tuain-ng-forms-lib 14.4.91 → 14.4.93

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/.browserslistrc +16 -0
  2. package/.yarn/cache/nanoid-npm-4.0.0-924f5c6312-7d5946df5c.zip +0 -0
  3. package/.yarn/cache/tslib-npm-2.4.1-36f0ed04db-19480d6e03.zip +0 -0
  4. package/.yarn/cache/yn-npm-5.0.0-b001dab23c-f0ec7710d3.zip +0 -0
  5. package/.yarn/install-state.gz +0 -0
  6. package/karma.conf.js +44 -0
  7. package/ng-package.json +11 -0
  8. package/package.json +6 -24
  9. package/src/lib/classes/forms/action.ts +56 -0
  10. package/src/lib/classes/forms/element.ts +29 -0
  11. package/src/lib/classes/forms/field.ts +500 -0
  12. package/src/lib/classes/forms/form.constants.ts +28 -0
  13. package/src/lib/classes/forms/form.ts +508 -0
  14. package/src/lib/classes/forms/piece-propagate.ts +46 -0
  15. package/src/lib/classes/forms/piece.ts +122 -0
  16. package/src/lib/classes/forms/section.ts +152 -0
  17. package/src/lib/classes/forms/subsection.ts +90 -0
  18. package/src/lib/classes/forms/table/action.ts +32 -0
  19. package/src/lib/classes/forms/table/column.ts +94 -0
  20. package/src/lib/classes/forms/table/row-data.ts +121 -0
  21. package/src/lib/classes/forms/table/table.ts +478 -0
  22. package/src/lib/components/elements/action.component.ts +59 -0
  23. package/src/lib/components/elements/field.component.ts +92 -0
  24. package/src/lib/components/elements/layout/element.component.ts +13 -0
  25. package/src/lib/components/elements/layout/form-error.component.ts +11 -0
  26. package/src/lib/components/elements/layout/form-header.component.ts +17 -0
  27. package/src/lib/components/elements/layout/piece.component.ts +34 -0
  28. package/src/lib/components/elements/layout/section.component.ts +31 -0
  29. package/src/lib/components/elements/layout/sub-section.component.ts +31 -0
  30. package/src/lib/components/elements/tables/table-record-action.component.ts +50 -0
  31. package/src/lib/components/elements/tables/table-record-field.component.ts +20 -0
  32. package/src/lib/components/elements/tables/table.component.ts +86 -0
  33. package/src/lib/components/forms/basic-form.ts +1588 -0
  34. package/src/lib/services/event-manager.service.ts +21 -0
  35. package/src/lib/services/file-manager.service.ts +6 -0
  36. package/src/lib/services/form-manager.service.ts +89 -0
  37. package/src/lib/services/icon-dictionary.service.ts +159 -0
  38. package/src/lib/tuain-ng-forms-lib.module.ts +40 -0
  39. package/{public-api.d.ts → src/public-api.ts} +5 -0
  40. package/src/test.ts +27 -0
  41. package/tsconfig.lib.json +15 -0
  42. package/tsconfig.lib.prod.json +10 -0
  43. package/tsconfig.spec.json +17 -0
  44. package/esm2020/lib/classes/forms/action.mjs +0 -35
  45. package/esm2020/lib/classes/forms/element.mjs +0 -26
  46. package/esm2020/lib/classes/forms/field.mjs +0 -444
  47. package/esm2020/lib/classes/forms/form.constants.mjs +0 -26
  48. package/esm2020/lib/classes/forms/form.mjs +0 -431
  49. package/esm2020/lib/classes/forms/piece-propagate.mjs +0 -30
  50. package/esm2020/lib/classes/forms/piece.mjs +0 -95
  51. package/esm2020/lib/classes/forms/section.mjs +0 -137
  52. package/esm2020/lib/classes/forms/subsection.mjs +0 -80
  53. package/esm2020/lib/classes/forms/table/action.mjs +0 -18
  54. package/esm2020/lib/classes/forms/table/column.mjs +0 -74
  55. package/esm2020/lib/classes/forms/table/row-data.mjs +0 -116
  56. package/esm2020/lib/classes/forms/table/table.mjs +0 -415
  57. package/esm2020/lib/components/elements/action.component.mjs +0 -71
  58. package/esm2020/lib/components/elements/field.component.mjs +0 -80
  59. package/esm2020/lib/components/elements/layout/element.component.mjs +0 -20
  60. package/esm2020/lib/components/elements/layout/form-error.component.mjs +0 -20
  61. package/esm2020/lib/components/elements/layout/form-header.component.mjs +0 -31
  62. package/esm2020/lib/components/elements/layout/piece.component.mjs +0 -22
  63. package/esm2020/lib/components/elements/layout/section.component.mjs +0 -37
  64. package/esm2020/lib/components/elements/layout/sub-section.component.mjs +0 -37
  65. package/esm2020/lib/components/elements/tables/table-record-action.component.mjs +0 -56
  66. package/esm2020/lib/components/elements/tables/table-record-field.component.mjs +0 -30
  67. package/esm2020/lib/components/elements/tables/table.component.mjs +0 -93
  68. package/esm2020/lib/components/forms/basic-form.mjs +0 -1514
  69. package/esm2020/lib/services/event-manager.service.mjs +0 -18
  70. package/esm2020/lib/services/file-manager.service.mjs +0 -6
  71. package/esm2020/lib/services/form-manager.service.mjs +0 -80
  72. package/esm2020/lib/tuain-ng-forms-lib.module.mjs +0 -71
  73. package/esm2020/public-api.mjs +0 -19
  74. package/esm2020/tuain-ng-forms-lib.mjs +0 -5
  75. package/fesm2015/tuain-ng-forms-lib.mjs +0 -4230
  76. package/fesm2015/tuain-ng-forms-lib.mjs.map +0 -1
  77. package/fesm2020/tuain-ng-forms-lib.mjs +0 -4048
  78. package/fesm2020/tuain-ng-forms-lib.mjs.map +0 -1
  79. package/lib/classes/forms/action.d.ts +0 -22
  80. package/lib/classes/forms/element.d.ts +0 -17
  81. package/lib/classes/forms/field.d.ts +0 -205
  82. package/lib/classes/forms/form.constants.d.ts +0 -25
  83. package/lib/classes/forms/form.d.ts +0 -137
  84. package/lib/classes/forms/piece-propagate.d.ts +0 -11
  85. package/lib/classes/forms/piece.d.ts +0 -41
  86. package/lib/classes/forms/section.d.ts +0 -32
  87. package/lib/classes/forms/subsection.d.ts +0 -24
  88. package/lib/classes/forms/table/action.d.ts +0 -15
  89. package/lib/classes/forms/table/column.d.ts +0 -33
  90. package/lib/classes/forms/table/row-data.d.ts +0 -14
  91. package/lib/classes/forms/table/table.d.ts +0 -100
  92. package/lib/components/elements/action.component.d.ts +0 -17
  93. package/lib/components/elements/field.component.d.ts +0 -38
  94. package/lib/components/elements/layout/element.component.d.ts +0 -9
  95. package/lib/components/elements/layout/form-error.component.d.ts +0 -8
  96. package/lib/components/elements/layout/form-header.component.d.ts +0 -12
  97. package/lib/components/elements/layout/piece.component.d.ts +0 -10
  98. package/lib/components/elements/layout/section.component.d.ts +0 -11
  99. package/lib/components/elements/layout/sub-section.component.d.ts +0 -11
  100. package/lib/components/elements/tables/table-record-action.component.d.ts +0 -16
  101. package/lib/components/elements/tables/table-record-field.component.d.ts +0 -12
  102. package/lib/components/elements/tables/table.component.d.ts +0 -35
  103. package/lib/components/forms/basic-form.d.ts +0 -353
  104. package/lib/services/event-manager.service.d.ts +0 -9
  105. package/lib/services/file-manager.service.d.ts +0 -5
  106. package/lib/services/form-manager.service.d.ts +0 -28
  107. package/lib/tuain-ng-forms-lib.module.d.ts +0 -20
  108. package/tuain-ng-forms-lib.d.ts +0 -5
@@ -0,0 +1,152 @@
1
+ import { Subject } from 'rxjs';
2
+ import { FormPiecePropagate } from './piece-propagate';
3
+ import { FormAction } from './action';
4
+ import { RecordFormSubSection } from './subsection';
5
+
6
+ const ACTIVE = 'active';
7
+
8
+ export class RecordFormSection extends FormPiecePropagate {
9
+ private readonly _activation = new Subject<string>();
10
+ private readonly _inactivation = new Subject<string>();
11
+
12
+ active = false;
13
+ sectionId: string | null = null;
14
+ sectionCode: string | null = null;
15
+ sectionTitle: string | null = null;
16
+ subSections: RecordFormSubSection[] = [];
17
+ subSectionsObj: any;
18
+ private _exclusiveSubSectionsByAttr = {};
19
+
20
+ constructor(sectionReceived, formObject, formConfig) {
21
+ super(sectionReceived, formConfig);
22
+ this.propagationCustomAttributes = this._formConfig?.propagationCustomAttributes?.sections ?? [];
23
+ if (!sectionReceived) { return; }
24
+ this.sectionId = (sectionReceived.sectionId) ? sectionReceived.sectionId.toString() : '';
25
+ this.sectionCode = (sectionReceived.sectionCode) ? sectionReceived.sectionCode : '';
26
+ this.sectionTitle = (sectionReceived.sectionTitle) ? sectionReceived.sectionTitle : '';
27
+ this.subSections = [];
28
+ this.subSectionsObj = {};
29
+ if (sectionReceived.subsections) {
30
+ const subsections = sectionReceived.subsections.map(subSecDef => {
31
+ const visibleStates = subSecDef.visibleStates ?? [];
32
+ if (subSecDef.elements && Array.isArray(subSecDef.elements)) {
33
+ subSecDef.elements = subSecDef.elements.map(elm => ({ code: elm.elementCode, type: elm.elementTypeName }));
34
+ }
35
+ return { ...subSecDef, visibleStates };
36
+ });
37
+ for (const subsectionReceived of subsections) {
38
+ const subSectionToAdd = new RecordFormSubSection(subsectionReceived, formObject, formConfig);
39
+ const subsectionCode = subSectionToAdd.subsectionCode;
40
+ if (subsectionCode) {
41
+ this.subSections.push(subSectionToAdd);
42
+ this.subSectionsObj[subsectionCode] = subSectionToAdd;
43
+ }
44
+ }
45
+ }
46
+ }
47
+
48
+ get code() { return this.sectionCode; }
49
+ get activation() { return this._activation; }
50
+ get inactivation() { return this._inactivation; }
51
+
52
+ activate() {
53
+ if (!this.active) {
54
+ this.active = true;
55
+ this.sectionCode && this._activation.next(this.sectionCode);
56
+ }
57
+ }
58
+
59
+ inactivate() {
60
+ if (this.active) {
61
+ this.active = false;
62
+ this.sectionCode && this._inactivation.next(this.sectionCode);
63
+ }
64
+ }
65
+
66
+ get title() { return this.sectionTitle; }
67
+ set title(title) { this.sectionTitle = title; }
68
+
69
+ getVisibleSubsections(state) {
70
+ return this.subSections.filter(subSection => subSection.visible);
71
+ }
72
+
73
+ getSubsection(subSectionCode) {
74
+ return (this.subSectionsObj && this.subSectionsObj[subSectionCode])
75
+ ? this.subSectionsObj[subSectionCode] : null;
76
+ }
77
+
78
+ activateSubSection(subSectionCode) {
79
+ if (subSectionCode === this._exclusiveSubSectionsByAttr[ACTIVE]) { return; }
80
+ const subSection = (this.subSectionsObj && this.subSectionsObj[subSectionCode])
81
+ ? this.subSectionsObj[subSectionCode] : null;
82
+ if (subSection) {
83
+ subSection?.activate();
84
+ this._exclusiveSubSectionsByAttr[ACTIVE] = subSectionCode;
85
+ }
86
+ }
87
+
88
+ getFields() {
89
+ let fieldsArray: any[] = [];
90
+ if (this.subSections && this.subSections.length > 0) {
91
+ for (const subSection of this.subSections) {
92
+ const subsectionFields: any[] = subSection.getFields() ?? [];
93
+ if (subsectionFields?.length > 0) {
94
+ fieldsArray = fieldsArray.concat(subsectionFields);
95
+ }
96
+ }
97
+ }
98
+ return fieldsArray;
99
+ }
100
+
101
+ getActions(): FormAction[] {
102
+ let actionArray: any[] = [];
103
+ if (this.subSections && this.subSections.length > 0) {
104
+ for (const subSection of this.subSections) {
105
+ const subSectionActions = subSection.getActions() ?? [];
106
+ if (subSectionActions?.length > 0) {
107
+ actionArray = actionArray.concat(subSectionActions);
108
+ }
109
+ }
110
+ }
111
+ return actionArray;
112
+ }
113
+
114
+ getActionNames(): string[] {
115
+ let actionArray: string[] = [];
116
+ if (this.subSections && this.subSections.length > 0) {
117
+ for (const subSection of this.subSections) {
118
+ actionArray = actionArray.concat(subSection.getActionNames());
119
+ }
120
+ }
121
+ return actionArray;
122
+ }
123
+
124
+ getFieldNames() {
125
+ let fieldsArray: string[] = [];
126
+ if (this.subSections && this.subSections.length > 0) {
127
+ for (const subSection of this.subSections) {
128
+ fieldsArray = fieldsArray.concat(subSection.getFieldNames());
129
+ }
130
+ }
131
+ return fieldsArray;
132
+ }
133
+
134
+ getField(name) {
135
+ let field = null;
136
+ if (this.subSections && this.subSections.length > 0) {
137
+ for (const subSection of this.subSections) {
138
+ field = subSection.getField(name);
139
+ if (field) {
140
+ return field;
141
+ }
142
+ }
143
+ }
144
+ return null;
145
+ }
146
+
147
+ override formStateChangeCustomSubscribe(formChangeSubject) {
148
+ this.subSections?.forEach(subsection => {
149
+ subsection?.subscribeFormStateChange(formChangeSubject);
150
+ });
151
+ }
152
+ }
@@ -0,0 +1,90 @@
1
+ import { FormPiecePropagate } from './piece-propagate';
2
+ import { FormAction } from './action';
3
+ import { elementTypes } from './form.constants';
4
+
5
+ export class RecordFormSubSection extends FormPiecePropagate {
6
+ _customRender: string | null = null;
7
+ subsectionId: string | null = null;
8
+ subsectionCode: string | null = null;
9
+ subsectionTitle: string | null = null;
10
+
11
+ subSectionElements: any[] = [];
12
+ subSectionFields: any[] = [];
13
+ subSectionTables: any[] = [];
14
+ subSectionActions: any[] = [];
15
+ elementsArray: any = {};
16
+ active = false;
17
+
18
+ constructor(subsectionReceived, formObject, formConfig) {
19
+ super(subsectionReceived, formConfig);
20
+ this.propagationCustomAttributes = this._formConfig?.propagationCustomAttributes?.subsections ?? [];
21
+ if (!subsectionReceived) { return; }
22
+ this.subsectionId = (subsectionReceived.subsectionId) ? subsectionReceived.subsectionId.toString() : '';
23
+ this.subsectionCode = (subsectionReceived.subsectionCode) ? subsectionReceived.subsectionCode : '';
24
+ this.subsectionTitle = (subsectionReceived.subsectionTitle) ? subsectionReceived.subsectionTitle : '';
25
+ if (subsectionReceived.elements) {
26
+ for (const receivedElement of subsectionReceived.elements) {
27
+ let elementObject: any = null;
28
+ let arrayToAdd: any[] = [];
29
+ const { type, code } = receivedElement;
30
+ switch (type) {
31
+ case elementTypes.field:
32
+ elementObject = formObject.getField(code);
33
+ arrayToAdd = this.subSectionFields;
34
+ break;
35
+ case elementTypes.table:
36
+ elementObject = formObject.getTable(code);
37
+ arrayToAdd = this.subSectionTables;
38
+ break;
39
+ case elementTypes.action:
40
+ elementObject = formObject.getAction(code);
41
+ arrayToAdd = this.subSectionActions;
42
+ break;
43
+ }
44
+ if (elementObject) {
45
+ elementObject.elementType = type;
46
+ arrayToAdd.push(elementObject);
47
+ this.subSectionElements.push(elementObject);
48
+ this.elementsArray[code] = elementObject;
49
+ }
50
+ }
51
+ }
52
+ }
53
+
54
+ get customRender() { return this._customRender; }
55
+ set customRender(customRenderName) { this._customRender = customRenderName; }
56
+
57
+ getField(name) {
58
+ return this.subSectionFields.find(fld => fld.name === name);
59
+ }
60
+
61
+ getFields() {
62
+ return this.subSectionFields;
63
+ }
64
+
65
+ getFieldNames() {
66
+ return this.subSectionFields.map(field => field.code);
67
+ }
68
+
69
+ getActions(): FormAction[] {
70
+ return this.subSectionActions;
71
+ }
72
+
73
+ getActionNames(): string[] {
74
+ return this.subSectionActions.map(action => action.actionCode);
75
+ }
76
+
77
+ activate() {
78
+ if (!this.active) {
79
+ this.active = true;
80
+ // this.subsectionCode && this._activation.next(this.subsectionCode);
81
+ }
82
+ }
83
+
84
+ inactivate() {
85
+ if (this.active) {
86
+ this.active = false;
87
+ // this.subsectionCode && this._inactivation.next(this.subsectionCode);
88
+ }
89
+ }
90
+ }
@@ -0,0 +1,32 @@
1
+ import { FormPiece } from '../piece';
2
+ export class TableAction extends FormPiece {
3
+ newState: string;
4
+
5
+ actionCode: string;
6
+ actionTitle: string;
7
+ iconName: string;
8
+ actionType: string;
9
+ actionClass: string;
10
+ stateField: string;
11
+
12
+ backend: boolean;
13
+ restrictedOnField: string;
14
+ restrictedOnValue: string;
15
+ restrictedOnOperator: string;
16
+
17
+ constructor(actionDefinition, formConfig) {
18
+ super(actionDefinition, formConfig);
19
+
20
+ this.actionCode = actionDefinition.actionCode;
21
+ this.actionTitle = actionDefinition.actionTitle;
22
+ this.iconName = actionDefinition.iconName || this.actionCode;
23
+ this.actionType = actionDefinition.actionType || 'STANDARD';
24
+ this.actionClass = actionDefinition.actionClass || 'INLINE';
25
+ this.newState = actionDefinition.newState;
26
+ this.stateField = actionDefinition.stateField || '';
27
+ this.backend = actionDefinition?.serverAction ?? false;
28
+ this.restrictedOnField = actionDefinition.fieldRestrictedCode || '';
29
+ this.restrictedOnValue = actionDefinition.valueRestricted ?? '';
30
+ this.restrictedOnOperator = actionDefinition.operatorRestricted || '';
31
+ }
32
+ }
@@ -0,0 +1,94 @@
1
+ import { FormPiece } from '../piece';
2
+
3
+ export interface FilterDef {
4
+ operators: string[];
5
+ options: any[];
6
+ }
7
+
8
+ export interface FilterSetup {
9
+ fieldCode: string;
10
+ operator: string;
11
+ values: any[];
12
+ }
13
+ export class RecordTableColumn extends FormPiece {
14
+ fieldCode: string = '';
15
+ fieldTitle: string = '';
16
+ fieldType: string = '';
17
+ fieldAlignment: string = '';
18
+ fieldFormat: string = '';
19
+ sortable: boolean = true;
20
+ searchable: boolean = true;
21
+ sortDirections: string[] = [];
22
+ // Filtros
23
+ filterVisible: boolean = false;
24
+ filterDef: FilterDef | null = null;
25
+ filterSetup: FilterSetup | null = null;
26
+
27
+ constructor(recTableColReceived, formConfig) {
28
+ super(recTableColReceived, formConfig);
29
+ this.filterDef = null;
30
+ if (recTableColReceived) {
31
+ this.fieldCode = recTableColReceived.fieldCode;
32
+ this.fieldTitle = recTableColReceived.fieldTitle;
33
+ this.fieldType = recTableColReceived.fieldTypeCode || this._formConfig.fieldTypes.text;
34
+ const defaultTypeAlignment = (this._formConfig.tableFieldStyles[this.fieldType] != null) ? this._formConfig.tableFieldStyles[this.fieldType]['text-align'] : 'left';
35
+ this.fieldAlignment = (recTableColReceived.alignment != null) ? recTableColReceived.alignment.toLowerCase() : defaultTypeAlignment;
36
+ this._absoluteVisible = recTableColReceived?.visible ?? true;
37
+ this.sortable = recTableColReceived?.sortable ?? false;
38
+ this.searchable = recTableColReceived?.searchable ?? true;
39
+ this.sortDirections = (this.sortable) ? ['ascend', 'descend'] : [];
40
+ this.fieldFormat = recTableColReceived.format || '';
41
+ this.customAttributes = recTableColReceived?.customAttributes ?? {};
42
+ }
43
+ }
44
+
45
+ setSearchable(searchable = true) { this.searchable = searchable; }
46
+
47
+ hideFilter() {
48
+ this.filterVisible = false;
49
+ }
50
+
51
+ addFilterDefinition(filterDefinition) {
52
+ this.filterDef = {
53
+ operators: filterDefinition.operators,
54
+ options: filterDefinition.options ?? null,
55
+ };
56
+ }
57
+
58
+ get filterDefinition() {
59
+ return this.filterDef;
60
+ }
61
+
62
+ addFilter(columnValues, operator) {
63
+ this.filterSetup = {
64
+ fieldCode: this.fieldCode,
65
+ operator: operator ?? this.filterDef?.operators[0],
66
+ values: columnValues,
67
+ }
68
+ }
69
+
70
+ get filter() {
71
+ return this.filterSetup;
72
+ }
73
+
74
+ removeFilter() {
75
+ this.filterSetup = null;
76
+ }
77
+
78
+ get options() {
79
+ if (this.filterDef?.operators?.length === 1 && this.filterDef?.operators[0] === 'IN') {
80
+ return this.filterDef?.options;
81
+ }
82
+ return null;
83
+ }
84
+
85
+ serSortDirections(ascend: boolean, descend: boolean) {
86
+ this.sortDirections = [];
87
+ if (ascend) {
88
+ this.sortDirections.unshift('ascend');
89
+ }
90
+ if (descend) {
91
+ this.sortDirections.unshift('descend');
92
+ }
93
+ }
94
+ }
@@ -0,0 +1,121 @@
1
+ import { RecordTableColumn } from './column';
2
+ import { operators } from '../form.constants';
3
+
4
+ export class TableRecordData {
5
+ recordId: string | null = null;
6
+ selected: boolean = false;
7
+ recordData: any = {};
8
+
9
+ constructor(recordReceived, recordDefinition: RecordTableColumn[], selectionFieldName = null) {
10
+ const { tableRecordId, recordData } = recordReceived;
11
+ this.recordId = tableRecordId;
12
+ if (!recordDefinition || recordDefinition.length === 0 || !recordData || recordData.length === 0) {
13
+ return;
14
+ }
15
+ const fieldNames = recordDefinition.map(column => column.fieldCode);
16
+ if (Array.isArray(recordData)) {
17
+ const rawRecordData = recordData.filter(fieldData => fieldData.fieldCode && fieldNames.includes(fieldData.fieldCode));
18
+ rawRecordData.forEach(fieldData => {
19
+ const { fieldCode, fieldValue } = fieldData;
20
+ const fieldDef = recordDefinition.find(column => column.fieldCode === fieldCode);
21
+ this.recordData[fieldCode] = fieldValue ?? '';
22
+ if (fieldCode === selectionFieldName) {
23
+ this.selected = fieldValue;
24
+ }
25
+ });
26
+ } else {
27
+ const fields = Object.keys(recordData);
28
+ fields.forEach(fieldCode => {
29
+ const fieldValue = recordData[fieldCode];
30
+ const fieldDef = recordDefinition.find(column => column.fieldCode === fieldCode);
31
+ this.recordData[fieldCode] = fieldValue ?? '';
32
+ });
33
+ }
34
+ }
35
+
36
+ toggleSelect() { this.selected = !this.selected; }
37
+ select() { this.selected = true; }
38
+ unselect() { this.selected = false; }
39
+
40
+ get recordIdKey() {
41
+ return (typeof this.recordId === 'object')
42
+ ? JSON.stringify(this.recordId) : this.recordId;
43
+ }
44
+
45
+ getFieldValue(fieldCode): any {
46
+ return (fieldCode && this.recordData) ? this.recordData[fieldCode] : null;
47
+ }
48
+
49
+ hasPattern(words, columnObj) {
50
+ if (!words || words.length === 0) {
51
+ return true;
52
+ }
53
+ for (const word of words) {
54
+ let wordIsPresent = false;
55
+ for (const fieldCode in this.recordData) {
56
+ const columnDef = columnObj?.[fieldCode];
57
+ if (columnDef?.searchable && this.recordData.hasOwnProperty(fieldCode)) {
58
+ const term = word.toUpperCase();
59
+ let fieldValue;
60
+ if (columnDef.fieldType.toUpperCase().includes('DATE')) {
61
+ fieldValue = this.recordData[fieldCode].substring(0, 16);
62
+ } else {
63
+ fieldValue = this.recordData[fieldCode];
64
+ }
65
+ if (fieldValue.toString().toUpperCase().includes(term)) {
66
+ wordIsPresent = true;
67
+ break;
68
+ }
69
+ }
70
+ }
71
+ if (!wordIsPresent) {
72
+ return false;
73
+ }
74
+ }
75
+ return true;
76
+ }
77
+
78
+ hasCondition(columnFilters) {
79
+ if (!columnFilters || columnFilters.length === 0) {
80
+ return true;
81
+ }
82
+ for (const condition of columnFilters) {
83
+ const { fieldCode, operator, values } = condition;
84
+ if (this.recordData.hasOwnProperty(fieldCode)) {
85
+ const fieldValue = this.recordData[fieldCode];
86
+ const stringValue = fieldValue.toString().toUpperCase();
87
+ if (operator === operators.G && fieldValue <= values[0]) {
88
+ return false;
89
+ }
90
+ if (operator === operators.L && fieldValue >= values[0]) {
91
+ return false;
92
+ }
93
+ if (operator === operators.GE && fieldValue < values[0]) {
94
+ return false;
95
+ }
96
+ if (operator === operators.LE && fieldValue > values[0]) {
97
+ return false;
98
+ }
99
+ if (operator === operators.IN && !values.includes(fieldValue)) {
100
+ return false;
101
+ }
102
+ if (operator === operators.EQ) {
103
+ return fieldValue === values[0];
104
+ }
105
+ if (operator === operators.NEQ && fieldValue === values[0]) {
106
+ return false;
107
+ }
108
+ if (operator === operators.HAS && !stringValue.includes(values[0].toString().toUpperCase())) {
109
+ return false;
110
+ }
111
+ if (operator === operators.NOTHAS && stringValue.includes(values[0].toString().toUpperCase())) {
112
+ return false;
113
+ }
114
+ if (operator === operators.BETWEEN && (fieldValue < values[0] || fieldValue > values[1])) {
115
+ return false;
116
+ }
117
+ }
118
+ }
119
+ return true;
120
+ }
121
+ }