@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
|
@@ -1,373 +0,0 @@
|
|
|
1
|
-
import extend from '@bdsoft-element/utils/lib/extend';
|
|
2
|
-
import {byCtx, condition, copyRule, enumerable, getRule, invoke, parseFn, parseJson, toJson} from '../frame/util';
|
|
3
|
-
import is, {hasProperty} from '@bdsoft-element/utils/lib/type';
|
|
4
|
-
import {baseRule} from '../factory/creator';
|
|
5
|
-
import RuleContext from '../factory/context';
|
|
6
|
-
import mergeProps from '@bdsoft-element/utils/lib/mergeprops';
|
|
7
|
-
import {nextTick} from 'vue';
|
|
8
|
-
|
|
9
|
-
export default function useLoader(Handler) {
|
|
10
|
-
extend(Handler.prototype, {
|
|
11
|
-
nextRefresh(fn) {
|
|
12
|
-
const id = this.loadedId;
|
|
13
|
-
nextTick(() => {
|
|
14
|
-
id === this.loadedId && (fn ? fn() : this.refresh());
|
|
15
|
-
});
|
|
16
|
-
},
|
|
17
|
-
parseRule(_rule) {
|
|
18
|
-
const rule = getRule(_rule);
|
|
19
|
-
|
|
20
|
-
Object.defineProperties(rule, {
|
|
21
|
-
__origin__: enumerable(_rule, true)
|
|
22
|
-
});
|
|
23
|
-
|
|
24
|
-
fullRule(rule);
|
|
25
|
-
this.appendValue(rule);
|
|
26
|
-
|
|
27
|
-
[rule, rule['prefix'], rule['suffix']].forEach(item => {
|
|
28
|
-
if (!item) {
|
|
29
|
-
return;
|
|
30
|
-
}
|
|
31
|
-
this.loadFn(item, rule);
|
|
32
|
-
});
|
|
33
|
-
this.loadCtrl(rule);
|
|
34
|
-
if (rule.update) {
|
|
35
|
-
rule.update = parseFn(rule.update);
|
|
36
|
-
}
|
|
37
|
-
return rule;
|
|
38
|
-
},
|
|
39
|
-
loadFn(item, rule) {
|
|
40
|
-
['on', 'props', 'deep'].forEach(k => {
|
|
41
|
-
item[k] && this.parseInjectEvent(rule, item[k]);
|
|
42
|
-
});
|
|
43
|
-
},
|
|
44
|
-
loadCtrl(rule) {
|
|
45
|
-
rule.control && rule.control.forEach(ctrl => {
|
|
46
|
-
if (ctrl.handle) {
|
|
47
|
-
ctrl.handle = parseFn(ctrl.handle)
|
|
48
|
-
}
|
|
49
|
-
})
|
|
50
|
-
},
|
|
51
|
-
syncProp(ctx) {
|
|
52
|
-
const rule = ctx.rule;
|
|
53
|
-
is.trueArray(rule.sync) && mergeProps([{
|
|
54
|
-
on: rule.sync.reduce((pre, prop) => {
|
|
55
|
-
pre[(typeof prop === 'object' && prop.event) || `update:${prop}`] = (val) => {
|
|
56
|
-
rule.props[(typeof prop === 'object' && prop.prop) || prop] = val;
|
|
57
|
-
this.vm.emit('sync', prop, val, rule, this.fapi);
|
|
58
|
-
}
|
|
59
|
-
return pre
|
|
60
|
-
}, {})
|
|
61
|
-
}], ctx.computed)
|
|
62
|
-
},
|
|
63
|
-
loadRule() {
|
|
64
|
-
// console.warn('%c load', 'color:blue');
|
|
65
|
-
this.cycleLoad = false;
|
|
66
|
-
this.loading = true;
|
|
67
|
-
if (this.pageEnd) {
|
|
68
|
-
this.bus.$emit('load-start');
|
|
69
|
-
}
|
|
70
|
-
this.deferSyncValue(() => {
|
|
71
|
-
this._loadRule(this.rules);
|
|
72
|
-
this.loading = false;
|
|
73
|
-
if (this.cycleLoad && this.pageEnd) {
|
|
74
|
-
return this.loadRule();
|
|
75
|
-
}
|
|
76
|
-
this.syncForm();
|
|
77
|
-
if (this.pageEnd) {
|
|
78
|
-
this.bus.$emit('load-end');
|
|
79
|
-
}
|
|
80
|
-
this.vm.setupState.renderRule();
|
|
81
|
-
});
|
|
82
|
-
},
|
|
83
|
-
loadChildren(children, parent) {
|
|
84
|
-
this.cycleLoad = false;
|
|
85
|
-
this.loading = true;
|
|
86
|
-
this.bus.$emit('load-start');
|
|
87
|
-
this._loadRule(children, parent);
|
|
88
|
-
this.loading = false;
|
|
89
|
-
if (this.cycleLoad) {
|
|
90
|
-
return this.loadRule();
|
|
91
|
-
} else {
|
|
92
|
-
this.syncForm();
|
|
93
|
-
this.bus.$emit('load-end');
|
|
94
|
-
}
|
|
95
|
-
this.$render.clearCache(parent);
|
|
96
|
-
},
|
|
97
|
-
_loadRule(rules, parent) {
|
|
98
|
-
|
|
99
|
-
const preIndex = (i) => {
|
|
100
|
-
let pre = rules[i - 1];
|
|
101
|
-
if (!pre || !pre.__fc__) {
|
|
102
|
-
return i > 0 ? preIndex(i - 1) : -1;
|
|
103
|
-
}
|
|
104
|
-
let index = this.sort.indexOf(pre.__fc__.id);
|
|
105
|
-
return index > -1 ? index : preIndex(i - 1);
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
const loadChildren = (children, parent) => {
|
|
109
|
-
if (is.trueArray(children)) {
|
|
110
|
-
this._loadRule(children, parent);
|
|
111
|
-
}
|
|
112
|
-
};
|
|
113
|
-
|
|
114
|
-
const ctxs = rules.map((_rule, index) => {
|
|
115
|
-
if (parent && !is.Object(_rule)) return;
|
|
116
|
-
if (!this.pageEnd && !parent && index >= this.first) return;
|
|
117
|
-
|
|
118
|
-
if (_rule.__fc__ && _rule.__fc__.root === rules && this.ctxs[_rule.__fc__.id]) {
|
|
119
|
-
loadChildren(_rule.__fc__.loadChildrenPending(), _rule.__fc__);
|
|
120
|
-
return _rule.__fc__;
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
let rule = getRule(_rule);
|
|
124
|
-
|
|
125
|
-
const isRepeat = () => {
|
|
126
|
-
return !!(rule.field && this.fieldCtx[rule.field] && this.fieldCtx[rule.field][0] !== _rule.__fc__)
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
this.fc.targetFormDriver('loadRule', {rule, api: this.api}, this.fc);
|
|
130
|
-
this.ruleEffect(rule, 'init', {repeat: isRepeat()});
|
|
131
|
-
|
|
132
|
-
if (isRepeat()) {
|
|
133
|
-
this.vm.emit('repeat-field', _rule, this.api);
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
let ctx;
|
|
137
|
-
let isCopy = false;
|
|
138
|
-
let isInit = !!_rule.__fc__;
|
|
139
|
-
let defaultValue = rule.value;
|
|
140
|
-
if (isInit) {
|
|
141
|
-
ctx = _rule.__fc__;
|
|
142
|
-
defaultValue = ctx.defaultValue;
|
|
143
|
-
if (ctx.deleted) {
|
|
144
|
-
if (isCtrl(ctx)) {
|
|
145
|
-
return;
|
|
146
|
-
}
|
|
147
|
-
ctx.update(this);
|
|
148
|
-
} else {
|
|
149
|
-
if (!ctx.check(this)) {
|
|
150
|
-
if (isCtrl(ctx)) {
|
|
151
|
-
return;
|
|
152
|
-
}
|
|
153
|
-
rules[index] = _rule = _rule._clone ? _rule._clone() : parseJson(toJson(_rule));
|
|
154
|
-
ctx = null;
|
|
155
|
-
isCopy = true;
|
|
156
|
-
}
|
|
157
|
-
}
|
|
158
|
-
}
|
|
159
|
-
if (!ctx) {
|
|
160
|
-
const rule = this.parseRule(_rule);
|
|
161
|
-
ctx = new RuleContext(this, rule, defaultValue);
|
|
162
|
-
this.bindParser(ctx);
|
|
163
|
-
} else {
|
|
164
|
-
if (ctx.originType !== ctx.rule.type) {
|
|
165
|
-
ctx.updateType();
|
|
166
|
-
}
|
|
167
|
-
this.bindParser(ctx);
|
|
168
|
-
this.appendValue(ctx.rule);
|
|
169
|
-
if (ctx.parent && ctx.parent !== parent) {
|
|
170
|
-
this.rmSubRuleData(ctx);
|
|
171
|
-
}
|
|
172
|
-
}
|
|
173
|
-
this.parseEmit(ctx);
|
|
174
|
-
this.syncProp(ctx);
|
|
175
|
-
ctx.parent = parent || null;
|
|
176
|
-
ctx.root = rules;
|
|
177
|
-
this.setCtx(ctx);
|
|
178
|
-
|
|
179
|
-
if (!isCopy && !isInit) {
|
|
180
|
-
this.effect(ctx, 'load');
|
|
181
|
-
this.targetHook(ctx, 'load');
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
this.effect(ctx, 'created');
|
|
185
|
-
|
|
186
|
-
const _load = ctx.loadChildrenPending()
|
|
187
|
-
ctx.parser.loadChildren === false || loadChildren(_load, ctx);
|
|
188
|
-
|
|
189
|
-
if (!parent) {
|
|
190
|
-
const _preIndex = preIndex(index);
|
|
191
|
-
if (_preIndex > -1 || !index) {
|
|
192
|
-
this.sort.splice(_preIndex + 1, 0, ctx.id);
|
|
193
|
-
} else {
|
|
194
|
-
this.sort.push(ctx.id);
|
|
195
|
-
}
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
const r = ctx.rule;
|
|
199
|
-
if (!ctx.updated) {
|
|
200
|
-
ctx.updated = true;
|
|
201
|
-
if (is.Function(r.update)) {
|
|
202
|
-
this.bus.$once('load-end', () => {
|
|
203
|
-
this.refreshUpdate(ctx, r.value, 'init');
|
|
204
|
-
});
|
|
205
|
-
}
|
|
206
|
-
this.effect(ctx, 'loaded');
|
|
207
|
-
}
|
|
208
|
-
|
|
209
|
-
// if (ctx.input)
|
|
210
|
-
// Object.defineProperty(r, 'value', this.valueHandle(ctx));
|
|
211
|
-
if (this.refreshControl(ctx)) this.cycleLoad = true;
|
|
212
|
-
return ctx;
|
|
213
|
-
}).filter(v => !!v);
|
|
214
|
-
if (parent) {
|
|
215
|
-
parent.children = ctxs;
|
|
216
|
-
}
|
|
217
|
-
},
|
|
218
|
-
refreshControl(ctx) {
|
|
219
|
-
return ctx.input && ctx.rule.control && this.useCtrl(ctx);
|
|
220
|
-
},
|
|
221
|
-
useCtrl(ctx) {
|
|
222
|
-
const controls = getCtrl(ctx), validate = [], api = this.api;
|
|
223
|
-
if (!controls.length) return false;
|
|
224
|
-
|
|
225
|
-
for (let i = 0; i < controls.length; i++) {
|
|
226
|
-
const control = controls[i], handleFn = control.handle || function (val) {
|
|
227
|
-
return ((condition[control.condition || '=='] || condition['=='])(val, control.value));
|
|
228
|
-
};
|
|
229
|
-
if (!is.trueArray(control.rule)) continue;
|
|
230
|
-
const data = {
|
|
231
|
-
...control,
|
|
232
|
-
valid: invoke(() => handleFn(ctx.rule.value, api)),
|
|
233
|
-
ctrl: findCtrl(ctx, control.rule),
|
|
234
|
-
isHidden: is.String(control.rule[0]),
|
|
235
|
-
};
|
|
236
|
-
if ((data.valid && data.ctrl) || (!data.valid && !data.ctrl && !data.isHidden)) continue;
|
|
237
|
-
validate.push(data);
|
|
238
|
-
}
|
|
239
|
-
if (!validate.length) return false;
|
|
240
|
-
|
|
241
|
-
const hideLst = [];
|
|
242
|
-
let flag = false;
|
|
243
|
-
this.deferSyncValue(() => {
|
|
244
|
-
validate.reverse().forEach(({isHidden, valid, rule, prepend, append, child, ctrl, method}) => {
|
|
245
|
-
if (isHidden) {
|
|
246
|
-
valid ? ctx.ctrlRule.push({
|
|
247
|
-
__ctrl: true,
|
|
248
|
-
children: rule,
|
|
249
|
-
valid
|
|
250
|
-
})
|
|
251
|
-
: (ctrl && ctx.ctrlRule.splice(ctx.ctrlRule.indexOf(ctrl) >>> 0, 1));
|
|
252
|
-
hideLst[valid ? 'push' : 'unshift'](() => {
|
|
253
|
-
if (method === 'disabled' || method === 'enabled') {
|
|
254
|
-
this.api.disabled(!valid, rule);
|
|
255
|
-
} else if (method === 'display') {
|
|
256
|
-
this.api.display(valid, rule);
|
|
257
|
-
} else if (method === 'required') {
|
|
258
|
-
rule.forEach(item => {
|
|
259
|
-
this.api.setEffect(item, 'required', valid);
|
|
260
|
-
})
|
|
261
|
-
if (!valid) {
|
|
262
|
-
this.api.clearValidateState(rule);
|
|
263
|
-
}
|
|
264
|
-
} else {
|
|
265
|
-
this.api.hidden(!valid, rule);
|
|
266
|
-
}
|
|
267
|
-
});
|
|
268
|
-
return;
|
|
269
|
-
}
|
|
270
|
-
if (valid) {
|
|
271
|
-
flag = true;
|
|
272
|
-
const ruleCon = {
|
|
273
|
-
type: 'fragment',
|
|
274
|
-
native: true,
|
|
275
|
-
__ctrl: true,
|
|
276
|
-
children: rule,
|
|
277
|
-
}
|
|
278
|
-
ctx.ctrlRule.push(ruleCon);
|
|
279
|
-
this.bus.$once('load-start', () => {
|
|
280
|
-
// this.cycleLoad = true;
|
|
281
|
-
if (prepend) {
|
|
282
|
-
api.prepend(ruleCon, prepend, child)
|
|
283
|
-
} else if (append || child) {
|
|
284
|
-
api.append(ruleCon, append || ctx.id, child)
|
|
285
|
-
} else {
|
|
286
|
-
ctx.root.splice(ctx.root.indexOf(ctx.origin) + 1, 0, ruleCon);
|
|
287
|
-
}
|
|
288
|
-
});
|
|
289
|
-
} else {
|
|
290
|
-
ctx.ctrlRule.splice(ctx.ctrlRule.indexOf(ctrl), 1);
|
|
291
|
-
const ctrlCtx = byCtx(ctrl);
|
|
292
|
-
ctrlCtx && ctrlCtx.rm();
|
|
293
|
-
}
|
|
294
|
-
});
|
|
295
|
-
});
|
|
296
|
-
if (hideLst.length) {
|
|
297
|
-
if (this.loading) {
|
|
298
|
-
hideLst.length && this.bus.$once('load-end', () => {
|
|
299
|
-
hideLst.forEach(v => v());
|
|
300
|
-
});
|
|
301
|
-
} else {
|
|
302
|
-
hideLst.length && nextTick(() => {
|
|
303
|
-
hideLst.forEach(v => v());
|
|
304
|
-
});
|
|
305
|
-
}
|
|
306
|
-
}
|
|
307
|
-
this.vm.emit('control', ctx.origin, this.api);
|
|
308
|
-
this.effect(ctx, 'control');
|
|
309
|
-
return flag;
|
|
310
|
-
},
|
|
311
|
-
reloadRule(rules) {
|
|
312
|
-
return this._reloadRule(rules);
|
|
313
|
-
},
|
|
314
|
-
_reloadRule(rules) {
|
|
315
|
-
// console.warn('%c reload', 'color:red');
|
|
316
|
-
if (!rules) rules = this.rules;
|
|
317
|
-
|
|
318
|
-
const ctxs = {...this.ctxs};
|
|
319
|
-
|
|
320
|
-
this.clearNextTick();
|
|
321
|
-
this.initData(rules);
|
|
322
|
-
this.fc.rules = rules;
|
|
323
|
-
|
|
324
|
-
this.deferSyncValue(() => {
|
|
325
|
-
this.bus.$once('load-end', () => {
|
|
326
|
-
Object.keys(ctxs).filter(id => this.ctxs[id] === undefined)
|
|
327
|
-
.forEach(id => this.rmCtx(ctxs[id]));
|
|
328
|
-
this.$render.clearCacheAll();
|
|
329
|
-
});
|
|
330
|
-
this.reloading = true;
|
|
331
|
-
this.loadRule();
|
|
332
|
-
this.reloading = false;
|
|
333
|
-
this.refresh();
|
|
334
|
-
this.bus.$emit('reloading', this.api);
|
|
335
|
-
});
|
|
336
|
-
|
|
337
|
-
this.bus.$off('next-tick', this.nextReload);
|
|
338
|
-
this.bus.$once('next-tick', this.nextReload);
|
|
339
|
-
this.bus.$emit('update', this.api);
|
|
340
|
-
},
|
|
341
|
-
//todo 组件生成全部通过 alias
|
|
342
|
-
refresh() {
|
|
343
|
-
this.vm.setupState.refresh();
|
|
344
|
-
},
|
|
345
|
-
});
|
|
346
|
-
}
|
|
347
|
-
|
|
348
|
-
function fullRule(rule) {
|
|
349
|
-
const def = baseRule();
|
|
350
|
-
|
|
351
|
-
Object.keys(def).forEach(k => {
|
|
352
|
-
if (!hasProperty(rule, k)) rule[k] = def[k];
|
|
353
|
-
});
|
|
354
|
-
return rule;
|
|
355
|
-
}
|
|
356
|
-
|
|
357
|
-
function getCtrl(ctx) {
|
|
358
|
-
const control = ctx.rule.control || [];
|
|
359
|
-
if (is.Object(control)) return [control];
|
|
360
|
-
else return control;
|
|
361
|
-
}
|
|
362
|
-
|
|
363
|
-
function findCtrl(ctx, rule) {
|
|
364
|
-
for (let i = 0; i < ctx.ctrlRule.length; i++) {
|
|
365
|
-
const ctrl = ctx.ctrlRule[i];
|
|
366
|
-
if (ctrl.children === rule)
|
|
367
|
-
return ctrl;
|
|
368
|
-
}
|
|
369
|
-
}
|
|
370
|
-
|
|
371
|
-
function isCtrl(ctx) {
|
|
372
|
-
return !!ctx.rule.__ctrl;
|
|
373
|
-
}
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import extend from '@bdsoft-element/utils/lib/extend';
|
|
2
|
-
import is from '@bdsoft-element/utils/lib/type';
|
|
3
|
-
|
|
4
|
-
const EVENT = ['hook:updated', 'hook:mounted'];
|
|
5
|
-
|
|
6
|
-
export default function usePage(Handler) {
|
|
7
|
-
extend(Handler.prototype, {
|
|
8
|
-
usePage() {
|
|
9
|
-
const page = this.options.page;
|
|
10
|
-
if (!page) return;
|
|
11
|
-
let first = 25;
|
|
12
|
-
let limit = getLimit(this.rules);
|
|
13
|
-
if (is.Object(page)) {
|
|
14
|
-
if (page.first) first = parseInt(page.first, 10) || first;
|
|
15
|
-
if (page.limit) limit = parseInt(page.limit, 10) || limit;
|
|
16
|
-
}
|
|
17
|
-
extend(this, {
|
|
18
|
-
first,
|
|
19
|
-
limit,
|
|
20
|
-
pageEnd: this.rules.length <= first,
|
|
21
|
-
})
|
|
22
|
-
|
|
23
|
-
this.bus.$on('page-end', () => this.vm.emit('page-end', this.api));
|
|
24
|
-
this.pageLoad();
|
|
25
|
-
},
|
|
26
|
-
pageLoad() {
|
|
27
|
-
const pageFn = () => {
|
|
28
|
-
if (this.pageEnd) {
|
|
29
|
-
this.bus.$off(EVENT, pageFn);
|
|
30
|
-
this.bus.$emit('page-end');
|
|
31
|
-
} else {
|
|
32
|
-
this.first += this.limit;
|
|
33
|
-
this.pageEnd = this.rules.length <= this.first;
|
|
34
|
-
this.loadRule();
|
|
35
|
-
this.refresh();
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
this.bus.$on(EVENT, pageFn);
|
|
39
|
-
},
|
|
40
|
-
})
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
function getLimit(rules) {
|
|
45
|
-
return rules.length < 31 ? 31 : Math.ceil(rules.length / 3);
|
|
46
|
-
}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import extend from '@bdsoft-element/utils/lib/extend';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
export default function useRender(Handler) {
|
|
5
|
-
extend(Handler.prototype, {
|
|
6
|
-
clearNextTick() {
|
|
7
|
-
this.nextTick && clearTimeout(this.nextTick);
|
|
8
|
-
this.nextTick = null;
|
|
9
|
-
},
|
|
10
|
-
bindNextTick(fn) {
|
|
11
|
-
this.clearNextTick();
|
|
12
|
-
this.nextTick = setTimeout(() => {
|
|
13
|
-
fn()
|
|
14
|
-
this.nextTick = null;
|
|
15
|
-
}, 10);
|
|
16
|
-
},
|
|
17
|
-
render() {
|
|
18
|
-
// console.warn('%c render', 'color:green');
|
|
19
|
-
++this.loadedId;
|
|
20
|
-
|
|
21
|
-
if (this.vm.setupState.unique > 0)
|
|
22
|
-
return this.$render.render();
|
|
23
|
-
else {
|
|
24
|
-
this.vm.setupState.unique = 1;
|
|
25
|
-
return [];
|
|
26
|
-
}
|
|
27
|
-
},
|
|
28
|
-
});
|
|
29
|
-
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import FormCreateFactory from './frame/index';
|
|
2
|
-
import fragment from './components/fragment';
|
|
3
|
-
import Creator, {creatorFactory} from './factory/creator';
|
|
4
|
-
import Manager from './factory/manager';
|
|
5
|
-
import {copyRule, copyRules, mergeRule, parseJson, toJson} from './frame/util';
|
|
6
|
-
|
|
7
|
-
export {
|
|
8
|
-
creatorFactory, Creator, Manager,
|
|
9
|
-
parseJson, toJson, copyRule, copyRules, mergeRule, fragment
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
export default FormCreateFactory;
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@bdsoft-element/formcore",
|
|
3
|
-
"version": "1.0.0",
|
|
4
|
-
"description": "",
|
|
5
|
-
"main": "index.js",
|
|
6
|
-
"scripts": {
|
|
7
|
-
"test": "echo \"Error: no test specified\" && exit 1"
|
|
8
|
-
},
|
|
9
|
-
"keywords": [],
|
|
10
|
-
"author": "",
|
|
11
|
-
"license": "ISC",
|
|
12
|
-
"dependencies": {
|
|
13
|
-
"@bdsoft-element/utils": "workspace:^"
|
|
14
|
-
}
|
|
15
|
-
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import is from '@bdsoft-element/utils/lib/type';
|
|
2
|
-
|
|
3
|
-
const name = 'html';
|
|
4
|
-
|
|
5
|
-
export default {
|
|
6
|
-
name,
|
|
7
|
-
loadChildren: false,
|
|
8
|
-
render(children, ctx) {
|
|
9
|
-
ctx.prop.props.innerHTML = children.default();
|
|
10
|
-
return ctx.vNode.make(ctx.prop.props.tag || 'div', ctx.prop);
|
|
11
|
-
},
|
|
12
|
-
renderChildren(children) {
|
|
13
|
-
return {
|
|
14
|
-
default: () => children.filter(v => is.String(v)).join('')
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
}
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import extend from '@bdsoft-element/utils/lib/extend';
|
|
2
|
-
|
|
3
|
-
export default function useCache(Render) {
|
|
4
|
-
extend(Render.prototype, {
|
|
5
|
-
initCache() {
|
|
6
|
-
this.clearCacheAll();
|
|
7
|
-
},
|
|
8
|
-
clearCache(ctx) {
|
|
9
|
-
if (ctx.rule.cache) {
|
|
10
|
-
return;
|
|
11
|
-
}
|
|
12
|
-
if (!this.cache[ctx.id]) {
|
|
13
|
-
if (ctx.parent) {
|
|
14
|
-
this.clearCache(ctx.parent);
|
|
15
|
-
}
|
|
16
|
-
return;
|
|
17
|
-
}
|
|
18
|
-
if (this.cache[ctx.id].use === true || this.cache[ctx.id].parent) {
|
|
19
|
-
this.$handle.refresh();
|
|
20
|
-
}
|
|
21
|
-
if (this.cache[ctx.id].parent) {
|
|
22
|
-
this.clearCache(this.cache[ctx.id].parent);
|
|
23
|
-
}
|
|
24
|
-
this.cache[ctx.id] = null;
|
|
25
|
-
},
|
|
26
|
-
clearCacheAll() {
|
|
27
|
-
this.cache = {};
|
|
28
|
-
},
|
|
29
|
-
setCache(ctx, vnode, parent) {
|
|
30
|
-
this.cache[ctx.id] = {
|
|
31
|
-
vnode,
|
|
32
|
-
use: false,
|
|
33
|
-
parent,
|
|
34
|
-
slot: ctx.rule.slot
|
|
35
|
-
};
|
|
36
|
-
},
|
|
37
|
-
getCache(ctx) {
|
|
38
|
-
const cache = this.cache[ctx.id];
|
|
39
|
-
if (cache) {
|
|
40
|
-
cache.use = true;
|
|
41
|
-
return cache.vnode;
|
|
42
|
-
}
|
|
43
|
-
return undefined;
|
|
44
|
-
}
|
|
45
|
-
})
|
|
46
|
-
|
|
47
|
-
}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import useCache from './cache';
|
|
2
|
-
import useRender from './render';
|
|
3
|
-
import extend from '@bdsoft-element/utils/lib/extend';
|
|
4
|
-
import {funcProxy} from '../frame/util';
|
|
5
|
-
|
|
6
|
-
let id = 1;
|
|
7
|
-
export default function Render(handle) {
|
|
8
|
-
extend(this, {
|
|
9
|
-
$handle: handle,
|
|
10
|
-
fc: handle.fc,
|
|
11
|
-
vm: handle.vm,
|
|
12
|
-
$manager: handle.$manager,
|
|
13
|
-
vNode: new handle.fc.CreateNode(handle.vm),
|
|
14
|
-
id:id++
|
|
15
|
-
});
|
|
16
|
-
|
|
17
|
-
funcProxy(this, {
|
|
18
|
-
options() {
|
|
19
|
-
return handle.options;
|
|
20
|
-
},
|
|
21
|
-
sort() {
|
|
22
|
-
return handle.sort;
|
|
23
|
-
}
|
|
24
|
-
})
|
|
25
|
-
|
|
26
|
-
this.initCache();
|
|
27
|
-
this.initRender();
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
useCache(Render);
|
|
31
|
-
useRender(Render)
|