@yuuvis/client-framework 2.3.1 → 2.3.3
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.
- package/datepicker/index.d.ts +1 -0
- package/datepicker/lib/date-input/date-input.component.d.ts +1 -3
- package/datepicker/lib/time-input/time-input.component.d.ts +0 -4
- package/fesm2022/yuuvis-client-framework-datepicker.mjs +34 -45
- package/fesm2022/yuuvis-client-framework-datepicker.mjs.map +1 -1
- package/fesm2022/yuuvis-client-framework-forms.mjs +2 -2
- package/fesm2022/yuuvis-client-framework-forms.mjs.map +1 -1
- package/fesm2022/yuuvis-client-framework-metadata-form.mjs +3 -2
- package/fesm2022/yuuvis-client-framework-metadata-form.mjs.map +1 -1
- package/fesm2022/yuuvis-client-framework-object-details.mjs +162 -56
- package/fesm2022/yuuvis-client-framework-object-details.mjs.map +1 -1
- package/fesm2022/yuuvis-client-framework-object-preview.mjs +4 -26
- package/fesm2022/yuuvis-client-framework-object-preview.mjs.map +1 -1
- package/fesm2022/yuuvis-client-framework-tile-list.mjs +5 -4
- package/fesm2022/yuuvis-client-framework-tile-list.mjs.map +1 -1
- package/lib/assets/i18n/de.json +2 -1
- package/lib/assets/i18n/en.json +2 -1
- package/object-details/lib/object-details-shell/object-details-shell.component.d.ts +1 -1
- package/object-details/lib/object-details-shell/object-details-shell.service.d.ts +2 -1
- package/object-details/lib/object-details.component.d.ts +4 -3
- package/object-details/lib/object-metadata/object-metadata-section/object-metadata-section.component.d.ts +11 -5
- package/object-details/lib/object-metadata/object-metadata.component.d.ts +18 -5
- package/object-preview/lib/services/object-preview.service.d.ts +1 -22
- package/package.json +4 -4
- package/tile-list/lib/tile-list/tile-list.component.d.ts +2 -3
|
@@ -175,9 +175,10 @@ class ObjectMetadataElementLabelDirective {
|
|
|
175
175
|
if (input.formChangedSubject) {
|
|
176
176
|
input.formChangedSubject?.pipe(takeUntilDestroyed(this.#dRef)).subscribe(() => {
|
|
177
177
|
const ctrl = input.ctrl;
|
|
178
|
+
const situation = input.situation;
|
|
178
179
|
this.state.set({
|
|
179
180
|
dirty: !!(ctrl && ctrl.dirty),
|
|
180
|
-
required: ctrl._eoFormElement.required && !this.#markAsInvalid(input.ctrl),
|
|
181
|
+
required: ctrl._eoFormElement.required && !this.#markAsInvalid(input.ctrl) && Situation.CREATE === situation,
|
|
181
182
|
invalid: this.#markAsInvalid(ctrl)
|
|
182
183
|
});
|
|
183
184
|
});
|
|
@@ -194,7 +195,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImpo
|
|
|
194
195
|
type: Directive,
|
|
195
196
|
args: [{
|
|
196
197
|
selector: '[yuvObjectMetadataElementLabel]',
|
|
197
|
-
standalone: true
|
|
198
|
+
standalone: true
|
|
198
199
|
}]
|
|
199
200
|
}] });
|
|
200
201
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"yuuvis-client-framework-metadata-form.mjs","sources":["../../../../../libs/yuuvis/client-framework/metadata-form/src/lib/metadata-form-element-registry.service.ts","../../../../../libs/yuuvis/client-framework/metadata-form/src/lib/object-metadata-element-label.directive.ts","../../../../../libs/yuuvis/client-framework/metadata-form/src/lib/object-metadata-element-error.directive.ts","../../../../../libs/yuuvis/client-framework/metadata-form/src/lib/object-metadata-element-template.directive.ts","../../../../../libs/yuuvis/client-framework/metadata-form/src/lib/metadata-form-field/metadata-form-field.component.ts","../../../../../libs/yuuvis/client-framework/metadata-form/src/lib/metadata-form-field/metadata-form-field.component.html","../../../../../libs/yuuvis/client-framework/metadata-form/src/yuuvis-client-framework-metadata-form.ts"],"sourcesContent":["import { Injectable, TemplateRef } from '@angular/core';\nimport { Situation } from '@yuuvis/client-core';\n\n/**\n * Object forms are used to render and edit metadata of DMS objects. Each property\n * of an object can be rendered in a diffenrent way, depending on the type of the property.\n * This service allows to register and retrieve templates for rendering these form elements.\n * \n * You can register templates for different situations like EDIT, SEARCH, and CREATE.\n * The templates will then be used to render the form elements in the object form component.\n * \n * So based on the property type you can register custom templates for rendering certain\n * form elements. This is useful if you want to render a property in a different way.\n * \n * Example:\n * Having a number property representing a rating, you might want to render it as \n * a list of stars instead of a simple input field. \n */\n@Injectable({\n providedIn: 'root'\n})\nexport class MetadataFormElementRegistry {\n private _defaults: { [propertyType: string]: TemplateRef<any> } = {};\n\n private _edit: { [propertyType: string]: TemplateRef<any> } = {};\n private _search: { [propertyType: string]: TemplateRef<any> } = {};\n private _create: { [propertyType: string]: TemplateRef<any> } = {};\n\n // registering a template by name will add this prefix to the given name\n NAME_PROPERTY_PREFIX = '@name:'\n\n /**\n * Get a template to render a certain form element\n * @param propertyType The internal type to get the template for\n * @param situation Form situation\n * @returns TemplateRef or undefined\n */\n getElementTemplate(propertyType: string, situation: string = Situation.EDIT): TemplateRef<any> | undefined {\n let cmps = { ...this._defaults, ...this._edit };\n if (situation === Situation.SEARCH) cmps = { ...this._defaults, ...this._edit, ...this._search };\n else if (situation === Situation.CREATE) cmps = { ...this._defaults, ...this._edit, ...this._create };\n\n return cmps[propertyType];\n }\n\n /**\n * Register an object form element for a certain internal type. You might add a new component\n * or overwrite an existung one.\n * @param propertyType The internal type to provide the component for\n * @param component The component\n * @param situation Form situation to provide thew form element for (defaults to EDIT)\n */\n addElementTemplate(propertyType: string, templateRef: TemplateRef<any>, situation: Situation = Situation.EDIT): void {\n if (propertyType && templateRef) {\n switch (situation) {\n case Situation.SEARCH: {\n this._search[propertyType] = templateRef;\n break;\n }\n case Situation.CREATE: {\n this._create[propertyType] = templateRef;\n break;\n }\n default: {\n this._edit[propertyType] = templateRef;\n }\n }\n }\n }\n\n /**\n * Remove a registered form element.\n * @param propertyType The internal type to remove the component for\n * @param situation Form situation to provide thew form element for (defaults to EDIT)\n */\n removeElementTemplate(propertyType: string, situation: Situation = Situation.EDIT) {\n switch (situation) {\n case Situation.SEARCH: {\n delete this._search[propertyType];\n break;\n }\n case Situation.CREATE: {\n delete this._create[propertyType];\n break;\n }\n default: {\n delete this._edit[propertyType];\n }\n }\n }\n\n /**\n * Register default form element component. Usually this will be done by the object\n * form component itself.\n * @param propertyType The internal type to provide the component for\n * @param component The default component\n */\n _addDefaultElementTemplate(propertyType: string, templateRef: TemplateRef<any>): void {\n if (propertyType && templateRef) {\n this._defaults[propertyType] = templateRef;\n }\n }\n\n /**\n * Remove a registered default form element.\n * @param propertyType The internal type to remove the component for\n */\n _removeDefaultElementTemplate(propertyType: string) {\n delete this._defaults[propertyType];\n }\n}\n","import { AfterViewInit, DestroyRef, Directive, effect, ElementRef, inject, input, OnInit, signal } from '@angular/core';\nimport { takeUntilDestroyed } from '@angular/core/rxjs-interop';\nimport { AbstractControl, FormControlStatus, Validators } from '@angular/forms';\nimport { MetadataFormFieldContext } from './metadata-form-field/metadata-form-field.interface';\nimport { ObjectFormControl } from '@yuuvis/client-core';\n\n/**\n * Directive to apply styles to an object metadata element label based on its control status.\n * Depending on the state of the control (dirty, error, required), it will add or remove specific classes\n * to the label element. These classes could then be used to style the label accordingly.\n *\n * Could be placed on any HTML element, but is primarily intended for use on `<mat-label>` or `<label>` elements.\n * If you would like to use it on any other element, make sure to add the class 'label' to it.\n * \n * @example\n * <mat-label [yuvObjectMetadataElementLabel]=\"ctx\">My Label</mat-label>\n * <label [yuvObjectMetadataElementLabel]=\"ctx\">My Label</label>\n * <div class=\"label\" [yuvObjectMetadataElementLabel]=\"ctx\">My Label</div>\n */\n@Directive({\n selector: '[yuvObjectMetadataElementLabel]',\n standalone: true,\n})\nexport class ObjectMetadataElementLabelDirective implements OnInit, AfterViewInit {\n #elRef = inject(ElementRef);\n #dRef = inject(DestroyRef);\n\n state = signal({\n dirty: false,\n required: false,\n invalid: false\n });\n #stateEffect = effect(() => {\n this.#applyState();\n });\n\n yuvObjectMetadataElementLabel = input<MetadataFormFieldContext>();\n\n #applyState() {\n const s = this.state();\n this.#toggleClass('dirty', s.dirty);\n this.#toggleClass('required', s.required);\n this.#toggleClass('invalid', s.invalid);\n }\n\n #markAsInvalid(ctrl: AbstractControl<any, any>): boolean {\n return ctrl.invalid && (ctrl.dirty || ctrl.touched);\n }\n\n #toggleClass(state: 'dirty' | 'invalid' | 'required', condition: boolean) {\n const matLabelEl = this.#elRef.nativeElement as HTMLElement;\n const matFormFieldEl = matLabelEl.closest('mat-form-field');\n\n if (matFormFieldEl) {\n matFormFieldEl.classList.toggle(`yuv-formfield-${state}`, condition);\n }\n if (matLabelEl) {\n // if the directive is put on a label outside of a mat-form-field, we'll add an\n // indicator element to the label itself\n const classPrefix = matLabelEl.tagName === 'LABEL' ? 'yuv-label-marker' : 'yuv-label';\n matLabelEl.classList.toggle(`${classPrefix}-${state}`, condition);\n }\n }\n\n ngOnInit() {\n const input = this.yuvObjectMetadataElementLabel();\n if (input) {\n if (input.formChangedSubject) {\n input.formChangedSubject?.pipe(takeUntilDestroyed(this.#dRef)).subscribe(() => {\n const ctrl = input.ctrl! as ObjectFormControl;\n this.state.set({\n dirty: !!(ctrl && ctrl.dirty),\n required: ctrl._eoFormElement.required && !this.#markAsInvalid(input.ctrl!),\n invalid: this.#markAsInvalid(ctrl)\n });\n });\n }\n }\n }\n\n ngAfterViewInit(): void {\n this.#applyState();\n }\n}\n","import { DestroyRef, Directive, ElementRef, inject, input, OnInit } from '@angular/core';\nimport { takeUntilDestroyed } from '@angular/core/rxjs-interop';\nimport { FormControlStatus } from '@angular/forms';\nimport { ObjectFormControl } from '@yuuvis/client-core';\nimport { FormTranslateService } from '@yuuvis/client-framework/common';\n\n/**\n * Directive to apply an object-form related error to as inner text to an element.\n * This could be used to render objec tform related errors in a custom element like <mat-error>.\n * \n * @example\n * <mat-error [yuvObjectMetadataElementError]=\"myControl\"></mat-error>\n */\n@Directive({\n selector: '[yuvObjectMetadataElementError]',\n standalone: true\n})\nexport class ObjectMetadataElementErrorDirective implements OnInit {\n #elRef = inject(ElementRef);\n #dRef = inject(DestroyRef);\n #fts = inject(FormTranslateService);\n\n yuvObjectMetadataElementError = input<ObjectFormControl>();\n\n #getErrors(): string[] {\n const ctrl = this.yuvObjectMetadataElementError();\n\n // only show errors if the control has been touched\n const shouldShowErrors = ctrl && ctrl.errors && (ctrl.touched || ctrl.dirty);\n\n return shouldShowErrors\n ? Object.keys(ctrl.errors).map((key) => {\n return key === 'eoformScript' ? ctrl._eoFormElement.error.msg : this.#fts.getErrorLabel(key, ctrl.errors![key].params);\n })\n : [];\n }\n\n ngOnInit() {\n const ctrl = this.yuvObjectMetadataElementError();\n if (ctrl) {\n ctrl.statusChanges.pipe(takeUntilDestroyed(this.#dRef)).subscribe((s: FormControlStatus) => {\n if (s === 'INVALID') {\n const err = this.#getErrors();\n this.#elRef.nativeElement.innerText = err.length > 0 ? err[0] : '';\n }\n });\n }\n }\n}\n","import { Directive, Input, OnDestroy, OnInit, TemplateRef, inject, input } from '@angular/core';\nimport { Situation } from '@yuuvis/client-core';\nimport { MetadataFormElementRegistry } from './metadata-form-element-registry.service';\n\n/**\n * Directive to be applied to a `ng-template`. It will register the template as a\n * form element used by object-form component.\n *\n * Context is provided with the following fields:\n * - situation: form situation 'EDIT', 'CREATE', 'SEARCH'\n * - field: ObjectTypeField\n * - ngControl: Reactive FormControl\n *\n * @example\n * <ng-template yuvMetadataElementTemplate propertyType=\"boolean:switch\" let-ctx>...</ng-template>\n *\n */\n@Directive({\n selector: '[yuvMetadataElementTemplate]',\n standalone: true\n})\nexport class ObjectMetadataElementTemplateDirective implements OnInit, OnDestroy {\n #registry = inject(MetadataFormElementRegistry);\n #template = inject(TemplateRef<any>);\n\n /**\n * Bucket to register the template. Use 'default' for templates that should be\n * used across all situations.\n */\n @Input() yuvMetadataElementTemplate?: string;\n /**\n * Situation to register the template for. So only object forms for that\n * situation (CREATE, EDIT, SEARCH) will use the template. Defaults to `EDIT`.\n */\n situation = input<Situation>(Situation.EDIT);\n\n /**\n * Internal property type to get the registered template. You need to set either\n * `propertyType` or `propertyName` to get a template. Setting a name and\n * a type, the name will be used because it is more precise.\n */\n propertyType = input<string>();\n /**\n * Pick registered metadata element by name. You need to set either\n * `propertyType` or `propertyName` to get a template. Setting a name and\n * a type, the name will be used because it is more precise.\n */\n propertyName = input<string>();\n #registrationKey?: string;\n\n ngOnInit(): void {\n const pn = this.propertyName();\n this.#registrationKey = pn ? `${this.#registry.NAME_PROPERTY_PREFIX}${pn}` : this.propertyType();\n if (this.#registrationKey) {\n if (this.yuvMetadataElementTemplate === 'default') {\n this.#registry._addDefaultElementTemplate(this.#registrationKey, this.#template);\n } else this.#registry.addElementTemplate(this.#registrationKey, this.#template, this.situation());\n }\n }\n\n ngOnDestroy(): void {\n if (!this.#registrationKey) return;\n if (this.yuvMetadataElementTemplate === 'default') this.#registry._removeDefaultElementTemplate(this.#registrationKey);\n else this.#registry.removeElementTemplate(this.#registrationKey, this.situation());\n }\n}\n","import { NgClass, NgTemplateOutlet } from '@angular/common';\nimport { Component, computed, effect, inject, input, signal, TemplateRef, untracked, ViewEncapsulation } from '@angular/core';\n\nimport { MatFormFieldModule } from '@angular/material/form-field';\n\nimport { ObjectTypeField, Situation, SystemService } from '@yuuvis/client-core';\nimport { injectNgControl, NoopValueAccessorDirective } from '@yuuvis/client-framework/common';\nimport { Subject } from 'rxjs';\nimport { MetadataFormElementRegistry } from '../metadata-form-element-registry.service';\nimport { MetadataFormFieldContext, ParentFormChangedEvent } from './metadata-form-field.interface';\n\n\n\n/**\n * Component to render a metadata form field within an object form. These forms are\n * created to render and edit metadata of DMS objects. This component is used as a wrapper\n * for the actual form element, which is defined by the `formField` input.\n */\n@Component({\n selector: 'yuv-metadata-form-field',\n standalone: true,\n imports: [NgClass, NgTemplateOutlet, MatFormFieldModule],\n templateUrl: './metadata-form-field.component.html',\n styleUrl: './metadata-form-field.component.scss',\n hostDirectives: [NoopValueAccessorDirective],\n encapsulation: ViewEncapsulation.None,\n host: {\n class: 'yuv-metadata-form-field',\n }\n})\nexport class MetadataFormFieldComponent {\n #registry = inject(MetadataFormElementRegistry);\n #system = inject(SystemService);\n\n #ngControl = injectNgControl();\n elementTemplate = signal<TemplateRef<any> | undefined>(undefined);\n readonly = false;\n\n formChangedSubject = input<Subject<ParentFormChangedEvent>>()\n formField = input.required<ObjectTypeField>({ alias: 'field' });\n #fieldEffect = effect(() => {\n const field = this.formField();\n\n untracked(() => {\n // check for template by name ...\n const templateByName = this.#registry.getElementTemplate(`${this.#registry.NAME_PROPERTY_PREFIX}${field.name}`, this.situation());\n if (templateByName) this.elementTemplate.set(templateByName);\n else {\n if (!field._internalType) field._internalType = this.#system.getInternalFormElementType(field.propertyType);\n this.elementTemplate.set(this.#registry.getElementTemplate(field._internalType, this.situation()));\n }\n // TODO: set readonly state based on ...????... schema?\n this.readonly = false;\n });\n });\n \n context = computed<MetadataFormFieldContext>(() => {\n const field = this.formField();\n field.required = this.situation() !== Situation.SEARCH ? field.required : false;\n return {\n label: field.label || field.name,\n description: field.description,\n situation: this.situation() || Situation.EDIT,\n field,\n ctrl: this.#ngControl?.control || undefined,\n formChangedSubject: this.formChangedSubject()\n };\n });\n\n /**\n * Form situation, if not set default will be 'EDIT'\n */\n situation = input<string | undefined>(Situation.EDIT);\n}\n","@let field = formField();\n@let et = elementTemplate();\n\n@if (field) {\n <div class=\"form-field t-{{ field._internalType }}\" #formField [attr.data-name]=\"field.name\" [ngClass]=\"{ disabled: !!readonly }\">\n @if (et) {\n <ng-container *ngTemplateOutlet=\"et; context: { $implicit: context() }\"></ng-container>\n } @else {\n <em>\n <strong>{{ field._internalType }}</strong>\n </em>\n }\n </div>\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;AAGA;;;;;;;;;;;;;;AAcG;MAIU,2BAA2B,CAAA;AAHxC,IAAA,WAAA,GAAA;QAIU,IAAS,CAAA,SAAA,GAAiD,EAAE;QAE5D,IAAK,CAAA,KAAA,GAAiD,EAAE;QACxD,IAAO,CAAA,OAAA,GAAiD,EAAE;QAC1D,IAAO,CAAA,OAAA,GAAiD,EAAE;;QAGlE,IAAoB,CAAA,oBA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C,IAAA,SAAS;AACT,IAAA,OAAO;AAEP,IAAA,UAAU;AAMV,IAAA,YAAY;+GAVD,0BAA0B,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA,CAAA;AAA1B,IAAA,SAAA,IAAA,CAAA,IAAA,GAAA,EAAA,CAAA,oBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,SAAA,EAAA,IAAA,EAAA,0BAA0B,snBC9BvC,ybAcA,EAAA,MAAA,EAAA,CAAA,2oDAAA,CAAA,EAAA,YAAA,EAAA,CAAA,EAAA,IAAA,EAAA,WAAA,EAAA,IAAA,EDOY,OAAO,EAAE,QAAA,EAAA,WAAA,EAAA,MAAA,EAAA,CAAA,OAAA,EAAA,SAAA,CAAA,EAAA,EAAA,EAAA,IAAA,EAAA,WAAA,EAAA,IAAA,EAAA,gBAAgB,mJAAE,kBAAkB,EAAA,CAAA,EAAA,aAAA,EAAA,EAAA,CAAA,iBAAA,CAAA,IAAA,EAAA,CAAA,CAAA;;4FAS5C,0BAA0B,EAAA,UAAA,EAAA,CAAA;kBAZtC,SAAS;AACE,YAAA,IAAA,EAAA,CAAA,EAAA,QAAA,EAAA,yBAAyB,cACvB,IAAI,EAAA,OAAA,EACP,CAAC,OAAO,EAAE,gBAAgB,EAAE,kBAAkB,CAAC,EAAA,cAAA,EAGxC,CAAC,0BAA0B,CAAC,iBAC7B,iBAAiB,CAAC,IAAI,EAC/B,IAAA,EAAA;AACJ,wBAAA,KAAK,EAAE,yBAAyB;AACjC,qBAAA,EAAA,QAAA,EAAA,ybAAA,EAAA,MAAA,EAAA,CAAA,2oDAAA,CAAA,EAAA;;;AE5BH;;AAEG;;;;"}
|
|
1
|
+
{"version":3,"file":"yuuvis-client-framework-metadata-form.mjs","sources":["../../../../../libs/yuuvis/client-framework/metadata-form/src/lib/metadata-form-element-registry.service.ts","../../../../../libs/yuuvis/client-framework/metadata-form/src/lib/object-metadata-element-label.directive.ts","../../../../../libs/yuuvis/client-framework/metadata-form/src/lib/object-metadata-element-error.directive.ts","../../../../../libs/yuuvis/client-framework/metadata-form/src/lib/object-metadata-element-template.directive.ts","../../../../../libs/yuuvis/client-framework/metadata-form/src/lib/metadata-form-field/metadata-form-field.component.ts","../../../../../libs/yuuvis/client-framework/metadata-form/src/lib/metadata-form-field/metadata-form-field.component.html","../../../../../libs/yuuvis/client-framework/metadata-form/src/yuuvis-client-framework-metadata-form.ts"],"sourcesContent":["import { Injectable, TemplateRef } from '@angular/core';\nimport { Situation } from '@yuuvis/client-core';\n\n/**\n * Object forms are used to render and edit metadata of DMS objects. Each property\n * of an object can be rendered in a diffenrent way, depending on the type of the property.\n * This service allows to register and retrieve templates for rendering these form elements.\n * \n * You can register templates for different situations like EDIT, SEARCH, and CREATE.\n * The templates will then be used to render the form elements in the object form component.\n * \n * So based on the property type you can register custom templates for rendering certain\n * form elements. This is useful if you want to render a property in a different way.\n * \n * Example:\n * Having a number property representing a rating, you might want to render it as \n * a list of stars instead of a simple input field. \n */\n@Injectable({\n providedIn: 'root'\n})\nexport class MetadataFormElementRegistry {\n private _defaults: { [propertyType: string]: TemplateRef<any> } = {};\n\n private _edit: { [propertyType: string]: TemplateRef<any> } = {};\n private _search: { [propertyType: string]: TemplateRef<any> } = {};\n private _create: { [propertyType: string]: TemplateRef<any> } = {};\n\n // registering a template by name will add this prefix to the given name\n NAME_PROPERTY_PREFIX = '@name:'\n\n /**\n * Get a template to render a certain form element\n * @param propertyType The internal type to get the template for\n * @param situation Form situation\n * @returns TemplateRef or undefined\n */\n getElementTemplate(propertyType: string, situation: string = Situation.EDIT): TemplateRef<any> | undefined {\n let cmps = { ...this._defaults, ...this._edit };\n if (situation === Situation.SEARCH) cmps = { ...this._defaults, ...this._edit, ...this._search };\n else if (situation === Situation.CREATE) cmps = { ...this._defaults, ...this._edit, ...this._create };\n\n return cmps[propertyType];\n }\n\n /**\n * Register an object form element for a certain internal type. You might add a new component\n * or overwrite an existung one.\n * @param propertyType The internal type to provide the component for\n * @param component The component\n * @param situation Form situation to provide thew form element for (defaults to EDIT)\n */\n addElementTemplate(propertyType: string, templateRef: TemplateRef<any>, situation: Situation = Situation.EDIT): void {\n if (propertyType && templateRef) {\n switch (situation) {\n case Situation.SEARCH: {\n this._search[propertyType] = templateRef;\n break;\n }\n case Situation.CREATE: {\n this._create[propertyType] = templateRef;\n break;\n }\n default: {\n this._edit[propertyType] = templateRef;\n }\n }\n }\n }\n\n /**\n * Remove a registered form element.\n * @param propertyType The internal type to remove the component for\n * @param situation Form situation to provide thew form element for (defaults to EDIT)\n */\n removeElementTemplate(propertyType: string, situation: Situation = Situation.EDIT) {\n switch (situation) {\n case Situation.SEARCH: {\n delete this._search[propertyType];\n break;\n }\n case Situation.CREATE: {\n delete this._create[propertyType];\n break;\n }\n default: {\n delete this._edit[propertyType];\n }\n }\n }\n\n /**\n * Register default form element component. Usually this will be done by the object\n * form component itself.\n * @param propertyType The internal type to provide the component for\n * @param component The default component\n */\n _addDefaultElementTemplate(propertyType: string, templateRef: TemplateRef<any>): void {\n if (propertyType && templateRef) {\n this._defaults[propertyType] = templateRef;\n }\n }\n\n /**\n * Remove a registered default form element.\n * @param propertyType The internal type to remove the component for\n */\n _removeDefaultElementTemplate(propertyType: string) {\n delete this._defaults[propertyType];\n }\n}\n","import { AfterViewInit, DestroyRef, Directive, effect, ElementRef, inject, input, OnInit, signal } from '@angular/core';\nimport { takeUntilDestroyed } from '@angular/core/rxjs-interop';\nimport { AbstractControl, FormControlStatus, Validators } from '@angular/forms';\nimport { MetadataFormFieldContext } from './metadata-form-field/metadata-form-field.interface';\nimport { ObjectFormControl, Situation } from '@yuuvis/client-core';\n\n/**\n * Directive to apply styles to an object metadata element label based on its control status.\n * Depending on the state of the control (dirty, error, required), it will add or remove specific classes\n * to the label element. These classes could then be used to style the label accordingly.\n *\n * Could be placed on any HTML element, but is primarily intended for use on `<mat-label>` or `<label>` elements.\n * If you would like to use it on any other element, make sure to add the class 'label' to it.\n *\n * @example\n * <mat-label [yuvObjectMetadataElementLabel]=\"ctx\">My Label</mat-label>\n * <label [yuvObjectMetadataElementLabel]=\"ctx\">My Label</label>\n * <div class=\"label\" [yuvObjectMetadataElementLabel]=\"ctx\">My Label</div>\n */\n@Directive({\n selector: '[yuvObjectMetadataElementLabel]',\n standalone: true\n})\nexport class ObjectMetadataElementLabelDirective implements OnInit, AfterViewInit {\n #elRef = inject(ElementRef);\n #dRef = inject(DestroyRef);\n\n state = signal({\n dirty: false,\n required: false,\n invalid: false\n });\n #stateEffect = effect(() => {\n this.#applyState();\n });\n\n yuvObjectMetadataElementLabel = input<MetadataFormFieldContext>();\n\n #applyState() {\n const s = this.state();\n this.#toggleClass('dirty', s.dirty);\n this.#toggleClass('required', s.required);\n this.#toggleClass('invalid', s.invalid);\n }\n\n #markAsInvalid(ctrl: AbstractControl<any, any>): boolean {\n return ctrl.invalid && (ctrl.dirty || ctrl.touched);\n }\n\n #toggleClass(state: 'dirty' | 'invalid' | 'required', condition: boolean) {\n const matLabelEl = this.#elRef.nativeElement as HTMLElement;\n const matFormFieldEl = matLabelEl.closest('mat-form-field');\n\n if (matFormFieldEl) {\n matFormFieldEl.classList.toggle(`yuv-formfield-${state}`, condition);\n }\n if (matLabelEl) {\n // if the directive is put on a label outside of a mat-form-field, we'll add an\n // indicator element to the label itself\n const classPrefix = matLabelEl.tagName === 'LABEL' ? 'yuv-label-marker' : 'yuv-label';\n matLabelEl.classList.toggle(`${classPrefix}-${state}`, condition);\n }\n }\n\n ngOnInit() {\n const input = this.yuvObjectMetadataElementLabel();\n if (input) {\n if (input.formChangedSubject) {\n input.formChangedSubject?.pipe(takeUntilDestroyed(this.#dRef)).subscribe(() => {\n const ctrl = input.ctrl! as ObjectFormControl;\n const situation = input.situation;\n this.state.set({\n dirty: !!(ctrl && ctrl.dirty),\n required: ctrl._eoFormElement.required && !this.#markAsInvalid(input.ctrl!) && Situation.CREATE === situation,\n invalid: this.#markAsInvalid(ctrl)\n });\n });\n }\n }\n }\n\n ngAfterViewInit(): void {\n this.#applyState();\n }\n}\n","import { DestroyRef, Directive, ElementRef, inject, input, OnInit } from '@angular/core';\nimport { takeUntilDestroyed } from '@angular/core/rxjs-interop';\nimport { FormControlStatus } from '@angular/forms';\nimport { ObjectFormControl } from '@yuuvis/client-core';\nimport { FormTranslateService } from '@yuuvis/client-framework/common';\n\n/**\n * Directive to apply an object-form related error to as inner text to an element.\n * This could be used to render objec tform related errors in a custom element like <mat-error>.\n * \n * @example\n * <mat-error [yuvObjectMetadataElementError]=\"myControl\"></mat-error>\n */\n@Directive({\n selector: '[yuvObjectMetadataElementError]',\n standalone: true\n})\nexport class ObjectMetadataElementErrorDirective implements OnInit {\n #elRef = inject(ElementRef);\n #dRef = inject(DestroyRef);\n #fts = inject(FormTranslateService);\n\n yuvObjectMetadataElementError = input<ObjectFormControl>();\n\n #getErrors(): string[] {\n const ctrl = this.yuvObjectMetadataElementError();\n\n // only show errors if the control has been touched\n const shouldShowErrors = ctrl && ctrl.errors && (ctrl.touched || ctrl.dirty);\n\n return shouldShowErrors\n ? Object.keys(ctrl.errors).map((key) => {\n return key === 'eoformScript' ? ctrl._eoFormElement.error.msg : this.#fts.getErrorLabel(key, ctrl.errors![key].params);\n })\n : [];\n }\n\n ngOnInit() {\n const ctrl = this.yuvObjectMetadataElementError();\n if (ctrl) {\n ctrl.statusChanges.pipe(takeUntilDestroyed(this.#dRef)).subscribe((s: FormControlStatus) => {\n if (s === 'INVALID') {\n const err = this.#getErrors();\n this.#elRef.nativeElement.innerText = err.length > 0 ? err[0] : '';\n }\n });\n }\n }\n}\n","import { Directive, Input, OnDestroy, OnInit, TemplateRef, inject, input } from '@angular/core';\nimport { Situation } from '@yuuvis/client-core';\nimport { MetadataFormElementRegistry } from './metadata-form-element-registry.service';\n\n/**\n * Directive to be applied to a `ng-template`. It will register the template as a\n * form element used by object-form component.\n *\n * Context is provided with the following fields:\n * - situation: form situation 'EDIT', 'CREATE', 'SEARCH'\n * - field: ObjectTypeField\n * - ngControl: Reactive FormControl\n *\n * @example\n * <ng-template yuvMetadataElementTemplate propertyType=\"boolean:switch\" let-ctx>...</ng-template>\n *\n */\n@Directive({\n selector: '[yuvMetadataElementTemplate]',\n standalone: true\n})\nexport class ObjectMetadataElementTemplateDirective implements OnInit, OnDestroy {\n #registry = inject(MetadataFormElementRegistry);\n #template = inject(TemplateRef<any>);\n\n /**\n * Bucket to register the template. Use 'default' for templates that should be\n * used across all situations.\n */\n @Input() yuvMetadataElementTemplate?: string;\n /**\n * Situation to register the template for. So only object forms for that\n * situation (CREATE, EDIT, SEARCH) will use the template. Defaults to `EDIT`.\n */\n situation = input<Situation>(Situation.EDIT);\n\n /**\n * Internal property type to get the registered template. You need to set either\n * `propertyType` or `propertyName` to get a template. Setting a name and\n * a type, the name will be used because it is more precise.\n */\n propertyType = input<string>();\n /**\n * Pick registered metadata element by name. You need to set either\n * `propertyType` or `propertyName` to get a template. Setting a name and\n * a type, the name will be used because it is more precise.\n */\n propertyName = input<string>();\n #registrationKey?: string;\n\n ngOnInit(): void {\n const pn = this.propertyName();\n this.#registrationKey = pn ? `${this.#registry.NAME_PROPERTY_PREFIX}${pn}` : this.propertyType();\n if (this.#registrationKey) {\n if (this.yuvMetadataElementTemplate === 'default') {\n this.#registry._addDefaultElementTemplate(this.#registrationKey, this.#template);\n } else this.#registry.addElementTemplate(this.#registrationKey, this.#template, this.situation());\n }\n }\n\n ngOnDestroy(): void {\n if (!this.#registrationKey) return;\n if (this.yuvMetadataElementTemplate === 'default') this.#registry._removeDefaultElementTemplate(this.#registrationKey);\n else this.#registry.removeElementTemplate(this.#registrationKey, this.situation());\n }\n}\n","import { NgClass, NgTemplateOutlet } from '@angular/common';\nimport { Component, computed, effect, inject, input, signal, TemplateRef, untracked, ViewEncapsulation } from '@angular/core';\n\nimport { MatFormFieldModule } from '@angular/material/form-field';\n\nimport { ObjectTypeField, Situation, SystemService } from '@yuuvis/client-core';\nimport { injectNgControl, NoopValueAccessorDirective } from '@yuuvis/client-framework/common';\nimport { Subject } from 'rxjs';\nimport { MetadataFormElementRegistry } from '../metadata-form-element-registry.service';\nimport { MetadataFormFieldContext, ParentFormChangedEvent } from './metadata-form-field.interface';\n\n\n\n/**\n * Component to render a metadata form field within an object form. These forms are\n * created to render and edit metadata of DMS objects. This component is used as a wrapper\n * for the actual form element, which is defined by the `formField` input.\n */\n@Component({\n selector: 'yuv-metadata-form-field',\n standalone: true,\n imports: [NgClass, NgTemplateOutlet, MatFormFieldModule],\n templateUrl: './metadata-form-field.component.html',\n styleUrl: './metadata-form-field.component.scss',\n hostDirectives: [NoopValueAccessorDirective],\n encapsulation: ViewEncapsulation.None,\n host: {\n class: 'yuv-metadata-form-field',\n }\n})\nexport class MetadataFormFieldComponent {\n #registry = inject(MetadataFormElementRegistry);\n #system = inject(SystemService);\n\n #ngControl = injectNgControl();\n elementTemplate = signal<TemplateRef<any> | undefined>(undefined);\n readonly = false;\n\n formChangedSubject = input<Subject<ParentFormChangedEvent>>()\n formField = input.required<ObjectTypeField>({ alias: 'field' });\n #fieldEffect = effect(() => {\n const field = this.formField();\n\n untracked(() => {\n // check for template by name ...\n const templateByName = this.#registry.getElementTemplate(`${this.#registry.NAME_PROPERTY_PREFIX}${field.name}`, this.situation());\n if (templateByName) this.elementTemplate.set(templateByName);\n else {\n if (!field._internalType) field._internalType = this.#system.getInternalFormElementType(field.propertyType);\n this.elementTemplate.set(this.#registry.getElementTemplate(field._internalType, this.situation()));\n }\n // TODO: set readonly state based on ...????... schema?\n this.readonly = false;\n });\n });\n \n context = computed<MetadataFormFieldContext>(() => {\n const field = this.formField();\n field.required = this.situation() !== Situation.SEARCH ? field.required : false;\n return {\n label: field.label || field.name,\n description: field.description,\n situation: this.situation() || Situation.EDIT,\n field,\n ctrl: this.#ngControl?.control || undefined,\n formChangedSubject: this.formChangedSubject()\n };\n });\n\n /**\n * Form situation, if not set default will be 'EDIT'\n */\n situation = input<string | undefined>(Situation.EDIT);\n}\n","@let field = formField();\n@let et = elementTemplate();\n\n@if (field) {\n <div class=\"form-field t-{{ field._internalType }}\" #formField [attr.data-name]=\"field.name\" [ngClass]=\"{ disabled: !!readonly }\">\n @if (et) {\n <ng-container *ngTemplateOutlet=\"et; context: { $implicit: context() }\"></ng-container>\n } @else {\n <em>\n <strong>{{ field._internalType }}</strong>\n </em>\n }\n </div>\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;AAGA;;;;;;;;;;;;;;AAcG;MAIU,2BAA2B,CAAA;AAHxC,IAAA,WAAA,GAAA;QAIU,IAAS,CAAA,SAAA,GAAiD,EAAE;QAE5D,IAAK,CAAA,KAAA,GAAiD,EAAE;QACxD,IAAO,CAAA,OAAA,GAAiD,EAAE;QAC1D,IAAO,CAAA,OAAA,GAAiD,EAAE;;QAGlE,IAAoB,CAAA,oBAAA,GAAG,QAAQ;AAiFhC;AA/EC;;;;;AAKG;AACH,IAAA,kBAAkB,CAAC,YAAoB,EAAE,SAAoB,GAAA,SAAS,CAAC,IAAI,EAAA;AACzE,QAAA,IAAI,IAAI,GAAG,EAAE,GAAG,IAAI,CAAC,SAAS,EAAE,GAAG,IAAI,CAAC,KAAK,EAAE;AAC/C,QAAA,IAAI,SAAS,KAAK,SAAS,CAAC,MAAM;AAAE,YAAA,IAAI,GAAG,EAAE,GAAG,IAAI,CAAC,SAAS,EAAE,GAAG,IAAI,CAAC,KAAK,EAAE,GAAG,IAAI,CAAC,OAAO,EAAE;AAC3F,aAAA,IAAI,SAAS,KAAK,SAAS,CAAC,MAAM;AAAE,YAAA,IAAI,GAAG,EAAE,GAAG,IAAI,CAAC,SAAS,EAAE,GAAG,IAAI,CAAC,KAAK,EAAE,GAAG,IAAI,CAAC,OAAO,EAAE;AAErG,QAAA,OAAO,IAAI,CAAC,YAAY,CAAC;;AAG3B;;;;;;AAMG;IACH,kBAAkB,CAAC,YAAoB,EAAE,WAA6B,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,kBAAkB,EAAA,CAAA,EAAA,aAAA,EAAA,EAAA,CAAA,iBAAA,CAAA,IAAA,EAAA,CAAA,CAAA;;4FAS5C,0BAA0B,EAAA,UAAA,EAAA,CAAA;kBAZtC,SAAS;AACE,YAAA,IAAA,EAAA,CAAA,EAAA,QAAA,EAAA,yBAAyB,cACvB,IAAI,EAAA,OAAA,EACP,CAAC,OAAO,EAAE,gBAAgB,EAAE,kBAAkB,CAAC,EAAA,cAAA,EAGxC,CAAC,0BAA0B,CAAC,iBAC7B,iBAAiB,CAAC,IAAI,EAC/B,IAAA,EAAA;AACJ,wBAAA,KAAK,EAAE,yBAAyB;AACjC,qBAAA,EAAA,QAAA,EAAA,ybAAA,EAAA,MAAA,EAAA,CAAA,2oDAAA,CAAA,EAAA;;;AE5BH;;AAEG;;;;"}
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { inject, contentChild, input, effect, Component, signal, Injectable,
|
|
2
|
+
import { inject, contentChild, input, effect, Component, signal, Injectable, viewChildren, linkedSignal, output, computed, Input, untracked, NgModule, Pipe } from '@angular/core';
|
|
3
3
|
import * as i1 from '@angular/common';
|
|
4
4
|
import { CommonModule } from '@angular/common';
|
|
5
5
|
import * as i1$1 from '@yuuvis/client-core';
|
|
6
|
-
import { ObjectConfigService, EventService, YuvEventType, Utils, DmsService, TranslateService, LocaleDatePipe, TranslateModule, SystemService, Situation, PendingChangesService, NotificationService, UserService } from '@yuuvis/client-core';
|
|
6
|
+
import { ObjectConfigService, EventService, YuvEventType, Utils, DmsService, TranslateService, LocaleDatePipe, TranslateModule, SystemService, Situation, PendingChangesService, NotificationService, UserService, TabGuardDirective } from '@yuuvis/client-core';
|
|
7
7
|
import { RendererDirective } from '@yuuvis/client-framework/renderer';
|
|
8
8
|
import * as i2 from '@angular/material/icon';
|
|
9
9
|
import { MatIconModule } from '@angular/material/icon';
|
|
10
10
|
import { RetentionBadgeComponent, BusyOverlayDirective } from '@yuuvis/client-framework/common';
|
|
11
|
-
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
|
11
|
+
import { takeUntilDestroyed, rxResource } from '@angular/core/rxjs-interop';
|
|
12
12
|
import { MatTooltipModule } from '@angular/material/tooltip';
|
|
13
|
-
import { finalize } from 'rxjs';
|
|
13
|
+
import { finalize, catchError, of, map } from 'rxjs';
|
|
14
14
|
import * as i2$2 from '@angular/material/tabs';
|
|
15
15
|
import { MatTabsModule } from '@angular/material/tabs';
|
|
16
16
|
import { ObjectPreviewComponent } from '@yuuvis/client-framework/object-preview';
|
|
@@ -95,20 +95,26 @@ class ObjectDetailsShellService {
|
|
|
95
95
|
this.id = Utils.uuid();
|
|
96
96
|
this.#dmsService = inject(DmsService);
|
|
97
97
|
this.translate = inject(TranslateService);
|
|
98
|
-
this
|
|
98
|
+
this.#dmsObject = signal(undefined);
|
|
99
|
+
this.dmsObject = this.#dmsObject.asReadonly();
|
|
99
100
|
this.contextError = signal(undefined);
|
|
100
101
|
this.busy = signal(false);
|
|
101
102
|
}
|
|
102
103
|
#dmsService;
|
|
104
|
+
#dmsObject;
|
|
105
|
+
setDmsObject(dmsObject) {
|
|
106
|
+
this.#dmsObject.set(dmsObject);
|
|
107
|
+
this.contextError.set(undefined);
|
|
108
|
+
}
|
|
103
109
|
fetchDmsObject(id) {
|
|
104
110
|
this.busy.set(true);
|
|
105
111
|
this.#dmsService
|
|
106
112
|
.getDmsObject(id)
|
|
107
113
|
.pipe(finalize(() => this.busy.set(false)))
|
|
108
114
|
.subscribe({
|
|
109
|
-
next: (dmsObject) => this
|
|
115
|
+
next: (dmsObject) => this.#dmsObject.set(dmsObject),
|
|
110
116
|
error: () => {
|
|
111
|
-
this
|
|
117
|
+
this.#dmsObject.set(undefined);
|
|
112
118
|
this.contextError.set(this.translate.instant('yuv.object-metadata.context.load.error'));
|
|
113
119
|
}
|
|
114
120
|
});
|
|
@@ -154,14 +160,14 @@ class ObjectDetailsShellComponent {
|
|
|
154
160
|
const o = e.data;
|
|
155
161
|
const dmsObj = this.dmsObject();
|
|
156
162
|
if (dmsObj && dmsObj.id === o.id)
|
|
157
|
-
this.
|
|
163
|
+
this.#odShellService.setDmsObject(o);
|
|
158
164
|
});
|
|
159
165
|
this.#eventService
|
|
160
166
|
.on(YuvEventType.DMS_OBJECT_DELETED)
|
|
161
167
|
.pipe(takeUntilDestroyed())
|
|
162
168
|
.subscribe((e) => {
|
|
163
169
|
if (e.data?.id === this.dmsObject()?.id) {
|
|
164
|
-
this.
|
|
170
|
+
this.#odShellService.setDmsObject(undefined);
|
|
165
171
|
}
|
|
166
172
|
});
|
|
167
173
|
}
|
|
@@ -343,44 +349,83 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImpo
|
|
|
343
349
|
class ObjectMetadataSectionComponent {
|
|
344
350
|
constructor() {
|
|
345
351
|
this.#system = inject(SystemService);
|
|
352
|
+
this.objectForms = viewChildren(ObjectFormComponent);
|
|
346
353
|
this._formOptions = signal(undefined);
|
|
347
|
-
|
|
354
|
+
// busy = signal<boolean>(false);
|
|
348
355
|
this.section = input.required();
|
|
349
|
-
this.
|
|
356
|
+
this.expandedInput = input(false, { alias: 'expanded' });
|
|
350
357
|
this.elementExtensions = input([]);
|
|
351
|
-
this.
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
358
|
+
this.expanded = linkedSignal(this.expandedInput);
|
|
359
|
+
// #objectFormLoadEffect = effect(() => {
|
|
360
|
+
// const section = this.section();
|
|
361
|
+
// const expanded = this.expanded();
|
|
362
|
+
// if (expanded && section && !this._formOptions()) {
|
|
363
|
+
// untracked(() => {
|
|
364
|
+
// this.busy.set(true);
|
|
365
|
+
// this.#system.getObjectTypeForm(section.id, section.situation || Situation.EDIT).subscribe({
|
|
366
|
+
// next: (formModel) => {
|
|
367
|
+
// this._formOptions.set({
|
|
368
|
+
// formModel,
|
|
369
|
+
// data: section.data || {}
|
|
370
|
+
// });
|
|
371
|
+
// this.busy.set(false);
|
|
372
|
+
// },
|
|
373
|
+
// error: () => {
|
|
374
|
+
// this._formOptions.set(undefined);
|
|
375
|
+
// this.busy.set(false);
|
|
376
|
+
// }
|
|
377
|
+
// });
|
|
378
|
+
// });
|
|
379
|
+
// }
|
|
380
|
+
// });
|
|
381
|
+
this.#formOptionsResource = rxResource({
|
|
382
|
+
request: () => ({ section: this.section(), extended: this.expanded() }),
|
|
383
|
+
loader: ({ request }) => {
|
|
384
|
+
if (request.extended && request.section) {
|
|
385
|
+
return this.#system.getObjectTypeForm(request.section.id, request.section.situation || Situation.EDIT).pipe(catchError(() => of(undefined)), map((formModel) => ({ formModel, data: request.section?.data || {} })));
|
|
386
|
+
}
|
|
387
|
+
else {
|
|
388
|
+
return of(undefined);
|
|
389
|
+
}
|
|
372
390
|
}
|
|
373
391
|
});
|
|
392
|
+
this.formOptions = this.#formOptionsResource.value;
|
|
393
|
+
this.busy = this.#formOptionsResource.isLoading;
|
|
374
394
|
this.statusChanged = output();
|
|
375
395
|
}
|
|
376
396
|
#system;
|
|
377
|
-
#objectFormLoadEffect
|
|
397
|
+
// #objectFormLoadEffect = effect(() => {
|
|
398
|
+
// const section = this.section();
|
|
399
|
+
// const expanded = this.expanded();
|
|
400
|
+
// if (expanded && section && !this._formOptions()) {
|
|
401
|
+
// untracked(() => {
|
|
402
|
+
// this.busy.set(true);
|
|
403
|
+
// this.#system.getObjectTypeForm(section.id, section.situation || Situation.EDIT).subscribe({
|
|
404
|
+
// next: (formModel) => {
|
|
405
|
+
// this._formOptions.set({
|
|
406
|
+
// formModel,
|
|
407
|
+
// data: section.data || {}
|
|
408
|
+
// });
|
|
409
|
+
// this.busy.set(false);
|
|
410
|
+
// },
|
|
411
|
+
// error: () => {
|
|
412
|
+
// this._formOptions.set(undefined);
|
|
413
|
+
// this.busy.set(false);
|
|
414
|
+
// }
|
|
415
|
+
// });
|
|
416
|
+
// });
|
|
417
|
+
// }
|
|
418
|
+
// });
|
|
419
|
+
#formOptionsResource;
|
|
420
|
+
resetForm() {
|
|
421
|
+
this.objectForms()?.forEach((f) => f.resetForm());
|
|
422
|
+
}
|
|
378
423
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: ObjectMetadataSectionComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
379
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.14", type: ObjectMetadataSectionComponent, isStandalone: true, selector: "yuv-object-metadata-section", inputs: { section: { classPropertyName: "section", publicName: "section", isSignal: true, isRequired: true, transformFunction: null },
|
|
424
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.14", type: ObjectMetadataSectionComponent, isStandalone: true, selector: "yuv-object-metadata-section", inputs: { section: { classPropertyName: "section", publicName: "section", isSignal: true, isRequired: true, transformFunction: null }, expandedInput: { classPropertyName: "expandedInput", publicName: "expanded", isSignal: true, isRequired: false, transformFunction: null }, elementExtensions: { classPropertyName: "elementExtensions", publicName: "elementExtensions", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { statusChanged: "statusChanged" }, viewQueries: [{ propertyName: "objectForms", predicate: ObjectFormComponent, descendants: true, isSignal: true }], ngImport: i0, template: "@let _section = section();\n@let fo = formOptions();\n\n<h3>\n <button\n type=\"button\"\n [attr.aria-expanded]=\"expanded()\"\n class=\"accordion-trigger\"\n [attr.aria-controls]=\"'sect_' + _section.id\"\n [id]=\"'accordion_' + _section.id\"\n (click)=\"expanded.set(!expanded())\"\n [attr.aria-busy]=\"busy()\"\n >\n @if (_section.icon) {\n @if (_section.svgIcon) {\n <mat-icon [svgIcon]=\"_section.icon\"></mat-icon>\n } @else {\n <mat-icon>{{ _section.icon }}</mat-icon>\n }\n }\n <span>{{ _section.label }}</span>\n @if (busy()) {\n <mat-spinner diameter=\"24\"></mat-spinner>\n }\n <mat-icon class=\"arr\">keyboard_arrow_down</mat-icon>\n </button>\n</h3>\n<div [id]=\"'sect_' + _section.id\" role=\"region\" [attr.aria-labelledby]=\"'accordion_' + _section.id\" class=\"accordion-panel\">\n @if (fo && expanded()) {\n <yuv-object-form [formOptions]=\"fo\" [elementExtensions]=\"elementExtensions()\" (statusChanged)=\"statusChanged.emit($event)\"></yuv-object-form>\n }\n</div>\n", styles: [":host{background-color:var(--_object-metadata-section-background);border:1px solid var(--ymt-outline-variant);border-radius:var(--_object-metadata-section-corner)}:host h3{margin:0;padding:0;display:flex}:host h3 button{margin:var(--ymt-spacing-2xs);border-radius:calc(var(--_object-metadata-section-corner) * .5);flex:1;padding:var(--ymt-spacing-xs);cursor:pointer;display:flex;gap:var(--ymt-spacing-xs);align-items:center;font-weight:700;color:var(--ymt-text-color-subtle);background-color:transparent;border:none}:host h3 button:hover{background-color:var(--ymt-hover-background)}:host h3 button:focus-visible{background-color:var(--ymt-hover-background);outline:2px solid var(--ymt-outline);outline-offset:-2px}:host h3 button[aria-expanded=true] mat-icon.arr{transform:rotate(180deg)}:host h3 button span{flex:1;text-align:start}:host h3 button mat-icon{margin-inline-end:var(--ymt-spacing-xs);transition:transform .3s ease}:host details{background-color:var(--_object-metadata-section-background);border:1px solid var(--ymt-outline-variant);border-radius:var(--_object-metadata-section-corner)}:host details:not(:last-child){margin-block-end:var(--ymt-spacing-m)}:host details[open] yuv-icon.arr{transform:rotate(180deg)}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "ngmodule", type: MatIconModule }, { kind: "component", type: i2.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "ngmodule", type: MatProgressSpinnerModule }, { kind: "component", type: i2$1.MatProgressSpinner, selector: "mat-progress-spinner, mat-spinner", inputs: ["color", "mode", "value", "diameter", "strokeWidth"], exportAs: ["matProgressSpinner"] }, { kind: "component", type: ObjectFormComponent, selector: "yuv-object-form", inputs: ["formOptions", "inert", "elementExtensions", "isInnerTableForm"], outputs: ["statusChanged", "onFormReady"] }] }); }
|
|
380
425
|
}
|
|
381
426
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: ObjectMetadataSectionComponent, decorators: [{
|
|
382
427
|
type: Component,
|
|
383
|
-
args: [{ selector: 'yuv-object-metadata-section', imports: [CommonModule, MatIconModule, MatProgressSpinnerModule, ObjectFormComponent], template: "@let _section = section();\n@let fo =
|
|
428
|
+
args: [{ selector: 'yuv-object-metadata-section', imports: [CommonModule, MatIconModule, MatProgressSpinnerModule, ObjectFormComponent], template: "@let _section = section();\n@let fo = formOptions();\n\n<h3>\n <button\n type=\"button\"\n [attr.aria-expanded]=\"expanded()\"\n class=\"accordion-trigger\"\n [attr.aria-controls]=\"'sect_' + _section.id\"\n [id]=\"'accordion_' + _section.id\"\n (click)=\"expanded.set(!expanded())\"\n [attr.aria-busy]=\"busy()\"\n >\n @if (_section.icon) {\n @if (_section.svgIcon) {\n <mat-icon [svgIcon]=\"_section.icon\"></mat-icon>\n } @else {\n <mat-icon>{{ _section.icon }}</mat-icon>\n }\n }\n <span>{{ _section.label }}</span>\n @if (busy()) {\n <mat-spinner diameter=\"24\"></mat-spinner>\n }\n <mat-icon class=\"arr\">keyboard_arrow_down</mat-icon>\n </button>\n</h3>\n<div [id]=\"'sect_' + _section.id\" role=\"region\" [attr.aria-labelledby]=\"'accordion_' + _section.id\" class=\"accordion-panel\">\n @if (fo && expanded()) {\n <yuv-object-form [formOptions]=\"fo\" [elementExtensions]=\"elementExtensions()\" (statusChanged)=\"statusChanged.emit($event)\"></yuv-object-form>\n }\n</div>\n", styles: [":host{background-color:var(--_object-metadata-section-background);border:1px solid var(--ymt-outline-variant);border-radius:var(--_object-metadata-section-corner)}:host h3{margin:0;padding:0;display:flex}:host h3 button{margin:var(--ymt-spacing-2xs);border-radius:calc(var(--_object-metadata-section-corner) * .5);flex:1;padding:var(--ymt-spacing-xs);cursor:pointer;display:flex;gap:var(--ymt-spacing-xs);align-items:center;font-weight:700;color:var(--ymt-text-color-subtle);background-color:transparent;border:none}:host h3 button:hover{background-color:var(--ymt-hover-background)}:host h3 button:focus-visible{background-color:var(--ymt-hover-background);outline:2px solid var(--ymt-outline);outline-offset:-2px}:host h3 button[aria-expanded=true] mat-icon.arr{transform:rotate(180deg)}:host h3 button span{flex:1;text-align:start}:host h3 button mat-icon{margin-inline-end:var(--ymt-spacing-xs);transition:transform .3s ease}:host details{background-color:var(--_object-metadata-section-background);border:1px solid var(--ymt-outline-variant);border-radius:var(--_object-metadata-section-corner)}:host details:not(:last-child){margin-block-end:var(--ymt-spacing-m)}:host details[open] yuv-icon.arr{transform:rotate(180deg)}\n"] }]
|
|
384
429
|
}] });
|
|
385
430
|
|
|
386
431
|
class ObjectMetadataComponent {
|
|
@@ -391,6 +436,7 @@ class ObjectMetadataComponent {
|
|
|
391
436
|
this.#system = inject(SystemService);
|
|
392
437
|
this.#dmsService = inject(DmsService);
|
|
393
438
|
this.objectForms = viewChildren(ObjectFormComponent);
|
|
439
|
+
this.objectMetadataSectionForms = viewChildren(ObjectMetadataSectionComponent);
|
|
394
440
|
this.#formSubscriptions = [];
|
|
395
441
|
this.#initialData = {};
|
|
396
442
|
this.busySaving = signal(false);
|
|
@@ -405,10 +451,6 @@ class ObjectMetadataComponent {
|
|
|
405
451
|
this.elementExtensions = input([]);
|
|
406
452
|
this.controlsVisible = signal(false);
|
|
407
453
|
this.empty = computed(() => !this.mainFormOptions() && this.flavorFormOptions().length === 0 && this.disableBasicMetadata());
|
|
408
|
-
// form of the dms object itself
|
|
409
|
-
this.mainFormOptions = signal(undefined);
|
|
410
|
-
// forms off allpied flavors
|
|
411
|
-
this.flavorFormOptions = signal([]);
|
|
412
454
|
// state of all individual forms
|
|
413
455
|
this.#formStates = new Map();
|
|
414
456
|
this.baseData = [];
|
|
@@ -422,8 +464,15 @@ class ObjectMetadataComponent {
|
|
|
422
464
|
this.formDisabled = false;
|
|
423
465
|
this.dmsObject = input();
|
|
424
466
|
this.#dmsObjectEffect = effect(() => {
|
|
425
|
-
this
|
|
467
|
+
const object = this.dmsObject();
|
|
468
|
+
if (object) {
|
|
469
|
+
this.#initialData = structuredClone(object.data);
|
|
470
|
+
}
|
|
426
471
|
});
|
|
472
|
+
/**
|
|
473
|
+
* @deprecated This input will be removed in the future.
|
|
474
|
+
* Please migrate to using `dmsObject` and `flavors` inputs instead.
|
|
475
|
+
*/
|
|
427
476
|
this.flavoredDmsObject = input();
|
|
428
477
|
this.#flavoredDmsObjectEffect = effect(() => {
|
|
429
478
|
const flavoredDmsObject = this.flavoredDmsObject();
|
|
@@ -437,6 +486,42 @@ class ObjectMetadataComponent {
|
|
|
437
486
|
* Emits the current state of the metadata form.
|
|
438
487
|
*/
|
|
439
488
|
this.statusChanged = output();
|
|
489
|
+
this.#mainFormOptionsRecource = rxResource({
|
|
490
|
+
request: this.dmsObject,
|
|
491
|
+
loader: ({ request }) => {
|
|
492
|
+
if (!request)
|
|
493
|
+
return of(undefined);
|
|
494
|
+
return this.#system.getObjectTypeForms([request.objectTypeId], this.situation).pipe(map((res) => res[request.objectTypeId]
|
|
495
|
+
? {
|
|
496
|
+
formModel: res[request.objectTypeId],
|
|
497
|
+
data: request.data,
|
|
498
|
+
disabled: this.formDisabled || !request.permissions?.writeIndexData
|
|
499
|
+
}
|
|
500
|
+
: undefined));
|
|
501
|
+
}
|
|
502
|
+
});
|
|
503
|
+
// form of the dms object itself
|
|
504
|
+
this.mainFormOptions = this.#mainFormOptionsRecource.value;
|
|
505
|
+
this.mainFormOptionsIsLoading = this.#mainFormOptionsRecource.isLoading;
|
|
506
|
+
this.flavors = input(undefined);
|
|
507
|
+
// forms off allpied flavors
|
|
508
|
+
this.flavorFormOptions = linkedSignal({
|
|
509
|
+
source: () => ({ object: this.dmsObject(), flavors: this.flavors() }),
|
|
510
|
+
computation: ({ object, flavors }) => {
|
|
511
|
+
const mappedFlavors = (flavors || []).reduce((acc, curr) => ({ ...acc, [curr.sot]: curr }), {});
|
|
512
|
+
if (!object)
|
|
513
|
+
return [];
|
|
514
|
+
return (flavors || [])
|
|
515
|
+
.map((f) => f.sot)
|
|
516
|
+
.map((id) => ({
|
|
517
|
+
id,
|
|
518
|
+
label: this.#system.getLocalizedLabel(id),
|
|
519
|
+
icon: mappedFlavors[id]?.icon,
|
|
520
|
+
svgIcon: mappedFlavors[id]?.svgIcon,
|
|
521
|
+
data: object.data
|
|
522
|
+
}));
|
|
523
|
+
}
|
|
524
|
+
});
|
|
440
525
|
}
|
|
441
526
|
#pendingChanges;
|
|
442
527
|
#notificationService;
|
|
@@ -449,6 +534,11 @@ class ObjectMetadataComponent {
|
|
|
449
534
|
#formStates;
|
|
450
535
|
#dmsObjectEffect;
|
|
451
536
|
#flavoredDmsObjectEffect;
|
|
537
|
+
/**
|
|
538
|
+
* @deprecated once input flavoredDmsObject will be removed in the future.
|
|
539
|
+
* this is not used anymore
|
|
540
|
+
*
|
|
541
|
+
*/
|
|
452
542
|
#init(object, flavors) {
|
|
453
543
|
if (object && (!this._dmsObject || this._dmsObject !== object)) {
|
|
454
544
|
this.#initialData = structuredClone(object.data);
|
|
@@ -456,6 +546,12 @@ class ObjectMetadataComponent {
|
|
|
456
546
|
}
|
|
457
547
|
this._dmsObject = object;
|
|
458
548
|
}
|
|
549
|
+
#mainFormOptionsRecource;
|
|
550
|
+
/**
|
|
551
|
+
* @deprecated once input flavoredDmsObject will be removed in the future.
|
|
552
|
+
* this is not used anymore
|
|
553
|
+
*
|
|
554
|
+
*/
|
|
459
555
|
#objectToForm(object, flavors) {
|
|
460
556
|
if (object) {
|
|
461
557
|
const mappedFlavors = (flavors || []).reduce((acc, curr) => ({ ...acc, [curr.sot]: curr }), {});
|
|
@@ -569,11 +665,12 @@ class ObjectMetadataComponent {
|
|
|
569
665
|
*/
|
|
570
666
|
resetForm() {
|
|
571
667
|
if (this.objectForms()?.length) {
|
|
572
|
-
this.objectForms().forEach((f) =>
|
|
573
|
-
f.resetForm();
|
|
574
|
-
});
|
|
575
|
-
this.#formStates.clear();
|
|
668
|
+
this.objectForms().forEach((f) => f.resetForm());
|
|
576
669
|
}
|
|
670
|
+
if (this.objectMetadataSectionForms()?.length) {
|
|
671
|
+
this.objectMetadataSectionForms().forEach((s) => s.resetForm());
|
|
672
|
+
}
|
|
673
|
+
(this.objectForms()?.length || this.objectMetadataSectionForms()?.length) && this.#formStates.clear();
|
|
577
674
|
}
|
|
578
675
|
#startPending() {
|
|
579
676
|
// because this method will be called every time the form status changes,
|
|
@@ -590,7 +687,7 @@ class ObjectMetadataComponent {
|
|
|
590
687
|
this.#formSubscriptions.forEach((s) => s.unsubscribe());
|
|
591
688
|
}
|
|
592
689
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: ObjectMetadataComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
593
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.14", type: ObjectMetadataComponent, isStandalone: true, selector: "yuv-object-metadata", inputs: { disableControls: { classPropertyName: "disableControls", publicName: "disableControls", isSignal: true, isRequired: false, transformFunction: null }, disableBasicMetadata: { classPropertyName: "disableBasicMetadata", publicName: "disableBasicMetadata", isSignal: true, isRequired: false, transformFunction: null }, elementExtensions: { classPropertyName: "elementExtensions", publicName: "elementExtensions", isSignal: true, isRequired: false, transformFunction: null }, situation: { classPropertyName: "situation", publicName: "situation", isSignal: false, isRequired: false, transformFunction: null }, formDisabled: { classPropertyName: "formDisabled", publicName: "formDisabled", isSignal: false, isRequired: false, transformFunction: null }, dmsObject: { classPropertyName: "dmsObject", publicName: "dmsObject", isSignal: true, isRequired: false, transformFunction: null }, flavoredDmsObject: { classPropertyName: "flavoredDmsObject", publicName: "flavoredDmsObject", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { indexDataSaved: "indexDataSaved", statusChanged: "statusChanged" }, host: { properties: { "class.empty": "empty()", "class.loading": "busyLoading()" } }, viewQueries: [{ propertyName: "objectForms", predicate: ObjectFormComponent, descendants: true, isSignal: true }], ngImport: i0, template: "<main [yuvBusyOverlay]=\"busySaving() || busyLoading()\">\n @if (empty()) {\n <p>{{ 'yuv.object-metadata.empty.message' | translate }}</p>\n }\n @if (!mainFormOptions()) {\n <yuv-object-form
|
|
690
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.14", type: ObjectMetadataComponent, isStandalone: true, selector: "yuv-object-metadata", inputs: { disableControls: { classPropertyName: "disableControls", publicName: "disableControls", isSignal: true, isRequired: false, transformFunction: null }, disableBasicMetadata: { classPropertyName: "disableBasicMetadata", publicName: "disableBasicMetadata", isSignal: true, isRequired: false, transformFunction: null }, elementExtensions: { classPropertyName: "elementExtensions", publicName: "elementExtensions", isSignal: true, isRequired: false, transformFunction: null }, situation: { classPropertyName: "situation", publicName: "situation", isSignal: false, isRequired: false, transformFunction: null }, formDisabled: { classPropertyName: "formDisabled", publicName: "formDisabled", isSignal: false, isRequired: false, transformFunction: null }, dmsObject: { classPropertyName: "dmsObject", publicName: "dmsObject", isSignal: true, isRequired: false, transformFunction: null }, flavoredDmsObject: { classPropertyName: "flavoredDmsObject", publicName: "flavoredDmsObject", isSignal: true, isRequired: false, transformFunction: null }, flavors: { classPropertyName: "flavors", publicName: "flavors", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { indexDataSaved: "indexDataSaved", statusChanged: "statusChanged" }, host: { properties: { "class.empty": "empty()", "class.loading": "busyLoading()" } }, viewQueries: [{ propertyName: "objectForms", predicate: ObjectFormComponent, descendants: true, isSignal: true }, { propertyName: "objectMetadataSectionForms", predicate: ObjectMetadataSectionComponent, descendants: true, isSignal: true }], ngImport: i0, template: "<main [yuvBusyOverlay]=\"busySaving() || busyLoading() || mainFormOptionsIsLoading()\">\n @if (empty()) {\n <p>{{ 'yuv.object-metadata.empty.message' | translate }}</p>\n }\n @if (!mainFormOptions()) {\n <yuv-object-form\n [formOptions]=\"mainFormOptions()\"\n [elementExtensions]=\"elementExtensions()\"\n (statusChanged)=\"onFormStatusChanged('main', $event)\"\n ></yuv-object-form>\n }\n @for (fo of flavorFormOptions(); track $index) {\n <yuv-object-metadata-section\n [section]=\"fo\"\n [elementExtensions]=\"elementExtensions()\"\n [expanded]=\"$index === 0\"\n (statusChanged)=\"onFormStatusChanged(fo.id, $event)\"\n ></yuv-object-metadata-section>\n }\n\n <!-- base data -->\n @if (_dmsObject && !disableBasicMetadata()) {\n <yuv-object-summary-data [dmsObject]=\"_dmsObject\"></yuv-object-summary-data>\n }\n</main>\n\n<footer [attr.inert]=\"disableControls() || !controlsVisible() || null\">\n <div class=\"container\">\n <button\n ymtButton=\"secondary\"\n button-size=\"small\"\n [disabled]=\"busySaving() || busyLoading()\"\n (click)=\"resetForm()\"\n [hidden]=\"!combinedFormState?.dirty\"\n [disabled]=\"!combinedFormState?.dirty\"\n >\n {{ 'yuv.object-metadata.button.reset' | translate }}\n </button>\n <button\n ymtButton=\"primary\"\n button-size=\"small\"\n (click)=\"save()\"\n [disabled]=\"!combinedFormState?.dirty || combinedFormState?.invalid || busySaving() || busyLoading()\"\n >\n {{ 'yuv.object-metadata.button.save' | translate }}\n </button>\n </div>\n</footer>\n", styles: [":host{--_object-metadata-panel-background: var(--object-metadata-panel-background, var(--ymt-surface-container-low));--_object-metadata-section-background: var(--object-metadata-section-background, var(--ymt-surface));--_object-metadata-section-corner: var(--object-metadata-section-corner, var(--ymt-corner-m));--_object-metadata-footer-background: var(--object-metadata-footer-background, var(--ymt-surface-container));--_object-metadata-footer-height: 4rem;display:grid;grid-template-rows:1fr auto;grid-template-columns:1fr;height:100%;overflow:hidden;position:relative;background-color:var(--_object-metadata-panel-background)}:host.empty main{justify-content:center;align-items:center}:host.loading main>*{opacity:0}:host main{grid-row:1/span 3;grid-column:1;overflow-y:auto;width:100%;display:flex;flex-flow:column;padding:var(--ymt-spacing-3xl) var(--ymt-spacing-l) var(--_object-metadata-footer-height) var(--ymt-spacing-l)}:host footer{grid-row:-1;grid-column:1;padding:var(--ymt-spacing-l);opacity:0;z-index:1}:host footer .container{background:var(--_object-metadata-footer-background);padding:var(--ymt-spacing-s);display:flex;align-items:center;justify-content:end;gap:var(--ymt-spacing-s);border-radius:var(--ymt-corner-full)}:host footer:not([inert]){animation:controlsAppear .2s ease-in-out forwards}:host main yuv-object-metadata-section{margin-block-end:var(--ymt-spacing-m)}:host main yuv-object-summary-data{background-color:var(--_object-metadata-section-background);border:1px solid var(--ymt-outline-variant);border-radius:var(--_object-metadata-section-corner);padding:var(--ymt-spacing-m)}@keyframes controlsAppear{0%{opacity:0;translate:0 var(--ymt-spacing-m)}to{opacity:1;translate:0 0}}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "component", type: ObjectFormComponent, selector: "yuv-object-form", inputs: ["formOptions", "inert", "elementExtensions", "isInnerTableForm"], outputs: ["statusChanged", "onFormReady"] }, { kind: "component", type: ObjectSummaryDataComponent, selector: "yuv-object-summary-data", inputs: ["dmsObject", "flavors", "showAppliedFlavors"] }, { kind: "directive", type: BusyOverlayDirective, selector: "[yuvBusyOverlay]", inputs: ["yuvBusyOverlay", "yuvBusyOverlayConfig"] }, { kind: "ngmodule", type: TranslateModule }, { kind: "pipe", type: i1$1.TranslatePipe, name: "translate" }, { kind: "ngmodule", type: MatButtonModule }, { kind: "ngmodule", type: MatIconModule }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "component", type: ObjectMetadataSectionComponent, selector: "yuv-object-metadata-section", inputs: ["section", "expanded", "elementExtensions"], outputs: ["statusChanged"] }, { kind: "directive", type: YmtButtonDirective, selector: "button[ymtButton], a[ymtButton]", inputs: ["ymtButton", "disabled", "aria-disabled", "disableRipple", "disabledInteractive", "button-size"] }] }); }
|
|
594
691
|
}
|
|
595
692
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: ObjectMetadataComponent, decorators: [{
|
|
596
693
|
type: Component,
|
|
@@ -608,7 +705,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImpo
|
|
|
608
705
|
], host: {
|
|
609
706
|
'[class.empty]': 'empty()',
|
|
610
707
|
'[class.loading]': 'busyLoading()'
|
|
611
|
-
}, template: "<main [yuvBusyOverlay]=\"busySaving() || busyLoading()\">\n @if (empty()) {\n <p>{{ 'yuv.object-metadata.empty.message' | translate }}</p>\n }\n @if (!mainFormOptions()) {\n <yuv-object-form
|
|
708
|
+
}, template: "<main [yuvBusyOverlay]=\"busySaving() || busyLoading() || mainFormOptionsIsLoading()\">\n @if (empty()) {\n <p>{{ 'yuv.object-metadata.empty.message' | translate }}</p>\n }\n @if (!mainFormOptions()) {\n <yuv-object-form\n [formOptions]=\"mainFormOptions()\"\n [elementExtensions]=\"elementExtensions()\"\n (statusChanged)=\"onFormStatusChanged('main', $event)\"\n ></yuv-object-form>\n }\n @for (fo of flavorFormOptions(); track $index) {\n <yuv-object-metadata-section\n [section]=\"fo\"\n [elementExtensions]=\"elementExtensions()\"\n [expanded]=\"$index === 0\"\n (statusChanged)=\"onFormStatusChanged(fo.id, $event)\"\n ></yuv-object-metadata-section>\n }\n\n <!-- base data -->\n @if (_dmsObject && !disableBasicMetadata()) {\n <yuv-object-summary-data [dmsObject]=\"_dmsObject\"></yuv-object-summary-data>\n }\n</main>\n\n<footer [attr.inert]=\"disableControls() || !controlsVisible() || null\">\n <div class=\"container\">\n <button\n ymtButton=\"secondary\"\n button-size=\"small\"\n [disabled]=\"busySaving() || busyLoading()\"\n (click)=\"resetForm()\"\n [hidden]=\"!combinedFormState?.dirty\"\n [disabled]=\"!combinedFormState?.dirty\"\n >\n {{ 'yuv.object-metadata.button.reset' | translate }}\n </button>\n <button\n ymtButton=\"primary\"\n button-size=\"small\"\n (click)=\"save()\"\n [disabled]=\"!combinedFormState?.dirty || combinedFormState?.invalid || busySaving() || busyLoading()\"\n >\n {{ 'yuv.object-metadata.button.save' | translate }}\n </button>\n </div>\n</footer>\n", styles: [":host{--_object-metadata-panel-background: var(--object-metadata-panel-background, var(--ymt-surface-container-low));--_object-metadata-section-background: var(--object-metadata-section-background, var(--ymt-surface));--_object-metadata-section-corner: var(--object-metadata-section-corner, var(--ymt-corner-m));--_object-metadata-footer-background: var(--object-metadata-footer-background, var(--ymt-surface-container));--_object-metadata-footer-height: 4rem;display:grid;grid-template-rows:1fr auto;grid-template-columns:1fr;height:100%;overflow:hidden;position:relative;background-color:var(--_object-metadata-panel-background)}:host.empty main{justify-content:center;align-items:center}:host.loading main>*{opacity:0}:host main{grid-row:1/span 3;grid-column:1;overflow-y:auto;width:100%;display:flex;flex-flow:column;padding:var(--ymt-spacing-3xl) var(--ymt-spacing-l) var(--_object-metadata-footer-height) var(--ymt-spacing-l)}:host footer{grid-row:-1;grid-column:1;padding:var(--ymt-spacing-l);opacity:0;z-index:1}:host footer .container{background:var(--_object-metadata-footer-background);padding:var(--ymt-spacing-s);display:flex;align-items:center;justify-content:end;gap:var(--ymt-spacing-s);border-radius:var(--ymt-corner-full)}:host footer:not([inert]){animation:controlsAppear .2s ease-in-out forwards}:host main yuv-object-metadata-section{margin-block-end:var(--ymt-spacing-m)}:host main yuv-object-summary-data{background-color:var(--_object-metadata-section-background);border:1px solid var(--ymt-outline-variant);border-radius:var(--_object-metadata-section-corner);padding:var(--ymt-spacing-m)}@keyframes controlsAppear{0%{opacity:0;translate:0 var(--ymt-spacing-m)}to{opacity:1;translate:0 0}}\n"] }]
|
|
612
709
|
}], propDecorators: { situation: [{
|
|
613
710
|
type: Input
|
|
614
711
|
}], formDisabled: [{
|
|
@@ -628,13 +725,15 @@ class ObjectDetailsComponent {
|
|
|
628
725
|
/**
|
|
629
726
|
* DmsObject to show the details for.
|
|
630
727
|
*/
|
|
631
|
-
this.
|
|
632
|
-
this.
|
|
633
|
-
|
|
634
|
-
|
|
728
|
+
this.dmsObjectInput = input(undefined, { alias: 'dmsObject' });
|
|
729
|
+
this.dmsObjectInputEffect = effect(() => {
|
|
730
|
+
const o = this.dmsObjectInput();
|
|
731
|
+
if (o)
|
|
732
|
+
untracked(() => this.#odShellService.setDmsObject(o));
|
|
635
733
|
});
|
|
734
|
+
this.dmsObject = this.#odShellService.dmsObject;
|
|
636
735
|
this.flavoredDmsObject = computed(() => {
|
|
637
|
-
const o = this.
|
|
736
|
+
const o = this.dmsObject();
|
|
638
737
|
const f = this.flavors();
|
|
639
738
|
return o
|
|
640
739
|
? {
|
|
@@ -674,18 +773,25 @@ class ObjectDetailsComponent {
|
|
|
674
773
|
}
|
|
675
774
|
#userService;
|
|
676
775
|
#odShellService;
|
|
677
|
-
#dmsObjectEffect;
|
|
678
776
|
#objectIdEffect;
|
|
679
777
|
onIndexdataSaved(updatedObject) {
|
|
680
|
-
|
|
681
|
-
this._dmsObject.set(updatedObject);
|
|
778
|
+
this.#odShellService.setDmsObject(updatedObject);
|
|
682
779
|
}
|
|
683
780
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: ObjectDetailsComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
684
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.14", type: ObjectDetailsComponent, isStandalone: true, selector: "yuv-object-details", inputs: {
|
|
781
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.14", type: ObjectDetailsComponent, isStandalone: true, selector: "yuv-object-details", inputs: { dmsObjectInput: { classPropertyName: "dmsObjectInput", publicName: "dmsObject", isSignal: true, isRequired: false, transformFunction: null }, flavors: { classPropertyName: "flavors", publicName: "flavors", isSignal: true, isRequired: false, transformFunction: null }, type: { classPropertyName: "type", publicName: "type", isSignal: true, isRequired: true, transformFunction: null }, objectConfigBucket: { classPropertyName: "objectConfigBucket", publicName: "objectConfigBucket", isSignal: true, isRequired: false, transformFunction: null }, objectId: { classPropertyName: "objectId", publicName: "objectId", isSignal: true, isRequired: false, transformFunction: null }, hideHeader: { classPropertyName: "hideHeader", publicName: "hideHeader", isSignal: true, isRequired: false, transformFunction: null } }, providers: [ObjectDetailsShellService], ngImport: i0, template: "<yuv-object-details-shell [type]=\"type()\" [hideHeader]=\"hideHeader()\" [bucket]=\"objectConfigBucket()\">\n @let dmsObj = dmsObject();\n <mat-tab-group yuvTabGuardDisable>\n <!-- content -->\n @if (dmsObj && dmsObj.content) {\n <mat-tab [label]=\"'yuv.object-details.tabs.content.title' | translate\">\n <ng-template matTabContent>\n <yuv-object-preview [dmsObject]=\"dmsObj\"></yuv-object-preview>\n </ng-template>\n </mat-tab>\n }\n\n <!-- indexdata -->\n <mat-tab [label]=\"'yuv.object-metadata.tabs.indexdata.title' | translate\">\n <ng-template matTabContent>\n <yuv-object-metadata [dmsObject]=\"dmsObject()\" [flavors]=\"flavors()\" (indexDataSaved)=\"onIndexdataSaved($event)\"> </yuv-object-metadata>\n </ng-template>\n </mat-tab>\n <!-- history -->\n <mat-tab [label]=\"'yuv.object-metadata.tabs.history.title' | translate\">\n <ng-template matTabContent> <yuv-object-audit [dmsObject]=\"dmsObj\"></yuv-object-audit> </ng-template\n ></mat-tab>\n </mat-tab-group>\n</yuv-object-details-shell>\n", styles: [":host{display:block;overflow:hidden}:host yuv-object-details-shell{height:100%}:host mat-tab-group{overflow:hidden;height:100%}:host mat-tab-group ::ng-deep .mat-mdc-tab-body-wrapper{height:100%}:host yuv-object-preview{background-color:var(--ymt-surface-container-low)}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "ngmodule", type: TranslateModule }, { kind: "pipe", type: i1$1.TranslatePipe, name: "translate" }, { kind: "ngmodule", type: MatTabsModule }, { kind: "directive", type: i2$2.MatTabContent, selector: "[matTabContent]" }, { kind: "component", type: i2$2.MatTab, selector: "mat-tab", inputs: ["disabled", "label", "aria-label", "aria-labelledby", "labelClass", "bodyClass", "id"], exportAs: ["matTab"] }, { kind: "component", type: i2$2.MatTabGroup, selector: "mat-tab-group", inputs: ["color", "fitInkBarToContent", "mat-stretch-tabs", "mat-align-tabs", "dynamicHeight", "selectedIndex", "headerPosition", "animationDuration", "contentTabIndex", "disablePagination", "disableRipple", "preserveContent", "backgroundColor", "aria-label", "aria-labelledby"], outputs: ["selectedIndexChange", "focusChange", "animationDone", "selectedTabChange"], exportAs: ["matTabGroup"] }, { kind: "directive", type: TabGuardDirective, selector: "mat-tab-group[yuvTabGuardDisable]" }, { kind: "component", type: ObjectDetailsShellComponent, selector: "yuv-object-details-shell", inputs: ["type", "bucket", "hideHeader"] }, { kind: "component", type: ObjectPreviewComponent, selector: "yuv-object-preview", inputs: ["objectId", "dmsObject", "version", "metadata"] }, { kind: "component", type: ObjectMetadataComponent, selector: "yuv-object-metadata", inputs: ["disableControls", "disableBasicMetadata", "elementExtensions", "situation", "formDisabled", "dmsObject", "flavoredDmsObject", "flavors"], outputs: ["indexDataSaved", "statusChanged"] }, { kind: "component", type: ObjectAuditComponent, selector: "yuv-object-audit", inputs: ["dmsObject", "skipActions", "allActions"] }] }); }
|
|
685
782
|
}
|
|
686
783
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: ObjectDetailsComponent, decorators: [{
|
|
687
784
|
type: Component,
|
|
688
|
-
args: [{ selector: 'yuv-object-details', standalone: true, imports: [
|
|
785
|
+
args: [{ selector: 'yuv-object-details', standalone: true, imports: [
|
|
786
|
+
CommonModule,
|
|
787
|
+
TranslateModule,
|
|
788
|
+
MatTabsModule,
|
|
789
|
+
TabGuardDirective,
|
|
790
|
+
ObjectDetailsShellComponent,
|
|
791
|
+
ObjectPreviewComponent,
|
|
792
|
+
ObjectMetadataComponent,
|
|
793
|
+
ObjectAuditComponent
|
|
794
|
+
], providers: [ObjectDetailsShellService], template: "<yuv-object-details-shell [type]=\"type()\" [hideHeader]=\"hideHeader()\" [bucket]=\"objectConfigBucket()\">\n @let dmsObj = dmsObject();\n <mat-tab-group yuvTabGuardDisable>\n <!-- content -->\n @if (dmsObj && dmsObj.content) {\n <mat-tab [label]=\"'yuv.object-details.tabs.content.title' | translate\">\n <ng-template matTabContent>\n <yuv-object-preview [dmsObject]=\"dmsObj\"></yuv-object-preview>\n </ng-template>\n </mat-tab>\n }\n\n <!-- indexdata -->\n <mat-tab [label]=\"'yuv.object-metadata.tabs.indexdata.title' | translate\">\n <ng-template matTabContent>\n <yuv-object-metadata [dmsObject]=\"dmsObject()\" [flavors]=\"flavors()\" (indexDataSaved)=\"onIndexdataSaved($event)\"> </yuv-object-metadata>\n </ng-template>\n </mat-tab>\n <!-- history -->\n <mat-tab [label]=\"'yuv.object-metadata.tabs.history.title' | translate\">\n <ng-template matTabContent> <yuv-object-audit [dmsObject]=\"dmsObj\"></yuv-object-audit> </ng-template\n ></mat-tab>\n </mat-tab-group>\n</yuv-object-details-shell>\n", styles: [":host{display:block;overflow:hidden}:host yuv-object-details-shell{height:100%}:host mat-tab-group{overflow:hidden;height:100%}:host mat-tab-group ::ng-deep .mat-mdc-tab-body-wrapper{height:100%}:host yuv-object-preview{background-color:var(--ymt-surface-container-low)}\n"] }]
|
|
689
795
|
}] });
|
|
690
796
|
|
|
691
797
|
const cmp = [
|