plain-design 1.0.0-beta.133 → 1.0.0-beta.135

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (36) hide show
  1. package/dist/plain-design.commonjs.min.js +2 -18
  2. package/dist/plain-design.commonjs.min.js.LICENSE.txt +18 -0
  3. package/dist/plain-design.min.css +2 -1
  4. package/dist/plain-design.min.js +2 -18
  5. package/dist/plain-design.min.js.LICENSE.txt +18 -0
  6. package/dist/report.html +3 -3
  7. package/package.json +43 -40
  8. package/src/packages/components/$ai/index.tsx +214 -0
  9. package/src/packages/components/$configuration/index.tsx +2 -0
  10. package/src/packages/components/$file/index.tsx +43 -0
  11. package/src/packages/components/AiChatBox/ai-chat-box.scss +71 -0
  12. package/src/packages/components/AiChatBox/index.tsx +154 -0
  13. package/src/packages/components/AutoTable/auto-table.scss +4 -3
  14. package/src/packages/components/AutoTable/createTableOptionUser.tsx +3 -1
  15. package/src/packages/components/AutoTable/filter/useTableOption.filter.state.ts +4 -3
  16. package/src/packages/components/AutoTable/setting/useTableOption.setting.config.tsx +57 -15
  17. package/src/packages/components/AutoTable/setting/useTableOption.setting.export.tsx +2 -27
  18. package/src/packages/components/AutoTable/setting/useTableOption.setting.senior.filter.tsx +92 -92
  19. package/src/packages/components/AutoTable/setting/useTableOption.setting.senior.sort.tsx +14 -7
  20. package/src/packages/components/AutoTable/use/useTableOption.ai.tsx +485 -0
  21. package/src/packages/components/AutoTable/use/useTableOption.buttons.tsx +26 -16
  22. package/src/packages/components/AutoTable/use/useTableOption.methods.tsx +3 -0
  23. package/src/packages/components/AutoTable/use/useTableOption.sort.ts +4 -3
  24. package/src/packages/components/AutoTable/utils/AutoTable.utils.ts +75 -0
  25. package/src/packages/components/AutoTable/utils/TableOption.space.tsx +2 -1
  26. package/src/packages/components/FilterService/filter/filter.select.tsx +1 -0
  27. package/src/packages/components/Image/index.tsx +2 -2
  28. package/src/packages/components/ImageUploader/index.tsx +4 -4
  29. package/src/packages/components/PlcImage/index.tsx +5 -5
  30. package/src/packages/components/Table/editor/PlcSelect.tsx +1 -0
  31. package/src/packages/components/Table/table/use/useTableFormEditor.tsx +38 -34
  32. package/src/packages/components/Table/table/utils/table.utils.ts +1 -0
  33. package/src/packages/components/useDialog/DialogService.tsx +1 -1
  34. package/src/packages/entry.tsx +4 -0
  35. package/src/packages/i18n/lang/en-us.ts +23 -14
  36. package/src/packages/i18n/lang/zh-cn.ts +10 -1
@@ -86,7 +86,8 @@ export const useTableOptionFilterState = AutoModule.createRegistration(({ hooks,
86
86
  */
87
87
  const clearAll = async (reload?: boolean) => {
88
88
  await hooks.onClearFilter.exec(undefined);
89
- state.filters.forEach(i => i.clear());
89
+ /*等待所有filtersClear之后自动reload*/
90
+ await Promise.all(state.filters.map(i => i.clear()));
90
91
  reload !== false && await methods.pageMethods.reload();
91
92
  };
92
93
 
@@ -177,8 +178,8 @@ export interface iFilterStateInitialization<CacheData> {
177
178
  applyCache: (param: iTableOptionApplyCacheParam<CacheData>) => void, // 应用缓存
178
179
  getCache: (param: iTableOptionGetCacheParam) => any, // 获取缓存
179
180
  getActiveFilterCount: () => number, // 显示当前有多少激活的筛选条件
180
- getDisplay: () => (() => RenderNode), // 在【所有筛选】面板中展示
181
- clear: () => void, // 清空筛选条件
181
+ getDisplay: () => (() => RenderNode), // 在【所有筛选】面板中展示
182
+ clear: () => void | Promise<void>, // 清空筛选条件
182
183
  }
183
184
 
184
185
  /**
@@ -17,6 +17,8 @@ import {SelectOption} from "../../SelectOption";
17
17
  import '../utils/TableOption.space';
18
18
  import i18n from "../../i18n";
19
19
  import {AutoModule} from "../utils/AutoModule";
20
+ import {insertSort} from "@peryl/utils/insertSort";
21
+ import {iPlcConfigData, iPlcCustomData} from "../utils/AutoTable.utils";
20
22
 
21
23
  declare module '../utils/TableOption.space' {
22
24
  namespace TableOptionSpace {
@@ -47,6 +49,7 @@ export const useTableOptionSettingConfig = AutoModule.createRegistration((
47
49
  const sourceFlatPlcList = (await methods.getSourceFlatPlcList()).filter(i => !!i.props.field);
48
50
  state.getSourceFlatPlcList = () => sourceFlatPlcList;
49
51
  state.data = sourceFlatPlcList.map((plc, index): iPlcConfigData => ({
52
+ field: plc.props.field || "",
50
53
  title: plc.props.title,
51
54
  order: index,
52
55
  align: plc.props.align || 'left',
@@ -114,8 +117,59 @@ export const useTableOptionSettingConfig = AutoModule.createRegistration((
114
117
 
115
118
  const handler = {
116
119
  apply: () => {
117
- const hasOrderChange = state.data.some((i, idx) => i.order !== idx);
118
- state.data.forEach((item, index) => {
120
+ handler.updateItemPlc({ plcConfigData: state.data });
121
+ },
122
+ updateItemPlc: async (data: {
123
+ /*自定义的配置数据,可以仅配置部分字段*/
124
+ customData?: iPlcCustomData[],
125
+ /*如果配置的数据有调整字段的顺序,那么会按照customData来对字段进行排序*/
126
+ customSort?: boolean,
127
+
128
+ /*按照个性配置面板中的数据对字段进行配置*/
129
+ plcConfigData?: iPlcConfigData[],
130
+ }) => {
131
+ if (!state.data.length) {
132
+ await utils.resetData();
133
+ }
134
+ /*
135
+ * 如果传递了plcConfigData,则使用这个数据来更新配置;
136
+ * 否则如果传递了自定义数据customData,则用customData来生成plcConfigData
137
+ */
138
+ const plcConfigData: iPlcConfigData[] = data.plcConfigData || (() => {
139
+ if (!data.customData) {return [];}
140
+ const field2custom = data.customData.reduce((prev, item) => {
141
+ prev[item.field] = item;
142
+ return prev;
143
+ }, {} as Record<string, undefined | iPlcCustomData>);
144
+ return state.data.map((stateDataItem): iPlcConfigData => {
145
+ const customItemData: iPlcCustomData | undefined = !stateDataItem.field ? undefined : field2custom[stateDataItem.field];
146
+ if (!customItemData) {
147
+ return stateDataItem;
148
+ } else {
149
+ return {
150
+ ...stateDataItem,
151
+ ...customItemData,
152
+ };
153
+ }
154
+ });
155
+ })();
156
+
157
+ console.log({ customData: data.customData, plcConfigData });
158
+
159
+ if (!!data.customSort && !!data.customData) {
160
+ const field2customIndex = data.customData.reduce((prev, item, index) => {
161
+ prev[item.field] = index;
162
+ return prev;
163
+ }, {} as Record<string, undefined | number>);
164
+ insertSort(plcConfigData, (a, b) => {
165
+ const aIndex = field2customIndex[a.field] || 0;
166
+ const bIndex = field2customIndex[b.field] || 0;
167
+ return aIndex > bIndex;
168
+ });
169
+ }
170
+
171
+ const hasOrderChange = plcConfigData.some((i, idx) => i.order !== idx);
172
+ plcConfigData.forEach((item, index) => {
119
173
  const plcState = item.plcRef().getState();
120
174
  const plcProps = item.plcRef().props;
121
175
  if (hasOrderChange) {plcState.order = index;}
@@ -197,22 +251,10 @@ export const useTableOptionSettingConfig = AutoModule.createRegistration((
197
251
  )
198
252
  });
199
253
 
200
- return {};
254
+ return { methods: handler };
201
255
  });
202
256
 
203
257
 
204
- interface iPlcConfigData {
205
- title?: string,
206
- order: number,
207
- align: string,
208
- width: number,
209
- fixed: string,
210
- hide?: boolean,
211
-
212
- plcRef: () => tPlc,
213
- key: string,
214
- }
215
-
216
258
  interface iPlcConfigCacheData {
217
259
  [k: string]: Partial<Omit<iPlcConfigData, 'plcRef'>>;
218
260
  }
@@ -21,6 +21,7 @@ import {getPlcDisplayValue} from "../../Table/plc/utils/plc.utils";
21
21
  import '../utils/TableOption.space';
22
22
  import i18n from "../../i18n";
23
23
  import {AutoModule} from "../utils/AutoModule";
24
+ import $file from "../../$file";
24
25
 
25
26
  declare module '../utils/TableOption.space' {
26
27
  namespace TableOptionSpace {
@@ -102,33 +103,7 @@ export const useTableOptionSettingExport = AutoModule.createRegistration((
102
103
  }));
103
104
  }
104
105
 
105
- // 导出excel
106
- const [ExcelJs, FileSaver] = await Promise.all([
107
- $configuration.get('getExcelJS')?.(),
108
- $configuration.get('getFileSaver')?.()
109
- ]);
110
- if (!ExcelJs) {
111
- throw new Error('请在$configuration中提供exceljs依赖');
112
- }
113
- if (!FileSaver) {
114
- throw new Error('请在$configuration中提供filesaver依赖');
115
- }
116
- const workbook = new ExcelJs.Workbook();
117
- const worksheet = workbook.addWorksheet('sheet');
118
- worksheet.columns = [
119
- { header: 'Id', key: 'id', width: 10 },
120
- { header: 'Name', key: 'name', width: 32 },
121
- { header: 'D.O.B.', key: 'DOB', width: 10, outlineLevel: 1 }
122
- ];
123
- worksheet.columns = exportPlcData.map(({ title, field }) => ({ header: title, key: field }));
124
- exportData.forEach(data => {
125
- worksheet.addRow(data);
126
- });
127
- const buffer = await workbook.xlsx.writeBuffer();
128
- FileSaver.saveAs(
129
- new Blob([buffer], { type: 'application/vnd.ms-excel' }),
130
- `${plainDate.today('', 'YYYY-MM-DD').getValue()}.xlsx`
131
- );
106
+ await $file.export2file({ exportData, columns: exportPlcData.map(({ title, field }) => ({ header: title, key: field })) });
132
107
  };
133
108
 
134
109
  const exportPage: ExportOption = {
@@ -41,6 +41,7 @@ export const useTableOptionSettingSeniorFilter = AutoModule.createRegistration((
41
41
  const filterOptions = filterState.createComputedFilterOptions(eAutoTableFilterMode.filterSenior);
42
42
 
43
43
  const utils = {
44
+ /*按照F_1, F_2, F_3...的规则生成ID*/
44
45
  nextId: (() => {
45
46
  const maxCount = computed(() => {
46
47
  const max = edit.state.metas.reduce((prev, item) => {
@@ -52,18 +53,24 @@ export const useTableOptionSettingSeniorFilter = AutoModule.createRegistration((
52
53
  });
53
54
  return () => `F_${maxCount.value + 1}`;
54
55
  })(),
56
+ /*重置查询表达式*/
55
57
  resetOperator: () => {
56
- edit.state.expression = edit.defaultExpression.value;
58
+ edit.state.expression = edit.getDefaultExpression();
57
59
  },
60
+ /*创建初始状态变量*/
58
61
  createState: () => {
59
62
  const state: iTableOptionSeniorData = reactive({
63
+ /*iTableOptionSeniorFilterMeta*/
60
64
  metas: [],
65
+ /*查询表达式*/
61
66
  expression: null,
62
- isCustomExpression: false,
67
+ /*当前是否开启自定义表达式*/
68
+ isCustomExpression: true,
63
69
  });
64
- const defaultExpression = computed(() => state.metas.map(i => i.id).join(` ${DEFAULT_EXPRESSION_JOIN} `));
70
+ /*默认的查询表达式*/
71
+ const getDefaultExpression = (): string => state.metas.map(i => i.id).join(` ${DEFAULT_EXPRESSION_JOIN} `);
65
72
  return {
66
- state, defaultExpression,
73
+ state, getDefaultExpression,
67
74
  };
68
75
  },
69
76
  };
@@ -74,26 +81,28 @@ export const useTableOptionSettingSeniorFilter = AutoModule.createRegistration((
74
81
  * @date 2021/7/22 21:05
75
82
  */
76
83
  const query = (() => {
77
- const { state, defaultExpression } = utils.createState();
84
+ const { state, getDefaultExpression } = utils.createState();
78
85
 
79
- const apply = async () => {
86
+ const apply = async (autoReload: boolean) => {
80
87
  await delay();
81
88
  const dataList = refList.length === 0 ? [] : await Promise.all(refList.map(i => i.getData()));
82
89
  const metas = !isSettingSeniorOpen() ? edit.state.metas : dataList.map((data, index) => ({ data, id: edit.state.metas[index].id }));
90
+ /*检查每一个条件是否输入正确*/
83
91
  const invalidIndex = metas.findIndex(i => !i.data || !i.data.filterQueryParam || !i.data.filterQueryParam.queries?.length);
84
92
  if (invalidIndex > -1) {
85
- $message.error(i18n.$it('table.pleaseEnterCompleteParamsForCondition').d(`第${invalidIndex + 1}个条件请输入完整参数!`));
93
+ $message.error(i18n.$it('table.pleaseEnterCompleteParamsForCondition', { invalidIndex: invalidIndex + 1 }).d(`第${invalidIndex + 1}个条件请输入完整参数!`));
86
94
  return;
87
95
  }
88
96
  state.metas = metas;
89
97
  state.expression = edit.state.expression;
90
98
  state.isCustomExpression = edit.state.isCustomExpression;
91
- await methods.pageMethods.reload();
99
+
100
+ if (autoReload) {await methods.pageMethods.reload();}
92
101
  };
93
102
 
94
103
  return {
95
104
  state,
96
- defaultExpression,
105
+ getDefaultExpression,
97
106
  apply,
98
107
  };
99
108
  })();
@@ -111,10 +120,8 @@ export const useTableOptionSettingSeniorFilter = AutoModule.createRegistration((
111
120
  * @author 韦胜健
112
121
  * @date 2023.1.15 22:11
113
122
  */
114
- const { state, defaultExpression } = {
115
- state: reactive(deepcopy(query.state)),
116
- defaultExpression: query.defaultExpression,
117
- };
123
+ const { state, getDefaultExpression } = utils.createState();
124
+ Object.assign(state, query.state);
118
125
 
119
126
  const add = () => {
120
127
  const id = utils.nextId();
@@ -127,20 +134,20 @@ export const useTableOptionSettingSeniorFilter = AutoModule.createRegistration((
127
134
  };
128
135
 
129
136
  const remove = (index: number) => {
130
- const isMatchDefaultOperator = !!state.expression && state.expression.trim() === defaultExpression.value;
137
+ const isMatchDefaultOperator = !!state.expression && state.expression.trim() === getDefaultExpression();
131
138
  state.metas.splice(index, 1);
132
- if (isMatchDefaultOperator) {state.expression = defaultExpression.value;}
139
+ if (isMatchDefaultOperator) {state.expression = getDefaultExpression();}
133
140
  };
134
141
 
135
- const clear = () => {
136
- state.metas = [];
137
- state.expression = null;
138
- query.apply();
142
+ const clear = async (autoReload: boolean) => {
143
+ Object.assign(state, utils.createState().state);
144
+ await query.apply(autoReload);
139
145
  };
140
146
 
141
147
  return {
142
148
  state,
143
- defaultExpression,
149
+ getDefaultExpression,
150
+
144
151
  add,
145
152
  remove,
146
153
  clear,
@@ -185,14 +192,18 @@ export const useTableOptionSettingSeniorFilter = AutoModule.createRegistration((
185
192
  },
186
193
  render: () => {
187
194
  refList.splice(0, refList.length);
195
+
196
+ const apply = () => query.apply(true);
197
+ const clear = () => edit.clear(true);
198
+
188
199
  return (
189
200
  <div className="auto-table-setting-senior-filter">
190
201
  <div className="auto-table-setting-senior-filter-button">
191
202
  <div>
192
- <Button label={i18n.$it('base.edit.apply').d('应用')} onClick={query.apply} mode="fill" icon="pi-find-replace"/>
203
+ <Button label={i18n.$it('base.edit.apply').d('应用')} onClick={apply} mode="fill" icon="pi-find-replace"/>
193
204
  <Button label={i18n.$it('base.edit.add').d('添加')} onClick={edit.add} icon="pi-plus"/>
194
205
  </div>
195
- <Button label={i18n.$it('base.clear').d('清空')} icon="pi-delete" status="error" onClick={edit.clear}/>
206
+ <Button label={i18n.$it('base.clear').d('清空')} icon="pi-delete" status="error" onClick={clear}/>
196
207
  </div>
197
208
  <div className="auto-table-setting-senior-filter-list">
198
209
  {edit.state.metas.length === 0 ? (
@@ -204,7 +215,7 @@ export const useTableOptionSettingSeniorFilter = AutoModule.createRegistration((
204
215
  ref={onRefList(index)}
205
216
  filterOptions={filterOptions.value}
206
217
  initialState={meta.data}
207
- onSearch={query.apply}
218
+ onSearch={apply}
208
219
  width="calc(100% - 40px)"
209
220
  hideSearchButton
210
221
  v-slots={{
@@ -232,7 +243,7 @@ export const useTableOptionSettingSeniorFilter = AutoModule.createRegistration((
232
243
  * @date 2023.1.8 19:09
233
244
  */
234
245
  hooks.onQueryParam.use(async () => {
235
- let expression = !query.state.isCustomExpression || !query.state.expression ? query.defaultExpression.value : query.state.expression;
246
+ let expression = !query.state.isCustomExpression || !query.state.expression ? query.getDefaultExpression() : query.state.expression;
236
247
  /*处理空格*/
237
248
  expression = expression.replace(/\s*(\|\||&&|或者|并且|or|and)\s*/gi, ' $1 ').replace(/\s+/, ' ');
238
249
  /*目标queries数组*/
@@ -285,88 +296,77 @@ export const useTableOptionSettingSeniorFilter = AutoModule.createRegistration((
285
296
  <Icon icon="pi-arrow-right"/>
286
297
  </Button>
287
298
  ),
288
- clear: () => null,
299
+ clear: () => edit.clear(false),
289
300
  getActiveFilterCount: () => query.state.metas.length
290
301
  });
291
302
 
292
303
  const tips = computed((): TableOptionSpace.iTableOptionTipMeta[] => {
293
304
  const list: TableOptionSpace.iTableOptionTipMeta[] = [];
294
- const { metas, expression, isCustomExpression } = query.state;
305
+ const { metas } = query.state;
295
306
  if (!metas.length || !filterOptions.value) {return list;}
296
307
  if (metas.every(i => !i.data?.filterQueryParam.queries?.length)) {return list;}
297
- if (!isCustomExpression) {
298
- metas.forEach((meta, index) => {
299
- if (!meta.data) {return;}
300
- const { field, filterHandler, formData } = meta.data;
301
- let filterOption = filterOptions.value!.find(i => i.field === field);
302
- if (!filterOption) {return;}
303
- filterOption = { ...filterOption, filterHandler };
304
- const tip = TableOptionUtils.createTableOptionTipMeta({
305
- formData,
306
- filterOption,
307
- onClear: async () => {
308
- edit.remove(index);
309
- await delay();
310
- await query.apply();
311
- },
312
- onClick: () => {setting.openSetting(eTableOptionSettingView.seniorFilter);},
313
- });
314
- !!tip && list.push(tip);
315
- });
316
- } else {
317
- if (!expression || !filterOptions.value.length) {return list;}
318
- /*id映射senior meta查询参数*/
319
- const idToSeniorMeta: Record<string, iTableOptionSeniorFilterMeta & { index: number }> = query.state.metas.reduce((prev, item) => {
320
- prev[item.id] = item;
321
- return prev;
322
- }, {} as any);
323
- const renderList: (() => RenderNode)[] = [];
324
- expression.split(' ').forEach(work => {
325
- if (!work.trim().length) {return; }
326
- if (ExpressionJoins.indexOf(work) > -1) {
327
- renderList.push(() => work);
328
- return;
329
- }
330
- const senior = idToSeniorMeta[work];
331
- if (!senior || !senior.data) {
332
- renderList.push(() => work);
333
- return;
334
- }
335
- const { filterHandler, field, formData } = senior.data;
336
- let filterOption = filterOptions.value!.find(i => i.field === field);
337
- if (!filterOption) {
338
- renderList.push(() => work);
339
- return;
340
- }
341
- filterOption = { ...filterOption, filterHandler };
342
- const tip = TableOptionUtils.createTableOptionTipMeta({
343
- filterOption,
344
- formData,
345
- onClick: doNothing,
346
- onClear: doNothing,
347
- });
348
- if (!tip) {
349
- renderList.push(() => work);
350
- return;
351
- }
352
- renderList.push(tip.display);
353
- });
354
- list.push({
355
- display: () => renderList.map((i, index) => <Fragment key={index}>{i()}</Fragment>),
356
- onClear: async (e: iMouseEvent) => {
357
- e.stopPropagation();
358
- Object.assign(edit.state, utils.createState().state);
359
- await query.apply();
360
- },
361
- onClick: () => {setting.openSetting(eTableOptionSettingView.seniorFilter);},
308
+
309
+ let expression = !query.state.isCustomExpression || !query.state.expression ? query.getDefaultExpression() : query.state.expression;
310
+ /*处理空格*/
311
+ expression = expression.replace(/\s*(\|\||&&|或者|并且|or|and)\s*/gi, ' $1 ').replace(/\s+/, ' ');
312
+
313
+ if (!expression || !filterOptions.value.length) {return list;}
314
+ /*id映射senior meta查询参数*/
315
+ const idToSeniorMeta: Record<string, iTableOptionSeniorFilterMeta & { index: number }> = query.state.metas.reduce((prev, item) => {
316
+ prev[item.id] = item;
317
+ return prev;
318
+ }, {} as any);
319
+ const renderList: (() => RenderNode)[] = [];
320
+ expression.split(' ').forEach(work => {
321
+ if (!work.trim().length) {return; }
322
+ if (ExpressionJoins.indexOf(work) > -1) {
323
+ renderList.push(() => ` ${work} `);
324
+ return;
325
+ }
326
+ const senior = idToSeniorMeta[work];
327
+ if (!senior || !senior.data) {
328
+ renderList.push(() => work);
329
+ return;
330
+ }
331
+ const { filterHandler, field, formData } = senior.data;
332
+ let filterOption = filterOptions.value!.find(i => i.field === field);
333
+ if (!filterOption) {
334
+ renderList.push(() => work);
335
+ return;
336
+ }
337
+ filterOption = { ...filterOption, filterHandler };
338
+ const tip = TableOptionUtils.createTableOptionTipMeta({
339
+ filterOption,
340
+ formData,
341
+ onClick: doNothing,
342
+ onClear: doNothing,
362
343
  });
363
- }
344
+ if (!tip) {
345
+ renderList.push(() => work);
346
+ return;
347
+ }
348
+ renderList.push(tip.display);
349
+ });
350
+ list.push({
351
+ display: () => renderList.map((i, index) => <Fragment key={index}>{i()}</Fragment>),
352
+ onClear: async (e: iMouseEvent) => {
353
+ e.stopPropagation();
354
+ await edit.clear(true);
355
+ },
356
+ onClick: () => {setting.openSetting(eTableOptionSettingView.seniorFilter);},
357
+ });
358
+
364
359
  return list;
365
360
  });
366
361
 
367
362
  hooks.onTips.use(list => {
368
363
  !!tips.value.length && list.push(...tips.value);
369
364
  });
365
+
366
+ return {
367
+ query,
368
+ edit,
369
+ };
370
370
  });
371
371
 
372
372
  export type iTableOptionSeniorFilterMeta = {
@@ -57,15 +57,21 @@ export const useTableOptionSettingSeniorSort = AutoModule.createRegistration((
57
57
  const handler = {
58
58
  add: (val: { field: string, title: string }) => {state.data.push({ ...val, desc: true });},
59
59
  remove: (index: number) => {state.data.splice(index, 1);},
60
- apply: () => {
61
- sortState.useSenior([...state.data]);
60
+ apply: (autoReload: boolean) => {
61
+ sortState.useSenior([...state.data], autoReload);
62
62
  },
63
- clear: () => {
64
- state.data = [];
65
- handler.apply();
63
+ update(sortData: iTableOptionSortMeta[], autoReload: boolean) {
64
+ state.data = sortData;
65
+ handler.apply(autoReload);
66
+ },
67
+ clear: (autoReload: boolean) => {
68
+ handler.update([], autoReload);
66
69
  },
67
70
  };
68
71
 
72
+ const applyAndReload = () => handler.apply(true);
73
+ const clearAndReload = () => handler.clear(true);
74
+
69
75
  setting.useTableOptionSettingInner({
70
76
  key: eTableOptionSettingView.sort,
71
77
  title: i18n.$it('table.seniorSort').d('高级排序'),
@@ -88,7 +94,7 @@ export const useTableOptionSettingSeniorSort = AutoModule.createRegistration((
88
94
  <div className="auto-table-setting-senior-sort" key="senior-sort">
89
95
  <div className="auto-table-setting-senior-sort-header">
90
96
  <div>
91
- <Button label={i18n.$it('base.edit.apply').d("应用")} mode="fill" icon="pi-find-replace" onClick={handler.apply}/>
97
+ <Button label={i18n.$it('base.edit.apply').d("应用")} mode="fill" icon="pi-find-replace" onClick={applyAndReload}/>
92
98
  {!!availablePlcOptions.value.length && (
93
99
  <Dropdown
94
100
  v-slots={{
@@ -100,7 +106,7 @@ export const useTableOptionSettingSeniorSort = AutoModule.createRegistration((
100
106
  />
101
107
  )}
102
108
  </div>
103
- <Button label={i18n.$it('base.clear').d("清空")} icon="pi-delete" status="error" onClick={handler.clear}/>
109
+ <Button label={i18n.$it('base.clear').d("清空")} icon="pi-delete" status="error" onClick={clearAndReload}/>
104
110
  </div>
105
111
  <Table data={state.data} defaultEditable editSourceData>
106
112
  <PlcDraggier v-model={state.data}/>
@@ -113,4 +119,5 @@ export const useTableOptionSettingSeniorSort = AutoModule.createRegistration((
113
119
  },
114
120
  });
115
121
 
122
+ return { methods: handler };
116
123
  });