@wix/auto-patterns 1.41.0 → 1.43.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 (42) hide show
  1. package/dist/cjs/components/AutoPatternsGrid/AutoPatternsGrid.js +3 -1
  2. package/dist/cjs/components/AutoPatternsGrid/AutoPatternsGrid.js.map +1 -1
  3. package/dist/cjs/components/AutoPatternsTable/AutoPatternsTable.js +3 -1
  4. package/dist/cjs/components/AutoPatternsTable/AutoPatternsTable.js.map +1 -1
  5. package/dist/cjs/hooks/useCommonCollectionFeatures.js +12 -7
  6. package/dist/cjs/hooks/useCommonCollectionFeatures.js.map +1 -1
  7. package/dist/cjs/hooks/useTableFeatures.js.map +1 -1
  8. package/dist/cjs/hooks/useViews.js +107 -0
  9. package/dist/cjs/hooks/useViews.js.map +1 -0
  10. package/dist/cjs/types/CollectionPageConfig.js.map +1 -1
  11. package/dist/esm/components/AutoPatternsGrid/AutoPatternsGrid.js +2 -0
  12. package/dist/esm/components/AutoPatternsGrid/AutoPatternsGrid.js.map +1 -1
  13. package/dist/esm/components/AutoPatternsTable/AutoPatternsTable.js +2 -0
  14. package/dist/esm/components/AutoPatternsTable/AutoPatternsTable.js.map +1 -1
  15. package/dist/esm/hooks/useCommonCollectionFeatures.js +8 -3
  16. package/dist/esm/hooks/useCommonCollectionFeatures.js.map +1 -1
  17. package/dist/esm/hooks/useTableFeatures.js.map +1 -1
  18. package/dist/esm/hooks/useViews.js +106 -0
  19. package/dist/esm/hooks/useViews.js.map +1 -0
  20. package/dist/esm/types/CollectionPageConfig.js.map +1 -1
  21. package/dist/types/components/AutoPatternsGrid/AutoPatternsGrid.d.ts.map +1 -1
  22. package/dist/types/components/AutoPatternsTable/AutoPatternsTable.d.ts.map +1 -1
  23. package/dist/types/hooks/useCommonCollectionFeatures.d.ts +3 -2
  24. package/dist/types/hooks/useCommonCollectionFeatures.d.ts.map +1 -1
  25. package/dist/types/hooks/useGridFeatures.d.ts +1 -0
  26. package/dist/types/hooks/useGridFeatures.d.ts.map +1 -1
  27. package/dist/types/hooks/useTableFeatures.d.ts +1 -0
  28. package/dist/types/hooks/useTableFeatures.d.ts.map +1 -1
  29. package/dist/types/hooks/useTableGridSwitchFeatures.d.ts +1 -0
  30. package/dist/types/hooks/useTableGridSwitchFeatures.d.ts.map +1 -1
  31. package/dist/types/hooks/useViews.d.ts +4 -0
  32. package/dist/types/hooks/useViews.d.ts.map +1 -0
  33. package/dist/types/testkit/playwright.d.ts +1 -1
  34. package/dist/types/testkit/playwright.d.ts.map +1 -1
  35. package/dist/types/types/CollectionPageConfig.d.ts +187 -1
  36. package/dist/types/types/CollectionPageConfig.d.ts.map +1 -1
  37. package/mcp-docs/app_config_structure.md +92 -0
  38. package/mcp-docs/auto-patterns-guide.md +467 -0
  39. package/mcp-docs/custom_overrides.md +37 -0
  40. package/mcp-docs/index.md +4 -0
  41. package/mcp-docs/views.md +335 -0
  42. package/package.json +20 -14
@@ -0,0 +1,335 @@
1
+ # Views Configuration (Collection Level)
2
+
3
+ Views let users quickly switch between predefined table or grid configurations (filters, column visibility/sort), and optionally save their own configurations.
4
+
5
+ To configure views in a `collectionPage`, add a `views` property inside the page's component configuration object.
6
+
7
+ ### Key Guidelines
8
+
9
+ * **enabled**: Must be set to `true` to activate the views feature.
10
+ * **Precedence over toolbarTitle**: When views are enabled, they take precedence over `toolbarTitle` configuration.
11
+ * **Column preferences**: To control column visibility and order in views, you must enable custom columns in your table config (`table.customColumns.enabled: true`).
12
+ * **Filter references**: Filters used in preset views must reference existing filter IDs from your `filters.items` configuration.
13
+ * **Reserved identifiers**: Don't use reserved IDs like `predefined-views`, `saved-views`, or `all-items-view`.
14
+
15
+ ### Views vs Categories
16
+
17
+ * **Individual views** (`type: 'views'`): Use for simple preset configurations
18
+ * **Categories** (`type: 'categories'`): Use to group related views together under labeled sections
19
+
20
+ ### Default View Behavior
21
+
22
+ * By default, the "All Items" view is shown as the first option
23
+ * Set `isDefaultView: true` on any preset view to make it the default instead
24
+ * Use `hideAllItemsView: true` to hide the "All Items" view when custom presets exist
25
+ * Use `customAllItemsViewLabel` to change the "All Items" label (ignored if a preset is set as default)
26
+
27
+ ## Configuration
28
+
29
+ For the complete interface definitions and detailed field documentation, see the views section in [app_config_structure.md](./app_config_structure.md#views-configuration-notes)
30
+
31
+ ## Usage Examples - Basic
32
+
33
+ ### Simple setup
34
+ Enable the views feature and manage views (save, rename, delete, set as default).
35
+
36
+ ```ts
37
+ views: {
38
+ enabled: true
39
+ }
40
+ ```
41
+
42
+ ### Preset view
43
+ Create a preset view.
44
+
45
+ For example a view that displays the `name` column in ascending order.
46
+ ```ts
47
+ views: {
48
+ enabled: true,
49
+ presets: {
50
+ type: 'views',
51
+ views: [
52
+ {
53
+ id: 'ascending-name',
54
+ label: 'Ascending names',
55
+ columnPreferences: [{ id: 'name', direction: 'asc' }],
56
+ },
57
+ ],
58
+ },
59
+ }
60
+ ```
61
+
62
+ ### Presets Categories
63
+ Group views under labeled categories.
64
+
65
+ For example, two views that sort the `price` column ascending and descending, grouped under 'Price' category
66
+
67
+ ```ts
68
+ views: {
69
+ enabled: true,
70
+ presets: {
71
+ type: 'categories',
72
+ categories: [
73
+ {
74
+ id: 'price',
75
+ label: 'Price',
76
+ views: [
77
+ {
78
+ id: 'price-low-to-high',
79
+ label: 'Low to High',
80
+ columnPreferences: [{ id: 'price', direction: 'asc' }],
81
+ },
82
+ {
83
+ id: 'price-high-to-low',
84
+ label: 'High to Low',
85
+ columnPreferences: [{ id: 'price', direction: 'desc' }],
86
+ },
87
+ ],
88
+ },
89
+ ],
90
+ },
91
+ }
92
+ ```
93
+
94
+ ### Category help tooltip icon
95
+ Add a help tooltip icon next to the category name using the `icon` property.
96
+
97
+ ```ts
98
+ views: {
99
+ enabled: true,
100
+ presets: {
101
+ type: 'categories',
102
+ categories: [
103
+ {
104
+ id: 'price',
105
+ label: 'Price',
106
+ icon: {
107
+ tooltipContent: 'These views sort by the item price.',
108
+ size: 'small',
109
+ },
110
+ views: [
111
+ // some views...
112
+ ],
113
+ },
114
+ ],
115
+ },
116
+ }
117
+ ```
118
+
119
+ ## Usage Examples - Advanced presets
120
+
121
+ ### Columns visibility and order
122
+ ```
123
+ Note that when controlling columns visibility, you always need to specify which columns you wish to show. a column without `{show: true}` will be hidden.
124
+ If you wish to hide a certain column or columns - you must pass all the other ids.
125
+ ```
126
+
127
+ The `columnPreferences` array controls both visibility and order together. The array order determines the display order, and `show: true` controls visibility.
128
+
129
+ Examples:
130
+
131
+ ```ts
132
+ views: {
133
+ enabled: true,
134
+ presets: {
135
+ type: 'views',
136
+ views: [
137
+ {
138
+ id: 'compact-view',
139
+ label: 'Compact',
140
+ columnPreferences: [
141
+ // The columns will be displayed in this order, re-order the array to control the columns' order
142
+ { id: 'name', show: true},
143
+ { id: 'price', show: true },
144
+ { id: 'age', show: true },
145
+ ],
146
+ }
147
+ ],
148
+ },
149
+ }
150
+ ```
151
+
152
+ ### Filters
153
+
154
+ #### Date filter
155
+ Apply a filter for date data type. A 'fixed' period can be used (last week, last month, next week...) or a custom range between actual dates.
156
+
157
+ Examples:
158
+ ```ts
159
+ filters: {
160
+ // some date filter definition with filterId: 'createdAt-filter', supporting presets and custom ranges
161
+ },
162
+ views: {
163
+ enabled: true,
164
+ presets: {
165
+ type: 'views',
166
+ views: [
167
+ {
168
+ // Fixed preset (last 7 days)
169
+ id: 'recent-created',
170
+ label: 'Created: Last 7 days',
171
+ filters: {
172
+ 'createdAt-filter': { filterType: 'date', value: { preset: 'SEVEN_DAYS' } },
173
+ },
174
+ },
175
+ {
176
+ // Closed range (between two dates)
177
+ id: 'created-in-2025',
178
+ label: 'Created in 2025',
179
+ filters: {
180
+ 'createdAt-filter': { filterType: 'date', value: { from: '01-01-2025', to: '12-31-2025' } },
181
+ },
182
+ },
183
+ ],
184
+ },
185
+ }
186
+ ```
187
+
188
+ #### Number filter
189
+ Apply a filter for numeric data type. You can filter by minimum only, maximum only, or a closed range.
190
+
191
+ Examples:
192
+ ```ts
193
+ filters: {
194
+ // some number filter definition with filterId: 'price-filter' and lower boundary of 0
195
+ },
196
+ views: {
197
+ enabled: true,
198
+ presets: {
199
+ type: 'views',
200
+ views: [
201
+ {
202
+ // Closed range — 10 ≤ price ≤ 100
203
+ id: 'price-10-to-100',
204
+ label: 'Price: 10–100',
205
+ filters: {
206
+ 'price-filter': { filterType: 'number', value: { from: 10, to: 100 } },
207
+ },
208
+ },
209
+ ],
210
+ },
211
+ }
212
+ ```
213
+
214
+ #### Boolean filter
215
+ Apply a filter for boolean data type. Choose items where the value is true or false. You can use the `name` field to control what will be written in the filter label when it's applied.
216
+
217
+ Examples:
218
+ ```ts
219
+ filters: {
220
+ // some boolean filter definition with filterId: 'inStock-filter'
221
+ },
222
+ views: {
223
+ enabled: true,
224
+ presets: {
225
+ type: 'views',
226
+ views: [
227
+ {
228
+ // Items where value is true
229
+ id: 'only-in-stock',
230
+ label: 'In stock only',
231
+ // we will use id: 'unchecked' for false
232
+ filters: {
233
+ 'inStock-filter': { filterType: 'boolean', value: [{ id: 'checked', name: 'In stock' }] },
234
+ },
235
+ },
236
+ ],
237
+ },
238
+ }
239
+ ```
240
+
241
+ #### Enum filter
242
+ Apply a filter for enum (options) data type. The value is an array of selected options. You can use the `name` field to control what will be written in the filter label when it's applied
243
+
244
+ Examples:
245
+ ```ts
246
+ filters: {
247
+ // some enum filter definiton with filterId: 'category-filter', and options that include the values 'pets' and 'toys'
248
+ },
249
+ views: {
250
+ enabled: true,
251
+ presets: {
252
+ type: 'views',
253
+ views: [
254
+ {
255
+ id: 'pets-and-toys',
256
+ label: 'Categories: Pets & Toys',
257
+ filters: {
258
+ 'category-filter': {
259
+ filterType: 'enum',
260
+ value: [
261
+ { id: 'pets', name: 'Pets' },
262
+ { id: 'toys', name: 'Toys' },
263
+ ],
264
+ },
265
+ },
266
+ },
267
+ ],
268
+ },
269
+ }
270
+ ```
271
+
272
+ #### Reference filter
273
+ Apply a filter for reference data type. The value is an array of selected options. You can use the `name` field to control what will be written in the filter label when it's applied
274
+
275
+ Examples:
276
+ ```ts
277
+ filters: {
278
+ // some reference filter definition with filterId: 'owner-filter'
279
+ },
280
+ views: {
281
+ enabled: true,
282
+ presets: {
283
+ type: 'views',
284
+ views: [
285
+ {
286
+ id: 'owners-a-b',
287
+ label: 'Owners: A & B',
288
+ filters: {
289
+ 'owner-filter': {
290
+ filterType: 'reference',
291
+ value: [
292
+ { id: 'owner-a-id', name: 'Owner A' },
293
+ { id: 'owner-b-id', name: 'Owner B' },
294
+ ],
295
+ },
296
+ },
297
+ },
298
+ ],
299
+ },
300
+ }
301
+ ```
302
+
303
+ ## About Column Preferences
304
+ ⚠️ **Note**: To control column visibility and order in a view, you must enable custom columns in your table config (`table.customColumns.enabled: true`). See the App Config Structure doc: [app_config_structure.md](./app_config_structure.md).
305
+
306
+ Column preferences allows to control:
307
+ 1. Column's sorting
308
+ 2. Column's visibility and order
309
+
310
+ ### Sorting
311
+ The `direction` field can be used to decide the sorting for a column in a preset view.
312
+
313
+ Note that the column must be configured with `sortable: true` in the columns config.
314
+
315
+ For example, to sort the column `age`:
316
+ ```ts
317
+ columnPreferences: [
318
+ {
319
+ id: `age`, // the column id
320
+ direction: 'asc', // we can also use 'desc'
321
+ }
322
+ ]
323
+ ```
324
+
325
+ ### Visibility & Order
326
+ Columns visibility and order are controlled together via the `show` field on `columnPreferences`.
327
+ If you wish to change visibility and order: list ALL the columns you want to see with `{ show: true }` and they’ll be shown in exactly that order. Columns that can’t be hidden (`hideable: false` or `hiddenFromCustomColumnsSelection: true`) are always shown even if you don’t list them. Columns marked `reorderDisabled: true` keep their original position and ignore reordering.
328
+
329
+ ## About Filters (in a preset view)
330
+ Filters used in a preset are referenced by their filter item `id` from your app config. If a referenced filter id does not exist in the app config, it is ignored. Ensure all used filters are defined under `filters.items`.
331
+
332
+ Example usages available here: [Filters examples](#filters)
333
+
334
+ **Supported filter value shapes**: See the complete `AutoFilterValue` type definition and all related filter value types (`DateFilterValue`, `NumberFilterValue`, `BooleanFilterValue`, `EnumFilterValue`, `ReferenceFilterValue`) in [app_config_structure.md](./app_config_structure.md).
335
+
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wix/auto-patterns",
3
- "version": "1.41.0",
3
+ "version": "1.43.0",
4
4
  "license": "UNLICENSED",
5
5
  "author": {
6
6
  "name": "Matvey Oklander",
@@ -35,6 +35,12 @@
35
35
  "require": "./dist/cjs/exports/testkit/puppeteer.js",
36
36
  "import": "./dist/esm/exports/testkit/puppeteer.js",
37
37
  "types": "./dist/types/exports/testkit/puppeteer.d.ts"
38
+ },
39
+ "./mcp-docs/auto-patterns-guide.md": {
40
+ "default": "./mcp-docs/auto-patterns-guide.md"
41
+ },
42
+ "./mcp-docs/wix_fqdn_custom_data_source.md": {
43
+ "default": "./mcp-docs/wix_fqdn_custom_data_source.md"
38
44
  }
39
45
  },
40
46
  "files": [
@@ -63,7 +69,7 @@
63
69
  },
64
70
  "dependencies": {
65
71
  "@babel/runtime": "^7.28.4",
66
- "@wix/data": "^1.0.316",
72
+ "@wix/data": "^1.0.323",
67
73
  "@wix/wix-ui-icons-common": "^3.100.0",
68
74
  "@wix/wix-ui-test-utils": "^1.3.3",
69
75
  "lodash": "^4.17.21"
@@ -79,22 +85,22 @@
79
85
  "@types/node": "^16.18.126",
80
86
  "@types/node-fetch": "^2.6.13",
81
87
  "@types/react": "^16.14.67",
82
- "@wix/crm": "^1.0.1117",
88
+ "@wix/crm": "^1.0.1175",
83
89
  "@wix/design-system": "^1.223.0",
84
- "@wix/eslint-config-yoshi": "^6.161.0",
90
+ "@wix/eslint-config-yoshi": "^6.162.0",
85
91
  "@wix/fe-essentials-standalone": "^1.1380.0",
86
- "@wix/jest-yoshi-preset": "^6.161.0",
87
- "@wix/patterns": "^1.294.0",
88
- "@wix/sdk": "^1.17.1",
92
+ "@wix/jest-yoshi-preset": "^6.162.0",
93
+ "@wix/patterns": "^1.299.0",
94
+ "@wix/sdk": "^1.17.2",
89
95
  "@wix/sdk-testkit": ">=0.1.9",
90
- "@wix/wix-data-items-common": "^1.0.255",
91
- "@wix/wix-data-items-sdk": "^1.0.450",
92
- "@wix/yoshi-flow-library": "^6.161.0",
93
- "@wix/yoshi-style-dependencies": "^6.161.0",
96
+ "@wix/wix-data-items-common": "^1.0.264",
97
+ "@wix/wix-data-items-sdk": "^1.0.460",
98
+ "@wix/yoshi-flow-library": "^6.162.0",
99
+ "@wix/yoshi-style-dependencies": "^6.162.0",
94
100
  "chance": "^1.1.13",
95
101
  "date-fns": "^2.30.0",
96
102
  "express": "^4.21.2",
97
- "fetch-mock": "^12.5.5",
103
+ "fetch-mock": "^12.6.0",
98
104
  "jest": "^27.5.1",
99
105
  "node-fetch": "^2.7.0",
100
106
  "react": "16.14.0",
@@ -106,7 +112,7 @@
106
112
  "@wix/design-system": "^1.204.0",
107
113
  "@wix/essentials": "^0.1.26",
108
114
  "@wix/patterns": "^1.254.0",
109
- "react": "^16.8.0",
115
+ "react": "^16.8.0 || ^18.0.0",
110
116
  "react-router-dom": "^6.0.0 || ^7.0.0"
111
117
  },
112
118
  "jest": {
@@ -153,5 +159,5 @@
153
159
  "wallaby": {
154
160
  "autoDetect": true
155
161
  },
156
- "falconPackageHash": "22d551f0337bd0d5e5de5a5cb32af3a84c6f8c8e1139cb9d4dbcd3f1"
162
+ "falconPackageHash": "a978db4a0bda96b3424d12b714abc59c92db2bef425e42fa25136858"
157
163
  }