yanzhi-ui 0.1.0 → 0.1.3
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/button/Button.vue.d.ts +25 -0
- package/dist/index.d.ts +7 -0
- package/dist/yanzhi-ui.css +1 -0
- package/dist/yanzhi-ui.d.ts +6 -0
- package/dist/yanzhi-ui.js +1 -0
- package/dist/yanzhi-ui.mjs +58 -0
- package/dist/yanzhi-ui.umd.js +1 -0
- package/package.json +18 -8
- package/src/packages/button/Button.vue +40 -20
- package/src/packages/index.ts +10 -1
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
interface ButtonProps {
|
|
2
|
+
type?: 'default' | 'primary' | 'success' | 'warning' | 'error';
|
|
3
|
+
size?: 'small' | 'medium' | 'large';
|
|
4
|
+
color?: string;
|
|
5
|
+
textColor?: string;
|
|
6
|
+
disabled?: boolean;
|
|
7
|
+
loading?: boolean;
|
|
8
|
+
}
|
|
9
|
+
declare function __VLS_template(): {
|
|
10
|
+
attrs: Partial<{}>;
|
|
11
|
+
slots: {
|
|
12
|
+
default?(_: {}): any;
|
|
13
|
+
};
|
|
14
|
+
refs: {};
|
|
15
|
+
rootEl: HTMLButtonElement;
|
|
16
|
+
};
|
|
17
|
+
type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
|
|
18
|
+
declare const __VLS_component: import('vue').DefineComponent<ButtonProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<ButtonProps> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, HTMLButtonElement>;
|
|
19
|
+
declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
|
|
20
|
+
export default _default;
|
|
21
|
+
type __VLS_WithTemplateSlots<T, S> = T & {
|
|
22
|
+
new (): {
|
|
23
|
+
$slots: S;
|
|
24
|
+
};
|
|
25
|
+
};
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.i-button[data-v-63e0e36c]{border-radius:4px;padding:0 12px;height:32px;border:none;cursor:pointer;transition:all .2s}.i-button.small[data-v-63e0e36c]{height:24px}.i-button.medium[data-v-63e0e36c]{height:32px}.i-button.large[data-v-63e0e36c]{height:40px}.i-button.disabled[data-v-63e0e36c]{cursor:not-allowed;opacity:.6}.i-button.loading[data-v-63e0e36c]{opacity:.8}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var c=Object.defineProperty;var u=(e,o,s)=>o in e?c(e,o,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[o]=s;var l=(e,o,s)=>u(e,typeof o!="symbol"?o+"":o,s);Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const i=require("vue"),b=["disabled"],h=i.defineComponent({__name:"Button",props:{type:{},size:{},color:{},textColor:{},disabled:{type:Boolean},loading:{type:Boolean}},setup(e){class o{constructor(t){l(this,"type");l(this,"size");l(this,"color");l(this,"textColor");l(this,"disabled");l(this,"loading");this.type=t.type||"default",this.size=t.size||"medium",this.color=t.color,this.textColor=t.textColor,this.disabled=t.disabled??!1,this.loading=t.loading??!1}get classes(){const t=["i-button",this.type,this.size];return this.disabled&&t.push("disabled"),this.loading&&t.push("loading"),t.join(" ")}get styles(){return{backgroundColor:this.color||"",color:this.textColor||""}}}const s=e,n=i.reactive(new o(s));return(a,t)=>(i.openBlock(),i.createElementBlock("button",{class:i.normalizeClass(n.classes),style:i.normalizeStyle(n.styles),disabled:n.disabled,onClick:t[0]||(t[0]=r=>a.$emit("click",r))},[i.renderSlot(a.$slots,"default",{},void 0,!0)],14,b))}}),y=(e,o)=>{const s=e.__vccOpts||e;for(const[n,a]of o)s[n]=a;return s},d=y(h,[["__scopeId","data-v-63e0e36c"]]),f=e=>{e.component("IButton",d)},g={install:f};exports.IButton=d;exports.default=g;
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
var d = Object.defineProperty;
|
|
2
|
+
var c = (e, o, s) => o in e ? d(e, o, { enumerable: !0, configurable: !0, writable: !0, value: s }) : e[o] = s;
|
|
3
|
+
var l = (e, o, s) => c(e, typeof o != "symbol" ? o + "" : o, s);
|
|
4
|
+
import { defineComponent as r, reactive as u, createElementBlock as h, openBlock as b, normalizeStyle as f, normalizeClass as m, renderSlot as p } from "vue";
|
|
5
|
+
const y = ["disabled"], g = /* @__PURE__ */ r({
|
|
6
|
+
__name: "Button",
|
|
7
|
+
props: {
|
|
8
|
+
type: {},
|
|
9
|
+
size: {},
|
|
10
|
+
color: {},
|
|
11
|
+
textColor: {},
|
|
12
|
+
disabled: { type: Boolean },
|
|
13
|
+
loading: { type: Boolean }
|
|
14
|
+
},
|
|
15
|
+
setup(e) {
|
|
16
|
+
class o {
|
|
17
|
+
constructor(t) {
|
|
18
|
+
l(this, "type");
|
|
19
|
+
l(this, "size");
|
|
20
|
+
l(this, "color");
|
|
21
|
+
l(this, "textColor");
|
|
22
|
+
l(this, "disabled");
|
|
23
|
+
l(this, "loading");
|
|
24
|
+
this.type = t.type || "default", this.size = t.size || "medium", this.color = t.color, this.textColor = t.textColor, this.disabled = t.disabled ?? !1, this.loading = t.loading ?? !1;
|
|
25
|
+
}
|
|
26
|
+
get classes() {
|
|
27
|
+
const t = ["i-button", this.type, this.size];
|
|
28
|
+
return this.disabled && t.push("disabled"), this.loading && t.push("loading"), t.join(" ");
|
|
29
|
+
}
|
|
30
|
+
get styles() {
|
|
31
|
+
return {
|
|
32
|
+
backgroundColor: this.color || "",
|
|
33
|
+
color: this.textColor || ""
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
const s = e, i = u(new o(s));
|
|
38
|
+
return (n, t) => (b(), h("button", {
|
|
39
|
+
class: m(i.classes),
|
|
40
|
+
style: f(i.styles),
|
|
41
|
+
disabled: i.disabled,
|
|
42
|
+
onClick: t[0] || (t[0] = (a) => n.$emit("click", a))
|
|
43
|
+
}, [
|
|
44
|
+
p(n.$slots, "default", {}, void 0, !0)
|
|
45
|
+
], 14, y));
|
|
46
|
+
}
|
|
47
|
+
}), _ = (e, o) => {
|
|
48
|
+
const s = e.__vccOpts || e;
|
|
49
|
+
for (const [i, n] of o)
|
|
50
|
+
s[i] = n;
|
|
51
|
+
return s;
|
|
52
|
+
}, C = /* @__PURE__ */ _(g, [["__scopeId", "data-v-63e0e36c"]]), B = (e) => {
|
|
53
|
+
e.component("IButton", C);
|
|
54
|
+
}, k = { install: B };
|
|
55
|
+
export {
|
|
56
|
+
C as IButton,
|
|
57
|
+
k as default
|
|
58
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(function(e,t){typeof exports=="object"&&typeof module<"u"?t(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],t):(e=typeof globalThis<"u"?globalThis:e||self,t(e.YanzhiUI={},e.Vue))})(this,(function(e,t){"use strict";var h=Object.defineProperty;var p=(e,t,n)=>t in e?h(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var s=(e,t,n)=>p(e,typeof t!="symbol"?t+"":t,n);const n=["disabled"],r=((i,c)=>{const a=i.__vccOpts||i;for(const[l,d]of c)a[l]=d;return a})(t.defineComponent({__name:"Button",props:{type:{},size:{},color:{},textColor:{},disabled:{type:Boolean},loading:{type:Boolean}},setup(i){class c{constructor(o){s(this,"type");s(this,"size");s(this,"color");s(this,"textColor");s(this,"disabled");s(this,"loading");this.type=o.type||"default",this.size=o.size||"medium",this.color=o.color,this.textColor=o.textColor,this.disabled=o.disabled??!1,this.loading=o.loading??!1}get classes(){const o=["i-button",this.type,this.size];return this.disabled&&o.push("disabled"),this.loading&&o.push("loading"),o.join(" ")}get styles(){return{backgroundColor:this.color||"",color:this.textColor||""}}}const a=i,l=t.reactive(new c(a));return(d,o)=>(t.openBlock(),t.createElementBlock("button",{class:t.normalizeClass(l.classes),style:t.normalizeStyle(l.styles),disabled:l.disabled,onClick:o[0]||(o[0]=f=>d.$emit("click",f))},[t.renderSlot(d.$slots,"default",{},void 0,!0)],14,n))}}),[["__scopeId","data-v-63e0e36c"]]),u={install:i=>{i.component("IButton",r)}};e.IButton=r,e.default=u,Object.defineProperties(e,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}));
|
package/package.json
CHANGED
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "yanzhi-ui",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "0.1.
|
|
5
|
-
"
|
|
6
|
-
"
|
|
7
|
-
"
|
|
8
|
-
"files": [
|
|
4
|
+
"version": "0.1.3",
|
|
5
|
+
"types": "dist/yanzhi-ui.d.ts",
|
|
6
|
+
"main": "dist/yanzhi-ui.umd.js",
|
|
7
|
+
"module": "dist/yanzhi-ui.mjs",
|
|
8
|
+
"files": [
|
|
9
|
+
"dist",
|
|
10
|
+
"src/packages"
|
|
11
|
+
],
|
|
9
12
|
"scripts": {
|
|
10
13
|
"dev": "vite",
|
|
11
14
|
"build": "vite build"
|
|
@@ -14,9 +17,16 @@
|
|
|
14
17
|
"vue": "^3.2.0"
|
|
15
18
|
},
|
|
16
19
|
"devDependencies": {
|
|
17
|
-
"vite": "^6.0.0",
|
|
18
20
|
"@vitejs/plugin-vue": "^5.2.0",
|
|
19
|
-
"
|
|
20
|
-
"
|
|
21
|
+
"typescript": "^5.1.0",
|
|
22
|
+
"vite": "^6.0.0",
|
|
23
|
+
"vite-plugin-dts": "^4.5.4",
|
|
24
|
+
"vue": "^3.2.0"
|
|
25
|
+
},
|
|
26
|
+
"exports": {
|
|
27
|
+
".": {
|
|
28
|
+
"import": "./dist/yanzhi-ui.mjs",
|
|
29
|
+
"require": "./dist/yanzhi-ui.umd.js"
|
|
30
|
+
}
|
|
21
31
|
}
|
|
22
32
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<button
|
|
3
|
-
:class="
|
|
4
|
-
:style="
|
|
5
|
-
:disabled="disabled
|
|
3
|
+
:class="button.classes"
|
|
4
|
+
:style="button.styles"
|
|
5
|
+
:disabled="button.disabled"
|
|
6
6
|
@click="$emit('click', $event)"
|
|
7
7
|
>
|
|
8
8
|
<slot />
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
</template>
|
|
11
11
|
|
|
12
12
|
<script setup lang="ts">
|
|
13
|
-
import { computed } from 'vue'
|
|
13
|
+
import { reactive, computed, toRefs } from 'vue'
|
|
14
14
|
|
|
15
15
|
interface ButtonProps {
|
|
16
16
|
type?: 'default' | 'primary' | 'success' | 'warning' | 'error'
|
|
@@ -21,22 +21,41 @@ interface ButtonProps {
|
|
|
21
21
|
loading?: boolean
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
-
|
|
25
|
-
type: '
|
|
26
|
-
size: '
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
24
|
+
class Button {
|
|
25
|
+
type: ButtonProps['type']
|
|
26
|
+
size: ButtonProps['size']
|
|
27
|
+
color?: string
|
|
28
|
+
textColor?: string
|
|
29
|
+
disabled: boolean
|
|
30
|
+
loading: boolean
|
|
31
|
+
|
|
32
|
+
constructor(props: ButtonProps) {
|
|
33
|
+
this.type = props.type || 'default'
|
|
34
|
+
this.size = props.size || 'medium'
|
|
35
|
+
this.color = props.color
|
|
36
|
+
this.textColor = props.textColor
|
|
37
|
+
this.disabled = props.disabled ?? false
|
|
38
|
+
this.loading = props.loading ?? false
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
get classes() {
|
|
42
|
+
const cls = ['i-button', this.type, this.size]
|
|
43
|
+
if (this.disabled) cls.push('disabled')
|
|
44
|
+
if (this.loading) cls.push('loading')
|
|
45
|
+
return cls.join(' ')
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
get styles() {
|
|
49
|
+
return {
|
|
50
|
+
backgroundColor: this.color || '',
|
|
51
|
+
color: this.textColor || ''
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
const props = withDefaults(defineProps<ButtonProps>(), {})
|
|
57
|
+
|
|
58
|
+
const button = reactive(new Button(props))
|
|
40
59
|
</script>
|
|
41
60
|
|
|
42
61
|
<style scoped>
|
|
@@ -46,6 +65,7 @@ const textColor = computed(() => props.textColor || '')
|
|
|
46
65
|
height: 32px;
|
|
47
66
|
border: none;
|
|
48
67
|
cursor: pointer;
|
|
68
|
+
transition: all 0.2s;
|
|
49
69
|
}
|
|
50
70
|
.i-button.small { height: 24px; }
|
|
51
71
|
.i-button.medium { height: 32px; }
|
package/src/packages/index.ts
CHANGED
|
@@ -1 +1,10 @@
|
|
|
1
|
-
|
|
1
|
+
// packages/index.ts
|
|
2
|
+
import type { App } from 'vue'
|
|
3
|
+
import IButton from './button/Button.vue'
|
|
4
|
+
|
|
5
|
+
const install = (app: App) => {
|
|
6
|
+
app.component('IButton', IButton)
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export { IButton }
|
|
10
|
+
export default { install }
|