@webitel/ui-datalist 1.1.79 → 1.1.81
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.
- package/Readme.md +2 -0
- package/package.json +1 -1
- package/src/modules/card/composables/useCardAnyFieldEditedWatcher.ts +18 -0
- package/src/modules/card/index.ts +1 -0
- package/src/modules/filters/components/table-filters-panel.vue +2 -2
- package/src/modules/filters/composables/useFilterConfigsToolkit.ts +3 -3
- package/src/modules/filters/modules/filterConfig/components/_custom/filterConfig.ts +5 -5
- package/types/.tsbuildinfo +1 -1
- package/types/modules/card/composables/useCardAnyFieldEditedWatcher.d.ts +18 -0
- package/types/modules/card/index.d.ts +1 -0
- package/types/modules/filters/components/table-filters-panel.vue.d.ts +2 -2
- package/types/modules/filters/composables/useFilterConfigsToolkit.d.ts +2 -2
- package/types/modules/filters/modules/filterConfig/components/_custom/filterConfig.d.ts +5 -5
package/Readme.md
CHANGED
|
@@ -79,6 +79,8 @@ aka "page"/"entity page"/"item card"/"item form" - form card of a single item fr
|
|
|
79
79
|
import {
|
|
80
80
|
createCardStore, // pinia store factory
|
|
81
81
|
useCardComponent, // all-in-one composable for card component wrapper (opened-*entity*.vue)
|
|
82
|
+
useNestedCardComponent, // popup / nested-route card with its own store
|
|
83
|
+
useCardAnyFieldEditedWatcher, // dirty flag for a local draft ref (no card store)
|
|
82
84
|
} from '@webitel/ui-datalist/card';
|
|
83
85
|
```
|
|
84
86
|
|
package/package.json
CHANGED
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
import { type Ref, ref, watch } from 'vue';
|
|
2
2
|
|
|
3
|
+
/**
|
|
4
|
+
* Dirty flag for a local draft `ref`.
|
|
5
|
+
*
|
|
6
|
+
* Replacing `value` with a new object resets dirty. Mutating fields
|
|
7
|
+
* in place sets `isAnyFieldEdited` to `true`.
|
|
8
|
+
*
|
|
9
|
+
* Used by `useCardComponent`. Also usable on nested popups that keep
|
|
10
|
+
* a local draft instead of a card store.
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* ```ts
|
|
14
|
+
* const draft = ref({ name: '' });
|
|
15
|
+
* const { isAnyFieldEdited } = useCardAnyFieldEditedWatcher({ value: draft });
|
|
16
|
+
*
|
|
17
|
+
* draft.value = { name: 'Holiday' }; // reset
|
|
18
|
+
* draft.value.name = 'NY'; // dirty
|
|
19
|
+
* ```
|
|
20
|
+
*/
|
|
3
21
|
export const useCardAnyFieldEditedWatcher = ({
|
|
4
22
|
value,
|
|
5
23
|
}: {
|
|
@@ -70,10 +70,10 @@
|
|
|
70
70
|
</template>
|
|
71
71
|
|
|
72
72
|
<script lang="ts" setup>
|
|
73
|
+
import type { DataField } from '@webitel/api-services/gen/models';
|
|
73
74
|
import { WtIconAction } from '@webitel/ui-sdk/components';
|
|
74
75
|
import { StoreGeneric } from 'pinia';
|
|
75
76
|
import { computed } from 'vue';
|
|
76
|
-
import { WebitelProtoDataField } from 'webitel-sdk';
|
|
77
77
|
|
|
78
78
|
import { ApplyPresetAction, SavePresetAction } from '../../filter-presets';
|
|
79
79
|
import { FilterInitParams, IFilter } from '../classes/Filter';
|
|
@@ -109,7 +109,7 @@ type Props = {
|
|
|
109
109
|
* Props.filterOptions, because this functionality can be expanded to many
|
|
110
110
|
* filter panels
|
|
111
111
|
*/
|
|
112
|
-
filterableExtensionFields?:
|
|
112
|
+
filterableExtensionFields?: DataField[];
|
|
113
113
|
/**
|
|
114
114
|
* @description
|
|
115
115
|
* QueryPreset "section" field
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import type { DataField } from '@webitel/api-services/gen/models';
|
|
1
2
|
import { type ComputedRef, computed } from 'vue';
|
|
2
3
|
import { useI18n } from 'vue-i18n';
|
|
3
|
-
import type { WebitelProtoDataField } from 'webitel-sdk';
|
|
4
4
|
|
|
5
5
|
import type { FilterName, IFilter } from '../classes/Filter';
|
|
6
6
|
import type { IFiltersManager } from '../classes/FiltersManager';
|
|
@@ -44,7 +44,7 @@ export type FilterConfigToolkit = {
|
|
|
44
44
|
export type FilterConfigToolkitParams = {
|
|
45
45
|
filterOptions: (FilterOption | BaseFilterConfig)[];
|
|
46
46
|
filtersManager: IFiltersManager;
|
|
47
|
-
filterableExtensionFields?:
|
|
47
|
+
filterableExtensionFields?: DataField[];
|
|
48
48
|
staticMode?: boolean;
|
|
49
49
|
};
|
|
50
50
|
|
|
@@ -91,7 +91,7 @@ export const useFilterConfigsToolkit = ({
|
|
|
91
91
|
* add filterConfigs for extension fields
|
|
92
92
|
*/
|
|
93
93
|
.concat(
|
|
94
|
-
filterableExtensionFields.map((field:
|
|
94
|
+
filterableExtensionFields.map((field: DataField) => {
|
|
95
95
|
return createTypeExtensionFilterConfig(
|
|
96
96
|
{
|
|
97
97
|
name: field.id,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
+
import type { DataField } from '@webitel/api-services/gen/models';
|
|
1
2
|
import { sysTypes } from '@webitel/ui-sdk/api/clients/index';
|
|
2
3
|
import { WtTypeExtensionFieldKind } from '@webitel/ui-sdk/enums';
|
|
3
4
|
import { get } from 'lodash';
|
|
4
|
-
import type { WebitelProtoDataField } from 'webitel-sdk';
|
|
5
5
|
import type {
|
|
6
6
|
BaseFilterConfig,
|
|
7
7
|
FilterConfigBaseParams,
|
|
@@ -13,7 +13,7 @@ import TypeExtensionFilterValueField from './type-extension-filter-value-field.v
|
|
|
13
13
|
import TypeExtensionFilterValuePreview from './type-extension-filter-value-preview.vue';
|
|
14
14
|
|
|
15
15
|
export interface ITypeExtensionFilterConfig extends BaseFilterConfig {
|
|
16
|
-
readonly field:
|
|
16
|
+
readonly field: DataField;
|
|
17
17
|
searchRecords?: IWtSysTypeFilterConfig['searchRecords'];
|
|
18
18
|
}
|
|
19
19
|
|
|
@@ -21,14 +21,14 @@ class TypeExtensionFilterConfig
|
|
|
21
21
|
extends FilterConfig
|
|
22
22
|
implements ITypeExtensionFilterConfig
|
|
23
23
|
{
|
|
24
|
-
readonly field:
|
|
24
|
+
readonly field: DataField;
|
|
25
25
|
|
|
26
26
|
constructor(
|
|
27
27
|
{ name }: FilterConfigBaseParams,
|
|
28
28
|
{
|
|
29
29
|
field,
|
|
30
30
|
}: {
|
|
31
|
-
field:
|
|
31
|
+
field: DataField;
|
|
32
32
|
},
|
|
33
33
|
) {
|
|
34
34
|
super({
|
|
@@ -99,7 +99,7 @@ export const createTypeExtensionFilterConfig = (
|
|
|
99
99
|
{
|
|
100
100
|
field,
|
|
101
101
|
}: {
|
|
102
|
-
field:
|
|
102
|
+
field: DataField;
|
|
103
103
|
},
|
|
104
104
|
) => {
|
|
105
105
|
switch (field.kind) {
|