xt-element-ui 1.0.0 → 1.0.2
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/fonts/element-icons.f1a45d74.ttf +0 -0
- package/lib/fonts/element-icons.ff18efd1.woff +0 -0
- package/lib/index.common.js +226 -23
- package/lib/index.css +1 -0
- package/lib/index.umd.js +272 -30
- package/lib/index.umd.min.js +1 -1
- package/package.json +16 -6
- package/src/components/button/index.js +2 -0
- package/src/components/button/index.vue +14 -0
- package/src/components/input/index.js +2 -0
- package/src/components/input/index.vue +20 -0
- package/src/index.js +141 -5
- package/src/components/Button.vue +0 -1
- package/src/components/Input.vue +0 -1
- package/vue.config.js +0 -41
|
Binary file
|
|
Binary file
|
package/lib/index.common.js
CHANGED
|
@@ -4,6 +4,18 @@
|
|
|
4
4
|
/******/ var __webpack_require__ = {};
|
|
5
5
|
/******/
|
|
6
6
|
/************************************************************************/
|
|
7
|
+
/******/ /* webpack/runtime/compat get default export */
|
|
8
|
+
/******/ (() => {
|
|
9
|
+
/******/ // getDefaultExport function for compatibility with non-harmony modules
|
|
10
|
+
/******/ __webpack_require__.n = (module) => {
|
|
11
|
+
/******/ var getter = module && module.__esModule ?
|
|
12
|
+
/******/ () => (module['default']) :
|
|
13
|
+
/******/ () => (module);
|
|
14
|
+
/******/ __webpack_require__.d(getter, { a: getter });
|
|
15
|
+
/******/ return getter;
|
|
16
|
+
/******/ };
|
|
17
|
+
/******/ })();
|
|
18
|
+
/******/
|
|
7
19
|
/******/ /* webpack/runtime/define property getters */
|
|
8
20
|
/******/ (() => {
|
|
9
21
|
/******/ // define getter functions for harmony exports
|
|
@@ -44,7 +56,19 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
44
56
|
|
|
45
57
|
// EXPORTS
|
|
46
58
|
__webpack_require__.d(__webpack_exports__, {
|
|
47
|
-
|
|
59
|
+
ElementUI: () => (/* reexport */ (external_ElementUI_default())),
|
|
60
|
+
Vue: () => (/* reexport */ (external_Vue_default())),
|
|
61
|
+
"default": () => (/* binding */ entry_lib),
|
|
62
|
+
getConfig: () => (/* reexport */ getConfig),
|
|
63
|
+
getPrimaryColor: () => (/* reexport */ getPrimaryColor),
|
|
64
|
+
getSize: () => (/* reexport */ getSize),
|
|
65
|
+
getTheme: () => (/* reexport */ getTheme),
|
|
66
|
+
onConfigChange: () => (/* reexport */ onConfigChange),
|
|
67
|
+
resetConfig: () => (/* reexport */ resetConfig),
|
|
68
|
+
setConfig: () => (/* reexport */ setConfig),
|
|
69
|
+
setPrimaryColor: () => (/* reexport */ setPrimaryColor),
|
|
70
|
+
setSize: () => (/* reexport */ setSize),
|
|
71
|
+
setTheme: () => (/* reexport */ setTheme)
|
|
48
72
|
});
|
|
49
73
|
|
|
50
74
|
;// ./node_modules/@vue/cli-service/lib/commands/build/setPublicPath.js
|
|
@@ -65,12 +89,32 @@ if (typeof window !== 'undefined') {
|
|
|
65
89
|
// Indicate to webpack that this file can be concatenated
|
|
66
90
|
/* harmony default export */ const setPublicPath = (null);
|
|
67
91
|
|
|
68
|
-
;//
|
|
69
|
-
|
|
92
|
+
;// external "Vue"
|
|
93
|
+
const external_Vue_namespaceObject = require("Vue");
|
|
94
|
+
var external_Vue_default = /*#__PURE__*/__webpack_require__.n(external_Vue_namespaceObject);
|
|
95
|
+
;// external "ElementUI"
|
|
96
|
+
const external_ElementUI_namespaceObject = require("ElementUI");
|
|
97
|
+
var external_ElementUI_default = /*#__PURE__*/__webpack_require__.n(external_ElementUI_namespaceObject);
|
|
98
|
+
;// ./node_modules/@vue/vue-loader-v15/lib/loaders/templateLoader.js??ruleSet[1].rules[2]!./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./src/components/button/index.vue?vue&type=template&id=55650f2e
|
|
99
|
+
var render = function render(){var _vm=this,_c=_vm._self._c;return _c('el-button',{on:{"click":_vm.handleClick}},[_vm._v(_vm._s(_vm.text))])
|
|
70
100
|
}
|
|
71
101
|
var staticRenderFns = []
|
|
72
102
|
|
|
73
103
|
|
|
104
|
+
;// ./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./src/components/button/index.vue?vue&type=script&lang=js
|
|
105
|
+
|
|
106
|
+
/* harmony default export */ const buttonvue_type_script_lang_js = ({
|
|
107
|
+
props:['text'],
|
|
108
|
+
name: 'XtButton',
|
|
109
|
+
methods:{
|
|
110
|
+
handleClick(){
|
|
111
|
+
this.$emit('click')
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
});
|
|
115
|
+
|
|
116
|
+
;// ./src/components/button/index.vue?vue&type=script&lang=js
|
|
117
|
+
/* harmony default export */ const components_buttonvue_type_script_lang_js = (buttonvue_type_script_lang_js);
|
|
74
118
|
;// ./node_modules/@vue/vue-loader-v15/lib/runtime/componentNormalizer.js
|
|
75
119
|
/* globals __VUE_SSR_CONTEXT__ */
|
|
76
120
|
|
|
@@ -169,15 +213,16 @@ function normalizeComponent(
|
|
|
169
213
|
}
|
|
170
214
|
}
|
|
171
215
|
|
|
172
|
-
;// ./src/components/
|
|
216
|
+
;// ./src/components/button/index.vue
|
|
217
|
+
|
|
218
|
+
|
|
173
219
|
|
|
174
|
-
var script = {}
|
|
175
220
|
|
|
176
221
|
|
|
177
222
|
/* normalize component */
|
|
178
223
|
;
|
|
179
224
|
var component = normalizeComponent(
|
|
180
|
-
|
|
225
|
+
components_buttonvue_type_script_lang_js,
|
|
181
226
|
render,
|
|
182
227
|
staticRenderFns,
|
|
183
228
|
false,
|
|
@@ -187,24 +232,43 @@ var component = normalizeComponent(
|
|
|
187
232
|
|
|
188
233
|
)
|
|
189
234
|
|
|
190
|
-
/* harmony default export */ const
|
|
191
|
-
;// ./
|
|
192
|
-
|
|
235
|
+
/* harmony default export */ const components_button = (component.exports);
|
|
236
|
+
;// ./src/components/button/index.js
|
|
237
|
+
|
|
238
|
+
/* harmony default export */ const src_components_button = (components_button);
|
|
239
|
+
;// ./node_modules/@vue/vue-loader-v15/lib/loaders/templateLoader.js??ruleSet[1].rules[2]!./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./src/components/input/index.vue?vue&type=template&id=fe9146e4
|
|
240
|
+
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)}}})
|
|
193
241
|
}
|
|
194
|
-
var
|
|
242
|
+
var inputvue_type_template_id_fe9146e4_staticRenderFns = []
|
|
243
|
+
|
|
244
|
+
|
|
245
|
+
;// ./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./src/components/input/index.vue?vue&type=script&lang=js
|
|
246
|
+
|
|
247
|
+
/* harmony default export */ const inputvue_type_script_lang_js = ({
|
|
248
|
+
name: 'XtInput',
|
|
249
|
+
props: {
|
|
250
|
+
value: [String, Number],
|
|
251
|
+
placeholder: {
|
|
252
|
+
type: String,
|
|
253
|
+
default: '请输入内容'
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
});
|
|
257
|
+
|
|
258
|
+
;// ./src/components/input/index.vue?vue&type=script&lang=js
|
|
259
|
+
/* harmony default export */ const components_inputvue_type_script_lang_js = (inputvue_type_script_lang_js);
|
|
260
|
+
;// ./src/components/input/index.vue
|
|
195
261
|
|
|
196
262
|
|
|
197
|
-
;// ./src/components/Input.vue
|
|
198
263
|
|
|
199
|
-
var Input_script = {}
|
|
200
264
|
|
|
201
265
|
|
|
202
266
|
/* normalize component */
|
|
203
267
|
;
|
|
204
|
-
var
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
268
|
+
var input_component = normalizeComponent(
|
|
269
|
+
components_inputvue_type_script_lang_js,
|
|
270
|
+
inputvue_type_template_id_fe9146e4_render,
|
|
271
|
+
inputvue_type_template_id_fe9146e4_staticRenderFns,
|
|
208
272
|
false,
|
|
209
273
|
null,
|
|
210
274
|
null,
|
|
@@ -212,17 +276,31 @@ var Input_component = normalizeComponent(
|
|
|
212
276
|
|
|
213
277
|
)
|
|
214
278
|
|
|
215
|
-
/* harmony default export */ const
|
|
279
|
+
/* harmony default export */ const input = (input_component.exports);
|
|
280
|
+
;// ./src/components/input/index.js
|
|
281
|
+
|
|
282
|
+
/* harmony default export */ const components_input = (input);
|
|
216
283
|
;// ./src/index.js
|
|
284
|
+
// 导入 Vue
|
|
285
|
+
|
|
286
|
+
|
|
287
|
+
// 在导入 Element UI 之前,先将 Vue 设置为全局变量
|
|
288
|
+
if (typeof window !== 'undefined') {
|
|
289
|
+
window.Vue = (external_Vue_default())
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
// 导入 Element UI 并注册
|
|
293
|
+
|
|
294
|
+
|
|
295
|
+
|
|
217
296
|
// 导入组件
|
|
218
297
|
|
|
219
298
|
|
|
220
|
-
// ...其他组件
|
|
221
299
|
|
|
222
300
|
// 存储组件列表
|
|
223
301
|
const components = [
|
|
224
|
-
|
|
225
|
-
|
|
302
|
+
src_components_button,
|
|
303
|
+
components_input
|
|
226
304
|
]
|
|
227
305
|
|
|
228
306
|
// 定义 install 方法,Vue.use() 会自动调用
|
|
@@ -230,7 +308,10 @@ const install = function (Vue) {
|
|
|
230
308
|
if (install.installed) return
|
|
231
309
|
install.installed = true
|
|
232
310
|
|
|
233
|
-
//
|
|
311
|
+
// 注册 Element UI
|
|
312
|
+
Vue.use((external_ElementUI_default()))
|
|
313
|
+
|
|
314
|
+
// 全局注册所有 xt- 组件
|
|
234
315
|
components.forEach(component => {
|
|
235
316
|
Vue.component(component.name, component)
|
|
236
317
|
})
|
|
@@ -245,9 +326,131 @@ if (typeof window !== 'undefined' && window.Vue) {
|
|
|
245
326
|
/* harmony default export */ const src_0 = ({
|
|
246
327
|
install,
|
|
247
328
|
// 按需导出组件
|
|
248
|
-
Button:
|
|
249
|
-
Input:
|
|
329
|
+
Button: src_components_button,
|
|
330
|
+
Input: components_input,
|
|
331
|
+
// 导出 ElementUI 以便用户按需引入
|
|
332
|
+
ElementUI: (external_ElementUI_default())
|
|
250
333
|
});
|
|
334
|
+
|
|
335
|
+
// 导出 Vue 和 ElementUI 以便用户使用
|
|
336
|
+
|
|
337
|
+
|
|
338
|
+
// 默认配置
|
|
339
|
+
const defaultConfig = {
|
|
340
|
+
theme: 'light',
|
|
341
|
+
size: 'medium',
|
|
342
|
+
primaryColor: '#1890ff'
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
// 当前配置
|
|
346
|
+
let currentConfig = { ...defaultConfig }
|
|
347
|
+
|
|
348
|
+
// 配置变更事件处理
|
|
349
|
+
const configChangeListeners = []
|
|
350
|
+
|
|
351
|
+
const emitConfigChange = function(key, value) {
|
|
352
|
+
configChangeListeners.forEach(listener => {
|
|
353
|
+
listener(key, value)
|
|
354
|
+
})
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
// 获取所有配置
|
|
358
|
+
const getConfig = function() {
|
|
359
|
+
return { ...currentConfig }
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
// 设置全局配置
|
|
363
|
+
const setConfig = function(config) {
|
|
364
|
+
if (typeof config !== 'object' || config === null) {
|
|
365
|
+
console.warn('[XtElementUI] setConfig 必须传入对象参数')
|
|
366
|
+
return
|
|
367
|
+
}
|
|
368
|
+
|
|
369
|
+
if (config.theme !== undefined) {
|
|
370
|
+
setTheme(config.theme)
|
|
371
|
+
}
|
|
372
|
+
if (config.size !== undefined) {
|
|
373
|
+
setSize(config.size)
|
|
374
|
+
}
|
|
375
|
+
if (config.primaryColor !== undefined) {
|
|
376
|
+
setPrimaryColor(config.primaryColor)
|
|
377
|
+
}
|
|
378
|
+
}
|
|
379
|
+
|
|
380
|
+
// 设置主题
|
|
381
|
+
const setTheme = function(theme) {
|
|
382
|
+
const validThemes = ['light', 'dark', 'compact']
|
|
383
|
+
if (!validThemes.includes(theme)) {
|
|
384
|
+
console.warn(`[XtElementUI] 无效的主题值: ${theme},可选值: ${validThemes.join(', ')}`)
|
|
385
|
+
return
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
currentConfig.theme = theme
|
|
389
|
+
document.documentElement.setAttribute('data-theme', theme)
|
|
390
|
+
emitConfigChange('theme', theme)
|
|
391
|
+
}
|
|
392
|
+
|
|
393
|
+
// 设置字体大小
|
|
394
|
+
const setSize = function(size) {
|
|
395
|
+
const validSizes = ['small', 'medium', 'large']
|
|
396
|
+
if (!validSizes.includes(size)) {
|
|
397
|
+
console.warn(`[XtElementUI] 无效的大小值: ${size},可选值: ${validSizes.join(', ')}`)
|
|
398
|
+
return
|
|
399
|
+
}
|
|
400
|
+
|
|
401
|
+
currentConfig.size = size
|
|
402
|
+
document.documentElement.setAttribute('data-size', size)
|
|
403
|
+
emitConfigChange('size', size)
|
|
404
|
+
}
|
|
405
|
+
|
|
406
|
+
// 设置主色调
|
|
407
|
+
const setPrimaryColor = function(color) {
|
|
408
|
+
// 简单的颜色格式验证
|
|
409
|
+
const colorRegex = /^#[0-9A-Fa-f]{6}$|^#[0-9A-Fa-f]{3}$/
|
|
410
|
+
if (!colorRegex.test(color)) {
|
|
411
|
+
console.warn(`[XtElementUI] 无效的颜色值: ${color},请使用十六进制颜色格式,如 #1890ff`)
|
|
412
|
+
return
|
|
413
|
+
}
|
|
414
|
+
|
|
415
|
+
currentConfig.primaryColor = color
|
|
416
|
+
document.documentElement.style.setProperty('--xt-color-primary', color)
|
|
417
|
+
emitConfigChange('primaryColor', color)
|
|
418
|
+
}
|
|
419
|
+
|
|
420
|
+
// 获取当前主题
|
|
421
|
+
const getTheme = function() {
|
|
422
|
+
return currentConfig.theme
|
|
423
|
+
}
|
|
424
|
+
|
|
425
|
+
// 获取当前字体大小
|
|
426
|
+
const getSize = function() {
|
|
427
|
+
return currentConfig.size
|
|
428
|
+
}
|
|
429
|
+
|
|
430
|
+
// 获取当前主色调
|
|
431
|
+
const getPrimaryColor = function() {
|
|
432
|
+
return currentConfig.primaryColor
|
|
433
|
+
}
|
|
434
|
+
|
|
435
|
+
// 重置为默认配置
|
|
436
|
+
const resetConfig = function() {
|
|
437
|
+
setConfig(defaultConfig)
|
|
438
|
+
}
|
|
439
|
+
|
|
440
|
+
// 监听配置变更
|
|
441
|
+
const onConfigChange = function(listener) {
|
|
442
|
+
if (typeof listener === 'function') {
|
|
443
|
+
configChangeListeners.push(listener)
|
|
444
|
+
return function() {
|
|
445
|
+
const index = configChangeListeners.indexOf(listener)
|
|
446
|
+
if (index > -1) {
|
|
447
|
+
configChangeListeners.splice(index, 1)
|
|
448
|
+
}
|
|
449
|
+
}
|
|
450
|
+
} else {
|
|
451
|
+
console.warn('[XtElementUI] onConfigChange 必须传入函数')
|
|
452
|
+
}
|
|
453
|
+
}
|
|
251
454
|
;// ./node_modules/@vue/cli-service/lib/commands/build/entry-lib.js
|
|
252
455
|
|
|
253
456
|
|