@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,18 +1,2 @@
1
1
  import { IFilter } from "../resources/filters.resources";
2
- /**
3
- * Get the Filter ID by the filter structure
4
- * The order of the epression ID is:
5
- * - Scope Type
6
- * - scope Id
7
- * - dataset Id
8
- * - column Id
9
- * - validator
10
- * - grouping
11
- * - Column Aggregate
12
- * - Optional Index
13
- * @param filter the filter structure
14
- * @param index an aditional number to add into the ID
15
- * @returns a text to identify the filter
16
- */
17
2
  export declare function getFilterId(filter: IFilter, index?: number): string;
18
- //# sourceMappingURL=getFilterId.d.ts.map
@@ -1,19 +1,4 @@
1
1
  import { isEmpty, isObject } from "@qrvey/utils";
2
- /**
3
- * Get the Filter ID by the filter structure
4
- * The order of the epression ID is:
5
- * - Scope Type
6
- * - scope Id
7
- * - dataset Id
8
- * - column Id
9
- * - validator
10
- * - grouping
11
- * - Column Aggregate
12
- * - Optional Index
13
- * @param filter the filter structure
14
- * @param index an aditional number to add into the ID
15
- * @returns a text to identify the filter
16
- */
17
2
  export function getFilterId(filter, index) {
18
3
  if (isEmpty(filter) || !isObject(filter))
19
4
  return "";
@@ -1,11 +1,4 @@
1
1
  import { IColumnType } from "@qrvey/utils";
2
2
  import { IFilterValidator } from "../resources/filter-validators.resources";
3
3
  import { IFilterType } from "../resources/filters.resources";
4
- /**
5
- * Gets the filter type based on the column type and the validator
6
- * @param columnType the column type
7
- * @param validator the validator type
8
- * @returns the filter type
9
- */
10
4
  export declare function getFilterType(columnType: IColumnType, validator: IFilterValidator): IFilterType;
11
- //# sourceMappingURL=getFilterType.d.ts.map
@@ -1,11 +1,5 @@
1
1
  import { COLUMN } from "@qrvey/utils";
2
2
  import { FILTER_TYPE, FILTER_TYPE_BY_VALIDATOR, } from "../resources/filters.resources";
3
- /**
4
- * Gets the filter type based on the column type and the validator
5
- * @param columnType the column type
6
- * @param validator the validator type
7
- * @returns the filter type
8
- */
9
3
  export function getFilterType(columnType, validator) {
10
4
  if (columnType === COLUMN.RANKING)
11
5
  return FILTER_TYPE.RANKING;
@@ -1,7 +1,11 @@
1
1
  export * from "./filter-adapt.helpers";
2
2
  export * from "./filter-settings.helpers";
3
+ export * from "./filter-validators.helpers";
4
+ export * from "./filter-verbose.helpers";
5
+ export * from "./getAggregateFilters";
3
6
  export * from "./getFilterId";
4
7
  export * from "./getFilterType";
8
+ export * from "./isDateDistinctGrouping";
9
+ export * from "./isRankingFilter";
5
10
  export * from "./resolveFilterConditions";
6
11
  export * from "./utils.helpers";
7
- //# sourceMappingURL=index.d.ts.map
@@ -1,6 +1,11 @@
1
1
  export * from "./filter-adapt.helpers";
2
2
  export * from "./filter-settings.helpers";
3
+ export * from "./filter-validators.helpers";
4
+ export * from "./filter-verbose.helpers";
5
+ export * from "./getAggregateFilters";
3
6
  export * from "./getFilterId";
4
7
  export * from "./getFilterType";
8
+ export * from "./isDateDistinctGrouping";
9
+ export * from "./isRankingFilter";
5
10
  export * from "./resolveFilterConditions";
6
11
  export * from "./utils.helpers";
@@ -0,0 +1,2 @@
1
+ import { IFilterGrouping } from "../resources/filter-grouping.resources";
2
+ export declare function isDateDistinctGrouping(grouping: IFilterGrouping): boolean;
@@ -0,0 +1,12 @@
1
+ import { FILTER_GROUPING, } from "../resources/filter-grouping.resources";
2
+ const DATE_DISTINCT_GROUPINGS = [
3
+ FILTER_GROUPING.YEAR_QUARTER,
4
+ FILTER_GROUPING.YEAR_MONTH,
5
+ FILTER_GROUPING.MONTH_DAY,
6
+ FILTER_GROUPING.DAY_HOUR,
7
+ FILTER_GROUPING.HOUR_MINUTE,
8
+ FILTER_GROUPING.MINUTE_SECOND,
9
+ ];
10
+ export function isDateDistinctGrouping(grouping) {
11
+ return DATE_DISTINCT_GROUPINGS.includes(grouping);
12
+ }
@@ -0,0 +1,2 @@
1
+ import { IFilter } from "../resources/filters.resources";
2
+ export declare function isRankingFilter(filter: IFilter): boolean;
@@ -0,0 +1,7 @@
1
+ import { COLUMN, isEmpty } from "@qrvey/utils";
2
+ import { isNullValidator } from "./filter-validators.helpers";
3
+ export function isRankingFilter(filter) {
4
+ return (filter.columnType === COLUMN.RANKING &&
5
+ isEmpty(filter.aggregateType) &&
6
+ !isNullValidator(filter.validator));
7
+ }
@@ -1,11 +1,3 @@
1
1
  import { IFilterParamSettings } from "../resources/filter-functions.resources";
2
2
  import { IFilter } from "../resources/filters.resources";
3
- /**
4
- * Resolves conditions to fullfill the match of the filter object
5
- * @param filter the filter object
6
- * @param params the params of the filter to resolve the condition
7
- * @param settings the filter param settings
8
- * @returns true: the conditions is fullfiled.
9
- */
10
3
  export declare function resolveFilterConditions(filter: IFilter, params: Partial<IFilter>, settings: IFilterParamSettings): boolean;
11
- //# sourceMappingURL=resolveFilterConditions.d.ts.map
@@ -1,12 +1,5 @@
1
- /**
2
- * Resolves conditions to fullfill the match of the filter object
3
- * @param filter the filter object
4
- * @param params the params of the filter to resolve the condition
5
- * @param settings the filter param settings
6
- * @returns true: the conditions is fullfiled.
7
- */
8
1
  export function resolveFilterConditions(filter, params, settings) {
9
- const paramKeys = Object.keys(params) || [];
2
+ const paramKeys = Object.keys(params);
10
3
  let condition = true;
11
4
  for (let i = 0; i < paramKeys.length; i++) {
12
5
  const paramKey = paramKeys[i];
@@ -1,26 +1,9 @@
1
1
  import { IColumn, IDataset } from "@qrvey/utils";
2
- /**
3
- * Gets the column info by ID
4
- * @param ids the ids to search the info
5
- * @param ids.columnId the column ID
6
- * @param ids.datasetId the dataset ID
7
- * @param datasets the collection of datasets
8
- * @returns the Column Info
9
- */
10
2
  export declare function getColumnInfo(ids: {
11
3
  columnId: string;
12
4
  datasetId: string;
13
5
  }, datasets?: IDataset[]): IColumn | undefined;
14
- /**
15
- * Gets the dataset info by ID
16
- * @param ids the ids to search the info
17
- * @param ids.columnId the column ID
18
- * @param ids.datasetId the dataset ID
19
- * @param datasets the collection of datasets
20
- * @returns the Dataset Info
21
- */
22
6
  export declare function getDatasetInfo(ids: {
23
7
  columnId: string;
24
8
  datasetId: string;
25
9
  }, datasets?: IDataset[]): IDataset | undefined;
26
- //# sourceMappingURL=utils.helpers.d.ts.map
@@ -1,23 +1,7 @@
1
- /**
2
- * Gets the column info by ID
3
- * @param ids the ids to search the info
4
- * @param ids.columnId the column ID
5
- * @param ids.datasetId the dataset ID
6
- * @param datasets the collection of datasets
7
- * @returns the Column Info
8
- */
9
1
  export function getColumnInfo(ids, datasets = []) {
10
2
  const datasetInfo = getDatasetInfo(ids, datasets);
11
3
  return datasetInfo?.options?.find((cInfo) => cInfo.id === ids.columnId && cInfo.qrveyid === ids.datasetId);
12
4
  }
13
- /**
14
- * Gets the dataset info by ID
15
- * @param ids the ids to search the info
16
- * @param ids.columnId the column ID
17
- * @param ids.datasetId the dataset ID
18
- * @param datasets the collection of datasets
19
- * @returns the Dataset Info
20
- */
21
5
  export function getDatasetInfo(ids, datasets = []) {
22
6
  if (ids == null || !Array.isArray(datasets))
23
7
  return;
package/dist/index.d.ts CHANGED
@@ -2,4 +2,3 @@ export * from "./classes";
2
2
  export * from "./helpers";
3
3
  export * from "./models";
4
4
  export * from "./resources";
5
- //# sourceMappingURL=index.d.ts.map
@@ -1,203 +1,47 @@
1
1
  import { IFilterAddSettings, IFilterBuilderEditSettings, IFilterMergeSettings, IFilterParamSettings } from "../resources/filter-functions.resources";
2
2
  import { IFilterValue } from "../resources/filter-values.resources";
3
3
  import { IFilter } from "../resources/filters.resources";
4
- /**
5
- * Structure model for the adding filters
6
- */
7
4
  export interface IFilterBuilderAdd {
8
- /**
9
- * Adds one filter into the collection.
10
- * Inserts it next to the last similar filter
11
- * @param filter the filter to add
12
- * @param inIndex the index to add the new filter
13
- * @param settings the settings object to setup this function
14
- * @returns the new collection of filters
15
- */
16
5
  addSingle: (filter: IFilter, inIndex?: number, settings?: IFilterAddSettings) => IFilterBuilderSingleReturn;
17
- /**
18
- * Adds various filter into the collection.
19
- * Inserts them next to the last similar filter
20
- * @param filter the filter to add
21
- * @param inIndexes collection of indexes to add the new filters
22
- * @param settings the settings object to setup this function
23
- * @returns the new collection of filters
24
- */
25
6
  addMultiple: (filter: IFilter[], inIndexes?: number[], settings?: IFilterAddSettings) => IFilterBuilderMultipleReturn;
26
7
  }
27
- /**
28
- * Structure module for the editing filter values
29
- */
30
8
  export interface IFilterBuilderAddValue {
31
- /**
32
- * Adds one value from filter
33
- * @param id the ID to search the filter to add value
34
- * @param value the value to to add
35
- * @returns the new filter collection
36
- */
37
9
  addValue: (id: string, value: IFilterValue) => IFilterBuilderSingleReturn;
38
- /**
39
- * Adds various values from filter
40
- * @param id the ID to search the filter to add value
41
- * @param values the value collection to add
42
- * @returns the new filter collection
43
- */
44
10
  addValues: (id: string, values: IFilterValue[]) => IFilterBuilderSingleReturn;
45
11
  }
46
- /**
47
- * Structure module for the deleting filters
48
- */
49
12
  export interface IFilterBuilderDelete {
50
- /**
51
- * Removes one filter from the collection
52
- * @param id the ID to search the filter to remove
53
- * @returns the new filter collection
54
- */
55
13
  deleteSingle: (id: string) => IFilterBuilderSingleReturn;
56
- /**
57
- * Removes various filters from the collection
58
- * @param ids a collection of ID to search filters to remove
59
- * @returns the new filter collection
60
- */
61
14
  deleteMultiple: (ids: string[]) => IFilterBuilderMultipleReturn;
62
15
  }
63
- /**
64
- * Structure module for the editing filter values
65
- */
66
16
  export interface IFilterBuilderDeleteValue {
67
- /**
68
- * Removes one value from filter
69
- * @param id the ID to search the filter to remove value
70
- * @param index the index to search the value to remove
71
- * @returns the new filter collection
72
- */
73
17
  deleteValue: (id: string, index: number) => IFilterBuilderSingleReturn;
74
- /**
75
- * Removes various values from filter
76
- * @param id the ID to search the filter to remove value
77
- * @param indexes the index collection to search the value to remove
78
- * @returns the new filter collection
79
- */
80
18
  deleteValues: (id: string, indexes: number[]) => IFilterBuilderSingleReturn;
81
19
  }
82
- /**
83
- * Structure module for the editing filters
84
- */
85
20
  export interface IFilterBuilderEdit {
86
- /**
87
- * Edits one filter from the collection
88
- * @param filter an object with properties to edit
89
- * @param id the ID to search the filter to edit
90
- * @param settings settings object for the function
91
- * @returns the new filter collection
92
- */
93
21
  editSingle: (id: string, filter: Partial<IFilter> | IFilter, settings?: IFilterBuilderEditSettings) => IFilterBuilderSingleReturn;
94
- /**
95
- * Edits various filters from the collection
96
- * @param filters a collection of object with properties to edit
97
- * @param ids the collection of IDs to search filters to edit
98
- * @param settings settings object for the function
99
- * @returns the new filter collection
100
- */
101
22
  editMultiple: (ids: string[], filter: Partial<IFilter>[] | IFilter[], settings?: IFilterBuilderEditSettings) => IFilterBuilderMultipleReturn;
102
23
  }
103
- /**
104
- * Structure module for the editing filter values
105
- */
106
24
  export interface IFilterBuilderEditValue {
107
- /**
108
- * Edits one value from filter
109
- * @param id the ID to search the filter to edit value
110
- * @param value the value to edit
111
- * @param index the value index to edit
112
- * @returns the new filter collection
113
- */
114
25
  editValue: (id: string, value: IFilterValue, index: number) => IFilterBuilderSingleReturn;
115
- /**
116
- * Edits various values from filter
117
- * @param id the ID to search the filter to edit value
118
- * @param values the value collection to edit
119
- * @param indexes the index collection to edit
120
- * @returns the new filter collection
121
- */
122
26
  editValues: (id: string, values: IFilterValue[], indexes: number[]) => IFilterBuilderSingleReturn;
123
27
  }
124
- /**
125
- * Structure module for the editing filters
126
- */
127
28
  export interface IFilterBuilderMerge {
128
- /**
129
- * Merge the filter into the collection by some filter parameters
130
- * @param filter the filter to merge
131
- * @param settings the settings object to setup this function
132
- * @returns the new filter collection
133
- */
134
29
  mergeSingle: (filter: IFilter, settings?: IFilterMergeSettings) => IFilterBuilderSingleReturn;
135
- /**
136
- * Merge the filters into the collection by some filter parameters
137
- * @param filters the filter collection to merge
138
- * @param settings the settings object to setup this function
139
- * @returns the new filter collection
140
- */
141
30
  mergeMultiple: (filters: IFilter[], settings?: IFilterMergeSettings) => IFilterBuilderMultipleReturn;
142
31
  }
143
- /**
144
- * Structure module for the editing filter values
145
- */
146
32
  export interface IFilterBuilderMergeValue {
147
- /**
148
- * Merge values from filter
149
- * @param id the ID to search the filter to merge values
150
- * @param values the value collection to merge
151
- * @returns the new filter collection
152
- */
153
33
  mergeValues: (id: string, values: IFilterValue[] | undefined, indexes: number[]) => IFilterBuilderSingleReturn;
154
34
  }
155
- /**
156
- * Structure module for the setting filters
157
- */
158
35
  export interface IFilterBuilderSet {
159
- /**
160
- * Sets the given filters by param
161
- * - Remove the filters by the sucesfull conditions and replace the given ones
162
- * @param filters the filters to set
163
- * @param params params to search the filters
164
- * @param settings settings for this function
165
- * @returns the new collection of filters
166
- */
167
36
  replaceByParams: (filters: IFilter[], params: Partial<IFilter>, settings?: IFilterParamSettings) => IFilterBuilderMultipleReturn;
168
37
  }
169
- /**
170
- * Structure for the returning a single item
171
- */
172
38
  export interface IFilterBuilderSingleReturn {
173
- /**
174
- * the new filter collection
175
- */
176
39
  resulting: IFilter[];
177
- /**
178
- * the affected filter
179
- */
180
40
  affected?: IFilter;
181
- /**
182
- * the original filter before affecting
183
- */
184
41
  original?: IFilter;
185
42
  }
186
- /**
187
- * Structure for the returning a multiple items
188
- */
189
43
  export interface IFilterBuilderMultipleReturn {
190
- /**
191
- * the new filter collection
192
- */
193
44
  resulting: IFilter[];
194
- /**
195
- * the affected filters
196
- */
197
45
  affected?: IFilter[];
198
- /**
199
- * the original filters before affecting
200
- */
201
46
  original?: IFilter[];
202
47
  }
203
- //# sourceMappingURL=filter-builder.models.d.ts.map
@@ -2,70 +2,17 @@ import { IColumnType } from "@qrvey/utils";
2
2
  import { IFilterGroupingInfoListByColumnSettings } from "../resources/filter-functions.resources";
3
3
  import { IColumnTypeWithGrouping, IFilterGrouping, IFilterGroupingInfo } from "../resources/filter-grouping.resources";
4
4
  import { IFilterValidator, IFilterValidatorInfo } from "../resources/filter-validators.resources";
5
- /**
6
- * Structure model for the getting resources
7
- */
8
5
  export interface IFilterResourcesValidator {
9
- /**
10
- * Gets the complete collection of validator types
11
- * @returns the collection of validator types
12
- */
13
6
  getValidators: () => IFilterValidator[];
14
- /**
15
- * Gets the complete collection of validator info
16
- * @returns the collection of validator info
17
- */
18
7
  getInfoValidators: () => IFilterValidatorInfo[];
19
- /**
20
- * Gets a validator info by a validator type
21
- * @param validator the validator type
22
- * @returns a single validator info
23
- */
24
8
  getInfoByValidator: (validator: IFilterValidator) => IFilterValidatorInfo;
25
- /**
26
- * Gets a collection of validator info by a column type
27
- * @param type the column type
28
- * @returns a collection of validator info
29
- */
30
9
  getInfoValidatorsByColumnType: (type: IColumnType) => IFilterValidatorInfo[];
31
- /**
32
- * Gets a collection of validator info by a mutiple column types
33
- * - The resulting validator info collection is an intersection of mulitple validator info collections
34
- * @param types a collection of column types
35
- * @returns a collection of validator info
36
- */
37
10
  getInfoValidatorsByColumnTypes: (types: IColumnType[]) => IFilterValidatorInfo[];
38
11
  }
39
12
  export interface IFilterResourcesGrouping {
40
- /**
41
- * Gets the complete collection of grouping types
42
- * @returns the collection of grouping types
43
- */
44
13
  getGroupings: () => IFilterGrouping[];
45
- /**
46
- * Gets the complete collection of validator info
47
- * @returns the collection of validator info
48
- */
49
14
  getInfoGroupings: () => IFilterGroupingInfo[];
50
- /**
51
- * Gets a grouping info by a grouping type
52
- * @param grouping the grouping type
53
- * @returns a single grouping info
54
- */
55
15
  getInfoByGrouping: (validator: IFilterValidator) => IFilterGroupingInfo;
56
- /**
57
- * Gets a collection of validator info by a column type
58
- * @param type the column type
59
- * @returns a collection of validator info
60
- */
61
16
  getInfoGroupingsByColumnType: (type: IColumnType, settings?: IFilterGroupingInfoListByColumnSettings) => IFilterGroupingInfo[];
62
- /**
63
- * Gets a collection of groupings info by a column type
64
- * - The resulting grouping info collection is an intersection of mulitple grouping info collections
65
- * @param types the collection of column type
66
- * @param settings settings for the function
67
- * @returns a collection of grouping info
68
- */
69
17
  getInfoGroupingsByColumnTypes: (types: IColumnTypeWithGrouping[], settings?: IFilterGroupingInfoListByColumnSettings[]) => IFilterGroupingInfo[];
70
18
  }
71
- //# sourceMappingURL=filter-resources.models.d.ts.map
@@ -1,42 +1,13 @@
1
- import { IFilterParamSettings } from "../resources/filter-functions.resources";
1
+ import { IFilterFindLastIndexReturn, IFilterParamSettings } from "../resources/filter-functions.resources";
2
2
  import { IFilter } from "../resources/filters.resources";
3
3
  export interface IFilterSearcherParams {
4
- /**
5
- * Searchs and excludes filters by the given params
6
- * @param params params to exclude the filters
7
- * @param settings settings for this function
8
- * @returns the new collection of filters
9
- */
10
4
  excludeByParams(params: Partial<IFilter>, settings?: IFilterParamSettings): IFilter[];
11
- /**
12
- * Searchs filters by the given params
13
- * @param params params to search the filters
14
- * @param settings settings for this function
15
- * @returns the new collection of filters
16
- */
17
5
  filterByParams(params: Partial<IFilter>, settings?: IFilterParamSettings): IFilter[];
18
- /**
19
- * Searchs filters by the given params and returns the inexes
20
- * @param params params to search the filters
21
- * @param settings settings for this function
22
- * @returns the new collection of filters
23
- */
24
6
  filterIndexesByParams(params: Partial<IFilter>, settings?: IFilterParamSettings): number[];
25
- /**
26
- * Searchs filters by the given params.
27
- * Gets the first match of the searching
28
- * @param params params to search the filters
29
- * @param settings settings for this function
30
- * @returns the new collection of filters
31
- */
32
7
  findByParams(params: Partial<IFilter>, settings?: IFilterParamSettings): IFilter | undefined;
33
- /**
34
- * Searchs filters by the given params.
35
- * Gets the first match of the searching and returns the related index
36
- * @param params params to search the filters
37
- * @param settings settings for this function
38
- * @returns the new collection of filters
39
- */
40
8
  findIndexByParams(params: Partial<IFilter>, settings?: IFilterParamSettings): number;
41
9
  }
42
- //# sourceMappingURL=filter-searcher.models.d.ts.map
10
+ export interface IFilterSearchEngine extends IFilterSearcherParams {
11
+ findLastIndexByFilter(newFilter: IFilter, index?: number): IFilterFindLastIndexReturn;
12
+ setFilters(filters: IFilter[]): void;
13
+ }
@@ -1,59 +1,19 @@
1
1
  import { IFilterValidation, IFilterValidationInfo } from "../resources/filter-validation.resources";
2
2
  import { IFilterInputValue } from "../resources/filter-values.resources";
3
3
  import { IFilter } from "../resources/filters.resources";
4
- /**
5
- * Structure module for the editing filter values
6
- */
7
4
  export interface IFilterValidationValue {
8
- /**
9
- * Validates the value based on the given filter
10
- * @param filter the filter to validate the value
11
- * @param value the value to validate
12
- * @returns the resulting validation
13
- */
14
5
  value: (filter: IFilter, value: IFilterInputValue) => IFilterValidationSingleError;
15
- /**
16
- * Validates the values based on the given filter
17
- * @param filter the filter to validate the value
18
- * @param values the collection of values to validate
19
- * @returns the resulting validation
20
- */
21
6
  values: (filter: IFilter, values: IFilterInputValue[]) => IFilterValidationMultipleError;
22
7
  }
23
- /**
24
- * Structure for the returning validation status
25
- */
26
8
  export interface IFilterValidationSingleError {
27
- /**
28
- * the errors
29
- */
30
9
  errors: IFilterValidationError[];
31
- /**
32
- * The info of the errors
33
- */
34
10
  infoErrors: IFilterValidationInfo[];
35
11
  }
36
- /**
37
- * Structure for the returning validation status on mulitple values
38
- */
39
12
  export interface IFilterValidationMultipleError {
40
- /**
41
- * the errors collection
42
- */
43
13
  errors: IFilterValidationError[][];
44
- /**
45
- * The info of the errors collection
46
- */
47
14
  infoErrors: IFilterValidationInfo[][];
48
15
  }
49
- /**
50
- * Structure for the error
51
- */
52
16
  export interface IFilterValidationError {
53
17
  type: IFilterValidation;
54
- /**
55
- * the affected values
56
- */
57
18
  value?: IFilterInputValue;
58
19
  }
59
- //# sourceMappingURL=filter-validation.models.d.ts.map
@@ -1,4 +1,3 @@
1
1
  export * from "./filter-builder.models";
2
2
  export * from "./filter-resources.models";
3
3
  export * from "./filter-searcher.models";
4
- //# sourceMappingURL=index.d.ts.map