@webiny/app-headless-cms 0.0.0-unstable.5e7233243f → 0.0.0-unstable.fcdad0bc61

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 (33) hide show
  1. package/admin/components/ContentEntryForm/Label.js +1 -1
  2. package/admin/components/ContentEntryForm/Label.js.map +1 -1
  3. package/admin/constants/statusLabels.js +2 -4
  4. package/admin/constants/statusLabels.js.map +1 -1
  5. package/admin/graphql/contentEntries.d.ts +0 -28
  6. package/admin/graphql/contentEntries.js +5 -29
  7. package/admin/graphql/contentEntries.js.map +1 -1
  8. package/admin/hooks/usePermission.d.ts +0 -2
  9. package/admin/hooks/usePermission.js +0 -36
  10. package/admin/hooks/usePermission.js.map +1 -1
  11. package/admin/menus/NothingToShowElement.js +4 -1
  12. package/admin/menus/NothingToShowElement.js.map +1 -1
  13. package/admin/plugins/editor/defaultBar/FormSettings/FormSettings.js +1 -1
  14. package/admin/plugins/editor/defaultBar/FormSettings/FormSettings.js.map +1 -1
  15. package/admin/plugins/permissionRenderer/components/ContentEntryPermission.js +11 -17
  16. package/admin/plugins/permissionRenderer/components/ContentEntryPermission.js.map +1 -1
  17. package/admin/views/contentEntries/ContentEntriesList.js +1 -1
  18. package/admin/views/contentEntries/ContentEntriesList.js.map +1 -1
  19. package/admin/views/contentEntries/ContentEntry/header/requestChanges/RequestChanges.d.ts +1 -1
  20. package/admin/views/contentEntries/ContentEntry/header/requestChanges/RequestChanges.js +3 -80
  21. package/admin/views/contentEntries/ContentEntry/header/requestChanges/RequestChanges.js.map +1 -1
  22. package/admin/views/contentEntries/ContentEntry/header/requestReview/RequestReview.d.ts +1 -1
  23. package/admin/views/contentEntries/ContentEntry/header/requestReview/RequestReview.js +3 -84
  24. package/admin/views/contentEntries/ContentEntry/header/requestReview/RequestReview.js.map +1 -1
  25. package/admin/views/contentEntries/ContentEntry/useRevision.d.ts +0 -8
  26. package/admin/views/contentEntries/ContentEntry/useRevision.js +4 -105
  27. package/admin/views/contentEntries/ContentEntry/useRevision.js.map +1 -1
  28. package/admin/views/contentEntries/experiment/ContentEntriesModule.d.ts +2 -2
  29. package/admin/views/contentEntries/experiment/ContentEntriesModule.js +13 -7
  30. package/admin/views/contentEntries/experiment/ContentEntriesModule.js.map +1 -1
  31. package/package.json +28 -28
  32. package/types.d.ts +9 -1
  33. package/types.js.map +1 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webiny/app-headless-cms",
3
- "version": "0.0.0-unstable.5e7233243f",
3
+ "version": "0.0.0-unstable.fcdad0bc61",
4
4
  "main": "index.js",
5
5
  "repository": {
6
6
  "type": "git",
@@ -15,37 +15,37 @@
15
15
  "dependencies": {
16
16
  "@apollo/react-common": "3.1.4",
17
17
  "@apollo/react-hooks": "3.1.5",
18
- "@babel/runtime": "7.18.9",
18
+ "@babel/runtime": "7.19.0",
19
19
  "@emotion/core": "10.3.1",
20
20
  "@emotion/styled": "10.3.0",
21
21
  "@fortawesome/fontawesome-common-types": "0.3.0",
22
22
  "@fortawesome/fontawesome-svg-core": "1.3.0",
23
- "@fortawesome/free-brands-svg-icons": "6.1.2",
24
- "@fortawesome/free-regular-svg-icons": "6.1.2",
25
- "@fortawesome/free-solid-svg-icons": "6.1.2",
23
+ "@fortawesome/free-brands-svg-icons": "6.2.0",
24
+ "@fortawesome/free-regular-svg-icons": "6.2.0",
25
+ "@fortawesome/free-solid-svg-icons": "6.2.0",
26
26
  "@fortawesome/react-fontawesome": "0.1.19",
27
- "@svgr/webpack": "6.3.1",
27
+ "@svgr/webpack": "6.4.0",
28
28
  "@types/react": "17.0.39",
29
- "@webiny/app": "0.0.0-unstable.5e7233243f",
30
- "@webiny/app-admin": "0.0.0-unstable.5e7233243f",
31
- "@webiny/app-graphql-playground": "0.0.0-unstable.5e7233243f",
32
- "@webiny/app-i18n": "0.0.0-unstable.5e7233243f",
33
- "@webiny/app-plugin-admin-welcome-screen": "0.0.0-unstable.5e7233243f",
34
- "@webiny/app-security": "0.0.0-unstable.5e7233243f",
35
- "@webiny/error": "0.0.0-unstable.5e7233243f",
36
- "@webiny/form": "0.0.0-unstable.5e7233243f",
37
- "@webiny/plugins": "0.0.0-unstable.5e7233243f",
38
- "@webiny/react-composition": "0.0.0-unstable.5e7233243f",
39
- "@webiny/react-router": "0.0.0-unstable.5e7233243f",
40
- "@webiny/ui": "0.0.0-unstable.5e7233243f",
41
- "@webiny/utils": "0.0.0-unstable.5e7233243f",
42
- "@webiny/validation": "0.0.0-unstable.5e7233243f",
29
+ "@webiny/app": "0.0.0-unstable.fcdad0bc61",
30
+ "@webiny/app-admin": "0.0.0-unstable.fcdad0bc61",
31
+ "@webiny/app-graphql-playground": "0.0.0-unstable.fcdad0bc61",
32
+ "@webiny/app-i18n": "0.0.0-unstable.fcdad0bc61",
33
+ "@webiny/app-plugin-admin-welcome-screen": "0.0.0-unstable.fcdad0bc61",
34
+ "@webiny/app-security": "0.0.0-unstable.fcdad0bc61",
35
+ "@webiny/error": "0.0.0-unstable.fcdad0bc61",
36
+ "@webiny/form": "0.0.0-unstable.fcdad0bc61",
37
+ "@webiny/plugins": "0.0.0-unstable.fcdad0bc61",
38
+ "@webiny/react-composition": "0.0.0-unstable.fcdad0bc61",
39
+ "@webiny/react-router": "0.0.0-unstable.fcdad0bc61",
40
+ "@webiny/ui": "0.0.0-unstable.fcdad0bc61",
41
+ "@webiny/utils": "0.0.0-unstable.fcdad0bc61",
42
+ "@webiny/validation": "0.0.0-unstable.fcdad0bc61",
43
43
  "apollo-cache": "1.3.5",
44
44
  "apollo-client": "2.6.10",
45
45
  "apollo-link": "1.2.14",
46
46
  "apollo-link-batch-http": "1.2.14",
47
47
  "apollo-utilities": "1.3.4",
48
- "classnames": "2.3.1",
48
+ "classnames": "2.3.2",
49
49
  "dot-prop-immutable": "2.1.1",
50
50
  "emotion": "10.0.27",
51
51
  "graphql": "15.8.0",
@@ -67,13 +67,13 @@
67
67
  "use-deep-compare-effect": "1.8.1"
68
68
  },
69
69
  "devDependencies": {
70
- "@babel/cli": "^7.16.0",
71
- "@babel/core": "^7.16.0",
72
- "@babel/preset-env": "^7.16.4",
70
+ "@babel/cli": "^7.19.3",
71
+ "@babel/core": "^7.19.3",
72
+ "@babel/preset-env": "^7.19.4",
73
73
  "@babel/preset-react": "^7.16.0",
74
- "@babel/preset-typescript": "^7.16.0",
75
- "@webiny/cli": "^0.0.0-unstable.5e7233243f",
76
- "@webiny/project-utils": "^0.0.0-unstable.5e7233243f",
74
+ "@babel/preset-typescript": "^7.18.6",
75
+ "@webiny/cli": "^0.0.0-unstable.fcdad0bc61",
76
+ "@webiny/project-utils": "^0.0.0-unstable.fcdad0bc61",
77
77
  "babel-plugin-emotion": "^9.2.8",
78
78
  "babel-plugin-lodash": "^3.3.4",
79
79
  "babel-plugin-module-resolver": "^4.1.0",
@@ -104,5 +104,5 @@
104
104
  ]
105
105
  }
106
106
  },
107
- "gitHead": "995a4b337db9b8497c6615e335dcd206afe26f8f"
107
+ "gitHead": "40d639c3665e384a5e2d26674d43ce26f3295e8c"
108
108
  }
package/types.d.ts CHANGED
@@ -297,7 +297,7 @@ export interface CmsEditorContentModel {
297
297
  */
298
298
  plugin?: boolean;
299
299
  }
300
- export declare type CmsContentEntryStatusType = "draft" | "published" | "unpublished" | "changesRequested" | "reviewRequested";
300
+ export declare type CmsContentEntryStatusType = "draft" | "published" | "unpublished";
301
301
  export interface CmsEditorContentEntry {
302
302
  id: string;
303
303
  savedOn: string;
@@ -582,4 +582,12 @@ interface BindComponentProps extends Omit<BaseBindComponentProps, "children" | "
582
582
  export declare type BindComponent = React.FC<BindComponentProps> & {
583
583
  parentName?: string;
584
584
  };
585
+ /**
586
+ * After RequestReview and RequestChanges was removed, we need an option to add new status filters
587
+ */
588
+ export interface CmsEntryFilterStatusPlugin extends Plugin {
589
+ type: "cms.entry.filter.status";
590
+ label: string;
591
+ value: string;
592
+ }
585
593
  export {};
package/types.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"names":[],"sources":["types.ts"],"sourcesContent":["import * as React from \"react\";\nimport { Plugin } from \"@webiny/plugins/types\";\nimport { ReactElement, ReactNode } from \"react\";\nimport {\n FormRenderPropParams,\n FormAPI,\n BindComponent as BaseBindComponent,\n BindComponentRenderProp as BaseBindComponentRenderProp,\n BindComponentProps as BaseBindComponentProps\n} from \"@webiny/form\";\nimport { ApolloClient } from \"apollo-client\";\nimport { IconPrefix, IconName } from \"@fortawesome/fontawesome-svg-core\";\nimport Label from \"./admin/components/ContentEntryForm/Label\";\nimport { SecurityPermission } from \"@webiny/app-security/types\";\n\ninterface QueryFieldParams {\n field: CmsEditorField;\n}\n\nexport interface CmsEditorFieldTypePlugin extends Plugin {\n /**\n * a plugin type\n */\n type: \"cms-editor-field-type\";\n field: {\n /**\n * A unique identifier of the field type (text, number, json, myField, ...).\n *\n * ```ts\n * type: \"myField\"\n * ```\n */\n type: string;\n /**\n * A display name for the field.\n *\n * ```ts\n * label: \"Field name\"\n * ```\n */\n label: string;\n /**\n * A list of available validators for the model field.\n *\n * ```ts\n * validators: [\n * \"required\",\n * \"gte\",\n * \"lte\"\n * ]\n * ```\n */\n validators?: string[];\n /**\n * A list of available validators when a model field accepts a list (array) of values.\n *\n * ```ts\n * listValidators: [\n * \"minLength\",\n * \"maxLength\"\n * ]\n * ```\n */\n listValidators?: string[];\n /**\n * An explanation of the field displayed beneath the label.\n *\n * ```ts\n * description: \"A short description of the field\"\n * ```\n */\n description: string;\n /**\n * A ReactNode to display the icon for the field.\n *\n * ```tsx\n * icon: <MyIconComponent />\n * ```\n */\n icon: React.ReactNode;\n /**\n * Is it allowed to have multiple values in this field?\n *\n * ```ts\n * allowMultipleValues: true\n * ```\n */\n allowMultipleValues: boolean;\n /**\n * Does this field type have a fixed list of values that can be selected?\n *\n * ```ts\n * allowPredefinedValues: false\n * ```\n */\n allowPredefinedValues: boolean;\n /**\n * A ReactNode label when multiple values are enabled.\n */\n multipleValuesLabel: React.ReactNode;\n /**\n * These are default values when the field is first created. This is a representation of the field that is stored in the database.\n *\n * ```ts\n * createField: () => ({\n * type: \"fieldType\",\n * validation: [],\n * renderer: {\n * name: \"fieldTypeRenderer\"\n * }\n * })\n * ```\n */\n createField: () => Pick<CmsEditorField, \"type\" | \"validation\" | \"renderer\" | \"settings\">;\n /**\n * A ReactNode that you can add in the section below the help text when creating/editing field.\n *\n * ```tsx\n * renderSettings: (params) => {\n * return <FieldSettingsComponent />;\n * }\n * ```\n */\n renderSettings?: (params: {\n form: FormRenderPropParams;\n afterChangeLabel: (value: string) => void;\n uniqueFieldIdValidator: (fieldId: string) => void;\n contentModel: CmsEditorContentModel;\n }) => React.ReactNode;\n /**\n * A ReactNode that renders in the Predefined values tab.\n *\n * ```tsx\n * renderPredefinedValues: (params) => {\n * const {form: {Bind}} = params;\n * return (\n * <Bind name=\"fieldProperty\">\n * <InputComponent />\n * </Bind>\n * );\n * }\n * ```\n */\n renderPredefinedValues?: (params: {\n form: FormRenderPropParams;\n field: CmsEditorField;\n getBind: (index?: number) => any;\n }) => React.ReactElement;\n /**\n * Object wrapper for GraphQL stuff\n */\n graphql?: {\n /**\n * Define field selection.\n *\n * ```ts\n * graphql: {\n * queryField: `\n * {\n * id\n * title\n * createdOn\n * }\n * `,\n * }\n * ```\n */\n queryField?: string | ((params: QueryFieldParams) => string);\n };\n render?(params: any): React.ReactElement;\n };\n}\n\nexport interface CmsEditorFieldRendererProps {\n field: CmsEditorField;\n Label: typeof Label;\n getBind: (index?: number, key?: string) => BindComponent;\n contentModel: CmsEditorContentModel;\n}\n\nexport interface CmsEditorFieldRendererPlugin extends Plugin {\n /**\n * a plugin type\n */\n type: \"cms-editor-field-renderer\";\n renderer: {\n /**\n * Name of the renderer to match the one from `createField()` method in `CmsEditorFieldTypePlugin`.\n *\n * ```ts\n * renderName: \"myFieldTypeRenderer\"\n * ```\n */\n rendererName: string;\n /**\n * A display name for the field in the UI. It is a `ReactNode` type so you can return a component if you want to.\n *\n * ```tsx\n * name: <MyFieldNameComponent />\n * ```\n */\n name: React.ReactNode;\n /**\n * A description for the field in the UI. Works exactly like the `name` property.\n *\n * ```tsx\n * name: <MyFieldDescriptionComponent />\n * ```\n */\n description: React.ReactNode;\n /**\n * A method that determines if the field can be rendered by this plugin.\n *\n * ```ts\n * canUse({ field }) {\n * return (\n * field.type === \"myType\" && !field.multipleValues\n * );\n * }\n * ```\n */\n canUse(props: { field: CmsEditorField }): boolean;\n /**\n * Renders a field in the UI.\n *\n * ```tsx\n * render({ field, getBind }) {\n * const Bind = getBind();\n *\n * return (\n * <Bind>\n * {bind => {\n * return (\n * <Input\n * value={bind.value}\n * onChange={bind.onChange}\n * />\n * )\n * }}\n * </Bind>\n * );\n * }\n * ```\n */\n render(props: CmsEditorFieldRendererProps): React.ReactNode;\n };\n}\n\nexport interface CmsEditorFieldPredefinedValuesEntry {\n label: string;\n value: string;\n selected?: boolean;\n}\n\nexport interface CmsEditorFieldPredefinedValues {\n enabled: boolean;\n values: CmsEditorFieldPredefinedValuesEntry[];\n}\n\nexport type CmsEditorField<T = unknown> = T & {\n id: string;\n type: string;\n fieldId: CmsEditorFieldId;\n storageId?: string;\n label?: string;\n helpText?: string;\n placeholderText?: string;\n validation?: CmsEditorFieldValidator[];\n listValidation?: CmsEditorFieldValidator[];\n multipleValues?: boolean;\n predefinedValues?: CmsEditorFieldPredefinedValues;\n settings?: {\n defaultValue?: string | null | undefined;\n defaultSetValue?: string;\n type?: string;\n fields?: CmsEditorField<any>[];\n layout?: string[][];\n models?: Pick<CmsModel, \"modelId\" | \"name\">[];\n imagesOnly?: boolean;\n [key: string]: any;\n };\n renderer: {\n name: string;\n };\n};\n\nexport type CmsEditorFieldId = string;\nexport type CmsEditorFieldsLayout = CmsEditorFieldId[][];\n\nexport interface CmsEditorContentModel {\n id: string;\n group: Pick<CmsGroup, \"id\" | \"name\">;\n description?: string;\n version: number;\n layout?: CmsEditorFieldsLayout;\n fields: CmsEditorField[];\n lockedFields: CmsEditorField[];\n name: string;\n modelId: string;\n titleFieldId: string;\n settings: {\n [key: string]: any;\n };\n status: string;\n savedOn: string;\n meta: any;\n createdBy: CmsCreatedBy;\n /**\n * If model is a plugin one (it cannot be changed/deleted)\n */\n plugin?: boolean;\n}\n\nexport type CmsContentEntryStatusType =\n | \"draft\"\n | \"published\"\n | \"unpublished\"\n | \"changesRequested\"\n | \"reviewRequested\";\n\nexport interface CmsEditorContentEntry {\n id: string;\n savedOn: string;\n modelId: string;\n createdBy: CmsCreatedBy;\n meta: {\n title: string;\n publishedOn: string;\n locked: boolean;\n status: CmsContentEntryStatusType;\n version: number;\n };\n [key: string]: any;\n}\n\nexport interface CmsContentEntryRevision {\n id: string;\n savedOn: string;\n modelId: string;\n createdBy: CmsCreatedBy;\n meta: {\n title: string;\n publishedOn: string;\n locked: boolean;\n status: CmsContentEntryStatusType;\n version: number;\n };\n}\n\nexport interface CmsEditorFieldValidator {\n name: string;\n message: string;\n settings: any;\n}\n\nexport interface CmsEditorFieldValidatorPluginValidator {\n name: string;\n label: string;\n description: string;\n defaultMessage: string;\n defaultSettings?: Record<string, any>;\n renderSettings?: (props: {\n field: CmsEditorField;\n Bind: BindComponent;\n setValue: (name: string, value: any) => void;\n setMessage: (message: string) => void;\n data: CmsEditorFieldValidator;\n }) => React.ReactElement;\n}\nexport interface CmsEditorFieldValidatorPlugin extends Plugin {\n type: \"cms-editor-field-validator\";\n validator: CmsEditorFieldValidatorPluginValidator;\n}\n\nexport type CmsEditorContentTab = React.FC<{ activeTab: boolean }>;\n\n// ------------------------------------------------------------------------------------------------------------\nexport interface CmsEditorFieldOptionPlugin extends Plugin {\n type: \"cms-editor-field-option\";\n render(): ReactElement;\n}\n\nexport interface CmsContentDetailsPlugin extends Plugin {\n render: (params: any) => ReactNode;\n}\n\nexport interface CmsContentDetailsRevisionContentPlugin extends Plugin {\n type: \"cms-content-details-revision-content\";\n render(params: any): ReactElement;\n}\n\nexport interface CmsEditorFieldValidatorPatternPlugin extends Plugin {\n type: \"cms-editor-field-validator-pattern\";\n pattern: {\n name: string;\n message: string;\n label: string;\n };\n}\n\nexport interface CmsFieldValidator {\n name: string;\n message: any;\n settings: any;\n}\n\nexport interface CmsModelFieldValidatorPlugin<T = any> extends Plugin {\n type: \"cms-model-field-validator\";\n validator: {\n name: string;\n validate: (value: T, validator: CmsFieldValidator) => Promise<any>;\n };\n}\n\n/**\n * @category Plugin\n * @category ContentModelField\n * @category FieldValidation\n */\nexport interface CmsModelFieldValidatorPatternPlugin extends Plugin {\n /**\n * A plugin type\n */\n type: \"cms-model-field-validator-pattern\";\n /**\n * A pattern object for the validator.\n */\n pattern: {\n /**\n * name of the pattern.\n */\n name: string;\n /**\n * RegExp of the validator.\n */\n regex: string;\n /**\n * RegExp flags\n */\n flags: string;\n };\n}\n\nexport interface FieldLayoutPosition {\n row: number;\n index: number | null;\n}\n\nexport interface CmsEditorFormSettingsPlugin extends Plugin {\n type: \"cms-editor-form-settings\";\n title: string;\n description: string;\n icon: React.ReactElement;\n render(props: { Bind: BaseBindComponent; form: FormAPI; formData: any }): React.ReactNode;\n renderHeaderActions?(props: {\n Bind: BaseBindComponent;\n form: FormAPI;\n formData: any;\n }): React.ReactNode;\n}\n\nexport interface CmsIcon {\n /**\n * [ pack, icon ], ex: [\"fab\", \"cog\"]\n */\n id: [IconPrefix, IconName];\n /**\n * Icon name\n */\n name: string;\n /**\n * SVG element\n */\n svg: ReactElement;\n}\n\nexport interface CmsIconsPlugin extends Plugin {\n type: \"cms-icons\";\n getIcons(): CmsIcon[];\n}\n\nexport interface UseContentModelEditorReducerState {\n apolloClient: ApolloClient<any>;\n id: string;\n}\n\n/**\n * Transform field value when sending data to the API.\n */\nexport interface CmsFieldValueTransformer extends Plugin {\n /**\n * A plugin type.\n */\n type: \"cms-field-value-transformer\";\n /**\n * A field type for the value transformer. Or a list of field types.\n */\n fieldType: string | string[];\n /**\n * A transformer function that takes a value and returns a new one.\n */\n transform: (value: any, field: CmsEditorField) => any;\n}\n\n/**\n * Define a custom form layout renderer for a specific content model.\n */\nexport interface CmsContentFormRendererPlugin extends Plugin {\n /**\n * A plugin type.\n */\n type: \"cms-content-form-renderer\";\n /**\n * Content model ID that will use this renderer.\n */\n modelId: string;\n\n /**\n * A function that will render a custom form layout.\n */\n render(props: {\n /**\n * Content model that is being rendered.\n */\n contentModel: CmsEditorContentModel;\n /**\n * Content entry data handled by the Form element.\n */\n data: Record<string, any>;\n /**\n * A component to bind data to the Form.\n */\n Bind: BindComponent;\n /**\n * Content model fields to render.\n */\n fields: Record<string, React.ReactElement>;\n }): React.ReactNode;\n}\n/**\n * #########################\n * Data types\n * #########################\n */\nexport interface CmsSecurityPermission extends SecurityPermission {\n accessLevel?: \"full\" | \"no\" | \"custom\";\n models?: Record<string, string>;\n groups?: Record<string, string>;\n endpoints?: string[];\n locales?: string[];\n rwd?: string;\n own?: boolean;\n pw?: string;\n}\nexport interface CmsCreatedBy {\n id: string;\n displayName: string;\n type: string;\n}\n/**\n * @category GraphQL\n * @category Model\n */\nexport type CmsModel = CmsEditorContentModel;\n/**\n * @category GraphQL\n * @category Group\n */\nexport interface CmsGroup {\n id: string;\n name: string;\n slug: string;\n icon?: string;\n description?: string;\n contentModels: CmsModel[];\n createdBy: CmsCreatedBy;\n /**\n * Tells if this group is a plugin one (cannot be changed/deleted)\n */\n plugin?: boolean;\n}\n/**\n * @category GraphQL\n * @category Error\n */\nexport interface CmsErrorResponse {\n message: string;\n code: string;\n data: Record<string, any> | Record<string, any>[];\n}\n/**\n * @category GraphQL\n * @category Meta\n */\nexport interface CmsMetaResponse {\n totalCount: number;\n cursor: string | null;\n hasMoreItems: boolean;\n}\n\n/***\n * ###### FORM ########\n */\nexport interface BindComponentRenderProp extends BaseBindComponentRenderProp {\n parentName: string;\n appendValue: (value: any) => void;\n prependValue: (value: any) => void;\n appendValues: (values: any[]) => void;\n removeValue: (index: number) => void;\n moveValueUp: (index: number) => void;\n moveValueDown: (index: number) => void;\n}\n\ninterface BindComponentProps extends Omit<BaseBindComponentProps, \"children\" | \"name\"> {\n name?: string;\n children?: ((props: BindComponentRenderProp) => React.ReactElement) | React.ReactElement;\n}\n\nexport type BindComponent = React.FC<BindComponentProps> & {\n parentName?: string;\n};\n"],"mappings":""}
1
+ {"version":3,"names":[],"sources":["types.ts"],"sourcesContent":["import * as React from \"react\";\nimport { Plugin } from \"@webiny/plugins/types\";\nimport { ReactElement, ReactNode } from \"react\";\nimport {\n FormRenderPropParams,\n FormAPI,\n BindComponent as BaseBindComponent,\n BindComponentRenderProp as BaseBindComponentRenderProp,\n BindComponentProps as BaseBindComponentProps\n} from \"@webiny/form\";\nimport { ApolloClient } from \"apollo-client\";\nimport { IconPrefix, IconName } from \"@fortawesome/fontawesome-svg-core\";\nimport Label from \"./admin/components/ContentEntryForm/Label\";\nimport { SecurityPermission } from \"@webiny/app-security/types\";\n\ninterface QueryFieldParams {\n field: CmsEditorField;\n}\n\nexport interface CmsEditorFieldTypePlugin extends Plugin {\n /**\n * a plugin type\n */\n type: \"cms-editor-field-type\";\n field: {\n /**\n * A unique identifier of the field type (text, number, json, myField, ...).\n *\n * ```ts\n * type: \"myField\"\n * ```\n */\n type: string;\n /**\n * A display name for the field.\n *\n * ```ts\n * label: \"Field name\"\n * ```\n */\n label: string;\n /**\n * A list of available validators for the model field.\n *\n * ```ts\n * validators: [\n * \"required\",\n * \"gte\",\n * \"lte\"\n * ]\n * ```\n */\n validators?: string[];\n /**\n * A list of available validators when a model field accepts a list (array) of values.\n *\n * ```ts\n * listValidators: [\n * \"minLength\",\n * \"maxLength\"\n * ]\n * ```\n */\n listValidators?: string[];\n /**\n * An explanation of the field displayed beneath the label.\n *\n * ```ts\n * description: \"A short description of the field\"\n * ```\n */\n description: string;\n /**\n * A ReactNode to display the icon for the field.\n *\n * ```tsx\n * icon: <MyIconComponent />\n * ```\n */\n icon: React.ReactNode;\n /**\n * Is it allowed to have multiple values in this field?\n *\n * ```ts\n * allowMultipleValues: true\n * ```\n */\n allowMultipleValues: boolean;\n /**\n * Does this field type have a fixed list of values that can be selected?\n *\n * ```ts\n * allowPredefinedValues: false\n * ```\n */\n allowPredefinedValues: boolean;\n /**\n * A ReactNode label when multiple values are enabled.\n */\n multipleValuesLabel: React.ReactNode;\n /**\n * These are default values when the field is first created. This is a representation of the field that is stored in the database.\n *\n * ```ts\n * createField: () => ({\n * type: \"fieldType\",\n * validation: [],\n * renderer: {\n * name: \"fieldTypeRenderer\"\n * }\n * })\n * ```\n */\n createField: () => Pick<CmsEditorField, \"type\" | \"validation\" | \"renderer\" | \"settings\">;\n /**\n * A ReactNode that you can add in the section below the help text when creating/editing field.\n *\n * ```tsx\n * renderSettings: (params) => {\n * return <FieldSettingsComponent />;\n * }\n * ```\n */\n renderSettings?: (params: {\n form: FormRenderPropParams;\n afterChangeLabel: (value: string) => void;\n uniqueFieldIdValidator: (fieldId: string) => void;\n contentModel: CmsEditorContentModel;\n }) => React.ReactNode;\n /**\n * A ReactNode that renders in the Predefined values tab.\n *\n * ```tsx\n * renderPredefinedValues: (params) => {\n * const {form: {Bind}} = params;\n * return (\n * <Bind name=\"fieldProperty\">\n * <InputComponent />\n * </Bind>\n * );\n * }\n * ```\n */\n renderPredefinedValues?: (params: {\n form: FormRenderPropParams;\n field: CmsEditorField;\n getBind: (index?: number) => any;\n }) => React.ReactElement;\n /**\n * Object wrapper for GraphQL stuff\n */\n graphql?: {\n /**\n * Define field selection.\n *\n * ```ts\n * graphql: {\n * queryField: `\n * {\n * id\n * title\n * createdOn\n * }\n * `,\n * }\n * ```\n */\n queryField?: string | ((params: QueryFieldParams) => string);\n };\n render?(params: any): React.ReactElement;\n };\n}\n\nexport interface CmsEditorFieldRendererProps {\n field: CmsEditorField;\n Label: typeof Label;\n getBind: (index?: number, key?: string) => BindComponent;\n contentModel: CmsEditorContentModel;\n}\n\nexport interface CmsEditorFieldRendererPlugin extends Plugin {\n /**\n * a plugin type\n */\n type: \"cms-editor-field-renderer\";\n renderer: {\n /**\n * Name of the renderer to match the one from `createField()` method in `CmsEditorFieldTypePlugin`.\n *\n * ```ts\n * renderName: \"myFieldTypeRenderer\"\n * ```\n */\n rendererName: string;\n /**\n * A display name for the field in the UI. It is a `ReactNode` type so you can return a component if you want to.\n *\n * ```tsx\n * name: <MyFieldNameComponent />\n * ```\n */\n name: React.ReactNode;\n /**\n * A description for the field in the UI. Works exactly like the `name` property.\n *\n * ```tsx\n * name: <MyFieldDescriptionComponent />\n * ```\n */\n description: React.ReactNode;\n /**\n * A method that determines if the field can be rendered by this plugin.\n *\n * ```ts\n * canUse({ field }) {\n * return (\n * field.type === \"myType\" && !field.multipleValues\n * );\n * }\n * ```\n */\n canUse(props: { field: CmsEditorField }): boolean;\n /**\n * Renders a field in the UI.\n *\n * ```tsx\n * render({ field, getBind }) {\n * const Bind = getBind();\n *\n * return (\n * <Bind>\n * {bind => {\n * return (\n * <Input\n * value={bind.value}\n * onChange={bind.onChange}\n * />\n * )\n * }}\n * </Bind>\n * );\n * }\n * ```\n */\n render(props: CmsEditorFieldRendererProps): React.ReactNode;\n };\n}\n\nexport interface CmsEditorFieldPredefinedValuesEntry {\n label: string;\n value: string;\n selected?: boolean;\n}\n\nexport interface CmsEditorFieldPredefinedValues {\n enabled: boolean;\n values: CmsEditorFieldPredefinedValuesEntry[];\n}\n\nexport type CmsEditorField<T = unknown> = T & {\n id: string;\n type: string;\n fieldId: CmsEditorFieldId;\n storageId?: string;\n label?: string;\n helpText?: string;\n placeholderText?: string;\n validation?: CmsEditorFieldValidator[];\n listValidation?: CmsEditorFieldValidator[];\n multipleValues?: boolean;\n predefinedValues?: CmsEditorFieldPredefinedValues;\n settings?: {\n defaultValue?: string | null | undefined;\n defaultSetValue?: string;\n type?: string;\n fields?: CmsEditorField<any>[];\n layout?: string[][];\n models?: Pick<CmsModel, \"modelId\" | \"name\">[];\n imagesOnly?: boolean;\n [key: string]: any;\n };\n renderer: {\n name: string;\n };\n};\n\nexport type CmsEditorFieldId = string;\nexport type CmsEditorFieldsLayout = CmsEditorFieldId[][];\n\nexport interface CmsEditorContentModel {\n id: string;\n group: Pick<CmsGroup, \"id\" | \"name\">;\n description?: string;\n version: number;\n layout?: CmsEditorFieldsLayout;\n fields: CmsEditorField[];\n lockedFields: CmsEditorField[];\n name: string;\n modelId: string;\n titleFieldId: string;\n settings: {\n [key: string]: any;\n };\n status: string;\n savedOn: string;\n meta: any;\n createdBy: CmsCreatedBy;\n /**\n * If model is a plugin one (it cannot be changed/deleted)\n */\n plugin?: boolean;\n}\n\nexport type CmsContentEntryStatusType = \"draft\" | \"published\" | \"unpublished\";\n\nexport interface CmsEditorContentEntry {\n id: string;\n savedOn: string;\n modelId: string;\n createdBy: CmsCreatedBy;\n meta: {\n title: string;\n publishedOn: string;\n locked: boolean;\n status: CmsContentEntryStatusType;\n version: number;\n };\n [key: string]: any;\n}\n\nexport interface CmsContentEntryRevision {\n id: string;\n savedOn: string;\n modelId: string;\n createdBy: CmsCreatedBy;\n meta: {\n title: string;\n publishedOn: string;\n locked: boolean;\n status: CmsContentEntryStatusType;\n version: number;\n };\n}\n\nexport interface CmsEditorFieldValidator {\n name: string;\n message: string;\n settings: any;\n}\n\nexport interface CmsEditorFieldValidatorPluginValidator {\n name: string;\n label: string;\n description: string;\n defaultMessage: string;\n defaultSettings?: Record<string, any>;\n renderSettings?: (props: {\n field: CmsEditorField;\n Bind: BindComponent;\n setValue: (name: string, value: any) => void;\n setMessage: (message: string) => void;\n data: CmsEditorFieldValidator;\n }) => React.ReactElement;\n}\nexport interface CmsEditorFieldValidatorPlugin extends Plugin {\n type: \"cms-editor-field-validator\";\n validator: CmsEditorFieldValidatorPluginValidator;\n}\n\nexport type CmsEditorContentTab = React.FC<{ activeTab: boolean }>;\n\n// ------------------------------------------------------------------------------------------------------------\nexport interface CmsEditorFieldOptionPlugin extends Plugin {\n type: \"cms-editor-field-option\";\n render(): ReactElement;\n}\n\nexport interface CmsContentDetailsPlugin extends Plugin {\n render: (params: any) => ReactNode;\n}\n\nexport interface CmsContentDetailsRevisionContentPlugin extends Plugin {\n type: \"cms-content-details-revision-content\";\n render(params: any): ReactElement;\n}\n\nexport interface CmsEditorFieldValidatorPatternPlugin extends Plugin {\n type: \"cms-editor-field-validator-pattern\";\n pattern: {\n name: string;\n message: string;\n label: string;\n };\n}\n\nexport interface CmsFieldValidator {\n name: string;\n message: any;\n settings: any;\n}\n\nexport interface CmsModelFieldValidatorPlugin<T = any> extends Plugin {\n type: \"cms-model-field-validator\";\n validator: {\n name: string;\n validate: (value: T, validator: CmsFieldValidator) => Promise<any>;\n };\n}\n\n/**\n * @category Plugin\n * @category ContentModelField\n * @category FieldValidation\n */\nexport interface CmsModelFieldValidatorPatternPlugin extends Plugin {\n /**\n * A plugin type\n */\n type: \"cms-model-field-validator-pattern\";\n /**\n * A pattern object for the validator.\n */\n pattern: {\n /**\n * name of the pattern.\n */\n name: string;\n /**\n * RegExp of the validator.\n */\n regex: string;\n /**\n * RegExp flags\n */\n flags: string;\n };\n}\n\nexport interface FieldLayoutPosition {\n row: number;\n index: number | null;\n}\n\nexport interface CmsEditorFormSettingsPlugin extends Plugin {\n type: \"cms-editor-form-settings\";\n title: string;\n description: string;\n icon: React.ReactElement;\n render(props: { Bind: BaseBindComponent; form: FormAPI; formData: any }): React.ReactNode;\n renderHeaderActions?(props: {\n Bind: BaseBindComponent;\n form: FormAPI;\n formData: any;\n }): React.ReactNode;\n}\n\nexport interface CmsIcon {\n /**\n * [ pack, icon ], ex: [\"fab\", \"cog\"]\n */\n id: [IconPrefix, IconName];\n /**\n * Icon name\n */\n name: string;\n /**\n * SVG element\n */\n svg: ReactElement;\n}\n\nexport interface CmsIconsPlugin extends Plugin {\n type: \"cms-icons\";\n getIcons(): CmsIcon[];\n}\n\nexport interface UseContentModelEditorReducerState {\n apolloClient: ApolloClient<any>;\n id: string;\n}\n\n/**\n * Transform field value when sending data to the API.\n */\nexport interface CmsFieldValueTransformer extends Plugin {\n /**\n * A plugin type.\n */\n type: \"cms-field-value-transformer\";\n /**\n * A field type for the value transformer. Or a list of field types.\n */\n fieldType: string | string[];\n /**\n * A transformer function that takes a value and returns a new one.\n */\n transform: (value: any, field: CmsEditorField) => any;\n}\n\n/**\n * Define a custom form layout renderer for a specific content model.\n */\nexport interface CmsContentFormRendererPlugin extends Plugin {\n /**\n * A plugin type.\n */\n type: \"cms-content-form-renderer\";\n /**\n * Content model ID that will use this renderer.\n */\n modelId: string;\n\n /**\n * A function that will render a custom form layout.\n */\n render(props: {\n /**\n * Content model that is being rendered.\n */\n contentModel: CmsEditorContentModel;\n /**\n * Content entry data handled by the Form element.\n */\n data: Record<string, any>;\n /**\n * A component to bind data to the Form.\n */\n Bind: BindComponent;\n /**\n * Content model fields to render.\n */\n fields: Record<string, React.ReactElement>;\n }): React.ReactNode;\n}\n/**\n * #########################\n * Data types\n * #########################\n */\nexport interface CmsSecurityPermission extends SecurityPermission {\n accessLevel?: \"full\" | \"no\" | \"custom\";\n models?: Record<string, string>;\n groups?: Record<string, string>;\n endpoints?: string[];\n locales?: string[];\n rwd?: string;\n own?: boolean;\n pw?: string;\n}\nexport interface CmsCreatedBy {\n id: string;\n displayName: string;\n type: string;\n}\n/**\n * @category GraphQL\n * @category Model\n */\nexport type CmsModel = CmsEditorContentModel;\n/**\n * @category GraphQL\n * @category Group\n */\nexport interface CmsGroup {\n id: string;\n name: string;\n slug: string;\n icon?: string;\n description?: string;\n contentModels: CmsModel[];\n createdBy: CmsCreatedBy;\n /**\n * Tells if this group is a plugin one (cannot be changed/deleted)\n */\n plugin?: boolean;\n}\n/**\n * @category GraphQL\n * @category Error\n */\nexport interface CmsErrorResponse {\n message: string;\n code: string;\n data: Record<string, any> | Record<string, any>[];\n}\n/**\n * @category GraphQL\n * @category Meta\n */\nexport interface CmsMetaResponse {\n totalCount: number;\n cursor: string | null;\n hasMoreItems: boolean;\n}\n\n/***\n * ###### FORM ########\n */\nexport interface BindComponentRenderProp extends BaseBindComponentRenderProp {\n parentName: string;\n appendValue: (value: any) => void;\n prependValue: (value: any) => void;\n appendValues: (values: any[]) => void;\n removeValue: (index: number) => void;\n moveValueUp: (index: number) => void;\n moveValueDown: (index: number) => void;\n}\n\ninterface BindComponentProps extends Omit<BaseBindComponentProps, \"children\" | \"name\"> {\n name?: string;\n children?: ((props: BindComponentRenderProp) => React.ReactElement) | React.ReactElement;\n}\n\nexport type BindComponent = React.FC<BindComponentProps> & {\n parentName?: string;\n};\n\n/**\n * After RequestReview and RequestChanges was removed, we need an option to add new status filters\n */\nexport interface CmsEntryFilterStatusPlugin extends Plugin {\n type: \"cms.entry.filter.status\";\n label: string;\n value: string;\n}\n"],"mappings":""}