ember-headless-table 1.1.0 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.md +9 -0
- package/dist/-private/-type-tests/plugin-properties.test.js +4 -8
- package/dist/-private/-type-tests/plugin-properties.test.js.map +1 -1
- package/dist/-private/-type-tests/plugin-with.test.js.map +1 -1
- package/dist/-private/-type-tests/plugins-accessors.test.js +12 -11
- package/dist/-private/-type-tests/plugins-accessors.test.js.map +1 -1
- package/dist/-private/-type-tests/plugins-signature-from.test.js +7 -6
- package/dist/-private/-type-tests/plugins-signature-from.test.js.map +1 -1
- package/dist/-private/-type-tests/plugins-signature-utils.test.js.map +1 -1
- package/dist/-private/-type-tests/table-api.test.js +3 -2
- package/dist/-private/-type-tests/table-api.test.js.map +1 -1
- package/dist/-private/-type-tests/table-config.test.js +8 -11
- package/dist/-private/-type-tests/table-config.test.js.map +1 -1
- package/dist/-private/column.d.ts +1 -1
- package/dist/-private/column.js +7 -15
- package/dist/-private/column.js.map +1 -1
- package/dist/-private/js-helper.d.ts +1 -1
- package/dist/-private/js-helper.js +2 -3
- package/dist/-private/js-helper.js.map +1 -1
- package/dist/-private/preferences.js +7 -39
- package/dist/-private/preferences.js.map +1 -1
- package/dist/-private/row.d.ts +1 -1
- package/dist/-private/row.js +4 -15
- package/dist/-private/row.js.map +1 -1
- package/dist/-private/table.js +3 -3
- package/dist/-private/utils.js +0 -2
- package/dist/-private/utils.js.map +1 -1
- package/dist/{applyDecoratedDescriptor-e0489e2f.js → applyDecoratedDescriptor-6b986a67.js} +1 -6
- package/dist/applyDecoratedDescriptor-6b986a67.js.map +1 -0
- package/dist/{classPrivateFieldGet-af59a8ea.js → classPrivateFieldGet-b4d7d334.js} +1 -3
- package/dist/{classPrivateFieldGet-af59a8ea.js.map → classPrivateFieldGet-b4d7d334.js.map} +1 -1
- package/dist/{defineProperty-a0196711.js → defineProperty-35ce617b.js} +1 -2
- package/dist/defineProperty-35ce617b.js.map +1 -0
- package/dist/index.d.ts +1 -1
- package/dist/plugins/-private/base.d.ts +1 -1
- package/dist/plugins/-private/base.js +18 -59
- package/dist/plugins/-private/base.js.map +1 -1
- package/dist/plugins/-private/utils.js +5 -20
- package/dist/plugins/-private/utils.js.map +1 -1
- package/dist/plugins/column-reordering/helpers.d.ts +9 -4
- package/dist/plugins/column-reordering/helpers.js +13 -6
- package/dist/plugins/column-reordering/helpers.js.map +1 -1
- package/dist/plugins/column-reordering/index.js +1 -1
- package/dist/plugins/column-reordering/plugin.d.ts +57 -11
- package/dist/plugins/column-reordering/plugin.js +109 -130
- package/dist/plugins/column-reordering/plugin.js.map +1 -1
- package/dist/plugins/column-reordering/utils.js +0 -7
- package/dist/plugins/column-reordering/utils.js.map +1 -1
- package/dist/plugins/column-resizing/handle.js +4 -33
- package/dist/plugins/column-resizing/handle.js.map +1 -1
- package/dist/plugins/column-resizing/helpers.js +2 -2
- package/dist/plugins/column-resizing/helpers.js.map +1 -1
- package/dist/plugins/column-resizing/plugin.js +15 -64
- package/dist/plugins/column-resizing/plugin.js.map +1 -1
- package/dist/plugins/column-resizing/resize-observer.js +1 -3
- package/dist/plugins/column-resizing/resize-observer.js.map +1 -1
- package/dist/plugins/column-resizing/utils.js +0 -2
- package/dist/plugins/column-resizing/utils.js.map +1 -1
- package/dist/plugins/column-visibility/helpers.js +3 -3
- package/dist/plugins/column-visibility/helpers.js.map +1 -1
- package/dist/plugins/column-visibility/plugin.js +6 -26
- package/dist/plugins/column-visibility/plugin.js.map +1 -1
- package/dist/plugins/data-sorting/helpers.js +7 -7
- package/dist/plugins/data-sorting/helpers.js.map +1 -1
- package/dist/plugins/data-sorting/plugin.js +2 -32
- package/dist/plugins/data-sorting/plugin.js.map +1 -1
- package/dist/plugins/data-sorting/types.js +0 -3
- package/dist/plugins/data-sorting/types.js.map +1 -1
- package/dist/plugins/metadata/helpers.d.ts +4 -0
- package/dist/plugins/metadata/helpers.js +12 -0
- package/dist/plugins/metadata/helpers.js.map +1 -0
- package/dist/plugins/metadata/index.d.ts +3 -0
- package/dist/plugins/metadata/index.js +3 -0
- package/dist/plugins/metadata/index.js.map +1 -0
- package/dist/plugins/metadata/plugin.d.ts +24 -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.map +1 -1
- package/dist/plugins/row-selection/plugin.js +5 -42
- package/dist/plugins/row-selection/plugin.js.map +1 -1
- package/dist/plugins/sticky-columns/helpers.js.map +1 -1
- package/dist/plugins/sticky-columns/plugin.js +4 -28
- package/dist/plugins/sticky-columns/plugin.js.map +1 -1
- package/dist/{table-8e46554b.d.ts → table-222f44e7.d.ts} +0 -0
- package/dist/{table-8e46554b.js → table-222f44e7.js} +17 -33
- package/dist/{table-8e46554b.js.map → table-222f44e7.js.map} +1 -1
- package/dist/test-support/index.js +2 -6
- package/dist/test-support/index.js.map +1 -1
- package/dist/utils.js +2 -5
- package/dist/utils.js.map +1 -1
- package/package.json +18 -32
- package/dist/applyDecoratedDescriptor-e0489e2f.js.map +0 -1
- package/dist/defineProperty-a0196711.js.map +0 -1
@@ -1,5 +1,5 @@
|
|
1
|
-
import { _ as _applyDecoratedDescriptor } from '../../applyDecoratedDescriptor-
|
2
|
-
import { _ as _defineProperty } from '../../defineProperty-
|
1
|
+
import { _ as _applyDecoratedDescriptor } from '../../applyDecoratedDescriptor-6b986a67.js';
|
2
|
+
import { _ as _defineProperty } from '../../defineProperty-35ce617b.js';
|
3
3
|
import { macroCondition, dependencySatisfies, importSync } from '@embroider/macros';
|
4
4
|
import '@glimmer/tracking';
|
5
5
|
import { action } from '@ember/object';
|
@@ -8,7 +8,6 @@ import { SortDirection } from './types.js';
|
|
8
8
|
|
9
9
|
var _class, _class2;
|
10
10
|
let cached = macroCondition(dependencySatisfies('ember-source', '>= 4.1.0-alpha.0')) ? importSync('@glimmer/tracking').cached : importSync('ember-cached-decorator-polyfill').cached;
|
11
|
-
|
12
11
|
/**
|
13
12
|
* Manages basic data-sorting behaviors. Ascending -> Descending -> None
|
14
13
|
*
|
@@ -25,14 +24,11 @@ let cached = macroCondition(dependencySatisfies('ember-source', '>= 4.1.0-alpha.
|
|
25
24
|
class Sorting extends BasePlugin {
|
26
25
|
constructor(...args) {
|
27
26
|
super(...args);
|
28
|
-
|
29
27
|
_defineProperty(this, "name", 'data-sorting');
|
30
|
-
|
31
28
|
_defineProperty(this, "meta", {
|
32
29
|
column: ColumnMeta,
|
33
30
|
table: TableMeta
|
34
31
|
});
|
35
|
-
|
36
32
|
_defineProperty(this, "headerCellModifier", (element, {
|
37
33
|
column
|
38
34
|
}) => {
|
@@ -41,75 +37,58 @@ class Sorting extends BasePlugin {
|
|
41
37
|
element.setAttribute('aria-sort', `${columnMeta.sortDirection}`);
|
42
38
|
});
|
43
39
|
}
|
44
|
-
|
45
40
|
}
|
46
41
|
let ColumnMeta = (_class = class ColumnMeta {
|
47
42
|
constructor(column) {
|
48
43
|
this.column = column;
|
49
44
|
}
|
50
|
-
|
51
45
|
get options() {
|
52
46
|
return options.forColumn(this.column, Sorting);
|
53
47
|
}
|
54
|
-
|
55
48
|
get isSortable() {
|
56
49
|
return this.options?.isSortable ?? this.tableMeta.isSortable;
|
57
50
|
}
|
58
|
-
|
59
51
|
get tableMeta() {
|
60
52
|
return meta.forTable(this.column.table, Sorting);
|
61
53
|
}
|
62
|
-
|
63
54
|
get sortDirection() {
|
64
55
|
let sort = this.tableMeta.sorts.find(sort => sort.property === this.sortProperty);
|
65
56
|
return sort?.direction ?? SortDirection.None;
|
66
57
|
}
|
67
|
-
|
68
58
|
get isAscending() {
|
69
59
|
return this.sortDirection === SortDirection.Ascending;
|
70
60
|
}
|
71
|
-
|
72
61
|
get isDescending() {
|
73
62
|
return this.sortDirection === SortDirection.Descending;
|
74
63
|
}
|
75
|
-
|
76
64
|
get isUnsorted() {
|
77
65
|
return this.sortDirection === SortDirection.None;
|
78
66
|
}
|
79
|
-
|
80
67
|
get sortProperty() {
|
81
68
|
return this.options?.sortProperty ?? this.column.config.key;
|
82
69
|
}
|
83
|
-
|
84
70
|
}, (_applyDecoratedDescriptor(_class.prototype, "options", [cached], Object.getOwnPropertyDescriptor(_class.prototype, "options"), _class.prototype)), _class);
|
85
71
|
let TableMeta = (_class2 = class TableMeta {
|
86
72
|
constructor(table) {
|
87
73
|
this.table = table;
|
88
74
|
}
|
89
|
-
|
90
75
|
get options() {
|
91
76
|
return options.forTable(this.table, Sorting);
|
92
77
|
}
|
93
|
-
|
94
78
|
get sorts() {
|
95
79
|
return this.options?.sorts ?? [];
|
96
80
|
}
|
97
|
-
|
98
81
|
get isSortable() {
|
99
82
|
return Boolean(this.options?.onSort) && Boolean(this.options?.sorts);
|
100
83
|
}
|
101
|
-
|
102
84
|
get onSort() {
|
103
85
|
return this.options?.onSort;
|
104
86
|
}
|
105
|
-
|
106
87
|
handleSort(column) {
|
107
88
|
let columnMeta = meta.forColumn(column, Sorting);
|
108
|
-
|
109
89
|
if (!columnMeta.sortProperty) {
|
110
90
|
return;
|
111
91
|
}
|
112
|
-
|
113
92
|
if (columnMeta.sortDirection === SortDirection.Ascending) {
|
114
93
|
this.onSort?.([]);
|
115
94
|
} else if (columnMeta.sortDirection === SortDirection.Descending) {
|
@@ -124,41 +103,32 @@ let TableMeta = (_class2 = class TableMeta {
|
|
124
103
|
}]);
|
125
104
|
}
|
126
105
|
}
|
127
|
-
|
128
106
|
toggleAscending(column) {
|
129
107
|
let columnMeta = meta.forColumn(column, Sorting);
|
130
|
-
|
131
108
|
if (!columnMeta.sortProperty) {
|
132
109
|
return;
|
133
110
|
}
|
134
|
-
|
135
111
|
if (columnMeta.sortDirection === SortDirection.Ascending) {
|
136
112
|
return this.onSort?.([]);
|
137
113
|
}
|
138
|
-
|
139
114
|
this.onSort?.([{
|
140
115
|
direction: SortDirection.Ascending,
|
141
116
|
property: columnMeta.sortProperty
|
142
117
|
}]);
|
143
118
|
}
|
144
|
-
|
145
119
|
toggleDescending(column) {
|
146
120
|
let columnMeta = meta.forColumn(column, Sorting);
|
147
|
-
|
148
121
|
if (!columnMeta.sortProperty) {
|
149
122
|
return;
|
150
123
|
}
|
151
|
-
|
152
124
|
if (columnMeta.sortDirection === SortDirection.Descending) {
|
153
125
|
return this.onSort?.([]);
|
154
126
|
}
|
155
|
-
|
156
127
|
this.onSort?.([{
|
157
128
|
direction: SortDirection.Descending,
|
158
129
|
property: columnMeta.sortProperty
|
159
130
|
}]);
|
160
131
|
}
|
161
|
-
|
162
132
|
}, (_applyDecoratedDescriptor(_class2.prototype, "options", [cached], Object.getOwnPropertyDescriptor(_class2.prototype, "options"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "handleSort", [action], Object.getOwnPropertyDescriptor(_class2.prototype, "handleSort"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "toggleAscending", [action], Object.getOwnPropertyDescriptor(_class2.prototype, "toggleAscending"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "toggleDescending", [action], Object.getOwnPropertyDescriptor(_class2.prototype, "toggleDescending"), _class2.prototype)), _class2);
|
163
133
|
|
164
134
|
export { ColumnMeta, Sorting, TableMeta };
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"plugin.js","sources":["../../../src/plugins/data-sorting/plugin.ts"],"sourcesContent":["import { cached } from '@glimmer/tracking';\nimport { action } from '@ember/object';\n\nimport { BasePlugin, meta, options } from '../-private/base';\nimport { SortDirection } from './types';\n\nimport type { Sort, SortItem } from './types';\nimport type { ColumnApi, PluginPreferences } from '[public-plugin-types]';\nimport type { Column, Table } from '[public-types]';\n\ninterface SortingPreferences extends PluginPreferences {\n table: {\n sorts?: Sort[];\n };\n}\n\ndeclare module 'ember-headless-table/plugins' {\n interface Registry {\n Sorting?: SortingPreferences;\n }\n}\n\nexport interface Signature<DataType = unknown> {\n Meta: {\n Column: ColumnMeta;\n Table: TableMeta;\n };\n Options: {\n Plugin: Options<DataType>;\n Column: ColumnOptions;\n };\n}\n\ninterface Options<DataType = unknown> {\n /**\n * Handler for interpreting sort requests from the headless table.\n *\n * Does not actually do the sorting.\n *\n * if omitted, the DataSorting plugin will disable itself\n */\n onSort?: (sorts: SortItem<DataType>[]) => void;\n /**\n * Provided sorts that the table should assume are true.\n *\n * if omitted, the DataSorting plugin will disable itself\n */\n sorts?: SortItem<DataType>[];\n}\n\ninterface ColumnOptions {\n /**\n * Opt in or out of sorting for a particular column.\n * Default is true.\n */\n isSortable?: boolean;\n /**\n * Use this key instead of the `key` on the column config.\n * This has no bearing on any behavior in the plugin, *other than*,\n * swapping out the `property`'s value on the `SortItem`s passed to\n * the table plugin config's `onSort` callback\n */\n sortProperty?: string;\n}\n\n/**\n * Manages basic data-sorting behaviors. Ascending -> Descending -> None\n *\n * This plugin requires a table plugin configuration, `onSort` for handling *how* sorting happens.\n * communicating back to the table that sorting has succeeded can be done by setting the `sorts`\n * property in the table plugin configuration.\n *\n * Note that this plugin doesn't actually sort the data, as data management is not the responsibility\n * of the table, but of the surrounding context providing the data to the table. So sorting can happen\n * client-side still, just in a component -- much the same way you'd handel sorting via API requests.\n *\n * This plugin is for *conveying* what the current sorts are, rather than _doing_ the sorting.\n */\nexport class Sorting<DataType = unknown> extends BasePlugin<Signature<DataType>> {\n name = 'data-sorting';\n\n meta = {\n column: ColumnMeta,\n table: TableMeta,\n };\n\n headerCellModifier = (element: HTMLElement, { column }: ColumnApi) => {\n let columnMeta = meta.forColumn(column, Sorting);\n\n element.setAttribute('data-test-is-sortable', `${columnMeta.isSortable}`);\n element.setAttribute('aria-sort', `${columnMeta.sortDirection}`);\n };\n}\n\nexport class ColumnMeta {\n constructor(private column: Column) {}\n\n @cached\n get options() {\n return options.forColumn(this.column, Sorting);\n }\n\n get isSortable() {\n return this.options?.isSortable ?? this.tableMeta.isSortable;\n }\n\n get tableMeta() {\n return meta.forTable(this.column.table, Sorting);\n }\n\n get sortDirection() {\n let sort = this.tableMeta.sorts.find((sort) => sort.property === this.sortProperty);\n\n return sort?.direction ?? SortDirection.None;\n }\n\n get isAscending() {\n return this.sortDirection === SortDirection.Ascending;\n }\n\n get isDescending() {\n return this.sortDirection === SortDirection.Descending;\n }\n\n get isUnsorted() {\n return this.sortDirection === SortDirection.None;\n }\n\n get sortProperty() {\n return this.options?.sortProperty ?? this.column.config.key;\n }\n}\n\nexport class TableMeta {\n constructor(private table: Table) {}\n\n @cached\n get options() {\n return options.forTable(this.table, Sorting);\n }\n\n get sorts() {\n return this.options?.sorts ?? [];\n }\n\n get isSortable() {\n return Boolean(this.options?.onSort) && Boolean(this.options?.sorts);\n }\n\n get onSort() {\n return this.options?.onSort;\n }\n\n @action\n handleSort(column: Column) {\n let columnMeta = meta.forColumn(column, Sorting);\n\n if (!columnMeta.sortProperty) {\n return;\n }\n\n if (columnMeta.sortDirection === SortDirection.Ascending) {\n this.onSort?.([]);\n } else if (columnMeta.sortDirection === SortDirection.Descending) {\n this.onSort?.([{ direction: SortDirection.Ascending, property: columnMeta.sortProperty }]);\n } else {\n this.onSort?.([{ direction: SortDirection.Descending, property: columnMeta.sortProperty }]);\n }\n }\n\n @action\n toggleAscending(column: Column) {\n let columnMeta = meta.forColumn(column, Sorting);\n\n if (!columnMeta.sortProperty) {\n return;\n }\n\n if (columnMeta.sortDirection === SortDirection.Ascending) {\n return this.onSort?.([]);\n }\n\n this.onSort?.([{ direction: SortDirection.Ascending, property: columnMeta.sortProperty }]);\n }\n\n @action\n toggleDescending(column: Column) {\n let columnMeta = meta.forColumn(column, Sorting);\n\n if (!columnMeta.sortProperty) {\n return;\n }\n\n if (columnMeta.sortDirection === SortDirection.Descending) {\n return this.onSort?.([]);\n }\n\n this.onSort?.([{ direction: SortDirection.Descending, property: columnMeta.sortProperty }]);\n }\n}\n"],"names":["Sorting","BasePlugin","column","ColumnMeta","table","TableMeta","element","columnMeta","meta","forColumn","setAttribute","isSortable","sortDirection","constructor","options","tableMeta","forTable","sort","sorts","find","property","sortProperty","direction","SortDirection","None","isAscending","Ascending","isDescending","Descending","isUnsorted","config","key","cached","Boolean","onSort","handleSort","toggleAscending","toggleDescending","action"],"mappings":";;;;;;;;;;;AAiEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMA,OAAN,SAA0CC,UAA1C,CAA0E;AAAA,EAAA,WAAA,CAAA,GAAA,IAAA,EAAA;AAAA,IAAA,KAAA,CAAA,GAAA,IAAA,CAAA,CAAA;;AAAA,IAAA,eAAA,CAAA,IAAA,EAAA,MAAA,EACxE,cADwE,CAAA,CAAA;;IAAA,eAGxE,CAAA,IAAA,EAAA,MAAA,EAAA;AACLC,MAAAA,MAAM,EAAEC,UADH;AAELC,MAAAA,KAAK,EAAEC,SAAAA;KALsE,CAAA,CAAA;;IAAA,eAQ1D,CAAA,IAAA,EAAA,oBAAA,EAAA,CAACC,OAAD,EAAuB;AAAEJ,MAAAA,MAAAA;AAAF,KAAvB,KAAiD;MACpE,IAAIK,UAAU,GAAGC,IAAI,CAACC,SAAL,CAAeP,MAAf,EAAuBF,OAAvB,CAAjB,CAAA;MAEAM,OAAO,CAACI,YAAR,CAAqB,uBAArB,EAA+C,CAAEH,EAAAA,UAAU,CAACI,UAAW,CAAvE,CAAA,CAAA,CAAA;MACAL,OAAO,CAACI,YAAR,CAAqB,WAArB,EAAmC,CAAEH,EAAAA,UAAU,CAACK,aAAc,CAA9D,CAAA,CAAA,CAAA;KAZ6E,CAAA,CAAA;AAAA,GAAA;;AAAA,CAAA;AAgBjF,IAAaT,UAAb,IAAA,MAAA,GAAO,MAAMA,UAAN,CAAiB;EACtBU,WAAW,CAASX,MAAT,EAAyB;IAAA,IAAhBA,CAAAA,MAAgB,GAAhBA,MAAgB,CAAA;AAAE,GAAA;;AAG3B,EAAA,IAAPY,OAAO,GAAG;IACZ,OAAOA,OAAO,CAACL,SAAR,CAAkB,KAAKP,MAAvB,EAA+BF,OAA/B,CAAP,CAAA;AACD,GAAA;;AAEa,EAAA,IAAVW,UAAU,G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SAAA,EAAA,SAAA,CAAA,EAAA,OAAA,CAAA,SAAA,CAAA,EAAA,yBAAA,CAAA,OAAA,CAAA,SAAA,EAAA,YAAA,EAAA,CAoBGM,MApBH,CAqCGA,EAAAA,MAAAA,CAAAA,wBAAAA,CAAAA,OAAAA,CAAAA,SAAAA,EAAAA,YAAAA,CAAAA,EAAAA,OAAAA,CAAAA,SAAAA,CAAAA,EAAAA,yBAAAA,CAAAA,OAAAA,CAAAA,SAAAA,EAAAA,iBAAAA,EAAAA,CAAAA,MArCH,gKAoDGA,MApDH,CAAA,EAAA,MAAA,CAAA,wBAAA,CAAA,OAAA,CAAA,SAAA,EAAA,kBAAA,CAAA,EAAA,OAAA,CAAA,SAAA,CAAA,GAAA,OAAA;;;;"}
|
1
|
+
{"version":3,"file":"plugin.js","sources":["../../../src/plugins/data-sorting/plugin.ts"],"sourcesContent":["import { cached } from '@glimmer/tracking';\nimport { action } from '@ember/object';\n\nimport { BasePlugin, meta, options } from '../-private/base';\nimport { SortDirection } from './types';\n\nimport type { Sort, SortItem } from './types';\nimport type { ColumnApi, PluginPreferences } from '[public-plugin-types]';\nimport type { Column, Table } from '[public-types]';\n\ninterface SortingPreferences extends PluginPreferences {\n table: {\n sorts?: Sort[];\n };\n}\n\ndeclare module 'ember-headless-table/plugins' {\n interface Registry {\n Sorting?: SortingPreferences;\n }\n}\n\nexport interface Signature<DataType = unknown> {\n Meta: {\n Column: ColumnMeta;\n Table: TableMeta;\n };\n Options: {\n Plugin: Options<DataType>;\n Column: ColumnOptions;\n };\n}\n\ninterface Options<DataType = unknown> {\n /**\n * Handler for interpreting sort requests from the headless table.\n *\n * Does not actually do the sorting.\n *\n * if omitted, the DataSorting plugin will disable itself\n */\n onSort?: (sorts: SortItem<DataType>[]) => void;\n /**\n * Provided sorts that the table should assume are true.\n *\n * if omitted, the DataSorting plugin will disable itself\n */\n sorts?: SortItem<DataType>[];\n}\n\ninterface ColumnOptions {\n /**\n * Opt in or out of sorting for a particular column.\n * Default is true.\n */\n isSortable?: boolean;\n /**\n * Use this key instead of the `key` on the column config.\n * This has no bearing on any behavior in the plugin, *other than*,\n * swapping out the `property`'s value on the `SortItem`s passed to\n * the table plugin config's `onSort` callback\n */\n sortProperty?: string;\n}\n\n/**\n * Manages basic data-sorting behaviors. Ascending -> Descending -> None\n *\n * This plugin requires a table plugin configuration, `onSort` for handling *how* sorting happens.\n * communicating back to the table that sorting has succeeded can be done by setting the `sorts`\n * property in the table plugin configuration.\n *\n * Note that this plugin doesn't actually sort the data, as data management is not the responsibility\n * of the table, but of the surrounding context providing the data to the table. So sorting can happen\n * client-side still, just in a component -- much the same way you'd handel sorting via API requests.\n *\n * This plugin is for *conveying* what the current sorts are, rather than _doing_ the sorting.\n */\nexport class Sorting<DataType = unknown> extends BasePlugin<Signature<DataType>> {\n name = 'data-sorting';\n\n meta = {\n column: ColumnMeta,\n table: TableMeta,\n };\n\n headerCellModifier = (element: HTMLElement, { column }: ColumnApi) => {\n let columnMeta = meta.forColumn(column, Sorting);\n\n element.setAttribute('data-test-is-sortable', `${columnMeta.isSortable}`);\n element.setAttribute('aria-sort', `${columnMeta.sortDirection}`);\n };\n}\n\nexport class ColumnMeta {\n constructor(private column: Column) {}\n\n @cached\n get options() {\n return options.forColumn(this.column, Sorting);\n }\n\n get isSortable() {\n return this.options?.isSortable ?? this.tableMeta.isSortable;\n }\n\n get tableMeta() {\n return meta.forTable(this.column.table, Sorting);\n }\n\n get sortDirection() {\n let sort = this.tableMeta.sorts.find((sort) => sort.property === this.sortProperty);\n\n return sort?.direction ?? SortDirection.None;\n }\n\n get isAscending() {\n return this.sortDirection === SortDirection.Ascending;\n }\n\n get isDescending() {\n return this.sortDirection === SortDirection.Descending;\n }\n\n get isUnsorted() {\n return this.sortDirection === SortDirection.None;\n }\n\n get sortProperty() {\n return this.options?.sortProperty ?? this.column.config.key;\n }\n}\n\nexport class TableMeta {\n constructor(private table: Table) {}\n\n @cached\n get options() {\n return options.forTable(this.table, Sorting);\n }\n\n get sorts() {\n return this.options?.sorts ?? [];\n }\n\n get isSortable() {\n return Boolean(this.options?.onSort) && Boolean(this.options?.sorts);\n }\n\n get onSort() {\n return this.options?.onSort;\n }\n\n @action\n handleSort(column: Column) {\n let columnMeta = meta.forColumn(column, Sorting);\n\n if (!columnMeta.sortProperty) {\n return;\n }\n\n if (columnMeta.sortDirection === SortDirection.Ascending) {\n this.onSort?.([]);\n } else if (columnMeta.sortDirection === SortDirection.Descending) {\n this.onSort?.([{ direction: SortDirection.Ascending, property: columnMeta.sortProperty }]);\n } else {\n this.onSort?.([{ direction: SortDirection.Descending, property: columnMeta.sortProperty }]);\n }\n }\n\n @action\n toggleAscending(column: Column) {\n let columnMeta = meta.forColumn(column, Sorting);\n\n if (!columnMeta.sortProperty) {\n return;\n }\n\n if (columnMeta.sortDirection === SortDirection.Ascending) {\n return this.onSort?.([]);\n }\n\n this.onSort?.([{ direction: SortDirection.Ascending, property: columnMeta.sortProperty }]);\n }\n\n @action\n toggleDescending(column: Column) {\n let columnMeta = meta.forColumn(column, Sorting);\n\n if (!columnMeta.sortProperty) {\n return;\n }\n\n if (columnMeta.sortDirection === SortDirection.Descending) {\n return this.onSort?.([]);\n }\n\n this.onSort?.([{ direction: SortDirection.Descending, property: columnMeta.sortProperty }]);\n }\n}\n"],"names":["Sorting","BasePlugin","column","ColumnMeta","table","TableMeta","element","columnMeta","meta","forColumn","setAttribute","isSortable","sortDirection","constructor","options","tableMeta","forTable","sort","sorts","find","property","sortProperty","direction","SortDirection","None","isAscending","Ascending","isDescending","Descending","isUnsorted","config","key","cached","Boolean","onSort","handleSort","toggleAscending","toggleDescending","action"],"mappings":";;;;;;;;;AAA2C,IAAA,MAAA,GAAA,cAAA,CAAA,mBAAA,CAAA,cAAA,EAAA,kBAAA,CAAA,CAAA,GAAA,UAAA,CAAA,mBAAA,CAAA,CAAA,MAAA,GAAA,UAAA,CAAA,iCAAA,CAAA,CAAA,MAAA,CAAA;AAiE3C;AACA;AACA;AACA;AACA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AA,yBAAAA,CAAAA,OAAAA,CAAAA,SAAAA,EAAAA,iBAAAA,EAAAA,CAAAA,MAAM,gKAeNA,MAAM,CAAA,EAAA,MAAA,CAAA,wBAAA,CAAA,OAAA,CAAA,SAAA,EAAA,kBAAA,CAAA,EAAA,OAAA,CAAA,SAAA,CAAA,GAAA,OAAA;;;;"}
|
@@ -1,13 +1,10 @@
|
|
1
1
|
let SortDirection;
|
2
|
-
|
3
2
|
(function (SortDirection) {
|
4
3
|
SortDirection["Ascending"] = "ascending";
|
5
4
|
SortDirection["Descending"] = "descending";
|
6
5
|
SortDirection["None"] = "none";
|
7
6
|
})(SortDirection || (SortDirection = {}));
|
8
|
-
|
9
7
|
let SortTransform;
|
10
|
-
|
11
8
|
(function (SortTransform) {
|
12
9
|
SortTransform["Underscore"] = "underscore";
|
13
10
|
SortTransform["Camelize"] = "camelize";
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"types.js","sources":["../../../src/plugins/data-sorting/types.ts"],"sourcesContent":["import type { ColumnKey } from '#/interfaces';\n\nexport enum SortDirection {\n Ascending = 'ascending',\n Descending = 'descending',\n None = 'none',\n}\n\nexport interface Sort {\n property: string;\n direction: SortDirection;\n}\n\nexport enum SortTransform {\n Underscore = 'underscore',\n Camelize = 'camelize',\n}\nexport interface SortsOptions {\n separator: string;\n transform: string | null;\n}\n\nexport interface SortItem<T> {\n direction: SortDirection;\n property: ColumnKey<T>;\n}\n"],"names":["SortDirection","SortTransform"],"mappings":"AAEA,IAAYA,
|
1
|
+
{"version":3,"file":"types.js","sources":["../../../src/plugins/data-sorting/types.ts"],"sourcesContent":["import type { ColumnKey } from '#/interfaces';\n\nexport enum SortDirection {\n Ascending = 'ascending',\n Descending = 'descending',\n None = 'none',\n}\n\nexport interface Sort {\n property: string;\n direction: SortDirection;\n}\n\nexport enum SortTransform {\n Underscore = 'underscore',\n Camelize = 'camelize',\n}\nexport interface SortsOptions {\n separator: string;\n transform: string | null;\n}\n\nexport interface SortItem<T> {\n direction: SortDirection;\n property: ColumnKey<T>;\n}\n"],"names":["SortDirection","SortTransform"],"mappings":"AAEA,IAAYA,cAAa;AAIxB,CAAA,UAJWA,aAAa,EAAA;EAAbA,aAAa,CAAA,WAAA,CAAA,GAAA,WAAA,CAAA;EAAbA,aAAa,CAAA,YAAA,CAAA,GAAA,YAAA,CAAA;EAAbA,aAAa,CAAA,MAAA,CAAA,GAAA,MAAA,CAAA;AAAA,CAAbA,EAAAA,aAAa,KAAbA,aAAa,GAAA,EAAA,CAAA,CAAA,CAAA;AAWzB,IAAYC,cAAa;AAGxB,CAAA,UAHWA,aAAa,EAAA;EAAbA,aAAa,CAAA,YAAA,CAAA,GAAA,YAAA,CAAA;EAAbA,aAAa,CAAA,UAAA,CAAA,GAAA,UAAA,CAAA;AAAA,CAAbA,EAAAA,aAAa,KAAbA,aAAa,GAAA,EAAA,CAAA,CAAA;;;;"}
|
@@ -0,0 +1,12 @@
|
|
1
|
+
import { options } from '../-private/base.js';
|
2
|
+
import { Metadata } from './plugin.js';
|
3
|
+
|
4
|
+
const forColumn = (column, key) => {
|
5
|
+
return options.forColumn(column, Metadata)[key];
|
6
|
+
};
|
7
|
+
const forTable = (table, key) => {
|
8
|
+
return options.forTable(table, Metadata)[key];
|
9
|
+
};
|
10
|
+
|
11
|
+
export { forColumn, forTable };
|
12
|
+
//# sourceMappingURL=helpers.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"helpers.js","sources":["../../../src/plugins/metadata/helpers.ts"],"sourcesContent":["import { options } from '../-private/base';\nimport { Metadata } from './plugin';\n\nimport type { Column, Table } from '[public-types]';\n\nexport const forColumn = (column: Column<any>, key: string) => {\n return options.forColumn(column, Metadata)[key];\n};\n\nexport const forTable = (table: Table<any>, key: string) => {\n return options.forTable(table, Metadata)[key];\n};\n"],"names":["forColumn","column","key","options","Metadata","forTable","table"],"mappings":";;;MAKaA,SAAS,GAAG,CAACC,MAAmB,EAAEC,GAAW,KAAK;EAC7D,OAAOC,OAAO,CAACH,SAAS,CAACC,MAAM,EAAEG,QAAQ,CAAC,CAACF,GAAG,CAAC,CAAA;AACjD,EAAC;MAEYG,QAAQ,GAAG,CAACC,KAAiB,EAAEJ,GAAW,KAAK;EAC1D,OAAOC,OAAO,CAACE,QAAQ,CAACC,KAAK,EAAEF,QAAQ,CAAC,CAACF,GAAG,CAAC,CAAA;AAC/C;;;;"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
|
@@ -0,0 +1,24 @@
|
|
1
|
+
import { BasePlugin } from "../-private/base";
|
2
|
+
/**
|
3
|
+
* Data stored per column or table can be arbitrary
|
4
|
+
*
|
5
|
+
*/
|
6
|
+
type ArbitraryData = Record<string, any>;
|
7
|
+
interface Signature<Data = ArbitraryData> {
|
8
|
+
Options: {
|
9
|
+
Column: Data;
|
10
|
+
Plugin: Data;
|
11
|
+
};
|
12
|
+
}
|
13
|
+
/**
|
14
|
+
* This plugin does noting,
|
15
|
+
* but gives consumer of it a safe way to store and associate "any" data with columns
|
16
|
+
* (and have a generic top-level bucket of data as well)
|
17
|
+
*
|
18
|
+
* This "metadata" stored per column per table is managed via the "options" part of the Signature, as
|
19
|
+
* "meta" is a term used for plugins for plugin authors.
|
20
|
+
*/
|
21
|
+
declare class Metadata<S extends Signature> extends BasePlugin<S> {
|
22
|
+
name: string;
|
23
|
+
}
|
24
|
+
export { Signature, Metadata };
|
@@ -0,0 +1,25 @@
|
|
1
|
+
import { _ as _defineProperty } from '../../defineProperty-35ce617b.js';
|
2
|
+
import { BasePlugin } from '../-private/base.js';
|
3
|
+
|
4
|
+
/**
|
5
|
+
* Data stored per column or table can be arbitrary
|
6
|
+
*
|
7
|
+
*/
|
8
|
+
|
9
|
+
/**
|
10
|
+
* This plugin does noting,
|
11
|
+
* but gives consumer of it a safe way to store and associate "any" data with columns
|
12
|
+
* (and have a generic top-level bucket of data as well)
|
13
|
+
*
|
14
|
+
* This "metadata" stored per column per table is managed via the "options" part of the Signature, as
|
15
|
+
* "meta" is a term used for plugins for plugin authors.
|
16
|
+
*/
|
17
|
+
class Metadata extends BasePlugin {
|
18
|
+
constructor(...args) {
|
19
|
+
super(...args);
|
20
|
+
_defineProperty(this, "name", 'metadata');
|
21
|
+
}
|
22
|
+
}
|
23
|
+
|
24
|
+
export { Metadata };
|
25
|
+
//# sourceMappingURL=plugin.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"plugin.js","sources":["../../../src/plugins/metadata/plugin.ts"],"sourcesContent":["import { BasePlugin } from '../-private/base';\n\n/**\n * Data stored per column or table can be arbitrary\n *\n */\ntype ArbitraryData = Record<string, any>;\n\nexport interface Signature<Data = ArbitraryData> {\n Options: {\n Column: Data;\n Plugin: Data;\n };\n}\n\n/**\n * This plugin does noting,\n * but gives consumer of it a safe way to store and associate \"any\" data with columns\n * (and have a generic top-level bucket of data as well)\n *\n * This \"metadata\" stored per column per table is managed via the \"options\" part of the Signature, as\n * \"meta\" is a term used for plugins for plugin authors.\n */\nexport class Metadata<S extends Signature> extends BasePlugin<S> {\n name = 'metadata';\n}\n"],"names":["Metadata","BasePlugin"],"mappings":";;;AAEA;AACA;AACA;AACA;;AAUA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMA,QAAQ,SAA8BC,UAAU,CAAI;AAAA,EAAA,WAAA,CAAA,GAAA,IAAA,EAAA;AAAA,IAAA,KAAA,CAAA,GAAA,IAAA,CAAA,CAAA;AAAA,IAAA,eAAA,CAAA,IAAA,EAAA,MAAA,EACxD,UAAU,CAAA,CAAA;AAAA,GAAA;AACnB;;;;"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"helpers.js","sources":["../../../src/plugins/row-selection/helpers.ts"],"sourcesContent":["import { meta } from '../-private/base';\nimport { RowSelection } from './plugin';\n\nimport type { Row } from '../../-private/row';\n\nexport const isSelected = (row: Row<any>) => meta.forRow(row, RowSelection).isSelected;\nexport const select = (row: Row<any>) => meta.forRow(row, RowSelection).select();\nexport const deselect = (row: Row<any>) => meta.forRow(row, RowSelection).deselect();\nexport const toggle = (row: Row<any>) => meta.forRow(row, RowSelection).toggle();\n"],"names":["isSelected","row","meta","forRow","RowSelection","select","deselect","toggle"],"mappings":";;;AAKaA,MAAAA,UAAU,GAAIC,
|
1
|
+
{"version":3,"file":"helpers.js","sources":["../../../src/plugins/row-selection/helpers.ts"],"sourcesContent":["import { meta } from '../-private/base';\nimport { RowSelection } from './plugin';\n\nimport type { Row } from '../../-private/row';\n\nexport const isSelected = (row: Row<any>) => meta.forRow(row, RowSelection).isSelected;\nexport const select = (row: Row<any>) => meta.forRow(row, RowSelection).select();\nexport const deselect = (row: Row<any>) => meta.forRow(row, RowSelection).deselect();\nexport const toggle = (row: Row<any>) => meta.forRow(row, RowSelection).toggle();\n"],"names":["isSelected","row","meta","forRow","RowSelection","select","deselect","toggle"],"mappings":";;;AAKaA,MAAAA,UAAU,GAAIC,GAAa,IAAKC,IAAI,CAACC,MAAM,CAACF,GAAG,EAAEG,YAAY,CAAC,CAACJ,WAAU;AACzEK,MAAAA,MAAM,GAAIJ,GAAa,IAAKC,IAAI,CAACC,MAAM,CAACF,GAAG,EAAEG,YAAY,CAAC,CAACC,MAAM,GAAE;AACnEC,MAAAA,QAAQ,GAAIL,GAAa,IAAKC,IAAI,CAACC,MAAM,CAACF,GAAG,EAAEG,YAAY,CAAC,CAACE,QAAQ,GAAE;AACvEC,MAAAA,MAAM,GAAIN,GAAa,IAAKC,IAAI,CAACC,MAAM,CAACF,GAAG,EAAEG,YAAY,CAAC,CAACG,MAAM;;;;"}
|
@@ -1,6 +1,6 @@
|
|
1
|
-
import { _ as _classExtractFieldDescriptor, a as _classPrivateFieldGet } from '../../classPrivateFieldGet-
|
2
|
-
import { _ as _applyDecoratedDescriptor } from '../../applyDecoratedDescriptor-
|
3
|
-
import { _ as _defineProperty } from '../../defineProperty-
|
1
|
+
import { _ as _classExtractFieldDescriptor, a as _classPrivateFieldGet } from '../../classPrivateFieldGet-b4d7d334.js';
|
2
|
+
import { _ as _applyDecoratedDescriptor } from '../../applyDecoratedDescriptor-6b986a67.js';
|
3
|
+
import { _ as _defineProperty } from '../../defineProperty-35ce617b.js';
|
4
4
|
import { macroCondition, dependencySatisfies, importSync } from '@embroider/macros';
|
5
5
|
import '@glimmer/tracking';
|
6
6
|
import { assert } from '@ember/debug';
|
@@ -13,7 +13,6 @@ function _classApplyDescriptorSet(receiver, descriptor, value) {
|
|
13
13
|
if (!descriptor.writable) {
|
14
14
|
throw new TypeError("attempted to set read only private field");
|
15
15
|
}
|
16
|
-
|
17
16
|
descriptor.value = value;
|
18
17
|
}
|
19
18
|
}
|
@@ -25,14 +24,10 @@ function _classPrivateFieldSet(receiver, privateMap, value) {
|
|
25
24
|
}
|
26
25
|
|
27
26
|
var _class, _table;
|
28
|
-
|
29
27
|
function _classPrivateFieldInitSpec(obj, privateMap, value) { _checkPrivateRedeclaration(obj, privateMap); privateMap.set(obj, value); }
|
30
|
-
|
31
28
|
function _checkPrivateRedeclaration(obj, privateCollection) { if (privateCollection.has(obj)) { throw new TypeError("Cannot initialize the same private elements twice on an object"); } }
|
32
29
|
let cached = macroCondition(dependencySatisfies('ember-source', '>= 4.1.0-alpha.0')) ? importSync('@glimmer/tracking').cached : importSync('ember-cached-decorator-polyfill').cached;
|
33
|
-
|
34
30
|
var _clickHandler = /*#__PURE__*/new WeakMap();
|
35
|
-
|
36
31
|
/**
|
37
32
|
* This plugin provides a means of managing selection of a single row in a table.
|
38
33
|
*
|
@@ -42,62 +37,51 @@ var _clickHandler = /*#__PURE__*/new WeakMap();
|
|
42
37
|
class RowSelection extends BasePlugin {
|
43
38
|
constructor(table) {
|
44
39
|
super(table);
|
45
|
-
|
46
40
|
_defineProperty(this, "name", 'row-selection');
|
47
|
-
|
48
41
|
_defineProperty(this, "meta", {
|
49
42
|
row: RowMeta,
|
50
43
|
table: TableMeta
|
51
44
|
});
|
52
|
-
|
53
45
|
_defineProperty(this, "rowModifier", (element, {
|
54
46
|
row
|
55
47
|
}) => {
|
56
48
|
let handler = event => {
|
57
49
|
_classPrivateFieldGet(this, _clickHandler).call(this, row, event);
|
58
50
|
};
|
59
|
-
|
60
51
|
element.addEventListener('click', handler);
|
61
52
|
return () => {
|
62
53
|
element.removeEventListener('click', handler);
|
63
54
|
};
|
64
55
|
});
|
65
|
-
|
66
56
|
_classPrivateFieldInitSpec(this, _clickHandler, {
|
67
57
|
writable: true,
|
68
58
|
value: (row, event) => {
|
69
59
|
assert(`expected event.target to be an instance of HTMLElement`, event.target instanceof HTMLElement || event.target instanceof SVGElement);
|
70
60
|
let selection = document.getSelection();
|
71
|
-
|
72
61
|
if (selection) {
|
73
62
|
let {
|
74
63
|
type,
|
75
64
|
anchorNode
|
76
65
|
} = selection;
|
77
66
|
let isSelectingText = type === 'Range' && event.target?.contains(anchorNode);
|
78
|
-
|
79
67
|
if (isSelectingText) {
|
80
68
|
event.stopPropagation();
|
81
69
|
return;
|
82
70
|
}
|
83
|
-
}
|
84
|
-
|
71
|
+
}
|
85
72
|
|
73
|
+
// Ignore clicks on interactive elements within the row
|
86
74
|
let inputParent = event.target.closest('input, button, label, a, select');
|
87
|
-
|
88
75
|
if (inputParent) {
|
89
76
|
return;
|
90
77
|
}
|
91
|
-
|
92
78
|
let rowMeta = meta.forRow(row, RowSelection);
|
93
79
|
rowMeta.toggle();
|
94
80
|
}
|
95
81
|
});
|
96
|
-
|
97
82
|
let pluginOptions = options.forTable(this.table, RowSelection);
|
98
83
|
assert(`selection, onSelect, and onDeselect are all required arguments for the RowSelection plugin. ` + `Specify these options via \`RowSelection.with(() => ({ selection, onSelect, onDeselect }))\``, pluginOptions.selection && pluginOptions.onSelect && pluginOptions.onDeselect);
|
99
84
|
}
|
100
|
-
|
101
85
|
}
|
102
86
|
let TableMeta = (_class = (_table = /*#__PURE__*/new WeakMap(), class TableMeta {
|
103
87
|
constructor(table) {
|
@@ -105,82 +89,61 @@ let TableMeta = (_class = (_table = /*#__PURE__*/new WeakMap(), class TableMeta
|
|
105
89
|
writable: true,
|
106
90
|
value: void 0
|
107
91
|
});
|
108
|
-
|
109
92
|
_classPrivateFieldSet(this, _table, table);
|
110
93
|
}
|
111
|
-
|
112
94
|
get selection() {
|
113
95
|
let passedSelection = options.forTable(_classPrivateFieldGet(this, _table), RowSelection).selection;
|
114
96
|
assert(`Cannot access selection because it is undefined`, passedSelection);
|
115
|
-
|
116
97
|
if (passedSelection instanceof Set) {
|
117
98
|
return passedSelection;
|
118
99
|
}
|
119
|
-
|
120
100
|
return new Set(passedSelection);
|
121
101
|
}
|
122
|
-
|
123
102
|
}), (_applyDecoratedDescriptor(_class.prototype, "selection", [cached], Object.getOwnPropertyDescriptor(_class.prototype, "selection"), _class.prototype)), _class);
|
124
|
-
|
125
103
|
var _row = /*#__PURE__*/new WeakMap();
|
126
|
-
|
127
104
|
class RowMeta {
|
128
105
|
constructor(row) {
|
129
106
|
_classPrivateFieldInitSpec(this, _row, {
|
130
107
|
writable: true,
|
131
108
|
value: void 0
|
132
109
|
});
|
133
|
-
|
134
110
|
_defineProperty(this, "toggle", () => {
|
135
111
|
if (this.isSelected) {
|
136
112
|
this.deselect();
|
137
113
|
return;
|
138
114
|
}
|
139
|
-
|
140
115
|
this.select();
|
141
116
|
});
|
142
|
-
|
143
117
|
_defineProperty(this, "select", () => {
|
144
118
|
let pluginOptions = options.forTable(_classPrivateFieldGet(this, _row).table, RowSelection);
|
145
|
-
|
146
119
|
if ('key' in pluginOptions && pluginOptions.key) {
|
147
120
|
let key = pluginOptions.key(_classPrivateFieldGet(this, _row).data);
|
148
121
|
pluginOptions.onSelect?.(key, _classPrivateFieldGet(this, _row));
|
149
122
|
return;
|
150
123
|
}
|
151
|
-
|
152
124
|
pluginOptions.onSelect?.(_classPrivateFieldGet(this, _row).data, _classPrivateFieldGet(this, _row));
|
153
125
|
});
|
154
|
-
|
155
126
|
_defineProperty(this, "deselect", () => {
|
156
127
|
let pluginOptions = options.forTable(_classPrivateFieldGet(this, _row).table, RowSelection);
|
157
|
-
|
158
128
|
if ('key' in pluginOptions && pluginOptions.key) {
|
159
129
|
let key = pluginOptions.key(_classPrivateFieldGet(this, _row).data);
|
160
130
|
pluginOptions.onDeselect?.(key, _classPrivateFieldGet(this, _row));
|
161
131
|
return;
|
162
132
|
}
|
163
|
-
|
164
133
|
pluginOptions.onDeselect?.(_classPrivateFieldGet(this, _row).data, _classPrivateFieldGet(this, _row));
|
165
134
|
});
|
166
|
-
|
167
135
|
_classPrivateFieldSet(this, _row, row);
|
168
136
|
}
|
169
|
-
|
170
137
|
get isSelected() {
|
171
138
|
let tableMeta = meta.forTable(_classPrivateFieldGet(this, _row).table, RowSelection);
|
172
139
|
let pluginOptions = options.forTable(_classPrivateFieldGet(this, _row).table, RowSelection);
|
173
|
-
|
174
140
|
if ('key' in pluginOptions && pluginOptions.key) {
|
175
141
|
let compareWith = pluginOptions.key(_classPrivateFieldGet(this, _row).data);
|
176
142
|
return tableMeta.selection.has(compareWith);
|
177
143
|
}
|
178
|
-
|
179
144
|
let compareWith = _classPrivateFieldGet(this, _row).data;
|
180
|
-
|
181
145
|
return tableMeta.selection.has(compareWith);
|
182
146
|
}
|
183
|
-
|
184
147
|
}
|
185
148
|
|
186
149
|
export { RowSelection };
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"plugin.js","sources":["../../../../node_modules/.pnpm/@babel+runtime@7.19.4/node_modules/@babel/runtime/helpers/esm/classApplyDescriptorSet.js","../../../../node_modules/.pnpm/@babel+runtime@7.19.4/node_modules/@babel/runtime/helpers/esm/classPrivateFieldSet.js","../../../src/plugins/row-selection/plugin.ts"],"sourcesContent":["export default function _classApplyDescriptorSet(receiver, descriptor, value) {\n if (descriptor.set) {\n descriptor.set.call(receiver, value);\n } else {\n if (!descriptor.writable) {\n throw new TypeError(\"attempted to set read only private field\");\n }\n descriptor.value = value;\n }\n}","import classApplyDescriptorSet from \"./classApplyDescriptorSet.js\";\nimport classExtractFieldDescriptor from \"./classExtractFieldDescriptor.js\";\nexport default function _classPrivateFieldSet(receiver, privateMap, value) {\n var descriptor = classExtractFieldDescriptor(receiver, privateMap, \"set\");\n classApplyDescriptorSet(receiver, descriptor, value);\n return value;\n}","import { cached } from '@glimmer/tracking';\nimport { assert } from '@ember/debug';\n\nimport { BasePlugin, meta, options } from '../-private/base';\n\nimport type { Row, Table } from '[public-types]';\nimport type { PluginSignature, RowApi } from '#interfaces';\n\nexport interface Signature<DataType = any, Key = DataType> extends PluginSignature {\n Meta: {\n Table: TableMeta;\n Row: RowMeta;\n };\n Options: {\n Plugin: {\n /**\n * A set of selected things using the same type of Identifier\n * returned from `key`\n */\n selection: Set<Key> | Array<Key>;\n } & (\n | {\n /**\n * For a given row's data, how should the key be determined?\n * this could be a remote id from a database, or some other attribute\n *\n * This could be useful for indicating in UI if a particular item is selected.\n *\n * If not provided, the row's data will be used as the key\n */\n key: (data: DataType) => Key;\n /**\n * When a row is clicked, this will be invoked,\n * allowing you to update your selection object\n */\n onSelect: (item: Key, row: Row<DataType>) => void;\n /**\n * When a row is clicked (and the row is selected), this will be invoked,\n * allowing you to update your selection object\n */\n onDeselect: (item: Key, row: Row<DataType>) => void;\n }\n | {\n /**\n * When a row is clicked (and the row is not selected), this will be invoked,\n * allowing you to update your selection object\n */\n onSelect: (item: DataType | any, row: Row<DataType>) => void;\n /**\n * When a row is clicked (and the row is selected), this will be invoked,\n * allowing you to update your selection object\n */\n onDeselect: (item: DataType | any, row: Row<DataType>) => void;\n }\n );\n };\n}\n\n/**\n * This plugin provides a means of managing selection of a single row in a table.\n *\n * The state of what is actually selected is managed by you, but this plugin\n * will wire up the click listeners as well as let you know which *data* is clicked.\n */\nexport class RowSelection<DataType = any, Key = DataType> extends BasePlugin<\n Signature<DataType, Key>\n> {\n name = 'row-selection';\n\n meta = {\n row: RowMeta,\n table: TableMeta,\n };\n\n constructor(table: Table) {\n super(table);\n\n let pluginOptions = options.forTable(this.table, RowSelection);\n\n assert(\n `selection, onSelect, and onDeselect are all required arguments for the RowSelection plugin. ` +\n `Specify these options via \\`RowSelection.with(() => ({ selection, onSelect, onDeselect }))\\``,\n pluginOptions.selection && pluginOptions.onSelect && pluginOptions.onDeselect\n );\n }\n\n rowModifier = (element: HTMLElement, { row }: RowApi<Table<any>>) => {\n let handler = (event: Event) => {\n this.#clickHandler(row, event);\n };\n\n element.addEventListener('click', handler);\n\n return () => {\n element.removeEventListener('click', handler);\n };\n };\n\n #clickHandler = (row: Row, event: Event) => {\n assert(\n `expected event.target to be an instance of HTMLElement`,\n event.target instanceof HTMLElement || event.target instanceof SVGElement\n );\n\n let selection = document.getSelection();\n\n if (selection) {\n let { type, anchorNode } = selection;\n let isSelectingText = type === 'Range' && event.target?.contains(anchorNode);\n\n if (isSelectingText) {\n event.stopPropagation();\n\n return;\n }\n }\n\n // Ignore clicks on interactive elements within the row\n let inputParent = event.target.closest('input, button, label, a, select');\n\n if (inputParent) {\n return;\n }\n\n let rowMeta = meta.forRow(row, RowSelection);\n\n rowMeta.toggle();\n };\n}\n\nclass TableMeta {\n #table: Table;\n\n constructor(table: Table) {\n this.#table = table;\n }\n\n @cached\n get selection(): Set<unknown> {\n let passedSelection = options.forTable(this.#table, RowSelection).selection;\n\n assert(`Cannot access selection because it is undefined`, passedSelection);\n\n if (passedSelection instanceof Set) {\n return passedSelection;\n }\n\n return new Set(passedSelection);\n }\n}\n\nclass RowMeta {\n #row: Row<any>;\n\n constructor(row: Row<any>) {\n this.#row = row;\n }\n\n get isSelected(): boolean {\n let tableMeta = meta.forTable(this.#row.table, RowSelection);\n let pluginOptions = options.forTable(this.#row.table, RowSelection);\n\n if ('key' in pluginOptions && pluginOptions.key) {\n let compareWith = pluginOptions.key(this.#row.data);\n\n return tableMeta.selection.has(compareWith);\n }\n\n let compareWith = this.#row.data;\n\n return tableMeta.selection.has(compareWith);\n }\n\n toggle = () => {\n if (this.isSelected) {\n this.deselect();\n\n return;\n }\n\n this.select();\n };\n\n select = () => {\n let pluginOptions = options.forTable(this.#row.table, RowSelection);\n\n if ('key' in pluginOptions && pluginOptions.key) {\n let key = pluginOptions.key(this.#row.data);\n\n pluginOptions.onSelect?.(key, this.#row);\n\n return;\n }\n\n pluginOptions.onSelect?.(this.#row.data, this.#row);\n };\n\n deselect = () => {\n let pluginOptions = options.forTable(this.#row.table, RowSelection);\n\n if ('key' in pluginOptions && pluginOptions.key) {\n let key = pluginOptions.key(this.#row.data);\n\n pluginOptions.onDeselect?.(key, this.#row);\n\n return;\n }\n\n pluginOptions.onDeselect?.(this.#row.data, this.#row);\n };\n}\n"],"names":["_classApplyDescriptorSet","receiver","descriptor","value","set","call","writable","TypeError","_classPrivateFieldSet","privateMap","classExtractFieldDescriptor","classApplyDescriptorSet","RowSelection","BasePlugin","constructor","table","row","RowMeta","TableMeta","element","handler","event","addEventListener","removeEventListener","assert","target","HTMLElement","SVGElement","selection","document","getSelection","type","anchorNode","isSelectingText","contains","stopPropagation","inputParent","closest","rowMeta","meta","forRow","toggle","pluginOptions","options","forTable","onSelect","onDeselect","passedSelection","Set","cached","isSelected","deselect","select","key","data","tableMeta","compareWith","has"],"mappings":";;;;;;;;AAAe,SAASA,wBAAT,CAAkCC,QAAlC,EAA4CC,UAA5C,EAAwDC,KAAxD,EAA+D;EAC5E,IAAID,UAAU,CAACE,GAAf,EAAoB;AAClBF,IAAAA,UAAU,CAACE,GAAX,CAAeC,IAAf,CAAoBJ,QAApB,EAA8BE,KAA9B,CAAA,CAAA;AACD,GAFD,MAEO;AACL,IAAA,IAAI,CAACD,UAAU,CAACI,QAAhB,EAA0B;AACxB,MAAA,MAAM,IAAIC,SAAJ,CAAc,0CAAd,CAAN,CAAA;AACD,KAAA;;IACDL,UAAU,CAACC,KAAX,GAAmBA,KAAnB,CAAA;AACD,GAAA;AACF;;ACPc,SAASK,qBAAT,CAA+BP,QAA/B,EAAyCQ,UAAzC,EAAqDN,KAArD,EAA4D;EACzE,IAAID,UAAU,GAAGQ,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,SAAS,GAAGhB,IAAI,CAACK,QAAL,CAAc,qBAAU7B,CAAAA,IAAAA,EAAAA,IAAAA,CAAAA,CAAAA,KAAxB,EAA+BH,YAA/B,CAAhB,CAAA;IACA,IAAI8B,aAAa,GAAGC,OAAO,CAACC,QAAR,CAAiB,qBAAU7B,CAAAA,IAAAA,EAAAA,IAAAA,CAAAA,CAAAA,KAA3B,EAAkCH,YAAlC,CAApB,CAAA;;AAEA,IAAA,IAAI,SAAS8B,aAAT,IAA0BA,aAAa,CAACW,GAA5C,EAAiD;MAC/C,IAAIG,WAAW,GAAGd,aAAa,CAACW,GAAd,CAAkB,qBAAA,CAAA,IAAA,EAAA,IAAA,CAAA,CAAUC,IAA5B,CAAlB,CAAA;AAEA,MAAA,OAAOC,SAAS,CAAC3B,SAAV,CAAoB6B,GAApB,CAAwBD,WAAxB,CAAP,CAAA;AACD,KAAA;;IAED,IAAIA,WAAW,GAAG,qBAAA,CAAA,IAAA,EAAA,IAAA,CAAA,CAAUF,IAA5B,CAAA;;AAEA,IAAA,OAAOC,SAAS,CAAC3B,SAAV,CAAoB6B,GAApB,CAAwBD,WAAxB,CAAP,CAAA;AACD,GAAA;;AApBW;;;;"}
|
1
|
+
{"version":3,"file":"plugin.js","sources":["../../../../node_modules/.pnpm/@babel+runtime@7.20.1/node_modules/@babel/runtime/helpers/esm/classApplyDescriptorSet.js","../../../../node_modules/.pnpm/@babel+runtime@7.20.1/node_modules/@babel/runtime/helpers/esm/classPrivateFieldSet.js","../../../src/plugins/row-selection/plugin.ts"],"sourcesContent":["export default function _classApplyDescriptorSet(receiver, descriptor, value) {\n if (descriptor.set) {\n descriptor.set.call(receiver, value);\n } else {\n if (!descriptor.writable) {\n throw new TypeError(\"attempted to set read only private field\");\n }\n descriptor.value = value;\n }\n}","import classApplyDescriptorSet from \"./classApplyDescriptorSet.js\";\nimport classExtractFieldDescriptor from \"./classExtractFieldDescriptor.js\";\nexport default function _classPrivateFieldSet(receiver, privateMap, value) {\n var descriptor = classExtractFieldDescriptor(receiver, privateMap, \"set\");\n classApplyDescriptorSet(receiver, descriptor, value);\n return value;\n}","import { cached } from '@glimmer/tracking';\nimport { assert } from '@ember/debug';\n\nimport { BasePlugin, meta, options } from '../-private/base';\n\nimport type { Row, Table } from '[public-types]';\nimport type { PluginSignature, RowApi } from '#interfaces';\n\nexport interface Signature<DataType = any, Key = DataType> extends PluginSignature {\n Meta: {\n Table: TableMeta;\n Row: RowMeta;\n };\n Options: {\n Plugin: {\n /**\n * A set of selected things using the same type of Identifier\n * returned from `key`\n */\n selection: Set<Key> | Array<Key>;\n } & (\n | {\n /**\n * For a given row's data, how should the key be determined?\n * this could be a remote id from a database, or some other attribute\n *\n * This could be useful for indicating in UI if a particular item is selected.\n *\n * If not provided, the row's data will be used as the key\n */\n key: (data: DataType) => Key;\n /**\n * When a row is clicked, this will be invoked,\n * allowing you to update your selection object\n */\n onSelect: (item: Key, row: Row<DataType>) => void;\n /**\n * When a row is clicked (and the row is selected), this will be invoked,\n * allowing you to update your selection object\n */\n onDeselect: (item: Key, row: Row<DataType>) => void;\n }\n | {\n /**\n * When a row is clicked (and the row is not selected), this will be invoked,\n * allowing you to update your selection object\n */\n onSelect: (item: DataType | any, row: Row<DataType>) => void;\n /**\n * When a row is clicked (and the row is selected), this will be invoked,\n * allowing you to update your selection object\n */\n onDeselect: (item: DataType | any, row: Row<DataType>) => void;\n }\n );\n };\n}\n\n/**\n * This plugin provides a means of managing selection of a single row in a table.\n *\n * The state of what is actually selected is managed by you, but this plugin\n * will wire up the click listeners as well as let you know which *data* is clicked.\n */\nexport class RowSelection<DataType = any, Key = DataType> extends BasePlugin<\n Signature<DataType, Key>\n> {\n name = 'row-selection';\n\n meta = {\n row: RowMeta,\n table: TableMeta,\n };\n\n constructor(table: Table) {\n super(table);\n\n let pluginOptions = options.forTable(this.table, RowSelection);\n\n assert(\n `selection, onSelect, and onDeselect are all required arguments for the RowSelection plugin. ` +\n `Specify these options via \\`RowSelection.with(() => ({ selection, onSelect, onDeselect }))\\``,\n pluginOptions.selection && pluginOptions.onSelect && pluginOptions.onDeselect\n );\n }\n\n rowModifier = (element: HTMLElement, { row }: RowApi<Table<any>>) => {\n let handler = (event: Event) => {\n this.#clickHandler(row, event);\n };\n\n element.addEventListener('click', handler);\n\n return () => {\n element.removeEventListener('click', handler);\n };\n };\n\n #clickHandler = (row: Row, event: Event) => {\n assert(\n `expected event.target to be an instance of HTMLElement`,\n event.target instanceof HTMLElement || event.target instanceof SVGElement\n );\n\n let selection = document.getSelection();\n\n if (selection) {\n let { type, anchorNode } = selection;\n let isSelectingText = type === 'Range' && event.target?.contains(anchorNode);\n\n if (isSelectingText) {\n event.stopPropagation();\n\n return;\n }\n }\n\n // Ignore clicks on interactive elements within the row\n let inputParent = event.target.closest('input, button, label, a, select');\n\n if (inputParent) {\n return;\n }\n\n let rowMeta = meta.forRow(row, RowSelection);\n\n rowMeta.toggle();\n };\n}\n\nclass TableMeta {\n #table: Table;\n\n constructor(table: Table) {\n this.#table = table;\n }\n\n @cached\n get selection(): Set<unknown> {\n let passedSelection = options.forTable(this.#table, RowSelection).selection;\n\n assert(`Cannot access selection because it is undefined`, passedSelection);\n\n if (passedSelection instanceof Set) {\n return passedSelection;\n }\n\n return new Set(passedSelection);\n }\n}\n\nclass RowMeta {\n #row: Row<any>;\n\n constructor(row: Row<any>) {\n this.#row = row;\n }\n\n get isSelected(): boolean {\n let tableMeta = meta.forTable(this.#row.table, RowSelection);\n let pluginOptions = options.forTable(this.#row.table, RowSelection);\n\n if ('key' in pluginOptions && pluginOptions.key) {\n let compareWith = pluginOptions.key(this.#row.data);\n\n return tableMeta.selection.has(compareWith);\n }\n\n let compareWith = this.#row.data;\n\n return tableMeta.selection.has(compareWith);\n }\n\n toggle = () => {\n if (this.isSelected) {\n this.deselect();\n\n return;\n }\n\n this.select();\n };\n\n select = () => {\n let pluginOptions = options.forTable(this.#row.table, RowSelection);\n\n if ('key' in pluginOptions && pluginOptions.key) {\n let key = pluginOptions.key(this.#row.data);\n\n pluginOptions.onSelect?.(key, this.#row);\n\n return;\n }\n\n pluginOptions.onSelect?.(this.#row.data, this.#row);\n };\n\n deselect = () => {\n let pluginOptions = options.forTable(this.#row.table, RowSelection);\n\n if ('key' in pluginOptions && pluginOptions.key) {\n let key = pluginOptions.key(this.#row.data);\n\n pluginOptions.onDeselect?.(key, this.#row);\n\n return;\n }\n\n pluginOptions.onDeselect?.(this.#row.data, this.#row);\n };\n}\n"],"names":["_classApplyDescriptorSet","receiver","descriptor","value","set","call","writable","TypeError","_classPrivateFieldSet","privateMap","classExtractFieldDescriptor","classApplyDescriptorSet","RowSelection","BasePlugin","constructor","table","row","RowMeta","TableMeta","element","handler","event","addEventListener","removeEventListener","assert","target","HTMLElement","SVGElement","selection","document","getSelection","type","anchorNode","isSelectingText","contains","stopPropagation","inputParent","closest","rowMeta","meta","forRow","toggle","pluginOptions","options","forTable","onSelect","onDeselect","passedSelection","Set","cached","isSelected","deselect","select","key","data","tableMeta","compareWith","has"],"mappings":";;;;;;;;AAAe,SAASA,wBAAwB,CAACC,QAAQ,EAAEC,UAAU,EAAEC,KAAK,EAAE;EAC5E,IAAID,UAAU,CAACE,GAAG,EAAE;IAClBF,UAAU,CAACE,GAAG,CAACC,IAAI,CAACJ,QAAQ,EAAEE,KAAK,CAAC,CAAA;AACtC,GAAC,MAAM;AACL,IAAA,IAAI,CAACD,UAAU,CAACI,QAAQ,EAAE;AACxB,MAAA,MAAM,IAAIC,SAAS,CAAC,0CAA0C,CAAC,CAAA;AACjE,KAAA;IACAL,UAAU,CAACC,KAAK,GAAGA,KAAK,CAAA;AAC1B,GAAA;AACF;;ACPe,SAASK,qBAAqB,CAACP,QAAQ,EAAEQ,UAAU,EAAEN,KAAK,EAAE;EACzE,IAAID,UAAU,GAAGQ,4BAA2B,CAACT,QAAQ,EAAEQ,UAAU,EAAE,KAAK,CAAC,CAAA;AACzEE,EAAAA,wBAAuB,CAACV,QAAQ,EAAEC,UAAU,EAAEC,KA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I,EAAM,IAAA,CAAA,CAAA,CAAA;KACtD,CAAA,CAAA;AAtDC,IAAA,qBAAA,CAAA,IAAI,QAAQtC,GAAG,CAAA,CAAA;AACjB,GAAA;AAEA,EAAA,IAAIkC,UAAU,GAAY;IACxB,IAAIK,SAAS,GAAGhB,IAAI,CAACK,QAAQ,CAAC,qBAAA,CAAA,IAAI,EAAM7B,IAAAA,CAAAA,CAAAA,KAAK,EAAEH,YAAY,CAAC,CAAA;IAC5D,IAAI8B,aAAa,GAAGC,OAAO,CAACC,QAAQ,CAAC,qBAAA,CAAA,IAAI,EAAM7B,IAAAA,CAAAA,CAAAA,KAAK,EAAEH,YAAY,CAAC,CAAA;AAEnE,IAAA,IAAI,KAAK,IAAI8B,aAAa,IAAIA,aAAa,CAACW,GAAG,EAAE;MAC/C,IAAIG,WAAW,GAAGd,aAAa,CAACW,GAAG,CAAC,qBAAA,CAAA,IAAI,EAAMC,IAAAA,CAAAA,CAAAA,IAAI,CAAC,CAAA;AAEnD,MAAA,OAAOC,SAAS,CAAC3B,SAAS,CAAC6B,GAAG,CAACD,WAAW,CAAC,CAAA;AAC7C,KAAA;AAEA,IAAA,IAAIA,WAAW,GAAG,qBAAI,CAAA,IAAA,EAAA,IAAA,CAAA,CAAMF,IAAI,CAAA;AAEhC,IAAA,OAAOC,SAAS,CAAC3B,SAAS,CAAC6B,GAAG,CAACD,WAAW,CAAC,CAAA;AAC7C,GAAA;AAuCF;;;;"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"helpers.js","sources":["../../../src/plugins/sticky-columns/helpers.ts"],"sourcesContent":["import { meta } from '../-private/base';\nimport { StickyColumns } from './plugin';\n\nimport type { Column } from '[public-types]';\n\nexport const isSticky = <DataType = unknown>(column: Column<DataType>) =>\n meta.forColumn(column, StickyColumns).isSticky;\n\nexport const styleFor = <DataType = unknown>(\n column: Column<DataType>\n): Partial<CSSStyleDeclaration> => meta.forColumn(column, StickyColumns).style;\n"],"names":["isSticky","column","meta","forColumn","StickyColumns","styleFor","style"],"mappings":";;;AAKaA,MAAAA,QAAQ,GAAwBC,
|
1
|
+
{"version":3,"file":"helpers.js","sources":["../../../src/plugins/sticky-columns/helpers.ts"],"sourcesContent":["import { meta } from '../-private/base';\nimport { StickyColumns } from './plugin';\n\nimport type { Column } from '[public-types]';\n\nexport const isSticky = <DataType = unknown>(column: Column<DataType>) =>\n meta.forColumn(column, StickyColumns).isSticky;\n\nexport const styleFor = <DataType = unknown>(\n column: Column<DataType>\n): Partial<CSSStyleDeclaration> => meta.forColumn(column, StickyColumns).style;\n"],"names":["isSticky","column","meta","forColumn","StickyColumns","styleFor","style"],"mappings":";;;AAKaA,MAAAA,QAAQ,GAAwBC,MAAwB,IACnEC,IAAI,CAACC,SAAS,CAACF,MAAM,EAAEG,aAAa,CAAC,CAACJ,SAAQ;AAEnCK,MAAAA,QAAQ,GACnBJ,MAAwB,IACSC,IAAI,CAACC,SAAS,CAACF,MAAM,EAAEG,aAAa,CAAC,CAACE;;;;"}
|