common-utils-kit 1.1.19 → 1.1.23
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/README.md +12 -0
- package/lib/element/demo.html +1 -0
- package/lib/element/element.common.js +350 -0
- package/lib/element/element.umd.js +350 -0
- package/lib/element/element.umd.min.js +1 -0
- package/lib/utils/demo.html +1 -0
- package/lib/{utils-kit.common.js → utils/utils.common.js} +17 -145
- package/lib/{utils-kit.umd.js → utils/utils.umd.js} +5 -144
- package/lib/utils/utils.umd.min.js +1 -0
- package/package.json +8 -2
- package/lib/demo.html +0 -1
- package/lib/utils-kit.umd.min.js +0 -1
package/README.md
CHANGED
|
@@ -108,9 +108,12 @@ this.$test.email("200") //false
|
|
|
108
108
|
```
|
|
109
109
|
|
|
110
110
|
## 文件插件(files)
|
|
111
|
+
```html
|
|
111
112
|
1. downloadBase64File(base64文件下载)
|
|
112
113
|
2. downloadFiles(文件http地址下载)
|
|
114
|
+
```
|
|
113
115
|
## 格式化数据(format)
|
|
116
|
+
```html
|
|
114
117
|
1. unrepeated(数组对象去重)
|
|
115
118
|
2. treeToFlat(树形结构拍平为一维数组)
|
|
116
119
|
3. flatToTree(一维数组递归成为树形结构)
|
|
@@ -119,7 +122,9 @@ this.$test.email("200") //false
|
|
|
119
122
|
6. dateDiff(计算日期差值(单位:天))
|
|
120
123
|
7. getNowDate(获取当前日期)
|
|
121
124
|
8. setFormColumnsData(设置自定义表单列数据)
|
|
125
|
+
```
|
|
122
126
|
## 数据验证(test)
|
|
127
|
+
```html
|
|
123
128
|
1. hasValue(是否有值,可验证指定类型)
|
|
124
129
|
2. valueType(返回数据类型)
|
|
125
130
|
3. emai(是否为邮箱)
|
|
@@ -131,11 +136,18 @@ this.$test.email("200") //false
|
|
|
131
136
|
9. letter(是否为字母)
|
|
132
137
|
10. landline(是否为座机)
|
|
133
138
|
11. code(是否为6位数短信验证码)
|
|
139
|
+
```
|
|
134
140
|
## 通用工具(tool)
|
|
141
|
+
```html
|
|
135
142
|
1. debounce(防抖)
|
|
136
143
|
2. throttle(节流)
|
|
137
144
|
3. sleep(睡眠阻塞延时)
|
|
145
|
+
```
|
|
138
146
|
## 组件使用
|
|
147
|
+
## 样式使用
|
|
148
|
+
main.js文件中
|
|
149
|
+
import 'common-utils-kit/lib/utils-kit.css';
|
|
150
|
+
|
|
139
151
|
### 文件预览(preview)
|
|
140
152
|
需要安装 npm i docx-preview --save 预览docx
|
|
141
153
|
需要安装 npm i axios --save 预览docx
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<!doctype html><meta charset="utf-8"><title>element demo</title><script src="./element.umd.js"></script><script>console.log(element)</script>
|
|
@@ -0,0 +1,350 @@
|
|
|
1
|
+
(function webpackUniversalModuleDefinition(root, factory) {
|
|
2
|
+
if(typeof exports === 'object' && typeof module === 'object')
|
|
3
|
+
module.exports = factory();
|
|
4
|
+
else if(typeof define === 'function' && define.amd)
|
|
5
|
+
define([], factory);
|
|
6
|
+
else {
|
|
7
|
+
var a = factory();
|
|
8
|
+
for(var i in a) (typeof exports === 'object' ? exports : root)[i] = a[i];
|
|
9
|
+
}
|
|
10
|
+
})((typeof self !== 'undefined' ? self : this), function() {
|
|
11
|
+
return /******/ (function() { // webpackBootstrap
|
|
12
|
+
/******/ var __webpack_modules__ = ({
|
|
13
|
+
|
|
14
|
+
/***/ 3:
|
|
15
|
+
/***/ (function(module, exports) {
|
|
16
|
+
|
|
17
|
+
var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;// addapted from the document.currentScript polyfill by Adam Miller
|
|
18
|
+
// MIT license
|
|
19
|
+
// source: https://github.com/amiller-gh/currentScript-polyfill
|
|
20
|
+
|
|
21
|
+
// added support for Firefox https://bugzilla.mozilla.org/show_bug.cgi?id=1620505
|
|
22
|
+
|
|
23
|
+
(function (root, factory) {
|
|
24
|
+
if (true) {
|
|
25
|
+
!(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory),
|
|
26
|
+
__WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
|
|
27
|
+
(__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),
|
|
28
|
+
__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
|
|
29
|
+
} else {}
|
|
30
|
+
}(typeof self !== 'undefined' ? self : this, function () {
|
|
31
|
+
function getCurrentScript () {
|
|
32
|
+
var descriptor = Object.getOwnPropertyDescriptor(document, 'currentScript')
|
|
33
|
+
// for chrome
|
|
34
|
+
if (!descriptor && 'currentScript' in document && document.currentScript) {
|
|
35
|
+
return document.currentScript
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
// for other browsers with native support for currentScript
|
|
39
|
+
if (descriptor && descriptor.get !== getCurrentScript && document.currentScript) {
|
|
40
|
+
return document.currentScript
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
// IE 8-10 support script readyState
|
|
44
|
+
// IE 11+ & Firefox support stack trace
|
|
45
|
+
try {
|
|
46
|
+
throw new Error();
|
|
47
|
+
}
|
|
48
|
+
catch (err) {
|
|
49
|
+
// Find the second match for the "at" string to get file src url from stack.
|
|
50
|
+
var ieStackRegExp = /.*at [^(]*\((.*):(.+):(.+)\)$/ig,
|
|
51
|
+
ffStackRegExp = /@([^@]*):(\d+):(\d+)\s*$/ig,
|
|
52
|
+
stackDetails = ieStackRegExp.exec(err.stack) || ffStackRegExp.exec(err.stack),
|
|
53
|
+
scriptLocation = (stackDetails && stackDetails[1]) || false,
|
|
54
|
+
line = (stackDetails && stackDetails[2]) || false,
|
|
55
|
+
currentLocation = document.location.href.replace(document.location.hash, ''),
|
|
56
|
+
pageSource,
|
|
57
|
+
inlineScriptSourceRegExp,
|
|
58
|
+
inlineScriptSource,
|
|
59
|
+
scripts = document.getElementsByTagName('script'); // Live NodeList collection
|
|
60
|
+
|
|
61
|
+
if (scriptLocation === currentLocation) {
|
|
62
|
+
pageSource = document.documentElement.outerHTML;
|
|
63
|
+
inlineScriptSourceRegExp = new RegExp('(?:[^\\n]+?\\n){0,' + (line - 2) + '}[^<]*<script>([\\d\\D]*?)<\\/script>[\\d\\D]*', 'i');
|
|
64
|
+
inlineScriptSource = pageSource.replace(inlineScriptSourceRegExp, '$1').trim();
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
for (var i = 0; i < scripts.length; i++) {
|
|
68
|
+
// If ready state is interactive, return the script tag
|
|
69
|
+
if (scripts[i].readyState === 'interactive') {
|
|
70
|
+
return scripts[i];
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
// If src matches, return the script tag
|
|
74
|
+
if (scripts[i].src === scriptLocation) {
|
|
75
|
+
return scripts[i];
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
// If inline source matches, return the script tag
|
|
79
|
+
if (
|
|
80
|
+
scriptLocation === currentLocation &&
|
|
81
|
+
scripts[i].innerHTML &&
|
|
82
|
+
scripts[i].innerHTML.trim() === inlineScriptSource
|
|
83
|
+
) {
|
|
84
|
+
return scripts[i];
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
// If no match, return null
|
|
89
|
+
return null;
|
|
90
|
+
}
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
return getCurrentScript
|
|
94
|
+
}));
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
/***/ })
|
|
98
|
+
|
|
99
|
+
/******/ });
|
|
100
|
+
/************************************************************************/
|
|
101
|
+
/******/ // The module cache
|
|
102
|
+
/******/ var __webpack_module_cache__ = {};
|
|
103
|
+
/******/
|
|
104
|
+
/******/ // The require function
|
|
105
|
+
/******/ function __webpack_require__(moduleId) {
|
|
106
|
+
/******/ // Check if module is in cache
|
|
107
|
+
/******/ var cachedModule = __webpack_module_cache__[moduleId];
|
|
108
|
+
/******/ if (cachedModule !== undefined) {
|
|
109
|
+
/******/ return cachedModule.exports;
|
|
110
|
+
/******/ }
|
|
111
|
+
/******/ // Create a new module (and put it into the cache)
|
|
112
|
+
/******/ var module = __webpack_module_cache__[moduleId] = {
|
|
113
|
+
/******/ // no module.id needed
|
|
114
|
+
/******/ // no module.loaded needed
|
|
115
|
+
/******/ exports: {}
|
|
116
|
+
/******/ };
|
|
117
|
+
/******/
|
|
118
|
+
/******/ // Execute the module function
|
|
119
|
+
/******/ __webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__);
|
|
120
|
+
/******/
|
|
121
|
+
/******/ // Return the exports of the module
|
|
122
|
+
/******/ return module.exports;
|
|
123
|
+
/******/ }
|
|
124
|
+
/******/
|
|
125
|
+
/************************************************************************/
|
|
126
|
+
/******/ /* webpack/runtime/define property getters */
|
|
127
|
+
/******/ !function() {
|
|
128
|
+
/******/ // define getter functions for harmony exports
|
|
129
|
+
/******/ __webpack_require__.d = function(exports, definition) {
|
|
130
|
+
/******/ for(var key in definition) {
|
|
131
|
+
/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
|
|
132
|
+
/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
|
|
133
|
+
/******/ }
|
|
134
|
+
/******/ }
|
|
135
|
+
/******/ };
|
|
136
|
+
/******/ }();
|
|
137
|
+
/******/
|
|
138
|
+
/******/ /* webpack/runtime/hasOwnProperty shorthand */
|
|
139
|
+
/******/ !function() {
|
|
140
|
+
/******/ __webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); }
|
|
141
|
+
/******/ }();
|
|
142
|
+
/******/
|
|
143
|
+
/******/ /* webpack/runtime/make namespace object */
|
|
144
|
+
/******/ !function() {
|
|
145
|
+
/******/ // define __esModule on exports
|
|
146
|
+
/******/ __webpack_require__.r = function(exports) {
|
|
147
|
+
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
|
|
148
|
+
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
149
|
+
/******/ }
|
|
150
|
+
/******/ Object.defineProperty(exports, '__esModule', { value: true });
|
|
151
|
+
/******/ };
|
|
152
|
+
/******/ }();
|
|
153
|
+
/******/
|
|
154
|
+
/******/ /* webpack/runtime/publicPath */
|
|
155
|
+
/******/ !function() {
|
|
156
|
+
/******/ __webpack_require__.p = "";
|
|
157
|
+
/******/ }();
|
|
158
|
+
/******/
|
|
159
|
+
/************************************************************************/
|
|
160
|
+
var __webpack_exports__ = {};
|
|
161
|
+
// This entry need to be wrapped in an IIFE because it need to be in strict mode.
|
|
162
|
+
!function() {
|
|
163
|
+
"use strict";
|
|
164
|
+
// ESM COMPAT FLAG
|
|
165
|
+
__webpack_require__.r(__webpack_exports__);
|
|
166
|
+
|
|
167
|
+
// EXPORTS
|
|
168
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
169
|
+
"default": function() { return /* binding */ entry_lib; }
|
|
170
|
+
});
|
|
171
|
+
|
|
172
|
+
;// CONCATENATED MODULE: ./node_modules/@vue/cli-service/lib/commands/build/setPublicPath.js
|
|
173
|
+
/* eslint-disable no-var */
|
|
174
|
+
// This file is imported into lib/wc client bundles.
|
|
175
|
+
|
|
176
|
+
if (typeof window !== 'undefined') {
|
|
177
|
+
var currentScript = window.document.currentScript
|
|
178
|
+
if (true) {
|
|
179
|
+
var getCurrentScript = __webpack_require__(3)
|
|
180
|
+
currentScript = getCurrentScript()
|
|
181
|
+
|
|
182
|
+
// for backward compatibility, because previously we directly included the polyfill
|
|
183
|
+
if (!('currentScript' in document)) {
|
|
184
|
+
Object.defineProperty(document, 'currentScript', { get: getCurrentScript })
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
var src = currentScript && currentScript.src.match(/(.+\/)[^/]+\.js(\?.*)?$/)
|
|
189
|
+
if (src) {
|
|
190
|
+
__webpack_require__.p = src[1] // eslint-disable-line
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
// Indicate to webpack that this file can be concatenated
|
|
195
|
+
/* harmony default export */ var setPublicPath = (null);
|
|
196
|
+
|
|
197
|
+
;// CONCATENATED MODULE: ./node_modules/thread-loader/dist/cjs.js!./node_modules/babel-loader/lib/index.js??clonedRuleSet-40.use[1]!./node_modules/@vue/vue-loader-v15/lib/loaders/templateLoader.js??ruleSet[1].rules[3]!./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./src/element-ui/View3D/index.vue?vue&type=template&id=ad6f53ee&scoped=true
|
|
198
|
+
var render = function render() {
|
|
199
|
+
var _vm = this,
|
|
200
|
+
_c = _vm._self._c;
|
|
201
|
+
return _c('div', [_vm._v("888888")]);
|
|
202
|
+
};
|
|
203
|
+
var staticRenderFns = [];
|
|
204
|
+
|
|
205
|
+
;// CONCATENATED MODULE: ./node_modules/thread-loader/dist/cjs.js!./node_modules/babel-loader/lib/index.js??clonedRuleSet-40.use[1]!./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./src/element-ui/View3D/index.vue?vue&type=script&lang=js
|
|
206
|
+
/* harmony default export */ var View3Dvue_type_script_lang_js = ({
|
|
207
|
+
name: "elementTable",
|
|
208
|
+
data: function data() {
|
|
209
|
+
return {};
|
|
210
|
+
},
|
|
211
|
+
mounted: function mounted() {},
|
|
212
|
+
methods: {}
|
|
213
|
+
});
|
|
214
|
+
;// CONCATENATED MODULE: ./src/element-ui/View3D/index.vue?vue&type=script&lang=js
|
|
215
|
+
/* harmony default export */ var element_ui_View3Dvue_type_script_lang_js = (View3Dvue_type_script_lang_js);
|
|
216
|
+
;// CONCATENATED MODULE: ./node_modules/@vue/vue-loader-v15/lib/runtime/componentNormalizer.js
|
|
217
|
+
/* globals __VUE_SSR_CONTEXT__ */
|
|
218
|
+
|
|
219
|
+
// IMPORTANT: Do NOT use ES2015 features in this file (except for modules).
|
|
220
|
+
// This module is a runtime utility for cleaner component module output and will
|
|
221
|
+
// be included in the final webpack user bundle.
|
|
222
|
+
|
|
223
|
+
function normalizeComponent(
|
|
224
|
+
scriptExports,
|
|
225
|
+
render,
|
|
226
|
+
staticRenderFns,
|
|
227
|
+
functionalTemplate,
|
|
228
|
+
injectStyles,
|
|
229
|
+
scopeId,
|
|
230
|
+
moduleIdentifier /* server only */,
|
|
231
|
+
shadowMode /* vue-cli only */
|
|
232
|
+
) {
|
|
233
|
+
// Vue.extend constructor export interop
|
|
234
|
+
var options =
|
|
235
|
+
typeof scriptExports === 'function' ? scriptExports.options : scriptExports
|
|
236
|
+
|
|
237
|
+
// render functions
|
|
238
|
+
if (render) {
|
|
239
|
+
options.render = render
|
|
240
|
+
options.staticRenderFns = staticRenderFns
|
|
241
|
+
options._compiled = true
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
// functional template
|
|
245
|
+
if (functionalTemplate) {
|
|
246
|
+
options.functional = true
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
// scopedId
|
|
250
|
+
if (scopeId) {
|
|
251
|
+
options._scopeId = 'data-v-' + scopeId
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
var hook
|
|
255
|
+
if (moduleIdentifier) {
|
|
256
|
+
// server build
|
|
257
|
+
hook = function (context) {
|
|
258
|
+
// 2.3 injection
|
|
259
|
+
context =
|
|
260
|
+
context || // cached call
|
|
261
|
+
(this.$vnode && this.$vnode.ssrContext) || // stateful
|
|
262
|
+
(this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional
|
|
263
|
+
// 2.2 with runInNewContext: true
|
|
264
|
+
if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {
|
|
265
|
+
context = __VUE_SSR_CONTEXT__
|
|
266
|
+
}
|
|
267
|
+
// inject component styles
|
|
268
|
+
if (injectStyles) {
|
|
269
|
+
injectStyles.call(this, context)
|
|
270
|
+
}
|
|
271
|
+
// register component module identifier for async chunk inferrence
|
|
272
|
+
if (context && context._registeredComponents) {
|
|
273
|
+
context._registeredComponents.add(moduleIdentifier)
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
// used by ssr in case component is cached and beforeCreate
|
|
277
|
+
// never gets called
|
|
278
|
+
options._ssrRegister = hook
|
|
279
|
+
} else if (injectStyles) {
|
|
280
|
+
hook = shadowMode
|
|
281
|
+
? function () {
|
|
282
|
+
injectStyles.call(
|
|
283
|
+
this,
|
|
284
|
+
(options.functional ? this.parent : this).$root.$options.shadowRoot
|
|
285
|
+
)
|
|
286
|
+
}
|
|
287
|
+
: injectStyles
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
if (hook) {
|
|
291
|
+
if (options.functional) {
|
|
292
|
+
// for template-only hot-reload because in that case the render fn doesn't
|
|
293
|
+
// go through the normalizer
|
|
294
|
+
options._injectStyles = hook
|
|
295
|
+
// register for functional component in vue file
|
|
296
|
+
var originalRender = options.render
|
|
297
|
+
options.render = function renderWithStyleInjection(h, context) {
|
|
298
|
+
hook.call(context)
|
|
299
|
+
return originalRender(h, context)
|
|
300
|
+
}
|
|
301
|
+
} else {
|
|
302
|
+
// inject component registration as beforeCreate hook
|
|
303
|
+
var existing = options.beforeCreate
|
|
304
|
+
options.beforeCreate = existing ? [].concat(existing, hook) : [hook]
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
return {
|
|
309
|
+
exports: scriptExports,
|
|
310
|
+
options: options
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
;// CONCATENATED MODULE: ./src/element-ui/View3D/index.vue
|
|
315
|
+
|
|
316
|
+
|
|
317
|
+
|
|
318
|
+
|
|
319
|
+
|
|
320
|
+
/* normalize component */
|
|
321
|
+
;
|
|
322
|
+
var component = normalizeComponent(
|
|
323
|
+
element_ui_View3Dvue_type_script_lang_js,
|
|
324
|
+
render,
|
|
325
|
+
staticRenderFns,
|
|
326
|
+
false,
|
|
327
|
+
null,
|
|
328
|
+
"ad6f53ee",
|
|
329
|
+
null
|
|
330
|
+
|
|
331
|
+
)
|
|
332
|
+
|
|
333
|
+
/* harmony default export */ var View3D = (component.exports);
|
|
334
|
+
;// CONCATENATED MODULE: ./src/element-ui/element.js
|
|
335
|
+
|
|
336
|
+
/* harmony default export */ var element_ui_element = ({
|
|
337
|
+
// 组件
|
|
338
|
+
View3D: View3D
|
|
339
|
+
});
|
|
340
|
+
;// CONCATENATED MODULE: ./node_modules/@vue/cli-service/lib/commands/build/entry-lib.js
|
|
341
|
+
|
|
342
|
+
|
|
343
|
+
/* harmony default export */ var entry_lib = (element_ui_element);
|
|
344
|
+
|
|
345
|
+
|
|
346
|
+
}();
|
|
347
|
+
/******/ return __webpack_exports__;
|
|
348
|
+
/******/ })()
|
|
349
|
+
;
|
|
350
|
+
});
|