xt-element-ui 1.0.8 → 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 +715 -396
- package/lib/index.css +1 -1
- package/lib/index.umd.js +715 -396
- package/lib/index.umd.min.js +1 -1
- package/package.json +2 -2
- package/src/components/button/index.vue +54 -15
- package/src/components/button/style/index copy.scss +221 -0
- package/src/components/button/style/index.scss +136 -0
- package/src/components/card/index.vue +20 -41
- package/src/components/card/style/index.scss +49 -0
- package/src/components/card-item/index.vue +71 -90
- package/src/components/card-item/style/index.scss +72 -0
- package/src/components/config-provider/index.js +2 -0
- package/src/components/config-provider/index.vue +193 -0
- package/src/components/config-provider/style/index.scss +12 -0
- package/src/components/flex-box/index.vue +20 -90
- package/src/components/flex-box/style/index.scss +91 -0
- package/src/components/index.scss +22 -0
- package/src/components/input/index.vue +28 -11
- package/src/components/input/style/index.scss +27 -0
- 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 +69 -123
- package/src/styles/{theme.scss → css-variables.scss} +72 -31
- package/src/styles/{theme-element.scss → element-theme.scss} +0 -10
- package/src/styles/theme/background.scss +6 -0
- package/src/styles/theme/border-radius.scss +4 -0
- package/src/styles/theme/borders.scss +4 -0
- package/src/styles/theme/colors.scss +11 -0
- package/src/styles/theme/component-variables.scss +70 -0
- package/src/styles/theme/dark-variables.scss +29 -0
- package/src/styles/theme/font.scss +10 -0
- package/src/styles/theme/index.scss +11 -0
- package/src/styles/theme/shadows.scss +3 -0
- package/src/styles/theme/spacing.scss +5 -0
- package/src/styles/theme/transitions.scss +3 -0
- package/src/styles/theme/typography.scss +5 -0
- package/src/styles/{export.scss → variables-export.scss} +1 -1
- package/src/styles/variables.scss +1 -126
- package/src/utils/index.js +193 -124
package/lib/index.common.js
CHANGED
|
@@ -87,62 +87,22 @@ module.exports =
|
|
|
87
87
|
/************************************************************************/
|
|
88
88
|
/******/ ({
|
|
89
89
|
|
|
90
|
-
/***/ "
|
|
90
|
+
/***/ "72fa":
|
|
91
91
|
/***/ (function(module, exports, __webpack_require__) {
|
|
92
92
|
|
|
93
93
|
// extracted by mini-css-extract-plugin
|
|
94
94
|
|
|
95
95
|
/***/ }),
|
|
96
96
|
|
|
97
|
-
/***/ "
|
|
97
|
+
/***/ "ad4d":
|
|
98
98
|
/***/ (function(module, exports, __webpack_require__) {
|
|
99
99
|
|
|
100
100
|
// extracted by mini-css-extract-plugin
|
|
101
|
-
module.exports = {"xtColorPrimary":"#
|
|
101
|
+
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"};
|
|
102
102
|
|
|
103
103
|
/***/ }),
|
|
104
104
|
|
|
105
|
-
/***/ "
|
|
106
|
-
/***/ (function(module, exports, __webpack_require__) {
|
|
107
|
-
|
|
108
|
-
// extracted by mini-css-extract-plugin
|
|
109
|
-
|
|
110
|
-
/***/ }),
|
|
111
|
-
|
|
112
|
-
/***/ "43ae":
|
|
113
|
-
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
114
|
-
|
|
115
|
-
"use strict";
|
|
116
|
-
/* harmony import */ var _node_modules_mini_css_extract_plugin_dist_loader_js_ref_9_oneOf_1_0_node_modules_css_loader_dist_cjs_js_ref_9_oneOf_1_1_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_postcss_loader_src_index_js_ref_9_oneOf_1_2_node_modules_sass_loader_dist_cjs_js_ref_9_oneOf_1_3_node_modules_vue_cli_service_node_modules_cache_loader_dist_cjs_js_ref_1_0_node_modules_vue_loader_lib_index_js_vue_loader_options_index_vue_vue_type_style_index_0_id_28fcf19e_prod_scoped_true_lang_scss__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("3a26");
|
|
117
|
-
/* harmony import */ var _node_modules_mini_css_extract_plugin_dist_loader_js_ref_9_oneOf_1_0_node_modules_css_loader_dist_cjs_js_ref_9_oneOf_1_1_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_postcss_loader_src_index_js_ref_9_oneOf_1_2_node_modules_sass_loader_dist_cjs_js_ref_9_oneOf_1_3_node_modules_vue_cli_service_node_modules_cache_loader_dist_cjs_js_ref_1_0_node_modules_vue_loader_lib_index_js_vue_loader_options_index_vue_vue_type_style_index_0_id_28fcf19e_prod_scoped_true_lang_scss__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_node_modules_mini_css_extract_plugin_dist_loader_js_ref_9_oneOf_1_0_node_modules_css_loader_dist_cjs_js_ref_9_oneOf_1_1_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_postcss_loader_src_index_js_ref_9_oneOf_1_2_node_modules_sass_loader_dist_cjs_js_ref_9_oneOf_1_3_node_modules_vue_cli_service_node_modules_cache_loader_dist_cjs_js_ref_1_0_node_modules_vue_loader_lib_index_js_vue_loader_options_index_vue_vue_type_style_index_0_id_28fcf19e_prod_scoped_true_lang_scss__WEBPACK_IMPORTED_MODULE_0__);
|
|
118
|
-
/* unused harmony reexport * */
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
/***/ }),
|
|
122
|
-
|
|
123
|
-
/***/ "7876":
|
|
124
|
-
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
125
|
-
|
|
126
|
-
"use strict";
|
|
127
|
-
/* harmony import */ var _node_modules_mini_css_extract_plugin_dist_loader_js_ref_9_oneOf_1_0_node_modules_css_loader_dist_cjs_js_ref_9_oneOf_1_1_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_postcss_loader_src_index_js_ref_9_oneOf_1_2_node_modules_sass_loader_dist_cjs_js_ref_9_oneOf_1_3_node_modules_vue_cli_service_node_modules_cache_loader_dist_cjs_js_ref_1_0_node_modules_vue_loader_lib_index_js_vue_loader_options_index_vue_vue_type_style_index_0_id_1100cec5_prod_lang_scss_scoped_true__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("ec69");
|
|
128
|
-
/* harmony import */ var _node_modules_mini_css_extract_plugin_dist_loader_js_ref_9_oneOf_1_0_node_modules_css_loader_dist_cjs_js_ref_9_oneOf_1_1_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_postcss_loader_src_index_js_ref_9_oneOf_1_2_node_modules_sass_loader_dist_cjs_js_ref_9_oneOf_1_3_node_modules_vue_cli_service_node_modules_cache_loader_dist_cjs_js_ref_1_0_node_modules_vue_loader_lib_index_js_vue_loader_options_index_vue_vue_type_style_index_0_id_1100cec5_prod_lang_scss_scoped_true__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_node_modules_mini_css_extract_plugin_dist_loader_js_ref_9_oneOf_1_0_node_modules_css_loader_dist_cjs_js_ref_9_oneOf_1_1_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_postcss_loader_src_index_js_ref_9_oneOf_1_2_node_modules_sass_loader_dist_cjs_js_ref_9_oneOf_1_3_node_modules_vue_cli_service_node_modules_cache_loader_dist_cjs_js_ref_1_0_node_modules_vue_loader_lib_index_js_vue_loader_options_index_vue_vue_type_style_index_0_id_1100cec5_prod_lang_scss_scoped_true__WEBPACK_IMPORTED_MODULE_0__);
|
|
129
|
-
/* unused harmony reexport * */
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
/***/ }),
|
|
133
|
-
|
|
134
|
-
/***/ "d0ed":
|
|
135
|
-
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
136
|
-
|
|
137
|
-
"use strict";
|
|
138
|
-
/* harmony import */ var _node_modules_mini_css_extract_plugin_dist_loader_js_ref_9_oneOf_1_0_node_modules_css_loader_dist_cjs_js_ref_9_oneOf_1_1_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_postcss_loader_src_index_js_ref_9_oneOf_1_2_node_modules_sass_loader_dist_cjs_js_ref_9_oneOf_1_3_node_modules_vue_cli_service_node_modules_cache_loader_dist_cjs_js_ref_1_0_node_modules_vue_loader_lib_index_js_vue_loader_options_index_vue_vue_type_style_index_0_id_444d40a5_prod_lang_scss_scoped_true__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("11a3");
|
|
139
|
-
/* harmony import */ var _node_modules_mini_css_extract_plugin_dist_loader_js_ref_9_oneOf_1_0_node_modules_css_loader_dist_cjs_js_ref_9_oneOf_1_1_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_postcss_loader_src_index_js_ref_9_oneOf_1_2_node_modules_sass_loader_dist_cjs_js_ref_9_oneOf_1_3_node_modules_vue_cli_service_node_modules_cache_loader_dist_cjs_js_ref_1_0_node_modules_vue_loader_lib_index_js_vue_loader_options_index_vue_vue_type_style_index_0_id_444d40a5_prod_lang_scss_scoped_true__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_node_modules_mini_css_extract_plugin_dist_loader_js_ref_9_oneOf_1_0_node_modules_css_loader_dist_cjs_js_ref_9_oneOf_1_1_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_postcss_loader_src_index_js_ref_9_oneOf_1_2_node_modules_sass_loader_dist_cjs_js_ref_9_oneOf_1_3_node_modules_vue_cli_service_node_modules_cache_loader_dist_cjs_js_ref_1_0_node_modules_vue_loader_lib_index_js_vue_loader_options_index_vue_vue_type_style_index_0_id_444d40a5_prod_lang_scss_scoped_true__WEBPACK_IMPORTED_MODULE_0__);
|
|
140
|
-
/* unused harmony reexport * */
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
/***/ }),
|
|
144
|
-
|
|
145
|
-
/***/ "ec69":
|
|
105
|
+
/***/ "d67a":
|
|
146
106
|
/***/ (function(module, exports, __webpack_require__) {
|
|
147
107
|
|
|
148
108
|
// extracted by mini-css-extract-plugin
|
|
@@ -157,18 +117,18 @@ module.exports = {"xtColorPrimary":"#409EFF","xtColorSuccess":"#67C23A","xtColor
|
|
|
157
117
|
__webpack_require__.r(__webpack_exports__);
|
|
158
118
|
|
|
159
119
|
// EXPORTS
|
|
160
|
-
__webpack_require__.d(__webpack_exports__, "utils", function() { return /* reexport */
|
|
161
|
-
__webpack_require__.d(__webpack_exports__, "variables", function() { return /* reexport */
|
|
120
|
+
__webpack_require__.d(__webpack_exports__, "utils", function() { return /* reexport */ src_utils; });
|
|
121
|
+
__webpack_require__.d(__webpack_exports__, "variables", function() { return /* reexport */ variables_export_default.a; });
|
|
162
122
|
__webpack_require__.d(__webpack_exports__, "getConfig", function() { return /* reexport */ src_getConfig; });
|
|
163
123
|
__webpack_require__.d(__webpack_exports__, "setConfig", function() { return /* reexport */ src_setConfig; });
|
|
164
|
-
__webpack_require__.d(__webpack_exports__, "setTheme", function() { return /* reexport */ src_setTheme; });
|
|
165
|
-
__webpack_require__.d(__webpack_exports__, "setSize", function() { return /* reexport */ src_setSize; });
|
|
166
|
-
__webpack_require__.d(__webpack_exports__, "setPrimaryColor", function() { return /* reexport */ src_setPrimaryColor; });
|
|
167
124
|
__webpack_require__.d(__webpack_exports__, "getTheme", function() { return /* reexport */ src_getTheme; });
|
|
168
125
|
__webpack_require__.d(__webpack_exports__, "getSize", function() { return /* reexport */ src_getSize; });
|
|
169
126
|
__webpack_require__.d(__webpack_exports__, "getPrimaryColor", function() { return /* reexport */ src_getPrimaryColor; });
|
|
170
127
|
__webpack_require__.d(__webpack_exports__, "resetConfig", function() { return /* reexport */ src_resetConfig; });
|
|
171
128
|
__webpack_require__.d(__webpack_exports__, "onConfigChange", function() { return /* reexport */ src_onConfigChange; });
|
|
129
|
+
__webpack_require__.d(__webpack_exports__, "setTheme", function() { return /* reexport */ src_setTheme; });
|
|
130
|
+
__webpack_require__.d(__webpack_exports__, "setSize", function() { return /* reexport */ src_setSize; });
|
|
131
|
+
__webpack_require__.d(__webpack_exports__, "setPrimaryColor", function() { return /* reexport */ src_setPrimaryColor; });
|
|
172
132
|
|
|
173
133
|
// CONCATENATED MODULE: ./node_modules/@vue/cli-service/lib/commands/build/setPublicPath.js
|
|
174
134
|
// This file is imported into lib/wc client bundles.
|
|
@@ -186,154 +146,264 @@ if (typeof window !== 'undefined') {
|
|
|
186
146
|
// Indicate to webpack that this file can be concatenated
|
|
187
147
|
/* harmony default export */ var setPublicPath = (null);
|
|
188
148
|
|
|
189
|
-
// EXTERNAL MODULE: ./src/styles/
|
|
190
|
-
var
|
|
191
|
-
|
|
149
|
+
// EXTERNAL MODULE: ./src/styles/css-variables.scss
|
|
150
|
+
var css_variables = __webpack_require__("72fa");
|
|
151
|
+
|
|
152
|
+
// EXTERNAL MODULE: ./src/components/index.scss
|
|
153
|
+
var components = __webpack_require__("d67a");
|
|
154
|
+
|
|
155
|
+
// EXTERNAL MODULE: ./src/styles/variables-export.scss
|
|
156
|
+
var variables_export = __webpack_require__("ad4d");
|
|
157
|
+
var variables_export_default = /*#__PURE__*/__webpack_require__.n(variables_export);
|
|
192
158
|
|
|
193
159
|
// CONCATENATED MODULE: ./src/utils/index.js
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
160
|
+
// 默认配置
|
|
161
|
+
const defaultConfig = {
|
|
162
|
+
theme: 'white',
|
|
163
|
+
size: 'medium',
|
|
164
|
+
primaryColor: '#1890ff'
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
// 当前配置
|
|
168
|
+
let currentConfig = { ...defaultConfig }
|
|
169
|
+
|
|
170
|
+
// 调试:输出初始化信息
|
|
171
|
+
console.log('[XtElementUI] utils initialized with currentConfig:', currentConfig)
|
|
172
|
+
|
|
173
|
+
// 配置变更事件处理
|
|
174
|
+
const configChangeListeners = []
|
|
175
|
+
|
|
176
|
+
const emitConfigChange = function(key, value) {
|
|
177
|
+
configChangeListeners.forEach(listener => {
|
|
178
|
+
listener(key, value)
|
|
179
|
+
})
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
// 获取所有配置
|
|
183
|
+
const getConfig = function() {
|
|
184
|
+
return { ...currentConfig }
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
// 设置全局配置
|
|
188
|
+
const setConfig = function(config) {
|
|
189
|
+
if (typeof config !== 'object' || config === null) {
|
|
190
|
+
console.warn('[XtElementUI] setConfig 必须传入对象参数')
|
|
191
|
+
return
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
if (config.theme !== undefined) {
|
|
195
|
+
setTheme(config.theme)
|
|
196
|
+
}
|
|
197
|
+
if (config.size !== undefined) {
|
|
198
|
+
setSize(config.size)
|
|
199
|
+
}
|
|
200
|
+
if (config.primaryColor !== undefined) {
|
|
201
|
+
setPrimaryColor(config.primaryColor)
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
|
|
206
|
+
// 设置主题
|
|
207
|
+
const setTheme = function(theme) {
|
|
208
|
+
const validThemes = ['white', 'dark']
|
|
209
|
+
if (!validThemes.includes(theme)) {
|
|
210
|
+
console.warn(`[XtElementUI] 无效的主题值: ${theme},可选值: ${validThemes.join(', ')}`)
|
|
211
|
+
return
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
currentConfig.theme = theme
|
|
215
|
+
const root = document.documentElement
|
|
216
|
+
|
|
217
|
+
// 使用类名方式切换主题(兼容 Element Plus 风格)
|
|
218
|
+
if (theme === 'dark') {
|
|
219
|
+
root.setAttribute('data-theme', 'dark')
|
|
220
|
+
} else {
|
|
221
|
+
root.removeAttribute('data-theme')
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
emitConfigChange('theme', theme)
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
// 设置字体大小
|
|
228
|
+
const setSize = function(size) {
|
|
229
|
+
const validSizes = ['small', 'medium', 'large']
|
|
230
|
+
if (!validSizes.includes(size)) {
|
|
231
|
+
console.warn(`[XtElementUI] 无效的大小值: ${size},可选值: ${validSizes.join(', ')}`)
|
|
232
|
+
return
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
currentConfig.size = size
|
|
236
|
+
document.documentElement.setAttribute('data-size', size)
|
|
237
|
+
emitConfigChange('size', size)
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
// 将十六进制颜色转换为 RGB 对象
|
|
241
|
+
function hexToRgb(hex) {
|
|
242
|
+
const result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex)
|
|
243
|
+
return result ? {
|
|
244
|
+
r: parseInt(result[1], 16),
|
|
245
|
+
g: parseInt(result[2], 16),
|
|
246
|
+
b: parseInt(result[3], 16)
|
|
247
|
+
} : null
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
// 将 RGB 对象转换为十六进制颜色
|
|
251
|
+
function rgbToHex(r, g, b) {
|
|
252
|
+
return '#' + [r, g, b].map(x => {
|
|
253
|
+
const hex = x.toString(16)
|
|
254
|
+
return hex.length === 1 ? '0' + hex : hex
|
|
255
|
+
}).join('')
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
// 计算浅色系列(混合白色)
|
|
259
|
+
function lightenColor(hex, percent) {
|
|
260
|
+
const rgb = hexToRgb(hex)
|
|
261
|
+
if (!rgb) return hex
|
|
262
|
+
|
|
263
|
+
const amount = Math.round(2.55 * percent)
|
|
264
|
+
const r = Math.min(255, rgb.r + amount)
|
|
265
|
+
const g = Math.min(255, rgb.g + amount)
|
|
266
|
+
const b = Math.min(255, rgb.b + amount)
|
|
267
|
+
|
|
268
|
+
return rgbToHex(r, g, b)
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
// 设置主色调
|
|
272
|
+
const setPrimaryColor = function(color) {
|
|
273
|
+
// 颜色格式验证(支持 3/6/8 位十六进制)
|
|
274
|
+
const colorRegex = /^#[0-9A-Fa-f]{3}$|^#[0-9A-Fa-f]{6}$|^#[0-9A-Fa-f]{8}$/
|
|
275
|
+
if (!colorRegex.test(color)) {
|
|
276
|
+
console.warn(`[XtElementUI] 无效的颜色值: ${color},请使用十六进制颜色格式,如 #1890ff`)
|
|
277
|
+
return
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
// 转换为 6 位十六进制(去掉透明度)
|
|
281
|
+
let validColor = color
|
|
282
|
+
if (color.length === 4) {
|
|
283
|
+
// #RGB 转换为 #RRGGBB
|
|
284
|
+
validColor = '#' + color[1] + color[1] + color[2] + color[2] + color[3] + color[3]
|
|
285
|
+
} else if (color.length === 9) {
|
|
286
|
+
// #RRGGBBAA 转换为 #RRGGBB(去掉 Alpha)
|
|
287
|
+
validColor = color.substring(0, 7)
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
currentConfig.primaryColor = validColor
|
|
291
|
+
|
|
292
|
+
// 设置主色调
|
|
293
|
+
document.documentElement.style.setProperty('--xt-color-primary', validColor)
|
|
294
|
+
|
|
295
|
+
// 动态计算并设置浅色系列
|
|
296
|
+
document.documentElement.style.setProperty('--xt-color-primary-light-3', lightenColor(validColor, 30))
|
|
297
|
+
document.documentElement.style.setProperty('--xt-color-primary-light-5', lightenColor(validColor, 50))
|
|
298
|
+
document.documentElement.style.setProperty('--xt-color-primary-light-7', lightenColor(validColor, 70))
|
|
299
|
+
document.documentElement.style.setProperty('--xt-color-primary-light-8', lightenColor(validColor, 80))
|
|
300
|
+
document.documentElement.style.setProperty('--xt-color-primary-light-9', lightenColor(validColor, 90))
|
|
301
|
+
|
|
302
|
+
emitConfigChange('primaryColor', validColor)
|
|
303
|
+
console.log('[XtElementUI] 主色调已设置为:', validColor)
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
// 获取当前主题
|
|
307
|
+
const getTheme = function() {
|
|
308
|
+
return currentConfig.theme
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
// 获取当前字体大小
|
|
312
|
+
const getSize = function() {
|
|
313
|
+
return currentConfig.size
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
// 获取当前主色调
|
|
317
|
+
const getPrimaryColor = function() {
|
|
318
|
+
return currentConfig.primaryColor
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
// 重置为默认配置
|
|
322
|
+
const resetConfig = function() {
|
|
323
|
+
setConfig(defaultConfig)
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
// 监听配置变更
|
|
327
|
+
const onConfigChange = function(listener) {
|
|
328
|
+
if (typeof listener === 'function') {
|
|
329
|
+
configChangeListeners.push(listener)
|
|
330
|
+
return function() {
|
|
331
|
+
const index = configChangeListeners.indexOf(listener)
|
|
332
|
+
if (index > -1) {
|
|
333
|
+
configChangeListeners.splice(index, 1)
|
|
334
|
+
}
|
|
335
|
+
}
|
|
336
|
+
} else {
|
|
337
|
+
console.warn('[XtElementUI] onConfigChange 必须传入函数')
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
/* harmony default export */ var utils = ({
|
|
342
|
+
setTheme,
|
|
343
|
+
setSize,
|
|
344
|
+
setPrimaryColor,
|
|
345
|
+
getConfig,
|
|
346
|
+
setConfig,
|
|
347
|
+
getTheme,
|
|
348
|
+
getSize,
|
|
349
|
+
getPrimaryColor,
|
|
350
|
+
resetConfig,
|
|
351
|
+
onConfigChange
|
|
352
|
+
});
|
|
353
|
+
|
|
354
|
+
// 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
|
|
355
|
+
var render = function render(){var _vm=this,_c=_vm._self._c;return _c('button',{staticClass:"xt-button",class:[
|
|
356
|
+
'xt-button--' + _vm.type,
|
|
357
|
+
_vm.size ? 'xt-button--' + _vm.size : '',
|
|
358
|
+
{
|
|
359
|
+
'xt-button--plain': _vm.plain,
|
|
360
|
+
'is-disabled': _vm.disabled,
|
|
361
|
+
'is-round': _vm.round
|
|
362
|
+
}
|
|
363
|
+
],attrs:{"disabled":_vm.disabled},on:{"click":_vm.handleClick}},[_vm._t("default")],2)
|
|
320
364
|
}
|
|
321
365
|
var staticRenderFns = []
|
|
322
366
|
|
|
323
367
|
|
|
324
|
-
// CONCATENATED MODULE: ./src/components/button/index.vue?vue&type=template&id=
|
|
368
|
+
// CONCATENATED MODULE: ./src/components/button/index.vue?vue&type=template&id=0890decd
|
|
325
369
|
|
|
326
370
|
// 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
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
371
|
+
|
|
372
|
+
/* harmony default export */ var buttonvue_type_script_lang_js = ({
|
|
373
|
+
name: 'XtButton',
|
|
374
|
+
props: {
|
|
375
|
+
type: {
|
|
376
|
+
type: String,
|
|
377
|
+
default: 'default',
|
|
378
|
+
validator: (val) => ['default', 'primary', 'success', 'warning', 'danger'].includes(val)
|
|
379
|
+
},
|
|
380
|
+
size: {
|
|
381
|
+
type: String,
|
|
382
|
+
default: '',
|
|
383
|
+
validator: (val) => ['', 'large', 'medium', 'small', 'mini'].includes(val)
|
|
384
|
+
},
|
|
385
|
+
plain: {
|
|
386
|
+
type: Boolean,
|
|
387
|
+
default: false
|
|
388
|
+
},
|
|
389
|
+
disabled: {
|
|
390
|
+
type: Boolean,
|
|
391
|
+
default: false
|
|
392
|
+
},
|
|
393
|
+
round: {
|
|
394
|
+
type: Boolean,
|
|
395
|
+
default: false
|
|
396
|
+
}
|
|
397
|
+
},
|
|
398
|
+
methods: {
|
|
399
|
+
handleClick() {
|
|
400
|
+
if (!this.disabled) {
|
|
401
|
+
this.$emit('click')
|
|
402
|
+
}
|
|
403
|
+
}
|
|
404
|
+
}
|
|
405
|
+
});
|
|
406
|
+
|
|
337
407
|
// CONCATENATED MODULE: ./src/components/button/index.vue?vue&type=script&lang=js
|
|
338
408
|
/* harmony default export */ var components_buttonvue_type_script_lang_js = (buttonvue_type_script_lang_js);
|
|
339
409
|
// CONCATENATED MODULE: ./node_modules/vue-loader/lib/runtime/componentNormalizer.js
|
|
@@ -457,27 +527,41 @@ var component = normalizeComponent(
|
|
|
457
527
|
// CONCATENATED MODULE: ./src/components/button/index.js
|
|
458
528
|
|
|
459
529
|
/* harmony default export */ var src_components_button = (components_button);
|
|
460
|
-
// CONCATENATED MODULE: ./node_modules/cache-loader/dist/cjs.js?{"cacheDirectory":"node_modules/.cache/vue-loader","cacheIdentifier":"
|
|
461
|
-
var
|
|
530
|
+
// 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/input/index.vue?vue&type=template&id=4349f550
|
|
531
|
+
var inputvue_type_template_id_4349f550_render = function render(){var _vm=this,_c=_vm._self._c;return _c('div',{staticClass:"xt-input"},[_c('el-input',{style:(_vm.inputStyle),attrs:{"value":_vm.value,"placeholder":_vm.placeholder},on:{"input":function($event){return _vm.$emit('input', $event)}}})],1)
|
|
462
532
|
}
|
|
463
|
-
var
|
|
533
|
+
var inputvue_type_template_id_4349f550_staticRenderFns = []
|
|
464
534
|
|
|
465
535
|
|
|
466
|
-
// CONCATENATED MODULE: ./src/components/input/index.vue?vue&type=template&id=
|
|
536
|
+
// CONCATENATED MODULE: ./src/components/input/index.vue?vue&type=template&id=4349f550
|
|
467
537
|
|
|
468
538
|
// 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/input/index.vue?vue&type=script&lang=js
|
|
469
539
|
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
540
|
+
/* harmony default export */ var inputvue_type_script_lang_js = ({
|
|
541
|
+
name: 'XtInput',
|
|
542
|
+
props: {
|
|
543
|
+
value: [String, Number],
|
|
544
|
+
placeholder: {
|
|
545
|
+
type: String,
|
|
546
|
+
default: '请输入内容'
|
|
547
|
+
},
|
|
548
|
+
color: {
|
|
549
|
+
type: String,
|
|
550
|
+
default: ''
|
|
551
|
+
}
|
|
552
|
+
},
|
|
553
|
+
computed: {
|
|
554
|
+
inputStyle() {
|
|
555
|
+
if (this.color) {
|
|
556
|
+
return {
|
|
557
|
+
'--xt-input-focus-color': this.color
|
|
558
|
+
}
|
|
477
559
|
}
|
|
560
|
+
return {}
|
|
478
561
|
}
|
|
479
|
-
}
|
|
480
|
-
|
|
562
|
+
}
|
|
563
|
+
});
|
|
564
|
+
|
|
481
565
|
// CONCATENATED MODULE: ./src/components/input/index.vue?vue&type=script&lang=js
|
|
482
566
|
/* harmony default export */ var components_inputvue_type_script_lang_js = (inputvue_type_script_lang_js);
|
|
483
567
|
// CONCATENATED MODULE: ./src/components/input/index.vue
|
|
@@ -490,8 +574,8 @@ var inputvue_type_template_id_fe9146e4_staticRenderFns = []
|
|
|
490
574
|
|
|
491
575
|
var input_component = normalizeComponent(
|
|
492
576
|
components_inputvue_type_script_lang_js,
|
|
493
|
-
|
|
494
|
-
|
|
577
|
+
inputvue_type_template_id_4349f550_render,
|
|
578
|
+
inputvue_type_template_id_4349f550_staticRenderFns,
|
|
495
579
|
false,
|
|
496
580
|
null,
|
|
497
581
|
null,
|
|
@@ -503,55 +587,60 @@ var input_component = normalizeComponent(
|
|
|
503
587
|
// CONCATENATED MODULE: ./src/components/input/index.js
|
|
504
588
|
|
|
505
589
|
/* harmony default export */ var components_input = (input);
|
|
506
|
-
// CONCATENATED MODULE: ./node_modules/cache-loader/dist/cjs.js?{"cacheDirectory":"node_modules/.cache/vue-loader","cacheIdentifier":"
|
|
507
|
-
var
|
|
590
|
+
// 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/flex-box/index.vue?vue&type=template&id=68f07021
|
|
591
|
+
var flex_boxvue_type_template_id_68f07021_render = function render(){var _vm=this,_c=_vm._self._c;return _c('div',{staticClass:"xt-flex-box",class:_vm.classAttrs,style:(_vm.flexStyle)},[_vm._t("default")],2)
|
|
508
592
|
}
|
|
509
|
-
var
|
|
593
|
+
var flex_boxvue_type_template_id_68f07021_staticRenderFns = []
|
|
510
594
|
|
|
511
595
|
|
|
512
|
-
// CONCATENATED MODULE: ./src/components/flex-box/index.vue?vue&type=template&id=
|
|
596
|
+
// CONCATENATED MODULE: ./src/components/flex-box/index.vue?vue&type=template&id=68f07021
|
|
513
597
|
|
|
514
598
|
// 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/flex-box/index.vue?vue&type=script&lang=js
|
|
515
599
|
|
|
516
600
|
/* harmony default export */ var flex_boxvue_type_script_lang_js = ({
|
|
517
|
-
name: "
|
|
601
|
+
name: "XtFlexBox",
|
|
518
602
|
props: {
|
|
519
|
-
type: "flex",
|
|
520
|
-
align: "center",
|
|
521
|
-
content: "start",
|
|
522
|
-
direction: "row",
|
|
523
|
-
wrap: "unset",
|
|
524
|
-
gap: {}
|
|
603
|
+
type: { type: String, default: "flex" },
|
|
604
|
+
align: { type: String, default: "center" },
|
|
605
|
+
content: { type: String, default: "start" },
|
|
606
|
+
direction: { type: String, default: "row" },
|
|
607
|
+
wrap: { type: String, default: "unset" },
|
|
608
|
+
gap: { type: String, default: "" }
|
|
525
609
|
},
|
|
526
610
|
computed: {
|
|
527
611
|
classAttrs(){
|
|
528
|
-
const {
|
|
529
|
-
return [`${
|
|
612
|
+
const { type, align, wrap, direction, content } = this;
|
|
613
|
+
return [`${type}`, `align-${align}`, `content-${content}`, `direction-${direction}`, `wrap-${wrap}`]
|
|
614
|
+
},
|
|
615
|
+
flexStyle() {
|
|
616
|
+
const result = {}
|
|
617
|
+
if (this.gap) {
|
|
618
|
+
result.gap = this.gap
|
|
619
|
+
} else {
|
|
620
|
+
result.gap = 'var(--xt-flex-box-gap, 8px)'
|
|
621
|
+
}
|
|
622
|
+
return result
|
|
530
623
|
}
|
|
531
624
|
}
|
|
532
625
|
});
|
|
533
626
|
|
|
534
627
|
// CONCATENATED MODULE: ./src/components/flex-box/index.vue?vue&type=script&lang=js
|
|
535
628
|
/* harmony default export */ var components_flex_boxvue_type_script_lang_js = (flex_boxvue_type_script_lang_js);
|
|
536
|
-
// EXTERNAL MODULE: ./src/components/flex-box/index.vue?vue&type=style&index=0&id=28fcf19e&prod&scoped=true&lang=scss
|
|
537
|
-
var flex_boxvue_type_style_index_0_id_28fcf19e_prod_scoped_true_lang_scss = __webpack_require__("43ae");
|
|
538
|
-
|
|
539
629
|
// CONCATENATED MODULE: ./src/components/flex-box/index.vue
|
|
540
630
|
|
|
541
631
|
|
|
542
632
|
|
|
543
633
|
|
|
544
634
|
|
|
545
|
-
|
|
546
635
|
/* normalize component */
|
|
547
636
|
|
|
548
637
|
var flex_box_component = normalizeComponent(
|
|
549
638
|
components_flex_boxvue_type_script_lang_js,
|
|
550
|
-
|
|
551
|
-
|
|
639
|
+
flex_boxvue_type_template_id_68f07021_render,
|
|
640
|
+
flex_boxvue_type_template_id_68f07021_staticRenderFns,
|
|
552
641
|
false,
|
|
553
642
|
null,
|
|
554
|
-
|
|
643
|
+
null,
|
|
555
644
|
null
|
|
556
645
|
|
|
557
646
|
)
|
|
@@ -560,50 +649,46 @@ var flex_box_component = normalizeComponent(
|
|
|
560
649
|
// CONCATENATED MODULE: ./src/components/flex-box/index.js
|
|
561
650
|
|
|
562
651
|
/* harmony default export */ var components_flex_box = (flex_box);
|
|
563
|
-
// CONCATENATED MODULE: ./node_modules/cache-loader/dist/cjs.js?{"cacheDirectory":"node_modules/.cache/vue-loader","cacheIdentifier":"
|
|
564
|
-
var
|
|
652
|
+
// 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/card/index.vue?vue&type=template&id=cb20295a
|
|
653
|
+
var cardvue_type_template_id_cb20295a_render = function render(){var _vm=this,_c=_vm._self._c;return _c('div',{staticClass:"xt-card",class:{'no-padding': _vm.noPadding }},[(_vm.title)?_c('div',{staticClass:"card__header"},[_vm._t("title",function(){return [_vm._v(_vm._s(_vm.title))]})],2):_vm._e(),_c('div',{staticClass:"card__body"},[_vm._t("default",function(){return [_c('span',{staticClass:"value"},[_vm._t("value",function(){return [_vm._v(_vm._s(_vm.value))]})],2),_c('span',{staticClass:"unit"},[_vm._v(_vm._s(_vm.unit))])]})],2)])
|
|
565
654
|
}
|
|
566
|
-
var
|
|
655
|
+
var cardvue_type_template_id_cb20295a_staticRenderFns = []
|
|
567
656
|
|
|
568
657
|
|
|
569
|
-
// CONCATENATED MODULE: ./src/components/card/index.vue?vue&type=template&id=
|
|
658
|
+
// CONCATENATED MODULE: ./src/components/card/index.vue?vue&type=template&id=cb20295a
|
|
570
659
|
|
|
571
660
|
// 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/card/index.vue?vue&type=script&lang=js
|
|
572
661
|
|
|
573
662
|
/* harmony default export */ var cardvue_type_script_lang_js = ({
|
|
574
|
-
name:"XtCard",
|
|
575
|
-
props:{
|
|
576
|
-
type:{},
|
|
577
|
-
title:{},
|
|
578
|
-
value:{},
|
|
579
|
-
unit:{},
|
|
580
|
-
icon:{},
|
|
581
|
-
iconIn:{default:"right"},
|
|
582
|
-
noPadding:{type:Boolean,default:false}
|
|
663
|
+
name: "XtCard",
|
|
664
|
+
props: {
|
|
665
|
+
type: {},
|
|
666
|
+
title: {},
|
|
667
|
+
value: {},
|
|
668
|
+
unit: {},
|
|
669
|
+
icon: {},
|
|
670
|
+
iconIn: { default: "right" },
|
|
671
|
+
noPadding: { type: Boolean, default: false }
|
|
583
672
|
}
|
|
584
673
|
});
|
|
585
674
|
|
|
586
675
|
// CONCATENATED MODULE: ./src/components/card/index.vue?vue&type=script&lang=js
|
|
587
676
|
/* harmony default export */ var components_cardvue_type_script_lang_js = (cardvue_type_script_lang_js);
|
|
588
|
-
// EXTERNAL MODULE: ./src/components/card/index.vue?vue&type=style&index=0&id=444d40a5&prod&lang=scss&scoped=true
|
|
589
|
-
var cardvue_type_style_index_0_id_444d40a5_prod_lang_scss_scoped_true = __webpack_require__("d0ed");
|
|
590
|
-
|
|
591
677
|
// CONCATENATED MODULE: ./src/components/card/index.vue
|
|
592
678
|
|
|
593
679
|
|
|
594
680
|
|
|
595
681
|
|
|
596
682
|
|
|
597
|
-
|
|
598
683
|
/* normalize component */
|
|
599
684
|
|
|
600
685
|
var card_component = normalizeComponent(
|
|
601
686
|
components_cardvue_type_script_lang_js,
|
|
602
|
-
|
|
603
|
-
|
|
687
|
+
cardvue_type_template_id_cb20295a_render,
|
|
688
|
+
cardvue_type_template_id_cb20295a_staticRenderFns,
|
|
604
689
|
false,
|
|
605
690
|
null,
|
|
606
|
-
|
|
691
|
+
null,
|
|
607
692
|
null
|
|
608
693
|
|
|
609
694
|
)
|
|
@@ -612,74 +697,90 @@ var card_component = normalizeComponent(
|
|
|
612
697
|
// CONCATENATED MODULE: ./src/components/card/index.js
|
|
613
698
|
|
|
614
699
|
/* harmony default export */ var components_card = (card);
|
|
615
|
-
// CONCATENATED MODULE: ./node_modules/cache-loader/dist/cjs.js?{"cacheDirectory":"node_modules/.cache/vue-loader","cacheIdentifier":"
|
|
616
|
-
var
|
|
700
|
+
// 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/card-item/index.vue?vue&type=template&id=20eea1e3
|
|
701
|
+
var card_itemvue_type_template_id_20eea1e3_render = function render(){var _vm=this,_c=_vm._self._c;return (_vm.iconType=='border')?_c('FlexBox',{staticClass:"xt-card-item is-border",class:[_vm.iconType=='border'?`is-${_vm.type}`:''],style:(_vm.cardItemStyle),attrs:{"content":"between"}},[(_vm.title)?_c('span',{staticClass:"item__label"},[_vm._t("label",function(){return [_vm._v(_vm._s(_vm.label))]})],2):_vm._e(),_c('span',{staticClass:"item__value"},[_vm._t("value",function(){return [_vm._v(_vm._s(_vm.value))]})],2),_c('span',{staticClass:"item__unit"},[_vm._t("unit",function(){return [_vm._v(_vm._s(_vm.unit))]})],2)]):_c('FlexBox',{staticClass:"xt-card-item",attrs:{"direction":_vm.direction,"content":_vm.contentAlign}},[_vm._t("icon",function(){return [_c('el-button',{attrs:{"type":_vm.type,"circle":_vm.circle,"round":_vm.round,"plain":"","icon":_vm.icon}})]}),_c('div',{staticClass:"item__value"},[_c('span',{staticClass:"value",style:(_vm.valueStyle)},[_vm._t("value",function(){return [_vm._v(_vm._s(_vm.label))]})],2),_c('div',{staticClass:"unit"},[_vm._v(_vm._s(_vm.value))])])],2)
|
|
617
702
|
}
|
|
618
|
-
var
|
|
703
|
+
var card_itemvue_type_template_id_20eea1e3_staticRenderFns = []
|
|
619
704
|
|
|
620
705
|
|
|
621
|
-
// CONCATENATED MODULE: ./src/components/card-item/index.vue?vue&type=template&id=
|
|
706
|
+
// CONCATENATED MODULE: ./src/components/card-item/index.vue?vue&type=template&id=20eea1e3
|
|
622
707
|
|
|
623
708
|
// 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/card-item/index.vue?vue&type=script&lang=js
|
|
624
709
|
|
|
625
710
|
|
|
626
711
|
/* harmony default export */ var card_itemvue_type_script_lang_js = ({
|
|
627
|
-
name:"XtCardItem",
|
|
628
|
-
components:{
|
|
712
|
+
name: "XtCardItem",
|
|
713
|
+
components: {
|
|
629
714
|
FlexBox: flex_box
|
|
630
715
|
},
|
|
631
|
-
props:{
|
|
632
|
-
iconType:{default:"border"},
|
|
633
|
-
type:{default:"primary"},
|
|
634
|
-
label:{},
|
|
635
|
-
value:{},
|
|
636
|
-
unit:{},
|
|
637
|
-
icon:{},
|
|
638
|
-
iconAt:{default:"right"}
|
|
716
|
+
props: {
|
|
717
|
+
iconType: { default: "border" },
|
|
718
|
+
type: { default: "primary" },
|
|
719
|
+
label: {},
|
|
720
|
+
value: {},
|
|
721
|
+
unit: {},
|
|
722
|
+
icon: {},
|
|
723
|
+
iconAt: { default: "right" },
|
|
724
|
+
color: {
|
|
725
|
+
type: String,
|
|
726
|
+
default: ''
|
|
727
|
+
}
|
|
639
728
|
},
|
|
640
|
-
data(){
|
|
641
|
-
return{
|
|
729
|
+
data() {
|
|
730
|
+
return {
|
|
642
731
|
circle: false,
|
|
643
732
|
round: false
|
|
644
733
|
}
|
|
645
734
|
},
|
|
646
|
-
computed:{
|
|
647
|
-
contentAlign(){
|
|
648
|
-
return this.iconAt=='center'?'center':'start'
|
|
735
|
+
computed: {
|
|
736
|
+
contentAlign() {
|
|
737
|
+
return this.iconAt == 'center' ? 'center' : 'start'
|
|
649
738
|
},
|
|
650
|
-
direction(){
|
|
739
|
+
direction() {
|
|
651
740
|
const iconAtMap = {
|
|
652
|
-
left:'row',
|
|
653
|
-
right:'row-reverse',
|
|
654
|
-
top:'column',
|
|
655
|
-
bottom:'column-reverse'
|
|
741
|
+
left: 'row',
|
|
742
|
+
right: 'row-reverse',
|
|
743
|
+
top: 'column',
|
|
744
|
+
bottom: 'column-reverse'
|
|
656
745
|
}
|
|
657
746
|
return iconAtMap[this.iconAt]
|
|
747
|
+
},
|
|
748
|
+
cardItemStyle() {
|
|
749
|
+
if (this.iconType === 'border' && this.type === 'primary' && this.color) {
|
|
750
|
+
return {
|
|
751
|
+
'--xt-card-item-color': this.color
|
|
752
|
+
}
|
|
753
|
+
}
|
|
754
|
+
return {}
|
|
755
|
+
},
|
|
756
|
+
valueStyle() {
|
|
757
|
+
if (this.iconType !== 'border' && this.type === 'primary' && this.color) {
|
|
758
|
+
return {
|
|
759
|
+
color: this.color
|
|
760
|
+
}
|
|
761
|
+
}
|
|
762
|
+
return {}
|
|
658
763
|
}
|
|
659
764
|
}
|
|
660
765
|
});
|
|
661
766
|
|
|
662
767
|
// CONCATENATED MODULE: ./src/components/card-item/index.vue?vue&type=script&lang=js
|
|
663
768
|
/* harmony default export */ var components_card_itemvue_type_script_lang_js = (card_itemvue_type_script_lang_js);
|
|
664
|
-
// EXTERNAL MODULE: ./src/components/card-item/index.vue?vue&type=style&index=0&id=1100cec5&prod&lang=scss&scoped=true
|
|
665
|
-
var card_itemvue_type_style_index_0_id_1100cec5_prod_lang_scss_scoped_true = __webpack_require__("7876");
|
|
666
|
-
|
|
667
769
|
// CONCATENATED MODULE: ./src/components/card-item/index.vue
|
|
668
770
|
|
|
669
771
|
|
|
670
772
|
|
|
671
773
|
|
|
672
774
|
|
|
673
|
-
|
|
674
775
|
/* normalize component */
|
|
675
776
|
|
|
676
777
|
var card_item_component = normalizeComponent(
|
|
677
778
|
components_card_itemvue_type_script_lang_js,
|
|
678
|
-
|
|
679
|
-
|
|
779
|
+
card_itemvue_type_template_id_20eea1e3_render,
|
|
780
|
+
card_itemvue_type_template_id_20eea1e3_staticRenderFns,
|
|
680
781
|
false,
|
|
681
782
|
null,
|
|
682
|
-
|
|
783
|
+
null,
|
|
683
784
|
null
|
|
684
785
|
|
|
685
786
|
)
|
|
@@ -688,12 +789,306 @@ var card_item_component = normalizeComponent(
|
|
|
688
789
|
// CONCATENATED MODULE: ./src/components/card-item/index.js
|
|
689
790
|
|
|
690
791
|
/* harmony default export */ var components_card_item = (card_item);
|
|
792
|
+
// 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
|
|
793
|
+
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)
|
|
794
|
+
}
|
|
795
|
+
var config_providervue_type_template_id_7d1cf1ae_staticRenderFns = []
|
|
796
|
+
|
|
797
|
+
|
|
798
|
+
// CONCATENATED MODULE: ./src/components/config-provider/index.vue?vue&type=template&id=7d1cf1ae
|
|
799
|
+
|
|
800
|
+
// 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
|
|
801
|
+
|
|
802
|
+
/* harmony default export */ var config_providervue_type_script_lang_js = ({
|
|
803
|
+
name: 'XtConfigProvider',
|
|
804
|
+
inheritAttrs: false,
|
|
805
|
+
props: {
|
|
806
|
+
theme: {
|
|
807
|
+
type: String,
|
|
808
|
+
default: 'white'
|
|
809
|
+
},
|
|
810
|
+
size: {
|
|
811
|
+
type: String,
|
|
812
|
+
default: 'medium'
|
|
813
|
+
},
|
|
814
|
+
primaryColor: {
|
|
815
|
+
type: String,
|
|
816
|
+
default: '#409EFF'
|
|
817
|
+
},
|
|
818
|
+
vars: {
|
|
819
|
+
type: Object,
|
|
820
|
+
default: () => ({})
|
|
821
|
+
},
|
|
822
|
+
tag: {
|
|
823
|
+
type: String,
|
|
824
|
+
default: 'div',
|
|
825
|
+
validator: (value) => {
|
|
826
|
+
return ['div', 'span', 'section', 'main', 'template', 'article', 'aside'].includes(value)
|
|
827
|
+
}
|
|
828
|
+
},
|
|
829
|
+
injectBackground: {
|
|
830
|
+
type: Boolean,
|
|
831
|
+
default: false
|
|
832
|
+
},
|
|
833
|
+
injectColor: {
|
|
834
|
+
type: Boolean,
|
|
835
|
+
default: false
|
|
836
|
+
}
|
|
837
|
+
},
|
|
838
|
+
computed: {
|
|
839
|
+
mergedStyle() {
|
|
840
|
+
const result = { ...this.vars }
|
|
841
|
+
|
|
842
|
+
if (this.primaryColor) {
|
|
843
|
+
const color = this.normalizeColor(this.primaryColor)
|
|
844
|
+
result['--xt-color-primary'] = color
|
|
845
|
+
result['--xt-color-primary-light-3'] = this.lightenColor(color, 30)
|
|
846
|
+
result['--xt-color-primary-light-5'] = this.lightenColor(color, 50)
|
|
847
|
+
result['--xt-color-primary-light-7'] = this.lightenColor(color, 70)
|
|
848
|
+
result['--xt-color-primary-light-8'] = this.lightenColor(color, 80)
|
|
849
|
+
result['--xt-color-primary-light-9'] = this.lightenColor(color, 90)
|
|
850
|
+
}
|
|
851
|
+
|
|
852
|
+
const sizeMap = {
|
|
853
|
+
small: '12px',
|
|
854
|
+
medium: '14px',
|
|
855
|
+
large: '16px'
|
|
856
|
+
}
|
|
857
|
+
if (sizeMap[this.size]) {
|
|
858
|
+
result['--xt-font-size-base'] = sizeMap[this.size]
|
|
859
|
+
}
|
|
860
|
+
|
|
861
|
+
if (this.theme === 'dark') {
|
|
862
|
+
result['--xt-color-text-primary'] = 'rgba(255, 255, 255, 0.95)'
|
|
863
|
+
result['--xt-color-text-regular'] = 'rgba(255, 255, 255, 0.8)'
|
|
864
|
+
result['--xt-color-text-secondary'] = 'rgba(255, 255, 255, 0.6)'
|
|
865
|
+
result['--xt-color-bg-primary'] = '#1f1f1f'
|
|
866
|
+
result['--xt-color-bg-secondary'] = '#2d2d2d'
|
|
867
|
+
result['--xt-color-bg-container'] = '#1f1f1f'
|
|
868
|
+
result['--xt-color-border'] = '#434343'
|
|
869
|
+
result['--xt-color-border-light'] = '#3d3d3d'
|
|
870
|
+
|
|
871
|
+
if (this.injectBackground) {
|
|
872
|
+
result.backgroundColor = result['--xt-color-bg-primary']
|
|
873
|
+
}
|
|
874
|
+
if (this.injectColor) {
|
|
875
|
+
result.color = result['--xt-color-text-primary']
|
|
876
|
+
}
|
|
877
|
+
} else {
|
|
878
|
+
// 恢复默认主题颜色(white 主题)
|
|
879
|
+
result['--xt-color-text-primary'] = '#303133'
|
|
880
|
+
result['--xt-color-text-regular'] = '#606266'
|
|
881
|
+
result['--xt-color-text-secondary'] = '#909399'
|
|
882
|
+
result['--xt-color-bg-primary'] = '#ffffff'
|
|
883
|
+
result['--xt-color-bg-secondary'] = '#f5f7fa'
|
|
884
|
+
result['--xt-color-bg-container'] = '#f5f7fa'
|
|
885
|
+
result['--xt-color-border'] = '#DCDFE6'
|
|
886
|
+
result['--xt-color-border-light'] = '#E4E7ED'
|
|
887
|
+
|
|
888
|
+
if (this.injectBackground) {
|
|
889
|
+
result.backgroundColor = result['--xt-color-bg-primary']
|
|
890
|
+
}
|
|
891
|
+
if (this.injectColor) {
|
|
892
|
+
result.color = result['--xt-color-text-primary']
|
|
893
|
+
}
|
|
894
|
+
}
|
|
895
|
+
|
|
896
|
+
return result
|
|
897
|
+
},
|
|
898
|
+
computedClass() {
|
|
899
|
+
const classes = []
|
|
900
|
+
|
|
901
|
+
if (this.tag !== 'template') {
|
|
902
|
+
classes.push('xt-config-provider')
|
|
903
|
+
|
|
904
|
+
if (this.theme === 'dark') {
|
|
905
|
+
classes.push('xt-config-provider--dark')
|
|
906
|
+
}
|
|
907
|
+
}
|
|
908
|
+
|
|
909
|
+
return classes
|
|
910
|
+
},
|
|
911
|
+
customAttrs() {
|
|
912
|
+
const props = ['theme', 'size', 'primaryColor', 'vars', 'tag', 'injectBackground', 'injectColor']
|
|
913
|
+
const attrs = {}
|
|
914
|
+
|
|
915
|
+
for (const key in this.$attrs) {
|
|
916
|
+
if (!props.includes(key)) {
|
|
917
|
+
attrs[key] = this.$attrs[key]
|
|
918
|
+
}
|
|
919
|
+
}
|
|
920
|
+
|
|
921
|
+
return attrs
|
|
922
|
+
}
|
|
923
|
+
},
|
|
924
|
+
methods: {
|
|
925
|
+
normalizeColor(color) {
|
|
926
|
+
if (!color) return '#409EFF'
|
|
927
|
+
|
|
928
|
+
if (/^#[0-9A-Fa-f]{6}$/.test(color)) {
|
|
929
|
+
return color
|
|
930
|
+
}
|
|
931
|
+
|
|
932
|
+
if (/^#[0-9A-Fa-f]{3}$/.test(color)) {
|
|
933
|
+
return '#' + color[1] + color[1] + color[2] + color[2] + color[3] + color[3]
|
|
934
|
+
}
|
|
935
|
+
|
|
936
|
+
if (/^#[0-9A-Fa-f]{8}$/.test(color)) {
|
|
937
|
+
return color.substring(0, 7)
|
|
938
|
+
}
|
|
939
|
+
|
|
940
|
+
const rgbaMatch = color.match(/^rgba?\((\d+),\s*(\d+),\s*(\d+)/i)
|
|
941
|
+
if (rgbaMatch) {
|
|
942
|
+
const r = parseInt(rgbaMatch[1])
|
|
943
|
+
const g = parseInt(rgbaMatch[2])
|
|
944
|
+
const b = parseInt(rgbaMatch[3])
|
|
945
|
+
return this.rgbToHex(r, g, b)
|
|
946
|
+
}
|
|
947
|
+
|
|
948
|
+
console.warn('[XtConfigProvider] 无法识别的颜色格式:', color)
|
|
949
|
+
return '#409EFF'
|
|
950
|
+
},
|
|
951
|
+
|
|
952
|
+
hexToRgb(hex) {
|
|
953
|
+
const result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex)
|
|
954
|
+
return result ? {
|
|
955
|
+
r: parseInt(result[1], 16),
|
|
956
|
+
g: parseInt(result[2], 16),
|
|
957
|
+
b: parseInt(result[3], 16)
|
|
958
|
+
} : null
|
|
959
|
+
},
|
|
960
|
+
|
|
961
|
+
rgbToHex(r, g, b) {
|
|
962
|
+
return '#' + [r, g, b].map(x => {
|
|
963
|
+
const hex = x.toString(16)
|
|
964
|
+
return hex.length === 1 ? '0' + hex : hex
|
|
965
|
+
}).join('')
|
|
966
|
+
},
|
|
967
|
+
|
|
968
|
+
lightenColor(hex, percent) {
|
|
969
|
+
const rgb = this.hexToRgb(hex)
|
|
970
|
+
if (!rgb) return hex
|
|
971
|
+
|
|
972
|
+
const amount = Math.round(2.55 * percent)
|
|
973
|
+
const r = Math.min(255, rgb.r + amount)
|
|
974
|
+
const g = Math.min(255, rgb.g + amount)
|
|
975
|
+
const b = Math.min(255, rgb.b + amount)
|
|
976
|
+
|
|
977
|
+
return this.rgbToHex(r, g, b)
|
|
978
|
+
}
|
|
979
|
+
}
|
|
980
|
+
});
|
|
981
|
+
|
|
982
|
+
// CONCATENATED MODULE: ./src/components/config-provider/index.vue?vue&type=script&lang=js
|
|
983
|
+
/* harmony default export */ var components_config_providervue_type_script_lang_js = (config_providervue_type_script_lang_js);
|
|
984
|
+
// CONCATENATED MODULE: ./src/components/config-provider/index.vue
|
|
985
|
+
|
|
986
|
+
|
|
987
|
+
|
|
988
|
+
|
|
989
|
+
|
|
990
|
+
/* normalize component */
|
|
991
|
+
|
|
992
|
+
var config_provider_component = normalizeComponent(
|
|
993
|
+
components_config_providervue_type_script_lang_js,
|
|
994
|
+
config_providervue_type_template_id_7d1cf1ae_render,
|
|
995
|
+
config_providervue_type_template_id_7d1cf1ae_staticRenderFns,
|
|
996
|
+
false,
|
|
997
|
+
null,
|
|
998
|
+
null,
|
|
999
|
+
null
|
|
1000
|
+
|
|
1001
|
+
)
|
|
1002
|
+
|
|
1003
|
+
/* harmony default export */ var config_provider = (config_provider_component.exports);
|
|
1004
|
+
// CONCATENATED MODULE: ./src/components/config-provider/index.js
|
|
1005
|
+
|
|
1006
|
+
/* harmony default export */ var components_config_provider = (config_provider);
|
|
1007
|
+
|
|
1008
|
+
// 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
|
|
1009
|
+
var textvue_type_template_id_04e7447e_render = function render(){var _vm=this,_c=_vm._self._c;return _c('span',{staticClass:"xt-text",class:[
|
|
1010
|
+
_vm.type ? 'xt-text--' + _vm.type : '',
|
|
1011
|
+
{ 'xt-text--bold': _vm.bold }
|
|
1012
|
+
],style:(_vm.customStyle)},[_vm._t("default")],2)
|
|
1013
|
+
}
|
|
1014
|
+
var textvue_type_template_id_04e7447e_staticRenderFns = []
|
|
1015
|
+
|
|
1016
|
+
|
|
1017
|
+
// CONCATENATED MODULE: ./src/components/text/index.vue?vue&type=template&id=04e7447e
|
|
1018
|
+
|
|
1019
|
+
// 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
|
|
1020
|
+
|
|
1021
|
+
/* harmony default export */ var textvue_type_script_lang_js = ({
|
|
1022
|
+
name: 'XtText',
|
|
1023
|
+
props: {
|
|
1024
|
+
type: {
|
|
1025
|
+
type: String,
|
|
1026
|
+
default: '',
|
|
1027
|
+
validator: (val) => ['', 'primary', 'success', 'warning', 'danger'].includes(val)
|
|
1028
|
+
},
|
|
1029
|
+
bold: {
|
|
1030
|
+
type: Boolean,
|
|
1031
|
+
default: false
|
|
1032
|
+
},
|
|
1033
|
+
letterSpacing: {
|
|
1034
|
+
type: [String, Number],
|
|
1035
|
+
default: ''
|
|
1036
|
+
}
|
|
1037
|
+
},
|
|
1038
|
+
computed: {
|
|
1039
|
+
customStyle() {
|
|
1040
|
+
const style = {}
|
|
1041
|
+
if (this.letterSpacing) {
|
|
1042
|
+
style.letterSpacing = typeof this.letterSpacing === 'number' ? `${this.letterSpacing}px` : this.letterSpacing
|
|
1043
|
+
}
|
|
1044
|
+
return style
|
|
1045
|
+
}
|
|
1046
|
+
}
|
|
1047
|
+
});
|
|
1048
|
+
|
|
1049
|
+
// CONCATENATED MODULE: ./src/components/text/index.vue?vue&type=script&lang=js
|
|
1050
|
+
/* harmony default export */ var components_textvue_type_script_lang_js = (textvue_type_script_lang_js);
|
|
1051
|
+
// CONCATENATED MODULE: ./src/components/text/index.vue
|
|
1052
|
+
|
|
1053
|
+
|
|
1054
|
+
|
|
1055
|
+
|
|
1056
|
+
|
|
1057
|
+
/* normalize component */
|
|
1058
|
+
|
|
1059
|
+
var text_component = normalizeComponent(
|
|
1060
|
+
components_textvue_type_script_lang_js,
|
|
1061
|
+
textvue_type_template_id_04e7447e_render,
|
|
1062
|
+
textvue_type_template_id_04e7447e_staticRenderFns,
|
|
1063
|
+
false,
|
|
1064
|
+
null,
|
|
1065
|
+
null,
|
|
1066
|
+
null
|
|
1067
|
+
|
|
1068
|
+
)
|
|
1069
|
+
|
|
1070
|
+
/* harmony default export */ var components_text = (text_component.exports);
|
|
1071
|
+
// CONCATENATED MODULE: ./src/components/text/index.js
|
|
1072
|
+
|
|
1073
|
+
/* harmony default export */ var src_components_text = (components_text);
|
|
691
1074
|
// CONCATENATED MODULE: ./src/index.js
|
|
1075
|
+
// 导入主题样式(定义 CSS 变量)
|
|
1076
|
+
|
|
1077
|
+
|
|
1078
|
+
// 导入组件样式(统一入口)
|
|
1079
|
+
|
|
1080
|
+
|
|
692
1081
|
// 导入 SCSS 变量(通过 CSS Modules :export 导出)
|
|
693
1082
|
|
|
694
1083
|
|
|
695
1084
|
|
|
696
1085
|
|
|
1086
|
+
// ES Module 默认导出需要通过 .default 访问
|
|
1087
|
+
const src_utils = utils.default || utils
|
|
1088
|
+
|
|
1089
|
+
// 从 utils 导入配置管理函数(仅用于存储配置)
|
|
1090
|
+
const { getConfig: src_getConfig, setConfig: src_setConfig, getTheme: src_getTheme, getSize: src_getSize, getPrimaryColor: src_getPrimaryColor, resetConfig: src_resetConfig, onConfigChange: src_onConfigChange, setTheme: src_setTheme, setSize: src_setSize, setPrimaryColor: src_setPrimaryColor } = src_utils
|
|
1091
|
+
|
|
697
1092
|
// 导入组件
|
|
698
1093
|
|
|
699
1094
|
|
|
@@ -701,26 +1096,63 @@ var card_item_component = normalizeComponent(
|
|
|
701
1096
|
|
|
702
1097
|
|
|
703
1098
|
|
|
1099
|
+
|
|
1100
|
+
|
|
704
1101
|
// 存储组件列表
|
|
705
|
-
const
|
|
1102
|
+
const src_components = [
|
|
706
1103
|
src_components_button,
|
|
707
1104
|
components_input,
|
|
708
1105
|
components_flex_box,
|
|
709
1106
|
components_card,
|
|
710
|
-
components_card_item
|
|
1107
|
+
components_card_item,
|
|
1108
|
+
components_config_provider,
|
|
1109
|
+
src_components_text
|
|
711
1110
|
]
|
|
712
1111
|
|
|
713
1112
|
|
|
714
1113
|
// 定义 install 方法,Vue.use() 会自动调用
|
|
715
|
-
const install = function (Vue) {
|
|
1114
|
+
const install = function (Vue, options = {}) {
|
|
716
1115
|
if (install.installed) return
|
|
717
1116
|
install.installed = true
|
|
718
1117
|
|
|
719
1118
|
// 全局注册所有 xt- 组件
|
|
720
|
-
|
|
1119
|
+
src_components.forEach(component => {
|
|
721
1120
|
Vue.component(component.name, component)
|
|
722
1121
|
})
|
|
723
|
-
|
|
1122
|
+
|
|
1123
|
+
// 将工具方法挂载到 Vue.prototype
|
|
1124
|
+
Vue.prototype.$xt = {
|
|
1125
|
+
setTheme: src_setTheme,
|
|
1126
|
+
setSize: src_setSize,
|
|
1127
|
+
setPrimaryColor: src_setPrimaryColor,
|
|
1128
|
+
getConfig: src_getConfig,
|
|
1129
|
+
setConfig: src_setConfig,
|
|
1130
|
+
getTheme: src_getTheme,
|
|
1131
|
+
getSize: src_getSize,
|
|
1132
|
+
getPrimaryColor: src_getPrimaryColor,
|
|
1133
|
+
resetConfig: src_resetConfig,
|
|
1134
|
+
onConfigChange: src_onConfigChange
|
|
1135
|
+
}
|
|
1136
|
+
|
|
1137
|
+
// 在安装时直接应用配置选项
|
|
1138
|
+
if (options) {
|
|
1139
|
+
// 处理主题配置
|
|
1140
|
+
if (options.theme !== undefined) {
|
|
1141
|
+
src_setTheme(options.theme)
|
|
1142
|
+
}
|
|
1143
|
+
// 处理字体大小配置
|
|
1144
|
+
if (options.size !== undefined) {
|
|
1145
|
+
src_setSize(options.size)
|
|
1146
|
+
}
|
|
1147
|
+
// 处理主色调配置
|
|
1148
|
+
if (options.primaryColor !== undefined) {
|
|
1149
|
+
src_setPrimaryColor(options.primaryColor)
|
|
1150
|
+
}
|
|
1151
|
+
// 处理完整配置对象
|
|
1152
|
+
if (options.config !== undefined) {
|
|
1153
|
+
src_setConfig(options.config)
|
|
1154
|
+
}
|
|
1155
|
+
}
|
|
724
1156
|
}
|
|
725
1157
|
|
|
726
1158
|
// 支持全局 script 标签引入
|
|
@@ -736,127 +1168,14 @@ if (typeof window !== 'undefined' && window.Vue) {
|
|
|
736
1168
|
Input: components_input,
|
|
737
1169
|
FlexBox: components_flex_box,
|
|
738
1170
|
Card: components_card,
|
|
739
|
-
CardItem: components_card_item
|
|
1171
|
+
CardItem: components_card_item,
|
|
1172
|
+
ConfigProvider: components_config_provider,
|
|
1173
|
+
Text: src_components_text
|
|
740
1174
|
});
|
|
741
1175
|
|
|
742
1176
|
// 导出工具函数和变量
|
|
743
1177
|
|
|
744
1178
|
|
|
745
|
-
// 默认配置
|
|
746
|
-
const src_defaultConfig = {
|
|
747
|
-
theme: 'light',
|
|
748
|
-
size: 'medium',
|
|
749
|
-
primaryColor: '#1890ff'
|
|
750
|
-
}
|
|
751
|
-
|
|
752
|
-
// 当前配置
|
|
753
|
-
let src_currentConfig = { ...src_defaultConfig }
|
|
754
|
-
|
|
755
|
-
// 配置变更事件处理
|
|
756
|
-
const src_configChangeListeners = []
|
|
757
|
-
|
|
758
|
-
const src_emitConfigChange = function(key, value) {
|
|
759
|
-
src_configChangeListeners.forEach(listener => {
|
|
760
|
-
listener(key, value)
|
|
761
|
-
})
|
|
762
|
-
}
|
|
763
|
-
|
|
764
|
-
// 获取所有配置
|
|
765
|
-
const src_getConfig = function() {
|
|
766
|
-
return { ...src_currentConfig }
|
|
767
|
-
}
|
|
768
|
-
|
|
769
|
-
// 设置全局配置
|
|
770
|
-
const src_setConfig = function(config) {
|
|
771
|
-
if (typeof config !== 'object' || config === null) {
|
|
772
|
-
console.warn('[XtElementUI] setConfig 必须传入对象参数')
|
|
773
|
-
return
|
|
774
|
-
}
|
|
775
|
-
|
|
776
|
-
if (config.theme !== undefined) {
|
|
777
|
-
src_setTheme(config.theme)
|
|
778
|
-
}
|
|
779
|
-
if (config.size !== undefined) {
|
|
780
|
-
src_setSize(config.size)
|
|
781
|
-
}
|
|
782
|
-
if (config.primaryColor !== undefined) {
|
|
783
|
-
src_setPrimaryColor(config.primaryColor)
|
|
784
|
-
}
|
|
785
|
-
}
|
|
786
|
-
|
|
787
|
-
// 设置主题(只控制颜色)
|
|
788
|
-
const src_setTheme = function(theme) {
|
|
789
|
-
const validThemes = ['light', 'dark']
|
|
790
|
-
if (!validThemes.includes(theme)) {
|
|
791
|
-
console.warn(`[XtElementUI] 无效的主题值: ${theme},可选值: ${validThemes.join(', ')}`)
|
|
792
|
-
return
|
|
793
|
-
}
|
|
794
|
-
|
|
795
|
-
src_currentConfig.theme = theme
|
|
796
|
-
document.documentElement.setAttribute('data-theme', theme)
|
|
797
|
-
src_emitConfigChange('theme', theme)
|
|
798
|
-
}
|
|
799
|
-
|
|
800
|
-
// 设置字体大小和间距
|
|
801
|
-
const src_setSize = function(size) {
|
|
802
|
-
const validSizes = ['small', 'medium', 'large']
|
|
803
|
-
if (!validSizes.includes(size)) {
|
|
804
|
-
console.warn(`[XtElementUI] 无效的大小值: ${size},可选值: ${validSizes.join(', ')}`)
|
|
805
|
-
return
|
|
806
|
-
}
|
|
807
|
-
|
|
808
|
-
src_currentConfig.size = size
|
|
809
|
-
document.documentElement.setAttribute('data-size', size)
|
|
810
|
-
src_emitConfigChange('size', size)
|
|
811
|
-
}
|
|
812
|
-
|
|
813
|
-
// 设置主色调
|
|
814
|
-
const src_setPrimaryColor = function(color) {
|
|
815
|
-
const colorRegex = /^#[0-9A-Fa-f]{6}$|^#[0-9A-Fa-f]{3}$/
|
|
816
|
-
if (!colorRegex.test(color)) {
|
|
817
|
-
console.warn(`[XtElementUI] 无效的颜色值: ${color},请使用十六进制颜色格式,如 #1890ff`)
|
|
818
|
-
return
|
|
819
|
-
}
|
|
820
|
-
|
|
821
|
-
src_currentConfig.primaryColor = color
|
|
822
|
-
document.documentElement.style.setProperty('--xt-color-primary', color)
|
|
823
|
-
src_emitConfigChange('primaryColor', color)
|
|
824
|
-
}
|
|
825
|
-
|
|
826
|
-
// 获取当前主题
|
|
827
|
-
const src_getTheme = function() {
|
|
828
|
-
return src_currentConfig.theme
|
|
829
|
-
}
|
|
830
|
-
|
|
831
|
-
// 获取当前字体大小
|
|
832
|
-
const src_getSize = function() {
|
|
833
|
-
return src_currentConfig.size
|
|
834
|
-
}
|
|
835
|
-
|
|
836
|
-
// 获取当前主色调
|
|
837
|
-
const src_getPrimaryColor = function() {
|
|
838
|
-
return src_currentConfig.primaryColor
|
|
839
|
-
}
|
|
840
|
-
|
|
841
|
-
// 重置为默认配置
|
|
842
|
-
const src_resetConfig = function() {
|
|
843
|
-
src_setConfig(src_defaultConfig)
|
|
844
|
-
}
|
|
845
|
-
|
|
846
|
-
// 监听配置变更
|
|
847
|
-
const src_onConfigChange = function(listener) {
|
|
848
|
-
if (typeof listener === 'function') {
|
|
849
|
-
src_configChangeListeners.push(listener)
|
|
850
|
-
return function() {
|
|
851
|
-
const index = src_configChangeListeners.indexOf(listener)
|
|
852
|
-
if (index > -1) {
|
|
853
|
-
src_configChangeListeners.splice(index, 1)
|
|
854
|
-
}
|
|
855
|
-
}
|
|
856
|
-
} else {
|
|
857
|
-
console.warn('[XtElementUI] onConfigChange 必须传入函数')
|
|
858
|
-
}
|
|
859
|
-
}
|
|
860
1179
|
// CONCATENATED MODULE: ./node_modules/@vue/cli-service/lib/commands/build/entry-lib.js
|
|
861
1180
|
|
|
862
1181
|
|