xt-element-ui 1.0.1 → 1.0.3
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/demo.html +10 -1
- package/lib/index.common.js +281 -113
- package/lib/index.css +1 -1
- package/lib/index.umd.js +265 -137
- package/lib/index.umd.min.js +1 -1
- package/package.json +15 -13
- package/src/index.js +106 -10
- package/docs/.vuepress/config.js +0 -23
- package/docs/.vuepress/enhanceApp.js +0 -8
- package/docs/README.md +0 -6
- package/docs/components/base/button.md +0 -5
- package/docs/components/base/input.md +0 -22
- package/examples/App.vue +0 -13
- package/examples/favicon.ico +0 -0
- package/examples/index.html +0 -11
- package/examples/main.js +0 -9
- package/vue.config.js +0 -46
- /package/lib/fonts/{element-icons.ff18efd1.woff → element-icons.535877f5.woff} +0 -0
- /package/lib/fonts/{element-icons.f1a45d74.ttf → element-icons.732389de.ttf} +0 -0
package/lib/demo.html
CHANGED
|
@@ -1 +1,10 @@
|
|
|
1
|
-
|
|
1
|
+
<meta charset="utf-8">
|
|
2
|
+
<title>index demo</title>
|
|
3
|
+
<script src="./index.umd.js"></script>
|
|
4
|
+
|
|
5
|
+
<link rel="stylesheet" href="./index.css">
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
<script>
|
|
9
|
+
console.log(index)
|
|
10
|
+
</script>
|
package/lib/index.common.js
CHANGED
|
@@ -1,78 +1,140 @@
|
|
|
1
|
-
|
|
2
|
-
/******/
|
|
3
|
-
/******/ // The
|
|
4
|
-
/******/ var
|
|
5
|
-
/******/
|
|
6
|
-
|
|
7
|
-
/******/
|
|
8
|
-
/******/
|
|
9
|
-
/******/ //
|
|
10
|
-
/******/
|
|
11
|
-
/******/
|
|
12
|
-
/******/
|
|
13
|
-
/******/
|
|
14
|
-
/******/
|
|
15
|
-
/******/
|
|
16
|
-
/******/
|
|
17
|
-
/******/
|
|
18
|
-
/******/
|
|
19
|
-
/******/ /* webpack/runtime/define property getters */
|
|
20
|
-
/******/ (() => {
|
|
21
|
-
/******/ // define getter functions for harmony exports
|
|
22
|
-
/******/ __webpack_require__.d = (exports, definition) => {
|
|
23
|
-
/******/ for(var key in definition) {
|
|
24
|
-
/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
|
|
25
|
-
/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
|
|
26
|
-
/******/ }
|
|
27
|
-
/******/ }
|
|
1
|
+
module.exports =
|
|
2
|
+
/******/ (function(modules) { // webpackBootstrap
|
|
3
|
+
/******/ // The module cache
|
|
4
|
+
/******/ var installedModules = {};
|
|
5
|
+
/******/
|
|
6
|
+
/******/ // The require function
|
|
7
|
+
/******/ function __webpack_require__(moduleId) {
|
|
8
|
+
/******/
|
|
9
|
+
/******/ // Check if module is in cache
|
|
10
|
+
/******/ if(installedModules[moduleId]) {
|
|
11
|
+
/******/ return installedModules[moduleId].exports;
|
|
12
|
+
/******/ }
|
|
13
|
+
/******/ // Create a new module (and put it into the cache)
|
|
14
|
+
/******/ var module = installedModules[moduleId] = {
|
|
15
|
+
/******/ i: moduleId,
|
|
16
|
+
/******/ l: false,
|
|
17
|
+
/******/ exports: {}
|
|
28
18
|
/******/ };
|
|
29
|
-
/******/
|
|
30
|
-
/******/
|
|
31
|
-
/******/
|
|
32
|
-
/******/
|
|
33
|
-
/******/
|
|
34
|
-
/******/
|
|
35
|
-
/******/
|
|
36
|
-
/******/
|
|
37
|
-
/******/
|
|
38
|
-
/******/
|
|
39
|
-
/******/
|
|
40
|
-
/******/
|
|
41
|
-
/******/
|
|
42
|
-
/******/
|
|
43
|
-
/******/
|
|
44
|
-
/******/
|
|
45
|
-
/******/
|
|
46
|
-
/******/
|
|
47
|
-
/******/
|
|
48
|
-
/******/ (
|
|
49
|
-
/******/ __webpack_require__.
|
|
50
|
-
/******/
|
|
51
|
-
/******/
|
|
19
|
+
/******/
|
|
20
|
+
/******/ // Execute the module function
|
|
21
|
+
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
|
|
22
|
+
/******/
|
|
23
|
+
/******/ // Flag the module as loaded
|
|
24
|
+
/******/ module.l = true;
|
|
25
|
+
/******/
|
|
26
|
+
/******/ // Return the exports of the module
|
|
27
|
+
/******/ return module.exports;
|
|
28
|
+
/******/ }
|
|
29
|
+
/******/
|
|
30
|
+
/******/
|
|
31
|
+
/******/ // expose the modules object (__webpack_modules__)
|
|
32
|
+
/******/ __webpack_require__.m = modules;
|
|
33
|
+
/******/
|
|
34
|
+
/******/ // expose the module cache
|
|
35
|
+
/******/ __webpack_require__.c = installedModules;
|
|
36
|
+
/******/
|
|
37
|
+
/******/ // define getter function for harmony exports
|
|
38
|
+
/******/ __webpack_require__.d = function(exports, name, getter) {
|
|
39
|
+
/******/ if(!__webpack_require__.o(exports, name)) {
|
|
40
|
+
/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
|
|
41
|
+
/******/ }
|
|
42
|
+
/******/ };
|
|
43
|
+
/******/
|
|
44
|
+
/******/ // define __esModule on exports
|
|
45
|
+
/******/ __webpack_require__.r = function(exports) {
|
|
46
|
+
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
|
|
47
|
+
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
48
|
+
/******/ }
|
|
49
|
+
/******/ Object.defineProperty(exports, '__esModule', { value: true });
|
|
50
|
+
/******/ };
|
|
51
|
+
/******/
|
|
52
|
+
/******/ // create a fake namespace object
|
|
53
|
+
/******/ // mode & 1: value is a module id, require it
|
|
54
|
+
/******/ // mode & 2: merge all properties of value into the ns
|
|
55
|
+
/******/ // mode & 4: return value when already ns object
|
|
56
|
+
/******/ // mode & 8|1: behave like require
|
|
57
|
+
/******/ __webpack_require__.t = function(value, mode) {
|
|
58
|
+
/******/ if(mode & 1) value = __webpack_require__(value);
|
|
59
|
+
/******/ if(mode & 8) return value;
|
|
60
|
+
/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
|
|
61
|
+
/******/ var ns = Object.create(null);
|
|
62
|
+
/******/ __webpack_require__.r(ns);
|
|
63
|
+
/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
|
|
64
|
+
/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
|
|
65
|
+
/******/ return ns;
|
|
66
|
+
/******/ };
|
|
67
|
+
/******/
|
|
68
|
+
/******/ // getDefaultExport function for compatibility with non-harmony modules
|
|
69
|
+
/******/ __webpack_require__.n = function(module) {
|
|
70
|
+
/******/ var getter = module && module.__esModule ?
|
|
71
|
+
/******/ function getDefault() { return module['default']; } :
|
|
72
|
+
/******/ function getModuleExports() { return module; };
|
|
73
|
+
/******/ __webpack_require__.d(getter, 'a', getter);
|
|
74
|
+
/******/ return getter;
|
|
75
|
+
/******/ };
|
|
76
|
+
/******/
|
|
77
|
+
/******/ // Object.prototype.hasOwnProperty.call
|
|
78
|
+
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
|
|
79
|
+
/******/
|
|
80
|
+
/******/ // __webpack_public_path__
|
|
81
|
+
/******/ __webpack_require__.p = "";
|
|
82
|
+
/******/
|
|
83
|
+
/******/
|
|
84
|
+
/******/ // Load entry module and return exports
|
|
85
|
+
/******/ return __webpack_require__(__webpack_require__.s = "fb15");
|
|
86
|
+
/******/ })
|
|
52
87
|
/************************************************************************/
|
|
53
|
-
|
|
88
|
+
/******/ ({
|
|
89
|
+
|
|
90
|
+
/***/ "0fae":
|
|
91
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
92
|
+
|
|
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");
|
|
108
|
+
|
|
109
|
+
/***/ }),
|
|
110
|
+
|
|
111
|
+
/***/ "fb15":
|
|
112
|
+
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
113
|
+
|
|
114
|
+
"use strict";
|
|
54
115
|
// ESM COMPAT FLAG
|
|
55
116
|
__webpack_require__.r(__webpack_exports__);
|
|
56
117
|
|
|
57
118
|
// EXPORTS
|
|
58
|
-
__webpack_require__.d(__webpack_exports__, {
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
});
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
/*
|
|
119
|
+
__webpack_require__.d(__webpack_exports__, "Vue", function() { return /* reexport */ external_Vue_default.a; });
|
|
120
|
+
__webpack_require__.d(__webpack_exports__, "ElementUI", function() { return /* reexport */ external_ElementUI_default.a; });
|
|
121
|
+
__webpack_require__.d(__webpack_exports__, "getConfig", function() { return /* reexport */ getConfig; });
|
|
122
|
+
__webpack_require__.d(__webpack_exports__, "setConfig", function() { return /* reexport */ setConfig; });
|
|
123
|
+
__webpack_require__.d(__webpack_exports__, "setTheme", function() { return /* reexport */ setTheme; });
|
|
124
|
+
__webpack_require__.d(__webpack_exports__, "setSize", function() { return /* reexport */ setSize; });
|
|
125
|
+
__webpack_require__.d(__webpack_exports__, "setPrimaryColor", function() { return /* reexport */ setPrimaryColor; });
|
|
126
|
+
__webpack_require__.d(__webpack_exports__, "getTheme", function() { return /* reexport */ getTheme; });
|
|
127
|
+
__webpack_require__.d(__webpack_exports__, "getSize", function() { return /* reexport */ getSize; });
|
|
128
|
+
__webpack_require__.d(__webpack_exports__, "getPrimaryColor", function() { return /* reexport */ getPrimaryColor; });
|
|
129
|
+
__webpack_require__.d(__webpack_exports__, "resetConfig", function() { return /* reexport */ resetConfig; });
|
|
130
|
+
__webpack_require__.d(__webpack_exports__, "onConfigChange", function() { return /* reexport */ onConfigChange; });
|
|
131
|
+
|
|
132
|
+
// CONCATENATED MODULE: ./node_modules/@vue/cli-service/lib/commands/build/setPublicPath.js
|
|
70
133
|
// This file is imported into lib/wc client bundles.
|
|
71
134
|
|
|
72
135
|
if (typeof window !== 'undefined') {
|
|
73
136
|
var currentScript = window.document.currentScript
|
|
74
|
-
if (false)
|
|
75
|
-
{ var getCurrentScript; }
|
|
137
|
+
if (false) { var getCurrentScript; }
|
|
76
138
|
|
|
77
139
|
var src = currentScript && currentScript.src.match(/(.+\/)[^/]+\.js(\?.*)?$/)
|
|
78
140
|
if (src) {
|
|
@@ -81,23 +143,30 @@ if (typeof window !== 'undefined') {
|
|
|
81
143
|
}
|
|
82
144
|
|
|
83
145
|
// Indicate to webpack that this file can be concatenated
|
|
84
|
-
/* harmony default export */
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
var external_Vue_default = /*#__PURE__*/__webpack_require__.n(
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
var
|
|
92
|
-
|
|
146
|
+
/* harmony default export */ var setPublicPath = (null);
|
|
147
|
+
|
|
148
|
+
// EXTERNAL MODULE: external "Vue"
|
|
149
|
+
var external_Vue_ = __webpack_require__("8bbf");
|
|
150
|
+
var external_Vue_default = /*#__PURE__*/__webpack_require__.n(external_Vue_);
|
|
151
|
+
|
|
152
|
+
// EXTERNAL MODULE: external "ElementUI"
|
|
153
|
+
var external_ElementUI_ = __webpack_require__("5f72");
|
|
154
|
+
var external_ElementUI_default = /*#__PURE__*/__webpack_require__.n(external_ElementUI_);
|
|
155
|
+
|
|
156
|
+
// EXTERNAL MODULE: ./node_modules/element-ui/lib/theme-chalk/index.css
|
|
157
|
+
var theme_chalk = __webpack_require__("0fae");
|
|
158
|
+
|
|
159
|
+
// CONCATENATED MODULE: ./node_modules/cache-loader/dist/cjs.js?{"cacheDirectory":"node_modules/.cache/vue-loader","cacheIdentifier":"1f5e94d8-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=55650f2e
|
|
93
160
|
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))])
|
|
94
161
|
}
|
|
95
162
|
var staticRenderFns = []
|
|
96
163
|
|
|
97
164
|
|
|
98
|
-
|
|
165
|
+
// CONCATENATED MODULE: ./src/components/button/index.vue?vue&type=template&id=55650f2e
|
|
166
|
+
|
|
167
|
+
// 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
|
|
99
168
|
|
|
100
|
-
/* harmony default export */
|
|
169
|
+
/* harmony default export */ var buttonvue_type_script_lang_js = ({
|
|
101
170
|
props:['text'],
|
|
102
171
|
name: 'XtButton',
|
|
103
172
|
methods:{
|
|
@@ -107,9 +176,9 @@ var staticRenderFns = []
|
|
|
107
176
|
}
|
|
108
177
|
});
|
|
109
178
|
|
|
110
|
-
|
|
111
|
-
/* harmony default export */
|
|
112
|
-
|
|
179
|
+
// CONCATENATED MODULE: ./src/components/button/index.vue?vue&type=script&lang=js
|
|
180
|
+
/* harmony default export */ var components_buttonvue_type_script_lang_js = (buttonvue_type_script_lang_js);
|
|
181
|
+
// CONCATENATED MODULE: ./node_modules/vue-loader/lib/runtime/componentNormalizer.js
|
|
113
182
|
/* globals __VUE_SSR_CONTEXT__ */
|
|
114
183
|
|
|
115
184
|
// IMPORTANT: Do NOT use ES2015 features in this file (except for modules).
|
|
@@ -207,14 +276,14 @@ function normalizeComponent(
|
|
|
207
276
|
}
|
|
208
277
|
}
|
|
209
278
|
|
|
210
|
-
|
|
279
|
+
// CONCATENATED MODULE: ./src/components/button/index.vue
|
|
211
280
|
|
|
212
281
|
|
|
213
282
|
|
|
214
283
|
|
|
215
284
|
|
|
216
285
|
/* normalize component */
|
|
217
|
-
|
|
286
|
+
|
|
218
287
|
var component = normalizeComponent(
|
|
219
288
|
components_buttonvue_type_script_lang_js,
|
|
220
289
|
render,
|
|
@@ -226,19 +295,21 @@ var component = normalizeComponent(
|
|
|
226
295
|
|
|
227
296
|
)
|
|
228
297
|
|
|
229
|
-
/* harmony default export */
|
|
230
|
-
|
|
298
|
+
/* harmony default export */ var components_button = (component.exports);
|
|
299
|
+
// CONCATENATED MODULE: ./src/components/button/index.js
|
|
231
300
|
|
|
232
|
-
/* harmony default export */
|
|
233
|
-
|
|
301
|
+
/* harmony default export */ var src_components_button = (components_button);
|
|
302
|
+
// CONCATENATED MODULE: ./node_modules/cache-loader/dist/cjs.js?{"cacheDirectory":"node_modules/.cache/vue-loader","cacheIdentifier":"1f5e94d8-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
|
|
234
303
|
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)}}})
|
|
235
304
|
}
|
|
236
305
|
var inputvue_type_template_id_fe9146e4_staticRenderFns = []
|
|
237
306
|
|
|
238
307
|
|
|
239
|
-
|
|
308
|
+
// CONCATENATED MODULE: ./src/components/input/index.vue?vue&type=template&id=fe9146e4
|
|
309
|
+
|
|
310
|
+
// 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
|
|
240
311
|
|
|
241
|
-
/* harmony default export */
|
|
312
|
+
/* harmony default export */ var inputvue_type_script_lang_js = ({
|
|
242
313
|
name: 'XtInput',
|
|
243
314
|
props: {
|
|
244
315
|
value: [String, Number],
|
|
@@ -249,16 +320,16 @@ var inputvue_type_template_id_fe9146e4_staticRenderFns = []
|
|
|
249
320
|
}
|
|
250
321
|
});
|
|
251
322
|
|
|
252
|
-
|
|
253
|
-
/* harmony default export */
|
|
254
|
-
|
|
323
|
+
// CONCATENATED MODULE: ./src/components/input/index.vue?vue&type=script&lang=js
|
|
324
|
+
/* harmony default export */ var components_inputvue_type_script_lang_js = (inputvue_type_script_lang_js);
|
|
325
|
+
// CONCATENATED MODULE: ./src/components/input/index.vue
|
|
255
326
|
|
|
256
327
|
|
|
257
328
|
|
|
258
329
|
|
|
259
330
|
|
|
260
331
|
/* normalize component */
|
|
261
|
-
|
|
332
|
+
|
|
262
333
|
var input_component = normalizeComponent(
|
|
263
334
|
components_inputvue_type_script_lang_js,
|
|
264
335
|
inputvue_type_template_id_fe9146e4_render,
|
|
@@ -270,14 +341,19 @@ var input_component = normalizeComponent(
|
|
|
270
341
|
|
|
271
342
|
)
|
|
272
343
|
|
|
273
|
-
/* harmony default export */
|
|
274
|
-
|
|
344
|
+
/* harmony default export */ var input = (input_component.exports);
|
|
345
|
+
// CONCATENATED MODULE: ./src/components/input/index.js
|
|
275
346
|
|
|
276
|
-
/* harmony default export */
|
|
277
|
-
|
|
347
|
+
/* harmony default export */ var components_input = (input);
|
|
348
|
+
// CONCATENATED MODULE: ./src/index.js
|
|
278
349
|
// 导入 Vue
|
|
279
350
|
|
|
280
351
|
|
|
352
|
+
// 在导入 Element UI 之前,先将 Vue 设置为全局变量
|
|
353
|
+
if (typeof window !== 'undefined') {
|
|
354
|
+
window.Vue = external_Vue_default.a
|
|
355
|
+
}
|
|
356
|
+
|
|
281
357
|
// 导入 Element UI 并注册
|
|
282
358
|
|
|
283
359
|
|
|
@@ -286,8 +362,6 @@ var input_component = normalizeComponent(
|
|
|
286
362
|
|
|
287
363
|
|
|
288
364
|
|
|
289
|
-
|
|
290
|
-
|
|
291
365
|
// 存储组件列表
|
|
292
366
|
const components = [
|
|
293
367
|
src_components_button,
|
|
@@ -300,7 +374,7 @@ const install = function (Vue) {
|
|
|
300
374
|
install.installed = true
|
|
301
375
|
|
|
302
376
|
// 注册 Element UI
|
|
303
|
-
Vue.use(
|
|
377
|
+
Vue.use(external_ElementUI_default.a)
|
|
304
378
|
|
|
305
379
|
// 全局注册所有 xt- 组件
|
|
306
380
|
components.forEach(component => {
|
|
@@ -308,53 +382,147 @@ const install = function (Vue) {
|
|
|
308
382
|
})
|
|
309
383
|
}
|
|
310
384
|
|
|
311
|
-
|
|
312
385
|
// 支持全局 script 标签引入
|
|
313
386
|
if (typeof window !== 'undefined' && window.Vue) {
|
|
314
387
|
install(window.Vue)
|
|
315
388
|
}
|
|
316
389
|
|
|
317
390
|
// 导出
|
|
318
|
-
/* harmony default export */
|
|
391
|
+
/* harmony default export */ var src_0 = ({
|
|
319
392
|
install,
|
|
320
393
|
// 按需导出组件
|
|
321
394
|
Button: src_components_button,
|
|
322
395
|
Input: components_input,
|
|
323
396
|
// 导出 ElementUI 以便用户按需引入
|
|
324
|
-
ElementUI:
|
|
397
|
+
ElementUI: external_ElementUI_default.a
|
|
325
398
|
});
|
|
326
399
|
|
|
327
400
|
// 导出 Vue 和 ElementUI 以便用户使用
|
|
328
401
|
|
|
329
402
|
|
|
330
|
-
//
|
|
403
|
+
// 默认配置
|
|
404
|
+
const defaultConfig = {
|
|
405
|
+
theme: 'light',
|
|
406
|
+
size: 'medium',
|
|
407
|
+
primaryColor: '#1890ff'
|
|
408
|
+
}
|
|
409
|
+
|
|
410
|
+
// 当前配置
|
|
411
|
+
let currentConfig = { ...defaultConfig }
|
|
412
|
+
|
|
413
|
+
// 配置变更事件处理
|
|
414
|
+
const configChangeListeners = []
|
|
415
|
+
|
|
416
|
+
const emitConfigChange = function(key, value) {
|
|
417
|
+
configChangeListeners.forEach(listener => {
|
|
418
|
+
listener(key, value)
|
|
419
|
+
})
|
|
420
|
+
}
|
|
421
|
+
|
|
422
|
+
// 获取所有配置
|
|
423
|
+
const getConfig = function() {
|
|
424
|
+
return { ...currentConfig }
|
|
425
|
+
}
|
|
426
|
+
|
|
427
|
+
// 设置全局配置
|
|
428
|
+
const setConfig = function(config) {
|
|
429
|
+
if (typeof config !== 'object' || config === null) {
|
|
430
|
+
console.warn('[XtElementUI] setConfig 必须传入对象参数')
|
|
431
|
+
return
|
|
432
|
+
}
|
|
433
|
+
|
|
434
|
+
if (config.theme !== undefined) {
|
|
435
|
+
setTheme(config.theme)
|
|
436
|
+
}
|
|
437
|
+
if (config.size !== undefined) {
|
|
438
|
+
setSize(config.size)
|
|
439
|
+
}
|
|
440
|
+
if (config.primaryColor !== undefined) {
|
|
441
|
+
setPrimaryColor(config.primaryColor)
|
|
442
|
+
}
|
|
443
|
+
}
|
|
444
|
+
|
|
445
|
+
// 设置主题
|
|
331
446
|
const setTheme = function(theme) {
|
|
332
447
|
const validThemes = ['light', 'dark', 'compact']
|
|
333
|
-
if (validThemes.includes(theme)) {
|
|
334
|
-
|
|
448
|
+
if (!validThemes.includes(theme)) {
|
|
449
|
+
console.warn(`[XtElementUI] 无效的主题值: ${theme},可选值: ${validThemes.join(', ')}`)
|
|
450
|
+
return
|
|
335
451
|
}
|
|
452
|
+
|
|
453
|
+
currentConfig.theme = theme
|
|
454
|
+
document.documentElement.setAttribute('data-theme', theme)
|
|
455
|
+
emitConfigChange('theme', theme)
|
|
336
456
|
}
|
|
337
457
|
|
|
458
|
+
// 设置字体大小
|
|
338
459
|
const setSize = function(size) {
|
|
339
460
|
const validSizes = ['small', 'medium', 'large']
|
|
340
|
-
if (validSizes.includes(size)) {
|
|
341
|
-
|
|
461
|
+
if (!validSizes.includes(size)) {
|
|
462
|
+
console.warn(`[XtElementUI] 无效的大小值: ${size},可选值: ${validSizes.join(', ')}`)
|
|
463
|
+
return
|
|
342
464
|
}
|
|
465
|
+
|
|
466
|
+
currentConfig.size = size
|
|
467
|
+
document.documentElement.setAttribute('data-size', size)
|
|
468
|
+
emitConfigChange('size', size)
|
|
343
469
|
}
|
|
344
470
|
|
|
471
|
+
// 设置主色调
|
|
472
|
+
const setPrimaryColor = function(color) {
|
|
473
|
+
// 简单的颜色格式验证
|
|
474
|
+
const colorRegex = /^#[0-9A-Fa-f]{6}$|^#[0-9A-Fa-f]{3}$/
|
|
475
|
+
if (!colorRegex.test(color)) {
|
|
476
|
+
console.warn(`[XtElementUI] 无效的颜色值: ${color},请使用十六进制颜色格式,如 #1890ff`)
|
|
477
|
+
return
|
|
478
|
+
}
|
|
479
|
+
|
|
480
|
+
currentConfig.primaryColor = color
|
|
481
|
+
document.documentElement.style.setProperty('--xt-color-primary', color)
|
|
482
|
+
emitConfigChange('primaryColor', color)
|
|
483
|
+
}
|
|
484
|
+
|
|
485
|
+
// 获取当前主题
|
|
345
486
|
const getTheme = function() {
|
|
346
|
-
return
|
|
487
|
+
return currentConfig.theme
|
|
347
488
|
}
|
|
348
489
|
|
|
490
|
+
// 获取当前字体大小
|
|
349
491
|
const getSize = function() {
|
|
350
|
-
return
|
|
492
|
+
return currentConfig.size
|
|
493
|
+
}
|
|
494
|
+
|
|
495
|
+
// 获取当前主色调
|
|
496
|
+
const getPrimaryColor = function() {
|
|
497
|
+
return currentConfig.primaryColor
|
|
498
|
+
}
|
|
499
|
+
|
|
500
|
+
// 重置为默认配置
|
|
501
|
+
const resetConfig = function() {
|
|
502
|
+
setConfig(defaultConfig)
|
|
351
503
|
}
|
|
352
|
-
|
|
504
|
+
|
|
505
|
+
// 监听配置变更
|
|
506
|
+
const onConfigChange = function(listener) {
|
|
507
|
+
if (typeof listener === 'function') {
|
|
508
|
+
configChangeListeners.push(listener)
|
|
509
|
+
return function() {
|
|
510
|
+
const index = configChangeListeners.indexOf(listener)
|
|
511
|
+
if (index > -1) {
|
|
512
|
+
configChangeListeners.splice(index, 1)
|
|
513
|
+
}
|
|
514
|
+
}
|
|
515
|
+
} else {
|
|
516
|
+
console.warn('[XtElementUI] onConfigChange 必须传入函数')
|
|
517
|
+
}
|
|
518
|
+
}
|
|
519
|
+
// CONCATENATED MODULE: ./node_modules/@vue/cli-service/lib/commands/build/entry-lib.js
|
|
520
|
+
|
|
521
|
+
|
|
522
|
+
/* harmony default export */ var entry_lib = __webpack_exports__["default"] = (src_0);
|
|
353
523
|
|
|
354
524
|
|
|
355
|
-
/* harmony default export */ const entry_lib = (src_0);
|
|
356
525
|
|
|
526
|
+
/***/ })
|
|
357
527
|
|
|
358
|
-
|
|
359
|
-
/******/ })()
|
|
360
|
-
;
|
|
528
|
+
/******/ });
|