icarys-fc-vant 1.0.15 → 1.0.16
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 +87 -278
- package/dist/components/common/subform/package.json +48 -0
- package/dist/components/common/subform/src/component.jsx +75 -0
- package/dist/components/common/subform/src/index.js +3 -0
- package/dist/components/common/wangeditor/package-lock.json +114 -0
- package/dist/components/common/wangeditor/package.json +52 -0
- package/dist/components/common/wangeditor/src/component.jsx +74 -0
- package/dist/components/common/wangeditor/src/index.js +3 -0
- package/dist/core/babel.config.js +13 -0
- package/dist/core/bili.config.js +34 -0
- package/dist/core/package-lock.json +13 -0
- package/dist/core/package.json +61 -0
- package/dist/core/src/components/formCreate.js +287 -0
- package/dist/core/src/components/fragment.js +12 -0
- package/dist/core/src/factory/context.js +264 -0
- package/dist/core/src/factory/creator.js +63 -0
- package/dist/core/src/factory/maker.js +17 -0
- package/dist/core/src/factory/manager.js +87 -0
- package/dist/core/src/factory/node.js +89 -0
- package/dist/core/src/factory/parser.js +28 -0
- package/dist/core/src/frame/api.js +691 -0
- package/dist/core/src/frame/attrs.js +12 -0
- package/dist/core/src/frame/dataDriver.js +76 -0
- package/dist/core/src/frame/fetch.js +128 -0
- package/dist/core/src/frame/index.js +792 -0
- package/dist/core/src/frame/language.js +50 -0
- package/dist/core/src/frame/provider.js +297 -0
- package/dist/core/src/frame/util.js +311 -0
- package/dist/core/src/handler/context.js +573 -0
- package/dist/core/src/handler/effect.js +122 -0
- package/dist/core/src/handler/index.js +143 -0
- package/dist/core/src/handler/inject.js +199 -0
- package/dist/core/src/handler/input.js +199 -0
- package/dist/core/src/handler/lifecycle.js +55 -0
- package/dist/core/src/handler/loader.js +375 -0
- package/dist/core/src/handler/page.js +46 -0
- package/dist/core/src/handler/render.js +29 -0
- package/dist/core/src/index.js +12 -0
- package/dist/core/src/parser/html.js +17 -0
- package/dist/core/src/render/cache.js +47 -0
- package/dist/core/src/render/index.js +33 -0
- package/dist/core/src/render/render.js +418 -0
- package/dist/core/types/index.d.ts +842 -0
- package/dist/icarys-fc-vant.umd.js +17 -0
- package/dist/index.d.ts +27 -0
- package/dist/index.esm.js +39 -0
- package/dist/index.js +46 -0
- package/dist/utils/lib/console.js +16 -0
- package/dist/utils/lib/debounce.js +9 -0
- package/dist/utils/lib/deepextend.js +51 -0
- package/dist/utils/lib/deepset.js +14 -0
- package/dist/utils/lib/extend.js +20 -0
- package/dist/utils/lib/index.js +14 -0
- package/dist/utils/lib/json.js +90 -0
- package/dist/utils/lib/mergeprops.js +62 -0
- package/dist/utils/lib/mitt.js +43 -0
- package/dist/utils/lib/modify.js +8 -0
- package/dist/utils/lib/slot.js +8 -0
- package/dist/utils/lib/toarray.js +5 -0
- package/dist/utils/lib/tocase.js +11 -0
- package/dist/utils/lib/todate.js +10 -0
- package/dist/utils/lib/toline.js +10 -0
- package/dist/utils/lib/topromise.js +10 -0
- package/dist/utils/lib/tostring.js +7 -0
- package/dist/utils/lib/type.js +45 -0
- package/dist/utils/lib/unique.js +6 -0
- package/dist/utils/package.json +32 -0
- package/dist/vant/auto-import.d.ts +5 -0
- package/dist/vant/auto-import.js +50 -0
- package/dist/vant/babel.config.js +10 -0
- package/dist/vant/bili.config.js +40 -0
- package/dist/vant/examples/main.js +13 -0
- package/dist/vant/examples/rule.js +366 -0
- package/dist/vant/package.json +83 -0
- package/dist/vant/src/components/calendar.jsx +128 -0
- package/dist/vant/src/components/cascader.jsx +120 -0
- package/dist/vant/src/components/checkbox.jsx +38 -0
- package/dist/vant/src/components/datePicker.jsx +87 -0
- package/dist/vant/src/components/group.jsx +384 -0
- package/dist/vant/src/components/index.js +26 -0
- package/dist/vant/src/components/radio.jsx +38 -0
- package/dist/vant/src/components/select.jsx +81 -0
- package/dist/vant/src/components/timePicker.jsx +76 -0
- package/dist/vant/src/components/uploader.jsx +99 -0
- package/dist/vant/src/core/alias.js +31 -0
- package/dist/vant/src/core/api.js +135 -0
- package/dist/vant/src/core/config.js +35 -0
- package/dist/vant/src/core/index.js +45 -0
- package/dist/vant/src/core/manager.js +282 -0
- package/dist/vant/src/core/provider.js +63 -0
- package/dist/vant/src/core/utils.js +15 -0
- package/dist/vant/src/index.js +13 -0
- package/dist/vant/src/parsers/hidden.js +12 -0
- package/dist/vant/src/parsers/index.js +59 -0
- package/dist/vant/src/parsers/row.js +10 -0
- package/dist/vant/src/style/index.css +495 -0
- package/dist/vant/types/config.d.ts +99 -0
- package/dist/vant/types/index.d.ts +27 -0
- package/dist/vant/vue.config.js +21 -0
- package/package.json +29 -67
- package/dist/index.min.js +0 -7411
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import {deepGet} from './util';
|
|
2
|
+
|
|
3
|
+
function getCookie(name) {
|
|
4
|
+
name = name + '=';
|
|
5
|
+
|
|
6
|
+
const decodedCookie = decodeURIComponent(document.cookie);
|
|
7
|
+
const cookieArray = decodedCookie.split(';');
|
|
8
|
+
|
|
9
|
+
for (let i = 0; i < cookieArray.length; i++) {
|
|
10
|
+
let cookie = cookieArray[i];
|
|
11
|
+
while (cookie.charAt(0) === ' ') {
|
|
12
|
+
cookie = cookie.substring(1);
|
|
13
|
+
}
|
|
14
|
+
if (cookie.indexOf(name) === 0) {
|
|
15
|
+
cookie = cookie.substring(name.length, cookie.length);
|
|
16
|
+
try {
|
|
17
|
+
return JSON.parse(cookie);
|
|
18
|
+
} catch (e) {
|
|
19
|
+
return cookie;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
return null;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
function getLocalStorage(name) {
|
|
27
|
+
const value = localStorage.getItem(name);
|
|
28
|
+
if (value) {
|
|
29
|
+
try {
|
|
30
|
+
return JSON.parse(value);
|
|
31
|
+
} catch (e) {
|
|
32
|
+
return value;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
return null;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
function getSessionStorage(name) {
|
|
39
|
+
const value = sessionStorage.getItem(name);
|
|
40
|
+
if (value) {
|
|
41
|
+
try {
|
|
42
|
+
return JSON.parse(value);
|
|
43
|
+
} catch (e) {
|
|
44
|
+
return value;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
return null;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export function baseDriver(driver, name) {
|
|
51
|
+
if (!name) {
|
|
52
|
+
return null;
|
|
53
|
+
}
|
|
54
|
+
const split = name.split('.');
|
|
55
|
+
let value = driver(split.shift());
|
|
56
|
+
|
|
57
|
+
if (!split.length) {
|
|
58
|
+
return value;
|
|
59
|
+
}
|
|
60
|
+
if (value == null) {
|
|
61
|
+
return null;
|
|
62
|
+
}
|
|
63
|
+
return deepGet(value, split);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
export function cookieDriver(name) {
|
|
67
|
+
return baseDriver(getCookie, name);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
export function localStorageDriver(name) {
|
|
71
|
+
return baseDriver(getLocalStorage, name);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
export function sessionStorageDriver(name) {
|
|
75
|
+
return baseDriver(getSessionStorage, name);
|
|
76
|
+
}
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
// https://github.com/ElemeFE/element/blob/dev/packages/upload/src/ajax.js
|
|
2
|
+
|
|
3
|
+
import is from '../../../utils/lib/type';
|
|
4
|
+
import {parseFn} from '../../../utils/lib/json';
|
|
5
|
+
import {deepGet} from './util';
|
|
6
|
+
import {toPromise} from '@form-create/utils';
|
|
7
|
+
|
|
8
|
+
function getError(action, option, xhr) {
|
|
9
|
+
const msg = `fail to ${action} ${xhr.status}'`;
|
|
10
|
+
const err = new Error(msg);
|
|
11
|
+
err.status = xhr.status;
|
|
12
|
+
err.url = action;
|
|
13
|
+
return err;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
function getBody(xhr) {
|
|
17
|
+
const text = xhr.responseText || xhr.response;
|
|
18
|
+
if (!text) {
|
|
19
|
+
return text;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
try {
|
|
23
|
+
return JSON.parse(text);
|
|
24
|
+
} catch (e) {
|
|
25
|
+
return text;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export default function fetch(option) {
|
|
30
|
+
if (typeof XMLHttpRequest === 'undefined') {
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
const xhr = new XMLHttpRequest();
|
|
35
|
+
let action = option.action || '';
|
|
36
|
+
|
|
37
|
+
if (xhr.upload && option.onProgress) {
|
|
38
|
+
xhr.upload.addEventListener('progress', (evt) => {
|
|
39
|
+
evt.percent = evt.total > 0 ? (evt.loaded / evt.total) * 100 : 0
|
|
40
|
+
option.onProgress(evt)
|
|
41
|
+
})
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
if (option.query) {
|
|
45
|
+
const query = is.String(option.query) ? option.query : Object.keys(option.query).reduce((acc, key) => {
|
|
46
|
+
acc[key] = (option.query[key] === null || option.query[key] === undefined) ? '' : option.query[key];
|
|
47
|
+
return acc;
|
|
48
|
+
}, {});
|
|
49
|
+
const queryString = new URLSearchParams(query).toString();
|
|
50
|
+
if (queryString) {
|
|
51
|
+
if (action.includes('?')) {
|
|
52
|
+
action += `&${queryString}`;
|
|
53
|
+
} else {
|
|
54
|
+
action += `?${queryString}`;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
xhr.onerror = function error(e) {
|
|
60
|
+
option.onError(e);
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
xhr.onload = function onload() {
|
|
64
|
+
if (xhr.status < 200 || xhr.status >= 300) {
|
|
65
|
+
return option.onError(getError(action, option, xhr), getBody(xhr));
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
option.onSuccess(getBody(xhr));
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
xhr.open(option.method || 'get', action, true);
|
|
72
|
+
|
|
73
|
+
let formData;
|
|
74
|
+
if (option.data || option.file) {
|
|
75
|
+
if (option.file || (option.dataType || '').toLowerCase() !== 'json') {
|
|
76
|
+
formData = new FormData();
|
|
77
|
+
Object.keys(option.data || {}).map(key => {
|
|
78
|
+
formData.append(key, option.data[key]);
|
|
79
|
+
});
|
|
80
|
+
} else {
|
|
81
|
+
formData = JSON.stringify(option.data || {});
|
|
82
|
+
xhr.setRequestHeader('content-type', 'application/json');
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
if(option.file){
|
|
87
|
+
formData.append(option.filename, option.file, option.file.name)
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
if (option.withCredentials && 'withCredentials' in xhr) {
|
|
91
|
+
xhr.withCredentials = true;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
const headers = option.headers || {};
|
|
95
|
+
|
|
96
|
+
Object.keys(headers).forEach(item => {
|
|
97
|
+
if (headers[item] != null) {
|
|
98
|
+
xhr.setRequestHeader(item, headers[item]);
|
|
99
|
+
}
|
|
100
|
+
});
|
|
101
|
+
xhr.send(formData);
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
export function asyncFetch(config, _fetch, api) {
|
|
106
|
+
return new Promise((resolve, reject) => {
|
|
107
|
+
(_fetch || fetch)({
|
|
108
|
+
...config,
|
|
109
|
+
onSuccess(res) {
|
|
110
|
+
let fn = (v) => v;
|
|
111
|
+
const parse = parseFn(config.parse);
|
|
112
|
+
if (is.Function(parse)) {
|
|
113
|
+
fn = parse;
|
|
114
|
+
} else if (parse && is.String(parse)) {
|
|
115
|
+
fn = (v) => {
|
|
116
|
+
return deepGet(v, parse);
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
toPromise(fn(res, config.targetRule, api)).then(res => {
|
|
120
|
+
resolve(res);
|
|
121
|
+
});
|
|
122
|
+
},
|
|
123
|
+
onError(err) {
|
|
124
|
+
reject(err);
|
|
125
|
+
}
|
|
126
|
+
})
|
|
127
|
+
});
|
|
128
|
+
}
|