Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit5c225cc

Browse files
column data mapping
1 parent2344a04 commit5c225cc

File tree

4 files changed

+77
-2
lines changed

4 files changed

+77
-2
lines changed

‎client/packages/lowcoder/src/comps/comps/tableComp/column/columnTypeComp.tsx‎

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import{CellProps}from"components/table/EditableCell";
22
import{DateTimeComp}from"comps/comps/tableComp/column/columnTypeComps/columnDateTimeComp";
33
import{ButtonComp}from"comps/comps/tableComp/column/simpleColumnTypeComps";
4-
import{withType}from"comps/generators";
4+
import{MultiCompBuilder,withDefault,withType}from"comps/generators";
55
import{trans}from"i18n";
66
import{Dropdown}from"lowcoder-design";
77
import{BooleanComp}from"./columnTypeComps/columnBooleanComp";
@@ -17,6 +17,31 @@ import { ColumnTagsComp } from "./columnTypeComps/columnTagsComp";
1717
import{ColumnSelectComp}from"./columnTypeComps/columnSelectComp";
1818
import{SimpleTextComp}from"./columnTypeComps/simpleTextComp";
1919
import{ColumnNumberComp}from"./columnTypeComps/ColumnNumberComp";
20+
import{useState}from"react";
21+
import{dropdownControl}from"@lowcoder-ee/index.sdk";
22+
23+
constcolumnValueOptions=[
24+
{
25+
label:"ID",
26+
value:"{{currentRow.id}}",
27+
},
28+
{
29+
label:"Name",
30+
value:"{{currentRow.name}}",
31+
},
32+
{
33+
label:"Department",
34+
value:"{{currentRow.department}}",
35+
},
36+
{
37+
label:"Date",
38+
value:"{{currentRow.date}}",
39+
},
40+
{
41+
label:"Other",
42+
value:"",
43+
},
44+
]asconst;
2045

2146
constactionOptions=[
2247
{
@@ -104,6 +129,15 @@ export type ColumnTypeKeys = keyof ColumnTypeMapType;
104129

105130
constTypedColumnTypeComp=withType(ColumnTypeCompMap,"text");
106131

132+
constchildrenMap={
133+
comp:TypedColumnTypeComp,
134+
valueMap:dropdownControl(columnValueOptions,"")
135+
};
136+
137+
constTmpColumnTypeComp=newMultiCompBuilder(childrenMap,(props)=>{
138+
returnprops;
139+
}).build();
140+
107141
exportclassColumnTypeCompextendsTypedColumnTypeComp{
108142
overridegetView(){
109143
constchildView=this.children.comp.getView();

‎client/packages/lowcoder/src/comps/comps/tableComp/column/tableColumnComp.tsx‎

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,29 @@ const columnFixOptions = [
5757
},
5858
]asconst;
5959

60+
constcolumnValueOptions=[
61+
{
62+
label:"ID",
63+
value:"{{currentRow.id}}",
64+
},
65+
{
66+
label:"Name",
67+
value:"{{currentRow.name}}",
68+
},
69+
{
70+
label:"Department",
71+
value:"{{currentRow.department}}",
72+
},
73+
{
74+
label:"Date",
75+
value:"{{currentRow.date}}",
76+
},
77+
{
78+
label:"Other",
79+
value:"",
80+
},
81+
]asconst;
82+
6083
constcellColorLabel=trans("table.cellColor");
6184
constCellColorTempComp=withContext(
6285
newMultiCompBuilder({color:ColorOrBoolCodeControl},(props)=>props.color)
@@ -94,6 +117,7 @@ export const columnChildrenMap = {
94117
sortable:BoolControl,
95118
width:NumberControl,
96119
autoWidth:dropdownControl(columnWidthOptions,"auto"),
120+
columnMapping:dropdownControl(columnValueOptions,""),
97121
render:RenderComp,
98122
align:HorizontalAlignmentControl,
99123
tempHide:stateComp<boolean>(false),
@@ -195,6 +219,21 @@ export class ColumnComp extends ColumnInitComp {
195219
label:trans("table.columnTitle"),
196220
placeholder:this.children.dataIndex.getView(),
197221
})}
222+
{this.children.columnMapping.propertyView({
223+
label:"Data Mapping",
224+
onChange:(value)=>{
225+
console.log(value)
226+
constcomp=this.children.render.getSelectedComp().getComp();
227+
// let textRawData = "{{currentCell}}";
228+
// if (comp.children.hasOwnProperty("text")) {
229+
// textRawData = (comp.children as any).text.toJsonValue();
230+
// }
231+
this.children.render.dispatchChangeValueAction({
232+
compType:columnType,
233+
comp:{text:value},
234+
}asany);
235+
}
236+
})}
198237
{/* FIXME: cast type currently, return type of withContext should be corrected later */}
199238
{this.children.render.getPropertyView()}
200239
{this.children.showTitle.propertyView({

‎client/packages/lowcoder/src/comps/comps/tableComp/tableUtils.tsx‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -271,6 +271,7 @@ export function columnsToAntdFormat(
271271
columnsAggrData:ColumnsAggrData,
272272
onTableEvent:(eventName:any)=>void,
273273
):Array<CustomColumnType<RecordType>>{
274+
console.log(columnsAggrData);
274275
constsortMap:Map<string|undefined,SortOrder>=newMap(
275276
sort.map((s)=>[s.column,s.desc ?"descend" :"ascend"])
276277
);

‎client/packages/lowcoder/src/comps/controls/dropdownControl.tsx‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,15 +92,16 @@ export function dropdownAbstractControl<T extends OptionsType>(
9292
returncontrolItem(
9393
{filterText:params.label},
9494
<DropdownPropertyView<T>
95+
{...params}
9596
value={this.value}
9697
options={finalOptions}
9798
onChange={(value)=>{
99+
console.log(value);
98100
if(!params.disableDispatchValueChange){
99101
this.dispatchChangeValueAction(value);
100102
}
101103
params.onChange?.(value);
102104
}}
103-
{...params}
104105
/>
105106
);
106107
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp