xt-element-ui 1.0.4 → 1.0.6
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 +183 -84
- package/lib/index.css +0 -1
- package/lib/index.umd.js +188 -89
- package/lib/index.umd.min.js +1 -1
- package/package.json +2 -2
- package/src/index.js +12 -17
- package/src/styles/export.scss +86 -0
- package/src/styles/theme-element.scss +1 -1
- package/src/styles/theme.scss +81 -59
- package/src/styles/variables.scss +119 -41
- package/src/utils/index.js +124 -0
- package/lib/fonts/element-icons.535877f5.woff +0 -0
- package/lib/fonts/element-icons.732389de.ttf +0 -0
package/lib/index.common.js
CHANGED
|
@@ -87,24 +87,11 @@ module.exports =
|
|
|
87
87
|
/************************************************************************/
|
|
88
88
|
/******/ ({
|
|
89
89
|
|
|
90
|
-
/***/ "
|
|
90
|
+
/***/ "27fd":
|
|
91
91
|
/***/ (function(module, exports, __webpack_require__) {
|
|
92
92
|
|
|
93
93
|
// extracted by mini-css-extract-plugin
|
|
94
|
-
|
|
95
|
-
/***/ }),
|
|
96
|
-
|
|
97
|
-
/***/ "5f72":
|
|
98
|
-
/***/ (function(module, exports) {
|
|
99
|
-
|
|
100
|
-
module.exports = require("ElementUI");
|
|
101
|
-
|
|
102
|
-
/***/ }),
|
|
103
|
-
|
|
104
|
-
/***/ "8bbf":
|
|
105
|
-
/***/ (function(module, exports) {
|
|
106
|
-
|
|
107
|
-
module.exports = require("Vue");
|
|
94
|
+
module.exports = {"xtColorPrimary":"#409EFF","xtColorSuccess":"#67C23A","xtColorWarning":"#E6A23C","xtColorDanger":"#F56C6C","xtColorInfo":"#909399","xtColorPrimaryLight3":"#79BBFF","xtColorPrimaryLight5":"#A0CFFF","xtColorPrimaryLight7":"#C6E2FF","xtColorPrimaryLight8":"#D9ECFF","xtColorPrimaryLight9":"#ECF5FF","xtColorTextPrimary":"#303133","xtColorTextRegular":"#606266","xtColorTextSecondary":"#909399","xtColorTextPlaceholder":"#C0C4CC","xtColorTextDisabled":"#C0C4CC","xtColorBgPrimary":"#ffffff","xtColorBgSecondary":"#f5f7fa","xtColorBgHover":"#f5f5f5","xtColorBgContainer":"#f5f7fa","xtColorBgOverlay":"#ffffff","xtColorBorder":"#DCDFE6","xtColorBorderLight":"#E4E7ED","xtColorBorderLighter":"#EBEEF5","xtColorBorderExtraLight":"#F2F6FC","xtFontSizeExtraLarge":"20px","xtFontSizeLarge":"18px","xtFontSizeMedium":"16px","xtFontSizeBase":"14px","xtFontSizeSmall":"13px","xtFontSizeExtraSmall":"12px","xtSpacingXs":"4px","xtSpacingSm":"8px","xtSpacingMd":"12px","xtSpacingLg":"16px","xtSpacingXl":"20px","xtBorderRadiusBase":"4px","xtBorderRadiusSmall":"2px","xtBorderRadiusRound":"20px","xtBorderRadiusCircle":"50%","xtShadowSm":"0 2px 4px rgba(0, 0, 0, 0.04)","xtShadowMd":"0 4px 12px rgba(0, 0, 0, 0.08)","xtShadowLg":"0 8px 24px rgba(0, 0, 0, 0.12)","xtTransitionDuration":"0.3s","xtTransitionDurationFast":"0.2s"};
|
|
108
95
|
|
|
109
96
|
/***/ }),
|
|
110
97
|
|
|
@@ -116,16 +103,18 @@ module.exports = require("Vue");
|
|
|
116
103
|
__webpack_require__.r(__webpack_exports__);
|
|
117
104
|
|
|
118
105
|
// EXPORTS
|
|
119
|
-
__webpack_require__.d(__webpack_exports__, "
|
|
120
|
-
__webpack_require__.d(__webpack_exports__, "
|
|
121
|
-
__webpack_require__.d(__webpack_exports__, "
|
|
122
|
-
__webpack_require__.d(__webpack_exports__, "
|
|
123
|
-
__webpack_require__.d(__webpack_exports__, "
|
|
124
|
-
__webpack_require__.d(__webpack_exports__, "
|
|
125
|
-
__webpack_require__.d(__webpack_exports__, "
|
|
126
|
-
__webpack_require__.d(__webpack_exports__, "
|
|
127
|
-
__webpack_require__.d(__webpack_exports__, "
|
|
128
|
-
__webpack_require__.d(__webpack_exports__, "
|
|
106
|
+
__webpack_require__.d(__webpack_exports__, "utils", function() { return /* reexport */ utils; });
|
|
107
|
+
__webpack_require__.d(__webpack_exports__, "variables", function() { return /* reexport */ export_default.a; });
|
|
108
|
+
__webpack_require__.d(__webpack_exports__, "getConfig", function() { return /* reexport */ src_getConfig; });
|
|
109
|
+
__webpack_require__.d(__webpack_exports__, "setConfig", function() { return /* reexport */ src_setConfig; });
|
|
110
|
+
__webpack_require__.d(__webpack_exports__, "setTheme", function() { return /* reexport */ src_setTheme; });
|
|
111
|
+
__webpack_require__.d(__webpack_exports__, "setSize", function() { return /* reexport */ src_setSize; });
|
|
112
|
+
__webpack_require__.d(__webpack_exports__, "setPrimaryColor", function() { return /* reexport */ src_setPrimaryColor; });
|
|
113
|
+
__webpack_require__.d(__webpack_exports__, "getTheme", function() { return /* reexport */ src_getTheme; });
|
|
114
|
+
__webpack_require__.d(__webpack_exports__, "getSize", function() { return /* reexport */ src_getSize; });
|
|
115
|
+
__webpack_require__.d(__webpack_exports__, "getPrimaryColor", function() { return /* reexport */ src_getPrimaryColor; });
|
|
116
|
+
__webpack_require__.d(__webpack_exports__, "resetConfig", function() { return /* reexport */ src_resetConfig; });
|
|
117
|
+
__webpack_require__.d(__webpack_exports__, "onConfigChange", function() { return /* reexport */ src_onConfigChange; });
|
|
129
118
|
|
|
130
119
|
// CONCATENATED MODULE: ./node_modules/@vue/cli-service/lib/commands/build/setPublicPath.js
|
|
131
120
|
// This file is imported into lib/wc client bundles.
|
|
@@ -143,18 +132,136 @@ if (typeof window !== 'undefined') {
|
|
|
143
132
|
// Indicate to webpack that this file can be concatenated
|
|
144
133
|
/* harmony default export */ var setPublicPath = (null);
|
|
145
134
|
|
|
146
|
-
// EXTERNAL MODULE:
|
|
147
|
-
var
|
|
148
|
-
var
|
|
149
|
-
|
|
150
|
-
// EXTERNAL MODULE: external "ElementUI"
|
|
151
|
-
var external_ElementUI_ = __webpack_require__("5f72");
|
|
152
|
-
var external_ElementUI_default = /*#__PURE__*/__webpack_require__.n(external_ElementUI_);
|
|
135
|
+
// EXTERNAL MODULE: ./src/styles/export.scss
|
|
136
|
+
var styles_export = __webpack_require__("27fd");
|
|
137
|
+
var export_default = /*#__PURE__*/__webpack_require__.n(styles_export);
|
|
153
138
|
|
|
154
|
-
//
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
139
|
+
// CONCATENATED MODULE: ./src/utils/index.js
|
|
140
|
+
|
|
141
|
+
// 默认配置
|
|
142
|
+
const defaultConfig = {
|
|
143
|
+
theme: 'light',
|
|
144
|
+
size: 'medium',
|
|
145
|
+
primaryColor: '#1890ff'
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
// 当前配置
|
|
149
|
+
let currentConfig = { ...defaultConfig }
|
|
150
|
+
|
|
151
|
+
// 配置变更事件处理
|
|
152
|
+
const configChangeListeners = []
|
|
153
|
+
|
|
154
|
+
const emitConfigChange = function(key, value) {
|
|
155
|
+
configChangeListeners.forEach(listener => {
|
|
156
|
+
listener(key, value)
|
|
157
|
+
})
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
// 获取所有配置
|
|
161
|
+
const getConfig = function() {
|
|
162
|
+
return { ...currentConfig }
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
// 设置全局配置
|
|
166
|
+
const setConfig = function(config) {
|
|
167
|
+
if (typeof config !== 'object' || config === null) {
|
|
168
|
+
console.warn('[XtElementUI] setConfig 必须传入对象参数')
|
|
169
|
+
return
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
if (config.theme !== undefined) {
|
|
173
|
+
setTheme(config.theme)
|
|
174
|
+
}
|
|
175
|
+
if (config.size !== undefined) {
|
|
176
|
+
setSize(config.size)
|
|
177
|
+
}
|
|
178
|
+
if (config.primaryColor !== undefined) {
|
|
179
|
+
setPrimaryColor(config.primaryColor)
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
|
|
184
|
+
// 设置主题
|
|
185
|
+
const setTheme = function(theme) {
|
|
186
|
+
const validThemes = ['light', 'dark', 'compact']
|
|
187
|
+
if (!validThemes.includes(theme)) {
|
|
188
|
+
console.warn(`[XtElementUI] 无效的主题值: ${theme},可选值: ${validThemes.join(', ')}`)
|
|
189
|
+
return
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
currentConfig.theme = theme
|
|
193
|
+
document.documentElement.setAttribute('data-theme', theme)
|
|
194
|
+
emitConfigChange('theme', theme)
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
// 设置字体大小
|
|
198
|
+
const setSize = function(size) {
|
|
199
|
+
const validSizes = ['small', 'medium', 'large']
|
|
200
|
+
if (!validSizes.includes(size)) {
|
|
201
|
+
console.warn(`[XtElementUI] 无效的大小值: ${size},可选值: ${validSizes.join(', ')}`)
|
|
202
|
+
return
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
currentConfig.size = size
|
|
206
|
+
document.documentElement.setAttribute('data-size', size)
|
|
207
|
+
emitConfigChange('size', size)
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
// 设置主色调
|
|
211
|
+
const setPrimaryColor = function(color) {
|
|
212
|
+
// 简单的颜色格式验证
|
|
213
|
+
const colorRegex = /^#[0-9A-Fa-f]{6}$|^#[0-9A-Fa-f]{3}$/
|
|
214
|
+
if (!colorRegex.test(color)) {
|
|
215
|
+
console.warn(`[XtElementUI] 无效的颜色值: ${color},请使用十六进制颜色格式,如 #1890ff`)
|
|
216
|
+
return
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
currentConfig.primaryColor = color
|
|
220
|
+
document.documentElement.style.setProperty('--xt-color-primary', color)
|
|
221
|
+
emitConfigChange('primaryColor', color)
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
// 获取当前主题
|
|
225
|
+
const getTheme = function() {
|
|
226
|
+
return currentConfig.theme
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
// 获取当前字体大小
|
|
230
|
+
const getSize = function() {
|
|
231
|
+
return currentConfig.size
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
// 获取当前主色调
|
|
235
|
+
const getPrimaryColor = function() {
|
|
236
|
+
return currentConfig.primaryColor
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
// 重置为默认配置
|
|
240
|
+
const resetConfig = function() {
|
|
241
|
+
setConfig(defaultConfig)
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
// 监听配置变更
|
|
245
|
+
const onConfigChange = function(listener) {
|
|
246
|
+
if (typeof listener === 'function') {
|
|
247
|
+
configChangeListeners.push(listener)
|
|
248
|
+
return function() {
|
|
249
|
+
const index = configChangeListeners.indexOf(listener)
|
|
250
|
+
if (index > -1) {
|
|
251
|
+
configChangeListeners.splice(index, 1)
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
} else {
|
|
255
|
+
console.warn('[XtElementUI] onConfigChange 必须传入函数')
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
/* harmony default export */ var utils = ({
|
|
260
|
+
setTheme,
|
|
261
|
+
setSize,
|
|
262
|
+
setPrimaryColor
|
|
263
|
+
});
|
|
264
|
+
// CONCATENATED MODULE: ./node_modules/cache-loader/dist/cjs.js?{"cacheDirectory":"node_modules/.cache/vue-loader","cacheIdentifier":"a978fd84-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=0ad9d4c9
|
|
158
265
|
var render = function render(){var _vm=this,_c=_vm._self._c;return _c('el-button',{on:{"click":_vm.handleClick}},[_vm._t("default")],2)
|
|
159
266
|
}
|
|
160
267
|
var staticRenderFns = []
|
|
@@ -296,7 +403,7 @@ var component = normalizeComponent(
|
|
|
296
403
|
// CONCATENATED MODULE: ./src/components/button/index.js
|
|
297
404
|
|
|
298
405
|
/* harmony default export */ var src_components_button = (components_button);
|
|
299
|
-
// CONCATENATED MODULE: ./node_modules/cache-loader/dist/cjs.js?{"cacheDirectory":"node_modules/.cache/vue-loader","cacheIdentifier":"
|
|
406
|
+
// CONCATENATED MODULE: ./node_modules/cache-loader/dist/cjs.js?{"cacheDirectory":"node_modules/.cache/vue-loader","cacheIdentifier":"a978fd84-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=fe9146e4
|
|
300
407
|
var inputvue_type_template_id_fe9146e4_render = function render(){var _vm=this,_c=_vm._self._c;return _c('el-input',{attrs:{"value":_vm.value,"placeholder":_vm.placeholder},on:{"input":function($event){return _vm.$emit('input', $event)}}})
|
|
301
408
|
}
|
|
302
409
|
var inputvue_type_template_id_fe9146e4_staticRenderFns = []
|
|
@@ -343,15 +450,8 @@ var input_component = normalizeComponent(
|
|
|
343
450
|
|
|
344
451
|
/* harmony default export */ var components_input = (input);
|
|
345
452
|
// CONCATENATED MODULE: ./src/index.js
|
|
346
|
-
// 导入
|
|
347
|
-
|
|
453
|
+
// 导入 SCSS 变量(通过 CSS Modules :export 导出)
|
|
348
454
|
|
|
349
|
-
// 在导入 Element UI 之前,先将 Vue 设置为全局变量
|
|
350
|
-
if (typeof window !== 'undefined') {
|
|
351
|
-
window.Vue = external_Vue_default.a
|
|
352
|
-
}
|
|
353
|
-
|
|
354
|
-
// 导入 Element UI 并注册
|
|
355
455
|
|
|
356
456
|
|
|
357
457
|
|
|
@@ -366,9 +466,6 @@ const components = [
|
|
|
366
466
|
]
|
|
367
467
|
|
|
368
468
|
|
|
369
|
-
// 注册 Element UI
|
|
370
|
-
external_Vue_default.a.use(external_ElementUI_default.a)
|
|
371
|
-
|
|
372
469
|
// 定义 install 方法,Vue.use() 会自动调用
|
|
373
470
|
const install = function (Vue) {
|
|
374
471
|
if (install.installed) return
|
|
@@ -378,6 +475,7 @@ const install = function (Vue) {
|
|
|
378
475
|
components.forEach(component => {
|
|
379
476
|
Vue.component(component.name, component)
|
|
380
477
|
})
|
|
478
|
+
Vue.prototype.$utils = utils
|
|
381
479
|
}
|
|
382
480
|
|
|
383
481
|
// 支持全局 script 标签引入
|
|
@@ -393,117 +491,118 @@ if (typeof window !== 'undefined' && window.Vue) {
|
|
|
393
491
|
Input: components_input
|
|
394
492
|
});
|
|
395
493
|
|
|
494
|
+
// 导出工具函数和变量
|
|
495
|
+
|
|
396
496
|
|
|
397
497
|
// 默认配置
|
|
398
|
-
const
|
|
498
|
+
const src_defaultConfig = {
|
|
399
499
|
theme: 'light',
|
|
400
500
|
size: 'medium',
|
|
401
501
|
primaryColor: '#1890ff'
|
|
402
502
|
}
|
|
403
503
|
|
|
404
504
|
// 当前配置
|
|
405
|
-
let
|
|
505
|
+
let src_currentConfig = { ...src_defaultConfig }
|
|
406
506
|
|
|
407
507
|
// 配置变更事件处理
|
|
408
|
-
const
|
|
508
|
+
const src_configChangeListeners = []
|
|
409
509
|
|
|
410
|
-
const
|
|
411
|
-
|
|
510
|
+
const src_emitConfigChange = function(key, value) {
|
|
511
|
+
src_configChangeListeners.forEach(listener => {
|
|
412
512
|
listener(key, value)
|
|
413
513
|
})
|
|
414
514
|
}
|
|
415
515
|
|
|
416
516
|
// 获取所有配置
|
|
417
|
-
const
|
|
418
|
-
return { ...
|
|
517
|
+
const src_getConfig = function() {
|
|
518
|
+
return { ...src_currentConfig }
|
|
419
519
|
}
|
|
420
520
|
|
|
421
521
|
// 设置全局配置
|
|
422
|
-
const
|
|
522
|
+
const src_setConfig = function(config) {
|
|
423
523
|
if (typeof config !== 'object' || config === null) {
|
|
424
524
|
console.warn('[XtElementUI] setConfig 必须传入对象参数')
|
|
425
525
|
return
|
|
426
526
|
}
|
|
427
527
|
|
|
428
528
|
if (config.theme !== undefined) {
|
|
429
|
-
|
|
529
|
+
src_setTheme(config.theme)
|
|
430
530
|
}
|
|
431
531
|
if (config.size !== undefined) {
|
|
432
|
-
|
|
532
|
+
src_setSize(config.size)
|
|
433
533
|
}
|
|
434
534
|
if (config.primaryColor !== undefined) {
|
|
435
|
-
|
|
535
|
+
src_setPrimaryColor(config.primaryColor)
|
|
436
536
|
}
|
|
437
537
|
}
|
|
438
538
|
|
|
439
|
-
//
|
|
440
|
-
const
|
|
441
|
-
const validThemes = ['light', 'dark'
|
|
539
|
+
// 设置主题(只控制颜色)
|
|
540
|
+
const src_setTheme = function(theme) {
|
|
541
|
+
const validThemes = ['light', 'dark']
|
|
442
542
|
if (!validThemes.includes(theme)) {
|
|
443
543
|
console.warn(`[XtElementUI] 无效的主题值: ${theme},可选值: ${validThemes.join(', ')}`)
|
|
444
544
|
return
|
|
445
545
|
}
|
|
446
546
|
|
|
447
|
-
|
|
547
|
+
src_currentConfig.theme = theme
|
|
448
548
|
document.documentElement.setAttribute('data-theme', theme)
|
|
449
|
-
|
|
549
|
+
src_emitConfigChange('theme', theme)
|
|
450
550
|
}
|
|
451
551
|
|
|
452
|
-
//
|
|
453
|
-
const
|
|
552
|
+
// 设置字体大小和间距
|
|
553
|
+
const src_setSize = function(size) {
|
|
454
554
|
const validSizes = ['small', 'medium', 'large']
|
|
455
555
|
if (!validSizes.includes(size)) {
|
|
456
556
|
console.warn(`[XtElementUI] 无效的大小值: ${size},可选值: ${validSizes.join(', ')}`)
|
|
457
557
|
return
|
|
458
558
|
}
|
|
459
559
|
|
|
460
|
-
|
|
560
|
+
src_currentConfig.size = size
|
|
461
561
|
document.documentElement.setAttribute('data-size', size)
|
|
462
|
-
|
|
562
|
+
src_emitConfigChange('size', size)
|
|
463
563
|
}
|
|
464
564
|
|
|
465
565
|
// 设置主色调
|
|
466
|
-
const
|
|
467
|
-
// 简单的颜色格式验证
|
|
566
|
+
const src_setPrimaryColor = function(color) {
|
|
468
567
|
const colorRegex = /^#[0-9A-Fa-f]{6}$|^#[0-9A-Fa-f]{3}$/
|
|
469
568
|
if (!colorRegex.test(color)) {
|
|
470
569
|
console.warn(`[XtElementUI] 无效的颜色值: ${color},请使用十六进制颜色格式,如 #1890ff`)
|
|
471
570
|
return
|
|
472
571
|
}
|
|
473
572
|
|
|
474
|
-
|
|
573
|
+
src_currentConfig.primaryColor = color
|
|
475
574
|
document.documentElement.style.setProperty('--xt-color-primary', color)
|
|
476
|
-
|
|
575
|
+
src_emitConfigChange('primaryColor', color)
|
|
477
576
|
}
|
|
478
577
|
|
|
479
578
|
// 获取当前主题
|
|
480
|
-
const
|
|
481
|
-
return
|
|
579
|
+
const src_getTheme = function() {
|
|
580
|
+
return src_currentConfig.theme
|
|
482
581
|
}
|
|
483
582
|
|
|
484
583
|
// 获取当前字体大小
|
|
485
|
-
const
|
|
486
|
-
return
|
|
584
|
+
const src_getSize = function() {
|
|
585
|
+
return src_currentConfig.size
|
|
487
586
|
}
|
|
488
587
|
|
|
489
588
|
// 获取当前主色调
|
|
490
|
-
const
|
|
491
|
-
return
|
|
589
|
+
const src_getPrimaryColor = function() {
|
|
590
|
+
return src_currentConfig.primaryColor
|
|
492
591
|
}
|
|
493
592
|
|
|
494
593
|
// 重置为默认配置
|
|
495
|
-
const
|
|
496
|
-
|
|
594
|
+
const src_resetConfig = function() {
|
|
595
|
+
src_setConfig(src_defaultConfig)
|
|
497
596
|
}
|
|
498
597
|
|
|
499
598
|
// 监听配置变更
|
|
500
|
-
const
|
|
599
|
+
const src_onConfigChange = function(listener) {
|
|
501
600
|
if (typeof listener === 'function') {
|
|
502
|
-
|
|
601
|
+
src_configChangeListeners.push(listener)
|
|
503
602
|
return function() {
|
|
504
|
-
const index =
|
|
603
|
+
const index = src_configChangeListeners.indexOf(listener)
|
|
505
604
|
if (index > -1) {
|
|
506
|
-
|
|
605
|
+
src_configChangeListeners.splice(index, 1)
|
|
507
606
|
}
|
|
508
607
|
}
|
|
509
608
|
} else {
|