@wix/auto-patterns 1.23.0 → 1.25.0
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/cjs/components/AutoPatternsEntityPage/AutoPatternsEntityPage.js +12 -323
- package/dist/cjs/components/AutoPatternsEntityPage/AutoPatternsEntityPage.js.map +1 -1
- package/dist/cjs/components/AutoPatternsEntityPage/EditModeEntityPage.js +172 -0
- package/dist/cjs/components/AutoPatternsEntityPage/EditModeEntityPage.js.map +1 -0
- package/dist/cjs/components/AutoPatternsEntityPage/RenderLayout/RenderLayoutCard.js +78 -0
- package/dist/cjs/components/AutoPatternsEntityPage/RenderLayout/RenderLayoutCard.js.map +1 -0
- package/dist/cjs/components/AutoPatternsEntityPage/RenderLayout/RenderLayoutContent.js +119 -0
- package/dist/cjs/components/AutoPatternsEntityPage/RenderLayout/RenderLayoutContent.js.map +1 -0
- package/dist/cjs/components/AutoPatternsEntityPage/RenderLayout/RenderViewField.js +79 -0
- package/dist/cjs/components/AutoPatternsEntityPage/RenderLayout/RenderViewField.js.map +1 -0
- package/dist/cjs/components/AutoPatternsEntityPage/RenderLayout/index.js +16 -0
- package/dist/cjs/components/AutoPatternsEntityPage/RenderLayout/index.js.map +1 -0
- package/dist/cjs/components/AutoPatternsEntityPage/ViewEntityPage/RenderViewLayoutCard.js +77 -0
- package/dist/cjs/components/AutoPatternsEntityPage/ViewEntityPage/RenderViewLayoutCard.js.map +1 -0
- package/dist/cjs/components/AutoPatternsEntityPage/ViewEntityPage/RenderViewLayoutContent.js +109 -0
- package/dist/cjs/components/AutoPatternsEntityPage/ViewEntityPage/RenderViewLayoutContent.js.map +1 -0
- package/dist/cjs/components/AutoPatternsEntityPage/ViewModeEntityPage.js +198 -0
- package/dist/cjs/components/AutoPatternsEntityPage/ViewModeEntityPage.js.map +1 -0
- package/dist/cjs/components/AutoPatternsEntityPage/index.js +12 -0
- package/dist/cjs/components/AutoPatternsEntityPage/index.js.map +1 -1
- package/dist/cjs/dataSourceAdapters/cms/cmsAdapter.js +2 -1
- package/dist/cjs/dataSourceAdapters/cms/cmsAdapter.js.map +1 -1
- package/dist/cjs/hooks/useActionCell.js +2 -1
- package/dist/cjs/hooks/useActionCell.js.map +1 -1
- package/dist/cjs/hooks/useBulkActionToolbar.js +2 -1
- package/dist/cjs/hooks/useBulkActionToolbar.js.map +1 -1
- package/dist/cjs/hooks/useCollectionPageActions.js +2 -1
- package/dist/cjs/hooks/useCollectionPageActions.js.map +1 -1
- package/dist/cjs/hooks/useEntityPageActions.js +106 -0
- package/dist/cjs/hooks/useEntityPageActions.js.map +1 -0
- package/dist/cjs/hooks/useEntityPageMoreActions.js +11 -1
- package/dist/cjs/hooks/useEntityPageMoreActions.js.map +1 -1
- package/dist/cjs/hooks/useNavigateEditEntityAction.js +50 -0
- package/dist/cjs/hooks/useNavigateEditEntityAction.js.map +1 -0
- package/dist/cjs/hooks/useNavigationUtils.js +12 -1
- package/dist/cjs/hooks/useNavigationUtils.js.map +1 -1
- package/dist/cjs/providers/ErrorContext.js +6 -3
- package/dist/cjs/providers/ErrorContext.js.map +1 -1
- package/dist/cjs/providers/PatternsWizardOverridesContext.js +1 -1
- package/dist/cjs/providers/PatternsWizardOverridesContext.js.map +1 -1
- package/dist/cjs/types/EntityPageConfig.js.map +1 -1
- package/dist/cjs/types/actions/actionCell.js.map +1 -1
- package/dist/cjs/types/actions/entityPageActions.js.map +1 -1
- package/dist/cjs/utils/actions/types.js.map +1 -1
- package/dist/docs/action_cell.md +11 -6
- package/dist/docs/app_config_structure.md +49 -4
- package/dist/docs/auto-patterns-guide.md +311 -43
- package/dist/docs/bulk_actions.md +7 -2
- package/dist/docs/collection_page_actions.md +14 -4
- package/dist/docs/entity_page.md +65 -1
- package/dist/docs/entity_page_actions.md +13 -11
- package/dist/docs/entity_page_view_actions.md +137 -0
- package/dist/docs/index.md +6 -2
- package/dist/docs/pages_configuration.md +1 -11
- package/dist/docs/sdk_utilities.md +11 -4
- package/dist/docs/wix_fqdn_custom_data_source.md +25 -5
- package/dist/esm/components/AutoPatternsCollectionComponent/AutoPatternsCollectionComponent.js +4 -3
- package/dist/esm/components/AutoPatternsCollectionComponent/AutoPatternsCollectionComponent.js.map +1 -1
- package/dist/esm/components/AutoPatternsCollectionPageContent/AutoPatternsCollectionPageContent.js +2 -1
- package/dist/esm/components/AutoPatternsCollectionPageContent/AutoPatternsCollectionPageContent.js.map +1 -1
- package/dist/esm/components/AutoPatternsEntityPage/AutoPatternsEntityPage.js +9 -196
- package/dist/esm/components/AutoPatternsEntityPage/AutoPatternsEntityPage.js.map +1 -1
- package/dist/esm/components/AutoPatternsEntityPage/EditModeEntityPage.js +115 -0
- package/dist/esm/components/AutoPatternsEntityPage/EditModeEntityPage.js.map +1 -0
- package/dist/esm/components/AutoPatternsEntityPage/Fields/DateInput.js +10 -6
- package/dist/esm/components/AutoPatternsEntityPage/Fields/DateInput.js.map +1 -1
- package/dist/esm/components/AutoPatternsEntityPage/Fields/DateTime.js +23 -16
- package/dist/esm/components/AutoPatternsEntityPage/Fields/DateTime.js.map +1 -1
- package/dist/esm/components/AutoPatternsEntityPage/Fields/FormFieldInput.js +3 -2
- package/dist/esm/components/AutoPatternsEntityPage/Fields/FormFieldInput.js.map +1 -1
- package/dist/esm/components/AutoPatternsEntityPage/Fields/ImageInput.js +9 -6
- package/dist/esm/components/AutoPatternsEntityPage/Fields/ImageInput.js.map +1 -1
- package/dist/esm/components/AutoPatternsEntityPage/Fields/LongText.js +8 -6
- package/dist/esm/components/AutoPatternsEntityPage/Fields/LongText.js.map +1 -1
- package/dist/esm/components/AutoPatternsEntityPage/Fields/Number.js +10 -8
- package/dist/esm/components/AutoPatternsEntityPage/Fields/Number.js.map +1 -1
- package/dist/esm/components/AutoPatternsEntityPage/Fields/ShortText.js +12 -10
- package/dist/esm/components/AutoPatternsEntityPage/Fields/ShortText.js.map +1 -1
- package/dist/esm/components/AutoPatternsEntityPage/Fields/Url.js +8 -6
- package/dist/esm/components/AutoPatternsEntityPage/Fields/Url.js.map +1 -1
- package/dist/esm/components/AutoPatternsEntityPage/RenderLayout/RenderLayoutCard.js +33 -0
- package/dist/esm/components/AutoPatternsEntityPage/RenderLayout/RenderLayoutCard.js.map +1 -0
- package/dist/esm/components/AutoPatternsEntityPage/RenderLayout/RenderLayoutContent.js +70 -0
- package/dist/esm/components/AutoPatternsEntityPage/RenderLayout/RenderLayoutContent.js.map +1 -0
- package/dist/esm/components/AutoPatternsEntityPage/RenderLayout/RenderViewField.js +48 -0
- package/dist/esm/components/AutoPatternsEntityPage/RenderLayout/RenderViewField.js.map +1 -0
- package/dist/esm/components/AutoPatternsEntityPage/RenderLayout/index.js +3 -0
- package/dist/esm/components/AutoPatternsEntityPage/RenderLayout/index.js.map +1 -0
- package/dist/esm/components/AutoPatternsEntityPage/SkeletonEntity.js +7 -4
- package/dist/esm/components/AutoPatternsEntityPage/SkeletonEntity.js.map +1 -1
- package/dist/esm/components/AutoPatternsEntityPage/ViewEntityPage/RenderViewLayoutCard.js +31 -0
- package/dist/esm/components/AutoPatternsEntityPage/ViewEntityPage/RenderViewLayoutCard.js.map +1 -0
- package/dist/esm/components/AutoPatternsEntityPage/ViewEntityPage/RenderViewLayoutContent.js +66 -0
- package/dist/esm/components/AutoPatternsEntityPage/ViewEntityPage/RenderViewLayoutContent.js.map +1 -0
- package/dist/esm/components/AutoPatternsEntityPage/ViewModeEntityPage.js +111 -0
- package/dist/esm/components/AutoPatternsEntityPage/ViewModeEntityPage.js.map +1 -0
- package/dist/esm/components/AutoPatternsEntityPage/index.js +2 -0
- package/dist/esm/components/AutoPatternsEntityPage/index.js.map +1 -1
- package/dist/esm/components/ModalRenderer.js +2 -1
- package/dist/esm/components/ModalRenderer.js.map +1 -1
- package/dist/esm/components/modals/actions/BulkDeleteModal.js +12 -7
- package/dist/esm/components/modals/actions/BulkDeleteModal.js.map +1 -1
- package/dist/esm/components/modals/actions/CreateModal.js +11 -6
- package/dist/esm/components/modals/actions/CreateModal.js.map +1 -1
- package/dist/esm/components/modals/actions/EditModal.js +11 -6
- package/dist/esm/components/modals/actions/EditModal.js.map +1 -1
- package/dist/esm/dataSourceAdapters/cms/cmsAdapter.js +6 -4
- package/dist/esm/dataSourceAdapters/cms/cmsAdapter.js.map +1 -1
- package/dist/esm/dataSourceAdapters/cms/filterUtils.js +2 -1
- package/dist/esm/dataSourceAdapters/cms/filterUtils.js.map +1 -1
- package/dist/esm/dataSourceAdapters/cms/sortUtils.js +2 -2
- package/dist/esm/dataSourceAdapters/cms/sortUtils.js.map +1 -1
- package/dist/esm/hooks/useActionCell.js +14 -9
- package/dist/esm/hooks/useActionCell.js.map +1 -1
- package/dist/esm/hooks/useBaseTableFeatures.js +2 -1
- package/dist/esm/hooks/useBaseTableFeatures.js.map +1 -1
- package/dist/esm/hooks/useBulkActionToolbar.js +4 -3
- package/dist/esm/hooks/useBulkActionToolbar.js.map +1 -1
- package/dist/esm/hooks/useCollectionPageActions.js +5 -4
- package/dist/esm/hooks/useCollectionPageActions.js.map +1 -1
- package/dist/esm/hooks/useCollectionPageOnRowClickActions.js +1 -1
- package/dist/esm/hooks/useCollectionPageOnRowClickActions.js.map +1 -1
- package/dist/esm/hooks/useColumns.js +12 -7
- package/dist/esm/hooks/useColumns.js.map +1 -1
- package/dist/esm/hooks/useCommonCollectionFeatures.js +8 -7
- package/dist/esm/hooks/useCommonCollectionFeatures.js.map +1 -1
- package/dist/esm/hooks/useEmptyStates.js +6 -5
- package/dist/esm/hooks/useEmptyStates.js.map +1 -1
- package/dist/esm/hooks/useEntityPageActions.js +83 -0
- package/dist/esm/hooks/useEntityPageActions.js.map +1 -0
- package/dist/esm/hooks/useEntityPageMoreActions.js +12 -2
- package/dist/esm/hooks/useEntityPageMoreActions.js.map +1 -1
- package/dist/esm/hooks/useFilters.js +7 -7
- package/dist/esm/hooks/useFilters.js.map +1 -1
- package/dist/esm/hooks/useNavigateEditEntityAction.js +46 -0
- package/dist/esm/hooks/useNavigateEditEntityAction.js.map +1 -0
- package/dist/esm/hooks/useNavigationUtils.js +15 -3
- package/dist/esm/hooks/useNavigationUtils.js.map +1 -1
- package/dist/esm/hooks/usePagePath.js +4 -3
- package/dist/esm/hooks/usePagePath.js.map +1 -1
- package/dist/esm/hooks/useTableFeatures.js +2 -1
- package/dist/esm/hooks/useTableFeatures.js.map +1 -1
- package/dist/esm/providers/ErrorContext.js +4 -1
- package/dist/esm/providers/ErrorContext.js.map +1 -1
- package/dist/esm/providers/PatternsWizardOverridesContext.js.map +1 -1
- package/dist/esm/providers/SchemaContext.js +3 -2
- package/dist/esm/providers/SchemaContext.js.map +1 -1
- package/dist/esm/providers/SchemaRegistryContext.js +1 -1
- package/dist/esm/providers/SchemaRegistryContext.js.map +1 -1
- package/dist/esm/types/EntityPageConfig.js.map +1 -1
- package/dist/esm/types/actions/actionCell.js.map +1 -1
- package/dist/esm/types/actions/entityPageActions.js.map +1 -1
- package/dist/esm/utils/actions/customAction.js +2 -1
- package/dist/esm/utils/actions/customAction.js.map +1 -1
- package/dist/esm/utils/actions/deleteAction.js +10 -5
- package/dist/esm/utils/actions/deleteAction.js.map +1 -1
- package/dist/esm/utils/actions/types.js.map +1 -1
- package/dist/esm/utils/filterCreators.js +11 -11
- package/dist/esm/utils/filterCreators.js.map +1 -1
- package/dist/types/components/AutoPatternsEntityPage/AutoPatternsEntityPage.d.ts.map +1 -1
- package/dist/types/components/AutoPatternsEntityPage/EditModeEntityPage.d.ts +6 -0
- package/dist/types/components/AutoPatternsEntityPage/EditModeEntityPage.d.ts.map +1 -0
- package/dist/types/components/AutoPatternsEntityPage/RenderLayout/RenderLayoutCard.d.ts +11 -0
- package/dist/types/components/AutoPatternsEntityPage/RenderLayout/RenderLayoutCard.d.ts.map +1 -0
- package/dist/types/components/AutoPatternsEntityPage/RenderLayout/RenderLayoutContent.d.ts +13 -0
- package/dist/types/components/AutoPatternsEntityPage/RenderLayout/RenderLayoutContent.d.ts.map +1 -0
- package/dist/types/components/AutoPatternsEntityPage/RenderLayout/RenderViewField.d.ts +8 -0
- package/dist/types/components/AutoPatternsEntityPage/RenderLayout/RenderViewField.d.ts.map +1 -0
- package/dist/types/components/AutoPatternsEntityPage/RenderLayout/index.d.ts +3 -0
- package/dist/types/components/AutoPatternsEntityPage/RenderLayout/index.d.ts.map +1 -0
- package/dist/types/components/AutoPatternsEntityPage/ViewEntityPage/RenderViewLayoutCard.d.ts +8 -0
- package/dist/types/components/AutoPatternsEntityPage/ViewEntityPage/RenderViewLayoutCard.d.ts.map +1 -0
- package/dist/types/components/AutoPatternsEntityPage/ViewEntityPage/RenderViewLayoutContent.d.ts +8 -0
- package/dist/types/components/AutoPatternsEntityPage/ViewEntityPage/RenderViewLayoutContent.d.ts.map +1 -0
- package/dist/types/components/AutoPatternsEntityPage/ViewModeEntityPage.d.ts +8 -0
- package/dist/types/components/AutoPatternsEntityPage/ViewModeEntityPage.d.ts.map +1 -0
- package/dist/types/components/AutoPatternsEntityPage/index.d.ts +2 -0
- package/dist/types/components/AutoPatternsEntityPage/index.d.ts.map +1 -1
- package/dist/types/dataSourceAdapters/cms/cmsAdapter.d.ts.map +1 -1
- package/dist/types/hooks/useActionCell.d.ts.map +1 -1
- package/dist/types/hooks/useEntityPageActions.d.ts +9 -0
- package/dist/types/hooks/useEntityPageActions.d.ts.map +1 -0
- package/dist/types/hooks/useEntityPageHeaderTexts.d.ts.map +1 -1
- package/dist/types/hooks/useEntityPageMoreActions.d.ts +2 -2
- package/dist/types/hooks/useEntityPageMoreActions.d.ts.map +1 -1
- package/dist/types/hooks/useNavigateEditEntityAction.d.ts +6 -0
- package/dist/types/hooks/useNavigateEditEntityAction.d.ts.map +1 -0
- package/dist/types/hooks/useNavigationUtils.d.ts +1 -0
- package/dist/types/hooks/useNavigationUtils.d.ts.map +1 -1
- package/dist/types/providers/ErrorContext.d.ts +7 -0
- package/dist/types/providers/ErrorContext.d.ts.map +1 -1
- package/dist/types/providers/PatternsWizardOverridesContext.d.ts +2 -2
- package/dist/types/providers/PatternsWizardOverridesContext.d.ts.map +1 -1
- package/dist/types/types/EntityPageConfig.d.ts +20 -4
- package/dist/types/types/EntityPageConfig.d.ts.map +1 -1
- package/dist/types/types/actions/actionCell.d.ts +7 -1
- package/dist/types/types/actions/actionCell.d.ts.map +1 -1
- package/dist/types/types/actions/entityPageActions.d.ts +24 -5
- package/dist/types/types/actions/entityPageActions.d.ts.map +1 -1
- package/dist/types/utils/actions/customAction.d.ts +1 -1
- package/dist/types/utils/actions/customAction.d.ts.map +1 -1
- package/dist/types/utils/actions/resolveAction.d.ts +1 -0
- package/dist/types/utils/actions/resolveAction.d.ts.map +1 -1
- package/dist/types/utils/actions/types.d.ts +2 -1
- package/dist/types/utils/actions/types.d.ts.map +1 -1
- package/package.json +16 -15
- package/dist/docs/config_schema.md +0 -184
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Cell, Layout } from '@wix/design-system';
|
|
3
|
+
import { useSchema } from '../../../providers/SchemaContext';
|
|
4
|
+
import { usePatternsWizardOverridesContext } from '../../../providers';
|
|
5
|
+
import { useEntityPageContext } from '@wix/patterns';
|
|
6
|
+
import { FormFieldInput } from '../Fields/FormFieldInput';
|
|
7
|
+
export const RenderLayoutContent = _ref => {
|
|
8
|
+
var _content$container$ch, _overrides$components;
|
|
9
|
+
let {
|
|
10
|
+
content,
|
|
11
|
+
level,
|
|
12
|
+
sectionId,
|
|
13
|
+
cardIndex,
|
|
14
|
+
contentIndex,
|
|
15
|
+
setInputRef
|
|
16
|
+
} = _ref;
|
|
17
|
+
const schema = useSchema();
|
|
18
|
+
const overrides = usePatternsWizardOverridesContext();
|
|
19
|
+
const pageState = useEntityPageContext();
|
|
20
|
+
const entity = pageState.entity;
|
|
21
|
+
switch (content.type) {
|
|
22
|
+
case 'field':
|
|
23
|
+
if (!content.field.fieldId) {
|
|
24
|
+
return null;
|
|
25
|
+
}
|
|
26
|
+
const field = schema.fields[content.field.fieldId];
|
|
27
|
+
if (!field) {
|
|
28
|
+
return null;
|
|
29
|
+
}
|
|
30
|
+
return /*#__PURE__*/React.createElement(Cell, {
|
|
31
|
+
span: content.field.span
|
|
32
|
+
}, /*#__PURE__*/React.createElement(FormFieldInput, {
|
|
33
|
+
key: content.field.fieldId,
|
|
34
|
+
field: field,
|
|
35
|
+
inputRef: ref => setInputRef(content.field.fieldId, ref)
|
|
36
|
+
}));
|
|
37
|
+
case 'container':
|
|
38
|
+
if (!((_content$container$ch = content.container.children) != null && _content$container$ch.length)) {
|
|
39
|
+
return null;
|
|
40
|
+
}
|
|
41
|
+
return /*#__PURE__*/React.createElement(Cell, {
|
|
42
|
+
span: content.container.span
|
|
43
|
+
}, /*#__PURE__*/React.createElement(Layout, null, content.container.children.map((child, index) => /*#__PURE__*/React.createElement(RenderLayoutContent, {
|
|
44
|
+
key: `${sectionId}-card-${cardIndex}-content-${contentIndex}-level-${level}-child-${index}`,
|
|
45
|
+
content: child,
|
|
46
|
+
level: level + 1,
|
|
47
|
+
sectionId: sectionId,
|
|
48
|
+
cardIndex: cardIndex,
|
|
49
|
+
contentIndex: index,
|
|
50
|
+
setInputRef: setInputRef
|
|
51
|
+
}))));
|
|
52
|
+
case 'component':
|
|
53
|
+
if (!content.component.componentId) {
|
|
54
|
+
return null;
|
|
55
|
+
}
|
|
56
|
+
const Component = overrides == null || (_overrides$components = overrides.components) == null ? void 0 : _overrides$components[content.component.componentId];
|
|
57
|
+
if (!Component) {
|
|
58
|
+
return null;
|
|
59
|
+
}
|
|
60
|
+
return /*#__PURE__*/React.createElement(Cell, {
|
|
61
|
+
span: content.component.span
|
|
62
|
+
}, /*#__PURE__*/React.createElement(Component, {
|
|
63
|
+
form: pageState == null ? void 0 : pageState.form,
|
|
64
|
+
entity: entity
|
|
65
|
+
}));
|
|
66
|
+
default:
|
|
67
|
+
return null;
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
//# sourceMappingURL=RenderLayoutContent.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["React","Cell","Layout","useSchema","usePatternsWizardOverridesContext","useEntityPageContext","FormFieldInput","RenderLayoutContent","_ref","_content$container$ch","_overrides$components","content","level","sectionId","cardIndex","contentIndex","setInputRef","schema","overrides","pageState","entity","type","field","fieldId","fields","createElement","span","key","inputRef","ref","container","children","length","map","child","index","component","componentId","Component","components","form"],"sources":["../../../../../src/components/AutoPatternsEntityPage/RenderLayout/RenderLayoutContent.tsx"],"sourcesContent":["import React from 'react';\nimport { Cell, Layout } from '@wix/design-system';\nimport { useSchema } from '../../../providers/SchemaContext';\nimport { usePatternsWizardOverridesContext } from '../../../providers';\nimport { useEntityPageContext } from '@wix/patterns';\nimport { FormFieldInput } from '../Fields/FormFieldInput';\nimport { LayoutContent } from '../../../types';\nimport { BaseInputRef } from '../Fields/types';\n\nexport interface RenderLayoutContentProps {\n content: LayoutContent;\n level: number;\n sectionId: string;\n cardIndex: number;\n contentIndex: number;\n setInputRef: (id: string, input: BaseInputRef) => void;\n}\n\nexport const RenderLayoutContent: React.FC<RenderLayoutContentProps> = ({\n content,\n level,\n sectionId,\n cardIndex,\n contentIndex,\n setInputRef,\n}) => {\n const schema = useSchema();\n const overrides = usePatternsWizardOverridesContext();\n const pageState = useEntityPageContext();\n\n const entity = pageState.entity;\n\n switch (content.type) {\n case 'field':\n if (!content.field.fieldId) {\n return null;\n }\n\n const field = schema.fields[content.field.fieldId];\n if (!field) {\n return null;\n }\n\n return (\n <Cell span={content.field.span}>\n <FormFieldInput\n key={content.field.fieldId}\n field={field}\n inputRef={(ref) => setInputRef(content.field.fieldId, ref)}\n />\n </Cell>\n );\n\n case 'container':\n if (!content.container.children?.length) {\n return null;\n }\n\n return (\n <Cell span={content.container.span}>\n <Layout>\n {content.container.children.map((child, index) => (\n <RenderLayoutContent\n key={`${sectionId}-card-${cardIndex}-content-${contentIndex}-level-${level}-child-${index}`}\n content={child}\n level={level + 1}\n sectionId={sectionId}\n cardIndex={cardIndex}\n contentIndex={index}\n setInputRef={setInputRef}\n />\n ))}\n </Layout>\n </Cell>\n );\n\n case 'component':\n if (!content.component.componentId) {\n return null;\n }\n\n const Component = overrides?.components?.[content.component.componentId];\n if (!Component) {\n return null;\n }\n\n return (\n <Cell span={content.component.span}>\n <Component\n form={pageState?.form as any}\n entity={entity as Record<string, any>}\n />\n </Cell>\n );\n\n default:\n return null;\n }\n};\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,IAAI,EAAEC,MAAM,QAAQ,oBAAoB;AACjD,SAASC,SAAS,QAAQ,kCAAkC;AAC5D,SAASC,iCAAiC,QAAQ,oBAAoB;AACtE,SAASC,oBAAoB,QAAQ,eAAe;AACpD,SAASC,cAAc,QAAQ,0BAA0B;AAazD,OAAO,MAAMC,mBAAuD,GAAGC,IAAA,IAOjE;EAAA,IAAAC,qBAAA,EAAAC,qBAAA;EAAA,IAPkE;IACtEC,OAAO;IACPC,KAAK;IACLC,SAAS;IACTC,SAAS;IACTC,YAAY;IACZC;EACF,CAAC,GAAAR,IAAA;EACC,MAAMS,MAAM,GAAGd,SAAS,CAAC,CAAC;EAC1B,MAAMe,SAAS,GAAGd,iCAAiC,CAAC,CAAC;EACrD,MAAMe,SAAS,GAAGd,oBAAoB,CAAC,CAAC;EAExC,MAAMe,MAAM,GAAGD,SAAS,CAACC,MAAM;EAE/B,QAAQT,OAAO,CAACU,IAAI;IAClB,KAAK,OAAO;MACV,IAAI,CAACV,OAAO,CAACW,KAAK,CAACC,OAAO,EAAE;QAC1B,OAAO,IAAI;MACb;MAEA,MAAMD,KAAK,GAAGL,MAAM,CAACO,MAAM,CAACb,OAAO,CAACW,KAAK,CAACC,OAAO,CAAC;MAClD,IAAI,CAACD,KAAK,EAAE;QACV,OAAO,IAAI;MACb;MAEA,oBACEtB,KAAA,CAAAyB,aAAA,CAACxB,IAAI;QAACyB,IAAI,EAAEf,OAAO,CAACW,KAAK,CAACI;MAAK,gBAC7B1B,KAAA,CAAAyB,aAAA,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B,aAAA,CAACxB,IAAI;QAACyB,IAAI,EAAEf,OAAO,CAACyB,SAAS,CAACV;MAAK,gBACjC1B,KAAA,CAAAyB,aAAA,CAACa,SAAS;QACRE,IAAI,EAAErB,SAAS,oBAATA,SAAS,CAAEqB,IAAY;QAC7BpB,MAAM,EAAEA;MAA8B,CACvC,CACG,CAAC;IAGX;MACE,OAAO,IAAI;EACf;AACF,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Cell, Box, Text } from '@wix/design-system';
|
|
3
|
+
export const RenderViewField = _ref => {
|
|
4
|
+
let {
|
|
5
|
+
field,
|
|
6
|
+
fieldId,
|
|
7
|
+
entity,
|
|
8
|
+
span
|
|
9
|
+
} = _ref;
|
|
10
|
+
const fieldValue = entity == null ? void 0 : entity[fieldId];
|
|
11
|
+
|
|
12
|
+
// Safe display value conversion for all field types
|
|
13
|
+
const getDisplayValue = value => {
|
|
14
|
+
if (value === null || value === undefined) {
|
|
15
|
+
return '-';
|
|
16
|
+
}
|
|
17
|
+
if (typeof value === 'string' || typeof value === 'number' || typeof value === 'boolean') {
|
|
18
|
+
return String(value);
|
|
19
|
+
}
|
|
20
|
+
if (Array.isArray(value)) {
|
|
21
|
+
return value.length > 0 ? value.join(', ') : '-';
|
|
22
|
+
}
|
|
23
|
+
if (typeof value === 'object') {
|
|
24
|
+
// Handle dates
|
|
25
|
+
if (value instanceof Date) {
|
|
26
|
+
return value.toLocaleDateString();
|
|
27
|
+
}
|
|
28
|
+
// Handle objects with display properties
|
|
29
|
+
if (value.toString && value.toString !== Object.prototype.toString) {
|
|
30
|
+
return value.toString();
|
|
31
|
+
}
|
|
32
|
+
// Fallback for complex objects
|
|
33
|
+
return JSON.stringify(value);
|
|
34
|
+
}
|
|
35
|
+
return String(value);
|
|
36
|
+
};
|
|
37
|
+
const displayValue = getDisplayValue(fieldValue);
|
|
38
|
+
return /*#__PURE__*/React.createElement(Cell, {
|
|
39
|
+
span: span
|
|
40
|
+
}, /*#__PURE__*/React.createElement(Box, {
|
|
41
|
+
direction: "vertical",
|
|
42
|
+
gap: "4px"
|
|
43
|
+
}, /*#__PURE__*/React.createElement(Text, {
|
|
44
|
+
size: "small",
|
|
45
|
+
secondary: true
|
|
46
|
+
}, field.displayName || fieldId), /*#__PURE__*/React.createElement(Text, null, displayValue)));
|
|
47
|
+
};
|
|
48
|
+
//# sourceMappingURL=RenderViewField.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["React","Cell","Box","Text","RenderViewField","_ref","field","fieldId","entity","span","fieldValue","getDisplayValue","value","undefined","String","Array","isArray","length","join","Date","toLocaleDateString","toString","Object","prototype","JSON","stringify","displayValue","createElement","direction","gap","size","secondary","displayName"],"sources":["../../../../../src/components/AutoPatternsEntityPage/RenderLayout/RenderViewField.tsx"],"sourcesContent":["import React from 'react';\nimport { Cell, Box, Text } from '@wix/design-system';\n\nexport const RenderViewField: React.FC<{\n field: any;\n fieldId: string;\n entity: any;\n span?: number;\n}> = ({ field, fieldId, entity, span }) => {\n const fieldValue = entity?.[fieldId];\n\n // Safe display value conversion for all field types\n const getDisplayValue = (value: any): string => {\n if (value === null || value === undefined) {\n return '-';\n }\n if (\n typeof value === 'string' ||\n typeof value === 'number' ||\n typeof value === 'boolean'\n ) {\n return String(value);\n }\n if (Array.isArray(value)) {\n return value.length > 0 ? value.join(', ') : '-';\n }\n if (typeof value === 'object') {\n // Handle dates\n if (value instanceof Date) {\n return value.toLocaleDateString();\n }\n // Handle objects with display properties\n if (value.toString && value.toString !== Object.prototype.toString) {\n return value.toString();\n }\n // Fallback for complex objects\n return JSON.stringify(value);\n }\n return String(value);\n };\n\n const displayValue = getDisplayValue(fieldValue);\n\n return (\n <Cell span={span}>\n <Box direction=\"vertical\" gap=\"4px\">\n <Text size=\"small\" secondary>\n {field.displayName || fieldId}\n </Text>\n <Text>{displayValue}</Text>\n </Box>\n </Cell>\n );\n};\n"],"mappings":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IAAI;IAACQ,IAAI,EAAEA;EAAK,gBACfT,KAAA,CAAA2B,aAAA,CAACzB,GAAG;IAAC0B,SAAS,EAAC,UAAU;IAACC,GAAG,EAAC;EAAK,gBACjC7B,KAAA,CAAA2B,aAAA,CAACxB,IAAI;IAAC2B,IAAI,EAAC,OAAO;IAACC,SAAS;EAAA,GACzBzB,KAAK,CAAC0B,WAAW,IAAIzB,OAClB,CAAC,eACPP,KAAA,CAAA2B,aAAA,CAACxB,IAAI,QAAEuB,YAAmB,CACvB,CACD,CAAC;AAEX,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sources":["../../../../../src/components/AutoPatternsEntityPage/RenderLayout/index.ts"],"sourcesContent":["export * from './RenderLayoutCard';\nexport * from './RenderLayoutContent';\n"],"mappings":"AAAA,cAAc,oBAAoB;AAClC,cAAc,uBAAuB","ignoreList":[]}
|
|
@@ -3,6 +3,7 @@ import { useForm } from '../../exports/form';
|
|
|
3
3
|
import React from 'react';
|
|
4
4
|
import { Card, Cell, Layout } from '@wix/design-system';
|
|
5
5
|
const RenderLayoutContent = _ref => {
|
|
6
|
+
var _content$container$ch;
|
|
6
7
|
let {
|
|
7
8
|
content,
|
|
8
9
|
level,
|
|
@@ -12,7 +13,7 @@ const RenderLayoutContent = _ref => {
|
|
|
12
13
|
} = _ref;
|
|
13
14
|
switch (content.type) {
|
|
14
15
|
case 'container':
|
|
15
|
-
if (!content.container.children
|
|
16
|
+
if (!((_content$container$ch = content.container.children) != null && _content$container$ch.length)) {
|
|
16
17
|
return null;
|
|
17
18
|
}
|
|
18
19
|
return /*#__PURE__*/React.createElement(Cell, {
|
|
@@ -30,6 +31,7 @@ const RenderLayoutContent = _ref => {
|
|
|
30
31
|
}
|
|
31
32
|
};
|
|
32
33
|
const RenderLayoutCard = _ref2 => {
|
|
34
|
+
var _layout$card$subtitle;
|
|
33
35
|
let {
|
|
34
36
|
layout,
|
|
35
37
|
sectionId,
|
|
@@ -41,7 +43,7 @@ const RenderLayoutCard = _ref2 => {
|
|
|
41
43
|
minHeight: "50px"
|
|
42
44
|
}, /*#__PURE__*/React.createElement(Card.Header, {
|
|
43
45
|
title: layout.card.title.text,
|
|
44
|
-
subtitle: layout.card.subtitle
|
|
46
|
+
subtitle: (_layout$card$subtitle = layout.card.subtitle) == null ? void 0 : _layout$card$subtitle.text
|
|
45
47
|
}), /*#__PURE__*/React.createElement(Card.Divider, null), /*#__PURE__*/React.createElement(Card.Content, null, /*#__PURE__*/React.createElement(Layout, null, layout.card.children.map((child, index) => /*#__PURE__*/React.createElement(RenderLayoutContent, {
|
|
46
48
|
key: `${sectionId}-card-${cardIndex}-content-${index}`,
|
|
47
49
|
content: child,
|
|
@@ -55,6 +57,7 @@ const RenderLayoutCard = _ref2 => {
|
|
|
55
57
|
}
|
|
56
58
|
};
|
|
57
59
|
export const SkeletonEntity = _ref3 => {
|
|
60
|
+
var _entityPage$layout, _entityPage$layout2, _entityPage$layout$si;
|
|
58
61
|
let {
|
|
59
62
|
entityPage
|
|
60
63
|
} = _ref3;
|
|
@@ -73,12 +76,12 @@ export const SkeletonEntity = _ref3 => {
|
|
|
73
76
|
title: {
|
|
74
77
|
text: ''
|
|
75
78
|
}
|
|
76
|
-
}), /*#__PURE__*/React.createElement(EntityPage.Content, null, /*#__PURE__*/React.createElement(EntityPage.MainContent, null, entityPage.layout
|
|
79
|
+
}), /*#__PURE__*/React.createElement(EntityPage.Content, null, /*#__PURE__*/React.createElement(EntityPage.MainContent, null, (_entityPage$layout = entityPage.layout) == null || (_entityPage$layout = _entityPage$layout.main) == null ? void 0 : _entityPage$layout.map((layout, layoutIndex) => /*#__PURE__*/React.createElement(RenderLayoutCard, {
|
|
77
80
|
key: `main-section-card-${layoutIndex}`,
|
|
78
81
|
layout: layout,
|
|
79
82
|
sectionId: "main",
|
|
80
83
|
cardIndex: layoutIndex
|
|
81
|
-
}))), entityPage.layout
|
|
84
|
+
}))), (_entityPage$layout2 = entityPage.layout) != null && _entityPage$layout2.sidebar ? /*#__PURE__*/React.createElement(EntityPage.AdditionalContent, null, (_entityPage$layout$si = entityPage.layout.sidebar) == null ? void 0 : _entityPage$layout$si.map((layout, layoutIndex) => /*#__PURE__*/React.createElement(RenderLayoutCard, {
|
|
82
85
|
key: `sidebar-section-card-${layoutIndex}`,
|
|
83
86
|
layout: layout,
|
|
84
87
|
sectionId: "sidebar",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["EntityPage","useEntityPage","useForm","React","Card","Cell","Layout","RenderLayoutContent","_ref","content","level","sectionId","cardIndex","contentIndex","type","container","children","length","createElement","span","map","child","index","key","RenderLayoutCard","_ref2","layout","minHeight","Header","title","card","text","subtitle","Divider","Content","SkeletonEntity","_ref3","entityPage","form","state","parentPath","onSave","updatedEntity","fetch","Promise","Fragment","MainContent","main","layoutIndex","sidebar","AdditionalContent"],"sources":["../../../../src/components/AutoPatternsEntityPage/SkeletonEntity.tsx"],"sourcesContent":["import { EntityPage, EntityPageState, useEntityPage } from '@wix/patterns';\nimport { useForm } from '../../exports/form';\nimport React from 'react';\nimport { EntityPageConfig, CardLayout, LayoutContent } from '../../types';\n\nexport interface SkeletonEntityProps {\n entityPage: EntityPageConfig;\n}\nimport { Card, Cell, Layout } from '@wix/design-system';\n\nconst RenderLayoutContent: React.FC<{\n content: LayoutContent;\n level: number;\n sectionId: string;\n cardIndex: number;\n contentIndex: number;\n}> = ({ content, level, sectionId, cardIndex, contentIndex }) => {\n switch (content.type) {\n case 'container':\n if (!content.container.children?.length) {\n return null;\n }\n\n return (\n <Cell span={content.container.span}>\n <Layout>\n {content.container.children.map((child, index) => (\n <RenderLayoutContent\n key={`${sectionId}-card-${cardIndex}-content-${contentIndex}-level-${level}-child-${index}`}\n content={child}\n level={level + 1}\n sectionId={sectionId}\n cardIndex={cardIndex}\n contentIndex={index}\n />\n ))}\n </Layout>\n </Cell>\n );\n\n default:\n return null;\n }\n};\n\nconst RenderLayoutCard: React.FC<{\n layout: CardLayout;\n sectionId: string;\n cardIndex: number;\n}> = ({ layout, sectionId, cardIndex }) => {\n switch (layout.type) {\n case 'card':\n return (\n <EntityPage.Card minHeight=\"50px\">\n <Card.Header\n title={layout.card.title.text}\n subtitle={layout.card.subtitle?.text}\n />\n <Card.Divider />\n <Card.Content>\n <Layout>\n {layout.card.children.map((child, index: number) => (\n <RenderLayoutContent\n key={`${sectionId}-card-${cardIndex}-content-${index}`}\n content={child}\n level={0}\n sectionId={sectionId}\n cardIndex={cardIndex}\n contentIndex={index}\n />\n ))}\n </Layout>\n </Card.Content>\n </EntityPage.Card>\n );\n default:\n return null;\n }\n};\n\nexport const SkeletonEntity = ({ entityPage }: SkeletonEntityProps) => {\n const form = useForm();\n\n const state: EntityPageState<any> = useEntityPage<any, any>({\n parentPath: '',\n form,\n onSave: async () => ({ updatedEntity: {} }),\n fetch: async () => new Promise(() => {}),\n });\n\n return (\n <>\n <EntityPage state={state}>\n <EntityPage.Header title={{ text: '' }} />\n <EntityPage.Content>\n <EntityPage.MainContent>\n {entityPage.layout?.main?.map((layout, layoutIndex) => (\n <RenderLayoutCard\n key={`main-section-card-${layoutIndex}`}\n layout={layout}\n sectionId=\"main\"\n cardIndex={layoutIndex}\n />\n ))}\n </EntityPage.MainContent>\n {entityPage.layout?.sidebar ? (\n <EntityPage.AdditionalContent>\n {entityPage.layout.sidebar?.map((layout, layoutIndex) => (\n <RenderLayoutCard\n key={`sidebar-section-card-${layoutIndex}`}\n layout={layout}\n sectionId=\"sidebar\"\n cardIndex={layoutIndex}\n />\n ))}\n </EntityPage.AdditionalContent>\n ) : null}\n </EntityPage.Content>\n </EntityPage>\n </>\n );\n};\n"],"mappings":"AAAA,SAASA,UAAU,EAAmBC,aAAa,QAAQ,eAAe;AAC1E,SAASC,OAAO,QAAQ,oBAAoB;AAC5C,OAAOC,KAAK,MAAM,OAAO;AAMzB,SAASC,IAAI,EAAEC,IAAI,EAAEC,MAAM,QAAQ,oBAAoB;AAEvD,MAAMC,mBAMJ,GAAGC,IAAA,IAA4D;EAAA,IAA3D;IAAEC,OAAO;IAAEC,KAAK;IAAEC,SAAS;IAAEC,SAAS;IAAEC;EAAa,CAAC,
|
|
1
|
+
{"version":3,"names":["EntityPage","useEntityPage","useForm","React","Card","Cell","Layout","RenderLayoutContent","_ref","_content$container$ch","content","level","sectionId","cardIndex","contentIndex","type","container","children","length","createElement","span","map","child","index","key","RenderLayoutCard","_ref2","_layout$card$subtitle","layout","minHeight","Header","title","card","text","subtitle","Divider","Content","SkeletonEntity","_ref3","_entityPage$layout","_entityPage$layout2","_entityPage$layout$si","entityPage","form","state","parentPath","onSave","updatedEntity","fetch","Promise","Fragment","MainContent","main","layoutIndex","sidebar","AdditionalContent"],"sources":["../../../../src/components/AutoPatternsEntityPage/SkeletonEntity.tsx"],"sourcesContent":["import { EntityPage, EntityPageState, useEntityPage } from '@wix/patterns';\nimport { useForm } from '../../exports/form';\nimport React from 'react';\nimport { EntityPageConfig, CardLayout, LayoutContent } from '../../types';\n\nexport interface SkeletonEntityProps {\n entityPage: EntityPageConfig;\n}\nimport { Card, Cell, Layout } from '@wix/design-system';\n\nconst RenderLayoutContent: React.FC<{\n content: LayoutContent;\n level: number;\n sectionId: string;\n cardIndex: number;\n contentIndex: number;\n}> = ({ content, level, sectionId, cardIndex, contentIndex }) => {\n switch (content.type) {\n case 'container':\n if (!content.container.children?.length) {\n return null;\n }\n\n return (\n <Cell span={content.container.span}>\n <Layout>\n {content.container.children.map((child, index) => (\n <RenderLayoutContent\n key={`${sectionId}-card-${cardIndex}-content-${contentIndex}-level-${level}-child-${index}`}\n content={child}\n level={level + 1}\n sectionId={sectionId}\n cardIndex={cardIndex}\n contentIndex={index}\n />\n ))}\n </Layout>\n </Cell>\n );\n\n default:\n return null;\n }\n};\n\nconst RenderLayoutCard: React.FC<{\n layout: CardLayout;\n sectionId: string;\n cardIndex: number;\n}> = ({ layout, sectionId, cardIndex }) => {\n switch (layout.type) {\n case 'card':\n return (\n <EntityPage.Card minHeight=\"50px\">\n <Card.Header\n title={layout.card.title.text}\n subtitle={layout.card.subtitle?.text}\n />\n <Card.Divider />\n <Card.Content>\n <Layout>\n {layout.card.children.map((child, index: number) => (\n <RenderLayoutContent\n key={`${sectionId}-card-${cardIndex}-content-${index}`}\n content={child}\n level={0}\n sectionId={sectionId}\n cardIndex={cardIndex}\n contentIndex={index}\n />\n ))}\n </Layout>\n </Card.Content>\n </EntityPage.Card>\n );\n default:\n return null;\n }\n};\n\nexport const SkeletonEntity = ({ entityPage }: SkeletonEntityProps) => {\n const form = useForm();\n\n const state: EntityPageState<any> = useEntityPage<any, any>({\n parentPath: '',\n form,\n onSave: async () => ({ updatedEntity: {} }),\n fetch: async () => new Promise(() => {}),\n });\n\n return (\n <>\n <EntityPage state={state}>\n <EntityPage.Header title={{ text: '' }} />\n <EntityPage.Content>\n <EntityPage.MainContent>\n {entityPage.layout?.main?.map((layout, layoutIndex) => (\n <RenderLayoutCard\n key={`main-section-card-${layoutIndex}`}\n layout={layout}\n sectionId=\"main\"\n cardIndex={layoutIndex}\n />\n ))}\n </EntityPage.MainContent>\n {entityPage.layout?.sidebar ? (\n <EntityPage.AdditionalContent>\n {entityPage.layout.sidebar?.map((layout, layoutIndex) => (\n <RenderLayoutCard\n key={`sidebar-section-card-${layoutIndex}`}\n layout={layout}\n sectionId=\"sidebar\"\n cardIndex={layoutIndex}\n />\n ))}\n </EntityPage.AdditionalContent>\n ) : null}\n </EntityPage.Content>\n </EntityPage>\n </>\n );\n};\n"],"mappings":"AAAA,SAASA,UAAU,EAAmBC,aAAa,QAAQ,eAAe;AAC1E,SAASC,OAAO,QAAQ,oBAAoB;AAC5C,OAAOC,KAAK,MAAM,OAAO;AAMzB,SAASC,IAAI,EAAEC,IAAI,EAAEC,MAAM,QAAQ,oBAAoB;AAEvD,MAAMC,mBAMJ,GAAGC,IAAA,IAA4D;EAAA,IAAAC,qBAAA;EAAA,IAA3D;IAAEC,OAAO;IAAEC,KAAK;IAAE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AU,CAAC8B,MAAM;IAACC,KAAK,EAAE;MAAEE,IAAI,EAAE;IAAG;EAAE,CAAE,CAAC,eAC1C9B,KAAA,CAAAgB,aAAA,CAACnB,UAAU,CAACoC,OAAO,qBACjBjC,KAAA,CAAAgB,aAAA,CAACnB,UAAU,CAACmD,WAAW,SAAAZ,kBAAA,GACpBG,UAAU,CAACd,MAAM,cAAAW,kBAAA,GAAjBA,kBAAA,CAAmBa,IAAI,qBAAvBb,kBAAA,CAAyBlB,GAAG,CAAC,CAACO,MAAM,EAAEyB,WAAW,kBAChDlD,KAAA,CAAAgB,aAAA,CAACM,gBAAgB;IACfD,GAAG,EAAE,qBAAqB6B,WAAW,EAAG;IACxCzB,MAAM,EAAEA,MAAO;IACfhB,SAAS,EAAC,MAAM;IAChBC,SAAS,EAAEwC;EAAY,CACxB,CACF,CACqB,CAAC,EACxB,CAAAb,mBAAA,GAAAE,UAAU,CAACd,MAAM,aAAjBY,mBAAA,CAAmBc,OAAO,gBACzBnD,KAAA,CAAAgB,aAAA,CAACnB,UAAU,CAACuD,iBAAiB,SAAAd,qBAAA,GAC1BC,UAAU,CAACd,MAAM,CAAC0B,OAAO,qBAAzBb,qBAAA,CAA2BpB,GAAG,CAAC,CAACO,MAAM,EAAEyB,WAAW,kBAClDlD,KAAA,CAAAgB,aAAA,CAACM,gBAAgB;IACfD,GAAG,EAAE,wBAAwB6B,WAAW,EAAG;IAC3CzB,MAAM,EAAEA,MAAO;IACfhB,SAAS,EAAC,SAAS;IACnBC,SAAS,EAAEwC;EAAY,CACxB,CACF,CAC2B,CAAC,GAC7B,IACc,CACV,CACZ,CAAC;AAEP,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Card, Layout } from '@wix/design-system';
|
|
3
|
+
import { RenderViewLayoutContent } from './RenderViewLayoutContent';
|
|
4
|
+
// TODO: remove this component and use RenderLayoutCard instead
|
|
5
|
+
export const RenderViewLayoutCard = _ref => {
|
|
6
|
+
var _layout$card$subtitle;
|
|
7
|
+
let {
|
|
8
|
+
entity,
|
|
9
|
+
layout,
|
|
10
|
+
sectionId,
|
|
11
|
+
cardIndex
|
|
12
|
+
} = _ref;
|
|
13
|
+
switch (layout.type) {
|
|
14
|
+
case 'card':
|
|
15
|
+
return /*#__PURE__*/React.createElement(Card, null, /*#__PURE__*/React.createElement(Card.Header, {
|
|
16
|
+
title: layout.card.title.text,
|
|
17
|
+
subtitle: (_layout$card$subtitle = layout.card.subtitle) == null ? void 0 : _layout$card$subtitle.text
|
|
18
|
+
}), /*#__PURE__*/React.createElement(Card.Divider, null), /*#__PURE__*/React.createElement(Card.Content, null, /*#__PURE__*/React.createElement(Layout, null, layout.card.children.map((child, index) => /*#__PURE__*/React.createElement(RenderViewLayoutContent, {
|
|
19
|
+
key: `${sectionId}-card-${cardIndex}-content-${index}`,
|
|
20
|
+
entity: entity,
|
|
21
|
+
content: child,
|
|
22
|
+
level: 0,
|
|
23
|
+
sectionId: sectionId,
|
|
24
|
+
cardIndex: cardIndex,
|
|
25
|
+
contentIndex: index
|
|
26
|
+
})))));
|
|
27
|
+
default:
|
|
28
|
+
return null;
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
//# sourceMappingURL=RenderViewLayoutCard.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["React","Card","Layout","RenderViewLayoutContent","RenderViewLayoutCard","_ref","_layout$card$subtitle","entity","layout","sectionId","cardIndex","type","createElement","Header","title","card","text","subtitle","Divider","Content","children","map","child","index","key","content","level","contentIndex"],"sources":["../../../../../src/components/AutoPatternsEntityPage/ViewEntityPage/RenderViewLayoutCard.tsx"],"sourcesContent":["import React from 'react';\nimport { Card, Layout } from '@wix/design-system';\nimport { RenderViewLayoutContent } from './RenderViewLayoutContent';\nimport { RenderLayoutCardProps } from '../RenderLayout';\n\ninterface RenderViewLayoutCardProps\n extends Omit<RenderLayoutCardProps, 'setInputRef'> {\n entity: Record<string, any>;\n}\n\n// TODO: remove this component and use RenderLayoutCard instead\nexport const RenderViewLayoutCard: React.FC<RenderViewLayoutCardProps> = ({\n entity,\n layout,\n sectionId,\n cardIndex,\n}) => {\n switch (layout.type) {\n case 'card':\n return (\n <Card>\n <Card.Header\n title={layout.card.title.text}\n subtitle={layout.card.subtitle?.text}\n />\n <Card.Divider />\n <Card.Content>\n <Layout>\n {layout.card.children.map((child, index: number) => (\n <RenderViewLayoutContent\n key={`${sectionId}-card-${cardIndex}-content-${index}`}\n entity={entity}\n content={child}\n level={0}\n sectionId={sectionId}\n cardIndex={cardIndex}\n contentIndex={index}\n />\n ))}\n </Layout>\n </Card.Content>\n </Card>\n );\n default:\n return null;\n }\n};\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,IAAI,EAAEC,MAAM,QAAQ,oBAAoB;AACjD,SAASC,uBAAuB,QAAQ,2BAA2B;AAQnE;AACA,OAAO,MAAMC,oBAAyD,GAAGC,IAAA,IAKnE;EAAA,IAAAC,qBAAA;EAAA,IALoE;IACxEC,MAAM;IACNC,MAAM;IACNC,SAAS;IACTC;EACF,CAAC,GAAAL,IAAA;EACC,QAAQG,MAAM,CAACG,IAAI;IACjB,KAAK,MAAM;MACT,oBACEX,KAAA,CAAAY,aAAA,CAACX,IAAI,qBACHD,KAAA,CAAAY,aAAA,CAACX,IAAI,CAACY,MAAM;QACVC,KAAK,EAAEN,MAAM,CAACO,IAAI,CAACD,KAAK,CAACE,IAAK;QAC9BC,QAAQ,GAAAX,qBAAA,GAAEE,MAAM,CAACO,IAAI,CAACE,QAAQ,qBAApBX,qBAAA,CAAsBU;MAAK,CACtC,CAAC,eACFhB,KAAA,CAAAY,aAAA,CAACX,IAAI,CAACiB,OAAO,MAAE,CAAC,eAChBlB,KAAA,CAAAY,aAAA,CAACX,IAAI,CAACkB,OAAO,qBACXnB,KAAA,CAAAY,aAAA,CAACV,MAAM,QACJM,MAAM,CAACO,IAAI,CAACK,QAAQ,CAACC,GAAG,CAAC,CAACC,KAAK,EAAEC,KAAa,kBAC7CvB,KAAA,CAAAY,aAAA,CAACT,uBAAuB;QACtBqB,GAAG,EAAE,GAAGf,SAAS,SAASC,SAAS,YAAYa,KAAK,EAAG;QACvDhB,MAAM,EAAEA,MAAO;QACfkB,OAAO,EAAEH,KAAM;QACfI,KAAK,EAAE,CAAE;QACTjB,SAAS,EAAEA,SAAU;QACrBC,SAAS,EAAEA,SAAU;QACrBiB,YAAY,EAAEJ;MAAM,CACrB,CACF,CACK,CACI,CACV,CAAC;IAEX;MACE,OAAO,IAAI;EACf;AACF,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Cell, Layout } from '@wix/design-system';
|
|
3
|
+
import { useSchema } from '../../../providers/SchemaContext';
|
|
4
|
+
import { usePatternsWizardOverridesContext } from '../../../providers';
|
|
5
|
+
import { RenderViewField } from '../RenderLayout/RenderViewField';
|
|
6
|
+
// TODO: remove this component and use RenderLayoutContent instead
|
|
7
|
+
export const RenderViewLayoutContent = _ref => {
|
|
8
|
+
var _content$container$ch, _overrides$components;
|
|
9
|
+
let {
|
|
10
|
+
entity,
|
|
11
|
+
content,
|
|
12
|
+
level,
|
|
13
|
+
sectionId,
|
|
14
|
+
cardIndex,
|
|
15
|
+
contentIndex
|
|
16
|
+
} = _ref;
|
|
17
|
+
const schema = useSchema();
|
|
18
|
+
const overrides = usePatternsWizardOverridesContext();
|
|
19
|
+
switch (content.type) {
|
|
20
|
+
case 'field':
|
|
21
|
+
if (!content.field.fieldId) {
|
|
22
|
+
return null;
|
|
23
|
+
}
|
|
24
|
+
const field = schema.fields[content.field.fieldId];
|
|
25
|
+
if (!field) {
|
|
26
|
+
return null;
|
|
27
|
+
}
|
|
28
|
+
return /*#__PURE__*/React.createElement(RenderViewField, {
|
|
29
|
+
field: field,
|
|
30
|
+
fieldId: content.field.fieldId,
|
|
31
|
+
entity: entity,
|
|
32
|
+
span: content.field.span
|
|
33
|
+
});
|
|
34
|
+
case 'container':
|
|
35
|
+
if (!((_content$container$ch = content.container.children) != null && _content$container$ch.length)) {
|
|
36
|
+
return null;
|
|
37
|
+
}
|
|
38
|
+
return /*#__PURE__*/React.createElement(Cell, {
|
|
39
|
+
span: content.container.span
|
|
40
|
+
}, /*#__PURE__*/React.createElement(Layout, null, content.container.children.map((child, index) => /*#__PURE__*/React.createElement(RenderViewLayoutContent, {
|
|
41
|
+
key: `${sectionId}-card-${cardIndex}-content-${contentIndex}-level-${level}-child-${index}`,
|
|
42
|
+
entity: entity,
|
|
43
|
+
content: child,
|
|
44
|
+
level: level + 1,
|
|
45
|
+
sectionId: sectionId,
|
|
46
|
+
cardIndex: cardIndex,
|
|
47
|
+
contentIndex: index
|
|
48
|
+
}))));
|
|
49
|
+
case 'component':
|
|
50
|
+
if (!content.component.componentId) {
|
|
51
|
+
return null;
|
|
52
|
+
}
|
|
53
|
+
const Component = overrides == null || (_overrides$components = overrides.components) == null ? void 0 : _overrides$components[content.component.componentId];
|
|
54
|
+
if (!Component) {
|
|
55
|
+
return null;
|
|
56
|
+
}
|
|
57
|
+
return /*#__PURE__*/React.createElement(Cell, {
|
|
58
|
+
span: content.component.span
|
|
59
|
+
}, /*#__PURE__*/React.createElement(Component, {
|
|
60
|
+
entity: entity
|
|
61
|
+
}));
|
|
62
|
+
default:
|
|
63
|
+
return null;
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
//# sourceMappingURL=RenderViewLayoutContent.js.map
|
package/dist/esm/components/AutoPatternsEntityPage/ViewEntityPage/RenderViewLayoutContent.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["React","Cell","Layout","useSchema","usePatternsWizardOverridesContext","RenderViewField","RenderViewLayoutContent","_ref","_content$container$ch","_overrides$components","entity","content","level","sectionId","cardIndex","contentIndex","schema","overrides","type","field","fieldId","fields","createElement","span","container","children","length","map","child","index","key","component","componentId","Component","components"],"sources":["../../../../../src/components/AutoPatternsEntityPage/ViewEntityPage/RenderViewLayoutContent.tsx"],"sourcesContent":["import React from 'react';\nimport { Cell, Layout } from '@wix/design-system';\nimport { useSchema } from '../../../providers/SchemaContext';\nimport { usePatternsWizardOverridesContext } from '../../../providers';\nimport { RenderViewField } from '../RenderLayout/RenderViewField';\nimport { RenderLayoutContentProps } from '../RenderLayout';\n\ninterface RenderViewLayoutContentProps\n extends Omit<RenderLayoutContentProps, 'setInputRef'> {\n entity: Record<string, any>;\n}\n\n// TODO: remove this component and use RenderLayoutContent instead\nexport const RenderViewLayoutContent: React.FC<\n RenderViewLayoutContentProps\n> = ({ entity, content, level, sectionId, cardIndex, contentIndex }) => {\n const schema = useSchema();\n const overrides = usePatternsWizardOverridesContext();\n\n switch (content.type) {\n case 'field':\n if (!content.field.fieldId) {\n return null;\n }\n\n const field = schema.fields[content.field.fieldId];\n if (!field) {\n return null;\n }\n\n return (\n <RenderViewField\n field={field}\n fieldId={content.field.fieldId}\n entity={entity}\n span={content.field.span}\n />\n );\n\n case 'container':\n if (!content.container.children?.length) {\n return null;\n }\n\n return (\n <Cell span={content.container.span}>\n <Layout>\n {content.container.children.map((child, index) => (\n <RenderViewLayoutContent\n key={`${sectionId}-card-${cardIndex}-content-${contentIndex}-level-${level}-child-${index}`}\n entity={entity}\n content={child}\n level={level + 1}\n sectionId={sectionId}\n cardIndex={cardIndex}\n contentIndex={index}\n />\n ))}\n </Layout>\n </Cell>\n );\n\n case 'component':\n if (!content.component.componentId) {\n return null;\n }\n\n const Component = overrides?.components?.[content.component.componentId];\n if (!Component) {\n return null;\n }\n\n return (\n <Cell span={content.component.span}>\n <Component entity={entity} />\n </Cell>\n );\n\n default:\n return null;\n }\n};\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,IAAI,EAAEC,MAAM,QAAQ,oBAAoB;AACjD,SAASC,SAAS,QAAQ,kCAAkC;AAC5D,SAASC,iCAAiC,QAAQ,oBAAoB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,GAAG,EAAE,GAAGjB,SAAS,SAASC,SAAS,YAAYC,YAAY,UAAUH,KAAK,UAAUiB,KAAK,EAAG;QAC5FnB,MAAM,EAAEA,MAAO;QACfC,OAAO,EAAEiB,KAAM;QACfhB,KAAK,EAAEA,KAAK,GAAG,CAAE;QACjBC,SAAS,EAAEA,SAAU;QACrBC,SAAS,EAAEA,SAAU;QACrBC,YAAY,EAAEc;MAAM,CACrB,CACF,CACK,CACJ,CAAC;IAGX,KAAK,WAAW;MACd,IAAI,CAAClB,OAAO,CAACoB,SAAS,CAACC,WAAW,EAAE;QAClC,OAAO,IAAI;MACb;MAEA,MAAMC,SAAS,GAAGhB,SAAS,aAAAR,qBAAA,GAATQ,SAAS,CAAEiB,UAAU,qBAArBzB,qBAAA,CAAwBE,OAAO,CAACoB,SAAS,CAACC,WAAW,CAAC;MACxE,IAAI,CAACC,SAAS,EAAE;QACd,OAAO,IAAI;MACb;MAEA,oBACEjC,KAAA,CAAAsB,aAAA,CAACrB,IAAI;QAACsB,IAAI,EAAEZ,OAAO,CAACoB,SAAS,CAACR;MAAK,gBACjCvB,KAAA,CAAAsB,aAAA,CAACW,SAAS;QAACvB,MAAM,EAAEA;MAAO,CAAE,CACxB,CAAC;IAGX;MACE,OAAO,IAAI;EACf;AACF,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import React, { useEffect, useMemo, useState } from 'react';
|
|
2
|
+
import { Box, Cell, Heading, Layout, Page } from '@wix/design-system';
|
|
3
|
+
import { RenderViewLayoutCard } from './ViewEntityPage/RenderViewLayoutCard';
|
|
4
|
+
import { useParams } from 'react-router-dom';
|
|
5
|
+
import { useSchema } from '../../providers';
|
|
6
|
+
import { useNavigation } from '../../hooks/useNavigationUtils';
|
|
7
|
+
import { MoreActions } from '@wix/patterns';
|
|
8
|
+
import { useEntityPageActions } from '../../hooks/useEntityPageActions';
|
|
9
|
+
import { useEntityPageMoreActions } from '../../hooks/useEntityPageMoreActions';
|
|
10
|
+
import { useActionsSDK } from '../../hooks/useActionsSDK';
|
|
11
|
+
import { useNavigateEditEntityAction } from '../../hooks/useNavigateEditEntityAction';
|
|
12
|
+
// TODO: temp solution until we have a proper view mode entity page
|
|
13
|
+
export const ViewModeEntityPage = _ref => {
|
|
14
|
+
var _configuration$subtit, _pageLayout$main, _pageLayout$sidebar;
|
|
15
|
+
let {
|
|
16
|
+
configuration
|
|
17
|
+
} = _ref;
|
|
18
|
+
const {
|
|
19
|
+
route
|
|
20
|
+
} = configuration;
|
|
21
|
+
const params = useParams();
|
|
22
|
+
const entityId = params[route.params.id];
|
|
23
|
+
const schema = useSchema();
|
|
24
|
+
const {
|
|
25
|
+
layout: pageLayout
|
|
26
|
+
} = configuration;
|
|
27
|
+
const {
|
|
28
|
+
navigateToCollectionPage
|
|
29
|
+
} = useNavigation();
|
|
30
|
+
const [entity, setEntity] = useState(undefined);
|
|
31
|
+
useEffect(() => {
|
|
32
|
+
let isMounted = true;
|
|
33
|
+
const fetchEntity = async () => {
|
|
34
|
+
if (!entityId) {
|
|
35
|
+
setEntity(undefined);
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
const fetchedEntity = await schema.actions.get(entityId);
|
|
39
|
+
if (isMounted) {
|
|
40
|
+
setEntity(fetchedEntity);
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
fetchEntity();
|
|
44
|
+
return () => {
|
|
45
|
+
isMounted = false;
|
|
46
|
+
};
|
|
47
|
+
}, [entityId, schema]);
|
|
48
|
+
const title = useMemo(() => {
|
|
49
|
+
if (configuration.title) {
|
|
50
|
+
return configuration.title.text;
|
|
51
|
+
} else {
|
|
52
|
+
return (entity == null ? void 0 : entity[schema.displayField]) ?? 'View Item';
|
|
53
|
+
}
|
|
54
|
+
}, [configuration.title, entity, schema.displayField]);
|
|
55
|
+
const subtitle = (_configuration$subtit = configuration.subtitle) == null ? void 0 : _configuration$subtit.text;
|
|
56
|
+
const sdk = useActionsSDK({
|
|
57
|
+
collectionId: configuration.collectionId
|
|
58
|
+
});
|
|
59
|
+
const actions = useEntityPageActions({
|
|
60
|
+
entityPageActions: configuration.actions,
|
|
61
|
+
entity,
|
|
62
|
+
sdk
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
// add OOTB navigate to edit action
|
|
66
|
+
const moreActions = useNavigateEditEntityAction({
|
|
67
|
+
displayName: entity == null ? void 0 : entity[schema.displayField],
|
|
68
|
+
configuration
|
|
69
|
+
});
|
|
70
|
+
const resolvedMoreActions = useEntityPageMoreActions(moreActions, entity, sdk);
|
|
71
|
+
return /*#__PURE__*/React.createElement(Page, {
|
|
72
|
+
dataHook: "view-mode-entity-page"
|
|
73
|
+
}, /*#__PURE__*/React.createElement(Page.Header, {
|
|
74
|
+
dataHook: "view-mode-entity-page-header",
|
|
75
|
+
title: /*#__PURE__*/React.createElement(Heading, {
|
|
76
|
+
size: "extraLarge"
|
|
77
|
+
}, title),
|
|
78
|
+
subtitle: subtitle,
|
|
79
|
+
showBackButton: true,
|
|
80
|
+
onBackClicked: () => navigateToCollectionPage(configuration.parentPageId),
|
|
81
|
+
actionsBar: /*#__PURE__*/React.createElement(Box, {
|
|
82
|
+
gap: "SP2"
|
|
83
|
+
}, resolvedMoreActions.length > 0 ? /*#__PURE__*/React.createElement(MoreActions, {
|
|
84
|
+
dataHook: "view-mode-entity-page-more-actions",
|
|
85
|
+
items: resolvedMoreActions
|
|
86
|
+
}) : undefined, actions)
|
|
87
|
+
}), /*#__PURE__*/React.createElement(Page.Content, null, /*#__PURE__*/React.createElement(Layout, null, /*#__PURE__*/React.createElement(Cell, {
|
|
88
|
+
span: pageLayout != null && pageLayout.sidebar ? 8 : 12
|
|
89
|
+
}, /*#__PURE__*/React.createElement(Box, {
|
|
90
|
+
direction: "vertical",
|
|
91
|
+
gap: "SP4"
|
|
92
|
+
}, pageLayout == null || (_pageLayout$main = pageLayout.main) == null ? void 0 : _pageLayout$main.map((layout, layoutIndex) => /*#__PURE__*/React.createElement(RenderViewLayoutCard, {
|
|
93
|
+
key: `main-section-card-${layoutIndex}`,
|
|
94
|
+
entity: entity,
|
|
95
|
+
layout: layout,
|
|
96
|
+
sectionId: "main",
|
|
97
|
+
cardIndex: layoutIndex
|
|
98
|
+
})))), pageLayout != null && pageLayout.sidebar ? /*#__PURE__*/React.createElement(Cell, {
|
|
99
|
+
span: 4
|
|
100
|
+
}, /*#__PURE__*/React.createElement(Box, {
|
|
101
|
+
direction: "vertical",
|
|
102
|
+
gap: "SP4"
|
|
103
|
+
}, (_pageLayout$sidebar = pageLayout.sidebar) == null ? void 0 : _pageLayout$sidebar.map((layout, layoutIndex) => /*#__PURE__*/React.createElement(RenderViewLayoutCard, {
|
|
104
|
+
key: `sidebar-section-card-${layoutIndex}`,
|
|
105
|
+
entity: entity,
|
|
106
|
+
layout: layout,
|
|
107
|
+
sectionId: "sidebar",
|
|
108
|
+
cardIndex: layoutIndex
|
|
109
|
+
})))) : null)));
|
|
110
|
+
};
|
|
111
|
+
//# sourceMappingURL=ViewModeEntityPage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["React","useEffect","useMemo","useState","Box","Cell","Heading","Layout","Page","RenderViewLayoutCard","useParams","useSchema","useNavigation","MoreActions","useEntityPageActions","useEntityPageMoreActions","useActionsSDK","useNavigateEditEntityAction","ViewModeEntityPage","_ref","_configuration$subtit","_pageLayout$main","_pageLayout$sidebar","configuration","route","params","entityId","id","schema","layout","pageLayout","navigateToCollectionPage","entity","setEntity","undefined","isMounted","fetchEntity","fetchedEntity","actions","get","title","text","displayField","subtitle","sdk","collectionId","entityPageActions","moreActions","displayName","resolvedMoreActions","createElement","dataHook","Header","size","showBackButton","onBackClicked","parentPageId","actionsBar","gap","length","items","Content","span","sidebar","direction","main","map","layoutIndex","key","sectionId","cardIndex"],"sources":["../../../../src/components/AutoPatternsEntityPage/ViewModeEntityPage.tsx"],"sourcesContent":["import React, { useEffect, useMemo, useState } from 'react';\nimport { ViewEntityPageConfig } from '../../types';\nimport { Box, Cell, Heading, Layout, Page } from '@wix/design-system';\nimport { RenderViewLayoutCard } from './ViewEntityPage/RenderViewLayoutCard';\nimport { useParams } from 'react-router-dom';\nimport { useSchema } from '../../providers';\nimport { useNavigation } from '../../hooks/useNavigationUtils';\nimport { MoreActions } from '@wix/patterns';\nimport { useEntityPageActions } from '../../hooks/useEntityPageActions';\nimport { useEntityPageMoreActions } from '../../hooks/useEntityPageMoreActions';\nimport { useActionsSDK } from '../../hooks/useActionsSDK';\nimport { useNavigateEditEntityAction } from '../../hooks/useNavigateEditEntityAction';\n\ninterface ViewModeEntityPageProps {\n configuration: ViewEntityPageConfig;\n}\n\n// TODO: temp solution until we have a proper view mode entity page\nexport const ViewModeEntityPage: React.FC<ViewModeEntityPageProps> = ({\n configuration,\n}) => {\n const { route } = configuration;\n const params = useParams();\n const entityId = params[route.params.id];\n const schema = useSchema();\n const { layout: pageLayout } = configuration;\n const { navigateToCollectionPage } = useNavigation();\n\n const [entity, setEntity] = useState<any>(undefined);\n\n useEffect(() => {\n let isMounted = true;\n const fetchEntity = async () => {\n if (!entityId) {\n setEntity(undefined);\n return;\n }\n const fetchedEntity = await schema.actions.get(entityId);\n if (isMounted) {\n setEntity(fetchedEntity);\n }\n };\n fetchEntity();\n return () => {\n isMounted = false;\n };\n }, [entityId, schema]);\n\n const title = useMemo(() => {\n if (configuration.title) {\n return configuration.title.text;\n } else {\n return entity?.[schema.displayField] ?? 'View Item';\n }\n }, [configuration.title, entity, schema.displayField]);\n\n const subtitle = configuration.subtitle?.text;\n\n const sdk = useActionsSDK({\n collectionId: configuration.collectionId,\n });\n\n const actions = useEntityPageActions({\n entityPageActions: configuration.actions,\n entity,\n sdk,\n });\n\n // add OOTB navigate to edit action\n const moreActions = useNavigateEditEntityAction({\n displayName: entity?.[schema.displayField],\n configuration,\n });\n\n const resolvedMoreActions = useEntityPageMoreActions(\n moreActions,\n entity,\n sdk,\n );\n\n return (\n <Page dataHook=\"view-mode-entity-page\">\n <Page.Header\n dataHook=\"view-mode-entity-page-header\"\n title={<Heading size=\"extraLarge\">{title}</Heading>}\n subtitle={subtitle}\n showBackButton\n onBackClicked={() =>\n navigateToCollectionPage(configuration.parentPageId!)\n }\n actionsBar={\n <Box gap=\"SP2\">\n {resolvedMoreActions.length > 0 ? (\n <MoreActions\n dataHook=\"view-mode-entity-page-more-actions\"\n items={resolvedMoreActions}\n />\n ) : undefined}\n {actions}\n </Box>\n }\n />\n <Page.Content>\n <Layout>\n <Cell span={pageLayout?.sidebar ? 8 : 12}>\n <Box direction=\"vertical\" gap=\"SP4\">\n {pageLayout?.main?.map((layout, layoutIndex) => (\n <RenderViewLayoutCard\n key={`main-section-card-${layoutIndex}`}\n entity={entity}\n layout={layout}\n sectionId=\"main\"\n cardIndex={layoutIndex}\n />\n ))}\n </Box>\n </Cell>\n {pageLayout?.sidebar ? (\n <Cell span={4}>\n <Box direction=\"vertical\" gap=\"SP4\">\n {pageLayout.sidebar?.map((layout, layoutIndex) => (\n <RenderViewLayoutCard\n key={`sidebar-section-card-${layoutIndex}`}\n entity={entity}\n layout={layout}\n sectionId=\"sidebar\"\n cardIndex={layoutIndex}\n />\n ))}\n </Box>\n </Cell>\n ) : null}\n </Layout>\n </Page.Content>\n </Page>\n );\n};\n"],"mappings":"AAAA,OAAOA,KAAK,IAAIC,SAAS,EAAEC,OAAO,EAAEC,QAAQ,QAAQ,OAAO;AAE3D,SAASC,GAAG,EAAEC,IAAI,EAAEC,OAAO,EAAEC,MAAM,EAAEC,IAAI,QAAQ,oBAAoB;AACrE,SAASC,oBAAoB,QAAQ,uCAAuC;AAC5E,SAASC,SAAS,QAAQ,kBAAkB;AAC5C,SAASC,SAAS,QAAQ,iBAAiB;AAC3C,SAASC,aAAa,QAAQ,gCAAgC;AAC9D,SAASC,WAAW,QAAQ,eAAe;AAC3C,SAASC,oBAAoB,QAAQ,kCAAkC;AACvE,SAASC,wBAAwB,QAAQ,sCAAsC;AAC/E,SAASC,aAAa,QAAQ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O;IACfH,MAAM,EAAEA,MAAO;IACfwC,SAAS,EAAC,SAAS;IACnBC,SAAS,EAAEH;EAAY,CACxB,CACF,CACE,CACD,CAAC,GACL,IACE,CACI,CACV,CAAC;AAEX,CAAC","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["../../../../src/components/AutoPatternsEntityPage/index.ts"],"sourcesContent":["export * from './AutoPatternsEntityPage';\n"],"mappings":"AAAA,cAAc,0BAA0B","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":[],"sources":["../../../../src/components/AutoPatternsEntityPage/index.ts"],"sourcesContent":["export * from './AutoPatternsEntityPage';\nexport * from './ViewModeEntityPage';\nexport * from './RenderLayout';\n"],"mappings":"AAAA,cAAc,0BAA0B;AACxC,cAAc,sBAAsB;AACpC,cAAc,gBAAgB","ignoreList":[]}
|
|
@@ -4,6 +4,7 @@ import * as modals from './modals';
|
|
|
4
4
|
import { useModalContext } from '../providers/ModalContext';
|
|
5
5
|
import { usePatternsWizardOverridesContext } from '../providers';
|
|
6
6
|
export const ModalRenderer = () => {
|
|
7
|
+
var _overrides$modals;
|
|
7
8
|
const {
|
|
8
9
|
modal,
|
|
9
10
|
closeModal
|
|
@@ -12,7 +13,7 @@ export const ModalRenderer = () => {
|
|
|
12
13
|
if (!modal.id) {
|
|
13
14
|
return null;
|
|
14
15
|
}
|
|
15
|
-
const ModalComponent = overrides
|
|
16
|
+
const ModalComponent = (overrides == null || (_overrides$modals = overrides.modals) == null ? void 0 : _overrides$modals[modal.id]) || modals[modal.id];
|
|
16
17
|
if (!ModalComponent) {
|
|
17
18
|
console.warn(`No modal registered for id: ${modal.id}`);
|
|
18
19
|
return null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","modals","useModalContext","usePatternsWizardOverridesContext","ModalRenderer","modal","closeModal","overrides","id","ModalComponent","console","warn","createElement","_extends","props","onClose"],"sources":["../../../src/components/ModalRenderer.tsx"],"sourcesContent":["import React from 'react';\nimport * as modals from './modals';\nimport { useModalContext } from '../providers/ModalContext';\nimport { usePatternsWizardOverridesContext } from '../providers';\n\nexport const ModalRenderer = () => {\n const { modal, closeModal } = useModalContext();\n const overrides = usePatternsWizardOverridesContext();\n\n if (!modal.id) {\n return null;\n }\n\n const ModalComponent =\n overrides?.modals?.[modal.id] ||\n (modals as Record<string, React.ComponentType<any>>)[modal.id];\n\n if (!ModalComponent) {\n console.warn(`No modal registered for id: ${modal.id}`);\n return null;\n }\n\n return <ModalComponent {...modal.props} onClose={closeModal} />;\n};\n"],"mappings":";AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,OAAO,KAAKC,MAAM,MAAM,UAAU;AAClC,SAASC,eAAe,QAAQ,2BAA2B;AAC3D,SAASC,iCAAiC,QAAQ,cAAc;AAEhE,OAAO,MAAMC,aAAa,GAAGA,CAAA,KAAM;EACjC,MAAM;IAAEC,KAAK;IAAEC;EAAW,CAAC,
|
|
1
|
+
{"version":3,"names":["React","modals","useModalContext","usePatternsWizardOverridesContext","ModalRenderer","_overrides$modals","modal","closeModal","overrides","id","ModalComponent","console","warn","createElement","_extends","props","onClose"],"sources":["../../../src/components/ModalRenderer.tsx"],"sourcesContent":["import React from 'react';\nimport * as modals from './modals';\nimport { useModalContext } from '../providers/ModalContext';\nimport { usePatternsWizardOverridesContext } from '../providers';\n\nexport const ModalRenderer = () => {\n const { modal, closeModal } = useModalContext();\n const overrides = usePatternsWizardOverridesContext();\n\n if (!modal.id) {\n return null;\n }\n\n const ModalComponent =\n overrides?.modals?.[modal.id] ||\n (modals as Record<string, React.ComponentType<any>>)[modal.id];\n\n if (!ModalComponent) {\n console.warn(`No modal registered for id: ${modal.id}`);\n return null;\n }\n\n return <ModalComponent {...modal.props} onClose={closeModal} />;\n};\n"],"mappings":";AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,OAAO,KAAKC,MAAM,MAAM,UAAU;AAClC,SAASC,eAAe,QAAQ,2BAA2B;AAC3D,SAASC,iCAAiC,QAAQ,cAAc;AAEhE,OAAO,MAAMC,aAAa,GAAGA,CAAA,KAAM;EAAA,IAAAC,iBAAA;EACjC,MAAM;IAAEC,KAAK;IAAEC;EAAW,CAAC,GAAGL,eAAe,CAAC,CAAC;EAC/C,MAAMM,SAAS,GAAGL,iCAAiC,CAAC,CAAC;EAErD,IAAI,CAACG,KAAK,CAACG,EAAE,EAAE;IACb,OAAO,IAAI;EACb;EAEA,MAAMC,cAAc,GAClB,CAAAF,SAAS,aAAAH,iBAAA,GAATG,SAAS,CAAEP,MAAM,qBAAjBI,iBAAA,CAAoBC,KAAK,CAACG,EAAE,CAAC,KAC5BR,MAAM,CAA8CK,KAAK,CAACG,EAAE,CAAC;EAEhE,IAAI,CAACC,cAAc,EAAE;IACnBC,OAAO,CAACC,IAAI,CAAC,+BAA+BN,KAAK,CAACG,EAAE,EAAE,CAAC;IACvD,OAAO,IAAI;EACb;EAEA,oBAAOT,KAAA,CAAAa,aAAA,CAACH,cAAc,EAAAI,QAAA,KAAKR,KAAK,CAACS,KAAK;IAAEC,OAAO,EAAET;EAAW,EAAE,CAAC;AACjE,CAAC","ignoreList":[]}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Box, CustomModalLayout, Modal, Text } from '@wix/design-system';
|
|
2
2
|
import React from 'react';
|
|
3
3
|
export const BulkDeleteModal = _ref => {
|
|
4
|
+
var _modalParams$title, _modalParams$actions, _modalParams$actions2, _modalParams$descript;
|
|
4
5
|
let {
|
|
5
6
|
sdk,
|
|
6
7
|
modalParams,
|
|
@@ -16,20 +17,24 @@ export const BulkDeleteModal = _ref => {
|
|
|
16
17
|
isOpen: true,
|
|
17
18
|
onRequestClose: closeModal
|
|
18
19
|
}, /*#__PURE__*/React.createElement(CustomModalLayout, {
|
|
19
|
-
title: modalParams.title
|
|
20
|
+
title: ((_modalParams$title = modalParams.title) == null ? void 0 : _modalParams$title.text) || 'Delete item?',
|
|
20
21
|
theme: "destructive",
|
|
21
22
|
onCloseButtonClick: () => {
|
|
22
23
|
closeModal();
|
|
23
24
|
},
|
|
24
25
|
primaryButtonOnClick: () => {
|
|
26
|
+
var _modalParams$feedback;
|
|
25
27
|
const schema = sdk.getSchema(sdk.collectionId);
|
|
26
28
|
if (!schema) {
|
|
27
29
|
throw new Error('Schema not found');
|
|
28
30
|
}
|
|
29
31
|
const selectedIds = actionParams.selectedValues.map(value => value[schema.idField]);
|
|
30
|
-
optimisticActions
|
|
31
|
-
successToast: modalParams.feedback
|
|
32
|
-
errorToast: () =>
|
|
32
|
+
optimisticActions == null || optimisticActions.deleteMany(actionParams.selectedValues, {
|
|
33
|
+
successToast: ((_modalParams$feedback = modalParams.feedback) == null || (_modalParams$feedback = _modalParams$feedback.successToast) == null ? void 0 : _modalParams$feedback.text) || 'Items deleted successfully',
|
|
34
|
+
errorToast: () => {
|
|
35
|
+
var _modalParams$feedback2;
|
|
36
|
+
return ((_modalParams$feedback2 = modalParams.feedback) == null || (_modalParams$feedback2 = _modalParams$feedback2.errorToast) == null ? void 0 : _modalParams$feedback2.text) || 'Failed to delete items';
|
|
37
|
+
},
|
|
33
38
|
submit: async () => {
|
|
34
39
|
const result = await schema.actions.bulkDelete(selectedIds);
|
|
35
40
|
return [result];
|
|
@@ -40,15 +45,15 @@ export const BulkDeleteModal = _ref => {
|
|
|
40
45
|
secondaryButtonOnClick: () => {
|
|
41
46
|
closeModal();
|
|
42
47
|
},
|
|
43
|
-
primaryButtonText: modalParams.actions
|
|
44
|
-
secondaryButtonText: modalParams.actions
|
|
48
|
+
primaryButtonText: ((_modalParams$actions = modalParams.actions) == null || (_modalParams$actions = _modalParams$actions.submit) == null ? void 0 : _modalParams$actions.text) || 'Save',
|
|
49
|
+
secondaryButtonText: ((_modalParams$actions2 = modalParams.actions) == null || (_modalParams$actions2 = _modalParams$actions2.cancel) == null ? void 0 : _modalParams$actions2.text) || 'Cancel',
|
|
45
50
|
content: /*#__PURE__*/React.createElement(Box, {
|
|
46
51
|
direction: "vertical",
|
|
47
52
|
width: "552px",
|
|
48
53
|
gap: "SP2",
|
|
49
54
|
paddingTop: "SP1",
|
|
50
55
|
paddingBottom: "SP1"
|
|
51
|
-
}, /*#__PURE__*/React.createElement(Box, null, /*#__PURE__*/React.createElement(Text, null, modalParams.description
|
|
56
|
+
}, /*#__PURE__*/React.createElement(Box, null, /*#__PURE__*/React.createElement(Text, null, ((_modalParams$descript = modalParams.description) == null ? void 0 : _modalParams$descript.text) || 'This items will be deleted')))
|
|
52
57
|
}));
|
|
53
58
|
};
|
|
54
59
|
//# sourceMappingURL=BulkDeleteModal.js.map
|