athena-ui-js 2.4.0 → 2.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.
@@ -1,113 +1,128 @@
1
- /**
2
- * Generates a button.
3
- *
4
- * @param {object} options
5
- * @param {string|Element} [options.parent] id or element, defaults to the body
6
- * @param {string} [options.id]
7
- * @param {string} [options.text]
8
- * @param {"primary"|"secondary"|"danger"|"link"} [options.variant="primary"]
9
- * @param {"button"|"submit"|"reset"} [options.type="button"]
10
- * @param {"small"|"large"} [options.size]
11
- * @param {boolean} [options.disabled]
12
- * @param {boolean} [options.loading] shows a spinner and blocks clicks
13
- * @param {(event: Event) => void} [options.onclick]
14
- * @returns {{element: HTMLButtonElement, setLoading: Function, setDisabled: Function, setText: Function}}
15
- */
16
- export function generateButton(options?: {
17
- parent?: string | Element;
18
- id?: string;
19
- text?: string;
20
- variant?: "primary" | "secondary" | "danger" | "link";
21
- type?: "button" | "submit" | "reset";
22
- size?: "small" | "large";
23
- disabled?: boolean;
24
- loading?: boolean;
25
- onclick?: (event: Event) => void;
26
- }): {
27
- element: HTMLButtonElement;
28
- setLoading: Function;
29
- setDisabled: Function;
30
- setText: Function;
31
- };
32
- /**
33
- * Generates one labelled form field with help text and an error line.
34
- *
35
- * @param {object} options
36
- * @param {string} options.name key of the field in the form values
37
- * @param {"text"|"password"|"email"|"number"|"date"|"datetime-local"|"time"|"url"|"tel"|"search"|"color"|"range"|"file"|"hidden"|"textarea"|"select"|"checkbox"|"switch"|"radio"|"checkboxes"|"autocomplete"|"multiselect"|"daterange"|"richtext"|"wysiwyg"} [options.type="text"]
38
- * @param {string} [options.label]
39
- * @param {string} [options.help] help text under the control
40
- * @param {*} [options.value] initial value (boolean for checkbox / switch, array for checkboxes / multiple select)
41
- * @param {(string|{value: string, text?: string, disabled?: boolean})[]} [options.options] choices of select / radio / checkboxes
42
- * @param {boolean} [options.multiple] select / file: allow several values
43
- * @param {string} [options.placeholder]
44
- * @param {number} [options.rows] textarea rows
45
- * @param {object} [options.rules] validation rules, see validateValue. They can also be given directly
46
- * (required, email, minLength, ...)
47
- * @param {(value, field) => void} [options.onChange]
48
- * @param {() => object} [options.getValues] all form values (set by generateForm, used by `match`)
49
- * @returns {{element: HTMLElement, name: string, getValue: Function, setValue: Function, validate: Function,
50
- * setError: Function, focus: Function}}
51
- */
52
- export function generateField(options?: {
53
- name: string;
54
- type?: "text" | "password" | "email" | "number" | "date" | "datetime-local" | "time" | "url" | "tel" | "search" | "color" | "range" | "file" | "hidden" | "textarea" | "select" | "checkbox" | "switch" | "radio" | "checkboxes" | "autocomplete" | "multiselect" | "daterange" | "richtext" | "wysiwyg";
55
- label?: string;
56
- help?: string;
57
- value?: any;
58
- options?: (string | {
59
- value: string;
60
- text?: string;
61
- disabled?: boolean;
62
- })[];
63
- multiple?: boolean;
64
- placeholder?: string;
65
- rows?: number;
66
- rules?: object;
67
- onChange?: (value: any, field: any) => void;
68
- getValues?: () => object;
69
- }): {
70
- element: HTMLElement;
71
- name: string;
72
- getValue: Function;
73
- setValue: Function;
74
- validate: Function;
75
- setError: Function;
76
- focus: Function;
77
- };
78
- /**
79
- * Generates a form from a list of field definitions.
80
- *
81
- * @param {object} options
82
- * @param {string|Element} [options.parent]
83
- * @param {string} [options.id]
84
- * @param {object[]} options.fields field definitions, see generateField
85
- * @param {string} [options.submitText]
86
- * @param {string|false} [options.resetText] adds a reset button when set
87
- * @param {(values: object, form: object) => (void|Promise)} [options.onSubmit] called with the values when every
88
- * field is valid. A returned promise keeps the submit button busy; a rejection is shown as form message.
89
- * @param {(values: object, field: object) => void} [options.onChange]
90
- * @returns {{element: HTMLFormElement, fields: Object<string, object>, getValues: Function, setValues: Function,
91
- * setErrors: Function, validate: Function, reset: Function, setMessage: Function, submitButton: object}}
92
- */
93
- export function generateForm(options?: {
94
- parent?: string | Element;
95
- id?: string;
96
- fields: object[];
97
- submitText?: string;
98
- resetText?: string | false;
99
- onSubmit?: (values: object, form: object) => (void | Promise<any>);
100
- onChange?: (values: object, field: object) => void;
101
- }): {
102
- element: HTMLFormElement;
103
- fields: {
104
- [x: string]: object;
105
- };
106
- getValues: Function;
107
- setValues: Function;
108
- setErrors: Function;
109
- validate: Function;
110
- reset: Function;
111
- setMessage: Function;
112
- submitButton: object;
113
- };
1
+ /**
2
+ * Generates a button.
3
+ *
4
+ * @param {object} options
5
+ * @param {string|Element} [options.parent] id or element, defaults to the body
6
+ * @param {string} [options.id]
7
+ * @param {string} [options.text]
8
+ * @param {"primary"|"secondary"|"danger"|"link"} [options.variant="primary"]
9
+ * @param {"button"|"submit"|"reset"} [options.type="button"]
10
+ * @param {"small"|"large"} [options.size]
11
+ * @param {boolean} [options.disabled]
12
+ * @param {boolean} [options.loading] shows a spinner and blocks clicks
13
+ * @param {(event: Event) => void} [options.onclick]
14
+ * @returns {{element: HTMLButtonElement, setLoading: Function, setDisabled: Function, setText: Function}}
15
+ */
16
+ export function generateButton(options?: {
17
+ parent?: string | Element;
18
+ id?: string;
19
+ text?: string;
20
+ variant?: "primary" | "secondary" | "danger" | "link";
21
+ type?: "button" | "submit" | "reset";
22
+ size?: "small" | "large";
23
+ disabled?: boolean;
24
+ loading?: boolean;
25
+ onclick?: (event: Event) => void;
26
+ }): {
27
+ element: HTMLButtonElement;
28
+ setLoading: Function;
29
+ setDisabled: Function;
30
+ setText: Function;
31
+ };
32
+ /**
33
+ * Generates one labelled form field with help text and an error line.
34
+ *
35
+ * @param {object} options
36
+ * @param {string} options.name key of the field in the form values
37
+ * @param {"text"|"password"|"email"|"number"|"date"|"datetime-local"|"time"|"url"|"tel"|"search"|"color"|"range"|"file"|"hidden"|"textarea"|"select"|"checkbox"|"switch"|"radio"|"checkboxes"|"autocomplete"|"multiselect"|"daterange"|"richtext"|"wysiwyg"} [options.type="text"]
38
+ * @param {string} [options.label]
39
+ * @param {string} [options.help] help text under the control
40
+ * @param {*} [options.value] initial value (boolean for checkbox / switch, array for checkboxes / multiple select)
41
+ * @param {(string|{value: string, text?: string, disabled?: boolean})[]} [options.options] choices of select / radio / checkboxes
42
+ * @param {boolean} [options.multiple] select / file: allow several values
43
+ * @param {string} [options.placeholder]
44
+ * @param {number} [options.rows] textarea rows
45
+ * @param {object} [options.rules] validation rules, see validateValue. They can also be given directly
46
+ * (required, email, minLength, ...)
47
+ * @param {(value, field) => void} [options.onChange]
48
+ * @param {() => object} [options.getValues] all form values (set by generateForm, used by `match`)
49
+ * @returns {{element: HTMLElement, name: string, getValue: Function, setValue: Function, validate: Function,
50
+ * setError: Function, focus: Function}}
51
+ */
52
+ export function generateField(options?: {
53
+ name: string;
54
+ type?: "text" | "password" | "email" | "number" | "date" | "datetime-local" | "time" | "url" | "tel" | "search" | "color" | "range" | "file" | "hidden" | "textarea" | "select" | "checkbox" | "switch" | "radio" | "checkboxes" | "autocomplete" | "multiselect" | "daterange" | "richtext" | "wysiwyg";
55
+ label?: string;
56
+ help?: string;
57
+ value?: any;
58
+ options?: (string | {
59
+ value: string;
60
+ text?: string;
61
+ disabled?: boolean;
62
+ })[];
63
+ multiple?: boolean;
64
+ placeholder?: string;
65
+ rows?: number;
66
+ rules?: object;
67
+ onChange?: (value: any, field: any) => void;
68
+ getValues?: () => object;
69
+ }): {
70
+ element: HTMLElement;
71
+ name: string;
72
+ getValue: Function;
73
+ setValue: Function;
74
+ validate: Function;
75
+ setError: Function;
76
+ focus: Function;
77
+ };
78
+ /**
79
+ * Generates a form from a list of field definitions.
80
+ *
81
+ * @param {object} options
82
+ * @param {string|Element} [options.parent]
83
+ * @param {string} [options.id]
84
+ * @param {object[]} options.fields field definitions, see generateField
85
+ * @param {string} [options.submitText]
86
+ * @param {string|false} [options.resetText] adds a reset button when set
87
+ * @param {(values: object, form: object) => (void|Promise)} [options.onSubmit] called with the values when every
88
+ * field is valid. A returned promise keeps the submit button busy; a rejection is shown as form message.
89
+ * @param {(values: object, field: object) => void} [options.onChange]
90
+ * @param {boolean} [options.nested=false] a field called "soa.host" is the key `host` of the object `soa` in the values
91
+ *
92
+ * Field definitions can also have these, which only generateForm reads:
93
+ * - `show: (values) => boolean`: the field is shown while it returns true. A field that is not shown is not validated and not in the values.
94
+ * - `label: (values) => string`: a label that follows the other fields (`values` are the raw values of every field)
95
+ * - `send: false`: the field is validated but not in the values (the second field of "type the password again")
96
+ * - `trim: true`: a text value is trimmed
97
+ * - `empty: "omit"|"null"|"empty"`: what an empty value (an empty text, a number that is not a number) becomes: left out, null, or "".
98
+ * Without it the value stays as it is.
99
+ *
100
+ * A rejection of `onSubmit` with a `details` object ({ "soa.host": "Not a name" }) puts the messages at their fields; what has no field, and the message
101
+ * of the error when no field shows one, go to the message of the form.
102
+ * @returns {{element: HTMLFormElement, fields: Object<string, object>, getValues: Function, getRawValues: Function, setValues: Function,
103
+ * setErrors: Function, validate: Function, reset: Function, setMessage: Function, arrange: Function, submitButton: object}}
104
+ */
105
+ export function generateForm(options?: {
106
+ parent?: string | Element;
107
+ id?: string;
108
+ fields: object[];
109
+ submitText?: string;
110
+ resetText?: string | false;
111
+ onSubmit?: (values: object, form: object) => (void | Promise<any>);
112
+ onChange?: (values: object, field: object) => void;
113
+ nested?: boolean;
114
+ }): {
115
+ element: HTMLFormElement;
116
+ fields: {
117
+ [x: string]: object;
118
+ };
119
+ getValues: Function;
120
+ getRawValues: Function;
121
+ setValues: Function;
122
+ setErrors: Function;
123
+ validate: Function;
124
+ reset: Function;
125
+ setMessage: Function;
126
+ arrange: Function;
127
+ submitButton: object;
128
+ };
@@ -1,123 +1,129 @@
1
- /**
2
- * Generates a table (optional filter box, sortable headers, pagination, row selection, inline
3
- * editing, resizable columns, virtual scrolling, CSV export) and appends it to its parent.
4
- *
5
- * @param {object} options
6
- * @param {string|Element} [options.parent] id or element, defaults to "wrapper"
7
- * @param {string} [options.id] id of the table wrapper (default: "table")
8
- * @param {string} [options.class] extra CSS class of the table
9
- * @param {string} [options.caption]
10
- * @param {{key: string, label?: string, width?: number, sortable?: boolean, editable?: boolean, format?: (value, row) => string}[]} options.columns
11
- * @param {object[]} [options.rows] row objects, read by column key
12
- * @param {boolean} [options.sortable=true] click on a header sorts by it
13
- * @param {boolean} [options.filter=false] show a text filter above the table
14
- * @param {number} [options.pageSize=0] rows per page, 0 disables pagination
15
- * @param {boolean} [options.selectable=false] checkbox column; the header checkbox selects every filtered row
16
- * @param {boolean} [options.resizableColumns=false] drag the edge of a header (or use the arrow keys on it) to resize;
17
- * double click resets the width
18
- * @param {{height?: number, rowHeight?: number, overscan?: number}|boolean} [options.virtual] render only the rows
19
- * in view, for lists of thousands of rows. Rows have a fixed height (default 36 px) and the table scrolls
20
- * inside `height` (default 400 px). Replaces pagination.
21
- * @param {(key: string, width: number) => void} [options.onColumnResize]
22
- * @param {(rows: object[]) => void} [options.onSelectionChange]
23
- * @param {(row: object, key: string, value, oldValue) => (boolean|void)} [options.onEdit] called after an edit
24
- * of an `editable` column (double click, or Enter / F2 on the focused cell). Return false to reject it.
25
- * @param {(row: object) => void} [options.onRowClick]
26
- * @param {string} [options.emptyText]
27
- * @param {(row: object, column: object) => (string|string[]|null|undefined)} [options.cellClass] CSS class(es) for a cell
28
- * @param {(row: object) => (string|string[]|null|undefined)} [options.rowClass] CSS class(es) for a row
29
- * @param {boolean} [options.focusableRows=false] rows are reachable with Tab and, with `onRowClick`, opened with Enter and Space
30
- * @param {(row: object) => string} [options.rowLabel] aria-label of a focusable row
31
- * @param {"normal"|"compact"} [options.density="normal"]
32
- * @param {boolean} [options.wrap] true lets long text wrap, false keeps one line with an ellipsis (default: wrap, except in virtual tables)
33
- * @param {(query: {page: number, pageSize: number, cursor: *, sort: ({key: string, descending: boolean}|null), filter: string}) =>
34
- * Promise<{rows: object[], total?: number, nextCursor?: *}>} [options.dataSource] load the rows from a server instead of
35
- * keeping them all in the browser. Sorting, the filter box and the pager call it again. Answer with `total` for numbered pages
36
- * (`page` is 0-based), or with `nextCursor` for a "Load more" button (`cursor` is what the last answer gave, undefined for the
37
- * first request; the rows are appended). A failed request shows the error with a Retry button.
38
- * Together with `virtual` the list scrolls like one of `total` rows (every answer must carry `total`): the rows in view are asked for
39
- * in chunks of `chunkSize` (`page` is the chunk number), rows that have not arrived yet show a placeholder, and sorting or the filter
40
- * start again from the top.
41
- * @param {number} [options.chunkSize=50] rows per request of a data source with `virtual`
42
- * @param {boolean} [options.animateRows=false] rows slide to their new place when the table is sorted, filtered or changes page, and new rows fade in
43
- * (at most 60 rows are animated, none under reduced motion, none in a virtual table)
44
- * @param {number} [options.filterDelay=300] ms to wait after typing before the data source is asked
45
- * @param {{label: string, onclick: (row: object) => void, danger?: boolean, hidden?: (row: object) => boolean, ariaLabel?: (row: object) => string}[]} [options.rowActions]
46
- * a column of buttons at the end of every row
47
- * Column extras: `render(row, value)` returns text or a Node (built by the caller, so safe by construction), `align`
48
- * ("left" | "center" | "right"), `title` (false switches the tooltip with the full text off).
49
- * @returns {{element: HTMLElement, update: Function, destroy: Function, setRows: Function, getSelected: () => object[], clearSelection: Function,
50
- * getColumnWidths: () => Object<string, number>, toCsv: () => string, exportCsv: (filename?: string) => void}}
51
- */
52
- export function generateTable(options?: {
53
- parent?: string | Element;
54
- id?: string;
55
- class?: string;
56
- caption?: string;
57
- columns: {
58
- key: string;
59
- label?: string;
60
- width?: number;
61
- sortable?: boolean;
62
- editable?: boolean;
63
- format?: (value: any, row: any) => string;
64
- }[];
65
- rows?: object[];
66
- sortable?: boolean;
67
- filter?: boolean;
68
- pageSize?: number;
69
- selectable?: boolean;
70
- resizableColumns?: boolean;
71
- virtual?: {
72
- height?: number;
73
- rowHeight?: number;
74
- overscan?: number;
75
- } | boolean;
76
- onColumnResize?: (key: string, width: number) => void;
77
- onSelectionChange?: (rows: object[]) => void;
78
- onEdit?: (row: object, key: string, value: any, oldValue: any) => (boolean | void);
79
- onRowClick?: (row: object) => void;
80
- emptyText?: string;
81
- cellClass?: (row: object, column: object) => (string | string[] | null | undefined);
82
- rowClass?: (row: object) => (string | string[] | null | undefined);
83
- focusableRows?: boolean;
84
- rowLabel?: (row: object) => string;
85
- density?: "normal" | "compact";
86
- wrap?: boolean;
87
- dataSource?: (query: {
88
- page: number;
89
- pageSize: number;
90
- cursor: any;
91
- sort: ({
92
- key: string;
93
- descending: boolean;
94
- } | null);
95
- filter: string;
96
- }) => Promise<{
97
- rows: object[];
98
- total?: number;
99
- nextCursor?: any;
100
- }>;
101
- chunkSize?: number;
102
- animateRows?: boolean;
103
- filterDelay?: number;
104
- rowActions?: {
105
- label: string;
106
- onclick: (row: object) => void;
107
- danger?: boolean;
108
- hidden?: (row: object) => boolean;
109
- ariaLabel?: (row: object) => string;
110
- }[];
111
- }): {
112
- element: HTMLElement;
113
- update: Function;
114
- destroy: Function;
115
- setRows: Function;
116
- getSelected: () => object[];
117
- clearSelection: Function;
118
- getColumnWidths: () => {
119
- [x: string]: number;
120
- };
121
- toCsv: () => string;
122
- exportCsv: (filename?: string) => void;
123
- };
1
+ /**
2
+ * Generates a table (optional filter box, sortable headers, pagination, row selection, inline
3
+ * editing, resizable columns, virtual scrolling, CSV export) and appends it to its parent.
4
+ *
5
+ * @param {object} options
6
+ * @param {string|Element} [options.parent] id or element, defaults to "wrapper"
7
+ * @param {string} [options.id] id of the table wrapper (default: "table")
8
+ * @param {string} [options.class] extra CSS class of the table
9
+ * @param {string} [options.caption]
10
+ * @param {{key: string, label?: string, width?: number, sortable?: boolean, editable?: boolean, align?: "left"|"center"|"right", title?: boolean,
11
+ * format?: (value, row) => string, render?: (row: object, value) => (string|Node)}[]} options.columns
12
+ * `format` writes the text of a cell; `render` builds its content instead (a badge, a link, buttons: an element, or text). Every cell carries its column
13
+ * label in `data-label`, so a stylesheet can show a row as a block on a narrow screen, with the label next to the value.
14
+ * @param {object[]} [options.rows] row objects, read by column key
15
+ * @param {boolean} [options.sortable=true] click on a header sorts by it
16
+ * @param {boolean} [options.filter=false] show a text filter above the table
17
+ * @param {number} [options.pageSize=0] rows per page, 0 disables pagination
18
+ * @param {boolean} [options.selectable=false] checkbox column; the header checkbox selects every filtered row
19
+ * @param {boolean} [options.resizableColumns=false] drag the edge of a header (or use the arrow keys on it) to resize;
20
+ * double click resets the width
21
+ * @param {{height?: number, rowHeight?: number, overscan?: number}|boolean} [options.virtual] render only the rows
22
+ * in view, for lists of thousands of rows. Rows have a fixed height (default 36 px) and the table scrolls
23
+ * inside `height` (default 400 px). Replaces pagination.
24
+ * @param {(key: string, width: number) => void} [options.onColumnResize]
25
+ * @param {(rows: object[]) => void} [options.onSelectionChange]
26
+ * @param {(row: object, key: string, value, oldValue) => (boolean|void)} [options.onEdit] called after an edit
27
+ * of an `editable` column (double click, or Enter / F2 on the focused cell). Return false to reject it.
28
+ * @param {(row: object) => void} [options.onRowClick]
29
+ * @param {string} [options.emptyText]
30
+ * @param {(row: object, column: object) => (string|string[]|null|undefined)} [options.cellClass] CSS class(es) for a cell
31
+ * @param {(row: object) => (string|string[]|null|undefined)} [options.rowClass] CSS class(es) for a row
32
+ * @param {boolean} [options.focusableRows=false] rows are reachable with Tab and, with `onRowClick`, opened with Enter and Space
33
+ * @param {(row: object) => string} [options.rowLabel] aria-label of a focusable row
34
+ * @param {"normal"|"compact"} [options.density="normal"]
35
+ * @param {boolean} [options.wrap] true lets long text wrap, false keeps one line with an ellipsis (default: wrap, except in virtual tables)
36
+ * @param {(query: {page: number, pageSize: number, cursor: *, sort: ({key: string, descending: boolean}|null), filter: string}) =>
37
+ * Promise<{rows: object[], total?: number, nextCursor?: *}>} [options.dataSource] load the rows from a server instead of
38
+ * keeping them all in the browser. Sorting, the filter box and the pager call it again. Answer with `total` for numbered pages
39
+ * (`page` is 0-based), or with `nextCursor` for a "Load more" button (`cursor` is what the last answer gave, undefined for the
40
+ * first request; the rows are appended). A failed request shows the error with a Retry button.
41
+ * Together with `virtual` the list scrolls like one of `total` rows (every answer must carry `total`): the rows in view are asked for
42
+ * in chunks of `chunkSize` (`page` is the chunk number), rows that have not arrived yet show a placeholder, and sorting or the filter
43
+ * start again from the top.
44
+ * @param {number} [options.chunkSize=50] rows per request of a data source with `virtual`
45
+ * @param {boolean} [options.animateRows=false] rows slide to their new place when the table is sorted, filtered or changes page, and new rows fade in
46
+ * (at most 60 rows are animated, none under reduced motion, none in a virtual table)
47
+ * @param {number} [options.filterDelay=300] ms to wait after typing before the data source is asked
48
+ * @param {{label: string, onclick: (row: object) => void, danger?: boolean, hidden?: (row: object) => boolean, ariaLabel?: (row: object) => string}[]} [options.rowActions]
49
+ * a column of buttons at the end of every row
50
+ * Column extras: `render(row, value)` returns text or a Node (built by the caller, so safe by construction), `align`
51
+ * ("left" | "center" | "right"), `title` (false switches the tooltip with the full text off).
52
+ * @returns {{element: HTMLElement, update: Function, destroy: Function, setRows: Function, getSelected: () => object[], clearSelection: Function,
53
+ * getColumnWidths: () => Object<string, number>, toCsv: () => string, exportCsv: (filename?: string) => void}}
54
+ */
55
+ export function generateTable(options?: {
56
+ parent?: string | Element;
57
+ id?: string;
58
+ class?: string;
59
+ caption?: string;
60
+ columns: {
61
+ key: string;
62
+ label?: string;
63
+ width?: number;
64
+ sortable?: boolean;
65
+ editable?: boolean;
66
+ align?: "left" | "center" | "right";
67
+ title?: boolean;
68
+ format?: (value: any, row: any) => string;
69
+ render?: (row: object, value: any) => (string | Node);
70
+ }[];
71
+ rows?: object[];
72
+ sortable?: boolean;
73
+ filter?: boolean;
74
+ pageSize?: number;
75
+ selectable?: boolean;
76
+ resizableColumns?: boolean;
77
+ virtual?: {
78
+ height?: number;
79
+ rowHeight?: number;
80
+ overscan?: number;
81
+ } | boolean;
82
+ onColumnResize?: (key: string, width: number) => void;
83
+ onSelectionChange?: (rows: object[]) => void;
84
+ onEdit?: (row: object, key: string, value: any, oldValue: any) => (boolean | void);
85
+ onRowClick?: (row: object) => void;
86
+ emptyText?: string;
87
+ cellClass?: (row: object, column: object) => (string | string[] | null | undefined);
88
+ rowClass?: (row: object) => (string | string[] | null | undefined);
89
+ focusableRows?: boolean;
90
+ rowLabel?: (row: object) => string;
91
+ density?: "normal" | "compact";
92
+ wrap?: boolean;
93
+ dataSource?: (query: {
94
+ page: number;
95
+ pageSize: number;
96
+ cursor: any;
97
+ sort: ({
98
+ key: string;
99
+ descending: boolean;
100
+ } | null);
101
+ filter: string;
102
+ }) => Promise<{
103
+ rows: object[];
104
+ total?: number;
105
+ nextCursor?: any;
106
+ }>;
107
+ chunkSize?: number;
108
+ animateRows?: boolean;
109
+ filterDelay?: number;
110
+ rowActions?: {
111
+ label: string;
112
+ onclick: (row: object) => void;
113
+ danger?: boolean;
114
+ hidden?: (row: object) => boolean;
115
+ ariaLabel?: (row: object) => string;
116
+ }[];
117
+ }): {
118
+ element: HTMLElement;
119
+ update: Function;
120
+ destroy: Function;
121
+ setRows: Function;
122
+ getSelected: () => object[];
123
+ clearSelection: Function;
124
+ getColumnWidths: () => {
125
+ [x: string]: number;
126
+ };
127
+ toCsv: () => string;
128
+ exportCsv: (filename?: string) => void;
129
+ };