@uniformdev/mesh-sdk-react 20.6.2-alpha.11 → 20.7.1-alpha.102
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/LICENSE.txt +1 -1
- package/dist/index.d.mts +56 -10
- package/dist/index.d.ts +56 -10
- package/dist/index.esm.js +140 -62
- package/dist/index.js +141 -67
- package/dist/index.mjs +140 -62
- package/package.json +10 -10
package/dist/index.esm.js
CHANGED
|
@@ -674,6 +674,7 @@ import { createVariableReference as createVariableReference2 } from "@uniformdev
|
|
|
674
674
|
import { HorizontalRhythm as HorizontalRhythm2, MenuGroup, MenuItemInner, MenuItemSeparator } from "@uniformdev/design-system";
|
|
675
675
|
import { dequal } from "dequal/lite";
|
|
676
676
|
import {
|
|
677
|
+
$addUpdateTag,
|
|
677
678
|
$createParagraphNode,
|
|
678
679
|
$createTextNode,
|
|
679
680
|
$getNodeByKey,
|
|
@@ -773,7 +774,7 @@ import { zodResolver } from "@hookform/resolvers/zod";
|
|
|
773
774
|
import { Button, Callout, HorizontalRhythm, Input, useShortcut } from "@uniformdev/design-system";
|
|
774
775
|
import { useLayoutEffect, useRef as useRef2 } from "react";
|
|
775
776
|
import { useForm } from "react-hook-form";
|
|
776
|
-
import
|
|
777
|
+
import * as z from "zod";
|
|
777
778
|
|
|
778
779
|
// src/components/Variables/styles/VariableEditor.styles.ts
|
|
779
780
|
import { css as css2 } from "@emotion/react";
|
|
@@ -1243,7 +1244,8 @@ function VariablesPlugin({
|
|
|
1243
1244
|
enableEditingVariables,
|
|
1244
1245
|
getEditorContext,
|
|
1245
1246
|
replaceValueOnVariableInsert,
|
|
1246
|
-
filterVariable
|
|
1247
|
+
filterVariable,
|
|
1248
|
+
disableVariableDisplayNames
|
|
1247
1249
|
}) {
|
|
1248
1250
|
const [editor] = useLexicalComposerContext2();
|
|
1249
1251
|
const { variables, dispatch, isEditing, canDispatch, readOnly, knownUndefinedValues, isLoading } = useVariables(true);
|
|
@@ -1321,9 +1323,10 @@ function VariablesPlugin({
|
|
|
1321
1323
|
});
|
|
1322
1324
|
return;
|
|
1323
1325
|
}
|
|
1326
|
+
const initialDisplayName = disableVariableDisplayNames ? prettifyBindExpression(result.selectedVariable.name) : result.selectedVariable.displayName;
|
|
1324
1327
|
editor.dispatchCommand(INSERT_VARIABLE_COMMAND, {
|
|
1325
1328
|
variable: result.selectedVariable.name,
|
|
1326
|
-
initialDisplayName
|
|
1329
|
+
initialDisplayName,
|
|
1327
1330
|
targetKey: sourceKey,
|
|
1328
1331
|
overwriteExistingValue: replaceValueOnVariableInsert
|
|
1329
1332
|
});
|
|
@@ -1371,9 +1374,10 @@ function VariablesPlugin({
|
|
|
1371
1374
|
if (result.canceled) {
|
|
1372
1375
|
return;
|
|
1373
1376
|
}
|
|
1377
|
+
const initialDisplayName = disableVariableDisplayNames ? prettifyBindExpression(result.selectedVariable.name) : result.selectedVariable.displayName;
|
|
1374
1378
|
editor.dispatchCommand(INSERT_VARIABLE_COMMAND, {
|
|
1375
1379
|
variable: result.selectedVariable.name,
|
|
1376
|
-
initialDisplayName
|
|
1380
|
+
initialDisplayName,
|
|
1377
1381
|
targetKey: void 0,
|
|
1378
1382
|
overwriteExistingValue: replaceValueOnVariableInsert
|
|
1379
1383
|
});
|
|
@@ -1392,8 +1396,9 @@ function VariablesPlugin({
|
|
|
1392
1396
|
var _a, _b;
|
|
1393
1397
|
if (!disableVariables) {
|
|
1394
1398
|
const targetVariable = variablesRef.current.variables[reference];
|
|
1399
|
+
const displayName = disableVariableDisplayNames ? prettifyBindExpression(reference) : initialDisplayName != null ? initialDisplayName : (targetVariable == null ? void 0 : targetVariable.displayName) || prettifyBindExpression(reference);
|
|
1395
1400
|
const variableNode = $createVariableNode(reference, {
|
|
1396
|
-
displayName
|
|
1401
|
+
displayName,
|
|
1397
1402
|
hasClickEvent: canEditVariable(reference, targetVariable),
|
|
1398
1403
|
referenceIsValid: true,
|
|
1399
1404
|
tooltip: (_a = targetVariable == null ? void 0 : targetVariable.tooltip) != null ? _a : targetVariable == null ? void 0 : targetVariable.helpText,
|
|
@@ -1430,7 +1435,8 @@ function VariablesPlugin({
|
|
|
1430
1435
|
readOnly,
|
|
1431
1436
|
getEditorContext,
|
|
1432
1437
|
editVariable,
|
|
1433
|
-
replaceValueOnVariableInsert
|
|
1438
|
+
replaceValueOnVariableInsert,
|
|
1439
|
+
disableVariableDisplayNames
|
|
1434
1440
|
]);
|
|
1435
1441
|
const updateExistingNodeIfChanged = useCallback2(
|
|
1436
1442
|
(variableNode) => {
|
|
@@ -1443,9 +1449,10 @@ function VariablesPlugin({
|
|
|
1443
1449
|
return;
|
|
1444
1450
|
}
|
|
1445
1451
|
const tooltip = (_d = (_c = (_b = (_a = targetVar == null ? void 0 : targetVar.tooltip) != null ? _a : targetVar == null ? void 0 : targetVar.helpText) != null ? _b : targetUndefinedVar == null ? void 0 : targetUndefinedVar.error) != null ? _c : targetUndefinedVar == null ? void 0 : targetUndefinedVar.warning) != null ? _d : targetUndefinedVar == null ? void 0 : targetUndefinedVar.info;
|
|
1452
|
+
const displayName = disableVariableDisplayNames ? prettifyBindExpression(variableNode.reference) : (targetVar == null ? void 0 : targetVar.displayName) || (targetUndefinedVar == null ? void 0 : targetUndefinedVar.displayName) || prettifyBindExpression(variableNode.reference);
|
|
1446
1453
|
const newState = {
|
|
1447
1454
|
...currentState,
|
|
1448
|
-
displayName
|
|
1455
|
+
displayName,
|
|
1449
1456
|
isLoading: isLoadingVariables && !targetVar && !(targetUndefinedVar == null ? void 0 : targetUndefinedVar.info),
|
|
1450
1457
|
hasClickEvent: canEditVariable(variableNode.reference, targetVar),
|
|
1451
1458
|
referenceIsValid: (targetUndefinedVar == null ? void 0 : targetUndefinedVar.error) ? false : (targetUndefinedVar == null ? void 0 : targetUndefinedVar.warning) ? "warning" : (targetUndefinedVar == null ? void 0 : targetUndefinedVar.info) ? "info" : isLoadingVariables ? true : Boolean(targetVar),
|
|
@@ -1456,7 +1463,7 @@ function VariablesPlugin({
|
|
|
1456
1463
|
variableNode.setState(newState);
|
|
1457
1464
|
}
|
|
1458
1465
|
},
|
|
1459
|
-
[canEditVariable]
|
|
1466
|
+
[canEditVariable, disableVariableDisplayNames]
|
|
1460
1467
|
);
|
|
1461
1468
|
useEffect4(() => {
|
|
1462
1469
|
let selection;
|
|
@@ -1465,6 +1472,7 @@ function VariablesPlugin({
|
|
|
1465
1472
|
});
|
|
1466
1473
|
editor.update(() => {
|
|
1467
1474
|
var _a;
|
|
1475
|
+
$addUpdateTag("skip-dom-selection");
|
|
1468
1476
|
$setSelection((_a = selection == null ? void 0 : selection.clone()) != null ? _a : null);
|
|
1469
1477
|
$dfs().filter(({ node }) => $isVariableNode(node)).forEach(({ node: variableNode }) => {
|
|
1470
1478
|
updateExistingNodeIfChanged(variableNode);
|
|
@@ -1614,6 +1622,14 @@ var VariableNode = class _VariableNode extends DecoratorNode {
|
|
|
1614
1622
|
updateDOM() {
|
|
1615
1623
|
return false;
|
|
1616
1624
|
}
|
|
1625
|
+
static importDOM() {
|
|
1626
|
+
return {
|
|
1627
|
+
binding: () => ({
|
|
1628
|
+
conversion: $convertBindingElement,
|
|
1629
|
+
priority: 0
|
|
1630
|
+
})
|
|
1631
|
+
};
|
|
1632
|
+
}
|
|
1617
1633
|
/**
|
|
1618
1634
|
* Render the variable node using React.
|
|
1619
1635
|
* NOTE: this is effectively an island of React, and you may not call hooks,
|
|
@@ -1623,6 +1639,21 @@ var VariableNode = class _VariableNode extends DecoratorNode {
|
|
|
1623
1639
|
return /* @__PURE__ */ jsx22(VariableNodeComponent, { state: this.__state, reference: this.reference, nodeKey: this.__key });
|
|
1624
1640
|
}
|
|
1625
1641
|
};
|
|
1642
|
+
function $convertBindingElement(domNode) {
|
|
1643
|
+
const element = domNode;
|
|
1644
|
+
const reference = element.textContent.replace(variablePrefix, "").replace(variableSuffix, "");
|
|
1645
|
+
const node = $createVariableNode(reference, {
|
|
1646
|
+
displayName: prettifyBindExpression(reference),
|
|
1647
|
+
hasClickEvent: true,
|
|
1648
|
+
referenceIsValid: true,
|
|
1649
|
+
tooltip: void 0,
|
|
1650
|
+
isFresh: true,
|
|
1651
|
+
isLoading: false
|
|
1652
|
+
});
|
|
1653
|
+
return {
|
|
1654
|
+
node
|
|
1655
|
+
};
|
|
1656
|
+
}
|
|
1626
1657
|
function $createVariableNode(variableReference, state) {
|
|
1627
1658
|
return new VariableNode(variableReference, state);
|
|
1628
1659
|
}
|
|
@@ -1806,7 +1837,7 @@ var menuBtn2 = css4`
|
|
|
1806
1837
|
transform: translateY(-50%);
|
|
1807
1838
|
`;
|
|
1808
1839
|
var input = css4`
|
|
1809
|
-
--input-padding: 12px var(--spacing-
|
|
1840
|
+
--input-padding: 12px var(--spacing-lg) 12px var(--spacing-sm);
|
|
1810
1841
|
appearance: none;
|
|
1811
1842
|
background-color: var(--white);
|
|
1812
1843
|
border: 1px solid var(--gray-300);
|
|
@@ -1943,6 +1974,7 @@ var input2 = css5`
|
|
|
1943
1974
|
&:disabled,
|
|
1944
1975
|
&:disabled::placeholder,
|
|
1945
1976
|
&:disabled:hover {
|
|
1977
|
+
border-color: var(--gray-200);
|
|
1946
1978
|
border-radius: var(--rounded-sm);
|
|
1947
1979
|
cursor: not-allowed;
|
|
1948
1980
|
color: var(--gray-400);
|
|
@@ -1952,6 +1984,7 @@ var input2 = css5`
|
|
|
1952
1984
|
&[contenteditable='false'] {
|
|
1953
1985
|
cursor: not-allowed;
|
|
1954
1986
|
color: var(--gray-400);
|
|
1987
|
+
border-color: var(--gray-200);
|
|
1955
1988
|
}
|
|
1956
1989
|
|
|
1957
1990
|
> p {
|
|
@@ -2343,7 +2376,7 @@ function VariablesComposerInput({
|
|
|
2343
2376
|
/* @__PURE__ */ jsx27(
|
|
2344
2377
|
PlainTextPlugin,
|
|
2345
2378
|
{
|
|
2346
|
-
contentEditable: /* @__PURE__ */ jsx27(ContentEditable, { ...contentEditableProps }),
|
|
2379
|
+
contentEditable: /* @__PURE__ */ jsx27(ContentEditable, { ...contentEditableProps, placeholder: null, "aria-placeholder": void 0 }),
|
|
2347
2380
|
placeholder: placeholder ? /* @__PURE__ */ jsx27(Fragment6, { children: placeholder }) : null,
|
|
2348
2381
|
ErrorBoundary: LexicalErrorBoundary
|
|
2349
2382
|
}
|
|
@@ -2458,7 +2491,8 @@ function InputVariables(props) {
|
|
|
2458
2491
|
styleVariant = "default",
|
|
2459
2492
|
renderMenuInPortal,
|
|
2460
2493
|
disableDismissEditorOnChange,
|
|
2461
|
-
singleTokenMode
|
|
2494
|
+
singleTokenMode,
|
|
2495
|
+
disableVariableDisplayNames
|
|
2462
2496
|
} = props;
|
|
2463
2497
|
const [finalId] = useState7(id != null ? id : () => v4());
|
|
2464
2498
|
const { dispatch, canDispatch, isEditing } = useVariables(true);
|
|
@@ -2481,7 +2515,7 @@ function InputVariables(props) {
|
|
|
2481
2515
|
gap: "xs",
|
|
2482
2516
|
css: css7`
|
|
2483
2517
|
position: relative;
|
|
2484
|
-
& > div:first-
|
|
2518
|
+
& > div:first-of-type {
|
|
2485
2519
|
flex-grow: 1;
|
|
2486
2520
|
}
|
|
2487
2521
|
`,
|
|
@@ -2567,6 +2601,7 @@ function InputVariables(props) {
|
|
|
2567
2601
|
replaceValueOnVariableInsert: useInputWithNoVariables,
|
|
2568
2602
|
autoFocus,
|
|
2569
2603
|
filterVariable,
|
|
2604
|
+
disableVariableDisplayNames,
|
|
2570
2605
|
children: [
|
|
2571
2606
|
/* @__PURE__ */ jsx28(PasteTransformerPlugin, { transformPaste }),
|
|
2572
2607
|
/* @__PURE__ */ jsx28(ControlledValuePlugin, { value, enabled: singleTokenMode || useInputWithNoVariables }),
|
|
@@ -2945,6 +2980,8 @@ var variableValue = css9`
|
|
|
2945
2980
|
|
|
2946
2981
|
// src/components/Variables/VariablesList.tsx
|
|
2947
2982
|
import { Fragment as Fragment8, jsx as jsx33, jsxs as jsxs16 } from "@emotion/react/jsx-runtime";
|
|
2983
|
+
var DroppableHack = Droppable;
|
|
2984
|
+
var DraggableHack = Draggable;
|
|
2948
2985
|
function VariablesList() {
|
|
2949
2986
|
const { variables, dispatch, readOnly } = useVariables();
|
|
2950
2987
|
const sorted = variablesToList(variables).filter((variable) => !variable.system);
|
|
@@ -2966,7 +3003,7 @@ function VariablesList() {
|
|
|
2966
3003
|
}
|
|
2967
3004
|
};
|
|
2968
3005
|
return /* @__PURE__ */ jsxs16(Fragment8, { children: [
|
|
2969
|
-
/* @__PURE__ */ jsx33(DragDropContext, { onDragEnd: (res) => onDragEnd(res), children: /* @__PURE__ */ jsx33(
|
|
3006
|
+
/* @__PURE__ */ jsx33(DragDropContext, { onDragEnd: (res) => onDragEnd(res), children: /* @__PURE__ */ jsx33(DroppableHack, { droppableId: "variables-table", children: (provided) => /* @__PURE__ */ jsxs16(Table, { ...provided.droppableProps, ref: provided.innerRef, children: [
|
|
2970
3007
|
/* @__PURE__ */ jsx33(TableHead, { children: /* @__PURE__ */ jsxs16(TableRow, { children: [
|
|
2971
3008
|
/* @__PURE__ */ jsx33(TableCellHead, { children: "Name" }),
|
|
2972
3009
|
/* @__PURE__ */ jsx33(TableCellHead, { children: "Default Value" }),
|
|
@@ -2977,7 +3014,7 @@ function VariablesList() {
|
|
|
2977
3014
|
const text = displayName != null ? displayName : name2;
|
|
2978
3015
|
const textValue = variableDefaultTextValue(defaultValue);
|
|
2979
3016
|
return /* @__PURE__ */ jsx33(
|
|
2980
|
-
|
|
3017
|
+
DraggableHack,
|
|
2981
3018
|
{
|
|
2982
3019
|
draggableId: name2,
|
|
2983
3020
|
index,
|
|
@@ -3592,8 +3629,8 @@ function urlEncodeRequestParameter(parameter, varValues) {
|
|
|
3592
3629
|
value: decodeVariablesInUrlEncodedString(encodeURIComponent(parameter.value), varValues)
|
|
3593
3630
|
};
|
|
3594
3631
|
}
|
|
3595
|
-
function decodeVariablesInUrlEncodedString(
|
|
3596
|
-
return
|
|
3632
|
+
function decodeVariablesInUrlEncodedString(string2, varValues) {
|
|
3633
|
+
return string2.replace(/(\$|%24)%7B(.*?)%7D/g, (_all, _money, body) => {
|
|
3597
3634
|
var _a;
|
|
3598
3635
|
const varName = decodeURIComponent(body);
|
|
3599
3636
|
return ((_a = varValues == null ? void 0 : varValues[varName]) == null ? void 0 : _a.default) ? variableDefaultTextValue(varValues[varName].default) : `\${${varName}}`;
|
|
@@ -3926,7 +3963,7 @@ var DataRefreshButton = ({
|
|
|
3926
3963
|
onRefreshData,
|
|
3927
3964
|
...props
|
|
3928
3965
|
}) => {
|
|
3929
|
-
return /* @__PURE__ */ jsxs22(Button2, { buttonType: "
|
|
3966
|
+
return /* @__PURE__ */ jsxs22(Button2, { buttonType: "ghost", onClick: onRefreshData, disabled: isLoading, ...props, children: [
|
|
3930
3967
|
!isLoading ? null : /* @__PURE__ */ jsx47(
|
|
3931
3968
|
LoadingIndicator3,
|
|
3932
3969
|
{
|
|
@@ -4200,7 +4237,7 @@ var ObjectSearchListItem = ({
|
|
|
4200
4237
|
),
|
|
4201
4238
|
/* @__PURE__ */ jsxs23("div", { css: ObjectListItemInfoContainer, children: [
|
|
4202
4239
|
selected ? /* @__PURE__ */ jsx49(Chip, { text: "selected", size: "xs" }) : null,
|
|
4203
|
-
!popoverData ? null : /* @__PURE__ */ jsx49(Popover, { ariaLabel: title, buttonText: `See ${title} details`,
|
|
4240
|
+
!popoverData ? null : /* @__PURE__ */ jsx49(Popover, { ariaLabel: title, buttonText: `See ${title} details`, children: popoverData })
|
|
4204
4241
|
] }),
|
|
4205
4242
|
!children ? null : /* @__PURE__ */ jsx49("div", { css: ObjectListItemUnControlledContent, children })
|
|
4206
4243
|
]
|
|
@@ -4230,7 +4267,6 @@ var ObjectSearchContainer = ({
|
|
|
4230
4267
|
role: "list",
|
|
4231
4268
|
css: css16`
|
|
4232
4269
|
> div {
|
|
4233
|
-
transition: max-height var(--duration-slow) var(--timing-ease-out);
|
|
4234
4270
|
max-height: ${selectedListItems.length === 0 ? "50vh" : "184px"};
|
|
4235
4271
|
}
|
|
4236
4272
|
`,
|
|
@@ -4396,7 +4432,7 @@ var ObjectSearchFilterContainer2 = ({ children }) => {
|
|
|
4396
4432
|
};
|
|
4397
4433
|
|
|
4398
4434
|
// src/components/ObjectSearch/ObjectSearchResultItem.tsx
|
|
4399
|
-
import { Button as Button3, Chip as Chip2, Popover as Popover2 } from "@uniformdev/design-system";
|
|
4435
|
+
import { Button as Button3, Chip as Chip2, Link, Popover as Popover2 } from "@uniformdev/design-system";
|
|
4400
4436
|
import { format as timeagoFormat } from "timeago.js";
|
|
4401
4437
|
|
|
4402
4438
|
// src/components/Image/Image.tsx
|
|
@@ -4508,6 +4544,11 @@ var ObjectSearchResultItemTimeStamp = css19`
|
|
|
4508
4544
|
color: var(--gray-500);
|
|
4509
4545
|
font-size: var(--fs-xs);
|
|
4510
4546
|
`;
|
|
4547
|
+
var ObjectSearchResultItemTitleLink = css19`
|
|
4548
|
+
text-decoration: none;
|
|
4549
|
+
color: var(--primary-action-default);
|
|
4550
|
+
font-size: var(--fs-sm);
|
|
4551
|
+
`;
|
|
4511
4552
|
var ObjectSearchAuthorStateGroup = css19`
|
|
4512
4553
|
align-items: center;
|
|
4513
4554
|
display: flex;
|
|
@@ -4542,7 +4583,8 @@ var ObjectSearchResultItem = ({
|
|
|
4542
4583
|
publishedAt,
|
|
4543
4584
|
hideRemoveButton = false,
|
|
4544
4585
|
disableDnD = false,
|
|
4545
|
-
children
|
|
4586
|
+
children,
|
|
4587
|
+
onClick
|
|
4546
4588
|
}) => {
|
|
4547
4589
|
const { onSelectItem } = useObjectSearchContext();
|
|
4548
4590
|
const formatedContentType = Array.isArray(contentType) ? contentType.join(", ") : contentType;
|
|
@@ -4565,7 +4607,19 @@ var ObjectSearchResultItem = ({
|
|
|
4565
4607
|
/* @__PURE__ */ jsxs27("div", { children: [
|
|
4566
4608
|
/* @__PURE__ */ jsx55("span", { css: ObjectSearchResultItemSubtitle, "data-testid": "sub-title", children: formatedContentType }),
|
|
4567
4609
|
/* @__PURE__ */ jsxs27("span", { role: "heading", css: ObjectSearchResultItemTitle, "data-testid": "title", children: [
|
|
4568
|
-
|
|
4610
|
+
onClick ? /* @__PURE__ */ jsx55(
|
|
4611
|
+
Link,
|
|
4612
|
+
{
|
|
4613
|
+
onClick: (e) => {
|
|
4614
|
+
e.preventDefault();
|
|
4615
|
+
e.stopPropagation();
|
|
4616
|
+
onClick();
|
|
4617
|
+
},
|
|
4618
|
+
href: editLink,
|
|
4619
|
+
text: title != null ? title : name,
|
|
4620
|
+
css: ObjectSearchResultItemTitleLink
|
|
4621
|
+
}
|
|
4622
|
+
) : /* @__PURE__ */ jsx55("span", { children: title != null ? title : name }),
|
|
4569
4623
|
!popoverData ? null : /* @__PURE__ */ jsx55(Popover2, { ariaLabel: title, buttonText: `See ${title} details`, children: popoverData })
|
|
4570
4624
|
] }),
|
|
4571
4625
|
!createdAt && !publishStatus ? null : /* @__PURE__ */ jsxs27("div", { css: ObjectSearchAuthorStateGroup, children: [
|
|
@@ -4607,7 +4661,10 @@ function legacyThemeMapper(theme) {
|
|
|
4607
4661
|
|
|
4608
4662
|
// src/components/ObjectSearch/ObjectSearchResultList.tsx
|
|
4609
4663
|
import { Button as Button4, Counter } from "@uniformdev/design-system";
|
|
4610
|
-
import {
|
|
4664
|
+
import {
|
|
4665
|
+
Draggable as Draggable2,
|
|
4666
|
+
Droppable as Droppable2
|
|
4667
|
+
} from "react-beautiful-dnd";
|
|
4611
4668
|
|
|
4612
4669
|
// src/components/ObjectSearch/styles/ObjectSearchResultList.styles.ts
|
|
4613
4670
|
import { css as css20 } from "@emotion/react";
|
|
@@ -4636,6 +4693,8 @@ var ObjectSearchResultListTitle = css20`
|
|
|
4636
4693
|
|
|
4637
4694
|
// src/components/ObjectSearch/ObjectSearchResultList.tsx
|
|
4638
4695
|
import { Fragment as Fragment10, jsx as jsx56, jsxs as jsxs28 } from "@emotion/react/jsx-runtime";
|
|
4696
|
+
var DroppableHack2 = Droppable2;
|
|
4697
|
+
var DraggableHack2 = Draggable2;
|
|
4639
4698
|
function ObjectSearchResultList({
|
|
4640
4699
|
resultLabelText = "Selected",
|
|
4641
4700
|
removeButtonText = "Remove all",
|
|
@@ -4707,7 +4766,7 @@ function ObjectSearchResultList({
|
|
|
4707
4766
|
] })
|
|
4708
4767
|
] }),
|
|
4709
4768
|
!selectedListItems.length ? whenNothingSelected : /* @__PURE__ */ jsx56(DragDropContext, { onDragEnd: (res) => onDragEnd(res), children: /* @__PURE__ */ jsx56(
|
|
4710
|
-
|
|
4769
|
+
DroppableHack2,
|
|
4711
4770
|
{
|
|
4712
4771
|
droppableId: multiSelectId != null ? multiSelectId : "canvas-multi-select",
|
|
4713
4772
|
renderClone: getContainerForDnDReparenting ? getDraggableItem : void 0,
|
|
@@ -4715,7 +4774,7 @@ function ObjectSearchResultList({
|
|
|
4715
4774
|
children: (provided) => /* @__PURE__ */ jsxs28("div", { ...provided.droppableProps, ref: provided.innerRef, children: [
|
|
4716
4775
|
selectedListItems.map((item, i) => {
|
|
4717
4776
|
return /* @__PURE__ */ jsx56(
|
|
4718
|
-
|
|
4777
|
+
DraggableHack2,
|
|
4719
4778
|
{
|
|
4720
4779
|
draggableId: item.id,
|
|
4721
4780
|
index: i,
|
|
@@ -5165,18 +5224,6 @@ var DATE_TIME_OPERATORS = [
|
|
|
5165
5224
|
value: "sys-date-gte",
|
|
5166
5225
|
editorType: "date",
|
|
5167
5226
|
expectedValueType: "single"
|
|
5168
|
-
},
|
|
5169
|
-
{
|
|
5170
|
-
label: "is empty",
|
|
5171
|
-
value: "ndef",
|
|
5172
|
-
editorType: "empty",
|
|
5173
|
-
expectedValueType: "false"
|
|
5174
|
-
},
|
|
5175
|
-
{
|
|
5176
|
-
label: "is not empty",
|
|
5177
|
-
value: "def",
|
|
5178
|
-
editorType: "empty",
|
|
5179
|
-
expectedValueType: "true"
|
|
5180
5227
|
}
|
|
5181
5228
|
];
|
|
5182
5229
|
var RICHTEXT_OPERATORS = [
|
|
@@ -6212,8 +6259,6 @@ var SearchAndFilterOptionsContainer = css21`
|
|
|
6212
6259
|
gap: var(--spacing-sm);
|
|
6213
6260
|
padding: var(--spacing-md) 0 var(--spacing-base);
|
|
6214
6261
|
will-change: height;
|
|
6215
|
-
position: relative;
|
|
6216
|
-
z-index: 2;
|
|
6217
6262
|
`;
|
|
6218
6263
|
var SearchAndFilterOptionsInnerContainer = css21`
|
|
6219
6264
|
display: flex;
|
|
@@ -6232,8 +6277,6 @@ var SearchAndFilterAdditionalContainer = css21`
|
|
|
6232
6277
|
flex-wrap: nowrap;
|
|
6233
6278
|
gap: var(--spacing-base);
|
|
6234
6279
|
padding: var(--spacing-base) var(--spacing-md) 0;
|
|
6235
|
-
position: relative;
|
|
6236
|
-
z-index: 0;
|
|
6237
6280
|
`;
|
|
6238
6281
|
|
|
6239
6282
|
// src/components/SearchAndFilter/FilterButton.tsx
|
|
@@ -6320,6 +6363,7 @@ function withInputVariables(WrappedComponent, noSwapping = false) {
|
|
|
6320
6363
|
return /* @__PURE__ */ jsx72(
|
|
6321
6364
|
InputVariables,
|
|
6322
6365
|
{
|
|
6366
|
+
"data-testid": "filter-value",
|
|
6323
6367
|
disableInlineMenu: true,
|
|
6324
6368
|
showMenuPosition: "inline-right",
|
|
6325
6369
|
onChange: (newValue) => props.onChange(newValue != null ? newValue : ""),
|
|
@@ -6340,6 +6384,7 @@ function withInputVariablesForMultiValue(WrappedComponent) {
|
|
|
6340
6384
|
return /* @__PURE__ */ jsx72(
|
|
6341
6385
|
InputVariables,
|
|
6342
6386
|
{
|
|
6387
|
+
"data-testid": "filter-value",
|
|
6343
6388
|
disableInlineMenu: true,
|
|
6344
6389
|
showMenuPosition: "inline-right",
|
|
6345
6390
|
onChange: (newValue) => props.onChange(newValue ? [newValue] : []),
|
|
@@ -6392,6 +6437,7 @@ var SearchAndFilterProvider = ({
|
|
|
6392
6437
|
onSearchChange,
|
|
6393
6438
|
onChange,
|
|
6394
6439
|
resetFilterValues = [{ field: "", operator: "", value: "" }],
|
|
6440
|
+
onResetFilterValues,
|
|
6395
6441
|
totalResults,
|
|
6396
6442
|
filterMapper: filterMapper2 = filterMapper,
|
|
6397
6443
|
children,
|
|
@@ -6420,9 +6466,12 @@ var SearchAndFilterProvider = ({
|
|
|
6420
6466
|
onChange([...filters, { field: "", operator: "", value: "" }]);
|
|
6421
6467
|
}, [filters, onChange]);
|
|
6422
6468
|
const handleResetFilters = useCallback6(() => {
|
|
6469
|
+
if (onResetFilterValues) {
|
|
6470
|
+
return onResetFilterValues();
|
|
6471
|
+
}
|
|
6423
6472
|
onSearchChange == null ? void 0 : onSearchChange("");
|
|
6424
6473
|
onChange(resetFilterValues);
|
|
6425
|
-
}, [onChange, resetFilterValues, onSearchChange]);
|
|
6474
|
+
}, [onChange, resetFilterValues, onSearchChange, onResetFilterValues]);
|
|
6426
6475
|
const handleDeleteFilter = useCallback6(
|
|
6427
6476
|
(index) => {
|
|
6428
6477
|
const remainingFilters = filters.filter((_, i) => i !== index);
|
|
@@ -6494,17 +6543,17 @@ var FilterControls = ({
|
|
|
6494
6543
|
const editorRef = useRef9(null);
|
|
6495
6544
|
const variableRefernceCountInSearchTerm = hasReferencedVariables2(searchTerm);
|
|
6496
6545
|
const [idToResetInputVariables, setIdToResetInputVariables] = useState20("data-resource-search-term-input");
|
|
6497
|
-
const [
|
|
6546
|
+
const [localSearchTerm, setLocalSearchTerm] = useState20(searchTerm);
|
|
6498
6547
|
useDebounce7(
|
|
6499
6548
|
() => {
|
|
6500
|
-
setSearchTerm(
|
|
6549
|
+
setSearchTerm(localSearchTerm);
|
|
6501
6550
|
},
|
|
6502
6551
|
300,
|
|
6503
|
-
[
|
|
6552
|
+
[localSearchTerm]
|
|
6504
6553
|
);
|
|
6505
6554
|
useEffect18(() => {
|
|
6506
6555
|
if (searchTerm === "") {
|
|
6507
|
-
|
|
6556
|
+
setLocalSearchTerm("");
|
|
6508
6557
|
setIdToResetInputVariables(`data-resource-search-term-input-${v42()}`);
|
|
6509
6558
|
}
|
|
6510
6559
|
}, [searchTerm]);
|
|
@@ -6522,7 +6571,7 @@ var FilterControls = ({
|
|
|
6522
6571
|
dataTestId: "filters-button"
|
|
6523
6572
|
}
|
|
6524
6573
|
),
|
|
6525
|
-
hideSearchInput ? null : /* @__PURE__ */ jsxs33("div", { css: BindableKeywordSearchInputStyles, children: [
|
|
6574
|
+
hideSearchInput ? null : /* @__PURE__ */ jsxs33("div", { css: BindableKeywordSearchInputStyles, "data-testid": "search-container", children: [
|
|
6526
6575
|
/* @__PURE__ */ jsx74(
|
|
6527
6576
|
InputVariables,
|
|
6528
6577
|
{
|
|
@@ -6530,18 +6579,24 @@ var FilterControls = ({
|
|
|
6530
6579
|
id: idToResetInputVariables,
|
|
6531
6580
|
showMenuPosition: "inline-right",
|
|
6532
6581
|
editorRef,
|
|
6533
|
-
value:
|
|
6534
|
-
onChange: (value) =>
|
|
6582
|
+
value: localSearchTerm,
|
|
6583
|
+
onChange: (value) => setLocalSearchTerm(value != null ? value : ""),
|
|
6535
6584
|
disableVariables: !allowBindingSearchTerm,
|
|
6536
6585
|
inputWhenNoVariables: /* @__PURE__ */ jsx74(
|
|
6537
6586
|
InputKeywordSearch,
|
|
6538
6587
|
{
|
|
6539
6588
|
placeholder: "Search...",
|
|
6540
|
-
onSearchTextChanged: (e) =>
|
|
6541
|
-
value:
|
|
6589
|
+
onSearchTextChanged: (e) => setLocalSearchTerm(e),
|
|
6590
|
+
value: localSearchTerm,
|
|
6542
6591
|
compact: true,
|
|
6543
6592
|
rounded: true,
|
|
6544
|
-
css: SearchInput
|
|
6593
|
+
css: SearchInput,
|
|
6594
|
+
onKeyPress: (e) => {
|
|
6595
|
+
if (e.key === "Enter") {
|
|
6596
|
+
e.preventDefault();
|
|
6597
|
+
e.stopPropagation();
|
|
6598
|
+
}
|
|
6599
|
+
}
|
|
6545
6600
|
}
|
|
6546
6601
|
)
|
|
6547
6602
|
}
|
|
@@ -6551,7 +6606,7 @@ var FilterControls = ({
|
|
|
6551
6606
|
{
|
|
6552
6607
|
css: ClearSearchButtonStyles,
|
|
6553
6608
|
onClick: () => {
|
|
6554
|
-
|
|
6609
|
+
setLocalSearchTerm("");
|
|
6555
6610
|
if (editorRef.current) {
|
|
6556
6611
|
if (editorRef.current.getRootElement() !== document.activeElement) {
|
|
6557
6612
|
editorRef.current.dispatchCommand(CLEAR_EDITOR_COMMAND2, void 0);
|
|
@@ -6988,15 +7043,36 @@ var SearchAndFilterResultContainer = ({
|
|
|
6988
7043
|
hideClearButton
|
|
6989
7044
|
}) => {
|
|
6990
7045
|
const { searchTerm, totalResults, filters, handleResetFilters, setSearchTerm } = useSearchAndFilter();
|
|
6991
|
-
const
|
|
6992
|
-
|
|
6993
|
-
|
|
7046
|
+
const emptyFilters = filters.length === 0 || filters.every((filter) => !filter.value);
|
|
7047
|
+
const getTextValue = ({
|
|
7048
|
+
defaultPropText,
|
|
7049
|
+
searchText,
|
|
7050
|
+
filterText,
|
|
7051
|
+
fallbackText
|
|
7052
|
+
}) => {
|
|
7053
|
+
if (defaultPropText) {
|
|
7054
|
+
return defaultPropText;
|
|
7055
|
+
}
|
|
7056
|
+
if (searchTerm && emptyFilters) {
|
|
7057
|
+
return searchText;
|
|
6994
7058
|
}
|
|
6995
|
-
if (
|
|
6996
|
-
return
|
|
7059
|
+
if (!emptyFilters && !searchTerm) {
|
|
7060
|
+
return filterText;
|
|
6997
7061
|
}
|
|
6998
|
-
return
|
|
7062
|
+
return fallbackText;
|
|
6999
7063
|
};
|
|
7064
|
+
const clearButtonText = getTextValue({
|
|
7065
|
+
defaultPropText: buttonText,
|
|
7066
|
+
searchText: "Clear search",
|
|
7067
|
+
filterText: "Clear filters",
|
|
7068
|
+
fallbackText: "Clear results"
|
|
7069
|
+
});
|
|
7070
|
+
const automateCalloutTitle = getTextValue({
|
|
7071
|
+
defaultPropText: calloutTitle,
|
|
7072
|
+
searchText: "No search results found",
|
|
7073
|
+
filterText: "No results match the selected filters",
|
|
7074
|
+
fallbackText: "No matching results found"
|
|
7075
|
+
});
|
|
7000
7076
|
if (totalResults && totalResults > 0) {
|
|
7001
7077
|
return null;
|
|
7002
7078
|
}
|
|
@@ -7017,7 +7093,7 @@ var SearchAndFilterResultContainer = ({
|
|
|
7017
7093
|
] }),
|
|
7018
7094
|
!searchTerm || hideClearButton ? null : /* @__PURE__ */ jsx78(Button5, { buttonType: "ghostDestructive", size: "zero", onClick: handleClearSearch, children: clearButtonLabel })
|
|
7019
7095
|
] }),
|
|
7020
|
-
totalResults === 0 ? /* @__PURE__ */ jsxs37(Callout4, { title:
|
|
7096
|
+
totalResults === 0 ? /* @__PURE__ */ jsxs37(Callout4, { title: automateCalloutTitle, type: "note", children: [
|
|
7021
7097
|
calloutText ? /* @__PURE__ */ jsx78(Paragraph, { children: calloutText }) : null,
|
|
7022
7098
|
hideClearButton ? null : /* @__PURE__ */ jsx78(
|
|
7023
7099
|
Button5,
|
|
@@ -7026,7 +7102,7 @@ var SearchAndFilterResultContainer = ({
|
|
|
7026
7102
|
size: "xs",
|
|
7027
7103
|
onClick: handleClearSearch,
|
|
7028
7104
|
"data-testid": "clear-search",
|
|
7029
|
-
children:
|
|
7105
|
+
children: clearButtonText
|
|
7030
7106
|
}
|
|
7031
7107
|
)
|
|
7032
7108
|
] }) : null
|
|
@@ -7049,7 +7125,8 @@ var SearchAndFilter = ({
|
|
|
7049
7125
|
onSearchChange,
|
|
7050
7126
|
totalResults,
|
|
7051
7127
|
allowBindingSearchTerm = false,
|
|
7052
|
-
resetFilterValues = []
|
|
7128
|
+
resetFilterValues = [],
|
|
7129
|
+
onResetFilterValues
|
|
7053
7130
|
}) => {
|
|
7054
7131
|
return /* @__PURE__ */ jsx79(
|
|
7055
7132
|
SearchAndFilterProvider,
|
|
@@ -7064,6 +7141,7 @@ var SearchAndFilter = ({
|
|
|
7064
7141
|
resetFilterValues,
|
|
7065
7142
|
filterMapper: filterMapper2,
|
|
7066
7143
|
allowBindingSearchTerm,
|
|
7144
|
+
onResetFilterValues,
|
|
7067
7145
|
children: /* @__PURE__ */ jsxs38(VerticalRhythm7, { "data-testid": "search-and-filter", children: [
|
|
7068
7146
|
/* @__PURE__ */ jsxs38("div", { css: SearchAndFilterOutterControlWrapper(viewSwitchControls ? "1fr auto" : "1fr"), children: [
|
|
7069
7147
|
/* @__PURE__ */ jsx79(
|