@wix/auto-patterns 1.20.0 → 1.22.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/AutoPatternsCollectionComponent/AutoPatternsCollectionComponent.js +109 -0
- package/dist/cjs/components/AutoPatternsCollectionComponent/AutoPatternsCollectionComponent.js.map +1 -0
- package/dist/cjs/components/AutoPatternsCollectionPage/AutoPatternsCollectionPage.js +5 -14
- package/dist/cjs/components/AutoPatternsCollectionPage/AutoPatternsCollectionPage.js.map +1 -1
- package/dist/cjs/components/AutoPatternsCollectionPageContent/AutoPatternsCollectionPageContent.js +19 -68
- package/dist/cjs/components/AutoPatternsCollectionPageContent/AutoPatternsCollectionPageContent.js.map +1 -1
- package/dist/cjs/components/AutoPatternsEntityPage/Fields/ImageInput.js +5 -4
- package/dist/cjs/components/AutoPatternsEntityPage/Fields/ImageInput.js.map +1 -1
- package/dist/cjs/components/AutoPatternsTable/AutoPatternsTable.js +3 -1
- package/dist/cjs/components/AutoPatternsTable/AutoPatternsTable.js.map +1 -1
- package/dist/cjs/hooks/useActionCell.js +10 -2
- package/dist/cjs/hooks/useActionCell.js.map +1 -1
- package/dist/cjs/hooks/useBaseTableFeatures.js +4 -3
- package/dist/cjs/hooks/useBaseTableFeatures.js.map +1 -1
- package/dist/cjs/hooks/useTableFeatures.js +3 -1
- package/dist/cjs/hooks/useTableFeatures.js.map +1 -1
- package/dist/cjs/hooks/useTableGridSwitchFeatures.js +4 -2
- package/dist/cjs/hooks/useTableGridSwitchFeatures.js.map +1 -1
- package/dist/cjs/providers/PatternsWizardOverridesContext.js.map +1 -1
- package/dist/cjs/types/CollectionPageConfig.js.map +1 -1
- package/dist/cjs/types/actions/actionCell.js.map +1 -1
- package/dist/docs/action_cell.md +13 -3
- package/dist/docs/app_config_structure.md +8 -2
- package/dist/docs/auto-patterns-guide.md +202 -14
- package/dist/docs/custom_overrides.md +181 -9
- package/dist/esm/components/AutoPatternsCollectionComponent/AutoPatternsCollectionComponent.js +72 -0
- package/dist/esm/components/AutoPatternsCollectionComponent/AutoPatternsCollectionComponent.js.map +1 -0
- package/dist/esm/components/AutoPatternsCollectionPage/AutoPatternsCollectionPage.js +1 -3
- package/dist/esm/components/AutoPatternsCollectionPage/AutoPatternsCollectionPage.js.map +1 -1
- package/dist/esm/components/AutoPatternsCollectionPageContent/AutoPatternsCollectionPageContent.js +17 -48
- package/dist/esm/components/AutoPatternsCollectionPageContent/AutoPatternsCollectionPageContent.js.map +1 -1
- package/dist/esm/components/AutoPatternsEntityPage/Fields/ImageInput.js +4 -3
- package/dist/esm/components/AutoPatternsEntityPage/Fields/ImageInput.js.map +1 -1
- package/dist/esm/components/AutoPatternsTable/AutoPatternsTable.js +2 -0
- package/dist/esm/components/AutoPatternsTable/AutoPatternsTable.js.map +1 -1
- package/dist/esm/hooks/useActionCell.js +10 -2
- package/dist/esm/hooks/useActionCell.js.map +1 -1
- package/dist/esm/hooks/useBaseTableFeatures.js +3 -2
- package/dist/esm/hooks/useBaseTableFeatures.js.map +1 -1
- package/dist/esm/hooks/useTableFeatures.js +3 -1
- package/dist/esm/hooks/useTableFeatures.js.map +1 -1
- package/dist/esm/hooks/useTableGridSwitchFeatures.js +4 -2
- package/dist/esm/hooks/useTableGridSwitchFeatures.js.map +1 -1
- package/dist/esm/providers/PatternsWizardOverridesContext.js.map +1 -1
- package/dist/esm/types/CollectionPageConfig.js.map +1 -1
- package/dist/esm/types/actions/actionCell.js.map +1 -1
- package/dist/types/components/AutoPatternsCollectionComponent/AutoPatternsCollectionComponent.d.ts +7 -0
- package/dist/types/components/AutoPatternsCollectionComponent/AutoPatternsCollectionComponent.d.ts.map +1 -0
- package/dist/types/components/AutoPatternsCollectionPage/AutoPatternsCollectionPage.d.ts.map +1 -1
- package/dist/types/components/AutoPatternsCollectionPageContent/AutoPatternsCollectionPageContent.d.ts.map +1 -1
- package/dist/types/components/AutoPatternsEntityPage/Fields/ImageInput.d.ts.map +1 -1
- package/dist/types/components/AutoPatternsTable/AutoPatternsTable.d.ts.map +1 -1
- package/dist/types/hooks/useActionCell.d.ts.map +1 -1
- package/dist/types/hooks/useBaseTableFeatures.d.ts +1 -0
- package/dist/types/hooks/useBaseTableFeatures.d.ts.map +1 -1
- package/dist/types/hooks/useTableFeatures.d.ts +1 -0
- package/dist/types/hooks/useTableFeatures.d.ts.map +1 -1
- package/dist/types/hooks/useTableGridSwitchFeatures.d.ts +1 -0
- package/dist/types/hooks/useTableGridSwitchFeatures.d.ts.map +1 -1
- package/dist/types/providers/PatternsWizardOverridesContext.d.ts +1 -1
- package/dist/types/providers/PatternsWizardOverridesContext.d.ts.map +1 -1
- package/dist/types/types/CollectionPageConfig.d.ts +8 -1
- package/dist/types/types/CollectionPageConfig.d.ts.map +1 -1
- package/dist/types/types/actions/actionCell.d.ts +1 -0
- package/dist/types/types/actions/actionCell.d.ts.map +1 -1
- package/package.json +13 -13
|
@@ -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","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 } = useBaseTableFeatures(configuration);\n\n const { fetchData } = useFetchData({\n searchableFieldIds: visibleFieldIds,\n filterFieldMapping,\n });\n\n const schema = useSchema();\n const overrides = usePatternsWizardOverridesContext();\n\n const state = useTableCollection<any>({\n queryName: `${collectionId}`,\n itemKey: (item) => item[schema.idField],\n itemName: (item) => item[schema.displayField],\n filters: filtersObject,\n toExtendedFields: (item) => item.extendedFields,\n fetchErrorMessage: ({ err }) => String(err),\n fetchData,\n limit,\n persistQueryToUrl: reflectQueryInUrl,\n disableAutoSelectAllCount: selectAllScope === 'page',\n selectionConsistencyMode: selectionUpdateMode,\n });\n\n const optimisticActions = useAutoPatternsOptimisticActions(\n collectionId,\n state.collection,\n );\n\n const commonFeatures = useCommonCollectionFeatures({\n ...configuration,\n optimisticActions,\n });\n\n const sections =\n configuration.sections?.id &&\n overrides?.sections?.[configuration.sections.id]\n ? {\n renderSection: overrides.sections[configuration.sections.id],\n TableSections,\n }\n : undefined;\n\n return {\n ...commonFeatures,\n state,\n columns,\n filters: filterComponent,\n optimisticActions,\n customColumns,\n onRowClick,\n stickyColumns,\n stickySelectionColumn,\n sections,\n };\n};\n"],"mappings":";;;;AACA,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,MAAMQ,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;EACF,CAAC,GAAG,IAAAC,0CAAoB,
|
|
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,MAAMQ,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,SAAS,EAAE,GAAG5B,YAAY,EAAE;IAC5B6B,OAAO,EAAGC,IAAI,IAAKA,IAAI,CAACR,MAAM,CAACS,OAAO,CAAC;IACvCC,QAAQ,EAAGF,IAAI,IAAKA,IAAI,CAACR,MAAM,CAACW,YAAY,CAAC;IAC7CvB,OAAO,EAAEH,aAAa;IACtB2B,gBAAgB,EAAGJ,IAAI,IAAKA,IAAI,CAACK,cAAc;IAC/CC,iBAAiB,EAAEA,CAAC;MAAEC;IAAI,CAAC,KAAKC,MAAM,CAACD,GAAG,CAAC;IAC3ClB,SAAS;IACTlB,KAAK;IACLsC,iBAAiB,EAAErC,iBAAiB;IACpCsC,yBAAyB,EAAErC,cAAc,KAAK,MAAM;IACpDsC,wBAAwB,EAAErC;EAC5B,CAAC,CAAC;EAEF,MAAMsC,iBAAiB,GAAG,IAAAC,kEAAgC,EACxD3C,YAAY,EACZ0B,KAAK,CAACrB,UACR,CAAC;EAED,MAAMuC,cAAc,GAAG,IAAAC,wDAA2B,EAAC;IACjD,GAAGhD,aAAa;IAChB6C;EACF,CAAC,CAAC;EAEF,MAAMI,QAAQ,GACZ,CAAAhD,qBAAA,GAAAD,aAAa,CAACiD,QAAQ,aAAtBhD,qBAAA,CAAwBiD,EAAE,IAC1BvB,SAAS,aAAAzB,mBAAA,GAATyB,SAAS,CAAEsB,QAAQ,aAAnB/C,mBAAA,CAAsBF,aAAa,CAACiD,QAAQ,CAACC,EAAE,CAAC,GAC5C;IACEC,aAAa,EAAExB,SAAS,CAACsB,QAAQ,CAACjD,aAAa,CAACiD,QAAQ,CAACC,EAAE,CAAC;IAC5DE,aAAa,EAAbA;EACF,CAAC,GACDC,SAAS;EAEf,OAAO;IACL,GAAGN,cAAc;IACjBlB,KAAK;IACLb,OAAO;IACPH,OAAO,EAAEJ,eAAe;IACxBoC,iBAAiB;IACjB/B,aAAa;IACbG,UAAU;IACVC,aAAa;IACbC,qBAAqB;IACrBC,YAAY;IACZ6B;EACF,CAAC;AACH,CAAC;AAACK,OAAA,CAAAvD,gBAAA,GAAAA,gBAAA","ignoreList":[]}
|
|
@@ -36,7 +36,8 @@ const useTableGridSwitchFeatures = config => {
|
|
|
36
36
|
columns: tableColumns,
|
|
37
37
|
onRowClick,
|
|
38
38
|
stickyColumns,
|
|
39
|
-
stickySelectionColumn
|
|
39
|
+
stickySelectionColumn,
|
|
40
|
+
showTitleBar
|
|
40
41
|
} = (0, _useBaseTableFeatures.useBaseTableFeatures)(config);
|
|
41
42
|
const {
|
|
42
43
|
fetchData: tableFetchData
|
|
@@ -78,7 +79,8 @@ const useTableGridSwitchFeatures = config => {
|
|
|
78
79
|
// Grid specific features
|
|
79
80
|
imagePlacement,
|
|
80
81
|
preset,
|
|
81
|
-
renderItem
|
|
82
|
+
renderItem,
|
|
83
|
+
showTitleBar
|
|
82
84
|
};
|
|
83
85
|
};
|
|
84
86
|
exports.useTableGridSwitchFeatures = useTableGridSwitchFeatures;
|
|
@@ -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","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 } = 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 };\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,MAAMQ,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,YAAY;IACrBC,UAAU;IACVC,aAAa;IACbC;EACF,CAAC,GAAG,IAAAC,0CAAoB,
|
|
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,MAAMQ,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,YAAY;IACrBC,UAAU;IACVC,aAAa;IACbC,qBAAqB;IACrBC;EACF,CAAC,GAAG,IAAAC,0CAAoB,EAAC5B,MAAM,CAAC;EAEhC,MAAM;IAAE6B,SAAS,EAAEC;EAAe,CAAC,GAAG,IAAAC,0BAAY,EAAC;IACjDC,kBAAkB,EAAEC,KAAK,CAACC,IAAI,CAC5B,IAAIC,GAAG,CAAC,CAAC,GAAGd,oBAAoB,EAAE,GAAGJ,mBAAmB,CAAC,CAC3D,CAAC;IACDN;EACF,CAAC,CAAC;EAEF,MAAMyB,KAAK,GAAG,IAAAC,sCAA4B,EAAM;IAC9CC,SAAS,EAAE,GAAGnC,YAAY,EAAE;IAC5BoC,OAAO,EAAGC,IAAI,IAAKA,IAAI,CAACvC,MAAM,CAACwC,OAAO,CAAC;IACvCC,QAAQ,EAAGF,IAAI,IAAKA,IAAI,CAACvC,MAAM,CAAC0C,YAAY,CAAC;IAC7C9B,OAAO,EAAEH,aAAa;IACtBkC,gBAAgB,EAAGJ,IAAI,IAAKA,IAAI,CAACK,cAAc;IAC/CC,iBAAiB,EAAEA,CAAC;MAAEC;IAAI,CAAC,KAAKC,MAAM,CAACD,GAAG,CAAC;IAC3ClB,SAAS,EAAEC,cAAc;IACzB1B,KAAK;IACL6C,iBAAiB,EAAE5C,iBAAiB;IACpC6C,yBAAyB,EAAE5C,cAAc,KAAK,MAAM;IACpD6C,wBAAwB,EAAE5C;EAC5B,CAAC,CAAC;EAEF,MAAM6C,iBAAiB,GAAG,IAAAC,kEAAgC,EACxDlD,YAAY,EACZiC,KAAK,CAAC5B,UACR,CAAC;EAED,MAAM8C,cAAc,GAAG,IAAAC,wDAA2B,EAAC;IACjD,GAAGvD,MAAM;IACToD;EACF,CAAC,CAAC;EAEF,OAAO;IACL,GAAGE,cAAc;IACjBlB,KAAK;IACLd,OAAO,EAAEC,YAAY;IACrBV,OAAO,EAAEJ,eAAe;IACxB2C,iBAAiB;IACjBhC,aAAa;IACbI,UAAU;IACVC,aAAa;IACbC,qBAAqB;IACrB8B,gBAAgB,EAAE,IAAI;IACtB;IACAzC,cAAc;IACdD,MAAM;IACNI,UAAU;IACVS;EACF,CAAC;AACH,CAAC;AAAC8B,OAAA,CAAA1D,0BAAA,GAAAA,0BAAA","ignoreList":[]}
|
|
@@ -1 +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","PatternsWizardOverridesContext","createContext","undefined","PatternsWizardOverridesProvider","children","value","createElement","Provider","__self","__source","fileName","lineNumber","columnNumber","exports","usePatternsWizardOverridesContext","useContext"],"sources":["../../../src/providers/PatternsWizardOverridesContext.tsx"],"sourcesContent":["import React, { createContext, useContext, ReactNode } from 'react';\nimport {\n CustomComponentProps,\n EntityPageMoreActionsActionParams,\n IColumnValue,\n SchemaConfig,\n} from '../types';\n\nimport { Section } from '@wix/patterns';\n\nimport { CustomActionParams, ResolvedAction } from '../utils/actions/types';\nimport {\n CollectionPageActionOnRowClickParams,\n CollectionPageActionParams,\n} from '../types/actions/collectionPageActions';\nimport { ActionCellActionParams } from '../types/actions/actionCell';\n\nexport interface PatternsWizardOverridesContextProps {\n actions?: Record<\n string,\n (\n props: CustomActionParams<\n | EntityPageMoreActionsActionParams\n | CollectionPageActionParams\n | ActionCellActionParams\n | CollectionPageActionOnRowClickParams\n >,\n ) => ResolvedAction\n >;\n columns?: Record<string, (props: IColumnValue<any>) => void>;\n modals?: Record<string, React.FC<any>>;\n
|
|
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","PatternsWizardOverridesContext","createContext","undefined","PatternsWizardOverridesProvider","children","value","createElement","Provider","__self","__source","fileName","lineNumber","columnNumber","exports","usePatternsWizardOverridesContext","useContext"],"sources":["../../../src/providers/PatternsWizardOverridesContext.tsx"],"sourcesContent":["import React, { createContext, useContext, ReactNode } from 'react';\nimport {\n CustomComponentProps,\n EntityPageMoreActionsActionParams,\n IColumnValue,\n SchemaConfig,\n} from '../types';\n\nimport { Section } from '@wix/patterns';\n\nimport { CustomActionParams, ResolvedAction } from '../utils/actions/types';\nimport {\n CollectionPageActionOnRowClickParams,\n CollectionPageActionParams,\n} from '../types/actions/collectionPageActions';\nimport { ActionCellActionParams } from '../types/actions/actionCell';\n\nexport interface PatternsWizardOverridesContextProps {\n actions?: Record<\n string,\n (\n props: CustomActionParams<\n | EntityPageMoreActionsActionParams\n | CollectionPageActionParams\n | ActionCellActionParams\n | CollectionPageActionOnRowClickParams\n >,\n ) => ResolvedAction\n >;\n columns?: Record<string, (props: IColumnValue<any>) => void>;\n modals?: Record<string, React.FC<any>>;\n emptyState?: Record<string, () => void>;\n components?: Record<string, React.FC<CustomComponentProps>>;\n slots?: Record<string, React.FC>;\n customDataSources?: Record<\n string,\n (collectionId: string, context: any) => Promise<SchemaConfig>\n >;\n sections?: Record<string, (item: any) => Section>;\n}\n\nconst PatternsWizardOverridesContext = createContext<\n PatternsWizardOverridesContextProps | undefined\n>(undefined);\n\nexport const PatternsWizardOverridesProvider: React.FC<{\n children: ReactNode;\n value: PatternsWizardOverridesContextProps;\n}> = ({ children, value }) => {\n return (\n <PatternsWizardOverridesContext.Provider value={value}>\n {children}\n </PatternsWizardOverridesContext.Provider>\n );\n};\n\nexport const usePatternsWizardOverridesContext = ():\n | PatternsWizardOverridesContextProps\n | undefined => {\n return useContext(PatternsWizardOverridesContext);\n};\n"],"mappings":";;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AAAoE,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,CAAAb,CAAA,EAAAc,CAAA,UAAAG,CAAA,KAAAA,CAAA,CAAAV,GAAA,IAAAU,CAAA,CAAAC,GAAA,IAAAP,MAAA,CAAAC,cAAA,CAAAJ,CAAA,EAAAM,CAAA,EAAAG,CAAA,IAAAT,CAAA,CAAAM,CAAA,IAAAd,CAAA,CAAAc,CAAA,YAAAN,CAAA,CAAAH,OAAA,GAAAL,CAAA,EAAAG,CAAA,IAAAA,CAAA,CAAAe,GAAA,CAAAlB,CAAA,EAAAQ,CAAA,GAAAA,CAAA;AAyCpE,MAAMW,8BAA8B,gBAAG,IAAAC,oBAAa,EAElDC,SAAS,CAAC;AAEL,MAAMC,+BAGX,GAAGA,CAAC;EAAEC,QAAQ;EAAEC;AAAM,CAAC,KAAK;EAC5B,oBACE7B,MAAA,CAAAU,OAAA,CAAAoB,aAAA,CAACN,8BAA8B,CAACO,QAAQ;IAACF,KAAK,EAAEA,KAAM;IAAAG,MAAA;IAAAC,QAAA;MAAAC,QAAA,EAAA/B,YAAA;MAAAgC,UAAA;MAAAC,YAAA;IAAA;EAAA,GACnDR,QACsC,CAAC;AAE9C,CAAC;AAACS,OAAA,CAAAV,+BAAA,GAAAA,+BAAA;AAEK,MAAMW,iCAAiC,GAAGA,CAAA,KAEhC;EACf,OAAO,IAAAC,iBAAU,EAACf,8BAA8B,CAAC;AACnD,CAAC;AAACa,OAAA,CAAAC,iCAAA,GAAAA,iCAAA","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["ComponentTypeEnum","exports"],"sources":["../../../src/types/CollectionPageConfig.ts"],"sourcesContent":["import { CollectionToolbarFiltersProps } from '@wix/patterns';\nimport { DateRangeFilterMode, DateRangeOptions } from '@wix/patterns/core';\nimport { BaseCollectionConfig } from './types';\nimport {\n ActionCellConfig,\n BulkActionsConfig,\n CollectionPageOnRowClickActionConfig,\n CollectionPagePrimaryActions,\n CollectionPageSecondaryActions,\n} from './actions';\n\nexport interface CollectionPageTitle {\n text: string;\n hideTotal?: boolean;\n}\n\nexport interface CollectionPageSubtitle {\n text: string;\n learnMore?: {\n url: string;\n label?: string;\n };\n}\n\nexport interface CollectionPageConfig {\n route: {\n path: string;\n };\n title: CollectionPageTitle;\n subtitle?: CollectionPageSubtitle;\n actions?: {\n primaryActions?: CollectionPagePrimaryActions;\n secondaryActions?: CollectionPageSecondaryActions;\n };\n components: ComponentConfig[];\n}\n\nexport interface
|
|
1
|
+
{"version":3,"names":["ComponentTypeEnum","exports"],"sources":["../../../src/types/CollectionPageConfig.ts"],"sourcesContent":["import { CollectionToolbarFiltersProps } from '@wix/patterns';\nimport { DateRangeFilterMode, DateRangeOptions } from '@wix/patterns/core';\nimport { BaseCollectionConfig } from './types';\nimport {\n ActionCellConfig,\n BulkActionsConfig,\n CollectionPageOnRowClickActionConfig,\n CollectionPagePrimaryActions,\n CollectionPageSecondaryActions,\n} from './actions';\n\nexport interface CollectionPageTitle {\n text: string;\n hideTotal?: boolean;\n}\n\nexport interface CollectionPageSubtitle {\n text: string;\n learnMore?: {\n url: string;\n label?: string;\n };\n}\n\nexport interface CollectionPageConfig {\n route: {\n path: string;\n };\n title: CollectionPageTitle;\n subtitle?: CollectionPageSubtitle;\n actions?: {\n primaryActions?: CollectionPagePrimaryActions;\n secondaryActions?: CollectionPageSecondaryActions;\n };\n components: ComponentConfig[];\n}\n\nexport interface CollectionComponentConfig\n extends BaseCollectionComponentConfig {\n type: 'collection';\n layout: LayoutItemConfig[];\n}\n\nexport interface CustomComponentConfig {\n type: 'custom';\n id: string;\n}\n\nexport type ComponentConfig = CollectionComponentConfig | CustomComponentConfig;\n\nexport interface LayoutItemConfig {\n type: 'Table' | 'Grid';\n table?: TableSpecificConfig;\n grid?: GridSpecificConfig;\n}\n\nexport type ColumnsConfig = Column[];\n\nexport interface TableSpecificConfig {\n columns: ColumnsConfig;\n customColumns?: {\n enabled: boolean;\n };\n stickyColumns?: number;\n onRowClick?: CollectionPageOnRowClickActionConfig;\n showTitleBar?: boolean;\n sections?: {\n id: string;\n };\n}\n\nexport interface GridSpecificConfig {\n item: GridItem;\n}\n\nexport interface TableConfig\n extends BaseCollectionComponentConfig,\n TableSpecificConfig {}\nexport interface GridConfig\n extends BaseCollectionComponentConfig,\n GridSpecificConfig {}\nexport interface TableGridSwitchConfig\n extends BaseCollectionComponentConfig,\n TableSpecificConfig,\n GridSpecificConfig {}\n\nexport type CollectionConfig = BaseCollectionConfig & {\n limit?: number;\n reflectQueryInUrl?: boolean;\n selectAllScope?: 'page' | 'all';\n selectionUpdateMode?: 'preserve' | 'clear';\n};\n\nexport interface BaseCollectionComponentConfig {\n collection: CollectionConfig;\n entityPageId?: string;\n search?: { shown?: boolean };\n toolbarTitle?: ToolbarTitle;\n actionCell?: ActionCellConfig;\n emptyState?: EmptyState;\n filters?: FiltersConfig;\n bulkActionToolbar?: BulkActionsConfig;\n}\n\nexport interface ToolbarTitle {\n title: string;\n subtitle?: {\n text: string;\n info?: {\n content: {\n text: string;\n link?: {\n url: string;\n label: string;\n };\n };\n };\n learnMore?: {\n url: string;\n label?: string;\n };\n };\n showTotal?: boolean;\n itemsLimit?: number;\n}\n\nexport interface Column {\n id: string;\n name: string;\n width: string;\n sortable?: boolean;\n defaultSortOrder?: 'asc' | 'desc';\n sortMode?: 'asc' | 'desc';\n defaultHidden?: boolean;\n hiddenFromCustomColumnsSelection?: boolean;\n hideable?: boolean;\n reorderDisabled?: boolean;\n}\n\nexport interface GridItem {\n titleFieldId: string;\n subtitleFieldId?: string;\n imageFieldId?: string;\n cardContentMode?: 'full' | 'title' | 'empty'; // Footer is not supported in auto-patterns\n imagePlacement?: 'top' | 'side';\n}\n\nexport interface EmptyState {\n title?: string;\n subtitle?: string;\n image?: {\n id: string;\n };\n addNewCta?: {\n id?: string;\n text?: string;\n };\n customCta?: {\n id?: string;\n };\n}\n\nexport interface FilterOption {\n value: string;\n label: string;\n}\n\nexport type FilterSelectionMode = 'single' | 'multiple';\nexport type FilterOptionType =\n | 'checkbox'\n | 'inlineCheckbox'\n | 'radio'\n | 'select';\n\nexport enum ComponentTypeEnum {\n SINGLE = 'single',\n MULTI_SELECT = 'multi-select',\n RADIO_GROUP = 'radio-group',\n NUMBER = 'number',\n DATE_RANGE = 'date-range',\n}\n\nexport type FilterItems = Filter[];\nexport interface FiltersConfig {\n items: FilterItems;\n maxInlineFilters?: CollectionToolbarFiltersProps['inline'];\n panelTitle?: string;\n}\n\nexport interface BaseOptionsFilterConfig {\n selectionMode: FilterSelectionMode;\n}\n\nexport interface DateFilterConfig {\n mode?: DateRangeFilterMode;\n presets?: DateRangeOptions;\n includeTime?: boolean;\n}\n\nexport interface NumberFilterConfig {\n min?: number;\n max?: number;\n allowedDecimals?: boolean;\n}\n\nexport interface BooleanFilterConfig {\n trueLabel?: string;\n falseLabel?: string;\n}\n\nexport interface EnumFilterConfig extends BaseOptionsFilterConfig {\n options: FilterOption[];\n optionType?: FilterOptionType;\n}\n\nexport interface DynamicOptionsFilterConfig extends BaseOptionsFilterConfig {}\n\nexport interface Filter {\n id: string;\n fieldId: string;\n displayName?: string;\n sectionTitle?: string;\n openByDefault?: boolean;\n tagLabel?: string;\n numberConfig?: NumberFilterConfig;\n dateConfig?: DateFilterConfig;\n booleanConfig?: BooleanFilterConfig;\n enumConfig?: EnumFilterConfig;\n dynamicOptionsConfig?: DynamicOptionsFilterConfig;\n}\n"],"mappings":";;;;IA8KYA,iBAAiB,GAAAC,OAAA,CAAAD,iBAAA,0BAAjBA,iBAAiB;EAAjBA,iBAAiB;EAAjBA,iBAAiB;EAAjBA,iBAAiB;EAAjBA,iBAAiB;EAAjBA,iBAAiB;EAAA,OAAjBA,iBAAiB;AAAA","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["../../../../src/types/actions/actionCell.ts"],"sourcesContent":["import {\n CustomActionModalProps,\n CustomActionParams,\n ResolvedAction,\n} from '../../exports/types';\nimport {\n CustomActionConfig,\n DeleteActionConfig,\n UpdateActionConfig,\n DividerActionConfig,\n} from './base';\n\nexport type ActionCellItemConfig =\n | UpdateActionConfig\n | CustomActionConfig\n | DeleteActionConfig;\n\nexport interface ActionCellPrimaryAction {\n item: ActionCellItemConfig;\n}\n\nexport interface ActionCellSecondaryActions {\n items: (ActionCellItemConfig | DividerActionConfig)[];\n inlineCount?: number;\n inlineAlwaysVisible?: boolean;\n}\n\nexport interface ActionCellConfig {\n primaryAction?: ActionCellPrimaryAction;\n secondaryActions?: ActionCellSecondaryActions;\n}\n\nexport interface ActionCellActionParams {\n item: any;\n}\n\nexport type CustomActionCellActionParams =\n CustomActionParams<ActionCellActionParams>;\n\nexport type CustomActionCellActionResolver = (\n params: CustomActionCellActionParams,\n) => ResolvedAction;\n\nexport interface CustomActionCellActionModalProps\n extends CustomActionModalProps {\n actionParams: ActionCellActionParams;\n}\n"],"mappings":"","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":[],"sources":["../../../../src/types/actions/actionCell.ts"],"sourcesContent":["import {\n CustomActionModalProps,\n CustomActionParams,\n ResolvedAction,\n} from '../../exports/types';\nimport {\n CustomActionConfig,\n DeleteActionConfig,\n UpdateActionConfig,\n DividerActionConfig,\n} from './base';\n\nexport type ActionCellItemConfig =\n | UpdateActionConfig\n | CustomActionConfig\n | DeleteActionConfig;\n\nexport interface ActionCellPrimaryAction {\n item: ActionCellItemConfig;\n alwaysVisible?: boolean;\n}\n\nexport interface ActionCellSecondaryActions {\n items: (ActionCellItemConfig | DividerActionConfig)[];\n inlineCount?: number;\n inlineAlwaysVisible?: boolean;\n}\n\nexport interface ActionCellConfig {\n primaryAction?: ActionCellPrimaryAction;\n secondaryActions?: ActionCellSecondaryActions;\n}\n\nexport interface ActionCellActionParams {\n item: any;\n}\n\nexport type CustomActionCellActionParams =\n CustomActionParams<ActionCellActionParams>;\n\nexport type CustomActionCellActionResolver = (\n params: CustomActionCellActionParams,\n) => ResolvedAction;\n\nexport interface CustomActionCellActionModalProps\n extends CustomActionModalProps {\n actionParams: ActionCellActionParams;\n}\n"],"mappings":"","ignoreList":[]}
|
package/dist/docs/action_cell.md
CHANGED
|
@@ -10,6 +10,10 @@ The ActionCell has a two-level structure:
|
|
|
10
10
|
|
|
11
11
|
Both properties are optional, but at least one should be provided for the ActionCell to be useful.
|
|
12
12
|
|
|
13
|
+
### Primary Action Visibility Control
|
|
14
|
+
|
|
15
|
+
**New Feature**: Primary actions now support visibility control through the `alwaysVisible` property. By default, primary actions follow standard table interaction patterns (typically visible on hover), but you can configure them to be always visible for improved accessibility and user discovery.
|
|
16
|
+
|
|
13
17
|
### Inline Secondary Actions
|
|
14
18
|
|
|
15
19
|
**New Feature**: By default, all secondary actions are hidden in a popover menu that appears when the user hovers over or clicks the "more actions" button. However, you can now configure some secondary actions to display inline directly in the table row for improved accessibility and reduced clicks.
|
|
@@ -214,17 +218,21 @@ Follow this decision process when implementing ActionCell:
|
|
|
214
218
|
- Most common operation (typically Edit) → Place in `primaryAction.item`
|
|
215
219
|
- Less common operations → Place in `secondaryActions.items` array
|
|
216
220
|
|
|
217
|
-
3. **
|
|
221
|
+
3. **Primary Action Visibility Strategy**:
|
|
222
|
+
- **Standard Visibility** (`alwaysVisible: false` or omitted): Use for most cases where actions appear on interaction
|
|
223
|
+
- **Always Visible** (`alwaysVisible: true`): Use for critical actions that need constant visibility or when user discovery is important
|
|
224
|
+
|
|
225
|
+
4. **Inline Secondary Actions Strategy**:
|
|
218
226
|
- **Action Prioritization**: Order `secondaryActions.items` by frequency of use (most used first)
|
|
219
227
|
- **Inline Count**: Use `inlineCount: 1-3` for optimal UX (avoid cluttering)
|
|
220
228
|
- **Visibility Control**:
|
|
221
229
|
- Use `inlineAlwaysVisible: false` (default) for cleaner visual appearance
|
|
222
230
|
- Use `inlineAlwaysVisible: true` only for critical actions requiring constant visibility
|
|
223
231
|
|
|
224
|
-
|
|
232
|
+
5. **Update Action Mode**:
|
|
225
233
|
- Complex, full-entity edits → Use `mode: "page"` to navigate to entity page
|
|
226
234
|
|
|
227
|
-
|
|
235
|
+
6. **Custom Implementation**:
|
|
228
236
|
- For `custom` actions, you must provide implementations in your code and register them with `PatternsWizardOverridesProvider`
|
|
229
237
|
|
|
230
238
|
### ActionCell Validation Checklist
|
|
@@ -238,6 +246,8 @@ AI agents should verify these requirements before generating ActionCell configur
|
|
|
238
246
|
✓ Delete action has a modal configuration
|
|
239
247
|
✓ Custom actions match implementations in overrides
|
|
240
248
|
✓ At least one of `primaryAction` or `secondaryActions` is provided
|
|
249
|
+
✓ `alwaysVisible` property on primary actions (if specified) is a boolean value
|
|
250
|
+
✓ Primary action visibility is properly considered for UX (use `alwaysVisible: true` for critical actions)
|
|
241
251
|
✓ `inlineCount` (if specified) is a non-negative number ≤ total secondary actions count
|
|
242
252
|
✓ `inlineAlwaysVisible` (if specified) is a boolean value
|
|
243
253
|
✓ Inline secondary actions configuration is applied only when secondary actions exist
|
|
@@ -69,8 +69,9 @@ export interface AppConfig {
|
|
|
69
69
|
menu?: {}; // Same structure as primaryActions.menu
|
|
70
70
|
};
|
|
71
71
|
};
|
|
72
|
-
components: [
|
|
72
|
+
components: [ // Array of component configurations that can be collection components or custom slot components
|
|
73
73
|
{
|
|
74
|
+
type: 'collection'; // Component type for collection rendering (table/grid with full features)
|
|
74
75
|
entityPageId?: string; // ID of the entity page to navigate to when clicking a row
|
|
75
76
|
collection: {
|
|
76
77
|
collectionId: string; // ID of the Wix Data collection
|
|
@@ -171,6 +172,7 @@ export interface AppConfig {
|
|
|
171
172
|
};
|
|
172
173
|
};
|
|
173
174
|
};
|
|
175
|
+
alwaysVisible?: boolean; // Whether to always show the primary action (not just on hover)
|
|
174
176
|
};
|
|
175
177
|
secondaryActions?: {
|
|
176
178
|
items: {}[]; // Array of action configurations, same structure as primaryAction.item, can include dividers
|
|
@@ -266,6 +268,7 @@ export interface AppConfig {
|
|
|
266
268
|
enabled: boolean; // Enable user customization (hide/reorder columns)
|
|
267
269
|
};
|
|
268
270
|
stickyColumns?: number; // Number of columns to make sticky from the start. Sticky columns remain visible when horizontally scrolling.
|
|
271
|
+
showTitleBar?: boolean; // Whether to show the table column headers. Default: true
|
|
269
272
|
};
|
|
270
273
|
},
|
|
271
274
|
{
|
|
@@ -287,6 +290,10 @@ export interface AppConfig {
|
|
|
287
290
|
};
|
|
288
291
|
}
|
|
289
292
|
]; // End of layout array
|
|
293
|
+
} |
|
|
294
|
+
{
|
|
295
|
+
type: 'custom'; // Component type for custom slot components
|
|
296
|
+
id: string; // Unique identifier that maps to a custom React component provided through PatternsWizardOverridesProvider slots
|
|
290
297
|
}
|
|
291
298
|
]; // End of components array
|
|
292
299
|
};
|
|
@@ -363,7 +370,6 @@ type LayoutContent =
|
|
|
363
370
|
componentId: string;
|
|
364
371
|
};
|
|
365
372
|
};
|
|
366
|
-
```
|
|
367
373
|
|
|
368
374
|
---
|
|
369
375
|
|
|
@@ -147,8 +147,9 @@ export interface AppConfig {
|
|
|
147
147
|
menu?: {}; // Same structure as primaryActions.menu
|
|
148
148
|
};
|
|
149
149
|
};
|
|
150
|
-
components: [
|
|
150
|
+
components: [ // Array of component configurations that can be collection components or custom slot components
|
|
151
151
|
{
|
|
152
|
+
type: 'collection'; // Component type for collection rendering (table/grid with full features)
|
|
152
153
|
entityPageId?: string; // ID of the entity page to navigate to when clicking a row
|
|
153
154
|
collection: {
|
|
154
155
|
collectionId: string; // ID of the Wix Data collection
|
|
@@ -249,6 +250,7 @@ export interface AppConfig {
|
|
|
249
250
|
};
|
|
250
251
|
};
|
|
251
252
|
};
|
|
253
|
+
alwaysVisible?: boolean; // Whether to always show the primary action (not just on hover)
|
|
252
254
|
};
|
|
253
255
|
secondaryActions?: {
|
|
254
256
|
items: {}[]; // Array of action configurations, same structure as primaryAction.item, can include dividers
|
|
@@ -344,6 +346,7 @@ export interface AppConfig {
|
|
|
344
346
|
enabled: boolean; // Enable user customization (hide/reorder columns)
|
|
345
347
|
};
|
|
346
348
|
stickyColumns?: number; // Number of columns to make sticky from the start. Sticky columns remain visible when horizontally scrolling.
|
|
349
|
+
showTitleBar?: boolean; // Whether to show the table column headers. Default: true
|
|
347
350
|
};
|
|
348
351
|
},
|
|
349
352
|
{
|
|
@@ -365,6 +368,10 @@ export interface AppConfig {
|
|
|
365
368
|
};
|
|
366
369
|
}
|
|
367
370
|
]; // End of layout array
|
|
371
|
+
} |
|
|
372
|
+
{
|
|
373
|
+
type: 'custom'; // Component type for custom slot components
|
|
374
|
+
id: string; // Unique identifier that maps to a custom React component provided through PatternsWizardOverridesProvider slots
|
|
368
375
|
}
|
|
369
376
|
]; // End of components array
|
|
370
377
|
};
|
|
@@ -441,7 +448,6 @@ type LayoutContent =
|
|
|
441
448
|
componentId: string;
|
|
442
449
|
};
|
|
443
450
|
};
|
|
444
|
-
```
|
|
445
451
|
|
|
446
452
|
---
|
|
447
453
|
|
|
@@ -1356,6 +1362,10 @@ The ActionCell has a two-level structure:
|
|
|
1356
1362
|
|
|
1357
1363
|
Both properties are optional, but at least one should be provided for the ActionCell to be useful.
|
|
1358
1364
|
|
|
1365
|
+
### Primary Action Visibility Control
|
|
1366
|
+
|
|
1367
|
+
**New Feature**: Primary actions now support visibility control through the `alwaysVisible` property. By default, primary actions follow standard table interaction patterns (typically visible on hover), but you can configure them to be always visible for improved accessibility and user discovery.
|
|
1368
|
+
|
|
1359
1369
|
### Inline Secondary Actions
|
|
1360
1370
|
|
|
1361
1371
|
**New Feature**: By default, all secondary actions are hidden in a popover menu that appears when the user hovers over or clicks the "more actions" button. However, you can now configure some secondary actions to display inline directly in the table row for improved accessibility and reduced clicks.
|
|
@@ -1560,17 +1570,21 @@ Follow this decision process when implementing ActionCell:
|
|
|
1560
1570
|
- Most common operation (typically Edit) → Place in `primaryAction.item`
|
|
1561
1571
|
- Less common operations → Place in `secondaryActions.items` array
|
|
1562
1572
|
|
|
1563
|
-
3. **
|
|
1573
|
+
3. **Primary Action Visibility Strategy**:
|
|
1574
|
+
- **Standard Visibility** (`alwaysVisible: false` or omitted): Use for most cases where actions appear on interaction
|
|
1575
|
+
- **Always Visible** (`alwaysVisible: true`): Use for critical actions that need constant visibility or when user discovery is important
|
|
1576
|
+
|
|
1577
|
+
4. **Inline Secondary Actions Strategy**:
|
|
1564
1578
|
- **Action Prioritization**: Order `secondaryActions.items` by frequency of use (most used first)
|
|
1565
1579
|
- **Inline Count**: Use `inlineCount: 1-3` for optimal UX (avoid cluttering)
|
|
1566
1580
|
- **Visibility Control**:
|
|
1567
1581
|
- Use `inlineAlwaysVisible: false` (default) for cleaner visual appearance
|
|
1568
1582
|
- Use `inlineAlwaysVisible: true` only for critical actions requiring constant visibility
|
|
1569
1583
|
|
|
1570
|
-
|
|
1584
|
+
5. **Update Action Mode**:
|
|
1571
1585
|
- Complex, full-entity edits → Use `mode: "page"` to navigate to entity page
|
|
1572
1586
|
|
|
1573
|
-
|
|
1587
|
+
6. **Custom Implementation**:
|
|
1574
1588
|
- For `custom` actions, you must provide implementations in your code and register them with `PatternsWizardOverridesProvider`
|
|
1575
1589
|
|
|
1576
1590
|
### ActionCell Validation Checklist
|
|
@@ -1584,6 +1598,8 @@ AI agents should verify these requirements before generating ActionCell configur
|
|
|
1584
1598
|
✓ Delete action has a modal configuration
|
|
1585
1599
|
✓ Custom actions match implementations in overrides
|
|
1586
1600
|
✓ At least one of `primaryAction` or `secondaryActions` is provided
|
|
1601
|
+
✓ `alwaysVisible` property on primary actions (if specified) is a boolean value
|
|
1602
|
+
✓ Primary action visibility is properly considered for UX (use `alwaysVisible: true` for critical actions)
|
|
1587
1603
|
✓ `inlineCount` (if specified) is a non-negative number ≤ total secondary actions count
|
|
1588
1604
|
✓ `inlineAlwaysVisible` (if specified) is a boolean value
|
|
1589
1605
|
✓ Inline secondary actions configuration is applied only when secondary actions exist
|
|
@@ -2163,6 +2179,10 @@ your-page/
|
|
|
2163
2179
|
│ ├── index.tsx // Exports useColumns hook
|
|
2164
2180
|
│ ├── name.ts
|
|
2165
2181
|
│ └── date.ts
|
|
2182
|
+
├── slots/ // Custom slot components for collection pages
|
|
2183
|
+
│ ├── index.tsx // Exports useSlots hook
|
|
2184
|
+
│ ├── TopBannerComponent.tsx
|
|
2185
|
+
│ └── BottomStatsComponent.tsx
|
|
2166
2186
|
├── customComponents/ // Custom entity page components
|
|
2167
2187
|
│ ├── index.tsx // Exports useComponents hook
|
|
2168
2188
|
│ ├── CustomNameField.tsx
|
|
@@ -2170,16 +2190,12 @@ your-page/
|
|
|
2170
2190
|
├── modals/ // Custom modals
|
|
2171
2191
|
│ ├── index.tsx // Exports useModals hook
|
|
2172
2192
|
│ └── myCustomModal.tsx
|
|
2173
|
-
|
|
2193
|
+
├── customDataSources/ // Custom data sources
|
|
2174
2194
|
│ ├── index.tsx // Exports useCustomDataSources hook
|
|
2175
2195
|
│ └── myCustomDataSource.ts
|
|
2176
|
-
|
|
2177
|
-
│ ├── index.tsx
|
|
2178
|
-
│ └── groupByType.ts
|
|
2179
|
-
└── customComponents/ // Custom entity page components
|
|
2196
|
+
└── sections/ // Section renderers
|
|
2180
2197
|
├── index.tsx
|
|
2181
|
-
|
|
2182
|
-
└── InfoCard.tsx
|
|
2198
|
+
└── groupByType.ts
|
|
2183
2199
|
```
|
|
2184
2200
|
|
|
2185
2201
|
### Using Override Hooks in Your Page
|
|
@@ -2189,6 +2205,7 @@ In your page component, use the hook-based approach to access React context and
|
|
|
2189
2205
|
```tsx
|
|
2190
2206
|
import { useActions } from '../components/actions';
|
|
2191
2207
|
import { useColumns } from '../components/columns';
|
|
2208
|
+
import { useSlots } from '../components/slots';
|
|
2192
2209
|
import { useSections } from '../components/sections';
|
|
2193
2210
|
import { useComponents } from '../components/customComponents';
|
|
2194
2211
|
import { useModals } from '../components/modals';
|
|
@@ -2197,13 +2214,14 @@ import { useCustomDataSources } from '../components/customDataSources';
|
|
|
2197
2214
|
export default function YourPage() {
|
|
2198
2215
|
const actions = useActions();
|
|
2199
2216
|
const columns = useColumns();
|
|
2217
|
+
const slots = useSlots();
|
|
2200
2218
|
const sections = useSections();
|
|
2201
2219
|
const components = useComponents();
|
|
2202
2220
|
const modals = useModals();
|
|
2203
2221
|
const customDataSources = useCustomDataSources();
|
|
2204
2222
|
|
|
2205
2223
|
return (
|
|
2206
|
-
<PatternsWizardOverridesProvider value={{ actions, columns, sections, components, modals, customDataSources }}>
|
|
2224
|
+
<PatternsWizardOverridesProvider value={{ actions, columns, slots, sections, components, modals, customDataSources }}>
|
|
2207
2225
|
<AutoPatternsApp configuration={config} />
|
|
2208
2226
|
</PatternsWizardOverridesProvider>
|
|
2209
2227
|
);
|
|
@@ -2212,12 +2230,13 @@ export default function YourPage() {
|
|
|
2212
2230
|
|
|
2213
2231
|
### Important: Updating Hook Index Files
|
|
2214
2232
|
|
|
2215
|
-
**When adding any new implementation (action, modal, column, section or component), you MUST update the corresponding hook in the `index.tsx` file to include your new implementation.** The main page component uses these hooks, so they serve as the central export point for each type of override.
|
|
2233
|
+
**When adding any new implementation (action, modal, column, slot, section or component), you MUST update the corresponding hook in the `index.tsx` file to include your new implementation.** The main page component uses these hooks, so they serve as the central export point for each type of override.
|
|
2216
2234
|
|
|
2217
2235
|
For example:
|
|
2218
2236
|
- Adding a new action → Update `../components/actions/index.tsx` to include the new action in the `useActions` hook
|
|
2219
2237
|
- Adding a new modal → Update `../components/modals/index.tsx` to include the new modal in the `useModals` hook
|
|
2220
2238
|
- Adding a new column override → Update `../components/columns/index.tsx` to include the new column in the `useColumns` hook
|
|
2239
|
+
- Adding a new slot component → Update `../components/slots/index.tsx` to include the new slot in the `useSlots` hook
|
|
2221
2240
|
- Adding a new section renderer → Update `../components/sections/index.tsx` to include the new section in the `useSections` hook
|
|
2222
2241
|
- Adding a new custom component → Update `../components/customComponents/index.tsx` to include the new component in the `useComponents` hook
|
|
2223
2242
|
- Adding a new custom data source → Update `../components/customDataSources/index.tsx` to include the new data source in the `useCustomDataSources` hook
|
|
@@ -2947,6 +2966,10 @@ interface Section {
|
|
|
2947
2966
|
prefixIcon?: React.ReactElement;
|
|
2948
2967
|
onClick: () => void;
|
|
2949
2968
|
};
|
|
2969
|
+
badge?: {
|
|
2970
|
+
visible: boolean;
|
|
2971
|
+
skin?: 'light' | 'danger' | 'neutralLight';
|
|
2972
|
+
};
|
|
2950
2973
|
}
|
|
2951
2974
|
```
|
|
2952
2975
|
|
|
@@ -2954,6 +2977,7 @@ The section renderer receives an item and returns:
|
|
|
2954
2977
|
- **id**: A unique identifier for the section (items with the same id are grouped together)
|
|
2955
2978
|
- **title**: The text displayed in the section header
|
|
2956
2979
|
- **primaryAction** (optional): An action button displayed in the section header
|
|
2980
|
+
- **badge** (optional): A badge configuration displayed in the section header
|
|
2957
2981
|
|
|
2958
2982
|
#### Example: Section Renderer Implementation
|
|
2959
2983
|
|
|
@@ -2979,6 +3003,10 @@ export function groupByType(item: any): Section {
|
|
|
2979
3003
|
console.log(`Showing all ${petType}s`);
|
|
2980
3004
|
},
|
|
2981
3005
|
},
|
|
3006
|
+
badge: {
|
|
3007
|
+
visible: true,
|
|
3008
|
+
skin: 'light',
|
|
3009
|
+
},
|
|
2982
3010
|
};
|
|
2983
3011
|
}
|
|
2984
3012
|
```
|
|
@@ -3001,16 +3029,20 @@ export function groupByAgeAndVaccination(item: any): Section {
|
|
|
3001
3029
|
|
|
3002
3030
|
let sectionId: string;
|
|
3003
3031
|
let sectionTitle: string;
|
|
3032
|
+
let badgeSkin: 'light' | 'danger' | 'neutralLight' = 'light';
|
|
3004
3033
|
|
|
3005
3034
|
if (age < 1) {
|
|
3006
3035
|
sectionId = 'puppies';
|
|
3007
3036
|
sectionTitle = 'Puppies (Under 1 year)';
|
|
3037
|
+
badgeSkin = 'neutralLight';
|
|
3008
3038
|
} else if (age >= 1 && age <= 5) {
|
|
3009
3039
|
sectionId = isVaccinated ? 'young-vaccinated' : 'young-unvaccinated';
|
|
3010
3040
|
sectionTitle = `Young Adults (1-5 years) - ${isVaccinated ? 'Vaccinated' : 'Not Vaccinated'}`;
|
|
3041
|
+
badgeSkin = isVaccinated ? 'light' : 'danger';
|
|
3011
3042
|
} else {
|
|
3012
3043
|
sectionId = 'seniors';
|
|
3013
3044
|
sectionTitle = 'Senior Pets (5+ years)';
|
|
3045
|
+
badgeSkin = 'light';
|
|
3014
3046
|
}
|
|
3015
3047
|
|
|
3016
3048
|
return {
|
|
@@ -3023,6 +3055,10 @@ export function groupByAgeAndVaccination(item: any): Section {
|
|
|
3023
3055
|
// Show special care information for puppies
|
|
3024
3056
|
},
|
|
3025
3057
|
} : undefined,
|
|
3058
|
+
badge: {
|
|
3059
|
+
visible: true,
|
|
3060
|
+
skin: badgeSkin,
|
|
3061
|
+
},
|
|
3026
3062
|
};
|
|
3027
3063
|
}
|
|
3028
3064
|
```
|
|
@@ -3051,4 +3087,156 @@ import * as actions from './components/actions';
|
|
|
3051
3087
|
|
|
3052
3088
|
By implementing sections, you can significantly improve the user experience when dealing with large datasets by providing logical groupings that make information easier to find and understand.
|
|
3053
3089
|
|
|
3090
|
+
## Slots
|
|
3091
|
+
|
|
3092
|
+
Slots allow you to inject custom React components into collection pages at specific points in the component hierarchy. Unlike other overrides that modify existing functionality, slots enable you to add entirely custom UI elements anywhere within the collection page components array.
|
|
3093
|
+
|
|
3094
|
+
Slots are useful for:
|
|
3095
|
+
- Adding custom banners or announcements above or below the table/grid
|
|
3096
|
+
- Inserting analytics widgets or dashboards
|
|
3097
|
+
- Adding custom promotional content
|
|
3098
|
+
- Implementing page-specific functionality that doesn't fit into standard patterns
|
|
3099
|
+
|
|
3100
|
+
### Configuration Structure
|
|
3101
|
+
|
|
3102
|
+
Slots are configured in the collection page configuration using the `CustomComponentConfig` structure:
|
|
3103
|
+
|
|
3104
|
+
```json
|
|
3105
|
+
{
|
|
3106
|
+
"type": "custom",
|
|
3107
|
+
"id": "myCustomSlot"
|
|
3108
|
+
}
|
|
3109
|
+
```
|
|
3110
|
+
|
|
3111
|
+
**Key Properties:**
|
|
3112
|
+
- `type`: Must be set to `"custom"` to identify this as a slot component
|
|
3113
|
+
- `id`: A unique identifier that maps to your slot component implementation
|
|
3114
|
+
|
|
3115
|
+
### Component Positioning
|
|
3116
|
+
|
|
3117
|
+
Slot components can be positioned anywhere within the `components` array of a collection page. They will be rendered in the exact order specified in the configuration:
|
|
3118
|
+
|
|
3119
|
+
```json
|
|
3120
|
+
{
|
|
3121
|
+
"type": "collectionPage",
|
|
3122
|
+
"collectionPage": {
|
|
3123
|
+
"components": [
|
|
3124
|
+
{
|
|
3125
|
+
"type": "custom",
|
|
3126
|
+
"id": "topBanner"
|
|
3127
|
+
},
|
|
3128
|
+
{
|
|
3129
|
+
"type": "collection",
|
|
3130
|
+
"collection": {
|
|
3131
|
+
"collectionId": "MyCollection"
|
|
3132
|
+
},
|
|
3133
|
+
"layout": [...]
|
|
3134
|
+
},
|
|
3135
|
+
{
|
|
3136
|
+
"type": "custom",
|
|
3137
|
+
"id": "bottomStats"
|
|
3138
|
+
}
|
|
3139
|
+
]
|
|
3140
|
+
}
|
|
3141
|
+
}
|
|
3142
|
+
```
|
|
3143
|
+
|
|
3144
|
+
This configuration will render:
|
|
3145
|
+
1. The custom `topBanner` component at the top
|
|
3146
|
+
2. The main collection component (table/grid) in the middle
|
|
3147
|
+
3. The custom `bottomStats` component at the bottom
|
|
3148
|
+
|
|
3149
|
+
### Implementation Structure
|
|
3150
|
+
|
|
3151
|
+
#### Creating Slot Components
|
|
3152
|
+
|
|
3153
|
+
Slot components are standard React functional components that take no props:
|
|
3154
|
+
|
|
3155
|
+
```tsx
|
|
3156
|
+
import React from 'react';
|
|
3157
|
+
import { Box, Card, Text, Button } from '@wix/design-system';
|
|
3158
|
+
|
|
3159
|
+
export const TopBannerComponent: React.FC = () => {
|
|
3160
|
+
return (
|
|
3161
|
+
<Card>
|
|
3162
|
+
<Card.Content>
|
|
3163
|
+
<Box direction="vertical" gap={2}>
|
|
3164
|
+
<Text size="large" weight="bold">Welcome to Pet Management</Text>
|
|
3165
|
+
<Text>Manage all your pets from this central dashboard.</Text>
|
|
3166
|
+
<Button size="small">Get Started</Button>
|
|
3167
|
+
</Box>
|
|
3168
|
+
</Card.Content>
|
|
3169
|
+
</Card>
|
|
3170
|
+
);
|
|
3171
|
+
};
|
|
3172
|
+
|
|
3173
|
+
export const BottomStatsComponent: React.FC = () => {
|
|
3174
|
+
return (
|
|
3175
|
+
<Card>
|
|
3176
|
+
<Card.Content>
|
|
3177
|
+
<Box direction="horizontal" gap={4}>
|
|
3178
|
+
<Box direction="vertical" gap={1}>
|
|
3179
|
+
<Text size="large" weight="bold">47</Text>
|
|
3180
|
+
<Text size="small">Total Pets</Text>
|
|
3181
|
+
</Box>
|
|
3182
|
+
<Box direction="vertical" gap={1}>
|
|
3183
|
+
<Text size="large" weight="bold">12</Text>
|
|
3184
|
+
<Text size="small">Available for Adoption</Text>
|
|
3185
|
+
</Box>
|
|
3186
|
+
</Box>
|
|
3187
|
+
</Card.Content>
|
|
3188
|
+
</Card>
|
|
3189
|
+
);
|
|
3190
|
+
};
|
|
3191
|
+
```
|
|
3192
|
+
|
|
3193
|
+
#### Creating the Slots Hook
|
|
3194
|
+
|
|
3195
|
+
In `components/slots/index.tsx`:
|
|
3196
|
+
|
|
3197
|
+
```tsx
|
|
3198
|
+
import { TopBannerComponent } from './TopBannerComponent';
|
|
3199
|
+
import { BottomStatsComponent } from './BottomStatsComponent';
|
|
3200
|
+
|
|
3201
|
+
export const useSlots = () => {
|
|
3202
|
+
// You can access React context and other hooks here
|
|
3203
|
+
return {
|
|
3204
|
+
topBanner: TopBannerComponent,
|
|
3205
|
+
bottomStats: BottomStatsComponent
|
|
3206
|
+
};
|
|
3207
|
+
};
|
|
3208
|
+
```
|
|
3209
|
+
|
|
3210
|
+
**Important:** Every time you create a new slot component, you must import it and add it to the `useSlots` hook return object. The key in the return object must match the `id` specified in your JSON configuration.
|
|
3211
|
+
|
|
3212
|
+
#### Registering Slots in Your Page
|
|
3213
|
+
|
|
3214
|
+
In your main page component:
|
|
3215
|
+
|
|
3216
|
+
```tsx
|
|
3217
|
+
import { useSlots } from '../components/slots';
|
|
3218
|
+
|
|
3219
|
+
export default function YourPage() {
|
|
3220
|
+
const slots = useSlots();
|
|
3221
|
+
|
|
3222
|
+
return (
|
|
3223
|
+
<PatternsWizardOverridesProvider value={{ slots }}>
|
|
3224
|
+
<AutoPatternsApp configuration={config} />
|
|
3225
|
+
</PatternsWizardOverridesProvider>
|
|
3226
|
+
);
|
|
3227
|
+
}
|
|
3228
|
+
```
|
|
3229
|
+
|
|
3230
|
+
### Important Guidelines for Slots
|
|
3231
|
+
|
|
3232
|
+
1. **Component Signature**: Slot components must be React functional components with no props: `React.FC`
|
|
3233
|
+
2. **Rendering Order**: Components render in the exact order specified in the `components` array
|
|
3234
|
+
3. **Performance**: Slot components re-render with the page, so optimize for performance if needed
|
|
3235
|
+
4. **Styling**: Follow the design system patterns and responsive design principles
|
|
3236
|
+
|
|
3237
|
+
|
|
3238
|
+
**Important:** Every time you create a new slot component, you must import it and add it to the `useSlots` hook return object in the `./components/slots/index.tsx` file. The key must match the `id` specified in your JSON configuration.
|
|
3239
|
+
|
|
3240
|
+
Slots provide a powerful way to enhance collection pages with custom functionality while maintaining the structure and features of the AutoPatterns system.
|
|
3241
|
+
|
|
3054
3242
|
---
|