straw-ui-vue 0.1.0
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/README.md +42 -0
- package/dist/_virtual/_plugin-vue_export-helper.cjs +1 -0
- package/dist/_virtual/_plugin-vue_export-helper.js +8 -0
- package/dist/components/st-button/index.d.ts +162 -0
- package/dist/components/st-button/st-button.vue.cjs +1 -0
- package/dist/components/st-button/st-button.vue.d.ts +29 -0
- package/dist/components/st-button/st-button.vue.js +5 -0
- package/dist/components/st-button/st-button.vue_vue_type_script_setup_true_lang.cjs +1 -0
- package/dist/components/st-button/st-button.vue_vue_type_script_setup_true_lang.js +81 -0
- package/dist/components/st-button/types.d.ts +49 -0
- package/dist/components/st-button.cjs +1 -0
- package/dist/components/st-button.js +6 -0
- package/dist/components/st-checkbox/index.d.ts +153 -0
- package/dist/components/st-checkbox/st-checkbox.vue.cjs +1 -0
- package/dist/components/st-checkbox/st-checkbox.vue.d.ts +27 -0
- package/dist/components/st-checkbox/st-checkbox.vue.js +5 -0
- package/dist/components/st-checkbox/st-checkbox.vue_vue_type_script_setup_true_lang.cjs +1 -0
- package/dist/components/st-checkbox/st-checkbox.vue_vue_type_script_setup_true_lang.js +109 -0
- package/dist/components/st-checkbox/types.d.ts +20 -0
- package/dist/components/st-checkbox-group/index.d.ts +171 -0
- package/dist/components/st-checkbox-group/st-checkbox-group.vue.cjs +1 -0
- package/dist/components/st-checkbox-group/st-checkbox-group.vue.d.ts +29 -0
- package/dist/components/st-checkbox-group/st-checkbox-group.vue.js +5 -0
- package/dist/components/st-checkbox-group/st-checkbox-group.vue_vue_type_script_setup_true_lang.cjs +1 -0
- package/dist/components/st-checkbox-group/st-checkbox-group.vue_vue_type_script_setup_true_lang.js +63 -0
- package/dist/components/st-checkbox-group/types.d.ts +43 -0
- package/dist/components/st-checkbox-group.cjs +1 -0
- package/dist/components/st-checkbox-group.js +6 -0
- package/dist/components/st-checkbox.cjs +1 -0
- package/dist/components/st-checkbox.js +6 -0
- package/dist/components/st-dialog/index.d.ts +243 -0
- package/dist/components/st-dialog/st-dialog.vue.cjs +1 -0
- package/dist/components/st-dialog/st-dialog.vue.d.ts +41 -0
- package/dist/components/st-dialog/st-dialog.vue.js +5 -0
- package/dist/components/st-dialog/st-dialog.vue_vue_type_script_setup_true_lang.cjs +1 -0
- package/dist/components/st-dialog/st-dialog.vue_vue_type_script_setup_true_lang.js +175 -0
- package/dist/components/st-dialog/types.d.ts +29 -0
- package/dist/components/st-dialog.cjs +1 -0
- package/dist/components/st-dialog.js +6 -0
- package/dist/components/st-input/index.d.ts +315 -0
- package/dist/components/st-input/st-input.vue.cjs +1 -0
- package/dist/components/st-input/st-input.vue.d.ts +48 -0
- package/dist/components/st-input/st-input.vue.js +7 -0
- package/dist/components/st-input/st-input.vue_vue_type_script_setup_true_lang.cjs +1 -0
- package/dist/components/st-input/st-input.vue_vue_type_script_setup_true_lang.js +146 -0
- package/dist/components/st-input/types.d.ts +68 -0
- package/dist/components/st-input.cjs +1 -0
- package/dist/components/st-input.js +6 -0
- package/dist/components/st-menu/index.d.ts +217 -0
- package/dist/components/st-menu/st-menu-node.vue.cjs +1 -0
- package/dist/components/st-menu/st-menu-node.vue.d.ts +14 -0
- package/dist/components/st-menu/st-menu-node.vue.js +5 -0
- package/dist/components/st-menu/st-menu-node.vue_vue_type_script_setup_true_lang.cjs +1 -0
- package/dist/components/st-menu/st-menu-node.vue_vue_type_script_setup_true_lang.js +107 -0
- package/dist/components/st-menu/st-menu.vue.cjs +1 -0
- package/dist/components/st-menu/st-menu.vue.d.ts +26 -0
- package/dist/components/st-menu/st-menu.vue.js +5 -0
- package/dist/components/st-menu/st-menu.vue_vue_type_script_setup_true_lang.cjs +1 -0
- package/dist/components/st-menu/st-menu.vue_vue_type_script_setup_true_lang.js +86 -0
- package/dist/components/st-menu/types.d.ts +82 -0
- package/dist/components/st-menu.cjs +1 -0
- package/dist/components/st-menu.js +7 -0
- package/dist/components/st-popover/index.d.ts +243 -0
- package/dist/components/st-popover/st-popover.vue.cjs +1 -0
- package/dist/components/st-popover/st-popover.vue.d.ts +37 -0
- package/dist/components/st-popover/st-popover.vue.js +5 -0
- package/dist/components/st-popover/st-popover.vue_vue_type_script_setup_true_lang.cjs +1 -0
- package/dist/components/st-popover/st-popover.vue_vue_type_script_setup_true_lang.js +355 -0
- package/dist/components/st-popover/types.d.ts +103 -0
- package/dist/components/st-popover.cjs +1 -0
- package/dist/components/st-popover.js +6 -0
- package/dist/components/st-radio/index.d.ts +135 -0
- package/dist/components/st-radio/st-radio.vue.cjs +1 -0
- package/dist/components/st-radio/st-radio.vue.d.ts +28 -0
- package/dist/components/st-radio/st-radio.vue.js +5 -0
- package/dist/components/st-radio/st-radio.vue_vue_type_script_setup_true_lang.cjs +1 -0
- package/dist/components/st-radio/st-radio.vue_vue_type_script_setup_true_lang.js +88 -0
- package/dist/components/st-radio/types.d.ts +15 -0
- package/dist/components/st-radio-group/index.d.ts +180 -0
- package/dist/components/st-radio-group/st-radio-group.vue.cjs +1 -0
- package/dist/components/st-radio-group/st-radio-group.vue.d.ts +35 -0
- package/dist/components/st-radio-group/st-radio-group.vue.js +5 -0
- package/dist/components/st-radio-group/st-radio-group.vue_vue_type_script_setup_true_lang.cjs +1 -0
- package/dist/components/st-radio-group/st-radio-group.vue_vue_type_script_setup_true_lang.js +66 -0
- package/dist/components/st-radio-group/types.d.ts +43 -0
- package/dist/components/st-radio-group.cjs +1 -0
- package/dist/components/st-radio-group.js +6 -0
- package/dist/components/st-radio.cjs +1 -0
- package/dist/components/st-radio.js +6 -0
- package/dist/components/st-select/index.d.ts +306 -0
- package/dist/components/st-select/st-select.vue.cjs +1 -0
- package/dist/components/st-select/st-select.vue.d.ts +47 -0
- package/dist/components/st-select/st-select.vue.js +5 -0
- package/dist/components/st-select/st-select.vue_vue_type_script_setup_true_lang.cjs +1 -0
- package/dist/components/st-select/st-select.vue_vue_type_script_setup_true_lang.js +200 -0
- package/dist/components/st-select/types.d.ts +85 -0
- package/dist/components/st-select.cjs +1 -0
- package/dist/components/st-select.js +6 -0
- package/dist/components/st-sidebar/index.d.ts +63 -0
- package/dist/components/st-sidebar/st-sidebar.vue.cjs +1 -0
- package/dist/components/st-sidebar/st-sidebar.vue.d.ts +11 -0
- package/dist/components/st-sidebar/st-sidebar.vue.js +5 -0
- package/dist/components/st-sidebar/st-sidebar.vue_vue_type_script_setup_true_lang.cjs +1 -0
- package/dist/components/st-sidebar/st-sidebar.vue_vue_type_script_setup_true_lang.js +108 -0
- package/dist/components/st-sidebar/types.d.ts +56 -0
- package/dist/components/st-sidebar-item/index.d.ts +63 -0
- package/dist/components/st-sidebar-item/st-sidebar-item.vue.cjs +1 -0
- package/dist/components/st-sidebar-item/st-sidebar-item.vue.d.ts +11 -0
- package/dist/components/st-sidebar-item/st-sidebar-item.vue.js +5 -0
- package/dist/components/st-sidebar-item/st-sidebar-item.vue_vue_type_script_setup_true_lang.cjs +1 -0
- package/dist/components/st-sidebar-item/st-sidebar-item.vue_vue_type_script_setup_true_lang.js +38 -0
- package/dist/components/st-sidebar-item/types.d.ts +19 -0
- package/dist/components/st-sidebar-item.cjs +1 -0
- package/dist/components/st-sidebar-item.js +6 -0
- package/dist/components/st-sidebar.cjs +1 -0
- package/dist/components/st-sidebar.js +6 -0
- package/dist/components/st-splitter/index.d.ts +88 -0
- package/dist/components/st-splitter/st-splitter.vue.cjs +1 -0
- package/dist/components/st-splitter/st-splitter.vue.d.ts +16 -0
- package/dist/components/st-splitter/st-splitter.vue.js +5 -0
- package/dist/components/st-splitter/st-splitter.vue_vue_type_script_setup_true_lang.cjs +1 -0
- package/dist/components/st-splitter/st-splitter.vue_vue_type_script_setup_true_lang.js +29 -0
- package/dist/components/st-splitter/types.d.ts +192 -0
- package/dist/components/st-splitter/useSplitter.cjs +1 -0
- package/dist/components/st-splitter/useSplitter.d.ts +24 -0
- package/dist/components/st-splitter/useSplitter.js +129 -0
- package/dist/components/st-splitter-panel/index.d.ts +180 -0
- package/dist/components/st-splitter-panel/st-splitter-panel.vue.cjs +1 -0
- package/dist/components/st-splitter-panel/st-splitter-panel.vue.d.ts +33 -0
- package/dist/components/st-splitter-panel/st-splitter-panel.vue.js +5 -0
- package/dist/components/st-splitter-panel/st-splitter-panel.vue_vue_type_script_setup_true_lang.cjs +1 -0
- package/dist/components/st-splitter-panel/st-splitter-panel.vue_vue_type_script_setup_true_lang.js +164 -0
- package/dist/components/st-splitter-panel/types.d.ts +27 -0
- package/dist/components/st-splitter-panel.cjs +1 -0
- package/dist/components/st-splitter-panel.js +6 -0
- package/dist/components/st-splitter.cjs +1 -0
- package/dist/components/st-splitter.js +7 -0
- package/dist/components/st-toggle/index.d.ts +159 -0
- package/dist/components/st-toggle/st-toggle.vue.cjs +1 -0
- package/dist/components/st-toggle/st-toggle.vue.d.ts +25 -0
- package/dist/components/st-toggle/st-toggle.vue.js +5 -0
- package/dist/components/st-toggle/st-toggle.vue_vue_type_script_setup_true_lang.cjs +1 -0
- package/dist/components/st-toggle/st-toggle.vue_vue_type_script_setup_true_lang.js +62 -0
- package/dist/components/st-toggle/types.d.ts +38 -0
- package/dist/components/st-toggle.cjs +1 -0
- package/dist/components/st-toggle.js +6 -0
- package/dist/components/st-tooltip/index.d.ts +183 -0
- package/dist/components/st-tooltip/st-tooltip.vue.cjs +1 -0
- package/dist/components/st-tooltip/st-tooltip.vue.d.ts +29 -0
- package/dist/components/st-tooltip/st-tooltip.vue.js +5 -0
- package/dist/components/st-tooltip/st-tooltip.vue_vue_type_script_setup_true_lang.cjs +1 -0
- package/dist/components/st-tooltip/st-tooltip.vue_vue_type_script_setup_true_lang.js +71 -0
- package/dist/components/st-tooltip/types.d.ts +79 -0
- package/dist/components/st-tooltip.cjs +1 -0
- package/dist/components/st-tooltip.js +6 -0
- package/dist/components/st-tree/index.d.ts +114 -0
- package/dist/components/st-tree/st-tree-node.vue.cjs +1 -0
- package/dist/components/st-tree/st-tree-node.vue.d.ts +4 -0
- package/dist/components/st-tree/st-tree-node.vue.js +5 -0
- package/dist/components/st-tree/st-tree-node.vue_vue_type_script_setup_true_lang.cjs +1 -0
- package/dist/components/st-tree/st-tree-node.vue_vue_type_script_setup_true_lang.js +87 -0
- package/dist/components/st-tree/st-tree.vue.cjs +1 -0
- package/dist/components/st-tree/st-tree.vue.d.ts +50 -0
- package/dist/components/st-tree/st-tree.vue.js +5 -0
- package/dist/components/st-tree/st-tree.vue_vue_type_script_setup_true_lang.cjs +1 -0
- package/dist/components/st-tree/st-tree.vue_vue_type_script_setup_true_lang.js +59 -0
- package/dist/components/st-tree/types.d.ts +87 -0
- package/dist/components/st-tree.cjs +1 -0
- package/dist/components/st-tree.js +6 -0
- package/dist/components/types.d.ts +41 -0
- package/dist/index.cjs +1 -0
- package/dist/index.css +2 -0
- package/dist/index.d.ts +3005 -0
- package/dist/index.js +47 -0
- package/dist/utils/cn.cjs +1 -0
- package/dist/utils/cn.d.ts +11 -0
- package/dist/utils/cn.js +8 -0
- package/dist/utils/cva/index.cjs +1 -0
- package/dist/utils/cva/index.d.ts +9 -0
- package/dist/utils/cva/index.js +25 -0
- package/dist/utils/cva/types.d.ts +45 -0
- package/dist/utils/directive/index.cjs +1 -0
- package/dist/utils/directive/index.d.ts +4 -0
- package/dist/utils/directive/index.js +10 -0
- package/dist/utils/directive/intersection.cjs +1 -0
- package/dist/utils/directive/intersection.d.ts +6 -0
- package/dist/utils/directive/intersection.js +20 -0
- package/dist/utils/directive/interval.cjs +1 -0
- package/dist/utils/directive/interval.d.ts +6 -0
- package/dist/utils/directive/interval.js +14 -0
- package/dist/utils/directive/move.cjs +1 -0
- package/dist/utils/directive/move.d.ts +6 -0
- package/dist/utils/directive/move.js +42 -0
- package/dist/utils/directive/resize.cjs +1 -0
- package/dist/utils/directive/resize.d.ts +6 -0
- package/dist/utils/directive/resize.js +17 -0
- package/dist/utils/with-install.cjs +1 -0
- package/dist/utils/with-install.d.ts +4 -0
- package/dist/utils/with-install.js +10 -0
- package/package.json +87 -0
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import { cn as e } from "../../utils/cn.js";
|
|
2
|
+
import { cva as t } from "../../utils/cva/index.js";
|
|
3
|
+
import { computed as n, createCommentVNode as r, createElementBlock as i, createElementVNode as a, defineComponent as o, inject as s, mergeModels as c, normalizeClass as l, normalizeStyle as u, openBlock as d, renderSlot as f, unref as p, useAttrs as m, useModel as h, useSlots as g } from "vue";
|
|
4
|
+
//#region src/components/st-checkbox/st-checkbox.vue?vue&type=script&setup=true&lang.ts
|
|
5
|
+
var _ = ["checked", "disabled"], v = /*@__PURE__*/ o({
|
|
6
|
+
inheritAttrs: !1,
|
|
7
|
+
__name: "st-checkbox",
|
|
8
|
+
props: /*@__PURE__*/ c({
|
|
9
|
+
disabled: {
|
|
10
|
+
type: Boolean,
|
|
11
|
+
default: !1
|
|
12
|
+
},
|
|
13
|
+
trueValue: {
|
|
14
|
+
type: [
|
|
15
|
+
Boolean,
|
|
16
|
+
String,
|
|
17
|
+
Number
|
|
18
|
+
],
|
|
19
|
+
default: !0
|
|
20
|
+
},
|
|
21
|
+
falseValue: {
|
|
22
|
+
type: [
|
|
23
|
+
Boolean,
|
|
24
|
+
String,
|
|
25
|
+
Number
|
|
26
|
+
],
|
|
27
|
+
default: !1
|
|
28
|
+
}
|
|
29
|
+
}, {
|
|
30
|
+
modelValue: {
|
|
31
|
+
type: [
|
|
32
|
+
Boolean,
|
|
33
|
+
String,
|
|
34
|
+
Number
|
|
35
|
+
],
|
|
36
|
+
default: !1
|
|
37
|
+
},
|
|
38
|
+
modelModifiers: {}
|
|
39
|
+
}),
|
|
40
|
+
emits: ["update:modelValue"],
|
|
41
|
+
setup(o) {
|
|
42
|
+
let c = o, v = h(o, "modelValue"), y = g(), b = m(), x = s("checkboxGroup", null), S = n(() => !!y.default), C = n(() => x && x.disabled.value || c.disabled), w = n(() => x ? x.modelValue.value.includes(c.trueValue) : v.value === c.trueValue), T = t({
|
|
43
|
+
base: "inline-flex items-center cursor-pointer select-none gap-2",
|
|
44
|
+
variants: { disabled: {
|
|
45
|
+
true: "cursor-not-allowed opacity-50",
|
|
46
|
+
false: ""
|
|
47
|
+
} }
|
|
48
|
+
}), E = n(() => e(T({ disabled: C.value }), b.class)), D = n(() => e("sr-only")), O = t({
|
|
49
|
+
base: "flex items-center justify-center border-2 rounded-radius transition-all duration-200 w-5 h-5",
|
|
50
|
+
variants: {
|
|
51
|
+
checked: {
|
|
52
|
+
true: "bg-primary border-primary",
|
|
53
|
+
false: "bg-background border-input hover:border-ring"
|
|
54
|
+
},
|
|
55
|
+
disabled: {
|
|
56
|
+
true: "cursor-not-allowed",
|
|
57
|
+
false: "cursor-pointer"
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}), k = n(() => O({
|
|
61
|
+
checked: w.value,
|
|
62
|
+
disabled: C.value
|
|
63
|
+
})), A = n(() => e("text-primary-foreground w-2.5 h-2.5")), j = n(() => e("w-full h-full")), M = t({
|
|
64
|
+
base: "text-foreground text-sm",
|
|
65
|
+
variants: { disabled: {
|
|
66
|
+
true: "text-muted-foreground",
|
|
67
|
+
false: ""
|
|
68
|
+
} }
|
|
69
|
+
}), N = n(() => M({ disabled: C.value })), P = (e) => {
|
|
70
|
+
C.value && e.preventDefault();
|
|
71
|
+
}, F = () => {
|
|
72
|
+
C.value || (x ? x.updateValue(c.trueValue, !w.value) : v.value = w.value ? c.falseValue : c.trueValue);
|
|
73
|
+
};
|
|
74
|
+
return (e, t) => (d(), i("label", {
|
|
75
|
+
class: l(E.value),
|
|
76
|
+
style: u(p(b).style),
|
|
77
|
+
onClick: P
|
|
78
|
+
}, [
|
|
79
|
+
a("input", {
|
|
80
|
+
checked: w.value,
|
|
81
|
+
class: l(D.value),
|
|
82
|
+
disabled: C.value,
|
|
83
|
+
type: "checkbox",
|
|
84
|
+
onChange: F
|
|
85
|
+
}, null, 42, _),
|
|
86
|
+
a("span", { class: l(k.value) }, [w.value ? (d(), i("span", {
|
|
87
|
+
key: 0,
|
|
88
|
+
class: l(A.value)
|
|
89
|
+
}, [(d(), i("svg", {
|
|
90
|
+
class: l(j.value),
|
|
91
|
+
fill: "none",
|
|
92
|
+
viewBox: "0 0 12 12",
|
|
93
|
+
xmlns: "http://www.w3.org/2000/svg"
|
|
94
|
+
}, [...t[0] ||= [a("path", {
|
|
95
|
+
d: "M2 6L5 9L10 3",
|
|
96
|
+
stroke: "currentColor",
|
|
97
|
+
"stroke-linecap": "round",
|
|
98
|
+
"stroke-linejoin": "round",
|
|
99
|
+
"stroke-width": "2"
|
|
100
|
+
}, null, -1)]], 2))], 2)) : r("", !0)], 2),
|
|
101
|
+
S.value ? (d(), i("span", {
|
|
102
|
+
key: 0,
|
|
103
|
+
class: l(N.value)
|
|
104
|
+
}, [f(e.$slots, "default")], 2)) : r("", !0)
|
|
105
|
+
], 6));
|
|
106
|
+
}
|
|
107
|
+
});
|
|
108
|
+
//#endregion
|
|
109
|
+
export { v as default };
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Checkbox 组件属性接口
|
|
3
|
+
* 用于定义复选框组件的属性
|
|
4
|
+
*/
|
|
5
|
+
export interface CheckboxProps {
|
|
6
|
+
/**
|
|
7
|
+
* 复选框禁用状态
|
|
8
|
+
*/
|
|
9
|
+
disabled?: boolean;
|
|
10
|
+
/**
|
|
11
|
+
* 选中时的值
|
|
12
|
+
*/
|
|
13
|
+
trueValue?: boolean | string | number;
|
|
14
|
+
/**
|
|
15
|
+
* 未选中时的值
|
|
16
|
+
*/
|
|
17
|
+
falseValue?: boolean | string | number;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export {};
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
export declare const StCheckboxGroup: {
|
|
2
|
+
new (...args: any[]): import("vue").CreateComponentPublicInstanceWithMixins<Readonly<import("vue").ExtractPropTypes<{
|
|
3
|
+
new (...args: any[]): import("vue").CreateComponentPublicInstanceWithMixins<Readonly<import("./types.d.ts").CheckboxGroupProps & {
|
|
4
|
+
modelValue?: (string | number | boolean)[];
|
|
5
|
+
}> & Readonly<{
|
|
6
|
+
"onUpdate:modelValue"?: (value: (string | number | boolean)[]) => any;
|
|
7
|
+
}>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
8
|
+
"update:modelValue": (value: (string | number | boolean)[]) => any;
|
|
9
|
+
}, import("vue").PublicProps, {
|
|
10
|
+
disabled: boolean;
|
|
11
|
+
list: import("./types.d.ts").CheckboxGroupItem[];
|
|
12
|
+
labelKey: string;
|
|
13
|
+
valueKey: string;
|
|
14
|
+
direction: import("./types.d.ts").CheckboxGroupDirection;
|
|
15
|
+
}, true, {}, {}, import("vue").GlobalComponents, import("vue").GlobalDirectives, string, {}, any, import("vue").ComponentProvideOptions, {
|
|
16
|
+
P: {};
|
|
17
|
+
B: {};
|
|
18
|
+
D: {};
|
|
19
|
+
C: {};
|
|
20
|
+
M: {};
|
|
21
|
+
Defaults: {};
|
|
22
|
+
}, Readonly<import("./types.d.ts").CheckboxGroupProps & {
|
|
23
|
+
modelValue?: (string | number | boolean)[];
|
|
24
|
+
}> & Readonly<{
|
|
25
|
+
"onUpdate:modelValue"?: (value: (string | number | boolean)[]) => any;
|
|
26
|
+
}>, {}, {}, {}, {}, {
|
|
27
|
+
disabled: boolean;
|
|
28
|
+
list: import("./types.d.ts").CheckboxGroupItem[];
|
|
29
|
+
labelKey: string;
|
|
30
|
+
valueKey: string;
|
|
31
|
+
direction: import("./types.d.ts").CheckboxGroupDirection;
|
|
32
|
+
}>;
|
|
33
|
+
__isFragment?: never;
|
|
34
|
+
__isTeleport?: never;
|
|
35
|
+
__isSuspense?: never;
|
|
36
|
+
} & import("vue").ComponentOptionsBase<Readonly<import("./types.d.ts").CheckboxGroupProps & {
|
|
37
|
+
modelValue?: (string | number | boolean)[];
|
|
38
|
+
}> & Readonly<{
|
|
39
|
+
"onUpdate:modelValue"?: (value: (string | number | boolean)[]) => any;
|
|
40
|
+
}>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
41
|
+
"update:modelValue": (value: (string | number | boolean)[]) => any;
|
|
42
|
+
}, string, {
|
|
43
|
+
disabled: boolean;
|
|
44
|
+
list: import("./types.d.ts").CheckboxGroupItem[];
|
|
45
|
+
labelKey: string;
|
|
46
|
+
valueKey: string;
|
|
47
|
+
direction: import("./types.d.ts").CheckboxGroupDirection;
|
|
48
|
+
}, {}, string, {}, import("vue").GlobalComponents, import("vue").GlobalDirectives, string, import("vue").ComponentProvideOptions> & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps & (new () => {
|
|
49
|
+
$slots: {
|
|
50
|
+
default?: (props: {}) => any;
|
|
51
|
+
};
|
|
52
|
+
})>>, {}, {}, import("vue").ComputedOptions, import("vue").MethodOptions, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, import("vue").PublicProps, {
|
|
53
|
+
[x: string]: any;
|
|
54
|
+
}, true, {}, {}, import("vue").GlobalComponents, import("vue").GlobalDirectives, string, {}, any, import("vue").ComponentProvideOptions, {
|
|
55
|
+
P: {};
|
|
56
|
+
B: {};
|
|
57
|
+
D: {};
|
|
58
|
+
C: {};
|
|
59
|
+
M: {};
|
|
60
|
+
Defaults: {};
|
|
61
|
+
}, Readonly<import("vue").ExtractPropTypes<{
|
|
62
|
+
new (...args: any[]): import("vue").CreateComponentPublicInstanceWithMixins<Readonly<import("./types.d.ts").CheckboxGroupProps & {
|
|
63
|
+
modelValue?: (string | number | boolean)[];
|
|
64
|
+
}> & Readonly<{
|
|
65
|
+
"onUpdate:modelValue"?: (value: (string | number | boolean)[]) => any;
|
|
66
|
+
}>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
67
|
+
"update:modelValue": (value: (string | number | boolean)[]) => any;
|
|
68
|
+
}, import("vue").PublicProps, {
|
|
69
|
+
disabled: boolean;
|
|
70
|
+
list: import("./types.d.ts").CheckboxGroupItem[];
|
|
71
|
+
labelKey: string;
|
|
72
|
+
valueKey: string;
|
|
73
|
+
direction: import("./types.d.ts").CheckboxGroupDirection;
|
|
74
|
+
}, true, {}, {}, import("vue").GlobalComponents, import("vue").GlobalDirectives, string, {}, any, import("vue").ComponentProvideOptions, {
|
|
75
|
+
P: {};
|
|
76
|
+
B: {};
|
|
77
|
+
D: {};
|
|
78
|
+
C: {};
|
|
79
|
+
M: {};
|
|
80
|
+
Defaults: {};
|
|
81
|
+
}, Readonly<import("./types.d.ts").CheckboxGroupProps & {
|
|
82
|
+
modelValue?: (string | number | boolean)[];
|
|
83
|
+
}> & Readonly<{
|
|
84
|
+
"onUpdate:modelValue"?: (value: (string | number | boolean)[]) => any;
|
|
85
|
+
}>, {}, {}, {}, {}, {
|
|
86
|
+
disabled: boolean;
|
|
87
|
+
list: import("./types.d.ts").CheckboxGroupItem[];
|
|
88
|
+
labelKey: string;
|
|
89
|
+
valueKey: string;
|
|
90
|
+
direction: import("./types.d.ts").CheckboxGroupDirection;
|
|
91
|
+
}>;
|
|
92
|
+
__isFragment?: never;
|
|
93
|
+
__isTeleport?: never;
|
|
94
|
+
__isSuspense?: never;
|
|
95
|
+
} & import("vue").ComponentOptionsBase<Readonly<import("./types.d.ts").CheckboxGroupProps & {
|
|
96
|
+
modelValue?: (string | number | boolean)[];
|
|
97
|
+
}> & Readonly<{
|
|
98
|
+
"onUpdate:modelValue"?: (value: (string | number | boolean)[]) => any;
|
|
99
|
+
}>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
100
|
+
"update:modelValue": (value: (string | number | boolean)[]) => any;
|
|
101
|
+
}, string, {
|
|
102
|
+
disabled: boolean;
|
|
103
|
+
list: import("./types.d.ts").CheckboxGroupItem[];
|
|
104
|
+
labelKey: string;
|
|
105
|
+
valueKey: string;
|
|
106
|
+
direction: import("./types.d.ts").CheckboxGroupDirection;
|
|
107
|
+
}, {}, string, {}, import("vue").GlobalComponents, import("vue").GlobalDirectives, string, import("vue").ComponentProvideOptions> & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps & (new () => {
|
|
108
|
+
$slots: {
|
|
109
|
+
default?: (props: {}) => any;
|
|
110
|
+
};
|
|
111
|
+
})>>, {}, {}, import("vue").ComputedOptions, import("vue").MethodOptions, {
|
|
112
|
+
[x: string]: any;
|
|
113
|
+
}>;
|
|
114
|
+
__isFragment?: never;
|
|
115
|
+
__isTeleport?: never;
|
|
116
|
+
__isSuspense?: never;
|
|
117
|
+
} & import("vue").ComponentOptionsBase<Readonly<import("vue").ExtractPropTypes<{
|
|
118
|
+
new (...args: any[]): import("vue").CreateComponentPublicInstanceWithMixins<Readonly<import("./types.d.ts").CheckboxGroupProps & {
|
|
119
|
+
modelValue?: (string | number | boolean)[];
|
|
120
|
+
}> & Readonly<{
|
|
121
|
+
"onUpdate:modelValue"?: (value: (string | number | boolean)[]) => any;
|
|
122
|
+
}>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
123
|
+
"update:modelValue": (value: (string | number | boolean)[]) => any;
|
|
124
|
+
}, import("vue").PublicProps, {
|
|
125
|
+
disabled: boolean;
|
|
126
|
+
list: import("./types.d.ts").CheckboxGroupItem[];
|
|
127
|
+
labelKey: string;
|
|
128
|
+
valueKey: string;
|
|
129
|
+
direction: import("./types.d.ts").CheckboxGroupDirection;
|
|
130
|
+
}, true, {}, {}, import("vue").GlobalComponents, import("vue").GlobalDirectives, string, {}, any, import("vue").ComponentProvideOptions, {
|
|
131
|
+
P: {};
|
|
132
|
+
B: {};
|
|
133
|
+
D: {};
|
|
134
|
+
C: {};
|
|
135
|
+
M: {};
|
|
136
|
+
Defaults: {};
|
|
137
|
+
}, Readonly<import("./types.d.ts").CheckboxGroupProps & {
|
|
138
|
+
modelValue?: (string | number | boolean)[];
|
|
139
|
+
}> & Readonly<{
|
|
140
|
+
"onUpdate:modelValue"?: (value: (string | number | boolean)[]) => any;
|
|
141
|
+
}>, {}, {}, {}, {}, {
|
|
142
|
+
disabled: boolean;
|
|
143
|
+
list: import("./types.d.ts").CheckboxGroupItem[];
|
|
144
|
+
labelKey: string;
|
|
145
|
+
valueKey: string;
|
|
146
|
+
direction: import("./types.d.ts").CheckboxGroupDirection;
|
|
147
|
+
}>;
|
|
148
|
+
__isFragment?: never;
|
|
149
|
+
__isTeleport?: never;
|
|
150
|
+
__isSuspense?: never;
|
|
151
|
+
} & import("vue").ComponentOptionsBase<Readonly<import("./types.d.ts").CheckboxGroupProps & {
|
|
152
|
+
modelValue?: (string | number | boolean)[];
|
|
153
|
+
}> & Readonly<{
|
|
154
|
+
"onUpdate:modelValue"?: (value: (string | number | boolean)[]) => any;
|
|
155
|
+
}>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
156
|
+
"update:modelValue": (value: (string | number | boolean)[]) => any;
|
|
157
|
+
}, string, {
|
|
158
|
+
disabled: boolean;
|
|
159
|
+
list: import("./types.d.ts").CheckboxGroupItem[];
|
|
160
|
+
labelKey: string;
|
|
161
|
+
valueKey: string;
|
|
162
|
+
direction: import("./types.d.ts").CheckboxGroupDirection;
|
|
163
|
+
}, {}, string, {}, import("vue").GlobalComponents, import("vue").GlobalDirectives, string, import("vue").ComponentProvideOptions> & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps & (new () => {
|
|
164
|
+
$slots: {
|
|
165
|
+
default?: (props: {}) => any;
|
|
166
|
+
};
|
|
167
|
+
})>>, {}, {}, import("vue").ComputedOptions, import("vue").MethodOptions, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, {
|
|
168
|
+
[x: string]: any;
|
|
169
|
+
}, {}, string, {}, import("vue").GlobalComponents, import("vue").GlobalDirectives, string, import("vue").ComponentProvideOptions> & (import("vue").VNodeProps & (import("vue").AllowedComponentProps & (import("vue").ComponentCustomProps & import("vue").Plugin)));
|
|
170
|
+
export default StCheckboxGroup;
|
|
171
|
+
export type * from './types.d.ts';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var e=require("./st-checkbox-group.vue_vue_type_script_setup_true_lang.cjs").default;exports.default=e;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { CheckboxGroupItem, CheckboxGroupProps } from './types.d.ts';
|
|
2
|
+
type __VLS_Props = CheckboxGroupProps;
|
|
3
|
+
type __VLS_ModelProps = {
|
|
4
|
+
modelValue?: (string | number | boolean)[];
|
|
5
|
+
};
|
|
6
|
+
type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
|
|
7
|
+
declare var __VLS_7: {};
|
|
8
|
+
type __VLS_Slots = {} & {
|
|
9
|
+
default?: (props: typeof __VLS_7) => any;
|
|
10
|
+
};
|
|
11
|
+
declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
12
|
+
"update:modelValue": (value: (string | number | boolean)[]) => any;
|
|
13
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
|
|
14
|
+
"onUpdate:modelValue"?: (value: (string | number | boolean)[]) => any;
|
|
15
|
+
}>, {
|
|
16
|
+
disabled: boolean;
|
|
17
|
+
list: CheckboxGroupItem[];
|
|
18
|
+
labelKey: string;
|
|
19
|
+
valueKey: string;
|
|
20
|
+
direction: import("./types.d.ts").CheckboxGroupDirection;
|
|
21
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
22
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
23
|
+
declare const _default: typeof __VLS_export;
|
|
24
|
+
export default _default;
|
|
25
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
26
|
+
new (): {
|
|
27
|
+
$slots: S;
|
|
28
|
+
};
|
|
29
|
+
};
|
package/dist/components/st-checkbox-group/st-checkbox-group.vue_vue_type_script_setup_true_lang.cjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=require("../../utils/cn.cjs"),t=require("../../utils/cva/index.cjs"),n=require("../st-checkbox/st-checkbox.vue.cjs");let r=require("vue");var i=(0,r.defineComponent)({name:`StCheckboxGroup`,inheritAttrs:!1,__name:`st-checkbox-group`,props:(0,r.mergeModels)({list:{default:void 0},labelKey:{default:`label`},valueKey:{default:`value`},disabled:{type:Boolean,default:!1},direction:{default:`horizontal`}},{modelValue:{default:()=>[]},modelModifiers:{}}),emits:[`update:modelValue`],setup(i){let a=(0,r.useAttrs)(),o=i,s=(0,r.useModel)(i,`modelValue`);(0,r.useSlots)();let c=(0,r.computed)(()=>!!(o.list&&o.list.length>0)),l=e=>{let t=e[o.valueKey];return typeof t==`boolean`?String(t):t},u=e=>e[o.labelKey],d=t.cva({base:`flex`,variants:{direction:{horizontal:`flex-row flex-wrap gap-4`,vertical:`flex-col gap-2`}}}),f=(0,r.computed)(()=>e.cn(d({direction:o.direction}),a.class));return(0,r.provide)(`checkboxGroup`,{disabled:(0,r.computed)(()=>o.disabled),modelValue:s,updateValue:(e,t)=>{let n=[...s.value];if(t)n.includes(e)||n.push(e);else{let t=n.indexOf(e);t>-1&&n.splice(t,1)}s.value=n}}),(e,t)=>((0,r.openBlock)(),(0,r.createElementBlock)(`div`,{class:(0,r.normalizeClass)(f.value),style:(0,r.normalizeStyle)((0,r.unref)(a).style)},[c.value?((0,r.openBlock)(!0),(0,r.createElementBlock)(r.Fragment,{key:0},(0,r.renderList)(o.list,e=>((0,r.openBlock)(),(0,r.createBlock)(n.default,{key:l(e),disabled:o.disabled,"true-value":l(e)},{default:(0,r.withCtx)(()=>[(0,r.createTextVNode)((0,r.toDisplayString)(u(e)),1)]),_:2},1032,[`disabled`,`true-value`]))),128)):(0,r.renderSlot)(e.$slots,`default`,{key:1})],6))}});exports.default=i;
|
package/dist/components/st-checkbox-group/st-checkbox-group.vue_vue_type_script_setup_true_lang.js
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { cn as e } from "../../utils/cn.js";
|
|
2
|
+
import { cva as t } from "../../utils/cva/index.js";
|
|
3
|
+
import n from "../st-checkbox/st-checkbox.vue.js";
|
|
4
|
+
import { Fragment as r, computed as i, createBlock as a, createElementBlock as o, createTextVNode as s, defineComponent as c, mergeModels as l, normalizeClass as u, normalizeStyle as d, openBlock as f, provide as p, renderList as m, renderSlot as h, toDisplayString as g, unref as _, useAttrs as v, useModel as y, useSlots as b, withCtx as x } from "vue";
|
|
5
|
+
//#region src/components/st-checkbox-group/st-checkbox-group.vue?vue&type=script&setup=true&lang.ts
|
|
6
|
+
var S = /*@__PURE__*/ c({
|
|
7
|
+
name: "StCheckboxGroup",
|
|
8
|
+
inheritAttrs: !1,
|
|
9
|
+
__name: "st-checkbox-group",
|
|
10
|
+
props: /*@__PURE__*/ l({
|
|
11
|
+
list: { default: void 0 },
|
|
12
|
+
labelKey: { default: "label" },
|
|
13
|
+
valueKey: { default: "value" },
|
|
14
|
+
disabled: {
|
|
15
|
+
type: Boolean,
|
|
16
|
+
default: !1
|
|
17
|
+
},
|
|
18
|
+
direction: { default: "horizontal" }
|
|
19
|
+
}, {
|
|
20
|
+
modelValue: { default: () => [] },
|
|
21
|
+
modelModifiers: {}
|
|
22
|
+
}),
|
|
23
|
+
emits: ["update:modelValue"],
|
|
24
|
+
setup(c) {
|
|
25
|
+
let l = v(), S = c, C = y(c, "modelValue");
|
|
26
|
+
b();
|
|
27
|
+
let w = i(() => !!(S.list && S.list.length > 0)), T = (e) => {
|
|
28
|
+
let t = e[S.valueKey];
|
|
29
|
+
return typeof t == "boolean" ? String(t) : t;
|
|
30
|
+
}, E = (e) => e[S.labelKey], D = t({
|
|
31
|
+
base: "flex",
|
|
32
|
+
variants: { direction: {
|
|
33
|
+
horizontal: "flex-row flex-wrap gap-4",
|
|
34
|
+
vertical: "flex-col gap-2"
|
|
35
|
+
} }
|
|
36
|
+
}), O = i(() => e(D({ direction: S.direction }), l.class));
|
|
37
|
+
return p("checkboxGroup", {
|
|
38
|
+
disabled: i(() => S.disabled),
|
|
39
|
+
modelValue: C,
|
|
40
|
+
updateValue: (e, t) => {
|
|
41
|
+
let n = [...C.value];
|
|
42
|
+
if (t) n.includes(e) || n.push(e);
|
|
43
|
+
else {
|
|
44
|
+
let t = n.indexOf(e);
|
|
45
|
+
t > -1 && n.splice(t, 1);
|
|
46
|
+
}
|
|
47
|
+
C.value = n;
|
|
48
|
+
}
|
|
49
|
+
}), (e, t) => (f(), o("div", {
|
|
50
|
+
class: u(O.value),
|
|
51
|
+
style: d(_(l).style)
|
|
52
|
+
}, [w.value ? (f(!0), o(r, { key: 0 }, m(S.list, (e) => (f(), a(n, {
|
|
53
|
+
key: T(e),
|
|
54
|
+
disabled: S.disabled,
|
|
55
|
+
"true-value": T(e)
|
|
56
|
+
}, {
|
|
57
|
+
default: x(() => [s(g(E(e)), 1)]),
|
|
58
|
+
_: 2
|
|
59
|
+
}, 1032, ["disabled", "true-value"]))), 128)) : h(e.$slots, "default", { key: 1 })], 6));
|
|
60
|
+
}
|
|
61
|
+
});
|
|
62
|
+
//#endregion
|
|
63
|
+
export { S as default };
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CheckboxGroup 组件属性接口
|
|
3
|
+
* 用于定义复选框组件组的属性
|
|
4
|
+
*/
|
|
5
|
+
export interface CheckboxGroupProps {
|
|
6
|
+
/**
|
|
7
|
+
* 复选框选项列表
|
|
8
|
+
*/
|
|
9
|
+
list?: CheckboxGroupItem[];
|
|
10
|
+
/**
|
|
11
|
+
* 用于显示的标签字段名
|
|
12
|
+
*/
|
|
13
|
+
labelKey?: string;
|
|
14
|
+
/**
|
|
15
|
+
* 用于值的字段名
|
|
16
|
+
*/
|
|
17
|
+
valueKey?: string;
|
|
18
|
+
/**
|
|
19
|
+
* 复选框禁用状态
|
|
20
|
+
*/
|
|
21
|
+
disabled?: boolean;
|
|
22
|
+
/**
|
|
23
|
+
* 排列方向
|
|
24
|
+
*/
|
|
25
|
+
direction?: CheckboxGroupDirection;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* 复选框选项项接口
|
|
30
|
+
*/
|
|
31
|
+
export interface CheckboxGroupItem {
|
|
32
|
+
/**
|
|
33
|
+
* 选项标签
|
|
34
|
+
*/
|
|
35
|
+
[key: string]: unknown;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* 复选框组排列方向类型
|
|
40
|
+
*/
|
|
41
|
+
export type CheckboxGroupDirection = 'horizontal' | 'vertical';
|
|
42
|
+
|
|
43
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});const e=require("../utils/with-install.cjs"),t=require("./st-checkbox-group/st-checkbox-group.vue.cjs");var n=e.withInstall(t.default);exports.StCheckboxGroup=n,exports.default=n;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});const e=require("../utils/with-install.cjs"),t=require("./st-checkbox/st-checkbox.vue.cjs");var n=e.withInstall(t.default);exports.StCheckbox=n,exports.default=n;
|