@contentful/field-editor-shared 2.13.9 → 2.14.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.
@@ -22,6 +22,11 @@ function _interop_require_default(obj) {
22
22
  default: obj
23
23
  };
24
24
  }
25
+ const MAX_LIMITS = {
26
+ Symbol: 256,
27
+ Text: 50000,
28
+ RichText: 200000
29
+ };
25
30
  function fromFieldValidations(validations = [], fieldType) {
26
31
  const sizeValidation = validations.find((v)=>'size' in v);
27
32
  const size = sizeValidation && sizeValidation.size || {};
@@ -46,7 +51,7 @@ function fromFieldValidations(validations = [], fieldType) {
46
51
  } else {
47
52
  return {
48
53
  type: 'max',
49
- max: fieldType === 'Symbol' ? 256 : 50000
54
+ max: MAX_LIMITS[fieldType]
50
55
  };
51
56
  }
52
57
  }
package/dist/esm/index.js CHANGED
@@ -1,13 +1,10 @@
1
- import * as ModalDialogLauncher from './ModalDialogLauncher';
2
- import * as ConstraintsUtils from './utils/constraints';
3
- import * as entityHelpers from './utils/entityHelpers';
1
+ export * as ModalDialogLauncher from './ModalDialogLauncher';
2
+ export * as ConstraintsUtils from './utils/constraints';
3
+ export * as entityHelpers from './utils/entityHelpers';
4
4
  export { AccessAPI, AppConfigAPI, BaseAppSDK, ContentType, DialogsAPI, EntryAPI, EntryFieldAPI, FieldAPI, FieldAppSDK, IdsAPI, LocalesAPI, LocationAPI, NavigatorAPI, NotifierAPI, OpenCustomWidgetOptions, ParametersAPI, SpaceAPI, WindowAPI } from '@contentful/app-sdk';
5
5
  export { CharCounter } from './CharCounter';
6
6
  export { CharValidation } from './CharValidation';
7
- export { ConstraintsUtils };
8
- export { entityHelpers };
9
7
  export { FieldConnector } from './FieldConnector';
10
- export { ModalDialogLauncher };
11
8
  export { PredefinedValuesError } from './PredefinedValuesError';
12
9
  export { isValidImage } from './utils/isValidImage';
13
10
  export { shortenStorageUnit, toLocaleString } from './utils/shortenStorageUnit';
@@ -1,4 +1,9 @@
1
1
  import isNumber from 'lodash/isNumber';
2
+ const MAX_LIMITS = {
3
+ Symbol: 256,
4
+ Text: 50000,
5
+ RichText: 200000
6
+ };
2
7
  export function fromFieldValidations(validations = [], fieldType) {
3
8
  const sizeValidation = validations.find((v)=>'size' in v);
4
9
  const size = sizeValidation && sizeValidation.size || {};
@@ -23,7 +28,7 @@ export function fromFieldValidations(validations = [], fieldType) {
23
28
  } else {
24
29
  return {
25
30
  type: 'max',
26
- max: fieldType === 'Symbol' ? 256 : 50000
31
+ max: MAX_LIMITS[fieldType]
27
32
  };
28
33
  }
29
34
  }
@@ -1,13 +1,10 @@
1
- import * as ModalDialogLauncher from './ModalDialogLauncher';
2
- import * as ConstraintsUtils from './utils/constraints';
3
- import * as entityHelpers from './utils/entityHelpers';
1
+ export * as ModalDialogLauncher from './ModalDialogLauncher';
2
+ export * as ConstraintsUtils from './utils/constraints';
3
+ export * as entityHelpers from './utils/entityHelpers';
4
4
  export { AccessAPI, AppConfigAPI, BaseAppSDK, ContentType, DialogsAPI, EntryAPI, EntryFieldAPI, FieldAPI, FieldAppSDK, IdsAPI, LocalesAPI, LocationAPI, NavigatorAPI, NotifierAPI, OpenCustomWidgetOptions, ParametersAPI, SpaceAPI, WindowAPI, } from '@contentful/app-sdk';
5
5
  export { CharCounter } from './CharCounter';
6
6
  export { CharValidation } from './CharValidation';
7
- export { ConstraintsUtils };
8
- export { entityHelpers };
9
7
  export { FieldConnector } from './FieldConnector';
10
- export { ModalDialogLauncher };
11
8
  export { PredefinedValuesError } from './PredefinedValuesError';
12
9
  export type { Asset, Entry, File } from './typesEntity';
13
10
  export { isValidImage } from './utils/isValidImage';
@@ -1,3 +1,3 @@
1
1
  import { ValidationType } from '../types';
2
- export declare function fromFieldValidations(validations: Record<string, any>[] | undefined, fieldType: 'Symbol' | 'Text'): ValidationType;
2
+ export declare function fromFieldValidations(validations: Record<string, any>[] | undefined, fieldType: 'Symbol' | 'Text' | 'RichText'): ValidationType;
3
3
  export declare function makeChecker(constraint: ValidationType): (length: number) => boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@contentful/field-editor-shared",
3
- "version": "2.13.9",
3
+ "version": "2.14.0",
4
4
  "main": "dist/cjs/index.js",
5
5
  "module": "dist/esm/index.js",
6
6
  "types": "dist/types/index.d.ts",
@@ -58,5 +58,5 @@
58
58
  "publishConfig": {
59
59
  "registry": "https://npm.pkg.github.com/"
60
60
  },
61
- "gitHead": "079953700877edc82c587553a9ffe6460874ac48"
61
+ "gitHead": "5e69589554e4e8e0870f08886848dc13434573ca"
62
62
  }