wyfe-ivue 0.1.0 → 0.2.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 CHANGED
@@ -3,7 +3,8 @@
3
3
  基于 Vite7 + Vue3 + Typescript5 + ElementPlus2 构建的高性能【万有前端·iVue】组件库
4
4
 
5
5
  ## 特别说明
6
- > 受作者个人时间与精力所限,及遵循“高内聚、低耦合”设计原则,【万有前端・iVue】组件库未提供独立文档地址,目前仅作为【[万有前端·iCode](https://wyfe.top/icode)】的一个菜单模块存在。
6
+ > 受作者个人时间与精力所限,及遵循“高内聚、低耦合”设计原则,【万有前端・iVue】组件库未提供独立文档地址,目前仅作为【[万有前端·iCode](https://wyfe.top/icode)】的一个菜单模块存在。
7
+ > 文档地址:https://wyfe.top/icode/iVue
7
8
 
8
9
 
9
10
  ## npm下载(支持pnpm/yarn/cnpm/npm)
@@ -26,13 +27,24 @@ $ pnpm i D:/xxx/wyfe-ivue/wyfe-ivue-0.0.1.tgz
26
27
 
27
28
  ## 使用
28
29
  ```js
29
- // main.ts
30
- import 'wyfe-ivue/dist/ui.css'
30
+ // 1、创建plugins/WyfeIVue.ts
31
+ import 'wyfe-ivue/dist/wyfe-ivue.css'
32
+ import { type App } from 'vue'
33
+ import * as WyfeIVue from 'wyfe-ivue'
31
34
 
32
- // xxx.vue
33
- import {UseXXX} from 'wyfe-ivue'
35
+ export default (app: App) => {
36
+ for (const [key, component] of Object.entries(WyfeIVue)) {
37
+ app.component(key, component)
38
+ }
34
39
 
35
- <UseXXX/>
40
+
41
+ // 2、在main.ts中引入使用:
42
+ import WyfeIVuePlugins from './plugins/WyfeIVue'
43
+
44
+ createApp(App).use(WyfeIVuePlugins).mount('#app')
45
+
46
+ // 3、在页面中使用(以使用UseElButton为例):
47
+ <UseElButton btnText="保存" @onClick="handleClick"/>
36
48
  ```
37
49
 
38
50
  ## 版本号规则
@@ -0,0 +1,75 @@
1
+ import { E as m } from "./index-C1Tf_IVU.js";
2
+ import { defineComponent as g, defineAsyncComponent as C, resolveComponent as s, createBlock as t, openBlock as n, withCtx as r, createElementBlock as u, Fragment as c, renderList as h, renderSlot as b, mergeProps as d, unref as y, normalizeProps as j, guardReactiveProps as k } from "vue";
3
+ const R = /* @__PURE__ */ g({
4
+ __name: "RecTableColumn",
5
+ props: {
6
+ columnObj: {
7
+ type: Object,
8
+ default: () => ({})
9
+ },
10
+ tableColumnAlign: {
11
+ type: String,
12
+ default: "center"
13
+ },
14
+ extConfig: {
15
+ type: Object,
16
+ default: () => ({})
17
+ }
18
+ },
19
+ setup(l) {
20
+ const i = C(() => import("./Span-Y-Lm4gq9.js"));
21
+ return (a, O) => {
22
+ const f = s("RecTableColumn", !0), p = m;
23
+ return n(), t(p, {
24
+ label: l.columnObj.label,
25
+ align: l.columnObj.align || l.tableColumnAlign
26
+ }, {
27
+ header: r(() => [
28
+ b(a.$slots, "header", j(k({ label: l.columnObj.label, prop: l.columnObj.prop })))
29
+ ]),
30
+ default: r(() => [
31
+ (n(!0), u(c, null, h(l.columnObj.children, (e) => (n(), u(c, {
32
+ key: e.prop
33
+ }, [
34
+ e.children && e.children.length ? (n(), t(f, {
35
+ key: 0,
36
+ columnObj: e
37
+ }, null, 8, ["columnObj"])) : (n(), t(p, {
38
+ key: 1,
39
+ label: e.label,
40
+ prop: e.prop,
41
+ "min-width": e.minWidth,
42
+ align: e.align || l.tableColumnAlign
43
+ }, {
44
+ default: r(({ row: o }) => [
45
+ e.prop && Object.keys(o).length ? (n(), u(c, { key: 0 }, [
46
+ e?.extConfig?.slot ? b(a.$slots, e.prop, d({
47
+ key: 0,
48
+ ref_for: !0
49
+ }, {
50
+ row: o,
51
+ data: o[e.prop],
52
+ dict: e.extConfig?.dict
53
+ })) : (n(), t(y(i), {
54
+ key: 1,
55
+ item: e,
56
+ data: o[e.prop],
57
+ extConfig: l.extConfig
58
+ }, null, 8, ["item", "data", "extConfig"]))
59
+ ], 64)) : b(a.$slots, "default", d({
60
+ key: 1,
61
+ ref_for: !0
62
+ }, { row: o }))
63
+ ]),
64
+ _: 2
65
+ }, 1032, ["label", "prop", "min-width", "align"]))
66
+ ], 64))), 128))
67
+ ]),
68
+ _: 3
69
+ }, 8, ["label", "align"]);
70
+ };
71
+ }
72
+ });
73
+ export {
74
+ R as default
75
+ };
@@ -0,0 +1,320 @@
1
+ import { i as x, a as G, b as $, c as E, C as w, U as C, u as A, d as z, e as ee, f as ae, g as oe, _ as I, h as N, j as le, k as F, l as te, m as ne, n as ie, o as se, p as de, w as re, q as D, E as ue } from "./index-C1Tf_IVU.js";
2
+ import { ref as B, inject as ce, computed as b, defineComponent as V, createElementBlock as S, openBlock as h, normalizeClass as v, unref as e, createElementVNode as _, withDirectives as U, withModifiers as k, isRef as T, vModelRadio as K, renderSlot as P, createTextVNode as L, toDisplayString as O, nextTick as j, normalizeStyle as fe, onMounted as me, provide as pe, reactive as be, toRefs as ve, watch as ge, Fragment as ye, renderList as he, createBlock as R, mergeProps as Ve, withCtx as _e, createVNode as Se } from "vue";
3
+ const q = E({
4
+ modelValue: {
5
+ type: [String, Number, Boolean],
6
+ default: void 0
7
+ },
8
+ size: A,
9
+ disabled: Boolean,
10
+ label: {
11
+ type: [String, Number, Boolean],
12
+ default: void 0
13
+ },
14
+ value: {
15
+ type: [String, Number, Boolean],
16
+ default: void 0
17
+ },
18
+ name: {
19
+ type: String,
20
+ default: void 0
21
+ }
22
+ }), ke = E({
23
+ ...q,
24
+ border: Boolean
25
+ }), M = {
26
+ [C]: (a) => x(a) || G(a) || $(a),
27
+ [w]: (a) => x(a) || G(a) || $(a)
28
+ }, H = Symbol("radioGroupKey"), J = (a, f) => {
29
+ const t = B(), o = ce(H, void 0), d = b(() => !!o), u = b(() => z(a.value) ? a.label : a.value), i = b({
30
+ get() {
31
+ return d.value ? o.modelValue : a.modelValue;
32
+ },
33
+ set(p) {
34
+ d.value ? o.changeEvent(p) : f && f(C, p), t.value.checked = a.modelValue === u.value;
35
+ }
36
+ }), c = ee(b(() => o?.size)), l = ae(b(() => o?.disabled)), s = B(!1), m = b(() => l.value || d.value && i.value !== u.value ? -1 : 0);
37
+ return oe({
38
+ from: "label act as value",
39
+ replacement: "value",
40
+ version: "3.0.0",
41
+ scope: "el-radio",
42
+ ref: "https://element-plus.org/en-US/component/radio.html"
43
+ }, b(() => d.value && z(a.value))), {
44
+ radioRef: t,
45
+ isGroup: d,
46
+ radioGroup: o,
47
+ focus: s,
48
+ size: c,
49
+ disabled: l,
50
+ tabIndex: m,
51
+ modelValue: i,
52
+ actualValue: u
53
+ };
54
+ }, Ee = V({
55
+ name: "ElRadio"
56
+ }), Be = /* @__PURE__ */ V({
57
+ ...Ee,
58
+ props: ke,
59
+ emits: M,
60
+ setup(a, { emit: f }) {
61
+ const t = a, o = N("radio"), { radioRef: d, radioGroup: u, focus: i, size: c, disabled: l, modelValue: s, actualValue: m } = J(t, f);
62
+ function p() {
63
+ j(() => f(w, s.value));
64
+ }
65
+ return (y, n) => {
66
+ var r;
67
+ return h(), S("label", {
68
+ class: v([
69
+ e(o).b(),
70
+ e(o).is("disabled", e(l)),
71
+ e(o).is("focus", e(i)),
72
+ e(o).is("bordered", y.border),
73
+ e(o).is("checked", e(s) === e(m)),
74
+ e(o).m(e(c))
75
+ ])
76
+ }, [
77
+ _("span", {
78
+ class: v([
79
+ e(o).e("input"),
80
+ e(o).is("disabled", e(l)),
81
+ e(o).is("checked", e(s) === e(m))
82
+ ])
83
+ }, [
84
+ U(_("input", {
85
+ ref_key: "radioRef",
86
+ ref: d,
87
+ "onUpdate:modelValue": (g) => T(s) ? s.value = g : null,
88
+ class: v(e(o).e("original")),
89
+ value: e(m),
90
+ name: y.name || ((r = e(u)) == null ? void 0 : r.name),
91
+ disabled: e(l),
92
+ checked: e(s) === e(m),
93
+ type: "radio",
94
+ onFocus: (g) => i.value = !0,
95
+ onBlur: (g) => i.value = !1,
96
+ onChange: p,
97
+ onClick: k(() => {
98
+ }, ["stop"])
99
+ }, null, 42, ["onUpdate:modelValue", "value", "name", "disabled", "checked", "onFocus", "onBlur", "onClick"]), [
100
+ [K, e(s)]
101
+ ]),
102
+ _("span", {
103
+ class: v(e(o).e("inner"))
104
+ }, null, 2)
105
+ ], 2),
106
+ _("span", {
107
+ class: v(e(o).e("label")),
108
+ onKeydown: k(() => {
109
+ }, ["stop"])
110
+ }, [
111
+ P(y.$slots, "default", {}, () => [
112
+ L(O(y.label), 1)
113
+ ])
114
+ ], 42, ["onKeydown"])
115
+ ], 2);
116
+ };
117
+ }
118
+ });
119
+ var W = /* @__PURE__ */ I(Be, [["__file", "radio.vue"]]);
120
+ const Re = E({
121
+ ...q
122
+ }), we = V({
123
+ name: "ElRadioButton"
124
+ }), Ce = /* @__PURE__ */ V({
125
+ ...we,
126
+ props: Re,
127
+ setup(a) {
128
+ const f = a, t = N("radio"), { radioRef: o, focus: d, size: u, disabled: i, modelValue: c, radioGroup: l, actualValue: s } = J(f), m = b(() => ({
129
+ backgroundColor: l?.fill || "",
130
+ borderColor: l?.fill || "",
131
+ boxShadow: l?.fill ? `-1px 0 0 0 ${l.fill}` : "",
132
+ color: l?.textColor || ""
133
+ }));
134
+ return (p, y) => {
135
+ var n;
136
+ return h(), S("label", {
137
+ class: v([
138
+ e(t).b("button"),
139
+ e(t).is("active", e(c) === e(s)),
140
+ e(t).is("disabled", e(i)),
141
+ e(t).is("focus", e(d)),
142
+ e(t).bm("button", e(u))
143
+ ])
144
+ }, [
145
+ U(_("input", {
146
+ ref_key: "radioRef",
147
+ ref: o,
148
+ "onUpdate:modelValue": (r) => T(c) ? c.value = r : null,
149
+ class: v(e(t).be("button", "original-radio")),
150
+ value: e(s),
151
+ type: "radio",
152
+ name: p.name || ((n = e(l)) == null ? void 0 : n.name),
153
+ disabled: e(i),
154
+ onFocus: (r) => d.value = !0,
155
+ onBlur: (r) => d.value = !1,
156
+ onClick: k(() => {
157
+ }, ["stop"])
158
+ }, null, 42, ["onUpdate:modelValue", "value", "name", "disabled", "onFocus", "onBlur", "onClick"]), [
159
+ [K, e(c)]
160
+ ]),
161
+ _("span", {
162
+ class: v(e(t).be("button", "inner")),
163
+ style: fe(e(c) === e(s) ? e(m) : {}),
164
+ onKeydown: k(() => {
165
+ }, ["stop"])
166
+ }, [
167
+ P(p.$slots, "default", {}, () => [
168
+ L(O(p.label), 1)
169
+ ])
170
+ ], 46, ["onKeydown"])
171
+ ], 2);
172
+ };
173
+ }
174
+ });
175
+ var Q = /* @__PURE__ */ I(Ce, [["__file", "radio-button.vue"]]);
176
+ const Ie = E({
177
+ id: {
178
+ type: String,
179
+ default: void 0
180
+ },
181
+ size: A,
182
+ disabled: Boolean,
183
+ modelValue: {
184
+ type: [String, Number, Boolean],
185
+ default: void 0
186
+ },
187
+ fill: {
188
+ type: String,
189
+ default: ""
190
+ },
191
+ textColor: {
192
+ type: String,
193
+ default: ""
194
+ },
195
+ name: {
196
+ type: String,
197
+ default: void 0
198
+ },
199
+ validateEvent: {
200
+ type: Boolean,
201
+ default: !0
202
+ },
203
+ options: {
204
+ type: F(Array)
205
+ },
206
+ props: {
207
+ type: F(Object),
208
+ default: () => X
209
+ },
210
+ ...le(["ariaLabel"])
211
+ }), Ne = M, X = {
212
+ label: "label",
213
+ value: "value",
214
+ disabled: "disabled"
215
+ }, Pe = V({
216
+ name: "ElRadioGroup"
217
+ }), xe = /* @__PURE__ */ V({
218
+ ...Pe,
219
+ props: Ie,
220
+ emits: Ne,
221
+ setup(a, { emit: f }) {
222
+ const t = a, o = N("radio"), d = te(), u = B(), { formItem: i } = ne(), { inputId: c, isLabeledByFormItem: l } = ie(t, {
223
+ formItemContext: i
224
+ }), s = (n) => {
225
+ f(C, n), j(() => f(w, n));
226
+ };
227
+ me(() => {
228
+ const n = u.value.querySelectorAll("[type=radio]"), r = n[0];
229
+ !Array.from(n).some((g) => g.checked) && r && (r.tabIndex = 0);
230
+ });
231
+ const m = b(() => t.name || d.value), p = b(() => ({
232
+ ...X,
233
+ ...t.props
234
+ })), y = (n) => {
235
+ const r = {
236
+ label: n[p.value.label],
237
+ value: n[p.value.value],
238
+ disabled: n[p.value.disabled]
239
+ };
240
+ return { ...n, ...r };
241
+ };
242
+ return pe(H, be({
243
+ ...ve(t),
244
+ changeEvent: s,
245
+ name: m
246
+ })), ge(() => t.modelValue, (n, r) => {
247
+ t.validateEvent && !se(n, r) && i?.validate("change").catch((g) => de());
248
+ }), (n, r) => (h(), S("div", {
249
+ id: e(c),
250
+ ref_key: "radioGroupRef",
251
+ ref: u,
252
+ class: v(e(o).b("group")),
253
+ role: "radiogroup",
254
+ "aria-label": e(l) ? void 0 : n.ariaLabel || "radio-group",
255
+ "aria-labelledby": e(l) ? e(i).labelId : void 0
256
+ }, [
257
+ P(n.$slots, "default", {}, () => [
258
+ (h(!0), S(ye, null, he(t.options, (g, Z) => (h(), R(W, Ve({ key: Z }, y(g)), null, 16))), 128))
259
+ ])
260
+ ], 10, ["id", "aria-label", "aria-labelledby"]));
261
+ }
262
+ });
263
+ var Y = /* @__PURE__ */ I(xe, [["__file", "radio-group.vue"]]);
264
+ const Ge = re(W, {
265
+ RadioButton: Q,
266
+ RadioGroup: Y
267
+ });
268
+ D(Y);
269
+ D(Q);
270
+ const Fe = /* @__PURE__ */ V({
271
+ __name: "Selection",
272
+ props: {
273
+ modelValue: {
274
+ type: String,
275
+ required: !0
276
+ },
277
+ config: {
278
+ type: Object,
279
+ default: () => ({})
280
+ }
281
+ },
282
+ emits: ["update:modelValue"],
283
+ setup(a, { emit: f }) {
284
+ const t = a, o = f, d = b({
285
+ get: () => t.modelValue,
286
+ set: (u) => {
287
+ o("update:modelValue", u);
288
+ }
289
+ });
290
+ return (u, i) => {
291
+ const c = Ge, l = ue;
292
+ return a.config?.type === "RADIO" ? (h(), R(l, {
293
+ key: 0,
294
+ label: a.config?.label,
295
+ width: a.config?.width,
296
+ align: a.config?.align,
297
+ fixed: a.config?.fixed
298
+ }, {
299
+ default: _e(({ row: s }) => [
300
+ Se(c, {
301
+ modelValue: d.value,
302
+ "onUpdate:modelValue": i[0] || (i[0] = (m) => d.value = m),
303
+ value: JSON.stringify(s)
304
+ }, null, 8, ["modelValue", "value"])
305
+ ]),
306
+ _: 1
307
+ }, 8, ["label", "width", "align", "fixed"])) : (h(), R(l, {
308
+ key: 1,
309
+ type: "selection",
310
+ selectable: a.config?.selectable,
311
+ width: a.config?.width,
312
+ align: a.config?.align,
313
+ fixed: a.config?.fixed
314
+ }, null, 8, ["selectable", "width", "align", "fixed"]));
315
+ };
316
+ }
317
+ });
318
+ export {
319
+ Fe as default
320
+ };
@@ -0,0 +1,31 @@
1
+ import { defineComponent as l, computed as o, createElementBlock as n, openBlock as r, normalizeStyle as s, normalizeClass as i, toDisplayString as c } from "vue";
2
+ import { r as p } from "./index-C1Tf_IVU.js";
3
+ const y = /* @__PURE__ */ l({
4
+ __name: "Span",
5
+ props: {
6
+ item: {
7
+ type: Object,
8
+ required: !0
9
+ },
10
+ data: {
11
+ type: [String, Number, Boolean, Object, Array, null],
12
+ default: ""
13
+ },
14
+ extConfig: {
15
+ type: Object,
16
+ default: () => ({})
17
+ }
18
+ },
19
+ setup(a) {
20
+ const e = a, t = o(
21
+ () => p(e.item, e.data, e.extConfig)
22
+ );
23
+ return (m, u) => (r(), n("span", {
24
+ class: i(t.value.class || a.item?.extConfig?.class),
25
+ style: s(t.value.style)
26
+ }, c(t.value.data), 7));
27
+ }
28
+ });
29
+ export {
30
+ y as default
31
+ };