@nanoporetech-digital/components 3.4.0 → 3.5.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 (101) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/dist/cjs/index-41582c2a.js +16 -12
  3. package/dist/cjs/index.cjs.js.map +1 -1
  4. package/dist/cjs/loader.cjs.js +1 -1
  5. package/dist/cjs/nano-components.cjs.js +1 -1
  6. package/dist/cjs/nano-demo.cjs.entry.js +291 -0
  7. package/dist/cjs/nano-demo.cjs.entry.js.map +1 -0
  8. package/dist/cjs/{nano-table-b9cdafab.js → nano-table-83e46f68.js} +486 -202
  9. package/dist/cjs/nano-table-83e46f68.js.map +1 -0
  10. package/dist/cjs/nano-table.cjs.entry.js +1 -1
  11. package/dist/cjs/{table.worker-291904c9.js → table.worker-525ec230.js} +3 -3
  12. package/dist/cjs/table.worker-525ec230.js.map +1 -0
  13. package/dist/cjs/table.worker-e9fb087e.js +4 -0
  14. package/dist/collection/collection-manifest.json +1 -0
  15. package/dist/collection/components/alert/alert.helpers.js.map +1 -1
  16. package/dist/collection/components/demo/demo.js +284 -0
  17. package/dist/collection/components/demo/demo.js.map +1 -0
  18. package/dist/collection/components/dialog/dialog.helpers.js.map +1 -1
  19. package/dist/collection/components/table/table-interface.js.map +1 -1
  20. package/dist/collection/components/table/table.cell.js +65 -0
  21. package/dist/collection/components/table/table.cell.js.map +1 -0
  22. package/dist/collection/components/table/table.css +98 -20
  23. package/dist/collection/components/table/table.header.js +156 -0
  24. package/dist/collection/components/table/table.header.js.map +1 -0
  25. package/dist/collection/components/table/table.js +170 -18
  26. package/dist/collection/components/table/table.js.map +1 -1
  27. package/dist/collection/components/table/table.row.js +113 -0
  28. package/dist/collection/components/table/table.row.js.map +1 -0
  29. package/dist/collection/components/table/table.store.js +46 -9
  30. package/dist/collection/components/table/table.store.js.map +1 -1
  31. package/dist/collection/components/table/table.utils.js +230 -0
  32. package/dist/collection/components/table/table.utils.js.map +1 -1
  33. package/dist/collection/components/table/table.worker.js +1 -0
  34. package/dist/collection/components/table/table.worker.js.map +1 -1
  35. package/dist/components/index.d.ts +1 -0
  36. package/dist/components/index.js +1 -0
  37. package/dist/components/index.js.map +1 -1
  38. package/dist/components/nano-demo.d.ts +11 -0
  39. package/dist/components/nano-demo.js +341 -0
  40. package/dist/components/nano-demo.js.map +1 -0
  41. package/dist/components/nano-table.js +2 -1247
  42. package/dist/components/nano-table.js.map +1 -1
  43. package/dist/components/table.js +1539 -0
  44. package/dist/components/table.js.map +1 -0
  45. package/dist/components/table.worker.js +2 -2
  46. package/dist/custom-elements/index.d.ts +6 -0
  47. package/dist/custom-elements/index.js +772 -204
  48. package/dist/custom-elements/index.js.map +1 -1
  49. package/dist/esm/index-3c280603.js +16 -12
  50. package/dist/esm/index.js.map +1 -1
  51. package/dist/esm/loader.js +1 -1
  52. package/dist/esm/nano-components.js +1 -1
  53. package/dist/esm/nano-demo.entry.js +287 -0
  54. package/dist/esm/nano-demo.entry.js.map +1 -0
  55. package/dist/esm/{nano-table-c8ef2276.js → nano-table-e2405350.js} +487 -203
  56. package/dist/esm/nano-table-e2405350.js.map +1 -0
  57. package/dist/esm/nano-table.entry.js +1 -1
  58. package/dist/esm/{table.worker-65438fa0.js → table.worker-739c193f.js} +3 -3
  59. package/dist/esm/table.worker-739c193f.js.map +1 -0
  60. package/dist/esm/table.worker-e9fb087e.js +4 -0
  61. package/dist/nano-components/index.esm.js.map +1 -1
  62. package/dist/nano-components/nano-components.esm.js +1 -1
  63. package/dist/nano-components/nano-components.esm.js.map +1 -1
  64. package/dist/nano-components/p-28fdfa6b.js +5 -0
  65. package/dist/nano-components/p-28fdfa6b.js.map +1 -0
  66. package/dist/nano-components/p-85cfb0af.entry.js +5 -0
  67. package/dist/nano-components/p-85cfb0af.entry.js.map +1 -0
  68. package/dist/nano-components/p-a71989f3.js +5 -0
  69. package/dist/nano-components/{p-14218d23.entry.js.map → p-a71989f3.js.map} +0 -0
  70. package/dist/nano-components/{p-14218d23.entry.js → p-e4a28360.entry.js} +2 -2
  71. package/dist/nano-components/{p-fe1f8360.js.map → p-e4a28360.entry.js.map} +0 -0
  72. package/dist/nano-components/p-e9fb087e.js +4 -0
  73. package/dist/types/components/alert/alert.helpers.d.ts +1 -1
  74. package/dist/types/components/demo/demo.d.ts +6 -0
  75. package/dist/types/components/dialog/dialog.helpers.d.ts +1 -1
  76. package/dist/types/components/table/table-interface.d.ts +38 -23
  77. package/dist/types/components/table/table.cell.d.ts +18 -0
  78. package/dist/types/components/table/table.d.ts +36 -1
  79. package/dist/types/components/table/table.header.d.ts +16 -0
  80. package/dist/types/components/table/table.row.d.ts +15 -0
  81. package/dist/types/components/table/table.utils.d.ts +99 -0
  82. package/dist/types/components.d.ts +50 -0
  83. package/docs-json.json +124 -3
  84. package/docs-vscode.json +17 -1
  85. package/package.json +2 -2
  86. package/dist/cjs/nano-table-b9cdafab.js.map +0 -1
  87. package/dist/cjs/table.worker-1fd13775.js +0 -4
  88. package/dist/cjs/table.worker-291904c9.js.map +0 -1
  89. package/dist/collection/components/table/table.children.js +0 -224
  90. package/dist/collection/components/table/table.children.js.map +0 -1
  91. package/dist/collection/components/table/table.service.js +0 -121
  92. package/dist/collection/components/table/table.service.js.map +0 -1
  93. package/dist/esm/nano-table-c8ef2276.js.map +0 -1
  94. package/dist/esm/table.worker-1fd13775.js +0 -4
  95. package/dist/esm/table.worker-65438fa0.js.map +0 -1
  96. package/dist/nano-components/p-1fd13775.js +0 -4
  97. package/dist/nano-components/p-f9349146.js +0 -5
  98. package/dist/nano-components/p-f9349146.js.map +0 -1
  99. package/dist/nano-components/p-fe1f8360.js +0 -5
  100. package/dist/types/components/table/table.children.d.ts +0 -30
  101. package/dist/types/components/table/table.service.d.ts +0 -42
@@ -1,4 +1,5 @@
1
- import type { VNode } from '../../stencil-public-runtime';
1
+ import type { JSXBase } from '../../stencil-public-runtime';
2
+ import type { VNode, FunctionalComponent } from '../../stencil-public-runtime';
2
3
  export declare namespace TableTypes {
3
4
  /** The column property */
4
5
  type ColumnProp = string | number;
@@ -6,6 +7,10 @@ export declare namespace TableTypes {
6
7
  type Position = 'start' | 'end' | 'top' | 'bottom';
7
8
  /** A function to assess whether a rendered row will be pinned to the top or bottom */
8
9
  type PinFunc = (props?: RowDataSchemaModel) => Position;
10
+ /** Function called, via intersection observer, when an element's pinned status changes */
11
+ type PinnedCb = (positions: {
12
+ [key in Position]?: boolean;
13
+ }) => void;
9
14
  /** Potential column ordering options */
10
15
  type Order = 'asc' | 'desc' | undefined;
11
16
  /** Column filtering */
@@ -18,16 +23,10 @@ export declare namespace TableTypes {
18
23
  prop: TableTypes.Prop;
19
24
  order: TableTypes.Order;
20
25
  }
21
- /** Potential html properties which can be passed to a row or column */
22
- interface EleProps {
23
- style?: {
24
- [key: string]: string | undefined;
25
- };
26
- class?: {
27
- [key: string]: boolean;
28
- } | string;
29
- [attr: string]: string | number | object | boolean | undefined;
30
- }
26
+ /** Potential html properties which can be passed to a cell or column */
27
+ type CellProps = JSXBase.ThHTMLAttributes<HTMLTableCellElement>;
28
+ /** Potential html properties which can be passed to a row */
29
+ type RowProps = JSXBase.HTMLAttributes<HTMLTableRowElement>;
31
30
  /** data model passed to cell rendering functions */
32
31
  interface ColumnDataSchemaModel {
33
32
  /** The column property being iterated over */
@@ -50,7 +49,8 @@ export declare namespace TableTypes {
50
49
  /** The row being rendered. You *must* nest this in your render function otherwise it will not be shown */
51
50
  renderedRow?: VNode;
52
51
  }
53
- /** A JSX `createElement` function passed to rendering functions
52
+ /** A JSX `createElement` function passed to rendering functions.
53
+ * You can use this to create markup outside of JSX environments
54
54
  * e.g. https://reactjs.org/docs/react-without-jsx.html */
55
55
  interface HFunc<T> {
56
56
  (tag: any): T;
@@ -77,7 +77,17 @@ export declare namespace TableTypes {
77
77
  * A row render function, called during a any row's render to the dom.
78
78
  * It can be used to add extra markup around any given table row
79
79
  **/
80
- type RowTemplateFunc<T> = (createElement: HFunc<T>, props?: RowDataSchemaModel) => T | undefined;
80
+ type RowTemplateFunc<T> = (
81
+ /** use this to create markup outside of JSX environments
82
+ * e.g. https://reactjs.org/docs/react-without-jsx.html */
83
+ createElement: HFunc<T>,
84
+ /** data passed to each template */
85
+ props: RowDataSchemaModel,
86
+ /** a helper template to minimise boilerplate.
87
+ * A shortcut for `<td><div class="nano-tbl__cell-content"></div></td>` */
88
+ TableCell: FunctionalComponent<{
89
+ header?: boolean;
90
+ }>) => T | undefined;
81
91
  /**
82
92
  * A cell render function, called during any cell's render to the dom.
83
93
  * It can be used to add any markup within a table cell.
@@ -93,11 +103,11 @@ export declare namespace TableTypes {
93
103
  */
94
104
  type ColSortComparator = (prop: keyof RowData, order: Order) => (a: RowData, b: RowData) => number;
95
105
  /** A function which can be used to apply any html attribute/s onto a table cell `td` */
96
- type PropertiesFunc = (props: ColumnDataSchemaModel) => EleProps | void | undefined;
106
+ type PropertiesFunc = (props: ColumnDataSchemaModel) => CellProps | void | undefined;
97
107
  /** A function which can be used to apply any html attribute/s onto a table head `th` */
98
- type ColPropertiesFunc = (props: ColumnConfig) => EleProps | void | undefined;
108
+ type ColPropertiesFunc = (props: ColumnConfig) => CellProps | void | undefined;
99
109
  /** A function which can be used to apply any html attribute/s onto a table row `tr` */
100
- type RowPropertiesFunc = (props: RowDataSchemaModel) => EleProps | void | undefined;
110
+ type RowPropertiesFunc = (props: RowDataSchemaModel) => RowProps | void | undefined;
101
111
  /** An individual table cell's data */
102
112
  type RowData = {
103
113
  [key: string | number]: any;
@@ -106,6 +116,8 @@ export declare namespace TableTypes {
106
116
  };
107
117
  /** A data property */
108
118
  type Prop = keyof TableTypes.RowData;
119
+ /** Valid column data types */
120
+ type ColumnType = 'text' | 'string' | 'number' | 'date' | 'unknown';
109
121
  /**
110
122
  * A table column's configuration
111
123
  */
@@ -114,14 +126,15 @@ export declare namespace TableTypes {
114
126
  title: string;
115
127
  /** The row's data property to retrieve per cell render */
116
128
  prop: keyof T;
117
- /** The type of data. Will affect how it is sorted and available
118
- * filter operations. Will be derived automatically by default */
119
- type?: 'text' | 'string' | 'number' | 'date';
129
+ /** The type of data. Will affect how it is sorted and the available
130
+ * filter operations ('text' uses browser locale to compare).
131
+ * If none supplied, it will be derived by default using the first row of data retrieved. */
132
+ type?: ColumnType;
120
133
  /** Whether this column is horizontally pinned to viewport */
121
134
  pinned?: Position;
122
135
  /** Whether this column is a row header; the cell will render a `th` not a `td` */
123
136
  rowHeader?: boolean;
124
- /** Whether this column can be ordered. Defaults to true */
137
+ /** Whether this column can be sorted. Defaults to true */
125
138
  sortable?: boolean;
126
139
  /** Current order of this column */
127
140
  order?: Order;
@@ -129,6 +142,8 @@ export declare namespace TableTypes {
129
142
  searchable?: boolean;
130
143
  /** Current filters applied to this column */
131
144
  filter?: string;
145
+ /** Whether this column can be dragged to change column order */
146
+ draggable?: boolean;
132
147
  /**
133
148
  * A cell render function, called during any cell's render to the dom.
134
149
  * It can be used to add any markup within a table cell.
@@ -153,7 +168,7 @@ export declare namespace TableTypes {
153
168
  */
154
169
  interface RowRenderer {
155
170
  /** Function to decide whether the row is vertically pinned. */
156
- pinned: PinFunc;
171
+ pinned?: PinFunc;
157
172
  /**
158
173
  * A row render function, called during a any row's render to the dom.
159
174
  * It can be used to add extra markup around any given table row
@@ -173,11 +188,11 @@ export declare namespace TableTypes {
173
188
  * A row render function, called during a any row's render to the dom.
174
189
  * It can be used to add extra markup around any given table row.
175
190
  * If used, and you want to see the rendered row, you *must* nest it within your
176
- * jsx function
191
+ * jsx function e.g. `(h, props) => { return [props.renderedRow, <tr><td>Custom thing</td></tr>]}`
177
192
  **/
178
193
  template?: RowTemplateFunc<VNode | VNode[]>;
179
194
  /** A function which can be used to apply any html attribute/s onto a table row `tr` */
180
- rowProperties?: () => EleProps | void | undefined;
195
+ rowProperties?: () => RowProps | void | undefined;
181
196
  }
182
197
  type TBody = {
183
198
  rows: TableTypes.NanoTable['rows'];
@@ -0,0 +1,18 @@
1
+ import { FunctionalComponent, VNode } from '../../stencil-public-runtime';
2
+ /**
3
+ * Renders a cell using a custom renderer if set.
4
+ * @param rowIndex - the current row index being rendered
5
+ * @param colIndex - the current column index being rendered
6
+ * @returns - a JSX node
7
+ */
8
+ export declare function cellRender(rowIndex: number, colIndex: number): VNode;
9
+ export declare const baseCellClasses: (colIndex: number, toString?: boolean) => string | {
10
+ [x: string]: boolean;
11
+ };
12
+ declare type TableCellProps = {
13
+ rowIndex: number;
14
+ colIndex: number;
15
+ nestedContent?: VNode;
16
+ };
17
+ export declare const TableCell: FunctionalComponent<TableCellProps>;
18
+ export {};
@@ -8,10 +8,12 @@ import type { TableTypes } from '../../interface';
8
8
  *- Built-in column sort
9
9
  *- Easily swap in API / async based search / filter & sort
10
10
  *- Pin headers, footers, rows, columns
11
+ *- Drag-&-Drop columns to re-order
11
12
  *- Add custom rendering at every level
12
13
  *- Add custom properties at every level
13
14
  *
14
15
  * @slot caption - The table's caption. You must either use this or the `caption` attribute.
16
+ * @slot no-results - text to display when search or filtering yields no results
15
17
  */
16
18
  export declare class Table implements ComponentInterface {
17
19
  constructor();
@@ -65,6 +67,18 @@ export declare class Table implements ComponentInterface {
65
67
  * A good use-case would be performing the sort on a server / via fetch.
66
68
  * Then on success, updating the table's data via the `rows` property */
67
69
  customSortFn?: (property: TableTypes.Prop, order: TableTypes.Order) => Promise<void>;
70
+ /**
71
+ * The default sortable option for all columns.
72
+ * `true` will enable column sorting unless you set `sortable: false` on a column
73
+ * `false` will disable column sorting unless you set `sortable: true` on a column
74
+ */
75
+ defaultSort: boolean;
76
+ /**
77
+ * The default draggable option for all columns.
78
+ * `true` will enable column drag-to-reorder unless you set `draggable: false` on a column
79
+ * `false` will disable column drag-to-reorder unless you set `draggable: true` on a column
80
+ */
81
+ defaultColDraggable: boolean;
68
82
  handleSearchTermChange(): void;
69
83
  /** Fired whenever a block is activated by scrolling into view / becoming visible
70
84
  * This could be leveraged for infinite scrolling / to fetch more data.
@@ -86,8 +100,20 @@ export declare class Table implements ComponentInterface {
86
100
  column: TableTypes.Prop;
87
101
  order: TableTypes.Order;
88
102
  }>;
103
+ /** Fired when a column has started dragging */
104
+ nanoTblColDrag: EventEmitter<{
105
+ column: TableTypes.Prop;
106
+ }>;
107
+ /** Fired when a column has been dropped (after dragging)
108
+ * `event.preventDefault()` to stop column re-order. */
109
+ nanoTblColDrop: EventEmitter<{
110
+ fromCol: TableTypes.Prop;
111
+ toCol: TableTypes.Prop;
112
+ fromIndex: number;
113
+ toIndex: number;
114
+ }>;
89
115
  /** Fired before a column is filtered.
90
- * `event.preventDefault()` to stop filtering. */
116
+ * `event.preventDefault()` to stop filtering. */
91
117
  nanoTblBeforeFilter: EventEmitter<{
92
118
  filters: TableTypes.Filter[];
93
119
  }>;
@@ -119,6 +145,11 @@ export declare class Table implements ComponentInterface {
119
145
  * @returns a promise which resolves when complete
120
146
  */
121
147
  addFilters(filters: TableTypes.Filter[], additive?: boolean): Promise<void>;
148
+ /** Remove filters from a column
149
+ * @param columnNames - the filters to apply
150
+ * @returns a promise which resolves when complete
151
+ */
152
+ removeFilters(columnNames: TableTypes.Prop[]): Promise<void>;
122
153
  host: HTMLNanoTableElement;
123
154
  private renderId;
124
155
  private store;
@@ -127,6 +158,7 @@ export declare class Table implements ComponentInterface {
127
158
  private currentSort;
128
159
  private tableEle;
129
160
  private topAnchorEle;
161
+ private tableWrapperEle;
130
162
  /** `tr` elements split into units - defined by `perPage`
131
163
  These are show / hidden for perf */
132
164
  blocks: TableTypes.TBody[];
@@ -145,6 +177,8 @@ export declare class Table implements ComponentInterface {
145
177
  private _isReady;
146
178
  scrollListener(): void;
147
179
  private handleReady;
180
+ private colDrag;
181
+ private colDrop;
148
182
  /**
149
183
  * Start a sort - can be cancelled by `preventDefault`
150
184
  * @param order - column order
@@ -197,6 +231,7 @@ export declare class Table implements ComponentInterface {
197
231
  /** Process slotted content */
198
232
  private processSlots;
199
233
  private handleColumnPinned;
234
+ private handleResizeChange;
200
235
  componentWillLoad(): Promise<void>;
201
236
  connectedCallback(): void;
202
237
  componentDidLoad(): void;
@@ -0,0 +1,16 @@
1
+ import { FunctionalComponent } from '../../stencil-public-runtime';
2
+ import type { TableTypes } from '../../interface';
3
+ declare type TableColHeadProps = {
4
+ column: TableTypes.ColumnConfig;
5
+ headRenderer: TableTypes.HeadFootRenderer;
6
+ onColumnSortClick?: (order: TableTypes.Order, column: TableTypes.Prop, el: HTMLTableCellElement) => void;
7
+ onColumnPinned?: TableTypes.PinnedCb;
8
+ onColumnDrag?: (column: TableTypes.Prop, el: HTMLTableCellElement) => void;
9
+ onColumnDrop?: (fromColumn: TableTypes.Prop, toColumn: TableTypes.Prop, el: HTMLTableCellElement) => void;
10
+ defaults: {
11
+ draggable?: boolean;
12
+ sortable?: boolean;
13
+ };
14
+ };
15
+ export declare const TableColHead: FunctionalComponent<TableColHeadProps>;
16
+ export {};
@@ -0,0 +1,15 @@
1
+ import { FunctionalComponent } from '../../stencil-public-runtime';
2
+ import type { TableTypes } from '../../interface';
3
+ declare type TableRowProps = {
4
+ rowRenderer: TableTypes.RowRenderer;
5
+ rowIndex: number;
6
+ row: TableTypes.RowData;
7
+ onColumnPinned?: TableTypes.PinnedCb;
8
+ };
9
+ export declare const TableRow: FunctionalComponent<TableRowProps>;
10
+ declare type TableHeadFootProps = {
11
+ rowRenderer: TableTypes.HeadFootRenderer;
12
+ onColumnPinned?: TableTypes.PinnedCb;
13
+ };
14
+ export declare const TableHeadFootRow: FunctionalComponent<TableHeadFootProps>;
15
+ export {};
@@ -1,3 +1,102 @@
1
+ import { VNode } from '../../stencil-public-runtime';
2
+ import type { TableTypes } from '../../interface';
3
+ declare type ValidRenderTypes = 'tr' | 'th' | 'td';
4
+ /**
5
+ * Get a model object for custom cell / property renderers.
6
+ * @param rowIndex - the current row index being rendered
7
+ * @param colIndex - the current column index being rendered
8
+ * @returns a model object which will be passed to custom renderers
9
+ */
10
+ export declare function colDataModel(rowIndex: number, colIndex: number): TableTypes.ColumnDataSchemaModel;
11
+ /**
12
+ * Get a model object for custom row renderers.
13
+ * @param rowIndex
14
+ * @returns a model object passed to custom row renderers
15
+ */
16
+ export declare function rowDataModel(rowIndex: number): TableTypes.RowDataSchemaModel;
17
+ /**
18
+ * Merges 2 objects of properties together
19
+ * @param current - property object
20
+ * @param extra - additional object property
21
+ * @returns - merged properties that can be applied to a node
22
+ */
23
+ export declare function mergeProperties<T extends TableTypes.CellProps | TableTypes.CellProps>(current: T, extra: T): T;
24
+ /**
25
+ * Returns the current nano-table's stores.
26
+ * @returns the current nano-table stores
27
+ */
28
+ export declare function fetchStores(): import("./table.store").TableStores;
29
+ /**
30
+ * Merges any defined cell properties with properties
31
+ * required by `nano-table` functionality
32
+ * @param rowIndex - the current row index being rendered
33
+ * @param colIndex = the current column index being rendered
34
+ * @param defaultProps - default properties required by `nano-table`
35
+ * @returns - the merged properties that will be applied to a node
36
+ */
37
+ export declare function mergeCellProperties(rowIndex: number, colIndex: number, defaultProps: TableTypes.CellProps): TableTypes.CellProps;
38
+ /**
39
+ * Renders a table header (within a thead) using a custom template if set.
40
+ * @param col - the current column config object
41
+ * @returns - a JSX node
42
+ */
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
+ /**
59
+ * Renders a class string or map for pinned classes on the v axis.
60
+ * @param type - element tagName
61
+ * @param vPinned - whether element is currently pinned vertically to top or bottom
62
+ * @param toString - render as a string (defaults to class map)
63
+ */
64
+ export declare function headerPinClasses(type: ValidRenderTypes, vPinned?: TableTypes.Position, toString?: false): {
65
+ [key: string]: boolean;
66
+ };
67
+ export declare function headerPinClasses(type: ValidRenderTypes, vPinned?: TableTypes.Position, toString?: true): string;
68
+ /**
69
+ * Turns a class map {'string': boolean} to class string
70
+ * @param classes - the class map to convert
71
+ * @returns a class string
72
+ */
73
+ export declare function classListToStr(classes: {
74
+ [key: string]: boolean;
75
+ }): string;
76
+ /**
77
+ * Detects the current scroll speed as a number.
78
+ * Use within a scroll listener
79
+ */
1
80
  export declare const detectScrollSpeed: () => number;
81
+ /**
82
+ * Attempts to find the closes scrolling parental element
83
+ * @param element - the element from which to traverse up the DOM
84
+ * @returns - the closest scrolling parental element
85
+ */
2
86
  export declare function findScrollParent(element: HTMLElement): HTMLElement;
87
+ /**
88
+ * Checks whether an element is currently viewable within the viewport
89
+ * @param el - element to check
90
+ * @param percentVisible - the percentage of the element that should be within the viewport
91
+ * @returns true if the element's area percentage is visible
92
+ */
3
93
  export declare function isInViewport(el: Element, percentVisible?: number): boolean;
94
+ /**
95
+ * Immutable array re-order
96
+ * @param from - the index to move from
97
+ * @param to - the index to move to
98
+ * @param arr - the array to re-order
99
+ * @returns - a new, re-orderd array
100
+ */
101
+ export declare function arrMove(from: number, to: number, arr: any[]): any[];
102
+ export {};
@@ -587,6 +587,8 @@ export namespace Components {
587
587
  */
588
588
  "setFocus": (day?: boolean, forceFocusVisible?: boolean) => Promise<void>;
589
589
  }
590
+ interface NanoDemo {
591
+ }
590
592
  interface NanoDetails {
591
593
  /**
592
594
  * Color to use from your application's color palette.
@@ -2031,6 +2033,14 @@ export namespace Components {
2031
2033
  property: TableTypes.Prop,
2032
2034
  order: TableTypes.Order
2033
2035
  ) => Promise<void>;
2036
+ /**
2037
+ * The default draggable option for all columns. `true` will enable column drag-to-reorder unless you set `draggable: false` on a column `false` will disable column drag-to-reorder unless you set `draggable: true` on a column
2038
+ */
2039
+ "defaultColDraggable": boolean;
2040
+ /**
2041
+ * The default sortable option for all columns. `true` will enable column sorting unless you set `sortable: false` on a column `false` will disable column sorting unless you set `sortable: true` on a column
2042
+ */
2043
+ "defaultSort": boolean;
2034
2044
  /**
2035
2045
  * Used for custom tfoot row rendering
2036
2046
  */
@@ -2051,6 +2061,12 @@ export namespace Components {
2051
2061
  * When loading rows asynchronously, this will render this number of placeholder rows
2052
2062
  */
2053
2063
  "placeholderSize": number;
2064
+ /**
2065
+ * Remove filters from a column
2066
+ * @param columnNames - the filters to apply
2067
+ * @returns a promise which resolves when complete
2068
+ */
2069
+ "removeFilters": (columnNames: TableTypes.Prop[]) => Promise<void>;
2054
2070
  /**
2055
2071
  * Remove any column filters currently applied
2056
2072
  * @returns a promise which resolves when complete
@@ -2368,6 +2384,12 @@ declare global {
2368
2384
  prototype: HTMLNanoDatePickerElement;
2369
2385
  new (): HTMLNanoDatePickerElement;
2370
2386
  };
2387
+ interface HTMLNanoDemoElement extends Components.NanoDemo, HTMLStencilElement {
2388
+ }
2389
+ var HTMLNanoDemoElement: {
2390
+ prototype: HTMLNanoDemoElement;
2391
+ new (): HTMLNanoDemoElement;
2392
+ };
2371
2393
  interface HTMLNanoDetailsElement extends Components.NanoDetails, HTMLStencilElement {
2372
2394
  }
2373
2395
  var HTMLNanoDetailsElement: {
@@ -2598,6 +2620,7 @@ declare global {
2598
2620
  "nano-datalist": HTMLNanoDatalistElement;
2599
2621
  "nano-date-input": HTMLNanoDateInputElement;
2600
2622
  "nano-date-picker": HTMLNanoDatePickerElement;
2623
+ "nano-demo": HTMLNanoDemoElement;
2601
2624
  "nano-details": HTMLNanoDetailsElement;
2602
2625
  "nano-dialog": HTMLNanoDialogElement;
2603
2626
  "nano-drawer": HTMLNanoDrawerElement;
@@ -3219,6 +3242,8 @@ declare namespace LocalJSX {
3219
3242
  */
3220
3243
  "selectedDate"?: string;
3221
3244
  }
3245
+ interface NanoDemo {
3246
+ }
3222
3247
  interface NanoDetails {
3223
3248
  /**
3224
3249
  * Color to use from your application's color palette.
@@ -4752,6 +4777,14 @@ declare namespace LocalJSX {
4752
4777
  property: TableTypes.Prop,
4753
4778
  order: TableTypes.Order
4754
4779
  ) => Promise<void>;
4780
+ /**
4781
+ * The default draggable option for all columns. `true` will enable column drag-to-reorder unless you set `draggable: false` on a column `false` will disable column drag-to-reorder unless you set `draggable: true` on a column
4782
+ */
4783
+ "defaultColDraggable"?: boolean;
4784
+ /**
4785
+ * The default sortable option for all columns. `true` will enable column sorting unless you set `sortable: false` on a column `false` will disable column sorting unless you set `sortable: true` on a column
4786
+ */
4787
+ "defaultSort"?: boolean;
4755
4788
  /**
4756
4789
  * Used for custom tfoot row rendering
4757
4790
  */
@@ -4800,6 +4833,21 @@ declare namespace LocalJSX {
4800
4833
  "onNanoTblBlockRendered"?: (event: NanoTableCustomEvent<{
4801
4834
  block: number;
4802
4835
  totalBlocks: number;
4836
+ }>) => void;
4837
+ /**
4838
+ * Fired when a column has started dragging
4839
+ */
4840
+ "onNanoTblColDrag"?: (event: NanoTableCustomEvent<{
4841
+ column: TableTypes.Prop;
4842
+ }>) => void;
4843
+ /**
4844
+ * Fired when a column has been dropped (after dragging) `event.preventDefault()` to stop column re-order.
4845
+ */
4846
+ "onNanoTblColDrop"?: (event: NanoTableCustomEvent<{
4847
+ fromCol: TableTypes.Prop;
4848
+ toCol: TableTypes.Prop;
4849
+ fromIndex: number;
4850
+ toIndex: number;
4803
4851
  }>) => void;
4804
4852
  /**
4805
4853
  * Fired when the table has done it's first complete render
@@ -4910,6 +4958,7 @@ declare namespace LocalJSX {
4910
4958
  "nano-datalist": NanoDatalist;
4911
4959
  "nano-date-input": NanoDateInput;
4912
4960
  "nano-date-picker": NanoDatePicker;
4961
+ "nano-demo": NanoDemo;
4913
4962
  "nano-details": NanoDetails;
4914
4963
  "nano-dialog": NanoDialog;
4915
4964
  "nano-drawer": NanoDrawer;
@@ -4965,6 +5014,7 @@ declare module "@stencil/core" {
4965
5014
  "nano-datalist": LocalJSX.NanoDatalist & JSXBase.HTMLAttributes<HTMLNanoDatalistElement>;
4966
5015
  "nano-date-input": LocalJSX.NanoDateInput & JSXBase.HTMLAttributes<HTMLNanoDateInputElement>;
4967
5016
  "nano-date-picker": LocalJSX.NanoDatePicker & JSXBase.HTMLAttributes<HTMLNanoDatePickerElement>;
5017
+ "nano-demo": LocalJSX.NanoDemo & JSXBase.HTMLAttributes<HTMLNanoDemoElement>;
4968
5018
  "nano-details": LocalJSX.NanoDetails & JSXBase.HTMLAttributes<HTMLNanoDetailsElement>;
4969
5019
  "nano-dialog": LocalJSX.NanoDialog & JSXBase.HTMLAttributes<HTMLNanoDialogElement>;
4970
5020
  "nano-drawer": LocalJSX.NanoDrawer & JSXBase.HTMLAttributes<HTMLNanoDrawerElement>;