@webitel/ui-sdk 25.8.58 → 25.8.61
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/dist/img/sprite/index.js +1 -1
- package/dist/ui-sdk.js +4037 -4004
- package/dist/ui-sdk.umd.cjs +117 -117
- package/package.json +1 -1
- package/src/components/wt-tree-line/wt-tree-line.vue +78 -5
- package/src/modules/Userinfo/v2/enums/ScopeClass/ScopeClass.ts +1 -0
- package/src/modules/Userinfo/v2/mappings/mappings.ts +1 -0
- package/src/modules/Userinfo/v2/scripts/utils.ts +1 -1
- package/types/components/wt-tree-line/wt-tree-line.vue.d.ts +3 -2
- package/types/modules/Userinfo/v2/enums/ScopeClass/ScopeClass.d.ts +1 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@webitel/ui-sdk",
|
|
3
|
-
"version": "25.8.
|
|
3
|
+
"version": "25.8.61",
|
|
4
4
|
"private": false,
|
|
5
5
|
"scripts": {
|
|
6
6
|
"make-all": "npm version patch --git-tag-version false && npm run build && (npm run build:types || true) && (npm run lint:fix || true) && npm run publish-lib",
|
|
@@ -48,6 +48,7 @@
|
|
|
48
48
|
:last-child="index === data[childrenProp].length - 1"
|
|
49
49
|
:multiple="multiple"
|
|
50
50
|
:allow-parent="allowParent"
|
|
51
|
+
:root-data="rootData || data"
|
|
51
52
|
@open-parent="onOpenParent"
|
|
52
53
|
@update:model-value="emit('update:modelValue', $event)"
|
|
53
54
|
/>
|
|
@@ -64,8 +65,8 @@ import type { WtTreeNestedIcons } from './types/wt-tree-nested-icons.ts';
|
|
|
64
65
|
|
|
65
66
|
const props = withDefaults(
|
|
66
67
|
defineProps<{
|
|
67
|
-
modelValue: null |
|
|
68
|
-
data:
|
|
68
|
+
modelValue: null | unknown | unknown[];
|
|
69
|
+
data: unknown;
|
|
69
70
|
itemLabel?: string | undefined;
|
|
70
71
|
itemData?: string | undefined;
|
|
71
72
|
childrenProp?: string;
|
|
@@ -80,6 +81,7 @@ const props = withDefaults(
|
|
|
80
81
|
* 'It's a key in data object, which contains field what display searched elements. By this field, table will be opened to elements with this field value. '
|
|
81
82
|
*/
|
|
82
83
|
searchedProp?: string;
|
|
84
|
+
rootData?: unknown;
|
|
83
85
|
}>(),
|
|
84
86
|
{
|
|
85
87
|
nestedLevel: 0,
|
|
@@ -118,6 +120,10 @@ const displayIcons = computed(() => {
|
|
|
118
120
|
});
|
|
119
121
|
|
|
120
122
|
const isMultipleItemsSelected = () => {
|
|
123
|
+
if (!Array.isArray(props.modelValue)) {
|
|
124
|
+
return false;
|
|
125
|
+
}
|
|
126
|
+
|
|
121
127
|
if (props.itemData) {
|
|
122
128
|
return props.modelValue.includes(props.data[props.itemData]);
|
|
123
129
|
}
|
|
@@ -147,6 +153,69 @@ const displayActiveState = computed(() => {
|
|
|
147
153
|
});
|
|
148
154
|
|
|
149
155
|
|
|
156
|
+
const toggleSelectionWithChildren = (node: unknown, select: boolean, result: unknown[]) => {
|
|
157
|
+
const value = props.itemData ? node[props.itemData] : node;
|
|
158
|
+
|
|
159
|
+
if (select) {
|
|
160
|
+
if (!result.some((item) => deepEqual(item, value))) {
|
|
161
|
+
result.push(value);
|
|
162
|
+
}
|
|
163
|
+
} else {
|
|
164
|
+
const index = result.findIndex((item) => deepEqual(item, value));
|
|
165
|
+
if (index !== -1) {
|
|
166
|
+
result.splice(index, 1);
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
if (node && Array.isArray(node[props.childrenProp]) && node[props.childrenProp].length) {
|
|
171
|
+
for (const child of node[props.childrenProp]) {
|
|
172
|
+
toggleSelectionWithChildren(child, select, result);
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
};
|
|
176
|
+
|
|
177
|
+
const deselectParents = (node: unknown, root: unknown, result: unknown[]) => {
|
|
178
|
+
const findAndDeselect = (current: unknown, parent: unknown | null): boolean => {
|
|
179
|
+
if (current === node) {
|
|
180
|
+
if (parent) {
|
|
181
|
+
const parentValue = props.itemData ? parent[props.itemData] : parent;
|
|
182
|
+
const index = result.findIndex((item) => deepEqual(item, parentValue));
|
|
183
|
+
if (index !== -1) {
|
|
184
|
+
result.splice(index, 1);
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
return true;
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
if (current && Array.isArray(current[props.childrenProp]) && current[props.childrenProp].length) {
|
|
191
|
+
for (const child of current[props.childrenProp]) {
|
|
192
|
+
if (findAndDeselect(child, current)) {
|
|
193
|
+
return true;
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
return false;
|
|
199
|
+
};
|
|
200
|
+
|
|
201
|
+
findAndDeselect(root, null);
|
|
202
|
+
};
|
|
203
|
+
|
|
204
|
+
const setMultipleModelValueWithTree = () => {
|
|
205
|
+
const isAlreadySelected = isSelected.value;
|
|
206
|
+
const newArray = [...props.modelValue];
|
|
207
|
+
|
|
208
|
+
// Toggle current node + children
|
|
209
|
+
toggleSelectionWithChildren(props.data, !isAlreadySelected, newArray);
|
|
210
|
+
|
|
211
|
+
if (isAlreadySelected) {
|
|
212
|
+
// If deselecting, also deselect parents
|
|
213
|
+
deselectParents(props.data, props.rootData, newArray);
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
emit('update:modelValue', newArray);
|
|
217
|
+
};
|
|
218
|
+
|
|
150
219
|
const setMultipleModelValue = () => {
|
|
151
220
|
const value = props.itemData ? props.data[props.itemData] : props.data;
|
|
152
221
|
let existingIndex;
|
|
@@ -172,8 +241,12 @@ const setMultipleModelValue = () => {
|
|
|
172
241
|
};
|
|
173
242
|
|
|
174
243
|
const selectElement = () => {
|
|
175
|
-
if (props.multiple && !props.data
|
|
176
|
-
|
|
244
|
+
if (props.multiple && !props.data?.service) {
|
|
245
|
+
if (props.data[props.childrenProp]?.length) {
|
|
246
|
+
setMultipleModelValueWithTree();
|
|
247
|
+
} else {
|
|
248
|
+
setMultipleModelValue();
|
|
249
|
+
}
|
|
177
250
|
return;
|
|
178
251
|
}
|
|
179
252
|
|
|
@@ -207,7 +280,7 @@ const onOpenParent = () => {
|
|
|
207
280
|
openParent();
|
|
208
281
|
};
|
|
209
282
|
|
|
210
|
-
const hasSearchedElement = (data: Record<string,
|
|
283
|
+
const hasSearchedElement = (data: Record<string, unknown>, nestedLevel = 0) => {
|
|
211
284
|
// Check if the object itself has searched
|
|
212
285
|
if (data[props.searchedProp] && nestedLevel) {
|
|
213
286
|
return true;
|
|
@@ -67,6 +67,7 @@ export const mapScopeClassToWtObjects: Record<ScopeClass, WtObject[]> = {
|
|
|
67
67
|
[ScopeClass.CaseComments]: [WtObject.CaseComment],
|
|
68
68
|
[ScopeClass.AuditForm]: [WtObject.AuditForm],
|
|
69
69
|
[ScopeClass.AuditRating]: [WtObject.AuditRating],
|
|
70
|
+
[ScopeClass.Custom]: [WtObject.CustomLookup],
|
|
70
71
|
};
|
|
71
72
|
|
|
72
73
|
export const mapScopeClassAccessTokenToCrudAction = {
|
|
@@ -125,6 +125,6 @@ export const getWtAppByUiSection = (section: UiSection): WtApplication => {
|
|
|
125
125
|
}
|
|
126
126
|
|
|
127
127
|
// then => custom lookup
|
|
128
|
-
console.info(`Havent found app for section: ${section}, fallback to crm`);
|
|
128
|
+
// console.info(`Havent found app for section: ${section}, fallback to crm`);
|
|
129
129
|
return WtApplication.Crm;
|
|
130
130
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { WtTreeNestedIcons } from './types/wt-tree-nested-icons.ts';
|
|
2
2
|
type __VLS_Props = {
|
|
3
|
-
modelValue: null |
|
|
4
|
-
data:
|
|
3
|
+
modelValue: null | unknown | unknown[];
|
|
4
|
+
data: unknown;
|
|
5
5
|
itemLabel?: string | undefined;
|
|
6
6
|
itemData?: string | undefined;
|
|
7
7
|
childrenProp?: string;
|
|
@@ -16,6 +16,7 @@ type __VLS_Props = {
|
|
|
16
16
|
* 'It's a key in data object, which contains field what display searched elements. By this field, table will be opened to elements with this field value. '
|
|
17
17
|
*/
|
|
18
18
|
searchedProp?: string;
|
|
19
|
+
rootData?: unknown;
|
|
19
20
|
};
|
|
20
21
|
declare const _default: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
|
|
21
22
|
"update:modelValue": (value: any) => any;
|