tuain-ng-forms-lib 14.4.93 → 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.
Files changed (108) hide show
  1. package/esm2020/lib/classes/forms/action.mjs +36 -0
  2. package/esm2020/lib/classes/forms/element.mjs +26 -0
  3. package/esm2020/lib/classes/forms/field.mjs +445 -0
  4. package/esm2020/lib/classes/forms/form.constants.mjs +26 -0
  5. package/esm2020/lib/classes/forms/form.mjs +431 -0
  6. package/esm2020/lib/classes/forms/piece-propagate.mjs +37 -0
  7. package/esm2020/lib/classes/forms/piece.mjs +95 -0
  8. package/esm2020/lib/classes/forms/section.mjs +138 -0
  9. package/esm2020/lib/classes/forms/subsection.mjs +81 -0
  10. package/esm2020/lib/classes/forms/table/action.mjs +18 -0
  11. package/esm2020/lib/classes/forms/table/column.mjs +74 -0
  12. package/esm2020/lib/classes/forms/table/row-data.mjs +116 -0
  13. package/esm2020/lib/classes/forms/table/table.mjs +416 -0
  14. package/esm2020/lib/components/elements/action.component.mjs +71 -0
  15. package/esm2020/lib/components/elements/field.component.mjs +81 -0
  16. package/esm2020/lib/components/elements/layout/element.component.mjs +20 -0
  17. package/esm2020/lib/components/elements/layout/form-error.component.mjs +20 -0
  18. package/esm2020/lib/components/elements/layout/form-header.component.mjs +31 -0
  19. package/esm2020/lib/components/elements/layout/piece.component.mjs +39 -0
  20. package/esm2020/lib/components/elements/layout/section.component.mjs +37 -0
  21. package/esm2020/lib/components/elements/layout/sub-section.component.mjs +37 -0
  22. package/esm2020/lib/components/elements/tables/table-record-action.component.mjs +56 -0
  23. package/esm2020/lib/components/elements/tables/table-record-field.component.mjs +30 -0
  24. package/esm2020/lib/components/elements/tables/table.component.mjs +89 -0
  25. package/esm2020/lib/components/forms/basic-form.mjs +1514 -0
  26. package/esm2020/lib/services/event-manager.service.mjs +18 -0
  27. package/esm2020/lib/services/file-manager.service.mjs +6 -0
  28. package/esm2020/lib/services/form-manager.service.mjs +80 -0
  29. package/esm2020/lib/tuain-ng-forms-lib.module.mjs +71 -0
  30. package/esm2020/public-api.mjs +19 -0
  31. package/esm2020/tuain-ng-forms-lib.mjs +5 -0
  32. package/fesm2015/tuain-ng-forms-lib.mjs +4259 -0
  33. package/fesm2015/tuain-ng-forms-lib.mjs.map +1 -0
  34. package/fesm2020/tuain-ng-forms-lib.mjs +4074 -0
  35. package/fesm2020/tuain-ng-forms-lib.mjs.map +1 -0
  36. package/lib/classes/forms/action.d.ts +22 -0
  37. package/lib/classes/forms/element.d.ts +17 -0
  38. package/lib/classes/forms/field.d.ts +205 -0
  39. package/lib/classes/forms/form.constants.d.ts +25 -0
  40. package/lib/classes/forms/form.d.ts +137 -0
  41. package/lib/classes/forms/piece-propagate.d.ts +13 -0
  42. package/lib/classes/forms/piece.d.ts +41 -0
  43. package/lib/classes/forms/section.d.ts +32 -0
  44. package/lib/classes/forms/subsection.d.ts +24 -0
  45. package/lib/classes/forms/table/action.d.ts +15 -0
  46. package/lib/classes/forms/table/column.d.ts +33 -0
  47. package/lib/classes/forms/table/row-data.d.ts +14 -0
  48. package/lib/classes/forms/table/table.d.ts +100 -0
  49. package/lib/components/elements/action.component.d.ts +17 -0
  50. package/lib/components/elements/field.component.d.ts +38 -0
  51. package/lib/components/elements/layout/element.component.d.ts +9 -0
  52. package/lib/components/elements/layout/form-error.component.d.ts +8 -0
  53. package/lib/components/elements/layout/form-header.component.d.ts +12 -0
  54. package/lib/components/elements/layout/piece.component.d.ts +12 -0
  55. package/lib/components/elements/layout/section.component.d.ts +11 -0
  56. package/lib/components/elements/layout/sub-section.component.d.ts +11 -0
  57. package/lib/components/elements/tables/table-record-action.component.d.ts +16 -0
  58. package/lib/components/elements/tables/table-record-field.component.d.ts +12 -0
  59. package/lib/components/elements/tables/table.component.d.ts +35 -0
  60. package/lib/components/forms/basic-form.d.ts +353 -0
  61. package/lib/services/event-manager.service.d.ts +9 -0
  62. package/lib/services/file-manager.service.d.ts +5 -0
  63. package/lib/services/form-manager.service.d.ts +28 -0
  64. package/lib/tuain-ng-forms-lib.module.d.ts +20 -0
  65. package/package.json +24 -6
  66. package/{src/public-api.ts → public-api.d.ts} +0 -5
  67. package/tuain-ng-forms-lib.d.ts +5 -0
  68. package/.browserslistrc +0 -16
  69. package/.yarn/cache/nanoid-npm-4.0.0-924f5c6312-7d5946df5c.zip +0 -0
  70. package/.yarn/cache/tslib-npm-2.4.1-36f0ed04db-19480d6e03.zip +0 -0
  71. package/.yarn/cache/yn-npm-5.0.0-b001dab23c-f0ec7710d3.zip +0 -0
  72. package/.yarn/install-state.gz +0 -0
  73. package/karma.conf.js +0 -44
  74. package/ng-package.json +0 -11
  75. package/src/lib/classes/forms/action.ts +0 -56
  76. package/src/lib/classes/forms/element.ts +0 -29
  77. package/src/lib/classes/forms/field.ts +0 -500
  78. package/src/lib/classes/forms/form.constants.ts +0 -28
  79. package/src/lib/classes/forms/form.ts +0 -508
  80. package/src/lib/classes/forms/piece-propagate.ts +0 -46
  81. package/src/lib/classes/forms/piece.ts +0 -122
  82. package/src/lib/classes/forms/section.ts +0 -152
  83. package/src/lib/classes/forms/subsection.ts +0 -90
  84. package/src/lib/classes/forms/table/action.ts +0 -32
  85. package/src/lib/classes/forms/table/column.ts +0 -94
  86. package/src/lib/classes/forms/table/row-data.ts +0 -121
  87. package/src/lib/classes/forms/table/table.ts +0 -478
  88. package/src/lib/components/elements/action.component.ts +0 -59
  89. package/src/lib/components/elements/field.component.ts +0 -92
  90. package/src/lib/components/elements/layout/element.component.ts +0 -13
  91. package/src/lib/components/elements/layout/form-error.component.ts +0 -11
  92. package/src/lib/components/elements/layout/form-header.component.ts +0 -17
  93. package/src/lib/components/elements/layout/piece.component.ts +0 -34
  94. package/src/lib/components/elements/layout/section.component.ts +0 -31
  95. package/src/lib/components/elements/layout/sub-section.component.ts +0 -31
  96. package/src/lib/components/elements/tables/table-record-action.component.ts +0 -50
  97. package/src/lib/components/elements/tables/table-record-field.component.ts +0 -20
  98. package/src/lib/components/elements/tables/table.component.ts +0 -86
  99. package/src/lib/components/forms/basic-form.ts +0 -1588
  100. package/src/lib/services/event-manager.service.ts +0 -21
  101. package/src/lib/services/file-manager.service.ts +0 -6
  102. package/src/lib/services/form-manager.service.ts +0 -89
  103. package/src/lib/services/icon-dictionary.service.ts +0 -159
  104. package/src/lib/tuain-ng-forms-lib.module.ts +0 -40
  105. package/src/test.ts +0 -27
  106. package/tsconfig.lib.json +0 -15
  107. package/tsconfig.lib.prod.json +0 -10
  108. package/tsconfig.spec.json +0 -17
@@ -1,34 +0,0 @@
1
- import { Component } from '@angular/core';
2
-
3
- const CUSTOM_ATTRIBUTES = 'customAttributes';
4
- @Component({
5
- selector: 'lib-piece',
6
- template: `<ng-content></ng-content>`
7
- })
8
- export class PieceComponent {
9
- formConfig: any;
10
- visible: boolean = true;
11
- disabled: boolean = false;
12
- customAttributes: any = {};
13
-
14
- defaultProcessAttributeChange(attribute: string, value?: any): boolean {
15
- if (!attribute || attribute.trim() === '') {
16
- return false;
17
- }
18
- const attributeParts = attribute.split('.');
19
- if (attributeParts?.length > 1) {
20
- const [attributeType, subAttribute] = attributeParts;
21
- if (attributeType === CUSTOM_ATTRIBUTES) {
22
- this.customAttributes[subAttribute] = value;
23
- this.customAttributeChange(subAttribute, value);
24
- }
25
- } else {
26
- this[attribute] = value;
27
- }
28
- return true;
29
- }
30
-
31
- customProcessAttributeChange(attribute: string, value?: any) { }
32
-
33
- customAttributeChange(subAttribute: string, value?: any) { }
34
- }
@@ -1,31 +0,0 @@
1
- import { Component, Input, OnInit } from '@angular/core';
2
- import { PieceComponent } from './piece.component';
3
-
4
- @Component({
5
- selector: 'lib-section',
6
- template: `<ng-content></ng-content>`
7
- })
8
- export class SectionComponent extends PieceComponent implements OnInit {
9
- @Input() section: any;
10
- @Input() form: any;
11
-
12
- ngOnInit() {
13
- this.formConfig = this.section?._formConfig;
14
- const mapping = this.formConfig?.sectionPropagateAttributes;
15
- for (let index = 0; index < mapping.length; index++) {
16
- const attrName = mapping[index].toString();
17
- const attributeValue = this.section?.[attrName];
18
- this.defaultProcessAttributeChange(attrName, attributeValue);
19
- this.customProcessAttributeChange(attrName, attributeValue);
20
- }
21
- // Subscripción a cambios en atributos
22
- this.section?.attributeChange.subscribe(event => {
23
- const { name: attrName, value } = event;
24
- this.defaultProcessAttributeChange(attrName, value);
25
- this.customProcessAttributeChange(attrName, value);
26
- });
27
- this.start();
28
- }
29
-
30
- start() { }
31
- }
@@ -1,31 +0,0 @@
1
- import { Component, Input, OnInit } from '@angular/core';
2
- import { PieceComponent } from './piece.component';
3
-
4
- @Component({
5
- selector: 'lib-subsection',
6
- template: `<ng-content></ng-content>`
7
- })
8
- export class SubSectionComponent extends PieceComponent implements OnInit {
9
- @Input() subSection: any;
10
- @Input() form: any;
11
-
12
- ngOnInit() {
13
- this.formConfig = this.subSection?._formConfig;
14
- const mapping = this.formConfig?.subSectionPropagateAttributes;
15
- for (let index = 0; index < mapping.length; index++) {
16
- const attrName = mapping[index].toString();
17
- const attributeValue = this.subSection?.[attrName];
18
- this.defaultProcessAttributeChange(attrName, attributeValue);
19
- this.customProcessAttributeChange(attrName, attributeValue);
20
- }
21
- // Subscripción a cambios en atributos
22
- this.subSection?.attributeChange.subscribe(event => {
23
- const { name: attrName, value } = event;
24
- this.defaultProcessAttributeChange(attrName, value);
25
- this.customProcessAttributeChange(attrName, value);
26
- });
27
- this.start();
28
- }
29
-
30
- start() { }
31
- }
@@ -1,50 +0,0 @@
1
- import { Component, Input, Output, OnInit, EventEmitter, ChangeDetectionStrategy } from '@angular/core';
2
- import { PieceComponent } from '../layout/piece.component';
3
- import { TableEvent, TableActionEvent } from '../../../classes/forms/table/table';
4
-
5
- const INLINE_ACTION = 'INLINE';
6
-
7
- @Component({
8
- selector: 'lib-table-record-action',
9
- template: `<ng-content></ng-content>`,
10
- changeDetection: ChangeDetectionStrategy.OnPush
11
- })
12
-
13
- export class LibTableRecordActionComponent extends PieceComponent implements OnInit {
14
- @Input() recordId: any;
15
- @Input() recordData: any;
16
- @Input() action: any;
17
-
18
- @Output() actionSelected: EventEmitter<TableActionEvent> = new EventEmitter<TableActionEvent>();
19
-
20
- ngOnInit() {
21
- this.formConfig = this.action?._formConfig;
22
- const mapping = this.formConfig?.actionPropagateAttributes;
23
- for (let index = 0; index < mapping.length; index++) {
24
- const attrName = mapping[index].toString();
25
- const attributeValue = this.action?.[attrName];
26
- this.defaultProcessAttributeChange(attrName, attributeValue);
27
- this.customProcessAttributeChange(attrName, attributeValue);
28
- }
29
- // Subscripción a cambios en atributos
30
- this.action?.attributeChange.subscribe(event => {
31
- const { name: attrName, value } = event;
32
- this.defaultProcessAttributeChange(attrName, value);
33
- this.customProcessAttributeChange(attrName, value);
34
- });
35
- this.start();
36
- }
37
-
38
- start() { }
39
-
40
- onActivate() {
41
- const tableEvent: TableActionEvent = {
42
- actionCode: this.action.actionCode,
43
- recordId: this.recordId,
44
- recordData: this.recordData,
45
- };
46
- this.actionSelected.emit(tableEvent);
47
- }
48
-
49
- class() { }
50
- }
@@ -1,20 +0,0 @@
1
- import { Component, Input, OnInit, ChangeDetectionStrategy } from '@angular/core';
2
-
3
- @Component({
4
- selector: 'lib-table-record-field',
5
- template: `<ng-content></ng-content>`,
6
- changeDetection: ChangeDetectionStrategy.OnPush
7
- })
8
-
9
- export class LibTableRecordFieldComponent implements OnInit {
10
- @Input() fieldCode: any;
11
- @Input() fieldType: any;
12
- @Input() fieldValue: any;
13
- @Input() column: any = null;
14
-
15
- ngOnInit() {
16
- this.start();
17
- }
18
-
19
- start() { }
20
- }
@@ -1,86 +0,0 @@
1
- import { Component, OnInit, Input, ChangeDetectionStrategy } from '@angular/core';
2
- import { TableRecordData } from '../../../classes/forms/table/row-data';
3
- import { TableActionEvent } from '../../../classes/forms/table/table';
4
- import { RecordTable, TableEvent } from '../../../classes/forms/table/table';
5
- import { ElementComponent } from '../layout/element.component';
6
-
7
- @Component({
8
- selector: 'lib-table',
9
- template: `<ng-content></ng-content>`,
10
- changeDetection: ChangeDetectionStrategy.OnPush
11
- })
12
-
13
- export class LibTableComponent extends ElementComponent implements OnInit {
14
- // Atributos sincronizados del objeto
15
- code: any;
16
- globalFilterString: string = '';
17
-
18
- tableFieldStyles: any;
19
- loaded = false;
20
- selectable = false;
21
- hasActions = false;
22
- inlineActions: any;
23
- globalActions: any;
24
- selectionActions: any;
25
-
26
- @Input() table: RecordTable | null = null;
27
- @Input() visibleRecords: TableRecordData[] = [];
28
- @Input() waiting: boolean = false;
29
-
30
- ngOnInit() {
31
- if (!this.table) { return; }
32
- this.formConfig = this.table?._formConfig;
33
- this.tableFieldStyles = this.formConfig?.tableFieldStyles;
34
- this.selectable = this.table?.selectable;
35
- this.hasActions = this.table?.hasActions();
36
- this.inlineActions = this.table?.getActions(this.formConfig?.tableActions.inline);
37
- this.globalActions = this.table?.getActions(this.formConfig?.tableActions.global);
38
- this.selectionActions = this.table?.getActions(this.formConfig?.tableActions.selection);
39
- // Inicialización de campos mapeados del objeto
40
- const mapping = Object.entries(this.formConfig?.tablePropagationAttributes);
41
- for (let index = 0; index < mapping.length; index++) {
42
- const tableAttr = mapping[index]?.[0];
43
- const componentAttr = mapping[index]?.[1]?.toString() ?? '';
44
- const attributeValue = this.table?.[tableAttr];
45
- this.defaultProcessAttributeChange(componentAttr, attributeValue);
46
- this.customProcessAttributeChange(componentAttr, attributeValue);
47
- }
48
- // Subscripción a cambios en atributos
49
- this.table?.attributeChange.subscribe(event => {
50
- const { name: attrName, value } = event;
51
- this.defaultProcessAttributeChange(attrName, value);
52
- this.customProcessAttributeChange(attrName, value);
53
- });
54
- this.start();
55
- }
56
-
57
- updateTableData() { }
58
- tableGlobalAction(actionCode: string) { this.table?.notifyGlobalAction(actionCode); }
59
- tableSelectionAction(actionCode: string) { this.table?.notifySelectionAction(actionCode); }
60
- tableActionSelected(actionEvent: TableActionEvent) { this.table?.notifyInlineAction(actionEvent); }
61
- tableSelectionToggle(recordId: any) { this.table?.notifyRecordSelection(recordId); }
62
- toggleSelectAll() { return (this.table?.allSelected) ? this.table?.unSelectAll() : this.table?.selectAll(); }
63
- globalFilterCompleted() { this.changePage(1); }
64
- changePage(requestedPage: number) { this.table?.changePage(requestedPage); }
65
- tableColumnSort(columnName: string, direction = null) { this.table?.sort(columnName, direction ?? 'ascend'); }
66
- globalFilterChanged() { this.table?.setGlobalFilterString(this.globalFilterString?.trim() ?? '', false); }
67
-
68
- override defaultProcessAttributeChange(attribute: string, value?: any): boolean {
69
- try {
70
- if (attribute === 'visibleRecords') {
71
- this.updateTableData();
72
- }
73
- return super.defaultProcessAttributeChange(attribute, value);
74
- } catch {
75
- return false;
76
- }
77
- }
78
-
79
- filterHasChanged(column, values) {
80
- if (!values || values.length === 0) {
81
- this.table?.removeColumnFilter(column.fieldCode);
82
- } else {
83
- this.table?.addColumnFilter(column.fieldCode, values);
84
- }
85
- }
86
- }