@wix/auto-patterns 1.23.0 → 1.24.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.
Files changed (182) hide show
  1. package/dist/cjs/components/AutoPatternsEntityPage/AutoPatternsEntityPage.js +12 -323
  2. package/dist/cjs/components/AutoPatternsEntityPage/AutoPatternsEntityPage.js.map +1 -1
  3. package/dist/cjs/components/AutoPatternsEntityPage/EditModeEntityPage.js +172 -0
  4. package/dist/cjs/components/AutoPatternsEntityPage/EditModeEntityPage.js.map +1 -0
  5. package/dist/cjs/components/AutoPatternsEntityPage/RenderLayout/RenderLayoutCard.js +78 -0
  6. package/dist/cjs/components/AutoPatternsEntityPage/RenderLayout/RenderLayoutCard.js.map +1 -0
  7. package/dist/cjs/components/AutoPatternsEntityPage/RenderLayout/RenderLayoutContent.js +119 -0
  8. package/dist/cjs/components/AutoPatternsEntityPage/RenderLayout/RenderLayoutContent.js.map +1 -0
  9. package/dist/cjs/components/AutoPatternsEntityPage/RenderLayout/RenderViewField.js +79 -0
  10. package/dist/cjs/components/AutoPatternsEntityPage/RenderLayout/RenderViewField.js.map +1 -0
  11. package/dist/cjs/components/AutoPatternsEntityPage/RenderLayout/index.js +16 -0
  12. package/dist/cjs/components/AutoPatternsEntityPage/RenderLayout/index.js.map +1 -0
  13. package/dist/cjs/components/AutoPatternsEntityPage/ViewEntityPage/RenderViewLayoutCard.js +77 -0
  14. package/dist/cjs/components/AutoPatternsEntityPage/ViewEntityPage/RenderViewLayoutCard.js.map +1 -0
  15. package/dist/cjs/components/AutoPatternsEntityPage/ViewEntityPage/RenderViewLayoutContent.js +109 -0
  16. package/dist/cjs/components/AutoPatternsEntityPage/ViewEntityPage/RenderViewLayoutContent.js.map +1 -0
  17. package/dist/cjs/components/AutoPatternsEntityPage/ViewModeEntityPage.js +196 -0
  18. package/dist/cjs/components/AutoPatternsEntityPage/ViewModeEntityPage.js.map +1 -0
  19. package/dist/cjs/components/AutoPatternsEntityPage/index.js +12 -0
  20. package/dist/cjs/components/AutoPatternsEntityPage/index.js.map +1 -1
  21. package/dist/cjs/hooks/useEntityPageActions.js +105 -0
  22. package/dist/cjs/hooks/useEntityPageActions.js.map +1 -0
  23. package/dist/cjs/hooks/useEntityPageMoreActions.js +10 -0
  24. package/dist/cjs/hooks/useEntityPageMoreActions.js.map +1 -1
  25. package/dist/cjs/hooks/useNavigateEditEntityAction.js +50 -0
  26. package/dist/cjs/hooks/useNavigateEditEntityAction.js.map +1 -0
  27. package/dist/cjs/hooks/useNavigationUtils.js +12 -1
  28. package/dist/cjs/hooks/useNavigationUtils.js.map +1 -1
  29. package/dist/cjs/providers/PatternsWizardOverridesContext.js.map +1 -1
  30. package/dist/cjs/types/EntityPageConfig.js.map +1 -1
  31. package/dist/cjs/types/actions/entityPageActions.js.map +1 -1
  32. package/dist/cjs/utils/actions/types.js.map +1 -1
  33. package/dist/docs/action_cell.md +6 -2
  34. package/dist/docs/app_config_structure.md +49 -4
  35. package/dist/docs/auto-patterns-guide.md +305 -39
  36. package/dist/docs/bulk_actions.md +6 -2
  37. package/dist/docs/collection_page_actions.md +14 -4
  38. package/dist/docs/entity_page.md +65 -1
  39. package/dist/docs/entity_page_actions.md +13 -11
  40. package/dist/docs/entity_page_view_actions.md +137 -0
  41. package/dist/docs/index.md +6 -2
  42. package/dist/docs/pages_configuration.md +1 -11
  43. package/dist/docs/sdk_utilities.md +11 -4
  44. package/dist/docs/wix_fqdn_custom_data_source.md +25 -5
  45. package/dist/esm/components/AutoPatternsCollectionComponent/AutoPatternsCollectionComponent.js +4 -3
  46. package/dist/esm/components/AutoPatternsCollectionComponent/AutoPatternsCollectionComponent.js.map +1 -1
  47. package/dist/esm/components/AutoPatternsCollectionPageContent/AutoPatternsCollectionPageContent.js +2 -1
  48. package/dist/esm/components/AutoPatternsCollectionPageContent/AutoPatternsCollectionPageContent.js.map +1 -1
  49. package/dist/esm/components/AutoPatternsEntityPage/AutoPatternsEntityPage.js +9 -196
  50. package/dist/esm/components/AutoPatternsEntityPage/AutoPatternsEntityPage.js.map +1 -1
  51. package/dist/esm/components/AutoPatternsEntityPage/EditModeEntityPage.js +115 -0
  52. package/dist/esm/components/AutoPatternsEntityPage/EditModeEntityPage.js.map +1 -0
  53. package/dist/esm/components/AutoPatternsEntityPage/Fields/DateInput.js +10 -6
  54. package/dist/esm/components/AutoPatternsEntityPage/Fields/DateInput.js.map +1 -1
  55. package/dist/esm/components/AutoPatternsEntityPage/Fields/DateTime.js +23 -16
  56. package/dist/esm/components/AutoPatternsEntityPage/Fields/DateTime.js.map +1 -1
  57. package/dist/esm/components/AutoPatternsEntityPage/Fields/FormFieldInput.js +3 -2
  58. package/dist/esm/components/AutoPatternsEntityPage/Fields/FormFieldInput.js.map +1 -1
  59. package/dist/esm/components/AutoPatternsEntityPage/Fields/ImageInput.js +9 -6
  60. package/dist/esm/components/AutoPatternsEntityPage/Fields/ImageInput.js.map +1 -1
  61. package/dist/esm/components/AutoPatternsEntityPage/Fields/LongText.js +8 -6
  62. package/dist/esm/components/AutoPatternsEntityPage/Fields/LongText.js.map +1 -1
  63. package/dist/esm/components/AutoPatternsEntityPage/Fields/Number.js +10 -8
  64. package/dist/esm/components/AutoPatternsEntityPage/Fields/Number.js.map +1 -1
  65. package/dist/esm/components/AutoPatternsEntityPage/Fields/ShortText.js +12 -10
  66. package/dist/esm/components/AutoPatternsEntityPage/Fields/ShortText.js.map +1 -1
  67. package/dist/esm/components/AutoPatternsEntityPage/Fields/Url.js +8 -6
  68. package/dist/esm/components/AutoPatternsEntityPage/Fields/Url.js.map +1 -1
  69. package/dist/esm/components/AutoPatternsEntityPage/RenderLayout/RenderLayoutCard.js +33 -0
  70. package/dist/esm/components/AutoPatternsEntityPage/RenderLayout/RenderLayoutCard.js.map +1 -0
  71. package/dist/esm/components/AutoPatternsEntityPage/RenderLayout/RenderLayoutContent.js +70 -0
  72. package/dist/esm/components/AutoPatternsEntityPage/RenderLayout/RenderLayoutContent.js.map +1 -0
  73. package/dist/esm/components/AutoPatternsEntityPage/RenderLayout/RenderViewField.js +48 -0
  74. package/dist/esm/components/AutoPatternsEntityPage/RenderLayout/RenderViewField.js.map +1 -0
  75. package/dist/esm/components/AutoPatternsEntityPage/RenderLayout/index.js +3 -0
  76. package/dist/esm/components/AutoPatternsEntityPage/RenderLayout/index.js.map +1 -0
  77. package/dist/esm/components/AutoPatternsEntityPage/SkeletonEntity.js +7 -4
  78. package/dist/esm/components/AutoPatternsEntityPage/SkeletonEntity.js.map +1 -1
  79. package/dist/esm/components/AutoPatternsEntityPage/ViewEntityPage/RenderViewLayoutCard.js +31 -0
  80. package/dist/esm/components/AutoPatternsEntityPage/ViewEntityPage/RenderViewLayoutCard.js.map +1 -0
  81. package/dist/esm/components/AutoPatternsEntityPage/ViewEntityPage/RenderViewLayoutContent.js +66 -0
  82. package/dist/esm/components/AutoPatternsEntityPage/ViewEntityPage/RenderViewLayoutContent.js.map +1 -0
  83. package/dist/esm/components/AutoPatternsEntityPage/ViewModeEntityPage.js +109 -0
  84. package/dist/esm/components/AutoPatternsEntityPage/ViewModeEntityPage.js.map +1 -0
  85. package/dist/esm/components/AutoPatternsEntityPage/index.js +2 -0
  86. package/dist/esm/components/AutoPatternsEntityPage/index.js.map +1 -1
  87. package/dist/esm/components/ModalRenderer.js +2 -1
  88. package/dist/esm/components/ModalRenderer.js.map +1 -1
  89. package/dist/esm/components/modals/actions/BulkDeleteModal.js +12 -7
  90. package/dist/esm/components/modals/actions/BulkDeleteModal.js.map +1 -1
  91. package/dist/esm/components/modals/actions/CreateModal.js +11 -6
  92. package/dist/esm/components/modals/actions/CreateModal.js.map +1 -1
  93. package/dist/esm/components/modals/actions/EditModal.js +11 -6
  94. package/dist/esm/components/modals/actions/EditModal.js.map +1 -1
  95. package/dist/esm/dataSourceAdapters/cms/cmsAdapter.js +4 -3
  96. package/dist/esm/dataSourceAdapters/cms/cmsAdapter.js.map +1 -1
  97. package/dist/esm/dataSourceAdapters/cms/filterUtils.js +2 -1
  98. package/dist/esm/dataSourceAdapters/cms/filterUtils.js.map +1 -1
  99. package/dist/esm/dataSourceAdapters/cms/sortUtils.js +2 -2
  100. package/dist/esm/dataSourceAdapters/cms/sortUtils.js.map +1 -1
  101. package/dist/esm/hooks/useActionCell.js +12 -8
  102. package/dist/esm/hooks/useActionCell.js.map +1 -1
  103. package/dist/esm/hooks/useBaseTableFeatures.js +2 -1
  104. package/dist/esm/hooks/useBaseTableFeatures.js.map +1 -1
  105. package/dist/esm/hooks/useBulkActionToolbar.js +2 -2
  106. package/dist/esm/hooks/useBulkActionToolbar.js.map +1 -1
  107. package/dist/esm/hooks/useCollectionPageActions.js +3 -3
  108. package/dist/esm/hooks/useCollectionPageActions.js.map +1 -1
  109. package/dist/esm/hooks/useCollectionPageOnRowClickActions.js +1 -1
  110. package/dist/esm/hooks/useCollectionPageOnRowClickActions.js.map +1 -1
  111. package/dist/esm/hooks/useColumns.js +12 -7
  112. package/dist/esm/hooks/useColumns.js.map +1 -1
  113. package/dist/esm/hooks/useCommonCollectionFeatures.js +8 -7
  114. package/dist/esm/hooks/useCommonCollectionFeatures.js.map +1 -1
  115. package/dist/esm/hooks/useEmptyStates.js +6 -5
  116. package/dist/esm/hooks/useEmptyStates.js.map +1 -1
  117. package/dist/esm/hooks/useEntityPageActions.js +82 -0
  118. package/dist/esm/hooks/useEntityPageActions.js.map +1 -0
  119. package/dist/esm/hooks/useEntityPageMoreActions.js +11 -1
  120. package/dist/esm/hooks/useEntityPageMoreActions.js.map +1 -1
  121. package/dist/esm/hooks/useFilters.js +7 -7
  122. package/dist/esm/hooks/useFilters.js.map +1 -1
  123. package/dist/esm/hooks/useNavigateEditEntityAction.js +46 -0
  124. package/dist/esm/hooks/useNavigateEditEntityAction.js.map +1 -0
  125. package/dist/esm/hooks/useNavigationUtils.js +15 -3
  126. package/dist/esm/hooks/useNavigationUtils.js.map +1 -1
  127. package/dist/esm/hooks/usePagePath.js +4 -3
  128. package/dist/esm/hooks/usePagePath.js.map +1 -1
  129. package/dist/esm/hooks/useTableFeatures.js +2 -1
  130. package/dist/esm/hooks/useTableFeatures.js.map +1 -1
  131. package/dist/esm/providers/PatternsWizardOverridesContext.js.map +1 -1
  132. package/dist/esm/providers/SchemaContext.js +3 -2
  133. package/dist/esm/providers/SchemaContext.js.map +1 -1
  134. package/dist/esm/providers/SchemaRegistryContext.js +1 -1
  135. package/dist/esm/providers/SchemaRegistryContext.js.map +1 -1
  136. package/dist/esm/types/EntityPageConfig.js.map +1 -1
  137. package/dist/esm/types/actions/entityPageActions.js.map +1 -1
  138. package/dist/esm/utils/actions/customAction.js +2 -1
  139. package/dist/esm/utils/actions/customAction.js.map +1 -1
  140. package/dist/esm/utils/actions/deleteAction.js +10 -5
  141. package/dist/esm/utils/actions/deleteAction.js.map +1 -1
  142. package/dist/esm/utils/actions/types.js.map +1 -1
  143. package/dist/esm/utils/filterCreators.js +11 -11
  144. package/dist/esm/utils/filterCreators.js.map +1 -1
  145. package/dist/types/components/AutoPatternsEntityPage/AutoPatternsEntityPage.d.ts.map +1 -1
  146. package/dist/types/components/AutoPatternsEntityPage/EditModeEntityPage.d.ts +6 -0
  147. package/dist/types/components/AutoPatternsEntityPage/EditModeEntityPage.d.ts.map +1 -0
  148. package/dist/types/components/AutoPatternsEntityPage/RenderLayout/RenderLayoutCard.d.ts +11 -0
  149. package/dist/types/components/AutoPatternsEntityPage/RenderLayout/RenderLayoutCard.d.ts.map +1 -0
  150. package/dist/types/components/AutoPatternsEntityPage/RenderLayout/RenderLayoutContent.d.ts +13 -0
  151. package/dist/types/components/AutoPatternsEntityPage/RenderLayout/RenderLayoutContent.d.ts.map +1 -0
  152. package/dist/types/components/AutoPatternsEntityPage/RenderLayout/RenderViewField.d.ts +8 -0
  153. package/dist/types/components/AutoPatternsEntityPage/RenderLayout/RenderViewField.d.ts.map +1 -0
  154. package/dist/types/components/AutoPatternsEntityPage/RenderLayout/index.d.ts +3 -0
  155. package/dist/types/components/AutoPatternsEntityPage/RenderLayout/index.d.ts.map +1 -0
  156. package/dist/types/components/AutoPatternsEntityPage/ViewEntityPage/RenderViewLayoutCard.d.ts +8 -0
  157. package/dist/types/components/AutoPatternsEntityPage/ViewEntityPage/RenderViewLayoutCard.d.ts.map +1 -0
  158. package/dist/types/components/AutoPatternsEntityPage/ViewEntityPage/RenderViewLayoutContent.d.ts +8 -0
  159. package/dist/types/components/AutoPatternsEntityPage/ViewEntityPage/RenderViewLayoutContent.d.ts.map +1 -0
  160. package/dist/types/components/AutoPatternsEntityPage/ViewModeEntityPage.d.ts +8 -0
  161. package/dist/types/components/AutoPatternsEntityPage/ViewModeEntityPage.d.ts.map +1 -0
  162. package/dist/types/components/AutoPatternsEntityPage/index.d.ts +2 -0
  163. package/dist/types/components/AutoPatternsEntityPage/index.d.ts.map +1 -1
  164. package/dist/types/hooks/useEntityPageActions.d.ts +9 -0
  165. package/dist/types/hooks/useEntityPageActions.d.ts.map +1 -0
  166. package/dist/types/hooks/useEntityPageHeaderTexts.d.ts.map +1 -1
  167. package/dist/types/hooks/useEntityPageMoreActions.d.ts +2 -2
  168. package/dist/types/hooks/useEntityPageMoreActions.d.ts.map +1 -1
  169. package/dist/types/hooks/useNavigateEditEntityAction.d.ts +6 -0
  170. package/dist/types/hooks/useNavigateEditEntityAction.d.ts.map +1 -0
  171. package/dist/types/hooks/useNavigationUtils.d.ts +1 -0
  172. package/dist/types/hooks/useNavigationUtils.d.ts.map +1 -1
  173. package/dist/types/providers/PatternsWizardOverridesContext.d.ts +2 -2
  174. package/dist/types/providers/PatternsWizardOverridesContext.d.ts.map +1 -1
  175. package/dist/types/types/EntityPageConfig.d.ts +20 -4
  176. package/dist/types/types/EntityPageConfig.d.ts.map +1 -1
  177. package/dist/types/types/actions/entityPageActions.d.ts +24 -5
  178. package/dist/types/types/actions/entityPageActions.d.ts.map +1 -1
  179. package/dist/types/utils/actions/types.d.ts +1 -1
  180. package/dist/types/utils/actions/types.d.ts.map +1 -1
  181. package/package.json +15 -15
  182. 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,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O,IAAI;MACb;MAEA,MAAMC,SAAS,GAAGpB,SAAS,aAAAR,qBAAA,GAATQ,SAAS,CAAEqB,UAAU,qBAArB7B,qBAAA,CAAwBC,OAAO,CAACyB,SAAS,CAACC,WAAW,CAAC;MACxE,IAAI,CAACC,SAAS,EAAE;QACd,OAAO,IAAI;MACb;MAEA,oBACEtC,KAAA,CAAAyB,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":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,IAAI,EAAEC,GAAG,EAAEC,IAAI,QAAQ,oBAAoB;AAEpD,OAAO,MAAMC,eAKX,GAAGC,IAAA,IAAsC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,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,3 @@
1
+ export * from './RenderLayoutCard';
2
+ export * from './RenderLayoutContent';
3
+ //# sourceMappingURL=index.js.map
@@ -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?.length) {
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?.text
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?.main?.map((layout, layoutIndex) => /*#__PURE__*/React.createElement(RenderLayoutCard, {
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?.sidebar ? /*#__PURE__*/React.createElement(EntityPage.AdditionalContent, null, entityPage.layout.sidebar?.map((layout, layoutIndex) => /*#__PURE__*/React.createElement(RenderLayoutCard, {
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,GAAAL,IAAA;EAC1D,QAAQC,OAAO,CAACK,IAAI;IAClB,KAAK,WAAW;MACd,IAAI,CAACL,OAAO,CAACM,SAAS,CAACC,QAAQ,EAAEC,MAAM,EAAE;QACvC,OAAO,IAAI;M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B,WAAW,EAAG;IACxCtB,MAAM,EAAEA,MAAO;IACff,SAAS,EAAC,MAAM;IAChBC,SAAS,EAAEoC;EAAY,CACxB,CACF,CACqB,CAAC,EACxBX,UAAU,CAACX,MAAM,EAAEuB,OAAO,gBACzB9C,KAAA,CAAAe,aAAA,CAAClB,UAAU,CAACkD,iBAAiB,QAC1Bb,UAAU,CAACX,MAAM,CAACuB,OAAO,EAAE7B,GAAG,CAAC,CAACM,MAAM,EAAEsB,WAAW,kBAClD7C,KAAA,CAAAe,aAAA,CAACM,gBAAgB;IACfD,GAAG,EAAE,wBAAwByB,WAAW,EAAG;IAC3CtB,MAAM,EAAEA,MAAO;IACff,SAAS,EAAC,SAAS;IACnBC,SAAS,EAAEoC;EAAY,CACxB,CACF,CAC2B,CAAC,GAC7B,IACc,CACV,CACZ,CAAC;AAEP,CAAC","ignoreList":[]}
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;IAAEC,SAAS;IAAEC,SAAS;IAAEC;EAAa,CAAC,GAAAN,IAAA;EAC1D,QAAQE,OAAO,CAACK,IAAI;IAClB,KAAK,WAAW;MACd,IAAI,GAAAN,qBAAA,GAACC,OAAO,CAACM,SAAS,CAACC,QAAQ,aAA1BR,qBAAA,CAA4BS,MAAM,GAAE;QACvC,OAAO,IAAI;MACb;MAEA,oBACEf,KAAA,CAAAgB,aAAA,CAACd,IAAI;QAACe,IAAI,EAAEV,OAAO,CAACM,SAAS,CAACI;MAAK,gBACjCjB,KAAA,CAAAgB,aAAA,CAACb,MAAM,QACJI,OAAO,CAACM,SAAS,CAACC,QAAQ,CAACI,GAAG,CAAC,CAACC,KAAK,EAAEC,KAAK,kBAC3CpB,KAAA,CAAAgB,aAAA,CAACZ,mBAAmB;QAClBiB,GAAG,EAAE,GAAGZ,SAAS,SAASC,SAAS,YAAYC,YAAY,UAAUH,KAAK,UAAUY,KAAK,EAAG;QAC5Fb,OAAO,EAAEY,KAAM;QACfX,KAAK,EAAEA,KAAK,GAAG,CAAE;QACjBC,SAAS,EAAEA,SAAU;QACrBC,SAAS,EAAEA,SAAU;QACrBC,YAAY,EAAES;MAAM,CACrB,CACF,CACK,CACJ,CAAC;IAGX;MACE,OAAO,IAAI;EACf;AACF,CAAC;AAED,MAAME,gBAIJ,GAAGC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ACM,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
@@ -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;AACtE,SAASC,eAAe,QAAQ,iCAAiC;AAQjE;AACA,OAAO,MAAMC,uBAEZ,GAAGC,IAAA,IAAoE;EAAA,IAAAC,qBAAA,EAAAC,qBAAA;EAAA,IAAnE;IAAEC,MAAM;IAAEC,OAAO;IAAEC,KAAK;IAAEC,SAAS;IAAEC,SAAS;IAAEC;EAAa,CAAC,GAAAR,IAAA;EACjE,MAAMS,MAAM,GAAGb,SAAS,CAAC,CAAC;EAC1B,MAAMc,SAAS,GAAGb,iCAAiC,CAAC,CAAC;EAErD,QAAQO,OAAO,CAACO,IAAI;IAClB,KAAK,OAAO;MACV,IAAI,CAACP,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C,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,109 @@
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
+ title: /*#__PURE__*/React.createElement(Heading, {
75
+ size: "extraLarge"
76
+ }, title),
77
+ subtitle: subtitle,
78
+ showBackButton: true,
79
+ onBackClicked: () => navigateToCollectionPage(configuration.parentPageId),
80
+ actionsBar: /*#__PURE__*/React.createElement(Box, {
81
+ gap: "SP2"
82
+ }, resolvedMoreActions.length > 0 ? /*#__PURE__*/React.createElement(MoreActions, {
83
+ items: resolvedMoreActions
84
+ }) : undefined, actions)
85
+ }), /*#__PURE__*/React.createElement(Page.Content, null, /*#__PURE__*/React.createElement(Layout, null, /*#__PURE__*/React.createElement(Cell, {
86
+ span: pageLayout != null && pageLayout.sidebar ? 8 : 12
87
+ }, /*#__PURE__*/React.createElement(Box, {
88
+ direction: "vertical",
89
+ gap: "SP4"
90
+ }, pageLayout == null || (_pageLayout$main = pageLayout.main) == null ? void 0 : _pageLayout$main.map((layout, layoutIndex) => /*#__PURE__*/React.createElement(RenderViewLayoutCard, {
91
+ key: `main-section-card-${layoutIndex}`,
92
+ entity: entity,
93
+ layout: layout,
94
+ sectionId: "main",
95
+ cardIndex: layoutIndex
96
+ })))), pageLayout != null && pageLayout.sidebar ? /*#__PURE__*/React.createElement(Cell, {
97
+ span: 4
98
+ }, /*#__PURE__*/React.createElement(Box, {
99
+ direction: "vertical",
100
+ gap: "SP4"
101
+ }, (_pageLayout$sidebar = pageLayout.sidebar) == null ? void 0 : _pageLayout$sidebar.map((layout, layoutIndex) => /*#__PURE__*/React.createElement(RenderViewLayoutCard, {
102
+ key: `sidebar-section-card-${layoutIndex}`,
103
+ entity: entity,
104
+ layout: layout,
105
+ sectionId: "sidebar",
106
+ cardIndex: layoutIndex
107
+ })))) : null)));
108
+ };
109
+ //# 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 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 items={resolvedMoreActions} />\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,2BAA2B;AACzD,SAASC,2BAA2B,QAAQ,yCAAyC;AAMrF;AACA,OAAO,MAAMC,kBAAqD,GAAGC,IAAA,IAE/D;EAAA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2 +1,4 @@
1
1
  export * from './AutoPatternsEntityPage';
2
+ export * from './ViewModeEntityPage';
3
+ export * from './RenderLayout';
2
4
  //# sourceMappingURL=index.js.map
@@ -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?.modals?.[modal.id] || modals[modal.id];
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,GAAGJ,eAAe,CAAC,CAAC;EAC/C,MAAMK,SAAS,GAAGJ,iCAAiC,CAAC,CAAC;EAErD,IAAI,CAACE,KAAK,CAACG,EAAE,EAAE;IACb,OAAO,IAAI;EACb;EAEA,MAAMC,cAAc,GAClBF,SAAS,EAAEN,MAAM,GAAGI,KAAK,CAACG,EAAE,CAAC,IAC5BP,MAAM,CAA8CI,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,oBAAOR,KAAA,CAAAY,aAAA,CAACH,cAAc,EAAAI,QAAA,KAAKR,KAAK,CAACS,KAAK;IAAEC,OAAO,EAAET;EAAW,EAAE,CAAC;AACjE,CAAC","ignoreList":[]}
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?.text || 'Delete item?',
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?.deleteMany(actionParams.selectedValues, {
31
- successToast: modalParams.feedback?.successToast?.text || 'Items deleted successfully',
32
- errorToast: () => modalParams.feedback?.errorToast?.text || 'Failed to delete items',
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?.submit?.text || 'Save',
44
- secondaryButtonText: modalParams.actions?.cancel?.text || 'Cancel',
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?.text || 'This items will be deleted')))
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