@uniformdev/mesh-sdk-react 20.7.1-alpha.81 → 20.7.1-alpha.85
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 +13 -2
- package/dist/index.d.ts +13 -2
- package/dist/index.esm.js +57 -18
- package/dist/index.js +60 -24
- package/dist/index.mjs +57 -18
- package/package.json +8 -8
package/dist/index.d.mts
CHANGED
|
@@ -8,7 +8,7 @@ import { DataVariableDefinition, DataResourceVariables, DataType, DataSourceVari
|
|
|
8
8
|
import { Emitter } from 'mitt';
|
|
9
9
|
import { TDate } from 'timeago.js';
|
|
10
10
|
import * as lexical from 'lexical';
|
|
11
|
-
import { SerializedEditorState, SerializedLexicalNode, Spread, DecoratorNode, NodeKey, LexicalNode, LexicalEditor, EditorState, SerializedRootNode } from 'lexical';
|
|
11
|
+
import { SerializedEditorState, SerializedLexicalNode, Spread, DecoratorNode, NodeKey, DOMConversionMap, LexicalNode, LexicalEditor, EditorState, SerializedRootNode } from 'lexical';
|
|
12
12
|
import { Interpolation, Theme, SerializedStyles } from '@emotion/react';
|
|
13
13
|
import { InputSelectProps, IconType } from '@uniformdev/design-system';
|
|
14
14
|
export { AddListButton, AddListButtonProps, Button, ButtonProps, Callout, CalloutProps, DrawerContent, Heading, HeadingProps, Input, InputComboBox, InputComboBoxProps, InputKeywordSearch, InputProps, InputSelect, InputToggle, InputToggleProps, Label, LabelProps, LoadingIndicator, LoadingOverlay, Menu, MenuItem, MenuItemProps, MenuProps, ParameterGroup, ParameterGroupProps, ParameterImage, ParameterImageInner, ParameterImageProps, ParameterInput, ParameterInputInner, ParameterInputProps, ParameterLabel, ParameterLabelProps, ParameterMenuButton, ParameterMenuButtonProps, ParameterSelect, ParameterSelectInner, ParameterSelectProps, ParameterShell, ParameterShellContext, ParameterShellProps, ParameterTextarea, ParameterTextareaInner, ParameterTextareaProps, ParameterToggle, ParameterToggleInner, ParameterToggleProps, ScrollableList, ScrollableListItem, ScrollableListItemProps, ScrollableListProps, Switch, SwitchProps, Textarea, TextareaProps, Theme, ThemeProps, useParameterShell, utilityColors } from '@uniformdev/design-system';
|
|
@@ -248,6 +248,7 @@ declare class VariableNode extends DecoratorNode<JSX.Element> {
|
|
|
248
248
|
/** Creates the DOM wrapper that hosts the node */
|
|
249
249
|
createDOM(): HTMLSpanElement;
|
|
250
250
|
updateDOM(): boolean;
|
|
251
|
+
static importDOM(): DOMConversionMap | null;
|
|
251
252
|
/**
|
|
252
253
|
* Render the variable node using React.
|
|
253
254
|
* NOTE: this is effectively an island of React, and you may not call hooks,
|
|
@@ -415,6 +416,11 @@ type VariablesPluginProps<TEditorContext = unknown> = {
|
|
|
415
416
|
filterVariable?: SelectVariableMenuProps<TEditorContext>['filterVariable'];
|
|
416
417
|
/** If true, the whole value of the editor is replaced when a variable is inserted */
|
|
417
418
|
replaceValueOnVariableInsert: boolean;
|
|
419
|
+
/**
|
|
420
|
+
* Disables display names for variables; the variable's (prettified) name is used instead even if a DN exists
|
|
421
|
+
* Use this to render dynamic tokens as paths instead of bound values.
|
|
422
|
+
*/
|
|
423
|
+
disableVariableDisplayNames?: boolean;
|
|
418
424
|
};
|
|
419
425
|
type UseVariablesMenuInput<TEditorContext> = Pick<VariablesPluginProps<TEditorContext>, 'showAddVariableMenuOption' | 'enableEditingVariables' | 'filterVariable' | 'getEditorContext'>;
|
|
420
426
|
type OnVariableSelectInput = {
|
|
@@ -435,7 +441,7 @@ declare function useVariablesMenu<TEditorContext>({ showAddVariableMenuOption, e
|
|
|
435
441
|
* Enables variables auto-complete and reference management to a Lexical editor.
|
|
436
442
|
* Must also activate the VariableNode node to make this work.
|
|
437
443
|
*/
|
|
438
|
-
declare function VariablesPlugin<TEditorContext = unknown>({ disableVariables, showAddVariableMenuOption, enableEditingVariables, getEditorContext, replaceValueOnVariableInsert, filterVariable, }: VariablesPluginProps<TEditorContext>): JSX.Element | null;
|
|
444
|
+
declare function VariablesPlugin<TEditorContext = unknown>({ disableVariables, showAddVariableMenuOption, enableEditingVariables, getEditorContext, replaceValueOnVariableInsert, filterVariable, disableVariableDisplayNames, }: VariablesPluginProps<TEditorContext>): JSX.Element | null;
|
|
439
445
|
|
|
440
446
|
type PasteTransformerPluginProps = {
|
|
441
447
|
/**
|
|
@@ -552,6 +558,11 @@ type InputVariablesProps<TEditorContext = unknown> = {
|
|
|
552
558
|
* any existing value on insert a new dynamic token.
|
|
553
559
|
*/
|
|
554
560
|
singleTokenMode?: boolean;
|
|
561
|
+
/**
|
|
562
|
+
* Disables display names for variables; the variable's (prettified) name is used instead even if a DN exists
|
|
563
|
+
* Use this to render dynamic tokens as paths instead of bound values.
|
|
564
|
+
*/
|
|
565
|
+
disableVariableDisplayNames?: boolean;
|
|
555
566
|
} & PasteTransformerPluginProps & UseInputVariablesStateProps<TEditorContext>;
|
|
556
567
|
/**
|
|
557
568
|
* An input box that enables insertion of 'variables', provided by VariablesProvider,
|
package/dist/index.d.ts
CHANGED
|
@@ -8,7 +8,7 @@ import { DataVariableDefinition, DataResourceVariables, DataType, DataSourceVari
|
|
|
8
8
|
import { Emitter } from 'mitt';
|
|
9
9
|
import { TDate } from 'timeago.js';
|
|
10
10
|
import * as lexical from 'lexical';
|
|
11
|
-
import { SerializedEditorState, SerializedLexicalNode, Spread, DecoratorNode, NodeKey, LexicalNode, LexicalEditor, EditorState, SerializedRootNode } from 'lexical';
|
|
11
|
+
import { SerializedEditorState, SerializedLexicalNode, Spread, DecoratorNode, NodeKey, DOMConversionMap, LexicalNode, LexicalEditor, EditorState, SerializedRootNode } from 'lexical';
|
|
12
12
|
import { Interpolation, Theme, SerializedStyles } from '@emotion/react';
|
|
13
13
|
import { InputSelectProps, IconType } from '@uniformdev/design-system';
|
|
14
14
|
export { AddListButton, AddListButtonProps, Button, ButtonProps, Callout, CalloutProps, DrawerContent, Heading, HeadingProps, Input, InputComboBox, InputComboBoxProps, InputKeywordSearch, InputProps, InputSelect, InputToggle, InputToggleProps, Label, LabelProps, LoadingIndicator, LoadingOverlay, Menu, MenuItem, MenuItemProps, MenuProps, ParameterGroup, ParameterGroupProps, ParameterImage, ParameterImageInner, ParameterImageProps, ParameterInput, ParameterInputInner, ParameterInputProps, ParameterLabel, ParameterLabelProps, ParameterMenuButton, ParameterMenuButtonProps, ParameterSelect, ParameterSelectInner, ParameterSelectProps, ParameterShell, ParameterShellContext, ParameterShellProps, ParameterTextarea, ParameterTextareaInner, ParameterTextareaProps, ParameterToggle, ParameterToggleInner, ParameterToggleProps, ScrollableList, ScrollableListItem, ScrollableListItemProps, ScrollableListProps, Switch, SwitchProps, Textarea, TextareaProps, Theme, ThemeProps, useParameterShell, utilityColors } from '@uniformdev/design-system';
|
|
@@ -248,6 +248,7 @@ declare class VariableNode extends DecoratorNode<JSX.Element> {
|
|
|
248
248
|
/** Creates the DOM wrapper that hosts the node */
|
|
249
249
|
createDOM(): HTMLSpanElement;
|
|
250
250
|
updateDOM(): boolean;
|
|
251
|
+
static importDOM(): DOMConversionMap | null;
|
|
251
252
|
/**
|
|
252
253
|
* Render the variable node using React.
|
|
253
254
|
* NOTE: this is effectively an island of React, and you may not call hooks,
|
|
@@ -415,6 +416,11 @@ type VariablesPluginProps<TEditorContext = unknown> = {
|
|
|
415
416
|
filterVariable?: SelectVariableMenuProps<TEditorContext>['filterVariable'];
|
|
416
417
|
/** If true, the whole value of the editor is replaced when a variable is inserted */
|
|
417
418
|
replaceValueOnVariableInsert: boolean;
|
|
419
|
+
/**
|
|
420
|
+
* Disables display names for variables; the variable's (prettified) name is used instead even if a DN exists
|
|
421
|
+
* Use this to render dynamic tokens as paths instead of bound values.
|
|
422
|
+
*/
|
|
423
|
+
disableVariableDisplayNames?: boolean;
|
|
418
424
|
};
|
|
419
425
|
type UseVariablesMenuInput<TEditorContext> = Pick<VariablesPluginProps<TEditorContext>, 'showAddVariableMenuOption' | 'enableEditingVariables' | 'filterVariable' | 'getEditorContext'>;
|
|
420
426
|
type OnVariableSelectInput = {
|
|
@@ -435,7 +441,7 @@ declare function useVariablesMenu<TEditorContext>({ showAddVariableMenuOption, e
|
|
|
435
441
|
* Enables variables auto-complete and reference management to a Lexical editor.
|
|
436
442
|
* Must also activate the VariableNode node to make this work.
|
|
437
443
|
*/
|
|
438
|
-
declare function VariablesPlugin<TEditorContext = unknown>({ disableVariables, showAddVariableMenuOption, enableEditingVariables, getEditorContext, replaceValueOnVariableInsert, filterVariable, }: VariablesPluginProps<TEditorContext>): JSX.Element | null;
|
|
444
|
+
declare function VariablesPlugin<TEditorContext = unknown>({ disableVariables, showAddVariableMenuOption, enableEditingVariables, getEditorContext, replaceValueOnVariableInsert, filterVariable, disableVariableDisplayNames, }: VariablesPluginProps<TEditorContext>): JSX.Element | null;
|
|
439
445
|
|
|
440
446
|
type PasteTransformerPluginProps = {
|
|
441
447
|
/**
|
|
@@ -552,6 +558,11 @@ type InputVariablesProps<TEditorContext = unknown> = {
|
|
|
552
558
|
* any existing value on insert a new dynamic token.
|
|
553
559
|
*/
|
|
554
560
|
singleTokenMode?: boolean;
|
|
561
|
+
/**
|
|
562
|
+
* Disables display names for variables; the variable's (prettified) name is used instead even if a DN exists
|
|
563
|
+
* Use this to render dynamic tokens as paths instead of bound values.
|
|
564
|
+
*/
|
|
565
|
+
disableVariableDisplayNames?: boolean;
|
|
555
566
|
} & PasteTransformerPluginProps & UseInputVariablesStateProps<TEditorContext>;
|
|
556
567
|
/**
|
|
557
568
|
* An input box that enables insertion of 'variables', provided by VariablesProvider,
|
package/dist/index.esm.js
CHANGED
|
@@ -774,7 +774,7 @@ import { zodResolver } from "@hookform/resolvers/zod";
|
|
|
774
774
|
import { Button, Callout, HorizontalRhythm, Input, useShortcut } from "@uniformdev/design-system";
|
|
775
775
|
import { useLayoutEffect, useRef as useRef2 } from "react";
|
|
776
776
|
import { useForm } from "react-hook-form";
|
|
777
|
-
import
|
|
777
|
+
import * as z from "zod";
|
|
778
778
|
|
|
779
779
|
// src/components/Variables/styles/VariableEditor.styles.ts
|
|
780
780
|
import { css as css2 } from "@emotion/react";
|
|
@@ -1244,7 +1244,8 @@ function VariablesPlugin({
|
|
|
1244
1244
|
enableEditingVariables,
|
|
1245
1245
|
getEditorContext,
|
|
1246
1246
|
replaceValueOnVariableInsert,
|
|
1247
|
-
filterVariable
|
|
1247
|
+
filterVariable,
|
|
1248
|
+
disableVariableDisplayNames
|
|
1248
1249
|
}) {
|
|
1249
1250
|
const [editor] = useLexicalComposerContext2();
|
|
1250
1251
|
const { variables, dispatch, isEditing, canDispatch, readOnly, knownUndefinedValues, isLoading } = useVariables(true);
|
|
@@ -1322,9 +1323,10 @@ function VariablesPlugin({
|
|
|
1322
1323
|
});
|
|
1323
1324
|
return;
|
|
1324
1325
|
}
|
|
1326
|
+
const initialDisplayName = disableVariableDisplayNames ? prettifyBindExpression(result.selectedVariable.name) : result.selectedVariable.displayName;
|
|
1325
1327
|
editor.dispatchCommand(INSERT_VARIABLE_COMMAND, {
|
|
1326
1328
|
variable: result.selectedVariable.name,
|
|
1327
|
-
initialDisplayName
|
|
1329
|
+
initialDisplayName,
|
|
1328
1330
|
targetKey: sourceKey,
|
|
1329
1331
|
overwriteExistingValue: replaceValueOnVariableInsert
|
|
1330
1332
|
});
|
|
@@ -1372,9 +1374,10 @@ function VariablesPlugin({
|
|
|
1372
1374
|
if (result.canceled) {
|
|
1373
1375
|
return;
|
|
1374
1376
|
}
|
|
1377
|
+
const initialDisplayName = disableVariableDisplayNames ? prettifyBindExpression(result.selectedVariable.name) : result.selectedVariable.displayName;
|
|
1375
1378
|
editor.dispatchCommand(INSERT_VARIABLE_COMMAND, {
|
|
1376
1379
|
variable: result.selectedVariable.name,
|
|
1377
|
-
initialDisplayName
|
|
1380
|
+
initialDisplayName,
|
|
1378
1381
|
targetKey: void 0,
|
|
1379
1382
|
overwriteExistingValue: replaceValueOnVariableInsert
|
|
1380
1383
|
});
|
|
@@ -1393,8 +1396,9 @@ function VariablesPlugin({
|
|
|
1393
1396
|
var _a, _b;
|
|
1394
1397
|
if (!disableVariables) {
|
|
1395
1398
|
const targetVariable = variablesRef.current.variables[reference];
|
|
1399
|
+
const displayName = disableVariableDisplayNames ? prettifyBindExpression(reference) : initialDisplayName != null ? initialDisplayName : (targetVariable == null ? void 0 : targetVariable.displayName) || prettifyBindExpression(reference);
|
|
1396
1400
|
const variableNode = $createVariableNode(reference, {
|
|
1397
|
-
displayName
|
|
1401
|
+
displayName,
|
|
1398
1402
|
hasClickEvent: canEditVariable(reference, targetVariable),
|
|
1399
1403
|
referenceIsValid: true,
|
|
1400
1404
|
tooltip: (_a = targetVariable == null ? void 0 : targetVariable.tooltip) != null ? _a : targetVariable == null ? void 0 : targetVariable.helpText,
|
|
@@ -1431,7 +1435,8 @@ function VariablesPlugin({
|
|
|
1431
1435
|
readOnly,
|
|
1432
1436
|
getEditorContext,
|
|
1433
1437
|
editVariable,
|
|
1434
|
-
replaceValueOnVariableInsert
|
|
1438
|
+
replaceValueOnVariableInsert,
|
|
1439
|
+
disableVariableDisplayNames
|
|
1435
1440
|
]);
|
|
1436
1441
|
const updateExistingNodeIfChanged = useCallback2(
|
|
1437
1442
|
(variableNode) => {
|
|
@@ -1444,9 +1449,10 @@ function VariablesPlugin({
|
|
|
1444
1449
|
return;
|
|
1445
1450
|
}
|
|
1446
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);
|
|
1447
1453
|
const newState = {
|
|
1448
1454
|
...currentState,
|
|
1449
|
-
displayName
|
|
1455
|
+
displayName,
|
|
1450
1456
|
isLoading: isLoadingVariables && !targetVar && !(targetUndefinedVar == null ? void 0 : targetUndefinedVar.info),
|
|
1451
1457
|
hasClickEvent: canEditVariable(variableNode.reference, targetVar),
|
|
1452
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),
|
|
@@ -1457,7 +1463,7 @@ function VariablesPlugin({
|
|
|
1457
1463
|
variableNode.setState(newState);
|
|
1458
1464
|
}
|
|
1459
1465
|
},
|
|
1460
|
-
[canEditVariable]
|
|
1466
|
+
[canEditVariable, disableVariableDisplayNames]
|
|
1461
1467
|
);
|
|
1462
1468
|
useEffect4(() => {
|
|
1463
1469
|
let selection;
|
|
@@ -1616,6 +1622,14 @@ var VariableNode = class _VariableNode extends DecoratorNode {
|
|
|
1616
1622
|
updateDOM() {
|
|
1617
1623
|
return false;
|
|
1618
1624
|
}
|
|
1625
|
+
static importDOM() {
|
|
1626
|
+
return {
|
|
1627
|
+
binding: () => ({
|
|
1628
|
+
conversion: $convertBindingElement,
|
|
1629
|
+
priority: 0
|
|
1630
|
+
})
|
|
1631
|
+
};
|
|
1632
|
+
}
|
|
1619
1633
|
/**
|
|
1620
1634
|
* Render the variable node using React.
|
|
1621
1635
|
* NOTE: this is effectively an island of React, and you may not call hooks,
|
|
@@ -1625,6 +1639,21 @@ var VariableNode = class _VariableNode extends DecoratorNode {
|
|
|
1625
1639
|
return /* @__PURE__ */ jsx22(VariableNodeComponent, { state: this.__state, reference: this.reference, nodeKey: this.__key });
|
|
1626
1640
|
}
|
|
1627
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
|
+
}
|
|
1628
1657
|
function $createVariableNode(variableReference, state) {
|
|
1629
1658
|
return new VariableNode(variableReference, state);
|
|
1630
1659
|
}
|
|
@@ -1945,6 +1974,7 @@ var input2 = css5`
|
|
|
1945
1974
|
&:disabled,
|
|
1946
1975
|
&:disabled::placeholder,
|
|
1947
1976
|
&:disabled:hover {
|
|
1977
|
+
border-color: var(--gray-200);
|
|
1948
1978
|
border-radius: var(--rounded-sm);
|
|
1949
1979
|
cursor: not-allowed;
|
|
1950
1980
|
color: var(--gray-400);
|
|
@@ -1954,6 +1984,7 @@ var input2 = css5`
|
|
|
1954
1984
|
&[contenteditable='false'] {
|
|
1955
1985
|
cursor: not-allowed;
|
|
1956
1986
|
color: var(--gray-400);
|
|
1987
|
+
border-color: var(--gray-200);
|
|
1957
1988
|
}
|
|
1958
1989
|
|
|
1959
1990
|
> p {
|
|
@@ -2460,7 +2491,8 @@ function InputVariables(props) {
|
|
|
2460
2491
|
styleVariant = "default",
|
|
2461
2492
|
renderMenuInPortal,
|
|
2462
2493
|
disableDismissEditorOnChange,
|
|
2463
|
-
singleTokenMode
|
|
2494
|
+
singleTokenMode,
|
|
2495
|
+
disableVariableDisplayNames
|
|
2464
2496
|
} = props;
|
|
2465
2497
|
const [finalId] = useState7(id != null ? id : () => v4());
|
|
2466
2498
|
const { dispatch, canDispatch, isEditing } = useVariables(true);
|
|
@@ -2569,6 +2601,7 @@ function InputVariables(props) {
|
|
|
2569
2601
|
replaceValueOnVariableInsert: useInputWithNoVariables,
|
|
2570
2602
|
autoFocus,
|
|
2571
2603
|
filterVariable,
|
|
2604
|
+
disableVariableDisplayNames,
|
|
2572
2605
|
children: [
|
|
2573
2606
|
/* @__PURE__ */ jsx28(PasteTransformerPlugin, { transformPaste }),
|
|
2574
2607
|
/* @__PURE__ */ jsx28(ControlledValuePlugin, { value, enabled: singleTokenMode || useInputWithNoVariables }),
|
|
@@ -2947,6 +2980,8 @@ var variableValue = css9`
|
|
|
2947
2980
|
|
|
2948
2981
|
// src/components/Variables/VariablesList.tsx
|
|
2949
2982
|
import { Fragment as Fragment8, jsx as jsx33, jsxs as jsxs16 } from "@emotion/react/jsx-runtime";
|
|
2983
|
+
var DroppableHack = Droppable;
|
|
2984
|
+
var DraggableHack = Draggable;
|
|
2950
2985
|
function VariablesList() {
|
|
2951
2986
|
const { variables, dispatch, readOnly } = useVariables();
|
|
2952
2987
|
const sorted = variablesToList(variables).filter((variable) => !variable.system);
|
|
@@ -2968,7 +3003,7 @@ function VariablesList() {
|
|
|
2968
3003
|
}
|
|
2969
3004
|
};
|
|
2970
3005
|
return /* @__PURE__ */ jsxs16(Fragment8, { children: [
|
|
2971
|
-
/* @__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: [
|
|
2972
3007
|
/* @__PURE__ */ jsx33(TableHead, { children: /* @__PURE__ */ jsxs16(TableRow, { children: [
|
|
2973
3008
|
/* @__PURE__ */ jsx33(TableCellHead, { children: "Name" }),
|
|
2974
3009
|
/* @__PURE__ */ jsx33(TableCellHead, { children: "Default Value" }),
|
|
@@ -2979,7 +3014,7 @@ function VariablesList() {
|
|
|
2979
3014
|
const text = displayName != null ? displayName : name2;
|
|
2980
3015
|
const textValue = variableDefaultTextValue(defaultValue);
|
|
2981
3016
|
return /* @__PURE__ */ jsx33(
|
|
2982
|
-
|
|
3017
|
+
DraggableHack,
|
|
2983
3018
|
{
|
|
2984
3019
|
draggableId: name2,
|
|
2985
3020
|
index,
|
|
@@ -3594,8 +3629,8 @@ function urlEncodeRequestParameter(parameter, varValues) {
|
|
|
3594
3629
|
value: decodeVariablesInUrlEncodedString(encodeURIComponent(parameter.value), varValues)
|
|
3595
3630
|
};
|
|
3596
3631
|
}
|
|
3597
|
-
function decodeVariablesInUrlEncodedString(
|
|
3598
|
-
return
|
|
3632
|
+
function decodeVariablesInUrlEncodedString(string2, varValues) {
|
|
3633
|
+
return string2.replace(/(\$|%24)%7B(.*?)%7D/g, (_all, _money, body) => {
|
|
3599
3634
|
var _a;
|
|
3600
3635
|
const varName = decodeURIComponent(body);
|
|
3601
3636
|
return ((_a = varValues == null ? void 0 : varValues[varName]) == null ? void 0 : _a.default) ? variableDefaultTextValue(varValues[varName].default) : `\${${varName}}`;
|
|
@@ -4202,7 +4237,7 @@ var ObjectSearchListItem = ({
|
|
|
4202
4237
|
),
|
|
4203
4238
|
/* @__PURE__ */ jsxs23("div", { css: ObjectListItemInfoContainer, children: [
|
|
4204
4239
|
selected ? /* @__PURE__ */ jsx49(Chip, { text: "selected", size: "xs" }) : null,
|
|
4205
|
-
!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 })
|
|
4206
4241
|
] }),
|
|
4207
4242
|
!children ? null : /* @__PURE__ */ jsx49("div", { css: ObjectListItemUnControlledContent, children })
|
|
4208
4243
|
]
|
|
@@ -4232,7 +4267,6 @@ var ObjectSearchContainer = ({
|
|
|
4232
4267
|
role: "list",
|
|
4233
4268
|
css: css16`
|
|
4234
4269
|
> div {
|
|
4235
|
-
transition: max-height var(--duration-slow) var(--timing-ease-out);
|
|
4236
4270
|
max-height: ${selectedListItems.length === 0 ? "50vh" : "184px"};
|
|
4237
4271
|
}
|
|
4238
4272
|
`,
|
|
@@ -4627,7 +4661,10 @@ function legacyThemeMapper(theme) {
|
|
|
4627
4661
|
|
|
4628
4662
|
// src/components/ObjectSearch/ObjectSearchResultList.tsx
|
|
4629
4663
|
import { Button as Button4, Counter } from "@uniformdev/design-system";
|
|
4630
|
-
import {
|
|
4664
|
+
import {
|
|
4665
|
+
Draggable as Draggable2,
|
|
4666
|
+
Droppable as Droppable2
|
|
4667
|
+
} from "react-beautiful-dnd";
|
|
4631
4668
|
|
|
4632
4669
|
// src/components/ObjectSearch/styles/ObjectSearchResultList.styles.ts
|
|
4633
4670
|
import { css as css20 } from "@emotion/react";
|
|
@@ -4656,6 +4693,8 @@ var ObjectSearchResultListTitle = css20`
|
|
|
4656
4693
|
|
|
4657
4694
|
// src/components/ObjectSearch/ObjectSearchResultList.tsx
|
|
4658
4695
|
import { Fragment as Fragment10, jsx as jsx56, jsxs as jsxs28 } from "@emotion/react/jsx-runtime";
|
|
4696
|
+
var DroppableHack2 = Droppable2;
|
|
4697
|
+
var DraggableHack2 = Draggable2;
|
|
4659
4698
|
function ObjectSearchResultList({
|
|
4660
4699
|
resultLabelText = "Selected",
|
|
4661
4700
|
removeButtonText = "Remove all",
|
|
@@ -4727,7 +4766,7 @@ function ObjectSearchResultList({
|
|
|
4727
4766
|
] })
|
|
4728
4767
|
] }),
|
|
4729
4768
|
!selectedListItems.length ? whenNothingSelected : /* @__PURE__ */ jsx56(DragDropContext, { onDragEnd: (res) => onDragEnd(res), children: /* @__PURE__ */ jsx56(
|
|
4730
|
-
|
|
4769
|
+
DroppableHack2,
|
|
4731
4770
|
{
|
|
4732
4771
|
droppableId: multiSelectId != null ? multiSelectId : "canvas-multi-select",
|
|
4733
4772
|
renderClone: getContainerForDnDReparenting ? getDraggableItem : void 0,
|
|
@@ -4735,7 +4774,7 @@ function ObjectSearchResultList({
|
|
|
4735
4774
|
children: (provided) => /* @__PURE__ */ jsxs28("div", { ...provided.droppableProps, ref: provided.innerRef, children: [
|
|
4736
4775
|
selectedListItems.map((item, i) => {
|
|
4737
4776
|
return /* @__PURE__ */ jsx56(
|
|
4738
|
-
|
|
4777
|
+
DraggableHack2,
|
|
4739
4778
|
{
|
|
4740
4779
|
draggableId: item.id,
|
|
4741
4780
|
index: i,
|
package/dist/index.js
CHANGED
|
@@ -920,7 +920,7 @@ var import_zod = require("@hookform/resolvers/zod");
|
|
|
920
920
|
var import_design_system4 = require("@uniformdev/design-system");
|
|
921
921
|
var import_react12 = require("react");
|
|
922
922
|
var import_react_hook_form = require("react-hook-form");
|
|
923
|
-
var
|
|
923
|
+
var z = __toESM(require("zod"));
|
|
924
924
|
|
|
925
925
|
// src/components/Variables/styles/VariableEditor.styles.ts
|
|
926
926
|
var import_react11 = require("@emotion/react");
|
|
@@ -932,13 +932,13 @@ var variablesFormContainer = import_react11.css`
|
|
|
932
932
|
|
|
933
933
|
// src/components/Variables/VariableEditor.tsx
|
|
934
934
|
var import_jsx_runtime18 = require("@emotion/react/jsx-runtime");
|
|
935
|
-
var schema =
|
|
936
|
-
name:
|
|
937
|
-
default:
|
|
938
|
-
displayName:
|
|
939
|
-
helpText:
|
|
940
|
-
order:
|
|
941
|
-
type:
|
|
935
|
+
var schema = z.object({
|
|
936
|
+
name: z.string().nonempty("Name can't be empty").regex(/^[^${}]+$/, "$, {, and } are reserved characters and cannot be used in a variable name"),
|
|
937
|
+
default: z.string(),
|
|
938
|
+
displayName: z.string().optional(),
|
|
939
|
+
helpText: z.string().optional(),
|
|
940
|
+
order: z.number().optional(),
|
|
941
|
+
type: z.string().optional()
|
|
942
942
|
});
|
|
943
943
|
function VariableEditor({
|
|
944
944
|
variable,
|
|
@@ -1390,7 +1390,8 @@ function VariablesPlugin({
|
|
|
1390
1390
|
enableEditingVariables,
|
|
1391
1391
|
getEditorContext,
|
|
1392
1392
|
replaceValueOnVariableInsert,
|
|
1393
|
-
filterVariable
|
|
1393
|
+
filterVariable,
|
|
1394
|
+
disableVariableDisplayNames
|
|
1394
1395
|
}) {
|
|
1395
1396
|
const [editor] = (0, import_LexicalComposerContext2.useLexicalComposerContext)();
|
|
1396
1397
|
const { variables, dispatch, isEditing, canDispatch, readOnly, knownUndefinedValues, isLoading } = useVariables(true);
|
|
@@ -1468,9 +1469,10 @@ function VariablesPlugin({
|
|
|
1468
1469
|
});
|
|
1469
1470
|
return;
|
|
1470
1471
|
}
|
|
1472
|
+
const initialDisplayName = disableVariableDisplayNames ? prettifyBindExpression(result.selectedVariable.name) : result.selectedVariable.displayName;
|
|
1471
1473
|
editor.dispatchCommand(INSERT_VARIABLE_COMMAND, {
|
|
1472
1474
|
variable: result.selectedVariable.name,
|
|
1473
|
-
initialDisplayName
|
|
1475
|
+
initialDisplayName,
|
|
1474
1476
|
targetKey: sourceKey,
|
|
1475
1477
|
overwriteExistingValue: replaceValueOnVariableInsert
|
|
1476
1478
|
});
|
|
@@ -1518,9 +1520,10 @@ function VariablesPlugin({
|
|
|
1518
1520
|
if (result.canceled) {
|
|
1519
1521
|
return;
|
|
1520
1522
|
}
|
|
1523
|
+
const initialDisplayName = disableVariableDisplayNames ? prettifyBindExpression(result.selectedVariable.name) : result.selectedVariable.displayName;
|
|
1521
1524
|
editor.dispatchCommand(INSERT_VARIABLE_COMMAND, {
|
|
1522
1525
|
variable: result.selectedVariable.name,
|
|
1523
|
-
initialDisplayName
|
|
1526
|
+
initialDisplayName,
|
|
1524
1527
|
targetKey: void 0,
|
|
1525
1528
|
overwriteExistingValue: replaceValueOnVariableInsert
|
|
1526
1529
|
});
|
|
@@ -1539,8 +1542,9 @@ function VariablesPlugin({
|
|
|
1539
1542
|
var _a, _b;
|
|
1540
1543
|
if (!disableVariables) {
|
|
1541
1544
|
const targetVariable = variablesRef.current.variables[reference];
|
|
1545
|
+
const displayName = disableVariableDisplayNames ? prettifyBindExpression(reference) : initialDisplayName != null ? initialDisplayName : (targetVariable == null ? void 0 : targetVariable.displayName) || prettifyBindExpression(reference);
|
|
1542
1546
|
const variableNode = $createVariableNode(reference, {
|
|
1543
|
-
displayName
|
|
1547
|
+
displayName,
|
|
1544
1548
|
hasClickEvent: canEditVariable(reference, targetVariable),
|
|
1545
1549
|
referenceIsValid: true,
|
|
1546
1550
|
tooltip: (_a = targetVariable == null ? void 0 : targetVariable.tooltip) != null ? _a : targetVariable == null ? void 0 : targetVariable.helpText,
|
|
@@ -1577,7 +1581,8 @@ function VariablesPlugin({
|
|
|
1577
1581
|
readOnly,
|
|
1578
1582
|
getEditorContext,
|
|
1579
1583
|
editVariable,
|
|
1580
|
-
replaceValueOnVariableInsert
|
|
1584
|
+
replaceValueOnVariableInsert,
|
|
1585
|
+
disableVariableDisplayNames
|
|
1581
1586
|
]);
|
|
1582
1587
|
const updateExistingNodeIfChanged = (0, import_react15.useCallback)(
|
|
1583
1588
|
(variableNode) => {
|
|
@@ -1590,9 +1595,10 @@ function VariablesPlugin({
|
|
|
1590
1595
|
return;
|
|
1591
1596
|
}
|
|
1592
1597
|
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;
|
|
1598
|
+
const displayName = disableVariableDisplayNames ? prettifyBindExpression(variableNode.reference) : (targetVar == null ? void 0 : targetVar.displayName) || (targetUndefinedVar == null ? void 0 : targetUndefinedVar.displayName) || prettifyBindExpression(variableNode.reference);
|
|
1593
1599
|
const newState = {
|
|
1594
1600
|
...currentState,
|
|
1595
|
-
displayName
|
|
1601
|
+
displayName,
|
|
1596
1602
|
isLoading: isLoadingVariables && !targetVar && !(targetUndefinedVar == null ? void 0 : targetUndefinedVar.info),
|
|
1597
1603
|
hasClickEvent: canEditVariable(variableNode.reference, targetVar),
|
|
1598
1604
|
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),
|
|
@@ -1603,7 +1609,7 @@ function VariablesPlugin({
|
|
|
1603
1609
|
variableNode.setState(newState);
|
|
1604
1610
|
}
|
|
1605
1611
|
},
|
|
1606
|
-
[canEditVariable]
|
|
1612
|
+
[canEditVariable, disableVariableDisplayNames]
|
|
1607
1613
|
);
|
|
1608
1614
|
(0, import_react15.useEffect)(() => {
|
|
1609
1615
|
let selection;
|
|
@@ -1762,6 +1768,14 @@ var VariableNode = class _VariableNode extends import_lexical5.DecoratorNode {
|
|
|
1762
1768
|
updateDOM() {
|
|
1763
1769
|
return false;
|
|
1764
1770
|
}
|
|
1771
|
+
static importDOM() {
|
|
1772
|
+
return {
|
|
1773
|
+
binding: () => ({
|
|
1774
|
+
conversion: $convertBindingElement,
|
|
1775
|
+
priority: 0
|
|
1776
|
+
})
|
|
1777
|
+
};
|
|
1778
|
+
}
|
|
1765
1779
|
/**
|
|
1766
1780
|
* Render the variable node using React.
|
|
1767
1781
|
* NOTE: this is effectively an island of React, and you may not call hooks,
|
|
@@ -1771,6 +1785,21 @@ var VariableNode = class _VariableNode extends import_lexical5.DecoratorNode {
|
|
|
1771
1785
|
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(VariableNodeComponent, { state: this.__state, reference: this.reference, nodeKey: this.__key });
|
|
1772
1786
|
}
|
|
1773
1787
|
};
|
|
1788
|
+
function $convertBindingElement(domNode) {
|
|
1789
|
+
const element = domNode;
|
|
1790
|
+
const reference = element.textContent.replace(variablePrefix, "").replace(variableSuffix, "");
|
|
1791
|
+
const node = $createVariableNode(reference, {
|
|
1792
|
+
displayName: prettifyBindExpression(reference),
|
|
1793
|
+
hasClickEvent: true,
|
|
1794
|
+
referenceIsValid: true,
|
|
1795
|
+
tooltip: void 0,
|
|
1796
|
+
isFresh: true,
|
|
1797
|
+
isLoading: false
|
|
1798
|
+
});
|
|
1799
|
+
return {
|
|
1800
|
+
node
|
|
1801
|
+
};
|
|
1802
|
+
}
|
|
1774
1803
|
function $createVariableNode(variableReference, state) {
|
|
1775
1804
|
return new VariableNode(variableReference, state);
|
|
1776
1805
|
}
|
|
@@ -2085,6 +2114,7 @@ var input2 = import_react19.css`
|
|
|
2085
2114
|
&:disabled,
|
|
2086
2115
|
&:disabled::placeholder,
|
|
2087
2116
|
&:disabled:hover {
|
|
2117
|
+
border-color: var(--gray-200);
|
|
2088
2118
|
border-radius: var(--rounded-sm);
|
|
2089
2119
|
cursor: not-allowed;
|
|
2090
2120
|
color: var(--gray-400);
|
|
@@ -2094,6 +2124,7 @@ var input2 = import_react19.css`
|
|
|
2094
2124
|
&[contenteditable='false'] {
|
|
2095
2125
|
cursor: not-allowed;
|
|
2096
2126
|
color: var(--gray-400);
|
|
2127
|
+
border-color: var(--gray-200);
|
|
2097
2128
|
}
|
|
2098
2129
|
|
|
2099
2130
|
> p {
|
|
@@ -2588,7 +2619,8 @@ function InputVariables(props) {
|
|
|
2588
2619
|
styleVariant = "default",
|
|
2589
2620
|
renderMenuInPortal,
|
|
2590
2621
|
disableDismissEditorOnChange,
|
|
2591
|
-
singleTokenMode
|
|
2622
|
+
singleTokenMode,
|
|
2623
|
+
disableVariableDisplayNames
|
|
2592
2624
|
} = props;
|
|
2593
2625
|
const [finalId] = (0, import_react28.useState)(id != null ? id : () => (0, import_uuid.v4)());
|
|
2594
2626
|
const { dispatch, canDispatch, isEditing } = useVariables(true);
|
|
@@ -2697,6 +2729,7 @@ function InputVariables(props) {
|
|
|
2697
2729
|
replaceValueOnVariableInsert: useInputWithNoVariables,
|
|
2698
2730
|
autoFocus,
|
|
2699
2731
|
filterVariable,
|
|
2732
|
+
disableVariableDisplayNames,
|
|
2700
2733
|
children: [
|
|
2701
2734
|
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(PasteTransformerPlugin, { transformPaste }),
|
|
2702
2735
|
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(ControlledValuePlugin, { value, enabled: singleTokenMode || useInputWithNoVariables }),
|
|
@@ -3065,6 +3098,8 @@ var variableValue = import_react34.css`
|
|
|
3065
3098
|
|
|
3066
3099
|
// src/components/Variables/VariablesList.tsx
|
|
3067
3100
|
var import_jsx_runtime32 = require("@emotion/react/jsx-runtime");
|
|
3101
|
+
var DroppableHack = import_react_beautiful_dnd2.Droppable;
|
|
3102
|
+
var DraggableHack = import_react_beautiful_dnd2.Draggable;
|
|
3068
3103
|
function VariablesList() {
|
|
3069
3104
|
const { variables, dispatch, readOnly } = useVariables();
|
|
3070
3105
|
const sorted = variablesToList(variables).filter((variable) => !variable.system);
|
|
@@ -3086,7 +3121,7 @@ function VariablesList() {
|
|
|
3086
3121
|
}
|
|
3087
3122
|
};
|
|
3088
3123
|
return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(import_jsx_runtime32.Fragment, { children: [
|
|
3089
|
-
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(DragDropContext, { onDragEnd: (res) => onDragEnd(res), children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
3124
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(DragDropContext, { onDragEnd: (res) => onDragEnd(res), children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(DroppableHack, { droppableId: "variables-table", children: (provided) => /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(import_design_system13.Table, { ...provided.droppableProps, ref: provided.innerRef, children: [
|
|
3090
3125
|
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(import_design_system13.TableHead, { children: /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(import_design_system13.TableRow, { children: [
|
|
3091
3126
|
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(import_design_system13.TableCellHead, { children: "Name" }),
|
|
3092
3127
|
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(import_design_system13.TableCellHead, { children: "Default Value" }),
|
|
@@ -3097,7 +3132,7 @@ function VariablesList() {
|
|
|
3097
3132
|
const text = displayName != null ? displayName : name2;
|
|
3098
3133
|
const textValue = variableDefaultTextValue(defaultValue);
|
|
3099
3134
|
return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
3100
|
-
|
|
3135
|
+
DraggableHack,
|
|
3101
3136
|
{
|
|
3102
3137
|
draggableId: name2,
|
|
3103
3138
|
index,
|
|
@@ -3692,8 +3727,8 @@ function urlEncodeRequestParameter(parameter, varValues) {
|
|
|
3692
3727
|
value: decodeVariablesInUrlEncodedString(encodeURIComponent(parameter.value), varValues)
|
|
3693
3728
|
};
|
|
3694
3729
|
}
|
|
3695
|
-
function decodeVariablesInUrlEncodedString(
|
|
3696
|
-
return
|
|
3730
|
+
function decodeVariablesInUrlEncodedString(string2, varValues) {
|
|
3731
|
+
return string2.replace(/(\$|%24)%7B(.*?)%7D/g, (_all, _money, body) => {
|
|
3697
3732
|
var _a;
|
|
3698
3733
|
const varName = decodeURIComponent(body);
|
|
3699
3734
|
return ((_a = varValues == null ? void 0 : varValues[varName]) == null ? void 0 : _a.default) ? variableDefaultTextValue(varValues[varName].default) : `\${${varName}}`;
|
|
@@ -4293,7 +4328,7 @@ var ObjectSearchListItem = ({
|
|
|
4293
4328
|
),
|
|
4294
4329
|
/* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("div", { css: ObjectListItemInfoContainer, children: [
|
|
4295
4330
|
selected ? /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(import_design_system22.Chip, { text: "selected", size: "xs" }) : null,
|
|
4296
|
-
!popoverData ? null : /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(import_design_system22.Popover, { ariaLabel: title, buttonText: `See ${title} details`,
|
|
4331
|
+
!popoverData ? null : /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(import_design_system22.Popover, { ariaLabel: title, buttonText: `See ${title} details`, children: popoverData })
|
|
4297
4332
|
] }),
|
|
4298
4333
|
!children ? null : /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("div", { css: ObjectListItemUnControlledContent, children })
|
|
4299
4334
|
]
|
|
@@ -4323,7 +4358,6 @@ var ObjectSearchContainer = ({
|
|
|
4323
4358
|
role: "list",
|
|
4324
4359
|
css: import_react45.css`
|
|
4325
4360
|
> div {
|
|
4326
|
-
transition: max-height var(--duration-slow) var(--timing-ease-out);
|
|
4327
4361
|
max-height: ${selectedListItems.length === 0 ? "50vh" : "184px"};
|
|
4328
4362
|
}
|
|
4329
4363
|
`,
|
|
@@ -4747,6 +4781,8 @@ var ObjectSearchResultListTitle = import_react50.css`
|
|
|
4747
4781
|
|
|
4748
4782
|
// src/components/ObjectSearch/ObjectSearchResultList.tsx
|
|
4749
4783
|
var import_jsx_runtime55 = require("@emotion/react/jsx-runtime");
|
|
4784
|
+
var DroppableHack2 = import_react_beautiful_dnd3.Droppable;
|
|
4785
|
+
var DraggableHack2 = import_react_beautiful_dnd3.Draggable;
|
|
4750
4786
|
function ObjectSearchResultList({
|
|
4751
4787
|
resultLabelText = "Selected",
|
|
4752
4788
|
removeButtonText = "Remove all",
|
|
@@ -4818,7 +4854,7 @@ function ObjectSearchResultList({
|
|
|
4818
4854
|
] })
|
|
4819
4855
|
] }),
|
|
4820
4856
|
!selectedListItems.length ? whenNothingSelected : /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(DragDropContext, { onDragEnd: (res) => onDragEnd(res), children: /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
|
|
4821
|
-
|
|
4857
|
+
DroppableHack2,
|
|
4822
4858
|
{
|
|
4823
4859
|
droppableId: multiSelectId != null ? multiSelectId : "canvas-multi-select",
|
|
4824
4860
|
renderClone: getContainerForDnDReparenting ? getDraggableItem : void 0,
|
|
@@ -4826,7 +4862,7 @@ function ObjectSearchResultList({
|
|
|
4826
4862
|
children: (provided) => /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)("div", { ...provided.droppableProps, ref: provided.innerRef, children: [
|
|
4827
4863
|
selectedListItems.map((item, i) => {
|
|
4828
4864
|
return /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
|
|
4829
|
-
|
|
4865
|
+
DraggableHack2,
|
|
4830
4866
|
{
|
|
4831
4867
|
draggableId: item.id,
|
|
4832
4868
|
index: i,
|
package/dist/index.mjs
CHANGED
|
@@ -774,7 +774,7 @@ import { zodResolver } from "@hookform/resolvers/zod";
|
|
|
774
774
|
import { Button, Callout, HorizontalRhythm, Input, useShortcut } from "@uniformdev/design-system";
|
|
775
775
|
import { useLayoutEffect, useRef as useRef2 } from "react";
|
|
776
776
|
import { useForm } from "react-hook-form";
|
|
777
|
-
import
|
|
777
|
+
import * as z from "zod";
|
|
778
778
|
|
|
779
779
|
// src/components/Variables/styles/VariableEditor.styles.ts
|
|
780
780
|
import { css as css2 } from "@emotion/react";
|
|
@@ -1244,7 +1244,8 @@ function VariablesPlugin({
|
|
|
1244
1244
|
enableEditingVariables,
|
|
1245
1245
|
getEditorContext,
|
|
1246
1246
|
replaceValueOnVariableInsert,
|
|
1247
|
-
filterVariable
|
|
1247
|
+
filterVariable,
|
|
1248
|
+
disableVariableDisplayNames
|
|
1248
1249
|
}) {
|
|
1249
1250
|
const [editor] = useLexicalComposerContext2();
|
|
1250
1251
|
const { variables, dispatch, isEditing, canDispatch, readOnly, knownUndefinedValues, isLoading } = useVariables(true);
|
|
@@ -1322,9 +1323,10 @@ function VariablesPlugin({
|
|
|
1322
1323
|
});
|
|
1323
1324
|
return;
|
|
1324
1325
|
}
|
|
1326
|
+
const initialDisplayName = disableVariableDisplayNames ? prettifyBindExpression(result.selectedVariable.name) : result.selectedVariable.displayName;
|
|
1325
1327
|
editor.dispatchCommand(INSERT_VARIABLE_COMMAND, {
|
|
1326
1328
|
variable: result.selectedVariable.name,
|
|
1327
|
-
initialDisplayName
|
|
1329
|
+
initialDisplayName,
|
|
1328
1330
|
targetKey: sourceKey,
|
|
1329
1331
|
overwriteExistingValue: replaceValueOnVariableInsert
|
|
1330
1332
|
});
|
|
@@ -1372,9 +1374,10 @@ function VariablesPlugin({
|
|
|
1372
1374
|
if (result.canceled) {
|
|
1373
1375
|
return;
|
|
1374
1376
|
}
|
|
1377
|
+
const initialDisplayName = disableVariableDisplayNames ? prettifyBindExpression(result.selectedVariable.name) : result.selectedVariable.displayName;
|
|
1375
1378
|
editor.dispatchCommand(INSERT_VARIABLE_COMMAND, {
|
|
1376
1379
|
variable: result.selectedVariable.name,
|
|
1377
|
-
initialDisplayName
|
|
1380
|
+
initialDisplayName,
|
|
1378
1381
|
targetKey: void 0,
|
|
1379
1382
|
overwriteExistingValue: replaceValueOnVariableInsert
|
|
1380
1383
|
});
|
|
@@ -1393,8 +1396,9 @@ function VariablesPlugin({
|
|
|
1393
1396
|
var _a, _b;
|
|
1394
1397
|
if (!disableVariables) {
|
|
1395
1398
|
const targetVariable = variablesRef.current.variables[reference];
|
|
1399
|
+
const displayName = disableVariableDisplayNames ? prettifyBindExpression(reference) : initialDisplayName != null ? initialDisplayName : (targetVariable == null ? void 0 : targetVariable.displayName) || prettifyBindExpression(reference);
|
|
1396
1400
|
const variableNode = $createVariableNode(reference, {
|
|
1397
|
-
displayName
|
|
1401
|
+
displayName,
|
|
1398
1402
|
hasClickEvent: canEditVariable(reference, targetVariable),
|
|
1399
1403
|
referenceIsValid: true,
|
|
1400
1404
|
tooltip: (_a = targetVariable == null ? void 0 : targetVariable.tooltip) != null ? _a : targetVariable == null ? void 0 : targetVariable.helpText,
|
|
@@ -1431,7 +1435,8 @@ function VariablesPlugin({
|
|
|
1431
1435
|
readOnly,
|
|
1432
1436
|
getEditorContext,
|
|
1433
1437
|
editVariable,
|
|
1434
|
-
replaceValueOnVariableInsert
|
|
1438
|
+
replaceValueOnVariableInsert,
|
|
1439
|
+
disableVariableDisplayNames
|
|
1435
1440
|
]);
|
|
1436
1441
|
const updateExistingNodeIfChanged = useCallback2(
|
|
1437
1442
|
(variableNode) => {
|
|
@@ -1444,9 +1449,10 @@ function VariablesPlugin({
|
|
|
1444
1449
|
return;
|
|
1445
1450
|
}
|
|
1446
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);
|
|
1447
1453
|
const newState = {
|
|
1448
1454
|
...currentState,
|
|
1449
|
-
displayName
|
|
1455
|
+
displayName,
|
|
1450
1456
|
isLoading: isLoadingVariables && !targetVar && !(targetUndefinedVar == null ? void 0 : targetUndefinedVar.info),
|
|
1451
1457
|
hasClickEvent: canEditVariable(variableNode.reference, targetVar),
|
|
1452
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),
|
|
@@ -1457,7 +1463,7 @@ function VariablesPlugin({
|
|
|
1457
1463
|
variableNode.setState(newState);
|
|
1458
1464
|
}
|
|
1459
1465
|
},
|
|
1460
|
-
[canEditVariable]
|
|
1466
|
+
[canEditVariable, disableVariableDisplayNames]
|
|
1461
1467
|
);
|
|
1462
1468
|
useEffect4(() => {
|
|
1463
1469
|
let selection;
|
|
@@ -1616,6 +1622,14 @@ var VariableNode = class _VariableNode extends DecoratorNode {
|
|
|
1616
1622
|
updateDOM() {
|
|
1617
1623
|
return false;
|
|
1618
1624
|
}
|
|
1625
|
+
static importDOM() {
|
|
1626
|
+
return {
|
|
1627
|
+
binding: () => ({
|
|
1628
|
+
conversion: $convertBindingElement,
|
|
1629
|
+
priority: 0
|
|
1630
|
+
})
|
|
1631
|
+
};
|
|
1632
|
+
}
|
|
1619
1633
|
/**
|
|
1620
1634
|
* Render the variable node using React.
|
|
1621
1635
|
* NOTE: this is effectively an island of React, and you may not call hooks,
|
|
@@ -1625,6 +1639,21 @@ var VariableNode = class _VariableNode extends DecoratorNode {
|
|
|
1625
1639
|
return /* @__PURE__ */ jsx22(VariableNodeComponent, { state: this.__state, reference: this.reference, nodeKey: this.__key });
|
|
1626
1640
|
}
|
|
1627
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
|
+
}
|
|
1628
1657
|
function $createVariableNode(variableReference, state) {
|
|
1629
1658
|
return new VariableNode(variableReference, state);
|
|
1630
1659
|
}
|
|
@@ -1945,6 +1974,7 @@ var input2 = css5`
|
|
|
1945
1974
|
&:disabled,
|
|
1946
1975
|
&:disabled::placeholder,
|
|
1947
1976
|
&:disabled:hover {
|
|
1977
|
+
border-color: var(--gray-200);
|
|
1948
1978
|
border-radius: var(--rounded-sm);
|
|
1949
1979
|
cursor: not-allowed;
|
|
1950
1980
|
color: var(--gray-400);
|
|
@@ -1954,6 +1984,7 @@ var input2 = css5`
|
|
|
1954
1984
|
&[contenteditable='false'] {
|
|
1955
1985
|
cursor: not-allowed;
|
|
1956
1986
|
color: var(--gray-400);
|
|
1987
|
+
border-color: var(--gray-200);
|
|
1957
1988
|
}
|
|
1958
1989
|
|
|
1959
1990
|
> p {
|
|
@@ -2460,7 +2491,8 @@ function InputVariables(props) {
|
|
|
2460
2491
|
styleVariant = "default",
|
|
2461
2492
|
renderMenuInPortal,
|
|
2462
2493
|
disableDismissEditorOnChange,
|
|
2463
|
-
singleTokenMode
|
|
2494
|
+
singleTokenMode,
|
|
2495
|
+
disableVariableDisplayNames
|
|
2464
2496
|
} = props;
|
|
2465
2497
|
const [finalId] = useState7(id != null ? id : () => v4());
|
|
2466
2498
|
const { dispatch, canDispatch, isEditing } = useVariables(true);
|
|
@@ -2569,6 +2601,7 @@ function InputVariables(props) {
|
|
|
2569
2601
|
replaceValueOnVariableInsert: useInputWithNoVariables,
|
|
2570
2602
|
autoFocus,
|
|
2571
2603
|
filterVariable,
|
|
2604
|
+
disableVariableDisplayNames,
|
|
2572
2605
|
children: [
|
|
2573
2606
|
/* @__PURE__ */ jsx28(PasteTransformerPlugin, { transformPaste }),
|
|
2574
2607
|
/* @__PURE__ */ jsx28(ControlledValuePlugin, { value, enabled: singleTokenMode || useInputWithNoVariables }),
|
|
@@ -2947,6 +2980,8 @@ var variableValue = css9`
|
|
|
2947
2980
|
|
|
2948
2981
|
// src/components/Variables/VariablesList.tsx
|
|
2949
2982
|
import { Fragment as Fragment8, jsx as jsx33, jsxs as jsxs16 } from "@emotion/react/jsx-runtime";
|
|
2983
|
+
var DroppableHack = Droppable;
|
|
2984
|
+
var DraggableHack = Draggable;
|
|
2950
2985
|
function VariablesList() {
|
|
2951
2986
|
const { variables, dispatch, readOnly } = useVariables();
|
|
2952
2987
|
const sorted = variablesToList(variables).filter((variable) => !variable.system);
|
|
@@ -2968,7 +3003,7 @@ function VariablesList() {
|
|
|
2968
3003
|
}
|
|
2969
3004
|
};
|
|
2970
3005
|
return /* @__PURE__ */ jsxs16(Fragment8, { children: [
|
|
2971
|
-
/* @__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: [
|
|
2972
3007
|
/* @__PURE__ */ jsx33(TableHead, { children: /* @__PURE__ */ jsxs16(TableRow, { children: [
|
|
2973
3008
|
/* @__PURE__ */ jsx33(TableCellHead, { children: "Name" }),
|
|
2974
3009
|
/* @__PURE__ */ jsx33(TableCellHead, { children: "Default Value" }),
|
|
@@ -2979,7 +3014,7 @@ function VariablesList() {
|
|
|
2979
3014
|
const text = displayName != null ? displayName : name2;
|
|
2980
3015
|
const textValue = variableDefaultTextValue(defaultValue);
|
|
2981
3016
|
return /* @__PURE__ */ jsx33(
|
|
2982
|
-
|
|
3017
|
+
DraggableHack,
|
|
2983
3018
|
{
|
|
2984
3019
|
draggableId: name2,
|
|
2985
3020
|
index,
|
|
@@ -3594,8 +3629,8 @@ function urlEncodeRequestParameter(parameter, varValues) {
|
|
|
3594
3629
|
value: decodeVariablesInUrlEncodedString(encodeURIComponent(parameter.value), varValues)
|
|
3595
3630
|
};
|
|
3596
3631
|
}
|
|
3597
|
-
function decodeVariablesInUrlEncodedString(
|
|
3598
|
-
return
|
|
3632
|
+
function decodeVariablesInUrlEncodedString(string2, varValues) {
|
|
3633
|
+
return string2.replace(/(\$|%24)%7B(.*?)%7D/g, (_all, _money, body) => {
|
|
3599
3634
|
var _a;
|
|
3600
3635
|
const varName = decodeURIComponent(body);
|
|
3601
3636
|
return ((_a = varValues == null ? void 0 : varValues[varName]) == null ? void 0 : _a.default) ? variableDefaultTextValue(varValues[varName].default) : `\${${varName}}`;
|
|
@@ -4202,7 +4237,7 @@ var ObjectSearchListItem = ({
|
|
|
4202
4237
|
),
|
|
4203
4238
|
/* @__PURE__ */ jsxs23("div", { css: ObjectListItemInfoContainer, children: [
|
|
4204
4239
|
selected ? /* @__PURE__ */ jsx49(Chip, { text: "selected", size: "xs" }) : null,
|
|
4205
|
-
!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 })
|
|
4206
4241
|
] }),
|
|
4207
4242
|
!children ? null : /* @__PURE__ */ jsx49("div", { css: ObjectListItemUnControlledContent, children })
|
|
4208
4243
|
]
|
|
@@ -4232,7 +4267,6 @@ var ObjectSearchContainer = ({
|
|
|
4232
4267
|
role: "list",
|
|
4233
4268
|
css: css16`
|
|
4234
4269
|
> div {
|
|
4235
|
-
transition: max-height var(--duration-slow) var(--timing-ease-out);
|
|
4236
4270
|
max-height: ${selectedListItems.length === 0 ? "50vh" : "184px"};
|
|
4237
4271
|
}
|
|
4238
4272
|
`,
|
|
@@ -4627,7 +4661,10 @@ function legacyThemeMapper(theme) {
|
|
|
4627
4661
|
|
|
4628
4662
|
// src/components/ObjectSearch/ObjectSearchResultList.tsx
|
|
4629
4663
|
import { Button as Button4, Counter } from "@uniformdev/design-system";
|
|
4630
|
-
import {
|
|
4664
|
+
import {
|
|
4665
|
+
Draggable as Draggable2,
|
|
4666
|
+
Droppable as Droppable2
|
|
4667
|
+
} from "react-beautiful-dnd";
|
|
4631
4668
|
|
|
4632
4669
|
// src/components/ObjectSearch/styles/ObjectSearchResultList.styles.ts
|
|
4633
4670
|
import { css as css20 } from "@emotion/react";
|
|
@@ -4656,6 +4693,8 @@ var ObjectSearchResultListTitle = css20`
|
|
|
4656
4693
|
|
|
4657
4694
|
// src/components/ObjectSearch/ObjectSearchResultList.tsx
|
|
4658
4695
|
import { Fragment as Fragment10, jsx as jsx56, jsxs as jsxs28 } from "@emotion/react/jsx-runtime";
|
|
4696
|
+
var DroppableHack2 = Droppable2;
|
|
4697
|
+
var DraggableHack2 = Draggable2;
|
|
4659
4698
|
function ObjectSearchResultList({
|
|
4660
4699
|
resultLabelText = "Selected",
|
|
4661
4700
|
removeButtonText = "Remove all",
|
|
@@ -4727,7 +4766,7 @@ function ObjectSearchResultList({
|
|
|
4727
4766
|
] })
|
|
4728
4767
|
] }),
|
|
4729
4768
|
!selectedListItems.length ? whenNothingSelected : /* @__PURE__ */ jsx56(DragDropContext, { onDragEnd: (res) => onDragEnd(res), children: /* @__PURE__ */ jsx56(
|
|
4730
|
-
|
|
4769
|
+
DroppableHack2,
|
|
4731
4770
|
{
|
|
4732
4771
|
droppableId: multiSelectId != null ? multiSelectId : "canvas-multi-select",
|
|
4733
4772
|
renderClone: getContainerForDnDReparenting ? getDraggableItem : void 0,
|
|
@@ -4735,7 +4774,7 @@ function ObjectSearchResultList({
|
|
|
4735
4774
|
children: (provided) => /* @__PURE__ */ jsxs28("div", { ...provided.droppableProps, ref: provided.innerRef, children: [
|
|
4736
4775
|
selectedListItems.map((item, i) => {
|
|
4737
4776
|
return /* @__PURE__ */ jsx56(
|
|
4738
|
-
|
|
4777
|
+
DraggableHack2,
|
|
4739
4778
|
{
|
|
4740
4779
|
draggableId: item.id,
|
|
4741
4780
|
index: i,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uniformdev/mesh-sdk-react",
|
|
3
|
-
"version": "20.7.1-alpha.
|
|
3
|
+
"version": "20.7.1-alpha.85+fd2c4a46e2",
|
|
4
4
|
"description": "Uniform Mesh Framework SDK for React",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -50,10 +50,10 @@
|
|
|
50
50
|
"@lexical/selection": "0.25.0",
|
|
51
51
|
"@lexical/utils": "0.25.0",
|
|
52
52
|
"@react-icons/all-files": "https://github.com/react-icons/react-icons/releases/download/v5.5.0/react-icons-all-files-5.5.0.tgz",
|
|
53
|
-
"@uniformdev/canvas": "20.7.1-alpha.
|
|
54
|
-
"@uniformdev/design-system": "20.7.1-alpha.
|
|
55
|
-
"@uniformdev/mesh-sdk": "20.7.1-alpha.
|
|
56
|
-
"@uniformdev/richtext": "20.7.1-alpha.
|
|
53
|
+
"@uniformdev/canvas": "20.7.1-alpha.85+fd2c4a46e2",
|
|
54
|
+
"@uniformdev/design-system": "20.7.1-alpha.85+fd2c4a46e2",
|
|
55
|
+
"@uniformdev/mesh-sdk": "20.7.1-alpha.85+fd2c4a46e2",
|
|
56
|
+
"@uniformdev/richtext": "20.7.1-alpha.85+fd2c4a46e2",
|
|
57
57
|
"dequal": "^2.0.3",
|
|
58
58
|
"lexical": "0.25.0",
|
|
59
59
|
"mitt": "3.0.1",
|
|
@@ -73,9 +73,9 @@
|
|
|
73
73
|
"@emotion/react": "11.13.5",
|
|
74
74
|
"@storybook/react": "8.3.3",
|
|
75
75
|
"@svgr/cli": "6.5.1",
|
|
76
|
-
"@types/react": "18.3.
|
|
76
|
+
"@types/react": "18.3.24",
|
|
77
77
|
"@types/react-beautiful-dnd": "13.1.8",
|
|
78
|
-
"@types/react-dom": "18.3.
|
|
78
|
+
"@types/react-dom": "18.3.7",
|
|
79
79
|
"@types/uuid": "9.0.4",
|
|
80
80
|
"react": "18.3.1",
|
|
81
81
|
"react-dom": "18.3.1"
|
|
@@ -86,5 +86,5 @@
|
|
|
86
86
|
"publishConfig": {
|
|
87
87
|
"access": "public"
|
|
88
88
|
},
|
|
89
|
-
"gitHead": "
|
|
89
|
+
"gitHead": "fd2c4a46e263c1f5b81033b43fe54360be163ef6"
|
|
90
90
|
}
|