@vuu-ui/vuu-filters 0.8.20-debug → 0.8.21-debug
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/cjs/index.js +26 -28
- package/cjs/index.js.map +3 -3
- package/esm/index.js +26 -28
- package/esm/index.js.map +2 -2
- package/index.css +38 -10
- package/index.css.map +2 -2
- package/package.json +10 -9
- package/types/filter-bar/useFilters.d.ts +1 -1
package/esm/index.js
CHANGED
|
@@ -905,7 +905,7 @@ import React4, {
|
|
|
905
905
|
} from "react";
|
|
906
906
|
|
|
907
907
|
// ../vuu-layout/src/overflow-container/useOverflowContainer.ts
|
|
908
|
-
import {
|
|
908
|
+
import { useDragDrop } from "@vuu-ui/vuu-ui-controls";
|
|
909
909
|
import {
|
|
910
910
|
isValidNumber,
|
|
911
911
|
MEASURES,
|
|
@@ -2565,21 +2565,13 @@ var TextInput = forwardRef6(function TextInput2({
|
|
|
2565
2565
|
const [typeaheadValues, setTypeaheadValues] = useState10([]);
|
|
2566
2566
|
const getSuggestions = suggestionProvider();
|
|
2567
2567
|
const handleSingleValueSelectionChange = useCallback17(
|
|
2568
|
-
(
|
|
2568
|
+
(_, value2) => onInputComplete(value2),
|
|
2569
2569
|
[onInputComplete]
|
|
2570
2570
|
);
|
|
2571
2571
|
const handleMultiValueSelectionChange = useCallback17(
|
|
2572
|
-
(
|
|
2573
|
-
if (value2.length === 1) {
|
|
2574
|
-
onInputComplete(value2[0]);
|
|
2575
|
-
} else if (value2.length > 1) {
|
|
2576
|
-
onInputComplete(value2);
|
|
2577
|
-
}
|
|
2578
|
-
},
|
|
2572
|
+
(_, values) => onInputComplete(values),
|
|
2579
2573
|
[onInputComplete]
|
|
2580
2574
|
);
|
|
2581
|
-
useEffect2(() => {
|
|
2582
|
-
}, [column]);
|
|
2583
2575
|
useEffect2(() => {
|
|
2584
2576
|
if (table) {
|
|
2585
2577
|
const params = valueInputValue ? [table, column.name, valueInputValue] : [table, column.name];
|
|
@@ -4231,7 +4223,7 @@ var KeySet = class {
|
|
|
4231
4223
|
}
|
|
4232
4224
|
next() {
|
|
4233
4225
|
if (this.free.length > 0) {
|
|
4234
|
-
return this.free.
|
|
4226
|
+
return this.free.shift();
|
|
4235
4227
|
} else {
|
|
4236
4228
|
return this.nextKeyValue++;
|
|
4237
4229
|
}
|
|
@@ -4269,7 +4261,7 @@ var KeySet = class {
|
|
|
4269
4261
|
return key;
|
|
4270
4262
|
}
|
|
4271
4263
|
toDebugString() {
|
|
4272
|
-
return Array.from(this.keys.entries()).map((k, v) => \`\${k}=>\${v}\`).join(",");
|
|
4264
|
+
return Array.from(this.keys.entries()).map(([k, v]) => \`\${k}=>\${v}\`).join(",");
|
|
4273
4265
|
}
|
|
4274
4266
|
};
|
|
4275
4267
|
|
|
@@ -10008,12 +10000,12 @@ var useFilters = ({
|
|
|
10008
10000
|
[filters, onFiltersChanged, saveFilterToSettings, setFilters]
|
|
10009
10001
|
);
|
|
10010
10002
|
const handleChangeFilter = useCallback31(
|
|
10011
|
-
(
|
|
10003
|
+
(oldFilter, newFilter) => {
|
|
10012
10004
|
let index = -1;
|
|
10013
10005
|
const newFilters = filters.map((f, i) => {
|
|
10014
|
-
if (f ===
|
|
10006
|
+
if (f === oldFilter) {
|
|
10015
10007
|
index = i;
|
|
10016
|
-
return
|
|
10008
|
+
return newFilter;
|
|
10017
10009
|
} else {
|
|
10018
10010
|
return f;
|
|
10019
10011
|
}
|
|
@@ -10218,21 +10210,27 @@ var useFilterBar = ({
|
|
|
10218
10210
|
},
|
|
10219
10211
|
[deleteFilter, editPillLabel, filters, focusFilterClause]
|
|
10220
10212
|
);
|
|
10213
|
+
const addIfNewElseUpdate = useCallback32(
|
|
10214
|
+
(edited, existing) => {
|
|
10215
|
+
if (existing === void 0) {
|
|
10216
|
+
const idx = onAddFilter(edited);
|
|
10217
|
+
editPillLabel(idx);
|
|
10218
|
+
return idx;
|
|
10219
|
+
} else {
|
|
10220
|
+
return onChangeFilter(existing, edited);
|
|
10221
|
+
}
|
|
10222
|
+
},
|
|
10223
|
+
[editPillLabel, onAddFilter, onChangeFilter]
|
|
10224
|
+
);
|
|
10221
10225
|
const handleMenuAction = useCallback32(
|
|
10222
10226
|
({ menuId }) => {
|
|
10223
10227
|
switch (menuId) {
|
|
10224
10228
|
case "apply-save": {
|
|
10225
|
-
const
|
|
10226
|
-
const
|
|
10227
|
-
|
|
10228
|
-
const indexOfNewFilter = changeHandler(newFilter);
|
|
10229
|
-
if (isNewFilter) {
|
|
10230
|
-
editPillLabel(indexOfNewFilter);
|
|
10231
|
-
}
|
|
10229
|
+
const editedFilter = editFilter;
|
|
10230
|
+
const idx = addIfNewElseUpdate(editedFilter, editingFilter.current);
|
|
10231
|
+
setActiveFilterIndex(appendIfNotPresent(idx));
|
|
10232
10232
|
setEditFilter(void 0);
|
|
10233
|
-
|
|
10234
|
-
(indices) => indices.includes(indexOfNewFilter) ? indices : indices.concat(indexOfNewFilter)
|
|
10235
|
-
);
|
|
10233
|
+
editingFilter.current = void 0;
|
|
10236
10234
|
setShowMenu(false);
|
|
10237
10235
|
return true;
|
|
10238
10236
|
}
|
|
@@ -10241,7 +10239,6 @@ var useFilterBar = ({
|
|
|
10241
10239
|
editFilter,
|
|
10242
10240
|
EMPTY_FILTER_CLAUSE
|
|
10243
10241
|
);
|
|
10244
|
-
console.log({ newFilter });
|
|
10245
10242
|
setEditFilter(newFilter);
|
|
10246
10243
|
setShowMenu(false);
|
|
10247
10244
|
return true;
|
|
@@ -10256,7 +10253,7 @@ var useFilterBar = ({
|
|
|
10256
10253
|
return false;
|
|
10257
10254
|
}
|
|
10258
10255
|
},
|
|
10259
|
-
[editFilter,
|
|
10256
|
+
[editFilter, addIfNewElseUpdate]
|
|
10260
10257
|
);
|
|
10261
10258
|
useEffect11(() => {
|
|
10262
10259
|
if (activeFilterIndex.length > 0) {
|
|
@@ -10409,6 +10406,7 @@ var useFilterBar = ({
|
|
|
10409
10406
|
showMenu
|
|
10410
10407
|
};
|
|
10411
10408
|
};
|
|
10409
|
+
var appendIfNotPresent = (n) => (ns) => ns.includes(n) ? ns : ns.concat(n);
|
|
10412
10410
|
|
|
10413
10411
|
// src/filter-bar/FilterBarMenu.tsx
|
|
10414
10412
|
import { PopupMenu as PopupMenu3 } from "@vuu-ui/vuu-popups";
|