@undevy-org/tablewright 0.7.6 → 0.7.7
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.
|
@@ -20,8 +20,10 @@ function patchFieldState(prev, fieldId, value) {
|
|
|
20
20
|
function mergeCompoundSubDraft(compound, subKey, next) {
|
|
21
21
|
const rest = { ...compound };
|
|
22
22
|
delete rest[subKey];
|
|
23
|
-
|
|
24
|
-
|
|
23
|
+
if (isFilterValueEmpty(next)) {
|
|
24
|
+
return Object.keys(rest).length === 0 ? void 0 : rest;
|
|
25
|
+
}
|
|
26
|
+
return { ...rest, [subKey]: next };
|
|
25
27
|
}
|
|
26
28
|
function formatTextMultiSummary(values, labels) {
|
|
27
29
|
if (values.length === 2) {
|
|
@@ -50,15 +52,10 @@ function mergeCompoundValueForApply(config, fieldId, committed, draft, touched,
|
|
|
50
52
|
if (hiddenSubSet.has(compoundSubTouchKey(fieldId, sub.key))) continue;
|
|
51
53
|
const touchKey = compoundSubTouchKey(fieldId, sub.key);
|
|
52
54
|
const subCommitted = committedCompound[sub.key];
|
|
53
|
-
const subDraft = draftCompound[sub.key];
|
|
54
55
|
if (shouldPreserveMultiSubOnApply(sub, subCommitted, touchKey, touched)) {
|
|
55
|
-
|
|
56
|
-
merged[sub.key] = subCommitted;
|
|
57
|
-
}
|
|
56
|
+
merged[sub.key] = subCommitted;
|
|
58
57
|
continue;
|
|
59
58
|
}
|
|
60
|
-
if (subDraft === void 0 || isFilterValueEmpty(subDraft)) continue;
|
|
61
|
-
merged[sub.key] = subDraft;
|
|
62
59
|
}
|
|
63
60
|
for (const key of Object.keys(merged)) {
|
|
64
61
|
const value = merged[key];
|
|
@@ -75,14 +72,14 @@ function resolveFieldApplyChange(config, fieldId, committed, draft, touched, hid
|
|
|
75
72
|
if (isMultiStringFilterValue(committed) && !touched.has(fieldId)) {
|
|
76
73
|
return { kind: "skip" };
|
|
77
74
|
}
|
|
78
|
-
if (
|
|
75
|
+
if (isFilterValueEmpty(draft)) {
|
|
79
76
|
return isActive ? { kind: "remove" } : { kind: "skip" };
|
|
80
77
|
}
|
|
81
78
|
return { kind: "set", value: draft };
|
|
82
79
|
}
|
|
83
80
|
case "date":
|
|
84
81
|
case "number-range": {
|
|
85
|
-
if (
|
|
82
|
+
if (isFilterValueEmpty(draft)) {
|
|
86
83
|
return isActive ? { kind: "remove" } : { kind: "skip" };
|
|
87
84
|
}
|
|
88
85
|
return { kind: "set", value: draft };
|
|
@@ -96,7 +93,7 @@ function resolveFieldApplyChange(config, fieldId, committed, draft, touched, hid
|
|
|
96
93
|
touched,
|
|
97
94
|
hiddenSubSet
|
|
98
95
|
);
|
|
99
|
-
if (
|
|
96
|
+
if (isFilterValueEmpty(merged)) {
|
|
100
97
|
return isActive ? { kind: "remove" } : { kind: "skip" };
|
|
101
98
|
}
|
|
102
99
|
return { kind: "set", value: merged };
|
package/dist/tablewright.cjs
CHANGED
|
@@ -4058,8 +4058,10 @@ function patchFieldState(prev, fieldId, value) {
|
|
|
4058
4058
|
function mergeCompoundSubDraft(compound, subKey, next) {
|
|
4059
4059
|
const rest = { ...compound };
|
|
4060
4060
|
delete rest[subKey];
|
|
4061
|
-
|
|
4062
|
-
|
|
4061
|
+
if (isFilterValueEmpty(next)) {
|
|
4062
|
+
return Object.keys(rest).length === 0 ? void 0 : rest;
|
|
4063
|
+
}
|
|
4064
|
+
return { ...rest, [subKey]: next };
|
|
4063
4065
|
}
|
|
4064
4066
|
function formatTextMultiSummary(values, labels) {
|
|
4065
4067
|
if (values.length === 2) {
|
|
@@ -4088,15 +4090,10 @@ function mergeCompoundValueForApply(config, fieldId, committed, draft, touched,
|
|
|
4088
4090
|
if (hiddenSubSet.has(compoundSubTouchKey(fieldId, sub.key))) continue;
|
|
4089
4091
|
const touchKey = compoundSubTouchKey(fieldId, sub.key);
|
|
4090
4092
|
const subCommitted = committedCompound[sub.key];
|
|
4091
|
-
const subDraft = draftCompound[sub.key];
|
|
4092
4093
|
if (shouldPreserveMultiSubOnApply(sub, subCommitted, touchKey, touched)) {
|
|
4093
|
-
|
|
4094
|
-
merged[sub.key] = subCommitted;
|
|
4095
|
-
}
|
|
4094
|
+
merged[sub.key] = subCommitted;
|
|
4096
4095
|
continue;
|
|
4097
4096
|
}
|
|
4098
|
-
if (subDraft === void 0 || isFilterValueEmpty(subDraft)) continue;
|
|
4099
|
-
merged[sub.key] = subDraft;
|
|
4100
4097
|
}
|
|
4101
4098
|
for (const key of Object.keys(merged)) {
|
|
4102
4099
|
const value = merged[key];
|
|
@@ -4113,14 +4110,14 @@ function resolveFieldApplyChange(config, fieldId, committed, draft, touched, hid
|
|
|
4113
4110
|
if (isMultiStringFilterValue(committed) && !touched.has(fieldId)) {
|
|
4114
4111
|
return { kind: "skip" };
|
|
4115
4112
|
}
|
|
4116
|
-
if (
|
|
4113
|
+
if (isFilterValueEmpty(draft)) {
|
|
4117
4114
|
return isActive ? { kind: "remove" } : { kind: "skip" };
|
|
4118
4115
|
}
|
|
4119
4116
|
return { kind: "set", value: draft };
|
|
4120
4117
|
}
|
|
4121
4118
|
case "date":
|
|
4122
4119
|
case "number-range": {
|
|
4123
|
-
if (
|
|
4120
|
+
if (isFilterValueEmpty(draft)) {
|
|
4124
4121
|
return isActive ? { kind: "remove" } : { kind: "skip" };
|
|
4125
4122
|
}
|
|
4126
4123
|
return { kind: "set", value: draft };
|
|
@@ -4134,7 +4131,7 @@ function resolveFieldApplyChange(config, fieldId, committed, draft, touched, hid
|
|
|
4134
4131
|
touched,
|
|
4135
4132
|
hiddenSubSet
|
|
4136
4133
|
);
|
|
4137
|
-
if (
|
|
4134
|
+
if (isFilterValueEmpty(merged)) {
|
|
4138
4135
|
return isActive ? { kind: "remove" } : { kind: "skip" };
|
|
4139
4136
|
}
|
|
4140
4137
|
return { kind: "set", value: merged };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@undevy-org/tablewright",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.7",
|
|
4
4
|
"description": "React data-table and application-shell components: filters, drawers, row controls, sortable and resizable columns, built on Radix UI and TanStack Table.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|