@leavittsoftware/web 5.16.0 → 5.18.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.
@@ -0,0 +1,353 @@
1
+ import { __decorate } from "tslib";
2
+ import '@material/web/dialog/dialog';
3
+ import '@material/web/button/text-button';
4
+ import '@material/web/tabs/tabs';
5
+ import '@material/web/tabs/primary-tab';
6
+ import '@material/web/button/filled-tonal-button';
7
+ import '@material/web/icon/icon';
8
+ import '@material/web/menu/menu';
9
+ import '@material/web/menu/menu-item';
10
+ import './data-table-core-settings-item';
11
+ import './data-table-core-settings-sort-item';
12
+ import { LitElement, css, html, nothing } from 'lit';
13
+ import { customElement, property, query, state } from 'lit/decorators.js';
14
+ import { generateDefaultSortFromMetaData } from './data-table-core';
15
+ import { dialogCloseNavigationHack, dialogOpenNavigationHack } from '../hacks/dialog-navigation-hack';
16
+ import { dialogZIndexHack } from '../hacks/dialog-zindex-hack';
17
+ import { repeat } from 'lit/directives/repeat.js';
18
+ import { niceBadgeStyles } from '../styles/nice-badge';
19
+ import { LoadWhile } from '../helpers/load-while';
20
+ let TitaniumDataTableCoreSettingsDialog = class TitaniumDataTableCoreSettingsDialog extends LoadWhile(LitElement) {
21
+ #tableMetaData_accessor_storage = null;
22
+ get tableMetaData() { return this.#tableMetaData_accessor_storage; }
23
+ set tableMetaData(value) { this.#tableMetaData_accessor_storage = value; }
24
+ #userSettings_accessor_storage = [];
25
+ get userSettings() { return this.#userSettings_accessor_storage; }
26
+ set userSettings(value) { this.#userSettings_accessor_storage = value; }
27
+ #sort_accessor_storage = [];
28
+ get sort() { return this.#sort_accessor_storage; }
29
+ set sort(value) { this.#sort_accessor_storage = value; }
30
+ #viewMode_accessor_storage = 'Customize';
31
+ get viewMode() { return this.#viewMode_accessor_storage; }
32
+ set viewMode(value) { this.#viewMode_accessor_storage = value; }
33
+ #customSortApplied_accessor_storage = false;
34
+ get customSortApplied() { return this.#customSortApplied_accessor_storage; }
35
+ set customSortApplied(value) { this.#customSortApplied_accessor_storage = value; }
36
+ #customColumnsApplied_accessor_storage = false;
37
+ get customColumnsApplied() { return this.#customColumnsApplied_accessor_storage; }
38
+ set customColumnsApplied(value) { this.#customColumnsApplied_accessor_storage = value; }
39
+ #dialog_accessor_storage;
40
+ get dialog() { return this.#dialog_accessor_storage; }
41
+ set dialog(value) { this.#dialog_accessor_storage = value; }
42
+ updated(changedProperties) {
43
+ if (changedProperties.has('tableMetaData')) {
44
+ //make sure all keys in tableMetaData.itemMetaData are in userSettings
45
+ if (this.tableMetaData?.itemMetaData.some((item) => !this.userSettings.some((setting) => setting.key === item.key))) {
46
+ this.#resetUserSettings();
47
+ }
48
+ //check if columns have been removed
49
+ if (this.tableMetaData?.itemMetaData.length !== this.userSettings.length) {
50
+ this.#resetUserSettings();
51
+ }
52
+ }
53
+ if (changedProperties.has('sort') || changedProperties.has('tableMetaData')) {
54
+ const defaultSort = generateDefaultSortFromMetaData(this.tableMetaData);
55
+ const _customSortApplied = JSON.stringify(defaultSort) !== JSON.stringify(this.sort);
56
+ if (this.customSortApplied !== _customSortApplied) {
57
+ this.customSortApplied = _customSortApplied;
58
+ this.dispatchEvent(new Event('custom-sort-applied-change'));
59
+ }
60
+ }
61
+ if (changedProperties.has('userSettings') || changedProperties.has('tableMetaData')) {
62
+ const _customColumnsApplied = this.#getNumberOfCustomSettingsApplied(this.userSettings, this.tableMetaData) > 0;
63
+ if (this.customColumnsApplied !== _customColumnsApplied) {
64
+ this.customColumnsApplied = _customColumnsApplied;
65
+ this.dispatchEvent(new Event('custom-columns-applied-change'));
66
+ }
67
+ }
68
+ }
69
+ #getNumberOfCustomSettingsApplied(userSettings, tableMetaData) {
70
+ let settingsCount = 0;
71
+ for (const metaData of tableMetaData?.itemMetaData ?? []) {
72
+ const setting = userSettings.find((setting) => setting.key === metaData.key);
73
+ if (setting?.show && metaData.hideByDefault) {
74
+ settingsCount++;
75
+ }
76
+ if (!setting?.show && !metaData.hideByDefault) {
77
+ settingsCount++;
78
+ }
79
+ }
80
+ //check if items are re-ordered by index, if so count as one change
81
+ if (userSettings.some((setting, index) => setting.key !== tableMetaData?.itemMetaData[index].key) ||
82
+ tableMetaData?.itemMetaData.some((metaData, index) => metaData.key !== userSettings[index].key)) {
83
+ settingsCount++;
84
+ }
85
+ return settingsCount;
86
+ }
87
+ #resetUserSettings() {
88
+ const _userSettings = this.tableMetaData?.itemMetaData.map((item) => ({ key: item.key, show: !item.hideByDefault })) ?? [];
89
+ if (JSON.stringify(_userSettings) !== JSON.stringify(this.userSettings)) {
90
+ this.userSettings = _userSettings;
91
+ this.dispatchEvent(new Event('setting-change'));
92
+ }
93
+ }
94
+ #resetSort() {
95
+ const _sort = generateDefaultSortFromMetaData(this.tableMetaData);
96
+ if (JSON.stringify(_sort) !== JSON.stringify(this.sort)) {
97
+ this.sort = _sort;
98
+ this.dispatchEvent(new Event('sort-changed'));
99
+ }
100
+ }
101
+ async show() {
102
+ this.dialog.returnValue = '';
103
+ this.dialog?.show();
104
+ return await new Promise((resolve) => {
105
+ this.#resolve = resolve;
106
+ });
107
+ }
108
+ #resolve;
109
+ static { this.styles = [
110
+ niceBadgeStyles,
111
+ css `
112
+ :host {
113
+ display: grid;
114
+ }
115
+
116
+ md-dialog {
117
+ max-width: 450px;
118
+ width: calc(100vw - 24px);
119
+
120
+ min-height: 400px;
121
+ }
122
+
123
+ md-tabs {
124
+ --md-primary-tab-container-color: var(--md-sys-color-surface-container-high);
125
+ --md-primary-tab-with-icon-and-label-text-container-height: 80px;
126
+ --md-primary-tab-icon-size: 32px;
127
+ padding: 0;
128
+ gap: 0;
129
+
130
+ md-primary-tab:first-of-type {
131
+ --md-primary-tab-container-shape-start-start: 32px;
132
+ --md-focus-ring-shape-start-start: 32px;
133
+ }
134
+
135
+ md-primary-tab:last-of-type {
136
+ --md-primary-tab-container-shape-start-end: 32px;
137
+ --md-focus-ring-shape-start-end: 32px;
138
+ }
139
+ }
140
+
141
+ md-primary-tab div[slot='icon'] {
142
+ position: relative;
143
+ nice-badge {
144
+ position: absolute;
145
+ top: 1px;
146
+ right: -10px;
147
+ }
148
+ }
149
+
150
+ main {
151
+ padding: 4px 16px 8px 16px;
152
+
153
+ p[no-sort] {
154
+ opacity: 0.8;
155
+ text-align: center;
156
+ }
157
+
158
+ add-container {
159
+ margin-top: 16px;
160
+ display: grid;
161
+ justify-self: center;
162
+ }
163
+ }
164
+
165
+ div[slot='actions'] {
166
+ display: flex;
167
+ justify-content: space-between;
168
+ gap: 8px;
169
+ }
170
+ `,
171
+ ]; }
172
+ render() {
173
+ const columnsNotInSort = this.tableMetaData?.itemMetaData.filter((item) => !item.disableSort && !this.sort.some((sort) => sort.key === item.key)) ?? [];
174
+ return html ` <md-dialog
175
+ @open=${(e) => {
176
+ dialogOpenNavigationHack(e.target);
177
+ dialogZIndexHack(e.target);
178
+ }}
179
+ @close=${(e) => {
180
+ if (e.target.returnValue === 'done' || e.target.returnValue === 'navigation-close') {
181
+ dialogCloseNavigationHack(e.target);
182
+ return this.#resolve(e.target.returnValue);
183
+ }
184
+ e.preventDefault();
185
+ }}
186
+ >
187
+ <md-tabs slot="headline" @change=${(e) => e.target.activeTab?.onActivate?.()}>
188
+ <md-primary-tab ?disabled=${this.isLoading} .onActivate=${() => (this.viewMode = 'Customize')}>
189
+ <div slot="icon">
190
+ ${this.customColumnsApplied ? html `<nice-badge compact primary>1</nice-badge>` : nothing}
191
+ <md-icon>tune</md-icon>
192
+ </div>
193
+ Customize columns
194
+ </md-primary-tab>
195
+ <md-primary-tab ?disabled=${this.isLoading} .onActivate=${() => (this.viewMode = 'Sort')}>
196
+ <div slot="icon">
197
+ ${this.customSortApplied ? html `<nice-badge compact primary>1</nice-badge>` : nothing}
198
+ <md-icon>edit_arrow_down</md-icon>
199
+ </div>
200
+ <div>Advanced Sort</div>
201
+ </md-primary-tab>
202
+ </md-tabs>
203
+ <main slot="content">
204
+ ${this.viewMode === 'Customize'
205
+ ? html ` <form
206
+ @item-drop=${(e) => {
207
+ e.stopPropagation();
208
+ const items = this.userSettings ?? [];
209
+ //HoverIndex cannot be dropped beyond the length of the array
210
+ const hoverIndex = Math.min(e.hoverIndex, items.length - 1);
211
+ //Ignore if item goes back to where it started
212
+ if (hoverIndex !== e.originIndex) {
213
+ const temp = items[e.originIndex];
214
+ items.splice(e.originIndex, 1);
215
+ items.splice(hoverIndex, 0, temp);
216
+ }
217
+ this.requestUpdate('userSettings');
218
+ this.dispatchEvent(new Event('setting-change'));
219
+ }}
220
+ >
221
+ ${repeat(this.userSettings, (setting) => setting.key, (setting, index) => html `
222
+ <data-table-core-settings-item
223
+ .index=${index}
224
+ .name=${this.tableMetaData?.itemMetaData.find((item) => item.key === setting.key)?.friendlyName ?? setting.key}
225
+ .selected=${setting.show}
226
+ ?disabled=${setting.show && this.userSettings.filter((s) => s.show).length === 1}
227
+ ?disable-drag=${this.userSettings.length === 1}
228
+ @changed=${(e) => {
229
+ setting.show = e.target.selected;
230
+ this.requestUpdate('userSettings');
231
+ this.dispatchEvent(new Event('setting-change'));
232
+ }}
233
+ ></data-table-core-settings-item>
234
+ `)}
235
+ </form>`
236
+ : html `<form
237
+ @item-drop=${(e) => {
238
+ e.stopPropagation();
239
+ const items = this.sort ?? [];
240
+ //HoverIndex cannot be dropped beyond the length of the array
241
+ const hoverIndex = Math.min(e.hoverIndex, items.length - 1);
242
+ //Ignore if item goes back to where it started
243
+ if (hoverIndex !== e.originIndex) {
244
+ const temp = items[e.originIndex];
245
+ items.splice(e.originIndex, 1);
246
+ items.splice(hoverIndex, 0, temp);
247
+ }
248
+ this.requestUpdate('sort');
249
+ this.dispatchEvent(new Event('sort-changed'));
250
+ }}
251
+ >
252
+ ${!this.sort.length
253
+ ? html `<p no-sort>No sort columns</p>`
254
+ : repeat(
255
+ //sort by sort order in this.sort
256
+ this.sort, (sort) => sort.key, (sort, index) => html `<data-table-core-settings-sort-item
257
+ .index=${index}
258
+ .name=${sort.key}
259
+ sort-direction=${sort.direction}
260
+ ?disabled=${this.isLoading}
261
+ ?disable-drag=${this.isLoading || this.sort.length === 1}
262
+ @sort-direction-changed=${(e) => {
263
+ this.sort[index].direction = e.target.sortDirection;
264
+ this.requestUpdate('sort');
265
+ this.dispatchEvent(new Event('sort-changed'));
266
+ }}
267
+ @delete=${() => {
268
+ this.sort.splice(index, 1);
269
+ this.requestUpdate('sort');
270
+ this.dispatchEvent(new Event('sort-changed'));
271
+ }}
272
+ ></data-table-core-settings-sort-item>`)}
273
+ </form>
274
+ ${columnsNotInSort.length !== 0
275
+ ? html ` <add-container>
276
+ <md-text-button
277
+ id="menu-anchor"
278
+ aria-haspopup="true"
279
+ aria-controls="menu"
280
+ aria-expanded="false"
281
+ trailing-icon
282
+ ?disabled=${this.isLoading}
283
+ @click=${(e) => {
284
+ e.preventDefault();
285
+ const root = e.target.getRootNode();
286
+ const menu = root.querySelector('#menu');
287
+ menu.open = !menu.open;
288
+ }}
289
+ >
290
+ <span>Add sort column</span>
291
+ <md-icon slot="icon">add</md-icon>
292
+ </md-text-button>
293
+
294
+ <md-menu
295
+ id="menu"
296
+ anchor="menu-anchor"
297
+ positioning="popover"
298
+ @close-menu=${(e) => {
299
+ e.detail.itemPath?.[0]?.action?.();
300
+ }}
301
+ >
302
+ ${repeat(columnsNotInSort, (column) => column.key, (column) => html `<md-menu-item
303
+ .action=${() => {
304
+ this.sort.push({ key: column.key, direction: 'asc' });
305
+ this.requestUpdate('sort');
306
+ this.dispatchEvent(new Event('sort-changed'));
307
+ }}
308
+ >
309
+ <md-icon slot="start">sort_by_alpha</md-icon>
310
+ ${column.friendlyName}
311
+ </md-menu-item>`)}
312
+ </md-menu>
313
+ </add-container>`
314
+ : nothing} `}
315
+ </main>
316
+ <div slot="actions">
317
+ <md-text-button
318
+ ?disabled=${this.isLoading || this.viewMode === 'Customize' ? !this.customColumnsApplied : !this.customSortApplied}
319
+ @click=${() => (this.viewMode === 'Customize' ? this.#resetUserSettings() : this.#resetSort())}
320
+ >Restore to defaults</md-text-button
321
+ >
322
+
323
+ <md-filled-tonal-button ?disabled=${this.isLoading} @click=${() => this.dialog?.close('done')}>Done</md-filled-tonal-button>
324
+ </div>
325
+ </md-dialog>`;
326
+ }
327
+ };
328
+ __decorate([
329
+ property({ type: Object })
330
+ ], TitaniumDataTableCoreSettingsDialog.prototype, "tableMetaData", null);
331
+ __decorate([
332
+ property({ type: Array })
333
+ ], TitaniumDataTableCoreSettingsDialog.prototype, "userSettings", null);
334
+ __decorate([
335
+ property({ type: Array })
336
+ ], TitaniumDataTableCoreSettingsDialog.prototype, "sort", null);
337
+ __decorate([
338
+ state()
339
+ ], TitaniumDataTableCoreSettingsDialog.prototype, "viewMode", null);
340
+ __decorate([
341
+ state()
342
+ ], TitaniumDataTableCoreSettingsDialog.prototype, "customSortApplied", null);
343
+ __decorate([
344
+ state()
345
+ ], TitaniumDataTableCoreSettingsDialog.prototype, "customColumnsApplied", null);
346
+ __decorate([
347
+ query('md-dialog')
348
+ ], TitaniumDataTableCoreSettingsDialog.prototype, "dialog", null);
349
+ TitaniumDataTableCoreSettingsDialog = __decorate([
350
+ customElement('titanium-data-table-core-settings-dialog')
351
+ ], TitaniumDataTableCoreSettingsDialog);
352
+ export { TitaniumDataTableCoreSettingsDialog };
353
+ //# sourceMappingURL=data-table-core-settings-dialog.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"data-table-core-settings-dialog.js","sourceRoot":"","sources":["data-table-core-settings-dialog.ts"],"names":[],"mappings":";AAAA,OAAO,6BAA6B,CAAC;AACrC,OAAO,kCAAkC,CAAC;AAC1C,OAAO,yBAAyB,CAAC;AACjC,OAAO,gCAAgC,CAAC;AACxC,OAAO,0CAA0C,CAAC;AAClD,OAAO,yBAAyB,CAAC;AACjC,OAAO,yBAAyB,CAAC;AACjC,OAAO,8BAA8B,CAAC;AAEtC,OAAO,iCAAiC,CAAC;AACzC,OAAO,sCAAsC,CAAC;AAE9C,OAAO,EAAE,UAAU,EAAkB,GAAG,EAAE,IAAI,EAAE,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gD;AAEnB;IAApC,KAAK,CAAC,WAAW,CAAC;iEAAmC;AAV3C,mCAAmC;IAD/C,aAAa,CAAC,0CAA0C,CAAC;GAC7C,mCAAmC,CAwU/C"}
@@ -0,0 +1,15 @@
1
+ import '@material/web/icon/icon';
2
+ import '@material/web/switch/switch';
3
+ import '@material/web/elevation/elevation';
4
+ import { DraggableItemBase } from './draggable-item-base';
5
+ export declare class TitaniumDataTableCoreSettingsItem extends DraggableItemBase {
6
+ accessor name: string;
7
+ accessor selected: boolean;
8
+ accessor disabled: boolean;
9
+ accessor index: number;
10
+ get items(): TitaniumDataTableCoreSettingsItem[];
11
+ get itemsContainer(): HTMLElement | null;
12
+ static styles: import("lit").CSSResultGroup[];
13
+ render(): import("lit-html").TemplateResult<1>;
14
+ }
15
+ //# sourceMappingURL=data-table-core-settings-item.d.ts.map
@@ -0,0 +1,102 @@
1
+ import { __decorate } from "tslib";
2
+ import '@material/web/icon/icon';
3
+ import '@material/web/switch/switch';
4
+ import '@material/web/elevation/elevation';
5
+ import { css, html } from 'lit';
6
+ import { customElement, property } from 'lit/decorators.js';
7
+ import { DraggableItemBase } from './draggable-item-base';
8
+ let TitaniumDataTableCoreSettingsItem = class TitaniumDataTableCoreSettingsItem extends DraggableItemBase {
9
+ #name_accessor_storage;
10
+ get name() { return this.#name_accessor_storage; }
11
+ set name(value) { this.#name_accessor_storage = value; }
12
+ #selected_accessor_storage;
13
+ get selected() { return this.#selected_accessor_storage; }
14
+ set selected(value) { this.#selected_accessor_storage = value; }
15
+ #disabled_accessor_storage;
16
+ get disabled() { return this.#disabled_accessor_storage; }
17
+ set disabled(value) { this.#disabled_accessor_storage = value; }
18
+ #index_accessor_storage;
19
+ get index() { return this.#index_accessor_storage; }
20
+ set index(value) { this.#index_accessor_storage = value; }
21
+ get items() {
22
+ return Array.from(this.parentElement?.querySelectorAll('data-table-core-settings-item') ?? []);
23
+ }
24
+ get itemsContainer() {
25
+ return this.parentElement;
26
+ }
27
+ static { this.styles = [
28
+ DraggableItemBase.styles,
29
+ css `
30
+ :host {
31
+ display: grid;
32
+ grid: 'icon label switch' / auto 1fr auto;
33
+ user-select: none;
34
+
35
+ font-size: 15px;
36
+ line-height: 17px;
37
+
38
+ align-items: center;
39
+ gap: 8px;
40
+ min-height: 48px;
41
+ border-bottom: 1px solid var(--md-sys-color-outline-variant);
42
+
43
+ position: relative;
44
+ box-sizing: border-box;
45
+ }
46
+
47
+ :host(:last-of-type) {
48
+ border-bottom: none;
49
+ }
50
+
51
+ md-switch {
52
+ --md-switch-track-height: 24px;
53
+ --md-switch-with-icon-handle-height: 20px;
54
+ --md-switch-with-icon-handle-width: 20px;
55
+ --md-switch-track-width: 40px;
56
+ }
57
+ `,
58
+ ]; }
59
+ render() {
60
+ return html `
61
+ <style>
62
+ :host([nudge-down]:not([dragged])) {
63
+ transform: translate3d(0, ${this.nudgeHeight}px, 0);
64
+ }
65
+
66
+ :host([nudge-up]:not([dragged])) {
67
+ transform: translate3d(0, -${this.nudgeHeight}px, 0);
68
+ }
69
+ </style>
70
+ <md-elevation></md-elevation>
71
+ <md-icon @mousedown=${this.mouseEvent} @touchstart=${this.touchEvent} drag>drag_indicator</md-icon>
72
+ <span>${this.name}</span>
73
+ <md-switch
74
+ ?selected=${this.selected}
75
+ @change=${() => {
76
+ this.selected = !this.selected;
77
+ this.dispatchEvent(new Event('changed'));
78
+ }}
79
+ icons
80
+ show-only-selected-icon
81
+ ?disabled=${this.disabled}
82
+ ></md-switch>
83
+ `;
84
+ }
85
+ };
86
+ __decorate([
87
+ property({ type: String })
88
+ ], TitaniumDataTableCoreSettingsItem.prototype, "name", null);
89
+ __decorate([
90
+ property({ type: Boolean })
91
+ ], TitaniumDataTableCoreSettingsItem.prototype, "selected", null);
92
+ __decorate([
93
+ property({ type: Boolean })
94
+ ], TitaniumDataTableCoreSettingsItem.prototype, "disabled", null);
95
+ __decorate([
96
+ property({ type: Number })
97
+ ], TitaniumDataTableCoreSettingsItem.prototype, "index", null);
98
+ TitaniumDataTableCoreSettingsItem = __decorate([
99
+ customElement('data-table-core-settings-item')
100
+ ], TitaniumDataTableCoreSettingsItem);
101
+ export { TitaniumDataTableCoreSettingsItem };
102
+ //# sourceMappingURL=data-table-core-settings-item.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"data-table-core-settings-item.js","sourceRoot":"","sources":["data-table-core-settings-item.ts"],"names":[],"mappings":";AAAA,OAAO,yBAAyB,CAAC;AACjC,OAAO,6BAA6B,CAAC;AACrC,OAAO,mCAAmC,CAAC;AAE3C,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AAChC,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAGnD,IAAM,iCAAiC,GAAvC,MAAM,iCAAkC,SAAQ,iBAAiB;IACjC,uBAAa;IAAb,IAAA,IAAI,0CAAS;IAAb,IAAA,IAAI,gDAAS;IACZ,2BAAkB;IAAlB,IAAA,QAAQ,8CAAU;IAAlB,IAAA,QAAQ,oDAAU;IAClB,2BAAkB;IAAlB,IAAA,QAAQ,8CAAU;IAAlB,IAAA,QAAQ,oDAAU;IACnB,wBAAc;IAAd,IAAA,KAAK,2CAAS;IAAd,IAAA,KAAK,iDAAS;IAEnD,IAAa,KAAK;QAChB,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,aAAa,EAAE,gBAAgB,CAAoC,+BAA+B,CAAC,IAAI,EAAE,CAAC,CAAC;IACpI,CAAC;IAED,IAAa,cAAc;QACzB,OAAO,IAAI,CAAC,aAAa,CAAC;IAC5B,CAAC;aAEM,WAAM,GAAG;QACd,iBAAiB,CAAC,MAAM;QACxB,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;KA4BF;KACF,AA/BY,CA+BX;IAEF,MAAM;QACJ,OAAO,IAAI,CAAA;;;sCAGuB,IAAI,CAAC,WAAW;;;;uCAIf,IAAI,CAAC,WAAW;;;;4BAI3B,IAAI,CAAC,UAAU,gBAAgB,IAAI,CAAC,UAAU;cAC5D,IAAI,CAAC,IAAI;;oBAEH,IAAI,CAAC,QAAQ;kBACf,GAAG,EAAE;YACb,IAAI,CAAC,QAAQ,GAAG,CAAC,IAAI,CAAC,QAAQ,CAAC;YAC/B,IAAI,CAAC,aAAa,CAAC,IAAI,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC;QAC3C,CAAC;;;oBAGW,IAAI,CAAC,QAAQ;;KAE5B,CAAC;IACJ,CAAC;;AAvEoC;IAApC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;6DAAuB;AACZ;IAArC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;iEAA4B;AAClB;IAArC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;iEAA4B;AACnB;IAApC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;8DAAwB;AAJxC,iCAAiC;IAD7C,aAAa,CAAC,+BAA+B,CAAC;GAClC,iCAAiC,CAyE7C"}
@@ -0,0 +1,17 @@
1
+ import '@material/web/icon/icon';
2
+ import '@material/web/switch/switch';
3
+ import '@material/web/elevation/elevation';
4
+ import '@material/web/select/filled-select';
5
+ import '@material/web/select/select-option';
6
+ import { DraggableItemBase } from './draggable-item-base';
7
+ export declare class TitaniumDataTableCoreSettingsSortItem extends DraggableItemBase {
8
+ accessor name: string;
9
+ accessor sortDirection: 'asc' | 'desc';
10
+ accessor index: number;
11
+ accessor disabled: boolean;
12
+ get items(): TitaniumDataTableCoreSettingsSortItem[];
13
+ get itemsContainer(): HTMLElement | null;
14
+ static styles: import("lit").CSSResultGroup[];
15
+ render(): import("lit-html").TemplateResult<1>;
16
+ }
17
+ //# sourceMappingURL=data-table-core-settings-sort-item.d.ts.map
@@ -0,0 +1,164 @@
1
+ import { __decorate } from "tslib";
2
+ import '@material/web/icon/icon';
3
+ import '@material/web/switch/switch';
4
+ import '@material/web/elevation/elevation';
5
+ import '@material/web/select/filled-select';
6
+ import '@material/web/select/select-option';
7
+ import { css, html } from 'lit';
8
+ import { customElement, property } from 'lit/decorators.js';
9
+ import { h5 } from '../styles/h5';
10
+ import { p } from '../styles/p';
11
+ import { ellipsis } from '../styles/ellipsis';
12
+ import { DraggableItemBase } from './draggable-item-base';
13
+ let TitaniumDataTableCoreSettingsSortItem = class TitaniumDataTableCoreSettingsSortItem extends DraggableItemBase {
14
+ #name_accessor_storage;
15
+ get name() { return this.#name_accessor_storage; }
16
+ set name(value) { this.#name_accessor_storage = value; }
17
+ #sortDirection_accessor_storage;
18
+ get sortDirection() { return this.#sortDirection_accessor_storage; }
19
+ set sortDirection(value) { this.#sortDirection_accessor_storage = value; }
20
+ #index_accessor_storage;
21
+ get index() { return this.#index_accessor_storage; }
22
+ set index(value) { this.#index_accessor_storage = value; }
23
+ #disabled_accessor_storage;
24
+ get disabled() { return this.#disabled_accessor_storage; }
25
+ set disabled(value) { this.#disabled_accessor_storage = value; }
26
+ get items() {
27
+ return Array.from(this.parentElement?.querySelectorAll('data-table-core-settings-sort-item') ?? []);
28
+ }
29
+ get itemsContainer() {
30
+ return this.parentElement;
31
+ }
32
+ static { this.styles = [
33
+ DraggableItemBase.styles,
34
+ h5,
35
+ p,
36
+ ellipsis,
37
+ css `
38
+ :host {
39
+ display: grid;
40
+ grid: 'icon header gap select delete' / auto auto 1fr auto auto;
41
+ user-select: none;
42
+
43
+ font-size: 15px;
44
+ line-height: 17px;
45
+
46
+ align-items: center;
47
+ gap: 8px;
48
+ min-height: 48px;
49
+ border-bottom: 1px solid var(--md-sys-color-outline-variant);
50
+
51
+ position: relative;
52
+ box-sizing: border-box;
53
+
54
+ padding: 12px 0;
55
+
56
+ label[disabled] span {
57
+ opacity: 0.3;
58
+ }
59
+ }
60
+
61
+ :host(:last-of-type) {
62
+ border-bottom: none;
63
+ }
64
+
65
+ md-icon[drag] {
66
+ grid-area: icon;
67
+ }
68
+
69
+ header {
70
+ grid-area: header;
71
+
72
+ h5[annotation] {
73
+ opacity: 0.6;
74
+
75
+ height: 16px;
76
+ transition:
77
+ opacity 0.2s ease-out,
78
+ height 0.2s ease-out;
79
+ transition-behavior: allow-discrete;
80
+ }
81
+ }
82
+
83
+ md-icon-button[remove] {
84
+ grid-area: delete;
85
+
86
+ --md-icon-button-icon-color: var(--md-sys-color-error);
87
+ --md-icon-button-pressed-icon-color: var(--md-sys-color-error);
88
+ --md-icon-button-focus-icon-color: var(--md-sys-color-error);
89
+ --md-icon-button-hover-icon-color: var(--md-sys-color-error);
90
+ }
91
+
92
+ md-filled-select {
93
+ grid-area: select;
94
+ --md-filled-field-top-space: 4px;
95
+ --md-filled-field-bottom-space: 4px;
96
+ --md-filled-field-content-size: 14px;
97
+ --md-filled-field-label-text-populated-size: 11px;
98
+
99
+ --md-filled-select-text-field-container-shape: 8px;
100
+ --md-filled-select-text-field-active-indicator-height: 0;
101
+ --md-filled-select-text-field-error-active-indicator-height: 0;
102
+ --md-filled-select-text-field-hover-active-indicator-height: 0;
103
+ --md-filled-select-text-field-focus-active-indicator-height: 0;
104
+ --md-filled-select-text-field-disabled-active-indicator-height: 0;
105
+
106
+ min-width: 105px;
107
+ }
108
+
109
+ :host([dragging]) h5[annotation],
110
+ :host([dragged]) h5[annotation] {
111
+ opacity: 0;
112
+ height: 0;
113
+ }
114
+ `,
115
+ ]; }
116
+ render() {
117
+ return html `
118
+ <style>
119
+ :host([nudge-down]:not([dragged])) {
120
+ transform: translate3d(0, ${this.nudgeHeight}px, 0);
121
+ }
122
+
123
+ :host([nudge-up]:not([dragged])) {
124
+ transform: translate3d(0, -${this.nudgeHeight}px, 0);
125
+ }
126
+ </style>
127
+ <md-elevation></md-elevation>
128
+ <md-icon @mousedown=${this.mouseEvent} @touchstart=${this.touchEvent} drag>drag_indicator</md-icon>
129
+ <header ellipsis>
130
+ <h5 ellipsis annotation>${this.index === 0 ? html `sort by` : html `then by`}</h5>
131
+ <p ellipsis>${this.name}</p>
132
+ </header>
133
+ <md-filled-select
134
+ ?disabled=${this.disabled}
135
+ .value=${this.sortDirection}
136
+ @change=${(e) => {
137
+ this.sortDirection = e.target.value;
138
+ this.dispatchEvent(new Event('sort-direction-changed'));
139
+ }}
140
+ >
141
+ <md-select-option value="asc"><span>A to Z</span></md-select-option>
142
+ <md-select-option value="desc"><span>Z to A</span> </md-select-option>
143
+ </md-filled-select>
144
+ <md-icon-button ?disabled=${this.disabled} remove @click=${() => this.dispatchEvent(new Event('delete'))}><md-icon>close_small</md-icon></md-icon-button>
145
+ `;
146
+ }
147
+ };
148
+ __decorate([
149
+ property({ type: String })
150
+ ], TitaniumDataTableCoreSettingsSortItem.prototype, "name", null);
151
+ __decorate([
152
+ property({ type: String, reflect: true, attribute: 'sort-direction' })
153
+ ], TitaniumDataTableCoreSettingsSortItem.prototype, "sortDirection", null);
154
+ __decorate([
155
+ property({ type: Number })
156
+ ], TitaniumDataTableCoreSettingsSortItem.prototype, "index", null);
157
+ __decorate([
158
+ property({ type: Boolean, reflect: true })
159
+ ], TitaniumDataTableCoreSettingsSortItem.prototype, "disabled", null);
160
+ TitaniumDataTableCoreSettingsSortItem = __decorate([
161
+ customElement('data-table-core-settings-sort-item')
162
+ ], TitaniumDataTableCoreSettingsSortItem);
163
+ export { TitaniumDataTableCoreSettingsSortItem };
164
+ //# sourceMappingURL=data-table-core-settings-sort-item.js.map