@wix/auto-patterns 1.11.0 → 1.13.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (86) hide show
  1. package/dist/cjs/components/AutoPatternsCollectionPageContent/AutoPatternsCollectionPageContent.js +57 -53
  2. package/dist/cjs/components/AutoPatternsCollectionPageContent/AutoPatternsCollectionPageContent.js.map +1 -1
  3. package/dist/cjs/components/AutoPatternsEntityPage/AutoPatternsEntityPage.js +38 -21
  4. package/dist/cjs/components/AutoPatternsEntityPage/AutoPatternsEntityPage.js.map +1 -1
  5. package/dist/cjs/hooks/useActionCell.js +3 -20
  6. package/dist/cjs/hooks/useActionCell.js.map +1 -1
  7. package/dist/cjs/hooks/useCommonCollectionFeatures.js +6 -10
  8. package/dist/cjs/hooks/useCommonCollectionFeatures.js.map +1 -1
  9. package/dist/cjs/hooks/useEntityPageMoreActions.js +46 -0
  10. package/dist/cjs/hooks/useEntityPageMoreActions.js.map +1 -0
  11. package/dist/cjs/hooks/useGridFeatures.js +8 -12
  12. package/dist/cjs/hooks/useGridFeatures.js.map +1 -1
  13. package/dist/cjs/hooks/useTableFeatures.js +6 -6
  14. package/dist/cjs/hooks/useTableFeatures.js.map +1 -1
  15. package/dist/cjs/hooks/useTableGridSwitchFeatures.js +7 -6
  16. package/dist/cjs/hooks/useTableGridSwitchFeatures.js.map +1 -1
  17. package/dist/cjs/providers/PatternsWizardOverridesContext.js +1 -1
  18. package/dist/cjs/providers/PatternsWizardOverridesContext.js.map +1 -1
  19. package/dist/cjs/types/CollectionPageConfig.js.map +1 -1
  20. package/dist/cjs/types/EntityPageConfig.js.map +1 -1
  21. package/dist/cjs/types/actions/actionCell.js.map +1 -1
  22. package/dist/cjs/types/actions/collectionPageActions.js.map +1 -1
  23. package/dist/cjs/types/actions/entityPageActions.js +4 -0
  24. package/dist/cjs/types/actions/entityPageActions.js.map +1 -0
  25. package/dist/cjs/types/actions/index.js +6 -0
  26. package/dist/cjs/types/actions/index.js.map +1 -1
  27. package/dist/cjs/utils/actions/customAction.js.map +1 -1
  28. package/dist/cjs/utils/actions/types.js.map +1 -1
  29. package/dist/esm/components/AutoPatternsCollectionPageContent/AutoPatternsCollectionPageContent.js +40 -36
  30. package/dist/esm/components/AutoPatternsCollectionPageContent/AutoPatternsCollectionPageContent.js.map +1 -1
  31. package/dist/esm/components/AutoPatternsEntityPage/AutoPatternsEntityPage.js +14 -3
  32. package/dist/esm/components/AutoPatternsEntityPage/AutoPatternsEntityPage.js.map +1 -1
  33. package/dist/esm/hooks/useActionCell.js +3 -20
  34. package/dist/esm/hooks/useActionCell.js.map +1 -1
  35. package/dist/esm/hooks/useCommonCollectionFeatures.js +2 -6
  36. package/dist/esm/hooks/useCommonCollectionFeatures.js.map +1 -1
  37. package/dist/esm/hooks/useEntityPageMoreActions.js +42 -0
  38. package/dist/esm/hooks/useEntityPageMoreActions.js.map +1 -0
  39. package/dist/esm/hooks/useGridFeatures.js +8 -12
  40. package/dist/esm/hooks/useGridFeatures.js.map +1 -1
  41. package/dist/esm/hooks/useTableFeatures.js +6 -6
  42. package/dist/esm/hooks/useTableFeatures.js.map +1 -1
  43. package/dist/esm/hooks/useTableGridSwitchFeatures.js +7 -6
  44. package/dist/esm/hooks/useTableGridSwitchFeatures.js.map +1 -1
  45. package/dist/esm/providers/PatternsWizardOverridesContext.js.map +1 -1
  46. package/dist/esm/types/CollectionPageConfig.js.map +1 -1
  47. package/dist/esm/types/EntityPageConfig.js.map +1 -1
  48. package/dist/esm/types/actions/actionCell.js.map +1 -1
  49. package/dist/esm/types/actions/collectionPageActions.js.map +1 -1
  50. package/dist/esm/types/actions/entityPageActions.js +2 -0
  51. package/dist/esm/types/actions/entityPageActions.js.map +1 -0
  52. package/dist/esm/types/actions/index.js +1 -0
  53. package/dist/esm/types/actions/index.js.map +1 -1
  54. package/dist/esm/utils/actions/customAction.js.map +1 -1
  55. package/dist/esm/utils/actions/types.js.map +1 -1
  56. package/dist/types/components/AutoPatternsCollectionPageContent/AutoPatternsCollectionPageContent.d.ts.map +1 -1
  57. package/dist/types/components/AutoPatternsEntityPage/AutoPatternsEntityPage.d.ts.map +1 -1
  58. package/dist/types/hooks/useActionCell.d.ts +2 -4
  59. package/dist/types/hooks/useActionCell.d.ts.map +1 -1
  60. package/dist/types/hooks/useCommonCollectionFeatures.d.ts +2 -3
  61. package/dist/types/hooks/useCommonCollectionFeatures.d.ts.map +1 -1
  62. package/dist/types/hooks/useEntityPageHeaderTexts.d.ts.map +1 -1
  63. package/dist/types/hooks/useEntityPageMoreActions.d.ts +6 -0
  64. package/dist/types/hooks/useEntityPageMoreActions.d.ts.map +1 -0
  65. package/dist/types/hooks/useGridFeatures.d.ts.map +1 -1
  66. package/dist/types/hooks/useTableGridSwitchFeatures.d.ts +1 -0
  67. package/dist/types/hooks/useTableGridSwitchFeatures.d.ts.map +1 -1
  68. package/dist/types/providers/PatternsWizardOverridesContext.d.ts +4 -2
  69. package/dist/types/providers/PatternsWizardOverridesContext.d.ts.map +1 -1
  70. package/dist/types/types/CollectionPageConfig.d.ts +42 -32
  71. package/dist/types/types/CollectionPageConfig.d.ts.map +1 -1
  72. package/dist/types/types/EntityPageConfig.d.ts +2 -0
  73. package/dist/types/types/EntityPageConfig.d.ts.map +1 -1
  74. package/dist/types/types/actions/actionCell.d.ts +2 -4
  75. package/dist/types/types/actions/actionCell.d.ts.map +1 -1
  76. package/dist/types/types/actions/collectionPageActions.d.ts +2 -4
  77. package/dist/types/types/actions/collectionPageActions.d.ts.map +1 -1
  78. package/dist/types/types/actions/entityPageActions.d.ts +12 -0
  79. package/dist/types/types/actions/entityPageActions.d.ts.map +1 -0
  80. package/dist/types/types/actions/index.d.ts +1 -0
  81. package/dist/types/types/actions/index.d.ts.map +1 -1
  82. package/dist/types/utils/actions/customAction.d.ts +1 -1
  83. package/dist/types/utils/actions/customAction.d.ts.map +1 -1
  84. package/dist/types/utils/actions/types.d.ts +3 -3
  85. package/dist/types/utils/actions/types.d.ts.map +1 -1
  86. package/package.json +17 -17
@@ -1,5 +1,5 @@
1
1
  import React, { useMemo, useRef } from 'react';
2
- import { EntityPage, useEntity, useEntityPage, useEntityPageContext } from '@wix/patterns';
2
+ import { EntityPage, useEntity, useEntityPage, useEntityPageContext, MoreActions } from '@wix/patterns';
3
3
  import { useForm } from '@wix/patterns/form';
4
4
  import { Card, Cell, Layout } from '@wix/design-system';
5
5
  import { useParams } from 'react-router-dom';
@@ -7,6 +7,8 @@ import { useSchema } from '../../providers/SchemaContext';
7
7
  import { FormFieldInput } from './Fields/FormFieldInput';
8
8
  import { useEntityPageHeaderTexts, useNavigation } from '../../hooks';
9
9
  import { usePatternsWizardOverridesContext } from '../../providers';
10
+ import { useEntityPageMoreActions } from '../../hooks/useEntityPageMoreActions';
11
+ import { useActionsSDK } from '../../hooks/useActionsSDK';
10
12
  const RenderLayoutContent = _ref => {
11
13
  var _content$container$ch, _overrides$components;
12
14
  let {
@@ -105,7 +107,9 @@ export const AutoPatternsEntityPage = _ref3 => {
105
107
  const {
106
108
  layout: pageLayout,
107
109
  parentPageId,
108
- route
110
+ route,
111
+ moreActions,
112
+ collectionId
109
113
  } = configuration;
110
114
  const form = useForm({
111
115
  mode: 'onChange'
@@ -170,12 +174,19 @@ export const AutoPatternsEntityPage = _ref3 => {
170
174
  isCreateMode,
171
175
  entityDisplayName: entity == null ? void 0 : entity[schema.displayField]
172
176
  });
177
+ const sdk = useActionsSDK({
178
+ collectionId
179
+ });
180
+ const resolvedMoreActions = useEntityPageMoreActions(moreActions, entity, sdk, form);
173
181
  return /*#__PURE__*/React.createElement(EntityPage, {
174
182
  state: state,
175
183
  dataHook: "auto-patterns-entity-page"
176
184
  }, /*#__PURE__*/React.createElement(EntityPage.Header, {
177
185
  title: title,
178
- subtitle: subtitle
186
+ subtitle: subtitle,
187
+ moreActions: resolvedMoreActions.length > 0 ? /*#__PURE__*/React.createElement(MoreActions, {
188
+ items: resolvedMoreActions
189
+ }) : undefined
179
190
  }), /*#__PURE__*/React.createElement(EntityPage.Content, null, /*#__PURE__*/React.createElement(EntityPage.MainContent, null, pageLayout == null || (_pageLayout$main = pageLayout.main) == null ? void 0 : _pageLayout$main.map((layout, layoutIndex) => /*#__PURE__*/React.createElement(RenderLayoutCard, {
180
191
  key: `main-section-card-${layoutIndex}`,
181
192
  layout: layout,
@@ -1 +1 @@
1
- {"version":3,"names":["React","useMemo","useRef","EntityPage","useEntity","useEntityPage","useEntityPageContext","useForm","Card","Cell","Layout","useParams","useSchema","FormFieldInput","useEntityPageHeaderTexts","useNavigation","usePatternsWizardOverridesContext","RenderLayoutContent","_ref","_content$container$ch","_overrides$components","content","level","sectionId","cardIndex","contentIndex","setInputRef","schema","overrides","pageState","type","field","fieldId","fields","createElement","span","key","inputRef","ref","container","children","length","map","child","index","component","componentId","Component","components","form","entity","RenderLayoutCard","_ref2","_layout$card$subtitle","layout","minHeight","Header","title","card","text","subtitle","Divider","Content","AutoPatternsEntityPage","_ref3","_pageLayout$main","_pageLayout$sidebar","configuration","pageLayout","parentPageId","route","mode","params","entityId","id","isCreateMode","inputRefs","input","current","validate","invalidFieldId","Object","keys","find","_inputRefs$current$fi","invalid","_inputRefs$current$in","focus","Error","getParentPagePath","parentPath","state","onSave","formValues","getValues","baseEntity","updatedEntity","newEntity","actions","update","create","fetch","undefined","get","config","entityDisplayName","displayField","dataHook","MainContent","main","layoutIndex","sidebar","AdditionalContent"],"sources":["../../../../src/components/AutoPatternsEntityPage/AutoPatternsEntityPage.tsx"],"sourcesContent":["import React, { useMemo, useRef } from 'react';\nimport { CardLayout, EntityPageConfig, LayoutContent } from '../../types';\nimport {\n EntityPage,\n EntityPageState,\n useEntity,\n useEntityPage,\n useEntityPageContext,\n} from '@wix/patterns';\nimport { useForm } from '@wix/patterns/form';\nimport { Card, Cell, Layout } from '@wix/design-system';\nimport { useParams } from 'react-router-dom';\nimport { useSchema } from '../../providers/SchemaContext';\nimport { BaseInputRef } from './Fields/types';\nimport { FormFieldInput } from './Fields/FormFieldInput';\nimport { useEntityPageHeaderTexts, useNavigation } from '../../hooks';\nimport { usePatternsWizardOverridesContext } from '../../providers';\n\nconst RenderLayoutContent: React.FC<{\n content: LayoutContent;\n level: number;\n sectionId: string;\n cardIndex: number;\n contentIndex: number;\n setInputRef: (id: string, input: BaseInputRef) => void;\n}> = ({ content, level, sectionId, cardIndex, contentIndex, setInputRef }) => {\n const schema = useSchema();\n const overrides = usePatternsWizardOverridesContext();\n const pageState = useEntityPageContext();\n\n switch (content.type) {\n case 'field':\n if (!content.field.fieldId) {\n return null;\n }\n\n const field = schema.fields[content.field.fieldId];\n\n if (!field) {\n return null;\n }\n\n return (\n <Cell span={content.field.span}>\n <FormFieldInput\n key={content.field.fieldId}\n field={field}\n inputRef={(ref) => setInputRef(content.field.fieldId, ref)}\n />\n </Cell>\n );\n\n case 'container':\n if (!content.container.children?.length) {\n return null;\n }\n\n return (\n <Cell span={content.container.span}>\n <Layout>\n {content.container.children.map((child, index) => (\n <RenderLayoutContent\n key={`${sectionId}-card-${cardIndex}-content-${contentIndex}-level-${level}-child-${index}`}\n content={child}\n level={level + 1}\n sectionId={sectionId}\n cardIndex={cardIndex}\n contentIndex={index}\n setInputRef={setInputRef}\n />\n ))}\n </Layout>\n </Cell>\n );\n\n case 'component':\n if (!content.component.componentId) {\n return null;\n }\n\n const Component = overrides?.components?.[content.component.componentId];\n\n if (!Component) {\n return null;\n }\n\n return (\n <Cell span={content.component.span}>\n <Component\n form={pageState.form as any}\n entity={pageState.entity as any as Record<string, any>}\n />\n </Cell>\n );\n\n default:\n return null;\n }\n};\n\nconst RenderLayoutCard: React.FC<{\n layout: CardLayout;\n sectionId: string;\n cardIndex: number;\n setInputRef: (id: string, input: BaseInputRef) => void;\n}> = ({ layout, sectionId, cardIndex, setInputRef }) => {\n switch (layout.type) {\n case 'card':\n return (\n <EntityPage.Card minHeight=\"50px\">\n <Card.Header\n title={layout.card.title.text}\n subtitle={layout.card.subtitle?.text}\n />\n <Card.Divider />\n <Card.Content>\n <Layout>\n {layout.card.children.map((child, index: number) => (\n <RenderLayoutContent\n key={`${sectionId}-card-${cardIndex}-content-${index}`}\n content={child}\n level={0}\n sectionId={sectionId}\n cardIndex={cardIndex}\n contentIndex={index}\n setInputRef={setInputRef}\n />\n ))}\n </Layout>\n </Card.Content>\n </EntityPage.Card>\n );\n default:\n return null;\n }\n};\n\nexport interface AutoPatternsEntityPageProps {\n configuration: EntityPageConfig;\n}\n\nexport const AutoPatternsEntityPage: React.FC<AutoPatternsEntityPageProps> = ({\n configuration,\n}) => {\n const { layout: pageLayout, parentPageId, route } = configuration;\n\n const form = useForm<any>({\n mode: 'onChange',\n });\n const params = useParams();\n const entityId = params[route.params.id];\n const schema = useSchema();\n const isCreateMode = !entityId;\n\n const inputRefs = useRef<{ [fieldId: string]: BaseInputRef }>({});\n\n const setInputRef = (id: string, input: BaseInputRef) => {\n inputRefs.current[id] = input;\n };\n\n const validate = () => {\n const invalidFieldId = Object.keys(inputRefs.current).find((fieldId) => {\n return inputRefs.current[fieldId]?.invalid;\n });\n\n if (invalidFieldId) {\n inputRefs.current[invalidFieldId]?.focus?.();\n throw new Error('Invalid form');\n }\n };\n const { getParentPagePath } = useNavigation();\n\n const parentPath = useMemo(\n () => getParentPagePath(parentPageId),\n [parentPageId, getParentPagePath],\n );\n\n const state: EntityPageState<any> = useEntityPage<any, any>({\n parentPath,\n form,\n onSave: async () => {\n validate();\n\n const formValues = form.getValues();\n const baseEntity = state.entity || {};\n const updatedEntity = {\n ...baseEntity,\n ...formValues,\n };\n\n const newEntity = entityId\n ? await schema.actions.update(updatedEntity)\n : await schema.actions.create(updatedEntity);\n\n return { updatedEntity: newEntity };\n },\n fetch: async () => {\n if (!entityId) {\n return { entity: undefined };\n }\n const entity = await schema.actions.get(entityId);\n return { entity };\n },\n });\n\n const entity = useEntity(state);\n\n const { title, subtitle } = useEntityPageHeaderTexts({\n config: configuration,\n isCreateMode,\n entityDisplayName: entity?.[schema.displayField],\n });\n\n return (\n <EntityPage state={state} dataHook=\"auto-patterns-entity-page\">\n <EntityPage.Header title={title} subtitle={subtitle} />\n <EntityPage.Content>\n <EntityPage.MainContent>\n {pageLayout?.main?.map((layout, layoutIndex) => (\n <RenderLayoutCard\n key={`main-section-card-${layoutIndex}`}\n layout={layout}\n sectionId=\"main\"\n cardIndex={layoutIndex}\n setInputRef={setInputRef}\n />\n ))}\n </EntityPage.MainContent>\n {pageLayout?.sidebar ? (\n <EntityPage.AdditionalContent>\n {pageLayout.sidebar?.map((layout, layoutIndex) => (\n <RenderLayoutCard\n key={`sidebar-section-card-${layoutIndex}`}\n layout={layout}\n sectionId=\"sidebar\"\n cardIndex={layoutIndex}\n setInputRef={setInputRef}\n />\n ))}\n </EntityPage.AdditionalContent>\n ) : null}\n </EntityPage.Content>\n </EntityPage>\n );\n};\n\n/*\n Key structure explanation:\n\n Main cards: main-section-card-{layoutIndex}\n Sidebar cards: sidebar-section-card-{layoutIndex}\n\n Layout content:\n {sectionId}-card-{cardIndex}-content-{contentIndex}\n\n Nested children:\n {sectionId}-card-{cardIndex}-content-{parentContentIndex}-level-{level}-child-{childIndex}\n\n This ensures uniqueness across all levels and sections.\n*/\n"],"mappings":"AAAA,OAAOA,KAAK,IAAIC,OAAO,EAAEC,MAAM,QAAQ,OAAO;AAE9C,SACEC,UAAU,EAEVC,SAAS,EACTC,aAAa,EACbC,oBAAoB,QACf,eAAe;AACtB,SAASC,OAAO,QAAQ,oBAAoB;AAC5C,SAASC,IAAI,EAAEC,IAAI,EAAEC,MAAM,QAAQ,oBAAoB;AACvD,SAASC,SAAS,QAAQ,kBAAkB;AAC5C,SAASC,SAAS,QAAQ,+BAA+B;AAEzD,SAASC,cAAc,QAAQ,yBAAyB;AACxD,SAASC,wBAAwB,EAAEC,aAAa,QAAQ,aAAa;AACrE,SAASC,iCAAiC,QAAQ,iBAAiB;AAEnE,MAAMC,mBAOJ,GAAGC,IAAA,IAAyE;EAAA,IAAAC,qBAAA,EAAAC,qBAAA;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AG,CAAC,CAACY,MAAM,EAAEwD,WAAW,kBACzC9G,KAAA,CAAAkC,aAAA,CAACiB,gBAAgB;IACff,GAAG,EAAE,qBAAqB0E,WAAW,EAAG;IACxCxD,MAAM,EAAEA,MAAO;IACf/B,SAAS,EAAC,MAAM;IAChBC,SAAS,EAAEsF,WAAY;IACvBpF,WAAW,EAAEA;EAAY,CAC1B,CACF,CACqB,CAAC,EACxB0C,UAAU,YAAVA,UAAU,CAAE2C,OAAO,gBAClB/G,KAAA,CAAAkC,aAAA,CAAC/B,UAAU,CAAC6G,iBAAiB,SAAA9C,mBAAA,GAC1BE,UAAU,CAAC2C,OAAO,qBAAlB7C,mBAAA,CAAoBxB,GAAG,CAAC,CAACY,MAAM,EAAEwD,WAAW,kBAC3C9G,KAAA,CAAAkC,aAAA,CAACiB,gBAAgB;IACff,GAAG,EAAE,wBAAwB0E,WAAW,EAAG;IAC3CxD,MAAM,EAAEA,MAAO;IACf/B,SAAS,EAAC,SAAS;IACnBC,SAAS,EAAEsF,WAAY;IACvBpF,WAAW,EAAEA;EAAY,CAC1B,CACF,CAC2B,CAAC,GAC7B,IACc,CACV,CAAC;AAEjB,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA","ignoreList":[]}
1
+ {"version":3,"names":["React","useMemo","useRef","EntityPage","useEntity","useEntityPage","useEntityPageContext","MoreActions","useForm","Card","Cell","Layout","useParams","useSchema","FormFieldInput","useEntityPageHeaderTexts","useNavigation","usePatternsWizardOverridesContext","useEntityPageMoreActions","useActionsSDK","RenderLayoutContent","_ref","_content$container$ch","_overrides$components","content","level","sectionId","cardIndex","contentIndex","setInputRef","schema","overrides","pageState","type","field","fieldId","fields","createElement","span","key","inputRef","ref","container","children","length","map","child","index","component","componentId","Component","components","form","entity","RenderLayoutCard","_ref2","_layout$card$subtitle","layout","minHeight","Header","title","card","text","subtitle","Divider","Content","AutoPatternsEntityPage","_ref3","_pageLayout$main","_pageLayout$sidebar","configuration","pageLayout","parentPageId","route","moreActions","collectionId","mode","params","entityId","id","isCreateMode","inputRefs","input","current","validate","invalidFieldId","Object","keys","find","_inputRefs$current$fi","invalid","_inputRefs$current$in","focus","Error","getParentPagePath","parentPath","state","onSave","formValues","getValues","baseEntity","updatedEntity","newEntity","actions","update","create","fetch","undefined","get","config","entityDisplayName","displayField","sdk","resolvedMoreActions","dataHook","items","MainContent","main","layoutIndex","sidebar","AdditionalContent"],"sources":["../../../../src/components/AutoPatternsEntityPage/AutoPatternsEntityPage.tsx"],"sourcesContent":["import React, { useMemo, useRef } from 'react';\nimport { CardLayout, EntityPageConfig, LayoutContent } from '../../types';\nimport {\n EntityPage,\n EntityPageState,\n useEntity,\n useEntityPage,\n useEntityPageContext,\n MoreActions,\n} from '@wix/patterns';\nimport { useForm } from '@wix/patterns/form';\nimport { Card, Cell, Layout } from '@wix/design-system';\nimport { useParams } from 'react-router-dom';\nimport { useSchema } from '../../providers/SchemaContext';\nimport { BaseInputRef } from './Fields/types';\nimport { FormFieldInput } from './Fields/FormFieldInput';\nimport { useEntityPageHeaderTexts, useNavigation } from '../../hooks';\nimport { usePatternsWizardOverridesContext } from '../../providers';\nimport { useEntityPageMoreActions } from '../../hooks/useEntityPageMoreActions';\nimport { useActionsSDK } from '../../hooks/useActionsSDK';\n\nconst RenderLayoutContent: React.FC<{\n content: LayoutContent;\n level: number;\n sectionId: string;\n cardIndex: number;\n contentIndex: number;\n setInputRef: (id: string, input: BaseInputRef) => void;\n}> = ({ content, level, sectionId, cardIndex, contentIndex, setInputRef }) => {\n const schema = useSchema();\n const overrides = usePatternsWizardOverridesContext();\n const pageState = useEntityPageContext();\n\n switch (content.type) {\n case 'field':\n if (!content.field.fieldId) {\n return null;\n }\n\n const field = schema.fields[content.field.fieldId];\n\n if (!field) {\n return null;\n }\n\n return (\n <Cell span={content.field.span}>\n <FormFieldInput\n key={content.field.fieldId}\n field={field}\n inputRef={(ref) => setInputRef(content.field.fieldId, ref)}\n />\n </Cell>\n );\n\n case 'container':\n if (!content.container.children?.length) {\n return null;\n }\n\n return (\n <Cell span={content.container.span}>\n <Layout>\n {content.container.children.map((child, index) => (\n <RenderLayoutContent\n key={`${sectionId}-card-${cardIndex}-content-${contentIndex}-level-${level}-child-${index}`}\n content={child}\n level={level + 1}\n sectionId={sectionId}\n cardIndex={cardIndex}\n contentIndex={index}\n setInputRef={setInputRef}\n />\n ))}\n </Layout>\n </Cell>\n );\n\n case 'component':\n if (!content.component.componentId) {\n return null;\n }\n\n const Component = overrides?.components?.[content.component.componentId];\n\n if (!Component) {\n return null;\n }\n\n return (\n <Cell span={content.component.span}>\n <Component\n form={pageState.form as any}\n entity={pageState.entity as any as Record<string, any>}\n />\n </Cell>\n );\n\n default:\n return null;\n }\n};\n\nconst RenderLayoutCard: React.FC<{\n layout: CardLayout;\n sectionId: string;\n cardIndex: number;\n setInputRef: (id: string, input: BaseInputRef) => void;\n}> = ({ layout, sectionId, cardIndex, setInputRef }) => {\n switch (layout.type) {\n case 'card':\n return (\n <EntityPage.Card minHeight=\"50px\">\n <Card.Header\n title={layout.card.title.text}\n subtitle={layout.card.subtitle?.text}\n />\n <Card.Divider />\n <Card.Content>\n <Layout>\n {layout.card.children.map((child, index: number) => (\n <RenderLayoutContent\n key={`${sectionId}-card-${cardIndex}-content-${index}`}\n content={child}\n level={0}\n sectionId={sectionId}\n cardIndex={cardIndex}\n contentIndex={index}\n setInputRef={setInputRef}\n />\n ))}\n </Layout>\n </Card.Content>\n </EntityPage.Card>\n );\n default:\n return null;\n }\n};\n\nexport interface AutoPatternsEntityPageProps {\n configuration: EntityPageConfig;\n}\n\nexport const AutoPatternsEntityPage: React.FC<AutoPatternsEntityPageProps> = ({\n configuration,\n}) => {\n const {\n layout: pageLayout,\n parentPageId,\n route,\n moreActions,\n collectionId,\n } = configuration;\n\n const form = useForm<any>({\n mode: 'onChange',\n });\n const params = useParams();\n const entityId = params[route.params.id];\n const schema = useSchema();\n const isCreateMode = !entityId;\n\n const inputRefs = useRef<{ [fieldId: string]: BaseInputRef }>({});\n\n const setInputRef = (id: string, input: BaseInputRef) => {\n inputRefs.current[id] = input;\n };\n\n const validate = () => {\n const invalidFieldId = Object.keys(inputRefs.current).find((fieldId) => {\n return inputRefs.current[fieldId]?.invalid;\n });\n\n if (invalidFieldId) {\n inputRefs.current[invalidFieldId]?.focus?.();\n throw new Error('Invalid form');\n }\n };\n const { getParentPagePath } = useNavigation();\n\n const parentPath = useMemo(\n () => getParentPagePath(parentPageId),\n [parentPageId, getParentPagePath],\n );\n\n const state: EntityPageState<any> = useEntityPage<any, any>({\n parentPath,\n form,\n onSave: async () => {\n validate();\n\n const formValues = form.getValues();\n const baseEntity = state.entity || {};\n const updatedEntity = {\n ...baseEntity,\n ...formValues,\n };\n\n const newEntity = entityId\n ? await schema.actions.update(updatedEntity)\n : await schema.actions.create(updatedEntity);\n\n return { updatedEntity: newEntity };\n },\n fetch: async () => {\n if (!entityId) {\n return { entity: undefined };\n }\n const entity = await schema.actions.get(entityId);\n return { entity };\n },\n });\n\n const entity = useEntity(state);\n\n const { title, subtitle } = useEntityPageHeaderTexts({\n config: configuration,\n isCreateMode,\n entityDisplayName: entity?.[schema.displayField],\n });\n\n const sdk = useActionsSDK({\n collectionId,\n });\n\n const resolvedMoreActions = useEntityPageMoreActions(\n moreActions,\n entity,\n sdk,\n form,\n );\n\n return (\n <EntityPage state={state} dataHook=\"auto-patterns-entity-page\">\n <EntityPage.Header\n title={title}\n subtitle={subtitle}\n moreActions={\n resolvedMoreActions.length > 0 ? (\n <MoreActions items={resolvedMoreActions} />\n ) : undefined\n }\n />\n <EntityPage.Content>\n <EntityPage.MainContent>\n {pageLayout?.main?.map((layout, layoutIndex) => (\n <RenderLayoutCard\n key={`main-section-card-${layoutIndex}`}\n layout={layout}\n sectionId=\"main\"\n cardIndex={layoutIndex}\n setInputRef={setInputRef}\n />\n ))}\n </EntityPage.MainContent>\n {pageLayout?.sidebar ? (\n <EntityPage.AdditionalContent>\n {pageLayout.sidebar?.map((layout, layoutIndex) => (\n <RenderLayoutCard\n key={`sidebar-section-card-${layoutIndex}`}\n layout={layout}\n sectionId=\"sidebar\"\n cardIndex={layoutIndex}\n setInputRef={setInputRef}\n />\n ))}\n </EntityPage.AdditionalContent>\n ) : null}\n </EntityPage.Content>\n </EntityPage>\n );\n};\n\n/*\n Key structure explanation:\n\n Main cards: main-section-card-{layoutIndex}\n Sidebar cards: sidebar-section-card-{layoutIndex}\n\n Layout content:\n {sectionId}-card-{cardIndex}-content-{contentIndex}\n\n Nested children:\n {sectionId}-card-{cardIndex}-content-{parentContentIndex}-level-{level}-child-{childIndex}\n\n This ensures uniqueness across all levels and sections.\n*/\n"],"mappings":"AAAA,OAAOA,KAAK,IAAIC,OAAO,EAAEC,MAAM,QAAQ,OAAO;AAE9C,SACEC,UAAU,EAEVC,SAAS,EACTC,aAAa,EACbC,oBAAoB,EACpBC,WAAW,QACN,eAAe;AACtB,SAASC,OAAO,QAAQ,oBAAoB;AAC5C,SAASC,IAAI,EAAEC,IAAI,EAAEC,MAAM,QAAQ,oBAAoB;AACvD,SAASC,SAAS,QAAQ,kBAAkB;AAC5C,SAASC,SAAS,QAAQ,+BAA+B;AAEzD,SAASC,cAAc,QAAQ,yBAAyB;AACxD,SAASC,wBAAwB,EAAEC,aAAa,QAAQ,aAAa;AACrE,SAASC,iCAAiC,QAAQ,iBAAiB;AACnE,SAASC,wBAAwB,QAAQ,sCAAsC;AAC/E,SAASC,aAAa,QAAQ,2BAA2B;AAEzD,MAAMC,mBAOJ,GAAGC,IAAA,IAAyE;EAAA,IAAAC,qBAAA,EAAAC,qBAAA;EAAA,IAAxE;IAAEC,OAAO;IAAEC,KAAK;IAAEC,SAAS;IAAEC,SAAS;IAAEC,YAAY;IAAEC;EAAY,CAAC,GAAAR,IAAA;EACvE,MAAMS,MAAM,GAAGjB,SAAS,CAAC,CAAC;EAC1B,MAAMkB,SAAS,GAAGd,iCAAiC,CAAC,CAAC;EACrD,M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C,aAAA,CAAClC,UAAU,CAACiH,WAAW,QACpB7C,UAAU,aAAAH,gBAAA,GAAVG,UAAU,CAAE8C,IAAI,qBAAhBjD,gBAAA,CAAkBvB,GAAG,CAAC,CAACY,MAAM,EAAE6D,WAAW,kBACzCtH,KAAA,CAAAqC,aAAA,CAACiB,gBAAgB;IACff,GAAG,EAAE,qBAAqB+E,WAAW,EAAG;IACxC7D,MAAM,EAAEA,MAAO;IACf/B,SAAS,EAAC,MAAM;IAChBC,SAAS,EAAE2F,WAAY;IACvBzF,WAAW,EAAEA;EAAY,CAC1B,CACF,CACqB,CAAC,EACxB0C,UAAU,YAAVA,UAAU,CAAEgD,OAAO,gBAClBvH,KAAA,CAAAqC,aAAA,CAAClC,UAAU,CAACqH,iBAAiB,SAAAnD,mBAAA,GAC1BE,UAAU,CAACgD,OAAO,qBAAlBlD,mBAAA,CAAoBxB,GAAG,CAAC,CAACY,MAAM,EAAE6D,WAAW,kBAC3CtH,KAAA,CAAAqC,aAAA,CAACiB,gBAAgB;IACff,GAAG,EAAE,wBAAwB+E,WAAW,EAAG;IAC3C7D,MAAM,EAAEA,MAAO;IACf/B,SAAS,EAAC,SAAS;IACnBC,SAAS,EAAE2F,WAAY;IACvBzF,WAAW,EAAEA;EAAY,CAC1B,CACF,CAC2B,CAAC,GAC7B,IACc,CACV,CAAC;AAEjB,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA","ignoreList":[]}
@@ -1,20 +1,11 @@
1
1
  import { useCallback } from 'react';
2
2
  import { useActionsSDK } from './useActionsSDK';
3
- import { useWixPatternsContainer, useSelector } from '@wix/patterns';
4
3
  import { updateAction, customModalAction, customAction, resolveAction, deleteAction } from '../utils/actions';
5
- import { useNavigation } from './useNavigationUtils';
6
4
  export const useActionCell = _ref => {
7
5
  let {
8
6
  config,
9
- collectionId,
10
- collectionType,
11
- entityPageId
7
+ collectionId
12
8
  } = _ref;
13
- const {
14
- navigateToEntityPage
15
- } = useNavigation();
16
- const container = useWixPatternsContainer();
17
- const editText = useSelector(() => container.translate('cairo.collectionsPage.edit.CTA'));
18
9
  const sdk = useActionsSDK({
19
10
  collectionId
20
11
  });
@@ -73,15 +64,7 @@ export const useActionCell = _ref => {
73
64
  disabledDescription: resolvedAction.tooltip
74
65
  };
75
66
  };
76
- const primaryAction = config != null && (_config$primaryAction = config.primaryAction) != null && _config$primaryAction.item ? buildAction(config.primaryAction.item) : collectionType === 'Grid' && entityPageId ? {
77
- text: editText,
78
- onClick: () => {
79
- navigateToEntityPage({
80
- item,
81
- entityPageId
82
- });
83
- }
84
- } : undefined;
67
+ const primaryAction = config != null && (_config$primaryAction = config.primaryAction) != null && _config$primaryAction.item ? buildAction(config.primaryAction.item) : undefined;
85
68
  const secondaryActions = config != null && (_config$secondaryActi = config.secondaryActions) != null && _config$secondaryActi.items.length ? config.secondaryActions.items.map(buildAction).filter(Boolean) : [];
86
69
  const numOfVisibleSecondaryActions = config == null || (_config$secondaryActi2 = config.secondaryActions) == null ? void 0 : _config$secondaryActi2.inlineCount;
87
70
  const alwaysShowSecondaryActions = config == null || (_config$secondaryActi3 = config.secondaryActions) == null ? void 0 : _config$secondaryActi3.inlineAlwaysVisible;
@@ -100,7 +83,7 @@ export const useActionCell = _ref => {
100
83
  numOfVisibleSecondaryActions,
101
84
  alwaysShowSecondaryActions
102
85
  };
103
- }, [config, sdk, entityPageId, navigateToEntityPage, collectionType, editText]);
86
+ }, [config, sdk]);
104
87
  return buildCellActions;
105
88
  };
106
89
  //# sourceMappingURL=useActionCell.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["useCallback","useActionsSDK","useWixPatternsContainer","useSelector","updateAction","customModalAction","customAction","resolveAction","deleteAction","useNavigation","useActionCell","_ref","config","collectionId","collectionType","entityPageId","navigateToEntityPage","container","editText","translate","sdk","buildCellActions","item","index","api","_config$primaryAction","_config$secondaryActi","_config$secondaryActi2","_config$secondaryActi3","buildAction","actionConfig","actionToResolve","baseParams","actionParams","type","action","resolvedAction","label","tooltip","resolvedActionProps","text","disabledDescription","primaryAction","onClick","undefined","secondaryActions","items","length","map","filter","Boolean","numOfVisibleSecondaryActions","inlineCount","alwaysShowSecondaryActions","inlineAlwaysVisible"],"sources":["../../../src/hooks/useActionCell.ts"],"sourcesContent":["import { useCallback } from 'react';\nimport {\n ActionCellConfig,\n ActionCellItemConfig,\n ComponentConfig,\n ResolvedAction,\n} from '../types';\nimport { useActionsSDK } from './useActionsSDK';\nimport { useWixPatternsContainer, useSelector } from '@wix/patterns';\nimport {\n updateAction,\n customModalAction,\n customAction,\n resolveAction,\n deleteAction,\n} from '../utils/actions';\nimport { useNavigation } from './useNavigationUtils';\n\nexport interface useActionCellParams {\n config?: ActionCellConfig;\n collectionId: string;\n collectionType?: ComponentConfig['type'];\n entityPageId?: string;\n}\n\nexport const useActionCell = ({\n config,\n collectionId,\n collectionType,\n entityPageId,\n}: useActionCellParams) => {\n const { navigateToEntityPage } = useNavigation();\n const container = useWixPatternsContainer();\n const editText = useSelector(() =>\n container.translate('cairo.collectionsPage.edit.CTA'),\n );\n\n const sdk = useActionsSDK({\n collectionId,\n });\n\n const buildCellActions = useCallback(\n (item, index, api) => {\n const buildAction = (actionConfig: ActionCellItemConfig) => {\n let actionToResolve: Partial<ResolvedAction> | null = null;\n\n const baseParams = {\n actionParams: { item, index, api },\n sdk,\n };\n\n switch (actionConfig.type) {\n case 'update':\n actionToResolve = updateAction({\n action: actionConfig,\n ...baseParams,\n });\n break;\n\n case 'delete':\n actionToResolve = deleteAction({\n action: actionConfig,\n ...baseParams,\n });\n break;\n\n case 'customModal':\n actionToResolve = customModalAction({\n action: actionConfig,\n ...baseParams,\n });\n break;\n\n case 'custom':\n actionToResolve = customAction({\n action: actionConfig,\n ...baseParams,\n });\n break;\n\n default:\n return null;\n }\n\n if (!actionToResolve) {\n return null;\n }\n\n const resolvedAction = resolveAction(actionConfig, actionToResolve);\n const { label, tooltip, ...resolvedActionProps } = resolvedAction;\n\n return {\n ...resolvedActionProps,\n text: resolvedAction.label,\n disabledDescription: resolvedAction.tooltip,\n };\n };\n\n const primaryAction = config?.primaryAction?.item\n ? buildAction(config.primaryAction.item)\n : collectionType === 'Grid' && entityPageId\n ? {\n text: editText,\n onClick: () => {\n navigateToEntityPage({\n item,\n entityPageId,\n });\n },\n }\n : undefined;\n\n const secondaryActions = config?.secondaryActions?.items.length\n ? config.secondaryActions.items.map(buildAction).filter(Boolean)\n : [];\n\n const numOfVisibleSecondaryActions =\n config?.secondaryActions?.inlineCount;\n const alwaysShowSecondaryActions =\n config?.secondaryActions?.inlineAlwaysVisible;\n\n if (!primaryAction && !secondaryActions.length) {\n return {};\n }\n\n return {\n ...(primaryAction ? { primaryAction } : { primaryAction: undefined }),\n ...(secondaryActions.length && { secondaryActions }),\n numOfVisibleSecondaryActions,\n alwaysShowSecondaryActions,\n };\n },\n [config, sdk, entityPageId, navigateToEntityPage, collectionType, editText],\n );\n\n return buildCellActions;\n};\n"],"mappings":"AAAA,SAASA,WAAW,QAAQ,OAAO;AAOnC,SAASC,aAAa,QAAQ,iBAAiB;AAC/C,SAASC,uBAAuB,EAAEC,WAAW,QAAQ,eAAe;AACpE,SACEC,YAAY,EACZC,iBAAiB,EACjBC,YAAY,EACZC,aAAa,EACbC,YAAY,QACP,kBAAkB;AACzB,SAASC,aAAa,QAAQ,sBAAsB;AASpD,OAAO,MAAMC,aAAa,GAAGC,IAAA,IAKF;EAAA,IALG;IAC5BC,MAAM;IACNC,YAAY;IACZC,cAAc;IACdC;EACmB,CAAC,GAAAJ,IAAA;EACpB,MAAM;IAAEK;EAAqB,CAAC,GAAGP,aAAa,CAAC,CAAC;EAChD,MAAMQ,SAAS,GAAGf,uBAAuB,CAAC,CAAC;EAC3C,MAAMgB,QAAQ,GAAGf,WAAW,CAAC,MAC3Bc,SAAS,CAACE,SAAS,CAAC,gCAAgC,CACtD,CAAC;EAED,MAAMC,GAAG,GAAGnB,aAAa,CAAC;IACxBY;EACF,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ACzB,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["useCallback","useActionsSDK","updateAction","customModalAction","customAction","resolveAction","deleteAction","useActionCell","_ref","config","collectionId","sdk","buildCellActions","item","index","api","_config$primaryAction","_config$secondaryActi","_config$secondaryActi2","_config$secondaryActi3","buildAction","actionConfig","actionToResolve","baseParams","actionParams","type","action","resolvedAction","label","tooltip","resolvedActionProps","text","disabledDescription","primaryAction","undefined","secondaryActions","items","length","map","filter","Boolean","numOfVisibleSecondaryActions","inlineCount","alwaysShowSecondaryActions","inlineAlwaysVisible"],"sources":["../../../src/hooks/useActionCell.ts"],"sourcesContent":["import { useCallback } from 'react';\nimport {\n ActionCellConfig,\n ActionCellItemConfig,\n ResolvedAction,\n} from '../types';\nimport { useActionsSDK } from './useActionsSDK';\nimport {\n updateAction,\n customModalAction,\n customAction,\n resolveAction,\n deleteAction,\n} from '../utils/actions';\n\nexport interface useActionCellParams {\n config?: ActionCellConfig;\n collectionId: string;\n}\n\nexport const useActionCell = ({\n config,\n collectionId,\n}: useActionCellParams) => {\n const sdk = useActionsSDK({\n collectionId,\n });\n\n const buildCellActions = useCallback(\n (item, index, api) => {\n const buildAction = (actionConfig: ActionCellItemConfig) => {\n let actionToResolve: Partial<ResolvedAction> | null = null;\n\n const baseParams = {\n actionParams: { item, index, api },\n sdk,\n };\n\n switch (actionConfig.type) {\n case 'update':\n actionToResolve = updateAction({\n action: actionConfig,\n ...baseParams,\n });\n break;\n\n case 'delete':\n actionToResolve = deleteAction({\n action: actionConfig,\n ...baseParams,\n });\n break;\n\n case 'customModal':\n actionToResolve = customModalAction({\n action: actionConfig,\n ...baseParams,\n });\n break;\n\n case 'custom':\n actionToResolve = customAction({\n action: actionConfig,\n ...baseParams,\n });\n break;\n\n default:\n return null;\n }\n\n if (!actionToResolve) {\n return null;\n }\n\n const resolvedAction = resolveAction(actionConfig, actionToResolve);\n const { label, tooltip, ...resolvedActionProps } = resolvedAction;\n\n return {\n ...resolvedActionProps,\n text: resolvedAction.label,\n disabledDescription: resolvedAction.tooltip,\n };\n };\n\n const primaryAction = config?.primaryAction?.item\n ? buildAction(config.primaryAction.item)\n : undefined;\n\n const secondaryActions = config?.secondaryActions?.items.length\n ? config.secondaryActions.items.map(buildAction).filter(Boolean)\n : [];\n\n const numOfVisibleSecondaryActions =\n config?.secondaryActions?.inlineCount;\n const alwaysShowSecondaryActions =\n config?.secondaryActions?.inlineAlwaysVisible;\n\n if (!primaryAction && !secondaryActions.length) {\n return {};\n }\n\n return {\n ...(primaryAction ? { primaryAction } : { primaryAction: undefined }),\n ...(secondaryActions.length && { secondaryActions }),\n numOfVisibleSecondaryActions,\n alwaysShowSecondaryActions,\n };\n },\n [config, sdk],\n );\n\n return buildCellActions;\n};\n"],"mappings":"AAAA,SAASA,WAAW,QAAQ,OAAO;AAMnC,SAASC,aAAa,QAAQ,iBAAiB;AAC/C,SACEC,YAAY,EACZC,iBAAiB,EACjBC,YAAY,EACZC,aAAa,EACbC,YAAY,QACP,kBAAkB;AAOzB,OAAO,MAAMC,aAAa,GAAGC,IAAA,IAGF;EAAA,IAHG;IAC5BC,MAAM;IACNC;EACmB,CAAC,GAAAF,IAAA;EACpB,MAAMG,GAAG,GAAGV,aAAa,CAAC;IACxBS;EACF,CAAC,CAAC;EAEF,MAAME,gBAAgB,GAAGZ,WAAW,CAClC,CAACa,IAAI,EAAEC,KAAK,EAAEC,GAAG,KAAK;IAAA,IAAAC,qBAAA,EAAAC,qBAAA,EAAAC,sBAAA,EAAAC,sBAAA;IACpB,MAAMC,WAAW,GAAIC,YAAkC,IAAK;MAC1D,IAAIC,eAA+C,GAAG,IAAI;MAE1D,MAAMC,UAAU,GAAG;QACjBC,YAAY,EAAE;UAAEX,IAAI;UAAEC,KAAK;UAAEC;QAAI,CAAC;QAClCJ;MACF,CAAC;MAED,QAAQU,YAAY,CAACI,IAAI;QACvB,KAAK,QAAQ;UACXH,eAAe,GAAGpB,YAAY,CAAC;YAC7BwB,MAAM,EAAEL,YAAY;Y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BAAgB,qBAAxBjB,sBAAA,CAA0BwB,WAAW;IACvC,MAAMC,0BAA0B,GAC9BlC,MAAM,aAAAU,sBAAA,GAANV,MAAM,CAAE0B,gBAAgB,qBAAxBhB,sBAAA,CAA0ByB,mBAAmB;IAE/C,IAAI,CAACX,aAAa,IAAI,CAACE,gBAAgB,CAACE,MAAM,EAAE;MAC9C,OAAO,CAAC,CAAC;IACX;IAEA,OAAO;MACL,IAAIJ,aAAa,GAAG;QAAEA;MAAc,CAAC,GAAG;QAAEA,aAAa,EAAEC;MAAU,CAAC,CAAC;MACrE,IAAIC,gBAAgB,CAACE,MAAM,IAAI;QAAEF;MAAiB,CAAC,CAAC;MACpDM,4BAA4B;MAC5BE;IACF,CAAC;EACH,CAAC,EACD,CAAClC,MAAM,EAAEE,GAAG,CACd,CAAC;EAED,OAAOC,gBAAgB;AACzB,CAAC","ignoreList":[]}
@@ -12,18 +12,14 @@ export const useCommonCollectionFeatures = _ref => {
12
12
  toolbarTitle,
13
13
  search,
14
14
  emptyState: emptyStateConfig,
15
- collection,
16
- collectionType,
17
- entityPageId
15
+ collection
18
16
  } = _ref;
19
17
  const {
20
18
  emptyState
21
19
  } = useEmptyStates(emptyStateConfig);
22
20
  const actionCell = useActionCell({
23
21
  config: actionCellConfig,
24
- collectionId: collection.collectionId,
25
- collectionType,
26
- entityPageId
22
+ collectionId: collection.collectionId
27
23
  });
28
24
  const bulkActionToolbar = useBulkActionToolbar({
29
25
  config: bulkActionToolbarConfig,
@@ -1 +1 @@
1
- {"version":3,"names":["React","useEmptyStates","ToolbarTitle","Box","Text","TextButton","useActionCell","useBulkActionToolbar","useCommonCollectionFeatures","_ref","_toolbarTitle$subtitl","_toolbarTitle$subtitl2","_toolbarTitle$subtitl3","_toolbarTitle$subtitl4","_toolbarTitle$subtitl5","_toolbarTitle$subtitl6","_toolbarTitle$subtitl7","actionCell","actionCellConfig","bulkActionToolbar","bulkActionToolbarConfig","toolbarTitle","search","emptyState","emptyStateConfig","collection","collectionType","entityPageId","config","collectionId","title","createElement","subtitle","text","learnMore","info","content","direction","gap","dataHook","light","size","link","underline","skin","as","rel","target","href","url","label","itemsLimit","showTotal","shown"],"sources":["../../../src/hooks/useCommonCollectionFeatures.tsx"],"sourcesContent":["import React from 'react';\nimport { useEmptyStates } from './useEmptyStates';\n\nimport { CollectionOptimisticActions, ToolbarTitle } from '@wix/patterns';\n\nimport { Box, Text, TextButton } from '@wix/design-system';\nimport { BaseCollectionComponentConfig, ComponentConfig } from '../types';\nimport { useActionCell } from './useActionCell';\nimport { useBulkActionToolbar } from './useBulkActionToolbar';\n\nexport type UseCommonCollectionFeaturesParams = Pick<\n BaseCollectionComponentConfig,\n | 'actionCell'\n | 'toolbarTitle'\n | 'search'\n | 'emptyState'\n | 'collection'\n | 'bulkActionToolbar'\n | 'entityPageId'\n> & {\n optimisticActions: CollectionOptimisticActions<any, any>;\n collectionType?: ComponentConfig['type'];\n};\n\nexport const useCommonCollectionFeatures = ({\n actionCell: actionCellConfig,\n bulkActionToolbar: bulkActionToolbarConfig,\n toolbarTitle,\n search,\n emptyState: emptyStateConfig,\n collection,\n collectionType,\n entityPageId,\n}: UseCommonCollectionFeaturesParams) => {\n const { emptyState } = useEmptyStates(emptyStateConfig);\n const actionCell = useActionCell({\n config: actionCellConfig,\n collectionId: collection.collectionId,\n collectionType,\n entityPageId,\n });\n\n const bulkActionToolbar = useBulkActionToolbar({\n config: bulkActionToolbarConfig,\n collectionId: collection.collectionId,\n });\n\n const title = toolbarTitle && (\n <ToolbarTitle\n title={toolbarTitle.title}\n subtitle={{\n text: toolbarTitle.subtitle?.text ?? '',\n learnMore: toolbarTitle.subtitle?.learnMore,\n info: toolbarTitle.subtitle?.info && {\n content: (\n <Box direction=\"vertical\" gap=\"6px\">\n <Text\n dataHook=\"toolbar-title-subtitle-info-content\"\n light\n size=\"small\"\n >\n {toolbarTitle.subtitle?.info?.content.text}\n </Text>\n {toolbarTitle.subtitle?.info?.content.link && (\n <TextButton\n dataHook=\"toolbar-title-subtitle-info-link\"\n size=\"small\"\n underline=\"always\"\n skin=\"light\"\n as=\"a\"\n rel=\"noopener\"\n target=\"_blank\"\n href={toolbarTitle.subtitle?.info?.content.link.url}\n >\n {toolbarTitle.subtitle?.info?.content.link.label}\n </TextButton>\n )}\n </Box>\n ),\n },\n }}\n itemsLimit={toolbarTitle.itemsLimit}\n showTotal={toolbarTitle.showTotal}\n />\n );\n\n return {\n search: search?.shown !== false,\n title,\n emptyState,\n actionCell,\n bulkActionToolbar,\n };\n};\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,cAAc,QAAQ,kBAAkB;AAEjD,SAAsCC,YAAY,QAAQ,eAAe;AAEzE,SAASC,GAAG,EAAEC,IAAI,EAAEC,UAAU,QAAQ,oBAAoB;AAE1D,SAASC,aAAa,QAAQ,iBAAiB;AAC/C,SAASC,oBAAoB,QAAQ,wBAAwB;AAgB7D,OAAO,MAAMC,2BAA2B,GAAGC,IAAA,IASF;EAAA,IAAAC,qBAAA,EAAAC,sBAAA,EAAAC,sBAAA,EAAAC,sBAAA,EAAAC,sBAAA,EAAAC,sBAAA,EAAAC,sBAAA;EAAA,IATG;IAC1CC,UAAU,EAAEC,gBAAgB;IAC5BC,iBAAiB,EAAEC,uBAAuB;IAC1CC,YAAY;IACZC,MAAM;IACNC,UAAU,EAAEC,gBAAgB;IAC5BC,UAAU;IACVC,cAAc;IACdC;EACiC,CAAC,GAAAlB,IAAA;EAClC,MAAM;IAAEc;EAAW,CAAC,GAAGtB,cAAc,CAACuB,gBAAgB,CAAC;EACvD,MAAMP,UAAU,GAAGX,aAAa,CAAC;IAC/BsB,MAAM,EAAEV,gBAAgB;IACxBW,YAAY,EAAEJ,UAAU,CAACI,YAAY;IACrCH,cAAc;IACdC;EACF,CAAC,CAAC;EAEF,MAAMR,iBAAiB,GAAGZ,oBAAoB,CAAC;IAC7CqB,MAAM,EAAER,uBAAuB;IAC/BS,YAAY,EAAEJ,UAAU,CAAC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,sBAAA,GAArBA,sBAAA,CAAuBoB,IAAI,qBAA3BpB,sBAAA,CAA6BqB,OAAO,CAACM,IAAI,CAACO;QAAI,IAAAjC,sBAAA,GAEnDK,YAAY,CAACW,QAAQ,cAAAhB,sBAAA,GAArBA,sBAAA,CAAuBmB,IAAI,qBAA3BnB,sBAAA,CAA6BoB,OAAO,CAACM,IAAI,CAACQ,KACjC,CAEX;MAET;IACF,CAAE;IACFC,UAAU,EAAE9B,YAAY,CAAC8B,UAAW;IACpCC,SAAS,EAAE/B,YAAY,CAAC+B;EAAU,CACnC,CACF;EAED,OAAO;IACL9B,MAAM,EAAE,CAAAA,MAAM,oBAANA,MAAM,CAAE+B,KAAK,MAAK,KAAK;IAC/BvB,KAAK;IACLP,UAAU;IACVN,UAAU;IACVE;EACF,CAAC;AACH,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["React","useEmptyStates","ToolbarTitle","Box","Text","TextButton","useActionCell","useBulkActionToolbar","useCommonCollectionFeatures","_ref","_toolbarTitle$subtitl","_toolbarTitle$subtitl2","_toolbarTitle$subtitl3","_toolbarTitle$subtitl4","_toolbarTitle$subtitl5","_toolbarTitle$subtitl6","_toolbarTitle$subtitl7","actionCell","actionCellConfig","bulkActionToolbar","bulkActionToolbarConfig","toolbarTitle","search","emptyState","emptyStateConfig","collection","config","collectionId","title","createElement","subtitle","text","learnMore","info","content","direction","gap","dataHook","light","size","link","underline","skin","as","rel","target","href","url","label","itemsLimit","showTotal","shown"],"sources":["../../../src/hooks/useCommonCollectionFeatures.tsx"],"sourcesContent":["import React from 'react';\nimport { useEmptyStates } from './useEmptyStates';\n\nimport { CollectionOptimisticActions, ToolbarTitle } from '@wix/patterns';\n\nimport { Box, Text, TextButton } from '@wix/design-system';\nimport { BaseCollectionComponentConfig } from '../types';\nimport { useActionCell } from './useActionCell';\nimport { useBulkActionToolbar } from './useBulkActionToolbar';\n\nexport type UseCommonCollectionFeaturesParams = Pick<\n BaseCollectionComponentConfig,\n | 'actionCell'\n | 'toolbarTitle'\n | 'search'\n | 'emptyState'\n | 'collection'\n | 'bulkActionToolbar'\n | 'entityPageId'\n> & {\n optimisticActions: CollectionOptimisticActions<any, any>;\n};\n\nexport const useCommonCollectionFeatures = ({\n actionCell: actionCellConfig,\n bulkActionToolbar: bulkActionToolbarConfig,\n toolbarTitle,\n search,\n emptyState: emptyStateConfig,\n collection,\n}: UseCommonCollectionFeaturesParams) => {\n const { emptyState } = useEmptyStates(emptyStateConfig);\n const actionCell = useActionCell({\n config: actionCellConfig,\n collectionId: collection.collectionId,\n });\n\n const bulkActionToolbar = useBulkActionToolbar({\n config: bulkActionToolbarConfig,\n collectionId: collection.collectionId,\n });\n\n const title = toolbarTitle && (\n <ToolbarTitle\n title={toolbarTitle.title}\n subtitle={{\n text: toolbarTitle.subtitle?.text ?? '',\n learnMore: toolbarTitle.subtitle?.learnMore,\n info: toolbarTitle.subtitle?.info && {\n content: (\n <Box direction=\"vertical\" gap=\"6px\">\n <Text\n dataHook=\"toolbar-title-subtitle-info-content\"\n light\n size=\"small\"\n >\n {toolbarTitle.subtitle?.info?.content.text}\n </Text>\n {toolbarTitle.subtitle?.info?.content.link && (\n <TextButton\n dataHook=\"toolbar-title-subtitle-info-link\"\n size=\"small\"\n underline=\"always\"\n skin=\"light\"\n as=\"a\"\n rel=\"noopener\"\n target=\"_blank\"\n href={toolbarTitle.subtitle?.info?.content.link.url}\n >\n {toolbarTitle.subtitle?.info?.content.link.label}\n </TextButton>\n )}\n </Box>\n ),\n },\n }}\n itemsLimit={toolbarTitle.itemsLimit}\n showTotal={toolbarTitle.showTotal}\n />\n );\n\n return {\n search: search?.shown !== false,\n title,\n emptyState,\n actionCell,\n bulkActionToolbar,\n };\n};\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,cAAc,QAAQ,kBAAkB;AAEjD,SAAsCC,YAAY,QAAQ,eAAe;AAEzE,SAASC,GAAG,EAAEC,IAAI,EAAEC,UAAU,QAAQ,oBAA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Action, resolveAction } from '../utils/actions';
2
+ import { useCallback } from 'react';
3
+ export function useEntityPageMoreActions(moreActions, entity, sdk, form) {
4
+ const buildEntityPageActions = useCallback(() => {
5
+ if (!moreActions) {
6
+ return;
7
+ }
8
+ const buildAction = actionConfig => {
9
+ let actionToResolve = null;
10
+ const baseParams = {
11
+ actionParams: {
12
+ entity,
13
+ form
14
+ },
15
+ sdk
16
+ };
17
+ switch (actionConfig.type) {
18
+ case 'custom':
19
+ actionToResolve = customAction({
20
+ action: actionConfig,
21
+ ...baseParams
22
+ });
23
+ break;
24
+ default:
25
+ return null;
26
+ }
27
+ if (!actionToResolve) {
28
+ return null;
29
+ }
30
+ const resolved = resolveAction(actionConfig, actionToResolve);
31
+ return {
32
+ onClick: resolved.onClick,
33
+ text: resolved.label,
34
+ prefixIcon: resolved.icon,
35
+ disabled: resolved.disabled
36
+ };
37
+ };
38
+ return moreActions.map(group => group.map(buildAction).filter(Boolean));
39
+ }, [moreActions, sdk, entity, form]);
40
+ return buildEntityPageActions() ?? [];
41
+ }
42
+ //# sourceMappingURL=useEntityPageMoreActions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["customAction","resolveAction","useCallback","useEntityPageMoreActions","moreActions","entity","sdk","form","buildEntityPageActions","buildAction","actionConfig","actionToResolve","baseParams","actionParams","type","action","resolved","onClick","text","label","prefixIcon","icon","disabled","map","group","filter","Boolean"],"sources":["../../../src/hooks/useEntityPageMoreActions.ts"],"sourcesContent":["import { ActionsSDK, ResolvedAction } from '../types';\nimport {\n EntityPageMoreActions,\n EntityPageActionConfig,\n} from '../types/actions';\nimport { customAction, resolveAction } from '../utils/actions';\nimport { useCallback } from 'react';\nimport { MoreActionsItem } from '@wix/patterns';\nimport { FieldValues, UseFormReturn } from '@wix/patterns/form';\n\nexport function useEntityPageMoreActions(\n moreActions: EntityPageMoreActions | undefined,\n entity: Record<string, any>,\n sdk: ActionsSDK,\n form: UseFormReturn<FieldValues, any, undefined>,\n) {\n const buildEntityPageActions = useCallback(() => {\n if (!moreActions) {\n return;\n }\n\n const buildAction = (\n actionConfig: EntityPageActionConfig,\n ): MoreActionsItem | null => {\n let actionToResolve: Partial<ResolvedAction> | null = null;\n const baseParams = {\n actionParams: { entity, form },\n sdk,\n };\n\n switch (actionConfig.type) {\n case 'custom':\n actionToResolve = customAction({\n action: actionConfig,\n ...baseParams,\n });\n break;\n default:\n return null;\n }\n\n if (!actionToResolve) {\n return null;\n }\n\n const resolved = resolveAction(\n actionConfig,\n actionToResolve,\n ) as ResolvedAction;\n\n return {\n onClick: resolved.onClick,\n text: resolved.label,\n prefixIcon: resolved.icon,\n disabled: resolved.disabled,\n };\n };\n\n return (moreActions as EntityPageActionConfig[][]).map((group) =>\n group.map(buildAction).filter(Boolean),\n ) as MoreActionsItem[][];\n }, [moreActions, sdk, entity, form]);\n\n return buildEntityPageActions() ?? [];\n}\n"],"mappings":"AAKA,SAASA,YAAY,EAAEC,aAAa,QAAQ,kBAAkB;AAC9D,SAASC,WAAW,QAAQ,OAAO;AAInC,OAAO,SAASC,wBAAwBA,CACtCC,WAA8C,EAC9CC,MAA2B,EAC3BC,GAAe,EACfC,IAAgD,EAChD;EACA,MAAMC,sBAAsB,GAAGN,WAAW,CAAC,MAAM;IAC/C,IAAI,CAACE,WAAW,EAAE;MAChB;IACF;IAEA,MAAMK,WAAW,GACfC,YAAoC,IACT;MAC3B,IAAIC,eAA+C,GAAG,IAAI;MAC1D,MAAMC,UAAU,GAAG;QACjBC,YAAY,EAAE;UAAER,MAAM;UAAEE;QAAK,CAAC;QAC9BD;MACF,CAAC;MAED,QAAQI,YAAY,CAACI,IAAI;QACvB,KAAK,QAAQ;UACXH,eAAe,GAAGX,YAAY,CAAC;YAC7Be,MAAM,EAAEL,YAAY;YACpB,GAAGE;UACL,CAAC,CAAC;UACF;QACF;UACE,OAAO,IAAI;MACf;MAEA,IAAI,CAACD,eAAe,EAAE;QACpB,OAAO,IAAI;MACb;MAEA,MAAMK,QAAQ,GAAGf,aAAa,CAC5BS,YAAY,EACZC,eACF,CAAmB;MAEnB,OAAO;QACLM,OAAO,EAAED,QAAQ,CAACC,OAAO;QACzBC,IAAI,EAAEF,QAAQ,CAACG,KAAK;QACpBC,UAAU,EAAEJ,QAAQ,CAACK,IAAI;QACzBC,QAAQ,EAAEN,QAAQ,CAACM;MACrB,CAAC;IACH,CAAC;IAED,OAAQlB,WAAW,CAAgCmB,GAAG,CAAEC,KAAK,IAC3DA,KAAK,CAACD,GAAG,CAACd,WAAW,CAAC,CAACgB,MAAM,CAACC,OAAO,CACvC,CAAC;EACH,CAAC,EAAE,CAACtB,WAAW,EAAEE,GAAG,EAAED,MAAM,EAAEE,IAAI,CAAC,CAAC;EAEpC,OAAOC,sBAAsB,CAAC,CAAC,IAAI,EAAE;AACvC","ignoreList":[]}
@@ -6,16 +6,13 @@ import { useSchema } from '../providers/SchemaContext';
6
6
  import { useAutoPatternsOptimisticActions } from './useAutoPatternsOptimisticActions';
7
7
  import { useBaseGridFeatures } from './useBaseGridFeatures';
8
8
  export const useGridFeatures = configuration => {
9
- const {
10
- collection
11
- } = configuration;
12
9
  const {
13
10
  collectionId,
14
11
  limit,
15
- persistQueryToUrl,
16
- disableAutoSelectAllCount,
17
- selectionConsistencyMode
18
- } = collection;
12
+ reflectQueryInUrl,
13
+ selectAllScope,
14
+ selectionUpdateMode
15
+ } = configuration.collection;
19
16
  const {
20
17
  renderItem,
21
18
  imagePlacement,
@@ -49,15 +46,14 @@ export const useGridFeatures = configuration => {
49
46
  },
50
47
  fetchData,
51
48
  limit,
52
- persistQueryToUrl,
53
- disableAutoSelectAllCount,
54
- selectionConsistencyMode
49
+ persistQueryToUrl: reflectQueryInUrl,
50
+ disableAutoSelectAllCount: selectAllScope === 'page',
51
+ selectionConsistencyMode: selectionUpdateMode
55
52
  });
56
53
  const optimisticActions = useAutoPatternsOptimisticActions(collectionId, state.collection);
57
54
  const commonFeatures = useCommonCollectionFeatures({
58
55
  ...configuration,
59
- optimisticActions,
60
- collectionType: 'Grid'
56
+ optimisticActions
61
57
  });
62
58
  return {
63
59
  ...commonFeatures,
@@ -1 +1 @@
1
- {"version":3,"names":["useFetchData","useGridCollection","useCommonCollectionFeatures","useFilters","useSchema","useAutoPatternsOptimisticActions","useBaseGridFeatures","useGridFeatures","configuration","collection","collectionId","limit","persistQueryToUrl","disableAutoSelectAllCount","selectionConsistencyMode","renderItem","imagePlacement","preset","visibleFieldIds","filterComponent","filtersObject","filtersMapping","filters","fetchData","collectionConfig","schema","state","queryName","itemKey","gridItem","idField","itemName","displayField","toExtendedFields","extendedFields","fetchErrorMessage","_ref","err","String","optimisticActions","commonFeatures","collectionType"],"sources":["../../../src/hooks/useGridFeatures.tsx"],"sourcesContent":["import { GridConfig } from '../types';\nimport { useFetchData } from './useFetchData';\nimport { useGridCollection } from '@wix/patterns';\nimport { useCommonCollectionFeatures } from './useCommonCollectionFeatures';\nimport { useFilters } from './useFilters';\nimport { useSchema } from '../providers/SchemaContext';\nimport { useAutoPatternsOptimisticActions } from './useAutoPatternsOptimisticActions';\nimport { useBaseGridFeatures } from './useBaseGridFeatures';\n\nexport const useGridFeatures = (configuration: GridConfig) => {\n const { collection } = configuration;\n\n const {\n collectionId,\n limit,\n persistQueryToUrl,\n disableAutoSelectAllCount,\n selectionConsistencyMode,\n } = collection;\n\n const { renderItem, imagePlacement, preset, visibleFieldIds } =\n useBaseGridFeatures(configuration);\n\n const { filterComponent, filtersObject, filtersMapping } = useFilters(\n configuration.filters,\n );\n\n const { fetchData } = useFetchData({\n collectionConfig: configuration.collection,\n visibleFieldIds,\n filtersMapping,\n });\n\n const schema = useSchema();\n\n const state = useGridCollection<any>({\n queryName: `${collectionId}`,\n itemKey: (gridItem) => gridItem[schema.idField],\n itemName: (gridItem) => gridItem[schema.displayField],\n filters: filtersObject,\n toExtendedFields: (gridItem) => gridItem.extendedFields,\n fetchErrorMessage: ({ err }) => String(err),\n fetchData,\n limit,\n persistQueryToUrl,\n disableAutoSelectAllCount,\n selectionConsistencyMode,\n });\n\n const optimisticActions = useAutoPatternsOptimisticActions(\n collectionId,\n state.collection,\n );\n\n const commonFeatures = useCommonCollectionFeatures({\n ...configuration,\n optimisticActions,\n collectionType: 'Grid',\n });\n\n return {\n ...commonFeatures,\n state,\n imagePlacement,\n preset,\n optimisticActions,\n renderItem,\n filters: filterComponent,\n };\n};\n"],"mappings":"AACA,SAASA,YAAY,QAAQ,gBAAgB;AAC7C,SAASC,iBAAiB,QAAQ,eAAe;AACjD,SAASC,2BAA2B,QAAQ,+BAA+B;AAC3E,SAASC,UAAU,QAAQ,cAAc;AACzC,SAASC,SAAS,QAAQ,4BAA4B;AACtD,SAASC,gCAAgC,QAAQ,oCAAoC;AACrF,SAASC,mBAAmB,QAAQ,uBAAuB;AAE3D,OAAO,MAAMC,eAAe,GAAIC,aAAyB,IAAK;EAC5D,MAAM;IAAEC;EAAW,CAAC,GAAGD,aAAa;EAEpC,MAAM;IACJE,YAAY;IACZC,KAAK;IACLC,iBAAiB;IACjBC,yBAAyB;IACzBC;EACF,CAAC,GAAGL,UAAU;EAEd,MAAM;IAAEM,UAAU;IAAEC,cAAc;IAAEC,MAAM;IAAEC;EAAgB,CAAC,GAC3DZ,mBAAmB,CAACE,aAAa,CAAC;EAEpC,MAAM;IAAEW,eAAe;IAAEC,aAAa;IAAEC;EAAe,CAAC,GAAGlB,UAAU,CACnEK,aAAa,CAACc,OAChB,CAAC;EAED,MAAM;IAAEC;EAAU,CAAC,GAAGvB,YAAY,CAAC;IACjCwB,gBAAgB,EAAEhB,aAAa,CAACC,UAAU;IAC1CS,eAAe;IACfG;EACF,CAAC,CAAC;EAEF,MAAMI,MAAM,GAAGrB,SAAS,CAAC,CAAC;EAE1B,MAAMsB,KAAK,GAAGzB,iBAAiB,CAAM;IACnC0B,SAAS,EAAE,GAAGjB,YAAY,EAAE;IAC5BkB,OAAO,EAAGC,QAAQ,IAAKA,QAAQ,CAACJ,MAAM,CAACK,OAAO,CAAC;IAC/CC,QAAQ,EAAGF,QAAQ,IAAKA,QAAQ,CAACJ,MAAM,CAACO,YAAY,CAAC;IACrDV,OAAO,EAAEF,aAAa;IACtBa,gBAAgB,EAAGJ,QAAQ,IAAKA,QAAQ,CAACK,cAAc;IACvDC,iBAAiB,EAAEC,IAAA;MAAA,IAAC;QAAEC;MAAI,CAAC,GAAAD,IAAA;MAAA,OAAKE,MAAM,CAACD,GAAG,CAAC;IAAA;IAC3Cd,SAAS;IACTZ,KAAK;IACLC,iBAAiB;IACjBC,yBAAyB;IACzBC;EACF,CAAC,CAAC;EAEF,MAAMyB,iBAAiB,GAAGlC,gCAAgC,CACxDK,YAAY,EACZgB,KAAK,CAACjB,UACR,CAAC;EAED,MAAM+B,cAAc,GAAGtC,2BAA2B,CAAC;IACjD,GAAGM,aAAa;IAChB+B,iBAAiB;IACjBE,cAAc,EAAE;EAClB,CAAC,CAAC;EAEF,OAAO;IACL,GAAGD,cAAc;IACjBd,KAAK;IACLV,cAAc;IACdC,MAAM;IACNsB,iBAAiB;IACjBxB,UAAU;IACVO,OAAO,EAAEH;EACX,CAAC;AACH,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["useFetchData","useGridCollection","useCommonCollectionFeatures","useFilters","useSchema","useAutoPatternsOptimisticActions","useBaseGridFeatures","useGridFeatures","configuration","collectionId","limit","reflectQueryInUrl","selectAllScope","selectionUpdateMode","collection","renderItem","imagePlacement","preset","visibleFieldIds","filterComponent","filtersObject","filtersMapping","filters","fetchData","collectionConfig","schema","state","queryName","itemKey","gridItem","idField","itemName","displayField","toExtendedFields","extendedFields","fetchErrorMessage","_ref","err","String","persistQueryToUrl","disableAutoSelectAllCount","selectionConsistencyMode","optimisticActions","commonFeatures"],"sources":["../../../src/hooks/useGridFeatures.tsx"],"sourcesContent":["import { GridConfig } from '../types';\nimport { useFetchData } from './useFetchData';\nimport { useGridCollection } from '@wix/patterns';\nimport { useCommonCollectionFeatures } from './useCommonCollectionFeatures';\nimport { useFilters } from './useFilters';\nimport { useSchema } from '../providers/SchemaContext';\nimport { useAutoPatternsOptimisticActions } from './useAutoPatternsOptimisticActions';\nimport { useBaseGridFeatures } from './useBaseGridFeatures';\n\nexport const useGridFeatures = (configuration: GridConfig) => {\n const {\n collectionId,\n limit,\n reflectQueryInUrl,\n selectAllScope,\n selectionUpdateMode,\n } = configuration.collection;\n\n const { renderItem, imagePlacement, preset, visibleFieldIds } =\n useBaseGridFeatures(configuration);\n\n const { filterComponent, filtersObject, filtersMapping } = useFilters(\n configuration.filters,\n );\n\n const { fetchData } = useFetchData({\n collectionConfig: configuration.collection,\n visibleFieldIds,\n filtersMapping,\n });\n\n const schema = useSchema();\n\n const state = useGridCollection<any>({\n queryName: `${collectionId}`,\n itemKey: (gridItem) => gridItem[schema.idField],\n itemName: (gridItem) => gridItem[schema.displayField],\n filters: filtersObject,\n toExtendedFields: (gridItem) => gridItem.extendedFields,\n fetchErrorMessage: ({ err }) => String(err),\n fetchData,\n limit,\n persistQueryToUrl: reflectQueryInUrl,\n disableAutoSelectAllCount: selectAllScope === 'page',\n selectionConsistencyMode: selectionUpdateMode,\n });\n\n const optimisticActions = useAutoPatternsOptimisticActions(\n collectionId,\n state.collection,\n );\n\n const commonFeatures = useCommonCollectionFeatures({\n ...configuration,\n optimisticActions,\n });\n\n return {\n ...commonFeatures,\n state,\n imagePlacement,\n preset,\n optimisticActions,\n renderItem,\n filters: filterComponent,\n };\n};\n"],"mappings":"AACA,SAASA,YAAY,QAAQ,gBAAgB;AAC7C,SAASC,iBAAiB,QAAQ,eAAe;AACjD,SAASC,2BAA2B,QAAQ,+BAA+B;AAC3E,SAASC,UAAU,QAAQ,cAAc;AACzC,SAASC,SAAS,QAAQ,4BAA4B;AACtD,SAASC,gCAAgC,QAAQ,oCAAoC;AACrF,SAASC,mBAAmB,QAAQ,uBAAuB;AAE3D,OAAO,MAAMC,eAAe,GAAIC,aAAyB,IAAK;EAC5D,MAAM;IACJC,YAAY;IACZC,KAAK;IACLC,iBAAiB;IACjBC,cAAc;I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;IACLV,cAAc;IACdC,MAAM;IACNyB,iBAAiB;IACjB3B,UAAU;IACVO,OAAO,EAAEH;EACX,CAAC;AACH,CAAC","ignoreList":[]}
@@ -9,9 +9,9 @@ export const useTableFeatures = configuration => {
9
9
  const {
10
10
  collectionId,
11
11
  limit,
12
- persistQueryToUrl,
13
- disableAutoSelectAllCount,
14
- selectionConsistencyMode
12
+ reflectQueryInUrl,
13
+ selectAllScope,
14
+ selectionUpdateMode
15
15
  } = configuration.collection;
16
16
  const {
17
17
  filterComponent,
@@ -48,9 +48,9 @@ export const useTableFeatures = configuration => {
48
48
  },
49
49
  fetchData,
50
50
  limit,
51
- persistQueryToUrl,
52
- disableAutoSelectAllCount,
53
- selectionConsistencyMode
51
+ persistQueryToUrl: reflectQueryInUrl,
52
+ disableAutoSelectAllCount: selectAllScope === 'page',
53
+ selectionConsistencyMode: selectionUpdateMode
54
54
  });
55
55
  const optimisticActions = useAutoPatternsOptimisticActions(collectionId, state.collection);
56
56
  const commonFeatures = useCommonCollectionFeatures({
@@ -1 +1 @@
1
- {"version":3,"names":["useFetchData","useTableCollection","useCommonCollectionFeatures","useFilters","useSchema","useAutoPatternsOptimisticActions","useBaseTableFeatures","useTableFeatures","configuration","collectionId","limit","persistQueryToUrl","disableAutoSelectAllCount","selectionConsistencyMode","collection","filterComponent","filtersObject","filtersMapping","filters","customColumns","visibleFieldIds","columns","onRowClick","stickyColumns","stickySelectionColumn","fetchData","collectionConfig","schema","state","queryName","itemKey","item","idField","itemName","displayField","toExtendedFields","extendedFields","fetchErrorMessage","_ref","err","String","optimisticActions","commonFeatures"],"sources":["../../../src/hooks/useTableFeatures.tsx"],"sourcesContent":["import { TableConfig } from '../types';\nimport { useFetchData } from './useFetchData';\nimport { useTableCollection } from '@wix/patterns';\nimport { useCommonCollectionFeatures } from './useCommonCollectionFeatures';\nimport { useFilters } from './useFilters';\nimport { useSchema } from '../providers/SchemaContext';\nimport { useAutoPatternsOptimisticActions } from './useAutoPatternsOptimisticActions';\nimport { useBaseTableFeatures } from './useBaseTableFeatures';\n\nexport const useTableFeatures = (configuration: TableConfig) => {\n const {\n collectionId,\n limit,\n persistQueryToUrl,\n disableAutoSelectAllCount,\n selectionConsistencyMode,\n } = configuration.collection;\n\n const { filterComponent, filtersObject, filtersMapping } = useFilters(\n configuration.filters,\n );\n const {\n customColumns,\n visibleFieldIds,\n columns,\n onRowClick,\n stickyColumns,\n stickySelectionColumn,\n } = useBaseTableFeatures(configuration);\n\n const { fetchData } = useFetchData({\n collectionConfig: configuration.collection,\n visibleFieldIds,\n filtersMapping,\n });\n\n const schema = useSchema();\n\n const state = useTableCollection<any>({\n queryName: `${collectionId}`,\n itemKey: (item) => item[schema.idField],\n itemName: (item) => item[schema.displayField],\n filters: filtersObject,\n toExtendedFields: (item) => item.extendedFields,\n fetchErrorMessage: ({ err }) => String(err),\n fetchData,\n limit,\n persistQueryToUrl,\n disableAutoSelectAllCount,\n selectionConsistencyMode,\n });\n\n const optimisticActions = useAutoPatternsOptimisticActions(\n collectionId,\n state.collection,\n );\n\n const commonFeatures = useCommonCollectionFeatures({\n ...configuration,\n optimisticActions,\n });\n\n return {\n ...commonFeatures,\n state,\n columns,\n filters: filterComponent,\n optimisticActions,\n customColumns,\n onRowClick,\n stickyColumns,\n stickySelectionColumn,\n };\n};\n"],"mappings":"AACA,SAASA,YAAY,QAAQ,gBAAgB;AAC7C,SAASC,kBAAkB,QAAQ,eAAe;AAClD,SAASC,2BAA2B,QAAQ,+BAA+B;AAC3E,SAASC,UAAU,QAAQ,cAAc;AACzC,SAASC,SAAS,QAAQ,4BAA4B;AACtD,SAASC,gCAAgC,QAAQ,oCAAoC;AACrF,SAASC,oBAAoB,QAAQ,wBAAwB;AAE7D,OAAO,MAAMC,gBAAgB,GAAIC,aAA0B,IAAK;EAC9D,MAAM;IACJC,YAAY;IACZC,KAAK;IACLC,iBAAiB;IACjBC,yBAAyB;IACzBC;EACF,CAAC,GAAGL,aAAa,CAACM,UAAU;EAE5B,MA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C;AACH,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["useFetchData","useTableCollection","useCommonCollectionFeatures","useFilters","useSchema","useAutoPatternsOptimisticActions","useBaseTableFeatures","useTableFeatures","configuration","collectionId","limit","reflectQueryInUrl","selectAllScope","selectionUpdateMode","collection","filterComponent","filtersObject","filtersMapping","filters","customColumns","visibleFieldIds","columns","onRowClick","stickyColumns","stickySelectionColumn","fetchData","collectionConfig","schema","state","queryName","itemKey","item","idField","itemName","displayField","toExtendedFields","extendedFields","fetchErrorMessage","_ref","err","String","persistQueryToUrl","disableAutoSelectAllCount","selectionConsistencyMode","optimisticActions","commonFeatures"],"sources":["../../../src/hooks/useTableFeatures.tsx"],"sourcesContent":["import { TableConfig } from '../types';\nimport { useFetchData } from './useFetchData';\nimport { useTableCollection } from '@wix/patterns';\nimport { useCommonCollectionFeatures } from './useCommonCollectionFeatures';\nimport { useFilters } from './useFilters';\nimport { useSchema } from '../providers/SchemaContext';\nimport { useAutoPatternsOptimisticActions } from './useAutoPatternsOptimisticActions';\nimport { useBaseTableFeatures } from './useBaseTableFeatures';\n\nexport const useTableFeatures = (configuration: TableConfig) => {\n const {\n collectionId,\n limit,\n reflectQueryInUrl,\n selectAllScope,\n selectionUpdateMode,\n } = configuration.collection;\n\n const { filterComponent, filtersObject, filtersMapping } = useFilters(\n configuration.filters,\n );\n const {\n customColumns,\n visibleFieldIds,\n columns,\n onRowClick,\n stickyColumns,\n stickySelectionColumn,\n } = useBaseTableFeatures(configuration);\n\n const { fetchData } = useFetchData({\n collectionConfig: configuration.collection,\n visibleFieldIds,\n filtersMapping,\n });\n\n const schema = useSchema();\n\n const state = useTableCollection<any>({\n queryName: `${collectionId}`,\n itemKey: (item) => item[schema.idField],\n itemName: (item) => item[schema.displayField],\n filters: filtersObject,\n toExtendedFields: (item) => item.extendedFields,\n fetchErrorMessage: ({ err }) => String(err),\n fetchData,\n limit,\n persistQueryToUrl: reflectQueryInUrl,\n disableAutoSelectAllCount: selectAllScope === 'page',\n selectionConsistencyMode: selectionUpdateMode,\n });\n\n const optimisticActions = useAutoPatternsOptimisticActions(\n collectionId,\n state.collection,\n );\n\n const commonFeatures = useCommonCollectionFeatures({\n ...configuration,\n optimisticActions,\n });\n\n return {\n ...commonFeatures,\n state,\n columns,\n filters: filterComponent,\n optimisticActions,\n customColumns,\n onRowClick,\n stickyColumns,\n stickySelectionColumn,\n };\n};\n"],"mappings":"AACA,SAASA,YAAY,QAAQ,gBAAgB;AAC7C,SAASC,kBAAkB,QAAQ,eAAe;AAClD,SAASC,2BAA2B,QAAQ,+BAA+B;AAC3E,SAASC,UAAU,QAAQ,cAAc;AACzC,SAASC,SAAS,QAAQ,4BAA4B;AACtD,SAASC,gCAAgC,QAAQ,oCAAoC;AACrF,SAASC,oBAAoB,QAAQ,wBAAwB;AAE7D,OAAO,MAAMC,gBAAgB,GAAIC,aAA0B,IAAK;EAC9D,MAAM;IACJC,YAAY;IACZC,KAAK;IACLC,iBAAiB;IACjBC,cAAc;IACdC;EACF,CAAC,GAAGL,aAAa,CAACM,UAAU;EAE5B,MAAM;IAAEC,eAAe;IAAEC,aAAa;IAAEC;EAAe,CAAC,GAAGd,UAAU,CACnEK,aAAa,CAACU,OAChB,CAAC;EACD,MAAM;IACJC,aAAa;IACbC,eAAe;IACfC,OAAO;IACPC,UAAU;IACVC,aAAa;IACbC;EACF,CAAC,GAAGlB,oBAAoB,CAACE,aAAa,CAAC;EAEvC,MAAM;IAAEiB;EAAU,CAAC,GAAGzB,YAAY,CAAC;IACjC0B,gBAAgB,EAAElB,aAAa,CAACM,UAAU;IAC1CM,eAAe;IACfH;EACF,CAAC,CAAC;EAEF,MAAMU,MAAM,GAAGvB,SAAS,CAAC,CAAC;EAE1B,MAAMwB,KAAK,GAAG3B,kBAAkB,CAAM;IACpC4B,SAAS,EAAE,GAAGpB,YAAY,EAAE;IAC5BqB,OAAO,EAAGC,IAAI,IAAKA,IAAI,CAACJ,MAAM,CAACK,OAAO,CAAC;IACvCC,QAAQ,EAAGF,IAAI,IAAKA,IAAI,CAACJ,MAAM,CAACO,YAAY,CAAC;IAC7ChB,OAAO,EAAEF,aAAa;IACtBmB,gBAAgB,EAAGJ,IAAI,IAAKA,IAAI,CAACK,cAAc;IAC/CC,iBAAiB,EAAEC,IAAA;MAAA,IAAC;QAAEC;MAAI,CAAC,GAAAD,IAAA;MAAA,OAAKE,MAAM,CAACD,GAAG,CAAC;IAAA;IAC3Cd,SAAS;IACTf,KAAK;IACL+B,iBAAiB,EAAE9B,iBAAiB;IACpC+B,yBAAyB,EAAE9B,cAAc,KAAK,MAAM;IACpD+B,wBAAwB,EAAE9B;EAC5B,CAAC,CAAC;EAEF,MAAM+B,iBAAiB,GAAGvC,gCAAgC,CACxDI,YAAY,EACZmB,KAAK,CAACd,UACR,CAAC;EAED,MAAM+B,cAAc,GAAG3C,2BAA2B,CAAC;IACjD,GAAGM,aAAa;IAChBoC;EACF,CAAC,CAAC;EAEF,OAAO;IACL,GAAGC,cAAc;IACjBjB,KAAK;IACLP,OAAO;IACPH,OAAO,EAAEH,eAAe;IACxB6B,iBAAiB;IACjBzB,aAAa;IACbG,UAAU;IACVC,aAAa;IACbC;EACF,CAAC;AACH,CAAC","ignoreList":[]}
@@ -11,9 +11,9 @@ export const useTableGridSwitchFeatures = config => {
11
11
  const {
12
12
  collectionId,
13
13
  limit,
14
- persistQueryToUrl,
15
- disableAutoSelectAllCount,
16
- selectionConsistencyMode
14
+ reflectQueryInUrl,
15
+ selectAllScope,
16
+ selectionUpdateMode
17
17
  } = config.collection;
18
18
  const {
19
19
  filterComponent,
@@ -55,9 +55,9 @@ export const useTableGridSwitchFeatures = config => {
55
55
  },
56
56
  fetchData: tableFetchData,
57
57
  limit,
58
- persistQueryToUrl,
59
- disableAutoSelectAllCount,
60
- selectionConsistencyMode
58
+ persistQueryToUrl: reflectQueryInUrl,
59
+ disableAutoSelectAllCount: selectAllScope === 'page',
60
+ selectionConsistencyMode: selectionUpdateMode
61
61
  });
62
62
  const optimisticActions = useAutoPatternsOptimisticActions(collectionId, state.collection);
63
63
  const commonFeatures = useCommonCollectionFeatures({
@@ -74,6 +74,7 @@ export const useTableGridSwitchFeatures = config => {
74
74
  onRowClick,
75
75
  stickyColumns,
76
76
  stickySelectionColumn,
77
+ horizontalScroll: true,
77
78
  // Grid specific features
78
79
  imagePlacement,
79
80
  preset,
@@ -1 +1 @@
1
- {"version":3,"names":["useFetchData","useTableGridSwitchCollection","useCommonCollectionFeatures","useFilters","useSchema","useAutoPatternsOptimisticActions","useBaseGridFeatures","useBaseTableFeatures","useTableGridSwitchFeatures","config","schema","collectionId","limit","persistQueryToUrl","disableAutoSelectAllCount","selectionConsistencyMode","collection","filterComponent","filtersObject","filtersMapping","filters","preset","imagePlacement","visibleFieldIds","gridVisibleFieldIds","renderItem","customColumns","tableVisibleFieldIds","columns","tableColumns","onRowClick","stickyColumns","stickySelectionColumn","fetchData","tableFetchData","collectionConfig","Array","from","Set","state","queryName","itemKey","item","idField","itemName","displayField","toExtendedFields","extendedFields","fetchErrorMessage","_ref","err","String","optimisticActions","commonFeatures"],"sources":["../../../src/hooks/useTableGridSwitchFeatures.tsx"],"sourcesContent":["import { TableGridSwitchConfig } from '../types';\nimport { useFetchData } from './useFetchData';\nimport { useTableGridSwitchCollection } from '@wix/patterns';\nimport { useCommonCollectionFeatures } from './useCommonCollectionFeatures';\nimport { useFilters } from './useFilters';\nimport { useSchema } from '../providers/SchemaContext';\nimport { useAutoPatternsOptimisticActions } from './useAutoPatternsOptimisticActions';\nimport { useBaseGridFeatures } from './useBaseGridFeatures';\nimport { useBaseTableFeatures } from './useBaseTableFeatures';\n\nexport const useTableGridSwitchFeatures = (config: TableGridSwitchConfig) => {\n const schema = useSchema();\n\n const {\n collectionId,\n limit,\n persistQueryToUrl,\n disableAutoSelectAllCount,\n selectionConsistencyMode,\n } = config.collection;\n\n const { filterComponent, filtersObject, filtersMapping } = useFilters(\n config.filters,\n );\n\n const {\n preset,\n imagePlacement,\n visibleFieldIds: gridVisibleFieldIds,\n renderItem,\n } = useBaseGridFeatures(config);\n\n const {\n customColumns,\n visibleFieldIds: tableVisibleFieldIds,\n columns: tableColumns,\n onRowClick,\n stickyColumns,\n stickySelectionColumn,\n } = useBaseTableFeatures(config);\n\n const { fetchData: tableFetchData } = useFetchData({\n collectionConfig: config.collection,\n visibleFieldIds: Array.from(\n new Set([...tableVisibleFieldIds, ...gridVisibleFieldIds]),\n ),\n filtersMapping,\n });\n\n const state = useTableGridSwitchCollection<any>({\n queryName: `${collectionId}`,\n itemKey: (item) => item[schema.idField],\n itemName: (item) => item[schema.displayField],\n filters: filtersObject,\n toExtendedFields: (item) => item.extendedFields,\n fetchErrorMessage: ({ err }) => String(err),\n fetchData: tableFetchData,\n limit,\n persistQueryToUrl,\n disableAutoSelectAllCount,\n selectionConsistencyMode,\n });\n\n const optimisticActions = useAutoPatternsOptimisticActions(\n collectionId,\n state.collection,\n );\n\n const commonFeatures = useCommonCollectionFeatures({\n ...config,\n optimisticActions,\n });\n\n return {\n ...commonFeatures,\n state,\n columns: tableColumns,\n filters: filterComponent,\n optimisticActions,\n customColumns,\n onRowClick,\n stickyColumns,\n stickySelectionColumn,\n // Grid specific features\n imagePlacement,\n preset,\n renderItem,\n };\n};\n"],"mappings":"AACA,SAASA,YAAY,QAAQ,gBAAgB;AAC7C,SAASC,4BAA4B,QAAQ,eAAe;AAC5D,SAASC,2BAA2B,QAAQ,+BAA+B;AAC3E,SAASC,UAAU,QAAQ,cAAc;AACzC,SAASC,SAAS,QAAQ,4BAA4B;AACtD,SAASC,gCAAgC,QAAQ,oCAAoC;AACrF,SAASC,mBAAmB,QAAQ,uBAAuB;AAC3D,SAASC,oBAAoB,QAAQ,wBAAwB;AAE7D,OAAO,MAAMC,0BAA0B,GAAIC,MAA6B,IAAK;EAC3E,MAAMC,MAAM,GAAGN,SAAS,CAAC,CAAC;EAE1B,MAAM;IACJO,YAAY;IACZC,KAAK;IACLC,iBAAiB;IACjBC,yBAAyB;IAC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,GAAG/C,gCAAgC,CACxDM,YAAY,EACZ4B,KAAK,CAACvB,UACR,CAAC;EAED,MAAMqC,cAAc,GAAGnD,2BAA2B,CAAC;IACjD,GAAGO,MAAM;IACT2C;EACF,CAAC,CAAC;EAEF,OAAO;IACL,GAAGC,cAAc;IACjBd,KAAK;IACLX,OAAO,EAAEC,YAAY;IACrBT,OAAO,EAAEH,eAAe;IACxBmC,iBAAiB;IACjB1B,aAAa;IACbI,UAAU;IACVC,aAAa;IACbC,qBAAqB;IACrB;IACAV,cAAc;IACdD,MAAM;IACNI;EACF,CAAC;AACH,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["useFetchData","useTableGridSwitchCollection","useCommonCollectionFeatures","useFilters","useSchema","useAutoPatternsOptimisticActions","useBaseGridFeatures","useBaseTableFeatures","useTableGridSwitchFeatures","config","schema","collectionId","limit","reflectQueryInUrl","selectAllScope","selectionUpdateMode","collection","filterComponent","filtersObject","filtersMapping","filters","preset","imagePlacement","visibleFieldIds","gridVisibleFieldIds","renderItem","customColumns","tableVisibleFieldIds","columns","tableColumns","onRowClick","stickyColumns","stickySelectionColumn","fetchData","tableFetchData","collectionConfig","Array","from","Set","state","queryName","itemKey","item","idField","itemName","displayField","toExtendedFields","extendedFields","fetchErrorMessage","_ref","err","String","persistQueryToUrl","disableAutoSelectAllCount","selectionConsistencyMode","optimisticActions","commonFeatures","horizontalScroll"],"sources":["../../../src/hooks/useTableGridSwitchFeatures.tsx"],"sourcesContent":["import { TableGridSwitchConfig } from '../types';\nimport { useFetchData } from './useFetchData';\nimport { useTableGridSwitchCollection } from '@wix/patterns';\nimport { useCommonCollectionFeatures } from './useCommonCollectionFeatures';\nimport { useFilters } from './useFilters';\nimport { useSchema } from '../providers/SchemaContext';\nimport { useAutoPatternsOptimisticActions } from './useAutoPatternsOptimisticActions';\nimport { useBaseGridFeatures } from './useBaseGridFeatures';\nimport { useBaseTableFeatures } from './useBaseTableFeatures';\n\nexport const useTableGridSwitchFeatures = (config: TableGridSwitchConfig) => {\n const schema = useSchema();\n\n const {\n collectionId,\n limit,\n reflectQueryInUrl,\n selectAllScope,\n selectionUpdateMode,\n } = config.collection;\n\n const { filterComponent, filtersObject, filtersMapping } = useFilters(\n config.filters,\n );\n\n const {\n preset,\n imagePlacement,\n visibleFieldIds: gridVisibleFieldIds,\n renderItem,\n } = useBaseGridFeatures(config);\n\n const {\n customColumns,\n visibleFieldIds: tableVisibleFieldIds,\n columns: tableColumns,\n onRowClick,\n stickyColumns,\n stickySelectionColumn,\n } = useBaseTableFeatures(config);\n\n const { fetchData: tableFetchData } = useFetchData({\n collectionConfig: config.collection,\n visibleFieldIds: Array.from(\n new Set([...tableVisibleFieldIds, ...gridVisibleFieldIds]),\n ),\n filtersMapping,\n });\n\n const state = useTableGridSwitchCollection<any>({\n queryName: `${collectionId}`,\n itemKey: (item) => item[schema.idField],\n itemName: (item) => item[schema.displayField],\n filters: filtersObject,\n toExtendedFields: (item) => item.extendedFields,\n fetchErrorMessage: ({ err }) => String(err),\n fetchData: tableFetchData,\n limit,\n persistQueryToUrl: reflectQueryInUrl,\n disableAutoSelectAllCount: selectAllScope === 'page',\n selectionConsistencyMode: selectionUpdateMode,\n });\n\n const optimisticActions = useAutoPatternsOptimisticActions(\n collectionId,\n state.collection,\n );\n\n const commonFeatures = useCommonCollectionFeatures({\n ...config,\n optimisticActions,\n });\n\n return {\n ...commonFeatures,\n state,\n columns: tableColumns,\n filters: filterComponent,\n optimisticActions,\n customColumns,\n onRowClick,\n stickyColumns,\n stickySelectionColumn,\n horizontalScroll: true,\n // Grid specific features\n imagePlacement,\n preset,\n renderItem,\n };\n};\n"],"mappings":"AACA,SAASA,YAAY,QAAQ,gBAAgB;AAC7C,SAASC,4BAA4B,QAAQ,eAAe;AAC5D,SAASC,2BAA2B,QAAQ,+BAA+B;AAC3E,SAASC,UAAU,QAAQ,cAAc;AACzC,SAASC,SAAS,QAAQ,4BAA4B;AACtD,SAASC,gCAAgC,QAAQ,oCAAoC;AACrF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,iBAAiB,EAAEC,IAAA;MAAA,IAAC;QAAEC;MAAI,CAAC,GAAAD,IAAA;MAAA,OAAKE,MAAM,CAACD,GAAG,CAAC;IAAA;IAC3CjB,SAAS,EAAEC,cAAc;IACzBtB,KAAK;IACLwC,iBAAiB,EAAEvC,iBAAiB;IACpCwC,yBAAyB,EAAEvC,cAAc,KAAK,MAAM;IACpDwC,wBAAwB,EAAEvC;EAC5B,CAAC,CAAC;EAEF,MAAMwC,iBAAiB,GAAGlD,gCAAgC,CACxDM,YAAY,EACZ4B,KAAK,CAACvB,UACR,CAAC;EAED,MAAMwC,cAAc,GAAGtD,2BAA2B,CAAC;IACjD,GAAGO,MAAM;IACT8C;EACF,CAAC,CAAC;EAEF,OAAO;IACL,GAAGC,cAAc;IACjBjB,KAAK;IACLX,OAAO,EAAEC,YAAY;IACrBT,OAAO,EAAEH,eAAe;IACxBsC,iBAAiB;IACjB7B,aAAa;IACbI,UAAU;IACVC,aAAa;IACbC,qBAAqB;IACrByB,gBAAgB,EAAE,IAAI;IACtB;IACAnC,cAAc;IACdD,MAAM;IACNI;EACF,CAAC;AACH,CAAC","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"names":["React","createContext","useContext","PatternsWizardOverridesContext","undefined","PatternsWizardOverridesProvider","_ref","children","value","createElement","Provider","usePatternsWizardOverridesContext"],"sources":["../../../src/providers/PatternsWizardOverridesContext.tsx"],"sourcesContent":["import React, { createContext, useContext, ReactNode } from 'react';\nimport { CustomComponentProps, IColumnValue } from '../types';\nimport { CollectionConfig } from '@wix/patterns';\nimport { CustomActionParams, ResolvedAction } from '../utils/actions/types';\n\nexport interface PatternsWizardOverridesContextProps {\n actions?: Record<string, (props: CustomActionParams) => ResolvedAction>;\n columns?: Record<string, (props: IColumnValue<any>) => void>;\n modals?: Record<string, React.FC<any>>;\n HeaderAddon?: React.FC;\n emptyState?: Record<string, () => void>;\n fetchData?: Record<string, CollectionConfig<any, any>['fetchData']>;\n components?: Record<string, React.FC<CustomComponentProps>>;\n}\n\nconst PatternsWizardOverridesContext = createContext<\n PatternsWizardOverridesContextProps | undefined\n>(undefined);\n\nexport const PatternsWizardOverridesProvider: React.FC<{\n children: ReactNode;\n value: PatternsWizardOverridesContextProps;\n}> = ({ children, value }) => {\n return (\n <PatternsWizardOverridesContext.Provider value={value}>\n {children}\n </PatternsWizardOverridesContext.Provider>\n );\n};\n\nexport const usePatternsWizardOverridesContext = ():\n | PatternsWizardOverridesContextProps\n | undefined => {\n return useContext(PatternsWizardOverridesContext);\n};\n"],"mappings":"AAAA,OAAOA,KAAK,IAAIC,aAAa,EAAEC,UAAU,QAAmB,OAAO;AAenE,MAAMC,8BAA8B,gBAAGF,aAAa,CAElDG,SAAS,CAAC;AAEZ,OAAO,MAAMC,+BAGX,GAAGC,IAAA,IAAyB;EAAA,IAAxB;IAAEC,QAAQ;IAAEC;EAAM,CAAC,GAAAF,IAAA;EACvB,oBACEN,KAAA,CAAAS,aAAA,CAACN,8BAA8B,CAACO,QAAQ;IAACF,KAAK,EAAEA;EAAM,GACnDD,QACsC,CAAC;AAE9C,CAAC;AAED,OAAO,MAAMI,iCAAiC,GAAGA,CAAA,KAEhC;EACf,OAAOT,UAAU,CAACC,8BAA8B,CAAC;AACnD,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["React","createContext","useContext","PatternsWizardOverridesContext","undefined","PatternsWizardOverridesProvider","_ref","children","value","createElement","Provider","usePatternsWizardOverridesContext"],"sources":["../../../src/providers/PatternsWizardOverridesContext.tsx"],"sourcesContent":["import React, { createContext, useContext, ReactNode } from 'react';\nimport {\n CustomComponentProps,\n EntityPageMoreActionsActionParams,\n IColumnValue,\n} from '../types';\nimport { CollectionConfig } from '@wix/patterns';\nimport { CustomActionParams, ResolvedAction } from '../utils/actions/types';\nimport { CollectionPageActionParams } from '../types/actions/collectionPageActions';\nimport { ActionCellActionParams } from '../types/actions/actionCell';\n\nexport interface PatternsWizardOverridesContextProps {\n actions?: Record<\n string,\n (\n props: CustomActionParams<\n | EntityPageMoreActionsActionParams\n | CollectionPageActionParams\n | ActionCellActionParams\n >,\n ) => ResolvedAction\n >;\n columns?: Record<string, (props: IColumnValue<any>) => void>;\n modals?: Record<string, React.FC<any>>;\n HeaderAddon?: React.FC;\n emptyState?: Record<string, () => void>;\n fetchData?: Record<string, CollectionConfig<any, any>['fetchData']>;\n components?: Record<string, React.FC<CustomComponentProps>>;\n}\n\nconst PatternsWizardOverridesContext = createContext<\n PatternsWizardOverridesContextProps | undefined\n>(undefined);\n\nexport const PatternsWizardOverridesProvider: React.FC<{\n children: ReactNode;\n value: PatternsWizardOverridesContextProps;\n}> = ({ children, value }) => {\n return (\n <PatternsWizardOverridesContext.Provider value={value}>\n {children}\n </PatternsWizardOverridesContext.Provider>\n );\n};\n\nexport const usePatternsWizardOverridesContext = ():\n | PatternsWizardOverridesContextProps\n | undefined => {\n return useContext(PatternsWizardOverridesContext);\n};\n"],"mappings":"AAAA,OAAOA,KAAK,IAAIC,aAAa,EAAEC,UAAU,QAAmB,OAAO;AA8BnE,MAAMC,8BAA8B,gBAAGF,aAAa,CAElDG,SAAS,CAAC;AAEZ,OAAO,MAAMC,+BAGX,GAAGC,IAAA,IAAyB;EAAA,IAAxB;IAAEC,QAAQ;IAAEC;EAAM,CAAC,GAAAF,IAAA;EACvB,oBACEN,KAAA,CAAAS,aAAA,CAACN,8BAA8B,CAACO,QAAQ;IAACF,KAAK,EAAEA;EAAM,GACnDD,QACsC,CAAC;AAE9C,CAAC;AAED,OAAO,MAAMI,iCAAiC,GAAGA,CAAA,KAEhC;EACf,OAAOT,UAAU,CAACC,8BAA8B,CAAC;AACnD,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 CollectionPagePrimaryActions,\n CollectionPageSecondaryActions,\n} from './actions';\n\nexport interface CollectionPageConfig {\n route: {\n path: string;\n };\n title: { text: string; hideTotal?: boolean };\n subtitle?: {\n text: string;\n learnMore?: {\n url: string;\n label?: string;\n };\n };\n actions?: {\n primaryActions?: CollectionPagePrimaryActions;\n secondaryActions?: CollectionPageSecondaryActions;\n };\n components: ComponentConfig[];\n}\n\nexport interface ComponentConfig {\n type: 'Table' | 'Grid' | 'TableGridSwitch';\n table?: TableConfig;\n grid?: GridConfig;\n tableGridSwitch?: TableGridSwitchConfig;\n}\n\nexport interface CollectionConfig extends BaseCollectionConfig {\n fetchData?: FetchData;\n limit?: number;\n persistQueryToUrl?: boolean;\n disableAutoSelectAllCount?: boolean;\n selectionConsistencyMode?: 'preserve' | 'clear';\n}\n\nexport interface BaseCollectionComponentConfig {\n collection: CollectionConfig;\n entityPageId?: string;\n search?: { shown?: boolean };\n toolbarTitle?: ToolbarTitle;\n actionCell?: ActionCellConfig;\n emptyState?: EmptyState;\n filters?: FiltersConfig;\n bulkActionToolbar?: BulkActionsConfig;\n}\n\nexport interface TableConfig extends BaseCollectionComponentConfig {\n columns: Column[];\n customColumns?: {\n enabled: boolean;\n };\n stickyColumns?: number;\n}\n\nexport interface GridConfig extends BaseCollectionComponentConfig {\n item: GridItem;\n}\n\nexport interface TableGridSwitchConfig extends TableConfig, GridConfig {}\n\nexport interface ToolbarTitle {\n title: string;\n subtitle?: {\n text: string;\n info?: {\n content: {\n text: string;\n link?: {\n url: string;\n label: string;\n };\n };\n };\n learnMore?: {\n url: string;\n label?: string;\n };\n };\n showTotal?: boolean;\n itemsLimit?: number;\n}\n\nexport interface Column {\n id: string;\n name: string;\n width: string;\n sortable?: boolean;\n defaultSortOrder?: 'asc' | 'desc';\n sortMode?: 'asc' | 'desc';\n defaultHidden?: boolean;\n hiddenFromCustomColumnsSelection?: boolean;\n hideable?: boolean;\n reorderDisabled?: boolean;\n}\n\nexport interface GridItem {\n titleFieldId: string;\n subtitleFieldId?: string;\n imageFieldId?: string;\n cardContentMode?: 'full' | 'title' | 'empty'; // Footer is not supported in auto-patterns\n imagePlacement?: 'top' | 'side';\n}\n\nexport interface EmptyState {\n title?: string;\n subtitle?: string;\n image?: {\n id: string;\n };\n addNewCta?: {\n id?: string;\n text?: string;\n };\n customCta?: {\n id?: string;\n };\n}\n\ninterface FetchData {\n id: string;\n}\n\nexport interface FilterOption {\n value: string;\n label: string;\n}\n\nexport type FilterSelectionMode = 'single' | 'multiple';\nexport type FilterOptionType =\n | 'checkbox'\n | 'inlineCheckbox'\n | 'radio'\n | 'select';\n\nexport enum ComponentTypeEnum {\n SINGLE = 'single',\n MULTI_SELECT = 'multi-select',\n RADIO_GROUP = 'radio-group',\n NUMBER = 'number',\n DATE_RANGE = 'date-range',\n}\n\nexport interface FiltersConfig {\n items: Filter[];\n maxInlineFilters?: CollectionToolbarFiltersProps['inline'];\n panelTitle?: string;\n}\n\nexport interface BaseOptionsFilterConfig {\n selectionMode: FilterSelectionMode;\n}\n\nexport interface DateFilterConfig {\n mode?: DateRangeFilterMode;\n presets?: DateRangeOptions;\n includeTime?: boolean;\n}\n\nexport interface NumberFilterConfig {\n min?: number;\n max?: number;\n allowedDecimals?: boolean;\n}\n\nexport interface BooleanFilterConfig {\n trueLabel?: string;\n falseLabel?: string;\n}\n\nexport interface EnumFilterConfig extends BaseOptionsFilterConfig {\n options: FilterOption[];\n optionType?: FilterOptionType;\n}\n\nexport interface DynamicOptionsFilterConfig extends BaseOptionsFilterConfig {}\n\nexport interface Filter {\n id: string;\n fieldId: string;\n displayName?: string;\n sectionTitle?: string;\n openByDefault?: boolean;\n tagLabel?: string;\n numberConfig?: NumberFilterConfig;\n dateConfig?: DateFilterConfig;\n booleanConfig?: BooleanFilterConfig;\n enumConfig?: EnumFilterConfig;\n dynamicOptionsConfig?: DynamicOptionsFilterConfig;\n}\n"],"mappings":"AA+IA,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 CollectionPagePrimaryActions,\n CollectionPageSecondaryActions,\n} from './actions';\n\nexport interface CollectionPageTitle {\n text: string;\n hideTotal?: boolean;\n}\n\nexport interface CollectionPageSubtitle {\n text: string;\n learnMore?: {\n url: string;\n label?: string;\n };\n}\n\nexport interface CollectionPageConfig {\n route: {\n path: string;\n };\n title: CollectionPageTitle;\n subtitle?: CollectionPageSubtitle;\n actions?: {\n primaryActions?: CollectionPagePrimaryActions;\n secondaryActions?: CollectionPageSecondaryActions;\n };\n components: ComponentConfig[];\n}\n\nexport interface ComponentConfig extends BaseCollectionComponentConfig {\n layout: LayoutItemConfig[];\n}\n\nexport interface LayoutItemConfig {\n type: 'Table' | 'Grid';\n table?: TableSpecificConfig;\n grid?: GridSpecificConfig;\n}\n\nexport type ColumnsConfig = Column[];\n\nexport interface TableSpecificConfig {\n columns: ColumnsConfig;\n customColumns?: {\n enabled: boolean;\n };\n stickyColumns?: number;\n}\n\nexport interface GridSpecificConfig {\n item: GridItem;\n}\n\nexport interface TableConfig\n extends BaseCollectionComponentConfig,\n TableSpecificConfig {}\nexport interface GridConfig\n extends BaseCollectionComponentConfig,\n GridSpecificConfig {}\nexport interface TableGridSwitchConfig\n extends BaseCollectionComponentConfig,\n TableSpecificConfig,\n GridSpecificConfig {}\n\nexport interface CollectionConfig extends BaseCollectionConfig {\n fetchData?: FetchData;\n limit?: number;\n reflectQueryInUrl?: boolean;\n selectAllScope?: 'page' | 'all';\n selectionUpdateMode?: 'preserve' | 'clear';\n}\n\nexport interface BaseCollectionComponentConfig {\n collection: CollectionConfig;\n entityPageId?: string;\n search?: { shown?: boolean };\n toolbarTitle?: ToolbarTitle;\n actionCell?: ActionCellConfig;\n emptyState?: EmptyState;\n filters?: FiltersConfig;\n bulkActionToolbar?: BulkActionsConfig;\n}\n\nexport interface ToolbarTitle {\n title: string;\n subtitle?: {\n text: string;\n info?: {\n content: {\n text: string;\n link?: {\n url: string;\n label: string;\n };\n };\n };\n learnMore?: {\n url: string;\n label?: string;\n };\n };\n showTotal?: boolean;\n itemsLimit?: number;\n}\n\nexport interface Column {\n id: string;\n name: string;\n width: string;\n sortable?: boolean;\n defaultSortOrder?: 'asc' | 'desc';\n sortMode?: 'asc' | 'desc';\n defaultHidden?: boolean;\n hiddenFromCustomColumnsSelection?: boolean;\n hideable?: boolean;\n reorderDisabled?: boolean;\n}\n\nexport interface GridItem {\n titleFieldId: string;\n subtitleFieldId?: string;\n imageFieldId?: string;\n cardContentMode?: 'full' | 'title' | 'empty'; // Footer is not supported in auto-patterns\n imagePlacement?: 'top' | 'side';\n}\n\nexport interface EmptyState {\n title?: string;\n subtitle?: string;\n image?: {\n id: string;\n };\n addNewCta?: {\n id?: string;\n text?: string;\n };\n customCta?: {\n id?: string;\n };\n}\n\ninterface FetchData {\n id: string;\n}\n\nexport interface FilterOption {\n value: string;\n label: string;\n}\n\nexport type FilterSelectionMode = 'single' | 'multiple';\nexport type FilterOptionType =\n | 'checkbox'\n | 'inlineCheckbox'\n | 'radio'\n | 'select';\n\nexport enum ComponentTypeEnum {\n SINGLE = 'single',\n MULTI_SELECT = 'multi-select',\n RADIO_GROUP = 'radio-group',\n NUMBER = 'number',\n DATE_RANGE = 'date-range',\n}\n\nexport type FilterItems = Filter[];\nexport interface FiltersConfig {\n items: FilterItems;\n maxInlineFilters?: CollectionToolbarFiltersProps['inline'];\n panelTitle?: string;\n}\n\nexport interface BaseOptionsFilterConfig {\n selectionMode: FilterSelectionMode;\n}\n\nexport interface DateFilterConfig {\n mode?: DateRangeFilterMode;\n presets?: DateRangeOptions;\n includeTime?: boolean;\n}\n\nexport interface NumberFilterConfig {\n min?: number;\n max?: number;\n allowedDecimals?: boolean;\n}\n\nexport interface BooleanFilterConfig {\n trueLabel?: string;\n falseLabel?: string;\n}\n\nexport interface EnumFilterConfig extends BaseOptionsFilterConfig {\n options: FilterOption[];\n optionType?: FilterOptionType;\n}\n\nexport interface DynamicOptionsFilterConfig extends BaseOptionsFilterConfig {}\n\nexport interface Filter {\n id: string;\n fieldId: string;\n displayName?: string;\n sectionTitle?: string;\n openByDefault?: boolean;\n tagLabel?: string;\n numberConfig?: NumberFilterConfig;\n dateConfig?: DateFilterConfig;\n booleanConfig?: BooleanFilterConfig;\n enumConfig?: EnumFilterConfig;\n dynamicOptionsConfig?: DynamicOptionsFilterConfig;\n}\n"],"mappings":"AAoKA,WAAYA,iBAAiB,0BAAjBA,iBAAiB;EAAjBA,iBAAiB;EAAjBA,iBAAiB;EAAjBA,iBAAiB;EAAjBA,iBAAiB;EAAjBA,iBAAiB;EAAA,OAAjBA,iBAAiB;AAAA","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"names":[],"sources":["../../../src/types/EntityPageConfig.ts"],"sourcesContent":["import { FieldValues, UseFormReturn } from '@wix/patterns/form';\n\nexport interface EntityPageConfig {\n route: {\n path: string;\n params: {\n id: string;\n };\n };\n title?: {\n text: string;\n };\n subtitle?: {\n text: string;\n learnMore?: {\n url: string;\n label?: string;\n };\n };\n collectionId: string;\n entityTypeSource: string;\n parentPageId?: string;\n layout?: {\n main: CardLayout[];\n sidebar?: CardLayout[];\n };\n}\n\nexport interface CardLayout {\n type: 'card';\n card: {\n title: {\n text: string;\n };\n subtitle?: {\n text: string;\n };\n children: LayoutContent[];\n };\n}\n\nexport type LayoutContent =\n | FieldContent\n | ContainerContent\n | ComponentItemContent;\n\ninterface FieldContent {\n type: 'field';\n field: {\n span?: number;\n fieldId: string;\n };\n}\n\ninterface ContainerContent {\n type: 'container';\n container: {\n span?: number;\n children: LayoutContent[];\n };\n}\n\ninterface ComponentItemContent {\n type: 'component';\n component: {\n span?: number;\n componentId: string;\n };\n}\n\nexport interface CustomComponentProps {\n entity?: Record<string, any>;\n form: UseFormReturn<FieldValues, any, undefined>;\n}\n"],"mappings":"","ignoreList":[]}
1
+ {"version":3,"names":[],"sources":["../../../src/types/EntityPageConfig.ts"],"sourcesContent":["import { FieldValues, UseFormReturn } from '@wix/patterns/form';\nimport { EntityPageMoreActions } from './actions/entityPageActions';\n\nexport interface EntityPageConfig {\n route: {\n path: string;\n params: {\n id: string;\n };\n };\n title?: {\n text: string;\n };\n subtitle?: {\n text: string;\n learnMore?: {\n url: string;\n label?: string;\n };\n };\n collectionId: string;\n entityTypeSource: string;\n parentPageId?: string;\n layout?: {\n main: CardLayout[];\n sidebar?: CardLayout[];\n };\n moreActions?: EntityPageMoreActions;\n}\n\nexport interface CardLayout {\n type: 'card';\n card: {\n title: {\n text: string;\n };\n subtitle?: {\n text: string;\n };\n children: LayoutContent[];\n };\n}\n\nexport type LayoutContent =\n | FieldContent\n | ContainerContent\n | ComponentItemContent;\n\ninterface FieldContent {\n type: 'field';\n field: {\n span?: number;\n fieldId: string;\n };\n}\n\ninterface ContainerContent {\n type: 'container';\n container: {\n span?: number;\n children: LayoutContent[];\n };\n}\n\ninterface ComponentItemContent {\n type: 'component';\n component: {\n span?: number;\n componentId: string;\n };\n}\n\nexport interface CustomComponentProps {\n entity?: Record<string, any>;\n form: UseFormReturn<FieldValues, any, undefined>;\n}\n"],"mappings":"","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"names":[],"sources":["../../../../src/types/actions/actionCell.ts"],"sourcesContent":["import {\n BaseActionParams,\n CustomActionModalProps,\n ResolvedAction,\n} from '../../exports/types';\nimport {\n CustomActionConfig,\n CustomModalActionConfig,\n DeleteActionConfig,\n UpdateActionConfig,\n} from './base';\n\nexport type ActionCellItemConfig =\n | UpdateActionConfig\n | CustomModalActionConfig\n | CustomActionConfig\n | DeleteActionConfig;\n\nexport interface ActionCellPrimaryAction {\n item: ActionCellItemConfig;\n}\n\nexport interface ActionCellSecondaryActions {\n items: ActionCellItemConfig[];\n inlineCount?: number;\n inlineAlwaysVisible?: boolean;\n}\n\nexport interface ActionCellConfig {\n primaryAction?: ActionCellPrimaryAction;\n secondaryActions?: ActionCellSecondaryActions;\n}\n\nexport interface ActionCellActionParams {\n item: any;\n}\n\nexport interface CustomActionCellActionParams extends BaseActionParams {\n actionParams: ActionCellActionParams;\n}\nexport type CustomActionCellActionResolver = (\n params: CustomActionCellActionParams,\n) => ResolvedAction;\n\nexport interface CustomActionCellActionModalProps\n extends CustomActionModalProps {\n actionParams: ActionCellActionParams;\n}\n"],"mappings":"","ignoreList":[]}
1
+ {"version":3,"names":[],"sources":["../../../../src/types/actions/actionCell.ts"],"sourcesContent":["import {\n CustomActionModalProps,\n CustomActionParams,\n ResolvedAction,\n} from '../../exports/types';\nimport {\n CustomActionConfig,\n CustomModalActionConfig,\n DeleteActionConfig,\n UpdateActionConfig,\n} from './base';\n\nexport type ActionCellItemConfig =\n | UpdateActionConfig\n | CustomModalActionConfig\n | CustomActionConfig\n | DeleteActionConfig;\n\nexport interface ActionCellPrimaryAction {\n item: ActionCellItemConfig;\n}\n\nexport interface ActionCellSecondaryActions {\n items: ActionCellItemConfig[];\n inlineCount?: number;\n inlineAlwaysVisible?: boolean;\n}\n\nexport interface ActionCellConfig {\n primaryAction?: ActionCellPrimaryAction;\n secondaryActions?: ActionCellSecondaryActions;\n}\n\nexport interface ActionCellActionParams {\n item: any;\n}\n\nexport type CustomActionCellActionParams =\n CustomActionParams<ActionCellActionParams>;\n\nexport type CustomActionCellActionResolver = (\n params: CustomActionCellActionParams,\n) => ResolvedAction;\n\nexport interface CustomActionCellActionModalProps\n extends CustomActionModalProps {\n actionParams: ActionCellActionParams;\n}\n"],"mappings":"","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"names":[],"sources":["../../../../src/types/actions/collectionPageActions.ts"],"sourcesContent":["import {\n BaseActionParams,\n CustomActionModalProps,\n ResolvedAction,\n} from '../../exports/types';\nimport {\n CreateActionConfig,\n CustomActionConfig,\n CustomModalActionConfig,\n} from './base';\n\nexport type CollectionPageActionConfig = (\n | CreateActionConfig\n | CustomModalActionConfig\n | CustomActionConfig\n) & {\n collection: {\n collectionId: string;\n entityTypeSource: 'cms';\n };\n};\n\ntype CollectionPageSingleAction = {\n type: 'single';\n single: {\n item: CollectionPageActionConfig;\n };\n multi?: never;\n};\n\ntype CollectionPageMultiAction = {\n type: 'multi';\n multi: {\n label: string;\n items: CollectionPageActionConfig[];\n };\n single?: never;\n};\n\nexport type CollectionPagePrimaryActions =\n | CollectionPageSingleAction\n | CollectionPageMultiAction;\n\nexport type CollectionPageSecondaryActions =\n | CollectionPageSingleAction\n | CollectionPageMultiAction;\n\nexport interface CollectionPageActionParams {\n collectionId: string;\n}\n\nexport interface CustomActionCollectionPageActionParams\n extends BaseActionParams {\n actionParams: CollectionPageActionParams;\n}\nexport type CustomActionCollectionPageActionResolver = (\n params: CustomActionCollectionPageActionParams,\n) => ResolvedAction;\n\nexport interface CustomActionCollectionPageActionModalProps\n extends CustomActionModalProps {\n actionParams: CollectionPageActionParams;\n}\n"],"mappings":"","ignoreList":[]}
1
+ {"version":3,"names":[],"sources":["../../../../src/types/actions/collectionPageActions.ts"],"sourcesContent":["import {\n CustomActionModalProps,\n CustomActionParams,\n ResolvedAction,\n} from '../../exports/types';\nimport {\n CreateActionConfig,\n CustomActionConfig,\n CustomModalActionConfig,\n} from './base';\n\nexport type CollectionPageActionConfig = (\n | CreateActionConfig\n | CustomModalActionConfig\n | CustomActionConfig\n) & {\n collection: {\n collectionId: string;\n entityTypeSource: 'cms';\n };\n};\n\ntype CollectionPageSingleAction = {\n type: 'single';\n single: {\n item: CollectionPageActionConfig;\n };\n multi?: never;\n};\n\ntype CollectionPageMultiAction = {\n type: 'multi';\n multi: {\n label: string;\n items: CollectionPageActionConfig[];\n };\n single?: never;\n};\n\nexport type CollectionPagePrimaryActions =\n | CollectionPageSingleAction\n | CollectionPageMultiAction;\n\nexport type CollectionPageSecondaryActions =\n | CollectionPageSingleAction\n | CollectionPageMultiAction;\n\nexport interface CollectionPageActionParams {\n collectionId: string;\n}\n\nexport type CustomActionCollectionPageActionParams =\n CustomActionParams<CollectionPageActionParams>;\n\nexport type CustomActionCollectionPageActionResolver = (\n params: CustomActionCollectionPageActionParams,\n) => ResolvedAction;\n\nexport interface CustomActionCollectionPageActionModalProps\n extends CustomActionModalProps {\n actionParams: CollectionPageActionParams;\n}\n"],"mappings":"","ignoreList":[]}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=entityPageActions.js.map