@scania/tegel 0.0.1-beta.3 → 0.0.1-beta.5

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 (275) hide show
  1. package/dist/cjs/index-e1c79686.js +1912 -0
  2. package/dist/cjs/index.cjs.js +2 -0
  3. package/dist/cjs/loader.cjs.js +21 -0
  4. package/dist/cjs/popper-11d5f714.js +1801 -0
  5. package/dist/cjs/sdds-accordion-item.cjs.entry.js +34 -0
  6. package/dist/cjs/sdds-accordion.cjs.entry.js +21 -0
  7. package/dist/cjs/sdds-badges.cjs.entry.js +55 -0
  8. package/dist/cjs/sdds-body-cell_2.cjs.entry.js +173 -0
  9. package/dist/cjs/sdds-button.cjs.entry.js +36 -0
  10. package/dist/cjs/sdds-datetime.cjs.entry.js +66 -0
  11. package/dist/cjs/sdds-dropdown-filter.cjs.entry.js +92 -0
  12. package/dist/cjs/sdds-dropdown_2.cjs.entry.js +335 -0
  13. package/dist/cjs/sdds-header-cell.cjs.entry.js +141 -0
  14. package/dist/cjs/sdds-icon.cjs.entry.js +42 -0
  15. package/dist/cjs/sdds-inline-tabs-fullbleed.cjs.entry.js +96 -0
  16. package/dist/cjs/sdds-inline-tabs.cjs.entry.js +211 -0
  17. package/dist/cjs/sdds-modal.cjs.entry.js +49 -0
  18. package/dist/cjs/sdds-navigation-tabs.cjs.entry.js +95 -0
  19. package/dist/cjs/sdds-popover-canvas.cjs.entry.js +76 -0
  20. package/dist/cjs/sdds-popover-menu.cjs.entry.js +75 -0
  21. package/dist/cjs/sdds-slider.cjs.entry.js +336 -0
  22. package/dist/cjs/sdds-spinner.cjs.entry.js +21 -0
  23. package/dist/cjs/sdds-table-body-row-expandable.cjs.entry.js +81 -0
  24. package/dist/cjs/sdds-table-body.cjs.entry.js +289 -0
  25. package/dist/cjs/sdds-table-footer.cjs.entry.js +165 -0
  26. package/dist/cjs/sdds-table-header.cjs.entry.js +100 -0
  27. package/dist/cjs/sdds-table-toolbar.cjs.entry.js +66 -0
  28. package/dist/cjs/sdds-table.cjs.entry.js +69 -0
  29. package/dist/cjs/sdds-textarea.cjs.entry.js +61 -0
  30. package/dist/cjs/sdds-textfield.cjs.entry.js +82 -0
  31. package/dist/cjs/sdds-tooltip.cjs.entry.js +95 -0
  32. package/dist/cjs/tegel.cjs.js +19 -0
  33. package/dist/collection/collection-manifest.json +40 -0
  34. package/dist/collection/components/accordion/accordion-item/accordion-item.css +134 -0
  35. package/dist/collection/components/accordion/accordion-item/accordion-item.js +146 -0
  36. package/dist/collection/components/accordion/accordion.css +77 -0
  37. package/dist/collection/components/accordion/accordion.js +62 -0
  38. package/dist/collection/components/accordion/accordion.stories.js +91 -0
  39. package/dist/collection/components/badge/badge.stories.js +101 -0
  40. package/dist/collection/components/badge/badges.css +42 -0
  41. package/dist/collection/components/badge/badges.js +150 -0
  42. package/dist/collection/components/banner/banner.stories.js +93 -0
  43. package/dist/collection/components/block/block.stories.js +46 -0
  44. package/dist/collection/components/breadcrumb/breadcrumb.stories.js +26 -0
  45. package/dist/collection/components/button/button-component.js +154 -0
  46. package/dist/collection/components/button/button-native.stories.js +183 -0
  47. package/dist/collection/components/button/button-webcomponent.stories.js +182 -0
  48. package/dist/collection/components/button/button.css +658 -0
  49. package/dist/collection/components/card/card.stories.js +181 -0
  50. package/dist/collection/components/checkbox/checkbox.stories.js +54 -0
  51. package/dist/collection/components/chips/chips.stories.js +124 -0
  52. package/dist/collection/components/data-table/native-table.stories.js +182 -0
  53. package/dist/collection/components/data-table/table/table.css +15 -0
  54. package/dist/collection/components/data-table/table/table.js +253 -0
  55. package/dist/collection/components/data-table/table-body/table-body.css +22 -0
  56. package/dist/collection/components/data-table/table-body/table-body.js +425 -0
  57. package/dist/collection/components/data-table/table-body-cell/table-body-cell.css +40 -0
  58. package/dist/collection/components/data-table/table-body-cell/table-body-cell.js +169 -0
  59. package/dist/collection/components/data-table/table-body-row/table-body-row.css +196 -0
  60. package/dist/collection/components/data-table/table-body-row/table-body-row.js +164 -0
  61. package/dist/collection/components/data-table/table-body-row-expandable/table-body-row-expandable.css +79 -0
  62. package/dist/collection/components/data-table/table-body-row-expandable/table-body-row-expandable.js +155 -0
  63. package/dist/collection/components/data-table/table-component-basic.stories.js +163 -0
  64. package/dist/collection/components/data-table/table-component-batch-actions.stories.js +129 -0
  65. package/dist/collection/components/data-table/table-component-bodydata.stories.js +58 -0
  66. package/dist/collection/components/data-table/table-component-custom-width.stories.js +198 -0
  67. package/dist/collection/components/data-table/table-component-event-listeners.stories.js +153 -0
  68. package/dist/collection/components/data-table/table-component-expandable-rows.stories.js +137 -0
  69. package/dist/collection/components/data-table/table-component-filtering.stories.js +139 -0
  70. package/dist/collection/components/data-table/table-component-multiselect.stories.js +160 -0
  71. package/dist/collection/components/data-table/table-component-pagination.stories.js +129 -0
  72. package/dist/collection/components/data-table/table-component-sorting.stories.js +107 -0
  73. package/dist/collection/components/data-table/table-footer/table-footer.css +93 -0
  74. package/dist/collection/components/data-table/table-footer/table-footer.js +355 -0
  75. package/dist/collection/components/data-table/table-header/table-header.css +204 -0
  76. package/dist/collection/components/data-table/table-header/table-header.js +153 -0
  77. package/dist/collection/components/data-table/table-header-cell/table-header-cell.css +126 -0
  78. package/dist/collection/components/data-table/table-header-cell/table-header-cell.js +320 -0
  79. package/dist/collection/components/data-table/table-toolbar/table-toolbar.css +92 -0
  80. package/dist/collection/components/data-table/table-toolbar/table-toolbar.js +142 -0
  81. package/dist/collection/components/datetime/datetime.css +375 -0
  82. package/dist/collection/components/datetime/datetime.js +251 -0
  83. package/dist/collection/components/datetime/datetime.stories.js +149 -0
  84. package/dist/collection/components/divider/divider.stories.js +116 -0
  85. package/dist/collection/components/dropdown/dropdown-filter/dropdown-filter.js +339 -0
  86. package/dist/collection/components/dropdown/dropdown-filter/dropdown-filter.stories.js +130 -0
  87. package/dist/collection/components/dropdown/dropdown-native.stories.js +90 -0
  88. package/dist/collection/components/dropdown/dropdown-option/dropdown-option.js +185 -0
  89. package/dist/collection/components/dropdown/dropdown-wc-default.stories.js +151 -0
  90. package/dist/collection/components/dropdown/dropdown-wc-multiselect.stories.js +146 -0
  91. package/dist/collection/components/dropdown/dropdown.css +891 -0
  92. package/dist/collection/components/dropdown/dropdown.js +554 -0
  93. package/dist/collection/components/footer/footer.stories.js +100 -0
  94. package/dist/collection/components/header/header-all.stories.js +217 -0
  95. package/dist/collection/components/header/header-default.stories.js +47 -0
  96. package/dist/collection/components/header/header-inline.stories.js +113 -0
  97. package/dist/collection/components/header/header-search.stories.js +263 -0
  98. package/dist/collection/components/header/header-toolbar.stories.js +204 -0
  99. package/dist/collection/components/icon/icon-font.stories.js +57 -0
  100. package/dist/collection/components/icon/icon-web-component.stories.js +51 -0
  101. package/dist/collection/components/icon/icon.css +16 -0
  102. package/dist/collection/components/icon/icon.js +89 -0
  103. package/dist/collection/components/icon/iconsArray.js +2 -0
  104. package/dist/collection/components/link/link.stories.js +45 -0
  105. package/dist/collection/components/message/message.stories.js +117 -0
  106. package/dist/collection/components/modal/modal-native.stories.js +121 -0
  107. package/dist/collection/components/modal/modal-webcomponent.stories.js +78 -0
  108. package/dist/collection/components/modal/modal.css +324 -0
  109. package/dist/collection/components/modal/modal.js +146 -0
  110. package/dist/collection/components/popover-canvas/popover-canvas.css +20 -0
  111. package/dist/collection/components/popover-canvas/popover-canvas.js +190 -0
  112. package/dist/collection/components/popover-canvas/popover-canvas.stories.js +87 -0
  113. package/dist/collection/components/popover-menu/popover-menu-icons.stories.js +132 -0
  114. package/dist/collection/components/popover-menu/popover-menu.css +19 -0
  115. package/dist/collection/components/popover-menu/popover-menu.js +189 -0
  116. package/dist/collection/components/popover-menu/popover-menu.stories.js +109 -0
  117. package/dist/collection/components/radio-button/radio-button.stories.js +68 -0
  118. package/dist/collection/components/side-menu/side-menu.stories.js +182 -0
  119. package/dist/collection/components/slider/slider.css +260 -0
  120. package/dist/collection/components/slider/slider.js +682 -0
  121. package/dist/collection/components/slider/slider.stories.js +251 -0
  122. package/dist/collection/components/spinner/spinner.css +79 -0
  123. package/dist/collection/components/spinner/spinner.js +61 -0
  124. package/dist/collection/components/spinner/spinner.stories.js +59 -0
  125. package/dist/collection/components/stepper/stepper.stories.js +139 -0
  126. package/dist/collection/components/tabs/inline-tabs-default/inline-tabs.css +159 -0
  127. package/dist/collection/components/tabs/inline-tabs-default/inline-tabs.js +302 -0
  128. package/dist/collection/components/tabs/inline-tabs-default/inline-tabs.stories.js +65 -0
  129. package/dist/collection/components/tabs/inline-tabs-fullbleed/inline-tabs-fullbleed.css +172 -0
  130. package/dist/collection/components/tabs/inline-tabs-fullbleed/inline-tabs-fullbleed.js +126 -0
  131. package/dist/collection/components/tabs/inline-tabs-fullbleed/inline-tabs-fullbleed.stories.js +43 -0
  132. package/dist/collection/components/tabs/navigation-tabs/navigation-tabs.css +153 -0
  133. package/dist/collection/components/tabs/navigation-tabs/navigation-tabs.js +103 -0
  134. package/dist/collection/components/tabs/navigation-tabs/navigation-tabs.stories.js +32 -0
  135. package/dist/collection/components/textarea/textarea.css +283 -0
  136. package/dist/collection/components/textarea/textarea.js +336 -0
  137. package/dist/collection/components/textarea/textarea.stories.js +149 -0
  138. package/dist/collection/components/textfield/textfield.css +494 -0
  139. package/dist/collection/components/textfield/textfield.js +359 -0
  140. package/dist/collection/components/textfield/textfield.stories.js +222 -0
  141. package/dist/collection/components/toast/toast.stories.js +119 -0
  142. package/dist/collection/components/toggle/toggle.stories.js +62 -0
  143. package/dist/collection/components/tooltip/tooltip.css +46 -0
  144. package/dist/collection/components/tooltip/tooltip.js +200 -0
  145. package/dist/collection/components/tooltip/tooltip.stories.js +113 -0
  146. package/dist/collection/components/utility/colour/background-color.stories.js +96 -0
  147. package/dist/collection/components/utility/colour/text-color.stories.js +94 -0
  148. package/dist/collection/foundations-stories/colour/colour-brand.stories.js +38 -0
  149. package/dist/collection/foundations-stories/colour/colour-scales.stories.js +71 -0
  150. package/dist/collection/foundations-stories/colour/colour-semantic.stories.js +40 -0
  151. package/dist/collection/foundations-stories/grid/grid.stories.js +386 -0
  152. package/dist/collection/foundations-stories/spacing/spacing-element.stories.js +100 -0
  153. package/dist/collection/foundations-stories/spacing/spacing-layout.stories.js +94 -0
  154. package/dist/collection/foundations-stories/typography/typography-body.stories.js +16 -0
  155. package/dist/collection/foundations-stories/typography/typography-detail.stories.js +17 -0
  156. package/dist/collection/foundations-stories/typography/typography-headline.stories.js +39 -0
  157. package/dist/collection/foundations-stories/typography/typography-paragraph.stories.js +12 -0
  158. package/dist/collection/index.js +1 -0
  159. package/dist/collection/stories/assets/code-brackets.svg +1 -0
  160. package/dist/collection/stories/assets/colors.svg +1 -0
  161. package/dist/collection/stories/assets/comments.svg +1 -0
  162. package/dist/collection/stories/assets/direction.svg +1 -0
  163. package/dist/collection/stories/assets/flow.svg +1 -0
  164. package/dist/collection/stories/assets/plugin.svg +1 -0
  165. package/dist/collection/stories/assets/repo.svg +1 -0
  166. package/dist/collection/stories/assets/stackalt.svg +1 -0
  167. package/dist/collection/utils/utils.js +12 -0
  168. package/dist/components/dropdown-option.js +0 -1
  169. package/dist/components/dropdown.js +0 -1
  170. package/dist/components/icon.js +0 -1
  171. package/dist/components/sdds-accordion-item.js +0 -1
  172. package/dist/components/sdds-accordion.js +0 -1
  173. package/dist/components/sdds-badges.js +0 -1
  174. package/dist/components/sdds-button.js +0 -1
  175. package/dist/components/sdds-datetime.js +0 -1
  176. package/dist/components/sdds-dropdown-filter.js +0 -1
  177. package/dist/components/sdds-header-cell.js +0 -1
  178. package/dist/components/sdds-inline-tabs-fullbleed.js +0 -1
  179. package/dist/components/sdds-inline-tabs.js +0 -1
  180. package/dist/components/sdds-modal.js +0 -1
  181. package/dist/components/sdds-navigation-tabs.js +0 -1
  182. package/dist/components/sdds-popover-canvas.js +0 -1
  183. package/dist/components/sdds-popover-menu.js +0 -1
  184. package/dist/components/sdds-slider.js +0 -1
  185. package/dist/components/sdds-spinner.js +0 -1
  186. package/dist/components/sdds-table-body-row-expandable.js +0 -1
  187. package/dist/components/sdds-table-body.js +0 -1
  188. package/dist/components/sdds-table-footer.js +0 -1
  189. package/dist/components/sdds-table-header.js +0 -1
  190. package/dist/components/sdds-table-toolbar.js +0 -1
  191. package/dist/components/sdds-table.js +0 -1
  192. package/dist/components/sdds-textarea.js +0 -1
  193. package/dist/components/sdds-textfield.js +0 -1
  194. package/dist/components/sdds-tooltip.js +0 -1
  195. package/dist/components/table-body-cell.js +0 -1
  196. package/dist/components/table-body-row.js +0 -1
  197. package/dist/esm/index-b67b15a6.js +1884 -0
  198. package/dist/esm/index.js +1 -0
  199. package/dist/esm/loader.js +17 -0
  200. package/dist/esm/polyfills/core-js.js +11 -0
  201. package/dist/esm/polyfills/css-shim.js +1 -0
  202. package/dist/esm/polyfills/dom.js +79 -0
  203. package/dist/esm/polyfills/es5-html-element.js +1 -0
  204. package/dist/esm/polyfills/index.js +34 -0
  205. package/dist/esm/polyfills/system.js +6 -0
  206. package/dist/esm/popper-f860750c.js +1799 -0
  207. package/dist/esm/sdds-accordion-item.entry.js +30 -0
  208. package/dist/esm/sdds-accordion.entry.js +17 -0
  209. package/dist/esm/sdds-badges.entry.js +51 -0
  210. package/dist/esm/sdds-body-cell_2.entry.js +168 -0
  211. package/dist/esm/sdds-button.entry.js +32 -0
  212. package/dist/esm/sdds-datetime.entry.js +62 -0
  213. package/dist/esm/sdds-dropdown-filter.entry.js +88 -0
  214. package/dist/esm/sdds-dropdown_2.entry.js +330 -0
  215. package/dist/esm/sdds-header-cell.entry.js +137 -0
  216. package/dist/esm/sdds-icon.entry.js +38 -0
  217. package/dist/esm/sdds-inline-tabs-fullbleed.entry.js +92 -0
  218. package/dist/esm/sdds-inline-tabs.entry.js +207 -0
  219. package/dist/esm/sdds-modal.entry.js +45 -0
  220. package/dist/esm/sdds-navigation-tabs.entry.js +91 -0
  221. package/dist/esm/sdds-popover-canvas.entry.js +72 -0
  222. package/dist/esm/sdds-popover-menu.entry.js +71 -0
  223. package/dist/esm/sdds-slider.entry.js +332 -0
  224. package/dist/esm/sdds-spinner.entry.js +17 -0
  225. package/dist/esm/sdds-table-body-row-expandable.entry.js +77 -0
  226. package/dist/esm/sdds-table-body.entry.js +285 -0
  227. package/dist/esm/sdds-table-footer.entry.js +161 -0
  228. package/dist/esm/sdds-table-header.entry.js +96 -0
  229. package/dist/esm/sdds-table-toolbar.entry.js +62 -0
  230. package/dist/esm/sdds-table.entry.js +65 -0
  231. package/dist/esm/sdds-textarea.entry.js +57 -0
  232. package/dist/esm/sdds-textfield.entry.js +78 -0
  233. package/dist/esm/sdds-tooltip.entry.js +91 -0
  234. package/dist/esm/tegel.js +17 -0
  235. package/dist/index.cjs.js +1 -0
  236. package/dist/index.js +1 -0
  237. package/dist/tegel/index.esm.js +0 -0
  238. package/dist/tegel/p-040efb32.entry.js +1 -0
  239. package/dist/tegel/p-12ca5cfa.entry.js +1 -0
  240. package/dist/tegel/p-157e1618.js +2 -0
  241. package/dist/tegel/p-1fe61cf6.entry.js +1 -0
  242. package/dist/tegel/p-2f376504.entry.js +1 -0
  243. package/dist/tegel/p-44ced895.entry.js +1 -0
  244. package/dist/tegel/p-4880f03d.entry.js +1 -0
  245. package/dist/tegel/p-4aba73a3.entry.js +1 -0
  246. package/dist/tegel/p-4b58a02c.entry.js +1 -0
  247. package/dist/tegel/p-4cb85347.entry.js +1 -0
  248. package/dist/tegel/p-52031b5a.entry.js +1 -0
  249. package/dist/tegel/p-677baf7f.entry.js +1 -0
  250. package/dist/tegel/p-71797eaf.entry.js +1 -0
  251. package/dist/tegel/p-7373284c.entry.js +1 -0
  252. package/dist/tegel/p-7451779b.entry.js +1 -0
  253. package/dist/tegel/p-77aeea3b.entry.js +1 -0
  254. package/dist/tegel/p-8582d6a7.entry.js +1 -0
  255. package/dist/tegel/p-96021bd0.entry.js +1 -0
  256. package/dist/tegel/p-9d8caf51.entry.js +1 -0
  257. package/dist/tegel/p-a5919930.entry.js +1 -0
  258. package/dist/tegel/p-b01cface.entry.js +1 -0
  259. package/dist/tegel/p-bf896643.entry.js +1 -0
  260. package/dist/tegel/p-c311725c.entry.js +1 -0
  261. package/dist/tegel/p-cf72dfd9.entry.js +1 -0
  262. package/dist/tegel/p-d91caec6.entry.js +1 -0
  263. package/dist/tegel/p-e10eec33.entry.js +1 -0
  264. package/dist/tegel/p-ec26fc38.js +1 -0
  265. package/dist/tegel/p-f2262a69.entry.js +1 -0
  266. package/dist/tegel/p-f2f7aa45.entry.js +1 -0
  267. package/dist/tegel/tegel.css +101 -0
  268. package/dist/tegel/tegel.esm.js +1 -0
  269. package/loader/cdn.js +3 -0
  270. package/loader/index.cjs.js +3 -0
  271. package/loader/index.d.ts +12 -0
  272. package/loader/index.es2017.js +3 -0
  273. package/loader/index.js +4 -0
  274. package/loader/package.json +11 -0
  275. package/package.json +4 -4
@@ -0,0 +1,253 @@
1
+ // https://stackoverflow.com/questions/63051941/how-to-pass-data-as-array-of-object-in-stencil-js
2
+ // https://medium.com/@scottmgerstl/passing-an-object-or-array-to-stencil-dd62b7d92641
3
+ import { h, Host } from '@stencil/core';
4
+ export class Table {
5
+ constructor() {
6
+ this.verticalDividers = false;
7
+ this.compactDesign = false;
8
+ this.noMinWidth = undefined;
9
+ this.whiteBackground = false;
10
+ this.enableMultiselect = false;
11
+ this.enableExpandableRows = false;
12
+ this.enableResponsive = false;
13
+ this.tableId = crypto.randomUUID();
14
+ }
15
+ emitTablePropsChangedEvent(changedValueName, changedValue) {
16
+ this.tablePropsChangedEvent.emit({
17
+ tableId: this.tableId,
18
+ changed: [changedValueName],
19
+ [changedValueName]: changedValue,
20
+ });
21
+ }
22
+ enableMultiselectChanged(newValue) {
23
+ this.emitTablePropsChangedEvent('enableMultiselect', newValue);
24
+ }
25
+ enableExpandableRowsChanged(newValue) {
26
+ this.emitTablePropsChangedEvent('enableExpandableRows', newValue);
27
+ }
28
+ compactDesignChanged(newValue) {
29
+ this.emitTablePropsChangedEvent('compactDesign', newValue);
30
+ }
31
+ verticalDividersChanged(newValue) {
32
+ this.emitTablePropsChangedEvent('verticalDividers', newValue);
33
+ }
34
+ noMinWidthChanged(newValue) {
35
+ this.emitTablePropsChangedEvent('noMinWidth', newValue);
36
+ }
37
+ whiteBackgroundChanged(newValue) {
38
+ this.emitTablePropsChangedEvent('whiteBackground', newValue);
39
+ }
40
+ render() {
41
+ return (h(Host, { class: { 'sdds-table--responsive': this.enableResponsive } }, h("table", { class: {
42
+ 'sdds-table': true,
43
+ 'sdds-table--compact': this.compactDesign,
44
+ 'sdds-table--divider': this.verticalDividers,
45
+ 'sdds-table--no-min-width': this.noMinWidth,
46
+ 'sdds-table--on-white-bg': this.whiteBackground,
47
+ 'sdds-table--responsive': this.enableResponsive,
48
+ } }, h("slot", null))));
49
+ }
50
+ static get is() { return "sdds-table"; }
51
+ static get encapsulation() { return "shadow"; }
52
+ static get originalStyleUrls() {
53
+ return {
54
+ "$": ["table.scss"]
55
+ };
56
+ }
57
+ static get styleUrls() {
58
+ return {
59
+ "$": ["table.css"]
60
+ };
61
+ }
62
+ static get properties() {
63
+ return {
64
+ "verticalDividers": {
65
+ "type": "boolean",
66
+ "mutable": false,
67
+ "complexType": {
68
+ "original": "boolean",
69
+ "resolved": "boolean",
70
+ "references": {}
71
+ },
72
+ "required": false,
73
+ "optional": false,
74
+ "docs": {
75
+ "tags": [],
76
+ "text": "Enables style with vertical dividers between columns"
77
+ },
78
+ "attribute": "vertical-dividers",
79
+ "reflect": true,
80
+ "defaultValue": "false"
81
+ },
82
+ "compactDesign": {
83
+ "type": "boolean",
84
+ "mutable": false,
85
+ "complexType": {
86
+ "original": "boolean",
87
+ "resolved": "boolean",
88
+ "references": {}
89
+ },
90
+ "required": false,
91
+ "optional": false,
92
+ "docs": {
93
+ "tags": [],
94
+ "text": "Enables style where data-table toolbar, rows and footer are less high"
95
+ },
96
+ "attribute": "compact-design",
97
+ "reflect": true,
98
+ "defaultValue": "false"
99
+ },
100
+ "noMinWidth": {
101
+ "type": "boolean",
102
+ "mutable": false,
103
+ "complexType": {
104
+ "original": "boolean",
105
+ "resolved": "boolean",
106
+ "references": {}
107
+ },
108
+ "required": false,
109
+ "optional": false,
110
+ "docs": {
111
+ "tags": [],
112
+ "text": "Enables to customise width on data-table columns"
113
+ },
114
+ "attribute": "no-min-width",
115
+ "reflect": true
116
+ },
117
+ "whiteBackground": {
118
+ "type": "boolean",
119
+ "mutable": false,
120
+ "complexType": {
121
+ "original": "boolean",
122
+ "resolved": "boolean",
123
+ "references": {}
124
+ },
125
+ "required": false,
126
+ "optional": false,
127
+ "docs": {
128
+ "tags": [],
129
+ "text": "Changes a colors of data data-table when used on white background"
130
+ },
131
+ "attribute": "white-background",
132
+ "reflect": true,
133
+ "defaultValue": "false"
134
+ },
135
+ "enableMultiselect": {
136
+ "type": "boolean",
137
+ "mutable": false,
138
+ "complexType": {
139
+ "original": "boolean",
140
+ "resolved": "boolean",
141
+ "references": {}
142
+ },
143
+ "required": false,
144
+ "optional": false,
145
+ "docs": {
146
+ "tags": [],
147
+ "text": "Enables multiselect feature of data-table"
148
+ },
149
+ "attribute": "enable-multiselect",
150
+ "reflect": true,
151
+ "defaultValue": "false"
152
+ },
153
+ "enableExpandableRows": {
154
+ "type": "boolean",
155
+ "mutable": false,
156
+ "complexType": {
157
+ "original": "boolean",
158
+ "resolved": "boolean",
159
+ "references": {}
160
+ },
161
+ "required": false,
162
+ "optional": false,
163
+ "docs": {
164
+ "tags": [],
165
+ "text": "Enables extended row feature of data-table"
166
+ },
167
+ "attribute": "enable-expandable-rows",
168
+ "reflect": true,
169
+ "defaultValue": "false"
170
+ },
171
+ "enableResponsive": {
172
+ "type": "boolean",
173
+ "mutable": false,
174
+ "complexType": {
175
+ "original": "boolean",
176
+ "resolved": "boolean",
177
+ "references": {}
178
+ },
179
+ "required": false,
180
+ "optional": false,
181
+ "docs": {
182
+ "tags": [],
183
+ "text": "Enables table to take 100% available width with equal spacing of columns"
184
+ },
185
+ "attribute": "enable-responsive",
186
+ "reflect": true,
187
+ "defaultValue": "false"
188
+ },
189
+ "tableId": {
190
+ "type": "string",
191
+ "mutable": false,
192
+ "complexType": {
193
+ "original": "string",
194
+ "resolved": "string",
195
+ "references": {}
196
+ },
197
+ "required": false,
198
+ "optional": false,
199
+ "docs": {
200
+ "tags": [],
201
+ "text": "ID used for internal table functionality and events, must be unique.\n\n**NOTE**: If you're listening for table events you need to set this ID yourself to identify the table, as the default ID is random and will be different every time."
202
+ },
203
+ "attribute": "table-id",
204
+ "reflect": false,
205
+ "defaultValue": "crypto.randomUUID()"
206
+ }
207
+ };
208
+ }
209
+ static get events() {
210
+ return [{
211
+ "method": "tablePropsChangedEvent",
212
+ "name": "tablePropsChangedEvent",
213
+ "bubbles": true,
214
+ "cancelable": true,
215
+ "composed": true,
216
+ "docs": {
217
+ "tags": [],
218
+ "text": "Broadcasts changes to the tables props"
219
+ },
220
+ "complexType": {
221
+ "original": "TablePropsChangedEvent",
222
+ "resolved": "{ tableId: string; changed: (keyof Props)[]; } & Partial<Props>",
223
+ "references": {
224
+ "TablePropsChangedEvent": {
225
+ "location": "local"
226
+ }
227
+ }
228
+ }
229
+ }];
230
+ }
231
+ static get elementRef() { return "host"; }
232
+ static get watchers() {
233
+ return [{
234
+ "propName": "enableMultiselect",
235
+ "methodName": "enableMultiselectChanged"
236
+ }, {
237
+ "propName": "enableExpandableRows",
238
+ "methodName": "enableExpandableRowsChanged"
239
+ }, {
240
+ "propName": "compactDesign",
241
+ "methodName": "compactDesignChanged"
242
+ }, {
243
+ "propName": "verticalDividers",
244
+ "methodName": "verticalDividersChanged"
245
+ }, {
246
+ "propName": "noMinWidth",
247
+ "methodName": "noMinWidthChanged"
248
+ }, {
249
+ "propName": "whiteBackground",
250
+ "methodName": "whiteBackgroundChanged"
251
+ }];
252
+ }
253
+ }
@@ -0,0 +1,22 @@
1
+ :host,
2
+ sdds-table-body {
3
+ box-sizing: border-box;
4
+ display: table-row-group;
5
+ }
6
+ :host *,
7
+ sdds-table-body * {
8
+ box-sizing: border-box;
9
+ }
10
+ :host .sdds-table__info-message,
11
+ sdds-table-body .sdds-table__info-message {
12
+ font: var(--sdds-detail-02);
13
+ letter-spacing: var(--sdds-detail-02-ls);
14
+ display: table-cell;
15
+ box-sizing: border-box;
16
+ color: var(--sdds-grey-958);
17
+ padding: var(--sdds-spacing-element-16);
18
+ min-width: 192px;
19
+ vertical-align: top;
20
+ background-color: transparent;
21
+ transition: background-color 200ms ease;
22
+ }
@@ -0,0 +1,425 @@
1
+ import { h, Host, } from '@stencil/core';
2
+ import dummyData from './dummy-data.json';
3
+ const relevantTableProps = [
4
+ 'enableMultiselect',
5
+ 'enableExpandableRows',
6
+ ];
7
+ export class TableBody {
8
+ constructor() {
9
+ this.uncheckAll = () => {
10
+ this.mainCheckboxStatus = false;
11
+ this.updateMainCheckboxEvent.emit([this.tableId, this.mainCheckboxStatus]);
12
+ this.updateBodyCheckboxesEvent.emit([this.tableId, this.mainCheckboxStatus]);
13
+ };
14
+ this.selectedDataExporter = () => {
15
+ const selectedRows = this.host.getElementsByClassName('sdds-table__row--selected');
16
+ this.multiselectArray = [];
17
+ for (let j = 0; j < selectedRows.length; j++) {
18
+ const rowCells = selectedRows[j].getElementsByTagName('sdds-body-cell');
19
+ const selectedObject = {};
20
+ for (let i = 0; i < rowCells.length; i++) {
21
+ const currentCellKey = rowCells[i].getAttribute('cell-key');
22
+ const currentCellValue = rowCells[i].getAttribute('cell-value');
23
+ selectedObject[currentCellKey] = currentCellValue;
24
+ }
25
+ this.multiselectArray.push(selectedObject);
26
+ }
27
+ this.multiselectArrayJSON = JSON.stringify(this.multiselectArray);
28
+ };
29
+ this.bodyCheckBoxClicked = () => {
30
+ const numberOfRows = this.host.getElementsByClassName('sdds-table__row').length;
31
+ const numberOfRowsSelected = this.host.getElementsByClassName('sdds-table__row--selected').length;
32
+ this.mainCheckboxStatus = numberOfRows === numberOfRowsSelected;
33
+ this.updateMainCheckboxEvent.emit([this.tableId, this.mainCheckboxStatus]);
34
+ this.selectedDataExporter();
35
+ };
36
+ this.disableFilteringFunction = false;
37
+ this.disableSortingFunction = false;
38
+ this.bodyData = undefined;
39
+ this.enableDummyData = false;
40
+ this.dummyData = JSON.stringify(dummyData);
41
+ this.rowsPerPage = 1;
42
+ this.enableMultiselect = false;
43
+ this.enablePaginationTableBody = false;
44
+ this.enableExpandableRows = true;
45
+ this.innerBodyData = [];
46
+ this.bodyDataManipulated = [];
47
+ this.bodyDataOriginal = [];
48
+ this.multiselectArray = [];
49
+ this.multiselectArrayJSON = undefined;
50
+ this.mainCheckboxStatus = false;
51
+ this.columnsNumber = 0;
52
+ this.disableAllSorting = false;
53
+ this.numberOfPages = 0;
54
+ this.paginationValue = 1;
55
+ this.tempPaginationDisable = false;
56
+ this.showNoResultsMessage = false;
57
+ this.tableId = '';
58
+ }
59
+ arrayDataWatcher(newValue) {
60
+ if (typeof newValue === 'string') {
61
+ this.innerBodyData = JSON.parse(newValue);
62
+ }
63
+ else {
64
+ this.innerBodyData = newValue;
65
+ }
66
+ this.bodyDataManipulated = [...this.innerBodyData];
67
+ this.bodyDataOriginal = [...this.innerBodyData];
68
+ }
69
+ tablePropsChangedEventListener(event) {
70
+ if (this.tableId === event.detail.tableId) {
71
+ event.detail.changed
72
+ .filter((changedProp) => relevantTableProps.includes(changedProp))
73
+ .forEach((changedProp) => {
74
+ if (typeof this[changedProp] === 'undefined') {
75
+ throw new Error(`Table prop is not supported: ${changedProp}`);
76
+ }
77
+ this[changedProp] = event.detail[changedProp];
78
+ });
79
+ }
80
+ }
81
+ static compareValues(key, order = 'asc') {
82
+ return function innerSort(a, b) {
83
+ // eslint-disable-next-line no-prototype-builtins
84
+ if (!a.hasOwnProperty(key) || !b.hasOwnProperty(key)) {
85
+ // property doesn't exist on either object
86
+ return 0;
87
+ }
88
+ const varA = typeof a[key] === 'string' ? a[key].toUpperCase() : a[key];
89
+ const varB = typeof b[key] === 'string' ? b[key].toUpperCase() : b[key];
90
+ let comparison = 0;
91
+ if (varA > varB) {
92
+ comparison = 1;
93
+ }
94
+ else if (varA < varB) {
95
+ comparison = -1;
96
+ }
97
+ return order === 'desc' ? comparison * -1 : comparison;
98
+ };
99
+ }
100
+ sortData(keyValue, sortingDirection) {
101
+ if (!this.disableSortingFunction) {
102
+ if (this.enableMultiselect) {
103
+ // Uncheck all checkboxes as state of checkbox is lost on sorting. Do it only in case multiSelect is True.
104
+ this.uncheckAll();
105
+ }
106
+ // use spread operator to make enable sorting and modifying array, same as using .slice()
107
+ this.bodyDataManipulated = [...this.bodyDataManipulated];
108
+ this.bodyDataManipulated.sort(TableBody.compareValues(keyValue, sortingDirection));
109
+ }
110
+ }
111
+ // Listen to sortColumnData from data-table-header-element
112
+ updateOptionsContent(event) {
113
+ const [receivedID, receivedKeyValue, receivedSortingDirection] = event.detail;
114
+ if (this.tableId === receivedID) {
115
+ this.sortData(receivedKeyValue, receivedSortingDirection);
116
+ }
117
+ }
118
+ headCheckboxListener(event) {
119
+ if (this.tableId === event.detail[0]) {
120
+ [, this.mainCheckboxStatus] = event.detail;
121
+ this.selectedDataExporter();
122
+ }
123
+ }
124
+ // No need to read the value, event is here just to trigger another function
125
+ bodyCheckboxListener() {
126
+ this.bodyCheckBoxClicked();
127
+ }
128
+ searchFunction(searchTerm) {
129
+ if (!this.disableFilteringFunction) {
130
+ /*
131
+ // Logic for filtering JSON data on all columns
132
+ // Really nice solution, do not delete, might be needed in future
133
+ // Reason to go with upper one is not to lose selected state on checkboxes
134
+ if (searchTerm.length > 0) {
135
+ this.bodyDataManipulated = this.bodyDataOriginal.filter((option) =>
136
+ Object.keys(option).some(
137
+ (key) =>
138
+ String(option[key] ?? '')
139
+ .toLowerCase()
140
+ .indexOf(searchTerm) >= 0
141
+ )
142
+ );
143
+ } else {
144
+ this.bodyDataManipulated = this.bodyDataOriginal;
145
+ }
146
+ */
147
+ // grab all rows in body
148
+ const dataRowsFiltering = this.host.querySelectorAll('sdds-table-body-row');
149
+ if (searchTerm.length > 0) {
150
+ if (this.enablePaginationTableBody) {
151
+ this.tempPaginationDisable = true;
152
+ }
153
+ dataRowsFiltering.forEach((item) => {
154
+ const cells = item.querySelectorAll('sdds-body-cell');
155
+ const cellValuesArray = [];
156
+ // go through cells and save cell-values in array
157
+ cells.forEach((cellItem) => {
158
+ const cellValue = cellItem.getAttribute('cell-value').toLowerCase();
159
+ cellValuesArray.push(cellValue);
160
+ });
161
+ // iterate over array of values and see if one matches search string
162
+ const matchCounter = cellValuesArray.find((element) => element.includes(searchTerm));
163
+ // if matches, show parent row, otherwise hide the row
164
+ if (matchCounter) {
165
+ item.classList.remove('sdds-table__row--hidden');
166
+ }
167
+ else {
168
+ item.classList.add('sdds-table__row--hidden');
169
+ }
170
+ });
171
+ this.disableAllSorting = true;
172
+ this.sortingSwitcherEvent.emit([this.tableId, this.disableAllSorting]);
173
+ const dataRowsHidden = this.host.querySelectorAll('.sdds-table__row--hidden');
174
+ // If same, info message will be shown
175
+ this.showNoResultsMessage = dataRowsHidden.length === dataRowsFiltering.length;
176
+ }
177
+ else {
178
+ if (this.enablePaginationTableBody) {
179
+ this.tempPaginationDisable = false;
180
+ }
181
+ // Check if pagination is ON in order to prevent showing all rows
182
+ if (this.enablePaginationTableBody) {
183
+ // TODO: EMIT PAGINATION
184
+ }
185
+ else {
186
+ dataRowsFiltering.forEach((item) => {
187
+ item.classList.remove('sdds-table__row--hidden');
188
+ });
189
+ }
190
+ this.disableAllSorting = false;
191
+ this.sortingSwitcherEvent.emit([this.tableId, this.disableAllSorting]);
192
+ }
193
+ }
194
+ }
195
+ // Listen to tableFilteringTerm from tableToolbar component
196
+ tableFilteringTermListener(event) {
197
+ if (this.tableId === event.detail[0]) {
198
+ this.searchFunction(event.detail[1]);
199
+ }
200
+ }
201
+ connectedCallback() {
202
+ this.tableEl = this.host.closest('sdds-table');
203
+ this.tableId = this.tableEl.tableId;
204
+ }
205
+ componentWillLoad() {
206
+ relevantTableProps.forEach((tablePropName) => {
207
+ this[tablePropName] = this.tableEl[tablePropName];
208
+ });
209
+ if (this.enableDummyData) {
210
+ this.bodyData = this.dummyData;
211
+ }
212
+ else if (this.bodyData) {
213
+ this.arrayDataWatcher(this.bodyData);
214
+ }
215
+ }
216
+ componentWillRender() {
217
+ const headerColumnsNo = this.host.parentElement.querySelector('sdds-table-header').children.length;
218
+ // multiselect and expended features requires one extra column for controls...
219
+ if (this.enableMultiselect || this.enableExpandableRows) {
220
+ this.columnsNumber = headerColumnsNo + 1;
221
+ }
222
+ else {
223
+ this.columnsNumber = headerColumnsNo;
224
+ }
225
+ }
226
+ render() {
227
+ return (h(Host, { "data-selected-rows": this.multiselectArrayJSON }, this.bodyDataManipulated.map((row) => (h("sdds-table-body-row", null, Object.keys(row).map((cellData) => (h("sdds-body-cell", { "cell-key": cellData, "cell-value": row[cellData] })))))), this.showNoResultsMessage && (h("tr", null, h("td", { class: "sdds-table__info-message", colSpan: this.columnsNumber }, "Unfortunately, no data matches your search term \uD83D\uDE15"))), h("slot", null)));
228
+ }
229
+ static get is() { return "sdds-table-body"; }
230
+ static get originalStyleUrls() {
231
+ return {
232
+ "$": ["table-body.scss"]
233
+ };
234
+ }
235
+ static get styleUrls() {
236
+ return {
237
+ "$": ["table-body.css"]
238
+ };
239
+ }
240
+ static get properties() {
241
+ return {
242
+ "disableFilteringFunction": {
243
+ "type": "boolean",
244
+ "mutable": false,
245
+ "complexType": {
246
+ "original": "boolean",
247
+ "resolved": "boolean",
248
+ "references": {}
249
+ },
250
+ "required": false,
251
+ "optional": false,
252
+ "docs": {
253
+ "tags": [],
254
+ "text": "Disables inbuilt filtering logic, leaving user an option to create own filter functionality while listening to events from sdds-table-toolbar component for search term"
255
+ },
256
+ "attribute": "disable-filtering-function",
257
+ "reflect": false,
258
+ "defaultValue": "false"
259
+ },
260
+ "disableSortingFunction": {
261
+ "type": "boolean",
262
+ "mutable": false,
263
+ "complexType": {
264
+ "original": "boolean",
265
+ "resolved": "boolean",
266
+ "references": {}
267
+ },
268
+ "required": false,
269
+ "optional": false,
270
+ "docs": {
271
+ "tags": [],
272
+ "text": "Disables inbuilt sorting logic, leaving user an option to create own sorting functionality while listening to events from sdds-header-cell component for sorting"
273
+ },
274
+ "attribute": "disable-sorting-function",
275
+ "reflect": false,
276
+ "defaultValue": "false"
277
+ },
278
+ "bodyData": {
279
+ "type": "any",
280
+ "mutable": false,
281
+ "complexType": {
282
+ "original": "any",
283
+ "resolved": "any",
284
+ "references": {}
285
+ },
286
+ "required": false,
287
+ "optional": false,
288
+ "docs": {
289
+ "tags": [],
290
+ "text": "Prop to pass JSON string which enables automatic rendering of table rows and cells"
291
+ },
292
+ "attribute": "body-data",
293
+ "reflect": false
294
+ },
295
+ "enableDummyData": {
296
+ "type": "boolean",
297
+ "mutable": false,
298
+ "complexType": {
299
+ "original": "boolean",
300
+ "resolved": "boolean",
301
+ "references": {}
302
+ },
303
+ "required": false,
304
+ "optional": false,
305
+ "docs": {
306
+ "tags": [],
307
+ "text": "Prop for showcase of rendering JSON in body-data, just for presentation purposes"
308
+ },
309
+ "attribute": "enable-dummy-data",
310
+ "reflect": false,
311
+ "defaultValue": "false"
312
+ }
313
+ };
314
+ }
315
+ static get states() {
316
+ return {
317
+ "dummyData": {},
318
+ "rowsPerPage": {},
319
+ "enableMultiselect": {},
320
+ "enablePaginationTableBody": {},
321
+ "enableExpandableRows": {},
322
+ "innerBodyData": {},
323
+ "bodyDataManipulated": {},
324
+ "bodyDataOriginal": {},
325
+ "multiselectArray": {},
326
+ "multiselectArrayJSON": {},
327
+ "mainCheckboxStatus": {},
328
+ "columnsNumber": {},
329
+ "disableAllSorting": {},
330
+ "numberOfPages": {},
331
+ "paginationValue": {},
332
+ "tempPaginationDisable": {},
333
+ "showNoResultsMessage": {},
334
+ "tableId": {}
335
+ };
336
+ }
337
+ static get events() {
338
+ return [{
339
+ "method": "sortingSwitcherEvent",
340
+ "name": "sortingSwitcherEvent",
341
+ "bubbles": true,
342
+ "cancelable": true,
343
+ "composed": true,
344
+ "docs": {
345
+ "tags": [],
346
+ "text": "Event that sends unique table identifier and enable/disable status for sorting functionality"
347
+ },
348
+ "complexType": {
349
+ "original": "any",
350
+ "resolved": "any",
351
+ "references": {}
352
+ }
353
+ }, {
354
+ "method": "updateBodyCheckboxesEvent",
355
+ "name": "updateBodyCheckboxesEvent",
356
+ "bubbles": true,
357
+ "cancelable": true,
358
+ "composed": true,
359
+ "docs": {
360
+ "tags": [],
361
+ "text": "Sends unique table identifier and mainCheckbox status to all rows when multiselect feature is enabled"
362
+ },
363
+ "complexType": {
364
+ "original": "any",
365
+ "resolved": "any",
366
+ "references": {}
367
+ }
368
+ }, {
369
+ "method": "updateMainCheckboxEvent",
370
+ "name": "updateMainCheckboxEvent",
371
+ "bubbles": true,
372
+ "cancelable": true,
373
+ "composed": true,
374
+ "docs": {
375
+ "tags": [],
376
+ "text": "Sends unique table identifier and status if mainCheckbox should change its state based on selection status of single rows when multiselect feature is used"
377
+ },
378
+ "complexType": {
379
+ "original": "any",
380
+ "resolved": "any",
381
+ "references": {}
382
+ }
383
+ }];
384
+ }
385
+ static get elementRef() { return "host"; }
386
+ static get watchers() {
387
+ return [{
388
+ "propName": "bodyData",
389
+ "methodName": "arrayDataWatcher"
390
+ }];
391
+ }
392
+ static get listeners() {
393
+ return [{
394
+ "name": "tablePropsChangedEvent",
395
+ "method": "tablePropsChangedEventListener",
396
+ "target": "body",
397
+ "capture": false,
398
+ "passive": false
399
+ }, {
400
+ "name": "sortColumnDataEvent",
401
+ "method": "updateOptionsContent",
402
+ "target": "body",
403
+ "capture": false,
404
+ "passive": false
405
+ }, {
406
+ "name": "mainCheckboxSelectedEvent",
407
+ "method": "headCheckboxListener",
408
+ "target": "body",
409
+ "capture": false,
410
+ "passive": false
411
+ }, {
412
+ "name": "bodyRowToTable",
413
+ "method": "bodyCheckboxListener",
414
+ "target": "body",
415
+ "capture": false,
416
+ "passive": false
417
+ }, {
418
+ "name": "tableFilteringTerm",
419
+ "method": "tableFilteringTermListener",
420
+ "target": "body",
421
+ "capture": false,
422
+ "passive": false
423
+ }];
424
+ }
425
+ }