Skip to content

Commit 18a93cf

Browse files
committed
remove edit functionality from columns
1 parent a909c64 commit 18a93cf

File tree

10 files changed

+29
-104
lines changed

10 files changed

+29
-104
lines changed

client/packages/lowcoder/src/comps/comps/tableLiteComp/column/columnTypeComp.tsx

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import { CellProps } from "components/table/EditableCell";
21
import { DateTimeComp } from "comps/comps/tableComp/column/columnTypeComps/columnDateTimeComp";
32
import { TimeComp } from "./columnTypeComps/columnTimeComp";
43
import { ButtonComp } from "comps/comps/tableComp/column/simpleColumnTypeComps";
@@ -23,6 +22,18 @@ import { ColumnNumberComp } from "./columnTypeComps/ColumnNumberComp";
2322
import { ColumnAvatarsComp } from "./columnTypeComps/columnAvatarsComp";
2423
import { ColumnDropdownComp } from "./columnTypeComps/columnDropdownComp";
2524

25+
export type CellProps = {
26+
editable?: boolean;
27+
tableSize?: string;
28+
candidateTags?: string[];
29+
candidateStatus?: { text: string; status: any }[];
30+
textOverflow?: boolean;
31+
cellTooltip?: string;
32+
editMode?: string;
33+
onTableEvent?: (eventName: any) => void;
34+
cellIndex?: string;
35+
};
36+
2637
const actionOptions = [
2738
{
2839
label: trans("table.avatars"),

client/packages/lowcoder/src/comps/comps/tableLiteComp/column/columnTypeCompBuilder.tsx

Lines changed: 13 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,4 @@
1-
import {
2-
CellViewReturn,
3-
EditableCell,
4-
EditViewFn,
5-
TABLE_EDITABLE_SWITCH_ON,
6-
} from "components/table/EditableCell";
1+
import { CellViewReturn } from "components/table/EditableCell";
72
import { stateComp } from "comps/generators";
83
import {
94
MultiCompBuilder,
@@ -53,7 +48,6 @@ export class ColumnTypeCompBuilder<
5348
private stylePropertyViewFn?: PropertyViewFnTypeForComp<
5449
RecordConstructorToComp<NewChildrenCtorMap<ChildrenCtorMap, T>>
5550
>;
56-
private editViewFn?: EditViewFn<T>;
5751
private cleanupFunctions: (() => void)[] = [];
5852

5953
constructor(
@@ -65,10 +59,8 @@ export class ColumnTypeCompBuilder<
6559
this.childrenMap = { ...childrenMap, changeValue: stateComp<T | null>(null) };
6660
}
6761

68-
setEditViewFn(editViewFn: NonNullable<typeof this.editViewFn>) {
69-
if (TABLE_EDITABLE_SWITCH_ON) {
70-
this.editViewFn = editViewFn;
71-
}
62+
setEditViewFn(_: any) {
63+
// Edit views are disabled in Table Lite; keep chainability without storing
7264
return this;
7365
}
7466

@@ -101,14 +93,15 @@ export class ColumnTypeCompBuilder<
10193
const baseValue = this.baseValueFn?.(props, dispatch);
10294
const normalView = this.viewFn(props, dispatch);
10395
return (
104-
<EditableCell<T>
105-
{...props}
106-
normalView={normalView}
107-
dispatch={dispatch}
108-
baseValue={baseValue}
109-
changeValue={props.changeValue as any}
110-
editViewFn={this.editViewFn}
111-
/>
96+
// <EditableCell<T>
97+
// {...props}
98+
// normalView={normalView}
99+
// dispatch={dispatch}
100+
// baseValue={baseValue}
101+
// changeValue={props.changeValue as any}
102+
// editViewFn={this.editViewFn}
103+
// />
104+
normalView
112105
);
113106
},
114107
(props) => {
@@ -155,7 +148,6 @@ export class ColumnTypeCompBuilder<
155148
.build();
156149

157150
const displayValueFn = this.displayValueFn;
158-
const editViewFn = this.editViewFn;
159151

160152
return class extends ColumnTypeCompTmp {
161153
// table cell data
@@ -193,7 +185,7 @@ export class ColumnTypeCompBuilder<
193185
}
194186

195187
static canBeEditable() {
196-
return !_.isNil(editViewFn);
188+
return false;
197189
}
198190

199191
componentWillUnmount() {

client/packages/lowcoder/src/comps/comps/tableLiteComp/column/columnTypeComps/ColumnNumberComp.tsx

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -159,19 +159,6 @@ export const ColumnNumberComp = (function () {
159159
(nodeValue) => nodeValue.text.value,
160160
getBaseValue
161161
)
162-
.setEditViewFn((props) => {
163-
const { value, onChange, onChangeEnd, otherProps } = props;
164-
return (
165-
<ColumnNumberEdit
166-
value={value}
167-
onChange={onChange}
168-
onChangeEnd={onChangeEnd}
169-
step={otherProps?.step ?? 1}
170-
precision={otherProps?.precision ?? 0}
171-
float={otherProps?.float ?? false}
172-
/>
173-
);
174-
})
175162
.setPropertyViewFn((children) => {
176163
return (
177164
<>

client/packages/lowcoder/src/comps/comps/tableLiteComp/column/columnTypeComps/columnBooleanComp.tsx

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -165,15 +165,6 @@ export const BooleanComp = (function () {
165165
(nodeValue) => nodeValue.text.value,
166166
getBaseValue
167167
)
168-
.setEditViewFn((props) => {
169-
return (
170-
<CheckBoxEdit
171-
value={props.value}
172-
onChange={props.onChange}
173-
onChangeEnd={props.onChangeEnd}
174-
/>
175-
);
176-
})
177168
.setPropertyViewFn((children) => {
178169
return (
179170
<>

client/packages/lowcoder/src/comps/comps/tableLiteComp/column/columnTypeComps/columnProgressComp.tsx

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -140,15 +140,6 @@ export const ProgressComp = (function () {
140140
(nodeValue) => nodeValue.text.value,
141141
getBaseValue
142142
)
143-
.setEditViewFn((props) => {
144-
return (
145-
<ProgressEdit
146-
value={props.value}
147-
onChange={props.onChange}
148-
onChangeEnd={props.onChangeEnd}
149-
/>
150-
);
151-
})
152143
.setPropertyViewFn((children) => {
153144
return (
154145
<>

client/packages/lowcoder/src/comps/comps/tableLiteComp/column/columnTypeComps/columnRatingComp.tsx

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -116,15 +116,6 @@ export const RatingComp = (function () {
116116
(nodeValue) => nodeValue.text.value,
117117
getBaseValue
118118
)
119-
.setEditViewFn((props) => {
120-
return (
121-
<RatingEdit
122-
value={props.value}
123-
onChange={props.onChange}
124-
onChangeEnd={props.onChangeEnd}
125-
/>
126-
);
127-
})
128119
.setPropertyViewFn((children) => {
129120
return (
130121
<>

client/packages/lowcoder/src/comps/comps/tableLiteComp/column/columnTypeComps/columnSelectComp.tsx

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -201,19 +201,6 @@ export const ColumnSelectComp = (function () {
201201
(nodeValue) => nodeValue.text.value,
202202
getBaseValue,
203203
)
204-
.setEditViewFn((props) => {
205-
return (
206-
<Wrapper>
207-
<SelectEdit
208-
initialValue={props.value}
209-
options={props.otherProps?.options || []}
210-
onChange={props.onChange}
211-
onChangeEnd={props.onChangeEnd}
212-
onMainEvent={props.otherProps?.onEvent}
213-
/>
214-
</Wrapper>
215-
)
216-
})
217204
.setPropertyViewFn((children) => {
218205
return (
219206
<>

client/packages/lowcoder/src/comps/comps/tableLiteComp/column/columnTypeComps/columnSwitchComp.tsx

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -131,26 +131,6 @@ export const SwitchComp = (function () {
131131
(nodeValue) => nodeValue.switchState.value,
132132
getBaseValue
133133
)
134-
.setEditViewFn((props) => {
135-
return (
136-
<Wrapper
137-
onBlur={() => {
138-
props.onChangeEnd()
139-
}}
140-
>
141-
<Switch
142-
autoFocus
143-
defaultChecked={props.value}
144-
disabled={false}
145-
onChange={(checked, e) => {
146-
props.onChange(checked);
147-
props.otherProps?.onEvent?.("change");
148-
props.otherProps?.onEvent?.(checked ? "true" : "false");
149-
}}
150-
/>
151-
</Wrapper>
152-
);
153-
})
154134
.setPropertyViewFn((children) => {
155135
return (
156136
<>

client/packages/lowcoder/src/comps/comps/tableLiteComp/column/columnTypeComps/simpleTextComp.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,5 @@ export const SimpleTextComp = new ColumnTypeCompBuilder(
116116
(nodeValue) => nodeValue.text.value,
117117
getBaseValue
118118
)
119-
.setEditViewFn((props) => <SimpleTextEditView {...props} />)
120119
.setPropertyViewFn((children) => <SimpleTextPropertyView children={children} />)
121120
.build();

client/packages/lowcoder/src/comps/comps/tableLiteComp/column/tableColumnComp.tsx

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,6 @@ export const columnChildrenMap = {
136136
align: HorizontalAlignmentControl,
137137
tempHide: stateComp<boolean>(false),
138138
fixed: dropdownControl(columnFixOptions, "close"),
139-
editable: BoolControl,
140139
background: withDefault(ColorControl, ""),
141140
margin: withDefault(RadiusControl, ""),
142141
text: withDefault(ColorControl, ""),
@@ -259,8 +258,6 @@ const ColumnPropertyView = React.memo(({
259258
label: trans("table.showTitle"),
260259
tooltip: trans("table.showTitleTooltip"),
261260
})}
262-
{ColumnTypeCompMap[columnType].canBeEditable() &&
263-
comp.children.editable.propertyView({ label: trans("table.editable") })}
264261
{comp.children.sortable.propertyView({
265262
label: trans("table.sortable"),
266263
})}
@@ -397,11 +394,10 @@ export class ColumnComp extends ColumnInitComp {
397394
override getView() {
398395
const superView = super.getView();
399396
const columnType = this.children.render.getSelectedComp().getComp().children.compType.getView();
400-
return {
401-
...superView,
402-
columnType,
403-
editable: ColumnTypeCompMap[columnType].canBeEditable() && superView.editable,
404-
};
397+
return {
398+
...superView,
399+
columnType,
400+
};
405401
}
406402

407403
exposingNode() {

0 commit comments

Comments
 (0)