@wix/auto-patterns 1.26.0 → 1.27.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.
- package/dist/cjs/components/AutoPatternsApp/AutoPatternsApp.js +16 -7
- package/dist/cjs/components/AutoPatternsApp/AutoPatternsApp.js.map +1 -1
- package/dist/cjs/components/AutoPatternsCollectionComponent/AutoPatternsCollectionComponent.js +2 -2
- package/dist/cjs/components/AutoPatternsCollectionComponent/AutoPatternsCollectionComponent.js.map +1 -1
- package/dist/cjs/components/AutoPatternsCollectionPage/AutoPatternsCollectionPage.js +58 -4
- package/dist/cjs/components/AutoPatternsCollectionPage/AutoPatternsCollectionPage.js.map +1 -1
- package/dist/cjs/components/AutoPatternsRoute/AutoPatternsRoutes.js +19 -5
- package/dist/cjs/components/AutoPatternsRoute/AutoPatternsRoutes.js.map +1 -1
- package/dist/cjs/dataSourceAdapters/cms/cmsAdapter.js +1 -1
- package/dist/cjs/dataSourceAdapters/cms/cmsAdapter.js.map +1 -1
- package/dist/cjs/hooks/index.js +19 -0
- package/dist/cjs/hooks/index.js.map +1 -1
- package/dist/cjs/hooks/useGridFeatures.js +3 -0
- package/dist/cjs/hooks/useGridFeatures.js.map +1 -1
- package/dist/cjs/hooks/useNavigationUtils.js +21 -6
- package/dist/cjs/hooks/useNavigationUtils.js.map +1 -1
- package/dist/cjs/hooks/useTableFeatures.js +3 -0
- package/dist/cjs/hooks/useTableFeatures.js.map +1 -1
- package/dist/cjs/hooks/useTableGridSwitchFeatures.js +3 -0
- package/dist/cjs/hooks/useTableGridSwitchFeatures.js.map +1 -1
- package/dist/cjs/hooks/useUpdateAppContextItems.js +18 -0
- package/dist/cjs/hooks/useUpdateAppContextItems.js.map +1 -0
- package/dist/cjs/providers/AppContext.js +58 -0
- package/dist/cjs/providers/AppContext.js.map +1 -0
- package/dist/cjs/providers/ItemsContext.js +37 -0
- package/dist/cjs/providers/ItemsContext.js.map +1 -0
- package/dist/cjs/providers/index.js +12 -0
- package/dist/cjs/providers/index.js.map +1 -1
- package/dist/cjs/types/types.js.map +1 -1
- package/dist/docs/auto-patterns-guide.md +119 -22
- package/dist/docs/bulk_actions.md +2 -5
- package/dist/docs/collection_page_actions.md +3 -12
- package/dist/docs/entity_page_actions.md +3 -3
- package/dist/docs/entity_page_view_actions.md +2 -2
- package/dist/docs/index.md +4 -0
- package/dist/docs/resolved_action.md +106 -0
- package/dist/esm/components/AutoPatternsApp/AutoPatternsApp.js +5 -3
- package/dist/esm/components/AutoPatternsApp/AutoPatternsApp.js.map +1 -1
- package/dist/esm/components/AutoPatternsCollectionComponent/AutoPatternsCollectionComponent.js +2 -2
- package/dist/esm/components/AutoPatternsCollectionComponent/AutoPatternsCollectionComponent.js.map +1 -1
- package/dist/esm/components/AutoPatternsCollectionPage/AutoPatternsCollectionPage.js +24 -0
- package/dist/esm/components/AutoPatternsCollectionPage/AutoPatternsCollectionPage.js.map +1 -1
- package/dist/esm/components/AutoPatternsRoute/AutoPatternsRoutes.js +8 -0
- package/dist/esm/components/AutoPatternsRoute/AutoPatternsRoutes.js.map +1 -1
- package/dist/esm/dataSourceAdapters/cms/cmsAdapter.js +1 -1
- package/dist/esm/dataSourceAdapters/cms/cmsAdapter.js.map +1 -1
- package/dist/esm/hooks/index.js +2 -0
- package/dist/esm/hooks/index.js.map +1 -1
- package/dist/esm/hooks/useGridFeatures.js +4 -1
- package/dist/esm/hooks/useGridFeatures.js.map +1 -1
- package/dist/esm/hooks/useNavigationUtils.js +21 -6
- package/dist/esm/hooks/useNavigationUtils.js.map +1 -1
- package/dist/esm/hooks/useTableFeatures.js +4 -1
- package/dist/esm/hooks/useTableFeatures.js.map +1 -1
- package/dist/esm/hooks/useTableGridSwitchFeatures.js +4 -1
- package/dist/esm/hooks/useTableGridSwitchFeatures.js.map +1 -1
- package/dist/esm/hooks/useUpdateAppContextItems.js +13 -0
- package/dist/esm/hooks/useUpdateAppContextItems.js.map +1 -0
- package/dist/esm/providers/AppContext.js +31 -0
- package/dist/esm/providers/AppContext.js.map +1 -0
- package/dist/esm/providers/ItemsContext.js +23 -0
- package/dist/esm/providers/ItemsContext.js.map +1 -0
- package/dist/esm/providers/index.js +1 -0
- package/dist/esm/providers/index.js.map +1 -1
- package/dist/esm/types/types.js.map +1 -1
- package/dist/types/components/AutoPatternsApp/AutoPatternsApp.d.ts +1 -0
- package/dist/types/components/AutoPatternsApp/AutoPatternsApp.d.ts.map +1 -1
- package/dist/types/components/AutoPatternsCollectionPage/AutoPatternsCollectionPage.d.ts.map +1 -1
- package/dist/types/components/AutoPatternsRoute/AutoPatternsRoutes.d.ts.map +1 -1
- package/dist/types/hooks/index.d.ts +2 -0
- package/dist/types/hooks/index.d.ts.map +1 -1
- package/dist/types/hooks/useGridFeatures.d.ts.map +1 -1
- package/dist/types/hooks/useNavigationUtils.d.ts +5 -1
- package/dist/types/hooks/useNavigationUtils.d.ts.map +1 -1
- package/dist/types/hooks/useTableFeatures.d.ts.map +1 -1
- package/dist/types/hooks/useTableGridSwitchFeatures.d.ts.map +1 -1
- package/dist/types/hooks/useUpdateAppContextItems.d.ts +2 -0
- package/dist/types/hooks/useUpdateAppContextItems.d.ts.map +1 -0
- package/dist/types/providers/AppContext.d.ts +11 -0
- package/dist/types/providers/AppContext.d.ts.map +1 -0
- package/dist/types/providers/ItemsContext.d.ts +11 -0
- package/dist/types/providers/ItemsContext.d.ts.map +1 -0
- package/dist/types/providers/index.d.ts +1 -0
- package/dist/types/providers/index.d.ts.map +1 -1
- package/dist/types/types/types.d.ts +1 -0
- package/dist/types/types/types.d.ts.map +1 -1
- package/package.json +14 -14
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_useFetchData","require","_patterns","_useCommonCollectionFeatures","_useFilters","_SchemaContext","_useAutoPatternsOptimisticActions","_useBaseTableFeatures","_PatternsWizardOverridesContext","useTableFeatures","configuration","_configuration$sectio","_overrides$sections","collectionId","limit","reflectQueryInUrl","selectAllScope","selectionUpdateMode","collection","filterComponent","filtersObject","filterFieldMapping","useFilters","filters","customColumns","visibleFieldIds","columns","onRowClick","stickyColumns","stickySelectionColumn","showTitleBar","useBaseTableFeatures","fetchData","useFetchData","searchableFieldIds","schema","useSchema","overrides","usePatternsWizardOverridesContext","state","useTableCollection","queryName","itemKey","item","idField","itemName","displayField","toExtendedFields","extendedFields","fetchErrorMessage","err","String","persistQueryToUrl","disableAutoSelectAllCount","selectionConsistencyMode","optimisticActions","useAutoPatternsOptimisticActions","commonFeatures","useCommonCollectionFeatures","sections","id","renderSection","TableSections","undefined","exports"],"sources":["../../../src/hooks/useTableFeatures.tsx"],"sourcesContent":["import { TableConfig } from '../types';\nimport { useFetchData } from './useFetchData';\nimport { TableSections, useTableCollection } from '@wix/patterns';\nimport { useCommonCollectionFeatures } from './useCommonCollectionFeatures';\nimport { useFilters } from './useFilters';\nimport { useSchema } from '../providers/SchemaContext';\nimport { useAutoPatternsOptimisticActions } from './useAutoPatternsOptimisticActions';\nimport { useBaseTableFeatures } from './useBaseTableFeatures';\nimport { usePatternsWizardOverridesContext } from '../providers/PatternsWizardOverridesContext';\n\nexport const useTableFeatures = (configuration: TableConfig) => {\n const {\n collectionId,\n limit,\n reflectQueryInUrl,\n selectAllScope,\n selectionUpdateMode,\n } = configuration.collection;\n\n const { filterComponent, filtersObject, filterFieldMapping } = useFilters(\n configuration.filters,\n );\n const {\n customColumns,\n visibleFieldIds,\n columns,\n onRowClick,\n stickyColumns,\n stickySelectionColumn,\n showTitleBar,\n } = useBaseTableFeatures(configuration);\n\n const { fetchData } = useFetchData({\n searchableFieldIds: visibleFieldIds,\n filterFieldMapping,\n });\n\n const schema = useSchema();\n const overrides = usePatternsWizardOverridesContext();\n\n const state = useTableCollection<any>({\n queryName: `${collectionId}`,\n itemKey: (item) => item[schema.idField],\n itemName: (item) => item[schema.displayField],\n filters: filtersObject,\n toExtendedFields: (item) => item.extendedFields,\n fetchErrorMessage: ({ err }) => String(err),\n fetchData,\n limit,\n persistQueryToUrl: reflectQueryInUrl,\n disableAutoSelectAllCount: selectAllScope === 'page',\n selectionConsistencyMode: selectionUpdateMode,\n });\n\n const optimisticActions = useAutoPatternsOptimisticActions(\n collectionId,\n state.collection,\n );\n\n const commonFeatures = useCommonCollectionFeatures({\n ...configuration,\n optimisticActions,\n });\n\n const sections =\n configuration.sections?.id &&\n overrides?.sections?.[configuration.sections.id]\n ? {\n renderSection: overrides.sections[configuration.sections.id],\n TableSections,\n }\n : undefined;\n\n return {\n ...commonFeatures,\n state,\n columns,\n filters: filterComponent,\n optimisticActions,\n customColumns,\n onRowClick,\n stickyColumns,\n stickySelectionColumn,\n showTitleBar,\n sections,\n };\n};\n"],"mappings":";;;;AACA,IAAAA,aAAA,GAAAC,OAAA;AACA,IAAAC,SAAA,GAAAD,OAAA;AACA,IAAAE,4BAAA,GAAAF,OAAA;AACA,IAAAG,WAAA,GAAAH,OAAA;AACA,IAAAI,cAAA,GAAAJ,OAAA;AACA,IAAAK,iCAAA,GAAAL,OAAA;AACA,IAAAM,qBAAA,GAAAN,OAAA;AACA,IAAAO,+BAAA,GAAAP,OAAA;AAEO,
|
|
1
|
+
{"version":3,"names":["_useFetchData","require","_patterns","_useCommonCollectionFeatures","_useFilters","_SchemaContext","_useAutoPatternsOptimisticActions","_useBaseTableFeatures","_PatternsWizardOverridesContext","_useUpdateAppContextItems","useTableFeatures","configuration","_configuration$sectio","_overrides$sections","collectionId","limit","reflectQueryInUrl","selectAllScope","selectionUpdateMode","collection","filterComponent","filtersObject","filterFieldMapping","useFilters","filters","customColumns","visibleFieldIds","columns","onRowClick","stickyColumns","stickySelectionColumn","showTitleBar","useBaseTableFeatures","fetchData","useFetchData","searchableFieldIds","schema","useSchema","overrides","usePatternsWizardOverridesContext","state","useTableCollection","queryName","itemKey","item","idField","itemName","displayField","toExtendedFields","extendedFields","fetchErrorMessage","err","String","persistQueryToUrl","disableAutoSelectAllCount","selectionConsistencyMode","items","useSelector","result","useUpdateAppContextItems","optimisticActions","useAutoPatternsOptimisticActions","commonFeatures","useCommonCollectionFeatures","sections","id","renderSection","TableSections","undefined","exports"],"sources":["../../../src/hooks/useTableFeatures.tsx"],"sourcesContent":["import { TableConfig } from '../types';\nimport { useFetchData } from './useFetchData';\nimport { TableSections, useSelector, useTableCollection } from '@wix/patterns';\nimport { useCommonCollectionFeatures } from './useCommonCollectionFeatures';\nimport { useFilters } from './useFilters';\nimport { useSchema } from '../providers/SchemaContext';\nimport { useAutoPatternsOptimisticActions } from './useAutoPatternsOptimisticActions';\nimport { useBaseTableFeatures } from './useBaseTableFeatures';\nimport { usePatternsWizardOverridesContext } from '../providers/PatternsWizardOverridesContext';\nimport { useUpdateAppContextItems } from './useUpdateAppContextItems';\n\nexport const useTableFeatures = (configuration: TableConfig) => {\n const {\n collectionId,\n limit,\n reflectQueryInUrl,\n selectAllScope,\n selectionUpdateMode,\n } = configuration.collection;\n\n const { filterComponent, filtersObject, filterFieldMapping } = useFilters(\n configuration.filters,\n );\n const {\n customColumns,\n visibleFieldIds,\n columns,\n onRowClick,\n stickyColumns,\n stickySelectionColumn,\n showTitleBar,\n } = useBaseTableFeatures(configuration);\n\n const { fetchData } = useFetchData({\n searchableFieldIds: visibleFieldIds,\n filterFieldMapping,\n });\n\n const schema = useSchema();\n const overrides = usePatternsWizardOverridesContext();\n\n const state = useTableCollection<any>({\n queryName: `${collectionId}`,\n itemKey: (item) => item[schema.idField],\n itemName: (item) => item[schema.displayField],\n filters: filtersObject,\n toExtendedFields: (item) => item.extendedFields,\n fetchErrorMessage: ({ err }) => String(err),\n fetchData,\n limit,\n persistQueryToUrl: reflectQueryInUrl,\n disableAutoSelectAllCount: selectAllScope === 'page',\n selectionConsistencyMode: selectionUpdateMode,\n });\n\n const items = useSelector(() => state.collection.result.items);\n useUpdateAppContextItems(items);\n\n const optimisticActions = useAutoPatternsOptimisticActions(\n collectionId,\n state.collection,\n );\n\n const commonFeatures = useCommonCollectionFeatures({\n ...configuration,\n optimisticActions,\n });\n\n const sections =\n configuration.sections?.id &&\n overrides?.sections?.[configuration.sections.id]\n ? {\n renderSection: overrides.sections[configuration.sections.id],\n TableSections,\n }\n : undefined;\n\n return {\n ...commonFeatures,\n state,\n columns,\n filters: filterComponent,\n optimisticActions,\n customColumns,\n onRowClick,\n stickyColumns,\n stickySelectionColumn,\n showTitleBar,\n sections,\n };\n};\n"],"mappings":";;;;AACA,IAAAA,aAAA,GAAAC,OAAA;AACA,IAAAC,SAAA,GAAAD,OAAA;AACA,IAAAE,4BAAA,GAAAF,OAAA;AACA,IAAAG,WAAA,GAAAH,OAAA;AACA,IAAAI,cAAA,GAAAJ,OAAA;AACA,IAAAK,iCAAA,GAAAL,OAAA;AACA,IAAAM,qBAAA,GAAAN,OAAA;AACA,IAAAO,+BAAA,GAAAP,OAAA;AACA,IAAAQ,yBAAA,GAAAR,OAAA;AAEO,MAAMS,gBAAgB,GAAIC,aAA0B,IAAK;EAAA,IAAAC,qBAAA,EAAAC,mBAAA;EAC9D,MAAM;IACJC,YAAY;IACZC,KAAK;IACLC,iBAAiB;IACjBC,cAAc;IACdC;EACF,CAAC,GAAGP,aAAa,CAACQ,UAAU;EAE5B,MAAM;IAAEC,eAAe;IAAEC,aAAa;IAAEC;EAAmB,CAAC,GAAG,IAAAC,sBAAU,EACvEZ,aAAa,CAACa,OAChB,CAAC;EACD,MAAM;IACJC,aAAa;IACbC,eAAe;IACfC,OAAO;IACPC,UAAU;IACVC,aAAa;IACbC,qBAAqB;IACrBC;EACF,CAAC,GAAG,IAAAC,0CAAoB,EAACrB,aAAa,CAAC;EAEvC,MAAM;IAAEsB;EAAU,CAAC,GAAG,IAAAC,0BAAY,EAAC;IACjCC,kBAAkB,EAAET,eAAe;IACnCJ;EACF,CAAC,CAAC;EAEF,MAAMc,MAAM,GAAG,IAAAC,wBAAS,EAAC,CAAC;EAC1B,MAAMC,SAAS,GAAG,IAAAC,iEAAiC,EAAC,CAAC;EAErD,MAAMC,KAAK,GAAG,IAAAC,4BAAkB,EAAM;IACpCC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b,OAAO;IACPH,OAAO,EAAEJ,eAAe;IACxBwC,iBAAiB;IACjBnC,aAAa;IACbG,UAAU;IACVC,aAAa;IACbC,qBAAqB;IACrBC,YAAY;IACZiC;EACF,CAAC;AACH,CAAC;AAACK,OAAA,CAAA3D,gBAAA,GAAAA,gBAAA","ignoreList":[]}
|
|
@@ -10,6 +10,7 @@ var _SchemaContext = require("../providers/SchemaContext");
|
|
|
10
10
|
var _useAutoPatternsOptimisticActions = require("./useAutoPatternsOptimisticActions");
|
|
11
11
|
var _useBaseGridFeatures = require("./useBaseGridFeatures");
|
|
12
12
|
var _useBaseTableFeatures = require("./useBaseTableFeatures");
|
|
13
|
+
var _useUpdateAppContextItems = require("./useUpdateAppContextItems");
|
|
13
14
|
const useTableGridSwitchFeatures = config => {
|
|
14
15
|
const schema = (0, _SchemaContext.useSchema)();
|
|
15
16
|
const {
|
|
@@ -60,6 +61,8 @@ const useTableGridSwitchFeatures = config => {
|
|
|
60
61
|
disableAutoSelectAllCount: selectAllScope === 'page',
|
|
61
62
|
selectionConsistencyMode: selectionUpdateMode
|
|
62
63
|
});
|
|
64
|
+
const items = (0, _patterns.useSelector)(() => state.collection.result.items);
|
|
65
|
+
(0, _useUpdateAppContextItems.useUpdateAppContextItems)(items);
|
|
63
66
|
const optimisticActions = (0, _useAutoPatternsOptimisticActions.useAutoPatternsOptimisticActions)(collectionId, state.collection);
|
|
64
67
|
const commonFeatures = (0, _useCommonCollectionFeatures.useCommonCollectionFeatures)({
|
|
65
68
|
...config,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_useFetchData","require","_patterns","_useCommonCollectionFeatures","_useFilters","_SchemaContext","_useAutoPatternsOptimisticActions","_useBaseGridFeatures","_useBaseTableFeatures","useTableGridSwitchFeatures","config","schema","useSchema","collectionId","limit","reflectQueryInUrl","selectAllScope","selectionUpdateMode","collection","filterComponent","filtersObject","filterFieldMapping","useFilters","filters","preset","imagePlacement","visibleFieldIds","gridVisibleFieldIds","renderItem","useBaseGridFeatures","customColumns","tableVisibleFieldIds","columns","tableColumns","onRowClick","stickyColumns","stickySelectionColumn","showTitleBar","useBaseTableFeatures","fetchData","tableFetchData","useFetchData","searchableFieldIds","Array","from","Set","state","useTableGridSwitchCollection","queryName","itemKey","item","idField","itemName","displayField","toExtendedFields","extendedFields","fetchErrorMessage","err","String","persistQueryToUrl","disableAutoSelectAllCount","selectionConsistencyMode","optimisticActions","useAutoPatternsOptimisticActions","commonFeatures","useCommonCollectionFeatures","horizontalScroll","exports"],"sources":["../../../src/hooks/useTableGridSwitchFeatures.tsx"],"sourcesContent":["import { TableGridSwitchConfig } from '../types';\nimport { useFetchData } from './useFetchData';\nimport { useTableGridSwitchCollection } from '@wix/patterns';\nimport { useCommonCollectionFeatures } from './useCommonCollectionFeatures';\nimport { useFilters } from './useFilters';\nimport { useSchema } from '../providers/SchemaContext';\nimport { useAutoPatternsOptimisticActions } from './useAutoPatternsOptimisticActions';\nimport { useBaseGridFeatures } from './useBaseGridFeatures';\nimport { useBaseTableFeatures } from './useBaseTableFeatures';\n\nexport const useTableGridSwitchFeatures = (config: TableGridSwitchConfig) => {\n const schema = useSchema();\n\n const {\n collectionId,\n limit,\n reflectQueryInUrl,\n selectAllScope,\n selectionUpdateMode,\n } = config.collection;\n\n const { filterComponent, filtersObject, filterFieldMapping } = useFilters(\n config.filters,\n );\n\n const {\n preset,\n imagePlacement,\n visibleFieldIds: gridVisibleFieldIds,\n renderItem,\n } = useBaseGridFeatures(config);\n\n const {\n customColumns,\n visibleFieldIds: tableVisibleFieldIds,\n columns: tableColumns,\n onRowClick,\n stickyColumns,\n stickySelectionColumn,\n showTitleBar,\n } = useBaseTableFeatures(config);\n\n const { fetchData: tableFetchData } = useFetchData({\n searchableFieldIds: Array.from(\n new Set([...tableVisibleFieldIds, ...gridVisibleFieldIds]),\n ),\n filterFieldMapping,\n });\n\n const state = useTableGridSwitchCollection<any>({\n queryName: `${collectionId}`,\n itemKey: (item) => item[schema.idField],\n itemName: (item) => item[schema.displayField],\n filters: filtersObject,\n toExtendedFields: (item) => item.extendedFields,\n fetchErrorMessage: ({ err }) => String(err),\n fetchData: tableFetchData,\n limit,\n persistQueryToUrl: reflectQueryInUrl,\n disableAutoSelectAllCount: selectAllScope === 'page',\n selectionConsistencyMode: selectionUpdateMode,\n });\n\n const optimisticActions = useAutoPatternsOptimisticActions(\n collectionId,\n state.collection,\n );\n\n const commonFeatures = useCommonCollectionFeatures({\n ...config,\n optimisticActions,\n });\n\n return {\n ...commonFeatures,\n state,\n columns: tableColumns,\n filters: filterComponent,\n optimisticActions,\n customColumns,\n onRowClick,\n stickyColumns,\n stickySelectionColumn,\n horizontalScroll: true,\n // Grid specific features\n imagePlacement,\n preset,\n renderItem,\n showTitleBar,\n };\n};\n"],"mappings":";;;;AACA,IAAAA,aAAA,GAAAC,OAAA;AACA,IAAAC,SAAA,GAAAD,OAAA;AACA,IAAAE,4BAAA,GAAAF,OAAA;AACA,IAAAG,WAAA,GAAAH,OAAA;AACA,IAAAI,cAAA,GAAAJ,OAAA;AACA,IAAAK,iCAAA,GAAAL,OAAA;AACA,IAAAM,oBAAA,GAAAN,OAAA;AACA,IAAAO,qBAAA,GAAAP,OAAA;AAEO,
|
|
1
|
+
{"version":3,"names":["_useFetchData","require","_patterns","_useCommonCollectionFeatures","_useFilters","_SchemaContext","_useAutoPatternsOptimisticActions","_useBaseGridFeatures","_useBaseTableFeatures","_useUpdateAppContextItems","useTableGridSwitchFeatures","config","schema","useSchema","collectionId","limit","reflectQueryInUrl","selectAllScope","selectionUpdateMode","collection","filterComponent","filtersObject","filterFieldMapping","useFilters","filters","preset","imagePlacement","visibleFieldIds","gridVisibleFieldIds","renderItem","useBaseGridFeatures","customColumns","tableVisibleFieldIds","columns","tableColumns","onRowClick","stickyColumns","stickySelectionColumn","showTitleBar","useBaseTableFeatures","fetchData","tableFetchData","useFetchData","searchableFieldIds","Array","from","Set","state","useTableGridSwitchCollection","queryName","itemKey","item","idField","itemName","displayField","toExtendedFields","extendedFields","fetchErrorMessage","err","String","persistQueryToUrl","disableAutoSelectAllCount","selectionConsistencyMode","items","useSelector","result","useUpdateAppContextItems","optimisticActions","useAutoPatternsOptimisticActions","commonFeatures","useCommonCollectionFeatures","horizontalScroll","exports"],"sources":["../../../src/hooks/useTableGridSwitchFeatures.tsx"],"sourcesContent":["import { TableGridSwitchConfig } from '../types';\nimport { useFetchData } from './useFetchData';\nimport { useSelector, useTableGridSwitchCollection } from '@wix/patterns';\nimport { useCommonCollectionFeatures } from './useCommonCollectionFeatures';\nimport { useFilters } from './useFilters';\nimport { useSchema } from '../providers/SchemaContext';\nimport { useAutoPatternsOptimisticActions } from './useAutoPatternsOptimisticActions';\nimport { useBaseGridFeatures } from './useBaseGridFeatures';\nimport { useBaseTableFeatures } from './useBaseTableFeatures';\nimport { useUpdateAppContextItems } from './useUpdateAppContextItems';\n\nexport const useTableGridSwitchFeatures = (config: TableGridSwitchConfig) => {\n const schema = useSchema();\n\n const {\n collectionId,\n limit,\n reflectQueryInUrl,\n selectAllScope,\n selectionUpdateMode,\n } = config.collection;\n\n const { filterComponent, filtersObject, filterFieldMapping } = useFilters(\n config.filters,\n );\n\n const {\n preset,\n imagePlacement,\n visibleFieldIds: gridVisibleFieldIds,\n renderItem,\n } = useBaseGridFeatures(config);\n\n const {\n customColumns,\n visibleFieldIds: tableVisibleFieldIds,\n columns: tableColumns,\n onRowClick,\n stickyColumns,\n stickySelectionColumn,\n showTitleBar,\n } = useBaseTableFeatures(config);\n\n const { fetchData: tableFetchData } = useFetchData({\n searchableFieldIds: Array.from(\n new Set([...tableVisibleFieldIds, ...gridVisibleFieldIds]),\n ),\n filterFieldMapping,\n });\n\n const state = useTableGridSwitchCollection<any>({\n queryName: `${collectionId}`,\n itemKey: (item) => item[schema.idField],\n itemName: (item) => item[schema.displayField],\n filters: filtersObject,\n toExtendedFields: (item) => item.extendedFields,\n fetchErrorMessage: ({ err }) => String(err),\n fetchData: tableFetchData,\n limit,\n persistQueryToUrl: reflectQueryInUrl,\n disableAutoSelectAllCount: selectAllScope === 'page',\n selectionConsistencyMode: selectionUpdateMode,\n });\n\n const items = useSelector(() => state.collection.result.items);\n useUpdateAppContextItems(items);\n\n const optimisticActions = useAutoPatternsOptimisticActions(\n collectionId,\n state.collection,\n );\n\n const commonFeatures = useCommonCollectionFeatures({\n ...config,\n optimisticActions,\n });\n\n return {\n ...commonFeatures,\n state,\n columns: tableColumns,\n filters: filterComponent,\n optimisticActions,\n customColumns,\n onRowClick,\n stickyColumns,\n stickySelectionColumn,\n horizontalScroll: true,\n // Grid specific features\n imagePlacement,\n preset,\n renderItem,\n showTitleBar,\n };\n};\n"],"mappings":";;;;AACA,IAAAA,aAAA,GAAAC,OAAA;AACA,IAAAC,SAAA,GAAAD,OAAA;AACA,IAAAE,4BAAA,GAAAF,OAAA;AACA,IAAAG,WAAA,GAAAH,OAAA;AACA,IAAAI,cAAA,GAAAJ,OAAA;AACA,IAAAK,iCAAA,GAAAL,OAAA;AACA,IAAAM,oBAAA,GAAAN,OAAA;AACA,IAAAO,qBAAA,GAAAP,OAAA;AACA,IAAAQ,yBAAA,GAAAR,OAAA;AAEO,MAAMS,0BAA0B,GAAIC,MAA6B,IAAK;EAC3E,MAAMC,MAAM,GAAG,IAAAC,wBAAS,EAAC,CAAC;EAE1B,MAAM;IACJC,YAAY;IACZC,KAAK;IACLC,iBAAiB;IACjBC,cAAc;IACdC;EACF,CAAC,GAAGP,MAAM,CAACQ,UAAU;EAErB,MAAM;IAAEC,eAAe;IAAEC,aAAa;IAAEC;EAAmB,CAAC,GAAG,IAAAC,sBAAU,EACvEZ,MAAM,CAACa,OACT,CAAC;EAED,MAAM;IACJC,MAAM;IACNC,cAAc;IACdC,eAAe,EAAEC,mBAAmB;IACpCC;EACF,CAAC,GAAG,IAAAC,wCAAmB,EAACnB,MAAM,CAAC;EAE/B,MAAM;IACJoB,aAAa;IACbJ,eAAe,EAAEK,oBAAoB;IACrCC,OAAO,EAAEC,YA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AEF,OAAO;IACL,GAAGE,cAAc;IACjBtB,KAAK;IACLd,OAAO,EAAEC,YAAY;IACrBV,OAAO,EAAEJ,eAAe;IACxB+C,iBAAiB;IACjBpC,aAAa;IACbI,UAAU;IACVC,aAAa;IACbC,qBAAqB;IACrBkC,gBAAgB,EAAE,IAAI;IACtB;IACA7C,cAAc;IACdD,MAAM;IACNI,UAAU;IACVS;EACF,CAAC;AACH,CAAC;AAACkC,OAAA,CAAA9D,0BAAA,GAAAA,0BAAA","ignoreList":[]}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
exports.__esModule = true;
|
|
4
|
+
exports.useUpdateAppContextItems = void 0;
|
|
5
|
+
var _react = require("react");
|
|
6
|
+
var _ItemsContext = require("../providers/ItemsContext");
|
|
7
|
+
const useUpdateAppContextItems = items => {
|
|
8
|
+
const {
|
|
9
|
+
setItems
|
|
10
|
+
} = (0, _ItemsContext.useItemsContext)();
|
|
11
|
+
(0, _react.useEffect)(() => {
|
|
12
|
+
if (items) {
|
|
13
|
+
setItems(items);
|
|
14
|
+
}
|
|
15
|
+
}, [items, setItems]);
|
|
16
|
+
};
|
|
17
|
+
exports.useUpdateAppContextItems = useUpdateAppContextItems;
|
|
18
|
+
//# sourceMappingURL=useUpdateAppContextItems.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_react","require","_ItemsContext","useUpdateAppContextItems","items","setItems","useItemsContext","useEffect","exports"],"sources":["../../../src/hooks/useUpdateAppContextItems.ts"],"sourcesContent":["import { useEffect } from 'react';\nimport { useItemsContext } from '../providers/ItemsContext';\n\nexport const useUpdateAppContextItems = (items: any[]) => {\n const { setItems } = useItemsContext();\n\n useEffect(() => {\n if (items) {\n setItems(items);\n }\n }, [items, setItems]);\n};\n"],"mappings":";;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,aAAA,GAAAD,OAAA;AAEO,MAAME,wBAAwB,GAAIC,KAAY,IAAK;EACxD,MAAM;IAAEC;EAAS,CAAC,GAAG,IAAAC,6BAAe,EAAC,CAAC;EAEtC,IAAAC,gBAAS,EAAC,MAAM;IACd,IAAIH,KAAK,EAAE;MACTC,QAAQ,CAACD,KAAK,CAAC;IACjB;EACF,CAAC,EAAE,CAACA,KAAK,EAAEC,QAAQ,CAAC,CAAC;AACvB,CAAC;AAACG,OAAA,CAAAL,wBAAA,GAAAA,wBAAA","ignoreList":[]}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
exports.__esModule = true;
|
|
4
|
+
exports.useAppContext = exports.AppContextProvider = void 0;
|
|
5
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
6
|
+
var _ItemsContext = require("./ItemsContext");
|
|
7
|
+
var _jsxFileName = "/home/builduser/work/73d19ce3378ce4dd/packages/auto-patterns/dist/cjs/providers/AppContext.tsx";
|
|
8
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
9
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
10
|
+
const AppContext = /*#__PURE__*/(0, _react.createContext)(undefined);
|
|
11
|
+
const AppContextInner = ({
|
|
12
|
+
children
|
|
13
|
+
}) => {
|
|
14
|
+
const {
|
|
15
|
+
items
|
|
16
|
+
} = (0, _ItemsContext.useItemsContext)();
|
|
17
|
+
const contextValue = {
|
|
18
|
+
items
|
|
19
|
+
};
|
|
20
|
+
return /*#__PURE__*/_react.default.createElement(AppContext.Provider, {
|
|
21
|
+
value: contextValue,
|
|
22
|
+
__self: void 0,
|
|
23
|
+
__source: {
|
|
24
|
+
fileName: _jsxFileName,
|
|
25
|
+
lineNumber: 24,
|
|
26
|
+
columnNumber: 5
|
|
27
|
+
}
|
|
28
|
+
}, children);
|
|
29
|
+
};
|
|
30
|
+
const AppContextProvider = ({
|
|
31
|
+
children
|
|
32
|
+
}) => {
|
|
33
|
+
return /*#__PURE__*/_react.default.createElement(_ItemsContext.ItemsContextProvider, {
|
|
34
|
+
__self: void 0,
|
|
35
|
+
__source: {
|
|
36
|
+
fileName: _jsxFileName,
|
|
37
|
+
lineNumber: 32,
|
|
38
|
+
columnNumber: 5
|
|
39
|
+
}
|
|
40
|
+
}, /*#__PURE__*/_react.default.createElement(AppContextInner, {
|
|
41
|
+
__self: void 0,
|
|
42
|
+
__source: {
|
|
43
|
+
fileName: _jsxFileName,
|
|
44
|
+
lineNumber: 33,
|
|
45
|
+
columnNumber: 7
|
|
46
|
+
}
|
|
47
|
+
}, children));
|
|
48
|
+
};
|
|
49
|
+
exports.AppContextProvider = AppContextProvider;
|
|
50
|
+
const useAppContext = () => {
|
|
51
|
+
const context = (0, _react.useContext)(AppContext);
|
|
52
|
+
if (context === undefined) {
|
|
53
|
+
throw new Error('useAppContext must be used within an AppContextProvider');
|
|
54
|
+
}
|
|
55
|
+
return context;
|
|
56
|
+
};
|
|
57
|
+
exports.useAppContext = useAppContext;
|
|
58
|
+
//# sourceMappingURL=AppContext.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_react","_interopRequireWildcard","require","_ItemsContext","_jsxFileName","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","AppContext","createContext","undefined","AppContextInner","children","items","useItemsContext","contextValue","createElement","Provider","value","__self","__source","fileName","lineNumber","columnNumber","AppContextProvider","ItemsContextProvider","exports","useAppContext","context","useContext","Error"],"sources":["../../../src/providers/AppContext.tsx"],"sourcesContent":["import React, { ReactNode, createContext, useContext } from 'react';\nimport {\n ItemsContextProvider,\n ItemsContextValue,\n useItemsContext,\n} from './ItemsContext';\n\ninterface AppContextValue extends Pick<ItemsContextValue, 'items'> {}\n\nconst AppContext = createContext<AppContextValue | undefined>(undefined);\n\nexport interface AppContextProviderProps {\n children: ReactNode;\n}\n\nconst AppContextInner: React.FC<AppContextProviderProps> = ({ children }) => {\n const { items } = useItemsContext();\n\n const contextValue: AppContextValue = {\n items,\n };\n\n return (\n <AppContext.Provider value={contextValue}>{children}</AppContext.Provider>\n );\n};\n\nexport const AppContextProvider: React.FC<AppContextProviderProps> = ({\n children,\n}) => {\n return (\n <ItemsContextProvider>\n <AppContextInner>{children}</AppContextInner>\n </ItemsContextProvider>\n );\n};\n\nexport const useAppContext = (): AppContextValue => {\n const context = useContext(AppContext);\n\n if (context === undefined) {\n throw new Error('useAppContext must be used within an AppContextProvider');\n }\n\n return context;\n};\n"],"mappings":";;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,aAAA,GAAAD,OAAA;AAIwB,IAAAE,YAAA;AAAA,SAAAC,yBAAAC,CAAA,6BAAAC,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,CAAA,WAAAA,CAAA,GAAAG,CAAA,GAAAD,CAAA,KAAAF,CAAA;AAAA,SAAAL,wBAAAK,CAAA,EAAAE,CAAA,SAAAA,CAAA,IAAAF,CAAA,IAAAA,CAAA,CAAAI,UAAA,SAAAJ,CAAA,eAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,WAAAK,OAAA,EAAAL,CAAA,QAAAG,CAAA,GAAAJ,wBAAA,CAAAG,CAAA,OAAAC,CAAA,IAAAA,CAAA,CAA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BAAoB;IAAAN,MAAA;IAAAC,QAAA;MAAAC,QAAA,EAAAlC,YAAA;MAAAmC,UAAA;MAAAC,YAAA;IAAA;EAAA,gBACnBxC,MAAA,CAAAW,OAAA,CAAAsB,aAAA,CAACL,eAAe;IAAAQ,MAAA;IAAAC,QAAA;MAAAC,QAAA,EAAAlC,YAAA;MAAAmC,UAAA;MAAAC,YAAA;IAAA;EAAA,GAAEX,QAA0B,CACxB,CAAC;AAE3B,CAAC;AAACc,OAAA,CAAAF,kBAAA,GAAAA,kBAAA;AAEK,MAAMG,aAAa,GAAGA,CAAA,KAAuB;EAClD,MAAMC,OAAO,GAAG,IAAAC,iBAAU,EAACrB,UAAU,CAAC;EAEtC,IAAIoB,OAAO,KAAKlB,SAAS,EAAE;IACzB,MAAM,IAAIoB,KAAK,CAAC,yDAAyD,CAAC;EAC5E;EAEA,OAAOF,OAAO;AAChB,CAAC;AAACF,OAAA,CAAAC,aAAA,GAAAA,aAAA","ignoreList":[]}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
exports.__esModule = true;
|
|
4
|
+
exports.useItemsContext = exports.ItemsContextProvider = void 0;
|
|
5
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
6
|
+
var _jsxFileName = "/home/builduser/work/73d19ce3378ce4dd/packages/auto-patterns/dist/cjs/providers/ItemsContext.tsx";
|
|
7
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
8
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
9
|
+
const ItemsContext = /*#__PURE__*/(0, _react.createContext)(undefined);
|
|
10
|
+
const ItemsContextProvider = ({
|
|
11
|
+
children
|
|
12
|
+
}) => {
|
|
13
|
+
const [items, setItems] = (0, _react.useState)([]);
|
|
14
|
+
const contextValue = {
|
|
15
|
+
items,
|
|
16
|
+
setItems
|
|
17
|
+
};
|
|
18
|
+
return /*#__PURE__*/_react.default.createElement(ItemsContext.Provider, {
|
|
19
|
+
value: contextValue,
|
|
20
|
+
__self: void 0,
|
|
21
|
+
__source: {
|
|
22
|
+
fileName: _jsxFileName,
|
|
23
|
+
lineNumber: 25,
|
|
24
|
+
columnNumber: 5
|
|
25
|
+
}
|
|
26
|
+
}, children);
|
|
27
|
+
};
|
|
28
|
+
exports.ItemsContextProvider = ItemsContextProvider;
|
|
29
|
+
const useItemsContext = () => {
|
|
30
|
+
const context = (0, _react.useContext)(ItemsContext);
|
|
31
|
+
if (context === undefined) {
|
|
32
|
+
throw new Error('useItemsContext must be used within an ItemsContextProvider');
|
|
33
|
+
}
|
|
34
|
+
return context;
|
|
35
|
+
};
|
|
36
|
+
exports.useItemsContext = useItemsContext;
|
|
37
|
+
//# sourceMappingURL=ItemsContext.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_react","_interopRequireWildcard","require","_jsxFileName","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","ItemsContext","createContext","undefined","ItemsContextProvider","children","items","setItems","useState","contextValue","createElement","Provider","value","__self","__source","fileName","lineNumber","columnNumber","exports","useItemsContext","context","useContext","Error"],"sources":["../../../src/providers/ItemsContext.tsx"],"sourcesContent":["import React, { ReactNode, createContext, useContext, useState } from 'react';\n\nexport interface ItemsContextValue {\n items: any[];\n setItems: (items: any[]) => void;\n}\n\nconst ItemsContext = createContext<ItemsContextValue | undefined>(undefined);\n\nexport interface ItemsContextProviderProps {\n children: ReactNode;\n}\n\nexport const ItemsContextProvider: React.FC<ItemsContextProviderProps> = ({\n children,\n}) => {\n const [items, setItems] = useState<any[]>([]);\n\n const contextValue: ItemsContextValue = {\n items,\n setItems,\n };\n\n return (\n <ItemsContext.Provider value={contextValue}>\n {children}\n </ItemsContext.Provider>\n );\n};\n\nexport const useItemsContext = (): ItemsContextValue => {\n const context = useContext(ItemsContext);\n\n if (context === undefined) {\n throw new Error(\n 'useItemsContext must be used within an ItemsContextProvider',\n );\n }\n\n return context;\n};\n"],"mappings":";;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AAA8E,IAAAC,YAAA;AAAA,SAAAC,yBAAAC,CAAA,6BAAAC,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,CAAA,WAAAA,CAAA,GAAAG,CAAA,GAAAD,CAAA,KAAAF,CAAA;AAAA,SAAAJ,wBAAAI,CAAA,EAAAE,CAAA,SAAAA,CAAA,IAAAF,CAAA,IAAAA,CAAA,CAAAI,UAAA,SAAAJ,CAAA,eAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,WAAAK,OAAA,EAAAL,CAAA,QAAAG,CAAA,GAAAJ,wBAAA,CAAAG,CAAA,OAAAC,CAAA,IAAAA,CAAA,CAAAG,GAAA,CAAAN,CAAA,UAAAG,CAAA,CAAAI,GAAA,CAAAP,CAAA,OAAAQ,CAAA,KAAAC,SAAA,UAAAC,CAAA,GAAAC,MAAA,CAAAC,cAAA,IAAAD,MAAA,CAAAE,wBAAA,WAAAC,CAAA,IAAAd,CAAA,oBAAAc,CAAA,OAAAC,cAAA,CAAAC,IAAA,CAAAhB,CAAA,EAAAc,CAAA,SAAAG,CAAA,GAAAP,CAAA,GAAAC,MAAA,CAAAE,wBAAA,CA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= {
|
|
5
|
+
useAppContext: true
|
|
6
|
+
};
|
|
7
|
+
exports.useAppContext = void 0;
|
|
4
8
|
var _SchemaContext = require("./SchemaContext");
|
|
5
9
|
Object.keys(_SchemaContext).forEach(function (key) {
|
|
6
10
|
if (key === "default" || key === "__esModule") return;
|
|
11
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
7
12
|
if (key in exports && exports[key] === _SchemaContext[key]) return;
|
|
8
13
|
exports[key] = _SchemaContext[key];
|
|
9
14
|
});
|
|
10
15
|
var _PatternsWizardOverridesContext = require("./PatternsWizardOverridesContext");
|
|
11
16
|
Object.keys(_PatternsWizardOverridesContext).forEach(function (key) {
|
|
12
17
|
if (key === "default" || key === "__esModule") return;
|
|
18
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
13
19
|
if (key in exports && exports[key] === _PatternsWizardOverridesContext[key]) return;
|
|
14
20
|
exports[key] = _PatternsWizardOverridesContext[key];
|
|
15
21
|
});
|
|
16
22
|
var _ModalContext = require("./ModalContext");
|
|
17
23
|
Object.keys(_ModalContext).forEach(function (key) {
|
|
18
24
|
if (key === "default" || key === "__esModule") return;
|
|
25
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
19
26
|
if (key in exports && exports[key] === _ModalContext[key]) return;
|
|
20
27
|
exports[key] = _ModalContext[key];
|
|
21
28
|
});
|
|
22
29
|
var _SchemaRegistryContext = require("./SchemaRegistryContext");
|
|
23
30
|
Object.keys(_SchemaRegistryContext).forEach(function (key) {
|
|
24
31
|
if (key === "default" || key === "__esModule") return;
|
|
32
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
25
33
|
if (key in exports && exports[key] === _SchemaRegistryContext[key]) return;
|
|
26
34
|
exports[key] = _SchemaRegistryContext[key];
|
|
27
35
|
});
|
|
28
36
|
var _AppConfigContext = require("./AppConfigContext");
|
|
29
37
|
Object.keys(_AppConfigContext).forEach(function (key) {
|
|
30
38
|
if (key === "default" || key === "__esModule") return;
|
|
39
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
31
40
|
if (key in exports && exports[key] === _AppConfigContext[key]) return;
|
|
32
41
|
exports[key] = _AppConfigContext[key];
|
|
33
42
|
});
|
|
34
43
|
var _ErrorContext = require("./ErrorContext");
|
|
35
44
|
Object.keys(_ErrorContext).forEach(function (key) {
|
|
36
45
|
if (key === "default" || key === "__esModule") return;
|
|
46
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
37
47
|
if (key in exports && exports[key] === _ErrorContext[key]) return;
|
|
38
48
|
exports[key] = _ErrorContext[key];
|
|
39
49
|
});
|
|
50
|
+
var _AppContext = require("./AppContext");
|
|
51
|
+
exports.useAppContext = _AppContext.useAppContext;
|
|
40
52
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_SchemaContext","require","Object","keys","forEach","key","exports","_PatternsWizardOverridesContext","_ModalContext","_SchemaRegistryContext","_AppConfigContext","_ErrorContext"],"sources":["../../../src/providers/index.ts"],"sourcesContent":["export * from './SchemaContext';\nexport * from './PatternsWizardOverridesContext';\nexport * from './ModalContext';\nexport * from './SchemaRegistryContext';\nexport * from './AppConfigContext';\nexport * from './ErrorContext';\n"],"mappings":"
|
|
1
|
+
{"version":3,"names":["_SchemaContext","require","Object","keys","forEach","key","prototype","hasOwnProperty","call","_exportNames","exports","_PatternsWizardOverridesContext","_ModalContext","_SchemaRegistryContext","_AppConfigContext","_ErrorContext","_AppContext","useAppContext"],"sources":["../../../src/providers/index.ts"],"sourcesContent":["export * from './SchemaContext';\nexport * from './PatternsWizardOverridesContext';\nexport * from './ModalContext';\nexport * from './SchemaRegistryContext';\nexport * from './AppConfigContext';\nexport * from './ErrorContext';\nexport { useAppContext } from './AppContext';\n"],"mappings":";;;;;;;AAAA,IAAAA,cAAA,GAAAC,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAH,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AA,EAAAJ,GAAA;EAAA,IAAAA,GAAA,IAAAK,OAAA,IAAAA,OAAA,CAAAL,GAAA,MAAAQ,sBAAA,CAAAR,GAAA;EAAAK,OAAA,CAAAL,GAAA,IAAAQ,sBAAA,CAAAR,GAAA;AAAA;AACA,IAAAS,iBAAA,GAAAb,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAW,iBAAA,EAAAV,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAC,YAAA,EAAAJ,GAAA;EAAA,IAAAA,GAAA,IAAAK,OAAA,IAAAA,OAAA,CAAAL,GAAA,MAAAS,iBAAA,CAAAT,GAAA;EAAAK,OAAA,CAAAL,GAAA,IAAAS,iBAAA,CAAAT,GAAA;AAAA;AACA,IAAAU,aAAA,GAAAd,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAY,aAAA,EAAAX,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAC,YAAA,EAAAJ,GAAA;EAAA,IAAAA,GAAA,IAAAK,OAAA,IAAAA,OAAA,CAAAL,GAAA,MAAAU,aAAA,CAAAV,GAAA;EAAAK,OAAA,CAAAL,GAAA,IAAAU,aAAA,CAAAV,GAAA;AAAA;AACA,IAAAW,WAAA,GAAAf,OAAA;AAA6CS,OAAA,CAAAO,aAAA,GAAAD,WAAA,CAAAC,aAAA","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["../../../src/types/types.ts"],"sourcesContent":["import { EntityPageConfig } from './EntityPageConfig';\nimport { CollectionPageConfig } from './CollectionPageConfig';\n\ninterface BaseCollectionConfigCommon {\n collectionId: string;\n}\n\ninterface CMSCollectionConfig extends BaseCollectionConfigCommon {\n entityTypeSource: 'cms';\n custom?: never;\n}\n\ninterface CustomCollectionConfig extends BaseCollectionConfigCommon {\n entityTypeSource: 'custom';\n custom: {\n id: string;\n };\n}\n\nexport type BaseCollectionConfig = CMSCollectionConfig | CustomCollectionConfig;\n\nexport type PatternsFieldType =\n | 'SHORT_TEXT'\n | 'LONG_TEXT'\n | 'NUMBER'\n | 'BOOLEAN'\n | 'DATE'\n | 'DATETIME'\n | 'URL'\n | 'ARRAY'\n | 'REFERENCE'\n | 'IMAGE';\n\nexport interface AppConfig {\n pages: PageConfig[];\n}\n\nexport interface BasePageConfig {\n id: string;\n appMainPage?: boolean;\n}\n\nexport interface CollectionPageConfigType extends BasePageConfig {\n type: 'collectionPage';\n collectionPage: CollectionPageConfig;\n entityPage?: never;\n}\n\nexport interface EntityPageConfigType extends BasePageConfig {\n type: 'entityPage';\n entityPage: EntityPageConfig;\n collectionPage?: never;\n}\n\nexport type PageConfig = CollectionPageConfigType | EntityPageConfigType;\n\nexport type EntityProps = { [key: string]: any };\n\nexport interface IMenuItem<T extends EntityProps = any> {\n item: T;\n}\nexport interface IColumnValue<T> {\n value: T;\n row: Record<string, any>;\n}\n\nexport type QueryOperator =\n | 'CONTAINS'\n | 'ENDS_WITH'\n | 'EQ'\n | 'EXISTS'\n | 'GT'\n | 'GTE'\n | 'HAS_ALL'\n | 'HAS_SOME'\n | 'LT'\n | 'LTE'\n | 'NE'\n | 'STARTS_WITH'\n | 'URLIZED';\n\ninterface BaseField {\n id: string;\n displayName: string;\n validation?: {\n numberRange?: NumberRange;\n stringLengthRange?: StringLengthRange;\n required: boolean;\n };\n capabilities: {\n supportedQueryOperators: QueryOperator[];\n sortable: boolean;\n };\n}\n\nexport interface ReferenceField extends BaseField {\n type: 'REFERENCE';\n referenceMetadata: {\n referencedCollectionId: string;\n };\n}\n\nexport interface NonReferenceField extends BaseField {\n type: Exclude<PatternsFieldType, 'REFERENCE'>;\n}\n\nexport type Field = ReferenceField | NonReferenceField;\n\nexport interface NumberRange {\n min?: number;\n max?: number;\n}\nexport interface StringLengthRange {\n minLength?: number;\n maxLength?: number;\n}\n\nexport interface Query {\n limit: number;\n offset: number;\n page: number;\n search?: string;\n cursor?: string | null;\n filters: Record<string, any>;\n sort?: {\n fieldName: string;\n order: 'asc' | 'desc';\n }[];\n}\n\nexport interface SchemaConfig {\n id: string;\n fields: Record<string, Field | undefined>;\n displayField: string;\n idField: string;\n actions: {\n get: (entityId: string) => Promise<any>;\n create: (newEntity: Partial<any>) => Promise<any>;\n update: (updatedEntity: any) => Promise<any>;\n delete: (entityId: string) => Promise<any>;\n bulkDelete: (entityIds: string[]) => Promise<any>;\n find: (\n query: Query,\n options?: {\n searchableFieldIds?: string[];\n filterFieldMapping?: Record<string, { fieldId: string }>;\n },\n ) => Promise<{ items: any[]; total: number }>;\n };\n}\n"],"mappings":"","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":[],"sources":["../../../src/types/types.ts"],"sourcesContent":["import { EntityPageConfig } from './EntityPageConfig';\nimport { CollectionPageConfig } from './CollectionPageConfig';\n\ninterface BaseCollectionConfigCommon {\n collectionId: string;\n}\n\ninterface CMSCollectionConfig extends BaseCollectionConfigCommon {\n entityTypeSource: 'cms';\n custom?: never;\n}\n\ninterface CustomCollectionConfig extends BaseCollectionConfigCommon {\n entityTypeSource: 'custom';\n custom: {\n id: string;\n };\n}\n\nexport type BaseCollectionConfig = CMSCollectionConfig | CustomCollectionConfig;\n\nexport type PatternsFieldType =\n | 'SHORT_TEXT'\n | 'LONG_TEXT'\n | 'NUMBER'\n | 'BOOLEAN'\n | 'DATE'\n | 'DATETIME'\n | 'URL'\n | 'ARRAY'\n | 'REFERENCE'\n | 'IMAGE';\n\nexport interface AppConfig {\n pages: PageConfig[];\n layout?: 'panel';\n}\n\nexport interface BasePageConfig {\n id: string;\n appMainPage?: boolean;\n}\n\nexport interface CollectionPageConfigType extends BasePageConfig {\n type: 'collectionPage';\n collectionPage: CollectionPageConfig;\n entityPage?: never;\n}\n\nexport interface EntityPageConfigType extends BasePageConfig {\n type: 'entityPage';\n entityPage: EntityPageConfig;\n collectionPage?: never;\n}\n\nexport type PageConfig = CollectionPageConfigType | EntityPageConfigType;\n\nexport type EntityProps = { [key: string]: any };\n\nexport interface IMenuItem<T extends EntityProps = any> {\n item: T;\n}\nexport interface IColumnValue<T> {\n value: T;\n row: Record<string, any>;\n}\n\nexport type QueryOperator =\n | 'CONTAINS'\n | 'ENDS_WITH'\n | 'EQ'\n | 'EXISTS'\n | 'GT'\n | 'GTE'\n | 'HAS_ALL'\n | 'HAS_SOME'\n | 'LT'\n | 'LTE'\n | 'NE'\n | 'STARTS_WITH'\n | 'URLIZED';\n\ninterface BaseField {\n id: string;\n displayName: string;\n validation?: {\n numberRange?: NumberRange;\n stringLengthRange?: StringLengthRange;\n required: boolean;\n };\n capabilities: {\n supportedQueryOperators: QueryOperator[];\n sortable: boolean;\n };\n}\n\nexport interface ReferenceField extends BaseField {\n type: 'REFERENCE';\n referenceMetadata: {\n referencedCollectionId: string;\n };\n}\n\nexport interface NonReferenceField extends BaseField {\n type: Exclude<PatternsFieldType, 'REFERENCE'>;\n}\n\nexport type Field = ReferenceField | NonReferenceField;\n\nexport interface NumberRange {\n min?: number;\n max?: number;\n}\nexport interface StringLengthRange {\n minLength?: number;\n maxLength?: number;\n}\n\nexport interface Query {\n limit: number;\n offset: number;\n page: number;\n search?: string;\n cursor?: string | null;\n filters: Record<string, any>;\n sort?: {\n fieldName: string;\n order: 'asc' | 'desc';\n }[];\n}\n\nexport interface SchemaConfig {\n id: string;\n fields: Record<string, Field | undefined>;\n displayField: string;\n idField: string;\n actions: {\n get: (entityId: string) => Promise<any>;\n create: (newEntity: Partial<any>) => Promise<any>;\n update: (updatedEntity: any) => Promise<any>;\n delete: (entityId: string) => Promise<any>;\n bulkDelete: (entityIds: string[]) => Promise<any>;\n find: (\n query: Query,\n options?: {\n searchableFieldIds?: string[];\n filterFieldMapping?: Record<string, { fieldId: string }>;\n },\n ) => Promise<{ items: any[]; total: number }>;\n };\n}\n"],"mappings":"","ignoreList":[]}
|
|
@@ -803,7 +803,7 @@ Custom collection page actions execute JavaScript code that you define for colle
|
|
|
803
803
|
```typescript
|
|
804
804
|
import { CustomActionCollectionPageActionResolver } from '@wix/auto-patterns';
|
|
805
805
|
import React from 'react';
|
|
806
|
-
import { Download } from '@wix/ui-icons-common';
|
|
806
|
+
import { Download } from '@wix/wix-ui-icons-common';
|
|
807
807
|
|
|
808
808
|
// IMPORTANT: Function name MUST match the action id in your configuration
|
|
809
809
|
export const exportCollection: CustomActionCollectionPageActionResolver = (params) => {
|
|
@@ -923,16 +923,7 @@ Row click actions are configured at the table level using the `onRowClick` prope
|
|
|
923
923
|
|
|
924
924
|
⚠️ **CRITICAL**: When you configure `onRowClick` in your TypeScript configuration, you MUST provide a complete working implementation. The Auto Patterns framework cannot function without it.
|
|
925
925
|
|
|
926
|
-
Custom row click actions use the `CustomActionCollectionPageActionOnRowClickResolver` type and MUST return a `ResolvedAction
|
|
927
|
-
|
|
928
|
-
#### Required Return Object Structure:
|
|
929
|
-
```typescript
|
|
930
|
-
return {
|
|
931
|
-
label: string, // REQUIRED: Action label
|
|
932
|
-
icon: ReactElement, // REQUIRED: Icon component
|
|
933
|
-
onClick: () => void // REQUIRED: Click handler function
|
|
934
|
-
};
|
|
935
|
-
```
|
|
926
|
+
Custom row click actions use the `CustomActionCollectionPageActionOnRowClickResolver` type and MUST return a `ResolvedAction`. See [ResolvedAction Reference](./resolved_action.md) for complete field documentation.
|
|
936
927
|
|
|
937
928
|
#### Complete Implementation Example:
|
|
938
929
|
|
|
@@ -1092,7 +1083,7 @@ export const quickToggle: CustomActionCollectionPageActionOnRowClickResolver = (
|
|
|
1092
1083
|
- **MANDATORY IMPLEMENTATION**: If you configure `onRowClick` in TypeScript configuration, you MUST provide a complete working implementation - the framework cannot function without it
|
|
1093
1084
|
- The action `id` in the configuration MUST exactly match the function name exported from your actions folder
|
|
1094
1085
|
- The implementation must use the `CustomActionCollectionPageActionOnRowClickResolver` type
|
|
1095
|
-
- **Required Return Object**: Must return
|
|
1086
|
+
- **Required Return Object**: Must return a `ResolvedAction` object - see [ResolvedAction Reference](./resolved_action.md)
|
|
1096
1087
|
- Access the clicked item's data through `actionParams.item`
|
|
1097
1088
|
- The implementation must be exported as a named export and registered in your `PatternsWizardOverridesProvider`
|
|
1098
1089
|
- When `onRowClick` is configured, the default navigation to entity page is completely disabled
|
|
@@ -1843,11 +1834,8 @@ Custom bulk actions execute JavaScript code that you define for bulk operations.
|
|
|
1843
1834
|
- Be registered in the `actions` property of your `PatternsWizardOverridesProvider`
|
|
1844
1835
|
- Follow JavaScript identifier naming rules (camelCase recommended)
|
|
1845
1836
|
|
|
1846
|
-
2. The implementation must return
|
|
1847
|
-
|
|
1848
|
-
- `icon`: An Icon component from "@wix/wix-ui-icons-common"
|
|
1849
|
-
- `onClick`: Handler function for the bulk action
|
|
1850
|
-
- `hidden` (optional): Boolean to hide the action when true
|
|
1837
|
+
2. The implementation must return a `ResolvedAction`:
|
|
1838
|
+
For complete field documentation, see [ResolvedAction Reference](./resolved_action.md).
|
|
1851
1839
|
|
|
1852
1840
|
3. The implementation must:
|
|
1853
1841
|
- Use the correct type: `CustomBulkActionsActionResolver`
|
|
@@ -2470,7 +2458,7 @@ export const myMoreAction: CustomEntityPageActionResolver = (params) => {
|
|
|
2470
2458
|
|
|
2471
2459
|
return {
|
|
2472
2460
|
label: 'My More Action',
|
|
2473
|
-
icon: <MyIcon />, //
|
|
2461
|
+
icon: <MyIcon />, // required
|
|
2474
2462
|
onClick: () => {
|
|
2475
2463
|
// Your custom logic here
|
|
2476
2464
|
},
|
|
@@ -2490,7 +2478,7 @@ export const myMoreAction: CustomEntityPageActionResolver = (params) => {
|
|
|
2490
2478
|
- The implementation must use the `CustomEntityPageActionResolver` type.
|
|
2491
2479
|
- The implementation must be exported as a named export (not default export).
|
|
2492
2480
|
- The function receives `{ actionParams, sdk }` as parameters.
|
|
2493
|
-
- The returned object must
|
|
2481
|
+
- The returned object must be a `ResolvedAction`. See [ResolvedAction Reference](./resolved_action.md) for complete documentation.
|
|
2494
2482
|
|
|
2495
2483
|
---
|
|
2496
2484
|
|
|
@@ -2501,7 +2489,7 @@ export const myMoreAction: CustomEntityPageActionResolver = (params) => {
|
|
|
2501
2489
|
✓ Custom actions match implementations in overrides
|
|
2502
2490
|
✓ The resolver is exported and registered in the `actions` property of your `PatternsWizardOverridesProvider`
|
|
2503
2491
|
✓ The function signature matches `CustomEntityPageActionResolver`
|
|
2504
|
-
✓ The returned object
|
|
2492
|
+
✓ The returned object is a `ResolvedAction` (see [ResolvedAction Reference](./resolved_action.md))
|
|
2505
2493
|
|
|
2506
2494
|
---
|
|
2507
2495
|
|
|
@@ -2608,7 +2596,7 @@ View mode actions follow the same resolver patterns as collection page actions:
|
|
|
2608
2596
|
These actions are handled automatically by the AutoPatterns framework using the configuration provided.
|
|
2609
2597
|
|
|
2610
2598
|
### For Custom Actions
|
|
2611
|
-
Custom actions require resolver implementations
|
|
2599
|
+
Custom actions require resolver implementations that return a `ResolvedAction` object. See [ResolvedAction Reference](./resolved_action.md) for complete field documentation.
|
|
2612
2600
|
|
|
2613
2601
|
```typescript
|
|
2614
2602
|
import { CustomEntityPageActionResolver } from '@wix/auto-patterns/types';
|
|
@@ -2619,7 +2607,7 @@ export const duplicateProduct: CustomEntityPageActionResolver = (params) => {
|
|
|
2619
2607
|
const schema = sdk.getSchema(sdk.collectionId);
|
|
2620
2608
|
return {
|
|
2621
2609
|
label: 'Duplicate Product',
|
|
2622
|
-
icon: <DuplicateIcon />, //
|
|
2610
|
+
icon: <DuplicateIcon />, // required
|
|
2623
2611
|
onClick: async () => {
|
|
2624
2612
|
// Your custom duplication logic here
|
|
2625
2613
|
await schema.actions.create({
|
|
@@ -2650,6 +2638,115 @@ export const duplicateProduct: CustomEntityPageActionResolver = (params) => {
|
|
|
2650
2638
|
|
|
2651
2639
|
---
|
|
2652
2640
|
|
|
2641
|
+
# ResolvedAction: Common Return Type for Custom Actions
|
|
2642
|
+
|
|
2643
|
+
All custom action resolvers in Auto Patterns must return a `ResolvedAction`. This applies to:
|
|
2644
|
+
- Collection page actions (primary, secondary, menus) and `onRowClick`
|
|
2645
|
+
- Entity page actions (view mode: primary/secondary/more; edit mode: moreActions)
|
|
2646
|
+
- Bulk action toolbar actions
|
|
2647
|
+
- Action Cell actions
|
|
2648
|
+
|
|
2649
|
+
## Type Definition
|
|
2650
|
+
|
|
2651
|
+
From `@wix/auto-patterns`:
|
|
2652
|
+
|
|
2653
|
+
```typescript
|
|
2654
|
+
export interface ResolvedAction {
|
|
2655
|
+
label: string;
|
|
2656
|
+
icon: IconElement;
|
|
2657
|
+
onClick: () => void;
|
|
2658
|
+
disabled?: boolean;
|
|
2659
|
+
hidden?: boolean;
|
|
2660
|
+
tooltip?: string;
|
|
2661
|
+
skin?: string;
|
|
2662
|
+
}
|
|
2663
|
+
```
|
|
2664
|
+
|
|
2665
|
+
## Field Reference
|
|
2666
|
+
|
|
2667
|
+
### Required Fields
|
|
2668
|
+
|
|
2669
|
+
- **`label`** (string): Text displayed in the button or menu item.
|
|
2670
|
+
- **`icon`** (IconElement): An icon component, typically from `@wix/wix-ui-icons-common`. Example: `icon: <Delete />`.
|
|
2671
|
+
- **`onClick`** (function): Handler function invoked when the user triggers the action. Can be async.
|
|
2672
|
+
|
|
2673
|
+
### Optional Fields
|
|
2674
|
+
|
|
2675
|
+
- **`disabled`** (boolean): When `true`, renders the action as disabled. Pair with `tooltip` to explain why the action is unavailable.
|
|
2676
|
+
- **`hidden`** (boolean): When `true`, the action is completely omitted from the UI. Useful for permission-based or state-based visibility control.
|
|
2677
|
+
- **`tooltip`** (string): Tooltip text displayed on hover. Especially useful when the action is disabled.
|
|
2678
|
+
- **`skin`** (string): Visual style of the action button. Availability may vary by placement context. Recommended values:
|
|
2679
|
+
- Primary actions: `"standard"`, `"inverted"`, `"premium"`
|
|
2680
|
+
- Secondary/more/menu items: `"dark"`, `"destructive"`, `"premium"`
|
|
2681
|
+
- If unsure, omit `skin` or use `"standard"` for primary actions and `"dark"` for secondary actions.
|
|
2682
|
+
|
|
2683
|
+
## Examples
|
|
2684
|
+
|
|
2685
|
+
### Minimal Example
|
|
2686
|
+
|
|
2687
|
+
```typescript
|
|
2688
|
+
import { Add } from '@wix/wix-ui-icons-common';
|
|
2689
|
+
|
|
2690
|
+
return {
|
|
2691
|
+
label: 'Create',
|
|
2692
|
+
icon: <Add />,
|
|
2693
|
+
onClick: () => {
|
|
2694
|
+
// Your action logic here
|
|
2695
|
+
}
|
|
2696
|
+
};
|
|
2697
|
+
```
|
|
2698
|
+
|
|
2699
|
+
### Complete Example with State Control
|
|
2700
|
+
|
|
2701
|
+
```typescript
|
|
2702
|
+
import { Download } from '@wix/wix-ui-icons-common';
|
|
2703
|
+
|
|
2704
|
+
return {
|
|
2705
|
+
label: 'Export',
|
|
2706
|
+
icon: <Download />,
|
|
2707
|
+
onClick: async () => {
|
|
2708
|
+
try {
|
|
2709
|
+
// Perform export logic using SDK
|
|
2710
|
+
await performExport();
|
|
2711
|
+
} catch (error) {
|
|
2712
|
+
// Handle errors, show toast, etc.
|
|
2713
|
+
}
|
|
2714
|
+
},
|
|
2715
|
+
disabled: total === 0,
|
|
2716
|
+
tooltip: total === 0 ? 'Select at least one item to export' : undefined,
|
|
2717
|
+
hidden: !userHasExportPermission,
|
|
2718
|
+
skin: 'premium'
|
|
2719
|
+
};
|
|
2720
|
+
```
|
|
2721
|
+
|
|
2722
|
+
## Context-Specific Notes
|
|
2723
|
+
|
|
2724
|
+
### Collection Page Actions
|
|
2725
|
+
- **onRowClick**: Access clicked item data via `actionParams.item`
|
|
2726
|
+
- **Collection-level actions**: Access collection context via `actionParams.collectionId`
|
|
2727
|
+
|
|
2728
|
+
### Entity Page Actions
|
|
2729
|
+
- **View/Edit mode**: Access entity data via `actionParams.entity`
|
|
2730
|
+
- **Edit mode only**: Access form instance via `actionParams.form`
|
|
2731
|
+
|
|
2732
|
+
### Bulk Actions
|
|
2733
|
+
- **Selection data**: Use `actionParams.selectedValues` and `actionParams.total`
|
|
2734
|
+
- **State control**: Commonly use `disabled: selectedValues.length === 0`
|
|
2735
|
+
|
|
2736
|
+
### Action Cell Actions
|
|
2737
|
+
- **Row context**: Access item and position via `actionParams.item` and `actionParams.index`
|
|
2738
|
+
|
|
2739
|
+
## See Also
|
|
2740
|
+
|
|
2741
|
+
- [Collection Page Actions](./collection_page_actions.md)
|
|
2742
|
+
- [Entity Page Actions](./entity_page_actions.md) (edit mode)
|
|
2743
|
+
- [Entity Page View Actions](./entity_page_view_actions.md)
|
|
2744
|
+
- [Bulk Actions Toolbar](./bulk_actions.md)
|
|
2745
|
+
- [Action Cell](./action_cell.md)
|
|
2746
|
+
- [App Config Structure](./app_config_structure.md) (action item `skin` property)
|
|
2747
|
+
|
|
2748
|
+
---
|
|
2749
|
+
|
|
2653
2750
|
# Installation & Setup
|
|
2654
2751
|
|
|
2655
2752
|
## 1. Install Packages
|
|
@@ -174,11 +174,8 @@ Custom bulk actions execute JavaScript code that you define for bulk operations.
|
|
|
174
174
|
- Be registered in the `actions` property of your `PatternsWizardOverridesProvider`
|
|
175
175
|
- Follow JavaScript identifier naming rules (camelCase recommended)
|
|
176
176
|
|
|
177
|
-
2. The implementation must return
|
|
178
|
-
|
|
179
|
-
- `icon`: An Icon component from "@wix/wix-ui-icons-common"
|
|
180
|
-
- `onClick`: Handler function for the bulk action
|
|
181
|
-
- `hidden` (optional): Boolean to hide the action when true
|
|
177
|
+
2. The implementation must return a `ResolvedAction`:
|
|
178
|
+
For complete field documentation, see [ResolvedAction Reference](./resolved_action.md).
|
|
182
179
|
|
|
183
180
|
3. The implementation must:
|
|
184
181
|
- Use the correct type: `CustomBulkActionsActionResolver`
|
|
@@ -64,7 +64,7 @@ Custom collection page actions execute JavaScript code that you define for colle
|
|
|
64
64
|
```typescript
|
|
65
65
|
import { CustomActionCollectionPageActionResolver } from '@wix/auto-patterns';
|
|
66
66
|
import React from 'react';
|
|
67
|
-
import { Download } from '@wix/ui-icons-common';
|
|
67
|
+
import { Download } from '@wix/wix-ui-icons-common';
|
|
68
68
|
|
|
69
69
|
// IMPORTANT: Function name MUST match the action id in your configuration
|
|
70
70
|
export const exportCollection: CustomActionCollectionPageActionResolver = (params) => {
|
|
@@ -184,16 +184,7 @@ Row click actions are configured at the table level using the `onRowClick` prope
|
|
|
184
184
|
|
|
185
185
|
⚠️ **CRITICAL**: When you configure `onRowClick` in your TypeScript configuration, you MUST provide a complete working implementation. The Auto Patterns framework cannot function without it.
|
|
186
186
|
|
|
187
|
-
Custom row click actions use the `CustomActionCollectionPageActionOnRowClickResolver` type and MUST return a `ResolvedAction
|
|
188
|
-
|
|
189
|
-
#### Required Return Object Structure:
|
|
190
|
-
```typescript
|
|
191
|
-
return {
|
|
192
|
-
label: string, // REQUIRED: Action label
|
|
193
|
-
icon: ReactElement, // REQUIRED: Icon component
|
|
194
|
-
onClick: () => void // REQUIRED: Click handler function
|
|
195
|
-
};
|
|
196
|
-
```
|
|
187
|
+
Custom row click actions use the `CustomActionCollectionPageActionOnRowClickResolver` type and MUST return a `ResolvedAction`. See [ResolvedAction Reference](./resolved_action.md) for complete field documentation.
|
|
197
188
|
|
|
198
189
|
#### Complete Implementation Example:
|
|
199
190
|
|
|
@@ -353,7 +344,7 @@ export const quickToggle: CustomActionCollectionPageActionOnRowClickResolver = (
|
|
|
353
344
|
- **MANDATORY IMPLEMENTATION**: If you configure `onRowClick` in TypeScript configuration, you MUST provide a complete working implementation - the framework cannot function without it
|
|
354
345
|
- The action `id` in the configuration MUST exactly match the function name exported from your actions folder
|
|
355
346
|
- The implementation must use the `CustomActionCollectionPageActionOnRowClickResolver` type
|
|
356
|
-
- **Required Return Object**: Must return
|
|
347
|
+
- **Required Return Object**: Must return a `ResolvedAction` object - see [ResolvedAction Reference](./resolved_action.md)
|
|
357
348
|
- Access the clicked item's data through `actionParams.item`
|
|
358
349
|
- The implementation must be exported as a named export and registered in your `PatternsWizardOverridesProvider`
|
|
359
350
|
- When `onRowClick` is configured, the default navigation to entity page is completely disabled
|
|
@@ -55,7 +55,7 @@ export const myMoreAction: CustomEntityPageActionResolver = (params) => {
|
|
|
55
55
|
|
|
56
56
|
return {
|
|
57
57
|
label: 'My More Action',
|
|
58
|
-
icon: <MyIcon />, //
|
|
58
|
+
icon: <MyIcon />, // required
|
|
59
59
|
onClick: () => {
|
|
60
60
|
// Your custom logic here
|
|
61
61
|
},
|
|
@@ -75,7 +75,7 @@ export const myMoreAction: CustomEntityPageActionResolver = (params) => {
|
|
|
75
75
|
- The implementation must use the `CustomEntityPageActionResolver` type.
|
|
76
76
|
- The implementation must be exported as a named export (not default export).
|
|
77
77
|
- The function receives `{ actionParams, sdk }` as parameters.
|
|
78
|
-
- The returned object must
|
|
78
|
+
- The returned object must be a `ResolvedAction`. See [ResolvedAction Reference](./resolved_action.md) for complete documentation.
|
|
79
79
|
|
|
80
80
|
---
|
|
81
81
|
|
|
@@ -86,7 +86,7 @@ export const myMoreAction: CustomEntityPageActionResolver = (params) => {
|
|
|
86
86
|
✓ Custom actions match implementations in overrides
|
|
87
87
|
✓ The resolver is exported and registered in the `actions` property of your `PatternsWizardOverridesProvider`
|
|
88
88
|
✓ The function signature matches `CustomEntityPageActionResolver`
|
|
89
|
-
✓ The returned object
|
|
89
|
+
✓ The returned object is a `ResolvedAction` (see [ResolvedAction Reference](./resolved_action.md))
|
|
90
90
|
|
|
91
91
|
---
|
|
92
92
|
|
|
@@ -96,7 +96,7 @@ View mode actions follow the same resolver patterns as collection page actions:
|
|
|
96
96
|
These actions are handled automatically by the AutoPatterns framework using the configuration provided.
|
|
97
97
|
|
|
98
98
|
### For Custom Actions
|
|
99
|
-
Custom actions require resolver implementations
|
|
99
|
+
Custom actions require resolver implementations that return a `ResolvedAction` object. See [ResolvedAction Reference](./resolved_action.md) for complete field documentation.
|
|
100
100
|
|
|
101
101
|
```typescript
|
|
102
102
|
import { CustomEntityPageActionResolver } from '@wix/auto-patterns/types';
|
|
@@ -107,7 +107,7 @@ export const duplicateProduct: CustomEntityPageActionResolver = (params) => {
|
|
|
107
107
|
const schema = sdk.getSchema(sdk.collectionId);
|
|
108
108
|
return {
|
|
109
109
|
label: 'Duplicate Product',
|
|
110
|
-
icon: <DuplicateIcon />, //
|
|
110
|
+
icon: <DuplicateIcon />, // required
|
|
111
111
|
onClick: async () => {
|
|
112
112
|
// Your custom duplication logic here
|
|
113
113
|
await schema.actions.create({
|