xt-element-ui 1.0.9 → 1.1.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/lib/index.common.js +135 -43
- package/lib/index.css +1 -1
- package/lib/index.umd.js +135 -43
- package/lib/index.umd.min.js +1 -1
- package/package.json +1 -1
- package/src/components/button/index.vue +29 -23
- package/src/components/button/style/index copy.scss +221 -0
- package/src/components/button/style/index.scss +31 -25
- package/src/components/card/style/index.scss +1 -1
- package/src/components/card-item/style/index.scss +1 -1
- package/src/components/config-provider/index.vue +18 -1
- package/src/components/index.scss +4 -1
- package/src/components/input/style/index.scss +1 -1
- package/src/components/text/index.js +2 -0
- package/src/components/text/index.vue +42 -0
- package/src/components/text/style/index.scss +45 -0
- package/src/index.js +7 -4
- package/src/styles/{vars.scss → css-variables.scss} +1 -1
- package/src/styles/theme/colors.scss +11 -0
- package/src/styles/theme/{component.scss → component-variables.scss} +3 -3
- package/src/styles/theme/index.scss +9 -9
- package/src/utils/index.js +3 -5
- package/src/styles/theme/color.scss +0 -11
- /package/src/styles/{theme-element.scss → element-theme.scss} +0 -0
- /package/src/styles/theme/{bg.scss → background.scss} +0 -0
- /package/src/styles/theme/{radius.scss → border-radius.scss} +0 -0
- /package/src/styles/theme/{border.scss → borders.scss} +0 -0
- /package/src/styles/theme/{dark.scss → dark-variables.scss} +0 -0
- /package/src/styles/theme/{shadow.scss → shadows.scss} +0 -0
- /package/src/styles/theme/{transition.scss → transitions.scss} +0 -0
- /package/src/styles/theme/{text.scss → typography.scss} +0 -0
- /package/src/styles/{export.scss → variables-export.scss} +0 -0
package/lib/index.umd.js
CHANGED
|
@@ -96,18 +96,18 @@ return /******/ (function(modules) { // webpackBootstrap
|
|
|
96
96
|
/************************************************************************/
|
|
97
97
|
/******/ ({
|
|
98
98
|
|
|
99
|
-
/***/ "
|
|
99
|
+
/***/ "72fa":
|
|
100
100
|
/***/ (function(module, exports, __webpack_require__) {
|
|
101
101
|
|
|
102
102
|
// extracted by mini-css-extract-plugin
|
|
103
|
-
module.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"};
|
|
104
103
|
|
|
105
104
|
/***/ }),
|
|
106
105
|
|
|
107
|
-
/***/ "
|
|
106
|
+
/***/ "ad4d":
|
|
108
107
|
/***/ (function(module, exports, __webpack_require__) {
|
|
109
108
|
|
|
110
109
|
// extracted by mini-css-extract-plugin
|
|
110
|
+
module.exports = {"xtColorPrimary":"#1890ff","xtColorSuccess":"#37c3a4","xtColorWarning":"#FFB74D","xtColorDanger":"#EA1D34","xtColorInfo":"#999999","xtColorPrimaryLight3":"#5DB1FF","xtColorPrimaryLight5":"#8CC8FF","xtColorPrimaryLight7":"#BADEFF","xtColorPrimaryLight8":"#D1E9FF","xtColorPrimaryLight9":"#E8F4FF","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"};
|
|
111
111
|
|
|
112
112
|
/***/ }),
|
|
113
113
|
|
|
@@ -127,7 +127,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
127
127
|
|
|
128
128
|
// EXPORTS
|
|
129
129
|
__webpack_require__.d(__webpack_exports__, "utils", function() { return /* reexport */ src_utils; });
|
|
130
|
-
__webpack_require__.d(__webpack_exports__, "variables", function() { return /* reexport */
|
|
130
|
+
__webpack_require__.d(__webpack_exports__, "variables", function() { return /* reexport */ variables_export_default.a; });
|
|
131
131
|
__webpack_require__.d(__webpack_exports__, "getConfig", function() { return /* reexport */ src_getConfig; });
|
|
132
132
|
__webpack_require__.d(__webpack_exports__, "setConfig", function() { return /* reexport */ src_setConfig; });
|
|
133
133
|
__webpack_require__.d(__webpack_exports__, "getTheme", function() { return /* reexport */ src_getTheme; });
|
|
@@ -155,22 +155,22 @@ if (typeof window !== 'undefined') {
|
|
|
155
155
|
// Indicate to webpack that this file can be concatenated
|
|
156
156
|
/* harmony default export */ var setPublicPath = (null);
|
|
157
157
|
|
|
158
|
-
// EXTERNAL MODULE: ./src/styles/
|
|
159
|
-
var
|
|
158
|
+
// EXTERNAL MODULE: ./src/styles/css-variables.scss
|
|
159
|
+
var css_variables = __webpack_require__("72fa");
|
|
160
160
|
|
|
161
161
|
// EXTERNAL MODULE: ./src/components/index.scss
|
|
162
162
|
var components = __webpack_require__("d67a");
|
|
163
163
|
|
|
164
|
-
// EXTERNAL MODULE: ./src/styles/export.scss
|
|
165
|
-
var
|
|
166
|
-
var
|
|
164
|
+
// EXTERNAL MODULE: ./src/styles/variables-export.scss
|
|
165
|
+
var variables_export = __webpack_require__("ad4d");
|
|
166
|
+
var variables_export_default = /*#__PURE__*/__webpack_require__.n(variables_export);
|
|
167
167
|
|
|
168
168
|
// CONCATENATED MODULE: ./src/utils/index.js
|
|
169
169
|
// 默认配置
|
|
170
170
|
const defaultConfig = {
|
|
171
|
-
theme: '
|
|
171
|
+
theme: 'white',
|
|
172
172
|
size: 'medium',
|
|
173
|
-
primaryColor: '#
|
|
173
|
+
primaryColor: '#1890ff'
|
|
174
174
|
}
|
|
175
175
|
|
|
176
176
|
// 当前配置
|
|
@@ -214,7 +214,7 @@ const setConfig = function(config) {
|
|
|
214
214
|
|
|
215
215
|
// 设置主题
|
|
216
216
|
const setTheme = function(theme) {
|
|
217
|
-
const validThemes = ['
|
|
217
|
+
const validThemes = ['white', 'dark']
|
|
218
218
|
if (!validThemes.includes(theme)) {
|
|
219
219
|
console.warn(`[XtElementUI] 无效的主题值: ${theme},可选值: ${validThemes.join(', ')}`)
|
|
220
220
|
return
|
|
@@ -225,10 +225,8 @@ const setTheme = function(theme) {
|
|
|
225
225
|
|
|
226
226
|
// 使用类名方式切换主题(兼容 Element Plus 风格)
|
|
227
227
|
if (theme === 'dark') {
|
|
228
|
-
root.classList.add('dark')
|
|
229
228
|
root.setAttribute('data-theme', 'dark')
|
|
230
229
|
} else {
|
|
231
|
-
root.classList.remove('dark')
|
|
232
230
|
root.removeAttribute('data-theme')
|
|
233
231
|
}
|
|
234
232
|
|
|
@@ -362,13 +360,21 @@ const onConfigChange = function(listener) {
|
|
|
362
360
|
onConfigChange
|
|
363
361
|
});
|
|
364
362
|
|
|
365
|
-
// CONCATENATED MODULE: ./node_modules/cache-loader/dist/cjs.js?{"cacheDirectory":"node_modules/.cache/vue-loader","cacheIdentifier":"721fc731-vue-loader-template"}!./node_modules/vue-loader/lib/loaders/templateLoader.js??ref--5!./node_modules/@vue/cli-service/node_modules/cache-loader/dist/cjs.js??ref--1-0!./node_modules/vue-loader/lib??vue-loader-options!./src/components/button/index.vue?vue&type=template&id=
|
|
366
|
-
var render = function render(){var _vm=this,_c=_vm._self._c;return _c('
|
|
363
|
+
// CONCATENATED MODULE: ./node_modules/cache-loader/dist/cjs.js?{"cacheDirectory":"node_modules/.cache/vue-loader","cacheIdentifier":"721fc731-vue-loader-template"}!./node_modules/vue-loader/lib/loaders/templateLoader.js??ref--5!./node_modules/@vue/cli-service/node_modules/cache-loader/dist/cjs.js??ref--1-0!./node_modules/vue-loader/lib??vue-loader-options!./src/components/button/index.vue?vue&type=template&id=0890decd
|
|
364
|
+
var render = function render(){var _vm=this,_c=_vm._self._c;return _c('button',{staticClass:"xt-button",class:[
|
|
365
|
+
'xt-button--' + _vm.type,
|
|
366
|
+
_vm.size ? 'xt-button--' + _vm.size : '',
|
|
367
|
+
{
|
|
368
|
+
'xt-button--plain': _vm.plain,
|
|
369
|
+
'is-disabled': _vm.disabled,
|
|
370
|
+
'is-round': _vm.round
|
|
371
|
+
}
|
|
372
|
+
],attrs:{"disabled":_vm.disabled},on:{"click":_vm.handleClick}},[_vm._t("default")],2)
|
|
367
373
|
}
|
|
368
374
|
var staticRenderFns = []
|
|
369
375
|
|
|
370
376
|
|
|
371
|
-
// CONCATENATED MODULE: ./src/components/button/index.vue?vue&type=template&id=
|
|
377
|
+
// CONCATENATED MODULE: ./src/components/button/index.vue?vue&type=template&id=0890decd
|
|
372
378
|
|
|
373
379
|
// CONCATENATED MODULE: ./node_modules/@vue/cli-service/node_modules/cache-loader/dist/cjs.js??ref--1-0!./node_modules/vue-loader/lib??vue-loader-options!./src/components/button/index.vue?vue&type=script&lang=js
|
|
374
380
|
|
|
@@ -377,32 +383,32 @@ var staticRenderFns = []
|
|
|
377
383
|
props: {
|
|
378
384
|
type: {
|
|
379
385
|
type: String,
|
|
380
|
-
default: '
|
|
386
|
+
default: 'default',
|
|
387
|
+
validator: (val) => ['default', 'primary', 'success', 'warning', 'danger'].includes(val)
|
|
388
|
+
},
|
|
389
|
+
size: {
|
|
390
|
+
type: String,
|
|
391
|
+
default: '',
|
|
392
|
+
validator: (val) => ['', 'large', 'medium', 'small', 'mini'].includes(val)
|
|
381
393
|
},
|
|
382
394
|
plain: {
|
|
383
395
|
type: Boolean,
|
|
384
396
|
default: false
|
|
385
397
|
},
|
|
386
|
-
|
|
387
|
-
type:
|
|
388
|
-
default:
|
|
389
|
-
}
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
if (this.color) {
|
|
394
|
-
return {
|
|
395
|
-
'--xt-button-bg-color': this.color,
|
|
396
|
-
'--xt-button-border-color': this.color,
|
|
397
|
-
'--xt-button-text-color': '#fff'
|
|
398
|
-
}
|
|
399
|
-
}
|
|
400
|
-
return {}
|
|
398
|
+
disabled: {
|
|
399
|
+
type: Boolean,
|
|
400
|
+
default: false
|
|
401
|
+
},
|
|
402
|
+
round: {
|
|
403
|
+
type: Boolean,
|
|
404
|
+
default: false
|
|
401
405
|
}
|
|
402
406
|
},
|
|
403
407
|
methods: {
|
|
404
408
|
handleClick() {
|
|
405
|
-
this
|
|
409
|
+
if (!this.disabled) {
|
|
410
|
+
this.$emit('click')
|
|
411
|
+
}
|
|
406
412
|
}
|
|
407
413
|
}
|
|
408
414
|
});
|
|
@@ -792,13 +798,13 @@ var card_item_component = normalizeComponent(
|
|
|
792
798
|
// CONCATENATED MODULE: ./src/components/card-item/index.js
|
|
793
799
|
|
|
794
800
|
/* harmony default export */ var components_card_item = (card_item);
|
|
795
|
-
// CONCATENATED MODULE: ./node_modules/cache-loader/dist/cjs.js?{"cacheDirectory":"node_modules/.cache/vue-loader","cacheIdentifier":"721fc731-vue-loader-template"}!./node_modules/vue-loader/lib/loaders/templateLoader.js??ref--5!./node_modules/@vue/cli-service/node_modules/cache-loader/dist/cjs.js??ref--1-0!./node_modules/vue-loader/lib??vue-loader-options!./src/components/config-provider/index.vue?vue&type=template&id=
|
|
796
|
-
var
|
|
801
|
+
// CONCATENATED MODULE: ./node_modules/cache-loader/dist/cjs.js?{"cacheDirectory":"node_modules/.cache/vue-loader","cacheIdentifier":"721fc731-vue-loader-template"}!./node_modules/vue-loader/lib/loaders/templateLoader.js??ref--5!./node_modules/@vue/cli-service/node_modules/cache-loader/dist/cjs.js??ref--1-0!./node_modules/vue-loader/lib??vue-loader-options!./src/components/config-provider/index.vue?vue&type=template&id=7d1cf1ae
|
|
802
|
+
var config_providervue_type_template_id_7d1cf1ae_render = function render(){var _vm=this,_c=_vm._self._c;return _c(_vm.tag,_vm._b({tag:"component",class:_vm.computedClass,style:(_vm.mergedStyle)},'component',_vm.customAttrs,false),[_vm._t("default")],2)
|
|
797
803
|
}
|
|
798
|
-
var
|
|
804
|
+
var config_providervue_type_template_id_7d1cf1ae_staticRenderFns = []
|
|
799
805
|
|
|
800
806
|
|
|
801
|
-
// CONCATENATED MODULE: ./src/components/config-provider/index.vue?vue&type=template&id=
|
|
807
|
+
// CONCATENATED MODULE: ./src/components/config-provider/index.vue?vue&type=template&id=7d1cf1ae
|
|
802
808
|
|
|
803
809
|
// CONCATENATED MODULE: ./node_modules/@vue/cli-service/node_modules/cache-loader/dist/cjs.js??ref--1-0!./node_modules/vue-loader/lib??vue-loader-options!./src/components/config-provider/index.vue?vue&type=script&lang=js
|
|
804
810
|
|
|
@@ -808,7 +814,7 @@ var config_providervue_type_template_id_676593fc_staticRenderFns = []
|
|
|
808
814
|
props: {
|
|
809
815
|
theme: {
|
|
810
816
|
type: String,
|
|
811
|
-
default: '
|
|
817
|
+
default: 'white'
|
|
812
818
|
},
|
|
813
819
|
size: {
|
|
814
820
|
type: String,
|
|
@@ -871,6 +877,23 @@ var config_providervue_type_template_id_676593fc_staticRenderFns = []
|
|
|
871
877
|
result['--xt-color-border'] = '#434343'
|
|
872
878
|
result['--xt-color-border-light'] = '#3d3d3d'
|
|
873
879
|
|
|
880
|
+
if (this.injectBackground) {
|
|
881
|
+
result.backgroundColor = result['--xt-color-bg-primary']
|
|
882
|
+
}
|
|
883
|
+
if (this.injectColor) {
|
|
884
|
+
result.color = result['--xt-color-text-primary']
|
|
885
|
+
}
|
|
886
|
+
} else {
|
|
887
|
+
// 恢复默认主题颜色(white 主题)
|
|
888
|
+
result['--xt-color-text-primary'] = '#303133'
|
|
889
|
+
result['--xt-color-text-regular'] = '#606266'
|
|
890
|
+
result['--xt-color-text-secondary'] = '#909399'
|
|
891
|
+
result['--xt-color-bg-primary'] = '#ffffff'
|
|
892
|
+
result['--xt-color-bg-secondary'] = '#f5f7fa'
|
|
893
|
+
result['--xt-color-bg-container'] = '#f5f7fa'
|
|
894
|
+
result['--xt-color-border'] = '#DCDFE6'
|
|
895
|
+
result['--xt-color-border-light'] = '#E4E7ED'
|
|
896
|
+
|
|
874
897
|
if (this.injectBackground) {
|
|
875
898
|
result.backgroundColor = result['--xt-color-bg-primary']
|
|
876
899
|
}
|
|
@@ -977,8 +1000,8 @@ var config_providervue_type_template_id_676593fc_staticRenderFns = []
|
|
|
977
1000
|
|
|
978
1001
|
var config_provider_component = normalizeComponent(
|
|
979
1002
|
components_config_providervue_type_script_lang_js,
|
|
980
|
-
|
|
981
|
-
|
|
1003
|
+
config_providervue_type_template_id_7d1cf1ae_render,
|
|
1004
|
+
config_providervue_type_template_id_7d1cf1ae_staticRenderFns,
|
|
982
1005
|
false,
|
|
983
1006
|
null,
|
|
984
1007
|
null,
|
|
@@ -991,6 +1014,72 @@ var config_provider_component = normalizeComponent(
|
|
|
991
1014
|
|
|
992
1015
|
/* harmony default export */ var components_config_provider = (config_provider);
|
|
993
1016
|
|
|
1017
|
+
// CONCATENATED MODULE: ./node_modules/cache-loader/dist/cjs.js?{"cacheDirectory":"node_modules/.cache/vue-loader","cacheIdentifier":"721fc731-vue-loader-template"}!./node_modules/vue-loader/lib/loaders/templateLoader.js??ref--5!./node_modules/@vue/cli-service/node_modules/cache-loader/dist/cjs.js??ref--1-0!./node_modules/vue-loader/lib??vue-loader-options!./src/components/text/index.vue?vue&type=template&id=04e7447e
|
|
1018
|
+
var textvue_type_template_id_04e7447e_render = function render(){var _vm=this,_c=_vm._self._c;return _c('span',{staticClass:"xt-text",class:[
|
|
1019
|
+
_vm.type ? 'xt-text--' + _vm.type : '',
|
|
1020
|
+
{ 'xt-text--bold': _vm.bold }
|
|
1021
|
+
],style:(_vm.customStyle)},[_vm._t("default")],2)
|
|
1022
|
+
}
|
|
1023
|
+
var textvue_type_template_id_04e7447e_staticRenderFns = []
|
|
1024
|
+
|
|
1025
|
+
|
|
1026
|
+
// CONCATENATED MODULE: ./src/components/text/index.vue?vue&type=template&id=04e7447e
|
|
1027
|
+
|
|
1028
|
+
// CONCATENATED MODULE: ./node_modules/@vue/cli-service/node_modules/cache-loader/dist/cjs.js??ref--1-0!./node_modules/vue-loader/lib??vue-loader-options!./src/components/text/index.vue?vue&type=script&lang=js
|
|
1029
|
+
|
|
1030
|
+
/* harmony default export */ var textvue_type_script_lang_js = ({
|
|
1031
|
+
name: 'XtText',
|
|
1032
|
+
props: {
|
|
1033
|
+
type: {
|
|
1034
|
+
type: String,
|
|
1035
|
+
default: '',
|
|
1036
|
+
validator: (val) => ['', 'primary', 'success', 'warning', 'danger'].includes(val)
|
|
1037
|
+
},
|
|
1038
|
+
bold: {
|
|
1039
|
+
type: Boolean,
|
|
1040
|
+
default: false
|
|
1041
|
+
},
|
|
1042
|
+
letterSpacing: {
|
|
1043
|
+
type: [String, Number],
|
|
1044
|
+
default: ''
|
|
1045
|
+
}
|
|
1046
|
+
},
|
|
1047
|
+
computed: {
|
|
1048
|
+
customStyle() {
|
|
1049
|
+
const style = {}
|
|
1050
|
+
if (this.letterSpacing) {
|
|
1051
|
+
style.letterSpacing = typeof this.letterSpacing === 'number' ? `${this.letterSpacing}px` : this.letterSpacing
|
|
1052
|
+
}
|
|
1053
|
+
return style
|
|
1054
|
+
}
|
|
1055
|
+
}
|
|
1056
|
+
});
|
|
1057
|
+
|
|
1058
|
+
// CONCATENATED MODULE: ./src/components/text/index.vue?vue&type=script&lang=js
|
|
1059
|
+
/* harmony default export */ var components_textvue_type_script_lang_js = (textvue_type_script_lang_js);
|
|
1060
|
+
// CONCATENATED MODULE: ./src/components/text/index.vue
|
|
1061
|
+
|
|
1062
|
+
|
|
1063
|
+
|
|
1064
|
+
|
|
1065
|
+
|
|
1066
|
+
/* normalize component */
|
|
1067
|
+
|
|
1068
|
+
var text_component = normalizeComponent(
|
|
1069
|
+
components_textvue_type_script_lang_js,
|
|
1070
|
+
textvue_type_template_id_04e7447e_render,
|
|
1071
|
+
textvue_type_template_id_04e7447e_staticRenderFns,
|
|
1072
|
+
false,
|
|
1073
|
+
null,
|
|
1074
|
+
null,
|
|
1075
|
+
null
|
|
1076
|
+
|
|
1077
|
+
)
|
|
1078
|
+
|
|
1079
|
+
/* harmony default export */ var components_text = (text_component.exports);
|
|
1080
|
+
// CONCATENATED MODULE: ./src/components/text/index.js
|
|
1081
|
+
|
|
1082
|
+
/* harmony default export */ var src_components_text = (components_text);
|
|
994
1083
|
// CONCATENATED MODULE: ./src/index.js
|
|
995
1084
|
// 导入主题样式(定义 CSS 变量)
|
|
996
1085
|
|
|
@@ -1017,6 +1106,7 @@ const { getConfig: src_getConfig, setConfig: src_setConfig, getTheme: src_getThe
|
|
|
1017
1106
|
|
|
1018
1107
|
|
|
1019
1108
|
|
|
1109
|
+
|
|
1020
1110
|
// 存储组件列表
|
|
1021
1111
|
const src_components = [
|
|
1022
1112
|
src_components_button,
|
|
@@ -1024,7 +1114,8 @@ const src_components = [
|
|
|
1024
1114
|
components_flex_box,
|
|
1025
1115
|
components_card,
|
|
1026
1116
|
components_card_item,
|
|
1027
|
-
components_config_provider
|
|
1117
|
+
components_config_provider,
|
|
1118
|
+
src_components_text
|
|
1028
1119
|
]
|
|
1029
1120
|
|
|
1030
1121
|
|
|
@@ -1087,7 +1178,8 @@ if (typeof window !== 'undefined' && window.Vue) {
|
|
|
1087
1178
|
FlexBox: components_flex_box,
|
|
1088
1179
|
Card: components_card,
|
|
1089
1180
|
CardItem: components_card_item,
|
|
1090
|
-
ConfigProvider: components_config_provider
|
|
1181
|
+
ConfigProvider: components_config_provider,
|
|
1182
|
+
Text: src_components_text
|
|
1091
1183
|
});
|
|
1092
1184
|
|
|
1093
1185
|
// 导出工具函数和变量
|
package/lib/index.umd.min.js
CHANGED
|
@@ -1 +1 @@
|
|
|
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 r(n){if(e[n])return e[n].exports;var o=e[n]={i:n,l:!1,exports:{}};return t[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}return r.m=t,r.c=e,r.d=function(t,e,n){r.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},r.r=function(t){"undefined"!==typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.t=function(t,e){if(1&e&&(t=r(t)),8&e)return t;if(4&e&&"object"===typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)r.d(n,o,function(e){return t[e]}.bind(null,o));return n},r.n=function(t){var e=t&&t.__esModule?function(){return t["default"]}:function(){return t};return r.d(e,"a",e),e},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.p="",r(r.s="fb15")}({"27fd":function(t,e,r){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"}},"7fc4":function(t,e,r){},d67a:function(t,e,r){},fb15:function(t,e,r){"use strict";if(r.r(e),r.d(e,"utils",(function(){return mt})),r.d(e,"variables",(function(){return l.a})),r.d(e,"getConfig",(function(){return gt})),r.d(e,"setConfig",(function(){return xt})),r.d(e,"getTheme",(function(){return ht})),r.d(e,"getSize",(function(){return yt})),r.d(e,"getPrimaryColor",(function(){return Ct})),r.d(e,"resetConfig",(function(){return vt})),r.d(e,"onConfigChange",(function(){return bt})),r.d(e,"setTheme",(function(){return _t})),r.d(e,"setSize",(function(){return St})),r.d(e,"setPrimaryColor",(function(){return Ft})),"undefined"!==typeof window){var n=window.document.currentScript,o=n&&n.src.match(/(.+\/)[^/]+\.js(\?.*)?$/);o&&(r.p=o[1])}r("7fc4"),r("d67a");var i=r("27fd"),l=r.n(i);const a={theme:"light",size:"medium",primaryColor:"#409EFF"};let s={...a};console.log("[XtElementUI] utils initialized with currentConfig:",s);const u=[],c=function(t,e){u.forEach(r=>{r(t,e)})},d=function(){return{...s}},f=function(t){"object"===typeof t&&null!==t?(void 0!==t.theme&&p(t.theme),void 0!==t.size&&m(t.size),void 0!==t.primaryColor&&y(t.primaryColor)):console.warn("[XtElementUI] setConfig 必须传入对象参数")},p=function(t){const e=["light","dark"];if(!e.includes(t))return void console.warn(`[XtElementUI] 无效的主题值: ${t},可选值: ${e.join(", ")}`);s.theme=t;const r=document.documentElement;"dark"===t?(r.classList.add("dark"),r.setAttribute("data-theme","dark")):(r.classList.remove("dark"),r.removeAttribute("data-theme")),c("theme",t)},m=function(t){const e=["small","medium","large"];e.includes(t)?(s.size=t,document.documentElement.setAttribute("data-size",t),c("size",t)):console.warn(`[XtElementUI] 无效的大小值: ${t},可选值: ${e.join(", ")}`)};function g(t){const e=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(t);return e?{r:parseInt(e[1],16),g:parseInt(e[2],16),b:parseInt(e[3],16)}:null}function x(t,e,r){return"#"+[t,e,r].map(t=>{const e=t.toString(16);return 1===e.length?"0"+e:e}).join("")}function h(t,e){const r=g(t);if(!r)return t;const n=Math.round(2.55*e),o=Math.min(255,r.r+n),i=Math.min(255,r.g+n),l=Math.min(255,r.b+n);return x(o,i,l)}const y=function(t){const e=/^#[0-9A-Fa-f]{3}$|^#[0-9A-Fa-f]{6}$|^#[0-9A-Fa-f]{8}$/;if(!e.test(t))return void console.warn(`[XtElementUI] 无效的颜色值: ${t},请使用十六进制颜色格式,如 #1890ff`);let r=t;4===t.length?r="#"+t[1]+t[1]+t[2]+t[2]+t[3]+t[3]:9===t.length&&(r=t.substring(0,7)),s.primaryColor=r,document.documentElement.style.setProperty("--xt-color-primary",r),document.documentElement.style.setProperty("--xt-color-primary-light-3",h(r,30)),document.documentElement.style.setProperty("--xt-color-primary-light-5",h(r,50)),document.documentElement.style.setProperty("--xt-color-primary-light-7",h(r,70)),document.documentElement.style.setProperty("--xt-color-primary-light-8",h(r,80)),document.documentElement.style.setProperty("--xt-color-primary-light-9",h(r,90)),c("primaryColor",r),console.log("[XtElementUI] 主色调已设置为:",r)},C=function(){return s.theme},v=function(){return s.size},b=function(){return s.primaryColor},_=function(){f(a)},S=function(t){if("function"===typeof t)return u.push(t),function(){const e=u.indexOf(t);e>-1&&u.splice(e,1)};console.warn("[XtElementUI] onConfigChange 必须传入函数")};var F={setTheme:p,setSize:m,setPrimaryColor:y,getConfig:d,setConfig:f,getTheme:C,getSize:v,getPrimaryColor:b,resetConfig:_,onConfigChange:S},E=function(){var t=this,e=t._self._c;return e("el-button",{staticClass:"xt-button",class:["xt-button--"+t.type],style:t.buttonStyle,attrs:{type:t.type,plain:t.plain},on:{click:t.handleClick}},[t._t("default")],2)},P=[],B={name:"XtButton",props:{type:{type:String,default:"primary"},plain:{type:Boolean,default:!1},color:{type:String,default:""}},computed:{buttonStyle(){return this.color?{"--xt-button-bg-color":this.color,"--xt-button-border-color":this.color,"--xt-button-text-color":"#fff"}:{}}},methods:{handleClick(){this.$emit("click")}}},z=B;function T(t,e,r,n,o,i,l,a){var s,u="function"===typeof t?t.options:t;if(e&&(u.render=e,u.staticRenderFns=r,u._compiled=!0),n&&(u.functional=!0),i&&(u._scopeId="data-v-"+i),l?(s=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__),o&&o.call(this,t),t&&t._registeredComponents&&t._registeredComponents.add(l)},u._ssrRegister=s):o&&(s=a?function(){o.call(this,(u.functional?this.parent:this).$root.$options.shadowRoot)}:o),s)if(u.functional){u._injectStyles=s;var c=u.render;u.render=function(t,e){return s.call(e),c(t,e)}}else{var d=u.beforeCreate;u.beforeCreate=d?[].concat(d,s):[s]}return{exports:t,options:u}}var w=T(z,E,P,!1,null,null,null),I=w.exports,$=I,j=function(){var t=this,e=t._self._c;return e("div",{staticClass:"xt-input"},[e("el-input",{style:t.inputStyle,attrs:{value:t.value,placeholder:t.placeholder},on:{input:function(e){return t.$emit("input",e)}}})],1)},A=[],X={name:"XtInput",props:{value:[String,Number],placeholder:{type:String,default:"请输入内容"},color:{type:String,default:""}},computed:{inputStyle(){return this.color?{"--xt-input-focus-color":this.color}:{}}}},k=X,M=T(k,j,A,!1,null,null,null),L=M.exports,R=L,O=function(){var t=this,e=t._self._c;return e("div",{staticClass:"xt-flex-box",class:t.classAttrs,style:t.flexStyle},[t._t("default")],2)},U=[],D={name:"XtFlexBox",props:{type:{type:String,default:"flex"},align:{type:String,default:"center"},content:{type:String,default:"start"},direction:{type:String,default:"row"},wrap:{type:String,default:"unset"},gap:{type:String,default:""}},computed:{classAttrs(){const{type:t,align:e,wrap:r,direction:n,content:o}=this;return[""+t,"align-"+e,"content-"+o,"direction-"+n,"wrap-"+r]},flexStyle(){const t={};return this.gap?t.gap=this.gap:t.gap="var(--xt-flex-box-gap, 8px)",t}}},H=D,V=T(H,O,U,!1,null,null,null),N=V.exports,W=N,q=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)])},G=[],J={name:"XtCard",props:{type:{},title:{},value:{},unit:{},icon:{},iconIn:{default:"right"},noPadding:{type:Boolean,default:!1}}},K=J,Q=T(K,q,G,!1,null,null,null),Y=Q.exports,Z=Y,tt=function(){var t=this,e=t._self._c;return"border"==t.iconType?e("FlexBox",{staticClass:"xt-card-item is-border",class:["border"==t.iconType?"is-"+t.type:""],style:t.cardItemStyle,attrs:{content:"between"}},[t.title?e("span",{staticClass:"item__label"},[t._t("label",(function(){return[t._v(t._s(t.label))]}))],2):t._e(),e("span",{staticClass:"item__value"},[t._t("value",(function(){return[t._v(t._s(t.value))]}))],2),e("span",{staticClass:"item__unit"},[t._t("unit",(function(){return[t._v(t._s(t.unit))]}))],2)]):e("FlexBox",{staticClass:"xt-card-item",attrs:{direction:t.direction,content:t.contentAlign}},[t._t("icon",(function(){return[e("el-button",{attrs:{type:t.type,circle:t.circle,round:t.round,plain:"",icon:t.icon}})]})),e("div",{staticClass:"item__value"},[e("span",{staticClass:"value",style:t.valueStyle},[t._t("value",(function(){return[t._v(t._s(t.label))]}))],2),e("div",{staticClass:"unit"},[t._v(t._s(t.value))])])],2)},et=[],rt={name:"XtCardItem",components:{FlexBox:N},props:{iconType:{default:"border"},type:{default:"primary"},label:{},value:{},unit:{},icon:{},iconAt:{default:"right"},color:{type:String,default:""}},data(){return{circle:!1,round:!1}},computed:{contentAlign(){return"center"==this.iconAt?"center":"start"},direction(){const t={left:"row",right:"row-reverse",top:"column",bottom:"column-reverse"};return t[this.iconAt]},cardItemStyle(){return"border"===this.iconType&&"primary"===this.type&&this.color?{"--xt-card-item-color":this.color}:{}},valueStyle(){return"border"!==this.iconType&&"primary"===this.type&&this.color?{color:this.color}:{}}}},nt=rt,ot=T(nt,tt,et,!1,null,null,null),it=ot.exports,lt=it,at=function(){var t=this,e=t._self._c;return e(t.tag,t._b({tag:"component",class:t.computedClass,style:t.mergedStyle},"component",t.customAttrs,!1),[t._t("default")],2)},st=[],ut={name:"XtConfigProvider",inheritAttrs:!1,props:{theme:{type:String,default:"light"},size:{type:String,default:"medium"},primaryColor:{type:String,default:"#409EFF"},vars:{type:Object,default:()=>({})},tag:{type:String,default:"div",validator:t=>["div","span","section","main","template","article","aside"].includes(t)},injectBackground:{type:Boolean,default:!1},injectColor:{type:Boolean,default:!1}},computed:{mergedStyle(){const t={...this.vars};if(this.primaryColor){const e=this.normalizeColor(this.primaryColor);t["--xt-color-primary"]=e,t["--xt-color-primary-light-3"]=this.lightenColor(e,30),t["--xt-color-primary-light-5"]=this.lightenColor(e,50),t["--xt-color-primary-light-7"]=this.lightenColor(e,70),t["--xt-color-primary-light-8"]=this.lightenColor(e,80),t["--xt-color-primary-light-9"]=this.lightenColor(e,90)}const e={small:"12px",medium:"14px",large:"16px"};return e[this.size]&&(t["--xt-font-size-base"]=e[this.size]),"dark"===this.theme&&(t["--xt-color-text-primary"]="rgba(255, 255, 255, 0.95)",t["--xt-color-text-regular"]="rgba(255, 255, 255, 0.8)",t["--xt-color-text-secondary"]="rgba(255, 255, 255, 0.6)",t["--xt-color-bg-primary"]="#1f1f1f",t["--xt-color-bg-secondary"]="#2d2d2d",t["--xt-color-bg-container"]="#1f1f1f",t["--xt-color-border"]="#434343",t["--xt-color-border-light"]="#3d3d3d",this.injectBackground&&(t.backgroundColor=t["--xt-color-bg-primary"]),this.injectColor&&(t.color=t["--xt-color-text-primary"])),t},computedClass(){const t=[];return"template"!==this.tag&&(t.push("xt-config-provider"),"dark"===this.theme&&t.push("xt-config-provider--dark")),t},customAttrs(){const t=["theme","size","primaryColor","vars","tag","injectBackground","injectColor"],e={};for(const r in this.$attrs)t.includes(r)||(e[r]=this.$attrs[r]);return e}},methods:{normalizeColor(t){if(!t)return"#409EFF";if(/^#[0-9A-Fa-f]{6}$/.test(t))return t;if(/^#[0-9A-Fa-f]{3}$/.test(t))return"#"+t[1]+t[1]+t[2]+t[2]+t[3]+t[3];if(/^#[0-9A-Fa-f]{8}$/.test(t))return t.substring(0,7);const e=t.match(/^rgba?\((\d+),\s*(\d+),\s*(\d+)/i);if(e){const t=parseInt(e[1]),r=parseInt(e[2]),n=parseInt(e[3]);return this.rgbToHex(t,r,n)}return console.warn("[XtConfigProvider] 无法识别的颜色格式:",t),"#409EFF"},hexToRgb(t){const e=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(t);return e?{r:parseInt(e[1],16),g:parseInt(e[2],16),b:parseInt(e[3],16)}:null},rgbToHex(t,e,r){return"#"+[t,e,r].map(t=>{const e=t.toString(16);return 1===e.length?"0"+e:e}).join("")},lightenColor(t,e){const r=this.hexToRgb(t);if(!r)return t;const n=Math.round(2.55*e),o=Math.min(255,r.r+n),i=Math.min(255,r.g+n),l=Math.min(255,r.b+n);return this.rgbToHex(o,i,l)}}},ct=ut,dt=T(ct,at,st,!1,null,null,null),ft=dt.exports,pt=ft;const mt=F.default||F,{getConfig:gt,setConfig:xt,getTheme:ht,getSize:yt,getPrimaryColor:Ct,resetConfig:vt,onConfigChange:bt,setTheme:_t,setSize:St,setPrimaryColor:Ft}=mt,Et=[$,R,W,Z,lt,pt],Pt=function(t,e={}){Pt.installed||(Pt.installed=!0,Et.forEach(e=>{t.component(e.name,e)}),t.prototype.$xt={setTheme:_t,setSize:St,setPrimaryColor:Ft,getConfig:gt,setConfig:xt,getTheme:ht,getSize:yt,getPrimaryColor:Ct,resetConfig:vt,onConfigChange:bt},e&&(void 0!==e.theme&&_t(e.theme),void 0!==e.size&&St(e.size),void 0!==e.primaryColor&&Ft(e.primaryColor),void 0!==e.config&&xt(e.config)))};"undefined"!==typeof window&&window.Vue&&Pt(window.Vue);var Bt={install:Pt,Button:$,Input:R,FlexBox:W,Card:Z,CardItem:lt,ConfigProvider:pt};e["default"]=Bt}})}));
|
|
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 r(n){if(e[n])return e[n].exports;var o=e[n]={i:n,l:!1,exports:{}};return t[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}return r.m=t,r.c=e,r.d=function(t,e,n){r.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},r.r=function(t){"undefined"!==typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.t=function(t,e){if(1&e&&(t=r(t)),8&e)return t;if(4&e&&"object"===typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)r.d(n,o,function(e){return t[e]}.bind(null,o));return n},r.n=function(t){var e=t&&t.__esModule?function(){return t["default"]}:function(){return t};return r.d(e,"a",e),e},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.p="",r(r.s="fb15")}({"72fa":function(t,e,r){},ad4d:function(t,e,r){t.exports={xtColorPrimary:"#1890ff",xtColorSuccess:"#37c3a4",xtColorWarning:"#FFB74D",xtColorDanger:"#EA1D34",xtColorInfo:"#999999",xtColorPrimaryLight3:"#5DB1FF",xtColorPrimaryLight5:"#8CC8FF",xtColorPrimaryLight7:"#BADEFF",xtColorPrimaryLight8:"#D1E9FF",xtColorPrimaryLight9:"#E8F4FF",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"}},d67a:function(t,e,r){},fb15:function(t,e,r){"use strict";if(r.r(e),r.d(e,"utils",(function(){return vt})),r.d(e,"variables",(function(){return l.a})),r.d(e,"getConfig",(function(){return _t})),r.d(e,"setConfig",(function(){return St})),r.d(e,"getTheme",(function(){return Ft})),r.d(e,"getSize",(function(){return Et})),r.d(e,"getPrimaryColor",(function(){return Bt})),r.d(e,"resetConfig",(function(){return wt})),r.d(e,"onConfigChange",(function(){return zt})),r.d(e,"setTheme",(function(){return Pt})),r.d(e,"setSize",(function(){return Tt})),r.d(e,"setPrimaryColor",(function(){return jt})),"undefined"!==typeof window){var n=window.document.currentScript,o=n&&n.src.match(/(.+\/)[^/]+\.js(\?.*)?$/);o&&(r.p=o[1])}r("72fa"),r("d67a");var i=r("ad4d"),l=r.n(i);const a={theme:"white",size:"medium",primaryColor:"#1890ff"};let s={...a};console.log("[XtElementUI] utils initialized with currentConfig:",s);const c=[],u=function(t,e){c.forEach(r=>{r(t,e)})},d=function(){return{...s}},f=function(t){"object"===typeof t&&null!==t?(void 0!==t.theme&&p(t.theme),void 0!==t.size&&m(t.size),void 0!==t.primaryColor&&h(t.primaryColor)):console.warn("[XtElementUI] setConfig 必须传入对象参数")},p=function(t){const e=["white","dark"];if(!e.includes(t))return void console.warn(`[XtElementUI] 无效的主题值: ${t},可选值: ${e.join(", ")}`);s.theme=t;const r=document.documentElement;"dark"===t?r.setAttribute("data-theme","dark"):r.removeAttribute("data-theme"),u("theme",t)},m=function(t){const e=["small","medium","large"];e.includes(t)?(s.size=t,document.documentElement.setAttribute("data-size",t),u("size",t)):console.warn(`[XtElementUI] 无效的大小值: ${t},可选值: ${e.join(", ")}`)};function g(t){const e=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(t);return e?{r:parseInt(e[1],16),g:parseInt(e[2],16),b:parseInt(e[3],16)}:null}function x(t,e,r){return"#"+[t,e,r].map(t=>{const e=t.toString(16);return 1===e.length?"0"+e:e}).join("")}function y(t,e){const r=g(t);if(!r)return t;const n=Math.round(2.55*e),o=Math.min(255,r.r+n),i=Math.min(255,r.g+n),l=Math.min(255,r.b+n);return x(o,i,l)}const h=function(t){const e=/^#[0-9A-Fa-f]{3}$|^#[0-9A-Fa-f]{6}$|^#[0-9A-Fa-f]{8}$/;if(!e.test(t))return void console.warn(`[XtElementUI] 无效的颜色值: ${t},请使用十六进制颜色格式,如 #1890ff`);let r=t;4===t.length?r="#"+t[1]+t[1]+t[2]+t[2]+t[3]+t[3]:9===t.length&&(r=t.substring(0,7)),s.primaryColor=r,document.documentElement.style.setProperty("--xt-color-primary",r),document.documentElement.style.setProperty("--xt-color-primary-light-3",y(r,30)),document.documentElement.style.setProperty("--xt-color-primary-light-5",y(r,50)),document.documentElement.style.setProperty("--xt-color-primary-light-7",y(r,70)),document.documentElement.style.setProperty("--xt-color-primary-light-8",y(r,80)),document.documentElement.style.setProperty("--xt-color-primary-light-9",y(r,90)),u("primaryColor",r),console.log("[XtElementUI] 主色调已设置为:",r)},C=function(){return s.theme},b=function(){return s.size},v=function(){return s.primaryColor},_=function(){f(a)},S=function(t){if("function"===typeof t)return c.push(t),function(){const e=c.indexOf(t);e>-1&&c.splice(e,1)};console.warn("[XtElementUI] onConfigChange 必须传入函数")};var F={setTheme:p,setSize:m,setPrimaryColor:h,getConfig:d,setConfig:f,getTheme:C,getSize:b,getPrimaryColor:v,resetConfig:_,onConfigChange:S},E=function(){var t=this,e=t._self._c;return e("button",{staticClass:"xt-button",class:["xt-button--"+t.type,t.size?"xt-button--"+t.size:"",{"xt-button--plain":t.plain,"is-disabled":t.disabled,"is-round":t.round}],attrs:{disabled:t.disabled},on:{click:t.handleClick}},[t._t("default")],2)},B=[],w={name:"XtButton",props:{type:{type:String,default:"default",validator:t=>["default","primary","success","warning","danger"].includes(t)},size:{type:String,default:"",validator:t=>["","large","medium","small","mini"].includes(t)},plain:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},round:{type:Boolean,default:!1}},methods:{handleClick(){this.disabled||this.$emit("click")}}},z=w;function P(t,e,r,n,o,i,l,a){var s,c="function"===typeof t?t.options:t;if(e&&(c.render=e,c.staticRenderFns=r,c._compiled=!0),n&&(c.functional=!0),i&&(c._scopeId="data-v-"+i),l?(s=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__),o&&o.call(this,t),t&&t._registeredComponents&&t._registeredComponents.add(l)},c._ssrRegister=s):o&&(s=a?function(){o.call(this,(c.functional?this.parent:this).$root.$options.shadowRoot)}:o),s)if(c.functional){c._injectStyles=s;var u=c.render;c.render=function(t,e){return s.call(e),u(t,e)}}else{var d=c.beforeCreate;c.beforeCreate=d?[].concat(d,s):[s]}return{exports:t,options:c}}var T=P(z,E,B,!1,null,null,null),j=T.exports,I=j,$=function(){var t=this,e=t._self._c;return e("div",{staticClass:"xt-input"},[e("el-input",{style:t.inputStyle,attrs:{value:t.value,placeholder:t.placeholder},on:{input:function(e){return t.$emit("input",e)}}})],1)},A=[],X={name:"XtInput",props:{value:[String,Number],placeholder:{type:String,default:"请输入内容"},color:{type:String,default:""}},computed:{inputStyle(){return this.color?{"--xt-input-focus-color":this.color}:{}}}},k=X,D=P(k,$,A,!1,null,null,null),M=D.exports,R=M,L=function(){var t=this,e=t._self._c;return e("div",{staticClass:"xt-flex-box",class:t.classAttrs,style:t.flexStyle},[t._t("default")],2)},O=[],U={name:"XtFlexBox",props:{type:{type:String,default:"flex"},align:{type:String,default:"center"},content:{type:String,default:"start"},direction:{type:String,default:"row"},wrap:{type:String,default:"unset"},gap:{type:String,default:""}},computed:{classAttrs(){const{type:t,align:e,wrap:r,direction:n,content:o}=this;return[""+t,"align-"+e,"content-"+o,"direction-"+n,"wrap-"+r]},flexStyle(){const t={};return this.gap?t.gap=this.gap:t.gap="var(--xt-flex-box-gap, 8px)",t}}},H=U,N=P(H,L,O,!1,null,null,null),V=N.exports,W=V,q=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)])},G=[],J={name:"XtCard",props:{type:{},title:{},value:{},unit:{},icon:{},iconIn:{default:"right"},noPadding:{type:Boolean,default:!1}}},K=J,Q=P(K,q,G,!1,null,null,null),Y=Q.exports,Z=Y,tt=function(){var t=this,e=t._self._c;return"border"==t.iconType?e("FlexBox",{staticClass:"xt-card-item is-border",class:["border"==t.iconType?"is-"+t.type:""],style:t.cardItemStyle,attrs:{content:"between"}},[t.title?e("span",{staticClass:"item__label"},[t._t("label",(function(){return[t._v(t._s(t.label))]}))],2):t._e(),e("span",{staticClass:"item__value"},[t._t("value",(function(){return[t._v(t._s(t.value))]}))],2),e("span",{staticClass:"item__unit"},[t._t("unit",(function(){return[t._v(t._s(t.unit))]}))],2)]):e("FlexBox",{staticClass:"xt-card-item",attrs:{direction:t.direction,content:t.contentAlign}},[t._t("icon",(function(){return[e("el-button",{attrs:{type:t.type,circle:t.circle,round:t.round,plain:"",icon:t.icon}})]})),e("div",{staticClass:"item__value"},[e("span",{staticClass:"value",style:t.valueStyle},[t._t("value",(function(){return[t._v(t._s(t.label))]}))],2),e("div",{staticClass:"unit"},[t._v(t._s(t.value))])])],2)},et=[],rt={name:"XtCardItem",components:{FlexBox:V},props:{iconType:{default:"border"},type:{default:"primary"},label:{},value:{},unit:{},icon:{},iconAt:{default:"right"},color:{type:String,default:""}},data(){return{circle:!1,round:!1}},computed:{contentAlign(){return"center"==this.iconAt?"center":"start"},direction(){const t={left:"row",right:"row-reverse",top:"column",bottom:"column-reverse"};return t[this.iconAt]},cardItemStyle(){return"border"===this.iconType&&"primary"===this.type&&this.color?{"--xt-card-item-color":this.color}:{}},valueStyle(){return"border"!==this.iconType&&"primary"===this.type&&this.color?{color:this.color}:{}}}},nt=rt,ot=P(nt,tt,et,!1,null,null,null),it=ot.exports,lt=it,at=function(){var t=this,e=t._self._c;return e(t.tag,t._b({tag:"component",class:t.computedClass,style:t.mergedStyle},"component",t.customAttrs,!1),[t._t("default")],2)},st=[],ct={name:"XtConfigProvider",inheritAttrs:!1,props:{theme:{type:String,default:"white"},size:{type:String,default:"medium"},primaryColor:{type:String,default:"#409EFF"},vars:{type:Object,default:()=>({})},tag:{type:String,default:"div",validator:t=>["div","span","section","main","template","article","aside"].includes(t)},injectBackground:{type:Boolean,default:!1},injectColor:{type:Boolean,default:!1}},computed:{mergedStyle(){const t={...this.vars};if(this.primaryColor){const e=this.normalizeColor(this.primaryColor);t["--xt-color-primary"]=e,t["--xt-color-primary-light-3"]=this.lightenColor(e,30),t["--xt-color-primary-light-5"]=this.lightenColor(e,50),t["--xt-color-primary-light-7"]=this.lightenColor(e,70),t["--xt-color-primary-light-8"]=this.lightenColor(e,80),t["--xt-color-primary-light-9"]=this.lightenColor(e,90)}const e={small:"12px",medium:"14px",large:"16px"};return e[this.size]&&(t["--xt-font-size-base"]=e[this.size]),"dark"===this.theme?(t["--xt-color-text-primary"]="rgba(255, 255, 255, 0.95)",t["--xt-color-text-regular"]="rgba(255, 255, 255, 0.8)",t["--xt-color-text-secondary"]="rgba(255, 255, 255, 0.6)",t["--xt-color-bg-primary"]="#1f1f1f",t["--xt-color-bg-secondary"]="#2d2d2d",t["--xt-color-bg-container"]="#1f1f1f",t["--xt-color-border"]="#434343",t["--xt-color-border-light"]="#3d3d3d",this.injectBackground&&(t.backgroundColor=t["--xt-color-bg-primary"]),this.injectColor&&(t.color=t["--xt-color-text-primary"])):(t["--xt-color-text-primary"]="#303133",t["--xt-color-text-regular"]="#606266",t["--xt-color-text-secondary"]="#909399",t["--xt-color-bg-primary"]="#ffffff",t["--xt-color-bg-secondary"]="#f5f7fa",t["--xt-color-bg-container"]="#f5f7fa",t["--xt-color-border"]="#DCDFE6",t["--xt-color-border-light"]="#E4E7ED",this.injectBackground&&(t.backgroundColor=t["--xt-color-bg-primary"]),this.injectColor&&(t.color=t["--xt-color-text-primary"])),t},computedClass(){const t=[];return"template"!==this.tag&&(t.push("xt-config-provider"),"dark"===this.theme&&t.push("xt-config-provider--dark")),t},customAttrs(){const t=["theme","size","primaryColor","vars","tag","injectBackground","injectColor"],e={};for(const r in this.$attrs)t.includes(r)||(e[r]=this.$attrs[r]);return e}},methods:{normalizeColor(t){if(!t)return"#409EFF";if(/^#[0-9A-Fa-f]{6}$/.test(t))return t;if(/^#[0-9A-Fa-f]{3}$/.test(t))return"#"+t[1]+t[1]+t[2]+t[2]+t[3]+t[3];if(/^#[0-9A-Fa-f]{8}$/.test(t))return t.substring(0,7);const e=t.match(/^rgba?\((\d+),\s*(\d+),\s*(\d+)/i);if(e){const t=parseInt(e[1]),r=parseInt(e[2]),n=parseInt(e[3]);return this.rgbToHex(t,r,n)}return console.warn("[XtConfigProvider] 无法识别的颜色格式:",t),"#409EFF"},hexToRgb(t){const e=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(t);return e?{r:parseInt(e[1],16),g:parseInt(e[2],16),b:parseInt(e[3],16)}:null},rgbToHex(t,e,r){return"#"+[t,e,r].map(t=>{const e=t.toString(16);return 1===e.length?"0"+e:e}).join("")},lightenColor(t,e){const r=this.hexToRgb(t);if(!r)return t;const n=Math.round(2.55*e),o=Math.min(255,r.r+n),i=Math.min(255,r.g+n),l=Math.min(255,r.b+n);return this.rgbToHex(o,i,l)}}},ut=ct,dt=P(ut,at,st,!1,null,null,null),ft=dt.exports,pt=ft,mt=function(){var t=this,e=t._self._c;return e("span",{staticClass:"xt-text",class:[t.type?"xt-text--"+t.type:"",{"xt-text--bold":t.bold}],style:t.customStyle},[t._t("default")],2)},gt=[],xt={name:"XtText",props:{type:{type:String,default:"",validator:t=>["","primary","success","warning","danger"].includes(t)},bold:{type:Boolean,default:!1},letterSpacing:{type:[String,Number],default:""}},computed:{customStyle(){const t={};return this.letterSpacing&&(t.letterSpacing="number"===typeof this.letterSpacing?this.letterSpacing+"px":this.letterSpacing),t}}},yt=xt,ht=P(yt,mt,gt,!1,null,null,null),Ct=ht.exports,bt=Ct;const vt=F.default||F,{getConfig:_t,setConfig:St,getTheme:Ft,getSize:Et,getPrimaryColor:Bt,resetConfig:wt,onConfigChange:zt,setTheme:Pt,setSize:Tt,setPrimaryColor:jt}=vt,It=[I,R,W,Z,lt,pt,bt],$t=function(t,e={}){$t.installed||($t.installed=!0,It.forEach(e=>{t.component(e.name,e)}),t.prototype.$xt={setTheme:Pt,setSize:Tt,setPrimaryColor:jt,getConfig:_t,setConfig:St,getTheme:Ft,getSize:Et,getPrimaryColor:Bt,resetConfig:wt,onConfigChange:zt},e&&(void 0!==e.theme&&Pt(e.theme),void 0!==e.size&&Tt(e.size),void 0!==e.primaryColor&&jt(e.primaryColor),void 0!==e.config&&St(e.config)))};"undefined"!==typeof window&&window.Vue&&$t(window.Vue);var At={install:$t,Button:I,Input:R,FlexBox:W,Card:Z,CardItem:lt,ConfigProvider:pt,Text:bt};e["default"]=At}})}));
|
package/package.json
CHANGED
|
@@ -1,14 +1,20 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<
|
|
2
|
+
<button
|
|
3
3
|
class="xt-button"
|
|
4
|
-
:class="[
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
4
|
+
:class="[
|
|
5
|
+
'xt-button--' + type,
|
|
6
|
+
size ? 'xt-button--' + size : '',
|
|
7
|
+
{
|
|
8
|
+
'xt-button--plain': plain,
|
|
9
|
+
'is-disabled': disabled,
|
|
10
|
+
'is-round': round
|
|
11
|
+
}
|
|
12
|
+
]"
|
|
13
|
+
:disabled="disabled"
|
|
8
14
|
@click="handleClick"
|
|
9
15
|
>
|
|
10
16
|
<slot></slot>
|
|
11
|
-
</
|
|
17
|
+
</button>
|
|
12
18
|
</template>
|
|
13
19
|
<script>
|
|
14
20
|
export default {
|
|
@@ -16,32 +22,32 @@ export default {
|
|
|
16
22
|
props: {
|
|
17
23
|
type: {
|
|
18
24
|
type: String,
|
|
19
|
-
default: '
|
|
25
|
+
default: 'default',
|
|
26
|
+
validator: (val) => ['default', 'primary', 'success', 'warning', 'danger'].includes(val)
|
|
27
|
+
},
|
|
28
|
+
size: {
|
|
29
|
+
type: String,
|
|
30
|
+
default: '',
|
|
31
|
+
validator: (val) => ['', 'large', 'medium', 'small', 'mini'].includes(val)
|
|
20
32
|
},
|
|
21
33
|
plain: {
|
|
22
34
|
type: Boolean,
|
|
23
35
|
default: false
|
|
24
36
|
},
|
|
25
|
-
|
|
26
|
-
type:
|
|
27
|
-
default:
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
if (this.color) {
|
|
33
|
-
return {
|
|
34
|
-
'--xt-button-bg-color': this.color,
|
|
35
|
-
'--xt-button-border-color': this.color,
|
|
36
|
-
'--xt-button-text-color': '#fff'
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
return {}
|
|
37
|
+
disabled: {
|
|
38
|
+
type: Boolean,
|
|
39
|
+
default: false
|
|
40
|
+
},
|
|
41
|
+
round: {
|
|
42
|
+
type: Boolean,
|
|
43
|
+
default: false
|
|
40
44
|
}
|
|
41
45
|
},
|
|
42
46
|
methods: {
|
|
43
47
|
handleClick() {
|
|
44
|
-
this
|
|
48
|
+
if (!this.disabled) {
|
|
49
|
+
this.$emit('click')
|
|
50
|
+
}
|
|
45
51
|
}
|
|
46
52
|
}
|
|
47
53
|
}
|