@cyberpunk-vue/components 1.9.25 → 1.10.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/dist/index.cjs +1 -1
- package/dist/index.mjs +26 -10
- package/dist/segmented/index.d.ts +15 -4
- package/dist/segmented/src/segmented.d.ts +17 -2
- package/dist/segmented/src/segmented.vue.d.ts +15 -4
- package/package.json +4 -4
package/dist/index.mjs
CHANGED
|
@@ -7100,10 +7100,15 @@ var Zr = $(Vr), Qr = ie(Jr, "$notify"), $r = /* @__PURE__ */ d({
|
|
|
7100
7100
|
block: {
|
|
7101
7101
|
type: Boolean,
|
|
7102
7102
|
default: !1
|
|
7103
|
+
},
|
|
7104
|
+
clearable: {
|
|
7105
|
+
type: Boolean,
|
|
7106
|
+
default: !1
|
|
7103
7107
|
}
|
|
7104
7108
|
}, ci = {
|
|
7105
|
-
"update:modelValue": (e) => typeof e == "string" || typeof e == "number",
|
|
7106
|
-
change: (e) => typeof e == "string" || typeof e == "number"
|
|
7109
|
+
"update:modelValue": (e) => e === void 0 || typeof e == "string" || typeof e == "number",
|
|
7110
|
+
change: (e) => e === void 0 || typeof e == "string" || typeof e == "number",
|
|
7111
|
+
clear: () => !0
|
|
7107
7112
|
}, li = [
|
|
7108
7113
|
"disabled",
|
|
7109
7114
|
"aria-checked",
|
|
@@ -7132,7 +7137,7 @@ var Zr = $(Vr), Qr = ie(Jr, "$notify"), $r = /* @__PURE__ */ d({
|
|
|
7132
7137
|
let t = w.value[e];
|
|
7133
7138
|
E.value = {
|
|
7134
7139
|
width: `${t.offsetWidth}px`,
|
|
7135
|
-
transform: `translateX(calc(${t.offsetLeft}px + var(--cp-segmented-indicator-offset,
|
|
7140
|
+
transform: `translateX(calc(${t.offsetLeft}px + var(--cp-segmented-indicator-offset, 0px)))`,
|
|
7136
7141
|
opacity: "1"
|
|
7137
7142
|
};
|
|
7138
7143
|
};
|
|
@@ -7158,9 +7163,19 @@ var Zr = $(Vr), Qr = ie(Jr, "$notify"), $r = /* @__PURE__ */ d({
|
|
|
7158
7163
|
]), F = r(() => {
|
|
7159
7164
|
let e = {};
|
|
7160
7165
|
return l.color && (e["--cp-segmented-color"] = l.color, e["--cp-segmented-color-light"] = `${l.color}25`), W(l.size) || (e["--cp-segmented-height"] = K(l.size, h)), e;
|
|
7161
|
-
}), I = (
|
|
7162
|
-
p.value ||
|
|
7163
|
-
}, L = (e) =>
|
|
7166
|
+
}), I = () => {
|
|
7167
|
+
p.value || l.modelValue === void 0 || (u("update:modelValue", void 0), u("change", void 0), u("clear"));
|
|
7168
|
+
}, L = (e) => {
|
|
7169
|
+
if (!(p.value || e.disabled)) {
|
|
7170
|
+
if (e.value === l.modelValue) {
|
|
7171
|
+
l.clearable && I();
|
|
7172
|
+
return;
|
|
7173
|
+
}
|
|
7174
|
+
u("update:modelValue", e.value), u("change", e.value);
|
|
7175
|
+
}
|
|
7176
|
+
}, z = (e) => {
|
|
7177
|
+
e.key === "Escape" && (!l.clearable || p.value || l.modelValue !== void 0 && (e.preventDefault(), I()));
|
|
7178
|
+
}, B = (e) => [
|
|
7164
7179
|
d.e("item"),
|
|
7165
7180
|
d.is("active", e.value === l.modelValue),
|
|
7166
7181
|
d.is("disabled", !!e.disabled)
|
|
@@ -7170,7 +7185,8 @@ var Zr = $(Vr), Qr = ie(Jr, "$notify"), $r = /* @__PURE__ */ d({
|
|
|
7170
7185
|
ref: C,
|
|
7171
7186
|
class: v(P.value),
|
|
7172
7187
|
style: y(F.value),
|
|
7173
|
-
role: "radiogroup"
|
|
7188
|
+
role: "radiogroup",
|
|
7189
|
+
onKeydown: z
|
|
7174
7190
|
}, [s("div", {
|
|
7175
7191
|
class: v(N(d).e("indicator")),
|
|
7176
7192
|
style: y(E.value)
|
|
@@ -7178,16 +7194,16 @@ var Zr = $(Vr), Qr = ie(Jr, "$notify"), $r = /* @__PURE__ */ d({
|
|
|
7178
7194
|
key: e.value,
|
|
7179
7195
|
ref_for: !0,
|
|
7180
7196
|
ref: (e) => O(e, n),
|
|
7181
|
-
class: v(
|
|
7197
|
+
class: v(B(e)),
|
|
7182
7198
|
disabled: p.value || e.disabled,
|
|
7183
7199
|
type: "button",
|
|
7184
7200
|
role: "radio",
|
|
7185
7201
|
"aria-checked": e.value === t.modelValue,
|
|
7186
|
-
onClick: (t) =>
|
|
7202
|
+
onClick: (t) => L(e)
|
|
7187
7203
|
}, [e.icon ? (S(), i(A(e.icon), {
|
|
7188
7204
|
key: 0,
|
|
7189
7205
|
class: v(N(d).e("item-icon"))
|
|
7190
|
-
}, null, 8, ["class"])) : a("", !0), s("span", { class: v(N(d).e("item-label")) }, j(e.label), 3)], 10, li))), 128))],
|
|
7206
|
+
}, null, 8, ["class"])) : a("", !0), s("span", { class: v(N(d).e("item-label")) }, j(e.label), 3)], 10, li))), 128))], 38));
|
|
7191
7207
|
}
|
|
7192
7208
|
})), di = {
|
|
7193
7209
|
data: {
|
|
@@ -47,11 +47,16 @@ export declare const CpSegmented: import('../utils').SFCWithInstall<import('vue'
|
|
|
47
47
|
readonly type: BooleanConstructor;
|
|
48
48
|
readonly default: false;
|
|
49
49
|
};
|
|
50
|
+
readonly clearable: {
|
|
51
|
+
readonly type: BooleanConstructor;
|
|
52
|
+
readonly default: false;
|
|
53
|
+
};
|
|
50
54
|
}>, {
|
|
51
55
|
updateIndicator: () => void;
|
|
52
56
|
}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
53
|
-
|
|
54
|
-
|
|
57
|
+
clear: () => void;
|
|
58
|
+
change: (value: import('.').SegmentedValueType | undefined) => void;
|
|
59
|
+
"update:modelValue": (value: import('.').SegmentedValueType | undefined) => void;
|
|
55
60
|
}, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<{
|
|
56
61
|
readonly modelValue: {
|
|
57
62
|
readonly type: import('vue').PropType<import('.').SegmentedValueType>;
|
|
@@ -89,9 +94,14 @@ export declare const CpSegmented: import('../utils').SFCWithInstall<import('vue'
|
|
|
89
94
|
readonly type: BooleanConstructor;
|
|
90
95
|
readonly default: false;
|
|
91
96
|
};
|
|
97
|
+
readonly clearable: {
|
|
98
|
+
readonly type: BooleanConstructor;
|
|
99
|
+
readonly default: false;
|
|
100
|
+
};
|
|
92
101
|
}>> & Readonly<{
|
|
93
|
-
|
|
94
|
-
|
|
102
|
+
onClear?: (() => any) | undefined;
|
|
103
|
+
onChange?: ((value: import('.').SegmentedValueType | undefined) => any) | undefined;
|
|
104
|
+
"onUpdate:modelValue"?: ((value: import('.').SegmentedValueType | undefined) => any) | undefined;
|
|
95
105
|
}>, {
|
|
96
106
|
readonly size: import('@cyberpunk-vue/hooks').Size;
|
|
97
107
|
readonly type: import('.').SegmentedType;
|
|
@@ -101,6 +111,7 @@ export declare const CpSegmented: import('../utils').SFCWithInstall<import('vue'
|
|
|
101
111
|
readonly block: boolean;
|
|
102
112
|
readonly shape: import('.').SegmentedShape;
|
|
103
113
|
readonly modelValue: import('.').SegmentedValueType;
|
|
114
|
+
readonly clearable: boolean;
|
|
104
115
|
readonly options: (string | number | import('.').SegmentedOption)[];
|
|
105
116
|
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {
|
|
106
117
|
trackRef: HTMLDivElement;
|
|
@@ -143,6 +143,15 @@ export declare const segmentedProps: {
|
|
|
143
143
|
readonly type: BooleanConstructor;
|
|
144
144
|
readonly default: false;
|
|
145
145
|
};
|
|
146
|
+
/**
|
|
147
|
+
* 是否允许清空选中项
|
|
148
|
+
* 启用后可通过再次点击已选项或按 Esc 键清空
|
|
149
|
+
* @default false
|
|
150
|
+
*/
|
|
151
|
+
readonly clearable: {
|
|
152
|
+
readonly type: BooleanConstructor;
|
|
153
|
+
readonly default: false;
|
|
154
|
+
};
|
|
146
155
|
};
|
|
147
156
|
export type SegmentedProps = ExtractPropTypes<typeof segmentedProps>;
|
|
148
157
|
/**
|
|
@@ -151,11 +160,17 @@ export type SegmentedProps = ExtractPropTypes<typeof segmentedProps>;
|
|
|
151
160
|
export declare const segmentedEmits: {
|
|
152
161
|
/**
|
|
153
162
|
* 值变化时触发 (v-model 绑定)
|
|
163
|
+
* 启用 clearable 并清空时值为 undefined
|
|
154
164
|
*/
|
|
155
|
-
'update:modelValue': (value: SegmentedValueType) => value is string | number;
|
|
165
|
+
'update:modelValue': (value: SegmentedValueType | undefined) => value is string | number | undefined;
|
|
156
166
|
/**
|
|
157
167
|
* 值变化时触发
|
|
168
|
+
* 启用 clearable 并清空时值为 undefined
|
|
169
|
+
*/
|
|
170
|
+
change: (value: SegmentedValueType | undefined) => value is string | number | undefined;
|
|
171
|
+
/**
|
|
172
|
+
* 清空选中项时触发(需启用 clearable)
|
|
158
173
|
*/
|
|
159
|
-
|
|
174
|
+
clear: () => boolean;
|
|
160
175
|
};
|
|
161
176
|
export type SegmentedEmits = typeof segmentedEmits;
|
|
@@ -36,12 +36,17 @@ declare const _default: import('vue').DefineComponent<import('vue').ExtractPropT
|
|
|
36
36
|
readonly type: BooleanConstructor;
|
|
37
37
|
readonly default: false;
|
|
38
38
|
};
|
|
39
|
+
readonly clearable: {
|
|
40
|
+
readonly type: BooleanConstructor;
|
|
41
|
+
readonly default: false;
|
|
42
|
+
};
|
|
39
43
|
}>, {
|
|
40
44
|
/** @description 更新滑块位置 */
|
|
41
45
|
updateIndicator: () => void;
|
|
42
46
|
}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
43
|
-
|
|
44
|
-
|
|
47
|
+
clear: () => void;
|
|
48
|
+
change: (value: SegmentedValueType | undefined) => void;
|
|
49
|
+
"update:modelValue": (value: SegmentedValueType | undefined) => void;
|
|
45
50
|
}, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<{
|
|
46
51
|
readonly modelValue: {
|
|
47
52
|
readonly type: import('vue').PropType<SegmentedValueType>;
|
|
@@ -79,9 +84,14 @@ declare const _default: import('vue').DefineComponent<import('vue').ExtractPropT
|
|
|
79
84
|
readonly type: BooleanConstructor;
|
|
80
85
|
readonly default: false;
|
|
81
86
|
};
|
|
87
|
+
readonly clearable: {
|
|
88
|
+
readonly type: BooleanConstructor;
|
|
89
|
+
readonly default: false;
|
|
90
|
+
};
|
|
82
91
|
}>> & Readonly<{
|
|
83
|
-
|
|
84
|
-
|
|
92
|
+
onClear?: (() => any) | undefined;
|
|
93
|
+
onChange?: ((value: SegmentedValueType | undefined) => any) | undefined;
|
|
94
|
+
"onUpdate:modelValue"?: ((value: SegmentedValueType | undefined) => any) | undefined;
|
|
85
95
|
}>, {
|
|
86
96
|
readonly size: import('@cyberpunk-vue/hooks').Size;
|
|
87
97
|
readonly type: import('./segmented').SegmentedType;
|
|
@@ -91,6 +101,7 @@ declare const _default: import('vue').DefineComponent<import('vue').ExtractPropT
|
|
|
91
101
|
readonly block: boolean;
|
|
92
102
|
readonly shape: import('./segmented').SegmentedShape;
|
|
93
103
|
readonly modelValue: SegmentedValueType;
|
|
104
|
+
readonly clearable: boolean;
|
|
94
105
|
readonly options: (string | number | SegmentedOption)[];
|
|
95
106
|
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {
|
|
96
107
|
trackRef: HTMLDivElement;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cyberpunk-vue/components",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.10.0",
|
|
4
4
|
"description": "Cyberpunk Vue components - A futuristic Vue 3 component library",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.cjs",
|
|
@@ -23,9 +23,9 @@
|
|
|
23
23
|
"vue": "^3.5.0"
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"@cyberpunk-vue/hooks": "1.
|
|
27
|
-
"@cyberpunk-vue/
|
|
28
|
-
"@cyberpunk-vue/
|
|
26
|
+
"@cyberpunk-vue/hooks": "1.10.0",
|
|
27
|
+
"@cyberpunk-vue/theme-chalk": "1.10.0",
|
|
28
|
+
"@cyberpunk-vue/constants": "1.10.0"
|
|
29
29
|
},
|
|
30
30
|
"author": "Juxest",
|
|
31
31
|
"license": "MIT",
|