eco-vue-js 0.3.70 → 0.3.71

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,19 +1,43 @@
1
1
  import { SemanticType } from '../../utils/SemanticType';
2
- declare const _default: <Model extends string | number | boolean | null>(__VLS_props: {
2
+ declare const _default: <Model extends string | number | boolean | null, Entity extends Record<string, unknown>>(__VLS_props: ({
3
3
  modelValue: Model;
4
4
  title?: string | undefined;
5
5
  list: Model[];
6
+ valueGetter: never;
6
7
  disabled?: boolean | undefined;
7
8
  loading?: string | number | undefined;
8
9
  minimize?: boolean | undefined;
9
10
  wrap?: boolean | undefined;
10
11
  semanticType?: SemanticType | undefined;
11
12
  stretch?: boolean | undefined;
12
- } & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, __VLS_ctx?: Pick<{
13
+ } | {
14
+ modelValue: Model;
15
+ title?: string | undefined;
16
+ list: Entity[];
17
+ valueGetter: (value: Entity) => Model;
18
+ disabled?: boolean | undefined;
19
+ loading?: string | number | undefined;
20
+ minimize?: boolean | undefined;
21
+ wrap?: boolean | undefined;
22
+ semanticType?: SemanticType | undefined;
23
+ stretch?: boolean | undefined;
24
+ }) & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, __VLS_ctx?: Pick<{
13
25
  props: {
14
26
  modelValue: Model;
15
27
  title?: string | undefined;
16
28
  list: Model[];
29
+ valueGetter: never;
30
+ disabled?: boolean | undefined;
31
+ loading?: string | number | undefined;
32
+ minimize?: boolean | undefined;
33
+ wrap?: boolean | undefined;
34
+ semanticType?: SemanticType | undefined;
35
+ stretch?: boolean | undefined;
36
+ } | {
37
+ modelValue: Model;
38
+ title?: string | undefined;
39
+ list: Entity[];
40
+ valueGetter: (value: Entity) => Model;
17
41
  disabled?: boolean | undefined;
18
42
  loading?: string | number | undefined;
19
43
  minimize?: boolean | undefined;
@@ -24,8 +48,9 @@ declare const _default: <Model extends string | number | boolean | null>(__VLS_p
24
48
  expose(exposed: {}): void;
25
49
  attrs: any;
26
50
  slots: {
51
+ title?(_: {}): any;
27
52
  default?(_: {
28
- item: Model;
53
+ item: Entity;
29
54
  }): any;
30
55
  };
31
56
  emit: (e: 'update:modelValue', value: Model) => void;
@@ -34,6 +59,18 @@ declare const _default: <Model extends string | number | boolean | null>(__VLS_p
34
59
  modelValue: Model;
35
60
  title?: string | undefined;
36
61
  list: Model[];
62
+ valueGetter: never;
63
+ disabled?: boolean | undefined;
64
+ loading?: string | number | undefined;
65
+ minimize?: boolean | undefined;
66
+ wrap?: boolean | undefined;
67
+ semanticType?: SemanticType | undefined;
68
+ stretch?: boolean | undefined;
69
+ } | {
70
+ modelValue: Model;
71
+ title?: string | undefined;
72
+ list: Entity[];
73
+ valueGetter: (value: Entity) => Model;
37
74
  disabled?: boolean | undefined;
38
75
  loading?: string | number | undefined;
39
76
  minimize?: boolean | undefined;
@@ -44,8 +81,9 @@ declare const _default: <Model extends string | number | boolean | null>(__VLS_p
44
81
  expose(exposed: {}): void;
45
82
  attrs: any;
46
83
  slots: {
84
+ title?(_: {}): any;
47
85
  default?(_: {
48
- item: Model;
86
+ item: Entity;
49
87
  }): any;
50
88
  };
51
89
  emit: (e: 'update:modelValue', value: Model) => void;
@@ -57,6 +95,18 @@ declare const _default: <Model extends string | number | boolean | null>(__VLS_p
57
95
  modelValue: Model;
58
96
  title?: string | undefined;
59
97
  list: Model[];
98
+ valueGetter: never;
99
+ disabled?: boolean | undefined;
100
+ loading?: string | number | undefined;
101
+ minimize?: boolean | undefined;
102
+ wrap?: boolean | undefined;
103
+ semanticType?: SemanticType | undefined;
104
+ stretch?: boolean | undefined;
105
+ } | {
106
+ modelValue: Model;
107
+ title?: string | undefined;
108
+ list: Entity[];
109
+ valueGetter: (value: Entity) => Model;
60
110
  disabled?: boolean | undefined;
61
111
  loading?: string | number | undefined;
62
112
  minimize?: boolean | undefined;
@@ -67,8 +117,9 @@ declare const _default: <Model extends string | number | boolean | null>(__VLS_p
67
117
  expose(exposed: {}): void;
68
118
  attrs: any;
69
119
  slots: {
120
+ title?(_: {}): any;
70
121
  default?(_: {
71
- item: Model;
122
+ item: Entity;
72
123
  }): any;
73
124
  };
74
125
  emit: (e: 'update:modelValue', value: Model) => void;
@@ -1 +1 @@
1
- {"version":3,"file":"WButtonGroup.vue.d.ts","sourceRoot":"","sources":["../../../../src/components/Button/WButtonGroup.vue.ts"],"names":[],"mappings":"AAGA,OAAO,EAAC,YAAY,EAAC,MAAM,sBAAsB,CAAA;;;;;;;;;;;;;;;;;;;;;;;yBAiKV,IAAI;WACpC,GAAG;;;;YA9BoB,GAAG;;cAyB3B,mBAAmB,mBAAiB,IAAI;;;;;;;;;;;;;yBAIP,IAAI;WACpC,GAAG;;;;YA9BoB,GAAG;;cAyB3B,mBAAmB,mBAAiB,IAAI;;;;;;;;;;;;;;;;6BAIP,IAAI;eACpC,GAAG;;;;gBA9BoB,GAAG;;kBAyB3B,mBAAmB,mBAAiB,IAAI;;;AA3J9C,wBAoKkE"}
1
+ {"version":3,"file":"WButtonGroup.vue.d.ts","sourceRoot":"","sources":["../../../../src/components/Button/WButtonGroup.vue.ts"],"names":[],"mappings":"AAGA,OAAO,EAAC,YAAY,EAAC,MAAM,sBAAsB,CAAA;;;;;iBAWlC,KAAK;;;;;;;;;;;;;;;;;;;;;;;qBAAL,KAAK;;;;;;;;;;;;;;;;;;;yBA6KmB,IAAI;WACpC,GAAG;;uBAtBkB,GAAG;;;YACD,GAAG;;cAgB3B,mBAAmB,mBAAiB,IAAI;;;;;;qBAzK/B,KAAK;;;;;;;;;;;;;;;;;;;yBA6KmB,IAAI;WACpC,GAAG;;uBAtBkB,GAAG;;;YACD,GAAG;;cAgB3B,mBAAmB,mBAAiB,IAAI;;;;;;;;;yBAzK/B,KAAK;;;;;;;;;;;;;;;;;;;6BA6KmB,IAAI;eACpC,GAAG;;2BAtBkB,GAAG;;;gBACD,GAAG;;kBAgB3B,mBAAmB,mBAAiB,IAAI;;;AAlL9C,wBA2LkE"}
@@ -1,4 +1,4 @@
1
- import { defineComponent, openBlock, createElementBlock, normalizeClass, toDisplayString, createCommentVNode, createElementVNode, Fragment, renderList, createBlock, unref, withCtx, renderSlot } from 'vue';
1
+ import { defineComponent, openBlock, createElementBlock, normalizeClass, renderSlot, createTextVNode, toDisplayString, createCommentVNode, createElementVNode, Fragment, renderList, createBlock, unref, withCtx } from 'vue';
2
2
  import _sfc_main$1 from './WButton.vue.js';
3
3
  import { SemanticType } from '../../utils/SemanticType.js';
4
4
 
@@ -8,6 +8,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
8
8
  modelValue: {},
9
9
  title: {},
10
10
  list: {},
11
+ valueGetter: { type: Function },
11
12
  disabled: { type: Boolean },
12
13
  loading: {},
13
14
  minimize: { type: Boolean },
@@ -17,12 +18,24 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
17
18
  },
18
19
  emits: ["update:modelValue"],
19
20
  setup(__props) {
21
+ const props = __props;
22
+ const getValue = (item) => {
23
+ if ("valueGetter" in props && typeof item === "object") {
24
+ return props.valueGetter(item);
25
+ } else {
26
+ return item;
27
+ }
28
+ };
20
29
  return (_ctx, _cache) => {
21
30
  return openBlock(), createElementBlock("div", null, [
22
- _ctx.title ? (openBlock(), createElementBlock("div", {
31
+ _ctx.title || _ctx.$slots.title?.().length ? (openBlock(), createElementBlock("div", {
23
32
  key: 0,
24
33
  class: normalizeClass(["text-xs font-semibold text-accent mb-2", { "opacity-60": _ctx.disabled }])
25
- }, toDisplayString(_ctx.title), 3)) : createCommentVNode("", true),
34
+ }, [
35
+ renderSlot(_ctx.$slots, "title", {}, () => [
36
+ createTextVNode(toDisplayString(_ctx.title), 1)
37
+ ])
38
+ ], 2)) : createCommentVNode("", true),
26
39
  createElementVNode("div", {
27
40
  class: normalizeClass(["flex px-px", {
28
41
  "flex-wrap gap-2": _ctx.wrap
@@ -31,21 +44,23 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
31
44
  (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.list, (item, index) => {
32
45
  return openBlock(), createBlock(_sfc_main$1, {
33
46
  key: index,
34
- "semantic-type": item === _ctx.modelValue ? _ctx.semanticType ?? unref(SemanticType).PRIMARY : unref(SemanticType).SECONDARY,
35
- loading: item === _ctx.loading,
36
- disabled: _ctx.disabled || _ctx.loading !== void 0 && item !== _ctx.loading,
47
+ "semantic-type": getValue(item) === _ctx.modelValue ? _ctx.semanticType ?? unref(SemanticType).PRIMARY : unref(SemanticType).SECONDARY,
48
+ loading: getValue(item) === _ctx.loading,
49
+ disabled: _ctx.disabled || _ctx.loading !== void 0 && getValue(item) !== _ctx.loading,
37
50
  minimize: _ctx.minimize,
38
51
  class: normalizeClass(_ctx.wrap ? [
39
- item !== _ctx.modelValue && "-mx-px"
52
+ getValue(item) !== _ctx.modelValue && "-mx-px"
40
53
  ] : [
41
- index !== _ctx.list.length - 1 ? "rounded-r-none border-r-0" : item !== _ctx.modelValue && "-mr-px",
42
- index !== 0 ? "rounded-l-none border-l-0" : item !== _ctx.modelValue && "-ml-px",
54
+ index !== _ctx.list.length - 1 ? "rounded-r-none border-r-0" : getValue(item) !== _ctx.modelValue && "-mr-px",
55
+ index !== 0 ? "rounded-l-none border-l-0" : getValue(item) !== _ctx.modelValue && "-ml-px",
43
56
  _ctx.stretch ? "flex-1" : void 0
44
57
  ]),
45
- onClick: ($event) => item !== _ctx.modelValue && _ctx.$emit("update:modelValue", item)
58
+ onClick: ($event) => getValue(item) !== _ctx.modelValue && _ctx.$emit("update:modelValue", getValue(item))
46
59
  }, {
47
60
  default: withCtx(() => [
48
- renderSlot(_ctx.$slots, "default", { item })
61
+ renderSlot(_ctx.$slots, "default", {
62
+ item
63
+ })
49
64
  ]),
50
65
  _: 2
51
66
  }, 1032, ["semantic-type", "loading", "disabled", "minimize", "class", "onClick"]);
@@ -103,7 +103,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
103
103
  key: 0,
104
104
  "parent-element": tooltipMeta.value.parent,
105
105
  "horizontal-align": unref(HorizontalAlign).CENTER,
106
- "max-height": 120,
106
+ "max-height": 200,
107
107
  "max-width": 240,
108
108
  "emit-update": "",
109
109
  class: "z-[10000] [--arrow-size:8px] transition-[top,bottom,left,right]",
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.3.70",
7
+ "version": "0.3.71",
8
8
  "scripts": {
9
9
  "dev": "vite",
10
10
  "build": "run-p type-check build-only",