tuain-ng-forms-lib 14.4.45 → 14.4.90
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/element.mjs +3 -3
- package/esm2020/lib/classes/forms/field.mjs +5 -5
- package/esm2020/lib/classes/forms/form.mjs +6 -6
- package/esm2020/lib/classes/forms/piece-propagate.mjs +30 -0
- package/esm2020/lib/classes/forms/piece.mjs +26 -46
- package/esm2020/lib/classes/forms/section.mjs +23 -20
- package/esm2020/lib/classes/forms/subsection.mjs +16 -3
- package/esm2020/lib/classes/forms/table/column.mjs +5 -2
- package/esm2020/lib/classes/forms/table/row-data.mjs +14 -9
- package/esm2020/lib/classes/forms/table/table.mjs +17 -10
- package/esm2020/lib/components/elements/field.component.mjs +3 -3
- package/esm2020/lib/components/elements/tables/table.component.mjs +3 -27
- package/esm2020/lib/components/forms/basic-form.mjs +2 -2
- package/fesm2015/tuain-ng-forms-lib.mjs +144 -130
- package/fesm2015/tuain-ng-forms-lib.mjs.map +1 -1
- package/fesm2020/tuain-ng-forms-lib.mjs +134 -118
- package/fesm2020/tuain-ng-forms-lib.mjs.map +1 -1
- package/lib/classes/forms/element.d.ts +2 -2
- package/lib/classes/forms/piece-propagate.d.ts +11 -0
- package/lib/classes/forms/piece.d.ts +11 -13
- package/lib/classes/forms/section.d.ts +5 -3
- package/lib/classes/forms/subsection.d.ts +5 -2
- package/lib/classes/forms/table/column.d.ts +2 -0
- package/lib/classes/forms/table/row-data.d.ts +1 -1
- package/lib/classes/forms/table/table.d.ts +3 -2
- package/lib/components/elements/field.component.d.ts +1 -1
- package/lib/components/elements/tables/table.component.d.ts +0 -8
- package/package.json +1 -1
|
@@ -163,13 +163,13 @@ class FieldComponent extends ElementComponent {
|
|
|
163
163
|
onChangeContent() { setTimeout(() => this.field?.notifyEditionFinish(), 50); }
|
|
164
164
|
onShowInfo(detail = null) { setTimeout(() => this.field?.notifyEditionDetailRequest(detail), 50); }
|
|
165
165
|
focus() { }
|
|
166
|
-
updateObject() { this.field?.setValue(this.value); }
|
|
166
|
+
updateObject(widgetUpdate = true) { this.field?.setValue(this.value, widgetUpdate); }
|
|
167
167
|
inputChanged() {
|
|
168
168
|
this.field?.setValue(this.value);
|
|
169
169
|
this.onChangeContent();
|
|
170
170
|
}
|
|
171
171
|
inputTyped() {
|
|
172
|
-
this.
|
|
172
|
+
this.updateObject(false);
|
|
173
173
|
this.onInputChange();
|
|
174
174
|
}
|
|
175
175
|
numberInputValidation(event) {
|
|
@@ -385,18 +385,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.6", ngImpor
|
|
|
385
385
|
type: Input
|
|
386
386
|
}] } });
|
|
387
387
|
|
|
388
|
-
const changeViewAttributes = ['visibleRecords', 'currentPage', 'recordsPerPage'];
|
|
389
388
|
class LibTableComponent extends ElementComponent {
|
|
390
389
|
constructor() {
|
|
391
390
|
super(...arguments);
|
|
392
|
-
this.currentPage = 1;
|
|
393
|
-
this.globalSearch = false;
|
|
394
391
|
this.globalFilterString = '';
|
|
395
|
-
// visibleRecords: any[] = [];
|
|
396
|
-
this.selectedRecords = [];
|
|
397
|
-
this.totalRecordsNumber = 0;
|
|
398
|
-
this.allSelected = false;
|
|
399
|
-
this.layout = '';
|
|
400
392
|
this.loaded = false;
|
|
401
393
|
this.selectable = false;
|
|
402
394
|
this.hasActions = false;
|
|
@@ -416,7 +408,7 @@ class LibTableComponent extends ElementComponent {
|
|
|
416
408
|
this.globalActions = this.table?.getActions(this.formConfig?.tableActions.global);
|
|
417
409
|
this.selectionActions = this.table?.getActions(this.formConfig?.tableActions.selection);
|
|
418
410
|
// Inicialización de campos mapeados del objeto
|
|
419
|
-
const mapping = Object.entries(this.formConfig?.
|
|
411
|
+
const mapping = Object.entries(this.formConfig?.tablePropagationAttributes);
|
|
420
412
|
for (let index = 0; index < mapping.length; index++) {
|
|
421
413
|
const tableAttr = mapping[index]?.[0];
|
|
422
414
|
const componentAttr = mapping[index]?.[1]?.toString() ?? '';
|
|
@@ -430,30 +422,14 @@ class LibTableComponent extends ElementComponent {
|
|
|
430
422
|
this.defaultProcessAttributeChange(attrName, value);
|
|
431
423
|
this.customProcessAttributeChange(attrName, value);
|
|
432
424
|
});
|
|
433
|
-
// Suscripción a los cambios de atributos de las columnas
|
|
434
|
-
// this.table.columns.forEach(column => {
|
|
435
|
-
// mapping = this.formConfig?.tableColumnPropagateAttributes;
|
|
436
|
-
// for (let index = 0; index < mapping.length; index++) {
|
|
437
|
-
// const attrName = mapping[index].toString();
|
|
438
|
-
// const attributeValue = column?.[attrName];
|
|
439
|
-
// this.defaultColumnAttributeChange(column, attrName, attributeValue);
|
|
440
|
-
// }
|
|
441
|
-
// column?.attributeChange.subscribe(event => {
|
|
442
|
-
// const { name: attrName, value } = event;
|
|
443
|
-
// this.defaultColumnAttributeChange(column, attrName, value);
|
|
444
|
-
// });
|
|
445
|
-
// });
|
|
446
425
|
this.start();
|
|
447
426
|
}
|
|
448
|
-
// defaultColumnAttributeChange(column: any, attribute: string, value?: any) {
|
|
449
|
-
// attribute && (column[attribute] = value);
|
|
450
|
-
// }
|
|
451
427
|
updateTableData() { }
|
|
452
428
|
tableGlobalAction(actionCode) { this.table?.notifyGlobalAction(actionCode); }
|
|
453
429
|
tableSelectionAction(actionCode) { this.table?.notifySelectionAction(actionCode); }
|
|
454
430
|
tableActionSelected(actionEvent) { this.table?.notifyInlineAction(actionEvent); }
|
|
455
431
|
tableSelectionToggle(recordId) { this.table?.notifyRecordSelection(recordId); }
|
|
456
|
-
toggleSelectAll() { return (this.allSelected) ? this.table?.unSelectAll() : this.table?.selectAll(); }
|
|
432
|
+
toggleSelectAll() { return (this.table?.allSelected) ? this.table?.unSelectAll() : this.table?.selectAll(); }
|
|
457
433
|
globalFilterCompleted() { this.changePage(1); }
|
|
458
434
|
changePage(requestedPage) { this.table?.changePage(requestedPage); }
|
|
459
435
|
tableColumnSort(columnName, direction = null) { this.table?.sort(columnName, direction ?? 'ascend'); }
|
|
@@ -527,14 +503,13 @@ const operators = {
|
|
|
527
503
|
|
|
528
504
|
class FormPiece {
|
|
529
505
|
constructor(pieceDefinition, formConfig) {
|
|
530
|
-
this._attributeChange = new BehaviorSubject(null);
|
|
531
506
|
this._formState = '';
|
|
532
|
-
this.
|
|
533
|
-
this.
|
|
507
|
+
this._absoluteVisible = true;
|
|
508
|
+
this._absoluteDisabled = false;
|
|
534
509
|
this.visibleStates = null;
|
|
535
510
|
this.enabledStates = null;
|
|
536
|
-
this.
|
|
537
|
-
this.
|
|
511
|
+
this._visible = true;
|
|
512
|
+
this._disabled = false;
|
|
538
513
|
this.customAttributes = {};
|
|
539
514
|
this._formConfig = formConfig;
|
|
540
515
|
this._isForced = false;
|
|
@@ -559,10 +534,6 @@ class FormPiece {
|
|
|
559
534
|
});
|
|
560
535
|
}
|
|
561
536
|
matchAttribute(name, value) { return this.customAttributes?.[name] === value; }
|
|
562
|
-
get attributeChange() { return this._attributeChange; }
|
|
563
|
-
propagateAttribute(name, value) {
|
|
564
|
-
this._attributeChange.next({ name, value });
|
|
565
|
-
}
|
|
566
537
|
setVisibleStates(newStates) {
|
|
567
538
|
const visibleStates = (!Array.isArray(newStates) && typeof newStates === 'string')
|
|
568
539
|
? newStates.split(',').map(state => state.trim()).filter(state => state.length > 0)
|
|
@@ -577,26 +548,23 @@ class FormPiece {
|
|
|
577
548
|
}
|
|
578
549
|
viewOnState(state) { return (this.visibleStates && state) ? this.visibleStates.includes(state) : false; }
|
|
579
550
|
enabledOnState(state) { return (this.enabledStates && state) ? this.enabledStates.includes(state) : false; }
|
|
551
|
+
get absoluteVisible() { return this._absoluteVisible; }
|
|
552
|
+
get absoluteDisabled() { return this._absoluteDisabled; }
|
|
580
553
|
get visible() { return this._visible; }
|
|
581
554
|
set visible(visible) { this.setVisibility(visible); }
|
|
582
555
|
visibleOn(state) {
|
|
583
|
-
return this.
|
|
556
|
+
return this._absoluteVisible && this.viewOnState(state);
|
|
584
557
|
}
|
|
585
558
|
enabledOn(state) {
|
|
586
|
-
return !this.
|
|
559
|
+
return !this._absoluteDisabled && this.enabledOnState(state);
|
|
587
560
|
}
|
|
588
561
|
setVisibility(visible, forced = null) {
|
|
589
|
-
this.
|
|
590
|
-
this.propagateVisible();
|
|
562
|
+
this._absoluteVisible = !!visible;
|
|
591
563
|
if (forced !== null) {
|
|
592
564
|
this._isForced = forced;
|
|
593
565
|
this._visibleForced = visible;
|
|
594
566
|
}
|
|
595
|
-
|
|
596
|
-
this.visibleOnState = this.visible && this.viewOnState(this._formState);
|
|
597
|
-
if (formerVisibleOnState !== this.visibleOnState) {
|
|
598
|
-
this.propagateAttribute('visible', this.visibleOnState);
|
|
599
|
-
}
|
|
567
|
+
this._visible = this._absoluteVisible && this.viewOnState(this._formState);
|
|
600
568
|
}
|
|
601
569
|
show(forced = null) {
|
|
602
570
|
this.setVisibility(true, forced);
|
|
@@ -604,42 +572,59 @@ class FormPiece {
|
|
|
604
572
|
hide(forced = null) {
|
|
605
573
|
this.setVisibility(false, forced);
|
|
606
574
|
}
|
|
607
|
-
get disabled() { return this._disabled; }
|
|
608
575
|
get enabled() { return !this._disabled; }
|
|
609
|
-
get editable() { return !this._disabled; }
|
|
610
576
|
set enabled(enabled) {
|
|
611
|
-
this.
|
|
612
|
-
|
|
613
|
-
this.disabledOnState = this._disabled || !this.enabledOnState(this._formState);
|
|
614
|
-
if (formerDisableOnState !== this.disabledOnState) {
|
|
615
|
-
this.propagateDisabled();
|
|
616
|
-
}
|
|
577
|
+
this._absoluteDisabled = !enabled;
|
|
578
|
+
this._disabled = this._absoluteDisabled || !this.enabledOnState(this._formState);
|
|
617
579
|
}
|
|
580
|
+
get editable() { return !this._disabled; }
|
|
581
|
+
get disabled() { return this._disabled; }
|
|
582
|
+
set disabled(disabled) { this.enabled = !disabled; }
|
|
618
583
|
enable() { this.enabled = true; }
|
|
619
584
|
disable() { this.enabled = false; }
|
|
585
|
+
formStateChangeCustomSubscribe(formChangeSubject) { }
|
|
586
|
+
formStateChange(state) {
|
|
587
|
+
if (state) {
|
|
588
|
+
this._formState = state;
|
|
589
|
+
this._visible = this._absoluteVisible && this.viewOnState(state);
|
|
590
|
+
this._disabled = this._absoluteDisabled || !this.enabledOnState(state);
|
|
591
|
+
}
|
|
592
|
+
}
|
|
620
593
|
subscribeFormStateChange(formChangeSubject) {
|
|
621
|
-
this.
|
|
622
|
-
formChangeSubject.subscribe(event =>
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
594
|
+
this.formStateChangeCustomSubscribe(formChangeSubject);
|
|
595
|
+
formChangeSubject.subscribe(event => this.formStateChange(event?.state));
|
|
596
|
+
}
|
|
597
|
+
}
|
|
598
|
+
|
|
599
|
+
const VISIBLE = 'visible';
|
|
600
|
+
const DISABLED = 'disabled';
|
|
601
|
+
class FormPiecePropagate extends FormPiece {
|
|
602
|
+
constructor(pieceDefinition, formConfig) {
|
|
603
|
+
super(pieceDefinition, formConfig);
|
|
604
|
+
this._attributeChange = new BehaviorSubject(null);
|
|
632
605
|
}
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
this.
|
|
606
|
+
get attributeChange() { return this._attributeChange; }
|
|
607
|
+
propagateAttribute(name, value) {
|
|
608
|
+
this._attributeChange?.next({ name, value });
|
|
636
609
|
}
|
|
637
|
-
|
|
638
|
-
|
|
610
|
+
setVisibility(visible, forced = null) {
|
|
611
|
+
super.setVisibility(visible, forced);
|
|
612
|
+
this.propagateAttribute(VISIBLE, this._visible);
|
|
613
|
+
}
|
|
614
|
+
set enabled(enabled) {
|
|
615
|
+
super.enabled = enabled;
|
|
616
|
+
this.propagateAttribute(DISABLED, this._disabled);
|
|
617
|
+
}
|
|
618
|
+
formStateChange(state) {
|
|
619
|
+
super.formStateChange(state);
|
|
620
|
+
if (state) {
|
|
621
|
+
this.propagateAttribute(VISIBLE, this._visible);
|
|
622
|
+
this.propagateAttribute(DISABLED, this._disabled);
|
|
623
|
+
}
|
|
639
624
|
}
|
|
640
625
|
}
|
|
641
626
|
|
|
642
|
-
class FormElement extends
|
|
627
|
+
class FormElement extends FormPiecePropagate {
|
|
643
628
|
constructor(elementDefinition, formConfig) {
|
|
644
629
|
super(elementDefinition, formConfig);
|
|
645
630
|
this.elementType = null;
|
|
@@ -797,7 +782,7 @@ class FieldDescriptor extends FormElement {
|
|
|
797
782
|
this.defaultEditable = this.enabled;
|
|
798
783
|
this.required = fld.required ?? false;
|
|
799
784
|
this.outputOnly = fld.outputOnly ?? false;
|
|
800
|
-
this.maxLength = fld.maxLength
|
|
785
|
+
this.maxLength = fld.maxLength || (this._captureType === 'TEXTAREA' ? BIG_MAX_LENGTH : STD_MAX_LENGTH);
|
|
801
786
|
this.intrinsicErrorMessage = this._formConfig?.fieldValidations?.[this._fieldType]?.message
|
|
802
787
|
?? this._formConfig?.fieldValidations?.DEFAULT?.message ?? '';
|
|
803
788
|
this.setError(fld.errorCode, fld.errorMessage, fld.errorType ?? DEFAULT_ERROR_TYPE);
|
|
@@ -859,7 +844,7 @@ class FieldDescriptor extends FormElement {
|
|
|
859
844
|
set info(newInfo) { this.setAttr(attrs$1._fieldInfo, newInfo); }
|
|
860
845
|
set intrinsicErrorMessage(message) { this.setAttr(attrs$1._intrinsicErrorMessage, message); }
|
|
861
846
|
get maxLength() { return (this._maxLength > 0) ? this._maxLength.toString() : ''; }
|
|
862
|
-
set maxLength(requiredMaxLength) { this.setAttr(attrs$1._maxLength, +requiredMaxLength); }
|
|
847
|
+
set maxLength(requiredMaxLength) { this.setAttr(attrs$1._maxLength, requiredMaxLength ? +requiredMaxLength : null); }
|
|
863
848
|
get maxValue() { return this._maxValue; }
|
|
864
849
|
set maxValue(inputMaxValue) {
|
|
865
850
|
let maxValue = inputMaxValue;
|
|
@@ -869,7 +854,7 @@ class FieldDescriptor extends FormElement {
|
|
|
869
854
|
this.setAttr(attrs$1._maxValue, maxValue);
|
|
870
855
|
}
|
|
871
856
|
get minLength() { return this._minLength; }
|
|
872
|
-
set minLength(requiredMinLength) { this.setAttr(attrs$1._minLength, +requiredMinLength); }
|
|
857
|
+
set minLength(requiredMinLength) { this.setAttr(attrs$1._minLength, requiredMinLength ? +requiredMinLength : null); }
|
|
873
858
|
get minValue() { return this._minValue; }
|
|
874
859
|
set minValue(inputMinValue) {
|
|
875
860
|
let minValue = inputMinValue;
|
|
@@ -913,7 +898,7 @@ class FieldDescriptor extends FormElement {
|
|
|
913
898
|
}
|
|
914
899
|
}
|
|
915
900
|
}
|
|
916
|
-
if (this._fieldRequired && this._fieldOptions?.length === 1) {
|
|
901
|
+
if (this._fieldRequired && this._fieldOptions?.length === 1 && this._value !== this._fieldOptions?.[0].fieldOptionId) {
|
|
917
902
|
this._setValue(this._fieldOptions?.[0].fieldOptionId);
|
|
918
903
|
this.notifyEditionFinish();
|
|
919
904
|
}
|
|
@@ -1144,6 +1129,7 @@ class RecordTableColumn extends FormPiece {
|
|
|
1144
1129
|
this.fieldAlignment = '';
|
|
1145
1130
|
this.fieldFormat = '';
|
|
1146
1131
|
this.sortable = true;
|
|
1132
|
+
this.searchable = true;
|
|
1147
1133
|
this.sortDirections = [];
|
|
1148
1134
|
// Filtros
|
|
1149
1135
|
this.filterVisible = false;
|
|
@@ -1156,13 +1142,15 @@ class RecordTableColumn extends FormPiece {
|
|
|
1156
1142
|
this.fieldType = recTableColReceived.fieldTypeCode || this._formConfig.fieldTypes.text;
|
|
1157
1143
|
const defaultTypeAlignment = (this._formConfig.tableFieldStyles[this.fieldType] != null) ? this._formConfig.tableFieldStyles[this.fieldType]['text-align'] : 'left';
|
|
1158
1144
|
this.fieldAlignment = (recTableColReceived.alignment != null) ? recTableColReceived.alignment.toLowerCase() : defaultTypeAlignment;
|
|
1159
|
-
this.
|
|
1145
|
+
this._absoluteVisible = recTableColReceived?.visible ?? true;
|
|
1160
1146
|
this.sortable = recTableColReceived?.sortable ?? false;
|
|
1147
|
+
this.searchable = recTableColReceived?.searchable ?? true;
|
|
1161
1148
|
this.sortDirections = (this.sortable) ? ['ascend', 'descend'] : [];
|
|
1162
1149
|
this.fieldFormat = recTableColReceived.format || '';
|
|
1163
1150
|
this.customAttributes = recTableColReceived?.customAttributes ?? {};
|
|
1164
1151
|
}
|
|
1165
1152
|
}
|
|
1153
|
+
setSearchable(searchable = true) { this.searchable = searchable; }
|
|
1166
1154
|
hideFilter() {
|
|
1167
1155
|
this.filterVisible = false;
|
|
1168
1156
|
}
|
|
@@ -1224,11 +1212,11 @@ class TableAction extends FormPiece {
|
|
|
1224
1212
|
|
|
1225
1213
|
class TableRecordData {
|
|
1226
1214
|
constructor(recordReceived, recordDefinition, selectionFieldName = null) {
|
|
1215
|
+
this.recordId = null;
|
|
1216
|
+
this.selected = false;
|
|
1227
1217
|
this.recordData = {};
|
|
1228
1218
|
const { tableRecordId, recordData } = recordReceived;
|
|
1229
1219
|
this.recordId = tableRecordId;
|
|
1230
|
-
this.selected = false;
|
|
1231
|
-
this.recordData = {};
|
|
1232
1220
|
if (!recordDefinition || recordDefinition.length === 0 || !recordData || recordData.length === 0) {
|
|
1233
1221
|
return;
|
|
1234
1222
|
}
|
|
@@ -1267,10 +1255,11 @@ class TableRecordData {
|
|
|
1267
1255
|
if (!words || words.length === 0) {
|
|
1268
1256
|
return true;
|
|
1269
1257
|
}
|
|
1270
|
-
for (const
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1258
|
+
for (const word of words) {
|
|
1259
|
+
let wordIsPresent = false;
|
|
1260
|
+
for (const fieldCode in this.recordData) {
|
|
1261
|
+
const columnDef = columnObj?.[fieldCode];
|
|
1262
|
+
if (columnDef?.searchable && this.recordData.hasOwnProperty(fieldCode)) {
|
|
1274
1263
|
const term = word.toUpperCase();
|
|
1275
1264
|
let fieldValue;
|
|
1276
1265
|
if (columnDef.fieldType.toUpperCase().includes('DATE')) {
|
|
@@ -1280,12 +1269,16 @@ class TableRecordData {
|
|
|
1280
1269
|
fieldValue = this.recordData[fieldCode];
|
|
1281
1270
|
}
|
|
1282
1271
|
if (fieldValue.toString().toUpperCase().includes(term)) {
|
|
1283
|
-
|
|
1272
|
+
wordIsPresent = true;
|
|
1273
|
+
break;
|
|
1284
1274
|
}
|
|
1285
1275
|
}
|
|
1286
1276
|
}
|
|
1277
|
+
if (!wordIsPresent) {
|
|
1278
|
+
return false;
|
|
1279
|
+
}
|
|
1287
1280
|
}
|
|
1288
|
-
return
|
|
1281
|
+
return true;
|
|
1289
1282
|
}
|
|
1290
1283
|
hasCondition(columnFilters) {
|
|
1291
1284
|
if (!columnFilters || columnFilters.length === 0) {
|
|
@@ -1339,7 +1332,7 @@ const attrs = {
|
|
|
1339
1332
|
tableCode: { name: 'tableCode', propagate: 'code' },
|
|
1340
1333
|
clientPaging: { name: 'clientPaging', propagate: null },
|
|
1341
1334
|
globalSearch: { name: 'globalSearch', propagate: 'globalSearch' },
|
|
1342
|
-
globalFilterString: { name: 'globalFilterString', propagate:
|
|
1335
|
+
globalFilterString: { name: 'globalFilterString', propagate: 'globalFilterString' },
|
|
1343
1336
|
sorting: { name: 'sorting', propagate: null },
|
|
1344
1337
|
recordsPerPage: { name: 'recordsPerPage', propagate: 'recordsPerPage' },
|
|
1345
1338
|
layout: { name: 'layout', propagate: 'layout' },
|
|
@@ -1360,6 +1353,7 @@ class RecordTable extends FormElement {
|
|
|
1360
1353
|
this._tableColumnObj = {};
|
|
1361
1354
|
this._actionsObj = {};
|
|
1362
1355
|
// Mecanismos de filtrado nueva versión
|
|
1356
|
+
this.globalFilterString = '';
|
|
1363
1357
|
this.globalFilterStrings = [];
|
|
1364
1358
|
this.layout = null;
|
|
1365
1359
|
this.tableRecordObj = {};
|
|
@@ -1398,7 +1392,11 @@ class RecordTable extends FormElement {
|
|
|
1398
1392
|
if (tableReceived.fields) {
|
|
1399
1393
|
const columns = [];
|
|
1400
1394
|
for (const columnReceived of tableReceived.fields) {
|
|
1401
|
-
const columnEnriched = {
|
|
1395
|
+
const columnEnriched = {
|
|
1396
|
+
...columnReceived,
|
|
1397
|
+
visibleStates: this.visibleStates,
|
|
1398
|
+
enabledStates: this.enabledStates
|
|
1399
|
+
};
|
|
1402
1400
|
const columnDefinition = new RecordTableColumn(columnEnriched, this._formConfig);
|
|
1403
1401
|
columns.push(columnDefinition);
|
|
1404
1402
|
this._tableColumnObj[columnDefinition.fieldCode] = columnDefinition;
|
|
@@ -1557,7 +1555,6 @@ class RecordTable extends FormElement {
|
|
|
1557
1555
|
}
|
|
1558
1556
|
}
|
|
1559
1557
|
updateVisibleRecords() {
|
|
1560
|
-
// updateView const changeViewAttributes = ['currentPage', 'recordsPerPage', 'sorting'];
|
|
1561
1558
|
let visibleRecords;
|
|
1562
1559
|
if (this.clientPaging) {
|
|
1563
1560
|
let filteredRecords = this.getFilteredRecords();
|
|
@@ -1633,7 +1630,7 @@ class RecordTable extends FormElement {
|
|
|
1633
1630
|
this.changePage(1);
|
|
1634
1631
|
}
|
|
1635
1632
|
if (notifyComponent) {
|
|
1636
|
-
this.setAttr(attrs.globalFilterString, text);
|
|
1633
|
+
this.setAttr(attrs.globalFilterString, text.trim());
|
|
1637
1634
|
}
|
|
1638
1635
|
}
|
|
1639
1636
|
addFilterDefinition(columnName, filterDefinition) {
|
|
@@ -1681,10 +1678,10 @@ class RecordTable extends FormElement {
|
|
|
1681
1678
|
for (let index = 0; index < columnFilters.length; index++) {
|
|
1682
1679
|
const columnFilter = columnFilters[index];
|
|
1683
1680
|
compactFilter.advancedFilter.push({
|
|
1684
|
-
fieldCode: columnFilter
|
|
1685
|
-
operator: columnFilter
|
|
1686
|
-
fieldValue1: columnFilter
|
|
1687
|
-
fieldValue2: columnFilter
|
|
1681
|
+
fieldCode: columnFilter?.fieldCode,
|
|
1682
|
+
operator: columnFilter?.operator,
|
|
1683
|
+
fieldValue1: columnFilter?.values[0],
|
|
1684
|
+
fieldValue2: columnFilter?.values[1],
|
|
1688
1685
|
});
|
|
1689
1686
|
}
|
|
1690
1687
|
return compactFilter;
|
|
@@ -1727,14 +1724,17 @@ class RecordTable extends FormElement {
|
|
|
1727
1724
|
}
|
|
1728
1725
|
return direction === TABLE_SORT_ASCENDING ? result : -result;
|
|
1729
1726
|
}
|
|
1730
|
-
|
|
1727
|
+
formStateChangeCustomSubscribe(formChangeSubject) {
|
|
1731
1728
|
this.columns?.forEach(column => {
|
|
1732
1729
|
column?.subscribeFormStateChange(formChangeSubject);
|
|
1733
1730
|
});
|
|
1731
|
+
this._actions?.forEach(action => {
|
|
1732
|
+
action?.subscribeFormStateChange(formChangeSubject);
|
|
1733
|
+
});
|
|
1734
1734
|
}
|
|
1735
1735
|
}
|
|
1736
1736
|
|
|
1737
|
-
class RecordFormSubSection extends
|
|
1737
|
+
class RecordFormSubSection extends FormPiecePropagate {
|
|
1738
1738
|
constructor(subsectionReceived, formObject, formConfig) {
|
|
1739
1739
|
super(subsectionReceived, formConfig);
|
|
1740
1740
|
this._customRender = null;
|
|
@@ -1746,6 +1746,7 @@ class RecordFormSubSection extends FormPiece {
|
|
|
1746
1746
|
this.subSectionTables = [];
|
|
1747
1747
|
this.subSectionActions = [];
|
|
1748
1748
|
this.elementsArray = {};
|
|
1749
|
+
this.active = false;
|
|
1749
1750
|
if (!subsectionReceived) {
|
|
1750
1751
|
return;
|
|
1751
1752
|
}
|
|
@@ -1797,9 +1798,22 @@ class RecordFormSubSection extends FormPiece {
|
|
|
1797
1798
|
getActionNames() {
|
|
1798
1799
|
return this.subSectionActions.map(action => action.actionCode);
|
|
1799
1800
|
}
|
|
1801
|
+
activate() {
|
|
1802
|
+
if (!this.active) {
|
|
1803
|
+
this.active = true;
|
|
1804
|
+
// this.subsectionCode && this._activation.next(this.subsectionCode);
|
|
1805
|
+
}
|
|
1806
|
+
}
|
|
1807
|
+
inactivate() {
|
|
1808
|
+
if (this.active) {
|
|
1809
|
+
this.active = false;
|
|
1810
|
+
// this.subsectionCode && this._inactivation.next(this.subsectionCode);
|
|
1811
|
+
}
|
|
1812
|
+
}
|
|
1800
1813
|
}
|
|
1801
1814
|
|
|
1802
|
-
|
|
1815
|
+
const ACTIVE$1 = 'active';
|
|
1816
|
+
class RecordFormSection extends FormPiecePropagate {
|
|
1803
1817
|
constructor(sectionReceived, formObject, formConfig) {
|
|
1804
1818
|
super(sectionReceived, formConfig);
|
|
1805
1819
|
this._activation = new Subject();
|
|
@@ -1809,6 +1823,7 @@ class RecordFormSection extends FormPiece {
|
|
|
1809
1823
|
this.sectionCode = null;
|
|
1810
1824
|
this.sectionTitle = null;
|
|
1811
1825
|
this.subSections = [];
|
|
1826
|
+
this._exclusiveSubSectionsByAttr = {};
|
|
1812
1827
|
if (!sectionReceived) {
|
|
1813
1828
|
return;
|
|
1814
1829
|
}
|
|
@@ -1818,20 +1833,12 @@ class RecordFormSection extends FormPiece {
|
|
|
1818
1833
|
this.subSections = [];
|
|
1819
1834
|
this.subSectionsObj = {};
|
|
1820
1835
|
if (sectionReceived.subsections) {
|
|
1821
|
-
const subsections = sectionReceived.subsections.map(
|
|
1822
|
-
|
|
1823
|
-
if (
|
|
1824
|
-
|
|
1825
|
-
.map(state => state.trim())
|
|
1826
|
-
.filter(state => state.length > 0);
|
|
1827
|
-
}
|
|
1828
|
-
if (!visibleStates || visibleStates.length === 0) {
|
|
1829
|
-
visibleStates = this.visibleStates;
|
|
1836
|
+
const subsections = sectionReceived.subsections.map(subSecDef => {
|
|
1837
|
+
const visibleStates = subSecDef.visibleStates ?? [];
|
|
1838
|
+
if (subSecDef.elements && Array.isArray(subSecDef.elements)) {
|
|
1839
|
+
subSecDef.elements = subSecDef.elements.map(elm => ({ code: elm.elementCode, type: elm.elementTypeName }));
|
|
1830
1840
|
}
|
|
1831
|
-
|
|
1832
|
-
objDef.elements = objDef.elements.map(elm => ({ code: elm.elementCode, type: elm.elementTypeName }));
|
|
1833
|
-
}
|
|
1834
|
-
return { ...objDef, visibleStates };
|
|
1841
|
+
return { ...subSecDef, visibleStates };
|
|
1835
1842
|
});
|
|
1836
1843
|
for (const subsectionReceived of subsections) {
|
|
1837
1844
|
const subSectionToAdd = new RecordFormSubSection(subsectionReceived, formObject, formConfig);
|
|
@@ -1861,14 +1868,23 @@ class RecordFormSection extends FormPiece {
|
|
|
1861
1868
|
get title() { return this.sectionTitle; }
|
|
1862
1869
|
set title(title) { this.sectionTitle = title; }
|
|
1863
1870
|
getVisibleSubsections(state) {
|
|
1864
|
-
return this.subSections.filter(subSection =>
|
|
1865
|
-
return subSection.visible && subSection.viewOnState(state);
|
|
1866
|
-
});
|
|
1871
|
+
return this.subSections.filter(subSection => subSection.visible);
|
|
1867
1872
|
}
|
|
1868
1873
|
getSubsection(subSectionCode) {
|
|
1869
1874
|
return (this.subSectionsObj && this.subSectionsObj[subSectionCode])
|
|
1870
1875
|
? this.subSectionsObj[subSectionCode] : null;
|
|
1871
1876
|
}
|
|
1877
|
+
activateSubSection(subSectionCode) {
|
|
1878
|
+
if (subSectionCode === this._exclusiveSubSectionsByAttr[ACTIVE$1]) {
|
|
1879
|
+
return;
|
|
1880
|
+
}
|
|
1881
|
+
const subSection = (this.subSectionsObj && this.subSectionsObj[subSectionCode])
|
|
1882
|
+
? this.subSectionsObj[subSectionCode] : null;
|
|
1883
|
+
if (subSection) {
|
|
1884
|
+
subSection?.activate();
|
|
1885
|
+
this._exclusiveSubSectionsByAttr[ACTIVE$1] = subSectionCode;
|
|
1886
|
+
}
|
|
1887
|
+
}
|
|
1872
1888
|
getFields() {
|
|
1873
1889
|
let fieldsArray = [];
|
|
1874
1890
|
if (this.subSections && this.subSections.length > 0) {
|
|
@@ -1923,7 +1939,7 @@ class RecordFormSection extends FormPiece {
|
|
|
1923
1939
|
}
|
|
1924
1940
|
return null;
|
|
1925
1941
|
}
|
|
1926
|
-
|
|
1942
|
+
formStateChangeCustomSubscribe(formChangeSubject) {
|
|
1927
1943
|
this.subSections?.forEach(subsection => {
|
|
1928
1944
|
subsection?.subscribeFormStateChange(formChangeSubject);
|
|
1929
1945
|
});
|
|
@@ -1993,7 +2009,7 @@ class FormStructureAndData {
|
|
|
1993
2009
|
if (definitionReceived.fields) {
|
|
1994
2010
|
const formFields = definitionReceived.fields.map(objDef => {
|
|
1995
2011
|
let visibleStates = objDef.visibleStates;
|
|
1996
|
-
let enabledStates = objDef.enabledStates
|
|
2012
|
+
let enabledStates = objDef.enabledStates ?? objDef.editableStates;
|
|
1997
2013
|
if (!visibleStates) {
|
|
1998
2014
|
visibleStates = (objDef.fieldModes || '').split(',')
|
|
1999
2015
|
.map(state => state.trim())
|
|
@@ -2272,7 +2288,7 @@ class FormStructureAndData {
|
|
|
2272
2288
|
getSections() { return this._sectionArray; }
|
|
2273
2289
|
getSectionsByAttribute(name, value) { return this._sectionArray.filter(item => item.matchAttribute(name, value)); }
|
|
2274
2290
|
get sectionTitles() { return this._sectionArray.map(formSection => formSection.sectionTitle); }
|
|
2275
|
-
get visibleSections() { return this._sectionArray.filter(sec => sec.
|
|
2291
|
+
get visibleSections() { return this._sectionArray.filter(sec => sec.absoluteVisible); }
|
|
2276
2292
|
getSection(code) { return (code && this._sections?.[code]) ? this._sections[code] : null; }
|
|
2277
2293
|
showSections(codes) { this.execOnSections(codes, SHOW); }
|
|
2278
2294
|
hideSections(codes) { this.execOnSections(codes, HIDE); }
|
|
@@ -2332,8 +2348,8 @@ class FormStructureAndData {
|
|
|
2332
2348
|
const fieldPayload = {
|
|
2333
2349
|
fieldCode: fld?.code,
|
|
2334
2350
|
fieldValue: fld?.value,
|
|
2335
|
-
editable: !fld?.
|
|
2336
|
-
visible: fld?.
|
|
2351
|
+
editable: !fld?.absoluteDisabled,
|
|
2352
|
+
visible: fld?.absoluteVisible,
|
|
2337
2353
|
required: fld?.required,
|
|
2338
2354
|
fieldOptions: '',
|
|
2339
2355
|
};
|
|
@@ -2342,7 +2358,7 @@ class FormStructureAndData {
|
|
|
2342
2358
|
formData.tables = this.getTables().map(tbl => {
|
|
2343
2359
|
const tablePayload = {
|
|
2344
2360
|
tableCode: tbl.tableCode,
|
|
2345
|
-
visible: tbl.
|
|
2361
|
+
visible: tbl.absoluteVisible,
|
|
2346
2362
|
currentPage: tbl.currentPage,
|
|
2347
2363
|
requestedPage: tbl.requestedPage,
|
|
2348
2364
|
recordsPerPage: tbl.recordsPerPage,
|
|
@@ -3214,7 +3230,7 @@ class BasicFormComponent {
|
|
|
3214
3230
|
for (const clientActionMethod of finishActionMethods) {
|
|
3215
3231
|
const { callback, properties } = clientActionMethod;
|
|
3216
3232
|
const continueOnError = properties?.continueOnError ?? false;
|
|
3217
|
-
if (!serverError || continueOnError) {
|
|
3233
|
+
if (callback && (!serverError || continueOnError)) {
|
|
3218
3234
|
clientActionPromises.push(callback(action, actionResult));
|
|
3219
3235
|
}
|
|
3220
3236
|
}
|