@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,14 +1,159 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
- import React from 'react';
3
- import { TableGridSwitch } from '@wix/patterns';
4
- import { useTableGridSwitchFeatures } from '../../hooks/useTableGridSwitchFeatures';
5
- export const AutoPatternsTableGridSwitch = _ref => {
6
- let {
7
- configuration
8
- } = _ref;
9
- const props = useTableGridSwitchFeatures(configuration);
2
+ import React, { useMemo, useState } from 'react';
3
+ import { TableGridSwitch, TableGridSwitchState, useCreateCollection, useSelector, useTableGridSwitchCollection, useWixPatternsContainer } from '@wix/patterns';
4
+ import { useBasePatternsStateParams } from '../../hooks/useBasePatternsStateParams';
5
+ import { useTableGridSwitchFeaturesAsync } from '../../hooks/useTableGridSwitchFeaturesAsync';
6
+ import { useBaseGridFeatures } from '../../hooks/useBaseGridFeatures';
7
+ import { useBaseCollectionComponentReadyFeatures } from '../../hooks/useBaseCollectionComponentReadyFeatures';
8
+ /**
9
+ * AutoPatternsTableGridSwitchLoaded - Step 4 in TableGridSwitch Flow
10
+ *
11
+ * FLOW 3: AutoPatternsCollectionComponent → AutoPatternsTableGridSwitch → useTableGridSwitchFeaturesAsync → [AutoPatternsTableGridSwitchLoaded] → useBaseCollectionComponentReadyFeatures → TableGridSwitch
12
+ *
13
+ * This component renders when all async features have been loaded and are ready.
14
+ * It represents the "loaded" state of the table-grid switch flow and handles:
15
+ *
16
+ * Key Responsibilities:
17
+ * - Creates the table-grid-switch collection state using loaded async features
18
+ * - Calls useBaseCollectionComponentReadyFeatures for final feature preparation
19
+ * - Combines both table features (baseTableFeatures) and grid features (renderItem, preset, imagePlacement)
20
+ * - Extracts async features like dragAndDrop if enabled
21
+ * - Renders the final TableGridSwitch component with all features combined
22
+ * - Provides both table columns AND grid display props to support switching
23
+ */
24
+ const AutoPatternsTableGridSwitchLoaded = props => {
25
+ const {
26
+ config,
27
+ asyncFeaturesState,
28
+ baseStateParams,
29
+ dataHook
30
+ } = props;
31
+
32
+ // Extract grid-specific display features (for grid mode when user switches)
33
+ const {
34
+ renderItem,
35
+ imagePlacement,
36
+ preset
37
+ } = useBaseGridFeatures(config);
38
+
39
+ // Extract loaded async features from the successful feature loading state
40
+ const {
41
+ baseTableFeatures,
42
+ dragAndDrop
43
+ } = useSelector(() => ({
44
+ ...asyncFeaturesState.status.data
45
+ }));
46
+
47
+ // Create table-grid-switch collection state with the loaded async dependencies
48
+ const state = useTableGridSwitchCollection(baseStateParams.params);
49
+
50
+ // STEP 5: Call shared hook that prepares final collection features
51
+ // This hook is shared across all three flows (Table, Grid, TableGridSwitch)
52
+ const baseCollectionComponentReadyFeatures = useBaseCollectionComponentReadyFeatures({
53
+ config,
54
+ collection: state.collection,
55
+ asyncFeaturesState,
56
+ baseStateParams
57
+ });
58
+
59
+ // Extract table-grid-switch specific drag and drop props if feature is loaded
60
+ const dragAndDropProps = dragAndDrop == null || dragAndDrop.useTableGridSwitchDragAndDrop == null ? void 0 : dragAndDrop.useTableGridSwitchDragAndDrop(config);
61
+
62
+ // Extract table-specific features (for table mode when user switches)
63
+ const baseTableFeaturesProps = baseTableFeatures == null ? void 0 : baseTableFeatures.useBaseTableFeatures(config);
64
+
65
+ // FINAL STEP: Render the fully-featured TableGridSwitch component
66
+ // Combines table features, grid features, and switch functionality
10
67
  return /*#__PURE__*/React.createElement(TableGridSwitch, _extends({
11
- dataHook: "auto-patterns-table-grid-switch"
12
- }, props));
68
+ dataHook: dataHook,
69
+ preset: preset,
70
+ imagePlacement: imagePlacement,
71
+ renderItem: renderItem,
72
+ columns: [],
73
+ state: state
74
+ }, baseCollectionComponentReadyFeatures, baseTableFeaturesProps, dragAndDropProps));
75
+ };
76
+
77
+ /**
78
+ * AutoPatternsTableGridSwitch - Step 2 in TableGridSwitch Flow
79
+ *
80
+ * FLOW 3: AutoPatternsCollectionComponent → [AutoPatternsTableGridSwitch] → useTableGridSwitchFeaturesAsync → AutoPatternsTableGridSwitchLoaded → useBaseCollectionComponentReadyFeatures → TableGridSwitch
81
+ *
82
+ * This is the main table-grid-switch component that orchestrates the combined table/grid rendering flow.
83
+ * It handles both table and grid configurations simultaneously to support runtime switching.
84
+ *
85
+ * Key Responsibilities:
86
+ * - Merges visible field IDs from both table columns AND grid features for comprehensive data fetching
87
+ * - Extracts grid display features (renderItem, preset, imagePlacement) for grid mode
88
+ * - Calls useTableGridSwitchFeaturesAsync (Step 3) to load combined async features
89
+ * - Creates initial table-grid-switch state with basic collection
90
+ * - Monitors loading status and switches between loading/loaded states
91
+ * - Renders skeleton TableGridSwitch during loading or AutoPatternsTableGridSwitchLoaded when ready
92
+ */
93
+ export const AutoPatternsTableGridSwitch = props => {
94
+ const {
95
+ config
96
+ } = props;
97
+
98
+ // Extract visible field IDs from table columns (for table mode)
99
+ const tableVisibleFieldIds = useMemo(() => config.columns.map(column => column.id), [config]);
100
+
101
+ // Extract grid display features and visible field IDs (for grid mode)
102
+ const {
103
+ renderItem,
104
+ imagePlacement,
105
+ preset,
106
+ visibleFieldIds: gridVisibleFieldIds
107
+ } = useBaseGridFeatures(config);
108
+
109
+ // IMPORTANT: Merge visible fields from BOTH table AND grid to support switching
110
+ // This ensures all necessary data is loaded regardless of current view mode
111
+ const visibleFieldIds = useMemo(() => Array.from(new Set([...tableVisibleFieldIds, ...gridVisibleFieldIds])), [tableVisibleFieldIds, gridVisibleFieldIds]);
112
+
113
+ // Initialize base state parameters with collection config and combined visible fields
114
+ const baseStateParams = useBasePatternsStateParams(config, {
115
+ visibleFieldIds
116
+ });
117
+
118
+ // STEP 3: Load table-grid-switch async features (combines table + grid features)
119
+ const {
120
+ asyncFeaturesState
121
+ } = useTableGridSwitchFeaturesAsync({
122
+ config
123
+ });
124
+
125
+ // Create patterns container and collection factory
126
+ const container = useWixPatternsContainer();
127
+ const createCollection = useCreateCollection();
128
+
129
+ // Initialize table-grid-switch state with basic collection (used during loading)
130
+ const [state] = useState(() => new TableGridSwitchState({
131
+ collection: createCollection(baseStateParams.params),
132
+ container,
133
+ containerOverrides: {}
134
+ }));
135
+
136
+ // Monitor async features loading status
137
+ const isReady = useSelector(() => asyncFeaturesState.status.isSuccess || asyncFeaturesState.status.isError);
138
+ const dataHook = 'auto-patterns-table-grid-switch';
139
+ if (isReady) {
140
+ // STEP 4: All features loaded - render the fully-featured table-grid-switch
141
+ return /*#__PURE__*/React.createElement(AutoPatternsTableGridSwitchLoaded, {
142
+ dataHook: dataHook,
143
+ config: config,
144
+ baseStateParams: baseStateParams,
145
+ asyncFeaturesState: asyncFeaturesState
146
+ });
147
+ }
148
+
149
+ // LOADING STATE: Render basic table-grid-switch skeleton while features are loading
150
+ return /*#__PURE__*/React.createElement(TableGridSwitch, {
151
+ dataHook: dataHook,
152
+ state: state,
153
+ columns: [],
154
+ preset: preset,
155
+ imagePlacement: imagePlacement,
156
+ renderItem: renderItem
157
+ });
13
158
  };
14
159
  //# sourceMappingURL=AutoPatternsTableGridSwitch.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["React","TableGridSwitch","useTableGridSwitchFeatures","AutoPatternsTableGridSwitch","_ref","configuration","props","createElement","_extends","dataHook"],"sources":["../../../../src/components/AutoPatternsTableGridSwitch/AutoPatternsTableGridSwitch.tsx"],"sourcesContent":["import React from 'react';\nimport { TableGridSwitch } from '@wix/patterns';\nimport { TableGridSwitchConfig } from '../../types';\nimport { useTableGridSwitchFeatures } from '../../hooks/useTableGridSwitchFeatures';\n\nexport interface AutoPatternsTableGridSwitchProps {\n configuration: TableGridSwitchConfig;\n}\n\nexport const AutoPatternsTableGridSwitch = ({\n configuration,\n}: AutoPatternsTableGridSwitchProps) => {\n const props = useTableGridSwitchFeatures(configuration);\n return (\n <TableGridSwitch dataHook=\"auto-patterns-table-grid-switch\" {...props} />\n );\n};\n"],"mappings":";AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,eAAe,QAAQ,eAAe;AAE/C,SAASC,0BAA0B,QAAQ,wCAAwC;AAMnF,OAAO,MAAMC,2BAA2B,GAAGC,IAAA,IAEH;EAAA,IAFI;IAC1CC;EACgC,CAAC,GAAAD,IAAA;EACjC,MAAME,KAAK,GAAGJ,0BAA0B,CAACG,aAAa,CAAC;EACvD,oBACEL,KAAA,CAAAO,aAAA,CAACN,eAAe,EAAAO,QAAA;IAACC,QAAQ,EAAC;EAAiC,GAAKH,KAAK,CAAG,CAAC;AAE7E,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["React","useMemo","useState","TableGridSwitch","TableGridSwitchState","useCreateCollection","useSelector","useTableGridSwitchCollection","useWixPatternsContainer","useBasePatternsStateParams","useTableGridSwitchFeaturesAsync","useBaseGridFeatures","useBaseCollectionComponentReadyFeatures","AutoPatternsTableGridSwitchLoaded","props","config","asyncFeaturesState","baseStateParams","dataHook","renderItem","imagePlacement","preset","baseTableFeatures","dragAndDrop","status","data","state","params","baseCollectionComponentReadyFeatures","collection","dragAndDropProps","useTableGridSwitchDragAndDrop","baseTableFeaturesProps","useBaseTableFeatures","createElement","_extends","columns","AutoPatternsTableGridSwitch","tableVisibleFieldIds","map","column","id","visibleFieldIds","gridVisibleFieldIds","Array","from","Set","container","createCollection","containerOverrides","isReady","isSuccess","isError"],"sources":["../../../../src/components/AutoPatternsTableGridSwitch/AutoPatternsTableGridSwitch.tsx"],"sourcesContent":["import React, { useMemo, useState } from 'react';\nimport {\n TableGridSwitch,\n TableGridSwitchState,\n useCreateCollection,\n useSelector,\n useTableGridSwitchCollection,\n useWixPatternsContainer,\n} from '@wix/patterns';\nimport { TableGridSwitchConfig } from '../../types';\nimport { useBasePatternsStateParams } from '../../hooks/useBasePatternsStateParams';\nimport { useTableGridSwitchFeaturesAsync } from '../../hooks/useTableGridSwitchFeaturesAsync';\nimport { useBaseGridFeatures } from '../../hooks/useBaseGridFeatures';\nimport { useBaseCollectionComponentReadyFeatures } from '../../hooks/useBaseCollectionComponentReadyFeatures';\n\nexport interface AutoPatternsTableGridSwitchProps {\n config: TableGridSwitchConfig;\n}\n\n/**\n * AutoPatternsTableGridSwitchLoaded - Step 4 in TableGridSwitch Flow\n *\n * FLOW 3: AutoPatternsCollectionComponent → AutoPatternsTableGridSwitch → useTableGridSwitchFeaturesAsync → [AutoPatternsTableGridSwitchLoaded] → useBaseCollectionComponentReadyFeatures → TableGridSwitch\n *\n * This component renders when all async features have been loaded and are ready.\n * It represents the \"loaded\" state of the table-grid switch flow and handles:\n *\n * Key Responsibilities:\n * - Creates the table-grid-switch collection state using loaded async features\n * - Calls useBaseCollectionComponentReadyFeatures for final feature preparation\n * - Combines both table features (baseTableFeatures) and grid features (renderItem, preset, imagePlacement)\n * - Extracts async features like dragAndDrop if enabled\n * - Renders the final TableGridSwitch component with all features combined\n * - Provides both table columns AND grid display props to support switching\n */\nconst AutoPatternsTableGridSwitchLoaded = (\n props: NonNullable<ReturnType<typeof useTableGridSwitchFeaturesAsync>> &\n AutoPatternsTableGridSwitchProps & {\n baseStateParams: ReturnType<typeof useBasePatternsStateParams>;\n dataHook?: string;\n },\n) => {\n const { config, asyncFeaturesState, baseStateParams, dataHook } = props;\n\n // Extract grid-specific display features (for grid mode when user switches)\n const { renderItem, imagePlacement, preset } = useBaseGridFeatures(config);\n\n // Extract loaded async features from the successful feature loading state\n const { baseTableFeatures, dragAndDrop } = useSelector(() => ({\n ...asyncFeaturesState.status.data,\n }));\n\n // Create table-grid-switch collection state with the loaded async dependencies\n const state = useTableGridSwitchCollection<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 table-grid-switch specific drag and drop props if feature is loaded\n const dragAndDropProps = dragAndDrop?.useTableGridSwitchDragAndDrop?.(config);\n\n // Extract table-specific features (for table mode when user switches)\n const baseTableFeaturesProps =\n baseTableFeatures?.useBaseTableFeatures(config);\n\n // FINAL STEP: Render the fully-featured TableGridSwitch component\n // Combines table features, grid features, and switch functionality\n return (\n <TableGridSwitch\n dataHook={dataHook}\n preset={preset}\n imagePlacement={imagePlacement}\n renderItem={renderItem}\n columns={[]}\n state={state}\n {...baseCollectionComponentReadyFeatures}\n {...baseTableFeaturesProps}\n {...dragAndDropProps}\n />\n );\n};\n\n/**\n * AutoPatternsTableGridSwitch - Step 2 in TableGridSwitch Flow\n *\n * FLOW 3: AutoPatternsCollectionComponent → [AutoPatternsTableGridSwitch] → useTableGridSwitchFeaturesAsync → AutoPatternsTableGridSwitchLoaded → useBaseCollectionComponentReadyFeatures → TableGridSwitch\n *\n * This is the main table-grid-switch component that orchestrates the combined table/grid rendering flow.\n * It handles both table and grid configurations simultaneously to support runtime switching.\n *\n * Key Responsibilities:\n * - Merges visible field IDs from both table columns AND grid features for comprehensive data fetching\n * - Extracts grid display features (renderItem, preset, imagePlacement) for grid mode\n * - Calls useTableGridSwitchFeaturesAsync (Step 3) to load combined async features\n * - Creates initial table-grid-switch state with basic collection\n * - Monitors loading status and switches between loading/loaded states\n * - Renders skeleton TableGridSwitch during loading or AutoPatternsTableGridSwitchLoaded when ready\n */\nexport const AutoPatternsTableGridSwitch = (\n props: AutoPatternsTableGridSwitchProps,\n) => {\n const { config } = props;\n\n // Extract visible field IDs from table columns (for table mode)\n const tableVisibleFieldIds = useMemo(\n () => config.columns.map((column) => column.id),\n [config],\n );\n\n // Extract grid display features and visible field IDs (for grid mode)\n const {\n renderItem,\n imagePlacement,\n preset,\n visibleFieldIds: gridVisibleFieldIds,\n } = useBaseGridFeatures(config);\n\n // IMPORTANT: Merge visible fields from BOTH table AND grid to support switching\n // This ensures all necessary data is loaded regardless of current view mode\n const visibleFieldIds = useMemo(\n () =>\n Array.from(new Set([...tableVisibleFieldIds, ...gridVisibleFieldIds])),\n [tableVisibleFieldIds, gridVisibleFieldIds],\n );\n\n // Initialize base state parameters with collection config and combined visible fields\n const baseStateParams = useBasePatternsStateParams(config, {\n visibleFieldIds,\n });\n\n // STEP 3: Load table-grid-switch async features (combines table + grid features)\n const { asyncFeaturesState } = useTableGridSwitchFeaturesAsync({ config });\n\n // Create patterns container and collection factory\n const container = useWixPatternsContainer();\n const createCollection = useCreateCollection();\n\n // Initialize table-grid-switch state with basic collection (used during loading)\n const [state] = useState(\n () =>\n new TableGridSwitchState<any, {}>({\n collection: createCollection<any, {}>(baseStateParams.params),\n container,\n containerOverrides: {},\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-grid-switch';\n\n if (isReady) {\n // STEP 4: All features loaded - render the fully-featured table-grid-switch\n return (\n <AutoPatternsTableGridSwitchLoaded\n dataHook={dataHook}\n config={config}\n baseStateParams={baseStateParams}\n asyncFeaturesState={asyncFeaturesState}\n />\n );\n }\n\n // LOADING STATE: Render basic table-grid-switch skeleton while features are loading\n return (\n <TableGridSwitch\n dataHook={dataHook}\n state={state}\n columns={[]}\n preset={preset}\n imagePlacement={imagePlacement}\n renderItem={renderItem}\n />\n );\n};\n"],"mappings":";AAAA,OAAOA,KAAK,IAAIC,OAAO,EAAEC,QAAQ,QAAQ,OAAO;AAChD,SACEC,eAAe,EACfC,oBAAoB,EACpBC,mBAAmB,EACnBC,WAAW,EACXC,4BAA4B,EAC5BC,uBAAuB,QAClB,eAAe;AAEtB,SAASC,0BAA0B,QAAQ,wCAAwC;AACnF,SAASC,+BAA+B,QAAQ,6CAA6C;AAC7F,SAASC,mBAAmB,QAAQ,iCAAiC;AACrE,SAASC,uCAAuC,QAAQ,qDAAqD;AAM7G;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMC,iCAAiC,GACrCC,KAIG,IACA;EACH,MAAM;IAAEC,MAAM;IAAEC,kBAAkB;IAAEC,eAAe;IAAEC;EAAS,CAAC,GAAGJ,KAAK;;EAEvE;EACA,MAAM;IAAEK,UAAU;IAAEC,cAAc;IAAEC;EAAO,CAAC,GAAGV,mBAAmB,CAACI,MAAM,CAAC;;EAE1E;EACA,MAAM;IAAEO,iBAAiB;IAAEC;EAAY,CAAC,GAAGjB,WAAW,CAAC,OAAO;IAC5D,GAAGU,kBAAkB,CAACQ,MAAM,CAACC;EAC/B,CAAC,CAAC,CAAC;;EAEH;EACA,MAAMC,KAAK,GAAGnB,4BAA4B,CAAMU,eAAe,CAACU,MAAM,CAAC;;EAEvE;EACA;EACA,MAAMC,oCAAoC,GACxChB,uCAAuC,CAAC;IACtCG,MAAM;IACNc,UAAU,EAAEH,KAAK,CAACG,UAAU;IAC5Bb,kBAAkB;IAClBC;EACF,CAAC,CAAC;;EAEJ;EACA,MAAMa,gBAAgB,GAAGP,WAAW,YAAXA,WAAW,CAAEQ,6BAA6B,oBAA1CR,WAAW,CAAEQ,6BAA6B,CAAGhB,MAAM,CAAC;;EAE7E;EACA,MAAMiB,sBAAsB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MgC,SAAS,GAAGvC,uBAAuB,CAAC,CAAC;EAC3C,MAAMwC,gBAAgB,GAAG3C,mBAAmB,CAAC,CAAC;;EAE9C;EACA,MAAM,CAACqB,KAAK,CAAC,GAAGxB,QAAQ,CACtB,MACE,IAAIE,oBAAoB,CAAU;IAChCyB,UAAU,EAAEmB,gBAAgB,CAAU/B,eAAe,CAACU,MAAM,CAAC;IAC7DoB,SAAS;IACTE,kBAAkB,EAAE,CAAC;EACvB,CAAC,CACL,CAAC;;EAED;EACA,MAAMC,OAAO,GAAG5C,WAAW,CACzB,MACEU,kBAAkB,CAACQ,MAAM,CAAC2B,SAAS,IAAInC,kBAAkB,CAACQ,MAAM,CAAC4B,OACrE,CAAC;EAED,MAAMlC,QAAQ,GAAG,iCAAiC;EAElD,IAAIgC,OAAO,EAAE;IACX;IACA,oBACElD,KAAA,CAAAkC,aAAA,CAACrB,iCAAiC;MAChCK,QAAQ,EAAEA,QAAS;MACnBH,MAAM,EAAEA,MAAO;MACfE,eAAe,EAAEA,eAAgB;MACjCD,kBAAkB,EAAEA;IAAmB,CACxC,CAAC;EAEN;;EAEA;EACA,oBACEhB,KAAA,CAAAkC,aAAA,CAAC/B,eAAe;IACde,QAAQ,EAAEA,QAAS;IACnBQ,KAAK,EAAEA,KAAM;IACbU,OAAO,EAAE,EAAG;IACZf,MAAM,EAAEA,MAAO;IACfD,cAAc,EAAEA,cAAe;IAC/BD,UAAU,EAAEA;EAAW,CACxB,CAAC;AAEN,CAAC","ignoreList":[]}
@@ -0,0 +1,7 @@
1
+ import { importCommonCollectionFeatures } from './pluginsDynamicImports';
2
+ export function getCommonCollectionFeaturesAsync() {
3
+ return {
4
+ commonCollectionFeatures: () => importCommonCollectionFeatures()
5
+ };
6
+ }
7
+ //# sourceMappingURL=getCommonCollectionFeaturesAsync.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["importCommonCollectionFeatures","getCommonCollectionFeaturesAsync","commonCollectionFeatures"],"sources":["../../../src/hooks/getCommonCollectionFeaturesAsync.ts"],"sourcesContent":["import { importCommonCollectionFeatures } from './pluginsDynamicImports';\n\nexport function getCommonCollectionFeaturesAsync() {\n return {\n commonCollectionFeatures: () => importCommonCollectionFeatures(),\n };\n}\n"],"mappings":"AAAA,SAASA,8BAA8B,QAAQ,yBAAyB;AAExE,OAAO,SAASC,gCAAgCA,CAAA,EAAG;EACjD,OAAO;IACLC,wBAAwB,EAAEA,CAAA,KAAMF,8BAA8B,CAAC;EACjE,CAAC;AACH","ignoreList":[]}
@@ -0,0 +1,48 @@
1
+ import { AutoCompleteFilter, DateRangeFilter, MultiInlineCheckboxFilter, MultiSelectCheckboxFilter, MultiSelectCollectionFilter, NumberRangeFilter, RadioGroupFilter } from '@wix/patterns';
2
+ export function getFilterComponent(filter) {
3
+ switch (filter.fieldDefinition.type) {
4
+ case 'DATE':
5
+ case 'DATETIME':
6
+ return DateRangeFilter;
7
+ case 'BOOLEAN':
8
+ return RadioGroupFilter;
9
+ case 'NUMBER':
10
+ return NumberRangeFilter;
11
+ case 'REFERENCE':
12
+ {
13
+ var _filter$dynamicOption;
14
+ return (filter == null || (_filter$dynamicOption = filter.dynamicOptionsFilterConfig) == null ? void 0 : _filter$dynamicOption.selectionMode) === 'single' ? AutoCompleteFilter : MultiSelectCollectionFilter;
15
+ }
16
+ default:
17
+ if (filter != null && filter.enumConfig) {
18
+ const {
19
+ selectionMode,
20
+ optionType,
21
+ options
22
+ } = filter.enumConfig;
23
+ const inlineComponentThreshold = 5;
24
+ let component;
25
+ if (selectionMode === 'single') {
26
+ component = options.length > inlineComponentThreshold ? AutoCompleteFilter : RadioGroupFilter;
27
+ if (optionType === 'select') {
28
+ component = AutoCompleteFilter;
29
+ } else if (optionType === 'radio') {
30
+ component = RadioGroupFilter;
31
+ }
32
+ } else {
33
+ component = options.length > inlineComponentThreshold ? MultiSelectCheckboxFilter : MultiInlineCheckboxFilter;
34
+ if (optionType === 'select') {
35
+ component = MultiSelectCollectionFilter;
36
+ } else if (optionType === 'inlineCheckbox') {
37
+ component = MultiInlineCheckboxFilter;
38
+ } else if (optionType === 'checkbox') {
39
+ component = MultiSelectCheckboxFilter;
40
+ }
41
+ }
42
+ return component;
43
+ }
44
+ break;
45
+ }
46
+ return null;
47
+ }
48
+ //# sourceMappingURL=getFilterComponent.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["AutoCompleteFilter","DateRangeFilter","MultiInlineCheckboxFilter","MultiSelectCheckboxFilter","MultiSelectCollectionFilter","NumberRangeFilter","RadioGroupFilter","getFilterComponent","filter","fieldDefinition","type","_filter$dynamicOption","dynamicOptionsFilterConfig","selectionMode","enumConfig","optionType","options","inlineComponentThreshold","component","length"],"sources":["../../../src/hooks/getFilterComponent.ts"],"sourcesContent":["import { FilterOptions } from './useFiltersState';\nimport {\n AutoCompleteFilter,\n DateRangeFilter,\n MultiInlineCheckboxFilter,\n MultiSelectCheckboxFilter,\n MultiSelectCollectionFilter,\n NumberRangeFilter,\n RadioGroupFilter,\n} from '@wix/patterns';\nimport { ElementType } from 'react';\n\nexport function getFilterComponent(filter: FilterOptions): ElementType | null {\n switch (filter.fieldDefinition.type) {\n case 'DATE':\n case 'DATETIME':\n return DateRangeFilter;\n\n case 'BOOLEAN':\n return RadioGroupFilter;\n\n case 'NUMBER':\n return NumberRangeFilter;\n\n case 'REFERENCE': {\n return filter?.dynamicOptionsFilterConfig?.selectionMode === 'single'\n ? AutoCompleteFilter\n : MultiSelectCollectionFilter;\n }\n\n default:\n if (filter?.enumConfig) {\n const { selectionMode, optionType, options } = filter.enumConfig;\n\n const inlineComponentThreshold = 5;\n\n let component;\n\n if (selectionMode === 'single') {\n component =\n options.length > inlineComponentThreshold\n ? AutoCompleteFilter\n : RadioGroupFilter;\n if (optionType === 'select') {\n component = AutoCompleteFilter;\n } else if (optionType === 'radio') {\n component = RadioGroupFilter;\n }\n } else {\n component =\n options.length > inlineComponentThreshold\n ? MultiSelectCheckboxFilter\n : MultiInlineCheckboxFilter;\n if (optionType === 'select') {\n component = MultiSelectCollectionFilter;\n } else if (optionType === 'inlineCheckbox') {\n component = MultiInlineCheckboxFilter;\n } else if (optionType === 'checkbox') {\n component = MultiSelectCheckboxFilter;\n }\n }\n\n return component;\n }\n break;\n }\n\n return null;\n}\n"],"mappings":"AACA,SACEA,kBAAkB,EAClBC,eAAe,EACfC,yBAAyB,EACzBC,yBAAyB,EACzBC,2BAA2B,EAC3BC,iBAAiB,EACjBC,gBAAgB,QACX,eAAe;AAGtB,OAAO,SAASC,kBAAkBA,CAACC,MAAqB,EAAsB;EAC5E,QAAQA,MAAM,CAACC,eAAe,CAACC,IAAI;IACjC,KAAK,MAAM;IACX,KAAK,UAAU;MACb,OAAOT,eAAe;IAExB,KAAK,SAAS;MACZ,OAAOK,gBAAgB;IAEzB,KAAK,QAAQ;MACX,OAAOD,iBAAiB;IAE1B,KAAK,WAAW;MAAE;QAAA,IAAAM,qBAAA;QAChB,OAAO,CAAAH,MAAM,aAAAG,qBAAA,GAANH,MAAM,CAAEI,0BAA0B,qBAAlCD,qBAAA,CAAoCE,aAAa,MAAK,QAAQ,GACjEb,kBAAkB,GAClBI,2BAA2B;MACjC;IAEA;MACE,IAAII,MAAM,YAANA,MAAM,CAAEM,UAAU,EAAE;QACtB,MAAM;UAAED,aAAa;UAAEE,UAAU;UAAEC;QAAQ,CAAC,GAAGR,MAAM,CAACM,UAAU;QAEhE,MAAMG,wBAAwB,GAAG,CAAC;QAElC,IAAIC,SAAS;QAEb,IAAIL,aAAa,KAAK,QAAQ,EAAE;UAC9BK,SAAS,GACPF,OAAO,CAACG,MAAM,GAAGF,wBAAwB,GACrCjB,kBAAkB,GAClBM,gBAAgB;UACtB,IAAIS,UAAU,KAAK,QAAQ,EAAE;YAC3BG,SAAS,GAAGlB,kBAAkB;UAChC,CAAC,MAAM,IAAIe,UAAU,KAAK,OAAO,EAAE;YACjCG,SAAS,GAAGZ,gBAAgB;UAC9B;QACF,CAAC,MAAM;UACLY,SAAS,GACPF,OAAO,CAACG,MAAM,GAAGF,wBAAwB,GACrCd,yBAAyB,GACzBD,yBAAyB;UAC/B,IAAIa,UAAU,KAAK,QAAQ,EAAE;YAC3BG,SAAS,GAAGd,2BAA2B;UACzC,CAAC,MAAM,IAAIW,UAAU,KAAK,gBAAgB,EAAE;YAC1CG,SAAS,GAAGhB,yBAAyB;UACvC,CAAC,MAAM,IAAIa,UAAU,KAAK,UAAU,EAAE;YACpCG,SAAS,GAAGf,yBAAyB;UACvC;QACF;QAEA,OAAOe,SAAS;MAClB;MACA;EACJ;EAEA,OAAO,IAAI;AACb","ignoreList":[]}
@@ -1,6 +1,5 @@
1
- export * from './useTableFeatures';
2
1
  export * from './useFilters';
3
- export * from './useGridFeatures';
2
+ export * from './useGridFeaturesAsync';
4
3
  export * from './useNavigationUtils';
5
4
  export * from './usePagePath';
6
5
  export * from './useEntityPageHeaderTexts';
@@ -1 +1 @@
1
- {"version":3,"names":["useAppContext"],"sources":["../../../src/hooks/index.ts"],"sourcesContent":["export * from './useTableFeatures';\nexport * from './useFilters';\nexport * from './useGridFeatures';\nexport * from './useNavigationUtils';\nexport * from './usePagePath';\nexport * from './useEntityPageHeaderTexts';\nexport { useAppContext } from '../providers/AppContext';\n"],"mappings":"AAAA,cAAc,oBAAoB;AAClC,cAAc,cAAc;AAC5B,cAAc,mBAAmB;AACjC,cAAc,sBAAsB;AACpC,cAAc,eAAe;AAC7B,cAAc,4BAA4B;AAC1C,SAASA,aAAa,QAAQ,yBAAyB","ignoreList":[]}
1
+ {"version":3,"names":["useAppContext"],"sources":["../../../src/hooks/index.ts"],"sourcesContent":["export * from './useFilters';\nexport * from './useGridFeaturesAsync';\nexport * from './useNavigationUtils';\nexport * from './usePagePath';\nexport * from './useEntityPageHeaderTexts';\nexport { useAppContext } from '../providers/AppContext';\n"],"mappings":"AAAA,cAAc,cAAc;AAC5B,cAAc,wBAAwB;AACtC,cAAc,sBAAsB;AACpC,cAAc,eAAe;AAC7B,cAAc,4BAA4B;AAC1C,SAASA,aAAa,QAAQ,yBAAyB","ignoreList":[]}
@@ -0,0 +1,13 @@
1
+ export const importTableDragAndDrop = () => import(/* webpackChunkName: "useTableDragAndDrop" */
2
+ './useTableDragAndDrop');
3
+ export const importTableGridSwitchDragAndDrop = () => import(/* webpackChunkName: "useTableGridSwitchDragAndDrop" */
4
+ './useTableGridSwitchDragAndDrop');
5
+ export const importGridDragAndDrop = () => import(/* webpackChunkName: "useGridDragAndDrop" */
6
+ './useGridDragAndDrop');
7
+ export const importBaseTableFeatures = () => import(/* webpackChunkName: "useBaseTableFeatures" */
8
+ './useBaseTableFeatures');
9
+ export const importCommonCollectionFeatures = () => import(/* webpackChunkName: "useCommonCollectionFeatures" */
10
+ './useCommonCollectionFeatures');
11
+ export const importTableSections = () => import(/* webpackChunkName: "useTableSections" */
12
+ './useTableSections');
13
+ //# sourceMappingURL=pluginsDynamicImports.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["importTableDragAndDrop","importTableGridSwitchDragAndDrop","importGridDragAndDrop","importBaseTableFeatures","importCommonCollectionFeatures","importTableSections"],"sources":["../../../src/hooks/pluginsDynamicImports.ts"],"sourcesContent":["export const importTableDragAndDrop = () =>\n import(\n /* webpackChunkName: \"useTableDragAndDrop\" */\n './useTableDragAndDrop'\n );\n\nexport const importTableGridSwitchDragAndDrop = () =>\n import(\n /* webpackChunkName: \"useTableGridSwitchDragAndDrop\" */\n './useTableGridSwitchDragAndDrop'\n );\n\nexport const importGridDragAndDrop = () =>\n import(\n /* webpackChunkName: \"useGridDragAndDrop\" */\n './useGridDragAndDrop'\n );\n\nexport const importBaseTableFeatures = () =>\n import(\n /* webpackChunkName: \"useBaseTableFeatures\" */\n './useBaseTableFeatures'\n );\n\nexport const importCommonCollectionFeatures = () =>\n import(\n /* webpackChunkName: \"useCommonCollectionFeatures\" */\n './useCommonCollectionFeatures'\n );\n\nexport const importTableSections = () =>\n import(\n /* webpackChunkName: \"useTableSections\" */\n './useTableSections'\n );\n"],"mappings":"AAAA,OAAO,MAAMA,sBAAsB,GAAGA,CAAA,KACpC,MAAM,CACJ;AACA,uBACF,CAAC;AAEH,OAAO,MAAMC,gCAAgC,GAAGA,CAAA,KAC9C,MAAM,CACJ;AACA,iCACF,CAAC;AAEH,OAAO,MAAMC,qBAAqB,GAAGA,CAAA,KACnC,MAAM,CACJ;AACA,sBACF,CAAC;AAEH,OAAO,MAAMC,uBAAuB,GAAGA,CAAA,KACrC,MAAM,CACJ;AACA,wBACF,CAAC;AAEH,OAAO,MAAMC,8BAA8B,GAAGA,CAAA,KAC5C,MAAM,CACJ;AACA,+BACF,CAAC;AAEH,OAAO,MAAMC,mBAAmB,GAAGA,CAAA,KACjC,MAAM,CACJ;AACA,oBACF,CAAC","ignoreList":[]}
@@ -0,0 +1,28 @@
1
+ import { PromiseState } from '@wix/patterns/core';
2
+ import { useState } from 'react';
3
+ export function useAsyncFeaturesPromiseState(loaders) {
4
+ const [state] = useState(() => {
5
+ const r = new PromiseState({
6
+ createPromise: async () => {
7
+ const entries = await Promise.all(Object.entries(loaders).map(async _ref => {
8
+ let [key, loadFunc] = _ref;
9
+ if (loadFunc) {
10
+ const result = await loadFunc();
11
+ return [key, result];
12
+ } else {
13
+ return [key, null];
14
+ }
15
+ }));
16
+ return entries.reduce((acc, _ref2) => {
17
+ let [key, value] = _ref2;
18
+ acc[key] = value;
19
+ return acc;
20
+ }, {});
21
+ }
22
+ });
23
+ r.fetchOnce();
24
+ return r;
25
+ });
26
+ return state;
27
+ }
28
+ //# sourceMappingURL=useAsyncFeaturesPromiseState.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["PromiseState","useState","useAsyncFeaturesPromiseState","loaders","state","r","createPromise","entries","Promise","all","Object","map","_ref","key","loadFunc","result","reduce","acc","_ref2","value","fetchOnce"],"sources":["../../../src/hooks/useAsyncFeaturesPromiseState.ts"],"sourcesContent":["import { PromiseState } from '@wix/patterns/core';\nimport { useState } from 'react';\n\nexport type AsyncFeaturesState<\n T extends Record<string, () => Promise<any> | null>,\n> = {\n [K in keyof T]: T[K] extends () => Promise<infer R> | null\n ? R | null | undefined\n : null | undefined;\n};\n\nexport function useAsyncFeaturesPromiseState<\n T extends Record<string, () => Promise<any> | null>,\n>(loaders: T): PromiseState<AsyncFeaturesState<T>> {\n const [state] = useState(() => {\n const r = new PromiseState({\n createPromise: async () => {\n const entries = await Promise.all(\n Object.entries(loaders).map(async ([key, loadFunc]) => {\n if (loadFunc) {\n const result = await loadFunc();\n return [key, result];\n } else {\n return [key, null];\n }\n }),\n );\n\n return entries.reduce((acc, [key, value]) => {\n acc[key as keyof AsyncFeaturesState<T>] = value;\n return acc;\n }, {} as AsyncFeaturesState<T>);\n },\n });\n\n r.fetchOnce();\n\n return r;\n });\n\n return state;\n}\n"],"mappings":"AAAA,SAASA,YAAY,QAAQ,oBAAoB;AACjD,SAASC,QAAQ,QAAQ,OAAO;AAUhC,OAAO,SAASC,4BAA4BA,CAE1CC,OAAU,EAAuC;EACjD,MAAM,CAACC,KAAK,CAAC,GAAGH,QAAQ,CAAC,MAAM;IAC7B,MAAMI,CAAC,GAAG,IAAIL,YAAY,CAAC;MACzBM,aAAa,EAAE,MAAAA,CAAA,KAAY;QACzB,MAAMC,OAAO,GAAG,MAAMC,OAAO,CAACC,GAAG,CAC/BC,MAAM,CAACH,OAAO,CAACJ,OAAO,CAAC,CAACQ,GAAG,CAAC,MAAAC,IAAA,IAA2B;UAAA,IAApB,CAACC,GAAG,EAAEC,QAAQ,CAAC,GAAAF,IAAA;UAChD,IAAIE,QAAQ,EAAE;YACZ,MAAMC,MAAM,GAAG,MAAMD,QAAQ,CAAC,CAAC;YAC/B,OAAO,CAACD,GAAG,EAAEE,MAAM,CAAC;UACtB,CAAC,MAAM;YACL,OAAO,CAACF,GAAG,EAAE,IAAI,CAAC;UACpB;QACF,CAAC,CACH,CAAC;QAED,OAAON,OAAO,CAACS,MAAM,CAAC,CAACC,GAAG,EAAAC,KAAA,KAAmB;UAAA,IAAjB,CAACL,GAAG,EAAEM,KAAK,CAAC,GAAAD,KAAA;UACtCD,GAAG,CAACJ,GAAG,CAAgC,GAAGM,KAAK;UAC/C,OAAOF,GAAG;QACZ,CAAC,EAAE,CAAC,CAA0B,CAAC;MACjC;IACF,CAAC,CAAC;IAEFZ,CAAC,CAACe,SAAS,CAAC,CAAC;IAEb,OAAOf,CAAC;EACV,CAAC,CAAC;EAEF,OAAOD,KAAK;AACd","ignoreList":[]}
@@ -0,0 +1,58 @@
1
+ import { useSyncCollectionStateToAppContext } from './useSyncCollectionStateToAppContext';
2
+ import { useCollectionInitAsyncDeps } from './useCollectionInitAsyncDeps';
3
+ import { useSelector } from '@wix/patterns';
4
+ /**
5
+ * useBaseCollectionComponentReadyFeatures - Step 5 (Shared Across All Flows)
6
+ *
7
+ * This is the shared hook used by all flows to prepare final collection features once async loading is complete.
8
+ * It handles the common functionality needed by all collection components regardless of display mode.
9
+ *
10
+ * Key Responsibilities:
11
+ * - Syncs collection state to app context for external consumption
12
+ * - Initializes async dependencies and connects them to the collection
13
+ * - Extracts and prepares common collection features (filters, search, actions, etc.)
14
+ * - Returns standardized props that all final components (Table/Grid/TableGridSwitch) can use
15
+ * - Provides consistent interface across all three rendering flows
16
+ */
17
+ export function useBaseCollectionComponentReadyFeatures(props) {
18
+ const {
19
+ collection,
20
+ config,
21
+ asyncFeaturesState,
22
+ baseStateParams
23
+ } = props;
24
+
25
+ // Extract loaded common features from async state (shared by all flows)
26
+ const {
27
+ commonCollectionFeatures
28
+ } = useSelector(() => ({
29
+ ...asyncFeaturesState.status.data
30
+ }));
31
+
32
+ // STEP 5A: Sync the collection state to app context for external access
33
+ // This allows other parts of the app to access current collection state
34
+ useSyncCollectionStateToAppContext({
35
+ collection
36
+ });
37
+
38
+ // STEP 5B: Initialize async dependencies and connect them to the collection
39
+ // This ensures all loaded features are properly connected to the collection instance
40
+ useCollectionInitAsyncDeps(asyncFeaturesState, collection);
41
+
42
+ // STEP 5C: Prepare filter functionality if filters are loaded and configured
43
+ const filtersProps = commonCollectionFeatures == null ? void 0 : commonCollectionFeatures.useFilters(config.filters, baseStateParams);
44
+
45
+ // STEP 5D: Prepare common collection features (search, bulk actions, empty states, etc.)
46
+ const commonCollectionFeaturesProps = commonCollectionFeatures == null ? void 0 : commonCollectionFeatures.useCommonCollectionFeatures({
47
+ ...config,
48
+ collectionState: collection
49
+ });
50
+
51
+ // FINAL STEP: Return standardized props for use by final components
52
+ // These props are consumed by Table, Grid, and TableGridSwitch components
53
+ return {
54
+ ...commonCollectionFeaturesProps,
55
+ filters: filtersProps == null ? void 0 : filtersProps.filterComponent
56
+ };
57
+ }
58
+ //# sourceMappingURL=useBaseCollectionComponentReadyFeatures.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["useSyncCollectionStateToAppContext","useCollectionInitAsyncDeps","useSelector","useBaseCollectionComponentReadyFeatures","props","collection","config","asyncFeaturesState","baseStateParams","commonCollectionFeatures","status","data","filtersProps","useFilters","filters","commonCollectionFeaturesProps","useCommonCollectionFeatures","collectionState","filterComponent"],"sources":["../../../src/hooks/useBaseCollectionComponentReadyFeatures.ts"],"sourcesContent":["import { useSyncCollectionStateToAppContext } from './useSyncCollectionStateToAppContext';\nimport { useCollectionInitAsyncDeps } from './useCollectionInitAsyncDeps';\nimport { BaseCollectionComponentConfig } from '../types';\nimport { CollectionState, useSelector } from '@wix/patterns';\nimport { getCommonCollectionFeaturesAsync } from './getCommonCollectionFeaturesAsync';\nimport { useBasePatternsStateParams } from './useBasePatternsStateParams';\nimport { PromiseState } from '@wix/patterns/core';\nimport { AsyncFeaturesState } from './useAsyncFeaturesPromiseState';\n\nexport interface UseBaseCollectionComponentReadyFeaturesParams {\n config: BaseCollectionComponentConfig;\n collection: CollectionState<any>;\n asyncFeaturesState: PromiseState<\n AsyncFeaturesState<ReturnType<typeof getCommonCollectionFeaturesAsync>>\n >;\n baseStateParams: ReturnType<typeof useBasePatternsStateParams>;\n}\n\n/**\n * useBaseCollectionComponentReadyFeatures - Step 5 (Shared Across All Flows)\n *\n * This is the shared hook used by all flows to prepare final collection features once async loading is complete.\n * It handles the common functionality needed by all collection components regardless of display mode.\n *\n * Key Responsibilities:\n * - Syncs collection state to app context for external consumption\n * - Initializes async dependencies and connects them to the collection\n * - Extracts and prepares common collection features (filters, search, actions, etc.)\n * - Returns standardized props that all final components (Table/Grid/TableGridSwitch) can use\n * - Provides consistent interface across all three rendering flows\n */\nexport function useBaseCollectionComponentReadyFeatures(\n props: UseBaseCollectionComponentReadyFeaturesParams,\n) {\n const { collection, config, asyncFeaturesState, baseStateParams } = props;\n\n // Extract loaded common features from async state (shared by all flows)\n const { commonCollectionFeatures } = useSelector(() => ({\n ...asyncFeaturesState.status.data,\n }));\n\n // STEP 5A: Sync the collection state to app context for external access\n // This allows other parts of the app to access current collection state\n useSyncCollectionStateToAppContext({ collection });\n\n // STEP 5B: Initialize async dependencies and connect them to the collection\n // This ensures all loaded features are properly connected to the collection instance\n useCollectionInitAsyncDeps(asyncFeaturesState, collection);\n\n // STEP 5C: Prepare filter functionality if filters are loaded and configured\n const filtersProps = commonCollectionFeatures?.useFilters(\n config.filters,\n baseStateParams,\n );\n\n // STEP 5D: Prepare common collection features (search, bulk actions, empty states, etc.)\n const commonCollectionFeaturesProps =\n commonCollectionFeatures?.useCommonCollectionFeatures({\n ...config,\n collectionState: collection,\n });\n\n // FINAL STEP: Return standardized props for use by final components\n // These props are consumed by Table, Grid, and TableGridSwitch components\n return {\n ...commonCollectionFeaturesProps,\n filters: filtersProps?.filterComponent,\n };\n}\n"],"mappings":"AAAA,SAASA,kCAAkC,QAAQ,sCAAsC;AACzF,SAASC,0BAA0B,QAAQ,8BAA8B;AAEzE,SAA0BC,WAAW,QAAQ,eAAe;AAe5D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,uCAAuCA,CACrDC,KAAoD,EACpD;EACA,MAAM;IAAEC,UAAU;IAAEC,MAAM;IAAEC,kBAAkB;IAAEC;EAAgB,CAAC,GAAGJ,KAAK;;EAEzE;EACA,MAAM;IAAEK;EAAyB,CAAC,GAAGP,WAAW,CAAC,OAAO;IACtD,GAAGK,kBAAkB,CAACG,MAAM,CAACC;EAC/B,CAAC,CAAC,CAAC;;EAEH;EACA;EACAX,kCAAkC,CAAC;IAAEK;EAAW,CAAC,CAAC;;EAElD;EACA;EACAJ,0BAA0B,CAACM,kBAAkB,EAAEF,UAAU,CAAC;;EAE1D;EACA,MAAMO,YAAY,GAAGH,wBAAwB,oBAAxBA,wBAAwB,CAAEI,UAAU,CACvDP,MAAM,CAACQ,OAAO,EACdN,eACF,CAAC;;EAED;EACA,MAAMO,6BAA6B,GACjCN,wBAAwB,oBAAxBA,wBAAwB,CAAEO,2BAA2B,CAAC;IACpD,GAAGV,MAAM;IACTW,eAAe,EAAEZ;EACnB,CAAC,CAAC;;EAEJ;EACA;EACA,OAAO;IACL,GAAGU,6BAA6B;IAChCD,OAAO,EAAEF,YAAY,oBAAZA,YAAY,CAAEM;EACzB,CAAC;AACH","ignoreList":[]}
@@ -0,0 +1,32 @@
1
+ import { useBaseCollectionParams } from './useBaseCollectionParams';
2
+ import { useFetchData } from './useFetchData';
3
+ import { useFiltersState } from './useFiltersState';
4
+ export function useBasePatternsStateParams(config, props) {
5
+ const {
6
+ visibleFieldIds
7
+ } = props;
8
+ const {
9
+ filterFieldMapping,
10
+ filtersObject,
11
+ filters
12
+ } = useFiltersState(config.filters);
13
+ const {
14
+ fetchData
15
+ } = useFetchData({
16
+ searchableFieldIds: visibleFieldIds,
17
+ filterFieldMapping
18
+ });
19
+ const params = useBaseCollectionParams({
20
+ config: config.collection,
21
+ fetchData,
22
+ filters: filtersObject
23
+ });
24
+ return {
25
+ params,
26
+ fetchData,
27
+ filterFieldMapping,
28
+ filtersObject,
29
+ filters
30
+ };
31
+ }
32
+ //# sourceMappingURL=useBasePatternsStateParams.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["useBaseCollectionParams","useFetchData","useFiltersState","useBasePatternsStateParams","config","props","visibleFieldIds","filterFieldMapping","filtersObject","filters","fetchData","searchableFieldIds","params","collection"],"sources":["../../../src/hooks/useBasePatternsStateParams.ts"],"sourcesContent":["import { useBaseCollectionParams } from './useBaseCollectionParams';\nimport { useFetchData } from './useFetchData';\nimport { BaseCollectionComponentConfig } from '../types';\nimport { useFiltersState } from './useFiltersState';\n\nexport interface UseBasePatternsStateParamsProps {\n visibleFieldIds: string[];\n}\n\nexport function useBasePatternsStateParams(\n config: BaseCollectionComponentConfig,\n props: UseBasePatternsStateParamsProps,\n) {\n const { visibleFieldIds } = props;\n\n const { filterFieldMapping, filtersObject, filters } = useFiltersState(\n config.filters,\n );\n\n const { fetchData } = useFetchData({\n searchableFieldIds: visibleFieldIds,\n filterFieldMapping,\n });\n\n const params = useBaseCollectionParams({\n config: config.collection,\n fetchData,\n filters: filtersObject,\n });\n\n return {\n params,\n fetchData,\n filterFieldMapping,\n filtersObject,\n filters,\n };\n}\n"],"mappings":"AAAA,SAASA,uBAAuB,QAAQ,2BAA2B;AACnE,SAASC,YAAY,QAAQ,gBAAgB;AAE7C,SAASC,eAAe,QAAQ,mBAAmB;AAMnD,OAAO,SAASC,0BAA0BA,CACxCC,MAAqC,EACrCC,KAAsC,EACtC;EACA,MAAM;IAAEC;EAAgB,CAAC,GAAGD,KAAK;EAEjC,MAAM;IAAEE,kBAAkB;IAAEC,aAAa;IAAEC;EAAQ,CAAC,GAAGP,eAAe,CACpEE,MAAM,CAACK,OACT,CAAC;EAED,MAAM;IAAEC;EAAU,CAAC,GAAGT,YAAY,CAAC;IACjCU,kBAAkB,EAAEL,eAAe;IACnCC;EACF,CAAC,CAAC;EAEF,MAAMK,MAAM,GAAGZ,uBAAuB,CAAC;IACrCI,MAAM,EAAEA,MAAM,CAACS,UAAU;IACzBH,SAAS;IACTD,OAAO,EAAED;EACX,CAAC,CAAC;EAEF,OAAO;IACLI,MAAM;IACNF,SAAS;IACTH,kBAAkB;IAClBC,aAAa;IACbC;EACF,CAAC;AACH","ignoreList":[]}
@@ -0,0 +1,11 @@
1
+ import { useState } from 'react';
2
+ export function useCollectionInitAsyncDeps(asyncFeaturesState, collection) {
3
+ useState(() => {
4
+ collection.hooks.addListener('beforeInitialFetch', () => {
5
+ if (asyncFeaturesState.status.isError) {
6
+ throw asyncFeaturesState.status.error;
7
+ }
8
+ });
9
+ });
10
+ }
11
+ //# sourceMappingURL=useCollectionInitAsyncDeps.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["useState","useCollectionInitAsyncDeps","asyncFeaturesState","collection","hooks","addListener","status","isError","error"],"sources":["../../../src/hooks/useCollectionInitAsyncDeps.ts"],"sourcesContent":["import { useState } from 'react';\nimport { CollectionState } from '@wix/patterns';\nimport { PromiseState } from '@wix/patterns/core';\n\nexport function useCollectionInitAsyncDeps(\n asyncFeaturesState: PromiseState<any>,\n collection: CollectionState<any, {}>,\n) {\n useState(() => {\n collection.hooks.addListener('beforeInitialFetch', () => {\n if (asyncFeaturesState.status.isError) {\n throw asyncFeaturesState.status.error;\n }\n });\n });\n}\n"],"mappings":"AAAA,SAASA,QAAQ,QAAQ,OAAO;AAIhC,OAAO,SAASC,0BAA0BA,CACxCC,kBAAqC,EACrCC,UAAoC,EACpC;EACAH,QAAQ,CAAC,MAAM;IACbG,UAAU,CAACC,KAAK,CAACC,WAAW,CAAC,oBAAoB,EAAE,MAAM;MACvD,IAAIH,kBAAkB,CAACI,MAAM,CAACC,OAAO,EAAE;QACrC,MAAML,kBAAkB,CAACI,MAAM,CAACE,KAAK;MACvC;IACF,CAAC,CAAC;EACJ,CAAC,CAAC;AACJ","ignoreList":[]}
@@ -6,6 +6,7 @@ import { useActionCell } from './useActionCell';
6
6
  import { useBulkActionToolbar } from './useBulkActionToolbar';
7
7
  import { useAutoPatternsOptimisticActions } from './useAutoPatternsOptimisticActions';
8
8
  import { useViews } from './useViews';
9
+ export * from './useFilters';
9
10
  export const useCommonCollectionFeatures = _ref => {
10
11
  var _toolbarTitle$subtitl, _toolbarTitle$subtitl2, _toolbarTitle$subtitl3, _toolbarTitle$subtitl4, _toolbarTitle$subtitl5, _toolbarTitle$subtitl6, _toolbarTitle$subtitl7;
11
12
  let {
@@ -1 +1 @@
1
- {"version":3,"names":["React","useEmptyStates","ToolbarTitle","Box","Text","TextButton","useActionCell","useBulkActionToolbar","useAutoPatternsOptimisticActions","useViews","useCommonCollectionFeatures","_ref","_toolbarTitle$subtitl","_toolbarTitle$subtitl2","_toolbarTitle$subtitl3","_toolbarTitle$subtitl4","_toolbarTitle$subtitl5","_toolbarTitle$subtitl6","_toolbarTitle$subtitl7","actionCell","actionCellConfig","bulkActionToolbar","bulkActionToolbarConfig","toolbarTitle","search","emptyState","emptyStateConfig","collection","collectionState","views","viewsConfig","optimisticActions","collectionConfig","config","collectionId","shouldShowTitle","title","createElement","subtitle","text","learnMore","info","content","direction","gap","dataHook","light","size","link","underline","skin","as","rel","target","href","url","label","itemsLimit","showTotal","undefined","shown"],"sources":["../../../src/hooks/useCommonCollectionFeatures.tsx"],"sourcesContent":["import React from 'react';\nimport { useEmptyStates } from './useEmptyStates';\n\nimport { CollectionState, ToolbarTitle } from '@wix/patterns';\n\nimport { Box, Text, TextButton } from '@wix/design-system';\nimport { BaseCollectionComponentConfig } from '../types';\nimport { useActionCell } from './useActionCell';\nimport { useBulkActionToolbar } from './useBulkActionToolbar';\nimport { useAutoPatternsOptimisticActions } from './useAutoPatternsOptimisticActions';\nimport { useViews } from './useViews';\n\nexport type UseCommonCollectionFeaturesParams = Pick<\n BaseCollectionComponentConfig,\n | 'actionCell'\n | 'toolbarTitle'\n | 'search'\n | 'emptyState'\n | 'collection'\n | 'bulkActionToolbar'\n | 'entityPageId'\n | 'views'\n> & {\n collectionState: CollectionState<any>;\n};\n\nexport const useCommonCollectionFeatures = ({\n actionCell: actionCellConfig,\n bulkActionToolbar: bulkActionToolbarConfig,\n toolbarTitle,\n search,\n emptyState: emptyStateConfig,\n collection,\n collectionState,\n views: viewsConfig,\n}: UseCommonCollectionFeaturesParams) => {\n const optimisticActions = useAutoPatternsOptimisticActions({\n collectionConfig: collection,\n collectionState,\n });\n\n const { emptyState } = useEmptyStates(emptyStateConfig);\n const actionCell = useActionCell({\n config: actionCellConfig,\n collectionId: collection.collectionId,\n });\n\n const bulkActionToolbar = useBulkActionToolbar({\n config: bulkActionToolbarConfig,\n collectionId: collection.collectionId,\n });\n\n const views = useViews(viewsConfig);\n\n const shouldShowTitle = toolbarTitle && !views;\n\n const title = shouldShowTitle ? (\n <ToolbarTitle\n title={toolbarTitle.title}\n subtitle={{\n text: toolbarTitle.subtitle?.text ?? '',\n learnMore: toolbarTitle.subtitle?.learnMore,\n info: toolbarTitle.subtitle?.info && {\n content: (\n <Box direction=\"vertical\" gap=\"6px\">\n <Text\n dataHook=\"toolbar-title-subtitle-info-content\"\n light\n size=\"small\"\n >\n {toolbarTitle.subtitle?.info?.content.text}\n </Text>\n {toolbarTitle.subtitle?.info?.content.link && (\n <TextButton\n dataHook=\"toolbar-title-subtitle-info-link\"\n size=\"small\"\n underline=\"always\"\n skin=\"light\"\n as=\"a\"\n rel=\"noopener\"\n target=\"_blank\"\n href={toolbarTitle.subtitle?.info?.content.link.url}\n >\n {toolbarTitle.subtitle?.info?.content.link.label}\n </TextButton>\n )}\n </Box>\n ),\n },\n }}\n itemsLimit={toolbarTitle.itemsLimit}\n showTotal={toolbarTitle.showTotal}\n />\n ) : undefined;\n\n return {\n search: search?.shown !== false,\n title,\n views,\n emptyState,\n actionCell,\n bulkActionToolbar,\n optimisticActions,\n };\n};\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,cAAc,QAAQ,kBAAkB;AAEjD,SAA0BC,YAAY,QAAQ,eAAe;AAE7D,SAASC,GAAG,EAAEC,IAAI,EAAEC,UAAU,QAAQ,oBAAoB;AAE1D,SAASC,aAAa,QAAQ,iBAAiB;AAC/C,SAASC,oBAAoB,QAAQ,wBAAwB;AAC7D,SAASC,g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AAY,CAACmC;EAAU,CACnC,CAAC,GACAC,SAAS;EAEb,OAAO;IACLnC,MAAM,EAAE,CAAAA,MAAM,oBAANA,MAAM,CAAEoC,KAAK,MAAK,KAAK;IAC/BxB,KAAK;IACLP,KAAK;IACLJ,UAAU;IACVN,UAAU;IACVE,iBAAiB;IACjBU;EACF,CAAC;AACH,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["React","useEmptyStates","ToolbarTitle","Box","Text","TextButton","useActionCell","useBulkActionToolbar","useAutoPatternsOptimisticActions","useViews","useCommonCollectionFeatures","_ref","_toolbarTitle$subtitl","_toolbarTitle$subtitl2","_toolbarTitle$subtitl3","_toolbarTitle$subtitl4","_toolbarTitle$subtitl5","_toolbarTitle$subtitl6","_toolbarTitle$subtitl7","actionCell","actionCellConfig","bulkActionToolbar","bulkActionToolbarConfig","toolbarTitle","search","emptyState","emptyStateConfig","collection","collectionState","views","viewsConfig","optimisticActions","collectionConfig","config","collectionId","shouldShowTitle","title","createElement","subtitle","text","learnMore","info","content","direction","gap","dataHook","light","size","link","underline","skin","as","rel","target","href","url","label","itemsLimit","showTotal","undefined","shown"],"sources":["../../../src/hooks/useCommonCollectionFeatures.tsx"],"sourcesContent":["import React from 'react';\nimport { useEmptyStates } from './useEmptyStates';\n\nimport { CollectionState, ToolbarTitle } from '@wix/patterns';\n\nimport { Box, Text, TextButton } from '@wix/design-system';\nimport { BaseCollectionComponentConfig } from '../types';\nimport { useActionCell } from './useActionCell';\nimport { useBulkActionToolbar } from './useBulkActionToolbar';\nimport { useAutoPatternsOptimisticActions } from './useAutoPatternsOptimisticActions';\nimport { useViews } from './useViews';\n\nexport * from './useFilters';\n\nexport type UseCommonCollectionFeaturesParams = Pick<\n BaseCollectionComponentConfig,\n | 'actionCell'\n | 'toolbarTitle'\n | 'search'\n | 'emptyState'\n | 'collection'\n | 'bulkActionToolbar'\n | 'entityPageId'\n | 'views'\n> & {\n collectionState: CollectionState<any>;\n};\n\nexport const useCommonCollectionFeatures = ({\n actionCell: actionCellConfig,\n bulkActionToolbar: bulkActionToolbarConfig,\n toolbarTitle,\n search,\n emptyState: emptyStateConfig,\n collection,\n collectionState,\n views: viewsConfig,\n}: UseCommonCollectionFeaturesParams) => {\n const optimisticActions = useAutoPatternsOptimisticActions({\n collectionConfig: collection,\n collectionState,\n });\n\n const { emptyState } = useEmptyStates(emptyStateConfig);\n const actionCell = useActionCell({\n config: actionCellConfig,\n collectionId: collection.collectionId,\n });\n\n const bulkActionToolbar = useBulkActionToolbar({\n config: bulkActionToolbarConfig,\n collectionId: collection.collectionId,\n });\n\n const views = useViews(viewsConfig);\n\n const shouldShowTitle = toolbarTitle && !views;\n\n const title = shouldShowTitle ? (\n <ToolbarTitle\n title={toolbarTitle.title}\n subtitle={{\n text: toolbarTitle.subtitle?.text ?? '',\n learnMore: toolbarTitle.subtitle?.learnMore,\n info: toolbarTitle.subtitle?.info && {\n content: (\n <Box direction=\"vertical\" gap=\"6px\">\n <Text\n dataHook=\"toolbar-title-subtitle-info-content\"\n light\n size=\"small\"\n >\n {toolbarTitle.subtitle?.info?.content.text}\n </Text>\n {toolbarTitle.subtitle?.info?.content.link && (\n <TextButton\n dataHook=\"toolbar-title-subtitle-info-link\"\n size=\"small\"\n underline=\"always\"\n skin=\"light\"\n as=\"a\"\n rel=\"noopener\"\n target=\"_blank\"\n href={toolbarTitle.subtitle?.info?.content.link.url}\n >\n {toolbarTitle.subtitle?.info?.content.link.label}\n </TextButton>\n )}\n </Box>\n ),\n },\n }}\n itemsLimit={toolbarTitle.itemsLimit}\n showTotal={toolbarTitle.showTotal}\n />\n ) : undefined;\n\n return {\n search: search?.shown !== false,\n title,\n views,\n emptyState,\n actionCell,\n bulkActionToolbar,\n optimisticActions,\n };\n};\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,cAAc,QAAQ,kBAAkB;AAEjD,SAA0BC,YAAY,QAAQ,eAAe;AAE7D,SAASC,GAAG,EAAEC,IAAI,EAAEC,UA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