tuain-ng-forms-lib 14.5.10 → 14.5.25
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 +18 -1
- package/esm2020/lib/classes/forms/field.mjs +1 -1
- package/esm2020/lib/classes/forms/piece-propagate.mjs +3 -2
- package/esm2020/lib/classes/forms/table/action.mjs +1 -20
- package/esm2020/lib/components/elements/field.component.mjs +14 -1
- package/esm2020/lib/components/elements/tables/table-record-action.component.mjs +15 -9
- package/esm2020/lib/services/file-manager.service.mjs +2 -1
- package/fesm2015/tuain-ng-forms-lib.mjs +55 -36
- package/fesm2015/tuain-ng-forms-lib.mjs.map +1 -1
- package/fesm2020/tuain-ng-forms-lib.mjs +47 -28
- package/fesm2020/tuain-ng-forms-lib.mjs.map +1 -1
- package/lib/classes/forms/action.d.ts +2 -0
- package/lib/classes/forms/table/action.d.ts +0 -3
- package/lib/components/elements/tables/table-record-action.component.d.ts +3 -1
- package/lib/services/file-manager.service.d.ts +1 -0
- package/package.json +1 -1
|
@@ -126,6 +126,7 @@ class FieldComponent extends ElementComponent {
|
|
|
126
126
|
}
|
|
127
127
|
this.formConfig = this.field?._formConfig;
|
|
128
128
|
const mapping = Object.entries(this.formConfig?.fieldPropagateAttributes);
|
|
129
|
+
const customAttributesMapping = this.formConfig?.propagationCustomAttributes.fields ?? [];
|
|
129
130
|
for (let index = 0; index < mapping.length; index++) {
|
|
130
131
|
const fieldAttr = mapping[index]?.[0];
|
|
131
132
|
const componentAttr = mapping[index]?.[1]?.toString() ?? '';
|
|
@@ -135,6 +136,18 @@ class FieldComponent extends ElementComponent {
|
|
|
135
136
|
this.customProcessAttributeChange(componentAttr, value);
|
|
136
137
|
}
|
|
137
138
|
}
|
|
139
|
+
// Atributos personalizados
|
|
140
|
+
for (let index = 0; index < customAttributesMapping.length; index++) {
|
|
141
|
+
const customAttribute = customAttributesMapping[index];
|
|
142
|
+
if (customAttribute) {
|
|
143
|
+
const value = this.field?.getCustomAttribute(customAttribute);
|
|
144
|
+
const fullName = `customAttributes.${customAttribute}`;
|
|
145
|
+
if (value) {
|
|
146
|
+
this.defaultProcessAttributeChange(fullName, value);
|
|
147
|
+
this.customProcessAttributeChange(fullName, value);
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
}
|
|
138
151
|
// Subscripción a cambios en atributos
|
|
139
152
|
this.field?.attributeChange.subscribe(event => {
|
|
140
153
|
const { name: componentAttr, value } = event;
|
|
@@ -298,6 +311,7 @@ const INLINE_ACTION$1 = 'INLINE';
|
|
|
298
311
|
class LibTableRecordActionComponent extends PieceComponent {
|
|
299
312
|
constructor() {
|
|
300
313
|
super(...arguments);
|
|
314
|
+
this.isVisible = true;
|
|
301
315
|
this.actionSelected = new EventEmitter();
|
|
302
316
|
}
|
|
303
317
|
ngOnInit() {
|
|
@@ -309,20 +323,25 @@ class LibTableRecordActionComponent extends PieceComponent {
|
|
|
309
323
|
this.defaultProcessAttributeChange(attrName, attributeValue);
|
|
310
324
|
this.customProcessAttributeChange(attrName, attributeValue);
|
|
311
325
|
}
|
|
312
|
-
// Subscripción a cambios en atributos
|
|
313
|
-
this.action?.attributeChange.subscribe(event => {
|
|
314
|
-
const { name: attrName, value } = event;
|
|
315
|
-
this.defaultProcessAttributeChange(attrName, value);
|
|
316
|
-
this.customProcessAttributeChange(attrName, value);
|
|
317
|
-
});
|
|
318
326
|
this.start();
|
|
319
327
|
}
|
|
320
328
|
start() {
|
|
321
|
-
this.action
|
|
329
|
+
if (this.action && this.action.restrictedOnField && this.recordData) {
|
|
330
|
+
const relatedField = this.recordData[this.action.restrictedOnField];
|
|
331
|
+
if (relatedField) {
|
|
332
|
+
const fieldValue = relatedField;
|
|
333
|
+
const restrictionOper = this.action.restrictedOnOperator;
|
|
334
|
+
const restrictionValue = this.action.restrictedOnValue;
|
|
335
|
+
if ((restrictionOper === '==' && fieldValue !== restrictionValue)
|
|
336
|
+
|| (restrictionOper === '!=' && fieldValue === restrictionValue)) {
|
|
337
|
+
this.isVisible = false;
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
}
|
|
322
341
|
}
|
|
323
342
|
onActivate() {
|
|
324
343
|
const tableEvent = {
|
|
325
|
-
actionCode: this.action
|
|
344
|
+
actionCode: this.action?.actionCode ?? '',
|
|
326
345
|
recordId: this.recordId,
|
|
327
346
|
recordData: this.recordData,
|
|
328
347
|
};
|
|
@@ -601,7 +620,8 @@ class FormPiecePropagate extends FormPiece {
|
|
|
601
620
|
setCustomAttribute(name, value) {
|
|
602
621
|
super.setCustomAttribute(name, value);
|
|
603
622
|
if (this.propagationCustomAttributes?.includes(name)) {
|
|
604
|
-
|
|
623
|
+
const fullName = `customAttributes.${name}`;
|
|
624
|
+
this.propagateAttribute(fullName, value);
|
|
605
625
|
}
|
|
606
626
|
}
|
|
607
627
|
setVisibility(visible, forced = null) {
|
|
@@ -661,6 +681,23 @@ class FormAction extends FormElement {
|
|
|
661
681
|
}
|
|
662
682
|
this.customValidation = () => true;
|
|
663
683
|
}
|
|
684
|
+
connectWithParentForm(form, formChangeSubject) {
|
|
685
|
+
super.connectWithParentForm(form, formChangeSubject);
|
|
686
|
+
if (this.restrictedOnField) {
|
|
687
|
+
const relatedField = this._form.fields?.[this.restrictedOnField];
|
|
688
|
+
if (relatedField) {
|
|
689
|
+
relatedField.editionFinish.subscribe(event => this.updateRestrictedVisibility());
|
|
690
|
+
relatedField.editionPartial.subscribe(event => this.updateRestrictedVisibility());
|
|
691
|
+
}
|
|
692
|
+
}
|
|
693
|
+
}
|
|
694
|
+
updateRestrictedVisibility() {
|
|
695
|
+
const lastVisible = this._visible;
|
|
696
|
+
const newVisible = this._absoluteVisible && this.viewOnState(this._formState);
|
|
697
|
+
if (lastVisible !== newVisible) {
|
|
698
|
+
this.setVisibility(newVisible);
|
|
699
|
+
}
|
|
700
|
+
}
|
|
664
701
|
viewOnState(state) {
|
|
665
702
|
const actionVisible = (this.visibleStates && state) ? this.visibleStates.includes(state) : false;
|
|
666
703
|
if (actionVisible && this._form && this.restrictedOnField) {
|
|
@@ -1214,25 +1251,6 @@ class TableAction extends FormPiece {
|
|
|
1214
1251
|
this.restrictedOnOperator = actionDefinition.operatorRestricted || null;
|
|
1215
1252
|
}
|
|
1216
1253
|
}
|
|
1217
|
-
viewOnState(state) {
|
|
1218
|
-
const actionVisible = (this.visibleStates && state) ? this.visibleStates.includes(state) : false;
|
|
1219
|
-
if (actionVisible && this._form && this.restrictedOnField) {
|
|
1220
|
-
// Aqui se debe cambiar el campo por la columna del registro!!!!!
|
|
1221
|
-
// const relatedField = this._form.fields?.[this.restrictedOnField];
|
|
1222
|
-
const relatedField = this.recordData?.[this.restrictedOnField];
|
|
1223
|
-
if (relatedField) {
|
|
1224
|
-
const fieldValue = relatedField.value;
|
|
1225
|
-
if ((this.restrictedOnOperator === '==' && fieldValue !== this.restrictedOnValue)
|
|
1226
|
-
|| (this.restrictedOnOperator === '!=' && fieldValue === this.restrictedOnValue)) {
|
|
1227
|
-
return false;
|
|
1228
|
-
}
|
|
1229
|
-
}
|
|
1230
|
-
}
|
|
1231
|
-
return actionVisible;
|
|
1232
|
-
}
|
|
1233
|
-
setRecodData(recordData) {
|
|
1234
|
-
this.recordData = recordData;
|
|
1235
|
-
}
|
|
1236
1254
|
}
|
|
1237
1255
|
|
|
1238
1256
|
class TableRecordData {
|
|
@@ -2500,6 +2518,7 @@ class LibFileManagementService {
|
|
|
2500
2518
|
openFile(fileBase64Data, fileName, fileType) { }
|
|
2501
2519
|
saveFileFromURL(fileUrl, fullFileName = null) { }
|
|
2502
2520
|
saveFile(fileBase64Data, fileName, fileType) { }
|
|
2521
|
+
printPdfFile(pdfBufferData) { }
|
|
2503
2522
|
}
|
|
2504
2523
|
|
|
2505
2524
|
const PAYLOAD_VERSION = 'TUAINEXCHANGE_1.0';
|