@uniformdev/mesh-sdk-react 19.159.1-alpha.16 → 19.159.1-alpha.27
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.d.mts +14 -5
- package/dist/index.d.ts +14 -5
- package/dist/index.esm.js +167 -81
- package/dist/index.js +313 -230
- package/dist/index.mjs +167 -81
- package/package.json +7 -7
package/dist/index.mjs
CHANGED
|
@@ -1651,8 +1651,7 @@ var EntrySearch = ({
|
|
|
1651
1651
|
const handleCancelClick = (e) => {
|
|
1652
1652
|
e.preventDefault();
|
|
1653
1653
|
setListOpen(false);
|
|
1654
|
-
if (onCancel)
|
|
1655
|
-
onCancel();
|
|
1654
|
+
if (onCancel) onCancel();
|
|
1656
1655
|
};
|
|
1657
1656
|
const handleLoadMoreClick = () => {
|
|
1658
1657
|
search(textInput, {
|
|
@@ -4672,8 +4671,7 @@ function VariablesComposer(props) {
|
|
|
4672
4671
|
);
|
|
4673
4672
|
const editorState = useRef12();
|
|
4674
4673
|
const updateTimeout = useRef12();
|
|
4675
|
-
if (typeof document === "undefined")
|
|
4676
|
-
return null;
|
|
4674
|
+
if (typeof document === "undefined") return null;
|
|
4677
4675
|
return /* @__PURE__ */ jsxs21(LexicalComposer, { initialConfig: editorConfig, children: [
|
|
4678
4676
|
/* @__PURE__ */ jsx38(
|
|
4679
4677
|
OnChangePlugin,
|
|
@@ -5138,7 +5136,7 @@ function ParameterOrSingleVariable(props) {
|
|
|
5138
5136
|
editorRef ? /* @__PURE__ */ jsx42(EditorRefPlugin, { editorRef }) : null,
|
|
5139
5137
|
/* @__PURE__ */ jsx42(ControlledValuePlugin, { enabled: true, value }),
|
|
5140
5138
|
/* @__PURE__ */ jsxs25(HorizontalRhythm6, { align: "center", gap: "xs", css: { width: "100%" }, children: [
|
|
5141
|
-
/* @__PURE__ */ jsx42("div", { css: { flex: 1 }, children: inputWhenNoVariables && !hadVariablesInValue ? inputWhenNoVariables : /* @__PURE__ */ jsx42(
|
|
5139
|
+
/* @__PURE__ */ jsx42("div", { css: { flex: 1, minWidth: "0" }, children: inputWhenNoVariables && !hadVariablesInValue ? inputWhenNoVariables : /* @__PURE__ */ jsx42(
|
|
5142
5140
|
VariablesComposerInput,
|
|
5143
5141
|
{
|
|
5144
5142
|
"data-text-value": value,
|
|
@@ -8178,6 +8176,58 @@ var TextEditor = ({
|
|
|
8178
8176
|
);
|
|
8179
8177
|
};
|
|
8180
8178
|
|
|
8179
|
+
// src/components/SearchAndFilter/editors/TextMultiChoiceEditor.tsx
|
|
8180
|
+
import {
|
|
8181
|
+
convertComboBoxGroupsToSelectableGroups as convertComboBoxGroupsToSelectableGroups5,
|
|
8182
|
+
getComboBoxSelectedSelectableGroups as getComboBoxSelectedSelectableGroups3,
|
|
8183
|
+
InputCreatableComboBox
|
|
8184
|
+
} from "@uniformdev/design-system";
|
|
8185
|
+
import { useMemo as useMemo21 } from "react";
|
|
8186
|
+
import { jsx as jsx80 } from "@emotion/react/jsx-runtime";
|
|
8187
|
+
var TextMultiChoiceEditor = ({
|
|
8188
|
+
value,
|
|
8189
|
+
disabled,
|
|
8190
|
+
readOnly,
|
|
8191
|
+
valueTestId,
|
|
8192
|
+
...props
|
|
8193
|
+
}) => {
|
|
8194
|
+
const readOnlyProps = readOnly ? readOnlyAttributes : {};
|
|
8195
|
+
const isClearable = !readOnly || !disabled;
|
|
8196
|
+
const { groupedOptions, selectedOptions } = useMemo21(() => {
|
|
8197
|
+
var _a;
|
|
8198
|
+
const coercedValue = typeof value === "string" ? [value] : value != null ? value : [];
|
|
8199
|
+
const options = (_a = coercedValue.map((v) => ({ label: v, value: v }))) != null ? _a : [];
|
|
8200
|
+
return convertComboBoxGroupsToSelectableGroups5({ options, selectedItems: new Set(value) });
|
|
8201
|
+
}, [value]);
|
|
8202
|
+
return /* @__PURE__ */ jsx80("div", { "data-testid": valueTestId, children: /* @__PURE__ */ jsx80(
|
|
8203
|
+
InputCreatableComboBox,
|
|
8204
|
+
{
|
|
8205
|
+
...props,
|
|
8206
|
+
placeholder: "Type a value\u2026",
|
|
8207
|
+
noOptionsMessage: () => "Type to create a new value",
|
|
8208
|
+
options: groupedOptions,
|
|
8209
|
+
isMulti: true,
|
|
8210
|
+
isClearable,
|
|
8211
|
+
isDisabled: disabled,
|
|
8212
|
+
onChange: (e) => {
|
|
8213
|
+
const selectedValues = getComboBoxSelectedSelectableGroups3(e);
|
|
8214
|
+
return props.onChange([...selectedValues]);
|
|
8215
|
+
},
|
|
8216
|
+
value: selectedOptions,
|
|
8217
|
+
"aria-readonly": readOnly,
|
|
8218
|
+
styles: {
|
|
8219
|
+
menu(base) {
|
|
8220
|
+
return {
|
|
8221
|
+
...base,
|
|
8222
|
+
minWidth: "max-content"
|
|
8223
|
+
};
|
|
8224
|
+
}
|
|
8225
|
+
},
|
|
8226
|
+
...readOnlyProps
|
|
8227
|
+
}
|
|
8228
|
+
) });
|
|
8229
|
+
};
|
|
8230
|
+
|
|
8181
8231
|
// src/components/SearchAndFilter/FilterButton.tsx
|
|
8182
8232
|
import { Counter as Counter2, Icon as Icon6 } from "@uniformdev/design-system";
|
|
8183
8233
|
|
|
@@ -8387,7 +8437,7 @@ var ResetConditionsBtn = css38`
|
|
|
8387
8437
|
border: none;
|
|
8388
8438
|
color: var(--action-destructive-default);
|
|
8389
8439
|
transition: color var(--duration-fast) var(--timing-ease-out);
|
|
8390
|
-
padding: 0;
|
|
8440
|
+
padding: 0 var(--spacing-sm) 0 0;
|
|
8391
8441
|
|
|
8392
8442
|
&:hover,
|
|
8393
8443
|
&:focus {
|
|
@@ -8395,6 +8445,7 @@ var ResetConditionsBtn = css38`
|
|
|
8395
8445
|
}
|
|
8396
8446
|
`;
|
|
8397
8447
|
var IconBtn = css38`
|
|
8448
|
+
align-self: center;
|
|
8398
8449
|
background: transparent;
|
|
8399
8450
|
border: none;
|
|
8400
8451
|
padding: var(--spacing-sm);
|
|
@@ -8424,7 +8475,7 @@ var SearchAndFilterButtonGroup = css38`
|
|
|
8424
8475
|
`;
|
|
8425
8476
|
|
|
8426
8477
|
// src/components/SearchAndFilter/FilterButton.tsx
|
|
8427
|
-
import { jsx as
|
|
8478
|
+
import { jsx as jsx81, jsxs as jsxs44 } from "@emotion/react/jsx-runtime";
|
|
8428
8479
|
var FilterButton2 = ({
|
|
8429
8480
|
text = "Filters",
|
|
8430
8481
|
icon = "filter-add",
|
|
@@ -8445,9 +8496,9 @@ var FilterButton2 = ({
|
|
|
8445
8496
|
...props,
|
|
8446
8497
|
"data-testid": dataTestId,
|
|
8447
8498
|
children: [
|
|
8448
|
-
/* @__PURE__ */
|
|
8449
|
-
/* @__PURE__ */
|
|
8450
|
-
filterCount ? /* @__PURE__ */
|
|
8499
|
+
/* @__PURE__ */ jsx81(Icon6, { icon, iconColor: "currentColor", size: "1rem" }),
|
|
8500
|
+
/* @__PURE__ */ jsx81("span", { css: FilterButtonText, children: text }),
|
|
8501
|
+
filterCount ? /* @__PURE__ */ jsx81(Counter2, { count: filterCount, bgColor: "var(--white)" }) : null
|
|
8451
8502
|
]
|
|
8452
8503
|
}
|
|
8453
8504
|
);
|
|
@@ -8469,22 +8520,19 @@ import {
|
|
|
8469
8520
|
useContext as useContext8,
|
|
8470
8521
|
useDeferredValue as useDeferredValue2,
|
|
8471
8522
|
useEffect as useEffect21,
|
|
8472
|
-
useMemo as
|
|
8523
|
+
useMemo as useMemo22,
|
|
8473
8524
|
useState as useState24
|
|
8474
8525
|
} from "react";
|
|
8475
8526
|
|
|
8476
8527
|
// src/components/SearchAndFilter/FilterEditor.tsx
|
|
8477
|
-
import { jsx as
|
|
8528
|
+
import { jsx as jsx82 } from "@emotion/react/jsx-runtime";
|
|
8478
8529
|
var FilterEditorRenderer = ({ editorType, ...props }) => {
|
|
8479
8530
|
const { filterMapper: contextFilterMapper } = useSearchAndFilter();
|
|
8480
8531
|
const Editor = contextFilterMapper == null ? void 0 : contextFilterMapper[editorType];
|
|
8481
|
-
if (!Editor) {
|
|
8482
|
-
return
|
|
8483
|
-
}
|
|
8484
|
-
if (editorType === "empty") {
|
|
8485
|
-
return null;
|
|
8532
|
+
if (!Editor || editorType === "empty") {
|
|
8533
|
+
return /* @__PURE__ */ jsx82("span", {});
|
|
8486
8534
|
}
|
|
8487
|
-
return /* @__PURE__ */
|
|
8535
|
+
return /* @__PURE__ */ jsx82(Editor, { ...props });
|
|
8488
8536
|
};
|
|
8489
8537
|
var filterMapper = {
|
|
8490
8538
|
multiChoice: FilterMultiChoiceEditor,
|
|
@@ -8492,6 +8540,7 @@ var filterMapper = {
|
|
|
8492
8540
|
date: DateEditor,
|
|
8493
8541
|
dateRange: DateRangeEditor,
|
|
8494
8542
|
text: TextEditor,
|
|
8543
|
+
textMultiChoice: TextMultiChoiceEditor,
|
|
8495
8544
|
numberRange: NumberRangeEditor,
|
|
8496
8545
|
number: NumberEditor,
|
|
8497
8546
|
statusMultiChoice: StatusMultiEditor,
|
|
@@ -8501,9 +8550,9 @@ var filterMapper = {
|
|
|
8501
8550
|
function withInputVariables(WrappedComponent) {
|
|
8502
8551
|
const WithInputVariables = (props) => {
|
|
8503
8552
|
if (Array.isArray(props.value) || !props.bindable || props.disabled || props.readOnly) {
|
|
8504
|
-
return /* @__PURE__ */
|
|
8553
|
+
return /* @__PURE__ */ jsx82(WrappedComponent, { ...props });
|
|
8505
8554
|
}
|
|
8506
|
-
return /* @__PURE__ */
|
|
8555
|
+
return /* @__PURE__ */ jsx82(
|
|
8507
8556
|
InputVariables,
|
|
8508
8557
|
{
|
|
8509
8558
|
disableInlineMenu: true,
|
|
@@ -8511,7 +8560,7 @@ function withInputVariables(WrappedComponent) {
|
|
|
8511
8560
|
onChange: (newValue) => props.onChange(newValue != null ? newValue : ""),
|
|
8512
8561
|
value: props.value,
|
|
8513
8562
|
disabled: props.disabled,
|
|
8514
|
-
inputWhenNoVariables: /* @__PURE__ */
|
|
8563
|
+
inputWhenNoVariables: /* @__PURE__ */ jsx82(WrappedComponent, { ...props })
|
|
8515
8564
|
}
|
|
8516
8565
|
);
|
|
8517
8566
|
};
|
|
@@ -8521,16 +8570,16 @@ function withInputVariablesForMultiValue(WrappedComponent) {
|
|
|
8521
8570
|
const WithInputVariables = (props) => {
|
|
8522
8571
|
var _a;
|
|
8523
8572
|
if (!props.bindable || props.disabled || props.readOnly) {
|
|
8524
|
-
return /* @__PURE__ */
|
|
8573
|
+
return /* @__PURE__ */ jsx82(WrappedComponent, { ...props });
|
|
8525
8574
|
}
|
|
8526
|
-
return /* @__PURE__ */
|
|
8575
|
+
return /* @__PURE__ */ jsx82(
|
|
8527
8576
|
InputVariables,
|
|
8528
8577
|
{
|
|
8529
8578
|
disableInlineMenu: true,
|
|
8530
8579
|
showMenuPosition: "inline-right",
|
|
8531
8580
|
onChange: (newValue) => props.onChange(newValue ? [newValue] : []),
|
|
8532
8581
|
value: (_a = props.value) == null ? void 0 : _a[0],
|
|
8533
|
-
inputWhenNoVariables: /* @__PURE__ */
|
|
8582
|
+
inputWhenNoVariables: /* @__PURE__ */ jsx82(WrappedComponent, { ...props })
|
|
8534
8583
|
}
|
|
8535
8584
|
);
|
|
8536
8585
|
};
|
|
@@ -8546,7 +8595,7 @@ var bindableFiltersMapper = {
|
|
|
8546
8595
|
};
|
|
8547
8596
|
|
|
8548
8597
|
// src/components/SearchAndFilter/hooks/useSearchAndFilter.tsx
|
|
8549
|
-
import { jsx as
|
|
8598
|
+
import { jsx as jsx83 } from "@emotion/react/jsx-runtime";
|
|
8550
8599
|
var SearchAndFilterContext = createContext6({
|
|
8551
8600
|
searchTerm: "",
|
|
8552
8601
|
setSearchTerm: () => {
|
|
@@ -8610,7 +8659,7 @@ var SearchAndFilterProvider = ({
|
|
|
8610
8659
|
},
|
|
8611
8660
|
[filters, onChange]
|
|
8612
8661
|
);
|
|
8613
|
-
const validFilterQuery =
|
|
8662
|
+
const validFilterQuery = useMemo22(() => {
|
|
8614
8663
|
const hasValidFilters = filters.every((f) => f.field && f.operator && f.value);
|
|
8615
8664
|
if (hasValidFilters) {
|
|
8616
8665
|
return filters;
|
|
@@ -8629,7 +8678,7 @@ var SearchAndFilterProvider = ({
|
|
|
8629
8678
|
};
|
|
8630
8679
|
}
|
|
8631
8680
|
}, [filterVisibility]);
|
|
8632
|
-
return /* @__PURE__ */
|
|
8681
|
+
return /* @__PURE__ */ jsx83(
|
|
8633
8682
|
SearchAndFilterContext.Provider,
|
|
8634
8683
|
{
|
|
8635
8684
|
value: {
|
|
@@ -8648,7 +8697,7 @@ var SearchAndFilterProvider = ({
|
|
|
8648
8697
|
filterMapper: filterMapper2,
|
|
8649
8698
|
allowBindingSearchTerm
|
|
8650
8699
|
},
|
|
8651
|
-
children: /* @__PURE__ */
|
|
8700
|
+
children: /* @__PURE__ */ jsx83(VerticalRhythm5, { children })
|
|
8652
8701
|
}
|
|
8653
8702
|
);
|
|
8654
8703
|
};
|
|
@@ -8658,7 +8707,7 @@ var useSearchAndFilter = () => {
|
|
|
8658
8707
|
};
|
|
8659
8708
|
|
|
8660
8709
|
// src/components/SearchAndFilter/FilterControls.tsx
|
|
8661
|
-
import { Fragment as Fragment16, jsx as
|
|
8710
|
+
import { Fragment as Fragment16, jsx as jsx84, jsxs as jsxs45 } from "@emotion/react/jsx-runtime";
|
|
8662
8711
|
var FilterControls = ({
|
|
8663
8712
|
children,
|
|
8664
8713
|
hideSearchInput
|
|
@@ -8689,7 +8738,7 @@ var FilterControls = ({
|
|
|
8689
8738
|
}
|
|
8690
8739
|
}, [searchTerm]);
|
|
8691
8740
|
return /* @__PURE__ */ jsxs45(Fragment16, { children: [
|
|
8692
|
-
/* @__PURE__ */
|
|
8741
|
+
/* @__PURE__ */ jsx84(
|
|
8693
8742
|
FilterButton2,
|
|
8694
8743
|
{
|
|
8695
8744
|
"aria-controls": "search-and-filter-options",
|
|
@@ -8703,7 +8752,7 @@ var FilterControls = ({
|
|
|
8703
8752
|
}
|
|
8704
8753
|
),
|
|
8705
8754
|
hideSearchInput ? null : /* @__PURE__ */ jsxs45("div", { css: BindableKeywordSearchInputStyles, children: [
|
|
8706
|
-
/* @__PURE__ */
|
|
8755
|
+
/* @__PURE__ */ jsx84(
|
|
8707
8756
|
InputVariables,
|
|
8708
8757
|
{
|
|
8709
8758
|
label: "",
|
|
@@ -8713,7 +8762,7 @@ var FilterControls = ({
|
|
|
8713
8762
|
value: localeSearchTerm,
|
|
8714
8763
|
onChange: (value) => setLocaleSearchTerm(value != null ? value : ""),
|
|
8715
8764
|
disableVariables: !allowBindingSearchTerm,
|
|
8716
|
-
inputWhenNoVariables: /* @__PURE__ */
|
|
8765
|
+
inputWhenNoVariables: /* @__PURE__ */ jsx84(
|
|
8717
8766
|
InputKeywordSearch2,
|
|
8718
8767
|
{
|
|
8719
8768
|
placeholder: "Search...",
|
|
@@ -8726,7 +8775,7 @@ var FilterControls = ({
|
|
|
8726
8775
|
)
|
|
8727
8776
|
}
|
|
8728
8777
|
),
|
|
8729
|
-
hasVariableInSearchTerm ? /* @__PURE__ */
|
|
8778
|
+
hasVariableInSearchTerm ? /* @__PURE__ */ jsx84("div", { css: ClearSearchButtonContainer, children: /* @__PURE__ */ jsx84(
|
|
8730
8779
|
"button",
|
|
8731
8780
|
{
|
|
8732
8781
|
css: ClearSearchButtonStyles,
|
|
@@ -8740,7 +8789,7 @@ var FilterControls = ({
|
|
|
8740
8789
|
},
|
|
8741
8790
|
type: "button",
|
|
8742
8791
|
"data-testid": "keyword-search-clear-button",
|
|
8743
|
-
children: /* @__PURE__ */
|
|
8792
|
+
children: /* @__PURE__ */ jsx84(Icon7, { icon: CgClose5, iconColor: "red", size: "1rem" })
|
|
8744
8793
|
}
|
|
8745
8794
|
) }) : null
|
|
8746
8795
|
] }),
|
|
@@ -8750,20 +8799,20 @@ var FilterControls = ({
|
|
|
8750
8799
|
|
|
8751
8800
|
// src/components/SearchAndFilter/FilterItem.tsx
|
|
8752
8801
|
import { Icon as Icon8, InputComboBox as InputComboBox5 } from "@uniformdev/design-system";
|
|
8753
|
-
import { useMemo as
|
|
8802
|
+
import { useMemo as useMemo23 } from "react";
|
|
8754
8803
|
|
|
8755
8804
|
// src/components/SearchAndFilter/FilterMenu.tsx
|
|
8756
8805
|
import { HorizontalRhythm as HorizontalRhythm8, VerticalRhythm as VerticalRhythm6 } from "@uniformdev/design-system";
|
|
8757
8806
|
import React13, { useEffect as useEffect23 } from "react";
|
|
8758
|
-
import { jsx as
|
|
8807
|
+
import { jsx as jsx85, jsxs as jsxs46 } from "@emotion/react/jsx-runtime";
|
|
8759
8808
|
var SearchAndFilterOptionsContainer2 = ({
|
|
8760
8809
|
buttonRow,
|
|
8761
8810
|
additionalFiltersContainer,
|
|
8762
8811
|
children
|
|
8763
8812
|
}) => {
|
|
8764
8813
|
return /* @__PURE__ */ jsxs46("div", { css: SearchAndFilterOptionsContainer, children: [
|
|
8765
|
-
/* @__PURE__ */
|
|
8766
|
-
buttonRow ? /* @__PURE__ */
|
|
8814
|
+
/* @__PURE__ */ jsx85("div", { css: SearchAndFilterOptionsInnerContainer, children }),
|
|
8815
|
+
buttonRow ? /* @__PURE__ */ jsx85(
|
|
8767
8816
|
HorizontalRhythm8,
|
|
8768
8817
|
{
|
|
8769
8818
|
css: SearchAndFilterButtonGroup,
|
|
@@ -8773,7 +8822,7 @@ var SearchAndFilterOptionsContainer2 = ({
|
|
|
8773
8822
|
children: buttonRow
|
|
8774
8823
|
}
|
|
8775
8824
|
) : null,
|
|
8776
|
-
additionalFiltersContainer ? /* @__PURE__ */
|
|
8825
|
+
additionalFiltersContainer ? /* @__PURE__ */ jsx85("div", { children: additionalFiltersContainer }) : null
|
|
8777
8826
|
] });
|
|
8778
8827
|
};
|
|
8779
8828
|
var FilterMenu = ({
|
|
@@ -8793,15 +8842,15 @@ var FilterMenu = ({
|
|
|
8793
8842
|
(_a = innerMenuRef.current) == null ? void 0 : _a.focus();
|
|
8794
8843
|
}
|
|
8795
8844
|
}, [filterVisibility]);
|
|
8796
|
-
return /* @__PURE__ */
|
|
8845
|
+
return /* @__PURE__ */ jsx85(VerticalRhythm6, { gap: "sm", "aria-haspopup": "true", id, "data-testid": dataTestId, children: filterVisibility ? /* @__PURE__ */ jsxs46(
|
|
8797
8846
|
SearchAndFilterOptionsContainer2,
|
|
8798
8847
|
{
|
|
8799
8848
|
buttonRow: menuControls,
|
|
8800
8849
|
additionalFiltersContainer,
|
|
8801
8850
|
children: [
|
|
8802
8851
|
/* @__PURE__ */ jsxs46(HorizontalRhythm8, { gap: "sm", align: "center", justify: "space-between", children: [
|
|
8803
|
-
/* @__PURE__ */
|
|
8804
|
-
(filters == null ? void 0 : filters.length) ? /* @__PURE__ */
|
|
8852
|
+
filterTitle ? /* @__PURE__ */ jsx85("span", { css: Title, ref: innerMenuRef, tabIndex: 0, children: filterTitle }) : null,
|
|
8853
|
+
(filters == null ? void 0 : filters.length) && resetButtonText ? /* @__PURE__ */ jsx85(
|
|
8805
8854
|
"button",
|
|
8806
8855
|
{
|
|
8807
8856
|
type: "button",
|
|
@@ -8822,7 +8871,7 @@ var FilterMenu = ({
|
|
|
8822
8871
|
};
|
|
8823
8872
|
|
|
8824
8873
|
// src/components/SearchAndFilter/FilterItem.tsx
|
|
8825
|
-
import { jsx as
|
|
8874
|
+
import { jsx as jsx86, jsxs as jsxs47 } from "@emotion/react/jsx-runtime";
|
|
8826
8875
|
var FilterItem = ({
|
|
8827
8876
|
index,
|
|
8828
8877
|
paramOptions,
|
|
@@ -8830,7 +8879,8 @@ var FilterItem = ({
|
|
|
8830
8879
|
valueOptions,
|
|
8831
8880
|
onParamChange,
|
|
8832
8881
|
onOperatorChange,
|
|
8833
|
-
onValueChange
|
|
8882
|
+
onValueChange,
|
|
8883
|
+
initialCriteriaTitle = "Where"
|
|
8834
8884
|
}) => {
|
|
8835
8885
|
var _a, _b;
|
|
8836
8886
|
const { filters, handleDeleteFilter, filterOptions } = useSearchAndFilter();
|
|
@@ -8838,7 +8888,7 @@ var FilterItem = ({
|
|
|
8838
8888
|
const operatorLabel = filters[index].operator !== "" ? `operator ${filters[index].operator}` : "unknown operator";
|
|
8839
8889
|
const metaDataLabel = filters[index].value !== "" ? `value ${filters[index].value}` : "unknown value";
|
|
8840
8890
|
const metaDataPossibleOptions = (_b = (_a = operatorOptions.find((op) => filters[index].operator === op.value)) == null ? void 0 : _a.editorType) != null ? _b : "singleChoice";
|
|
8841
|
-
const { selectedFieldValue, selectedOperatorValue, selectedMetaValue, readOnly, bindable } =
|
|
8891
|
+
const { selectedFieldValue, selectedOperatorValue, selectedMetaValue, readOnly, bindable } = useMemo23(() => {
|
|
8842
8892
|
var _a2;
|
|
8843
8893
|
const currentSelectedFilter = filterOptions.find((item) => {
|
|
8844
8894
|
var _a3;
|
|
@@ -8866,9 +8916,9 @@ var FilterItem = ({
|
|
|
8866
8916
|
isClearable: false
|
|
8867
8917
|
} : {};
|
|
8868
8918
|
return /* @__PURE__ */ jsxs47("div", { css: ConditionalFilterRow, "data-testid": "filter-item", children: [
|
|
8869
|
-
/* @__PURE__ */
|
|
8919
|
+
/* @__PURE__ */ jsx86("span", { children: index === 0 ? initialCriteriaTitle : "and" }),
|
|
8870
8920
|
/* @__PURE__ */ jsxs47("div", { css: ConditionalInputRow, children: [
|
|
8871
|
-
/* @__PURE__ */
|
|
8921
|
+
/* @__PURE__ */ jsx86(
|
|
8872
8922
|
InputComboBox5,
|
|
8873
8923
|
{
|
|
8874
8924
|
"aria-label": label,
|
|
@@ -8895,7 +8945,7 @@ var FilterItem = ({
|
|
|
8895
8945
|
name: `filter-field-${index}`
|
|
8896
8946
|
}
|
|
8897
8947
|
),
|
|
8898
|
-
/* @__PURE__ */
|
|
8948
|
+
/* @__PURE__ */ jsx86(
|
|
8899
8949
|
InputComboBox5,
|
|
8900
8950
|
{
|
|
8901
8951
|
"aria-label": operatorLabel,
|
|
@@ -8919,7 +8969,7 @@ var FilterItem = ({
|
|
|
8919
8969
|
name: `filter-operator-${index}`
|
|
8920
8970
|
}
|
|
8921
8971
|
),
|
|
8922
|
-
/* @__PURE__ */
|
|
8972
|
+
/* @__PURE__ */ jsx86(
|
|
8923
8973
|
FilterEditorRenderer,
|
|
8924
8974
|
{
|
|
8925
8975
|
"aria-label": metaDataLabel,
|
|
@@ -8933,7 +8983,7 @@ var FilterItem = ({
|
|
|
8933
8983
|
valueTestId: "filter-value"
|
|
8934
8984
|
}
|
|
8935
8985
|
),
|
|
8936
|
-
readOnly
|
|
8986
|
+
readOnly ? null : /* @__PURE__ */ jsx86(
|
|
8937
8987
|
"button",
|
|
8938
8988
|
{
|
|
8939
8989
|
type: "button",
|
|
@@ -8941,15 +8991,36 @@ var FilterItem = ({
|
|
|
8941
8991
|
"aria-label": "delete filter",
|
|
8942
8992
|
css: IconBtn,
|
|
8943
8993
|
"data-testid": "delete-filter",
|
|
8944
|
-
|
|
8994
|
+
disabled: filters.length === 1,
|
|
8995
|
+
children: /* @__PURE__ */ jsx86(Icon8, { icon: "trash", iconColor: filters.length === 1 ? "gray" : "red", size: "1rem" })
|
|
8945
8996
|
}
|
|
8946
8997
|
)
|
|
8947
8998
|
] })
|
|
8948
8999
|
] });
|
|
8949
9000
|
};
|
|
9001
|
+
var singleValuedOperators = /* @__PURE__ */ new Set([
|
|
9002
|
+
"eq",
|
|
9003
|
+
"neq",
|
|
9004
|
+
"lt",
|
|
9005
|
+
"gt",
|
|
9006
|
+
"is",
|
|
9007
|
+
"!is",
|
|
9008
|
+
"has",
|
|
9009
|
+
"!has",
|
|
9010
|
+
"startswith",
|
|
9011
|
+
"!startswith",
|
|
9012
|
+
"endswith",
|
|
9013
|
+
"!endswith"
|
|
9014
|
+
]);
|
|
9015
|
+
var arrayValuedOperators = /* @__PURE__ */ new Set(["in", "nin", "is$", "!is$"]);
|
|
9016
|
+
var clearValueOnChangeAwayFromOperators = /* @__PURE__ */ new Set(["def", "ndef", "empty", "!empty", "between"]);
|
|
9017
|
+
var noValueOperators = /* @__PURE__ */ new Set(["empty", "!empty"]);
|
|
8950
9018
|
var FilterItems = ({
|
|
8951
9019
|
addButtonText = "add condition",
|
|
8952
|
-
additionalFiltersContainer
|
|
9020
|
+
additionalFiltersContainer,
|
|
9021
|
+
filterTitle,
|
|
9022
|
+
resetButtonText,
|
|
9023
|
+
initialCriteriaTitle
|
|
8953
9024
|
}) => {
|
|
8954
9025
|
const { filterOptions, filters, setFilters, handleAddFilter } = useSearchAndFilter();
|
|
8955
9026
|
const handleUpdateFilter = (index, prop, value) => {
|
|
@@ -8957,14 +9028,25 @@ var FilterItems = ({
|
|
|
8957
9028
|
const next = [...filters];
|
|
8958
9029
|
next[index] = { ...next[index], [prop]: value };
|
|
8959
9030
|
if (prop === "operator") {
|
|
8960
|
-
|
|
9031
|
+
const newOperator = value;
|
|
9032
|
+
const currentValue = next[index].value;
|
|
9033
|
+
if (Array.isArray(newOperator)) {
|
|
9034
|
+
throw new Error("Operator value must be a single string");
|
|
9035
|
+
}
|
|
9036
|
+
if (singleValuedOperators.has(newOperator) && Array.isArray(currentValue)) {
|
|
8961
9037
|
next[index].value = next[index].value[0];
|
|
8962
9038
|
}
|
|
8963
|
-
if (
|
|
9039
|
+
if (arrayValuedOperators.has(newOperator) && Array.isArray(currentValue) === false) {
|
|
9040
|
+
next[index].value = currentValue ? [currentValue] : [];
|
|
9041
|
+
}
|
|
9042
|
+
if (clearValueOnChangeAwayFromOperators.has(filters[index].operator)) {
|
|
9043
|
+
next[index].value = "";
|
|
9044
|
+
}
|
|
9045
|
+
if (noValueOperators.has(newOperator)) {
|
|
8964
9046
|
next[index].value = "";
|
|
8965
9047
|
}
|
|
8966
|
-
if (
|
|
8967
|
-
next[index].value = [
|
|
9048
|
+
if (newOperator === "between" && Array.isArray(currentValue) === false) {
|
|
9049
|
+
next[index].value = [currentValue, ""];
|
|
8968
9050
|
}
|
|
8969
9051
|
if (value === "def" || value === "true") {
|
|
8970
9052
|
next[index].value = "true";
|
|
@@ -8983,7 +9065,7 @@ var FilterItems = ({
|
|
|
8983
9065
|
}
|
|
8984
9066
|
setFilters(next);
|
|
8985
9067
|
};
|
|
8986
|
-
return /* @__PURE__ */
|
|
9068
|
+
return /* @__PURE__ */ jsx86(
|
|
8987
9069
|
FilterMenu,
|
|
8988
9070
|
{
|
|
8989
9071
|
id: "search-and-filter-options",
|
|
@@ -8996,12 +9078,14 @@ var FilterItems = ({
|
|
|
8996
9078
|
onClick: handleAddFilter,
|
|
8997
9079
|
"data-testid": "add-filter",
|
|
8998
9080
|
children: [
|
|
8999
|
-
/* @__PURE__ */
|
|
9081
|
+
/* @__PURE__ */ jsx86(Icon8, { icon: "math-plus", iconColor: "currentColor", size: "1rem" }),
|
|
9000
9082
|
addButtonText
|
|
9001
9083
|
]
|
|
9002
9084
|
}
|
|
9003
9085
|
),
|
|
9004
9086
|
additionalFiltersContainer,
|
|
9087
|
+
filterTitle,
|
|
9088
|
+
resetButtonText,
|
|
9005
9089
|
children: filters.map((item, i) => {
|
|
9006
9090
|
var _a, _b, _c, _d, _e, _f;
|
|
9007
9091
|
const availableTypeOptions = (_b = (_a = filterOptions.find((fo) => {
|
|
@@ -9010,7 +9094,7 @@ var FilterItems = ({
|
|
|
9010
9094
|
})) == null ? void 0 : _a.options) != null ? _b : [];
|
|
9011
9095
|
const possibleValueOptions = (_d = (_c = availableTypeOptions == null ? void 0 : availableTypeOptions.find((op) => op.value === item.field)) == null ? void 0 : _c.valueOptions) != null ? _d : [];
|
|
9012
9096
|
const possibleOperators = (_f = (_e = availableTypeOptions == null ? void 0 : availableTypeOptions.find((op) => op.value === item.field)) == null ? void 0 : _e.operatorOptions) != null ? _f : [];
|
|
9013
|
-
return /* @__PURE__ */
|
|
9097
|
+
return /* @__PURE__ */ jsx86(
|
|
9014
9098
|
FilterItem,
|
|
9015
9099
|
{
|
|
9016
9100
|
index: i,
|
|
@@ -9019,7 +9103,8 @@ var FilterItems = ({
|
|
|
9019
9103
|
operatorOptions: possibleOperators,
|
|
9020
9104
|
onOperatorChange: (e) => handleUpdateFilter(i, "operator", e),
|
|
9021
9105
|
onValueChange: (e) => handleUpdateFilter(i, "value", e),
|
|
9022
|
-
valueOptions: possibleValueOptions
|
|
9106
|
+
valueOptions: possibleValueOptions,
|
|
9107
|
+
initialCriteriaTitle
|
|
9023
9108
|
},
|
|
9024
9109
|
i
|
|
9025
9110
|
);
|
|
@@ -9033,7 +9118,7 @@ import { VerticalRhythm as VerticalRhythm7 } from "@uniformdev/design-system";
|
|
|
9033
9118
|
|
|
9034
9119
|
// src/components/SearchAndFilter/SearchAndFilterResultContainer.tsx
|
|
9035
9120
|
import { Button as Button6, Callout as Callout6, HorizontalRhythm as HorizontalRhythm9, Paragraph } from "@uniformdev/design-system";
|
|
9036
|
-
import { Fragment as Fragment17, jsx as
|
|
9121
|
+
import { Fragment as Fragment17, jsx as jsx87, jsxs as jsxs48 } from "@emotion/react/jsx-runtime";
|
|
9037
9122
|
var SearchAndFilterResultContainer = ({
|
|
9038
9123
|
buttonText,
|
|
9039
9124
|
clearButtonLabel = "clear",
|
|
@@ -9070,11 +9155,11 @@ var SearchAndFilterResultContainer = ({
|
|
|
9070
9155
|
" results ",
|
|
9071
9156
|
searchTerm ? `for "${searchTerm}"` : null
|
|
9072
9157
|
] }),
|
|
9073
|
-
!searchTerm || hideClearButton ? null : /* @__PURE__ */
|
|
9158
|
+
!searchTerm || hideClearButton ? null : /* @__PURE__ */ jsx87(Button6, { buttonType: "ghostDestructive", size: "zero", onClick: handleClearSearch, children: clearButtonLabel })
|
|
9074
9159
|
] }),
|
|
9075
9160
|
totalResults === 0 ? /* @__PURE__ */ jsxs48(Callout6, { title: calloutTitle != null ? calloutTitle : automateCalloutTitle(), type: "note", children: [
|
|
9076
|
-
calloutText ? /* @__PURE__ */
|
|
9077
|
-
hideClearButton ? null : /* @__PURE__ */
|
|
9161
|
+
calloutText ? /* @__PURE__ */ jsx87(Paragraph, { children: calloutText }) : null,
|
|
9162
|
+
hideClearButton ? null : /* @__PURE__ */ jsx87(
|
|
9078
9163
|
Button6,
|
|
9079
9164
|
{
|
|
9080
9165
|
buttonType: "tertiaryOutline",
|
|
@@ -9089,14 +9174,14 @@ var SearchAndFilterResultContainer = ({
|
|
|
9089
9174
|
};
|
|
9090
9175
|
|
|
9091
9176
|
// src/components/SearchAndFilter/SearchAndFilter.tsx
|
|
9092
|
-
import { jsx as
|
|
9177
|
+
import { jsx as jsx88, jsxs as jsxs49 } from "@emotion/react/jsx-runtime";
|
|
9093
9178
|
var SearchAndFilter = ({
|
|
9094
9179
|
filters,
|
|
9095
9180
|
filterOptions,
|
|
9096
9181
|
filterVisible,
|
|
9097
9182
|
filterControls,
|
|
9098
9183
|
viewSwitchControls,
|
|
9099
|
-
resultsContainerView = /* @__PURE__ */
|
|
9184
|
+
resultsContainerView = /* @__PURE__ */ jsx88(SearchAndFilterResultContainer, {}),
|
|
9100
9185
|
filterMapper: filterMapper2 = filterMapper,
|
|
9101
9186
|
additionalFiltersContainer,
|
|
9102
9187
|
onChange,
|
|
@@ -9106,7 +9191,7 @@ var SearchAndFilter = ({
|
|
|
9106
9191
|
allowBindingSearchTerm = false,
|
|
9107
9192
|
resetFilterValues = []
|
|
9108
9193
|
}) => {
|
|
9109
|
-
return /* @__PURE__ */
|
|
9194
|
+
return /* @__PURE__ */ jsx88(
|
|
9110
9195
|
SearchAndFilterProvider,
|
|
9111
9196
|
{
|
|
9112
9197
|
filters,
|
|
@@ -9121,16 +9206,16 @@ var SearchAndFilter = ({
|
|
|
9121
9206
|
allowBindingSearchTerm,
|
|
9122
9207
|
children: /* @__PURE__ */ jsxs49(VerticalRhythm7, { "data-testid": "search-and-filter", children: [
|
|
9123
9208
|
/* @__PURE__ */ jsxs49("div", { css: SearchAndFilterOutterControlWrapper(viewSwitchControls ? "1fr auto" : "1fr"), children: [
|
|
9124
|
-
/* @__PURE__ */
|
|
9209
|
+
/* @__PURE__ */ jsx88(
|
|
9125
9210
|
"div",
|
|
9126
9211
|
{
|
|
9127
9212
|
css: SearchAndFilterControlsWrapper(viewSwitchControls ? "auto 1fr 0.05fr" : "auto 1fr"),
|
|
9128
|
-
children: !filterControls ? /* @__PURE__ */
|
|
9213
|
+
children: !filterControls ? /* @__PURE__ */ jsx88(FilterControls, { hideSearchInput: !onSearchChange }) : filterControls
|
|
9129
9214
|
}
|
|
9130
9215
|
),
|
|
9131
9216
|
viewSwitchControls
|
|
9132
9217
|
] }),
|
|
9133
|
-
/* @__PURE__ */
|
|
9218
|
+
/* @__PURE__ */ jsx88(FilterItems, { additionalFiltersContainer }),
|
|
9134
9219
|
resultsContainerView
|
|
9135
9220
|
] })
|
|
9136
9221
|
}
|
|
@@ -9141,7 +9226,7 @@ var SearchAndFilter = ({
|
|
|
9141
9226
|
import { InputKeywordSearch as InputKeywordSearch3 } from "@uniformdev/design-system";
|
|
9142
9227
|
import { createContext as createContext7, useState as useState26 } from "react";
|
|
9143
9228
|
import { useDebounce as useDebounce10 } from "react-use";
|
|
9144
|
-
import { jsx as
|
|
9229
|
+
import { jsx as jsx89 } from "@emotion/react/jsx-runtime";
|
|
9145
9230
|
var SearchOnlyContext = createContext7({
|
|
9146
9231
|
searchTerm: "",
|
|
9147
9232
|
setSearchTerm: () => {
|
|
@@ -9158,14 +9243,14 @@ var SearchOnlyFilter = ({ onSearchChange, maxWidth }) => {
|
|
|
9158
9243
|
300,
|
|
9159
9244
|
[localeSearchTerm]
|
|
9160
9245
|
);
|
|
9161
|
-
return /* @__PURE__ */
|
|
9246
|
+
return /* @__PURE__ */ jsx89(
|
|
9162
9247
|
SearchOnlyContext.Provider,
|
|
9163
9248
|
{
|
|
9164
9249
|
value: {
|
|
9165
9250
|
searchTerm,
|
|
9166
9251
|
setSearchTerm: setLocaleSearchTerm
|
|
9167
9252
|
},
|
|
9168
|
-
children: /* @__PURE__ */
|
|
9253
|
+
children: /* @__PURE__ */ jsx89("div", { css: { maxWidth: maxWidth != null ? maxWidth : "712px" }, children: /* @__PURE__ */ jsx89(
|
|
9169
9254
|
InputKeywordSearch3,
|
|
9170
9255
|
{
|
|
9171
9256
|
placeholder: "Search...",
|
|
@@ -9416,7 +9501,7 @@ var InputVariableWrapper = css39`
|
|
|
9416
9501
|
`;
|
|
9417
9502
|
|
|
9418
9503
|
// src/components/SearchAndFilter/SortItems.tsx
|
|
9419
|
-
import { jsx as
|
|
9504
|
+
import { jsx as jsx90, jsxs as jsxs50 } from "@emotion/react/jsx-runtime";
|
|
9420
9505
|
var SortItems = ({
|
|
9421
9506
|
sortByLabel = "Sort by",
|
|
9422
9507
|
localeLabel = "Show locale",
|
|
@@ -9440,9 +9525,9 @@ var SortItems = ({
|
|
|
9440
9525
|
const localeLabelValue = sortOptions.length > 1 ? localeLabel : `${localeLabel}s`;
|
|
9441
9526
|
return /* @__PURE__ */ jsxs50("div", { css: [SortFilterWrapper(hideLocaleOptions)], "data-testid": "sorting-options", children: [
|
|
9442
9527
|
/* @__PURE__ */ jsxs50(VerticalRhythm8, { gap: "xs", children: [
|
|
9443
|
-
/* @__PURE__ */
|
|
9528
|
+
/* @__PURE__ */ jsx90("span", { css: Title2, children: sortByLabel }),
|
|
9444
9529
|
/* @__PURE__ */ jsxs50("div", { css: SortFilterInputRow, children: [
|
|
9445
|
-
/* @__PURE__ */
|
|
9530
|
+
/* @__PURE__ */ jsx90(
|
|
9446
9531
|
InputVariables,
|
|
9447
9532
|
{
|
|
9448
9533
|
disableInlineMenu: disableSortBinding,
|
|
@@ -9450,7 +9535,7 @@ var SortItems = ({
|
|
|
9450
9535
|
value: sortField,
|
|
9451
9536
|
valueToResetTo: "created_at",
|
|
9452
9537
|
onChange: (e) => onSortChange(`${e}_${sortDirection}`),
|
|
9453
|
-
inputWhenNoVariables: /* @__PURE__ */
|
|
9538
|
+
inputWhenNoVariables: /* @__PURE__ */ jsx90(
|
|
9454
9539
|
InputComboBox6,
|
|
9455
9540
|
{
|
|
9456
9541
|
id: "sort-by-field",
|
|
@@ -9473,7 +9558,7 @@ var SortItems = ({
|
|
|
9473
9558
|
)
|
|
9474
9559
|
}
|
|
9475
9560
|
),
|
|
9476
|
-
/* @__PURE__ */
|
|
9561
|
+
/* @__PURE__ */ jsx90(
|
|
9477
9562
|
InputVariables,
|
|
9478
9563
|
{
|
|
9479
9564
|
disableInlineMenu: disableSortBinding,
|
|
@@ -9481,7 +9566,7 @@ var SortItems = ({
|
|
|
9481
9566
|
valueToResetTo: "DESC",
|
|
9482
9567
|
showMenuPosition: disableSortBinding ? void 0 : "inline-right",
|
|
9483
9568
|
onChange: (e) => onSortChange(`${sortField}_${e}`),
|
|
9484
|
-
inputWhenNoVariables: /* @__PURE__ */
|
|
9569
|
+
inputWhenNoVariables: /* @__PURE__ */ jsx90(
|
|
9485
9570
|
SegmentedControl,
|
|
9486
9571
|
{
|
|
9487
9572
|
noCheckmark: true,
|
|
@@ -9513,14 +9598,14 @@ var SortItems = ({
|
|
|
9513
9598
|
)
|
|
9514
9599
|
] })
|
|
9515
9600
|
] }),
|
|
9516
|
-
hideLocaleOptions ? null : /* @__PURE__ */
|
|
9601
|
+
hideLocaleOptions ? null : /* @__PURE__ */ jsx90(VerticalRhythm8, { gap: "xs", css: InputVariableWrapper, children: /* @__PURE__ */ jsx90(
|
|
9517
9602
|
InputVariables,
|
|
9518
9603
|
{
|
|
9519
9604
|
label: localeLabelValue,
|
|
9520
9605
|
value: localeValue,
|
|
9521
9606
|
showMenuPosition: "inline-right",
|
|
9522
9607
|
onChange: (e) => onLocaleChange(e != null ? e : ""),
|
|
9523
|
-
inputWhenNoVariables: /* @__PURE__ */
|
|
9608
|
+
inputWhenNoVariables: /* @__PURE__ */ jsx90(
|
|
9524
9609
|
InputSelect8,
|
|
9525
9610
|
{
|
|
9526
9611
|
name: "localeReturned",
|
|
@@ -9729,6 +9814,7 @@ export {
|
|
|
9729
9814
|
Switch,
|
|
9730
9815
|
TEXTBOX_OPERATORS,
|
|
9731
9816
|
TextEditor,
|
|
9817
|
+
TextMultiChoiceEditor,
|
|
9732
9818
|
TextVariableRenderer,
|
|
9733
9819
|
Textarea,
|
|
9734
9820
|
Theme3 as Theme,
|