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
|
@@ -125,23 +125,36 @@ class FieldComponent extends ElementComponent {
|
|
|
125
125
|
this.field = null;
|
|
126
126
|
}
|
|
127
127
|
ngOnInit() {
|
|
128
|
-
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
128
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
129
129
|
if (!this.field) {
|
|
130
130
|
return;
|
|
131
131
|
}
|
|
132
132
|
this.formConfig = (_a = this.field) === null || _a === void 0 ? void 0 : _a._formConfig;
|
|
133
133
|
const mapping = Object.entries((_b = this.formConfig) === null || _b === void 0 ? void 0 : _b.fieldPropagateAttributes);
|
|
134
|
+
const customAttributesMapping = (_d = (_c = this.formConfig) === null || _c === void 0 ? void 0 : _c.propagationCustomAttributes.fields) !== null && _d !== void 0 ? _d : [];
|
|
134
135
|
for (let index = 0; index < mapping.length; index++) {
|
|
135
|
-
const fieldAttr = (
|
|
136
|
-
const componentAttr = (
|
|
136
|
+
const fieldAttr = (_e = mapping[index]) === null || _e === void 0 ? void 0 : _e[0];
|
|
137
|
+
const componentAttr = (_h = (_g = (_f = mapping[index]) === null || _f === void 0 ? void 0 : _f[1]) === null || _g === void 0 ? void 0 : _g.toString()) !== null && _h !== void 0 ? _h : '';
|
|
137
138
|
if (componentAttr) {
|
|
138
|
-
const value = (
|
|
139
|
+
const value = (_j = this.field) === null || _j === void 0 ? void 0 : _j[fieldAttr];
|
|
139
140
|
this.defaultProcessAttributeChange(componentAttr, value);
|
|
140
141
|
this.customProcessAttributeChange(componentAttr, value);
|
|
141
142
|
}
|
|
142
143
|
}
|
|
144
|
+
// Atributos personalizados
|
|
145
|
+
for (let index = 0; index < customAttributesMapping.length; index++) {
|
|
146
|
+
const customAttribute = customAttributesMapping[index];
|
|
147
|
+
if (customAttribute) {
|
|
148
|
+
const value = (_k = this.field) === null || _k === void 0 ? void 0 : _k.getCustomAttribute(customAttribute);
|
|
149
|
+
const fullName = `customAttributes.${customAttribute}`;
|
|
150
|
+
if (value) {
|
|
151
|
+
this.defaultProcessAttributeChange(fullName, value);
|
|
152
|
+
this.customProcessAttributeChange(fullName, value);
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
}
|
|
143
156
|
// Subscripción a cambios en atributos
|
|
144
|
-
(
|
|
157
|
+
(_l = this.field) === null || _l === void 0 ? void 0 : _l.attributeChange.subscribe(event => {
|
|
145
158
|
const { name: componentAttr, value } = event;
|
|
146
159
|
this.defaultProcessAttributeChange(componentAttr, value);
|
|
147
160
|
this.customProcessAttributeChange(componentAttr, value);
|
|
@@ -308,10 +321,11 @@ const INLINE_ACTION$1 = 'INLINE';
|
|
|
308
321
|
class LibTableRecordActionComponent extends PieceComponent {
|
|
309
322
|
constructor() {
|
|
310
323
|
super(...arguments);
|
|
324
|
+
this.isVisible = true;
|
|
311
325
|
this.actionSelected = new EventEmitter();
|
|
312
326
|
}
|
|
313
327
|
ngOnInit() {
|
|
314
|
-
var _a, _b, _c
|
|
328
|
+
var _a, _b, _c;
|
|
315
329
|
this.formConfig = (_a = this.action) === null || _a === void 0 ? void 0 : _a._formConfig;
|
|
316
330
|
const mapping = (_b = this.formConfig) === null || _b === void 0 ? void 0 : _b.actionPropagateAttributes;
|
|
317
331
|
for (let index = 0; index < mapping.length; index++) {
|
|
@@ -320,21 +334,26 @@ class LibTableRecordActionComponent extends PieceComponent {
|
|
|
320
334
|
this.defaultProcessAttributeChange(attrName, attributeValue);
|
|
321
335
|
this.customProcessAttributeChange(attrName, attributeValue);
|
|
322
336
|
}
|
|
323
|
-
// Subscripción a cambios en atributos
|
|
324
|
-
(_d = this.action) === null || _d === void 0 ? void 0 : _d.attributeChange.subscribe(event => {
|
|
325
|
-
const { name: attrName, value } = event;
|
|
326
|
-
this.defaultProcessAttributeChange(attrName, value);
|
|
327
|
-
this.customProcessAttributeChange(attrName, value);
|
|
328
|
-
});
|
|
329
337
|
this.start();
|
|
330
338
|
}
|
|
331
339
|
start() {
|
|
332
|
-
|
|
333
|
-
|
|
340
|
+
if (this.action && this.action.restrictedOnField && this.recordData) {
|
|
341
|
+
const relatedField = this.recordData[this.action.restrictedOnField];
|
|
342
|
+
if (relatedField) {
|
|
343
|
+
const fieldValue = relatedField;
|
|
344
|
+
const restrictionOper = this.action.restrictedOnOperator;
|
|
345
|
+
const restrictionValue = this.action.restrictedOnValue;
|
|
346
|
+
if ((restrictionOper === '==' && fieldValue !== restrictionValue)
|
|
347
|
+
|| (restrictionOper === '!=' && fieldValue === restrictionValue)) {
|
|
348
|
+
this.isVisible = false;
|
|
349
|
+
}
|
|
350
|
+
}
|
|
351
|
+
}
|
|
334
352
|
}
|
|
335
353
|
onActivate() {
|
|
354
|
+
var _a, _b;
|
|
336
355
|
const tableEvent = {
|
|
337
|
-
actionCode: this.action.actionCode,
|
|
356
|
+
actionCode: (_b = (_a = this.action) === null || _a === void 0 ? void 0 : _a.actionCode) !== null && _b !== void 0 ? _b : '',
|
|
338
357
|
recordId: this.recordId,
|
|
339
358
|
recordData: this.recordData,
|
|
340
359
|
};
|
|
@@ -619,7 +638,8 @@ class FormPiecePropagate extends FormPiece {
|
|
|
619
638
|
var _a;
|
|
620
639
|
super.setCustomAttribute(name, value);
|
|
621
640
|
if ((_a = this.propagationCustomAttributes) === null || _a === void 0 ? void 0 : _a.includes(name)) {
|
|
622
|
-
|
|
641
|
+
const fullName = `customAttributes.${name}`;
|
|
642
|
+
this.propagateAttribute(fullName, value);
|
|
623
643
|
}
|
|
624
644
|
}
|
|
625
645
|
setVisibility(visible, forced = null) {
|
|
@@ -680,6 +700,24 @@ class FormAction extends FormElement {
|
|
|
680
700
|
}
|
|
681
701
|
this.customValidation = () => true;
|
|
682
702
|
}
|
|
703
|
+
connectWithParentForm(form, formChangeSubject) {
|
|
704
|
+
var _a;
|
|
705
|
+
super.connectWithParentForm(form, formChangeSubject);
|
|
706
|
+
if (this.restrictedOnField) {
|
|
707
|
+
const relatedField = (_a = this._form.fields) === null || _a === void 0 ? void 0 : _a[this.restrictedOnField];
|
|
708
|
+
if (relatedField) {
|
|
709
|
+
relatedField.editionFinish.subscribe(event => this.updateRestrictedVisibility());
|
|
710
|
+
relatedField.editionPartial.subscribe(event => this.updateRestrictedVisibility());
|
|
711
|
+
}
|
|
712
|
+
}
|
|
713
|
+
}
|
|
714
|
+
updateRestrictedVisibility() {
|
|
715
|
+
const lastVisible = this._visible;
|
|
716
|
+
const newVisible = this._absoluteVisible && this.viewOnState(this._formState);
|
|
717
|
+
if (lastVisible !== newVisible) {
|
|
718
|
+
this.setVisibility(newVisible);
|
|
719
|
+
}
|
|
720
|
+
}
|
|
683
721
|
viewOnState(state) {
|
|
684
722
|
var _a;
|
|
685
723
|
const actionVisible = (this.visibleStates && state) ? this.visibleStates.includes(state) : false;
|
|
@@ -1243,26 +1281,6 @@ class TableAction extends FormPiece {
|
|
|
1243
1281
|
this.restrictedOnOperator = actionDefinition.operatorRestricted || null;
|
|
1244
1282
|
}
|
|
1245
1283
|
}
|
|
1246
|
-
viewOnState(state) {
|
|
1247
|
-
var _a;
|
|
1248
|
-
const actionVisible = (this.visibleStates && state) ? this.visibleStates.includes(state) : false;
|
|
1249
|
-
if (actionVisible && this._form && this.restrictedOnField) {
|
|
1250
|
-
// Aqui se debe cambiar el campo por la columna del registro!!!!!
|
|
1251
|
-
// const relatedField = this._form.fields?.[this.restrictedOnField];
|
|
1252
|
-
const relatedField = (_a = this.recordData) === null || _a === void 0 ? void 0 : _a[this.restrictedOnField];
|
|
1253
|
-
if (relatedField) {
|
|
1254
|
-
const fieldValue = relatedField.value;
|
|
1255
|
-
if ((this.restrictedOnOperator === '==' && fieldValue !== this.restrictedOnValue)
|
|
1256
|
-
|| (this.restrictedOnOperator === '!=' && fieldValue === this.restrictedOnValue)) {
|
|
1257
|
-
return false;
|
|
1258
|
-
}
|
|
1259
|
-
}
|
|
1260
|
-
}
|
|
1261
|
-
return actionVisible;
|
|
1262
|
-
}
|
|
1263
|
-
setRecodData(recordData) {
|
|
1264
|
-
this.recordData = recordData;
|
|
1265
|
-
}
|
|
1266
1284
|
}
|
|
1267
1285
|
|
|
1268
1286
|
class TableRecordData {
|
|
@@ -2553,6 +2571,7 @@ class LibFileManagementService {
|
|
|
2553
2571
|
openFile(fileBase64Data, fileName, fileType) { }
|
|
2554
2572
|
saveFileFromURL(fileUrl, fullFileName = null) { }
|
|
2555
2573
|
saveFile(fileBase64Data, fileName, fileType) { }
|
|
2574
|
+
printPdfFile(pdfBufferData) { }
|
|
2556
2575
|
}
|
|
2557
2576
|
|
|
2558
2577
|
const PAYLOAD_VERSION = 'TUAINEXCHANGE_1.0';
|