@universal-ember/table 3.6.1 → 3.6.2
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.
- package/declarations/-private/-type-tests/plugin-properties.test.d.ts +2 -0
- package/declarations/-private/-type-tests/plugin-properties.test.d.ts.map +1 -0
- package/declarations/-private/-type-tests/plugin-with.test.d.ts +2 -0
- package/declarations/-private/-type-tests/plugin-with.test.d.ts.map +1 -0
- package/declarations/-private/-type-tests/plugins-accessors.test.d.ts +2 -0
- package/declarations/-private/-type-tests/plugins-accessors.test.d.ts.map +1 -0
- package/declarations/-private/-type-tests/plugins-signature-from.test.d.ts +2 -0
- package/declarations/-private/-type-tests/plugins-signature-from.test.d.ts.map +1 -0
- package/declarations/-private/-type-tests/plugins-signature-utils.test.d.ts +2 -0
- package/declarations/-private/-type-tests/plugins-signature-utils.test.d.ts.map +1 -0
- package/declarations/-private/-type-tests/table-api.test.d.ts +2 -0
- package/declarations/-private/-type-tests/table-api.test.d.ts.map +1 -0
- package/declarations/-private/-type-tests/table-config.test.d.ts +2 -0
- package/declarations/-private/-type-tests/table-config.test.d.ts.map +1 -0
- package/declarations/-private/column.d.ts +18 -0
- package/declarations/-private/column.d.ts.map +1 -0
- package/declarations/-private/ember-compat.d.ts +8 -0
- package/declarations/-private/ember-compat.d.ts.map +1 -0
- package/declarations/-private/interfaces/column.d.ts +63 -0
- package/declarations/-private/interfaces/column.d.ts.map +1 -0
- package/declarations/-private/interfaces/index.d.ts +8 -0
- package/declarations/-private/interfaces/index.d.ts.map +1 -0
- package/declarations/-private/interfaces/modifier.d.ts +7 -0
- package/declarations/-private/interfaces/modifier.d.ts.map +1 -0
- package/declarations/-private/interfaces/pagination.d.ts +17 -0
- package/declarations/-private/interfaces/pagination.d.ts.map +1 -0
- package/declarations/-private/interfaces/plugins.d.ts +315 -0
- package/declarations/-private/interfaces/plugins.d.ts.map +1 -0
- package/declarations/-private/interfaces/preferences.d.ts +74 -0
- package/declarations/-private/interfaces/preferences.d.ts.map +1 -0
- package/declarations/-private/interfaces/selection.d.ts +36 -0
- package/declarations/-private/interfaces/selection.d.ts.map +1 -0
- package/declarations/-private/interfaces/table.d.ts +127 -0
- package/declarations/-private/interfaces/table.d.ts.map +1 -0
- package/declarations/-private/js-helper.d.ts +39 -0
- package/declarations/-private/js-helper.d.ts.map +1 -0
- package/declarations/-private/preferences.d.ts +47 -0
- package/declarations/-private/preferences.d.ts.map +1 -0
- package/declarations/-private/private-types.d.ts +6 -0
- package/declarations/-private/private-types.d.ts.map +1 -0
- package/declarations/-private/row.d.ts +12 -0
- package/declarations/-private/row.d.ts.map +1 -0
- package/declarations/-private/table.d.ts +136 -0
- package/declarations/-private/table.d.ts.map +1 -0
- package/declarations/-private/utils.d.ts +3 -0
- package/declarations/-private/utils.d.ts.map +1 -0
- package/declarations/index.d.ts +14 -0
- package/declarations/index.d.ts.map +1 -0
- package/declarations/plugins/-private/base.d.ts +281 -0
- package/declarations/plugins/-private/base.d.ts.map +1 -0
- package/declarations/plugins/-private/utils.d.ts +22 -0
- package/declarations/plugins/-private/utils.d.ts.map +1 -0
- package/declarations/plugins/column-reordering/helpers.d.ts +54 -0
- package/declarations/plugins/column-reordering/helpers.d.ts.map +1 -0
- package/declarations/plugins/column-reordering/index.d.ts +5 -0
- package/declarations/plugins/column-reordering/index.d.ts.map +1 -0
- package/declarations/plugins/column-reordering/plugin.d.ts +196 -0
- package/declarations/plugins/column-reordering/plugin.d.ts.map +1 -0
- package/declarations/plugins/column-reordering/utils.d.ts +8 -0
- package/declarations/plugins/column-reordering/utils.d.ts.map +1 -0
- package/declarations/plugins/column-resizing/handle.d.ts +128 -0
- package/declarations/plugins/column-resizing/handle.d.ts.map +1 -0
- package/declarations/plugins/column-resizing/helpers.d.ts +40 -0
- package/declarations/plugins/column-resizing/helpers.d.ts.map +1 -0
- package/declarations/plugins/column-resizing/index.d.ts +6 -0
- package/declarations/plugins/column-resizing/index.d.ts.map +1 -0
- package/declarations/plugins/column-resizing/plugin.d.ts +172 -0
- package/declarations/plugins/column-resizing/plugin.d.ts.map +1 -0
- package/declarations/plugins/column-resizing/resize-observer.d.ts +14 -0
- package/declarations/plugins/column-resizing/resize-observer.d.ts.map +1 -0
- package/declarations/plugins/column-resizing/utils.d.ts +22 -0
- package/declarations/plugins/column-resizing/utils.d.ts.map +1 -0
- package/declarations/plugins/column-visibility/helpers.d.ts +18 -0
- package/declarations/plugins/column-visibility/helpers.d.ts.map +1 -0
- package/declarations/plugins/column-visibility/index.d.ts +5 -0
- package/declarations/plugins/column-visibility/index.d.ts.map +1 -0
- package/declarations/plugins/column-visibility/plugin.d.ts +64 -0
- package/declarations/plugins/column-visibility/plugin.d.ts.map +1 -0
- package/declarations/plugins/data-sorting/helpers.d.ts +38 -0
- package/declarations/plugins/data-sorting/helpers.d.ts.map +1 -0
- package/declarations/plugins/data-sorting/index.d.ts +7 -0
- package/declarations/plugins/data-sorting/index.d.ts.map +1 -0
- package/declarations/plugins/data-sorting/plugin.d.ts +102 -0
- package/declarations/plugins/data-sorting/plugin.d.ts.map +1 -0
- package/declarations/plugins/data-sorting/types.d.ts +23 -0
- package/declarations/plugins/data-sorting/types.d.ts.map +1 -0
- package/declarations/plugins/index.d.ts +6 -0
- package/declarations/plugins/index.d.ts.map +1 -0
- package/declarations/plugins/metadata/helpers.d.ts +4 -0
- package/declarations/plugins/metadata/helpers.d.ts.map +1 -0
- package/declarations/plugins/metadata/index.d.ts +5 -0
- package/declarations/plugins/metadata/index.d.ts.map +1 -0
- package/declarations/plugins/metadata/plugin.d.ts +25 -0
- package/declarations/plugins/metadata/plugin.d.ts.map +1 -0
- package/declarations/plugins/row-selection/helpers.d.ts +6 -0
- package/declarations/plugins/row-selection/helpers.d.ts.map +1 -0
- package/declarations/plugins/row-selection/index.d.ts +5 -0
- package/declarations/plugins/row-selection/index.d.ts.map +1 -0
- package/declarations/plugins/row-selection/plugin.d.ts +80 -0
- package/declarations/plugins/row-selection/plugin.d.ts.map +1 -0
- package/declarations/plugins/sticky-columns/helpers.d.ts +17 -0
- package/declarations/plugins/sticky-columns/helpers.d.ts.map +1 -0
- package/declarations/plugins/sticky-columns/index.d.ts +5 -0
- package/declarations/plugins/sticky-columns/index.d.ts.map +1 -0
- package/declarations/plugins/sticky-columns/plugin.d.ts +70 -0
- package/declarations/plugins/sticky-columns/plugin.d.ts.map +1 -0
- package/declarations/test-support/index.d.ts +15 -0
- package/declarations/test-support/index.d.ts.map +1 -0
- package/declarations/utils.d.ts +26 -0
- package/declarations/utils.d.ts.map +1 -0
- package/dist/-private/-type-tests/plugin-properties.test.js +27 -0
- package/dist/-private/-type-tests/plugin-properties.test.js.map +1 -0
- package/dist/-private/-type-tests/plugin-with.test.js +20 -0
- package/dist/-private/-type-tests/plugin-with.test.js.map +1 -0
- package/dist/-private/-type-tests/plugins-accessors.test.js +36 -0
- package/dist/-private/-type-tests/plugins-accessors.test.js.map +1 -0
- package/dist/-private/-type-tests/plugins-signature-from.test.js +15 -0
- package/dist/-private/-type-tests/plugins-signature-from.test.js.map +1 -0
- package/dist/-private/-type-tests/plugins-signature-utils.test.js +36 -0
- package/dist/-private/-type-tests/plugins-signature-utils.test.js.map +1 -0
- package/dist/-private/-type-tests/table-api.test.js +17 -0
- package/dist/-private/-type-tests/table-api.test.js.map +1 -0
- package/dist/-private/-type-tests/table-config.test.js +55 -0
- package/dist/-private/-type-tests/table-config.test.js.map +1 -0
- package/dist/-private/column.js +62 -0
- package/dist/-private/column.js.map +1 -0
- package/dist/-private/ember-compat.js +17 -0
- package/dist/-private/ember-compat.js.map +1 -0
- package/dist/-private/interfaces/column.js +2 -0
- package/dist/-private/interfaces/column.js.map +1 -0
- package/dist/-private/interfaces/index.js +2 -0
- package/dist/-private/interfaces/index.js.map +1 -0
- package/dist/-private/interfaces/modifier.js +2 -0
- package/dist/-private/interfaces/modifier.js.map +1 -0
- package/dist/-private/interfaces/pagination.js +2 -0
- package/dist/-private/interfaces/pagination.js.map +1 -0
- package/dist/-private/interfaces/plugins.js +2 -0
- package/dist/-private/interfaces/plugins.js.map +1 -0
- package/dist/-private/interfaces/preferences.js +2 -0
- package/dist/-private/interfaces/preferences.js.map +1 -0
- package/dist/-private/interfaces/selection.js +2 -0
- package/dist/-private/interfaces/selection.js.map +1 -0
- package/dist/-private/interfaces/table.js +2 -0
- package/dist/-private/interfaces/table.js.map +1 -0
- package/dist/-private/js-helper.js +55 -0
- package/dist/-private/js-helper.js.map +1 -0
- package/dist/-private/preferences.js +149 -0
- package/dist/-private/preferences.js.map +1 -0
- package/dist/-private/private-types.js +2 -0
- package/dist/-private/private-types.js.map +1 -0
- package/dist/-private/row.js +51 -0
- package/dist/-private/row.js.map +1 -0
- package/dist/-private/table.js +276 -0
- package/dist/-private/table.js.map +1 -0
- package/dist/-private/utils.js +15 -0
- package/dist/-private/utils.js.map +1 -0
- package/dist/_rollupPluginBabelHelpers-CjaRjJZX.js +63 -0
- package/dist/_rollupPluginBabelHelpers-CjaRjJZX.js.map +1 -0
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -0
- package/dist/plugins/-private/base.js +532 -0
- package/dist/plugins/-private/base.js.map +1 -0
- package/dist/plugins/-private/utils.js +103 -0
- package/dist/plugins/-private/utils.js.map +1 -0
- package/dist/plugins/column-reordering/helpers.js +81 -0
- package/dist/plugins/column-reordering/helpers.js.map +1 -0
- package/dist/plugins/column-reordering/index.js +3 -0
- package/dist/plugins/column-reordering/index.js.map +1 -0
- package/dist/plugins/column-reordering/plugin.js +451 -0
- package/dist/plugins/column-reordering/plugin.js.map +1 -0
- package/dist/plugins/column-reordering/utils.js +34 -0
- package/dist/plugins/column-reordering/utils.js.map +1 -0
- package/dist/plugins/column-resizing/handle.js +243 -0
- package/dist/plugins/column-resizing/handle.js.map +1 -0
- package/dist/plugins/column-resizing/helpers.js +77 -0
- package/dist/plugins/column-resizing/helpers.js.map +1 -0
- package/dist/plugins/column-resizing/index.js +4 -0
- package/dist/plugins/column-resizing/index.js.map +1 -0
- package/dist/plugins/column-resizing/plugin.js +365 -0
- package/dist/plugins/column-resizing/plugin.js.map +1 -0
- package/dist/plugins/column-resizing/resize-observer.js +44 -0
- package/dist/plugins/column-resizing/resize-observer.js.map +1 -0
- package/dist/plugins/column-resizing/utils.js +44 -0
- package/dist/plugins/column-resizing/utils.js.map +1 -0
- package/dist/plugins/column-visibility/helpers.js +25 -0
- package/dist/plugins/column-visibility/helpers.js.map +1 -0
- package/dist/plugins/column-visibility/index.js +3 -0
- package/dist/plugins/column-visibility/index.js.map +1 -0
- package/dist/plugins/column-visibility/plugin.js +92 -0
- package/dist/plugins/column-visibility/plugin.js.map +1 -0
- package/dist/plugins/data-sorting/helpers.js +49 -0
- package/dist/plugins/data-sorting/helpers.js.map +1 -0
- package/dist/plugins/data-sorting/index.js +4 -0
- package/dist/plugins/data-sorting/index.js.map +1 -0
- package/dist/plugins/data-sorting/plugin.js +132 -0
- package/dist/plugins/data-sorting/plugin.js.map +1 -0
- package/dist/plugins/data-sorting/types.js +14 -0
- package/dist/plugins/data-sorting/types.js.map +1 -0
- package/dist/plugins/index.js +3 -0
- package/dist/plugins/index.js.map +1 -0
- package/dist/plugins/metadata/helpers.js +12 -0
- package/dist/plugins/metadata/helpers.js.map +1 -0
- package/dist/plugins/metadata/index.js +3 -0
- package/dist/plugins/metadata/index.js.map +1 -0
- package/dist/plugins/metadata/plugin.js +25 -0
- package/dist/plugins/metadata/plugin.js.map +1 -0
- package/dist/plugins/row-selection/helpers.js +10 -0
- package/dist/plugins/row-selection/helpers.js.map +1 -0
- package/dist/plugins/row-selection/index.js +3 -0
- package/dist/plugins/row-selection/index.js.map +1 -0
- package/dist/plugins/row-selection/plugin.js +118 -0
- package/dist/plugins/row-selection/plugin.js.map +1 -0
- package/dist/plugins/sticky-columns/helpers.js +49 -0
- package/dist/plugins/sticky-columns/helpers.js.map +1 -0
- package/dist/plugins/sticky-columns/index.js +3 -0
- package/dist/plugins/sticky-columns/index.js.map +1 -0
- package/dist/plugins/sticky-columns/plugin.js +139 -0
- package/dist/plugins/sticky-columns/plugin.js.map +1 -0
- package/dist/test-support/index.js +62 -0
- package/dist/test-support/index.js.map +1 -0
- package/dist/utils.js +77 -0
- package/dist/utils.js.map +1 -0
- package/package.json +2 -2
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin-properties.test.d.ts","sourceRoot":"","sources":["../../../src/-private/-type-tests/plugin-properties.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin-with.test.d.ts","sourceRoot":"","sources":["../../../src/-private/-type-tests/plugin-with.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugins-accessors.test.d.ts","sourceRoot":"","sources":["../../../src/-private/-type-tests/plugins-accessors.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugins-signature-from.test.d.ts","sourceRoot":"","sources":["../../../src/-private/-type-tests/plugins-signature-from.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugins-signature-utils.test.d.ts","sourceRoot":"","sources":["../../../src/-private/-type-tests/plugins-signature-utils.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"table-api.test.d.ts","sourceRoot":"","sources":["../../../src/-private/-type-tests/table-api.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"table-config.test.d.ts","sourceRoot":"","sources":["../../../src/-private/-type-tests/table-config.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { Row } from './row';
|
|
2
|
+
import type { Table } from './table';
|
|
3
|
+
import type { ContentValue } from '@glint/template';
|
|
4
|
+
import type { ColumnConfig } from './interfaces';
|
|
5
|
+
export declare class Column<T = unknown> {
|
|
6
|
+
table: Table<T>;
|
|
7
|
+
config: ColumnConfig<T>;
|
|
8
|
+
get Cell(): import("@glint/template").ComponentLike<import("./interfaces").CellContext<T>> | undefined;
|
|
9
|
+
get key(): string;
|
|
10
|
+
get name(): string | undefined;
|
|
11
|
+
constructor(table: Table<T>, config: ColumnConfig<T>);
|
|
12
|
+
getValueForRow(row: Row<T>): ContentValue;
|
|
13
|
+
private getDefaultValue;
|
|
14
|
+
getOptionsForRow(row: Row<T>): {
|
|
15
|
+
defaultValue: string;
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=column.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"column.d.ts","sourceRoot":"","sources":["../../src/-private/column.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AACjC,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AACpD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAQjD,qBAAa,MAAM,CAAC,CAAC,GAAG,OAAO;IAcpB,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC;IACf,MAAM,EAAE,YAAY,CAAC,CAAC,CAAC;IAdhC,IAAI,IAAI,+FAEP;IAED,IAAI,GAAG,WAEN;IAED,IAAI,IAAI,uBAEP;gBAGQ,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC,EACf,MAAM,EAAE,YAAY,CAAC,CAAC,CAAC;IAIhC,cAAc,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC,CAAC,GAAG,YAAY;IAoBzC,OAAO,CAAC,eAAe;IAKvB,gBAAgB,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC,CAAC;;;CAY7B"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type Owner from '@ember/owner';
|
|
2
|
+
interface CompatOwner {
|
|
3
|
+
getOwner: (context: unknown) => Owner | undefined;
|
|
4
|
+
setOwner: (context: unknown, owner: Owner) => void;
|
|
5
|
+
}
|
|
6
|
+
export declare const compatOwner: CompatOwner;
|
|
7
|
+
export {};
|
|
8
|
+
//# sourceMappingURL=ember-compat.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ember-compat.d.ts","sourceRoot":"","sources":["../../src/-private/ember-compat.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,KAAK,MAAM,cAAc,CAAC;AAEtC,UAAU,WAAW;IACnB,QAAQ,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,KAAK,GAAG,SAAS,CAAC;IAClD,QAAQ,EAAE,CAAC,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;CACpD;AAED,eAAO,MAAM,WAAW,EAAS,WAAW,CAAC"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import type { BasePlugin, Plugin } from '../../plugins';
|
|
2
|
+
import type { Column } from '../column';
|
|
3
|
+
import type { Row } from '../row';
|
|
4
|
+
import type { ColumnOptionsFor, SignatureFrom } from './plugins';
|
|
5
|
+
import type { Constructor } from '../private-types';
|
|
6
|
+
import type { ComponentLike, ContentValue } from '@glint/template';
|
|
7
|
+
export interface CellContext<T> {
|
|
8
|
+
column: Column<T>;
|
|
9
|
+
row: Row<T>;
|
|
10
|
+
}
|
|
11
|
+
type ColumnPluginOption<P = Plugin> = P extends BasePlugin ? [Constructor<P>, () => ColumnOptionsFor<SignatureFrom<P>>] : [P | Constructor<P>, () => unknown];
|
|
12
|
+
export type CellOptions = {
|
|
13
|
+
/**
|
|
14
|
+
* when no value is present for a given set of data for the given column config
|
|
15
|
+
*/
|
|
16
|
+
defaultValue?: string;
|
|
17
|
+
} & Record<string, unknown>;
|
|
18
|
+
export interface ColumnConfig<T = unknown> {
|
|
19
|
+
/**
|
|
20
|
+
* the `key` is required for preferences storage, as well as
|
|
21
|
+
* managing uniqueness of the columns in an easy-to-understand way.
|
|
22
|
+
*
|
|
23
|
+
* key may be anything if a `value` is provided, but _should_
|
|
24
|
+
* be a property-path on each data object passed to the table.
|
|
25
|
+
*
|
|
26
|
+
* @example `someObj.property.path`
|
|
27
|
+
* @example `someProperty`
|
|
28
|
+
*/
|
|
29
|
+
key: string;
|
|
30
|
+
/**
|
|
31
|
+
* Optionally provide a function to determine the value of a row at this column
|
|
32
|
+
*/
|
|
33
|
+
value?: (context: CellContext<T>) => ContentValue;
|
|
34
|
+
/**
|
|
35
|
+
* Recommended property to use for custom components for each cell per column.
|
|
36
|
+
* Out-of-the-box, this property isn't used, but the provided type may be
|
|
37
|
+
* a convenience for consumers of the headless table
|
|
38
|
+
*/
|
|
39
|
+
Cell?: ComponentLike<CellContext<T>>;
|
|
40
|
+
/**
|
|
41
|
+
* The name or title of the column, shown in the column heading / th
|
|
42
|
+
*/
|
|
43
|
+
name?: string;
|
|
44
|
+
/**
|
|
45
|
+
* Bag of extra properties to pass to Cell via `@options`, if desired
|
|
46
|
+
*/
|
|
47
|
+
options?: (context: CellContext<T>) => CellOptions;
|
|
48
|
+
/**
|
|
49
|
+
* Each plugin may provide column options, and provides similar syntax to how
|
|
50
|
+
* options for the table are specified in the plugins entry,
|
|
51
|
+
*
|
|
52
|
+
* ```js
|
|
53
|
+
* pluginOptions: [
|
|
54
|
+
* ColumnVisibility.forColumn(() => ({ isVisible: false })),
|
|
55
|
+
* StickyColumns.forColumn(() => ({ sticky: 'right' })),
|
|
56
|
+
* ],
|
|
57
|
+
* ```
|
|
58
|
+
*/
|
|
59
|
+
pluginOptions?: ColumnPluginOption[];
|
|
60
|
+
}
|
|
61
|
+
export type ColumnKey<T> = NonNullable<ColumnConfig<T>['key']>;
|
|
62
|
+
export {};
|
|
63
|
+
//# sourceMappingURL=column.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"column.d.ts","sourceRoot":"","sources":["../../../src/-private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,MAAM,CAAC;IAEd;;OAEG;IACH,OAAO,CAAC,EAAE,CAAC,OAAO,EAAE,WAAW,CAAC,CAAC,CAAC,KAAK,WAAW,CAAC;IAEnD;;;;;;;;;;OAUG;IACH,aAAa,CAAC,EAAE,kBAAkB,EAAE,CAAC;CACtC;AAED,MAAM,MAAM,SAAS,CAAC,CAAC,IAAI,WAAW,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export * from './column.ts';
|
|
2
|
+
export * from './modifier.ts';
|
|
3
|
+
export * from './pagination.ts';
|
|
4
|
+
export * from './plugins.ts';
|
|
5
|
+
export * from './preferences.ts';
|
|
6
|
+
export * from './selection.ts';
|
|
7
|
+
export * from './table.ts';
|
|
8
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/-private/interfaces/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,eAAe,CAAC;AAC9B,cAAc,iBAAiB,CAAC;AAChC,cAAc,cAAc,CAAC;AAC7B,cAAc,kBAAkB,CAAC;AACjC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,YAAY,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"modifier.d.ts","sourceRoot":"","sources":["../../../src/-private/interfaces/modifier.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,UAAU;IACzB,IAAI,IAAI,CAAC;CACV;AAED,MAAM,WAAW,gBAAgB,CAAC,IAAI,SAAS,OAAO,EAAE;IACtD,CAAC,OAAO,EAAE,WAAW,EAAE,GAAG,IAAI,EAAE,IAAI,GAAG,IAAI,GAAG,UAAU,CAAC;CAC1D"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export interface Pagination {
|
|
2
|
+
formatItemSummary?: (data: {
|
|
3
|
+
end: number;
|
|
4
|
+
start: number;
|
|
5
|
+
totalItems: number;
|
|
6
|
+
}) => string;
|
|
7
|
+
onChange: (value: {
|
|
8
|
+
page: number;
|
|
9
|
+
pageSize: number;
|
|
10
|
+
}) => Promise<void> | void;
|
|
11
|
+
page: number;
|
|
12
|
+
pageSize: number;
|
|
13
|
+
pageSizeLabel?: string;
|
|
14
|
+
pageSizes?: number[];
|
|
15
|
+
totalItems: number;
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=pagination.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pagination.d.ts","sourceRoot":"","sources":["../../../src/-private/interfaces/pagination.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,UAAU;IACzB,iBAAiB,CAAC,EAAE,CAAC,IAAI,EAAE;QACzB,GAAG,EAAE,MAAM,CAAC;QACZ,KAAK,EAAE,MAAM,CAAC;QACd,UAAU,EAAE,MAAM,CAAC;KACpB,KAAK,MAAM,CAAC;IACb,QAAQ,EAAE,CAAC,KAAK,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAA;KAAE,KAAK,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;IAC9E,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;IACrB,UAAU,EAAE,MAAM,CAAC;CACpB"}
|
|
@@ -0,0 +1,315 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* NOTE:
|
|
3
|
+
* Empty, EmptyObject, and GetOrElse are copied from @glimmer/component
|
|
4
|
+
*/
|
|
5
|
+
import type { Constructor } from '../../-private/private-types.ts';
|
|
6
|
+
import type { Column, Row, Table } from '../../index.ts';
|
|
7
|
+
import type { Destructor } from '../../-private/interfaces';
|
|
8
|
+
type DataTypeOf<T> = T extends Table<infer DataType> ? DataType : T;
|
|
9
|
+
/**
|
|
10
|
+
* @private utility class
|
|
11
|
+
*
|
|
12
|
+
* This class exists because there isn't a way to, in TS,
|
|
13
|
+
* get access to static properties from an instance type
|
|
14
|
+
*/
|
|
15
|
+
export type PluginClass<PluginType> = PluginType & {
|
|
16
|
+
new: (...args: unknown[]) => PluginType;
|
|
17
|
+
features?: string[];
|
|
18
|
+
requires?: string[];
|
|
19
|
+
};
|
|
20
|
+
export type PluginSubclassInstance<PluginType> = PluginType & {
|
|
21
|
+
constructor: PluginClass<PluginType>;
|
|
22
|
+
};
|
|
23
|
+
/**
|
|
24
|
+
* @public
|
|
25
|
+
*
|
|
26
|
+
* The data passed to a plugin's column APIs
|
|
27
|
+
*/
|
|
28
|
+
export interface ColumnApi<T extends Table = Table> {
|
|
29
|
+
column: Column<DataTypeOf<T>>;
|
|
30
|
+
table: T;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* @public
|
|
34
|
+
*
|
|
35
|
+
* The data passed to a plugin's row APIs
|
|
36
|
+
*/
|
|
37
|
+
export interface RowApi<T extends Table = Table> {
|
|
38
|
+
row: Row<DataTypeOf<T>>;
|
|
39
|
+
table: T;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* @private utility type
|
|
43
|
+
*
|
|
44
|
+
* Note that this exists here, and the Plugin interface exists in general
|
|
45
|
+
* because we need to derive types in a static context on BasePlugin,
|
|
46
|
+
* and the source of types need to exist somewhere other than BasePlugin,
|
|
47
|
+
* so that:
|
|
48
|
+
* - inference will work
|
|
49
|
+
* - we avoid infinite recursive type definitions
|
|
50
|
+
*/
|
|
51
|
+
export type SignatureFrom<Klass extends Plugin<any>> = Klass extends Plugin<infer Signature> ? Signature : never;
|
|
52
|
+
/**
|
|
53
|
+
* @public
|
|
54
|
+
*
|
|
55
|
+
* Table plugins are stateless objects that optionally provide hooks based on what
|
|
56
|
+
* the plugin wishes to modify.
|
|
57
|
+
*
|
|
58
|
+
* If state is desired, Metadata classes may be provided to manage that state.
|
|
59
|
+
* As a convenience, when the meta classes are instantiated, they'll be given the same
|
|
60
|
+
* `owner` as everything else in the application, so service injection will be available
|
|
61
|
+
* within the meta class instances.
|
|
62
|
+
*
|
|
63
|
+
* A plugin can provide components that the consuming Table can opt in to rendering.
|
|
64
|
+
* (though, often these components will be required to be rendered for the plugin to work)
|
|
65
|
+
*
|
|
66
|
+
* a `Plugin` has one type argument:
|
|
67
|
+
* - Signature - which can provide optional information about the Meta/State and Options the plugin can take
|
|
68
|
+
*
|
|
69
|
+
* Any particular plugin instantiation will have at most 1 instance of their TableMeta
|
|
70
|
+
* and `n` instances of their ColumnMeta, where `n` is at most the number of columns.
|
|
71
|
+
*/
|
|
72
|
+
export interface Plugin<Signature = unknown> {
|
|
73
|
+
/**
|
|
74
|
+
* Unique name for the plugin.
|
|
75
|
+
* - only one plugin of the same name is allowed
|
|
76
|
+
* - the name is used for storing preferences / serializable information
|
|
77
|
+
*/
|
|
78
|
+
name: string;
|
|
79
|
+
/**
|
|
80
|
+
* Some plugins may require that other plugins be present.
|
|
81
|
+
* and because plugins can be interchangeable, the features implemented
|
|
82
|
+
* by those plugins must be declared via strings so that we can have
|
|
83
|
+
* a semi-stable reference that isn't tied to object equality or anything like that.
|
|
84
|
+
*
|
|
85
|
+
* This enables, for example, the StickyColumns plugin to work with different implementations of the ColumnResizing plugin (such as one
|
|
86
|
+
* might have between an aria-grid and a data table)
|
|
87
|
+
*/
|
|
88
|
+
features?: string[];
|
|
89
|
+
/**
|
|
90
|
+
* List of features to lookup "somewhere" in the list of plugins
|
|
91
|
+
* order does not matter.
|
|
92
|
+
*/
|
|
93
|
+
requires?: string[];
|
|
94
|
+
/**
|
|
95
|
+
* Optional state that this plugin may or may not choose to use
|
|
96
|
+
*
|
|
97
|
+
* columns will each have an instance of meta.column.
|
|
98
|
+
* the table will have only one instance of meta.table.
|
|
99
|
+
*/
|
|
100
|
+
meta?: {
|
|
101
|
+
/**
|
|
102
|
+
* @public
|
|
103
|
+
*
|
|
104
|
+
* Specifies the class definition to use for storing column-related state / behavior for this plugin
|
|
105
|
+
*/
|
|
106
|
+
column?: Constructor<ColumnMetaFor<Signature>>;
|
|
107
|
+
/**
|
|
108
|
+
* @public
|
|
109
|
+
*
|
|
110
|
+
* Specifies the class definition to use for storing table-related state / behavior for this plugin
|
|
111
|
+
*/
|
|
112
|
+
table?: Constructor<TableMetaFor<Signature>>;
|
|
113
|
+
/**
|
|
114
|
+
* @public
|
|
115
|
+
*
|
|
116
|
+
* Specifies the class definition to use for storing the row-related state / behavior for this plugin
|
|
117
|
+
*/
|
|
118
|
+
row?: Constructor<RowMetaFor<Signature>>;
|
|
119
|
+
};
|
|
120
|
+
/**
|
|
121
|
+
* @public
|
|
122
|
+
* @kind Column property
|
|
123
|
+
*
|
|
124
|
+
* Specify a modifier setup/teardown function to attach to each of the header cells
|
|
125
|
+
*
|
|
126
|
+
* Can be used to add / remove attributes, event listeners, etc
|
|
127
|
+
*/
|
|
128
|
+
headerCellModifier?: (element: HTMLElement, ...args: [ColumnApi<Table<any>>]) => void | Destructor;
|
|
129
|
+
/**
|
|
130
|
+
* @public
|
|
131
|
+
* @kind Row property
|
|
132
|
+
*
|
|
133
|
+
* Specify a modifier setup/teardown function to attach to each of the rows
|
|
134
|
+
*
|
|
135
|
+
* Can be used to add / remove attributes, event listeners, etc
|
|
136
|
+
*/
|
|
137
|
+
rowModifier?: (element: HTMLElement, ...args: [RowApi<Table<any>>]) => void | Destructor;
|
|
138
|
+
/**
|
|
139
|
+
* @public
|
|
140
|
+
* @kind Table hook
|
|
141
|
+
*
|
|
142
|
+
* Specify a modifier setup/teardown function to attach to the table's containing element
|
|
143
|
+
*/
|
|
144
|
+
containerModifier?: (element: HTMLElement, ...args: [Table<any>]) => void | Destructor;
|
|
145
|
+
/**
|
|
146
|
+
* @public
|
|
147
|
+
* @kind Table Hook
|
|
148
|
+
*
|
|
149
|
+
* If the plugin has state, this should be used to reset that state
|
|
150
|
+
*/
|
|
151
|
+
reset?: () => void;
|
|
152
|
+
/**
|
|
153
|
+
* @public
|
|
154
|
+
* @kind Table Hook
|
|
155
|
+
*
|
|
156
|
+
* A plugin may change the columns order, visibility, etc.
|
|
157
|
+
* By implementing this getter, this plugin's
|
|
158
|
+
* `columns` property will be used by other plugins via
|
|
159
|
+
* the `columns.for(table, RequestingPlugin)` api.
|
|
160
|
+
*
|
|
161
|
+
* For the end-consumer, they may choose to do
|
|
162
|
+
* `columns.for(table)`, which will aggregate all column modifications
|
|
163
|
+
* from all plugins.
|
|
164
|
+
*
|
|
165
|
+
* As always, `table.columns` is the way to get the unmodified list of columns.
|
|
166
|
+
*/
|
|
167
|
+
columns?: Column<any>[];
|
|
168
|
+
}
|
|
169
|
+
/**
|
|
170
|
+
* @private utility type
|
|
171
|
+
*/
|
|
172
|
+
type GetOrElse<Obj, K, Fallback> = K extends keyof Obj ? Obj[K] : Fallback;
|
|
173
|
+
/**
|
|
174
|
+
* @public
|
|
175
|
+
*
|
|
176
|
+
* utility class to help with autocompletion / documentation
|
|
177
|
+
* in the editor while while defining the signature of custom plugins.
|
|
178
|
+
*/
|
|
179
|
+
export interface PluginSignature {
|
|
180
|
+
/**
|
|
181
|
+
* Meta is how plugins can manage per-{table,columns,rows}
|
|
182
|
+
* state, event listeners, and general public API
|
|
183
|
+
*/
|
|
184
|
+
Meta?: {
|
|
185
|
+
/**
|
|
186
|
+
* If a plugin has Table meta/state,
|
|
187
|
+
* the shape of that state can be described here
|
|
188
|
+
*/
|
|
189
|
+
Table?: unknown;
|
|
190
|
+
/**
|
|
191
|
+
* If a plugin has Column meta/state,
|
|
192
|
+
* the shape of that state can be described here
|
|
193
|
+
*/
|
|
194
|
+
Column?: unknown;
|
|
195
|
+
/**
|
|
196
|
+
* If a plugin has Row meta/state,
|
|
197
|
+
* the shape of that state can be described here
|
|
198
|
+
*/
|
|
199
|
+
Row?: unknown;
|
|
200
|
+
};
|
|
201
|
+
Options?: {
|
|
202
|
+
/**
|
|
203
|
+
* If a plugin has options configurable for the whole table,
|
|
204
|
+
* those can be specified here.
|
|
205
|
+
*
|
|
206
|
+
* These are passed via the the `withOptions` API
|
|
207
|
+
*
|
|
208
|
+
* ```js
|
|
209
|
+
* headlessTable(this?, {
|
|
210
|
+
* // ...
|
|
211
|
+
* plugins: [
|
|
212
|
+
* MyPlugin.withOptions(() => {
|
|
213
|
+
* // the return value here is this is Signature['Options']['Plugin']
|
|
214
|
+
* return {};
|
|
215
|
+
* })
|
|
216
|
+
* ]
|
|
217
|
+
* })
|
|
218
|
+
* ```
|
|
219
|
+
*/
|
|
220
|
+
Plugin?: unknown;
|
|
221
|
+
/**
|
|
222
|
+
* If a plugin has options configurable per column,
|
|
223
|
+
* those can be specified here
|
|
224
|
+
*
|
|
225
|
+
* These are passed via the the `forColumn` API
|
|
226
|
+
*
|
|
227
|
+
* ```js
|
|
228
|
+
* headlessTable(this?, {
|
|
229
|
+
* // ...
|
|
230
|
+
* columns: () => [
|
|
231
|
+
* MyPlugin.forColumn(() => {
|
|
232
|
+
* // the return value here is this is Signature['Options']['Column']
|
|
233
|
+
* return {};
|
|
234
|
+
* })
|
|
235
|
+
* ]
|
|
236
|
+
* })
|
|
237
|
+
* ```
|
|
238
|
+
*/
|
|
239
|
+
Column?: unknown;
|
|
240
|
+
};
|
|
241
|
+
}
|
|
242
|
+
/**
|
|
243
|
+
* @private default type
|
|
244
|
+
*
|
|
245
|
+
* Describes the shape of all the dynamic parts of a Plugin.
|
|
246
|
+
*
|
|
247
|
+
* There are no row options, because rows are not statically configurable.
|
|
248
|
+
*/
|
|
249
|
+
export interface DefaultPluginSignature {
|
|
250
|
+
Meta: {
|
|
251
|
+
Row: unknown;
|
|
252
|
+
Column: unknown;
|
|
253
|
+
Table: unknown;
|
|
254
|
+
};
|
|
255
|
+
Options: {
|
|
256
|
+
Plugin: unknown;
|
|
257
|
+
Column: unknown;
|
|
258
|
+
};
|
|
259
|
+
}
|
|
260
|
+
/**
|
|
261
|
+
* @private utility type
|
|
262
|
+
*/
|
|
263
|
+
export type TableMetaFor<Signature> = Signature extends {
|
|
264
|
+
Meta: {
|
|
265
|
+
Table: unknown;
|
|
266
|
+
};
|
|
267
|
+
} ? GetOrElse<Signature['Meta'], 'Table', never> : never;
|
|
268
|
+
/**
|
|
269
|
+
* @private utility type
|
|
270
|
+
*/
|
|
271
|
+
export type ColumnMetaFor<Signature> = Signature extends {
|
|
272
|
+
Meta: {
|
|
273
|
+
Column: unknown;
|
|
274
|
+
};
|
|
275
|
+
} ? GetOrElse<Signature['Meta'], 'Column', never> : never;
|
|
276
|
+
/**
|
|
277
|
+
* @private utility type
|
|
278
|
+
*/
|
|
279
|
+
export type RowMetaFor<Signature> = Signature extends {
|
|
280
|
+
Meta: {
|
|
281
|
+
Row: unknown;
|
|
282
|
+
};
|
|
283
|
+
} ? GetOrElse<Signature['Meta'], 'Row', never> : never;
|
|
284
|
+
/**
|
|
285
|
+
* @private utility type
|
|
286
|
+
*/
|
|
287
|
+
export type OptionsFor<Signature> = Signature extends {
|
|
288
|
+
Options: object;
|
|
289
|
+
} ? GetOrElse<Signature['Options'], 'Plugin', EmptyObject> : EmptyObject;
|
|
290
|
+
/**
|
|
291
|
+
* @private utility type
|
|
292
|
+
*/
|
|
293
|
+
export type ColumnOptionsFor<Signature> = Signature extends {
|
|
294
|
+
Options: object;
|
|
295
|
+
} ? GetOrElse<Signature['Options'], 'Column', EmptyObject> : EmptyObject;
|
|
296
|
+
declare const Empty: unique symbol;
|
|
297
|
+
/**
|
|
298
|
+
* This provides us a way to have a "fallback" which represents an empty object,
|
|
299
|
+
* without the downsides of how TS treats `{}`. Specifically: this will
|
|
300
|
+
* correctly leverage "excess property checking" so that, given a component
|
|
301
|
+
* which has no named args, if someone invokes it with any named args, they will
|
|
302
|
+
* get a type error.
|
|
303
|
+
*
|
|
304
|
+
* @internal This is exported so declaration emit works (if it were not emitted,
|
|
305
|
+
* declarations which fall back to it would not work). It is *not* intended for
|
|
306
|
+
* public usage, and the specific mechanics it uses may change at any time.
|
|
307
|
+
* The location of this export *is* part of the public API, because moving it
|
|
308
|
+
* will break existing declarations, but is not legal for end users to import
|
|
309
|
+
* themselves, so ***DO NOT RELY ON IT***.
|
|
310
|
+
*/
|
|
311
|
+
export type EmptyObject = {
|
|
312
|
+
[Empty]?: true;
|
|
313
|
+
};
|
|
314
|
+
export {};
|
|
315
|
+
//# sourceMappingURL=plugins.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugins.d.ts","sourceRoot":"","sources":["../../../src/-private/interfaces/plugins.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AACnE,OAAO,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AACzD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAE5D,KAAK,UAAU,CAAC,CAAC,IAAI,CAAC,SAAS,KAAK,CAAC,MAAM,QAAQ,CAAC,GAAG,QAAQ,GAAG,CAAC,CAAC;AAEpE;;;;;GAKG;AACH,MAAM,MAAM,WAAW,CAAC,UAAU,IAAI,UAAU,GAAG;IACjD,GAAG,EAAE,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,UAAU,CAAC;IACxC,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;CACrB,CAAC;AAEF,MAAM,MAAM,sBAAsB,CAAC,UAAU,IAAI,UAAU,GAAG;IAC5D,WAAW,EAAE,WAAW,CAAC,UAAU,CAAC,CAAC;CACtC,CAAC;AAEF;;;;GAIG;AACH,MAAM,WAAW,SAAS,CAAC,CAAC,SAAS,KAAK,GAAG,KAAK;IAChD,MAAM,EAAE,MAAM,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC;IAC9B,KAAK,EAAE,CAAC,CAAC;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, data?: TablePreferencesData): void;
|
|
3
|
+
restore?(key: string): TablePreferencesData | undefined;
|
|
4
|
+
}
|
|
5
|
+
/**
|
|
6
|
+
* The root preferences object
|
|
7
|
+
*
|
|
8
|
+
* This object is serialized to JSON for your `PreferencesAdapter` to consume.
|
|
9
|
+
* This could allow for saving the data off to an API or local storage.
|
|
10
|
+
*/
|
|
11
|
+
export interface TablePreferencesData {
|
|
12
|
+
/**
|
|
13
|
+
* Every plugin has its own namespace for preferences storage.
|
|
14
|
+
*
|
|
15
|
+
* This is so that plugins can not worry about colliding with other plugins'
|
|
16
|
+
* keys within the preferences. For example: multiple plugins may use "enabled"
|
|
17
|
+
*/
|
|
18
|
+
plugins?: Registry;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* A type registry for @universal-ember/table Plugin's Preferences.
|
|
22
|
+
* Meant to be declaration-merged so string lookups resolve to the correct type.
|
|
23
|
+
*
|
|
24
|
+
* And so that accessing the full "preferences" object from "persist"
|
|
25
|
+
* and within "restore" can be fully typed.
|
|
26
|
+
* This also helps out with Glint, as `unknown` types are not allowed to be rendered
|
|
27
|
+
*
|
|
28
|
+
* As a plugin author, to help define what your preferences shape is, you may
|
|
29
|
+
* ```ts
|
|
30
|
+
* import { type PluginPreferences } from '@universal-ember/table/plugins';
|
|
31
|
+
*
|
|
32
|
+
* interface SortingPreferences extends PluginPreferences {
|
|
33
|
+
*
|
|
34
|
+
* }
|
|
35
|
+
*
|
|
36
|
+
* declare module '@universal-ember/table/plugins' {
|
|
37
|
+
* interface Registry {
|
|
38
|
+
* // The key *must* match the same of the class
|
|
39
|
+
* Sorting: SortingPreferences;
|
|
40
|
+
* }
|
|
41
|
+
* }
|
|
42
|
+
* ```
|
|
43
|
+
*/
|
|
44
|
+
export interface Registry {
|
|
45
|
+
}
|
|
46
|
+
export type PluginPreferenceFor<PluginName> = PluginName extends keyof Registry ? Registry[PluginName] & PluginPreferences : PluginPreferences;
|
|
47
|
+
export type PreferencesTableKey<PluginName> = keyof PluginPreferenceFor<PluginName>['table'];
|
|
48
|
+
export type PreferencesTableValues<PluginName> = PluginPreferenceFor<PluginName>['table'][PreferencesTableKey<PluginName>];
|
|
49
|
+
export type PreferencesColumnValues<PluginName> = PluginPreferenceFor<PluginName>['columns'][keyof PluginPreferenceFor<PluginName>['columns']];
|
|
50
|
+
/**
|
|
51
|
+
* Preferences for a column may store a map of key-value pairs
|
|
52
|
+
* for each of
|
|
53
|
+
* - the table
|
|
54
|
+
* - each column
|
|
55
|
+
*/
|
|
56
|
+
export interface PluginPreferences {
|
|
57
|
+
/**
|
|
58
|
+
* A plugin's preferences for the table can be any
|
|
59
|
+
* string -> stringifyable mapping
|
|
60
|
+
*/
|
|
61
|
+
table: Record<string, unknown>;
|
|
62
|
+
/**
|
|
63
|
+
* preferences for a plugin's columns-of-interest are mapped out by
|
|
64
|
+
* the column's key
|
|
65
|
+
*/
|
|
66
|
+
columns: {
|
|
67
|
+
/**
|
|
68
|
+
* For any particular column that a plugin may desire to store preferences on,
|
|
69
|
+
* the data can be any string -> stringifyable mapping
|
|
70
|
+
*/
|
|
71
|
+
[columnKey: string]: Record<string, unknown>;
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
//# sourceMappingURL=preferences.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"preferences.d.ts","sourceRoot":"","sources":["../../../src/-private/interfaces/preferences.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,kBAAkB;IACjC,OAAO,CAAC,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,oBAAoB,GAAG,IAAI,CAAC;IACzD,OAAO,CAAC,CAAC,GAAG,EAAE,MAAM,GAAG,oBAAoB,GAAG,SAAS,CAAC;CACzD;AAED;;;;;GAKG;AACH,MAAM,WAAW,oBAAoB;IACnC;;;;;OAKG;IACH,OAAO,CAAC,EAAE,QAAQ,CAAC;CACpB;AAED;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,MAAM,WAAW,QAAQ;CAAG;AAE5B,MAAM,MAAM,mBAAmB,CAAC,UAAU,IAAI,UAAU,SAAS,MAAM,QAAQ,GAC3E,QAAQ,CAAC,UAAU,CAAC,GAAG,iBAAiB,GACxC,iBAAiB,CAAC;AAEtB,MAAM,MAAM,mBAAmB,CAAC,UAAU,IACxC,MAAM,mBAAmB,CAAC,UAAU,CAAC,CAAC,OAAO,CAAC,CAAC;AAEjD,MAAM,MAAM,sBAAsB,CAAC,UAAU,IAC3C,mBAAmB,CAAC,UAAU,CAAC,CAAC,OAAO,CAAC,CAAC,mBAAmB,CAAC,UAAU,CAAC,CAAC,CAAC;AAC5E,MAAM,MAAM,uBAAuB,CAAC,UAAU,IAC5C,mBAAmB,CAAC,UAAU,CAAC,CAAC,SAAS,CAAC,CAAC,MAAM,mBAAmB,CAAC,UAAU,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC;AAC/F;;;;;GAKG;AACH,MAAM,WAAW,iBAAiB;IAChC;;;OAGG;IACH,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC/B;;;OAGG;IACH,OAAO,EAAE;QACP;;;WAGG;QACH,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;KAC9C,CAAC;CACH"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Types minimally replicated here so we don't need to depend on the package that
|
|
3
|
+
* actually defines these types
|
|
4
|
+
*
|
|
5
|
+
* This also enables a much broader variety of implementations as these interfaces
|
|
6
|
+
* describe only what's needed by the headless table, and not the concrete implementation
|
|
7
|
+
*/
|
|
8
|
+
type CurrentState<T> = {
|
|
9
|
+
state: 'ALL' | 'NONE';
|
|
10
|
+
} | {
|
|
11
|
+
state: 'SOME';
|
|
12
|
+
includeItems: T[];
|
|
13
|
+
} | {
|
|
14
|
+
state: 'ALL_EXCEPT';
|
|
15
|
+
excludeItems: T[];
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* A table can provide a `Selection` object that matches this API
|
|
19
|
+
*/
|
|
20
|
+
export interface Selection<Item = object> {
|
|
21
|
+
get selected(): Item[];
|
|
22
|
+
get currentState(): CurrentState<Item>;
|
|
23
|
+
get isIndeterminate(): boolean;
|
|
24
|
+
get isAllSelected(): boolean;
|
|
25
|
+
get numSelected(): number;
|
|
26
|
+
get numTotal(): number;
|
|
27
|
+
isSelected(item: Item): boolean;
|
|
28
|
+
selectItem(item: Item): void;
|
|
29
|
+
toggleItem(item: Item): void;
|
|
30
|
+
toggleAll(): void;
|
|
31
|
+
selectAll(): void;
|
|
32
|
+
deselectAll(): void;
|
|
33
|
+
deselectItem(item: Item): void;
|
|
34
|
+
}
|
|
35
|
+
export {};
|
|
36
|
+
//# sourceMappingURL=selection.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"selection.d.ts","sourceRoot":"","sources":["../../../src/-private/interfaces/selection.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,KAAK,YAAY,CAAC,CAAC,IACf;IACE,KAAK,EAAE,KAAK,GAAG,MAAM,CAAC;CACvB,GACD;IACE,KAAK,EAAE,MAAM,CAAC;IACd,YAAY,EAAE,CAAC,EAAE,CAAC;CACnB,GACD;IACE,KAAK,EAAE,YAAY,CAAC;IACpB,YAAY,EAAE,CAAC,EAAE,CAAC;CACnB,CAAC;AAEN;;GAEG;AACH,MAAM,WAAW,SAAS,CAAC,IAAI,GAAG,MAAM;IACtC,IAAI,QAAQ,IAAI,IAAI,EAAE,CAAC;IACvB,IAAI,YAAY,IAAI,YAAY,CAAC,IAAI,CAAC,CAAC;IACvC,IAAI,eAAe,IAAI,OAAO,CAAC;IAC/B,IAAI,aAAa,IAAI,OAAO,CAAC;IAC7B,IAAI,WAAW,IAAI,MAAM,CAAC;IAC1B,IAAI,QAAQ,IAAI,MAAM,CAAC;IACvB,UAAU,CAAC,IAAI,EAAE,IAAI,GAAG,OAAO,CAAC;IAChC,UAAU,CAAC,IAAI,EAAE,IAAI,GAAG,IAAI,CAAC;IAC7B,UAAU,CAAC,IAAI,EAAE,IAAI,GAAG,IAAI,CAAC;IAC7B,SAAS,IAAI,IAAI,CAAC;IAClB,SAAS,IAAI,IAAI,CAAC;IAClB,WAAW,IAAI,IAAI,CAAC;IACpB,YAAY,CAAC,IAAI,EAAE,IAAI,GAAG,IAAI,CAAC;CAChC"}
|