@3t-transform/threeteeui 0.0.16 → 0.0.18
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/dist/cjs/{index-864b7110.js → index-bf777121.js} +3 -0
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/cjs/tttx-button.cjs.entry.js +25 -19
- package/dist/cjs/tttx-checkbox.cjs.entry.js +18 -18
- package/dist/cjs/tttx-form.cjs.entry.js +365 -365
- package/dist/cjs/tttx-icon.cjs.entry.js +14 -1856
- package/dist/cjs/tttx-input-calendar.cjs.entry.js +125 -0
- package/dist/cjs/tttx-keyvalue-block.cjs.entry.js +33 -0
- package/dist/cjs/tttx-list.cjs.entry.js +188 -188
- package/dist/cjs/tttx-loading-spinner.cjs.entry.js +16 -16
- package/dist/cjs/tttx-popover-content.cjs.entry.js +13 -13
- package/dist/cjs/tttx-standalone-input.cjs.entry.js +127 -127
- package/dist/cjs/tttx-table.cjs.entry.js +50 -50
- package/dist/cjs/tttx.cjs.js +2 -2
- package/dist/collection/collection-manifest.json +2 -0
- package/dist/collection/components/atoms/tttx-button/tttx-button.css +94 -18
- package/dist/collection/components/atoms/tttx-button/tttx-button.js +110 -93
- package/dist/collection/components/atoms/tttx-button/tttx-button.stories.js +74 -27
- package/dist/collection/components/atoms/tttx-icon/tttx-icon.css +8 -5
- package/dist/collection/components/atoms/tttx-icon/tttx-icon.js +62 -116
- package/dist/collection/components/atoms/tttx-icon/tttx-icon.stories.js +22 -47
- package/dist/collection/components/atoms/tttx-keyvalue-block/tttx-keyvalue-block.css +26 -0
- package/dist/collection/components/atoms/tttx-keyvalue-block/tttx-keyvalue-block.js +56 -0
- package/dist/collection/components/atoms/tttx-keyvalue-block/tttx-keyvalue-block.stories.js +12 -0
- package/dist/collection/components/atoms/tttx-loading-spinner/tttx-loading-spinner.js +67 -66
- package/dist/collection/components/atoms/tttx-loading-spinner/tttx-loading-spinner.stories.js +17 -17
- package/dist/collection/components/atoms/tttx-popover-content/tttx-popover-content.js +97 -96
- package/dist/collection/components/atoms/tttx-popover-content/tttx-popover-content.stories.js +23 -23
- package/dist/collection/components/atoms/ttx-checkbox/tttx-checkbox.js +102 -101
- package/dist/collection/components/atoms/ttx-checkbox/tttx-checkbox.stories.js +9 -9
- package/dist/collection/components/molecules/tttx-form/tttx-form.css +95 -11
- package/dist/collection/components/molecules/tttx-form/tttx-form.js +452 -451
- package/dist/collection/components/molecules/tttx-form/tttx-form.stories.js +109 -109
- package/dist/collection/components/molecules/tttx-input-calendar/tttx-input-calendar.css +93 -0
- package/dist/collection/components/molecules/tttx-input-calendar/tttx-input-calendar.js +174 -0
- package/dist/collection/components/molecules/tttx-input-calendar/tttx-input-calendar.stories.js +27 -0
- package/dist/collection/components/molecules/tttx-list/tttx-list.js +312 -311
- package/dist/collection/components/molecules/tttx-list/tttx-list.stories.js +14 -14
- package/dist/collection/components/molecules/tttx-standalone-input/tttx-standalone-input.js +570 -569
- package/dist/collection/components/molecules/tttx-standalone-input/tttx-standalone-input.stories.js +134 -134
- package/dist/collection/components/molecules/tttx-table/tttx-table.js +174 -177
- package/dist/collection/components/molecules/tttx-table/tttx-table.stories.js +65 -65
- package/dist/collection/components/palette.stories.js +7 -7
- package/dist/collection/docs/gettingstarted-developer.stories.js +5 -5
- package/dist/collection/icons.js +2838 -2838
- package/dist/collection/index.js +1 -1
- package/dist/components/index.d.ts +2 -0
- package/dist/components/index.js +2 -0
- package/dist/components/tttx-button.js +1 -40
- package/dist/components/tttx-button2.js +56 -0
- package/dist/components/tttx-checkbox.js +36 -36
- package/dist/components/tttx-form.js +382 -382
- package/dist/components/tttx-icon2.js +32 -1874
- package/dist/components/tttx-input-calendar.d.ts +11 -0
- package/dist/components/tttx-input-calendar.js +157 -0
- package/dist/components/tttx-keyvalue-block.d.ts +11 -0
- package/dist/components/tttx-keyvalue-block.js +49 -0
- package/dist/components/tttx-list.js +214 -214
- package/dist/components/tttx-loading-spinner2.js +33 -33
- package/dist/components/tttx-popover-content2.js +32 -32
- package/dist/components/tttx-standalone-input.js +168 -169
- package/dist/components/tttx-table.js +79 -79
- package/dist/esm/{index-232e347b.js → index-a05bd606.js} +3 -0
- package/dist/esm/loader.js +3 -3
- package/dist/esm/polyfills/core-js.js +0 -0
- package/dist/esm/polyfills/dom.js +0 -0
- package/dist/esm/polyfills/es5-html-element.js +0 -0
- package/dist/esm/polyfills/index.js +0 -0
- package/dist/esm/polyfills/system.js +0 -0
- package/dist/esm/tttx-button.entry.js +25 -19
- package/dist/esm/tttx-checkbox.entry.js +18 -18
- package/dist/esm/tttx-form.entry.js +365 -365
- package/dist/esm/tttx-icon.entry.js +14 -1856
- package/dist/esm/tttx-input-calendar.entry.js +121 -0
- package/dist/esm/tttx-keyvalue-block.entry.js +29 -0
- package/dist/esm/tttx-list.entry.js +188 -188
- package/dist/esm/tttx-loading-spinner.entry.js +16 -16
- package/dist/esm/tttx-popover-content.entry.js +13 -13
- package/dist/esm/tttx-standalone-input.entry.js +127 -127
- package/dist/esm/tttx-table.entry.js +50 -50
- package/dist/esm/tttx.js +3 -3
- package/dist/tttx/{p-3973b7dd.entry.js → p-037d286f.entry.js} +1 -1
- package/dist/tttx/{p-184c4fae.js → p-07b134af.js} +1 -1
- package/dist/tttx/{p-125f06b3.entry.js → p-1b63f16a.entry.js} +1 -1
- package/dist/tttx/p-45afb84c.entry.js +1 -0
- package/dist/tttx/p-68ff0f39.entry.js +1 -0
- package/dist/tttx/{p-6828fe6f.entry.js → p-93763d3c.entry.js} +1 -1
- package/dist/tttx/p-a5808741.entry.js +1 -0
- package/dist/tttx/{p-fe4c70b2.entry.js → p-a92ca87e.entry.js} +1 -1
- package/dist/tttx/{p-5ce1ba22.entry.js → p-a96ca037.entry.js} +1 -1
- package/dist/tttx/p-dc087fd8.entry.js +1 -0
- package/dist/tttx/p-e3cc75bb.entry.js +1 -0
- package/dist/tttx/{p-01e1894e.entry.js → p-f579ed1e.entry.js} +1 -1
- package/dist/tttx/tttx.esm.js +1 -1
- package/dist/types/components/atoms/tttx-button/tttx-button.d.ts +10 -9
- package/dist/types/components/atoms/tttx-button/tttx-button.stories.d.ts +10 -20
- package/dist/types/components/atoms/tttx-icon/tttx-icon.d.ts +5 -14
- package/dist/types/components/atoms/tttx-icon/tttx-icon.stories.d.ts +20 -21
- package/dist/types/components/atoms/tttx-keyvalue-block/tttx-keyvalue-block.d.ts +4 -0
- package/dist/types/components/atoms/tttx-keyvalue-block/tttx-keyvalue-block.stories.d.ts +6 -0
- package/dist/types/components/atoms/tttx-loading-spinner/tttx-loading-spinner.d.ts +6 -6
- package/dist/types/components/atoms/tttx-loading-spinner/tttx-loading-spinner.stories.d.ts +17 -17
- package/dist/types/components/atoms/tttx-popover-content/tttx-popover-content.d.ts +7 -7
- package/dist/types/components/atoms/tttx-popover-content/tttx-popover-content.stories.d.ts +18 -18
- package/dist/types/components/atoms/ttx-checkbox/tttx-checkbox.d.ts +9 -9
- package/dist/types/components/atoms/ttx-checkbox/tttx-checkbox.stories.d.ts +6 -6
- package/dist/types/components/molecules/tttx-form/tttx-form.d.ts +134 -134
- package/dist/types/components/molecules/tttx-form/tttx-form.stories.d.ts +12 -12
- package/dist/types/components/molecules/tttx-input-calendar/tttx-input-calendar.d.ts +19 -0
- package/dist/types/components/molecules/tttx-input-calendar/tttx-input-calendar.stories.d.ts +26 -0
- package/dist/types/components/molecules/tttx-list/tttx-list.d.ts +51 -51
- package/dist/types/components/molecules/tttx-list/tttx-list.stories.d.ts +13 -13
- package/dist/types/components/molecules/tttx-standalone-input/tttx-standalone-input.d.ts +38 -38
- package/dist/types/components/molecules/tttx-standalone-input/tttx-standalone-input.stories.d.ts +106 -106
- package/dist/types/components/molecules/tttx-table/tttx-table.d.ts +15 -15
- package/dist/types/components/molecules/tttx-table/tttx-table.stories.d.ts +21 -21
- package/dist/types/components/palette.stories.d.ts +6 -6
- package/dist/types/components.d.ts +46 -15
- package/dist/types/docs/gettingstarted-developer.stories.d.ts +5 -5
- package/dist/types/icons.d.ts +2 -2
- package/dist/types/index.d.ts +1 -1
- package/package.json +4 -4
- package/dist/tttx/p-10316ff1.entry.js +0 -1
- package/dist/tttx/p-b1c22f5f.entry.js +0 -1
- package/dist/tttx/p-c7f9be65.entry.js +0 -1
|
@@ -1,311 +1,312 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
this.
|
|
6
|
-
this.
|
|
7
|
-
this.
|
|
8
|
-
this.
|
|
9
|
-
this.
|
|
10
|
-
this.
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
this.
|
|
17
|
-
this.
|
|
18
|
-
this.
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
if
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
this.
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
this.
|
|
34
|
-
this.
|
|
35
|
-
|
|
36
|
-
.
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
this.
|
|
41
|
-
this.
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
this.
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
this.
|
|
79
|
-
|
|
80
|
-
scrollableContext
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
const
|
|
112
|
-
checkbox.
|
|
113
|
-
checkbox.
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
const
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
row.
|
|
149
|
-
row.
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
icon.
|
|
155
|
-
icon.
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
rowContainer.
|
|
163
|
-
rowContainer.
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
this.
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
static get
|
|
185
|
-
static get
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
"
|
|
200
|
-
"
|
|
201
|
-
|
|
202
|
-
"
|
|
203
|
-
"
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
"
|
|
207
|
-
"
|
|
208
|
-
|
|
209
|
-
"
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
"
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
"
|
|
217
|
-
"
|
|
218
|
-
|
|
219
|
-
"
|
|
220
|
-
"
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
"
|
|
224
|
-
"
|
|
225
|
-
|
|
226
|
-
"
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
"
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
"
|
|
237
|
-
"
|
|
238
|
-
"
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
"
|
|
245
|
-
"
|
|
246
|
-
"
|
|
247
|
-
"
|
|
248
|
-
"
|
|
249
|
-
|
|
250
|
-
"
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
"
|
|
255
|
-
"
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
"
|
|
260
|
-
"
|
|
261
|
-
"
|
|
262
|
-
"
|
|
263
|
-
"
|
|
264
|
-
|
|
265
|
-
"
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
"
|
|
270
|
-
"
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
"
|
|
275
|
-
"
|
|
276
|
-
"
|
|
277
|
-
"
|
|
278
|
-
"
|
|
279
|
-
|
|
280
|
-
"
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
"
|
|
285
|
-
"
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
static get
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
"
|
|
294
|
-
"
|
|
295
|
-
"
|
|
296
|
-
"
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
"
|
|
300
|
-
"
|
|
301
|
-
"
|
|
302
|
-
"
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
"
|
|
306
|
-
"
|
|
307
|
-
"
|
|
308
|
-
"
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
}
|
|
1
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
2
|
+
import { h, Host } from '@stencil/core';
|
|
3
|
+
export class TttxList {
|
|
4
|
+
constructor() {
|
|
5
|
+
this.rowCount = 0;
|
|
6
|
+
this.name = undefined;
|
|
7
|
+
this.selectable = undefined;
|
|
8
|
+
this.items = [];
|
|
9
|
+
this.selectedIds = [];
|
|
10
|
+
this.loading = true;
|
|
11
|
+
this.lastPage = false;
|
|
12
|
+
}
|
|
13
|
+
listLoadHandler(event) {
|
|
14
|
+
if (event.detail.name !== this.name)
|
|
15
|
+
return;
|
|
16
|
+
this.items = [...this.items, ...event.detail.items];
|
|
17
|
+
this.loading = false;
|
|
18
|
+
this.lastPage = event.detail.lastPage;
|
|
19
|
+
this.renderRows(event.detail.items);
|
|
20
|
+
if (this.scrollableParent.clientHeight === this.scrollableParent.scrollHeight)
|
|
21
|
+
this.listPaginateHandler();
|
|
22
|
+
}
|
|
23
|
+
listPaginateHandler() {
|
|
24
|
+
// We don't want to emit an event to load the next page if this is the last page, or if we're already loading
|
|
25
|
+
if (this.lastPage || this.loading)
|
|
26
|
+
return;
|
|
27
|
+
this.loading = true;
|
|
28
|
+
this.listPaginate.emit({ name: this.name });
|
|
29
|
+
}
|
|
30
|
+
listClearDataCacheHandler(event) {
|
|
31
|
+
if (event.detail.name !== this.name)
|
|
32
|
+
return;
|
|
33
|
+
this.items = [];
|
|
34
|
+
this.selectedIds = [];
|
|
35
|
+
this.listItemContainer()
|
|
36
|
+
.querySelectorAll('.tttx-list__row')
|
|
37
|
+
.forEach((node) => {
|
|
38
|
+
node.remove();
|
|
39
|
+
});
|
|
40
|
+
this.rowCount = 0;
|
|
41
|
+
this.lastPage = false;
|
|
42
|
+
this.loading = false;
|
|
43
|
+
}
|
|
44
|
+
listActionSelectedEventHandler(event) {
|
|
45
|
+
if (event.detail.name !== this.name || !this.selectable || this.selectedIds.length === 0)
|
|
46
|
+
return;
|
|
47
|
+
const selectedRows = this.selectedIds.map(id => {
|
|
48
|
+
return this.items[id];
|
|
49
|
+
});
|
|
50
|
+
if (event.detail.removeRows)
|
|
51
|
+
this.removeSelectedRows();
|
|
52
|
+
this.listSelectedEvent.emit({
|
|
53
|
+
name: this.name,
|
|
54
|
+
eventName: event.detail.eventName,
|
|
55
|
+
selectedRows,
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
removeSelectedRows() {
|
|
59
|
+
const orderedSelectedIds = [...this.selectedIds].sort((a, b) => {
|
|
60
|
+
return b - a;
|
|
61
|
+
});
|
|
62
|
+
orderedSelectedIds.forEach(itemIndex => {
|
|
63
|
+
this.items.splice(itemIndex, 1);
|
|
64
|
+
this.listItemContainer().removeChild(this.listItemContainer().querySelector(`[data-row-id="${itemIndex}"]`));
|
|
65
|
+
// If this removes the scrollbar and we're not on the last page, load in a new page
|
|
66
|
+
if (this.scrollableParent.clientHeight === this.scrollableParent.scrollHeight)
|
|
67
|
+
this.listPaginateHandler();
|
|
68
|
+
});
|
|
69
|
+
// Empty selected ids with mutation rather than assignment to avoid unecessary component rerender
|
|
70
|
+
this.selectedIds.splice(0, this.selectedIds.length);
|
|
71
|
+
}
|
|
72
|
+
listItemClickHandler(itemData) {
|
|
73
|
+
if (this.selectedIds.length !== 0)
|
|
74
|
+
return;
|
|
75
|
+
this.listItemClick.emit({ itemData, name: this.name });
|
|
76
|
+
}
|
|
77
|
+
componentWillLoad() {
|
|
78
|
+
this.template = this.host.querySelector('template');
|
|
79
|
+
this.scrollableParent = this.getScrollableParent(this.host);
|
|
80
|
+
const scrollableContext = this.scrollableParent === document.scrollingElement ? document : this.scrollableParent;
|
|
81
|
+
scrollableContext.addEventListener('scroll', this.scrollHandler.bind(this));
|
|
82
|
+
window.addEventListener('resize', this.scrollHandler.bind(this));
|
|
83
|
+
}
|
|
84
|
+
componentDidLoad() {
|
|
85
|
+
// Emit event to load first page
|
|
86
|
+
this.listPaginate.emit({ name: this.name });
|
|
87
|
+
}
|
|
88
|
+
listItemContainer() {
|
|
89
|
+
return this.host.shadowRoot.querySelector('.list-item-container');
|
|
90
|
+
}
|
|
91
|
+
async scrollHandler() {
|
|
92
|
+
const { clientHeight, scrollTop, scrollHeight } = this.scrollableParent;
|
|
93
|
+
if (Math.abs(scrollHeight - clientHeight - scrollTop) < 26)
|
|
94
|
+
this.listPaginateHandler();
|
|
95
|
+
}
|
|
96
|
+
isScrollable(node) {
|
|
97
|
+
const hasScrollbar = ['scroll', 'auto'].includes(node.style.overflowY);
|
|
98
|
+
return hasScrollbar;
|
|
99
|
+
}
|
|
100
|
+
getScrollableParent(node) {
|
|
101
|
+
if (!node || node === document.body) {
|
|
102
|
+
return document.scrollingElement;
|
|
103
|
+
}
|
|
104
|
+
else {
|
|
105
|
+
return this.isScrollable(node) ? node : this.getScrollableParent(node.parentElement);
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
appendRowCheckbox(rowContainer) {
|
|
109
|
+
if (!this.selectable)
|
|
110
|
+
return;
|
|
111
|
+
const rowId = this.rowCount;
|
|
112
|
+
const checkbox = document.createElement('input');
|
|
113
|
+
checkbox.setAttribute('type', 'checkbox');
|
|
114
|
+
checkbox.addEventListener('click', e => {
|
|
115
|
+
e.stopPropagation();
|
|
116
|
+
if (e.target.checked) {
|
|
117
|
+
this.selectedIds = [...this.selectedIds, rowId];
|
|
118
|
+
rowContainer.classList.add('selected');
|
|
119
|
+
}
|
|
120
|
+
else {
|
|
121
|
+
this.selectedIds = this.selectedIds.filter(id => {
|
|
122
|
+
return id !== rowId;
|
|
123
|
+
});
|
|
124
|
+
rowContainer.classList.remove('selected');
|
|
125
|
+
}
|
|
126
|
+
});
|
|
127
|
+
rowContainer.setAttribute('data-row-id', `${rowId}`);
|
|
128
|
+
this.rowCount++;
|
|
129
|
+
rowContainer.appendChild(checkbox);
|
|
130
|
+
}
|
|
131
|
+
appendSeededTemplate(rowData, rowContainer) {
|
|
132
|
+
this.template.childNodes.forEach(child => {
|
|
133
|
+
const clone = child.cloneNode(false);
|
|
134
|
+
if (clone.getAttribute('data-fields')) {
|
|
135
|
+
const fields = clone.getAttribute('data-fields').replace(/\s/g, '').split(',');
|
|
136
|
+
const filteredRowData = Object.fromEntries(fields.map((field) => {
|
|
137
|
+
return [field, rowData[field]];
|
|
138
|
+
}));
|
|
139
|
+
clone.setAttribute('row-data', JSON.stringify(filteredRowData));
|
|
140
|
+
}
|
|
141
|
+
else {
|
|
142
|
+
clone.setAttribute('row-data', JSON.stringify(rowData));
|
|
143
|
+
}
|
|
144
|
+
rowContainer.appendChild(clone);
|
|
145
|
+
});
|
|
146
|
+
}
|
|
147
|
+
appendGenericTemplate(rowData, rowContainer) {
|
|
148
|
+
const row = document.createElement('div');
|
|
149
|
+
row.classList.add('generic-template__content');
|
|
150
|
+
row.textContent = rowData.text;
|
|
151
|
+
rowContainer.appendChild(row);
|
|
152
|
+
if (!rowData.icon)
|
|
153
|
+
return;
|
|
154
|
+
const icon = document.createElement('span');
|
|
155
|
+
icon.classList.add('material-symbols-rounded');
|
|
156
|
+
icon.textContent = rowData.icon;
|
|
157
|
+
if (rowData.iconColor)
|
|
158
|
+
icon.style['color'] = rowData.iconColor;
|
|
159
|
+
row.prepend(icon);
|
|
160
|
+
}
|
|
161
|
+
row(rowData) {
|
|
162
|
+
const rowContainer = document.createElement('div');
|
|
163
|
+
rowContainer.classList.add('tttx-list__row');
|
|
164
|
+
rowContainer.addEventListener('click', () => {
|
|
165
|
+
this.listItemClickHandler(rowData);
|
|
166
|
+
});
|
|
167
|
+
this.appendRowCheckbox(rowContainer);
|
|
168
|
+
this.template ? this.appendSeededTemplate(rowData, rowContainer) : this.appendGenericTemplate(rowData, rowContainer);
|
|
169
|
+
return rowContainer;
|
|
170
|
+
}
|
|
171
|
+
renderRows(batchData) {
|
|
172
|
+
batchData.forEach(rowData => {
|
|
173
|
+
this.listItemContainer().appendChild(this.row(rowData));
|
|
174
|
+
});
|
|
175
|
+
}
|
|
176
|
+
loadIndicator() {
|
|
177
|
+
if (!this.loading)
|
|
178
|
+
return;
|
|
179
|
+
return h("div", { class: "load-indicator" }, h("tttx-loading-spinner", { size: 'large' }));
|
|
180
|
+
}
|
|
181
|
+
render() {
|
|
182
|
+
return (h(Host, null, h("div", { class: "list-item-container", tabindex: "0" }, !this.loading && this.items.length === 0 ? 'No data to display' : undefined), this.loadIndicator()));
|
|
183
|
+
}
|
|
184
|
+
static get is() { return "tttx-list"; }
|
|
185
|
+
static get encapsulation() { return "shadow"; }
|
|
186
|
+
static get originalStyleUrls() {
|
|
187
|
+
return {
|
|
188
|
+
"$": ["tttx-list.scss"]
|
|
189
|
+
};
|
|
190
|
+
}
|
|
191
|
+
static get styleUrls() {
|
|
192
|
+
return {
|
|
193
|
+
"$": ["tttx-list.css"]
|
|
194
|
+
};
|
|
195
|
+
}
|
|
196
|
+
static get properties() {
|
|
197
|
+
return {
|
|
198
|
+
"name": {
|
|
199
|
+
"type": "string",
|
|
200
|
+
"mutable": false,
|
|
201
|
+
"complexType": {
|
|
202
|
+
"original": "string",
|
|
203
|
+
"resolved": "string",
|
|
204
|
+
"references": {}
|
|
205
|
+
},
|
|
206
|
+
"required": false,
|
|
207
|
+
"optional": false,
|
|
208
|
+
"docs": {
|
|
209
|
+
"tags": [],
|
|
210
|
+
"text": ""
|
|
211
|
+
},
|
|
212
|
+
"attribute": "name",
|
|
213
|
+
"reflect": false
|
|
214
|
+
},
|
|
215
|
+
"selectable": {
|
|
216
|
+
"type": "boolean",
|
|
217
|
+
"mutable": false,
|
|
218
|
+
"complexType": {
|
|
219
|
+
"original": "boolean",
|
|
220
|
+
"resolved": "boolean",
|
|
221
|
+
"references": {}
|
|
222
|
+
},
|
|
223
|
+
"required": false,
|
|
224
|
+
"optional": false,
|
|
225
|
+
"docs": {
|
|
226
|
+
"tags": [],
|
|
227
|
+
"text": ""
|
|
228
|
+
},
|
|
229
|
+
"attribute": "selectable",
|
|
230
|
+
"reflect": false
|
|
231
|
+
}
|
|
232
|
+
};
|
|
233
|
+
}
|
|
234
|
+
static get states() {
|
|
235
|
+
return {
|
|
236
|
+
"items": {},
|
|
237
|
+
"selectedIds": {},
|
|
238
|
+
"loading": {},
|
|
239
|
+
"lastPage": {}
|
|
240
|
+
};
|
|
241
|
+
}
|
|
242
|
+
static get events() {
|
|
243
|
+
return [{
|
|
244
|
+
"method": "listPaginate",
|
|
245
|
+
"name": "listPaginate",
|
|
246
|
+
"bubbles": true,
|
|
247
|
+
"cancelable": true,
|
|
248
|
+
"composed": true,
|
|
249
|
+
"docs": {
|
|
250
|
+
"tags": [],
|
|
251
|
+
"text": ""
|
|
252
|
+
},
|
|
253
|
+
"complexType": {
|
|
254
|
+
"original": "any",
|
|
255
|
+
"resolved": "any",
|
|
256
|
+
"references": {}
|
|
257
|
+
}
|
|
258
|
+
}, {
|
|
259
|
+
"method": "listSelectedEvent",
|
|
260
|
+
"name": "listSelectedEvent",
|
|
261
|
+
"bubbles": true,
|
|
262
|
+
"cancelable": true,
|
|
263
|
+
"composed": true,
|
|
264
|
+
"docs": {
|
|
265
|
+
"tags": [],
|
|
266
|
+
"text": ""
|
|
267
|
+
},
|
|
268
|
+
"complexType": {
|
|
269
|
+
"original": "any",
|
|
270
|
+
"resolved": "any",
|
|
271
|
+
"references": {}
|
|
272
|
+
}
|
|
273
|
+
}, {
|
|
274
|
+
"method": "listItemClick",
|
|
275
|
+
"name": "listItemClick",
|
|
276
|
+
"bubbles": true,
|
|
277
|
+
"cancelable": true,
|
|
278
|
+
"composed": true,
|
|
279
|
+
"docs": {
|
|
280
|
+
"tags": [],
|
|
281
|
+
"text": ""
|
|
282
|
+
},
|
|
283
|
+
"complexType": {
|
|
284
|
+
"original": "any",
|
|
285
|
+
"resolved": "any",
|
|
286
|
+
"references": {}
|
|
287
|
+
}
|
|
288
|
+
}];
|
|
289
|
+
}
|
|
290
|
+
static get elementRef() { return "host"; }
|
|
291
|
+
static get listeners() {
|
|
292
|
+
return [{
|
|
293
|
+
"name": "listPageLoad",
|
|
294
|
+
"method": "listLoadHandler",
|
|
295
|
+
"target": "document",
|
|
296
|
+
"capture": false,
|
|
297
|
+
"passive": false
|
|
298
|
+
}, {
|
|
299
|
+
"name": "listClearDataCache",
|
|
300
|
+
"method": "listClearDataCacheHandler",
|
|
301
|
+
"target": "document",
|
|
302
|
+
"capture": false,
|
|
303
|
+
"passive": false
|
|
304
|
+
}, {
|
|
305
|
+
"name": "listActionSelectedEvent",
|
|
306
|
+
"method": "listActionSelectedEventHandler",
|
|
307
|
+
"target": "document",
|
|
308
|
+
"capture": false,
|
|
309
|
+
"passive": false
|
|
310
|
+
}];
|
|
311
|
+
}
|
|
312
|
+
}
|