namirasoft-account-react 1.4.418 → 1.4.421

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 (74) hide show
  1. package/dist/IEntityInfo.d.ts +3 -1
  2. package/dist/NSACacheService.d.ts +3 -0
  3. package/dist/NSACacheService.js +13 -0
  4. package/dist/NSACacheService.js.map +1 -1
  5. package/dist/NSAFilterOperators.d.ts +28 -0
  6. package/dist/NSAFilterOperators.js +50 -0
  7. package/dist/NSAFilterOperators.js.map +1 -0
  8. package/dist/components/NSAQuickFilter/NSAFilterBoxBase.d.ts +14 -0
  9. package/dist/components/NSAQuickFilter/NSAFilterBoxBase.js +40 -0
  10. package/dist/components/NSAQuickFilter/NSAFilterBoxBase.js.map +1 -0
  11. package/dist/components/NSAQuickFilter/NSAFilterBoxBoolean.d.ts +12 -0
  12. package/dist/components/NSAQuickFilter/NSAFilterBoxBoolean.js +30 -0
  13. package/dist/components/NSAQuickFilter/NSAFilterBoxBoolean.js.map +1 -0
  14. package/dist/components/NSAQuickFilter/NSAFilterBoxDate.d.ts +12 -0
  15. package/dist/components/NSAQuickFilter/NSAFilterBoxDate.js +58 -0
  16. package/dist/components/NSAQuickFilter/NSAFilterBoxDate.js.map +1 -0
  17. package/dist/components/NSAQuickFilter/NSAFilterBoxDateTime.d.ts +12 -0
  18. package/dist/components/NSAQuickFilter/NSAFilterBoxDateTime.js +58 -0
  19. package/dist/components/NSAQuickFilter/NSAFilterBoxDateTime.js.map +1 -0
  20. package/dist/components/NSAQuickFilter/NSAFilterBoxEnum.d.ts +22 -0
  21. package/dist/components/NSAQuickFilter/NSAFilterBoxEnum.js +52 -0
  22. package/dist/components/NSAQuickFilter/NSAFilterBoxEnum.js.map +1 -0
  23. package/dist/components/NSAQuickFilter/NSAFilterBoxNumber.d.ts +22 -0
  24. package/dist/components/NSAQuickFilter/NSAFilterBoxNumber.js +67 -0
  25. package/dist/components/NSAQuickFilter/NSAFilterBoxNumber.js.map +1 -0
  26. package/dist/components/NSAQuickFilter/NSAFilterBoxString.d.ts +13 -0
  27. package/dist/components/NSAQuickFilter/NSAFilterBoxString.js +47 -0
  28. package/dist/components/NSAQuickFilter/NSAFilterBoxString.js.map +1 -0
  29. package/dist/components/NSAQuickFilter/NSAFilterBoxTime.d.ts +12 -0
  30. package/dist/components/NSAQuickFilter/NSAFilterBoxTime.js +58 -0
  31. package/dist/components/NSAQuickFilter/NSAFilterBoxTime.js.map +1 -0
  32. package/dist/components/NSAQuickFilter/NSAQuickFilterBar.d.ts +28 -0
  33. package/dist/components/NSAQuickFilter/NSAQuickFilterBar.js +74 -0
  34. package/dist/components/NSAQuickFilter/NSAQuickFilterBar.js.map +1 -0
  35. package/dist/components/NSAQuickFilter/NSAQuickFilterDialog.d.ts +43 -0
  36. package/dist/components/NSAQuickFilter/NSAQuickFilterDialog.js +114 -0
  37. package/dist/components/NSAQuickFilter/NSAQuickFilterDialog.js.map +1 -0
  38. package/dist/components/NSAReorderDialog.d.ts +30 -0
  39. package/dist/components/NSAReorderDialog.js +69 -0
  40. package/dist/components/NSAReorderDialog.js.map +1 -0
  41. package/dist/components/NSAReorderDialog.module.css +50 -0
  42. package/dist/components/NSASortDialog.d.ts +21 -0
  43. package/dist/components/NSASortDialog.js +61 -0
  44. package/dist/components/NSASortDialog.js.map +1 -0
  45. package/dist/components/NSATable.d.ts +95 -0
  46. package/dist/components/NSATable.js +335 -0
  47. package/dist/components/NSATable.js.map +1 -0
  48. package/dist/layouts/NSASectionList.d.ts +7 -37
  49. package/dist/layouts/NSASectionList.js +17 -247
  50. package/dist/layouts/NSASectionList.js.map +1 -1
  51. package/dist/layouts/NSASectionList.module.css +15 -18
  52. package/package.json +2 -2
  53. package/src/IEntityInfo.ts +3 -1
  54. package/src/NSACacheService.ts +20 -0
  55. package/src/NSAFilterOperators.ts +93 -0
  56. package/src/components/NSAQuickFilter/NSAFilterBoxBase.tsx +56 -0
  57. package/src/components/NSAQuickFilter/NSAFilterBoxBoolean.tsx +55 -0
  58. package/src/components/NSAQuickFilter/NSAFilterBoxDate.tsx +105 -0
  59. package/src/components/NSAQuickFilter/NSAFilterBoxDateTime.tsx +106 -0
  60. package/src/components/NSAQuickFilter/NSAFilterBoxEnum.module.css +45 -0
  61. package/src/components/NSAQuickFilter/NSAFilterBoxEnum.tsx +80 -0
  62. package/src/components/NSAQuickFilter/NSAFilterBoxNumber.tsx +137 -0
  63. package/src/components/NSAQuickFilter/NSAFilterBoxString.tsx +82 -0
  64. package/src/components/NSAQuickFilter/NSAFilterBoxTime.tsx +102 -0
  65. package/src/components/NSAQuickFilter/NSAQuickFilterBar.module.css +20 -0
  66. package/src/components/NSAQuickFilter/NSAQuickFilterBar.tsx +115 -0
  67. package/src/components/NSAQuickFilter/NSAQuickFilterDialog.module.css +75 -0
  68. package/src/components/NSAQuickFilter/NSAQuickFilterDialog.tsx +261 -0
  69. package/src/components/NSAReorderDialog.module.css +50 -0
  70. package/src/components/NSAReorderDialog.tsx +150 -0
  71. package/src/components/NSASortDialog.tsx +118 -0
  72. package/src/components/NSATable.tsx +490 -0
  73. package/src/layouts/NSASectionList.module.css +15 -18
  74. package/src/layouts/NSASectionList.tsx +43 -395
@@ -0,0 +1,490 @@
1
+ import { FilterItem, FilterItemColumnType, NamingConvention, ObjectService, SearchOperation, SortItem } from "namirasoft-core";
2
+ import { CategoryRow, FieldRow } from "namirasoft-field";
3
+ import { FilterItemColumnTypeBuilder, VariableType } from "namirasoft-schema";
4
+ import { IBaseComponentProps, NSButtonProps, NSFilterBox, NSFilterBoxItems, NSFilterBoxProps_Table, NSTable, TableColumnInfo, TableRowInfo } from "namirasoft-site-react";
5
+ import { Component, ReactNode, createRef } from "react";
6
+ import { IEntityInfo } from "../IEntityInfo";
7
+ import { NSACacheService } from "../NSACacheService";
8
+ import { NSAQuickFilterBar } from "./NSAQuickFilter/NSAQuickFilterBar";
9
+ import { NSAQuickFilterDialog, QuickFilterConfig } from "./NSAQuickFilter/NSAQuickFilterDialog";
10
+ import { NSAReorderDialog } from "./NSAReorderDialog";
11
+ import { NSASortDialog } from "./NSASortDialog";
12
+
13
+ export interface NSATableUIProps<RowType>
14
+ {
15
+ getRowAttributes?: (row_value: RowType, row_index: number, res: { rows: RowType[]; count: number; } | null) => { [key: string]: any };
16
+ getColumnAttributes?: (column: TableColumnInfo) => { [key: string]: any };
17
+ getCellFormattedValue?: (value: any, column: TableColumnInfo, row: TableRowInfo<RowType>) => any;
18
+ search_box?: {
19
+ exclude?: {
20
+ show?: {
21
+ table?: (table: string) => boolean;
22
+ column?: (table: string, column: string) => boolean;
23
+ },
24
+ load_value?: (table: string, column: string) => boolean;
25
+ }
26
+ };
27
+ }
28
+
29
+ export interface NSATableProps<RowType extends { id: string }, RowTypeInput = RowType> extends IBaseComponentProps
30
+ {
31
+ entity: IEntityInfo<RowType, RowTypeInput>;
32
+ ctf: {
33
+ enabled: boolean;
34
+ fields: FieldRow[] | null;
35
+ categories: CategoryRow[] | null;
36
+ };
37
+ url: { getQuery(name: string, base64?: boolean, remove?: boolean): string };
38
+ ui?: NSATableUIProps<RowType>;
39
+ checkbox?: boolean;
40
+ buttons?: NSButtonProps[];
41
+ onSelectionChanged?: () => void;
42
+ }
43
+
44
+ interface NSATableState<RowType>
45
+ {
46
+ res: { rows: RowType[]; count: number; } | null;
47
+ sorts: SortItem[];
48
+ visible_column_keys: string[];
49
+ quick_filter_configs: QuickFilterConfig[];
50
+ show_sort_dialog: boolean;
51
+ show_reorder_dialog: boolean;
52
+ show_quick_filter_dialog: boolean;
53
+ filter_revision: number;
54
+ }
55
+
56
+ export class NSATable<RowType extends { id: string }, RowTypeInput = RowType>
57
+ extends Component<NSATableProps<RowType, RowTypeInput>, NSATableState<RowType>>
58
+ {
59
+ public NSTable_Main = createRef<NSTable<RowType>>();
60
+ public NSFilterBox_Top = createRef<NSFilterBox>();
61
+ public NSAQuickFilterBar_Ref = createRef<NSAQuickFilterBar>();
62
+
63
+ constructor(props: NSATableProps<RowType, RowTypeInput>)
64
+ {
65
+ super(props);
66
+ this.state = {
67
+ res: null,
68
+ sorts: [],
69
+ visible_column_keys: [],
70
+ quick_filter_configs: [],
71
+ show_sort_dialog: false,
72
+ show_reorder_dialog: false,
73
+ show_quick_filter_dialog: false,
74
+ filter_revision: 0,
75
+ };
76
+ }
77
+
78
+ override componentDidMount()
79
+ {
80
+ const visible = this.NSTable_Main.current?.getVisibleColumns() ?? [];
81
+ if (visible.length > 0)
82
+ this.setState({ visible_column_keys: visible.map(v => v.table + "." + v.column) });
83
+
84
+ let quick_filter_configs = NSACacheService.loadQuickFilters(this.props.entity.name);
85
+ if (quick_filter_configs.length === 0)
86
+ quick_filter_configs = this.buildDefaultQuickFilters();
87
+ // Re-render so the filter chips reflect any incoming filter items.
88
+ this.setState(prev => ({ quick_filter_configs, filter_revision: prev.filter_revision + 1 }));
89
+ }
90
+
91
+ private getColumns(): TableColumnInfo[]
92
+ {
93
+ let columns = Object.values(this.props.entity.client.getColumns()).flat();
94
+ columns.forEach(col =>
95
+ {
96
+ col.text = NamingConvention.auto.convert(col.text, NamingConvention.Pascal_Case_Space);
97
+ });
98
+ return columns;
99
+ }
100
+
101
+ private buildDefaultQuickFilters(): QuickFilterConfig[]
102
+ {
103
+ const getDefaults = this.props.entity.client.getQuickFilters;
104
+ if (!getDefaults)
105
+ return [];
106
+
107
+ const columns = this.getColumns();
108
+ const ans: QuickFilterConfig[] = [];
109
+ for (const def of getDefaults())
110
+ {
111
+ const col = columns.find(c => c.name === def.column);
112
+ if (!col)
113
+ continue;
114
+ const columnType = new ObjectService(col.type).getEnum(VariableType, VariableType.Any);
115
+ ans.push({
116
+ id: `default-${col.table.name}-${col.name}`,
117
+ column: {
118
+ table: { name: col.table.name, text: col.table.text },
119
+ name: col.name,
120
+ text: col.text,
121
+ type: col.type,
122
+ columnType,
123
+ },
124
+ operatorName: (def as { operator?: string }).operator,
125
+ });
126
+ }
127
+ return ans;
128
+ }
129
+
130
+ private filterItemTypeConverter(type: string): FilterItemColumnType
131
+ {
132
+ let t = new ObjectService(type).getEnum(VariableType, VariableType.Any);
133
+ let builder = new FilterItemColumnTypeBuilder(t);
134
+ return builder.runSynch(() => { }) ?? FilterItemColumnType.Unknown;
135
+ }
136
+
137
+ private getIncomingFilterItems(): FilterItem[] | undefined
138
+ {
139
+ try
140
+ {
141
+ let encoded = this.props.url.getQuery("filters");
142
+ if (encoded)
143
+ return FilterItem.decode(encoded) ?? undefined;
144
+ } catch (error)
145
+ {
146
+ }
147
+ return undefined;
148
+ }
149
+
150
+ public reload(page: number | null, size: number | null): Promise<void> | undefined
151
+ {
152
+ return this.NSTable_Main.current?.reload(page, size);
153
+ }
154
+ public getSelectedIDs(): string[]
155
+ {
156
+ return this.NSTable_Main.current?.getSelectedIDs() ?? [];
157
+ }
158
+ public getSelectedRows(): RowType[]
159
+ {
160
+ return this.NSTable_Main.current?.getSelectedRows() ?? [];
161
+ }
162
+ public setSelectedIDs(ids: string[], rows: RowType[], callback?: () => void)
163
+ {
164
+ this.NSTable_Main.current?.setSelectedIDs(ids, rows, callback);
165
+ }
166
+ public getSortItems(): SortItem[]
167
+ {
168
+ return this.NSTable_Main.current?.getSortItems() ?? [];
169
+ }
170
+ public setSortItems(items: SortItem[] | null)
171
+ {
172
+ this.NSTable_Main.current?.setSortItems(items);
173
+ }
174
+ public getVisibleColumns(): { table: string, column: string }[]
175
+ {
176
+ return this.NSTable_Main.current?.getVisibleColumns() ?? [];
177
+ }
178
+ public setVisibleColumns(visible_columns: { table: string, column: string }[])
179
+ {
180
+ this.NSTable_Main.current?.setVisibleColumns(visible_columns);
181
+ }
182
+ public getFilterBoxItems(): FilterItem[]
183
+ {
184
+ return this.NSFilterBox_Top.current?.getFilterItems() ?? [];
185
+ }
186
+ public getQuickFilterItems(): FilterItem[]
187
+ {
188
+ return this.NSAQuickFilterBar_Ref.current?.getFilterItems() ?? [];
189
+ }
190
+ public getFilterItems(): FilterItem[]
191
+ {
192
+ return [...this.getFilterBoxItems(), ...this.getQuickFilterItems()];
193
+ }
194
+
195
+ private reloadFromFilters()
196
+ {
197
+ this.NSTable_Main.current?.setSelectedIDs([], []);
198
+ this.NSTable_Main.current?.reload(null, null);
199
+ }
200
+
201
+ private onFilterBoxChanged = () =>
202
+ {
203
+ this.reloadFromFilters();
204
+ this.setState(prev => ({ filter_revision: prev.filter_revision + 1 }));
205
+ };
206
+
207
+ private buildButtons(): NSButtonProps[]
208
+ {
209
+ const buttons: NSButtonProps[] = [
210
+ {
211
+ title: "",
212
+ icon: { src: "https://static.namirasoft.com/image/concept/grip-vertical/blue.svg", alt: "reorder" },
213
+ attributes: { title: "Reorder" },
214
+ onClick: {
215
+ action: () => this.setState({ show_reorder_dialog: true, visible_column_keys: this.getVisibleColumns().map(c => c.table + "." + c.column) }),
216
+ showLoading: false,
217
+ },
218
+ },
219
+ {
220
+ title: "",
221
+ icon: { src: "https://static.namirasoft.com/image/concept/arrow-down-short-wide/blue.svg", alt: "sort" },
222
+ attributes: { title: "Sort" },
223
+ onClick: {
224
+ action: () => this.setState({ show_sort_dialog: true, sorts: this.getSortItems() }),
225
+ showLoading: false,
226
+ },
227
+ },
228
+ {
229
+ title: "",
230
+ icon: { src: "https://static.namirasoft.com/image/concept/sliders/blue.svg", alt: "filter" },
231
+ attributes: { title: "Quick Filters" },
232
+ onClick: {
233
+ action: () => this.setState({ show_quick_filter_dialog: true }),
234
+ showLoading: false,
235
+ },
236
+ },
237
+ ];
238
+ return [...buttons, ...(this.props.buttons ?? [])];
239
+ }
240
+
241
+ private renderFilterHeader(): ReactNode
242
+ {
243
+ return (
244
+ <NSFilterBox
245
+ ref={this.NSFilterBox_Top}
246
+ filterItems={this.getIncomingFilterItems()}
247
+ getTables={() =>
248
+ {
249
+ return this.props.entity.tables.map(table =>
250
+ {
251
+ let columns = table.table.getColumns().map(c => ({ id: c.name, ...c, type: this.filterItemTypeConverter(c.type) }));
252
+ columns = columns.filter(c =>
253
+ {
254
+ if (this.props.ui?.search_box?.exclude?.show?.column)
255
+ if (this.props.ui?.search_box?.exclude.show?.column(table.table.name, c.name))
256
+ return false;
257
+ return true;
258
+ });
259
+ return { name: table.table.name, text: table.table.text, columns, required: table.required };
260
+ }).filter(t =>
261
+ {
262
+ if (this.props.ui?.search_box?.exclude?.show?.table)
263
+ if (this.props.ui?.search_box?.exclude.show.table(t.name))
264
+ return false;
265
+ return true;
266
+ });
267
+ }}
268
+ getMoreTables={async () =>
269
+ {
270
+ let ans: NSFilterBoxProps_Table[] = [];
271
+ if (this.props.ctf.enabled)
272
+ try
273
+ {
274
+ if (this.props.ctf.fields)
275
+ if (this.props.ctf.fields.length > 0)
276
+ {
277
+ let name = this.props.entity.name + "_field";
278
+ ans.push({
279
+ name,
280
+ text: "Fields",
281
+ columns: [{
282
+ id: "field_id",
283
+ name: "field_id",
284
+ text: "ID",
285
+ type: FilterItemColumnType.Unknown,
286
+ getValues: async (search) =>
287
+ {
288
+ return this.props.ctf.fields?.filter(c => SearchOperation.match(c.id, search)).map(c => { return { value: c.id, title: c.id } }) ?? [];
289
+ }
290
+ }, {
291
+ id: "field_name",
292
+ name: "field_id",
293
+ text: "Name",
294
+ type: FilterItemColumnType.Unknown,
295
+ getValues: async (search) =>
296
+ {
297
+ return this.props.ctf.fields?.filter(c => SearchOperation.match(c.name, search)).map(c => { return { value: c.id, title: c.name } }) ?? [];
298
+ }
299
+ }, {
300
+ id: "field_value",
301
+ name: "value",
302
+ text: "Value",
303
+ type: FilterItemColumnType.Unknown
304
+ },
305
+ ...this.props.ctf.fields.map(f =>
306
+ {
307
+ return {
308
+ id: f.id,
309
+ name: f.id,
310
+ text: f.name,
311
+ type: this.filterItemTypeConverter(f.type.type.type),
312
+ getValues: async (search: string) =>
313
+ {
314
+ let values = await this.props.entity.server.value_list(name, "value", search, f.id, null);
315
+ return values.map(v => { return { value: v, title: v } });
316
+ }
317
+ };
318
+ }),],
319
+ required: false
320
+ });
321
+ }
322
+
323
+ if (this.props.ctf.categories)
324
+ if (this.props.ctf.categories.length > 0)
325
+ ans.push({
326
+ name: this.props.entity.name + "_category",
327
+ text: "Categories",
328
+ columns: [{
329
+ id: "category_id",
330
+ name: "category_id",
331
+ text: "ID",
332
+ type: FilterItemColumnType.Unknown,
333
+ getValues: async (search) =>
334
+ {
335
+ return this.props.ctf.categories?.filter(c => SearchOperation.match(c.id, search)).map(c => { return { value: c.id, title: c.id } }) ?? [];
336
+ }
337
+ }, {
338
+ id: "category_name",
339
+ name: "category_id",
340
+ text: "Name",
341
+ type: FilterItemColumnType.Unknown,
342
+ getValues: async (search) =>
343
+ {
344
+ return this.props.ctf.categories?.filter(c => SearchOperation.match(c.name, search)).map(c => { return { value: c.id, title: c.name } }) ?? [];
345
+ }
346
+ }],
347
+ required: false
348
+ });
349
+
350
+ } catch (error)
351
+ {
352
+ }
353
+ // todo add tags
354
+ return ans;
355
+ }}
356
+ getValues={async (table, column, value) =>
357
+ {
358
+ if (this.props.ui?.search_box?.exclude?.load_value)
359
+ if (this.props.ui?.search_box?.exclude?.load_value(table.name, column.name))
360
+ return [];
361
+ let values = await this.props.entity.server.value_list(table.name, column.name, value, null, null);
362
+ return values.map(v => { return { value: v, title: v } });
363
+ }}
364
+ onChanged={this.onFilterBoxChanged}
365
+ />
366
+ );
367
+ }
368
+
369
+ private getOrderedColumns(): TableColumnInfo[]
370
+ {
371
+ const all = this.getColumns();
372
+ const vk = this.state.visible_column_keys;
373
+ if (vk.length === 0)
374
+ return all;
375
+ const ordered = vk.map(k => all.find(c => c.table.name + "." + c.name === k)).filter((c): c is TableColumnInfo => !!c);
376
+ const rest = all.filter(c => !vk.includes(c.table.name + "." + c.name));
377
+ return [...ordered, ...rest];
378
+ }
379
+
380
+ override render(): ReactNode
381
+ {
382
+ const filterBoxItems = this.NSFilterBox_Top.current?.getFilterItems() ?? [];
383
+ const filterChips = filterBoxItems.length > 0 && (
384
+ <NSFilterBoxItems
385
+ filterItems={filterBoxItems}
386
+ onClearFilterItems={() => this.NSFilterBox_Top.current?.setFilterItems([])}
387
+ onRemoveFilterItem={(item) => this.NSFilterBox_Top.current?.removeFilterItem(item)}
388
+ />
389
+ );
390
+
391
+ const quickFilterBar = this.state.quick_filter_configs.length > 0 && (
392
+ <NSAQuickFilterBar
393
+ key={this.state.quick_filter_configs.map(c => c.id).join("-")}
394
+ ref={this.NSAQuickFilterBar_Ref}
395
+ configs={this.state.quick_filter_configs}
396
+ getValues={async (tableName, columnName, search) =>
397
+ {
398
+ const values = await this.props.entity.server.value_list(tableName, columnName, search, null, null);
399
+ const col = this.getColumns().find(c => c.table.name === tableName && c.name === columnName);
400
+ return values.map(v =>
401
+ {
402
+ const formatted = col ? col.formatter.format(v, col, { value: {} } as any, true) : null;
403
+ return { value: v, title: formatted != null ? String(formatted) : v };
404
+ });
405
+ }}
406
+ onChanged={() => this.reloadFromFilters()}
407
+ />
408
+ );
409
+
410
+ return (
411
+ <>
412
+ <NSTable<RowType>
413
+ id={this.props.id}
414
+ classList={this.props.classList}
415
+ style={this.props.style}
416
+ ref={this.NSTable_Main}
417
+ name={NamingConvention.lower_case_dash.convert(this.props.entity.name, NamingConvention.Pascal_Case_Space)}
418
+ checkbox={this.props.checkbox ?? true}
419
+ headerChildren={this.renderFilterHeader()}
420
+ buttons={this.buildButtons()}
421
+ columns={this.getOrderedColumns()}
422
+ getRows={async (page, size, sorts) =>
423
+ {
424
+ let res: { rows: RowType[], count: number } = { rows: [], count: 0 };
425
+ if (this.props.entity.server.list)
426
+ res = await this.props.entity.server.list(this.getFilterItems(), page, size, sorts, null);
427
+ this.setState({ res });
428
+ return res;
429
+ }}
430
+ getRowKey={(row) => row.value.id.toString()}
431
+ getRowAttributes={(row_value, row_index) => this.props.ui?.getRowAttributes?.(row_value, row_index, this.state.res) ?? {}}
432
+ getColumnAttributes={this.props.ui?.getColumnAttributes}
433
+ getCellFormattedValue={this.props.ui?.getCellFormattedValue}
434
+ onVisibleColumnsChanged={(visible_columns) => this.setState({ visible_column_keys: visible_columns.map(c => c.table + "." + c.column) })}
435
+ onSelectedIDsChanged={() => this.props.onSelectionChanged?.()}
436
+ >
437
+ {filterChips}
438
+ {quickFilterBar}
439
+ </NSTable>
440
+ {
441
+ this.state.show_sort_dialog &&
442
+ <NSASortDialog
443
+ sorts={this.state.sorts}
444
+ getColumns={() => this.getColumns()}
445
+ onCancel={() => this.setState({ show_sort_dialog: false })}
446
+ onApply={sorts =>
447
+ {
448
+ this.setSortItems(sorts);
449
+ this.setState({ show_sort_dialog: false, sorts: sorts ?? [] });
450
+ }}
451
+ />
452
+ }
453
+ {
454
+ this.state.show_reorder_dialog &&
455
+ <NSAReorderDialog
456
+ visibleColumnKeys={this.state.visible_column_keys}
457
+ getColumns={() => this.getColumns()}
458
+ onCancel={() => this.setState({ show_reorder_dialog: false })}
459
+ onApply={orderedKeys =>
460
+ {
461
+ const cs_all = this.getColumns();
462
+ const cs = orderedKeys.map((v: string) => cs_all.find((c: TableColumnInfo) => v === c.table.name + "." + c.name)).filter(Boolean) as TableColumnInfo[];
463
+ this.setVisibleColumns(cs.map(c => ({ table: c.table.name, column: c.name })));
464
+ this.setState({ show_reorder_dialog: false, visible_column_keys: orderedKeys });
465
+ }}
466
+ />
467
+ }
468
+ {
469
+ this.state.show_quick_filter_dialog &&
470
+ <NSAQuickFilterDialog
471
+ configs={this.state.quick_filter_configs}
472
+ getColumns={() => this.getColumns()}
473
+ typeConverter={(type: string) => new ObjectService(type).getEnum(VariableType, VariableType.Any)}
474
+ onSave={configs =>
475
+ {
476
+ NSACacheService.saveQuickFilters(this.props.entity.name, configs);
477
+ this.setState({ quick_filter_configs: configs }, () => this.reloadFromFilters());
478
+ }}
479
+ onConfirm={configs =>
480
+ {
481
+ NSACacheService.saveQuickFilters(this.props.entity.name, configs);
482
+ this.setState({ quick_filter_configs: configs, show_quick_filter_dialog: false }, () => this.reloadFromFilters());
483
+ }}
484
+ onClose={() => this.setState({ show_quick_filter_dialog: false })}
485
+ />
486
+ }
487
+ </>
488
+ );
489
+ }
490
+ }
@@ -1,22 +1,19 @@
1
- .nsa_section_list_items {
2
- display: flex;
3
- flex-direction: row;
4
- flex-wrap: wrap;
5
- justify-content: center;
6
- align-items: center;
7
- gap: 16px;
8
- width: 100%;
1
+ .nsa_section_list_btn {
2
+ width: 48px;
3
+ border: 1px solid #a0a0a0;
9
4
  }
10
5
 
11
- @media screen and (min-width: 1024px) {
6
+ .nsa_section_list_btn img {
7
+ width: 24px;
8
+ height: 24px;
9
+ }
12
10
 
13
- .nsa_section_list_items {
14
- display: flex;
15
- flex-direction: row;
16
- flex-wrap: nowrap;
17
- justify-content: end;
18
- align-items: center;
19
- flex: 1;
20
- width: unset;
21
- }
11
+ .nsa_section_list_actions {
12
+ display: flex;
13
+ flex-direction: row;
14
+ flex-wrap: nowrap;
15
+ justify-content: flex-end;
16
+ align-items: center;
17
+ gap: 8px;
18
+ flex-shrink: 0;
22
19
  }