@webitel/ui-datalist 1.1.58 → 1.1.59

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 (183) hide show
  1. package/package.json +1 -1
  2. package/src/modules/card/composables/useCardAnyFieldEditedWatcher.ts +6 -2
  3. package/src/modules/card/composables/useCardComponent.ts +4 -1
  4. package/src/modules/card/composables/useCardSaveAction.ts +2 -0
  5. package/src/modules/card/composables/useCardValidation.ts +6 -1
  6. package/src/modules/card/composables/useNestedCardComponent.ts +4 -1
  7. package/src/modules/filter-presets/api/PresetQuery.ts +32 -9
  8. package/src/modules/filter-presets/components/apply-preset/apply-preset-action.vue +15 -5
  9. package/src/modules/filter-presets/components/apply-preset/preset-preview.vue +7 -4
  10. package/src/modules/filter-presets/components/save-preset/save-preset-action.vue +11 -3
  11. package/src/modules/filter-presets/types/PresetSnapshot.ts +6 -0
  12. package/src/modules/filters/classes/Filter.ts +1 -1
  13. package/src/modules/filters/classes/FiltersManager.ts +25 -17
  14. package/src/modules/filters/components/config/dynamic-view/dynamic-filter-config-form.vue +12 -11
  15. package/src/modules/filters/components/config/dynamic-view/dynamic-filter-config-view.vue +3 -1
  16. package/src/modules/filters/components/config/static-view/static-filter-field.vue +3 -1
  17. package/src/modules/filters/components/dynamic-filter-add-action.vue +8 -1
  18. package/src/modules/filters/components/preview/dynamic-filter-preview.vue +12 -2
  19. package/src/modules/filters/components/search-bar/dynamic-filter-search.vue +10 -9
  20. package/src/modules/filters/components/table-filters-panel.vue +4 -3
  21. package/src/modules/filters/components/types/Filter.types.ts +4 -1
  22. package/src/modules/filters/composables/useFilterConfigsToolkit.ts +2 -1
  23. package/src/modules/filters/createTableFiltersStore.ts +1 -1
  24. package/src/modules/filters/modules/filterConfig/classes/FilterConfig.ts +4 -1
  25. package/src/modules/filters/modules/filterConfig/classes/createFilterConfig.ts +4 -1
  26. package/src/modules/filters/modules/filterConfig/components/_custom/filterConfig.ts +8 -4
  27. package/src/modules/filters/modules/filterConfig/components/_custom/type-extension-filter-value-field.vue +13 -4
  28. package/src/modules/filters/modules/filterConfig/components/_custom/type-extension-filter-value-preview.vue +1 -1
  29. package/src/modules/filters/modules/filterConfig/components/_shared/date-time-filter/date-time-options/date-time-options-filter-value-field.vue +2 -1
  30. package/src/modules/filters/modules/filterConfig/components/_shared/has-options/has-option-filter-value-field.vue +1 -1
  31. package/src/modules/filters/modules/filterConfig/components/_shared/lookup-filter-preview/lookup-filter-value-preview.vue +15 -1
  32. package/src/modules/filters/modules/filterConfig/components/agent-status/agent-status-filter-value-preview.vue +2 -2
  33. package/src/modules/filters/modules/filterConfig/components/auditor/index.ts +5 -2
  34. package/src/modules/filters/modules/filterConfig/components/case-actual-reaction-time/case-actual-reaction-time-filter-value-preview.vue +1 -1
  35. package/src/modules/filters/modules/filterConfig/components/case-actual-resolution-time/case-actual-resolution-time-filter-value-preview.vue +1 -1
  36. package/src/modules/filters/modules/filterConfig/components/case-assignee/case-assignee-filter-value-field.vue +1 -1
  37. package/src/modules/filters/modules/filterConfig/components/case-assignee/filterConfig.ts +5 -3
  38. package/src/modules/filters/modules/filterConfig/components/case-close-reason-groups/case-close-reason-groups-filter-value-field.vue +2 -2
  39. package/src/modules/filters/modules/filterConfig/components/case-reaction-time/case-reaction-time-filter-value-preview.vue +1 -1
  40. package/src/modules/filters/modules/filterConfig/components/case-resolution-time/case-resolution-time-filter-value-preview.vue +1 -1
  41. package/src/modules/filters/modules/filterConfig/components/case-service/case-service-filter-value-field.vue +1 -1
  42. package/src/modules/filters/modules/filterConfig/components/case-sla-condition/case-sla-condition-filter-value-field.vue +2 -2
  43. package/src/modules/filters/modules/filterConfig/components/case-status/case-status-filter-value-field.vue +2 -2
  44. package/src/modules/filters/modules/filterConfig/components/contact-group/contact-group-filter-value-field.vue +6 -5
  45. package/src/modules/filters/modules/filterConfig/components/contact-group/index.ts +5 -2
  46. package/src/modules/filters/modules/filterConfig/components/contact-label/contact-label-filter-value-field.vue +1 -1
  47. package/src/modules/filters/modules/filterConfig/components/contact-label/index.ts +4 -2
  48. package/src/modules/filters/modules/filterConfig/components/contact-owner/index.ts +7 -3
  49. package/src/modules/filters/modules/filterConfig/components/gateway/gateway-filter-value-field.vue +1 -1
  50. package/src/modules/filters/modules/filterConfig/components/has-user/has-user-filter-value-field.vue +1 -1
  51. package/src/modules/filters/modules/filterConfig/components/queue/index.ts +5 -2
  52. package/src/modules/filters/modules/filterConfig/components/queue-period/queue-period-filter-value-preview.vue +2 -2
  53. package/src/modules/filters/modules/filterConfig/components/queue-type/queue-type-filter-value-preview.vue +2 -2
  54. package/src/modules/filters/modules/filterConfig/components/region/index.ts +5 -2
  55. package/src/modules/filters/modules/filterConfig/components/skill/index.ts +5 -2
  56. package/src/modules/filters/modules/filterConfig/components/supervisor/index.ts +5 -2
  57. package/src/modules/filters/modules/filterConfig/components/team/index.ts +6 -2
  58. package/src/modules/filters/scripts/utils.ts +2 -2
  59. package/src/modules/headers/createTableHeadersStore.ts +46 -20
  60. package/src/modules/permissions-page/components/permissions-tab.vue +7 -1
  61. package/src/modules/persist/PersistedStorage.types.ts +4 -1
  62. package/src/modules/persist/usePersistedStorage.ts +9 -3
  63. package/src/modules/scripts/utils.ts +5 -3
  64. package/types/.tsbuildinfo +1 -1
  65. package/types/modules/card/composables/useCardAnyFieldEditedWatcher.d.ts +4 -3
  66. package/types/modules/card/composables/useCardComponent.d.ts +2 -2
  67. package/types/modules/card/composables/useCardRouting.d.ts +1 -1
  68. package/types/modules/card/composables/useCardValidation.d.ts +3 -2
  69. package/types/modules/card/composables/useNestedCardComponent.d.ts +2 -2
  70. package/types/modules/card/stores/createCardStore.d.ts +18 -18
  71. package/types/modules/filter-presets/api/PresetQuery.d.ts +14 -13
  72. package/types/modules/filter-presets/components/_shared/input-fields/preset-description-field.vue.d.ts +3 -3
  73. package/types/modules/filter-presets/components/_shared/input-fields/preset-name-field.vue.d.ts +2 -2
  74. package/types/modules/filter-presets/components/apply-preset/apply-preset-action.vue.d.ts +1 -1
  75. package/types/modules/filter-presets/components/apply-preset/preset-preview.vue.d.ts +4 -4
  76. package/types/modules/filter-presets/components/save-preset/overwrite-preset-popup.vue.d.ts +3 -3
  77. package/types/modules/filter-presets/components/save-preset/save-preset-popup.vue.d.ts +3 -3
  78. package/types/modules/filter-presets/stores/createFilterPresetsStore.d.ts +40 -34
  79. package/types/modules/filter-presets/types/PresetSnapshot.d.ts +6 -0
  80. package/types/modules/filters/classes/Filter.d.ts +1 -1
  81. package/types/modules/filters/components/config/dynamic-view/dynamic-filter-config-form-label.vue.d.ts +4 -4
  82. package/types/modules/filters/components/config/dynamic-view/dynamic-filter-config-form-value-input.vue.d.ts +2 -2
  83. package/types/modules/filters/components/config/dynamic-view/dynamic-filter-config-form.vue.d.ts +5 -5
  84. package/types/modules/filters/components/config/dynamic-view/dynamic-filter-config-view.vue.d.ts +1 -1
  85. package/types/modules/filters/components/config/static-view/static-filter-field.vue.d.ts +3 -3
  86. package/types/modules/filters/components/dynamic-filter-add-action.vue.d.ts +1 -1
  87. package/types/modules/filters/components/dynamic-filter-panel-wrapper.vue.d.ts +1 -1
  88. package/types/modules/filters/components/preview/dynamic-filter-preview.vue.d.ts +2 -2
  89. package/types/modules/filters/components/search-bar/dynamic-filter-search.vue.d.ts +6 -6
  90. package/types/modules/filters/components/table-filters-panel.vue.d.ts +6 -6
  91. package/types/modules/filters/components/types/Filter.types.d.ts +3 -1
  92. package/types/modules/filters/composables/useFilterConfigsToolkit.d.ts +2 -1
  93. package/types/modules/filters/createTableFiltersStore.d.ts +23 -11
  94. package/types/modules/filters/modules/filterConfig/classes/FilterConfig.d.ts +3 -1
  95. package/types/modules/filters/modules/filterConfig/components/_custom/filterConfig.d.ts +2 -5
  96. package/types/modules/filters/modules/filterConfig/components/_custom/type-extension-filter-value-field.vue.d.ts +2 -2
  97. package/types/modules/filters/modules/filterConfig/components/_shared/date-time-filter/date-time-filter-value-field.vue.d.ts +3 -3
  98. package/types/modules/filters/modules/filterConfig/components/_shared/date-time-filter/date-time-options/date-time-options-filter-value-field.vue.d.ts +5 -5
  99. package/types/modules/filters/modules/filterConfig/components/_shared/durations/duration-filter-value-field.vue.d.ts +3 -3
  100. package/types/modules/filters/modules/filterConfig/components/_shared/has-options/has-option-filter-value-field.vue.d.ts +3 -3
  101. package/types/modules/filters/modules/filterConfig/components/agent/agent-filter-value-field.vue.d.ts +4 -4
  102. package/types/modules/filters/modules/filterConfig/components/agent/config.d.ts +2 -0
  103. package/types/modules/filters/modules/filterConfig/components/agent-status/agent-status-filter-value-field.vue.d.ts +4 -4
  104. package/types/modules/filters/modules/filterConfig/components/amd-result/amd-result-filter-value-field.vue.d.ts +4 -4
  105. package/types/modules/filters/modules/filterConfig/components/auditor/auditor-filter-value-field.vue.d.ts +3 -3
  106. package/types/modules/filters/modules/filterConfig/components/auditor/index.d.ts +5 -5
  107. package/types/modules/filters/modules/filterConfig/components/call-direction/call-direction-filter-value-field.vue.d.ts +4 -4
  108. package/types/modules/filters/modules/filterConfig/components/case-actual-reaction-time/case-actual-reaction-time-filter-value-field.vue.d.ts +3 -3
  109. package/types/modules/filters/modules/filterConfig/components/case-actual-resolution-time/case-actual-resolution-time-filter-value-field.vue.d.ts +3 -3
  110. package/types/modules/filters/modules/filterConfig/components/case-assignee/case-assignee-filter-value-field.vue.d.ts +2 -2
  111. package/types/modules/filters/modules/filterConfig/components/case-assignee/filterConfig.d.ts +5 -5
  112. package/types/modules/filters/modules/filterConfig/components/case-author/case-author-filter-value-field.vue.d.ts +4 -4
  113. package/types/modules/filters/modules/filterConfig/components/case-author/config.d.ts +4 -0
  114. package/types/modules/filters/modules/filterConfig/components/case-close-reason-groups/case-close-reason-groups-filter-value-field.vue.d.ts +3 -3
  115. package/types/modules/filters/modules/filterConfig/components/case-close-reason-groups/config.d.ts +4 -0
  116. package/types/modules/filters/modules/filterConfig/components/case-impacted/case-impacted-filter-value-field.vue.d.ts +4 -4
  117. package/types/modules/filters/modules/filterConfig/components/case-impacted/config.d.ts +2 -0
  118. package/types/modules/filters/modules/filterConfig/components/case-priority/case-priority-filter-value-field.vue.d.ts +4 -4
  119. package/types/modules/filters/modules/filterConfig/components/case-priority/config.d.ts +2 -0
  120. package/types/modules/filters/modules/filterConfig/components/case-reaction-time/case-reaction-time-filter-value-field.vue.d.ts +3 -3
  121. package/types/modules/filters/modules/filterConfig/components/case-reporter/case-reporter-filter-value-field.vue.d.ts +4 -4
  122. package/types/modules/filters/modules/filterConfig/components/case-reporter/config.d.ts +2 -0
  123. package/types/modules/filters/modules/filterConfig/components/case-resolution-time/case-resolution-time-filter-value-field.vue.d.ts +3 -3
  124. package/types/modules/filters/modules/filterConfig/components/case-service/case-service-filter-value-field.vue.d.ts +2 -2
  125. package/types/modules/filters/modules/filterConfig/components/case-service/config.d.ts +4 -0
  126. package/types/modules/filters/modules/filterConfig/components/case-sla/case-sla-filter-value-field.vue.d.ts +4 -4
  127. package/types/modules/filters/modules/filterConfig/components/case-sla/config.d.ts +2 -0
  128. package/types/modules/filters/modules/filterConfig/components/case-sla-condition/case-sla-condition-filter-value-field.vue.d.ts +3 -3
  129. package/types/modules/filters/modules/filterConfig/components/case-sla-condition/config.d.ts +4 -0
  130. package/types/modules/filters/modules/filterConfig/components/case-source/case-source-filter-value-field.vue.d.ts +4 -4
  131. package/types/modules/filters/modules/filterConfig/components/case-source/config.d.ts +4 -0
  132. package/types/modules/filters/modules/filterConfig/components/case-status/case-status-filter-value-field.vue.d.ts +3 -3
  133. package/types/modules/filters/modules/filterConfig/components/case-status/config.d.ts +4 -0
  134. package/types/modules/filters/modules/filterConfig/components/contact/config.d.ts +2 -0
  135. package/types/modules/filters/modules/filterConfig/components/contact/contact-filter-value-field.vue.d.ts +4 -4
  136. package/types/modules/filters/modules/filterConfig/components/contact-group/contact-group-filter-value-field.vue.d.ts +2 -2
  137. package/types/modules/filters/modules/filterConfig/components/contact-group/index.d.ts +6 -4
  138. package/types/modules/filters/modules/filterConfig/components/contact-label/contact-label-filter-value-field.vue.d.ts +3 -3
  139. package/types/modules/filters/modules/filterConfig/components/contact-label/index.d.ts +5 -5
  140. package/types/modules/filters/modules/filterConfig/components/contact-owner/contact-owner-filter-value-field.vue.d.ts +3 -3
  141. package/types/modules/filters/modules/filterConfig/components/contact-owner/index.d.ts +5 -5
  142. package/types/modules/filters/modules/filterConfig/components/created-at-from/created-at-from-filter-value-field.vue.d.ts +3 -3
  143. package/types/modules/filters/modules/filterConfig/components/created-at-to/created-at-to-filter-value-field.vue.d.ts +3 -3
  144. package/types/modules/filters/modules/filterConfig/components/gateway/config.d.ts +2 -0
  145. package/types/modules/filters/modules/filterConfig/components/gateway/gateway-filter-value-field.vue.d.ts +4 -4
  146. package/types/modules/filters/modules/filterConfig/components/grantee/config.d.ts +4 -0
  147. package/types/modules/filters/modules/filterConfig/components/grantee/grantee-filter-value-field.vue.d.ts +4 -4
  148. package/types/modules/filters/modules/filterConfig/components/hangup-cause/hangup-cause-filter-value-field.vue.d.ts +4 -4
  149. package/types/modules/filters/modules/filterConfig/components/has-attachment/has-attachment-filter-value-field.vue.d.ts +4 -4
  150. package/types/modules/filters/modules/filterConfig/components/has-file/has-file-filter-value-field.vue.d.ts +4 -4
  151. package/types/modules/filters/modules/filterConfig/components/has-rating/has-rating-filter-value-field.vue.d.ts +4 -4
  152. package/types/modules/filters/modules/filterConfig/components/has-transcription/has-transcription-filter-value-field.vue.d.ts +4 -4
  153. package/types/modules/filters/modules/filterConfig/components/has-user/has-user-filter-value-field.vue.d.ts +3 -3
  154. package/types/modules/filters/modules/filterConfig/components/index.d.ts +60 -59
  155. package/types/modules/filters/modules/filterConfig/components/queue/index.d.ts +5 -5
  156. package/types/modules/filters/modules/filterConfig/components/queue/queue-filter-value-field.vue.d.ts +3 -3
  157. package/types/modules/filters/modules/filterConfig/components/queue-period/queue-period-filter-value-field.vue.d.ts +4 -4
  158. package/types/modules/filters/modules/filterConfig/components/queue-type/queue-type-filter-value-field.vue.d.ts +4 -4
  159. package/types/modules/filters/modules/filterConfig/components/rated-by/config.d.ts +4 -0
  160. package/types/modules/filters/modules/filterConfig/components/rated-by/rated-by-filter-value-field.vue.d.ts +4 -4
  161. package/types/modules/filters/modules/filterConfig/components/rating/rating-from-to-filter-value-field.vue.d.ts +3 -3
  162. package/types/modules/filters/modules/filterConfig/components/region/index.d.ts +5 -5
  163. package/types/modules/filters/modules/filterConfig/components/region/region-filter-value-field.vue.d.ts +3 -3
  164. package/types/modules/filters/modules/filterConfig/components/score/score-from-to-filter-value-field.vue.d.ts +3 -3
  165. package/types/modules/filters/modules/filterConfig/components/skill/index.d.ts +5 -5
  166. package/types/modules/filters/modules/filterConfig/components/skill/skill-filter-value-field.vue.d.ts +3 -3
  167. package/types/modules/filters/modules/filterConfig/components/supervisor/index.d.ts +5 -5
  168. package/types/modules/filters/modules/filterConfig/components/supervisor/supervisor-filter-value-field.vue.d.ts +3 -3
  169. package/types/modules/filters/modules/filterConfig/components/tag/tag-filter-value-field.vue.d.ts +4 -4
  170. package/types/modules/filters/modules/filterConfig/components/talk-duration/talk-duration-filter-value-field.vue.d.ts +4 -4
  171. package/types/modules/filters/modules/filterConfig/components/team/index.d.ts +5 -5
  172. package/types/modules/filters/modules/filterConfig/components/team/team-filter-value-field.vue.d.ts +3 -3
  173. package/types/modules/filters/modules/filterConfig/components/total-duration/total-duration-filter-value-field.vue.d.ts +4 -4
  174. package/types/modules/filters/modules/filterConfig/components/user/config.d.ts +4 -0
  175. package/types/modules/filters/modules/filterConfig/components/user/user-filter-value-field.vue.d.ts +4 -4
  176. package/types/modules/filters/modules/filterConfig/components/utilization-progress/utilization-progress-filter-value-field.vue.d.ts +4 -4
  177. package/types/modules/filters/modules/filterConfig/components/variable/variable-filter-value-field.vue.d.ts +4 -4
  178. package/types/modules/filters/modules/filterConfig/composables/booleanFilterToolkit.d.ts +2 -2
  179. package/types/modules/filters/scripts/utils.d.ts +2 -2
  180. package/types/modules/headers/createTableHeadersStore.d.ts +57 -58
  181. package/types/modules/permissions-page/stores/createPermissionsStore.d.ts +80 -68
  182. package/types/modules/persist/PersistedStorage.types.d.ts +3 -3
  183. package/types/modules/table/createTableStore.store.d.ts +78 -66
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webitel/ui-datalist",
3
- "version": "1.1.58",
3
+ "version": "1.1.59",
4
4
  "description": "Toolkit for building data lists in webitel ui system",
5
5
  "scripts": {
6
6
  "build:types": "vue-tsc -b tsconfig.build.json",
@@ -1,6 +1,10 @@
1
- import { ref, watch } from 'vue';
1
+ import { type Ref, ref, watch } from 'vue';
2
2
 
3
- export const useCardAnyFieldEditedWatcher = ({ value }) => {
3
+ export const useCardAnyFieldEditedWatcher = ({
4
+ value,
5
+ }: {
6
+ value: Ref<object>;
7
+ }) => {
4
8
  const isAnyFieldEdited = ref(false);
5
9
 
6
10
  let prevValue: object;
@@ -10,7 +10,10 @@ import { useCardSaveAction } from './useCardSaveAction';
10
10
  import { useCardValidation } from './useCardValidation';
11
11
  import { useItemCardSaveText } from './useItemCardSaveText';
12
12
 
13
- export const useCardComponent = <CardEntity>({
13
+ export const useCardComponent = <
14
+ // biome-ignore lint/suspicious/noExplicitAny: matches RegleSchema's own state constraint
15
+ CardEntity extends Record<string, any>,
16
+ >({
14
17
  useCardStore,
15
18
  onLoadErrorHandler,
16
19
  manualSetup = false,
@@ -8,6 +8,8 @@ export const useCardSaveAction = <CardEntity>({
8
8
  saveItem: (data: CardEntity) => Promise<unknown /* coz doesnt matter */>;
9
9
  }) => {
10
10
  const save = async () => {
11
+ if (!validate) return;
12
+
11
13
  const { valid, data } = await validate();
12
14
  if (!valid) return;
13
15
 
@@ -1,7 +1,12 @@
1
+ import type { RegleShortcutDefinition } from '@regle/core';
1
2
  import type { RegleSchema } from '@regle/schemas';
2
3
  import { computed, type Ref } from 'vue';
3
4
 
4
- export const useCardValidation = <TState, TSchema = {}>({
5
+ export const useCardValidation = <
6
+ // biome-ignore lint/suspicious/noExplicitAny: matches RegleSchema's own state constraint
7
+ TState extends Record<string, any>,
8
+ TSchema extends RegleShortcutDefinition = {},
9
+ >({
5
10
  validationSchema,
6
11
  }: {
7
12
  validationSchema: Ref<RegleSchema<TState, TSchema>>;
@@ -22,7 +22,10 @@ import { useCardRouting } from './useCardRouting';
22
22
  * });
23
23
  * ```
24
24
  */
25
- export const useNestedCardComponent = <CardEntity>({
25
+ export const useNestedCardComponent = <
26
+ // biome-ignore lint/suspicious/noExplicitAny: matches RegleSchema's own state constraint
27
+ CardEntity extends Record<string, any>,
28
+ >({
26
29
  useCardStore,
27
30
  onLoadErrorHandler,
28
31
  routeParamName,
@@ -12,6 +12,7 @@ import applyTransform, {
12
12
  snakeToCamel,
13
13
  starToSearch,
14
14
  } from '@webitel/ui-sdk/api/transformers/index';
15
+ import type { Id } from '@webitel/ui-sdk/api/types/ApiModule';
15
16
  import {
16
17
  type EngineCreatePresetQueryRequest,
17
18
  type EnginePresetQuery,
@@ -39,13 +40,17 @@ type GetPresetListRequestConfig = {
39
40
  };
40
41
  };
41
42
 
42
- const getPresetList = async (params, config?: GetPresetListRequestConfig) => {
43
+ const getPresetList = async (
44
+ params?: unknown,
45
+ config?: GetPresetListRequestConfig,
46
+ ) => {
43
47
  const useStarToSearch = config?.transformers?.useStarToSearch ?? true;
44
48
 
45
49
  const { page, size, search, sort, fields, presetNamespace, id } =
46
50
  applyTransform(params, [
47
51
  merge(getDefaultGetParams()),
48
- (params) => (useStarToSearch ? starToSearch('search')(params) : params),
52
+ (params: object) =>
53
+ useStarToSearch ? starToSearch('search')(params) : params,
49
54
  ]);
50
55
  try {
51
56
  const response = await service.searchPresetQuery(
@@ -79,9 +84,9 @@ const getPresetList = async (params, config?: GetPresetListRequestConfig) => {
79
84
  }
80
85
  };
81
86
 
82
- const getPreset = async ({ id }) => {
87
+ const getPreset = async ({ id }: { id?: Id | null }) => {
83
88
  try {
84
- const response = await service.readPresetQuery(id);
89
+ const response = await service.readPresetQuery(Number(id));
85
90
  return applyTransform(response.data, [
86
91
  snakeToCamel(),
87
92
  ]);
@@ -101,7 +106,12 @@ const addPreset = async ({
101
106
  }): Promise<EnginePresetQuery> => {
102
107
  const item = applyTransform(preset, [
103
108
  camelToSnake(),
104
- (item) => {
109
+ (item: {
110
+ preset: {
111
+ namespace: string;
112
+ };
113
+ section: string;
114
+ }) => {
105
115
  item.preset.namespace = namespace;
106
116
  item.section = namespace;
107
117
  return item;
@@ -119,10 +129,23 @@ const addPreset = async ({
119
129
  }
120
130
  };
121
131
 
122
- const updatePreset = async ({ item: itemInstance, id, namespace }) => {
132
+ const updatePreset = async ({
133
+ item: itemInstance,
134
+ id,
135
+ namespace,
136
+ }: {
137
+ item: EngineCreatePresetQueryRequest;
138
+ id: number;
139
+ namespace: string;
140
+ }) => {
123
141
  const item = applyTransform(itemInstance, [
124
142
  camelToSnake(),
125
- (item) => {
143
+ (item: {
144
+ preset: {
145
+ namespace: string;
146
+ };
147
+ section: string;
148
+ }) => {
126
149
  item.preset.namespace = namespace;
127
150
  item.section = namespace;
128
151
  return item;
@@ -140,9 +163,9 @@ const updatePreset = async ({ item: itemInstance, id, namespace }) => {
140
163
  }
141
164
  };
142
165
 
143
- const deletePreset = async ({ id }) => {
166
+ const deletePreset = async ({ id }: { id?: Id | null }) => {
144
167
  try {
145
- const response = await service.deletePresetQuery(id);
168
+ const response = await service.deletePresetQuery(Number(id));
146
169
  return applyTransform(response.data, []);
147
170
  } catch (err) {
148
171
  throw applyTransform(err, [
@@ -81,6 +81,7 @@ import {
81
81
  import { useEventBus } from '@webitel/ui-sdk/composables';
82
82
  import { IconAction } from '@webitel/ui-sdk/enums';
83
83
  import { useTableEmpty } from '@webitel/ui-sdk/modules/TableComponentModule/composables/useTableEmpty';
84
+ import type { AxiosError } from 'axios';
84
85
  import { type StoreGeneric, storeToRefs } from 'pinia';
85
86
  import { computed, onMounted, ref, watch } from 'vue';
86
87
  import { useI18n } from 'vue-i18n';
@@ -88,6 +89,7 @@ import { EnginePresetQuery } from 'webitel-sdk';
88
89
 
89
90
  import { AnyFilterConfig } from '../../../filters/modules/filterConfig/classes/FilterConfig';
90
91
  import PresetQueryAPI from '../../api/PresetQuery';
92
+ import type { PresetSnapshot } from '../../types/PresetSnapshot';
91
93
  import PresetPreview from './preset-preview.vue';
92
94
 
93
95
  const props = defineProps<{
@@ -206,14 +208,22 @@ const applySelectedPreset = () => {
206
208
  showPresetsList.value = false;
207
209
  };
208
210
 
209
- const updatePreset = async ({ preset, onSuccess, onFailure }) => {
211
+ const updatePreset = async ({
212
+ preset,
213
+ onSuccess,
214
+ onFailure,
215
+ }: {
216
+ preset: EnginePresetQuery;
217
+ onSuccess: () => void;
218
+ onFailure: (err: AxiosError) => void;
219
+ }) => {
210
220
  try {
211
221
  await PresetQueryAPI.update({
212
222
  item: {
213
223
  ...preset,
214
224
  },
215
- id: preset.id,
216
- namespace: preset.preset?.namespace,
225
+ id: Number(preset.id),
226
+ namespace: (preset.preset as PresetSnapshot | undefined)?.namespace ?? '',
217
227
  });
218
228
  eventBus?.$emit('notification', {
219
229
  type: 'success',
@@ -224,7 +234,7 @@ const updatePreset = async ({ preset, onSuccess, onFailure }) => {
224
234
  onSuccess();
225
235
  return loadDataList();
226
236
  } catch (err) {
227
- onFailure(err);
237
+ onFailure(err as AxiosError);
228
238
  throw err;
229
239
  }
230
240
  };
@@ -233,7 +243,7 @@ const deletePreset = async (preset: EnginePresetQuery) => {
233
243
  await deleteEls([
234
244
  preset,
235
245
  ]);
236
- eventBus.$emit('notification', {
246
+ eventBus?.$emit('notification', {
237
247
  type: 'success',
238
248
  text: t('systemNotifications.success.delete', {
239
249
  entity: t('webitelUI.filters.presets.preset'),
@@ -91,6 +91,7 @@ import { EnginePresetQuery } from 'webitel-sdk';
91
91
 
92
92
  import { createFiltersManager } from '../../../filters';
93
93
  import { AnyFilterConfig } from '../../../filters/modules/filterConfig/classes/FilterConfig';
94
+ import type { PresetSnapshot } from '../../types/PresetSnapshot';
94
95
  import PresetDescriptionField from '../_shared/input-fields/preset-description-field.vue';
95
96
  import PresetNameField from '../_shared/input-fields/preset-name-field.vue';
96
97
  import PresetFiltersPreview from '../_shared/preset-filters-preview.vue';
@@ -123,7 +124,9 @@ const emit = defineEmits<{
123
124
  const filtersManager = computed(() => {
124
125
  const filtersManager = createFiltersManager();
125
126
 
126
- const snapshot = props.preset?.preset?.['filtersManager.toString'];
127
+ const snapshot = (props.preset?.preset as PresetSnapshot | undefined)?.[
128
+ 'filtersManager.toString'
129
+ ];
127
130
  if (snapshot) {
128
131
  filtersManager.fromString(snapshot);
129
132
  }
@@ -147,8 +150,8 @@ const editDraft = ref({
147
150
 
148
151
  const fillDraft = () => {
149
152
  editDraft.value = {
150
- name: props.preset.name,
151
- description: props.preset.description,
153
+ name: props.preset.name ?? '',
154
+ description: props.preset.description ?? '',
152
155
  };
153
156
  };
154
157
 
@@ -170,7 +173,7 @@ const v$ = useVuelidate(
170
173
  );
171
174
  v$.value.$touch();
172
175
 
173
- const startEdit = ({ open: openExpansion }) => {
176
+ const startEdit = ({ open: openExpansion }: { open: () => void }) => {
174
177
  openExpansion();
175
178
  editMode.value = true;
176
179
  };
@@ -107,7 +107,7 @@ const presetToOverwriteWith: Ref<EnginePresetQuery | null> = ref(null);
107
107
 
108
108
  const handlePresetSubmit = async (
109
109
  preset: EnginePresetQuery,
110
- { onCompleted }: SubmitConfig,
110
+ { onCompleted }: SubmitConfig = {},
111
111
  ) => {
112
112
  try {
113
113
  await addPreset({
@@ -124,7 +124,15 @@ const handlePresetSubmit = async (
124
124
 
125
125
  showSaveForm.value = false;
126
126
  } catch (err) {
127
- if (err?.status === 409) {
127
+ if (
128
+ (
129
+ err as
130
+ | {
131
+ status?: number;
132
+ }
133
+ | undefined
134
+ )?.status === 409
135
+ ) {
128
136
  presetToOverwriteWith.value = preset;
129
137
  }
130
138
  throw err;
@@ -139,7 +147,7 @@ const handlePresetOverwriteConfirmation = async ({
139
147
  try {
140
148
  const { items } = await getPresetList(
141
149
  {
142
- search: presetToOverwriteWith.value.name,
150
+ search: presetToOverwriteWith.value?.name,
143
151
  presetNamespace: props.namespace,
144
152
  },
145
153
  {
@@ -0,0 +1,6 @@
1
+ /** payload stored in `EnginePresetQuery.preset`, typed as `object` by the SDK */
2
+ export interface PresetSnapshot {
3
+ /** serialized `FiltersManager`, see `IFiltersManager.toString()` */
4
+ 'filtersManager.toString'?: string;
5
+ namespace?: string;
6
+ }
@@ -47,7 +47,7 @@ export interface IFilter {
47
47
 
48
48
  export class Filter implements IFilter {
49
49
  readonly name: FilterName;
50
- label: FilterLabel;
50
+ label?: FilterLabel;
51
51
  value: FilterValue;
52
52
 
53
53
  constructor(
@@ -181,17 +181,20 @@ class FiltersManager implements IFiltersManager {
181
181
  const filtersData = this.getFiltersList({
182
182
  include,
183
183
  exclude,
184
- }).reduce((acc, { name, label, value }) => {
185
- if (isEmpty(value) && value == null) return acc;
184
+ }).reduce<Record<string, FilterValue | FilterLabel>>(
185
+ (acc, { name, label, value }) => {
186
+ if (isEmpty(value) && value == null) return acc;
186
187
 
187
- acc[filterValueToSnapshotKey(name)] = value;
188
+ acc[filterValueToSnapshotKey(name)] = value;
188
189
 
189
- if (label) {
190
- acc[filterLabelToSnapshotKey(name)] = label;
191
- }
190
+ if (label) {
191
+ acc[filterLabelToSnapshotKey(name)] = label;
192
+ }
192
193
 
193
- return acc;
194
- }, {});
194
+ return acc;
195
+ },
196
+ {},
197
+ );
195
198
 
196
199
  return JSON.stringify(filtersData);
197
200
  }
@@ -203,9 +206,9 @@ class FiltersManager implements IFiltersManager {
203
206
  first, make transition object from snapshot,
204
207
  because filter should bw always added with value
205
208
  */
206
- const filtersData: {
207
- FilterName: FilterData;
208
- } = Object.entries(snapshot).reduce(
209
+ const filtersData: Record<FilterName, Partial<FilterData>> = Object.entries(
210
+ snapshot as Record<string, unknown>,
211
+ ).reduce(
209
212
  (filtersAcc, [snapshotKey, snapshotValue]) => {
210
213
  const name = filterNameFromSnapshotKey(snapshotKey);
211
214
  const valueProp = filterValuePropFromSnapshotKey(snapshotKey);
@@ -215,19 +218,23 @@ class FiltersManager implements IFiltersManager {
215
218
  return filtersAcc;
216
219
  }
217
220
 
218
- if (filtersAcc[name]) {
219
- filtersAcc[name][valueProp] = snapshotValue;
221
+ if (valueProp === 'label') {
222
+ const label = snapshotValue as FilterLabel;
223
+ filtersAcc[name] = {
224
+ ...filtersAcc[name],
225
+ label,
226
+ };
220
227
  } else {
228
+ const value = snapshotValue as FilterValue;
221
229
  filtersAcc[name] = {
222
- [valueProp]: snapshotValue,
230
+ ...filtersAcc[name],
231
+ value,
223
232
  };
224
233
  }
225
234
 
226
235
  return filtersAcc;
227
236
  },
228
- {} as {
229
- FilterName: FilterData;
230
- },
237
+ {} as Record<FilterName, Partial<FilterData>>,
231
238
  );
232
239
 
233
240
  Object.entries(filtersData).forEach(([name, filterData]) => {
@@ -238,6 +245,7 @@ class FiltersManager implements IFiltersManager {
238
245
  });
239
246
  } else {
240
247
  this.addFilter({
248
+ value: null,
241
249
  ...filterData,
242
250
  name,
243
251
  });
@@ -25,7 +25,7 @@
25
25
  }"
26
26
  >
27
27
  <dynamic-filter-config-form-value-input
28
- v-if="filterName"
28
+ v-if="filterName && selectedFilterConfig"
29
29
  :key="filterName"
30
30
  :model-value="filterValue"
31
31
  :filter-config="selectedFilterConfig"
@@ -131,7 +131,7 @@ const filterConfigOptions = computed(() => {
131
131
  ];
132
132
  }
133
133
 
134
- return props.filterConfigs;
134
+ return props.filterConfigs ?? [];
135
135
  });
136
136
 
137
137
  const selectedFilterConfig = computed(() => {
@@ -144,11 +144,11 @@ const selectedFilterConfig = computed(() => {
144
144
  });
145
145
  });
146
146
 
147
- const onValueChange = (v) => {
147
+ const onValueChange = (v: unknown) => {
148
148
  filterValue.value = v;
149
149
  };
150
150
 
151
- const onValueInvalidChange = (v) => {
151
+ const onValueInvalidChange = (v: boolean) => {
152
152
  invalid.value = v;
153
153
  };
154
154
 
@@ -156,8 +156,8 @@ const valueInputLabelText = computed(() => {
156
156
  return t('webitelUI.filters.filterValue');
157
157
  });
158
158
 
159
- const onLabelValueUpdate = (val: string) => {
160
- filterLabel.value = val;
159
+ const onLabelValueUpdate = (val?: string) => {
160
+ filterLabel.value = val ?? '';
161
161
  };
162
162
 
163
163
  const onFilterNameUpdate = (val: string) => {
@@ -174,13 +174,14 @@ const submit = () => {
174
174
  });
175
175
  };
176
176
 
177
- if (props.filter) {
177
+ const editedFilter = props.filter;
178
+ if (editedFilter) {
178
179
  watch(
179
- props.filter,
180
+ editedFilter,
180
181
  () => {
181
- filterName.value = props.filter.name;
182
- filterValue.value = deepcopy(props.filter.value);
183
- filterLabel.value = props.filter.label;
182
+ filterName.value = editedFilter.name;
183
+ filterValue.value = deepcopy(editedFilter.value);
184
+ filterLabel.value = editedFilter.label ?? '';
184
185
  },
185
186
  {
186
187
  immediate: true,
@@ -33,7 +33,9 @@ interface Props {
33
33
 
34
34
  const props = defineProps<Props>();
35
35
 
36
- const popover = ref(null);
36
+ const popover = ref<{
37
+ hide: () => void;
38
+ } | null>(null);
37
39
 
38
40
  const hidePopover = () => {
39
41
  popover.value?.hide();
@@ -16,6 +16,7 @@
16
16
  import { isEmpty } from '@webitel/ui-sdk/scripts';
17
17
  import { computed } from 'vue';
18
18
 
19
+ import type { FilterValue } from '../../../classes/Filter';
19
20
  import { StaticFilterEmits, StaticFilterProps } from '../../types/Filter.types';
20
21
 
21
22
  /* Author @Lera24
@@ -29,8 +30,9 @@ const emit = defineEmits<StaticFilterEmits>();
29
30
 
30
31
  const filterValue = computed(() => props.filter?.value);
31
32
 
32
- const onValueChange = (value) => {
33
+ const onValueChange = (value: FilterValue) => {
33
34
  if (isEmpty(value) && typeof value !== 'boolean') {
35
+ if (!props.filter) return;
34
36
  return emit('delete:filter', props.filter);
35
37
  }
36
38
 
@@ -55,7 +55,14 @@ const emit = defineEmits<{
55
55
  ];
56
56
  }>();
57
57
 
58
- const submit = (payload: FilterInitParams, { hide }) => {
58
+ const submit = (
59
+ payload: FilterInitParams,
60
+ {
61
+ hide,
62
+ }: {
63
+ hide: () => void;
64
+ },
65
+ ) => {
59
66
  emit('add:filter', payload);
60
67
  hide();
61
68
  };
@@ -89,7 +89,10 @@ const emit = defineEmits<DynamicFilterEmits>();
89
89
 
90
90
  const localValue = ref();
91
91
 
92
- const showChipPopover = (event, showPopoverCb: (event) => void) => {
92
+ const showChipPopover = (
93
+ event: Event,
94
+ showPopoverCb: (event: Event) => void,
95
+ ) => {
93
96
  if (!localValue.value) {
94
97
  fillLocalValue();
95
98
  }
@@ -152,7 +155,14 @@ const isRenderPreview = computed(
152
155
  () => localValue.value === false || localValue.value,
153
156
  );
154
157
 
155
- const submit = (filter: FilterInitParams, { hide }) => {
158
+ const submit = (
159
+ filter: FilterInitParams,
160
+ {
161
+ hide,
162
+ }: {
163
+ hide: () => void;
164
+ },
165
+ ) => {
156
166
  emit('update:filter', filter);
157
167
  hide();
158
168
  };
@@ -52,7 +52,7 @@ const { t } = useI18n();
52
52
 
53
53
  const localSearchValue = ref('');
54
54
 
55
- const hasFilter = (filterName = searchMode.value) => {
55
+ const hasFilter = (filterName = searchMode.value ?? '') => {
56
56
  return props.filtersManager.filters.has(filterName);
57
57
  };
58
58
  const addFilter = (filterInitParams: FilterInitParams) => {
@@ -80,7 +80,7 @@ const hasSearchModes = computed(() => {
80
80
 
81
81
  const currentSearchName = computed(() => {
82
82
  if (hasSearchModes.value) {
83
- return searchMode.value;
83
+ return searchMode.value ?? defaultSearchName;
84
84
  }
85
85
 
86
86
  return defaultSearchName;
@@ -96,7 +96,7 @@ const inputValue = (value: string) => {
96
96
  });
97
97
  }
98
98
  if (hasSearchModes.value) {
99
- searchMode.value = props.searchModeOptions[0].value;
99
+ searchMode.value = props.searchModeOptions?.[0]?.value;
100
100
  }
101
101
  }
102
102
  };
@@ -117,25 +117,26 @@ const handleSearch = (value = localSearchValue.value) => {
117
117
  }
118
118
  };
119
119
 
120
- const updateSearchMode = (
121
- nextSearchMode: DynamicFilterSearchSearchModeOption,
122
- ) => {
120
+ const updateSearchMode = (nextSearchMode: string | object) => {
123
121
  if (hasFilter(currentSearchName.value)) {
124
122
  deleteFilter({
125
123
  name: currentSearchName.value,
126
124
  });
127
125
  }
128
126
  localSearchValue.value = '';
129
- searchMode.value = nextSearchMode.value;
127
+ searchMode.value =
128
+ typeof nextSearchMode === 'string'
129
+ ? nextSearchMode
130
+ : (nextSearchMode as DynamicFilterSearchSearchModeOption).value;
130
131
  };
131
132
 
132
133
  const initialize = () => {
133
134
  if (!hasSearchModes.value) return;
134
135
 
135
136
  if (!searchMode.value) {
136
- searchMode.value = props.searchModeOptions[0].value;
137
+ searchMode.value = props.searchModeOptions?.[0]?.value;
137
138
  }
138
- restoreLocalSearchValue(searchMode.value);
139
+ restoreLocalSearchValue(searchMode.value ?? defaultSearchName);
139
140
  };
140
141
  /**
141
142
  * @description
@@ -10,7 +10,7 @@
10
10
  :filter-config="filterConfig"
11
11
  @add:filter="emit('filter:add', $event)"
12
12
  @update:filter="emit('filter:update', $event)"
13
- @delete:filter="emit('filter:delete', filter)"
13
+ @delete:filter="filter && emit('filter:delete', filter)"
14
14
  />
15
15
  </div>
16
16
 
@@ -36,8 +36,9 @@
36
36
  <template #actions>
37
37
  <template v-if="enablePresets">
38
38
  <apply-preset-action
39
+ v-if="presetStore"
39
40
  :filter-configs="filterConfigs"
40
- :namespace="props.presetNamespace"
41
+ :namespace="props.presetNamespace ?? ''"
41
42
  :presets-store="presetStore"
42
43
  @apply="emit('preset:apply', $event)"
43
44
  />
@@ -46,7 +47,7 @@
46
47
  :filter-configs="filterConfigs"
47
48
  :filters-included="filtersIncluded"
48
49
  :filters-manager="props.filtersManager"
49
- :namespace="props.presetNamespace"
50
+ :namespace="props.presetNamespace ?? ''"
50
51
  />
51
52
  </template>
52
53
 
@@ -27,7 +27,10 @@ export interface FilterProps {
27
27
  filterConfig: AnyFilterConfig;
28
28
  }
29
29
 
30
- export interface StaticFilterProps extends FilterProps {}
30
+ /** the static view lists every config, so the filter is absent until applied */
31
+ export interface StaticFilterProps extends Omit<FilterProps, 'filter'> {
32
+ filter?: IFilter;
33
+ }
31
34
 
32
35
  export interface DynamicFilterProps extends FilterProps {
33
36
  readonly?: boolean;
@@ -32,10 +32,11 @@ export type FilterConfigToolkit = {
32
32
  filter: IFilter;
33
33
  }>
34
34
  >;
35
+ /** every config is listed, so `filter` is absent until a value is applied */
35
36
  staticViewFilterToFilterConfigMappings: ComputedRef<
36
37
  Array<{
37
38
  filterConfig: BaseFilterConfig;
38
- filter: IFilter;
39
+ filter?: IFilter;
39
40
  }>
40
41
  >;
41
42
  };
@@ -11,7 +11,7 @@ import {
11
11
  } from './classes/FiltersManager';
12
12
 
13
13
  export const tableFiltersStoreBody = (
14
- namespace,
14
+ namespace: string,
15
15
  config?: {
16
16
  filtersManagerConfig?: FiltersManagerConfig;
17
17
  },
@@ -31,8 +31,11 @@ export type FilterConfigSearchMethodParams = [
31
31
  /**
32
32
  * @description
33
33
  * any request-related data
34
+ *
35
+ * `any`, not `unknown`, so each filter narrows it in its own `searchRecords`
34
36
  */
35
- unknown,
37
+ // biome-ignore lint/suspicious/noExplicitAny: see above
38
+ any,
36
39
  /**
37
40
  * @description
38
41
  * filter-related data