@uniformdev/mesh-sdk-react 18.35.1-alpha.27 → 18.38.2-alpha.6
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.ts +66 -4
- package/dist/index.esm.js +141 -65
- package/dist/index.js +144 -60
- package/dist/index.mjs +141 -65
- package/package.json +9 -7
package/dist/index.d.ts
CHANGED
|
@@ -5,11 +5,11 @@ import { TDate } from 'timeago.js';
|
|
|
5
5
|
import * as _emotion_react from '@emotion/react';
|
|
6
6
|
import { DataVariableDefinition, DataResourceVariables } from '@uniformdev/canvas';
|
|
7
7
|
import * as _uniformdev_mesh_sdk from '@uniformdev/mesh-sdk';
|
|
8
|
-
import { MeshLocation, SetValueOptions, DataSourceLocationValue, DataTypeLocationValue } from '@uniformdev/mesh-sdk';
|
|
8
|
+
import { MeshLocation, SetValueOptions, DataSourceLocationValue, DataTypeLocationValue, UniformMeshSDK, MeshLocationCore } from '@uniformdev/mesh-sdk';
|
|
9
9
|
export * from '@uniformdev/mesh-sdk';
|
|
10
10
|
import { Emitter } from 'mitt';
|
|
11
11
|
import { BadgeThemeProps, InputSelectProps } from '@uniformdev/design-system';
|
|
12
|
-
export { AddListButton, AddListButtonProps, Button, ButtonProps, Callout, CalloutProps, 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 } from '@uniformdev/design-system';
|
|
12
|
+
export { AddListButton, AddListButtonProps, Button, ButtonProps, Callout, CalloutProps, Heading, HeadingProps, Input, InputComboBox, InputComboBoxProps, InputKeywordSearch, InputProps, InputSelect, InputToggle, InputToggleProps, InputKeywordSearch as KeywordSearchInput, 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 } from '@uniformdev/design-system';
|
|
13
13
|
|
|
14
14
|
declare const SvgCaution: (props: SVGProps<SVGSVGElement>) => _emotion_react_types_jsx_namespace.EmotionJSX.Element;
|
|
15
15
|
|
|
@@ -183,6 +183,10 @@ type ProductSearchResult = EntrySearchResult & {
|
|
|
183
183
|
id: string;
|
|
184
184
|
name: string;
|
|
185
185
|
}>;
|
|
186
|
+
/** @deprecated Use `editLink` instead. */
|
|
187
|
+
url?: string;
|
|
188
|
+
/** @deprecated Use `title` instead. */
|
|
189
|
+
name?: string;
|
|
186
190
|
};
|
|
187
191
|
interface ProductSearchResults {
|
|
188
192
|
total: number;
|
|
@@ -386,6 +390,8 @@ declare function useMeshLocation<TLocationType extends MeshLocation['type'], TLo
|
|
|
386
390
|
type: TLocationType;
|
|
387
391
|
}> | Extract<_uniformdev_mesh_sdk.DataTypeLocation, {
|
|
388
392
|
type: TLocationType;
|
|
393
|
+
}> | Extract<_uniformdev_mesh_sdk.DataTypeInstanceLocation, {
|
|
394
|
+
type: TLocationType;
|
|
389
395
|
}> | Extract<_uniformdev_mesh_sdk.DataResourceLocation, {
|
|
390
396
|
type: TLocationType;
|
|
391
397
|
}> | Extract<_uniformdev_mesh_sdk.ParamTypeLocation<TLocationValue, unknown, TLocationSetValue, unknown>, {
|
|
@@ -399,6 +405,8 @@ declare function useMeshLocation<TLocationType extends MeshLocation['type'], TLo
|
|
|
399
405
|
type: TLocationType;
|
|
400
406
|
}> | Extract<_uniformdev_mesh_sdk.DataTypeLocation, {
|
|
401
407
|
type: TLocationType;
|
|
408
|
+
}> | Extract<_uniformdev_mesh_sdk.DataTypeInstanceLocation, {
|
|
409
|
+
type: TLocationType;
|
|
402
410
|
}> | Extract<_uniformdev_mesh_sdk.DataResourceLocation, {
|
|
403
411
|
type: TLocationType;
|
|
404
412
|
}> | Extract<_uniformdev_mesh_sdk.ParamTypeLocation<TLocationValue, unknown, TLocationSetValue, unknown>, {
|
|
@@ -411,6 +419,8 @@ declare function useMeshLocation<TLocationType extends MeshLocation['type'], TLo
|
|
|
411
419
|
type: TLocationType;
|
|
412
420
|
}> | Extract<_uniformdev_mesh_sdk.DataTypeLocation, {
|
|
413
421
|
type: TLocationType;
|
|
422
|
+
}> | Extract<_uniformdev_mesh_sdk.DataTypeInstanceLocation, {
|
|
423
|
+
type: TLocationType;
|
|
414
424
|
}> | Extract<_uniformdev_mesh_sdk.DataResourceLocation, {
|
|
415
425
|
type: TLocationType;
|
|
416
426
|
}> | Extract<_uniformdev_mesh_sdk.ParamTypeLocation<TLocationValue, unknown, TLocationSetValue, unknown>, {
|
|
@@ -460,9 +470,11 @@ declare function variablesToList(variables: Record<string, DataVariableDefinitio
|
|
|
460
470
|
type VariableEditorProps = {
|
|
461
471
|
variable: string;
|
|
462
472
|
onSubmit: (values: DataVariableDefinitionWithName) => void | Promise<void>;
|
|
473
|
+
/** Disables the tip about Mesh integrations. Intended for use when this is placed on a custom Mesh integration to edit variables. */
|
|
474
|
+
disableMeshTip?: boolean;
|
|
463
475
|
onCancel: () => void;
|
|
464
476
|
};
|
|
465
|
-
declare function VariableEditor({ variable, onSubmit, onCancel }: VariableEditorProps): _emotion_react_types_jsx_namespace.EmotionJSX.Element;
|
|
477
|
+
declare function VariableEditor({ variable, onSubmit, onCancel, disableMeshTip }: VariableEditorProps): _emotion_react_types_jsx_namespace.EmotionJSX.Element;
|
|
466
478
|
|
|
467
479
|
declare function VariablesList(): _emotion_react_types_jsx_namespace.EmotionJSX.Element;
|
|
468
480
|
|
|
@@ -1026,6 +1038,56 @@ declare function useRequestParameter(paramName: string): {
|
|
|
1026
1038
|
update: (value: string) => void;
|
|
1027
1039
|
};
|
|
1028
1040
|
|
|
1041
|
+
/** @deprecated */
|
|
1042
|
+
interface UniformMeshLocationContextValue<TLocationValue = unknown, TLocationSetValue = TLocationValue> {
|
|
1043
|
+
location: MeshLocation<TLocationValue, TLocationSetValue>;
|
|
1044
|
+
}
|
|
1045
|
+
/** @deprecated not intended for public usage */
|
|
1046
|
+
declare const UniformMeshLocationContext: React__default.Context<UniformMeshLocationContextValue<unknown, unknown> | undefined>;
|
|
1047
|
+
/** @deprecated not intended for public usage. Use <MeshApp /> instead. */
|
|
1048
|
+
declare const UniformMeshLocationContextProvider: React__default.FC<React__default.PropsWithChildren<unknown>>;
|
|
1049
|
+
/**
|
|
1050
|
+
* Provides access to the current UniformMeshLocationContext value.
|
|
1051
|
+
* @deprecated Not intended for public use. Use `useUniformMeshLocation` instead.
|
|
1052
|
+
*/
|
|
1053
|
+
declare const useUniformMeshLocationContext: <TLocationValue = unknown, TLocationSetValue = TLocationValue>() => UniformMeshLocationContextValue<TLocationValue, TLocationSetValue>;
|
|
1054
|
+
|
|
1055
|
+
interface UniformMeshSdkContextValue {
|
|
1056
|
+
sdk: UniformMeshSDK;
|
|
1057
|
+
}
|
|
1058
|
+
/** @deprecated not intended for public usage */
|
|
1059
|
+
declare const UniformMeshSdkContext: React__default.Context<UniformMeshSdkContextValue | undefined>;
|
|
1060
|
+
/** @deprecated not intended for public usage; use <MeshApp /> instead */
|
|
1061
|
+
declare const UniformMeshSdkContextProvider: React__default.FC<React__default.PropsWithChildren<unknown>>;
|
|
1062
|
+
/**
|
|
1063
|
+
* Provides access to the current (initialized) Uniform Mesh SDK context value.
|
|
1064
|
+
* @deprecated Not intended for public use. Use `useUniformMeshLocation` or `useUniformMeshSdk` instead.
|
|
1065
|
+
*/
|
|
1066
|
+
declare const useUniformMeshSdkContext: () => UniformMeshSdkContextValue;
|
|
1067
|
+
|
|
1068
|
+
interface UseUniformMeshSdkOptions {
|
|
1069
|
+
autoResizingDisabled?: boolean;
|
|
1070
|
+
}
|
|
1071
|
+
/**
|
|
1072
|
+
* Provides a React-hook wrapper around Uniform Mesh SDK initialization.
|
|
1073
|
+
* NOTE: initialization is an async operation and should be handled as such.
|
|
1074
|
+
*
|
|
1075
|
+
* @deprecated prefer <MeshApp /> to initialize and provide in a single component
|
|
1076
|
+
*/
|
|
1077
|
+
declare const useInitializeUniformMeshSdk: ({ autoResizingDisabled }?: UseUniformMeshSdkOptions) => {
|
|
1078
|
+
initializing: boolean;
|
|
1079
|
+
error: Error | undefined;
|
|
1080
|
+
sdk: UniformMeshSDK | undefined;
|
|
1081
|
+
};
|
|
1082
|
+
|
|
1083
|
+
/**
|
|
1084
|
+
* Provides convenient access to the current Uniform Mesh location via React hook.
|
|
1085
|
+
* Intended to be used within <MeshApp />.
|
|
1086
|
+
*
|
|
1087
|
+
* @deprecated prefer useMeshLocation which has much more accurate type safety
|
|
1088
|
+
*/
|
|
1089
|
+
declare function useUniformMeshLocation<TLocationValue = unknown, TLocationMetadata = never, TLocationSetValue = TLocationValue>(): MeshLocationCore<TLocationValue, TLocationMetadata, TLocationSetValue>;
|
|
1090
|
+
|
|
1029
1091
|
/**
|
|
1030
1092
|
* Provides convenient access to the current Uniform Mesh SDK instance via React hook.
|
|
1031
1093
|
* Intended to be used within <MeshApp />.
|
|
@@ -1041,4 +1103,4 @@ declare function useUniformMeshSdk(): _uniformdev_mesh_sdk.UniformMeshSDK;
|
|
|
1041
1103
|
*/
|
|
1042
1104
|
declare function createLocationValidator<TSetValue>(setValue: SetLocationValueDispatch<TSetValue>, validate: (newValue: TSetValue, currentResult: SetValueOptions | undefined) => SetValueOptions): SetLocationValueDispatch<TSetValue>;
|
|
1043
1105
|
|
|
1044
|
-
export { BaseRequestData, Brand, DamItem, DamSelectedItem, DamSelectedItemProps, DataRefreshButton, DataRefreshButtonProps, DataResourceVariableRendererProps, DataResourceVariablesList, DataResourceVariablesListProps, DataSourceEditor, DataSourceEditorProps, DataTypeEditor, DataTypeEditorProps, DataVariableDefinitionWithName, DefaultSearchRow, DefaultSelectedItem, DispatchResult, EntrySearch, EntrySearchContentType, EntrySearchProps, EntrySearchQueryOptions, EntrySearchResult, EntrySearchRowProps, EntrySearchSelectedItemProps, GetProductOptions, GetProductsOptions, index as Icons, InputToken, InputVariables, InputVariablesProps, ItemListProps, LinkButton, MeshApp, MeshAppProps, NoResultsProps, ObjectSearchContainer, ObjectSearchContainerProps, ObjectSearchContextProps, ObjectSearchFilter, ObjectSearchFilterContainer, ObjectSearchFilterContainerProps, ObjectSearchFilterProps, ObjectSearchListItem, ObjectSearchListItemLoadingSkeleton, ObjectSearchListItemProps, ObjectSearchProvider, ObjectSearchProviderProps, ObjectSearchResultItem, ObjectSearchResultItemButton, ObjectSearchResultItemButtonProps, ObjectSearchResultItemProps, ObjectSearchResultList, ObjectSearchResultListProps, ProductCategory, ProductDynamicSelectorValue, ProductPreviewList, ProductQuery, ProductQueryCategory, ProductQueryContext, ProductQueryContextValue, ProductQueryProps, ProductSearch, ProductSearchContext, ProductSearchContextValue, ProductSearchProps, ProductSearchResult, ProductSearchResults, ProductSearchRow, ProductSelectedItem, QueryFilter, QueryFilterProps, QueryFilterSearchProps, RequestAction, RequestBody, RequestContext, RequestData, RequestHeaders, RequestMethodSelect, RequestParameter, RequestParameters, RequestParametersProps, RequestProvider, RequestProviderProps, RequestTypeContainer, RequestTypeContainerProps, RequestUrl, RequestUrlInput, ResolvableLoadingValue, SearchQueryProps, SelectedItemProps, SelectionField, SelectionFieldValue, SetLocationValueDispatch, SetLocationValueFunction, TextVariableRenderer, VariableEditor, VariableEditorProps, VariablesAction, VariablesContext, VariablesEvents, VariablesList, VariablesProvider, VariablesProviderProps, badgeIcon, createLocationValidator, damSelectItemImage, damSelectedItemContainer, damSelectedItemCopy, damSelectedItemDetails, damSelectedItemIcon, damSelectedItemInfoBtn, damSelectedItemInner, damSelectedItemLinkBtn, damSelectedItemLinkContainer, damSelectedItemMediaContainer, damSelectedItemPopover, damSelectedItemPopoverLabel, damSelectedItemSmallText, damSelectedItemTitle, draggableContainer, draggableIcon, draggableIconOffset, draggableIconWrapper, entrySearchBtn, entrySearchConfig, entrySearchConfigHidden, entrySearchLoadMoreBtn, entrySearchResultList, entrySearchSelectIcon, entrySearchSelectImg, entrySearchSelectInput, entrySearchSelectOption, entrySearchWrapper, productSearchRowActiveIcon, productSearchRowCategory, productSearchRowContainer, productSearchRowContent, productSearchRowContentActive, productSearchRowDetails, productSearchRowTitle, productSelectedItemContainer, productSelectedItemContent, productSelectedItemDetails, productSelectedItemIcon, productSelectedItemImage, productSelectedItemLinkContainer, productedSelectedItemLinkBtn, productedSelectedItemSmallText, searchRowBtn, searchRowContainer, searchRowContainerActive, searchRowContainerWithPopover, searchRowPopover, searchRowText, searchRowTextSmall, selectItemLinkBtn, selectItemLinkContainer, selectItemPopover, selectItemPopoverLabel, selectItemSmallText, selectedItemContainer, selectedItemCopy, selectedItemDetails, selectedItemIcon, selectedItemInner, selectedItemTitle, urlEncodeRequestParameter, urlEncodeRequestUrl, useMeshLocation, useObjectSearchContext, useProductQueryContext, useProductSearchContext, useRequest, useRequestHeader, useRequestParameter, useUniformMeshSdk, useVariables, variablesToList };
|
|
1106
|
+
export { BaseRequestData, Brand, DamItem, DamSelectedItem, DamSelectedItemProps, DataRefreshButton, DataRefreshButtonProps, DataResourceVariableRendererProps, DataResourceVariablesList, DataResourceVariablesListProps, DataSourceEditor, DataSourceEditorProps, DataTypeEditor, DataTypeEditorProps, DataVariableDefinitionWithName, DefaultSearchRow, DefaultSelectedItem, DispatchResult, EntrySearch, EntrySearchContentType, EntrySearchProps, EntrySearchQueryOptions, EntrySearchResult, EntrySearchRowProps, EntrySearchSelectedItemProps, GetProductOptions, GetProductsOptions, index as Icons, InputToken, InputVariables, InputVariablesProps, ItemListProps, LinkButton, MeshApp, MeshAppProps, NoResultsProps, ObjectSearchContainer, ObjectSearchContainerProps, ObjectSearchContextProps, ObjectSearchFilter, ObjectSearchFilterContainer, ObjectSearchFilterContainerProps, ObjectSearchFilterProps, ObjectSearchListItem, ObjectSearchListItemLoadingSkeleton, ObjectSearchListItemProps, ObjectSearchProvider, ObjectSearchProviderProps, ObjectSearchResultItem, ObjectSearchResultItemButton, ObjectSearchResultItemButtonProps, ObjectSearchResultItemProps, ObjectSearchResultList, ObjectSearchResultListProps, ProductCategory, ProductDynamicSelectorValue, ProductPreviewList, ProductQuery, ProductQueryCategory, ProductQueryContext, ProductQueryContextValue, ProductQueryProps, ProductSearch, ProductSearchContext, ProductSearchContextValue, ProductSearchProps, ProductSearchResult, ProductSearchResults, ProductSearchRow, ProductSelectedItem, QueryFilter, QueryFilterProps, QueryFilterSearchProps, RequestAction, RequestBody, RequestContext, RequestData, RequestHeaders, RequestMethodSelect, RequestParameter, RequestParameters, RequestParametersProps, RequestProvider, RequestProviderProps, RequestTypeContainer, RequestTypeContainerProps, RequestUrl, RequestUrlInput, ResolvableLoadingValue, SearchQueryProps, SelectedItemProps, SelectionField, SelectionFieldValue, SetLocationValueDispatch, SetLocationValueFunction, TextVariableRenderer, UniformMeshLocationContext, UniformMeshLocationContextProvider, UniformMeshLocationContextValue, UniformMeshSdkContext, UniformMeshSdkContextProvider, UniformMeshSdkContextValue, UseUniformMeshSdkOptions, VariableEditor, VariableEditorProps, VariablesAction, VariablesContext, VariablesEvents, VariablesList, VariablesProvider, VariablesProviderProps, badgeIcon, createLocationValidator, damSelectItemImage, damSelectedItemContainer, damSelectedItemCopy, damSelectedItemDetails, damSelectedItemIcon, damSelectedItemInfoBtn, damSelectedItemInner, damSelectedItemLinkBtn, damSelectedItemLinkContainer, damSelectedItemMediaContainer, damSelectedItemPopover, damSelectedItemPopoverLabel, damSelectedItemSmallText, damSelectedItemTitle, draggableContainer, draggableIcon, draggableIconOffset, draggableIconWrapper, entrySearchBtn, entrySearchConfig, entrySearchConfigHidden, entrySearchLoadMoreBtn, entrySearchResultList, entrySearchSelectIcon, entrySearchSelectImg, entrySearchSelectInput, entrySearchSelectOption, entrySearchWrapper, productSearchRowActiveIcon, productSearchRowCategory, productSearchRowContainer, productSearchRowContent, productSearchRowContentActive, productSearchRowDetails, productSearchRowTitle, productSelectedItemContainer, productSelectedItemContent, productSelectedItemDetails, productSelectedItemIcon, productSelectedItemImage, productSelectedItemLinkContainer, productedSelectedItemLinkBtn, productedSelectedItemSmallText, searchRowBtn, searchRowContainer, searchRowContainerActive, searchRowContainerWithPopover, searchRowPopover, searchRowText, searchRowTextSmall, selectItemLinkBtn, selectItemLinkContainer, selectItemPopover, selectItemPopoverLabel, selectItemSmallText, selectedItemContainer, selectedItemCopy, selectedItemDetails, selectedItemIcon, selectedItemInner, selectedItemTitle, urlEncodeRequestParameter, urlEncodeRequestUrl, useInitializeUniformMeshSdk, useMeshLocation, useObjectSearchContext, useProductQueryContext, useProductSearchContext, useRequest, useRequestHeader, useRequestParameter, useUniformMeshLocation, useUniformMeshLocationContext, useUniformMeshSdk, useUniformMeshSdkContext, useVariables, variablesToList };
|
package/dist/index.esm.js
CHANGED
|
@@ -893,7 +893,7 @@ var ProductPreviewList = ({
|
|
|
893
893
|
scrollbarStyles
|
|
894
894
|
],
|
|
895
895
|
children: products == null ? void 0 : products.map((product, index) => {
|
|
896
|
-
var _a;
|
|
896
|
+
var _a, _b;
|
|
897
897
|
const [category] = (product == null ? void 0 : product.categories) || [];
|
|
898
898
|
const categoryName = typeof category === "undefined" || !categories ? void 0 : (_a = categories.find((c) => c.id === category.id)) == null ? void 0 : _a.name;
|
|
899
899
|
return /* @__PURE__ */ jsx18("li", { css: productPreviewListItem, children: /* @__PURE__ */ jsxs7(
|
|
@@ -906,13 +906,13 @@ var ProductPreviewList = ({
|
|
|
906
906
|
"img",
|
|
907
907
|
{
|
|
908
908
|
src: product.thumbnailUrl,
|
|
909
|
-
alt: typeof product.title === "string" ? product.title : `Product ${index}`,
|
|
909
|
+
alt: typeof product.title === "string" ? product.title : product.name || `Product ${index}`,
|
|
910
910
|
css: productPreviewListImage,
|
|
911
911
|
"data-test-id": "product-image"
|
|
912
912
|
}
|
|
913
913
|
) : /* @__PURE__ */ jsx18("div", { css: productPreviewListImageDefault }),
|
|
914
914
|
/* @__PURE__ */ jsxs7("h4", { css: productPreviewListTitle, "data-test-id": "product-name", children: [
|
|
915
|
-
product.title,
|
|
915
|
+
product.title || product.name,
|
|
916
916
|
categoryName && /* @__PURE__ */ jsx18("span", { css: productPreviewListCategoryText, children: categoryName })
|
|
917
917
|
] }),
|
|
918
918
|
product && /* @__PURE__ */ jsxs7(Fragment2, { children: [
|
|
@@ -925,12 +925,12 @@ var ProductPreviewList = ({
|
|
|
925
925
|
"Price: ",
|
|
926
926
|
product.price
|
|
927
927
|
] }) : null,
|
|
928
|
-
product.editLink ? /* @__PURE__ */ jsxs7(
|
|
928
|
+
product.editLink || product.url ? /* @__PURE__ */ jsxs7(
|
|
929
929
|
"a",
|
|
930
930
|
{
|
|
931
931
|
css: productPreviewListLinkBtn,
|
|
932
|
-
href: product.editLink,
|
|
933
|
-
title: `Go to ${product.title}`,
|
|
932
|
+
href: (_b = product.editLink) != null ? _b : product.url,
|
|
933
|
+
title: `Go to ${product.title || product.name}`,
|
|
934
934
|
target: "_blank",
|
|
935
935
|
rel: "noopener noreferrer",
|
|
936
936
|
"data-test-id": "edit-product-button",
|
|
@@ -2642,7 +2642,7 @@ function DefaultDamItemRenderer({ item }) {
|
|
|
2642
2642
|
}
|
|
2643
2643
|
|
|
2644
2644
|
// src/components/DataResourceVariablesList.tsx
|
|
2645
|
-
import { Callout as
|
|
2645
|
+
import { Callout as Callout4, Input as Input4 } from "@uniformdev/design-system";
|
|
2646
2646
|
|
|
2647
2647
|
// src/hooks/useMeshLocation.ts
|
|
2648
2648
|
import { useMemo as useMemo4, useRef as useRef7 } from "react";
|
|
@@ -2655,6 +2655,18 @@ import { Theme } from "@uniformdev/design-system";
|
|
|
2655
2655
|
import { createContext, useContext as useContext3 } from "react";
|
|
2656
2656
|
import { jsx as jsx26, jsxs as jsxs15 } from "@emotion/react/jsx-runtime";
|
|
2657
2657
|
var UniformMeshSdkContext = createContext(void 0);
|
|
2658
|
+
var UniformMeshSdkContextProvider = ({ children }) => {
|
|
2659
|
+
let value = void 0;
|
|
2660
|
+
if (typeof window !== "undefined" && typeof window.UniformMeshSDK !== "undefined") {
|
|
2661
|
+
value = {
|
|
2662
|
+
sdk: window.UniformMeshSDK
|
|
2663
|
+
};
|
|
2664
|
+
}
|
|
2665
|
+
return /* @__PURE__ */ jsxs15(UniformMeshSdkContext.Provider, { value, children: [
|
|
2666
|
+
/* @__PURE__ */ jsx26(Theme, {}),
|
|
2667
|
+
/* @__PURE__ */ jsx26(UniformMeshLocationContextProvider, { children })
|
|
2668
|
+
] });
|
|
2669
|
+
};
|
|
2658
2670
|
var useUniformMeshSdkContext = () => {
|
|
2659
2671
|
const context = useContext3(UniformMeshSdkContext);
|
|
2660
2672
|
if (!context) {
|
|
@@ -2671,7 +2683,9 @@ function useUniformMeshSdk() {
|
|
|
2671
2683
|
|
|
2672
2684
|
// src/components/UniformMeshLocationContext.tsx
|
|
2673
2685
|
import { jsx as jsx27 } from "@emotion/react/jsx-runtime";
|
|
2674
|
-
var UniformMeshLocationContext = createContext2(
|
|
2686
|
+
var UniformMeshLocationContext = createContext2(
|
|
2687
|
+
void 0
|
|
2688
|
+
);
|
|
2675
2689
|
var UniformMeshLocationContextProvider = ({
|
|
2676
2690
|
children
|
|
2677
2691
|
}) => {
|
|
@@ -2702,9 +2716,20 @@ var useUniformMeshLocationContext = () => {
|
|
|
2702
2716
|
};
|
|
2703
2717
|
|
|
2704
2718
|
// src/hooks/useMeshLocation.ts
|
|
2719
|
+
var legacyWarned = false;
|
|
2705
2720
|
function useMeshLocation(expectedLocation) {
|
|
2706
2721
|
const { location } = useUniformMeshLocationContext();
|
|
2707
|
-
|
|
2722
|
+
let effectiveExpected = expectedLocation;
|
|
2723
|
+
if (expectedLocation === "dataTypeInstance") {
|
|
2724
|
+
effectiveExpected = "dataResource";
|
|
2725
|
+
if (!legacyWarned) {
|
|
2726
|
+
console.warn(
|
|
2727
|
+
"`dataTypeInstance` mesh location is deprecated, please switch to `dataResource` instead."
|
|
2728
|
+
);
|
|
2729
|
+
legacyWarned = true;
|
|
2730
|
+
}
|
|
2731
|
+
}
|
|
2732
|
+
if (effectiveExpected && location.type !== effectiveExpected) {
|
|
2708
2733
|
throw new Error(`Expected location type ${expectedLocation} but got ${location.type}`);
|
|
2709
2734
|
}
|
|
2710
2735
|
const backdoorLocation = useRef7(location);
|
|
@@ -2793,8 +2818,10 @@ import mitt from "mitt";
|
|
|
2793
2818
|
import * as React10 from "react";
|
|
2794
2819
|
|
|
2795
2820
|
// src/components/Variables/VariableEditor.tsx
|
|
2796
|
-
import {
|
|
2797
|
-
import {
|
|
2821
|
+
import { zodResolver } from "@hookform/resolvers/zod";
|
|
2822
|
+
import { Button as Button2, Callout as Callout3, Input as Input2, useShortcut } from "@uniformdev/design-system";
|
|
2823
|
+
import { useForm } from "react-hook-form";
|
|
2824
|
+
import { z } from "zod";
|
|
2798
2825
|
|
|
2799
2826
|
// src/components/Variables/InputVariables.styles.ts
|
|
2800
2827
|
import { css as css19 } from "@emotion/react";
|
|
@@ -2810,57 +2837,90 @@ var variablesFormBtnGroup = css19`
|
|
|
2810
2837
|
|
|
2811
2838
|
// src/components/Variables/VariableEditor.tsx
|
|
2812
2839
|
import { jsx as jsx28, jsxs as jsxs16 } from "@emotion/react/jsx-runtime";
|
|
2813
|
-
|
|
2814
|
-
|
|
2840
|
+
var schema = z.object({
|
|
2841
|
+
name: z.string().nonempty("Name can't be empty").regex(/^[^${}]+$/, "$, {, and } are reserved characters and cannot be used in a variable name"),
|
|
2842
|
+
default: z.string(),
|
|
2843
|
+
displayName: z.string().optional(),
|
|
2844
|
+
helpText: z.string().optional(),
|
|
2845
|
+
order: z.number().optional(),
|
|
2846
|
+
type: z.string().optional()
|
|
2847
|
+
});
|
|
2848
|
+
function VariableEditor({ variable, onSubmit, onCancel, disableMeshTip }) {
|
|
2849
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
2815
2850
|
const { variables } = useVariables();
|
|
2816
|
-
|
|
2817
|
-
|
|
2818
|
-
{
|
|
2819
|
-
|
|
2820
|
-
|
|
2821
|
-
|
|
2822
|
-
|
|
2823
|
-
|
|
2824
|
-
|
|
2825
|
-
|
|
2826
|
-
|
|
2827
|
-
|
|
2828
|
-
|
|
2829
|
-
|
|
2830
|
-
|
|
2831
|
-
|
|
2832
|
-
|
|
2833
|
-
|
|
2834
|
-
|
|
2835
|
-
|
|
2836
|
-
|
|
2837
|
-
|
|
2838
|
-
|
|
2839
|
-
|
|
2840
|
-
|
|
2841
|
-
|
|
2842
|
-
|
|
2843
|
-
|
|
2844
|
-
|
|
2845
|
-
|
|
2846
|
-
|
|
2847
|
-
|
|
2848
|
-
|
|
2849
|
-
|
|
2850
|
-
|
|
2851
|
-
|
|
2852
|
-
|
|
2853
|
-
|
|
2854
|
-
|
|
2855
|
-
),
|
|
2856
|
-
|
|
2857
|
-
|
|
2858
|
-
|
|
2859
|
-
|
|
2860
|
-
|
|
2861
|
-
|
|
2862
|
-
|
|
2863
|
-
|
|
2851
|
+
const currentVariable = variables[variable];
|
|
2852
|
+
const { register, handleSubmit, formState } = useForm({
|
|
2853
|
+
defaultValues: {
|
|
2854
|
+
name: variable,
|
|
2855
|
+
default: (_a = currentVariable == null ? void 0 : currentVariable.default) != null ? _a : "",
|
|
2856
|
+
displayName: (_b = currentVariable == null ? void 0 : currentVariable.displayName) != null ? _b : "",
|
|
2857
|
+
helpText: (_c = currentVariable == null ? void 0 : currentVariable.helpText) != null ? _c : "",
|
|
2858
|
+
order: currentVariable == null ? void 0 : currentVariable.order,
|
|
2859
|
+
type: (_d = currentVariable == null ? void 0 : currentVariable.type) != null ? _d : ""
|
|
2860
|
+
},
|
|
2861
|
+
resolver: zodResolver(schema)
|
|
2862
|
+
});
|
|
2863
|
+
const submitHandler = handleSubmit((values) => {
|
|
2864
|
+
const finalValue = {
|
|
2865
|
+
...values,
|
|
2866
|
+
helpText: values.helpText || void 0,
|
|
2867
|
+
type: values.type || void 0,
|
|
2868
|
+
displayName: values.displayName || void 0
|
|
2869
|
+
};
|
|
2870
|
+
return onSubmit(finalValue);
|
|
2871
|
+
});
|
|
2872
|
+
useShortcut({
|
|
2873
|
+
shortcut: "enter",
|
|
2874
|
+
handler: () => {
|
|
2875
|
+
submitHandler();
|
|
2876
|
+
},
|
|
2877
|
+
activeWhenEditing: true
|
|
2878
|
+
});
|
|
2879
|
+
return (
|
|
2880
|
+
// NOTE: this is intentionally NOT a <form> because it's regularly used in a nested modal and that can make it bubble
|
|
2881
|
+
// up a submit to its 'parent form' which is not what we want.
|
|
2882
|
+
/* @__PURE__ */ jsxs16("div", { css: variablesFormContainer, children: [
|
|
2883
|
+
/* @__PURE__ */ jsx28(
|
|
2884
|
+
Input2,
|
|
2885
|
+
{
|
|
2886
|
+
...register("name"),
|
|
2887
|
+
label: "Name",
|
|
2888
|
+
disabled: variable !== "",
|
|
2889
|
+
caption: "This cannot change once created.",
|
|
2890
|
+
errorMessage: (_e = formState.errors.name) == null ? void 0 : _e.message,
|
|
2891
|
+
"data-af": "1"
|
|
2892
|
+
}
|
|
2893
|
+
),
|
|
2894
|
+
/* @__PURE__ */ jsx28(
|
|
2895
|
+
Input2,
|
|
2896
|
+
{
|
|
2897
|
+
...register("helpText"),
|
|
2898
|
+
label: "Help Text",
|
|
2899
|
+
caption: "Appears when entering a value for this variable.",
|
|
2900
|
+
autoComplete: "off",
|
|
2901
|
+
errorMessage: (_f = formState.errors.helpText) == null ? void 0 : _f.message
|
|
2902
|
+
}
|
|
2903
|
+
),
|
|
2904
|
+
/* @__PURE__ */ jsx28(
|
|
2905
|
+
Input2,
|
|
2906
|
+
{
|
|
2907
|
+
...register("default"),
|
|
2908
|
+
label: "Default Value",
|
|
2909
|
+
autoComplete: "off",
|
|
2910
|
+
errorMessage: (_g = formState.errors.default) == null ? void 0 : _g.message
|
|
2911
|
+
}
|
|
2912
|
+
),
|
|
2913
|
+
/* @__PURE__ */ jsxs16("div", { css: variablesFormBtnGroup, children: [
|
|
2914
|
+
/* @__PURE__ */ jsx28(Button2, { type: "button", onClick: submitHandler, children: "OK" }),
|
|
2915
|
+
/* @__PURE__ */ jsx28(Button2, { type: "button", buttonType: "ghost", onClick: onCancel, children: "Cancel" })
|
|
2916
|
+
] }),
|
|
2917
|
+
disableMeshTip ? null : /* @__PURE__ */ jsxs16(Callout3, { type: "tip", title: "Customized User Interfaces", children: [
|
|
2918
|
+
"Developers can create customized user interfaces for variable editing by building a Uniform mesh integration. Get started quickly with our",
|
|
2919
|
+
" ",
|
|
2920
|
+
/* @__PURE__ */ jsx28("a", { href: "https://docs.uniform.app", target: "_blank", rel: "noopener noreferrer", children: "Mesh SDK" }),
|
|
2921
|
+
"."
|
|
2922
|
+
] })
|
|
2923
|
+
] })
|
|
2864
2924
|
);
|
|
2865
2925
|
}
|
|
2866
2926
|
|
|
@@ -3284,13 +3344,13 @@ function DataResourceVariablesList({
|
|
|
3284
3344
|
const {
|
|
3285
3345
|
value,
|
|
3286
3346
|
metadata: { dataType }
|
|
3287
|
-
} = useMeshLocation("
|
|
3347
|
+
} = useMeshLocation("dataTypeInstance");
|
|
3288
3348
|
const variableDefinitions = variablesToList(dataType.variables);
|
|
3289
3349
|
if (variableDefinitions.length === 0) {
|
|
3290
3350
|
if (NoVariablesComponent) {
|
|
3291
3351
|
return /* @__PURE__ */ jsx33(NoVariablesComponent, {});
|
|
3292
3352
|
}
|
|
3293
|
-
return /* @__PURE__ */ jsx33(
|
|
3353
|
+
return /* @__PURE__ */ jsx33(Callout4, { type: "note", children: "No settings are required." });
|
|
3294
3354
|
}
|
|
3295
3355
|
return /* @__PURE__ */ jsx33("div", { children: variableDefinitions.map((variableDefinition) => {
|
|
3296
3356
|
var _a, _b, _c;
|
|
@@ -4750,6 +4810,12 @@ var QueryFilter = ({
|
|
|
4750
4810
|
] });
|
|
4751
4811
|
};
|
|
4752
4812
|
|
|
4813
|
+
// src/hooks/useUniformMeshLocation.ts
|
|
4814
|
+
function useUniformMeshLocation() {
|
|
4815
|
+
const { location } = useUniformMeshLocationContext();
|
|
4816
|
+
return location;
|
|
4817
|
+
}
|
|
4818
|
+
|
|
4753
4819
|
// src/hooks/index.ts
|
|
4754
4820
|
import { ParameterShellContext, useParameterShell } from "@uniformdev/design-system";
|
|
4755
4821
|
|
|
@@ -4765,13 +4831,14 @@ function createLocationValidator(setValue, validate) {
|
|
|
4765
4831
|
import {
|
|
4766
4832
|
AddListButton as AddListButton2,
|
|
4767
4833
|
Button as Button6,
|
|
4768
|
-
Callout as
|
|
4834
|
+
Callout as Callout5,
|
|
4769
4835
|
Heading,
|
|
4770
4836
|
Input as Input8,
|
|
4771
4837
|
InputComboBox,
|
|
4772
4838
|
InputKeywordSearch as InputKeywordSearch4,
|
|
4773
4839
|
InputSelect as InputSelect8,
|
|
4774
4840
|
InputToggle,
|
|
4841
|
+
InputKeywordSearch as InputKeywordSearch5,
|
|
4775
4842
|
Label,
|
|
4776
4843
|
LoadingIndicator as LoadingIndicator4,
|
|
4777
4844
|
LoadingOverlay as LoadingOverlay2,
|
|
@@ -4801,7 +4868,7 @@ export * from "@uniformdev/mesh-sdk";
|
|
|
4801
4868
|
export {
|
|
4802
4869
|
AddListButton2 as AddListButton,
|
|
4803
4870
|
Button6 as Button,
|
|
4804
|
-
|
|
4871
|
+
Callout5 as Callout,
|
|
4805
4872
|
DamSelectedItem,
|
|
4806
4873
|
DataRefreshButton,
|
|
4807
4874
|
DataResourceVariablesList,
|
|
@@ -4818,6 +4885,7 @@ export {
|
|
|
4818
4885
|
InputSelect8 as InputSelect,
|
|
4819
4886
|
InputToggle,
|
|
4820
4887
|
InputVariables,
|
|
4888
|
+
InputKeywordSearch5 as KeywordSearchInput,
|
|
4821
4889
|
Label,
|
|
4822
4890
|
LinkButton,
|
|
4823
4891
|
LoadingIndicator4 as LoadingIndicator,
|
|
@@ -4873,6 +4941,10 @@ export {
|
|
|
4873
4941
|
TextVariableRenderer,
|
|
4874
4942
|
Textarea,
|
|
4875
4943
|
Theme3 as Theme,
|
|
4944
|
+
UniformMeshLocationContext,
|
|
4945
|
+
UniformMeshLocationContextProvider,
|
|
4946
|
+
UniformMeshSdkContext,
|
|
4947
|
+
UniformMeshSdkContextProvider,
|
|
4876
4948
|
VariableEditor,
|
|
4877
4949
|
VariablesList,
|
|
4878
4950
|
VariablesProvider,
|
|
@@ -4941,6 +5013,7 @@ export {
|
|
|
4941
5013
|
selectedItemTitle,
|
|
4942
5014
|
urlEncodeRequestParameter,
|
|
4943
5015
|
urlEncodeRequestUrl,
|
|
5016
|
+
useInitializeUniformMeshSdk,
|
|
4944
5017
|
useMeshLocation,
|
|
4945
5018
|
useObjectSearchContext,
|
|
4946
5019
|
useParameterShell,
|
|
@@ -4949,7 +5022,10 @@ export {
|
|
|
4949
5022
|
useRequest,
|
|
4950
5023
|
useRequestHeader,
|
|
4951
5024
|
useRequestParameter,
|
|
5025
|
+
useUniformMeshLocation,
|
|
5026
|
+
useUniformMeshLocationContext,
|
|
4952
5027
|
useUniformMeshSdk,
|
|
5028
|
+
useUniformMeshSdkContext,
|
|
4953
5029
|
useVariables,
|
|
4954
5030
|
variablesToList
|
|
4955
5031
|
};
|
package/dist/index.js
CHANGED
|
@@ -50,6 +50,7 @@ __export(src_exports, {
|
|
|
50
50
|
InputSelect: () => import_design_system34.InputSelect,
|
|
51
51
|
InputToggle: () => import_design_system34.InputToggle,
|
|
52
52
|
InputVariables: () => InputVariables,
|
|
53
|
+
KeywordSearchInput: () => import_design_system34.InputKeywordSearch,
|
|
53
54
|
Label: () => import_design_system34.Label,
|
|
54
55
|
LinkButton: () => LinkButton,
|
|
55
56
|
LoadingIndicator: () => import_design_system34.LoadingIndicator,
|
|
@@ -105,6 +106,10 @@ __export(src_exports, {
|
|
|
105
106
|
TextVariableRenderer: () => TextVariableRenderer,
|
|
106
107
|
Textarea: () => import_design_system34.Textarea,
|
|
107
108
|
Theme: () => import_design_system34.Theme,
|
|
109
|
+
UniformMeshLocationContext: () => UniformMeshLocationContext,
|
|
110
|
+
UniformMeshLocationContextProvider: () => UniformMeshLocationContextProvider,
|
|
111
|
+
UniformMeshSdkContext: () => UniformMeshSdkContext,
|
|
112
|
+
UniformMeshSdkContextProvider: () => UniformMeshSdkContextProvider,
|
|
108
113
|
VariableEditor: () => VariableEditor,
|
|
109
114
|
VariablesList: () => VariablesList,
|
|
110
115
|
VariablesProvider: () => VariablesProvider,
|
|
@@ -173,6 +178,7 @@ __export(src_exports, {
|
|
|
173
178
|
selectedItemTitle: () => selectedItemTitle,
|
|
174
179
|
urlEncodeRequestParameter: () => urlEncodeRequestParameter,
|
|
175
180
|
urlEncodeRequestUrl: () => urlEncodeRequestUrl,
|
|
181
|
+
useInitializeUniformMeshSdk: () => useInitializeUniformMeshSdk,
|
|
176
182
|
useMeshLocation: () => useMeshLocation,
|
|
177
183
|
useObjectSearchContext: () => useObjectSearchContext,
|
|
178
184
|
useParameterShell: () => import_design_system33.useParameterShell,
|
|
@@ -181,7 +187,10 @@ __export(src_exports, {
|
|
|
181
187
|
useRequest: () => useRequest,
|
|
182
188
|
useRequestHeader: () => useRequestHeader,
|
|
183
189
|
useRequestParameter: () => useRequestParameter,
|
|
190
|
+
useUniformMeshLocation: () => useUniformMeshLocation,
|
|
191
|
+
useUniformMeshLocationContext: () => useUniformMeshLocationContext,
|
|
184
192
|
useUniformMeshSdk: () => useUniformMeshSdk,
|
|
193
|
+
useUniformMeshSdkContext: () => useUniformMeshSdkContext,
|
|
185
194
|
useVariables: () => useVariables,
|
|
186
195
|
variablesToList: () => variablesToList
|
|
187
196
|
});
|
|
@@ -1076,7 +1085,7 @@ var ProductPreviewList = ({
|
|
|
1076
1085
|
import_design_system3.scrollbarStyles
|
|
1077
1086
|
],
|
|
1078
1087
|
children: products == null ? void 0 : products.map((product, index) => {
|
|
1079
|
-
var _a;
|
|
1088
|
+
var _a, _b;
|
|
1080
1089
|
const [category] = (product == null ? void 0 : product.categories) || [];
|
|
1081
1090
|
const categoryName = typeof category === "undefined" || !categories ? void 0 : (_a = categories.find((c) => c.id === category.id)) == null ? void 0 : _a.name;
|
|
1082
1091
|
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("li", { css: productPreviewListItem, children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
|
|
@@ -1089,13 +1098,13 @@ var ProductPreviewList = ({
|
|
|
1089
1098
|
"img",
|
|
1090
1099
|
{
|
|
1091
1100
|
src: product.thumbnailUrl,
|
|
1092
|
-
alt: typeof product.title === "string" ? product.title : `Product ${index}`,
|
|
1101
|
+
alt: typeof product.title === "string" ? product.title : product.name || `Product ${index}`,
|
|
1093
1102
|
css: productPreviewListImage,
|
|
1094
1103
|
"data-test-id": "product-image"
|
|
1095
1104
|
}
|
|
1096
1105
|
) : /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { css: productPreviewListImageDefault }),
|
|
1097
1106
|
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("h4", { css: productPreviewListTitle, "data-test-id": "product-name", children: [
|
|
1098
|
-
product.title,
|
|
1107
|
+
product.title || product.name,
|
|
1099
1108
|
categoryName && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { css: productPreviewListCategoryText, children: categoryName })
|
|
1100
1109
|
] }),
|
|
1101
1110
|
product && /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_jsx_runtime18.Fragment, { children: [
|
|
@@ -1108,12 +1117,12 @@ var ProductPreviewList = ({
|
|
|
1108
1117
|
"Price: ",
|
|
1109
1118
|
product.price
|
|
1110
1119
|
] }) : null,
|
|
1111
|
-
product.editLink ? /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
|
|
1120
|
+
product.editLink || product.url ? /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
|
|
1112
1121
|
"a",
|
|
1113
1122
|
{
|
|
1114
1123
|
css: productPreviewListLinkBtn,
|
|
1115
|
-
href: product.editLink,
|
|
1116
|
-
title: `Go to ${product.title}`,
|
|
1124
|
+
href: (_b = product.editLink) != null ? _b : product.url,
|
|
1125
|
+
title: `Go to ${product.title || product.name}`,
|
|
1117
1126
|
target: "_blank",
|
|
1118
1127
|
rel: "noopener noreferrer",
|
|
1119
1128
|
"data-test-id": "edit-product-button",
|
|
@@ -2828,6 +2837,18 @@ var import_design_system13 = require("@uniformdev/design-system");
|
|
|
2828
2837
|
var import_react25 = require("react");
|
|
2829
2838
|
var import_jsx_runtime26 = require("@emotion/react/jsx-runtime");
|
|
2830
2839
|
var UniformMeshSdkContext = (0, import_react25.createContext)(void 0);
|
|
2840
|
+
var UniformMeshSdkContextProvider = ({ children }) => {
|
|
2841
|
+
let value = void 0;
|
|
2842
|
+
if (typeof window !== "undefined" && typeof window.UniformMeshSDK !== "undefined") {
|
|
2843
|
+
value = {
|
|
2844
|
+
sdk: window.UniformMeshSDK
|
|
2845
|
+
};
|
|
2846
|
+
}
|
|
2847
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(UniformMeshSdkContext.Provider, { value, children: [
|
|
2848
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_design_system13.Theme, {}),
|
|
2849
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(UniformMeshLocationContextProvider, { children })
|
|
2850
|
+
] });
|
|
2851
|
+
};
|
|
2831
2852
|
var useUniformMeshSdkContext = () => {
|
|
2832
2853
|
const context = (0, import_react25.useContext)(UniformMeshSdkContext);
|
|
2833
2854
|
if (!context) {
|
|
@@ -2844,7 +2865,9 @@ function useUniformMeshSdk() {
|
|
|
2844
2865
|
|
|
2845
2866
|
// src/components/UniformMeshLocationContext.tsx
|
|
2846
2867
|
var import_jsx_runtime27 = require("@emotion/react/jsx-runtime");
|
|
2847
|
-
var UniformMeshLocationContext = (0, import_react26.createContext)(
|
|
2868
|
+
var UniformMeshLocationContext = (0, import_react26.createContext)(
|
|
2869
|
+
void 0
|
|
2870
|
+
);
|
|
2848
2871
|
var UniformMeshLocationContextProvider = ({
|
|
2849
2872
|
children
|
|
2850
2873
|
}) => {
|
|
@@ -2875,9 +2898,20 @@ var useUniformMeshLocationContext = () => {
|
|
|
2875
2898
|
};
|
|
2876
2899
|
|
|
2877
2900
|
// src/hooks/useMeshLocation.ts
|
|
2901
|
+
var legacyWarned = false;
|
|
2878
2902
|
function useMeshLocation(expectedLocation) {
|
|
2879
2903
|
const { location } = useUniformMeshLocationContext();
|
|
2880
|
-
|
|
2904
|
+
let effectiveExpected = expectedLocation;
|
|
2905
|
+
if (expectedLocation === "dataTypeInstance") {
|
|
2906
|
+
effectiveExpected = "dataResource";
|
|
2907
|
+
if (!legacyWarned) {
|
|
2908
|
+
console.warn(
|
|
2909
|
+
"`dataTypeInstance` mesh location is deprecated, please switch to `dataResource` instead."
|
|
2910
|
+
);
|
|
2911
|
+
legacyWarned = true;
|
|
2912
|
+
}
|
|
2913
|
+
}
|
|
2914
|
+
if (effectiveExpected && location.type !== effectiveExpected) {
|
|
2881
2915
|
throw new Error(`Expected location type ${expectedLocation} but got ${location.type}`);
|
|
2882
2916
|
}
|
|
2883
2917
|
const backdoorLocation = (0, import_react27.useRef)(location);
|
|
@@ -2966,8 +3000,10 @@ var import_mitt = __toESM(require("mitt"));
|
|
|
2966
3000
|
var React10 = __toESM(require("react"));
|
|
2967
3001
|
|
|
2968
3002
|
// src/components/Variables/VariableEditor.tsx
|
|
3003
|
+
var import_zod = require("@hookform/resolvers/zod");
|
|
2969
3004
|
var import_design_system14 = require("@uniformdev/design-system");
|
|
2970
|
-
var
|
|
3005
|
+
var import_react_hook_form = require("react-hook-form");
|
|
3006
|
+
var import_zod2 = require("zod");
|
|
2971
3007
|
|
|
2972
3008
|
// src/components/Variables/InputVariables.styles.ts
|
|
2973
3009
|
var import_react29 = require("@emotion/react");
|
|
@@ -2983,57 +3019,90 @@ var variablesFormBtnGroup = import_react29.css`
|
|
|
2983
3019
|
|
|
2984
3020
|
// src/components/Variables/VariableEditor.tsx
|
|
2985
3021
|
var import_jsx_runtime28 = require("@emotion/react/jsx-runtime");
|
|
2986
|
-
|
|
2987
|
-
|
|
3022
|
+
var schema = import_zod2.z.object({
|
|
3023
|
+
name: import_zod2.z.string().nonempty("Name can't be empty").regex(/^[^${}]+$/, "$, {, and } are reserved characters and cannot be used in a variable name"),
|
|
3024
|
+
default: import_zod2.z.string(),
|
|
3025
|
+
displayName: import_zod2.z.string().optional(),
|
|
3026
|
+
helpText: import_zod2.z.string().optional(),
|
|
3027
|
+
order: import_zod2.z.number().optional(),
|
|
3028
|
+
type: import_zod2.z.string().optional()
|
|
3029
|
+
});
|
|
3030
|
+
function VariableEditor({ variable, onSubmit, onCancel, disableMeshTip }) {
|
|
3031
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
2988
3032
|
const { variables } = useVariables();
|
|
2989
|
-
|
|
2990
|
-
|
|
2991
|
-
{
|
|
2992
|
-
|
|
2993
|
-
|
|
2994
|
-
|
|
2995
|
-
|
|
2996
|
-
|
|
2997
|
-
|
|
2998
|
-
|
|
2999
|
-
|
|
3000
|
-
|
|
3001
|
-
|
|
3002
|
-
|
|
3003
|
-
|
|
3004
|
-
|
|
3005
|
-
|
|
3006
|
-
|
|
3007
|
-
|
|
3008
|
-
|
|
3009
|
-
|
|
3010
|
-
|
|
3011
|
-
|
|
3012
|
-
|
|
3013
|
-
|
|
3014
|
-
|
|
3015
|
-
|
|
3016
|
-
|
|
3017
|
-
|
|
3018
|
-
|
|
3019
|
-
|
|
3020
|
-
|
|
3021
|
-
|
|
3022
|
-
|
|
3023
|
-
|
|
3024
|
-
|
|
3025
|
-
|
|
3026
|
-
|
|
3027
|
-
|
|
3028
|
-
),
|
|
3029
|
-
|
|
3030
|
-
|
|
3031
|
-
|
|
3032
|
-
|
|
3033
|
-
|
|
3034
|
-
|
|
3035
|
-
|
|
3036
|
-
|
|
3033
|
+
const currentVariable = variables[variable];
|
|
3034
|
+
const { register, handleSubmit, formState } = (0, import_react_hook_form.useForm)({
|
|
3035
|
+
defaultValues: {
|
|
3036
|
+
name: variable,
|
|
3037
|
+
default: (_a = currentVariable == null ? void 0 : currentVariable.default) != null ? _a : "",
|
|
3038
|
+
displayName: (_b = currentVariable == null ? void 0 : currentVariable.displayName) != null ? _b : "",
|
|
3039
|
+
helpText: (_c = currentVariable == null ? void 0 : currentVariable.helpText) != null ? _c : "",
|
|
3040
|
+
order: currentVariable == null ? void 0 : currentVariable.order,
|
|
3041
|
+
type: (_d = currentVariable == null ? void 0 : currentVariable.type) != null ? _d : ""
|
|
3042
|
+
},
|
|
3043
|
+
resolver: (0, import_zod.zodResolver)(schema)
|
|
3044
|
+
});
|
|
3045
|
+
const submitHandler = handleSubmit((values) => {
|
|
3046
|
+
const finalValue = {
|
|
3047
|
+
...values,
|
|
3048
|
+
helpText: values.helpText || void 0,
|
|
3049
|
+
type: values.type || void 0,
|
|
3050
|
+
displayName: values.displayName || void 0
|
|
3051
|
+
};
|
|
3052
|
+
return onSubmit(finalValue);
|
|
3053
|
+
});
|
|
3054
|
+
(0, import_design_system14.useShortcut)({
|
|
3055
|
+
shortcut: "enter",
|
|
3056
|
+
handler: () => {
|
|
3057
|
+
submitHandler();
|
|
3058
|
+
},
|
|
3059
|
+
activeWhenEditing: true
|
|
3060
|
+
});
|
|
3061
|
+
return (
|
|
3062
|
+
// NOTE: this is intentionally NOT a <form> because it's regularly used in a nested modal and that can make it bubble
|
|
3063
|
+
// up a submit to its 'parent form' which is not what we want.
|
|
3064
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { css: variablesFormContainer, children: [
|
|
3065
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
3066
|
+
import_design_system14.Input,
|
|
3067
|
+
{
|
|
3068
|
+
...register("name"),
|
|
3069
|
+
label: "Name",
|
|
3070
|
+
disabled: variable !== "",
|
|
3071
|
+
caption: "This cannot change once created.",
|
|
3072
|
+
errorMessage: (_e = formState.errors.name) == null ? void 0 : _e.message,
|
|
3073
|
+
"data-af": "1"
|
|
3074
|
+
}
|
|
3075
|
+
),
|
|
3076
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
3077
|
+
import_design_system14.Input,
|
|
3078
|
+
{
|
|
3079
|
+
...register("helpText"),
|
|
3080
|
+
label: "Help Text",
|
|
3081
|
+
caption: "Appears when entering a value for this variable.",
|
|
3082
|
+
autoComplete: "off",
|
|
3083
|
+
errorMessage: (_f = formState.errors.helpText) == null ? void 0 : _f.message
|
|
3084
|
+
}
|
|
3085
|
+
),
|
|
3086
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
3087
|
+
import_design_system14.Input,
|
|
3088
|
+
{
|
|
3089
|
+
...register("default"),
|
|
3090
|
+
label: "Default Value",
|
|
3091
|
+
autoComplete: "off",
|
|
3092
|
+
errorMessage: (_g = formState.errors.default) == null ? void 0 : _g.message
|
|
3093
|
+
}
|
|
3094
|
+
),
|
|
3095
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { css: variablesFormBtnGroup, children: [
|
|
3096
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_design_system14.Button, { type: "button", onClick: submitHandler, children: "OK" }),
|
|
3097
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_design_system14.Button, { type: "button", buttonType: "ghost", onClick: onCancel, children: "Cancel" })
|
|
3098
|
+
] }),
|
|
3099
|
+
disableMeshTip ? null : /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(import_design_system14.Callout, { type: "tip", title: "Customized User Interfaces", children: [
|
|
3100
|
+
"Developers can create customized user interfaces for variable editing by building a Uniform mesh integration. Get started quickly with our",
|
|
3101
|
+
" ",
|
|
3102
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("a", { href: "https://docs.uniform.app", target: "_blank", rel: "noopener noreferrer", children: "Mesh SDK" }),
|
|
3103
|
+
"."
|
|
3104
|
+
] })
|
|
3105
|
+
] })
|
|
3037
3106
|
);
|
|
3038
3107
|
}
|
|
3039
3108
|
|
|
@@ -3447,7 +3516,7 @@ function DataResourceVariablesList({
|
|
|
3447
3516
|
const {
|
|
3448
3517
|
value,
|
|
3449
3518
|
metadata: { dataType }
|
|
3450
|
-
} = useMeshLocation("
|
|
3519
|
+
} = useMeshLocation("dataTypeInstance");
|
|
3451
3520
|
const variableDefinitions = variablesToList(dataType.variables);
|
|
3452
3521
|
if (variableDefinitions.length === 0) {
|
|
3453
3522
|
if (NoVariablesComponent) {
|
|
@@ -4895,6 +4964,12 @@ var QueryFilter = ({
|
|
|
4895
4964
|
] });
|
|
4896
4965
|
};
|
|
4897
4966
|
|
|
4967
|
+
// src/hooks/useUniformMeshLocation.ts
|
|
4968
|
+
function useUniformMeshLocation() {
|
|
4969
|
+
const { location } = useUniformMeshLocationContext();
|
|
4970
|
+
return location;
|
|
4971
|
+
}
|
|
4972
|
+
|
|
4898
4973
|
// src/hooks/index.ts
|
|
4899
4974
|
var import_design_system33 = require("@uniformdev/design-system");
|
|
4900
4975
|
|
|
@@ -4930,6 +5005,7 @@ __reExport(src_exports, require("@uniformdev/mesh-sdk"), module.exports);
|
|
|
4930
5005
|
InputSelect,
|
|
4931
5006
|
InputToggle,
|
|
4932
5007
|
InputVariables,
|
|
5008
|
+
KeywordSearchInput,
|
|
4933
5009
|
Label,
|
|
4934
5010
|
LinkButton,
|
|
4935
5011
|
LoadingIndicator,
|
|
@@ -4985,6 +5061,10 @@ __reExport(src_exports, require("@uniformdev/mesh-sdk"), module.exports);
|
|
|
4985
5061
|
TextVariableRenderer,
|
|
4986
5062
|
Textarea,
|
|
4987
5063
|
Theme,
|
|
5064
|
+
UniformMeshLocationContext,
|
|
5065
|
+
UniformMeshLocationContextProvider,
|
|
5066
|
+
UniformMeshSdkContext,
|
|
5067
|
+
UniformMeshSdkContextProvider,
|
|
4988
5068
|
VariableEditor,
|
|
4989
5069
|
VariablesList,
|
|
4990
5070
|
VariablesProvider,
|
|
@@ -5053,6 +5133,7 @@ __reExport(src_exports, require("@uniformdev/mesh-sdk"), module.exports);
|
|
|
5053
5133
|
selectedItemTitle,
|
|
5054
5134
|
urlEncodeRequestParameter,
|
|
5055
5135
|
urlEncodeRequestUrl,
|
|
5136
|
+
useInitializeUniformMeshSdk,
|
|
5056
5137
|
useMeshLocation,
|
|
5057
5138
|
useObjectSearchContext,
|
|
5058
5139
|
useParameterShell,
|
|
@@ -5061,7 +5142,10 @@ __reExport(src_exports, require("@uniformdev/mesh-sdk"), module.exports);
|
|
|
5061
5142
|
useRequest,
|
|
5062
5143
|
useRequestHeader,
|
|
5063
5144
|
useRequestParameter,
|
|
5145
|
+
useUniformMeshLocation,
|
|
5146
|
+
useUniformMeshLocationContext,
|
|
5064
5147
|
useUniformMeshSdk,
|
|
5148
|
+
useUniformMeshSdkContext,
|
|
5065
5149
|
useVariables,
|
|
5066
5150
|
variablesToList
|
|
5067
5151
|
});
|
package/dist/index.mjs
CHANGED
|
@@ -893,7 +893,7 @@ var ProductPreviewList = ({
|
|
|
893
893
|
scrollbarStyles
|
|
894
894
|
],
|
|
895
895
|
children: products == null ? void 0 : products.map((product, index) => {
|
|
896
|
-
var _a;
|
|
896
|
+
var _a, _b;
|
|
897
897
|
const [category] = (product == null ? void 0 : product.categories) || [];
|
|
898
898
|
const categoryName = typeof category === "undefined" || !categories ? void 0 : (_a = categories.find((c) => c.id === category.id)) == null ? void 0 : _a.name;
|
|
899
899
|
return /* @__PURE__ */ jsx18("li", { css: productPreviewListItem, children: /* @__PURE__ */ jsxs7(
|
|
@@ -906,13 +906,13 @@ var ProductPreviewList = ({
|
|
|
906
906
|
"img",
|
|
907
907
|
{
|
|
908
908
|
src: product.thumbnailUrl,
|
|
909
|
-
alt: typeof product.title === "string" ? product.title : `Product ${index}`,
|
|
909
|
+
alt: typeof product.title === "string" ? product.title : product.name || `Product ${index}`,
|
|
910
910
|
css: productPreviewListImage,
|
|
911
911
|
"data-test-id": "product-image"
|
|
912
912
|
}
|
|
913
913
|
) : /* @__PURE__ */ jsx18("div", { css: productPreviewListImageDefault }),
|
|
914
914
|
/* @__PURE__ */ jsxs7("h4", { css: productPreviewListTitle, "data-test-id": "product-name", children: [
|
|
915
|
-
product.title,
|
|
915
|
+
product.title || product.name,
|
|
916
916
|
categoryName && /* @__PURE__ */ jsx18("span", { css: productPreviewListCategoryText, children: categoryName })
|
|
917
917
|
] }),
|
|
918
918
|
product && /* @__PURE__ */ jsxs7(Fragment2, { children: [
|
|
@@ -925,12 +925,12 @@ var ProductPreviewList = ({
|
|
|
925
925
|
"Price: ",
|
|
926
926
|
product.price
|
|
927
927
|
] }) : null,
|
|
928
|
-
product.editLink ? /* @__PURE__ */ jsxs7(
|
|
928
|
+
product.editLink || product.url ? /* @__PURE__ */ jsxs7(
|
|
929
929
|
"a",
|
|
930
930
|
{
|
|
931
931
|
css: productPreviewListLinkBtn,
|
|
932
|
-
href: product.editLink,
|
|
933
|
-
title: `Go to ${product.title}`,
|
|
932
|
+
href: (_b = product.editLink) != null ? _b : product.url,
|
|
933
|
+
title: `Go to ${product.title || product.name}`,
|
|
934
934
|
target: "_blank",
|
|
935
935
|
rel: "noopener noreferrer",
|
|
936
936
|
"data-test-id": "edit-product-button",
|
|
@@ -2642,7 +2642,7 @@ function DefaultDamItemRenderer({ item }) {
|
|
|
2642
2642
|
}
|
|
2643
2643
|
|
|
2644
2644
|
// src/components/DataResourceVariablesList.tsx
|
|
2645
|
-
import { Callout as
|
|
2645
|
+
import { Callout as Callout4, Input as Input4 } from "@uniformdev/design-system";
|
|
2646
2646
|
|
|
2647
2647
|
// src/hooks/useMeshLocation.ts
|
|
2648
2648
|
import { useMemo as useMemo4, useRef as useRef7 } from "react";
|
|
@@ -2655,6 +2655,18 @@ import { Theme } from "@uniformdev/design-system";
|
|
|
2655
2655
|
import { createContext, useContext as useContext3 } from "react";
|
|
2656
2656
|
import { jsx as jsx26, jsxs as jsxs15 } from "@emotion/react/jsx-runtime";
|
|
2657
2657
|
var UniformMeshSdkContext = createContext(void 0);
|
|
2658
|
+
var UniformMeshSdkContextProvider = ({ children }) => {
|
|
2659
|
+
let value = void 0;
|
|
2660
|
+
if (typeof window !== "undefined" && typeof window.UniformMeshSDK !== "undefined") {
|
|
2661
|
+
value = {
|
|
2662
|
+
sdk: window.UniformMeshSDK
|
|
2663
|
+
};
|
|
2664
|
+
}
|
|
2665
|
+
return /* @__PURE__ */ jsxs15(UniformMeshSdkContext.Provider, { value, children: [
|
|
2666
|
+
/* @__PURE__ */ jsx26(Theme, {}),
|
|
2667
|
+
/* @__PURE__ */ jsx26(UniformMeshLocationContextProvider, { children })
|
|
2668
|
+
] });
|
|
2669
|
+
};
|
|
2658
2670
|
var useUniformMeshSdkContext = () => {
|
|
2659
2671
|
const context = useContext3(UniformMeshSdkContext);
|
|
2660
2672
|
if (!context) {
|
|
@@ -2671,7 +2683,9 @@ function useUniformMeshSdk() {
|
|
|
2671
2683
|
|
|
2672
2684
|
// src/components/UniformMeshLocationContext.tsx
|
|
2673
2685
|
import { jsx as jsx27 } from "@emotion/react/jsx-runtime";
|
|
2674
|
-
var UniformMeshLocationContext = createContext2(
|
|
2686
|
+
var UniformMeshLocationContext = createContext2(
|
|
2687
|
+
void 0
|
|
2688
|
+
);
|
|
2675
2689
|
var UniformMeshLocationContextProvider = ({
|
|
2676
2690
|
children
|
|
2677
2691
|
}) => {
|
|
@@ -2702,9 +2716,20 @@ var useUniformMeshLocationContext = () => {
|
|
|
2702
2716
|
};
|
|
2703
2717
|
|
|
2704
2718
|
// src/hooks/useMeshLocation.ts
|
|
2719
|
+
var legacyWarned = false;
|
|
2705
2720
|
function useMeshLocation(expectedLocation) {
|
|
2706
2721
|
const { location } = useUniformMeshLocationContext();
|
|
2707
|
-
|
|
2722
|
+
let effectiveExpected = expectedLocation;
|
|
2723
|
+
if (expectedLocation === "dataTypeInstance") {
|
|
2724
|
+
effectiveExpected = "dataResource";
|
|
2725
|
+
if (!legacyWarned) {
|
|
2726
|
+
console.warn(
|
|
2727
|
+
"`dataTypeInstance` mesh location is deprecated, please switch to `dataResource` instead."
|
|
2728
|
+
);
|
|
2729
|
+
legacyWarned = true;
|
|
2730
|
+
}
|
|
2731
|
+
}
|
|
2732
|
+
if (effectiveExpected && location.type !== effectiveExpected) {
|
|
2708
2733
|
throw new Error(`Expected location type ${expectedLocation} but got ${location.type}`);
|
|
2709
2734
|
}
|
|
2710
2735
|
const backdoorLocation = useRef7(location);
|
|
@@ -2793,8 +2818,10 @@ import mitt from "mitt";
|
|
|
2793
2818
|
import * as React10 from "react";
|
|
2794
2819
|
|
|
2795
2820
|
// src/components/Variables/VariableEditor.tsx
|
|
2796
|
-
import {
|
|
2797
|
-
import {
|
|
2821
|
+
import { zodResolver } from "@hookform/resolvers/zod";
|
|
2822
|
+
import { Button as Button2, Callout as Callout3, Input as Input2, useShortcut } from "@uniformdev/design-system";
|
|
2823
|
+
import { useForm } from "react-hook-form";
|
|
2824
|
+
import { z } from "zod";
|
|
2798
2825
|
|
|
2799
2826
|
// src/components/Variables/InputVariables.styles.ts
|
|
2800
2827
|
import { css as css19 } from "@emotion/react";
|
|
@@ -2810,57 +2837,90 @@ var variablesFormBtnGroup = css19`
|
|
|
2810
2837
|
|
|
2811
2838
|
// src/components/Variables/VariableEditor.tsx
|
|
2812
2839
|
import { jsx as jsx28, jsxs as jsxs16 } from "@emotion/react/jsx-runtime";
|
|
2813
|
-
|
|
2814
|
-
|
|
2840
|
+
var schema = z.object({
|
|
2841
|
+
name: z.string().nonempty("Name can't be empty").regex(/^[^${}]+$/, "$, {, and } are reserved characters and cannot be used in a variable name"),
|
|
2842
|
+
default: z.string(),
|
|
2843
|
+
displayName: z.string().optional(),
|
|
2844
|
+
helpText: z.string().optional(),
|
|
2845
|
+
order: z.number().optional(),
|
|
2846
|
+
type: z.string().optional()
|
|
2847
|
+
});
|
|
2848
|
+
function VariableEditor({ variable, onSubmit, onCancel, disableMeshTip }) {
|
|
2849
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
2815
2850
|
const { variables } = useVariables();
|
|
2816
|
-
|
|
2817
|
-
|
|
2818
|
-
{
|
|
2819
|
-
|
|
2820
|
-
|
|
2821
|
-
|
|
2822
|
-
|
|
2823
|
-
|
|
2824
|
-
|
|
2825
|
-
|
|
2826
|
-
|
|
2827
|
-
|
|
2828
|
-
|
|
2829
|
-
|
|
2830
|
-
|
|
2831
|
-
|
|
2832
|
-
|
|
2833
|
-
|
|
2834
|
-
|
|
2835
|
-
|
|
2836
|
-
|
|
2837
|
-
|
|
2838
|
-
|
|
2839
|
-
|
|
2840
|
-
|
|
2841
|
-
|
|
2842
|
-
|
|
2843
|
-
|
|
2844
|
-
|
|
2845
|
-
|
|
2846
|
-
|
|
2847
|
-
|
|
2848
|
-
|
|
2849
|
-
|
|
2850
|
-
|
|
2851
|
-
|
|
2852
|
-
|
|
2853
|
-
|
|
2854
|
-
|
|
2855
|
-
),
|
|
2856
|
-
|
|
2857
|
-
|
|
2858
|
-
|
|
2859
|
-
|
|
2860
|
-
|
|
2861
|
-
|
|
2862
|
-
|
|
2863
|
-
|
|
2851
|
+
const currentVariable = variables[variable];
|
|
2852
|
+
const { register, handleSubmit, formState } = useForm({
|
|
2853
|
+
defaultValues: {
|
|
2854
|
+
name: variable,
|
|
2855
|
+
default: (_a = currentVariable == null ? void 0 : currentVariable.default) != null ? _a : "",
|
|
2856
|
+
displayName: (_b = currentVariable == null ? void 0 : currentVariable.displayName) != null ? _b : "",
|
|
2857
|
+
helpText: (_c = currentVariable == null ? void 0 : currentVariable.helpText) != null ? _c : "",
|
|
2858
|
+
order: currentVariable == null ? void 0 : currentVariable.order,
|
|
2859
|
+
type: (_d = currentVariable == null ? void 0 : currentVariable.type) != null ? _d : ""
|
|
2860
|
+
},
|
|
2861
|
+
resolver: zodResolver(schema)
|
|
2862
|
+
});
|
|
2863
|
+
const submitHandler = handleSubmit((values) => {
|
|
2864
|
+
const finalValue = {
|
|
2865
|
+
...values,
|
|
2866
|
+
helpText: values.helpText || void 0,
|
|
2867
|
+
type: values.type || void 0,
|
|
2868
|
+
displayName: values.displayName || void 0
|
|
2869
|
+
};
|
|
2870
|
+
return onSubmit(finalValue);
|
|
2871
|
+
});
|
|
2872
|
+
useShortcut({
|
|
2873
|
+
shortcut: "enter",
|
|
2874
|
+
handler: () => {
|
|
2875
|
+
submitHandler();
|
|
2876
|
+
},
|
|
2877
|
+
activeWhenEditing: true
|
|
2878
|
+
});
|
|
2879
|
+
return (
|
|
2880
|
+
// NOTE: this is intentionally NOT a <form> because it's regularly used in a nested modal and that can make it bubble
|
|
2881
|
+
// up a submit to its 'parent form' which is not what we want.
|
|
2882
|
+
/* @__PURE__ */ jsxs16("div", { css: variablesFormContainer, children: [
|
|
2883
|
+
/* @__PURE__ */ jsx28(
|
|
2884
|
+
Input2,
|
|
2885
|
+
{
|
|
2886
|
+
...register("name"),
|
|
2887
|
+
label: "Name",
|
|
2888
|
+
disabled: variable !== "",
|
|
2889
|
+
caption: "This cannot change once created.",
|
|
2890
|
+
errorMessage: (_e = formState.errors.name) == null ? void 0 : _e.message,
|
|
2891
|
+
"data-af": "1"
|
|
2892
|
+
}
|
|
2893
|
+
),
|
|
2894
|
+
/* @__PURE__ */ jsx28(
|
|
2895
|
+
Input2,
|
|
2896
|
+
{
|
|
2897
|
+
...register("helpText"),
|
|
2898
|
+
label: "Help Text",
|
|
2899
|
+
caption: "Appears when entering a value for this variable.",
|
|
2900
|
+
autoComplete: "off",
|
|
2901
|
+
errorMessage: (_f = formState.errors.helpText) == null ? void 0 : _f.message
|
|
2902
|
+
}
|
|
2903
|
+
),
|
|
2904
|
+
/* @__PURE__ */ jsx28(
|
|
2905
|
+
Input2,
|
|
2906
|
+
{
|
|
2907
|
+
...register("default"),
|
|
2908
|
+
label: "Default Value",
|
|
2909
|
+
autoComplete: "off",
|
|
2910
|
+
errorMessage: (_g = formState.errors.default) == null ? void 0 : _g.message
|
|
2911
|
+
}
|
|
2912
|
+
),
|
|
2913
|
+
/* @__PURE__ */ jsxs16("div", { css: variablesFormBtnGroup, children: [
|
|
2914
|
+
/* @__PURE__ */ jsx28(Button2, { type: "button", onClick: submitHandler, children: "OK" }),
|
|
2915
|
+
/* @__PURE__ */ jsx28(Button2, { type: "button", buttonType: "ghost", onClick: onCancel, children: "Cancel" })
|
|
2916
|
+
] }),
|
|
2917
|
+
disableMeshTip ? null : /* @__PURE__ */ jsxs16(Callout3, { type: "tip", title: "Customized User Interfaces", children: [
|
|
2918
|
+
"Developers can create customized user interfaces for variable editing by building a Uniform mesh integration. Get started quickly with our",
|
|
2919
|
+
" ",
|
|
2920
|
+
/* @__PURE__ */ jsx28("a", { href: "https://docs.uniform.app", target: "_blank", rel: "noopener noreferrer", children: "Mesh SDK" }),
|
|
2921
|
+
"."
|
|
2922
|
+
] })
|
|
2923
|
+
] })
|
|
2864
2924
|
);
|
|
2865
2925
|
}
|
|
2866
2926
|
|
|
@@ -3284,13 +3344,13 @@ function DataResourceVariablesList({
|
|
|
3284
3344
|
const {
|
|
3285
3345
|
value,
|
|
3286
3346
|
metadata: { dataType }
|
|
3287
|
-
} = useMeshLocation("
|
|
3347
|
+
} = useMeshLocation("dataTypeInstance");
|
|
3288
3348
|
const variableDefinitions = variablesToList(dataType.variables);
|
|
3289
3349
|
if (variableDefinitions.length === 0) {
|
|
3290
3350
|
if (NoVariablesComponent) {
|
|
3291
3351
|
return /* @__PURE__ */ jsx33(NoVariablesComponent, {});
|
|
3292
3352
|
}
|
|
3293
|
-
return /* @__PURE__ */ jsx33(
|
|
3353
|
+
return /* @__PURE__ */ jsx33(Callout4, { type: "note", children: "No settings are required." });
|
|
3294
3354
|
}
|
|
3295
3355
|
return /* @__PURE__ */ jsx33("div", { children: variableDefinitions.map((variableDefinition) => {
|
|
3296
3356
|
var _a, _b, _c;
|
|
@@ -4750,6 +4810,12 @@ var QueryFilter = ({
|
|
|
4750
4810
|
] });
|
|
4751
4811
|
};
|
|
4752
4812
|
|
|
4813
|
+
// src/hooks/useUniformMeshLocation.ts
|
|
4814
|
+
function useUniformMeshLocation() {
|
|
4815
|
+
const { location } = useUniformMeshLocationContext();
|
|
4816
|
+
return location;
|
|
4817
|
+
}
|
|
4818
|
+
|
|
4753
4819
|
// src/hooks/index.ts
|
|
4754
4820
|
import { ParameterShellContext, useParameterShell } from "@uniformdev/design-system";
|
|
4755
4821
|
|
|
@@ -4765,13 +4831,14 @@ function createLocationValidator(setValue, validate) {
|
|
|
4765
4831
|
import {
|
|
4766
4832
|
AddListButton as AddListButton2,
|
|
4767
4833
|
Button as Button6,
|
|
4768
|
-
Callout as
|
|
4834
|
+
Callout as Callout5,
|
|
4769
4835
|
Heading,
|
|
4770
4836
|
Input as Input8,
|
|
4771
4837
|
InputComboBox,
|
|
4772
4838
|
InputKeywordSearch as InputKeywordSearch4,
|
|
4773
4839
|
InputSelect as InputSelect8,
|
|
4774
4840
|
InputToggle,
|
|
4841
|
+
InputKeywordSearch as InputKeywordSearch5,
|
|
4775
4842
|
Label,
|
|
4776
4843
|
LoadingIndicator as LoadingIndicator4,
|
|
4777
4844
|
LoadingOverlay as LoadingOverlay2,
|
|
@@ -4801,7 +4868,7 @@ export * from "@uniformdev/mesh-sdk";
|
|
|
4801
4868
|
export {
|
|
4802
4869
|
AddListButton2 as AddListButton,
|
|
4803
4870
|
Button6 as Button,
|
|
4804
|
-
|
|
4871
|
+
Callout5 as Callout,
|
|
4805
4872
|
DamSelectedItem,
|
|
4806
4873
|
DataRefreshButton,
|
|
4807
4874
|
DataResourceVariablesList,
|
|
@@ -4818,6 +4885,7 @@ export {
|
|
|
4818
4885
|
InputSelect8 as InputSelect,
|
|
4819
4886
|
InputToggle,
|
|
4820
4887
|
InputVariables,
|
|
4888
|
+
InputKeywordSearch5 as KeywordSearchInput,
|
|
4821
4889
|
Label,
|
|
4822
4890
|
LinkButton,
|
|
4823
4891
|
LoadingIndicator4 as LoadingIndicator,
|
|
@@ -4873,6 +4941,10 @@ export {
|
|
|
4873
4941
|
TextVariableRenderer,
|
|
4874
4942
|
Textarea,
|
|
4875
4943
|
Theme3 as Theme,
|
|
4944
|
+
UniformMeshLocationContext,
|
|
4945
|
+
UniformMeshLocationContextProvider,
|
|
4946
|
+
UniformMeshSdkContext,
|
|
4947
|
+
UniformMeshSdkContextProvider,
|
|
4876
4948
|
VariableEditor,
|
|
4877
4949
|
VariablesList,
|
|
4878
4950
|
VariablesProvider,
|
|
@@ -4941,6 +5013,7 @@ export {
|
|
|
4941
5013
|
selectedItemTitle,
|
|
4942
5014
|
urlEncodeRequestParameter,
|
|
4943
5015
|
urlEncodeRequestUrl,
|
|
5016
|
+
useInitializeUniformMeshSdk,
|
|
4944
5017
|
useMeshLocation,
|
|
4945
5018
|
useObjectSearchContext,
|
|
4946
5019
|
useParameterShell,
|
|
@@ -4949,7 +5022,10 @@ export {
|
|
|
4949
5022
|
useRequest,
|
|
4950
5023
|
useRequestHeader,
|
|
4951
5024
|
useRequestParameter,
|
|
5025
|
+
useUniformMeshLocation,
|
|
5026
|
+
useUniformMeshLocationContext,
|
|
4952
5027
|
useUniformMeshSdk,
|
|
5028
|
+
useUniformMeshSdkContext,
|
|
4953
5029
|
useVariables,
|
|
4954
5030
|
variablesToList
|
|
4955
5031
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uniformdev/mesh-sdk-react",
|
|
3
|
-
"version": "18.
|
|
3
|
+
"version": "18.38.2-alpha.6+d4938f167",
|
|
4
4
|
"description": "Uniform Mesh Framework SDK for React",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -43,15 +43,17 @@
|
|
|
43
43
|
"document": "api-extractor run --local"
|
|
44
44
|
},
|
|
45
45
|
"dependencies": {
|
|
46
|
-
"@
|
|
47
|
-
"@uniformdev/
|
|
48
|
-
"
|
|
46
|
+
"@hookform/resolvers": "^3.0.1",
|
|
47
|
+
"@uniformdev/design-system": "18.38.2-alpha.6+d4938f167",
|
|
48
|
+
"@uniformdev/mesh-sdk": "18.38.2-alpha.6+d4938f167",
|
|
49
49
|
"mitt": "^3.0.0",
|
|
50
50
|
"react-beautiful-dnd": "13.1.1",
|
|
51
|
+
"react-hook-form": "^7.43.9",
|
|
51
52
|
"react-icons": "4.8.0",
|
|
52
53
|
"react-use": "17.4.0",
|
|
53
54
|
"timeago.js": "4.0.2",
|
|
54
|
-
"uuid": "9.0.0"
|
|
55
|
+
"uuid": "9.0.0",
|
|
56
|
+
"zod": "^3.21.4"
|
|
55
57
|
},
|
|
56
58
|
"peerDependencies": {
|
|
57
59
|
"@emotion/react": ">=11.8.0",
|
|
@@ -62,7 +64,7 @@
|
|
|
62
64
|
"@emotion/babel-preset-css-prop": "11.10.0",
|
|
63
65
|
"@emotion/react": "11.10.5",
|
|
64
66
|
"@svgr/cli": "6.5.1",
|
|
65
|
-
"@types/react": "18.0.
|
|
67
|
+
"@types/react": "18.0.35",
|
|
66
68
|
"@types/react-beautiful-dnd": "13.1.4",
|
|
67
69
|
"@types/uuid": "9.0.1",
|
|
68
70
|
"react": "18.2.0",
|
|
@@ -74,5 +76,5 @@
|
|
|
74
76
|
"publishConfig": {
|
|
75
77
|
"access": "public"
|
|
76
78
|
},
|
|
77
|
-
"gitHead": "
|
|
79
|
+
"gitHead": "d4938f167d196bbd523e6cdd031f56fab4ceebf6"
|
|
78
80
|
}
|