@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
@@ -11,8 +11,72 @@ All entity pages must have:
11
11
 
12
12
  * Displays details for a **single entity**.
13
13
  * Always tied to a single Wix collection.
14
+ * Supports **two distinct modes**: **view mode** and **edit mode** with separate page configurations.
14
15
 
15
- > The custom actions must be defined inside the `moreActions` array.
16
+ ## Entity Page Modes
17
+
18
+ AutoPatterns supports two entity page modes that can be configured as separate pages:
19
+
20
+ ### Edit Mode (Default)
21
+ - **Purpose**: Allows users to modify entity data
22
+ - **UI**: Uses `@wix/patterns` `EntityPage` component with built-in Save/Cancel actions
23
+ - **Actions**: Only supports `moreActions` (custom actions in the "more" menu)
24
+ - **Default Mode**: When `mode` is not specified, defaults to edit mode
25
+
26
+ ### View Mode
27
+ - **Purpose**: Displays entity data in read-only format with rich action capabilities
28
+ - **Actions**: Supports `primaryActions`, `secondaryActions`, and `moreActions` (collection-style actions)
29
+ - **Mode**: Must be explicitly set with `mode: 'view'`
30
+
31
+
32
+ ## Routing Patterns
33
+
34
+ When implementing both view and edit modes for the same entity, use these routing patterns:
35
+
36
+ - **View Mode**: `/entity/:entityId` (e.g., `/product/:productId`)
37
+ - **Edit Mode**: `/entity/edit/:entityId` (e.g., `/product/edit/:productId`)
38
+
39
+ This pattern allows:
40
+ - Clear distinction between view and edit URLs
41
+ - Natural navigation flow between modes
42
+
43
+ ## View Mode: Purpose and API
44
+
45
+ ### Purpose of View Mode
46
+ View mode is primarily intended for **read-only entity presentation** with rich action capabilities by default; however, it also supports interactive or editable custom components if needed:
47
+
48
+ - **Data Display**: Present entity information in a clean, read-only format
49
+ - **Action Hub**: Provide primary, secondary, and more actions for entity operations
50
+ - **Navigation Center**: Enable seamless transitions to edit mode and other workflows
51
+ - **Rich Content**: Display images, rich text, and complex data types optimally
52
+
53
+
54
+ See [Entity Page View Actions](./entity_page_view_actions.md) for detailed action configuration.
55
+
56
+ #### Out-of-the-Box Features
57
+
58
+ **Automatic Edit Navigation**: When a corresponding edit mode page exists, view mode automatically adds an "Edit [EntityName]" action to the more actions menu.
59
+
60
+ **Back Navigation**: Automatic "Back" button that navigates to the parent collection page.
61
+
62
+ ## Action Configuration
63
+
64
+ Entity page action configuration depends on the mode:
65
+
66
+ - **Edit Mode**: Supports only `moreActions`. See [Entity Page Actions](./entity_page_actions.md)
67
+ - **View Mode**: Supports full action API (`primaryActions`, `secondaryActions`, `moreActions`). See [Entity Page View Actions](./entity_page_view_actions.md)
68
+
69
+ ### Edit Mode Actions
70
+ - **Supported**: `moreActions` only
71
+ - **Built-in**: Save and Cancel actions are automatically provided
72
+ - **Custom Actions**: Must be defined in the `moreActions` array
73
+
74
+ ### View Mode Actions
75
+ - **Supported**: `primaryActions`, `secondaryActions`, and `moreActions`
76
+ - **Pattern**: Follows collection page action patterns
77
+ - **Flexibility**: Full control over all action areas
78
+
79
+ > The custom actions must be defined inside the `moreActions` array for edit mode, but view mode supports actions in all areas.
16
80
 
17
81
  > Note: You do not need to define a custom action to navigate to the entity page. This behavior is built-in — clicking on a row in the collection table automatically navigates to the corresponding entity page.
18
82
 
@@ -1,8 +1,10 @@
1
- ## Entity Page Actions: `moreActions` Support
1
+ ## Entity Page Edit Mode Actions: `moreActions` Support
2
2
 
3
- Entity pages in AutoPatternsApp support not only a primary action (such as "Save" or "Delete") but also a flexible set of **more actions** (sometimes called "secondary actions" or `moreActions`). These allow you to provide additional contextual actions for the entity, such as custom logic, or grouped actions.
3
+ Entity pages in **edit mode** support not only built-in actions (such as "Save" and "Cancel") but also a flexible set of **more actions** (sometimes called "secondary actions" or `moreActions`). These allow you to provide additional contextual actions for the entity, such as custom logic, or grouped actions.
4
4
 
5
- > **Note:** All custom actions for entity pages must be placed in the `moreActions` array. Do not place custom actions as primary actions on entity pages. The `moreActions` array is the only supported location for custom actions on entity pages.
5
+ > **Note:** This documentation covers **edit mode** entity pages only. Edit mode supports only `moreActions`. For **view mode** entity pages that support `primaryActions`, `secondaryActions`, and `moreActions`, see [Entity Page View Actions](./entity_page_view_actions.md).
6
+
7
+ > **Edit Mode Limitation:** All custom actions for edit mode entity pages must be placed in the `moreActions` array. Do not place custom actions as primary actions on edit mode entity pages. The `moreActions` array is the only supported location for custom actions on edit mode entity pages.
6
8
 
7
9
  ### Configuration Structure
8
10
 
@@ -39,16 +41,16 @@ Entity pages in AutoPatternsApp support not only a primary action (such as "Save
39
41
 
40
42
  ---
41
43
 
42
- ### CustomEntityPageMoreActionsActionResolver
44
+ ### CustomEntityPageActionResolver
43
45
 
44
- The `CustomEntityPageMoreActionsActionResolver` type is used to implement custom actions for the `moreActions` menu on entity pages in AutoPatternsApp. Each action in the `moreActions` array must have a corresponding resolver function registered in your overrides.
46
+ The `CustomEntityPageActionResolver` type is used to implement custom actions for the `moreActions` menu on entity pages in AutoPatternsApp. Each action in the `moreActions` array must have a corresponding resolver function registered in your overrides.
45
47
 
46
48
  #### Function Signature
47
49
 
48
50
  ```typescript
49
- import { CustomEntityPageMoreActionsActionResolver } from '@wix/auto-patterns/types';
51
+ import { CustomEntityPageActionResolver } from '@wix/auto-patterns/types';
50
52
 
51
- export const myMoreAction: CustomEntityPageMoreActionsActionResolver = (params) => {
53
+ export const myMoreAction: CustomEntityPageActionResolver = (params) => {
52
54
  const { actionParams: { entity, form } , sdk } = params;
53
55
 
54
56
  return {
@@ -67,10 +69,10 @@ export const myMoreAction: CustomEntityPageMoreActionsActionResolver = (params)
67
69
 
68
70
  ---
69
71
 
70
- #### Key Points for CustomEntityPageMoreActionsActionResolver
72
+ #### Key Points for CustomEntityPageActionResolver
71
73
 
72
74
  - The action `id` in the configuration MUST exactly match the function name exported from your actions folder.
73
- - The implementation must use the `CustomEntityPageMoreActionsActionResolver` type.
75
+ - The implementation must use the `CustomEntityPageActionResolver` type.
74
76
  - The implementation must be exported as a named export (not default export).
75
77
  - The function receives `{ actionParams, sdk }` as parameters.
76
78
  - The returned object must include at least a `label` and an `onClick` handler (optionally an `icon`).
@@ -83,10 +85,10 @@ export const myMoreAction: CustomEntityPageMoreActionsActionResolver = (params)
83
85
  ✓ Each action type only includes its required field(s)
84
86
  ✓ Custom actions match implementations in overrides
85
87
  ✓ The resolver is exported and registered in the `actions` property of your `PatternsWizardOverridesProvider`
86
- ✓ The function signature matches `CustomEntityPageMoreActionsActionResolver`
88
+ ✓ The function signature matches `CustomEntityPageActionResolver`
87
89
  ✓ The returned object includes `label`, `onClick`, and optionally `icon`
88
90
 
89
91
  ---
90
92
 
91
93
  **Summary:**
92
- The `CustomEntityPageMoreActionsActionResolver` enables you to add custom, contextual actions to the "More Actions" menu on your entity pages. Implement the resolver, export it, and reference it by `id` in your config for seamless integration.
94
+ The `CustomEntityPageActionResolver` enables you to add custom, contextual actions to the "More Actions" menu on your entity pages. Implement the resolver, export it, and reference it by `id` in your config for seamless integration.
@@ -0,0 +1,137 @@
1
+ # Entity Page View Mode Actions
2
+
3
+ View mode supports the complete collection-style actions API, providing maximum flexibility for entity operations.
4
+
5
+ ## Supported Action Types
6
+
7
+ ### Primary Actions
8
+ The main call-to-action, typically for the most common operation:
9
+
10
+ ```typescript
11
+ primaryActions: {
12
+ type: 'action',
13
+ action: {
14
+ item: {
15
+ id: 'createEntity',
16
+ label: 'Create New',
17
+ type: 'create',
18
+ create: {
19
+ mode: 'page',
20
+ page: { id: 'EntityEditPageId' }
21
+ }
22
+ }
23
+ }
24
+ }
25
+ ```
26
+
27
+ ### Secondary Actions
28
+ Supporting actions displayed alongside primary actions:
29
+
30
+ ```typescript
31
+ secondaryActions: {
32
+ type: 'action',
33
+ action: {
34
+ item: {
35
+ id: 'duplicateEntity',
36
+ label: 'Duplicate',
37
+ type: 'custom',
38
+ }
39
+ }
40
+ }
41
+ ```
42
+
43
+ ### More Actions
44
+ Additional contextual actions in dropdown menu:
45
+
46
+ ```typescript
47
+ moreActions: [
48
+ {
49
+ id: 'shareEntity',
50
+ type: 'custom',
51
+ label: 'Share',
52
+ }
53
+ ]
54
+ ```
55
+
56
+ ## Action Menu Support
57
+
58
+ View mode also supports menu-style actions for grouping related operations:
59
+
60
+ ```typescript
61
+ primaryActions: {
62
+ type: 'menu',
63
+ menu: {
64
+ label: 'Actions',
65
+ items: [
66
+ {
67
+ id: 'duplicateProduct',
68
+ label: 'Duplicate',
69
+ type: 'custom',
70
+ },
71
+ { type: 'divider' },
72
+ {
73
+ id: 'shareProduct',
74
+ type: 'custom',
75
+ label: 'Share'
76
+ }
77
+ ]
78
+ }
79
+ }
80
+ ```
81
+
82
+ ## Automatic Edit Action
83
+
84
+ View mode automatically provides an "Edit [EntityName]" action in the more actions menu when:
85
+ - An edit mode page exists for the same collection
86
+ - The edit page has no explicit mode or `mode: 'edit'`
87
+ - The view page has `mode: 'view'`
88
+
89
+ This action is automatically added and doesn't need to be configured manually.
90
+
91
+ ## Action Resolvers
92
+
93
+ View mode actions follow the same resolver patterns as collection page actions:
94
+
95
+ ### For Standard Actions (create)
96
+ These actions are handled automatically by the AutoPatterns framework using the configuration provided.
97
+
98
+ ### For Custom Actions
99
+ Custom actions require resolver implementations:
100
+
101
+ ```typescript
102
+ import { CustomEntityPageActionResolver } from '@wix/auto-patterns/types';
103
+
104
+ export const duplicateProduct: CustomEntityPageActionResolver = (params) => {
105
+ const { actionParams: { entity }, sdk } = params;
106
+
107
+ const schema = sdk.getSchema(sdk.collectionId);
108
+ return {
109
+ label: 'Duplicate Product',
110
+ icon: <DuplicateIcon />, // optional
111
+ onClick: async () => {
112
+ // Your custom duplication logic here
113
+ await schema.actions.create({
114
+ ...entity,
115
+ name: `${entity.name} (Copy)`
116
+ });
117
+ },
118
+ };
119
+ };
120
+ ```
121
+
122
+ ## Best Practices
123
+
124
+ ### When to Use Each Action Type
125
+
126
+ **Primary Actions**: Use for the most common user action (typically "Create" or main workflow action)
127
+
128
+ **Secondary Actions**: Use for supporting workflows like "Duplicate"
129
+
130
+ **More Actions**: Use for:
131
+ - Less common operations
132
+ - Administrative functions
133
+ - Actions that need confirmation
134
+
135
+ ### Navigation Patterns
136
+
137
+ 1. **View → Create**: Use primary actions with `type: 'create'`
@@ -43,8 +43,12 @@ This index maps user requests to the appropriate section IDs for fetching releva
43
43
  **Keywords**: entity page layout, detail page configuration, field arrangement, layout structure, grid system, column spans, main/sidebar sections, field grouping, container usage, custom components, 12-column grid
44
44
 
45
45
  ### ID: `entity_page_actions`
46
- **Topics**: Entity page actions, moreActions, custom entity actions
47
- **Keywords**: entity page actions, detail page operations, moreActions, secondary actions, custom entity actions, entity-specific operations, action menus
46
+ **Topics**: Entity page edit mode actions, moreActions, custom entity actions
47
+ **Keywords**: entity page actions, edit mode actions, moreActions, custom entity actions, entity-specific operations, action menus
48
+
49
+ ### ID: `entity_page_view_actions`
50
+ **Topics**: Entity page view mode actions, primaryActions, secondaryActions, collection-style actions
51
+ **Keywords**: view mode actions, primaryActions, secondaryActions, read-only entity actions, entity page view operations, collection-style entity actions, navigation actions
48
52
 
49
53
  ### ID: `installation`
50
54
  **Topics**: Package installation, setup process, component integration, provider setup
@@ -5,7 +5,6 @@
5
5
  - **Pages array must contain exactly two pages** - one collectionPage and one entityPage
6
6
  - **Exactly one page must have `appMainPage: true`** to designate it as the main page
7
7
  - **All page IDs referenced in relationships must exist in the configuration** - validate all `parentPageId` and `entityPageId` references
8
- - **Bind `type` strictly to matching fields** - if `type: 'collectionPage'`, only `collectionPage` field exists (no `entityPage` field), and vice versa
9
8
 
10
9
  ## Default Generation
11
10
 
@@ -18,12 +17,6 @@
18
17
  * The route path **must** include a descriptive segment (e.g., `/product/:entityId`, `/pet/:entityId`)
19
18
  * **Never use just `/:entityId`** - this conflicts with the collection page route and breaks routing
20
19
 
21
- ## Type and Structure Binding
22
-
23
- * If `type: 'collectionPage'`, then **only** `collectionPage` field exists (no `entityPage` field).
24
- * If `type: 'entityPage'`, then **only** `entityPage` field exists (no `collectionPage` field).
25
- * **No cross-mixing** allowed.
26
-
27
20
  ## Page Connection Configuration
28
21
 
29
22
  ### Main Page Designation
@@ -88,11 +81,8 @@ A two-way connection must be established between collection pages and entity pag
88
81
  * **Route Structure**: Entity pages must use `/[segment]/:entityId` format (e.g., `/product/:entityId` or `/pets/:entityId`), never just `/:entityId`
89
82
  * **Route Parameters Configuration**: All entity pages must have both a dynamic parameter in `route.path` and a matching configuration in `route.params`
90
83
 
91
- ## ⚠️ Common Type and Route Mistakes to Avoid
84
+ ## ⚠️ Common Route and Configuration Mistakes to Avoid
92
85
 
93
- - Using incorrect field types
94
- - Missing required fields
95
- - Including fields from wrong page type
96
86
  - Missing route.params for entity pages
97
87
  - Using `/:entityId` instead of `/segment/:entityId` for entity page routes (causes routing conflicts)
98
88
 
@@ -48,9 +48,15 @@ const optimisticActions = sdk.getOptimisticActions(sdk.collectionId);
48
48
  const schema = sdk.getSchema(sdk.collectionId);
49
49
 
50
50
  optimisticActions.operation(items, {
51
- submit: async (items) => schema.actions.serverMethod(items),
51
+ submit: async (items) => {
52
+ // Handle potential undefined schema
53
+ if (schema) {
54
+ return await schema.actions.serverMethod(items);
55
+ }
56
+ return items; // fallback when schema is unavailable
57
+ },
52
58
  successToast: 'Success message',
53
- errorToast: (err, {retry}) => ({ text: 'Error message', action: { text: 'Retry', onClick: retry }})
59
+ errorToast: (err, {retry}) => ({ message: 'Error message', action: { text: 'Retry', onClick: retry }})
54
60
  });
55
61
  ```
56
62
 
@@ -81,7 +87,7 @@ interface OptimisticParams<T> {
81
87
  }
82
88
 
83
89
  interface ToastConfig {
84
- text: string;
90
+ message: string; // Note: Use 'message' property, not 'text'
85
91
  action?: { text: string; onClick: () => void };
86
92
  }
87
93
  ```
@@ -90,8 +96,9 @@ interface ToastConfig {
90
96
 
91
97
  **Before using optimistic actions:**
92
98
  - Verify `sdk.getOptimisticActions(collectionId)` returns valid instance
93
- - Verify `sdk.getSchema(collectionId)` returns valid schema
99
+ - **Always check for undefined schema**: `sdk.getSchema(collectionId)` can return `undefined` - handle this case in your submit functions
94
100
  - For delete operations: `showUndoToast: true` is mandatory
95
101
  - All `submit` functions must return a Promise
102
+ - **Toast property**: Use `message` property in ToastConfig, not `text`
96
103
 
97
104
  **SDK Parameter:** Available in custom actions and modals. See SDK Utilities section for complete interface.
@@ -1,26 +1,41 @@
1
1
  # FQDN-Based Custom Data Source Implementation
2
2
 
3
+ **🛑 CRITICAL PREREQUISITE**: This guide explains a specialized feature that exists within the broader auto-patterns framework. You **CANNOT** implement this guide without first having the complete content of the WixAutoPatternsGuide.
4
+
5
+ **📋 MANDATORY FIRST STEP**: Before proceeding with this FQDN-specific implementation:
6
+ 1. **You MUST call the `WixAutoPatternsGuide` tool first** to get the foundational auto-patterns knowledge
7
+ 2. **This document is NOT standalone** - it's an advanced feature guide that builds upon the core auto-patterns concepts
8
+ 3. **Without the WixAutoPatternsGuide content**, you will not understand the basic concepts, component structure, or implementation patterns required for this FQDN implementation
9
+
3
10
  When implementing a custom data source based on a Wix Business API FQDN, you'll need to understand several key concepts and follow specific implementation patterns. This guide covers the complete process from schema extraction to creating a foundation structure that **you will need to complete**.
4
11
 
5
12
  **⚠️ IMPORTANT**: This guide creates a foundation with helpful comments and unimplemented actions that throw exceptions. The actual data source implementation (CRUD operations) must be completed by you using the appropriate Wix Business API client library.
6
13
 
7
14
  **📝 MINIMAL IMPLEMENTATION APPROACH**: This guide focuses on creating a basic, functional dashboard page. Custom overrides (actions, columns, components, etc.) should only be implemented when explicitly requested by the user. A simple dashboard page requires only the core custom data source implementation without any additional overrides.
8
15
 
9
- ## Prerequisites: Required Tools
16
+ ## Prerequisites: Required Tools and Knowledge
17
+
18
+ **🛑 ABSOLUTE REQUIREMENT - WixAutoPatternsGuide Content**:
19
+ - **You MUST have the complete WixAutoPatternsGuide content** before starting this implementation
20
+ - **This FQDN guide is NOT self-contained** - it's a specialized extension of the main auto-patterns guide
21
+ - **If you haven't called the `WixAutoPatternsGuide` tool yet**, stop now and call it first
22
+ - **This guide will reference concepts, components, and patterns** that are only explained in the main guide
10
23
 
11
24
  **🛑 CRITICAL**: Before proceeding with this guide, you must have the following tools available:
12
- - `WixPatternsGuide` tool for understanding auto-patterns fundamentals and implementation patterns
25
+ - `WixAutoPatternsGuide` tool for understanding auto-patterns fundamentals and implementation patterns (**MANDATORY FIRST STEP**)
13
26
  - `fqdn_schema` tool for extracting schema information from FQDNs
14
27
  - `client_lib` tool for determining the correct client library package
15
28
 
16
29
  **If these tools are not available, you CANNOT continue with this guide.**
17
30
 
18
31
  **Auto-Patterns Context Requirement:**
19
- If you haven't already used the `WixPatternsGuide` tool in this conversation, you MUST call it first to understand:
32
+ If you haven't already used the `WixAutoPatternsGuide` tool in this conversation, you MUST call it first to understand:
20
33
  - How AutoPatternsApp works
21
34
  - AppConfig structure and requirements
22
35
  - Custom data source implementation patterns
23
36
  - Best practices for auto-patterns development
37
+ - Basic component structure and routing
38
+ - Provider setup and configuration
24
39
 
25
40
  **Without this foundational knowledge, you cannot successfully implement FQDN-based custom data sources.**
26
41
 
@@ -65,7 +80,10 @@ This will tell you which library to import for your custom data source implement
65
80
 
66
81
  Transform the FQDN schema from Step 1 into a AutoPatterns-compatible SchemaConfig by mapping the FQDN field types to AutoPatterns field types. Identify appropriate fields for `displayField` and `idField` based on your FQDN schema.
67
82
 
68
- **Note**: When implementing a custom data source, you can leave `supportedQueryOperators` empty (`supportedQueryOperators: []`) even if you know the supported operators. This is because the custom data source will handle all query operations directly through your implementation.
83
+ **🛑 MANDATORY - Query Operators Must Be Empty Array**: When implementing a custom data source, you **MUST** set `supportedQueryOperators: []` (empty array) for all fields. This is required because:
84
+ - Custom data sources handle all query operations directly through your implementation
85
+ - You don't need to specify individual operators for each field
86
+ - The custom data source `find` action will receive all queries regardless of declared operators
69
87
 
70
88
  ### ⚠️ CRITICAL: Field ID Conversion from snake_case to camelCase
71
89
 
@@ -112,7 +130,7 @@ export const myCustomDataSource = async (collectionId: string, context: any) =>
112
130
  // Field definitions based on your FQDN schema mapping
113
131
  },
114
132
  displayField: 'name',
115
- idField: '_id',
133
+ idField: 'id',
116
134
  actions: {
117
135
  get: async (entityId: string) => {
118
136
  // TODO: Implement using your FQDN client library
@@ -218,6 +236,7 @@ If the user specifically requests custom actions for your FQDN-based data source
218
236
  ✅ **Schema Extraction**: Used fqdn_schema tool to understand entity structure
219
237
  ✅ **Client Library**: Used client_lib tool to identify correct SDK package
220
238
  ✅ **Field Mapping**: Mapped FQDN field types to AutoPatterns field types
239
+ ✅ **🛑 MANDATORY: Empty Query Operators**: Set `supportedQueryOperators: []` for ALL fields to avoid TypeScript errors
221
240
  ✅ **⚠️ CRITICAL: Field ID Conversion**: Converted individual field segments from snake_case to camelCase while preserving field path structure in SchemaConfig and AppConfig
222
241
  ✅ **AppConfig Update**: Set `entityTypeSource: "custom"` and provided custom.id
223
242
  ✅ **Custom Data Source Structure**: Followed "Custom Overrides" section for folder structure and registration
@@ -235,6 +254,7 @@ If the user specifically requests custom actions for your FQDN-based data source
235
254
  - **⚠️ CRITICAL: Implementing Unnecessary Overrides**: Do NOT implement custom actions, column overrides, or custom components unless explicitly requested by the user - a basic dashboard page only needs the core custom data source
236
255
  - **⚠️ CRITICAL: Inconsistent Field ID Casing**: Failing to convert individual field segments from snake_case to camelCase while preserving field path structure in SchemaConfig and AppConfig - this is the most common mistake and will cause field mapping failures
237
256
  - **⚠️ CRITICAL: Implementing Actions**: DO NOT implement the schema actions - they should contain helpful comments and throw unimplemented exceptions for the user to complete
257
+ - **🛑 CRITICAL: Query Operators MUST Be Empty Array**: You **MUST** use `supportedQueryOperators: []` (empty array) for all fields - attempting to specify actual operators will cause TypeScript compilation errors and is not supported for custom data sources
238
258
  - **Mismatched Field Types**: Ensure FQDN field types are correctly mapped to AutoPatterns types
239
259
  - **Wrong Client Library**: Use the exact client library returned by the client_lib tool
240
260
  - **ID Field Confusion**: Ensure the idField matches what your FQDN API actually uses (often `_id` for Wix APIs)
@@ -14,14 +14,15 @@ export const AutoPatternsCollectionComponent = _ref => {
14
14
  ...sharedConfig
15
15
  } = component;
16
16
  const memoized = useMemo(() => {
17
- if (!layout?.length) {
17
+ var _layout$find, _layout$find2;
18
+ if (!(layout != null && layout.length)) {
18
19
  return {
19
20
  componentToRender: null,
20
21
  componentType: 'Table'
21
22
  };
22
23
  }
23
- const tableConfig = layout.find(item => item.type === 'Table')?.table;
24
- const gridConfig = layout.find(item => item.type === 'Grid')?.grid;
24
+ const tableConfig = (_layout$find = layout.find(item => item.type === 'Table')) == null ? void 0 : _layout$find.table;
25
+ const gridConfig = (_layout$find2 = layout.find(item => item.type === 'Grid')) == null ? void 0 : _layout$find2.grid;
25
26
  let componentType = 'Table';
26
27
  let componentToRender = null;
27
28
  if (tableConfig && gridConfig) {
@@ -1 +1 @@
1
- {"version":3,"names":["AutoPatternsTableGridSwitch","AutoPatternsTable","AutoPatternsGrid","SchemaProvider","SkeletonCollection","React","useMemo","AutoPatternsCollectionComponent","_ref","component","index","layout","sharedConfig","memoized","length","componentToRender","componentType","tableConfig","find","item","type","table","gridConfig","grid","config","createElement","configuration","Fragment","key","collection","collectionId","skeleton"],"sources":["../../../../src/components/AutoPatternsCollectionComponent/AutoPatternsCollectionComponent.tsx"],"sourcesContent":["import { CollectionComponentConfig } from '../../types';\nimport { AutoPatternsTableGridSwitch } from '../AutoPatternsTableGridSwitch/AutoPatternsTableGridSwitch';\nimport { AutoPatternsTable } from '../AutoPatternsTable';\nimport { AutoPatternsGrid } from '../AutoPatternsGrid';\nimport { SchemaProvider } from '../../providers';\nimport { SkeletonCollection } from '../AutoPatternsCollectionPageContent/SkeletonCollection';\nimport React, { useMemo } from 'react';\n\nexport const AutoPatternsCollectionComponent = ({\n component,\n index,\n}: {\n component: CollectionComponentConfig;\n index: number;\n}) => {\n const { layout, ...sharedConfig } = component;\n\n const memoized = useMemo(() => {\n if (!layout?.length) {\n return {\n componentToRender: null,\n componentType: 'Table' as 'Table' | 'Grid',\n };\n }\n\n const tableConfig = layout.find((item) => item.type === 'Table')?.table;\n const gridConfig = layout.find((item) => item.type === 'Grid')?.grid;\n\n let componentType: 'Table' | 'Grid' = 'Table';\n let componentToRender: React.ReactNode = null;\n\n if (tableConfig && gridConfig) {\n const config = {\n ...sharedConfig,\n ...tableConfig,\n ...gridConfig,\n };\n componentToRender = (\n <AutoPatternsTableGridSwitch configuration={config} />\n );\n } else if (tableConfig) {\n const config = { ...sharedConfig, ...tableConfig };\n componentToRender = <AutoPatternsTable configuration={config} />;\n } else if (gridConfig) {\n componentType = 'Grid';\n const config = { ...sharedConfig, ...gridConfig };\n componentToRender = <AutoPatternsGrid configuration={config} />;\n }\n\n return { componentToRender, componentType };\n }, [layout, sharedConfig]);\n\n const { componentToRender, componentType } = memoized;\n\n return (\n <>\n {componentToRender ? (\n <SchemaProvider\n key={`${sharedConfig.collection.collectionId}-${index}`}\n collection={sharedConfig.collection}\n skeleton={<SkeletonCollection componentType={componentType} />}\n >\n {componentToRender}\n </SchemaProvider>\n ) : null}\n </>\n );\n};\n"],"mappings":"AACA,SAASA,2BAA2B,QAAQ,4DAA4D;AACxG,SAASC,iBAAiB,QAAQ,sBAAsB;AACxD,SAASC,gBAAgB,QAAQ,qBAAqB;AACtD,SAASC,cAAc,QAAQ,iBAAiB;AAChD,SAASC,kBAAkB,QAAQ,yDAAyD;AAC5F,OAAOC,KAAK,IAAIC,OAAO,QAAQ,OAAO;AAEtC,OAAO,MAAMC,+BAA+B,GAAGC,IAAA,IAMzC;EAAA,IAN0C;IAC9CC,SAAS;IACTC;EAIF,CAAC,GAAAF,IAAA;EACC,MAAM;IAAEG,MAAM;IAAE,GAAGC;EAAa,CAAC,GAAGH,SAAS;EAE7C,MAAMI,QAAQ,GAAGP,OAAO,CAAC,MAAM;IAC7B,IAAI,CAACK,MAAM,EAAEG,MAAM,EAAE;MACnB,OAAO;QACLC,iBAAiB,EAAE,IAAI;QACvBC,aAAa,EAAE;MACjB,CAAC;IACH;IAEA,MAAMC,WAAW,GAAGN,MAAM,CAACO,IAAI,CAAEC,IAAI,IAAKA,IAAI,CAACC,IAAI,KAAK,OAAO,CAAC,EAAEC,KAAK;IACvE,MAAMC,UAAU,GAAGX,MAAM,CAACO,IAAI,CAAEC,IAAI,IAAKA,IAAI,CAACC,IAAI,KAAK,MAAM,CAAC,EAAEG,IAAI;IAEpE,IAAIP,aAA+B,GAAG,OAAO;IAC7C,IAAID,iBAAkC,GAAG,IAAI;IAE7C,IAAIE,WAAW,IAAIK,UAAU,EAAE;MAC7B,MAAME,MAAM,GAAG;QACb,GAAGZ,YAAY;QACf,GAAGK,WAAW;QACd,GAAGK;MACL,CAAC;MACDP,iBAAiB,gBACfV,KAAA,CAAAoB,aAAA,CAACzB,2BAA2B;QAAC0B,aAAa,EAAEF;MAAO,CAAE,CACtD;IACH,CAAC,MAAM,IAAIP,WAAW,EAAE;MACtB,MAAMO,MAAM,GAAG;QAAE,GAAGZ,YAAY;QAAE,GAAGK;MAAY,CAAC;MAClDF,iBAAiB,gBAAGV,KAAA,CAAAoB,aAAA,CAACxB,iBAAiB;QAACyB,aAAa,EAAEF;MAAO,CAAE,CAAC;IAClE,CAAC,MAAM,IAAIF,UAAU,EAAE;MACrBN,aAAa,GAAG,MAAM;MACtB,MAAMQ,MAAM,GAAG;QAAE,GAAGZ,YAAY;QAAE,GAAGU;MAAW,CAAC;MACjDP,iBAAiB,gBAAGV,KAAA,CAAAoB,aAAA,CAACvB,gBAAgB;QAACwB,aAAa,EAAEF;MAAO,CAAE,CAAC;IACjE;IAEA,OAAO;MAAET,iBAAiB;MAAEC;IAAc,CAAC;EAC7C,CAAC,EAAE,CAACL,MAAM,EAAEC,YAAY,CAAC,CAAC;EAE1B,MAAM;IAAEG,iBAAiB;IAAEC;EAAc,CAAC,GAAGH,QAAQ;EAErD,oBACER,KAAA,CAAAoB,aAAA,CAAApB,KAAA,CAAAsB,QAAA,QACGZ,iBAAiB,gBAChBV,KAAA,CAAAoB,aAAA,CAACtB,cAAc;IACbyB,GAAG,EAAE,GAAGhB,YAAY,CAACiB,UAAU,CAACC,YAAY,IAAIpB,KAAK,EAAG;IACxDmB,UAAU,EAAEjB,YAAY,CAACiB,UAAW;IACpCE,QAAQ,eAAE1B,KAAA,CAAAoB,aAAA,CAACrB,kBAAkB;MAACY,aAAa,EAAEA;IAAc,CAAE;EAAE,GAE9DD,iBACa,CAAC,GACf,IACJ,CAAC;AAEP,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["AutoPatternsTableGridSwitch","AutoPatternsTable","AutoPatternsGrid","SchemaProvider","SkeletonCollection","React","useMemo","AutoPatternsCollectionComponent","_ref","component","index","layout","sharedConfig","memoized","_layout$find","_layout$find2","length","componentToRender","componentType","tableConfig","find","item","type","table","gridConfig","grid","config","createElement","configuration","Fragment","key","collection","collectionId","skeleton"],"sources":["../../../../src/components/AutoPatternsCollectionComponent/AutoPatternsCollectionComponent.tsx"],"sourcesContent":["import { CollectionComponentConfig } from '../../types';\nimport { AutoPatternsTableGridSwitch } from '../AutoPatternsTableGridSwitch/AutoPatternsTableGridSwitch';\nimport { AutoPatternsTable } from '../AutoPatternsTable';\nimport { AutoPatternsGrid } from '../AutoPatternsGrid';\nimport { SchemaProvider } from '../../providers';\nimport { SkeletonCollection } from '../AutoPatternsCollectionPageContent/SkeletonCollection';\nimport React, { useMemo } from 'react';\n\nexport const AutoPatternsCollectionComponent = ({\n component,\n index,\n}: {\n component: CollectionComponentConfig;\n index: number;\n}) => {\n const { layout, ...sharedConfig } = component;\n\n const memoized = useMemo(() => {\n if (!layout?.length) {\n return {\n componentToRender: null,\n componentType: 'Table' as 'Table' | 'Grid',\n };\n }\n\n const tableConfig = layout.find((item) => item.type === 'Table')?.table;\n const gridConfig = layout.find((item) => item.type === 'Grid')?.grid;\n\n let componentType: 'Table' | 'Grid' = 'Table';\n let componentToRender: React.ReactNode = null;\n\n if (tableConfig && gridConfig) {\n const config = {\n ...sharedConfig,\n ...tableConfig,\n ...gridConfig,\n };\n componentToRender = (\n <AutoPatternsTableGridSwitch configuration={config} />\n );\n } else if (tableConfig) {\n const config = { ...sharedConfig, ...tableConfig };\n componentToRender = <AutoPatternsTable configuration={config} />;\n } else if (gridConfig) {\n componentType = 'Grid';\n const config = { ...sharedConfig, ...gridConfig };\n componentToRender = <AutoPatternsGrid configuration={config} />;\n }\n\n return { componentToRender, componentType };\n }, [layout, sharedConfig]);\n\n const { componentToRender, componentType } = memoized;\n\n return (\n <>\n {componentToRender ? (\n <SchemaProvider\n key={`${sharedConfig.collection.collectionId}-${index}`}\n collection={sharedConfig.collection}\n skeleton={<SkeletonCollection componentType={componentType} />}\n >\n {componentToRender}\n </SchemaProvider>\n ) : null}\n </>\n );\n};\n"],"mappings":"AACA,SAASA,2BAA2B,QAAQ,4DAA4D;AACxG,SAASC,iBAAiB,QAAQ,sBAAsB;AACxD,SAASC,gBAAgB,QAAQ,qBAAqB;AACtD,SAASC,cAAc,QAAQ,iBAAiB;AAChD,SAASC,kBAAkB,QAAQ,yDAAyD;AAC5F,OAAOC,KAAK,IAAIC,OAAO,QAAQ,OAAO;AAEtC,OAAO,MAAMC,+BAA+B,GAAGC,IAAA,IAMzC;EAAA,IAN0C;IAC9CC,SAAS;IACTC;EAIF,CAAC,GAAAF,IAAA;EACC,MAAM;IAAEG,MAAM;IAAE,GAAGC;EAAa,CAAC,GAAGH,SAAS;EAE7C,MAAMI,QAAQ,GAAGP,OAAO,CAAC,MAAM;IAAA,IAAAQ,YAAA,EAAAC,aAAA;IAC7B,IAAI,EAACJ,MAAM,YAANA,MAAM,CAAEK,MAAM,GAAE;MACnB,OAAO;QACLC,iBAAiB,EAAE,IAAI;QACvBC,aAAa,EAAE;MACjB,CAAC;IACH;IAEA,MAAMC,WAAW,IAAAL,YAAA,GAAGH,MAAM,CAACS,IAAI,CAAEC,IAAI,IAAKA,IAAI,CAACC,IAAI,KAAK,OAAO,CAAC,qBAA5CR,YAAA,CAA8CS,KAAK;IACvE,MAAMC,UAAU,IAAAT,aAAA,GAAGJ,MAAM,CAACS,IAAI,CAAEC,IAAI,IAAKA,IAAI,CAACC,IAAI,KAAK,MAAM,CAAC,qBAA3CP,aAAA,CAA6CU,IAAI;IAEpE,IAAIP,aAA+B,GAAG,OAAO;IAC7C,IAAID,iBAAkC,GAAG,IAAI;IAE7C,IAAIE,WAAW,IAAIK,UAAU,EAAE;MAC7B,MAAME,MAAM,GAAG;QACb,GAAGd,YAAY;QACf,GAAGO,WAAW;QACd,GAAGK;MACL,CAAC;MACDP,iBAAiB,gBACfZ,KAAA,CAAAsB,aAAA,CAAC3B,2BAA2B;QAAC4B,aAAa,EAAEF;MAAO,CAAE,CACtD;IACH,CAAC,MAAM,IAAIP,WAAW,EAAE;MACtB,MAAMO,MAAM,GAAG;QAAE,GAAGd,YAAY;QAAE,GAAGO;MAAY,CAAC;MAClDF,iBAAiB,gBAAGZ,KAAA,CAAAsB,aAAA,CAAC1B,iBAAiB;QAAC2B,aAAa,EAAEF;MAAO,CAAE,CAAC;IAClE,CAAC,MAAM,IAAIF,UAAU,EAAE;MACrBN,aAAa,GAAG,MAAM;MACtB,MAAMQ,MAAM,GAAG;QAAE,GAAGd,YAAY;QAAE,GAAGY;MAAW,CAAC;MACjDP,iBAAiB,gBAAGZ,KAAA,CAAAsB,aAAA,CAACzB,gBAAgB;QAAC0B,aAAa,EAAEF;MAAO,CAAE,CAAC;IACjE;IAEA,OAAO;MAAET,iBAAiB;MAAEC;IAAc,CAAC;EAC7C,CAAC,EAAE,CAACP,MAAM,EAAEC,YAAY,CAAC,CAAC;EAE1B,MAAM;IAAEK,iBAAiB;IAAEC;EAAc,CAAC,GAAGL,QAAQ;EAErD,oBACER,KAAA,CAAAsB,aAAA,CAAAtB,KAAA,CAAAwB,QAAA,QACGZ,iBAAiB,gBAChBZ,KAAA,CAAAsB,aAAA,CAACxB,cAAc;IACb2B,GAAG,EAAE,GAAGlB,YAAY,CAACmB,UAAU,CAACC,YAAY,IAAItB,KAAK,EAAG;IACxDqB,UAAU,EAAEnB,YAAY,CAACmB,UAAW;IACpCE,QAAQ,eAAE5B,KAAA,CAAAsB,aAAA,CAACvB,kBAAkB;MAACc,aAAa,EAAEA;IAAc,CAAE;EAAE,GAE9DD,iBACa,CAAC,GACf,IACJ,CAAC;AAEP,CAAC","ignoreList":[]}
@@ -17,7 +17,8 @@ export const AutoPatternsCollectionPageContent = _ref => {
17
17
  index: index
18
18
  });
19
19
  } else if (component.type === 'custom') {
20
- const CustomComponent = overrides?.slots?.[component.id];
20
+ var _overrides$slots;
21
+ const CustomComponent = overrides == null || (_overrides$slots = overrides.slots) == null ? void 0 : _overrides$slots[component.id];
21
22
  if (!CustomComponent) {
22
23
  return null;
23
24
  }
@@ -1 +1 @@
1
- {"version":3,"names":["React","usePatternsWizardOverridesContext","AutoPatternsCollectionComponent","AutoPatternsCollectionPageContent","_ref","configuration","components","overrides","createElement","Fragment","map","component","index","type","key","collection","collectionId","CustomComponent","slots","id","filter","Boolean"],"sources":["../../../../src/components/AutoPatternsCollectionPageContent/AutoPatternsCollectionPageContent.tsx"],"sourcesContent":["import React from 'react';\nimport { CollectionPageConfig } from '../../types';\nimport { usePatternsWizardOverridesContext } from '../../providers';\nimport { AutoPatternsCollectionComponent } from '../AutoPatternsCollectionComponent/AutoPatternsCollectionComponent';\n\nexport interface AutoPatternsCollectionPageContentProps {\n configuration: CollectionPageConfig;\n}\n\nexport const AutoPatternsCollectionPageContent = ({\n configuration,\n}: AutoPatternsCollectionPageContentProps) => {\n const { components } = configuration;\n const overrides = usePatternsWizardOverridesContext();\n\n return (\n <>\n {components\n .map((component, index) => {\n if (component.type === 'collection') {\n return (\n <AutoPatternsCollectionComponent\n key={`collection-${component.collection.collectionId}-${index}`}\n component={component}\n index={index}\n />\n );\n } else if (component.type === 'custom') {\n const CustomComponent = overrides?.slots?.[component.id];\n\n if (!CustomComponent) {\n return null;\n }\n\n return <CustomComponent key={`custom-${component.id}-${index}`} />;\n }\n\n return null;\n })\n .filter(Boolean)}\n </>\n );\n};\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AAEzB,SAASC,iCAAiC,QAAQ,iBAAiB;AACnE,SAASC,+BAA+B,QAAQ,oEAAoE;AAMpH,OAAO,MAAMC,iCAAiC,GAAGC,IAAA,IAEH;EAAA,IAFI;IAChDC;EACsC,CAAC,GAAAD,IAAA;EACvC,MAAM;IAAEE;EAAW,CAAC,GAAGD,aAAa;EACpC,MAAME,SAAS,GAAGN,iCAAiC,CAAC,CAAC;EAErD,oBACED,KAAA,CAAAQ,aAAA,CAAAR,KAAA,CAAAS,QAAA,QACGH,UAAU,CACRI,GAAG,CAAC,CAACC,SAAS,EAAEC,KAAK,KAAK;IACzB,IAAID,SAAS,CAACE,IAAI,KAAK,YAAY,EAAE;MACnC,oBACEb,KAAA,CAAAQ,aAAA,CAACN,+BAA+B;QAC9BY,GAAG,EAAE,cAAcH,SAAS,CAACI,UAAU,CAACC,YAAY,IAAIJ,KAAK,EAAG;QAChED,SAAS,EAAEA,SAAU;QACrBC,KAAK,EAAEA;MAAM,CACd,CAAC;IAEN,CAAC,MAAM,IAAID,SAAS,CAACE,IAAI,KAAK,QAAQ,EAAE;MACtC,MAAMI,eAAe,GAAGV,SAAS,EAAEW,KAAK,GAAGP,SAAS,CAACQ,EAAE,CAAC;MAExD,IAAI,CAACF,eAAe,EAAE;QACpB,OAAO,IAAI;MACb;MAEA,oBAAOjB,KAAA,CAAAQ,aAAA,CAACS,eAAe;QAACH,GAAG,EAAE,UAAUH,SAAS,CAACQ,EAAE,IAAIP,KAAK;MAAG,CAAE,CAAC;IACpE;IAEA,OAAO,IAAI;EACb,CAAC,CAAC,CACDQ,MAAM,CAACC,OAAO,CACjB,CAAC;AAEP,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["React","usePatternsWizardOverridesContext","AutoPatternsCollectionComponent","AutoPatternsCollectionPageContent","_ref","configuration","components","overrides","createElement","Fragment","map","component","index","type","key","collection","collectionId","_overrides$slots","CustomComponent","slots","id","filter","Boolean"],"sources":["../../../../src/components/AutoPatternsCollectionPageContent/AutoPatternsCollectionPageContent.tsx"],"sourcesContent":["import React from 'react';\nimport { CollectionPageConfig } from '../../types';\nimport { usePatternsWizardOverridesContext } from '../../providers';\nimport { AutoPatternsCollectionComponent } from '../AutoPatternsCollectionComponent/AutoPatternsCollectionComponent';\n\nexport interface AutoPatternsCollectionPageContentProps {\n configuration: CollectionPageConfig;\n}\n\nexport const AutoPatternsCollectionPageContent = ({\n configuration,\n}: AutoPatternsCollectionPageContentProps) => {\n const { components } = configuration;\n const overrides = usePatternsWizardOverridesContext();\n\n return (\n <>\n {components\n .map((component, index) => {\n if (component.type === 'collection') {\n return (\n <AutoPatternsCollectionComponent\n key={`collection-${component.collection.collectionId}-${index}`}\n component={component}\n index={index}\n />\n );\n } else if (component.type === 'custom') {\n const CustomComponent = overrides?.slots?.[component.id];\n\n if (!CustomComponent) {\n return null;\n }\n\n return <CustomComponent key={`custom-${component.id}-${index}`} />;\n }\n\n return null;\n })\n .filter(Boolean)}\n </>\n );\n};\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AAEzB,SAASC,iCAAiC,QAAQ,iBAAiB;AACnE,SAASC,+BAA+B,QAAQ,oEAAoE;AAMpH,OAAO,MAAMC,iCAAiC,GAAGC,IAAA,IAEH;EAAA,IAFI;IAChDC;EACsC,CAAC,GAAAD,IAAA;EACvC,MAAM;IAAEE;EAAW,CAAC,GAAGD,aAAa;EACpC,MAAME,SAAS,GAAGN,iCAAiC,CAAC,CAAC;EAErD,oBACED,KAAA,CAAAQ,aAAA,CAAAR,KAAA,CAAAS,QAAA,QACGH,UAAU,CACRI,GAAG,CAAC,CAACC,SAAS,EAAEC,KAAK,KAAK;IACzB,IAAID,SAAS,CAACE,IAAI,KAAK,YAAY,EAAE;MACnC,oBACEb,KAAA,CAAAQ,aAAA,CAACN,+BAA+B;QAC9BY,GAAG,EAAE,cAAcH,SAAS,CAACI,UAAU,CAACC,YAAY,IAAIJ,KAAK,EAAG;QAChED,SAAS,EAAEA,SAAU;QACrBC,KAAK,EAAEA;MAAM,CACd,CAAC;IAEN,CAAC,MAAM,IAAID,SAAS,CAACE,IAAI,KAAK,QAAQ,EAAE;MAAA,IAAAI,gBAAA;MACtC,MAAMC,eAAe,GAAGX,SAAS,aAAAU,gBAAA,GAATV,SAAS,CAAEY,KAAK,qBAAhBF,gBAAA,CAAmBN,SAAS,CAACS,EAAE,CAAC;MAExD,IAAI,CAACF,eAAe,EAAE;QACpB,OAAO,IAAI;MACb;MAEA,oBAAOlB,KAAA,CAAAQ,aAAA,CAACU,eAAe;QAACJ,GAAG,EAAE,UAAUH,SAAS,CAACS,EAAE,IAAIR,KAAK;MAAG,CAAE,CAAC;IACpE;IAEA,OAAO,IAAI;EACb,CAAC,CAAC,CACDS,MAAM,CAACC,OAAO,CACjB,CAAC;AAEP,CAAC","ignoreList":[]}