@webiny/app-headless-cms-common 6.0.0-beta.0 → 6.0.0-rc.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 (81) hide show
  1. package/Fields/ErrorBoundary.d.ts +24 -0
  2. package/Fields/ErrorBoundary.js +40 -0
  3. package/Fields/ErrorBoundary.js.map +1 -0
  4. package/Fields/FieldElement.d.ts +64 -0
  5. package/Fields/FieldElement.js +77 -0
  6. package/Fields/FieldElement.js.map +1 -0
  7. package/Fields/FieldElementError.d.ts +7 -0
  8. package/Fields/FieldElementError.js +25 -0
  9. package/Fields/FieldElementError.js.map +1 -0
  10. package/Fields/Fields.d.ts +11 -0
  11. package/Fields/Fields.js +43 -0
  12. package/Fields/Fields.js.map +1 -0
  13. package/Fields/Label.d.ts +6 -0
  14. package/Fields/Label.js +10 -0
  15. package/Fields/Label.js.map +1 -0
  16. package/Fields/index.d.ts +3 -0
  17. package/Fields/index.js +5 -0
  18. package/Fields/index.js.map +1 -0
  19. package/Fields/useBind.d.ts +9 -0
  20. package/Fields/useBind.js +113 -0
  21. package/Fields/useBind.js.map +1 -0
  22. package/Fields/useRenderPlugins.d.ts +1 -0
  23. package/Fields/useRenderPlugins.js +7 -0
  24. package/Fields/useRenderPlugins.js.map +1 -0
  25. package/ModelFieldProvider/ModelFieldContext.d.ts +38 -0
  26. package/ModelFieldProvider/ModelFieldContext.js +26 -0
  27. package/ModelFieldProvider/ModelFieldContext.js.map +1 -0
  28. package/ModelFieldProvider/index.d.ts +2 -0
  29. package/ModelFieldProvider/index.js +4 -0
  30. package/ModelFieldProvider/index.js.map +1 -0
  31. package/ModelFieldProvider/useModelField.d.ts +15 -0
  32. package/ModelFieldProvider/useModelField.js +29 -0
  33. package/ModelFieldProvider/useModelField.js.map +1 -0
  34. package/ModelProvider/ModelContext.d.ts +9 -0
  35. package/ModelProvider/ModelContext.js +12 -0
  36. package/ModelProvider/ModelContext.js.map +1 -0
  37. package/ModelProvider/index.d.ts +2 -0
  38. package/ModelProvider/index.js +4 -0
  39. package/ModelProvider/index.js.map +1 -0
  40. package/ModelProvider/useModel.d.ts +9 -0
  41. package/ModelProvider/useModel.js +16 -0
  42. package/ModelProvider/useModel.js.map +1 -0
  43. package/README.md +6 -13
  44. package/constants.d.ts +1 -0
  45. package/constants.js +3 -0
  46. package/constants.js.map +1 -0
  47. package/createFieldsList.d.ts +6 -2
  48. package/createFieldsList.js +31 -32
  49. package/createFieldsList.js.map +1 -1
  50. package/createValidationContainer.d.ts +18 -0
  51. package/createValidationContainer.js +23 -0
  52. package/createValidationContainer.js.map +1 -0
  53. package/createValidators.d.ts +3 -0
  54. package/createValidators.js +52 -0
  55. package/createValidators.js.map +1 -0
  56. package/entries.graphql.d.ts +54 -2
  57. package/entries.graphql.js +338 -55
  58. package/entries.graphql.js.map +1 -1
  59. package/exports/admin/cms.d.ts +1 -0
  60. package/exports/admin/cms.js +3 -0
  61. package/exports/admin/cms.js.map +1 -0
  62. package/getModelTitleFieldId.d.ts +1 -1
  63. package/getModelTitleFieldId.js +1 -7
  64. package/getModelTitleFieldId.js.map +1 -1
  65. package/index.d.ts +10 -4
  66. package/index.js +10 -49
  67. package/index.js.map +1 -1
  68. package/package.json +20 -25
  69. package/prepareFormData.d.ts +1 -1
  70. package/prepareFormData.js +23 -42
  71. package/prepareFormData.js.map +1 -1
  72. package/types/index.d.ts +53 -43
  73. package/types/index.js +1 -38
  74. package/types/index.js.map +1 -1
  75. package/types/model.d.ts +23 -17
  76. package/types/model.js +1 -5
  77. package/types/model.js.map +1 -1
  78. package/types/shared.js +1 -5
  79. package/types/validation.d.ts +3 -3
  80. package/types/validation.js +1 -5
  81. package/types/validation.js.map +1 -1
package/index.js CHANGED
@@ -1,51 +1,12 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- var _entries = require("./entries.graphql");
7
- Object.keys(_entries).forEach(function (key) {
8
- if (key === "default" || key === "__esModule") return;
9
- if (key in exports && exports[key] === _entries[key]) return;
10
- Object.defineProperty(exports, key, {
11
- enumerable: true,
12
- get: function get() {
13
- return _entries[key];
14
- }
15
- });
16
- });
17
- var _getModelTitleFieldId = require("./getModelTitleFieldId");
18
- Object.keys(_getModelTitleFieldId).forEach(function (key) {
19
- if (key === "default" || key === "__esModule") return;
20
- if (key in exports && exports[key] === _getModelTitleFieldId[key]) return;
21
- Object.defineProperty(exports, key, {
22
- enumerable: true,
23
- get: function get() {
24
- return _getModelTitleFieldId[key];
25
- }
26
- });
27
- });
28
- var _createFieldsList = require("./createFieldsList");
29
- Object.keys(_createFieldsList).forEach(function (key) {
30
- if (key === "default" || key === "__esModule") return;
31
- if (key in exports && exports[key] === _createFieldsList[key]) return;
32
- Object.defineProperty(exports, key, {
33
- enumerable: true,
34
- get: function get() {
35
- return _createFieldsList[key];
36
- }
37
- });
38
- });
39
- var _prepareFormData = require("./prepareFormData");
40
- Object.keys(_prepareFormData).forEach(function (key) {
41
- if (key === "default" || key === "__esModule") return;
42
- if (key in exports && exports[key] === _prepareFormData[key]) return;
43
- Object.defineProperty(exports, key, {
44
- enumerable: true,
45
- get: function get() {
46
- return _prepareFormData[key];
47
- }
48
- });
49
- });
1
+ export * from "./Fields/index.js";
2
+ export * from "./ModelFieldProvider/index.js";
3
+ export * from "./ModelProvider/index.js";
4
+ export * from "./entries.graphql.js";
5
+ export * from "./getModelTitleFieldId.js";
6
+ export * from "./createFieldsList.js";
7
+ export * from "./createValidationContainer.js";
8
+ export * from "./createValidators.js";
9
+ export * from "./prepareFormData.js";
10
+ export * from "./constants.js";
50
11
 
51
12
  //# sourceMappingURL=index.js.map
package/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"names":["_entries","require","Object","keys","forEach","key","exports","defineProperty","enumerable","get","_getModelTitleFieldId","_createFieldsList","_prepareFormData"],"sources":["index.ts"],"sourcesContent":["export * from \"./entries.graphql\";\nexport * from \"./getModelTitleFieldId\";\nexport * from \"./createFieldsList\";\nexport * from \"./prepareFormData\";\n"],"mappings":";;;;;AAAA,IAAAA,QAAA,GAAAC,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAH,QAAA,EAAAI,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAL,QAAA,CAAAK,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,IAAA;MAAA,OAAAT,QAAA,CAAAK,GAAA;IAAA;EAAA;AAAA;AACA,IAAAK,qBAAA,GAAAT,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAO,qBAAA,EAAAN,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAK,qBAAA,CAAAL,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,IAAA;MAAA,OAAAC,qBAAA,CAAAL,GAAA;IAAA;EAAA;AAAA;AACA,IAAAM,iBAAA,GAAAV,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAQ,iBAAA,EAAAP,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAM,iBAAA,CAAAN,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,IAAA;MAAA,OAAAE,iBAAA,CAAAN,GAAA;IAAA;EAAA;AAAA;AACA,IAAAO,gBAAA,GAAAX,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAS,gBAAA,EAAAR,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAO,gBAAA,CAAAP,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,IAAA;MAAA,OAAAG,gBAAA,CAAAP,GAAA;IAAA;EAAA;AAAA","ignoreList":[]}
1
+ {"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["export * from \"./Fields/index.js\";\nexport * from \"./ModelFieldProvider/index.js\";\nexport * from \"./ModelProvider/index.js\";\nexport * from \"./entries.graphql.js\";\nexport * from \"./getModelTitleFieldId.js\";\nexport * from \"./createFieldsList.js\";\nexport * from \"./createValidationContainer.js\";\nexport * from \"./createValidators.js\";\nexport * from \"./prepareFormData.js\";\nexport * from \"./constants.js\";\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA","ignoreList":[]}
package/package.json CHANGED
@@ -1,6 +1,7 @@
1
1
  {
2
2
  "name": "@webiny/app-headless-cms-common",
3
- "version": "6.0.0-beta.0",
3
+ "version": "6.0.0-rc.0",
4
+ "type": "module",
4
5
  "main": "index.js",
5
6
  "repository": {
6
7
  "type": "git",
@@ -13,40 +14,34 @@
13
14
  ],
14
15
  "license": "MIT",
15
16
  "dependencies": {
16
- "@babel/runtime": "7.24.1",
17
+ "@emotion/react": "11.10.8",
18
+ "@emotion/styled": "11.10.6",
17
19
  "@fortawesome/fontawesome-svg-core": "1.3.0",
18
- "@types/react": "18.2.79",
19
- "@webiny/app-security": "6.0.0-beta.0",
20
- "@webiny/form": "6.0.0-beta.0",
21
- "@webiny/plugins": "6.0.0-beta.0",
22
- "@webiny/validation": "6.0.0-beta.0",
20
+ "@webiny/admin-ui": "6.0.0-rc.0",
21
+ "@webiny/app": "6.0.0-rc.0",
22
+ "@webiny/app-admin": "6.0.0-rc.0",
23
+ "@webiny/form": "6.0.0-rc.0",
24
+ "@webiny/plugins": "6.0.0-rc.0",
25
+ "@webiny/react-composition": "6.0.0-rc.0",
26
+ "@webiny/validation": "6.0.0-rc.0",
23
27
  "dnd-core": "16.0.1",
24
- "graphql": "15.8.0",
28
+ "graphql": "16.12.0",
25
29
  "graphql-tag": "2.12.6",
30
+ "lodash": "4.17.23",
26
31
  "prop-types": "15.8.1",
27
32
  "react": "18.2.0"
28
33
  },
29
34
  "devDependencies": {
30
- "@babel/cli": "7.24.1",
31
- "@babel/core": "7.24.3",
32
- "@babel/preset-env": "7.24.3",
33
- "@babel/preset-react": "7.24.1",
34
- "@babel/preset-typescript": "7.24.1",
35
- "@emotion/babel-plugin": "11.11.0",
36
- "@webiny/cli": "6.0.0-beta.0",
37
- "@webiny/project-utils": "6.0.0-beta.0",
38
- "babel-plugin-module-resolver": "5.0.0",
39
- "rimraf": "5.0.5",
40
- "ttypescript": "1.5.15",
41
- "typescript": "4.7.4"
35
+ "@emotion/babel-plugin": "11.13.5",
36
+ "@types/react": "18.2.79",
37
+ "@webiny/build-tools": "6.0.0-rc.0",
38
+ "babel-plugin-module-resolver": "5.0.2",
39
+ "rimraf": "6.1.3",
40
+ "typescript": "5.9.3"
42
41
  },
43
42
  "publishConfig": {
44
43
  "access": "public",
45
44
  "directory": "dist"
46
45
  },
47
- "scripts": {
48
- "build": "yarn webiny run build",
49
- "watch": "yarn webiny run watch"
50
- },
51
- "gitHead": "aa8dbfbbd5ad13ec271adba6f2431e02991a300f"
46
+ "gitHead": "0f2aa699f4642e550ab62c96fcd050e8d02345c9"
52
47
  }
@@ -1,2 +1,2 @@
1
- import { CmsModelField } from "./types";
1
+ import type { CmsModelField } from "./types/index.js";
2
2
  export declare const prepareFormData: <T extends Record<string, any>>(input: T, fields: CmsModelField[]) => T;
@@ -1,51 +1,34 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
6
- });
7
- exports.prepareFormData = void 0;
8
- var _createForOfIteratorHelper2 = _interopRequireDefault(require("@babel/runtime/helpers/createForOfIteratorHelper"));
9
- var _plugins = require("@webiny/plugins");
1
+ import { plugins } from "@webiny/plugins";
10
2
  /**
11
3
  * This method builds transformer plugins only once.
12
4
  * Really no need in building more than once because at this point all plugins are registered.
13
5
  */
14
- var availableTransformerPlugins = undefined;
15
- var getAvailableTransformerPlugins = function getAvailableTransformerPlugins() {
6
+ let availableTransformerPlugins = undefined;
7
+ const getAvailableTransformerPlugins = () => {
16
8
  if (availableTransformerPlugins) {
17
9
  return availableTransformerPlugins;
18
10
  }
19
- availableTransformerPlugins = _plugins.plugins.byType("cms-field-value-transformer").reduce(function (transformers, pl) {
20
- var fieldTypes = Array.isArray(pl.fieldType) ? pl.fieldType : [pl.fieldType];
21
- var _iterator = (0, _createForOfIteratorHelper2.default)(fieldTypes),
22
- _step;
23
- try {
24
- for (_iterator.s(); !(_step = _iterator.n()).done;) {
25
- var _fieldType = _step.value;
26
- if (transformers[_fieldType]) {
27
- console.warn("Transformer for field type \"".concat(_fieldType, "\" is already defined. There cannot be more than one transformer."));
28
- continue;
29
- }
30
- transformers[_fieldType] = pl;
11
+ availableTransformerPlugins = plugins.byType("cms-field-value-transformer").reduce((transformers, pl) => {
12
+ const fieldTypes = Array.isArray(pl.fieldType) ? pl.fieldType : [pl.fieldType];
13
+ for (const fieldType of fieldTypes) {
14
+ if (transformers[fieldType]) {
15
+ console.warn(`Transformer for field type "${fieldType}" is already defined. There cannot be more than one transformer.`);
16
+ continue;
31
17
  }
32
- } catch (err) {
33
- _iterator.e(err);
34
- } finally {
35
- _iterator.f();
18
+ transformers[fieldType] = pl;
36
19
  }
37
20
  return transformers;
38
21
  }, {});
39
22
  return availableTransformerPlugins;
40
23
  };
41
- var transformationRunner;
42
- var createTransformationRunner = function createTransformationRunner() {
24
+ let transformationRunner;
25
+ const createTransformationRunner = () => {
43
26
  if (transformationRunner) {
44
27
  return transformationRunner;
45
28
  }
46
- var availablePlugins = getAvailableTransformerPlugins();
47
- transformationRunner = function transformationRunner(field, value) {
48
- var transformer = availablePlugins[field.type];
29
+ const availablePlugins = getAvailableTransformerPlugins();
30
+ transformationRunner = (field, value) => {
31
+ const transformer = availablePlugins[field.type];
49
32
  if (!transformer) {
50
33
  return value;
51
34
  }
@@ -53,13 +36,13 @@ var createTransformationRunner = function createTransformationRunner() {
53
36
  };
54
37
  return transformationRunner;
55
38
  };
56
- var prepareFormData = exports.prepareFormData = function prepareFormData(input, fields) {
57
- var runTransformation = createTransformationRunner();
58
- return fields.reduce(function (output, field) {
59
- var inputValue = input[field.fieldId];
60
- var fieldId = field.fieldId;
61
- if (field.multipleValues) {
62
- var values = Array.isArray(inputValue) ? inputValue : undefined;
39
+ export const prepareFormData = (input, fields) => {
40
+ const runTransformation = createTransformationRunner();
41
+ return fields.reduce((output, field) => {
42
+ const inputValue = input[field.fieldId];
43
+ const fieldId = field.fieldId;
44
+ if (field.list) {
45
+ const values = Array.isArray(inputValue) ? inputValue : undefined;
63
46
  if (!values) {
64
47
  return output;
65
48
  }
@@ -74,9 +57,7 @@ var prepareFormData = exports.prepareFormData = function prepareFormData(input,
74
57
  else if (values.length === 1 && (values[0] === null || values[0] === undefined)) {
75
58
  return output;
76
59
  }
77
- output[fieldId] = values.map(function (value) {
78
- return runTransformation(field, value);
79
- });
60
+ output[fieldId] = values.map(value => runTransformation(field, value));
80
61
  return output;
81
62
  }
82
63
  /**
@@ -1 +1 @@
1
- {"version":3,"names":["_plugins","require","availableTransformerPlugins","undefined","getAvailableTransformerPlugins","plugins","byType","reduce","transformers","pl","fieldTypes","Array","isArray","fieldType","_iterator","_createForOfIteratorHelper2","default","_step","s","n","done","value","console","warn","concat","err","e","f","transformationRunner","createTransformationRunner","availablePlugins","field","transformer","type","transform","prepareFormData","exports","input","fields","runTransformation","output","inputValue","fieldId","multipleValues","values","length","map"],"sources":["prepareFormData.ts"],"sourcesContent":["import { CmsFieldValueTransformer, CmsModelField } from \"~/types\";\nimport { plugins } from \"@webiny/plugins\";\n\ninterface AvailableFieldTransformers {\n [fieldType: string]: CmsFieldValueTransformer;\n}\n\n/**\n * This method builds transformer plugins only once.\n * Really no need in building more than once because at this point all plugins are registered.\n */\nlet availableTransformerPlugins: AvailableFieldTransformers | undefined = undefined;\nconst getAvailableTransformerPlugins = (): AvailableFieldTransformers => {\n if (availableTransformerPlugins) {\n return availableTransformerPlugins;\n }\n availableTransformerPlugins = plugins\n .byType<CmsFieldValueTransformer>(\"cms-field-value-transformer\")\n .reduce<AvailableFieldTransformers>((transformers, pl) => {\n const fieldTypes = Array.isArray(pl.fieldType) ? pl.fieldType : [pl.fieldType];\n for (const fieldType of fieldTypes) {\n if (transformers[fieldType]) {\n console.warn(\n `Transformer for field type \"${fieldType}\" is already defined. There cannot be more than one transformer.`\n );\n continue;\n }\n transformers[fieldType] = pl;\n }\n return transformers;\n }, {});\n\n return availableTransformerPlugins;\n};\n\ninterface TransformationRunnerCallable {\n (field: CmsModelField, value: any): any;\n}\n\nlet transformationRunner: TransformationRunnerCallable;\nconst createTransformationRunner = (): TransformationRunnerCallable => {\n if (transformationRunner) {\n return transformationRunner;\n }\n const availablePlugins = getAvailableTransformerPlugins();\n\n transformationRunner = (field, value) => {\n const transformer = availablePlugins[field.type];\n if (!transformer) {\n return value;\n }\n return transformer.transform(value, field);\n };\n return transformationRunner;\n};\n\nexport const prepareFormData = <T extends Record<string, any>>(\n input: T,\n fields: CmsModelField[]\n): T => {\n const runTransformation = createTransformationRunner();\n\n return fields.reduce<Record<keyof T, any>>((output, field) => {\n const inputValue = input[field.fieldId];\n\n const fieldId: keyof T = field.fieldId;\n\n if (field.multipleValues) {\n const values = Array.isArray(inputValue) ? inputValue : undefined;\n if (!values) {\n return output;\n }\n /**\n * We need to skip sending the values if there is only one item in the array, and it is a null or undefined value.\n *\n * In case there are more items in the array, and they are null / undefined,\n * we must not do anything because it means the user added new items into the array,\n * and they want to have it like that - or is a mistake by user - in that case they will then remove the extra item(s).\n */\n //\n else if (values.length === 1 && (values[0] === null || values[0] === undefined)) {\n return output;\n }\n\n output[fieldId] = values.map(value => runTransformation(field, value));\n\n return output;\n }\n /**\n * Regular values, single values.\n */\n output[fieldId] = runTransformation(field, inputValue);\n\n return output;\n }, {} as T);\n};\n"],"mappings":";;;;;;;;AACA,IAAAA,QAAA,GAAAC,OAAA;AAMA;AACA;AACA;AACA;AACA,IAAIC,2BAAmE,GAAGC,SAAS;AACnF,IAAMC,8BAA8B,GAAG,SAAjCA,8BAA8BA,CAAA,EAAqC;EACrE,IAAIF,2BAA2B,EAAE;IAC7B,OAAOA,2BAA2B;EACtC;EACAA,2BAA2B,GAAGG,gBAAO,CAChCC,MAAM,CAA2B,6BAA6B,CAAC,CAC/DC,MAAM,CAA6B,UAACC,YAAY,EAAEC,EAAE,EAAK;IACtD,IAAMC,UAAU,GAAGC,KAAK,CAACC,OAAO,CAACH,EAAE,CAACI,SAAS,CAAC,GAAGJ,EAAE,CAACI,SAAS,GAAG,CAACJ,EAAE,CAACI,SAAS,CAAC;IAAC,IAAAC,SAAA,OAAAC,2BAAA,CAAAC,OAAA,EACvDN,UAAU;MAAAO,KAAA;IAAA;MAAlC,KAAAH,SAAA,CAAAI,CAAA,MAAAD,KAAA,GAAAH,SAAA,CAAAK,CAAA,IAAAC,IAAA,GAAoC;QAAA,IAAzBP,UAAS,GAAAI,KAAA,CAAAI,KAAA;QAChB,IAAIb,YAAY,CAACK,UAAS,CAAC,EAAE;UACzBS,OAAO,CAACC,IAAI,iCAAAC,MAAA,CACuBX,UAAS,sEAC5C,CAAC;UACD;QACJ;QACAL,YAAY,CAACK,UAAS,CAAC,GAAGJ,EAAE;MAChC;IAAC,SAAAgB,GAAA;MAAAX,SAAA,CAAAY,CAAA,CAAAD,GAAA;IAAA;MAAAX,SAAA,CAAAa,CAAA;IAAA;IACD,OAAOnB,YAAY;EACvB,CAAC,EAAE,CAAC,CAAC,CAAC;EAEV,OAAON,2BAA2B;AACtC,CAAC;AAMD,IAAI0B,oBAAkD;AACtD,IAAMC,0BAA0B,GAAG,SAA7BA,0BAA0BA,CAAA,EAAuC;EACnE,IAAID,oBAAoB,EAAE;IACtB,OAAOA,oBAAoB;EAC/B;EACA,IAAME,gBAAgB,GAAG1B,8BAA8B,CAAC,CAAC;EAEzDwB,oBAAoB,GAAG,SAAAA,qBAACG,KAAK,EAAEV,KAAK,EAAK;IACrC,IAAMW,WAAW,GAAGF,gBAAgB,CAACC,KAAK,CAACE,IAAI,CAAC;IAChD,IAAI,CAACD,WAAW,EAAE;MACd,OAAOX,KAAK;IAChB;IACA,OAAOW,WAAW,CAACE,SAAS,CAACb,KAAK,EAAEU,KAAK,CAAC;EAC9C,CAAC;EACD,OAAOH,oBAAoB;AAC/B,CAAC;AAEM,IAAMO,eAAe,GAAAC,OAAA,CAAAD,eAAA,GAAG,SAAlBA,eAAeA,CACxBE,KAAQ,EACRC,MAAuB,EACnB;EACJ,IAAMC,iBAAiB,GAAGV,0BAA0B,CAAC,CAAC;EAEtD,OAAOS,MAAM,CAAC/B,MAAM,CAAuB,UAACiC,MAAM,EAAET,KAAK,EAAK;IAC1D,IAAMU,UAAU,GAAGJ,KAAK,CAACN,KAAK,CAACW,OAAO,CAAC;IAEvC,IAAMA,OAAgB,GAAGX,KAAK,CAACW,OAAO;IAEtC,IAAIX,KAAK,CAACY,cAAc,EAAE;MACtB,IAAMC,MAAM,GAAGjC,KAAK,CAACC,OAAO,CAAC6B,UAAU,CAAC,GAAGA,UAAU,GAAGtC,SAAS;MACjE,IAAI,CAACyC,MAAM,EAAE;QACT,OAAOJ,MAAM;MACjB;MACA;AACZ;AACA;AACA;AACA;AACA;AACA;MACY;MAAA,KACK,IAAII,MAAM,CAACC,MAAM,KAAK,CAAC,KAAKD,MAAM,CAAC,CAAC,CAAC,KAAK,IAAI,IAAIA,MAAM,CAAC,CAAC,CAAC,KAAKzC,SAAS,CAAC,EAAE;QAC7E,OAAOqC,MAAM;MACjB;MAEAA,MAAM,CAACE,OAAO,CAAC,GAAGE,MAAM,CAACE,GAAG,CAAC,UAAAzB,KAAK;QAAA,OAAIkB,iBAAiB,CAACR,KAAK,EAAEV,KAAK,CAAC;MAAA,EAAC;MAEtE,OAAOmB,MAAM;IACjB;IACA;AACR;AACA;IACQA,MAAM,CAACE,OAAO,CAAC,GAAGH,iBAAiB,CAACR,KAAK,EAAEU,UAAU,CAAC;IAEtD,OAAOD,MAAM;EACjB,CAAC,EAAE,CAAC,CAAM,CAAC;AACf,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["plugins","availableTransformerPlugins","undefined","getAvailableTransformerPlugins","byType","reduce","transformers","pl","fieldTypes","Array","isArray","fieldType","console","warn","transformationRunner","createTransformationRunner","availablePlugins","field","value","transformer","type","transform","prepareFormData","input","fields","runTransformation","output","inputValue","fieldId","list","values","length","map"],"sources":["prepareFormData.ts"],"sourcesContent":["import type { CmsFieldValueTransformer, CmsModelField } from \"~/types/index.js\";\nimport { plugins } from \"@webiny/plugins\";\n\ninterface AvailableFieldTransformers {\n [fieldType: string]: CmsFieldValueTransformer;\n}\n\n/**\n * This method builds transformer plugins only once.\n * Really no need in building more than once because at this point all plugins are registered.\n */\nlet availableTransformerPlugins: AvailableFieldTransformers | undefined = undefined;\nconst getAvailableTransformerPlugins = (): AvailableFieldTransformers => {\n if (availableTransformerPlugins) {\n return availableTransformerPlugins;\n }\n availableTransformerPlugins = plugins\n .byType<CmsFieldValueTransformer>(\"cms-field-value-transformer\")\n .reduce<AvailableFieldTransformers>((transformers, pl) => {\n const fieldTypes = Array.isArray(pl.fieldType) ? pl.fieldType : [pl.fieldType];\n for (const fieldType of fieldTypes) {\n if (transformers[fieldType]) {\n console.warn(\n `Transformer for field type \"${fieldType}\" is already defined. There cannot be more than one transformer.`\n );\n continue;\n }\n transformers[fieldType] = pl;\n }\n return transformers;\n }, {});\n\n return availableTransformerPlugins;\n};\n\ninterface TransformationRunnerCallable {\n (field: CmsModelField, value: any): any;\n}\n\nlet transformationRunner: TransformationRunnerCallable;\nconst createTransformationRunner = (): TransformationRunnerCallable => {\n if (transformationRunner) {\n return transformationRunner;\n }\n const availablePlugins = getAvailableTransformerPlugins();\n\n transformationRunner = (field, value) => {\n const transformer = availablePlugins[field.type];\n if (!transformer) {\n return value;\n }\n return transformer.transform(value, field);\n };\n return transformationRunner;\n};\n\nexport const prepareFormData = <T extends Record<string, any>>(\n input: T,\n fields: CmsModelField[]\n): T => {\n const runTransformation = createTransformationRunner();\n\n return fields.reduce<Record<keyof T, any>>((output, field) => {\n const inputValue = input[field.fieldId];\n\n const fieldId: keyof T = field.fieldId;\n\n if (field.list) {\n const values = Array.isArray(inputValue) ? inputValue : undefined;\n if (!values) {\n return output;\n }\n /**\n * We need to skip sending the values if there is only one item in the array, and it is a null or undefined value.\n *\n * In case there are more items in the array, and they are null / undefined,\n * we must not do anything because it means the user added new items into the array,\n * and they want to have it like that - or is a mistake by user - in that case they will then remove the extra item(s).\n */\n //\n else if (values.length === 1 && (values[0] === null || values[0] === undefined)) {\n return output;\n }\n\n output[fieldId] = values.map(value => runTransformation(field, value));\n\n return output;\n }\n /**\n * Regular values, single values.\n */\n output[fieldId] = runTransformation(field, inputValue);\n\n return output;\n }, {} as T);\n};\n"],"mappings":"AACA,SAASA,OAAO,QAAQ,iBAAiB;AAMzC;AACA;AACA;AACA;AACA,IAAIC,2BAAmE,GAAGC,SAAS;AACnF,MAAMC,8BAA8B,GAAGA,CAAA,KAAkC;EACrE,IAAIF,2BAA2B,EAAE;IAC7B,OAAOA,2BAA2B;EACtC;EACAA,2BAA2B,GAAGD,OAAO,CAChCI,MAAM,CAA2B,6BAA6B,CAAC,CAC/DC,MAAM,CAA6B,CAACC,YAAY,EAAEC,EAAE,KAAK;IACtD,MAAMC,UAAU,GAAGC,KAAK,CAACC,OAAO,CAACH,EAAE,CAACI,SAAS,CAAC,GAAGJ,EAAE,CAACI,SAAS,GAAG,CAACJ,EAAE,CAACI,SAAS,CAAC;IAC9E,KAAK,MAAMA,SAAS,IAAIH,UAAU,EAAE;MAChC,IAAIF,YAAY,CAACK,SAAS,CAAC,EAAE;QACzBC,OAAO,CAACC,IAAI,CACR,+BAA+BF,SAAS,kEAC5C,CAAC;QACD;MACJ;MACAL,YAAY,CAACK,SAAS,CAAC,GAAGJ,EAAE;IAChC;IACA,OAAOD,YAAY;EACvB,CAAC,EAAE,CAAC,CAAC,CAAC;EAEV,OAAOL,2BAA2B;AACtC,CAAC;AAMD,IAAIa,oBAAkD;AACtD,MAAMC,0BAA0B,GAAGA,CAAA,KAAoC;EACnE,IAAID,oBAAoB,EAAE;IACtB,OAAOA,oBAAoB;EAC/B;EACA,MAAME,gBAAgB,GAAGb,8BAA8B,CAAC,CAAC;EAEzDW,oBAAoB,GAAGA,CAACG,KAAK,EAAEC,KAAK,KAAK;IACrC,MAAMC,WAAW,GAAGH,gBAAgB,CAACC,KAAK,CAACG,IAAI,CAAC;IAChD,IAAI,CAACD,WAAW,EAAE;MACd,OAAOD,KAAK;IAChB;IACA,OAAOC,WAAW,CAACE,SAAS,CAACH,KAAK,EAAED,KAAK,CAAC;EAC9C,CAAC;EACD,OAAOH,oBAAoB;AAC/B,CAAC;AAED,OAAO,MAAMQ,eAAe,GAAGA,CAC3BC,KAAQ,EACRC,MAAuB,KACnB;EACJ,MAAMC,iBAAiB,GAAGV,0BAA0B,CAAC,CAAC;EAEtD,OAAOS,MAAM,CAACnB,MAAM,CAAuB,CAACqB,MAAM,EAAET,KAAK,KAAK;IAC1D,MAAMU,UAAU,GAAGJ,KAAK,CAACN,KAAK,CAACW,OAAO,CAAC;IAEvC,MAAMA,OAAgB,GAAGX,KAAK,CAACW,OAAO;IAEtC,IAAIX,KAAK,CAACY,IAAI,EAAE;MACZ,MAAMC,MAAM,GAAGrB,KAAK,CAACC,OAAO,CAACiB,UAAU,CAAC,GAAGA,UAAU,GAAGzB,SAAS;MACjE,IAAI,CAAC4B,MAAM,EAAE;QACT,OAAOJ,MAAM;MACjB;MACA;AACZ;AACA;AACA;AACA;AACA;AACA;MACY;MAAA,KACK,IAAII,MAAM,CAACC,MAAM,KAAK,CAAC,KAAKD,MAAM,CAAC,CAAC,CAAC,KAAK,IAAI,IAAIA,MAAM,CAAC,CAAC,CAAC,KAAK5B,SAAS,CAAC,EAAE;QAC7E,OAAOwB,MAAM;MACjB;MAEAA,MAAM,CAACE,OAAO,CAAC,GAAGE,MAAM,CAACE,GAAG,CAACd,KAAK,IAAIO,iBAAiB,CAACR,KAAK,EAAEC,KAAK,CAAC,CAAC;MAEtE,OAAOQ,MAAM;IACjB;IACA;AACR;AACA;IACQA,MAAM,CAACE,OAAO,CAAC,GAAGH,iBAAiB,CAACR,KAAK,EAAEU,UAAU,CAAC;IAEtD,OAAOD,MAAM;EACjB,CAAC,EAAE,CAAC,CAAM,CAAC;AACf,CAAC","ignoreList":[]}
package/types/index.d.ts CHANGED
@@ -1,19 +1,21 @@
1
- import * as React from "react";
2
- import { ReactElement, ReactNode } from "react";
3
- import { Plugin } from "@webiny/plugins/types";
4
- import { BindComponent as BaseBindComponent, BindComponentProps as BaseBindComponentProps, BindComponentRenderProp as BaseBindComponentRenderProp, FormAPI } from "@webiny/form";
5
- import { IconName, IconPrefix } from "@fortawesome/fontawesome-svg-core";
6
- import { SecurityPermission } from "@webiny/app-security/types";
7
- import { CmsModelFieldValidator, CmsModelFieldValidatorsFactory, CmsModelFieldValidatorsGroup } from "./validation";
8
- import { CmsModel, CmsModelField } from "./model";
9
- import { CmsIdentity } from "./shared";
1
+ import type * as React from "react";
2
+ import type { ReactElement, ReactNode } from "react";
3
+ import type { Plugin } from "@webiny/plugins/types.js";
4
+ import type { BindComponent as BaseBindComponent, BindComponentProps as BaseBindComponentProps, BindComponentRenderProp as BaseBindComponentRenderProp, FormAPI } from "@webiny/form";
5
+ import type { IconName, IconPrefix } from "@fortawesome/fontawesome-svg-core";
6
+ import type { CmsModelFieldValidator, CmsModelFieldValidatorsFactory, CmsModelFieldValidatorsGroup } from "./validation.js";
7
+ import type { CmsModel, CmsModelField } from "./model.js";
8
+ import type { CmsIdentity } from "../types/shared.js";
10
9
  import type { SourceType } from "dnd-core";
11
- export declare type DragObjectWithType = {
10
+ import type { IconPickerIconDto } from "@webiny/admin-ui";
11
+ import { GenericRecord } from "@webiny/app/types.js";
12
+ import { Identity } from "@webiny/app-admin/domain/Identity.js";
13
+ export type DragObjectWithType = {
12
14
  type: SourceType;
13
15
  };
14
- export * from "./validation";
15
- export * from "./model";
16
- export * from "./shared";
16
+ export type * from "./validation.js";
17
+ export type * from "./model.js";
18
+ export type * from "./shared.js";
17
19
  interface QueryFieldParams {
18
20
  model: CmsModel;
19
21
  field: CmsModelField;
@@ -37,7 +39,7 @@ export interface DragSource extends DragObjectWithType {
37
39
  /**
38
40
  * @deprecated Use `CmsModelFieldTypePlugin`.
39
41
  */
40
- export declare type CmsEditorFieldTypePlugin = CmsModelFieldTypePlugin;
42
+ export type CmsEditorFieldTypePlugin = CmsModelFieldTypePlugin;
41
43
  export interface CmsModelFieldTypePlugin extends Plugin {
42
44
  /**
43
45
  * a plugin type
@@ -103,10 +105,10 @@ export interface CmsModelFieldTypePlugin extends Plugin {
103
105
  * Is it allowed to have multiple values in this field?
104
106
  *
105
107
  * ```ts
106
- * allowMultipleValues: true
108
+ * allowList: true
107
109
  * ```
108
110
  */
109
- allowMultipleValues?: boolean;
111
+ allowList?: boolean;
110
112
  /**
111
113
  * Does this field type have a fixed list of values that can be selected?
112
114
  *
@@ -118,7 +120,12 @@ export interface CmsModelFieldTypePlugin extends Plugin {
118
120
  /**
119
121
  * A ReactNode label when multiple values are enabled.
120
122
  */
121
- multipleValuesLabel?: React.ReactNode;
123
+ listLabel?: React.ReactNode;
124
+ /**
125
+ * Determines if this field type should be hidden from the admin UI.
126
+ * If set to `true`, the field type will not be visible or selectable in the admin interface.
127
+ */
128
+ hideInAdmin?: boolean;
122
129
  /**
123
130
  * These are default values when the field is first created. This is a representation of the field that is stored in the database.
124
131
  *
@@ -224,11 +231,11 @@ export interface CmsModelFieldRendererProps {
224
231
  /**
225
232
  * @deprecated Use `CmsModelFieldRendererProps`.
226
233
  */
227
- export declare type CmsEditorFieldRendererProps = CmsModelFieldRendererProps;
234
+ export type CmsEditorFieldRendererProps = CmsModelFieldRendererProps;
228
235
  /**
229
236
  * @deprecated Use `CmsModelFieldRendererPlugin`.
230
237
  */
231
- export declare type CmsEditorFieldRendererPlugin = CmsModelFieldRendererPlugin;
238
+ export type CmsEditorFieldRendererPlugin = CmsModelFieldRendererPlugin;
232
239
  export interface CmsModelFieldRendererPlugin extends Plugin {
233
240
  /**
234
241
  * a plugin type
@@ -265,7 +272,7 @@ export interface CmsModelFieldRendererPlugin extends Plugin {
265
272
  * ```ts
266
273
  * canUse({ field }) {
267
274
  * return (
268
- * field.type === "myType" && !field.multipleValues
275
+ * field.type === "myType" && !field.list
269
276
  * );
270
277
  * }
271
278
  * ```
@@ -324,12 +331,12 @@ export interface CmsDynamicZoneTemplate {
324
331
  export interface CmsDynamicZoneTemplateWithTypename extends CmsDynamicZoneTemplate {
325
332
  __typename: string;
326
333
  }
327
- export declare type CmsContentEntryStatusType = "draft" | "published" | "unpublished";
334
+ export type CmsContentEntryStatusType = "draft" | "published" | "unpublished";
328
335
  /**
329
336
  * @deprecated Use `CmsContentEntry`.
330
337
  */
331
- export declare type CmsEditorContentEntry = CmsContentEntry;
332
- export interface CmsContentEntry {
338
+ export type CmsEditorContentEntry = CmsContentEntry;
339
+ export interface CmsContentEntry<TValues extends GenericRecord = GenericRecord> {
333
340
  id: string;
334
341
  entryId: string;
335
342
  modelId: string;
@@ -366,7 +373,7 @@ export interface CmsContentEntry {
366
373
  status: CmsContentEntryStatusType;
367
374
  version: number;
368
375
  };
369
- [key: string]: any;
376
+ values?: TValues;
370
377
  }
371
378
  export interface CmsContentEntryRevision {
372
379
  id: string;
@@ -379,16 +386,16 @@ export interface CmsContentEntryRevision {
379
386
  deletedBy: CmsIdentity | null;
380
387
  revisionCreatedOn: string;
381
388
  revisionSavedOn: string;
382
- revisionModifiedOn: string;
389
+ revisionModifiedOn: string | null;
383
390
  revisionDeletedOn: string | null;
384
- revisionFirstPublishedOn: string;
385
- revisionLastPublishedOn: string;
391
+ revisionFirstPublishedOn: string | null;
392
+ revisionLastPublishedOn: string | null;
386
393
  revisionCreatedBy: CmsIdentity;
387
394
  revisionSavedBy: CmsIdentity;
388
- revisionModifiedBy: CmsIdentity;
395
+ revisionModifiedBy: CmsIdentity | null;
389
396
  revisionDeletedBy: CmsIdentity | null;
390
- revisionFirstPublishedBy: CmsIdentity;
391
- revisionLastPublishedBy: CmsIdentity;
397
+ revisionFirstPublishedBy: CmsIdentity | null;
398
+ revisionLastPublishedBy: CmsIdentity | null;
392
399
  wbyAco_location: Location;
393
400
  meta: {
394
401
  title: string;
@@ -397,7 +404,7 @@ export interface CmsContentEntryRevision {
397
404
  version: number;
398
405
  };
399
406
  }
400
- export declare type CmsEditorContentTab = React.ComponentType<{
407
+ export type CmsEditorContentTab = React.ComponentType<{
401
408
  activeTab: boolean;
402
409
  }>;
403
410
  export interface CmsEditorFieldOptionPlugin extends Plugin {
@@ -411,20 +418,21 @@ export interface FieldLayoutPosition {
411
418
  row: number;
412
419
  index: number | null;
413
420
  }
414
- export interface CmsEditorFormSettingsPlugin extends Plugin {
421
+ export interface CmsEditorFormSettingsPlugin<T = GenericRecord> extends Plugin {
415
422
  type: "cms-editor-form-settings";
416
423
  title: string;
417
424
  description: string;
418
425
  icon: React.ReactElement;
426
+ showSave?: boolean;
419
427
  render(props: {
420
428
  Bind: BaseBindComponent;
421
- form: FormAPI;
422
- formData: any;
429
+ form: FormAPI<T>;
430
+ formData: T;
423
431
  }): React.ReactNode;
424
432
  renderHeaderActions?(props: {
425
433
  Bind: BaseBindComponent;
426
- form: FormAPI;
427
- formData: any;
434
+ form: FormAPI<T>;
435
+ formData: T;
428
436
  }): React.ReactNode;
429
437
  }
430
438
  export interface CmsIcon {
@@ -443,7 +451,7 @@ export interface CmsIcon {
443
451
  }
444
452
  export interface CmsIconsPlugin extends Plugin {
445
453
  type: "cms-icons";
446
- getIcons(): CmsIcon[];
454
+ getIcons(): IconPickerIconDto[];
447
455
  }
448
456
  /**
449
457
  * Transform field value when sending data to the API.
@@ -501,12 +509,11 @@ export interface CmsContentFormRendererPlugin extends Plugin {
501
509
  * Data types
502
510
  * #########################
503
511
  */
504
- export interface CmsSecurityPermission extends SecurityPermission {
512
+ export interface CmsSecurityPermission extends Identity.Permission {
505
513
  accessLevel?: "full" | "no" | "custom";
506
- models?: Record<string, string>;
507
- groups?: Record<string, string>;
514
+ models?: string[];
515
+ groups?: string[];
508
516
  endpoints?: string[];
509
- locales?: string[];
510
517
  rwd?: string;
511
518
  own?: boolean;
512
519
  pw?: string;
@@ -518,7 +525,7 @@ export interface CmsSecurityPermission extends SecurityPermission {
518
525
  export interface CmsErrorResponse {
519
526
  message: string;
520
527
  code: string;
521
- data: Record<string, any>;
528
+ data?: Record<string, any> | null;
522
529
  }
523
530
  /**
524
531
  * @category GraphQL
@@ -545,8 +552,11 @@ interface BindComponentProps<T = any> extends Omit<BaseBindComponentProps, "chil
545
552
  name?: string;
546
553
  children?: ((props: BindComponentRenderProp<T>) => React.ReactElement) | React.ReactElement;
547
554
  }
548
- export declare type BindComponent<T = any> = React.ComponentType<BindComponentProps<T>> & {
555
+ export type BindComponent<T = any> = React.ComponentType<BindComponentProps<T>> & {
549
556
  parentName: string;
557
+ ValidationContainer: React.ComponentType<{
558
+ children: React.ReactNode;
559
+ }>;
550
560
  };
551
561
  /**
552
562
  * After RequestReview and RequestChanges was removed, we need an option to add new status filters
package/types/index.js CHANGED
@@ -1,40 +1,3 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- var _validation = require("./validation");
7
- Object.keys(_validation).forEach(function (key) {
8
- if (key === "default" || key === "__esModule") return;
9
- if (key in exports && exports[key] === _validation[key]) return;
10
- Object.defineProperty(exports, key, {
11
- enumerable: true,
12
- get: function get() {
13
- return _validation[key];
14
- }
15
- });
16
- });
17
- var _model = require("./model");
18
- Object.keys(_model).forEach(function (key) {
19
- if (key === "default" || key === "__esModule") return;
20
- if (key in exports && exports[key] === _model[key]) return;
21
- Object.defineProperty(exports, key, {
22
- enumerable: true,
23
- get: function get() {
24
- return _model[key];
25
- }
26
- });
27
- });
28
- var _shared = require("./shared");
29
- Object.keys(_shared).forEach(function (key) {
30
- if (key === "default" || key === "__esModule") return;
31
- if (key in exports && exports[key] === _shared[key]) return;
32
- Object.defineProperty(exports, key, {
33
- enumerable: true,
34
- get: function get() {
35
- return _shared[key];
36
- }
37
- });
38
- });
1
+ export {};
39
2
 
40
3
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_validation","require","Object","keys","forEach","key","exports","defineProperty","enumerable","get","_model","_shared"],"sources":["index.ts"],"sourcesContent":["import * as React from \"react\";\nimport { ReactElement, ReactNode } from \"react\";\nimport { Plugin } from \"@webiny/plugins/types\";\nimport {\n BindComponent as BaseBindComponent,\n BindComponentProps as BaseBindComponentProps,\n BindComponentRenderProp as BaseBindComponentRenderProp,\n FormAPI\n} from \"@webiny/form\";\nimport { IconName, IconPrefix } from \"@fortawesome/fontawesome-svg-core\";\nimport { SecurityPermission } from \"@webiny/app-security/types\";\nimport {\n CmsModelFieldValidator,\n CmsModelFieldValidatorsFactory,\n CmsModelFieldValidatorsGroup\n} from \"./validation\";\nimport { CmsModel, CmsModelField } from \"./model\";\nimport { CmsIdentity } from \"~/types/shared\";\nimport type { SourceType } from \"dnd-core\";\n\nexport type DragObjectWithType = {\n type: SourceType;\n};\n\nexport * from \"./validation\";\nexport * from \"./model\";\nexport * from \"./shared\";\n\ninterface QueryFieldParams {\n model: CmsModel;\n field: CmsModelField;\n graphQLTypePrefix: string;\n}\n\ninterface Position {\n row: number;\n index: number;\n}\n\ninterface Location {\n folderId: string;\n}\n\nexport interface DragSource extends DragObjectWithType {\n parent?: string;\n pos?: Partial<Position>;\n type: \"row\" | \"field\" | \"newField\";\n fieldType?: string;\n field?: CmsModelField | null;\n fields?: CmsModelField[];\n}\n\n/**\n * @deprecated Use `CmsModelFieldTypePlugin`.\n */\nexport type CmsEditorFieldTypePlugin = CmsModelFieldTypePlugin;\n\nexport interface CmsModelFieldTypePlugin 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[] | CmsModelFieldValidatorsGroup | CmsModelFieldValidatorsFactory;\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[] | CmsModelFieldValidatorsGroup | CmsModelFieldValidatorsFactory;\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<CmsModelField, \"type\" | \"validation\" | \"renderer\" | \"settings\">;\n /**\n * If `true` (default), this field will be configurable via a settings dialog.\n * If `false`, a user will not be able to open the settings dialog, not will the dialog be opened on field drop.\n */\n canEditSettings?: boolean;\n /**\n * Determine if a `draggable` can be dropped into this field.\n * NOTE: This is only applicable to nested field types.\n */\n canAccept?(field: CmsModelField, draggable: DragSource): boolean;\n /**\n * If `true` (default), will allow fields to be laid out into columns (next to each other).\n * If `false`, horizontal layout will not be allowed.\n * NOTE: This is only applicable to nested field types.\n */\n allowLayout?: boolean;\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 afterChangeLabel: (value: string) => void;\n uniqueFieldIdValidator: (fieldId: string) => void;\n contentModel: CmsModel;\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 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 | null);\n };\n render?(params: any): React.ReactElement;\n tags?: string[];\n /**\n * Render additional information in the Admin UI Model edit view\n */\n renderInfo?: (params: { field: CmsModelField; model: CmsModel }) => React.ReactElement;\n };\n}\n\nexport interface CmsModelFieldRendererSettingsProps {\n field: CmsModelField;\n}\n\nexport interface CmsModelFieldRendererProps {\n field: CmsModelField;\n Label: React.ComponentType<React.PropsWithChildren>;\n getBind: <T = any>(index?: number, key?: string) => BindComponent<T>;\n contentModel: CmsModel;\n}\n\n/**\n * @deprecated Use `CmsModelFieldRendererProps`.\n */\nexport type CmsEditorFieldRendererProps = CmsModelFieldRendererProps;\n\n/**\n * @deprecated Use `CmsModelFieldRendererPlugin`.\n */\nexport type CmsEditorFieldRendererPlugin = CmsModelFieldRendererPlugin;\n\nexport interface CmsModelFieldRendererPlugin 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 `CmsModelFieldTypePlugin`.\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 use a JSX element.\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: {\n field: CmsModelField;\n fieldPlugin: CmsModelFieldTypePlugin;\n model: CmsModel;\n }): 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: CmsModelFieldRendererProps): React.ReactNode;\n renderSettings?: (props: CmsModelFieldRendererSettingsProps) => 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 interface CmsDynamicZoneTemplate {\n id: string;\n name: string;\n gqlTypeName: string;\n description: string;\n icon: string;\n fields: CmsModelField[];\n layout: string[][];\n validation: CmsModelFieldValidator[];\n tags?: string[];\n}\n\nexport interface CmsDynamicZoneTemplateWithTypename extends CmsDynamicZoneTemplate {\n __typename: string;\n}\n\nexport type CmsContentEntryStatusType = \"draft\" | \"published\" | \"unpublished\";\n\n/**\n * @deprecated Use `CmsContentEntry`.\n */\nexport type CmsEditorContentEntry = CmsContentEntry;\n\nexport interface CmsContentEntry {\n id: string;\n entryId: string;\n modelId: string;\n createdOn: string;\n createdBy: CmsIdentity;\n savedOn: string;\n savedBy: CmsIdentity;\n modifiedOn: string | null;\n modifiedBy: CmsIdentity | null;\n deletedOn: string | null;\n deletedBy: CmsIdentity | null;\n firstPublishedOn: string | null;\n firstPublishedBy: CmsIdentity | null;\n lastPublishedOn: string | null;\n lastPublishedBy: CmsIdentity | null;\n revisionCreatedOn: string;\n revisionCreatedBy: CmsIdentity;\n revisionSavedOn: string;\n revisionSavedBy: CmsIdentity;\n revisionModifiedOn: string | null;\n revisionModifiedBy: CmsIdentity | null;\n revisionDeletedOn: string | null;\n revisionDeletedBy: CmsIdentity | null;\n revisionFirstPublishedOn: string | null;\n revisionFirstPublishedBy: CmsIdentity | null;\n revisionLastPublishedOn: string | null;\n revisionLastPublishedBy: CmsIdentity | null;\n wbyAco_location: Location;\n meta: {\n title: string;\n description?: string;\n image?: string;\n locked: boolean;\n status: CmsContentEntryStatusType;\n version: number;\n };\n [key: string]: any;\n}\n\nexport interface CmsContentEntryRevision {\n id: string;\n modelId: string;\n savedOn: string;\n deletedOn: string | null;\n firstPublishedOn: string | null;\n lastPublishedOn: string | null;\n createdBy: CmsIdentity;\n deletedBy: CmsIdentity | null;\n revisionCreatedOn: string;\n revisionSavedOn: string;\n revisionModifiedOn: string;\n revisionDeletedOn: string | null;\n revisionFirstPublishedOn: string;\n revisionLastPublishedOn: string;\n revisionCreatedBy: CmsIdentity;\n revisionSavedBy: CmsIdentity;\n revisionModifiedBy: CmsIdentity;\n revisionDeletedBy: CmsIdentity | null;\n revisionFirstPublishedBy: CmsIdentity;\n revisionLastPublishedBy: CmsIdentity;\n wbyAco_location: Location;\n meta: {\n title: string;\n locked: boolean;\n status: CmsContentEntryStatusType;\n version: number;\n };\n}\n\nexport type CmsEditorContentTab = React.ComponentType<{ 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 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\n/**\n * Transform field value when sending data to the API.\n */\nexport interface CmsFieldValueTransformer<TField extends CmsModelField = CmsModelField>\n 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: TField) => 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: CmsModel;\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}\n\n/**\n * @category GraphQL\n * @category Error\n */\nexport interface CmsErrorResponse {\n message: string;\n code: string;\n data: 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<T = any> extends BaseBindComponentRenderProp<T> {\n parentName: string;\n appendValue: (value: any, index?: number) => 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<T = any> extends Omit<BaseBindComponentProps, \"children\" | \"name\"> {\n name?: string;\n children?: ((props: BindComponentRenderProp<T>) => React.ReactElement) | React.ReactElement;\n}\n\nexport type BindComponent<T = any> = React.ComponentType<BindComponentProps<T>> & {\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":";;;;;AAwBA,IAAAA,WAAA,GAAAC,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAH,WAAA,EAAAI,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAL,WAAA,CAAAK,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,IAAA;MAAA,OAAAT,WAAA,CAAAK,GAAA;IAAA;EAAA;AAAA;AACA,IAAAK,MAAA,GAAAT,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAO,MAAA,EAAAN,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAK,MAAA,CAAAL,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,IAAA;MAAA,OAAAC,MAAA,CAAAL,GAAA;IAAA;EAAA;AAAA;AACA,IAAAM,OAAA,GAAAV,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAQ,OAAA,EAAAP,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAM,OAAA,CAAAN,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,IAAA;MAAA,OAAAE,OAAA,CAAAN,GAAA;IAAA;EAAA;AAAA","ignoreList":[]}
1
+ {"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["import type * as React from \"react\";\nimport type { ReactElement, ReactNode } from \"react\";\nimport type { Plugin } from \"@webiny/plugins/types.js\";\nimport type {\n BindComponent as BaseBindComponent,\n BindComponentProps as BaseBindComponentProps,\n BindComponentRenderProp as BaseBindComponentRenderProp,\n FormAPI\n} from \"@webiny/form\";\nimport type { IconName, IconPrefix } from \"@fortawesome/fontawesome-svg-core\";\nimport type {\n CmsModelFieldValidator,\n CmsModelFieldValidatorsFactory,\n CmsModelFieldValidatorsGroup\n} from \"./validation.js\";\nimport type { CmsModel, CmsModelField } from \"./model.js\";\nimport type { CmsIdentity } from \"~/types/shared.js\";\nimport type { SourceType } from \"dnd-core\";\nimport type { IconPickerIconDto } from \"@webiny/admin-ui\";\nimport { GenericRecord } from \"@webiny/app/types.js\";\nimport { Identity } from \"@webiny/app-admin/domain/Identity.js\";\n\nexport type DragObjectWithType = {\n type: SourceType;\n};\n\nexport type * from \"./validation.js\";\nexport type * from \"./model.js\";\nexport type * from \"./shared.js\";\n\ninterface QueryFieldParams {\n model: CmsModel;\n field: CmsModelField;\n graphQLTypePrefix: string;\n}\n\ninterface Position {\n row: number;\n index: number;\n}\n\ninterface Location {\n folderId: string;\n}\n\nexport interface DragSource extends DragObjectWithType {\n parent?: string;\n pos?: Partial<Position>;\n type: \"row\" | \"field\" | \"newField\";\n fieldType?: string;\n field?: CmsModelField | null;\n fields?: CmsModelField[];\n}\n\n/**\n * @deprecated Use `CmsModelFieldTypePlugin`.\n */\nexport type CmsEditorFieldTypePlugin = CmsModelFieldTypePlugin;\n\nexport interface CmsModelFieldTypePlugin 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[] | CmsModelFieldValidatorsGroup | CmsModelFieldValidatorsFactory;\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[] | CmsModelFieldValidatorsGroup | CmsModelFieldValidatorsFactory;\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 * allowList: true\n * ```\n */\n allowList?: 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 listLabel?: React.ReactNode;\n /**\n * Determines if this field type should be hidden from the admin UI.\n * If set to `true`, the field type will not be visible or selectable in the admin interface.\n */\n hideInAdmin?: boolean;\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<CmsModelField, \"type\" | \"validation\" | \"renderer\" | \"settings\">;\n /**\n * If `true` (default), this field will be configurable via a settings dialog.\n * If `false`, a user will not be able to open the settings dialog, not will the dialog be opened on field drop.\n */\n canEditSettings?: boolean;\n /**\n * Determine if a `draggable` can be dropped into this field.\n * NOTE: This is only applicable to nested field types.\n */\n canAccept?(field: CmsModelField, draggable: DragSource): boolean;\n /**\n * If `true` (default), will allow fields to be laid out into columns (next to each other).\n * If `false`, horizontal layout will not be allowed.\n * NOTE: This is only applicable to nested field types.\n */\n allowLayout?: boolean;\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 afterChangeLabel: (value: string) => void;\n uniqueFieldIdValidator: (fieldId: string) => void;\n contentModel: CmsModel;\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 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 | null);\n };\n render?(params: any): React.ReactElement;\n tags?: string[];\n /**\n * Render additional information in the Admin UI Model edit view\n */\n renderInfo?: (params: { field: CmsModelField; model: CmsModel }) => React.ReactElement;\n };\n}\n\nexport interface CmsModelFieldRendererSettingsProps {\n field: CmsModelField;\n}\n\nexport interface CmsModelFieldRendererProps {\n field: CmsModelField;\n Label: React.ComponentType<React.PropsWithChildren>;\n getBind: <T = any>(index?: number, key?: string) => BindComponent<T>;\n contentModel: CmsModel;\n}\n\n/**\n * @deprecated Use `CmsModelFieldRendererProps`.\n */\nexport type CmsEditorFieldRendererProps = CmsModelFieldRendererProps;\n\n/**\n * @deprecated Use `CmsModelFieldRendererPlugin`.\n */\nexport type CmsEditorFieldRendererPlugin = CmsModelFieldRendererPlugin;\n\nexport interface CmsModelFieldRendererPlugin 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 `CmsModelFieldTypePlugin`.\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 use a JSX element.\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.list\n * );\n * }\n * ```\n */\n canUse(props: {\n field: CmsModelField;\n fieldPlugin: CmsModelFieldTypePlugin;\n model: CmsModel;\n }): 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: CmsModelFieldRendererProps): React.ReactNode;\n renderSettings?: (props: CmsModelFieldRendererSettingsProps) => 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 interface CmsDynamicZoneTemplate {\n id: string;\n name: string;\n gqlTypeName: string;\n description: string;\n icon: string;\n fields: CmsModelField[];\n layout: string[][];\n validation: CmsModelFieldValidator[];\n tags?: string[];\n}\n\nexport interface CmsDynamicZoneTemplateWithTypename extends CmsDynamicZoneTemplate {\n __typename: string;\n}\n\nexport type CmsContentEntryStatusType = \"draft\" | \"published\" | \"unpublished\";\n\n/**\n * @deprecated Use `CmsContentEntry`.\n */\nexport type CmsEditorContentEntry = CmsContentEntry;\n\nexport interface CmsContentEntry<TValues extends GenericRecord = GenericRecord> {\n id: string;\n entryId: string;\n modelId: string;\n createdOn: string;\n createdBy: CmsIdentity;\n savedOn: string;\n savedBy: CmsIdentity;\n modifiedOn: string | null;\n modifiedBy: CmsIdentity | null;\n deletedOn: string | null;\n deletedBy: CmsIdentity | null;\n firstPublishedOn: string | null;\n firstPublishedBy: CmsIdentity | null;\n lastPublishedOn: string | null;\n lastPublishedBy: CmsIdentity | null;\n revisionCreatedOn: string;\n revisionCreatedBy: CmsIdentity;\n revisionSavedOn: string;\n revisionSavedBy: CmsIdentity;\n revisionModifiedOn: string | null;\n revisionModifiedBy: CmsIdentity | null;\n revisionDeletedOn: string | null;\n revisionDeletedBy: CmsIdentity | null;\n revisionFirstPublishedOn: string | null;\n revisionFirstPublishedBy: CmsIdentity | null;\n revisionLastPublishedOn: string | null;\n revisionLastPublishedBy: CmsIdentity | null;\n wbyAco_location: Location;\n meta: {\n title: string;\n description?: string;\n image?: string;\n locked: boolean;\n status: CmsContentEntryStatusType;\n version: number;\n };\n values?: TValues;\n}\n\nexport interface CmsContentEntryRevision {\n id: string;\n modelId: string;\n savedOn: string;\n deletedOn: string | null;\n firstPublishedOn: string | null;\n lastPublishedOn: string | null;\n createdBy: CmsIdentity;\n deletedBy: CmsIdentity | null;\n revisionCreatedOn: string;\n revisionSavedOn: string;\n revisionModifiedOn: string | null;\n revisionDeletedOn: string | null;\n revisionFirstPublishedOn: string | null;\n revisionLastPublishedOn: string | null;\n revisionCreatedBy: CmsIdentity;\n revisionSavedBy: CmsIdentity;\n revisionModifiedBy: CmsIdentity | null;\n revisionDeletedBy: CmsIdentity | null;\n revisionFirstPublishedBy: CmsIdentity | null;\n revisionLastPublishedBy: CmsIdentity | null;\n wbyAco_location: Location;\n meta: {\n title: string;\n locked: boolean;\n status: CmsContentEntryStatusType;\n version: number;\n };\n}\n\nexport type CmsEditorContentTab = React.ComponentType<{ 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 FieldLayoutPosition {\n row: number;\n index: number | null;\n}\n\nexport interface CmsEditorFormSettingsPlugin<T = GenericRecord> extends Plugin {\n type: \"cms-editor-form-settings\";\n title: string;\n description: string;\n icon: React.ReactElement;\n showSave?: boolean;\n render(props: { Bind: BaseBindComponent; form: FormAPI<T>; formData: T }): React.ReactNode;\n renderHeaderActions?(props: {\n Bind: BaseBindComponent;\n form: FormAPI<T>;\n formData: T;\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(): IconPickerIconDto[];\n}\n\n/**\n * Transform field value when sending data to the API.\n */\nexport interface CmsFieldValueTransformer<TField extends CmsModelField = CmsModelField>\n 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: TField) => 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: CmsModel;\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 Identity.Permission {\n accessLevel?: \"full\" | \"no\" | \"custom\";\n models?: string[];\n groups?: string[];\n endpoints?: string[];\n rwd?: string;\n own?: boolean;\n pw?: string;\n}\n\n/**\n * @category GraphQL\n * @category Error\n */\nexport interface CmsErrorResponse {\n message: string;\n code: string;\n data?: Record<string, any> | null;\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<T = any> extends BaseBindComponentRenderProp<T> {\n parentName: string;\n appendValue: (value: any, index?: number) => 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<T = any> extends Omit<BaseBindComponentProps, \"children\" | \"name\"> {\n name?: string;\n children?: ((props: BindComponentRenderProp<T>) => React.ReactElement) | React.ReactElement;\n}\n\nexport type BindComponent<T = any> = React.ComponentType<BindComponentProps<T>> & {\n parentName: string;\n ValidationContainer: React.ComponentType<{ children: React.ReactNode }>;\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":"","ignoreList":[]}