Skip to content

Commit 38c8653

Browse files
committed
remove change value props
1 parent 6b34a8d commit 38c8653

19 files changed

+34
-78
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { DateTimeComp } from "comps/comps/tableComp/column/columnTypeComps/columnDateTimeComp";
22
import { TimeComp } from "./columnTypeComps/columnTimeComp";
3-
import { ButtonComp } from "comps/comps/tableComp/column/simpleColumnTypeComps";
3+
import { ButtonComp } from "./simpleColumnTypeComps";
44
import { withType } from "comps/generators";
55
import { trans } from "i18n";
66
import { Dropdown } from "lowcoder-design/src/components/Dropdown";

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

Lines changed: 10 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -28,25 +28,21 @@ type ViewValueFnType<ChildrenCtorMap extends Record<string, CompConstructor<unkn
2828
nodeValue: RecordConstructorToNodeValue<ChildrenCtorMap>
2929
) => JSONValue;
3030

31-
type NewChildrenCtorMap<ChildrenCtorMap, T extends JSONValue> = ChildrenCtorMap & {
32-
changeValue: ReturnType<typeof stateComp<T | null>>;
33-
};
34-
3531
export type ColumnTypeViewFn<ChildrenCtroMap, T extends JSONValue, ViewReturn> = ViewFnTypeForComp<
3632
ViewReturn,
37-
RecordConstructorToComp<NewChildrenCtorMap<ChildrenCtroMap, T>>
33+
RecordConstructorToComp<ChildrenCtroMap>
3834
>;
3935

4036
export class ColumnTypeCompBuilder<
4137
ChildrenCtorMap extends Record<string, CompConstructor<unknown>>,
4238
T extends JSONValue = JSONValue
4339
> {
44-
private childrenMap: NewChildrenCtorMap<ChildrenCtorMap, T>;
40+
private childrenMap: ChildrenCtorMap;
4541
private propertyViewFn?: PropertyViewFnTypeForComp<
46-
RecordConstructorToComp<NewChildrenCtorMap<ChildrenCtorMap, T>>
42+
RecordConstructorToComp<ChildrenCtorMap>
4743
>;
4844
private stylePropertyViewFn?: PropertyViewFnTypeForComp<
49-
RecordConstructorToComp<NewChildrenCtorMap<ChildrenCtorMap, T>>
45+
RecordConstructorToComp<ChildrenCtorMap>
5046
>;
5147
private cleanupFunctions: (() => void)[] = [];
5248

@@ -56,7 +52,7 @@ export class ColumnTypeCompBuilder<
5652
private displayValueFn: ViewValueFnType<ChildrenCtorMap>,
5753
private baseValueFn?: ColumnTypeViewFn<ChildrenCtorMap, T, T>
5854
) {
59-
this.childrenMap = { ...childrenMap, changeValue: stateComp<T | null>(null) };
55+
this.childrenMap = { ...childrenMap } as ChildrenCtorMap;
6056
}
6157

6258
setEditViewFn(_: any) {
@@ -66,7 +62,7 @@ export class ColumnTypeCompBuilder<
6662

6763
setPropertyViewFn(
6864
propertyViewFn: PropertyViewFnTypeForComp<
69-
RecordConstructorToComp<NewChildrenCtorMap<ChildrenCtorMap, T>>
65+
RecordConstructorToComp<ChildrenCtorMap>
7066
>
7167
) {
7268
this.propertyViewFn = propertyViewFn;
@@ -75,7 +71,7 @@ export class ColumnTypeCompBuilder<
7571

7672
setStylePropertyViewFn(
7773
stylePropertyViewFn: PropertyViewFnTypeForComp<
78-
RecordConstructorToComp<NewChildrenCtorMap<ChildrenCtorMap, T>>
74+
RecordConstructorToComp<ChildrenCtorMap>
7975
>
8076
) {
8177
this.stylePropertyViewFn = stylePropertyViewFn;
@@ -92,17 +88,7 @@ export class ColumnTypeCompBuilder<
9288
(props: any, dispatch: any) => {
9389
const baseValue = this.baseValueFn?.(props, dispatch);
9490
const normalView = this.viewFn(props, dispatch);
95-
return (
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
105-
);
91+
return normalView;
10692
},
10793
(props) => {
10894
let safeOptions = [];
@@ -139,8 +125,8 @@ export class ColumnTypeCompBuilder<
139125
(cellProps) => memoizedViewFn({ ...props, ...cellProps } as any, dispatch);
140126

141127
const ColumnTypeCompTmp = new MultiCompBuilder(
142-
this.childrenMap as ToConstructor<
143-
RecordConstructorToComp<NewChildrenCtorMap<ChildrenCtorMap, T>>
128+
(this.childrenMap as unknown) as ToConstructor<
129+
RecordConstructorToComp<ChildrenCtorMap>
144130
>,
145131
viewFn
146132
)

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ export const ColumnNumberComp = (function () {
153153
return new ColumnTypeCompBuilder(
154154
childrenMap,
155155
(props, dispatch) => {
156-
const value = props.changeValue ?? getBaseValue(props, dispatch);
156+
const value = getBaseValue(props, dispatch);
157157
return <ColumnNumberView value={value} {...props} />;
158158
},
159159
(nodeValue) => nodeValue.text.value,

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ export const BooleanComp = (function () {
151151
return new ColumnTypeCompBuilder(
152152
childrenMap,
153153
(props, dispatch) => {
154-
const value = props.changeValue ?? getBaseValue(props, dispatch);
154+
const value = getBaseValue(props, dispatch);
155155
return (
156156
<CheckBoxView
157157
value={value}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,7 @@ export const DateComp = (function () {
255255
return new ColumnTypeCompBuilder(
256256
childrenMap,
257257
(props, dispatch) => {
258-
const value = props.changeValue ?? getBaseValue(props, dispatch);
258+
const value = getBaseValue(props, dispatch);
259259
return formatDate(value, props.format);
260260
},
261261
(nodeValue) => formatDate(nodeValue.text.value, nodeValue.format.value),

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ export const DateTimeComp = (function () {
6363
return new ColumnTypeCompBuilder(
6464
childrenMap,
6565
(props, dispatch) => {
66-
const value = props.changeValue ?? getBaseValue(props, dispatch);
66+
const value = getBaseValue(props, dispatch);
6767
return formatDate(value, props.format);
6868
},
6969
(nodeValue) => formatDate(nodeValue.text.value, nodeValue.format.value),

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ export const ImageComp = (function () {
112112
return new ColumnTypeCompBuilder(
113113
childrenMap,
114114
(props, dispatch) => {
115-
const value = props.changeValue ?? getBaseValue(props, dispatch);
115+
const value = getBaseValue(props, dispatch);
116116
return <ImageView src={value} size={props.size} onEvent={props.onEvent} />;
117117
},
118118
(nodeValue) => nodeValue.src.value,

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ const LinkCompTmp = (function () {
111111
return new ColumnTypeCompBuilder(
112112
childrenMap,
113113
(props, dispatch) => {
114-
const value = props.changeValue ?? getBaseValue(props, dispatch);
114+
const value = getBaseValue(props, dispatch);
115115
return <ColumnLink disabled={props.disabled} label={value} onClick={props.onClick} />;
116116
},
117117
(nodeValue) => nodeValue.text.value,

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ export const ColumnMarkdownComp = (function () {
102102
return new ColumnTypeCompBuilder(
103103
childrenMap,
104104
(props, dispatch) => {
105-
const value = props.changeValue ?? getBaseValue(props, dispatch);
105+
const value = getBaseValue(props, dispatch);
106106
return <MarkdownView value={value} onEvent={props.onEvent} />;
107107
},
108108
(nodeValue) => nodeValue.text.value,

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ export const ProgressComp = (function () {
128128
return new ColumnTypeCompBuilder(
129129
childrenMap,
130130
(props, dispatch) => {
131-
const value = props.changeValue ?? getBaseValue(props, dispatch);
131+
const value = getBaseValue(props, dispatch);
132132
const Progress = () => {
133133
const style = useStyle(ProgressStyle);
134134
return (

0 commit comments

Comments
 (0)