@strapi/content-type-builder 5.16.1 → 5.17.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 (57) hide show
  1. package/dist/admin/components/ApplyConditionButton.js +34 -0
  2. package/dist/admin/components/ApplyConditionButton.js.map +1 -0
  3. package/dist/admin/components/ApplyConditionButton.mjs +32 -0
  4. package/dist/admin/components/ApplyConditionButton.mjs.map +1 -0
  5. package/dist/admin/components/AttributeRow.js +58 -8
  6. package/dist/admin/components/AttributeRow.js.map +1 -1
  7. package/dist/admin/components/AttributeRow.mjs +59 -9
  8. package/dist/admin/components/AttributeRow.mjs.map +1 -1
  9. package/dist/admin/components/FormModal/FormModal.js +134 -3
  10. package/dist/admin/components/FormModal/FormModal.js.map +1 -1
  11. package/dist/admin/components/FormModal/FormModal.mjs +137 -5
  12. package/dist/admin/components/FormModal/FormModal.mjs.map +1 -1
  13. package/dist/admin/components/FormModal/attributes/ConditionForm.js +448 -0
  14. package/dist/admin/components/FormModal/attributes/ConditionForm.js.map +1 -0
  15. package/dist/admin/components/FormModal/attributes/ConditionForm.mjs +428 -0
  16. package/dist/admin/components/FormModal/attributes/ConditionForm.mjs.map +1 -0
  17. package/dist/admin/components/FormModal/attributes/advancedForm.js +55 -16
  18. package/dist/admin/components/FormModal/attributes/advancedForm.js.map +1 -1
  19. package/dist/admin/components/FormModal/attributes/advancedForm.mjs +55 -16
  20. package/dist/admin/components/FormModal/attributes/advancedForm.mjs.map +1 -1
  21. package/dist/admin/components/FormModal/forms/forms.js +3 -1
  22. package/dist/admin/components/FormModal/forms/forms.js.map +1 -1
  23. package/dist/admin/components/FormModal/forms/forms.mjs +3 -1
  24. package/dist/admin/components/FormModal/forms/forms.mjs.map +1 -1
  25. package/dist/admin/components/GenericInputs.js +5 -2
  26. package/dist/admin/components/GenericInputs.js.map +1 -1
  27. package/dist/admin/components/GenericInputs.mjs +5 -2
  28. package/dist/admin/components/GenericInputs.mjs.map +1 -1
  29. package/dist/admin/components/TabForm.js +88 -0
  30. package/dist/admin/components/TabForm.js.map +1 -1
  31. package/dist/admin/components/TabForm.mjs +89 -1
  32. package/dist/admin/components/TabForm.mjs.map +1 -1
  33. package/dist/admin/src/components/ApplyConditionButton.d.ts +8 -0
  34. package/dist/admin/src/components/FormModal/attributes/ConditionForm.d.ts +23 -0
  35. package/dist/admin/src/components/FormModal/attributes/advancedForm.d.ts +288 -8
  36. package/dist/admin/src/components/FormModal/attributes/form.d.ts +288 -8
  37. package/dist/admin/src/components/GenericInputs.d.ts +30 -3
  38. package/dist/admin/src/utils/conditions.d.ts +17 -0
  39. package/dist/admin/translations/en.json.js +24 -0
  40. package/dist/admin/translations/en.json.js.map +1 -1
  41. package/dist/admin/translations/en.json.mjs +24 -0
  42. package/dist/admin/translations/en.json.mjs.map +1 -1
  43. package/dist/admin/utils/conditions.js +61 -0
  44. package/dist/admin/utils/conditions.js.map +1 -0
  45. package/dist/admin/utils/conditions.mjs +57 -0
  46. package/dist/admin/utils/conditions.mjs.map +1 -0
  47. package/dist/server/controllers/validation/schema.js +11 -2
  48. package/dist/server/controllers/validation/schema.js.map +1 -1
  49. package/dist/server/controllers/validation/schema.mjs +11 -2
  50. package/dist/server/controllers/validation/schema.mjs.map +1 -1
  51. package/dist/server/src/controllers/validation/schema.d.ts +25728 -0
  52. package/dist/server/src/controllers/validation/schema.d.ts.map +1 -1
  53. package/dist/server/src/services/schema.d.ts +1302 -0
  54. package/dist/server/src/services/schema.d.ts.map +1 -1
  55. package/dist/server/src/utils/attributes.d.ts +210 -0
  56. package/dist/server/src/utils/attributes.d.ts.map +1 -1
  57. package/package.json +5 -5
@@ -1 +1 @@
1
- {"version":3,"file":"TabForm.js","sources":["../../../admin/src/components/TabForm.tsx"],"sourcesContent":["import { Box, Grid, Typography } from '@strapi/design-system';\nimport get from 'lodash/get';\nimport { useIntl } from 'react-intl';\n\nimport { GenericInput } from './GenericInputs';\n\ninterface TabFormProps {\n form: Array<Record<string, any>>;\n formErrors: Record<string, any>;\n genericInputProps: Record<string, any>;\n modifiedData: Record<string, any>;\n onChange: (value: any) => void;\n}\n\n/* eslint-disable react/no-array-index-key */\nexport const TabForm = ({\n form,\n formErrors,\n genericInputProps,\n modifiedData,\n onChange,\n}: TabFormProps) => {\n const { formatMessage } = useIntl();\n\n return (\n <>\n {form.map((section, sectionIndex) => {\n // Don't display an empty section\n if (section.items.length === 0) {\n return null;\n }\n\n return (\n <Box key={sectionIndex}>\n {section.sectionTitle && (\n <Box paddingBottom={4}>\n <Typography variant=\"delta\" tag=\"h3\">\n {formatMessage(section.sectionTitle)}\n </Typography>\n </Box>\n )}\n <Grid.Root gap={4}>\n {section.items.map((input: any, i: number) => {\n const key = `${sectionIndex}.${i}`;\n\n /**\n * Use undefined as the default value because not every input wants a string e.g. Date pickers\n */\n const value = get(modifiedData, input.name, undefined);\n\n // When extending the yup schema of an existing field (like in https://github.com/strapi/strapi/blob/293ff3b8f9559236609d123a2774e3be05ce8274/packages/strapi-plugin-i18n/admin/src/index.js#L52)\n // and triggering a yup validation error in the UI (missing a required field for example)\n // We got an object that looks like: formErrors = { \"pluginOptions.i18n.localized\": {...} }\n // In order to deal with this error, we can't rely on lodash.get to resolve this key\n // - lodash will try to access {pluginOptions: {i18n: {localized: true}}})\n // - and we just want to access { \"pluginOptions.i18n.localized\": {...} }\n // NOTE: this is a hack\n const pluginOptionError = Object.keys(formErrors).find((key) => key === input.name);\n\n // Retrieve the error for a specific input\n const errorId = pluginOptionError\n ? formErrors[pluginOptionError].id\n : get(\n formErrors,\n [\n ...input.name\n .split('.')\n // The filter here is used when creating a component\n // in the component step 1 modal\n // Since the component info is stored in the\n // componentToCreate object we can access the error\n // By removing the key\n .filter((key: string) => key !== 'componentToCreate'),\n 'id',\n ],\n null\n );\n\n if (input.type === 'pushRight') {\n return (\n <Grid.Item\n col={input.size || 6}\n key={input.name || key}\n direction=\"column\"\n alignItems=\"stretch\"\n >\n <div />\n </Grid.Item>\n );\n }\n\n return (\n <Grid.Item\n col={input.size || 6}\n key={input.name || key}\n direction=\"column\"\n alignItems=\"stretch\"\n >\n <GenericInput\n {...input}\n {...genericInputProps}\n error={errorId}\n onChange={onChange}\n value={value}\n autoFocus={i === 0}\n />\n </Grid.Item>\n );\n })}\n </Grid.Root>\n </Box>\n );\n })}\n </>\n );\n};\n"],"names":["TabForm","form","formErrors","genericInputProps","modifiedData","onChange","formatMessage","useIntl","_jsx","_Fragment","map","section","sectionIndex","items","length","_jsxs","Box","sectionTitle","paddingBottom","Typography","variant","tag","Grid","Root","gap","input","i","key","value","get","name","undefined","pluginOptionError","Object","keys","find","errorId","id","split","filter","type","Item","col","size","direction","alignItems","div","GenericInput","error","autoFocus"],"mappings":";;;;;;;;AAcA,8CACaA,MAAAA,OAAAA,GAAU,CAAC,EACtBC,IAAI,EACJC,UAAU,EACVC,iBAAiB,EACjBC,YAAY,EACZC,QAAQ,EACK,GAAA;IACb,MAAM,EAAEC,aAAa,EAAE,GAAGC,iBAAAA,EAAAA;IAE1B,qBACEC,cAAA,CAAAC,mBAAA,EAAA;kBACGR,IAAKS,CAAAA,GAAG,CAAC,CAACC,OAASC,EAAAA,YAAAA,GAAAA;;AAElB,YAAA,IAAID,OAAQE,CAAAA,KAAK,CAACC,MAAM,KAAK,CAAG,EAAA;gBAC9B,OAAO,IAAA;AACT;AAEA,YAAA,qBACEC,eAACC,CAAAA,gBAAAA,EAAAA;;oBACEL,OAAQM,CAAAA,YAAY,kBACnBT,cAACQ,CAAAA,gBAAAA,EAAAA;wBAAIE,aAAe,EAAA,CAAA;AAClB,wBAAA,QAAA,gBAAAV,cAACW,CAAAA,uBAAAA,EAAAA;4BAAWC,OAAQ,EAAA,OAAA;4BAAQC,GAAI,EAAA,IAAA;AAC7Bf,4BAAAA,QAAAA,EAAAA,aAAAA,CAAcK,QAAQM,YAAY;;;AAIzC,kCAAAT,cAAA,CAACc,kBAAKC,IAAI,EAAA;wBAACC,GAAK,EAAA,CAAA;AACbb,wBA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,SAAA;AAEX,gCAAA,QAAA,gBAAArC,cAACuC,CAAAA,0BAAAA,EAAAA;AACE,oCAAA,GAAGtB,KAAK;AACR,oCAAA,GAAGtB,iBAAiB;oCACrB6C,KAAOZ,EAAAA,OAAAA;oCACP/B,QAAUA,EAAAA,QAAAA;oCACVuB,KAAOA,EAAAA,KAAAA;AACPqB,oCAAAA,SAAAA,EAAWvB,CAAM,KAAA;;AAVdD,6BAAAA,EAAAA,KAAAA,CAAMK,IAAI,IAAIH,GAAAA,CAAAA;AAczB,yBAAA;;;AA3EMf,aAAAA,EAAAA,YAAAA,CAAAA;AA+Ed,SAAA;;AAGN;;;;"}
1
+ {"version":3,"file":"TabForm.js","sources":["../../../admin/src/components/TabForm.tsx"],"sourcesContent":["import { Box, Grid, Typography, Button, Tooltip } from '@strapi/design-system';\nimport get from 'lodash/get';\nimport { useIntl } from 'react-intl';\n\nimport { formatCondition, getAvailableConditionFields } from '../utils/conditions';\n\nimport { GenericInput } from './GenericInputs';\n\ninterface TabFormProps {\n form: Array<Record<string, any>>;\n formErrors: Record<string, any>;\n genericInputProps: Record<string, any>;\n modifiedData: Record<string, any>;\n onChange: (value: any) => void;\n}\n\n/* eslint-disable react/no-array-index-key */\nexport const TabForm = ({\n form,\n formErrors,\n genericInputProps,\n modifiedData,\n onChange,\n}: TabFormProps) => {\n const { formatMessage } = useIntl();\n\n return (\n <>\n {form.map((section, sectionIndex) => {\n // Don't display an empty section\n if (section.items.length === 0) {\n return null;\n }\n return (\n <Box key={sectionIndex}>\n {section.sectionTitle && (\n <Box paddingBottom={4}>\n <Typography variant=\"delta\" tag=\"h3\">\n {formatMessage(section.sectionTitle)}\n </Typography>\n </Box>\n )}\n {section.intlLabel && (\n <Typography variant=\"pi\" textColor=\"neutral600\">\n {formatMessage(section.intlLabel)}\n </Typography>\n )}\n\n <Grid.Root gap={4}>\n {section.items.map((input: any, i: number) => {\n const key = `${sectionIndex}.${i}`;\n\n /**\n * Use undefined as the default value because not every input wants a string e.g. Date pickers\n */\n const value = get(modifiedData, input.name, undefined);\n\n // When extending the yup schema of an existing field (like in https://github.com/strapi/strapi/blob/293ff3b8f9559236609d123a2774e3be05ce8274/packages/strapi-plugin-i18n/admin/src/index.js#L52)\n // and triggering a yup validation error in the UI (missing a required field for example)\n // We got an object that looks like: formErrors = { \"pluginOptions.i18n.localized\": {...} }\n // In order to deal with this error, we can't rely on lodash.get to resolve this key\n // - lodash will try to access {pluginOptions: {i18n: {localized: true}}})\n // - and we just want to access { \"pluginOptions.i18n.localized\": {...} }\n // NOTE: this is a hack\n const pluginOptionError = Object.keys(formErrors).find((key) => key === input.name);\n\n // Retrieve the error for a specific input\n const errorId = pluginOptionError\n ? formErrors[pluginOptionError].id\n : get(\n formErrors,\n [\n ...input.name\n .split('.')\n // The filter here is used when creating a component\n // in the component step 1 modal\n // Since the component info is stored in the\n // componentToCreate object we can access the error\n // By removing the key\n .filter((key: string) => key !== 'componentToCreate'),\n 'id',\n ],\n null\n );\n\n if (input.type === 'pushRight') {\n return (\n <Grid.Item\n col={input.size || 6}\n key={input.name || key}\n direction=\"column\"\n alignItems=\"stretch\"\n >\n <div />\n </Grid.Item>\n );\n }\n\n // Special handling for 'condition-form'\n if (input.type === 'condition-form') {\n const currentCondition = get(modifiedData, input.name);\n\n // Get all attributes from the content type schema\n const contentTypeAttributes =\n genericInputProps.contentTypeSchema?.attributes || [];\n\n if (!genericInputProps.contentTypeSchema) {\n console.warn('contentTypeSchema is undefined, skipping condition form');\n return null;\n }\n\n // Filter for boolean and enumeration fields only, excluding the current field\n const availableFields = getAvailableConditionFields(\n contentTypeAttributes,\n modifiedData.name\n );\n\n const noFieldsMessage = formatMessage({\n id: 'form.attribute.condition.no-fields',\n defaultMessage:\n 'No boolean or enumeration fields available to set conditions on.',\n });\n\n return (\n <Grid.Item\n col={input.size || 12}\n key={input.name || key}\n direction=\"column\"\n alignItems=\"stretch\"\n >\n {!currentCondition || Object.keys(currentCondition).length === 0 ? (\n <Box>\n {currentCondition && Object.keys(currentCondition).length > 0 && (\n <Typography variant=\"sigma\" textColor=\"neutral800\" marginBottom={2}>\n {formatCondition(\n currentCondition,\n availableFields,\n genericInputProps.attributeName || modifiedData.name\n )}\n </Typography>\n )}\n <Tooltip description={noFieldsMessage}>\n <Button\n marginTop={\n currentCondition && Object.keys(currentCondition).length > 0 ? 0 : 4\n }\n fullWidth={true}\n variant=\"secondary\"\n onClick={() => {\n onChange({\n target: {\n name: input.name,\n value: { visible: { '==': [{ var: '' }, ''] } },\n },\n });\n }}\n startIcon={<span aria-hidden>+</span>}\n disabled={availableFields.length === 0}\n >\n {formatMessage({\n id: 'form.attribute.condition.apply',\n defaultMessage: 'Apply condition',\n })}\n </Button>\n </Tooltip>\n </Box>\n ) : (\n <GenericInput\n {...input}\n {...genericInputProps}\n error={errorId}\n onChange={onChange}\n value={value}\n autoFocus={i === 0}\n attributeName={modifiedData.name}\n conditionFields={availableFields}\n onDelete={() => {\n onChange({\n target: {\n name: input.name,\n },\n });\n }}\n />\n )}\n </Grid.Item>\n );\n }\n\n // Default rendering for all other input types\n return (\n <Grid.Item\n col={input.size || 6}\n key={input.name || key}\n direction=\"column\"\n alignItems=\"stretch\"\n >\n <GenericInput\n {...input}\n {...genericInputProps}\n error={errorId}\n onChange={onChange}\n value={value}\n autoFocus={i === 0}\n />\n </Grid.Item>\n );\n })}\n </Grid.Root>\n </Box>\n );\n })}\n </>\n );\n};\n"],"names":["TabForm","form","formErrors","genericInputProps","modifiedData","onChange","formatMessage","useIntl","_jsx","_Fragment","map","section","sectionIndex","items","length","_jsxs","Box","sectionTitle","paddingBottom","Typography","variant","tag","intlLabel","textColor","Grid","Root","gap","input","i","key","value","get","name","undefined","pluginOptionError","Object","keys","find","errorId","id","split","filter","type","Item","col","size","direction","alignItems","div","currentCondition","contentTypeAttributes","contentTypeSchema","attributes","console","warn","availableFields","getAvailableConditionFields","noFieldsMessage","defaultMessage","marginBottom","formatCondition","attributeName","Tooltip","description","Button","marginTop","fullWidth","onClick","target","visible","var","startIcon","span","aria-hidden","disabled","GenericInput","error","autoFocus","conditionFields","onDelete"],"mappings":";;;;;;;;;AAgBA,8CACaA,MAAAA,OAAAA,GAAU,CAAC,EACtBC,IAAI,EACJC,UAAU,EACVC,iBAAiB,EACjBC,YAAY,EACZC,QAAQ,EACK,GAAA;IACb,MAAM,EAAEC,aAAa,EAAE,GAAGC,iBAAAA,EAAAA;IAE1B,qBACEC,cAAA,CAAAC,mBAAA,EAAA;kBACGR,IAAKS,CAAAA,GAAG,CAAC,CAACC,OAASC,EAAAA,YAAAA,GAAAA;;AAElB,YAAA,IAAID,OAAQE,CAAAA,KAAK,CAACC,MAAM,KAAK,CAAG,EAAA;gBAC9B,OAAO,IAAA;AACT;AACA,YAAA,qBACEC,eAACC,CAAAA,gBAAAA,EAAAA;;oBACEL,OAAQM,CAAAA,YAAY,kBACnBT,cAACQ,CAAAA,gBAAAA,EAAAA;wBAAIE,aAAe,EAAA,CAAA;AAClB,wBAAA,QAAA,gBAAAV,cAACW,CAAAA,uBAAAA,EAAAA;4BAAWC,OAAQ,EAAA,OAAA;4BAAQC,GAAI,EAAA,IAAA;AAC7Bf,4BAAAA,QAAAA,EAAAA,aAAAA,CAAcK,QAAQM,YAAY;;;oBAIxCN,OAAQW,CAAAA,SAAS,kBAChBd,cAACW,CAAAA,uBAAAA,EAAAA;wBAAWC,OAAQ,EAAA,IAAA;wBAAKG,SAAU,EAAA,YAAA;AAChCjB,wBAAAA,QAAAA,EAAAA,aAAAA,CAAcK,QAAQW,SAAS;;AAIpC,kCAAAd,cAAA,CAACgB,kBAAKC,IAAI,EAAA;wBAACC,GAAK,EAAA,CAAA;AACbf,wBAAAA,QAAAA,EAAAA,OAAAA,CAAQE,KAAK,CAACH,GAAG,CAAC,CAACiB,KAAYC,EAAAA,CAAAA,GAAAA;AAC9B,4BAAA,MAAMC,MAAM,CAAC,EAAEjB,aAAa,CAAC,EAAEgB,EAAE,CAAC;AAElC;;AAEC,oBACD,MAAME,K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AOtC,EAAAA,OAAAA;oCACPjC,QAAUA,EAAAA,QAAAA;oCACVyB,KAAOA,EAAAA,KAAAA;AACP+C,oCAAAA,SAAAA,EAAWjD,CAAM,KAAA;;AAVdD,6BAAAA,EAAAA,KAAAA,CAAMK,IAAI,IAAIH,GAAAA,CAAAA;AAczB,yBAAA;;;AA7KMjB,aAAAA,EAAAA,YAAAA,CAAAA;AAiLd,SAAA;;AAGN;;;;"}
@@ -1,7 +1,8 @@
1
1
  import { jsx, Fragment, jsxs } from 'react/jsx-runtime';
2
- import { Box, Typography, Grid } from '@strapi/design-system';
2
+ import { Box, Typography, Grid, Tooltip, Button } from '@strapi/design-system';
3
3
  import get from 'lodash/get';
4
4
  import { useIntl } from 'react-intl';
5
+ import { getAvailableConditionFields, formatCondition } from '../utils/conditions.mjs';
5
6
  import { GenericInput as MemoizedGenericInput } from './GenericInputs.mjs';
6
7
 
7
8
  /* eslint-disable react/no-array-index-key */ const TabForm = ({ form, formErrors, genericInputProps, modifiedData, onChange })=>{
@@ -22,6 +23,11 @@ import { GenericInput as MemoizedGenericInput } from './GenericInputs.mjs';
22
23
  children: formatMessage(section.sectionTitle)
23
24
  })
24
25
  }),
26
+ section.intlLabel && /*#__PURE__*/ jsx(Typography, {
27
+ variant: "pi",
28
+ textColor: "neutral600",
29
+ children: formatMessage(section.intlLabel)
30
+ }),
25
31
  /*#__PURE__*/ jsx(Grid.Root, {
26
32
  gap: 4,
27
33
  children: section.items.map((input, i)=>{
@@ -55,6 +61,88 @@ import { GenericInput as MemoizedGenericInput } from './GenericInputs.mjs';
55
61
  children: /*#__PURE__*/ jsx("div", {})
56
62
  }, input.name || key);
57
63
  }
64
+ // Special handling for 'condition-form'
65
+ if (input.type === 'condition-form') {
66
+ const currentCondition = get(modifiedData, input.name);
67
+ // Get all attributes from the content type schema
68
+ const contentTypeAttributes = genericInputProps.contentTypeSchema?.attributes || [];
69
+ if (!genericInputProps.contentTypeSchema) {
70
+ console.warn('contentTypeSchema is undefined, skipping condition form');
71
+ return null;
72
+ }
73
+ // Filter for boolean and enumeration fields only, excluding the current field
74
+ const availableFields = getAvailableConditionFields(contentTypeAttributes, modifiedData.name);
75
+ const noFieldsMessage = formatMessage({
76
+ id: 'form.attribute.condition.no-fields',
77
+ defaultMessage: 'No boolean or enumeration fields available to set conditions on.'
78
+ });
79
+ return /*#__PURE__*/ jsx(Grid.Item, {
80
+ col: input.size || 12,
81
+ direction: "column",
82
+ alignItems: "stretch",
83
+ children: !currentCondition || Object.keys(currentCondition).length === 0 ? /*#__PURE__*/ jsxs(Box, {
84
+ children: [
85
+ currentCondition && Object.keys(currentCondition).length > 0 && /*#__PURE__*/ jsx(Typography, {
86
+ variant: "sigma",
87
+ textColor: "neutral800",
88
+ marginBottom: 2,
89
+ children: formatCondition(currentCondition, availableFields, genericInputProps.attributeName || modifiedData.name)
90
+ }),
91
+ /*#__PURE__*/ jsx(Tooltip, {
92
+ description: noFieldsMessage,
93
+ children: /*#__PURE__*/ jsx(Button, {
94
+ marginTop: currentCondition && Object.keys(currentCondition).length > 0 ? 0 : 4,
95
+ fullWidth: true,
96
+ variant: "secondary",
97
+ onClick: ()=>{
98
+ onChange({
99
+ target: {
100
+ name: input.name,
101
+ value: {
102
+ visible: {
103
+ '==': [
104
+ {
105
+ var: ''
106
+ },
107
+ ''
108
+ ]
109
+ }
110
+ }
111
+ }
112
+ });
113
+ },
114
+ startIcon: /*#__PURE__*/ jsx("span", {
115
+ "aria-hidden": true,
116
+ children: "+"
117
+ }),
118
+ disabled: availableFields.length === 0,
119
+ children: formatMessage({
120
+ id: 'form.attribute.condition.apply',
121
+ defaultMessage: 'Apply condition'
122
+ })
123
+ })
124
+ })
125
+ ]
126
+ }) : /*#__PURE__*/ jsx(MemoizedGenericInput, {
127
+ ...input,
128
+ ...genericInputProps,
129
+ error: errorId,
130
+ onChange: onChange,
131
+ value: value,
132
+ autoFocus: i === 0,
133
+ attributeName: modifiedData.name,
134
+ conditionFields: availableFields,
135
+ onDelete: ()=>{
136
+ onChange({
137
+ target: {
138
+ name: input.name
139
+ }
140
+ });
141
+ }
142
+ })
143
+ }, input.name || key);
144
+ }
145
+ // Default rendering for all other input types
58
146
  return /*#__PURE__*/ jsx(Grid.Item, {
59
147
  col: input.size || 6,
60
148
  direction: "column",
@@ -1 +1 @@
1
- {"version":3,"file":"TabForm.mjs","sources":["../../../admin/src/components/TabForm.tsx"],"sourcesContent":["import { Box, Grid, Typography } from '@strapi/design-system';\nimport get from 'lodash/get';\nimport { useIntl } from 'react-intl';\n\nimport { GenericInput } from './GenericInputs';\n\ninterface TabFormProps {\n form: Array<Record<string, any>>;\n formErrors: Record<string, any>;\n genericInputProps: Record<string, any>;\n modifiedData: Record<string, any>;\n onChange: (value: any) => void;\n}\n\n/* eslint-disable react/no-array-index-key */\nexport const TabForm = ({\n form,\n formErrors,\n genericInputProps,\n modifiedData,\n onChange,\n}: TabFormProps) => {\n const { formatMessage } = useIntl();\n\n return (\n <>\n {form.map((section, sectionIndex) => {\n // Don't display an empty section\n if (section.items.length === 0) {\n return null;\n }\n\n return (\n <Box key={sectionIndex}>\n {section.sectionTitle && (\n <Box paddingBottom={4}>\n <Typography variant=\"delta\" tag=\"h3\">\n {formatMessage(section.sectionTitle)}\n </Typography>\n </Box>\n )}\n <Grid.Root gap={4}>\n {section.items.map((input: any, i: number) => {\n const key = `${sectionIndex}.${i}`;\n\n /**\n * Use undefined as the default value because not every input wants a string e.g. Date pickers\n */\n const value = get(modifiedData, input.name, undefined);\n\n // When extending the yup schema of an existing field (like in https://github.com/strapi/strapi/blob/293ff3b8f9559236609d123a2774e3be05ce8274/packages/strapi-plugin-i18n/admin/src/index.js#L52)\n // and triggering a yup validation error in the UI (missing a required field for example)\n // We got an object that looks like: formErrors = { \"pluginOptions.i18n.localized\": {...} }\n // In order to deal with this error, we can't rely on lodash.get to resolve this key\n // - lodash will try to access {pluginOptions: {i18n: {localized: true}}})\n // - and we just want to access { \"pluginOptions.i18n.localized\": {...} }\n // NOTE: this is a hack\n const pluginOptionError = Object.keys(formErrors).find((key) => key === input.name);\n\n // Retrieve the error for a specific input\n const errorId = pluginOptionError\n ? formErrors[pluginOptionError].id\n : get(\n formErrors,\n [\n ...input.name\n .split('.')\n // The filter here is used when creating a component\n // in the component step 1 modal\n // Since the component info is stored in the\n // componentToCreate object we can access the error\n // By removing the key\n .filter((key: string) => key !== 'componentToCreate'),\n 'id',\n ],\n null\n );\n\n if (input.type === 'pushRight') {\n return (\n <Grid.Item\n col={input.size || 6}\n key={input.name || key}\n direction=\"column\"\n alignItems=\"stretch\"\n >\n <div />\n </Grid.Item>\n );\n }\n\n return (\n <Grid.Item\n col={input.size || 6}\n key={input.name || key}\n direction=\"column\"\n alignItems=\"stretch\"\n >\n <GenericInput\n {...input}\n {...genericInputProps}\n error={errorId}\n onChange={onChange}\n value={value}\n autoFocus={i === 0}\n />\n </Grid.Item>\n );\n })}\n </Grid.Root>\n </Box>\n );\n })}\n </>\n );\n};\n"],"names":["TabForm","form","formErrors","genericInputProps","modifiedData","onChange","formatMessage","useIntl","_jsx","_Fragment","map","section","sectionIndex","items","length","_jsxs","Box","sectionTitle","paddingBottom","Typography","variant","tag","Grid","Root","gap","input","i","key","value","get","name","undefined","pluginOptionError","Object","keys","find","errorId","id","split","filter","type","Item","col","size","direction","alignItems","div","GenericInput","error","autoFocus"],"mappings":";;;;;;AAcA,8CACaA,MAAAA,OAAAA,GAAU,CAAC,EACtBC,IAAI,EACJC,UAAU,EACVC,iBAAiB,EACjBC,YAAY,EACZC,QAAQ,EACK,GAAA;IACb,MAAM,EAAEC,aAAa,EAAE,GAAGC,OAAAA,EAAAA;IAE1B,qBACEC,GAAA,CAAAC,QAAA,EAAA;kBACGR,IAAKS,CAAAA,GAAG,CAAC,CAACC,OAASC,EAAAA,YAAAA,GAAAA;;AAElB,YAAA,IAAID,OAAQE,CAAAA,KAAK,CAACC,MAAM,KAAK,CAAG,EAAA;gBAC9B,OAAO,IAAA;AACT;AAEA,YAAA,qBACEC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AAAA,CAAMkB,IAAI,IAAI,CAAA;oCAEnBC,SAAU,EAAA,QAAA;oCACVC,UAAW,EAAA,SAAA;AAEX,oCAAA,QAAA,gBAAArC,GAACsC,CAAAA,KAAAA,EAAAA,EAAAA;AAJIrB,iCAAAA,EAAAA,KAAAA,CAAMK,IAAI,IAAIH,GAAAA,CAAAA;AAOzB;4BAEA,qBACEnB,GAAA,CAACc,KAAKmB,IAAI,EAAA;gCACRC,GAAKjB,EAAAA,KAAAA,CAAMkB,IAAI,IAAI,CAAA;gCAEnBC,SAAU,EAAA,QAAA;gCACVC,UAAW,EAAA,SAAA;AAEX,gCAAA,QAAA,gBAAArC,GAACuC,CAAAA,oBAAAA,EAAAA;AACE,oCAAA,GAAGtB,KAAK;AACR,oCAAA,GAAGtB,iBAAiB;oCACrB6C,KAAOZ,EAAAA,OAAAA;oCACP/B,QAAUA,EAAAA,QAAAA;oCACVuB,KAAOA,EAAAA,KAAAA;AACPqB,oCAAAA,SAAAA,EAAWvB,CAAM,KAAA;;AAVdD,6BAAAA,EAAAA,KAAAA,CAAMK,IAAI,IAAIH,GAAAA,CAAAA;AAczB,yBAAA;;;AA3EMf,aAAAA,EAAAA,YAAAA,CAAAA;AA+Ed,SAAA;;AAGN;;;;"}
1
+ {"version":3,"file":"TabForm.mjs","sources":["../../../admin/src/components/TabForm.tsx"],"sourcesContent":["import { Box, Grid, Typography, Button, Tooltip } from '@strapi/design-system';\nimport get from 'lodash/get';\nimport { useIntl } from 'react-intl';\n\nimport { formatCondition, getAvailableConditionFields } from '../utils/conditions';\n\nimport { GenericInput } from './GenericInputs';\n\ninterface TabFormProps {\n form: Array<Record<string, any>>;\n formErrors: Record<string, any>;\n genericInputProps: Record<string, any>;\n modifiedData: Record<string, any>;\n onChange: (value: any) => void;\n}\n\n/* eslint-disable react/no-array-index-key */\nexport const TabForm = ({\n form,\n formErrors,\n genericInputProps,\n modifiedData,\n onChange,\n}: TabFormProps) => {\n const { formatMessage } = useIntl();\n\n return (\n <>\n {form.map((section, sectionIndex) => {\n // Don't display an empty section\n if (section.items.length === 0) {\n return null;\n }\n return (\n <Box key={sectionIndex}>\n {section.sectionTitle && (\n <Box paddingBottom={4}>\n <Typography variant=\"delta\" tag=\"h3\">\n {formatMessage(section.sectionTitle)}\n </Typography>\n </Box>\n )}\n {section.intlLabel && (\n <Typography variant=\"pi\" textColor=\"neutral600\">\n {formatMessage(section.intlLabel)}\n </Typography>\n )}\n\n <Grid.Root gap={4}>\n {section.items.map((input: any, i: number) => {\n const key = `${sectionIndex}.${i}`;\n\n /**\n * Use undefined as the default value because not every input wants a string e.g. Date pickers\n */\n const value = get(modifiedData, input.name, undefined);\n\n // When extending the yup schema of an existing field (like in https://github.com/strapi/strapi/blob/293ff3b8f9559236609d123a2774e3be05ce8274/packages/strapi-plugin-i18n/admin/src/index.js#L52)\n // and triggering a yup validation error in the UI (missing a required field for example)\n // We got an object that looks like: formErrors = { \"pluginOptions.i18n.localized\": {...} }\n // In order to deal with this error, we can't rely on lodash.get to resolve this key\n // - lodash will try to access {pluginOptions: {i18n: {localized: true}}})\n // - and we just want to access { \"pluginOptions.i18n.localized\": {...} }\n // NOTE: this is a hack\n const pluginOptionError = Object.keys(formErrors).find((key) => key === input.name);\n\n // Retrieve the error for a specific input\n const errorId = pluginOptionError\n ? formErrors[pluginOptionError].id\n : get(\n formErrors,\n [\n ...input.name\n .split('.')\n // The filter here is used when creating a component\n // in the component step 1 modal\n // Since the component info is stored in the\n // componentToCreate object we can access the error\n // By removing the key\n .filter((key: string) => key !== 'componentToCreate'),\n 'id',\n ],\n null\n );\n\n if (input.type === 'pushRight') {\n return (\n <Grid.Item\n col={input.size || 6}\n key={input.name || key}\n direction=\"column\"\n alignItems=\"stretch\"\n >\n <div />\n </Grid.Item>\n );\n }\n\n // Special handling for 'condition-form'\n if (input.type === 'condition-form') {\n const currentCondition = get(modifiedData, input.name);\n\n // Get all attributes from the content type schema\n const contentTypeAttributes =\n genericInputProps.contentTypeSchema?.attributes || [];\n\n if (!genericInputProps.contentTypeSchema) {\n console.warn('contentTypeSchema is undefined, skipping condition form');\n return null;\n }\n\n // Filter for boolean and enumeration fields only, excluding the current field\n const availableFields = getAvailableConditionFields(\n contentTypeAttributes,\n modifiedData.name\n );\n\n const noFieldsMessage = formatMessage({\n id: 'form.attribute.condition.no-fields',\n defaultMessage:\n 'No boolean or enumeration fields available to set conditions on.',\n });\n\n return (\n <Grid.Item\n col={input.size || 12}\n key={input.name || key}\n direction=\"column\"\n alignItems=\"stretch\"\n >\n {!currentCondition || Object.keys(currentCondition).length === 0 ? (\n <Box>\n {currentCondition && Object.keys(currentCondition).length > 0 && (\n <Typography variant=\"sigma\" textColor=\"neutral800\" marginBottom={2}>\n {formatCondition(\n currentCondition,\n availableFields,\n genericInputProps.attributeName || modifiedData.name\n )}\n </Typography>\n )}\n <Tooltip description={noFieldsMessage}>\n <Button\n marginTop={\n currentCondition && Object.keys(currentCondition).length > 0 ? 0 : 4\n }\n fullWidth={true}\n variant=\"secondary\"\n onClick={() => {\n onChange({\n target: {\n name: input.name,\n value: { visible: { '==': [{ var: '' }, ''] } },\n },\n });\n }}\n startIcon={<span aria-hidden>+</span>}\n disabled={availableFields.length === 0}\n >\n {formatMessage({\n id: 'form.attribute.condition.apply',\n defaultMessage: 'Apply condition',\n })}\n </Button>\n </Tooltip>\n </Box>\n ) : (\n <GenericInput\n {...input}\n {...genericInputProps}\n error={errorId}\n onChange={onChange}\n value={value}\n autoFocus={i === 0}\n attributeName={modifiedData.name}\n conditionFields={availableFields}\n onDelete={() => {\n onChange({\n target: {\n name: input.name,\n },\n });\n }}\n />\n )}\n </Grid.Item>\n );\n }\n\n // Default rendering for all other input types\n return (\n <Grid.Item\n col={input.size || 6}\n key={input.name || key}\n direction=\"column\"\n alignItems=\"stretch\"\n >\n <GenericInput\n {...input}\n {...genericInputProps}\n error={errorId}\n onChange={onChange}\n value={value}\n autoFocus={i === 0}\n />\n </Grid.Item>\n );\n })}\n </Grid.Root>\n </Box>\n );\n })}\n </>\n );\n};\n"],"names":["TabForm","form","formErrors","genericInputProps","modifiedData","onChange","formatMessage","useIntl","_jsx","_Fragment","map","section","sectionIndex","items","length","_jsxs","Box","sectionTitle","paddingBottom","Typography","variant","tag","intlLabel","textColor","Grid","Root","gap","input","i","key","value","get","name","undefined","pluginOptionError","Object","keys","find","errorId","id","split","filter","type","Item","col","size","direction","alignItems","div","currentCondition","contentTypeAttributes","contentTypeSchema","attributes","console","warn","availableFields","getAvailableConditionFields","noFieldsMessage","defaultMessage","marginBottom","formatCondition","attributeName","Tooltip","description","Button","marginTop","fullWidth","onClick","target","visible","var","startIcon","span","aria-hidden","disabled","GenericInput","error","autoFocus","conditionFields","onDelete"],"mappings":";;;;;;;AAgBA,8CACaA,MAAAA,OAAAA,GAAU,CAAC,EACtBC,IAAI,EACJC,UAAU,EACVC,iBAAiB,EACjBC,YAAY,EACZC,QAAQ,EACK,GAAA;IACb,MAAM,EAAEC,aAAa,EAAE,GAAGC,OAAAA,EAAAA;IAE1B,qBACEC,GAAA,CAAAC,QAAA,EAAA;kBACGR,IAAKS,CAAAA,GAAG,CAAC,CAACC,OAASC,EAAAA,YAAAA,GAAAA;;AAElB,YAAA,IAAID,OAAQE,CAAAA,KAAK,CAACC,MAAM,KAAK,CAAG,EAAA;gBAC9B,OAAO,IAAA;AACT;AACA,YAAA,qBACEC,IAACC,CAAAA,GAAAA,EAAAA;;oBACEL,OAAQM,CAAAA,YAAY,kBACnBT,GAACQ,CAAAA,GAAAA,EAAAA;wBAAIE,aAAe,EAAA,CAAA;AAClB,wBAAA,QAAA,gBAAAV,GAACW,CAAAA,UAAAA,EAAAA;4BAAWC,OAAQ,EAAA,OAAA;4BAAQC,GAAI,EAAA,IAAA;AAC7Bf,4BAAAA,QAAAA,EAAAA,aAAAA,CAAcK,QAAQM,YAAY;;;oBAIxCN,OAAQW,CAAAA,SAAS,kBAChBd,GAACW,CAAAA,UAAAA,EAAAA;wBAAWC,OAAQ,EAAA,IAAA;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DCL,iCAAAA,EAAAA,KAAAA,CAAMK,IAAI,IAAIH,GAAAA,CAAAA;AA6DzB;;4BAGA,qBACErB,GAAA,CAACgB,KAAKmB,IAAI,EAAA;gCACRC,GAAKjB,EAAAA,KAAAA,CAAMkB,IAAI,IAAI,CAAA;gCAEnBC,SAAU,EAAA,QAAA;gCACVC,UAAW,EAAA,SAAA;AAEX,gCAAA,QAAA,gBAAAvC,GAACmE,CAAAA,oBAAAA,EAAAA;AACE,oCAAA,GAAGhD,KAAK;AACR,oCAAA,GAAGxB,iBAAiB;oCACrByE,KAAOtC,EAAAA,OAAAA;oCACPjC,QAAUA,EAAAA,QAAAA;oCACVyB,KAAOA,EAAAA,KAAAA;AACP+C,oCAAAA,SAAAA,EAAWjD,CAAM,KAAA;;AAVdD,6BAAAA,EAAAA,KAAAA,CAAMK,IAAI,IAAIH,GAAAA,CAAAA;AAczB,yBAAA;;;AA7KMjB,aAAAA,EAAAA,YAAAA,CAAAA;AAiLd,SAAA;;AAGN;;;;"}
@@ -0,0 +1,8 @@
1
+ interface ApplyConditionButtonProps {
2
+ disabled?: boolean;
3
+ tooltipMessage?: string;
4
+ onClick?: () => void;
5
+ marginTop?: number;
6
+ }
7
+ export declare const ApplyConditionButton: ({ disabled, tooltipMessage, onClick, marginTop, }: ApplyConditionButtonProps) => import("react/jsx-runtime").JSX.Element;
8
+ export {};
@@ -0,0 +1,23 @@
1
+ interface ConditionFormProps {
2
+ name: string;
3
+ value: any;
4
+ onChange: (e: {
5
+ target: {
6
+ name: string;
7
+ value: any;
8
+ };
9
+ }) => void;
10
+ onDelete: () => void;
11
+ attributeName?: string;
12
+ conditionFields?: Array<{
13
+ name: string;
14
+ type: string;
15
+ enum?: string[];
16
+ }>;
17
+ allAttributes?: Array<{
18
+ name: string;
19
+ type: string;
20
+ }>;
21
+ }
22
+ export declare const ConditionForm: ({ name, value, onChange, onDelete, attributeName, conditionFields, }: ConditionFormProps) => import("react/jsx-runtime").JSX.Element;
23
+ export {};
@@ -1,7 +1,27 @@
1
1
  type DataType = 'biginteger' | 'string' | 'integer' | 'float' | 'decimal';
2
2
  export declare const advancedForm: {
3
3
  blocks(): {
4
- sections: {
4
+ sections: ({
5
+ sectionTitle: {
6
+ id: string;
7
+ defaultMessage: string;
8
+ };
9
+ intlLabel: {
10
+ id: string;
11
+ defaultMessage: string;
12
+ };
13
+ items: {
14
+ name: string;
15
+ type: string;
16
+ intlLabel: {
17
+ id: string;
18
+ defaultMessage: string;
19
+ };
20
+ validations: {
21
+ required: boolean;
22
+ };
23
+ }[];
24
+ } | {
5
25
  sectionTitle: {
6
26
  id: string;
7
27
  defaultMessage: string;
@@ -18,10 +38,30 @@ export declare const advancedForm: {
18
38
  defaultMessage: string;
19
39
  };
20
40
  }[];
21
- }[];
41
+ })[];
22
42
  };
23
43
  boolean(): {
24
44
  sections: ({
45
+ sectionTitle: {
46
+ id: string;
47
+ defaultMessage: string;
48
+ };
49
+ intlLabel: {
50
+ id: string;
51
+ defaultMessage: string;
52
+ };
53
+ items: {
54
+ name: string;
55
+ type: string;
56
+ intlLabel: {
57
+ id: string;
58
+ defaultMessage: string;
59
+ };
60
+ validations: {
61
+ required: boolean;
62
+ };
63
+ }[];
64
+ } | {
25
65
  sectionTitle: null;
26
66
  items: {
27
67
  autoFocus: boolean;
@@ -70,6 +110,26 @@ export declare const advancedForm: {
70
110
  type: string;
71
111
  }): {
72
112
  sections: ({
113
+ sectionTitle: {
114
+ id: string;
115
+ defaultMessage: string;
116
+ };
117
+ intlLabel: {
118
+ id: string;
119
+ defaultMessage: string;
120
+ };
121
+ items: {
122
+ name: string;
123
+ type: string;
124
+ intlLabel: {
125
+ id: string;
126
+ defaultMessage: string;
127
+ };
128
+ validations: {
129
+ required: boolean;
130
+ };
131
+ }[];
132
+ } | {
73
133
  sectionTitle: null;
74
134
  items: {
75
135
  type: string;
@@ -103,11 +163,15 @@ export declare const advancedForm: {
103
163
  })[];
104
164
  };
105
165
  dynamiczone(): {
106
- sections: {
166
+ sections: ({
107
167
  sectionTitle: {
108
168
  id: string;
109
169
  defaultMessage: string;
110
170
  };
171
+ intlLabel: {
172
+ id: string;
173
+ defaultMessage: string;
174
+ };
111
175
  items: {
112
176
  name: string;
113
177
  type: string;
@@ -115,11 +179,47 @@ export declare const advancedForm: {
115
179
  id: string;
116
180
  defaultMessage: string;
117
181
  };
182
+ validations: {
183
+ required: boolean;
184
+ };
118
185
  }[];
119
- }[];
186
+ } | {
187
+ sectionTitle: {
188
+ id: string;
189
+ defaultMessage: string;
190
+ };
191
+ items: {
192
+ name: string;
193
+ type: string;
194
+ intlLabel: {
195
+ id: string;
196
+ defaultMessage: string;
197
+ };
198
+ }[];
199
+ })[];
120
200
  };
121
201
  email(): {
122
202
  sections: ({
203
+ sectionTitle: {
204
+ id: string;
205
+ defaultMessage: string;
206
+ };
207
+ intlLabel: {
208
+ id: string;
209
+ defaultMessage: string;
210
+ };
211
+ items: {
212
+ name: string;
213
+ type: string;
214
+ intlLabel: {
215
+ id: string;
216
+ defaultMessage: string;
217
+ };
218
+ validations: {
219
+ required: boolean;
220
+ };
221
+ }[];
222
+ } | {
123
223
  sectionTitle: null;
124
224
  items: {
125
225
  type: string;
@@ -148,6 +248,26 @@ export declare const advancedForm: {
148
248
  enum: Array<string>;
149
249
  }): {
150
250
  sections: ({
251
+ sectionTitle: {
252
+ id: string;
253
+ defaultMessage: string;
254
+ };
255
+ intlLabel: {
256
+ id: string;
257
+ defaultMessage: string;
258
+ };
259
+ items: {
260
+ name: string;
261
+ type: string;
262
+ intlLabel: {
263
+ id: string;
264
+ defaultMessage: string;
265
+ };
266
+ validations: {
267
+ required: boolean;
268
+ };
269
+ }[];
270
+ } | {
151
271
  sectionTitle: null;
152
272
  items: ({
153
273
  name: string;
@@ -202,7 +322,27 @@ export declare const advancedForm: {
202
322
  })[];
203
323
  };
204
324
  json(): {
205
- sections: {
325
+ sections: ({
326
+ sectionTitle: {
327
+ id: string;
328
+ defaultMessage: string;
329
+ };
330
+ intlLabel: {
331
+ id: string;
332
+ defaultMessage: string;
333
+ };
334
+ items: {
335
+ name: string;
336
+ type: string;
337
+ intlLabel: {
338
+ id: string;
339
+ defaultMessage: string;
340
+ };
341
+ validations: {
342
+ required: boolean;
343
+ };
344
+ }[];
345
+ } | {
206
346
  sectionTitle: {
207
347
  id: string;
208
348
  defaultMessage: string;
@@ -219,10 +359,30 @@ export declare const advancedForm: {
219
359
  defaultMessage: string;
220
360
  };
221
361
  }[];
222
- }[];
362
+ })[];
223
363
  };
224
364
  media(): {
225
365
  sections: ({
366
+ sectionTitle: {
367
+ id: string;
368
+ defaultMessage: string;
369
+ };
370
+ intlLabel: {
371
+ id: string;
372
+ defaultMessage: string;
373
+ };
374
+ items: {
375
+ name: string;
376
+ type: string;
377
+ intlLabel: {
378
+ id: string;
379
+ defaultMessage: string;
380
+ };
381
+ validations: {
382
+ required: boolean;
383
+ };
384
+ }[];
385
+ } | {
226
386
  sectionTitle: null;
227
387
  items: {
228
388
  intlLabel: {
@@ -258,6 +418,26 @@ export declare const advancedForm: {
258
418
  type: DataType;
259
419
  }): {
260
420
  sections: ({
421
+ sectionTitle: {
422
+ id: string;
423
+ defaultMessage: string;
424
+ };
425
+ intlLabel: {
426
+ id: string;
427
+ defaultMessage: string;
428
+ };
429
+ items: {
430
+ name: string;
431
+ type: string;
432
+ intlLabel: {
433
+ id: string;
434
+ defaultMessage: string;
435
+ };
436
+ validations: {
437
+ required: boolean;
438
+ };
439
+ }[];
440
+ } | {
261
441
  sectionTitle: null;
262
442
  items: {
263
443
  autoFocus: boolean;
@@ -287,6 +467,26 @@ export declare const advancedForm: {
287
467
  };
288
468
  password(): {
289
469
  sections: ({
470
+ sectionTitle: {
471
+ id: string;
472
+ defaultMessage: string;
473
+ };
474
+ intlLabel: {
475
+ id: string;
476
+ defaultMessage: string;
477
+ };
478
+ items: {
479
+ name: string;
480
+ type: string;
481
+ intlLabel: {
482
+ id: string;
483
+ defaultMessage: string;
484
+ };
485
+ validations: {
486
+ required: boolean;
487
+ };
488
+ }[];
489
+ } | {
290
490
  sectionTitle: null;
291
491
  items: {
292
492
  name: string;
@@ -312,7 +512,27 @@ export declare const advancedForm: {
312
512
  })[];
313
513
  };
314
514
  relation(): {
315
- sections: {
515
+ sections: ({
516
+ sectionTitle: {
517
+ id: string;
518
+ defaultMessage: string;
519
+ };
520
+ intlLabel: {
521
+ id: string;
522
+ defaultMessage: string;
523
+ };
524
+ items: {
525
+ name: string;
526
+ type: string;
527
+ intlLabel: {
528
+ id: string;
529
+ defaultMessage: string;
530
+ };
531
+ validations: {
532
+ required: boolean;
533
+ };
534
+ }[];
535
+ } | {
316
536
  sectionTitle: {
317
537
  id: string;
318
538
  defaultMessage: string;
@@ -329,10 +549,30 @@ export declare const advancedForm: {
329
549
  defaultMessage: string;
330
550
  };
331
551
  }[];
332
- }[];
552
+ })[];
333
553
  };
334
554
  richtext(): {
335
555
  sections: ({
556
+ sectionTitle: {
557
+ id: string;
558
+ defaultMessage: string;
559
+ };
560
+ intlLabel: {
561
+ id: string;
562
+ defaultMessage: string;
563
+ };
564
+ items: {
565
+ name: string;
566
+ type: string;
567
+ intlLabel: {
568
+ id: string;
569
+ defaultMessage: string;
570
+ };
571
+ validations: {
572
+ required: boolean;
573
+ };
574
+ }[];
575
+ } | {
336
576
  sectionTitle: null;
337
577
  items: {
338
578
  name: string;
@@ -359,6 +599,26 @@ export declare const advancedForm: {
359
599
  };
360
600
  text(): {
361
601
  sections: ({
602
+ sectionTitle: {
603
+ id: string;
604
+ defaultMessage: string;
605
+ };
606
+ intlLabel: {
607
+ id: string;
608
+ defaultMessage: string;
609
+ };
610
+ items: {
611
+ name: string;
612
+ type: string;
613
+ intlLabel: {
614
+ id: string;
615
+ defaultMessage: string;
616
+ };
617
+ validations: {
618
+ required: boolean;
619
+ };
620
+ }[];
621
+ } | {
362
622
  sectionTitle: null;
363
623
  items: {
364
624
  name: string;
@@ -387,6 +647,26 @@ export declare const advancedForm: {
387
647
  targetField: string;
388
648
  }): {
389
649
  sections: ({
650
+ sectionTitle: {
651
+ id: string;
652
+ defaultMessage: string;
653
+ };
654
+ intlLabel: {
655
+ id: string;
656
+ defaultMessage: string;
657
+ };
658
+ items: {
659
+ name: string;
660
+ type: string;
661
+ intlLabel: {
662
+ id: string;
663
+ defaultMessage: string;
664
+ };
665
+ validations: {
666
+ required: boolean;
667
+ };
668
+ }[];
669
+ } | {
390
670
  sectionTitle: null;
391
671
  items: {
392
672
  disabled: boolean;