eco-vue-js 0.5.16 → 0.5.18

Sign up to get free protection for your applications and to get access to all the features.
@@ -4,6 +4,7 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__
4
4
  contentMaxHeight?: number | undefined;
5
5
  contentMaxWidth?: number | undefined;
6
6
  horizontalAlign?: HorizontalAlign | undefined;
7
+ leftToggle?: boolean | undefined;
7
8
  disabled?: boolean | undefined;
8
9
  teleport?: boolean | undefined;
9
10
  }>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<__VLS_TypePropsToRuntimeProps<{
@@ -11,6 +12,7 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__
11
12
  contentMaxHeight?: number | undefined;
12
13
  contentMaxWidth?: number | undefined;
13
14
  horizontalAlign?: HorizontalAlign | undefined;
15
+ leftToggle?: boolean | undefined;
14
16
  disabled?: boolean | undefined;
15
17
  teleport?: boolean | undefined;
16
18
  }>>>, {}, {}>, {
@@ -1 +1 @@
1
- {"version":3,"file":"WButtonDropdown.vue.d.ts","sourceRoot":"","sources":["../../../src/components/Button/WButtonDropdown.vue"],"names":[],"mappings":"AAiDA;AAEA,OAAO,EAAC,eAAe,EAAE,KAAK,YAAY,EAAC,MAAM,QAAQ,CAAA;;;;;;;;;;;;;;;;;;;;AA8MzD,wBAAwG;AACxG,KAAK,sBAAsB,CAAC,CAAC,IAAI,CAAC,SAAS,SAAS,GAAG,KAAK,GAAG,CAAC,CAAC;AACjE,KAAK,6BAA6B,CAAC,CAAC,IAAI;KAAG,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,GAAG,EAAE,SAAS,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG;QAAE,IAAI,EAAE,OAAO,KAAK,EAAE,QAAQ,CAAC,sBAAsB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;KAAE,GAAG;QAAE,IAAI,EAAE,OAAO,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QAAC,QAAQ,EAAE,IAAI,CAAA;KAAE;CAAE,CAAC;AAC9M,KAAK,uBAAuB,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG;IAAE,QAAO;QAClD,MAAM,EAAE,CAAC,CAAC;KACT,CAAA;CAAE,CAAC"}
1
+ {"version":3,"file":"WButtonDropdown.vue.d.ts","sourceRoot":"","sources":["../../../src/components/Button/WButtonDropdown.vue"],"names":[],"mappings":"AA+DA;AAEA,OAAO,EAAC,eAAe,EAAE,KAAK,YAAY,EAAC,MAAM,QAAQ,CAAA;;;;;;;;;;;;;;;;;;;;;;AAqPzD,wBAAwG;AACxG,KAAK,sBAAsB,CAAC,CAAC,IAAI,CAAC,SAAS,SAAS,GAAG,KAAK,GAAG,CAAC,CAAC;AACjE,KAAK,6BAA6B,CAAC,CAAC,IAAI;KAAG,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,GAAG,EAAE,SAAS,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG;QAAE,IAAI,EAAE,OAAO,KAAK,EAAE,QAAQ,CAAC,sBAAsB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;KAAE,GAAG;QAAE,IAAI,EAAE,OAAO,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QAAC,QAAQ,EAAE,IAAI,CAAA;KAAE;CAAE,CAAC;AAC9M,KAAK,uBAAuB,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG;IAAE,QAAO;QAClD,MAAM,EAAE,CAAC,CAAC;KACT,CAAA;CAAE,CAAC"}
@@ -1,4 +1,4 @@
1
- import { defineComponent, ref, openBlock, createBlock, unref, withCtx, createElementVNode, createElementBlock, Fragment, renderList, resolveDynamicComponent, createVNode, normalizeClass, renderSlot } from 'vue';
1
+ import { defineComponent, ref, openBlock, createBlock, unref, withCtx, createElementVNode, createVNode, normalizeClass, createCommentVNode, createElementBlock, Fragment, renderList, resolveDynamicComponent, renderSlot } from 'vue';
2
2
  import IconArrow from '../../assets/icons/default/IconArrow.svg.js';
3
3
  import './WButtonAction.vue.js';
4
4
  import _sfc_main$2 from './WButton.vue.js';
@@ -20,6 +20,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
20
20
  contentMaxHeight: {},
21
21
  contentMaxWidth: {},
22
22
  horizontalAlign: {},
23
+ leftToggle: { type: Boolean },
23
24
  disabled: { type: Boolean },
24
25
  teleport: { type: Boolean }
25
26
  },
@@ -39,6 +40,20 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
39
40
  }, {
40
41
  toggle: withCtx(() => [
41
42
  createElementVNode("div", _hoisted_1, [
43
+ _ctx.leftToggle ? (openBlock(), createBlock(_sfc_main$2, {
44
+ key: 0,
45
+ "semantic-type": _ctx.semanticType,
46
+ disabled: _ctx.disabled,
47
+ join: "",
48
+ onClick: _cache[0] || (_cache[0] = ($event) => isOpen.value = !isOpen.value)
49
+ }, {
50
+ default: withCtx(() => [
51
+ createVNode(unref(IconArrow), {
52
+ class: normalizeClass(["square-4 transition-transform", { "rotate-180": isOpen.value }])
53
+ }, null, 8, ["class"])
54
+ ]),
55
+ _: 1
56
+ }, 8, ["semantic-type", "disabled"])) : createCommentVNode("", true),
42
57
  (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.$slots.button?.(), (item, index) => {
43
58
  return openBlock(), createBlock(resolveDynamicComponent(item), {
44
59
  key: index,
@@ -46,11 +61,12 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
46
61
  class: "flex-1"
47
62
  });
48
63
  }), 128)),
49
- createVNode(_sfc_main$2, {
64
+ !_ctx.leftToggle ? (openBlock(), createBlock(_sfc_main$2, {
65
+ key: 1,
50
66
  "semantic-type": _ctx.semanticType,
51
67
  disabled: _ctx.disabled,
52
68
  join: "",
53
- onClick: _cache[0] || (_cache[0] = ($event) => isOpen.value = !isOpen.value)
69
+ onClick: _cache[1] || (_cache[1] = ($event) => isOpen.value = !isOpen.value)
54
70
  }, {
55
71
  default: withCtx(() => [
56
72
  createVNode(unref(IconArrow), {
@@ -58,7 +74,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
58
74
  }, null, 8, ["class"])
59
75
  ]),
60
76
  _: 1
61
- }, 8, ["semantic-type", "disabled"])
77
+ }, 8, ["semantic-type", "disabled"])) : createCommentVNode("", true)
62
78
  ])
63
79
  ]),
64
80
  content: withCtx(() => [
@@ -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
- }): any;
47
- right?(_: {}): any;
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
- }): any;
110
- right?(_: {}): any;
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
- }): any;
173
- right?(_: {}): any;
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":"AA2KA;AAEA,OAAO,EAAwC,KAAK,SAAS,EAAC,MAAM,KAAK,CAAA;;;YA2nB/D,MAAM;;;;;;;;gBADF,IAAI,EAAE;;;;;;;;;;;;;;;aAET,IAAI,EAAE;;;gBAOsB,IAAI;;;;;;;;;;WAwBpC,GAAG;;;;;;YAtEoB,GAAG;uBACL,GAAG;;;YA1iBzB,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;;;;;OAymBiC,IAAI;;;gBA/BjE,MAAM;;;;;;;;oBADF,IAAI,EAAE;;;;;;;;;;;;;;;iBAET,IAAI,EAAE;;;oBAOsB,IAAI;;;;;;;;;;;;;SAuB4B,IAAI;WACpE,GAAG;;;;;;YAtEoB,GAAG;uBACL,GAAG;;;YA1iBzB,QAAQ,QAAQ,IAAI,GAAG,IAAI;YAC3B,UAAU,QAAQ,IAAI,G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BAxJd,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, normalizeClass, renderSlot, resolveDynamicComponent, createVNode, createCommentVNode, createElementVNode, toDisplayString } from 'vue';
2
- import _sfc_main$2 from './components/SelectOption.vue.js';
3
- import IconCancel from '../../assets/icons/default/IconCancel.svg.js';
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 = ["onClick"];
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 _hoisted_4 = { class: "select-none cursor-default w-select-field sm-not:px-3" };
15
- const _hoisted_5 = /* @__PURE__ */ createElementVNode("span", { class: "w-select-field pr-2 sm-not:px-3" }, " Create: ", -1);
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[4] || (_cache[4] = ($event) => !_ctx.loading && _ctx.$emit("update:search", $event ?? "")),
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[5] || (_cache[5] = ($event) => isOpen.value = true),
182
- onClose: _cache[6] || (_cache[6] = ($event) => {
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[7] || (_cache[7] = ($event) => {
184
+ onFocus: _cache[5] || (_cache[5] = ($event) => {
187
185
  focused.value = true;
188
186
  _ctx.$emit("focus", $event);
189
187
  }),
190
- onBlur: _cache[8] || (_cache[8] = ($event) => {
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(), createElementBlock("div", {
195
+ return openBlock(), createBlock(_sfc_main$2, {
198
196
  key: option,
199
- class: normalizeClass(["relative flex overflow-hidden items-center text-description group/model", {
200
- "cursor-pointer": !_ctx.disabled,
201
- "cursor-not-allowed opacity-50": _ctx.disabled
202
- }])
203
- }, [
204
- renderSlot(_ctx.$slots, "option", {
205
- option,
206
- selected: true,
207
- model: true
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
- !_ctx.optionComponent && !_ctx.disableClear ? (openBlock(), createElementBlock("button", {
234
- key: 0,
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", _hoisted_3, [
251
- createElementVNode("div", _hoisted_4, toDisplayString(_ctx.emptyStub ?? "No match"), 1)
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$2, {
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$2, {
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[2] || (_cache[2] = ($event) => createOption(_ctx.search)),
297
- onMouseenter: _cache[3] || (_cache[3] = ($event) => setCursor(_ctx.options.length))
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
- _hoisted_5,
266
+ _hoisted_3,
301
267
  renderSlot(_ctx.$slots, "option", {
302
268
  option: _ctx.search,
303
269
  selected: false,
@@ -52,7 +52,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
52
52
  const isMobile = getIsMobile();
53
53
  const focused = ref(false);
54
54
  const isFetchingPrefix = ref(false);
55
- const isDisabled = computed(() => props.loading || isFetchingPrefix.value || props.readonly || props.disabled);
55
+ const isDisabled = computed(() => props.loading || props.readonly || props.disabled);
56
56
  const close = () => {
57
57
  isOpen.value = false;
58
58
  focused.value = 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;
@@ -27,11 +27,12 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
27
27
  const emit = __emit;
28
28
  const element = ref();
29
29
  const toggle = () => {
30
+ if (props.skeleton || props.loading)
31
+ return;
30
32
  if (props.isSelected)
31
33
  emit("unselect");
32
34
  else
33
35
  emit("select");
34
- return false;
35
36
  };
36
37
  const scrollIntoView = () => {
37
38
  element.value?.scrollIntoView({ behavior: "auto", block: "center" });
@@ -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 };
@@ -0,0 +1,5 @@
1
+ import _sfc_main from './SelectOptionPrefix.vue.js';
2
+
3
+
4
+
5
+ export { _sfc_main as default };
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "type": "git",
5
5
  "url": "https://github.com/rsmple/eco-vue-js.git"
6
6
  },
7
- "version": "0.5.16",
7
+ "version": "0.5.18",
8
8
  "scripts": {
9
9
  "dev": "vite",
10
10
  "build": "run-p type-check build-only",