@poirazis/supercomponents-shared 1.2.12 → 1.2.13
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/index.js +11250 -11204
- package/dist/index.umd.cjs +15 -15
- package/package.json +1 -1
- package/src/lib/SuperForm/InnerForm.svelte +68 -19
- package/src/lib/SuperForm/SuperForm.svelte +13 -3
- package/src/lib/SuperTable/SuperTable.css +9 -6
- package/src/lib/SuperTable/SuperTable.svelte +207 -193
- package/src/lib/SuperTable/controls/ColumnsSection.svelte +11 -19
- package/src/lib/SuperTable/controls/RowButtonsColumn.svelte +4 -4
- package/src/lib/SuperTable/controls/SelectionColumn.svelte +9 -10
- package/src/lib/SuperTable/overlays/AddNewRowOverlay.svelte +1 -1
- package/src/lib/SuperTableCells/CellBoolean.svelte +0 -1
- package/src/lib/SuperTableCells/CellCommon.css +59 -88
- package/src/lib/SuperTableCells/CellDateRange.svelte +3 -4
- package/src/lib/SuperTableCells/CellDatetime.svelte +3 -4
- package/src/lib/SuperTableCells/CellJSON.svelte +1 -4
- package/src/lib/SuperTableCells/CellLink.svelte +20 -25
- package/src/lib/SuperTableCells/CellLinkAdvanced.svelte +3 -7
- package/src/lib/SuperTableCells/CellLinkPickerSelect.svelte +7 -4
- package/src/lib/SuperTableCells/CellNumber.svelte +18 -23
- package/src/lib/SuperTableCells/CellOptions.svelte +34 -31
- package/src/lib/SuperTableCells/CellSQLLink.svelte +84 -64
- package/src/lib/SuperTableCells/CellSQLLinkPicker.svelte +66 -36
- package/src/lib/SuperTableCells/CellString.svelte +9 -25
- package/src/lib/SuperTableCells/CellStringMask.svelte +0 -4
- package/src/lib/SuperTableCells/CellStringSimple.svelte +6 -8
- package/src/lib/SuperTableColumn/SuperTableColumn.svelte +10 -10
- package/src/lib/SuperTableColumn/parts/SuperColumnHeader.svelte +4 -1
- package/src/lib/SuperTableColumn/parts/SuperColumnRow.svelte +25 -21
- package/src/lib/SuperTabs/SuperTabs.svelte +7 -12
- package/src/lib/SuperTable/controls/SuperTableWelcome.svelte +0 -58
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import { getContext, createEventDispatcher, tick } from "svelte";
|
|
3
|
-
import type { LogicalOperator, EmptyFilterOption } from "@budibase/types";
|
|
4
3
|
|
|
5
4
|
const { API, fetchData, QueryUtils } = getContext("sdk");
|
|
6
5
|
const dispatch = createEventDispatcher();
|
|
@@ -18,7 +17,7 @@
|
|
|
18
17
|
let control;
|
|
19
18
|
let filterTerm;
|
|
20
19
|
let initLimit = 15;
|
|
21
|
-
|
|
20
|
+
|
|
22
21
|
let isInitialLoad = true;
|
|
23
22
|
let hasMoreData = true;
|
|
24
23
|
let optionRefs = [];
|
|
@@ -26,12 +25,23 @@
|
|
|
26
25
|
let optionsFetch;
|
|
27
26
|
let searchFilter;
|
|
28
27
|
let currentLimit = initLimit;
|
|
28
|
+
let searchExtensions = {};
|
|
29
29
|
|
|
30
30
|
$: localValue = Array.isArray(value) ? value : [];
|
|
31
31
|
$: defaultQuery = QueryUtils.buildQuery(filter);
|
|
32
|
-
$:
|
|
33
|
-
|
|
34
|
-
|
|
32
|
+
$: {
|
|
33
|
+
if (searchFilter) {
|
|
34
|
+
// If searchFilter is already in $or format (object), use it directly
|
|
35
|
+
// Otherwise if it's legacy array format, build it through QueryUtils
|
|
36
|
+
if (Array.isArray(searchFilter)) {
|
|
37
|
+
searchExtensions = { search: QueryUtils.buildQuery(searchFilter) };
|
|
38
|
+
} else {
|
|
39
|
+
searchExtensions = { search: searchFilter };
|
|
40
|
+
}
|
|
41
|
+
} else {
|
|
42
|
+
searchExtensions = {};
|
|
43
|
+
}
|
|
44
|
+
}
|
|
35
45
|
|
|
36
46
|
$: query = extendQuery(defaultQuery, searchExtensions);
|
|
37
47
|
|
|
@@ -50,6 +60,10 @@
|
|
|
50
60
|
$: optionsFetch?.update({ query: query, limit: currentLimit });
|
|
51
61
|
|
|
52
62
|
$: primaryDisplay = $optionsFetch?.definition?.primaryDisplay || "id";
|
|
63
|
+
$: gridTemplate = relatedColumns
|
|
64
|
+
.map((col) => col.width || "1fr")
|
|
65
|
+
.concat("32px")
|
|
66
|
+
.join(" ");
|
|
53
67
|
|
|
54
68
|
$: if ($optionsFetch?.loaded) {
|
|
55
69
|
hasMoreData = $optionsFetch.rows.length >= currentLimit;
|
|
@@ -71,17 +85,15 @@
|
|
|
71
85
|
return defaultQuery;
|
|
72
86
|
}
|
|
73
87
|
const extended = {
|
|
74
|
-
[
|
|
88
|
+
["$and"]: {
|
|
75
89
|
conditions: [
|
|
76
90
|
...(defaultQuery ? [defaultQuery] : []),
|
|
77
91
|
...Object.values(extensions || {}),
|
|
78
92
|
],
|
|
79
93
|
},
|
|
80
|
-
onEmptyFilter:
|
|
94
|
+
onEmptyFilter: "none",
|
|
81
95
|
};
|
|
82
|
-
return (extended[
|
|
83
|
-
? extended
|
|
84
|
-
: {};
|
|
96
|
+
return (extended["$and"]?.conditions?.length ?? 0) > 0 ? extended : {};
|
|
85
97
|
};
|
|
86
98
|
|
|
87
99
|
const rowSelected = (val) => {
|
|
@@ -98,6 +110,7 @@
|
|
|
98
110
|
: val[primaryDisplay];
|
|
99
111
|
|
|
100
112
|
const selectedItem = {
|
|
113
|
+
...val, // Include the full row object
|
|
101
114
|
[relatedField]: val[relatedField],
|
|
102
115
|
primaryDisplay: displayValue,
|
|
103
116
|
};
|
|
@@ -108,7 +121,7 @@
|
|
|
108
121
|
} else localValue = [selectedItem];
|
|
109
122
|
} else {
|
|
110
123
|
let pos = localValue.findIndex(
|
|
111
|
-
(v) => v[relatedField] == val[relatedField]
|
|
124
|
+
(v) => v[relatedField] == val[relatedField],
|
|
112
125
|
);
|
|
113
126
|
if (pos > -1) {
|
|
114
127
|
localValue.splice(pos, 1);
|
|
@@ -124,15 +137,29 @@
|
|
|
124
137
|
const handleSearch = (e) => {
|
|
125
138
|
filterTerm = e.target.value;
|
|
126
139
|
if (e.target.value) {
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
140
|
+
// If we have relatedColumns, create an OR filter that matches any column
|
|
141
|
+
if (relatedColumns && relatedColumns.length > 0) {
|
|
142
|
+
searchFilter = {
|
|
143
|
+
$or: {
|
|
144
|
+
conditions: relatedColumns.map((col) => ({
|
|
145
|
+
fuzzy: {
|
|
146
|
+
[col.name]: e.target.value,
|
|
147
|
+
},
|
|
148
|
+
})),
|
|
149
|
+
},
|
|
150
|
+
};
|
|
151
|
+
} else {
|
|
152
|
+
// Otherwise use primary display field
|
|
153
|
+
searchFilter = [
|
|
154
|
+
{
|
|
155
|
+
field: primaryDisplay,
|
|
156
|
+
type: "string",
|
|
157
|
+
operator: "fuzzy",
|
|
158
|
+
value: e.target.value,
|
|
159
|
+
valueType: "Value",
|
|
160
|
+
},
|
|
161
|
+
];
|
|
162
|
+
}
|
|
136
163
|
} else {
|
|
137
164
|
searchFilter = undefined;
|
|
138
165
|
}
|
|
@@ -186,12 +213,7 @@
|
|
|
186
213
|
filterTerm = char;
|
|
187
214
|
control?.focus();
|
|
188
215
|
},
|
|
189
|
-
focusList: () => {
|
|
190
|
-
listElement?.focus();
|
|
191
|
-
},
|
|
192
216
|
};
|
|
193
|
-
|
|
194
|
-
$: numCols = relatedColumns.length;
|
|
195
217
|
</script>
|
|
196
218
|
|
|
197
219
|
<!-- svelte-ignore a11y-no-static-element-interactions -->
|
|
@@ -221,7 +243,7 @@
|
|
|
221
243
|
: "Search"}
|
|
222
244
|
on:input={handleSearch}
|
|
223
245
|
on:keydown={handleNavigation}
|
|
224
|
-
on:
|
|
246
|
+
on:focusout
|
|
225
247
|
/>
|
|
226
248
|
</div>
|
|
227
249
|
|
|
@@ -229,18 +251,19 @@
|
|
|
229
251
|
<div
|
|
230
252
|
class="list"
|
|
231
253
|
class:table-mode={relatedColumns && relatedColumns.length > 0}
|
|
232
|
-
bind:this={listElement}
|
|
233
254
|
on:scroll={handleScroll}
|
|
234
255
|
>
|
|
235
256
|
{#if relatedColumns && relatedColumns.length > 1}
|
|
236
257
|
<div
|
|
237
258
|
class="grid-container"
|
|
238
|
-
style="--
|
|
259
|
+
style="--grid-template: {gridTemplate}"
|
|
239
260
|
on:scroll={handleScroll}
|
|
240
261
|
>
|
|
241
262
|
<div class="header-row">
|
|
242
263
|
{#each relatedColumns as col}
|
|
243
|
-
<div class="header-cell">
|
|
264
|
+
<div class="header-cell">
|
|
265
|
+
{col.displayName || col.name}
|
|
266
|
+
</div>
|
|
244
267
|
{/each}
|
|
245
268
|
<div class="header-cell check"></div>
|
|
246
269
|
</div>
|
|
@@ -255,7 +278,9 @@
|
|
|
255
278
|
on:mousedown|preventDefault={() => selectRow(row)}
|
|
256
279
|
>
|
|
257
280
|
{#each relatedColumns as col}
|
|
258
|
-
<div class="data-cell">
|
|
281
|
+
<div class="data-cell">
|
|
282
|
+
{row[col.name] || ""}
|
|
283
|
+
</div>
|
|
259
284
|
{/each}
|
|
260
285
|
<div class="data-cell check"><i class="ri-check-line"></i></div>
|
|
261
286
|
</div>
|
|
@@ -318,7 +343,7 @@
|
|
|
318
343
|
on:mouseleave={() => (focusIdx = -1)}
|
|
319
344
|
on:mousedown|preventDefault|stopPropagation={() => selectRow(row)}
|
|
320
345
|
>
|
|
321
|
-
{row.primaryDisplay || row[primaryDisplay]}
|
|
346
|
+
<span>{row.primaryDisplay || row[primaryDisplay]}</span>
|
|
322
347
|
<i class="ri-check-line"></i>
|
|
323
348
|
</div>
|
|
324
349
|
{/each}
|
|
@@ -336,7 +361,7 @@
|
|
|
336
361
|
on:mouseleave={() => (focusIdx = -1)}
|
|
337
362
|
on:mousedown|preventDefault={() => selectRow(row)}
|
|
338
363
|
>
|
|
339
|
-
{row.primaryDisplay || row[primaryDisplay]}
|
|
364
|
+
<span>{row.primaryDisplay || row[primaryDisplay]}</span>
|
|
340
365
|
<i class="ri-check-line"></i>
|
|
341
366
|
</div>
|
|
342
367
|
{/if}
|
|
@@ -444,15 +469,20 @@
|
|
|
444
469
|
line-height: 1.5rem;
|
|
445
470
|
padding: 0.15rem 0.5rem;
|
|
446
471
|
overflow: hidden;
|
|
447
|
-
text-overflow: ellipsis;
|
|
448
|
-
white-space: nowrap;
|
|
449
472
|
display: flex;
|
|
473
|
+
min-width: 0;
|
|
450
474
|
justify-content: space-between;
|
|
451
475
|
|
|
452
476
|
& > i {
|
|
453
477
|
visibility: hidden;
|
|
454
478
|
}
|
|
455
479
|
|
|
480
|
+
& > span {
|
|
481
|
+
overflow: hidden;
|
|
482
|
+
text-overflow: ellipsis;
|
|
483
|
+
white-space: nowrap;
|
|
484
|
+
}
|
|
485
|
+
|
|
456
486
|
&.selected {
|
|
457
487
|
& > i {
|
|
458
488
|
visibility: visible;
|
|
@@ -492,13 +522,13 @@
|
|
|
492
522
|
background-color: var(--spectrum-global-color-gray-100);
|
|
493
523
|
z-index: 1;
|
|
494
524
|
display: grid;
|
|
495
|
-
grid-template-columns:
|
|
525
|
+
grid-template-columns: var(--grid-template);
|
|
496
526
|
height: 1.75rem;
|
|
497
527
|
}
|
|
498
528
|
|
|
499
529
|
.data-row {
|
|
500
530
|
display: grid;
|
|
501
|
-
grid-template-columns:
|
|
531
|
+
grid-template-columns: var(--grid-template);
|
|
502
532
|
cursor: pointer;
|
|
503
533
|
}
|
|
504
534
|
|
|
@@ -8,21 +8,13 @@
|
|
|
8
8
|
import fsm from "svelte-fsm";
|
|
9
9
|
import "./CellCommon.css";
|
|
10
10
|
|
|
11
|
-
/**
|
|
12
|
-
* @typedef {import('./types.js').CellOptions} CellOptions
|
|
13
|
-
* @typedef {import('./types.js').CellApi} CellApi
|
|
14
|
-
*/
|
|
15
|
-
|
|
16
11
|
const dispatch = createEventDispatcher();
|
|
17
12
|
const { processStringSync } = getContext("sdk");
|
|
18
13
|
|
|
19
|
-
/** @type {string | null} */
|
|
20
14
|
export let value;
|
|
21
15
|
|
|
22
|
-
/** @type {string | undefined} */
|
|
23
16
|
export let formattedValue = undefined;
|
|
24
17
|
|
|
25
|
-
/** @type {CellOptions} */
|
|
26
18
|
export let cellOptions = {
|
|
27
19
|
role: "formInput",
|
|
28
20
|
initialState: "Editing",
|
|
@@ -157,7 +149,6 @@
|
|
|
157
149
|
});
|
|
158
150
|
|
|
159
151
|
// Public API
|
|
160
|
-
/** @type {CellApi} */
|
|
161
152
|
export const cellApi = {
|
|
162
153
|
focus: () => cellState.focus(),
|
|
163
154
|
reset: () => cellState.reset(value),
|
|
@@ -201,6 +192,7 @@
|
|
|
201
192
|
<!-- svelte-ignore a11y-click-events-have-key-events -->
|
|
202
193
|
<div
|
|
203
194
|
class="superCell"
|
|
195
|
+
tabindex={cellOptions.readonly || cellOptions.disabled ? -1 : 0}
|
|
204
196
|
class:multirow={controlType == "textarea"}
|
|
205
197
|
class:inEdit
|
|
206
198
|
class:isDirty={isDirty && showDirty}
|
|
@@ -212,8 +204,9 @@
|
|
|
212
204
|
class:error
|
|
213
205
|
style:color
|
|
214
206
|
style:background
|
|
207
|
+
on:focusin={cellState.focus}
|
|
215
208
|
>
|
|
216
|
-
{#if icon}
|
|
209
|
+
{#if icon && !textarea}
|
|
217
210
|
<i class={icon + " field-icon"} class:with-error={error}></i>
|
|
218
211
|
{/if}
|
|
219
212
|
{#if inEdit}
|
|
@@ -247,39 +240,30 @@
|
|
|
247
240
|
: cellOptions.align == "flex-end"
|
|
248
241
|
? "right"
|
|
249
242
|
: "left"}
|
|
250
|
-
style:padding-right={cellOptions.align != "flex-start"
|
|
251
|
-
? "2rem"
|
|
252
|
-
: "0.75rem"}
|
|
253
243
|
on:input={cellState.debounce}
|
|
254
244
|
on:focusout={cellState.focusout}
|
|
255
245
|
on:keydown={cellState.handleKeyboard}
|
|
256
246
|
use:focus
|
|
257
247
|
/>
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
{/if}
|
|
248
|
+
<i
|
|
249
|
+
class="ri-close-line clear-icon"
|
|
250
|
+
class:visible={localValue && cellOptions?.clearIcon !== false}
|
|
251
|
+
on:mousedown|self|preventDefault={cellState.clear}
|
|
252
|
+
></i>
|
|
264
253
|
{/if}
|
|
265
254
|
{:else if textarea}
|
|
266
255
|
<div
|
|
267
256
|
class="value textarea"
|
|
268
|
-
tabindex={cellOptions.readonly || cellOptions.disabled ? -1 : 0}
|
|
269
|
-
class:with-icon={cellOptions.icon || error}
|
|
270
257
|
class:placeholder={!value && !formattedValue}
|
|
271
258
|
style:justify-content={cellOptions.align}
|
|
272
|
-
on:focusin={cellState.focus}
|
|
273
259
|
>
|
|
274
260
|
{formattedValue || value || placeholder}
|
|
275
261
|
</div>
|
|
276
262
|
{:else}
|
|
277
263
|
<div
|
|
278
264
|
class="value"
|
|
279
|
-
tabindex={cellOptions.readonly || cellOptions.disabled ? -1 : 0}
|
|
280
265
|
class:placeholder={!value}
|
|
281
266
|
style:justify-content={cellOptions.align}
|
|
282
|
-
on:focusin={cellState.focus}
|
|
283
267
|
>
|
|
284
268
|
<span>
|
|
285
269
|
{formattedValue || value || placeholder}
|
|
@@ -294,7 +278,7 @@
|
|
|
294
278
|
display: flex;
|
|
295
279
|
align-items: flex-start;
|
|
296
280
|
white-space: pre-wrap;
|
|
297
|
-
padding: 0.5rem;
|
|
281
|
+
padding: 0.5rem 0rem;
|
|
298
282
|
overflow-y: auto;
|
|
299
283
|
}
|
|
300
284
|
|
|
@@ -331,8 +331,6 @@
|
|
|
331
331
|
},
|
|
332
332
|
};
|
|
333
333
|
}
|
|
334
|
-
|
|
335
|
-
$: console.log(value, localValue, isComplete);
|
|
336
334
|
</script>
|
|
337
335
|
|
|
338
336
|
<!-- svelte-ignore a11y-no-noninteractive-tabindex -->
|
|
@@ -365,7 +363,6 @@
|
|
|
365
363
|
bind:this={inputElement}
|
|
366
364
|
tabindex="0"
|
|
367
365
|
class="editor"
|
|
368
|
-
class:with-icon={cellOptions.icon}
|
|
369
366
|
{placeholder}
|
|
370
367
|
style:color={!isComplete
|
|
371
368
|
? "var(--spectrum-global-color-gray-700)"
|
|
@@ -393,7 +390,6 @@
|
|
|
393
390
|
<div
|
|
394
391
|
class="value"
|
|
395
392
|
tabindex={cellOptions.readonly || cellOptions.disabled ? "-1" : "0"}
|
|
396
|
-
class:with-icon={cellOptions.icon}
|
|
397
393
|
class:placeholder={!value}
|
|
398
394
|
style:justify-content={cellOptions.align}
|
|
399
395
|
on:focusin={cellState.focus}
|
|
@@ -10,12 +10,11 @@
|
|
|
10
10
|
debounce: 250,
|
|
11
11
|
};
|
|
12
12
|
|
|
13
|
-
$: formattedValue =
|
|
14
|
-
cellOptions
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
: undefined;;
|
|
13
|
+
$: formattedValue = cellOptions?.template
|
|
14
|
+
? processStringSync(cellOptions.template, {
|
|
15
|
+
value,
|
|
16
|
+
})
|
|
17
|
+
: undefined;
|
|
19
18
|
|
|
20
19
|
$: placeholder =
|
|
21
20
|
cellOptions.readonly || cellOptions.disabled
|
|
@@ -39,12 +38,11 @@
|
|
|
39
38
|
style:font-weight={cellOptions.fontWeight}
|
|
40
39
|
>
|
|
41
40
|
{#if cellOptions.icon}
|
|
42
|
-
<i class={cellOptions.icon + " icon"}></i>
|
|
41
|
+
<i class={cellOptions.icon + " field-icon"}></i>
|
|
43
42
|
{/if}
|
|
44
43
|
|
|
45
44
|
<div
|
|
46
45
|
class="value"
|
|
47
|
-
class:with-icon={cellOptions.icon}
|
|
48
46
|
class:placeholder={!value}
|
|
49
47
|
style:justify-content={cellOptions.align}
|
|
50
48
|
>
|
|
@@ -28,6 +28,8 @@
|
|
|
28
28
|
const stbState = getContext("stbState");
|
|
29
29
|
const stbAPI = getContext("stbAPI");
|
|
30
30
|
|
|
31
|
+
const data = getContext("data");
|
|
32
|
+
|
|
31
33
|
// Cell Components Map
|
|
32
34
|
const cellComponents = {
|
|
33
35
|
string: CellString,
|
|
@@ -68,7 +70,6 @@
|
|
|
68
70
|
export let columnOptions;
|
|
69
71
|
export let sticky;
|
|
70
72
|
export let scrollPos;
|
|
71
|
-
export let stbData;
|
|
72
73
|
|
|
73
74
|
// Internal Variables
|
|
74
75
|
let id = Math.random() * 100;
|
|
@@ -106,9 +107,7 @@
|
|
|
106
107
|
})
|
|
107
108
|
: undefined;
|
|
108
109
|
|
|
109
|
-
$: values = $
|
|
110
|
-
deepGet(row, $columnOptionsStore.name)
|
|
111
|
-
);
|
|
110
|
+
$: values = $data.map((row) => deepGet(row, $columnOptionsStore.name));
|
|
112
111
|
|
|
113
112
|
$: if ($stbSortColumn == $columnOptionsStore.name) {
|
|
114
113
|
sorted = $stbSortOrder;
|
|
@@ -139,7 +138,7 @@
|
|
|
139
138
|
color: $columnOptionsStore.color,
|
|
140
139
|
controlType: "checkbox",
|
|
141
140
|
};
|
|
142
|
-
}
|
|
141
|
+
},
|
|
143
142
|
);
|
|
144
143
|
|
|
145
144
|
const headerCellOptions = derivedMemo(
|
|
@@ -160,7 +159,7 @@
|
|
|
160
159
|
initialState: "Editing",
|
|
161
160
|
role: "inlineInput",
|
|
162
161
|
};
|
|
163
|
-
}
|
|
162
|
+
},
|
|
164
163
|
);
|
|
165
164
|
|
|
166
165
|
// Allow the Super Table to bind to the Super Column State Machine to control it
|
|
@@ -177,7 +176,7 @@
|
|
|
177
176
|
if (columnOptions.canSort) {
|
|
178
177
|
stbState.sortBy(
|
|
179
178
|
columnOptions.name,
|
|
180
|
-
sorted == "ascending" ? "descending" : "ascending"
|
|
179
|
+
sorted == "ascending" ? "descending" : "ascending",
|
|
181
180
|
);
|
|
182
181
|
sorted = "ascending" ? "descending" : "ascending";
|
|
183
182
|
}
|
|
@@ -188,7 +187,7 @@
|
|
|
188
187
|
unlockWidth() {
|
|
189
188
|
if (resizing) return;
|
|
190
189
|
$lockWidth = 0;
|
|
191
|
-
if (!columnOptions.asComponent) this.lockWidth.debounce(
|
|
190
|
+
if (!columnOptions.asComponent) this.lockWidth.debounce(150);
|
|
192
191
|
},
|
|
193
192
|
startResizing(e) {
|
|
194
193
|
e.stopPropagation();
|
|
@@ -244,6 +243,7 @@
|
|
|
244
243
|
return "Idle";
|
|
245
244
|
},
|
|
246
245
|
clear() {
|
|
246
|
+
stbState.clearFilter(id);
|
|
247
247
|
return "Idle";
|
|
248
248
|
},
|
|
249
249
|
},
|
|
@@ -259,7 +259,7 @@
|
|
|
259
259
|
},
|
|
260
260
|
EditingCell: {
|
|
261
261
|
_enter() {
|
|
262
|
-
$lockWidth = viewport.clientWidth;
|
|
262
|
+
$lockWidth = Math.max(viewport.clientWidth, 160);
|
|
263
263
|
stbState.edit.debounce(30);
|
|
264
264
|
},
|
|
265
265
|
patchRow(index, id, rev, field, change) {
|
|
@@ -395,7 +395,7 @@
|
|
|
395
395
|
{/if}
|
|
396
396
|
|
|
397
397
|
<SuperColumnBody
|
|
398
|
-
rows={$
|
|
398
|
+
rows={$data}
|
|
399
399
|
rowHeight={$stbSettings.appearance.rowHeight}
|
|
400
400
|
field={$columnOptionsStore.name}
|
|
401
401
|
idField={$stbSettings.data.idColumn}
|
|
@@ -28,6 +28,10 @@
|
|
|
28
28
|
}
|
|
29
29
|
|
|
30
30
|
$: isEntering = $columnState == "Entering";
|
|
31
|
+
$: if ($columnState == "Idle") {
|
|
32
|
+
filterValue = null;
|
|
33
|
+
filterOperator = $columnOptions.defaultFilteringOperator;
|
|
34
|
+
}
|
|
31
35
|
|
|
32
36
|
const handleValueChange = (e) => {
|
|
33
37
|
if (e.detail != undefined && e.detail != null && e.detail != "") {
|
|
@@ -125,7 +129,6 @@
|
|
|
125
129
|
fieldSchema={$columnOptions.schema}
|
|
126
130
|
multi={filterOperator == "containsAny" || filterOperator == "oneOf"}
|
|
127
131
|
on:change={handleValueChange}
|
|
128
|
-
on:cancel={columnState.cancel}
|
|
129
132
|
on:focusout={handleBlur}
|
|
130
133
|
/>
|
|
131
134
|
{:else}
|
|
@@ -21,16 +21,18 @@
|
|
|
21
21
|
export let isLast;
|
|
22
22
|
export let disabled;
|
|
23
23
|
|
|
24
|
-
// the default height
|
|
25
|
-
|
|
26
|
-
let viewport;
|
|
27
24
|
let info;
|
|
28
25
|
|
|
29
|
-
|
|
26
|
+
// Get Row overrides from metadata or fallback to column settings
|
|
27
|
+
$: color = $rowMetadata[index]?.color;
|
|
28
|
+
$: height = $rowMetadata[index]?.height;
|
|
29
|
+
$: bgcolor = $rowMetadata[index]?.bgcolor;
|
|
30
|
+
|
|
30
31
|
$: id = row?.[idField] ?? index;
|
|
31
32
|
$: value = deepGet(row, field);
|
|
32
|
-
$:
|
|
33
|
-
$:
|
|
33
|
+
$: hovered = $stbHovered == index || $stbMenuID == index;
|
|
34
|
+
$: selected = $rowMetadata?.[index]?.selected ?? false;
|
|
35
|
+
$: disabled = $rowMetadata?.[index]?.disabled ?? false;
|
|
34
36
|
$: hasChildren = $columnSettings.hasChildren > 0;
|
|
35
37
|
|
|
36
38
|
const patchRow = async (change) => {
|
|
@@ -73,37 +75,39 @@
|
|
|
73
75
|
} else return obj[path] ?? undefined;
|
|
74
76
|
};
|
|
75
77
|
|
|
78
|
+
const onClick = () => {
|
|
79
|
+
if (disabled) return;
|
|
80
|
+
stbState.handleRowClick(index, field, deepGet(row, field), id);
|
|
81
|
+
};
|
|
76
82
|
onDestroy(() => {
|
|
77
83
|
if ($stbEditing == index) {
|
|
78
84
|
columnState.exitedit();
|
|
79
85
|
}
|
|
80
86
|
});
|
|
87
|
+
|
|
88
|
+
const onContextMenu = (e) => {
|
|
89
|
+
stbAPI.showContextMenu(index, e.__root);
|
|
90
|
+
};
|
|
81
91
|
</script>
|
|
82
92
|
|
|
83
93
|
<!-- svelte-ignore a11y-click-events-have-key-events -->
|
|
84
94
|
<!-- svelte-ignore a11y-no-static-element-interactions -->
|
|
85
95
|
<!-- svelte-ignore a11y-no-noninteractive-tabindex -->
|
|
86
96
|
<div
|
|
87
|
-
bind:this={viewport}
|
|
88
97
|
class="super-row"
|
|
89
|
-
class:
|
|
90
|
-
class:
|
|
91
|
-
class:
|
|
92
|
-
class:
|
|
98
|
+
class:selected
|
|
99
|
+
class:hovered
|
|
100
|
+
class:isEditing
|
|
101
|
+
class:disabled
|
|
93
102
|
class:isLast
|
|
94
|
-
style:height
|
|
95
|
-
style:color
|
|
96
|
-
style:background-color={
|
|
103
|
+
style:height
|
|
104
|
+
style:color
|
|
105
|
+
style:background-color={bgcolor}
|
|
97
106
|
style:justify-content={$columnSettings.align}
|
|
98
107
|
on:mouseenter={() => ($stbHovered = index)}
|
|
99
108
|
on:mouseleave={() => ($stbHovered = undefined)}
|
|
100
|
-
on:click={
|
|
101
|
-
|
|
102
|
-
stbState.handleRowClick(index, field, deepGet(row, field), id);
|
|
103
|
-
}}
|
|
104
|
-
on:contextmenu|preventDefault={() => {
|
|
105
|
-
stbAPI.showContextMenu(index, viewport);
|
|
106
|
-
}}
|
|
109
|
+
on:click={onClick}
|
|
110
|
+
on:contextmenu|preventDefault={onContextMenu}
|
|
107
111
|
>
|
|
108
112
|
{#if !hasChildren}
|
|
109
113
|
<svelte:component
|
|
@@ -15,14 +15,14 @@
|
|
|
15
15
|
export let tabsIconsOnly;
|
|
16
16
|
export let list_icon;
|
|
17
17
|
export let list_title;
|
|
18
|
-
export let
|
|
18
|
+
export let tabsWidth = "200px";
|
|
19
19
|
|
|
20
20
|
export let quietTabs;
|
|
21
21
|
|
|
22
22
|
// Computed for repeated logic
|
|
23
23
|
$: isVertical = tabsPosition == "left" || theme === "list";
|
|
24
24
|
$: justify = direction === "row" ? hAlign : vAlign;
|
|
25
|
-
$: button = theme === "buttons"
|
|
25
|
+
$: button = theme === "buttons";
|
|
26
26
|
</script>
|
|
27
27
|
|
|
28
28
|
<!-- svelte-ignore a11y-click-events-have-key-events -->
|
|
@@ -33,15 +33,14 @@
|
|
|
33
33
|
class:quietTabs
|
|
34
34
|
class:list={theme === "list"}
|
|
35
35
|
class:vertical={isVertical}
|
|
36
|
-
class:wide={theme === "wideButtons" && wide}
|
|
37
36
|
style:justify-content={justify}
|
|
37
|
+
style:width={isVertical ? tabsWidth || "200px" : "100%"}
|
|
38
38
|
>
|
|
39
39
|
<div
|
|
40
40
|
class="tabs"
|
|
41
41
|
class:vertical={isVertical}
|
|
42
42
|
class:buttons={button}
|
|
43
43
|
class:list={theme === "list"}
|
|
44
|
-
class:wide={theme === "wideButtons" && wide}
|
|
45
44
|
style:justify-content={buttonsAlignment}
|
|
46
45
|
style:--tab-alignment={tabsAlignment}
|
|
47
46
|
style:--tab-track-thickness="1px"
|
|
@@ -104,19 +103,14 @@
|
|
|
104
103
|
}
|
|
105
104
|
|
|
106
105
|
.outer-tabs.vertical {
|
|
106
|
+
padding-left: 0.25rem;
|
|
107
|
+
padding-right: 0.25rem;
|
|
107
108
|
flex-direction: column;
|
|
108
109
|
align-items: stretch;
|
|
109
|
-
margin-right: 0.75rem;
|
|
110
110
|
margin-bottom: unset;
|
|
111
|
-
width: 10rem;
|
|
112
|
-
background-color: var(--spectrum-global-color-gray-100);
|
|
113
111
|
--selected-tab: var(--spectrum-global-color-gray-200);
|
|
114
112
|
}
|
|
115
113
|
|
|
116
|
-
.outer-tabs.vertical.wide {
|
|
117
|
-
width: 14rem;
|
|
118
|
-
}
|
|
119
|
-
|
|
120
114
|
.tabs {
|
|
121
115
|
flex: auto;
|
|
122
116
|
display: flex;
|
|
@@ -179,6 +173,7 @@
|
|
|
179
173
|
|
|
180
174
|
.tab.button.vertical {
|
|
181
175
|
width: 100%;
|
|
176
|
+
padding: 0.5rem 0.75rem;
|
|
182
177
|
}
|
|
183
178
|
|
|
184
179
|
.tab.button:active:not(.disabled):not(.list-section) {
|
|
@@ -188,7 +183,7 @@
|
|
|
188
183
|
}
|
|
189
184
|
|
|
190
185
|
.tab.button.selected {
|
|
191
|
-
color: var(--spectrum-global-color-gray-
|
|
186
|
+
color: var(--spectrum-global-color-gray-700);
|
|
192
187
|
border: 1px solid var(--spectrum-global-color-gray-300);
|
|
193
188
|
background-color: rgb(
|
|
194
189
|
from var(--spectrum-global-color-gray-200) r g b / 0.85
|