@dragonmastery/zinia-forms-core 0.5.2 → 0.5.3
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 +40 -16
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -7839,6 +7839,9 @@ function useDataTable(schema, options) {
|
|
|
7839
7839
|
delete currentFilters[fieldName];
|
|
7840
7840
|
tableState.setFilters(currentFilters);
|
|
7841
7841
|
tableState.setPagination(0);
|
|
7842
|
+
delete filterInputValues.value[fieldName];
|
|
7843
|
+
delete filterInputValues.value[`${fieldName}_start`];
|
|
7844
|
+
delete filterInputValues.value[`${fieldName}_end`];
|
|
7842
7845
|
await fetchData();
|
|
7843
7846
|
return;
|
|
7844
7847
|
}
|
|
@@ -9039,13 +9042,20 @@ function debounce(key, callback, delay = 300) {
|
|
|
9039
9042
|
}, delay);
|
|
9040
9043
|
timeoutStore.set(key, timeoutId);
|
|
9041
9044
|
}
|
|
9045
|
+
function clearDebounce(key) {
|
|
9046
|
+
const existing = timeoutStore.get(key);
|
|
9047
|
+
if (existing) {
|
|
9048
|
+
clearTimeout(existing);
|
|
9049
|
+
timeoutStore.delete(key);
|
|
9050
|
+
}
|
|
9051
|
+
}
|
|
9042
9052
|
var TextFilter = (props) => {
|
|
9043
9053
|
const currentOperator = props.filterOperators.value[props.field] || OPERATORS.CONTAINS;
|
|
9044
9054
|
const isArrayOperator = currentOperator === OPERATORS.IS_ONE_OF || currentOperator === OPERATORS.IS_NOT_ONE_OF;
|
|
9045
9055
|
const isDefaultOperator = currentOperator === OPERATORS.CONTAINS;
|
|
9046
9056
|
const showOperatorSelect = !isDefaultOperator;
|
|
9047
9057
|
const filterInputValue = props.filterInputValues.value[props.field];
|
|
9048
|
-
const displayValue = filterInputValue !== void 0
|
|
9058
|
+
const displayValue = filterInputValue !== void 0 ? filterInputValue : props.value || "";
|
|
9049
9059
|
const handleFilterChange = (value, operator = currentOperator) => {
|
|
9050
9060
|
const filter = {
|
|
9051
9061
|
operator,
|
|
@@ -9098,13 +9108,18 @@ var TextFilter = (props) => {
|
|
|
9098
9108
|
onInput: (e) => {
|
|
9099
9109
|
const value = e.target.value;
|
|
9100
9110
|
props.filterInputValues.value[props.field] = value;
|
|
9101
|
-
|
|
9102
|
-
`filter_${props.field}
|
|
9103
|
-
()
|
|
9104
|
-
|
|
9105
|
-
|
|
9106
|
-
|
|
9107
|
-
|
|
9111
|
+
if (value === "") {
|
|
9112
|
+
clearDebounce(`filter_${props.field}`);
|
|
9113
|
+
handleFilterChange("");
|
|
9114
|
+
} else {
|
|
9115
|
+
debounce(
|
|
9116
|
+
`filter_${props.field}`,
|
|
9117
|
+
() => {
|
|
9118
|
+
handleFilterChange(value);
|
|
9119
|
+
},
|
|
9120
|
+
300
|
|
9121
|
+
);
|
|
9122
|
+
}
|
|
9108
9123
|
},
|
|
9109
9124
|
onKeydown: (e) => {
|
|
9110
9125
|
if (e.key === "Escape" && props.filterInputValues.value[props.field]) {
|
|
@@ -9129,7 +9144,7 @@ var NumberFilter = (props) => {
|
|
|
9129
9144
|
const currentOperator = props.filterOperators.value[props.field] || OPERATORS.EQUALS;
|
|
9130
9145
|
const isBetween = currentOperator === OPERATORS.BETWEEN;
|
|
9131
9146
|
const filterInputValue = props.filterInputValues.value[props.field];
|
|
9132
|
-
const displayValue = filterInputValue !== void 0
|
|
9147
|
+
const displayValue = filterInputValue !== void 0 ? filterInputValue : props.value !== void 0 && props.value !== null && props.value !== "" ? String(props.value) : "";
|
|
9133
9148
|
const handleFilterChange = (value, operator = currentOperator) => {
|
|
9134
9149
|
const filter = {
|
|
9135
9150
|
operator
|
|
@@ -9186,13 +9201,18 @@ var NumberFilter = (props) => {
|
|
|
9186
9201
|
onInput: (e) => {
|
|
9187
9202
|
const value = e.target.value;
|
|
9188
9203
|
props.filterInputValues.value[props.field] = value;
|
|
9189
|
-
|
|
9190
|
-
`filter_${props.field}
|
|
9191
|
-
()
|
|
9192
|
-
|
|
9193
|
-
|
|
9194
|
-
|
|
9195
|
-
|
|
9204
|
+
if (value === "") {
|
|
9205
|
+
clearDebounce(`filter_${props.field}`);
|
|
9206
|
+
handleFilterChange("");
|
|
9207
|
+
} else {
|
|
9208
|
+
debounce(
|
|
9209
|
+
`filter_${props.field}`,
|
|
9210
|
+
() => {
|
|
9211
|
+
handleFilterChange(value);
|
|
9212
|
+
},
|
|
9213
|
+
300
|
|
9214
|
+
);
|
|
9215
|
+
}
|
|
9196
9216
|
},
|
|
9197
9217
|
onKeydown: (e) => {
|
|
9198
9218
|
if (e.key === "Escape" && props.filterInputValues.value[props.field]) {
|
|
@@ -11590,6 +11610,10 @@ function useCursorDataTable(schema, options) {
|
|
|
11590
11610
|
delete currentFilters[fieldName];
|
|
11591
11611
|
tableState.setFilters(currentFilters);
|
|
11592
11612
|
tableState.setCursorNavigation(void 0);
|
|
11613
|
+
delete filterInputValues.value[fieldName];
|
|
11614
|
+
delete filterInputValues.value[`${fieldName}_start`];
|
|
11615
|
+
delete filterInputValues.value[`${fieldName}_end`];
|
|
11616
|
+
await fetchData();
|
|
11593
11617
|
return;
|
|
11594
11618
|
}
|
|
11595
11619
|
const validation = validateFilterValueObject(fieldName, filter, fieldRegistry);
|