@milaboratories/uikit 1.2.17 → 1.2.19
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/CHANGELOG.md +12 -0
- package/dist/pl-uikit.js +1532 -1501
- package/dist/pl-uikit.umd.cjs +4 -4
- package/dist/src/components/PlDropdown/PlDropdown.vue.d.ts +5 -1
- package/dist/src/components/PlDropdownRef/PlDropdownRef.vue.d.ts +109 -0
- package/dist/src/components/PlDropdownRef/__tests__/PlDropdownRef.spec.d.ts +1 -0
- package/dist/src/components/PlDropdownRef/index.d.ts +1 -0
- package/dist/src/index.d.ts +2 -0
- package/dist/src/types.d.ts +6 -1
- package/dist/style.css +1 -1
- package/dist/tsconfig.lib.tsbuildinfo +1 -1
- package/package.json +4 -3
- package/src/assets/icons/icon-assets/24_link-disabled.svg +4 -0
- package/src/assets/icons/icon-assets-min/24_link-disabled.svg +1 -0
- package/src/assets/icons/icons-24-generated.json +1 -0
- package/src/assets/icons/icons-24-generated.scss +1 -0
- package/src/assets/icons.scss +0 -4
- package/src/assets/masks.scss +0 -4
- package/src/assets/mixins.scss +8 -8
- package/src/components/PlBtnAccent/pl-btn-accent.scss +6 -4
- package/src/components/PlBtnGhost/pl-btn-ghost.scss +9 -6
- package/src/components/PlBtnPrimary/pl-btn-primary.scss +12 -10
- package/src/components/PlBtnSecondary/pl-btn-secondary.scss +9 -7
- package/src/components/PlDropdown/PlDropdown.vue +11 -6
- package/src/components/PlDropdown/pl-dropdown.scss +20 -38
- package/src/components/PlDropdownLine/pl-dropdown-line.scss +2 -2
- package/src/components/PlDropdownMulti/pl-dropdown-multi.scss +5 -5
- package/src/components/PlDropdownRef/PlDropdownRef.vue +90 -0
- package/src/components/PlDropdownRef/__tests__/PlDropdownRef.spec.ts +55 -0
- package/src/components/PlDropdownRef/index.ts +1 -0
- package/src/components/PlFileDialog/pl-file-dialog.scss +1 -1
- package/src/index.ts +1 -0
- package/src/types.ts +8 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@milaboratories/uikit",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.19",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "dist/pl-uikit.umd.js",
|
|
6
6
|
"module": "dist/pl-uikit.js",
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
},
|
|
23
23
|
"devDependencies": {
|
|
24
24
|
"@vue/test-utils": "^2.4.6",
|
|
25
|
-
"jsdom": "^24.1.
|
|
25
|
+
"jsdom": "^24.1.3",
|
|
26
26
|
"resize-observer-polyfill": "^1.5.1",
|
|
27
27
|
"@vitejs/plugin-vue": "^5.1.4",
|
|
28
28
|
"tsc-alias": "^1.8.10",
|
|
@@ -30,8 +30,9 @@
|
|
|
30
30
|
"vite": "^5.4.8",
|
|
31
31
|
"vue-tsc": "^2.1.6",
|
|
32
32
|
"yarpm": "^1.2.0",
|
|
33
|
+
"svgo": "^3.3.2",
|
|
33
34
|
"@milaboratories/helpers": "^1.6.5",
|
|
34
|
-
"@platforma-sdk/model": "^1.
|
|
35
|
+
"@platforma-sdk/model": "^1.5.40"
|
|
35
36
|
},
|
|
36
37
|
"scripts": {
|
|
37
38
|
"dev": "vite",
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<path d="M11.2215 15.2214L13.5701 12.8728C15.2299 11.213 15.2299 8.52208 13.5701 6.86235C11.9104 5.20262 9.21946 5.20262 7.55973 6.86235L3.31709 11.105C1.65736 12.7647 1.65736 15.4557 3.31709 17.1154C4.38619 18.1845 5.88315 18.5649 7.25677 18.2567L8.45261 19.4526C6.38306 20.2767 3.93154 19.8512 2.25643 18.1761C0.0109174 15.9305 0.0109177 12.2898 2.25643 10.0443L6.49907 5.80169C8.74459 3.55617 12.3853 3.55618 14.6308 5.80169C16.8763 8.0472 16.8763 11.6879 14.6308 13.9334L12.2821 16.2821L11.2215 15.2214Z" fill="#CFD1DB"/>
|
|
3
|
+
<path d="M17.4594 18.1761C15.2139 20.4216 11.5732 20.4216 9.32772 18.1761C7.08221 15.9305 7.08221 12.2898 9.32772 10.0443L11.686 7.68602L12.7467 8.74668L10.3884 11.105C8.72865 12.7647 8.72865 15.4557 10.3884 17.1154C12.0481 18.7751 14.7391 18.7751 16.3988 17.1154L20.6414 12.8728C22.3012 11.213 22.3012 8.52208 20.6414 6.86235C19.5764 5.79734 18.0868 5.41573 16.7175 5.7175L15.5197 4.51969C17.5864 3.70296 20.0307 4.1303 21.7021 5.80169C23.9476 8.0472 23.9476 11.6879 21.7021 13.9334L17.4594 18.1761Z" fill="#CFD1DB"/>
|
|
4
|
+
</svg>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none"><path fill="#CFD1DB" d="m11.222 15.221 2.348-2.348a4.25 4.25 0 1 0-6.01-6.01l-4.243 4.242a4.25 4.25 0 0 0 3.94 7.152l1.196 1.196a5.751 5.751 0 0 1-6.197-9.409L6.5 5.802a5.75 5.75 0 0 1 8.132 8.131l-2.349 2.35z"/><path fill="#CFD1DB" d="M17.46 18.176a5.75 5.75 0 1 1-8.132-8.132l2.358-2.358 1.06 1.06-2.358 2.359a4.25 4.25 0 1 0 6.01 6.01l4.243-4.242a4.25 4.25 0 0 0-3.923-7.155L15.52 4.52a5.751 5.751 0 0 1 6.182 9.413z"/></svg>
|
package/src/assets/icons.scss
CHANGED
|
@@ -11,10 +11,6 @@
|
|
|
11
11
|
@include icon(url("./images/16_attention.svg"), var(--icon-size));
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
-
&--clear {
|
|
15
|
-
@include icon(url("./images/16_clear.svg"), var(--icon-size));
|
|
16
|
-
}
|
|
17
|
-
|
|
18
14
|
&--chevron-right {
|
|
19
15
|
@include icon(url("./images/16_chevron-right.svg"), var(--icon-size));
|
|
20
16
|
}
|
package/src/assets/masks.scss
CHANGED
|
@@ -15,10 +15,6 @@
|
|
|
15
15
|
@include mask(url("./images/16_attention.svg"), var(--mask-size));
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
-
&--clear {
|
|
19
|
-
@include mask(url("./images/16_clear.svg"), var(--mask-size));
|
|
20
|
-
}
|
|
21
|
-
|
|
22
18
|
&--chevron-right {
|
|
23
19
|
@include mask(url("./images/16_chevron-right.svg"), var(--mask-size));
|
|
24
20
|
}
|
package/src/assets/mixins.scss
CHANGED
|
@@ -79,6 +79,14 @@
|
|
|
79
79
|
@mixin scrollbar($y: true, $x: false, $over: auto) {
|
|
80
80
|
--thumb-color: var(--ic-02);
|
|
81
81
|
|
|
82
|
+
@if $y {
|
|
83
|
+
overflow-y: $over;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
@if $x {
|
|
87
|
+
overflow-x: $over;
|
|
88
|
+
}
|
|
89
|
+
|
|
82
90
|
&::-webkit-scrollbar {
|
|
83
91
|
width: 6px;
|
|
84
92
|
height: 5px;
|
|
@@ -92,14 +100,6 @@
|
|
|
92
100
|
border-radius: 5px;
|
|
93
101
|
}
|
|
94
102
|
|
|
95
|
-
@if $y {
|
|
96
|
-
overflow-y: $over;
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
@if $x {
|
|
100
|
-
overflow-x: $over;
|
|
101
|
-
}
|
|
102
|
-
|
|
103
103
|
&:hover {
|
|
104
104
|
--thumb-color: var(--border-color-focus);
|
|
105
105
|
}
|
|
@@ -3,11 +3,13 @@
|
|
|
3
3
|
.ui-btn-accent {
|
|
4
4
|
@include base-btn;
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
& {
|
|
7
|
+
--color-btn-background: var(--color-accent-default);
|
|
8
|
+
--color-btn-hover: var(--color-accent-hover);
|
|
8
9
|
|
|
9
|
-
|
|
10
|
-
|
|
10
|
+
background-color: var(--color-btn-background);
|
|
11
|
+
border: none;
|
|
12
|
+
}
|
|
11
13
|
|
|
12
14
|
&.large {
|
|
13
15
|
--drop-shadow: 3px 3px 0px #000000;
|
|
@@ -2,13 +2,16 @@
|
|
|
2
2
|
|
|
3
3
|
.ui-btn-ghost {
|
|
4
4
|
@include base-btn;
|
|
5
|
-
gap: 10px;
|
|
6
|
-
background: transparent;
|
|
7
|
-
border: none;
|
|
8
|
-
width: fit-content;
|
|
9
5
|
|
|
10
|
-
|
|
11
|
-
|
|
6
|
+
& {
|
|
7
|
+
gap: 10px;
|
|
8
|
+
background: transparent;
|
|
9
|
+
border: none;
|
|
10
|
+
width: fit-content;
|
|
11
|
+
|
|
12
|
+
--color-text: var(--txt-01);
|
|
13
|
+
--color-btn-hover: var(--btn-sec-hover-grey);
|
|
14
|
+
}
|
|
12
15
|
|
|
13
16
|
[data-theme="dark"] & {
|
|
14
17
|
&:hover {
|
|
@@ -3,16 +3,18 @@
|
|
|
3
3
|
.pl-btn-primary {
|
|
4
4
|
@include base-btn;
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
6
|
+
& {
|
|
7
|
+
--color-btn-hover: var(--color-primary-hover);
|
|
8
|
+
--color-btn-background: var(--color-primary-default);
|
|
9
|
+
--btn-disabled-bg: var(--color-dis-01);
|
|
10
|
+
--shape-shadow: var(--btn-shape-shadow);
|
|
11
|
+
|
|
12
|
+
background-color: var(--color-btn-background);
|
|
13
|
+
border: none;
|
|
14
|
+
min-width: 160px;
|
|
15
|
+
|
|
16
|
+
--append-shadow: inset 0 0 0 1px #110529;
|
|
17
|
+
}
|
|
16
18
|
|
|
17
19
|
&.loading {
|
|
18
20
|
background: rgba(7, 5, 41, 0.8);
|
|
@@ -3,13 +3,15 @@
|
|
|
3
3
|
.pl-btn-secondary {
|
|
4
4
|
@include base-btn;
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
6
|
+
& {
|
|
7
|
+
border: 1px solid var(--color-border);
|
|
8
|
+
background: transparent;
|
|
9
|
+
min-width: 160px;
|
|
10
|
+
|
|
11
|
+
--color-border: var(--color-border-default);
|
|
12
|
+
--color-text: var(--txt-01);
|
|
13
|
+
--color-btn-hover: var(--btn-sec-hover-grey);
|
|
14
|
+
}
|
|
13
15
|
|
|
14
16
|
&:disabled {
|
|
15
17
|
--color-text: var(--color-dis-01);
|
|
@@ -67,9 +67,13 @@ const props = withDefaults(
|
|
|
67
67
|
*/
|
|
68
68
|
disabled?: boolean;
|
|
69
69
|
/**
|
|
70
|
-
* Custom icon class for the dropdown arrow (optional)
|
|
70
|
+
* Custom icon (16px) class for the dropdown arrow (optional)
|
|
71
71
|
*/
|
|
72
72
|
arrowIcon?: string;
|
|
73
|
+
/**
|
|
74
|
+
* Custom icon (24px) class for the dropdown arrow (optional)
|
|
75
|
+
*/
|
|
76
|
+
arrowIconLarge?: string;
|
|
73
77
|
/**
|
|
74
78
|
* Option list item size
|
|
75
79
|
*/
|
|
@@ -84,6 +88,7 @@ const props = withDefaults(
|
|
|
84
88
|
required: false,
|
|
85
89
|
disabled: false,
|
|
86
90
|
arrowIcon: undefined,
|
|
91
|
+
arrowIconLarge: undefined,
|
|
87
92
|
optionSize: 'small',
|
|
88
93
|
},
|
|
89
94
|
);
|
|
@@ -301,14 +306,14 @@ watchPostEffect(() => {
|
|
|
301
306
|
|
|
302
307
|
<div v-if="!data.open" @click="setFocusOnInput">
|
|
303
308
|
<LongText class="input-value"> {{ textValue }} </LongText>
|
|
304
|
-
<div v-if="clearable" class="close" @click.stop="clear" />
|
|
305
309
|
</div>
|
|
306
310
|
|
|
307
|
-
<div
|
|
308
|
-
|
|
309
|
-
<div class="ui-dropdown__append">
|
|
310
|
-
<div v-if="clearable && hasValue" class="icon icon--clear" @click.stop="clear" />
|
|
311
|
+
<div class="ui-dropdown__controls">
|
|
312
|
+
<div v-if="clearable && hasValue" class="icon-16 icon-clear" @click.stop="clear" />
|
|
311
313
|
<slot name="append" />
|
|
314
|
+
<div v-if="arrowIconLarge" class="arrow-icon" :class="[`icon-24 ${arrowIconLarge}`]" @click.stop="toggleOpen" />
|
|
315
|
+
<div v-else-if="arrowIcon" class="arrow-icon" :class="[`icon-16 ${arrowIcon}`]" @click.stop="toggleOpen" />
|
|
316
|
+
<div v-else class="arrow-icon arrow-icon-default" @click.stop="toggleOpen" />
|
|
312
317
|
</div>
|
|
313
318
|
</div>
|
|
314
319
|
<label v-if="label">
|
|
@@ -12,10 +12,6 @@
|
|
|
12
12
|
--label-offset-right-x: 8px;
|
|
13
13
|
--label-color: var(--txt-01);
|
|
14
14
|
|
|
15
|
-
[data-theme='dark'] & {
|
|
16
|
-
--options-bg: #1b1b1f;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
15
|
position: relative;
|
|
20
16
|
outline: none;
|
|
21
17
|
min-height: var(--control-height);
|
|
@@ -24,6 +20,10 @@
|
|
|
24
20
|
font-size: var(--font-size-base);
|
|
25
21
|
font-weight: var(--font-weigh-base);
|
|
26
22
|
|
|
23
|
+
[data-theme='dark'] & {
|
|
24
|
+
--options-bg: #1b1b1f;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
27
|
&__envelope {
|
|
28
28
|
font-family: var(--control-font-family);
|
|
29
29
|
min-width: 160px;
|
|
@@ -56,9 +56,10 @@
|
|
|
56
56
|
background-color: var(--options-bg);
|
|
57
57
|
border-radius: 0 0 6px 6px;
|
|
58
58
|
max-height: 244px;
|
|
59
|
-
@include scrollbar;
|
|
60
59
|
border-top: 1px solid var(--color-div-black);
|
|
61
60
|
|
|
61
|
+
@include scrollbar;
|
|
62
|
+
|
|
62
63
|
.nothing-found {
|
|
63
64
|
padding: 0 10px;
|
|
64
65
|
height: var(--control-height);
|
|
@@ -79,8 +80,8 @@
|
|
|
79
80
|
.checkmark {
|
|
80
81
|
position: absolute;
|
|
81
82
|
display: none;
|
|
82
|
-
@include abs-center-y();
|
|
83
83
|
right: 10px;
|
|
84
|
+
@include abs-center-y();
|
|
84
85
|
}
|
|
85
86
|
|
|
86
87
|
> span {
|
|
@@ -162,12 +163,6 @@
|
|
|
162
163
|
color: var(--color-placeholder);
|
|
163
164
|
}
|
|
164
165
|
}
|
|
165
|
-
|
|
166
|
-
&:hover {
|
|
167
|
-
.clear {
|
|
168
|
-
display: block;
|
|
169
|
-
}
|
|
170
|
-
}
|
|
171
166
|
}
|
|
172
167
|
|
|
173
168
|
&__helper {
|
|
@@ -178,43 +173,30 @@
|
|
|
178
173
|
@include field-error();
|
|
179
174
|
}
|
|
180
175
|
|
|
181
|
-
&
|
|
182
|
-
padding-right: 24px;
|
|
176
|
+
&__controls {
|
|
183
177
|
display: flex;
|
|
184
178
|
flex-direction: row;
|
|
185
179
|
align-items: center;
|
|
186
|
-
gap:
|
|
187
|
-
|
|
180
|
+
gap: 6px;
|
|
181
|
+
margin-left: auto;
|
|
182
|
+
|
|
183
|
+
.icon-clear {
|
|
188
184
|
cursor: pointer;
|
|
189
185
|
}
|
|
190
|
-
|
|
186
|
+
|
|
187
|
+
.mask-16,.mask-24 {
|
|
191
188
|
background-color: var(--control-mask-fill);
|
|
192
189
|
cursor: pointer;
|
|
193
190
|
}
|
|
194
191
|
}
|
|
195
192
|
|
|
196
|
-
.arrow {
|
|
197
|
-
position: absolute;
|
|
198
|
-
@include abs-center-y;
|
|
199
|
-
right: 12px;
|
|
200
|
-
background-color: var(--control-mask-fill);
|
|
201
|
-
@include mask(url('@/assets/images/16_chevron-down.svg'), 16px);
|
|
202
|
-
}
|
|
203
|
-
|
|
204
|
-
.arrow-altered {
|
|
205
|
-
position: absolute;
|
|
206
|
-
@include abs-center-y;
|
|
207
|
-
right: 12px;
|
|
208
|
-
}
|
|
209
|
-
|
|
210
|
-
.clear {
|
|
211
|
-
display: none;
|
|
212
|
-
position: absolute;
|
|
213
|
-
@include abs-center-y;
|
|
214
|
-
right: 36px;
|
|
215
|
-
z-index: 1;
|
|
216
|
-
@include icon(url('@/assets/images/16_clear.svg'), 16px); // @todo mask-image
|
|
193
|
+
.arrow-icon {
|
|
217
194
|
cursor: pointer;
|
|
195
|
+
// Default "arrow" icon (16x16)
|
|
196
|
+
&.arrow-icon-default {
|
|
197
|
+
background-color: var(--control-mask-fill);
|
|
198
|
+
@include mask(url('@/assets/images/16_chevron-down.svg'), 16px);
|
|
199
|
+
}
|
|
218
200
|
}
|
|
219
201
|
|
|
220
202
|
&.open,
|
|
@@ -123,8 +123,8 @@
|
|
|
123
123
|
max-height: 320px;
|
|
124
124
|
overflow-y: auto;
|
|
125
125
|
background-color: var(--bg-elevated-01);
|
|
126
|
-
@include scrollbar;
|
|
127
126
|
box-shadow: var(--shadow-m);
|
|
127
|
+
@include scrollbar;
|
|
128
128
|
}
|
|
129
129
|
|
|
130
130
|
&__items-tabs {
|
|
@@ -138,7 +138,7 @@
|
|
|
138
138
|
padding: 6px 12px 12px 12px;
|
|
139
139
|
border: 1px solid var(--color-div-grey);
|
|
140
140
|
border-radius: 6px;
|
|
141
|
-
@include scrollbar(false, true);
|
|
142
141
|
box-shadow: var(--shadow-m);
|
|
142
|
+
@include scrollbar(false, true);
|
|
143
143
|
}
|
|
144
144
|
}
|
|
@@ -12,10 +12,6 @@
|
|
|
12
12
|
--label-offset-right-x: 8px;
|
|
13
13
|
--label-color: var(--txt-01);
|
|
14
14
|
|
|
15
|
-
[data-theme="dark"] & {
|
|
16
|
-
--options-bg: #1B1B1F;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
15
|
position: relative;
|
|
20
16
|
outline: none;
|
|
21
17
|
min-height: var(--control-height);
|
|
@@ -24,6 +20,10 @@
|
|
|
24
20
|
font-size: var(--font-size-base);
|
|
25
21
|
font-weight: var(--font-weigh-base);
|
|
26
22
|
|
|
23
|
+
[data-theme="dark"] & {
|
|
24
|
+
--options-bg: #1B1B1F;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
27
|
&__envelope {
|
|
28
28
|
font-family: var(--control-font-family);
|
|
29
29
|
min-width: 160px;
|
|
@@ -57,8 +57,8 @@
|
|
|
57
57
|
background-color: var(--options-bg);
|
|
58
58
|
border-radius: 0 0 6px 6px;
|
|
59
59
|
max-height: 244px;
|
|
60
|
-
@include scrollbar;
|
|
61
60
|
border-top: 1px solid var(--color-div-black);
|
|
61
|
+
@include scrollbar;
|
|
62
62
|
|
|
63
63
|
.nothing-found {
|
|
64
64
|
padding: 0 10px;
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
/**
|
|
3
|
+
* A component for selecting one value from a list of options
|
|
4
|
+
*/
|
|
5
|
+
export default {
|
|
6
|
+
name: 'PlDropdownRef',
|
|
7
|
+
};
|
|
8
|
+
</script>
|
|
9
|
+
|
|
10
|
+
<script lang="ts" setup>
|
|
11
|
+
import type { ModelRef, RefOption } from '@/types';
|
|
12
|
+
import { PlDropdown } from '../PlDropdown';
|
|
13
|
+
import { computed } from 'vue';
|
|
14
|
+
|
|
15
|
+
defineEmits<{
|
|
16
|
+
/**
|
|
17
|
+
* Emitted when the model value is updated.
|
|
18
|
+
*/
|
|
19
|
+
(e: 'update:modelValue', value: ModelRef | undefined): void;
|
|
20
|
+
}>();
|
|
21
|
+
|
|
22
|
+
const props = withDefaults(
|
|
23
|
+
defineProps<{
|
|
24
|
+
/**
|
|
25
|
+
* The current selected ref of the dropdown.
|
|
26
|
+
*/
|
|
27
|
+
modelValue: ModelRef | undefined;
|
|
28
|
+
/**
|
|
29
|
+
* The label text for the dropdown field (optional)
|
|
30
|
+
*/
|
|
31
|
+
label?: string;
|
|
32
|
+
/**
|
|
33
|
+
* List of available ref options for the dropdown
|
|
34
|
+
*/
|
|
35
|
+
options: Readonly<RefOption[]>;
|
|
36
|
+
/**
|
|
37
|
+
* A helper text displayed below the dropdown when there are no errors (optional).
|
|
38
|
+
*/
|
|
39
|
+
helper?: string;
|
|
40
|
+
/**
|
|
41
|
+
* Error message displayed below the dropdown (optional)
|
|
42
|
+
*/
|
|
43
|
+
error?: string;
|
|
44
|
+
/**
|
|
45
|
+
* Placeholder text shown when no value is selected.
|
|
46
|
+
*/
|
|
47
|
+
placeholder?: string;
|
|
48
|
+
/**
|
|
49
|
+
* Enables a button to clear the selected value (default: false)
|
|
50
|
+
*/
|
|
51
|
+
clearable?: boolean;
|
|
52
|
+
/**
|
|
53
|
+
* If `true`, the dropdown component is marked as required.
|
|
54
|
+
*/
|
|
55
|
+
required?: boolean;
|
|
56
|
+
/**
|
|
57
|
+
* If `true`, the dropdown component is disabled and cannot be interacted with.
|
|
58
|
+
*/
|
|
59
|
+
disabled?: boolean;
|
|
60
|
+
/**
|
|
61
|
+
* Option list item size
|
|
62
|
+
*/
|
|
63
|
+
optionSize?: 'small' | 'medium';
|
|
64
|
+
}>(),
|
|
65
|
+
{
|
|
66
|
+
label: '',
|
|
67
|
+
helper: undefined,
|
|
68
|
+
error: undefined,
|
|
69
|
+
placeholder: '...',
|
|
70
|
+
clearable: false,
|
|
71
|
+
required: false,
|
|
72
|
+
disabled: false,
|
|
73
|
+
arrowIcon: undefined,
|
|
74
|
+
optionSize: 'small',
|
|
75
|
+
},
|
|
76
|
+
);
|
|
77
|
+
|
|
78
|
+
const options = computed(() =>
|
|
79
|
+
props.options.map((opt) => ({
|
|
80
|
+
label: opt.label,
|
|
81
|
+
value: opt.ref,
|
|
82
|
+
})),
|
|
83
|
+
);
|
|
84
|
+
|
|
85
|
+
const arrowIcon = computed(() => (props.disabled ? 'icon-link-disabled' : 'icon-link'));
|
|
86
|
+
</script>
|
|
87
|
+
|
|
88
|
+
<template>
|
|
89
|
+
<PlDropdown v-bind="props" :options="options" :arrow-icon-large="arrowIcon" @update:model-value="$emit('update:modelValue', $event)"> </PlDropdown>
|
|
90
|
+
</template>
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { describe, it, expect } from 'vitest';
|
|
2
|
+
|
|
3
|
+
import { mount } from '@vue/test-utils';
|
|
4
|
+
import PlDropdownRef from '../PlDropdownRef.vue';
|
|
5
|
+
|
|
6
|
+
describe('PlDropdownRef', () => {
|
|
7
|
+
it('modelValue', async () => {
|
|
8
|
+
const wrapper = mount(PlDropdownRef, {
|
|
9
|
+
props: {
|
|
10
|
+
modelValue: {
|
|
11
|
+
__isRef: true as const,
|
|
12
|
+
blockId: '2',
|
|
13
|
+
name: 'Ref to block 2',
|
|
14
|
+
},
|
|
15
|
+
'onUpdate:modelValue': (e) => wrapper.setProps({ modelValue: e }),
|
|
16
|
+
options: [
|
|
17
|
+
{
|
|
18
|
+
label: 'Ref 1',
|
|
19
|
+
ref: {
|
|
20
|
+
__isRef: true as const,
|
|
21
|
+
blockId: '1',
|
|
22
|
+
name: 'Ref to block 1',
|
|
23
|
+
},
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
label: 'Ref 2',
|
|
27
|
+
ref: {
|
|
28
|
+
__isRef: true as const,
|
|
29
|
+
blockId: '2',
|
|
30
|
+
name: 'Ref to block 2',
|
|
31
|
+
},
|
|
32
|
+
},
|
|
33
|
+
],
|
|
34
|
+
},
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
await wrapper.find('input').trigger('focus');
|
|
38
|
+
|
|
39
|
+
expect(await wrapper.findAll('.dropdown-list-item').length).toBe(2);
|
|
40
|
+
|
|
41
|
+
await wrapper
|
|
42
|
+
.findAll('.dropdown-list-item')
|
|
43
|
+
.filter((node) => node.text().match(/Ref 2/))
|
|
44
|
+
.at(0)
|
|
45
|
+
?.trigger('click');
|
|
46
|
+
|
|
47
|
+
expect(wrapper.props('modelValue')).toStrictEqual({
|
|
48
|
+
__isRef: true as const,
|
|
49
|
+
blockId: '2',
|
|
50
|
+
name: 'Ref to block 2',
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
expect(await wrapper.findAll('.dropdown-list-item').length).toBe(0); // options are closed after click
|
|
54
|
+
});
|
|
55
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as PlDropdownRef } from './PlDropdownRef.vue';
|
|
@@ -114,11 +114,11 @@
|
|
|
114
114
|
.ls-body {
|
|
115
115
|
padding: 12px;
|
|
116
116
|
height: 366px;
|
|
117
|
-
@include scrollbar(true);
|
|
118
117
|
overflow: auto;
|
|
119
118
|
user-select: none;
|
|
120
119
|
display: flex;
|
|
121
120
|
flex-direction: column;
|
|
121
|
+
@include scrollbar(true);
|
|
122
122
|
> div {
|
|
123
123
|
font-family: var(--font-family-monospace);
|
|
124
124
|
color: var(--txt-01);
|
package/src/index.ts
CHANGED
|
@@ -30,6 +30,7 @@ export * from './components/PlBtnGroup';
|
|
|
30
30
|
export * from './components/PlTextField';
|
|
31
31
|
export * from './components/PlTextArea';
|
|
32
32
|
export * from './components/PlDropdown';
|
|
33
|
+
export * from './components/PlDropdownRef';
|
|
33
34
|
export * from './components/PlDropdownLine';
|
|
34
35
|
export * from './components/PlTooltip';
|
|
35
36
|
export * from './components/PlProgressBar';
|
package/src/types.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ImportFileHandle, Platforma, StorageHandle } from '@platforma-sdk/model';
|
|
1
|
+
import type { ImportFileHandle, Platforma, StorageHandle, Ref as ModelRef } from '@platforma-sdk/model';
|
|
2
2
|
import type { Ref, ComputedRef } from 'vue';
|
|
3
3
|
|
|
4
4
|
export type Size = 'small' | 'medium' | 'large';
|
|
@@ -37,6 +37,13 @@ export type ListOption<T = unknown> =
|
|
|
37
37
|
value: T;
|
|
38
38
|
};
|
|
39
39
|
|
|
40
|
+
export type { ModelRef };
|
|
41
|
+
|
|
42
|
+
export type RefOption = {
|
|
43
|
+
readonly label: string;
|
|
44
|
+
readonly ref: ModelRef;
|
|
45
|
+
};
|
|
46
|
+
|
|
40
47
|
export type ListOptionNormalized<T = unknown> = {
|
|
41
48
|
label: string;
|
|
42
49
|
description?: string;
|