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