@wix/auto-patterns 1.36.0 → 1.37.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/modals/actions/BulkDeleteModal.js +7 -7
- package/dist/cjs/components/modals/actions/BulkDeleteModal.js.map +1 -1
- package/dist/cjs/hooks/useColumns.js +5 -0
- package/dist/cjs/hooks/useColumns.js.map +1 -1
- package/dist/cjs/types/CollectionPageConfig.js.map +1 -1
- package/dist/esm/components/modals/actions/BulkDeleteModal.js +5 -5
- package/dist/esm/components/modals/actions/BulkDeleteModal.js.map +1 -1
- package/dist/esm/hooks/useColumns.js +5 -0
- package/dist/esm/hooks/useColumns.js.map +1 -1
- package/dist/esm/types/CollectionPageConfig.js.map +1 -1
- package/dist/types/components/modals/actions/BulkDeleteModal.d.ts.map +1 -1
- package/dist/types/hooks/useColumns.d.ts.map +1 -1
- package/dist/types/types/CollectionPageConfig.d.ts +4 -0
- package/dist/types/types/CollectionPageConfig.d.ts.map +1 -1
- package/docs/GETTING_STARTED.md +93 -0
- package/mcp-docs/app_config_structure.md +1 -0
- package/mcp-docs/auto-patterns-guide.md +35 -0
- package/mcp-docs/collection_page.md +34 -0
- package/package.json +2 -2
|
@@ -27,11 +27,11 @@ const BulkDeleteModal = ({
|
|
|
27
27
|
lineNumber: 20,
|
|
28
28
|
columnNumber: 5
|
|
29
29
|
}
|
|
30
|
-
}, /*#__PURE__*/_react.default.createElement(_designSystem.
|
|
30
|
+
}, /*#__PURE__*/_react.default.createElement(_designSystem.MessageModalLayout, {
|
|
31
31
|
title: ((_modalParams$title = modalParams.title) == null ? void 0 : _modalParams$title.text) || 'Delete item?',
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
closeModal()
|
|
32
|
+
skin: "destructive",
|
|
33
|
+
closeButtonProps: {
|
|
34
|
+
onClick: () => closeModal()
|
|
35
35
|
},
|
|
36
36
|
primaryButtonOnClick: () => {
|
|
37
37
|
var _modalParams$feedback;
|
|
@@ -66,21 +66,21 @@ const BulkDeleteModal = ({
|
|
|
66
66
|
__self: void 0,
|
|
67
67
|
__source: {
|
|
68
68
|
fileName: _jsxFileName,
|
|
69
|
-
lineNumber:
|
|
69
|
+
lineNumber: 53,
|
|
70
70
|
columnNumber: 11
|
|
71
71
|
}
|
|
72
72
|
}, /*#__PURE__*/_react.default.createElement(_designSystem.Box, {
|
|
73
73
|
__self: void 0,
|
|
74
74
|
__source: {
|
|
75
75
|
fileName: _jsxFileName,
|
|
76
|
-
lineNumber:
|
|
76
|
+
lineNumber: 59,
|
|
77
77
|
columnNumber: 13
|
|
78
78
|
}
|
|
79
79
|
}, /*#__PURE__*/_react.default.createElement(_designSystem.Text, {
|
|
80
80
|
__self: void 0,
|
|
81
81
|
__source: {
|
|
82
82
|
fileName: _jsxFileName,
|
|
83
|
-
lineNumber:
|
|
83
|
+
lineNumber: 60,
|
|
84
84
|
columnNumber: 15
|
|
85
85
|
}
|
|
86
86
|
}, ((_modalParams$descript = modalParams.description) == null ? void 0 : _modalParams$descript.text) || 'This items will be deleted'))),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_designSystem","require","_react","_interopRequireDefault","_jsxFileName","BulkDeleteModal","sdk","modalParams","actionParams","_modalParams$title","_modalParams$actions","_modalParams$actions2","_modalParams$descript","getOptimisticActions","collectionId","closeModal","optimisticActions","default","createElement","Modal","isOpen","onRequestClose","__self","__source","fileName","lineNumber","columnNumber","
|
|
1
|
+
{"version":3,"names":["_designSystem","require","_react","_interopRequireDefault","_jsxFileName","BulkDeleteModal","sdk","modalParams","actionParams","_modalParams$title","_modalParams$actions","_modalParams$actions2","_modalParams$descript","getOptimisticActions","collectionId","closeModal","optimisticActions","default","createElement","Modal","isOpen","onRequestClose","__self","__source","fileName","lineNumber","columnNumber","MessageModalLayout","title","text","skin","closeButtonProps","onClick","primaryButtonOnClick","_modalParams$feedback","schema","getSchema","Error","selectedIds","selectedValues","map","value","idField","deleteMany","successToast","feedback","errorToast","_modalParams$feedback2","submit","result","actions","bulkDelete","secondaryButtonOnClick","primaryButtonText","secondaryButtonText","cancel","content","Box","direction","gap","paddingTop","paddingBottom","Text","description","exports"],"sources":["../../../../../src/components/modals/actions/BulkDeleteModal.tsx"],"sourcesContent":["import { Box, MessageModalLayout, Modal, Text } from '@wix/design-system';\nimport React from 'react';\nimport { BulkActionsActionParams, BulkDeleteActionModal } from '../../../types';\nimport { ActionModalProps } from './types';\n\nexport interface BulkDeleteModalProps extends ActionModalProps {\n modalParams: BulkDeleteActionModal;\n actionParams: BulkActionsActionParams;\n}\n\nexport const BulkDeleteModal = ({\n sdk,\n modalParams,\n actionParams,\n}: BulkDeleteModalProps) => {\n const { getOptimisticActions, collectionId, closeModal } = sdk;\n const optimisticActions = getOptimisticActions(collectionId);\n\n return (\n <Modal isOpen onRequestClose={closeModal}>\n <MessageModalLayout\n title={modalParams.title?.text || 'Delete item?'}\n skin=\"destructive\"\n closeButtonProps={{ onClick: () => closeModal() }}\n primaryButtonOnClick={() => {\n const schema = sdk.getSchema(sdk.collectionId);\n if (!schema) {\n throw new Error('Schema not found');\n }\n const selectedIds = actionParams.selectedValues.map(\n (value) => value[schema.idField],\n );\n optimisticActions?.deleteMany(actionParams.selectedValues, {\n successToast:\n modalParams.feedback?.successToast?.text ||\n 'Items deleted successfully',\n errorToast: () =>\n modalParams.feedback?.errorToast?.text ||\n 'Failed to delete items',\n submit: async () => {\n const result = await schema.actions.bulkDelete(selectedIds);\n return [result];\n },\n });\n closeModal();\n }}\n secondaryButtonOnClick={() => {\n closeModal();\n }}\n primaryButtonText={modalParams.actions?.submit?.text || 'Save'}\n secondaryButtonText={modalParams.actions?.cancel?.text || 'Cancel'}\n content={\n <Box\n direction=\"vertical\"\n gap=\"SP2\"\n paddingTop=\"SP1\"\n paddingBottom=\"SP1\"\n >\n <Box>\n <Text>\n {modalParams.description?.text || 'This items will be deleted'}\n </Text>\n </Box>\n </Box>\n }\n />\n </Modal>\n );\n};\n"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A;QAAAC,QAAA,EAAApB,YAAA;QAAAqB,UAAA;QAAAC,YAAA;MAAA;IAAA,gBAEnBxB,MAAA,CAAAe,OAAA,CAAAC,aAAA,CAAClB,aAAA,CAAAyD,GAAG;MAAAnC,MAAA;MAAAC,QAAA;QAAAC,QAAA,EAAApB,YAAA;QAAAqB,UAAA;QAAAC,YAAA;MAAA;IAAA,gBACFxB,MAAA,CAAAe,OAAA,CAAAC,aAAA,CAAClB,aAAA,CAAA8D,IAAI;MAAAxC,MAAA;MAAAC,QAAA;QAAAC,QAAA,EAAApB,YAAA;QAAAqB,UAAA;QAAAC,YAAA;MAAA;IAAA,GACF,EAAAd,qBAAA,GAAAL,WAAW,CAACwD,WAAW,qBAAvBnD,qBAAA,CAAyBiB,IAAI,KAAI,4BAC9B,CACH,CACF,CACN;IAAAP,MAAA;IAAAC,QAAA;MAAAC,QAAA,EAAApB,YAAA;MAAAqB,UAAA;MAAAC,YAAA;IAAA;EAAA,CACF,CACI,CAAC;AAEZ,CAAC;AAACsC,OAAA,CAAA3D,eAAA,GAAAA,eAAA","ignoreList":[]}
|
|
@@ -129,6 +129,11 @@ const useColumns = columns => {
|
|
|
129
129
|
width: column.width,
|
|
130
130
|
...createSortConfiguration(column, sortable),
|
|
131
131
|
...createCustomColumnConfiguration(column),
|
|
132
|
+
...(column.tooltipContent && {
|
|
133
|
+
infoTooltipProps: {
|
|
134
|
+
content: column.tooltipContent
|
|
135
|
+
}
|
|
136
|
+
}),
|
|
132
137
|
render: row => {
|
|
133
138
|
var _overrides$columns3;
|
|
134
139
|
const itemValue = (0, _lodash.get)(row, column.id);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_react","_interopRequireDefault","require","_providers","_lodash","_designSystem","_getImageUrl","_jsxFileName","useColumns","columns","fields","useSchema","getSchema","useSchemaRegistry","overrides","useAutoPatternsOverridesContext","existingColumns","filter","column","_overrides$columns","id","createRenderer","fieldDefinition","itemValue","type","Date","toLocaleDateString","date","toLocaleString","join","referenceMetadata","referencedCollectionId","refSchema","nameValue","imageValue","displayField","_Object$values$find","imageFieldId","Object","values","find","field","imageUrl","getImageUrl","default","createElement","Box","gap","verticalAlign","__self","__source","fileName","lineNumber","columnNumber","Avatar","size","name","imgProps","src","Image","width","dataHook","map","_overrides$columns2","_fieldDefinition$capa","sortable","capabilities","baseColumnConfig","title","displayName","createSortConfiguration","createCustomColumnConfiguration","render","row","_overrides$columns3","get","camelCase","_overrides$columns4","_overrides$columns4$c","call","value","Boolean","exports","sortableColumnConfig","defaultSortOrder","sortMode","undefined","reorderDisabled","hiddenFromCustomColumnsSelection","hideable","defaultHidden"],"sources":["../../../src/hooks/useColumns.tsx"],"sourcesContent":["import React from 'react';\nimport { TableColumn } from '@wix/patterns';\nimport {\n useAutoPatternsOverridesContext,\n useSchema,\n useSchemaRegistry,\n} from '../providers';\nimport { Column, Field } from '../types';\nimport { camelCase, get } from 'lodash';\nimport { Avatar, Box, Image } from '@wix/design-system';\nimport { getImageUrl } from '../utils/media/getImageUrl';\n\nexport const useColumns = (columns: Column[]) => {\n const { fields } = useSchema();\n const { getSchema } = useSchemaRegistry();\n const overrides = useAutoPatternsOverridesContext();\n\n const existingColumns = columns.filter((column) => {\n return !!fields[column.id] || overrides?.columns?.[column.id];\n });\n\n const createRenderer = (fieldDefinition: Field, itemValue: any) => {\n if (itemValue == null) {\n return '';\n }\n\n switch (fieldDefinition.type) {\n case 'BOOLEAN':\n return itemValue ? '✔' : '✖';\n case 'DATE':\n if (itemValue instanceof Date) {\n return itemValue.toLocaleDateString();\n }\n if (typeof itemValue === 'string') {\n const date = new Date(itemValue);\n return date.toLocaleDateString();\n }\n return itemValue;\n case 'DATETIME':\n if (itemValue instanceof Date) {\n return itemValue.toLocaleString();\n }\n if (typeof itemValue === 'string') {\n const date = new Date(itemValue);\n return date.toLocaleString();\n }\n return itemValue;\n case 'ARRAY':\n // We assume that the array contains strings\n // If the array contains objects, we need to handle it differently\n return itemValue.join(', ');\n case 'REFERENCE':\n if (fieldDefinition.referenceMetadata && getSchema) {\n const { referencedCollectionId } = fieldDefinition.referenceMetadata;\n const refSchema = getSchema(referencedCollectionId);\n\n if (refSchema) {\n let nameValue: string | undefined;\n let imageValue: string | undefined;\n const displayField = refSchema.displayField;\n if (typeof itemValue === 'object' && itemValue !== null) {\n nameValue = itemValue[displayField] || '';\n const imageFieldId = Object.values(fields).find(\n (field) => field?.type === 'IMAGE',\n )?.id;\n imageValue = imageFieldId && itemValue[imageFieldId];\n }\n\n const imageUrl = imageValue && getImageUrl(imageValue);\n return (\n <Box gap=\"SP2\" verticalAlign=\"middle\">\n {imageUrl && (\n <Avatar\n size=\"size24\"\n name={nameValue}\n imgProps={{ src: imageUrl }}\n />\n )}\n <div>{nameValue}</div>\n </Box>\n );\n }\n }\n\n return itemValue;\n case 'IMAGE':\n const imageUrl = getImageUrl(itemValue);\n\n return (\n <Image src={imageUrl} width=\"48px\" dataHook=\"auto-patterns-image\" />\n );\n default:\n return itemValue;\n }\n };\n\n return existingColumns\n .map((column) => {\n const fieldDefinition = fields[column.id];\n if (!fieldDefinition && !overrides?.columns?.[column.id]) {\n return null;\n }\n\n const sortable =\n column.sortable && fieldDefinition?.capabilities?.sortable;\n\n const baseColumnConfig = {\n id: column.id,\n title: column.name || fieldDefinition?.displayName,\n width: column.width,\n ...createSortConfiguration(column, sortable),\n ...createCustomColumnConfiguration(column),\n render: (row: any) => {\n const itemValue = get(row, column.id);\n\n if (overrides?.columns?.[camelCase(column.id)]) {\n return overrides?.columns?.[camelCase(column.id)]?.({\n value: itemValue,\n row,\n });\n }\n\n if (fieldDefinition) {\n return createRenderer(fieldDefinition, itemValue);\n }\n\n return null; // Shouldn't really happen\n },\n };\n\n return baseColumnConfig;\n })\n .filter(Boolean) as TableColumn<any>[];\n};\n\nconst createSortConfiguration = (\n column: Column,\n sortable?: boolean,\n): Partial<TableColumn<any>> => {\n if (!sortable) {\n return {};\n }\n const sortableColumnConfig = {\n sortable,\n defaultSortOrder: column.defaultSortOrder,\n };\n\n // default sort mode is ['asc', 'desc', undefined]\n // so if sort mode is 'desc' -> we want to override the default\n // and set it to ['desc', 'asc', undefined]\n if (column.sortMode && column.sortMode === 'desc') {\n return {\n ...sortableColumnConfig,\n sortMode: ['desc', 'asc', undefined],\n };\n }\n return {\n ...sortableColumnConfig,\n };\n};\n\nconst createCustomColumnConfiguration = (\n column: Column,\n): Partial<TableColumn<any>> => {\n const reorderDisabled = !!column.reorderDisabled;\n\n if (column.hiddenFromCustomColumnsSelection) {\n return { hiddenFromCustomColumnsSelection: true };\n }\n if (column.hideable === false) {\n return {\n hideable: false,\n reorderDisabled,\n };\n }\n return {\n defaultHidden: !!column.defaultHidden,\n reorderDisabled,\n };\n};\n"],"mappings":";;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AAEA,IAAAC,UAAA,GAAAD,OAAA;AAMA,IAAAE,OAAA,GAAAF,OAAA;AACA,IAAAG,aAAA,GAAAH,OAAA;AACA,IAAAI,YAAA,GAAAJ,OAAA;AAAyD,IAAAK,YAAA;AAElD,MAAMC,UAAU,GAAIC,OAAiB,IAAK;EAC/C,MAAM;IAAEC;EAAO,CAAC,GAAG,IAAAC,oBAAS,EAAC,CAAC;EAC9B,MAAM;IAAEC;EAAU,CAAC,GAAG,IAAAC,4BAAiB,EAAC,CAAC;EACzC,MAAMC,SAAS,GAAG,IAAAC,0CAA+B,EAAC,CAAC;EAEnD,MAAMC,eAAe,GAAGP,OAAO,CAACQ,MAAM,CAAEC,MAAM,IAAK;IAAA,IAAAC,kBAAA;IACjD,OAAO,CAAC,CAACT,MAAM,CAACQ,MAAM,CAACE,EAAE,CAAC,KAAIN,SAAS,aAAAK,kBAAA,GAATL,SAAS,CAAEL,OAAO,qBAAlBU,kBAAA,CAAqBD,MAAM,CAACE,EAAE,CAAC;EAC/D,CAAC,CAAC;EAEF,MAAMC,cAAc,GAAGA,CAACC,eAAsB,EAAEC,SAAc,KAAK;IACjE,IAAIA,SA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,MAAM,CAACuE,QAAQ,KAAK,KAAK,EAAE;IAC7B,OAAO;MACLA,QAAQ,EAAE,KAAK;MACfF;IACF,CAAC;EACH;EACA,OAAO;IACLG,aAAa,EAAE,CAAC,CAACxE,MAAM,CAACwE,aAAa;IACrCH;EACF,CAAC;AACH,CAAC","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["_react","_interopRequireDefault","require","_providers","_lodash","_designSystem","_getImageUrl","_jsxFileName","useColumns","columns","fields","useSchema","getSchema","useSchemaRegistry","overrides","useAutoPatternsOverridesContext","existingColumns","filter","column","_overrides$columns","id","createRenderer","fieldDefinition","itemValue","type","Date","toLocaleDateString","date","toLocaleString","join","referenceMetadata","referencedCollectionId","refSchema","nameValue","imageValue","displayField","_Object$values$find","imageFieldId","Object","values","find","field","imageUrl","getImageUrl","default","createElement","Box","gap","verticalAlign","__self","__source","fileName","lineNumber","columnNumber","Avatar","size","name","imgProps","src","Image","width","dataHook","map","_overrides$columns2","_fieldDefinition$capa","sortable","capabilities","baseColumnConfig","title","displayName","createSortConfiguration","createCustomColumnConfiguration","tooltipContent","infoTooltipProps","content","render","row","_overrides$columns3","get","camelCase","_overrides$columns4","_overrides$columns4$c","call","value","Boolean","exports","sortableColumnConfig","defaultSortOrder","sortMode","undefined","reorderDisabled","hiddenFromCustomColumnsSelection","hideable","defaultHidden"],"sources":["../../../src/hooks/useColumns.tsx"],"sourcesContent":["import React from 'react';\nimport { TableColumn } from '@wix/patterns';\nimport {\n useAutoPatternsOverridesContext,\n useSchema,\n useSchemaRegistry,\n} from '../providers';\nimport { Column, Field } from '../types';\nimport { camelCase, get } from 'lodash';\nimport { Avatar, Box, Image } from '@wix/design-system';\nimport { getImageUrl } from '../utils/media/getImageUrl';\n\nexport const useColumns = (columns: Column[]) => {\n const { fields } = useSchema();\n const { getSchema } = useSchemaRegistry();\n const overrides = useAutoPatternsOverridesContext();\n\n const existingColumns = columns.filter((column) => {\n return !!fields[column.id] || overrides?.columns?.[column.id];\n });\n\n const createRenderer = (fieldDefinition: Field, itemValue: any) => {\n if (itemValue == null) {\n return '';\n }\n\n switch (fieldDefinition.type) {\n case 'BOOLEAN':\n return itemValue ? '✔' : '✖';\n case 'DATE':\n if (itemValue instanceof Date) {\n return itemValue.toLocaleDateString();\n }\n if (typeof itemValue === 'string') {\n const date = new Date(itemValue);\n return date.toLocaleDateString();\n }\n return itemValue;\n case 'DATETIME':\n if (itemValue instanceof Date) {\n return itemValue.toLocaleString();\n }\n if (typeof itemValue === 'string') {\n const date = new Date(itemValue);\n return date.toLocaleString();\n }\n return itemValue;\n case 'ARRAY':\n // We assume that the array contains strings\n // If the array contains objects, we need to handle it differently\n return itemValue.join(', ');\n case 'REFERENCE':\n if (fieldDefinition.referenceMetadata && getSchema) {\n const { referencedCollectionId } = fieldDefinition.referenceMetadata;\n const refSchema = getSchema(referencedCollectionId);\n\n if (refSchema) {\n let nameValue: string | undefined;\n let imageValue: string | undefined;\n const displayField = refSchema.displayField;\n if (typeof itemValue === 'object' && itemValue !== null) {\n nameValue = itemValue[displayField] || '';\n const imageFieldId = Object.values(fields).find(\n (field) => field?.type === 'IMAGE',\n )?.id;\n imageValue = imageFieldId && itemValue[imageFieldId];\n }\n\n const imageUrl = imageValue && getImageUrl(imageValue);\n return (\n <Box gap=\"SP2\" verticalAlign=\"middle\">\n {imageUrl && (\n <Avatar\n size=\"size24\"\n name={nameValue}\n imgProps={{ src: imageUrl }}\n />\n )}\n <div>{nameValue}</div>\n </Box>\n );\n }\n }\n\n return itemValue;\n case 'IMAGE':\n const imageUrl = getImageUrl(itemValue);\n\n return (\n <Image src={imageUrl} width=\"48px\" dataHook=\"auto-patterns-image\" />\n );\n default:\n return itemValue;\n }\n };\n\n return existingColumns\n .map((column) => {\n const fieldDefinition = fields[column.id];\n if (!fieldDefinition && !overrides?.columns?.[column.id]) {\n return null;\n }\n\n const sortable =\n column.sortable && fieldDefinition?.capabilities?.sortable;\n const baseColumnConfig = {\n id: column.id,\n title: column.name || fieldDefinition?.displayName,\n width: column.width,\n ...createSortConfiguration(column, sortable),\n ...createCustomColumnConfiguration(column),\n ...(column.tooltipContent && {\n infoTooltipProps: {\n content: column.tooltipContent,\n },\n }),\n render: (row: any) => {\n const itemValue = get(row, column.id);\n\n if (overrides?.columns?.[camelCase(column.id)]) {\n return overrides?.columns?.[camelCase(column.id)]?.({\n value: itemValue,\n row,\n });\n }\n\n if (fieldDefinition) {\n return createRenderer(fieldDefinition, itemValue);\n }\n\n return null; // Shouldn't really happen\n },\n };\n\n return baseColumnConfig;\n })\n .filter(Boolean) as TableColumn<any>[];\n};\n\nconst createSortConfiguration = (\n column: Column,\n sortable?: boolean,\n): Partial<TableColumn<any>> => {\n if (!sortable) {\n return {};\n }\n const sortableColumnConfig = {\n sortable,\n defaultSortOrder: column.defaultSortOrder,\n };\n\n // default sort mode is ['asc', 'desc', undefined]\n // so if sort mode is 'desc' -> we want to override the default\n // and set it to ['desc', 'asc', undefined]\n if (column.sortMode && column.sortMode === 'desc') {\n return {\n ...sortableColumnConfig,\n sortMode: ['desc', 'asc', undefined],\n };\n }\n return {\n ...sortableColumnConfig,\n };\n};\n\nconst createCustomColumnConfiguration = (\n column: Column,\n): Partial<TableColumn<any>> => {\n const reorderDisabled = !!column.reorderDisabled;\n\n if (column.hiddenFromCustomColumnsSelection) {\n return { hiddenFromCustomColumnsSelection: true };\n }\n if (column.hideable === false) {\n return {\n hideable: false,\n reorderDisabled,\n };\n }\n return {\n defaultHidden: !!column.defaultHidden,\n reorderDisabled,\n };\n};\n"],"mappings":";;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AAEA,IAAAC,UAAA,GAAAD,OAAA;AAMA,IAAAE,OAAA,GAAAF,OAAA;AACA,IAAAG,aAAA,GAAAH,OAAA;AACA,IAAAI,YAAA,GAAAJ,OAAA;AAAyD,IAAAK,YAAA;AAElD,MAAMC,UAAU,GAAIC,OAAiB,IAAK;EAC/C,MAAM;IAAEC;EAAO,CAAC,GAAG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B,IAAI,CAACA,QAAQ,EAAE;IACb,OAAO,CAAC,CAAC;EACX;EACA,MAAMqB,oBAAoB,GAAG;IAC3BrB,QAAQ;IACRsB,gBAAgB,EAAErE,MAAM,CAACqE;EAC3B,CAAC;;EAED;EACA;EACA;EACA,IAAIrE,MAAM,CAACsE,QAAQ,IAAItE,MAAM,CAACsE,QAAQ,KAAK,MAAM,EAAE;IACjD,OAAO;MACL,GAAGF,oBAAoB;MACvBE,QAAQ,EAAE,CAAC,MAAM,EAAE,KAAK,EAAEC,SAAS;IACrC,CAAC;EACH;EACA,OAAO;IACL,GAAGH;EACL,CAAC;AACH,CAAC;AAED,MAAMf,+BAA+B,GACnCrD,MAAc,IACgB;EAC9B,MAAMwE,eAAe,GAAG,CAAC,CAACxE,MAAM,CAACwE,eAAe;EAEhD,IAAIxE,MAAM,CAACyE,gCAAgC,EAAE;IAC3C,OAAO;MAAEA,gCAAgC,EAAE;IAAK,CAAC;EACnD;EACA,IAAIzE,MAAM,CAAC0E,QAAQ,KAAK,KAAK,EAAE;IAC7B,OAAO;MACLA,QAAQ,EAAE,KAAK;MACfF;IACF,CAAC;EACH;EACA,OAAO;IACLG,aAAa,EAAE,CAAC,CAAC3E,MAAM,CAAC2E,aAAa;IACrCH;EACF,CAAC;AACH,CAAC","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 /**\n * The title text.\n */\n text: string;\n /**\n * Determines whether to hide the number of total entities on the title of the page.\n */\n hideTotal?: boolean;\n}\n\nexport interface CollectionPageSubtitle {\n /**\n * The subtitle text.\n */\n text: string;\n /**\n * \"Learn more\" link.\n */\n learnMore?: {\n /**\n * Where the link should navigate to.\n */\n url: string;\n /**\n * The label of the link button. defaults to \"Learn More\".\n */\n label?: string;\n };\n}\n\nexport interface CollectionPageConfig {\n /**\n * Route configuration.\n */\n route: {\n /**\n * Route path (relative path).\n */\n path: string;\n };\n /**\n * Page title configuration.\n */\n title: CollectionPageTitle;\n /**\n * Page subtitle configuration.\n */\n subtitle?: CollectionPageSubtitle;\n /**\n * Page-level actions to render in the page header.\n */\n actions?: {\n /**\n * Primary actions.\n */\n primaryActions?: CollectionPagePrimaryActions;\n /**\n * Secondary actions.\n */\n secondaryActions?: CollectionPageSecondaryActions;\n };\n /**\n * Components rendered within the page layout.\n */\n components: ComponentConfig[];\n}\n\nexport interface CollectionComponentConfig\n extends BaseCollectionComponentConfig {\n /**\n * Type discriminator.\n */\n type: 'collection';\n /**\n * Layout items to render.\n */\n layout: LayoutItemConfig[];\n}\n\nexport interface CustomComponentConfig {\n /**\n * Type discriminator.\n */\n type: 'custom';\n /**\n * Identifier that maps to a custom React component provided via overrides.\n */\n id: string;\n}\n\nexport type ComponentConfig = CollectionComponentConfig | CustomComponentConfig;\n\nexport interface LayoutItemConfig {\n /**\n * Rendering mode for the collection component.\n */\n type: 'Table' | 'Grid';\n /**\n * Table-specific configuration.\n */\n table?: TableSpecificConfig;\n /**\n * Grid-specific configuration.\n */\n grid?: GridSpecificConfig;\n}\n\nexport type ColumnsConfig = Column[];\n\nexport interface TableSpecificConfig {\n /**\n * Table columns configuration.\n */\n columns: ColumnsConfig;\n /**\n * Enables custom columns (hide/reorder columns) functionality.\n */\n customColumns?: {\n enabled: boolean;\n };\n /**\n * Number of leading columns that remain sticky on horizontal scroll.\n */\n stickyColumns?: number;\n /**\n * Row click action.\n */\n onRowClick?: CollectionPageOnRowClickActionConfig;\n /**\n * Show column headers (title bar).\n * @default true\n */\n showTitleBar?: boolean;\n /**\n * Sectioning support for table.\n *\n * The `id` must match the identifier of a custom sectioning override component.\n * This allows you to provide a custom React component for table section rendering.\n */\n sections?: {\n id: string;\n };\n}\n\nexport interface GridSpecificConfig {\n /**\n * Grid item.\n */\n item: GridItem;\n}\n\nexport interface TableConfig\n extends BaseCollectionComponentConfig,\n TableSpecificConfig {}\n\nexport interface GridConfig\n extends BaseCollectionComponentConfig,\n GridSpecificConfig {}\n\nexport interface TableGridSwitchConfig\n extends BaseCollectionComponentConfig,\n TableSpecificConfig,\n GridSpecificConfig {}\n\nexport type CollectionConfig = BaseCollectionConfig & {\n /**\n * Default fetch limit (items per page).\n */\n limit?: number;\n /**\n * Reflect search/filters/sort in the URL.\n * @default false\n */\n reflectQueryInUrl?: boolean;\n /**\n * Scope of \"Select All\":\n * - 'all': select the entire collection (server-side).\n * - 'page': select only currently visible items.\n * @default \"all\"\n */\n selectAllScope?: 'page' | 'all';\n /**\n * Selection behavior when data changes:\n * - 'preserve': keep current selections if still valid.\n * - 'clear': clear selection on data refresh.\n * @default \"clear\"\n */\n selectionUpdateMode?: 'preserve' | 'clear';\n /**\n * Enables optimistic UI actions;\n * Identifier that maps to a custom optimistic actions provided via overrides.\n */\n optimisticActions?: {\n id: string;\n };\n /**\n * Pagination strategy:\n * - 'cursor': `find()` must return { items, cursor, total? }\n * - 'offset': `find()` must return { items, hasNext, total? }\n * @default \"offset\"\n */\n paginationMode?: 'cursor' | 'offset';\n};\n\nexport interface BaseCollectionComponentConfig {\n /**\n * Collection data configuration and behavior.\n */\n collection: CollectionConfig;\n /**\n * Entity page to navigate to (by page id) when interacting with rows (e.g. onRowClick/update).\n */\n entityPageId?: string;\n /**\n * Search configuration.\n */\n search?: {\n /**\n * Whether to show the search input.\n * @default true\n */\n shown?: boolean;\n };\n /**\n * Toolbar title configuration.\n */\n toolbarTitle?: ToolbarTitle;\n /**\n * Action cell configuration per row.\n */\n actionCell?: ActionCellConfig;\n /**\n * Empty state configuration.\n */\n emptyState?: EmptyState;\n /**\n * Filters configuration.\n */\n filters?: FiltersConfig;\n /**\n * Bulk action toolbar configuration.\n */\n bulkActionToolbar?: BulkActionsConfig;\n}\n\nexport interface ToolbarTitle {\n /**\n * Title text.\n */\n title: string;\n /**\n * Subtitle configuration.\n */\n subtitle?: {\n /**\n * Subtitle text.\n */\n text: string;\n /**\n * Info tooltip content with an optional link.\n */\n info?: {\n content: {\n text: string;\n link?: {\n url: string;\n label: string;\n };\n };\n };\n /**\n * \"Learn more\" link.\n */\n learnMore?: {\n /**\n * Where the link should navigate to.\n */\n url: string;\n /**\n * The label of the link button.\n */\n label?: string;\n };\n };\n /**\n * Show total items on the toolbar.\n * @default false\n */\n showTotal?: boolean;\n /**\n * Limit displayed item count in the toolbar.\n */\n itemsLimit?: number;\n}\n\nexport interface Column {\n /**\n * FieldId to bind the column to.\n */\n id: string;\n /**\n * Column header text.\n */\n name: string;\n /**\n * CSS width value (e.g. '120px', '20%').\n */\n width: string;\n /**\n * Whether the column supports sorting.\n */\n sortable?: boolean;\n /**\n * Initial sort order when the page loads.\n */\n defaultSortOrder?: 'asc' | 'desc';\n /**\n * Current sort mode selected in UI.\n */\n sortMode?: 'asc' | 'desc';\n /**\n * Hide column by default in the custom columns panel.\n * When true, the column will not be shown initially and must be enabled by the user via the customize columns UI.\n */\n defaultHidden?: boolean;\n /**\n * Exclude from the \"customize columns\" selection UI.\n */\n hiddenFromCustomColumnsSelection?: boolean;\n /**\n * Controls whether the \"hide/show\" checkbox for this column is enabled in the custom columns panel.\n * If set to false, the checkbox will be disabled and the user cannot toggle visibility for this column.\n */\n hideable?: boolean;\n /**\n * Prevent column reordering in the customization UI.\n */\n reorderDisabled?: boolean;\n}\n\nexport interface GridItem {\n /**\n * FieldId to use as the card title.\n */\n titleFieldId: string;\n /**\n * FieldId to use as the card subtitle.\n */\n subtitleFieldId?: string;\n /**\n * FieldId to use as the card image.\n */\n imageFieldId?: string;\n /**\n * Controls which content is shown in the card (preset):\n * - 'full': shows title and subtitle.\n * - 'title': shows only the title.\n * - 'empty': hides both title and subtitle.\n */\n cardContentMode?: 'full' | 'title' | 'empty'; // Footer is not supported in auto-patterns\n /**\n * Position of the image inside the card layout.\n */\n imagePlacement?: 'top' | 'side';\n}\n\nexport interface EmptyState {\n /**\n * Empty state title.\n */\n title?: string;\n /**\n * Empty state subtitle.\n */\n subtitle?: string;\n /**\n * Image to display in the empty state.\n */\n image?: {\n id: string;\n };\n /**\n * \"Add new\" call-to-action button.\n */\n addNewCta?: {\n id?: string;\n text?: string;\n };\n /**\n * Custom CTA slot (advanced).\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';\n\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[];\n\nexport interface FiltersConfig {\n /**\n * Filter items to display.\n */\n items: FilterItems;\n /**\n * Maximum number of filters shown inline before moving to the panel.\n * @default 0 (all in panel).\n */\n maxInlineFilters?: CollectionToolbarFiltersProps['inline'];\n /**\n * Title for the filter panel drawer.\n */\n panelTitle?: string;\n}\n\nexport interface BaseOptionsFilterConfig {\n /**\n * Selection behavior: single choice or multiple choices.\n */\n selectionMode: FilterSelectionMode;\n}\n\nexport interface DateFilterConfig {\n /**\n * Controls behavior: presets only, custom only, or both.\n */\n mode?: DateRangeFilterMode;\n /**\n * Which preset ranges to display (only if mode supports presets).\n */\n presets?: DateRangeOptions;\n /**\n * Whether to include time selection.\n * @default true\n */\n includeTime?: boolean;\n}\n\nexport interface NumberFilterConfig {\n /**\n * Minimum allowed value.\n */\n min?: number;\n /**\n * Maximum allowed value.\n */\n max?: number;\n /**\n * Whether decimal values are allowed.\n */\n allowedDecimals?: boolean;\n}\n\nexport interface BooleanFilterConfig {\n /**\n * Label for the \"true\" option.\n */\n trueLabel?: string;\n /**\n * Label for the \"false\" option.\n */\n falseLabel?: string;\n}\n\nexport interface EnumFilterConfig extends BaseOptionsFilterConfig {\n /**\n * List of available options.\n */\n options: FilterOption[];\n /**\n * Rendering control for option appearance.\n */\n optionType?: FilterOptionType;\n}\n\nexport interface DynamicOptionsFilterConfig extends BaseOptionsFilterConfig {}\n\nexport interface Filter {\n /**\n * Filter unique identifier.\n */\n id: string;\n /**\n * Target field id this filter controls.\n */\n fieldId: string;\n /**\n * Optional filter display name (defaults to field name).\n */\n displayName?: string;\n /**\n * Optional grouping label. Filters with the same `sectionTitle` are grouped together.\n */\n sectionTitle?: string;\n /**\n * Whether the filter item is expanded by default in the panel.\n */\n openByDefault?: boolean;\n /**\n * Label shown in the table/grid tag when the filter is active.\n */\n tagLabel?: string;\n /**\n * Configuration for number inputs (NUMBER fields).\n */\n numberConfig?: NumberFilterConfig;\n /**\n * Configuration for date inputs (DATETIME fields).\n */\n dateConfig?: DateFilterConfig;\n /**\n * Configuration for boolean input labels (BOOLEAN fields).\n */\n booleanConfig?: BooleanFilterConfig;\n /**\n * Configuration for enum inputs (ARRAY/ARRAY_STRING fields).\n */\n enumConfig?: EnumFilterConfig;\n /**\n * Dynamic options configuration (advanced).\n */\n dynamicOptionsConfig?: DynamicOptionsFilterConfig;\n}\n"],"mappings":";;;;IAqaYA,iBAAiB,GAAAC,OAAA,CAAAD,iBAAA,0BAAjBA,iBAAiB;EAAjBA,iBAAiB;EAAjBA,iBAAiB;EAAjBA,iBAAiB;EAAjBA,iBAAiB;EAAjBA,iBAAiB;EAAA,OAAjBA,iBAAiB;AAAA","ignoreList":[]}
|
|
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 /**\n * The title text.\n */\n text: string;\n /**\n * Determines whether to hide the number of total entities on the title of the page.\n */\n hideTotal?: boolean;\n}\n\nexport interface CollectionPageSubtitle {\n /**\n * The subtitle text.\n */\n text: string;\n /**\n * \"Learn more\" link.\n */\n learnMore?: {\n /**\n * Where the link should navigate to.\n */\n url: string;\n /**\n * The label of the link button. defaults to \"Learn More\".\n */\n label?: string;\n };\n}\n\nexport interface CollectionPageConfig {\n /**\n * Route configuration.\n */\n route: {\n /**\n * Route path (relative path).\n */\n path: string;\n };\n /**\n * Page title configuration.\n */\n title: CollectionPageTitle;\n /**\n * Page subtitle configuration.\n */\n subtitle?: CollectionPageSubtitle;\n /**\n * Page-level actions to render in the page header.\n */\n actions?: {\n /**\n * Primary actions.\n */\n primaryActions?: CollectionPagePrimaryActions;\n /**\n * Secondary actions.\n */\n secondaryActions?: CollectionPageSecondaryActions;\n };\n /**\n * Components rendered within the page layout.\n */\n components: ComponentConfig[];\n}\n\nexport interface CollectionComponentConfig\n extends BaseCollectionComponentConfig {\n /**\n * Type discriminator.\n */\n type: 'collection';\n /**\n * Layout items to render.\n */\n layout: LayoutItemConfig[];\n}\n\nexport interface CustomComponentConfig {\n /**\n * Type discriminator.\n */\n type: 'custom';\n /**\n * Identifier that maps to a custom React component provided via overrides.\n */\n id: string;\n}\n\nexport type ComponentConfig = CollectionComponentConfig | CustomComponentConfig;\n\nexport interface LayoutItemConfig {\n /**\n * Rendering mode for the collection component.\n */\n type: 'Table' | 'Grid';\n /**\n * Table-specific configuration.\n */\n table?: TableSpecificConfig;\n /**\n * Grid-specific configuration.\n */\n grid?: GridSpecificConfig;\n}\n\nexport type ColumnsConfig = Column[];\n\nexport interface TableSpecificConfig {\n /**\n * Table columns configuration.\n */\n columns: ColumnsConfig;\n /**\n * Enables custom columns (hide/reorder columns) functionality.\n */\n customColumns?: {\n enabled: boolean;\n };\n /**\n * Number of leading columns that remain sticky on horizontal scroll.\n */\n stickyColumns?: number;\n /**\n * Row click action.\n */\n onRowClick?: CollectionPageOnRowClickActionConfig;\n /**\n * Show column headers (title bar).\n * @default true\n */\n showTitleBar?: boolean;\n /**\n * Sectioning support for table.\n *\n * The `id` must match the identifier of a custom sectioning override component.\n * This allows you to provide a custom React component for table section rendering.\n */\n sections?: {\n id: string;\n };\n}\n\nexport interface GridSpecificConfig {\n /**\n * Grid item.\n */\n item: GridItem;\n}\n\nexport interface TableConfig\n extends BaseCollectionComponentConfig,\n TableSpecificConfig {}\n\nexport interface GridConfig\n extends BaseCollectionComponentConfig,\n GridSpecificConfig {}\n\nexport interface TableGridSwitchConfig\n extends BaseCollectionComponentConfig,\n TableSpecificConfig,\n GridSpecificConfig {}\n\nexport type CollectionConfig = BaseCollectionConfig & {\n /**\n * Default fetch limit (items per page).\n */\n limit?: number;\n /**\n * Reflect search/filters/sort in the URL.\n * @default false\n */\n reflectQueryInUrl?: boolean;\n /**\n * Scope of \"Select All\":\n * - 'all': select the entire collection (server-side).\n * - 'page': select only currently visible items.\n * @default \"all\"\n */\n selectAllScope?: 'page' | 'all';\n /**\n * Selection behavior when data changes:\n * - 'preserve': keep current selections if still valid.\n * - 'clear': clear selection on data refresh.\n * @default \"clear\"\n */\n selectionUpdateMode?: 'preserve' | 'clear';\n /**\n * Enables optimistic UI actions;\n * Identifier that maps to a custom optimistic actions provided via overrides.\n */\n optimisticActions?: {\n id: string;\n };\n /**\n * Pagination strategy:\n * - 'cursor': `find()` must return { items, cursor, total? }\n * - 'offset': `find()` must return { items, hasNext, total? }\n * @default \"offset\"\n */\n paginationMode?: 'cursor' | 'offset';\n};\n\nexport interface BaseCollectionComponentConfig {\n /**\n * Collection data configuration and behavior.\n */\n collection: CollectionConfig;\n /**\n * Entity page to navigate to (by page id) when interacting with rows (e.g. onRowClick/update).\n */\n entityPageId?: string;\n /**\n * Search configuration.\n */\n search?: {\n /**\n * Whether to show the search input.\n * @default true\n */\n shown?: boolean;\n };\n /**\n * Toolbar title configuration.\n */\n toolbarTitle?: ToolbarTitle;\n /**\n * Action cell configuration per row.\n */\n actionCell?: ActionCellConfig;\n /**\n * Empty state configuration.\n */\n emptyState?: EmptyState;\n /**\n * Filters configuration.\n */\n filters?: FiltersConfig;\n /**\n * Bulk action toolbar configuration.\n */\n bulkActionToolbar?: BulkActionsConfig;\n}\n\nexport interface ToolbarTitle {\n /**\n * Title text.\n */\n title: string;\n /**\n * Subtitle configuration.\n */\n subtitle?: {\n /**\n * Subtitle text.\n */\n text: string;\n /**\n * Info tooltip content with an optional link.\n */\n info?: {\n content: {\n text: string;\n link?: {\n url: string;\n label: string;\n };\n };\n };\n /**\n * \"Learn more\" link.\n */\n learnMore?: {\n /**\n * Where the link should navigate to.\n */\n url: string;\n /**\n * The label of the link button.\n */\n label?: string;\n };\n };\n /**\n * Show total items on the toolbar.\n * @default false\n */\n showTotal?: boolean;\n /**\n * Limit displayed item count in the toolbar.\n */\n itemsLimit?: number;\n}\n\nexport interface Column {\n /**\n * FieldId to bind the column to.\n */\n id: string;\n /**\n * Column header text.\n */\n name: string;\n /**\n * CSS width value (e.g. '120px', '20%').\n */\n width: string;\n /**\n * Whether the column supports sorting.\n */\n sortable?: boolean;\n /**\n * Initial sort order when the page loads.\n */\n defaultSortOrder?: 'asc' | 'desc';\n /**\n * Current sort mode selected in UI.\n */\n sortMode?: 'asc' | 'desc';\n /**\n * Hide column by default in the custom columns panel.\n * When true, the column will not be shown initially and must be enabled by the user via the customize columns UI.\n */\n defaultHidden?: boolean;\n /**\n * Exclude from the \"customize columns\" selection UI.\n */\n hiddenFromCustomColumnsSelection?: boolean;\n /**\n * Controls whether the \"hide/show\" checkbox for this column is enabled in the custom columns panel.\n * If set to false, the checkbox will be disabled and the user cannot toggle visibility for this column.\n */\n hideable?: boolean;\n /**\n * Prevent column reordering in the customization UI.\n */\n reorderDisabled?: boolean;\n /**\n * Tooltip content to display when hovering over the info icon in the column header.\n */\n tooltipContent?: string;\n}\n\nexport interface GridItem {\n /**\n * FieldId to use as the card title.\n */\n titleFieldId: string;\n /**\n * FieldId to use as the card subtitle.\n */\n subtitleFieldId?: string;\n /**\n * FieldId to use as the card image.\n */\n imageFieldId?: string;\n /**\n * Controls which content is shown in the card (preset):\n * - 'full': shows title and subtitle.\n * - 'title': shows only the title.\n * - 'empty': hides both title and subtitle.\n */\n cardContentMode?: 'full' | 'title' | 'empty'; // Footer is not supported in auto-patterns\n /**\n * Position of the image inside the card layout.\n */\n imagePlacement?: 'top' | 'side';\n}\n\nexport interface EmptyState {\n /**\n * Empty state title.\n */\n title?: string;\n /**\n * Empty state subtitle.\n */\n subtitle?: string;\n /**\n * Image to display in the empty state.\n */\n image?: {\n id: string;\n };\n /**\n * \"Add new\" call-to-action button.\n */\n addNewCta?: {\n id?: string;\n text?: string;\n };\n /**\n * Custom CTA slot (advanced).\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';\n\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[];\n\nexport interface FiltersConfig {\n /**\n * Filter items to display.\n */\n items: FilterItems;\n /**\n * Maximum number of filters shown inline before moving to the panel.\n * @default 0 (all in panel).\n */\n maxInlineFilters?: CollectionToolbarFiltersProps['inline'];\n /**\n * Title for the filter panel drawer.\n */\n panelTitle?: string;\n}\n\nexport interface BaseOptionsFilterConfig {\n /**\n * Selection behavior: single choice or multiple choices.\n */\n selectionMode: FilterSelectionMode;\n}\n\nexport interface DateFilterConfig {\n /**\n * Controls behavior: presets only, custom only, or both.\n */\n mode?: DateRangeFilterMode;\n /**\n * Which preset ranges to display (only if mode supports presets).\n */\n presets?: DateRangeOptions;\n /**\n * Whether to include time selection.\n * @default true\n */\n includeTime?: boolean;\n}\n\nexport interface NumberFilterConfig {\n /**\n * Minimum allowed value.\n */\n min?: number;\n /**\n * Maximum allowed value.\n */\n max?: number;\n /**\n * Whether decimal values are allowed.\n */\n allowedDecimals?: boolean;\n}\n\nexport interface BooleanFilterConfig {\n /**\n * Label for the \"true\" option.\n */\n trueLabel?: string;\n /**\n * Label for the \"false\" option.\n */\n falseLabel?: string;\n}\n\nexport interface EnumFilterConfig extends BaseOptionsFilterConfig {\n /**\n * List of available options.\n */\n options: FilterOption[];\n /**\n * Rendering control for option appearance.\n */\n optionType?: FilterOptionType;\n}\n\nexport interface DynamicOptionsFilterConfig extends BaseOptionsFilterConfig {}\n\nexport interface Filter {\n /**\n * Filter unique identifier.\n */\n id: string;\n /**\n * Target field id this filter controls.\n */\n fieldId: string;\n /**\n * Optional filter display name (defaults to field name).\n */\n displayName?: string;\n /**\n * Optional grouping label. Filters with the same `sectionTitle` are grouped together.\n */\n sectionTitle?: string;\n /**\n * Whether the filter item is expanded by default in the panel.\n */\n openByDefault?: boolean;\n /**\n * Label shown in the table/grid tag when the filter is active.\n */\n tagLabel?: string;\n /**\n * Configuration for number inputs (NUMBER fields).\n */\n numberConfig?: NumberFilterConfig;\n /**\n * Configuration for date inputs (DATETIME fields).\n */\n dateConfig?: DateFilterConfig;\n /**\n * Configuration for boolean input labels (BOOLEAN fields).\n */\n booleanConfig?: BooleanFilterConfig;\n /**\n * Configuration for enum inputs (ARRAY/ARRAY_STRING fields).\n */\n enumConfig?: EnumFilterConfig;\n /**\n * Dynamic options configuration (advanced).\n */\n dynamicOptionsConfig?: DynamicOptionsFilterConfig;\n}\n"],"mappings":";;;;IAyaYA,iBAAiB,GAAAC,OAAA,CAAAD,iBAAA,0BAAjBA,iBAAiB;EAAjBA,iBAAiB;EAAjBA,iBAAiB;EAAjBA,iBAAiB;EAAjBA,iBAAiB;EAAjBA,iBAAiB;EAAA,OAAjBA,iBAAiB;AAAA","ignoreList":[]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Box,
|
|
1
|
+
import { Box, MessageModalLayout, Modal, Text } from '@wix/design-system';
|
|
2
2
|
import React from 'react';
|
|
3
3
|
export const BulkDeleteModal = _ref => {
|
|
4
4
|
var _modalParams$title, _modalParams$actions, _modalParams$actions2, _modalParams$descript;
|
|
@@ -16,11 +16,11 @@ export const BulkDeleteModal = _ref => {
|
|
|
16
16
|
return /*#__PURE__*/React.createElement(Modal, {
|
|
17
17
|
isOpen: true,
|
|
18
18
|
onRequestClose: closeModal
|
|
19
|
-
}, /*#__PURE__*/React.createElement(
|
|
19
|
+
}, /*#__PURE__*/React.createElement(MessageModalLayout, {
|
|
20
20
|
title: ((_modalParams$title = modalParams.title) == null ? void 0 : _modalParams$title.text) || 'Delete item?',
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
closeModal()
|
|
21
|
+
skin: "destructive",
|
|
22
|
+
closeButtonProps: {
|
|
23
|
+
onClick: () => closeModal()
|
|
24
24
|
},
|
|
25
25
|
primaryButtonOnClick: () => {
|
|
26
26
|
var _modalParams$feedback;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["Box","
|
|
1
|
+
{"version":3,"names":["Box","MessageModalLayout","Modal","Text","React","BulkDeleteModal","_ref","_modalParams$title","_modalParams$actions","_modalParams$actions2","_modalParams$descript","sdk","modalParams","actionParams","getOptimisticActions","collectionId","closeModal","optimisticActions","createElement","isOpen","onRequestClose","title","text","skin","closeButtonProps","onClick","primaryButtonOnClick","_modalParams$feedback","schema","getSchema","Error","selectedIds","selectedValues","map","value","idField","deleteMany","successToast","feedback","errorToast","_modalParams$feedback2","submit","result","actions","bulkDelete","secondaryButtonOnClick","primaryButtonText","secondaryButtonText","cancel","content","direction","gap","paddingTop","paddingBottom","description"],"sources":["../../../../../src/components/modals/actions/BulkDeleteModal.tsx"],"sourcesContent":["import { Box, MessageModalLayout, Modal, Text } from '@wix/design-system';\nimport React from 'react';\nimport { BulkActionsActionParams, BulkDeleteActionModal } from '../../../types';\nimport { ActionModalProps } from './types';\n\nexport interface BulkDeleteModalProps extends ActionModalProps {\n modalParams: BulkDeleteActionModal;\n actionParams: BulkActionsActionParams;\n}\n\nexport const BulkDeleteModal = ({\n sdk,\n modalParams,\n actionParams,\n}: BulkDeleteModalProps) => {\n const { getOptimisticActions, collectionId, closeModal } = sdk;\n const optimisticActions = getOptimisticActions(collectionId);\n\n return (\n <Modal isOpen onRequestClose={closeModal}>\n <MessageModalLayout\n title={modalParams.title?.text || 'Delete item?'}\n skin=\"destructive\"\n closeButtonProps={{ onClick: () => closeModal() }}\n primaryButtonOnClick={() => {\n const schema = sdk.getSchema(sdk.collectionId);\n if (!schema) {\n throw new Error('Schema not found');\n }\n const selectedIds = actionParams.selectedValues.map(\n (value) => value[schema.idField],\n );\n optimisticActions?.deleteMany(actionParams.selectedValues, {\n successToast:\n modalParams.feedback?.successToast?.text ||\n 'Items deleted successfully',\n errorToast: () =>\n modalParams.feedback?.errorToast?.text ||\n 'Failed to delete items',\n submit: async () => {\n const result = await schema.actions.bulkDelete(selectedIds);\n return [result];\n },\n });\n closeModal();\n }}\n secondaryButtonOnClick={() => {\n closeModal();\n }}\n primaryButtonText={modalParams.actions?.submit?.text || 'Save'}\n secondaryButtonText={modalParams.actions?.cancel?.text || 'Cancel'}\n content={\n <Box\n direction=\"vertical\"\n gap=\"SP2\"\n paddingTop=\"SP1\"\n paddingBottom=\"SP1\"\n >\n <Box>\n <Text>\n {modalParams.description?.text || 'This items will be deleted'}\n </Text>\n </Box>\n </Box>\n }\n />\n </Modal>\n );\n};\n"],"mappings":"AAAA,SAASA,GAAG,EAAEC,kBAAkB,EAAEC,KAAK,EAAEC,IAAI,QAAQ,oBAAoB;AACzE,OAAOC,KAAK,MAAM,OAAO;AASzB,OAAO,MA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SortConfiguration(column, sortable),
|
|
100
100
|
...createCustomColumnConfiguration(column),
|
|
101
|
+
...(column.tooltipContent && {
|
|
102
|
+
infoTooltipProps: {
|
|
103
|
+
content: column.tooltipContent
|
|
104
|
+
}
|
|
105
|
+
}),
|
|
101
106
|
render: row => {
|
|
102
107
|
var _overrides$columns3;
|
|
103
108
|
const itemValue = get(row, column.id);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","useAutoPatternsOverridesContext","useSchema","useSchemaRegistry","camelCase","get","Avatar","Box","Image","getImageUrl","useColumns","columns","fields","getSchema","overrides","existingColumns","filter","column","_overrides$columns","id","createRenderer","fieldDefinition","itemValue","type","Date","toLocaleDateString","date","toLocaleString","join","referenceMetadata","referencedCollectionId","refSchema","nameValue","imageValue","displayField","_Object$values$find","imageFieldId","Object","values","find","field","imageUrl","createElement","gap","verticalAlign","size","name","imgProps","src","width","dataHook","map","_overrides$columns2","_fieldDefinition$capa","sortable","capabilities","baseColumnConfig","title","displayName","createSortConfiguration","createCustomColumnConfiguration","render","row","_overrides$columns3","_overrides$columns4","_overrides$columns4$c","call","value","Boolean","sortableColumnConfig","defaultSortOrder","sortMode","undefined","reorderDisabled","hiddenFromCustomColumnsSelection","hideable","defaultHidden"],"sources":["../../../src/hooks/useColumns.tsx"],"sourcesContent":["import React from 'react';\nimport { TableColumn } from '@wix/patterns';\nimport {\n useAutoPatternsOverridesContext,\n useSchema,\n useSchemaRegistry,\n} from '../providers';\nimport { Column, Field } from '../types';\nimport { camelCase, get } from 'lodash';\nimport { Avatar, Box, Image } from '@wix/design-system';\nimport { getImageUrl } from '../utils/media/getImageUrl';\n\nexport const useColumns = (columns: Column[]) => {\n const { fields } = useSchema();\n const { getSchema } = useSchemaRegistry();\n const overrides = useAutoPatternsOverridesContext();\n\n const existingColumns = columns.filter((column) => {\n return !!fields[column.id] || overrides?.columns?.[column.id];\n });\n\n const createRenderer = (fieldDefinition: Field, itemValue: any) => {\n if (itemValue == null) {\n return '';\n }\n\n switch (fieldDefinition.type) {\n case 'BOOLEAN':\n return itemValue ? '✔' : '✖';\n case 'DATE':\n if (itemValue instanceof Date) {\n return itemValue.toLocaleDateString();\n }\n if (typeof itemValue === 'string') {\n const date = new Date(itemValue);\n return date.toLocaleDateString();\n }\n return itemValue;\n case 'DATETIME':\n if (itemValue instanceof Date) {\n return itemValue.toLocaleString();\n }\n if (typeof itemValue === 'string') {\n const date = new Date(itemValue);\n return date.toLocaleString();\n }\n return itemValue;\n case 'ARRAY':\n // We assume that the array contains strings\n // If the array contains objects, we need to handle it differently\n return itemValue.join(', ');\n case 'REFERENCE':\n if (fieldDefinition.referenceMetadata && getSchema) {\n const { referencedCollectionId } = fieldDefinition.referenceMetadata;\n const refSchema = getSchema(referencedCollectionId);\n\n if (refSchema) {\n let nameValue: string | undefined;\n let imageValue: string | undefined;\n const displayField = refSchema.displayField;\n if (typeof itemValue === 'object' && itemValue !== null) {\n nameValue = itemValue[displayField] || '';\n const imageFieldId = Object.values(fields).find(\n (field) => field?.type === 'IMAGE',\n )?.id;\n imageValue = imageFieldId && itemValue[imageFieldId];\n }\n\n const imageUrl = imageValue && getImageUrl(imageValue);\n return (\n <Box gap=\"SP2\" verticalAlign=\"middle\">\n {imageUrl && (\n <Avatar\n size=\"size24\"\n name={nameValue}\n imgProps={{ src: imageUrl }}\n />\n )}\n <div>{nameValue}</div>\n </Box>\n );\n }\n }\n\n return itemValue;\n case 'IMAGE':\n const imageUrl = getImageUrl(itemValue);\n\n return (\n <Image src={imageUrl} width=\"48px\" dataHook=\"auto-patterns-image\" />\n );\n default:\n return itemValue;\n }\n };\n\n return existingColumns\n .map((column) => {\n const fieldDefinition = fields[column.id];\n if (!fieldDefinition && !overrides?.columns?.[column.id]) {\n return null;\n }\n\n const sortable =\n column.sortable && fieldDefinition?.capabilities?.sortable;\n\n const baseColumnConfig = {\n id: column.id,\n title: column.name || fieldDefinition?.displayName,\n width: column.width,\n ...createSortConfiguration(column, sortable),\n ...createCustomColumnConfiguration(column),\n render: (row: any) => {\n const itemValue = get(row, column.id);\n\n if (overrides?.columns?.[camelCase(column.id)]) {\n return overrides?.columns?.[camelCase(column.id)]?.({\n value: itemValue,\n row,\n });\n }\n\n if (fieldDefinition) {\n return createRenderer(fieldDefinition, itemValue);\n }\n\n return null; // Shouldn't really happen\n },\n };\n\n return baseColumnConfig;\n })\n .filter(Boolean) as TableColumn<any>[];\n};\n\nconst createSortConfiguration = (\n column: Column,\n sortable?: boolean,\n): Partial<TableColumn<any>> => {\n if (!sortable) {\n return {};\n }\n const sortableColumnConfig = {\n sortable,\n defaultSortOrder: column.defaultSortOrder,\n };\n\n // default sort mode is ['asc', 'desc', undefined]\n // so if sort mode is 'desc' -> we want to override the default\n // and set it to ['desc', 'asc', undefined]\n if (column.sortMode && column.sortMode === 'desc') {\n return {\n ...sortableColumnConfig,\n sortMode: ['desc', 'asc', undefined],\n };\n }\n return {\n ...sortableColumnConfig,\n };\n};\n\nconst createCustomColumnConfiguration = (\n column: Column,\n): Partial<TableColumn<any>> => {\n const reorderDisabled = !!column.reorderDisabled;\n\n if (column.hiddenFromCustomColumnsSelection) {\n return { hiddenFromCustomColumnsSelection: true };\n }\n if (column.hideable === false) {\n return {\n hideable: false,\n reorderDisabled,\n };\n }\n return {\n defaultHidden: !!column.defaultHidden,\n reorderDisabled,\n };\n};\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AAEzB,SACEC,+BAA+B,EAC/BC,SAAS,EACTC,iBAAiB,QACZ,cAAc;AAErB,SAASC,SAAS,EAAEC,GAAG,QAAQ,QAAQ;AACvC,SAASC,MAAM,EAAEC,GAAG,EAAEC,KAAK,QAAQ,oBAAoB;AACvD,SAASC,WAAW,QAAQ,4BAA4B;AAExD,OAAO,MAAMC,UAAU,GAAIC,OAAiB,IAAK;EAC/C,MAAM;IAAEC;EAAO,CAAC,GAAGV,SAAS,CAAC,CAAC;EAC9B,MAAM;IAAEW;EAAU,CAAC,GAAGV,iBAAiB,C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rCH;EACF,CAAC;AACH,CAAC","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["React","useAutoPatternsOverridesContext","useSchema","useSchemaRegistry","camelCase","get","Avatar","Box","Image","getImageUrl","useColumns","columns","fields","getSchema","overrides","existingColumns","filter","column","_overrides$columns","id","createRenderer","fieldDefinition","itemValue","type","Date","toLocaleDateString","date","toLocaleString","join","referenceMetadata","referencedCollectionId","refSchema","nameValue","imageValue","displayField","_Object$values$find","imageFieldId","Object","values","find","field","imageUrl","createElement","gap","verticalAlign","size","name","imgProps","src","width","dataHook","map","_overrides$columns2","_fieldDefinition$capa","sortable","capabilities","baseColumnConfig","title","displayName","createSortConfiguration","createCustomColumnConfiguration","tooltipContent","infoTooltipProps","content","render","row","_overrides$columns3","_overrides$columns4","_overrides$columns4$c","call","value","Boolean","sortableColumnConfig","defaultSortOrder","sortMode","undefined","reorderDisabled","hiddenFromCustomColumnsSelection","hideable","defaultHidden"],"sources":["../../../src/hooks/useColumns.tsx"],"sourcesContent":["import React from 'react';\nimport { TableColumn } from '@wix/patterns';\nimport {\n useAutoPatternsOverridesContext,\n useSchema,\n useSchemaRegistry,\n} from '../providers';\nimport { Column, Field } from '../types';\nimport { camelCase, get } from 'lodash';\nimport { Avatar, Box, Image } from '@wix/design-system';\nimport { getImageUrl } from '../utils/media/getImageUrl';\n\nexport const useColumns = (columns: Column[]) => {\n const { fields } = useSchema();\n const { getSchema } = useSchemaRegistry();\n const overrides = useAutoPatternsOverridesContext();\n\n const existingColumns = columns.filter((column) => {\n return !!fields[column.id] || overrides?.columns?.[column.id];\n });\n\n const createRenderer = (fieldDefinition: Field, itemValue: any) => {\n if (itemValue == null) {\n return '';\n }\n\n switch (fieldDefinition.type) {\n case 'BOOLEAN':\n return itemValue ? '✔' : '✖';\n case 'DATE':\n if (itemValue instanceof Date) {\n return itemValue.toLocaleDateString();\n }\n if (typeof itemValue === 'string') {\n const date = new Date(itemValue);\n return date.toLocaleDateString();\n }\n return itemValue;\n case 'DATETIME':\n if (itemValue instanceof Date) {\n return itemValue.toLocaleString();\n }\n if (typeof itemValue === 'string') {\n const date = new Date(itemValue);\n return date.toLocaleString();\n }\n return itemValue;\n case 'ARRAY':\n // We assume that the array contains strings\n // If the array contains objects, we need to handle it differently\n return itemValue.join(', ');\n case 'REFERENCE':\n if (fieldDefinition.referenceMetadata && getSchema) {\n const { referencedCollectionId } = fieldDefinition.referenceMetadata;\n const refSchema = getSchema(referencedCollectionId);\n\n if (refSchema) {\n let nameValue: string | undefined;\n let imageValue: string | undefined;\n const displayField = refSchema.displayField;\n if (typeof itemValue === 'object' && itemValue !== null) {\n nameValue = itemValue[displayField] || '';\n const imageFieldId = Object.values(fields).find(\n (field) => field?.type === 'IMAGE',\n )?.id;\n imageValue = imageFieldId && itemValue[imageFieldId];\n }\n\n const imageUrl = imageValue && getImageUrl(imageValue);\n return (\n <Box gap=\"SP2\" verticalAlign=\"middle\">\n {imageUrl && (\n <Avatar\n size=\"size24\"\n name={nameValue}\n imgProps={{ src: imageUrl }}\n />\n )}\n <div>{nameValue}</div>\n </Box>\n );\n }\n }\n\n return itemValue;\n case 'IMAGE':\n const imageUrl = getImageUrl(itemValue);\n\n return (\n <Image src={imageUrl} width=\"48px\" dataHook=\"auto-patterns-image\" />\n );\n default:\n return itemValue;\n }\n };\n\n return existingColumns\n .map((column) => {\n const fieldDefinition = fields[column.id];\n if (!fieldDefinition && !overrides?.columns?.[column.id]) {\n return null;\n }\n\n const sortable =\n column.sortable && fieldDefinition?.capabilities?.sortable;\n const baseColumnConfig = {\n id: column.id,\n title: column.name || fieldDefinition?.displayName,\n width: column.width,\n ...createSortConfiguration(column, sortable),\n ...createCustomColumnConfiguration(column),\n ...(column.tooltipContent && {\n infoTooltipProps: {\n content: column.tooltipContent,\n },\n }),\n render: (row: any) => {\n const itemValue = get(row, column.id);\n\n if (overrides?.columns?.[camelCase(column.id)]) {\n return overrides?.columns?.[camelCase(column.id)]?.({\n value: itemValue,\n row,\n });\n }\n\n if (fieldDefinition) {\n return createRenderer(fieldDefinition, itemValue);\n }\n\n return null; // Shouldn't really happen\n },\n };\n\n return baseColumnConfig;\n })\n .filter(Boolean) as TableColumn<any>[];\n};\n\nconst createSortConfiguration = (\n column: Column,\n sortable?: boolean,\n): Partial<TableColumn<any>> => {\n if (!sortable) {\n return {};\n }\n const sortableColumnConfig = {\n sortable,\n defaultSortOrder: column.defaultSortOrder,\n };\n\n // default sort mode is ['asc', 'desc', undefined]\n // so if sort mode is 'desc' -> we want to override the default\n // and set it to ['desc', 'asc', undefined]\n if (column.sortMode && column.sortMode === 'desc') {\n return {\n ...sortableColumnConfig,\n sortMode: ['desc', 'asc', undefined],\n };\n }\n return {\n ...sortableColumnConfig,\n };\n};\n\nconst createCustomColumnConfiguration = (\n column: Column,\n): Partial<TableColumn<any>> => {\n const reorderDisabled = !!column.reorderDisabled;\n\n if (column.hiddenFromCustomColumnsSelection) {\n return { hiddenFromCustomColumnsSelection: true };\n }\n if (column.hideable === false) {\n return {\n hideable: false,\n reorderDisabled,\n };\n }\n return {\n defaultHidden: !!column.defaultHidden,\n reorderDisabled,\n };\n};\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AAEzB,SACEC,+BAA+B,EAC/BC,SAAS,EACTC,iBAAiB,QACZ,cAAc;AAErB,SAASC,SAAS,EAAEC,GAAG,QAAQ,QAAQ;AACvC,SAASC,MAAM,EAAEC,GAAG,EAAEC,KAAK,QAAQ,oBAAoB;AACvD,SAASC,WAAW,QAAQ,4BAA4B;AAExD,OAAO,MAAMC,UAAU,GAAIC,OAAiB,IAAK;EAC/C,MAAM;IAAEC;EAAO,CAAC,GAAGV,SAAS,CAAC,CAAC;EAC9B,MAAM;IAAEW;EAAU,CAAC,GAAGV,iBAAiB,CAAC,CAAC;EACzC,MAAMW,SAAS,GAAGb,+BAA+B,CAAC,CAAC;EAEnD,MAAMc,eAAe,GAAGJ,OAAO,CAACK,MAAM,CAAEC,MAAM,IAAK;IAAA,IAAAC,kBA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AC;AACH,CAAC","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["ComponentTypeEnum"],"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 /**\n * The title text.\n */\n text: string;\n /**\n * Determines whether to hide the number of total entities on the title of the page.\n */\n hideTotal?: boolean;\n}\n\nexport interface CollectionPageSubtitle {\n /**\n * The subtitle text.\n */\n text: string;\n /**\n * \"Learn more\" link.\n */\n learnMore?: {\n /**\n * Where the link should navigate to.\n */\n url: string;\n /**\n * The label of the link button. defaults to \"Learn More\".\n */\n label?: string;\n };\n}\n\nexport interface CollectionPageConfig {\n /**\n * Route configuration.\n */\n route: {\n /**\n * Route path (relative path).\n */\n path: string;\n };\n /**\n * Page title configuration.\n */\n title: CollectionPageTitle;\n /**\n * Page subtitle configuration.\n */\n subtitle?: CollectionPageSubtitle;\n /**\n * Page-level actions to render in the page header.\n */\n actions?: {\n /**\n * Primary actions.\n */\n primaryActions?: CollectionPagePrimaryActions;\n /**\n * Secondary actions.\n */\n secondaryActions?: CollectionPageSecondaryActions;\n };\n /**\n * Components rendered within the page layout.\n */\n components: ComponentConfig[];\n}\n\nexport interface CollectionComponentConfig\n extends BaseCollectionComponentConfig {\n /**\n * Type discriminator.\n */\n type: 'collection';\n /**\n * Layout items to render.\n */\n layout: LayoutItemConfig[];\n}\n\nexport interface CustomComponentConfig {\n /**\n * Type discriminator.\n */\n type: 'custom';\n /**\n * Identifier that maps to a custom React component provided via overrides.\n */\n id: string;\n}\n\nexport type ComponentConfig = CollectionComponentConfig | CustomComponentConfig;\n\nexport interface LayoutItemConfig {\n /**\n * Rendering mode for the collection component.\n */\n type: 'Table' | 'Grid';\n /**\n * Table-specific configuration.\n */\n table?: TableSpecificConfig;\n /**\n * Grid-specific configuration.\n */\n grid?: GridSpecificConfig;\n}\n\nexport type ColumnsConfig = Column[];\n\nexport interface TableSpecificConfig {\n /**\n * Table columns configuration.\n */\n columns: ColumnsConfig;\n /**\n * Enables custom columns (hide/reorder columns) functionality.\n */\n customColumns?: {\n enabled: boolean;\n };\n /**\n * Number of leading columns that remain sticky on horizontal scroll.\n */\n stickyColumns?: number;\n /**\n * Row click action.\n */\n onRowClick?: CollectionPageOnRowClickActionConfig;\n /**\n * Show column headers (title bar).\n * @default true\n */\n showTitleBar?: boolean;\n /**\n * Sectioning support for table.\n *\n * The `id` must match the identifier of a custom sectioning override component.\n * This allows you to provide a custom React component for table section rendering.\n */\n sections?: {\n id: string;\n };\n}\n\nexport interface GridSpecificConfig {\n /**\n * Grid item.\n */\n item: GridItem;\n}\n\nexport interface TableConfig\n extends BaseCollectionComponentConfig,\n TableSpecificConfig {}\n\nexport interface GridConfig\n extends BaseCollectionComponentConfig,\n GridSpecificConfig {}\n\nexport interface TableGridSwitchConfig\n extends BaseCollectionComponentConfig,\n TableSpecificConfig,\n GridSpecificConfig {}\n\nexport type CollectionConfig = BaseCollectionConfig & {\n /**\n * Default fetch limit (items per page).\n */\n limit?: number;\n /**\n * Reflect search/filters/sort in the URL.\n * @default false\n */\n reflectQueryInUrl?: boolean;\n /**\n * Scope of \"Select All\":\n * - 'all': select the entire collection (server-side).\n * - 'page': select only currently visible items.\n * @default \"all\"\n */\n selectAllScope?: 'page' | 'all';\n /**\n * Selection behavior when data changes:\n * - 'preserve': keep current selections if still valid.\n * - 'clear': clear selection on data refresh.\n * @default \"clear\"\n */\n selectionUpdateMode?: 'preserve' | 'clear';\n /**\n * Enables optimistic UI actions;\n * Identifier that maps to a custom optimistic actions provided via overrides.\n */\n optimisticActions?: {\n id: string;\n };\n /**\n * Pagination strategy:\n * - 'cursor': `find()` must return { items, cursor, total? }\n * - 'offset': `find()` must return { items, hasNext, total? }\n * @default \"offset\"\n */\n paginationMode?: 'cursor' | 'offset';\n};\n\nexport interface BaseCollectionComponentConfig {\n /**\n * Collection data configuration and behavior.\n */\n collection: CollectionConfig;\n /**\n * Entity page to navigate to (by page id) when interacting with rows (e.g. onRowClick/update).\n */\n entityPageId?: string;\n /**\n * Search configuration.\n */\n search?: {\n /**\n * Whether to show the search input.\n * @default true\n */\n shown?: boolean;\n };\n /**\n * Toolbar title configuration.\n */\n toolbarTitle?: ToolbarTitle;\n /**\n * Action cell configuration per row.\n */\n actionCell?: ActionCellConfig;\n /**\n * Empty state configuration.\n */\n emptyState?: EmptyState;\n /**\n * Filters configuration.\n */\n filters?: FiltersConfig;\n /**\n * Bulk action toolbar configuration.\n */\n bulkActionToolbar?: BulkActionsConfig;\n}\n\nexport interface ToolbarTitle {\n /**\n * Title text.\n */\n title: string;\n /**\n * Subtitle configuration.\n */\n subtitle?: {\n /**\n * Subtitle text.\n */\n text: string;\n /**\n * Info tooltip content with an optional link.\n */\n info?: {\n content: {\n text: string;\n link?: {\n url: string;\n label: string;\n };\n };\n };\n /**\n * \"Learn more\" link.\n */\n learnMore?: {\n /**\n * Where the link should navigate to.\n */\n url: string;\n /**\n * The label of the link button.\n */\n label?: string;\n };\n };\n /**\n * Show total items on the toolbar.\n * @default false\n */\n showTotal?: boolean;\n /**\n * Limit displayed item count in the toolbar.\n */\n itemsLimit?: number;\n}\n\nexport interface Column {\n /**\n * FieldId to bind the column to.\n */\n id: string;\n /**\n * Column header text.\n */\n name: string;\n /**\n * CSS width value (e.g. '120px', '20%').\n */\n width: string;\n /**\n * Whether the column supports sorting.\n */\n sortable?: boolean;\n /**\n * Initial sort order when the page loads.\n */\n defaultSortOrder?: 'asc' | 'desc';\n /**\n * Current sort mode selected in UI.\n */\n sortMode?: 'asc' | 'desc';\n /**\n * Hide column by default in the custom columns panel.\n * When true, the column will not be shown initially and must be enabled by the user via the customize columns UI.\n */\n defaultHidden?: boolean;\n /**\n * Exclude from the \"customize columns\" selection UI.\n */\n hiddenFromCustomColumnsSelection?: boolean;\n /**\n * Controls whether the \"hide/show\" checkbox for this column is enabled in the custom columns panel.\n * If set to false, the checkbox will be disabled and the user cannot toggle visibility for this column.\n */\n hideable?: boolean;\n /**\n * Prevent column reordering in the customization UI.\n */\n reorderDisabled?: boolean;\n}\n\nexport interface GridItem {\n /**\n * FieldId to use as the card title.\n */\n titleFieldId: string;\n /**\n * FieldId to use as the card subtitle.\n */\n subtitleFieldId?: string;\n /**\n * FieldId to use as the card image.\n */\n imageFieldId?: string;\n /**\n * Controls which content is shown in the card (preset):\n * - 'full': shows title and subtitle.\n * - 'title': shows only the title.\n * - 'empty': hides both title and subtitle.\n */\n cardContentMode?: 'full' | 'title' | 'empty'; // Footer is not supported in auto-patterns\n /**\n * Position of the image inside the card layout.\n */\n imagePlacement?: 'top' | 'side';\n}\n\nexport interface EmptyState {\n /**\n * Empty state title.\n */\n title?: string;\n /**\n * Empty state subtitle.\n */\n subtitle?: string;\n /**\n * Image to display in the empty state.\n */\n image?: {\n id: string;\n };\n /**\n * \"Add new\" call-to-action button.\n */\n addNewCta?: {\n id?: string;\n text?: string;\n };\n /**\n * Custom CTA slot (advanced).\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';\n\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[];\n\nexport interface FiltersConfig {\n /**\n * Filter items to display.\n */\n items: FilterItems;\n /**\n * Maximum number of filters shown inline before moving to the panel.\n * @default 0 (all in panel).\n */\n maxInlineFilters?: CollectionToolbarFiltersProps['inline'];\n /**\n * Title for the filter panel drawer.\n */\n panelTitle?: string;\n}\n\nexport interface BaseOptionsFilterConfig {\n /**\n * Selection behavior: single choice or multiple choices.\n */\n selectionMode: FilterSelectionMode;\n}\n\nexport interface DateFilterConfig {\n /**\n * Controls behavior: presets only, custom only, or both.\n */\n mode?: DateRangeFilterMode;\n /**\n * Which preset ranges to display (only if mode supports presets).\n */\n presets?: DateRangeOptions;\n /**\n * Whether to include time selection.\n * @default true\n */\n includeTime?: boolean;\n}\n\nexport interface NumberFilterConfig {\n /**\n * Minimum allowed value.\n */\n min?: number;\n /**\n * Maximum allowed value.\n */\n max?: number;\n /**\n * Whether decimal values are allowed.\n */\n allowedDecimals?: boolean;\n}\n\nexport interface BooleanFilterConfig {\n /**\n * Label for the \"true\" option.\n */\n trueLabel?: string;\n /**\n * Label for the \"false\" option.\n */\n falseLabel?: string;\n}\n\nexport interface EnumFilterConfig extends BaseOptionsFilterConfig {\n /**\n * List of available options.\n */\n options: FilterOption[];\n /**\n * Rendering control for option appearance.\n */\n optionType?: FilterOptionType;\n}\n\nexport interface DynamicOptionsFilterConfig extends BaseOptionsFilterConfig {}\n\nexport interface Filter {\n /**\n * Filter unique identifier.\n */\n id: string;\n /**\n * Target field id this filter controls.\n */\n fieldId: string;\n /**\n * Optional filter display name (defaults to field name).\n */\n displayName?: string;\n /**\n * Optional grouping label. Filters with the same `sectionTitle` are grouped together.\n */\n sectionTitle?: string;\n /**\n * Whether the filter item is expanded by default in the panel.\n */\n openByDefault?: boolean;\n /**\n * Label shown in the table/grid tag when the filter is active.\n */\n tagLabel?: string;\n /**\n * Configuration for number inputs (NUMBER fields).\n */\n numberConfig?: NumberFilterConfig;\n /**\n * Configuration for date inputs (DATETIME fields).\n */\n dateConfig?: DateFilterConfig;\n /**\n * Configuration for boolean input labels (BOOLEAN fields).\n */\n booleanConfig?: BooleanFilterConfig;\n /**\n * Configuration for enum inputs (ARRAY/ARRAY_STRING fields).\n */\n enumConfig?: EnumFilterConfig;\n /**\n * Dynamic options configuration (advanced).\n */\n dynamicOptionsConfig?: DynamicOptionsFilterConfig;\n}\n"],"mappings":"AAqaA,WAAYA,iBAAiB,0BAAjBA,iBAAiB;EAAjBA,iBAAiB;EAAjBA,iBAAiB;EAAjBA,iBAAiB;EAAjBA,iBAAiB;EAAjBA,iBAAiB;EAAA,OAAjBA,iBAAiB;AAAA","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["ComponentTypeEnum"],"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 /**\n * The title text.\n */\n text: string;\n /**\n * Determines whether to hide the number of total entities on the title of the page.\n */\n hideTotal?: boolean;\n}\n\nexport interface CollectionPageSubtitle {\n /**\n * The subtitle text.\n */\n text: string;\n /**\n * \"Learn more\" link.\n */\n learnMore?: {\n /**\n * Where the link should navigate to.\n */\n url: string;\n /**\n * The label of the link button. defaults to \"Learn More\".\n */\n label?: string;\n };\n}\n\nexport interface CollectionPageConfig {\n /**\n * Route configuration.\n */\n route: {\n /**\n * Route path (relative path).\n */\n path: string;\n };\n /**\n * Page title configuration.\n */\n title: CollectionPageTitle;\n /**\n * Page subtitle configuration.\n */\n subtitle?: CollectionPageSubtitle;\n /**\n * Page-level actions to render in the page header.\n */\n actions?: {\n /**\n * Primary actions.\n */\n primaryActions?: CollectionPagePrimaryActions;\n /**\n * Secondary actions.\n */\n secondaryActions?: CollectionPageSecondaryActions;\n };\n /**\n * Components rendered within the page layout.\n */\n components: ComponentConfig[];\n}\n\nexport interface CollectionComponentConfig\n extends BaseCollectionComponentConfig {\n /**\n * Type discriminator.\n */\n type: 'collection';\n /**\n * Layout items to render.\n */\n layout: LayoutItemConfig[];\n}\n\nexport interface CustomComponentConfig {\n /**\n * Type discriminator.\n */\n type: 'custom';\n /**\n * Identifier that maps to a custom React component provided via overrides.\n */\n id: string;\n}\n\nexport type ComponentConfig = CollectionComponentConfig | CustomComponentConfig;\n\nexport interface LayoutItemConfig {\n /**\n * Rendering mode for the collection component.\n */\n type: 'Table' | 'Grid';\n /**\n * Table-specific configuration.\n */\n table?: TableSpecificConfig;\n /**\n * Grid-specific configuration.\n */\n grid?: GridSpecificConfig;\n}\n\nexport type ColumnsConfig = Column[];\n\nexport interface TableSpecificConfig {\n /**\n * Table columns configuration.\n */\n columns: ColumnsConfig;\n /**\n * Enables custom columns (hide/reorder columns) functionality.\n */\n customColumns?: {\n enabled: boolean;\n };\n /**\n * Number of leading columns that remain sticky on horizontal scroll.\n */\n stickyColumns?: number;\n /**\n * Row click action.\n */\n onRowClick?: CollectionPageOnRowClickActionConfig;\n /**\n * Show column headers (title bar).\n * @default true\n */\n showTitleBar?: boolean;\n /**\n * Sectioning support for table.\n *\n * The `id` must match the identifier of a custom sectioning override component.\n * This allows you to provide a custom React component for table section rendering.\n */\n sections?: {\n id: string;\n };\n}\n\nexport interface GridSpecificConfig {\n /**\n * Grid item.\n */\n item: GridItem;\n}\n\nexport interface TableConfig\n extends BaseCollectionComponentConfig,\n TableSpecificConfig {}\n\nexport interface GridConfig\n extends BaseCollectionComponentConfig,\n GridSpecificConfig {}\n\nexport interface TableGridSwitchConfig\n extends BaseCollectionComponentConfig,\n TableSpecificConfig,\n GridSpecificConfig {}\n\nexport type CollectionConfig = BaseCollectionConfig & {\n /**\n * Default fetch limit (items per page).\n */\n limit?: number;\n /**\n * Reflect search/filters/sort in the URL.\n * @default false\n */\n reflectQueryInUrl?: boolean;\n /**\n * Scope of \"Select All\":\n * - 'all': select the entire collection (server-side).\n * - 'page': select only currently visible items.\n * @default \"all\"\n */\n selectAllScope?: 'page' | 'all';\n /**\n * Selection behavior when data changes:\n * - 'preserve': keep current selections if still valid.\n * - 'clear': clear selection on data refresh.\n * @default \"clear\"\n */\n selectionUpdateMode?: 'preserve' | 'clear';\n /**\n * Enables optimistic UI actions;\n * Identifier that maps to a custom optimistic actions provided via overrides.\n */\n optimisticActions?: {\n id: string;\n };\n /**\n * Pagination strategy:\n * - 'cursor': `find()` must return { items, cursor, total? }\n * - 'offset': `find()` must return { items, hasNext, total? }\n * @default \"offset\"\n */\n paginationMode?: 'cursor' | 'offset';\n};\n\nexport interface BaseCollectionComponentConfig {\n /**\n * Collection data configuration and behavior.\n */\n collection: CollectionConfig;\n /**\n * Entity page to navigate to (by page id) when interacting with rows (e.g. onRowClick/update).\n */\n entityPageId?: string;\n /**\n * Search configuration.\n */\n search?: {\n /**\n * Whether to show the search input.\n * @default true\n */\n shown?: boolean;\n };\n /**\n * Toolbar title configuration.\n */\n toolbarTitle?: ToolbarTitle;\n /**\n * Action cell configuration per row.\n */\n actionCell?: ActionCellConfig;\n /**\n * Empty state configuration.\n */\n emptyState?: EmptyState;\n /**\n * Filters configuration.\n */\n filters?: FiltersConfig;\n /**\n * Bulk action toolbar configuration.\n */\n bulkActionToolbar?: BulkActionsConfig;\n}\n\nexport interface ToolbarTitle {\n /**\n * Title text.\n */\n title: string;\n /**\n * Subtitle configuration.\n */\n subtitle?: {\n /**\n * Subtitle text.\n */\n text: string;\n /**\n * Info tooltip content with an optional link.\n */\n info?: {\n content: {\n text: string;\n link?: {\n url: string;\n label: string;\n };\n };\n };\n /**\n * \"Learn more\" link.\n */\n learnMore?: {\n /**\n * Where the link should navigate to.\n */\n url: string;\n /**\n * The label of the link button.\n */\n label?: string;\n };\n };\n /**\n * Show total items on the toolbar.\n * @default false\n */\n showTotal?: boolean;\n /**\n * Limit displayed item count in the toolbar.\n */\n itemsLimit?: number;\n}\n\nexport interface Column {\n /**\n * FieldId to bind the column to.\n */\n id: string;\n /**\n * Column header text.\n */\n name: string;\n /**\n * CSS width value (e.g. '120px', '20%').\n */\n width: string;\n /**\n * Whether the column supports sorting.\n */\n sortable?: boolean;\n /**\n * Initial sort order when the page loads.\n */\n defaultSortOrder?: 'asc' | 'desc';\n /**\n * Current sort mode selected in UI.\n */\n sortMode?: 'asc' | 'desc';\n /**\n * Hide column by default in the custom columns panel.\n * When true, the column will not be shown initially and must be enabled by the user via the customize columns UI.\n */\n defaultHidden?: boolean;\n /**\n * Exclude from the \"customize columns\" selection UI.\n */\n hiddenFromCustomColumnsSelection?: boolean;\n /**\n * Controls whether the \"hide/show\" checkbox for this column is enabled in the custom columns panel.\n * If set to false, the checkbox will be disabled and the user cannot toggle visibility for this column.\n */\n hideable?: boolean;\n /**\n * Prevent column reordering in the customization UI.\n */\n reorderDisabled?: boolean;\n /**\n * Tooltip content to display when hovering over the info icon in the column header.\n */\n tooltipContent?: string;\n}\n\nexport interface GridItem {\n /**\n * FieldId to use as the card title.\n */\n titleFieldId: string;\n /**\n * FieldId to use as the card subtitle.\n */\n subtitleFieldId?: string;\n /**\n * FieldId to use as the card image.\n */\n imageFieldId?: string;\n /**\n * Controls which content is shown in the card (preset):\n * - 'full': shows title and subtitle.\n * - 'title': shows only the title.\n * - 'empty': hides both title and subtitle.\n */\n cardContentMode?: 'full' | 'title' | 'empty'; // Footer is not supported in auto-patterns\n /**\n * Position of the image inside the card layout.\n */\n imagePlacement?: 'top' | 'side';\n}\n\nexport interface EmptyState {\n /**\n * Empty state title.\n */\n title?: string;\n /**\n * Empty state subtitle.\n */\n subtitle?: string;\n /**\n * Image to display in the empty state.\n */\n image?: {\n id: string;\n };\n /**\n * \"Add new\" call-to-action button.\n */\n addNewCta?: {\n id?: string;\n text?: string;\n };\n /**\n * Custom CTA slot (advanced).\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';\n\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[];\n\nexport interface FiltersConfig {\n /**\n * Filter items to display.\n */\n items: FilterItems;\n /**\n * Maximum number of filters shown inline before moving to the panel.\n * @default 0 (all in panel).\n */\n maxInlineFilters?: CollectionToolbarFiltersProps['inline'];\n /**\n * Title for the filter panel drawer.\n */\n panelTitle?: string;\n}\n\nexport interface BaseOptionsFilterConfig {\n /**\n * Selection behavior: single choice or multiple choices.\n */\n selectionMode: FilterSelectionMode;\n}\n\nexport interface DateFilterConfig {\n /**\n * Controls behavior: presets only, custom only, or both.\n */\n mode?: DateRangeFilterMode;\n /**\n * Which preset ranges to display (only if mode supports presets).\n */\n presets?: DateRangeOptions;\n /**\n * Whether to include time selection.\n * @default true\n */\n includeTime?: boolean;\n}\n\nexport interface NumberFilterConfig {\n /**\n * Minimum allowed value.\n */\n min?: number;\n /**\n * Maximum allowed value.\n */\n max?: number;\n /**\n * Whether decimal values are allowed.\n */\n allowedDecimals?: boolean;\n}\n\nexport interface BooleanFilterConfig {\n /**\n * Label for the \"true\" option.\n */\n trueLabel?: string;\n /**\n * Label for the \"false\" option.\n */\n falseLabel?: string;\n}\n\nexport interface EnumFilterConfig extends BaseOptionsFilterConfig {\n /**\n * List of available options.\n */\n options: FilterOption[];\n /**\n * Rendering control for option appearance.\n */\n optionType?: FilterOptionType;\n}\n\nexport interface DynamicOptionsFilterConfig extends BaseOptionsFilterConfig {}\n\nexport interface Filter {\n /**\n * Filter unique identifier.\n */\n id: string;\n /**\n * Target field id this filter controls.\n */\n fieldId: string;\n /**\n * Optional filter display name (defaults to field name).\n */\n displayName?: string;\n /**\n * Optional grouping label. Filters with the same `sectionTitle` are grouped together.\n */\n sectionTitle?: string;\n /**\n * Whether the filter item is expanded by default in the panel.\n */\n openByDefault?: boolean;\n /**\n * Label shown in the table/grid tag when the filter is active.\n */\n tagLabel?: string;\n /**\n * Configuration for number inputs (NUMBER fields).\n */\n numberConfig?: NumberFilterConfig;\n /**\n * Configuration for date inputs (DATETIME fields).\n */\n dateConfig?: DateFilterConfig;\n /**\n * Configuration for boolean input labels (BOOLEAN fields).\n */\n booleanConfig?: BooleanFilterConfig;\n /**\n * Configuration for enum inputs (ARRAY/ARRAY_STRING fields).\n */\n enumConfig?: EnumFilterConfig;\n /**\n * Dynamic options configuration (advanced).\n */\n dynamicOptionsConfig?: DynamicOptionsFilterConfig;\n}\n"],"mappings":"AAyaA,WAAYA,iBAAiB,0BAAjBA,iBAAiB;EAAjBA,iBAAiB;EAAjBA,iBAAiB;EAAjBA,iBAAiB;EAAjBA,iBAAiB;EAAjBA,iBAAiB;EAAA,OAAjBA,iBAAiB;AAAA","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BulkDeleteModal.d.ts","sourceRoot":"","sources":["../../../../../src/components/modals/actions/BulkDeleteModal.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,uBAAuB,EAAE,qBAAqB,EAAE,MAAM,gBAAgB,CAAC;AAChF,OAAO,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAE3C,MAAM,WAAW,oBAAqB,SAAQ,gBAAgB;IAC5D,WAAW,EAAE,qBAAqB,CAAC;IACnC,YAAY,EAAE,uBAAuB,CAAC;CACvC;AAED,eAAO,MAAM,eAAe,GAAI,qCAI7B,oBAAoB,
|
|
1
|
+
{"version":3,"file":"BulkDeleteModal.d.ts","sourceRoot":"","sources":["../../../../../src/components/modals/actions/BulkDeleteModal.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,uBAAuB,EAAE,qBAAqB,EAAE,MAAM,gBAAgB,CAAC;AAChF,OAAO,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAE3C,MAAM,WAAW,oBAAqB,SAAQ,gBAAgB;IAC5D,WAAW,EAAE,qBAAqB,CAAC;IACnC,YAAY,EAAE,uBAAuB,CAAC;CACvC;AAED,eAAO,MAAM,eAAe,GAAI,qCAI7B,oBAAoB,sBAsDtB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useColumns.d.ts","sourceRoot":"","sources":["../../../src/hooks/useColumns.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAM5C,OAAO,EAAE,MAAM,EAAS,MAAM,UAAU,CAAC;AAKzC,eAAO,MAAM,UAAU,GAAI,SAAS,MAAM,EAAE,
|
|
1
|
+
{"version":3,"file":"useColumns.d.ts","sourceRoot":"","sources":["../../../src/hooks/useColumns.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAM5C,OAAO,EAAE,MAAM,EAAS,MAAM,UAAU,CAAC;AAKzC,eAAO,MAAM,UAAU,GAAI,SAAS,MAAM,EAAE,KA4HpB,WAAW,CAAC,GAAG,CAAC,EACvC,CAAC"}
|
|
@@ -320,6 +320,10 @@ export interface Column {
|
|
|
320
320
|
* Prevent column reordering in the customization UI.
|
|
321
321
|
*/
|
|
322
322
|
reorderDisabled?: boolean;
|
|
323
|
+
/**
|
|
324
|
+
* Tooltip content to display when hovering over the info icon in the column header.
|
|
325
|
+
*/
|
|
326
|
+
tooltipContent?: string;
|
|
323
327
|
}
|
|
324
328
|
export interface GridItem {
|
|
325
329
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CollectionPageConfig.d.ts","sourceRoot":"","sources":["../../../src/types/CollectionPageConfig.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,6BAA6B,EAAE,MAAM,eAAe,CAAC;AAC9D,OAAO,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAC3E,OAAO,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAA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CAAC;IACd;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;OAEG;IACH,gBAAgB,CAAC,EAAE,KAAK,GAAG,MAAM,CAAC;IAClC;;OAEG;IACH,QAAQ,CAAC,EAAE,KAAK,GAAG,MAAM,CAAC;IAC1B;;;OAGG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB;;OAEG;IACH,gCAAgC,CAAC,EAAE,OAAO,CAAC;IAC3C;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;OAEG;IACH,eAAe,CAAC,EAAE,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"CollectionPageConfig.d.ts","sourceRoot":"","sources":["../../../src/types/CollectionPageConfig.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,6BAA6B,EAAE,MAAM,eAAe,CAAC;AAC9D,OAAO,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAC3E,OAAO,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AAC/C,OAAO,EACL,gBAAgB,EAChB,iBAAiB,EACjB,oCAAoC,EACpC,4BAA4B,EAC5B,8BAA8B,EAC/B,MAAM,WAAW,CAAC;AAEnB,MAAM,WAAW,mBAAmB;IAClC;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IACb;;OAEG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAED,MAAM,WAAW,sBAAsB;IACrC;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IACb;;OAEG;IACH,SAAS,CAAC,EAAE;QACV;;WAEG;QACH,GAAG,EAAE,MAAM,CAAC;QACZ;;WAEG;QACH,KAAK,CAAC,EAAE,MAAM,CAAC;KAChB,CAAC;CACH;AAED,MAAM,WAAW,oBAAoB;IACnC;;OAEG;IACH,KAAK,EAAE;QACL;;WAEG;QACH,IAAI,EAAE,MAAM,CAAC;KACd,CAAC;IACF;;OAEG;IACH,KAAK,EAAE,mBAAmB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C;CACnD"}
|
package/docs/GETTING_STARTED.md
CHANGED
|
@@ -96,3 +96,96 @@ const MyPage = () => {
|
|
|
96
96
|
|
|
97
97
|
export default MyPage;
|
|
98
98
|
```
|
|
99
|
+
|
|
100
|
+
## Handling Errors
|
|
101
|
+
|
|
102
|
+
When implementing custom actions or data sources that make HTTP requests, proper error handling is crucial for a good user experience. Auto Patterns provides built-in error handling, but you need to follow specific patterns when making HTTP requests.
|
|
103
|
+
|
|
104
|
+
### When Error Handling is Required
|
|
105
|
+
|
|
106
|
+
**You MUST wrap these HTTP requests with `errorHandler.withErrorHandler`:**
|
|
107
|
+
|
|
108
|
+
- **httpClient from @wix/essentials** (e.g., `httpClient.request(getDummyEntity(...))`)
|
|
109
|
+
- **Wix APIs** (e.g., `wix/data`, `wix/stores`, `items.get()`, `items.insert()`)
|
|
110
|
+
- **httpClient.fetchWithAuth()** calls
|
|
111
|
+
|
|
112
|
+
**You should NOT wrap these with errorHandler:**
|
|
113
|
+
|
|
114
|
+
- **External API calls** using `fetch()`, `axios.get()`, or other HTTP libraries
|
|
115
|
+
- **SDK actions** from AutoPatterns (e.g., `sdk.getOptimisticActions()`, `sdk.getSchema()`)
|
|
116
|
+
- **Schema actions** from AutoPatterns (e.g., `schema.actions.bulkDelete`, `schema.actions.update`, `schema.actions.create`)
|
|
117
|
+
|
|
118
|
+
### Installation
|
|
119
|
+
|
|
120
|
+
First, ensure `@wix/essentials` is installed:
|
|
121
|
+
|
|
122
|
+
```bash
|
|
123
|
+
npm install @wix/essentials
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
### Example: Custom Action with Error Handling
|
|
127
|
+
|
|
128
|
+
```typescript
|
|
129
|
+
import { errorHandler, httpClient } from '@wix/essentials';
|
|
130
|
+
import { CustomActionCellActionResolver } from '@wix/auto-patterns';
|
|
131
|
+
import { getItem } from 'wix/stores';
|
|
132
|
+
|
|
133
|
+
export const updateProductStatus: CustomActionCellActionResolver = (params) => {
|
|
134
|
+
const { actionParams, sdk } = params;
|
|
135
|
+
const { item } = actionParams;
|
|
136
|
+
|
|
137
|
+
return {
|
|
138
|
+
label: 'Update Status',
|
|
139
|
+
icon: <UpdateIcon />,
|
|
140
|
+
onClick: () => {
|
|
141
|
+
// ✅ CORRECT: Wix API call wrapped with errorHandler
|
|
142
|
+
errorHandler.withErrorHandler(
|
|
143
|
+
async () => {
|
|
144
|
+
const response = await httpClient.request(
|
|
145
|
+
getItem({ itemId: item._id })
|
|
146
|
+
);
|
|
147
|
+
return response.data;
|
|
148
|
+
},
|
|
149
|
+
{
|
|
150
|
+
// Custom error handling for specific error codes
|
|
151
|
+
'ITEM_NOT_FOUND': {
|
|
152
|
+
message: 'This product no longer exists',
|
|
153
|
+
action: { text: 'Refresh', onClick: () => window.location.reload() }
|
|
154
|
+
},
|
|
155
|
+
'INSUFFICIENT_PERMISSIONS': {
|
|
156
|
+
message: 'You don\'t have permission to view this product',
|
|
157
|
+
action: { text: 'Contact Admin', onClick: () => window.open('mailto:admin@example.com') }
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
).catch((error) => {
|
|
161
|
+
// Handle any additional logic after error display
|
|
162
|
+
console.error('Failed to update product status:', error);
|
|
163
|
+
});
|
|
164
|
+
},
|
|
165
|
+
};
|
|
166
|
+
};
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
### Example: External API Call (No Error Handler Needed)
|
|
170
|
+
|
|
171
|
+
```typescript
|
|
172
|
+
export const sendToExternalService: CustomActionCellActionResolver = (params) => {
|
|
173
|
+
const { actionParams, sdk } = params;
|
|
174
|
+
const { item } = actionParams;
|
|
175
|
+
|
|
176
|
+
return {
|
|
177
|
+
label: 'Send to External Service',
|
|
178
|
+
icon: <SendIcon />,
|
|
179
|
+
onClick: () => {
|
|
180
|
+
fetch('https://api.external-service.com/send', {
|
|
181
|
+
method: 'POST',
|
|
182
|
+
body: JSON.stringify({ data: item }),
|
|
183
|
+
headers: { 'Content-Type': 'application/json' }
|
|
184
|
+
});
|
|
185
|
+
},
|
|
186
|
+
};
|
|
187
|
+
};
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
For more information about error handling, see the [Wix Error Handler documentation](https://dev.wix.com/docs/sdk/core-modules/essentials/error-handler).
|
|
191
|
+
|
|
@@ -304,6 +304,7 @@ export interface AppConfig {
|
|
|
304
304
|
hideable?: boolean; // Whether column can be hidden
|
|
305
305
|
defaultHidden?: boolean; // Whether column is hidden by default
|
|
306
306
|
hiddenFromCustomColumnsSelection?: boolean; // Whether column is hidden from custom columns selection
|
|
307
|
+
tooltipContent?: string; // Tooltip content to display when hovering over the info icon in the column header
|
|
307
308
|
}[];
|
|
308
309
|
customColumns?: {
|
|
309
310
|
enabled: boolean; // Enable user customization (hide/reorder columns)
|
|
@@ -382,6 +382,7 @@ export interface AppConfig {
|
|
|
382
382
|
hideable?: boolean; // Whether column can be hidden
|
|
383
383
|
defaultHidden?: boolean; // Whether column is hidden by default
|
|
384
384
|
hiddenFromCustomColumnsSelection?: boolean; // Whether column is hidden from custom columns selection
|
|
385
|
+
tooltipContent?: string; // Tooltip content to display when hovering over the info icon in the column header
|
|
385
386
|
}[];
|
|
386
387
|
customColumns?: {
|
|
387
388
|
enabled: boolean; // Enable user customization (hide/reorder columns)
|
|
@@ -771,6 +772,40 @@ The `layout` array contains the rendering components for the collection. Each la
|
|
|
771
772
|
* If the user does not specify, **select the most relevant fields automatically**.
|
|
772
773
|
* For grid components, it is strongly recommended to implement a primary action cell with an `update` action that navigates to the entity page. This provides users with an intuitive way to access detailed information and edit individual entities directly from the grid view.
|
|
773
774
|
|
|
775
|
+
## Column Tooltips
|
|
776
|
+
|
|
777
|
+
Add tooltips to column headers using the `tooltipContent` property. When provided, an info icon appears next to the column header that users can hover over to see the tooltip content.
|
|
778
|
+
|
|
779
|
+
Use tooltips to provide:
|
|
780
|
+
- **Explanations** - Help users understand what the column represents
|
|
781
|
+
- **Tools** - Provide guidance on how to use or interpret the column data
|
|
782
|
+
- **Additional information** - Offer context about the column's purpose, data format, or usage
|
|
783
|
+
|
|
784
|
+
```json
|
|
785
|
+
{
|
|
786
|
+
"columns": [
|
|
787
|
+
{
|
|
788
|
+
"id": "name",
|
|
789
|
+
"name": "Name",
|
|
790
|
+
"width": "200px",
|
|
791
|
+
"tooltipContent": "The name of the pet"
|
|
792
|
+
},
|
|
793
|
+
{
|
|
794
|
+
"id": "age",
|
|
795
|
+
"name": "Age",
|
|
796
|
+
"width": "100px",
|
|
797
|
+
"tooltipContent": "Age in years. Use this to filter pets by age range."
|
|
798
|
+
},
|
|
799
|
+
{
|
|
800
|
+
"id": "lastVisit",
|
|
801
|
+
"name": "Last Visit",
|
|
802
|
+
"width": "150px",
|
|
803
|
+
"tooltipContent": "Date of the pet's last veterinary visit. Click to sort by most recent visits."
|
|
804
|
+
}
|
|
805
|
+
]
|
|
806
|
+
}
|
|
807
|
+
```
|
|
808
|
+
|
|
774
809
|
---
|
|
775
810
|
|
|
776
811
|
# Collection Page Actions
|
|
@@ -52,3 +52,37 @@ The `layout` array contains the rendering components for the collection. Each la
|
|
|
52
52
|
* `item.title`, `item.subtitle`, `item.image` fields are **Field IDs** from the schema.
|
|
53
53
|
* If the user does not specify, **select the most relevant fields automatically**.
|
|
54
54
|
* For grid components, it is strongly recommended to implement a primary action cell with an `update` action that navigates to the entity page. This provides users with an intuitive way to access detailed information and edit individual entities directly from the grid view.
|
|
55
|
+
|
|
56
|
+
## Column Tooltips
|
|
57
|
+
|
|
58
|
+
Add tooltips to column headers using the `tooltipContent` property. When provided, an info icon appears next to the column header that users can hover over to see the tooltip content.
|
|
59
|
+
|
|
60
|
+
Use tooltips to provide:
|
|
61
|
+
- **Explanations** - Help users understand what the column represents
|
|
62
|
+
- **Tools** - Provide guidance on how to use or interpret the column data
|
|
63
|
+
- **Additional information** - Offer context about the column's purpose, data format, or usage
|
|
64
|
+
|
|
65
|
+
```json
|
|
66
|
+
{
|
|
67
|
+
"columns": [
|
|
68
|
+
{
|
|
69
|
+
"id": "name",
|
|
70
|
+
"name": "Name",
|
|
71
|
+
"width": "200px",
|
|
72
|
+
"tooltipContent": "The name of the pet"
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
"id": "age",
|
|
76
|
+
"name": "Age",
|
|
77
|
+
"width": "100px",
|
|
78
|
+
"tooltipContent": "Age in years. Use this to filter pets by age range."
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
"id": "lastVisit",
|
|
82
|
+
"name": "Last Visit",
|
|
83
|
+
"width": "150px",
|
|
84
|
+
"tooltipContent": "Date of the pet's last veterinary visit. Click to sort by most recent visits."
|
|
85
|
+
}
|
|
86
|
+
]
|
|
87
|
+
}
|
|
88
|
+
```
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wix/auto-patterns",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.37.0",
|
|
4
4
|
"license": "UNLICENSED",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Matvey Oklander",
|
|
@@ -125,5 +125,5 @@
|
|
|
125
125
|
"wallaby": {
|
|
126
126
|
"autoDetect": true
|
|
127
127
|
},
|
|
128
|
-
"falconPackageHash": "
|
|
128
|
+
"falconPackageHash": "12b7738cf82cb4287ef766b8803a032af10223745f185ead7da74ffa"
|
|
129
129
|
}
|