@techextensor/tab-core-utility 2.1.7 → 2.1.8

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 (177) hide show
  1. package/esm2022/index.mjs +64 -0
  2. package/esm2022/lib/tab-core-utility/app/constants/api-constants.mjs +33 -0
  3. package/esm2022/lib/tab-core-utility/app/constants/common.mjs +25 -0
  4. package/esm2022/lib/tab-core-utility/app/constants/error-messages.mjs +13 -0
  5. package/esm2022/lib/tab-core-utility/app/constants/storage-constants.mjs +16 -0
  6. package/esm2022/lib/tab-core-utility/app/crud/tab-delete.service.mjs +145 -0
  7. package/esm2022/lib/tab-core-utility/app/crud/tab-get.service.mjs +131 -0
  8. package/esm2022/lib/tab-core-utility/app/crud/tab-insert.service.mjs +77 -0
  9. package/esm2022/lib/tab-core-utility/app/crud/tab-update.service.mjs +105 -0
  10. package/esm2022/lib/tab-core-utility/app/crud/tab-workflow.service.mjs +43 -0
  11. package/esm2022/lib/tab-core-utility/app/enums/controllers.enum.mjs +26 -0
  12. package/esm2022/lib/tab-core-utility/app/enums/dsq.enum.mjs +48 -0
  13. package/esm2022/lib/tab-core-utility/app/enums/permission.enum.mjs +20 -0
  14. package/esm2022/lib/tab-core-utility/app/enums/query.enum.mjs +14 -0
  15. package/esm2022/lib/tab-core-utility/app/enums/workflow.enum.mjs +37 -0
  16. package/esm2022/lib/tab-core-utility/app/helpers/common/app.helpers.mjs +68 -0
  17. package/esm2022/lib/tab-core-utility/app/helpers/common/dsq.helpers.mjs +70 -0
  18. package/esm2022/lib/tab-core-utility/app/helpers/common/req-res.helpers.mjs +64 -0
  19. package/esm2022/lib/tab-core-utility/app/helpers/common/where-clause.helpers.mjs +208 -0
  20. package/esm2022/lib/tab-core-utility/app/helpers/screen/forms.helpers.mjs +38 -0
  21. package/esm2022/lib/tab-core-utility/app/helpers/screen/grid-column-data.helpers.mjs +78 -0
  22. package/esm2022/lib/tab-core-utility/app/helpers/screen/grid.helpers.mjs +112 -0
  23. package/esm2022/lib/tab-core-utility/app/helpers/screen/media-upload.helpers.mjs +77 -0
  24. package/esm2022/lib/tab-core-utility/app/helpers/screen/plugin.helpers.mjs +55 -0
  25. package/esm2022/lib/tab-core-utility/app/helpers/screen/screen.helpers.mjs +26 -0
  26. package/esm2022/lib/tab-core-utility/app/interfaces/auth.interface.mjs +2 -0
  27. package/esm2022/lib/tab-core-utility/app/interfaces/common-api.interface.mjs +2 -0
  28. package/esm2022/lib/tab-core-utility/app/interfaces/grid.interface.mjs +3 -0
  29. package/esm2022/lib/tab-core-utility/app/interfaces/orgInfo.interface.mjs +2 -0
  30. package/esm2022/lib/tab-core-utility/app/interfaces/schema.interface.mjs +2 -0
  31. package/esm2022/lib/tab-core-utility/app/interfaces/user.interface.mjs +2 -0
  32. package/esm2022/lib/tab-core-utility/app/models/api-query.class.mjs +47 -0
  33. package/esm2022/lib/tab-core-utility/app/models/app-object.class.mjs +30 -0
  34. package/esm2022/lib/tab-core-utility/app/models/common.class.mjs +12 -0
  35. package/esm2022/lib/tab-core-utility/app/models/data-source-queries.class.mjs +31 -0
  36. package/esm2022/lib/tab-core-utility/app/utils/filter.util.mjs +75 -0
  37. package/esm2022/lib/tab-core-utility/app/utils/form-builder.util.mjs +39 -0
  38. package/esm2022/lib/tab-core-utility/app/utils/json.util.mjs +138 -0
  39. package/esm2022/lib/tab-core-utility/app/utils/operators.util.mjs +129 -0
  40. package/esm2022/lib/tab-core-utility/app/utils/req-res.util.mjs +168 -0
  41. package/esm2022/lib/tab-core-utility/app/utils/tab-app.util.mjs +99 -0
  42. package/esm2022/lib/tab-core-utility/auth/auth.service.mjs +74 -0
  43. package/esm2022/lib/tab-core-utility/auth/idb-storage.service.mjs +69 -0
  44. package/esm2022/lib/tab-core-utility/auth/local-storage.service.mjs +52 -0
  45. package/esm2022/lib/tab-core-utility/auth/session-storage.service.mjs +52 -0
  46. package/esm2022/lib/tab-core-utility/core/error-handler/error-handler-interceptor.service.mjs +26 -0
  47. package/esm2022/lib/tab-core-utility/core/error-handler/error-handler.store.mjs +21 -0
  48. package/esm2022/lib/tab-core-utility/core/error-handler/models/error-handler.state.mjs +5 -0
  49. package/esm2022/lib/tab-core-utility/core/http-client/api-url.token.mjs +4 -0
  50. package/esm2022/lib/tab-core-utility/core/http-client/api.service.mjs +99 -0
  51. package/esm2022/lib/tab-core-utility/core/util/auth.utils.mjs +21 -0
  52. package/esm2022/lib/tab-core-utility/store/auth.store.mjs +43 -0
  53. package/esm2022/lib/tab-core-utility/store/orginfo.store.mjs +42 -0
  54. package/esm2022/lib/tab-core-utility/store/schema.store.mjs +68 -0
  55. package/esm2022/techextensor-tab-core-utility.mjs +5 -0
  56. package/{src/index.ts → index.d.ts} +53 -77
  57. package/lib/tab-core-utility/app/constants/api-constants.d.ts +30 -0
  58. package/lib/tab-core-utility/app/constants/common.d.ts +8 -0
  59. package/lib/tab-core-utility/app/constants/error-messages.d.ts +6 -0
  60. package/lib/tab-core-utility/app/constants/storage-constants.d.ts +15 -0
  61. package/lib/tab-core-utility/app/crud/tab-delete.service.d.ts +51 -0
  62. package/lib/tab-core-utility/app/crud/tab-get.service.d.ts +58 -0
  63. package/lib/tab-core-utility/app/crud/tab-insert.service.d.ts +37 -0
  64. package/lib/tab-core-utility/app/crud/tab-update.service.d.ts +14 -0
  65. package/lib/tab-core-utility/app/crud/tab-workflow.service.d.ts +20 -0
  66. package/lib/tab-core-utility/app/enums/controllers.enum.d.ts +24 -0
  67. package/lib/tab-core-utility/app/enums/dsq.enum.d.ts +42 -0
  68. package/lib/tab-core-utility/app/enums/permission.enum.d.ts +16 -0
  69. package/lib/tab-core-utility/app/enums/query.enum.d.ts +11 -0
  70. package/lib/tab-core-utility/app/enums/workflow.enum.d.ts +30 -0
  71. package/lib/tab-core-utility/app/helpers/common/app.helpers.d.ts +31 -0
  72. package/lib/tab-core-utility/app/helpers/common/dsq.helpers.d.ts +32 -0
  73. package/lib/tab-core-utility/app/helpers/common/req-res.helpers.d.ts +62 -0
  74. package/lib/tab-core-utility/app/helpers/common/where-clause.helpers.d.ts +82 -0
  75. package/lib/tab-core-utility/app/helpers/screen/forms.helpers.d.ts +11 -0
  76. package/lib/tab-core-utility/app/helpers/screen/grid-column-data.helpers.d.ts +33 -0
  77. package/lib/tab-core-utility/app/helpers/screen/grid.helpers.d.ts +63 -0
  78. package/lib/tab-core-utility/app/helpers/screen/media-upload.helpers.d.ts +38 -0
  79. package/lib/tab-core-utility/app/helpers/screen/plugin.helpers.d.ts +25 -0
  80. package/lib/tab-core-utility/app/helpers/screen/screen.helpers.d.ts +11 -0
  81. package/{src/lib/tab-core-utility/app/interfaces/auth.interface.ts → lib/tab-core-utility/app/interfaces/auth.interface.d.ts} +15 -18
  82. package/lib/tab-core-utility/app/interfaces/common-api.interface.d.ts +24 -0
  83. package/lib/tab-core-utility/app/interfaces/grid.interface.d.ts +110 -0
  84. package/lib/tab-core-utility/app/interfaces/orgInfo.interface.d.ts +31 -0
  85. package/lib/tab-core-utility/app/interfaces/schema.interface.d.ts +11 -0
  86. package/lib/tab-core-utility/app/interfaces/user.interface.d.ts +84 -0
  87. package/lib/tab-core-utility/app/models/api-query.class.d.ts +69 -0
  88. package/lib/tab-core-utility/app/models/app-object.class.d.ts +74 -0
  89. package/lib/tab-core-utility/app/models/common.class.d.ts +24 -0
  90. package/lib/tab-core-utility/app/models/data-source-queries.class.d.ts +95 -0
  91. package/lib/tab-core-utility/app/utils/filter.util.d.ts +30 -0
  92. package/lib/tab-core-utility/app/utils/form-builder.util.d.ts +13 -0
  93. package/lib/tab-core-utility/app/utils/json.util.d.ts +25 -0
  94. package/lib/tab-core-utility/app/utils/operators.util.d.ts +21 -0
  95. package/lib/tab-core-utility/app/utils/req-res.util.d.ts +61 -0
  96. package/lib/tab-core-utility/app/utils/tab-app.util.d.ts +48 -0
  97. package/lib/tab-core-utility/auth/auth.service.d.ts +53 -0
  98. package/lib/tab-core-utility/auth/idb-storage.service.d.ts +14 -0
  99. package/lib/tab-core-utility/auth/local-storage.service.d.ts +22 -0
  100. package/lib/tab-core-utility/auth/session-storage.service.d.ts +22 -0
  101. package/lib/tab-core-utility/core/error-handler/error-handler-interceptor.service.d.ts +3 -0
  102. package/lib/tab-core-utility/core/error-handler/error-handler.store.d.ts +10 -0
  103. package/lib/tab-core-utility/core/error-handler/models/error-handler.state.d.ts +5 -0
  104. package/lib/tab-core-utility/core/http-client/api-url.token.d.ts +3 -0
  105. package/lib/tab-core-utility/core/http-client/api.service.d.ts +65 -0
  106. package/lib/tab-core-utility/core/util/auth.utils.d.ts +9 -0
  107. package/lib/tab-core-utility/store/auth.store.d.ts +19 -0
  108. package/lib/tab-core-utility/store/orginfo.store.d.ts +22 -0
  109. package/lib/tab-core-utility/store/schema.store.d.ts +32 -0
  110. package/package.json +31 -18
  111. package/.eslintrc.json +0 -92
  112. package/README.md +0 -7
  113. package/jest.config.ts +0 -22
  114. package/ng-package.json +0 -7
  115. package/project.json +0 -42
  116. package/src/lib/tab-core-utility/app/constants/api-constants.ts +0 -33
  117. package/src/lib/tab-core-utility/app/constants/common.ts +0 -34
  118. package/src/lib/tab-core-utility/app/constants/error-messages.ts +0 -21
  119. package/src/lib/tab-core-utility/app/constants/storage-constants.ts +0 -17
  120. package/src/lib/tab-core-utility/app/crud/tab-delete.service.ts +0 -144
  121. package/src/lib/tab-core-utility/app/crud/tab-get.service.ts +0 -160
  122. package/src/lib/tab-core-utility/app/crud/tab-insert.service.ts +0 -75
  123. package/src/lib/tab-core-utility/app/crud/tab-update.service.ts +0 -105
  124. package/src/lib/tab-core-utility/app/crud/tab-workflow.service.ts +0 -39
  125. package/src/lib/tab-core-utility/app/enums/controllers.enum.ts +0 -24
  126. package/src/lib/tab-core-utility/app/enums/dsq.enum.ts +0 -46
  127. package/src/lib/tab-core-utility/app/enums/permission.enum.ts +0 -18
  128. package/src/lib/tab-core-utility/app/enums/query.enum.ts +0 -12
  129. package/src/lib/tab-core-utility/app/enums/workflow.enum.ts +0 -35
  130. package/src/lib/tab-core-utility/app/helpers/common/app.helpers.ts +0 -65
  131. package/src/lib/tab-core-utility/app/helpers/common/dsq.helpers.ts +0 -80
  132. package/src/lib/tab-core-utility/app/helpers/common/req-res.helpers.ts +0 -75
  133. package/src/lib/tab-core-utility/app/helpers/common/where-clause.helpers.ts +0 -262
  134. package/src/lib/tab-core-utility/app/helpers/screen/forms.helpers.ts +0 -33
  135. package/src/lib/tab-core-utility/app/helpers/screen/grid-column-data.helpers.ts +0 -88
  136. package/src/lib/tab-core-utility/app/helpers/screen/grid.helpers.ts +0 -113
  137. package/src/lib/tab-core-utility/app/helpers/screen/media-upload.helpers.ts +0 -74
  138. package/src/lib/tab-core-utility/app/helpers/screen/plugin.helpers.ts +0 -52
  139. package/src/lib/tab-core-utility/app/helpers/screen/screen.helpers.ts +0 -20
  140. package/src/lib/tab-core-utility/app/interfaces/common-api.interface.ts +0 -27
  141. package/src/lib/tab-core-utility/app/interfaces/grid.interface.ts +0 -118
  142. package/src/lib/tab-core-utility/app/interfaces/orgInfo.interface.ts +0 -34
  143. package/src/lib/tab-core-utility/app/interfaces/schema.interface.ts +0 -11
  144. package/src/lib/tab-core-utility/app/interfaces/user.interface.ts +0 -91
  145. package/src/lib/tab-core-utility/app/models/api-query.class.ts +0 -92
  146. package/src/lib/tab-core-utility/app/models/app-object.class.ts +0 -87
  147. package/src/lib/tab-core-utility/app/models/common.class.ts +0 -30
  148. package/src/lib/tab-core-utility/app/models/data-source-queries.class.ts +0 -114
  149. package/src/lib/tab-core-utility/app/utils/filter.util.ts +0 -78
  150. package/src/lib/tab-core-utility/app/utils/form-builder.util.ts +0 -31
  151. package/src/lib/tab-core-utility/app/utils/json.util.ts +0 -137
  152. package/src/lib/tab-core-utility/app/utils/operators.util.ts +0 -129
  153. package/src/lib/tab-core-utility/app/utils/req-res.util.ts +0 -189
  154. package/src/lib/tab-core-utility/app/utils/tab-app.util.ts +0 -131
  155. package/src/lib/tab-core-utility/auth/auth.service.spec.ts +0 -167
  156. package/src/lib/tab-core-utility/auth/auth.service.ts +0 -91
  157. package/src/lib/tab-core-utility/auth/idb-storage.service.ts +0 -77
  158. package/src/lib/tab-core-utility/auth/local-storage.service.spec.ts +0 -47
  159. package/src/lib/tab-core-utility/auth/local-storage.service.ts +0 -46
  160. package/src/lib/tab-core-utility/auth/session-storage.service.spec.ts +0 -47
  161. package/src/lib/tab-core-utility/auth/session-storage.service.ts +0 -46
  162. package/src/lib/tab-core-utility/core/error-handler/error-handler-interceptor.service.ts +0 -32
  163. package/src/lib/tab-core-utility/core/error-handler/error-handler.store.spec.ts +0 -16
  164. package/src/lib/tab-core-utility/core/error-handler/error-handler.store.ts +0 -26
  165. package/src/lib/tab-core-utility/core/error-handler/models/error-handler.state.ts +0 -9
  166. package/src/lib/tab-core-utility/core/http-client/api-url.token.ts +0 -4
  167. package/src/lib/tab-core-utility/core/http-client/api.service.spec.ts +0 -18
  168. package/src/lib/tab-core-utility/core/http-client/api.service.ts +0 -105
  169. package/src/lib/tab-core-utility/core/util/auth.utils.ts +0 -22
  170. package/src/lib/tab-core-utility/store/auth.store.ts +0 -54
  171. package/src/lib/tab-core-utility/store/orginfo.store.ts +0 -57
  172. package/src/lib/tab-core-utility/store/schema.store.ts +0 -85
  173. package/src/test-setup.ts +0 -8
  174. package/tsconfig.json +0 -29
  175. package/tsconfig.lib.json +0 -17
  176. package/tsconfig.lib.prod.json +0 -7
  177. package/tsconfig.spec.json +0 -16
@@ -1,262 +0,0 @@
1
- /* eslint-disable @typescript-eslint/no-explicit-any */
2
-
3
- import { Injectable } from '@angular/core';
4
- import { from } from 'rxjs';
5
- import { filter, map, toArray } from 'rxjs/operators';
6
-
7
- import {
8
- ConjuctionClause,
9
- RelationalOperator,
10
- FilterValueType,
11
- } from '../../enums/dsq.enum';
12
- import { APIFilterCriteria } from '../../models/api-query.class';
13
- import {
14
- getAppObjectFromSystemDBTableName,
15
- getAppObject,
16
- } from '../../utils/tab-app.util';
17
-
18
- @Injectable({ providedIn: 'root' })
19
- export class WhereClauseHelper {
20
- /**
21
- * Binds the where clause for deleting records based on field, value, field name, and CRUD table name
22
- * @param fields The fields to bind the where clause
23
- * @param value The value to match in the where clause
24
- * @param fieldName The field name to match in the where clause
25
- * @param crudTableName The CRUD table name for the where clause
26
- * @returns The bound where clause for delete operation
27
- */
28
- bindWhereClauseForDelete(
29
- fields: any,
30
- value: any,
31
- fieldName: string,
32
- crudTableName: string
33
- ) {
34
- const appobj = getAppObjectFromSystemDBTableName(crudTableName);
35
- if (appobj && appobj.CRUDAppObjectId !== null) {
36
- const crudAppObj = getAppObject(appobj.CRUDAppObjectId);
37
- if (crudAppObj) {
38
- crudTableName = crudAppObj.SystemDBTableName;
39
- }
40
- }
41
- return this.bindWhereClause(fields, value, fieldName, crudTableName);
42
- }
43
-
44
- /**
45
- * Binds the where clause for deleting records with multiple primary keys
46
- * @param data The data containing primary key values
47
- * @param fieldName The field name of the primary key
48
- * @param crudTableName The CRUD table name for the where clause
49
- * @returns The bound where clause for delete operation with multiple primary keys
50
- */
51
- bindWhereClauseForDeleteWithMultiplePrimaryKeys(
52
- data: any,
53
- fieldName: string,
54
- crudTableName: string
55
- ) {
56
- return this.bindWhereClauseForMultiplePrimaryKeys(
57
- data,
58
- fieldName,
59
- crudTableName
60
- );
61
- }
62
-
63
- /**
64
- * Binds the where clause for an insert operation
65
- * @returns The bound where clause for insert operation
66
- */
67
- bindWhereClauseForInsert() {
68
- return this.bindWhereClauseEmpty();
69
- }
70
-
71
- /**
72
- * Binds an empty where clause
73
- * @returns The bound empty where clause
74
- */
75
- bindWhereClauseEmpty() {
76
- const whereClause = new APIFilterCriteria();
77
- whereClause.FilterLogic = '1';
78
- whereClause.Filters = [];
79
- return whereClause;
80
- }
81
-
82
- /**
83
- * Binds the where clause based on provided parameters
84
- * @param fields The fields to bind the where clause
85
- * @param value The value to match in the where clause
86
- * @param fieldName The field name to match in the where clause
87
- * @param crudTableName The CRUD table name for the where clause
88
- * @returns The bound where clause
89
- */
90
- private bindWhereClause(
91
- fields: any,
92
- value: any,
93
- fieldName: string,
94
- crudTableName: string
95
- ) {
96
- return from(fields).pipe(
97
- filter((f: any) =>
98
- fieldName
99
- ? f.Field?.FieldName === fieldName
100
- : f.Field?.FieldName === 'Id' || f.Field?.FieldName === 'ID'
101
- ),
102
- map((field: any) => ({
103
- ConjuctionClause: ConjuctionClause.AND,
104
- FieldID: crudTableName + '.' + field.Field.SystemDBFieldName,
105
- RelationalOperator: RelationalOperator.EqualTo,
106
- ValueType: FilterValueType.Literal,
107
- value: value,
108
- Sequence: 0,
109
- GroupID: 0,
110
- })),
111
- toArray(),
112
- map((filters: any[]) => {
113
- const whereClause = new APIFilterCriteria();
114
- whereClause.Filters = filters;
115
- whereClause.FilterLogic = '1';
116
- return whereClause;
117
- })
118
- );
119
- }
120
-
121
- /**
122
- * Binds the where clause for deleting records with multiple primary keys
123
- * @param data The data containing primary key values
124
- * @param primaryKeys The array of primary key fields
125
- * @param crudTableName The CRUD table name for the where clause
126
- * @returns The bound where clause for delete operation with multiple primary keys
127
- */
128
- bindWhereClauseForMultiplePrimaryKeys(
129
- data: any,
130
- primaryKeys: any,
131
- crudTableName: string
132
- ) {
133
- const whereClause = new APIFilterCriteria();
134
- whereClause.Filters = [];
135
- if (primaryKeys && primaryKeys.length > 0) {
136
- primaryKeys.forEach((element: any) => {
137
- const value = data[element.FieldName];
138
- if (value) {
139
- const filter: any = {
140
- ConjuctionClause: ConjuctionClause.AND,
141
- FieldID: crudTableName + '.' + element.SystemDBFieldName,
142
- RelationalOperator: RelationalOperator.EqualTo,
143
- ValueType: FilterValueType.Literal,
144
- value: value,
145
- Sequence: 0,
146
- GroupID: 0,
147
- };
148
- whereClause.Filters.push(filter);
149
- }
150
- });
151
- }
152
- whereClause.FilterLogic = '1';
153
- return whereClause;
154
- }
155
-
156
- /**
157
- * Binds the where clause for updating records
158
- * @param tableName The name of the table to update
159
- * @param queryFieldsArray The array of fields and values for the update query
160
- * @returns The bound where clause for update operation
161
- */
162
- bindWhereClauseForUpdate(tableName: string, queryFieldsArray: any) {
163
- const whereClause = new APIFilterCriteria();
164
- whereClause.Filters = [];
165
- if (queryFieldsArray.length) {
166
- queryFieldsArray.forEach((element: any) => {
167
- const filter: any = {
168
- ConjuctionClause: ConjuctionClause.AND,
169
- FieldID: tableName + '.' + element.FieldName,
170
- RelationalOperator: RelationalOperator.EqualTo,
171
- ValueType: FilterValueType.Literal,
172
- value: element.FieldValue,
173
- Sequence: 0,
174
- GroupID: 0,
175
- };
176
- whereClause.Filters.push(filter);
177
- });
178
- }
179
- whereClause.FilterLogic = '1';
180
- return whereClause;
181
- }
182
-
183
- /**
184
- * Binds the where clause for deleting records by table and primary key
185
- * @param tableName The name of the table from which to delete records
186
- * @param primaryKey The name of the primary key field
187
- * @param primaryKeyValue The value of the primary key
188
- * @returns The bound where clause for delete operation using table and primary key
189
- */
190
- bindWhereClauseForDeleteByTable(
191
- tableName: string,
192
- primaryKey: string,
193
- primaryKeyValue: string
194
- ) {
195
- const whereClause = new APIFilterCriteria();
196
- whereClause.Filters = [];
197
- const filter: any = {
198
- ConjuctionClause: ConjuctionClause.AND,
199
- FieldID: tableName + '.' + primaryKey,
200
- RelationalOperator: RelationalOperator.EqualTo,
201
- ValueType: FilterValueType.Literal,
202
- value: primaryKeyValue,
203
- Sequence: 0,
204
- GroupID: 0,
205
- };
206
- whereClause.Filters.push(filter);
207
- whereClause.FilterLogic = '1';
208
- return whereClause;
209
- }
210
-
211
- /**
212
- * Binds the where clause for deleting records using IN operator by table
213
- * @param tableName The name of the table from which to delete records
214
- * @param primaryKey The name of the primary key field
215
- * @param values The array of values for the IN operator
216
- * @returns The bound where clause for delete operation using IN operator and table
217
- */
218
- bindWhereClauseForDeleteUsingInOperatorByTable(
219
- tableName: string,
220
- primaryKey: string,
221
- values: []
222
- ) {
223
- const appobj = getAppObjectFromSystemDBTableName(tableName);
224
- if (appobj?.CRUDAppObjectId !== null) {
225
- const crudAppObj = getAppObject(appobj.CRUDAppObjectId);
226
- if (crudAppObj) {
227
- tableName = crudAppObj.SystemDBTableName;
228
- }
229
- }
230
- const whereClause = new APIFilterCriteria();
231
- whereClause.Filters = [];
232
- const filter: any = {
233
- ConjuctionClause: ConjuctionClause.AND,
234
- FieldID: tableName + '.' + primaryKey,
235
- RelationalOperator: RelationalOperator.IN,
236
- ValueType: FilterValueType.Literal,
237
- value: values.join(','),
238
- Sequence: 0,
239
- GroupID: 0,
240
- };
241
- whereClause.Filters.push(filter);
242
- whereClause.FilterLogic = '1';
243
- return whereClause;
244
- }
245
-
246
- /**
247
- * Binds the where clause for updating records in a grid
248
- * @param Fields The fields to bind the where clause
249
- * @param value The value to match in the where clause
250
- * @param fieldName The field name to match in the where clause
251
- * @param crudTableName The CRUD table name for the where clause
252
- * @returns The bound where clause for update operation in a grid
253
- */
254
- bindWhereClauseForUpdateGrid(
255
- Fields: any,
256
- value: any,
257
- fieldName: string,
258
- crudTableName: string
259
- ) {
260
- return this.bindWhereClause(Fields, value, fieldName, crudTableName);
261
- }
262
- }
@@ -1,33 +0,0 @@
1
- /* eslint-disable @typescript-eslint/no-explicit-any */
2
-
3
- import { Injectable } from '@angular/core';
4
-
5
- @Injectable({ providedIn: 'root' })
6
- export class FormDataHelper {
7
-
8
- /**
9
- * Sets form data based on the provided data object.
10
- * @param data$ An Observable emitting the data object containing form data.
11
- * @returns An Observable emitting an object containing the modified form data.
12
- */
13
- setFormData(data: any) {
14
- const objNew: any = {};
15
- if (!!data && !!data.Result) {
16
- Object.entries(data.Result[0]).forEach(([key, value]) => {
17
- if (key !== undefined) {
18
- if (typeof value === 'number') {
19
- value = value.toString();
20
- }
21
- if (key == 'Logo') {
22
- if (value !== '' && value !== null && value !== undefined) {
23
- // Additional handling can be added here if necessary
24
- }
25
- } else {
26
- objNew[key] = value;
27
- }
28
- }
29
- });
30
- }
31
- return objNew;
32
- }
33
- }
@@ -1,88 +0,0 @@
1
- /* eslint-disable @typescript-eslint/no-explicit-any */
2
-
3
- import { Injectable, inject } from '@angular/core';
4
- import { of } from 'rxjs';
5
- import { map } from 'rxjs/operators';
6
- import { ColumnDetailModel } from '../../interfaces/grid.interface';
7
- import { GridHelper } from './grid.helpers';
8
-
9
- @Injectable({ providedIn: 'root' })
10
- export class GridColumnDataHelper {
11
- private readonly gridHelper = inject(GridHelper);
12
-
13
- /**
14
- * Retrieves column data based on the provided fields.
15
- * @param fields The fields to generate column data from.
16
- * @returns An Observable emitting an array of column data.
17
- */
18
- getColumnData(fields: any) {
19
- return of(fields).pipe(
20
- map((fields: any[]) => {
21
- return fields.map((field) => this.mapToColumnDetailModel(field));
22
- })
23
- );
24
- }
25
-
26
- /**
27
- * Maps field data to a ColumnDetailModel.
28
- * @param field The field data to map.
29
- * @returns The mapped ColumnDetailModel.
30
- */
31
- private mapToColumnDetailModel(field: any): ColumnDetailModel {
32
- const columnD: ColumnDetailModel = {
33
- text: field?.Field?.DisplayName,
34
- dataField: field?.Field?.FieldName,
35
- columntype: this.gridHelper.getColumnType(
36
- field?.Field?.FieldType?.DataType
37
- ),
38
- appFieldId: field?.Field?.ID,
39
- seq: field?.SeqNo,
40
- isPrimaryKey: field?.Field?.IsPrimaryKey,
41
- SystemDBFieldName: field?.Field?.SystemDBFieldName,
42
- };
43
-
44
- if (field?.FieldType == 2) {
45
- columnD.dataField = field?.LookupDetails?.replaceAll('.', '_');
46
- columnD.dataField = field?.FieldDetails?.replaceAll('.', '_');
47
- }
48
-
49
- if (field && field?.Field_GridAttributes) {
50
- const attr = JSON.parse(field?.Field_GridAttributes);
51
- Object.assign(columnD, attr);
52
- if (!!attr.cellsrenderer && attr.cellsrenderer !== '') {
53
- columnD.cellsrenderer = this.getRendererValue(attr.cellsrenderer);
54
- }
55
- }
56
-
57
- if (field && field?.Field?.LookUpDetails) {
58
- columnD.LookUpDetails = field?.Field?.LookUpDetails;
59
- columnD.dropDownLookup = field?.Field?.dropDownData;
60
- }
61
-
62
- return columnD;
63
- }
64
-
65
- /**
66
- * Retrieves the renderer value based on the provided key.
67
- * @param key The key to retrieve the renderer value for.
68
- * @returns The renderer value.
69
- */
70
- private getRendererValue(key: string) {
71
- return key && key === 'LINKRENDERER' ? this.rowLinkRenderer : null;
72
- }
73
-
74
- /**
75
- * Renderer function for rendering row links.
76
- * @param row The row number.
77
- * @param column The column information.
78
- * @param value The value to render.
79
- * @returns The HTML string for rendering the row link.
80
- */
81
- private rowLinkRenderer = (
82
- row: number,
83
- column: any,
84
- value: string
85
- ): string => {
86
- return `&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <a data-row='${row}' style='cursor:pointer;' column-name='${column}' action='redirect' class='Link_click' >${value}</a>`;
87
- };
88
- }
@@ -1,113 +0,0 @@
1
- /* eslint-disable @typescript-eslint/no-explicit-any */
2
- import { Injectable } from '@angular/core';
3
- import { AppObject } from '../../models/app-object.class';
4
- import { getDsqIDFromQueryName } from '../../utils/tab-app.util';
5
- import { of } from 'rxjs';
6
- import { Common } from '../../constants/common';
7
- import { JqWidghtModel } from '../../interfaces/grid.interface';
8
-
9
- @Injectable({ providedIn: 'root' })
10
- export class GridHelper {
11
- /**
12
- * Generates a grid schema for the master app object.
13
- * @param masterAppObj The master app object.
14
- * @param dsqID The data source query ID.
15
- * @returns The generated grid schema.
16
- */
17
- generateGridSchema(masterAppObj: AppObject, dsqID: any) {
18
- const schema = {
19
- label: masterAppObj?.SystemDBTableName,
20
- type: 'customGrid',
21
- key: masterAppObj?.SystemDBTableName,
22
- input: true,
23
- redrawOn: masterAppObj?.SystemDBTableName,
24
- 'customOptions.dataSourceQueryId': dsqID,
25
- };
26
- return schema;
27
- }
28
-
29
- /**
30
- * Generates a grid schema for the child relationship.
31
- * @param childRel The child relationship.
32
- * @param masterAppObj The master app object.
33
- * @returns The generated child grid schema.
34
- */
35
- generateChildGridSchema(childRel: any, masterAppObj: AppObject) {
36
- const dsqNameString =
37
- 'FK_' +
38
- childRel.childDetails.LookupObject +
39
- '_' +
40
- masterAppObj.SystemDBTableName;
41
- const dsqObject = getDsqIDFromQueryName(
42
- childRel.childDetails.LookupObject,
43
- dsqNameString
44
- );
45
- if (dsqObject) {
46
- return {
47
- label: childRel?.childDetails?.LookupObject,
48
- type: 'customGrid',
49
- key: childRel?.childDetails?.LookupObject,
50
- input: true,
51
- redrawOn: masterAppObj?.SystemDBTableName,
52
- 'customOptions.dataSourceQueryId': dsqObject ? dsqObject.ID : '',
53
- logic: [
54
- {
55
- name: 'Update Fields',
56
- trigger: {
57
- type: 'javascript',
58
- javascript: 'result=true;',
59
- },
60
- actions: [
61
- {
62
- name:
63
- 'Refresh ' + childRel?.childDetails?.LookupObject + ' Grid',
64
- type: 'property',
65
- property: {
66
- label: 'parameters',
67
- value: 'customOptions.parameters',
68
- type: 'string',
69
- },
70
- text: '{{data.' + masterAppObj?.SystemDBTableName + '}}',
71
- },
72
- ],
73
- },
74
- ],
75
- };
76
- }
77
- return of({});
78
- }
79
-
80
- /**
81
- * Retrieves the default grid configuration.
82
- * @returns The default grid configuration.
83
- */
84
- getDefaultGridConfiguration(): JqWidghtModel | null {
85
- const tabData: any = Common.tabJson;
86
- if (tabData) {
87
- const configuration = tabData?.AppConfigurations.find(
88
- (c: any) => c.Setting_Key === 'GridConfig'
89
- );
90
- if (configuration) {
91
- return JSON.parse(configuration.Value);
92
- }
93
- }
94
- return null;
95
- }
96
-
97
- /**
98
- * Determines the column type based on the data type.
99
- * @param dataType The data type.
100
- * @returns The column type.
101
- */
102
- getColumnType(dataType: number): string {
103
- if (dataType === 1 || (dataType >= 7 && dataType === 15)) return 'string';
104
- else if (dataType === 2 || dataType === 4 || dataType === 16)
105
- return 'number';
106
- else if (dataType === 3) return 'boolean';
107
- else if (dataType === 4 || (dataType >= 7 && dataType <= 15))
108
- return 'string';
109
- else if (dataType === 5) return 'date';
110
- else if (dataType === 6) return 'dateTime';
111
- else return 'string';
112
- }
113
- }
@@ -1,74 +0,0 @@
1
- /* eslint-disable @typescript-eslint/no-explicit-any */
2
-
3
- import { Injectable, inject } from '@angular/core';
4
- import { ApiService } from '../../../core/http-client/api.service';
5
- import { getHeaders } from '../../utils/req-res.util';
6
- import { Observable, of } from 'rxjs';
7
- import { API } from '../../constants/api-constants';
8
- @Injectable({ providedIn: 'root' })
9
- export class MediaUploadHelper {
10
- private readonly apiService = inject(ApiService);
11
-
12
- /**
13
- * Uploads media object to the server.
14
- * @param mediaObject The media object to upload.
15
- * @returns An Observable that emits the response from the server.
16
- */
17
- uploadMediaFile(mediaObject: any): Observable<any> {
18
- const headers = getHeaders();
19
- if (headers) {
20
- return this.apiService.post(`${API.fileUpload}`, mediaObject, headers);
21
- }
22
- return of(null);
23
- }
24
-
25
- /**
26
- * Retrieves a file from the server by its media ID.
27
- * @param mediaId The ID of the media file to retrieve.
28
- * @returns An Observable that emits the file as a Blob.
29
- */
30
- getFileByMediaId(mediaId: number, params?: any): Observable<Blob> {
31
- const headers = getHeaders();
32
- if (headers) {
33
- return this.apiService.getBlob(`${API.getMediaFile}?mediaId=${mediaId}`, params, headers);
34
- }
35
- return of();
36
- }
37
-
38
- /**
39
- * Downloads all files from the given URL.
40
- * @param endPointName The URL to download files from.
41
- * @returns An Observable that emits the downloaded files as a Blob.
42
- */
43
- downloadAllFiles(endPointName: any): Observable<Blob> {
44
- return this.apiService.getBlob(endPointName);
45
- }
46
-
47
- /**
48
- * Downloads PDF files from the given URL.
49
- * @param endPointName The URL to download PDF files from.
50
- * @param data The data to send along with the request.
51
- * @returns An Observable that emits the downloaded PDF files as a Blob.
52
- */
53
- downloadPdfFiles(endPointName: any, data: any): Observable<Blob> {
54
- const headers = getHeaders();
55
- if (headers) {
56
- return this.apiService.postBlob(endPointName, data, headers);
57
- }
58
- return of();
59
- }
60
-
61
- /**
62
- * Retrieves an image from the server by its media ID.
63
- * @param mediaId The ID of the media file to retrieve.
64
- * @returns An Observable that emits the image as a Blob.
65
- */
66
- getImageByMediaId(mediaId: any, params?: any): Observable<Blob> {
67
- const headers = getHeaders();
68
- if (headers) {
69
- const endPointName = `${API.getImage}?mediaId=${mediaId}`;
70
- return this.apiService.get<Blob>(endPointName, params, headers);
71
- }
72
- return of();
73
- }
74
- }
@@ -1,52 +0,0 @@
1
- /* eslint-disable @typescript-eslint/no-explicit-any */
2
-
3
- import { Injectable, inject } from '@angular/core';
4
- import { Observable, of } from 'rxjs';
5
- import { ApiService } from '../../../core/http-client/api.service';
6
- import { getHeaders } from '../../utils/req-res.util';
7
- import { API } from '../../constants/api-constants';
8
-
9
-
10
- @Injectable({ providedIn: 'root' })
11
- export class PluginHelper {
12
- private readonly apiService = inject(ApiService);
13
-
14
- /**
15
- * Uploads a plugin object to the server.
16
- * @param pluginObject The plugin object to upload.
17
- * @returns An Observable emitting the response from the server.
18
- */
19
- uploadPlugin(pluginObject: any): Observable<any> {
20
- const headers = getHeaders();
21
- if (headers) {
22
- return this.apiService.post(`${API.pluginUpload}`, pluginObject, headers);
23
- }
24
- return of(null);
25
- }
26
-
27
- /**
28
- * Retrieves a file from the server by its ID.
29
- * @param Id The ID of the file to retrieve.
30
- * @returns An Observable emitting the file as a Blob.
31
- */
32
- getFile(Id: number, params?: any): Observable<Blob> {
33
- const headers = getHeaders();
34
- if (headers) {
35
- return this.apiService.getBlob(`${API.getFile}?Id=${Id}`, params, headers);
36
- }
37
- return of();
38
- }
39
-
40
- /**
41
- * Retrieves all plugins by their type from the server.
42
- * @param pluginType The type of plugins to retrieve.
43
- * @returns An Observable emitting the response from the server.
44
- */
45
- getAll(pluginType: number, params?: any): Observable<any> {
46
- const headers = getHeaders();
47
- if (headers) {
48
- return this.apiService.get(`${API.getAllPluginByType}?PluginTypeId=${pluginType}`, params, headers);
49
- }
50
- return of();
51
- }
52
- }
@@ -1,20 +0,0 @@
1
- /* eslint-disable @typescript-eslint/no-explicit-any */
2
- import { Injectable } from '@angular/core';
3
- import { Common } from '../../constants/common';
4
-
5
- @Injectable({ providedIn: 'root' })
6
- export class ScreenHelper {
7
- /**
8
- * Retrieves screen data based on the provided screen ID.
9
- * @param screenId The ID of the screen to retrieve.
10
- * @returns The screen data if found, otherwise null.
11
- */
12
- getScreen(screenId: string) {
13
- const tabData: any = Common.tabJson;
14
- if (tabData) {
15
- return tabData?.AppScreens.find(
16
- (t: any) => t?.ID == screenId.toLowerCase()
17
- );
18
- } else return null;
19
- }
20
- }
@@ -1,27 +0,0 @@
1
- /* eslint-disable @typescript-eslint/no-explicit-any */
2
- export interface ApiResponse {
3
- requestId: string;
4
- isSuccess: boolean;
5
- result: any;
6
- errors: string[];
7
- }
8
- export interface RecordInfo {
9
- isSystemRecord: boolean | null;
10
- blueprintId: string | null;
11
- blueprintStatusId: string | null;
12
- recordId: string;
13
- primaryKey: string;
14
- }
15
-
16
-
17
- export interface CommonApiResponse {
18
- RequestId: string
19
- IsSuccess: boolean
20
- Result: string | any[]
21
- StatusCode: string
22
- RecordAffectted: number
23
- TotalRecords: number
24
- TotalExecutionTime: number
25
- Log: any[]
26
- Errors: any[]
27
- }