@poirazis/supercomponents-shared 1.0.39 → 1.0.40
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.
- package/dist/index.js +11154 -10827
- package/dist/index.umd.cjs +23 -23
- package/dist/style.css +1 -1
- package/package.json +1 -1
- package/src/lib/SuperButton/SuperButton.svelte +14 -10
- package/src/lib/SuperForm/InnerForm.svelte +1 -0
- package/src/lib/SuperTable/SuperTable.css +5 -1
- package/src/lib/SuperTable/SuperTable.svelte +210 -221
- package/src/lib/SuperTable/controls/ColumnsSection.svelte +2 -0
- package/src/lib/SuperTable/controls/SelectionColumn.svelte +6 -6
- package/src/lib/SuperTable/overlays/ScrollbarsOverlay.svelte +8 -6
- package/src/lib/SuperTableCells/CellAttachmentExpanded.svelte +28 -4
- package/src/lib/SuperTableCells/CellAttachmentSlider.svelte +37 -5
- package/src/lib/SuperTableCells/CellDatetime.svelte +10 -3
- package/src/lib/SuperTableCells/CellNumber.svelte +1 -0
- package/src/lib/SuperTableCells/CellOptions.svelte +2 -0
- package/src/lib/SuperTableCells/CellOptionsAdvanced.svelte +77 -28
- package/src/lib/SuperTableCells/CellString.svelte +25 -24
- package/src/lib/SuperTableColumn/SuperTableColumn.svelte +2 -2
- package/src/lib/SuperTableColumn/parts/SuperColumnBody.svelte +13 -15
- package/src/lib/SuperTableColumn/parts/SuperColumnHeader.svelte +1 -1
- package/src/lib/SuperTabs/SuperTabs.svelte +13 -3
|
@@ -59,7 +59,7 @@
|
|
|
59
59
|
export let inBuilder;
|
|
60
60
|
|
|
61
61
|
// Properties
|
|
62
|
-
export let
|
|
62
|
+
export let dataSource;
|
|
63
63
|
export let idColumn = "_id";
|
|
64
64
|
export let sortColumn;
|
|
65
65
|
export let sortOrder;
|
|
@@ -131,34 +131,16 @@
|
|
|
131
131
|
export let afterEdit;
|
|
132
132
|
export let onRefresh;
|
|
133
133
|
|
|
134
|
-
const dataSourceStore = memo(
|
|
135
|
-
const columnsStore =
|
|
134
|
+
const dataSourceStore = memo(dataSource);
|
|
135
|
+
const columnsStore = memo(columnList);
|
|
136
|
+
const stbRowMetadata = writable([]);
|
|
136
137
|
const filterStore = memo(filter);
|
|
137
138
|
|
|
138
|
-
$: dataSourceStore.set(
|
|
139
|
+
$: dataSourceStore.set(dataSource);
|
|
139
140
|
|
|
140
141
|
$: filterStore.set(filter);
|
|
141
|
-
$: stbData = createFetch($dataSourceStore);
|
|
142
142
|
$: stbSchema.set($stbData?.definition?.schema);
|
|
143
143
|
|
|
144
|
-
// Memoize schema changes - only update when schema actually changes
|
|
145
|
-
let previousSchema = null;
|
|
146
|
-
|
|
147
|
-
$: {
|
|
148
|
-
const newSchema = $stbData?.definition?.schema;
|
|
149
|
-
|
|
150
|
-
// Check if schema has actually changed
|
|
151
|
-
const schemaChanged =
|
|
152
|
-
JSON.stringify(newSchema) !== JSON.stringify(previousSchema);
|
|
153
|
-
|
|
154
|
-
if (schemaChanged) {
|
|
155
|
-
memoizedSchema.set(newSchema);
|
|
156
|
-
previousSchema = newSchema;
|
|
157
|
-
// Reset columnsStore only when schema changes
|
|
158
|
-
columnsStore.set(columnList || []);
|
|
159
|
-
}
|
|
160
|
-
}
|
|
161
|
-
|
|
162
144
|
// Update columnsStore when columnList changes
|
|
163
145
|
$: columnsStore.set(columnList || []);
|
|
164
146
|
|
|
@@ -189,12 +171,18 @@
|
|
|
189
171
|
let _limit = limit;
|
|
190
172
|
let start = 0;
|
|
191
173
|
let end = 0;
|
|
174
|
+
let initializing = true;
|
|
175
|
+
let initTimer;
|
|
176
|
+
|
|
177
|
+
let stbData = writable({ rows: [], count: 0, definition: {} });
|
|
192
178
|
|
|
193
179
|
// Scrolling width lock variables
|
|
194
180
|
let scrollLockTimeout;
|
|
195
181
|
let isScrolling = false;
|
|
196
182
|
let tableWidth = 0;
|
|
197
183
|
|
|
184
|
+
let loadedId = null;
|
|
185
|
+
|
|
198
186
|
// Keep track of the applied query extentions when filtering
|
|
199
187
|
let stbColumnFilters = new Set();
|
|
200
188
|
let queryExtensions = {};
|
|
@@ -208,7 +196,7 @@
|
|
|
208
196
|
|
|
209
197
|
const stbSettings = memo({});
|
|
210
198
|
const stbSchema = memo({});
|
|
211
|
-
|
|
199
|
+
|
|
212
200
|
// Create Stores
|
|
213
201
|
const stbScrollPos = memo(0);
|
|
214
202
|
const stbScrollOffset = memo(0);
|
|
@@ -277,7 +265,7 @@
|
|
|
277
265
|
canResize,
|
|
278
266
|
},
|
|
279
267
|
data: {
|
|
280
|
-
|
|
268
|
+
dataSource,
|
|
281
269
|
idColumn,
|
|
282
270
|
filter,
|
|
283
271
|
sortColumn,
|
|
@@ -322,57 +310,19 @@
|
|
|
322
310
|
},
|
|
323
311
|
});
|
|
324
312
|
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
: $stbSettings.appearance.rowHeight,
|
|
339
|
-
bgcolor: rowBGColorTemplate
|
|
340
|
-
? processStringSync(rowBGColorTemplate, {
|
|
341
|
-
...$context,
|
|
342
|
-
[comp_id]: { row },
|
|
343
|
-
})
|
|
344
|
-
: undefined,
|
|
345
|
-
color: rowColorTemplate
|
|
346
|
-
? processStringSync(rowColorTemplate, {
|
|
347
|
-
...$context,
|
|
348
|
-
[comp_id]: { row },
|
|
349
|
-
})
|
|
350
|
-
: undefined,
|
|
351
|
-
disabled: rowDisabledTemplate
|
|
352
|
-
? processStringSync(rowDisabledTemplate, {
|
|
353
|
-
...$context,
|
|
354
|
-
[comp_id]: { row },
|
|
355
|
-
})
|
|
356
|
-
: undefined,
|
|
357
|
-
})) || [{}]
|
|
358
|
-
);
|
|
359
|
-
}
|
|
360
|
-
);
|
|
361
|
-
|
|
362
|
-
$: cumulativeHeights = derivedMemo(
|
|
363
|
-
[stbRowMetadata, stbSettings],
|
|
364
|
-
([$meta, $settings]) => {
|
|
365
|
-
const defaultRowHeight = $settings.appearance?.rowHeight || 36;
|
|
366
|
-
return $meta.map((_, i) =>
|
|
367
|
-
$meta
|
|
368
|
-
.slice(0, i + 1)
|
|
369
|
-
.reduce(
|
|
370
|
-
(sum, meta) => sum + Math.max(meta.height || defaultRowHeight, 0),
|
|
371
|
-
0
|
|
372
|
-
)
|
|
373
|
-
);
|
|
374
|
-
}
|
|
375
|
-
);
|
|
313
|
+
const createFetch = (datasource) => {
|
|
314
|
+
return fetchData({
|
|
315
|
+
API,
|
|
316
|
+
datasource,
|
|
317
|
+
options: {
|
|
318
|
+
query,
|
|
319
|
+
sortColumn,
|
|
320
|
+
sortOrder,
|
|
321
|
+
limit,
|
|
322
|
+
paginate: false,
|
|
323
|
+
},
|
|
324
|
+
});
|
|
325
|
+
};
|
|
376
326
|
|
|
377
327
|
// The Super Table API
|
|
378
328
|
const tableAPI = {
|
|
@@ -534,7 +484,7 @@
|
|
|
534
484
|
executeRowButtonAction: async (index, action) => {
|
|
535
485
|
let cmd = enrichButtonActions(
|
|
536
486
|
action,
|
|
537
|
-
tableAPI.enrichContext($stbData
|
|
487
|
+
tableAPI.enrichContext($stbData?.rows[index])
|
|
538
488
|
);
|
|
539
489
|
await cmd?.();
|
|
540
490
|
},
|
|
@@ -544,7 +494,7 @@
|
|
|
544
494
|
executeCellOnClickAction: async (index, column, value, id) => {
|
|
545
495
|
let cmd = enrichButtonActions(
|
|
546
496
|
onCellClick,
|
|
547
|
-
tableAPI.enrichContext($stbData
|
|
497
|
+
tableAPI.enrichContext($stbData?.rows[index])
|
|
548
498
|
);
|
|
549
499
|
await cmd?.({ column, value, id });
|
|
550
500
|
},
|
|
@@ -567,7 +517,7 @@
|
|
|
567
517
|
await tick();
|
|
568
518
|
let cmd = enrichButtonActions(
|
|
569
519
|
onRowSelect,
|
|
570
|
-
tableAPI.enrichContext($stbData
|
|
520
|
+
tableAPI.enrichContext($stbData?.rows[index])
|
|
571
521
|
);
|
|
572
522
|
await cmd?.();
|
|
573
523
|
},
|
|
@@ -589,7 +539,7 @@
|
|
|
589
539
|
tableAPI.executeRowButtonAction(null, action);
|
|
590
540
|
},
|
|
591
541
|
selectRow: (index) => {
|
|
592
|
-
let id = $stbData
|
|
542
|
+
let id = $stbData?.rows[index][idColumn] ?? index;
|
|
593
543
|
let disabled = $stbRowMetadata[index]["disabled"];
|
|
594
544
|
|
|
595
545
|
if (maxSelected != 1) {
|
|
@@ -619,8 +569,8 @@
|
|
|
619
569
|
if ($stbSelected.length) tableAPI.executeRowOnSelectAction(index);
|
|
620
570
|
},
|
|
621
571
|
selectAllRows: () => {
|
|
622
|
-
if ($stbSelected.length != $stbData
|
|
623
|
-
$stbSelected = $stbData
|
|
572
|
+
if ($stbSelected.length != $stbData?.rows.length)
|
|
573
|
+
$stbSelected = $stbData?.rows.map((x) => x[idColumn]);
|
|
624
574
|
else $stbSelected = [];
|
|
625
575
|
|
|
626
576
|
tableAPI.executeRowOnSelectAction();
|
|
@@ -679,8 +629,8 @@
|
|
|
679
629
|
}
|
|
680
630
|
},
|
|
681
631
|
deleteRow: async (index) => {
|
|
682
|
-
let id = $stbData
|
|
683
|
-
let row = $stbData
|
|
632
|
+
let id = $stbData?.rows[index][idColumn];
|
|
633
|
+
let row = $stbData?.rows[index];
|
|
684
634
|
|
|
685
635
|
let autoDelete = [
|
|
686
636
|
{
|
|
@@ -702,13 +652,13 @@
|
|
|
702
652
|
let cmd;
|
|
703
653
|
let cmd_after = enrichButtonActions(
|
|
704
654
|
afterDelete,
|
|
705
|
-
tableAPI.enrichContext($stbData
|
|
655
|
+
tableAPI.enrichContext($stbData?.rows[index])
|
|
706
656
|
);
|
|
707
657
|
|
|
708
658
|
if (onDelete?.length) {
|
|
709
659
|
cmd = enrichButtonActions(
|
|
710
660
|
onDelete,
|
|
711
|
-
tableAPI.enrichContext($stbData
|
|
661
|
+
tableAPI.enrichContext($stbData?.rows[index])
|
|
712
662
|
);
|
|
713
663
|
} else {
|
|
714
664
|
cmd = enrichButtonActions(autoDelete, {});
|
|
@@ -786,7 +736,38 @@
|
|
|
786
736
|
refresh() {
|
|
787
737
|
stbData?.refresh();
|
|
788
738
|
},
|
|
789
|
-
enrichRows() {
|
|
739
|
+
enrichRows() {
|
|
740
|
+
if ($stbData?.loading) return;
|
|
741
|
+
|
|
742
|
+
$stbRowMetadata = $stbData?.rows?.map((row) => ({
|
|
743
|
+
height: rowHeight
|
|
744
|
+
? toNumber(
|
|
745
|
+
processStringSync(rowHeight, {
|
|
746
|
+
...$context,
|
|
747
|
+
[comp_id]: { row },
|
|
748
|
+
})
|
|
749
|
+
) || $stbSettings.appearance.rowHeight
|
|
750
|
+
: $stbSettings.appearance.rowHeight,
|
|
751
|
+
bgcolor: rowBGColorTemplate
|
|
752
|
+
? processStringSync(rowBGColorTemplate, {
|
|
753
|
+
...$context,
|
|
754
|
+
[comp_id]: { row },
|
|
755
|
+
})
|
|
756
|
+
: undefined,
|
|
757
|
+
color: rowColorTemplate
|
|
758
|
+
? processStringSync(rowColorTemplate, {
|
|
759
|
+
...$context,
|
|
760
|
+
[comp_id]: { row },
|
|
761
|
+
})
|
|
762
|
+
: undefined,
|
|
763
|
+
disabled: rowDisabledTemplate
|
|
764
|
+
? processStringSync(rowDisabledTemplate, {
|
|
765
|
+
...$context,
|
|
766
|
+
[comp_id]: { row },
|
|
767
|
+
})
|
|
768
|
+
: undefined,
|
|
769
|
+
})) || [{}];
|
|
770
|
+
},
|
|
790
771
|
lockColumnWidths() {
|
|
791
772
|
if (isScrolling) return; // Already locked
|
|
792
773
|
isScrolling = true;
|
|
@@ -1047,17 +1028,24 @@
|
|
|
1047
1028
|
if (timer) clearInterval(timer);
|
|
1048
1029
|
start = 0;
|
|
1049
1030
|
end = 0;
|
|
1031
|
+
|
|
1050
1032
|
$stbScrollPos = 0;
|
|
1051
1033
|
$stbScrollOffset = 0;
|
|
1052
1034
|
$stbHorizontalScrollPos = 0;
|
|
1053
1035
|
$stbSelected = [];
|
|
1054
1036
|
$columnsStore = [];
|
|
1037
|
+
$stbVisibleRows = [];
|
|
1055
1038
|
if (_limit != limit) _limit = limit;
|
|
1039
|
+
|
|
1040
|
+
stbData = createFetch($dataSourceStore);
|
|
1041
|
+
|
|
1042
|
+
// If Initialization takes more than 130ms, show loading state
|
|
1043
|
+
initTimer = setTimeout(() => {
|
|
1044
|
+
initializing = true;
|
|
1045
|
+
}, 130);
|
|
1056
1046
|
},
|
|
1057
1047
|
synch(fetchState) {
|
|
1058
1048
|
if (fetchState.loaded) {
|
|
1059
|
-
this.enrichRows();
|
|
1060
|
-
this.calculateBoundaries();
|
|
1061
1049
|
if (autoRefreshRate && !inBuilder) {
|
|
1062
1050
|
timer = setInterval(() => {
|
|
1063
1051
|
if (!$stbData?.loading) stbData?.refresh();
|
|
@@ -1070,15 +1058,13 @@
|
|
|
1070
1058
|
},
|
|
1071
1059
|
Idle: {
|
|
1072
1060
|
_enter() {
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1061
|
+
clearTimeout(initTimer);
|
|
1062
|
+
initializing = false;
|
|
1063
|
+
isEmpty = $stbData?.rows.length < 1;
|
|
1076
1064
|
},
|
|
1077
1065
|
_exit() {},
|
|
1078
1066
|
synch(fetchState) {
|
|
1079
|
-
if (fetchState.loading) return;
|
|
1080
|
-
this.enrichRows();
|
|
1081
|
-
this.calculateBoundaries();
|
|
1067
|
+
if (fetchState.loading && !fetchState.loaded) return;
|
|
1082
1068
|
isEmpty = !$stbData?.rows.length;
|
|
1083
1069
|
},
|
|
1084
1070
|
addFilter(filterObj) {
|
|
@@ -1120,10 +1106,6 @@
|
|
|
1120
1106
|
},
|
|
1121
1107
|
synch(fetchState) {
|
|
1122
1108
|
if (fetchState.loaded) {
|
|
1123
|
-
this.enrichRows();
|
|
1124
|
-
this.calculateBoundaries();
|
|
1125
|
-
this.calculateRowBoundaries();
|
|
1126
|
-
|
|
1127
1109
|
isEmpty = fetchState.rows.length < 1;
|
|
1128
1110
|
}
|
|
1129
1111
|
},
|
|
@@ -1173,15 +1155,14 @@
|
|
|
1173
1155
|
},
|
|
1174
1156
|
});
|
|
1175
1157
|
|
|
1176
|
-
//
|
|
1177
|
-
$: stbState.
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
$
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
$stbSortOrder
|
|
1158
|
+
// Initialize and Enrich Rows
|
|
1159
|
+
$: stbState.init($dataSourceStore);
|
|
1160
|
+
$: stbState.synch($stbData);
|
|
1161
|
+
$: stbState.enrichRows(
|
|
1162
|
+
$stbData,
|
|
1163
|
+
rowBGColorTemplate,
|
|
1164
|
+
rowColorTemplate,
|
|
1165
|
+
rowHeight
|
|
1185
1166
|
);
|
|
1186
1167
|
|
|
1187
1168
|
// Scroll to Top when filter changes
|
|
@@ -1199,21 +1180,20 @@
|
|
|
1199
1180
|
// Data Related
|
|
1200
1181
|
$: defaultQuery = QueryUtils.buildQuery($filterStore);
|
|
1201
1182
|
$: query = extendQuery(defaultQuery, queryExtensions);
|
|
1202
|
-
|
|
1203
1183
|
$: stbData?.update({
|
|
1204
1184
|
query,
|
|
1205
1185
|
sortColumn,
|
|
1206
1186
|
sortOrder,
|
|
1207
1187
|
});
|
|
1208
|
-
|
|
1188
|
+
|
|
1209
1189
|
$: tableId = $stbData?.definition?.tableId || $stbData?.definition?._id;
|
|
1210
1190
|
|
|
1211
1191
|
// Derived Store with the columns to be rendered
|
|
1212
1192
|
$: superColumns = derivedMemo(
|
|
1213
|
-
[
|
|
1214
|
-
([$
|
|
1193
|
+
[stbSchema, columnsStore, stbSettings],
|
|
1194
|
+
([$stbSchema, $columnsStore, $stbSettings]) => {
|
|
1215
1195
|
return tableAPI.populateColumns(
|
|
1216
|
-
$
|
|
1196
|
+
$stbSchema,
|
|
1217
1197
|
$columnsStore,
|
|
1218
1198
|
$stbSettings.showAutoColumns,
|
|
1219
1199
|
$stbSettings.showSpecialColumns
|
|
@@ -1221,6 +1201,25 @@
|
|
|
1221
1201
|
}
|
|
1222
1202
|
);
|
|
1223
1203
|
|
|
1204
|
+
$: cumulativeHeights = derivedMemo(stbRowMetadata, ($meta) => {
|
|
1205
|
+
return $meta?.map((_, i) =>
|
|
1206
|
+
$meta
|
|
1207
|
+
.slice(0, i + 1)
|
|
1208
|
+
.reduce((sum, meta) => sum + Math.max(meta.height, 0), 0)
|
|
1209
|
+
);
|
|
1210
|
+
});
|
|
1211
|
+
|
|
1212
|
+
// Virtual List Capabilities reacting to viewport change
|
|
1213
|
+
$: stbState.calculateBoundaries(
|
|
1214
|
+
clientHeight,
|
|
1215
|
+
canInsert,
|
|
1216
|
+
$stbSortColumn,
|
|
1217
|
+
fetchOnScroll,
|
|
1218
|
+
$stbSortColumn,
|
|
1219
|
+
$stbSortOrder,
|
|
1220
|
+
$cumulativeHeights
|
|
1221
|
+
);
|
|
1222
|
+
|
|
1224
1223
|
// Derived Store with common column settings
|
|
1225
1224
|
const commonColumnOptions = derivedMemo(stbSettings, ($stbSettings) => {
|
|
1226
1225
|
return {
|
|
@@ -1322,21 +1321,6 @@
|
|
|
1322
1321
|
$: showButtonColumnRight = rowMenu == "columnRight" && rowMenuItems?.length;
|
|
1323
1322
|
$: showButtonColumnLeft = rowMenu == "columnLeft" && rowMenuItems?.length;
|
|
1324
1323
|
|
|
1325
|
-
const createFetch = (datasource) => {
|
|
1326
|
-
stbState.init();
|
|
1327
|
-
return fetchData({
|
|
1328
|
-
API,
|
|
1329
|
-
datasource,
|
|
1330
|
-
options: {
|
|
1331
|
-
query,
|
|
1332
|
-
sortColumn,
|
|
1333
|
-
sortOrder,
|
|
1334
|
-
limit,
|
|
1335
|
-
paginate: false,
|
|
1336
|
-
},
|
|
1337
|
-
});
|
|
1338
|
-
};
|
|
1339
|
-
|
|
1340
1324
|
const extendQuery = (
|
|
1341
1325
|
defaultQuery: SearchFilters,
|
|
1342
1326
|
extensions: Record<string, any>
|
|
@@ -1389,7 +1373,10 @@
|
|
|
1389
1373
|
setContext("stbMenuAnchor", stbMenuAnchor);
|
|
1390
1374
|
setContext("stbAPI", tableAPI);
|
|
1391
1375
|
setContext("stbVisibleRows", stbVisibleRows);
|
|
1392
|
-
|
|
1376
|
+
setContext("stbRowMetadata", stbRowMetadata);
|
|
1377
|
+
|
|
1378
|
+
// Reactive Context
|
|
1379
|
+
|
|
1393
1380
|
$: setContext("stbData", stbData);
|
|
1394
1381
|
$: setContext("stbSchema", stbSchema);
|
|
1395
1382
|
$: setContext("new_row", new_row);
|
|
@@ -1422,6 +1409,7 @@
|
|
|
1422
1409
|
<div
|
|
1423
1410
|
class="super-table"
|
|
1424
1411
|
class:quiet
|
|
1412
|
+
class:initializing
|
|
1425
1413
|
bind:this={viewport}
|
|
1426
1414
|
bind:clientWidth={tableWidth}
|
|
1427
1415
|
bind:clientHeight
|
|
@@ -1445,107 +1433,108 @@
|
|
|
1445
1433
|
on:touchmove={(e) => stbState.handleTouch(e, "move")}
|
|
1446
1434
|
on:touchend={(e) => stbState.handleTouch(e, "end")}
|
|
1447
1435
|
>
|
|
1448
|
-
|
|
1449
|
-
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
<RowButtonsColumn {rowMenuItems} {menuItemsVisible} {rowMenu} />
|
|
1457
|
-
{/if}
|
|
1458
|
-
|
|
1459
|
-
{#if stickFirstColumn && $superColumns.length > 1}
|
|
1460
|
-
<SuperTableColumn
|
|
1461
|
-
sticky={true}
|
|
1462
|
-
scrollPos={$stbHorizontalScrollPos}
|
|
1463
|
-
columnOptions={{
|
|
1464
|
-
...$superColumns[0],
|
|
1465
|
-
...$commonColumnOptions,
|
|
1466
|
-
overflow,
|
|
1467
|
-
isFirst: true,
|
|
1468
|
-
isLast:
|
|
1469
|
-
$superColumns?.length == 1 &&
|
|
1470
|
-
!showButtonColumnRight &&
|
|
1471
|
-
canScroll,
|
|
1472
|
-
}}
|
|
1473
|
-
/>
|
|
1474
|
-
{/if}
|
|
1475
|
-
</ControlSection>
|
|
1436
|
+
{#key stbData}
|
|
1437
|
+
<Provider {actions} data={dataContext} />
|
|
1438
|
+
|
|
1439
|
+
<ControlSection>
|
|
1440
|
+
<SelectionColumn {stbData} {hideSelectionColumn} />
|
|
1441
|
+
|
|
1442
|
+
{#if showButtonColumnLeft}
|
|
1443
|
+
<RowButtonsColumn {rowMenuItems} {menuItemsVisible} {rowMenu} />
|
|
1476
1444
|
{/if}
|
|
1477
1445
|
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
{menuItemsVisible}
|
|
1493
|
-
{rowMenu}
|
|
1494
|
-
{canScroll}
|
|
1495
|
-
right={true}
|
|
1496
|
-
/>
|
|
1497
|
-
</ControlSection>
|
|
1446
|
+
{#if stickFirstColumn && $superColumns.length > 1}
|
|
1447
|
+
<SuperTableColumn
|
|
1448
|
+
{stbData}
|
|
1449
|
+
sticky={true}
|
|
1450
|
+
scrollPos={$stbHorizontalScrollPos}
|
|
1451
|
+
columnOptions={{
|
|
1452
|
+
...$superColumns[0],
|
|
1453
|
+
...$commonColumnOptions,
|
|
1454
|
+
overflow,
|
|
1455
|
+
isFirst: true,
|
|
1456
|
+
isLast:
|
|
1457
|
+
$superColumns?.length == 1 && !showButtonColumnRight && canScroll,
|
|
1458
|
+
}}
|
|
1459
|
+
/>
|
|
1498
1460
|
{/if}
|
|
1461
|
+
</ControlSection>
|
|
1462
|
+
|
|
1463
|
+
<ColumnsSection
|
|
1464
|
+
{stbData}
|
|
1465
|
+
{stbSettings}
|
|
1466
|
+
{superColumns}
|
|
1467
|
+
{commonColumnOptions}
|
|
1468
|
+
{canScroll}
|
|
1469
|
+
bind:columnsViewport
|
|
1470
|
+
>
|
|
1471
|
+
{#key stbData}
|
|
1472
|
+
{#key $stbSchema}
|
|
1473
|
+
{#key columnSizing}
|
|
1474
|
+
<slot />
|
|
1475
|
+
{/key}
|
|
1476
|
+
{/key}
|
|
1477
|
+
{/key}
|
|
1478
|
+
</ColumnsSection>
|
|
1479
|
+
|
|
1480
|
+
{#if showButtonColumnRight && !isEmpty}
|
|
1481
|
+
<ControlSection>
|
|
1482
|
+
<RowButtonsColumn
|
|
1483
|
+
{rowMenuItems}
|
|
1484
|
+
{menuItemsVisible}
|
|
1485
|
+
{rowMenu}
|
|
1486
|
+
{canScroll}
|
|
1487
|
+
right={true}
|
|
1488
|
+
/>
|
|
1489
|
+
</ControlSection>
|
|
1490
|
+
{/if}
|
|
1499
1491
|
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
|
|
1492
|
+
<ScrollbarsOverlay
|
|
1493
|
+
anchor={columnsViewport}
|
|
1494
|
+
clientHeight={maxBodyHeight}
|
|
1495
|
+
{scrollHeight}
|
|
1496
|
+
{highlighted}
|
|
1497
|
+
{isEmpty}
|
|
1498
|
+
bind:horizontalVisible
|
|
1499
|
+
on:positionChange={stbState.calculateRowBoundaries}
|
|
1500
|
+
/>
|
|
1501
|
+
|
|
1502
|
+
<EmptyResultSetOverlay
|
|
1503
|
+
{isEmpty}
|
|
1504
|
+
message={$stbSettings.data.emptyMessage}
|
|
1505
|
+
top={$superColumns?.length
|
|
1506
|
+
? $stbSettings.appearance.headerHeight + 16
|
|
1507
|
+
: 16}
|
|
1508
|
+
bottom={horizontalVisible ? 24 : 16}
|
|
1509
|
+
/>
|
|
1510
|
+
|
|
1511
|
+
<RowContextMenu {rowContextMenuItems} />
|
|
1512
|
+
|
|
1513
|
+
{#if $stbSettings.features.canInsert || $stbState == "Filtered"}
|
|
1514
|
+
<AddNewRowOverlay
|
|
1515
|
+
{stbState}
|
|
1516
|
+
{tableAPI}
|
|
1504
1517
|
{highlighted}
|
|
1505
|
-
{
|
|
1506
|
-
|
|
1507
|
-
on:positionChange={stbState.calculateRowBoundaries}
|
|
1518
|
+
{tableActions}
|
|
1519
|
+
footer={$stbSettings.showFooter}
|
|
1508
1520
|
/>
|
|
1521
|
+
{/if}
|
|
1509
1522
|
|
|
1510
|
-
|
|
1511
|
-
|
|
1512
|
-
|
|
1513
|
-
|
|
1514
|
-
|
|
1515
|
-
|
|
1516
|
-
|
|
1523
|
+
{#if $stbSettings.features.canSelect && selectedActions?.length}
|
|
1524
|
+
<SelectedActionsOverlay
|
|
1525
|
+
{stbSettings}
|
|
1526
|
+
{selectedActions}
|
|
1527
|
+
{stbSelected}
|
|
1528
|
+
{tableAPI}
|
|
1529
|
+
{stbState}
|
|
1530
|
+
{highlighted}
|
|
1531
|
+
{entitySingular}
|
|
1532
|
+
{entityPlural}
|
|
1517
1533
|
/>
|
|
1534
|
+
{/if}
|
|
1518
1535
|
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
{#if $stbSettings.features.canInsert || $stbState == "Filtered"}
|
|
1522
|
-
<AddNewRowOverlay
|
|
1523
|
-
{stbState}
|
|
1524
|
-
{tableAPI}
|
|
1525
|
-
{highlighted}
|
|
1526
|
-
{tableActions}
|
|
1527
|
-
footer={$stbSettings.showFooter}
|
|
1528
|
-
/>
|
|
1529
|
-
{/if}
|
|
1530
|
-
|
|
1531
|
-
{#if $stbSettings.features.canSelect && selectedActions?.length}
|
|
1532
|
-
<SelectedActionsOverlay
|
|
1533
|
-
{stbSettings}
|
|
1534
|
-
{selectedActions}
|
|
1535
|
-
{stbSelected}
|
|
1536
|
-
{tableAPI}
|
|
1537
|
-
{stbState}
|
|
1538
|
-
{highlighted}
|
|
1539
|
-
{entitySingular}
|
|
1540
|
-
{entityPlural}
|
|
1541
|
-
/>
|
|
1542
|
-
{/if}
|
|
1543
|
-
|
|
1544
|
-
{#if $stbData.loading}
|
|
1545
|
-
<LoadingOverlay />
|
|
1546
|
-
{/if}
|
|
1547
|
-
{:else}
|
|
1548
|
-
<CellSkeleton />
|
|
1536
|
+
{#if $stbData.loading && $stbData.loaded}
|
|
1537
|
+
<LoadingOverlay />
|
|
1549
1538
|
{/if}
|
|
1550
1539
|
{/key}
|
|
1551
1540
|
</div>
|
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
export let columnsViewport;
|
|
8
8
|
export let showActionColumn;
|
|
9
9
|
export let canScroll;
|
|
10
|
+
export let stbData;
|
|
10
11
|
let overflow;
|
|
11
12
|
</script>
|
|
12
13
|
|
|
@@ -17,6 +18,7 @@
|
|
|
17
18
|
|
|
18
19
|
{#each $superColumns as column, idx (idx)}
|
|
19
20
|
<SuperTableColumn
|
|
21
|
+
{stbData}
|
|
20
22
|
columnOptions={{
|
|
21
23
|
...$commonColumnOptions,
|
|
22
24
|
...column,
|
|
@@ -3,24 +3,24 @@
|
|
|
3
3
|
|
|
4
4
|
const stbState = getContext("stbState");
|
|
5
5
|
const stbSettings = getContext("stbSettings");
|
|
6
|
-
const stbData = getContext("stbData");
|
|
7
6
|
const stbHorizontalScrollPos = getContext("stbHorizontalScrollPos");
|
|
8
7
|
const stbHovered = getContext("stbHovered");
|
|
9
8
|
const stbMenuID = getContext("stbMenuID");
|
|
10
9
|
const stbSelected = getContext("stbSelected");
|
|
11
10
|
const stbAPI = getContext("stbAPI");
|
|
12
|
-
const rowMetadata = getContext("stbRowMetadata");
|
|
13
11
|
const stbVisibleRows = getContext("stbVisibleRows");
|
|
12
|
+
const stbRowMetadata = getContext("stbRowMetadata");
|
|
14
13
|
|
|
15
14
|
export let sticky;
|
|
16
15
|
export let hideSelectionColumn;
|
|
16
|
+
export let stbData;
|
|
17
17
|
|
|
18
18
|
$: idColumn = $stbSettings.data.idColumn;
|
|
19
19
|
$: partialSelection =
|
|
20
|
-
$stbSelected.length && $stbSelected.length != $stbData
|
|
20
|
+
$stbSelected.length && $stbSelected.length != $stbData?.rows?.length;
|
|
21
21
|
|
|
22
22
|
$: fullSelection =
|
|
23
|
-
$stbSelected.length == $stbData
|
|
23
|
+
$stbSelected.length == $stbData?.rows?.length && $stbData?.rows?.length > 0;
|
|
24
24
|
|
|
25
25
|
$: numbering = $stbSettings.appearance.numberingColumn;
|
|
26
26
|
$: checkBoxes = $stbSettings.features.canSelect && !hideSelectionColumn;
|
|
@@ -83,8 +83,8 @@
|
|
|
83
83
|
class:is-selected={selected}
|
|
84
84
|
class:is-hovered={$stbHovered == visibleRow ||
|
|
85
85
|
$stbMenuID == visibleRow}
|
|
86
|
-
class:is-disabled={$
|
|
87
|
-
style:min-height={$
|
|
86
|
+
class:is-disabled={$stbRowMetadata[visibleRow]?.disabled}
|
|
87
|
+
style:min-height={$stbRowMetadata[visibleRow]?.height}
|
|
88
88
|
on:mouseenter={() => ($stbHovered = visibleRow)}
|
|
89
89
|
on:mouseleave={() => ($stbHovered = null)}
|
|
90
90
|
>
|