@limetech/lime-elements 35.0.0-next.3 → 35.0.0-next.32

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 (243) hide show
  1. package/dist/cjs/checkbox.template-7e3fd86a.js +43 -0
  2. package/dist/cjs/{component-f7ef9087.js → component-66df95e7.js} +190 -132
  3. package/dist/cjs/{component-f532119f.js → component-67144c1c.js} +47 -3
  4. package/dist/cjs/{component-ed21410d.js → component-ae3bfacf.js} +367 -235
  5. package/dist/cjs/{component-2faaa141.js → component-cf490570.js} +213 -143
  6. package/dist/cjs/{component-10dbdd60.js → component-dd795ff0.js} +7 -5
  7. package/dist/cjs/{index-e63a89d7.js → index-43283636.js} +23 -0
  8. package/dist/cjs/lime-elements.cjs.js +3 -3
  9. package/dist/cjs/limel-badge.cjs.entry.js +3 -3
  10. package/dist/cjs/limel-banner.cjs.entry.js +1 -1
  11. package/dist/cjs/limel-button-group.cjs.entry.js +2 -2
  12. package/dist/cjs/limel-button.cjs.entry.js +2 -2
  13. package/dist/cjs/limel-checkbox.cjs.entry.js +135 -89
  14. package/dist/cjs/limel-chip-set.cjs.entry.js +234 -190
  15. package/dist/cjs/limel-circular-progress.cjs.entry.js +2 -2
  16. package/dist/cjs/limel-code-editor.cjs.entry.js +49 -22
  17. package/dist/cjs/limel-collapsible-section.cjs.entry.js +1 -1
  18. package/dist/cjs/limel-color-picker-palette_2.cjs.entry.js +1 -1
  19. package/dist/cjs/limel-color-picker.cjs.entry.js +1 -1
  20. package/dist/cjs/limel-config.cjs.entry.js +1 -1
  21. package/dist/cjs/limel-date-picker.cjs.entry.js +5 -5
  22. package/dist/cjs/limel-dialog.cjs.entry.js +8 -9
  23. package/dist/cjs/limel-file.cjs.entry.js +5 -5
  24. package/dist/cjs/limel-flatpickr-adapter.cjs.entry.js +972 -648
  25. package/dist/cjs/limel-flex-container.cjs.entry.js +5 -1
  26. package/dist/cjs/limel-form.cjs.entry.js +382 -355
  27. package/dist/cjs/limel-grid.cjs.entry.js +1 -1
  28. package/dist/cjs/limel-header.cjs.entry.js +1 -1
  29. package/dist/cjs/limel-icon-button.cjs.entry.js +5 -5
  30. package/dist/cjs/limel-icon.cjs.entry.js +1 -1
  31. package/dist/cjs/limel-input-field.cjs.entry.js +9 -8
  32. package/dist/cjs/limel-linear-progress.cjs.entry.js +3 -3
  33. package/dist/cjs/limel-list_3.cjs.entry.js +147 -88
  34. package/dist/cjs/limel-menu-list.cjs.entry.js +86 -73
  35. package/dist/cjs/limel-menu.cjs.entry.js +1 -1
  36. package/dist/cjs/limel-picker.cjs.entry.js +3 -6
  37. package/dist/cjs/limel-popover-surface.cjs.entry.js +2 -2
  38. package/dist/cjs/limel-progress-flow-item.cjs.entry.js +1 -1
  39. package/dist/cjs/limel-progress-flow.cjs.entry.js +1 -1
  40. package/dist/cjs/limel-select.cjs.entry.js +5 -5
  41. package/dist/cjs/limel-slider.cjs.entry.js +33 -6
  42. package/dist/cjs/limel-snackbar.cjs.entry.js +78 -72
  43. package/dist/cjs/limel-spinner.cjs.entry.js +1 -1
  44. package/dist/cjs/limel-switch.cjs.entry.js +497 -201
  45. package/dist/cjs/limel-tab-bar.cjs.entry.js +262 -185
  46. package/dist/cjs/limel-tab-panel.cjs.entry.js +1 -1
  47. package/dist/cjs/limel-table.cjs.entry.js +375 -12
  48. package/dist/cjs/limel-tooltip_2.cjs.entry.js +1 -1
  49. package/dist/cjs/loader.cjs.js +3 -3
  50. package/dist/collection/collection-manifest.json +2 -2
  51. package/dist/collection/components/badge/badge.css +9 -15
  52. package/dist/collection/components/badge/badge.js +2 -2
  53. package/dist/collection/components/button/button.css +333 -145
  54. package/dist/collection/components/button-group/button-group.css +30 -5
  55. package/dist/collection/components/checkbox/checkbox.css +70 -17
  56. package/dist/collection/components/checkbox/checkbox.js +5 -4
  57. package/dist/collection/components/checkbox/checkbox.template.js +24 -20
  58. package/dist/collection/components/chip-set/chip-set.css +367 -34
  59. package/dist/collection/components/circular-progress/circular-progress.css +2 -2
  60. package/dist/collection/components/code-editor/code-editor.css +8 -13
  61. package/dist/collection/components/date-picker/flatpickr-adapter/flatpickr-adapter.css +1 -1
  62. package/dist/collection/components/dialog/dialog.css +153 -109
  63. package/dist/collection/components/dialog/dialog.js +7 -0
  64. package/dist/collection/components/flex-container/flex-container.js +10 -0
  65. package/dist/collection/components/form/form.css +5 -1
  66. package/dist/collection/components/form/form.js +34 -0
  67. package/dist/collection/components/form/templates/common.js +4 -1
  68. package/dist/collection/components/icon-button/icon-button.css +116 -59
  69. package/dist/collection/components/icon-button/icon-button.js +1 -0
  70. package/dist/collection/components/input-field/input-field.css +344 -29
  71. package/dist/collection/components/input-field/input-field.js +3 -2
  72. package/dist/collection/components/linear-progress/linear-progress.css +14 -2
  73. package/dist/collection/components/list/list-renderer.js +1 -4
  74. package/dist/collection/components/list/list.css +937 -90
  75. package/dist/collection/components/list/list.js +13 -6
  76. package/dist/collection/components/menu-list/menu-list-renderer.js +1 -4
  77. package/dist/collection/components/menu-list/menu-list.css +937 -90
  78. package/dist/collection/components/menu-surface/menu-surface.css +31 -7
  79. package/dist/collection/components/picker/picker.js +4 -6
  80. package/dist/collection/components/popover-surface/popover-surface.css +1 -0
  81. package/dist/collection/components/select/select.css +424 -17
  82. package/dist/collection/components/select/select.template.js +1 -1
  83. package/dist/collection/components/slider/slider.css +49 -2
  84. package/dist/collection/components/snackbar/snackbar.css +588 -301
  85. package/dist/collection/components/switch/switch.css +592 -222
  86. package/dist/collection/components/switch/switch.js +18 -12
  87. package/dist/collection/components/tab-bar/tab-bar.css +77 -48
  88. package/dist/collection/components/table/columns.js +1 -1
  89. package/dist/collection/components/table/selection.js +111 -0
  90. package/dist/collection/components/table/table-selection.js +125 -0
  91. package/dist/collection/components/table/table.css +275 -141
  92. package/dist/collection/components/table/table.js +231 -13
  93. package/dist/collection/style/functions.scss +3 -1
  94. package/dist/collection/style/internal/lime-theme.scss +30 -31
  95. package/dist/collection/style/internal/lime-typography.scss +55 -56
  96. package/dist/collection/style/internal/z-index.scss +2 -1
  97. package/dist/esm/checkbox.template-e68ade4d.js +41 -0
  98. package/dist/esm/{component-89e0ce26.js → component-19eb6e2b.js} +7 -5
  99. package/dist/esm/{component-2630c3d7.js → component-288691f3.js} +367 -235
  100. package/dist/esm/{component-d682c974.js → component-410aad5a.js} +44 -4
  101. package/dist/esm/{component-429e92ee.js → component-5b4ac85a.js} +213 -143
  102. package/dist/esm/{component-2eb4e07b.js → component-fffa3419.js} +191 -133
  103. package/dist/esm/{index-2316f345.js → index-4456d4ad.js} +23 -0
  104. package/dist/esm/lime-elements.js +3 -3
  105. package/dist/esm/limel-badge.entry.js +3 -3
  106. package/dist/esm/limel-banner.entry.js +1 -1
  107. package/dist/esm/limel-button-group.entry.js +2 -2
  108. package/dist/esm/limel-button.entry.js +2 -2
  109. package/dist/esm/limel-checkbox.entry.js +136 -90
  110. package/dist/esm/limel-chip-set.entry.js +234 -190
  111. package/dist/esm/limel-circular-progress.entry.js +2 -2
  112. package/dist/esm/limel-code-editor.entry.js +49 -22
  113. package/dist/esm/limel-collapsible-section.entry.js +1 -1
  114. package/dist/esm/limel-color-picker-palette_2.entry.js +1 -1
  115. package/dist/esm/limel-color-picker.entry.js +1 -1
  116. package/dist/esm/limel-config.entry.js +1 -1
  117. package/dist/esm/limel-date-picker.entry.js +5 -5
  118. package/dist/esm/limel-dialog.entry.js +8 -9
  119. package/dist/esm/limel-file.entry.js +5 -5
  120. package/dist/esm/limel-flatpickr-adapter.entry.js +972 -648
  121. package/dist/esm/limel-flex-container.entry.js +5 -1
  122. package/dist/esm/limel-form.entry.js +383 -356
  123. package/dist/esm/limel-grid.entry.js +1 -1
  124. package/dist/esm/limel-header.entry.js +1 -1
  125. package/dist/esm/limel-icon-button.entry.js +5 -5
  126. package/dist/esm/limel-icon.entry.js +1 -1
  127. package/dist/esm/limel-input-field.entry.js +9 -8
  128. package/dist/esm/limel-linear-progress.entry.js +4 -4
  129. package/dist/esm/limel-list_3.entry.js +148 -89
  130. package/dist/esm/limel-menu-list.entry.js +87 -74
  131. package/dist/esm/limel-menu.entry.js +1 -1
  132. package/dist/esm/limel-picker.entry.js +3 -6
  133. package/dist/esm/limel-popover-surface.entry.js +2 -2
  134. package/dist/esm/limel-progress-flow-item.entry.js +1 -1
  135. package/dist/esm/limel-progress-flow.entry.js +1 -1
  136. package/dist/esm/limel-select.entry.js +5 -5
  137. package/dist/esm/limel-slider.entry.js +34 -7
  138. package/dist/esm/limel-snackbar.entry.js +78 -72
  139. package/dist/esm/limel-spinner.entry.js +1 -1
  140. package/dist/esm/limel-switch.entry.js +497 -201
  141. package/dist/esm/limel-tab-bar.entry.js +262 -185
  142. package/dist/esm/limel-tab-panel.entry.js +1 -1
  143. package/dist/esm/limel-table.entry.js +375 -12
  144. package/dist/esm/limel-tooltip_2.entry.js +1 -1
  145. package/dist/esm/loader.js +3 -3
  146. package/dist/esm/polyfills/css-shim.js +1 -1
  147. package/dist/esm/{util-71a23335.js → util-f1bde91c.js} +1 -1
  148. package/dist/lime-elements/lime-elements.esm.js +1 -1
  149. package/dist/lime-elements/{p-a4c532a7.entry.js → p-00d485d8.entry.js} +1 -1
  150. package/dist/lime-elements/p-062a9599.entry.js +131 -0
  151. package/dist/lime-elements/p-0c5655e2.js +1 -0
  152. package/dist/lime-elements/{p-597cbe05.entry.js → p-0ea1cbf6.entry.js} +1 -1
  153. package/dist/lime-elements/p-1bacecd5.entry.js +73 -0
  154. package/dist/lime-elements/p-1c284626.js +73 -0
  155. package/dist/lime-elements/p-1fef7a86.entry.js +16 -0
  156. package/dist/lime-elements/{p-a2cf74c1.entry.js → p-255084bd.entry.js} +1 -1
  157. package/dist/lime-elements/{p-e881e98d.entry.js → p-2550ff27.entry.js} +1 -1
  158. package/dist/lime-elements/p-2a7c3c07.entry.js +1 -0
  159. package/dist/lime-elements/{p-31fecf5d.entry.js → p-3bef288b.entry.js} +1 -1
  160. package/dist/lime-elements/{p-58cbe99d.entry.js → p-3f440859.entry.js} +1 -1
  161. package/dist/lime-elements/{p-4b5af81b.entry.js → p-41ec08c9.entry.js} +1 -1
  162. package/dist/lime-elements/{p-92146da6.js → p-44f9b6d5.js} +0 -0
  163. package/dist/lime-elements/{p-1fb5340d.entry.js → p-45689f25.entry.js} +1 -1
  164. package/dist/lime-elements/p-47ef0ebb.entry.js +1 -0
  165. package/dist/lime-elements/{p-076bd4dc.js → p-48d4ef20.js} +3 -3
  166. package/dist/lime-elements/p-4e9869f4.entry.js +126 -0
  167. package/dist/lime-elements/{p-6003f817.entry.js → p-549190f6.entry.js} +1 -1
  168. package/dist/lime-elements/p-63516991.entry.js +1 -0
  169. package/dist/lime-elements/p-6fc9a0be.entry.js +59 -0
  170. package/dist/lime-elements/{p-64549ba6.entry.js → p-70a4d004.entry.js} +3 -3
  171. package/dist/lime-elements/p-7d4eb67f.entry.js +1 -0
  172. package/dist/lime-elements/p-87a8afd2.entry.js +16 -0
  173. package/dist/lime-elements/{p-714fde78.entry.js → p-897a7f8a.entry.js} +1 -1
  174. package/dist/lime-elements/{p-fc30b8e3.entry.js → p-8a5ca741.entry.js} +1 -1
  175. package/dist/lime-elements/{p-8a2c1038.entry.js → p-9607b6f9.entry.js} +2 -2
  176. package/dist/lime-elements/p-9caf28bd.entry.js +1 -0
  177. package/dist/lime-elements/{p-152a6d5f.js → p-9faad6eb.js} +1 -1
  178. package/dist/lime-elements/{p-34c7872e.entry.js → p-a35e6b8a.entry.js} +1 -1
  179. package/dist/lime-elements/{p-13f0e4f4.entry.js → p-ab88cc76.entry.js} +1 -1
  180. package/dist/lime-elements/{p-041ae00c.entry.js → p-b808ba3d.entry.js} +1 -1
  181. package/dist/lime-elements/p-bcaa25e1.entry.js +1 -0
  182. package/dist/lime-elements/p-be351178.entry.js +37 -0
  183. package/dist/lime-elements/p-c40f5030.entry.js +82 -0
  184. package/dist/lime-elements/p-c4e2eb42.entry.js +1 -0
  185. package/dist/lime-elements/{p-1876a96a.entry.js → p-c5168bda.entry.js} +1 -1
  186. package/dist/lime-elements/p-cbc43682.js +81 -0
  187. package/dist/lime-elements/{p-ace9affc.js → p-d0a7de87.js} +2 -2
  188. package/dist/lime-elements/{p-be56ffab.entry.js → p-d5f17adb.entry.js} +1 -1
  189. package/dist/lime-elements/p-d70f1c00.entry.js +59 -0
  190. package/dist/lime-elements/{p-8ad5e143.entry.js → p-dd62c71b.entry.js} +1 -1
  191. package/dist/lime-elements/p-dfba92de.js +126 -0
  192. package/dist/lime-elements/p-e320ba6a.entry.js +1 -0
  193. package/dist/lime-elements/p-e55144ec.entry.js +1 -0
  194. package/dist/lime-elements/p-e66816a4.entry.js +82 -0
  195. package/dist/lime-elements/{p-dfe0a58b.entry.js → p-e6f39a71.entry.js} +1 -1
  196. package/dist/lime-elements/p-f777d8a3.entry.js +82 -0
  197. package/dist/lime-elements/style/functions.scss +3 -1
  198. package/dist/lime-elements/style/internal/lime-theme.scss +30 -31
  199. package/dist/lime-elements/style/internal/lime-typography.scss +55 -56
  200. package/dist/lime-elements/style/internal/z-index.scss +2 -1
  201. package/dist/types/components/badge/badge.d.ts +1 -1
  202. package/dist/types/components/checkbox/checkbox.d.ts +3 -2
  203. package/dist/types/components/checkbox/checkbox.template.d.ts +1 -0
  204. package/dist/types/components/dialog/dialog.d.ts +7 -0
  205. package/dist/types/components/flex-container/flex-container.d.ts +7 -0
  206. package/dist/types/components/form/form.d.ts +8 -1
  207. package/dist/types/components/form/form.types.d.ts +6 -0
  208. package/dist/types/components/picker/picker.d.ts +2 -1
  209. package/dist/types/components/switch/switch.d.ts +2 -2
  210. package/dist/types/components/table/columns.d.ts +7 -0
  211. package/dist/types/components/table/selection.d.ts +79 -0
  212. package/dist/types/components/table/table-selection.d.ts +57 -0
  213. package/dist/types/components/table/table.d.ts +41 -7
  214. package/dist/types/components/table/table.types.d.ts +13 -0
  215. package/dist/types/components.d.ts +44 -4
  216. package/dist/types/stencil-public-runtime.d.ts +6 -4
  217. package/package.json +22 -22
  218. package/dist/cjs/checkbox.template-50eb8b76.js +0 -39
  219. package/dist/esm/checkbox.template-50f7c07b.js +0 -37
  220. package/dist/lime-elements/p-0ce9165f.entry.js +0 -1
  221. package/dist/lime-elements/p-0fd208f3.entry.js +0 -82
  222. package/dist/lime-elements/p-143705b1.entry.js +0 -1
  223. package/dist/lime-elements/p-250f55be.js +0 -1
  224. package/dist/lime-elements/p-29f054cc.entry.js +0 -37
  225. package/dist/lime-elements/p-31299106.js +0 -126
  226. package/dist/lime-elements/p-468e940e.entry.js +0 -16
  227. package/dist/lime-elements/p-4932c029.entry.js +0 -1
  228. package/dist/lime-elements/p-510bb5a4.entry.js +0 -1
  229. package/dist/lime-elements/p-668795a7.js +0 -73
  230. package/dist/lime-elements/p-6cfb45a1.entry.js +0 -1
  231. package/dist/lime-elements/p-7476efe0.entry.js +0 -1
  232. package/dist/lime-elements/p-902347b9.js +0 -81
  233. package/dist/lime-elements/p-90f3e17c.entry.js +0 -37
  234. package/dist/lime-elements/p-96e44a1e.entry.js +0 -82
  235. package/dist/lime-elements/p-b2a8cb31.entry.js +0 -59
  236. package/dist/lime-elements/p-bc0dcf01.entry.js +0 -73
  237. package/dist/lime-elements/p-c35874db.entry.js +0 -1
  238. package/dist/lime-elements/p-c8c8a946.entry.js +0 -59
  239. package/dist/lime-elements/p-ca664c9f.entry.js +0 -1
  240. package/dist/lime-elements/p-d2c74396.entry.js +0 -1
  241. package/dist/lime-elements/p-d48ad9f7.entry.js +0 -126
  242. package/dist/lime-elements/p-d93a3b07.entry.js +0 -16
  243. package/dist/lime-elements/p-f2c706b8.entry.js +0 -131
@@ -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,17 @@ 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
+ this.initTableSelection();
79
106
  }
80
107
  componentDidLoad() {
81
108
  this.init();
@@ -102,7 +129,7 @@ export class Table {
102
129
  if (!this.tabulator) {
103
130
  return;
104
131
  }
105
- this.tabulator.getRows().forEach(this.formatRow);
132
+ this.formatRows();
106
133
  }
107
134
  updateData(newData = [], oldData = []) {
108
135
  if (isEqual(newData, oldData)) {
@@ -114,6 +141,7 @@ export class Table {
114
141
  return;
115
142
  }
116
143
  this.tabulator.replaceData(this.data);
144
+ this.setSelection();
117
145
  });
118
146
  }
119
147
  updateColumns(newColumns, oldColumns) {
@@ -123,20 +151,53 @@ export class Table {
123
151
  if (this.areSameColumns(newColumns, oldColumns)) {
124
152
  return;
125
153
  }
126
- const existingColumns = this.tabulator
154
+ const columnsInTable = this.tabulator
127
155
  .getColumns()
128
- .map(this.findColumn);
129
- if (this.areSameColumns(newColumns, existingColumns)) {
156
+ .filter((c) => c.getField());
157
+ const oldColumnsInTable = columnsInTable.map((c) => oldColumns.find((old) => old.field === c.getField()));
158
+ if (this.areSameColumns(newColumns, oldColumnsInTable)) {
130
159
  return;
131
160
  }
132
161
  // Updating columns requires a reinitialization otherwise sorting will not work
133
162
  // afterwards
134
163
  this.init();
135
164
  }
165
+ updateAggregates(newAggregates, oldAggregates) {
166
+ if (!this.tabulator) {
167
+ return;
168
+ }
169
+ if (isEqual(newAggregates, oldAggregates)) {
170
+ return;
171
+ }
172
+ if (!this.haveSameAggregateFields(newAggregates, oldAggregates)) {
173
+ this.init();
174
+ return;
175
+ }
176
+ this.tabulator.recalc();
177
+ this.tabulator.rowManager.redraw();
178
+ }
179
+ updateSelection(newSelection) {
180
+ if (!this.tableSelection) {
181
+ return;
182
+ }
183
+ this.tableSelection.setSelection(newSelection);
184
+ }
185
+ updateSelectable() {
186
+ if (this.tableSelection && !this.selectable) {
187
+ this.tableSelection = null;
188
+ }
189
+ this.initTableSelection();
190
+ this.init();
191
+ }
136
192
  areSameColumns(newColumns, oldColumns) {
137
193
  return (newColumns.length === oldColumns.length &&
138
194
  newColumns.every((column) => oldColumns.includes(column)));
139
195
  }
196
+ haveSameAggregateFields(newAggregates, oldAggregates) {
197
+ const oldAggregateFields = (oldAggregates === null || oldAggregates === void 0 ? void 0 : oldAggregates.map((a) => a.field)) || [];
198
+ return ((newAggregates === null || newAggregates === void 0 ? void 0 : newAggregates.length) === (oldAggregates === null || oldAggregates === void 0 ? void 0 : oldAggregates.length) &&
199
+ !!(newAggregates === null || newAggregates === void 0 ? void 0 : newAggregates.every((a) => oldAggregateFields.includes(a.field))));
200
+ }
140
201
  init() {
141
202
  if (this.tabulator) {
142
203
  this.pool.releaseAll();
@@ -163,14 +224,28 @@ export class Table {
163
224
  // matter if its rendered or not.
164
225
  if (!('ResizeObserver' in window)) {
165
226
  this.tabulator = new TabulatorTable(table, options);
227
+ this.setSelection();
166
228
  return;
167
229
  }
168
230
  const observer = new ResizeObserver(() => {
169
231
  this.tabulator = new TabulatorTable(table, options);
232
+ this.setSelection();
170
233
  observer.unobserve(table);
171
234
  });
172
235
  observer.observe(table);
173
236
  }
237
+ initTableSelection() {
238
+ if (this.selectable) {
239
+ this.tableSelection = new TableSelection(() => this.tabulator, this.pool, this.select);
240
+ this.tableSelection.setSelection(this.selection);
241
+ }
242
+ }
243
+ setSelection() {
244
+ if (!(this.tabulator && this.tableSelection)) {
245
+ return;
246
+ }
247
+ this.tableSelection.setSelection(this.selection);
248
+ }
174
249
  updateMaxPage() {
175
250
  var _a;
176
251
  (_a = this.tabulator) === null || _a === void 0 ? void 0 : _a.setMaxPage(this.calculatePageCount());
@@ -192,7 +267,38 @@ export class Table {
192
267
  });
193
268
  }
194
269
  getColumnDefinitions() {
195
- return this.columns.map(this.columnFactory.create);
270
+ const columnDefinitions = this.columns
271
+ .map(this.addColumnAggregator)
272
+ .map(this.columnFactory.create);
273
+ if (this.tableSelection) {
274
+ return this.tableSelection.getColumnDefinitions(columnDefinitions);
275
+ }
276
+ return columnDefinitions;
277
+ }
278
+ addColumnAggregator(column) {
279
+ var _a;
280
+ if (!((_a = this.aggregates) === null || _a === void 0 ? void 0 : _a.length) || column.aggregator) {
281
+ return column;
282
+ }
283
+ const aggregate = this.aggregates.find((a) => a.field === column.field);
284
+ if (aggregate) {
285
+ column.aggregator = (col,
286
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
287
+ _values,
288
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
289
+ _data) => {
290
+ var _a;
291
+ if (!col) {
292
+ return undefined;
293
+ }
294
+ const value = (_a = this.aggregates.find((a) => a.field === col.field)) === null || _a === void 0 ? void 0 : _a.value;
295
+ if (col.formatter) {
296
+ return col.formatter(value);
297
+ }
298
+ return value;
299
+ };
300
+ }
301
+ return column;
196
302
  }
197
303
  getAjaxOptions() {
198
304
  if (!this.isRemoteMode()) {
@@ -291,7 +397,11 @@ export class Table {
291
397
  }
292
398
  this.changePage.emit(page);
293
399
  }
294
- onClickRow(_, row) {
400
+ onClickRow(_ev, row) {
401
+ if (typeof row.getPosition === 'undefined') {
402
+ // Not a data row, probably a CalcComponent
403
+ return;
404
+ }
295
405
  if (this.activeRow === row.getData()) {
296
406
  this.activeRow = null;
297
407
  }
@@ -300,6 +410,9 @@ export class Table {
300
410
  }
301
411
  this.activate.emit(this.activeRow);
302
412
  }
413
+ formatRows() {
414
+ this.tabulator.getRows().forEach(this.formatRow);
415
+ }
303
416
  formatRow(row) {
304
417
  if (this.activeRow === row.getData()) {
305
418
  row.getElement().classList.add('active');
@@ -319,15 +432,29 @@ export class Table {
319
432
  return columns.some((column) => has(column, 'aggregator'));
320
433
  }
321
434
  render() {
322
- return (h("div", { id: "tabulator-container" },
435
+ var _a;
436
+ return (h("div", { id: "tabulator-container", class: {
437
+ 'has-pagination': this.totalRows > this.pageSize,
438
+ 'has-aggregation': this.hasAggregation(this.columns),
439
+ 'has-movable-columns': this.movableColumns,
440
+ 'has-rowselector': this.selectable,
441
+ 'has-selection': (_a = this.tableSelection) === null || _a === void 0 ? void 0 : _a.hasSelection,
442
+ } },
323
443
  h("div", { id: "tabulator-loader", style: { display: this.loading ? 'flex' : 'none' } },
324
444
  h("limel-spinner", { size: "large" })),
325
445
  this.renderEmptyMessage(),
326
- h("div", { id: "tabulator-table", class: {
327
- 'has-pagination': this.totalRows > this.pageSize,
328
- 'has-aggregation': this.hasAggregation(this.columns),
329
- 'has-movable-columns': this.movableColumns,
330
- } })));
446
+ this.renderSelectAll(),
447
+ h("div", { id: "tabulator-table" })));
448
+ }
449
+ renderSelectAll() {
450
+ var _a, _b, _c;
451
+ if (!this.selectable) {
452
+ return;
453
+ }
454
+ const showSelectAll = !this.loading && this.tableSelection;
455
+ return (h("div", { class: "select-all", style: { display: showSelectAll ? 'inline-block' : 'none' } },
456
+ h("limel-checkbox", { onChange: this.selectAllOnChange, disabled: !this.totalRows, checked: (_a = this.tableSelection) === null || _a === void 0 ? void 0 : _a.hasSelection, indeterminate: ((_b = this.tableSelection) === null || _b === void 0 ? void 0 : _b.hasSelection) &&
457
+ ((_c = this.selection) === null || _c === void 0 ? void 0 : _c.length) < this.data.length })));
331
458
  }
332
459
  renderEmptyMessage() {
333
460
  const showEmptyMessage = !this.loading && !this.data.length && this.emptyMessage;
@@ -537,6 +664,58 @@ export class Table {
537
664
  },
538
665
  "attribute": "empty-message",
539
666
  "reflect": false
667
+ },
668
+ "aggregates": {
669
+ "type": "unknown",
670
+ "mutable": false,
671
+ "complexType": {
672
+ "original": "ColumnAggregate[]",
673
+ "resolved": "ColumnAggregate[]",
674
+ "references": {
675
+ "ColumnAggregate": {
676
+ "location": "import",
677
+ "path": "./table.types"
678
+ }
679
+ }
680
+ },
681
+ "required": false,
682
+ "optional": false,
683
+ "docs": {
684
+ "tags": [],
685
+ "text": "Column aggregates to be displayed in the table"
686
+ }
687
+ },
688
+ "selectable": {
689
+ "type": "boolean",
690
+ "mutable": false,
691
+ "complexType": {
692
+ "original": "boolean",
693
+ "resolved": "boolean",
694
+ "references": {}
695
+ },
696
+ "required": false,
697
+ "optional": false,
698
+ "docs": {
699
+ "tags": [],
700
+ "text": "Enables row selection"
701
+ },
702
+ "attribute": "selectable",
703
+ "reflect": false
704
+ },
705
+ "selection": {
706
+ "type": "unknown",
707
+ "mutable": false,
708
+ "complexType": {
709
+ "original": "object[]",
710
+ "resolved": "object[]",
711
+ "references": {}
712
+ },
713
+ "required": false,
714
+ "optional": false,
715
+ "docs": {
716
+ "tags": [],
717
+ "text": "Selected data. Requires `selectable` to be true."
718
+ }
540
719
  }
541
720
  }; }
542
721
  static get events() { return [{
@@ -629,6 +808,36 @@ export class Table {
629
808
  }
630
809
  }
631
810
  }
811
+ }, {
812
+ "method": "select",
813
+ "name": "select",
814
+ "bubbles": true,
815
+ "cancelable": true,
816
+ "composed": true,
817
+ "docs": {
818
+ "tags": [],
819
+ "text": "Emitted when the row selection has been changed"
820
+ },
821
+ "complexType": {
822
+ "original": "object[]",
823
+ "resolved": "object[]",
824
+ "references": {}
825
+ }
826
+ }, {
827
+ "method": "selectAll",
828
+ "name": "selectAll",
829
+ "bubbles": true,
830
+ "cancelable": true,
831
+ "composed": true,
832
+ "docs": {
833
+ "tags": [],
834
+ "text": "Emitted when the select all rows state is toggled"
835
+ },
836
+ "complexType": {
837
+ "original": "boolean",
838
+ "resolved": "boolean",
839
+ "references": {}
840
+ }
632
841
  }]; }
633
842
  static get elementRef() { return "host"; }
634
843
  static get watchers() { return [{
@@ -649,5 +858,14 @@ export class Table {
649
858
  }, {
650
859
  "propName": "columns",
651
860
  "methodName": "updateColumns"
861
+ }, {
862
+ "propName": "aggregates",
863
+ "methodName": "updateAggregates"
864
+ }, {
865
+ "propName": "selection",
866
+ "methodName": "updateSelection"
867
+ }, {
868
+ "propName": "selectable",
869
+ "methodName": "updateSelectable"
652
870
  }]; }
653
871
  }
@@ -5,6 +5,8 @@
5
5
  * without being explicitly called by outside code.
6
6
  */
7
7
 
8
+ @use 'sass:math';
9
+
8
10
  @function pxToRem($px) {
9
- @return #{$px/16}rem;
11
+ @return #{math.div($px, 16)}rem;
10
12
  }
@@ -10,37 +10,36 @@
10
10
  @use '../brand-colors';
11
11
  @use '../_theme-color-variables';
12
12
 
13
- @use '@material/theme' with
14
- (
15
- $primary: brand-colors.$lime-turquoise,
16
- $secondary: brand-colors.$lime-dark-grey,
17
- $background: #fff,
18
- $surface: #fff,
19
- $error: #b00020,
20
- $on-primary: #fff,
21
- $on-secondary: #fff,
22
- $on-surface: #000,
23
- $on-error: #fff,
24
- // $text-disabled-on-background: rgba(0, 0, 0, 0.38),
25
- // $text-hint-on-light: rgba(0, 0, 0, 0.38),
26
- // $text-primary-on-background: rgba(0, 0, 0, 0.87),
27
- // $text-secondary-on-background: rgba(0, 0, 0, 0.54),
28
- //
29
- // The following variables are also available to be set if needed
30
- // (note by Ads: they probably aren't available in MDC v11)
31
- //
32
- // $text-hint-on-background: rgba(0, 0, 0, 0.38),
33
- // $text-icon-on-background: rgba(0, 0, 0, 0.38),
34
- // $text-primary-on-light: rgba(0, 0, 0, 0.87),
35
- // $text-secondary-on-light: rgba(0, 0, 0, 0.54),
36
- // $text-disabled-on-light: rgba(0, 0, 0, 0.38),
37
- // $text-icon-on-light: rgba(0, 0, 0, 0.38),
38
- // $text-primary-on-dark: white,
39
- // $text-secondary-on-dark: rgba(255, 255, 255, 0.7),
40
- // $text-hint-on-dark: rgba(255, 255, 255, 0.5),
41
- // $text-disabled-on-dark: rgba(255, 255, 255, 0.5),
42
- // $text-icon-on-dark: rgba(255, 255, 255, 0.5),
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';
@@ -9,60 +9,59 @@
9
9
 
10
10
  @use '../functions';
11
11
 
12
- @use '@material/typography' with
13
- (
14
- $styles-headline1: (
15
- font-size: functions.pxToRem(22),
16
- line-height: functions.pxToRem(22),
17
- ),
18
- $styles-headline2: (
19
- font-size: functions.pxToRem(16),
20
- line-height: functions.pxToRem(14),
21
- ),
22
- $styles-headline3: (
23
- font-size: functions.pxToRem(16),
24
- line-height: functions.pxToRem(14),
25
- ),
26
- $styles-headline4: (
27
- font-size: functions.pxToRem(16),
28
- line-height: functions.pxToRem(14),
29
- ),
30
- $styles-headline5: (
31
- font-size: functions.pxToRem(14),
32
- line-height: functions.pxToRem(14),
33
- ),
34
- $styles-headline6: (
35
- font-size: functions.pxToRem(14),
36
- line-height: functions.pxToRem(14),
37
- ),
38
- $styles-subtitle1: (
39
- font-size: functions.pxToRem(14),
40
- line-height: functions.pxToRem(18),
41
- ),
42
- $styles-subtitle2: (
43
- font-size: functions.pxToRem(13),
44
- line-height: functions.pxToRem(18),
45
- ),
46
- $styles-body1: (
47
- font-size: functions.pxToRem(13),
48
- line-height: functions.pxToRem(24),
49
- ),
50
- $styles-body2: (
51
- font-size: functions.pxToRem(13),
52
- line-height: functions.pxToRem(26),
53
- ),
54
- $styles-caption: (
55
- font-size: functions.pxToRem(11),
56
- line-height: functions.pxToRem(14),
57
- ),
58
- $styles-button: (
59
- font-size: functions.pxToRem(14),
60
- line-height: functions.pxToRem(36),
61
- text-transform: none,
62
- ),
63
- $styles-overline: (
64
- font-size: functions.pxToRem(11),
65
- line-height: functions.pxToRem(14),
66
- )
67
- );
12
+ @use '@material/typography' with (
13
+ $styles-headline1: (
14
+ font-size: functions.pxToRem(22),
15
+ line-height: functions.pxToRem(22),
16
+ ),
17
+ $styles-headline2: (
18
+ font-size: functions.pxToRem(16),
19
+ line-height: functions.pxToRem(14),
20
+ ),
21
+ $styles-headline3: (
22
+ font-size: functions.pxToRem(16),
23
+ line-height: functions.pxToRem(14),
24
+ ),
25
+ $styles-headline4: (
26
+ font-size: functions.pxToRem(16),
27
+ line-height: functions.pxToRem(14),
28
+ ),
29
+ $styles-headline5: (
30
+ font-size: functions.pxToRem(14),
31
+ line-height: functions.pxToRem(14),
32
+ ),
33
+ $styles-headline6: (
34
+ font-size: functions.pxToRem(14),
35
+ line-height: functions.pxToRem(14),
36
+ ),
37
+ $styles-subtitle1: (
38
+ font-size: functions.pxToRem(14),
39
+ line-height: functions.pxToRem(18),
40
+ ),
41
+ $styles-subtitle2: (
42
+ font-size: functions.pxToRem(13),
43
+ line-height: functions.pxToRem(18),
44
+ ),
45
+ $styles-body1: (
46
+ font-size: functions.pxToRem(13),
47
+ line-height: functions.pxToRem(24),
48
+ ),
49
+ $styles-body2: (
50
+ font-size: functions.pxToRem(13),
51
+ line-height: functions.pxToRem(26),
52
+ ),
53
+ $styles-caption: (
54
+ font-size: functions.pxToRem(11),
55
+ line-height: functions.pxToRem(14),
56
+ ),
57
+ $styles-button: (
58
+ font-size: functions.pxToRem(14),
59
+ line-height: functions.pxToRem(36),
60
+ text-transform: none,
61
+ ),
62
+ $styles-overline: (
63
+ font-size: functions.pxToRem(11),
64
+ line-height: functions.pxToRem(14),
65
+ )
66
+ );
68
67
  @forward '@material/typography';
@@ -9,7 +9,8 @@ $input-field--mdc-text-field__input--readonly: 1 !default;
9
9
  $list--has-interactive-items--mdc-list-item--hover: 1 !default;
10
10
  $list-static-actions-list: 1 !default;
11
11
  $tab-bar--active-tab: 2 !default;
12
- $table--has-interactive-rows--selectable-row--hover: 1 !default;
12
+ $table--has-interactive-rows--selectable-row--hover: 2 !default;
13
+ $table--limel-table--row-selector: 1 !default;
13
14
  $popover-before: -1 !default;
14
15
  $button-group-radio-button-keyboard-focused: 1 !default;
15
16
  $list-mdc-list-item: 0 !default;
@@ -0,0 +1,41 @@
1
+ import { h } from './index-4456d4ad.js';
2
+
3
+ const CheckboxTemplate = (props) => {
4
+ const inputProps = {};
5
+ if (props.indeterminate) {
6
+ inputProps['data-indeterminate'] = 'true';
7
+ }
8
+ return [
9
+ h("div", { class: "mdc-form-field " },
10
+ h("div", { class: {
11
+ 'mdc-checkbox': true,
12
+ 'mdc-checkbox--invalid': props.invalid,
13
+ 'mdc-checkbox--disabled': props.disabled,
14
+ 'mdc-checkbox--required': props.required,
15
+ 'mdc-checkbox--indeterminate': props.indeterminate,
16
+ 'lime-checkbox--readonly': props.readonly,
17
+ } },
18
+ h("input", Object.assign({ type: "checkbox", class: "mdc-checkbox__native-control", id: props.id, checked: props.checked, disabled: props.disabled || props.readonly, required: props.required, onChange: props.onChange }, inputProps)),
19
+ h("div", { class: "mdc-checkbox__background" },
20
+ h("svg", { class: "mdc-checkbox__checkmark", viewBox: "0 0 24 24" },
21
+ h("path", { class: "mdc-checkbox__checkmark-path", fill: "none", d: "M1.73,12.91 8.1,19.28 22.79,4.59" })),
22
+ h("div", { class: "mdc-checkbox__mixedmark" }))),
23
+ h("label", { class: {
24
+ 'mdc-checkbox--invalid': props.invalid,
25
+ 'mdc-checkbox--disabled': props.disabled,
26
+ 'mdc-checkbox--required': props.required,
27
+ 'mdc-checkbox--indeterminate': props.indeterminate,
28
+ 'lime-checkbox--readonly': props.readonly,
29
+ }, htmlFor: props.id }, props.label)),
30
+ h(HelperText, { text: props.helperText }),
31
+ ];
32
+ };
33
+ const HelperText = (props) => {
34
+ if (typeof props.text !== 'string') {
35
+ return;
36
+ }
37
+ return (h("div", { class: "limel-checkbox-helper-line" },
38
+ h("p", { class: "limel-checkbox-helper-text", "aria-hidden": "true" }, props.text.trim())));
39
+ };
40
+
41
+ export { CheckboxTemplate as C };
@@ -1,4 +1,4 @@
1
- import { M as MDCFoundation, a as MDCComponent } from './component-d682c974.js';
1
+ import { M as MDCFoundation, a as MDCComponent } from './component-410aad5a.js';
2
2
  import { e as estimateScrollWidth } from './ponyfill-30263d5e.js';
3
3
 
4
4
  /*! *****************************************************************************
@@ -98,7 +98,9 @@ var MDCFloatingLabelFoundation = /** @class */ (function (_super) {
98
98
  __extends(MDCFloatingLabelFoundation, _super);
99
99
  function MDCFloatingLabelFoundation(adapter) {
100
100
  var _this = _super.call(this, __assign(__assign({}, MDCFloatingLabelFoundation.defaultAdapter), adapter)) || this;
101
- _this.shakeAnimationEndHandler_ = function () { return _this.handleShakeAnimationEnd_(); };
101
+ _this.shakeAnimationEndHandler = function () {
102
+ _this.handleShakeAnimationEnd();
103
+ };
102
104
  return _this;
103
105
  }
104
106
  Object.defineProperty(MDCFloatingLabelFoundation, "cssClasses", {
@@ -127,10 +129,10 @@ var MDCFloatingLabelFoundation = /** @class */ (function (_super) {
127
129
  configurable: true
128
130
  });
129
131
  MDCFloatingLabelFoundation.prototype.init = function () {
130
- this.adapter.registerInteractionHandler('animationend', this.shakeAnimationEndHandler_);
132
+ this.adapter.registerInteractionHandler('animationend', this.shakeAnimationEndHandler);
131
133
  };
132
134
  MDCFloatingLabelFoundation.prototype.destroy = function () {
133
- this.adapter.deregisterInteractionHandler('animationend', this.shakeAnimationEndHandler_);
135
+ this.adapter.deregisterInteractionHandler('animationend', this.shakeAnimationEndHandler);
134
136
  };
135
137
  /**
136
138
  * Returns the width of the label element.
@@ -178,7 +180,7 @@ var MDCFloatingLabelFoundation = /** @class */ (function (_super) {
178
180
  this.adapter.removeClass(LABEL_REQUIRED);
179
181
  }
180
182
  };
181
- MDCFloatingLabelFoundation.prototype.handleShakeAnimationEnd_ = function () {
183
+ MDCFloatingLabelFoundation.prototype.handleShakeAnimationEnd = function () {
182
184
  var LABEL_SHAKE = MDCFloatingLabelFoundation.cssClasses.LABEL_SHAKE;
183
185
  this.adapter.removeClass(LABEL_SHAKE);
184
186
  };