jky-component-lib 0.0.10 → 0.0.17
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/es/button/Button.vue.d.ts +6 -0
- package/dist/es/button/Button.vue.js +32 -4
- package/dist/es/button/style.css +144 -89
- package/dist/es/button-nav/ButtonNav.vue.d.ts +30 -0
- package/dist/es/button-nav/ButtonNav.vue.js +130 -0
- package/dist/es/button-nav/ButtonNav.vue3.js +5 -0
- package/dist/es/button-nav/index.d.ts +4 -0
- package/dist/es/button-nav/index.js +8 -0
- package/dist/es/button-nav/style.css +39 -0
- package/dist/es/components.d.ts +3 -0
- package/dist/es/components.js +10 -1
- package/dist/es/index.js +8 -2
- package/dist/es/menu/Menu.vue.d.ts +32 -0
- package/dist/es/menu/Menu.vue.js +110 -0
- package/dist/es/menu/Menu.vue3.js +5 -0
- package/dist/es/menu/index.d.ts +4 -0
- package/dist/es/menu/index.js +8 -0
- package/dist/es/menu/style.css +70 -0
- package/dist/es/package.json.js +1 -1
- package/dist/es/page-header/PageHeader.vue.d.ts +45 -0
- package/dist/es/page-header/PageHeader.vue.js +263 -0
- package/dist/es/page-header/PageHeader.vue3.js +5 -0
- package/dist/es/page-header/index.d.ts +4 -0
- package/dist/es/page-header/index.js +8 -0
- package/dist/es/page-header/style.css +140 -0
- package/dist/es/resolver.d.ts +1 -1
- package/dist/es/resolver.js +2 -2
- package/dist/es/say-hello/style.css +32 -8
- package/dist/es/style.css +531 -54
- package/dist/es/styles.css +1 -1
- package/dist/lib/button/Button.vue.d.ts +6 -0
- package/dist/lib/button/Button.vue.js +31 -3
- package/dist/lib/button/style.css +144 -89
- package/dist/lib/button-nav/ButtonNav.vue.d.ts +30 -0
- package/dist/lib/button-nav/ButtonNav.vue.js +130 -0
- package/dist/lib/button-nav/ButtonNav.vue3.js +5 -0
- package/dist/lib/button-nav/index.d.ts +4 -0
- package/dist/lib/button-nav/index.js +8 -0
- package/dist/lib/button-nav/style.css +39 -0
- package/dist/lib/components.d.ts +3 -0
- package/dist/lib/components.js +13 -4
- package/dist/lib/index.js +9 -3
- package/dist/lib/menu/Menu.vue.d.ts +32 -0
- package/dist/lib/menu/Menu.vue.js +110 -0
- package/dist/lib/menu/Menu.vue3.js +5 -0
- package/dist/lib/menu/index.d.ts +4 -0
- package/dist/lib/menu/index.js +8 -0
- package/dist/lib/menu/style.css +70 -0
- package/dist/lib/package.json.js +1 -1
- package/dist/lib/page-header/PageHeader.vue.d.ts +45 -0
- package/dist/lib/page-header/PageHeader.vue.js +263 -0
- package/dist/lib/page-header/PageHeader.vue3.js +5 -0
- package/dist/lib/page-header/index.d.ts +4 -0
- package/dist/lib/page-header/index.js +8 -0
- package/dist/lib/page-header/style.css +140 -0
- package/dist/lib/resolver.d.ts +1 -1
- package/dist/lib/resolver.js +2 -2
- package/dist/lib/say-hello/style.css +32 -8
- package/dist/lib/style.css +531 -54
- package/dist/lib/styles.css +1 -1
- package/dist/umd/index.js +1856 -14
- package/dist/umd/styles.css +1 -1
- package/package.json +6 -1
|
@@ -3,10 +3,16 @@ type __VLS_Props = {
|
|
|
3
3
|
size?: 'large' | 'default' | 'small';
|
|
4
4
|
disabled?: boolean;
|
|
5
5
|
loading?: boolean;
|
|
6
|
+
icon?: string;
|
|
7
|
+
iconPosition?: 'prefix' | 'suffix';
|
|
6
8
|
};
|
|
7
9
|
declare function __VLS_template(): {
|
|
8
10
|
attrs: Partial<{}>;
|
|
9
11
|
slots: {
|
|
12
|
+
icon?(_: {}): any;
|
|
13
|
+
icon?(_: {}): any;
|
|
14
|
+
icon?(_: {}): any;
|
|
15
|
+
default?(_: {}): any;
|
|
10
16
|
default?(_: {}): any;
|
|
11
17
|
};
|
|
12
18
|
refs: {};
|
|
@@ -17,12 +17,20 @@ var __spreadValues = (a, b) => {
|
|
|
17
17
|
return a;
|
|
18
18
|
};
|
|
19
19
|
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
20
|
-
import { defineComponent, openBlock, createElementBlock, normalizeClass, createElementVNode,
|
|
20
|
+
import { defineComponent, openBlock, createElementBlock, normalizeClass, createElementVNode, Fragment, renderSlot, createCommentVNode } from "vue";
|
|
21
21
|
const _hoisted_1 = ["disabled"];
|
|
22
22
|
const _hoisted_2 = {
|
|
23
23
|
key: 0,
|
|
24
24
|
class: "jky-button__loading"
|
|
25
25
|
};
|
|
26
|
+
const _hoisted_3 = {
|
|
27
|
+
key: 0,
|
|
28
|
+
class: "jky-button__icon"
|
|
29
|
+
};
|
|
30
|
+
const _hoisted_4 = {
|
|
31
|
+
key: 1,
|
|
32
|
+
class: "jky-button__icon"
|
|
33
|
+
};
|
|
26
34
|
const _sfc_main = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({}, {
|
|
27
35
|
name: "JkyButton"
|
|
28
36
|
}), {
|
|
@@ -31,7 +39,9 @@ const _sfc_main = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({
|
|
|
31
39
|
type: { default: "primary" },
|
|
32
40
|
size: { default: "default" },
|
|
33
41
|
disabled: { type: Boolean, default: false },
|
|
34
|
-
loading: { type: Boolean, default: false }
|
|
42
|
+
loading: { type: Boolean, default: false },
|
|
43
|
+
icon: {},
|
|
44
|
+
iconPosition: { default: "prefix" }
|
|
35
45
|
},
|
|
36
46
|
emits: ["click"],
|
|
37
47
|
setup(__props, { emit: __emit }) {
|
|
@@ -79,8 +89,26 @@ const _sfc_main = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({
|
|
|
79
89
|
})
|
|
80
90
|
])
|
|
81
91
|
], -1)
|
|
82
|
-
])])) :
|
|
83
|
-
|
|
92
|
+
])])) : __props.icon ? (openBlock(), createElementBlock(Fragment, { key: 1 }, [
|
|
93
|
+
__props.iconPosition === "prefix" ? (openBlock(), createElementBlock("span", _hoisted_3, [
|
|
94
|
+
renderSlot(_ctx.$slots, "icon", {}, () => [
|
|
95
|
+
createElementVNode("span", {
|
|
96
|
+
class: normalizeClass(__props.icon)
|
|
97
|
+
}, null, 2)
|
|
98
|
+
])
|
|
99
|
+
])) : createCommentVNode("", true),
|
|
100
|
+
renderSlot(_ctx.$slots, "default"),
|
|
101
|
+
__props.iconPosition === "suffix" ? (openBlock(), createElementBlock("span", _hoisted_4, [
|
|
102
|
+
renderSlot(_ctx.$slots, "icon", {}, () => [
|
|
103
|
+
createElementVNode("span", {
|
|
104
|
+
class: normalizeClass(__props.icon)
|
|
105
|
+
}, null, 2)
|
|
106
|
+
])
|
|
107
|
+
])) : createCommentVNode("", true)
|
|
108
|
+
], 64)) : (openBlock(), createElementBlock(Fragment, { key: 2 }, [
|
|
109
|
+
renderSlot(_ctx.$slots, "icon"),
|
|
110
|
+
renderSlot(_ctx.$slots, "default")
|
|
111
|
+
], 64))
|
|
84
112
|
], 10, _hoisted_1);
|
|
85
113
|
};
|
|
86
114
|
}
|
package/dist/es/button/style.css
CHANGED
|
@@ -1,38 +1,141 @@
|
|
|
1
1
|
|
|
2
2
|
/* 禁止使用 @apply,所有 TailwindCSS 工具类直接写在 class 中 */
|
|
3
3
|
/* 样式文件仅用于定义组件特定的自定义纯 CSS 样式 */
|
|
4
|
-
/* Button 组件样式 - 使用
|
|
4
|
+
/* Button 组件样式 - 使用 CSS 变量实现主题化 */
|
|
5
|
+
/* 1. 定义 CSS 变量 */
|
|
6
|
+
:root {
|
|
7
|
+
/* 颜色变量 */
|
|
8
|
+
--jky-button-primary-bg: #007bff;
|
|
9
|
+
--jky-button-primary-text: #ffffff;
|
|
10
|
+
--jky-button-primary-hover-bg: #0056b3;
|
|
11
|
+
|
|
12
|
+
--jky-button-success-bg: #28a745;
|
|
13
|
+
--jky-button-success-text: #ffffff;
|
|
14
|
+
--jky-button-success-hover-bg: #1e7e34;
|
|
15
|
+
|
|
16
|
+
--jky-button-warning-bg: #ffc107;
|
|
17
|
+
--jky-button-warning-text: #ffffff;
|
|
18
|
+
--jky-button-warning-hover-bg: #e0a800;
|
|
19
|
+
|
|
20
|
+
--jky-button-danger-bg: #dc3545;
|
|
21
|
+
--jky-button-danger-text: #ffffff;
|
|
22
|
+
--jky-button-danger-hover-bg: #c82333;
|
|
23
|
+
|
|
24
|
+
--jky-button-info-bg: #6c757d;
|
|
25
|
+
--jky-button-info-text: #ffffff;
|
|
26
|
+
--jky-button-info-hover-bg: #5a6268;
|
|
27
|
+
|
|
28
|
+
/* 默认样式 */
|
|
29
|
+
--jky-button-default-bg: #ffffff;
|
|
30
|
+
--jky-button-default-text: #606266;
|
|
31
|
+
--jky-button-default-border: #dcdfe6;
|
|
32
|
+
--jky-button-default-hover-bg: #f5f7fa;
|
|
33
|
+
|
|
34
|
+
/* 尺寸变量 */
|
|
35
|
+
--jky-button-font-size: 14px;
|
|
36
|
+
--jky-button-font-size-small: 12px;
|
|
37
|
+
--jky-button-font-size-large: 16px;
|
|
38
|
+
|
|
39
|
+
--jky-button-padding: 0 16px;
|
|
40
|
+
--jky-button-padding-small: 0 12px;
|
|
41
|
+
--jky-button-padding-large: 0 20px;
|
|
42
|
+
|
|
43
|
+
--jky-button-height: 40px;
|
|
44
|
+
--jky-button-height-small: 32px;
|
|
45
|
+
--jky-button-height-large: 48px;
|
|
46
|
+
|
|
47
|
+
/* 圆角 */
|
|
48
|
+
--jky-button-border-radius: 0.375rem;
|
|
49
|
+
|
|
50
|
+
/* 状态变量 */
|
|
51
|
+
--jky-button-disabled-opacity: 0.5;
|
|
52
|
+
--jky-button-disabled-bg: #f5f7fa;
|
|
53
|
+
--jky-button-disabled-text: #c0c4cc;
|
|
54
|
+
--jky-button-loading-opacity: 0.7;
|
|
55
|
+
|
|
56
|
+
/* 图标 */
|
|
57
|
+
--jky-button-icon-size: 1.25rem;
|
|
58
|
+
--jky-button-icon-margin: 0.5rem;
|
|
59
|
+
}
|
|
60
|
+
/* 2. 基础样式 */
|
|
5
61
|
.jky-button {
|
|
6
|
-
/* 基础样式 - 使用 TailwindCSS 工具类 */
|
|
7
62
|
display: inline-flex;
|
|
8
63
|
align-items: center;
|
|
9
64
|
justify-content: center;
|
|
65
|
+
height: var(--jky-button-height);
|
|
66
|
+
padding: var(--jky-button-padding);
|
|
67
|
+
font-size: var(--jky-button-font-size);
|
|
10
68
|
font-weight: 500;
|
|
11
|
-
border-radius:
|
|
69
|
+
border-radius: var(--jky-button-border-radius);
|
|
70
|
+
background-color: var(--jky-button-default-bg);
|
|
71
|
+
color: var(--jky-button-default-text);
|
|
72
|
+
border: 1px solid var(--jky-button-default-border);
|
|
12
73
|
transition: color 200ms, background-color 200ms;
|
|
13
74
|
cursor: pointer;
|
|
14
|
-
border: 1px solid transparent;
|
|
15
|
-
|
|
16
|
-
/* 默认尺寸 */
|
|
17
|
-
height: 40px;
|
|
18
|
-
padding: 0 16px;
|
|
19
|
-
font-size: 14px;
|
|
20
75
|
}
|
|
21
|
-
/*
|
|
22
|
-
.jky-button
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
76
|
+
/* 3. 类型变体 */
|
|
77
|
+
.jky-button--primary {
|
|
78
|
+
background-color: var(--jky-button-primary-bg);
|
|
79
|
+
color: var(--jky-button-primary-text);
|
|
80
|
+
border: none;
|
|
81
|
+
}
|
|
82
|
+
.jky-button--primary:hover {
|
|
83
|
+
background-color: var(--jky-button-primary-hover-bg);
|
|
84
|
+
}
|
|
85
|
+
.jky-button--success {
|
|
86
|
+
background-color: var(--jky-button-success-bg);
|
|
87
|
+
color: var(--jky-button-success-text);
|
|
88
|
+
border: none;
|
|
89
|
+
}
|
|
90
|
+
.jky-button--success:hover {
|
|
91
|
+
background-color: var(--jky-button-success-hover-bg);
|
|
92
|
+
}
|
|
93
|
+
.jky-button--warning {
|
|
94
|
+
background-color: var(--jky-button-warning-bg);
|
|
95
|
+
color: var(--jky-button-warning-text);
|
|
96
|
+
border: none;
|
|
97
|
+
}
|
|
98
|
+
.jky-button--warning:hover {
|
|
99
|
+
background-color: var(--jky-button-warning-hover-bg);
|
|
100
|
+
}
|
|
101
|
+
.jky-button--danger {
|
|
102
|
+
background-color: var(--jky-button-danger-bg);
|
|
103
|
+
color: var(--jky-button-danger-text);
|
|
104
|
+
border: none;
|
|
105
|
+
}
|
|
106
|
+
.jky-button--danger:hover {
|
|
107
|
+
background-color: var(--jky-button-danger-hover-bg);
|
|
108
|
+
}
|
|
109
|
+
.jky-button--info {
|
|
110
|
+
background-color: var(--jky-button-info-bg);
|
|
111
|
+
color: var(--jky-button-info-text);
|
|
112
|
+
border: none;
|
|
113
|
+
}
|
|
114
|
+
.jky-button--info:hover {
|
|
115
|
+
background-color: var(--jky-button-info-hover-bg);
|
|
116
|
+
}
|
|
117
|
+
/* 4. 尺寸变体 */
|
|
118
|
+
.jky-button--small {
|
|
119
|
+
height: var(--jky-button-height-small);
|
|
120
|
+
font-size: var(--jky-button-font-size-small);
|
|
121
|
+
padding: var(--jky-button-padding-small);
|
|
26
122
|
}
|
|
27
|
-
|
|
123
|
+
.jky-button--large {
|
|
124
|
+
height: var(--jky-button-height-large);
|
|
125
|
+
font-size: var(--jky-button-font-size-large);
|
|
126
|
+
padding: var(--jky-button-padding-large);
|
|
127
|
+
}
|
|
128
|
+
/* 5. 状态样式 */
|
|
28
129
|
.jky-button.is-disabled {
|
|
29
|
-
opacity:
|
|
130
|
+
opacity: var(--jky-button-disabled-opacity);
|
|
30
131
|
pointer-events: none;
|
|
31
132
|
cursor: not-allowed;
|
|
133
|
+
background-color: var(--jky-button-disabled-bg);
|
|
134
|
+
color: var(--jky-button-disabled-text);
|
|
32
135
|
}
|
|
33
|
-
/* 加载状态 */
|
|
34
136
|
.jky-button.is-loading {
|
|
35
137
|
position: relative;
|
|
138
|
+
opacity: var(--jky-button-loading-opacity);
|
|
36
139
|
pointer-events: none;
|
|
37
140
|
}
|
|
38
141
|
.jky-button__loading {
|
|
@@ -42,9 +145,31 @@
|
|
|
42
145
|
align-items: center;
|
|
43
146
|
justify-content: center;
|
|
44
147
|
}
|
|
148
|
+
/* 6. 图标样式 */
|
|
149
|
+
.jky-button__icon {
|
|
150
|
+
display: inline-flex;
|
|
151
|
+
align-items: center;
|
|
152
|
+
justify-content: center;
|
|
153
|
+
font-size: 1em;
|
|
154
|
+
margin-right: var(--jky-button-icon-margin);
|
|
155
|
+
}
|
|
156
|
+
.jky-button__icon:only-child {
|
|
157
|
+
margin-right: 0;
|
|
158
|
+
}
|
|
159
|
+
.jky-button--suffix .jky-button__icon {
|
|
160
|
+
margin-right: 0;
|
|
161
|
+
margin-left: var(--jky-button-icon-margin);
|
|
162
|
+
}
|
|
163
|
+
/* 7. 焦点样式 */
|
|
164
|
+
.jky-button:focus-visible {
|
|
165
|
+
outline: 2px solid transparent;
|
|
166
|
+
outline-offset: 2px;
|
|
167
|
+
box-shadow: 0 0 0 2px white, 0 0 0 4px #000;
|
|
168
|
+
}
|
|
169
|
+
/* 8. 加载动画 */
|
|
45
170
|
.loading-spinner {
|
|
46
|
-
width:
|
|
47
|
-
height:
|
|
171
|
+
width: var(--jky-button-icon-size);
|
|
172
|
+
height: var(--jky-button-icon-size);
|
|
48
173
|
animation: spin 1s linear infinite;
|
|
49
174
|
}
|
|
50
175
|
@keyframes spin {
|
|
@@ -55,73 +180,3 @@ to {
|
|
|
55
180
|
transform: rotate(360deg);
|
|
56
181
|
}
|
|
57
182
|
}
|
|
58
|
-
/* 按钮类型 */
|
|
59
|
-
.jky-button--primary {
|
|
60
|
-
background-color: #007bff;
|
|
61
|
-
color: #ffffff;
|
|
62
|
-
}
|
|
63
|
-
.jky-button--primary:hover {
|
|
64
|
-
background-color: #0056b3;
|
|
65
|
-
}
|
|
66
|
-
.jky-button--success {
|
|
67
|
-
background-color: #28a745;
|
|
68
|
-
color: #ffffff;
|
|
69
|
-
}
|
|
70
|
-
.jky-button--success:hover {
|
|
71
|
-
background-color: #1e7e34;
|
|
72
|
-
}
|
|
73
|
-
.jky-button--warning {
|
|
74
|
-
background-color: #ffc107;
|
|
75
|
-
color: #212529;
|
|
76
|
-
}
|
|
77
|
-
.jky-button--warning:hover {
|
|
78
|
-
background-color: #e0a800;
|
|
79
|
-
}
|
|
80
|
-
.jky-button--danger {
|
|
81
|
-
background-color: #dc3545;
|
|
82
|
-
color: #ffffff;
|
|
83
|
-
}
|
|
84
|
-
.jky-button--danger:hover {
|
|
85
|
-
background-color: #bd2130;
|
|
86
|
-
}
|
|
87
|
-
.jky-button--info {
|
|
88
|
-
background-color: #6c757d;
|
|
89
|
-
color: #ffffff;
|
|
90
|
-
}
|
|
91
|
-
.jky-button--info:hover {
|
|
92
|
-
background-color: #545b62;
|
|
93
|
-
}
|
|
94
|
-
/* 按钮尺寸 */
|
|
95
|
-
.jky-button--large {
|
|
96
|
-
height: 48px;
|
|
97
|
-
padding: 0 24px;
|
|
98
|
-
font-size: 16px;
|
|
99
|
-
}
|
|
100
|
-
.jky-button--default {
|
|
101
|
-
height: 40px;
|
|
102
|
-
padding: 0 16px;
|
|
103
|
-
font-size: 14px;
|
|
104
|
-
}
|
|
105
|
-
.jky-button--small {
|
|
106
|
-
height: 32px;
|
|
107
|
-
padding: 0 12px;
|
|
108
|
-
font-size: 12px;
|
|
109
|
-
}
|
|
110
|
-
/* 边框按钮样式 */
|
|
111
|
-
.jky-button--primary.is-border {
|
|
112
|
-
background-color: transparent;
|
|
113
|
-
border-color: #007bff;
|
|
114
|
-
color: #007bff;
|
|
115
|
-
}
|
|
116
|
-
.jky-button--primary.is-border:hover {
|
|
117
|
-
background-color: rgba(0, 123, 255, 0.1);
|
|
118
|
-
}
|
|
119
|
-
/* 文字按钮样式 */
|
|
120
|
-
.jky-button--text {
|
|
121
|
-
background-color: transparent;
|
|
122
|
-
color: #007bff;
|
|
123
|
-
border-color: transparent;
|
|
124
|
-
}
|
|
125
|
-
.jky-button--text:hover {
|
|
126
|
-
background-color: rgba(0, 123, 255, 0.1);
|
|
127
|
-
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { ButtonProps } from 'element-plus/es/components/button';
|
|
2
|
+
type __VLS_Props = {
|
|
3
|
+
modelValue?: string | number;
|
|
4
|
+
items?: NavItem[];
|
|
5
|
+
limit?: number;
|
|
6
|
+
size?: ButtonProps['size'];
|
|
7
|
+
type?: ButtonProps['type'];
|
|
8
|
+
plain?: boolean;
|
|
9
|
+
buttonWidth?: string;
|
|
10
|
+
};
|
|
11
|
+
interface NavItem {
|
|
12
|
+
label: string;
|
|
13
|
+
value: string | number;
|
|
14
|
+
disabled?: boolean;
|
|
15
|
+
icon?: string;
|
|
16
|
+
}
|
|
17
|
+
declare const _default: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {} & {
|
|
18
|
+
change: (value: string | number) => any;
|
|
19
|
+
"update:modelValue": (value: string | number) => any;
|
|
20
|
+
}, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
21
|
+
onChange?: ((value: string | number) => any) | undefined;
|
|
22
|
+
"onUpdate:modelValue"?: ((value: string | number) => any) | undefined;
|
|
23
|
+
}>, {
|
|
24
|
+
size: "" | "default" | "large" | "small";
|
|
25
|
+
type: "" | "default" | "primary" | "success" | "warning" | "danger" | "info" | "text";
|
|
26
|
+
items: NavItem[];
|
|
27
|
+
limit: number;
|
|
28
|
+
plain: boolean;
|
|
29
|
+
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, HTMLDivElement>;
|
|
30
|
+
export default _default;
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __defProps = Object.defineProperties;
|
|
3
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
4
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
7
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
8
|
+
var __spreadValues = (a, b) => {
|
|
9
|
+
for (var prop in b || (b = {}))
|
|
10
|
+
if (__hasOwnProp.call(b, prop))
|
|
11
|
+
__defNormalProp(a, prop, b[prop]);
|
|
12
|
+
if (__getOwnPropSymbols)
|
|
13
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
14
|
+
if (__propIsEnum.call(b, prop))
|
|
15
|
+
__defNormalProp(a, prop, b[prop]);
|
|
16
|
+
}
|
|
17
|
+
return a;
|
|
18
|
+
};
|
|
19
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
20
|
+
import { defineComponent, computed, openBlock, createElementBlock, Fragment, renderList, createBlock, unref, normalizeClass, normalizeStyle, createSlots, withCtx, createTextVNode, toDisplayString, createElementVNode, createVNode, createCommentVNode } from "vue";
|
|
21
|
+
import { ElButton, ElDropdown, ElDropdownMenu, ElDropdownItem } from "element-plus";
|
|
22
|
+
const _hoisted_1 = { class: "jky-button-nav flex flex-wrap items-center gap-2" };
|
|
23
|
+
const _sfc_main = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({}, {
|
|
24
|
+
name: "JkyButtonNav"
|
|
25
|
+
}), {
|
|
26
|
+
__name: "ButtonNav",
|
|
27
|
+
props: {
|
|
28
|
+
modelValue: {},
|
|
29
|
+
items: { default: () => [] },
|
|
30
|
+
limit: { default: 2 },
|
|
31
|
+
size: { default: "default" },
|
|
32
|
+
type: { default: "primary" },
|
|
33
|
+
plain: { type: Boolean, default: false },
|
|
34
|
+
buttonWidth: {}
|
|
35
|
+
},
|
|
36
|
+
emits: ["update:modelValue", "change"],
|
|
37
|
+
setup(__props, { emit: __emit }) {
|
|
38
|
+
const props = __props;
|
|
39
|
+
const emit = __emit;
|
|
40
|
+
const visibleItems = computed(() => props.items.slice(0, props.limit));
|
|
41
|
+
const hiddenItems = computed(() => props.items.slice(props.limit));
|
|
42
|
+
const hasMore = computed(() => props.items.length > props.limit);
|
|
43
|
+
function handleClick(value) {
|
|
44
|
+
emit("update:modelValue", value);
|
|
45
|
+
emit("change", value);
|
|
46
|
+
}
|
|
47
|
+
return (_ctx, _cache) => {
|
|
48
|
+
return openBlock(), createElementBlock("div", _hoisted_1, [
|
|
49
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(visibleItems.value, (item) => {
|
|
50
|
+
return openBlock(), createBlock(unref(ElButton), {
|
|
51
|
+
key: item.value,
|
|
52
|
+
type: props.modelValue === item.value ? props.type : "default",
|
|
53
|
+
size: props.size,
|
|
54
|
+
disabled: item.disabled,
|
|
55
|
+
link: props.plain && props.modelValue !== item.value,
|
|
56
|
+
style: normalizeStyle({ width: props.buttonWidth }),
|
|
57
|
+
class: normalizeClass({
|
|
58
|
+
"is-active": props.modelValue === item.value
|
|
59
|
+
}),
|
|
60
|
+
onClick: ($event) => handleClick(item.value)
|
|
61
|
+
}, createSlots({
|
|
62
|
+
default: withCtx(() => [
|
|
63
|
+
createTextVNode(" " + toDisplayString(item.label), 1)
|
|
64
|
+
]),
|
|
65
|
+
_: 2
|
|
66
|
+
}, [
|
|
67
|
+
item.icon ? {
|
|
68
|
+
name: "icon",
|
|
69
|
+
fn: withCtx(() => [
|
|
70
|
+
createElementVNode("span", {
|
|
71
|
+
class: normalizeClass(item.icon)
|
|
72
|
+
}, null, 2)
|
|
73
|
+
]),
|
|
74
|
+
key: "0"
|
|
75
|
+
} : void 0
|
|
76
|
+
]), 1032, ["type", "size", "disabled", "link", "style", "class", "onClick"]);
|
|
77
|
+
}), 128)),
|
|
78
|
+
hasMore.value ? (openBlock(), createBlock(unref(ElDropdown), {
|
|
79
|
+
key: 0,
|
|
80
|
+
trigger: "click"
|
|
81
|
+
}, {
|
|
82
|
+
dropdown: withCtx(() => [
|
|
83
|
+
createVNode(unref(ElDropdownMenu), { class: "jky-button-nav-dropdown" }, {
|
|
84
|
+
default: withCtx(() => [
|
|
85
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(hiddenItems.value, (item) => {
|
|
86
|
+
return openBlock(), createBlock(unref(ElDropdownItem), {
|
|
87
|
+
key: item.value,
|
|
88
|
+
disabled: item.disabled,
|
|
89
|
+
onClick: ($event) => handleClick(item.value)
|
|
90
|
+
}, {
|
|
91
|
+
default: withCtx(() => [
|
|
92
|
+
item.icon ? (openBlock(), createElementBlock("span", {
|
|
93
|
+
key: 0,
|
|
94
|
+
class: normalizeClass([item.icon, "mr-2"])
|
|
95
|
+
}, null, 2)) : createCommentVNode("", true),
|
|
96
|
+
createTextVNode(" " + toDisplayString(item.label), 1)
|
|
97
|
+
]),
|
|
98
|
+
_: 2
|
|
99
|
+
}, 1032, ["disabled", "onClick"]);
|
|
100
|
+
}), 128))
|
|
101
|
+
]),
|
|
102
|
+
_: 1
|
|
103
|
+
})
|
|
104
|
+
]),
|
|
105
|
+
default: withCtx(() => [
|
|
106
|
+
createVNode(unref(ElButton), {
|
|
107
|
+
type: hiddenItems.value.some((item) => item.value === props.modelValue) ? props.type : "default",
|
|
108
|
+
size: props.size,
|
|
109
|
+
link: props.plain && !hiddenItems.value.some((item) => item.value === props.modelValue),
|
|
110
|
+
style: normalizeStyle({ width: props.buttonWidth }),
|
|
111
|
+
class: normalizeClass({
|
|
112
|
+
"is-active": hiddenItems.value.some((item) => item.value === props.modelValue)
|
|
113
|
+
})
|
|
114
|
+
}, {
|
|
115
|
+
default: withCtx(() => [..._cache[0] || (_cache[0] = [
|
|
116
|
+
createTextVNode(" 更多 ", -1),
|
|
117
|
+
createElementVNode("span", { class: "ml-1" }, "▼", -1)
|
|
118
|
+
])]),
|
|
119
|
+
_: 1
|
|
120
|
+
}, 8, ["type", "size", "link", "style", "class"])
|
|
121
|
+
]),
|
|
122
|
+
_: 1
|
|
123
|
+
})) : createCommentVNode("", true)
|
|
124
|
+
]);
|
|
125
|
+
};
|
|
126
|
+
}
|
|
127
|
+
}));
|
|
128
|
+
export {
|
|
129
|
+
_sfc_main as default
|
|
130
|
+
};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/* ButtonNav 组件样式 */
|
|
2
|
+
:root {
|
|
3
|
+
/* 选中状态的颜色变量 */
|
|
4
|
+
--jky-button-nav-active-bg: var(--el-color-primary);
|
|
5
|
+
--jky-button-nav-active-text: #ffffff;
|
|
6
|
+
--jky-button-nav-inactive-bg: var(--el-fill-color-light);
|
|
7
|
+
--jky-button-nav-inactive-text: var(--el-text-color-regular);
|
|
8
|
+
|
|
9
|
+
/* Dropdown 间距 */
|
|
10
|
+
--el-dropdown-menu-margin-left: 12px;
|
|
11
|
+
}
|
|
12
|
+
.jky-button-nav {
|
|
13
|
+
/* 使用纯 CSS 定义容器样式 */
|
|
14
|
+
display: flex;
|
|
15
|
+
flex-wrap: wrap;
|
|
16
|
+
align-items: center;
|
|
17
|
+
.el-dropdown {
|
|
18
|
+
margin-left: var(--el-dropdown-menu-margin-left);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/* 按钮选中状态 - 通过 CSS 变量控制 */
|
|
23
|
+
.jky-button-nav-item {
|
|
24
|
+
/* 默认状态(未选中) */
|
|
25
|
+
background-color: var(--jky-button-nav-inactive-bg);
|
|
26
|
+
color: var(--jky-button-nav-inactive-text);
|
|
27
|
+
|
|
28
|
+
/* 选中状态 */
|
|
29
|
+
&[aria-pressed="true"],
|
|
30
|
+
&.is-active {
|
|
31
|
+
background-color: var(--jky-button-nav-active-bg);
|
|
32
|
+
color: var(--jky-button-nav-active-text);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/* Dropdown 菜单保持 Element Plus 原始样式 */
|
|
37
|
+
.jky-button-nav-dropdown {
|
|
38
|
+
/* 不覆盖任何样式,保持 el-dropdown-menu 默认样式 */
|
|
39
|
+
}
|
package/dist/es/components.d.ts
CHANGED
package/dist/es/components.js
CHANGED
|
@@ -1,11 +1,20 @@
|
|
|
1
1
|
import { JkyButton } from "./button/index.js";
|
|
2
|
+
import { JkyButtonNav } from "./button-nav/index.js";
|
|
3
|
+
import { JkyMenu } from "./menu/index.js";
|
|
4
|
+
import { JkyPageHeader } from "./page-header/index.js";
|
|
2
5
|
import { JkySayHello } from "./say-hello/index.js";
|
|
3
6
|
const components = [
|
|
4
7
|
JkySayHello,
|
|
5
|
-
JkyButton
|
|
8
|
+
JkyButton,
|
|
9
|
+
JkyButtonNav,
|
|
10
|
+
JkyPageHeader,
|
|
11
|
+
JkyMenu
|
|
6
12
|
];
|
|
7
13
|
export {
|
|
8
14
|
JkyButton,
|
|
15
|
+
JkyButtonNav,
|
|
16
|
+
JkyMenu,
|
|
17
|
+
JkyPageHeader,
|
|
9
18
|
JkySayHello,
|
|
10
19
|
components
|
|
11
20
|
};
|
package/dist/es/index.js
CHANGED
|
@@ -1,16 +1,22 @@
|
|
|
1
1
|
import { components } from "./components.js";
|
|
2
2
|
import { createInstaller } from "./utils/installer.js";
|
|
3
3
|
/* empty css */
|
|
4
|
-
import {
|
|
4
|
+
import { JkyComponentLibResolver } from "./resolver.js";
|
|
5
5
|
import { JkyButton } from "./button/index.js";
|
|
6
|
+
import { JkyButtonNav } from "./button-nav/index.js";
|
|
7
|
+
import { JkyMenu } from "./menu/index.js";
|
|
8
|
+
import { JkyPageHeader } from "./page-header/index.js";
|
|
6
9
|
import { JkySayHello } from "./say-hello/index.js";
|
|
7
10
|
const installer = createInstaller(components);
|
|
8
11
|
const install = installer.install;
|
|
9
12
|
const version = installer.version;
|
|
10
13
|
export {
|
|
11
14
|
JkyButton,
|
|
15
|
+
JkyButtonNav,
|
|
16
|
+
JkyComponentLibResolver,
|
|
17
|
+
JkyMenu,
|
|
18
|
+
JkyPageHeader,
|
|
12
19
|
JkySayHello,
|
|
13
|
-
StarterLibVue3Resolver,
|
|
14
20
|
components,
|
|
15
21
|
installer as default,
|
|
16
22
|
install,
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { MenuProps } from 'element-plus/es/components/menu';
|
|
2
|
+
interface MenuItem {
|
|
3
|
+
index: string;
|
|
4
|
+
title?: string;
|
|
5
|
+
icon?: string;
|
|
6
|
+
disabled?: boolean;
|
|
7
|
+
children?: MenuItem[];
|
|
8
|
+
popperOffset?: number;
|
|
9
|
+
route?: string | object;
|
|
10
|
+
[key: string]: any;
|
|
11
|
+
}
|
|
12
|
+
interface Props extends MenuProps {
|
|
13
|
+
menuData?: MenuItem[];
|
|
14
|
+
modelValue?: string;
|
|
15
|
+
}
|
|
16
|
+
declare function __VLS_template(): {
|
|
17
|
+
attrs: Partial<{}>;
|
|
18
|
+
slots: {
|
|
19
|
+
default?(_: {}): any;
|
|
20
|
+
};
|
|
21
|
+
refs: {};
|
|
22
|
+
rootEl: any;
|
|
23
|
+
};
|
|
24
|
+
type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
|
|
25
|
+
declare const __VLS_component: import('vue').DefineComponent<Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<Props> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
|
|
26
|
+
declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
|
|
27
|
+
export default _default;
|
|
28
|
+
type __VLS_WithTemplateSlots<T, S> = T & {
|
|
29
|
+
new (): {
|
|
30
|
+
$slots: S;
|
|
31
|
+
};
|
|
32
|
+
};
|