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

Commit9d5e0aa

Browse files
committed
[Fix]:#1795 remove unnecessary code
1 parent7c17a48 commit9d5e0aa

File tree

2 files changed

+10
-58
lines changed

2 files changed

+10
-58
lines changed

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

Lines changed: 8 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -99,65 +99,16 @@ export class TableImplComp extends TableInitComp implements IContainer {
9999
}
100100

101101
downloadData(fileName:string){
102-
constallDisplayData=(thisasany).exposingValues["displayData"];
102+
// displayData already contains only visible columns (filtered in transformDispalyData)
103+
constdisplayData=(thisasany).exposingValues["displayData"];
103104
constdelimiter=this.children.toolbar.children.columnSeparator.getView();
104105

105-
try{
106-
// Build the set of visible column keys as shown to the user (title or dataIndex)
107-
constenableColumnSetting=this.children.toolbar.children.columnSetting.getView();
108-
constvisibleColumnKeys=newSet<string>();
109-
this.children.columns.getView().forEach((col)=>{
110-
constcolView=col.getView();
111-
constisHidden=columnHide({
112-
hide:colView.hide,
113-
tempHide:colView.tempHide,
114-
enableColumnSetting,
115-
});
116-
if(!isHidden){
117-
constheaderKey=(colView.titleasany)||colView.dataIndex;
118-
if(headerKey){
119-
visibleColumnKeys.add(String(headerKey));
120-
}
121-
}
122-
});
123-
124-
constpickVisible=(row:any):any=>{
125-
constresult:any={};
126-
// copy only allowed keys
127-
Object.keys(row||{}).forEach((key)=>{
128-
if(key!==COLUMN_CHILDREN_KEY&&visibleColumnKeys.has(key)){
129-
result[key]=row[key];
130-
}
131-
});
132-
// retain children recursively if present
133-
if(Array.isArray(row?.[COLUMN_CHILDREN_KEY])){
134-
constchildren=row[COLUMN_CHILDREN_KEY].map((r:any)=>pickVisible(r));
135-
if(children.length){
136-
result[COLUMN_CHILDREN_KEY]=children;
137-
}
138-
}
139-
returnresult;
140-
};
141-
142-
constdataToSave=Array.isArray(allDisplayData)
143-
?allDisplayData.map((r:any)=>pickVisible(r))
144-
:allDisplayData;
145-
146-
saveDataAsFile({
147-
data:dataToSave,
148-
filename:fileName,
149-
fileType:"csv",
150-
delimiter,
151-
});
152-
}catch(_e){
153-
// Fallback to previous behavior if anything goes wrong
154-
saveDataAsFile({
155-
data:allDisplayData,
156-
filename:fileName,
157-
fileType:"csv",
158-
delimiter,
159-
});
160-
}
106+
saveDataAsFile({
107+
data:displayData,
108+
filename:fileName,
109+
fileType:"csv",
110+
delimiter,
111+
});
161112
}
162113

163114
refreshData(allQueryNames:Array<string>,setLoading:(loading:boolean)=>void){

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,8 @@ export function transformDispalyData(
209209
returnoriDisplayData.map((row)=>{
210210
consttransData=_(row)
211211
.omit(OB_ROW_ORI_INDEX)
212-
.mapKeys((value,key)=>dataIndexTitleDict[key]||key)
212+
.pickBy((value,key)=>keyindataIndexTitleDict)// Only include columns in the dictionary
213+
.mapKeys((value,key)=>dataIndexTitleDict[key])
213214
.value();
214215
if(Array.isArray(row[COLUMN_CHILDREN_KEY])){
215216
return{

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp