@umbraco-cms/backoffice 14.3.0-rc → 14.3.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 (46) hide show
  1. package/dist-cms/custom-elements.json +44 -0
  2. package/dist-cms/packages/block/block/workspace/block-element-manager.d.ts +2 -2
  3. package/dist-cms/packages/block/block/workspace/block-element-manager.js +2 -2
  4. package/dist-cms/packages/block/block/workspace/views/edit/block-workspace-view-edit-properties.element.d.ts +1 -0
  5. package/dist-cms/packages/block/block/workspace/views/edit/block-workspace-view-edit-properties.element.js +5 -0
  6. package/dist-cms/packages/block/block-grid/property-editors/block-grid-editor/property-editor-ui-block-grid.element.js +1 -1
  7. package/dist-cms/packages/block/block-list/property-editors/block-list-editor/property-editor-ui-block-list.element.js +1 -1
  8. package/dist-cms/packages/core/components/code-block/code-block.element.js +1 -1
  9. package/dist-cms/packages/core/content-type/components/property-type-based-property/property-type-based-property.element.d.ts +6 -0
  10. package/dist-cms/packages/core/content-type/components/property-type-based-property/property-type-based-property.element.js +32 -0
  11. package/dist-cms/packages/core/property/index.d.ts +1 -0
  12. package/dist-cms/packages/core/property/index.js +1 -0
  13. package/dist-cms/packages/core/property/types/index.d.ts +1 -0
  14. package/dist-cms/packages/core/property/types/index.js +1 -0
  15. package/dist-cms/packages/core/property/types/unsupported-properties.type.d.ts +1 -0
  16. package/dist-cms/packages/core/property/types/unsupported-properties.type.js +1 -0
  17. package/dist-cms/packages/core/property/unsupported-property/index.d.ts +2 -0
  18. package/dist-cms/packages/core/property/unsupported-property/index.js +2 -0
  19. package/dist-cms/packages/core/property/unsupported-property/unsupported-property.element.d.ts +15 -0
  20. package/dist-cms/packages/core/property/unsupported-property/unsupported-property.element.js +50 -0
  21. package/dist-cms/packages/core/property/unsupported-property/utils.d.ts +2 -0
  22. package/dist-cms/packages/core/property/unsupported-property/utils.js +3 -0
  23. package/dist-cms/packages/core/property-type/workspace/property-type-workspace.context.js +1 -1
  24. package/dist-cms/packages/core/validation/context/index.d.ts +2 -0
  25. package/dist-cms/packages/core/validation/context/index.js +2 -0
  26. package/dist-cms/packages/core/validation/{controllers → context}/server-model-validator.context.js +1 -1
  27. package/dist-cms/packages/core/validation/context/validation.context-token.d.ts +2 -2
  28. package/dist-cms/packages/core/validation/context/validation.context.d.ts +6 -77
  29. package/dist-cms/packages/core/validation/context/validation.context.js +7 -243
  30. package/dist-cms/packages/core/validation/controllers/index.d.ts +1 -2
  31. package/dist-cms/packages/core/validation/controllers/index.js +1 -2
  32. package/dist-cms/packages/core/validation/controllers/validation.controller.d.ts +84 -0
  33. package/dist-cms/packages/core/validation/controllers/validation.controller.js +252 -0
  34. package/dist-cms/packages/core/workspace/contexts/submittable-workspace-context-base.d.ts +2 -2
  35. package/dist-cms/packages/data-type/workspace/data-type-workspace.context.js +1 -1
  36. package/dist-cms/packages/documents/document-types/workspace/document-type-workspace.context.js +1 -1
  37. package/dist-cms/packages/documents/documents/entity-actions/create/document-create-options-modal.element.js +28 -13
  38. package/dist-cms/packages/documents/documents/workspace/document-workspace.context.js +1 -1
  39. package/dist-cms/packages/sysinfo/components/sysinfo.element.js +1 -1
  40. package/dist-cms/tsconfig.build.tsbuildinfo +1 -1
  41. package/dist-cms/umbraco-package.json +1 -1
  42. package/dist-cms/vscode-html-custom-data.json +21 -2
  43. package/package.json +1 -1
  44. /package/dist-cms/packages/core/validation/{controllers → context}/server-model-validator.context-token.d.ts +0 -0
  45. /package/dist-cms/packages/core/validation/{controllers → context}/server-model-validator.context-token.js +0 -0
  46. /package/dist-cms/packages/core/validation/{controllers → context}/server-model-validator.context.d.ts +0 -0
@@ -3304,6 +3304,10 @@
3304
3304
  {
3305
3305
  "name": "data-path",
3306
3306
  "type": "string | undefined"
3307
+ },
3308
+ {
3309
+ "name": "ownerEntityType",
3310
+ "type": "string | undefined"
3307
3311
  }
3308
3312
  ],
3309
3313
  "properties": [
@@ -3316,6 +3320,11 @@
3316
3320
  "attribute": "data-path",
3317
3321
  "type": "string | undefined"
3318
3322
  },
3323
+ {
3324
+ "name": "ownerEntityType",
3325
+ "attribute": "ownerEntityType",
3326
+ "type": "string | undefined"
3327
+ },
3319
3328
  {
3320
3329
  "name": "styles",
3321
3330
  "type": "array",
@@ -4683,6 +4692,41 @@
4683
4692
  }
4684
4693
  ]
4685
4694
  },
4695
+ {
4696
+ "name": "umb-unsupported-property",
4697
+ "path": "./../src/packages/core/property/unsupported-property/unsupported-property.element.ts",
4698
+ "attributes": [
4699
+ {
4700
+ "name": "alias",
4701
+ "type": "string",
4702
+ "default": "\"\""
4703
+ },
4704
+ {
4705
+ "name": "schema",
4706
+ "type": "string",
4707
+ "default": "\"\""
4708
+ }
4709
+ ],
4710
+ "properties": [
4711
+ {
4712
+ "name": "alias",
4713
+ "attribute": "alias",
4714
+ "type": "string",
4715
+ "default": "\"\""
4716
+ },
4717
+ {
4718
+ "name": "schema",
4719
+ "attribute": "schema",
4720
+ "type": "string",
4721
+ "default": "\"\""
4722
+ },
4723
+ {
4724
+ "name": "styles",
4725
+ "type": "array",
4726
+ "default": "[\"UmbTextStyles\",null]"
4727
+ }
4728
+ ]
4729
+ },
4686
4730
  {
4687
4731
  "name": "umb-restore-from-recycle-bin-modal",
4688
4732
  "path": "./../src/packages/core/recycle-bin/entity-action/restore-from-recycle-bin/modal/restore-from-recycle-bin-modal.element.ts",
@@ -5,7 +5,7 @@ import { UmbContentTypeStructureManager } from '../../../core/content-type/index
5
5
  import type { UmbControllerHost } from '../../../../libs/controller-api/index.js';
6
6
  import { type UmbClassInterface, UmbControllerBase } from '../../../../libs/class-api/index.js';
7
7
  import type { UmbVariantId } from '../../../core/variant/index.js';
8
- import { UmbValidationContext } from '../../../core/validation/index.js';
8
+ import { UmbValidationController } from '../../../core/validation/index.js';
9
9
  export declare class UmbBlockElementManager extends UmbControllerBase {
10
10
  #private;
11
11
  readonly data: import("rxjs/internal/Observable").Observable<UmbBlockDataType | undefined>;
@@ -13,7 +13,7 @@ export declare class UmbBlockElementManager extends UmbControllerBase {
13
13
  readonly unique: import("rxjs/internal/Observable").Observable<string | undefined>;
14
14
  readonly contentTypeId: import("rxjs/internal/Observable").Observable<string | undefined>;
15
15
  readonly structure: UmbContentTypeStructureManager<UmbContentTypeModel>;
16
- readonly validation: UmbValidationContext;
16
+ readonly validation: UmbValidationController;
17
17
  constructor(host: UmbControllerHost, dataPathPropertyName: string);
18
18
  reset(): void;
19
19
  setVariantId(variantId: UmbVariantId | undefined): void;
@@ -3,7 +3,7 @@ import { UmbContentTypeStructureManager } from '../../../core/content-type/index
3
3
  import { UmbClassState, UmbObjectState } from '../../../../libs/observable-api/index.js';
4
4
  import { UmbControllerBase } from '../../../../libs/class-api/index.js';
5
5
  import { UmbDocumentTypeDetailRepository } from '../../../documents/document-types/index.js';
6
- import { UmbValidationContext } from '../../../core/validation/index.js';
6
+ import { UmbValidationController } from '../../../core/validation/index.js';
7
7
  export class UmbBlockElementManager extends UmbControllerBase {
8
8
  //
9
9
  #data;
@@ -23,7 +23,7 @@ export class UmbBlockElementManager extends UmbControllerBase {
23
23
  this.unique = this.#data.asObservablePart((data) => data?.udi);
24
24
  this.contentTypeId = this.#data.asObservablePart((data) => data?.contentTypeKey);
25
25
  this.structure = new UmbContentTypeStructureManager(this, new UmbDocumentTypeDetailRepository(this));
26
- this.validation = new UmbValidationContext(this);
26
+ this.validation = new UmbValidationController(this);
27
27
  this.#updateLock = 0;
28
28
  this.finishPropertyValueChange = () => {
29
29
  this.#updateLock--;
@@ -9,6 +9,7 @@ export declare class UmbBlockWorkspaceViewEditPropertiesElement extends UmbLitEl
9
9
  set containerId(value: string | null | undefined);
10
10
  _propertyStructure: Array<UmbPropertyTypeModel>;
11
11
  _dataPaths?: Array<string>;
12
+ private _ownerEntityType?;
12
13
  constructor();
13
14
  render(): unknown;
14
15
  static styles: import("@lit/reactive-element/css-tag.js").CSSResult[];
@@ -32,6 +32,7 @@ let UmbBlockWorkspaceViewEditPropertiesElement = class UmbBlockWorkspaceViewEdit
32
32
  this._propertyStructure = [];
33
33
  this.consumeContext(UMB_BLOCK_WORKSPACE_CONTEXT, (workspaceContext) => {
34
34
  this.#blockWorkspace = workspaceContext;
35
+ this._ownerEntityType = this.#blockWorkspace.getEntityType();
35
36
  this.#setStructureManager();
36
37
  });
37
38
  }
@@ -53,6 +54,7 @@ let UmbBlockWorkspaceViewEditPropertiesElement = class UmbBlockWorkspaceViewEdit
53
54
  return repeat(this._propertyStructure, (property) => property.alias, (property, index) => html `<umb-property-type-based-property
54
55
  class="property"
55
56
  data-path=${this._dataPaths[index]}
57
+ .ownerEntityType=${this._ownerEntityType}
56
58
  .property=${property}
57
59
  ${umbDestroyOnDisconnect()}></umb-property-type-based-property>`);
58
60
  }
@@ -80,6 +82,9 @@ __decorate([
80
82
  __decorate([
81
83
  state()
82
84
  ], UmbBlockWorkspaceViewEditPropertiesElement.prototype, "_dataPaths", void 0);
85
+ __decorate([
86
+ state()
87
+ ], UmbBlockWorkspaceViewEditPropertiesElement.prototype, "_ownerEntityType", void 0);
83
88
  UmbBlockWorkspaceViewEditPropertiesElement = __decorate([
84
89
  customElement('umb-block-workspace-view-edit-properties')
85
90
  ], UmbBlockWorkspaceViewEditPropertiesElement);
@@ -48,7 +48,7 @@ let UmbPropertyEditorUIBlockGridElement = class UmbPropertyEditorUIBlockGridElem
48
48
  }
49
49
  constructor() {
50
50
  super();
51
- this.#validationContext = new UmbValidationContext(this).provide();
51
+ this.#validationContext = new UmbValidationContext(this);
52
52
  this.#context = new UmbBlockGridManagerContext(this);
53
53
  //
54
54
  this._value = {
@@ -104,7 +104,7 @@ let UmbPropertyEditorUIBlockListElement = class UmbPropertyEditorUIBlockListElem
104
104
  this.#entriesContext.setLayouts(model);
105
105
  },
106
106
  });
107
- this.#validationContext = new UmbValidationContext(this).provide();
107
+ this.#validationContext = new UmbValidationContext(this);
108
108
  //#catalogueModal: UmbModalRouteRegistrationController<typeof UMB_BLOCK_CATALOGUE_MODAL.DATA, undefined>;
109
109
  this._value = {
110
110
  layout: {},
@@ -76,7 +76,7 @@ let UmbCodeBlockElement = class UmbCodeBlockElement extends LitElement {
76
76
  pre,
77
77
  code {
78
78
  word-wrap: normal;
79
- white-space: pre-line;
79
+ white-space: pre;
80
80
  }
81
81
 
82
82
  #header {
@@ -6,10 +6,16 @@ export declare class UmbPropertyTypeBasedPropertyElement extends UmbLitElement {
6
6
  get property(): UmbPropertyTypeModel | undefined;
7
7
  private _property?;
8
8
  dataPath?: string;
9
+ get ownerEntityType(): string | undefined;
10
+ set ownerEntityType(value: string | undefined);
11
+ private _ownerEntityType?;
9
12
  private _propertyEditorUiAlias?;
13
+ private _propertyEditorSchemaAlias?;
14
+ private _isUnsupported?;
10
15
  private _dataTypeData?;
11
16
  private _dataTypeDetailRepository;
12
17
  private _dataTypeObserver?;
18
+ private _checkSchemaSupport;
13
19
  private _observeDataType;
14
20
  render(): import("lit-html").TemplateResult<1> | undefined;
15
21
  static styles: import("@lit/reactive-element/css-tag.js").CSSResult[];
@@ -10,6 +10,7 @@ import { UmbDataTypeDetailRepository } from '../../../../data-type/index.js';
10
10
  import { umbExtensionsRegistry } from '../../../extension-registry/index.js';
11
11
  import { UmbLitElement } from '../../../lit-element/index.js';
12
12
  import { UmbTextStyles } from '../../../style/index.js';
13
+ import { UMB_UNSUPPORTED_EDITOR_SCHEMA_ALIASES } from '../../../property/index.js';
13
14
  let UmbPropertyTypeBasedPropertyElement = class UmbPropertyTypeBasedPropertyElement extends UmbLitElement {
14
15
  constructor() {
15
16
  super(...arguments);
@@ -26,7 +27,21 @@ let UmbPropertyTypeBasedPropertyElement = class UmbPropertyTypeBasedPropertyElem
26
27
  get property() {
27
28
  return this._property;
28
29
  }
30
+ get ownerEntityType() {
31
+ return this._ownerEntityType;
32
+ }
33
+ set ownerEntityType(value) {
34
+ // Change this to ownerSchemaEditorAlias and retrieve the correct information.
35
+ this._ownerEntityType = value;
36
+ }
29
37
  #contentPropertyContext;
38
+ async _checkSchemaSupport() {
39
+ if (!this._ownerEntityType || !this._propertyEditorSchemaAlias)
40
+ return;
41
+ if (this._ownerEntityType in UMB_UNSUPPORTED_EDITOR_SCHEMA_ALIASES) {
42
+ this._isUnsupported = UMB_UNSUPPORTED_EDITOR_SCHEMA_ALIASES[this._ownerEntityType].includes(this._propertyEditorSchemaAlias);
43
+ }
44
+ }
30
45
  async _observeDataType(dataTypeUnique) {
31
46
  this._dataTypeObserver?.destroy();
32
47
  if (dataTypeUnique) {
@@ -37,6 +52,8 @@ let UmbPropertyTypeBasedPropertyElement = class UmbPropertyTypeBasedPropertyElem
37
52
  this.#contentPropertyContext.setDataType(contextValue);
38
53
  this._dataTypeData = dataType?.values;
39
54
  this._propertyEditorUiAlias = dataType?.editorUiAlias || undefined;
55
+ this._propertyEditorSchemaAlias = dataType?.editorAlias || undefined;
56
+ this._checkSchemaSupport();
40
57
  // If there is no UI, we will look up the Property editor model to find the default UI alias:
41
58
  if (!this._propertyEditorUiAlias && dataType?.editorAlias) {
42
59
  //use 'dataType.editorAlias' to look up the extension in the registry:
@@ -57,6 +74,12 @@ let UmbPropertyTypeBasedPropertyElement = class UmbPropertyTypeBasedPropertyElem
57
74
  render() {
58
75
  if (!this._propertyEditorUiAlias || !this._property?.alias)
59
76
  return;
77
+ if (this._isUnsupported) {
78
+ return html `<umb-unsupported-property
79
+ .alias=${this._property.alias}
80
+ .ownerEntityType=${this._ownerEntityType}
81
+ .schema=${this._propertyEditorSchemaAlias}></umb-unsupported-property>`;
82
+ }
60
83
  return html `
61
84
  <umb-property
62
85
  .dataPath=${this.dataPath}
@@ -85,9 +108,18 @@ __decorate([
85
108
  __decorate([
86
109
  property({ type: String, attribute: 'data-path' })
87
110
  ], UmbPropertyTypeBasedPropertyElement.prototype, "dataPath", void 0);
111
+ __decorate([
112
+ property({ type: String })
113
+ ], UmbPropertyTypeBasedPropertyElement.prototype, "ownerEntityType", null);
88
114
  __decorate([
89
115
  state()
90
116
  ], UmbPropertyTypeBasedPropertyElement.prototype, "_propertyEditorUiAlias", void 0);
117
+ __decorate([
118
+ state()
119
+ ], UmbPropertyTypeBasedPropertyElement.prototype, "_propertyEditorSchemaAlias", void 0);
120
+ __decorate([
121
+ state()
122
+ ], UmbPropertyTypeBasedPropertyElement.prototype, "_isUnsupported", void 0);
91
123
  __decorate([
92
124
  state()
93
125
  ], UmbPropertyTypeBasedPropertyElement.prototype, "_dataTypeData", void 0);
@@ -3,3 +3,4 @@ export * from './property-dataset/index.js';
3
3
  export * from './property-layout/index.js';
4
4
  export * from './property/index.js';
5
5
  export * from './types/index.js';
6
+ export * from './unsupported-property/index.js';
@@ -3,3 +3,4 @@ export * from './property-dataset/index.js';
3
3
  export * from './property-layout/index.js';
4
4
  export * from './property/index.js';
5
5
  export * from './types/index.js';
6
+ export * from './unsupported-property/index.js';
@@ -1 +1,2 @@
1
1
  export * from './property-value-data.type.js';
2
+ export * from './unsupported-properties.type.js';
@@ -1 +1,2 @@
1
1
  export * from './property-value-data.type.js';
2
+ export * from './unsupported-properties.type.js';
@@ -0,0 +1 @@
1
+ export type UmbUnsupportedEditorSchemaAliases = Record<string, Array<string>>;
@@ -0,0 +1,2 @@
1
+ export * from './utils.js';
2
+ export * from './unsupported-property.element.js';
@@ -0,0 +1,2 @@
1
+ export * from './utils.js';
2
+ export * from './unsupported-property.element.js';
@@ -0,0 +1,15 @@
1
+ import { UmbLitElement } from '../../lit-element/index.js';
2
+ /**
3
+ * @description Component for displaying an unsupported property
4
+ */
5
+ export declare class UmbUnsupportedPropertyElement extends UmbLitElement {
6
+ alias: string;
7
+ schema: string;
8
+ render(): import("lit-html").TemplateResult<1>;
9
+ static styles: import("@lit/reactive-element/css-tag.js").CSSResult[];
10
+ }
11
+ declare global {
12
+ interface HTMLElementTagNameMap {
13
+ 'umb-unsupported-property': UmbUnsupportedPropertyElement;
14
+ }
15
+ }
@@ -0,0 +1,50 @@
1
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
6
+ };
7
+ import { css, customElement, html, property } from '../../../../external/lit/index.js';
8
+ import { UmbLitElement } from '../../lit-element/index.js';
9
+ import { UmbTextStyles } from '../../style/index.js';
10
+ /**
11
+ * @description Component for displaying an unsupported property
12
+ */
13
+ let UmbUnsupportedPropertyElement = class UmbUnsupportedPropertyElement extends UmbLitElement {
14
+ constructor() {
15
+ super(...arguments);
16
+ this.alias = '';
17
+ this.schema = '';
18
+ }
19
+ render() {
20
+ return html `<div id="not-supported">
21
+ <umb-localize key="blockEditor_propertyEditorNotSupported" .args=${[this.alias, this.schema]}></umb-localize>
22
+ </div>`;
23
+ }
24
+ static { this.styles = [
25
+ UmbTextStyles,
26
+ css `
27
+ :host {
28
+ display: block;
29
+ padding: var(--uui-size-layout-1) 0;
30
+ }
31
+
32
+ #not-supported {
33
+ background-color: var(--uui-color-danger);
34
+ color: var(--uui-color-surface);
35
+ padding: var(--uui-size-space-4);
36
+ border-radius: var(--uui-border-radius);
37
+ }
38
+ `,
39
+ ]; }
40
+ };
41
+ __decorate([
42
+ property({ type: String })
43
+ ], UmbUnsupportedPropertyElement.prototype, "alias", void 0);
44
+ __decorate([
45
+ property({ type: String })
46
+ ], UmbUnsupportedPropertyElement.prototype, "schema", void 0);
47
+ UmbUnsupportedPropertyElement = __decorate([
48
+ customElement('umb-unsupported-property')
49
+ ], UmbUnsupportedPropertyElement);
50
+ export { UmbUnsupportedPropertyElement };
@@ -0,0 +1,2 @@
1
+ import type { UmbUnsupportedEditorSchemaAliases } from '../types/index.js';
2
+ export declare const UMB_UNSUPPORTED_EDITOR_SCHEMA_ALIASES: UmbUnsupportedEditorSchemaAliases;
@@ -0,0 +1,3 @@
1
+ export const UMB_UNSUPPORTED_EDITOR_SCHEMA_ALIASES = {
2
+ block: ['Umbraco.ImageCropper', 'Umbraco.UploadField'],
3
+ };
@@ -21,7 +21,7 @@ export class UmbPropertyTypeWorkspaceContext extends UmbSubmittableWorkspaceCont
21
21
  this.data = this.#data.asObservable();
22
22
  this.name = this.#data.asObservablePart((data) => data?.name);
23
23
  this.unique = this.#data.asObservablePart((data) => data?.id);
24
- this.addValidationContext(new UmbValidationContext(this).provide());
24
+ this.addValidationContext(new UmbValidationContext(this));
25
25
  const manifest = args.manifest;
26
26
  this.#entityType = manifest.meta?.entityType;
27
27
  this.#init = this.consumeContext(UMB_CONTENT_TYPE_WORKSPACE_CONTEXT, (context) => {
@@ -1,2 +1,4 @@
1
1
  export * from './validation.context.js';
2
2
  export * from './validation.context-token.js';
3
+ export * from './server-model-validator.context-token.js';
4
+ export * from './server-model-validator.context.js';
@@ -1,2 +1,4 @@
1
1
  export * from './validation.context.js';
2
2
  export * from './validation.context-token.js';
3
+ export * from './server-model-validator.context-token.js';
4
+ export * from './server-model-validator.context.js';
@@ -1,5 +1,5 @@
1
1
  import { UmbDataPathPropertyValueQuery } from '../utils/index.js';
2
- import { UMB_VALIDATION_CONTEXT } from '../context/validation.context-token.js';
2
+ import { UMB_VALIDATION_CONTEXT } from './validation.context-token.js';
3
3
  import { UMB_VALIDATION_EMPTY_LOCALIZATION_KEY } from '../const.js';
4
4
  import { UMB_SERVER_MODEL_VALIDATOR_CONTEXT } from './server-model-validator.context-token.js';
5
5
  import { UmbContextBase } from '../../../../libs/class-api/index.js';
@@ -1,3 +1,3 @@
1
- import type { UmbValidationContext } from './validation.context.js';
1
+ import type { UmbValidationController } from '../controllers/validation.controller.js';
2
2
  import { UmbContextToken } from '../../../../libs/context-api/index.js';
3
- export declare const UMB_VALIDATION_CONTEXT: UmbContextToken<UmbValidationContext, UmbValidationContext>;
3
+ export declare const UMB_VALIDATION_CONTEXT: UmbContextToken<UmbValidationController, UmbValidationController>;
@@ -1,89 +1,18 @@
1
- import type { UmbValidator } from '../interfaces/validator.interface.js';
2
- import type { UmbValidationMessageTranslator } from '../translators/index.js';
3
- import { UmbValidationMessagesManager } from './validation-messages.manager.js';
4
- import { type UmbClassInterface, UmbControllerBase } from '../../../../libs/class-api/index.js';
1
+ import { UmbValidationController } from '../controllers/validation.controller.js';
2
+ import type { UmbClassInterface } from '../../../../libs/class-api/index.js';
5
3
  import type { UmbControllerHost } from '../../../../libs/controller-api/index.js';
6
4
  /**
7
5
  * Validation Context is the core of Validation.
8
6
  * It hosts Validators that has to validate for the context to be valid.
9
7
  * It can also be used as a Validator as part of a parent Validation Context.
10
8
  */
11
- export declare class UmbValidationContext extends UmbControllerBase implements UmbValidator {
12
- #private;
13
- translationDataOf(path: string): any;
14
- setTranslationData(data: any): void;
15
- getTranslationData(): any;
16
- readonly messages: UmbValidationMessagesManager;
9
+ export declare class UmbValidationContext extends UmbValidationController {
17
10
  constructor(host: UmbControllerHost);
18
- /**
19
- * Add a path translator to this validation context.
20
- * @param translator
21
- */
22
- addTranslator(translator: UmbValidationMessageTranslator): Promise<void>;
23
- /**
24
- * Remove a path translator from this validation context.
25
- * @param translator
26
- */
27
- removeTranslator(translator: UmbValidationMessageTranslator): Promise<void>;
28
11
  /**
29
12
  * Provides the validation context to the current host, if not already provided to a different host.
30
- * @returns instance {UmbValidationContext} - Returns it self.
31
- */
32
- provide(): UmbValidationContext;
33
- /**
34
- * Provide this validation context to a specific controller host.
35
- * This can be used to Host a validation context in a Workspace, but provide it on a certain scope, like a specific Workspace View.
36
- * @param controllerHost {UmbClassInterface}
13
+ * @deprecated No need to provide, this happens automatically. (Do notice this was necessary in 14.3.-rc, but removed in 14.3 release)
14
+ * @returns instance {UmbValidationController} - Returns it self.
37
15
  */
16
+ provide(): UmbValidationController;
38
17
  provideAt(controllerHost: UmbClassInterface): void;
39
- /**
40
- * Define a specific data path for this validation context.
41
- * This will turn this validation context into a sub-context of the parent validation context.
42
- * This means that a two-way binding for messages will be established between the parent and the sub-context.
43
- * And it will inherit the Translation Data from its parent.
44
- *
45
- * messages and data will be localizes accordingly to the given data path.
46
- * @param dataPath {string} - The data path to bind this validation context to.
47
- * @example
48
- * ```ts
49
- * const validationContext = new UmbValidationContext(host);
50
- * validationContext.setDataPath("$.values[?(@.alias='my-property')].value");
51
- * ```
52
- *
53
- * A message with the path: '$.values[?(@.alias='my-property')].value.innerProperty', will for above example become '$.innerProperty' for the local Validation Context.
54
- */
55
- setDataPath(dataPath: string): void;
56
- /**
57
- * Get if this context is valid.
58
- * Notice this does not verify the validity.
59
- * @returns {boolean}
60
- */
61
- get isValid(): boolean;
62
- /**
63
- * Add a validator to this context.
64
- * This validator will have to be valid for the context to be valid.
65
- * If the context is in validation mode, the validator will be validated immediately.
66
- * @param validator { UmbValidator } - The validator to add to this context.
67
- */
68
- addValidator(validator: UmbValidator): void;
69
- /**
70
- * Remove a validator from this context.
71
- * @param validator {UmbValidator} - The validator to remove from this context.
72
- */
73
- removeValidator(validator: UmbValidator): void;
74
- /**
75
- * Validate this context, all the validators of this context will be validated.
76
- * Notice its a recursive check meaning sub validation contexts also validates their validators.
77
- * @returns succeed {Promise<boolean>} - Returns a promise that resolves to true if the validator succeeded, this depends on the validators and wether forceSucceed is set.
78
- */
79
- validate(): Promise<void>;
80
- /**
81
- * Focus the first invalid element that this context can find.
82
- */
83
- focusFirstInvalidElement(): void;
84
- /**
85
- * Reset the validation state of this context.
86
- */
87
- reset(): void;
88
- destroy(): void;
89
18
  }