eco-vue-js 0.5.17 → 0.5.18
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/components/Select/WSelect.vue.d.ts +36 -15
- package/dist/components/Select/WSelect.vue.d.ts.map +1 -1
- package/dist/components/Select/WSelect.vue.js +31 -65
- package/dist/components/Select/WSelectSingle.vue.d.ts +3 -3
- package/dist/components/Select/components/SelectOptionPrefix.vue.d.ts +63 -0
- package/dist/components/Select/components/SelectOptionPrefix.vue.d.ts.map +1 -0
- package/dist/components/Select/components/SelectOptionPrefix.vue.js +65 -0
- package/dist/components/Select/components/SelectOptionPrefix.vue2.js +5 -0
- package/package.json +1 -1
@@ -38,13 +38,20 @@ declare const _default: <Item extends string | number = string>(__VLS_props: {
|
|
38
38
|
allowCreate?: boolean | undefined;
|
39
39
|
} & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, __VLS_ctx?: {
|
40
40
|
attrs: any;
|
41
|
-
slots: {
|
42
|
-
option
|
43
|
-
option: string;
|
41
|
+
slots: Readonly<{
|
42
|
+
option?: ((props: {
|
43
|
+
option: Item | string;
|
44
44
|
selected: boolean;
|
45
45
|
model: boolean;
|
46
|
-
})
|
47
|
-
right
|
46
|
+
}) => void) | undefined;
|
47
|
+
right?: (() => void) | undefined;
|
48
|
+
}> & {
|
49
|
+
option?: ((props: {
|
50
|
+
option: Item | string;
|
51
|
+
selected: boolean;
|
52
|
+
model: boolean;
|
53
|
+
}) => void) | undefined;
|
54
|
+
right?: (() => void) | undefined;
|
48
55
|
};
|
49
56
|
emit: {
|
50
57
|
(e: 'select', item: Item): void;
|
@@ -101,13 +108,20 @@ declare const _default: <Item extends string | number = string>(__VLS_props: {
|
|
101
108
|
blur: () => void;
|
102
109
|
}>): void;
|
103
110
|
attrs: any;
|
104
|
-
slots: {
|
105
|
-
option
|
106
|
-
option: string;
|
111
|
+
slots: Readonly<{
|
112
|
+
option?: ((props: {
|
113
|
+
option: Item | string;
|
114
|
+
selected: boolean;
|
115
|
+
model: boolean;
|
116
|
+
}) => void) | undefined;
|
117
|
+
right?: (() => void) | undefined;
|
118
|
+
}> & {
|
119
|
+
option?: ((props: {
|
120
|
+
option: Item | string;
|
107
121
|
selected: boolean;
|
108
122
|
model: boolean;
|
109
|
-
})
|
110
|
-
right
|
123
|
+
}) => void) | undefined;
|
124
|
+
right?: (() => void) | undefined;
|
111
125
|
};
|
112
126
|
emit: {
|
113
127
|
(e: 'select', item: Item): void;
|
@@ -164,13 +178,20 @@ declare const _default: <Item extends string | number = string>(__VLS_props: {
|
|
164
178
|
blur: () => void;
|
165
179
|
}>): void;
|
166
180
|
attrs: any;
|
167
|
-
slots: {
|
168
|
-
option
|
169
|
-
option: string;
|
181
|
+
slots: Readonly<{
|
182
|
+
option?: ((props: {
|
183
|
+
option: Item | string;
|
184
|
+
selected: boolean;
|
185
|
+
model: boolean;
|
186
|
+
}) => void) | undefined;
|
187
|
+
right?: (() => void) | undefined;
|
188
|
+
}> & {
|
189
|
+
option?: ((props: {
|
190
|
+
option: Item | string;
|
170
191
|
selected: boolean;
|
171
192
|
model: boolean;
|
172
|
-
})
|
173
|
-
right
|
193
|
+
}) => void) | undefined;
|
194
|
+
right?: (() => void) | undefined;
|
174
195
|
};
|
175
196
|
emit: {
|
176
197
|
(e: 'select', item: Item): void;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"WSelect.vue.d.ts","sourceRoot":"","sources":["../../../src/components/Select/WSelect.vue"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"WSelect.vue.d.ts","sourceRoot":"","sources":["../../../src/components/Select/WSelect.vue"],"names":[],"mappings":"AAyIA;AAEA,OAAO,EAAwC,KAAK,SAAS,EAAC,MAAM,KAAK,CAAA;;;YAyiB/D,MAAM;;;;;;;;gBADF,IAAI,EAAE;;;;;;;;;;;;;;;aAET,IAAI,EAAE;;;gBAOsB,IAAI;;;;;;;;;;WAwBpC,GAAG;;0BA1YS;YACf,MAAM,EAAE,IAAI,GAAG,MAAM,CAAA;YACrB,QAAQ,EAAE,OAAO,CAAA;YACjB,KAAK,EAAE,OAAO,CAAA;SACf,KAAK,IAAI;uBACI,IAAI;;0BALD;YACf,MAAM,EAAE,IAAI,GAAG,MAAM,CAAA;YACrB,QAAQ,EAAE,OAAO,CAAA;YACjB,KAAK,EAAE,OAAO,CAAA;SACf,KAAK,IAAI;uBACI,IAAI;;;YAxJd,QAAQ,QAAQ,IAAI,GAAG,IAAI;YAC3B,UAAU,QAAQ,IAAI,GAAG,IAAI;YAC7B,eAAe,SAAS,MAAM,GAAG,IAAI;YACrC,eAAe,SAAS,MAAM,GAAG,IAAI;YACrC,OAAO,SAAS,UAAU,GAAG,IAAI;YACjC,MAAM,SAAS,UAAU,GAAG,IAAI;;;;;OAuhBiC,IAAI;;;gBA/BjE,MAAM;;;;;;;;oBADF,IAAI,EAAE;;;;;;;;;;;;;;;iBAET,IAAI,EAAE;;;oBAOsB,IAAI;;;;;;;;;;;;;SAuB4B,IAAI;WACpE,GAAG;;0BA1YS;YACf,MAAM,EAAE,IAAI,GAAG,MAAM,CAAA;YACrB,QAAQ,EAAE,OAAO,CAAA;YACjB,KAAK,EAAE,OAAO,CAAA;SACf,KAAK,IAAI;uBACI,IAAI;;0BALD;YACf,MAAM,EAAE,IAAI,GAAG,MAAM,CAAA;YACrB,QAAQ,EAAE,OAAO,CAAA;YACjB,KAAK,EAAE,OAAO,CAAA;SACf,KAAK,IAAI;uBACI,IAAI;;;YAxJd,QAAQ,QAAQ,IAAI,GAAG,IAAI;YAC3B,UAAU,QAAQ,IAAI,GAAG,IAAI;YAC7B,eAAe,SAAS,MAAM,GAAG,IAAI;YACrC,eAAe,SAAS,MAAM,GAAG,IAAI;YACrC,OAAO,SAAS,UAAU,GAAG,IAAI;YACjC,MAAM,SAAS,UAAU,GAAG,IAAI;;;;;;;;oBAwf5B,MAAM;;;;;;;;wBADF,IAAI,EAAE;;;;;;;;;;;;;;;qBAET,IAAI,EAAE;;;wBAOsB,IAAI;;;;;;;;;;;;;aAuB4B,IAAI;eACpE,GAAG;;8BA1YS;gBACf,MAAM,EAAE,IAAI,GAAG,MAAM,CAAA;gBACrB,QAAQ,EAAE,OAAO,CAAA;gBACjB,KAAK,EAAE,OAAO,CAAA;aACf,KAAK,IAAI;2BACI,IAAI;;8BALD;gBACf,MAAM,EAAE,IAAI,GAAG,MAAM,CAAA;gBACrB,QAAQ,EAAE,OAAO,CAAA;gBACjB,KAAK,EAAE,OAAO,CAAA;aACf,KAAK,IAAI;2BACI,IAAI;;;gBAxJd,QAAQ,QAAQ,IAAI,GAAG,IAAI;gBAC3B,UAAU,QAAQ,IAAI,GAAG,IAAI;gBAC7B,eAAe,SAAS,MAAM,GAAG,IAAI;gBACrC,eAAe,SAAS,MAAM,GAAG,IAAI;gBACrC,OAAO,SAAS,UAAU,GAAG,IAAI;gBACjC,MAAM,SAAS,UAAU,GAAG,IAAI;;;;AAzCtC,wBAskB2E"}
|
@@ -1,18 +1,16 @@
|
|
1
|
-
import { defineComponent, ref, computed, watch, toRef, nextTick, openBlock, createBlock, unref, withModifiers, createSlots, withCtx, createElementBlock, Fragment, renderList,
|
2
|
-
import _sfc_main$
|
3
|
-
import
|
1
|
+
import { defineComponent, ref, computed, watch, toRef, nextTick, openBlock, createBlock, unref, withModifiers, createSlots, withCtx, createElementBlock, Fragment, renderList, renderSlot, createCommentVNode, createElementVNode, toDisplayString, resolveDynamicComponent } from 'vue';
|
2
|
+
import _sfc_main$3 from './components/SelectOption.vue.js';
|
3
|
+
import _sfc_main$2 from './components/SelectOptionPrefix.vue.js';
|
4
4
|
import { getIsMobile } from '../../utils/mobile.js';
|
5
5
|
import { debounce } from '../../utils/utils.js';
|
6
6
|
import _sfc_main$1 from '../Input/WInputSuggest.vue.js';
|
7
7
|
|
8
|
-
const _hoisted_1 =
|
9
|
-
const _hoisted_2 = ["onClick"];
|
10
|
-
const _hoisted_3 = {
|
8
|
+
const _hoisted_1 = {
|
11
9
|
key: 0,
|
12
10
|
class: "py-2 px-[1.0625rem] first:pt-4 last:pb-4"
|
13
11
|
};
|
14
|
-
const
|
15
|
-
const
|
12
|
+
const _hoisted_2 = { class: "select-none cursor-default w-select-field sm-not:px-3" };
|
13
|
+
const _hoisted_3 = /* @__PURE__ */ createElementVNode("span", { class: "w-select-field pr-2 sm-not:px-3" }, " Create: ", -1);
|
16
14
|
const _sfc_main = /* @__PURE__ */ defineComponent({
|
17
15
|
__name: "WSelect",
|
18
16
|
props: {
|
@@ -173,85 +171,53 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
173
171
|
icon: _ctx.icon,
|
174
172
|
mono: _ctx.mono,
|
175
173
|
autofocus: _ctx.autofocus,
|
176
|
-
"onUpdate:modelValue": _cache[
|
174
|
+
"onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => !_ctx.loading && _ctx.$emit("update:search", $event ?? "")),
|
177
175
|
"onKeypress:enter": withModifiers(selectCursor, ["stop", "prevent"]),
|
178
176
|
"onKeypress:up": withModifiers(cursorUp, ["prevent"]),
|
179
177
|
"onKeypress:down": withModifiers(cursorDown, ["prevent"]),
|
180
178
|
"onKeypress:delete": captureDoubleDelete,
|
181
|
-
onOpen: _cache[
|
182
|
-
onClose: _cache[
|
179
|
+
onOpen: _cache[3] || (_cache[3] = ($event) => isOpen.value = true),
|
180
|
+
onClose: _cache[4] || (_cache[4] = ($event) => {
|
183
181
|
close();
|
184
182
|
_ctx.$emit("update:search", "");
|
185
183
|
}),
|
186
|
-
onFocus: _cache[
|
184
|
+
onFocus: _cache[5] || (_cache[5] = ($event) => {
|
187
185
|
focused.value = true;
|
188
186
|
_ctx.$emit("focus", $event);
|
189
187
|
}),
|
190
|
-
onBlur: _cache[
|
188
|
+
onBlur: _cache[6] || (_cache[6] = ($event) => {
|
191
189
|
focused.value = false;
|
192
190
|
_ctx.$emit("blur", $event);
|
193
191
|
})
|
194
192
|
}, createSlots({
|
195
193
|
prefix: withCtx(({ unclickable }) => [
|
196
194
|
(_ctx.hidePrefix ? unref(isMobile) ? unclickable || !focused.value : !isOpen.value : true) ? (openBlock(true), createElementBlock(Fragment, { key: 0 }, renderList(_ctx.modelValue, (option) => {
|
197
|
-
return openBlock(),
|
195
|
+
return openBlock(), createBlock(_sfc_main$2, {
|
198
196
|
key: option,
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
}, () => [
|
209
|
-
_ctx.optionComponent ? (openBlock(), createBlock(resolveDynamicComponent(_ctx.optionComponent), {
|
210
|
-
key: 0,
|
197
|
+
option,
|
198
|
+
"option-component": _ctx.optionComponent,
|
199
|
+
loading: _ctx.loading,
|
200
|
+
disabled: _ctx.disabled,
|
201
|
+
"disable-clear": _ctx.disableClear,
|
202
|
+
onUnselect: ($event) => unselect(option)
|
203
|
+
}, {
|
204
|
+
option: withCtx(() => [
|
205
|
+
renderSlot(_ctx.$slots, "option", {
|
211
206
|
option,
|
212
207
|
selected: true,
|
213
208
|
model: true
|
214
|
-
}
|
215
|
-
default: withCtx(() => [
|
216
|
-
!_ctx.disableClear ? (openBlock(), createElementBlock("button", {
|
217
|
-
key: 0,
|
218
|
-
class: normalizeClass(["relative flex square-5 rounded-full -my-1 -mr-2 ml-1 items-center justify-center outline-none", {
|
219
|
-
"cursor-not-allowed": _ctx.disabled,
|
220
|
-
"cursor-progress": _ctx.loading,
|
221
|
-
"cursor-pointer w-ripple w-ripple-hover ": !_ctx.loading && !_ctx.disabled
|
222
|
-
}]),
|
223
|
-
onMousedown: _cache[0] || (_cache[0] = withModifiers(() => {
|
224
|
-
}, ["stop", "prevent"])),
|
225
|
-
onClick: withModifiers(($event) => !_ctx.loading && unselect(option), ["stop", "prevent"])
|
226
|
-
}, [
|
227
|
-
createVNode(unref(IconCancel), { class: "square-3" })
|
228
|
-
], 42, _hoisted_1)) : createCommentVNode("", true)
|
229
|
-
]),
|
230
|
-
_: 2
|
231
|
-
}, 1032, ["option"])) : createCommentVNode("", true)
|
209
|
+
})
|
232
210
|
]),
|
233
|
-
|
234
|
-
|
235
|
-
class: normalizeClass(["relative flex square-5 rounded-full items-center justify-center outline-none", {
|
236
|
-
"cursor-not-allowed": _ctx.disabled,
|
237
|
-
"cursor-progress": _ctx.loading,
|
238
|
-
"cursor-pointer w-ripple w-ripple-hover ": !_ctx.loading && !_ctx.disabled
|
239
|
-
}]),
|
240
|
-
onMousedown: _cache[1] || (_cache[1] = withModifiers(() => {
|
241
|
-
}, ["stop", "prevent"])),
|
242
|
-
onClick: withModifiers(($event) => !_ctx.loading && unselect(option), ["stop", "prevent"])
|
243
|
-
}, [
|
244
|
-
createVNode(unref(IconCancel), { class: "square-3" })
|
245
|
-
], 42, _hoisted_2)) : createCommentVNode("", true)
|
246
|
-
], 2);
|
211
|
+
_: 2
|
212
|
+
}, 1032, ["option", "option-component", "loading", "disabled", "disable-clear", "onUnselect"]);
|
247
213
|
}), 128)) : createCommentVNode("", true)
|
248
214
|
]),
|
249
215
|
content: withCtx(() => [
|
250
|
-
!_ctx.options.length ? (openBlock(), createElementBlock("div",
|
251
|
-
createElementVNode("div",
|
216
|
+
!_ctx.options.length ? (openBlock(), createElementBlock("div", _hoisted_1, [
|
217
|
+
createElementVNode("div", _hoisted_2, toDisplayString(_ctx.emptyStub ?? "No match"), 1)
|
252
218
|
])) : createCommentVNode("", true),
|
253
219
|
(openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.options, (option, index) => {
|
254
|
-
return openBlock(), createBlock(_sfc_main$
|
220
|
+
return openBlock(), createBlock(_sfc_main$3, {
|
255
221
|
key: option,
|
256
222
|
"is-selected": _ctx.modelValue.includes(option),
|
257
223
|
"is-cursor": index === cursor.value,
|
@@ -285,7 +251,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
285
251
|
_: 2
|
286
252
|
}, 1032, ["is-selected", "is-cursor", "loading", "scroll", "hide-option-icon", "onSelect", "onUnselect", "onMouseenter"]);
|
287
253
|
}), 128)),
|
288
|
-
_ctx.allowCreate && _ctx.search !== "" ? (openBlock(), createBlock(_sfc_main$
|
254
|
+
_ctx.allowCreate && _ctx.search !== "" ? (openBlock(), createBlock(_sfc_main$3, {
|
289
255
|
key: 1,
|
290
256
|
"is-selected": false,
|
291
257
|
"is-cursor": cursor.value === _ctx.options.length,
|
@@ -293,11 +259,11 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
293
259
|
scroll: isCursorLocked.value,
|
294
260
|
"hide-option-icon": _ctx.hideOptionIcon,
|
295
261
|
class: "first:pt-4 last:pb-4",
|
296
|
-
onSelect: _cache[
|
297
|
-
onMouseenter: _cache[
|
262
|
+
onSelect: _cache[0] || (_cache[0] = ($event) => createOption(_ctx.search)),
|
263
|
+
onMouseenter: _cache[1] || (_cache[1] = ($event) => setCursor(_ctx.options.length))
|
298
264
|
}, {
|
299
265
|
default: withCtx(() => [
|
300
|
-
|
266
|
+
_hoisted_3,
|
301
267
|
renderSlot(_ctx.$slots, "option", {
|
302
268
|
option: _ctx.search,
|
303
269
|
selected: false,
|
@@ -37,7 +37,7 @@ declare const _default: <Item extends string | number, AllowClear extends boolea
|
|
37
37
|
attrs: any;
|
38
38
|
slots: {
|
39
39
|
option?(_: {
|
40
|
-
option: string;
|
40
|
+
option: string | Item;
|
41
41
|
selected: boolean;
|
42
42
|
model: boolean;
|
43
43
|
}): any;
|
@@ -92,7 +92,7 @@ declare const _default: <Item extends string | number, AllowClear extends boolea
|
|
92
92
|
attrs: any;
|
93
93
|
slots: {
|
94
94
|
option?(_: {
|
95
|
-
option: string;
|
95
|
+
option: string | Item;
|
96
96
|
selected: boolean;
|
97
97
|
model: boolean;
|
98
98
|
}): any;
|
@@ -148,7 +148,7 @@ declare const _default: <Item extends string | number, AllowClear extends boolea
|
|
148
148
|
attrs: any;
|
149
149
|
slots: {
|
150
150
|
option?(_: {
|
151
|
-
option: string;
|
151
|
+
option: string | Item;
|
152
152
|
selected: boolean;
|
153
153
|
model: boolean;
|
154
154
|
}): any;
|
@@ -0,0 +1,63 @@
|
|
1
|
+
import type { Component } from 'vue';
|
2
|
+
declare const _default: <Item extends string | number = string>(__VLS_props: {
|
3
|
+
option: Item;
|
4
|
+
disabled?: boolean | undefined;
|
5
|
+
loading?: boolean | undefined;
|
6
|
+
onUnselect?: (() => any) | undefined;
|
7
|
+
optionComponent?: Component<{
|
8
|
+
option: Item;
|
9
|
+
selected?: boolean | undefined;
|
10
|
+
model?: boolean | undefined;
|
11
|
+
}> | undefined;
|
12
|
+
disableClear?: boolean | undefined;
|
13
|
+
} & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, __VLS_ctx?: {
|
14
|
+
attrs: any;
|
15
|
+
slots: {
|
16
|
+
option?(_: {}): any;
|
17
|
+
};
|
18
|
+
emit: (e: 'unselect') => void;
|
19
|
+
} | undefined, __VLS_expose?: ((exposed: import('vue').ShallowUnwrapRef<{}>) => void) | undefined, __VLS_setup?: Promise<{
|
20
|
+
props: {
|
21
|
+
option: Item;
|
22
|
+
disabled?: boolean | undefined;
|
23
|
+
loading?: boolean | undefined;
|
24
|
+
onUnselect?: (() => any) | undefined;
|
25
|
+
optionComponent?: Component<{
|
26
|
+
option: Item;
|
27
|
+
selected?: boolean | undefined;
|
28
|
+
model?: boolean | undefined;
|
29
|
+
}> | undefined;
|
30
|
+
disableClear?: boolean | undefined;
|
31
|
+
} & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps;
|
32
|
+
expose(exposed: import('vue').ShallowUnwrapRef<{}>): void;
|
33
|
+
attrs: any;
|
34
|
+
slots: {
|
35
|
+
option?(_: {}): any;
|
36
|
+
};
|
37
|
+
emit: (e: 'unselect') => void;
|
38
|
+
}>) => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
39
|
+
[key: string]: any;
|
40
|
+
}> & {
|
41
|
+
__ctx?: {
|
42
|
+
props: {
|
43
|
+
option: Item;
|
44
|
+
disabled?: boolean | undefined;
|
45
|
+
loading?: boolean | undefined;
|
46
|
+
onUnselect?: (() => any) | undefined;
|
47
|
+
optionComponent?: Component<{
|
48
|
+
option: Item;
|
49
|
+
selected?: boolean | undefined;
|
50
|
+
model?: boolean | undefined;
|
51
|
+
}> | undefined;
|
52
|
+
disableClear?: boolean | undefined;
|
53
|
+
} & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps;
|
54
|
+
expose(exposed: import('vue').ShallowUnwrapRef<{}>): void;
|
55
|
+
attrs: any;
|
56
|
+
slots: {
|
57
|
+
option?(_: {}): any;
|
58
|
+
};
|
59
|
+
emit: (e: 'unselect') => void;
|
60
|
+
} | undefined;
|
61
|
+
};
|
62
|
+
export default _default;
|
63
|
+
//# sourceMappingURL=SelectOptionPrefix.vue.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"SelectOptionPrefix.vue.d.ts","sourceRoot":"","sources":["../../../../src/components/Select/components/SelectOptionPrefix.vue"],"names":[],"mappings":"AAgDA;AAEA,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,KAAK,CAAA;;YAwLxB,IAAI;;;;;gBACyB,IAAI;;;;;;WAWpC,GAAG;;wBA7BkB,GAAG;;cApJzB,UAAU,KAAG,IAAI;yCAgLP,OAAO,KAAK,EAAE,gBAAgB,CAAC,EAAE,CAAC,KAAG,IAAI;;gBAX/C,IAAI;;;;;oBACyB,IAAI;;;;;;oBAU3B,OAAO,KAAK,EAAE,gBAAgB,CAAC,EAAE,CAAC,GAAG,IAAI;WAClD,GAAG;;wBA7BkB,GAAG;;cApJzB,UAAU,KAAG,IAAI;;;;;;oBAqKb,IAAI;;;;;wBACyB,IAAI;;;;;;wBAU3B,OAAO,KAAK,EAAE,gBAAgB,CAAC,EAAE,CAAC,GAAG,IAAI;eAClD,GAAG;;4BA7BkB,GAAG;;kBApJzB,UAAU,KAAG,IAAI;;;AAfvB,wBAqM2E"}
|
@@ -0,0 +1,65 @@
|
|
1
|
+
import { defineComponent, openBlock, createElementBlock, normalizeClass, renderSlot, createBlock, resolveDynamicComponent, withCtx, withModifiers, createVNode, unref, createCommentVNode } from 'vue';
|
2
|
+
import IconCancel from '../../../assets/icons/default/IconCancel.svg.js';
|
3
|
+
|
4
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
5
|
+
__name: "SelectOptionPrefix",
|
6
|
+
props: {
|
7
|
+
option: {},
|
8
|
+
optionComponent: {},
|
9
|
+
disabled: { type: Boolean },
|
10
|
+
loading: { type: Boolean },
|
11
|
+
disableClear: { type: Boolean }
|
12
|
+
},
|
13
|
+
emits: ["unselect"],
|
14
|
+
setup(__props) {
|
15
|
+
return (_ctx, _cache) => {
|
16
|
+
return openBlock(), createElementBlock("div", {
|
17
|
+
class: normalizeClass(["relative grid grid-cols-[1fr,auto] items-center text-description group/model", {
|
18
|
+
"cursor-pointer": !_ctx.disabled,
|
19
|
+
"cursor-not-allowed opacity-50": _ctx.disabled
|
20
|
+
}])
|
21
|
+
}, [
|
22
|
+
renderSlot(_ctx.$slots, "option", {}, () => [
|
23
|
+
_ctx.optionComponent ? (openBlock(), createBlock(resolveDynamicComponent(_ctx.optionComponent), {
|
24
|
+
key: 0,
|
25
|
+
option: _ctx.option,
|
26
|
+
selected: true,
|
27
|
+
model: true
|
28
|
+
}, {
|
29
|
+
default: withCtx(() => [
|
30
|
+
!_ctx.disableClear ? (openBlock(), createElementBlock("button", {
|
31
|
+
key: 0,
|
32
|
+
class: normalizeClass(["relative flex square-5 rounded-full -my-1 -mr-2 ml-1 items-center justify-center outline-none", {
|
33
|
+
"cursor-not-allowed": _ctx.disabled,
|
34
|
+
"cursor-progress": _ctx.loading,
|
35
|
+
"cursor-pointer w-ripple w-ripple-hover ": !_ctx.loading && !_ctx.disabled
|
36
|
+
}]),
|
37
|
+
onMousedown: _cache[0] || (_cache[0] = withModifiers(() => {
|
38
|
+
}, ["stop", "prevent"])),
|
39
|
+
onClick: _cache[1] || (_cache[1] = withModifiers(($event) => !_ctx.loading && _ctx.$emit("unselect"), ["stop", "prevent"]))
|
40
|
+
}, [
|
41
|
+
createVNode(unref(IconCancel), { class: "square-3" })
|
42
|
+
], 34)) : createCommentVNode("", true)
|
43
|
+
]),
|
44
|
+
_: 1
|
45
|
+
}, 8, ["option"])) : createCommentVNode("", true)
|
46
|
+
]),
|
47
|
+
!_ctx.optionComponent && !_ctx.disableClear ? (openBlock(), createElementBlock("button", {
|
48
|
+
key: 0,
|
49
|
+
class: normalizeClass(["relative flex square-5 rounded-full items-center justify-center outline-none", {
|
50
|
+
"cursor-not-allowed": _ctx.disabled,
|
51
|
+
"cursor-progress": _ctx.loading,
|
52
|
+
"cursor-pointer w-ripple w-ripple-hover ": !_ctx.loading && !_ctx.disabled
|
53
|
+
}]),
|
54
|
+
onMousedown: _cache[2] || (_cache[2] = withModifiers(() => {
|
55
|
+
}, ["stop", "prevent"])),
|
56
|
+
onClick: _cache[3] || (_cache[3] = withModifiers(($event) => !_ctx.loading && _ctx.$emit("unselect"), ["stop", "prevent"]))
|
57
|
+
}, [
|
58
|
+
createVNode(unref(IconCancel), { class: "square-3" })
|
59
|
+
], 34)) : createCommentVNode("", true)
|
60
|
+
], 2);
|
61
|
+
};
|
62
|
+
}
|
63
|
+
});
|
64
|
+
|
65
|
+
export { _sfc_main as default };
|