@nanoporetech-digital/components 5.1.2 → 5.2.0

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 (218) hide show
  1. package/CHANGELOG.md +35 -0
  2. package/dist/cjs/{component-store-74d25f63.js → component-store-f1dc1276.js} +2 -2
  3. package/dist/cjs/{component-store-74d25f63.js.map → component-store-f1dc1276.js.map} +1 -1
  4. package/dist/cjs/index.cjs.js +1 -1
  5. package/dist/cjs/loader.cjs.js +1 -1
  6. package/dist/cjs/nano-algolia-filter.cjs.entry.js +2 -2
  7. package/dist/cjs/nano-algolia-input.cjs.entry.js +2 -2
  8. package/dist/cjs/nano-algolia.cjs.entry.js +2 -2
  9. package/dist/cjs/nano-checkbox-group.cjs.entry.js +5 -1
  10. package/dist/cjs/nano-checkbox-group.cjs.entry.js.map +1 -1
  11. package/dist/cjs/nano-components.cjs.js +1 -1
  12. package/dist/cjs/nano-datalist_3.cjs.entry.js +14 -5
  13. package/dist/cjs/nano-datalist_3.cjs.entry.js.map +1 -1
  14. package/dist/cjs/nano-dialog.cjs.entry.js +2 -2
  15. package/dist/cjs/nano-global-nav-user-profile_3.cjs.entry.js +8 -5
  16. package/dist/cjs/nano-global-nav-user-profile_3.cjs.entry.js.map +1 -1
  17. package/dist/cjs/nano-global-nav.cjs.entry.js +2 -2
  18. package/dist/cjs/nano-input.cjs.entry.js +3 -3
  19. package/dist/cjs/nano-input.cjs.entry.js.map +1 -1
  20. package/dist/cjs/nano-overflow-nav.cjs.entry.js +1 -1
  21. package/dist/cjs/nano-range.cjs.entry.js +1 -1
  22. package/dist/cjs/nano-resize-observe_2.cjs.entry.js +3 -1
  23. package/dist/cjs/nano-resize-observe_2.cjs.entry.js.map +1 -1
  24. package/dist/cjs/nano-sortable.cjs.entry.js +18 -8
  25. package/dist/cjs/nano-sortable.cjs.entry.js.map +1 -1
  26. package/dist/cjs/nano-split-pane.cjs.entry.js +1 -1
  27. package/dist/cjs/nano-sticker.cjs.entry.js +4 -2
  28. package/dist/cjs/nano-sticker.cjs.entry.js.map +1 -1
  29. package/dist/cjs/nano-tab-group.cjs.entry.js +2 -2
  30. package/dist/cjs/{nano-table-0a720c5f.js → nano-table-04993bb4.js} +560 -186
  31. package/dist/cjs/nano-table-04993bb4.js.map +1 -0
  32. package/dist/cjs/nano-table.cjs.entry.js +2 -2
  33. package/dist/cjs/{table.worker-347d4d31.js → table.worker-85877b23.js} +4 -4
  34. package/dist/cjs/table.worker-85877b23.js.map +1 -0
  35. package/dist/cjs/{table.worker-bd51e29f.js → table.worker-f258383d.js} +1 -1
  36. package/dist/cjs/{throttle-f55496c8.js → throttle-dfa64b9e.js} +17 -20
  37. package/dist/cjs/throttle-dfa64b9e.js.map +1 -0
  38. package/dist/collection/components/checkbox/checkbox-group.js +4 -0
  39. package/dist/collection/components/checkbox/checkbox-group.js.map +1 -1
  40. package/dist/collection/components/datalist/datalist.js +13 -4
  41. package/dist/collection/components/datalist/datalist.js.map +1 -1
  42. package/dist/collection/components/input/input.css +1 -1
  43. package/dist/collection/components/input/input.js +1 -1
  44. package/dist/collection/components/input/input.js.map +1 -1
  45. package/dist/collection/components/nav-item/nav-item.js +6 -3
  46. package/dist/collection/components/nav-item/nav-item.js.map +1 -1
  47. package/dist/collection/components/resize-observe/resize-observe.js +21 -1
  48. package/dist/collection/components/resize-observe/resize-observe.js.map +1 -1
  49. package/dist/collection/components/select/select.css +1 -2
  50. package/dist/collection/components/sortable/sortable.js +5 -7
  51. package/dist/collection/components/sortable/sortable.js.map +1 -1
  52. package/dist/collection/components/sticker/sticker.js +11 -5
  53. package/dist/collection/components/sticker/sticker.js.map +1 -1
  54. package/dist/collection/components/table/table-interface.js.map +1 -1
  55. package/dist/collection/components/table/table.cell.js +43 -10
  56. package/dist/collection/components/table/table.cell.js.map +1 -1
  57. package/dist/collection/components/table/table.css +38 -55
  58. package/dist/collection/components/table/table.header.js +4 -9
  59. package/dist/collection/components/table/table.header.js.map +1 -1
  60. package/dist/collection/components/table/table.js +104 -48
  61. package/dist/collection/components/table/table.js.map +1 -1
  62. package/dist/collection/components/table/table.pin-service.js +382 -0
  63. package/dist/collection/components/table/table.pin-service.js.map +1 -0
  64. package/dist/collection/components/table/table.row.js +39 -46
  65. package/dist/collection/components/table/table.row.js.map +1 -1
  66. package/dist/collection/components/table/table.utils.js +0 -124
  67. package/dist/collection/components/table/table.utils.js.map +1 -1
  68. package/dist/collection/components/table/table.worker.js +1 -0
  69. package/dist/collection/components/table/table.worker.js.map +1 -1
  70. package/dist/collection/utils/events.js +27 -0
  71. package/dist/collection/utils/events.js.map +1 -0
  72. package/dist/collection/utils/throttle.js +16 -19
  73. package/dist/collection/utils/throttle.js.map +1 -1
  74. package/dist/components/datalist.js +13 -4
  75. package/dist/components/datalist.js.map +1 -1
  76. package/dist/components/input.js +2 -2
  77. package/dist/components/input.js.map +1 -1
  78. package/dist/components/nano-checkbox-group.js +4 -0
  79. package/dist/components/nano-checkbox-group.js.map +1 -1
  80. package/dist/components/nano-sortable.js +17 -7
  81. package/dist/components/nano-sortable.js.map +1 -1
  82. package/dist/components/nav-item.js +6 -3
  83. package/dist/components/nav-item.js.map +1 -1
  84. package/dist/components/resize-observe.js +3 -1
  85. package/dist/components/resize-observe.js.map +1 -1
  86. package/dist/components/select.js +1 -1
  87. package/dist/components/select.js.map +1 -1
  88. package/dist/components/sticker.js +3 -1
  89. package/dist/components/sticker.js.map +1 -1
  90. package/dist/components/table.js +533 -188
  91. package/dist/components/table.js.map +1 -1
  92. package/dist/components/table.worker.js +1 -1
  93. package/dist/components/throttle.js +16 -19
  94. package/dist/components/throttle.js.map +1 -1
  95. package/dist/esm/{component-store-244a8431.js → component-store-c23ebc9c.js} +2 -2
  96. package/dist/esm/{component-store-244a8431.js.map → component-store-c23ebc9c.js.map} +1 -1
  97. package/dist/esm/index.js +1 -1
  98. package/dist/esm/loader.js +1 -1
  99. package/dist/esm/nano-algolia-filter.entry.js +2 -2
  100. package/dist/esm/nano-algolia-input.entry.js +2 -2
  101. package/dist/esm/nano-algolia.entry.js +2 -2
  102. package/dist/esm/nano-checkbox-group.entry.js +5 -1
  103. package/dist/esm/nano-checkbox-group.entry.js.map +1 -1
  104. package/dist/esm/nano-components.js +1 -1
  105. package/dist/esm/nano-datalist_3.entry.js +14 -5
  106. package/dist/esm/nano-datalist_3.entry.js.map +1 -1
  107. package/dist/esm/nano-dialog.entry.js +2 -2
  108. package/dist/esm/nano-global-nav-user-profile_3.entry.js +8 -5
  109. package/dist/esm/nano-global-nav-user-profile_3.entry.js.map +1 -1
  110. package/dist/esm/nano-global-nav.entry.js +2 -2
  111. package/dist/esm/nano-input.entry.js +3 -3
  112. package/dist/esm/nano-input.entry.js.map +1 -1
  113. package/dist/esm/nano-overflow-nav.entry.js +1 -1
  114. package/dist/esm/nano-range.entry.js +1 -1
  115. package/dist/esm/nano-resize-observe_2.entry.js +3 -1
  116. package/dist/esm/nano-resize-observe_2.entry.js.map +1 -1
  117. package/dist/esm/nano-sortable.entry.js +18 -8
  118. package/dist/esm/nano-sortable.entry.js.map +1 -1
  119. package/dist/esm/nano-split-pane.entry.js +1 -1
  120. package/dist/esm/nano-sticker.entry.js +4 -2
  121. package/dist/esm/nano-sticker.entry.js.map +1 -1
  122. package/dist/esm/nano-tab-group.entry.js +2 -2
  123. package/dist/esm/{nano-table-9767860f.js → nano-table-91f09583.js} +561 -187
  124. package/dist/esm/nano-table-91f09583.js.map +1 -0
  125. package/dist/esm/nano-table.entry.js +2 -2
  126. package/dist/esm/{table.worker-d252307c.js → table.worker-625475ba.js} +4 -4
  127. package/dist/esm/table.worker-625475ba.js.map +1 -0
  128. package/dist/esm/{table.worker-bd51e29f.js → table.worker-f258383d.js} +1 -1
  129. package/dist/esm/{throttle-7836544e.js → throttle-ac4fcefa.js} +17 -20
  130. package/dist/esm/throttle-ac4fcefa.js.map +1 -0
  131. package/dist/nano-components/index.esm.js +1 -1
  132. package/dist/nano-components/nano-components.esm.js +1 -1
  133. package/dist/nano-components/nano-components.esm.js.map +1 -1
  134. package/dist/nano-components/{p-7d6065c6.entry.js → p-0697795a.entry.js} +2 -2
  135. package/dist/nano-components/p-0697795a.entry.js.map +1 -0
  136. package/dist/nano-components/p-17ee0c07.entry.js +5 -0
  137. package/dist/nano-components/{p-6975f110.entry.js → p-192902e0.entry.js} +2 -2
  138. package/dist/nano-components/{p-a6ff5ca6.js → p-1a0b5bc3.js} +2 -2
  139. package/dist/nano-components/{p-3a761d77.entry.js → p-1b791810.entry.js} +2 -2
  140. package/dist/nano-components/p-3de3449e.js +5 -0
  141. package/dist/nano-components/p-3de3449e.js.map +1 -0
  142. package/dist/nano-components/p-3eb6d833.entry.js +5 -0
  143. package/dist/nano-components/p-3eb6d833.entry.js.map +1 -0
  144. package/dist/nano-components/{p-a1c0afb6.entry.js → p-4884b65a.entry.js} +2 -2
  145. package/dist/nano-components/{p-75735a91.entry.js → p-565793a2.entry.js} +2 -2
  146. package/dist/nano-components/p-565793a2.entry.js.map +1 -0
  147. package/dist/nano-components/p-5aae2588.entry.js +5 -0
  148. package/dist/nano-components/p-5aae2588.entry.js.map +1 -0
  149. package/dist/nano-components/{p-935aef3d.entry.js → p-6920ad69.entry.js} +2 -2
  150. package/dist/nano-components/{p-1c6c94cb.entry.js → p-7baa9e14.entry.js} +2 -2
  151. package/dist/nano-components/p-7bff5224.js +5 -0
  152. package/dist/nano-components/p-7bff5224.js.map +1 -0
  153. package/dist/nano-components/{p-f60fe933.entry.js → p-898cbac7.entry.js} +2 -2
  154. package/dist/nano-components/{p-ace1ffc2.entry.js → p-a362bd23.entry.js} +2 -2
  155. package/dist/nano-components/{p-eb6c9191.entry.js → p-b72df1aa.entry.js} +2 -2
  156. package/dist/nano-components/p-bf18e298.entry.js +5 -0
  157. package/dist/nano-components/p-bf18e298.entry.js.map +1 -0
  158. package/dist/nano-components/p-ce5efc3f.entry.js +5 -0
  159. package/dist/nano-components/p-ce5efc3f.entry.js.map +1 -0
  160. package/dist/nano-components/{p-1b687f96.entry.js → p-d0eefd52.entry.js} +2 -2
  161. package/dist/nano-components/{p-2d43a82b.entry.js → p-d74e2642.entry.js} +2 -2
  162. package/dist/nano-components/p-d74e2642.entry.js.map +1 -0
  163. package/dist/nano-components/p-dfbf0d56.js +5 -0
  164. package/dist/nano-components/{p-bd51e29f.js → p-f258383d.js} +1 -1
  165. package/dist/types/components/datalist/datalist.d.ts +1 -0
  166. package/dist/types/components/nav-item/nav-item.d.ts +1 -1
  167. package/dist/types/components/resize-observe/resize-observe.d.ts +2 -0
  168. package/dist/types/components/sortable/sortable.d.ts +0 -1
  169. package/dist/types/components/sticker/sticker.d.ts +2 -2
  170. package/dist/types/components/table/table-interface.d.ts +23 -11
  171. package/dist/types/components/table/table.cell.d.ts +0 -7
  172. package/dist/types/components/table/table.d.ts +10 -7
  173. package/dist/types/components/table/table.header.d.ts +0 -1
  174. package/dist/types/components/table/table.pin-service.d.ts +90 -0
  175. package/dist/types/components/table/table.row.d.ts +3 -2
  176. package/dist/types/components/table/table.utils.d.ts +0 -27
  177. package/dist/types/components.d.ts +29 -11
  178. package/dist/types/utils/events.d.ts +15 -0
  179. package/dist/types/utils/throttle.d.ts +1 -1
  180. package/docs-json.json +59 -24
  181. package/docs-vscode.json +2 -2
  182. package/hydrate/index.js +610 -204
  183. package/package.json +2 -2
  184. package/dist/cjs/nano-table-0a720c5f.js.map +0 -1
  185. package/dist/cjs/table.worker-347d4d31.js.map +0 -1
  186. package/dist/cjs/throttle-f55496c8.js.map +0 -1
  187. package/dist/esm/nano-table-9767860f.js.map +0 -1
  188. package/dist/esm/table.worker-d252307c.js.map +0 -1
  189. package/dist/esm/throttle-7836544e.js.map +0 -1
  190. package/dist/nano-components/p-15217442.entry.js +0 -5
  191. package/dist/nano-components/p-15217442.entry.js.map +0 -1
  192. package/dist/nano-components/p-2d43a82b.entry.js.map +0 -1
  193. package/dist/nano-components/p-633c778c.js +0 -5
  194. package/dist/nano-components/p-633c778c.js.map +0 -1
  195. package/dist/nano-components/p-66631f50.js +0 -5
  196. package/dist/nano-components/p-75735a91.entry.js.map +0 -1
  197. package/dist/nano-components/p-7d6065c6.entry.js.map +0 -1
  198. package/dist/nano-components/p-8a79a7ca.entry.js +0 -5
  199. package/dist/nano-components/p-9746b0a5.js +0 -5
  200. package/dist/nano-components/p-9746b0a5.js.map +0 -1
  201. package/dist/nano-components/p-b0c60290.entry.js +0 -5
  202. package/dist/nano-components/p-b0c60290.entry.js.map +0 -1
  203. package/dist/nano-components/p-c8ccb57a.entry.js +0 -5
  204. package/dist/nano-components/p-c8ccb57a.entry.js.map +0 -1
  205. package/dist/nano-components/p-d1a5326f.entry.js +0 -5
  206. package/dist/nano-components/p-d1a5326f.entry.js.map +0 -1
  207. /package/dist/nano-components/{p-66631f50.js.map → p-17ee0c07.entry.js.map} +0 -0
  208. /package/dist/nano-components/{p-6975f110.entry.js.map → p-192902e0.entry.js.map} +0 -0
  209. /package/dist/nano-components/{p-a6ff5ca6.js.map → p-1a0b5bc3.js.map} +0 -0
  210. /package/dist/nano-components/{p-3a761d77.entry.js.map → p-1b791810.entry.js.map} +0 -0
  211. /package/dist/nano-components/{p-a1c0afb6.entry.js.map → p-4884b65a.entry.js.map} +0 -0
  212. /package/dist/nano-components/{p-935aef3d.entry.js.map → p-6920ad69.entry.js.map} +0 -0
  213. /package/dist/nano-components/{p-1c6c94cb.entry.js.map → p-7baa9e14.entry.js.map} +0 -0
  214. /package/dist/nano-components/{p-f60fe933.entry.js.map → p-898cbac7.entry.js.map} +0 -0
  215. /package/dist/nano-components/{p-ace1ffc2.entry.js.map → p-a362bd23.entry.js.map} +0 -0
  216. /package/dist/nano-components/{p-eb6c9191.entry.js.map → p-b72df1aa.entry.js.map} +0 -0
  217. /package/dist/nano-components/{p-1b687f96.entry.js.map → p-d0eefd52.entry.js.map} +0 -0
  218. /package/dist/nano-components/{p-8a79a7ca.entry.js.map → p-dfbf0d56.js.map} +0 -0
@@ -3,8 +3,8 @@
3
3
  */
4
4
  import { Fragment, h } from '@stencil/core';
5
5
  import { CSSNAMESPACE } from './table.constants';
6
- import { addHObserver, addVObserver, colheadFootRender, headerPinClasses, mergeProperties, } from './table.utils';
7
- export const TableColHead = ({ column, headRenderer, onColumnSortClick, onColumnPinned, defaults, }) => {
6
+ import { colheadFootRender, headerPinClasses, mergeProperties, } from './table.utils';
7
+ export const TableColHead = ({ column, onColumnSortClick, defaults, }) => {
8
8
  // Sort handling
9
9
  function handleColumnSortClick(e) {
10
10
  let order;
@@ -29,7 +29,7 @@ export const TableColHead = ({ column, headRenderer, onColumnSortClick, onColumn
29
29
  extraProps = column.columnProperties(column) || extraProps;
30
30
  }
31
31
  const baseProps = {
32
- class: Object.assign(Object.assign({}, headerPinClasses('th', headRenderer === null || headRenderer === void 0 ? void 0 : headRenderer.pinned)), { [`${CSSNAMESPACE}__pin--start`]: column.pinned === 'start', [`${CSSNAMESPACE}__pin--end`]: column.pinned === 'end', [`${CSSNAMESPACE}__ordered`]: !!column.order, [`${CSSNAMESPACE}__filtered`]: column.filter !== undefined && column.filter !== null }),
32
+ class: Object.assign(Object.assign({}, headerPinClasses('th', column.pinned)), { [`${CSSNAMESPACE}__pin--start`]: column.pinned === 'start', [`${CSSNAMESPACE}__pin--end`]: column.pinned === 'end', [`${CSSNAMESPACE}__ordered`]: !!column.order, [`${CSSNAMESPACE}__filtered`]: column.filter !== undefined && column.filter !== null }),
33
33
  };
34
34
  let props = extraProps ? mergeProperties(baseProps, extraProps) : baseProps;
35
35
  const content = colheadFootRender(column);
@@ -46,12 +46,7 @@ export const TableColHead = ({ column, headRenderer, onColumnSortClick, onColumn
46
46
  : 'none';
47
47
  props = Object.assign(Object.assign({}, props), { 'aria-sort': sort });
48
48
  }
49
- return (h("th", Object.assign({}, props, { ref: (th) => {
50
- if (['end', 'start'].includes(column.pinned))
51
- addHObserver(th, column.pinned, onColumnPinned);
52
- if (['top', 'bottom'].includes(headRenderer.pinned))
53
- addVObserver(th, headRenderer.pinned, onColumnPinned);
54
- }, key: column.prop }), isSortable() ? (h("button", { class: {
49
+ return (h("th", Object.assign({}, props, { key: column.prop }), isSortable() ? (h("button", { class: {
55
50
  [`${CSSNAMESPACE}__order-btn`]: true,
56
51
  [`${CSSNAMESPACE}__cell-content`]: true,
57
52
  }, onClick: handleColumnSortClick }, colheadFootRender(column), column.filter !== undefined && column.filter !== null && (h("nano-icon", { name: "light/filter" })), !!column.order &&
@@ -1 +1 @@
1
- {"version":3,"file":"table.header.js","sourceRoot":"","sources":["../../../src/components/table/table.header.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAuB,CAAC,EAAE,MAAM,eAAe,CAAC;AACjE,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EACL,YAAY,EACZ,YAAY,EACZ,iBAAiB,EACjB,gBAAgB,EAChB,eAAe,GAChB,MAAM,eAAe,CAAC;AAkBvB,MAAM,CAAC,MAAM,YAAY,GAA2C,CAAC,EACnE,MAAM,EACN,YAAY,EACZ,iBAAiB,EACjB,cAAc,EACd,QAAQ,GACT,EAAE,EAAE;EACH,gBAAgB;EAEhB,SAAS,qBAAqB,CAAC,CAAuC;IACpE,IAAI,KAAK,CAAC;IACV,QAAQ,MAAM,CAAC,KAAK,EAAE;MACpB,KAAK,KAAK;QACR,KAAK,GAAG,MAAM,CAAC;QACf,MAAM;MACR,KAAK,MAAM;QACT,KAAK,GAAG,IAAI,CAAC;QACb,MAAM;MACR;QACE,KAAK,GAAG,KAAK,CAAC;KACjB;IACD,iBAAiB,CAAC,KAAK,EAAE,MAAM,CAAC,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC;EAChE,CAAC;EAED,SAAS,UAAU;IACjB,OAAO,CACL,CAAC,CAAC,CAAC,QAAQ,CAAC,QAAQ,IAAI,MAAM,CAAC,QAAQ,KAAK,KAAK,CAAC;MAClD,CAAC,CAAC,QAAQ,CAAC,QAAQ,IAAI,MAAM,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WAAK,KAAK,EAAE,GAAG,YAAY,gBAAgB;IACxC,iBAAiB,CAAC,MAAM,CAAC;IACzB,MAAM,CAAC,MAAM,KAAK,SAAS,IAAI,MAAM,CAAC,MAAM,KAAK,IAAI,IAAI,CACxD,iBAAW,IAAI,EAAC,mBAAmB,GAAG,CACvC,CACG,CACP,CACE,CACN,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import { Fragment, FunctionalComponent, h } from '@stencil/core';\nimport { CSSNAMESPACE } from './table.constants';\nimport {\n addHObserver,\n addVObserver,\n colheadFootRender,\n headerPinClasses,\n mergeProperties,\n} from './table.utils';\nimport type { TableTypes } from '../../interface';\n\n// TABLE HEADERS\n// (thead > tr > th, tfoot > tr > th)\n\ntype TableColHeadProps = {\n column: TableTypes.ColumnConfig;\n headRenderer: TableTypes.HeadFootRenderer;\n onColumnSortClick?: (\n order: TableTypes.Order,\n column: TableTypes.Prop,\n el: HTMLTableCellElement\n ) => void;\n onColumnPinned?: TableTypes.PinnedCb;\n defaults: { sortable?: boolean };\n};\n\nexport const TableColHead: FunctionalComponent<TableColHeadProps> = ({\n column,\n headRenderer,\n onColumnSortClick,\n onColumnPinned,\n defaults,\n}) => {\n // Sort handling\n\n function handleColumnSortClick(e: MouseEvent & { target: HTMLElement }) {\n let order;\n switch (column.order) {\n case 'asc':\n order = 'desc';\n break;\n case 'desc':\n order = null;\n break;\n default:\n order = 'asc';\n }\n onColumnSortClick(order, column.prop, e.target.closest('th'));\n }\n\n function isSortable() {\n return (\n (!!defaults.sortable && column.sortable !== false) ||\n (!defaults.sortable && column.sortable === true)\n );\n }\n\n let extraProps = {};\n if (column.columnProperties) {\n extraProps = column.columnProperties(column) || extraProps;\n }\n\n const baseProps = {\n class: {\n ...headerPinClasses('th', headRenderer?.pinned),\n [`${CSSNAMESPACE}__pin--start`]: column.pinned === 'start',\n [`${CSSNAMESPACE}__pin--end`]: column.pinned === 'end',\n [`${CSSNAMESPACE}__ordered`]: !!column.order,\n [`${CSSNAMESPACE}__filtered`]:\n column.filter !== undefined && column.filter !== null,\n },\n };\n let props = extraProps ? mergeProperties(baseProps, extraProps) : baseProps;\n const content = colheadFootRender(column);\n\n if (!content) return <Fragment></Fragment>;\n\n props =\n Number((props as TableTypes.CellProps).colSpan) > 1\n ? { ...props, scope: 'colgroup' }\n : { ...props, scope: 'col' };\n\n if (isSortable()) {\n const sort = column.order\n ? column.order === 'asc'\n ? 'ascending'\n : 'descending'\n : 'none';\n\n props = { ...props, 'aria-sort': sort };\n }\n\n return (\n <th\n {...props}\n ref={(th) => {\n if (['end', 'start'].includes(column.pinned))\n addHObserver(th, column.pinned, onColumnPinned);\n if (['top', 'bottom'].includes(headRenderer.pinned))\n addVObserver(th, headRenderer.pinned, onColumnPinned);\n }}\n key={column.prop}\n >\n {isSortable() ? (\n <button\n class={{\n [`${CSSNAMESPACE}__order-btn`]: true,\n [`${CSSNAMESPACE}__cell-content`]: true,\n }}\n onClick={handleColumnSortClick}\n >\n {colheadFootRender(column)}\n {column.filter !== undefined && column.filter !== null && (\n <nano-icon name=\"light/filter\" />\n )}\n {!!column.order &&\n (column.order === 'desc' ? (\n <nano-icon name=\"solid/long-arrow-down\" />\n ) : (\n <nano-icon name=\"solid/long-arrow-up\" />\n ))}\n <div class={`${CSSNAMESPACE}__status-icons`}>\n <nano-icon name=\"light/chevron-down\" />\n </div>\n </button>\n ) : (\n <div class={`${CSSNAMESPACE}__cell-content`}>\n {colheadFootRender(column)}\n {column.filter !== undefined && column.filter !== null && (\n <nano-icon name=\"light/bars-filter\" />\n )}\n </div>\n )}\n </th>\n );\n};\n"]}
1
+ {"version":3,"file":"table.header.js","sourceRoot":"","sources":["../../../src/components/table/table.header.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAuB,CAAC,EAAE,MAAM,eAAe,CAAC;AACjE,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EACL,iBAAiB,EACjB,gBAAgB,EAChB,eAAe,GACh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M,CAAC,KAAK,KAAK,MAAM,CAAC,CAAC,CAAC,CACzB,iBAAW,IAAI,EAAC,uBAAuB,GAAG,CAC3C,CAAC,CAAC,CAAC,CACF,iBAAW,IAAI,EAAC,qBAAqB,GAAG,CACzC,CAAC;IACJ,WAAK,KAAK,EAAE,GAAG,YAAY,gBAAgB;MACzC,iBAAW,IAAI,EAAC,oBAAoB,GAAG,CACnC,CACC,CACV,CAAC,CAAC,CAAC,CACF,WAAK,KAAK,EAAE,GAAG,YAAY,gBAAgB;IACxC,iBAAiB,CAAC,MAAM,CAAC;IACzB,MAAM,CAAC,MAAM,KAAK,SAAS,IAAI,MAAM,CAAC,MAAM,KAAK,IAAI,IAAI,CACxD,iBAAW,IAAI,EAAC,mBAAmB,GAAG,CACvC,CACG,CACP,CACE,CACN,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import { Fragment, FunctionalComponent, h } from '@stencil/core';\nimport { CSSNAMESPACE } from './table.constants';\nimport {\n colheadFootRender,\n headerPinClasses,\n mergeProperties,\n} from './table.utils';\nimport type { TableTypes } from '../../interface';\n\n// TABLE HEADERS\n// (thead > tr > th, tfoot > tr > th)\n\ntype TableColHeadProps = {\n column: TableTypes.ColumnConfig;\n headRenderer: TableTypes.HeadFootRenderer;\n onColumnSortClick?: (\n order: TableTypes.Order,\n column: TableTypes.Prop,\n el: HTMLTableCellElement\n ) => void;\n defaults: { sortable?: boolean };\n};\n\nexport const TableColHead: FunctionalComponent<TableColHeadProps> = ({\n column,\n onColumnSortClick,\n defaults,\n}) => {\n // Sort handling\n\n function handleColumnSortClick(e: MouseEvent & { target: HTMLElement }) {\n let order;\n switch (column.order) {\n case 'asc':\n order = 'desc';\n break;\n case 'desc':\n order = null;\n break;\n default:\n order = 'asc';\n }\n onColumnSortClick(order, column.prop, e.target.closest('th'));\n }\n\n function isSortable() {\n return (\n (!!defaults.sortable && column.sortable !== false) ||\n (!defaults.sortable && column.sortable === true)\n );\n }\n\n let extraProps = {};\n if (column.columnProperties) {\n extraProps = column.columnProperties(column) || extraProps;\n }\n\n const baseProps = {\n class: {\n ...headerPinClasses('th', column.pinned),\n [`${CSSNAMESPACE}__pin--start`]: column.pinned === 'start',\n [`${CSSNAMESPACE}__pin--end`]: column.pinned === 'end',\n [`${CSSNAMESPACE}__ordered`]: !!column.order,\n [`${CSSNAMESPACE}__filtered`]:\n column.filter !== undefined && column.filter !== null,\n },\n };\n let props = extraProps ? mergeProperties(baseProps, extraProps) : baseProps;\n const content = colheadFootRender(column);\n\n if (!content) return <Fragment></Fragment>;\n\n props =\n Number((props as TableTypes.CellProps).colSpan) > 1\n ? { ...props, scope: 'colgroup' }\n : { ...props, scope: 'col' };\n\n if (isSortable()) {\n const sort = column.order\n ? column.order === 'asc'\n ? 'ascending'\n : 'descending'\n : 'none';\n\n props = { ...props, 'aria-sort': sort };\n }\n\n return (\n <th {...props} key={column.prop}>\n {isSortable() ? (\n <button\n class={{\n [`${CSSNAMESPACE}__order-btn`]: true,\n [`${CSSNAMESPACE}__cell-content`]: true,\n }}\n onClick={handleColumnSortClick}\n >\n {colheadFootRender(column)}\n {column.filter !== undefined && column.filter !== null && (\n <nano-icon name=\"light/filter\" />\n )}\n {!!column.order &&\n (column.order === 'desc' ? (\n <nano-icon name=\"solid/long-arrow-down\" />\n ) : (\n <nano-icon name=\"solid/long-arrow-up\" />\n ))}\n <div class={`${CSSNAMESPACE}__status-icons`}>\n <nano-icon name=\"light/chevron-down\" />\n </div>\n </button>\n ) : (\n <div class={`${CSSNAMESPACE}__cell-content`}>\n {colheadFootRender(column)}\n {column.filter !== undefined && column.filter !== null && (\n <nano-icon name=\"light/bars-filter\" />\n )}\n </div>\n )}\n </th>\n );\n};\n"]}
@@ -1,7 +1,7 @@
1
1
  /*!
2
2
  * Web Components for Nanopore digital Web Apps
3
3
  */
4
- import { h, Host, readTask, Build, } from '@stencil/core';
4
+ import { h, Host, readTask, } from '@stencil/core';
5
5
  import { cyrb53 } from '../../utils/math';
6
6
  import { debounce } from '../../utils/throttle';
7
7
  import { TableColHead } from './table.header';
@@ -10,9 +10,10 @@ import { TableCell } from './table.cell';
10
10
  import { CSSNAMESPACE } from './table.constants';
11
11
  import { generateStore, storeSearch, storeSetConfig, storeSetData, storeSort, storeFilter, } from './table.store';
12
12
  import { findScrollParent, isInViewport } from './table.utils';
13
+ import { TablePinService } from './table.pin-service';
13
14
  const measurePerf = false;
14
15
  function perMark(name, end = false) {
15
- if (!Build.isDev || Build.isTesting || !performance || !measurePerf)
16
+ if (!performance || !measurePerf)
16
17
  return;
17
18
  if (end) {
18
19
  performance === null || performance === void 0 ? void 0 : performance.mark('end' + name);
@@ -108,11 +109,24 @@ export class Table {
108
109
  * stop loop - it's on the current active block.
109
110
  */
110
111
  this.scrollHandler = () => {
112
+ var _a;
113
+ perMark('scrollHandler');
111
114
  // don't listen if this table isn't in the viewport
112
- if (!this.store.general.state.isActive)
115
+ if (!((_a = this.store) === null || _a === void 0 ? void 0 : _a.general.state.isActive) || !this.rows)
113
116
  return;
117
+ if (this.primaryBlockIndex === undefined)
118
+ this.primaryBlockIndex = 0;
114
119
  readTask(() => {
115
- this.cacheScrollPosition = this.scrollParent.scrollTop || window.scrollY;
120
+ this.cacheScrollPosition =
121
+ typeof this.scrollParent.scrollTop !== 'undefined'
122
+ ? this.scrollParent.scrollTop
123
+ : window.scrollY;
124
+ if (this.tablePinnedService) {
125
+ this.tablePinnedService.onScroll({
126
+ x: this.scrollParent.scrollLeft || window.scrollX,
127
+ y: this.cacheScrollPosition,
128
+ });
129
+ }
116
130
  let cumulativeHeight = this.host.offsetTop;
117
131
  let blockIndex = 0;
118
132
  const blockLen = this.blocks.length;
@@ -123,21 +137,18 @@ export class Table {
123
137
  const potentialBlocks = [
124
138
  blockIndex,
125
139
  blockIndex + 1,
126
- Math.max(0, blockIndex - 1),
140
+ this.cacheScrollPosition,
141
+ cumulativeHeight,
142
+ // Math.max(0, blockIndex - 1),
127
143
  ];
128
144
  if (potentialBlocks.toString() !== this.activeBlocks.toString()) {
129
145
  this.activeBlocks = potentialBlocks;
130
- this.setBlockHeight();
131
146
  }
132
147
  this.primaryBlockIndex = blockIndex;
133
148
  }
134
149
  blockIndex++;
135
150
  }
136
- });
137
- };
138
- this.handleColumnPinned = (positions) => {
139
- Object.entries(positions).forEach(([key, applied]) => {
140
- this.tableEle.classList.toggle(`${CSSNAMESPACE}__pinned--${key}`, applied);
151
+ perMark('scrollHandler', true);
141
152
  });
142
153
  };
143
154
  this.handleResizeChange = (e) => {
@@ -148,12 +159,12 @@ export class Table {
148
159
  classes = [...e.target.className.split(' '), ...classes];
149
160
  this.tableWrapperEle.classList.add(...classes.filter((cl) => !!cl));
150
161
  };
151
- this.jsxRenderer = undefined;
162
+ this.customRenderer = undefined;
152
163
  this.type = 'table';
153
164
  this.caption = undefined;
154
165
  this.showCaption = false;
155
166
  this.loading = undefined;
156
- this.internalLoading = false;
167
+ this.internalLoading = true;
157
168
  this.placeholderSize = 5;
158
169
  this.rows = undefined;
159
170
  this.columns = [];
@@ -161,14 +172,14 @@ export class Table {
161
172
  this.rowRender = undefined;
162
173
  this.footRender = { pinned: 'bottom' };
163
174
  this.showFooter = false;
164
- this.perBlock = 40;
175
+ this.perBlock = 50;
165
176
  this.searchTerm = undefined;
166
177
  this.customFilterFn = undefined;
167
178
  this.customSortFn = undefined;
168
179
  this.defaultSort = true;
169
180
  this.virtualTotalItems = 0;
170
181
  this.blocks = [];
171
- this.activeBlocks = [0, 1, 2];
182
+ this.activeBlocks = [0, 1];
172
183
  this.debounceSetLoading = debounce(this.debounceSetLoading.bind(this), 50);
173
184
  }
174
185
  get _loading() {
@@ -197,6 +208,8 @@ export class Table {
197
208
  if (!this.isReady)
198
209
  requestAnimationFrame(() => this.setInitialBlockDimension());
199
210
  this._loading = false;
211
+ if (this.tablePinnedService)
212
+ this.tablePinnedService.assessRows();
200
213
  });
201
214
  }
202
215
  async handleColsChange() {
@@ -214,6 +227,10 @@ export class Table {
214
227
  virtualTotalItemsChangeHandler() {
215
228
  this.setBlocks();
216
229
  }
230
+ /** @readonly - shows the currently applied filters */
231
+ get appliedFilters() {
232
+ return this.filters;
233
+ }
217
234
  /** Remove any column sorts currently applied
218
235
  * @returns a promise which resolves when complete */
219
236
  async resetSorting() {
@@ -256,8 +273,6 @@ export class Table {
256
273
  }
257
274
  /** Updates a row model at a given index
258
275
  * @param row - the row to update.
259
- * *Note* - this should come from the `col.cellTemplate` or `row.rowRender.template` `rowModel` property
260
- * - rows are augmented with certain properties to aid with efficient rendering
261
276
  * @param rowIndex - the row index to insert this row
262
277
  */
263
278
  async updateRow(row, rowIndex) {
@@ -288,7 +303,9 @@ export class Table {
288
303
  ? document
289
304
  : this._scrollParent).removeEventListener('scroll', this.scrollHandler);
290
305
  }
291
- (ele === document.documentElement ? document : ele).addEventListener('scroll', this.scrollHandler);
306
+ (ele === document.documentElement ? document : ele).addEventListener('scroll', this.scrollHandler
307
+ // {passive: true}
308
+ );
292
309
  this._scrollParent = ele;
293
310
  }
294
311
  // used to fire `nanoTblBlockRendered` on block render change
@@ -391,10 +408,11 @@ export class Table {
391
408
  const res = await this.customFilterFn(this.filters);
392
409
  // if the response is 'true', the custom filter did it's thing
393
410
  // handover to finish and stop loading state.
394
- // if response is falsey, carry on to do a FE filter
411
+ // if response is falsy, carry on to do a FE filter
395
412
  if (res === true) {
396
413
  this.filterComplete();
397
414
  this._loading = false;
415
+ return;
398
416
  }
399
417
  }
400
418
  catch (e) {
@@ -403,8 +421,8 @@ export class Table {
403
421
  console.warn('custom filter failed', e);
404
422
  this.currentFilters = '';
405
423
  this._loading = false;
424
+ return;
406
425
  }
407
- return;
408
426
  }
409
427
  try {
410
428
  await storeFilter(this.host, this.filters);
@@ -420,9 +438,17 @@ export class Table {
420
438
  filterComplete() {
421
439
  this.columns = this.columns.map((c) => {
422
440
  const cFilter = this.filters.find((f) => f.prop === c.prop);
423
- if (cFilter)
441
+ // if we found a filter AND
442
+ // it isn't true / false and has a length OR
443
+ // it is true or false
444
+ if (cFilter &&
445
+ ((typeof cFilter.filter !== 'boolean' && cFilter.filter.length) ||
446
+ typeof cFilter.filter === 'boolean'))
424
447
  c.filter = cFilter.filter;
425
- else if (c.filter !== null && c.filter !== undefined)
448
+ // if a filter value is not set OR
449
+ // it isn't true / false and has no length
450
+ else if ((c.filter !== null && c.filter !== undefined) ||
451
+ (!!c.filter && typeof c.filter !== 'boolean' && !c.filter.length))
426
452
  c.filter = undefined;
427
453
  return c;
428
454
  });
@@ -511,6 +537,8 @@ export class Table {
511
537
  if (!!col) {
512
538
  await this.sortStart(col.order, col.prop);
513
539
  }
540
+ if (this.tablePinnedService)
541
+ this.tablePinnedService.assessCols();
514
542
  }
515
543
  /** Split up all incoming rows into 'blocks' split amongst tbody elements.
516
544
  * These can then be hidden / shown to improve performance.
@@ -557,14 +585,14 @@ export class Table {
557
585
  getBlockHeight(blockIndex) {
558
586
  if (this.blockHeights.length) {
559
587
  const cachedBlockHeight = this.blockHeights.find((bh) => bh.blockIndex === blockIndex);
560
- if (cachedBlockHeight)
588
+ if (cachedBlockHeight && cachedBlockHeight.height)
561
589
  return cachedBlockHeight.height;
562
590
  }
563
591
  const blockLength = this.blocks[blockIndex].rows.length;
564
592
  if (blockLength === this.perBlock && this.measureHeight) {
565
593
  return this.measureHeight;
566
594
  }
567
- return this.unitHeight ? this.unitHeight * blockLength : undefined;
595
+ return this.unitHeight ? this.unitHeight * blockLength : 100;
568
596
  }
569
597
  /** cache the height for all active blocks for later renders */
570
598
  setBlockHeight() {
@@ -617,7 +645,9 @@ export class Table {
617
645
  // setup stores
618
646
  this.store = await generateStore(this.host, this.columns, this.scrollParent, this.isReady);
619
647
  await this.handleRowsChange();
620
- this.store.general.onChange('isActive', this.scrollHandler);
648
+ this.store.general.onChange('isActive', () => {
649
+ this.scrollHandler();
650
+ });
621
651
  this.store.data.onChange('rows', () => this.setBlocks());
622
652
  // setup dom and attach listeners
623
653
  this.processSlots();
@@ -631,6 +661,9 @@ export class Table {
631
661
  }
632
662
  componentDidLoad() {
633
663
  this.setInitialBlockDimension();
664
+ if (!this.tablePinnedService) {
665
+ this.tablePinnedService = new TablePinService(this.tableEle, this.scrollParent);
666
+ }
634
667
  }
635
668
  componentShouldUpdate(_newVal, _oldVal, stateName) {
636
669
  // stop double rendering - we use the store for rendering internally
@@ -638,14 +671,14 @@ export class Table {
638
671
  // but we don't want it to cause renders
639
672
  if (['rows', 'columns'].includes(stateName))
640
673
  return false;
641
- if (Build.isDev && !Build.isTesting && measurePerf)
674
+ if (measurePerf)
642
675
  console.log(stateName, _newVal, _oldVal);
643
676
  }
644
677
  componentWillRender() {
645
678
  perMark('render');
646
679
  }
647
680
  componentDidRender() {
648
- this.setMeasureElement();
681
+ this.setMeasureElement().then(() => this.setBlockHeight());
649
682
  perMark('render', true);
650
683
  }
651
684
  disconnectedCallback() {
@@ -659,17 +692,20 @@ export class Table {
659
692
  }
660
693
  render() {
661
694
  this.blockElements = [];
662
- return (h(Host, null, h("div", { class: `${CSSNAMESPACE}__top-anchor`, ref: (a) => (this.topAnchorEle = a) }, "\u00A0"), h("nano-resize-observe", { states: "576w sm, 768w md", class: "sm md", onNanoResizeStateChange: this.handleResizeChange }), h("div", { class: `${CSSNAMESPACE}__wrap sm md`, ref: (div) => (this.tableWrapperEle = div), "aria-labelledby": 'table-caption-' + this.renderId, tabindex: this.type === 'grid' ? '0' : undefined }, h("nano-progress-bar", { indeterminate: true, class: {
695
+ return (h(Host, null, h("div", { class: `${CSSNAMESPACE}__top-anchor`, ref: (a) => (this.topAnchorEle = a) }, "\u00A0"), h("nano-resize-observe", { states: "576w sm, 768w md", class: "sm md", onNanoResizeStateChange: this.handleResizeChange, onNanoResize: () => {
696
+ if (this.tablePinnedService)
697
+ this.tablePinnedService.onResize();
698
+ } }), h("div", { class: `${CSSNAMESPACE}__wrap sm md`, ref: (div) => (this.tableWrapperEle = div), "aria-labelledby": 'nano-table-caption-' + this.renderId, tabindex: this.type === 'grid' ? '0' : undefined }, h("nano-progress-bar", { indeterminate: true, class: {
663
699
  [`${CSSNAMESPACE}__progress-bar`]: true,
664
700
  [`${CSSNAMESPACE}__progress-bar--show`]: this._loading,
665
- } }), h("table", { role: this.type === 'grid' ? 'grid' : undefined, "aria-rowcount": this.store.data.state.rows.length, "aria-colcount": this.store.config.state.columns.length, class: `${CSSNAMESPACE}`, ref: (tbl) => (this.tableEle = tbl) }, h("caption", { class: {
701
+ } }), h("table", { role: this.type === 'grid' ? 'grid' : undefined, "aria-rowcount": this.store.data.state.rows.length, "aria-colcount": this.store.config.state.columns.length, class: `${CSSNAMESPACE}`, ref: (tbl) => (this.tableEle = tbl), id: 'nano-table-' + this.renderId }, h("caption", { class: {
666
702
  [`${CSSNAMESPACE}__caption`]: true,
667
703
  [`${CSSNAMESPACE}__caption--hide`]: !this.showCaption,
668
- }, id: 'table-caption-' + this.renderId }, h("slot", { name: "caption" }, this.caption)), h("thead", null, h(TableHeadFootRow, { rowRenderer: this.headRender, onColumnPinned: this.handleColumnPinned }, this.store.config.state.columns.map((colModel) => [
669
- h(TableColHead, { column: colModel, headRenderer: this.headRender, onColumnSortClick: this.sortStart, onColumnPinned: this.handleColumnPinned, defaults: {
704
+ }, id: 'nano-table-caption-' + this.renderId }, h("slot", { name: "caption" }, this.caption)), h("thead", null, h(TableHeadFootRow, { rowRenderer: this.headRender }, this.store.config.state.columns.map((colModel) => [
705
+ h(TableColHead, { column: colModel, headRenderer: this.headRender, onColumnSortClick: this.sortStart, defaults: {
670
706
  sortable: this.defaultSort,
671
707
  } }),
672
- ]))), this._loading && !this.blocks.length && (h("tbody", { class: `${CSSNAMESPACE}__active` }, [...Array(10).keys()].map((rowIndex) => (h("tr", null, this.store.config.state.columns.map((_colModel, colIndex) => (h(TableCell, { rowIndex: rowIndex, colIndex: colIndex, nestedContent: () => h("nano-skeleton", null) })))))))), h("tr", { hidden: !!this._loading || !!this.blocks.length }, h("th", { class: `${CSSNAMESPACE}__th`, colSpan: this.store.config.state.columns.length }, h("div", { class: "nano-tbl__cell-content nano-tbl__cell-content--no-result" }, h("slot", { name: "no-results" }, "No results found")))), this.blocks.map((block, blockIndex) => (h("tbody", { key: block.__uuid, id: `tbody-${this.renderId}-${blockIndex}`, ref: (tb) => {
708
+ ]))), this._loading && !this.blocks.length && (h("tbody", { class: `${CSSNAMESPACE}__active ${CSSNAMESPACE}__loading` }, [...Array(10).keys()].map((rowIndex) => (h("tr", null, this.store.config.state.columns.map((_colModel, colIndex) => (h(TableCell, { rowIndex: rowIndex, colIndex: colIndex, nestedContent: () => h("nano-skeleton", null) })))))))), h("tr", { hidden: !!this._loading || !!this.blocks.length }, h("th", { class: `${CSSNAMESPACE}__th`, colSpan: this.store.config.state.columns.length }, h("div", { class: "nano-tbl__cell-content nano-tbl__cell-content--no-result" }, h("slot", { name: "no-results" }, "No results found")))), this.blocks.map((block, blockIndex) => (h("tbody", { key: block.__uuid, id: `tbody-${this.renderId}-${blockIndex}`, ref: (tb) => {
673
709
  this.blockElements.push(tb);
674
710
  }, class: {
675
711
  [`${CSSNAMESPACE}__inactive`]: !this.activeBlocks.includes(blockIndex),
@@ -677,10 +713,10 @@ export class Table {
677
713
  } }, this.activeBlocks.includes(blockIndex) ? (block.rows.map((row, i) => {
678
714
  const rowIndex = blockIndex > 0 ? blockIndex * this.perBlock + i : i;
679
715
  return (h(TableRow, { rowRenderer: this.rowRender, rowModel: row, rowIndex: rowIndex }, this.store.config.state.columns.map((_colModel, colIndex) => (h(TableCell, { rowIndex: rowIndex, colIndex: colIndex })))));
680
- })) : (h("tr", null, h("td", { colSpan: this.store.config.state.columns.length, style: {
716
+ })) : (h("tr", { class: `${CSSNAMESPACE}__tr--placeholder` }, h("td", { colSpan: this.store.config.state.columns.length, style: {
681
717
  height: this.getBlockHeight(blockIndex) + 'px',
682
- } })))))), this.showFooter && (h("tfoot", null, h(TableHeadFootRow, { rowRenderer: this.footRender, onColumnPinned: this.handleColumnPinned }, this.store.config.state.columns.map((colModel) => [
683
- h(TableColHead, { column: colModel, headRenderer: this.footRender, onColumnPinned: this.handleColumnPinned, onColumnSortClick: this.sortStart, defaults: {
718
+ } })))))), this.showFooter && (h("tfoot", null, h(TableHeadFootRow, { rowRenderer: this.footRender }, this.store.config.state.columns.map((colModel) => [
719
+ h(TableColHead, { column: colModel, headRenderer: this.footRender, onColumnSortClick: this.sortStart, defaults: {
684
720
  sortable: this.defaultSort,
685
721
  } }),
686
722
  ]))))), !!this.blocks.length && (h("nano-spinner", { type: "circle", class: {
@@ -701,16 +737,15 @@ export class Table {
701
737
  }
702
738
  static get properties() {
703
739
  return {
704
- "jsxRenderer": {
740
+ "customRenderer": {
705
741
  "type": "unknown",
706
742
  "mutable": false,
707
743
  "complexType": {
708
- "original": "TableTypes.HFunc<any>",
709
- "resolved": "HFunc<any>",
744
+ "original": "(node: any, cell: HTMLElement) => void",
745
+ "resolved": "(node: any, cell: HTMLElement) => void",
710
746
  "references": {
711
- "TableTypes": {
712
- "location": "import",
713
- "path": "../../interface"
747
+ "HTMLElement": {
748
+ "location": "global"
714
749
  }
715
750
  }
716
751
  },
@@ -718,7 +753,7 @@ export class Table {
718
753
  "optional": false,
719
754
  "docs": {
720
755
  "tags": [],
721
- "text": ""
756
+ "text": "Function called whenever `col.cellTemplate` renders an unknown object.\nThe function should render a valid HTMLElement to the cell arg.\nExample usage - render JSX from a 3rd party lib and append the result to the cell element."
722
757
  },
723
758
  "getter": false,
724
759
  "setter": false
@@ -794,7 +829,7 @@ export class Table {
794
829
  "optional": false,
795
830
  "docs": {
796
831
  "tags": [],
797
- "text": "Will show a loading state when set to true.\nBy default, will be shown automatically if `rows` is a promise waiting to resolve\nor when performing custom filtering or sorting.\n*Note* when set manually, will overwrite any internal loading state.\nSet to 'undefined' to revert to default behaviour."
832
+ "text": "Will show a loading state when set to true.\nBy default, will be shown automatically if `rows` is a promise waiting to resolve / or falsy\n*or* when performing custom filtering or sorting.\n*Note* when set manually, will overwrite any internal loading state.\nSet to 'undefined' to revert to default behaviour."
798
833
  },
799
834
  "getter": false,
800
835
  "setter": false,
@@ -976,7 +1011,7 @@ export class Table {
976
1011
  "setter": false,
977
1012
  "attribute": "per-block",
978
1013
  "reflect": false,
979
- "defaultValue": "40"
1014
+ "defaultValue": "50"
980
1015
  },
981
1016
  "blocksLength": {
982
1017
  "type": "number",
@@ -1036,7 +1071,7 @@ export class Table {
1036
1071
  "optional": true,
1037
1072
  "docs": {
1038
1073
  "tags": [],
1039
- "text": "A custom filtering function. Should return a promise.\nIf the promise resolves as `true` the column UI will be updated.\nIf the promise resolves as falsey, the sort will be performed by the component.\nA good use-case would be performing the filter on a server / via fetch.\nThen on success, updating the table's data via the `rows` property"
1074
+ "text": "A custom filtering function. Should return a promise.\nIf the promise resolves as `true` the column UI will be updated.\nIf the promise resolves as falsy, the sort will be performed by the component.\nA good use-case would be performing the filter on a server / via fetch.\nThen on success, updating the table's data via the `rows` property"
1040
1075
  },
1041
1076
  "getter": false,
1042
1077
  "setter": false
@@ -1105,6 +1140,27 @@ export class Table {
1105
1140
  "attribute": "virtual-total-items",
1106
1141
  "reflect": false,
1107
1142
  "defaultValue": "0"
1143
+ },
1144
+ "appliedFilters": {
1145
+ "type": "unknown",
1146
+ "mutable": false,
1147
+ "complexType": {
1148
+ "original": "Filter[]",
1149
+ "resolved": "Filter[]",
1150
+ "references": {}
1151
+ },
1152
+ "required": false,
1153
+ "optional": false,
1154
+ "docs": {
1155
+ "tags": [{
1156
+ "name": "readonly",
1157
+ "text": "- shows the currently applied filters"
1158
+ }],
1159
+ "text": ""
1160
+ },
1161
+ "getter": true,
1162
+ "setter": false,
1163
+ "defaultValue": "[]"
1108
1164
  }
1109
1165
  };
1110
1166
  }
@@ -1425,9 +1481,9 @@ export class Table {
1425
1481
  "parameters": [{
1426
1482
  "tags": [{
1427
1483
  "name": "param",
1428
- "text": "row - the row to update.\n*Note* - this should come from the `col.cellTemplate` or `row.rowRender.template` `rowModel` property\n- rows are augmented with certain properties to aid with efficient rendering"
1484
+ "text": "row - the row to update."
1429
1485
  }],
1430
- "text": "- the row to update.\n*Note* - this should come from the `col.cellTemplate` or `row.rowRender.template` `rowModel` property\n- rows are augmented with certain properties to aid with efficient rendering"
1486
+ "text": "- the row to update."
1431
1487
  }, {
1432
1488
  "tags": [{
1433
1489
  "name": "param",
@@ -1450,7 +1506,7 @@ export class Table {
1450
1506
  "text": "Updates a row model at a given index",
1451
1507
  "tags": [{
1452
1508
  "name": "param",
1453
- "text": "row - the row to update.\n*Note* - this should come from the `col.cellTemplate` or `row.rowRender.template` `rowModel` property\n- rows are augmented with certain properties to aid with efficient rendering"
1509
+ "text": "row - the row to update."
1454
1510
  }, {
1455
1511
  "name": "param",
1456
1512
  "text": "rowIndex - the row index to insert this row"