@qrvey/filters 0.0.45 → 0.1.0

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 (279) hide show
  1. package/README.md +63 -1
  2. package/dist/cjs/classes/FilterAdapter.js +1 -80
  3. package/dist/cjs/classes/FilterBuilder.js +32 -251
  4. package/dist/cjs/classes/FilterManager.js +7 -64
  5. package/dist/cjs/classes/FilterResources.js +3 -116
  6. package/dist/cjs/classes/FilterSearcher.js +0 -77
  7. package/dist/cjs/classes/FilterValidation.js +0 -93
  8. package/dist/cjs/classes/FilterValues.js +0 -24
  9. package/dist/cjs/classes/index.js +8 -21
  10. package/dist/cjs/helpers/filter-adapt.helpers.js +3 -46
  11. package/dist/cjs/helpers/filter-adapt.legacy.helpers.js +6 -53
  12. package/dist/cjs/helpers/filter-adapt.logic.helpers.js +7 -128
  13. package/dist/cjs/helpers/filter-builder.helpers.js +1 -8
  14. package/dist/cjs/helpers/filter-settings.helpers.js +6 -41
  15. package/dist/cjs/helpers/filter-validators.helpers.js +15 -9
  16. package/dist/cjs/helpers/filter-verbose.helpers.js +211 -0
  17. package/dist/cjs/helpers/getAggregateFilters.js +11 -0
  18. package/dist/cjs/helpers/getFilterId.js +1 -17
  19. package/dist/cjs/helpers/getFilterType.js +1 -8
  20. package/dist/cjs/helpers/index.js +12 -20
  21. package/dist/cjs/helpers/isDateDistinctGrouping.js +15 -0
  22. package/dist/cjs/helpers/isRankingFilter.js +10 -0
  23. package/dist/cjs/helpers/resolveFilterConditions.js +2 -10
  24. package/dist/cjs/helpers/utils.helpers.js +2 -19
  25. package/dist/cjs/index.js +5 -18
  26. package/dist/cjs/models/index.js +4 -17
  27. package/dist/cjs/resources/filter-grouping.resources.js +0 -18
  28. package/dist/cjs/resources/filter-logic.resources.js +0 -3
  29. package/dist/cjs/resources/filter-scopes.resources.js +10 -27
  30. package/dist/cjs/resources/filter-validators.resources.js +0 -3
  31. package/dist/cjs/resources/filter-verbose.resources.js +13 -0
  32. package/dist/cjs/resources/filters.resources.js +0 -12
  33. package/dist/cjs/resources/index.js +12 -24
  34. package/dist/classes/FilterAdapter.d.ts +0 -80
  35. package/dist/classes/FilterAdapter.js +1 -80
  36. package/dist/classes/FilterBuilder.d.ts +2 -177
  37. package/dist/classes/FilterBuilder.js +32 -251
  38. package/dist/classes/FilterManager.d.ts +7 -62
  39. package/dist/classes/FilterManager.js +7 -64
  40. package/dist/classes/FilterResources.d.ts +1 -115
  41. package/dist/classes/FilterResources.js +3 -116
  42. package/dist/classes/FilterSearcher.d.ts +2 -77
  43. package/dist/classes/FilterSearcher.js +0 -77
  44. package/dist/classes/FilterValidation.d.ts +1 -47
  45. package/dist/classes/FilterValidation.js +0 -93
  46. package/dist/classes/FilterValues.d.ts +0 -25
  47. package/dist/classes/FilterValues.js +0 -24
  48. package/dist/classes/index.d.ts +0 -1
  49. package/dist/helpers/filter-adapt.helpers.d.ts +0 -15
  50. package/dist/helpers/filter-adapt.helpers.js +1 -43
  51. package/dist/helpers/filter-adapt.legacy.helpers.d.ts +0 -20
  52. package/dist/helpers/filter-adapt.legacy.helpers.js +3 -49
  53. package/dist/helpers/filter-adapt.logic.helpers.d.ts +0 -22
  54. package/dist/helpers/filter-adapt.logic.helpers.js +3 -123
  55. package/dist/helpers/filter-builder.helpers.d.ts +0 -7
  56. package/dist/helpers/filter-builder.helpers.js +0 -6
  57. package/dist/helpers/filter-settings.helpers.d.ts +0 -35
  58. package/dist/helpers/filter-settings.helpers.js +0 -34
  59. package/dist/helpers/filter-validators.helpers.d.ts +3 -6
  60. package/dist/helpers/filter-validators.helpers.js +11 -7
  61. package/dist/helpers/filter-verbose.helpers.d.ts +6 -0
  62. package/dist/helpers/filter-verbose.helpers.js +206 -0
  63. package/dist/helpers/getAggregateFilters.d.ts +3 -0
  64. package/dist/helpers/getAggregateFilters.js +7 -0
  65. package/dist/helpers/getFilterId.d.ts +0 -16
  66. package/dist/helpers/getFilterId.js +0 -15
  67. package/dist/helpers/getFilterType.d.ts +0 -7
  68. package/dist/helpers/getFilterType.js +0 -6
  69. package/dist/helpers/index.d.ts +5 -1
  70. package/dist/helpers/index.js +5 -0
  71. package/dist/helpers/isDateDistinctGrouping.d.ts +2 -0
  72. package/dist/helpers/isDateDistinctGrouping.js +12 -0
  73. package/dist/helpers/isRankingFilter.d.ts +2 -0
  74. package/dist/helpers/isRankingFilter.js +7 -0
  75. package/dist/helpers/resolveFilterConditions.d.ts +0 -8
  76. package/dist/helpers/resolveFilterConditions.js +1 -8
  77. package/dist/helpers/utils.helpers.d.ts +0 -17
  78. package/dist/helpers/utils.helpers.js +0 -16
  79. package/dist/index.d.ts +0 -1
  80. package/dist/models/filter-builder.models.d.ts +0 -156
  81. package/dist/models/filter-resources.models.d.ts +0 -53
  82. package/dist/models/filter-searcher.models.d.ts +5 -34
  83. package/dist/models/filter-validation.models.d.ts +0 -40
  84. package/dist/models/index.d.ts +0 -1
  85. package/dist/resources/filter-functions.resources.d.ts +0 -49
  86. package/dist/resources/filter-grouping.resources.d.ts +0 -7
  87. package/dist/resources/filter-grouping.resources.js +0 -18
  88. package/dist/resources/filter-logic.resources.d.ts +0 -79
  89. package/dist/resources/filter-logic.resources.js +0 -3
  90. package/dist/resources/filter-operators.resources.d.ts +0 -1
  91. package/dist/resources/filter-panel.interfaces.d.ts +0 -49
  92. package/dist/resources/filter-scopes.resources.d.ts +2 -25
  93. package/dist/resources/filter-scopes.resources.js +10 -27
  94. package/dist/resources/filter-validation.resources.d.ts +0 -1
  95. package/dist/resources/filter-validators.resources.d.ts +0 -1
  96. package/dist/resources/filter-validators.resources.js +0 -3
  97. package/dist/resources/filter-values.resources.d.ts +0 -13
  98. package/dist/resources/filter-verbose.resources.d.ts +23 -0
  99. package/dist/resources/filter-verbose.resources.js +10 -0
  100. package/dist/resources/filter-visual.resources.d.ts +0 -50
  101. package/dist/resources/filters.resources.d.ts +1 -102
  102. package/dist/resources/filters.resources.js +0 -12
  103. package/dist/resources/index.d.ts +1 -1
  104. package/dist/resources/index.js +1 -0
  105. package/package.json +59 -44
  106. package/.eslintignore +0 -6
  107. package/.eslintrc.json +0 -122
  108. package/.husky/pre-commit +0 -4
  109. package/.lintstagedrc +0 -7
  110. package/.prettierignore +0 -6
  111. package/.prettierrc.json +0 -1
  112. package/CHANGELOG.md +0 -274
  113. package/CODE_OF_CONDUCT.md +0 -132
  114. package/bitbucket-pipelines.yml +0 -92
  115. package/dist/cjs/classes/FilterAdapter.d.ts +0 -107
  116. package/dist/cjs/classes/FilterAdapter.d.ts.map +0 -1
  117. package/dist/cjs/classes/FilterBuilder.d.ts +0 -206
  118. package/dist/cjs/classes/FilterBuilder.d.ts.map +0 -1
  119. package/dist/cjs/classes/FilterManager.d.ts +0 -84
  120. package/dist/cjs/classes/FilterManager.d.ts.map +0 -1
  121. package/dist/cjs/classes/FilterResources.d.ts +0 -139
  122. package/dist/cjs/classes/FilterResources.d.ts.map +0 -1
  123. package/dist/cjs/classes/FilterSearcher.d.ts +0 -90
  124. package/dist/cjs/classes/FilterSearcher.d.ts.map +0 -1
  125. package/dist/cjs/classes/FilterValidation.d.ts +0 -58
  126. package/dist/cjs/classes/FilterValidation.d.ts.map +0 -1
  127. package/dist/cjs/classes/FilterValues.d.ts +0 -33
  128. package/dist/cjs/classes/FilterValues.d.ts.map +0 -1
  129. package/dist/cjs/classes/index.d.ts +0 -8
  130. package/dist/cjs/classes/index.d.ts.map +0 -1
  131. package/dist/cjs/helpers/filter-adapt.helpers.d.ts +0 -21
  132. package/dist/cjs/helpers/filter-adapt.helpers.d.ts.map +0 -1
  133. package/dist/cjs/helpers/filter-adapt.legacy.helpers.d.ts +0 -26
  134. package/dist/cjs/helpers/filter-adapt.legacy.helpers.d.ts.map +0 -1
  135. package/dist/cjs/helpers/filter-adapt.logic.helpers.d.ts +0 -29
  136. package/dist/cjs/helpers/filter-adapt.logic.helpers.d.ts.map +0 -1
  137. package/dist/cjs/helpers/filter-builder.helpers.d.ts +0 -11
  138. package/dist/cjs/helpers/filter-builder.helpers.d.ts.map +0 -1
  139. package/dist/cjs/helpers/filter-settings.helpers.d.ts +0 -42
  140. package/dist/cjs/helpers/filter-settings.helpers.d.ts.map +0 -1
  141. package/dist/cjs/helpers/filter-validators.helpers.d.ts +0 -8
  142. package/dist/cjs/helpers/filter-validators.helpers.d.ts.map +0 -1
  143. package/dist/cjs/helpers/getFilterId.d.ts +0 -18
  144. package/dist/cjs/helpers/getFilterId.d.ts.map +0 -1
  145. package/dist/cjs/helpers/getFilterType.d.ts +0 -11
  146. package/dist/cjs/helpers/getFilterType.d.ts.map +0 -1
  147. package/dist/cjs/helpers/index.d.ts +0 -7
  148. package/dist/cjs/helpers/index.d.ts.map +0 -1
  149. package/dist/cjs/helpers/resolveFilterConditions.d.ts +0 -11
  150. package/dist/cjs/helpers/resolveFilterConditions.d.ts.map +0 -1
  151. package/dist/cjs/helpers/utils.helpers.d.ts +0 -26
  152. package/dist/cjs/helpers/utils.helpers.d.ts.map +0 -1
  153. package/dist/cjs/index.d.ts +0 -5
  154. package/dist/cjs/index.d.ts.map +0 -1
  155. package/dist/cjs/models/filter-builder.models.d.ts +0 -203
  156. package/dist/cjs/models/filter-builder.models.d.ts.map +0 -1
  157. package/dist/cjs/models/filter-resources.models.d.ts +0 -71
  158. package/dist/cjs/models/filter-resources.models.d.ts.map +0 -1
  159. package/dist/cjs/models/filter-searcher.models.d.ts +0 -42
  160. package/dist/cjs/models/filter-searcher.models.d.ts.map +0 -1
  161. package/dist/cjs/models/filter-validation.models.d.ts +0 -59
  162. package/dist/cjs/models/filter-validation.models.d.ts.map +0 -1
  163. package/dist/cjs/models/index.d.ts +0 -4
  164. package/dist/cjs/models/index.d.ts.map +0 -1
  165. package/dist/cjs/resources/filter-functions.resources.d.ts +0 -94
  166. package/dist/cjs/resources/filter-functions.resources.d.ts.map +0 -1
  167. package/dist/cjs/resources/filter-grouping.resources.d.ts +0 -103
  168. package/dist/cjs/resources/filter-grouping.resources.d.ts.map +0 -1
  169. package/dist/cjs/resources/filter-logic.resources.d.ts +0 -135
  170. package/dist/cjs/resources/filter-logic.resources.d.ts.map +0 -1
  171. package/dist/cjs/resources/filter-operators.resources.d.ts +0 -16
  172. package/dist/cjs/resources/filter-operators.resources.d.ts.map +0 -1
  173. package/dist/cjs/resources/filter-panel.interfaces.d.ts +0 -80
  174. package/dist/cjs/resources/filter-panel.interfaces.d.ts.map +0 -1
  175. package/dist/cjs/resources/filter-scopes.resources.d.ts +0 -62
  176. package/dist/cjs/resources/filter-scopes.resources.d.ts.map +0 -1
  177. package/dist/cjs/resources/filter-validation.resources.d.ts +0 -20
  178. package/dist/cjs/resources/filter-validation.resources.d.ts.map +0 -1
  179. package/dist/cjs/resources/filter-validators.resources.d.ts +0 -80
  180. package/dist/cjs/resources/filter-validators.resources.d.ts.map +0 -1
  181. package/dist/cjs/resources/filter-values.resources.d.ts +0 -40
  182. package/dist/cjs/resources/filter-values.resources.d.ts.map +0 -1
  183. package/dist/cjs/resources/filter-visual.resources.d.ts +0 -77
  184. package/dist/cjs/resources/filter-visual.resources.d.ts.map +0 -1
  185. package/dist/cjs/resources/filters.resources.d.ts +0 -168
  186. package/dist/cjs/resources/filters.resources.d.ts.map +0 -1
  187. package/dist/cjs/resources/index.d.ts +0 -11
  188. package/dist/cjs/resources/index.d.ts.map +0 -1
  189. package/dist/classes/FilterAdapter.d.ts.map +0 -1
  190. package/dist/classes/FilterBuilder.d.ts.map +0 -1
  191. package/dist/classes/FilterManager.d.ts.map +0 -1
  192. package/dist/classes/FilterResources.d.ts.map +0 -1
  193. package/dist/classes/FilterSearcher.d.ts.map +0 -1
  194. package/dist/classes/FilterValidation.d.ts.map +0 -1
  195. package/dist/classes/FilterValues.d.ts.map +0 -1
  196. package/dist/classes/index.d.ts.map +0 -1
  197. package/dist/helpers/filter-adapt.helpers.d.ts.map +0 -1
  198. package/dist/helpers/filter-adapt.legacy.helpers.d.ts.map +0 -1
  199. package/dist/helpers/filter-adapt.logic.helpers.d.ts.map +0 -1
  200. package/dist/helpers/filter-builder.helpers.d.ts.map +0 -1
  201. package/dist/helpers/filter-settings.helpers.d.ts.map +0 -1
  202. package/dist/helpers/filter-validators.helpers.d.ts.map +0 -1
  203. package/dist/helpers/getFilterId.d.ts.map +0 -1
  204. package/dist/helpers/getFilterType.d.ts.map +0 -1
  205. package/dist/helpers/index.d.ts.map +0 -1
  206. package/dist/helpers/resolveFilterConditions.d.ts.map +0 -1
  207. package/dist/helpers/utils.helpers.d.ts.map +0 -1
  208. package/dist/index.d.ts.map +0 -1
  209. package/dist/models/filter-builder.models.d.ts.map +0 -1
  210. package/dist/models/filter-resources.models.d.ts.map +0 -1
  211. package/dist/models/filter-searcher.models.d.ts.map +0 -1
  212. package/dist/models/filter-validation.models.d.ts.map +0 -1
  213. package/dist/models/index.d.ts.map +0 -1
  214. package/dist/resources/filter-functions.resources.d.ts.map +0 -1
  215. package/dist/resources/filter-grouping.resources.d.ts.map +0 -1
  216. package/dist/resources/filter-logic.resources.d.ts.map +0 -1
  217. package/dist/resources/filter-operators.resources.d.ts.map +0 -1
  218. package/dist/resources/filter-panel.interfaces.d.ts.map +0 -1
  219. package/dist/resources/filter-scopes.resources.d.ts.map +0 -1
  220. package/dist/resources/filter-validation.resources.d.ts.map +0 -1
  221. package/dist/resources/filter-validators.resources.d.ts.map +0 -1
  222. package/dist/resources/filter-values.resources.d.ts.map +0 -1
  223. package/dist/resources/filter-visual.resources.d.ts.map +0 -1
  224. package/dist/resources/filters.resources.d.ts.map +0 -1
  225. package/dist/resources/index.d.ts.map +0 -1
  226. package/jest.config.js +0 -10
  227. package/jsdoc.config.json +0 -14
  228. package/scripts/clean-build/index.js +0 -62
  229. package/sonar-project.properties +0 -2
  230. package/src/classes/FilterAdapter.ts +0 -208
  231. package/src/classes/FilterBuilder.ts +0 -822
  232. package/src/classes/FilterManager.ts +0 -126
  233. package/src/classes/FilterResources.ts +0 -411
  234. package/src/classes/FilterSearcher.ts +0 -243
  235. package/src/classes/FilterValidation.ts +0 -221
  236. package/src/classes/FilterValues.ts +0 -89
  237. package/src/classes/index.ts +0 -7
  238. package/src/helpers/filter-adapt.helpers.ts +0 -204
  239. package/src/helpers/filter-adapt.legacy.helpers.ts +0 -298
  240. package/src/helpers/filter-adapt.logic.helpers.ts +0 -631
  241. package/src/helpers/filter-builder.helpers.ts +0 -28
  242. package/src/helpers/filter-settings.helpers.ts +0 -133
  243. package/src/helpers/filter-validators.helpers.ts +0 -15
  244. package/src/helpers/getFilterId.ts +0 -35
  245. package/src/helpers/getFilterType.ts +0 -23
  246. package/src/helpers/index.ts +0 -6
  247. package/src/helpers/resolveFilterConditions.ts +0 -29
  248. package/src/helpers/utils.helpers.ts +0 -37
  249. package/src/index.ts +0 -4
  250. package/src/models/filter-builder.models.ts +0 -256
  251. package/src/models/filter-resources.models.ts +0 -89
  252. package/src/models/filter-searcher.models.ts +0 -61
  253. package/src/models/filter-validation.models.ts +0 -71
  254. package/src/models/index.ts +0 -3
  255. package/src/resources/filter-functions.resources.ts +0 -132
  256. package/src/resources/filter-grouping.resources.ts +0 -531
  257. package/src/resources/filter-logic.resources.ts +0 -148
  258. package/src/resources/filter-operators.resources.ts +0 -40
  259. package/src/resources/filter-panel.interfaces.ts +0 -86
  260. package/src/resources/filter-scopes.resources.ts +0 -152
  261. package/src/resources/filter-validation.resources.ts +0 -90
  262. package/src/resources/filter-validators.resources.ts +0 -411
  263. package/src/resources/filter-values.resources.ts +0 -57
  264. package/src/resources/filter-visual.resources.ts +0 -86
  265. package/src/resources/filters.resources.ts +0 -232
  266. package/src/resources/index.ts +0 -10
  267. package/tests/classes/FilterAdapter.test.ts +0 -124
  268. package/tests/classes/FilterBuilder.test.ts +0 -903
  269. package/tests/classes/FilterResources.test.ts +0 -267
  270. package/tests/classes/FilterSearcher.test.ts +0 -188
  271. package/tests/classes/FilterValidation.test.ts +0 -54
  272. package/tests/helpers/getFilterId.test.ts +0 -121
  273. package/tests/mock/datasets.mock.ts +0 -61
  274. package/tests/mock/filters-adapter.mock.ts +0 -646
  275. package/tests/mock/filters-interactive-table.mock.ts +0 -59
  276. package/tests/mock/filters.mock.ts +0 -277
  277. package/tsconfig.doc.json +0 -4
  278. package/tsconfig.eslint.json +0 -4
  279. package/tsconfig.json +0 -113
@@ -1,133 +0,0 @@
1
- import {
2
- DEFAULT_FILTER_ADD_SETTINGS,
3
- DEFAULT_FILTER_CREATE_SETTINGS,
4
- DEFAULT_FILTERS_EDIT_SETTINGS,
5
- DEFAULT_FILTERS_GROUPING_INFO_BY_COLUMN_SETTINGS,
6
- DEFAULT_FILTERS_PARAM_SETTINGS,
7
- IFilterAddSettings,
8
- IFilterBuilderEditSettings,
9
- IFilterCreateSettings,
10
- IFilterGroupingInfoListByColumnSettings,
11
- IFilterParamSettings,
12
- IFilterReplaceParamSettings,
13
- } from "../resources/filter-functions.resources";
14
-
15
- /**
16
- * Gets a complete settings for the edit filters settings
17
- * - Fills the missing properties with default ones
18
- * @param settings the settings
19
- * @returns the complete settings
20
- */
21
- export function getEditFiltersSettings(
22
- settings?: IFilterBuilderEditSettings,
23
- ): IFilterBuilderEditSettings {
24
- return {
25
- automaticId:
26
- settings?.automaticId ?? DEFAULT_FILTERS_EDIT_SETTINGS.automaticId,
27
- strictValidation:
28
- settings?.strictValidation ??
29
- DEFAULT_FILTERS_EDIT_SETTINGS.strictValidation,
30
- };
31
- }
32
-
33
- /**
34
- * Gets a complete settings for the filter-create settings
35
- * @param settings the filter-create settings
36
- * @returns the complete filter-create settings
37
- */
38
- export function getFilterAddSettings(
39
- settings?: IFilterAddSettings,
40
- ): IFilterAddSettings {
41
- return {
42
- automaticId:
43
- settings?.automaticId ?? DEFAULT_FILTER_ADD_SETTINGS.automaticId,
44
- automaticOperator:
45
- settings?.automaticOperator ??
46
- DEFAULT_FILTER_ADD_SETTINGS.automaticOperator,
47
- };
48
- }
49
-
50
- /**
51
- * Gets a complete settings for the filter-create settings
52
- * @param settings the filter-create settings
53
- * @returns the complete filter-create settings
54
- */
55
- export function getFilterCreateSettings(
56
- settings?: IFilterCreateSettings,
57
- ): IFilterCreateSettings {
58
- return {
59
- automaticId:
60
- settings?.automaticId ?? DEFAULT_FILTER_CREATE_SETTINGS.automaticId,
61
- rawValues: settings?.rawValues ?? DEFAULT_FILTER_CREATE_SETTINGS.rawValues,
62
- strictValidation:
63
- settings?.strictValidation ??
64
- DEFAULT_FILTER_CREATE_SETTINGS.strictValidation,
65
- ...getInfoGroupingsByColumnTypeSettings(settings),
66
- };
67
- }
68
-
69
- /**
70
- * Gets a complete settings for the info grouping by column settings
71
- * - Fills the missing properties with default ones
72
- * @param settings the settings
73
- * @returns the complete settings
74
- */
75
- export function getInfoGroupingsByColumnTypeSettings(
76
- settings?: IFilterGroupingInfoListByColumnSettings,
77
- ): IFilterGroupingInfoListByColumnSettings {
78
- return {
79
- hasDateTime:
80
- settings?.hasDateTime ??
81
- DEFAULT_FILTERS_GROUPING_INFO_BY_COLUMN_SETTINGS.hasDateTime,
82
- hasDistinctDate:
83
- settings?.hasDistinctDate ??
84
- DEFAULT_FILTERS_GROUPING_INFO_BY_COLUMN_SETTINGS.hasDistinctDate,
85
- hasDistinctDateTime:
86
- settings?.hasDistinctDateTime ??
87
- DEFAULT_FILTERS_GROUPING_INFO_BY_COLUMN_SETTINGS.hasDistinctDateTime,
88
- hasImageUploadAnalysis:
89
- settings?.hasImageUploadAnalysis ??
90
- DEFAULT_FILTERS_GROUPING_INFO_BY_COLUMN_SETTINGS.hasImageUploadAnalysis,
91
- isExpressionCategorizable:
92
- settings?.isExpressionCategorizable ??
93
- DEFAULT_FILTERS_GROUPING_INFO_BY_COLUMN_SETTINGS.isExpressionCategorizable,
94
- };
95
- }
96
-
97
- /**
98
- * Gets a complete settings for the param settings
99
- * - Fills the missing properties with default ones
100
- * @param settings the settings
101
- * @returns the complete settings
102
- */
103
- export function getParamFiltersSettings(
104
- settings?: IFilterParamSettings,
105
- ): IFilterParamSettings {
106
- return {
107
- letPassUndefinedParams:
108
- settings?.letPassUndefinedParams ??
109
- DEFAULT_FILTERS_PARAM_SETTINGS.letPassUndefinedParams,
110
- letPassUndefinedProperties:
111
- settings?.letPassUndefinedProperties ??
112
- DEFAULT_FILTERS_PARAM_SETTINGS.letPassUndefinedProperties,
113
- removeEmptyArrays:
114
- settings?.removeEmptyArrays ??
115
- DEFAULT_FILTERS_PARAM_SETTINGS.removeEmptyArrays,
116
- };
117
- }
118
-
119
- /**
120
- * Gets a complete settings for the replaceByParams settings
121
- * - Fills the missing properties with default ones
122
- * @param settings the settings
123
- * @returns the complete settings
124
- */
125
- export function getReplaceByParamsSettings(
126
- settings?: IFilterReplaceParamSettings,
127
- ): IFilterReplaceParamSettings {
128
- return {
129
- ...settings,
130
- automaticOperator: settings?.automaticOperator ?? false,
131
- addingInSameIndex: settings?.addingInSameIndex ?? false,
132
- };
133
- }
@@ -1,15 +0,0 @@
1
- import {
2
- FILTER_VALIDATOR,
3
- IFilterValidator,
4
- } from "../resources/filter-validators.resources";
5
-
6
- /**
7
- * Checks if the given validator is a Null type.
8
- * @param validator The Filter Validator
9
- * @returns True: It is a Null Validator
10
- */
11
- export function isNullValidator(validator: IFilterValidator): boolean {
12
- return [FILTER_VALIDATOR.IS_NOT_NULL, FILTER_VALIDATOR.IS_NULL].includes(
13
- validator,
14
- );
15
- }
@@ -1,35 +0,0 @@
1
- import { isEmpty, isObject } from "@qrvey/utils";
2
-
3
- import { IFilter } from "../resources/filters.resources";
4
-
5
- /**
6
- * Get the Filter ID by the filter structure
7
- * The order of the epression ID is:
8
- * - Scope Type
9
- * - scope Id
10
- * - dataset Id
11
- * - column Id
12
- * - validator
13
- * - grouping
14
- * - Column Aggregate
15
- * - Optional Index
16
- * @param filter the filter structure
17
- * @param index an aditional number to add into the ID
18
- * @returns a text to identify the filter
19
- */
20
- export function getFilterId(filter: IFilter, index?: number): string {
21
- if (isEmpty(filter) || !isObject(filter)) return "";
22
-
23
- const filterId: string[] = [];
24
- if (!isEmpty(filter.scope)) filterId.push(filter.scope.toLowerCase());
25
- if (!isEmpty(filter.scopeId)) filterId.push(filter.scopeId!);
26
- if (!isEmpty(filter.datasetId)) filterId.push(filter.datasetId);
27
- if (!isEmpty(filter.columnId)) filterId.push(filter.columnId);
28
- if (!isEmpty(filter.validator)) filterId.push(filter.validator.toLowerCase());
29
- if (!isEmpty(filter.grouping)) filterId.push(filter.grouping!.toLowerCase());
30
- if (!isEmpty(filter.aggregateType))
31
- filterId.push(filter.aggregateType!.toLowerCase());
32
- if (!isEmpty(index)) filterId.push(index!.toString());
33
-
34
- return filterId.length > 0 ? filterId.join("|") : "";
35
- }
@@ -1,23 +0,0 @@
1
- import { COLUMN, IColumnType } from "@qrvey/utils";
2
-
3
- import { IFilterValidator } from "../resources/filter-validators.resources";
4
- import {
5
- FILTER_TYPE,
6
- FILTER_TYPE_BY_VALIDATOR,
7
- IFilterType,
8
- } from "../resources/filters.resources";
9
-
10
- /**
11
- * Gets the filter type based on the column type and the validator
12
- * @param columnType the column type
13
- * @param validator the validator type
14
- * @returns the filter type
15
- */
16
- export function getFilterType(
17
- columnType: IColumnType,
18
- validator: IFilterValidator,
19
- ): IFilterType {
20
- if (columnType === COLUMN.RANKING) return FILTER_TYPE.RANKING;
21
-
22
- return FILTER_TYPE_BY_VALIDATOR[validator];
23
- }
@@ -1,6 +0,0 @@
1
- export * from "./filter-adapt.helpers";
2
- export * from "./filter-settings.helpers";
3
- export * from "./getFilterId";
4
- export * from "./getFilterType";
5
- export * from "./resolveFilterConditions";
6
- export * from "./utils.helpers";
@@ -1,29 +0,0 @@
1
- import { IFilterParamSettings } from "../resources/filter-functions.resources";
2
- import { IFilter } from "../resources/filters.resources";
3
-
4
- /**
5
- * Resolves conditions to fullfill the match of the filter object
6
- * @param filter the filter object
7
- * @param params the params of the filter to resolve the condition
8
- * @param settings the filter param settings
9
- * @returns true: the conditions is fullfiled.
10
- */
11
- export function resolveFilterConditions(
12
- filter: IFilter,
13
- params: Partial<IFilter>,
14
- settings: IFilterParamSettings,
15
- ): boolean {
16
- const paramKeys = (Object.keys(params) as (keyof IFilter)[]) || [];
17
-
18
- let condition = true;
19
- for (let i = 0; i < paramKeys.length; i++) {
20
- const paramKey = paramKeys[i];
21
- condition =
22
- (settings.letPassUndefinedProperties && filter[paramKey] == null) ||
23
- (settings.letPassUndefinedParams && params[paramKey] == null) ||
24
- params[paramKey] === filter[paramKey];
25
-
26
- if (!condition) break;
27
- }
28
- return condition;
29
- }
@@ -1,37 +0,0 @@
1
- import { IColumn, IDataset } from "@qrvey/utils";
2
-
3
- /**
4
- * Gets the column info by ID
5
- * @param ids the ids to search the info
6
- * @param ids.columnId the column ID
7
- * @param ids.datasetId the dataset ID
8
- * @param datasets the collection of datasets
9
- * @returns the Column Info
10
- */
11
- export function getColumnInfo(
12
- ids: { columnId: string; datasetId: string },
13
- datasets: IDataset[] = [],
14
- ): IColumn | undefined {
15
- const datasetInfo: IDataset | undefined = getDatasetInfo(ids, datasets);
16
-
17
- return datasetInfo?.options?.find(
18
- (cInfo) => cInfo.id === ids.columnId && cInfo.qrveyid === ids.datasetId,
19
- );
20
- }
21
-
22
- /**
23
- * Gets the dataset info by ID
24
- * @param ids the ids to search the info
25
- * @param ids.columnId the column ID
26
- * @param ids.datasetId the dataset ID
27
- * @param datasets the collection of datasets
28
- * @returns the Dataset Info
29
- */
30
- export function getDatasetInfo(
31
- ids: { columnId: string; datasetId: string },
32
- datasets: IDataset[] = [],
33
- ): IDataset | undefined {
34
- if (ids == null || !Array.isArray(datasets)) return;
35
-
36
- return datasets?.find((dInfo) => dInfo.qrveyid === ids.datasetId);
37
- }
package/src/index.ts DELETED
@@ -1,4 +0,0 @@
1
- export * from "./classes";
2
- export * from "./helpers";
3
- export * from "./models";
4
- export * from "./resources";
@@ -1,256 +0,0 @@
1
- import {
2
- IFilterAddSettings,
3
- IFilterBuilderEditSettings,
4
- IFilterMergeSettings,
5
- IFilterParamSettings,
6
- } from "../resources/filter-functions.resources";
7
- import { IFilterValue } from "../resources/filter-values.resources";
8
- import { IFilter } from "../resources/filters.resources";
9
-
10
- /**
11
- * Structure model for the adding filters
12
- */
13
- export interface IFilterBuilderAdd {
14
- /**
15
- * Adds one filter into the collection.
16
- * Inserts it next to the last similar filter
17
- * @param filter the filter to add
18
- * @param inIndex the index to add the new filter
19
- * @param settings the settings object to setup this function
20
- * @returns the new collection of filters
21
- */
22
- addSingle: (
23
- filter: IFilter,
24
- inIndex?: number,
25
- settings?: IFilterAddSettings,
26
- ) => IFilterBuilderSingleReturn;
27
- /**
28
- * Adds various filter into the collection.
29
- * Inserts them next to the last similar filter
30
- * @param filter the filter to add
31
- * @param inIndexes collection of indexes to add the new filters
32
- * @param settings the settings object to setup this function
33
- * @returns the new collection of filters
34
- */
35
- addMultiple: (
36
- filter: IFilter[],
37
- inIndexes?: number[],
38
- settings?: IFilterAddSettings,
39
- ) => IFilterBuilderMultipleReturn;
40
- }
41
-
42
- /**
43
- * Structure module for the editing filter values
44
- */
45
- export interface IFilterBuilderAddValue {
46
- /**
47
- * Adds one value from filter
48
- * @param id the ID to search the filter to add value
49
- * @param value the value to to add
50
- * @returns the new filter collection
51
- */
52
- addValue: (id: string, value: IFilterValue) => IFilterBuilderSingleReturn;
53
- /**
54
- * Adds various values from filter
55
- * @param id the ID to search the filter to add value
56
- * @param values the value collection to add
57
- * @returns the new filter collection
58
- */
59
- addValues: (id: string, values: IFilterValue[]) => IFilterBuilderSingleReturn;
60
- }
61
-
62
- /**
63
- * Structure module for the deleting filters
64
- */
65
- export interface IFilterBuilderDelete {
66
- /**
67
- * Removes one filter from the collection
68
- * @param id the ID to search the filter to remove
69
- * @returns the new filter collection
70
- */
71
- deleteSingle: (id: string) => IFilterBuilderSingleReturn;
72
- /**
73
- * Removes various filters from the collection
74
- * @param ids a collection of ID to search filters to remove
75
- * @returns the new filter collection
76
- */
77
- deleteMultiple: (ids: string[]) => IFilterBuilderMultipleReturn;
78
- }
79
-
80
- /**
81
- * Structure module for the editing filter values
82
- */
83
- export interface IFilterBuilderDeleteValue {
84
- /**
85
- * Removes one value from filter
86
- * @param id the ID to search the filter to remove value
87
- * @param index the index to search the value to remove
88
- * @returns the new filter collection
89
- */
90
- deleteValue: (id: string, index: number) => IFilterBuilderSingleReturn;
91
- /**
92
- * Removes various values from filter
93
- * @param id the ID to search the filter to remove value
94
- * @param indexes the index collection to search the value to remove
95
- * @returns the new filter collection
96
- */
97
- deleteValues: (id: string, indexes: number[]) => IFilterBuilderSingleReturn;
98
- }
99
-
100
- /**
101
- * Structure module for the editing filters
102
- */
103
- export interface IFilterBuilderEdit {
104
- /**
105
- * Edits one filter from the collection
106
- * @param filter an object with properties to edit
107
- * @param id the ID to search the filter to edit
108
- * @param settings settings object for the function
109
- * @returns the new filter collection
110
- */
111
- editSingle: (
112
- id: string,
113
- filter: Partial<IFilter> | IFilter,
114
- settings?: IFilterBuilderEditSettings,
115
- ) => IFilterBuilderSingleReturn;
116
- /**
117
- * Edits various filters from the collection
118
- * @param filters a collection of object with properties to edit
119
- * @param ids the collection of IDs to search filters to edit
120
- * @param settings settings object for the function
121
- * @returns the new filter collection
122
- */
123
- editMultiple: (
124
- ids: string[],
125
- filter: Partial<IFilter>[] | IFilter[],
126
- settings?: IFilterBuilderEditSettings,
127
- ) => IFilterBuilderMultipleReturn;
128
- }
129
-
130
- /**
131
- * Structure module for the editing filter values
132
- */
133
- export interface IFilterBuilderEditValue {
134
- /**
135
- * Edits one value from filter
136
- * @param id the ID to search the filter to edit value
137
- * @param value the value to edit
138
- * @param index the value index to edit
139
- * @returns the new filter collection
140
- */
141
- editValue: (
142
- id: string,
143
- value: IFilterValue,
144
- index: number,
145
- ) => IFilterBuilderSingleReturn;
146
- /**
147
- * Edits various values from filter
148
- * @param id the ID to search the filter to edit value
149
- * @param values the value collection to edit
150
- * @param indexes the index collection to edit
151
- * @returns the new filter collection
152
- */
153
- editValues: (
154
- id: string,
155
- values: IFilterValue[],
156
- indexes: number[],
157
- ) => IFilterBuilderSingleReturn;
158
- }
159
-
160
- /**
161
- * Structure module for the editing filters
162
- */
163
- export interface IFilterBuilderMerge {
164
- /**
165
- * Merge the filter into the collection by some filter parameters
166
- * @param filter the filter to merge
167
- * @param settings the settings object to setup this function
168
- * @returns the new filter collection
169
- */
170
- mergeSingle: (
171
- filter: IFilter,
172
- settings?: IFilterMergeSettings,
173
- ) => IFilterBuilderSingleReturn;
174
- /**
175
- * Merge the filters into the collection by some filter parameters
176
- * @param filters the filter collection to merge
177
- * @param settings the settings object to setup this function
178
- * @returns the new filter collection
179
- */
180
- mergeMultiple: (
181
- filters: IFilter[],
182
- settings?: IFilterMergeSettings,
183
- ) => IFilterBuilderMultipleReturn;
184
- }
185
-
186
- /**
187
- * Structure module for the editing filter values
188
- */
189
- export interface IFilterBuilderMergeValue {
190
- /**
191
- * Merge values from filter
192
- * @param id the ID to search the filter to merge values
193
- * @param values the value collection to merge
194
- * @returns the new filter collection
195
- */
196
- mergeValues: (
197
- id: string,
198
- values: IFilterValue[] | undefined,
199
- indexes: number[],
200
- ) => IFilterBuilderSingleReturn;
201
- }
202
-
203
- /**
204
- * Structure module for the setting filters
205
- */
206
- export interface IFilterBuilderSet {
207
- /**
208
- * Sets the given filters by param
209
- * - Remove the filters by the sucesfull conditions and replace the given ones
210
- * @param filters the filters to set
211
- * @param params params to search the filters
212
- * @param settings settings for this function
213
- * @returns the new collection of filters
214
- */
215
- replaceByParams: (
216
- filters: IFilter[],
217
- params: Partial<IFilter>,
218
- settings?: IFilterParamSettings,
219
- ) => IFilterBuilderMultipleReturn;
220
- }
221
-
222
- /**
223
- * Structure for the returning a single item
224
- */
225
- export interface IFilterBuilderSingleReturn {
226
- /**
227
- * the new filter collection
228
- */
229
- resulting: IFilter[];
230
- /**
231
- * the affected filter
232
- */
233
- affected?: IFilter;
234
- /**
235
- * the original filter before affecting
236
- */
237
- original?: IFilter;
238
- }
239
-
240
- /**
241
- * Structure for the returning a multiple items
242
- */
243
- export interface IFilterBuilderMultipleReturn {
244
- /**
245
- * the new filter collection
246
- */
247
- resulting: IFilter[];
248
- /**
249
- * the affected filters
250
- */
251
- affected?: IFilter[];
252
- /**
253
- * the original filters before affecting
254
- */
255
- original?: IFilter[];
256
- }
@@ -1,89 +0,0 @@
1
- import { IColumnType } from "@qrvey/utils";
2
-
3
- import { IFilterGroupingInfoListByColumnSettings } from "../resources/filter-functions.resources";
4
- import {
5
- IColumnTypeWithGrouping,
6
- IFilterGrouping,
7
- IFilterGroupingInfo,
8
- } from "../resources/filter-grouping.resources";
9
- import {
10
- IFilterValidator,
11
- IFilterValidatorInfo,
12
- } from "../resources/filter-validators.resources";
13
-
14
- /**
15
- * Structure model for the getting resources
16
- */
17
- export interface IFilterResourcesValidator {
18
- /**
19
- * Gets the complete collection of validator types
20
- * @returns the collection of validator types
21
- */
22
- getValidators: () => IFilterValidator[];
23
- /**
24
- * Gets the complete collection of validator info
25
- * @returns the collection of validator info
26
- */
27
- getInfoValidators: () => IFilterValidatorInfo[];
28
- /**
29
- * Gets a validator info by a validator type
30
- * @param validator the validator type
31
- * @returns a single validator info
32
- */
33
- getInfoByValidator: (validator: IFilterValidator) => IFilterValidatorInfo;
34
- /**
35
- * Gets a collection of validator info by a column type
36
- * @param type the column type
37
- * @returns a collection of validator info
38
- */
39
- getInfoValidatorsByColumnType: (type: IColumnType) => IFilterValidatorInfo[];
40
- /**
41
- * Gets a collection of validator info by a mutiple column types
42
- * - The resulting validator info collection is an intersection of mulitple validator info collections
43
- * @param types a collection of column types
44
- * @returns a collection of validator info
45
- */
46
- getInfoValidatorsByColumnTypes: (
47
- types: IColumnType[],
48
- ) => IFilterValidatorInfo[];
49
- }
50
-
51
- export interface IFilterResourcesGrouping {
52
- /**
53
- * Gets the complete collection of grouping types
54
- * @returns the collection of grouping types
55
- */
56
- getGroupings: () => IFilterGrouping[];
57
- /**
58
- * Gets the complete collection of validator info
59
- * @returns the collection of validator info
60
- */
61
- getInfoGroupings: () => IFilterGroupingInfo[];
62
- /**
63
- * Gets a grouping info by a grouping type
64
- * @param grouping the grouping type
65
- * @returns a single grouping info
66
- */
67
- getInfoByGrouping: (validator: IFilterValidator) => IFilterGroupingInfo;
68
- /**
69
- * Gets a collection of validator info by a column type
70
- * @param type the column type
71
- * @returns a collection of validator info
72
- */
73
- getInfoGroupingsByColumnType: (
74
- type: IColumnType,
75
- settings?: IFilterGroupingInfoListByColumnSettings,
76
- ) => IFilterGroupingInfo[];
77
-
78
- /**
79
- * Gets a collection of groupings info by a column type
80
- * - The resulting grouping info collection is an intersection of mulitple grouping info collections
81
- * @param types the collection of column type
82
- * @param settings settings for the function
83
- * @returns a collection of grouping info
84
- */
85
- getInfoGroupingsByColumnTypes: (
86
- types: IColumnTypeWithGrouping[],
87
- settings?: IFilterGroupingInfoListByColumnSettings[],
88
- ) => IFilterGroupingInfo[];
89
- }
@@ -1,61 +0,0 @@
1
- import { IFilterParamSettings } from "../resources/filter-functions.resources";
2
- import { IFilter } from "../resources/filters.resources";
3
-
4
- export interface IFilterSearcherParams {
5
- /**
6
- * Searchs and excludes filters by the given params
7
- * @param params params to exclude the filters
8
- * @param settings settings for this function
9
- * @returns the new collection of filters
10
- */
11
- excludeByParams(
12
- params: Partial<IFilter>,
13
- settings?: IFilterParamSettings,
14
- ): IFilter[];
15
-
16
- /**
17
- * Searchs filters by the given params
18
- * @param params params to search the filters
19
- * @param settings settings for this function
20
- * @returns the new collection of filters
21
- */
22
- filterByParams(
23
- params: Partial<IFilter>,
24
- settings?: IFilterParamSettings,
25
- ): IFilter[];
26
-
27
- /**
28
- * Searchs filters by the given params and returns the inexes
29
- * @param params params to search the filters
30
- * @param settings settings for this function
31
- * @returns the new collection of filters
32
- */
33
- filterIndexesByParams(
34
- params: Partial<IFilter>,
35
- settings?: IFilterParamSettings,
36
- ): number[];
37
-
38
- /**
39
- * Searchs filters by the given params.
40
- * Gets the first match of the searching
41
- * @param params params to search the filters
42
- * @param settings settings for this function
43
- * @returns the new collection of filters
44
- */
45
- findByParams(
46
- params: Partial<IFilter>,
47
- settings?: IFilterParamSettings,
48
- ): IFilter | undefined;
49
-
50
- /**
51
- * Searchs filters by the given params.
52
- * Gets the first match of the searching and returns the related index
53
- * @param params params to search the filters
54
- * @param settings settings for this function
55
- * @returns the new collection of filters
56
- */
57
- findIndexByParams(
58
- params: Partial<IFilter>,
59
- settings?: IFilterParamSettings,
60
- ): number;
61
- }