xt-element-ui 1.0.5 → 1.0.7
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/lib/index.common.js +399 -76
- package/lib/index.css +1 -1
- package/lib/index.umd.js +404 -81
- package/lib/index.umd.min.js +1 -1
- package/package.json +2 -2
- package/src/components/card/index.js +2 -0
- package/src/components/card/index.vue +48 -0
- package/src/components/card-item/index.js +2 -0
- package/src/components/card-item/index.vue +48 -0
- package/src/components/chart/index.js +0 -0
- package/src/components/chart/index.vue +0 -0
- package/src/components/flex-box/index.js +2 -0
- package/src/components/flex-box/index.vue +104 -0
- package/src/index.js +23 -19
- package/src/styles/export.scss +86 -0
- package/src/styles/theme-element.scss +1 -1
- package/src/styles/theme.scss +81 -59
- package/src/styles/variables.scss +119 -41
- package/src/utils/index.js +124 -0
- package/lib/fonts/element-icons.535877f5.woff +0 -0
- package/lib/fonts/element-icons.732389de.ttf +0 -0
package/lib/index.umd.min.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(e
|
|
1
|
+
(function(t,e){"object"===typeof exports&&"object"===typeof module?module.exports=e():"function"===typeof define&&define.amd?define("xt-element-ui",[],e):"object"===typeof exports?exports["xt-element-ui"]=e():t["xt-element-ui"]=e()})("undefined"!==typeof self?self:this,(function(){return function(t){var e={};function n(o){if(e[o])return e[o].exports;var r=e[o]={i:o,l:!1,exports:{}};return t[o].call(r.exports,r,r.exports,n),r.l=!0,r.exports}return n.m=t,n.c=e,n.d=function(t,e,o){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:o})},n.r=function(t){"undefined"!==typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"===typeof t&&t&&t.__esModule)return t;var o=Object.create(null);if(n.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var r in t)n.d(o,r,function(e){return t[e]}.bind(null,r));return o},n.n=function(t){var e=t&&t.__esModule?function(){return t["default"]}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s="fb15")}({1809:function(t,e,n){},"1e2e":function(t,e,n){"use strict";n("b7a7")},2580:function(t,e,n){"use strict";n("1809")},"27fd":function(t,e,n){t.exports={xtColorPrimary:"#409EFF",xtColorSuccess:"#67C23A",xtColorWarning:"#E6A23C",xtColorDanger:"#F56C6C",xtColorInfo:"#909399",xtColorPrimaryLight3:"#79BBFF",xtColorPrimaryLight5:"#A0CFFF",xtColorPrimaryLight7:"#C6E2FF",xtColorPrimaryLight8:"#D9ECFF",xtColorPrimaryLight9:"#ECF5FF",xtColorTextPrimary:"#303133",xtColorTextRegular:"#606266",xtColorTextSecondary:"#909399",xtColorTextPlaceholder:"#C0C4CC",xtColorTextDisabled:"#C0C4CC",xtColorBgPrimary:"#ffffff",xtColorBgSecondary:"#f5f7fa",xtColorBgHover:"#f5f5f5",xtColorBgContainer:"#f5f7fa",xtColorBgOverlay:"#ffffff",xtColorBorder:"#DCDFE6",xtColorBorderLight:"#E4E7ED",xtColorBorderLighter:"#EBEEF5",xtColorBorderExtraLight:"#F2F6FC",xtFontSizeExtraLarge:"20px",xtFontSizeLarge:"18px",xtFontSizeMedium:"16px",xtFontSizeBase:"14px",xtFontSizeSmall:"13px",xtFontSizeExtraSmall:"12px",xtSpacingXs:"4px",xtSpacingSm:"8px",xtSpacingMd:"12px",xtSpacingLg:"16px",xtSpacingXl:"20px",xtBorderRadiusBase:"4px",xtBorderRadiusSmall:"2px",xtBorderRadiusRound:"20px",xtBorderRadiusCircle:"50%",xtShadowSm:"0 2px 4px rgba(0, 0, 0, 0.04)",xtShadowMd:"0 4px 12px rgba(0, 0, 0, 0.08)",xtShadowLg:"0 8px 24px rgba(0, 0, 0, 0.12)",xtTransitionDuration:"0.3s",xtTransitionDurationFast:"0.2s"}},4755:function(t,e,n){"use strict";n("991c")},"991c":function(t,e,n){},b7a7:function(t,e,n){},fb15:function(t,e,n){"use strict";if(n.r(e),n.d(e,"utils",(function(){return m})),n.d(e,"variables",(function(){return l.a})),n.d(e,"getConfig",(function(){return rt})),n.d(e,"setConfig",(function(){return it})),n.d(e,"setTheme",(function(){return lt})),n.d(e,"setSize",(function(){return at})),n.d(e,"setPrimaryColor",(function(){return ut})),n.d(e,"getTheme",(function(){return st})),n.d(e,"getSize",(function(){return ct})),n.d(e,"getPrimaryColor",(function(){return ft})),n.d(e,"resetConfig",(function(){return dt})),n.d(e,"onConfigChange",(function(){return pt})),"undefined"!==typeof window){var o=window.document.currentScript,r=o&&o.src.match(/(.+\/)[^/]+\.js(\?.*)?$/);r&&(n.p=r[1])}var i=n("27fd"),l=n.n(i);const a={theme:"light",size:"medium",primaryColor:"#1890ff"};let u={...a};const s=[],c=function(t,e){s.forEach(n=>{n(t,e)})},f=function(t){const e=["light","dark","compact"];e.includes(t)?(u.theme=t,document.documentElement.setAttribute("data-theme",t),c("theme",t)):console.warn(`[XtElementUI] 无效的主题值: ${t},可选值: ${e.join(", ")}`)},d=function(t){const e=["small","medium","large"];e.includes(t)?(u.size=t,document.documentElement.setAttribute("data-size",t),c("size",t)):console.warn(`[XtElementUI] 无效的大小值: ${t},可选值: ${e.join(", ")}`)},p=function(t){const e=/^#[0-9A-Fa-f]{6}$|^#[0-9A-Fa-f]{3}$/;e.test(t)?(u.primaryColor=t,document.documentElement.style.setProperty("--xt-color-primary",t),c("primaryColor",t)):console.warn(`[XtElementUI] 无效的颜色值: ${t},请使用十六进制颜色格式,如 #1890ff`)};var m={setTheme:f,setSize:d,setPrimaryColor:p},x=function(){var t=this,e=t._self._c;return e("el-button",{on:{click:t.handleClick}},[t._t("default")],2)},C=[],g={name:"XtButton",methods:{handleClick(){this.$emit("click")}}},h=g;function y(t,e,n,o,r,i,l,a){var u,s="function"===typeof t?t.options:t;if(e&&(s.render=e,s.staticRenderFns=n,s._compiled=!0),o&&(s.functional=!0),i&&(s._scopeId="data-v-"+i),l?(u=function(t){t=t||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext,t||"undefined"===typeof __VUE_SSR_CONTEXT__||(t=__VUE_SSR_CONTEXT__),r&&r.call(this,t),t&&t._registeredComponents&&t._registeredComponents.add(l)},s._ssrRegister=u):r&&(u=a?function(){r.call(this,(s.functional?this.parent:this).$root.$options.shadowRoot)}:r),u)if(s.functional){s._injectStyles=u;var c=s.render;s.render=function(t,e){return u.call(e),c(t,e)}}else{var f=s.beforeCreate;s.beforeCreate=f?[].concat(f,u):[u]}return{exports:t,options:s}}var _=y(h,x,C,!1,null,null,null),v=_.exports,S=v,b=function(){var t=this,e=t._self._c;return e("el-input",{attrs:{value:t.value,placeholder:t.placeholder},on:{input:function(e){return t.$emit("input",e)}}})},E=[],F={name:"XtInput",props:{value:[String,Number],placeholder:{type:String,default:"请输入内容"}}},$=F,w=y($,b,E,!1,null,null,null),B=w.exports,P=B,z=function(){var t=this,e=t._self._c;return e("div",{staticClass:"xt-flex-box",class:t.classAttrs,staticStyle:{gap:"gap"}})},j=[],X={name:"XtFlex",props:{type:"flex",align:"center",content:"start",direction:"row",wrap:"unset",gap:{}},computed:{classAttrs(){const{inline:t,align:e,wrap:n,direction:o,content:r}=this;return[""+(t?"is-inline":"flex"),`align-${e} content-${r} direction-${o} wrap-${n}`]}}},I=X,T=(n("4755"),y(I,z,j,!1,null,"617fe54e",null)),A=T.exports,L=A,O=function(){var t=this,e=t._self._c;return e("div",{staticClass:"xt-card",class:{"no-padding":t.noPadding}},[t.title?e("div",{staticClass:"card_header"},[t._t("title",(function(){return[t._v(t._s(t.title))]}))],2):t._e(),e("div",{staticClass:"card_body"},[t._t("default",(function(){return[e("span",{staticClass:"value"},[t._t("value",(function(){return[t._v(t._s(t.value))]}))],2),e("span",{staticClass:"unit"},[t._v(t._s(t.unit))])]}))],2)])},R=[],U={name:"XtCard",props:{type:{},title:{},value:{},unit:{},icon:{},iconIn:{default:"right"},noPadding:{type:Boolean,default:!1}}},D=U,M=(n("1e2e"),y(D,O,R,!1,null,null,null)),k=M.exports,V=k,N=function(){var t=this,e=t._self._c;return e("div",{staticClass:"xt-card",class:{"no-padding":t.noPadding}},[t.title?e("div",{staticClass:"card_header"},[t._t("title",(function(){return[t._v(t._s(t.title))]}))],2):t._e(),e("div",{staticClass:"card_body"},[t._t("default",(function(){return[e("span",{staticClass:"value"},[t._t("value",(function(){return[t._v(t._s(t.value))]}))],2),e("span",{staticClass:"unit"},[t._v(t._s(t.unit))])]}))],2)])},H=[],W={name:"XtCardItem",props:{type:{},title:{},value:{},unit:{},icon:{},iconIn:{default:"right"},noPadding:{type:Boolean,default:!1}}},q=W,G=(n("2580"),y(q,N,H,!1,null,null,null)),J=G.exports,K=J;const Q=[S,P,L,V,K],Y=function(t){Y.installed||(Y.installed=!0,Q.forEach(e=>{t.component(e.name,e)}),t.prototype.$utils=m)};"undefined"!==typeof window&&window.Vue&&Y(window.Vue);var Z={install:Y,Button:S,Input:P,FlexBox:L,Card:V,CardItem:K};const tt={theme:"light",size:"medium",primaryColor:"#1890ff"};let et={...tt};const nt=[],ot=function(t,e){nt.forEach(n=>{n(t,e)})},rt=function(){return{...et}},it=function(t){"object"===typeof t&&null!==t?(void 0!==t.theme&<(t.theme),void 0!==t.size&&at(t.size),void 0!==t.primaryColor&&ut(t.primaryColor)):console.warn("[XtElementUI] setConfig 必须传入对象参数")},lt=function(t){const e=["light","dark"];e.includes(t)?(et.theme=t,document.documentElement.setAttribute("data-theme",t),ot("theme",t)):console.warn(`[XtElementUI] 无效的主题值: ${t},可选值: ${e.join(", ")}`)},at=function(t){const e=["small","medium","large"];e.includes(t)?(et.size=t,document.documentElement.setAttribute("data-size",t),ot("size",t)):console.warn(`[XtElementUI] 无效的大小值: ${t},可选值: ${e.join(", ")}`)},ut=function(t){const e=/^#[0-9A-Fa-f]{6}$|^#[0-9A-Fa-f]{3}$/;e.test(t)?(et.primaryColor=t,document.documentElement.style.setProperty("--xt-color-primary",t),ot("primaryColor",t)):console.warn(`[XtElementUI] 无效的颜色值: ${t},请使用十六进制颜色格式,如 #1890ff`)},st=function(){return et.theme},ct=function(){return et.size},ft=function(){return et.primaryColor},dt=function(){it(tt)},pt=function(t){if("function"===typeof t)return nt.push(t),function(){const e=nt.indexOf(t);e>-1&&nt.splice(e,1)};console.warn("[XtElementUI] onConfigChange 必须传入函数")};e["default"]=Z}})}));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "xt-element-ui",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.7",
|
|
4
4
|
"description": "基于 Vue2.7 + ElementUI 的组件库",
|
|
5
5
|
"main": "lib/index.common.js",
|
|
6
6
|
"module": "lib/index.esm.js",
|
|
@@ -32,6 +32,6 @@
|
|
|
32
32
|
],
|
|
33
33
|
"dependencies": {
|
|
34
34
|
"vue-server-renderer": "^2.7.14",
|
|
35
|
-
"xt-element-ui": "^1.0.
|
|
35
|
+
"xt-element-ui": "^1.0.6"
|
|
36
36
|
}
|
|
37
37
|
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="xt-card" :class="{'no-padding': noPadding }">
|
|
3
|
+
<div class="card_header" v-if="title">
|
|
4
|
+
<slot name="title">{{title }}</slot>
|
|
5
|
+
</div>
|
|
6
|
+
<div class="card_body">
|
|
7
|
+
<slot>
|
|
8
|
+
<span class="value"><slot name="value">{{value}}</slot></span>
|
|
9
|
+
<span class="unit">{{ unit }}</span>
|
|
10
|
+
</slot>
|
|
11
|
+
</div>
|
|
12
|
+
</div>
|
|
13
|
+
</template>
|
|
14
|
+
<script>
|
|
15
|
+
export default {
|
|
16
|
+
name:"XtCard",
|
|
17
|
+
props:{
|
|
18
|
+
type:{},
|
|
19
|
+
title:{},
|
|
20
|
+
value:{},
|
|
21
|
+
unit:{},
|
|
22
|
+
icon:{},
|
|
23
|
+
iconIn:{default:"right"},
|
|
24
|
+
noPadding:{type:Boolean,default:false}
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
</script>
|
|
28
|
+
<style lang="scss">
|
|
29
|
+
.xt-card{
|
|
30
|
+
border-radius: 4px;
|
|
31
|
+
box-shadow: 0 2px 12px 0 rgha(0,0,0,1);
|
|
32
|
+
background-color:#fff;
|
|
33
|
+
overflow: hidden; color:#303133; transition:.35;
|
|
34
|
+
.card__header{
|
|
35
|
+
padding:18px 20px;
|
|
36
|
+
box-sizing:border-box;
|
|
37
|
+
}
|
|
38
|
+
.card_body{
|
|
39
|
+
padding:20px;
|
|
40
|
+
.value{
|
|
41
|
+
font-size:20px; font-weight: 600;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
.value{font-weight:600;}
|
|
45
|
+
.card_header + .card__body{padding-top:0;}
|
|
46
|
+
&.noPadding{ .card_body{padding:0px;}}
|
|
47
|
+
}
|
|
48
|
+
</style>
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="xt-card" :class="{'no-padding': noPadding }">
|
|
3
|
+
<div class="card_header" v-if="title">
|
|
4
|
+
<slot name="title">{{title }}</slot>
|
|
5
|
+
</div>
|
|
6
|
+
<div class="card_body">
|
|
7
|
+
<slot>
|
|
8
|
+
<span class="value"><slot name="value">{{value}}</slot></span>
|
|
9
|
+
<span class="unit">{{ unit }}</span>
|
|
10
|
+
</slot>
|
|
11
|
+
</div>
|
|
12
|
+
</div>
|
|
13
|
+
</template>
|
|
14
|
+
<script>
|
|
15
|
+
export default {
|
|
16
|
+
name:"XtCardItem",
|
|
17
|
+
props:{
|
|
18
|
+
type:{},
|
|
19
|
+
title:{},
|
|
20
|
+
value:{},
|
|
21
|
+
unit:{},
|
|
22
|
+
icon:{},
|
|
23
|
+
iconIn:{default:"right"},
|
|
24
|
+
noPadding:{type:Boolean,default:false}
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
</script>
|
|
28
|
+
<style lang="scss">
|
|
29
|
+
.xt-card{
|
|
30
|
+
border-radius: 4px;
|
|
31
|
+
box-shadow: 0 2px 12px 0 rgha(0,0,0,1);
|
|
32
|
+
background-color:#fff;
|
|
33
|
+
overflow: hidden; color:#303133; transition:.35;
|
|
34
|
+
.card__header{
|
|
35
|
+
padding:18px 20px;
|
|
36
|
+
box-sizing:border-box;
|
|
37
|
+
}
|
|
38
|
+
.card_body{
|
|
39
|
+
padding:20px;
|
|
40
|
+
.value{
|
|
41
|
+
font-size:20px; font-weight: 600;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
.value{font-weight:600;}
|
|
45
|
+
.card_header + .card__body{padding-top:0;}
|
|
46
|
+
&.noPadding{ .card_body{padding:0px;}}
|
|
47
|
+
}
|
|
48
|
+
</style>
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
<<template>
|
|
2
|
+
<div class="xt-flex-box" :class="classAttrs" style="gap: gap">
|
|
3
|
+
|
|
4
|
+
</div>
|
|
5
|
+
</template>
|
|
6
|
+
|
|
7
|
+
<script>
|
|
8
|
+
export default {
|
|
9
|
+
name: "XtFlex",
|
|
10
|
+
props: {
|
|
11
|
+
type: "flex",
|
|
12
|
+
align: "center",
|
|
13
|
+
content: "start",
|
|
14
|
+
direction: "row",
|
|
15
|
+
wrap: "unset",
|
|
16
|
+
gap: {}
|
|
17
|
+
},
|
|
18
|
+
computed: {
|
|
19
|
+
classAttrs(){
|
|
20
|
+
const {inline, align, wrap, direction,content} = this;
|
|
21
|
+
return [`${inline?'is-inline':'flex'}`, `align-${align} content-${content} direction-${direction} wrap-${wrap}`]
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
</script>
|
|
26
|
+
|
|
27
|
+
<style scoped lang="scss">
|
|
28
|
+
.xt-flex-box{
|
|
29
|
+
&.flex{
|
|
30
|
+
display: flex;
|
|
31
|
+
&.direction{
|
|
32
|
+
&-row,&-row-reverse{
|
|
33
|
+
>.flex{
|
|
34
|
+
width: 100%;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
&-column,&-column-reverse{
|
|
38
|
+
>.flex{
|
|
39
|
+
height: 100%;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
&.is-inline{
|
|
45
|
+
display: inline-flex;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
}
|
|
49
|
+
.direction{
|
|
50
|
+
&-row{
|
|
51
|
+
flex-direction: row;
|
|
52
|
+
&-reverse{
|
|
53
|
+
flex-direction: row-reverse;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
&-column{
|
|
57
|
+
flex-direction: column;
|
|
58
|
+
&-reverse{
|
|
59
|
+
flex-direction: column-reverse;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
.align{
|
|
64
|
+
&-center{
|
|
65
|
+
align-items: center;
|
|
66
|
+
}
|
|
67
|
+
&-start{
|
|
68
|
+
align-items: flex-start;
|
|
69
|
+
}
|
|
70
|
+
&-end{
|
|
71
|
+
align-items: flex-end;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
.content{
|
|
77
|
+
&-center{
|
|
78
|
+
justify-content: center;
|
|
79
|
+
}
|
|
80
|
+
&-around{
|
|
81
|
+
justify-content: space-around;
|
|
82
|
+
}
|
|
83
|
+
&-between{
|
|
84
|
+
justify-content: space-between;
|
|
85
|
+
}
|
|
86
|
+
&-start{
|
|
87
|
+
justify-content: flex-start;
|
|
88
|
+
}
|
|
89
|
+
&-end{
|
|
90
|
+
justify-content: flex-end;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
.wrap{
|
|
94
|
+
&-wrap{
|
|
95
|
+
flex-wrap: wrap;
|
|
96
|
+
}
|
|
97
|
+
&-nowrap{
|
|
98
|
+
flex-wrap: nowrap;
|
|
99
|
+
}
|
|
100
|
+
&-unset{
|
|
101
|
+
flex-wrap: wrap;
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
</style>
|
package/src/index.js
CHANGED
|
@@ -1,29 +1,25 @@
|
|
|
1
|
-
// 导入
|
|
2
|
-
import
|
|
1
|
+
// 导入 SCSS 变量(通过 CSS Modules :export 导出)
|
|
2
|
+
import variables from './styles/export.scss'
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
if (typeof window !== 'undefined') {
|
|
6
|
-
window.Vue = Vue
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
// 导入 Element UI 并注册
|
|
10
|
-
import Element from 'element-ui'
|
|
11
|
-
import 'element-ui/lib/theme-chalk/index.css'
|
|
4
|
+
import utils from './utils/index'
|
|
12
5
|
|
|
13
6
|
// 导入组件
|
|
14
7
|
import Button from './components/button'
|
|
15
8
|
import Input from './components/input'
|
|
9
|
+
import FlexBox from './components/flex-box'
|
|
10
|
+
import Card from './components/card'
|
|
11
|
+
import CardItem from './components/card-item'
|
|
16
12
|
|
|
17
13
|
// 存储组件列表
|
|
18
14
|
const components = [
|
|
19
15
|
Button,
|
|
20
|
-
Input
|
|
16
|
+
Input,
|
|
17
|
+
FlexBox,
|
|
18
|
+
Card,
|
|
19
|
+
CardItem
|
|
21
20
|
]
|
|
22
21
|
|
|
23
22
|
|
|
24
|
-
// 注册 Element UI
|
|
25
|
-
Vue.use(Element)
|
|
26
|
-
|
|
27
23
|
// 定义 install 方法,Vue.use() 会自动调用
|
|
28
24
|
const install = function (Vue) {
|
|
29
25
|
if (install.installed) return
|
|
@@ -33,6 +29,7 @@ const install = function (Vue) {
|
|
|
33
29
|
components.forEach(component => {
|
|
34
30
|
Vue.component(component.name, component)
|
|
35
31
|
})
|
|
32
|
+
Vue.prototype.$utils = utils
|
|
36
33
|
}
|
|
37
34
|
|
|
38
35
|
// 支持全局 script 标签引入
|
|
@@ -45,9 +42,17 @@ export default {
|
|
|
45
42
|
install,
|
|
46
43
|
// 按需导出组件
|
|
47
44
|
Button,
|
|
48
|
-
Input
|
|
45
|
+
Input,
|
|
46
|
+
FlexBox,
|
|
47
|
+
Card,
|
|
48
|
+
CardItem
|
|
49
49
|
}
|
|
50
50
|
|
|
51
|
+
// 导出工具函数和变量
|
|
52
|
+
export {
|
|
53
|
+
utils,
|
|
54
|
+
variables
|
|
55
|
+
}
|
|
51
56
|
|
|
52
57
|
// 默认配置
|
|
53
58
|
const defaultConfig = {
|
|
@@ -91,9 +96,9 @@ export const setConfig = function(config) {
|
|
|
91
96
|
}
|
|
92
97
|
}
|
|
93
98
|
|
|
94
|
-
//
|
|
99
|
+
// 设置主题(只控制颜色)
|
|
95
100
|
export const setTheme = function(theme) {
|
|
96
|
-
const validThemes = ['light', 'dark'
|
|
101
|
+
const validThemes = ['light', 'dark']
|
|
97
102
|
if (!validThemes.includes(theme)) {
|
|
98
103
|
console.warn(`[XtElementUI] 无效的主题值: ${theme},可选值: ${validThemes.join(', ')}`)
|
|
99
104
|
return
|
|
@@ -104,7 +109,7 @@ export const setTheme = function(theme) {
|
|
|
104
109
|
emitConfigChange('theme', theme)
|
|
105
110
|
}
|
|
106
111
|
|
|
107
|
-
//
|
|
112
|
+
// 设置字体大小和间距
|
|
108
113
|
export const setSize = function(size) {
|
|
109
114
|
const validSizes = ['small', 'medium', 'large']
|
|
110
115
|
if (!validSizes.includes(size)) {
|
|
@@ -119,7 +124,6 @@ export const setSize = function(size) {
|
|
|
119
124
|
|
|
120
125
|
// 设置主色调
|
|
121
126
|
export const setPrimaryColor = function(color) {
|
|
122
|
-
// 简单的颜色格式验证
|
|
123
127
|
const colorRegex = /^#[0-9A-Fa-f]{6}$|^#[0-9A-Fa-f]{3}$/
|
|
124
128
|
if (!colorRegex.test(color)) {
|
|
125
129
|
console.warn(`[XtElementUI] 无效的颜色值: ${color},请使用十六进制颜色格式,如 #1890ff`)
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
@use './variables.scss' as *;
|
|
2
|
+
|
|
3
|
+
// SCSS 变量导出给 JavaScript 使用
|
|
4
|
+
:export {
|
|
5
|
+
// ===========================
|
|
6
|
+
// 主色调系列
|
|
7
|
+
// ===========================
|
|
8
|
+
xtColorPrimary: #{$xt-color-primary}; // 主颜色 - Element UI 标准蓝色
|
|
9
|
+
xtColorSuccess: #{$xt-color-success}; // 成功色 - Element UI 标准绿色
|
|
10
|
+
xtColorWarning: #{$xt-color-warning}; // 警告色 - Element UI 标准橙色
|
|
11
|
+
xtColorDanger: #{$xt-color-danger}; // 危险色 - Element UI 标准红色
|
|
12
|
+
xtColorInfo: #{$xt-color-info}; // 信息色 - Element UI 标准灰色
|
|
13
|
+
|
|
14
|
+
// 主色调浅色系列
|
|
15
|
+
xtColorPrimaryLight3: #{$xt-color-primary-light-3}; // 主色浅色 30%
|
|
16
|
+
xtColorPrimaryLight5: #{$xt-color-primary-light-5}; // 主色浅色 50%
|
|
17
|
+
xtColorPrimaryLight7: #{$xt-color-primary-light-7}; // 主色浅色 70%
|
|
18
|
+
xtColorPrimaryLight8: #{$xt-color-primary-light-8}; // 主色浅色 80%
|
|
19
|
+
xtColorPrimaryLight9: #{$xt-color-primary-light-9}; // 主色浅色 90%
|
|
20
|
+
|
|
21
|
+
// ===========================
|
|
22
|
+
// 文字颜色
|
|
23
|
+
// ===========================
|
|
24
|
+
xtColorTextPrimary: #{$xt-color-text-primary}; // 主要文字颜色 - 最深
|
|
25
|
+
xtColorTextRegular: #{$xt-color-text-regular}; // 常规文字颜色 - 中等
|
|
26
|
+
xtColorTextSecondary: #{$xt-color-text-secondary}; // 次要文字颜色 - 较浅
|
|
27
|
+
xtColorTextPlaceholder: #{$xt-color-text-placeholder}; // 占位符文字颜色
|
|
28
|
+
xtColorTextDisabled: #{$xt-color-text-disabled}; // 禁用状态文字颜色
|
|
29
|
+
|
|
30
|
+
// ===========================
|
|
31
|
+
// 背景颜色
|
|
32
|
+
// ===========================
|
|
33
|
+
xtColorBgPrimary: #{$xt-color-bg-primary}; // 主背景色 - 白色
|
|
34
|
+
xtColorBgSecondary: #{$xt-color-bg-secondary}; // 次要背景色 - 浅灰
|
|
35
|
+
xtColorBgHover: #{$xt-color-bg-hover}; // 悬停背景色
|
|
36
|
+
xtColorBgContainer: #{$xt-color-bg-container}; // 容器背景色
|
|
37
|
+
xtColorBgOverlay: #{$xt-color-bg-overlay}; // 浮层背景色
|
|
38
|
+
|
|
39
|
+
// ===========================
|
|
40
|
+
// 边框颜色
|
|
41
|
+
// ===========================
|
|
42
|
+
xtColorBorder: #{$xt-color-border}; // 边框颜色 - 标准
|
|
43
|
+
xtColorBorderLight: #{$xt-color-border-light}; // 边框浅色
|
|
44
|
+
xtColorBorderLighter: #{$xt-color-border-lighter}; // 边框更浅色
|
|
45
|
+
xtColorBorderExtraLight: #{$xt-color-border-extra-light}; // 边框极浅色
|
|
46
|
+
|
|
47
|
+
// ===========================
|
|
48
|
+
// 字体大小
|
|
49
|
+
// ===========================
|
|
50
|
+
xtFontSizeExtraLarge: #{$xt-font-size-extra-large}; // 特大字体
|
|
51
|
+
xtFontSizeLarge: #{$xt-font-size-large}; // 大字体
|
|
52
|
+
xtFontSizeMedium: #{$xt-font-size-medium}; // 中等字体
|
|
53
|
+
xtFontSizeBase: #{$xt-font-size-base}; // 基准字体
|
|
54
|
+
xtFontSizeSmall: #{$xt-font-size-small}; // 小字体
|
|
55
|
+
xtFontSizeExtraSmall: #{$xt-font-size-extra-small}; // 特小字体
|
|
56
|
+
|
|
57
|
+
// ===========================
|
|
58
|
+
// 间距
|
|
59
|
+
// ===========================
|
|
60
|
+
xtSpacingXs: #{$xt-spacing-xs}; // 最小间距
|
|
61
|
+
xtSpacingSm: #{$xt-spacing-sm}; // 小间距
|
|
62
|
+
xtSpacingMd: #{$xt-spacing-md}; // 中间距
|
|
63
|
+
xtSpacingLg: #{$xt-spacing-lg}; // 大间距
|
|
64
|
+
xtSpacingXl: #{$xt-spacing-xl}; // 特大间距
|
|
65
|
+
|
|
66
|
+
// ===========================
|
|
67
|
+
// 圆角
|
|
68
|
+
// ===========================
|
|
69
|
+
xtBorderRadiusBase: #{$xt-border-radius-base}; // 基准圆角
|
|
70
|
+
xtBorderRadiusSmall: #{$xt-border-radius-small}; // 小圆角
|
|
71
|
+
xtBorderRadiusRound: #{$xt-border-radius-round}; // 圆角(胶囊状)
|
|
72
|
+
xtBorderRadiusCircle: #{$xt-border-radius-circle}; // 圆形
|
|
73
|
+
|
|
74
|
+
// ===========================
|
|
75
|
+
// 阴影
|
|
76
|
+
// ===========================
|
|
77
|
+
xtShadowSm: #{$xt-shadow-sm}; // 小阴影
|
|
78
|
+
xtShadowMd: #{$xt-shadow-md}; // 中等阴影
|
|
79
|
+
xtShadowLg: #{$xt-shadow-lg}; // 大阴影
|
|
80
|
+
|
|
81
|
+
// ===========================
|
|
82
|
+
// 过渡动画
|
|
83
|
+
// ===========================
|
|
84
|
+
xtTransitionDuration: #{$xt-transition-duration}; // 默认过渡时长
|
|
85
|
+
xtTransitionDurationFast: #{$xt-transition-duration-fast}; // 快速过渡时长
|
|
86
|
+
}
|
package/src/styles/theme.scss
CHANGED
|
@@ -1,106 +1,128 @@
|
|
|
1
1
|
@use './variables.scss' as *;
|
|
2
2
|
|
|
3
3
|
:root {
|
|
4
|
+
// 主色调系列
|
|
4
5
|
--xt-color-primary: #{$xt-color-primary};
|
|
5
6
|
--xt-color-success: #{$xt-color-success};
|
|
6
7
|
--xt-color-warning: #{$xt-color-warning};
|
|
7
8
|
--xt-color-danger: #{$xt-color-danger};
|
|
8
9
|
--xt-color-info: #{$xt-color-info};
|
|
9
10
|
|
|
11
|
+
// 主色调浅色系列
|
|
12
|
+
--xt-color-primary-light-3: #{$xt-color-primary-light-3};
|
|
13
|
+
--xt-color-primary-light-5: #{$xt-color-primary-light-5};
|
|
14
|
+
--xt-color-primary-light-7: #{$xt-color-primary-light-7};
|
|
15
|
+
--xt-color-primary-light-8: #{$xt-color-primary-light-8};
|
|
16
|
+
--xt-color-primary-light-9: #{$xt-color-primary-light-9};
|
|
17
|
+
|
|
18
|
+
// 文字颜色
|
|
10
19
|
--xt-color-text-primary: #{$xt-color-text-primary};
|
|
20
|
+
--xt-color-text-regular: #{$xt-color-text-regular};
|
|
11
21
|
--xt-color-text-secondary: #{$xt-color-text-secondary};
|
|
12
22
|
--xt-color-text-placeholder: #{$xt-color-text-placeholder};
|
|
13
23
|
--xt-color-text-disabled: #{$xt-color-text-disabled};
|
|
14
24
|
|
|
25
|
+
// 背景颜色
|
|
15
26
|
--xt-color-bg-primary: #{$xt-color-bg-primary};
|
|
16
27
|
--xt-color-bg-secondary: #{$xt-color-bg-secondary};
|
|
17
28
|
--xt-color-bg-hover: #{$xt-color-bg-hover};
|
|
29
|
+
--xt-color-bg-container: #{$xt-color-bg-container};
|
|
30
|
+
--xt-color-bg-overlay: #{$xt-color-bg-overlay};
|
|
18
31
|
|
|
32
|
+
// 边框颜色
|
|
19
33
|
--xt-color-border: #{$xt-color-border};
|
|
20
34
|
--xt-color-border-light: #{$xt-color-border-light};
|
|
21
|
-
|
|
22
|
-
--xt-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
--xt-font-size-
|
|
26
|
-
--xt-font-size-
|
|
27
|
-
|
|
35
|
+
--xt-color-border-lighter: #{$xt-color-border-lighter};
|
|
36
|
+
--xt-color-border-extra-light: #{$xt-color-border-extra-light};
|
|
37
|
+
|
|
38
|
+
// 字体大小
|
|
39
|
+
--xt-font-size-extra-large: #{$xt-font-size-extra-large};
|
|
40
|
+
--xt-font-size-large: #{$xt-font-size-large};
|
|
41
|
+
--xt-font-size-medium: #{$xt-font-size-medium};
|
|
42
|
+
--xt-font-size-base: #{$xt-font-size-base};
|
|
43
|
+
--xt-font-size-small: #{$xt-font-size-small};
|
|
44
|
+
--xt-font-size-extra-small: #{$xt-font-size-extra-small};
|
|
45
|
+
|
|
46
|
+
// 间距
|
|
28
47
|
--xt-spacing-xs: #{$xt-spacing-xs};
|
|
29
48
|
--xt-spacing-sm: #{$xt-spacing-sm};
|
|
30
49
|
--xt-spacing-md: #{$xt-spacing-md};
|
|
31
50
|
--xt-spacing-lg: #{$xt-spacing-lg};
|
|
32
51
|
--xt-spacing-xl: #{$xt-spacing-xl};
|
|
33
52
|
|
|
34
|
-
|
|
35
|
-
--xt-border-radius-
|
|
36
|
-
--xt-border-radius-
|
|
53
|
+
// 圆角
|
|
54
|
+
--xt-border-radius-base: #{$xt-border-radius-base};
|
|
55
|
+
--xt-border-radius-small: #{$xt-border-radius-small};
|
|
56
|
+
--xt-border-radius-round: #{$xt-border-radius-round};
|
|
57
|
+
--xt-border-radius-circle: #{$xt-border-radius-circle};
|
|
58
|
+
|
|
59
|
+
// 阴影
|
|
60
|
+
--xt-shadow-sm: #{$xt-shadow-sm};
|
|
61
|
+
--xt-shadow-md: #{$xt-shadow-md};
|
|
62
|
+
--xt-shadow-lg: #{$xt-shadow-lg};
|
|
63
|
+
|
|
64
|
+
// 过渡动画
|
|
65
|
+
--xt-transition-duration: #{$xt-transition-duration};
|
|
66
|
+
--xt-transition-duration-fast: #{$xt-transition-duration-fast};
|
|
37
67
|
}
|
|
38
68
|
|
|
69
|
+
// 暗色主题 - 只控制颜色
|
|
39
70
|
[data-theme="dark"] {
|
|
40
|
-
--xt-color-primary: #
|
|
41
|
-
--xt-color-success: #
|
|
42
|
-
--xt-color-warning: #
|
|
43
|
-
--xt-color-danger: #
|
|
44
|
-
--xt-color-info: #
|
|
71
|
+
--xt-color-primary: #{$xt-color-primary};
|
|
72
|
+
--xt-color-success: #67C23A;
|
|
73
|
+
--xt-color-warning: #E6A23C;
|
|
74
|
+
--xt-color-danger: #F56C6C;
|
|
75
|
+
--xt-color-info: #909399;
|
|
45
76
|
|
|
46
77
|
--xt-color-text-primary: rgba(255, 255, 255, 0.95);
|
|
47
|
-
--xt-color-text-
|
|
48
|
-
--xt-color-text-
|
|
49
|
-
--xt-color-text-
|
|
78
|
+
--xt-color-text-regular: rgba(255, 255, 255, 0.8);
|
|
79
|
+
--xt-color-text-secondary: rgba(255, 255, 255, 0.6);
|
|
80
|
+
--xt-color-text-placeholder: rgba(255, 255, 255, 0.4);
|
|
81
|
+
--xt-color-text-disabled: rgba(255, 255, 255, 0.3);
|
|
50
82
|
|
|
51
83
|
--xt-color-bg-primary: #1f1f1f;
|
|
52
84
|
--xt-color-bg-secondary: #2d2d2d;
|
|
53
85
|
--xt-color-bg-hover: #3d3d3d;
|
|
86
|
+
--xt-color-bg-container: #1f1f1f;
|
|
87
|
+
--xt-color-bg-overlay: #2d2d2d;
|
|
54
88
|
|
|
55
89
|
--xt-color-border: #434343;
|
|
56
90
|
--xt-color-border-light: #3d3d3d;
|
|
91
|
+
--xt-color-border-lighter: #3d3d3d;
|
|
92
|
+
--xt-color-border-extra-light: #434343;
|
|
57
93
|
}
|
|
58
94
|
|
|
95
|
+
// 紧凑主题
|
|
59
96
|
[data-theme="compact"] {
|
|
60
|
-
--xt-
|
|
61
|
-
--xt-
|
|
62
|
-
--xt-color-warning: #d49806;
|
|
63
|
-
--xt-color-danger: #cf1322;
|
|
64
|
-
}
|
|
97
|
+
--xt-font-size-base: 13px;
|
|
98
|
+
--xt-font-size-small: 12px;
|
|
65
99
|
|
|
66
|
-
|
|
67
|
-
--xt-
|
|
68
|
-
--xt-
|
|
69
|
-
--xt-
|
|
70
|
-
--xt-font-size-lg: #{18 + 0}px;
|
|
71
|
-
--xt-font-size-xl: #{20 + 0}px;
|
|
72
|
-
|
|
73
|
-
--xt-spacing-xs: #{4 + 0}px;
|
|
74
|
-
--xt-spacing-sm: #{8 + 0}px;
|
|
75
|
-
--xt-spacing-md: #{16 + 0}px;
|
|
76
|
-
--xt-spacing-lg: #{24 + 0}px;
|
|
77
|
-
--xt-spacing-xl: #{32 + 0}px;
|
|
100
|
+
--xt-spacing-xs: 3px;
|
|
101
|
+
--xt-spacing-sm: 6px;
|
|
102
|
+
--xt-spacing-md: 10px;
|
|
103
|
+
--xt-spacing-lg: 14px;
|
|
78
104
|
}
|
|
79
105
|
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
--xt-font-size-
|
|
83
|
-
--xt-font-size-
|
|
84
|
-
--xt-font-size-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
--xt-spacing-
|
|
88
|
-
--xt-spacing-
|
|
89
|
-
--xt-spacing-
|
|
90
|
-
--xt-spacing-lg: #{24 + 6}px;
|
|
91
|
-
--xt-spacing-xl: #{32 + 8}px;
|
|
106
|
+
// 大字体主题
|
|
107
|
+
[data-size="large"] {
|
|
108
|
+
--xt-font-size-base: 16px;
|
|
109
|
+
--xt-font-size-medium: 18px;
|
|
110
|
+
--xt-font-size-large: 20px;
|
|
111
|
+
|
|
112
|
+
--xt-spacing-xs: 5px;
|
|
113
|
+
--xt-spacing-sm: 10px;
|
|
114
|
+
--xt-spacing-md: 15px;
|
|
115
|
+
--xt-spacing-lg: 20px;
|
|
92
116
|
}
|
|
93
117
|
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
--xt-font-size-
|
|
97
|
-
--xt-font-size-
|
|
98
|
-
--xt-font-size-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
--xt-spacing-
|
|
102
|
-
--xt-spacing-
|
|
103
|
-
--xt-spacing-
|
|
104
|
-
--xt-spacing-lg: #{24 + 12}px;
|
|
105
|
-
--xt-spacing-xl: #{32 + 16}px;
|
|
118
|
+
// 小字体主题
|
|
119
|
+
[data-size="small"] {
|
|
120
|
+
--xt-font-size-base: 12px;
|
|
121
|
+
--xt-font-size-small: 11px;
|
|
122
|
+
--xt-font-size-extra-small: 10px;
|
|
123
|
+
|
|
124
|
+
--xt-spacing-xs: 3px;
|
|
125
|
+
--xt-spacing-sm: 6px;
|
|
126
|
+
--xt-spacing-md: 9px;
|
|
127
|
+
--xt-spacing-lg: 12px;
|
|
106
128
|
}
|