@wix/auto-patterns 1.15.0 → 1.17.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 (100) hide show
  1. package/dist/cjs/components/AutoPatternsCollectionPageContent/AutoPatternsCollectionPageContent.js +16 -4
  2. package/dist/cjs/components/AutoPatternsCollectionPageContent/AutoPatternsCollectionPageContent.js.map +1 -1
  3. package/dist/cjs/components/AutoPatternsCollectionPageContent/SkeletonCollection.js +34 -0
  4. package/dist/cjs/components/AutoPatternsCollectionPageContent/SkeletonCollection.js.map +1 -0
  5. package/dist/cjs/components/AutoPatternsEntityPage/AutoPatternsEntityPage.js +1 -0
  6. package/dist/cjs/components/AutoPatternsEntityPage/AutoPatternsEntityPage.js.map +1 -1
  7. package/dist/cjs/components/AutoPatternsEntityPage/SkeletonEntity.js +198 -0
  8. package/dist/cjs/components/AutoPatternsEntityPage/SkeletonEntity.js.map +1 -0
  9. package/dist/cjs/components/AutoPatternsRoute/AutoPatternsPage.js +13 -3
  10. package/dist/cjs/components/AutoPatternsRoute/AutoPatternsPage.js.map +1 -1
  11. package/dist/cjs/components/AutoPatternsRoute/AutoPatternsRoutes.js +4 -4
  12. package/dist/cjs/components/AutoPatternsRoute/AutoPatternsRoutes.js.map +1 -1
  13. package/dist/cjs/hooks/useBaseTableFeatures.js +7 -2
  14. package/dist/cjs/hooks/useBaseTableFeatures.js.map +1 -1
  15. package/dist/cjs/hooks/useCollectionPageOnRowClickActions.js +49 -0
  16. package/dist/cjs/hooks/useCollectionPageOnRowClickActions.js.map +1 -0
  17. package/dist/cjs/hooks/useNavigationUtils.js +2 -2
  18. package/dist/cjs/hooks/useNavigationUtils.js.map +1 -1
  19. package/dist/cjs/providers/PatternsWizardOverridesContext.js +1 -1
  20. package/dist/cjs/providers/PatternsWizardOverridesContext.js.map +1 -1
  21. package/dist/cjs/providers/SchemaContext.js +4 -3
  22. package/dist/cjs/providers/SchemaContext.js.map +1 -1
  23. package/dist/cjs/types/CollectionPageConfig.js.map +1 -1
  24. package/dist/cjs/types/actions/base.js.map +1 -1
  25. package/dist/cjs/types/actions/collectionPageActions.js.map +1 -1
  26. package/dist/cjs/utils/actions/resolveAction.js +2 -1
  27. package/dist/cjs/utils/actions/resolveAction.js.map +1 -1
  28. package/dist/cjs/utils/actions/types.js.map +1 -1
  29. package/dist/docs/action_cell.md +233 -0
  30. package/dist/docs/app_config_structure.md +356 -0
  31. package/dist/docs/auto-patterns-guide.md +2467 -0
  32. package/dist/docs/bulk_actions.md +266 -0
  33. package/dist/docs/collection_page.md +54 -0
  34. package/dist/docs/collection_page_actions.md +343 -0
  35. package/dist/docs/custom_overrides.md +511 -0
  36. package/dist/docs/entity_page.md +104 -0
  37. package/dist/docs/entity_page_actions.md +92 -0
  38. package/dist/docs/index.md +76 -0
  39. package/dist/docs/installation.md +55 -0
  40. package/dist/docs/introduction.md +74 -0
  41. package/dist/docs/pages_configuration.md +129 -0
  42. package/dist/docs/recipe-bulk-operations.md +1352 -0
  43. package/dist/docs/recipe-crud-operations.md +805 -0
  44. package/dist/docs/recipe-customization.md +1703 -0
  45. package/dist/docs/recipe-first-dashboard.md +795 -0
  46. package/dist/docs/sdk_and_schema.md +215 -0
  47. package/dist/esm/components/AutoPatternsCollectionPageContent/AutoPatternsCollectionPageContent.js +7 -1
  48. package/dist/esm/components/AutoPatternsCollectionPageContent/AutoPatternsCollectionPageContent.js.map +1 -1
  49. package/dist/esm/components/AutoPatternsCollectionPageContent/SkeletonCollection.js +21 -0
  50. package/dist/esm/components/AutoPatternsCollectionPageContent/SkeletonCollection.js.map +1 -0
  51. package/dist/esm/components/AutoPatternsEntityPage/AutoPatternsEntityPage.js +3 -1
  52. package/dist/esm/components/AutoPatternsEntityPage/AutoPatternsEntityPage.js.map +1 -1
  53. package/dist/esm/components/AutoPatternsEntityPage/SkeletonEntity.js +91 -0
  54. package/dist/esm/components/AutoPatternsEntityPage/SkeletonEntity.js.map +1 -0
  55. package/dist/esm/components/AutoPatternsRoute/AutoPatternsPage.js +5 -1
  56. package/dist/esm/components/AutoPatternsRoute/AutoPatternsPage.js.map +1 -1
  57. package/dist/esm/components/AutoPatternsRoute/AutoPatternsRoutes.js +1 -1
  58. package/dist/esm/components/AutoPatternsRoute/AutoPatternsRoutes.js.map +1 -1
  59. package/dist/esm/hooks/useBaseTableFeatures.js +6 -1
  60. package/dist/esm/hooks/useBaseTableFeatures.js.map +1 -1
  61. package/dist/esm/hooks/useCollectionPageOnRowClickActions.js +45 -0
  62. package/dist/esm/hooks/useCollectionPageOnRowClickActions.js.map +1 -0
  63. package/dist/esm/hooks/useNavigationUtils.js +1 -1
  64. package/dist/esm/hooks/useNavigationUtils.js.map +1 -1
  65. package/dist/esm/providers/PatternsWizardOverridesContext.js.map +1 -1
  66. package/dist/esm/providers/SchemaContext.js +3 -2
  67. package/dist/esm/providers/SchemaContext.js.map +1 -1
  68. package/dist/esm/types/CollectionPageConfig.js.map +1 -1
  69. package/dist/esm/types/actions/base.js.map +1 -1
  70. package/dist/esm/types/actions/collectionPageActions.js.map +1 -1
  71. package/dist/esm/utils/actions/resolveAction.js +2 -1
  72. package/dist/esm/utils/actions/resolveAction.js.map +1 -1
  73. package/dist/esm/utils/actions/types.js.map +1 -1
  74. package/dist/types/components/AutoPatternsCollectionPageContent/AutoPatternsCollectionPageContent.d.ts.map +1 -1
  75. package/dist/types/components/AutoPatternsCollectionPageContent/SkeletonCollection.d.ts +5 -0
  76. package/dist/types/components/AutoPatternsCollectionPageContent/SkeletonCollection.d.ts.map +1 -0
  77. package/dist/types/components/AutoPatternsEntityPage/SkeletonEntity.d.ts +7 -0
  78. package/dist/types/components/AutoPatternsEntityPage/SkeletonEntity.d.ts.map +1 -0
  79. package/dist/types/components/AutoPatternsRoute/AutoPatternsPage.d.ts.map +1 -1
  80. package/dist/types/hooks/useBaseTableFeatures.d.ts +1 -1
  81. package/dist/types/hooks/useBaseTableFeatures.d.ts.map +1 -1
  82. package/dist/types/hooks/useCollectionPageOnRowClickActions.d.ts +7 -0
  83. package/dist/types/hooks/useCollectionPageOnRowClickActions.d.ts.map +1 -0
  84. package/dist/types/hooks/useTableFeatures.d.ts +1 -1
  85. package/dist/types/hooks/useTableGridSwitchFeatures.d.ts +1 -1
  86. package/dist/types/providers/PatternsWizardOverridesContext.d.ts +2 -2
  87. package/dist/types/providers/PatternsWizardOverridesContext.d.ts.map +1 -1
  88. package/dist/types/providers/SchemaContext.d.ts +2 -1
  89. package/dist/types/providers/SchemaContext.d.ts.map +1 -1
  90. package/dist/types/types/CollectionPageConfig.d.ts +2 -1
  91. package/dist/types/types/CollectionPageConfig.d.ts.map +1 -1
  92. package/dist/types/types/actions/base.d.ts +1 -0
  93. package/dist/types/types/actions/base.d.ts.map +1 -1
  94. package/dist/types/types/actions/collectionPageActions.d.ts +8 -0
  95. package/dist/types/types/actions/collectionPageActions.d.ts.map +1 -1
  96. package/dist/types/utils/actions/resolveAction.d.ts +1 -0
  97. package/dist/types/utils/actions/resolveAction.d.ts.map +1 -1
  98. package/dist/types/utils/actions/types.d.ts +1 -0
  99. package/dist/types/utils/actions/types.d.ts.map +1 -1
  100. package/package.json +26 -20
@@ -0,0 +1,356 @@
1
+ # AppConfig Structure
2
+
3
+ ## ⚠️ Configuration Rules
4
+
5
+ - **Configuration must come only from a JSON file** - never inline or from other sources
6
+ - **DO NOT fill optional fields unless explicitly requested** - leave optional properties undefined to avoid unnecessary complexity
7
+ - **After each configuration change, verify that the configuration strictly aligns with the structure described below** - any configuration entries not defined in this structure must be removed
8
+ - **When generating config for the first time, select up to 3 columns from the schema that best represent the entity**
9
+
10
+ ## ⚠️ Common Configuration Mistakes to Avoid
11
+
12
+ - Adding more than two pages
13
+ - Mixing page types in a single configuration
14
+ - Including undefined optional fields
15
+ - Selecting too many initial columns
16
+ - Not designating exactly one page as `appMainPage: true`
17
+ - Missing or inconsistent page relationships (parentPageId/entityPageId)
18
+ - Setting `stickyColumns` to invalid values (negative, zero, or exceeding column count)
19
+
20
+ ```ts
21
+ export interface AppConfig {
22
+ pages: {
23
+ id: string; // Page unique identifier (must be unique across the app)
24
+ type: 'collectionPage' | 'entityPage'; // Defines page type
25
+ appMainPage?: boolean; // Designates this page as the main page (exactly one page must have this set to true)
26
+ collectionPage?: {
27
+ route: {
28
+ path: string; // Route path for the collection page (e.g., '/')
29
+ };
30
+ title: {
31
+ text: string; // Main page title
32
+ hideTotal?: boolean; // Hide total items in header. Default: true
33
+ };
34
+ subtitle?: {
35
+ text: string; // Optional page subtitle
36
+ };
37
+ actions?: { // Defines page-level actions for the collection page
38
+ primaryActions?: {
39
+ type: 'action' | 'menu'; // Type of primary actions layout
40
+ action?: { // Required when type is 'action'
41
+ item: {
42
+ id: string; // Unique identifier for the action
43
+ type: 'create' | 'custom'; // Action type
44
+ label?: string; // Text displayed for the action
45
+ collection: {
46
+ collectionId: string; // ID of the Wix Data collection
47
+ entityTypeSource: 'cms'; // Data source type. Always 'cms'
48
+ };
49
+ create?: { // Required when type is 'create'
50
+ mode: 'page'; // Create mode
51
+ page: {
52
+ id: string; // Entity page ID to navigate to for creation
53
+ };
54
+ };
55
+ };
56
+ };
57
+ menu?: { // Required when type is 'menu'
58
+ label: string; // Label for the group
59
+ items: {}[]; // Array of action configurations, same structure as action.item, can include dividers
60
+ };
61
+ };
62
+ secondaryActions?: {
63
+ type: 'action' | 'menu'; // Type of secondary actions layout, same structure as primaryActions
64
+ action?: {}; // Same structure as primaryActions.action
65
+ menu?: {}; // Same structure as primaryActions.menu
66
+ };
67
+ };
68
+ components: [
69
+ {
70
+ entityPageId?: string; // ID of the entity page to navigate to when clicking a row
71
+ collection: {
72
+ collectionId: string; // ID of the Wix Data collection
73
+ entityTypeSource: 'cms'; // Data source type. Always 'cms'
74
+ reflectQueryInUrl?: boolean; // Reflects query state (search, filters, sorting) in the browser URL. Default: false
75
+ selectAllScope?: 'page' | 'all'; // Controls "Select All" scope. 'all' selects entire collection, 'page' selects only visible items. Default: 'all'
76
+ selectionUpdateMode?: 'preserve' | 'clear'; // Controls selection behavior when data changes. 'preserve' maintains selections, 'clear' clears them. Default: 'clear'
77
+ };
78
+ filters?: {
79
+ panelTitle?: string; // Title of the filters panel
80
+ items: {
81
+ id: string; // Unique identifier for the filter item
82
+ fieldId: string; // ID of the field to filter by (must be a valid type: NUMBER, DATETIME, BOOLEAN, ARRAY, ARRAY_STRING)
83
+ displayName?: string; // Display name of the filter item
84
+ openByDefault?: boolean; // Whether the filter item is open by default in the panel (accordion is open)
85
+ sectionTitle?: string; // Title of the filter section. Required if more than one section exists to prevent confusion
86
+ tagLabel?: string; // Label shown in Tag component in the table/grid when the filter is applied (e.g., "Age: 7")
87
+ numberConfig?: {
88
+ min?: number; // Minimum value
89
+ max?: number; // Maximum value
90
+ allowedDecimals?: true; // Decimal precision allowed
91
+ };
92
+ dateConfig?: {
93
+ mode?: 'ONLY_PREDEFINED' | 'ONLY_CUSTOM' | 'COMBINE'; // Determines filter behavior
94
+ presets?: (
95
+ | 'SEVEN_DAYS'
96
+ | 'FOURTEEN_DAYS'
97
+ | 'MONTH'
98
+ | 'TODAY'
99
+ | 'TOMORROW'
100
+ | 'NEXT_THREE_DAYS'
101
+ | 'NEXT_SEVEN_DAYS'
102
+ | 'NEXT_THIRTY_DAYS'
103
+ )[]; // Shown only if mode includes predefined presets (COMBINE or ONLY_PREDEFINED)
104
+ includeTime?: boolean; // Whether to allow time selection. Default is true
105
+ };
106
+ booleanConfig?: {
107
+ trueLabel?: string; // Label shown for the true value
108
+ falseLabel?: string; // Label shown for the false value
109
+ };
110
+ enumConfig?: {
111
+ options: {
112
+ value: string; // Enum option value
113
+ label: string; // Enum option label
114
+ }[];
115
+ selectionMode: 'single' | 'multiple'; // Selection behavior
116
+ optionType?:
117
+ | 'checkbox'
118
+ | 'inlineCheckbox'
119
+ | 'radio'
120
+ | 'select'; // Option rendering style
121
+ };
122
+ }[];
123
+ };
124
+ actionCell?: {
125
+ primaryAction?: {
126
+ item: {
127
+ id: string; // Unique identifier for the action
128
+ type: 'update' | 'delete' | 'custom'; // Action type
129
+ label?: string; // Text displayed for the action
130
+ skin?: string; // Visual appearance of the action button (see Action Button Skin Values section)
131
+ disabled?: boolean; // Whether the action is disabled
132
+ tooltip?: string; // Tooltip text shown on hover
133
+ update?: { // Required when type is 'update'
134
+ mode: 'page'; // Update mode
135
+ page?: { // Required when mode is 'page'
136
+ id: string; // Entity page ID to navigate to
137
+ };
138
+ };
139
+ delete?: { // Required when type is 'delete'
140
+ mode: 'modal'; // Currently only 'modal' is supported
141
+ modal: {
142
+ title?: {
143
+ text: string; // Modal title
144
+ };
145
+ description?: {
146
+ text: string; // Modal description
147
+ };
148
+ actions?: {
149
+ submit?: {
150
+ text: string; // Submit button text
151
+ };
152
+ cancel?: {
153
+ text: string; // Cancel button text
154
+ };
155
+ };
156
+ feedback?: {
157
+ successToast?: {
158
+ text: string; // Success message
159
+ };
160
+ errorToast?: {
161
+ text: string; // Error message
162
+ };
163
+ };
164
+ };
165
+ };
166
+ };
167
+ };
168
+ secondaryActions?: {
169
+ items: {}[]; // Array of action configurations, same structure as primaryAction.item, can include dividers
170
+ inlineCount?: number; // How many secondary actions to show inline before showing popover
171
+ inlineAlwaysVisible?: boolean; // Whether to always show inline actions (not just on hover)
172
+ };
173
+ };
174
+ bulkActionToolbar?: {
175
+ primaryActions?: ({
176
+ type: 'action' | 'menu'; // Type of bulk action item
177
+ action?: { // Required when type is 'action'
178
+ item: {
179
+ id: string; // Unique identifier for the bulk action
180
+ type: 'bulkDelete' | 'custom'; // Bulk action type
181
+ label?: string; // Text displayed for the action
182
+ bulkDelete?: { // Required when type is 'bulkDelete'
183
+ mode: 'modal'; // Currently only 'modal' is supported
184
+ modal: {
185
+ title?: {
186
+ text: string; // Modal title
187
+ };
188
+ description?: {
189
+ text: string; // Modal description
190
+ };
191
+ actions?: {
192
+ submit?: {
193
+ text: string; // Submit button text
194
+ };
195
+ cancel?: {
196
+ text: string; // Cancel button text
197
+ };
198
+ };
199
+ feedback?: {
200
+ successToast?: {
201
+ text: string; // Success message
202
+ };
203
+ errorToast?: {
204
+ text: string; // Error message
205
+ };
206
+ };
207
+ };
208
+ };
209
+ };
210
+ };
211
+ menu?: { // Required when type is 'menu'
212
+ label: string; // Label for the dropdown group
213
+ items: {}[] // Array of bulk actions configurations, same structure as action.item, can include dividers
214
+ };
215
+ })[];
216
+ secondaryActions?: {}[]; // Array of bulk actions configurations, same structure as primaryActions[].menu.items, can include dividers
217
+ };
218
+ toolbarTitle?: {
219
+ title: string; // Toolbar title above the table/grid
220
+ subtitle?: {
221
+ text: string; // Toolbar subtitle
222
+ };
223
+ showTotal?: boolean; // Show total items on toolbar. Default: false
224
+ };
225
+ search?: {
226
+ shown?: boolean; // Show/hide the search
227
+ };
228
+ emptyState?: {
229
+ title?: string; // Empty state title
230
+ subtitle?: string; // Empty state subtitle
231
+ image?: {
232
+ id: string; // Image ID for empty state
233
+ };
234
+ addNewCta?: {
235
+ id?: string; // Add New CTA ID
236
+ text?: string; // Add New CTA text
237
+ };
238
+ customCta?: {
239
+ id?: string; // Custom CTA ID
240
+ };
241
+ };
242
+ layout: [ // Array of layout items that define what components to render
243
+ {
244
+ type: 'Table'; // Layout item type for table rendering
245
+ table?: {
246
+ columns: {
247
+ id: string; // Field ID from the collection
248
+ name: string; // Column title displayed
249
+ width: string; // The width of the column (required in types)
250
+ sortable?: boolean; // If the column is sortable
251
+ defaultSortOrder?: 'asc' | 'desc'; // Optional default sort order
252
+ sortMode?: 'asc' | 'desc'; // Optional sorting mode
253
+ reorderDisabled?: boolean; // Whether column reordering is disabled
254
+ hideable?: boolean; // Whether column can be hidden
255
+ defaultHidden?: boolean; // Whether column is hidden by default
256
+ hiddenFromCustomColumnsSelection?: boolean; // Whether column is hidden from custom columns selection
257
+ }[];
258
+ customColumns?: {
259
+ enabled: boolean; // Enable user customization (hide/reorder columns)
260
+ };
261
+ stickyColumns?: number; // Number of columns to make sticky from the start. Sticky columns remain visible when horizontally scrolling.
262
+ };
263
+ },
264
+ {
265
+ type: 'Grid'; // Layout item type for grid rendering
266
+ grid?: {
267
+ item: {
268
+ titleFieldId: string; // Field ID to display as the item title
269
+ subtitleFieldId?: string; // Field ID for the item subtitle
270
+ imageFieldId?: string; // Field ID for the item image
271
+ /**
272
+ * Controls which content is shown in the card (preset):
273
+ * - 'full': Shows both title and subtitle.
274
+ * - 'title': Shows only the title.
275
+ * - 'empty': Hides both title and subtitle (card appears visually empty except for image or other content).
276
+ */
277
+ cardContentMode?: 'full' | 'title' | 'empty';
278
+ imagePlacement?: 'top' | 'side';
279
+ };
280
+ };
281
+ }
282
+ ]; // End of layout array
283
+ }
284
+ ]; // End of components array
285
+ };
286
+ entityPage?: {
287
+ route: {
288
+ path: string; // Route path for the entity page (e.g., '/product/:entityId')
289
+ params: {
290
+ id: string; // Maps dynamic parameter in path to its identifier
291
+ };
292
+ };
293
+ title?: {
294
+ text: string; // Entity page title
295
+ };
296
+ subtitle?: {
297
+ text: string; // Entity page subtitle
298
+ };
299
+ parentPageId?: string; // ID of the parent collection page
300
+ layout?: {
301
+ // Main layout section
302
+ main: {
303
+ type: 'card'; // Type of the card
304
+ card: {
305
+ title: {
306
+ text: string; // Title of the card
307
+ };
308
+ subtitle?: {
309
+ text: string; // Subtitle of the card
310
+ };
311
+ children: LayoutContent[]; // Array of content items that can be fields, nested containers, or components
312
+ };
313
+ }[];
314
+ // Sidebar layout section
315
+ sidebar?: {
316
+ type: 'card';
317
+ card: {
318
+ title: {
319
+ text: string; // Title of the card
320
+ };
321
+ subtitle?: {
322
+ text: string; // Subtitle of the card
323
+ };
324
+ children: LayoutContent[]; // Array of content items that can be fields, nested containers, or components
325
+ };
326
+ }[];
327
+ };
328
+ collectionId: string; // Related collection ID
329
+ entityTypeSource: 'cms'; // Data source type. Always 'cms'
330
+ };
331
+ }[];
332
+ }
333
+
334
+ type LayoutContent =
335
+ | {
336
+ type: 'field';
337
+ field: {
338
+ span?: number;
339
+ fieldId: string;
340
+ };
341
+ }
342
+ | {
343
+ type: 'container';
344
+ container: {
345
+ span?: number;
346
+ children: LayoutContent[];
347
+ };
348
+ }
349
+ | {
350
+ type: 'component';
351
+ component: {
352
+ span?: number;
353
+ componentId: string;
354
+ };
355
+ };
356
+ ```