@leavittsoftware/web 5.16.0 → 5.17.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,352 @@
1
+ import { __decorate } from "tslib";
2
+ import '@material/web/dialog/dialog';
3
+ import '@material/web/button/text-button';
4
+ import '@material/web/tabs/primary-tab';
5
+ import '@material/web/button/filled-tonal-button';
6
+ import '@material/web/icon/icon';
7
+ import '@material/web/menu/menu';
8
+ import '@material/web/menu/menu-item';
9
+ import './data-table-core-settings-item';
10
+ import './data-table-core-settings-sort-item';
11
+ import { LitElement, css, html, nothing } from 'lit';
12
+ import { customElement, property, query, state } from 'lit/decorators.js';
13
+ import { generateDefaultSortFromMetaData } from './data-table-core';
14
+ import { dialogCloseNavigationHack, dialogOpenNavigationHack } from '../hacks/dialog-navigation-hack';
15
+ import { dialogZIndexHack } from '../hacks/dialog-zindex-hack';
16
+ import { repeat } from 'lit/directives/repeat.js';
17
+ import { niceBadgeStyles } from '../styles/nice-badge';
18
+ import { LoadWhile } from '../helpers/load-while';
19
+ let TitaniumDataTableCoreSettingsDialog = class TitaniumDataTableCoreSettingsDialog extends LoadWhile(LitElement) {
20
+ #tableMetaData_accessor_storage = null;
21
+ get tableMetaData() { return this.#tableMetaData_accessor_storage; }
22
+ set tableMetaData(value) { this.#tableMetaData_accessor_storage = value; }
23
+ #userSettings_accessor_storage = [];
24
+ get userSettings() { return this.#userSettings_accessor_storage; }
25
+ set userSettings(value) { this.#userSettings_accessor_storage = value; }
26
+ #sort_accessor_storage = [];
27
+ get sort() { return this.#sort_accessor_storage; }
28
+ set sort(value) { this.#sort_accessor_storage = value; }
29
+ #viewMode_accessor_storage = 'Customize';
30
+ get viewMode() { return this.#viewMode_accessor_storage; }
31
+ set viewMode(value) { this.#viewMode_accessor_storage = value; }
32
+ #customSortApplied_accessor_storage = false;
33
+ get customSortApplied() { return this.#customSortApplied_accessor_storage; }
34
+ set customSortApplied(value) { this.#customSortApplied_accessor_storage = value; }
35
+ #customColumnsApplied_accessor_storage = false;
36
+ get customColumnsApplied() { return this.#customColumnsApplied_accessor_storage; }
37
+ set customColumnsApplied(value) { this.#customColumnsApplied_accessor_storage = value; }
38
+ #dialog_accessor_storage;
39
+ get dialog() { return this.#dialog_accessor_storage; }
40
+ set dialog(value) { this.#dialog_accessor_storage = value; }
41
+ updated(changedProperties) {
42
+ if (changedProperties.has('tableMetaData')) {
43
+ //make sure all keys in tableMetaData.itemMetaData are in userSettings
44
+ if (this.tableMetaData?.itemMetaData.some((item) => !this.userSettings.some((setting) => setting.key === item.key))) {
45
+ this.#resetUserSettings();
46
+ }
47
+ //check if columns have been removed
48
+ if (this.tableMetaData?.itemMetaData.length !== this.userSettings.length) {
49
+ this.#resetUserSettings();
50
+ }
51
+ }
52
+ if (changedProperties.has('sort') || changedProperties.has('tableMetaData')) {
53
+ const defaultSort = generateDefaultSortFromMetaData(this.tableMetaData);
54
+ const _customSortApplied = JSON.stringify(defaultSort) !== JSON.stringify(this.sort);
55
+ if (this.customSortApplied !== _customSortApplied) {
56
+ this.customSortApplied = _customSortApplied;
57
+ this.dispatchEvent(new Event('custom-sort-applied-change'));
58
+ }
59
+ }
60
+ if (changedProperties.has('userSettings') || changedProperties.has('tableMetaData')) {
61
+ const _customColumnsApplied = this.#getNumberOfCustomSettingsApplied(this.userSettings, this.tableMetaData) > 0;
62
+ if (this.customColumnsApplied !== _customColumnsApplied) {
63
+ this.customColumnsApplied = _customColumnsApplied;
64
+ this.dispatchEvent(new Event('custom-columns-applied-change'));
65
+ }
66
+ }
67
+ }
68
+ #getNumberOfCustomSettingsApplied(userSettings, tableMetaData) {
69
+ let settingsCount = 0;
70
+ for (const metaData of tableMetaData?.itemMetaData ?? []) {
71
+ const setting = userSettings.find((setting) => setting.key === metaData.key);
72
+ if (setting?.show && metaData.hideByDefault) {
73
+ settingsCount++;
74
+ }
75
+ if (!setting?.show && !metaData.hideByDefault) {
76
+ settingsCount++;
77
+ }
78
+ }
79
+ //check if items are re-ordered by index, if so count as one change
80
+ if (userSettings.some((setting, index) => setting.key !== tableMetaData?.itemMetaData[index].key) ||
81
+ tableMetaData?.itemMetaData.some((metaData, index) => metaData.key !== userSettings[index].key)) {
82
+ settingsCount++;
83
+ }
84
+ return settingsCount;
85
+ }
86
+ #resetUserSettings() {
87
+ const _userSettings = this.tableMetaData?.itemMetaData.map((item) => ({ key: item.key, show: !item.hideByDefault })) ?? [];
88
+ if (JSON.stringify(_userSettings) !== JSON.stringify(this.userSettings)) {
89
+ this.userSettings = _userSettings;
90
+ this.dispatchEvent(new Event('setting-change'));
91
+ }
92
+ }
93
+ #resetSort() {
94
+ const _sort = generateDefaultSortFromMetaData(this.tableMetaData);
95
+ if (JSON.stringify(_sort) !== JSON.stringify(this.sort)) {
96
+ this.sort = _sort;
97
+ this.dispatchEvent(new Event('sort-changed'));
98
+ }
99
+ }
100
+ async show() {
101
+ this.dialog.returnValue = '';
102
+ this.dialog?.show();
103
+ return await new Promise((resolve) => {
104
+ this.#resolve = resolve;
105
+ });
106
+ }
107
+ #resolve;
108
+ static { this.styles = [
109
+ niceBadgeStyles,
110
+ css `
111
+ :host {
112
+ display: grid;
113
+ }
114
+
115
+ md-dialog {
116
+ max-width: 450px;
117
+ width: calc(100vw - 24px);
118
+
119
+ min-height: 400px;
120
+ }
121
+
122
+ md-tabs {
123
+ --md-primary-tab-container-color: var(--md-sys-color-surface-container-high);
124
+ --md-primary-tab-with-icon-and-label-text-container-height: 80px;
125
+ --md-primary-tab-icon-size: 32px;
126
+ padding: 0;
127
+ gap: 0;
128
+
129
+ md-primary-tab:first-of-type {
130
+ --md-primary-tab-container-shape-start-start: 32px;
131
+ --md-focus-ring-shape-start-start: 32px;
132
+ }
133
+
134
+ md-primary-tab:last-of-type {
135
+ --md-primary-tab-container-shape-start-end: 32px;
136
+ --md-focus-ring-shape-start-end: 32px;
137
+ }
138
+ }
139
+
140
+ md-primary-tab div[slot='icon'] {
141
+ position: relative;
142
+ nice-badge {
143
+ position: absolute;
144
+ top: 1px;
145
+ right: -10px;
146
+ }
147
+ }
148
+
149
+ main {
150
+ padding: 4px 16px 8px 16px;
151
+
152
+ p[no-sort] {
153
+ opacity: 0.8;
154
+ text-align: center;
155
+ }
156
+
157
+ add-container {
158
+ margin-top: 16px;
159
+ display: grid;
160
+ justify-self: center;
161
+ }
162
+ }
163
+
164
+ div[slot='actions'] {
165
+ display: flex;
166
+ justify-content: space-between;
167
+ gap: 8px;
168
+ }
169
+ `,
170
+ ]; }
171
+ render() {
172
+ const columnsNotInSort = this.tableMetaData?.itemMetaData.filter((item) => !item.disableSort && !this.sort.some((sort) => sort.key === item.key)) ?? [];
173
+ return html ` <md-dialog
174
+ @open=${(e) => {
175
+ dialogOpenNavigationHack(e.target);
176
+ dialogZIndexHack(e.target);
177
+ }}
178
+ @close=${(e) => {
179
+ if (e.target.returnValue === 'done' || e.target.returnValue === 'navigation-close') {
180
+ dialogCloseNavigationHack(e.target);
181
+ return this.#resolve(e.target.returnValue);
182
+ }
183
+ e.preventDefault();
184
+ }}
185
+ >
186
+ <md-tabs slot="headline" @change=${(e) => e.target.activeTab?.onActivate?.()}>
187
+ <md-primary-tab ?disabled=${this.isLoading} .onActivate=${() => (this.viewMode = 'Customize')}>
188
+ <div slot="icon">
189
+ ${this.customColumnsApplied ? html `<nice-badge compact primary>1</nice-badge>` : nothing}
190
+ <md-icon>tune</md-icon>
191
+ </div>
192
+ Customize columns
193
+ </md-primary-tab>
194
+ <md-primary-tab ?disabled=${this.isLoading} .onActivate=${() => (this.viewMode = 'Sort')}>
195
+ <div slot="icon">
196
+ ${this.customSortApplied ? html `<nice-badge compact primary>1</nice-badge>` : nothing}
197
+ <md-icon>edit_arrow_down</md-icon>
198
+ </div>
199
+ <div>Advanced Sort</div>
200
+ </md-primary-tab>
201
+ </md-tabs>
202
+ <main slot="content">
203
+ ${this.viewMode === 'Customize'
204
+ ? html ` <form
205
+ @item-drop=${(e) => {
206
+ e.stopPropagation();
207
+ const items = this.userSettings ?? [];
208
+ //HoverIndex cannot be dropped beyond the length of the array
209
+ const hoverIndex = Math.min(e.hoverIndex, items.length - 1);
210
+ //Ignore if item goes back to where it started
211
+ if (hoverIndex !== e.originIndex) {
212
+ const temp = items[e.originIndex];
213
+ items.splice(e.originIndex, 1);
214
+ items.splice(hoverIndex, 0, temp);
215
+ }
216
+ this.requestUpdate('userSettings');
217
+ this.dispatchEvent(new Event('setting-change'));
218
+ }}
219
+ >
220
+ ${repeat(this.userSettings, (setting) => setting.key, (setting, index) => html `
221
+ <data-table-core-settings-item
222
+ .index=${index}
223
+ .name=${this.tableMetaData?.itemMetaData.find((item) => item.key === setting.key)?.friendlyName ?? setting.key}
224
+ .selected=${setting.show}
225
+ ?disabled=${setting.show && this.userSettings.filter((s) => s.show).length === 1}
226
+ ?disable-drag=${this.userSettings.length === 1}
227
+ @changed=${(e) => {
228
+ setting.show = e.target.selected;
229
+ this.requestUpdate('userSettings');
230
+ this.dispatchEvent(new Event('setting-change'));
231
+ }}
232
+ ></data-table-core-settings-item>
233
+ `)}
234
+ </form>`
235
+ : html `<form
236
+ @item-drop=${(e) => {
237
+ e.stopPropagation();
238
+ const items = this.sort ?? [];
239
+ //HoverIndex cannot be dropped beyond the length of the array
240
+ const hoverIndex = Math.min(e.hoverIndex, items.length - 1);
241
+ //Ignore if item goes back to where it started
242
+ if (hoverIndex !== e.originIndex) {
243
+ const temp = items[e.originIndex];
244
+ items.splice(e.originIndex, 1);
245
+ items.splice(hoverIndex, 0, temp);
246
+ }
247
+ this.requestUpdate('sort');
248
+ this.dispatchEvent(new Event('sort-changed'));
249
+ }}
250
+ >
251
+ ${!this.sort.length
252
+ ? html `<p no-sort>No sort columns</p>`
253
+ : repeat(
254
+ //sort by sort order in this.sort
255
+ this.sort, (sort) => sort.key, (sort, index) => html `<data-table-core-settings-sort-item
256
+ .index=${index}
257
+ .name=${sort.key}
258
+ sort-direction=${sort.direction}
259
+ ?disabled=${this.isLoading}
260
+ ?disable-drag=${this.isLoading || this.sort.length === 1}
261
+ @sort-direction-changed=${(e) => {
262
+ this.sort[index].direction = e.target.sortDirection;
263
+ this.requestUpdate('sort');
264
+ this.dispatchEvent(new Event('sort-changed'));
265
+ }}
266
+ @delete=${() => {
267
+ this.sort.splice(index, 1);
268
+ this.requestUpdate('sort');
269
+ this.dispatchEvent(new Event('sort-changed'));
270
+ }}
271
+ ></data-table-core-settings-sort-item>`)}
272
+ </form>
273
+ ${columnsNotInSort.length !== 0
274
+ ? html ` <add-container>
275
+ <md-text-button
276
+ id="menu-anchor"
277
+ aria-haspopup="true"
278
+ aria-controls="menu"
279
+ aria-expanded="false"
280
+ trailing-icon
281
+ ?disabled=${this.isLoading}
282
+ @click=${(e) => {
283
+ e.preventDefault();
284
+ const root = e.target.getRootNode();
285
+ const menu = root.querySelector('#menu');
286
+ menu.open = !menu.open;
287
+ }}
288
+ >
289
+ <span>Add sort column</span>
290
+ <md-icon slot="icon">add</md-icon>
291
+ </md-text-button>
292
+
293
+ <md-menu
294
+ id="menu"
295
+ anchor="menu-anchor"
296
+ positioning="popover"
297
+ @close-menu=${(e) => {
298
+ e.detail.itemPath?.[0]?.action?.();
299
+ }}
300
+ >
301
+ ${repeat(columnsNotInSort, (column) => column.key, (column) => html `<md-menu-item
302
+ .action=${() => {
303
+ this.sort.push({ key: column.key, direction: 'asc' });
304
+ this.requestUpdate('sort');
305
+ this.dispatchEvent(new Event('sort-changed'));
306
+ }}
307
+ >
308
+ <md-icon slot="start">sort_by_alpha</md-icon>
309
+ ${column.friendlyName}
310
+ </md-menu-item>`)}
311
+ </md-menu>
312
+ </add-container>`
313
+ : nothing} `}
314
+ </main>
315
+ <div slot="actions">
316
+ <md-text-button
317
+ ?disabled=${this.isLoading || this.viewMode === 'Customize' ? !this.customColumnsApplied : !this.customSortApplied}
318
+ @click=${() => (this.viewMode === 'Customize' ? this.#resetUserSettings() : this.#resetSort())}
319
+ >Restore to defaults</md-text-button
320
+ >
321
+
322
+ <md-filled-tonal-button ?disabled=${this.isLoading} @click=${() => this.dialog?.close('done')}>Done</md-filled-tonal-button>
323
+ </div>
324
+ </md-dialog>`;
325
+ }
326
+ };
327
+ __decorate([
328
+ property({ type: Object })
329
+ ], TitaniumDataTableCoreSettingsDialog.prototype, "tableMetaData", null);
330
+ __decorate([
331
+ property({ type: Array })
332
+ ], TitaniumDataTableCoreSettingsDialog.prototype, "userSettings", null);
333
+ __decorate([
334
+ property({ type: Array })
335
+ ], TitaniumDataTableCoreSettingsDialog.prototype, "sort", null);
336
+ __decorate([
337
+ state()
338
+ ], TitaniumDataTableCoreSettingsDialog.prototype, "viewMode", null);
339
+ __decorate([
340
+ state()
341
+ ], TitaniumDataTableCoreSettingsDialog.prototype, "customSortApplied", null);
342
+ __decorate([
343
+ state()
344
+ ], TitaniumDataTableCoreSettingsDialog.prototype, "customColumnsApplied", null);
345
+ __decorate([
346
+ query('md-dialog')
347
+ ], TitaniumDataTableCoreSettingsDialog.prototype, "dialog", null);
348
+ TitaniumDataTableCoreSettingsDialog = __decorate([
349
+ customElement('titanium-data-table-core-settings-dialog')
350
+ ], TitaniumDataTableCoreSettingsDialog);
351
+ export { TitaniumDataTableCoreSettingsDialog };
352
+ //# 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,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,OAAO,EAAE,MAAM,KAAK,CAAC;AACrE,OAAO,EAAE,aA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AV3C,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