@avakhula/ui 0.0.33 → 0.0.34-4.2
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/.eslintrc.cjs +17 -10
- package/.storybook/preview-head.html +1 -0
- package/dist/index.js +9042 -7752
- package/dist/index.umd.cjs +87 -88
- package/dist/style.css +1 -1
- package/package.json +15 -15
- package/src/App.vue +138 -25
- package/src/assets/scss/mixins/dropdown-list-item.scss +8 -1
- package/src/assets/scss/mixins/tooltip-position.scss +1 -1
- package/src/assets/scss/variables/shadows.json +14 -30
- package/src/assets/scss/variables/shadows.scss +10 -15
- package/src/components/Accordion/Accordion.scss +4 -1
- package/src/components/Accordion/Accordion.vue +20 -3
- package/src/components/Accordion/Acordion.spec.js +75 -0
- package/src/components/Alert/Alert.spec.js +69 -0
- package/src/components/Alert/Alert.stories.js +1 -4
- package/src/components/Alert/Alert.vue +22 -3
- package/src/components/Alert/alert.scss +22 -0
- package/src/components/Alert/constants.js +1 -0
- package/src/components/Avatar/Avatar.stories.js +23 -0
- package/src/components/Avatar/Avatar.vue +125 -0
- package/src/components/Avatar/constants.js +4 -0
- package/src/components/Badge/Badge.spec.js +37 -0
- package/src/components/Badge/Badge.vue +1 -1
- package/src/components/Button/Button.spec.js +85 -0
- package/src/components/Button/Button.vue +14 -3
- package/src/components/Button/button.scss +5 -0
- package/src/components/Dropdown/Dropdown.vue +3 -3
- package/src/components/Dropdown/DropdownItem.vue +9 -3
- package/src/components/Form/Checkbox/Checkbox.scss +79 -53
- package/src/components/Form/Checkbox/Checkbox.stories.js +4 -2
- package/src/components/Form/Checkbox/Checkbox.vue +70 -48
- package/src/components/Form/CheckboxGroup/CheckboxGroup.vue +11 -0
- package/src/components/Form/CheckboxGroup/readme.mdx +2 -0
- package/src/components/Form/DatePicker/DatePicker.scss +259 -261
- package/src/components/Form/DatePicker/DatePicker.vue +1 -1
- package/src/components/Form/Input/Input.vue +69 -15
- package/src/components/Form/Input/constants.js +1 -0
- package/src/components/Form/Input/input.scss +33 -6
- package/src/components/Form/Label/Label.stories.js +7 -0
- package/src/components/Form/Label/Label.vue +43 -4
- package/src/components/Form/Label/readme.mdx +1 -0
- package/src/components/Form/PhoneInput/phoneInput.scss +3 -2
- package/src/components/Form/Radio/Radio.vue +31 -38
- package/src/components/Form/Radio/radio.scss +6 -3
- package/src/components/Form/Toggle/Toggle.vue +5 -1
- package/src/components/Form/Toggle/toggle.scss +4 -4
- package/src/components/IconButton/IconButton.scss +7 -0
- package/src/components/IconButton/IconButton.vue +10 -9
- package/src/components/List.vue +1 -1
- package/src/components/Modal/Modal.stories.js +6 -4
- package/src/components/Modal/Modal.vue +56 -11
- package/src/components/Pagination/LimitSelector.vue +3 -5
- package/src/components/Pagination/Pagination.vue +3 -0
- package/src/components/Pagination/pagination.scss +8 -14
- package/src/components/Panel/Panel.stories.js +0 -7
- package/src/components/Panel/Panel.vue +30 -29
- package/src/components/Popover/Popover.vue +43 -17
- package/src/components/Popover/constants.js +1 -1
- package/src/components/Popover/popover.scss +28 -8
- package/src/components/ProgressBar/ProgressBar.vue +14 -1
- package/src/components/ProgressBar/constants.js +1 -0
- package/src/components/ProgressBar/progressBar.scss +7 -0
- package/src/components/Sorting/Sorting.stories.js +12 -2
- package/src/components/Sorting/Sorting.vue +125 -37
- package/src/components/Sorting/sorting.scss +17 -14
- package/src/components/SplitButton/SplitButton.vue +8 -1
- package/src/components/SplitButton/splitButton.scss +3 -0
- package/src/components/StatusIndicator/icons.js +11 -11
- package/src/components/Tabs/Tabs.vue +25 -2
- package/src/components/Tabs/tabs.scss +1 -1
- package/src/components/ToggleTip/constants.js +1 -1
- package/src/components/ToggleTip/toggleTip.scss +2 -2
- package/src/components/Tooltip/Tooltip.vue +120 -4
- package/src/components/TreeSelect/Option.vue +36 -27
- package/src/components/TreeSelect/Select.stories.js +5 -90
- package/src/components/TreeSelect/Select.vue +256 -121
- package/src/components/TreeSelect/scss/option.scss +8 -0
- package/src/components/TreeSelect/scss/select.scss +51 -6
- package/src/directives/tooltip/TooltipController.js +184 -0
- package/src/directives/tooltip/readme.mdx +17 -0
- package/src/directives/tooltip/textOverflowTooltip.js +21 -49
- package/src/directives/tooltip/tooltip.js +57 -45
- package/src/directives/tooltip/tooltip.stories.js +39 -0
- package/src/helpers/removeEvents.js +2 -2
- package/src/index.js +1 -0
- package/src/main.js +1 -0
- package/src/scripts/parseScssVariables.js +23 -7
- package/src/components/Panel/constants.js +0 -4
|
@@ -1,11 +1,24 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<
|
|
2
|
+
<ib-alert class="tree-select-error" v-if="errorMessage">
|
|
3
|
+
{{ errorMessage }}
|
|
4
|
+
</ib-alert>
|
|
5
|
+
|
|
6
|
+
<div
|
|
7
|
+
class="tree-select"
|
|
8
|
+
:class="{
|
|
9
|
+
...classList, 'tree-select-custom-trigger-content': hasTriggerContent
|
|
10
|
+
}"
|
|
11
|
+
>
|
|
3
12
|
<ib-dropdown
|
|
4
|
-
:disabled="isLoading"
|
|
13
|
+
:disabled="isLoading || disable"
|
|
5
14
|
:is-resizable="isResizable"
|
|
6
|
-
:vertical="
|
|
7
|
-
|
|
15
|
+
:vertical="verticalVal"
|
|
16
|
+
:class="{
|
|
17
|
+
disable: disable
|
|
18
|
+
}"
|
|
8
19
|
ref="dropdown"
|
|
20
|
+
@close="onClose"
|
|
21
|
+
@open="onOpen"
|
|
9
22
|
>
|
|
10
23
|
<template v-if="hasTrigger" v-slot:trigger>
|
|
11
24
|
<slot v-bind:selected-count="selectedKeys.length" name="trigger"></slot>
|
|
@@ -16,53 +29,65 @@
|
|
|
16
29
|
role="combobox"
|
|
17
30
|
tabindex="0"
|
|
18
31
|
class="tree-choice"
|
|
32
|
+
ref="combobox"
|
|
19
33
|
@click.prevent
|
|
34
|
+
@blur="onBlur"
|
|
35
|
+
@keyup.down="comboboxKeyupDown"
|
|
36
|
+
@keyup.up="comboboxKeyupDown"
|
|
20
37
|
:aria-label="ariaLabel"
|
|
21
|
-
:aria-
|
|
38
|
+
:aria-activedescendant="focusedOptionId"
|
|
22
39
|
:class="{
|
|
23
40
|
'tree-choice-opened': isOpened,
|
|
24
|
-
'has-clear-button':
|
|
41
|
+
'has-clear-button': showClearButton,
|
|
42
|
+
'tree-choice-error': errorMessage,
|
|
25
43
|
}"
|
|
26
44
|
>
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
v-html="selectStatus || placeholder"
|
|
31
|
-
></span>
|
|
45
|
+
|
|
46
|
+
<template v-if="hasTriggerContent">
|
|
47
|
+
<slot v-bind:selected-count="selectedKeys.length" name="triggerContent"></slot>
|
|
32
48
|
</template>
|
|
49
|
+
|
|
33
50
|
<template v-else>
|
|
34
|
-
<
|
|
35
|
-
|
|
36
|
-
|
|
51
|
+
<template v-if="htmlOptionTitle">
|
|
52
|
+
<span
|
|
53
|
+
:class="{ placeholder: !selectStatus }"
|
|
54
|
+
v-html="selectStatus || placeholder"
|
|
55
|
+
></span>
|
|
56
|
+
</template>
|
|
57
|
+
<template v-else>
|
|
58
|
+
<span :class="{ placeholder: !selectStatus }">
|
|
59
|
+
{{ selectStatus || placeholder }}
|
|
60
|
+
</span>
|
|
61
|
+
</template>
|
|
37
62
|
</template>
|
|
38
|
-
</div>
|
|
39
|
-
<ib-icon-button
|
|
40
|
-
v-if="showClearButton"
|
|
41
|
-
kind="ghost"
|
|
42
|
-
class="button-clear"
|
|
43
|
-
@click.prevent="clearValue"
|
|
44
|
-
:help-text="clearButtonMessage"
|
|
45
|
-
v-show="Object.keys(selected).length"
|
|
46
|
-
>
|
|
47
|
-
<ib-icon name="close-outline"></ib-icon>
|
|
48
|
-
</ib-icon-button>
|
|
49
63
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
64
|
+
<ib-icon-button
|
|
65
|
+
v-if="showClearButton"
|
|
66
|
+
kind="ghost"
|
|
67
|
+
class="button-clear"
|
|
68
|
+
@click.prevent="clearValue"
|
|
69
|
+
@keypress.enter.stop.prevent
|
|
70
|
+
@keydown.enter.stop.prevent
|
|
71
|
+
@keyup.enter.prevent="clearValue"
|
|
72
|
+
:help-text="clearButtonMessage"
|
|
73
|
+
v-show="Object.keys(selected).length"
|
|
74
|
+
>
|
|
75
|
+
<ib-icon name="close-outline"></ib-icon>
|
|
76
|
+
</ib-icon-button>
|
|
77
|
+
|
|
78
|
+
<ib-icon
|
|
79
|
+
:name="isOpened ? 'chevron-up-outline' : 'chevron-down-outline'"
|
|
80
|
+
:classes="'tree-select-caret'"
|
|
81
|
+
/>
|
|
82
|
+
</div>
|
|
83
|
+
|
|
54
84
|
</template>
|
|
55
85
|
|
|
56
86
|
<template v-slot:body>
|
|
57
87
|
<div
|
|
58
88
|
class="tree-drop"
|
|
59
89
|
:class="{ 'not-tree-child': !hasTreeChildren }"
|
|
60
|
-
:style="
|
|
61
|
-
width: 'auto',
|
|
62
|
-
position: 'absolute',
|
|
63
|
-
left: -size.left + 'px',
|
|
64
|
-
right: -size.right + 'px',
|
|
65
|
-
}"
|
|
90
|
+
:style="treeDropPos"
|
|
66
91
|
>
|
|
67
92
|
<div
|
|
68
93
|
v-if="isResizable"
|
|
@@ -98,24 +123,32 @@
|
|
|
98
123
|
<ib-input
|
|
99
124
|
class="tree-search"
|
|
100
125
|
v-if="showSearch"
|
|
126
|
+
ref="search"
|
|
101
127
|
:show-icon="true"
|
|
128
|
+
autocomplete="off"
|
|
102
129
|
:value="filterString"
|
|
130
|
+
:aria-label="
|
|
131
|
+
searchPlaceholderText
|
|
132
|
+
? searchPlaceholderText
|
|
133
|
+
: actualStrings.searchPlaceholder"
|
|
103
134
|
:placeholder="
|
|
104
135
|
searchPlaceholderText
|
|
105
136
|
? searchPlaceholderText
|
|
106
137
|
: actualStrings.searchPlaceholder
|
|
107
138
|
"
|
|
108
139
|
@input="filter($event, actualOptions)"
|
|
140
|
+
@keyup.down="inputKeyupDown"
|
|
109
141
|
></ib-input>
|
|
110
142
|
|
|
111
143
|
<list
|
|
112
144
|
ref="list"
|
|
145
|
+
role="listbox"
|
|
113
146
|
:class="{ 'tree-select-list': true, 'has-hierarchy': hasHierarchy }"
|
|
114
147
|
>
|
|
115
148
|
<div
|
|
116
149
|
v-if="
|
|
117
150
|
!requiredDependencyNotFilled &&
|
|
118
|
-
!
|
|
151
|
+
!visibleOptionsCount &&
|
|
119
152
|
hasEmptyMessage
|
|
120
153
|
"
|
|
121
154
|
class="tree-select-empty"
|
|
@@ -123,7 +156,7 @@
|
|
|
123
156
|
<slot name="emptyMessage"></slot>
|
|
124
157
|
</div>
|
|
125
158
|
<div
|
|
126
|
-
v-else-if="!requiredDependencyNotFilled && !
|
|
159
|
+
v-else-if="!requiredDependencyNotFilled && !visibleOptionsCount"
|
|
127
160
|
class="tree-select-default-empty tree-select-empty"
|
|
128
161
|
>
|
|
129
162
|
{{ actualStrings.emptyTitle }}
|
|
@@ -157,7 +190,7 @@
|
|
|
157
190
|
v-if="
|
|
158
191
|
allOptions &&
|
|
159
192
|
isMultiple &&
|
|
160
|
-
|
|
193
|
+
visibleOptionsCount &&
|
|
161
194
|
!requiredDependencyNotFilled
|
|
162
195
|
"
|
|
163
196
|
>
|
|
@@ -178,14 +211,18 @@
|
|
|
178
211
|
:parent-auto-check="false"
|
|
179
212
|
:is-multiple="isMultiple"
|
|
180
213
|
:is-bookmarkable="false"
|
|
181
|
-
@check="manageAll"
|
|
182
214
|
:uid="uid"
|
|
183
215
|
:only-end-nodes="onlyEndNodes"
|
|
184
216
|
:show-input="showInputs"
|
|
217
|
+
@check="manageAll"
|
|
218
|
+
@on-focus="(id) => focusedOptionId = id"
|
|
185
219
|
></select-option>
|
|
186
220
|
</template>
|
|
187
221
|
|
|
188
|
-
<template
|
|
222
|
+
<template
|
|
223
|
+
v-for="option in actualOptions"
|
|
224
|
+
:key="name + option.value"
|
|
225
|
+
>
|
|
189
226
|
<slot
|
|
190
227
|
:option="option"
|
|
191
228
|
:name="actualName"
|
|
@@ -196,7 +233,7 @@
|
|
|
196
233
|
:html-title="htmlOptionTitle"
|
|
197
234
|
:show-input="showInputs"
|
|
198
235
|
>
|
|
199
|
-
|
|
236
|
+
<select-option
|
|
200
237
|
v-show="option.visible"
|
|
201
238
|
:option="option"
|
|
202
239
|
:is-toggle="isToggle"
|
|
@@ -204,12 +241,13 @@
|
|
|
204
241
|
:parent-auto-check="parentAutoCheck"
|
|
205
242
|
:is-multiple="isMultiple"
|
|
206
243
|
:is-bookmarkable="isBookmarkable"
|
|
207
|
-
@check="registerCheck"
|
|
208
|
-
@toggle-bookmark="toggleBookmark"
|
|
209
244
|
:uid="uid"
|
|
210
245
|
:only-end-nodes="onlyEndNodes"
|
|
211
246
|
:html-title="htmlOptionTitle"
|
|
212
247
|
:show-input="showInputs"
|
|
248
|
+
@check="registerCheck"
|
|
249
|
+
@toggle-bookmark="toggleBookmark"
|
|
250
|
+
@on-focus="(id) => focusedOptionId = id"
|
|
213
251
|
></select-option>
|
|
214
252
|
</slot>
|
|
215
253
|
</template>
|
|
@@ -222,6 +260,7 @@
|
|
|
222
260
|
</template>
|
|
223
261
|
|
|
224
262
|
<script>
|
|
263
|
+
// <!-- TODO: use constants for vertical position -->
|
|
225
264
|
import IbInput from "../Form/Input/Input.vue";
|
|
226
265
|
import Option from "./Option.vue";
|
|
227
266
|
import Mark from "mark.js/dist/mark.es6.min";
|
|
@@ -229,11 +268,18 @@ import generateUID from "../../helpers/generateUID";
|
|
|
229
268
|
import IbDropdown from "../Dropdown/Dropdown.vue";
|
|
230
269
|
import IbIcon from "../Icon.vue";
|
|
231
270
|
import IbIconButton from "../IconButton/IconButton.vue";
|
|
271
|
+
import IbAlert from "../Alert/Alert.vue";
|
|
232
272
|
import List from "../List.vue";
|
|
233
273
|
|
|
274
|
+
function copy(data) {
|
|
275
|
+
return JSON.parse(JSON.stringify(data));
|
|
276
|
+
}
|
|
277
|
+
|
|
234
278
|
export default {
|
|
235
279
|
name: "IbTreeSelect",
|
|
280
|
+
inject: ["LANG_COMPONENTS"],
|
|
236
281
|
props: {
|
|
282
|
+
classList: [String, Array],
|
|
237
283
|
placeholder: {
|
|
238
284
|
type: String,
|
|
239
285
|
default: "",
|
|
@@ -254,6 +300,9 @@ export default {
|
|
|
254
300
|
type: Boolean,
|
|
255
301
|
default: false,
|
|
256
302
|
},
|
|
303
|
+
menuSize: {
|
|
304
|
+
type: [String, Number],
|
|
305
|
+
},
|
|
257
306
|
initialSize: {
|
|
258
307
|
left: 0,
|
|
259
308
|
right: 0,
|
|
@@ -355,6 +404,10 @@ export default {
|
|
|
355
404
|
type: String,
|
|
356
405
|
default: "",
|
|
357
406
|
},
|
|
407
|
+
errorMessage: {
|
|
408
|
+
type: String,
|
|
409
|
+
default: "",
|
|
410
|
+
},
|
|
358
411
|
allOptions: {
|
|
359
412
|
type: Boolean,
|
|
360
413
|
default: true,
|
|
@@ -371,15 +424,35 @@ export default {
|
|
|
371
424
|
type: Boolean,
|
|
372
425
|
default: false,
|
|
373
426
|
},
|
|
427
|
+
disable: {
|
|
428
|
+
type: Boolean,
|
|
429
|
+
default: false
|
|
430
|
+
}
|
|
374
431
|
},
|
|
432
|
+
emits: [
|
|
433
|
+
"close",
|
|
434
|
+
"input",
|
|
435
|
+
"blur",
|
|
436
|
+
"search",
|
|
437
|
+
"resize",
|
|
438
|
+
"submit",
|
|
439
|
+
"clearValue",
|
|
440
|
+
"update:modelValue",
|
|
441
|
+
],
|
|
375
442
|
watch: {
|
|
376
443
|
value(value) {
|
|
377
444
|
this.val = value;
|
|
378
|
-
this.
|
|
445
|
+
if (!Array.isArray(value) || value.join(',') !== Object.keys(this.selected).join(',')) {
|
|
446
|
+
this.setPreparedValues(this.actualOptions, false);
|
|
447
|
+
}
|
|
379
448
|
},
|
|
380
|
-
modelValue
|
|
381
|
-
|
|
382
|
-
|
|
449
|
+
modelValue: {
|
|
450
|
+
handler(value) {
|
|
451
|
+
this.val = value;
|
|
452
|
+
this.actualOptions = [];
|
|
453
|
+
this.setPreparedValues();
|
|
454
|
+
},
|
|
455
|
+
deep: true,
|
|
383
456
|
},
|
|
384
457
|
val(value) {
|
|
385
458
|
if (
|
|
@@ -395,15 +468,21 @@ export default {
|
|
|
395
468
|
});
|
|
396
469
|
}
|
|
397
470
|
},
|
|
398
|
-
options
|
|
471
|
+
options: {
|
|
472
|
+
handler(newOptions) {
|
|
473
|
+
this.initialOptions = copy(newOptions);
|
|
474
|
+
},
|
|
475
|
+
deep: true,
|
|
476
|
+
},
|
|
477
|
+
initialOptions(newOptions) {
|
|
399
478
|
let isOptionsEqual = true;
|
|
400
479
|
|
|
401
|
-
if (typeof
|
|
480
|
+
if (typeof newOptions === "function") {
|
|
402
481
|
isOptionsEqual = false;
|
|
403
482
|
} else {
|
|
404
483
|
const result = [];
|
|
405
484
|
|
|
406
|
-
const options =
|
|
485
|
+
const options = newOptions;
|
|
407
486
|
Array.prototype.forEach.call(options, (option) => {
|
|
408
487
|
if (option.id !== undefined) result.push(option.id);
|
|
409
488
|
});
|
|
@@ -449,11 +528,7 @@ export default {
|
|
|
449
528
|
this.defaultFilter = (options) => {
|
|
450
529
|
this.marker.unmark();
|
|
451
530
|
const filterString = this.filterString.toLowerCase().trim();
|
|
452
|
-
this.
|
|
453
|
-
this,
|
|
454
|
-
options,
|
|
455
|
-
filterString
|
|
456
|
-
);
|
|
531
|
+
this.filterFunc.call(this, options, filterString);
|
|
457
532
|
|
|
458
533
|
if (filterString) {
|
|
459
534
|
this.marker.mark(filterString);
|
|
@@ -461,6 +536,7 @@ export default {
|
|
|
461
536
|
};
|
|
462
537
|
|
|
463
538
|
return {
|
|
539
|
+
initialOptions: copy(this.options),
|
|
464
540
|
val: this.modelValue ? this.modelValue : this.value,
|
|
465
541
|
size: {
|
|
466
542
|
left: (this.initialSize && this.initialSize.left) || 0,
|
|
@@ -475,51 +551,48 @@ export default {
|
|
|
475
551
|
actualOptions: [],
|
|
476
552
|
actualBookmarkedOptions: {},
|
|
477
553
|
selected: [],
|
|
554
|
+
isOpen: false,
|
|
555
|
+
verticalVal: this.vertical ?? "bottom",
|
|
478
556
|
allOptionsIsChecked: true,
|
|
479
|
-
countVisibleChildren: 0,
|
|
480
557
|
hasTreeChildren: false,
|
|
481
558
|
uid: `f${(~~(Math.random() * 1e8)).toString(16)}`,
|
|
559
|
+
focusedOptionId: '',
|
|
482
560
|
actualStrings: {
|
|
483
561
|
...{
|
|
484
|
-
searchPlaceholder:
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
// this.requiredDependencyNotFilled ||
|
|
519
|
-
// this.lang(
|
|
520
|
-
// "required_dependency_are_not_filled",
|
|
521
|
-
// LANG_COMPONENTS.COMPONENT_SELECT
|
|
522
|
-
// ),
|
|
562
|
+
searchPlaceholder: lang(
|
|
563
|
+
this.searchPlaceholderText.length
|
|
564
|
+
? this.searchPlaceholderText
|
|
565
|
+
: "search_placeholder",
|
|
566
|
+
this.LANG_COMPONENTS?.COMPONENT_SELECT
|
|
567
|
+
),
|
|
568
|
+
emptyTitle: lang(
|
|
569
|
+
"empty_title",
|
|
570
|
+
this.LANG_COMPONENTS?.COMPONENT_SELECT
|
|
571
|
+
),
|
|
572
|
+
selectAllOptions: lang(
|
|
573
|
+
"all_options",
|
|
574
|
+
this.LANG_COMPONENTS?.COMPONENT_SELECT
|
|
575
|
+
),
|
|
576
|
+
allSelected: lang(
|
|
577
|
+
"all_selected",
|
|
578
|
+
this.LANG_COMPONENTS?.COMPONENT_SELECT
|
|
579
|
+
),
|
|
580
|
+
loading:
|
|
581
|
+
lang("loading", this.LANG_COMPONENTS?.COMPONENT_SELECT) + "...",
|
|
582
|
+
selectedCount: lang(
|
|
583
|
+
"selected_count",
|
|
584
|
+
this.LANG_COMPONENTS?.COMPONENT_SELECT
|
|
585
|
+
),
|
|
586
|
+
buttonTitle:
|
|
587
|
+
this.buttonTitle ||
|
|
588
|
+
lang("button_title", this.LANG_COMPONENTS?.COMPONENT_SELECT),
|
|
589
|
+
requiredDependencyNotFilled:
|
|
590
|
+
// eslint-disable-next-line vue/no-computed-properties-in-data
|
|
591
|
+
this.requiredDependencyNotFilled ||
|
|
592
|
+
lang(
|
|
593
|
+
"required_dependency_are_not_filled",
|
|
594
|
+
this.LANG_COMPONENTS?.COMPONENT_SELECT
|
|
595
|
+
),
|
|
523
596
|
},
|
|
524
597
|
...this.strings,
|
|
525
598
|
},
|
|
@@ -527,6 +600,30 @@ export default {
|
|
|
527
600
|
};
|
|
528
601
|
},
|
|
529
602
|
methods: {
|
|
603
|
+
onBlur() {
|
|
604
|
+
setTimeout(() => {
|
|
605
|
+
if (!this.isOpen) {
|
|
606
|
+
this.$emit("blur");
|
|
607
|
+
}
|
|
608
|
+
}, 200);
|
|
609
|
+
},
|
|
610
|
+
inputKeyupDown() {
|
|
611
|
+
this.focusOnFirstOptions();
|
|
612
|
+
},
|
|
613
|
+
comboboxKeyupDown() {
|
|
614
|
+
if (this.showSearch) {
|
|
615
|
+
this.$refs.search.focus();
|
|
616
|
+
return;
|
|
617
|
+
}
|
|
618
|
+
|
|
619
|
+
this.focusOnFirstOptions();
|
|
620
|
+
},
|
|
621
|
+
focus() {
|
|
622
|
+
this.$refs.combobox.focus();
|
|
623
|
+
},
|
|
624
|
+
focusOnFirstOptions() {
|
|
625
|
+
this.$refs.list.$el.querySelector('[tabindex]:not(hidden)').focus();
|
|
626
|
+
},
|
|
530
627
|
startResizing(prop) {
|
|
531
628
|
this.resizingProp = prop;
|
|
532
629
|
},
|
|
@@ -582,7 +679,7 @@ export default {
|
|
|
582
679
|
this.defaultFilter(options);
|
|
583
680
|
},
|
|
584
681
|
setPreparedValues(opt) {
|
|
585
|
-
let options = opt || this.
|
|
682
|
+
let options = opt || this.initialOptions;
|
|
586
683
|
if (this.alphabetSort) {
|
|
587
684
|
options = options.sort((a, b) =>
|
|
588
685
|
a.title.toLowerCase().localeCompare(b.title.toLowerCase())
|
|
@@ -592,18 +689,28 @@ export default {
|
|
|
592
689
|
return this.prepare(options).then(([options, selected]) => {
|
|
593
690
|
this.actualOptions = options;
|
|
594
691
|
this.allOptionsIsChecked = this.checkIfOptionsChecked(options);
|
|
595
|
-
this.countVisibleChildren = options.length;
|
|
596
692
|
this.isInitialized = true;
|
|
597
693
|
this.selected = selected;
|
|
598
694
|
this.setBookmarkedOptions(options);
|
|
599
695
|
});
|
|
600
696
|
},
|
|
601
697
|
clear() {
|
|
602
|
-
this.
|
|
698
|
+
this.setPreparedValues();
|
|
603
699
|
this.allOptionsIsChecked = false;
|
|
604
|
-
this.countVisibleChildren = 0;
|
|
605
700
|
this.selected = [];
|
|
606
|
-
|
|
701
|
+
|
|
702
|
+
if (this.isMultiple) {
|
|
703
|
+
this.$emit("update:modelValue", null);
|
|
704
|
+
this.$emit("input", null);
|
|
705
|
+
this.$emit("clear-value", null);
|
|
706
|
+
|
|
707
|
+
} else {
|
|
708
|
+
this.$emit("update:modelValue", []);
|
|
709
|
+
this.$emit("input", []);
|
|
710
|
+
this.$emit("clear-value", []);
|
|
711
|
+
}
|
|
712
|
+
|
|
713
|
+
this.setPreparedValues();
|
|
607
714
|
},
|
|
608
715
|
clearValue() {
|
|
609
716
|
this.clear();
|
|
@@ -636,7 +743,7 @@ export default {
|
|
|
636
743
|
option.initiallyVisible =
|
|
637
744
|
typeof option.visible === "undefined" ? true : option.visible;
|
|
638
745
|
option.visible = option.initiallyVisible;
|
|
639
|
-
option.
|
|
746
|
+
option.readonly = option.readonly ? true : false;
|
|
640
747
|
|
|
641
748
|
option.checked = this.isMultiple
|
|
642
749
|
? this.val !== null &&
|
|
@@ -650,7 +757,7 @@ export default {
|
|
|
650
757
|
}
|
|
651
758
|
|
|
652
759
|
if (option.children) {
|
|
653
|
-
this.hasTreeChildren = true;
|
|
760
|
+
this.hasTreeChildren = true;
|
|
654
761
|
option.isChildrenVisible = false;
|
|
655
762
|
}
|
|
656
763
|
|
|
@@ -684,26 +791,16 @@ export default {
|
|
|
684
791
|
filterFunc(options, filterString) {
|
|
685
792
|
let visibleOptionsCount = 0;
|
|
686
793
|
|
|
687
|
-
options.forEach(
|
|
688
|
-
let isVisible =
|
|
689
|
-
option.initiallyVisible &&
|
|
690
|
-
option.title.toString().toLowerCase().includes(filterString) &&
|
|
691
|
-
!this.actualBookmarkedOptions[option.id];
|
|
794
|
+
options.forEach(option => {
|
|
795
|
+
let isVisible = option.initiallyVisible && option.title && option.title.toString().toLowerCase().includes(filterString) && !this.actualBookmarkedOptions[option.id];
|
|
692
796
|
|
|
693
797
|
if (option.children && option.children.length) {
|
|
694
|
-
let visibleChildrenCount = this.filterFunc(
|
|
695
|
-
option.children,
|
|
696
|
-
filterString
|
|
697
|
-
);
|
|
798
|
+
let visibleChildrenCount = this.filterFunc(option.children, filterString);
|
|
698
799
|
visibleOptionsCount += visibleChildrenCount;
|
|
699
800
|
|
|
700
801
|
if (visibleChildrenCount) {
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
Boolean(Object.keys(this.actualBookmarkedOptions).length);
|
|
704
|
-
option.isDisabled =
|
|
705
|
-
visibleChildrenCount < option.children.length &&
|
|
706
|
-
!this.isBookmarkable;
|
|
802
|
+
option.isChildrenVisible = !!filterString || Boolean(Object.keys(this.actualBookmarkedOptions).length);
|
|
803
|
+
option.isDisabled = visibleChildrenCount < option.children.length && !this.isBookmarkable;
|
|
707
804
|
}
|
|
708
805
|
|
|
709
806
|
if (!isVisible) {
|
|
@@ -719,7 +816,6 @@ export default {
|
|
|
719
816
|
visibleOptionsCount++;
|
|
720
817
|
}
|
|
721
818
|
});
|
|
722
|
-
|
|
723
819
|
return visibleOptionsCount;
|
|
724
820
|
},
|
|
725
821
|
submit() {
|
|
@@ -747,7 +843,7 @@ export default {
|
|
|
747
843
|
this.$refs.dropdown.close();
|
|
748
844
|
},
|
|
749
845
|
checkIfOptionsChecked(options) {
|
|
750
|
-
return options.every((option) => option.checked);
|
|
846
|
+
return options.every((option) => option.checked || option.readonly);
|
|
751
847
|
},
|
|
752
848
|
registerCheck(option, isChecked, isDirectChild) {
|
|
753
849
|
if (isChecked) {
|
|
@@ -757,8 +853,8 @@ export default {
|
|
|
757
853
|
!(this.onlyEndNodes && option.children && option.children.length)
|
|
758
854
|
) {
|
|
759
855
|
this.selected[option.id] = option;
|
|
760
|
-
this.$emit("input", Object.keys(this.selected));
|
|
761
856
|
this.$emit("update:modelValue", Object.keys(this.selected));
|
|
857
|
+
this.$emit("input", Object.keys(this.selected));
|
|
762
858
|
}
|
|
763
859
|
} else {
|
|
764
860
|
const selectedOptionKey = Object.keys(this.selected)[0];
|
|
@@ -773,8 +869,8 @@ export default {
|
|
|
773
869
|
} else {
|
|
774
870
|
delete this.selected[option.id];
|
|
775
871
|
option.checked = false;
|
|
776
|
-
this.$emit("input", Object.keys(this.selected));
|
|
777
872
|
this.$emit("update:modelValue", Object.keys(this.selected));
|
|
873
|
+
this.$emit("input", Object.keys(this.selected));
|
|
778
874
|
}
|
|
779
875
|
|
|
780
876
|
this.toggleDuplicateOptions(this.actualOptions, option.id, isChecked);
|
|
@@ -797,6 +893,7 @@ export default {
|
|
|
797
893
|
manageAll() {
|
|
798
894
|
this.allOptionsIsChecked = !this.allOptionsIsChecked;
|
|
799
895
|
this.traverseTree(this.actualOptions, (option) => {
|
|
896
|
+
if (option.readonly) return;
|
|
800
897
|
this.registerCheck(option, this.allOptionsIsChecked, false);
|
|
801
898
|
});
|
|
802
899
|
},
|
|
@@ -842,20 +939,57 @@ export default {
|
|
|
842
939
|
this.filter(this.filterString, options);
|
|
843
940
|
},
|
|
844
941
|
onClose() {
|
|
942
|
+
this.isOpen = false;
|
|
943
|
+
this.filter("", this.actualOptions);
|
|
944
|
+
|
|
845
945
|
if (this.isMultiple) {
|
|
846
946
|
this.$emit("close", Object.keys(this.selected));
|
|
847
947
|
} else {
|
|
848
948
|
this.$emit("close", Object.keys(this.selected)[0]);
|
|
849
949
|
}
|
|
950
|
+
this.$emit("blur");
|
|
951
|
+
this.verticalVal = this.vertical ?? "bottom";
|
|
850
952
|
},
|
|
953
|
+
onOpen() {
|
|
954
|
+
const screenHeight = document.documentElement.scrollHeight;
|
|
955
|
+
this.isOpen = true;
|
|
956
|
+
|
|
957
|
+
if (this.vertical === "bottom") return;
|
|
958
|
+
|
|
959
|
+
this.$nextTick(() => {
|
|
960
|
+
const newScreenHeight = document.documentElement.scrollHeight
|
|
961
|
+
if(newScreenHeight > screenHeight) {
|
|
962
|
+
this.verticalVal = "top";
|
|
963
|
+
}
|
|
964
|
+
})
|
|
965
|
+
}
|
|
851
966
|
},
|
|
852
967
|
computed: {
|
|
853
968
|
hasTrigger() {
|
|
854
969
|
return !!this.$slots.trigger;
|
|
855
970
|
},
|
|
971
|
+
hasTriggerContent() {
|
|
972
|
+
return !!this.$slots.triggerContent;
|
|
973
|
+
},
|
|
856
974
|
hasEmptyMessage() {
|
|
857
975
|
return !!this.$slots.emptyMessage;
|
|
858
976
|
},
|
|
977
|
+
treeDropPos() {
|
|
978
|
+
if (this.menuSize) {
|
|
979
|
+
return {
|
|
980
|
+
width: this.menuSize + "px",
|
|
981
|
+
maxWidth: this.menuSize + "px",
|
|
982
|
+
minWidth: this.menuSize + "px",
|
|
983
|
+
};
|
|
984
|
+
}
|
|
985
|
+
|
|
986
|
+
return {
|
|
987
|
+
width: "auto",
|
|
988
|
+
position: "absolute",
|
|
989
|
+
left: -this.size.left + "px",
|
|
990
|
+
right: -this.size.right + "px",
|
|
991
|
+
};
|
|
992
|
+
},
|
|
859
993
|
hasHierarchy() {
|
|
860
994
|
return this.actualOptions.some((option) => {
|
|
861
995
|
return option.children;
|
|
@@ -938,6 +1072,7 @@ export default {
|
|
|
938
1072
|
},
|
|
939
1073
|
},
|
|
940
1074
|
components: {
|
|
1075
|
+
IbAlert,
|
|
941
1076
|
IbIconButton,
|
|
942
1077
|
IbIcon,
|
|
943
1078
|
IbDropdown,
|