@poirazis/supercomponents-shared 1.0.26 → 1.0.28
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 +19311 -18109
- package/dist/index.umd.cjs +12 -12
- package/dist/style.css +1 -1
- package/package.json +1 -1
- package/src/lib/SuperButton/SuperButton.svelte +20 -5
- package/src/lib/SuperField/SuperField.svelte +10 -1
- package/src/lib/SuperTable/SuperTable.css +14 -10
- package/src/lib/SuperTable/SuperTable.svelte +39 -30
- package/src/lib/SuperTable/controls/ColumnsSection.svelte +1 -1
- package/src/lib/SuperTable/controls/RowButtonsColumn.svelte +16 -11
- package/src/lib/SuperTable/controls/SelectionColumn.svelte +85 -60
- package/src/lib/SuperTable/overlays/ScrollbarsOverlay.svelte +1 -1
- package/src/lib/SuperTableCells/CellBoolean.svelte +36 -28
- package/src/lib/SuperTableCells/CellCommon.css +84 -19
- package/src/lib/SuperTableCells/CellDateRange.svelte +597 -0
- package/src/lib/SuperTableCells/CellDatetime.svelte +161 -8
- package/src/lib/SuperTableCells/CellLink.svelte +36 -14
- package/src/lib/SuperTableCells/CellLinkPickerSelect.svelte +9 -9
- package/src/lib/SuperTableCells/CellNumber.svelte +67 -40
- package/src/lib/SuperTableCells/CellOptions.svelte +12 -9
- package/src/lib/SuperTableCells/CellString.svelte +12 -8
- package/src/lib/SuperTableCells/index.js +1 -1
- package/src/lib/SuperTableColumn/SuperTableColumn.svelte +4 -0
- package/src/lib/SuperTableColumn/parts/SuperColumnRow.svelte +36 -23
- package/src/lib/SuperTree/SuperTree.svelte +2 -2
- package/src/lib/SuperTableCells/CellLinkPickerTable.svelte +0 -91
|
@@ -31,9 +31,10 @@
|
|
|
31
31
|
return state;
|
|
32
32
|
},
|
|
33
33
|
reset() {
|
|
34
|
-
console.log("reset", value);
|
|
35
34
|
localValue = value;
|
|
36
35
|
lastEdit = undefined;
|
|
36
|
+
originalValue = undefined;
|
|
37
|
+
isDirty = false;
|
|
37
38
|
return cellOptions?.initialState ?? "View";
|
|
38
39
|
},
|
|
39
40
|
},
|
|
@@ -52,6 +53,7 @@
|
|
|
52
53
|
},
|
|
53
54
|
_exit() {
|
|
54
55
|
originalValue = undefined;
|
|
56
|
+
lastEdit = undefined;
|
|
55
57
|
dispatch("exitedit");
|
|
56
58
|
dispatch("focusout");
|
|
57
59
|
},
|
|
@@ -93,18 +95,18 @@
|
|
|
93
95
|
|
|
94
96
|
$: inEdit = $cellState == "Editing";
|
|
95
97
|
$: isDirty = lastEdit && originalValue != localValue;
|
|
96
|
-
$: formattedValue =
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
: formattedValue;
|
|
98
|
+
$: formattedValue = cellOptions?.template
|
|
99
|
+
? processStringSync(cellOptions.template, {
|
|
100
|
+
value,
|
|
101
|
+
})
|
|
102
|
+
: value;
|
|
102
103
|
|
|
103
104
|
$: placeholder =
|
|
104
105
|
cellOptions.readonly || cellOptions.disabled
|
|
105
106
|
? ""
|
|
106
107
|
: cellOptions.placeholder || "";
|
|
107
108
|
|
|
109
|
+
$: cellState.reset(value);
|
|
108
110
|
const focus = (node) => {
|
|
109
111
|
node?.focus();
|
|
110
112
|
};
|
|
@@ -137,7 +139,9 @@
|
|
|
137
139
|
class:readonly={cellOptions.readonly}
|
|
138
140
|
class:error={cellOptions.error}
|
|
139
141
|
style:color={cellOptions.color}
|
|
140
|
-
style:background={cellOptions.
|
|
142
|
+
style:background={$cellState == "Editing" && cellOptions.role != "inline"
|
|
143
|
+
? "var(--spectrum-global-color-gray-50)"
|
|
144
|
+
: cellOptions.background}
|
|
141
145
|
style:font-weight={cellOptions.fontWeight}
|
|
142
146
|
>
|
|
143
147
|
{#if cellOptions.icon}
|
|
@@ -3,12 +3,12 @@ export { default as CellAttachment } from "./CellAttachment.svelte";
|
|
|
3
3
|
export { default as CellBoolean } from "./CellBoolean.svelte";
|
|
4
4
|
export { default as CellColor } from "./CellColor.svelte";
|
|
5
5
|
export { default as CellDatetime } from "./CellDatetime.svelte";
|
|
6
|
+
export { default as CellDateRange } from "./CellDateRange.svelte";
|
|
6
7
|
export { default as CellIcon } from "./CellIcon.svelte";
|
|
7
8
|
export { default as CellJSON } from "./CellJSON.svelte";
|
|
8
9
|
export { default as CellLink } from "./CellLink.svelte";
|
|
9
10
|
export { default as CellLinkAdvanced } from "./CellLinkAdvanced.svelte";
|
|
10
11
|
export { default as CellLinkPickerSelect } from "./CellLinkPickerSelect.svelte";
|
|
11
|
-
export { default as CellLinkPickerTable } from "./CellLinkPickerTable.svelte";
|
|
12
12
|
export { default as CellLinkPickerTree } from "./CellLinkPickerTree.svelte";
|
|
13
13
|
export { default as CellNumber } from "./CellNumber.svelte";
|
|
14
14
|
export { default as CellOptions } from "./CellOptions.svelte";
|
|
@@ -19,6 +19,7 @@
|
|
|
19
19
|
import CellAttachment from "../SuperTableCells/CellAttachment.svelte";
|
|
20
20
|
|
|
21
21
|
import CellStringSimple from "../SuperTableCells/CellStringSimple.svelte";
|
|
22
|
+
import CellLinkAdvanced from "../SuperTableCells/CellLinkAdvanced.svelte";
|
|
22
23
|
|
|
23
24
|
const stbData = getContext("stbData");
|
|
24
25
|
const stbSettings = getContext("stbSettings");
|
|
@@ -136,6 +137,9 @@
|
|
|
136
137
|
optionsViewMode: $columnOptionsStore.optionsViewMode,
|
|
137
138
|
relViewMode: $columnOptionsStore.relViewMode,
|
|
138
139
|
padding: $columnOptionsStore.isFirst ? "1rem" : "0.5rem",
|
|
140
|
+
background: $columnOptionsStore.background,
|
|
141
|
+
color: $columnOptionsStore.color,
|
|
142
|
+
controlType: "checkbox",
|
|
139
143
|
};
|
|
140
144
|
}
|
|
141
145
|
);
|
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
getContext,
|
|
4
4
|
createEventDispatcher,
|
|
5
5
|
onMount,
|
|
6
|
-
tick,
|
|
7
6
|
onDestroy,
|
|
8
7
|
} from "svelte";
|
|
9
8
|
|
|
@@ -33,6 +32,7 @@
|
|
|
33
32
|
export let rowHeight;
|
|
34
33
|
let mounted;
|
|
35
34
|
let viewport;
|
|
35
|
+
let info;
|
|
36
36
|
|
|
37
37
|
$: meta = $rowMetadata?.[index] ?? {};
|
|
38
38
|
$: id = row?.[idField] ?? index;
|
|
@@ -46,31 +46,23 @@
|
|
|
46
46
|
...row,
|
|
47
47
|
[field]: change,
|
|
48
48
|
};
|
|
49
|
+
|
|
49
50
|
try {
|
|
51
|
+
value = "";
|
|
50
52
|
let patched_row = await stbAPI.patchRow(patch);
|
|
51
|
-
row = patched_row;
|
|
53
|
+
row = { ...patched_row };
|
|
52
54
|
} catch (ex) {
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
55
|
+
if (ex.json.validationErrors) {
|
|
56
|
+
info = ex.json.validationErrors[field][0];
|
|
57
|
+
} else {
|
|
58
|
+
info = ex.message;
|
|
59
|
+
}
|
|
57
60
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
viewport &&
|
|
64
|
-
viewport.scrollHeight > meta.height
|
|
65
|
-
) {
|
|
66
|
-
dispatch("resize", viewport.scrollHeight);
|
|
67
|
-
} else if (
|
|
68
|
-
$columnSettings.superColumn &&
|
|
69
|
-
viewport &&
|
|
70
|
-
!hasChildren &&
|
|
71
|
-
viewport.scrollHeight > rowHeight
|
|
72
|
-
)
|
|
73
|
-
dispatch("resize", rowHeight);
|
|
61
|
+
setTimeout(() => {
|
|
62
|
+
info = undefined;
|
|
63
|
+
}, 2250);
|
|
64
|
+
} finally {
|
|
65
|
+
value = deepGet(row, field);
|
|
74
66
|
}
|
|
75
67
|
};
|
|
76
68
|
|
|
@@ -106,6 +98,7 @@
|
|
|
106
98
|
class:is-selected={isSelected}
|
|
107
99
|
class:is-hovered={isHovered}
|
|
108
100
|
class:is-editing={isEditing}
|
|
101
|
+
class:is-disabled={meta.disabled}
|
|
109
102
|
class:isLast
|
|
110
103
|
style:height={meta.height + "px"}
|
|
111
104
|
style:color={meta.color}
|
|
@@ -123,8 +116,9 @@
|
|
|
123
116
|
{#if !hasChildren}
|
|
124
117
|
<svelte:component
|
|
125
118
|
this={$columnSettings.cellComponent}
|
|
126
|
-
cellOptions={{ ...$rowCellOptions, disabled }}
|
|
119
|
+
cellOptions={{ ...$rowCellOptions, disabled, error: info }}
|
|
127
120
|
fieldSchema={$columnSettings.schema}
|
|
121
|
+
ownId={row[idField]}
|
|
128
122
|
{value}
|
|
129
123
|
on:enteredit={() => columnState.enteredit(index)}
|
|
130
124
|
on:exitedit={columnState.exitedit}
|
|
@@ -133,6 +127,9 @@
|
|
|
133
127
|
stbAPI.executeOnLinkClickAction(field, e.detail);
|
|
134
128
|
}}
|
|
135
129
|
/>
|
|
130
|
+
{#if info}
|
|
131
|
+
<div class="info" class:bottom={index == 0}>{info}</div>
|
|
132
|
+
{/if}
|
|
136
133
|
{:else}
|
|
137
134
|
<Provider
|
|
138
135
|
data={{
|
|
@@ -147,3 +144,19 @@
|
|
|
147
144
|
</Provider>
|
|
148
145
|
{/if}
|
|
149
146
|
</div>
|
|
147
|
+
|
|
148
|
+
<style>
|
|
149
|
+
.info {
|
|
150
|
+
position: absolute;
|
|
151
|
+
top: -26px;
|
|
152
|
+
font-size: 11px;
|
|
153
|
+
background-color: var(--spectrum-global-color-red-400);
|
|
154
|
+
border-radius: 4px;
|
|
155
|
+
padding: 4px;
|
|
156
|
+
|
|
157
|
+
&.bottom {
|
|
158
|
+
top: unset;
|
|
159
|
+
bottom: -26px;
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
</style>
|
|
@@ -57,13 +57,13 @@
|
|
|
57
57
|
class:open
|
|
58
58
|
style:z-index={1}
|
|
59
59
|
style:font-size={"16px"}
|
|
60
|
-
on:mousedown|self|preventDefault={toggleOpen}
|
|
60
|
+
on:mousedown|self|preventDefault|stopPropagation={toggleOpen}
|
|
61
61
|
/>
|
|
62
62
|
{/if}
|
|
63
63
|
<div
|
|
64
64
|
style:z-index={2}
|
|
65
65
|
style:width={"100%"}
|
|
66
|
-
on:mousedown|preventDefault={toggleNode}
|
|
66
|
+
on:mousedown|preventDefault|stopPropagation={toggleNode}
|
|
67
67
|
>
|
|
68
68
|
<span class="spectrum-TreeView-itemLabel" style:padding-left={"0.25rem"}
|
|
69
69
|
>{tree.label || "Not Set"}</span
|
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
<script>
|
|
2
|
-
import { createEventDispatcher, getContext } from "svelte";
|
|
3
|
-
|
|
4
|
-
const dispatch = createEventDispatcher();
|
|
5
|
-
|
|
6
|
-
const { fetchData, API } = getContext("sdk");
|
|
7
|
-
|
|
8
|
-
export let value = [];
|
|
9
|
-
export let datasource;
|
|
10
|
-
export let sortColumn;
|
|
11
|
-
export let sortOrder;
|
|
12
|
-
export let filter;
|
|
13
|
-
export let searchTerm;
|
|
14
|
-
export let pickerColumns;
|
|
15
|
-
export let searchColumns = [];
|
|
16
|
-
export let multi;
|
|
17
|
-
|
|
18
|
-
export let picker;
|
|
19
|
-
|
|
20
|
-
$: fetch = fetchData({
|
|
21
|
-
API,
|
|
22
|
-
datasource,
|
|
23
|
-
options: {
|
|
24
|
-
paginate: false,
|
|
25
|
-
limit: 1,
|
|
26
|
-
},
|
|
27
|
-
});
|
|
28
|
-
|
|
29
|
-
$: primaryDisplay = $fetch?.definition?.primaryDisplay || "_id";
|
|
30
|
-
|
|
31
|
-
$: tableOptions = {
|
|
32
|
-
idColumn: "_id",
|
|
33
|
-
superColumnsPos: "first",
|
|
34
|
-
columnSizing: "flexible",
|
|
35
|
-
columnMaxWidth: "auto",
|
|
36
|
-
debounce: 500,
|
|
37
|
-
visibleRowCount: 7,
|
|
38
|
-
rowSelectMode: multi ? "multi" : "single",
|
|
39
|
-
selectionColumn: false,
|
|
40
|
-
dividers: "horizontal",
|
|
41
|
-
dividersColor: null,
|
|
42
|
-
baseFontSize: 12,
|
|
43
|
-
rowHeight: 32,
|
|
44
|
-
showFooter: false,
|
|
45
|
-
showHeader: true,
|
|
46
|
-
canFilter: true,
|
|
47
|
-
canSort: true,
|
|
48
|
-
canEdit: false,
|
|
49
|
-
canDelete: false,
|
|
50
|
-
canInsert: false,
|
|
51
|
-
canResize: false,
|
|
52
|
-
datasource,
|
|
53
|
-
filter: {},
|
|
54
|
-
sortColumn: null,
|
|
55
|
-
sortOrder: null,
|
|
56
|
-
limit: 10,
|
|
57
|
-
paginate: false,
|
|
58
|
-
autoRefresh: false,
|
|
59
|
-
autoRefreshRate: 10,
|
|
60
|
-
columnList: pickerColumns,
|
|
61
|
-
size: "S",
|
|
62
|
-
cellPadding: "0.5rem",
|
|
63
|
-
useOptionColors: true,
|
|
64
|
-
optionsViewMode: "text",
|
|
65
|
-
relViewMode: "text",
|
|
66
|
-
onRowSelect: (arr) => {
|
|
67
|
-
var val = arr.selectedRows.map((x) => {
|
|
68
|
-
return { _id: x["_id"], primaryDisplay: x[primaryDisplay] };
|
|
69
|
-
});
|
|
70
|
-
dispatch("change", val);
|
|
71
|
-
},
|
|
72
|
-
};
|
|
73
|
-
|
|
74
|
-
// <SuperTable on:change {...tableOptions}></SuperTable>
|
|
75
|
-
</script>
|
|
76
|
-
|
|
77
|
-
<!-- svelte-ignore a11y-no-static-element-interactions -->
|
|
78
|
-
<!-- svelte-ignore a11y-click-events-have-key-events -->
|
|
79
|
-
<div bind:this={picker} class="control"></div>
|
|
80
|
-
|
|
81
|
-
<style>
|
|
82
|
-
.control {
|
|
83
|
-
flex: auto;
|
|
84
|
-
flex-direction: column;
|
|
85
|
-
display: flex;
|
|
86
|
-
align-items: stretch;
|
|
87
|
-
justify-content: stretch;
|
|
88
|
-
overflow-x: hidden;
|
|
89
|
-
padding: 0.25rem;
|
|
90
|
-
}
|
|
91
|
-
</style>
|