@poirazis/supercomponents-shared 1.2.11 → 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 +11081 -10997
- package/dist/index.umd.cjs +13 -13
- package/package.json +1 -1
- package/src/lib/SuperField/SuperField.svelte +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/CellAttachmentExpanded.svelte +0 -1
- package/src/lib/SuperTableCells/CellAttachmentSlider.svelte +0 -1
- package/src/lib/SuperTableCells/CellBoolean.svelte +0 -1
- package/src/lib/SuperTableCells/CellCommon.css +60 -88
- package/src/lib/SuperTableCells/CellDateRange.svelte +6 -32
- package/src/lib/SuperTableCells/CellDatetime.svelte +3 -4
- package/src/lib/SuperTableCells/CellJSON.svelte +1 -4
- package/src/lib/SuperTableCells/CellLink.svelte +22 -21
- 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 +39 -37
- package/src/lib/SuperTableCells/CellSQLLink.svelte +85 -66
- package/src/lib/SuperTableCells/CellSQLLinkPicker.svelte +66 -36
- package/src/lib/SuperTableCells/CellString.svelte +9 -25
- package/src/lib/SuperTableCells/CellStringMask.svelte +119 -26
- 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 +28 -23
- package/src/lib/SuperTable/controls/SuperTableWelcome.svelte +0 -58
|
@@ -23,6 +23,8 @@
|
|
|
23
23
|
let popup;
|
|
24
24
|
let search;
|
|
25
25
|
let pickerApi;
|
|
26
|
+
let isLoading = false;
|
|
27
|
+
let localValue;
|
|
26
28
|
|
|
27
29
|
const editorState = fsm("Closed", {
|
|
28
30
|
Open: {
|
|
@@ -54,7 +56,10 @@
|
|
|
54
56
|
},
|
|
55
57
|
View: {
|
|
56
58
|
_enter() {},
|
|
57
|
-
|
|
59
|
+
toggle() {
|
|
60
|
+
return;
|
|
61
|
+
},
|
|
62
|
+
focus(e) {
|
|
58
63
|
if (!cellOptions.readonly && !cellOptions.disabled) return "Editing";
|
|
59
64
|
},
|
|
60
65
|
},
|
|
@@ -68,11 +73,18 @@
|
|
|
68
73
|
editorState.close();
|
|
69
74
|
dispatch("exitedit");
|
|
70
75
|
},
|
|
76
|
+
toggle(e) {
|
|
77
|
+
editorState.toggle();
|
|
78
|
+
},
|
|
71
79
|
focusout(e) {
|
|
72
80
|
if (popup?.contains(e?.relatedTarget)) return;
|
|
73
81
|
this.submit();
|
|
74
82
|
},
|
|
75
|
-
|
|
83
|
+
popupfocusout(e) {
|
|
84
|
+
if (anchor != e?.relatedTarget) {
|
|
85
|
+
this.submit();
|
|
86
|
+
}
|
|
87
|
+
},
|
|
76
88
|
clear() {
|
|
77
89
|
localValue = [];
|
|
78
90
|
},
|
|
@@ -82,6 +94,8 @@
|
|
|
82
94
|
return "View";
|
|
83
95
|
},
|
|
84
96
|
cancel() {
|
|
97
|
+
anchor.blur();
|
|
98
|
+
localValue = JSON.parse(originalValue);
|
|
85
99
|
return "View";
|
|
86
100
|
},
|
|
87
101
|
},
|
|
@@ -94,7 +108,9 @@
|
|
|
94
108
|
$: pills = cellOptions.relViewMode == "pills";
|
|
95
109
|
$: ownId = ownId || cellOptions?.ownId;
|
|
96
110
|
|
|
97
|
-
$:
|
|
111
|
+
$: if (!isLoading) {
|
|
112
|
+
localValue = enrichValue(value);
|
|
113
|
+
}
|
|
98
114
|
|
|
99
115
|
$: inEdit = $cellState == "Editing";
|
|
100
116
|
$: isDirty = inEdit && originalValue != JSON.stringify(localValue);
|
|
@@ -116,17 +132,7 @@
|
|
|
116
132
|
} else if (e.key == "Tab" && $editorState == "Open") {
|
|
117
133
|
cellState.focusout(e);
|
|
118
134
|
} else if ($editorState == "Open") {
|
|
119
|
-
|
|
120
|
-
e.preventDefault();
|
|
121
|
-
pickerApi?.focusPrev();
|
|
122
|
-
pickerApi?.scrollIntoView();
|
|
123
|
-
} else if (e.key === "ArrowDown") {
|
|
124
|
-
e.preventDefault();
|
|
125
|
-
pickerApi?.focusNext();
|
|
126
|
-
pickerApi?.scrollIntoView();
|
|
127
|
-
} else if (e.key.length == 1 && e.key.match(/\S/)) {
|
|
128
|
-
pickerApi?.setSearch(e.key);
|
|
129
|
-
}
|
|
135
|
+
pickerApi?.focus();
|
|
130
136
|
}
|
|
131
137
|
};
|
|
132
138
|
|
|
@@ -135,6 +141,7 @@
|
|
|
135
141
|
|
|
136
142
|
if (!multi) {
|
|
137
143
|
editorState.close();
|
|
144
|
+
anchor.focus();
|
|
138
145
|
}
|
|
139
146
|
};
|
|
140
147
|
|
|
@@ -146,25 +153,30 @@
|
|
|
146
153
|
: [];
|
|
147
154
|
const missingIds = x.filter((id) => !existingIds.includes(id));
|
|
148
155
|
if (missingIds.length > 0) {
|
|
156
|
+
isLoading = true;
|
|
149
157
|
API.fetchTableDefinition(relatedTableId).then((def) => {
|
|
150
158
|
fieldSchema.primaryDisplay = def.primaryDisplay;
|
|
151
159
|
});
|
|
152
160
|
|
|
153
161
|
Promise.all(
|
|
154
|
-
missingIds.map((id) => API.fetchRow(relatedTableId, id, true))
|
|
162
|
+
missingIds.map((id) => API.fetchRow(relatedTableId, id, true)),
|
|
155
163
|
)
|
|
156
164
|
.then((rows) => {
|
|
157
165
|
const newEnriched = rows.map((row) => ({
|
|
158
|
-
|
|
166
|
+
...row,
|
|
159
167
|
primaryDisplay: fieldSchema.primaryDisplay
|
|
160
168
|
? row[fieldSchema.primaryDisplay]
|
|
161
169
|
: row.name || row.id,
|
|
162
170
|
}));
|
|
163
171
|
// Append new enriched items to existing localValue
|
|
164
172
|
localValue = [...(localValue || []), ...newEnriched];
|
|
173
|
+
// Dispatch enrich event with full row context
|
|
174
|
+
dispatch("enrich", { rows: newEnriched });
|
|
175
|
+
isLoading = false;
|
|
165
176
|
})
|
|
166
177
|
.catch((e) => {
|
|
167
178
|
// On error, keep existing localValue
|
|
179
|
+
isLoading = false;
|
|
168
180
|
});
|
|
169
181
|
}
|
|
170
182
|
return localValue || [];
|
|
@@ -173,23 +185,27 @@
|
|
|
173
185
|
const existing =
|
|
174
186
|
localValue && localValue.find((v) => v[relatedField] === x);
|
|
175
187
|
if (!existing) {
|
|
188
|
+
isLoading = true;
|
|
176
189
|
API.fetchTableDefinition(relatedTableId).then((def) => {
|
|
177
190
|
fieldSchema.primaryDisplay = def.primaryDisplay;
|
|
178
191
|
});
|
|
179
192
|
|
|
180
193
|
API.fetchRow(relatedTableId, x, true)
|
|
181
194
|
.then((row) => {
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
195
|
+
const enrichedRow = {
|
|
196
|
+
...row,
|
|
197
|
+
primaryDisplay: fieldSchema.primaryDisplay
|
|
198
|
+
? row[fieldSchema.primaryDisplay]
|
|
199
|
+
: row.name || row.id,
|
|
200
|
+
};
|
|
201
|
+
localValue = [enrichedRow];
|
|
202
|
+
// Dispatch enrich event with full row context
|
|
203
|
+
dispatch("enrich", { rows: [enrichedRow] });
|
|
204
|
+
isLoading = false;
|
|
190
205
|
})
|
|
191
206
|
.catch((e) => {
|
|
192
207
|
localValue = [];
|
|
208
|
+
isLoading = false;
|
|
193
209
|
});
|
|
194
210
|
}
|
|
195
211
|
return localValue || [];
|
|
@@ -205,7 +221,7 @@
|
|
|
205
221
|
<!-- svelte-ignore a11y-no-noninteractive-tabindex -->
|
|
206
222
|
<!-- svelte-ignore a11y-no-static-element-interactions -->
|
|
207
223
|
<div
|
|
208
|
-
class="superCell"
|
|
224
|
+
class="superCell has-popup"
|
|
209
225
|
tabindex={cellOptions?.disabled ? -1 : 0}
|
|
210
226
|
bind:this={anchor}
|
|
211
227
|
class:isDirty={isDirty && cellOptions.showDirty}
|
|
@@ -215,64 +231,66 @@
|
|
|
215
231
|
class:formInput={cellOptions.role == "formInput"}
|
|
216
232
|
class:disabled={cellOptions.disabled}
|
|
217
233
|
class:readonly
|
|
234
|
+
class:open-popup={$editorState == "Open"}
|
|
218
235
|
class:error={cellOptions.error}
|
|
219
236
|
style:color={cellOptions.color}
|
|
220
237
|
style:background={cellOptions.background}
|
|
221
|
-
style:font-weight={cellOptions.fontWeight}
|
|
222
238
|
on:focusin={cellState.focus}
|
|
223
239
|
on:keydown|self={handleKeyboard}
|
|
240
|
+
on:mousedown={cellState.toggle}
|
|
224
241
|
on:focusout={cellState.focusout}
|
|
225
242
|
>
|
|
226
|
-
{#if
|
|
227
|
-
|
|
228
|
-
|
|
243
|
+
{#if !isLoading}
|
|
244
|
+
{#if cellOptions?.icon}
|
|
245
|
+
<i class={cellOptions.icon + " field-icon"}></i>
|
|
246
|
+
{/if}
|
|
229
247
|
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
248
|
+
<div class="value" class:placeholder={localValue?.length < 1}>
|
|
249
|
+
{#if localValue?.length < 1}
|
|
250
|
+
<span> {placeholder} </span>
|
|
251
|
+
{:else if pills}
|
|
252
|
+
<div
|
|
253
|
+
class="items"
|
|
254
|
+
class:pills
|
|
255
|
+
class:withCount={localValue.length > 5}
|
|
256
|
+
class:inEdit
|
|
257
|
+
>
|
|
258
|
+
{#each localValue as val, idx}
|
|
259
|
+
{#if idx < 5}
|
|
260
|
+
<div class="item">
|
|
261
|
+
<span>{val.primaryDisplay}</span>
|
|
262
|
+
</div>
|
|
263
|
+
{/if}
|
|
264
|
+
{/each}
|
|
265
|
+
{#if localValue.length > 5}
|
|
266
|
+
<span class="count">
|
|
267
|
+
(+ {localValue.length - 5})
|
|
268
|
+
</span>
|
|
245
269
|
{/if}
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
{localValue.map((v) => v.primaryDisplay).join(", ")}
|
|
259
|
-
</span>
|
|
270
|
+
</div>
|
|
271
|
+
{:else}
|
|
272
|
+
<span>
|
|
273
|
+
{#if cellOptions.role == "formInput" && localValue.length > 1}
|
|
274
|
+
({localValue.length})
|
|
275
|
+
{/if}
|
|
276
|
+
{localValue.map((v) => v.primaryDisplay).join(", ")}
|
|
277
|
+
</span>
|
|
278
|
+
{/if}
|
|
279
|
+
</div>
|
|
280
|
+
{#if !readonly && (cellOptions.role == "formInput" || inEdit)}
|
|
281
|
+
<i class="ph ph-caret-down control-icon"></i>
|
|
260
282
|
{/if}
|
|
261
|
-
</div>
|
|
262
|
-
{#if !readonly && (cellOptions.role == "formInput" || inEdit)}
|
|
263
|
-
<i class="ph ph-caret-down control-icon" on:click={editorState.toggle}></i>
|
|
264
283
|
{/if}
|
|
265
284
|
</div>
|
|
266
285
|
|
|
267
286
|
{#if inEdit}
|
|
268
287
|
<SuperPopover
|
|
269
288
|
{anchor}
|
|
270
|
-
useAnchorWidth
|
|
289
|
+
useAnchorWidth={true}
|
|
290
|
+
minWidth={cellOptions.pickerWidth || undefined}
|
|
291
|
+
align="left"
|
|
271
292
|
open={$editorState == "Open"}
|
|
272
|
-
|
|
273
|
-
console.log("closing editor");
|
|
274
|
-
editorState.close();
|
|
275
|
-
}}
|
|
293
|
+
bind:popup
|
|
276
294
|
>
|
|
277
295
|
{#if fieldSchema.recursiveTable}
|
|
278
296
|
<CellLinkPickerTree
|
|
@@ -294,6 +312,7 @@
|
|
|
294
312
|
value={localValue}
|
|
295
313
|
bind:api={pickerApi}
|
|
296
314
|
on:change={handleChange}
|
|
315
|
+
on:focusout={cellState.popupfocusout}
|
|
297
316
|
/>
|
|
298
317
|
{/if}
|
|
299
318
|
</SuperPopover>
|
|
@@ -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
|
|