@bdsoft/element 1.1.8 → 1.1.11
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/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 -51
package/package.json
CHANGED
package/global/index.ts
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { App } from 'vue'
|
|
2
|
-
|
|
3
|
-
import { showsuccess, showerror, showwarning, showinfo } from '../utils/message.js'
|
|
4
|
-
// App是用来确定类型
|
|
5
|
-
export default function registerProperties(app: App) {
|
|
6
|
-
app.config.globalProperties.showsuccess = showsuccess
|
|
7
|
-
app.config.globalProperties.showerror = showerror
|
|
8
|
-
app.config.globalProperties.showwarning = showwarning
|
|
9
|
-
app.config.globalProperties.showinfo = showinfo
|
|
10
|
-
}
|
package/index.html
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
<!doctype html>
|
|
2
|
-
<html lang="en">
|
|
3
|
-
<head>
|
|
4
|
-
<meta charset="UTF-8" />
|
|
5
|
-
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
|
|
6
|
-
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
7
|
-
<title>Vite + Vue</title>
|
|
8
|
-
</head>
|
|
9
|
-
<body>
|
|
10
|
-
<div id="app"></div>
|
|
11
|
-
<script type="module" src="/src/main.js"></script>
|
|
12
|
-
</body>
|
|
13
|
-
</html>
|
|
@@ -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' + (FormCreate.isMobile ? 'Mobile' : ''),
|
|
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
|
-
}
|
|
@@ -1,257 +0,0 @@
|
|
|
1
|
-
import unique from '@bdsoft-element/utils/lib/unique';
|
|
2
|
-
import toCase from '@bdsoft-element/utils/lib/tocase';
|
|
3
|
-
import extend from '@bdsoft-element/utils/lib/extend';
|
|
4
|
-
import {enumerable, invoke, mergeRule} from '../frame/util';
|
|
5
|
-
import {deepCopy} from '@bdsoft-element/utils/lib/deepextend';
|
|
6
|
-
import {markRaw, reactive} from 'vue';
|
|
7
|
-
import is from '@bdsoft-element/utils/lib/type';
|
|
8
|
-
// import toArray from '@bdsoft-element/utils/lib/toarray';
|
|
9
|
-
|
|
10
|
-
function bind(ctx) {
|
|
11
|
-
Object.defineProperties(ctx.origin, {
|
|
12
|
-
__fc__: enumerable(markRaw(ctx), true)
|
|
13
|
-
});
|
|
14
|
-
if(ctx.rule !== ctx.origin) {
|
|
15
|
-
Object.defineProperties(ctx.rule, {
|
|
16
|
-
__fc__: enumerable(markRaw(ctx), true)
|
|
17
|
-
});
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
export default function RuleContext(handle, rule, defaultValue) {
|
|
22
|
-
const id = unique();
|
|
23
|
-
const isInput = !!rule.field;
|
|
24
|
-
extend(this, {
|
|
25
|
-
id,
|
|
26
|
-
ref: id,
|
|
27
|
-
wrapRef: id + 'fi',
|
|
28
|
-
rule,
|
|
29
|
-
origin: rule.__origin__ || rule,
|
|
30
|
-
name: rule.name,
|
|
31
|
-
pending: {},
|
|
32
|
-
none: false,
|
|
33
|
-
watch: [],
|
|
34
|
-
linkOn: [],
|
|
35
|
-
root: [],
|
|
36
|
-
ctrlRule: [],
|
|
37
|
-
children: [],
|
|
38
|
-
parent: null,
|
|
39
|
-
group: rule.subRule ? this : null,
|
|
40
|
-
cacheConfig: null,
|
|
41
|
-
prop: {...rule},
|
|
42
|
-
computed: {},
|
|
43
|
-
payload: {},
|
|
44
|
-
refRule: {},
|
|
45
|
-
input: isInput,
|
|
46
|
-
el: undefined,
|
|
47
|
-
exportEl: undefined,
|
|
48
|
-
defaultValue: isInput ? deepCopy(defaultValue) : undefined,
|
|
49
|
-
field: rule.field || undefined
|
|
50
|
-
})
|
|
51
|
-
|
|
52
|
-
this.updateKey();
|
|
53
|
-
bind(this);
|
|
54
|
-
this.update(handle, true);
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
extend(RuleContext.prototype, {
|
|
58
|
-
getParentGroup() {
|
|
59
|
-
let ctx = this.parent;
|
|
60
|
-
while (ctx) {
|
|
61
|
-
if (ctx.group) {
|
|
62
|
-
return ctx;
|
|
63
|
-
}
|
|
64
|
-
ctx = ctx.parent;
|
|
65
|
-
}
|
|
66
|
-
},
|
|
67
|
-
loadChildrenPending() {
|
|
68
|
-
const children = this.rule.children || [];
|
|
69
|
-
if (Array.isArray(children))
|
|
70
|
-
return children;
|
|
71
|
-
return this.loadPending({
|
|
72
|
-
key: 'children', origin: children, def: [],
|
|
73
|
-
onLoad: (data) => {
|
|
74
|
-
this.$handle && this.$handle.loadChildren(data, this);
|
|
75
|
-
}, onUpdate: (value, oldValue) => {
|
|
76
|
-
if (this.$handle) {
|
|
77
|
-
value === oldValue ? this.$handle.loadChildren(value, this) : this.$handle.updateChildren(this, value, oldValue);
|
|
78
|
-
}
|
|
79
|
-
}, onReload: (value) => {
|
|
80
|
-
if (this.$handle) {
|
|
81
|
-
this.$handle.updateChildren(this, [], value);
|
|
82
|
-
} else {
|
|
83
|
-
delete this.pending.children;
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
});
|
|
87
|
-
},
|
|
88
|
-
loadPending(config) {
|
|
89
|
-
const {key, origin, def, onLoad, onReload, onUpdate} = config;
|
|
90
|
-
|
|
91
|
-
if (this.pending[key] && this.pending[key].origin === origin) {
|
|
92
|
-
return this.getPending(key, def);
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
delete this.pending[key];
|
|
96
|
-
|
|
97
|
-
let value = origin;
|
|
98
|
-
if (is.Function(origin)) {
|
|
99
|
-
let source = invoke(() => origin({
|
|
100
|
-
rule: this.rule, api: this.$api, update: (data) => {
|
|
101
|
-
const value = data || def;
|
|
102
|
-
const oldValue = this.getPending(key, def);
|
|
103
|
-
this.setPending(key, origin, value);
|
|
104
|
-
onUpdate && onUpdate(value, oldValue);
|
|
105
|
-
}, reload: () => {
|
|
106
|
-
const oldValue = this.getPending(key, def);
|
|
107
|
-
delete this.pending[key];
|
|
108
|
-
onReload && onReload(oldValue);
|
|
109
|
-
this.$api && this.$api.sync(this.rule);
|
|
110
|
-
}
|
|
111
|
-
}));
|
|
112
|
-
if (source && is.Function(source.then)) {
|
|
113
|
-
source.then((data) => {
|
|
114
|
-
const value = data || def;
|
|
115
|
-
this.setPending(key, origin, value);
|
|
116
|
-
onLoad && onLoad(value);
|
|
117
|
-
this.$api && this.$api.sync(this.rule);
|
|
118
|
-
}).catch(e => {
|
|
119
|
-
console.error(e);
|
|
120
|
-
})
|
|
121
|
-
value = def;
|
|
122
|
-
this.setPending(key, origin, value);
|
|
123
|
-
} else {
|
|
124
|
-
value = source || def;
|
|
125
|
-
this.setPending(key, origin, value);
|
|
126
|
-
onLoad && onLoad(value);
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
return value;
|
|
130
|
-
},
|
|
131
|
-
getPending(key, def) {
|
|
132
|
-
return (this.pending[key] && this.pending[key].value) || def;
|
|
133
|
-
},
|
|
134
|
-
setPending(key, origin, value) {
|
|
135
|
-
this.pending[key] = {
|
|
136
|
-
origin,
|
|
137
|
-
value: reactive(value)
|
|
138
|
-
};
|
|
139
|
-
},
|
|
140
|
-
effectData(name) {
|
|
141
|
-
if (!this.payload[name]) {
|
|
142
|
-
this.payload[name] = {};
|
|
143
|
-
}
|
|
144
|
-
return this.payload[name];
|
|
145
|
-
},
|
|
146
|
-
clearEffectData(name) {
|
|
147
|
-
if (name === undefined) {
|
|
148
|
-
this.payload = {};
|
|
149
|
-
} else {
|
|
150
|
-
delete this.payload[name];
|
|
151
|
-
}
|
|
152
|
-
},
|
|
153
|
-
updateKey(flag) {
|
|
154
|
-
this.key = unique();
|
|
155
|
-
flag && this.parent && this.parent.updateKey(flag);
|
|
156
|
-
},
|
|
157
|
-
updateType() {
|
|
158
|
-
this.originType = this.rule.type;
|
|
159
|
-
this.type = toCase(this.rule.type);
|
|
160
|
-
this.trueType = this.$handle.getType(this.originType);
|
|
161
|
-
},
|
|
162
|
-
setParser(parser) {
|
|
163
|
-
this.parser = parser;
|
|
164
|
-
parser.init(this);
|
|
165
|
-
},
|
|
166
|
-
initProp() {
|
|
167
|
-
const rule = {...this.rule};
|
|
168
|
-
delete rule.children;
|
|
169
|
-
delete rule.validate;
|
|
170
|
-
this.prop = mergeRule({}, [rule, ...Object.keys(this.payload).map(k => this.payload[k]), this.computed]);
|
|
171
|
-
this.prop.validate = [...this.refRule?.__$validate?.value || [], ...this.prop.validate || []]
|
|
172
|
-
},
|
|
173
|
-
initNone() {
|
|
174
|
-
this.none = !(is.Undef(this.prop.display) || !!this.prop.display)
|
|
175
|
-
},
|
|
176
|
-
injectValidate() {
|
|
177
|
-
return this.prop.validate;
|
|
178
|
-
},
|
|
179
|
-
check(handle) {
|
|
180
|
-
return this.vm === handle.vm
|
|
181
|
-
},
|
|
182
|
-
unwatch() {
|
|
183
|
-
this.watch.forEach(un => un());
|
|
184
|
-
this.watch = [];
|
|
185
|
-
this.refRule = {};
|
|
186
|
-
},
|
|
187
|
-
unlink() {
|
|
188
|
-
this.linkOn.forEach(un => un());
|
|
189
|
-
this.linkOn = [];
|
|
190
|
-
},
|
|
191
|
-
link() {
|
|
192
|
-
this.unlink();
|
|
193
|
-
this.$handle.appendLink(this);
|
|
194
|
-
},
|
|
195
|
-
watchTo() {
|
|
196
|
-
this.$handle.watchCtx(this);
|
|
197
|
-
},
|
|
198
|
-
delete() {
|
|
199
|
-
this.unwatch();
|
|
200
|
-
this.unlink();
|
|
201
|
-
this.rmCtrl();
|
|
202
|
-
if (this.parent) {
|
|
203
|
-
this.parent.children.splice(this.parent.children.indexOf(this) >>> 0, 1);
|
|
204
|
-
}
|
|
205
|
-
extend(this, {
|
|
206
|
-
deleted: true,
|
|
207
|
-
computed: {},
|
|
208
|
-
parent: null,
|
|
209
|
-
children: [],
|
|
210
|
-
cacheConfig: null,
|
|
211
|
-
none: false,
|
|
212
|
-
})
|
|
213
|
-
},
|
|
214
|
-
rmCtrl() {
|
|
215
|
-
this.ctrlRule.forEach(ctrl => ctrl.__fc__ && ctrl.__fc__.rm());
|
|
216
|
-
this.ctrlRule = [];
|
|
217
|
-
},
|
|
218
|
-
rm() {
|
|
219
|
-
const _rm = () => {
|
|
220
|
-
let index = this.root.indexOf(this.origin);
|
|
221
|
-
if (index > -1) {
|
|
222
|
-
this.root.splice(index, 1);
|
|
223
|
-
this.$handle && this.$handle.refresh();
|
|
224
|
-
}
|
|
225
|
-
}
|
|
226
|
-
if (this.deleted) {
|
|
227
|
-
_rm();
|
|
228
|
-
return;
|
|
229
|
-
}
|
|
230
|
-
this.$handle.noWatch(() => {
|
|
231
|
-
this.$handle.deferSyncValue(() => {
|
|
232
|
-
this.rmCtrl();
|
|
233
|
-
_rm();
|
|
234
|
-
this.$handle.rmCtx(this);
|
|
235
|
-
extend(this, {
|
|
236
|
-
root: []
|
|
237
|
-
});
|
|
238
|
-
}, this.input);
|
|
239
|
-
});
|
|
240
|
-
},
|
|
241
|
-
update(handle, init) {
|
|
242
|
-
extend(this, {
|
|
243
|
-
deleted: false,
|
|
244
|
-
$handle: handle,
|
|
245
|
-
$render: handle.$render,
|
|
246
|
-
$api: handle.api,
|
|
247
|
-
vm: handle.vm,
|
|
248
|
-
vNode: handle.$render.vNode,
|
|
249
|
-
updated: false,
|
|
250
|
-
cacheValue: this.rule.value
|
|
251
|
-
});
|
|
252
|
-
!init && this.unwatch();
|
|
253
|
-
this.watchTo();
|
|
254
|
-
this.link();
|
|
255
|
-
this.updateType();
|
|
256
|
-
}
|
|
257
|
-
})
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
import extend from '@bdsoft-element/utils/lib/extend';
|
|
2
|
-
import is from '@bdsoft-element/utils/lib/type';
|
|
3
|
-
import {attrs} from '../frame/attrs';
|
|
4
|
-
import {copyRule, mergeRule} from '../frame/util';
|
|
5
|
-
import {$set} from '@bdsoft-element/utils/lib/modify';
|
|
6
|
-
|
|
7
|
-
export function baseRule() {
|
|
8
|
-
return {
|
|
9
|
-
props: {},
|
|
10
|
-
on: {},
|
|
11
|
-
options: [],
|
|
12
|
-
children: [],
|
|
13
|
-
hidden: false,
|
|
14
|
-
display: true,
|
|
15
|
-
value: undefined,
|
|
16
|
-
};
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
export function creatorFactory(name, init) {
|
|
20
|
-
return (title, field, value, props = {}) => {
|
|
21
|
-
const maker = new Creator(name, title, field, value, props);
|
|
22
|
-
if (init) {
|
|
23
|
-
if (is.Function(init)) init(maker);
|
|
24
|
-
else maker.props(init);
|
|
25
|
-
}
|
|
26
|
-
return maker;
|
|
27
|
-
};
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
export default function Creator(type, title, field, value, props) {
|
|
31
|
-
this._data = extend(baseRule(), {type, title, field, value, props: props || {}});
|
|
32
|
-
this.event = this.on;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
extend(Creator.prototype, {
|
|
36
|
-
getRule() {
|
|
37
|
-
return this._data;
|
|
38
|
-
},
|
|
39
|
-
setProp(key, value) {
|
|
40
|
-
$set(this._data, key, value);
|
|
41
|
-
return this;
|
|
42
|
-
},
|
|
43
|
-
modelField(field) {
|
|
44
|
-
this._data.modelField = field;
|
|
45
|
-
return this;
|
|
46
|
-
},
|
|
47
|
-
_clone() {
|
|
48
|
-
const clone = new this.constructor();
|
|
49
|
-
clone._data = copyRule(this._data);
|
|
50
|
-
return clone;
|
|
51
|
-
},
|
|
52
|
-
})
|
|
53
|
-
|
|
54
|
-
export function appendProto(attrs) {
|
|
55
|
-
attrs.forEach(name => {
|
|
56
|
-
Creator.prototype[name] = function (key) {
|
|
57
|
-
mergeRule(this._data, {[name]: arguments.length < 2 ? key : {[key]: arguments[1]}})
|
|
58
|
-
return this;
|
|
59
|
-
};
|
|
60
|
-
});
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
appendProto(attrs());
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import {creatorFactory} from './creator';
|
|
2
|
-
|
|
3
|
-
const commonMaker = creatorFactory('');
|
|
4
|
-
|
|
5
|
-
export function create(type, field, title) {
|
|
6
|
-
let make = commonMaker('', field);
|
|
7
|
-
make._data.type = type;
|
|
8
|
-
make._data.title = title;
|
|
9
|
-
return make;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
export default function makerFactory() {
|
|
13
|
-
return {
|
|
14
|
-
create,
|
|
15
|
-
factory: creatorFactory
|
|
16
|
-
};
|
|
17
|
-
}
|