@wix/auto-patterns 1.18.0 → 1.20.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 (62) hide show
  1. package/dist/cjs/components/AutoPatternsTable/AutoPatternsTable.js +4 -2
  2. package/dist/cjs/components/AutoPatternsTable/AutoPatternsTable.js.map +1 -1
  3. package/dist/cjs/hooks/useTableFeatures.js +9 -1
  4. package/dist/cjs/hooks/useTableFeatures.js.map +1 -1
  5. package/dist/cjs/providers/ErrorContext.js +64 -0
  6. package/dist/cjs/providers/ErrorContext.js.map +1 -0
  7. package/dist/cjs/providers/PatternsWizardOverridesContext.js +1 -1
  8. package/dist/cjs/providers/PatternsWizardOverridesContext.js.map +1 -1
  9. package/dist/cjs/providers/RootAppProvider.js +16 -8
  10. package/dist/cjs/providers/RootAppProvider.js.map +1 -1
  11. package/dist/cjs/providers/SchemaContext.js +7 -2
  12. package/dist/cjs/providers/SchemaContext.js.map +1 -1
  13. package/dist/cjs/providers/index.js +6 -0
  14. package/dist/cjs/providers/index.js.map +1 -1
  15. package/dist/cjs/types/CollectionPageConfig.js.map +1 -1
  16. package/dist/cjs/types/actions/collectionPageActions.js.map +1 -1
  17. package/dist/cjs/types/types.js.map +1 -1
  18. package/dist/docs/action_cell.md +21 -8
  19. package/dist/docs/app_config_structure.md +10 -3
  20. package/dist/docs/auto-patterns-guide.md +425 -120
  21. package/dist/docs/bulk_actions.md +20 -7
  22. package/dist/docs/collection_page_actions.md +45 -19
  23. package/dist/docs/custom_overrides.md +318 -71
  24. package/dist/docs/entity_page.md +0 -1
  25. package/dist/docs/index.md +1 -1
  26. package/dist/docs/installation.md +8 -9
  27. package/dist/docs/introduction.md +3 -2
  28. package/dist/docs/wix_fqdn_custom_data_source.md +111 -54
  29. package/dist/esm/components/AutoPatternsTable/AutoPatternsTable.js +4 -2
  30. package/dist/esm/components/AutoPatternsTable/AutoPatternsTable.js.map +1 -1
  31. package/dist/esm/hooks/useTableFeatures.js +10 -2
  32. package/dist/esm/hooks/useTableFeatures.js.map +1 -1
  33. package/dist/esm/providers/ErrorContext.js +44 -0
  34. package/dist/esm/providers/ErrorContext.js.map +1 -0
  35. package/dist/esm/providers/PatternsWizardOverridesContext.js.map +1 -1
  36. package/dist/esm/providers/RootAppProvider.js +2 -1
  37. package/dist/esm/providers/RootAppProvider.js.map +1 -1
  38. package/dist/esm/providers/SchemaContext.js +6 -1
  39. package/dist/esm/providers/SchemaContext.js.map +1 -1
  40. package/dist/esm/providers/index.js +1 -0
  41. package/dist/esm/providers/index.js.map +1 -1
  42. package/dist/esm/types/CollectionPageConfig.js.map +1 -1
  43. package/dist/esm/types/actions/collectionPageActions.js.map +1 -1
  44. package/dist/esm/types/types.js.map +1 -1
  45. package/dist/types/components/AutoPatternsTable/AutoPatternsTable.d.ts.map +1 -1
  46. package/dist/types/hooks/useTableFeatures.d.ts +6 -0
  47. package/dist/types/hooks/useTableFeatures.d.ts.map +1 -1
  48. package/dist/types/providers/ErrorContext.d.ts +11 -0
  49. package/dist/types/providers/ErrorContext.d.ts.map +1 -0
  50. package/dist/types/providers/PatternsWizardOverridesContext.d.ts +2 -0
  51. package/dist/types/providers/PatternsWizardOverridesContext.d.ts.map +1 -1
  52. package/dist/types/providers/RootAppProvider.d.ts.map +1 -1
  53. package/dist/types/providers/SchemaContext.d.ts.map +1 -1
  54. package/dist/types/providers/index.d.ts +1 -0
  55. package/dist/types/providers/index.d.ts.map +1 -1
  56. package/dist/types/types/CollectionPageConfig.d.ts +3 -0
  57. package/dist/types/types/CollectionPageConfig.d.ts.map +1 -1
  58. package/dist/types/types/actions/collectionPageActions.d.ts +7 -0
  59. package/dist/types/types/actions/collectionPageActions.d.ts.map +1 -1
  60. package/dist/types/types/types.d.ts +1 -5
  61. package/dist/types/types/types.d.ts.map +1 -1
  62. package/package.json +9 -9
@@ -4,6 +4,8 @@ When implementing a custom data source based on a Wix Business API FQDN, you'll
4
4
 
5
5
  **⚠️ 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
6
 
7
+ **📝 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
+
7
9
  ## Prerequisites: Required Tools
8
10
 
9
11
  **🛑 CRITICAL**: Before proceeding with this guide, you must have the following tools available:
@@ -85,11 +87,11 @@ This conversion ensures:
85
87
  - **Proper field mapping** between configuration and data source
86
88
  - **Seamless integration** with AutoPatterns components
87
89
 
88
- For the complete SchemaConfig interface, field definitions, and implementation details, refer to the `schema_config` section.
90
+ For the complete SchemaConfig interface, field definitions, and implementation details, refer to the "Schema Config" section.
89
91
 
90
92
  ## Step 4: Set Up Custom Data Source Structure
91
93
 
92
- Follow the complete custom data source implementation guide in the `custom_overrides` section. The key FQDN-specific considerations are:
94
+ Follow the complete custom data source implementation guide in the "Custom Overrides" section. The key FQDN-specific considerations are:
93
95
 
94
96
  1. **Import the client library** identified in Step 2
95
97
  2. **Use the field mappings** from Step 3 in your SchemaConfig
@@ -97,52 +99,75 @@ Follow the complete custom data source implementation guide in the `custom_overr
97
99
 
98
100
  **Important**: The schema actions should contain helpful comments but NOT actual implementations. Each action should throw an error indicating it's unimplemented and needs to be implemented by the user.
99
101
 
100
- For detailed implementation patterns, folder structure, and registration steps, refer to the **Custom Data Sources** section in `custom_overrides`.
102
+ ### Custom Data Source Hook Implementation
101
103
 
102
- ### Example: Unimplemented Actions Structure
104
+ Create your custom data source with the hook pattern:
103
105
 
104
- Here's what your schema actions should look like - containing helpful comments but throwing unimplemented exceptions:
106
+ In `components/customDataSources/myCustomDataSource.ts`:
107
+ ```typescript
108
+ export const myCustomDataSource = async (collectionId: string, context: any) => {
109
+ return {
110
+ id: 'myCustomCollection',
111
+ fields: {
112
+ // Field definitions based on your FQDN schema mapping
113
+ },
114
+ displayField: 'name',
115
+ idField: '_id',
116
+ actions: {
117
+ get: async (entityId: string) => {
118
+ // TODO: Implement using your FQDN client library
119
+ // Example: const result = await yourFQDNClient.getEntity(entityId);
120
+ // Remember to map the response fields from snake_case to camelCase
121
+ throw new Error('get action not implemented - user must implement this method');
122
+ },
123
+ create: async (newEntity: any) => {
124
+ // TODO: Implement using your FQDN client library
125
+ // Example: const result = await yourFQDNClient.createEntity(newEntity);
126
+ // Remember to map the request fields from camelCase to snake_case
127
+ throw new Error('create action not implemented - user must implement this method');
128
+ },
129
+ update: async (updatedEntity: any) => {
130
+ // TODO: Implement using your FQDN client library
131
+ // Example: const result = await yourFQDNClient.updateEntity(updatedEntity);
132
+ // Remember to map the request fields from camelCase to snake_case
133
+ throw new Error('update action not implemented - user must implement this method');
134
+ },
135
+ delete: async (entityId: string) => {
136
+ // TODO: Implement using your FQDN client library
137
+ // Example: await yourFQDNClient.deleteEntity(entityId);
138
+ throw new Error('delete action not implemented - user must implement this method');
139
+ },
140
+ bulkDelete: async (entityIds: string[]) => {
141
+ // TODO: Implement using your FQDN client library
142
+ // Example: await yourFQDNClient.bulkDeleteEntities(entityIds);
143
+ throw new Error('bulkDelete action not implemented - user must implement this method');
144
+ },
145
+ find: async (query: Query, options?: any) => {
146
+ // TODO: Implement using your FQDN client library
147
+ // Example: const result = await yourFQDNClient.queryEntities(query, options);
148
+ // Remember to map the response fields from snake_case to camelCase
149
+ // Must return: { items: any[], total: number }
150
+ throw new Error('find action not implemented - user must implement this method');
151
+ }
152
+ }
153
+ };
154
+ };
155
+ ```
105
156
 
157
+ In `components/customDataSources/index.tsx`:
106
158
  ```typescript
107
- actions: {
108
- get: async (entityId: string) => {
109
- // TODO: Implement using your FQDN client library
110
- // Example: const result = await yourFQDNClient.getEntity(entityId);
111
- // Remember to map the response fields from snake_case to camelCase
112
- throw new Error('get action not implemented - user must implement this method');
113
- },
114
- create: async (newEntity: any) => {
115
- // TODO: Implement using your FQDN client library
116
- // Example: const result = await yourFQDNClient.createEntity(newEntity);
117
- // Remember to map the request fields from camelCase to snake_case
118
- throw new Error('create action not implemented - user must implement this method');
119
- },
120
- update: async (updatedEntity: any) => {
121
- // TODO: Implement using your FQDN client library
122
- // Example: const result = await yourFQDNClient.updateEntity(updatedEntity);
123
- // Remember to map the request fields from camelCase to snake_case
124
- throw new Error('update action not implemented - user must implement this method');
125
- },
126
- delete: async (entityId: string) => {
127
- // TODO: Implement using your FQDN client library
128
- // Example: await yourFQDNClient.deleteEntity(entityId);
129
- throw new Error('delete action not implemented - user must implement this method');
130
- },
131
- bulkDelete: async (entityIds: string[]) => {
132
- // TODO: Implement using your FQDN client library
133
- // Example: await yourFQDNClient.bulkDeleteEntities(entityIds);
134
- throw new Error('bulkDelete action not implemented - user must implement this method');
135
- },
136
- find: async (query: Query, options?: any) => {
137
- // TODO: Implement using your FQDN client library
138
- // Example: const result = await yourFQDNClient.queryEntities(query, options);
139
- // Remember to map the response fields from snake_case to camelCase
140
- // Must return: { items: any[], total: number }
141
- throw new Error('find action not implemented - user must implement this method');
142
- }
143
- }
159
+ import { myCustomDataSource } from './myCustomDataSource';
160
+
161
+ export const useCustomDataSources = () => {
162
+ // You can access React context and other hooks here
163
+ return {
164
+ myCustomDataSource
165
+ };
166
+ };
144
167
  ```
145
168
 
169
+ For detailed implementation patterns, folder structure, and registration steps, refer to the **Custom Data Sources** section in "Custom Overrides".
170
+
146
171
  ## Step 5: Update AppConfig
147
172
 
148
173
  Configure your AppConfig to use the custom data source by setting:
@@ -161,24 +186,53 @@ Configure your AppConfig to use the custom data source by setting:
161
186
  }
162
187
  ```
163
188
 
164
- For complete AppConfig structure, configuration rules, and advanced options, refer to the `app_config_structure` section.
189
+ For complete AppConfig structure, configuration rules, and advanced options, refer to the "App Config Structure" section.
190
+
191
+ ## Step 6: Register Custom Data Source
192
+
193
+ In your main page component, use the hook to register your custom data source:
194
+
195
+ ```tsx
196
+ import { useCustomDataSources } from '../components/customDataSources';
197
+
198
+ export default function YourPage() {
199
+ const customDataSources = useCustomDataSources();
200
+
201
+ return (
202
+ <PatternsWizardOverridesProvider value={{ customDataSources }}>
203
+ <AutoPatternsApp configuration={config} />
204
+ </PatternsWizardOverridesProvider>
205
+ );
206
+ }
207
+ ```
208
+
209
+ ## Step 7: Implement Custom Actions (Only if Explicitly Requested)
165
210
 
166
- ## Step 6: Implement Custom Actions (Optional)
211
+ **⚠️ IMPORTANT**: Custom actions should only be implemented when the user explicitly requests them. A basic dashboard page with standard CRUD operations does not require custom actions.
167
212
 
168
- If you need custom actions for your FQDN-based data source, follow the action implementation patterns from the `custom_overrides` section. Your custom actions will have access to the same SDK utilities, but remember that they will need to interact with your FQDN-based API directly since the SchemaConfig actions from Step 4 are left unimplemented for you to complete.
213
+ If the user specifically requests custom actions for your FQDN-based data source, follow the action implementation patterns from the "Custom Overrides" section. Your custom actions will have access to the same SDK utilities, but remember that they will need to interact with your FQDN-based API directly since the SchemaConfig actions from Step 4 are left unimplemented for you to complete.
169
214
 
170
215
  ## FQDN-Specific Implementation Checklist
171
216
 
217
+ ### Core Requirements (Always Required)
172
218
  ✅ **Schema Extraction**: Used fqdn_schema tool to understand entity structure
173
219
  ✅ **Client Library**: Used client_lib tool to identify correct SDK package
174
220
  ✅ **Field Mapping**: Mapped FQDN field types to AutoPatterns field types
175
221
  ✅ **⚠️ CRITICAL: Field ID Conversion**: Converted individual field segments from snake_case to camelCase while preserving field path structure in SchemaConfig and AppConfig
176
222
  ✅ **AppConfig Update**: Set `entityTypeSource: "custom"` and provided custom.id
177
- ✅ **Custom Data Source Structure**: Followed `custom_overrides` section for folder structure and registration
223
+ ✅ **Custom Data Source Structure**: Followed "Custom Overrides" section for folder structure and registration
224
+ ✅ **Hook Implementation**: Created useCustomDataSources hook for accessing React context
178
225
  ✅ **⚠️ CRITICAL: Unimplemented Actions**: All schema actions contain helpful comments but throw unimplemented exceptions - **user must implement these actions themselves**
179
226
 
227
+ ### Optional Enhancements (Only When Explicitly Requested)
228
+ ⚠️ **Custom Actions**: Only implement if user specifically requests custom actions beyond standard CRUD
229
+ ⚠️ **Column Overrides**: Only implement if user requests custom column rendering
230
+ ⚠️ **Custom Components**: Only implement if user requests custom entity page components
231
+ ⚠️ **Bulk Operations**: Only implement if user requests custom bulk actions beyond standard bulk delete
232
+
180
233
  ## Common FQDN-Specific Pitfalls to Avoid
181
234
 
235
+ - **⚠️ 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
182
236
  - **⚠️ 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
183
237
  - **⚠️ CRITICAL: Implementing Actions**: DO NOT implement the schema actions - they should contain helpful comments and throw unimplemented exceptions for the user to complete
184
238
  - **Mismatched Field Types**: Ensure FQDN field types are correctly mapped to AutoPatterns types
@@ -186,16 +240,19 @@ If you need custom actions for your FQDN-based data source, follow the action im
186
240
  - **ID Field Confusion**: Ensure the idField matches what your FQDN API actually uses (often `_id` for Wix APIs)
187
241
  - **Display Field Selection**: Choose a display field that provides meaningful identification from your FQDN schema
188
242
  - **Custom Data Source ID Mismatch**: Ensure the custom.id in AppConfig matches your custom data source identifier
243
+ - **Hook Registration**: Don't forget to register the custom data source through the useCustomDataSources hook
244
+
245
+ For general implementation pitfalls, refer to the "Custom Overrides" section.
189
246
 
190
- For general implementation pitfalls, refer to the `custom_overrides` section.
247
+ ## Advanced Customization (Only When Explicitly Requested)
191
248
 
192
- ## Advanced Customization
249
+ **⚠️ IMPORTANT**: The following customizations should only be implemented when the user explicitly requests them. A basic dashboard page does not require these advanced features.
193
250
 
194
- For advanced customization options, refer to these section IDs:
195
- - `collection_page_actions` - For custom collection-level actions
196
- - `action_cell` - For custom row-level actions
197
- - `bulk_actions` - For custom bulk operations
198
- - `entity_page_actions` - For custom entity-level actions
199
- - `custom_overrides` - For column overrides and custom components
251
+ For advanced customization options when specifically requested, refer to these sections:
252
+ - "Collection Page Actions" - For custom collection-level actions
253
+ - "Action Cell" - For custom row-level actions
254
+ - "Bulk Actions" - For custom bulk operations
255
+ - "Entity Page Actions" - For custom entity-level actions
256
+ - "Custom Overrides" - For column overrides and custom components
200
257
 
201
258
  By following these steps, you'll successfully implement a custom data source that integrates seamlessly with AutoPatternsApp while leveraging Wix Business APIs through their FQDNs.
@@ -17,7 +17,8 @@ export const AutoPatternsTable = _ref => {
17
17
  bulkActionToolbar,
18
18
  onRowClick,
19
19
  stickyColumns,
20
- stickySelectionColumn
20
+ stickySelectionColumn,
21
+ sections
21
22
  } = useTableFeatures(configuration);
22
23
  return /*#__PURE__*/React.createElement(Table, {
23
24
  dataHook: "auto-patterns-table",
@@ -33,7 +34,8 @@ export const AutoPatternsTable = _ref => {
33
34
  onRowClick: onRowClick,
34
35
  horizontalScroll: true,
35
36
  stickyColumns: stickyColumns,
36
- stickySelectionColumn: stickySelectionColumn
37
+ stickySelectionColumn: stickySelectionColumn,
38
+ sections: sections
37
39
  });
38
40
  };
39
41
  //# sourceMappingURL=AutoPatternsTable.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["React","Table","useTableFeatures","AutoPatternsTable","_ref","configuration","state","columns","customColumns","search","title","emptyState","filters","actionCell","bulkActionToolbar","onRowClick","stickyColumns","stickySelectionColumn","createElement","dataHook","horizontalScroll"],"sources":["../../../../src/components/AutoPatternsTable/AutoPatternsTable.tsx"],"sourcesContent":["import React from 'react';\nimport { Table } from '@wix/patterns';\nimport { TableConfig } from '../../types';\nimport { useTableFeatures } from '../../hooks';\n\nexport interface AutoPatternsTableContentProps {\n configuration: TableConfig;\n}\n\nexport const AutoPatternsTable = ({\n configuration,\n}: AutoPatternsTableContentProps) => {\n const {\n state,\n columns,\n customColumns,\n search,\n title,\n emptyState,\n filters,\n actionCell,\n bulkActionToolbar,\n onRowClick,\n stickyColumns,\n stickySelectionColumn,\n } = useTableFeatures(configuration);\n\n return (\n <Table\n dataHook=\"auto-patterns-table\"\n search={search}\n title={title}\n state={state}\n columns={columns}\n customColumns={customColumns}\n actionCell={actionCell}\n filters={filters}\n emptyState={emptyState}\n bulkActionToolbar={bulkActionToolbar}\n onRowClick={onRowClick}\n horizontalScroll\n stickyColumns={stickyColumns}\n stickySelectionColumn={stickySelectionColumn}\n />\n );\n};\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,KAAK,QAAQ,eAAe;AAErC,SAASC,gBAAgB,QAAQ,aAAa;AAM9C,OAAO,MAAMC,iBAAiB,GAAGC,IAAA,IAEI;EAAA,IAFH;IAChCC;EAC6B,CAAC,GAAAD,IAAA;EAC9B,MAAM;IACJE,KAAK;IACLC,OAAO;IACPC,aAAa;IACbC,MAAM;IACNC,KAAK;IACLC,UAAU;IACVC,OAAO;IACPC,UAAU;IACVC,iBAAiB;IACjBC,UAAU;IACVC,aAAa;IACbC;EACF,CAAC,GAAGf,gBAAgB,CAACG,aAAa,CAAC;EAEnC,oBACEL,KAAA,CAAAkB,aAAA,CAACjB,KAAK;IACJkB,QAAQ,EAAC,qBAAqB;IAC9BV,MAAM,EAAEA,MAAO;IACfC,KAAK,EAAEA,KAAM;IACbJ,KAAK,EAAEA,KAAM;IACbC,OAAO,EAAEA,OAAQ;IACjBC,aAAa,EAAEA,aAAc;IAC7BK,UAAU,EAAEA,UAAW;IACvBD,OAAO,EAAEA,OAAQ;IACjBD,UAAU,EAAEA,UAAW;IACvBG,iBAAiB,EAAEA,iBAAkB;IACrCC,UAAU,EAAEA,UAAW;IACvBK,gBAAgB;IAChBJ,aAAa,EAAEA,aAAc;IAC7BC,qBAAqB,EAAEA;EAAsB,CAC9C,CAAC;AAEN,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["React","Table","useTableFeatures","AutoPatternsTable","_ref","configuration","state","columns","customColumns","search","title","emptyState","filters","actionCell","bulkActionToolbar","onRowClick","stickyColumns","stickySelectionColumn","sections","createElement","dataHook","horizontalScroll"],"sources":["../../../../src/components/AutoPatternsTable/AutoPatternsTable.tsx"],"sourcesContent":["import React from 'react';\nimport { Table } from '@wix/patterns';\nimport { TableConfig } from '../../types';\nimport { useTableFeatures } from '../../hooks';\n\nexport interface AutoPatternsTableContentProps {\n configuration: TableConfig;\n}\n\nexport const AutoPatternsTable = ({\n configuration,\n}: AutoPatternsTableContentProps) => {\n const {\n state,\n columns,\n customColumns,\n search,\n title,\n emptyState,\n filters,\n actionCell,\n bulkActionToolbar,\n onRowClick,\n stickyColumns,\n stickySelectionColumn,\n sections,\n } = useTableFeatures(configuration);\n\n return (\n <Table\n dataHook=\"auto-patterns-table\"\n search={search}\n title={title}\n state={state}\n columns={columns}\n customColumns={customColumns}\n actionCell={actionCell}\n filters={filters}\n emptyState={emptyState}\n bulkActionToolbar={bulkActionToolbar}\n onRowClick={onRowClick}\n horizontalScroll\n stickyColumns={stickyColumns}\n stickySelectionColumn={stickySelectionColumn}\n sections={sections}\n />\n );\n};\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,KAAK,QAAQ,eAAe;AAErC,SAASC,gBAAgB,QAAQ,aAAa;AAM9C,OAAO,MAAMC,iBAAiB,GAAGC,IAAA,IAEI;EAAA,IAFH;IAChCC;EAC6B,CAAC,GAAAD,IAAA;EAC9B,MAAM;IACJE,KAAK;IACLC,OAAO;IACPC,aAAa;IACbC,MAAM;IACNC,KAAK;IACLC,UAAU;IACVC,OAAO;IACPC,UAAU;IACVC,iBAAiB;IACjBC,UAAU;IACVC,aAAa;IACbC,qBAAqB;IACrBC;EACF,CAAC,GAAGhB,gBAAgB,CAACG,aAAa,CAAC;EAEnC,oBACEL,KAAA,CAAAmB,aAAA,CAAClB,KAAK;IACJmB,QAAQ,EAAC,qBAAqB;IAC9BX,MAAM,EAAEA,MAAO;IACfC,KAAK,EAAEA,KAAM;IACbJ,KAAK,EAAEA,KAAM;IACbC,OAAO,EAAEA,OAAQ;IACjBC,aAAa,EAAEA,aAAc;IAC7BK,UAAU,EAAEA,UAAW;IACvBD,OAAO,EAAEA,OAAQ;IACjBD,UAAU,EAAEA,UAAW;IACvBG,iBAAiB,EAAEA,iBAAkB;IACrCC,UAAU,EAAEA,UAAW;IACvBM,gBAAgB;IAChBL,aAAa,EAAEA,aAAc;IAC7BC,qBAAqB,EAAEA,qBAAsB;IAC7CC,QAAQ,EAAEA;EAAS,CACpB,CAAC;AAEN,CAAC","ignoreList":[]}
@@ -1,11 +1,13 @@
1
1
  import { useFetchData } from './useFetchData';
2
- import { useTableCollection } from '@wix/patterns';
2
+ import { TableSections, useTableCollection } from '@wix/patterns';
3
3
  import { useCommonCollectionFeatures } from './useCommonCollectionFeatures';
4
4
  import { useFilters } from './useFilters';
5
5
  import { useSchema } from '../providers/SchemaContext';
6
6
  import { useAutoPatternsOptimisticActions } from './useAutoPatternsOptimisticActions';
7
7
  import { useBaseTableFeatures } from './useBaseTableFeatures';
8
+ import { usePatternsWizardOverridesContext } from '../providers/PatternsWizardOverridesContext';
8
9
  export const useTableFeatures = configuration => {
10
+ var _configuration$sectio, _overrides$sections;
9
11
  const {
10
12
  collectionId,
11
13
  limit,
@@ -33,6 +35,7 @@ export const useTableFeatures = configuration => {
33
35
  filterFieldMapping
34
36
  });
35
37
  const schema = useSchema();
38
+ const overrides = usePatternsWizardOverridesContext();
36
39
  const state = useTableCollection({
37
40
  queryName: `${collectionId}`,
38
41
  itemKey: item => item[schema.idField],
@@ -56,6 +59,10 @@ export const useTableFeatures = configuration => {
56
59
  ...configuration,
57
60
  optimisticActions
58
61
  });
62
+ const sections = (_configuration$sectio = configuration.sections) != null && _configuration$sectio.id && overrides != null && (_overrides$sections = overrides.sections) != null && _overrides$sections[configuration.sections.id] ? {
63
+ renderSection: overrides.sections[configuration.sections.id],
64
+ TableSections
65
+ } : undefined;
59
66
  return {
60
67
  ...commonFeatures,
61
68
  state,
@@ -65,7 +72,8 @@ export const useTableFeatures = configuration => {
65
72
  customColumns,
66
73
  onRowClick,
67
74
  stickyColumns,
68
- stickySelectionColumn
75
+ stickySelectionColumn,
76
+ sections
69
77
  };
70
78
  };
71
79
  //# sourceMappingURL=useTableFeatures.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["useFetchData","useTableCollection","useCommonCollectionFeatures","useFilters","useSchema","useAutoPatternsOptimisticActions","useBaseTableFeatures","useTableFeatures","configuration","collectionId","limit","reflectQueryInUrl","selectAllScope","selectionUpdateMode","collection","filterComponent","filtersObject","filterFieldMapping","filters","customColumns","visibleFieldIds","columns","onRowClick","stickyColumns","stickySelectionColumn","fetchData","searchableFieldIds","schema","state","queryName","itemKey","item","idField","itemName","displayField","toExtendedFields","extendedFields","fetchErrorMessage","_ref","err","String","persistQueryToUrl","disableAutoSelectAllCount","selectionConsistencyMode","optimisticActions","commonFeatures"],"sources":["../../../src/hooks/useTableFeatures.tsx"],"sourcesContent":["import { TableConfig } from '../types';\nimport { useFetchData } from './useFetchData';\nimport { useTableCollection } from '@wix/patterns';\nimport { useCommonCollectionFeatures } from './useCommonCollectionFeatures';\nimport { useFilters } from './useFilters';\nimport { useSchema } from '../providers/SchemaContext';\nimport { useAutoPatternsOptimisticActions } from './useAutoPatternsOptimisticActions';\nimport { useBaseTableFeatures } from './useBaseTableFeatures';\n\nexport const useTableFeatures = (configuration: TableConfig) => {\n const {\n collectionId,\n limit,\n reflectQueryInUrl,\n selectAllScope,\n selectionUpdateMode,\n } = configuration.collection;\n\n const { filterComponent, filtersObject, filterFieldMapping } = useFilters(\n configuration.filters,\n );\n const {\n customColumns,\n visibleFieldIds,\n columns,\n onRowClick,\n stickyColumns,\n stickySelectionColumn,\n } = useBaseTableFeatures(configuration);\n\n const { fetchData } = useFetchData({\n searchableFieldIds: visibleFieldIds,\n filterFieldMapping,\n });\n\n const schema = useSchema();\n\n const state = useTableCollection<any>({\n queryName: `${collectionId}`,\n itemKey: (item) => item[schema.idField],\n itemName: (item) => item[schema.displayField],\n filters: filtersObject,\n toExtendedFields: (item) => item.extendedFields,\n fetchErrorMessage: ({ err }) => String(err),\n fetchData,\n limit,\n persistQueryToUrl: reflectQueryInUrl,\n disableAutoSelectAllCount: selectAllScope === 'page',\n selectionConsistencyMode: selectionUpdateMode,\n });\n\n const optimisticActions = useAutoPatternsOptimisticActions(\n collectionId,\n state.collection,\n );\n\n const commonFeatures = useCommonCollectionFeatures({\n ...configuration,\n optimisticActions,\n });\n\n return {\n ...commonFeatures,\n state,\n columns,\n filters: filterComponent,\n optimisticActions,\n customColumns,\n onRowClick,\n stickyColumns,\n stickySelectionColumn,\n };\n};\n"],"mappings":"AACA,SAASA,YAAY,QAAQ,gBAAgB;AAC7C,SAASC,kBAAkB,QAAQ,eAAe;AAClD,SAASC,2BAA2B,QAAQ,+BAA+B;AAC3E,SAASC,UAAU,QAAQ,cAAc;AACzC,SAASC,SAAS,QAAQ,4BAA4B;AACtD,SAASC,gCAAgC,QAAQ,oCAAoC;AACrF,SAASC,oBAAoB,QAAQ,wBAAwB;AAE7D,OAAO,MAAMC,gBAAgB,GAAIC,aAA0B,IAAK;EAC9D,MAAM;IACJC,YAAY;IACZC,KAAK;IACLC,iBAAiB;IACjBC,cAAc;IACdC;EACF,CAAC,GAAGL,aAAa,CAACM,UAAU;EAE5B,MAAM;IAAEC,eAAe;IAAEC,aAAa;IAAEC;EAAmB,CAAC,GAAGd,UAAU,CACvEK,aAAa,CAACU,OAChB,CAAC;EACD,MAAM;IACJC,aAAa;IACbC,eAAe;IACfC,OAAO;IACPC,UAAU;IACVC,aAAa;IACbC;EACF,CAAC,GAAGlB,oBAAoB,CAACE,aAAa,CAAC;EAEvC,MAAM;IAAEiB;EAAU,CAAC,GAAGzB,YAAY,CAAC;IACjC0B,kBAAkB,EAAEN,eAAe;IACnCH;EACF,CAAC,CAAC;EAEF,MAAMU,MAAM,GAAGvB,SAAS,CAAC,CAAC;EAE1B,MAAMwB,KAAK,GAAG3B,kBAAkB,CAAM;IACpC4B,SAAS,EAAE,GAAGpB,YAAY,EAAE;IAC5BqB,OAAO,EAAGC,IAAI,IAAKA,IAAI,CAACJ,MAAM,CAACK,OAAO,CAAC;IACvCC,QAAQ,EAAGF,IAAI,IAAKA,IAAI,CAACJ,MAAM,CAACO,YAAY,CAAC;IAC7ChB,OAAO,EAAEF,aAAa;IACtBmB,gBAAgB,EAAGJ,IAAI,IAAKA,IAAI,CAACK,cAAc;IAC/CC,iBAAiB,EAAEC,IAAA;MAAA,IAAC;QAAEC;MAAI,CAAC,GAAAD,IAAA;MAAA,OAAKE,MAAM,CAACD,GAAG,CAAC;IAAA;IAC3Cd,SAAS;IACTf,KAAK;IACL+B,iBAAiB,EAAE9B,iBAAiB;IACpC+B,yBAAyB,EAAE9B,cAAc,KAAK,MAAM;IACpD+B,wBAAwB,EAAE9B;EAC5B,CAAC,CAAC;EAEF,MAAM+B,iBAAiB,GAAGvC,gCAAgC,CACxDI,YAAY,EACZmB,KAAK,CAACd,UACR,CAAC;EAED,MAAM+B,cAAc,GAAG3C,2BAA2B,CAAC;IACjD,GAAGM,aAAa;IAChBoC;EACF,CAAC,CAAC;EAEF,OAAO;IACL,GAAGC,cAAc;IACjBjB,KAAK;IACLP,OAAO;IACPH,OAAO,EAAEH,eAAe;IACxB6B,iBAAiB;IACjBzB,aAAa;IACbG,UAAU;IACVC,aAAa;IACbC;EACF,CAAC;AACH,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["useFetchData","TableSections","useTableCollection","useCommonCollectionFeatures","useFilters","useSchema","useAutoPatternsOptimisticActions","useBaseTableFeatures","usePatternsWizardOverridesContext","useTableFeatures","configuration","_configuration$sectio","_overrides$sections","collectionId","limit","reflectQueryInUrl","selectAllScope","selectionUpdateMode","collection","filterComponent","filtersObject","filterFieldMapping","filters","customColumns","visibleFieldIds","columns","onRowClick","stickyColumns","stickySelectionColumn","fetchData","searchableFieldIds","schema","overrides","state","queryName","itemKey","item","idField","itemName","displayField","toExtendedFields","extendedFields","fetchErrorMessage","_ref","err","String","persistQueryToUrl","disableAutoSelectAllCount","selectionConsistencyMode","optimisticActions","commonFeatures","sections","id","renderSection","undefined"],"sources":["../../../src/hooks/useTableFeatures.tsx"],"sourcesContent":["import { TableConfig } from '../types';\nimport { useFetchData } from './useFetchData';\nimport { TableSections, useTableCollection } from '@wix/patterns';\nimport { useCommonCollectionFeatures } from './useCommonCollectionFeatures';\nimport { useFilters } from './useFilters';\nimport { useSchema } from '../providers/SchemaContext';\nimport { useAutoPatternsOptimisticActions } from './useAutoPatternsOptimisticActions';\nimport { useBaseTableFeatures } from './useBaseTableFeatures';\nimport { usePatternsWizardOverridesContext } from '../providers/PatternsWizardOverridesContext';\n\nexport const useTableFeatures = (configuration: TableConfig) => {\n const {\n collectionId,\n limit,\n reflectQueryInUrl,\n selectAllScope,\n selectionUpdateMode,\n } = configuration.collection;\n\n const { filterComponent, filtersObject, filterFieldMapping } = useFilters(\n configuration.filters,\n );\n const {\n customColumns,\n visibleFieldIds,\n columns,\n onRowClick,\n stickyColumns,\n stickySelectionColumn,\n } = useBaseTableFeatures(configuration);\n\n const { fetchData } = useFetchData({\n searchableFieldIds: visibleFieldIds,\n filterFieldMapping,\n });\n\n const schema = useSchema();\n const overrides = usePatternsWizardOverridesContext();\n\n const state = useTableCollection<any>({\n queryName: `${collectionId}`,\n itemKey: (item) => item[schema.idField],\n itemName: (item) => item[schema.displayField],\n filters: filtersObject,\n toExtendedFields: (item) => item.extendedFields,\n fetchErrorMessage: ({ err }) => String(err),\n fetchData,\n limit,\n persistQueryToUrl: reflectQueryInUrl,\n disableAutoSelectAllCount: selectAllScope === 'page',\n selectionConsistencyMode: selectionUpdateMode,\n });\n\n const optimisticActions = useAutoPatternsOptimisticActions(\n collectionId,\n state.collection,\n );\n\n const commonFeatures = useCommonCollectionFeatures({\n ...configuration,\n optimisticActions,\n });\n\n const sections =\n configuration.sections?.id &&\n overrides?.sections?.[configuration.sections.id]\n ? {\n renderSection: overrides.sections[configuration.sections.id],\n TableSections,\n }\n : undefined;\n\n return {\n ...commonFeatures,\n state,\n columns,\n filters: filterComponent,\n optimisticActions,\n customColumns,\n onRowClick,\n stickyColumns,\n stickySelectionColumn,\n sections,\n };\n};\n"],"mappings":"AACA,SAASA,YAAY,QAAQ,gBAAgB;AAC7C,SAASC,aAAa,EAAEC,kBAAkB,QAAQ,eAAe;AACjE,SAASC,2BAA2B,QAAQ,+BAA+B;AAC3E,SAASC,UAAU,QAAQ,cAAc;AACzC,SAASC,SAAS,QAAQ,4BAA4B;AACtD,SAASC,gCAAgC,QAAQ,oCAAoC;AACrF,SAASC,oBAAoB,QAAQ,wBAAwB;AAC7D,SAASC,iCAAiC,QAAQ,6CAA6C;AAE/F,OAAO,MAAMC,gBAAgB,GAAIC,aAA0B,IAAK;EAAA,IAAAC,qBAAA,EAAAC,mBAAA;EAC9D,MAAM;IACJC,YAAY;IACZC,KAAK;IACLC,iBAAiB;IACjBC,cAAc;IACdC;EACF,CAAC,GAAGP,aAAa,CAACQ,UAAU;EAE5B,MAAM;IAAEC,eAAe;IAAEC,aAAa;IAAEC;EAAmB,CAAC,GAAGjB,UAAU,CACvEM,aAAa,CAACY,OAChB,CAAC;EACD,MAAM;IACJC,aAAa;IACbC,eAAe;IACfC,OAAO;IACPC,UAAU;IACVC,aAAa;IACbC;EACF,CAAC,GAAGrB,oBAAoB,CAACG,aAAa,CAAC;EAEvC,MAAM;IAAEmB;EAAU,CAAC,GAAG7B,YAAY,CAAC;IACjC8B,kBAAkB,EAAEN,eAAe;IACnCH;EACF,CAAC,CAAC;EAEF,MAAMU,MAAM,GAAG1B,SAAS,CAAC,CAAC;EAC1B,MAAM2B,SAAS,GAAGxB,iCAAiC,CAAC,CAAC;EAErD,MAAMyB,KAAK,GAAG/B,kBAAkB,CAAM;IACpCgC,SAAS,EAAE,GAAGrB,YAAY,EAAE;IAC5BsB,OAAO,EAAGC,IAAI,IAAKA,IAAI,CAACL,MAAM,CAACM,OAAO,CAAC;IACvCC,QAAQ,EAAGF,IAAI,IAAKA,IAAI,CAACL,MAAM,CAACQ,YAAY,CAAC;IAC7CjB,OAAO,EAAEF,aAAa;IACtBoB,gBAAgB,EAAGJ,IAAI,IAAKA,IAAI,CAACK,cAAc;IAC/CC,iBAAiB,EAAEC,IAAA;MAAA,IAAC;QAAEC;MAAI,CAAC,GAAAD,IAAA;MAAA,OAAKE,MAAM,CAACD,GAAG,CAAC;IAAA;IAC3Cf,SAAS;IACTf,KAAK;IACLgC,iBAAiB,EAAE/B,iBAAiB;IACpCgC,yBAAyB,EAAE/B,cAAc,KAAK,MAAM;IACpDgC,wBAAwB,EAAE/B;EAC5B,CAAC,CAAC;EAEF,MAAMgC,iBAAiB,GAAG3C,gCAAgC,CACxDO,YAAY,EACZoB,KAAK,CAACf,UACR,CAAC;EAED,MAAMgC,cAAc,GAAG/C,2BAA2B,CAAC;IACjD,GAAGO,aAAa;IAChBuC;EACF,CAAC,CAAC;EAEF,MAAME,QAAQ,GACZ,CAAAxC,qBAAA,GAAAD,aAAa,CAACyC,QAAQ,aAAtBxC,qBAAA,CAAwByC,EAAE,IAC1BpB,SAAS,aAAApB,mBAAA,GAAToB,SAAS,CAAEmB,QAAQ,aAAnBvC,mBAAA,CAAsBF,aAAa,CAACyC,QAAQ,CAACC,EAAE,CAAC,GAC5C;IACEC,aAAa,EAAErB,SAAS,CAACmB,QAAQ,CAACzC,aAAa,CAACyC,QAAQ,CAACC,EAAE,CAAC;IAC5DnD;EACF,CAAC,GACDqD,SAAS;EAEf,OAAO;IACL,GAAGJ,cAAc;IACjBjB,KAAK;IACLR,OAAO;IACPH,OAAO,EAAEH,eAAe;IACxB8B,iBAAiB;IACjB1B,aAAa;IACbG,UAAU;IACVC,aAAa;IACbC,qBAAqB;IACrBuB;EACF,CAAC;AACH,CAAC","ignoreList":[]}
@@ -0,0 +1,44 @@
1
+ import React, { createContext, useContext, useState, useCallback } from 'react';
2
+ import { PageErrorState } from '@wix/patterns';
3
+ const ErrorContext = /*#__PURE__*/createContext(undefined);
4
+ export const ErrorProvider = _ref => {
5
+ let {
6
+ children
7
+ } = _ref;
8
+ const [errorState, setErrorState] = useState({
9
+ hasError: false,
10
+ error: null
11
+ });
12
+ const showError = useCallback(error => {
13
+ const errorObj = typeof error === 'string' ? new Error(error) : error;
14
+ setErrorState({
15
+ hasError: true,
16
+ error: errorObj
17
+ });
18
+ }, []);
19
+ const clearError = useCallback(() => {
20
+ setErrorState({
21
+ hasError: false,
22
+ error: null
23
+ });
24
+ }, []);
25
+ if (errorState.hasError && errorState.error) {
26
+ return /*#__PURE__*/React.createElement(PageErrorState, {
27
+ subtitle: errorState.error.message
28
+ });
29
+ }
30
+ return /*#__PURE__*/React.createElement(ErrorContext.Provider, {
31
+ value: {
32
+ showError,
33
+ clearError
34
+ }
35
+ }, children);
36
+ };
37
+ export const useError = () => {
38
+ const context = useContext(ErrorContext);
39
+ if (!context) {
40
+ throw new Error('useError must be used within an ErrorProvider');
41
+ }
42
+ return context;
43
+ };
44
+ //# sourceMappingURL=ErrorContext.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["React","createContext","useContext","useState","useCallback","PageErrorState","ErrorContext","undefined","ErrorProvider","_ref","children","errorState","setErrorState","hasError","error","showError","errorObj","Error","clearError","createElement","subtitle","message","Provider","value","useError","context"],"sources":["../../../src/providers/ErrorContext.tsx"],"sourcesContent":["import React, {\n createContext,\n useContext,\n useState,\n useCallback,\n ReactNode,\n} from 'react';\nimport { PageErrorState } from '@wix/patterns';\n\ninterface ErrorState {\n hasError: boolean;\n error: Error | null;\n}\n\ninterface ErrorContextType {\n showError: (error: Error) => void;\n clearError: () => void;\n}\n\nconst ErrorContext = createContext<ErrorContextType | undefined>(undefined);\n\nexport const ErrorProvider: React.FC<{ children: ReactNode }> = ({\n children,\n}) => {\n const [errorState, setErrorState] = useState<ErrorState>({\n hasError: false,\n error: null,\n });\n\n const showError = useCallback((error: Error | string) => {\n const errorObj = typeof error === 'string' ? new Error(error) : error;\n setErrorState({\n hasError: true,\n error: errorObj,\n });\n }, []);\n\n const clearError = useCallback(() => {\n setErrorState({\n hasError: false,\n error: null,\n });\n }, []);\n\n if (errorState.hasError && errorState.error) {\n return <PageErrorState subtitle={errorState.error.message} />;\n }\n\n return (\n <ErrorContext.Provider value={{ showError, clearError }}>\n {children}\n </ErrorContext.Provider>\n );\n};\n\nexport const useError = (): ErrorContextType => {\n const context = useContext(ErrorContext);\n if (!context) {\n throw new Error('useError must be used within an ErrorProvider');\n }\n return context;\n};\n"],"mappings":"AAAA,OAAOA,KAAK,IACVC,aAAa,EACbC,UAAU,EACVC,QAAQ,EACRC,WAAW,QAEN,OAAO;AACd,SAASC,cAAc,QAAQ,eAAe;AAY9C,MAAMC,YAAY,gBAAGL,aAAa,CAA+BM,SAAS,CAAC;AAE3E,OAAO,MAAMC,aAAgD,GAAGC,IAAA,IAE1D;EAAA,IAF2D;IAC/DC;EACF,CAAC,GAAAD,IAAA;EACC,MAAM,CAACE,UAAU,EAAEC,aAAa,CAAC,GAAGT,QAAQ,CAAa;IACvDU,QAAQ,EAAE,KAAK;IACfC,KAAK,EAAE;EACT,CAAC,CAAC;EAEF,MAAMC,SAAS,GAAGX,WAAW,CAAEU,KAAqB,IAAK;IACvD,MAAME,QAAQ,GAAG,OAAOF,KAAK,KAAK,QAAQ,GAAG,IAAIG,KAAK,CAACH,KAAK,CAAC,GAAGA,KAAK;IACrEF,aAAa,CAAC;MACZC,QAAQ,EAAE,IAAI;MACdC,KAAK,EAAEE;IACT,CAAC,CAAC;EACJ,CAAC,EAAE,EAAE,CAAC;EAEN,MAAME,UAAU,GAAGd,WAAW,CAAC,MAAM;IACnCQ,aAAa,CAAC;MACZC,QAAQ,EAAE,KAAK;MACfC,KAAK,EAAE;IACT,CAAC,CAAC;EACJ,CAAC,EAAE,EAAE,CAAC;EAEN,IAAIH,UAAU,CAACE,QAAQ,IAAIF,UAAU,CAACG,KAAK,EAAE;IAC3C,oBAAOd,KAAA,CAAAmB,aAAA,CAACd,cAAc;MAACe,QAAQ,EAAET,UAAU,CAACG,KAAK,CAACO;IAAQ,CAAE,CAAC;EAC/D;EAEA,oBACErB,KAAA,CAAAmB,aAAA,CAACb,YAAY,CAACgB,QAAQ;IAACC,KAAK,EAAE;MAAER,SAAS;MAAEG;IAAW;EAAE,GACrDR,QACoB,CAAC;AAE5B,CAAC;AAED,OAAO,MAAMc,QAAQ,GAAGA,CAAA,KAAwB;EAC9C,MAAMC,OAAO,GAAGvB,UAAU,CAACI,YAAY,CAAC;EACxC,IAAI,CAACmB,OAAO,EAAE;IACZ,MAAM,IAAIR,KAAK,CAAC,+CAA+C,CAAC;EAClE;EACA,OAAOQ,OAAO;AAChB,CAAC","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"names":["React","createContext","useContext","PatternsWizardOverridesContext","undefined","PatternsWizardOverridesProvider","_ref","children","value","createElement","Provider","usePatternsWizardOverridesContext"],"sources":["../../../src/providers/PatternsWizardOverridesContext.tsx"],"sourcesContent":["import React, { createContext, useContext, ReactNode } from 'react';\nimport {\n CustomComponentProps,\n EntityPageMoreActionsActionParams,\n IColumnValue,\n SchemaConfig,\n} from '../types';\n\nimport { CustomActionParams, ResolvedAction } from '../utils/actions/types';\nimport {\n CollectionPageActionOnRowClickParams,\n CollectionPageActionParams,\n} from '../types/actions/collectionPageActions';\nimport { ActionCellActionParams } from '../types/actions/actionCell';\n\nexport interface PatternsWizardOverridesContextProps {\n actions?: Record<\n string,\n (\n props: CustomActionParams<\n | EntityPageMoreActionsActionParams\n | CollectionPageActionParams\n | ActionCellActionParams\n | CollectionPageActionOnRowClickParams\n >,\n ) => ResolvedAction\n >;\n columns?: Record<string, (props: IColumnValue<any>) => void>;\n modals?: Record<string, React.FC<any>>;\n HeaderAddon?: React.FC;\n emptyState?: Record<string, () => void>;\n components?: Record<string, React.FC<CustomComponentProps>>;\n customDataSources?: Record<\n string,\n (collectionId: string, context: any) => Promise<SchemaConfig>\n >;\n}\n\nconst PatternsWizardOverridesContext = createContext<\n PatternsWizardOverridesContextProps | undefined\n>(undefined);\n\nexport const PatternsWizardOverridesProvider: React.FC<{\n children: ReactNode;\n value: PatternsWizardOverridesContextProps;\n}> = ({ children, value }) => {\n return (\n <PatternsWizardOverridesContext.Provider value={value}>\n {children}\n </PatternsWizardOverridesContext.Provider>\n );\n};\n\nexport const usePatternsWizardOverridesContext = ():\n | PatternsWizardOverridesContextProps\n | undefined => {\n return useContext(PatternsWizardOverridesContext);\n};\n"],"mappings":"AAAA,OAAOA,KAAK,IAAIC,aAAa,EAAEC,UAAU,QAAmB,OAAO;AAsCnE,MAAMC,8BAA8B,gBAAGF,aAAa,CAElDG,SAAS,CAAC;AAEZ,OAAO,MAAMC,+BAGX,GAAGC,IAAA,IAAyB;EAAA,IAAxB;IAAEC,QAAQ;IAAEC;EAAM,CAAC,GAAAF,IAAA;EACvB,oBACEN,KAAA,CAAAS,aAAA,CAACN,8BAA8B,CAACO,QAAQ;IAACF,KAAK,EAAEA;EAAM,GACnDD,QACsC,CAAC;AAE9C,CAAC;AAED,OAAO,MAAMI,iCAAiC,GAAGA,CAAA,KAEhC;EACf,OAAOT,UAAU,CAACC,8BAA8B,CAAC;AACnD,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["React","createContext","useContext","PatternsWizardOverridesContext","undefined","PatternsWizardOverridesProvider","_ref","children","value","createElement","Provider","usePatternsWizardOverridesContext"],"sources":["../../../src/providers/PatternsWizardOverridesContext.tsx"],"sourcesContent":["import React, { createContext, useContext, ReactNode } from 'react';\nimport {\n CustomComponentProps,\n EntityPageMoreActionsActionParams,\n IColumnValue,\n SchemaConfig,\n} from '../types';\n\nimport { Section } from '@wix/patterns';\n\nimport { CustomActionParams, ResolvedAction } from '../utils/actions/types';\nimport {\n CollectionPageActionOnRowClickParams,\n CollectionPageActionParams,\n} from '../types/actions/collectionPageActions';\nimport { ActionCellActionParams } from '../types/actions/actionCell';\n\nexport interface PatternsWizardOverridesContextProps {\n actions?: Record<\n string,\n (\n props: CustomActionParams<\n | EntityPageMoreActionsActionParams\n | CollectionPageActionParams\n | ActionCellActionParams\n | CollectionPageActionOnRowClickParams\n >,\n ) => ResolvedAction\n >;\n columns?: Record<string, (props: IColumnValue<any>) => void>;\n modals?: Record<string, React.FC<any>>;\n HeaderAddon?: React.FC;\n emptyState?: Record<string, () => void>;\n components?: Record<string, React.FC<CustomComponentProps>>;\n customDataSources?: Record<\n string,\n (collectionId: string, context: any) => Promise<SchemaConfig>\n >;\n sections?: Record<string, (item: any) => Section>;\n}\n\nconst PatternsWizardOverridesContext = createContext<\n PatternsWizardOverridesContextProps | undefined\n>(undefined);\n\nexport const PatternsWizardOverridesProvider: React.FC<{\n children: ReactNode;\n value: PatternsWizardOverridesContextProps;\n}> = ({ children, value }) => {\n return (\n <PatternsWizardOverridesContext.Provider value={value}>\n {children}\n </PatternsWizardOverridesContext.Provider>\n );\n};\n\nexport const usePatternsWizardOverridesContext = ():\n | PatternsWizardOverridesContextProps\n | undefined => {\n return useContext(PatternsWizardOverridesContext);\n};\n"],"mappings":"AAAA,OAAOA,KAAK,IAAIC,aAAa,EAAEC,UAAU,QAAmB,OAAO;AAyCnE,MAAMC,8BAA8B,gBAAGF,aAAa,CAElDG,SAAS,CAAC;AAEZ,OAAO,MAAMC,+BAGX,GAAGC,IAAA,IAAyB;EAAA,IAAxB;IAAEC,QAAQ;IAAEC;EAAM,CAAC,GAAAF,IAAA;EACvB,oBACEN,KAAA,CAAAS,aAAA,CAACN,8BAA8B,CAACO,QAAQ;IAACF,KAAK,EAAEA;EAAM,GACnDD,QACsC,CAAC;AAE9C,CAAC;AAED,OAAO,MAAMI,iCAAiC,GAAGA,CAAA,KAEhC;EACf,OAAOT,UAAU,CAACC,8BAA8B,CAAC;AACnD,CAAC","ignoreList":[]}
@@ -3,6 +3,7 @@ import { AppConfigProvider } from './AppConfigContext';
3
3
  import { ModalProvider } from './ModalContext';
4
4
  import { SchemaRegistryProvider } from './SchemaRegistryContext';
5
5
  import { OptimisticActionsProvider } from './OptimisticActionsContext';
6
+ import { ErrorProvider } from './ErrorContext';
6
7
  export const RootAppProvider = _ref => {
7
8
  let {
8
9
  appConfig,
@@ -10,6 +11,6 @@ export const RootAppProvider = _ref => {
10
11
  } = _ref;
11
12
  return /*#__PURE__*/React.createElement(AppConfigProvider, {
12
13
  appConfig: appConfig
13
- }, /*#__PURE__*/React.createElement(SchemaRegistryProvider, null, /*#__PURE__*/React.createElement(OptimisticActionsProvider, null, /*#__PURE__*/React.createElement(ModalProvider, null, children))));
14
+ }, /*#__PURE__*/React.createElement(ErrorProvider, null, /*#__PURE__*/React.createElement(SchemaRegistryProvider, null, /*#__PURE__*/React.createElement(OptimisticActionsProvider, null, /*#__PURE__*/React.createElement(ModalProvider, null, children)))));
14
15
  };
15
16
  //# sourceMappingURL=RootAppProvider.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["React","AppConfigProvider","ModalProvider","SchemaRegistryProvider","OptimisticActionsProvider","RootAppProvider","_ref","appConfig","children","createElement"],"sources":["../../../src/providers/RootAppProvider.tsx"],"sourcesContent":["import React, { ReactNode } from 'react';\nimport { AppConfig } from '../types';\nimport { AppConfigProvider } from './AppConfigContext';\nimport { ModalProvider } from './ModalContext';\nimport { SchemaRegistryProvider } from './SchemaRegistryContext';\nimport { OptimisticActionsProvider } from './OptimisticActionsContext';\n\nexport const RootAppProvider = ({\n appConfig,\n children,\n}: {\n appConfig: AppConfig;\n children: ReactNode;\n}) => {\n return (\n <AppConfigProvider appConfig={appConfig}>\n <SchemaRegistryProvider>\n <OptimisticActionsProvider>\n <ModalProvider>{children}</ModalProvider>\n </OptimisticActionsProvider>\n </SchemaRegistryProvider>\n </AppConfigProvider>\n );\n};\n"],"mappings":"AAAA,OAAOA,KAAK,MAAqB,OAAO;AAExC,SAASC,iBAAiB,QAAQ,oBAAoB;AACtD,SAASC,aAAa,QAAQ,gBAAgB;AAC9C,SAASC,sBAAsB,QAAQ,yBAAyB;AAChE,SAASC,yBAAyB,QAAQ,4BAA4B;AAEtE,OAAO,MAAMC,eAAe,GAAGC,IAAA,IAMzB;EAAA,IAN0B;IAC9BC,SAAS;IACTC;EAIF,CAAC,GAAAF,IAAA;EACC,oBACEN,KAAA,CAAAS,aAAA,CAACR,iBAAiB;IAACM,SAAS,EAAEA;EAAU,gBACtCP,KAAA,CAAAS,aAAA,CAACN,sBAAsB,qBACrBH,KAAA,CAAAS,aAAA,CAACL,yBAAyB,qBACxBJ,KAAA,CAAAS,aAAA,CAACP,aAAa,QAAEM,QAAwB,CACf,CACL,CACP,CAAC;AAExB,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["React","AppConfigProvider","ModalProvider","SchemaRegistryProvider","OptimisticActionsProvider","ErrorProvider","RootAppProvider","_ref","appConfig","children","createElement"],"sources":["../../../src/providers/RootAppProvider.tsx"],"sourcesContent":["import React, { ReactNode } from 'react';\nimport { AppConfig } from '../types';\nimport { AppConfigProvider } from './AppConfigContext';\nimport { ModalProvider } from './ModalContext';\nimport { SchemaRegistryProvider } from './SchemaRegistryContext';\nimport { OptimisticActionsProvider } from './OptimisticActionsContext';\nimport { ErrorProvider } from './ErrorContext';\n\nexport const RootAppProvider = ({\n appConfig,\n children,\n}: {\n appConfig: AppConfig;\n children: ReactNode;\n}) => {\n return (\n <AppConfigProvider appConfig={appConfig}>\n <ErrorProvider>\n <SchemaRegistryProvider>\n <OptimisticActionsProvider>\n <ModalProvider>{children}</ModalProvider>\n </OptimisticActionsProvider>\n </SchemaRegistryProvider>\n </ErrorProvider>\n </AppConfigProvider>\n );\n};\n"],"mappings":"AAAA,OAAOA,KAAK,MAAqB,OAAO;AAExC,SAASC,iBAAiB,QAAQ,oBAAoB;AACtD,SAASC,aAAa,QAAQ,gBAAgB;AAC9C,SAASC,sBAAsB,QAAQ,yBAAyB;AAChE,SAASC,yBAAyB,QAAQ,4BAA4B;AACtE,SAASC,aAAa,QAAQ,gBAAgB;AAE9C,OAAO,MAAMC,eAAe,GAAGC,IAAA,IAMzB;EAAA,IAN0B;IAC9BC,SAAS;IACTC;EAIF,CAAC,GAAAF,IAAA;EACC,oBACEP,KAAA,CAAAU,aAAA,CAACT,iBAAiB;IAACO,SAAS,EAAEA;EAAU,gBACtCR,KAAA,CAAAU,aAAA,CAACL,aAAa,qBACZL,KAAA,CAAAU,aAAA,CAACP,sBAAsB,qBACrBH,KAAA,CAAAU,aAAA,CAACN,yBAAyB,qBACxBJ,KAAA,CAAAU,aAAA,CAACR,aAAa,QAAEO,QAAwB,CACf,CACL,CACX,CACE,CAAC;AAExB,CAAC","ignoreList":[]}
@@ -3,6 +3,7 @@ import { getSchema } from '../dataSourceAdapters/factory';
3
3
  import { useSchemaRegistry } from './SchemaRegistryContext';
4
4
  import { usePatternsWizardOverridesContext } from './PatternsWizardOverridesContext';
5
5
  import { useWixPatternsContainer } from '@wix/patterns';
6
+ import { useError } from './ErrorContext';
6
7
  const SchemaContext = /*#__PURE__*/createContext(null);
7
8
  export const SchemaProvider = _ref => {
8
9
  var _collection$custom;
@@ -20,6 +21,9 @@ export const SchemaProvider = _ref => {
20
21
  getSchema: getSchemaFromRegistry,
21
22
  addSchema: addSchemaToRegistry
22
23
  } = useSchemaRegistry();
24
+ const {
25
+ showError
26
+ } = useError();
23
27
  const [schema, setSchema] = useState(null);
24
28
  const [isLoading, setIsLoading] = useState(false);
25
29
  const overrides = usePatternsWizardOverridesContext();
@@ -77,10 +81,11 @@ export const SchemaProvider = _ref => {
77
81
  await fetchReferencedSchemas(fetchedSchema);
78
82
  }).catch(error => {
79
83
  console.error('Error fetching schema config:', error);
84
+ showError(error);
80
85
  }).finally(() => {
81
86
  setIsLoading(false);
82
87
  });
83
- }, [collectionId, entityTypeSource, customDataSourceId, addSchemaToRegistry, getSchemaFromRegistry, overrides, httpClient]);
88
+ }, [collectionId, entityTypeSource, customDataSourceId, addSchemaToRegistry, getSchemaFromRegistry, overrides, httpClient, showError]);
84
89
  if (!schema || isLoading) {
85
90
  return skeleton;
86
91
  }
@@ -1 +1 @@
1
- {"version":3,"names":["React","createContext","useContext","useEffect","useState","getSchema","useSchemaRegistry","usePatternsWizardOverridesContext","useWixPatternsContainer","SchemaContext","SchemaProvider","_ref","_collection$custom","collection","children","skeleton","collectionId","entityTypeSource","customDataSourceId","custom","id","undefined","getSchemaFromRegistry","addSchema","addSchemaToRegistry","schema","setSchema","isLoading","setIsLoading","overrides","httpClient","fetchSchemaForCollection","targetCollectionId","targetCustomDataSourceId","customDataSources","customSchemaProvider","Error","fetchReferencedSchemas","referencedSchema","referencedCollectionIds","Set","Object","values","fields","forEach","field","type","referenceMetadata","referencedCollectionId","add","size","fetchPromises","Array","from","map","refCollectionId","refSchema","error","console","Promise","all","cachedSchema","then","fetchedSchema","catch","finally","createElement","Provider","value","useSchema","context"],"sources":["../../../src/providers/SchemaContext.tsx"],"sourcesContent":["import React, {\n createContext,\n useContext,\n useEffect,\n useState,\n ReactNode,\n} from 'react';\n\nimport { SchemaConfig, BaseCollectionConfig } from '../types';\nimport { getSchema } from '../dataSourceAdapters/factory';\nimport { useSchemaRegistry } from './SchemaRegistryContext';\nimport { usePatternsWizardOverridesContext } from './PatternsWizardOverridesContext';\nimport { useWixPatternsContainer } from '@wix/patterns';\n\nconst SchemaContext = createContext<SchemaConfig | null>(null);\n\ninterface SchemaProviderProps {\n collection: BaseCollectionConfig;\n children: ReactNode;\n skeleton: JSX.Element;\n}\n\nexport const SchemaProvider = ({\n collection,\n children,\n skeleton,\n}: SchemaProviderProps) => {\n const { collectionId, entityTypeSource } = collection;\n const customDataSourceId =\n collection.entityTypeSource === 'custom' && 'custom' in collection\n ? collection.custom?.id\n : undefined;\n const { getSchema: getSchemaFromRegistry, addSchema: addSchemaToRegistry } =\n useSchemaRegistry();\n const [schema, setSchema] = useState<SchemaConfig | null>(null);\n const [isLoading, setIsLoading] = useState<boolean>(false);\n const overrides = usePatternsWizardOverridesContext();\n const { httpClient } = useWixPatternsContainer();\n\n useEffect(() => {\n const fetchSchemaForCollection = async (\n targetCollectionId: string,\n targetCustomDataSourceId?: string,\n ): Promise<SchemaConfig> => {\n if (\n entityTypeSource === 'custom' &&\n targetCustomDataSourceId &&\n overrides?.customDataSources\n ) {\n const customSchemaProvider =\n overrides.customDataSources[targetCustomDataSourceId];\n if (customSchemaProvider) {\n return customSchemaProvider(targetCollectionId, { httpClient });\n }\n throw new Error(\n `Custom schema provider '${targetCustomDataSourceId}' not found`,\n );\n }\n\n return getSchema(targetCollectionId, entityTypeSource);\n };\n\n const fetchReferencedSchemas = async (referencedSchema: SchemaConfig) => {\n const referencedCollectionIds = new Set<string>();\n\n Object.values(referencedSchema.fields).forEach((field) => {\n if (field && field.type === 'REFERENCE' && field.referenceMetadata) {\n const { referencedCollectionId } = field.referenceMetadata;\n if (\n referencedCollectionId &&\n !getSchemaFromRegistry(referencedCollectionId)\n ) {\n referencedCollectionIds.add(referencedCollectionId);\n }\n }\n });\n\n if (referencedCollectionIds.size === 0) {\n return;\n }\n\n const fetchPromises = Array.from(referencedCollectionIds).map(\n async (refCollectionId) => {\n try {\n const refSchema = await fetchSchemaForCollection(refCollectionId);\n\n addSchemaToRegistry(refCollectionId, refSchema);\n\n await fetchReferencedSchemas(refSchema);\n } catch (error) {\n console.error(\n `Error fetching referenced schema ${refCollectionId}:`,\n error,\n );\n }\n },\n );\n\n await Promise.all(fetchPromises);\n };\n\n const cachedSchema = getSchemaFromRegistry(collectionId);\n if (cachedSchema) {\n setSchema(cachedSchema);\n return;\n }\n setIsLoading(true);\n fetchSchemaForCollection(collectionId, customDataSourceId)\n .then(async (fetchedSchema) => {\n setSchema(fetchedSchema);\n addSchemaToRegistry(collectionId, fetchedSchema);\n\n await fetchReferencedSchemas(fetchedSchema);\n })\n .catch((error) => {\n console.error('Error fetching schema config:', error);\n })\n .finally(() => {\n setIsLoading(false);\n });\n }, [\n collectionId,\n entityTypeSource,\n customDataSourceId,\n addSchemaToRegistry,\n getSchemaFromRegistry,\n overrides,\n httpClient,\n ]);\n if (!schema || isLoading) {\n return skeleton;\n }\n\n return (\n <SchemaContext.Provider value={schema}>{children}</SchemaContext.Provider>\n );\n};\n\nexport const useSchema = (): SchemaConfig => {\n const context = useContext(SchemaContext);\n if (!context) {\n throw new Error('useSchema must be used within a SchemaProvider');\n }\n return context;\n};\n"],"mappings":"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","ignoreList":[]}
1
+ {"version":3,"names":["React","createContext","useContext","useEffect","useState","getSchema","useSchemaRegistry","usePatternsWizardOverridesContext","useWixPatternsContainer","useError","SchemaContext","SchemaProvider","_ref","_collection$custom","collection","children","skeleton","collectionId","entityTypeSource","customDataSourceId","custom","id","undefined","getSchemaFromRegistry","addSchema","addSchemaToRegistry","showError","schema","setSchema","isLoading","setIsLoading","overrides","httpClient","fetchSchemaForCollection","targetCollectionId","targetCustomDataSourceId","customDataSources","customSchemaProvider","Error","fetchReferencedSchemas","referencedSchema","referencedCollectionIds","Set","Object","values","fields","forEach","field","type","referenceMetadata","referencedCollectionId","add","size","fetchPromises","Array","from","map","refCollectionId","refSchema","error","console","Promise","all","cachedSchema","then","fetchedSchema","catch","finally","createElement","Provider","value","useSchema","context"],"sources":["../../../src/providers/SchemaContext.tsx"],"sourcesContent":["import React, {\n createContext,\n useContext,\n useEffect,\n useState,\n ReactNode,\n} from 'react';\n\nimport { SchemaConfig, BaseCollectionConfig } from '../types';\nimport { getSchema } from '../dataSourceAdapters/factory';\nimport { useSchemaRegistry } from './SchemaRegistryContext';\nimport { usePatternsWizardOverridesContext } from './PatternsWizardOverridesContext';\nimport { useWixPatternsContainer } from '@wix/patterns';\nimport { useError } from './ErrorContext';\n\nconst SchemaContext = createContext<SchemaConfig | null>(null);\n\ninterface SchemaProviderProps {\n collection: BaseCollectionConfig;\n children: ReactNode;\n skeleton: JSX.Element;\n}\n\nexport const SchemaProvider = ({\n collection,\n children,\n skeleton,\n}: SchemaProviderProps) => {\n const { collectionId, entityTypeSource } = collection;\n const customDataSourceId =\n collection.entityTypeSource === 'custom' && 'custom' in collection\n ? collection.custom?.id\n : undefined;\n const { getSchema: getSchemaFromRegistry, addSchema: addSchemaToRegistry } =\n useSchemaRegistry();\n const { showError } = useError();\n const [schema, setSchema] = useState<SchemaConfig | null>(null);\n const [isLoading, setIsLoading] = useState<boolean>(false);\n const overrides = usePatternsWizardOverridesContext();\n const { httpClient } = useWixPatternsContainer();\n\n useEffect(() => {\n const fetchSchemaForCollection = async (\n targetCollectionId: string,\n targetCustomDataSourceId?: string,\n ): Promise<SchemaConfig> => {\n if (\n entityTypeSource === 'custom' &&\n targetCustomDataSourceId &&\n overrides?.customDataSources\n ) {\n const customSchemaProvider =\n overrides.customDataSources[targetCustomDataSourceId];\n if (customSchemaProvider) {\n return customSchemaProvider(targetCollectionId, { httpClient });\n }\n throw new Error(\n `Custom schema provider '${targetCustomDataSourceId}' not found`,\n );\n }\n\n return getSchema(targetCollectionId, entityTypeSource);\n };\n\n const fetchReferencedSchemas = async (referencedSchema: SchemaConfig) => {\n const referencedCollectionIds = new Set<string>();\n\n Object.values(referencedSchema.fields).forEach((field) => {\n if (field && field.type === 'REFERENCE' && field.referenceMetadata) {\n const { referencedCollectionId } = field.referenceMetadata;\n if (\n referencedCollectionId &&\n !getSchemaFromRegistry(referencedCollectionId)\n ) {\n referencedCollectionIds.add(referencedCollectionId);\n }\n }\n });\n\n if (referencedCollectionIds.size === 0) {\n return;\n }\n\n const fetchPromises = Array.from(referencedCollectionIds).map(\n async (refCollectionId) => {\n try {\n const refSchema = await fetchSchemaForCollection(refCollectionId);\n\n addSchemaToRegistry(refCollectionId, refSchema);\n\n await fetchReferencedSchemas(refSchema);\n } catch (error) {\n console.error(\n `Error fetching referenced schema ${refCollectionId}:`,\n error,\n );\n }\n },\n );\n\n await Promise.all(fetchPromises);\n };\n\n const cachedSchema = getSchemaFromRegistry(collectionId);\n if (cachedSchema) {\n setSchema(cachedSchema);\n return;\n }\n setIsLoading(true);\n fetchSchemaForCollection(collectionId, customDataSourceId)\n .then(async (fetchedSchema) => {\n setSchema(fetchedSchema);\n addSchemaToRegistry(collectionId, fetchedSchema);\n\n await fetchReferencedSchemas(fetchedSchema);\n })\n .catch((error) => {\n console.error('Error fetching schema config:', error);\n showError(error);\n })\n .finally(() => {\n setIsLoading(false);\n });\n }, [\n collectionId,\n entityTypeSource,\n customDataSourceId,\n addSchemaToRegistry,\n getSchemaFromRegistry,\n overrides,\n httpClient,\n showError,\n ]);\n if (!schema || isLoading) {\n return skeleton;\n }\n\n return (\n <SchemaContext.Provider value={schema}>{children}</SchemaContext.Provider>\n );\n};\n\nexport const useSchema = (): SchemaConfig => {\n const context = useContext(SchemaContext);\n if (!context) {\n throw new Error('useSchema must be used within a SchemaProvider');\n }\n return context;\n};\n"],"mappings":"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","ignoreList":[]}
@@ -3,4 +3,5 @@ export * from './PatternsWizardOverridesContext';
3
3
  export * from './ModalContext';
4
4
  export * from './SchemaRegistryContext';
5
5
  export * from './AppConfigContext';
6
+ export * from './ErrorContext';
6
7
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":[],"sources":["../../../src/providers/index.ts"],"sourcesContent":["export * from './SchemaContext';\nexport * from './PatternsWizardOverridesContext';\nexport * from './ModalContext';\nexport * from './SchemaRegistryContext';\nexport * from './AppConfigContext';\n"],"mappings":"AAAA,cAAc,iBAAiB;AAC/B,cAAc,kCAAkC;AAChD,cAAc,gBAAgB;AAC9B,cAAc,yBAAyB;AACvC,cAAc,oBAAoB","ignoreList":[]}
1
+ {"version":3,"names":[],"sources":["../../../src/providers/index.ts"],"sourcesContent":["export * from './SchemaContext';\nexport * from './PatternsWizardOverridesContext';\nexport * from './ModalContext';\nexport * from './SchemaRegistryContext';\nexport * from './AppConfigContext';\nexport * from './ErrorContext';\n"],"mappings":"AAAA,cAAc,iBAAiB;AAC/B,cAAc,kCAAkC;AAChD,cAAc,gBAAgB;AAC9B,cAAc,yBAAyB;AACvC,cAAc,oBAAoB;AAClC,cAAc,gBAAgB","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"names":["ComponentTypeEnum"],"sources":["../../../src/types/CollectionPageConfig.ts"],"sourcesContent":["import { CollectionToolbarFiltersProps } from '@wix/patterns';\nimport { DateRangeFilterMode, DateRangeOptions } from '@wix/patterns/core';\nimport { BaseCollectionConfig } from './types';\nimport {\n ActionCellConfig,\n BulkActionsConfig,\n CollectionPageOnRowClickActionConfig,\n CollectionPagePrimaryActions,\n CollectionPageSecondaryActions,\n} from './actions';\n\nexport interface CollectionPageTitle {\n text: string;\n hideTotal?: boolean;\n}\n\nexport interface CollectionPageSubtitle {\n text: string;\n learnMore?: {\n url: string;\n label?: string;\n };\n}\n\nexport interface CollectionPageConfig {\n route: {\n path: string;\n };\n title: CollectionPageTitle;\n subtitle?: CollectionPageSubtitle;\n actions?: {\n primaryActions?: CollectionPagePrimaryActions;\n secondaryActions?: CollectionPageSecondaryActions;\n };\n components: ComponentConfig[];\n}\n\nexport interface ComponentConfig extends BaseCollectionComponentConfig {\n layout: LayoutItemConfig[];\n}\n\nexport interface LayoutItemConfig {\n type: 'Table' | 'Grid';\n table?: TableSpecificConfig;\n grid?: GridSpecificConfig;\n}\n\nexport type ColumnsConfig = Column[];\n\nexport interface TableSpecificConfig {\n columns: ColumnsConfig;\n customColumns?: {\n enabled: boolean;\n };\n stickyColumns?: number;\n onRowClick?: CollectionPageOnRowClickActionConfig;\n}\n\nexport interface GridSpecificConfig {\n item: GridItem;\n}\n\nexport interface TableConfig\n extends BaseCollectionComponentConfig,\n TableSpecificConfig {}\nexport interface GridConfig\n extends BaseCollectionComponentConfig,\n GridSpecificConfig {}\nexport interface TableGridSwitchConfig\n extends BaseCollectionComponentConfig,\n TableSpecificConfig,\n GridSpecificConfig {}\n\nexport type CollectionConfig = BaseCollectionConfig & {\n limit?: number;\n reflectQueryInUrl?: boolean;\n selectAllScope?: 'page' | 'all';\n selectionUpdateMode?: 'preserve' | 'clear';\n};\n\nexport interface BaseCollectionComponentConfig {\n collection: CollectionConfig;\n entityPageId?: string;\n search?: { shown?: boolean };\n toolbarTitle?: ToolbarTitle;\n actionCell?: ActionCellConfig;\n emptyState?: EmptyState;\n filters?: FiltersConfig;\n bulkActionToolbar?: BulkActionsConfig;\n}\n\nexport interface ToolbarTitle {\n title: string;\n subtitle?: {\n text: string;\n info?: {\n content: {\n text: string;\n link?: {\n url: string;\n label: string;\n };\n };\n };\n learnMore?: {\n url: string;\n label?: string;\n };\n };\n showTotal?: boolean;\n itemsLimit?: number;\n}\n\nexport interface Column {\n id: string;\n name: string;\n width: string;\n sortable?: boolean;\n defaultSortOrder?: 'asc' | 'desc';\n sortMode?: 'asc' | 'desc';\n defaultHidden?: boolean;\n hiddenFromCustomColumnsSelection?: boolean;\n hideable?: boolean;\n reorderDisabled?: boolean;\n}\n\nexport interface GridItem {\n titleFieldId: string;\n subtitleFieldId?: string;\n imageFieldId?: string;\n cardContentMode?: 'full' | 'title' | 'empty'; // Footer is not supported in auto-patterns\n imagePlacement?: 'top' | 'side';\n}\n\nexport interface EmptyState {\n title?: string;\n subtitle?: string;\n image?: {\n id: string;\n };\n addNewCta?: {\n id?: string;\n text?: string;\n };\n customCta?: {\n id?: string;\n };\n}\n\nexport interface FilterOption {\n value: string;\n label: string;\n}\n\nexport type FilterSelectionMode = 'single' | 'multiple';\nexport type FilterOptionType =\n | 'checkbox'\n | 'inlineCheckbox'\n | 'radio'\n | 'select';\n\nexport enum ComponentTypeEnum {\n SINGLE = 'single',\n MULTI_SELECT = 'multi-select',\n RADIO_GROUP = 'radio-group',\n NUMBER = 'number',\n DATE_RANGE = 'date-range',\n}\n\nexport type FilterItems = Filter[];\nexport interface FiltersConfig {\n items: FilterItems;\n maxInlineFilters?: CollectionToolbarFiltersProps['inline'];\n panelTitle?: string;\n}\n\nexport interface BaseOptionsFilterConfig {\n selectionMode: FilterSelectionMode;\n}\n\nexport interface DateFilterConfig {\n mode?: DateRangeFilterMode;\n presets?: DateRangeOptions;\n includeTime?: boolean;\n}\n\nexport interface NumberFilterConfig {\n min?: number;\n max?: number;\n allowedDecimals?: boolean;\n}\n\nexport interface BooleanFilterConfig {\n trueLabel?: string;\n falseLabel?: string;\n}\n\nexport interface EnumFilterConfig extends BaseOptionsFilterConfig {\n options: FilterOption[];\n optionType?: FilterOptionType;\n}\n\nexport interface DynamicOptionsFilterConfig extends BaseOptionsFilterConfig {}\n\nexport interface Filter {\n id: string;\n fieldId: string;\n displayName?: string;\n sectionTitle?: string;\n openByDefault?: boolean;\n tagLabel?: string;\n numberConfig?: NumberFilterConfig;\n dateConfig?: DateFilterConfig;\n booleanConfig?: BooleanFilterConfig;\n enumConfig?: EnumFilterConfig;\n dynamicOptionsConfig?: DynamicOptionsFilterConfig;\n}\n"],"mappings":"AAiKA,WAAYA,iBAAiB,0BAAjBA,iBAAiB;EAAjBA,iBAAiB;EAAjBA,iBAAiB;EAAjBA,iBAAiB;EAAjBA,iBAAiB;EAAjBA,iBAAiB;EAAA,OAAjBA,iBAAiB;AAAA","ignoreList":[]}
1
+ {"version":3,"names":["ComponentTypeEnum"],"sources":["../../../src/types/CollectionPageConfig.ts"],"sourcesContent":["import { CollectionToolbarFiltersProps } from '@wix/patterns';\nimport { DateRangeFilterMode, DateRangeOptions } from '@wix/patterns/core';\nimport { BaseCollectionConfig } from './types';\nimport {\n ActionCellConfig,\n BulkActionsConfig,\n CollectionPageOnRowClickActionConfig,\n CollectionPagePrimaryActions,\n CollectionPageSecondaryActions,\n} from './actions';\n\nexport interface CollectionPageTitle {\n text: string;\n hideTotal?: boolean;\n}\n\nexport interface CollectionPageSubtitle {\n text: string;\n learnMore?: {\n url: string;\n label?: string;\n };\n}\n\nexport interface CollectionPageConfig {\n route: {\n path: string;\n };\n title: CollectionPageTitle;\n subtitle?: CollectionPageSubtitle;\n actions?: {\n primaryActions?: CollectionPagePrimaryActions;\n secondaryActions?: CollectionPageSecondaryActions;\n };\n components: ComponentConfig[];\n}\n\nexport interface ComponentConfig extends BaseCollectionComponentConfig {\n layout: LayoutItemConfig[];\n}\n\nexport interface LayoutItemConfig {\n type: 'Table' | 'Grid';\n table?: TableSpecificConfig;\n grid?: GridSpecificConfig;\n}\n\nexport type ColumnsConfig = Column[];\n\nexport interface TableSpecificConfig {\n columns: ColumnsConfig;\n customColumns?: {\n enabled: boolean;\n };\n stickyColumns?: number;\n onRowClick?: CollectionPageOnRowClickActionConfig;\n sections?: {\n id: string;\n };\n}\n\nexport interface GridSpecificConfig {\n item: GridItem;\n}\n\nexport interface TableConfig\n extends BaseCollectionComponentConfig,\n TableSpecificConfig {}\nexport interface GridConfig\n extends BaseCollectionComponentConfig,\n GridSpecificConfig {}\nexport interface TableGridSwitchConfig\n extends BaseCollectionComponentConfig,\n TableSpecificConfig,\n GridSpecificConfig {}\n\nexport type CollectionConfig = BaseCollectionConfig & {\n limit?: number;\n reflectQueryInUrl?: boolean;\n selectAllScope?: 'page' | 'all';\n selectionUpdateMode?: 'preserve' | 'clear';\n};\n\nexport interface BaseCollectionComponentConfig {\n collection: CollectionConfig;\n entityPageId?: string;\n search?: { shown?: boolean };\n toolbarTitle?: ToolbarTitle;\n actionCell?: ActionCellConfig;\n emptyState?: EmptyState;\n filters?: FiltersConfig;\n bulkActionToolbar?: BulkActionsConfig;\n}\n\nexport interface ToolbarTitle {\n title: string;\n subtitle?: {\n text: string;\n info?: {\n content: {\n text: string;\n link?: {\n url: string;\n label: string;\n };\n };\n };\n learnMore?: {\n url: string;\n label?: string;\n };\n };\n showTotal?: boolean;\n itemsLimit?: number;\n}\n\nexport interface Column {\n id: string;\n name: string;\n width: string;\n sortable?: boolean;\n defaultSortOrder?: 'asc' | 'desc';\n sortMode?: 'asc' | 'desc';\n defaultHidden?: boolean;\n hiddenFromCustomColumnsSelection?: boolean;\n hideable?: boolean;\n reorderDisabled?: boolean;\n}\n\nexport interface GridItem {\n titleFieldId: string;\n subtitleFieldId?: string;\n imageFieldId?: string;\n cardContentMode?: 'full' | 'title' | 'empty'; // Footer is not supported in auto-patterns\n imagePlacement?: 'top' | 'side';\n}\n\nexport interface EmptyState {\n title?: string;\n subtitle?: string;\n image?: {\n id: string;\n };\n addNewCta?: {\n id?: string;\n text?: string;\n };\n customCta?: {\n id?: string;\n };\n}\n\nexport interface FilterOption {\n value: string;\n label: string;\n}\n\nexport type FilterSelectionMode = 'single' | 'multiple';\nexport type FilterOptionType =\n | 'checkbox'\n | 'inlineCheckbox'\n | 'radio'\n | 'select';\n\nexport enum ComponentTypeEnum {\n SINGLE = 'single',\n MULTI_SELECT = 'multi-select',\n RADIO_GROUP = 'radio-group',\n NUMBER = 'number',\n DATE_RANGE = 'date-range',\n}\n\nexport type FilterItems = Filter[];\nexport interface FiltersConfig {\n items: FilterItems;\n maxInlineFilters?: CollectionToolbarFiltersProps['inline'];\n panelTitle?: string;\n}\n\nexport interface BaseOptionsFilterConfig {\n selectionMode: FilterSelectionMode;\n}\n\nexport interface DateFilterConfig {\n mode?: DateRangeFilterMode;\n presets?: DateRangeOptions;\n includeTime?: boolean;\n}\n\nexport interface NumberFilterConfig {\n min?: number;\n max?: number;\n allowedDecimals?: boolean;\n}\n\nexport interface BooleanFilterConfig {\n trueLabel?: string;\n falseLabel?: string;\n}\n\nexport interface EnumFilterConfig extends BaseOptionsFilterConfig {\n options: FilterOption[];\n optionType?: FilterOptionType;\n}\n\nexport interface DynamicOptionsFilterConfig extends BaseOptionsFilterConfig {}\n\nexport interface Filter {\n id: string;\n fieldId: string;\n displayName?: string;\n sectionTitle?: string;\n openByDefault?: boolean;\n tagLabel?: string;\n numberConfig?: NumberFilterConfig;\n dateConfig?: DateFilterConfig;\n booleanConfig?: BooleanFilterConfig;\n enumConfig?: EnumFilterConfig;\n dynamicOptionsConfig?: DynamicOptionsFilterConfig;\n}\n"],"mappings":"AAoKA,WAAYA,iBAAiB,0BAAjBA,iBAAiB;EAAjBA,iBAAiB;EAAjBA,iBAAiB;EAAjBA,iBAAiB;EAAjBA,iBAAiB;EAAjBA,iBAAiB;EAAA,OAAjBA,iBAAiB;AAAA","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"names":[],"sources":["../../../../src/types/actions/collectionPageActions.ts"],"sourcesContent":["import {\n CustomActionModalProps,\n CustomActionParams,\n ResolvedAction,\n} from '../../exports/types';\nimport {\n CreateActionConfig,\n CustomActionConfig,\n DividerActionConfig,\n} from './base';\n\nexport type CollectionPageActionConfig = (\n | CreateActionConfig\n | CustomActionConfig\n) & {\n collection: {\n collectionId: string;\n entityTypeSource: 'cms';\n };\n};\n\ntype CollectionPageAction = {\n type: 'action';\n action: {\n item: CollectionPageActionConfig;\n };\n menu?: never;\n};\n\ntype CollectionPageMenu = {\n type: 'menu';\n menu: {\n label: string;\n items: (CollectionPageActionConfig | DividerActionConfig)[];\n };\n action?: never;\n};\n\nexport type CollectionPagePrimaryActions =\n | CollectionPageAction\n | CollectionPageMenu;\n\nexport type CollectionPageSecondaryActions =\n | CollectionPageAction\n | CollectionPageMenu;\n\nexport interface CollectionPageActionParams {\n collectionId: string;\n}\n\nexport type CustomActionCollectionPageActionParams =\n CustomActionParams<CollectionPageActionParams>;\n\nexport type CustomActionCollectionPageActionResolver = (\n params: CustomActionCollectionPageActionParams,\n) => ResolvedAction;\n\nexport interface CustomActionCollectionPageActionModalProps\n extends CustomActionModalProps {\n actionParams: CollectionPageActionParams;\n}\n\nexport type CollectionPageOnRowClickActionConfig = CustomActionConfig & {\n item: any;\n};\n\nexport interface CollectionPageActionOnRowClickParams {\n item: any;\n}\n\nexport type CustomActionCollectionPageActionOnRowClickParams =\n CustomActionParams<CollectionPageActionOnRowClickParams>;\n\nexport type CustomActionCollectionPageActionOnRowClickResolver = (\n params: CustomActionCollectionPageActionOnRowClickParams,\n) => ResolvedAction;\n"],"mappings":"","ignoreList":[]}
1
+ {"version":3,"names":[],"sources":["../../../../src/types/actions/collectionPageActions.ts"],"sourcesContent":["import {\n CustomActionModalProps,\n CustomActionParams,\n ResolvedAction,\n} from '../../exports/types';\nimport {\n CreateActionConfig,\n CustomActionConfig,\n DividerActionConfig,\n} from './base';\n\nexport type CollectionPageActionConfig = (\n | CreateActionConfig\n | CustomActionConfig\n) & {\n collection:\n | {\n collectionId: string;\n entityTypeSource: 'cms';\n custom?: never;\n }\n | {\n collectionId: string;\n entityTypeSource: 'custom';\n custom: {\n id: string;\n };\n };\n};\n\ntype CollectionPageAction = {\n type: 'action';\n action: {\n item: CollectionPageActionConfig;\n };\n menu?: never;\n};\n\ntype CollectionPageMenu = {\n type: 'menu';\n menu: {\n label: string;\n items: (CollectionPageActionConfig | DividerActionConfig)[];\n };\n action?: never;\n};\n\nexport type CollectionPagePrimaryActions =\n | CollectionPageAction\n | CollectionPageMenu;\n\nexport type CollectionPageSecondaryActions =\n | CollectionPageAction\n | CollectionPageMenu;\n\nexport interface CollectionPageActionParams {\n collectionId: string;\n}\n\nexport type CustomActionCollectionPageActionParams =\n CustomActionParams<CollectionPageActionParams>;\n\nexport type CustomActionCollectionPageActionResolver = (\n params: CustomActionCollectionPageActionParams,\n) => ResolvedAction;\n\nexport interface CustomActionCollectionPageActionModalProps\n extends CustomActionModalProps {\n actionParams: CollectionPageActionParams;\n}\n\nexport type CollectionPageOnRowClickActionConfig = CustomActionConfig & {\n item: any;\n};\n\nexport interface CollectionPageActionOnRowClickParams {\n item: any;\n}\n\nexport type CustomActionCollectionPageActionOnRowClickParams =\n CustomActionParams<CollectionPageActionOnRowClickParams>;\n\nexport type CustomActionCollectionPageActionOnRowClickResolver = (\n params: CustomActionCollectionPageActionOnRowClickParams,\n) => ResolvedAction;\n"],"mappings":"","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"names":[],"sources":["../../../src/types/types.ts"],"sourcesContent":["import { EntityPageConfig } from './EntityPageConfig';\nimport { CollectionPageConfig } from './CollectionPageConfig';\n\ninterface BaseCollectionConfigCommon {\n collectionId: string;\n}\n\ninterface CMSCollectionConfig extends BaseCollectionConfigCommon {\n entityTypeSource: 'cms';\n custom?: never;\n}\n\ninterface WixCollectionConfig extends BaseCollectionConfigCommon {\n entityTypeSource: 'wix';\n custom?: never;\n}\n\ninterface CustomCollectionConfig extends BaseCollectionConfigCommon {\n entityTypeSource: 'custom';\n custom: {\n id: string;\n };\n}\n\nexport type BaseCollectionConfig =\n | CMSCollectionConfig\n | WixCollectionConfig\n | CustomCollectionConfig;\n\nexport type PatternsFieldType =\n | 'SHORT_TEXT'\n | 'LONG_TEXT'\n | 'NUMBER'\n | 'BOOLEAN'\n | 'DATE'\n | 'DATETIME'\n | 'URL'\n | 'ARRAY'\n | 'REFERENCE'\n | 'IMAGE';\n\nexport interface AppConfig {\n pages: PageConfig[];\n}\n\nexport interface BasePageConfig {\n id: string;\n appMainPage?: boolean;\n}\n\nexport interface CollectionPageConfigType extends BasePageConfig {\n type: 'collectionPage';\n collectionPage: CollectionPageConfig;\n entityPage?: never;\n}\n\nexport interface EntityPageConfigType extends BasePageConfig {\n type: 'entityPage';\n entityPage: EntityPageConfig;\n collectionPage?: never;\n}\n\nexport type PageConfig = CollectionPageConfigType | EntityPageConfigType;\n\nexport type EntityProps = { [key: string]: any };\n\nexport interface IMenuItem<T extends EntityProps = any> {\n item: T;\n}\nexport interface IColumnValue<T> {\n value: T;\n row: Record<string, any>;\n}\n\nexport type QueryOperator =\n | 'CONTAINS'\n | 'ENDS_WITH'\n | 'EQ'\n | 'EXISTS'\n | 'GT'\n | 'GTE'\n | 'HAS_ALL'\n | 'HAS_SOME'\n | 'LT'\n | 'LTE'\n | 'NE'\n | 'STARTS_WITH'\n | 'URLIZED';\n\ninterface BaseField {\n id: string;\n displayName: string;\n validation?: {\n numberRange?: NumberRange;\n stringLengthRange?: StringLengthRange;\n required: boolean;\n };\n capabilities: {\n supportedQueryOperators: QueryOperator[];\n sortable: boolean;\n };\n}\n\nexport interface ReferenceField extends BaseField {\n type: 'REFERENCE';\n referenceMetadata: {\n referencedCollectionId: string;\n };\n}\n\nexport interface NonReferenceField extends BaseField {\n type: Exclude<PatternsFieldType, 'REFERENCE'>;\n}\n\nexport type Field = ReferenceField | NonReferenceField;\n\nexport interface NumberRange {\n min?: number;\n max?: number;\n}\nexport interface StringLengthRange {\n minLength?: number;\n maxLength?: number;\n}\n\nexport interface Query {\n limit: number;\n offset: number;\n page: number;\n search?: string;\n cursor?: string | null;\n filters: Record<string, any>;\n sort?: {\n fieldName: string;\n order: 'asc' | 'desc';\n }[];\n}\n\nexport interface SchemaConfig {\n id: string;\n fields: Record<string, Field | undefined>;\n displayField: string;\n idField: string;\n actions: {\n get: (entityId: string) => Promise<any>;\n create: (newEntity: Partial<any>) => Promise<any>;\n update: (updatedEntity: any) => Promise<any>;\n delete: (entityId: string) => Promise<any>;\n bulkDelete: (entityIds: string[]) => Promise<any>;\n find: (\n query: Query,\n options?: {\n searchableFieldIds?: string[];\n filterFieldMapping?: Record<string, { fieldId: string }>;\n },\n ) => Promise<{ items: any[]; total: number }>;\n };\n}\n"],"mappings":"","ignoreList":[]}
1
+ {"version":3,"names":[],"sources":["../../../src/types/types.ts"],"sourcesContent":["import { EntityPageConfig } from './EntityPageConfig';\nimport { CollectionPageConfig } from './CollectionPageConfig';\n\ninterface BaseCollectionConfigCommon {\n collectionId: string;\n}\n\ninterface CMSCollectionConfig extends BaseCollectionConfigCommon {\n entityTypeSource: 'cms';\n custom?: never;\n}\n\ninterface CustomCollectionConfig extends BaseCollectionConfigCommon {\n entityTypeSource: 'custom';\n custom: {\n id: string;\n };\n}\n\nexport type BaseCollectionConfig = CMSCollectionConfig | CustomCollectionConfig;\n\nexport type PatternsFieldType =\n | 'SHORT_TEXT'\n | 'LONG_TEXT'\n | 'NUMBER'\n | 'BOOLEAN'\n | 'DATE'\n | 'DATETIME'\n | 'URL'\n | 'ARRAY'\n | 'REFERENCE'\n | 'IMAGE';\n\nexport interface AppConfig {\n pages: PageConfig[];\n}\n\nexport interface BasePageConfig {\n id: string;\n appMainPage?: boolean;\n}\n\nexport interface CollectionPageConfigType extends BasePageConfig {\n type: 'collectionPage';\n collectionPage: CollectionPageConfig;\n entityPage?: never;\n}\n\nexport interface EntityPageConfigType extends BasePageConfig {\n type: 'entityPage';\n entityPage: EntityPageConfig;\n collectionPage?: never;\n}\n\nexport type PageConfig = CollectionPageConfigType | EntityPageConfigType;\n\nexport type EntityProps = { [key: string]: any };\n\nexport interface IMenuItem<T extends EntityProps = any> {\n item: T;\n}\nexport interface IColumnValue<T> {\n value: T;\n row: Record<string, any>;\n}\n\nexport type QueryOperator =\n | 'CONTAINS'\n | 'ENDS_WITH'\n | 'EQ'\n | 'EXISTS'\n | 'GT'\n | 'GTE'\n | 'HAS_ALL'\n | 'HAS_SOME'\n | 'LT'\n | 'LTE'\n | 'NE'\n | 'STARTS_WITH'\n | 'URLIZED';\n\ninterface BaseField {\n id: string;\n displayName: string;\n validation?: {\n numberRange?: NumberRange;\n stringLengthRange?: StringLengthRange;\n required: boolean;\n };\n capabilities: {\n supportedQueryOperators: QueryOperator[];\n sortable: boolean;\n };\n}\n\nexport interface ReferenceField extends BaseField {\n type: 'REFERENCE';\n referenceMetadata: {\n referencedCollectionId: string;\n };\n}\n\nexport interface NonReferenceField extends BaseField {\n type: Exclude<PatternsFieldType, 'REFERENCE'>;\n}\n\nexport type Field = ReferenceField | NonReferenceField;\n\nexport interface NumberRange {\n min?: number;\n max?: number;\n}\nexport interface StringLengthRange {\n minLength?: number;\n maxLength?: number;\n}\n\nexport interface Query {\n limit: number;\n offset: number;\n page: number;\n search?: string;\n cursor?: string | null;\n filters: Record<string, any>;\n sort?: {\n fieldName: string;\n order: 'asc' | 'desc';\n }[];\n}\n\nexport interface SchemaConfig {\n id: string;\n fields: Record<string, Field | undefined>;\n displayField: string;\n idField: string;\n actions: {\n get: (entityId: string) => Promise<any>;\n create: (newEntity: Partial<any>) => Promise<any>;\n update: (updatedEntity: any) => Promise<any>;\n delete: (entityId: string) => Promise<any>;\n bulkDelete: (entityIds: string[]) => Promise<any>;\n find: (\n query: Query,\n options?: {\n searchableFieldIds?: string[];\n filterFieldMapping?: Record<string, { fieldId: string }>;\n },\n ) => Promise<{ items: any[]; total: number }>;\n };\n}\n"],"mappings":"","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"AutoPatternsTable.d.ts","sourceRoot":"","sources":["../../../../src/components/AutoPatternsTable/AutoPatternsTable.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAG1C,MAAM,WAAW,6BAA6B;IAC5C,aAAa,EAAE,WAAW,CAAC;CAC5B;AAED,eAAO,MAAM,iBAAiB,GAAI,oBAE/B,6BAA6B,sBAkC/B,CAAC"}
1
+ {"version":3,"file":"AutoPatternsTable.d.ts","sourceRoot":"","sources":["../../../../src/components/AutoPatternsTable/AutoPatternsTable.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAG1C,MAAM,WAAW,6BAA6B;IAC5C,aAAa,EAAE,WAAW,CAAC;CAC5B;AAED,eAAO,MAAM,iBAAiB,GAAI,oBAE/B,6BAA6B,sBAoC/B,CAAC"}
@@ -8,6 +8,12 @@ export declare const useTableFeatures: (configuration: TableConfig) => {
8
8
  onRowClick: (item: any, index: any) => void | null;
9
9
  stickyColumns: number | undefined;
10
10
  stickySelectionColumn: boolean;
11
+ sections: {
12
+ renderSection: (item: any) => import("@wix/patterns").Section;
13
+ TableSections: (<T, F extends import("@wix/patterns").FiltersMap>({ renderSection, table, columns, ...collectionTableProps }: import("@wix/patterns/dist/types/components/TableSections").TableSectionsProps<T, F>) => React.JSX.Element) & {
14
+ displayName: string;
15
+ };
16
+ } | undefined;
11
17
  search: boolean;
12
18
  title: import("react").JSX.Element | undefined;
13
19
  emptyState: import("react").JSX.Element;