@limetech/lime-elements 34.2.0-next.6 → 35.0.0-next.12
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/cjs/checkbox.template-b7b0460f.js +41 -0
- package/dist/cjs/lime-elements.cjs.js +2 -2
- package/dist/cjs/limel-checkbox.cjs.entry.js +2 -2
- package/dist/cjs/limel-form.cjs.entry.js +330 -352
- package/dist/cjs/limel-input-field.cjs.entry.js +1 -1
- package/dist/cjs/limel-list_3.cjs.entry.js +129 -74
- package/dist/cjs/limel-menu-list.cjs.entry.js +1 -1
- package/dist/cjs/limel-menu.cjs.entry.js +3 -1
- package/dist/cjs/limel-select.cjs.entry.js +1 -1
- package/dist/cjs/limel-slider.cjs.entry.js +1 -1
- package/dist/cjs/limel-tab-bar.cjs.entry.js +1 -1
- package/dist/cjs/limel-table.cjs.entry.js +362 -10
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/collection/collection-manifest.json +1 -1
- package/dist/collection/components/checkbox/checkbox.css +1 -3
- package/dist/collection/components/checkbox/checkbox.template.js +22 -20
- package/dist/collection/components/form/templates/common.js +4 -1
- package/dist/collection/components/input-field/input-field.css +14 -0
- package/dist/collection/components/list/list.css +2 -3
- package/dist/collection/components/menu/menu.css +1 -1
- package/dist/collection/components/menu/menu.js +3 -1
- package/dist/collection/components/menu-list/menu-list.css +2 -3
- package/dist/collection/components/menu-surface/menu-surface.css +9 -1
- package/dist/collection/components/select/select.css +6 -3
- package/dist/collection/components/slider/slider.css +5 -0
- package/dist/collection/components/tab-bar/tab-bar.css +5 -4
- package/dist/collection/components/table/columns.js +1 -1
- package/dist/collection/components/table/selection.js +111 -0
- package/dist/collection/components/table/table-selection.js +125 -0
- package/dist/collection/components/table/table.css +115 -32
- package/dist/collection/components/table/table.js +212 -7
- package/dist/collection/style/internal/lime-theme.scss +30 -31
- package/dist/collection/style/internal/lime-typography.scss +55 -56
- package/dist/collection/style/internal/shared_input-select-picker.scss +1 -0
- package/dist/collection/style/internal/z-index.scss +2 -1
- package/dist/esm/checkbox.template-b4bacc2e.js +39 -0
- package/dist/esm/{component-2eb4e07b.js → component-834d85a1.js} +1 -1
- package/dist/esm/lime-elements.js +2 -2
- package/dist/esm/limel-checkbox.entry.js +3 -3
- package/dist/esm/limel-form.entry.js +330 -352
- package/dist/esm/limel-input-field.entry.js +1 -1
- package/dist/esm/limel-linear-progress.entry.js +1 -1
- package/dist/esm/limel-list_3.entry.js +131 -76
- package/dist/esm/limel-menu-list.entry.js +3 -3
- package/dist/esm/limel-menu.entry.js +3 -1
- package/dist/esm/limel-select.entry.js +1 -1
- package/dist/esm/limel-slider.entry.js +2 -2
- package/dist/esm/limel-tab-bar.entry.js +1 -1
- package/dist/esm/limel-table.entry.js +362 -10
- package/dist/esm/loader.js +2 -2
- package/dist/esm/{util-71a23335.js → util-f1bde91c.js} +1 -1
- package/dist/lime-elements/lime-elements.esm.js +1 -1
- package/dist/lime-elements/p-22c60ff3.js +1 -0
- package/dist/lime-elements/{p-1652d3ca.entry.js → p-24d97176.entry.js} +1 -1
- package/dist/lime-elements/{p-13f0e4f4.entry.js → p-268cf1fa.entry.js} +1 -1
- package/dist/lime-elements/{p-6215e45e.entry.js → p-29f054cc.entry.js} +1 -1
- package/dist/lime-elements/{p-511d71e0.entry.js → p-714fde78.entry.js} +1 -1
- package/dist/lime-elements/{p-bc0dcf01.entry.js → p-84689828.entry.js} +4 -4
- package/dist/lime-elements/{p-31299106.js → p-90c6fa15.js} +1 -1
- package/dist/lime-elements/{p-152a6d5f.js → p-9faad6eb.js} +1 -1
- package/dist/lime-elements/p-ad04a4d4.entry.js +16 -0
- package/dist/lime-elements/{p-a77cbb08.entry.js → p-ca664c9f.entry.js} +1 -1
- package/dist/lime-elements/{p-050e8972.entry.js → p-d8167c28.entry.js} +2 -2
- package/dist/lime-elements/{p-f2c706b8.entry.js → p-dcc52d92.entry.js} +1 -1
- package/dist/lime-elements/{p-b5faa40d.entry.js → p-df8faeb4.entry.js} +2 -2
- package/dist/lime-elements/{p-64549ba6.entry.js → p-e275f502.entry.js} +2 -2
- package/dist/lime-elements/style/internal/lime-theme.scss +30 -31
- package/dist/lime-elements/style/internal/lime-typography.scss +55 -56
- package/dist/lime-elements/style/internal/shared_input-select-picker.scss +1 -0
- package/dist/lime-elements/style/internal/z-index.scss +2 -1
- package/dist/types/components/table/columns.d.ts +7 -0
- package/dist/types/components/table/selection.d.ts +79 -0
- package/dist/types/components/table/table-selection.d.ts +57 -0
- package/dist/types/components/table/table.d.ts +39 -7
- package/dist/types/components/table/table.types.d.ts +13 -0
- package/dist/types/components.d.ts +33 -1
- package/dist/types/stencil-public-runtime.d.ts +6 -4
- package/package.json +14 -14
- package/dist/cjs/checkbox.template-50eb8b76.js +0 -39
- package/dist/esm/checkbox.template-50f7c07b.js +0 -37
- package/dist/lime-elements/p-250f55be.js +0 -1
- package/dist/lime-elements/p-d93a3b07.entry.js +0 -16
|
@@ -952,13 +952,13 @@ body.tabulator-print-fullscreen-hide > *:not(.tabulator-print-fullscreen) {
|
|
|
952
952
|
cursor: pointer;
|
|
953
953
|
}
|
|
954
954
|
[aria-sort=none] .tabulator-arrow {
|
|
955
|
-
border-bottom-color: rgb(var(--
|
|
955
|
+
border-bottom-color: rgb(var(--table-arrow-color)) !important;
|
|
956
956
|
}
|
|
957
957
|
[aria-sort=desc] .tabulator-arrow {
|
|
958
|
-
border-top-color: rgb(var(--
|
|
958
|
+
border-top-color: rgb(var(--table-arrow-color--active)) !important;
|
|
959
959
|
}
|
|
960
960
|
[aria-sort=asc] .tabulator-arrow {
|
|
961
|
-
border-bottom-color: rgb(var(--
|
|
961
|
+
border-bottom-color: rgb(var(--table-arrow-color--active)) !important;
|
|
962
962
|
}
|
|
963
963
|
.tabulator-arrow:before, .tabulator-arrow:after {
|
|
964
964
|
display: block;
|
|
@@ -967,7 +967,7 @@ body.tabulator-print-fullscreen-hide > *:not(.tabulator-print-fullscreen) {
|
|
|
967
967
|
bottom: 0;
|
|
968
968
|
}
|
|
969
969
|
.tabulator-arrow:before {
|
|
970
|
-
background-color: rgb(var(--
|
|
970
|
+
background-color: rgb(var(--table-header-background-color));
|
|
971
971
|
width: 0.5rem;
|
|
972
972
|
height: 0.5rem;
|
|
973
973
|
transform: rotate(45deg);
|
|
@@ -976,7 +976,7 @@ body.tabulator-print-fullscreen-hide > *:not(.tabulator-print-fullscreen) {
|
|
|
976
976
|
}
|
|
977
977
|
.tabulator-arrow:after {
|
|
978
978
|
width: 0.125rem;
|
|
979
|
-
background-color: rgb(var(--
|
|
979
|
+
background-color: rgb(var(--table-arrow-color));
|
|
980
980
|
height: 0.5625rem;
|
|
981
981
|
top: 0.125rem;
|
|
982
982
|
left: -0.0625rem;
|
|
@@ -991,7 +991,7 @@ body.tabulator-print-fullscreen-hide > *:not(.tabulator-print-fullscreen) {
|
|
|
991
991
|
top: -0.6875rem;
|
|
992
992
|
}
|
|
993
993
|
[aria-sort=desc] .tabulator-arrow:after, [aria-sort=asc] .tabulator-arrow:after {
|
|
994
|
-
background-color: rgb(var(--
|
|
994
|
+
background-color: rgb(var(--table-arrow-color--active));
|
|
995
995
|
}
|
|
996
996
|
|
|
997
997
|
@keyframes indicate-sortable-column {
|
|
@@ -1156,21 +1156,21 @@ body.tabulator-print-fullscreen-hide > *:not(.tabulator-print-fullscreen) {
|
|
|
1156
1156
|
* Nothing in this file may output any CSS
|
|
1157
1157
|
* without being explicitly called by outside code.
|
|
1158
1158
|
*/
|
|
1159
|
-
:host(.has-interactive-rows) .tabulator-row.tabulator-selectable {
|
|
1159
|
+
:host(.has-interactive-rows) .tabulator-row:not(.tabulator-calcs).tabulator-selectable {
|
|
1160
1160
|
transition: background-color 0.2s ease, box-shadow 0.2s ease, transform 0.1s ease-out;
|
|
1161
1161
|
}
|
|
1162
|
-
:host(.has-interactive-rows) .tabulator-row.tabulator-selectable:hover {
|
|
1162
|
+
:host(.has-interactive-rows) .tabulator-row:not(.tabulator-calcs).tabulator-selectable:hover {
|
|
1163
1163
|
box-shadow: var(--button-shadow-hovered);
|
|
1164
1164
|
}
|
|
1165
|
-
:host(.has-interactive-rows) .tabulator-row.tabulator-selectable:active {
|
|
1165
|
+
:host(.has-interactive-rows) .tabulator-row:not(.tabulator-calcs).tabulator-selectable:active {
|
|
1166
1166
|
box-shadow: var(--button-shadow-pressed);
|
|
1167
1167
|
transform: translate3d(0, 0.08rem, 0);
|
|
1168
1168
|
}
|
|
1169
|
-
:host(.has-interactive-rows) .tabulator-row.tabulator-selectable:hover {
|
|
1170
|
-
z-index:
|
|
1169
|
+
:host(.has-interactive-rows) .tabulator-row:not(.tabulator-calcs).tabulator-selectable:hover {
|
|
1170
|
+
z-index: 2;
|
|
1171
1171
|
}
|
|
1172
|
-
:host(.has-interactive-rows) .tabulator-row.tabulator-selectable:not(.active):hover {
|
|
1173
|
-
background-color: rgb(var(--
|
|
1172
|
+
:host(.has-interactive-rows) .tabulator-row:not(.tabulator-calcs).tabulator-selectable:not(.active):hover {
|
|
1173
|
+
background-color: rgb(var(--table-row-background-color--hover));
|
|
1174
1174
|
}
|
|
1175
1175
|
|
|
1176
1176
|
:host(.has-low-density) #tabulator-table {
|
|
@@ -1263,26 +1263,109 @@ body.tabulator-print-fullscreen-hide > *:not(.tabulator-print-fullscreen) {
|
|
|
1263
1263
|
.tabulator.has-movable-columns .tabulator-header {
|
|
1264
1264
|
overflow-y: visible;
|
|
1265
1265
|
}
|
|
1266
|
-
.tabulator.has-movable-columns .tabulator-header .tabulator-col {
|
|
1266
|
+
.tabulator.has-movable-columns .tabulator-header .tabulator-col:not(.tabulator-frozen) {
|
|
1267
1267
|
cursor: move !important;
|
|
1268
1268
|
}
|
|
1269
|
-
.tabulator.has-movable-columns .tabulator-header .tabulator-col.tabulator-sortable.tabulator-moving {
|
|
1269
|
+
.tabulator.has-movable-columns .tabulator-header .tabulator-col:not(.tabulator-frozen).tabulator-sortable.tabulator-moving {
|
|
1270
1270
|
animation: detach-a-column-header 0.2s ease forwards;
|
|
1271
1271
|
opacity: 0.9;
|
|
1272
1272
|
border: none;
|
|
1273
1273
|
border-radius: 0.25rem;
|
|
1274
|
-
background-color: rgb(var(
|
|
1274
|
+
background-color: rgb(var(---table-header-background-color-when-being-dragged));
|
|
1275
1275
|
box-shadow: var(--shadow-depth-16);
|
|
1276
1276
|
}
|
|
1277
|
-
.tabulator.has-movable-columns .tabulator-header .tabulator-col.tabulator-sortable.tabulator-moving:hover {
|
|
1278
|
-
background-color: rgb(var(
|
|
1277
|
+
.tabulator.has-movable-columns .tabulator-header .tabulator-col:not(.tabulator-frozen).tabulator-sortable.tabulator-moving:hover {
|
|
1278
|
+
background-color: rgb(var(---table-header-background-color-when-being-dragged));
|
|
1279
|
+
}
|
|
1280
|
+
.tabulator.has-movable-columns .tabulator-header .tabulator-col:not(.tabulator-frozen).tabulator-sortable.tabulator-moving .tabulator-arrow:before {
|
|
1281
|
+
background-color: rgb(var(---table-header-background-color-when-being-dragged));
|
|
1282
|
+
}
|
|
1283
|
+
|
|
1284
|
+
/*
|
|
1285
|
+
* This file is imported into every component!
|
|
1286
|
+
*
|
|
1287
|
+
* Nothing in this file may output any CSS
|
|
1288
|
+
* without being explicitly called by outside code.
|
|
1289
|
+
*/
|
|
1290
|
+
.select-all,
|
|
1291
|
+
.limel-table--row-selector {
|
|
1292
|
+
--mdc-checkbox-ripple-size: 1rem;
|
|
1293
|
+
}
|
|
1294
|
+
|
|
1295
|
+
.select-all {
|
|
1296
|
+
position: absolute;
|
|
1297
|
+
z-index: 1;
|
|
1298
|
+
left: 0;
|
|
1299
|
+
top: 0.4375rem;
|
|
1300
|
+
width: 2.5625rem;
|
|
1301
|
+
display: flex !important;
|
|
1302
|
+
align-items: center;
|
|
1303
|
+
justify-content: center;
|
|
1279
1304
|
}
|
|
1280
|
-
.
|
|
1281
|
-
|
|
1305
|
+
.select-all limel-checkbox {
|
|
1306
|
+
transform: translate(-0.25rem, 0);
|
|
1307
|
+
}
|
|
1308
|
+
|
|
1309
|
+
.limel-table--row-selector {
|
|
1310
|
+
position: sticky !important;
|
|
1311
|
+
left: 0;
|
|
1312
|
+
border-width: 0;
|
|
1313
|
+
justify-content: center;
|
|
1314
|
+
z-index: 1;
|
|
1315
|
+
}
|
|
1316
|
+
.tabulator-row-odd .limel-table--row-selector {
|
|
1317
|
+
background-image: linear-gradient(to right, rgb(var(--table-row-background-color--odd)) 70%, rgb(var(--table-row-background-color--odd), 0));
|
|
1318
|
+
}
|
|
1319
|
+
.tabulator-row-even .limel-table--row-selector {
|
|
1320
|
+
background-image: linear-gradient(to right, rgb(var(--table-row-background-color--even)) 70%, rgb(var(--table-row-background-color--even), 0));
|
|
1321
|
+
}
|
|
1322
|
+
.tabulator-row:not(.tabulator-calcs):hover .limel-table--row-selector {
|
|
1323
|
+
will-change: background-image;
|
|
1324
|
+
background-image: linear-gradient(to right, rgb(var(--table-row-background-color--hover)) 70%, rgb(var(--table-row-background-color--hover), 0));
|
|
1325
|
+
}
|
|
1326
|
+
.tabulator-row.active .limel-table--row-selector, .tabulator-row.active:hover .limel-table--row-selector {
|
|
1327
|
+
background-image: linear-gradient(to right, rgb(var(--table-row-background-color--active)) 70%, rgb(var(--table-row-background-color--active), 0));
|
|
1328
|
+
}
|
|
1329
|
+
.limel-table--row-selector limel-checkbox {
|
|
1330
|
+
transition: opacity 0.2s ease;
|
|
1331
|
+
align-self: center;
|
|
1332
|
+
opacity: 0.3;
|
|
1333
|
+
transform: translate(-0.25rem, 0);
|
|
1334
|
+
}
|
|
1335
|
+
.tabulator-row:hover .limel-table--row-selector limel-checkbox {
|
|
1336
|
+
opacity: 1;
|
|
1337
|
+
}
|
|
1338
|
+
.has-selection .limel-table--row-selector limel-checkbox {
|
|
1339
|
+
opacity: 1;
|
|
1340
|
+
}
|
|
1341
|
+
.limel-table--row-selector .tabulator-col-resize-handle {
|
|
1342
|
+
display: none;
|
|
1343
|
+
}
|
|
1344
|
+
.limel-table--row-selector + .tabulator-col .tabulator-col-resize-handle.prev, .limel-table--row-selector + .tabulator-cell .tabulator-col-resize-handle.prev {
|
|
1345
|
+
display: none;
|
|
1346
|
+
}
|
|
1347
|
+
|
|
1348
|
+
.tabulator.has-movable-columns .tabulator-header .tabulator-col.limel-table--row-selector {
|
|
1349
|
+
border: none;
|
|
1350
|
+
cursor: default;
|
|
1351
|
+
pointer-events: none;
|
|
1352
|
+
background-color: transparent;
|
|
1353
|
+
background-image: linear-gradient(to right, rgb(var(--table-header-background-color--hover)) 70%, rgb(var(--table-header-background-color--hover), 0));
|
|
1354
|
+
position: sticky;
|
|
1355
|
+
left: 0;
|
|
1282
1356
|
}
|
|
1283
1357
|
|
|
1284
1358
|
:host {
|
|
1285
1359
|
display: block;
|
|
1360
|
+
--table-header-background-color: var(--contrast-500);
|
|
1361
|
+
--table-header-background-color--hover: var(--contrast-400);
|
|
1362
|
+
--table-header-background-color-when-being-dragged: var(--contrast-100);
|
|
1363
|
+
--table-row-background-color--odd: var(--contrast-200);
|
|
1364
|
+
--table-row-background-color--even: var(--contrast-100);
|
|
1365
|
+
--table-row-background-color--hover: var(--contrast-100);
|
|
1366
|
+
--table-row-background-color--active: var(--color-teal-lighter);
|
|
1367
|
+
--table-arrow-color: var(--contrast-800);
|
|
1368
|
+
--table-arrow-color--active: var(--color-teal-default);
|
|
1286
1369
|
}
|
|
1287
1370
|
|
|
1288
1371
|
#tabulator-container {
|
|
@@ -1304,46 +1387,46 @@ body.tabulator-print-fullscreen-hide > *:not(.tabulator-print-fullscreen) {
|
|
|
1304
1387
|
|
|
1305
1388
|
.tabulator .tabulator-header {
|
|
1306
1389
|
border-bottom: 0;
|
|
1307
|
-
background-color: rgb(var(--
|
|
1390
|
+
background-color: rgb(var(--table-header-background-color--hover));
|
|
1308
1391
|
}
|
|
1309
1392
|
.tabulator .tabulator-header .tabulator-col {
|
|
1310
1393
|
transition: background-color 0.2s ease;
|
|
1311
|
-
background-color: rgb(var(--
|
|
1394
|
+
background-color: rgb(var(--table-header-background-color--hover));
|
|
1312
1395
|
border-right-color: rgb(var(--contrast-200));
|
|
1313
1396
|
}
|
|
1314
|
-
.tabulator .tabulator-header .tabulator-col .tabulator-col-content {
|
|
1315
|
-
padding-top: 0.5rem;
|
|
1316
|
-
padding-bottom: 0.5rem;
|
|
1317
|
-
}
|
|
1318
1397
|
.tabulator .tabulator-header .tabulator-col.tabulator-sortable:hover {
|
|
1319
|
-
background-color:
|
|
1398
|
+
background-color: var(--table-header-background-color--hover);
|
|
1320
1399
|
}
|
|
1321
1400
|
.tabulator .tabulator-header .tabulator-col-title {
|
|
1322
1401
|
font-weight: 500;
|
|
1323
1402
|
padding-left: 0.125rem;
|
|
1324
1403
|
}
|
|
1325
1404
|
.tabulator .tabulator-footer {
|
|
1326
|
-
background-color: rgb(var(--
|
|
1405
|
+
background-color: rgb(var(--table-header-background-color--hover));
|
|
1327
1406
|
border: none;
|
|
1407
|
+
user-select: auto;
|
|
1328
1408
|
}
|
|
1329
1409
|
.tabulator .tabulator-footer .tabulator-calcs-holder {
|
|
1330
1410
|
border-color: rgb(var(--contrast-600));
|
|
1331
1411
|
}
|
|
1332
1412
|
|
|
1413
|
+
.tabulator-row.tabulator-calcs {
|
|
1414
|
+
cursor: default !important;
|
|
1415
|
+
}
|
|
1333
1416
|
.tabulator-row.tabulator-selectable {
|
|
1334
1417
|
transition: background-color 0.2s ease;
|
|
1335
1418
|
}
|
|
1336
1419
|
.tabulator-row.tabulator-selectable:not(.active):hover {
|
|
1337
|
-
background-color: rgb(var(--
|
|
1420
|
+
background-color: rgb(var(--table-header-background-color));
|
|
1338
1421
|
}
|
|
1339
1422
|
.tabulator-row.tabulator-row-odd {
|
|
1340
|
-
background-color: rgb(var(--
|
|
1423
|
+
background-color: rgb(var(--table-row-background-color--odd));
|
|
1341
1424
|
}
|
|
1342
1425
|
.tabulator-row.tabulator-row-even {
|
|
1343
|
-
background-color: rgb(var(--
|
|
1426
|
+
background-color: rgb(var(--table-row-background-color--even));
|
|
1344
1427
|
}
|
|
1345
1428
|
.tabulator-row.active, .tabulator-row.active:hover {
|
|
1346
|
-
background-color:
|
|
1429
|
+
background-color: rgb(var(--table-row-background-color--active));
|
|
1347
1430
|
}
|
|
1348
1431
|
.tabulator-row .tabulator-cell {
|
|
1349
1432
|
border-right: transparent;
|
|
@@ -3,6 +3,7 @@ import TabulatorTable from 'tabulator-tables';
|
|
|
3
3
|
import { ColumnDefinitionFactory, createColumnSorter } from './columns';
|
|
4
4
|
import { isEqual, has } from 'lodash-es';
|
|
5
5
|
import { ElementPool } from './element-pool';
|
|
6
|
+
import { TableSelection } from './table-selection';
|
|
6
7
|
const FIRST_PAGE = 1;
|
|
7
8
|
/**
|
|
8
9
|
* @exampleComponent limel-example-table
|
|
@@ -12,6 +13,7 @@ const FIRST_PAGE = 1;
|
|
|
12
13
|
* @exampleComponent limel-example-table-local
|
|
13
14
|
* @exampleComponent limel-example-table-remote
|
|
14
15
|
* @exampleComponent limel-example-table-activate-row
|
|
16
|
+
* @exampleComponent limel-example-table-selectable-rows
|
|
15
17
|
* @exampleComponent limel-example-table-default-sorted
|
|
16
18
|
* @exampleComponent limel-example-table-low-density
|
|
17
19
|
*/
|
|
@@ -44,6 +46,27 @@ export class Table {
|
|
|
44
46
|
* The page to show
|
|
45
47
|
*/
|
|
46
48
|
this.page = FIRST_PAGE;
|
|
49
|
+
this.getActiveRows = () => {
|
|
50
|
+
if (!this.tabulator) {
|
|
51
|
+
return [];
|
|
52
|
+
}
|
|
53
|
+
return this.tabulator.getRows('active');
|
|
54
|
+
};
|
|
55
|
+
this.getActiveRowsData = () => {
|
|
56
|
+
// Note: Tabulator.getData() creates copies of each data object
|
|
57
|
+
// and will break this.selection.has checks, hence why this function
|
|
58
|
+
// intentionally retrieves the data using the row components
|
|
59
|
+
return this.getActiveRows().map((row) => row.getData());
|
|
60
|
+
};
|
|
61
|
+
this.selectAllOnChange = (ev) => {
|
|
62
|
+
const selectAll = ev.detail;
|
|
63
|
+
ev.stopPropagation();
|
|
64
|
+
ev.preventDefault();
|
|
65
|
+
const newSelection = selectAll ? this.getActiveRowsData() : [];
|
|
66
|
+
this.select.emit(newSelection);
|
|
67
|
+
this.tableSelection.setSelection(newSelection);
|
|
68
|
+
this.selectAll.emit(selectAll);
|
|
69
|
+
};
|
|
47
70
|
this.getColumnOptions = () => {
|
|
48
71
|
if (!this.movableColumns) {
|
|
49
72
|
return {};
|
|
@@ -54,7 +77,7 @@ export class Table {
|
|
|
54
77
|
};
|
|
55
78
|
};
|
|
56
79
|
this.handleMoveColumn = (_, components) => {
|
|
57
|
-
const columns = components.map(this.findColumn);
|
|
80
|
+
const columns = components.map(this.findColumn).filter((c) => c);
|
|
58
81
|
this.changeColumns.emit(columns);
|
|
59
82
|
};
|
|
60
83
|
this.findColumn = (component) => {
|
|
@@ -69,13 +92,20 @@ export class Table {
|
|
|
69
92
|
this.requestData = this.requestData.bind(this);
|
|
70
93
|
this.onClickRow = this.onClickRow.bind(this);
|
|
71
94
|
this.formatRow = this.formatRow.bind(this);
|
|
95
|
+
this.formatRows = this.formatRows.bind(this);
|
|
72
96
|
this.updateMaxPage = this.updateMaxPage.bind(this);
|
|
73
97
|
this.initTabulatorComponent = this.initTabulatorComponent.bind(this);
|
|
98
|
+
this.setSelection = this.setSelection.bind(this);
|
|
99
|
+
this.addColumnAggregator = this.addColumnAggregator.bind(this);
|
|
74
100
|
this.pool = new ElementPool(document);
|
|
75
101
|
this.columnFactory = new ColumnDefinitionFactory(this.pool);
|
|
76
102
|
}
|
|
77
103
|
componentWillLoad() {
|
|
78
104
|
this.firstRequest = this.mode === 'remote';
|
|
105
|
+
if (this.selectable) {
|
|
106
|
+
this.tableSelection = new TableSelection(() => this.tabulator, this.pool, this.select);
|
|
107
|
+
this.tableSelection.setSelection(this.selection);
|
|
108
|
+
}
|
|
79
109
|
}
|
|
80
110
|
componentDidLoad() {
|
|
81
111
|
this.init();
|
|
@@ -102,7 +132,7 @@ export class Table {
|
|
|
102
132
|
if (!this.tabulator) {
|
|
103
133
|
return;
|
|
104
134
|
}
|
|
105
|
-
this.
|
|
135
|
+
this.formatRows();
|
|
106
136
|
}
|
|
107
137
|
updateData(newData = [], oldData = []) {
|
|
108
138
|
if (isEqual(newData, oldData)) {
|
|
@@ -114,6 +144,7 @@ export class Table {
|
|
|
114
144
|
return;
|
|
115
145
|
}
|
|
116
146
|
this.tabulator.replaceData(this.data);
|
|
147
|
+
this.setSelection();
|
|
117
148
|
});
|
|
118
149
|
}
|
|
119
150
|
updateColumns(newColumns, oldColumns) {
|
|
@@ -123,20 +154,46 @@ export class Table {
|
|
|
123
154
|
if (this.areSameColumns(newColumns, oldColumns)) {
|
|
124
155
|
return;
|
|
125
156
|
}
|
|
126
|
-
const
|
|
157
|
+
const columnsInTable = this.tabulator
|
|
127
158
|
.getColumns()
|
|
128
|
-
.
|
|
129
|
-
|
|
159
|
+
.filter((c) => c.getField());
|
|
160
|
+
const oldColumnsInTable = columnsInTable.map((c) => oldColumns.find((old) => old.field === c.getField()));
|
|
161
|
+
if (this.areSameColumns(newColumns, oldColumnsInTable)) {
|
|
130
162
|
return;
|
|
131
163
|
}
|
|
132
164
|
// Updating columns requires a reinitialization otherwise sorting will not work
|
|
133
165
|
// afterwards
|
|
134
166
|
this.init();
|
|
135
167
|
}
|
|
168
|
+
updateAggregates(newAggregates, oldAggregates) {
|
|
169
|
+
if (!this.tabulator) {
|
|
170
|
+
return;
|
|
171
|
+
}
|
|
172
|
+
if (isEqual(newAggregates, oldAggregates)) {
|
|
173
|
+
return;
|
|
174
|
+
}
|
|
175
|
+
if (!this.haveSameAggregateFields(newAggregates, oldAggregates)) {
|
|
176
|
+
this.init();
|
|
177
|
+
return;
|
|
178
|
+
}
|
|
179
|
+
this.tabulator.recalc();
|
|
180
|
+
this.tabulator.rowManager.redraw();
|
|
181
|
+
}
|
|
182
|
+
updateSelection(newSelection) {
|
|
183
|
+
if (!this.tableSelection) {
|
|
184
|
+
return;
|
|
185
|
+
}
|
|
186
|
+
this.tableSelection.setSelection(newSelection);
|
|
187
|
+
}
|
|
136
188
|
areSameColumns(newColumns, oldColumns) {
|
|
137
189
|
return (newColumns.length === oldColumns.length &&
|
|
138
190
|
newColumns.every((column) => oldColumns.includes(column)));
|
|
139
191
|
}
|
|
192
|
+
haveSameAggregateFields(newAggregates, oldAggregates) {
|
|
193
|
+
const oldAggregateFields = (oldAggregates === null || oldAggregates === void 0 ? void 0 : oldAggregates.map((a) => a.field)) || [];
|
|
194
|
+
return ((newAggregates === null || newAggregates === void 0 ? void 0 : newAggregates.length) === (oldAggregates === null || oldAggregates === void 0 ? void 0 : oldAggregates.length) &&
|
|
195
|
+
!!(newAggregates === null || newAggregates === void 0 ? void 0 : newAggregates.every((a) => oldAggregateFields.includes(a.field))));
|
|
196
|
+
}
|
|
140
197
|
init() {
|
|
141
198
|
if (this.tabulator) {
|
|
142
199
|
this.pool.releaseAll();
|
|
@@ -163,14 +220,22 @@ export class Table {
|
|
|
163
220
|
// matter if its rendered or not.
|
|
164
221
|
if (!('ResizeObserver' in window)) {
|
|
165
222
|
this.tabulator = new TabulatorTable(table, options);
|
|
223
|
+
this.setSelection();
|
|
166
224
|
return;
|
|
167
225
|
}
|
|
168
226
|
const observer = new ResizeObserver(() => {
|
|
169
227
|
this.tabulator = new TabulatorTable(table, options);
|
|
228
|
+
this.setSelection();
|
|
170
229
|
observer.unobserve(table);
|
|
171
230
|
});
|
|
172
231
|
observer.observe(table);
|
|
173
232
|
}
|
|
233
|
+
setSelection() {
|
|
234
|
+
if (!(this.tabulator && this.tableSelection)) {
|
|
235
|
+
return;
|
|
236
|
+
}
|
|
237
|
+
this.tableSelection.setSelection(this.selection);
|
|
238
|
+
}
|
|
174
239
|
updateMaxPage() {
|
|
175
240
|
var _a;
|
|
176
241
|
(_a = this.tabulator) === null || _a === void 0 ? void 0 : _a.setMaxPage(this.calculatePageCount());
|
|
@@ -192,7 +257,38 @@ export class Table {
|
|
|
192
257
|
});
|
|
193
258
|
}
|
|
194
259
|
getColumnDefinitions() {
|
|
195
|
-
|
|
260
|
+
const columnDefinitions = this.columns
|
|
261
|
+
.map(this.addColumnAggregator)
|
|
262
|
+
.map(this.columnFactory.create);
|
|
263
|
+
if (this.tableSelection) {
|
|
264
|
+
return this.tableSelection.getColumnDefinitions(columnDefinitions);
|
|
265
|
+
}
|
|
266
|
+
return columnDefinitions;
|
|
267
|
+
}
|
|
268
|
+
addColumnAggregator(column) {
|
|
269
|
+
var _a;
|
|
270
|
+
if (!((_a = this.aggregates) === null || _a === void 0 ? void 0 : _a.length) || column.aggregator) {
|
|
271
|
+
return column;
|
|
272
|
+
}
|
|
273
|
+
const aggregate = this.aggregates.find((a) => a.field === column.field);
|
|
274
|
+
if (aggregate) {
|
|
275
|
+
column.aggregator = (col,
|
|
276
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
277
|
+
_values,
|
|
278
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
279
|
+
_data) => {
|
|
280
|
+
var _a;
|
|
281
|
+
if (!col) {
|
|
282
|
+
return undefined;
|
|
283
|
+
}
|
|
284
|
+
const value = (_a = this.aggregates.find((a) => a.field === col.field)) === null || _a === void 0 ? void 0 : _a.value;
|
|
285
|
+
if (col.formatter) {
|
|
286
|
+
return col.formatter(value);
|
|
287
|
+
}
|
|
288
|
+
return value;
|
|
289
|
+
};
|
|
290
|
+
}
|
|
291
|
+
return column;
|
|
196
292
|
}
|
|
197
293
|
getAjaxOptions() {
|
|
198
294
|
if (!this.isRemoteMode()) {
|
|
@@ -291,7 +387,11 @@ export class Table {
|
|
|
291
387
|
}
|
|
292
388
|
this.changePage.emit(page);
|
|
293
389
|
}
|
|
294
|
-
onClickRow(
|
|
390
|
+
onClickRow(_ev, row) {
|
|
391
|
+
if (typeof row.getPosition === 'undefined') {
|
|
392
|
+
// Not a data row, probably a CalcComponent
|
|
393
|
+
return;
|
|
394
|
+
}
|
|
295
395
|
if (this.activeRow === row.getData()) {
|
|
296
396
|
this.activeRow = null;
|
|
297
397
|
}
|
|
@@ -300,6 +400,9 @@ export class Table {
|
|
|
300
400
|
}
|
|
301
401
|
this.activate.emit(this.activeRow);
|
|
302
402
|
}
|
|
403
|
+
formatRows() {
|
|
404
|
+
this.tabulator.getRows().forEach(this.formatRow);
|
|
405
|
+
}
|
|
303
406
|
formatRow(row) {
|
|
304
407
|
if (this.activeRow === row.getData()) {
|
|
305
408
|
row.getElement().classList.add('active');
|
|
@@ -319,16 +422,30 @@ export class Table {
|
|
|
319
422
|
return columns.some((column) => has(column, 'aggregator'));
|
|
320
423
|
}
|
|
321
424
|
render() {
|
|
425
|
+
var _a;
|
|
322
426
|
return (h("div", { id: "tabulator-container" },
|
|
323
427
|
h("div", { id: "tabulator-loader", style: { display: this.loading ? 'flex' : 'none' } },
|
|
324
428
|
h("limel-spinner", { size: "large" })),
|
|
325
429
|
this.renderEmptyMessage(),
|
|
430
|
+
this.renderSelectAll(),
|
|
326
431
|
h("div", { id: "tabulator-table", class: {
|
|
327
432
|
'has-pagination': this.totalRows > this.pageSize,
|
|
328
433
|
'has-aggregation': this.hasAggregation(this.columns),
|
|
329
434
|
'has-movable-columns': this.movableColumns,
|
|
435
|
+
'has-rowselector': this.selectable,
|
|
436
|
+
'has-selection': (_a = this.tableSelection) === null || _a === void 0 ? void 0 : _a.hasSelection,
|
|
330
437
|
} })));
|
|
331
438
|
}
|
|
439
|
+
renderSelectAll() {
|
|
440
|
+
var _a, _b, _c;
|
|
441
|
+
if (!this.selectable) {
|
|
442
|
+
return;
|
|
443
|
+
}
|
|
444
|
+
const showSelectAll = !this.loading && this.tableSelection;
|
|
445
|
+
return (h("div", { class: "select-all", style: { display: showSelectAll ? 'inline-block' : 'none' } },
|
|
446
|
+
h("limel-checkbox", { onChange: this.selectAllOnChange, checked: (_a = this.tableSelection) === null || _a === void 0 ? void 0 : _a.hasSelection, indeterminate: ((_b = this.tableSelection) === null || _b === void 0 ? void 0 : _b.hasSelection) &&
|
|
447
|
+
((_c = this.selection) === null || _c === void 0 ? void 0 : _c.length) < this.data.length })));
|
|
448
|
+
}
|
|
332
449
|
renderEmptyMessage() {
|
|
333
450
|
const showEmptyMessage = !this.loading && !this.data.length && this.emptyMessage;
|
|
334
451
|
return (h("div", { id: "tabulator-empty-text", style: { display: showEmptyMessage ? 'flex' : 'none' } },
|
|
@@ -537,6 +654,58 @@ export class Table {
|
|
|
537
654
|
},
|
|
538
655
|
"attribute": "empty-message",
|
|
539
656
|
"reflect": false
|
|
657
|
+
},
|
|
658
|
+
"aggregates": {
|
|
659
|
+
"type": "unknown",
|
|
660
|
+
"mutable": false,
|
|
661
|
+
"complexType": {
|
|
662
|
+
"original": "ColumnAggregate[]",
|
|
663
|
+
"resolved": "ColumnAggregate[]",
|
|
664
|
+
"references": {
|
|
665
|
+
"ColumnAggregate": {
|
|
666
|
+
"location": "import",
|
|
667
|
+
"path": "./table.types"
|
|
668
|
+
}
|
|
669
|
+
}
|
|
670
|
+
},
|
|
671
|
+
"required": false,
|
|
672
|
+
"optional": false,
|
|
673
|
+
"docs": {
|
|
674
|
+
"tags": [],
|
|
675
|
+
"text": "Column aggregates to be displayed in the table"
|
|
676
|
+
}
|
|
677
|
+
},
|
|
678
|
+
"selectable": {
|
|
679
|
+
"type": "boolean",
|
|
680
|
+
"mutable": false,
|
|
681
|
+
"complexType": {
|
|
682
|
+
"original": "boolean",
|
|
683
|
+
"resolved": "boolean",
|
|
684
|
+
"references": {}
|
|
685
|
+
},
|
|
686
|
+
"required": false,
|
|
687
|
+
"optional": false,
|
|
688
|
+
"docs": {
|
|
689
|
+
"tags": [],
|
|
690
|
+
"text": "Enables row selection"
|
|
691
|
+
},
|
|
692
|
+
"attribute": "selectable",
|
|
693
|
+
"reflect": false
|
|
694
|
+
},
|
|
695
|
+
"selection": {
|
|
696
|
+
"type": "unknown",
|
|
697
|
+
"mutable": false,
|
|
698
|
+
"complexType": {
|
|
699
|
+
"original": "object[]",
|
|
700
|
+
"resolved": "object[]",
|
|
701
|
+
"references": {}
|
|
702
|
+
},
|
|
703
|
+
"required": false,
|
|
704
|
+
"optional": false,
|
|
705
|
+
"docs": {
|
|
706
|
+
"tags": [],
|
|
707
|
+
"text": "Selected data. Requires `selectable` to be true."
|
|
708
|
+
}
|
|
540
709
|
}
|
|
541
710
|
}; }
|
|
542
711
|
static get events() { return [{
|
|
@@ -629,6 +798,36 @@ export class Table {
|
|
|
629
798
|
}
|
|
630
799
|
}
|
|
631
800
|
}
|
|
801
|
+
}, {
|
|
802
|
+
"method": "select",
|
|
803
|
+
"name": "select",
|
|
804
|
+
"bubbles": true,
|
|
805
|
+
"cancelable": true,
|
|
806
|
+
"composed": true,
|
|
807
|
+
"docs": {
|
|
808
|
+
"tags": [],
|
|
809
|
+
"text": "Emitted when the row selection has been changed"
|
|
810
|
+
},
|
|
811
|
+
"complexType": {
|
|
812
|
+
"original": "object[]",
|
|
813
|
+
"resolved": "object[]",
|
|
814
|
+
"references": {}
|
|
815
|
+
}
|
|
816
|
+
}, {
|
|
817
|
+
"method": "selectAll",
|
|
818
|
+
"name": "selectAll",
|
|
819
|
+
"bubbles": true,
|
|
820
|
+
"cancelable": true,
|
|
821
|
+
"composed": true,
|
|
822
|
+
"docs": {
|
|
823
|
+
"tags": [],
|
|
824
|
+
"text": "Emitted when the select all rows state is toggled"
|
|
825
|
+
},
|
|
826
|
+
"complexType": {
|
|
827
|
+
"original": "boolean",
|
|
828
|
+
"resolved": "boolean",
|
|
829
|
+
"references": {}
|
|
830
|
+
}
|
|
632
831
|
}]; }
|
|
633
832
|
static get elementRef() { return "host"; }
|
|
634
833
|
static get watchers() { return [{
|
|
@@ -649,5 +848,11 @@ export class Table {
|
|
|
649
848
|
}, {
|
|
650
849
|
"propName": "columns",
|
|
651
850
|
"methodName": "updateColumns"
|
|
851
|
+
}, {
|
|
852
|
+
"propName": "aggregates",
|
|
853
|
+
"methodName": "updateAggregates"
|
|
854
|
+
}, {
|
|
855
|
+
"propName": "selection",
|
|
856
|
+
"methodName": "updateSelection"
|
|
652
857
|
}]; }
|
|
653
858
|
}
|
|
@@ -10,37 +10,36 @@
|
|
|
10
10
|
@use '../brand-colors';
|
|
11
11
|
@use '../_theme-color-variables';
|
|
12
12
|
|
|
13
|
-
@use '@material/theme' with
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
);
|
|
13
|
+
@use '@material/theme' with (
|
|
14
|
+
$primary: brand-colors.$lime-turquoise,
|
|
15
|
+
$secondary: brand-colors.$lime-dark-grey,
|
|
16
|
+
$background: #fff,
|
|
17
|
+
$surface: #fff,
|
|
18
|
+
$error: #b00020,
|
|
19
|
+
$on-primary: #fff,
|
|
20
|
+
$on-secondary: #fff,
|
|
21
|
+
$on-surface: #000,
|
|
22
|
+
$on-error: #fff,
|
|
23
|
+
// $text-disabled-on-background: rgba(0, 0, 0, 0.38),
|
|
24
|
+
// $text-hint-on-light: rgba(0, 0, 0, 0.38),
|
|
25
|
+
// $text-primary-on-background: rgba(0, 0, 0, 0.87),
|
|
26
|
+
// $text-secondary-on-background: rgba(0, 0, 0, 0.54),
|
|
27
|
+
//
|
|
28
|
+
// The following variables are also available to be set if needed
|
|
29
|
+
// (note by Ads: they probably aren't available in MDC v11)
|
|
30
|
+
//
|
|
31
|
+
// $text-hint-on-background: rgba(0, 0, 0, 0.38),
|
|
32
|
+
// $text-icon-on-background: rgba(0, 0, 0, 0.38),
|
|
33
|
+
// $text-primary-on-light: rgba(0, 0, 0, 0.87),
|
|
34
|
+
// $text-secondary-on-light: rgba(0, 0, 0, 0.54),
|
|
35
|
+
// $text-disabled-on-light: rgba(0, 0, 0, 0.38),
|
|
36
|
+
// $text-icon-on-light: rgba(0, 0, 0, 0.38),
|
|
37
|
+
// $text-primary-on-dark: white,
|
|
38
|
+
// $text-secondary-on-dark: rgba(255, 255, 255, 0.7),
|
|
39
|
+
// $text-hint-on-dark: rgba(255, 255, 255, 0.5),
|
|
40
|
+
// $text-disabled-on-dark: rgba(255, 255, 255, 0.5),
|
|
41
|
+
// $text-icon-on-dark: rgba(255, 255, 255, 0.5),
|
|
42
|
+
);
|
|
44
43
|
@forward '@material/theme';
|
|
45
44
|
|
|
46
45
|
@use './lime-typography';
|