ember-headless-table 0.0.0 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (169) hide show
  1. package/addon-main.js +5 -0
  2. package/dist/-private/-type-tests/plugin-properties.test.d.ts +2 -0
  3. package/dist/-private/-type-tests/plugin-properties.test.d.ts.map +1 -0
  4. package/dist/-private/-type-tests/plugin-properties.test.js +31 -0
  5. package/dist/-private/-type-tests/plugin-properties.test.js.map +1 -0
  6. package/dist/-private/-type-tests/plugin-with.test.d.ts +1 -0
  7. package/dist/-private/-type-tests/plugin-with.test.js +21 -0
  8. package/dist/-private/-type-tests/plugin-with.test.js.map +1 -0
  9. package/dist/-private/-type-tests/plugins-accessors.test.d.ts +1 -0
  10. package/dist/-private/-type-tests/plugins-accessors.test.js +36 -0
  11. package/dist/-private/-type-tests/plugins-accessors.test.js.map +1 -0
  12. package/dist/-private/-type-tests/plugins-signature-from.test.d.ts +1 -0
  13. package/dist/-private/-type-tests/plugins-signature-from.test.js +14 -0
  14. package/dist/-private/-type-tests/plugins-signature-from.test.js.map +1 -0
  15. package/dist/-private/-type-tests/plugins-signature-utils.test.d.ts +1 -0
  16. package/dist/-private/-type-tests/plugins-signature-utils.test.js +36 -0
  17. package/dist/-private/-type-tests/plugins-signature-utils.test.js.map +1 -0
  18. package/dist/-private/-type-tests/table-api.test.d.ts +1 -0
  19. package/dist/-private/-type-tests/table-api.test.js +16 -0
  20. package/dist/-private/-type-tests/table-api.test.js.map +1 -0
  21. package/dist/-private/-type-tests/table-config.test.d.ts +1 -0
  22. package/dist/-private/-type-tests/table-config.test.js +58 -0
  23. package/dist/-private/-type-tests/table-config.test.js.map +1 -0
  24. package/dist/-private/column.d.ts +18 -0
  25. package/dist/-private/column.js +70 -0
  26. package/dist/-private/column.js.map +1 -0
  27. package/dist/-private/interfaces/column.d.ts +57 -0
  28. package/dist/-private/interfaces/column.js +2 -0
  29. package/dist/-private/interfaces/column.js.map +1 -0
  30. package/dist/-private/interfaces/index.d.ts +7 -0
  31. package/dist/-private/interfaces/index.js +2 -0
  32. package/dist/-private/interfaces/index.js.map +1 -0
  33. package/dist/-private/interfaces/modifier.d.ts +7 -0
  34. package/dist/-private/interfaces/modifier.js +2 -0
  35. package/dist/-private/interfaces/modifier.js.map +1 -0
  36. package/dist/-private/interfaces/pagination.d.ts +17 -0
  37. package/dist/-private/interfaces/pagination.js +2 -0
  38. package/dist/-private/interfaces/pagination.js.map +1 -0
  39. package/dist/-private/interfaces/plugins.d.ts +314 -0
  40. package/dist/-private/interfaces/plugins.js +2 -0
  41. package/dist/-private/interfaces/plugins.js.map +1 -0
  42. package/dist/-private/interfaces/preferences.d.ts +74 -0
  43. package/dist/-private/interfaces/preferences.js +2 -0
  44. package/dist/-private/interfaces/preferences.js.map +1 -0
  45. package/dist/-private/interfaces/selection.d.ts +35 -0
  46. package/dist/-private/interfaces/selection.js +2 -0
  47. package/dist/-private/interfaces/selection.js.map +1 -0
  48. package/dist/-private/interfaces/table.d.ts +109 -0
  49. package/dist/-private/interfaces/table.js +2 -0
  50. package/dist/-private/interfaces/table.js.map +1 -0
  51. package/dist/-private/js-helper.d.ts +39 -0
  52. package/dist/-private/js-helper.js +20 -0
  53. package/dist/-private/js-helper.js.map +1 -0
  54. package/dist/-private/preferences.d.ts +56 -0
  55. package/dist/-private/preferences.js +175 -0
  56. package/dist/-private/preferences.js.map +1 -0
  57. package/dist/-private/private-types.d.ts +6 -0
  58. package/dist/-private/private-types.js +2 -0
  59. package/dist/-private/private-types.js.map +1 -0
  60. package/dist/-private/row.d.ts +12 -0
  61. package/dist/-private/row.js +63 -0
  62. package/dist/-private/row.js.map +1 -0
  63. package/dist/-private/table.d.ts +0 -0
  64. package/dist/-private/table.js +18 -0
  65. package/dist/-private/table.js.map +1 -0
  66. package/dist/-private/utils.d.ts +3 -0
  67. package/dist/-private/utils.js +17 -0
  68. package/dist/-private/utils.js.map +1 -0
  69. package/dist/applyDecoratedDescriptor-e0489e2f.js +31 -0
  70. package/dist/applyDecoratedDescriptor-e0489e2f.js.map +1 -0
  71. package/dist/classPrivateFieldGet-af59a8ea.js +23 -0
  72. package/dist/classPrivateFieldGet-af59a8ea.js.map +1 -0
  73. package/dist/defineProperty-a0196711.js +17 -0
  74. package/dist/defineProperty-a0196711.js.map +1 -0
  75. package/dist/index.d.ts +13 -0
  76. package/dist/index.js +4 -0
  77. package/dist/index.js.map +1 -0
  78. package/dist/plugins/-private/base.d.ts +267 -0
  79. package/dist/plugins/-private/base.js +486 -0
  80. package/dist/plugins/-private/base.js.map +1 -0
  81. package/dist/plugins/-private/utils.d.ts +21 -0
  82. package/dist/plugins/-private/utils.js +118 -0
  83. package/dist/plugins/-private/utils.js.map +1 -0
  84. package/dist/plugins/column-reordering/helpers.d.ts +28 -0
  85. package/dist/plugins/column-reordering/helpers.js +37 -0
  86. package/dist/plugins/column-reordering/helpers.js.map +1 -0
  87. package/dist/plugins/column-reordering/index.d.ts +3 -0
  88. package/dist/plugins/column-reordering/index.js +3 -0
  89. package/dist/plugins/column-reordering/index.js.map +1 -0
  90. package/dist/plugins/column-reordering/plugin.d.ts +133 -0
  91. package/dist/plugins/column-reordering/plugin.js +392 -0
  92. package/dist/plugins/column-reordering/plugin.js.map +1 -0
  93. package/dist/plugins/column-reordering/utils.d.ts +7 -0
  94. package/dist/plugins/column-reordering/utils.js +41 -0
  95. package/dist/plugins/column-reordering/utils.js.map +1 -0
  96. package/dist/plugins/column-resizing/handle.d.ts +116 -0
  97. package/dist/plugins/column-resizing/handle.js +251 -0
  98. package/dist/plugins/column-resizing/handle.js.map +1 -0
  99. package/dist/plugins/column-resizing/helpers.d.ts +17 -0
  100. package/dist/plugins/column-resizing/helpers.js +22 -0
  101. package/dist/plugins/column-resizing/helpers.js.map +1 -0
  102. package/dist/plugins/column-resizing/index.d.ts +4 -0
  103. package/dist/plugins/column-resizing/index.js +4 -0
  104. package/dist/plugins/column-resizing/index.js.map +1 -0
  105. package/dist/plugins/column-resizing/plugin.d.ts +144 -0
  106. package/dist/plugins/column-resizing/plugin.js +352 -0
  107. package/dist/plugins/column-resizing/plugin.js.map +1 -0
  108. package/dist/plugins/column-resizing/resize-observer.d.ts +14 -0
  109. package/dist/plugins/column-resizing/resize-observer.js +46 -0
  110. package/dist/plugins/column-resizing/resize-observer.js.map +1 -0
  111. package/dist/plugins/column-resizing/utils.d.ts +22 -0
  112. package/dist/plugins/column-resizing/utils.js +46 -0
  113. package/dist/plugins/column-resizing/utils.js.map +1 -0
  114. package/dist/plugins/column-visibility/helpers.d.ts +18 -0
  115. package/dist/plugins/column-visibility/helpers.js +25 -0
  116. package/dist/plugins/column-visibility/helpers.js.map +1 -0
  117. package/dist/plugins/column-visibility/index.d.ts +3 -0
  118. package/dist/plugins/column-visibility/index.js +3 -0
  119. package/dist/plugins/column-visibility/index.js.map +1 -0
  120. package/dist/plugins/column-visibility/plugin.d.ts +62 -0
  121. package/dist/plugins/column-visibility/plugin.js +124 -0
  122. package/dist/plugins/column-visibility/plugin.js.map +1 -0
  123. package/dist/plugins/data-sorting/helpers.d.ts +38 -0
  124. package/dist/plugins/data-sorting/helpers.js +49 -0
  125. package/dist/plugins/data-sorting/helpers.js.map +1 -0
  126. package/dist/plugins/data-sorting/index.d.ts +5 -0
  127. package/dist/plugins/data-sorting/index.js +4 -0
  128. package/dist/plugins/data-sorting/index.js.map +1 -0
  129. package/dist/plugins/data-sorting/plugin.d.ts +99 -0
  130. package/dist/plugins/data-sorting/plugin.js +165 -0
  131. package/dist/plugins/data-sorting/plugin.js.map +1 -0
  132. package/dist/plugins/data-sorting/types.d.ts +23 -0
  133. package/dist/plugins/data-sorting/types.js +17 -0
  134. package/dist/plugins/data-sorting/types.js.map +1 -0
  135. package/dist/plugins/index.d.ts +5 -0
  136. package/dist/plugins/index.js +3 -0
  137. package/dist/plugins/index.js.map +1 -0
  138. package/dist/plugins/row-selection/helpers.d.ts +6 -0
  139. package/dist/plugins/row-selection/helpers.js +10 -0
  140. package/dist/plugins/row-selection/helpers.js.map +1 -0
  141. package/dist/plugins/row-selection/index.d.ts +3 -0
  142. package/dist/plugins/row-selection/index.js +3 -0
  143. package/dist/plugins/row-selection/index.js.map +1 -0
  144. package/dist/plugins/row-selection/plugin.d.ts +79 -0
  145. package/dist/plugins/row-selection/plugin.js +187 -0
  146. package/dist/plugins/row-selection/plugin.js.map +1 -0
  147. package/dist/plugins/sticky-columns/helpers.d.ts +4 -0
  148. package/dist/plugins/sticky-columns/helpers.js +8 -0
  149. package/dist/plugins/sticky-columns/helpers.js.map +1 -0
  150. package/dist/plugins/sticky-columns/index.d.ts +3 -0
  151. package/dist/plugins/sticky-columns/index.js +3 -0
  152. package/dist/plugins/sticky-columns/index.js.map +1 -0
  153. package/dist/plugins/sticky-columns/plugin.d.ts +53 -0
  154. package/dist/plugins/sticky-columns/plugin.js +132 -0
  155. package/dist/plugins/sticky-columns/plugin.js.map +1 -0
  156. package/dist/table-8e46554b.d.ts +127 -0
  157. package/dist/table-8e46554b.js +249 -0
  158. package/dist/table-8e46554b.js.map +1 -0
  159. package/dist/test-support/index.d.ts +14 -0
  160. package/dist/test-support/index.js +72 -0
  161. package/dist/test-support/index.js.map +1 -0
  162. package/dist/utils.d.ts +26 -0
  163. package/dist/utils.js +77 -0
  164. package/dist/utils.js.map +1 -0
  165. package/package.json +147 -51
  166. package/LICENSE.md +0 -9
  167. package/README.md +0 -38
  168. package/config/environment.js +0 -5
  169. package/index.js +0 -5
@@ -0,0 +1,267 @@
1
+ import { Table } from "../../table-8e46554b";
2
+ import { ColumnReordering } from "../column-reordering/index";
3
+ import { ColumnVisibility } from "../column-visibility/index";
4
+ import { Class, Constructor } from "../../-private/private-types";
5
+ import { Column, Row } from "../../index";
6
+ import { ColumnMetaFor, ColumnOptionsFor, OptionsFor, Plugin, RowMetaFor, TableMetaFor } from "../../-private/interfaces/index";
7
+ type InstanceOf<T> = T extends Class<infer Instance> ? Instance : T;
8
+ /**
9
+ * @public
10
+ *
11
+ * list of interfaces by feature name that consumers may provide alternative
12
+ * implementation for
13
+ */
14
+ interface TableFeatures extends Record<string, unknown | undefined> {
15
+ /**
16
+ * @public
17
+ *
18
+ * interface for the table meta of a "column visibility plugin"
19
+ */
20
+ columnVisibility: InstanceOf<ColumnVisibility['meta']['table']>;
21
+ /**
22
+ * @public
23
+ *
24
+ * interface for the table meta of a "column order plugin"
25
+ */
26
+ columnOrder: InstanceOf<ColumnReordering['meta']['table']>;
27
+ }
28
+ /**
29
+ * @public
30
+ *
31
+ * list of interfaces by feature name that consumers may provide alternative
32
+ * implementation for
33
+ */
34
+ interface ColumnFeatures extends Record<string, unknown | undefined> {
35
+ /**
36
+ * @public
37
+ *
38
+ * interface for the column meta of a "column visibility plugin"
39
+ */
40
+ columnVisibility: InstanceOf<ColumnVisibility['meta']['column']>;
41
+ /**
42
+ * @public
43
+ *
44
+ * interface for the column meta of a "column order plugin"
45
+ */
46
+ columnOrder: InstanceOf<ColumnReordering['meta']['column']>;
47
+ }
48
+ /**
49
+ * @private utility type
50
+ *
51
+ */
52
+ type SignatureFrom<Klass extends BasePlugin<any>> = Klass extends BasePlugin<infer Signature> ? Signature : never;
53
+ declare const __Signature__: unique symbol;
54
+ /**
55
+ * @public
56
+ *
57
+ * If your table plugin is a class, you may extend from BasePlugin, which provides
58
+ * small utility methods and properties for getting the metadata for your plugin
59
+ * for the table and each column
60
+ *
61
+ * One instance of a plugin exists per table
62
+ */
63
+ declare abstract class BasePlugin<Signature = unknown> implements Plugin<Signature> {
64
+ protected table: Table;
65
+ constructor(table: Table);
66
+ /**
67
+ * @private (secret)
68
+ *
69
+ * Because classes are kind of like interfaces,
70
+ * we need "something" to help TS know what a Resource is.
71
+ *
72
+ * This isn't a real API, but does help with type inference
73
+ * with the SignatureFrom utility above
74
+ */
75
+ [__Signature__]: Signature;
76
+ /**
77
+ * Helper for specifying plugins on `headlessTable` with the plugin-level options
78
+ */
79
+ /**
80
+ * Helper for specifying plugins on `headlessTable` with the plugin-level options
81
+ */
82
+ static with<T extends BasePlugin<any>>(this: Constructor<T>, configFn: () => OptionsFor<SignatureFrom<T>>): [Constructor<T>, () => OptionsFor<SignatureFrom<T>>];
83
+ /**
84
+ * Helper for specifying column-level configurations for a plugin on `headlessTable`'s
85
+ * columns option
86
+ */
87
+ /**
88
+ * Helper for specifying column-level configurations for a plugin on `headlessTable`'s
89
+ * columns option
90
+ */
91
+ static forColumn<T extends BasePlugin<any>>(this: Constructor<T>, configFn: () => ColumnOptionsFor<SignatureFrom<T>>): [Constructor<T>, () => ColumnOptionsFor<SignatureFrom<T>>];
92
+ meta?: {
93
+ column?: Constructor<ColumnMetaFor<Signature>>;
94
+ table?: Constructor<TableMetaFor<Signature>>;
95
+ row?: Constructor<RowMetaFor<Signature>>;
96
+ };
97
+ abstract name: string;
98
+ static features?: string[];
99
+ static requires?: string[];
100
+ }
101
+ declare const preferences: {
102
+ /**
103
+ * @public
104
+ *
105
+ * returns an object for getting and setting preferences data
106
+ * based on the column (scoped to key)
107
+ *
108
+ * Only the provided plugin will have access to these preferences
109
+ * (though, if other plugins can guess how the underlying plugin access
110
+ * works, they can access this data, too. No security guaranteed)
111
+ */
112
+ forColumn<P extends BasePlugin<any>, Data = unknown>(column: Column<Data>, klass: Class<P>): {
113
+ /**
114
+ * delete an entry on the underlying `Map` used for this column-plugin pair
115
+ */
116
+ delete(key: string): void | undefined;
117
+ /**
118
+ * get an entry on the underlying `Map` used for this column-plugin pair
119
+ */
120
+ get(key: string): unknown;
121
+ /**
122
+ * set an entry on the underlying `Map` used for this column-plugin pair
123
+ */
124
+ set(key: string, value: unknown): void;
125
+ };
126
+ /**
127
+ * @public
128
+ *
129
+ * returns an object for getting and setting preferences data
130
+ * based on the table (scoped to the key: "table")
131
+ *
132
+ * Only the provided plugin will have access to these preferences
133
+ * (though, if other plugins can guess how the underlying plugin access
134
+ * works, they can access this data, too. No security guaranteed)
135
+ */
136
+ forTable<P_1 extends BasePlugin<any>, Data_1 = unknown>(table: Table<Data_1>, klass: Class<P_1>): {
137
+ /**
138
+ * delete an entry on the underlying `Map` used for this column-plugin pair
139
+ */
140
+ delete(key: string): void | undefined;
141
+ /**
142
+ * get an entry on the underlying `Map` used for this column-plugin pair
143
+ */
144
+ get(key: string): unknown;
145
+ /**
146
+ * set an entry on the underlying `Map` used for this column-plugin pair
147
+ */
148
+ set(key: string, value: unknown): void | undefined;
149
+ };
150
+ };
151
+ /**
152
+ * if a `requester` is not provided,
153
+ * Get the columns for the table, considering any and all plugins that could modify columns.
154
+ *
155
+ * If you are an end-consumer of ember-headless-table, this is the function to use.
156
+ * If you are a plugin-author, you'll want to pass your plugin class as the second parameter.
157
+ *
158
+ * For a given plugin, `requester`, determine what columns should be returned.
159
+ * Since multiple plugins could be used in a table, there is an implicit hierarchy of
160
+ * column modifications that can occur from each of those plugins.
161
+ *
162
+ * If a plugin defines other plugins as either *requirements* or *optional requirements*,
163
+ * and that upstream plugin defines a `columns` property, then those columns will be returned here.
164
+ *
165
+ * This works recursively up the plugin tree up until a plugin has no requirements, and then
166
+ * all columns from the table are returned.
167
+ */
168
+ declare function columnsFor<DataType = any>(table: Table<DataType>, requester?: Plugin<any> | undefined): Column<DataType>[];
169
+ declare const columns: {
170
+ for: typeof columnsFor;
171
+ /**
172
+ * for a given current or reference column, return the column that
173
+ * is immediately next, or to the right of that column.
174
+ *
175
+ * If a plugin class is provided, the hierarchy of column list modifications
176
+ * will be respected.
177
+ */
178
+ next: <Data = unknown>(current: Column<Data>, requester?: Plugin<any>) => Column<Data> | undefined;
179
+ /**
180
+ * for a given current or reference column, return the column that
181
+ * is immediately previous, or to the left of that column.
182
+ *
183
+ * If a plugin class is provided, the hierarchy of column list modifications
184
+ * will be respected.
185
+ */
186
+ previous: <Data_1 = unknown>(current: Column<Data_1>, requester?: Plugin<any>) => Column<Data_1> | undefined;
187
+ /**
188
+ * for a given current or reference column, return the columns that
189
+ * should appear before, or to the left of that column.
190
+ *
191
+ * if a plugin class is provided, the hierarchy of column list modifications
192
+ * will be respected.
193
+ */
194
+ before: <Data_2 = unknown>(current: Column<Data_2>, requester?: Plugin<any>) => Column<Data_2>[];
195
+ /**
196
+ * for a given current or reference column, return the columns that
197
+ * should appear after, or to the right of that column.
198
+ *
199
+ * if a plugin class is provided, the hierarchy of column list modifications
200
+ * will be respected.
201
+ */
202
+ after: <Data_3 = unknown>(current: Column<Data_3>, requester?: Plugin<any>) => Column<Data_3>[];
203
+ };
204
+ declare const meta: {
205
+ /**
206
+ * @public
207
+ *
208
+ * For a given column and plugin, return the meta / state bucket for the
209
+ * plugin<->column instance pair.
210
+ *
211
+ * Note that this requires the column instance to exist on the table.
212
+ */
213
+ forColumn<P extends BasePlugin<any>, Data = unknown>(column: Column<Data>, klass: Class<P>): ColumnMetaFor<SignatureFrom<P>>;
214
+ /**
215
+ * @public
216
+ *
217
+ * For a given row and plugin, return the meta / state bucket for the
218
+ * plugin<->row instance pair.
219
+ *
220
+ * Note that this requires the row instance to exist on the table.
221
+ */
222
+ forRow<P_1 extends BasePlugin<any>, Data_1 = unknown>(row: Row<Data_1>, klass: Class<P_1>): RowMetaFor<SignatureFrom<P_1>>;
223
+ /**
224
+ * @public
225
+ *
226
+ * For a given table and plugin, return the meta / state bucket for the
227
+ * plugin<->table instance pair.
228
+ */
229
+ forTable<P_2 extends BasePlugin<any>, Data_2 = unknown>(table: Table<Data_2>, klass: Class<P_2>): TableMetaFor<SignatureFrom<P_2>>;
230
+ /**
231
+ * Instead of finding meta based on column or table instances,
232
+ * you can search for meta based on feature strings, such as `columnWidth`
233
+ */
234
+ withFeature: {
235
+ /**
236
+ * @public
237
+ *
238
+ * for a given column and feature name, return the "ColumnMeta" for that feature.
239
+ * This is useful when plugins may depend on one another but may not necessarily care which
240
+ * plugin is providing what behavior.
241
+ *
242
+ * For example, multiple column-focused plugins may care about width or visibility
243
+ */
244
+ forColumn<FeatureName extends string, Data_3 = unknown>(column: Column<Data_3>, featureName: FeatureName): ColumnFeatures[FeatureName];
245
+ /**
246
+ * @public
247
+ *
248
+ * for a given table and feature name, return the "TableMeta" for that feature.
249
+ * This is useful when plugins may depend on one another but may not necessarily care
250
+ * which plugin is providing that behavior.
251
+ *
252
+ * For example, multiple column-focused plugins may care about width or visibility.
253
+ */
254
+ forTable<FeatureName_1 extends string, Data_4 = unknown>(table: Table<Data_4>, featureName: FeatureName_1): TableFeatures[FeatureName_1];
255
+ };
256
+ };
257
+ declare const options: {
258
+ /**
259
+ * @public
260
+ *
261
+ * For a given table and plugin, return the options, if any were given from the user
262
+ * during construction of the table.
263
+ */
264
+ forTable<P extends BasePlugin<any>, Data = unknown>(table: Table<Data>, klass: Class<P>): Partial<OptionsFor<SignatureFrom<P>>>;
265
+ forColumn<P_1 extends BasePlugin<any>, Data_1 = unknown>(column: Column<Data_1>, klass: Class<P_1>): Partial<ColumnOptionsFor<SignatureFrom<P_1>>>;
266
+ };
267
+ export { TableFeatures, ColumnFeatures, SignatureFrom, BasePlugin, preferences, columns, meta, options };