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

Commitadccc16

Browse files
committed
[Feat]:#1979 expose hide/showcolumns methods
1 parent0e5aa97 commitadccc16

File tree

1 file changed

+73
-0
lines changed

1 file changed

+73
-0
lines changed

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

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -822,6 +822,55 @@ TableTmpComp = withMethodExposing(TableTmpComp, [
822822
}
823823
},
824824
}
825+
,
826+
{
827+
method:{
828+
name:"hideColumns",
829+
description:"Hide specified columns by dataIndex or title",
830+
params:[
831+
{name:"columns",type:"arrayString"},
832+
],
833+
},
834+
execute:(comp,values)=>{
835+
constcolumns=values[0];
836+
if(!isArray(columns)){
837+
returnPromise.reject("hideColumns expects an array of strings, e.g. ['id','name']");
838+
}
839+
consttargets=newSet((columnsasany[]).map((c)=>String(c)));
840+
comp.children.columns.getView().forEach((c)=>{
841+
constview=c.getView();
842+
if(targets.has(view.dataIndex)||targets.has(view.title)){
843+
// Ensure both persistent and temporary flags are updated
844+
c.children.hide.dispatchChangeValueAction(true);
845+
c.children.tempHide.dispatchChangeValueAction(true);
846+
}
847+
});
848+
},
849+
}
850+
,
851+
{
852+
method:{
853+
name:"showColumns",
854+
description:"Show specified columns by dataIndex or title",
855+
params:[
856+
{name:"columns",type:"arrayString"},
857+
],
858+
},
859+
execute:(comp,values)=>{
860+
constcolumns=values[0];
861+
if(!isArray(columns)){
862+
returnPromise.reject("showColumns expects an array of strings, e.g. ['id','name']");
863+
}
864+
consttargets=newSet((columnsasany[]).map((c)=>String(c)));
865+
comp.children.columns.getView().forEach((c)=>{
866+
constview=c.getView();
867+
if(targets.has(view.dataIndex)||targets.has(view.title)){
868+
c.children.hide.dispatchChangeValueAction(false);
869+
c.children.tempHide.dispatchChangeValueAction(false);
870+
}
871+
});
872+
},
873+
}
825874
]);
826875

827876
// exposing data
@@ -1052,6 +1101,30 @@ export const TableComp = withExposingConfigs(TableTmpComp, [
10521101
},
10531102
trans("table.displayDataDesc")
10541103
),
1104+
newCompDepsConfig(
1105+
"hiddenColumns",
1106+
(comp)=>{
1107+
return{
1108+
dataIndexes:comp.children.columns.getColumnsNode("dataIndex"),
1109+
hides:comp.children.columns.getColumnsNode("hide"),
1110+
tempHides:comp.children.columns.getColumnsNode("tempHide"),
1111+
columnSetting:comp.children.toolbar.children.columnSetting.node(),
1112+
};
1113+
},
1114+
(input)=>{
1115+
consthidden:string[]=[];
1116+
_.forEach(input.dataIndexes,(dataIndex,idx)=>{
1117+
constisHidden=columnHide({
1118+
hide:input.hides[idx].value,
1119+
tempHide:input.tempHides[idx],
1120+
enableColumnSetting:input.columnSetting.value,
1121+
});
1122+
if(isHidden)hidden.push(dataIndex);
1123+
});
1124+
returnhidden;
1125+
},
1126+
trans("table.displayDataDesc")
1127+
),
10551128
newDepsConfig(
10561129
"filter",
10571130
(children)=>{

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp