@webiny/app-headless-cms 5.22.1 → 5.23.0-beta.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 (41) hide show
  1. package/admin/components/ContentEntryForm/functions/createValidators.js +1 -1
  2. package/admin/components/ContentEntryForm/useContentEntryForm.d.ts +1 -0
  3. package/admin/components/ContentEntryForm/useContentEntryForm.js +2 -2
  4. package/admin/components/ContentModelEditor/Editor.d.ts +1 -1
  5. package/admin/components/FieldEditor/EditFieldDialog/GeneralTab.js +1 -1
  6. package/admin/components/FieldEditor/FieldEditorContext.js +3 -0
  7. package/admin/components/FieldEditor/Styled.d.ts +2 -2
  8. package/admin/components/FieldEditor/utils/deleteField.js +1 -1
  9. package/admin/plugins/editor/defaultBar/Divider.d.ts +1 -1
  10. package/admin/plugins/editor/defaultBar/FormSettings/FormSettingsStyled.d.ts +2 -2
  11. package/admin/plugins/editor/defaultBar/Name/NameStyled.d.ts +3 -3
  12. package/admin/plugins/fieldRenderers/dateTime/Time.js +37 -8
  13. package/admin/plugins/fieldRenderers/ref/components/ContentEntriesAutocomplete.js +38 -3
  14. package/admin/plugins/fieldRenderers/ref/components/ContentEntriesMultiAutoComplete.js +39 -2
  15. package/admin/plugins/fieldRenderers/ref/components/MissingEntryHelpText.d.ts +1 -0
  16. package/admin/plugins/fieldRenderers/ref/components/MissingEntryHelpText.js +8 -2
  17. package/admin/plugins/fieldRenderers/ref/components/NewRefEntryFormDialog.js +12 -3
  18. package/admin/plugins/fieldRenderers/ref/components/useReference.js +7 -1
  19. package/admin/plugins/fieldRenderers/ref/components/useReferences.js +7 -1
  20. package/admin/plugins/fieldRenderers/ref/hooks/useNewRefEntry.d.ts +2 -1
  21. package/admin/plugins/fieldRenderers/ref/hooks/useNewRefEntry.js +30 -4
  22. package/admin/plugins/fieldRenderers/ref/refInput.js +3 -2
  23. package/admin/plugins/fieldRenderers/ref/refInputs.js +3 -2
  24. package/admin/plugins/fields/richText.js +0 -1
  25. package/admin/plugins/index.d.ts +1 -1
  26. package/admin/plugins/permissionRenderer/components/StyledComponents.d.ts +1 -1
  27. package/admin/plugins/transformers/dateTransformer.js +6 -4
  28. package/admin/plugins/validators/dateGte.js +42 -11
  29. package/admin/plugins/validators/dateLte.js +42 -11
  30. package/admin/plugins/validators/gte.js +33 -5
  31. package/admin/plugins/validators/in.js +33 -5
  32. package/admin/plugins/validators/lte.js +33 -5
  33. package/admin/plugins/validators/maxLength.js +33 -5
  34. package/admin/plugins/validators/minLength.js +33 -5
  35. package/admin/plugins/validators/pattern.d.ts +1 -1
  36. package/admin/plugins/validators/pattern.js +49 -20
  37. package/admin/plugins/validators/timeGte.js +32 -6
  38. package/admin/plugins/validators/timeLte.js +32 -6
  39. package/admin/views/contentEntries/ContentEntry/ContentEntryContext.d.ts +3 -3
  40. package/admin/views/contentEntries/ContentEntry.js +2 -1
  41. package/package.json +19 -19
@@ -1,15 +1,43 @@
1
+ import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
2
+ import _regeneratorRuntime from "@babel/runtime/regenerator";
1
3
  import { validation } from "@webiny/validation";
2
4
  export default {
3
5
  type: "cms-model-field-validator",
4
6
  name: "cms-model-field-validator-lte",
5
7
  validator: {
6
8
  name: "lte",
7
- validate: function validate(value, validator) {
8
- var lteValue = validator.settings.value;
9
+ validate: function () {
10
+ var _validate = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(value, validator) {
11
+ var lteValue;
12
+ return _regeneratorRuntime.wrap(function _callee$(_context) {
13
+ while (1) {
14
+ switch (_context.prev = _context.next) {
15
+ case 0:
16
+ lteValue = validator.settings.value;
9
17
 
10
- if (typeof lteValue !== "undefined") {
11
- return validation.validate(value, "lte:".concat(lteValue));
18
+ if (!(typeof lteValue === "undefined")) {
19
+ _context.next = 3;
20
+ break;
21
+ }
22
+
23
+ return _context.abrupt("return", true);
24
+
25
+ case 3:
26
+ return _context.abrupt("return", validation.validate(value, "lte:".concat(lteValue)));
27
+
28
+ case 4:
29
+ case "end":
30
+ return _context.stop();
31
+ }
32
+ }
33
+ }, _callee);
34
+ }));
35
+
36
+ function validate(_x, _x2) {
37
+ return _validate.apply(this, arguments);
12
38
  }
13
- }
39
+
40
+ return validate;
41
+ }()
14
42
  }
15
43
  };
@@ -1,15 +1,43 @@
1
+ import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
2
+ import _regeneratorRuntime from "@babel/runtime/regenerator";
1
3
  import { validation } from "@webiny/validation";
2
4
  export default {
3
5
  type: "cms-model-field-validator",
4
6
  name: "cms-model-field-validator-max-length",
5
7
  validator: {
6
8
  name: "maxLength",
7
- validate: function validate(value, validator) {
8
- var maxLengthValue = validator.settings.value;
9
+ validate: function () {
10
+ var _validate = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(value, validator) {
11
+ var maxLengthValue;
12
+ return _regeneratorRuntime.wrap(function _callee$(_context) {
13
+ while (1) {
14
+ switch (_context.prev = _context.next) {
15
+ case 0:
16
+ maxLengthValue = validator.settings.value;
9
17
 
10
- if (typeof maxLengthValue !== "undefined") {
11
- return validation.validate(value, "maxLength:".concat(maxLengthValue));
18
+ if (!(typeof maxLengthValue === "undefined")) {
19
+ _context.next = 3;
20
+ break;
21
+ }
22
+
23
+ return _context.abrupt("return", true);
24
+
25
+ case 3:
26
+ return _context.abrupt("return", validation.validate(value, "maxLength:".concat(maxLengthValue)));
27
+
28
+ case 4:
29
+ case "end":
30
+ return _context.stop();
31
+ }
32
+ }
33
+ }, _callee);
34
+ }));
35
+
36
+ function validate(_x, _x2) {
37
+ return _validate.apply(this, arguments);
12
38
  }
13
- }
39
+
40
+ return validate;
41
+ }()
14
42
  }
15
43
  };
@@ -1,15 +1,43 @@
1
+ import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
2
+ import _regeneratorRuntime from "@babel/runtime/regenerator";
1
3
  import { validation } from "@webiny/validation";
2
4
  export default {
3
5
  type: "cms-model-field-validator",
4
6
  name: "cms-model-field-validator-min-length",
5
7
  validator: {
6
8
  name: "minLength",
7
- validate: function validate(value, validator) {
8
- var minLengthValue = validator.settings.value;
9
+ validate: function () {
10
+ var _validate = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(value, validator) {
11
+ var minLengthValue;
12
+ return _regeneratorRuntime.wrap(function _callee$(_context) {
13
+ while (1) {
14
+ switch (_context.prev = _context.next) {
15
+ case 0:
16
+ minLengthValue = validator.settings.value;
9
17
 
10
- if (typeof minLengthValue !== "undefined") {
11
- return validation.validate(value, "minLength:".concat(minLengthValue));
18
+ if (!(typeof minLengthValue === "undefined")) {
19
+ _context.next = 3;
20
+ break;
21
+ }
22
+
23
+ return _context.abrupt("return", true);
24
+
25
+ case 3:
26
+ return _context.abrupt("return", validation.validate(value, "minLength:".concat(minLengthValue)));
27
+
28
+ case 4:
29
+ case "end":
30
+ return _context.stop();
31
+ }
32
+ }
33
+ }, _callee);
34
+ }));
35
+
36
+ function validate(_x, _x2) {
37
+ return _validate.apply(this, arguments);
12
38
  }
13
- }
39
+
40
+ return validate;
41
+ }()
14
42
  }
15
43
  };
@@ -3,7 +3,7 @@ declare const _default: {
3
3
  name: string;
4
4
  validator: {
5
5
  name: string;
6
- validate: (value: any, validator: any) => boolean;
6
+ validate: (value: any, validator: any) => Promise<boolean>;
7
7
  };
8
8
  };
9
9
  export default _default;
@@ -1,34 +1,63 @@
1
+ import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
2
+ import _regeneratorRuntime from "@babel/runtime/regenerator";
1
3
  import { plugins } from "@webiny/plugins";
2
4
  export default {
3
5
  type: "cms-model-field-validator",
4
6
  name: "cms-model-field-validator-pattern",
5
7
  validator: {
6
8
  name: "pattern",
7
- validate: function validate(value, validator) {
8
- if (!value) {
9
- return true;
10
- }
9
+ validate: function () {
10
+ var _validate = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(value, validator) {
11
+ var settings, pattern, patternPlugin;
12
+ return _regeneratorRuntime.wrap(function _callee$(_context) {
13
+ while (1) {
14
+ switch (_context.prev = _context.next) {
15
+ case 0:
16
+ if (value) {
17
+ _context.next = 2;
18
+ break;
19
+ }
11
20
 
12
- var settings = validator.settings;
13
- var pattern;
21
+ return _context.abrupt("return", true);
14
22
 
15
- if (settings.preset === "custom") {
16
- pattern = settings;
17
- } else {
18
- var patternPlugin = plugins.byType("cms-model-field-validator-pattern").find(function (item) {
19
- return item.pattern.name === settings.preset;
20
- });
23
+ case 2:
24
+ settings = validator.settings;
21
25
 
22
- if (patternPlugin) {
23
- pattern = patternPlugin.pattern;
24
- }
25
- }
26
+ if (settings.preset === "custom") {
27
+ pattern = settings;
28
+ } else {
29
+ patternPlugin = plugins.byType("cms-model-field-validator-pattern").find(function (item) {
30
+ return item.pattern.name === settings.preset;
31
+ });
32
+
33
+ if (patternPlugin) {
34
+ pattern = patternPlugin.pattern;
35
+ }
36
+ }
37
+
38
+ if (pattern) {
39
+ _context.next = 6;
40
+ break;
41
+ }
42
+
43
+ return _context.abrupt("return", true);
44
+
45
+ case 6:
46
+ return _context.abrupt("return", new RegExp(pattern.regex, pattern.flags).test(value));
47
+
48
+ case 7:
49
+ case "end":
50
+ return _context.stop();
51
+ }
52
+ }
53
+ }, _callee);
54
+ }));
26
55
 
27
- if (!pattern) {
28
- return true;
56
+ function validate(_x, _x2) {
57
+ return _validate.apply(this, arguments);
29
58
  }
30
59
 
31
- return new RegExp(pattern.regex, pattern.flags).test(value);
32
- }
60
+ return validate;
61
+ }()
33
62
  }
34
63
  };
@@ -1,3 +1,5 @@
1
+ import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
2
+ import _regeneratorRuntime from "@babel/runtime/regenerator";
1
3
  import { validation } from "@webiny/validation";
2
4
  export default (function () {
3
5
  return {
@@ -5,15 +7,39 @@ export default (function () {
5
7
  name: "cms-model-field-validator-time-gte",
6
8
  validator: {
7
9
  name: "timeGte",
8
- validate: function validate(value, validator) {
9
- var gteValue = validator.settings.value;
10
+ validate: function () {
11
+ var _validate = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(value, validator) {
12
+ var gteValue;
13
+ return _regeneratorRuntime.wrap(function _callee$(_context) {
14
+ while (1) {
15
+ switch (_context.prev = _context.next) {
16
+ case 0:
17
+ gteValue = validator.settings.value;
10
18
 
11
- if (typeof gteValue === "undefined") {
12
- return;
19
+ if (!(typeof gteValue === "undefined")) {
20
+ _context.next = 3;
21
+ break;
22
+ }
23
+
24
+ return _context.abrupt("return", true);
25
+
26
+ case 3:
27
+ return _context.abrupt("return", validation.validate(value, "timeGte:".concat(gteValue)));
28
+
29
+ case 4:
30
+ case "end":
31
+ return _context.stop();
32
+ }
33
+ }
34
+ }, _callee);
35
+ }));
36
+
37
+ function validate(_x, _x2) {
38
+ return _validate.apply(this, arguments);
13
39
  }
14
40
 
15
- return validation.validate(value, "timeGte:".concat(gteValue));
16
- }
41
+ return validate;
42
+ }()
17
43
  }
18
44
  };
19
45
  });
@@ -1,3 +1,5 @@
1
+ import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
2
+ import _regeneratorRuntime from "@babel/runtime/regenerator";
1
3
  import { validation } from "@webiny/validation";
2
4
  export default (function () {
3
5
  return {
@@ -5,15 +7,39 @@ export default (function () {
5
7
  name: "cms-model-field-validator-time-lte",
6
8
  validator: {
7
9
  name: "timeLte",
8
- validate: function validate(value, validator) {
9
- var lteValue = validator.settings.value;
10
+ validate: function () {
11
+ var _validate = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(value, validator) {
12
+ var lteValue;
13
+ return _regeneratorRuntime.wrap(function _callee$(_context) {
14
+ while (1) {
15
+ switch (_context.prev = _context.next) {
16
+ case 0:
17
+ lteValue = validator.settings.value;
10
18
 
11
- if (typeof lteValue === "undefined") {
12
- return;
19
+ if (!(typeof lteValue === "undefined")) {
20
+ _context.next = 3;
21
+ break;
22
+ }
23
+
24
+ return _context.abrupt("return", true);
25
+
26
+ case 3:
27
+ return _context.abrupt("return", validation.validate(value, "timeLte:".concat(lteValue)));
28
+
29
+ case 4:
30
+ case "end":
31
+ return _context.stop();
32
+ }
33
+ }
34
+ }, _callee);
35
+ }));
36
+
37
+ function validate(_x, _x2) {
38
+ return _validate.apply(this, arguments);
13
39
  }
14
40
 
15
- return validation.validate(value, "timeLte:".concat(lteValue));
16
- }
41
+ return validate;
42
+ }()
17
43
  }
18
44
  };
19
45
  });
@@ -20,14 +20,14 @@ export interface ContentEntryContext extends ContentEntriesContext {
20
20
  showEmptyView: boolean;
21
21
  }
22
22
  export declare const Context: React.Context<ContentEntryContext>;
23
- export interface ContentEntryContextProviderProps extends GetContentEntryFormType {
23
+ export interface ContentEntryContextProviderProps extends UseContentEntryProviderProps {
24
24
  children: React.ReactNode;
25
25
  }
26
- interface GetContentEntryFormType {
26
+ interface UseContentEntryProviderProps {
27
27
  getContentId?: () => string | null;
28
28
  isNewEntry?: () => boolean;
29
29
  }
30
- export declare const useContentEntryProviderProps: () => GetContentEntryFormType;
30
+ export declare const useContentEntryProviderProps: () => UseContentEntryProviderProps;
31
31
  export declare const Provider: {
32
32
  ({ children, isNewEntry, getContentId }: ContentEntryContextProviderProps): JSX.Element;
33
33
  displayName: string;
@@ -88,7 +88,8 @@ var ContentEntry = function ContentEntry() {
88
88
  entry: entry,
89
89
  onForm: function onForm(form) {
90
90
  return setFormRef(form);
91
- }
91
+ },
92
+ addEntryToListCache: true
92
93
  })))), /*#__PURE__*/React.createElement(Tab, {
93
94
  label: "Revisions",
94
95
  disabled: loading,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webiny/app-headless-cms",
3
- "version": "5.22.1",
3
+ "version": "5.23.0-beta.0",
4
4
  "main": "index.js",
5
5
  "repository": {
6
6
  "type": "git",
@@ -21,22 +21,22 @@
21
21
  "@fortawesome/free-brands-svg-icons": "5.15.4",
22
22
  "@fortawesome/free-regular-svg-icons": "5.15.4",
23
23
  "@fortawesome/free-solid-svg-icons": "5.15.4",
24
- "@fortawesome/react-fontawesome": "0.1.16",
25
- "@svgr/webpack": "6.2.0",
24
+ "@fortawesome/react-fontawesome": "0.1.17",
25
+ "@svgr/webpack": "6.2.1",
26
26
  "@types/react": "16.14.2",
27
- "@webiny/app": "5.22.1",
28
- "@webiny/app-admin": "5.22.1",
29
- "@webiny/app-graphql-playground": "5.22.1",
30
- "@webiny/app-i18n": "5.22.1",
31
- "@webiny/app-plugin-admin-welcome-screen": "5.22.1",
32
- "@webiny/app-security": "5.22.1",
33
- "@webiny/error": "5.22.1",
34
- "@webiny/form": "5.22.1",
35
- "@webiny/plugins": "5.22.1",
36
- "@webiny/react-router": "5.22.1",
37
- "@webiny/ui": "5.22.1",
38
- "@webiny/utils": "5.22.1",
39
- "@webiny/validation": "5.22.1",
27
+ "@webiny/app": "5.23.0-beta.0",
28
+ "@webiny/app-admin": "5.23.0-beta.0",
29
+ "@webiny/app-graphql-playground": "5.23.0-beta.0",
30
+ "@webiny/app-i18n": "5.23.0-beta.0",
31
+ "@webiny/app-plugin-admin-welcome-screen": "5.23.0-beta.0",
32
+ "@webiny/app-security": "5.23.0-beta.0",
33
+ "@webiny/error": "5.23.0-beta.0",
34
+ "@webiny/form": "5.23.0-beta.0",
35
+ "@webiny/plugins": "5.23.0-beta.0",
36
+ "@webiny/react-router": "5.23.0-beta.0",
37
+ "@webiny/ui": "5.23.0-beta.0",
38
+ "@webiny/utils": "5.23.0-beta.0",
39
+ "@webiny/validation": "5.23.0-beta.0",
40
40
  "apollo-cache": "1.3.5",
41
41
  "apollo-client": "2.6.10",
42
42
  "apollo-link": "1.2.14",
@@ -68,8 +68,8 @@
68
68
  "@babel/preset-env": "^7.16.4",
69
69
  "@babel/preset-react": "^7.16.0",
70
70
  "@babel/preset-typescript": "^7.16.0",
71
- "@webiny/cli": "^5.22.1",
72
- "@webiny/project-utils": "^5.22.1",
71
+ "@webiny/cli": "^5.23.0-beta.0",
72
+ "@webiny/project-utils": "^5.23.0-beta.0",
73
73
  "babel-plugin-emotion": "^9.2.8",
74
74
  "babel-plugin-lodash": "^3.3.4",
75
75
  "babel-plugin-module-resolver": "^4.1.0",
@@ -101,5 +101,5 @@
101
101
  ]
102
102
  }
103
103
  },
104
- "gitHead": "a11862df42aaf38380b28fa70e33b0ac3d37abe8"
104
+ "gitHead": "deb16c58954f7396c848f04806a2028aa53cc97b"
105
105
  }