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/index.umd.js
CHANGED
|
@@ -7,121 +7,143 @@
|
|
|
7
7
|
exports["xt-element-ui"] = factory(require("ElementUI"), require("Vue"));
|
|
8
8
|
else
|
|
9
9
|
root["xt-element-ui"] = factory(root["ElementUI"], root["Vue"]);
|
|
10
|
-
})((typeof self !== 'undefined' ? self : this), (
|
|
11
|
-
return /******/ (()
|
|
12
|
-
/******/ "use strict";
|
|
13
|
-
/******/ var __webpack_modules__ = ({
|
|
14
|
-
|
|
15
|
-
/***/ 282
|
|
16
|
-
(module) {
|
|
17
|
-
|
|
18
|
-
module.exports = __WEBPACK_EXTERNAL_MODULE__282__;
|
|
19
|
-
|
|
20
|
-
/***/ },
|
|
21
|
-
|
|
22
|
-
/***/ 508
|
|
23
|
-
(module) {
|
|
24
|
-
|
|
25
|
-
module.exports = __WEBPACK_EXTERNAL_MODULE__508__;
|
|
26
|
-
|
|
27
|
-
/***/ }
|
|
28
|
-
|
|
29
|
-
/******/ });
|
|
30
|
-
/************************************************************************/
|
|
10
|
+
})((typeof self !== 'undefined' ? self : this), function(__WEBPACK_EXTERNAL_MODULE__5f72__, __WEBPACK_EXTERNAL_MODULE__8bbf__) {
|
|
11
|
+
return /******/ (function(modules) { // webpackBootstrap
|
|
31
12
|
/******/ // The module cache
|
|
32
|
-
/******/ var
|
|
33
|
-
/******/
|
|
13
|
+
/******/ var installedModules = {};
|
|
14
|
+
/******/
|
|
34
15
|
/******/ // The require function
|
|
35
16
|
/******/ function __webpack_require__(moduleId) {
|
|
17
|
+
/******/
|
|
36
18
|
/******/ // Check if module is in cache
|
|
37
|
-
/******/
|
|
38
|
-
/******/
|
|
39
|
-
/******/ return cachedModule.exports;
|
|
19
|
+
/******/ if(installedModules[moduleId]) {
|
|
20
|
+
/******/ return installedModules[moduleId].exports;
|
|
40
21
|
/******/ }
|
|
41
22
|
/******/ // Create a new module (and put it into the cache)
|
|
42
|
-
/******/ var module =
|
|
43
|
-
/******/
|
|
44
|
-
/******/
|
|
23
|
+
/******/ var module = installedModules[moduleId] = {
|
|
24
|
+
/******/ i: moduleId,
|
|
25
|
+
/******/ l: false,
|
|
45
26
|
/******/ exports: {}
|
|
46
27
|
/******/ };
|
|
47
|
-
/******/
|
|
28
|
+
/******/
|
|
48
29
|
/******/ // Execute the module function
|
|
49
|
-
/******/
|
|
50
|
-
/******/
|
|
30
|
+
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
|
|
31
|
+
/******/
|
|
32
|
+
/******/ // Flag the module as loaded
|
|
33
|
+
/******/ module.l = true;
|
|
34
|
+
/******/
|
|
51
35
|
/******/ // Return the exports of the module
|
|
52
36
|
/******/ return module.exports;
|
|
53
37
|
/******/ }
|
|
54
|
-
/******/
|
|
55
|
-
|
|
56
|
-
/******/
|
|
57
|
-
/******/
|
|
58
|
-
/******/
|
|
59
|
-
/******/
|
|
60
|
-
/******/
|
|
61
|
-
/******/
|
|
62
|
-
/******/
|
|
63
|
-
/******/
|
|
64
|
-
/******/
|
|
65
|
-
/******/
|
|
66
|
-
/******/
|
|
67
|
-
/******/
|
|
68
|
-
/******/
|
|
69
|
-
/******/
|
|
70
|
-
/******/
|
|
71
|
-
/******/
|
|
72
|
-
/******/
|
|
73
|
-
/******/
|
|
74
|
-
/******/
|
|
75
|
-
/******/
|
|
76
|
-
/******/
|
|
77
|
-
/******/
|
|
78
|
-
/******/
|
|
79
|
-
/******/
|
|
80
|
-
/******/
|
|
81
|
-
/******/
|
|
82
|
-
/******/
|
|
83
|
-
/******/
|
|
84
|
-
/******/
|
|
85
|
-
/******/
|
|
86
|
-
/******/
|
|
87
|
-
/******/
|
|
88
|
-
/******/
|
|
89
|
-
/******/
|
|
90
|
-
/******/
|
|
91
|
-
/******/
|
|
92
|
-
/******/
|
|
93
|
-
/******/
|
|
94
|
-
/******/
|
|
95
|
-
/******/
|
|
96
|
-
/******/
|
|
97
|
-
/******/
|
|
98
|
-
/******/ __webpack_require__.
|
|
99
|
-
/******/
|
|
100
|
-
/******/
|
|
38
|
+
/******/
|
|
39
|
+
/******/
|
|
40
|
+
/******/ // expose the modules object (__webpack_modules__)
|
|
41
|
+
/******/ __webpack_require__.m = modules;
|
|
42
|
+
/******/
|
|
43
|
+
/******/ // expose the module cache
|
|
44
|
+
/******/ __webpack_require__.c = installedModules;
|
|
45
|
+
/******/
|
|
46
|
+
/******/ // define getter function for harmony exports
|
|
47
|
+
/******/ __webpack_require__.d = function(exports, name, getter) {
|
|
48
|
+
/******/ if(!__webpack_require__.o(exports, name)) {
|
|
49
|
+
/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
|
|
50
|
+
/******/ }
|
|
51
|
+
/******/ };
|
|
52
|
+
/******/
|
|
53
|
+
/******/ // define __esModule on exports
|
|
54
|
+
/******/ __webpack_require__.r = function(exports) {
|
|
55
|
+
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
|
|
56
|
+
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
57
|
+
/******/ }
|
|
58
|
+
/******/ Object.defineProperty(exports, '__esModule', { value: true });
|
|
59
|
+
/******/ };
|
|
60
|
+
/******/
|
|
61
|
+
/******/ // create a fake namespace object
|
|
62
|
+
/******/ // mode & 1: value is a module id, require it
|
|
63
|
+
/******/ // mode & 2: merge all properties of value into the ns
|
|
64
|
+
/******/ // mode & 4: return value when already ns object
|
|
65
|
+
/******/ // mode & 8|1: behave like require
|
|
66
|
+
/******/ __webpack_require__.t = function(value, mode) {
|
|
67
|
+
/******/ if(mode & 1) value = __webpack_require__(value);
|
|
68
|
+
/******/ if(mode & 8) return value;
|
|
69
|
+
/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
|
|
70
|
+
/******/ var ns = Object.create(null);
|
|
71
|
+
/******/ __webpack_require__.r(ns);
|
|
72
|
+
/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
|
|
73
|
+
/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
|
|
74
|
+
/******/ return ns;
|
|
75
|
+
/******/ };
|
|
76
|
+
/******/
|
|
77
|
+
/******/ // getDefaultExport function for compatibility with non-harmony modules
|
|
78
|
+
/******/ __webpack_require__.n = function(module) {
|
|
79
|
+
/******/ var getter = module && module.__esModule ?
|
|
80
|
+
/******/ function getDefault() { return module['default']; } :
|
|
81
|
+
/******/ function getModuleExports() { return module; };
|
|
82
|
+
/******/ __webpack_require__.d(getter, 'a', getter);
|
|
83
|
+
/******/ return getter;
|
|
84
|
+
/******/ };
|
|
85
|
+
/******/
|
|
86
|
+
/******/ // Object.prototype.hasOwnProperty.call
|
|
87
|
+
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
|
|
88
|
+
/******/
|
|
89
|
+
/******/ // __webpack_public_path__
|
|
90
|
+
/******/ __webpack_require__.p = "";
|
|
91
|
+
/******/
|
|
92
|
+
/******/
|
|
93
|
+
/******/ // Load entry module and return exports
|
|
94
|
+
/******/ return __webpack_require__(__webpack_require__.s = "fb15");
|
|
95
|
+
/******/ })
|
|
101
96
|
/************************************************************************/
|
|
102
|
-
|
|
97
|
+
/******/ ({
|
|
98
|
+
|
|
99
|
+
/***/ "0fae":
|
|
100
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
101
|
+
|
|
102
|
+
// extracted by mini-css-extract-plugin
|
|
103
|
+
|
|
104
|
+
/***/ }),
|
|
105
|
+
|
|
106
|
+
/***/ "5f72":
|
|
107
|
+
/***/ (function(module, exports) {
|
|
108
|
+
|
|
109
|
+
module.exports = __WEBPACK_EXTERNAL_MODULE__5f72__;
|
|
110
|
+
|
|
111
|
+
/***/ }),
|
|
112
|
+
|
|
113
|
+
/***/ "8bbf":
|
|
114
|
+
/***/ (function(module, exports) {
|
|
115
|
+
|
|
116
|
+
module.exports = __WEBPACK_EXTERNAL_MODULE__8bbf__;
|
|
117
|
+
|
|
118
|
+
/***/ }),
|
|
119
|
+
|
|
120
|
+
/***/ "fb15":
|
|
121
|
+
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
122
|
+
|
|
123
|
+
"use strict";
|
|
103
124
|
// ESM COMPAT FLAG
|
|
104
125
|
__webpack_require__.r(__webpack_exports__);
|
|
105
126
|
|
|
106
127
|
// EXPORTS
|
|
107
|
-
__webpack_require__.d(__webpack_exports__, {
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
});
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
/*
|
|
128
|
+
__webpack_require__.d(__webpack_exports__, "Vue", function() { return /* reexport */ external_Vue_default.a; });
|
|
129
|
+
__webpack_require__.d(__webpack_exports__, "ElementUI", function() { return /* reexport */ external_ElementUI_default.a; });
|
|
130
|
+
__webpack_require__.d(__webpack_exports__, "getConfig", function() { return /* reexport */ getConfig; });
|
|
131
|
+
__webpack_require__.d(__webpack_exports__, "setConfig", function() { return /* reexport */ setConfig; });
|
|
132
|
+
__webpack_require__.d(__webpack_exports__, "setTheme", function() { return /* reexport */ setTheme; });
|
|
133
|
+
__webpack_require__.d(__webpack_exports__, "setSize", function() { return /* reexport */ setSize; });
|
|
134
|
+
__webpack_require__.d(__webpack_exports__, "setPrimaryColor", function() { return /* reexport */ setPrimaryColor; });
|
|
135
|
+
__webpack_require__.d(__webpack_exports__, "getTheme", function() { return /* reexport */ getTheme; });
|
|
136
|
+
__webpack_require__.d(__webpack_exports__, "getSize", function() { return /* reexport */ getSize; });
|
|
137
|
+
__webpack_require__.d(__webpack_exports__, "getPrimaryColor", function() { return /* reexport */ getPrimaryColor; });
|
|
138
|
+
__webpack_require__.d(__webpack_exports__, "resetConfig", function() { return /* reexport */ resetConfig; });
|
|
139
|
+
__webpack_require__.d(__webpack_exports__, "onConfigChange", function() { return /* reexport */ onConfigChange; });
|
|
140
|
+
|
|
141
|
+
// CONCATENATED MODULE: ./node_modules/@vue/cli-service/lib/commands/build/setPublicPath.js
|
|
119
142
|
// This file is imported into lib/wc client bundles.
|
|
120
143
|
|
|
121
144
|
if (typeof window !== 'undefined') {
|
|
122
145
|
var currentScript = window.document.currentScript
|
|
123
|
-
if (false)
|
|
124
|
-
{ var getCurrentScript; }
|
|
146
|
+
if (false) { var getCurrentScript; }
|
|
125
147
|
|
|
126
148
|
var src = currentScript && currentScript.src.match(/(.+\/)[^/]+\.js(\?.*)?$/)
|
|
127
149
|
if (src) {
|
|
@@ -130,23 +152,30 @@ if (typeof window !== 'undefined') {
|
|
|
130
152
|
}
|
|
131
153
|
|
|
132
154
|
// Indicate to webpack that this file can be concatenated
|
|
133
|
-
/* harmony default export */
|
|
155
|
+
/* harmony default export */ var setPublicPath = (null);
|
|
134
156
|
|
|
135
157
|
// EXTERNAL MODULE: external "Vue"
|
|
136
|
-
var external_Vue_ = __webpack_require__(
|
|
158
|
+
var external_Vue_ = __webpack_require__("8bbf");
|
|
137
159
|
var external_Vue_default = /*#__PURE__*/__webpack_require__.n(external_Vue_);
|
|
160
|
+
|
|
138
161
|
// EXTERNAL MODULE: external "ElementUI"
|
|
139
|
-
var external_ElementUI_ = __webpack_require__(
|
|
162
|
+
var external_ElementUI_ = __webpack_require__("5f72");
|
|
140
163
|
var external_ElementUI_default = /*#__PURE__*/__webpack_require__.n(external_ElementUI_);
|
|
141
|
-
|
|
164
|
+
|
|
165
|
+
// EXTERNAL MODULE: ./node_modules/element-ui/lib/theme-chalk/index.css
|
|
166
|
+
var theme_chalk = __webpack_require__("0fae");
|
|
167
|
+
|
|
168
|
+
// 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
|
|
142
169
|
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))])
|
|
143
170
|
}
|
|
144
171
|
var staticRenderFns = []
|
|
145
172
|
|
|
146
173
|
|
|
147
|
-
|
|
174
|
+
// CONCATENATED MODULE: ./src/components/button/index.vue?vue&type=template&id=55650f2e
|
|
175
|
+
|
|
176
|
+
// 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
|
|
148
177
|
|
|
149
|
-
/* harmony default export */
|
|
178
|
+
/* harmony default export */ var buttonvue_type_script_lang_js = ({
|
|
150
179
|
props:['text'],
|
|
151
180
|
name: 'XtButton',
|
|
152
181
|
methods:{
|
|
@@ -156,9 +185,9 @@ var staticRenderFns = []
|
|
|
156
185
|
}
|
|
157
186
|
});
|
|
158
187
|
|
|
159
|
-
|
|
160
|
-
/* harmony default export */
|
|
161
|
-
|
|
188
|
+
// CONCATENATED MODULE: ./src/components/button/index.vue?vue&type=script&lang=js
|
|
189
|
+
/* harmony default export */ var components_buttonvue_type_script_lang_js = (buttonvue_type_script_lang_js);
|
|
190
|
+
// CONCATENATED MODULE: ./node_modules/vue-loader/lib/runtime/componentNormalizer.js
|
|
162
191
|
/* globals __VUE_SSR_CONTEXT__ */
|
|
163
192
|
|
|
164
193
|
// IMPORTANT: Do NOT use ES2015 features in this file (except for modules).
|
|
@@ -256,14 +285,14 @@ function normalizeComponent(
|
|
|
256
285
|
}
|
|
257
286
|
}
|
|
258
287
|
|
|
259
|
-
|
|
288
|
+
// CONCATENATED MODULE: ./src/components/button/index.vue
|
|
260
289
|
|
|
261
290
|
|
|
262
291
|
|
|
263
292
|
|
|
264
293
|
|
|
265
294
|
/* normalize component */
|
|
266
|
-
|
|
295
|
+
|
|
267
296
|
var component = normalizeComponent(
|
|
268
297
|
components_buttonvue_type_script_lang_js,
|
|
269
298
|
render,
|
|
@@ -275,19 +304,21 @@ var component = normalizeComponent(
|
|
|
275
304
|
|
|
276
305
|
)
|
|
277
306
|
|
|
278
|
-
/* harmony default export */
|
|
279
|
-
|
|
307
|
+
/* harmony default export */ var components_button = (component.exports);
|
|
308
|
+
// CONCATENATED MODULE: ./src/components/button/index.js
|
|
280
309
|
|
|
281
|
-
/* harmony default export */
|
|
282
|
-
|
|
310
|
+
/* harmony default export */ var src_components_button = (components_button);
|
|
311
|
+
// 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
|
|
283
312
|
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)}}})
|
|
284
313
|
}
|
|
285
314
|
var inputvue_type_template_id_fe9146e4_staticRenderFns = []
|
|
286
315
|
|
|
287
316
|
|
|
288
|
-
|
|
317
|
+
// CONCATENATED MODULE: ./src/components/input/index.vue?vue&type=template&id=fe9146e4
|
|
318
|
+
|
|
319
|
+
// 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
|
|
289
320
|
|
|
290
|
-
/* harmony default export */
|
|
321
|
+
/* harmony default export */ var inputvue_type_script_lang_js = ({
|
|
291
322
|
name: 'XtInput',
|
|
292
323
|
props: {
|
|
293
324
|
value: [String, Number],
|
|
@@ -298,16 +329,16 @@ var inputvue_type_template_id_fe9146e4_staticRenderFns = []
|
|
|
298
329
|
}
|
|
299
330
|
});
|
|
300
331
|
|
|
301
|
-
|
|
302
|
-
/* harmony default export */
|
|
303
|
-
|
|
332
|
+
// CONCATENATED MODULE: ./src/components/input/index.vue?vue&type=script&lang=js
|
|
333
|
+
/* harmony default export */ var components_inputvue_type_script_lang_js = (inputvue_type_script_lang_js);
|
|
334
|
+
// CONCATENATED MODULE: ./src/components/input/index.vue
|
|
304
335
|
|
|
305
336
|
|
|
306
337
|
|
|
307
338
|
|
|
308
339
|
|
|
309
340
|
/* normalize component */
|
|
310
|
-
|
|
341
|
+
|
|
311
342
|
var input_component = normalizeComponent(
|
|
312
343
|
components_inputvue_type_script_lang_js,
|
|
313
344
|
inputvue_type_template_id_fe9146e4_render,
|
|
@@ -319,14 +350,19 @@ var input_component = normalizeComponent(
|
|
|
319
350
|
|
|
320
351
|
)
|
|
321
352
|
|
|
322
|
-
/* harmony default export */
|
|
323
|
-
|
|
353
|
+
/* harmony default export */ var input = (input_component.exports);
|
|
354
|
+
// CONCATENATED MODULE: ./src/components/input/index.js
|
|
324
355
|
|
|
325
|
-
/* harmony default export */
|
|
326
|
-
|
|
356
|
+
/* harmony default export */ var components_input = (input);
|
|
357
|
+
// CONCATENATED MODULE: ./src/index.js
|
|
327
358
|
// 导入 Vue
|
|
328
359
|
|
|
329
360
|
|
|
361
|
+
// 在导入 Element UI 之前,先将 Vue 设置为全局变量
|
|
362
|
+
if (typeof window !== 'undefined') {
|
|
363
|
+
window.Vue = external_Vue_default.a
|
|
364
|
+
}
|
|
365
|
+
|
|
330
366
|
// 导入 Element UI 并注册
|
|
331
367
|
|
|
332
368
|
|
|
@@ -335,8 +371,6 @@ var input_component = normalizeComponent(
|
|
|
335
371
|
|
|
336
372
|
|
|
337
373
|
|
|
338
|
-
|
|
339
|
-
|
|
340
374
|
// 存储组件列表
|
|
341
375
|
const components = [
|
|
342
376
|
src_components_button,
|
|
@@ -349,7 +383,7 @@ const install = function (Vue) {
|
|
|
349
383
|
install.installed = true
|
|
350
384
|
|
|
351
385
|
// 注册 Element UI
|
|
352
|
-
Vue.use(
|
|
386
|
+
Vue.use(external_ElementUI_default.a)
|
|
353
387
|
|
|
354
388
|
// 全局注册所有 xt- 组件
|
|
355
389
|
components.forEach(component => {
|
|
@@ -357,54 +391,148 @@ const install = function (Vue) {
|
|
|
357
391
|
})
|
|
358
392
|
}
|
|
359
393
|
|
|
360
|
-
|
|
361
394
|
// 支持全局 script 标签引入
|
|
362
395
|
if (typeof window !== 'undefined' && window.Vue) {
|
|
363
396
|
install(window.Vue)
|
|
364
397
|
}
|
|
365
398
|
|
|
366
399
|
// 导出
|
|
367
|
-
/* harmony default export */
|
|
400
|
+
/* harmony default export */ var src_0 = ({
|
|
368
401
|
install,
|
|
369
402
|
// 按需导出组件
|
|
370
403
|
Button: src_components_button,
|
|
371
404
|
Input: components_input,
|
|
372
405
|
// 导出 ElementUI 以便用户按需引入
|
|
373
|
-
ElementUI:
|
|
406
|
+
ElementUI: external_ElementUI_default.a
|
|
374
407
|
});
|
|
375
408
|
|
|
376
409
|
// 导出 Vue 和 ElementUI 以便用户使用
|
|
377
410
|
|
|
378
411
|
|
|
379
|
-
//
|
|
412
|
+
// 默认配置
|
|
413
|
+
const defaultConfig = {
|
|
414
|
+
theme: 'light',
|
|
415
|
+
size: 'medium',
|
|
416
|
+
primaryColor: '#1890ff'
|
|
417
|
+
}
|
|
418
|
+
|
|
419
|
+
// 当前配置
|
|
420
|
+
let currentConfig = { ...defaultConfig }
|
|
421
|
+
|
|
422
|
+
// 配置变更事件处理
|
|
423
|
+
const configChangeListeners = []
|
|
424
|
+
|
|
425
|
+
const emitConfigChange = function(key, value) {
|
|
426
|
+
configChangeListeners.forEach(listener => {
|
|
427
|
+
listener(key, value)
|
|
428
|
+
})
|
|
429
|
+
}
|
|
430
|
+
|
|
431
|
+
// 获取所有配置
|
|
432
|
+
const getConfig = function() {
|
|
433
|
+
return { ...currentConfig }
|
|
434
|
+
}
|
|
435
|
+
|
|
436
|
+
// 设置全局配置
|
|
437
|
+
const setConfig = function(config) {
|
|
438
|
+
if (typeof config !== 'object' || config === null) {
|
|
439
|
+
console.warn('[XtElementUI] setConfig 必须传入对象参数')
|
|
440
|
+
return
|
|
441
|
+
}
|
|
442
|
+
|
|
443
|
+
if (config.theme !== undefined) {
|
|
444
|
+
setTheme(config.theme)
|
|
445
|
+
}
|
|
446
|
+
if (config.size !== undefined) {
|
|
447
|
+
setSize(config.size)
|
|
448
|
+
}
|
|
449
|
+
if (config.primaryColor !== undefined) {
|
|
450
|
+
setPrimaryColor(config.primaryColor)
|
|
451
|
+
}
|
|
452
|
+
}
|
|
453
|
+
|
|
454
|
+
// 设置主题
|
|
380
455
|
const setTheme = function(theme) {
|
|
381
456
|
const validThemes = ['light', 'dark', 'compact']
|
|
382
|
-
if (validThemes.includes(theme)) {
|
|
383
|
-
|
|
457
|
+
if (!validThemes.includes(theme)) {
|
|
458
|
+
console.warn(`[XtElementUI] 无效的主题值: ${theme},可选值: ${validThemes.join(', ')}`)
|
|
459
|
+
return
|
|
384
460
|
}
|
|
461
|
+
|
|
462
|
+
currentConfig.theme = theme
|
|
463
|
+
document.documentElement.setAttribute('data-theme', theme)
|
|
464
|
+
emitConfigChange('theme', theme)
|
|
385
465
|
}
|
|
386
466
|
|
|
467
|
+
// 设置字体大小
|
|
387
468
|
const setSize = function(size) {
|
|
388
469
|
const validSizes = ['small', 'medium', 'large']
|
|
389
|
-
if (validSizes.includes(size)) {
|
|
390
|
-
|
|
470
|
+
if (!validSizes.includes(size)) {
|
|
471
|
+
console.warn(`[XtElementUI] 无效的大小值: ${size},可选值: ${validSizes.join(', ')}`)
|
|
472
|
+
return
|
|
391
473
|
}
|
|
474
|
+
|
|
475
|
+
currentConfig.size = size
|
|
476
|
+
document.documentElement.setAttribute('data-size', size)
|
|
477
|
+
emitConfigChange('size', size)
|
|
392
478
|
}
|
|
393
479
|
|
|
480
|
+
// 设置主色调
|
|
481
|
+
const setPrimaryColor = function(color) {
|
|
482
|
+
// 简单的颜色格式验证
|
|
483
|
+
const colorRegex = /^#[0-9A-Fa-f]{6}$|^#[0-9A-Fa-f]{3}$/
|
|
484
|
+
if (!colorRegex.test(color)) {
|
|
485
|
+
console.warn(`[XtElementUI] 无效的颜色值: ${color},请使用十六进制颜色格式,如 #1890ff`)
|
|
486
|
+
return
|
|
487
|
+
}
|
|
488
|
+
|
|
489
|
+
currentConfig.primaryColor = color
|
|
490
|
+
document.documentElement.style.setProperty('--xt-color-primary', color)
|
|
491
|
+
emitConfigChange('primaryColor', color)
|
|
492
|
+
}
|
|
493
|
+
|
|
494
|
+
// 获取当前主题
|
|
394
495
|
const getTheme = function() {
|
|
395
|
-
return
|
|
496
|
+
return currentConfig.theme
|
|
396
497
|
}
|
|
397
498
|
|
|
499
|
+
// 获取当前字体大小
|
|
398
500
|
const getSize = function() {
|
|
399
|
-
return
|
|
501
|
+
return currentConfig.size
|
|
502
|
+
}
|
|
503
|
+
|
|
504
|
+
// 获取当前主色调
|
|
505
|
+
const getPrimaryColor = function() {
|
|
506
|
+
return currentConfig.primaryColor
|
|
400
507
|
}
|
|
401
|
-
|
|
508
|
+
|
|
509
|
+
// 重置为默认配置
|
|
510
|
+
const resetConfig = function() {
|
|
511
|
+
setConfig(defaultConfig)
|
|
512
|
+
}
|
|
513
|
+
|
|
514
|
+
// 监听配置变更
|
|
515
|
+
const onConfigChange = function(listener) {
|
|
516
|
+
if (typeof listener === 'function') {
|
|
517
|
+
configChangeListeners.push(listener)
|
|
518
|
+
return function() {
|
|
519
|
+
const index = configChangeListeners.indexOf(listener)
|
|
520
|
+
if (index > -1) {
|
|
521
|
+
configChangeListeners.splice(index, 1)
|
|
522
|
+
}
|
|
523
|
+
}
|
|
524
|
+
} else {
|
|
525
|
+
console.warn('[XtElementUI] onConfigChange 必须传入函数')
|
|
526
|
+
}
|
|
527
|
+
}
|
|
528
|
+
// CONCATENATED MODULE: ./node_modules/@vue/cli-service/lib/commands/build/entry-lib.js
|
|
529
|
+
|
|
530
|
+
|
|
531
|
+
/* harmony default export */ var entry_lib = __webpack_exports__["default"] = (src_0);
|
|
402
532
|
|
|
403
533
|
|
|
404
|
-
/* harmony default export */ const entry_lib = (src_0);
|
|
405
534
|
|
|
535
|
+
/***/ })
|
|
406
536
|
|
|
407
|
-
/******/
|
|
408
|
-
/******/ })()
|
|
409
|
-
;
|
|
537
|
+
/******/ });
|
|
410
538
|
});
|
package/lib/index.umd.min.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(e,t){"object"===typeof exports&&"object"===typeof module?module.exports=t(require("ElementUI"),require("Vue")):"function"===typeof define&&define.amd?define("xt-element-ui",["ElementUI","Vue"],t):"object"===typeof exports?exports["xt-element-ui"]=t(require("ElementUI"),require("Vue")):e["xt-element-ui"]=t(e["ElementUI"],e["Vue"])})("undefined"!==typeof self?self:this,(e,t)
|
|
1
|
+
(function(e,t){"object"===typeof exports&&"object"===typeof module?module.exports=t(require("ElementUI"),require("Vue")):"function"===typeof define&&define.amd?define("xt-element-ui",["ElementUI","Vue"],t):"object"===typeof exports?exports["xt-element-ui"]=t(require("ElementUI"),require("Vue")):e["xt-element-ui"]=t(e["ElementUI"],e["Vue"])})("undefined"!==typeof self?self:this,(function(e,t){return function(e){var t={};function n(o){if(t[o])return t[o].exports;var r=t[o]={i:o,l:!1,exports:{}};return e[o].call(r.exports,r,r.exports,n),r.l=!0,r.exports}return n.m=e,n.c=t,n.d=function(e,t,o){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:o})},n.r=function(e){"undefined"!==typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"===typeof e&&e&&e.__esModule)return e;var o=Object.create(null);if(n.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)n.d(o,r,function(t){return e[t]}.bind(null,r));return o},n.n=function(e){var t=e&&e.__esModule?function(){return e["default"]}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s="fb15")}({"0fae":function(e,t,n){},"5f72":function(t,n){t.exports=e},"8bbf":function(e,n){e.exports=t},fb15:function(e,t,n){"use strict";if(n.r(t),n.d(t,"Vue",(function(){return u.a})),n.d(t,"ElementUI",(function(){return c.a})),n.d(t,"getConfig",(function(){return V})),n.d(t,"setConfig",(function(){return z})),n.d(t,"setTheme",(function(){return X})),n.d(t,"setSize",(function(){return P})),n.d(t,"setPrimaryColor",(function(){return T})),n.d(t,"getTheme",(function(){return k})),n.d(t,"getSize",(function(){return R})),n.d(t,"getPrimaryColor",(function(){return q})),n.d(t,"resetConfig",(function(){return A})),n.d(t,"onConfigChange",(function(){return M})),"undefined"!==typeof window){var o=window.document.currentScript,r=o&&o.src.match(/(.+\/)[^/]+\.js(\?.*)?$/);r&&(n.p=r[1])}var i=n("8bbf"),u=n.n(i),f=n("5f72"),c=n.n(f),l=(n("0fae"),function(){var e=this,t=e._self._c;return t("el-button",{on:{click:e.handleClick}},[e._v(e._s(e.text))])}),s=[],a={props:["text"],name:"XtButton",methods:{handleClick(){this.$emit("click")}}},d=a;function p(e,t,n,o,r,i,u,f){var c,l="function"===typeof e?e.options:e;if(t&&(l.render=t,l.staticRenderFns=n,l._compiled=!0),o&&(l.functional=!0),i&&(l._scopeId="data-v-"+i),u?(c=function(e){e=e||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext,e||"undefined"===typeof __VUE_SSR_CONTEXT__||(e=__VUE_SSR_CONTEXT__),r&&r.call(this,e),e&&e._registeredComponents&&e._registeredComponents.add(u)},l._ssrRegister=c):r&&(c=f?function(){r.call(this,(l.functional?this.parent:this).$root.$options.shadowRoot)}:r),c)if(l.functional){l._injectStyles=c;var s=l.render;l.render=function(e,t){return c.call(t),s(e,t)}}else{var a=l.beforeCreate;l.beforeCreate=a?[].concat(a,c):[c]}return{exports:e,options:l}}var m=p(d,l,s,!1,null,null,null),h=m.exports,y=h,_=function(){var e=this,t=e._self._c;return t("el-input",{attrs:{value:e.value,placeholder:e.placeholder},on:{input:function(t){return e.$emit("input",t)}}})},b=[],v={name:"XtInput",props:{value:[String,Number],placeholder:{type:String,default:"请输入内容"}}},g=v,C=p(g,_,b,!1,null,null,null),x=C.exports,w=x;"undefined"!==typeof window&&(window.Vue=u.a);const E=[y,w],$=function(e){$.installed||($.installed=!0,e.use(c.a),E.forEach(t=>{e.component(t.name,t)}))};"undefined"!==typeof window&&window.Vue&&$(window.Vue);var j={install:$,Button:y,Input:w,ElementUI:c.a};const S={theme:"light",size:"medium",primaryColor:"#1890ff"};let I={...S};const U=[],O=function(e,t){U.forEach(n=>{n(e,t)})},V=function(){return{...I}},z=function(e){"object"===typeof e&&null!==e?(void 0!==e.theme&&X(e.theme),void 0!==e.size&&P(e.size),void 0!==e.primaryColor&&T(e.primaryColor)):console.warn("[XtElementUI] setConfig 必须传入对象参数")},X=function(e){const t=["light","dark","compact"];t.includes(e)?(I.theme=e,document.documentElement.setAttribute("data-theme",e),O("theme",e)):console.warn(`[XtElementUI] 无效的主题值: ${e},可选值: ${t.join(", ")}`)},P=function(e){const t=["small","medium","large"];t.includes(e)?(I.size=e,document.documentElement.setAttribute("data-size",e),O("size",e)):console.warn(`[XtElementUI] 无效的大小值: ${e},可选值: ${t.join(", ")}`)},T=function(e){const t=/^#[0-9A-Fa-f]{6}$|^#[0-9A-Fa-f]{3}$/;t.test(e)?(I.primaryColor=e,document.documentElement.style.setProperty("--xt-color-primary",e),O("primaryColor",e)):console.warn(`[XtElementUI] 无效的颜色值: ${e},请使用十六进制颜色格式,如 #1890ff`)},k=function(){return I.theme},R=function(){return I.size},q=function(){return I.primaryColor},A=function(){z(S)},M=function(e){if("function"===typeof e)return U.push(e),function(){const t=U.indexOf(e);t>-1&&U.splice(t,1)};console.warn("[XtElementUI] onConfigChange 必须传入函数")};t["default"]=j}})}));
|
package/package.json
CHANGED
|
@@ -1,31 +1,33 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "xt-element-ui",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.3",
|
|
4
4
|
"description": "基于 Vue2.7 + ElementUI 的组件库",
|
|
5
|
-
"main": "lib/index.js",
|
|
5
|
+
"main": "lib/index.common.js",
|
|
6
|
+
"module": "lib/index.esm.js",
|
|
7
|
+
"unpkg": "lib/index.umd.min.js",
|
|
6
8
|
"style": "lib/index.css",
|
|
7
9
|
"scripts": {
|
|
8
10
|
"docs:dev": "vuepress dev docs",
|
|
9
11
|
"docs:build": "vuepress build docs",
|
|
10
12
|
"dev": "vue-cli-service serve",
|
|
11
|
-
"lib": "vue-cli-service build --target lib --name index --dest lib src/index.js"
|
|
13
|
+
"lib": "vue-cli-service build --target lib --name index --dest lib src/index.js",
|
|
14
|
+
"prepublishOnly": "npm run lib"
|
|
12
15
|
},
|
|
13
|
-
"keywords": [
|
|
14
|
-
"vue2",
|
|
15
|
-
"element-ui",
|
|
16
|
-
"component",
|
|
17
|
-
"ui"
|
|
18
|
-
],
|
|
19
|
-
"author": "nss3012",
|
|
20
|
-
"license": "MIT",
|
|
21
16
|
"peerDependencies": {
|
|
22
17
|
"element-ui": "^2.15.0",
|
|
23
18
|
"vue": "^2.7.0"
|
|
24
19
|
},
|
|
25
20
|
"devDependencies": {
|
|
26
|
-
"@vue/cli-service": "
|
|
21
|
+
"@vue/cli-service": "~4.5.19",
|
|
22
|
+
"element-ui": "^2.15.14",
|
|
27
23
|
"sass": "^1.32.13",
|
|
28
24
|
"sass-loader": "^10.5.2",
|
|
25
|
+
"vue": "^2.7.14",
|
|
29
26
|
"vuepress": "^1.9.10"
|
|
30
|
-
}
|
|
27
|
+
},
|
|
28
|
+
"files": [
|
|
29
|
+
"lib",
|
|
30
|
+
"src",
|
|
31
|
+
"README.md"
|
|
32
|
+
]
|
|
31
33
|
}
|