ngx-t-forms 2.0.30 → 2.0.31
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/fesm2022/ngx-t-forms-auto-complete-input-element.component-DCKuXHAW.mjs +104 -0
- package/fesm2022/ngx-t-forms-auto-complete-input-element.component-DCKuXHAW.mjs.map +1 -0
- package/fesm2022/ngx-t-forms-basic-input-input-element.component-Ce4ipSUc.mjs +85 -0
- package/fesm2022/ngx-t-forms-basic-input-input-element.component-Ce4ipSUc.mjs.map +1 -0
- package/fesm2022/ngx-t-forms-calculated-field-rules.component-C5TPddVe.mjs +643 -0
- package/fesm2022/ngx-t-forms-calculated-field-rules.component-C5TPddVe.mjs.map +1 -0
- package/fesm2022/ngx-t-forms-chip-options-creator-editor.component-CICQaqz6.mjs +97 -0
- package/fesm2022/ngx-t-forms-chip-options-creator-editor.component-CICQaqz6.mjs.map +1 -0
- package/fesm2022/ngx-t-forms-config-mscoa-additional-inputs.component-CzisLSIP.mjs +195 -0
- package/fesm2022/ngx-t-forms-config-mscoa-additional-inputs.component-CzisLSIP.mjs.map +1 -0
- package/fesm2022/ngx-t-forms-data-source-picker.component-Dzz_o6fJ.mjs +261 -0
- package/fesm2022/ngx-t-forms-data-source-picker.component-Dzz_o6fJ.mjs.map +1 -0
- package/fesm2022/ngx-t-forms-date-picker-input-element.component-CYUbVyzP.mjs +85 -0
- package/fesm2022/ngx-t-forms-date-picker-input-element.component-CYUbVyzP.mjs.map +1 -0
- package/fesm2022/ngx-t-forms-date-range-picker-input-element.component-CmoquQGV.mjs +156 -0
- package/fesm2022/ngx-t-forms-date-range-picker-input-element.component-CmoquQGV.mjs.map +1 -0
- package/fesm2022/ngx-t-forms-document-list-label-config-editor.component-CLUOXreG.mjs +368 -0
- package/fesm2022/ngx-t-forms-document-list-label-config-editor.component-CLUOXreG.mjs.map +1 -0
- package/fesm2022/ngx-t-forms-document-picker.component-qObjcqhE.mjs +704 -0
- package/fesm2022/ngx-t-forms-document-picker.component-qObjcqhE.mjs.map +1 -0
- package/fesm2022/ngx-t-forms-editor-input-element.component-BLXlfb6F.mjs +294 -0
- package/fesm2022/ngx-t-forms-editor-input-element.component-BLXlfb6F.mjs.map +1 -0
- package/fesm2022/ngx-t-forms-editor-js-input.component-BQL0AH7H.mjs +240 -0
- package/fesm2022/ngx-t-forms-editor-js-input.component-BQL0AH7H.mjs.map +1 -0
- package/fesm2022/ngx-t-forms-file-upload-input-element.component-C7mMeEjF.mjs +205 -0
- package/fesm2022/ngx-t-forms-file-upload-input-element.component-C7mMeEjF.mjs.map +1 -0
- package/fesm2022/ngx-t-forms-form-input-selector.component-C9u8zq9B.mjs +86 -0
- package/fesm2022/ngx-t-forms-form-input-selector.component-C9u8zq9B.mjs.map +1 -0
- package/fesm2022/ngx-t-forms-form-json-view.component-856Hx1Bg.mjs +22 -0
- package/fesm2022/ngx-t-forms-form-json-view.component-856Hx1Bg.mjs.map +1 -0
- package/fesm2022/ngx-t-forms-form-payload-projection.component-CDkTuX9S.mjs +179 -0
- package/fesm2022/ngx-t-forms-form-payload-projection.component-CDkTuX9S.mjs.map +1 -0
- package/fesm2022/ngx-t-forms-form-section-stepper.component-Bs50-nEB.mjs +319 -0
- package/fesm2022/ngx-t-forms-form-section-stepper.component-Bs50-nEB.mjs.map +1 -0
- package/fesm2022/ngx-t-forms-forms-builder-menu.component-qrhM0jGL.mjs +379 -0
- package/fesm2022/ngx-t-forms-forms-builder-menu.component-qrhM0jGL.mjs.map +1 -0
- package/fesm2022/ngx-t-forms-geo-location.component-Bosp1UzR.mjs +124 -0
- package/fesm2022/ngx-t-forms-geo-location.component-Bosp1UzR.mjs.map +1 -0
- package/fesm2022/ngx-t-forms-getInputIcon-B4ADgevZ.mjs +31 -0
- package/fesm2022/ngx-t-forms-getInputIcon-B4ADgevZ.mjs.map +1 -0
- package/fesm2022/ngx-t-forms-image-capture-input-element.component-C1g7Z0cK.mjs +180 -0
- package/fesm2022/ngx-t-forms-image-capture-input-element.component-C1g7Z0cK.mjs.map +1 -0
- package/fesm2022/ngx-t-forms-index-dDSobs6A.mjs +2 -0
- package/fesm2022/ngx-t-forms-index-dDSobs6A.mjs.map +1 -0
- package/fesm2022/ngx-t-forms-input-custom.component-BkbHFAyR.mjs +105 -0
- package/fesm2022/ngx-t-forms-input-custom.component-BkbHFAyR.mjs.map +1 -0
- package/fesm2022/ngx-t-forms-input-editor.component-BPUOM9kQ.mjs +181 -0
- package/fesm2022/ngx-t-forms-input-editor.component-BPUOM9kQ.mjs.map +1 -0
- package/fesm2022/{ngx-t-forms-map-mat-options-keys-SM5XM9uy.mjs → ngx-t-forms-map-mat-options-keys-B6hJ7Io5.mjs} +12 -14
- package/fesm2022/ngx-t-forms-map-mat-options-keys-B6hJ7Io5.mjs.map +1 -0
- package/fesm2022/ngx-t-forms-mat-chip-list-editor.component-c7uZT1sr.mjs +66 -0
- package/fesm2022/ngx-t-forms-mat-chip-list-editor.component-c7uZT1sr.mjs.map +1 -0
- package/fesm2022/ngx-t-forms-mat-slider-editor.component-CTSBrM-j.mjs +211 -0
- package/fesm2022/ngx-t-forms-mat-slider-editor.component-CTSBrM-j.mjs.map +1 -0
- package/fesm2022/ngx-t-forms-mat-slider-toggle-editor.component-CcYiwx-8.mjs +165 -0
- package/fesm2022/ngx-t-forms-mat-slider-toggle-editor.component-CcYiwx-8.mjs.map +1 -0
- package/fesm2022/ngx-t-forms-missing-form-configs.component-DrnH8qdG.mjs +38 -0
- package/fesm2022/ngx-t-forms-missing-form-configs.component-DrnH8qdG.mjs.map +1 -0
- package/fesm2022/ngx-t-forms-mscoa-chart-toolbar.component-C_abEBQ5.mjs +38 -0
- package/fesm2022/ngx-t-forms-mscoa-chart-toolbar.component-C_abEBQ5.mjs.map +1 -0
- package/fesm2022/ngx-t-forms-mscoa-error-display.component-99DpVSy7.mjs +126 -0
- package/fesm2022/ngx-t-forms-mscoa-error-display.component-99DpVSy7.mjs.map +1 -0
- package/fesm2022/ngx-t-forms-mscoa-segment-config.component-C0qsMfsq.mjs +336 -0
- package/fesm2022/ngx-t-forms-mscoa-segment-config.component-C0qsMfsq.mjs.map +1 -0
- package/fesm2022/ngx-t-forms-mscoa-temporary-hint.component-B1Z-IXSL.mjs +74 -0
- package/fesm2022/ngx-t-forms-mscoa-temporary-hint.component-B1Z-IXSL.mjs.map +1 -0
- package/fesm2022/ngx-t-forms-multiple-input-input-element.component-C7y1OGPx.mjs +905 -0
- package/fesm2022/ngx-t-forms-multiple-input-input-element.component-C7y1OGPx.mjs.map +1 -0
- package/fesm2022/ngx-t-forms-ngx-t-forms-u_kigDid.mjs +19461 -0
- package/fesm2022/ngx-t-forms-ngx-t-forms-u_kigDid.mjs.map +1 -0
- package/fesm2022/ngx-t-forms-paginated-selection-table-AQZSMmhr.mjs +555 -0
- package/fesm2022/ngx-t-forms-paginated-selection-table-AQZSMmhr.mjs.map +1 -0
- package/fesm2022/ngx-t-forms-pipeline-generator.component-DmNSc5aw.mjs +748 -0
- package/fesm2022/ngx-t-forms-pipeline-generator.component-DmNSc5aw.mjs.map +1 -0
- package/fesm2022/ngx-t-forms-record-list-manager.component-CUMMvMch.mjs +358 -0
- package/fesm2022/ngx-t-forms-record-list-manager.component-CUMMvMch.mjs.map +1 -0
- package/fesm2022/ngx-t-forms-required-inputs.component-Ch2yNcIS.mjs +272 -0
- package/fesm2022/ngx-t-forms-required-inputs.component-Ch2yNcIS.mjs.map +1 -0
- package/fesm2022/ngx-t-forms-rest-api-call-setup.component-C_aFtdvW.mjs +398 -0
- package/fesm2022/ngx-t-forms-rest-api-call-setup.component-C_aFtdvW.mjs.map +1 -0
- package/fesm2022/ngx-t-forms-search-field.component-B2ZO7lqO.mjs +38 -0
- package/fesm2022/ngx-t-forms-search-field.component-B2ZO7lqO.mjs.map +1 -0
- package/fesm2022/ngx-t-forms-section-report.component-BxOhR6C0.mjs +98 -0
- package/fesm2022/ngx-t-forms-section-report.component-BxOhR6C0.mjs.map +1 -0
- package/fesm2022/ngx-t-forms-select-input-element.component-DbgZdNoe.mjs +150 -0
- package/fesm2022/ngx-t-forms-select-input-element.component-DbgZdNoe.mjs.map +1 -0
- package/fesm2022/ngx-t-forms-selection-options-editor.component-Dhln81DL.mjs +169 -0
- package/fesm2022/ngx-t-forms-selection-options-editor.component-Dhln81DL.mjs.map +1 -0
- package/fesm2022/ngx-t-forms-t-workflow-picker.component-leBokXvM.mjs +204 -0
- package/fesm2022/ngx-t-forms-t-workflow-picker.component-leBokXvM.mjs.map +1 -0
- package/fesm2022/ngx-t-forms-textarea-input-element.component-BEbXJjFA.mjs +95 -0
- package/fesm2022/ngx-t-forms-textarea-input-element.component-BEbXJjFA.mjs.map +1 -0
- package/fesm2022/ngx-t-forms-toggle-input-element.component-DDErRUJd.mjs +82 -0
- package/fesm2022/ngx-t-forms-toggle-input-element.component-DDErRUJd.mjs.map +1 -0
- package/fesm2022/ngx-t-forms-validators-config.component-oGjQVGE2.mjs +733 -0
- package/fesm2022/ngx-t-forms-validators-config.component-oGjQVGE2.mjs.map +1 -0
- package/fesm2022/ngx-t-forms-workflow-adjudication.component-CtU8dECN.mjs +1303 -0
- package/fesm2022/ngx-t-forms-workflow-adjudication.component-CtU8dECN.mjs.map +1 -0
- package/fesm2022/ngx-t-forms.mjs +2 -1
- package/fesm2022/ngx-t-forms.mjs.map +1 -1
- package/package.json +20 -18
- package/styles/_editor-mixins.scss +62 -0
- package/styles/_json-editor-syntax.scss +26 -0
- package/styles/_signature-pad.scss +26 -0
- package/styles/_tokens.scss +148 -0
- package/types/ngx-t-forms.d.ts +1747 -746
- package/fesm2022/ngx-t-forms-calculated-field-rules.component-Ct6_c_Lj.mjs +0 -313
- package/fesm2022/ngx-t-forms-calculated-field-rules.component-Ct6_c_Lj.mjs.map +0 -1
- package/fesm2022/ngx-t-forms-chip-options-creator-editor.component-yuM1KHho.mjs +0 -191
- package/fesm2022/ngx-t-forms-chip-options-creator-editor.component-yuM1KHho.mjs.map +0 -1
- package/fesm2022/ngx-t-forms-config-mscoa-additional-inputs.component-BptpYSe-.mjs +0 -207
- package/fesm2022/ngx-t-forms-config-mscoa-additional-inputs.component-BptpYSe-.mjs.map +0 -1
- package/fesm2022/ngx-t-forms-data-source-picker.component-Badna1Rl.mjs +0 -204
- package/fesm2022/ngx-t-forms-data-source-picker.component-Badna1Rl.mjs.map +0 -1
- package/fesm2022/ngx-t-forms-document-list-label-config-editor.component-2_8XzUgD.mjs +0 -289
- package/fesm2022/ngx-t-forms-document-list-label-config-editor.component-2_8XzUgD.mjs.map +0 -1
- package/fesm2022/ngx-t-forms-form-input-selector.component-DV4Sts9F.mjs +0 -134
- package/fesm2022/ngx-t-forms-form-input-selector.component-DV4Sts9F.mjs.map +0 -1
- package/fesm2022/ngx-t-forms-form-json-view.component-B8seYzMQ.mjs +0 -22
- package/fesm2022/ngx-t-forms-form-json-view.component-B8seYzMQ.mjs.map +0 -1
- package/fesm2022/ngx-t-forms-form-section-stepper.component-x_83iAWA.mjs +0 -281
- package/fesm2022/ngx-t-forms-form-section-stepper.component-x_83iAWA.mjs.map +0 -1
- package/fesm2022/ngx-t-forms-forms-builder-menu.component-UWo_dyVt.mjs +0 -345
- package/fesm2022/ngx-t-forms-forms-builder-menu.component-UWo_dyVt.mjs.map +0 -1
- package/fesm2022/ngx-t-forms-input-editor.component-B_kkOoEO.mjs +0 -147
- package/fesm2022/ngx-t-forms-input-editor.component-B_kkOoEO.mjs.map +0 -1
- package/fesm2022/ngx-t-forms-map-mat-options-keys-SM5XM9uy.mjs.map +0 -1
- package/fesm2022/ngx-t-forms-mat-chip-list-editor.component-C41AL9Et.mjs +0 -105
- package/fesm2022/ngx-t-forms-mat-chip-list-editor.component-C41AL9Et.mjs.map +0 -1
- package/fesm2022/ngx-t-forms-mat-slider-editor.component-BWe8U-sI.mjs +0 -109
- package/fesm2022/ngx-t-forms-mat-slider-editor.component-BWe8U-sI.mjs.map +0 -1
- package/fesm2022/ngx-t-forms-mat-slider-toggle-editor.component-B_XlkHuK.mjs +0 -155
- package/fesm2022/ngx-t-forms-mat-slider-toggle-editor.component-B_XlkHuK.mjs.map +0 -1
- package/fesm2022/ngx-t-forms-missing-form-configs.component-DPNNyKkt.mjs +0 -28
- package/fesm2022/ngx-t-forms-missing-form-configs.component-DPNNyKkt.mjs.map +0 -1
- package/fesm2022/ngx-t-forms-mscoa-chart-toolbar.component-DY1QnG08.mjs +0 -43
- package/fesm2022/ngx-t-forms-mscoa-chart-toolbar.component-DY1QnG08.mjs.map +0 -1
- package/fesm2022/ngx-t-forms-mscoa-error-display.component-CRc_4l3l.mjs +0 -116
- package/fesm2022/ngx-t-forms-mscoa-error-display.component-CRc_4l3l.mjs.map +0 -1
- package/fesm2022/ngx-t-forms-mscoa-segment-config.component-Ckr_nuZF.mjs +0 -296
- package/fesm2022/ngx-t-forms-mscoa-segment-config.component-Ckr_nuZF.mjs.map +0 -1
- package/fesm2022/ngx-t-forms-mscoa-temporary-hint.component-GYxT-56Y.mjs +0 -83
- package/fesm2022/ngx-t-forms-mscoa-temporary-hint.component-GYxT-56Y.mjs.map +0 -1
- package/fesm2022/ngx-t-forms-ngx-t-forms-DP2koSL5.mjs +0 -17401
- package/fesm2022/ngx-t-forms-ngx-t-forms-DP2koSL5.mjs.map +0 -1
- package/fesm2022/ngx-t-forms-pipeline-generator.component-BxHetD_Q.mjs +0 -613
- package/fesm2022/ngx-t-forms-pipeline-generator.component-BxHetD_Q.mjs.map +0 -1
- package/fesm2022/ngx-t-forms-record-list-manager.component-BQuMkoXo.mjs +0 -269
- package/fesm2022/ngx-t-forms-record-list-manager.component-BQuMkoXo.mjs.map +0 -1
- package/fesm2022/ngx-t-forms-required-inputs.component-CLyq9dIR.mjs +0 -190
- package/fesm2022/ngx-t-forms-required-inputs.component-CLyq9dIR.mjs.map +0 -1
- package/fesm2022/ngx-t-forms-rest-api-call-setup.component-CWeIUKLz.mjs +0 -291
- package/fesm2022/ngx-t-forms-rest-api-call-setup.component-CWeIUKLz.mjs.map +0 -1
- package/fesm2022/ngx-t-forms-section-report.component-BtaF39WD.mjs +0 -156
- package/fesm2022/ngx-t-forms-section-report.component-BtaF39WD.mjs.map +0 -1
- package/fesm2022/ngx-t-forms-selection-options-editor.component-B4cEGWrK.mjs +0 -186
- package/fesm2022/ngx-t-forms-selection-options-editor.component-B4cEGWrK.mjs.map +0 -1
- package/fesm2022/ngx-t-forms-t-workflow-picker.component-BkVN4Wdk.mjs +0 -187
- package/fesm2022/ngx-t-forms-t-workflow-picker.component-BkVN4Wdk.mjs.map +0 -1
- package/fesm2022/ngx-t-forms-validators-config.component-Cq07Er-G.mjs +0 -215
- package/fesm2022/ngx-t-forms-validators-config.component-Cq07Er-G.mjs.map +0 -1
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { input, inject, computed, ChangeDetectionStrategy, Component } from '@angular/core';
|
|
3
|
+
import * as i1 from '@angular/material/chips';
|
|
4
|
+
import { MatChipsModule } from '@angular/material/chips';
|
|
5
|
+
import * as i3 from '@angular/material/icon';
|
|
6
|
+
import { MatIconModule } from '@angular/material/icon';
|
|
7
|
+
import * as i10 from '@angular/material/sort';
|
|
8
|
+
import { MatSortModule } from '@angular/material/sort';
|
|
9
|
+
import * as i5 from '@angular/material/table';
|
|
10
|
+
import { MatTableModule } from '@angular/material/table';
|
|
11
|
+
import * as i5$1 from '@angular/material/toolbar';
|
|
12
|
+
import { MatToolbarModule } from '@angular/material/toolbar';
|
|
13
|
+
import { F as FormsStoreService } from './ngx-t-forms-ngx-t-forms-u_kigDid.mjs';
|
|
14
|
+
import { ElementTypes, validateFormSlide } from 'ngx-t-forms-types';
|
|
15
|
+
|
|
16
|
+
class SectionReportComponent {
|
|
17
|
+
constructor() {
|
|
18
|
+
this.sectionId = input.required(...(ngDevMode ? [{ debugName: "sectionId" }] : /* istanbul ignore next */ []));
|
|
19
|
+
this.displayedColumns = ['icon', 'name', 'description', 'value'];
|
|
20
|
+
this.#store = inject(FormsStoreService);
|
|
21
|
+
this.selectFormInEdit = this.#store.signalSelectors.selectFormInEdit;
|
|
22
|
+
this.section = computed(() => {
|
|
23
|
+
const form = this.selectFormInEdit();
|
|
24
|
+
return (form?.form.slides.find((slide) => slide.sectionId === this.sectionId()) ||
|
|
25
|
+
null);
|
|
26
|
+
}, ...(ngDevMode ? [{ debugName: "section" }] : /* istanbul ignore next */ []));
|
|
27
|
+
this.sectionData = computed(() => this.#buildMetrics(this.section()), ...(ngDevMode ? [{ debugName: "sectionData" }] : /* istanbul ignore next */ []));
|
|
28
|
+
}
|
|
29
|
+
#store;
|
|
30
|
+
#buildMetrics(data) {
|
|
31
|
+
if (!data)
|
|
32
|
+
return [];
|
|
33
|
+
const sectionId = this.sectionId();
|
|
34
|
+
const allInputs = data.columns
|
|
35
|
+
.flatMap((column) => column.element === ElementTypes.MultipleInput
|
|
36
|
+
? [...(column?.formInputs || []), column]
|
|
37
|
+
: [column])
|
|
38
|
+
.filter((input) => input.sectionId === sectionId);
|
|
39
|
+
const calculatedInputs = allInputs.filter((input) => input.calculatedFieldRules?.formula && input.calculatedFieldRules?.formula !== '');
|
|
40
|
+
const inputsWithManualValidations = allInputs.filter((input) => input.validators?.some((validator) => Object.keys(validator).length > 0));
|
|
41
|
+
const allSectionInputConfigErrors = validateFormSlide(data);
|
|
42
|
+
return [
|
|
43
|
+
{
|
|
44
|
+
icon: 'input',
|
|
45
|
+
name: 'Total Inputs',
|
|
46
|
+
value: Object.keys(allInputs || {}).length,
|
|
47
|
+
color: '#2196f3',
|
|
48
|
+
description: 'Total number of form inputs in section',
|
|
49
|
+
trend: 'stable',
|
|
50
|
+
category: 'inputs',
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
icon: 'calculate',
|
|
54
|
+
name: 'Calculated Fields',
|
|
55
|
+
value: calculatedInputs.length,
|
|
56
|
+
details: calculatedInputs,
|
|
57
|
+
color: '#4caf50',
|
|
58
|
+
description: 'Fields with calculation formulas',
|
|
59
|
+
trend: 'monitoring',
|
|
60
|
+
category: 'calculations',
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
icon: 'rule',
|
|
64
|
+
name: 'Manual Validations',
|
|
65
|
+
value: inputsWithManualValidations.length,
|
|
66
|
+
details: inputsWithManualValidations,
|
|
67
|
+
color: '#ff9800',
|
|
68
|
+
description: 'Fields with custom validation rules',
|
|
69
|
+
trend: 'warning',
|
|
70
|
+
category: 'validation',
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
icon: 'bug_report',
|
|
74
|
+
name: 'Config Errors',
|
|
75
|
+
value: allSectionInputConfigErrors.length,
|
|
76
|
+
color: '#f44336',
|
|
77
|
+
description: 'Configuration errors detected',
|
|
78
|
+
trend: 'critical',
|
|
79
|
+
category: 'errors',
|
|
80
|
+
},
|
|
81
|
+
];
|
|
82
|
+
}
|
|
83
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.12", ngImport: i0, type: SectionReportComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
84
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.12", type: SectionReportComponent, isStandalone: true, selector: "lib-section-report", inputs: { sectionId: { classPropertyName: "sectionId", publicName: "sectionId", isSignal: true, isRequired: true, transformFunction: null } }, ngImport: i0, template: "@if (section()) {\r\n <div class=\"report-container\">\r\n <mat-toolbar style=\"padding: 0px;\">\r\n <mat-icon class=\"section-icon\">analytics</mat-icon>\r\n <small>\r\n Form Section Diagnostic Report\r\n </small>\r\n\r\n <span class=\"spacer\"></span>\r\n <div class=\"status-chips\">\r\n <div class=\"status-chip\">\r\n <mat-icon>check_circle</mat-icon>\r\n </div>\r\n @if (section()?.sectionIsSeen) {\r\n <div class=\"status-chip initialized\">\r\n <mat-icon>task_alt</mat-icon>\r\n Initialized\r\n </div>\r\n }\r\n </div>\r\n </mat-toolbar>\r\n\r\n <table mat-table [dataSource]=\"(sectionData()) || []\" matSort class=\"w-full\">\r\n <!-- Icon Column -->\r\n <ng-container matColumnDef=\"icon\">\r\n <th mat-header-cell *matHeaderCellDef></th>\r\n <td mat-cell *matCellDef=\"let row\">\r\n <mat-icon [style.color]=\"row.color\">{{ row.icon }}</mat-icon>\r\n </td>\r\n </ng-container>\r\n\r\n <!-- description Column -->\r\n <ng-container matColumnDef=\"description\">\r\n <th mat-header-cell *matHeaderCellDef mat-sort-header>description</th>\r\n <td mat-cell *matCellDef=\"let row\">{{ row.description }}</td>\r\n </ng-container>\r\n\r\n <!-- Name Column -->\r\n <ng-container matColumnDef=\"name\">\r\n <th mat-header-cell *matHeaderCellDef mat-sort-header>Type</th>\r\n <td mat-cell *matCellDef=\"let row\">{{ row.name }}</td>\r\n </ng-container>\r\n\r\n <!-- Value Column -->\r\n <ng-container matColumnDef=\"value\">\r\n <th mat-header-cell *matHeaderCellDef mat-sort-header>Value</th>\r\n <td mat-cell *matCellDef=\"let row\">{{ row.value }}</td>\r\n </ng-container>\r\n\r\n <!-- Details Column -->\r\n <ng-container matColumnDef=\"details\">\r\n <th mat-header-cell *matHeaderCellDef>Details</th>\r\n <td mat-cell *matCellDef=\"let row\">\r\n @if (row.details?.length) {\r\n <mat-chip-set>\r\n @for (detail of row.details; track $index) {\r\n <mat-chip class=\"detail-chip\">{{ detail }}</mat-chip>\r\n }\r\n </mat-chip-set>\r\n }\r\n </td>\r\n </ng-container>\r\n\r\n <tr mat-header-row *matHeaderRowDef=\"displayedColumns\"></tr>\r\n <tr mat-row *matRowDef=\"let row; columns: displayedColumns;\"></tr>\r\n </table>\r\n </div>\r\n}\r\n", styles: [".report-container{padding:20px;display:flex;flex-direction:column;gap:20px;background:var(--mat-sys-surface-container, var(--mat-app-surface))}.header-card{background:var(--lib-forms-surface)}.title-section{display:flex;align-items:center;gap:12px}.section-icon{color:var(--sem-info);font-size:1.75em;width:28px;height:28px;margin-right:8px}h1{margin:0;font-size:1.25em;font-weight:500}.subtitle{margin:4px 0 0;color:var(--lib-forms-on-surface-variant);font-size:.875em}.status-chips{display:flex;gap:8px;margin-left:auto}.status-chip{display:flex;align-items:center;gap:4px;padding:4px 12px;border-radius:16px;background:var(--sem-success);color:var(--lib-forms-on-primary);font-size:.875em}.status-chip.invalid{background:var(--sem-error)}.status-chip.initialized{background:var(--sem-info)}.status-chip mat-icon{font-size:1.125em;width:18px;height:18px}.filter-field{width:100%;margin-bottom:16px}.detail-chip{font-size:.75em;height:24px}mat-card-content{padding:16px}\n"], dependencies: [{ kind: "ngmodule", type: MatChipsModule }, { kind: "component", type: i1.MatChip, selector: "mat-basic-chip, [mat-basic-chip], mat-chip, [mat-chip]", inputs: ["role", "id", "aria-label", "aria-description", "value", "color", "removable", "highlighted", "disableRipple", "disabled"], outputs: ["removed", "destroyed"], exportAs: ["matChip"] }, { kind: "component", type: i1.MatChipSet, selector: "mat-chip-set", inputs: ["disabled", "role", "tabIndex"] }, { kind: "ngmodule", type: MatIconModule }, { kind: "component", type: i3.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "ngmodule", type: MatSortModule }, { kind: "directive", type: i10.MatSort, selector: "[matSort]", inputs: ["matSortActive", "matSortStart", "matSortDirection", "matSortDisableClear", "matSortDisabled"], outputs: ["matSortChange"], exportAs: ["matSort"] }, { kind: "component", type: i10.MatSortHeader, selector: "[mat-sort-header]", inputs: ["mat-sort-header", "arrowPosition", "start", "disabled", "sortActionDescription", "disableClear"], exportAs: ["matSortHeader"] }, { kind: "ngmodule", type: MatTableModule }, { kind: "component", type: i5.MatTable, selector: "mat-table, table[mat-table]", exportAs: ["matTable"] }, { kind: "directive", type: i5.MatHeaderCellDef, selector: "[matHeaderCellDef]" }, { kind: "directive", type: i5.MatHeaderRowDef, selector: "[matHeaderRowDef]", inputs: ["matHeaderRowDef", "matHeaderRowDefSticky"] }, { kind: "directive", type: i5.MatColumnDef, selector: "[matColumnDef]", inputs: ["matColumnDef"] }, { kind: "directive", type: i5.MatCellDef, selector: "[matCellDef]" }, { kind: "directive", type: i5.MatRowDef, selector: "[matRowDef]", inputs: ["matRowDefColumns", "matRowDefWhen"] }, { kind: "directive", type: i5.MatHeaderCell, selector: "mat-header-cell, th[mat-header-cell]" }, { kind: "directive", type: i5.MatCell, selector: "mat-cell, td[mat-cell]" }, { kind: "component", type: i5.MatHeaderRow, selector: "mat-header-row, tr[mat-header-row]", exportAs: ["matHeaderRow"] }, { kind: "component", type: i5.MatRow, selector: "mat-row, tr[mat-row]", exportAs: ["matRow"] }, { kind: "ngmodule", type: MatToolbarModule }, { kind: "component", type: i5$1.MatToolbar, selector: "mat-toolbar", inputs: ["color"], exportAs: ["matToolbar"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
85
|
+
}
|
|
86
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.12", ngImport: i0, type: SectionReportComponent, decorators: [{
|
|
87
|
+
type: Component,
|
|
88
|
+
args: [{ selector: 'lib-section-report', imports: [
|
|
89
|
+
MatChipsModule,
|
|
90
|
+
MatIconModule,
|
|
91
|
+
MatSortModule,
|
|
92
|
+
MatTableModule,
|
|
93
|
+
MatToolbarModule,
|
|
94
|
+
], changeDetection: ChangeDetectionStrategy.OnPush, template: "@if (section()) {\r\n <div class=\"report-container\">\r\n <mat-toolbar style=\"padding: 0px;\">\r\n <mat-icon class=\"section-icon\">analytics</mat-icon>\r\n <small>\r\n Form Section Diagnostic Report\r\n </small>\r\n\r\n <span class=\"spacer\"></span>\r\n <div class=\"status-chips\">\r\n <div class=\"status-chip\">\r\n <mat-icon>check_circle</mat-icon>\r\n </div>\r\n @if (section()?.sectionIsSeen) {\r\n <div class=\"status-chip initialized\">\r\n <mat-icon>task_alt</mat-icon>\r\n Initialized\r\n </div>\r\n }\r\n </div>\r\n </mat-toolbar>\r\n\r\n <table mat-table [dataSource]=\"(sectionData()) || []\" matSort class=\"w-full\">\r\n <!-- Icon Column -->\r\n <ng-container matColumnDef=\"icon\">\r\n <th mat-header-cell *matHeaderCellDef></th>\r\n <td mat-cell *matCellDef=\"let row\">\r\n <mat-icon [style.color]=\"row.color\">{{ row.icon }}</mat-icon>\r\n </td>\r\n </ng-container>\r\n\r\n <!-- description Column -->\r\n <ng-container matColumnDef=\"description\">\r\n <th mat-header-cell *matHeaderCellDef mat-sort-header>description</th>\r\n <td mat-cell *matCellDef=\"let row\">{{ row.description }}</td>\r\n </ng-container>\r\n\r\n <!-- Name Column -->\r\n <ng-container matColumnDef=\"name\">\r\n <th mat-header-cell *matHeaderCellDef mat-sort-header>Type</th>\r\n <td mat-cell *matCellDef=\"let row\">{{ row.name }}</td>\r\n </ng-container>\r\n\r\n <!-- Value Column -->\r\n <ng-container matColumnDef=\"value\">\r\n <th mat-header-cell *matHeaderCellDef mat-sort-header>Value</th>\r\n <td mat-cell *matCellDef=\"let row\">{{ row.value }}</td>\r\n </ng-container>\r\n\r\n <!-- Details Column -->\r\n <ng-container matColumnDef=\"details\">\r\n <th mat-header-cell *matHeaderCellDef>Details</th>\r\n <td mat-cell *matCellDef=\"let row\">\r\n @if (row.details?.length) {\r\n <mat-chip-set>\r\n @for (detail of row.details; track $index) {\r\n <mat-chip class=\"detail-chip\">{{ detail }}</mat-chip>\r\n }\r\n </mat-chip-set>\r\n }\r\n </td>\r\n </ng-container>\r\n\r\n <tr mat-header-row *matHeaderRowDef=\"displayedColumns\"></tr>\r\n <tr mat-row *matRowDef=\"let row; columns: displayedColumns;\"></tr>\r\n </table>\r\n </div>\r\n}\r\n", styles: [".report-container{padding:20px;display:flex;flex-direction:column;gap:20px;background:var(--mat-sys-surface-container, var(--mat-app-surface))}.header-card{background:var(--lib-forms-surface)}.title-section{display:flex;align-items:center;gap:12px}.section-icon{color:var(--sem-info);font-size:1.75em;width:28px;height:28px;margin-right:8px}h1{margin:0;font-size:1.25em;font-weight:500}.subtitle{margin:4px 0 0;color:var(--lib-forms-on-surface-variant);font-size:.875em}.status-chips{display:flex;gap:8px;margin-left:auto}.status-chip{display:flex;align-items:center;gap:4px;padding:4px 12px;border-radius:16px;background:var(--sem-success);color:var(--lib-forms-on-primary);font-size:.875em}.status-chip.invalid{background:var(--sem-error)}.status-chip.initialized{background:var(--sem-info)}.status-chip mat-icon{font-size:1.125em;width:18px;height:18px}.filter-field{width:100%;margin-bottom:16px}.detail-chip{font-size:.75em;height:24px}mat-card-content{padding:16px}\n"] }]
|
|
95
|
+
}], propDecorators: { sectionId: [{ type: i0.Input, args: [{ isSignal: true, alias: "sectionId", required: true }] }] } });
|
|
96
|
+
|
|
97
|
+
export { SectionReportComponent };
|
|
98
|
+
//# sourceMappingURL=ngx-t-forms-section-report.component-BxOhR6C0.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ngx-t-forms-section-report.component-BxOhR6C0.mjs","sources":["../../../projects/ngx-t-forms/src/lib/components/form-builder/elements/section-report/section-report.component.ts","../../../projects/ngx-t-forms/src/lib/components/form-builder/elements/section-report/section-report.component.html"],"sourcesContent":["import { ChangeDetectionStrategy, Component, Signal, computed, inject, input } from '@angular/core';\r\n\r\nimport { MatChipsModule } from '@angular/material/chips';\r\nimport { MatIconModule } from '@angular/material/icon';\r\nimport { MatSortModule } from '@angular/material/sort';\r\nimport { MatTableModule } from '@angular/material/table';\r\nimport { MatToolbarModule } from '@angular/material/toolbar';\r\n\r\nimport { FormsStoreService } from '../../../forms/store/forms-store.service';\r\n\r\nimport { ElementTypes, FormSlideInterface, validateFormSlide } from 'ngx-t-forms-types';\r\n\r\ninterface SectionReportMetric {\r\n icon: string;\r\n name: string;\r\n value: number;\r\n color: string;\r\n description: string;\r\n trend: string;\r\n category: string;\r\n details?: unknown[];\r\n}\r\n\r\n@Component({\r\n selector: 'lib-section-report',\r\n imports: [\r\n MatChipsModule,\r\n MatIconModule,\r\n MatSortModule,\r\n MatTableModule,\r\n MatToolbarModule,\r\n ],\r\n templateUrl: './section-report.component.html',\r\n styleUrl: './section-report.component.scss',\r\n changeDetection: ChangeDetectionStrategy.OnPush,\r\n})\r\nexport class SectionReportComponent {\r\n readonly sectionId = input.required<string>();\r\n\r\n protected readonly displayedColumns: readonly string[] = ['icon', 'name', 'description', 'value'];\r\n\r\n readonly #store: FormsStoreService = inject(FormsStoreService);\r\n protected readonly selectFormInEdit = this.#store.signalSelectors.selectFormInEdit;\r\n\r\n protected readonly section: Signal<FormSlideInterface | null> = computed<FormSlideInterface | null>(() => {\r\n const form = this.selectFormInEdit();\r\n return (\r\n form?.form.slides.find((slide: FormSlideInterface) => slide.sectionId === this.sectionId()) ||\r\n null\r\n );\r\n });\r\n\r\n protected readonly sectionData: Signal<SectionReportMetric[]> = computed<SectionReportMetric[]>(\r\n () => this.#buildMetrics(this.section()),\r\n );\r\n\r\n #buildMetrics(data: FormSlideInterface | null): SectionReportMetric[] {\r\n if (!data) return [];\r\n const sectionId = this.sectionId();\r\n const allInputs = data.columns\r\n .flatMap((column) =>\r\n column.element === ElementTypes.MultipleInput\r\n ? [...(column?.formInputs || []), column]\r\n : [column],\r\n )\r\n .filter((input) => input.sectionId === sectionId);\r\n\r\n const calculatedInputs = allInputs.filter(\r\n (input) =>\r\n input.calculatedFieldRules?.formula && input.calculatedFieldRules?.formula !== '',\r\n );\r\n const inputsWithManualValidations = allInputs.filter((input) =>\r\n input.validators?.some((validator) => Object.keys(validator).length > 0),\r\n );\r\n const allSectionInputConfigErrors = validateFormSlide(data);\r\n\r\n return [\r\n {\r\n icon: 'input',\r\n name: 'Total Inputs',\r\n value: Object.keys(allInputs || {}).length,\r\n color: '#2196f3',\r\n description: 'Total number of form inputs in section',\r\n trend: 'stable',\r\n category: 'inputs',\r\n },\r\n {\r\n icon: 'calculate',\r\n name: 'Calculated Fields',\r\n value: calculatedInputs.length,\r\n details: calculatedInputs,\r\n color: '#4caf50',\r\n description: 'Fields with calculation formulas',\r\n trend: 'monitoring',\r\n category: 'calculations',\r\n },\r\n {\r\n icon: 'rule',\r\n name: 'Manual Validations',\r\n value: inputsWithManualValidations.length,\r\n details: inputsWithManualValidations,\r\n color: '#ff9800',\r\n description: 'Fields with custom validation rules',\r\n trend: 'warning',\r\n category: 'validation',\r\n },\r\n {\r\n icon: 'bug_report',\r\n name: 'Config Errors',\r\n value: allSectionInputConfigErrors.length,\r\n color: '#f44336',\r\n description: 'Configuration errors detected',\r\n trend: 'critical',\r\n category: 'errors',\r\n },\r\n ];\r\n }\r\n}\r\n","@if (section()) {\r\n <div class=\"report-container\">\r\n <mat-toolbar style=\"padding: 0px;\">\r\n <mat-icon class=\"section-icon\">analytics</mat-icon>\r\n <small>\r\n Form Section Diagnostic Report\r\n </small>\r\n\r\n <span class=\"spacer\"></span>\r\n <div class=\"status-chips\">\r\n <div class=\"status-chip\">\r\n <mat-icon>check_circle</mat-icon>\r\n </div>\r\n @if (section()?.sectionIsSeen) {\r\n <div class=\"status-chip initialized\">\r\n <mat-icon>task_alt</mat-icon>\r\n Initialized\r\n </div>\r\n }\r\n </div>\r\n </mat-toolbar>\r\n\r\n <table mat-table [dataSource]=\"(sectionData()) || []\" matSort class=\"w-full\">\r\n <!-- Icon Column -->\r\n <ng-container matColumnDef=\"icon\">\r\n <th mat-header-cell *matHeaderCellDef></th>\r\n <td mat-cell *matCellDef=\"let row\">\r\n <mat-icon [style.color]=\"row.color\">{{ row.icon }}</mat-icon>\r\n </td>\r\n </ng-container>\r\n\r\n <!-- description Column -->\r\n <ng-container matColumnDef=\"description\">\r\n <th mat-header-cell *matHeaderCellDef mat-sort-header>description</th>\r\n <td mat-cell *matCellDef=\"let row\">{{ row.description }}</td>\r\n </ng-container>\r\n\r\n <!-- Name Column -->\r\n <ng-container matColumnDef=\"name\">\r\n <th mat-header-cell *matHeaderCellDef mat-sort-header>Type</th>\r\n <td mat-cell *matCellDef=\"let row\">{{ row.name }}</td>\r\n </ng-container>\r\n\r\n <!-- Value Column -->\r\n <ng-container matColumnDef=\"value\">\r\n <th mat-header-cell *matHeaderCellDef mat-sort-header>Value</th>\r\n <td mat-cell *matCellDef=\"let row\">{{ row.value }}</td>\r\n </ng-container>\r\n\r\n <!-- Details Column -->\r\n <ng-container matColumnDef=\"details\">\r\n <th mat-header-cell *matHeaderCellDef>Details</th>\r\n <td mat-cell *matCellDef=\"let row\">\r\n @if (row.details?.length) {\r\n <mat-chip-set>\r\n @for (detail of row.details; track $index) {\r\n <mat-chip class=\"detail-chip\">{{ detail }}</mat-chip>\r\n }\r\n </mat-chip-set>\r\n }\r\n </td>\r\n </ng-container>\r\n\r\n <tr mat-header-row *matHeaderRowDef=\"displayedColumns\"></tr>\r\n <tr mat-row *matRowDef=\"let row; columns: displayedColumns;\"></tr>\r\n </table>\r\n </div>\r\n}\r\n"],"names":["i2","i3","i4","i5"],"mappings":";;;;;;;;;;;;;;;MAoCa,sBAAsB,CAAA;AAbnC,IAAA,WAAA,GAAA;AAcW,QAAA,IAAA,CAAA,SAAS,GAAG,KAAK,CAAC,QAAQ,+EAAU;QAE1B,IAAA,CAAA,gBAAgB,GAAsB,CAAC,MAAM,EAAE,MAAM,EAAE,aAAa,EAAE,OAAO,CAAC;AAExF,QAAA,IAAA,CAAA,MAAM,GAAsB,MAAM,CAAC,iBAAiB,CAAC;QAC3C,IAAA,CAAA,gBAAgB,GAAG,IAAI,CAAC,MAAM,CAAC,eAAe,CAAC,gBAAgB;AAE/D,QAAA,IAAA,CAAA,OAAO,GAAsC,QAAQ,CAA4B,MAAK;AACvG,YAAA,MAAM,IAAI,GAAG,IAAI,CAAC,gBAAgB,EAAE;YACpC,QACE,IAAI,EAAE,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,KAAyB,KAAK,KAAK,CAAC,SAAS,KAAK,IAAI,CAAC,SAAS,EAAE,CAAC;AAC3F,gBAAA,IAAI;AAER,QAAA,CAAC,8EAAC;AAEiB,QAAA,IAAA,CAAA,WAAW,GAAkC,QAAQ,CACtE,MAAM,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC,kFACzC;AA+DF,I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AAAA,EAAA,CAAA,YAAA,EAAA,QAAA,EAAA,oCAAA,EAAA,QAAA,EAAA,CAAA,cAAA,CAAA,EAAA,EAAA,EAAA,IAAA,EAAA,WAAA,EAAA,IAAA,EAAAA,EAAA,CAAA,MAAA,EAAA,QAAA,EAAA,sBAAA,EAAA,QAAA,EAAA,CAAA,QAAA,CAAA,EAAA,EAAA,EAAA,IAAA,EAAA,UAAA,EAAA,IAAA,EACd,gBAAgB,EAAA,EAAA,EAAA,IAAA,EAAA,WAAA,EAAA,IAAA,EAAAC,IAAA,CAAA,UAAA,EAAA,QAAA,EAAA,aAAA,EAAA,MAAA,EAAA,CAAA,OAAA,CAAA,EAAA,QAAA,EAAA,CAAA,YAAA,CAAA,EAAA,CAAA,EAAA,eAAA,EAAA,EAAA,CAAA,uBAAA,CAAA,MAAA,EAAA,CAAA,CAAA;;4FAMP,sBAAsB,EAAA,UAAA,EAAA,CAAA;kBAblC,SAAS;AACE,YAAA,IAAA,EAAA,CAAA,EAAA,QAAA,EAAA,oBAAoB,EAAA,OAAA,EACrB;wBACP,cAAc;wBACd,aAAa;wBACb,aAAa;wBACb,cAAc;wBACd,gBAAgB;qBACjB,EAAA,eAAA,EAGgB,uBAAuB,CAAC,MAAM,EAAA,QAAA,EAAA,2+EAAA,EAAA,MAAA,EAAA,CAAA,+8BAAA,CAAA,EAAA;;;;;"}
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { inject, ElementRef, input, ChangeDetectionStrategy, Component, output, computed } from '@angular/core';
|
|
3
|
+
import * as i1$1 from '@angular/forms';
|
|
4
|
+
import { NgControl, ReactiveFormsModule } from '@angular/forms';
|
|
5
|
+
import * as i2 from '@angular/material/form-field';
|
|
6
|
+
import { MatFormFieldControl, MatFormFieldModule } from '@angular/material/form-field';
|
|
7
|
+
import * as i3$1 from '@angular/material/icon';
|
|
8
|
+
import { MatIconModule } from '@angular/material/icon';
|
|
9
|
+
import * as i1$2 from '@angular/material/button';
|
|
10
|
+
import { MatButtonModule } from '@angular/material/button';
|
|
11
|
+
import * as i5 from '@angular/material/tooltip';
|
|
12
|
+
import { MatTooltipModule } from '@angular/material/tooltip';
|
|
13
|
+
import { B as BaseCustomInput, m as getInputErrorMessage, n as TFormInputStatusComponent } from './ngx-t-forms-ngx-t-forms-u_kigDid.mjs';
|
|
14
|
+
import { Subject } from 'rxjs';
|
|
15
|
+
import * as i8 from '@angular/material/select';
|
|
16
|
+
import { MatSelectModule } from '@angular/material/select';
|
|
17
|
+
import { OptionSelectTypes } from 'ngx-t-forms-types';
|
|
18
|
+
import * as i1 from '@angular/material/chips';
|
|
19
|
+
import { MatChipsModule } from '@angular/material/chips';
|
|
20
|
+
import * as i13 from '@angular/material/radio';
|
|
21
|
+
import { MatRadioModule } from '@angular/material/radio';
|
|
22
|
+
import * as i3 from '@angular/material/checkbox';
|
|
23
|
+
import { MatCheckboxModule } from '@angular/material/checkbox';
|
|
24
|
+
import * as i4 from '@angular/material/list';
|
|
25
|
+
import { MatListModule } from '@angular/material/list';
|
|
26
|
+
import { TitleCasePipe } from '@angular/common';
|
|
27
|
+
|
|
28
|
+
const customInputConfig = {
|
|
29
|
+
controlType: 'lib-select-input',
|
|
30
|
+
nextId: 0,
|
|
31
|
+
};
|
|
32
|
+
class SelectInputComponent extends BaseCustomInput {
|
|
33
|
+
constructor() {
|
|
34
|
+
super(inject(NgControl, { optional: true, self: true }), inject(ElementRef), customInputConfig);
|
|
35
|
+
this.inputConfig = input.required(...(ngDevMode ? [{ debugName: "inputConfig" }] : /* istanbul ignore next */ []));
|
|
36
|
+
this.optionSelectTypes = OptionSelectTypes;
|
|
37
|
+
this.#valueSubject = new Subject();
|
|
38
|
+
}
|
|
39
|
+
get empty() {
|
|
40
|
+
return !this.value;
|
|
41
|
+
}
|
|
42
|
+
get shouldLabelFloat() {
|
|
43
|
+
return true;
|
|
44
|
+
}
|
|
45
|
+
#valueSubject;
|
|
46
|
+
onInputChange($event) {
|
|
47
|
+
this.#valueSubject.next($event);
|
|
48
|
+
}
|
|
49
|
+
onSelectionChange(event) {
|
|
50
|
+
this.value = event.value;
|
|
51
|
+
this.stateChanges.next();
|
|
52
|
+
this.onChange(this.value);
|
|
53
|
+
}
|
|
54
|
+
checkBoxChanged(event, value) {
|
|
55
|
+
const current = Array.isArray(this.value) ? this.value : [];
|
|
56
|
+
if (event.checked) {
|
|
57
|
+
this.value = [...current, value];
|
|
58
|
+
}
|
|
59
|
+
else {
|
|
60
|
+
this.value = current.filter((v) => v !== value);
|
|
61
|
+
}
|
|
62
|
+
this.stateChanges.next();
|
|
63
|
+
this.onChange(this.value);
|
|
64
|
+
}
|
|
65
|
+
isSelected(value) {
|
|
66
|
+
if (!this.value || !Array.isArray(this.value))
|
|
67
|
+
return false;
|
|
68
|
+
return this.value.includes(value);
|
|
69
|
+
}
|
|
70
|
+
// NOTE(phase-4): `matOptions.options` is `(FormInputBasicOptionInterface | DynamicObjectInterface)[]`
|
|
71
|
+
// but templates access `.value`, `.label`, `.username`, `.email` directly. Until the template
|
|
72
|
+
// is split per `optionType`, the return shape stays `any[]` to keep strictTemplates passing.
|
|
73
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- TODO(phase-4): split template per matOptions.optionType, then narrow.
|
|
74
|
+
getSelectOptions() {
|
|
75
|
+
const cfg = this.inputConfig();
|
|
76
|
+
if (!cfg?.matOptions)
|
|
77
|
+
return [];
|
|
78
|
+
if (Array.isArray(cfg.matOptions?.options)) {
|
|
79
|
+
return cfg.matOptions?.options || [];
|
|
80
|
+
}
|
|
81
|
+
return [];
|
|
82
|
+
}
|
|
83
|
+
getAvatar(userName) {
|
|
84
|
+
return `https://ui-avatars.com/api/?color=EADDFF&font-size=0.36&bold=true&background=random&name=${userName}`;
|
|
85
|
+
}
|
|
86
|
+
get inputControl() {
|
|
87
|
+
return this.ngControl?.control ?? null;
|
|
88
|
+
}
|
|
89
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.12", ngImport: i0, type: SelectInputComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
90
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.12", type: SelectInputComponent, isStandalone: true, selector: "lib-select-input", inputs: { inputConfig: { classPropertyName: "inputConfig", publicName: "inputConfig", isSignal: true, isRequired: true, transformFunction: null } }, host: { properties: { "class.floating": "shouldLabelFloat", "id": "id" } }, providers: [{ provide: MatFormFieldControl, useExisting: SelectInputComponent }], usesInheritance: true, ngImport: i0, template: "@switch (inputConfig().optionSelectType) {\r\n@case (optionSelectTypes.ChipSelect) {\r\n<mat-chip-listbox [multiple]=\"!!inputConfig().allowMultipleSelection\" [value]=\"value\" [disabled]=\"disabled\"\r\n (change)=\"onSelectionChange($event)\" aria-l abel=\"Chip select options\">\r\n @for (option of getSelectOptions(); track option.value) {\r\n <mat-chip-option [value]=\"option.value\">{{option.label}}</mat-chip-option>\r\n }\r\n</mat-chip-listbox>\r\n}\r\n@case (optionSelectTypes.RadioButton) {\r\n@if (!!inputConfig().allowMultipleSelection) {\r\n@for (option of getSelectOptions(); track option.value) {\r\n<mat-checkbox\r\n [value]=\"option.value\"\r\n [checked]=\"isSelected(option.value)\"\r\n (change)=\"checkBoxChanged($event, option.value)\" class=\"example-margin\">\r\n {{option.label}}\r\n</mat-checkbox>\r\n}\r\n} @else {\r\n<mat-radio-group aria-labelledby=\"example-radio-group-label\" class=\"example-radio-group\"\r\n (change)=\"onSelectionChange($event)\" [value]=\"value\">\r\n @for (option of getSelectOptions(); track option.value) {\r\n <mat-radio-button class=\"example-radio-button\" [value]=\"option.value\">{{option.label}}</mat-radio-button>\r\n }\r\n</mat-radio-group>\r\n}\r\n\r\n}\r\n@default {\r\n\r\n<mat-select [multiple]=\"!!inputConfig().allowMultipleSelection\" #sele (selectionChange)=\"onSelectionChange($event)\"\r\n [value]=\"value\">\r\n\r\n\r\n\r\n @for (option of getSelectOptions(); track option.value) {\r\n <mat-option [value]=\"option.value\" [disabled]=\"inputConfig().readonly\">\r\n @switch (inputConfig().matOptions?.optionType) {\r\n @case ('user') {\r\n <mat-list-item style=\"padding: 0px;\">\r\n <img matListItemAvatar [src]=\"getAvatar(option.username)\" />\r\n <div matListItemTitle>{{ option.username | titlecase }}</div>\r\n <div matListItemLine> {{ option.email }}</div>\r\n </mat-list-item>\r\n\r\n }\r\n @default {\r\n {{ option.label }}\r\n }\r\n }\r\n\r\n </mat-option>\r\n }\r\n\r\n</mat-select>\r\n\r\n}\r\n}\r\n", styles: [""], dependencies: [{ kind: "ngmodule", type: ReactiveFormsModule }, { kind: "ngmodule", type: MatSelectModule }, { kind: "component", type: i8.MatSelect, selector: "mat-select", inputs: ["aria-describedby", "panelClass", "disabled", "disableRipple", "tabIndex", "hideSingleSelectionIndicator", "placeholder", "required", "multiple", "disableOptionCentering", "compareWith", "value", "aria-label", "aria-labelledby", "errorStateMatcher", "typeaheadDebounceInterval", "sortComparator", "id", "panelWidth", "canSelectNullableOptions"], outputs: ["openedChange", "opened", "closed", "selectionChange", "valueChange"], exportAs: ["matSelect"] }, { kind: "component", type: i8.MatOption, selector: "mat-option", inputs: ["value", "id", "disabled"], outputs: ["onSelectionChange"], exportAs: ["matOption"] }, { kind: "ngmodule", type: MatChipsModule }, { kind: "component", type: i1.MatChipListbox, selector: "mat-chip-listbox", inputs: ["multiple", "aria-orientation", "selectable", "compareWith", "required", "hideSingleSelectionIndicator", "value"], outputs: ["change"] }, { kind: "component", type: i1.MatChipOption, selector: "mat-basic-chip-option, [mat-basic-chip-option], mat-chip-option, [mat-chip-option]", inputs: ["selectable", "selected"], outputs: ["selectionChange"] }, { kind: "ngmodule", type: MatRadioModule }, { kind: "directive", type: i13.MatRadioGroup, selector: "mat-radio-group", inputs: ["color", "name", "labelPosition", "value", "selected", "disabled", "required", "disabledInteractive"], outputs: ["change"], exportAs: ["matRadioGroup"] }, { kind: "component", type: i13.MatRadioButton, selector: "mat-radio-button", inputs: ["id", "name", "aria-label", "aria-labelledby", "aria-describedby", "disableRipple", "tabIndex", "checked", "value", "labelPosition", "disabled", "required", "color", "disabledInteractive"], outputs: ["change"], exportAs: ["matRadioButton"] }, { kind: "ngmodule", type: MatCheckboxModule }, { kind: "component", type: i3.MatCheckbox, selector: "mat-checkbox", inputs: ["aria-label", "aria-labelledby", "aria-describedby", "aria-expanded", "aria-controls", "aria-owns", "id", "required", "labelPosition", "name", "value", "disableRipple", "tabIndex", "color", "disabledInteractive", "checked", "disabled", "indeterminate"], outputs: ["change", "indeterminateChange"], exportAs: ["matCheckbox"] }, { kind: "ngmodule", type: MatListModule }, { kind: "component", type: i4.MatListItem, selector: "mat-list-item, a[mat-list-item], button[mat-list-item]", inputs: ["activated"], exportAs: ["matListItem"] }, { kind: "directive", type: i4.MatListItemAvatar, selector: "[matListItemAvatar]" }, { kind: "directive", type: i4.MatListItemLine, selector: "[matListItemLine]" }, { kind: "directive", type: i4.MatListItemTitle, selector: "[matListItemTitle]" }, { kind: "pipe", type: TitleCasePipe, name: "titlecase" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
91
|
+
}
|
|
92
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.12", ngImport: i0, type: SelectInputComponent, decorators: [{
|
|
93
|
+
type: Component,
|
|
94
|
+
args: [{ selector: 'lib-select-input', imports: [
|
|
95
|
+
ReactiveFormsModule,
|
|
96
|
+
MatSelectModule,
|
|
97
|
+
MatChipsModule,
|
|
98
|
+
MatRadioModule,
|
|
99
|
+
MatCheckboxModule,
|
|
100
|
+
MatListModule,
|
|
101
|
+
TitleCasePipe,
|
|
102
|
+
], changeDetection: ChangeDetectionStrategy.OnPush, host: {
|
|
103
|
+
'[class.floating]': 'shouldLabelFloat',
|
|
104
|
+
'[id]': 'id',
|
|
105
|
+
}, providers: [{ provide: MatFormFieldControl, useExisting: SelectInputComponent }], template: "@switch (inputConfig().optionSelectType) {\r\n@case (optionSelectTypes.ChipSelect) {\r\n<mat-chip-listbox [multiple]=\"!!inputConfig().allowMultipleSelection\" [value]=\"value\" [disabled]=\"disabled\"\r\n (change)=\"onSelectionChange($event)\" aria-l abel=\"Chip select options\">\r\n @for (option of getSelectOptions(); track option.value) {\r\n <mat-chip-option [value]=\"option.value\">{{option.label}}</mat-chip-option>\r\n }\r\n</mat-chip-listbox>\r\n}\r\n@case (optionSelectTypes.RadioButton) {\r\n@if (!!inputConfig().allowMultipleSelection) {\r\n@for (option of getSelectOptions(); track option.value) {\r\n<mat-checkbox\r\n [value]=\"option.value\"\r\n [checked]=\"isSelected(option.value)\"\r\n (change)=\"checkBoxChanged($event, option.value)\" class=\"example-margin\">\r\n {{option.label}}\r\n</mat-checkbox>\r\n}\r\n} @else {\r\n<mat-radio-group aria-labelledby=\"example-radio-group-label\" class=\"example-radio-group\"\r\n (change)=\"onSelectionChange($event)\" [value]=\"value\">\r\n @for (option of getSelectOptions(); track option.value) {\r\n <mat-radio-button class=\"example-radio-button\" [value]=\"option.value\">{{option.label}}</mat-radio-button>\r\n }\r\n</mat-radio-group>\r\n}\r\n\r\n}\r\n@default {\r\n\r\n<mat-select [multiple]=\"!!inputConfig().allowMultipleSelection\" #sele (selectionChange)=\"onSelectionChange($event)\"\r\n [value]=\"value\">\r\n\r\n\r\n\r\n @for (option of getSelectOptions(); track option.value) {\r\n <mat-option [value]=\"option.value\" [disabled]=\"inputConfig().readonly\">\r\n @switch (inputConfig().matOptions?.optionType) {\r\n @case ('user') {\r\n <mat-list-item style=\"padding: 0px;\">\r\n <img matListItemAvatar [src]=\"getAvatar(option.username)\" />\r\n <div matListItemTitle>{{ option.username | titlecase }}</div>\r\n <div matListItemLine> {{ option.email }}</div>\r\n </mat-list-item>\r\n\r\n }\r\n @default {\r\n {{ option.label }}\r\n }\r\n }\r\n\r\n </mat-option>\r\n }\r\n\r\n</mat-select>\r\n\r\n}\r\n}\r\n" }]
|
|
106
|
+
}], ctorParameters: () => [], propDecorators: { inputConfig: [{ type: i0.Input, args: [{ isSignal: true, alias: "inputConfig", required: true }] }] } });
|
|
107
|
+
|
|
108
|
+
/** Wraps a reactive select control inside a `mat-form-field`. */
|
|
109
|
+
class SelectInputElementComponent {
|
|
110
|
+
constructor() {
|
|
111
|
+
this.inputConfig = input.required(...(ngDevMode ? [{ debugName: "inputConfig" }] : /* istanbul ignore next */ []));
|
|
112
|
+
this.formGroup = input.required(...(ngDevMode ? [{ debugName: "formGroup" }] : /* istanbul ignore next */ []));
|
|
113
|
+
this.reload = output();
|
|
114
|
+
this.errorMessage = computed(() => getInputErrorMessage(this.inputConfig(), this.formGroup()), ...(ngDevMode ? [{ debugName: "errorMessage" }] : /* istanbul ignore next */ []));
|
|
115
|
+
this.errorStateMatcher = {
|
|
116
|
+
isErrorState(control, _form) {
|
|
117
|
+
return !!(control && control.invalid && (control.dirty || control.touched));
|
|
118
|
+
},
|
|
119
|
+
};
|
|
120
|
+
}
|
|
121
|
+
getSelectOptions() {
|
|
122
|
+
const cfg = this.inputConfig();
|
|
123
|
+
if (!cfg.matOptions)
|
|
124
|
+
return [];
|
|
125
|
+
if (Array.isArray(cfg.matOptions?.options)) {
|
|
126
|
+
return cfg.matOptions.options ?? [];
|
|
127
|
+
}
|
|
128
|
+
return [];
|
|
129
|
+
}
|
|
130
|
+
selectInputSearchWord(event) {
|
|
131
|
+
this.optionsSearchWordKeyWord = event.detail.value.toUpperCase();
|
|
132
|
+
}
|
|
133
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.12", ngImport: i0, type: SelectInputElementComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
134
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.12", type: SelectInputElementComponent, isStandalone: true, selector: "lib-select-input-element", inputs: { inputConfig: { classPropertyName: "inputConfig", publicName: "inputConfig", isSignal: true, isRequired: true, transformFunction: null }, formGroup: { classPropertyName: "formGroup", publicName: "formGroup", isSignal: true, isRequired: true, transformFunction: null } }, outputs: { reload: "reload" }, ngImport: i0, template: "<ng-container [formGroup]=\"formGroup()\">\r\n @if (inputConfig(); as inputConfig) {\r\n <mat-form-field [appearance]=\"inputConfig.appearance || 'fill'\" subscriptSizing=\"dynamic\">\r\n <mat-label>\r\n {{ inputConfig.label }}\r\n <lib-t-form-input-status [inputConfig]=\"inputConfig\"></lib-t-form-input-status>\r\n </mat-label>\r\n\r\n <lib-select-input\r\n [inputConfig]=\"inputConfig\"\r\n [required]=\"inputConfig.required\"\r\n [formControlName]=\"inputConfig.id\"\r\n ></lib-select-input>\r\n\r\n @if (inputConfig.hintLabel || inputConfig.temporaryHint) {\r\n <mat-hint class=\"inputHint\">\r\n {{ inputConfig.temporaryHint || inputConfig.hintLabel }}\r\n </mat-hint>\r\n }\r\n\r\n <mat-error class=\"oneLineTextEllipsis\" matTooltipClass=\"errorToolTip\">{{ errorMessage() }}</mat-error>\r\n\r\n @if (inputConfig.canReload?.canReload) {\r\n <button\r\n mat-icon-button\r\n style=\"margin-right: 4px;\"\r\n matTooltip=\"Click to refresh this field.\"\r\n class=\"input-sync-button\"\r\n (click)=\"inputConfig.canReload.emit()\"\r\n matSuffix\r\n >\r\n <mat-icon style=\"color: var(--mat-sys-primary)\">sync</mat-icon>\r\n </button>\r\n }\r\n\r\n @if (inputConfig.prefixIcon) {\r\n <mat-icon matPrefix>{{ inputConfig.prefixIcon }}</mat-icon>\r\n }\r\n\r\n @if (inputConfig.suffixIcon && inputConfig.id !== 'password') {\r\n <mat-icon matSuffix>{{ inputConfig.suffixIcon }}</mat-icon>\r\n }\r\n\r\n @if (inputConfig.prefixText) {\r\n <span matPrefix style=\"top: 0\">{{ inputConfig.prefixText }}</span>\r\n }\r\n @if (inputConfig.suffixText) {\r\n <span matSuffix style=\"padding-left: 5px\">{{ inputConfig.suffixText }}</span>\r\n }\r\n\r\n @if (inputConfig.maxLength && formGroup()) {\r\n <mat-hint align=\"end\">\r\n {{ (formGroup().controls[inputConfig.id]?.value?.length || 0) + '/' + inputConfig.maxLength }}\r\n </mat-hint>\r\n }\r\n </mat-form-field>\r\n }\r\n</ng-container>\r\n", styles: ["mat-form-field{width:100%!important}mat-form-field .input-sync-button{display:none}mat-form-field:hover .input-sync-button{display:inline-block}\n"], dependencies: [{ kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1$1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],[formArray],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i1$1.RequiredValidator, selector: ":not([type=checkbox])[required][formControlName],:not([type=checkbox])[required][formControl],:not([type=checkbox])[required][ngModel]", inputs: ["required"] }, { kind: "directive", type: i1$1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i1$1.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "ngmodule", type: MatFormFieldModule }, { kind: "component", type: i2.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i2.MatLabel, selector: "mat-label" }, { kind: "directive", type: i2.MatHint, selector: "mat-hint", inputs: ["align", "id"] }, { kind: "directive", type: i2.MatError, selector: "mat-error, [matError]", inputs: ["id"] }, { kind: "directive", type: i2.MatPrefix, selector: "[matPrefix], [matIconPrefix], [matTextPrefix]", inputs: ["matTextPrefix"] }, { kind: "directive", type: i2.MatSuffix, selector: "[matSuffix], [matIconSuffix], [matTextSuffix]", inputs: ["matTextSuffix"] }, { kind: "ngmodule", type: MatIconModule }, { kind: "component", type: i3$1.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "ngmodule", type: MatButtonModule }, { kind: "component", type: i1$2.MatIconButton, selector: "button[mat-icon-button], a[mat-icon-button], button[matIconButton], a[matIconButton]", exportAs: ["matButton", "matAnchor"] }, { kind: "ngmodule", type: MatTooltipModule }, { kind: "directive", type: i5.MatTooltip, selector: "[matTooltip]", inputs: ["matTooltipPosition", "matTooltipPositionAtOrigin", "matTooltipDisabled", "matTooltipShowDelay", "matTooltipHideDelay", "matTooltipTouchGestures", "matTooltip", "matTooltipClass"], exportAs: ["matTooltip"] }, { kind: "component", type: SelectInputComponent, selector: "lib-select-input", inputs: ["inputConfig"] }, { kind: "component", type: TFormInputStatusComponent, selector: "lib-t-form-input-status", inputs: ["inputConfig"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
135
|
+
}
|
|
136
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.12", ngImport: i0, type: SelectInputElementComponent, decorators: [{
|
|
137
|
+
type: Component,
|
|
138
|
+
args: [{ selector: 'lib-select-input-element', changeDetection: ChangeDetectionStrategy.OnPush, imports: [
|
|
139
|
+
ReactiveFormsModule,
|
|
140
|
+
MatFormFieldModule,
|
|
141
|
+
MatIconModule,
|
|
142
|
+
MatButtonModule,
|
|
143
|
+
MatTooltipModule,
|
|
144
|
+
SelectInputComponent,
|
|
145
|
+
TFormInputStatusComponent,
|
|
146
|
+
], template: "<ng-container [formGroup]=\"formGroup()\">\r\n @if (inputConfig(); as inputConfig) {\r\n <mat-form-field [appearance]=\"inputConfig.appearance || 'fill'\" subscriptSizing=\"dynamic\">\r\n <mat-label>\r\n {{ inputConfig.label }}\r\n <lib-t-form-input-status [inputConfig]=\"inputConfig\"></lib-t-form-input-status>\r\n </mat-label>\r\n\r\n <lib-select-input\r\n [inputConfig]=\"inputConfig\"\r\n [required]=\"inputConfig.required\"\r\n [formControlName]=\"inputConfig.id\"\r\n ></lib-select-input>\r\n\r\n @if (inputConfig.hintLabel || inputConfig.temporaryHint) {\r\n <mat-hint class=\"inputHint\">\r\n {{ inputConfig.temporaryHint || inputConfig.hintLabel }}\r\n </mat-hint>\r\n }\r\n\r\n <mat-error class=\"oneLineTextEllipsis\" matTooltipClass=\"errorToolTip\">{{ errorMessage() }}</mat-error>\r\n\r\n @if (inputConfig.canReload?.canReload) {\r\n <button\r\n mat-icon-button\r\n style=\"margin-right: 4px;\"\r\n matTooltip=\"Click to refresh this field.\"\r\n class=\"input-sync-button\"\r\n (click)=\"inputConfig.canReload.emit()\"\r\n matSuffix\r\n >\r\n <mat-icon style=\"color: var(--mat-sys-primary)\">sync</mat-icon>\r\n </button>\r\n }\r\n\r\n @if (inputConfig.prefixIcon) {\r\n <mat-icon matPrefix>{{ inputConfig.prefixIcon }}</mat-icon>\r\n }\r\n\r\n @if (inputConfig.suffixIcon && inputConfig.id !== 'password') {\r\n <mat-icon matSuffix>{{ inputConfig.suffixIcon }}</mat-icon>\r\n }\r\n\r\n @if (inputConfig.prefixText) {\r\n <span matPrefix style=\"top: 0\">{{ inputConfig.prefixText }}</span>\r\n }\r\n @if (inputConfig.suffixText) {\r\n <span matSuffix style=\"padding-left: 5px\">{{ inputConfig.suffixText }}</span>\r\n }\r\n\r\n @if (inputConfig.maxLength && formGroup()) {\r\n <mat-hint align=\"end\">\r\n {{ (formGroup().controls[inputConfig.id]?.value?.length || 0) + '/' + inputConfig.maxLength }}\r\n </mat-hint>\r\n }\r\n </mat-form-field>\r\n }\r\n</ng-container>\r\n", styles: ["mat-form-field{width:100%!important}mat-form-field .input-sync-button{display:none}mat-form-field:hover .input-sync-button{display:inline-block}\n"] }]
|
|
147
|
+
}], propDecorators: { inputConfig: [{ type: i0.Input, args: [{ isSignal: true, alias: "inputConfig", required: true }] }], formGroup: [{ type: i0.Input, args: [{ isSignal: true, alias: "formGroup", required: true }] }], reload: [{ type: i0.Output, args: ["reload"] }] } });
|
|
148
|
+
|
|
149
|
+
export { SelectInputElementComponent };
|
|
150
|
+
//# sourceMappingURL=ngx-t-forms-select-input-element.component-DbgZdNoe.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ngx-t-forms-select-input-element.component-DbgZdNoe.mjs","sources":["../../../projects/ngx-t-forms/src/lib/components/t-form-input/elements/select-input-element/elements/select-input/select-input.component.ts","../../../projects/ngx-t-forms/src/lib/components/t-form-input/elements/select-input-element/elements/select-input/select-input.component.html","../../../projects/ngx-t-forms/src/lib/components/t-form-input/elements/select-input-element/select-input-element.component.ts","../../../projects/ngx-t-forms/src/lib/components/t-form-input/elements/select-input-element/select-input-element.component.html"],"sourcesContent":["import { ChangeDetectionStrategy, Component, ElementRef, inject, input } from '@angular/core';\r\nimport { MatFormFieldControl } from '@angular/material/form-field';\r\nimport { BaseCustomInput, BaseCustomInputConfig } from '../../../../../../services/core/t-input-controller/functions/baseCustomInput';\r\n\r\nimport { AbstractControl, NgControl, ReactiveFormsModule } from '@angular/forms';\r\nimport { Subject } from 'rxjs';\r\nimport { MatSelectChange, MatSelectModule } from '@angular/material/select';\r\nimport { ITowerStepColumn, OptionSelectTypes } from 'ngx-t-forms-types';\r\nimport { MatChipListboxChange, MatChipsModule } from '@angular/material/chips';\r\nimport { MatRadioChange, MatRadioModule } from '@angular/material/radio';\r\nimport { MatCheckboxChange, MatCheckboxModule } from '@angular/material/checkbox';\r\nimport { MatListModule } from '@angular/material/list';\r\nimport { TitleCasePipe } from '@angular/common';\r\n\r\nconst customInputConfig: BaseCustomInputConfig = {\r\n controlType: 'lib-select-input',\r\n nextId: 0,\r\n};\r\n\r\n@Component({\r\n selector: 'lib-select-input',\r\n imports: [\r\n ReactiveFormsModule,\r\n MatSelectModule,\r\n MatChipsModule,\r\n MatRadioModule,\r\n MatCheckboxModule,\r\n MatListModule,\r\n TitleCasePipe,\r\n ],\r\n templateUrl: './select-input.component.html',\r\n styleUrl: './select-input.component.css',\r\n changeDetection: ChangeDetectionStrategy.OnPush,\r\n host: {\r\n '[class.floating]': 'shouldLabelFloat',\r\n '[id]': 'id',\r\n },\r\n providers: [{ provide: MatFormFieldControl, useExisting: SelectInputComponent }],\r\n})\r\nexport class SelectInputComponent extends BaseCustomInput<string | number | Date | string[]> {\r\n readonly inputConfig = input.required<ITowerStepColumn>();\r\n\r\n constructor() {\r\n super(\r\n inject(NgControl, { optional: true, self: true }) as NgControl,\r\n inject<ElementRef<HTMLElement>>(ElementRef),\r\n customInputConfig,\r\n );\r\n }\r\n\r\n protected readonly optionSelectTypes = OptionSelectTypes;\r\n\r\n override get empty(): boolean {\r\n return !this.value;\r\n }\r\n\r\n override get shouldLabelFloat(): boolean {\r\n return true;\r\n }\r\n\r\n readonly #valueSubject = new Subject<unknown>();\r\n\r\n protected onInputChange($event: unknown): void {\r\n this.#valueSubject.next($event);\r\n }\r\n\r\n protected onSelectionChange(event: MatSelectChange | MatChipListboxChange | MatRadioChange): void {\r\n this.value = event.value;\r\n this.stateChanges.next();\r\n this.onChange(this.value);\r\n }\r\n\r\n protected checkBoxChanged(event: MatCheckboxChange, value: string): void {\r\n const current = Array.isArray(this.value) ? (this.value as string[]) : [];\r\n if (event.checked) {\r\n this.value = [...current, value];\r\n } else {\r\n this.value = current.filter((v) => v !== value);\r\n }\r\n this.stateChanges.next();\r\n this.onChange(this.value);\r\n }\r\n\r\n protected isSelected(value: string): boolean {\r\n if (!this.value || !Array.isArray(this.value)) return false;\r\n return (this.value as string[]).includes(value);\r\n }\r\n\r\n // NOTE(phase-4): `matOptions.options` is `(FormInputBasicOptionInterface | DynamicObjectInterface)[]`\r\n // but templates access `.value`, `.label`, `.username`, `.email` directly. Until the template\r\n // is split per `optionType`, the return shape stays `any[]` to keep strictTemplates passing.\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any -- TODO(phase-4): split template per matOptions.optionType, then narrow.\r\n protected getSelectOptions(): any[] {\r\n const cfg = this.inputConfig();\r\n if (!cfg?.matOptions) return [];\r\n if (Array.isArray(cfg.matOptions?.options)) {\r\n return cfg.matOptions?.options || [];\r\n }\r\n return [];\r\n }\r\n\r\n protected getAvatar(userName: unknown): string {\r\n return `https://ui-avatars.com/api/?color=EADDFF&font-size=0.36&bold=true&background=random&name=${userName}`;\r\n }\r\n\r\n protected get inputControl(): AbstractControl | null {\r\n return this.ngControl?.control ?? null;\r\n }\r\n}\r\n","@switch (inputConfig().optionSelectType) {\r\n@case (optionSelectTypes.ChipSelect) {\r\n<mat-chip-listbox [multiple]=\"!!inputConfig().allowMultipleSelection\" [value]=\"value\" [disabled]=\"disabled\"\r\n (change)=\"onSelectionChange($event)\" aria-l abel=\"Chip select options\">\r\n @for (option of getSelectOptions(); track option.value) {\r\n <mat-chip-option [value]=\"option.value\">{{option.label}}</mat-chip-option>\r\n }\r\n</mat-chip-listbox>\r\n}\r\n@case (optionSelectTypes.RadioButton) {\r\n@if (!!inputConfig().allowMultipleSelection) {\r\n@for (option of getSelectOptions(); track option.value) {\r\n<mat-checkbox\r\n [value]=\"option.value\"\r\n [checked]=\"isSelected(option.value)\"\r\n (change)=\"checkBoxChanged($event, option.value)\" class=\"example-margin\">\r\n {{option.label}}\r\n</mat-checkbox>\r\n}\r\n} @else {\r\n<mat-radio-group aria-labelledby=\"example-radio-group-label\" class=\"example-radio-group\"\r\n (change)=\"onSelectionChange($event)\" [value]=\"value\">\r\n @for (option of getSelectOptions(); track option.value) {\r\n <mat-radio-button class=\"example-radio-button\" [value]=\"option.value\">{{option.label}}</mat-radio-button>\r\n }\r\n</mat-radio-group>\r\n}\r\n\r\n}\r\n@default {\r\n\r\n<mat-select [multiple]=\"!!inputConfig().allowMultipleSelection\" #sele (selectionChange)=\"onSelectionChange($event)\"\r\n [value]=\"value\">\r\n\r\n\r\n\r\n @for (option of getSelectOptions(); track option.value) {\r\n <mat-option [value]=\"option.value\" [disabled]=\"inputConfig().readonly\">\r\n @switch (inputConfig().matOptions?.optionType) {\r\n @case ('user') {\r\n <mat-list-item style=\"padding: 0px;\">\r\n <img matListItemAvatar [src]=\"getAvatar(option.username)\" />\r\n <div matListItemTitle>{{ option.username | titlecase }}</div>\r\n <div matListItemLine> {{ option.email }}</div>\r\n </mat-list-item>\r\n\r\n }\r\n @default {\r\n {{ option.label }}\r\n }\r\n }\r\n\r\n </mat-option>\r\n }\r\n\r\n</mat-select>\r\n\r\n}\r\n}\r\n","import { ChangeDetectionStrategy, Component, computed, input, output } from '@angular/core';\r\nimport { FormControl, FormGroup, FormGroupDirective, NgForm, ReactiveFormsModule } from '@angular/forms';\r\nimport { ErrorStateMatcher } from '@angular/material/core';\r\nimport { MatFormFieldModule } from '@angular/material/form-field';\r\nimport { MatIconModule } from '@angular/material/icon';\r\nimport { MatButtonModule } from '@angular/material/button';\r\nimport { MatTooltipModule } from '@angular/material/tooltip';\r\nimport type { ITowerStepColumn } from 'ngx-t-forms-types';\r\nimport { TFormInputStatusComponent } from '../../../t-form-input-status/t-form-input-status.component';\r\nimport { SelectInputComponent } from './elements/select-input/select-input.component';\r\nimport { getInputErrorMessage } from '../../../../services/core/t-input-controller/functions/inputErrorMessage';\r\n\r\n/** Wraps a reactive select control inside a `mat-form-field`. */\r\n@Component({\r\n selector: 'lib-select-input-element',\r\n templateUrl: './select-input-element.component.html',\r\n styleUrl: './select-input-element.component.css',\r\n changeDetection: ChangeDetectionStrategy.OnPush,\r\n imports: [\r\n ReactiveFormsModule,\r\n MatFormFieldModule,\r\n MatIconModule,\r\n MatButtonModule,\r\n MatTooltipModule,\r\n SelectInputComponent,\r\n TFormInputStatusComponent,\r\n ],\r\n})\r\nexport class SelectInputElementComponent {\r\n readonly inputConfig = input.required<ITowerStepColumn>();\r\n readonly formGroup = input.required<FormGroup>();\r\n readonly reload = output<void>();\r\n\r\n protected optionsSearchWordKeyWord!: string;\r\n\r\n protected readonly errorMessage = computed(() =>\r\n getInputErrorMessage(this.inputConfig(), this.formGroup()),\r\n );\r\n\r\n protected readonly errorStateMatcher: ErrorStateMatcher = {\r\n isErrorState(control: FormControl | null, _form: FormGroupDirective | NgForm | null): boolean {\r\n return !!(control && control.invalid && (control.dirty || control.touched));\r\n },\r\n };\r\n\r\n protected getSelectOptions(): unknown[] {\r\n const cfg = this.inputConfig();\r\n if (!cfg.matOptions) return [];\r\n if (Array.isArray(cfg.matOptions?.options)) {\r\n return cfg.matOptions.options ?? [];\r\n }\r\n return [];\r\n }\r\n\r\n protected selectInputSearchWord(event: { detail: { value: string } }): void {\r\n this.optionsSearchWordKeyWord = event.detail.value.toUpperCase();\r\n }\r\n}\r\n","<ng-container [formGroup]=\"formGroup()\">\r\n @if (inputConfig(); as inputConfig) {\r\n <mat-form-field [appearance]=\"inputConfig.appearance || 'fill'\" subscriptSizing=\"dynamic\">\r\n <mat-label>\r\n {{ inputConfig.label }}\r\n <lib-t-form-input-status [inputConfig]=\"inputConfig\"></lib-t-form-input-status>\r\n </mat-label>\r\n\r\n <lib-select-input\r\n [inputConfig]=\"inputConfig\"\r\n [required]=\"inputConfig.required\"\r\n [formControlName]=\"inputConfig.id\"\r\n ></lib-select-input>\r\n\r\n @if (inputConfig.hintLabel || inputConfig.temporaryHint) {\r\n <mat-hint class=\"inputHint\">\r\n {{ inputConfig.temporaryHint || inputConfig.hintLabel }}\r\n </mat-hint>\r\n }\r\n\r\n <mat-error class=\"oneLineTextEllipsis\" matTooltipClass=\"errorToolTip\">{{ errorMessage() }}</mat-error>\r\n\r\n @if (inputConfig.canReload?.canReload) {\r\n <button\r\n mat-icon-button\r\n style=\"margin-right: 4px;\"\r\n matTooltip=\"Click to refresh this field.\"\r\n class=\"input-sync-button\"\r\n (click)=\"inputConfig.canReload.emit()\"\r\n matSuffix\r\n >\r\n <mat-icon style=\"color: var(--mat-sys-primary)\">sync</mat-icon>\r\n </button>\r\n }\r\n\r\n @if (inputConfig.prefixIcon) {\r\n <mat-icon matPrefix>{{ inputConfig.prefixIcon }}</mat-icon>\r\n }\r\n\r\n @if (inputConfig.suffixIcon && inputConfig.id !== 'password') {\r\n <mat-icon matSuffix>{{ inputConfig.suffixIcon }}</mat-icon>\r\n }\r\n\r\n @if (inputConfig.prefixText) {\r\n <span matPrefix style=\"top: 0\">{{ inputConfig.prefixText }}</span>\r\n }\r\n @if (inputConfig.suffixText) {\r\n <span matSuffix style=\"padding-left: 5px\">{{ inputConfig.suffixText }}</span>\r\n }\r\n\r\n @if (inputConfig.maxLength && formGroup()) {\r\n <mat-hint align=\"end\">\r\n {{ (formGroup().controls[inputConfig.id]?.value?.length || 0) + '/' + inputConfig.maxLength }}\r\n </mat-hint>\r\n }\r\n </mat-form-field>\r\n }\r\n</ng-container>\r\n"],"names":["i1","i2","i3","i4","i5"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAcA,MAAM,iBAAiB,GAA0B;AAC/C,IAAA,WAAW,EAAE,kBAAkB;AAC/B,IAAA,MAAM,EAAE,CAAC;CACV;AAsBK,MAAO,oBAAqB,SAAQ,eAAkD,CAAA;AAG1F,IAAA,WAAA,GAAA;QACE,KAAK,CACH,MAAM,CAAC,SAAS,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,CAAc,EAC9D,MAAM,CAA0B,UAAU,CAAC,EAC3C,iBAAiB,CAClB;AAPM,QAAA,IAAA,CAAA,WAAW,GAAG,KAAK,CAAC,QAAQ,iFAAoB;QAUtC,IAAA,CAAA,iBAAiB,GAAG,iBAAiB;AAU/C,QAAA,IAAA,CAAA,aAAa,GAAG,IAAI,OAAO,EAAW;IAZ/C;AAIA,IAAA,IAAa,KAAK,GAAA;AAChB,QAAA,OAAO,CAAC,IAAI,CAAC,KAAK;IACpB;AAEA,IAAA,IAAa,gBAAgB,GAAA;AAC3B,QAAA,OAAO,IAAI;IACb;AAES,IAAA,aAAa;AAEZ,IAAA,aAAa,CAAC,MAAe,EAAA;AACrC,QAAA,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,MAAM,CAAC;IACjC;AAEU,IAAA,iBAAiB,CAAC,KAA8D,EAAA;AACxF,QAAA,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC,KAAK;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,CAAA,EAAA;;;;;"}
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { input, output, inject, PLATFORM_ID, signal, computed, ViewEncapsulation, ChangeDetectionStrategy, Component } from '@angular/core';
|
|
3
|
+
import { DOCUMENT, isPlatformBrowser } from '@angular/common';
|
|
4
|
+
import * as i1 from '@angular/forms';
|
|
5
|
+
import { NonNullableFormBuilder, Validators, ReactiveFormsModule } from '@angular/forms';
|
|
6
|
+
import * as i1$1 from '@angular/material/button';
|
|
7
|
+
import { MatButtonModule } from '@angular/material/button';
|
|
8
|
+
import * as i3 from '@angular/material/card';
|
|
9
|
+
import { MatCardModule } from '@angular/material/card';
|
|
10
|
+
import * as i1$2 from '@angular/material/chips';
|
|
11
|
+
import { MatChipsModule } from '@angular/material/chips';
|
|
12
|
+
import * as i2 from '@angular/material/form-field';
|
|
13
|
+
import { MatFormFieldModule } from '@angular/material/form-field';
|
|
14
|
+
import * as i3$1 from '@angular/material/icon';
|
|
15
|
+
import { MatIconModule } from '@angular/material/icon';
|
|
16
|
+
import * as i2$1 from '@angular/material/input';
|
|
17
|
+
import { MatInputModule } from '@angular/material/input';
|
|
18
|
+
import * as i5 from '@angular/material/toolbar';
|
|
19
|
+
import { MatToolbarModule } from '@angular/material/toolbar';
|
|
20
|
+
import * as i5$1 from '@angular/material/tooltip';
|
|
21
|
+
import { MatTooltipModule } from '@angular/material/tooltip';
|
|
22
|
+
import { v4 } from 'uuid';
|
|
23
|
+
import { E as EmptyStateComponent } from './ngx-t-forms-ngx-t-forms-u_kigDid.mjs';
|
|
24
|
+
|
|
25
|
+
let nextUniqueId = 0;
|
|
26
|
+
/**
|
|
27
|
+
* Editor for a list of selectable `{ id, label, value }` options. Renders inside
|
|
28
|
+
* `t-dynamic-data-edit`, which supplies the field label, hint, and validation
|
|
29
|
+
* errors — so this component owns only the chip list plus the add/edit card.
|
|
30
|
+
*
|
|
31
|
+
* @example
|
|
32
|
+
* <lib-selection-options-editor
|
|
33
|
+
* [options]="options()"
|
|
34
|
+
* [disabled]="disabled()"
|
|
35
|
+
* (valueChanged)="onOptions($event)" />
|
|
36
|
+
*/
|
|
37
|
+
class SelectionOptionsEditorComponent {
|
|
38
|
+
constructor() {
|
|
39
|
+
/** Validation errors surfaced by the parent (kept for contract parity). */
|
|
40
|
+
this.errors = input([], ...(ngDevMode ? [{ debugName: "errors" }] : /* istanbul ignore next */ []));
|
|
41
|
+
/** Disables interaction with the chip list and the add control. */
|
|
42
|
+
this.disabled = input(false, ...(ngDevMode ? [{ debugName: "disabled" }] : /* istanbul ignore next */ []));
|
|
43
|
+
/** Current set of options to edit. */
|
|
44
|
+
this.options = input([], ...(ngDevMode ? [{ debugName: "options" }] : /* istanbul ignore next */ []));
|
|
45
|
+
/** Fires the full option list whenever it is added to, edited, or pruned. */
|
|
46
|
+
this.valueChanged = output();
|
|
47
|
+
/** Stable host id used by the parent's `[attr.id]` binding. */
|
|
48
|
+
this.hostId = `app-selection-options-editor-${nextUniqueId++}`;
|
|
49
|
+
this.#platformId = inject(PLATFORM_ID);
|
|
50
|
+
this.#document = inject(DOCUMENT);
|
|
51
|
+
this.#fb = inject(NonNullableFormBuilder);
|
|
52
|
+
/** Option being edited (existing) or added (no id yet); `null` when closed. */
|
|
53
|
+
this.inEdit = signal(null, ...(ngDevMode ? [{ debugName: "inEdit" }] : /* istanbul ignore next */ []));
|
|
54
|
+
/** Whether the editor is in "add new" mode (open card, no existing id). */
|
|
55
|
+
this.isAdding = signal(false, ...(ngDevMode ? [{ debugName: "isAdding" }] : /* istanbul ignore next */ []));
|
|
56
|
+
/** When true, an empty value auto-fills from the camelCased label on blur. */
|
|
57
|
+
this.isAutoCamelCase = signal(true, ...(ngDevMode ? [{ debugName: "isAutoCamelCase" }] : /* istanbul ignore next */ []));
|
|
58
|
+
/** Live snapshot of the upstream options, defensively normalised to an array. */
|
|
59
|
+
this.optionList = computed(() => this.options() ?? [], ...(ngDevMode ? [{ debugName: "optionList" }] : /* istanbul ignore next */ []));
|
|
60
|
+
/** Whether the add/edit card is currently open. */
|
|
61
|
+
this.isEditing = computed(() => this.isAdding() || this.inEdit() !== null, ...(ngDevMode ? [{ debugName: "isEditing" }] : /* istanbul ignore next */ []));
|
|
62
|
+
/** Reactive form for the open add/edit card. */
|
|
63
|
+
this.form = this.#fb.group({
|
|
64
|
+
label: this.#fb.control('', Validators.required),
|
|
65
|
+
value: this.#fb.control('', Validators.required),
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
#platformId;
|
|
69
|
+
#document;
|
|
70
|
+
#fb;
|
|
71
|
+
/** Opens the card to add a new option. */
|
|
72
|
+
add() {
|
|
73
|
+
this.inEdit.set(null);
|
|
74
|
+
this.isAdding.set(true);
|
|
75
|
+
this.#resetForm('', '');
|
|
76
|
+
}
|
|
77
|
+
/** Opens the card to edit an existing option. */
|
|
78
|
+
startEdit(option) {
|
|
79
|
+
this.isAdding.set(false);
|
|
80
|
+
this.inEdit.set(option);
|
|
81
|
+
this.#resetForm(option.label, option.value);
|
|
82
|
+
}
|
|
83
|
+
/** Closes the card without persisting changes. */
|
|
84
|
+
closeEdit() {
|
|
85
|
+
this.inEdit.set(null);
|
|
86
|
+
this.isAdding.set(false);
|
|
87
|
+
}
|
|
88
|
+
/** Removes an option after browser confirmation, then emits the new list. */
|
|
89
|
+
remove(option) {
|
|
90
|
+
if (!isPlatformBrowser(this.#platformId))
|
|
91
|
+
return;
|
|
92
|
+
const win = this.#document.defaultView;
|
|
93
|
+
if (!win)
|
|
94
|
+
return;
|
|
95
|
+
if (!win.confirm(`Are you sure you want to delete the option "${option.label}"?`))
|
|
96
|
+
return;
|
|
97
|
+
this.valueChanged.emit(this.optionList().filter((o) => o.id !== option.id));
|
|
98
|
+
if (this.inEdit()?.id === option.id)
|
|
99
|
+
this.closeEdit();
|
|
100
|
+
}
|
|
101
|
+
/** Persists the open card as a new or updated option, then emits the list. */
|
|
102
|
+
save() {
|
|
103
|
+
if (this.form.invalid)
|
|
104
|
+
return;
|
|
105
|
+
const { label, value } = this.form.getRawValue();
|
|
106
|
+
const editing = this.inEdit();
|
|
107
|
+
const next = editing
|
|
108
|
+
? this.optionList().map((o) => (o.id === editing.id ? { ...o, label, value } : o))
|
|
109
|
+
: [...this.optionList(), { id: v4(), label, value }];
|
|
110
|
+
this.valueChanged.emit(next);
|
|
111
|
+
this.closeEdit();
|
|
112
|
+
}
|
|
113
|
+
/** Toggles auto-camelCase generation of an empty value from the label. */
|
|
114
|
+
toggleAutoCamelCase() {
|
|
115
|
+
this.isAutoCamelCase.update((on) => !on);
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* Fills an empty `value` with the camelCased `label` on label blur. A value
|
|
119
|
+
* the user already set is never overwritten.
|
|
120
|
+
*/
|
|
121
|
+
autoFillValueFromLabel() {
|
|
122
|
+
if (!this.isAutoCamelCase())
|
|
123
|
+
return;
|
|
124
|
+
const label = this.form.controls.label.value.trim();
|
|
125
|
+
if (label && !this.form.controls.value.value) {
|
|
126
|
+
this.form.controls.value.setValue(this.#camelCase(label));
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
/** Resets the form to the supplied label/value pair. */
|
|
130
|
+
#resetForm(label, value) {
|
|
131
|
+
this.form.reset({ label, value });
|
|
132
|
+
}
|
|
133
|
+
/** Native camelCase: identical output to the previous lodash dependency. */
|
|
134
|
+
#camelCase(input) {
|
|
135
|
+
const words = input
|
|
136
|
+
.replace(/[^A-Za-z0-9]+/g, ' ')
|
|
137
|
+
.replace(/([a-z0-9])([A-Z])/g, '$1 $2')
|
|
138
|
+
.trim()
|
|
139
|
+
.toLowerCase()
|
|
140
|
+
.split(/\s+/)
|
|
141
|
+
.filter((w) => w.length > 0);
|
|
142
|
+
return words
|
|
143
|
+
.map((word, i) => (i === 0 ? word : word.charAt(0).toUpperCase() + word.slice(1)))
|
|
144
|
+
.join('');
|
|
145
|
+
}
|
|
146
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.12", ngImport: i0, type: SelectionOptionsEditorComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
147
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.12", type: SelectionOptionsEditorComponent, isStandalone: true, selector: "lib-selection-options-editor", inputs: { errors: { classPropertyName: "errors", publicName: "errors", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { valueChanged: "valueChanged" }, host: { properties: { "attr.id": "hostId" }, classAttribute: "lib-selection-options-editor" }, ngImport: i0, template: "@if (optionList().length) {\n <mat-chip-listbox\n class=\"lib-selection-options-editor__listbox\"\n aria-label=\"Option selection\"\n [disabled]=\"disabled()\">\n @for (option of optionList(); track option.id) {\n <mat-chip-option\n class=\"lib-selection-options-editor__chip\"\n color=\"accent\"\n [value]=\"option.value\"\n [selected]=\"inEdit()?.id === option.id\"\n (click)=\"startEdit(option)\">\n {{ option.label }}\n <button\n matChipRemove\n [attr.aria-label]=\"'Remove ' + option.label\"\n (click)=\"$event.stopPropagation(); remove(option)\">\n <mat-icon>cancel</mat-icon>\n </button>\n </mat-chip-option>\n }\n </mat-chip-listbox>\n} @else if (!isEditing()) {\n <lib-empty-state icon=\"list_alt\" message=\"No options yet\" />\n}\n\n@if (!isEditing()) {\n <mat-toolbar class=\"lib-selection-options-editor__toolbar\">\n <button\n class=\"lib-selection-options-editor__add\"\n mat-stroked-button\n [disabled]=\"disabled()\"\n (click)=\"add()\">\n Add an option <mat-icon>add</mat-icon>\n </button>\n </mat-toolbar>\n} @else {\n <mat-card class=\"lib-selection-options-editor__card\" appearance=\"outlined\">\n <mat-card-header>\n <mat-card-subtitle>{{ inEdit() ? 'Edit Option' : 'Add New Option' }}</mat-card-subtitle>\n </mat-card-header>\n\n <mat-card-content>\n <form [formGroup]=\"form\">\n <mat-form-field\n class=\"lib-selection-options-editor__field\"\n subscriptSizing=\"dynamic\"\n floatLabel=\"always\"\n appearance=\"outline\">\n <mat-label>Display Text</mat-label>\n <input\n type=\"text\"\n matInput\n formControlName=\"label\"\n placeholder=\"Enter option text\"\n (blur)=\"autoFillValueFromLabel()\" />\n <mat-hint>The text users will see and select from the list.</mat-hint>\n </mat-form-field>\n\n <mat-form-field\n class=\"lib-selection-options-editor__field\"\n subscriptSizing=\"dynamic\"\n floatLabel=\"always\"\n appearance=\"outline\">\n <mat-label>Stored Value</mat-label>\n <input type=\"text\" matInput formControlName=\"value\" placeholder=\"Enter data value\" />\n <button\n matSuffix\n mat-icon-button\n matTooltip=\"Toggle auto-creation of value from display text\"\n [color]=\"isAutoCamelCase() ? 'primary' : ''\"\n (click)=\"toggleAutoCamelCase()\">\n <mat-icon>{{ isAutoCamelCase() ? 'drive_file_rename_outline' : 'edit_off' }}</mat-icon>\n </button>\n <mat-hint>The value saved when this option is chosen. (Often an ID or code)</mat-hint>\n </mat-form-field>\n </form>\n </mat-card-content>\n\n <mat-card-actions>\n <button mat-button (click)=\"closeEdit()\">Cancel</button>\n <button mat-flat-button [disabled]=\"form.invalid\" (click)=\"save()\">\n {{ inEdit() ? 'Save Changes' : 'Add Option' }}\n </button>\n </mat-card-actions>\n </mat-card>\n}\n", styles: [":host{display:flex;flex-direction:column;gap:1.5rem}.lib-selection-options-editor__listbox{display:flex;overflow-x:auto}.lib-selection-options-editor__chip{min-width:fit-content}.lib-selection-options-editor__toolbar{padding:0;background:transparent}.lib-selection-options-editor__add{width:100%}.lib-selection-options-editor__card{background:var(--lib-forms-surface);border:1px solid color-mix(in srgb,var(--lib-forms-outline) 15%,transparent);border-radius:var(--lib-forms-radius-lg, 12px);box-shadow:var(--lib-forms-shadow-resting)}.lib-selection-options-editor__field{width:100%;background:var(--lib-forms-surface)}.lib-selection-options-editor__field+.lib-selection-options-editor__field{margin-top:1.5rem}\n"], dependencies: [{ kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],[formArray],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i1.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "ngmodule", type: MatButtonModule }, { kind: "component", type: i1$1.MatButton, selector: " button[matButton], a[matButton], button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button], a[mat-button], a[mat-raised-button], a[mat-flat-button], a[mat-stroked-button] ", inputs: ["matButton"], exportAs: ["matButton", "matAnchor"] }, { kind: "component", type: i1$1.MatIconButton, selector: "button[mat-icon-button], a[mat-icon-button], button[matIconButton], a[matIconButton]", exportAs: ["matButton", "matAnchor"] }, { kind: "ngmodule", type: MatCardModule }, { kind: "component", type: i3.MatCard, selector: "mat-card", inputs: ["appearance"], exportAs: ["matCard"] }, { kind: "directive", type: i3.MatCardActions, selector: "mat-card-actions", inputs: ["align"], exportAs: ["matCardActions"] }, { kind: "directive", type: i3.MatCardContent, selector: "mat-card-content" }, { kind: "component", type: i3.MatCardHeader, selector: "mat-card-header" }, { kind: "directive", type: i3.MatCardSubtitle, selector: "mat-card-subtitle, [mat-card-subtitle], [matCardSubtitle]" }, { kind: "ngmodule", type: MatChipsModule }, { kind: "component", type: i1$2.MatChipListbox, selector: "mat-chip-listbox", inputs: ["multiple", "aria-orientation", "selectable", "compareWith", "required", "hideSingleSelectionIndicator", "value"], outputs: ["change"] }, { kind: "component", type: i1$2.MatChipOption, selector: "mat-basic-chip-option, [mat-basic-chip-option], mat-chip-option, [mat-chip-option]", inputs: ["selectable", "selected"], outputs: ["selectionChange"] }, { kind: "directive", type: i1$2.MatChipRemove, selector: "[matChipRemove]" }, { kind: "ngmodule", type: MatFormFieldModule }, { kind: "component", type: i2.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i2.MatLabel, selector: "mat-label" }, { kind: "directive", type: i2.MatHint, selector: "mat-hint", inputs: ["align", "id"] }, { kind: "directive", type: i2.MatSuffix, selector: "[matSuffix], [matIconSuffix], [matTextSuffix]", inputs: ["matTextSuffix"] }, { kind: "ngmodule", type: MatIconModule }, { kind: "component", type: i3$1.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "ngmodule", type: MatInputModule }, { kind: "directive", type: i2$1.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly", "disabledInteractive"], exportAs: ["matInput"] }, { kind: "ngmodule", type: MatToolbarModule }, { kind: "component", type: i5.MatToolbar, selector: "mat-toolbar", inputs: ["color"], exportAs: ["matToolbar"] }, { kind: "ngmodule", type: MatTooltipModule }, { kind: "directive", type: i5$1.MatTooltip, selector: "[matTooltip]", inputs: ["matTooltipPosition", "matTooltipPositionAtOrigin", "matTooltipDisabled", "matTooltipShowDelay", "matTooltipHideDelay", "matTooltipTouchGestures", "matTooltip", "matTooltipClass"], exportAs: ["matTooltip"] }, { kind: "component", type: EmptyStateComponent, selector: "lib-empty-state", inputs: ["icon", "message"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
148
|
+
}
|
|
149
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.12", ngImport: i0, type: SelectionOptionsEditorComponent, decorators: [{
|
|
150
|
+
type: Component,
|
|
151
|
+
args: [{ selector: 'lib-selection-options-editor', changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.Emulated, host: {
|
|
152
|
+
'class': 'lib-selection-options-editor',
|
|
153
|
+
'[attr.id]': 'hostId',
|
|
154
|
+
}, imports: [
|
|
155
|
+
ReactiveFormsModule,
|
|
156
|
+
MatButtonModule,
|
|
157
|
+
MatCardModule,
|
|
158
|
+
MatChipsModule,
|
|
159
|
+
MatFormFieldModule,
|
|
160
|
+
MatIconModule,
|
|
161
|
+
MatInputModule,
|
|
162
|
+
MatToolbarModule,
|
|
163
|
+
MatTooltipModule,
|
|
164
|
+
EmptyStateComponent,
|
|
165
|
+
], template: "@if (optionList().length) {\n <mat-chip-listbox\n class=\"lib-selection-options-editor__listbox\"\n aria-label=\"Option selection\"\n [disabled]=\"disabled()\">\n @for (option of optionList(); track option.id) {\n <mat-chip-option\n class=\"lib-selection-options-editor__chip\"\n color=\"accent\"\n [value]=\"option.value\"\n [selected]=\"inEdit()?.id === option.id\"\n (click)=\"startEdit(option)\">\n {{ option.label }}\n <button\n matChipRemove\n [attr.aria-label]=\"'Remove ' + option.label\"\n (click)=\"$event.stopPropagation(); remove(option)\">\n <mat-icon>cancel</mat-icon>\n </button>\n </mat-chip-option>\n }\n </mat-chip-listbox>\n} @else if (!isEditing()) {\n <lib-empty-state icon=\"list_alt\" message=\"No options yet\" />\n}\n\n@if (!isEditing()) {\n <mat-toolbar class=\"lib-selection-options-editor__toolbar\">\n <button\n class=\"lib-selection-options-editor__add\"\n mat-stroked-button\n [disabled]=\"disabled()\"\n (click)=\"add()\">\n Add an option <mat-icon>add</mat-icon>\n </button>\n </mat-toolbar>\n} @else {\n <mat-card class=\"lib-selection-options-editor__card\" appearance=\"outlined\">\n <mat-card-header>\n <mat-card-subtitle>{{ inEdit() ? 'Edit Option' : 'Add New Option' }}</mat-card-subtitle>\n </mat-card-header>\n\n <mat-card-content>\n <form [formGroup]=\"form\">\n <mat-form-field\n class=\"lib-selection-options-editor__field\"\n subscriptSizing=\"dynamic\"\n floatLabel=\"always\"\n appearance=\"outline\">\n <mat-label>Display Text</mat-label>\n <input\n type=\"text\"\n matInput\n formControlName=\"label\"\n placeholder=\"Enter option text\"\n (blur)=\"autoFillValueFromLabel()\" />\n <mat-hint>The text users will see and select from the list.</mat-hint>\n </mat-form-field>\n\n <mat-form-field\n class=\"lib-selection-options-editor__field\"\n subscriptSizing=\"dynamic\"\n floatLabel=\"always\"\n appearance=\"outline\">\n <mat-label>Stored Value</mat-label>\n <input type=\"text\" matInput formControlName=\"value\" placeholder=\"Enter data value\" />\n <button\n matSuffix\n mat-icon-button\n matTooltip=\"Toggle auto-creation of value from display text\"\n [color]=\"isAutoCamelCase() ? 'primary' : ''\"\n (click)=\"toggleAutoCamelCase()\">\n <mat-icon>{{ isAutoCamelCase() ? 'drive_file_rename_outline' : 'edit_off' }}</mat-icon>\n </button>\n <mat-hint>The value saved when this option is chosen. (Often an ID or code)</mat-hint>\n </mat-form-field>\n </form>\n </mat-card-content>\n\n <mat-card-actions>\n <button mat-button (click)=\"closeEdit()\">Cancel</button>\n <button mat-flat-button [disabled]=\"form.invalid\" (click)=\"save()\">\n {{ inEdit() ? 'Save Changes' : 'Add Option' }}\n </button>\n </mat-card-actions>\n </mat-card>\n}\n", styles: [":host{display:flex;flex-direction:column;gap:1.5rem}.lib-selection-options-editor__listbox{display:flex;overflow-x:auto}.lib-selection-options-editor__chip{min-width:fit-content}.lib-selection-options-editor__toolbar{padding:0;background:transparent}.lib-selection-options-editor__add{width:100%}.lib-selection-options-editor__card{background:var(--lib-forms-surface);border:1px solid color-mix(in srgb,var(--lib-forms-outline) 15%,transparent);border-radius:var(--lib-forms-radius-lg, 12px);box-shadow:var(--lib-forms-shadow-resting)}.lib-selection-options-editor__field{width:100%;background:var(--lib-forms-surface)}.lib-selection-options-editor__field+.lib-selection-options-editor__field{margin-top:1.5rem}\n"] }]
|
|
166
|
+
}], propDecorators: { errors: [{ type: i0.Input, args: [{ isSignal: true, alias: "errors", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], options: [{ type: i0.Input, args: [{ isSignal: true, alias: "options", required: false }] }], valueChanged: [{ type: i0.Output, args: ["valueChanged"] }] } });
|
|
167
|
+
|
|
168
|
+
export { SelectionOptionsEditorComponent };
|
|
169
|
+
//# sourceMappingURL=ngx-t-forms-selection-options-editor.component-Dhln81DL.mjs.map
|