@bdsoft/element 1.1.9 → 1.1.12
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/dist/BdElement.js +23111 -0
- package/index.js +11 -11
- package/package.json +2 -1
- package/global/index.ts +0 -6
- package/global/register-properties.ts +0 -10
- package/index.html +0 -13
- package/package-form/core/components/formCreate.js +0 -274
- package/package-form/core/components/fragment.js +0 -12
- package/package-form/core/factory/context.js +0 -257
- package/package-form/core/factory/creator.js +0 -63
- package/package-form/core/factory/maker.js +0 -17
- package/package-form/core/factory/manager.js +0 -79
- package/package-form/core/factory/node.js +0 -85
- package/package-form/core/factory/parser.js +0 -28
- package/package-form/core/frame/api.js +0 -599
- package/package-form/core/frame/attrs.js +0 -12
- package/package-form/core/frame/dataDriver.js +0 -76
- package/package-form/core/frame/fetch.js +0 -119
- package/package-form/core/frame/formCreate.js +0 -274
- package/package-form/core/frame/index.js +0 -760
- package/package-form/core/frame/provider.js +0 -288
- package/package-form/core/frame/util.js +0 -274
- package/package-form/core/handler/context.js +0 -380
- package/package-form/core/handler/effect.js +0 -122
- package/package-form/core/handler/index.js +0 -111
- package/package-form/core/handler/inject.js +0 -145
- package/package-form/core/handler/input.js +0 -197
- package/package-form/core/handler/lifecycle.js +0 -43
- package/package-form/core/handler/loader.js +0 -373
- package/package-form/core/handler/page.js +0 -46
- package/package-form/core/handler/render.js +0 -29
- package/package-form/core/index.js +0 -12
- package/package-form/core/package.json +0 -15
- package/package-form/core/parser/html.js +0 -17
- package/package-form/core/render/cache.js +0 -47
- package/package-form/core/render/index.js +0 -31
- package/package-form/core/render/render.js +0 -393
- package/package-form/element-form/components/checkbox/package.json +0 -17
- package/package-form/element-form/components/checkbox/src/component.jsx +0 -110
- package/package-form/element-form/components/checkbox/src/index.js +0 -3
- package/package-form/element-form/components/frame/package.json +0 -17
- package/package-form/element-form/components/frame/src/IconCircleClose.vue +0 -14
- package/package-form/element-form/components/frame/src/IconDelete.vue +0 -12
- package/package-form/element-form/components/frame/src/IconDocument.vue +0 -12
- package/package-form/element-form/components/frame/src/IconFolderOpened.vue +0 -12
- package/package-form/element-form/components/frame/src/IconView.vue +0 -12
- package/package-form/element-form/components/frame/src/component.jsx +0 -349
- package/package-form/element-form/components/frame/src/index.js +0 -3
- package/package-form/element-form/components/frame/src/style.css +0 -66
- package/package-form/element-form/components/group/package.json +0 -17
- package/package-form/element-form/components/group/src/component.jsx +0 -314
- package/package-form/element-form/components/group/src/index.js +0 -3
- package/package-form/element-form/components/group/src/style.css +0 -125
- package/package-form/element-form/components/index.js +0 -22
- package/package-form/element-form/components/radio/package.json +0 -17
- package/package-form/element-form/components/radio/src/component.jsx +0 -101
- package/package-form/element-form/components/radio/src/index.js +0 -3
- package/package-form/element-form/components/select/package.json +0 -17
- package/package-form/element-form/components/select/src/component.jsx +0 -52
- package/package-form/element-form/components/select/src/index.js +0 -3
- package/package-form/element-form/components/subform/package.json +0 -14
- package/package-form/element-form/components/subform/src/component.jsx +0 -76
- package/package-form/element-form/components/subform/src/index.js +0 -3
- package/package-form/element-form/components/tree/package.json +0 -17
- package/package-form/element-form/components/tree/src/component.jsx +0 -62
- package/package-form/element-form/components/tree/src/index.js +0 -3
- package/package-form/element-form/components/upload/package.json +0 -17
- package/package-form/element-form/components/upload/src/IconUpload.vue +0 -12
- package/package-form/element-form/components/upload/src/component.jsx +0 -129
- package/package-form/element-form/components/upload/src/index.js +0 -3
- package/package-form/element-form/components/upload/src/style.css +0 -11
- package/package-form/element-form/index.js +0 -8
- package/package-form/element-form/package.json +0 -16
- package/package-form/element-form/src/components/icon/IconWarning.vue +0 -12
- package/package-form/element-form/src/components/index.js +0 -22
- package/package-form/element-form/src/core/alias.js +0 -34
- package/package-form/element-form/src/core/api.js +0 -208
- package/package-form/element-form/src/core/config.js +0 -62
- package/package-form/element-form/src/core/index.js +0 -60
- package/package-form/element-form/src/core/maker.js +0 -76
- package/package-form/element-form/src/core/manager.js +0 -315
- package/package-form/element-form/src/core/provider.js +0 -79
- package/package-form/element-form/src/parsers/datePicker.js +0 -31
- package/package-form/element-form/src/parsers/hidden.js +0 -12
- package/package-form/element-form/src/parsers/index.js +0 -17
- package/package-form/element-form/src/parsers/input.js +0 -21
- package/package-form/element-form/src/parsers/row.js +0 -10
- package/package-form/element-form/src/parsers/select.js +0 -15
- package/package-form/element-form/src/parsers/slider.js +0 -21
- package/package-form/element-form/src/parsers/timePicker.js +0 -17
- package/package-form/element-form/src/style/index.css +0 -52
- package/src/App.vue +0 -28
- package/src/assets/css/element.scss +0 -196
- package/src/assets/css/layout.scss +0 -215
- package/src/assets/css/tailwind.scss +0 -67
- package/src/assets/images/banner.gif +0 -0
- package/src/assets/images/banner.png +0 -0
- package/src/assets/images/bg1.svg +0 -22
- package/src/assets/images/bg2.png +0 -0
- package/src/assets/images/ff.png +0 -0
- package/src/assets/images/home-file1.png +0 -0
- package/src/assets/images/ky.png +0 -0
- package/src/assets/images/menu/add.png +0 -0
- package/src/assets/images/menu/del.png +0 -0
- package/src/assets/images/menu/down.png +0 -0
- package/src/assets/images/menu/dr.png +0 -0
- package/src/assets/images/menu/edit.png +0 -0
- package/src/assets/images/menu/kx.png +0 -0
- package/src/assets/images/menu/mb.png +0 -0
- package/src/assets/images/menu/pz.png +0 -0
- package/src/assets/images/menu/save.png +0 -0
- package/src/assets/images/menu/sj.png +0 -0
- package/src/assets/images/menu/sjk.png +0 -0
- package/src/assets/images/menu/up.png +0 -0
- package/src/assets/images/po-i.png +0 -0
- package/src/assets/images/po1-i1.png +0 -0
- package/src/assets/images/po1-i2.png +0 -0
- package/src/assets/images/po1-i3.png +0 -0
- package/src/assets/images/po1-i4.png +0 -0
- package/src/assets/images/po1-i5.png +0 -0
- package/src/assets/images/po1-i6.png +0 -0
- package/src/assets/images/po1-i7.png +0 -0
- package/src/assets/images/po1-i8.png +0 -0
- package/src/assets/images/po2-i1.png +0 -0
- package/src/assets/images/po2-i2.png +0 -0
- package/src/assets/images/po3-i1.png +0 -0
- package/src/assets/images/po4-i1.png +0 -0
- package/src/assets/images/po5-i1.png +0 -0
- package/src/assets/images/po6-i1.png +0 -0
- package/src/assets/images/po6-i2.png +0 -0
- package/src/assets/images/po7-i1.png +0 -0
- package/src/assets/images/tj1.png +0 -0
- package/src/assets/images/tj2.png +0 -0
- package/src/assets/images/tj3.png +0 -0
- package/src/components/3dcloudwords/index.js +0 -346
- package/src/components/3dcloudwords/index.vue +0 -99
- package/src/components/3dcloudwords/readme.md +0 -66
- package/src/components/badge/index.js +0 -167
- package/src/components/badge/index.scss +0 -166
- package/src/components/badge/index.vue +0 -98
- package/src/components/badge/readme.md +0 -18
- package/src/components/basic/Finish.vue +0 -107
- package/src/components/basic/button.vue +0 -19
- package/src/components/basic/readme.md +0 -7
- package/src/components/button/index.vue +0 -48
- package/src/components/button/readme.md +0 -62
- package/src/components/carousel/index.vue +0 -104
- package/src/components/carousel/readme.md +0 -12
- package/src/components/chartconfig/index.vue +0 -141
- package/src/components/chartconfig/readme.md +0 -25
- package/src/components/contextMenu/hookContxtMenu.js +0 -41
- package/src/components/contextMenu/index.vue +0 -245
- package/src/components/contextMenu/readme.md +0 -55
- package/src/components/contextMenu/useElementBounding.js +0 -40
- package/src/components/countup/countUp.js +0 -196
- package/src/components/countup/index.vue +0 -114
- package/src/components/countup/readme.md +0 -9
- package/src/components/empty/assets/build.png +0 -0
- package/src/components/empty/assets/emptybg.gif +0 -0
- package/src/components/empty/assets/emptybg.png +0 -0
- package/src/components/empty/assets/emptybg2.jpg +0 -0
- package/src/components/empty/assets/emptybg3.jpg +0 -0
- package/src/components/empty/assets/wuxiao.png +0 -0
- package/src/components/empty/assets/wuxiao.webp +0 -0
- package/src/components/empty/building.vue +0 -117
- package/src/components/empty/empty.vue +0 -120
- package/src/components/empty/index.js +0 -12
- package/src/components/empty/invalid.vue +0 -56
- package/src/components/error/Error.vue +0 -79
- package/src/components/error/readme.md +0 -20
- package/src/components/form/Form.vue +0 -84
- package/src/components/form/FormItem.vue +0 -143
- package/src/components/form/data.js +0 -52
- package/src/components/form/readme.md +0 -69
- package/src/components/layout/banner.vue +0 -412
- package/src/components/layout/bar.vue +0 -43
- package/src/components/layout/layout1.vue +0 -60
- package/src/components/layout/layout2.vue +0 -134
- package/src/components/layout/layout3.vue +0 -107
- package/src/components/layout/layout4.vue +0 -66
- package/src/components/layout/nav.vue +0 -333
- package/src/components/layout/readme.md +0 -61
- package/src/components/loading/index.vue +0 -122
- package/src/components/loading/readme.md +0 -6
- package/src/components/notice/NoticeList.vue +0 -198
- package/src/components/notice/NoticeListPaging.vue +0 -281
- package/src/components/notice/NoticeView.vue +0 -92
- package/src/components/notice/readme.md +0 -1
- package/src/components/pagination/index.vue +0 -100
- package/src/components/pagination/readme.md +0 -19
- package/src/components/pagination/scroll-to.js +0 -51
- package/src/components/progress/bar.vue +0 -72
- package/src/components/progress/progress.vue +0 -58
- package/src/components/screenfull/index.js +0 -3
- package/src/components/screenfull/index.vue +0 -65
- package/src/components/screenfull/package.json +0 -15
- package/src/components/screenfull/readme.md +0 -6
- package/src/components/statisticalCount/index.vue +0 -80
- package/src/components/statisticalCount/readme.md +0 -21
- package/src/components/username/index.vue +0 -79
- package/src/components/username/readme.md +0 -22
- package/src/components/username//346/225/210/346/236/234/345/233/276.png +0 -0
- package/src/index.js +0 -88
- package/src/utils/index.js +0 -32
- package/src/xm_components/HeadSearch/hook/hookSearch.js +0 -96
- package/src/xm_components/HeadSearch/index.vue +0 -206
- package/src/xm_components/HeadSearch/readme.md +0 -12
- package/src/xm_components/HeadSearch//346/220/234/347/264/242/345/210/227/350/241/250.png +0 -0
- package/src/xm_components/Milestone/index.vue +0 -213
- package/src/xm_components/Milestone/readme.md +0 -15
- package/src/xm_components/MultiStatisticalCard/image.png +0 -0
- package/src/xm_components/MultiStatisticalCard/index.vue +0 -114
- package/src/xm_components/MultiStatisticalCard/readme.md +0 -29
- package/src/xm_components/StatisticalCard/image.png +0 -0
- package/src/xm_components/StatisticalCard/index.vue +0 -196
- package/src/xm_components/StatisticalCard/readme.md +0 -41
- package/src/xm_components/readme.md +0 -1
- package/utils/coms/load.jsx +0 -10
- package/utils/func.js +0 -32
- package/utils/hookDialog.js +0 -38
- package/utils/hookPage.js +0 -49
- package/utils/index.js +0 -5
- package/utils/lib/console.js +0 -39
- package/utils/lib/debounce.js +0 -19
- package/utils/lib/deepextend.js +0 -51
- package/utils/lib/deepset.js +0 -14
- package/utils/lib/extend.js +0 -28
- package/utils/lib/index.js +0 -13
- package/utils/lib/json.js +0 -90
- package/utils/lib/mergeprops.js +0 -62
- package/utils/lib/mitt.js +0 -43
- package/utils/lib/modify.js +0 -8
- package/utils/lib/slot.js +0 -19
- package/utils/lib/toarray.js +0 -5
- package/utils/lib/tocase.js +0 -11
- package/utils/lib/todate.js +0 -10
- package/utils/lib/toline.js +0 -10
- package/utils/lib/tostring.js +0 -7
- package/utils/lib/type.js +0 -45
- package/utils/lib/unique.js +0 -6
- package/utils/message.js +0 -164
- package/utils/package.json +0 -16
- package/utils/type.js +0 -45
- package/vite.config.js +0 -56
|
@@ -1,119 +0,0 @@
|
|
|
1
|
-
// https://github.com/ElemeFE/element/blob/dev/packages/upload/src/ajax.js
|
|
2
|
-
|
|
3
|
-
import is from '@bdsoft-element/utils/lib/type';
|
|
4
|
-
import {parseFn} from '@bdsoft-element/utils/lib/json';
|
|
5
|
-
import {deepGet} from './util';
|
|
6
|
-
|
|
7
|
-
function getError(action, option, xhr) {
|
|
8
|
-
const msg = `fail to ${action} ${xhr.status}'`;
|
|
9
|
-
const err = new Error(msg);
|
|
10
|
-
err.status = xhr.status;
|
|
11
|
-
err.url = action;
|
|
12
|
-
return err;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
function getBody(xhr) {
|
|
16
|
-
const text = xhr.responseText || xhr.response;
|
|
17
|
-
if (!text) {
|
|
18
|
-
return text;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
try {
|
|
22
|
-
return JSON.parse(text);
|
|
23
|
-
} catch (e) {
|
|
24
|
-
return text;
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
export default function fetch(option) {
|
|
29
|
-
if (typeof XMLHttpRequest === 'undefined') {
|
|
30
|
-
return;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
const xhr = new XMLHttpRequest();
|
|
34
|
-
let action = option.action || '';
|
|
35
|
-
|
|
36
|
-
if (xhr.upload && option.onProgress) {
|
|
37
|
-
xhr.upload.addEventListener('progress', (evt) => {
|
|
38
|
-
evt.percent = evt.total > 0 ? (evt.loaded / evt.total) * 100 : 0
|
|
39
|
-
option.onProgress(evt)
|
|
40
|
-
})
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
if (option.query) {
|
|
44
|
-
const queryString = new URLSearchParams(option.query).toString();
|
|
45
|
-
if (action.includes('?')) {
|
|
46
|
-
action += `&${queryString}`;
|
|
47
|
-
} else {
|
|
48
|
-
action += `?${queryString}`;
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
xhr.onerror = function error(e) {
|
|
53
|
-
option.onError(e);
|
|
54
|
-
};
|
|
55
|
-
|
|
56
|
-
xhr.onload = function onload() {
|
|
57
|
-
if (xhr.status < 200 || xhr.status >= 300) {
|
|
58
|
-
return option.onError(getError(action, option, xhr), getBody(xhr));
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
option.onSuccess(getBody(xhr));
|
|
62
|
-
};
|
|
63
|
-
|
|
64
|
-
xhr.open(option.method || 'get', action, true);
|
|
65
|
-
|
|
66
|
-
let formData;
|
|
67
|
-
if (option.data || option.file) {
|
|
68
|
-
if (option.file || (option.dataType || '').toLowerCase() !== 'json') {
|
|
69
|
-
formData = new FormData();
|
|
70
|
-
Object.keys(option.data || {}).map(key => {
|
|
71
|
-
formData.append(key, option.data[key]);
|
|
72
|
-
});
|
|
73
|
-
} else {
|
|
74
|
-
formData = JSON.stringify(option.data || {});
|
|
75
|
-
xhr.setRequestHeader('content-type', 'application/json');
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
if(option.file){
|
|
80
|
-
formData.append(option.filename, option.file, option.file.name)
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
if (option.withCredentials && 'withCredentials' in xhr) {
|
|
84
|
-
xhr.withCredentials = true;
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
const headers = option.headers || {};
|
|
88
|
-
|
|
89
|
-
Object.keys(headers).forEach(item => {
|
|
90
|
-
if (headers[item] != null) {
|
|
91
|
-
xhr.setRequestHeader(item, headers[item]);
|
|
92
|
-
}
|
|
93
|
-
});
|
|
94
|
-
xhr.send(formData);
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
export function asyncFetch(config, _fetch, api) {
|
|
99
|
-
return new Promise((resolve, reject) => {
|
|
100
|
-
(_fetch || fetch)({
|
|
101
|
-
...config,
|
|
102
|
-
onSuccess(res) {
|
|
103
|
-
let fn = (v) => v;
|
|
104
|
-
const parse = parseFn(config.parse);
|
|
105
|
-
if (is.Function(parse)) {
|
|
106
|
-
fn = parse;
|
|
107
|
-
} else if (parse && is.String(parse)) {
|
|
108
|
-
fn = (v) => {
|
|
109
|
-
return deepGet(v, parse);
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
resolve(fn(res, undefined, api));
|
|
113
|
-
},
|
|
114
|
-
onError(err) {
|
|
115
|
-
reject(err);
|
|
116
|
-
}
|
|
117
|
-
})
|
|
118
|
-
});
|
|
119
|
-
}
|
|
@@ -1,274 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
defineComponent,
|
|
3
|
-
getCurrentInstance,
|
|
4
|
-
inject,
|
|
5
|
-
markRaw,
|
|
6
|
-
nextTick,
|
|
7
|
-
onBeforeMount,
|
|
8
|
-
onBeforeUnmount,
|
|
9
|
-
onMounted,
|
|
10
|
-
onUpdated,
|
|
11
|
-
provide,
|
|
12
|
-
reactive,
|
|
13
|
-
toRefs,
|
|
14
|
-
watch, watchEffect
|
|
15
|
-
} from 'vue';
|
|
16
|
-
import toArray from '@bdsoft-element/utils/lib/toarray';
|
|
17
|
-
import debounce from '@bdsoft-element/utils/lib/debounce';
|
|
18
|
-
import toLine from '@bdsoft-element/utils/lib/toline';
|
|
19
|
-
|
|
20
|
-
const getGroupInject = (vm, parent) => {
|
|
21
|
-
if (!vm || vm === parent) {
|
|
22
|
-
return;
|
|
23
|
-
}
|
|
24
|
-
if (vm.props.formCreateInject) {
|
|
25
|
-
return vm.props.formCreateInject
|
|
26
|
-
}
|
|
27
|
-
if (vm.parent) {
|
|
28
|
-
return getGroupInject(vm.parent, parent);
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
export default function $FormCreate(FormCreate, components, directives) {
|
|
33
|
-
return defineComponent({
|
|
34
|
-
name: 'FormCreate' ,
|
|
35
|
-
components,
|
|
36
|
-
directives,
|
|
37
|
-
props: {
|
|
38
|
-
rule: {
|
|
39
|
-
type: Array,
|
|
40
|
-
required: true,
|
|
41
|
-
default: () => []
|
|
42
|
-
},
|
|
43
|
-
option: {
|
|
44
|
-
type: Object,
|
|
45
|
-
default: () => ({})
|
|
46
|
-
},
|
|
47
|
-
extendOption: Boolean,
|
|
48
|
-
driver: [String, Object],
|
|
49
|
-
modelValue: Object,
|
|
50
|
-
disabled: {
|
|
51
|
-
type: Boolean,
|
|
52
|
-
default: undefined,
|
|
53
|
-
},
|
|
54
|
-
preview: {
|
|
55
|
-
type: Boolean,
|
|
56
|
-
default: undefined,
|
|
57
|
-
},
|
|
58
|
-
index: [String, Number],
|
|
59
|
-
api: Object,
|
|
60
|
-
locale: [String, Object],
|
|
61
|
-
name: String,
|
|
62
|
-
subForm: {
|
|
63
|
-
type: Boolean,
|
|
64
|
-
default: true
|
|
65
|
-
},
|
|
66
|
-
inFor: Boolean,
|
|
67
|
-
},
|
|
68
|
-
emits: ['update:api', 'update:modelValue', 'mounted', 'submit', 'reset', 'change', 'emit-event', 'control', 'remove-rule', 'remove-field', 'sync', 'reload', 'repeat-field', 'update', 'validate-field-fail', 'validate-fail', 'created'],
|
|
69
|
-
render() {
|
|
70
|
-
return this.fc.render();
|
|
71
|
-
},
|
|
72
|
-
setup(props) {
|
|
73
|
-
const vm = getCurrentInstance();
|
|
74
|
-
provide('parentFC', vm);
|
|
75
|
-
const parent = inject('parentFC', null);
|
|
76
|
-
let top = parent;
|
|
77
|
-
|
|
78
|
-
if (parent) {
|
|
79
|
-
while (top.setupState.parent) {
|
|
80
|
-
top = top.setupState.parent;
|
|
81
|
-
}
|
|
82
|
-
} else {
|
|
83
|
-
top = vm;
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
const {rule, modelValue, subForm, inFor} = toRefs(props);
|
|
87
|
-
|
|
88
|
-
const data = reactive({
|
|
89
|
-
ctxInject: {},
|
|
90
|
-
destroyed: false,
|
|
91
|
-
isShow: true,
|
|
92
|
-
unique: 1,
|
|
93
|
-
renderRule: [...rule.value || []],
|
|
94
|
-
updateValue: JSON.stringify(modelValue.value || {}),
|
|
95
|
-
});
|
|
96
|
-
|
|
97
|
-
const fc = new FormCreate(vm);
|
|
98
|
-
const fapi = fc.api();
|
|
99
|
-
|
|
100
|
-
const isMore = inFor.value;
|
|
101
|
-
|
|
102
|
-
const addSubForm = () => {
|
|
103
|
-
if (parent) {
|
|
104
|
-
const inject = getGroupInject(vm, parent);
|
|
105
|
-
if (inject) {
|
|
106
|
-
let sub;
|
|
107
|
-
if (isMore) {
|
|
108
|
-
sub = toArray(inject.getSubForm());
|
|
109
|
-
sub.push(fapi);
|
|
110
|
-
|
|
111
|
-
} else {
|
|
112
|
-
sub = fapi;
|
|
113
|
-
}
|
|
114
|
-
inject.subForm(sub);
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
};
|
|
118
|
-
|
|
119
|
-
const rmSubForm = () => {
|
|
120
|
-
const inject = getGroupInject(vm, parent);
|
|
121
|
-
if (inject) {
|
|
122
|
-
if (isMore) {
|
|
123
|
-
const sub = toArray(inject.getSubForm());
|
|
124
|
-
const idx = sub.indexOf(fapi);
|
|
125
|
-
if (idx > -1) {
|
|
126
|
-
sub.splice(idx, 1);
|
|
127
|
-
}
|
|
128
|
-
} else {
|
|
129
|
-
inject.subForm();
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
};
|
|
133
|
-
|
|
134
|
-
let styleEl = null;
|
|
135
|
-
|
|
136
|
-
onBeforeMount(() => {
|
|
137
|
-
watchEffect(() => {
|
|
138
|
-
let content = '';
|
|
139
|
-
const globalClass = (props.option && props.option.globalClass) || {};
|
|
140
|
-
Object.keys(globalClass).forEach(k => {
|
|
141
|
-
let subCss = '';
|
|
142
|
-
globalClass[k].style && Object.keys(globalClass[k].style).forEach(key => {
|
|
143
|
-
subCss += toLine(key) + ':' + globalClass[k].style[key] + ';';
|
|
144
|
-
});
|
|
145
|
-
if (globalClass[k].content) {
|
|
146
|
-
subCss += globalClass[k].content + ';';
|
|
147
|
-
}
|
|
148
|
-
if (subCss) {
|
|
149
|
-
content += `.${k}{${subCss}}`;
|
|
150
|
-
}
|
|
151
|
-
});
|
|
152
|
-
if (props.option && props.option.style) {
|
|
153
|
-
content += props.option.style;
|
|
154
|
-
}
|
|
155
|
-
if (!styleEl) {
|
|
156
|
-
styleEl = document.createElement('style');
|
|
157
|
-
styleEl.type = 'text/css';
|
|
158
|
-
document.head.appendChild(styleEl);
|
|
159
|
-
}
|
|
160
|
-
styleEl.innerHTML = content || '';
|
|
161
|
-
})
|
|
162
|
-
});
|
|
163
|
-
|
|
164
|
-
const emit$topForm = debounce(() => {
|
|
165
|
-
fc.bus.$emit('$loadData.$topForm');
|
|
166
|
-
}, 100);
|
|
167
|
-
|
|
168
|
-
const emit$form = debounce(() => {
|
|
169
|
-
fc.bus.$emit('$loadData.$form');
|
|
170
|
-
}, 100);
|
|
171
|
-
|
|
172
|
-
const emit$change = (field) => {
|
|
173
|
-
fc.bus.$emit('change-$form.' + field);
|
|
174
|
-
};
|
|
175
|
-
|
|
176
|
-
onMounted(() => {
|
|
177
|
-
if (parent) {
|
|
178
|
-
fapi.top.bus.$on('$loadData.$form', emit$topForm);
|
|
179
|
-
fapi.top.bus.$on('change', emit$change);
|
|
180
|
-
}
|
|
181
|
-
fc.mounted();
|
|
182
|
-
});
|
|
183
|
-
|
|
184
|
-
onBeforeUnmount(() => {
|
|
185
|
-
if (parent) {
|
|
186
|
-
fapi.top.bus.$off('$loadData.$form', emit$topForm);
|
|
187
|
-
fapi.top.bus.$off('change', emit$change);
|
|
188
|
-
}
|
|
189
|
-
styleEl && document.head.removeChild(styleEl);
|
|
190
|
-
rmSubForm();
|
|
191
|
-
data.destroyed = true;
|
|
192
|
-
fc.unmount();
|
|
193
|
-
})
|
|
194
|
-
|
|
195
|
-
onUpdated(() => {
|
|
196
|
-
fc.updated();
|
|
197
|
-
});
|
|
198
|
-
|
|
199
|
-
watch(subForm, (n) => {
|
|
200
|
-
n ? addSubForm() : rmSubForm();
|
|
201
|
-
}, {immediate: true});
|
|
202
|
-
|
|
203
|
-
watch(() => [...rule.value], (n) => {
|
|
204
|
-
if (fc.$handle.isBreakWatch() || n.length === data.renderRule.length && n.every(v => data.renderRule.indexOf(v) > -1)) return;
|
|
205
|
-
fc.$handle.updateAppendData();
|
|
206
|
-
fc.$handle.reloadRule(rule.value);
|
|
207
|
-
vm.setupState.renderRule();
|
|
208
|
-
})
|
|
209
|
-
|
|
210
|
-
watch(() => props.option, () => {
|
|
211
|
-
fc.initOptions();
|
|
212
|
-
fapi.refresh();
|
|
213
|
-
}, {deep: true});
|
|
214
|
-
|
|
215
|
-
watch(() => [props.disabled, props.preview], () => {
|
|
216
|
-
fapi.refresh();
|
|
217
|
-
});
|
|
218
|
-
|
|
219
|
-
watch(modelValue, (n) => {
|
|
220
|
-
if (JSON.stringify(n || {}) === data.updateValue) return;
|
|
221
|
-
if (fapi.config.forceCoverValue) {
|
|
222
|
-
fapi.coverValue(n || {});
|
|
223
|
-
} else {
|
|
224
|
-
fapi.setValue(n || {});
|
|
225
|
-
}
|
|
226
|
-
}, {deep: true, flush: 'post'});
|
|
227
|
-
|
|
228
|
-
watch(() => props.index, () => {
|
|
229
|
-
fapi.coverValue({});
|
|
230
|
-
fc.$handle.updateAppendData();
|
|
231
|
-
nextTick(() => {
|
|
232
|
-
nextTick(() => {
|
|
233
|
-
fapi.clearValidateState();
|
|
234
|
-
});
|
|
235
|
-
});
|
|
236
|
-
}, {flush: 'sync'});
|
|
237
|
-
|
|
238
|
-
return {
|
|
239
|
-
fc: markRaw(fc),
|
|
240
|
-
parent: parent ? markRaw(parent) : parent,
|
|
241
|
-
top: markRaw(top),
|
|
242
|
-
fapi: markRaw(fapi),
|
|
243
|
-
...toRefs(data),
|
|
244
|
-
getGroupInject: () => getGroupInject(vm, parent),
|
|
245
|
-
refresh() {
|
|
246
|
-
++data.unique;
|
|
247
|
-
},
|
|
248
|
-
renderRule() {
|
|
249
|
-
data.renderRule = [...rule.value || []];
|
|
250
|
-
},
|
|
251
|
-
updateValue(value) {
|
|
252
|
-
if (data.destroyed) return;
|
|
253
|
-
const json = JSON.stringify(value);
|
|
254
|
-
if (data.updateValue === json) {
|
|
255
|
-
return;
|
|
256
|
-
}
|
|
257
|
-
data.updateValue = json;
|
|
258
|
-
vm.emit('update:modelValue', value);
|
|
259
|
-
nextTick(() => {
|
|
260
|
-
emit$form();
|
|
261
|
-
if (!parent) {
|
|
262
|
-
emit$topForm();
|
|
263
|
-
}
|
|
264
|
-
});
|
|
265
|
-
}
|
|
266
|
-
}
|
|
267
|
-
},
|
|
268
|
-
created() {
|
|
269
|
-
const vm = getCurrentInstance();
|
|
270
|
-
vm.emit('update:api', vm.setupState.fapi);
|
|
271
|
-
vm.setupState.fc.init();
|
|
272
|
-
},
|
|
273
|
-
})
|
|
274
|
-
}
|