tuain-ng-forms-lib 14.4.91 → 14.4.95
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/esm2020/lib/classes/forms/action.mjs +2 -1
- package/esm2020/lib/classes/forms/field.mjs +2 -1
- package/esm2020/lib/classes/forms/piece-propagate.mjs +8 -1
- package/esm2020/lib/classes/forms/section.mjs +2 -1
- package/esm2020/lib/classes/forms/subsection.mjs +2 -1
- package/esm2020/lib/classes/forms/table/table.mjs +2 -1
- package/esm2020/lib/components/elements/field.component.mjs +3 -2
- package/esm2020/lib/components/elements/layout/piece.component.mjs +19 -2
- package/esm2020/lib/components/elements/tables/table.component.mjs +2 -6
- package/fesm2015/tuain-ng-forms-lib.mjs +58 -29
- package/fesm2015/tuain-ng-forms-lib.mjs.map +1 -1
- package/fesm2020/tuain-ng-forms-lib.mjs +33 -7
- package/fesm2020/tuain-ng-forms-lib.mjs.map +1 -1
- package/lib/classes/forms/piece-propagate.d.ts +2 -0
- package/lib/components/elements/field.component.d.ts +1 -1
- package/lib/components/elements/layout/piece.component.d.ts +3 -1
- package/package.json +1 -1
|
@@ -7,15 +7,32 @@ import { CommonModule } from '@angular/common';
|
|
|
7
7
|
import { RouterModule } from '@angular/router';
|
|
8
8
|
import { FormsModule } from '@angular/forms';
|
|
9
9
|
|
|
10
|
+
const CUSTOM_ATTRIBUTES = 'customAttributes';
|
|
10
11
|
class PieceComponent {
|
|
11
12
|
constructor() {
|
|
12
13
|
this.visible = true;
|
|
13
14
|
this.disabled = false;
|
|
15
|
+
this.customAttributes = {};
|
|
14
16
|
}
|
|
15
17
|
defaultProcessAttributeChange(attribute, value) {
|
|
16
|
-
attribute
|
|
18
|
+
if (!attribute || attribute.trim() === '') {
|
|
19
|
+
return false;
|
|
20
|
+
}
|
|
21
|
+
const attributeParts = attribute.split('.');
|
|
22
|
+
if (attributeParts?.length > 1) {
|
|
23
|
+
const [attributeType, subAttribute] = attributeParts;
|
|
24
|
+
if (attributeType === CUSTOM_ATTRIBUTES) {
|
|
25
|
+
this.customAttributes[subAttribute] = value;
|
|
26
|
+
this.customAttributeChange(subAttribute, value);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
else {
|
|
30
|
+
this[attribute] = value;
|
|
31
|
+
}
|
|
32
|
+
return true;
|
|
17
33
|
}
|
|
18
34
|
customProcessAttributeChange(attribute, value) { }
|
|
35
|
+
customAttributeChange(subAttribute, value) { }
|
|
19
36
|
}
|
|
20
37
|
PieceComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.6", ngImport: i0, type: PieceComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
21
38
|
PieceComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.6", type: PieceComponent, selector: "lib-piece", ngImport: i0, template: `<ng-content></ng-content>`, isInline: true });
|
|
@@ -155,8 +172,9 @@ class FieldComponent extends ElementComponent {
|
|
|
155
172
|
this.focus();
|
|
156
173
|
}
|
|
157
174
|
else {
|
|
158
|
-
|
|
175
|
+
return super.defaultProcessAttributeChange(attribute, value);
|
|
159
176
|
}
|
|
177
|
+
return true;
|
|
160
178
|
}
|
|
161
179
|
updateValue() { this.value = this.field?.value; }
|
|
162
180
|
onInputChange() { setTimeout(() => this.field?.notifyEditionPartial(), 50); }
|
|
@@ -435,15 +453,11 @@ class LibTableComponent extends ElementComponent {
|
|
|
435
453
|
tableColumnSort(columnName, direction = null) { this.table?.sort(columnName, direction ?? 'ascend'); }
|
|
436
454
|
globalFilterChanged() { this.table?.setGlobalFilterString(this.globalFilterString?.trim() ?? '', false); }
|
|
437
455
|
defaultProcessAttributeChange(attribute, value) {
|
|
438
|
-
if (!attribute) {
|
|
439
|
-
return false;
|
|
440
|
-
}
|
|
441
456
|
try {
|
|
442
457
|
if (attribute === 'visibleRecords') {
|
|
443
458
|
this.updateTableData();
|
|
444
459
|
}
|
|
445
|
-
|
|
446
|
-
return true;
|
|
460
|
+
return super.defaultProcessAttributeChange(attribute, value);
|
|
447
461
|
}
|
|
448
462
|
catch {
|
|
449
463
|
return false;
|
|
@@ -601,12 +615,19 @@ const DISABLED = 'disabled';
|
|
|
601
615
|
class FormPiecePropagate extends FormPiece {
|
|
602
616
|
constructor(pieceDefinition, formConfig) {
|
|
603
617
|
super(pieceDefinition, formConfig);
|
|
618
|
+
this.propagationCustomAttributes = [];
|
|
604
619
|
this._attributeChange = new BehaviorSubject(null);
|
|
605
620
|
}
|
|
606
621
|
get attributeChange() { return this._attributeChange; }
|
|
607
622
|
propagateAttribute(name, value) {
|
|
608
623
|
this._attributeChange?.next({ name, value });
|
|
609
624
|
}
|
|
625
|
+
setCustomAttribute(name, value) {
|
|
626
|
+
super.setCustomAttribute(name, value);
|
|
627
|
+
if (this.propagationCustomAttributes?.includes(name)) {
|
|
628
|
+
this.propagateAttribute(name, value);
|
|
629
|
+
}
|
|
630
|
+
}
|
|
610
631
|
setVisibility(visible, forced = null) {
|
|
611
632
|
super.setVisibility(visible, forced);
|
|
612
633
|
this.propagateAttribute(VISIBLE, this._visible);
|
|
@@ -654,6 +675,7 @@ class FormAction extends FormElement {
|
|
|
654
675
|
super(actionDefinition, formConfig);
|
|
655
676
|
this._actionActivated = new Subject();
|
|
656
677
|
this.inProgress = false;
|
|
678
|
+
this.propagationCustomAttributes = this._formConfig?.propagationCustomAttributes?.actions ?? [];
|
|
657
679
|
this.elementType = elementTypes.action;
|
|
658
680
|
this.actionCode = actionDefinition.actionCode ? actionDefinition.actionCode.toString() : '';
|
|
659
681
|
this.actionName = actionDefinition.actionTitle;
|
|
@@ -751,6 +773,7 @@ class FieldDescriptor extends FormElement {
|
|
|
751
773
|
this._hasChanged = false;
|
|
752
774
|
this._outputOnly = false;
|
|
753
775
|
this._tooltipText = '';
|
|
776
|
+
this.propagationCustomAttributes = this._formConfig?.propagationCustomAttributes?.fields ?? [];
|
|
754
777
|
this.elementType = elementTypes.field;
|
|
755
778
|
const fld = (inputFieldReceived) ? inputFieldReceived : {};
|
|
756
779
|
this.setAttr(attrs$1._fieldCode, fld.fieldCode);
|
|
@@ -1364,6 +1387,7 @@ class RecordTable extends FormElement {
|
|
|
1364
1387
|
this.totalRecordsNumber = 0;
|
|
1365
1388
|
this.recordsNumber = 0;
|
|
1366
1389
|
this.clientPaging = true;
|
|
1390
|
+
this.propagationCustomAttributes = this._formConfig?.propagationCustomAttributes?.tables ?? [];
|
|
1367
1391
|
this.elementType = elementTypes.table;
|
|
1368
1392
|
this.waiting = false;
|
|
1369
1393
|
this.currentPage = 1;
|
|
@@ -1747,6 +1771,7 @@ class RecordFormSubSection extends FormPiecePropagate {
|
|
|
1747
1771
|
this.subSectionActions = [];
|
|
1748
1772
|
this.elementsArray = {};
|
|
1749
1773
|
this.active = false;
|
|
1774
|
+
this.propagationCustomAttributes = this._formConfig?.propagationCustomAttributes?.subsections ?? [];
|
|
1750
1775
|
if (!subsectionReceived) {
|
|
1751
1776
|
return;
|
|
1752
1777
|
}
|
|
@@ -1824,6 +1849,7 @@ class RecordFormSection extends FormPiecePropagate {
|
|
|
1824
1849
|
this.sectionTitle = null;
|
|
1825
1850
|
this.subSections = [];
|
|
1826
1851
|
this._exclusiveSubSectionsByAttr = {};
|
|
1852
|
+
this.propagationCustomAttributes = this._formConfig?.propagationCustomAttributes?.sections ?? [];
|
|
1827
1853
|
if (!sectionReceived) {
|
|
1828
1854
|
return;
|
|
1829
1855
|
}
|