@nanoporetech-digital/components 5.1.3 → 5.2.1

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 (188) hide show
  1. package/CHANGELOG.md +26 -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 +1 -1
  10. package/dist/cjs/nano-components.cjs.js +1 -1
  11. package/dist/cjs/nano-datalist_3.cjs.entry.js +1 -1
  12. package/dist/cjs/nano-dialog.cjs.entry.js +2 -2
  13. package/dist/cjs/nano-global-nav-user-profile_3.cjs.entry.js +2 -2
  14. package/dist/cjs/nano-global-nav-user-profile_3.cjs.entry.js.map +1 -1
  15. package/dist/cjs/nano-global-nav.cjs.entry.js +2 -2
  16. package/dist/cjs/nano-input.cjs.entry.js +1 -1
  17. package/dist/cjs/nano-overflow-nav.cjs.entry.js +1 -1
  18. package/dist/cjs/nano-range.cjs.entry.js +1 -1
  19. package/dist/cjs/nano-resize-observe_2.cjs.entry.js +3 -1
  20. package/dist/cjs/nano-resize-observe_2.cjs.entry.js.map +1 -1
  21. package/dist/cjs/nano-sortable.cjs.entry.js +16 -8
  22. package/dist/cjs/nano-sortable.cjs.entry.js.map +1 -1
  23. package/dist/cjs/nano-split-pane.cjs.entry.js +1 -1
  24. package/dist/cjs/nano-sticker.cjs.entry.js +4 -2
  25. package/dist/cjs/nano-sticker.cjs.entry.js.map +1 -1
  26. package/dist/cjs/nano-tab-group.cjs.entry.js +2 -2
  27. package/dist/cjs/{nano-table-5a7a4d53.js → nano-table-10a40ab3.js} +557 -185
  28. package/dist/cjs/nano-table-10a40ab3.js.map +1 -0
  29. package/dist/cjs/nano-table.cjs.entry.js +2 -2
  30. package/dist/cjs/{table.worker-77e56070.js → table.worker-f04588c1.js} +4 -4
  31. package/dist/cjs/table.worker-f04588c1.js.map +1 -0
  32. package/dist/cjs/{table.worker-bd51e29f.js → table.worker-f258383d.js} +1 -1
  33. package/dist/cjs/{throttle-f55496c8.js → throttle-dfa64b9e.js} +17 -20
  34. package/dist/cjs/throttle-dfa64b9e.js.map +1 -0
  35. package/dist/collection/components/resize-observe/resize-observe.js +21 -1
  36. package/dist/collection/components/resize-observe/resize-observe.js.map +1 -1
  37. package/dist/collection/components/select/select.css +0 -1
  38. package/dist/collection/components/sortable/sortable.js +3 -7
  39. package/dist/collection/components/sortable/sortable.js.map +1 -1
  40. package/dist/collection/components/sticker/sticker.js +11 -5
  41. package/dist/collection/components/sticker/sticker.js.map +1 -1
  42. package/dist/collection/components/table/table-interface.js.map +1 -1
  43. package/dist/collection/components/table/table.cell.js +43 -10
  44. package/dist/collection/components/table/table.cell.js.map +1 -1
  45. package/dist/collection/components/table/table.css +38 -55
  46. package/dist/collection/components/table/table.header.js +4 -9
  47. package/dist/collection/components/table/table.header.js.map +1 -1
  48. package/dist/collection/components/table/table.js +101 -47
  49. package/dist/collection/components/table/table.js.map +1 -1
  50. package/dist/collection/components/table/table.pin-service.js +382 -0
  51. package/dist/collection/components/table/table.pin-service.js.map +1 -0
  52. package/dist/collection/components/table/table.row.js +39 -46
  53. package/dist/collection/components/table/table.row.js.map +1 -1
  54. package/dist/collection/components/table/table.utils.js +0 -124
  55. package/dist/collection/components/table/table.utils.js.map +1 -1
  56. package/dist/collection/components/table/table.worker.js +1 -0
  57. package/dist/collection/components/table/table.worker.js.map +1 -1
  58. package/dist/collection/utils/events.js +27 -0
  59. package/dist/collection/utils/events.js.map +1 -0
  60. package/dist/collection/utils/throttle.js +16 -19
  61. package/dist/collection/utils/throttle.js.map +1 -1
  62. package/dist/components/nano-sortable.js +15 -7
  63. package/dist/components/nano-sortable.js.map +1 -1
  64. package/dist/components/resize-observe.js +3 -1
  65. package/dist/components/resize-observe.js.map +1 -1
  66. package/dist/components/select.js +1 -1
  67. package/dist/components/select.js.map +1 -1
  68. package/dist/components/sticker.js +3 -1
  69. package/dist/components/sticker.js.map +1 -1
  70. package/dist/components/table.js +530 -187
  71. package/dist/components/table.js.map +1 -1
  72. package/dist/components/table.worker.js +1 -1
  73. package/dist/components/throttle.js +16 -19
  74. package/dist/components/throttle.js.map +1 -1
  75. package/dist/esm/{component-store-244a8431.js → component-store-c23ebc9c.js} +2 -2
  76. package/dist/esm/{component-store-244a8431.js.map → component-store-c23ebc9c.js.map} +1 -1
  77. package/dist/esm/index.js +1 -1
  78. package/dist/esm/loader.js +1 -1
  79. package/dist/esm/nano-algolia-filter.entry.js +2 -2
  80. package/dist/esm/nano-algolia-input.entry.js +2 -2
  81. package/dist/esm/nano-algolia.entry.js +2 -2
  82. package/dist/esm/nano-checkbox-group.entry.js +1 -1
  83. package/dist/esm/nano-components.js +1 -1
  84. package/dist/esm/nano-datalist_3.entry.js +1 -1
  85. package/dist/esm/nano-dialog.entry.js +2 -2
  86. package/dist/esm/nano-global-nav-user-profile_3.entry.js +2 -2
  87. package/dist/esm/nano-global-nav-user-profile_3.entry.js.map +1 -1
  88. package/dist/esm/nano-global-nav.entry.js +2 -2
  89. package/dist/esm/nano-input.entry.js +1 -1
  90. package/dist/esm/nano-overflow-nav.entry.js +1 -1
  91. package/dist/esm/nano-range.entry.js +1 -1
  92. package/dist/esm/nano-resize-observe_2.entry.js +3 -1
  93. package/dist/esm/nano-resize-observe_2.entry.js.map +1 -1
  94. package/dist/esm/nano-sortable.entry.js +16 -8
  95. package/dist/esm/nano-sortable.entry.js.map +1 -1
  96. package/dist/esm/nano-split-pane.entry.js +1 -1
  97. package/dist/esm/nano-sticker.entry.js +4 -2
  98. package/dist/esm/nano-sticker.entry.js.map +1 -1
  99. package/dist/esm/nano-tab-group.entry.js +2 -2
  100. package/dist/esm/{nano-table-026a0d30.js → nano-table-2bbcaa8d.js} +558 -186
  101. package/dist/esm/nano-table-2bbcaa8d.js.map +1 -0
  102. package/dist/esm/nano-table.entry.js +2 -2
  103. package/dist/esm/{table.worker-c17a27ed.js → table.worker-7324ad73.js} +4 -4
  104. package/dist/esm/table.worker-7324ad73.js.map +1 -0
  105. package/dist/esm/{table.worker-bd51e29f.js → table.worker-f258383d.js} +1 -1
  106. package/dist/esm/{throttle-7836544e.js → throttle-ac4fcefa.js} +17 -20
  107. package/dist/esm/throttle-ac4fcefa.js.map +1 -0
  108. package/dist/nano-components/index.esm.js +1 -1
  109. package/dist/nano-components/nano-components.esm.js +1 -1
  110. package/dist/nano-components/nano-components.esm.js.map +1 -1
  111. package/dist/nano-components/{p-7d6065c6.entry.js → p-0697795a.entry.js} +2 -2
  112. package/dist/nano-components/p-0697795a.entry.js.map +1 -0
  113. package/dist/nano-components/{p-6975f110.entry.js → p-192902e0.entry.js} +2 -2
  114. package/dist/nano-components/{p-a6ff5ca6.js → p-1a0b5bc3.js} +2 -2
  115. package/dist/nano-components/{p-3a761d77.entry.js → p-1b791810.entry.js} +2 -2
  116. package/dist/nano-components/p-39aec880.entry.js +5 -0
  117. package/dist/nano-components/{p-3b4b7f40.entry.js → p-3eb6d833.entry.js} +2 -2
  118. package/dist/nano-components/{p-a1c0afb6.entry.js → p-4884b65a.entry.js} +2 -2
  119. package/dist/nano-components/p-52ae36ec.js +5 -0
  120. package/dist/nano-components/{p-34501eae.entry.js → p-565793a2.entry.js} +2 -2
  121. package/dist/nano-components/p-5aae2588.entry.js +5 -0
  122. package/dist/nano-components/p-5aae2588.entry.js.map +1 -0
  123. package/dist/nano-components/{p-935aef3d.entry.js → p-6920ad69.entry.js} +2 -2
  124. package/dist/nano-components/{p-1c6c94cb.entry.js → p-7baa9e14.entry.js} +2 -2
  125. package/dist/nano-components/p-7bff5224.js +5 -0
  126. package/dist/nano-components/p-7bff5224.js.map +1 -0
  127. package/dist/nano-components/{p-f60fe933.entry.js → p-898cbac7.entry.js} +2 -2
  128. package/dist/nano-components/p-9b533dc3.js +5 -0
  129. package/dist/nano-components/p-9b533dc3.js.map +1 -0
  130. package/dist/nano-components/{p-ace1ffc2.entry.js → p-a362bd23.entry.js} +2 -2
  131. package/dist/nano-components/{p-eb6c9191.entry.js → p-b72df1aa.entry.js} +2 -2
  132. package/dist/nano-components/{p-9c4efe14.entry.js → p-bf18e298.entry.js} +2 -2
  133. package/dist/nano-components/p-bf18e298.entry.js.map +1 -0
  134. package/dist/nano-components/p-ce5efc3f.entry.js +5 -0
  135. package/dist/nano-components/p-ce5efc3f.entry.js.map +1 -0
  136. package/dist/nano-components/{p-1b687f96.entry.js → p-d0eefd52.entry.js} +2 -2
  137. package/dist/nano-components/{p-1a9d9956.entry.js → p-d74e2642.entry.js} +2 -2
  138. package/dist/nano-components/{p-bd51e29f.js → p-f258383d.js} +1 -1
  139. package/dist/types/components/resize-observe/resize-observe.d.ts +2 -0
  140. package/dist/types/components/sortable/sortable.d.ts +0 -1
  141. package/dist/types/components/sticker/sticker.d.ts +2 -2
  142. package/dist/types/components/table/table-interface.d.ts +23 -11
  143. package/dist/types/components/table/table.cell.d.ts +0 -7
  144. package/dist/types/components/table/table.d.ts +10 -8
  145. package/dist/types/components/table/table.header.d.ts +0 -1
  146. package/dist/types/components/table/table.pin-service.d.ts +90 -0
  147. package/dist/types/components/table/table.row.d.ts +3 -2
  148. package/dist/types/components/table/table.utils.d.ts +0 -27
  149. package/dist/types/components.d.ts +29 -11
  150. package/dist/types/utils/events.d.ts +15 -0
  151. package/dist/types/utils/throttle.d.ts +1 -1
  152. package/docs-json.json +59 -24
  153. package/docs-vscode.json +2 -2
  154. package/hydrate/index.js +580 -194
  155. package/package.json +2 -2
  156. package/dist/cjs/nano-table-5a7a4d53.js.map +0 -1
  157. package/dist/cjs/table.worker-77e56070.js.map +0 -1
  158. package/dist/cjs/throttle-f55496c8.js.map +0 -1
  159. package/dist/esm/nano-table-026a0d30.js.map +0 -1
  160. package/dist/esm/table.worker-c17a27ed.js.map +0 -1
  161. package/dist/esm/throttle-7836544e.js.map +0 -1
  162. package/dist/nano-components/p-15217442.entry.js +0 -5
  163. package/dist/nano-components/p-15217442.entry.js.map +0 -1
  164. package/dist/nano-components/p-2e63676f.js +0 -5
  165. package/dist/nano-components/p-30cc21c2.entry.js +0 -5
  166. package/dist/nano-components/p-59eb9caa.js +0 -5
  167. package/dist/nano-components/p-59eb9caa.js.map +0 -1
  168. package/dist/nano-components/p-7759d185.entry.js +0 -5
  169. package/dist/nano-components/p-7759d185.entry.js.map +0 -1
  170. package/dist/nano-components/p-7d6065c6.entry.js.map +0 -1
  171. package/dist/nano-components/p-9746b0a5.js +0 -5
  172. package/dist/nano-components/p-9746b0a5.js.map +0 -1
  173. package/dist/nano-components/p-9c4efe14.entry.js.map +0 -1
  174. /package/dist/nano-components/{p-6975f110.entry.js.map → p-192902e0.entry.js.map} +0 -0
  175. /package/dist/nano-components/{p-a6ff5ca6.js.map → p-1a0b5bc3.js.map} +0 -0
  176. /package/dist/nano-components/{p-3a761d77.entry.js.map → p-1b791810.entry.js.map} +0 -0
  177. /package/dist/nano-components/{p-2e63676f.js.map → p-39aec880.entry.js.map} +0 -0
  178. /package/dist/nano-components/{p-3b4b7f40.entry.js.map → p-3eb6d833.entry.js.map} +0 -0
  179. /package/dist/nano-components/{p-a1c0afb6.entry.js.map → p-4884b65a.entry.js.map} +0 -0
  180. /package/dist/nano-components/{p-30cc21c2.entry.js.map → p-52ae36ec.js.map} +0 -0
  181. /package/dist/nano-components/{p-34501eae.entry.js.map → p-565793a2.entry.js.map} +0 -0
  182. /package/dist/nano-components/{p-935aef3d.entry.js.map → p-6920ad69.entry.js.map} +0 -0
  183. /package/dist/nano-components/{p-1c6c94cb.entry.js.map → p-7baa9e14.entry.js.map} +0 -0
  184. /package/dist/nano-components/{p-f60fe933.entry.js.map → p-898cbac7.entry.js.map} +0 -0
  185. /package/dist/nano-components/{p-ace1ffc2.entry.js.map → p-a362bd23.entry.js.map} +0 -0
  186. /package/dist/nano-components/{p-eb6c9191.entry.js.map → p-b72df1aa.entry.js.map} +0 -0
  187. /package/dist/nano-components/{p-1b687f96.entry.js.map → p-d0eefd52.entry.js.map} +0 -0
  188. /package/dist/nano-components/{p-1a9d9956.entry.js.map → p-d74e2642.entry.js.map} +0 -0
@@ -0,0 +1,90 @@
1
+ /**
2
+ * Manages the complex business of table 'pinning'; sticking columns and rows to the scrolling parent element.
3
+ *
4
+ * *knowing* when an element is pinned is tricky.
5
+ * Managing the display of multiple, side-by-side pinned elements is trickier still.
6
+ *
7
+ * Pinning table columns are very different from pinning table rows:
8
+ * - Rows are actual elements we can select, measure and apply styles to.
9
+ * - Columns are disparate collections of elements that are much harder to select, measure and apply styles to.
10
+ *
11
+ * With this in mind, how columns and rows are pinned is different:
12
+ * Rows can have changes applied directly, Columns have changes applied via dynamic stylesheets.
13
+ *
14
+ * The service is slightly opinionated on how it pins rows and columns (with some room for override):
15
+ * - Pinned columns are stuck consecutively, without overlapping.
16
+ * e.g. If column 'name' and 'surname' are both `pin: 'start'`; 'surname' will display **next** to name.
17
+ * Both columns are important for context
18
+ *
19
+ * - Pinned rows are set to overlap *when* they have the same ancestor,
20
+ * and stuck consecutively when they have a different ancestor.
21
+ * e.g. `tbody > tr.pin ~ tr.pin` the second row will **overlap** the first; it's unlikely both rows will be important for context.
22
+ * `thead > tr.pin`, `tbody > tr.pin`. Both rows are required for context so will require next to each other.
23
+ *
24
+ * Devs can override this behaviour by setting `--pin-start`, `--pin-end`, `--pin-top`, `--pin-bottom` custom vars.
25
+ */
26
+ export declare class TablePinService {
27
+ private cachedColMeta;
28
+ private tableId;
29
+ private tableEle;
30
+ private scrollElement;
31
+ private startColumns;
32
+ private endColumns;
33
+ private topRows;
34
+ private bottomRows;
35
+ private tableDims;
36
+ constructor(table: HTMLTableElement, scrollElement: HTMLElement);
37
+ private get pinnedStart();
38
+ private set pinnedStart(value);
39
+ private _pinnedStart;
40
+ /**
41
+ * Called when columns are either pinned or unpinned.
42
+ * Attaches a tiny stylesheet to target the 'last' start column.
43
+ * (e.g. We only want to apply drop shadow on last pinned start column - not all pinned columns)
44
+ */
45
+ private handlePinnedStartChange;
46
+ private get pinnedEnd();
47
+ private set pinnedEnd(value);
48
+ private _pinnedEnd;
49
+ /**
50
+ * Called when columns are either pinned or unpinned.
51
+ * Attaches a tiny stylesheet to target the 'first' end column.
52
+ * (e.g. We only want to apply drop shadow on first pinned end column - not all pinned columns)
53
+ */
54
+ private handlePinnedEndChange;
55
+ private get cssColDimensionCacheKey();
56
+ private set cssColDimensionCacheKey(value);
57
+ private _cssColDimensionCacheKey;
58
+ /**
59
+ * To only generate column dimension styles when necessary we
60
+ * maintain a cache key string via serialised column meta.
61
+ * Only when this key changes do we generate a new stylesheet
62
+ */
63
+ private generateCssCacheKey;
64
+ /**
65
+ * Generates pinned column width offset styles
66
+ * so pinned columns can appear stuck together,
67
+ * then attaches a stylesheet.
68
+ */
69
+ private createPinnedColDimensionStyles;
70
+ private getParentOffsets;
71
+ /**
72
+ * Loops through all 'top' & 'bottom' rows (on scroll or resize)
73
+ * Manages their visual state by applying classes on stuck / unstuck
74
+ * And their pinned offset / distance
75
+ */
76
+ assessRows(): void;
77
+ /**
78
+ * Loops through all 'start' & 'end' columns (on scroll or resize)
79
+ * Caches meta about each column (e.g. size, position-index)
80
+ * and decides which columns are pinned
81
+ */
82
+ assessCols(): Promise<void>;
83
+ private cacheX;
84
+ private cacheY;
85
+ onScroll(pos: {
86
+ x: number;
87
+ y: number;
88
+ }): void;
89
+ onResize(): void;
90
+ }
@@ -4,12 +4,13 @@ type TableRowProps = {
4
4
  rowRenderer: TableTypes.RowRenderer;
5
5
  rowIndex: number;
6
6
  rowModel: TableTypes.RowData;
7
- onColumnPinned?: TableTypes.PinnedCb;
7
+ onRowPinned?: TableTypes.PinnedCb;
8
8
  };
9
9
  export declare const TableRow: FunctionalComponent<TableRowProps>;
10
10
  type TableHeadFootProps = {
11
11
  rowRenderer: TableTypes.HeadFootRenderer;
12
- onColumnPinned?: TableTypes.PinnedCb;
12
+ onRowPinned?: TableTypes.PinnedCb;
13
+ onColPinned?: TableTypes.PinnedCb;
13
14
  };
14
15
  export declare const TableHeadFootRow: FunctionalComponent<TableHeadFootProps>;
15
16
  export {};
@@ -41,20 +41,6 @@ export declare function mergeCellProperties(rowIndex: number, colIndex: number,
41
41
  * @returns - a JSX node
42
42
  */
43
43
  export declare function colheadFootRender(col: TableTypes.ColumnConfig): VNode;
44
- /**
45
- * Adds element to Intersection Observer. Fires when element changes on the x axis
46
- * @param el - an element to observe
47
- * @param pos - the edge to watch (start or end)
48
- * @param cb - callback when an intersection state changes.
49
- */
50
- export declare function addHObserver(el: HTMLTableCellElement, pos: TableTypes.Position, cb: TableTypes.PinnedCb): void;
51
- /**
52
- * Adds element to Intersection Observer. Fires when element changes on the y axis
53
- * @param el - an element to observe
54
- * @param pos - the edge to watch (start or end)
55
- * @param cb - callback when an intersection state changes.
56
- */
57
- export declare function addVObserver(el: HTMLTableCellElement, pos: TableTypes.Position, cb: TableTypes.PinnedCb): void;
58
44
  /**
59
45
  * Renders a class string or map for pinned classes on the v axis.
60
46
  * @param type - element tagName
@@ -74,11 +60,6 @@ export declare function headerPinClasses(type: ValidRenderTypes, vPinned?: Table
74
60
  export declare function classListToStr(classes: {
75
61
  [key: string]: boolean;
76
62
  }): string;
77
- /**
78
- * Detects the current scroll speed as a number.
79
- * Use within a scroll listener
80
- */
81
- export declare const detectScrollSpeed: () => number;
82
63
  /**
83
64
  * Attempts to find the closes scrolling parental element
84
65
  * @param element - the element from which to traverse up the DOM
@@ -92,12 +73,4 @@ export declare function findScrollParent(element: HTMLElement): HTMLElement;
92
73
  * @returns true if the element's area percentage is visible
93
74
  */
94
75
  export declare function isInViewport(el: Element, percentVisible?: number): boolean;
95
- /**
96
- * Immutable array re-order
97
- * @param from - the index to move from
98
- * @param to - the index to move to
99
- * @param arr - the array to re-order
100
- * @returns - a new, re-orderd array
101
- */
102
- export declare function arrMove(from: number, to: number, arr: any[]): any[];
103
76
  export {};
@@ -2294,9 +2294,9 @@ export namespace Components {
2294
2294
  "scrollParent"?: HTMLElement | Document;
2295
2295
  "setTriggerPos": (offset: number | { v: number; h: number; }) => Promise<number | { v: number; h: number; }>;
2296
2296
  /**
2297
- * Upon being stuck, attach the sticker to another sticker element. A JS query selector that returns a <nano-sticker>
2297
+ * Upon being stuck, attach the sticker to another sticker element. JS query selector string or DOM element pointing to a `<nano-sticker>`
2298
2298
  */
2299
- "stickTo": string;
2299
+ "stickTo": string | HTMLNanoStickerElement;
2300
2300
  }
2301
2301
  interface NanoTab {
2302
2302
  /**
@@ -2393,6 +2393,10 @@ export namespace Components {
2393
2393
  * @returns a promise which resolves when complete
2394
2394
  */
2395
2395
  "addSort": (column: TableTypes.Prop, order: TableTypes.Order) => Promise<void>;
2396
+ /**
2397
+ * @readonly - shows the currently applied filters
2398
+ */
2399
+ "appliedFilters": Filter[];
2396
2400
  /**
2397
2401
  * The number of total blocks currently rendered in the table. @readonly
2398
2402
  */
@@ -2406,11 +2410,15 @@ export namespace Components {
2406
2410
  */
2407
2411
  "columns": TableTypes.NanoTable<any>['columns'];
2408
2412
  /**
2409
- * A custom filtering function. Should return a promise. If the promise resolves as `true` the column UI will be updated. If the promise resolves as falsey, the sort will be performed by the component. A good use-case would be performing the filter on a server / via fetch. Then on success, updating the table's data via the `rows` property
2413
+ * A custom filtering function. Should return a promise. If the promise resolves as `true` the column UI will be updated. If the promise resolves as falsy, the sort will be performed by the component. A good use-case would be performing the filter on a server / via fetch. Then on success, updating the table's data via the `rows` property
2410
2414
  */
2411
2415
  "customFilterFn"?: (
2412
2416
  filters: TableTypes.Filter[]
2413
2417
  ) => Promise<true | TableTypes.Falsy>;
2418
+ /**
2419
+ * Function called whenever `col.cellTemplate` renders an unknown object. The function should render a valid HTMLElement to the cell arg. Example usage - render JSX from a 3rd party lib and append the result to the cell element.
2420
+ */
2421
+ "customRenderer": (node: any, cell: HTMLElement) => void;
2414
2422
  /**
2415
2423
  * A custom sorting function. Should return a promise. If the promise resolves as `true` the column UI will be updated. If the promise resolves as falsey, the sort will be performed by the component. A good use-case would be performing the sort on a server / via fetch. Then on success, updating the table's data via the `rows` property
2416
2424
  */
@@ -2430,9 +2438,8 @@ export namespace Components {
2430
2438
  * Used for custom thead row rendering
2431
2439
  */
2432
2440
  "headRender": TableTypes.HeadFootRenderer;
2433
- "jsxRenderer": TableTypes.HFunc<any>;
2434
2441
  /**
2435
- * Will show a loading state when set to true. By default, will be shown automatically if `rows` is a promise waiting to resolve or when performing custom filtering or sorting. *Note* when set manually, will overwrite any internal loading state. Set to 'undefined' to revert to default behaviour.
2442
+ * Will show a loading state when set to true. By default, will be shown automatically if `rows` is a promise waiting to resolve / or falsy *or* when performing custom filtering or sorting. *Note* when set manually, will overwrite any internal loading state. Set to 'undefined' to revert to default behaviour.
2436
2443
  */
2437
2444
  "loading": boolean;
2438
2445
  /**
@@ -2486,7 +2493,7 @@ export namespace Components {
2486
2493
  "type": 'grid' | 'table';
2487
2494
  /**
2488
2495
  * Updates a row model at a given index
2489
- * @param row - the row to update. *Note* - this should come from the `col.cellTemplate` or `row.rowRender.template` `rowModel` property - rows are augmented with certain properties to aid with efficient rendering
2496
+ * @param row - the row to update.
2490
2497
  * @param rowIndex - the row index to insert this row
2491
2498
  */
2492
2499
  "updateRow": (row: TableTypes.RowData, rowIndex: number) => Promise<void>;
@@ -5198,6 +5205,10 @@ declare namespace LocalJSX {
5198
5205
  * Fire `nanoResizeContentFitChange` events notifying whether content currently fits or does not on the x, y or both axis'. Also makes the `content-fit-...` slots available
5199
5206
  */
5200
5207
  "notifyContentFit"?: 'x' | 'y' | 'xy';
5208
+ /**
5209
+ * Fires after any resizing
5210
+ */
5211
+ "onNanoResize"?: (event: NanoResizeObserveCustomEvent<ResizeObserverEntry[]>) => void;
5201
5212
  /**
5202
5213
  * Fires when the content either begins or stops fitting. Will only work when `notifyContentFit` is set.
5203
5214
  */
@@ -5679,9 +5690,9 @@ declare namespace LocalJSX {
5679
5690
  */
5680
5691
  "scrollParent"?: HTMLElement | Document;
5681
5692
  /**
5682
- * Upon being stuck, attach the sticker to another sticker element. A JS query selector that returns a <nano-sticker>
5693
+ * Upon being stuck, attach the sticker to another sticker element. JS query selector string or DOM element pointing to a `<nano-sticker>`
5683
5694
  */
5684
- "stickTo"?: string;
5695
+ "stickTo"?: string | HTMLNanoStickerElement;
5685
5696
  }
5686
5697
  interface NanoTab {
5687
5698
  /**
@@ -5774,6 +5785,10 @@ declare namespace LocalJSX {
5774
5785
  * - Add custom properties at every level
5775
5786
  */
5776
5787
  interface NanoTable {
5788
+ /**
5789
+ * @readonly - shows the currently applied filters
5790
+ */
5791
+ "appliedFilters"?: Filter[];
5777
5792
  /**
5778
5793
  * The number of total blocks currently rendered in the table. @readonly
5779
5794
  */
@@ -5787,11 +5802,15 @@ declare namespace LocalJSX {
5787
5802
  */
5788
5803
  "columns"?: TableTypes.NanoTable<any>['columns'];
5789
5804
  /**
5790
- * A custom filtering function. Should return a promise. If the promise resolves as `true` the column UI will be updated. If the promise resolves as falsey, the sort will be performed by the component. A good use-case would be performing the filter on a server / via fetch. Then on success, updating the table's data via the `rows` property
5805
+ * A custom filtering function. Should return a promise. If the promise resolves as `true` the column UI will be updated. If the promise resolves as falsy, the sort will be performed by the component. A good use-case would be performing the filter on a server / via fetch. Then on success, updating the table's data via the `rows` property
5791
5806
  */
5792
5807
  "customFilterFn"?: (
5793
5808
  filters: TableTypes.Filter[]
5794
5809
  ) => Promise<true | TableTypes.Falsy>;
5810
+ /**
5811
+ * Function called whenever `col.cellTemplate` renders an unknown object. The function should render a valid HTMLElement to the cell arg. Example usage - render JSX from a 3rd party lib and append the result to the cell element.
5812
+ */
5813
+ "customRenderer"?: (node: any, cell: HTMLElement) => void;
5795
5814
  /**
5796
5815
  * A custom sorting function. Should return a promise. If the promise resolves as `true` the column UI will be updated. If the promise resolves as falsey, the sort will be performed by the component. A good use-case would be performing the sort on a server / via fetch. Then on success, updating the table's data via the `rows` property
5797
5816
  */
@@ -5811,9 +5830,8 @@ declare namespace LocalJSX {
5811
5830
  * Used for custom thead row rendering
5812
5831
  */
5813
5832
  "headRender"?: TableTypes.HeadFootRenderer;
5814
- "jsxRenderer"?: TableTypes.HFunc<any>;
5815
5833
  /**
5816
- * Will show a loading state when set to true. By default, will be shown automatically if `rows` is a promise waiting to resolve or when performing custom filtering or sorting. *Note* when set manually, will overwrite any internal loading state. Set to 'undefined' to revert to default behaviour.
5834
+ * Will show a loading state when set to true. By default, will be shown automatically if `rows` is a promise waiting to resolve / or falsy *or* when performing custom filtering or sorting. *Note* when set manually, will overwrite any internal loading state. Set to 'undefined' to revert to default behaviour.
5817
5835
  */
5818
5836
  "loading"?: boolean;
5819
5837
  /**
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Add multiple event listeners with the same callback function
3
+ * @param el the element which emits events
4
+ * @param events the event names to listen to (string separated by a space)
5
+ * @param fn the function to call
6
+ * @param opts the event options to apply
7
+ */
8
+ export declare function addListeners(el: Element | Document, events: string, fn: (e: Event) => void, opts?: AddEventListenerOptions): void;
9
+ /**
10
+ * Remove multiple event listeners with the same callback function
11
+ * @param el the element which emits events
12
+ * @param events the event names to listen to (string separated by a space)
13
+ * @param fn the function to call
14
+ */
15
+ export declare function removeListeners(el: Element | Document, events: string, fn: (e: Event) => void): void;
@@ -14,4 +14,4 @@ export declare const debounce: (callback: (...args: any[]) => void, wait?: numbe
14
14
  * @param delay how long to delay before calling the function
15
15
  * @returns a throttled function to call as often as required
16
16
  */
17
- export declare function throttle(callback: (...args: [any]) => void, delay: number): (...args: any[]) => void;
17
+ export declare const throttle: (callback: any, delay: any) => (...args: any[]) => any;
package/docs-json.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "timestamp": "2023-07-13T16:29:40",
2
+ "timestamp": "2023-08-03T13:31:21",
3
3
  "compiler": {
4
4
  "name": "@stencil/core",
5
5
  "version": "2.23.0",
@@ -12284,6 +12284,15 @@
12284
12284
  ],
12285
12285
  "methods": [],
12286
12286
  "events": [
12287
+ {
12288
+ "event": "nanoResize",
12289
+ "detail": "ResizeObserverEntry[]",
12290
+ "bubbles": true,
12291
+ "cancelable": true,
12292
+ "composed": true,
12293
+ "docs": "Fires after any resizing",
12294
+ "docsTags": []
12295
+ },
12287
12296
  {
12288
12297
  "event": "nanoResizeContentFitChange",
12289
12298
  "detail": "{ x: boolean; y: boolean; }",
@@ -15046,13 +15055,16 @@
15046
15055
  },
15047
15056
  {
15048
15057
  "name": "stickTo",
15049
- "type": "string",
15058
+ "type": "HTMLNanoStickerElement | string",
15050
15059
  "mutable": false,
15051
15060
  "attr": "stick-to",
15052
15061
  "reflectToAttr": false,
15053
- "docs": "Upon being stuck, attach the sticker to another sticker element.\nA JS query selector that returns a <nano-sticker>",
15062
+ "docs": "Upon being stuck, attach the sticker to another sticker element.\nJS query selector string or DOM element pointing to a `<nano-sticker>`",
15054
15063
  "docsTags": [],
15055
15064
  "values": [
15065
+ {
15066
+ "type": "HTMLNanoStickerElement"
15067
+ },
15056
15068
  {
15057
15069
  "type": "string"
15058
15070
  }
@@ -15950,6 +15962,29 @@
15950
15962
  ],
15951
15963
  "usage": {},
15952
15964
  "props": [
15965
+ {
15966
+ "name": "appliedFilters",
15967
+ "type": "Filter[]",
15968
+ "mutable": false,
15969
+ "reflectToAttr": false,
15970
+ "docs": "",
15971
+ "docsTags": [
15972
+ {
15973
+ "name": "readonly",
15974
+ "text": "- shows the currently applied filters"
15975
+ }
15976
+ ],
15977
+ "default": "[]",
15978
+ "values": [
15979
+ {
15980
+ "type": "Filter[]"
15981
+ }
15982
+ ],
15983
+ "optional": false,
15984
+ "required": false,
15985
+ "getter": true,
15986
+ "setter": false
15987
+ },
15953
15988
  {
15954
15989
  "name": "blocksLength",
15955
15990
  "type": "number",
@@ -16009,7 +16044,7 @@
16009
16044
  "type": "(filters: Filter[]) => Promise<true | Falsy>",
16010
16045
  "mutable": false,
16011
16046
  "reflectToAttr": false,
16012
- "docs": "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",
16047
+ "docs": "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",
16013
16048
  "docsTags": [],
16014
16049
  "values": [
16015
16050
  {
@@ -16024,6 +16059,23 @@
16024
16059
  "getter": false,
16025
16060
  "setter": false
16026
16061
  },
16062
+ {
16063
+ "name": "customRenderer",
16064
+ "type": "(node: any, cell: HTMLElement) => void",
16065
+ "mutable": false,
16066
+ "reflectToAttr": false,
16067
+ "docs": "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.",
16068
+ "docsTags": [],
16069
+ "values": [
16070
+ {
16071
+ "type": "(node: any, cell: HTMLElement) => void"
16072
+ }
16073
+ ],
16074
+ "optional": false,
16075
+ "required": false,
16076
+ "getter": false,
16077
+ "setter": false
16078
+ },
16027
16079
  {
16028
16080
  "name": "customSortFn",
16029
16081
  "type": "(property: keyof RowGeneric, order: Order) => Promise<true | Falsy>",
@@ -16099,30 +16151,13 @@
16099
16151
  "getter": false,
16100
16152
  "setter": false
16101
16153
  },
16102
- {
16103
- "name": "jsxRenderer",
16104
- "type": "HFunc<any>",
16105
- "mutable": false,
16106
- "reflectToAttr": false,
16107
- "docs": "",
16108
- "docsTags": [],
16109
- "values": [
16110
- {
16111
- "type": "HFunc<any>"
16112
- }
16113
- ],
16114
- "optional": false,
16115
- "required": false,
16116
- "getter": false,
16117
- "setter": false
16118
- },
16119
16154
  {
16120
16155
  "name": "loading",
16121
16156
  "type": "boolean",
16122
16157
  "mutable": false,
16123
16158
  "attr": "loading",
16124
16159
  "reflectToAttr": false,
16125
- "docs": "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.",
16160
+ "docs": "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.",
16126
16161
  "docsTags": [],
16127
16162
  "default": "undefined",
16128
16163
  "values": [
@@ -16143,7 +16178,7 @@
16143
16178
  "reflectToAttr": false,
16144
16179
  "docs": "To improve performance, data is split into blocks\nwhich are shown / hidden and rendered as they become visible.\nUse this to control the number of hits within a block -\nA block should fill a scrolling viewport.\nThe less perBlock the better for performance",
16145
16180
  "docsTags": [],
16146
- "default": "40",
16181
+ "default": "50",
16147
16182
  "values": [
16148
16183
  {
16149
16184
  "type": "number"
@@ -16415,7 +16450,7 @@
16415
16450
  "docsTags": [
16416
16451
  {
16417
16452
  "name": "param",
16418
- "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"
16453
+ "text": "row - the row to update."
16419
16454
  },
16420
16455
  {
16421
16456
  "name": "param",
package/docs-vscode.json CHANGED
@@ -2681,7 +2681,7 @@
2681
2681
  },
2682
2682
  {
2683
2683
  "name": "stick-to",
2684
- "description": "Upon being stuck, attach the sticker to another sticker element.\nA JS query selector that returns a <nano-sticker>"
2684
+ "description": "Upon being stuck, attach the sticker to another sticker element.\nJS query selector string or DOM element pointing to a `<nano-sticker>`"
2685
2685
  }
2686
2686
  ]
2687
2687
  },
@@ -2838,7 +2838,7 @@
2838
2838
  },
2839
2839
  {
2840
2840
  "name": "loading",
2841
- "description": "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."
2841
+ "description": "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."
2842
2842
  },
2843
2843
  {
2844
2844
  "name": "per-block",