@wix/auto-patterns 1.42.0 → 1.44.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 (175) hide show
  1. package/dist/cjs/components/AutoPatternsApp/AutoPatternsApp.js +19 -5
  2. package/dist/cjs/components/AutoPatternsApp/AutoPatternsApp.js.map +1 -1
  3. package/dist/cjs/components/AutoPatternsCollectionComponent/AutoPatternsCollectionComponent.js +29 -74
  4. package/dist/cjs/components/AutoPatternsCollectionComponent/AutoPatternsCollectionComponent.js.map +1 -1
  5. package/dist/cjs/components/AutoPatternsGrid/AutoPatternsGrid.js +147 -25
  6. package/dist/cjs/components/AutoPatternsGrid/AutoPatternsGrid.js.map +1 -1
  7. package/dist/cjs/components/AutoPatternsRoute/AutoPatternsPage.js +10 -27
  8. package/dist/cjs/components/AutoPatternsRoute/AutoPatternsPage.js.map +1 -1
  9. package/dist/cjs/components/AutoPatternsTable/AutoPatternsTable.js +141 -40
  10. package/dist/cjs/components/AutoPatternsTable/AutoPatternsTable.js.map +1 -1
  11. package/dist/cjs/components/AutoPatternsTableGridSwitch/AutoPatternsTableGridSwitch.js +169 -9
  12. package/dist/cjs/components/AutoPatternsTableGridSwitch/AutoPatternsTableGridSwitch.js.map +1 -1
  13. package/dist/cjs/hooks/getCommonCollectionFeaturesAsync.js +11 -0
  14. package/dist/cjs/hooks/getCommonCollectionFeaturesAsync.js.map +1 -0
  15. package/dist/cjs/hooks/getFilterComponent.js +52 -0
  16. package/dist/cjs/hooks/getFilterComponent.js.map +1 -0
  17. package/dist/cjs/hooks/index.js +4 -11
  18. package/dist/cjs/hooks/index.js.map +1 -1
  19. package/dist/cjs/hooks/pluginsDynamicImports.js +25 -0
  20. package/dist/cjs/hooks/pluginsDynamicImports.js.map +1 -0
  21. package/dist/cjs/hooks/useAsyncFeaturesPromiseState.js +30 -0
  22. package/dist/cjs/hooks/useAsyncFeaturesPromiseState.js.map +1 -0
  23. package/dist/cjs/hooks/useBaseCollectionComponentReadyFeatures.js +62 -0
  24. package/dist/cjs/hooks/useBaseCollectionComponentReadyFeatures.js.map +1 -0
  25. package/dist/cjs/hooks/useBasePatternsStateParams.js +36 -0
  26. package/dist/cjs/hooks/useBasePatternsStateParams.js.map +1 -0
  27. package/dist/cjs/hooks/useCollectionInitAsyncDeps.js +15 -0
  28. package/dist/cjs/hooks/useCollectionInitAsyncDeps.js.map +1 -0
  29. package/dist/cjs/hooks/useCommonCollectionFeatures.js +14 -4
  30. package/dist/cjs/hooks/useCommonCollectionFeatures.js.map +1 -1
  31. package/dist/cjs/hooks/useFilters.js +17 -103
  32. package/dist/cjs/hooks/useFilters.js.map +1 -1
  33. package/dist/cjs/hooks/useFiltersState.js +112 -0
  34. package/dist/cjs/hooks/useFiltersState.js.map +1 -0
  35. package/dist/cjs/hooks/useGridFeaturesAsync.js +42 -0
  36. package/dist/cjs/hooks/useGridFeaturesAsync.js.map +1 -0
  37. package/dist/cjs/hooks/useGridVisibleFieldIds.js +17 -0
  38. package/dist/cjs/hooks/useGridVisibleFieldIds.js.map +1 -0
  39. package/dist/cjs/hooks/useSyncCollectionStateToAppContext.js +22 -0
  40. package/dist/cjs/hooks/useSyncCollectionStateToAppContext.js.map +1 -0
  41. package/dist/cjs/hooks/useTableFeaturesAsync.js +51 -0
  42. package/dist/cjs/hooks/useTableFeaturesAsync.js.map +1 -0
  43. package/dist/cjs/hooks/useTableGridSwitchFeaturesAsync.js +52 -0
  44. package/dist/cjs/hooks/useTableGridSwitchFeaturesAsync.js.map +1 -0
  45. package/dist/cjs/hooks/useTableSections.js +18 -0
  46. package/dist/cjs/hooks/useTableSections.js.map +1 -0
  47. package/dist/cjs/utils/filterCreators.js +16 -31
  48. package/dist/cjs/utils/filterCreators.js.map +1 -1
  49. package/dist/cjs/utils/minimalRequiredPatternsRuntimeCheck.js +18 -0
  50. package/dist/cjs/utils/minimalRequiredPatternsRuntimeCheck.js.map +1 -0
  51. package/dist/cjs/utils/minimalRequiredRuntimeCheck.js +21 -0
  52. package/dist/cjs/utils/minimalRequiredRuntimeCheck.js.map +1 -0
  53. package/dist/esm/components/AutoPatternsApp/AutoPatternsApp.js +14 -1
  54. package/dist/esm/components/AutoPatternsApp/AutoPatternsApp.js.map +1 -1
  55. package/dist/esm/components/AutoPatternsCollectionComponent/AutoPatternsCollectionComponent.js +23 -31
  56. package/dist/esm/components/AutoPatternsCollectionComponent/AutoPatternsCollectionComponent.js.map +1 -1
  57. package/dist/esm/components/AutoPatternsGrid/AutoPatternsGrid.js +134 -28
  58. package/dist/esm/components/AutoPatternsGrid/AutoPatternsGrid.js.map +1 -1
  59. package/dist/esm/components/AutoPatternsRoute/AutoPatternsPage.js +3 -7
  60. package/dist/esm/components/AutoPatternsRoute/AutoPatternsPage.js.map +1 -1
  61. package/dist/esm/components/AutoPatternsTable/AutoPatternsTable.js +126 -41
  62. package/dist/esm/components/AutoPatternsTable/AutoPatternsTable.js.map +1 -1
  63. package/dist/esm/components/AutoPatternsTableGridSwitch/AutoPatternsTableGridSwitch.js +155 -10
  64. package/dist/esm/components/AutoPatternsTableGridSwitch/AutoPatternsTableGridSwitch.js.map +1 -1
  65. package/dist/esm/hooks/getCommonCollectionFeaturesAsync.js +7 -0
  66. package/dist/esm/hooks/getCommonCollectionFeaturesAsync.js.map +1 -0
  67. package/dist/esm/hooks/getFilterComponent.js +48 -0
  68. package/dist/esm/hooks/getFilterComponent.js.map +1 -0
  69. package/dist/esm/hooks/index.js +1 -2
  70. package/dist/esm/hooks/index.js.map +1 -1
  71. package/dist/esm/hooks/pluginsDynamicImports.js +13 -0
  72. package/dist/esm/hooks/pluginsDynamicImports.js.map +1 -0
  73. package/dist/esm/hooks/useAsyncFeaturesPromiseState.js +28 -0
  74. package/dist/esm/hooks/useAsyncFeaturesPromiseState.js.map +1 -0
  75. package/dist/esm/hooks/useBaseCollectionComponentReadyFeatures.js +58 -0
  76. package/dist/esm/hooks/useBaseCollectionComponentReadyFeatures.js.map +1 -0
  77. package/dist/esm/hooks/useBasePatternsStateParams.js +32 -0
  78. package/dist/esm/hooks/useBasePatternsStateParams.js.map +1 -0
  79. package/dist/esm/hooks/useCollectionInitAsyncDeps.js +11 -0
  80. package/dist/esm/hooks/useCollectionInitAsyncDeps.js.map +1 -0
  81. package/dist/esm/hooks/useCommonCollectionFeatures.js +1 -0
  82. package/dist/esm/hooks/useCommonCollectionFeatures.js.map +1 -1
  83. package/dist/esm/hooks/useFilters.js +14 -100
  84. package/dist/esm/hooks/useFilters.js.map +1 -1
  85. package/dist/esm/hooks/useFiltersState.js +107 -0
  86. package/dist/esm/hooks/useFiltersState.js.map +1 -0
  87. package/dist/esm/hooks/useGridFeaturesAsync.js +37 -0
  88. package/dist/esm/hooks/useGridFeaturesAsync.js.map +1 -0
  89. package/dist/esm/hooks/useGridVisibleFieldIds.js +13 -0
  90. package/dist/esm/hooks/useGridVisibleFieldIds.js.map +1 -0
  91. package/dist/esm/hooks/useSyncCollectionStateToAppContext.js +18 -0
  92. package/dist/esm/hooks/useSyncCollectionStateToAppContext.js.map +1 -0
  93. package/dist/esm/hooks/useTableFeaturesAsync.js +46 -0
  94. package/dist/esm/hooks/useTableFeaturesAsync.js.map +1 -0
  95. package/dist/esm/hooks/useTableGridSwitchFeaturesAsync.js +47 -0
  96. package/dist/esm/hooks/useTableGridSwitchFeaturesAsync.js.map +1 -0
  97. package/dist/esm/hooks/useTableSections.js +14 -0
  98. package/dist/esm/hooks/useTableSections.js.map +1 -0
  99. package/dist/esm/utils/filterCreators.js +17 -32
  100. package/dist/esm/utils/filterCreators.js.map +1 -1
  101. package/dist/esm/utils/minimalRequiredPatternsRuntimeCheck.js +14 -0
  102. package/dist/esm/utils/minimalRequiredPatternsRuntimeCheck.js.map +1 -0
  103. package/dist/esm/utils/minimalRequiredRuntimeCheck.js +17 -0
  104. package/dist/esm/utils/minimalRequiredRuntimeCheck.js.map +1 -0
  105. package/dist/types/components/AutoPatternsApp/AutoPatternsApp.d.ts.map +1 -1
  106. package/dist/types/components/AutoPatternsCollectionComponent/AutoPatternsCollectionComponent.d.ts +6 -0
  107. package/dist/types/components/AutoPatternsCollectionComponent/AutoPatternsCollectionComponent.d.ts.map +1 -1
  108. package/dist/types/components/AutoPatternsGrid/AutoPatternsGrid.d.ts +17 -2
  109. package/dist/types/components/AutoPatternsGrid/AutoPatternsGrid.d.ts.map +1 -1
  110. package/dist/types/components/AutoPatternsRoute/AutoPatternsPage.d.ts.map +1 -1
  111. package/dist/types/components/AutoPatternsTable/AutoPatternsTable.d.ts +17 -2
  112. package/dist/types/components/AutoPatternsTable/AutoPatternsTable.d.ts.map +1 -1
  113. package/dist/types/components/AutoPatternsTableGridSwitch/AutoPatternsTableGridSwitch.d.ts +18 -2
  114. package/dist/types/components/AutoPatternsTableGridSwitch/AutoPatternsTableGridSwitch.d.ts.map +1 -1
  115. package/dist/types/hooks/getCommonCollectionFeaturesAsync.d.ts +4 -0
  116. package/dist/types/hooks/getCommonCollectionFeaturesAsync.d.ts.map +1 -0
  117. package/dist/types/hooks/getFilterComponent.d.ts +4 -0
  118. package/dist/types/hooks/getFilterComponent.d.ts.map +1 -0
  119. package/dist/types/hooks/index.d.ts +1 -2
  120. package/dist/types/hooks/index.d.ts.map +1 -1
  121. package/dist/types/hooks/pluginsDynamicImports.d.ts +7 -0
  122. package/dist/types/hooks/pluginsDynamicImports.d.ts.map +1 -0
  123. package/dist/types/hooks/useAsyncFeaturesPromiseState.d.ts +6 -0
  124. package/dist/types/hooks/useAsyncFeaturesPromiseState.d.ts.map +1 -0
  125. package/dist/types/hooks/useBaseCollectionComponentReadyFeatures.d.ts +36 -0
  126. package/dist/types/hooks/useBaseCollectionComponentReadyFeatures.d.ts.map +1 -0
  127. package/dist/types/hooks/useBasePatternsStateParams.d.ts +31 -0
  128. package/dist/types/hooks/useBasePatternsStateParams.d.ts.map +1 -0
  129. package/dist/types/hooks/useCollectionInitAsyncDeps.d.ts +4 -0
  130. package/dist/types/hooks/useCollectionInitAsyncDeps.d.ts.map +1 -0
  131. package/dist/types/hooks/useCommonCollectionFeatures.d.ts +1 -0
  132. package/dist/types/hooks/useCommonCollectionFeatures.d.ts.map +1 -1
  133. package/dist/types/hooks/useFilters.d.ts +9 -21
  134. package/dist/types/hooks/useFilters.d.ts.map +1 -1
  135. package/dist/types/hooks/useFiltersState.d.ts +26 -0
  136. package/dist/types/hooks/useFiltersState.d.ts.map +1 -0
  137. package/dist/types/hooks/useGridDragAndDrop.d.ts +1 -1
  138. package/dist/types/hooks/useGridFeaturesAsync.d.ts +26 -0
  139. package/dist/types/hooks/useGridFeaturesAsync.d.ts.map +1 -0
  140. package/dist/types/hooks/useGridVisibleFieldIds.d.ts +3 -0
  141. package/dist/types/hooks/useGridVisibleFieldIds.d.ts.map +1 -0
  142. package/dist/types/hooks/useSyncCollectionStateToAppContext.d.ts +6 -0
  143. package/dist/types/hooks/useSyncCollectionStateToAppContext.d.ts.map +1 -0
  144. package/dist/types/hooks/useTableFeaturesAsync.d.ts +29 -0
  145. package/dist/types/hooks/useTableFeaturesAsync.d.ts.map +1 -0
  146. package/dist/types/hooks/useTableGridSwitchDragAndDrop.d.ts +1 -1
  147. package/dist/types/hooks/useTableGridSwitchFeaturesAsync.d.ts +29 -0
  148. package/dist/types/hooks/useTableGridSwitchFeaturesAsync.d.ts.map +1 -0
  149. package/dist/types/hooks/useTableSections.d.ts +8 -0
  150. package/dist/types/hooks/useTableSections.d.ts.map +1 -0
  151. package/dist/types/utils/filterCreators.d.ts +10 -19
  152. package/dist/types/utils/filterCreators.d.ts.map +1 -1
  153. package/dist/types/utils/minimalRequiredPatternsRuntimeCheck.d.ts +5 -0
  154. package/dist/types/utils/minimalRequiredPatternsRuntimeCheck.d.ts.map +1 -0
  155. package/dist/types/utils/minimalRequiredRuntimeCheck.d.ts +9 -0
  156. package/dist/types/utils/minimalRequiredRuntimeCheck.d.ts.map +1 -0
  157. package/package.json +18 -17
  158. package/dist/cjs/hooks/useGridFeatures.js +0 -63
  159. package/dist/cjs/hooks/useGridFeatures.js.map +0 -1
  160. package/dist/cjs/hooks/useTableFeatures.js +0 -79
  161. package/dist/cjs/hooks/useTableFeatures.js.map +0 -1
  162. package/dist/cjs/hooks/useTableGridSwitchFeatures.js +0 -83
  163. package/dist/cjs/hooks/useTableGridSwitchFeatures.js.map +0 -1
  164. package/dist/esm/hooks/useGridFeatures.js +0 -58
  165. package/dist/esm/hooks/useGridFeatures.js.map +0 -1
  166. package/dist/esm/hooks/useTableFeatures.js +0 -74
  167. package/dist/esm/hooks/useTableFeatures.js.map +0 -1
  168. package/dist/esm/hooks/useTableGridSwitchFeatures.js +0 -78
  169. package/dist/esm/hooks/useTableGridSwitchFeatures.js.map +0 -1
  170. package/dist/types/hooks/useGridFeatures.d.ts +0 -43
  171. package/dist/types/hooks/useGridFeatures.d.ts.map +0 -1
  172. package/dist/types/hooks/useTableFeatures.d.ts +0 -27
  173. package/dist/types/hooks/useTableFeatures.d.ts.map +0 -1
  174. package/dist/types/hooks/useTableGridSwitchFeatures.d.ts +0 -52
  175. package/dist/types/hooks/useTableGridSwitchFeatures.d.ts.map +0 -1
@@ -1,15 +1,16 @@
1
- import React, { useMemo, lazy, Suspense } from 'react';
1
+ import React, { useMemo } from 'react';
2
2
  import { SchemaProvider } from '../../providers';
3
3
  import { SkeletonCollection } from '../AutoPatternsCollectionPageContent/SkeletonCollection';
4
- const AutoPatternsTableGridSwitch = /*#__PURE__*/lazy(() => import('../AutoPatternsTableGridSwitch/AutoPatternsTableGridSwitch').then(module => ({
5
- default: module.AutoPatternsTableGridSwitch
6
- })));
7
- const AutoPatternsTable = /*#__PURE__*/lazy(() => import('../AutoPatternsTable/AutoPatternsTable').then(module => ({
8
- default: module.AutoPatternsTable
9
- })));
10
- const AutoPatternsGrid = /*#__PURE__*/lazy(() => import('../AutoPatternsGrid/AutoPatternsGrid').then(module => ({
11
- default: module.AutoPatternsGrid
12
- })));
4
+ import { AutoPatternsTable } from '../AutoPatternsTable';
5
+ import { AutoPatternsTableGridSwitch } from '../AutoPatternsTableGridSwitch/AutoPatternsTableGridSwitch';
6
+ import { AutoPatternsGrid } from '../AutoPatternsGrid';
7
+
8
+ /**
9
+ * AutoPatternsCollectionComponent - Entry Point for All Data Display Flows
10
+ *
11
+ * This is the main component that determines which data display pattern to render based on configuration.
12
+ * It serves as the entry point for three distinct rendering flows:
13
+ */
13
14
  export const AutoPatternsCollectionComponent = _ref => {
14
15
  let {
15
16
  component,
@@ -21,12 +22,15 @@ export const AutoPatternsCollectionComponent = _ref => {
21
22
  } = component;
22
23
  const memoized = useMemo(() => {
23
24
  var _layout$find, _layout$find2;
25
+ // No layout configuration - return null to render nothing
24
26
  if (!(layout != null && layout.length)) {
25
27
  return {
26
28
  componentToRender: null,
27
29
  componentType: 'Table'
28
30
  };
29
31
  }
32
+
33
+ // Extract table and grid configurations from layout array
30
34
  const tableConfig = (_layout$find = layout.find(item => item.type === 'Table')) == null ? void 0 : _layout$find.table;
31
35
  const gridConfig = (_layout$find2 = layout.find(item => item.type === 'Grid')) == null ? void 0 : _layout$find2.grid;
32
36
  let componentType = 'Table';
@@ -37,38 +41,26 @@ export const AutoPatternsCollectionComponent = _ref => {
37
41
  ...tableConfig,
38
42
  ...gridConfig
39
43
  };
40
- componentToRender = /*#__PURE__*/React.createElement(Suspense, {
41
- fallback: /*#__PURE__*/React.createElement(SkeletonCollection, {
42
- componentType: "Table"
43
- })
44
- }, /*#__PURE__*/React.createElement(AutoPatternsTableGridSwitch, {
45
- configuration: config
46
- }));
44
+ componentToRender = /*#__PURE__*/React.createElement(AutoPatternsTableGridSwitch, {
45
+ config: config
46
+ });
47
47
  } else if (tableConfig) {
48
48
  const config = {
49
49
  ...sharedConfig,
50
50
  ...tableConfig
51
51
  };
52
- componentToRender = /*#__PURE__*/React.createElement(Suspense, {
53
- fallback: /*#__PURE__*/React.createElement(SkeletonCollection, {
54
- componentType: "Table"
55
- })
56
- }, /*#__PURE__*/React.createElement(AutoPatternsTable, {
57
- configuration: config
58
- }));
52
+ componentToRender = /*#__PURE__*/React.createElement(AutoPatternsTable, {
53
+ config: config
54
+ });
59
55
  } else if (gridConfig) {
60
56
  componentType = 'Grid';
61
57
  const config = {
62
58
  ...sharedConfig,
63
59
  ...gridConfig
64
60
  };
65
- componentToRender = /*#__PURE__*/React.createElement(Suspense, {
66
- fallback: /*#__PURE__*/React.createElement(SkeletonCollection, {
67
- componentType: "Grid"
68
- })
69
- }, /*#__PURE__*/React.createElement(AutoPatternsGrid, {
70
- configuration: config
71
- }));
61
+ componentToRender = /*#__PURE__*/React.createElement(AutoPatternsGrid, {
62
+ config: config
63
+ });
72
64
  }
73
65
  return {
74
66
  componentToRender,
@@ -1 +1 @@
1
- {"version":3,"names":["React","useMemo","lazy","Suspense","SchemaProvider","SkeletonCollection","AutoPatternsTableGridSwitch","then","module","default","AutoPatternsTable","AutoPatternsGrid","AutoPatternsCollectionComponent","_ref","component","index","layout","sharedConfig","memoized","_layout$find","_layout$find2","length","componentToRender","componentType","tableConfig","find","item","type","table","gridConfig","grid","config","createElement","fallback","configuration","Fragment","key","collection","collectionId","skeleton"],"sources":["../../../../src/components/AutoPatternsCollectionComponent/AutoPatternsCollectionComponent.tsx"],"sourcesContent":["import React, { useMemo, lazy, Suspense } from 'react';\nimport { CollectionComponentConfig } from '../../types';\nimport { SchemaProvider } from '../../providers';\nimport { SkeletonCollection } from '../AutoPatternsCollectionPageContent/SkeletonCollection';\n\nconst AutoPatternsTableGridSwitch = lazy(() =>\n import('../AutoPatternsTableGridSwitch/AutoPatternsTableGridSwitch').then(\n (module) => ({ default: module.AutoPatternsTableGridSwitch }),\n ),\n);\nconst AutoPatternsTable = lazy(() =>\n import('../AutoPatternsTable/AutoPatternsTable').then((module) => ({\n default: module.AutoPatternsTable,\n })),\n);\nconst AutoPatternsGrid = lazy(() =>\n import('../AutoPatternsGrid/AutoPatternsGrid').then((module) => ({\n default: module.AutoPatternsGrid,\n })),\n);\n\nexport const AutoPatternsCollectionComponent = ({\n component,\n index,\n}: {\n component: CollectionComponentConfig;\n index: number;\n}) => {\n const { layout, ...sharedConfig } = component;\n\n const memoized = useMemo(() => {\n if (!layout?.length) {\n return {\n componentToRender: null,\n componentType: 'Table' as 'Table' | 'Grid',\n };\n }\n\n const tableConfig = layout.find((item) => item.type === 'Table')?.table;\n const gridConfig = layout.find((item) => item.type === 'Grid')?.grid;\n\n let componentType: 'Table' | 'Grid' = 'Table';\n let componentToRender: React.ReactNode = null;\n\n if (tableConfig && gridConfig) {\n const config = {\n ...sharedConfig,\n ...tableConfig,\n ...gridConfig,\n };\n componentToRender = (\n <Suspense fallback={<SkeletonCollection componentType=\"Table\" />}>\n <AutoPatternsTableGridSwitch configuration={config} />\n </Suspense>\n );\n } else if (tableConfig) {\n const config = { ...sharedConfig, ...tableConfig };\n componentToRender = (\n <Suspense fallback={<SkeletonCollection componentType=\"Table\" />}>\n <AutoPatternsTable configuration={config} />\n </Suspense>\n );\n } else if (gridConfig) {\n componentType = 'Grid';\n const config = { ...sharedConfig, ...gridConfig };\n componentToRender = (\n <Suspense fallback={<SkeletonCollection componentType=\"Grid\" />}>\n <AutoPatternsGrid configuration={config} />\n </Suspense>\n );\n }\n\n return { componentToRender, componentType };\n }, [layout, sharedConfig]);\n\n const { componentToRender, componentType } = memoized;\n\n return (\n <>\n {componentToRender ? (\n <SchemaProvider\n key={`${sharedConfig.collection.collectionId}-${index}`}\n collection={sharedConfig.collection}\n skeleton={<SkeletonCollection componentType={componentType} />}\n >\n {componentToRender}\n </SchemaProvider>\n ) : null}\n </>\n );\n};\n"],"mappings":"AAAA,OAAOA,KAAK,IAAIC,OAAO,EAAEC,IAAI,EAAEC,QAAQ,QAAQ,OAAO;AAEtD,SAASC,cAAc,QAAQ,iBAAiB;AAChD,SAASC,kBAAkB,QAAQ,yDAAyD;AAE5F,MAAMC,2BAA2B,gBAAGJ,IAAI,CAAC,MACvC,MAAM,CAAC,4DAA4D,CAAC,CAACK,IAAI,CACtEC,MAAM,KAAM;EAAEC,OAAO,EAAED,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,iBAAiB,gBAChBtB,KAAA,CAAAgC,aAAA,CAAC5B,cAAc;IACbgC,GAAG,EAAE,GAAGnB,YAAY,CAACoB,UAAU,CAACC,YAAY,IAAIvB,KAAK,EAAG;IACxDsB,UAAU,EAAEpB,YAAY,CAACoB,UAAW;IACpCE,QAAQ,eAAEvC,KAAA,CAAAgC,aAAA,CAAC3B,kBAAkB;MAACkB,aAAa,EAAEA;IAAc,CAAE;EAAE,GAE9DD,iBACa,CAAC,GACf,IACJ,CAAC;AAEP,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["React","useMemo","SchemaProvider","SkeletonCollection","AutoPatternsTable","AutoPatternsTableGridSwitch","AutoPatternsGrid","AutoPatternsCollectionComponent","_ref","component","index","layout","sharedConfig","memoized","_layout$find","_layout$find2","length","componentToRender","componentType","tableConfig","find","item","type","table","gridConfig","grid","config","createElement","Fragment","key","collection","collectionId","skeleton"],"sources":["../../../../src/components/AutoPatternsCollectionComponent/AutoPatternsCollectionComponent.tsx"],"sourcesContent":["import React, { useMemo } from 'react';\nimport { CollectionComponentConfig } from '../../types';\nimport { SchemaProvider } from '../../providers';\nimport { SkeletonCollection } from '../AutoPatternsCollectionPageContent/SkeletonCollection';\nimport { AutoPatternsTable } from '../AutoPatternsTable';\nimport { AutoPatternsTableGridSwitch } from '../AutoPatternsTableGridSwitch/AutoPatternsTableGridSwitch';\nimport { AutoPatternsGrid } from '../AutoPatternsGrid';\n\n/**\n * AutoPatternsCollectionComponent - Entry Point for All Data Display Flows\n *\n * This is the main component that determines which data display pattern to render based on configuration.\n * It serves as the entry point for three distinct rendering flows:\n */\nexport const AutoPatternsCollectionComponent = ({\n component,\n index,\n}: {\n component: CollectionComponentConfig;\n index: number;\n}) => {\n const { layout, ...sharedConfig } = component;\n\n const memoized = useMemo(() => {\n // No layout configuration - return null to render nothing\n if (!layout?.length) {\n return {\n componentToRender: null,\n componentType: 'Table' as 'Table' | 'Grid',\n };\n }\n\n // Extract table and grid configurations from layout array\n const tableConfig = layout.find((item) => item.type === 'Table')?.table;\n const gridConfig = layout.find((item) => item.type === 'Grid')?.grid;\n\n let componentType: 'Table' | 'Grid' = 'Table';\n let componentToRender: React.ReactNode = null;\n\n if (tableConfig && gridConfig) {\n const config = {\n ...sharedConfig,\n ...tableConfig,\n ...gridConfig,\n };\n componentToRender = <AutoPatternsTableGridSwitch config={config} />;\n } else if (tableConfig) {\n const config = { ...sharedConfig, ...tableConfig };\n componentToRender = <AutoPatternsTable config={config} />;\n } else if (gridConfig) {\n componentType = 'Grid';\n const config = { ...sharedConfig, ...gridConfig };\n componentToRender = <AutoPatternsGrid config={config} />;\n }\n\n return { componentToRender, componentType };\n }, [layout, sharedConfig]);\n\n const { componentToRender, componentType } = memoized;\n\n return (\n <>\n {componentToRender ? (\n <SchemaProvider\n key={`${sharedConfig.collection.collectionId}-${index}`}\n collection={sharedConfig.collection}\n skeleton={<SkeletonCollection componentType={componentType} />}\n >\n {componentToRender}\n </SchemaProvider>\n ) : null}\n </>\n );\n};\n"],"mappings":"AAAA,OAAOA,KAAK,IAAIC,OAAO,QAAQ,OAAO;AAEtC,SAASC,cAAc,QAAQ,iBAAiB;AAChD,SAASC,kBAAkB,QAAQ,yDAAyD;AAC5F,SAASC,iBAAiB,QAAQ,sBAAsB;AACxD,SAASC,2BAA2B,QAAQ,4DAA4D;AACxG,SAASC,gBAAgB,QAAQ,qBAAqB;;AAEtD;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,+BAA+B,GAAGC,IAAA,IAMzC;EAAA,IAN0C;IAC9CC,SAAS;IACTC;EAIF,CAAC,GAAAF,IAAA;EACC,MAAM;IAAEG,MAAM;IAAE,GAAGC;EAAa,CAAC,GAAGH,SAAS;EAE7C,MAAMI,QAAQ,GAAGZ,OAAO,CAAC,MAAM;IAAA,IAAAa,YAAA,EAAAC,aAAA;IAC7B;IACA,IAAI,EAACJ,MAAM,YAANA,MAAM,CAAEK,MAAM,GAAE;MACnB,OAAO;QACLC,iBAAiB,E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GAAGL,QAAQ;EAErD,oBACEb,KAAA,CAAA2B,aAAA,CAAA3B,KAAA,CAAA4B,QAAA,QACGX,iBAAiB,gBAChBjB,KAAA,CAAA2B,aAAA,CAACzB,cAAc;IACb2B,GAAG,EAAE,GAAGjB,YAAY,CAACkB,UAAU,CAACC,YAAY,IAAIrB,KAAK,EAAG;IACxDoB,UAAU,EAAElB,YAAY,CAACkB,UAAW;IACpCE,QAAQ,eAAEhC,KAAA,CAAA2B,aAAA,CAACxB,kBAAkB;MAACe,aAAa,EAAEA;IAAc,CAAE;EAAE,GAE9DD,iBACa,CAAC,GACf,IACJ,CAAC;AAEP,CAAC","ignoreList":[]}
@@ -1,37 +1,143 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
- import React from 'react';
3
- import { Grid } from '@wix/patterns';
4
- import { useGridFeatures } from '../../hooks';
5
- export const AutoPatternsGrid = _ref => {
6
- let {
7
- configuration
8
- } = _ref;
2
+ import React, { useState } from 'react';
3
+ import { Grid, GridState, useCreateCollection, useGridCollection, useSelector, useWixPatternsContainer } from '@wix/patterns';
4
+ import { useBasePatternsStateParams } from '../../hooks/useBasePatternsStateParams';
5
+ import { useGridFeaturesAsync } from '../../hooks';
6
+ import { useBaseGridFeatures } from '../../hooks/useBaseGridFeatures';
7
+ import { useBaseCollectionComponentReadyFeatures } from '../../hooks/useBaseCollectionComponentReadyFeatures';
8
+ /**
9
+ * AutoPatternsGridLoaded - Step 4 in Grid Flow
10
+ *
11
+ * FLOW 2: AutoPatternsCollectionComponent → AutoPatternsGrid → useGridFeaturesAsync → [AutoPatternsGridLoaded] → useBaseCollectionComponentReadyFeatures → Grid
12
+ *
13
+ * This component renders when all async features have been loaded and are ready.
14
+ * It represents the "loaded" state of the grid flow and handles:
15
+ *
16
+ * Key Responsibilities:
17
+ * - Creates the grid collection state using loaded async features
18
+ * - Calls useBaseCollectionComponentReadyFeatures for final feature preparation
19
+ * - Extracts grid-specific features (renderItem, preset, imagePlacement) from base features
20
+ * - Extracts async features like dragAndDrop if enabled
21
+ * - Renders the final Grid component with all features combined
22
+ */
23
+ const AutoPatternsGridLoaded = props => {
24
+ const {
25
+ config,
26
+ asyncFeaturesState,
27
+ baseStateParams,
28
+ dataHook
29
+ } = props;
30
+
31
+ // Extract grid-specific display features (how items are rendered and displayed)
9
32
  const {
10
- state,
11
- search,
12
- title,
13
- emptyState,
14
- filters,
15
- actionCell,
16
33
  renderItem,
17
34
  imagePlacement,
18
- views,
19
- preset,
20
- dragAndDropProps
21
- } = useGridFeatures(configuration);
35
+ preset
36
+ } = useBaseGridFeatures(config);
37
+
38
+ // Extract loaded async features from the successful feature loading state
39
+ const {
40
+ dragAndDrop
41
+ } = useSelector(() => ({
42
+ ...asyncFeaturesState.status.data
43
+ }));
44
+
45
+ // Create grid collection state with the loaded async dependencies
46
+ const state = useGridCollection(baseStateParams.params);
47
+
48
+ // STEP 5: Call shared hook that prepares final collection features
49
+ // This hook is shared across all three flows (Table, Grid, TableGridSwitch)
50
+ const baseCollectionComponentReadyFeatures = useBaseCollectionComponentReadyFeatures({
51
+ config,
52
+ collection: state.collection,
53
+ asyncFeaturesState,
54
+ baseStateParams
55
+ });
56
+
57
+ // Extract grid-specific drag and drop props if feature is loaded
58
+ const dragAndDropProps = dragAndDrop == null || dragAndDrop.useGridDragAndDrop == null ? void 0 : dragAndDrop.useGridDragAndDrop(config);
59
+
60
+ // FINAL STEP: Render the fully-featured Grid component
61
+ // Combines grid display features with loaded async features
22
62
  return /*#__PURE__*/React.createElement(Grid, _extends({
23
- dataHook: "auto-patterns-grid",
24
- search: search,
25
- title: title,
26
- state: state,
27
- actionCell: actionCell,
28
- filters: filters,
29
- views: views,
30
- emptyState: emptyState,
31
- imagePlacement: imagePlacement
32
- }, dragAndDropProps, {
63
+ dataHook: dataHook,
33
64
  preset: preset,
34
- renderItem: renderItem
65
+ imagePlacement: imagePlacement,
66
+ renderItem: renderItem,
67
+ state: state
68
+ }, baseCollectionComponentReadyFeatures, dragAndDropProps));
69
+ };
70
+
71
+ /**
72
+ * AutoPatternsGrid - Step 2 in Grid Flow
73
+ *
74
+ * FLOW 2: AutoPatternsCollectionComponent → [AutoPatternsGrid] → useGridFeaturesAsync → AutoPatternsGridLoaded → useBaseCollectionComponentReadyFeatures → Grid
75
+ *
76
+ * This is the main grid component that orchestrates the grid rendering flow.
77
+ * It handles the loading states and coordinates between async feature loading and final rendering.
78
+ *
79
+ * Key Responsibilities:
80
+ * - Extracts grid display features (renderItem, preset, imagePlacement) and visible field IDs
81
+ * - Calls useGridFeaturesAsync (Step 3) to load grid-specific async features
82
+ * - Creates initial grid state with basic collection
83
+ * - Monitors loading status and switches between loading/loaded states
84
+ * - Renders skeleton grid during loading or AutoPatternsGridLoaded when ready
85
+ */
86
+ export const AutoPatternsGrid = props => {
87
+ const {
88
+ config
89
+ } = props;
90
+
91
+ // Extract grid display features and visible field IDs from configuration
92
+ const {
93
+ renderItem,
94
+ imagePlacement,
95
+ preset,
96
+ visibleFieldIds
97
+ } = useBaseGridFeatures(config);
98
+
99
+ // Initialize base state parameters with collection config and visible fields
100
+ const baseStateParams = useBasePatternsStateParams(config, {
101
+ visibleFieldIds
102
+ });
103
+
104
+ // STEP 3: Load grid-specific async features (currently only drag&drop)
105
+ const {
106
+ asyncFeaturesState
107
+ } = useGridFeaturesAsync({
108
+ config
109
+ });
110
+
111
+ // Create patterns container and collection factory
112
+ const container = useWixPatternsContainer();
113
+ const createCollection = useCreateCollection();
114
+
115
+ // Initialize grid state with basic collection (used during loading)
116
+ const [state] = useState(() => new GridState({
117
+ collection: createCollection(baseStateParams.params),
118
+ container
35
119
  }));
120
+
121
+ // Monitor async features loading status
122
+ const isReady = useSelector(() => asyncFeaturesState.status.isSuccess || asyncFeaturesState.status.isError);
123
+ const dataHook = 'auto-patterns-grid';
124
+ if (isReady) {
125
+ // STEP 4: All features loaded - render the fully-featured grid
126
+ return /*#__PURE__*/React.createElement(AutoPatternsGridLoaded, {
127
+ dataHook: dataHook,
128
+ config: config,
129
+ baseStateParams: baseStateParams,
130
+ asyncFeaturesState: asyncFeaturesState
131
+ });
132
+ }
133
+
134
+ // LOADING STATE: Render basic grid skeleton while features are loading
135
+ return /*#__PURE__*/React.createElement(Grid, {
136
+ dataHook: dataHook,
137
+ preset: preset,
138
+ imagePlacement: imagePlacement,
139
+ renderItem: renderItem,
140
+ state: state
141
+ });
36
142
  };
37
143
  //# sourceMappingURL=AutoPatternsGrid.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["React","Grid","useGridFeatures","AutoPatternsGrid","_ref","configuration","state","search","title","emptyState","filters","actionCell","renderItem","imagePlacement","views","preset","dragAndDropProps","createElement","_extends","dataHook"],"sources":["../../../../src/components/AutoPatternsGrid/AutoPatternsGrid.tsx"],"sourcesContent":["import React from 'react';\nimport { Grid } from '@wix/patterns';\nimport { GridConfig } from '../../types';\nimport { useGridFeatures } from '../../hooks';\n\nexport interface AutoPatternsGridContentProps {\n configuration: GridConfig;\n}\n\nexport const AutoPatternsGrid = ({\n configuration,\n}: AutoPatternsGridContentProps) => {\n const {\n state,\n search,\n title,\n emptyState,\n filters,\n actionCell,\n renderItem,\n imagePlacement,\n views,\n preset,\n dragAndDropProps,\n } = useGridFeatures(configuration);\n\n return (\n <Grid\n dataHook=\"auto-patterns-grid\"\n search={search}\n title={title}\n state={state}\n actionCell={actionCell}\n filters={filters}\n views={views}\n emptyState={emptyState}\n imagePlacement={imagePlacement}\n {...dragAndDropProps}\n preset={preset}\n renderItem={renderItem}\n />\n );\n};\n"],"mappings":";AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,IAAI,QAAQ,eAAe;AAEpC,SAASC,eAAe,QAAQ,aAAa;AAM7C,OAAO,MAAMC,gBAAgB,GAAGC,IAAA,IAEI;EAAA,IAFH;IAC/BC;EAC4B,CAAC,GAAAD,IAAA;EAC7B,MAAM;IACJE,KAAK;IACLC,MAAM;IACNC,KAAK;IACLC,UAAU;IACVC,OAAO;IACPC,UAAU;IACVC,UAAU;IACVC,cAAc;IACdC,KAAK;IACLC,MAAM;IACNC;EACF,CAAC,GAAGd,eAAe,CAACG,aAAa,CAAC;EAElC,oBACEL,KAAA,CAAAiB,aAAA,CAAChB,IAAI,EAAAiB,QAAA;IACHC,QAAQ,EAAC,oBAAoB;IAC7BZ,MAAM,EAAEA,MAAO;IACfC,KAAK,EAAEA,KAAM;IACbF,KAAK,EAAEA,KAAM;IACbK,UAAU,EAAEA,UAAW;IACvBD,OAAO,EAAEA,OAAQ;IACjBI,KAAK,EAAEA,KAAM;IACbL,UAAU,EAAEA,UAAW;IACvBI,cAAc,EAAEA;EAAe,GAC3BG,gBAAgB;IACpBD,MAAM,EAAEA,MAAO;IACfH,UAAU,EAAEA;EAAW,EACxB,CAAC;AAEN,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["React","useState","Grid","GridState","useCreateCollection","useGridCollection","useSelector","useWixPatternsContainer","useBasePatternsStateParams","useGridFeaturesAsync","useBaseGridFeatures","useBaseCollectionComponentReadyFeatures","AutoPatternsGridLoaded","props","config","asyncFeaturesState","baseStateParams","dataHook","renderItem","imagePlacement","preset","dragAndDrop","status","data","state","params","baseCollectionComponentReadyFeatures","collection","dragAndDropProps","useGridDragAndDrop","createElement","_extends","AutoPatternsGrid","visibleFieldIds","container","createCollection","isReady","isSuccess","isError"],"sources":["../../../../src/components/AutoPatternsGrid/AutoPatternsGrid.tsx"],"sourcesContent":["import React, { useState } from 'react';\nimport {\n Grid,\n GridState,\n useCreateCollection,\n useGridCollection,\n useSelector,\n useWixPatternsContainer,\n} from '@wix/patterns';\nimport { GridConfig } from '../../types';\nimport { useBasePatternsStateParams } from '../../hooks/useBasePatternsStateParams';\nimport { useGridFeaturesAsync } from '../../hooks';\nimport { useBaseGridFeatures } from '../../hooks/useBaseGridFeatures';\nimport { useBaseCollectionComponentReadyFeatures } from '../../hooks/useBaseCollectionComponentReadyFeatures';\n\nexport interface AutoPatternsGridContentProps {\n config: GridConfig;\n}\n\n/**\n * AutoPatternsGridLoaded - Step 4 in Grid Flow\n *\n * FLOW 2: AutoPatternsCollectionComponent → AutoPatternsGrid → useGridFeaturesAsync → [AutoPatternsGridLoaded] → useBaseCollectionComponentReadyFeatures → Grid\n *\n * This component renders when all async features have been loaded and are ready.\n * It represents the \"loaded\" state of the grid flow and handles:\n *\n * Key Responsibilities:\n * - Creates the grid collection state using loaded async features\n * - Calls useBaseCollectionComponentReadyFeatures for final feature preparation\n * - Extracts grid-specific features (renderItem, preset, imagePlacement) from base features\n * - Extracts async features like dragAndDrop if enabled\n * - Renders the final Grid component with all features combined\n */\nconst AutoPatternsGridLoaded = (\n props: NonNullable<ReturnType<typeof useGridFeaturesAsync>> &\n AutoPatternsGridContentProps & {\n baseStateParams: ReturnType<typeof useBasePatternsStateParams>;\n dataHook?: string;\n },\n) => {\n const { config, asyncFeaturesState, baseStateParams, dataHook } = props;\n\n // Extract grid-specific display features (how items are rendered and displayed)\n const { renderItem, imagePlacement, preset } = useBaseGridFeatures(config);\n\n // Extract loaded async features from the successful feature loading state\n const { dragAndDrop } = useSelector(() => ({\n ...asyncFeaturesState.status.data,\n }));\n\n // Create grid collection state with the loaded async dependencies\n const state = useGridCollection<any>(baseStateParams.params);\n\n // STEP 5: Call shared hook that prepares final collection features\n // This hook is shared across all three flows (Table, Grid, TableGridSwitch)\n const baseCollectionComponentReadyFeatures =\n useBaseCollectionComponentReadyFeatures({\n config,\n collection: state.collection,\n asyncFeaturesState,\n baseStateParams,\n });\n\n // Extract grid-specific drag and drop props if feature is loaded\n const dragAndDropProps = dragAndDrop?.useGridDragAndDrop?.(config);\n\n // FINAL STEP: Render the fully-featured Grid component\n // Combines grid display features with loaded async features\n return (\n <Grid\n dataHook={dataHook}\n preset={preset}\n imagePlacement={imagePlacement}\n renderItem={renderItem}\n state={state}\n {...baseCollectionComponentReadyFeatures}\n {...dragAndDropProps}\n />\n );\n};\n\n/**\n * AutoPatternsGrid - Step 2 in Grid Flow\n *\n * FLOW 2: AutoPatternsCollectionComponent → [AutoPatternsGrid] → useGridFeaturesAsync → AutoPatternsGridLoaded → useBaseCollectionComponentReadyFeatures → Grid\n *\n * This is the main grid component that orchestrates the grid rendering flow.\n * It handles the loading states and coordinates between async feature loading and final rendering.\n *\n * Key Responsibilities:\n * - Extracts grid display features (renderItem, preset, imagePlacement) and visible field IDs\n * - Calls useGridFeaturesAsync (Step 3) to load grid-specific async features\n * - Creates initial grid state with basic collection\n * - Monitors loading status and switches between loading/loaded states\n * - Renders skeleton grid during loading or AutoPatternsGridLoaded when ready\n */\nexport const AutoPatternsGrid = (props: AutoPatternsGridContentProps) => {\n const { config } = props;\n\n // Extract grid display features and visible field IDs from configuration\n const { renderItem, imagePlacement, preset, visibleFieldIds } =\n useBaseGridFeatures(config);\n\n // Initialize base state parameters with collection config and visible fields\n const baseStateParams = useBasePatternsStateParams(config, {\n visibleFieldIds,\n });\n\n // STEP 3: Load grid-specific async features (currently only drag&drop)\n const { asyncFeaturesState } = useGridFeaturesAsync({ config });\n\n // Create patterns container and collection factory\n const container = useWixPatternsContainer();\n const createCollection = useCreateCollection();\n\n // Initialize grid state with basic collection (used during loading)\n const [state] = useState(\n () =>\n new GridState<any, {}>({\n collection: createCollection<any, {}>(baseStateParams.params),\n container,\n }),\n );\n\n // Monitor async features loading status\n const isReady = useSelector(\n () =>\n asyncFeaturesState.status.isSuccess || asyncFeaturesState.status.isError,\n );\n\n const dataHook = 'auto-patterns-grid';\n\n if (isReady) {\n // STEP 4: All features loaded - render the fully-featured grid\n return (\n <AutoPatternsGridLoaded\n dataHook={dataHook}\n config={config}\n baseStateParams={baseStateParams}\n asyncFeaturesState={asyncFeaturesState}\n />\n );\n }\n\n // LOADING STATE: Render basic grid skeleton while features are loading\n return (\n <Grid\n dataHook={dataHook}\n preset={preset}\n imagePlacement={imagePlacement}\n renderItem={renderItem}\n state={state}\n />\n );\n};\n"],"mappings":";AAAA,OAAOA,KAAK,IAAIC,QAAQ,QAAQ,OAAO;AACvC,SACEC,IAAI,EACJC,S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;IACfD,cAAc,EAAEA,cAAe;IAC/BD,UAAU,EAAEA,UAAW;IACvBM,KAAK,EAAEA;EAAM,CACd,CAAC;AAEN,CAAC","ignoreList":[]}
@@ -1,9 +1,7 @@
1
1
  import React, { lazy, Suspense } from 'react';
2
2
  import { SchemaProvider } from '../../providers/SchemaContext';
3
3
  import { SkeletonEntity } from '../AutoPatternsEntityPage/SkeletonEntity';
4
- const AutoPatternsCollectionPage = /*#__PURE__*/lazy(() => import('../AutoPatternsCollectionPage').then(module => ({
5
- default: module.AutoPatternsCollectionPage
6
- })));
4
+ import { AutoPatternsCollectionPage } from '../AutoPatternsCollectionPage';
7
5
  const AutoPatternsEntityPage = /*#__PURE__*/lazy(() => import('../AutoPatternsEntityPage').then(module => ({
8
6
  default: module.AutoPatternsEntityPage
9
7
  })));
@@ -19,11 +17,9 @@ export const AutoPatternsPage = _ref => {
19
17
  switch (type) {
20
18
  case 'collectionPage':
21
19
  if (collectionPage) {
22
- return /*#__PURE__*/React.createElement(Suspense, {
23
- fallback: /*#__PURE__*/React.createElement("div", null)
24
- }, /*#__PURE__*/React.createElement(AutoPatternsCollectionPage, {
20
+ return /*#__PURE__*/React.createElement(AutoPatternsCollectionPage, {
25
21
  configuration: collectionPage
26
- }));
22
+ });
27
23
  }
28
24
  break;
29
25
  case 'entityPage':
@@ -1 +1 @@
1
- {"version":3,"names":["React","lazy","Suspense","SchemaProvider","SkeletonEntity","AutoPatternsCollectionPage","then","module","default","AutoPatternsEntityPage","AutoPatternsPage","_ref","pageConfig","type","collectionPage","entityPage","createElement","fallback","configuration","collection","skeleton"],"sources":["../../../../src/components/AutoPatternsRoute/AutoPatternsPage.tsx"],"sourcesContent":["import React, { lazy, Suspense } from 'react';\nimport { PageConfig } from '../../types';\nimport { SchemaProvider } from '../../providers/SchemaContext';\nimport { SkeletonEntity } from '../AutoPatternsEntityPage/SkeletonEntity';\n\nconst AutoPatternsCollectionPage = lazy(() =>\n import('../AutoPatternsCollectionPage').then((module) => ({\n default: module.AutoPatternsCollectionPage,\n })),\n);\nconst AutoPatternsEntityPage = lazy(() =>\n import('../AutoPatternsEntityPage').then((module) => ({\n default: module.AutoPatternsEntityPage,\n })),\n);\n\nexport interface AutoPatternsPageProps {\n pageConfig: PageConfig;\n}\n\nexport const AutoPatternsPage = ({ pageConfig }: AutoPatternsPageProps) => {\n const { type, collectionPage, entityPage } = pageConfig;\n\n switch (type) {\n case 'collectionPage':\n if (collectionPage) {\n return (\n <Suspense fallback={<div />}>\n <AutoPatternsCollectionPage configuration={collectionPage} />\n </Suspense>\n );\n }\n break;\n case 'entityPage':\n if (entityPage) {\n return (\n <SchemaProvider\n collection={entityPage}\n skeleton={<SkeletonEntity entityPage={entityPage} />}\n >\n <Suspense fallback={<SkeletonEntity entityPage={entityPage} />}>\n <AutoPatternsEntityPage configuration={entityPage} />\n </Suspense>\n </SchemaProvider>\n );\n }\n break;\n default:\n break;\n }\n\n return null;\n};\n"],"mappings":"AAAA,OAAOA,KAAK,IAAIC,IAAI,EAAEC,QAAQ,QAAQ,OAAO;AAE7C,SAASC,cAAc,QAAQ,+BAA+B;AAC9D,SAASC,cAAc,QAAQ,0CAA0C;AAEzE,MAAMC,0BAA0B,gBAAGJ,IAAI,CAAC,MACtC,MAAM,CAAC,+BAA+B,CAAC,CAACK,IAAI,CAAEC,MAAM,KAAM;EACxDC,OAAO,EAAED,MAAM,CAACF;AAClB,CAAC,CAAC,CACJ,CAAC;AACD,MAAMI,sBAAsB,gBAAGR,IAAI,CAAC,MAClC,MAAM,CAAC,2BAA2B,CAAC,CAACK,IAAI,CAAEC,MAAM,KAAM;EACpDC,OAAO,EAAED,MAAM,CAACE;AAClB,CAAC,CAAC,CACJ,CAAC;AAMD,OAAO,MAAMC,gBAAgB,GAAGC,IAAA,IAA2C;EAAA,IAA1C;IAAEC;EAAkC,CAAC,GAAAD,IAAA;EACpE,MAAM;IAAEE,IAAI;IAAEC,cAAc;IAAEC;EAAW,CAAC,GAAGH,UAAU;EAEvD,QAAQC,IAAI;IACV,KAAK,gBAAgB;MACnB,IAAIC,cAAc,EAAE;QAClB,oBACEd,KAAA,CAAAgB,aAAA,CAACd,QAAQ;UAACe,QAAQ,eAAEjB,KAAA,CAAAgB,aAAA,YAAM;QAAE,gBAC1BhB,KAAA,CAAAgB,aAAA,CAACX,0BAA0B;UAACa,aAAa,EAAEJ;QAAe,CAAE,CACpD,CAAC;MAEf;MACA;IACF,KAAK,YAAY;MACf,IAAIC,UAAU,EAAE;QACd,oBACEf,KAAA,CAAAgB,aAAA,CAACb,cAAc;UACbgB,UAAU,EAAEJ,UAAW;UACvBK,QAAQ,eAAEpB,KAAA,CAAAgB,aAAA,CAACZ,cAAc;YAACW,UAAU,EAAEA;UAAW,CAAE;QAAE,gBAErDf,KAAA,CAAAgB,aAAA,CAACd,QAAQ;UAACe,QAAQ,eAAEjB,KAAA,CAAAgB,aAAA,CAACZ,cAAc;YAACW,UAAU,EAAEA;UAAW,CAAE;QAAE,gBAC7Df,KAAA,CAAAgB,aAAA,CAACP,sBAAsB;UAACS,aAAa,EAAEH;QAAW,CAAE,CAC5C,CACI,CAAC;MAErB;MACA;IACF;MACE;EACJ;EAEA,OAAO,IAAI;AACb,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["React","lazy","Suspense","SchemaProvider","SkeletonEntity","AutoPatternsCollectionPage","AutoPatternsEntityPage","then","module","default","AutoPatternsPage","_ref","pageConfig","type","collectionPage","entityPage","createElement","configuration","collection","skeleton","fallback"],"sources":["../../../../src/components/AutoPatternsRoute/AutoPatternsPage.tsx"],"sourcesContent":["import React, { lazy, Suspense } from 'react';\nimport { PageConfig } from '../../types';\nimport { SchemaProvider } from '../../providers/SchemaContext';\nimport { SkeletonEntity } from '../AutoPatternsEntityPage/SkeletonEntity';\nimport { AutoPatternsCollectionPage } from '../AutoPatternsCollectionPage';\n\nconst AutoPatternsEntityPage = lazy(() =>\n import('../AutoPatternsEntityPage').then((module) => ({\n default: module.AutoPatternsEntityPage,\n })),\n);\n\nexport interface AutoPatternsPageProps {\n pageConfig: PageConfig;\n}\n\nexport const AutoPatternsPage = ({ pageConfig }: AutoPatternsPageProps) => {\n const { type, collectionPage, entityPage } = pageConfig;\n\n switch (type) {\n case 'collectionPage':\n if (collectionPage) {\n return <AutoPatternsCollectionPage configuration={collectionPage} />;\n }\n break;\n case 'entityPage':\n if (entityPage) {\n return (\n <SchemaProvider\n collection={entityPage}\n skeleton={<SkeletonEntity entityPage={entityPage} />}\n >\n <Suspense fallback={<SkeletonEntity entityPage={entityPage} />}>\n <AutoPatternsEntityPage configuration={entityPage} />\n </Suspense>\n </SchemaProvider>\n );\n }\n break;\n default:\n break;\n }\n\n return null;\n};\n"],"mappings":"AAAA,OAAOA,KAAK,IAAIC,IAAI,EAAEC,QAAQ,QAAQ,OAAO;AAE7C,SAASC,cAAc,QAAQ,+BAA+B;AAC9D,SAASC,cAAc,QAAQ,0CAA0C;AACzE,SAASC,0BAA0B,QAAQ,+BAA+B;AAE1E,MAAMC,sBAAsB,gBAAGL,IAAI,CAAC,MAClC,MAAM,CAAC,2BAA2B,CAAC,CAACM,IAAI,CAAEC,MAAM,KAAM;EACpDC,OAAO,EAAED,MAAM,CAACF;AAClB,CAAC,CAAC,CACJ,CAAC;AAMD,OAAO,MAAMI,gBAAgB,GAAGC,IAAA,IAA2C;EAAA,IAA1C;IAAEC;EAAkC,CAAC,GAAAD,IAAA;EACpE,MAAM;IAAEE,IAAI;IAAEC,cAAc;IAAEC;EAAW,CAAC,GAAGH,UAAU;EAEvD,QAAQC,IAAI;IACV,KAAK,gBAAgB;MACnB,IAAIC,cAAc,EAAE;QAClB,oBAAOd,KAAA,CAAAgB,aAAA,CAACX,0BAA0B;UAACY,aAAa,EAAEH;QAAe,CAAE,CAAC;MACtE;MACA;IACF,KAAK,YAAY;MACf,IAAIC,UAAU,EAAE;QACd,oBACEf,KAAA,CAAAgB,aAAA,CAACb,cAAc;UACbe,UAAU,EAAEH,UAAW;UACvBI,QAAQ,eAAEnB,KAAA,CAAAgB,aAAA,CAACZ,cAAc;YAACW,UAAU,EAAEA;UAAW,CAAE;QAAE,gBAErDf,KAAA,CAAAgB,aAAA,CAACd,QAAQ;UAACkB,QAAQ,eAAEpB,KAAA,CAAAgB,aAAA,CAACZ,cAAc;YAACW,UAAU,EAAEA;UAAW,CAAE;QAAE,gBAC7Df,KAAA,CAAAgB,aAAA,CAACV,sBAAsB;UAACW,aAAa,EAAEF;QAAW,CAAE,CAC5C,CACI,CAAC;MAErB;MACA;IACF;MACE;EACJ;EAEA,OAAO,IAAI;AACb,CAAC","ignoreList":[]}
@@ -1,50 +1,135 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
- import React from 'react';
3
- import { Table } from '@wix/patterns';
4
- import { useTableFeatures } from '../../hooks';
5
- export const AutoPatternsTable = _ref => {
6
- let {
7
- configuration
8
- } = _ref;
2
+ import React, { useMemo, useState } from 'react';
3
+ import { Table, TableState, useCreateCollection, useSelector, useTableCollection, useWixPatternsContainer } from '@wix/patterns';
4
+ import { useBasePatternsStateParams } from '../../hooks/useBasePatternsStateParams';
5
+ import { useTableFeaturesAsync } from '../../hooks/useTableFeaturesAsync';
6
+ import { useBaseCollectionComponentReadyFeatures } from '../../hooks/useBaseCollectionComponentReadyFeatures';
7
+ /**
8
+ * AutoPatternsTableLoaded - Step 4 in Table Flow
9
+ *
10
+ * FLOW 1: AutoPatternsCollectionComponent → AutoPatternsTable → useTableFeaturesAsync → [AutoPatternsTableLoaded] → useBaseCollectionComponentReadyFeatures → Table
11
+ *
12
+ * This component renders when all async features have been loaded and are ready.
13
+ * It represents the "loaded" state of the table flow and handles:
14
+ *
15
+ * Key Responsibilities:
16
+ * - Creates the table collection state using loaded async features
17
+ * - Calls useBaseCollectionComponentReadyFeatures for final feature preparation
18
+ * - Extracts and applies table-specific features (baseTableFeatures, sections, dragAndDrop)
19
+ * - Renders the final Table component with all features combined
20
+ * - Merges all feature props into a single props object for the Table
21
+ */
22
+ const AutoPatternsTableLoaded = props => {
9
23
  const {
10
- state,
11
- columns,
12
- customColumns,
13
- search,
14
- title,
15
- emptyState,
16
- filters,
17
- views,
18
- actionCell,
19
- bulkActionToolbar,
20
- onRowClick,
21
- stickyColumns,
22
- stickySelectionColumn,
23
- showTitleBar,
24
+ config,
25
+ asyncFeaturesState,
26
+ baseStateParams,
27
+ dataHook
28
+ } = props;
29
+
30
+ // Extract loaded async features from the successful feature loading state
31
+ const {
32
+ baseTableFeatures,
24
33
  sections,
25
- dragAndDropProps,
26
- dataExtension
27
- } = useTableFeatures(configuration);
34
+ dragAndDrop
35
+ } = useSelector(() => ({
36
+ ...asyncFeaturesState.status.data
37
+ }));
38
+
39
+ // Create table collection state with the loaded async dependencies
40
+ const state = useTableCollection(baseStateParams.params);
41
+
42
+ // STEP 5: Call shared hook that prepares final collection features
43
+ // This hook is shared across all three flows (Table, Grid, TableGridSwitch)
44
+ const baseCollectionComponentReadyFeatures = useBaseCollectionComponentReadyFeatures({
45
+ config,
46
+ collection: state.collection,
47
+ asyncFeaturesState,
48
+ baseStateParams
49
+ });
50
+
51
+ // Extract feature-specific props from loaded features
52
+ const dragAndDropProps = dragAndDrop == null || dragAndDrop.useTableDragAndDrop == null ? void 0 : dragAndDrop.useTableDragAndDrop(config);
53
+ const baseTableFeaturesProps = baseTableFeatures == null ? void 0 : baseTableFeatures.useBaseTableFeatures(config);
54
+ const sectionsProps = sections == null ? void 0 : sections.useTableSections(config);
55
+
56
+ // FINAL STEP: Render the fully-featured Table component
57
+ // Combines all loaded features into final table props
28
58
  return /*#__PURE__*/React.createElement(Table, _extends({
29
- dataHook: "auto-patterns-table",
30
- search: search,
31
- title: title,
59
+ dataHook: dataHook,
32
60
  state: state,
33
- columns: columns,
34
- dataExtension: dataExtension,
35
- customColumns: customColumns
36
- }, dragAndDropProps, {
37
- actionCell: actionCell,
38
- filters: filters,
39
- views: views,
40
- emptyState: emptyState,
41
- bulkActionToolbar: bulkActionToolbar,
42
- onRowClick: onRowClick,
61
+ columns: [],
43
62
  horizontalScroll: true,
44
- stickyColumns: stickyColumns,
45
- stickySelectionColumn: stickySelectionColumn,
46
- showTitleBar: showTitleBar,
47
- sections: sections
63
+ useNewInfiniteScrollLoader: true
64
+ }, sectionsProps && {
65
+ sections: sectionsProps
66
+ }, baseTableFeaturesProps, baseCollectionComponentReadyFeatures, dragAndDropProps));
67
+ };
68
+
69
+ /**
70
+ * AutoPatternsTable - Step 2 in Table Flow
71
+ *
72
+ * FLOW 1: AutoPatternsCollectionComponent → [AutoPatternsTable] → useTableFeaturesAsync → AutoPatternsTableLoaded → useBaseCollectionComponentReadyFeatures → Table
73
+ *
74
+ * This is the main table component that orchestrates the table rendering flow.
75
+ * It handles the loading states and coordinates between async feature loading and final rendering.
76
+ *
77
+ * Key Responsibilities:
78
+ * - Prepares visible field IDs from table column configuration
79
+ * - Calls useTableFeaturesAsync (Step 3) to load table-specific async features
80
+ * - Creates initial table state with basic collection
81
+ * - Monitors loading status and switches between loading/loaded states
82
+ * - Renders skeleton table during loading or AutoPatternsTableLoaded when ready
83
+ */
84
+ export const AutoPatternsTable = props => {
85
+ const {
86
+ config
87
+ } = props;
88
+
89
+ // Extract visible field IDs from table columns for data fetching optimization
90
+ const visibleFieldIds = useMemo(() => config.columns.map(column => column.id), [config]);
91
+
92
+ // Initialize base state parameters with collection config and visible fields
93
+ const baseStateParams = useBasePatternsStateParams(config, {
94
+ visibleFieldIds
95
+ });
96
+
97
+ // STEP 3: Load table-specific async features (drag&drop, sections, base table features)
98
+ const {
99
+ asyncFeaturesState
100
+ } = useTableFeaturesAsync({
101
+ config
102
+ });
103
+
104
+ // Create patterns container and collection factory
105
+ const container = useWixPatternsContainer();
106
+ const createCollection = useCreateCollection();
107
+
108
+ // Initialize table state with basic collection (used during loading)
109
+ const [state] = useState(() => new TableState({
110
+ collection: createCollection(baseStateParams.params),
111
+ container
48
112
  }));
113
+
114
+ // Monitor async features loading status
115
+ const isReady = useSelector(() => asyncFeaturesState.status.isSuccess || asyncFeaturesState.status.isError);
116
+ const dataHook = 'auto-patterns-table';
117
+ if (isReady) {
118
+ // STEP 4: All features loaded - render the fully-featured table
119
+ return /*#__PURE__*/React.createElement(AutoPatternsTableLoaded, {
120
+ dataHook: dataHook,
121
+ config: config,
122
+ baseStateParams: baseStateParams,
123
+ asyncFeaturesState: asyncFeaturesState
124
+ });
125
+ }
126
+
127
+ // LOADING STATE: Render basic table skeleton while features are loading
128
+ return /*#__PURE__*/React.createElement(Table, {
129
+ dataHook: dataHook,
130
+ useNewInfiniteScrollLoader: true,
131
+ state: state,
132
+ columns: []
133
+ });
49
134
  };
50
135
  //# sourceMappingURL=AutoPatternsTable.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["React","Table","useTableFeatures","AutoPatternsTable","_ref","configuration","state","columns","customColumns","search","title","emptyState","filters","views","actionCell","bulkActionToolbar","onRowClick","stickyColumns","stickySelectionColumn","showTitleBar","sections","dragAndDropProps","dataExtension","createElement","_extends","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 views,\n actionCell,\n bulkActionToolbar,\n onRowClick,\n stickyColumns,\n stickySelectionColumn,\n showTitleBar,\n sections,\n dragAndDropProps,\n dataExtension,\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 dataExtension={dataExtension}\n customColumns={customColumns}\n {...dragAndDropProps}\n actionCell={actionCell}\n filters={filters}\n views={views}\n emptyState={emptyState}\n bulkActionToolbar={bulkActionToolbar}\n onRowClick={onRowClick}\n horizontalScroll\n stickyColumns={stickyColumns}\n stickySelectionColumn={stickySelectionColumn}\n showTitleBar={showTitleBar}\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,KAAK;IACLC,UAAU;IACVC,iBAAiB;IACjBC,UAAU;IACVC,aAAa;IACbC,qBAAqB;IACrBC,YAAY;IACZC,QAAQ;IACRC,gBAAgB;IAChBC;EACF,CAAC,GAAGpB,gBAAgB,CAACG,aAAa,CAAC;EAEnC,oBACEL,KAAA,CAAAuB,aAAA,CAACtB,KAAK,EAAAuB,QAAA;IACJC,QAAQ,EAAC,qBAAqB;IAC9BhB,MAAM,EAAEA,MAAO;IACfC,KAAK,EAAEA,KAAM;IACbJ,KAAK,EAAEA,KAAM;IACbC,OAAO,EAAEA,OAAQ;IACjBe,aAAa,EAAEA,aAAc;IAC7Bd,aAAa,EAAEA;EAAc,GACzBa,gBAAgB;IACpBP,UAAU,EAAEA,UAAW;IACvBF,OAAO,EAAEA,OAAQ;IACjBC,KAAK,EAAEA,KAAM;IACbF,UAAU,EAAEA,UAAW;IACvBI,iBAAiB,EAAEA,iBAAkB;IACrCC,UAAU,EAAEA,UAAW;IACvBU,gBAAgB;IAChBT,aAAa,EAAEA,aAAc;IAC7BC,qBAAqB,EAAEA,qBAAsB;IAC7CC,YAAY,EAAEA,YAAa;IAC3BC,QAAQ,EAAEA;EAAS,EACpB,CAAC;AAEN,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["React","useMemo","useState","Table","TableState","useCreateCollection","useSelector","useTableCollection","useWixPatternsContainer","useBasePatternsStateParams","useTableFeaturesAsync","useBaseCollectionComponentReadyFeatures","AutoPatternsTableLoaded","props","config","asyncFeaturesState","baseStateParams","dataHook","baseTableFeatures","sections","dragAndDrop","status","data","state","params","baseCollectionComponentReadyFeatures","collection","dragAndDropProps","useTableDragAndDrop","baseTableFeaturesProps","useBaseTableFeatures","sectionsProps","useTableSections","createElement","_extends","columns","horizontalScroll","useNewInfiniteScrollLoader","AutoPatternsTable","visibleFieldIds","map","column","id","container","createCollection","isReady","isSuccess","isError"],"sources":["../../../../src/components/AutoPatternsTable/AutoPatternsTable.tsx"],"sourcesContent":["import React, { useMemo, useState } from 'react';\nimport {\n Table,\n TableState,\n useCreateCollection,\n useSelector,\n useTableCollection,\n useWixPatternsContainer,\n} from '@wix/patterns';\nimport { TableConfig } from '../../types';\nimport { useBasePatternsStateParams } from '../../hooks/useBasePatternsStateParams';\nimport { useTableFeaturesAsync } from '../../hooks/useTableFeaturesAsync';\nimport { useBaseCollectionComponentReadyFeatures } from '../../hooks/useBaseCollectionComponentReadyFeatures';\n\nexport interface AutoPatternsTableContentProps {\n config: TableConfig;\n}\n\n/**\n * AutoPatternsTableLoaded - Step 4 in Table Flow\n *\n * FLOW 1: AutoPatternsCollectionComponent → AutoPatternsTable → useTableFeaturesAsync → [AutoPatternsTableLoaded] → useBaseCollectionComponentReadyFeatures → Table\n *\n * This component renders when all async features have been loaded and are ready.\n * It represents the \"loaded\" state of the table flow and handles:\n *\n * Key Responsibilities:\n * - Creates the table collection state using loaded async features\n * - Calls useBaseCollectionComponentReadyFeatures for final feature preparation\n * - Extracts and applies table-specific features (baseTableFeatures, sections, dragAndDrop)\n * - Renders the final Table component with all features combined\n * - Merges all feature props into a single props object for the Table\n */\nconst AutoPatternsTableLoaded = (\n props: NonNullable<ReturnType<typeof useTableFeaturesAsync>> &\n AutoPatternsTableContentProps & {\n baseStateParams: ReturnType<typeof useBasePatternsStateParams>;\n dataHook?: string;\n },\n) => {\n const { config, asyncFeaturesState, baseStateParams, dataHook } = props;\n\n // Extract loaded async features from the successful feature loading state\n const { baseTableFeatures, sections, dragAndDrop } = useSelector(() => ({\n ...asyncFeaturesState.status.data,\n }));\n\n // Create table collection state with the loaded async dependencies\n const state = useTableCollection<any>(baseStateParams.params);\n\n // STEP 5: Call shared hook that prepares final collection features\n // This hook is shared across all three flows (Table, Grid, TableGridSwitch)\n const baseCollectionComponentReadyFeatures =\n useBaseCollectionComponentReadyFeatures({\n config,\n collection: state.collection,\n asyncFeaturesState,\n baseStateParams,\n });\n\n // Extract feature-specific props from loaded features\n const dragAndDropProps = dragAndDrop?.useTableDragAndDrop?.(config);\n const baseTableFeaturesProps =\n baseTableFeatures?.useBaseTableFeatures(config);\n const sectionsProps = sections?.useTableSections(config);\n\n // FINAL STEP: Render the fully-featured Table component\n // Combines all loaded features into final table props\n return (\n <Table\n dataHook={dataHook}\n state={state}\n columns={[]}\n horizontalScroll\n useNewInfiniteScrollLoader\n {...(sectionsProps && { sections: sectionsProps })}\n {...baseTableFeaturesProps}\n {...baseCollectionComponentReadyFeatures}\n {...dragAndDropProps}\n />\n );\n};\n\n/**\n * AutoPatternsTable - Step 2 in Table Flow\n *\n * FLOW 1: AutoPatternsCollectionComponent → [AutoPatternsTable] → useTableFeaturesAsync → AutoPatternsTableLoaded → useBaseCollectionComponentReadyFeatures → Table\n *\n * This is the main table component that orchestrates the table rendering flow.\n * It handles the loading states and coordinates between async feature loading and final rendering.\n *\n * Key Responsibilities:\n * - Prepares visible field IDs from table column configuration\n * - Calls useTableFeaturesAsync (Step 3) to load table-specific async features\n * - Creates initial table state with basic collection\n * - Monitors loading status and switches between loading/loaded states\n * - Renders skeleton table during loading or AutoPatternsTableLoaded when ready\n */\nexport const AutoPatternsTable = (props: AutoPatternsTableContentProps) => {\n const { config } = props;\n\n // Extract visible field IDs from table columns for data fetching optimization\n const visibleFieldIds = useMemo(\n () => config.columns.map((column) => column.id),\n [config],\n );\n\n // Initialize base state parameters with collection config and visible fields\n const baseStateParams = useBasePatternsStateParams(config, {\n visibleFieldIds,\n });\n\n // STEP 3: Load table-specific async features (drag&drop, sections, base table features)\n const { asyncFeaturesState } = useTableFeaturesAsync({ config });\n\n // Create patterns container and collection factory\n const container = useWixPatternsContainer();\n const createCollection = useCreateCollection();\n\n // Initialize table state with basic collection (used during loading)\n const [state] = useState(\n () =>\n new TableState<any, {}>({\n collection: createCollection<any, {}>(baseStateParams.params),\n container,\n }),\n );\n\n // Monitor async features loading status\n const isReady = useSelector(\n () =>\n asyncFeaturesState.status.isSuccess || asyncFeaturesState.status.isError,\n );\n\n const dataHook = 'auto-patterns-table';\n\n if (isReady) {\n // STEP 4: All features loaded - render the fully-featured table\n return (\n <AutoPatternsTableLoaded\n dataHook={dataHook}\n config={config}\n baseStateParams={baseStateParams}\n asyncFeaturesState={asyncFeaturesState}\n />\n );\n }\n\n // LOADING STATE: Render basic table skeleton while features are loading\n return (\n <Table\n dataHook={dataHook}\n useNewInfiniteScrollLoader\n state={state}\n columns={[]}\n />\n );\n};\n"],"mappings":";AAAA,OAAOA,KAAK,IAAIC,OAAO,EAAEC,QAAQ,QAAQ,OAAO;AAChD,SACEC,KAAK,EACLC,UAAU,EACVC,mBAAmB,EACnBC,WAAW,EACXC,kBAAkB,EAClBC,uBAAuB,QAClB,eAAe;AAEtB,SAASC,0BAA0B,QAAQ,wCAAwC;AACnF,SAASC,qBAAqB,QAAQ,mCAAmC;AACzE,SAASC,uCAAuC,QAAQ,qDAAqD;AAM7G;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMC,uBAAuB,GAC3BC,KAIG,IACA;EACH,MAAM;IAAEC,MAAM;IAAEC,kBAAkB;IAAEC,eAAe;IAAEC;EAAS,CAAC,GAAGJ,KAAK;;EAEvE;EACA,MAAM;IAAEK,iBAAiB;IAAEC,QAAQ;IAAEC;EAAY,CAAC,GAAGd,WAAW,CAAC,OAAO;IACtE,GAAGS,kBAAkB,CAACM,MAAM,CA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