icarys-form-create-vant 1.0.3 → 1.0.4
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 +1 -1
- package/dist/index.js +21 -17787
- package/dist/index.min.js +3 -3
- package/dist/index.min.js.map +1 -1
- package/package.json +5 -2
- package/src/components/common/subform/LICENSE +21 -0
- package/src/components/common/subform/README.md +6 -0
- package/src/components/common/subform/package.json +48 -0
- package/src/components/common/subform/src/component.jsx +75 -0
- package/src/components/common/subform/src/index.js +3 -0
- package/src/components/common/wangeditor/LICENSE +21 -0
- package/src/components/common/wangeditor/README.md +14 -0
- package/src/components/common/wangeditor/package-lock.json +114 -0
- package/src/components/common/wangeditor/package.json +52 -0
- package/src/components/common/wangeditor/src/component.jsx +74 -0
- package/src/components/common/wangeditor/src/index.js +3 -0
- package/src/core/LICENSE +21 -0
- package/src/core/README.md +120 -0
- package/src/core/babel.config.js +13 -0
- package/src/core/bili.config.js +34 -0
- package/src/core/package-lock.json +13 -0
- package/src/core/package.json +61 -0
- package/src/core/src/components/formCreate.js +287 -0
- package/src/core/src/components/fragment.js +12 -0
- package/src/core/src/factory/context.js +264 -0
- package/src/core/src/factory/creator.js +63 -0
- package/src/core/src/factory/maker.js +17 -0
- package/src/core/src/factory/manager.js +87 -0
- package/src/core/src/factory/node.js +89 -0
- package/src/core/src/factory/parser.js +28 -0
- package/src/core/src/frame/api.js +691 -0
- package/src/core/src/frame/attrs.js +12 -0
- package/src/core/src/frame/dataDriver.js +76 -0
- package/src/core/src/frame/fetch.js +128 -0
- package/src/core/src/frame/index.js +792 -0
- package/src/core/src/frame/language.js +50 -0
- package/src/core/src/frame/provider.js +297 -0
- package/src/core/src/frame/util.js +311 -0
- package/src/core/src/handler/context.js +573 -0
- package/src/core/src/handler/effect.js +122 -0
- package/src/core/src/handler/index.js +143 -0
- package/src/core/src/handler/inject.js +199 -0
- package/src/core/src/handler/input.js +199 -0
- package/src/core/src/handler/lifecycle.js +55 -0
- package/src/core/src/handler/loader.js +375 -0
- package/src/core/src/handler/page.js +46 -0
- package/src/core/src/handler/render.js +29 -0
- package/src/core/src/index.js +12 -0
- package/src/core/src/parser/html.js +17 -0
- package/src/core/src/render/cache.js +47 -0
- package/src/core/src/render/index.js +33 -0
- package/src/core/src/render/render.js +418 -0
- package/src/core/types/index.d.ts +842 -0
- package/src/index.js +5 -0
- package/src/utils/LICENSE +21 -0
- package/src/utils/README.md +24 -0
- package/src/utils/lib/console.js +16 -0
- package/src/utils/lib/debounce.js +9 -0
- package/src/utils/lib/deepextend.js +51 -0
- package/src/utils/lib/deepset.js +14 -0
- package/src/utils/lib/extend.js +20 -0
- package/src/utils/lib/index.js +14 -0
- package/src/utils/lib/json.js +90 -0
- package/src/utils/lib/mergeprops.js +62 -0
- package/src/utils/lib/mitt.js +43 -0
- package/src/utils/lib/modify.js +8 -0
- package/src/utils/lib/slot.js +8 -0
- package/src/utils/lib/toarray.js +5 -0
- package/src/utils/lib/tocase.js +11 -0
- package/src/utils/lib/todate.js +10 -0
- package/src/utils/lib/toline.js +10 -0
- package/src/utils/lib/topromise.js +10 -0
- package/src/utils/lib/tostring.js +7 -0
- package/src/utils/lib/type.js +45 -0
- package/src/utils/lib/unique.js +6 -0
- package/src/utils/package.json +32 -0
- package/src/vant/LICENSE +21 -0
- package/src/vant/README.md +137 -0
- package/src/vant/auto-import.d.ts +5 -0
- package/src/vant/auto-import.js +50 -0
- package/src/vant/babel.config.js +10 -0
- package/src/vant/bili.config.js +40 -0
- package/src/vant/examples/App.vue +96 -0
- package/src/vant/examples/main.js +13 -0
- package/src/vant/examples/rule.js +366 -0
- package/src/vant/package-lock.json +11367 -0
- package/src/vant/package.json +83 -0
- package/src/vant/public/index.html +14 -0
- package/src/vant/src/components/calendar.jsx +128 -0
- package/src/vant/src/components/cascader.jsx +120 -0
- package/src/vant/src/components/checkbox.jsx +38 -0
- package/src/vant/src/components/datePicker.jsx +87 -0
- package/src/vant/src/components/group.jsx +384 -0
- package/src/vant/src/components/icon/IconWarning.vue +12 -0
- package/src/vant/src/components/index.js +26 -0
- package/src/vant/src/components/radio.jsx +38 -0
- package/src/vant/src/components/select.jsx +81 -0
- package/src/vant/src/components/timePicker.jsx +76 -0
- package/src/vant/src/components/uploader.jsx +99 -0
- package/src/vant/src/core/alias.js +31 -0
- package/src/vant/src/core/api.js +135 -0
- package/src/vant/src/core/config.js +35 -0
- package/src/vant/src/core/index.js +45 -0
- package/src/vant/src/core/manager.js +282 -0
- package/src/vant/src/core/provider.js +63 -0
- package/src/vant/src/core/utils.js +15 -0
- package/src/vant/src/index.js +13 -0
- package/src/vant/src/parsers/hidden.js +12 -0
- package/src/vant/src/parsers/index.js +59 -0
- package/src/vant/src/parsers/row.js +10 -0
- package/src/vant/src/style/index.css +495 -0
- package/src/vant/types/config.d.ts +99 -0
- package/src/vant/types/index.d.ts +27 -0
- package/src/vant/vue.config.js +21 -0
package/src/index.js
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2022 xaboy
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# @form-create/utils
|
|
2
|
+
**form-create 是一个可以通过 JSON 生成具有动态渲染、数据收集、验证和提交功能的表单生成组件。支持6个UI框架,并且支持生成任何 Vue 组件。内置20种常用表单组件和自定义组件,再复杂的表单都可以轻松搞定。**
|
|
3
|
+
|
|
4
|
+
form-create is a form generation component that can generate dynamic rendering, data collection, verification and submission functions through JSON. Supports 5 UI frameworks, and supports the generation of any Vue components. Built-in 20 kinds of commonly used form components and custom components, no matter how complex forms can be easily handled.
|
|
5
|
+
|
|
6
|
+
[GitHub](https://github.com/xaboy/form-create) | [文档](http://form-create.com/v2) | [Document](http://form-create.com/en/v2)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
- **预览**
|
|
10
|
+
|
|
11
|
+

|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
- **操作表单**
|
|
15
|
+
|
|
16
|
+

|
|
17
|
+
|
|
18
|
+
- **`group` 组件**
|
|
19
|
+
|
|
20
|
+

|
|
21
|
+
|
|
22
|
+
- **`control` 配置项**
|
|
23
|
+
|
|
24
|
+

|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export function format(type, msg, rule) {
|
|
2
|
+
return (`[form-create ${type}]: ${msg}` + (rule ? ('\n\nrule: ' + JSON.stringify(rule.getRule ? rule.getRule() : rule)) : ''))
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
export function tip(msg, rule) {
|
|
6
|
+
console.warn(format('tip', msg, rule));
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export function err(msg, rule) {
|
|
10
|
+
console.error(format('err', msg, rule));
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export function logError(e) {
|
|
14
|
+
err(e.toString());
|
|
15
|
+
console.error(e);
|
|
16
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import {$set} from './modify';
|
|
2
|
+
import is from './type';
|
|
3
|
+
|
|
4
|
+
export default function deepExtend(origin, target = {}, mode) {
|
|
5
|
+
let isArr = false;
|
|
6
|
+
for (let key in target) {
|
|
7
|
+
if (Object.prototype.hasOwnProperty.call(target, key)) {
|
|
8
|
+
let clone = target[key];
|
|
9
|
+
if ((isArr = Array.isArray(clone)) || is.Object(clone)) {
|
|
10
|
+
let nst = origin[key] === undefined;
|
|
11
|
+
if (isArr) {
|
|
12
|
+
isArr = false;
|
|
13
|
+
nst && $set(origin, key, []);
|
|
14
|
+
} else if (clone._clone && mode !== undefined) {
|
|
15
|
+
if (mode) {
|
|
16
|
+
clone = clone.getRule();
|
|
17
|
+
nst && $set(origin, key, {});
|
|
18
|
+
} else {
|
|
19
|
+
$set(origin, key, clone._clone());
|
|
20
|
+
continue;
|
|
21
|
+
}
|
|
22
|
+
} else {
|
|
23
|
+
nst && $set(origin, key, {});
|
|
24
|
+
}
|
|
25
|
+
origin[key] = deepExtend(origin[key], clone, mode);
|
|
26
|
+
} else {
|
|
27
|
+
$set(origin, key, clone);
|
|
28
|
+
if (!is.Undef(clone)) {
|
|
29
|
+
if (!is.Undef(clone.__json)) {
|
|
30
|
+
origin[key].__json = clone.__json;
|
|
31
|
+
}
|
|
32
|
+
if (!is.Undef(clone.__origin)) {
|
|
33
|
+
origin[key].__origin = clone.__origin;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
return (mode !== undefined && Array.isArray(origin)) ? origin.filter(v => !v || !v.__ctrl) : origin
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export function deepCopy(value) {
|
|
43
|
+
return deepExtend({}, {value}).value;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export function deepExtendArgs(origin, ...lst) {
|
|
47
|
+
lst.forEach(target => {
|
|
48
|
+
origin = deepExtend(origin, target);
|
|
49
|
+
});
|
|
50
|
+
return origin;
|
|
51
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export default function deepSet(data, idx, val) {
|
|
2
|
+
let _data = data, to;
|
|
3
|
+
(idx || '').split('.').forEach(v => {
|
|
4
|
+
if (to) {
|
|
5
|
+
if (!_data[to] || typeof _data[to] != 'object') {
|
|
6
|
+
_data[to] = {}
|
|
7
|
+
}
|
|
8
|
+
_data = _data[to];
|
|
9
|
+
}
|
|
10
|
+
to = v;
|
|
11
|
+
})
|
|
12
|
+
_data[to] = val;
|
|
13
|
+
return _data;
|
|
14
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import {$set} from './modify';
|
|
2
|
+
|
|
3
|
+
const _extends = Object.assign || function (a) {
|
|
4
|
+
for (let b, c = 1; c < arguments.length; c++) {
|
|
5
|
+
for (let d in b = arguments[c], b) {
|
|
6
|
+
Object.prototype.hasOwnProperty.call(b, d) && ($set(a, d, b[d]));
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
return a;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export default function extend() {
|
|
14
|
+
return _extends.apply(this, arguments);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export function copy(obj) {
|
|
18
|
+
if (typeof obj !== 'object' || obj === null) return obj;
|
|
19
|
+
return obj instanceof Array ? [...obj] : {...obj};
|
|
20
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export {default as debounce} from './debounce';
|
|
2
|
+
export {default as toArray} from './toarray';
|
|
3
|
+
export {default as toString} from './tostring';
|
|
4
|
+
export {default as toPromise} from './topromise';
|
|
5
|
+
export {default as toLine} from './toline';
|
|
6
|
+
export {default as toDate} from './todate';
|
|
7
|
+
export {default as deepExtend, deepExtendArgs, deepCopy} from './deepextend';
|
|
8
|
+
export {default as extend, copy} from './extend';
|
|
9
|
+
export {parseJson, toJson} from './json';
|
|
10
|
+
export {$set, $del} from './modify';
|
|
11
|
+
export {default as is} from './type';
|
|
12
|
+
export {default as uniqueId} from './unique';
|
|
13
|
+
export {default as getSlot} from './slot';
|
|
14
|
+
export {default as deepSet} from './deepset';
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import deepExtend from './deepextend';
|
|
2
|
+
import {err} from './console';
|
|
3
|
+
import is from './type';
|
|
4
|
+
|
|
5
|
+
const PREFIX = '[[FORM-CREATE-PREFIX-';
|
|
6
|
+
const SUFFIX = '-FORM-CREATE-SUFFIX]]';
|
|
7
|
+
|
|
8
|
+
export function toJson(obj, space) {
|
|
9
|
+
return JSON.stringify(deepExtend(Array.isArray(obj) ? [] : {}, obj, true), function (key, val) {
|
|
10
|
+
if (val && val._isVue === true)
|
|
11
|
+
return undefined;
|
|
12
|
+
|
|
13
|
+
if (typeof val !== 'function') {
|
|
14
|
+
return val;
|
|
15
|
+
}
|
|
16
|
+
if (val.__json) {
|
|
17
|
+
return val.__json;
|
|
18
|
+
}
|
|
19
|
+
if (val.__origin)
|
|
20
|
+
val = val.__origin;
|
|
21
|
+
|
|
22
|
+
if (val.__emit)
|
|
23
|
+
return undefined;
|
|
24
|
+
return PREFIX + val + SUFFIX;
|
|
25
|
+
}, space);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
function makeFn(fn) {
|
|
29
|
+
return (new Function('return ' + fn))();
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export function parseFn(fn, mode) {
|
|
33
|
+
if (fn && is.String(fn) && fn.length > 4) {
|
|
34
|
+
let v = fn.trim();
|
|
35
|
+
let flag = false;
|
|
36
|
+
try {
|
|
37
|
+
if (v.indexOf(SUFFIX) > 0 && v.indexOf(PREFIX) === 0) {
|
|
38
|
+
v = v.replace(SUFFIX, '').replace(PREFIX, '');
|
|
39
|
+
flag = true;
|
|
40
|
+
} else if (v.indexOf('$FN:') === 0) {
|
|
41
|
+
v = v.substring(4);
|
|
42
|
+
flag = true;
|
|
43
|
+
} else if (v.indexOf('$EXEC:') === 0) {
|
|
44
|
+
v = v.substring(6);
|
|
45
|
+
flag = true;
|
|
46
|
+
} else if (v.indexOf('$GLOBAL:') === 0) {
|
|
47
|
+
const name = v.substring(8);
|
|
48
|
+
v = function (...args) {
|
|
49
|
+
const callback = args[0].api.getGlobalEvent(name);
|
|
50
|
+
if (callback) {
|
|
51
|
+
return callback.call(this, ...args);
|
|
52
|
+
}
|
|
53
|
+
return undefined;
|
|
54
|
+
}
|
|
55
|
+
v.__json = fn;
|
|
56
|
+
v.__inject = true;
|
|
57
|
+
return v;
|
|
58
|
+
} else if (v.indexOf('$FNX:') === 0) {
|
|
59
|
+
v = makeFn('function($inject){\n' + v.substring(5) + '\n}');
|
|
60
|
+
v.__json = fn;
|
|
61
|
+
v.__inject = true;
|
|
62
|
+
return v;
|
|
63
|
+
} else if (!mode && v.indexOf('function ') === 0 && v !== 'function ') {
|
|
64
|
+
flag = true;
|
|
65
|
+
} else if (!mode && v.indexOf('function(') === 0 && v !== 'function(') {
|
|
66
|
+
flag = true;
|
|
67
|
+
}
|
|
68
|
+
if (!flag) return fn;
|
|
69
|
+
let val;
|
|
70
|
+
try{
|
|
71
|
+
val = makeFn(v);
|
|
72
|
+
}catch (e){
|
|
73
|
+
val = makeFn('function ' + v);
|
|
74
|
+
}
|
|
75
|
+
val.__json = fn;
|
|
76
|
+
return val;
|
|
77
|
+
} catch (e) {
|
|
78
|
+
err(`解析失败:${v}\n\nerr: ${e}`);
|
|
79
|
+
return undefined;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
return fn;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
export function parseJson(json, mode) {
|
|
86
|
+
return JSON.parse(json, function (k, v) {
|
|
87
|
+
if (is.Undef(v) || !v.indexOf) return v;
|
|
88
|
+
return parseFn(v, mode);
|
|
89
|
+
});
|
|
90
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
export const normalMerge = ['props'];
|
|
2
|
+
export const toArrayMerge = ['class', 'style', 'directives'];
|
|
3
|
+
export const functionalMerge = ['on', 'hook'];
|
|
4
|
+
|
|
5
|
+
const mergeProps = (objects, initial = {}, opt = {}) => {
|
|
6
|
+
const _normalMerge = [...normalMerge, ...opt['normal'] || []];
|
|
7
|
+
const _toArrayMerge = [...toArrayMerge, ...opt['array'] || []];
|
|
8
|
+
const _functionalMerge = [...functionalMerge, ...opt['functional'] || []];
|
|
9
|
+
const propsMerge = opt['props'] || [];
|
|
10
|
+
|
|
11
|
+
return objects.reduce((a, b) => {
|
|
12
|
+
for (const key in b) {
|
|
13
|
+
if (a[key]) {
|
|
14
|
+
if (propsMerge.indexOf(key) > -1) {
|
|
15
|
+
a[key] = mergeProps([b[key]], a[key]);
|
|
16
|
+
} else if (_normalMerge.indexOf(key) > -1) {
|
|
17
|
+
a[key] = {...a[key], ...b[key]}
|
|
18
|
+
} else if (_toArrayMerge.indexOf(key) > -1) {
|
|
19
|
+
const arrA = a[key] instanceof Array ? a[key] : [a[key]];
|
|
20
|
+
const arrB = b[key] instanceof Array ? b[key] : [b[key]];
|
|
21
|
+
a[key] = [...arrA, ...arrB]
|
|
22
|
+
} else if (_functionalMerge.indexOf(key) > -1) {
|
|
23
|
+
for (const event in b[key]) {
|
|
24
|
+
if (a[key][event]) {
|
|
25
|
+
const arrA = a[key][event] instanceof Array ? a[key][event] : [a[key][event]];
|
|
26
|
+
const arrB = b[key][event] instanceof Array ? b[key][event] : [b[key][event]];
|
|
27
|
+
a[key][event] = [...arrA, ...arrB]
|
|
28
|
+
} else {
|
|
29
|
+
a[key][event] = b[key][event]
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
} else if (key === 'hook') {
|
|
33
|
+
for (let hook in b[key]) {
|
|
34
|
+
if (a[key][hook]) {
|
|
35
|
+
a[key][hook] = mergeFn(a[key][hook], b[key][hook])
|
|
36
|
+
} else {
|
|
37
|
+
a[key][hook] = b[key][hook]
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
} else {
|
|
41
|
+
a[key] = b[key]
|
|
42
|
+
}
|
|
43
|
+
} else {
|
|
44
|
+
if (_normalMerge.indexOf(key) > -1 || _functionalMerge.indexOf(key) > -1 || propsMerge.indexOf(key) > -1) {
|
|
45
|
+
a[key] = {...b[key]}
|
|
46
|
+
} else if (_toArrayMerge.indexOf(key) > -1) {
|
|
47
|
+
a[key] = b[key] instanceof Array ? [...b[key]] : (typeof b[key] === 'object' ? {...b[key]} : b[key]);
|
|
48
|
+
} else
|
|
49
|
+
a[key] = b[key];
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
return a
|
|
53
|
+
}, initial);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
const mergeFn = (fn1, fn2) =>
|
|
57
|
+
function () {
|
|
58
|
+
fn1 && fn1.apply(this, arguments);
|
|
59
|
+
fn2 && fn2.apply(this, arguments);
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
export default mergeProps;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
// https://github.com/developit/mitt
|
|
2
|
+
|
|
3
|
+
export default function Mitt(all) {
|
|
4
|
+
all = all || new Map();
|
|
5
|
+
|
|
6
|
+
const mitt = {
|
|
7
|
+
|
|
8
|
+
$on(type, handler) {
|
|
9
|
+
const handlers = all.get(type);
|
|
10
|
+
const added = handlers && handlers.push(handler);
|
|
11
|
+
if (!added) {
|
|
12
|
+
all.set(type, [handler]);
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
|
|
16
|
+
$once(type, handler) {
|
|
17
|
+
handler._once = true;
|
|
18
|
+
mitt.$on(type, handler);
|
|
19
|
+
},
|
|
20
|
+
|
|
21
|
+
$off(type, handler) {
|
|
22
|
+
const handlers = all.get(type);
|
|
23
|
+
if (handlers) {
|
|
24
|
+
handlers.splice(handlers.indexOf(handler) >>> 0, 1);
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
|
|
28
|
+
$emit(type, ...args) {
|
|
29
|
+
(all.get(type) || []).slice().map((handler) => {
|
|
30
|
+
if (handler._once) {
|
|
31
|
+
mitt.$off(type, handler);
|
|
32
|
+
delete handler._once;
|
|
33
|
+
}
|
|
34
|
+
handler(...args);
|
|
35
|
+
});
|
|
36
|
+
(all.get('*') || []).slice().map((handler) => {
|
|
37
|
+
handler(type, args);
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
return mitt;
|
|
43
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export default function toCase(str) {
|
|
2
|
+
const to = str.replace(/(-[a-z])/g, function (v) {
|
|
3
|
+
return v.replace('-', '').toLocaleUpperCase();
|
|
4
|
+
});
|
|
5
|
+
|
|
6
|
+
return lower(to);
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export function lower(str) {
|
|
10
|
+
return str.replace(str[0], str[0].toLowerCase());
|
|
11
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export default function toLine(name) {
|
|
2
|
+
let line = name.replace(/([A-Z])/g, '-$1').toLocaleLowerCase();
|
|
3
|
+
if (line.indexOf('-') === 0)
|
|
4
|
+
line = line.substr(1);
|
|
5
|
+
return line;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export function upper(str) {
|
|
9
|
+
return str.replace(str[0], str[0].toLocaleUpperCase());
|
|
10
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
const is = {
|
|
2
|
+
type(arg, type) {
|
|
3
|
+
return Object.prototype.toString.call(arg) === '[object ' + type + ']'
|
|
4
|
+
},
|
|
5
|
+
Undef(v) {
|
|
6
|
+
return v === undefined || v === null
|
|
7
|
+
},
|
|
8
|
+
Element(arg) {
|
|
9
|
+
return typeof arg === 'object' && arg !== null && arg.nodeType === 1 && !is.Object(arg)
|
|
10
|
+
},
|
|
11
|
+
trueArray(data) {
|
|
12
|
+
return Array.isArray(data) && data.length > 0;
|
|
13
|
+
},
|
|
14
|
+
Function(v) {
|
|
15
|
+
const type = this.getType(v);
|
|
16
|
+
return type === 'Function' || type === 'AsyncFunction';
|
|
17
|
+
},
|
|
18
|
+
getType(v) {
|
|
19
|
+
const str = Object.prototype.toString.call(v)
|
|
20
|
+
return /^\[object (.*)\]$/.exec(str)[1]
|
|
21
|
+
},
|
|
22
|
+
empty(value) {
|
|
23
|
+
if (value === undefined || value === null) {
|
|
24
|
+
return true;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
if (Array.isArray(value) && Array.isArray(value) && !value.length) {
|
|
28
|
+
return true;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
return typeof value === 'string' && !value;
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
['Date', 'Object', 'String', 'Boolean', 'Array', 'Number'].forEach(t => {
|
|
36
|
+
is[t] = function (arg) {
|
|
37
|
+
return is.type(arg, t);
|
|
38
|
+
}
|
|
39
|
+
})
|
|
40
|
+
|
|
41
|
+
export function hasProperty(rule, k) {
|
|
42
|
+
return ({}).hasOwnProperty.call(rule, k)
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export default is;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@form-create/utils",
|
|
3
|
+
"version": "3.2.31",
|
|
4
|
+
"description": "",
|
|
5
|
+
"main": "./lib/index.js",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"test": "echo \"Error: no test specified\" && exit 1"
|
|
8
|
+
},
|
|
9
|
+
"files": [
|
|
10
|
+
"README.md",
|
|
11
|
+
"package.json",
|
|
12
|
+
"LICENSE",
|
|
13
|
+
"lib"
|
|
14
|
+
],
|
|
15
|
+
"keywords": [
|
|
16
|
+
"@form-create"
|
|
17
|
+
],
|
|
18
|
+
"repository": {
|
|
19
|
+
"type": "git",
|
|
20
|
+
"url": "git+https://github.com/xaboy/form-create.git"
|
|
21
|
+
},
|
|
22
|
+
"author": "xaboy",
|
|
23
|
+
"license": "MIT",
|
|
24
|
+
"bugs": {
|
|
25
|
+
"url": "https://github.com/xaboy/form-create/issues"
|
|
26
|
+
},
|
|
27
|
+
"homepage": "http://www.form-create.com",
|
|
28
|
+
"publishConfig": {
|
|
29
|
+
"access": "public"
|
|
30
|
+
},
|
|
31
|
+
"gitHead": "3d024534b3ee103a96da1d3629582c0cdf19d9a8"
|
|
32
|
+
}
|
package/src/vant/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2022 xaboy
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|