@myrmidon/cadmus-profile-editor 20.0.0 → 20.0.1
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.
|
@@ -131,7 +131,7 @@ var FacetDefinitionValidatorService = class FacetDefinitionValidatorService {
|
|
|
131
131
|
}
|
|
132
132
|
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
133
133
|
minVersion: "12.0.0",
|
|
134
|
-
version: "22.
|
|
134
|
+
version: "22.3.0",
|
|
135
135
|
ngImport: i0,
|
|
136
136
|
type: FacetDefinitionValidatorService,
|
|
137
137
|
deps: [{ token: i1$1.ThesaurusService }],
|
|
@@ -139,7 +139,7 @@ var FacetDefinitionValidatorService = class FacetDefinitionValidatorService {
|
|
|
139
139
|
});
|
|
140
140
|
static ɵprov = i0.ɵɵngDeclareInjectable({
|
|
141
141
|
minVersion: "12.0.0",
|
|
142
|
-
version: "22.
|
|
142
|
+
version: "22.3.0",
|
|
143
143
|
ngImport: i0,
|
|
144
144
|
type: FacetDefinitionValidatorService,
|
|
145
145
|
providedIn: "root"
|
|
@@ -147,7 +147,7 @@ var FacetDefinitionValidatorService = class FacetDefinitionValidatorService {
|
|
|
147
147
|
};
|
|
148
148
|
i0.ɵɵngDeclareClassMetadata({
|
|
149
149
|
minVersion: "12.0.0",
|
|
150
|
-
version: "22.
|
|
150
|
+
version: "22.3.0",
|
|
151
151
|
ngImport: i0,
|
|
152
152
|
type: FacetDefinitionValidatorService,
|
|
153
153
|
decorators: [{
|
|
@@ -234,7 +234,7 @@ var PartDefinitionEditorComponent = class PartDefinitionEditorComponent {
|
|
|
234
234
|
}
|
|
235
235
|
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
236
236
|
minVersion: "12.0.0",
|
|
237
|
-
version: "22.
|
|
237
|
+
version: "22.3.0",
|
|
238
238
|
ngImport: i0,
|
|
239
239
|
type: PartDefinitionEditorComponent,
|
|
240
240
|
deps: [],
|
|
@@ -242,7 +242,7 @@ var PartDefinitionEditorComponent = class PartDefinitionEditorComponent {
|
|
|
242
242
|
});
|
|
243
243
|
static ɵcmp = i0.ɵɵngDeclareComponent({
|
|
244
244
|
minVersion: "17.0.0",
|
|
245
|
-
version: "22.
|
|
245
|
+
version: "22.3.0",
|
|
246
246
|
type: PartDefinitionEditorComponent,
|
|
247
247
|
isStandalone: true,
|
|
248
248
|
selector: "cadmus-part-definition-editor",
|
|
@@ -449,7 +449,7 @@ var PartDefinitionEditorComponent = class PartDefinitionEditorComponent {
|
|
|
449
449
|
};
|
|
450
450
|
i0.ɵɵngDeclareClassMetadata({
|
|
451
451
|
minVersion: "12.0.0",
|
|
452
|
-
version: "22.
|
|
452
|
+
version: "22.3.0",
|
|
453
453
|
ngImport: i0,
|
|
454
454
|
type: PartDefinitionEditorComponent,
|
|
455
455
|
decorators: [{
|
|
@@ -643,7 +643,7 @@ var FacetDefinitionEditorComponent = class FacetDefinitionEditorComponent {
|
|
|
643
643
|
}
|
|
644
644
|
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
645
645
|
minVersion: "12.0.0",
|
|
646
|
-
version: "22.
|
|
646
|
+
version: "22.3.0",
|
|
647
647
|
ngImport: i0,
|
|
648
648
|
type: FacetDefinitionEditorComponent,
|
|
649
649
|
deps: [{ token: i1.DialogService }],
|
|
@@ -651,7 +651,7 @@ var FacetDefinitionEditorComponent = class FacetDefinitionEditorComponent {
|
|
|
651
651
|
});
|
|
652
652
|
static ɵcmp = i0.ɵɵngDeclareComponent({
|
|
653
653
|
minVersion: "17.0.0",
|
|
654
|
-
version: "22.
|
|
654
|
+
version: "22.3.0",
|
|
655
655
|
type: FacetDefinitionEditorComponent,
|
|
656
656
|
isStandalone: true,
|
|
657
657
|
selector: "cadmus-facet-definition-editor",
|
|
@@ -903,7 +903,7 @@ var FacetDefinitionEditorComponent = class FacetDefinitionEditorComponent {
|
|
|
903
903
|
};
|
|
904
904
|
i0.ɵɵngDeclareClassMetadata({
|
|
905
905
|
minVersion: "12.0.0",
|
|
906
|
-
version: "22.
|
|
906
|
+
version: "22.3.0",
|
|
907
907
|
ngImport: i0,
|
|
908
908
|
type: FacetDefinitionEditorComponent,
|
|
909
909
|
decorators: [{
|
|
@@ -1135,7 +1135,7 @@ var FacetDefinitionListEditorComponent = class FacetDefinitionListEditorComponen
|
|
|
1135
1135
|
}
|
|
1136
1136
|
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
1137
1137
|
minVersion: "12.0.0",
|
|
1138
|
-
version: "22.
|
|
1138
|
+
version: "22.3.0",
|
|
1139
1139
|
ngImport: i0,
|
|
1140
1140
|
type: FacetDefinitionListEditorComponent,
|
|
1141
1141
|
deps: [
|
|
@@ -1148,7 +1148,7 @@ var FacetDefinitionListEditorComponent = class FacetDefinitionListEditorComponen
|
|
|
1148
1148
|
});
|
|
1149
1149
|
static ɵcmp = i0.ɵɵngDeclareComponent({
|
|
1150
1150
|
minVersion: "17.0.0",
|
|
1151
|
-
version: "22.
|
|
1151
|
+
version: "22.3.0",
|
|
1152
1152
|
type: FacetDefinitionListEditorComponent,
|
|
1153
1153
|
isStandalone: true,
|
|
1154
1154
|
selector: "cadmus-facet-definition-list-editor",
|
|
@@ -1270,7 +1270,7 @@ var FacetDefinitionListEditorComponent = class FacetDefinitionListEditorComponen
|
|
|
1270
1270
|
};
|
|
1271
1271
|
i0.ɵɵngDeclareClassMetadata({
|
|
1272
1272
|
minVersion: "12.0.0",
|
|
1273
|
-
version: "22.
|
|
1273
|
+
version: "22.3.0",
|
|
1274
1274
|
ngImport: i0,
|
|
1275
1275
|
type: FacetDefinitionListEditorComponent,
|
|
1276
1276
|
decorators: [{
|
|
@@ -1322,7 +1322,7 @@ var FacetEditPageComponent = class FacetEditPageComponent {
|
|
|
1322
1322
|
}
|
|
1323
1323
|
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
1324
1324
|
minVersion: "12.0.0",
|
|
1325
|
-
version: "22.
|
|
1325
|
+
version: "22.3.0",
|
|
1326
1326
|
ngImport: i0,
|
|
1327
1327
|
type: FacetEditPageComponent,
|
|
1328
1328
|
deps: [],
|
|
@@ -1330,7 +1330,7 @@ var FacetEditPageComponent = class FacetEditPageComponent {
|
|
|
1330
1330
|
});
|
|
1331
1331
|
static ɵcmp = i0.ɵɵngDeclareComponent({
|
|
1332
1332
|
minVersion: "14.0.0",
|
|
1333
|
-
version: "22.
|
|
1333
|
+
version: "22.3.0",
|
|
1334
1334
|
type: FacetEditPageComponent,
|
|
1335
1335
|
isStandalone: true,
|
|
1336
1336
|
selector: "cadmus-facet-edit-page",
|
|
@@ -1385,7 +1385,7 @@ var FacetEditPageComponent = class FacetEditPageComponent {
|
|
|
1385
1385
|
};
|
|
1386
1386
|
i0.ɵɵngDeclareClassMetadata({
|
|
1387
1387
|
minVersion: "12.0.0",
|
|
1388
|
-
version: "22.
|
|
1388
|
+
version: "22.3.0",
|
|
1389
1389
|
ngImport: i0,
|
|
1390
1390
|
type: FacetEditPageComponent,
|
|
1391
1391
|
decorators: [{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"myrmidon-cadmus-profile-editor.mjs","names":[],"sources":["../../../../projects/myrmidon/cadmus-profile-editor/src/lib/services/facet-definition-validator.service.ts","../../../../projects/myrmidon/cadmus-profile-editor/src/lib/components/part-definition-editor/part-definition-editor.component.ts","../../../../projects/myrmidon/cadmus-profile-editor/src/lib/components/part-definition-editor/part-definition-editor.component.html","../../../../projects/myrmidon/cadmus-profile-editor/src/lib/components/facet-definition-editor/facet-definition-editor.component.ts","../../../../projects/myrmidon/cadmus-profile-editor/src/lib/components/facet-definition-editor/facet-definition-editor.component.html","../../../../projects/myrmidon/cadmus-profile-editor/src/lib/components/facet-definition-list-editor/facet-definition-list-editor.component.ts","../../../../projects/myrmidon/cadmus-profile-editor/src/lib/components/facet-definition-list-editor/facet-definition-list-editor.component.html","../../../../projects/myrmidon/cadmus-profile-editor/src/lib/components/facet-edit-page/facet-edit-page.component.ts","../../../../projects/myrmidon/cadmus-profile-editor/src/lib/components/facet-edit-page/facet-edit-page.component.html","../../../../projects/myrmidon/cadmus-profile-editor/src/lib/cadmus-profile-edit.routes.ts"],"sourcesContent":["import { Injectable } from '@angular/core';\nimport { Observable, of } from 'rxjs';\nimport { map } from 'rxjs/operators';\n\nimport { FacetDefinition } from '@myrmidon/cadmus-core';\nimport { FacetModelSettings, ThesaurusService } from '@myrmidon/cadmus-api';\n\n/** A single validation issue produced by {@link FacetDefinitionValidatorService}. */\nexport interface FacetValidationIssue {\n severity: 'error' | 'warning' | 'info';\n /** Human-readable description of the issue. */\n message: string;\n}\n\n/** The result returned by {@link FacetDefinitionValidatorService.validate}. */\nexport interface FacetValidationResult {\n issues: FacetValidationIssue[];\n hasErrors: boolean;\n hasWarnings: boolean;\n hasInfos: boolean;\n}\n\n/**\n * Validates a list of {@link FacetDefinition} objects before they are persisted.\n *\n * Rules:\n * - duplicate facet ID → error\n * - facet ID still set to \"new\" → warning (unfilled placeholder)\n * - duplicate facet label → error\n * - duplicate facet color → info\n * - duplicate facet description → info\n * - facet with no part definitions → error\n * - within a facet: two parts with same typeId AND same roleId\n * (including both empty/null) → error\n * (one with a roleId and one without is valid: they serve different roles)\n * - within a facet: duplicate part color → info\n * - within a facet: duplicate part description → info\n * - (when facetModelSettings is provided) for each part/fragment entry in the\n * settings, each thesaurus ID listed in thesauriIds is checked against the\n * existing thesauri: missing required thesauri (prefixed with \"*\") → error;\n * missing optional thesauri → info.\n */\n@Injectable({ providedIn: 'root' })\nexport class FacetDefinitionValidatorService {\n constructor(private _thesaurusService: ThesaurusService) {}\n\n private buildResult(issues: FacetValidationIssue[]): FacetValidationResult {\n return {\n issues,\n hasErrors: issues.some((i) => i.severity === 'error'),\n hasWarnings: issues.some((i) => i.severity === 'warning'),\n hasInfos: issues.some((i) => i.severity === 'info'),\n };\n }\n\n private checkThesauri(\n issues: FacetValidationIssue[],\n existingIds: Set<string>,\n entries: { [key: string]: { thesauriIds?: string[] } },\n kind: 'Part' | 'Fragment',\n ): void {\n for (const [typeId, entry] of Object.entries(entries)) {\n for (const rawId of entry.thesauriIds ?? []) {\n const required = rawId.startsWith('*');\n const bareId = required ? rawId.substring(1) : rawId;\n if (!existingIds.has(bareId)) {\n if (required) {\n issues.push({\n severity: 'error',\n message: `${kind} \"${typeId}\" requires thesaurus \"${bareId}\" which does not exist.`,\n });\n } else {\n issues.push({\n severity: 'info',\n message: `${kind} \"${typeId}\" uses optional thesaurus \"${bareId}\" which does not exist.`,\n });\n }\n }\n }\n }\n }\n\n /**\n * Validate the given list of facet definitions and return a result\n * containing all issues found.\n * @param facets The list of facet definitions to validate.\n * @param facetModelSettings Optional settings; when provided the thesauri\n * referenced by each part/fragment are checked against the server.\n */\n public validate(\n facets: FacetDefinition[],\n facetModelSettings?: FacetModelSettings,\n ): Observable<FacetValidationResult> {\n const issues: FacetValidationIssue[] = [];\n\n const seenIds = new Set<string>();\n const seenLabels = new Set<string>();\n const seenColors = new Set<string>();\n const seenDescriptions = new Set<string>();\n\n for (const facet of facets) {\n const label = `facet \"${facet.id}\"`;\n\n // duplicate / placeholder ID\n if (!facet.id) {\n issues.push({ severity: 'error', message: 'A facet has an empty ID.' });\n } else if (facet.id === 'new') {\n issues.push({\n severity: 'warning',\n message: `Facet has placeholder ID \"new\" — please assign a real ID.`,\n });\n } else if (seenIds.has(facet.id)) {\n issues.push({\n severity: 'error',\n message: `Duplicate facet ID: \"${facet.id}\".`,\n });\n } else {\n seenIds.add(facet.id);\n }\n\n // duplicate label\n if (facet.label) {\n if (seenLabels.has(facet.label)) {\n issues.push({\n severity: 'error',\n message: `Duplicate facet label \"${facet.label}\" in ${label}.`,\n });\n } else {\n seenLabels.add(facet.label);\n }\n }\n\n // duplicate color (info)\n if (facet.colorKey) {\n if (seenColors.has(facet.colorKey)) {\n issues.push({\n severity: 'info',\n message: `Duplicate facet color \"${facet.colorKey}\" in ${label}.`,\n });\n } else {\n seenColors.add(facet.colorKey);\n }\n }\n\n // duplicate description (info)\n if (facet.description) {\n if (seenDescriptions.has(facet.description)) {\n issues.push({\n severity: 'info',\n message: `Duplicate facet description \"${facet.description}\" in ${label}.`,\n });\n } else {\n seenDescriptions.add(facet.description);\n }\n }\n\n // no part definitions\n if (!facet.partDefinitions.length) {\n issues.push({\n severity: 'error',\n message: `${label} has no part definitions.`,\n });\n }\n\n // within-facet checks\n const seenPartKeys = new Set<string>();\n const seenPartColors = new Set<string>();\n const seenPartDescriptions = new Set<string>();\n\n for (const part of facet.partDefinitions) {\n // duplicate typeId + roleId combination\n // key uses empty string for absent roleId so that\n // (typeId, undefined) vs (typeId, \"r1\") are treated as different\n const key = `${part.typeId}|${part.roleId ?? ''}`;\n if (seenPartKeys.has(key)) {\n issues.push({\n severity: 'error',\n message:\n `Duplicate part (typeId \"${part.typeId}\", ` +\n `roleId \"${part.roleId ?? '(none)'}\") in ${label}.`,\n });\n } else {\n seenPartKeys.add(key);\n }\n\n // duplicate part color (info)\n if (part.colorKey) {\n if (seenPartColors.has(part.colorKey)) {\n issues.push({\n severity: 'info',\n message: `Duplicate part color \"${part.colorKey}\" in ${label}.`,\n });\n } else {\n seenPartColors.add(part.colorKey);\n }\n }\n\n // duplicate part description (info)\n if (part.description) {\n if (seenPartDescriptions.has(part.description)) {\n issues.push({\n severity: 'info',\n message: `Duplicate part description \"${part.description}\" for type \"${part.typeId}\" in ${label}.`,\n });\n } else {\n seenPartDescriptions.add(part.description);\n }\n }\n }\n }\n\n // thesaurus coverage check (only when model settings are available)\n if (!facetModelSettings) {\n return of(this.buildResult(issues));\n }\n\n return this._thesaurusService.getThesaurusIds().pipe(\n map((ids) => {\n // remove final @language from IDs for comparison, as facet model settings\n // do not include the language suffix\n const existingIds = new Set(ids.map((id) => id.replace(/\\@[a-z]+$/g, '')));\n this.checkThesauri(\n issues,\n existingIds,\n facetModelSettings.parts,\n 'Part',\n );\n if (facetModelSettings.fragments) {\n this.checkThesauri(\n issues,\n existingIds,\n facetModelSettings.fragments,\n 'Fragment',\n );\n }\n return this.buildResult(issues);\n }),\n );\n }\n}\n","import {\r\n ChangeDetectionStrategy,\r\n Component,\r\n computed,\r\n effect,\r\n input,\r\n linkedSignal,\r\n model,\r\n output,\r\n untracked,\r\n} from '@angular/core';\r\nimport {\r\n FormField,\r\n form,\r\n maxLength,\r\n pattern,\r\n required,\r\n} from '@angular/forms/signals';\r\n\r\n// material\r\nimport { MatIconButton } from '@angular/material/button';\r\nimport { MatTooltip } from '@angular/material/tooltip';\r\nimport {\r\n MatError,\r\n MatFormField,\r\n MatInput,\r\n MatLabel,\r\n} from '@angular/material/input';\r\nimport { MatIcon } from '@angular/material/icon';\r\n\r\nimport { PartDefinition } from '@myrmidon/cadmus-core';\r\nimport { FacetModelSettings } from '@myrmidon/cadmus-api';\r\nimport { MatSuffix } from '@angular/material/form-field';\r\nimport { MatOption, MatSelect } from '@angular/material/select';\r\nimport { MatCheckbox } from '@angular/material/checkbox';\r\n\r\n/**\r\n * The editable shape behind the form. Text fields use '' as their empty\r\n * value, as they are bound to native inputs.\r\n */\r\ninterface PartDefinitionControls {\r\n typeId: string;\r\n roleId: string;\r\n name: string;\r\n required: boolean;\r\n description: string;\r\n colorKey: string;\r\n groupKey: string;\r\n sortKey: string;\r\n}\r\n\r\nfunction toDraft(data: PartDefinition | undefined): PartDefinitionControls {\r\n return {\r\n typeId: data?.typeId || '',\r\n roleId: data?.roleId || '',\r\n name: data?.name || '',\r\n required: data?.isRequired || false,\r\n description: data?.description || '',\r\n colorKey: data?.colorKey || '',\r\n groupKey: data?.groupKey || '',\r\n sortKey: data?.sortKey || '',\r\n };\r\n}\r\n\r\n/**\r\n * Draft -> definition. Normalizes values (trimming, '' to undefined), so\r\n * the definition saved from a draft may differ from the draft itself.\r\n */\r\nfunction toData(v: PartDefinitionControls): PartDefinition {\r\n return {\r\n typeId: v.typeId.trim(),\r\n roleId: v.roleId.trim() || undefined,\r\n name: v.name.trim(),\r\n isRequired: v.required,\r\n description: v.description.trim() || undefined,\r\n colorKey: v.colorKey.trim() || undefined,\r\n groupKey: v.groupKey.trim() || undefined,\r\n sortKey: v.sortKey.trim() || undefined,\r\n };\r\n}\r\n\r\n/**\r\n * Editor for a single part definition. This allows users to edit the part definition\r\n * properties: type ID, selected from a list if facet model settings are provided,\r\n * or entered freely if not (but this should not happen, as at least part definitions\r\n * should be present and these provide fallback model settings); role ID, selected\r\n * from a closed list when the part type is a base text part, or entered freely otherwise;\r\n * name; color; group; sort key; description; and whether the part is required or not\r\n * in its facet.\r\n * NOTE: part definition settings are not edited here. They are defined server-side\r\n * and will later be obsoleted.\r\n */\r\n@Component({\r\n selector: 'cadmus-part-definition-editor',\r\n imports: [\r\n FormField,\r\n MatCheckbox,\r\n MatError,\r\n MatFormField,\r\n MatIcon,\r\n MatIconButton,\r\n MatInput,\r\n MatLabel,\r\n MatOption,\r\n MatSelect,\r\n MatSuffix,\r\n MatTooltip,\r\n ],\r\n templateUrl: './part-definition-editor.component.html',\r\n styleUrl: './part-definition-editor.component.css',\r\n changeDetection: ChangeDetectionStrategy.OnPush,\r\n})\r\nexport class PartDefinitionEditorComponent {\r\n /**\r\n * The part to edit.\r\n */\r\n public readonly definition = model<PartDefinition | undefined>();\r\n\r\n /**\r\n * The facet models settings, used to get the list of available part type IDs,\r\n * and whether they are base text parts; in this case, the same settings also\r\n * provide the list of their available role IDs from the fragments property.\r\n */\r\n public readonly facetModelSettings = input<FacetModelSettings | undefined>(\r\n undefined,\r\n );\r\n\r\n /**\r\n * The list of available part type IDs, taken from the facet model settings.\r\n * If the facet model settings are not provided, or do not contain any part\r\n * definition, this list is empty and the type ID must be entered freely.\r\n */\r\n public readonly availablePartTypeIds = computed(() => {\r\n const settings = this.facetModelSettings();\r\n return settings?.parts ? Object.keys(settings.parts) : [];\r\n });\r\n\r\n /**\r\n * The list of available fragment IDs, taken from the facet model settings.\r\n * This is used to populate the role ID select when the part type is a base\r\n * text part (i.e. its baseText property in settings is true).\r\n */\r\n public readonly availableFragmentIds = computed(() => {\r\n const settings = this.facetModelSettings();\r\n return settings?.fragments ? Object.keys(settings.fragments) : [];\r\n });\r\n\r\n\r\n /**\r\n * True to hide the sort key field. This is used when the sort key is\r\n * defined at the level of the part definitions list, and not at the level\r\n * of each part definition.\r\n */\r\n public readonly hideSortKey = input<boolean>(false);\r\n\r\n /**\r\n * Emitted when user requests to cancel the edit and close this editor.\r\n */\r\n public readonly cancelEdit = output();\r\n\r\n /**\r\n * The editable draft, derived from definition. On the echo of our own\r\n * save the live draft is kept, as toData() normalizes its values.\r\n */\r\n private readonly _draft = linkedSignal<\r\n PartDefinition | undefined,\r\n PartDefinitionControls\r\n >({\r\n source: () => this.definition(),\r\n computation: (data, previous) =>\r\n previous &&\r\n JSON.stringify(data) === JSON.stringify(toData(previous.value))\r\n ? previous.value\r\n : toDraft(data),\r\n });\r\n\r\n public readonly form = form(this._draft, (path) => {\r\n required(path.typeId);\r\n maxLength(path.typeId, 100);\r\n required(path.name);\r\n maxLength(path.name, 100);\r\n maxLength(path.description, 1000);\r\n // color key has form RRGGBB, where RR, GG and BB are hex values\r\n // for red, green and blue\r\n pattern(path.colorKey, /^[0-9a-fA-F]{6}$/);\r\n });\r\n\r\n /**\r\n * True if the part type is a base text part, i.e. if the facet model settings\r\n * for the current part type ID has the baseText property set to true. In this\r\n * case, the role ID select is shown with the list of available fragment IDs\r\n * from the facet model settings; otherwise, a free text input is shown for\r\n * the role ID.\r\n */\r\n public readonly isBaseTextPart = computed<boolean>(() => {\r\n const settings = this.facetModelSettings();\r\n return settings?.parts?.[this.form.typeId().value()]?.baseText === true;\r\n });\r\n\r\n constructor() {\r\n // once the draft mirrors the bound definition again, clear interaction\r\n // state\r\n effect(() => {\r\n const draft = this._draft();\r\n untracked(() => {\r\n if (\r\n JSON.stringify(draft) === JSON.stringify(toDraft(this.definition()))\r\n ) {\r\n this.form().reset();\r\n }\r\n });\r\n });\r\n }\r\n\r\n public onColorPick(value: string): void {\r\n // native color input returns \"#rrggbb\" — strip the leading \"#\"\r\n this.form.colorKey().value.set(value.slice(1));\r\n this.form.colorKey().markAsDirty();\r\n }\r\n\r\n public cancel(): void {\r\n this.cancelEdit.emit();\r\n }\r\n\r\n /**\r\n * Saves the current form data by updating the `data` model signal.\r\n * This method can be called manually (e.g., by a Save button) or\r\n * automatically (via auto-save).\r\n * @param pristine If true (default), the form is marked as pristine\r\n * after saving.\r\n * Set to false for auto-save if you want the form to remain dirty.\r\n */\r\n public save(pristine = true): void {\r\n if (this.form().invalid()) {\r\n // show validation errors\r\n this.form().markAsTouched();\r\n return;\r\n }\r\n\r\n this.definition.set(toData(this._draft()));\r\n\r\n if (pristine) {\r\n this.form().reset();\r\n }\r\n }\r\n}\r\n","<div>\r\n <div class=\"form-row\">\r\n <!-- typeId (bound) -->\r\n @if (availablePartTypeIds().length) {\r\n <mat-form-field>\r\n <mat-label>type</mat-label>\r\n <mat-select [formField]=\"form.typeId\">\r\n @for (id of availablePartTypeIds(); track id) {\r\n <mat-option [value]=\"id\">{{ id }}</mat-option>\r\n }\r\n </mat-select>\r\n @if (\r\n form.typeId().getError('required') && (form.typeId().dirty() || form.typeId().touched())\r\n ) {\r\n <mat-error>type ID required</mat-error>\r\n }\r\n </mat-form-field>\r\n } @else {\r\n <!-- typeId (free) -->\r\n <mat-form-field>\r\n <mat-label>type ID</mat-label>\r\n <input matInput [formField]=\"form.typeId\" />\r\n @if (\r\n form.typeId().getError('required') && (form.typeId().dirty() || form.typeId().touched())\r\n ) {\r\n <mat-error>type ID required</mat-error>\r\n }\r\n @if (\r\n form.typeId().getError('maxLength') && (form.typeId().dirty() || form.typeId().touched())\r\n ) {\r\n <mat-error>type ID too long</mat-error>\r\n }\r\n </mat-form-field>\r\n }\r\n\r\n <!-- roleId is to be selected from a list if the part is a base text part -->\r\n @if (isBaseTextPart()) {\r\n <mat-form-field>\r\n <mat-label>role ID</mat-label>\r\n <mat-select [formField]=\"form.roleId\">\r\n @for (e of availableFragmentIds(); track e) {\r\n <mat-option [value]=\"e\">{{ e }}</mat-option>\r\n }\r\n </mat-select>\r\n @if (\r\n form.roleId().getError('required') && (form.roleId().dirty() || form.roleId().touched())\r\n ) {\r\n <mat-error>role ID required</mat-error>\r\n }\r\n </mat-form-field>\r\n } @else {\r\n <!-- else roleId is free -->\r\n <mat-form-field>\r\n <mat-label>role ID</mat-label>\r\n <input matInput [formField]=\"form.roleId\" />\r\n @if (\r\n form.roleId().getError('required') && (form.roleId().dirty() || form.roleId().touched())\r\n ) {\r\n <mat-error>role ID required</mat-error>\r\n }\r\n @if (\r\n form.roleId().getError('maxLength') && (form.roleId().dirty() || form.roleId().touched())\r\n ) {\r\n <mat-error>role ID too long</mat-error>\r\n }\r\n </mat-form-field>\r\n }\r\n\r\n <!-- required -->\r\n <mat-checkbox [formField]=\"form.required\">required</mat-checkbox>\r\n </div>\r\n\r\n <div class=\"form-row\">\r\n <!-- name -->\r\n <mat-form-field>\r\n <mat-label>name</mat-label>\r\n <input matInput [formField]=\"form.name\" />\r\n @if (form.name().getError('required') && (form.name().dirty() || form.name().touched())) {\r\n <mat-error>name required</mat-error>\r\n }\r\n @if (form.name().getError('maxLength') && (form.name().dirty() || form.name().touched())) {\r\n <mat-error>name too long</mat-error>\r\n }\r\n </mat-form-field>\r\n\r\n <!-- color -->\r\n <mat-form-field class=\"color-input\">\r\n <mat-label>color</mat-label>\r\n <input matInput [formField]=\"form.colorKey\" />\r\n @if (\r\n form.colorKey().getError('pattern') && (form.colorKey().dirty() || form.colorKey().touched())\r\n ) {\r\n <mat-error>invalid color key</mat-error>\r\n }\r\n <input\r\n type=\"color\"\r\n class=\"color-picker-input\"\r\n #colorPicker\r\n [value]=\"\r\n form.colorKey().value().length === 6\r\n ? '#' + form.colorKey().value()\r\n : '#000000'\r\n \"\r\n (input)=\"onColorPick(colorPicker.value)\"\r\n />\r\n <button\r\n type=\"button\"\r\n mat-icon-button\r\n matSuffix\r\n matTooltip=\"Pick color\"\r\n (click)=\"colorPicker.click()\"\r\n >\r\n <mat-icon>palette</mat-icon>\r\n </button>\r\n </mat-form-field>\r\n <div class=\"color-sample\" [style.--swatch-color]=\"'#' + form.colorKey().value()\"></div>\r\n\r\n <!-- group -->\r\n <mat-form-field>\r\n <mat-label>group</mat-label>\r\n <input matInput [formField]=\"form.groupKey\" />\r\n @if (\r\n form.groupKey().getError('maxLength') && (form.groupKey().dirty() || form.groupKey().touched())\r\n ) {\r\n <mat-error>group key too long</mat-error>\r\n }\r\n </mat-form-field>\r\n\r\n <!-- sortKey -->\r\n @if (!hideSortKey()) {\r\n <mat-form-field>\r\n <mat-label>sort key</mat-label>\r\n <input matInput [formField]=\"form.sortKey\" />\r\n @if (\r\n form.sortKey().getError('maxLength') && (form.sortKey().dirty() || form.sortKey().touched())\r\n ) {\r\n <mat-error>sort key too long</mat-error>\r\n }\r\n </mat-form-field>\r\n }\r\n </div>\r\n\r\n <!-- description -->\r\n <div>\r\n <mat-form-field class=\"long-text\">\r\n <mat-label>description</mat-label>\r\n <textarea matInput [formField]=\"form.description\" rows=\"2\"></textarea>\r\n @if (\r\n form.description().getError('maxLength') &&\r\n (form.description().dirty() || form.description().touched())\r\n ) {\r\n <mat-error>description too long</mat-error>\r\n }\r\n </mat-form-field>\r\n </div>\r\n\r\n <!-- buttons -->\r\n <div>\r\n <button\r\n type=\"button\"\r\n mat-icon-button\r\n matTooltip=\"Discard changes\"\r\n (click)=\"cancel()\"\r\n >\r\n <mat-icon class=\"mat-warn\">clear</mat-icon>\r\n </button>\r\n <button\r\n type=\"button\"\r\n mat-icon-button\r\n matTooltip=\"Accept changes\"\r\n [disabled]=\"form().invalid() || !form().dirty()\"\r\n (click)=\"save()\"\r\n >\r\n <mat-icon class=\"mat-primary\">check_circle</mat-icon>\r\n </button>\r\n </div>\r\n</div>\r\n","import {\r\n ChangeDetectionStrategy,\r\n Component,\r\n computed,\r\n effect,\r\n input,\r\n linkedSignal,\r\n model,\r\n output,\r\n signal,\r\n untracked,\r\n} from '@angular/core';\r\nimport {\r\n FormField,\r\n form,\r\n maxLength,\r\n pattern,\r\n required,\r\n validate,\r\n} from '@angular/forms/signals';\r\n\r\n// material\r\nimport { MatButtonModule } from '@angular/material/button';\r\nimport { MatCheckbox } from '@angular/material/checkbox';\r\nimport {\r\n MatError,\r\n MatFormField,\r\n MatLabel,\r\n MatSuffix,\r\n} from '@angular/material/form-field';\r\nimport {\r\n MatExpansionPanel,\r\n MatExpansionPanelHeader,\r\n MatExpansionPanelTitle,\r\n} from '@angular/material/expansion';\r\nimport { MatIcon } from '@angular/material/icon';\r\nimport { MatInput } from '@angular/material/input';\r\nimport { MatTab, MatTabGroup } from '@angular/material/tabs';\r\nimport { MatTooltip } from '@angular/material/tooltip';\r\n\r\nimport { ColorToContrastPipe, EllipsisPipe } from '@myrmidon/ngx-tools';\r\nimport { DialogService } from '@myrmidon/ngx-mat-tools';\r\n\r\nimport { FacetDefinition, PartDefinition } from '@myrmidon/cadmus-core';\r\nimport { FacetModelSettings } from '@myrmidon/cadmus-api';\r\n\r\nimport { PartDefinitionEditorComponent } from '../part-definition-editor/part-definition-editor.component';\r\n\r\n/**\r\n * Editor for a single facet definition and its part definitions.\r\n * This editor is used as a descendant of the facet definition list editor, and allows\r\n * to edit a single facet definition and its part definitions.\r\n */\r\n/**\r\n * The editable shape behind the form.\r\n */\r\ninterface FacetDefinitionControls {\r\n id: string;\r\n label: string;\r\n colorKey: string;\r\n description: string;\r\n partDefinitions: PartDefinition[];\r\n}\r\n\r\n/**\r\n * A plain copy of a part definition, with its string keys only. The form\r\n * tags each item of its partDefinitions array with a hidden identity Symbol:\r\n * copying through Object.entries keeps such tags away from the objects we\r\n * receive and from those we emit (a spread would copy an enumerable Symbol).\r\n */\r\nfunction copyPart(d: PartDefinition): PartDefinition {\r\n return Object.fromEntries(Object.entries(d)) as unknown as PartDefinition;\r\n}\r\n\r\n/**\r\n * Bound definition -> draft. Part definitions are sorted by sortKey, so that\r\n * the displayed order always matches the key order, and copied: the draft\r\n * must not adopt the caller's own objects.\r\n */\r\nfunction toDraft(data: FacetDefinition | undefined): FacetDefinitionControls {\r\n return {\r\n id: data?.id || '',\r\n label: data?.label || '',\r\n colorKey: data?.colorKey || '',\r\n description: data?.description || '',\r\n partDefinitions: [...(data?.partDefinitions || [])]\r\n .sort((a, b) => (a.sortKey ?? '').localeCompare(b.sortKey ?? ''))\r\n .map(copyPart),\r\n };\r\n}\r\n\r\n/**\r\n * Draft -> definition. Normalizes values (trimming), so the definition\r\n * saved from a draft may differ from the draft itself.\r\n */\r\nfunction toData(v: FacetDefinitionControls): FacetDefinition {\r\n return {\r\n id: v.id.trim(),\r\n label: v.label.trim(),\r\n colorKey: v.colorKey,\r\n description: v.description.trim(),\r\n partDefinitions: v.partDefinitions.map(copyPart),\r\n };\r\n}\r\n\r\n@Component({\r\n selector: 'cadmus-facet-definition-editor',\r\n imports: [\r\n FormField,\r\n MatButtonModule,\r\n MatCheckbox,\r\n MatError,\r\n MatExpansionPanel,\r\n MatExpansionPanelHeader,\r\n MatExpansionPanelTitle,\r\n MatFormField,\r\n MatIcon,\r\n MatInput,\r\n MatLabel,\r\n MatSuffix,\r\n MatTab,\r\n MatTabGroup,\r\n MatTooltip,\r\n ColorToContrastPipe,\r\n EllipsisPipe,\r\n PartDefinitionEditorComponent,\r\n ],\r\n templateUrl: './facet-definition-editor.component.html',\r\n styleUrl: './facet-definition-editor.component.css',\r\n changeDetection: ChangeDetectionStrategy.OnPush,\r\n})\r\nexport class FacetDefinitionEditorComponent {\r\n /**\r\n * The facet definition to edit.\r\n */\r\n public readonly definition = model<FacetDefinition | undefined>();\r\n\r\n /**\r\n * The facet models settings, used to get the list of available part type IDs,\r\n * and whether they are base text parts; in this case, the same settings also\r\n * provide the list of their available role IDs from the fragments property.\r\n */\r\n public readonly facetModelSettings = input<FacetModelSettings | undefined>(\r\n undefined,\r\n );\r\n\r\n /**\r\n * The list of available part type IDs, taken from the facet model settings.\r\n * If the facet model settings are not provided, or do not contain any part\r\n * definition, this list is empty and the type ID must be entered freely.\r\n */\r\n public readonly availablePartTypeIds = computed(() => {\r\n const settings = this.facetModelSettings();\r\n return settings?.parts ? Object.keys(settings.parts) : [];\r\n });\r\n\r\n /**\r\n * Emitted when user requests to cancel the edit and close this editor.\r\n */\r\n public readonly cancelEdit = output();\r\n\r\n // edited part definition\r\n public readonly edited = signal<PartDefinition | undefined>(undefined);\r\n public readonly editedIndex = signal<number>(-1);\r\n\r\n /**\r\n * The editable draft, derived from definition. On the echo of our own\r\n * save the live draft is kept, as toData() normalizes its values.\r\n */\r\n private readonly _draft = linkedSignal<\r\n FacetDefinition | undefined,\r\n FacetDefinitionControls\r\n >({\r\n source: () => this.definition(),\r\n computation: (data, previous) =>\r\n previous &&\r\n JSON.stringify(data) === JSON.stringify(toData(previous.value))\r\n ? previous.value\r\n : toDraft(data),\r\n });\r\n\r\n public readonly form = form(this._draft, (path) => {\r\n required(path.id);\r\n maxLength(path.id, 100);\r\n required(path.label);\r\n maxLength(path.label, 100);\r\n // color key is a 6-digit hex string (without #)\r\n pattern(path.colorKey, /^[0-9a-fA-F]{6}$/);\r\n maxLength(path.description, 1000);\r\n // at least 1 part definition. Unlike reactive forms' required, the\r\n // signal forms required() rule accepts an empty array\r\n validate(path.partDefinitions, ({ value }) =>\r\n value().length ? null : { kind: 'required' },\r\n );\r\n });\r\n\r\n constructor(private _dialogService: DialogService) {\r\n // once the draft mirrors the bound definition again, clear interaction\r\n // state\r\n effect(() => {\r\n const draft = this._draft();\r\n untracked(() => {\r\n if (\r\n JSON.stringify(draft) === JSON.stringify(toDraft(this.definition()))\r\n ) {\r\n this.form().reset();\r\n }\r\n });\r\n });\r\n }\r\n\r\n /**\r\n * Set the part definitions, reassigning their sort keys as 2-digits\r\n * ordinal numbers, so that they are sorted in the order of the list.\r\n */\r\n private setPartDefinitions(definitions: PartDefinition[]): void {\r\n this.form.partDefinitions().value.set(\r\n definitions.map((entry, index) => ({\r\n ...entry,\r\n sortKey: (index + 1).toString().padStart(2, '0'),\r\n })),\r\n );\r\n this.form.partDefinitions().markAsDirty();\r\n }\r\n\r\n //#region Part definitions\r\n public addPartDefinition(): void {\r\n const definition: PartDefinition = {\r\n typeId: this.availablePartTypeIds().length\r\n ? this.availablePartTypeIds()[0]\r\n : '',\r\n name: 'new',\r\n };\r\n this.editedIndex.set(-1);\r\n this.edited.set(definition);\r\n }\r\n\r\n public editPartDefinition(entry: PartDefinition, index: number): void {\r\n this.editedIndex.set(index);\r\n this.edited.set(structuredClone(entry));\r\n }\r\n\r\n public closePartDefinition(): void {\r\n this.editedIndex.set(-1);\r\n this.edited.set(undefined);\r\n }\r\n\r\n public savePartDefinition(entry: PartDefinition): void {\r\n const entries = [...this.form.partDefinitions().value()];\r\n if (this.editedIndex() === -1) {\r\n entries.push(entry);\r\n } else {\r\n entries.splice(this.editedIndex(), 1, entry);\r\n }\r\n this.setPartDefinitions(entries);\r\n this.closePartDefinition();\r\n }\r\n\r\n public deletePartDefinition(index: number): void {\r\n const definition = this.form.partDefinitions().value()[index];\r\n this._dialogService\r\n .confirm('Confirmation', `Delete part \"${definition.name}\"?`)\r\n .subscribe((yes: boolean | undefined) => {\r\n if (yes) {\r\n if (this.editedIndex() === index) {\r\n this.closePartDefinition();\r\n }\r\n const definitions = [...this.form.partDefinitions().value()];\r\n definitions.splice(index, 1);\r\n this.setPartDefinitions(definitions);\r\n }\r\n });\r\n }\r\n\r\n public movePartDefinitionUp(index: number): void {\r\n if (index < 1) {\r\n return;\r\n }\r\n const definitions = [...this.form.partDefinitions().value()];\r\n const definition = definitions[index];\r\n definitions.splice(index, 1);\r\n definitions.splice(index - 1, 0, definition);\r\n // keep editedIndex in sync\r\n if (this.editedIndex() === index) {\r\n this.editedIndex.set(index - 1);\r\n } else if (this.editedIndex() === index - 1) {\r\n this.editedIndex.set(index);\r\n }\r\n this.setPartDefinitions(definitions);\r\n }\r\n\r\n public movePartDefinitionDown(index: number): void {\r\n if (index + 1 >= this.form.partDefinitions().value().length) {\r\n return;\r\n }\r\n const definitions = [...this.form.partDefinitions().value()];\r\n const definition = definitions[index];\r\n definitions.splice(index, 1);\r\n definitions.splice(index + 1, 0, definition);\r\n // keep editedIndex in sync\r\n if (this.editedIndex() === index) {\r\n this.editedIndex.set(index + 1);\r\n } else if (this.editedIndex() === index + 1) {\r\n this.editedIndex.set(index);\r\n }\r\n this.setPartDefinitions(definitions);\r\n }\r\n //#endregion\r\n\r\n public onColorPick(value: string): void {\r\n // native color input returns \"#rrggbb\" — strip the leading \"#\"\r\n this.form.colorKey().value.set(value.slice(1));\r\n this.form.colorKey().markAsDirty();\r\n }\r\n\r\n public cancel(): void {\r\n this.cancelEdit.emit();\r\n }\r\n\r\n /**\r\n * Saves the current form data by updating the `definition` model signal.\r\n * This method can be called manually (e.g., by a Save button) or\r\n * automatically (via auto-save).\r\n * @param pristine If true (default), the form is marked as pristine\r\n * after saving.\r\n * Set to false for auto-save if you want the form to remain dirty.\r\n */\r\n public save(pristine = true): void {\r\n if (this.form().invalid()) {\r\n // show validation errors\r\n this.form().markAsTouched();\r\n return;\r\n }\r\n\r\n this.definition.set(toData(this._draft()));\r\n\r\n if (pristine) {\r\n this.form().reset();\r\n }\r\n }\r\n}\r\n","<div>\r\n <mat-tab-group>\r\n <!-- GENERAL -->\r\n <mat-tab label=\"general\">\r\n <div class=\"form-row\">\r\n <!-- id -->\r\n <mat-form-field>\r\n <mat-label>ID</mat-label>\r\n <input matInput [formField]=\"form.id\" />\r\n @if (form.id().getError('required') && (form.id().dirty() || form.id().touched())) {\r\n <mat-error>ID required</mat-error>\r\n }\r\n @if (form.id().getError('maxLength') && (form.id().dirty() || form.id().touched())) {\r\n <mat-error>ID too long</mat-error>\r\n }\r\n </mat-form-field>\r\n\r\n <!-- label -->\r\n <mat-form-field>\r\n <mat-label>label</mat-label>\r\n <input matInput [formField]=\"form.label\" />\r\n @if (form.label().getError('required') && (form.label().dirty() || form.label().touched())) {\r\n <mat-error>label required</mat-error>\r\n }\r\n @if (\r\n form.label().getError('maxLength') && (form.label().dirty() || form.label().touched())\r\n ) {\r\n <mat-error>label too long</mat-error>\r\n }\r\n </mat-form-field>\r\n\r\n <!-- color -->\r\n <mat-form-field class=\"color-input\">\r\n <mat-label>color</mat-label>\r\n <input matInput [formField]=\"form.colorKey\" />\r\n @if (\r\n form.colorKey().getError('pattern') &&\r\n (form.colorKey().dirty() || form.colorKey().touched())\r\n ) {\r\n <mat-error>invalid color key</mat-error>\r\n }\r\n <input\r\n type=\"color\"\r\n class=\"color-picker-input\"\r\n #colorPicker\r\n [value]=\"\r\n form.colorKey().value().length === 6\r\n ? '#' + form.colorKey().value()\r\n : '#000000'\r\n \"\r\n (input)=\"onColorPick(colorPicker.value)\"\r\n />\r\n <button\r\n type=\"button\"\r\n mat-icon-button\r\n matSuffix\r\n matTooltip=\"Pick color\"\r\n (click)=\"colorPicker.click()\"\r\n >\r\n <mat-icon>palette</mat-icon>\r\n </button>\r\n </mat-form-field>\r\n <div class=\"color-sample\" [style.--swatch-color]=\"'#' + form.colorKey().value()\"></div>\r\n </div>\r\n\r\n <!-- description -->\r\n <div>\r\n <mat-form-field class=\"long-text\">\r\n <mat-label>description</mat-label>\r\n <textarea matInput [formField]=\"form.description\" rows=\"2\"></textarea>\r\n @if (\r\n form.description().getError('maxLength') &&\r\n (form.description().dirty() || form.description().touched())\r\n ) {\r\n <mat-error>description too long</mat-error>\r\n }\r\n </mat-form-field>\r\n </div>\r\n </mat-tab>\r\n\r\n <!-- PARTS -->\r\n <mat-tab label=\"parts\">\r\n <div>\r\n <button\r\n type=\"button\"\r\n mat-flat-button\r\n color=\"primary\"\r\n (click)=\"addPartDefinition()\"\r\n >\r\n <mat-icon>add_circle</mat-icon> part\r\n </button>\r\n </div>\r\n @if (form.partDefinitions().value().length) {\r\n <table>\r\n <thead>\r\n <tr>\r\n <th></th>\r\n <th>required</th>\r\n <th>type ID</th>\r\n <th>role ID</th>\r\n <th>name</th>\r\n <th>group</th>\r\n <th>color</th>\r\n <th>description</th>\r\n </tr>\r\n </thead>\r\n <tbody>\r\n @for (\r\n entry of form.partDefinitions().value();\r\n track entry;\r\n let i = $index;\r\n let first = $first;\r\n let last = $last\r\n ) {\r\n <tr [class.selected]=\"i === editedIndex()\">\r\n <td class=\"fit-width\">\r\n <button\r\n type=\"button\"\r\n mat-icon-button\r\n color=\"primary\"\r\n matTooltip=\"Edit this part definition\"\r\n (click)=\"editPartDefinition(entry, i)\"\r\n >\r\n <mat-icon class=\"mat-primary\">edit</mat-icon>\r\n </button>\r\n <button\r\n type=\"button\"\r\n mat-icon-button\r\n matTooltip=\"Move this part definition up\"\r\n [disabled]=\"first\"\r\n (click)=\"movePartDefinitionUp(i)\"\r\n >\r\n <mat-icon>arrow_upward</mat-icon>\r\n </button>\r\n <button\r\n type=\"button\"\r\n mat-icon-button\r\n matTooltip=\"Move this part definition down\"\r\n [disabled]=\"last\"\r\n (click)=\"movePartDefinitionDown(i)\"\r\n >\r\n <mat-icon>arrow_downward</mat-icon>\r\n </button>\r\n <button\r\n type=\"button\"\r\n mat-icon-button\r\n color=\"warn\"\r\n matTooltip=\"Delete this part definition\"\r\n (click)=\"deletePartDefinition(i)\"\r\n >\r\n <mat-icon class=\"mat-warn\">remove_circle</mat-icon>\r\n </button>\r\n </td>\r\n <td class=\"fit-width\">\r\n <mat-checkbox\r\n [checked]=\"entry.isRequired\"\r\n disabled\r\n ></mat-checkbox>\r\n </td>\r\n <td>{{ entry.typeId }}</td>\r\n <td>{{ entry.roleId }}</td>\r\n <td>{{ entry.name }}</td>\r\n <td>{{ entry.groupKey }}</td>\r\n <td>\r\n <span\r\n class=\"color-swatch\"\r\n [style.background-color]=\"'#' + entry.colorKey\"\r\n [style.color]=\"('#' + entry.colorKey) | colorToContrast\"\r\n >\r\n {{ entry.colorKey }}\r\n </span>\r\n </td>\r\n <td>{{ entry.description | ellipsis: 50 }}</td>\r\n </tr>\r\n }\r\n </tbody>\r\n </table>\r\n }\r\n @if (edited()) {\r\n <fieldset>\r\n <mat-expansion-panel [expanded]=\"edited()\" [disabled]=\"!edited()\">\r\n <mat-expansion-panel-header>\r\n <mat-panel-title>Part #{{ editedIndex() + 1 }}</mat-panel-title>\r\n </mat-expansion-panel-header>\r\n <cadmus-part-definition-editor\r\n [facetModelSettings]=\"facetModelSettings()\"\r\n [hideSortKey]=\"true\"\r\n [definition]=\"edited()\"\r\n (definitionChange)=\"savePartDefinition($event!)\"\r\n (cancelEdit)=\"closePartDefinition()\"\r\n />\r\n </mat-expansion-panel>\r\n </fieldset>\r\n }\r\n </mat-tab>\r\n </mat-tab-group>\r\n\r\n <!-- buttons -->\r\n <div>\r\n <button\r\n type=\"button\"\r\n mat-icon-button\r\n matTooltip=\"Discard changes\"\r\n (click)=\"cancel()\"\r\n >\r\n <mat-icon class=\"mat-warn\">clear</mat-icon>\r\n </button>\r\n <button\r\n type=\"button\"\r\n mat-icon-button\r\n matTooltip=\"Accept changes\"\r\n [disabled]=\"form().invalid() || !form().dirty()\"\r\n (click)=\"save()\"\r\n >\r\n <mat-icon class=\"mat-primary\">check_circle</mat-icon>\r\n </button>\r\n </div>\r\n</div>\r\n","import {\r\n ChangeDetectionStrategy,\r\n Component,\r\n computed,\r\n OnInit,\r\n output,\r\n signal,\r\n} from '@angular/core';\r\nimport { from, of } from 'rxjs';\r\nimport { catchError, concatMap, map, take, tap, toArray } from 'rxjs/operators';\r\n\r\n// material\r\nimport { MatButtonModule } from '@angular/material/button';\r\nimport { MatSnackBar } from '@angular/material/snack-bar';\r\nimport { MatIcon } from '@angular/material/icon';\r\nimport { MatTooltip } from '@angular/material/tooltip';\r\nimport {\r\n MatExpansionPanel,\r\n MatExpansionPanelHeader,\r\n MatExpansionPanelTitle,\r\n MatExpansionPanelDescription,\r\n} from '@angular/material/expansion';\r\nimport { MatProgressBar } from '@angular/material/progress-bar';\r\n\r\nimport { DialogService } from '@myrmidon/ngx-mat-tools';\r\nimport { ColorToContrastPipe, EllipsisPipe } from '@myrmidon/ngx-tools';\r\n\r\nimport { FacetDefinition } from '@myrmidon/cadmus-core';\r\nimport { FacetModelSettings, FacetService } from '@myrmidon/cadmus-api';\r\n\r\nimport {\r\n FacetDefinitionValidatorService,\r\n FacetValidationResult,\r\n} from '../../services/facet-definition-validator.service';\r\nimport { FacetDefinitionEditorComponent } from '../facet-definition-editor/facet-definition-editor.component';\r\n\r\n/**\r\n * Editor for a list of facet definitions. Cadmus facet definitions represent the data\r\n * types of items, and define all the parts which can be included in an item. Some of\r\n * them are required, others are optional. There can be multiple parts of the same type\r\n * in the same item, provided that their roleId is different.\r\n * This editor is used to edit the list of facet definitions from the current profile.\r\n * As the top level editor, it loads and saves the facet definitions list via API\r\n * services, and allows to add, edit, delete and reorder facet definitions.\r\n * The actual editing of a facet definition is delegated to descendant dumb components.\r\n * All edits happen in memory until the user clicks the Save button, which saves all\r\n * facet definitions to the server, and shows the result of the operation.\r\n */\r\n@Component({\r\n selector: 'cadmus-facet-definition-list-editor',\r\n imports: [\r\n MatButtonModule,\r\n MatExpansionPanel,\r\n MatExpansionPanelDescription,\r\n MatExpansionPanelHeader,\r\n MatExpansionPanelTitle,\r\n MatIcon,\r\n MatTooltip,\r\n MatProgressBar,\r\n ColorToContrastPipe,\r\n EllipsisPipe,\r\n FacetDefinitionEditorComponent,\r\n ],\r\n templateUrl: './facet-definition-list-editor.component.html',\r\n styleUrl: './facet-definition-list-editor.component.css',\r\n changeDetection: ChangeDetectionStrategy.OnPush,\r\n})\r\nexport class FacetDefinitionListEditorComponent implements OnInit {\r\n public readonly edited = signal<FacetDefinition | undefined>(undefined);\r\n public readonly editedIndex = signal<number>(-1);\r\n public readonly dirty = signal<boolean>(false);\r\n public readonly facets = signal<FacetDefinition[]>([]);\r\n public readonly busy = signal<boolean>(false);\r\n public readonly saveResult = signal<string | undefined>(undefined);\r\n /** True after at least one facet was successfully saved; prompts an app reload. */\r\n public readonly reloadNeeded = signal<boolean>(false);\r\n /** Last validation result, set by validate() and by save(). */\r\n public readonly validationResult = signal<FacetValidationResult | undefined>(\r\n undefined,\r\n );\r\n public readonly validationResultHasIssues = computed(() => {\r\n const vr = this.validationResult();\r\n return vr ? vr.hasErrors || vr.hasWarnings : false;\r\n })\r\n\r\n /**\r\n * The facet models settings, used to get the list of available part type IDs,\r\n * and whether they are base text parts; in this case, the same settings also\r\n * provide the list of their available role IDs from the fragments property.\r\n */\r\n public readonly facetModelSettings = signal<FacetModelSettings | undefined>(\r\n undefined,\r\n );\r\n\r\n public readonly dirtyChange = output<boolean>();\r\n public readonly editorClose = output<void>();\r\n\r\n constructor(\r\n private _dialogService: DialogService,\r\n private _facetService: FacetService,\r\n private _validator: FacetDefinitionValidatorService,\r\n private _snackbar: MatSnackBar,\r\n ) {}\r\n\r\n public ngOnInit(): void {\r\n // load facets once at start\r\n this.busy.set(true);\r\n this._facetService.getFacets().subscribe({\r\n next: (facets) => {\r\n this.facets.set(facets);\r\n this.busy.set(false);\r\n },\r\n error: (error) => {\r\n console.error(error);\r\n this.busy.set(false);\r\n this._snackbar.open('Error loading facets', 'Close');\r\n },\r\n });\r\n\r\n // load facet model settings once at start\r\n this._facetService.getFacetModelSettings().subscribe({\r\n next: (settings) => {\r\n this.facetModelSettings.set(settings);\r\n },\r\n error: (error) => {\r\n console.error(error);\r\n this._snackbar.open('Error loading facet model settings', 'Close');\r\n },\r\n });\r\n }\r\n\r\n public addFacet(): void {\r\n const entry: FacetDefinition = {\r\n id: 'new',\r\n label: 'New facet',\r\n colorKey: 'default',\r\n description: '',\r\n partDefinitions: [],\r\n };\r\n this.editedIndex.set(-1);\r\n this.edited.set(entry);\r\n }\r\n\r\n public editFacet(facet: FacetDefinition, index: number): void {\r\n this.editedIndex.set(index);\r\n this.edited.set(structuredClone(facet));\r\n }\r\n\r\n public closeFacet(): void {\r\n this.editedIndex.set(-1);\r\n this.edited.set(undefined);\r\n }\r\n\r\n public saveFacet(facet: FacetDefinition): void {\r\n const entries = [...this.facets()];\r\n if (this.editedIndex() === -1) {\r\n entries.push(facet);\r\n } else {\r\n entries.splice(this.editedIndex(), 1, facet);\r\n }\r\n this.facets.set(entries);\r\n this.closeFacet();\r\n this.dirty.set(true);\r\n this.dirtyChange.emit(true);\r\n }\r\n\r\n public deleteFacet(index: number): void {\r\n this._dialogService\r\n .confirm('Confirmation', `Delete facet ${this.edited()?.label}?`)\r\n .subscribe((yes: boolean | undefined) => {\r\n if (yes) {\r\n if (this.editedIndex() === index) {\r\n this.closeFacet();\r\n }\r\n const entries = [...this.facets()];\r\n entries.splice(index, 1);\r\n this.facets.set(entries);\r\n this.dirty.set(true);\r\n this.dirtyChange.emit(true);\r\n }\r\n });\r\n }\r\n\r\n public moveFacetUp(index: number): void {\r\n if (index < 1) {\r\n return;\r\n }\r\n const facet = this.facets()[index];\r\n const facets = [...this.facets()];\r\n facets.splice(index, 1);\r\n facets.splice(index - 1, 0, facet);\r\n this.facets.set(facets);\r\n this.dirty.set(true);\r\n this.dirtyChange.emit(true);\r\n // keep editedIndex in sync\r\n if (this.editedIndex() === index) {\r\n this.editedIndex.set(index - 1);\r\n } else if (this.editedIndex() === index - 1) {\r\n this.editedIndex.set(index);\r\n }\r\n }\r\n\r\n public moveFacetDown(index: number): void {\r\n if (index + 1 >= this.facets().length) {\r\n return;\r\n }\r\n const facet = this.facets()[index];\r\n const facets = [...this.facets()];\r\n facets.splice(index, 1);\r\n facets.splice(index + 1, 0, facet);\r\n this.facets.set(facets);\r\n this.dirty.set(true);\r\n this.dirtyChange.emit(true);\r\n // keep editedIndex in sync\r\n if (this.editedIndex() === index) {\r\n this.editedIndex.set(index + 1);\r\n } else if (this.editedIndex() === index + 1) {\r\n this.editedIndex.set(index);\r\n }\r\n }\r\n\r\n public reloadApp(): void {\r\n window.location.href = '/';\r\n }\r\n\r\n public close(): void {\r\n this.editorClose.emit();\r\n }\r\n\r\n /** Run validation and update validationResult; returns the observable. */\r\n private runValidation() {\r\n return this._validator\r\n .validate(this.facets(), this.facetModelSettings())\r\n .pipe(tap((result) => this.validationResult.set(result)));\r\n }\r\n\r\n /** Trigger validation from the template and update the displayed result. */\r\n public validate(): void {\r\n this.runValidation().pipe(take(1)).subscribe();\r\n }\r\n\r\n /** Persist all facets to the server; called only after all gates pass. */\r\n private doSave(): void {\r\n const facets = this.facets();\r\n this.busy.set(true);\r\n this.saveResult.set(undefined);\r\n\r\n from(facets)\r\n .pipe(\r\n concatMap((facet) =>\r\n this._facetService.addFacet(facet).pipe(\r\n map(() => true),\r\n catchError(() => of(false)),\r\n ),\r\n ),\r\n toArray(),\r\n )\r\n .subscribe((results) => {\r\n const saved: string[] = [];\r\n const failed: string[] = [];\r\n results.forEach((ok, i) => {\r\n if (ok) {\r\n saved.push(facets[i].id);\r\n } else {\r\n failed.push(facets[i].id);\r\n }\r\n });\r\n this.busy.set(false);\r\n this.dirty.set(failed.length > 0);\r\n this.dirtyChange.emit(failed.length > 0);\r\n if (saved.length > 0) {\r\n this.reloadNeeded.set(true);\r\n }\r\n const parts: string[] = [];\r\n if (saved.length) {\r\n parts.push(`Saved: ${saved.join(', ')}`);\r\n }\r\n if (failed.length) {\r\n parts.push(`Failed: ${failed.join(', ')}`);\r\n }\r\n this.saveResult.set(parts.join(' | '));\r\n });\r\n }\r\n\r\n /**\r\n * Final confirmation gate before the actual write.\r\n * Always shown, even when there are no warnings or errors.\r\n */\r\n private confirmAndSave(): void {\r\n this._dialogService\r\n .confirm(\r\n 'Save facets',\r\n 'Saving replaces ALL facet definitions on the server. ' +\r\n 'This may affect every item in the database. Proceed?',\r\n )\r\n .subscribe((ok) => {\r\n if (ok) {\r\n this.doSave();\r\n }\r\n });\r\n }\r\n\r\n public downloadFacets(): void {\r\n const replacer = (_key: string, value: unknown) =>\r\n value === null || value === false ? undefined : value;\r\n const dataStr =\r\n 'data:text/json;charset=utf-8,' +\r\n encodeURIComponent(JSON.stringify(this.facets(), replacer, 2));\r\n const dlAnchorElem = document.createElement('a');\r\n dlAnchorElem.setAttribute('href', dataStr);\r\n dlAnchorElem.setAttribute('download', 'facets.json');\r\n dlAnchorElem.click();\r\n }\r\n\r\n /**\r\n * Validate the current facets, then — if there are no blocking errors —\r\n * walk the user through confirmation gates before saving.\r\n *\r\n * Gates (in order):\r\n * 1. Validation errors → block save, show results.\r\n * 2. Validation warnings → ask user to confirm before continuing.\r\n * 3. Final critical-operation confirmation → always shown.\r\n */\r\n public save(): void {\r\n if (!this.facets().length) {\r\n return;\r\n }\r\n\r\n this.runValidation()\r\n .pipe(take(1))\r\n .subscribe((result) => {\r\n if (result.hasErrors) {\r\n // validation result is already displayed; nothing more to do\r\n return;\r\n }\r\n\r\n if (result.hasWarnings) {\r\n const warnCount = result.issues.filter(\r\n (i) => i.severity === 'warning',\r\n ).length;\r\n this._dialogService\r\n .confirm(\r\n 'Warnings',\r\n `There ${warnCount === 1 ? 'is 1 warning' : `are ${warnCount} warnings`}. ` +\r\n 'Review the validation results below. Proceed anyway?',\r\n )\r\n .subscribe((ok) => {\r\n if (ok) {\r\n this.confirmAndSave();\r\n }\r\n });\r\n } else {\r\n this.confirmAndSave();\r\n }\r\n });\r\n }\r\n}\r\n","<div>\r\n <div class=\"form-row\">\r\n <button type=\"button\" mat-flat-button color=\"primary\" (click)=\"addFacet()\">\r\n <mat-icon>add_circle</mat-icon> facet\r\n </button>\r\n <button type=\"button\" mat-flat-button (click)=\"validate()\">\r\n <mat-icon>fact_check</mat-icon> validate\r\n </button>\r\n <button type=\"button\" mat-flat-button (click)=\"downloadFacets()\">\r\n <mat-icon>download</mat-icon> download\r\n </button>\r\n <button type=\"button\" mat-flat-button color=\"warn\" (click)=\"save()\">\r\n <mat-icon>save</mat-icon> save\r\n </button>\r\n </div>\r\n <div>\r\n @if (busy()) {\r\n <mat-progress-bar mode=\"indeterminate\" color=\"accent\" />\r\n }\r\n </div>\r\n @if (validationResult(); as vr) {\r\n <mat-expansion-panel [expanded]=\"true\">\r\n <mat-expansion-panel-header>\r\n <mat-panel-title>Validation result</mat-panel-title>\r\n <mat-panel-description\r\n [style.color]=\"validationResultHasIssues() ? 'warn' : 'primary'\"\r\n >\r\n {{ vr.issues.length }} result{{ vr.issues.length !== 1 ? \"s\" : \"\" }}\r\n </mat-panel-description>\r\n </mat-expansion-panel-header>\r\n <div class=\"validation-result\">\r\n @if (!vr.issues.length) {\r\n <span>No issues found.</span>\r\n } @else {\r\n <div class=\"validation-issues\">\r\n @for (issue of vr.issues; track $index) {\r\n <div class=\"validation-issue {{ issue.severity }}\">\r\n <mat-icon>{{\r\n issue.severity === \"error\"\r\n ? \"error\"\r\n : issue.severity === \"warning\"\r\n ? \"warning\"\r\n : \"info\"\r\n }}</mat-icon>\r\n <span>{{ issue.message }}</span>\r\n </div>\r\n }\r\n </div>\r\n }\r\n </div>\r\n </mat-expansion-panel>\r\n }\r\n @if (reloadNeeded()) {\r\n <div class=\"reload-notice\">\r\n <mat-icon>info</mat-icon>\r\n <span\r\n >Facet definitions are cached at startup. Please reload the app to apply\r\n the changes.</span\r\n >\r\n <button\r\n type=\"button\"\r\n mat-flat-button\r\n color=\"primary\"\r\n (click)=\"reloadApp()\"\r\n >\r\n <mat-icon>refresh</mat-icon>\r\n reload app\r\n </button>\r\n </div>\r\n }\r\n @if (facets().length) {\r\n <table class=\"margin-top\">\r\n <thead>\r\n <tr>\r\n <th></th>\r\n <th>ID</th>\r\n <th>label</th>\r\n <th>color</th>\r\n <th>parts</th>\r\n <th>description</th>\r\n </tr>\r\n </thead>\r\n <tbody>\r\n @for (\r\n entry of facets();\r\n track entry;\r\n let i = $index;\r\n let first = $first;\r\n let last = $last\r\n ) {\r\n <tr [class.selected]=\"i === editedIndex()\">\r\n <td class=\"fit-width\">\r\n <button\r\n type=\"button\"\r\n mat-icon-button\r\n color=\"primary\"\r\n matTooltip=\"Edit this facet\"\r\n (click)=\"editFacet(entry, i)\"\r\n >\r\n <mat-icon class=\"mat-primary\">edit</mat-icon>\r\n </button>\r\n <button\r\n type=\"button\"\r\n mat-icon-button\r\n matTooltip=\"Move this facet up\"\r\n [disabled]=\"first\"\r\n (click)=\"moveFacetUp(i)\"\r\n >\r\n <mat-icon>arrow_upward</mat-icon>\r\n </button>\r\n <button\r\n type=\"button\"\r\n mat-icon-button\r\n matTooltip=\"Move this facet down\"\r\n [disabled]=\"last\"\r\n (click)=\"moveFacetDown(i)\"\r\n >\r\n <mat-icon>arrow_downward</mat-icon>\r\n </button>\r\n <button\r\n type=\"button\"\r\n mat-icon-button\r\n color=\"warn\"\r\n matTooltip=\"Delete this facet\"\r\n (click)=\"deleteFacet(i)\"\r\n >\r\n <mat-icon class=\"mat-warn\">remove_circle</mat-icon>\r\n </button>\r\n </td>\r\n <td>{{ entry.id }}</td>\r\n <td>{{ entry.label }}</td>\r\n <td>\r\n <span\r\n class=\"color-swatch\"\r\n [style.background-color]=\"'#' + entry.colorKey\"\r\n [style.color]=\"'#' + entry.colorKey | colorToContrast\"\r\n >\r\n {{ entry.colorKey }}\r\n </span>\r\n </td>\r\n <td>{{ entry.partDefinitions.length }}</td>\r\n <td>{{ entry.description | ellipsis: 50 }}</td>\r\n </tr>\r\n }\r\n </tbody>\r\n </table>\r\n }\r\n @if (edited()) {\r\n <fieldset>\r\n <mat-expansion-panel [expanded]=\"edited()\" [disabled]=\"!edited()\">\r\n <mat-expansion-panel-header>\r\n <mat-panel-title>Facet #{{ editedIndex() + 1 }}</mat-panel-title>\r\n </mat-expansion-panel-header>\r\n <cadmus-facet-definition-editor\r\n [facetModelSettings]=\"facetModelSettings()\"\r\n [definition]=\"edited()\"\r\n (definitionChange)=\"saveFacet($event!)\"\r\n (cancelEdit)=\"closeFacet()\"\r\n />\r\n </mat-expansion-panel>\r\n </fieldset>\r\n }\r\n</div>\r\n","import { ChangeDetectionStrategy, Component, signal } from '@angular/core';\n\nimport {\n MatCard,\n MatCardContent,\n MatCardHeader,\n MatCardTitle,\n} from '@angular/material/card';\nimport { MatIcon } from '@angular/material/icon';\n\nimport { ComponentCanDeactivate } from '@myrmidon/cadmus-core';\n\nimport { FacetDefinitionListEditorComponent } from '../facet-definition-list-editor/facet-definition-list-editor.component';\n\n@Component({\n selector: 'cadmus-facet-edit-page',\n imports: [\n MatCard,\n MatCardContent,\n MatCardHeader,\n MatCardTitle,\n MatIcon,\n FacetDefinitionListEditorComponent,\n ],\n templateUrl: './facet-edit-page.component.html',\n styleUrl: './facet-edit-page.component.css',\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class FacetEditPageComponent implements ComponentCanDeactivate {\n private readonly _dirty = signal<boolean>(false);\n\n public canDeactivate(): boolean {\n return !this._dirty();\n }\n\n public onDirtyChange(dirty: boolean): void {\n this._dirty.set(dirty);\n }\n}\n","<mat-card>\r\n <mat-card-header>\r\n <mat-icon mat-card-avatar>dashboard</mat-icon>\r\n <mat-card-title>Edit Facets</mat-card-title>\r\n </mat-card-header>\r\n <mat-card-content>\r\n <div class=\"margin-top\">\r\n <cadmus-facet-definition-list-editor (dirtyChange)=\"onDirtyChange($event)\" />\r\n </div>\r\n </mat-card-content>\r\n</mat-card>\r\n","import { Routes } from '@angular/router';\n\nimport { pendingChangesGuard } from '@myrmidon/cadmus-core';\n\nimport { FacetEditPageComponent } from './components/facet-edit-page/facet-edit-page.component';\n\nexport const CADMUS_PROFILE_EDIT_ROUTES: Routes = [\n {\n path: 'facets',\n pathMatch: 'full',\n component: FacetEditPageComponent,\n canDeactivate: [pendingChangesGuard],\n },\n];\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AA2CA,IAAa,kCAAb,MAAa,gCAA+B;CACtB;CAApB,YAAoB,mBAAmC;EAAnC,KAAA,oBAAA;CAAsC;CAElD,YAAY,QAA8B;EAChD,OAAO;GACL;GACA,WAAW,OAAO,MAAM,MAAM,EAAE,aAAa,OAAO;GACpD,aAAa,OAAO,MAAM,MAAM,EAAE,aAAa,SAAS;GACxD,UAAU,OAAO,MAAM,MAAM,EAAE,aAAa,MAAM;EACnD;CACH;CAEQ,cACN,QACA,aACA,SACA,MAAyB;EAEzB,KAAK,MAAM,CAAC,QAAQ,UAAU,OAAO,QAAQ,OAAO,GAClD,KAAK,MAAM,SAAS,MAAM,eAAe,CAAA,GAAI;GAC3C,MAA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on-cadmus-profile-editor.mjs","names":["i1","toDraft","toData","MatError","MatFormField","MatLabel","i2","i3.FacetDefinitionValidatorService","i5"],"sources":["../../../../projects/myrmidon/cadmus-profile-editor/src/lib/services/facet-definition-validator.service.ts","../../../../projects/myrmidon/cadmus-profile-editor/src/lib/components/part-definition-editor/part-definition-editor.component.ts","../../../../projects/myrmidon/cadmus-profile-editor/src/lib/components/part-definition-editor/part-definition-editor.component.html","../../../../projects/myrmidon/cadmus-profile-editor/src/lib/components/facet-definition-editor/facet-definition-editor.component.ts","../../../../projects/myrmidon/cadmus-profile-editor/src/lib/components/facet-definition-editor/facet-definition-editor.component.html","../../../../projects/myrmidon/cadmus-profile-editor/src/lib/components/facet-definition-list-editor/facet-definition-list-editor.component.ts","../../../../projects/myrmidon/cadmus-profile-editor/src/lib/components/facet-definition-list-editor/facet-definition-list-editor.component.html","../../../../projects/myrmidon/cadmus-profile-editor/src/lib/components/facet-edit-page/facet-edit-page.component.ts","../../../../projects/myrmidon/cadmus-profile-editor/src/lib/components/facet-edit-page/facet-edit-page.component.html","../../../../projects/myrmidon/cadmus-profile-editor/src/lib/cadmus-profile-edit.routes.ts"],"sourcesContent":["import { Injectable } from '@angular/core';\nimport { Observable, of } from 'rxjs';\nimport { map } from 'rxjs/operators';\n\nimport { FacetDefinition } from '@myrmidon/cadmus-core';\nimport { FacetModelSettings, ThesaurusService } from '@myrmidon/cadmus-api';\n\n/** A single validation issue produced by {@link FacetDefinitionValidatorService}. */\nexport interface FacetValidationIssue {\n severity: 'error' | 'warning' | 'info';\n /** Human-readable description of the issue. */\n message: string;\n}\n\n/** The result returned by {@link FacetDefinitionValidatorService.validate}. */\nexport interface FacetValidationResult {\n issues: FacetValidationIssue[];\n hasErrors: boolean;\n hasWarnings: boolean;\n hasInfos: boolean;\n}\n\n/**\n * Validates a list of {@link FacetDefinition} objects before they are persisted.\n *\n * Rules:\n * - duplicate facet ID → error\n * - facet ID still set to \"new\" → warning (unfilled placeholder)\n * - duplicate facet label → error\n * - duplicate facet color → info\n * - duplicate facet description → info\n * - facet with no part definitions → error\n * - within a facet: two parts with same typeId AND same roleId\n * (including both empty/null) → error\n * (one with a roleId and one without is valid: they serve different roles)\n * - within a facet: duplicate part color → info\n * - within a facet: duplicate part description → info\n * - (when facetModelSettings is provided) for each part/fragment entry in the\n * settings, each thesaurus ID listed in thesauriIds is checked against the\n * existing thesauri: missing required thesauri (prefixed with \"*\") → error;\n * missing optional thesauri → info.\n */\n@Injectable({ providedIn: 'root' })\nexport class FacetDefinitionValidatorService {\n constructor(private _thesaurusService: ThesaurusService) {}\n\n private buildResult(issues: FacetValidationIssue[]): FacetValidationResult {\n return {\n issues,\n hasErrors: issues.some((i) => i.severity === 'error'),\n hasWarnings: issues.some((i) => i.severity === 'warning'),\n hasInfos: issues.some((i) => i.severity === 'info'),\n };\n }\n\n private checkThesauri(\n issues: FacetValidationIssue[],\n existingIds: Set<string>,\n entries: { [key: string]: { thesauriIds?: string[] } },\n kind: 'Part' | 'Fragment',\n ): void {\n for (const [typeId, entry] of Object.entries(entries)) {\n for (const rawId of entry.thesauriIds ?? []) {\n const required = rawId.startsWith('*');\n const bareId = required ? rawId.substring(1) : rawId;\n if (!existingIds.has(bareId)) {\n if (required) {\n issues.push({\n severity: 'error',\n message: `${kind} \"${typeId}\" requires thesaurus \"${bareId}\" which does not exist.`,\n });\n } else {\n issues.push({\n severity: 'info',\n message: `${kind} \"${typeId}\" uses optional thesaurus \"${bareId}\" which does not exist.`,\n });\n }\n }\n }\n }\n }\n\n /**\n * Validate the given list of facet definitions and return a result\n * containing all issues found.\n * @param facets The list of facet definitions to validate.\n * @param facetModelSettings Optional settings; when provided the thesauri\n * referenced by each part/fragment are checked against the server.\n */\n public validate(\n facets: FacetDefinition[],\n facetModelSettings?: FacetModelSettings,\n ): Observable<FacetValidationResult> {\n const issues: FacetValidationIssue[] = [];\n\n const seenIds = new Set<string>();\n const seenLabels = new Set<string>();\n const seenColors = new Set<string>();\n const seenDescriptions = new Set<string>();\n\n for (const facet of facets) {\n const label = `facet \"${facet.id}\"`;\n\n // duplicate / placeholder ID\n if (!facet.id) {\n issues.push({ severity: 'error', message: 'A facet has an empty ID.' });\n } else if (facet.id === 'new') {\n issues.push({\n severity: 'warning',\n message: `Facet has placeholder ID \"new\" — please assign a real ID.`,\n });\n } else if (seenIds.has(facet.id)) {\n issues.push({\n severity: 'error',\n message: `Duplicate facet ID: \"${facet.id}\".`,\n });\n } else {\n seenIds.add(facet.id);\n }\n\n // duplicate label\n if (facet.label) {\n if (seenLabels.has(facet.label)) {\n issues.push({\n severity: 'error',\n message: `Duplicate facet label \"${facet.label}\" in ${label}.`,\n });\n } else {\n seenLabels.add(facet.label);\n }\n }\n\n // duplicate color (info)\n if (facet.colorKey) {\n if (seenColors.has(facet.colorKey)) {\n issues.push({\n severity: 'info',\n message: `Duplicate facet color \"${facet.colorKey}\" in ${label}.`,\n });\n } else {\n seenColors.add(facet.colorKey);\n }\n }\n\n // duplicate description (info)\n if (facet.description) {\n if (seenDescriptions.has(facet.description)) {\n issues.push({\n severity: 'info',\n message: `Duplicate facet description \"${facet.description}\" in ${label}.`,\n });\n } else {\n seenDescriptions.add(facet.description);\n }\n }\n\n // no part definitions\n if (!facet.partDefinitions.length) {\n issues.push({\n severity: 'error',\n message: `${label} has no part definitions.`,\n });\n }\n\n // within-facet checks\n const seenPartKeys = new Set<string>();\n const seenPartColors = new Set<string>();\n const seenPartDescriptions = new Set<string>();\n\n for (const part of facet.partDefinitions) {\n // duplicate typeId + roleId combination\n // key uses empty string for absent roleId so that\n // (typeId, undefined) vs (typeId, \"r1\") are treated as different\n const key = `${part.typeId}|${part.roleId ?? ''}`;\n if (seenPartKeys.has(key)) {\n issues.push({\n severity: 'error',\n message:\n `Duplicate part (typeId \"${part.typeId}\", ` +\n `roleId \"${part.roleId ?? '(none)'}\") in ${label}.`,\n });\n } else {\n seenPartKeys.add(key);\n }\n\n // duplicate part color (info)\n if (part.colorKey) {\n if (seenPartColors.has(part.colorKey)) {\n issues.push({\n severity: 'info',\n message: `Duplicate part color \"${part.colorKey}\" in ${label}.`,\n });\n } else {\n seenPartColors.add(part.colorKey);\n }\n }\n\n // duplicate part description (info)\n if (part.description) {\n if (seenPartDescriptions.has(part.description)) {\n issues.push({\n severity: 'info',\n message: `Duplicate part description \"${part.description}\" for type \"${part.typeId}\" in ${label}.`,\n });\n } else {\n seenPartDescriptions.add(part.description);\n }\n }\n }\n }\n\n // thesaurus coverage check (only when model settings are available)\n if (!facetModelSettings) {\n return of(this.buildResult(issues));\n }\n\n return this._thesaurusService.getThesaurusIds().pipe(\n map((ids) => {\n // remove final @language from IDs for comparison, as facet model settings\n // do not include the language suffix\n const existingIds = new Set(ids.map((id) => id.replace(/\\@[a-z]+$/g, '')));\n this.checkThesauri(\n issues,\n existingIds,\n facetModelSettings.parts,\n 'Part',\n );\n if (facetModelSettings.fragments) {\n this.checkThesauri(\n issues,\n existingIds,\n facetModelSettings.fragments,\n 'Fragment',\n );\n }\n return this.buildResult(issues);\n }),\n );\n }\n}\n","import {\r\n ChangeDetectionStrategy,\r\n Component,\r\n computed,\r\n effect,\r\n input,\r\n linkedSignal,\r\n model,\r\n output,\r\n untracked,\r\n} from '@angular/core';\r\nimport {\r\n FormField,\r\n form,\r\n maxLength,\r\n pattern,\r\n required,\r\n} from '@angular/forms/signals';\r\n\r\n// material\r\nimport { MatIconButton } from '@angular/material/button';\r\nimport { MatTooltip } from '@angular/material/tooltip';\r\nimport {\r\n MatError,\r\n MatFormField,\r\n MatInput,\r\n MatLabel,\r\n} from '@angular/material/input';\r\nimport { MatIcon } from '@angular/material/icon';\r\n\r\nimport { PartDefinition } from '@myrmidon/cadmus-core';\r\nimport { FacetModelSettings } from '@myrmidon/cadmus-api';\r\nimport { MatSuffix } from '@angular/material/form-field';\r\nimport { MatOption, MatSelect } from '@angular/material/select';\r\nimport { MatCheckbox } from '@angular/material/checkbox';\r\n\r\n/**\r\n * The editable shape behind the form. Text fields use '' as their empty\r\n * value, as they are bound to native inputs.\r\n */\r\ninterface PartDefinitionControls {\r\n typeId: string;\r\n roleId: string;\r\n name: string;\r\n required: boolean;\r\n description: string;\r\n colorKey: string;\r\n groupKey: string;\r\n sortKey: string;\r\n}\r\n\r\nfunction toDraft(data: PartDefinition | undefined): PartDefinitionControls {\r\n return {\r\n typeId: data?.typeId || '',\r\n roleId: data?.roleId || '',\r\n name: data?.name || '',\r\n required: data?.isRequired || false,\r\n description: data?.description || '',\r\n colorKey: data?.colorKey || '',\r\n groupKey: data?.groupKey || '',\r\n sortKey: data?.sortKey || '',\r\n };\r\n}\r\n\r\n/**\r\n * Draft -> definition. Normalizes values (trimming, '' to undefined), so\r\n * the definition saved from a draft may differ from the draft itself.\r\n */\r\nfunction toData(v: PartDefinitionControls): PartDefinition {\r\n return {\r\n typeId: v.typeId.trim(),\r\n roleId: v.roleId.trim() || undefined,\r\n name: v.name.trim(),\r\n isRequired: v.required,\r\n description: v.description.trim() || undefined,\r\n colorKey: v.colorKey.trim() || undefined,\r\n groupKey: v.groupKey.trim() || undefined,\r\n sortKey: v.sortKey.trim() || undefined,\r\n };\r\n}\r\n\r\n/**\r\n * Editor for a single part definition. This allows users to edit the part definition\r\n * properties: type ID, selected from a list if facet model settings are provided,\r\n * or entered freely if not (but this should not happen, as at least part definitions\r\n * should be present and these provide fallback model settings); role ID, selected\r\n * from a closed list when the part type is a base text part, or entered freely otherwise;\r\n * name; color; group; sort key; description; and whether the part is required or not\r\n * in its facet.\r\n * NOTE: part definition settings are not edited here. They are defined server-side\r\n * and will later be obsoleted.\r\n */\r\n@Component({\r\n selector: 'cadmus-part-definition-editor',\r\n imports: [\r\n FormField,\r\n MatCheckbox,\r\n MatError,\r\n MatFormField,\r\n MatIcon,\r\n MatIconButton,\r\n MatInput,\r\n MatLabel,\r\n MatOption,\r\n MatSelect,\r\n MatSuffix,\r\n MatTooltip,\r\n ],\r\n templateUrl: './part-definition-editor.component.html',\r\n styleUrl: './part-definition-editor.component.css',\r\n changeDetection: ChangeDetectionStrategy.OnPush,\r\n})\r\nexport class PartDefinitionEditorComponent {\r\n /**\r\n * The part to edit.\r\n */\r\n public readonly definition = model<PartDefinition | undefined>();\r\n\r\n /**\r\n * The facet models settings, used to get the list of available part type IDs,\r\n * and whether they are base text parts; in this case, the same settings also\r\n * provide the list of their available role IDs from the fragments property.\r\n */\r\n public readonly facetModelSettings = input<FacetModelSettings | undefined>(\r\n undefined,\r\n );\r\n\r\n /**\r\n * The list of available part type IDs, taken from the facet model settings.\r\n * If the facet model settings are not provided, or do not contain any part\r\n * definition, this list is empty and the type ID must be entered freely.\r\n */\r\n public readonly availablePartTypeIds = computed(() => {\r\n const settings = this.facetModelSettings();\r\n return settings?.parts ? Object.keys(settings.parts) : [];\r\n });\r\n\r\n /**\r\n * The list of available fragment IDs, taken from the facet model settings.\r\n * This is used to populate the role ID select when the part type is a base\r\n * text part (i.e. its baseText property in settings is true).\r\n */\r\n public readonly availableFragmentIds = computed(() => {\r\n const settings = this.facetModelSettings();\r\n return settings?.fragments ? Object.keys(settings.fragments) : [];\r\n });\r\n\r\n\r\n /**\r\n * True to hide the sort key field. This is used when the sort key is\r\n * defined at the level of the part definitions list, and not at the level\r\n * of each part definition.\r\n */\r\n public readonly hideSortKey = input<boolean>(false);\r\n\r\n /**\r\n * Emitted when user requests to cancel the edit and close this editor.\r\n */\r\n public readonly cancelEdit = output();\r\n\r\n /**\r\n * The editable draft, derived from definition. On the echo of our own\r\n * save the live draft is kept, as toData() normalizes its values.\r\n */\r\n private readonly _draft = linkedSignal<\r\n PartDefinition | undefined,\r\n PartDefinitionControls\r\n >({\r\n source: () => this.definition(),\r\n computation: (data, previous) =>\r\n previous &&\r\n JSON.stringify(data) === JSON.stringify(toData(previous.value))\r\n ? previous.value\r\n : toDraft(data),\r\n });\r\n\r\n public readonly form = form(this._draft, (path) => {\r\n required(path.typeId);\r\n maxLength(path.typeId, 100);\r\n required(path.name);\r\n maxLength(path.name, 100);\r\n maxLength(path.description, 1000);\r\n // color key has form RRGGBB, where RR, GG and BB are hex values\r\n // for red, green and blue\r\n pattern(path.colorKey, /^[0-9a-fA-F]{6}$/);\r\n });\r\n\r\n /**\r\n * True if the part type is a base text part, i.e. if the facet model settings\r\n * for the current part type ID has the baseText property set to true. In this\r\n * case, the role ID select is shown with the list of available fragment IDs\r\n * from the facet model settings; otherwise, a free text input is shown for\r\n * the role ID.\r\n */\r\n public readonly isBaseTextPart = computed<boolean>(() => {\r\n const settings = this.facetModelSettings();\r\n return settings?.parts?.[this.form.typeId().value()]?.baseText === true;\r\n });\r\n\r\n constructor() {\r\n // once the draft mirrors the bound definition again, clear interaction\r\n // state\r\n effect(() => {\r\n const draft = this._draft();\r\n untracked(() => {\r\n if (\r\n JSON.stringify(draft) === JSON.stringify(toDraft(this.definition()))\r\n ) {\r\n this.form().reset();\r\n }\r\n });\r\n });\r\n }\r\n\r\n public onColorPick(value: string): void {\r\n // native color input returns \"#rrggbb\" — strip the leading \"#\"\r\n this.form.colorKey().value.set(value.slice(1));\r\n this.form.colorKey().markAsDirty();\r\n }\r\n\r\n public cancel(): void {\r\n this.cancelEdit.emit();\r\n }\r\n\r\n /**\r\n * Saves the current form data by updating the `data` model signal.\r\n * This method can be called manually (e.g., by a Save button) or\r\n * automatically (via auto-save).\r\n * @param pristine If true (default), the form is marked as pristine\r\n * after saving.\r\n * Set to false for auto-save if you want the form to remain dirty.\r\n */\r\n public save(pristine = true): void {\r\n if (this.form().invalid()) {\r\n // show validation errors\r\n this.form().markAsTouched();\r\n return;\r\n }\r\n\r\n this.definition.set(toData(this._draft()));\r\n\r\n if (pristine) {\r\n this.form().reset();\r\n }\r\n }\r\n}\r\n","<div>\r\n <div class=\"form-row\">\r\n <!-- typeId (bound) -->\r\n @if (availablePartTypeIds().length) {\r\n <mat-form-field>\r\n <mat-label>type</mat-label>\r\n <mat-select [formField]=\"form.typeId\">\r\n @for (id of availablePartTypeIds(); track id) {\r\n <mat-option [value]=\"id\">{{ id }}</mat-option>\r\n }\r\n </mat-select>\r\n @if (\r\n form.typeId().getError('required') && (form.typeId().dirty() || form.typeId().touched())\r\n ) {\r\n <mat-error>type ID required</mat-error>\r\n }\r\n </mat-form-field>\r\n } @else {\r\n <!-- typeId (free) -->\r\n <mat-form-field>\r\n <mat-label>type ID</mat-label>\r\n <input matInput [formField]=\"form.typeId\" />\r\n @if (\r\n form.typeId().getError('required') && (form.typeId().dirty() || form.typeId().touched())\r\n ) {\r\n <mat-error>type ID required</mat-error>\r\n }\r\n @if (\r\n form.typeId().getError('maxLength') && (form.typeId().dirty() || form.typeId().touched())\r\n ) {\r\n <mat-error>type ID too long</mat-error>\r\n }\r\n </mat-form-field>\r\n }\r\n\r\n <!-- roleId is to be selected from a list if the part is a base text part -->\r\n @if (isBaseTextPart()) {\r\n <mat-form-field>\r\n <mat-label>role ID</mat-label>\r\n <mat-select [formField]=\"form.roleId\">\r\n @for (e of availableFragmentIds(); track e) {\r\n <mat-option [value]=\"e\">{{ e }}</mat-option>\r\n }\r\n </mat-select>\r\n @if (\r\n form.roleId().getError('required') && (form.roleId().dirty() || form.roleId().touched())\r\n ) {\r\n <mat-error>role ID required</mat-error>\r\n }\r\n </mat-form-field>\r\n } @else {\r\n <!-- else roleId is free -->\r\n <mat-form-field>\r\n <mat-label>role ID</mat-label>\r\n <input matInput [formField]=\"form.roleId\" />\r\n @if (\r\n form.roleId().getError('required') && (form.roleId().dirty() || form.roleId().touched())\r\n ) {\r\n <mat-error>role ID required</mat-error>\r\n }\r\n @if (\r\n form.roleId().getError('maxLength') && (form.roleId().dirty() || form.roleId().touched())\r\n ) {\r\n <mat-error>role ID too long</mat-error>\r\n }\r\n </mat-form-field>\r\n }\r\n\r\n <!-- required -->\r\n <mat-checkbox [formField]=\"form.required\">required</mat-checkbox>\r\n </div>\r\n\r\n <div class=\"form-row\">\r\n <!-- name -->\r\n <mat-form-field>\r\n <mat-label>name</mat-label>\r\n <input matInput [formField]=\"form.name\" />\r\n @if (form.name().getError('required') && (form.name().dirty() || form.name().touched())) {\r\n <mat-error>name required</mat-error>\r\n }\r\n @if (form.name().getError('maxLength') && (form.name().dirty() || form.name().touched())) {\r\n <mat-error>name too long</mat-error>\r\n }\r\n </mat-form-field>\r\n\r\n <!-- color -->\r\n <mat-form-field class=\"color-input\">\r\n <mat-label>color</mat-label>\r\n <input matInput [formField]=\"form.colorKey\" />\r\n @if (\r\n form.colorKey().getError('pattern') && (form.colorKey().dirty() || form.colorKey().touched())\r\n ) {\r\n <mat-error>invalid color key</mat-error>\r\n }\r\n <input\r\n type=\"color\"\r\n class=\"color-picker-input\"\r\n #colorPicker\r\n [value]=\"\r\n form.colorKey().value().length === 6\r\n ? '#' + form.colorKey().value()\r\n : '#000000'\r\n \"\r\n (input)=\"onColorPick(colorPicker.value)\"\r\n />\r\n <button\r\n type=\"button\"\r\n mat-icon-button\r\n matSuffix\r\n matTooltip=\"Pick color\"\r\n (click)=\"colorPicker.click()\"\r\n >\r\n <mat-icon>palette</mat-icon>\r\n </button>\r\n </mat-form-field>\r\n <div class=\"color-sample\" [style.--swatch-color]=\"'#' + form.colorKey().value()\"></div>\r\n\r\n <!-- group -->\r\n <mat-form-field>\r\n <mat-label>group</mat-label>\r\n <input matInput [formField]=\"form.groupKey\" />\r\n @if (\r\n form.groupKey().getError('maxLength') && (form.groupKey().dirty() || form.groupKey().touched())\r\n ) {\r\n <mat-error>group key too long</mat-error>\r\n }\r\n </mat-form-field>\r\n\r\n <!-- sortKey -->\r\n @if (!hideSortKey()) {\r\n <mat-form-field>\r\n <mat-label>sort key</mat-label>\r\n <input matInput [formField]=\"form.sortKey\" />\r\n @if (\r\n form.sortKey().getError('maxLength') && (form.sortKey().dirty() || form.sortKey().touched())\r\n ) {\r\n <mat-error>sort key too long</mat-error>\r\n }\r\n </mat-form-field>\r\n }\r\n </div>\r\n\r\n <!-- description -->\r\n <div>\r\n <mat-form-field class=\"long-text\">\r\n <mat-label>description</mat-label>\r\n <textarea matInput [formField]=\"form.description\" rows=\"2\"></textarea>\r\n @if (\r\n form.description().getError('maxLength') &&\r\n (form.description().dirty() || form.description().touched())\r\n ) {\r\n <mat-error>description too long</mat-error>\r\n }\r\n </mat-form-field>\r\n </div>\r\n\r\n <!-- buttons -->\r\n <div>\r\n <button\r\n type=\"button\"\r\n mat-icon-button\r\n matTooltip=\"Discard changes\"\r\n (click)=\"cancel()\"\r\n >\r\n <mat-icon class=\"mat-warn\">clear</mat-icon>\r\n </button>\r\n <button\r\n type=\"button\"\r\n mat-icon-button\r\n matTooltip=\"Accept changes\"\r\n [disabled]=\"form().invalid() || !form().dirty()\"\r\n (click)=\"save()\"\r\n >\r\n <mat-icon class=\"mat-primary\">check_circle</mat-icon>\r\n </button>\r\n </div>\r\n</div>\r\n","import {\r\n ChangeDetectionStrategy,\r\n Component,\r\n computed,\r\n effect,\r\n input,\r\n linkedSignal,\r\n model,\r\n output,\r\n signal,\r\n untracked,\r\n} from '@angular/core';\r\nimport {\r\n FormField,\r\n form,\r\n maxLength,\r\n pattern,\r\n required,\r\n validate,\r\n} from '@angular/forms/signals';\r\n\r\n// material\r\nimport { MatButtonModule } from '@angular/material/button';\r\nimport { MatCheckbox } from '@angular/material/checkbox';\r\nimport {\r\n MatError,\r\n MatFormField,\r\n MatLabel,\r\n MatSuffix,\r\n} from '@angular/material/form-field';\r\nimport {\r\n MatExpansionPanel,\r\n MatExpansionPanelHeader,\r\n MatExpansionPanelTitle,\r\n} from '@angular/material/expansion';\r\nimport { MatIcon } from '@angular/material/icon';\r\nimport { MatInput } from '@angular/material/input';\r\nimport { MatTab, MatTabGroup } from '@angular/material/tabs';\r\nimport { MatTooltip } from '@angular/material/tooltip';\r\n\r\nimport { ColorToContrastPipe, EllipsisPipe } from '@myrmidon/ngx-tools';\r\nimport { DialogService } from '@myrmidon/ngx-mat-tools';\r\n\r\nimport { FacetDefinition, PartDefinition } from '@myrmidon/cadmus-core';\r\nimport { FacetModelSettings } from '@myrmidon/cadmus-api';\r\n\r\nimport { PartDefinitionEditorComponent } from '../part-definition-editor/part-definition-editor.component';\r\n\r\n/**\r\n * Editor for a single facet definition and its part definitions.\r\n * This editor is used as a descendant of the facet definition list editor, and allows\r\n * to edit a single facet definition and its part definitions.\r\n */\r\n/**\r\n * The editable shape behind the form.\r\n */\r\ninterface FacetDefinitionControls {\r\n id: string;\r\n label: string;\r\n colorKey: string;\r\n description: string;\r\n partDefinitions: PartDefinition[];\r\n}\r\n\r\n/**\r\n * A plain copy of a part definition, with its string keys only. The form\r\n * tags each item of its partDefinitions array with a hidden identity Symbol:\r\n * copying through Object.entries keeps such tags away from the objects we\r\n * receive and from those we emit (a spread would copy an enumerable Symbol).\r\n */\r\nfunction copyPart(d: PartDefinition): PartDefinition {\r\n return Object.fromEntries(Object.entries(d)) as unknown as PartDefinition;\r\n}\r\n\r\n/**\r\n * Bound definition -> draft. Part definitions are sorted by sortKey, so that\r\n * the displayed order always matches the key order, and copied: the draft\r\n * must not adopt the caller's own objects.\r\n */\r\nfunction toDraft(data: FacetDefinition | undefined): FacetDefinitionControls {\r\n return {\r\n id: data?.id || '',\r\n label: data?.label || '',\r\n colorKey: data?.colorKey || '',\r\n description: data?.description || '',\r\n partDefinitions: [...(data?.partDefinitions || [])]\r\n .sort((a, b) => (a.sortKey ?? '').localeCompare(b.sortKey ?? ''))\r\n .map(copyPart),\r\n };\r\n}\r\n\r\n/**\r\n * Draft -> definition. Normalizes values (trimming), so the definition\r\n * saved from a draft may differ from the draft itself.\r\n */\r\nfunction toData(v: FacetDefinitionControls): FacetDefinition {\r\n return {\r\n id: v.id.trim(),\r\n label: v.label.trim(),\r\n colorKey: v.colorKey,\r\n description: v.description.trim(),\r\n partDefinitions: v.partDefinitions.map(copyPart),\r\n };\r\n}\r\n\r\n@Component({\r\n selector: 'cadmus-facet-definition-editor',\r\n imports: [\r\n FormField,\r\n MatButtonModule,\r\n MatCheckbox,\r\n MatError,\r\n MatExpansionPanel,\r\n MatExpansionPanelHeader,\r\n MatExpansionPanelTitle,\r\n MatFormField,\r\n MatIcon,\r\n MatInput,\r\n MatLabel,\r\n MatSuffix,\r\n MatTab,\r\n MatTabGroup,\r\n MatTooltip,\r\n ColorToContrastPipe,\r\n EllipsisPipe,\r\n PartDefinitionEditorComponent,\r\n ],\r\n templateUrl: './facet-definition-editor.component.html',\r\n styleUrl: './facet-definition-editor.component.css',\r\n changeDetection: ChangeDetectionStrategy.OnPush,\r\n})\r\nexport class FacetDefinitionEditorComponent {\r\n /**\r\n * The facet definition to edit.\r\n */\r\n public readonly definition = model<FacetDefinition | undefined>();\r\n\r\n /**\r\n * The facet models settings, used to get the list of available part type IDs,\r\n * and whether they are base text parts; in this case, the same settings also\r\n * provide the list of their available role IDs from the fragments property.\r\n */\r\n public readonly facetModelSettings = input<FacetModelSettings | undefined>(\r\n undefined,\r\n );\r\n\r\n /**\r\n * The list of available part type IDs, taken from the facet model settings.\r\n * If the facet model settings are not provided, or do not contain any part\r\n * definition, this list is empty and the type ID must be entered freely.\r\n */\r\n public readonly availablePartTypeIds = computed(() => {\r\n const settings = this.facetModelSettings();\r\n return settings?.parts ? Object.keys(settings.parts) : [];\r\n });\r\n\r\n /**\r\n * Emitted when user requests to cancel the edit and close this editor.\r\n */\r\n public readonly cancelEdit = output();\r\n\r\n // edited part definition\r\n public readonly edited = signal<PartDefinition | undefined>(undefined);\r\n public readonly editedIndex = signal<number>(-1);\r\n\r\n /**\r\n * The editable draft, derived from definition. On the echo of our own\r\n * save the live draft is kept, as toData() normalizes its values.\r\n */\r\n private readonly _draft = linkedSignal<\r\n FacetDefinition | undefined,\r\n FacetDefinitionControls\r\n >({\r\n source: () => this.definition(),\r\n computation: (data, previous) =>\r\n previous &&\r\n JSON.stringify(data) === JSON.stringify(toData(previous.value))\r\n ? previous.value\r\n : toDraft(data),\r\n });\r\n\r\n public readonly form = form(this._draft, (path) => {\r\n required(path.id);\r\n maxLength(path.id, 100);\r\n required(path.label);\r\n maxLength(path.label, 100);\r\n // color key is a 6-digit hex string (without #)\r\n pattern(path.colorKey, /^[0-9a-fA-F]{6}$/);\r\n maxLength(path.description, 1000);\r\n // at least 1 part definition. Unlike reactive forms' required, the\r\n // signal forms required() rule accepts an empty array\r\n validate(path.partDefinitions, ({ value }) =>\r\n value().length ? null : { kind: 'required' },\r\n );\r\n });\r\n\r\n constructor(private _dialogService: DialogService) {\r\n // once the draft mirrors the bound definition again, clear interaction\r\n // state\r\n effect(() => {\r\n const draft = this._draft();\r\n untracked(() => {\r\n if (\r\n JSON.stringify(draft) === JSON.stringify(toDraft(this.definition()))\r\n ) {\r\n this.form().reset();\r\n }\r\n });\r\n });\r\n }\r\n\r\n /**\r\n * Set the part definitions, reassigning their sort keys as 2-digits\r\n * ordinal numbers, so that they are sorted in the order of the list.\r\n */\r\n private setPartDefinitions(definitions: PartDefinition[]): void {\r\n this.form.partDefinitions().value.set(\r\n definitions.map((entry, index) => ({\r\n ...entry,\r\n sortKey: (index + 1).toString().padStart(2, '0'),\r\n })),\r\n );\r\n this.form.partDefinitions().markAsDirty();\r\n }\r\n\r\n //#region Part definitions\r\n public addPartDefinition(): void {\r\n const definition: PartDefinition = {\r\n typeId: this.availablePartTypeIds().length\r\n ? this.availablePartTypeIds()[0]\r\n : '',\r\n name: 'new',\r\n };\r\n this.editedIndex.set(-1);\r\n this.edited.set(definition);\r\n }\r\n\r\n public editPartDefinition(entry: PartDefinition, index: number): void {\r\n this.editedIndex.set(index);\r\n this.edited.set(structuredClone(entry));\r\n }\r\n\r\n public closePartDefinition(): void {\r\n this.editedIndex.set(-1);\r\n this.edited.set(undefined);\r\n }\r\n\r\n public savePartDefinition(entry: PartDefinition): void {\r\n const entries = [...this.form.partDefinitions().value()];\r\n if (this.editedIndex() === -1) {\r\n entries.push(entry);\r\n } else {\r\n entries.splice(this.editedIndex(), 1, entry);\r\n }\r\n this.setPartDefinitions(entries);\r\n this.closePartDefinition();\r\n }\r\n\r\n public deletePartDefinition(index: number): void {\r\n const definition = this.form.partDefinitions().value()[index];\r\n this._dialogService\r\n .confirm('Confirmation', `Delete part \"${definition.name}\"?`)\r\n .subscribe((yes: boolean | undefined) => {\r\n if (yes) {\r\n if (this.editedIndex() === index) {\r\n this.closePartDefinition();\r\n }\r\n const definitions = [...this.form.partDefinitions().value()];\r\n definitions.splice(index, 1);\r\n this.setPartDefinitions(definitions);\r\n }\r\n });\r\n }\r\n\r\n public movePartDefinitionUp(index: number): void {\r\n if (index < 1) {\r\n return;\r\n }\r\n const definitions = [...this.form.partDefinitions().value()];\r\n const definition = definitions[index];\r\n definitions.splice(index, 1);\r\n definitions.splice(index - 1, 0, definition);\r\n // keep editedIndex in sync\r\n if (this.editedIndex() === index) {\r\n this.editedIndex.set(index - 1);\r\n } else if (this.editedIndex() === index - 1) {\r\n this.editedIndex.set(index);\r\n }\r\n this.setPartDefinitions(definitions);\r\n }\r\n\r\n public movePartDefinitionDown(index: number): void {\r\n if (index + 1 >= this.form.partDefinitions().value().length) {\r\n return;\r\n }\r\n const definitions = [...this.form.partDefinitions().value()];\r\n const definition = definitions[index];\r\n definitions.splice(index, 1);\r\n definitions.splice(index + 1, 0, definition);\r\n // keep editedIndex in sync\r\n if (this.editedIndex() === index) {\r\n this.editedIndex.set(index + 1);\r\n } else if (this.editedIndex() === index + 1) {\r\n this.editedIndex.set(index);\r\n }\r\n this.setPartDefinitions(definitions);\r\n }\r\n //#endregion\r\n\r\n public onColorPick(value: string): void {\r\n // native color input returns \"#rrggbb\" — strip the leading \"#\"\r\n this.form.colorKey().value.set(value.slice(1));\r\n this.form.colorKey().markAsDirty();\r\n }\r\n\r\n public cancel(): void {\r\n this.cancelEdit.emit();\r\n }\r\n\r\n /**\r\n * Saves the current form data by updating the `definition` model signal.\r\n * This method can be called manually (e.g., by a Save button) or\r\n * automatically (via auto-save).\r\n * @param pristine If true (default), the form is marked as pristine\r\n * after saving.\r\n * Set to false for auto-save if you want the form to remain dirty.\r\n */\r\n public save(pristine = true): void {\r\n if (this.form().invalid()) {\r\n // show validation errors\r\n this.form().markAsTouched();\r\n return;\r\n }\r\n\r\n this.definition.set(toData(this._draft()));\r\n\r\n if (pristine) {\r\n this.form().reset();\r\n }\r\n }\r\n}\r\n","<div>\r\n <mat-tab-group>\r\n <!-- GENERAL -->\r\n <mat-tab label=\"general\">\r\n <div class=\"form-row\">\r\n <!-- id -->\r\n <mat-form-field>\r\n <mat-label>ID</mat-label>\r\n <input matInput [formField]=\"form.id\" />\r\n @if (form.id().getError('required') && (form.id().dirty() || form.id().touched())) {\r\n <mat-error>ID required</mat-error>\r\n }\r\n @if (form.id().getError('maxLength') && (form.id().dirty() || form.id().touched())) {\r\n <mat-error>ID too long</mat-error>\r\n }\r\n </mat-form-field>\r\n\r\n <!-- label -->\r\n <mat-form-field>\r\n <mat-label>label</mat-label>\r\n <input matInput [formField]=\"form.label\" />\r\n @if (form.label().getError('required') && (form.label().dirty() || form.label().touched())) {\r\n <mat-error>label required</mat-error>\r\n }\r\n @if (\r\n form.label().getError('maxLength') && (form.label().dirty() || form.label().touched())\r\n ) {\r\n <mat-error>label too long</mat-error>\r\n }\r\n </mat-form-field>\r\n\r\n <!-- color -->\r\n <mat-form-field class=\"color-input\">\r\n <mat-label>color</mat-label>\r\n <input matInput [formField]=\"form.colorKey\" />\r\n @if (\r\n form.colorKey().getError('pattern') &&\r\n (form.colorKey().dirty() || form.colorKey().touched())\r\n ) {\r\n <mat-error>invalid color key</mat-error>\r\n }\r\n <input\r\n type=\"color\"\r\n class=\"color-picker-input\"\r\n #colorPicker\r\n [value]=\"\r\n form.colorKey().value().length === 6\r\n ? '#' + form.colorKey().value()\r\n : '#000000'\r\n \"\r\n (input)=\"onColorPick(colorPicker.value)\"\r\n />\r\n <button\r\n type=\"button\"\r\n mat-icon-button\r\n matSuffix\r\n matTooltip=\"Pick color\"\r\n (click)=\"colorPicker.click()\"\r\n >\r\n <mat-icon>palette</mat-icon>\r\n </button>\r\n </mat-form-field>\r\n <div class=\"color-sample\" [style.--swatch-color]=\"'#' + form.colorKey().value()\"></div>\r\n </div>\r\n\r\n <!-- description -->\r\n <div>\r\n <mat-form-field class=\"long-text\">\r\n <mat-label>description</mat-label>\r\n <textarea matInput [formField]=\"form.description\" rows=\"2\"></textarea>\r\n @if (\r\n form.description().getError('maxLength') &&\r\n (form.description().dirty() || form.description().touched())\r\n ) {\r\n <mat-error>description too long</mat-error>\r\n }\r\n </mat-form-field>\r\n </div>\r\n </mat-tab>\r\n\r\n <!-- PARTS -->\r\n <mat-tab label=\"parts\">\r\n <div>\r\n <button\r\n type=\"button\"\r\n mat-flat-button\r\n color=\"primary\"\r\n (click)=\"addPartDefinition()\"\r\n >\r\n <mat-icon>add_circle</mat-icon> part\r\n </button>\r\n </div>\r\n @if (form.partDefinitions().value().length) {\r\n <table>\r\n <thead>\r\n <tr>\r\n <th></th>\r\n <th>required</th>\r\n <th>type ID</th>\r\n <th>role ID</th>\r\n <th>name</th>\r\n <th>group</th>\r\n <th>color</th>\r\n <th>description</th>\r\n </tr>\r\n </thead>\r\n <tbody>\r\n @for (\r\n entry of form.partDefinitions().value();\r\n track entry;\r\n let i = $index;\r\n let first = $first;\r\n let last = $last\r\n ) {\r\n <tr [class.selected]=\"i === editedIndex()\">\r\n <td class=\"fit-width\">\r\n <button\r\n type=\"button\"\r\n mat-icon-button\r\n color=\"primary\"\r\n matTooltip=\"Edit this part definition\"\r\n (click)=\"editPartDefinition(entry, i)\"\r\n >\r\n <mat-icon class=\"mat-primary\">edit</mat-icon>\r\n </button>\r\n <button\r\n type=\"button\"\r\n mat-icon-button\r\n matTooltip=\"Move this part definition up\"\r\n [disabled]=\"first\"\r\n (click)=\"movePartDefinitionUp(i)\"\r\n >\r\n <mat-icon>arrow_upward</mat-icon>\r\n </button>\r\n <button\r\n type=\"button\"\r\n mat-icon-button\r\n matTooltip=\"Move this part definition down\"\r\n [disabled]=\"last\"\r\n (click)=\"movePartDefinitionDown(i)\"\r\n >\r\n <mat-icon>arrow_downward</mat-icon>\r\n </button>\r\n <button\r\n type=\"button\"\r\n mat-icon-button\r\n color=\"warn\"\r\n matTooltip=\"Delete this part definition\"\r\n (click)=\"deletePartDefinition(i)\"\r\n >\r\n <mat-icon class=\"mat-warn\">remove_circle</mat-icon>\r\n </button>\r\n </td>\r\n <td class=\"fit-width\">\r\n <mat-checkbox\r\n [checked]=\"entry.isRequired\"\r\n disabled\r\n ></mat-checkbox>\r\n </td>\r\n <td>{{ entry.typeId }}</td>\r\n <td>{{ entry.roleId }}</td>\r\n <td>{{ entry.name }}</td>\r\n <td>{{ entry.groupKey }}</td>\r\n <td>\r\n <span\r\n class=\"color-swatch\"\r\n [style.background-color]=\"'#' + entry.colorKey\"\r\n [style.color]=\"('#' + entry.colorKey) | colorToContrast\"\r\n >\r\n {{ entry.colorKey }}\r\n </span>\r\n </td>\r\n <td>{{ entry.description | ellipsis: 50 }}</td>\r\n </tr>\r\n }\r\n </tbody>\r\n </table>\r\n }\r\n @if (edited()) {\r\n <fieldset>\r\n <mat-expansion-panel [expanded]=\"edited()\" [disabled]=\"!edited()\">\r\n <mat-expansion-panel-header>\r\n <mat-panel-title>Part #{{ editedIndex() + 1 }}</mat-panel-title>\r\n </mat-expansion-panel-header>\r\n <cadmus-part-definition-editor\r\n [facetModelSettings]=\"facetModelSettings()\"\r\n [hideSortKey]=\"true\"\r\n [definition]=\"edited()\"\r\n (definitionChange)=\"savePartDefinition($event!)\"\r\n (cancelEdit)=\"closePartDefinition()\"\r\n />\r\n </mat-expansion-panel>\r\n </fieldset>\r\n }\r\n </mat-tab>\r\n </mat-tab-group>\r\n\r\n <!-- buttons -->\r\n <div>\r\n <button\r\n type=\"button\"\r\n mat-icon-button\r\n matTooltip=\"Discard changes\"\r\n (click)=\"cancel()\"\r\n >\r\n <mat-icon class=\"mat-warn\">clear</mat-icon>\r\n </button>\r\n <button\r\n type=\"button\"\r\n mat-icon-button\r\n matTooltip=\"Accept changes\"\r\n [disabled]=\"form().invalid() || !form().dirty()\"\r\n (click)=\"save()\"\r\n >\r\n <mat-icon class=\"mat-primary\">check_circle</mat-icon>\r\n </button>\r\n </div>\r\n</div>\r\n","import {\r\n ChangeDetectionStrategy,\r\n Component,\r\n computed,\r\n OnInit,\r\n output,\r\n signal,\r\n} from '@angular/core';\r\nimport { from, of } from 'rxjs';\r\nimport { catchError, concatMap, map, take, tap, toArray } from 'rxjs/operators';\r\n\r\n// material\r\nimport { MatButtonModule } from '@angular/material/button';\r\nimport { MatSnackBar } from '@angular/material/snack-bar';\r\nimport { MatIcon } from '@angular/material/icon';\r\nimport { MatTooltip } from '@angular/material/tooltip';\r\nimport {\r\n MatExpansionPanel,\r\n MatExpansionPanelHeader,\r\n MatExpansionPanelTitle,\r\n MatExpansionPanelDescription,\r\n} from '@angular/material/expansion';\r\nimport { MatProgressBar } from '@angular/material/progress-bar';\r\n\r\nimport { DialogService } from '@myrmidon/ngx-mat-tools';\r\nimport { ColorToContrastPipe, EllipsisPipe } from '@myrmidon/ngx-tools';\r\n\r\nimport { FacetDefinition } from '@myrmidon/cadmus-core';\r\nimport { FacetModelSettings, FacetService } from '@myrmidon/cadmus-api';\r\n\r\nimport {\r\n FacetDefinitionValidatorService,\r\n FacetValidationResult,\r\n} from '../../services/facet-definition-validator.service';\r\nimport { FacetDefinitionEditorComponent } from '../facet-definition-editor/facet-definition-editor.component';\r\n\r\n/**\r\n * Editor for a list of facet definitions. Cadmus facet definitions represent the data\r\n * types of items, and define all the parts which can be included in an item. Some of\r\n * them are required, others are optional. There can be multiple parts of the same type\r\n * in the same item, provided that their roleId is different.\r\n * This editor is used to edit the list of facet definitions from the current profile.\r\n * As the top level editor, it loads and saves the facet definitions list via API\r\n * services, and allows to add, edit, delete and reorder facet definitions.\r\n * The actual editing of a facet definition is delegated to descendant dumb components.\r\n * All edits happen in memory until the user clicks the Save button, which saves all\r\n * facet definitions to the server, and shows the result of the operation.\r\n */\r\n@Component({\r\n selector: 'cadmus-facet-definition-list-editor',\r\n imports: [\r\n MatButtonModule,\r\n MatExpansionPanel,\r\n MatExpansionPanelDescription,\r\n MatExpansionPanelHeader,\r\n MatExpansionPanelTitle,\r\n MatIcon,\r\n MatTooltip,\r\n MatProgressBar,\r\n ColorToContrastPipe,\r\n EllipsisPipe,\r\n FacetDefinitionEditorComponent,\r\n ],\r\n templateUrl: './facet-definition-list-editor.component.html',\r\n styleUrl: './facet-definition-list-editor.component.css',\r\n changeDetection: ChangeDetectionStrategy.OnPush,\r\n})\r\nexport class FacetDefinitionListEditorComponent implements OnInit {\r\n public readonly edited = signal<FacetDefinition | undefined>(undefined);\r\n public readonly editedIndex = signal<number>(-1);\r\n public readonly dirty = signal<boolean>(false);\r\n public readonly facets = signal<FacetDefinition[]>([]);\r\n public readonly busy = signal<boolean>(false);\r\n public readonly saveResult = signal<string | undefined>(undefined);\r\n /** True after at least one facet was successfully saved; prompts an app reload. */\r\n public readonly reloadNeeded = signal<boolean>(false);\r\n /** Last validation result, set by validate() and by save(). */\r\n public readonly validationResult = signal<FacetValidationResult | undefined>(\r\n undefined,\r\n );\r\n public readonly validationResultHasIssues = computed(() => {\r\n const vr = this.validationResult();\r\n return vr ? vr.hasErrors || vr.hasWarnings : false;\r\n })\r\n\r\n /**\r\n * The facet models settings, used to get the list of available part type IDs,\r\n * and whether they are base text parts; in this case, the same settings also\r\n * provide the list of their available role IDs from the fragments property.\r\n */\r\n public readonly facetModelSettings = signal<FacetModelSettings | undefined>(\r\n undefined,\r\n );\r\n\r\n public readonly dirtyChange = output<boolean>();\r\n public readonly editorClose = output<void>();\r\n\r\n constructor(\r\n private _dialogService: DialogService,\r\n private _facetService: FacetService,\r\n private _validator: FacetDefinitionValidatorService,\r\n private _snackbar: MatSnackBar,\r\n ) {}\r\n\r\n public ngOnInit(): void {\r\n // load facets once at start\r\n this.busy.set(true);\r\n this._facetService.getFacets().subscribe({\r\n next: (facets) => {\r\n this.facets.set(facets);\r\n this.busy.set(false);\r\n },\r\n error: (error) => {\r\n console.error(error);\r\n this.busy.set(false);\r\n this._snackbar.open('Error loading facets', 'Close');\r\n },\r\n });\r\n\r\n // load facet model settings once at start\r\n this._facetService.getFacetModelSettings().subscribe({\r\n next: (settings) => {\r\n this.facetModelSettings.set(settings);\r\n },\r\n error: (error) => {\r\n console.error(error);\r\n this._snackbar.open('Error loading facet model settings', 'Close');\r\n },\r\n });\r\n }\r\n\r\n public addFacet(): void {\r\n const entry: FacetDefinition = {\r\n id: 'new',\r\n label: 'New facet',\r\n colorKey: 'default',\r\n description: '',\r\n partDefinitions: [],\r\n };\r\n this.editedIndex.set(-1);\r\n this.edited.set(entry);\r\n }\r\n\r\n public editFacet(facet: FacetDefinition, index: number): void {\r\n this.editedIndex.set(index);\r\n this.edited.set(structuredClone(facet));\r\n }\r\n\r\n public closeFacet(): void {\r\n this.editedIndex.set(-1);\r\n this.edited.set(undefined);\r\n }\r\n\r\n public saveFacet(facet: FacetDefinition): void {\r\n const entries = [...this.facets()];\r\n if (this.editedIndex() === -1) {\r\n entries.push(facet);\r\n } else {\r\n entries.splice(this.editedIndex(), 1, facet);\r\n }\r\n this.facets.set(entries);\r\n this.closeFacet();\r\n this.dirty.set(true);\r\n this.dirtyChange.emit(true);\r\n }\r\n\r\n public deleteFacet(index: number): void {\r\n this._dialogService\r\n .confirm('Confirmation', `Delete facet ${this.edited()?.label}?`)\r\n .subscribe((yes: boolean | undefined) => {\r\n if (yes) {\r\n if (this.editedIndex() === index) {\r\n this.closeFacet();\r\n }\r\n const entries = [...this.facets()];\r\n entries.splice(index, 1);\r\n this.facets.set(entries);\r\n this.dirty.set(true);\r\n this.dirtyChange.emit(true);\r\n }\r\n });\r\n }\r\n\r\n public moveFacetUp(index: number): void {\r\n if (index < 1) {\r\n return;\r\n }\r\n const facet = this.facets()[index];\r\n const facets = [...this.facets()];\r\n facets.splice(index, 1);\r\n facets.splice(index - 1, 0, facet);\r\n this.facets.set(facets);\r\n this.dirty.set(true);\r\n this.dirtyChange.emit(true);\r\n // keep editedIndex in sync\r\n if (this.editedIndex() === index) {\r\n this.editedIndex.set(index - 1);\r\n } else if (this.editedIndex() === index - 1) {\r\n this.editedIndex.set(index);\r\n }\r\n }\r\n\r\n public moveFacetDown(index: number): void {\r\n if (index + 1 >= this.facets().length) {\r\n return;\r\n }\r\n const facet = this.facets()[index];\r\n const facets = [...this.facets()];\r\n facets.splice(index, 1);\r\n facets.splice(index + 1, 0, facet);\r\n this.facets.set(facets);\r\n this.dirty.set(true);\r\n this.dirtyChange.emit(true);\r\n // keep editedIndex in sync\r\n if (this.editedIndex() === index) {\r\n this.editedIndex.set(index + 1);\r\n } else if (this.editedIndex() === index + 1) {\r\n this.editedIndex.set(index);\r\n }\r\n }\r\n\r\n public reloadApp(): void {\r\n window.location.href = '/';\r\n }\r\n\r\n public close(): void {\r\n this.editorClose.emit();\r\n }\r\n\r\n /** Run validation and update validationResult; returns the observable. */\r\n private runValidation() {\r\n return this._validator\r\n .validate(this.facets(), this.facetModelSettings())\r\n .pipe(tap((result) => this.validationResult.set(result)));\r\n }\r\n\r\n /** Trigger validation from the template and update the displayed result. */\r\n public validate(): void {\r\n this.runValidation().pipe(take(1)).subscribe();\r\n }\r\n\r\n /** Persist all facets to the server; called only after all gates pass. */\r\n private doSave(): void {\r\n const facets = this.facets();\r\n this.busy.set(true);\r\n this.saveResult.set(undefined);\r\n\r\n from(facets)\r\n .pipe(\r\n concatMap((facet) =>\r\n this._facetService.addFacet(facet).pipe(\r\n map(() => true),\r\n catchError(() => of(false)),\r\n ),\r\n ),\r\n toArray(),\r\n )\r\n .subscribe((results) => {\r\n const saved: string[] = [];\r\n const failed: string[] = [];\r\n results.forEach((ok, i) => {\r\n if (ok) {\r\n saved.push(facets[i].id);\r\n } else {\r\n failed.push(facets[i].id);\r\n }\r\n });\r\n this.busy.set(false);\r\n this.dirty.set(failed.length > 0);\r\n this.dirtyChange.emit(failed.length > 0);\r\n if (saved.length > 0) {\r\n this.reloadNeeded.set(true);\r\n }\r\n const parts: string[] = [];\r\n if (saved.length) {\r\n parts.push(`Saved: ${saved.join(', ')}`);\r\n }\r\n if (failed.length) {\r\n parts.push(`Failed: ${failed.join(', ')}`);\r\n }\r\n this.saveResult.set(parts.join(' | '));\r\n });\r\n }\r\n\r\n /**\r\n * Final confirmation gate before the actual write.\r\n * Always shown, even when there are no warnings or errors.\r\n */\r\n private confirmAndSave(): void {\r\n this._dialogService\r\n .confirm(\r\n 'Save facets',\r\n 'Saving replaces ALL facet definitions on the server. ' +\r\n 'This may affect every item in the database. Proceed?',\r\n )\r\n .subscribe((ok) => {\r\n if (ok) {\r\n this.doSave();\r\n }\r\n });\r\n }\r\n\r\n public downloadFacets(): void {\r\n const replacer = (_key: string, value: unknown) =>\r\n value === null || value === false ? undefined : value;\r\n const dataStr =\r\n 'data:text/json;charset=utf-8,' +\r\n encodeURIComponent(JSON.stringify(this.facets(), replacer, 2));\r\n const dlAnchorElem = document.createElement('a');\r\n dlAnchorElem.setAttribute('href', dataStr);\r\n dlAnchorElem.setAttribute('download', 'facets.json');\r\n dlAnchorElem.click();\r\n }\r\n\r\n /**\r\n * Validate the current facets, then — if there are no blocking errors —\r\n * walk the user through confirmation gates before saving.\r\n *\r\n * Gates (in order):\r\n * 1. Validation errors → block save, show results.\r\n * 2. Validation warnings → ask user to confirm before continuing.\r\n * 3. Final critical-operation confirmation → always shown.\r\n */\r\n public save(): void {\r\n if (!this.facets().length) {\r\n return;\r\n }\r\n\r\n this.runValidation()\r\n .pipe(take(1))\r\n .subscribe((result) => {\r\n if (result.hasErrors) {\r\n // validation result is already displayed; nothing more to do\r\n return;\r\n }\r\n\r\n if (result.hasWarnings) {\r\n const warnCount = result.issues.filter(\r\n (i) => i.severity === 'warning',\r\n ).length;\r\n this._dialogService\r\n .confirm(\r\n 'Warnings',\r\n `There ${warnCount === 1 ? 'is 1 warning' : `are ${warnCount} warnings`}. ` +\r\n 'Review the validation results below. Proceed anyway?',\r\n )\r\n .subscribe((ok) => {\r\n if (ok) {\r\n this.confirmAndSave();\r\n }\r\n });\r\n } else {\r\n this.confirmAndSave();\r\n }\r\n });\r\n }\r\n}\r\n","<div>\r\n <div class=\"form-row\">\r\n <button type=\"button\" mat-flat-button color=\"primary\" (click)=\"addFacet()\">\r\n <mat-icon>add_circle</mat-icon> facet\r\n </button>\r\n <button type=\"button\" mat-flat-button (click)=\"validate()\">\r\n <mat-icon>fact_check</mat-icon> validate\r\n </button>\r\n <button type=\"button\" mat-flat-button (click)=\"downloadFacets()\">\r\n <mat-icon>download</mat-icon> download\r\n </button>\r\n <button type=\"button\" mat-flat-button color=\"warn\" (click)=\"save()\">\r\n <mat-icon>save</mat-icon> save\r\n </button>\r\n </div>\r\n <div>\r\n @if (busy()) {\r\n <mat-progress-bar mode=\"indeterminate\" color=\"accent\" />\r\n }\r\n </div>\r\n @if (validationResult(); as vr) {\r\n <mat-expansion-panel [expanded]=\"true\">\r\n <mat-expansion-panel-header>\r\n <mat-panel-title>Validation result</mat-panel-title>\r\n <mat-panel-description\r\n [style.color]=\"validationResultHasIssues() ? 'warn' : 'primary'\"\r\n >\r\n {{ vr.issues.length }} result{{ vr.issues.length !== 1 ? \"s\" : \"\" }}\r\n </mat-panel-description>\r\n </mat-expansion-panel-header>\r\n <div class=\"validation-result\">\r\n @if (!vr.issues.length) {\r\n <span>No issues found.</span>\r\n } @else {\r\n <div class=\"validation-issues\">\r\n @for (issue of vr.issues; track $index) {\r\n <div class=\"validation-issue {{ issue.severity }}\">\r\n <mat-icon>{{\r\n issue.severity === \"error\"\r\n ? \"error\"\r\n : issue.severity === \"warning\"\r\n ? \"warning\"\r\n : \"info\"\r\n }}</mat-icon>\r\n <span>{{ issue.message }}</span>\r\n </div>\r\n }\r\n </div>\r\n }\r\n </div>\r\n </mat-expansion-panel>\r\n }\r\n @if (reloadNeeded()) {\r\n <div class=\"reload-notice\">\r\n <mat-icon>info</mat-icon>\r\n <span\r\n >Facet definitions are cached at startup. Please reload the app to apply\r\n the changes.</span\r\n >\r\n <button\r\n type=\"button\"\r\n mat-flat-button\r\n color=\"primary\"\r\n (click)=\"reloadApp()\"\r\n >\r\n <mat-icon>refresh</mat-icon>\r\n reload app\r\n </button>\r\n </div>\r\n }\r\n @if (facets().length) {\r\n <table class=\"margin-top\">\r\n <thead>\r\n <tr>\r\n <th></th>\r\n <th>ID</th>\r\n <th>label</th>\r\n <th>color</th>\r\n <th>parts</th>\r\n <th>description</th>\r\n </tr>\r\n </thead>\r\n <tbody>\r\n @for (\r\n entry of facets();\r\n track entry;\r\n let i = $index;\r\n let first = $first;\r\n let last = $last\r\n ) {\r\n <tr [class.selected]=\"i === editedIndex()\">\r\n <td class=\"fit-width\">\r\n <button\r\n type=\"button\"\r\n mat-icon-button\r\n color=\"primary\"\r\n matTooltip=\"Edit this facet\"\r\n (click)=\"editFacet(entry, i)\"\r\n >\r\n <mat-icon class=\"mat-primary\">edit</mat-icon>\r\n </button>\r\n <button\r\n type=\"button\"\r\n mat-icon-button\r\n matTooltip=\"Move this facet up\"\r\n [disabled]=\"first\"\r\n (click)=\"moveFacetUp(i)\"\r\n >\r\n <mat-icon>arrow_upward</mat-icon>\r\n </button>\r\n <button\r\n type=\"button\"\r\n mat-icon-button\r\n matTooltip=\"Move this facet down\"\r\n [disabled]=\"last\"\r\n (click)=\"moveFacetDown(i)\"\r\n >\r\n <mat-icon>arrow_downward</mat-icon>\r\n </button>\r\n <button\r\n type=\"button\"\r\n mat-icon-button\r\n color=\"warn\"\r\n matTooltip=\"Delete this facet\"\r\n (click)=\"deleteFacet(i)\"\r\n >\r\n <mat-icon class=\"mat-warn\">remove_circle</mat-icon>\r\n </button>\r\n </td>\r\n <td>{{ entry.id }}</td>\r\n <td>{{ entry.label }}</td>\r\n <td>\r\n <span\r\n class=\"color-swatch\"\r\n [style.background-color]=\"'#' + entry.colorKey\"\r\n [style.color]=\"'#' + entry.colorKey | colorToContrast\"\r\n >\r\n {{ entry.colorKey }}\r\n </span>\r\n </td>\r\n <td>{{ entry.partDefinitions.length }}</td>\r\n <td>{{ entry.description | ellipsis: 50 }}</td>\r\n </tr>\r\n }\r\n </tbody>\r\n </table>\r\n }\r\n @if (edited()) {\r\n <fieldset>\r\n <mat-expansion-panel [expanded]=\"edited()\" [disabled]=\"!edited()\">\r\n <mat-expansion-panel-header>\r\n <mat-panel-title>Facet #{{ editedIndex() + 1 }}</mat-panel-title>\r\n </mat-expansion-panel-header>\r\n <cadmus-facet-definition-editor\r\n [facetModelSettings]=\"facetModelSettings()\"\r\n [definition]=\"edited()\"\r\n (definitionChange)=\"saveFacet($event!)\"\r\n (cancelEdit)=\"closeFacet()\"\r\n />\r\n </mat-expansion-panel>\r\n </fieldset>\r\n }\r\n</div>\r\n","import { ChangeDetectionStrategy, Component, signal } from '@angular/core';\n\nimport {\n MatCard,\n MatCardContent,\n MatCardHeader,\n MatCardTitle,\n} from '@angular/material/card';\nimport { MatIcon } from '@angular/material/icon';\n\nimport { ComponentCanDeactivate } from '@myrmidon/cadmus-core';\n\nimport { FacetDefinitionListEditorComponent } from '../facet-definition-list-editor/facet-definition-list-editor.component';\n\n@Component({\n selector: 'cadmus-facet-edit-page',\n imports: [\n MatCard,\n MatCardContent,\n MatCardHeader,\n MatCardTitle,\n MatIcon,\n FacetDefinitionListEditorComponent,\n ],\n templateUrl: './facet-edit-page.component.html',\n styleUrl: './facet-edit-page.component.css',\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class FacetEditPageComponent implements ComponentCanDeactivate {\n private readonly _dirty = signal<boolean>(false);\n\n public canDeactivate(): boolean {\n return !this._dirty();\n }\n\n public onDirtyChange(dirty: boolean): void {\n this._dirty.set(dirty);\n }\n}\n","<mat-card>\r\n <mat-card-header>\r\n <mat-icon mat-card-avatar>dashboard</mat-icon>\r\n <mat-card-title>Edit Facets</mat-card-title>\r\n </mat-card-header>\r\n <mat-card-content>\r\n <div class=\"margin-top\">\r\n <cadmus-facet-definition-list-editor (dirtyChange)=\"onDirtyChange($event)\" />\r\n </div>\r\n </mat-card-content>\r\n</mat-card>\r\n","import { Routes } from '@angular/router';\n\nimport { pendingChangesGuard } from '@myrmidon/cadmus-core';\n\nimport { FacetEditPageComponent } from './components/facet-edit-page/facet-edit-page.component';\n\nexport const CADMUS_PROFILE_EDIT_ROUTES: Routes = [\n {\n path: 'facets',\n pathMatch: 'full',\n component: FacetEditPageComponent,\n canDeactivate: [pendingChangesGuard],\n },\n];\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AA2CA,IAAa,kCAAb,MAAa,gCAA+B;CACtB;CAApB,YAAoB,mBAAmC;EAAnC,KAAA,oBAAA;CAAsC;CAElD,YAAY,QAA8B;EAChD,OAAO;GACL;GACA,WAAW,OAAO,MAAM,MAAM,EAAE,aAAa,OAAO;GACpD,aAAa,OAAO,MAAM,MAAM,EAAE,aAAa,SAAS;GACxD,UAAU,OAAO,MAAM,MAAM,EAAE,aAAa,MAAM;EACnD;CACH;CAEQ,cACN,QACA,aACA,SACA,MAAyB;EAEzB,KAAK,MAAM,CAAC,QAAQ,UAAU,OAAO,QAAQ,OAAO,GAClD,KAAK,MAAM,SAAS,MAAM,eAAe,CAAA,GAAI;GAC3C,MAAM,WAAW,MAAM,WAAW,GAAG;GACrC,MAAM,SAAS,WAAW,MAAM,UAAU,CAAC,IAAI;GAC/C,IAAI,CAAC,YAAY,IAAI,MAAM,GAAG;IAC5B,IAAI,UACF,OAAO,KAAK;KACV,UAAU;KACV,SAAS,GAAG,KAAI,IAAK,OAAM,wBAAyB,OAAM;IAC3D,CAAA;SAED,OAAO,KAAK;KACV,UAAU;KACV,SAAS,GAAG,KAAI,IAAK,OAAM,6BAA8B,OAAM;IAChE,CAAA;GAEL;EACF;CAEJ;CASO,SACL,QACA,oBAAuC;EAEvC,MAAM,SAAiC,CAAA;EAEvC,MAAM,0BAAU,IAAI,IAAG;EACvB,MAAM,6BAAa,IAAI,IAAG;EAC1B,MAAM,6BAAa,IAAI,IAAG;EAC1B,MAAM,mCAAmB,IAAI,IAAG;EAEhC,KAAK,MAAM,SAAS,QAAQ;GAC1B,MAAM,QAAQ,UAAU,MAAM,GAAE;GAGhC,IAAI,CAAC,MAA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,MACb;IAAY,UAAA;GAAA;GAAA;IAAA,MAAA;IAAA,MACZ;IAAO,UAAA;IAAA,QAAA;KAAA;KAAA;KAAA;KAAA;KAAA;IAAA;IAAA,UAAA,CAAA,SAAA;GAAA;GAAA;IAAA,MAAA;IAAA,MACP;IAAkC,UAAA;IAAA,SAAA,CAAA,eAAA,aAAA;GAAA;EAAA;EAAA,iBAAA,GAAA,wBAAA;CAAA,CAAA;;AAMzB,GAAA,yBAAA;CAAA,YAAA;CAAA,SAAA;CAAA,UAAA;CAAA,MAAA;CAAsB,YAAA,CAAA;EAdlC,MAAA;EACW,MAAA,CAAA;GAAA,UAAA;GAAwB,SACzB;IACP;IACA;IACA;IACA;IACA;IACA;GACD;GAAA,iBAGgB,wBAAwB;GAAM,UAAA;GAAA,QAAA,CAAA,gCAAA;EAAA,CAAA;;;AEpBjD,MAAa,6BAAqC,CAChD;CACE,MAAM;CACN,WAAW;CACX,WAAW;CACX,eAAe,CAAC,mBAAmB;AACpC,CACF"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
{
|
|
2
|
-
"name": "@myrmidon/cadmus-profile-editor",
|
|
3
|
-
"version": "20.0.0",
|
|
4
2
|
"description": "Cadmus - profile editor components.",
|
|
5
3
|
"keywords": [
|
|
6
4
|
"Cadmus"
|
|
@@ -19,20 +17,21 @@
|
|
|
19
17
|
"@myrmidon/cadmus-api": "^20.0.0",
|
|
20
18
|
"@myrmidon/cadmus-core": "^20.0.0"
|
|
21
19
|
},
|
|
22
|
-
"dependencies": {
|
|
23
|
-
"tslib": "^2.3.0"
|
|
24
|
-
},
|
|
25
20
|
"sideEffects": false,
|
|
26
|
-
"
|
|
27
|
-
"
|
|
21
|
+
"name": "@myrmidon/cadmus-profile-editor",
|
|
22
|
+
"type": "module",
|
|
23
|
+
"main": "./fesm2022/myrmidon-cadmus-profile-editor.mjs",
|
|
24
|
+
"module": "./fesm2022/myrmidon-cadmus-profile-editor.mjs",
|
|
25
|
+
"typings": "./types/myrmidon-cadmus-profile-editor.d.ts",
|
|
26
|
+
"types": "./types/myrmidon-cadmus-profile-editor.d.ts",
|
|
28
27
|
"exports": {
|
|
29
|
-
"./package.json": {
|
|
30
|
-
"default": "./package.json"
|
|
31
|
-
},
|
|
32
28
|
".": {
|
|
33
29
|
"types": "./types/myrmidon-cadmus-profile-editor.d.ts",
|
|
34
30
|
"default": "./fesm2022/myrmidon-cadmus-profile-editor.mjs"
|
|
31
|
+
},
|
|
32
|
+
"./package.json": {
|
|
33
|
+
"default": "./package.json"
|
|
35
34
|
}
|
|
36
35
|
},
|
|
37
|
-
"
|
|
38
|
-
}
|
|
36
|
+
"version": "20.0.1"
|
|
37
|
+
}
|
|
@@ -329,4 +329,5 @@ export declare class FacetEditPageComponent implements ComponentCanDeactivate {
|
|
|
329
329
|
static ɵfac: i0.ɵɵFactoryDeclaration<FacetEditPageComponent, never>;
|
|
330
330
|
static ɵcmp: i0.ɵɵComponentDeclaration<FacetEditPageComponent, "cadmus-facet-edit-page", never, {}, {}, never, never, true, never>;
|
|
331
331
|
}
|
|
332
|
-
export declare const CADMUS_PROFILE_EDIT_ROUTES: Routes;
|
|
332
|
+
export declare const CADMUS_PROFILE_EDIT_ROUTES: Routes;
|
|
333
|
+
export {};
|