@wix/auto-patterns 1.21.0 → 1.23.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/hooks/useActionCell.js +10 -2
- package/dist/cjs/hooks/useActionCell.js.map +1 -1
- package/dist/cjs/providers/PatternsWizardOverridesContext.js +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/cjs/types/actions/base.js.map +1 -1
- package/dist/docs/action_cell.md +13 -3
- package/dist/docs/app_config_structure.md +7 -4
- package/dist/docs/auto-patterns-guide.md +288 -35
- package/dist/docs/bulk_actions.md +1 -4
- package/dist/docs/custom_overrides.md +267 -24
- package/dist/esm/components/AutoPatternsCollectionComponent/AutoPatternsCollectionComponent.js +71 -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 +16 -48
- package/dist/esm/components/AutoPatternsCollectionPageContent/AutoPatternsCollectionPageContent.js.map +1 -1
- package/dist/esm/components/AutoPatternsEntityPage/AutoPatternsEntityPage.js +8 -13
- package/dist/esm/components/AutoPatternsEntityPage/AutoPatternsEntityPage.js.map +1 -1
- package/dist/esm/components/AutoPatternsEntityPage/Fields/DateInput.js +6 -10
- package/dist/esm/components/AutoPatternsEntityPage/Fields/DateInput.js.map +1 -1
- package/dist/esm/components/AutoPatternsEntityPage/Fields/DateTime.js +16 -23
- package/dist/esm/components/AutoPatternsEntityPage/Fields/DateTime.js.map +1 -1
- package/dist/esm/components/AutoPatternsEntityPage/Fields/FormFieldInput.js +2 -3
- package/dist/esm/components/AutoPatternsEntityPage/Fields/FormFieldInput.js.map +1 -1
- package/dist/esm/components/AutoPatternsEntityPage/Fields/ImageInput.js +6 -9
- package/dist/esm/components/AutoPatternsEntityPage/Fields/ImageInput.js.map +1 -1
- package/dist/esm/components/AutoPatternsEntityPage/Fields/LongText.js +6 -8
- package/dist/esm/components/AutoPatternsEntityPage/Fields/LongText.js.map +1 -1
- package/dist/esm/components/AutoPatternsEntityPage/Fields/Number.js +8 -10
- package/dist/esm/components/AutoPatternsEntityPage/Fields/Number.js.map +1 -1
- package/dist/esm/components/AutoPatternsEntityPage/Fields/ShortText.js +10 -12
- package/dist/esm/components/AutoPatternsEntityPage/Fields/ShortText.js.map +1 -1
- package/dist/esm/components/AutoPatternsEntityPage/Fields/Url.js +6 -8
- package/dist/esm/components/AutoPatternsEntityPage/Fields/Url.js.map +1 -1
- package/dist/esm/components/AutoPatternsEntityPage/SkeletonEntity.js +4 -7
- package/dist/esm/components/AutoPatternsEntityPage/SkeletonEntity.js.map +1 -1
- package/dist/esm/components/ModalRenderer.js +1 -2
- package/dist/esm/components/ModalRenderer.js.map +1 -1
- package/dist/esm/components/modals/actions/BulkDeleteModal.js +7 -12
- package/dist/esm/components/modals/actions/BulkDeleteModal.js.map +1 -1
- package/dist/esm/components/modals/actions/CreateModal.js +6 -11
- package/dist/esm/components/modals/actions/CreateModal.js.map +1 -1
- package/dist/esm/components/modals/actions/EditModal.js +6 -11
- package/dist/esm/components/modals/actions/EditModal.js.map +1 -1
- package/dist/esm/dataSourceAdapters/cms/cmsAdapter.js +3 -4
- package/dist/esm/dataSourceAdapters/cms/cmsAdapter.js.map +1 -1
- package/dist/esm/dataSourceAdapters/cms/filterUtils.js +1 -2
- package/dist/esm/dataSourceAdapters/cms/filterUtils.js.map +1 -1
- package/dist/esm/dataSourceAdapters/cms/sortUtils.js +2 -2
- package/dist/esm/dataSourceAdapters/cms/sortUtils.js.map +1 -1
- package/dist/esm/hooks/useActionCell.js +16 -12
- package/dist/esm/hooks/useActionCell.js.map +1 -1
- package/dist/esm/hooks/useBaseTableFeatures.js +1 -2
- package/dist/esm/hooks/useBaseTableFeatures.js.map +1 -1
- package/dist/esm/hooks/useBulkActionToolbar.js +2 -2
- package/dist/esm/hooks/useBulkActionToolbar.js.map +1 -1
- package/dist/esm/hooks/useCollectionPageActions.js +3 -3
- package/dist/esm/hooks/useCollectionPageActions.js.map +1 -1
- package/dist/esm/hooks/useCollectionPageOnRowClickActions.js +1 -1
- package/dist/esm/hooks/useCollectionPageOnRowClickActions.js.map +1 -1
- package/dist/esm/hooks/useColumns.js +7 -12
- package/dist/esm/hooks/useColumns.js.map +1 -1
- package/dist/esm/hooks/useCommonCollectionFeatures.js +7 -8
- package/dist/esm/hooks/useCommonCollectionFeatures.js.map +1 -1
- package/dist/esm/hooks/useEmptyStates.js +5 -6
- package/dist/esm/hooks/useEmptyStates.js.map +1 -1
- package/dist/esm/hooks/useFilters.js +7 -7
- package/dist/esm/hooks/useFilters.js.map +1 -1
- package/dist/esm/hooks/useNavigationUtils.js +2 -3
- package/dist/esm/hooks/useNavigationUtils.js.map +1 -1
- package/dist/esm/hooks/usePagePath.js +3 -4
- package/dist/esm/hooks/usePagePath.js.map +1 -1
- package/dist/esm/hooks/useTableFeatures.js +1 -2
- package/dist/esm/hooks/useTableFeatures.js.map +1 -1
- package/dist/esm/providers/PatternsWizardOverridesContext.js.map +1 -1
- package/dist/esm/providers/SchemaContext.js +2 -3
- package/dist/esm/providers/SchemaContext.js.map +1 -1
- package/dist/esm/providers/SchemaRegistryContext.js +1 -1
- package/dist/esm/providers/SchemaRegistryContext.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/esm/types/actions/base.js.map +1 -1
- package/dist/esm/utils/actions/customAction.js +1 -2
- package/dist/esm/utils/actions/customAction.js.map +1 -1
- package/dist/esm/utils/actions/deleteAction.js +5 -10
- package/dist/esm/utils/actions/deleteAction.js.map +1 -1
- package/dist/esm/utils/filterCreators.js +11 -11
- package/dist/esm/utils/filterCreators.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/hooks/useActionCell.d.ts.map +1 -1
- package/dist/types/providers/PatternsWizardOverridesContext.d.ts +3 -6
- package/dist/types/providers/PatternsWizardOverridesContext.d.ts.map +1 -1
- package/dist/types/types/CollectionPageConfig.d.ts +7 -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/dist/types/types/actions/base.d.ts +0 -4
- package/dist/types/types/actions/base.d.ts.map +1 -1
- package/package.json +11 -11
package/dist/cjs/components/AutoPatternsCollectionComponent/AutoPatternsCollectionComponent.js
ADDED
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
exports.__esModule = true;
|
|
4
|
+
exports.AutoPatternsCollectionComponent = void 0;
|
|
5
|
+
var _AutoPatternsTableGridSwitch = require("../AutoPatternsTableGridSwitch/AutoPatternsTableGridSwitch");
|
|
6
|
+
var _AutoPatternsTable = require("../AutoPatternsTable");
|
|
7
|
+
var _AutoPatternsGrid = require("../AutoPatternsGrid");
|
|
8
|
+
var _providers = require("../../providers");
|
|
9
|
+
var _SkeletonCollection = require("../AutoPatternsCollectionPageContent/SkeletonCollection");
|
|
10
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
11
|
+
var _jsxFileName = "/home/builduser/work/73d19ce3378ce4dd/packages/auto-patterns/dist/cjs/components/AutoPatternsCollectionComponent/AutoPatternsCollectionComponent.tsx";
|
|
12
|
+
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); }
|
|
13
|
+
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; }
|
|
14
|
+
const AutoPatternsCollectionComponent = ({
|
|
15
|
+
component,
|
|
16
|
+
index
|
|
17
|
+
}) => {
|
|
18
|
+
const {
|
|
19
|
+
layout,
|
|
20
|
+
...sharedConfig
|
|
21
|
+
} = component;
|
|
22
|
+
const memoized = (0, _react.useMemo)(() => {
|
|
23
|
+
var _layout$find, _layout$find2;
|
|
24
|
+
if (!(layout != null && layout.length)) {
|
|
25
|
+
return {
|
|
26
|
+
componentToRender: null,
|
|
27
|
+
componentType: 'Table'
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
const tableConfig = (_layout$find = layout.find(item => item.type === 'Table')) == null ? void 0 : _layout$find.table;
|
|
31
|
+
const gridConfig = (_layout$find2 = layout.find(item => item.type === 'Grid')) == null ? void 0 : _layout$find2.grid;
|
|
32
|
+
let componentType = 'Table';
|
|
33
|
+
let componentToRender = null;
|
|
34
|
+
if (tableConfig && gridConfig) {
|
|
35
|
+
const config = {
|
|
36
|
+
...sharedConfig,
|
|
37
|
+
...tableConfig,
|
|
38
|
+
...gridConfig
|
|
39
|
+
};
|
|
40
|
+
componentToRender = /*#__PURE__*/_react.default.createElement(_AutoPatternsTableGridSwitch.AutoPatternsTableGridSwitch, {
|
|
41
|
+
configuration: config,
|
|
42
|
+
__self: void 0,
|
|
43
|
+
__source: {
|
|
44
|
+
fileName: _jsxFileName,
|
|
45
|
+
lineNumber: 39,
|
|
46
|
+
columnNumber: 9
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
} else if (tableConfig) {
|
|
50
|
+
const config = {
|
|
51
|
+
...sharedConfig,
|
|
52
|
+
...tableConfig
|
|
53
|
+
};
|
|
54
|
+
componentToRender = /*#__PURE__*/_react.default.createElement(_AutoPatternsTable.AutoPatternsTable, {
|
|
55
|
+
configuration: config,
|
|
56
|
+
__self: void 0,
|
|
57
|
+
__source: {
|
|
58
|
+
fileName: _jsxFileName,
|
|
59
|
+
lineNumber: 43,
|
|
60
|
+
columnNumber: 27
|
|
61
|
+
}
|
|
62
|
+
});
|
|
63
|
+
} else if (gridConfig) {
|
|
64
|
+
componentType = 'Grid';
|
|
65
|
+
const config = {
|
|
66
|
+
...sharedConfig,
|
|
67
|
+
...gridConfig
|
|
68
|
+
};
|
|
69
|
+
componentToRender = /*#__PURE__*/_react.default.createElement(_AutoPatternsGrid.AutoPatternsGrid, {
|
|
70
|
+
configuration: config,
|
|
71
|
+
__self: void 0,
|
|
72
|
+
__source: {
|
|
73
|
+
fileName: _jsxFileName,
|
|
74
|
+
lineNumber: 47,
|
|
75
|
+
columnNumber: 27
|
|
76
|
+
}
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
return {
|
|
80
|
+
componentToRender,
|
|
81
|
+
componentType
|
|
82
|
+
};
|
|
83
|
+
}, [layout, sharedConfig]);
|
|
84
|
+
const {
|
|
85
|
+
componentToRender,
|
|
86
|
+
componentType
|
|
87
|
+
} = memoized;
|
|
88
|
+
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, componentToRender ? /*#__PURE__*/_react.default.createElement(_providers.SchemaProvider, {
|
|
89
|
+
key: `${sharedConfig.collection.collectionId}-${index}`,
|
|
90
|
+
collection: sharedConfig.collection,
|
|
91
|
+
skeleton: /*#__PURE__*/_react.default.createElement(_SkeletonCollection.SkeletonCollection, {
|
|
92
|
+
componentType: componentType,
|
|
93
|
+
__self: void 0,
|
|
94
|
+
__source: {
|
|
95
|
+
fileName: _jsxFileName,
|
|
96
|
+
lineNumber: 61,
|
|
97
|
+
columnNumber: 21
|
|
98
|
+
}
|
|
99
|
+
}),
|
|
100
|
+
__self: void 0,
|
|
101
|
+
__source: {
|
|
102
|
+
fileName: _jsxFileName,
|
|
103
|
+
lineNumber: 58,
|
|
104
|
+
columnNumber: 9
|
|
105
|
+
}
|
|
106
|
+
}, componentToRender) : null);
|
|
107
|
+
};
|
|
108
|
+
exports.AutoPatternsCollectionComponent = AutoPatternsCollectionComponent;
|
|
109
|
+
//# sourceMappingURL=AutoPatternsCollectionComponent.js.map
|
package/dist/cjs/components/AutoPatternsCollectionComponent/AutoPatternsCollectionComponent.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_AutoPatternsTableGridSwitch","require","_AutoPatternsTable","_AutoPatternsGrid","_providers","_SkeletonCollection","_react","_interopRequireWildcard","_jsxFileName","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","AutoPatternsCollectionComponent","component","index","layout","sharedConfig","memoized","useMemo","_layout$find","_layout$find2","length","componentToRender","componentType","tableConfig","find","item","type","table","gridConfig","grid","config","createElement","AutoPatternsTableGridSwitch","configuration","__self","__source","fileName","lineNumber","columnNumber","AutoPatternsTable","AutoPatternsGrid","Fragment","SchemaProvider","key","collection","collectionId","skeleton","SkeletonCollection","exports"],"sources":["../../../../src/components/AutoPatternsCollectionComponent/AutoPatternsCollectionComponent.tsx"],"sourcesContent":["import { CollectionComponentConfig } from '../../types';\nimport { AutoPatternsTableGridSwitch } from '../AutoPatternsTableGridSwitch/AutoPatternsTableGridSwitch';\nimport { AutoPatternsTable } from '../AutoPatternsTable';\nimport { AutoPatternsGrid } from '../AutoPatternsGrid';\nimport { SchemaProvider } from '../../providers';\nimport { SkeletonCollection } from '../AutoPatternsCollectionPageContent/SkeletonCollection';\nimport React, { useMemo } from 'react';\n\nexport const AutoPatternsCollectionComponent = ({\n component,\n index,\n}: {\n component: CollectionComponentConfig;\n index: number;\n}) => {\n const { layout, ...sharedConfig } = component;\n\n const memoized = useMemo(() => {\n if (!layout?.length) {\n return {\n componentToRender: null,\n componentType: 'Table' as 'Table' | 'Grid',\n };\n }\n\n const tableConfig = layout.find((item) => item.type === 'Table')?.table;\n const gridConfig = layout.find((item) => item.type === 'Grid')?.grid;\n\n let componentType: 'Table' | 'Grid' = 'Table';\n let componentToRender: React.ReactNode = null;\n\n if (tableConfig && gridConfig) {\n const config = {\n ...sharedConfig,\n ...tableConfig,\n ...gridConfig,\n };\n componentToRender = (\n <AutoPatternsTableGridSwitch configuration={config} />\n );\n } else if (tableConfig) {\n const config = { ...sharedConfig, ...tableConfig };\n componentToRender = <AutoPatternsTable configuration={config} />;\n } else if (gridConfig) {\n componentType = 'Grid';\n const config = { ...sharedConfig, ...gridConfig };\n componentToRender = <AutoPatternsGrid configuration={config} />;\n }\n\n return { componentToRender, componentType };\n }, [layout, sharedConfig]);\n\n const { componentToRender, componentType } = memoized;\n\n return (\n <>\n {componentToRender ? (\n <SchemaProvider\n key={`${sharedConfig.collection.collectionId}-${index}`}\n collection={sharedConfig.collection}\n skeleton={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AACzB,aAAa,EAAEA,aAAc;MAAAY,MAAA;MAAAC,QAAA;QAAAC,QAAA,EAAA9C,YAAA;QAAA+C,UAAA;QAAAC,YAAA;MAAA;IAAA,CAAE,CAAE;IAAAJ,MAAA;IAAAC,QAAA;MAAAC,QAAA,EAAA9C,YAAA;MAAA+C,UAAA;MAAAC,YAAA;IAAA;EAAA,GAE9DjB,iBACa,CAAC,GACf,IACJ,CAAC;AAEP,CAAC;AAAC2B,OAAA,CAAArC,+BAAA,GAAAA,+BAAA","ignoreList":[]}
|
|
@@ -6,7 +6,6 @@ exports.AutoPatternsCollectionPage = void 0;
|
|
|
6
6
|
var _react = _interopRequireDefault(require("react"));
|
|
7
7
|
var _page = require("@wix/patterns/page");
|
|
8
8
|
var _AutoPatternsCollectionPageContent = require("../AutoPatternsCollectionPageContent");
|
|
9
|
-
var _providers = require("../../providers");
|
|
10
9
|
var _useCollectionPageActions = require("../../hooks/useCollectionPageActions");
|
|
11
10
|
var _jsxFileName = "/home/builduser/work/73d19ce3378ce4dd/packages/auto-patterns/dist/cjs/components/AutoPatternsCollectionPage/AutoPatternsCollectionPage.tsx";
|
|
12
11
|
const AutoPatternsCollectionPage = ({
|
|
@@ -19,14 +18,13 @@ const AutoPatternsCollectionPage = ({
|
|
|
19
18
|
const actions = (0, _useCollectionPageActions.useCollectionPageActions)({
|
|
20
19
|
collectionPageActions: configuration.actions
|
|
21
20
|
});
|
|
22
|
-
const context = (0, _providers.usePatternsWizardOverridesContext)();
|
|
23
21
|
return /*#__PURE__*/_react.default.createElement(_page.CollectionPage, {
|
|
24
22
|
height: "100vh",
|
|
25
23
|
dataHook: "auto-patterns-page",
|
|
26
24
|
__self: void 0,
|
|
27
25
|
__source: {
|
|
28
26
|
fileName: _jsxFileName,
|
|
29
|
-
lineNumber:
|
|
27
|
+
lineNumber: 21,
|
|
30
28
|
columnNumber: 5
|
|
31
29
|
}
|
|
32
30
|
}, /*#__PURE__*/_react.default.createElement(_page.CollectionPage.Header, {
|
|
@@ -37,29 +35,22 @@ const AutoPatternsCollectionPage = ({
|
|
|
37
35
|
__self: void 0,
|
|
38
36
|
__source: {
|
|
39
37
|
fileName: _jsxFileName,
|
|
40
|
-
lineNumber:
|
|
38
|
+
lineNumber: 22,
|
|
41
39
|
columnNumber: 7
|
|
42
40
|
}
|
|
43
41
|
}), /*#__PURE__*/_react.default.createElement(_page.CollectionPage.Content, {
|
|
44
42
|
__self: void 0,
|
|
45
43
|
__source: {
|
|
46
44
|
fileName: _jsxFileName,
|
|
47
|
-
lineNumber:
|
|
45
|
+
lineNumber: 28,
|
|
48
46
|
columnNumber: 7
|
|
49
47
|
}
|
|
50
|
-
},
|
|
51
|
-
__self: void 0,
|
|
52
|
-
__source: {
|
|
53
|
-
fileName: _jsxFileName,
|
|
54
|
-
lineNumber: 32,
|
|
55
|
-
columnNumber: 33
|
|
56
|
-
}
|
|
57
|
-
}) : null, /*#__PURE__*/_react.default.createElement(_AutoPatternsCollectionPageContent.AutoPatternsCollectionPageContent, {
|
|
48
|
+
}, /*#__PURE__*/_react.default.createElement(_AutoPatternsCollectionPageContent.AutoPatternsCollectionPageContent, {
|
|
58
49
|
configuration: configuration,
|
|
59
50
|
__self: void 0,
|
|
60
51
|
__source: {
|
|
61
52
|
fileName: _jsxFileName,
|
|
62
|
-
lineNumber:
|
|
53
|
+
lineNumber: 29,
|
|
63
54
|
columnNumber: 9
|
|
64
55
|
}
|
|
65
56
|
})));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_react","_interopRequireDefault","require","_page","_AutoPatternsCollectionPageContent","
|
|
1
|
+
{"version":3,"names":["_react","_interopRequireDefault","require","_page","_AutoPatternsCollectionPageContent","_useCollectionPageActions","_jsxFileName","AutoPatternsCollectionPage","configuration","title","subtitle","actions","useCollectionPageActions","collectionPageActions","default","createElement","CollectionPage","height","dataHook","__self","__source","fileName","lineNumber","columnNumber","Header","primaryAction","primaryActions","secondaryActions","Content","AutoPatternsCollectionPageContent","exports"],"sources":["../../../../src/components/AutoPatternsCollectionPage/AutoPatternsCollectionPage.tsx"],"sourcesContent":["import React from 'react';\nimport { CollectionPage } from '@wix/patterns/page';\nimport { AutoPatternsCollectionPageContent } from '../AutoPatternsCollectionPageContent';\nimport { CollectionPageConfig } from '../../types/CollectionPageConfig';\nimport { useCollectionPageActions } from '../../hooks/useCollectionPageActions';\n\nexport interface AutoPatternsCollectionPageProps {\n configuration: CollectionPageConfig;\n}\n\nexport const AutoPatternsCollectionPage: React.FC<\n AutoPatternsCollectionPageProps\n> = ({ configuration }) => {\n const { title, subtitle } = configuration;\n\n const actions = useCollectionPageActions({\n collectionPageActions: configuration.actions,\n });\n\n return (\n <CollectionPage height=\"100vh\" dataHook=\"auto-patterns-page\">\n <CollectionPage.Header\n title={title}\n subtitle={subtitle}\n primaryAction={actions.primaryActions}\n secondaryActions={actions.secondaryActions}\n />\n <CollectionPage.Content>\n <AutoPatternsCollectionPageContent configuration={configuration} />\n </CollectionPage.Content>\n </CollectionPage>\n );\n};\n"],"mappings":";;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,kCAAA,GAAAF,OAAA;AAEA,IAAAG,yBAAA,GAAAH,OAAA;AAAgF,IAAAI,YAAA;AAMzE,MAAMC,0BAEZ,GAAGA,CAAC;EAAEC;AAAc,CAAC,KAAK;EACzB,MAAM;IAAEC,KAAK;IAAEC;EAAS,CAAC,GAAGF,aAAa;EAEzC,MAAMG,OAAO,GAAG,IAAAC,kDAAwB,EAAC;IACvCC,qBAAqB,EAAEL,aAAa,CAACG;EACvC,CAAC,CAAC;EAEF,oBACEX,MAAA,CAAAc,OAAA,CAAAC,aAAA,CAACZ,KAAA,CAAAa,cAAc;IAACC,MAAM,EAAC,OAAO;IAACC,QAAQ,EAAC,oBAAoB;IAAAC,MAAA;IAAAC,QAAA;MAAAC,QAAA,EAAAf,YAAA;MAAAgB,UAAA;MAAAC,YAAA;IAAA;EAAA,gBAC1DvB,MAAA,CAAAc,OAAA,CAAAC,aAAA,CAACZ,KAAA,CAAAa,cAAc,CAACQ,MAAM;IACpBf,KAAK,EAAEA,KAAM;IACbC,QAAQ,EAAEA,QAAS;IACnBe,aAAa,EAAEd,OAAO,CAACe,cAAe;IACtCC,gBAAgB,EAAEhB,OAAO,CAACgB,gBAAiB;IAAAR,MAAA;IAAAC,QAAA;MAAAC,QAAA,EAAAf,YAAA;MAAAgB,UAAA;MAAAC,YAAA;IAAA;EAAA,CAC5C,CAAC,eACFvB,MAAA,CAAAc,OAAA,CAAAC,aAAA,CAACZ,KAAA,CAAAa,cAAc,CAACY,OAAO;IAAAT,MAAA;IAAAC,QAAA;MAAAC,QAAA,EAAAf,YAAA;MAAAgB,UAAA;MAAAC,YAAA;IAAA;EAAA,gBACrBvB,MAAA,CAAAc,OAAA,CAAAC,aAAA,CAACX,kCAAA,CAAAyB,iCAAiC;IAACrB,aAAa,EAAEA,aAAc;IAAAW,MAAA;IAAAC,QAAA;MAAAC,QAAA,EAAAf,YAAA;MAAAgB,UAAA;MAAAC,YAAA;IAAA;EAAA,CAAE,CAC5C,CACV,CAAC;AAErB,CAAC;AAACO,OAAA,CAAAvB,0BAAA,GAAAA,0BAAA","ignoreList":[]}
|
package/dist/cjs/components/AutoPatternsCollectionPageContent/AutoPatternsCollectionPageContent.js
CHANGED
|
@@ -4,11 +4,8 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
4
4
|
exports.__esModule = true;
|
|
5
5
|
exports.AutoPatternsCollectionPageContent = void 0;
|
|
6
6
|
var _react = _interopRequireDefault(require("react"));
|
|
7
|
-
var _AutoPatternsTable = require("../AutoPatternsTable");
|
|
8
|
-
var _AutoPatternsGrid = require("../AutoPatternsGrid");
|
|
9
|
-
var _AutoPatternsTableGridSwitch = require("../AutoPatternsTableGridSwitch/AutoPatternsTableGridSwitch");
|
|
10
7
|
var _providers = require("../../providers");
|
|
11
|
-
var
|
|
8
|
+
var _AutoPatternsCollectionComponent = require("../AutoPatternsCollectionComponent/AutoPatternsCollectionComponent");
|
|
12
9
|
var _jsxFileName = "/home/builduser/work/73d19ce3378ce4dd/packages/auto-patterns/dist/cjs/components/AutoPatternsCollectionPageContent/AutoPatternsCollectionPageContent.tsx";
|
|
13
10
|
const AutoPatternsCollectionPageContent = ({
|
|
14
11
|
configuration
|
|
@@ -16,83 +13,37 @@ const AutoPatternsCollectionPageContent = ({
|
|
|
16
13
|
const {
|
|
17
14
|
components
|
|
18
15
|
} = configuration;
|
|
16
|
+
const overrides = (0, _providers.usePatternsWizardOverridesContext)();
|
|
19
17
|
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, components.map((component, index) => {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
if (!(layout != null && layout.length)) {
|
|
26
|
-
return null;
|
|
27
|
-
}
|
|
28
|
-
const tableConfig = (_layout$find = layout.find(item => item.type === 'Table')) == null ? void 0 : _layout$find.table;
|
|
29
|
-
const gridConfig = (_layout$find2 = layout.find(item => item.type === 'Grid')) == null ? void 0 : _layout$find2.grid;
|
|
30
|
-
let componentType = 'Table';
|
|
31
|
-
let componentToRender = null;
|
|
32
|
-
if (tableConfig && gridConfig) {
|
|
33
|
-
const config = {
|
|
34
|
-
...sharedConfig,
|
|
35
|
-
...tableConfig,
|
|
36
|
-
...gridConfig
|
|
37
|
-
};
|
|
38
|
-
componentToRender = /*#__PURE__*/_react.default.createElement(_AutoPatternsTableGridSwitch.AutoPatternsTableGridSwitch, {
|
|
39
|
-
configuration: config,
|
|
18
|
+
if (component.type === 'collection') {
|
|
19
|
+
return /*#__PURE__*/_react.default.createElement(_AutoPatternsCollectionComponent.AutoPatternsCollectionComponent, {
|
|
20
|
+
key: `collection-${component.collection.collectionId}-${index}`,
|
|
21
|
+
component: component,
|
|
22
|
+
index: index,
|
|
40
23
|
__self: void 0,
|
|
41
24
|
__source: {
|
|
42
25
|
fileName: _jsxFileName,
|
|
43
|
-
lineNumber:
|
|
26
|
+
lineNumber: 22,
|
|
44
27
|
columnNumber: 15
|
|
45
28
|
}
|
|
46
29
|
});
|
|
47
|
-
} else if (
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
__source: {
|
|
56
|
-
fileName: _jsxFileName,
|
|
57
|
-
lineNumber: 46,
|
|
58
|
-
columnNumber: 33
|
|
59
|
-
}
|
|
60
|
-
});
|
|
61
|
-
} else if (gridConfig) {
|
|
62
|
-
componentType = 'Grid';
|
|
63
|
-
const config = {
|
|
64
|
-
...sharedConfig,
|
|
65
|
-
...gridConfig
|
|
66
|
-
};
|
|
67
|
-
componentToRender = /*#__PURE__*/_react.default.createElement(_AutoPatternsGrid.AutoPatternsGrid, {
|
|
68
|
-
configuration: config,
|
|
30
|
+
} else if (component.type === 'custom') {
|
|
31
|
+
var _overrides$slots;
|
|
32
|
+
const CustomComponent = overrides == null || (_overrides$slots = overrides.slots) == null ? void 0 : _overrides$slots[component.id];
|
|
33
|
+
if (!CustomComponent) {
|
|
34
|
+
return null;
|
|
35
|
+
}
|
|
36
|
+
return /*#__PURE__*/_react.default.createElement(CustomComponent, {
|
|
37
|
+
key: `custom-${component.id}-${index}`,
|
|
69
38
|
__self: void 0,
|
|
70
39
|
__source: {
|
|
71
40
|
fileName: _jsxFileName,
|
|
72
|
-
lineNumber:
|
|
73
|
-
columnNumber:
|
|
41
|
+
lineNumber: 35,
|
|
42
|
+
columnNumber: 20
|
|
74
43
|
}
|
|
75
44
|
});
|
|
76
45
|
}
|
|
77
|
-
return
|
|
78
|
-
key: `${sharedConfig.collection.collectionId}-${index}`,
|
|
79
|
-
collection: sharedConfig.collection,
|
|
80
|
-
skeleton: /*#__PURE__*/_react.default.createElement(_SkeletonCollection.SkeletonCollection, {
|
|
81
|
-
componentType: componentType,
|
|
82
|
-
__self: void 0,
|
|
83
|
-
__source: {
|
|
84
|
-
fileName: _jsxFileName,
|
|
85
|
-
lineNumber: 57,
|
|
86
|
-
columnNumber: 25
|
|
87
|
-
}
|
|
88
|
-
}),
|
|
89
|
-
__self: void 0,
|
|
90
|
-
__source: {
|
|
91
|
-
fileName: _jsxFileName,
|
|
92
|
-
lineNumber: 54,
|
|
93
|
-
columnNumber: 13
|
|
94
|
-
}
|
|
95
|
-
}, componentToRender) : null;
|
|
46
|
+
return null;
|
|
96
47
|
}).filter(Boolean));
|
|
97
48
|
};
|
|
98
49
|
exports.AutoPatternsCollectionPageContent = AutoPatternsCollectionPageContent;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_react","_interopRequireDefault","require","
|
|
1
|
+
{"version":3,"names":["_react","_interopRequireDefault","require","_providers","_AutoPatternsCollectionComponent","_jsxFileName","AutoPatternsCollectionPageContent","configuration","components","overrides","usePatternsWizardOverridesContext","default","createElement","Fragment","map","component","index","type","AutoPatternsCollectionComponent","key","collection","collectionId","__self","__source","fileName","lineNumber","columnNumber","_overrides$slots","CustomComponent","slots","id","filter","Boolean","exports"],"sources":["../../../../src/components/AutoPatternsCollectionPageContent/AutoPatternsCollectionPageContent.tsx"],"sourcesContent":["import React from 'react';\nimport { CollectionPageConfig } from '../../types';\nimport { usePatternsWizardOverridesContext } from '../../providers';\nimport { AutoPatternsCollectionComponent } from '../AutoPatternsCollectionComponent/AutoPatternsCollectionComponent';\n\nexport interface AutoPatternsCollectionPageContentProps {\n configuration: CollectionPageConfig;\n}\n\nexport const AutoPatternsCollectionPageContent = ({\n configuration,\n}: AutoPatternsCollectionPageContentProps) => {\n const { components } = configuration;\n const overrides = usePatternsWizardOverridesContext();\n\n return (\n <>\n {components\n .map((component, index) => {\n if (component.type === 'collection') {\n return (\n <AutoPatternsCollectionComponent\n key={`collection-${component.collection.collectionId}-${index}`}\n component={component}\n index={index}\n />\n );\n } else if (component.type === 'custom') {\n const CustomComponent = overrides?.slots?.[component.id];\n\n if (!CustomComponent) {\n return null;\n }\n\n return <CustomComponent key={`custom-${component.id}-${index}`} />;\n }\n\n return null;\n })\n .filter(Boolean)}\n </>\n );\n};\n"],"mappings":";;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AAEA,IAAAC,UAAA,GAAAD,OAAA;AACA,IAAAE,gCAAA,GAAAF,OAAA;AAAqH,IAAAG,YAAA;AAM9G,MAAMC,iCAAiC,GAAGA,CAAC;EAChDC;AACsC,CAAC,KAAK;EAC5C,MAAM;IAAEC;EAAW,CAAC,GAAGD,aAAa;EACpC,MAAME,SAAS,GAAG,IAAAC,4CAAiC,EAAC,CAAC;EAErD,oBACEV,MAAA,CAAAW,OAAA,CAAAC,aAAA,CAAAZ,MAAA,CAAAW,OAAA,CAAAE,QAAA,QACGL,UAAU,CACRM,GAAG,CAAC,CAACC,SAAS,EAAEC,KAAK,KAAK;IACzB,IAAID,SAAS,CAACE,IAAI,KAAK,YAAY,EAAE;MACnC,oBACEjB,MAAA,CAAAW,OAAA,CAAAC,aAAA,CAACR,gCAAA,CAAAc,+BAA+B;QAC9BC,GAAG,EAAE,cAAcJ,SAAS,CAACK,UAAU,CAACC,YAAY,IAAIL,KAAK,EAAG;QAChED,SAAS,EAAEA,SAAU;QACrBC,KAAK,EAAEA,KAAM;QAAAM,MAAA;QAAAC,QAAA;UAAAC,QAAA,EAAAnB,YAAA;UAAAoB,UAAA;UAAAC,YAAA;QAAA;MAAA,CACd,CAAC;IAEN,CAAC,MAAM,IAAIX,SAAS,CAACE,IAAI,KAAK,QAAQ,EAAE;MAAA,IAAAU,gBAAA;MACtC,MAAMC,eAAe,GAAGnB,SAAS,aAAAkB,gBAAA,GAATlB,SAAS,CAAEoB,KAAK,qBAAhBF,gBAAA,CAAmBZ,SAAS,CAACe,EAAE,CAAC;MAExD,IAAI,CAACF,eAAe,EAAE;QACpB,OAAO,IAAI;MACb;MAEA,oBAAO5B,MAAA,CAAAW,OAAA,CAAAC,aAAA,CAACgB,eAAe;QAACT,GAAG,EAAE,UAAUJ,SAAS,CAACe,EAAE,IAAId,KAAK,EAAG;QAAAM,MAAA;QAAAC,QAAA;UAAAC,QAAA,EAAAnB,YAAA;UAAAoB,UAAA;UAAAC,YAAA;QAAA;MAAA,CAAE,CAAC;IACpE;IAEA,OAAO,IAAI;EACb,CAAC,CAAC,CACDK,MAAM,CAACC,OAAO,CACjB,CAAC;AAEP,CAAC;AAACC,OAAA,CAAA3B,iCAAA,GAAAA,iCAAA","ignoreList":[]}
|
|
@@ -20,7 +20,7 @@ const useActionCell = ({
|
|
|
20
20
|
collectionId
|
|
21
21
|
});
|
|
22
22
|
const buildCellActions = (0, _react.useCallback)((item, index, api) => {
|
|
23
|
-
var _config$primaryAction, _config$secondaryActi, _config$secondaryActi2, _config$secondaryActi3, _config$secondaryActi4;
|
|
23
|
+
var _config$primaryAction, _config$primaryAction2, _config$secondaryActi, _config$secondaryActi2, _config$secondaryActi3, _config$secondaryActi4;
|
|
24
24
|
const buildAction = actionConfig => {
|
|
25
25
|
if (actionConfig.type === 'divider') {
|
|
26
26
|
return {
|
|
@@ -74,6 +74,11 @@ const useActionCell = ({
|
|
|
74
74
|
};
|
|
75
75
|
};
|
|
76
76
|
const primaryAction = config != null && (_config$primaryAction = config.primaryAction) != null && _config$primaryAction.item ? buildAction(config.primaryAction.item) : undefined;
|
|
77
|
+
const primaryActionProps = {
|
|
78
|
+
...(config != null && (_config$primaryAction2 = config.primaryAction) != null && _config$primaryAction2.alwaysVisible ? {
|
|
79
|
+
visibility: 'always'
|
|
80
|
+
} : {})
|
|
81
|
+
};
|
|
77
82
|
const rawSecondaryActions = config != null && (_config$secondaryActi = config.secondaryActions) != null && _config$secondaryActi.items.length ? config.secondaryActions.items.map(buildAction).filter(Boolean) : [];
|
|
78
83
|
|
|
79
84
|
// Process secondary actions with inline count consideration
|
|
@@ -85,7 +90,10 @@ const useActionCell = ({
|
|
|
85
90
|
}
|
|
86
91
|
return {
|
|
87
92
|
...(primaryAction ? {
|
|
88
|
-
primaryAction
|
|
93
|
+
primaryAction: {
|
|
94
|
+
...primaryAction,
|
|
95
|
+
...primaryActionProps
|
|
96
|
+
}
|
|
89
97
|
} : {
|
|
90
98
|
primaryAction: undefined
|
|
91
99
|
}),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_react","require","_useActionsSDK","_actions","cleanupActionsWithDividers","actions","inlineCount","clean","a","filter","x","i","ar","_ar","divider","length","slice","useActionCell","config","collectionId","sdk","useActionsSDK","buildCellActions","useCallback","item","index","api","_config$primaryAction","_config$secondaryActi","_config$secondaryActi2","_config$secondaryActi3","_config$secondaryActi4","buildAction","actionConfig","type","actionToResolve","baseParams","actionParams","updateAction","action","deleteAction","customAction","resolvedAction","resolveAction","label","tooltip","resolvedActionProps","text","disabledDescription","primaryAction","undefined","rawSecondaryActions","secondaryActions","items","map","Boolean","numOfVisibleSecondaryActions","alwaysShowSecondaryActions","inlineAlwaysVisible","exports"],"sources":["../../../src/hooks/useActionCell.ts"],"sourcesContent":["import { useCallback } from 'react';\nimport {\n ActionCellConfig,\n ActionCellItemConfig,\n ResolvedAction,\n} from '../types';\nimport { useActionsSDK } from './useActionsSDK';\nimport {\n updateAction,\n customAction,\n resolveAction,\n deleteAction,\n} from '../utils/actions';\nimport { DividerActionConfig } from '../types/actions/base';\n\nexport interface useActionCellParams {\n config?: ActionCellConfig;\n collectionId: string;\n}\n\nconst cleanupActionsWithDividers = (\n actions: any[],\n inlineCount?: number,\n): any[] => {\n const clean = (a: any[]) =>\n a.filter(\n (x, i, ar) =>\n x?.divider !== true ||\n (i > 0 && i < ar.length - 1 && ar[i - 1]?.divider !== true),\n );\n return !actions?.length || !inlineCount || inlineCount >= actions.length\n ? clean(actions || [])\n : [\n ...clean(actions.slice(0, inlineCount)),\n ...clean(actions.slice(inlineCount)),\n ];\n};\n\nexport const useActionCell = ({\n config,\n collectionId,\n}: useActionCellParams) => {\n const sdk = useActionsSDK({\n collectionId,\n });\n\n const buildCellActions = useCallback(\n (item, index, api) => {\n const buildAction = (\n actionConfig: ActionCellItemConfig | DividerActionConfig,\n ) => {\n if (actionConfig.type === 'divider') {\n return { divider: true };\n }\n\n let actionToResolve: Partial<ResolvedAction> | null = null;\n\n const baseParams = {\n actionParams: { item, index, api },\n sdk,\n };\n\n switch (actionConfig.type) {\n case 'update':\n actionToResolve = updateAction({\n action: actionConfig,\n ...baseParams,\n });\n break;\n\n case 'delete':\n actionToResolve = deleteAction({\n action: actionConfig,\n ...baseParams,\n });\n break;\n\n case 'custom':\n actionToResolve = customAction({\n action: actionConfig,\n ...baseParams,\n });\n break;\n\n default:\n return null;\n }\n\n if (!actionToResolve) {\n return null;\n }\n\n const resolvedAction = resolveAction(actionConfig, actionToResolve);\n const { label, tooltip, ...resolvedActionProps } = resolvedAction;\n\n return {\n ...resolvedActionProps,\n text: resolvedAction.label,\n disabledDescription: resolvedAction.tooltip,\n };\n };\n\n const primaryAction = config?.primaryAction?.item\n ? buildAction(config.primaryAction.item)\n : undefined;\n\n const rawSecondaryActions = config?.secondaryActions?.items.length\n ? config.secondaryActions.items.map(buildAction).filter(Boolean)\n : [];\n\n // Process secondary actions with inline count consideration\n const secondaryActions = cleanupActionsWithDividers(\n rawSecondaryActions,\n config?.secondaryActions?.inlineCount,\n );\n\n const numOfVisibleSecondaryActions =\n config?.secondaryActions?.inlineCount;\n const alwaysShowSecondaryActions =\n config?.secondaryActions?.inlineAlwaysVisible;\n\n if (!primaryAction && !secondaryActions.length) {\n return {};\n }\n\n return {\n ...(primaryAction
|
|
1
|
+
{"version":3,"names":["_react","require","_useActionsSDK","_actions","cleanupActionsWithDividers","actions","inlineCount","clean","a","filter","x","i","ar","_ar","divider","length","slice","useActionCell","config","collectionId","sdk","useActionsSDK","buildCellActions","useCallback","item","index","api","_config$primaryAction","_config$primaryAction2","_config$secondaryActi","_config$secondaryActi2","_config$secondaryActi3","_config$secondaryActi4","buildAction","actionConfig","type","actionToResolve","baseParams","actionParams","updateAction","action","deleteAction","customAction","resolvedAction","resolveAction","label","tooltip","resolvedActionProps","text","disabledDescription","primaryAction","undefined","primaryActionProps","alwaysVisible","visibility","rawSecondaryActions","secondaryActions","items","map","Boolean","numOfVisibleSecondaryActions","alwaysShowSecondaryActions","inlineAlwaysVisible","exports"],"sources":["../../../src/hooks/useActionCell.ts"],"sourcesContent":["import { useCallback } from 'react';\nimport {\n ActionCellConfig,\n ActionCellItemConfig,\n ResolvedAction,\n} from '../types';\nimport { useActionsSDK } from './useActionsSDK';\nimport {\n updateAction,\n customAction,\n resolveAction,\n deleteAction,\n} from '../utils/actions';\nimport { DividerActionConfig } from '../types/actions/base';\n\nexport interface useActionCellParams {\n config?: ActionCellConfig;\n collectionId: string;\n}\n\nconst cleanupActionsWithDividers = (\n actions: any[],\n inlineCount?: number,\n): any[] => {\n const clean = (a: any[]) =>\n a.filter(\n (x, i, ar) =>\n x?.divider !== true ||\n (i > 0 && i < ar.length - 1 && ar[i - 1]?.divider !== true),\n );\n return !actions?.length || !inlineCount || inlineCount >= actions.length\n ? clean(actions || [])\n : [\n ...clean(actions.slice(0, inlineCount)),\n ...clean(actions.slice(inlineCount)),\n ];\n};\n\nexport const useActionCell = ({\n config,\n collectionId,\n}: useActionCellParams) => {\n const sdk = useActionsSDK({\n collectionId,\n });\n\n const buildCellActions = useCallback(\n (item, index, api) => {\n const buildAction = (\n actionConfig: ActionCellItemConfig | DividerActionConfig,\n ) => {\n if (actionConfig.type === 'divider') {\n return { divider: true };\n }\n\n let actionToResolve: Partial<ResolvedAction> | null = null;\n\n const baseParams = {\n actionParams: { item, index, api },\n sdk,\n };\n\n switch (actionConfig.type) {\n case 'update':\n actionToResolve = updateAction({\n action: actionConfig,\n ...baseParams,\n });\n break;\n\n case 'delete':\n actionToResolve = deleteAction({\n action: actionConfig,\n ...baseParams,\n });\n break;\n\n case 'custom':\n actionToResolve = customAction({\n action: actionConfig,\n ...baseParams,\n });\n break;\n\n default:\n return null;\n }\n\n if (!actionToResolve) {\n return null;\n }\n\n const resolvedAction = resolveAction(actionConfig, actionToResolve);\n const { label, tooltip, ...resolvedActionProps } = resolvedAction;\n\n return {\n ...resolvedActionProps,\n text: resolvedAction.label,\n disabledDescription: resolvedAction.tooltip,\n };\n };\n\n const primaryAction = config?.primaryAction?.item\n ? buildAction(config.primaryAction.item)\n : undefined;\n\n const primaryActionProps = {\n ...(config?.primaryAction?.alwaysVisible\n ? { visibility: 'always' }\n : {}),\n };\n\n const rawSecondaryActions = config?.secondaryActions?.items.length\n ? config.secondaryActions.items.map(buildAction).filter(Boolean)\n : [];\n\n // Process secondary actions with inline count consideration\n const secondaryActions = cleanupActionsWithDividers(\n rawSecondaryActions,\n config?.secondaryActions?.inlineCount,\n );\n\n const numOfVisibleSecondaryActions =\n config?.secondaryActions?.inlineCount;\n const alwaysShowSecondaryActions =\n config?.secondaryActions?.inlineAlwaysVisible;\n\n if (!primaryAction && !secondaryActions.length) {\n return {};\n }\n\n return {\n ...(primaryAction\n ? {\n primaryAction: {\n ...primaryAction,\n ...primaryActionProps,\n },\n }\n : { primaryAction: undefined }),\n ...(secondaryActions.length && { secondaryActions }),\n numOfVisibleSecondaryActions,\n alwaysShowSecondaryActions,\n };\n },\n [config, sdk],\n );\n\n return buildCellActions;\n};\n"],"mappings":";;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AAMA,IAAAC,cAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AAaA,MAAMG,0BAA0B,GAAGA,CACjCC,OAAc,EACdC,WAAoB,KACV;EACV,MAAMC,KAAK,GAAIC,CAAQ,IACrBA,CAAC,CAACC,MAAM,CACN,CAACC,CAAC,EAAEC,CAAC,EAAEC,EAAE;IAAA,IAAAC,GAAA;IAAA,OACP,CAAAH,CAAC,oBAADA,CAAC,CAAEI,OAAO,MAAK,IAAI,IAClBH,CAAC,GAAG,CAAC,IAAIA,CAAC,GAAGC,EAAE,CAACG,MAAM,GAAG,CAAC,IAAI,EAAAF,GAA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AAY,sBAAA,GAANZ,MAAM,CAAEsC,gBAAgB,qBAAxB1B,sBAAA,CAA0BxB,WAC5B,CAAC;IAED,MAAMsD,4BAA4B,GAChC1C,MAAM,aAAAa,sBAAA,GAANb,MAAM,CAAEsC,gBAAgB,qBAAxBzB,sBAAA,CAA0BzB,WAAW;IACvC,MAAMuD,0BAA0B,GAC9B3C,MAAM,aAAAc,sBAAA,GAANd,MAAM,CAAEsC,gBAAgB,qBAAxBxB,sBAAA,CAA0B8B,mBAAmB;IAE/C,IAAI,CAACZ,aAAa,IAAI,CAACM,gBAAgB,CAACzC,MAAM,EAAE;MAC9C,OAAO,CAAC,CAAC;IACX;IAEA,OAAO;MACL,IAAImC,aAAa,GACb;QACEA,aAAa,EAAE;UACb,GAAGA,aAAa;UAChB,GAAGE;QACL;MACF,CAAC,GACD;QAAEF,aAAa,EAAEC;MAAU,CAAC,CAAC;MACjC,IAAIK,gBAAgB,CAACzC,MAAM,IAAI;QAAEyC;MAAiB,CAAC,CAAC;MACpDI,4BAA4B;MAC5BC;IACF,CAAC;EACH,CAAC,EACD,CAAC3C,MAAM,EAAEE,GAAG,CACd,CAAC;EAED,OAAOE,gBAAgB;AACzB,CAAC;AAACyC,OAAA,CAAA9C,aAAA,GAAAA,aAAA","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
|
|
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 CustomActionCellActionResolver,\n CustomEntityPageMoreActionsActionResolver,\n CustomBulkActionsActionResolver,\n CustomActionCollectionPageActionResolver,\n CustomActionCollectionPageActionOnRowClickResolver,\n IColumnValue,\n SchemaConfig,\n} from '../types';\n\nimport { Section } from '@wix/patterns';\n\nexport interface PatternsWizardOverridesContextProps {\n actions?: Record<\n string,\n | CustomActionCellActionResolver\n | CustomBulkActionsActionResolver\n | CustomEntityPageMoreActionsActionResolver\n | CustomActionCollectionPageActionResolver\n | CustomActionCollectionPageActionOnRowClickResolver\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,u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EC;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":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["../../../../src/types/actions/base.ts"],"sourcesContent":["export type DividerActionConfig = { type: 'divider' };\n\nexport type BaseActionItemConfig = {\n id: string;\n label?: string;\n skin?: string;\n};\n\nexport interface Feedback {\n successToast?: { text: string };\n errorToast?: { text: string };\n}\n\nexport interface BaseActionModal {\n title?: { text: string };\n actions?: {\n submit?: { text: string };\n cancel?: { text: string };\n };\n feedback?: Feedback;\n}\n\nexport interface ActionModalField {\n id: string;\n label?: string;\n}\n\nexport interface DeleteActionModal extends BaseActionModal {\n description?: { text: string };\n}\n\nexport interface BulkDeleteActionModal extends DeleteActionModal {}\n\nexport type BulkDeleteAction =\n | {\n mode: 'modal';\n modal: BulkDeleteActionModal;\n
|
|
1
|
+
{"version":3,"names":[],"sources":["../../../../src/types/actions/base.ts"],"sourcesContent":["export type DividerActionConfig = { type: 'divider' };\n\nexport type BaseActionItemConfig = {\n id: string;\n label?: string;\n skin?: string;\n};\n\nexport interface Feedback {\n successToast?: { text: string };\n errorToast?: { text: string };\n}\n\nexport interface BaseActionModal {\n title?: { text: string };\n actions?: {\n submit?: { text: string };\n cancel?: { text: string };\n };\n feedback?: Feedback;\n}\n\nexport interface ActionModalField {\n id: string;\n label?: string;\n}\n\nexport interface DeleteActionModal extends BaseActionModal {\n description?: { text: string };\n}\n\nexport interface BulkDeleteActionModal extends DeleteActionModal {}\n\nexport type BulkDeleteAction =\n | {\n mode: 'modal';\n modal: BulkDeleteActionModal;\n }\n | {\n mode: 'custom';\n modal?: never;\n };\n\nexport type DeleteAction = {\n mode: 'modal';\n modal: DeleteActionModal;\n};\n\nexport interface BaseActionPage {\n id: string;\n}\n\nexport interface ActionModalWithFields extends BaseActionModal {\n fields: ActionModalField[];\n}\n\nexport interface UpdateActionModal extends ActionModalWithFields {}\n\nexport interface CreateActionModal extends ActionModalWithFields {}\n\nexport interface UpdateActionPage extends BaseActionPage {}\n\nexport interface CreateActionPage extends BaseActionPage {}\n\nexport type UpdateAction = {\n mode: 'page';\n page: UpdateActionPage;\n};\n\nexport type CreateAction = {\n mode: 'page';\n page: CreateActionPage;\n};\n\nexport type CreateActionConfig = BaseActionItemConfig & {\n type: 'create';\n create: CreateAction;\n};\n\nexport type UpdateActionConfig = BaseActionItemConfig & {\n type: 'update';\n update: UpdateAction;\n};\n\nexport type DeleteActionConfig = BaseActionItemConfig & {\n type: 'delete';\n delete: DeleteAction;\n};\n\nexport type BulkDeleteActionConfig = BaseActionItemConfig & {\n type: 'bulkDelete';\n bulkDelete: BulkDeleteAction;\n};\n\nexport type CustomActionConfig = BaseActionItemConfig & {\n type: 'custom';\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
|
|
@@ -46,9 +46,6 @@ export interface AppConfig {
|
|
|
46
46
|
collection: {
|
|
47
47
|
collectionId: string; // ID of the Wix Data collection
|
|
48
48
|
entityTypeSource: 'cms' | 'custom'; // Data source type.
|
|
49
|
-
custom?: {
|
|
50
|
-
id: string;
|
|
51
|
-
};
|
|
52
49
|
};
|
|
53
50
|
create?: { // Required when type is 'create'
|
|
54
51
|
mode: 'page'; // Create mode
|
|
@@ -69,8 +66,9 @@ export interface AppConfig {
|
|
|
69
66
|
menu?: {}; // Same structure as primaryActions.menu
|
|
70
67
|
};
|
|
71
68
|
};
|
|
72
|
-
components: [
|
|
69
|
+
components: [ // Array of component configurations that can be collection components or custom slot components
|
|
73
70
|
{
|
|
71
|
+
type: 'collection'; // Component type for collection rendering (table/grid with full features)
|
|
74
72
|
entityPageId?: string; // ID of the entity page to navigate to when clicking a row
|
|
75
73
|
collection: {
|
|
76
74
|
collectionId: string; // ID of the Wix Data collection
|
|
@@ -171,6 +169,7 @@ export interface AppConfig {
|
|
|
171
169
|
};
|
|
172
170
|
};
|
|
173
171
|
};
|
|
172
|
+
alwaysVisible?: boolean; // Whether to always show the primary action (not just on hover)
|
|
174
173
|
};
|
|
175
174
|
secondaryActions?: {
|
|
176
175
|
items: {}[]; // Array of action configurations, same structure as primaryAction.item, can include dividers
|
|
@@ -288,6 +287,10 @@ export interface AppConfig {
|
|
|
288
287
|
};
|
|
289
288
|
}
|
|
290
289
|
]; // End of layout array
|
|
290
|
+
} |
|
|
291
|
+
{
|
|
292
|
+
type: 'custom'; // Component type for custom slot components
|
|
293
|
+
id: string; // Unique identifier that maps to a custom React component provided through PatternsWizardOverridesProvider slots
|
|
291
294
|
}
|
|
292
295
|
]; // End of components array
|
|
293
296
|
};
|