@bdsoft/element 1.1.0
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 +90 -0
- package/global/index.ts +6 -0
- package/global/register-properties.ts +10 -0
- package/index.html +13 -0
- package/index.js +84 -0
- package/package-form/core/components/formCreate.js +274 -0
- package/package-form/core/components/fragment.js +12 -0
- package/package-form/core/factory/context.js +257 -0
- package/package-form/core/factory/creator.js +63 -0
- package/package-form/core/factory/maker.js +17 -0
- package/package-form/core/factory/manager.js +79 -0
- package/package-form/core/factory/node.js +85 -0
- package/package-form/core/factory/parser.js +28 -0
- package/package-form/core/frame/api.js +599 -0
- package/package-form/core/frame/attrs.js +12 -0
- package/package-form/core/frame/dataDriver.js +76 -0
- package/package-form/core/frame/fetch.js +119 -0
- package/package-form/core/frame/formCreate.js +274 -0
- package/package-form/core/frame/index.js +760 -0
- package/package-form/core/frame/provider.js +288 -0
- package/package-form/core/frame/util.js +274 -0
- package/package-form/core/handler/context.js +380 -0
- package/package-form/core/handler/effect.js +122 -0
- package/package-form/core/handler/index.js +111 -0
- package/package-form/core/handler/inject.js +145 -0
- package/package-form/core/handler/input.js +197 -0
- package/package-form/core/handler/lifecycle.js +43 -0
- package/package-form/core/handler/loader.js +373 -0
- package/package-form/core/handler/page.js +46 -0
- package/package-form/core/handler/render.js +29 -0
- package/package-form/core/index.js +12 -0
- package/package-form/core/package.json +15 -0
- package/package-form/core/parser/html.js +17 -0
- package/package-form/core/render/cache.js +47 -0
- package/package-form/core/render/index.js +31 -0
- package/package-form/core/render/render.js +393 -0
- package/package-form/element-form/components/checkbox/package.json +17 -0
- package/package-form/element-form/components/checkbox/src/component.jsx +110 -0
- package/package-form/element-form/components/checkbox/src/index.js +3 -0
- package/package-form/element-form/components/frame/package.json +17 -0
- package/package-form/element-form/components/frame/src/IconCircleClose.vue +14 -0
- package/package-form/element-form/components/frame/src/IconDelete.vue +12 -0
- package/package-form/element-form/components/frame/src/IconDocument.vue +12 -0
- package/package-form/element-form/components/frame/src/IconFolderOpened.vue +12 -0
- package/package-form/element-form/components/frame/src/IconView.vue +12 -0
- package/package-form/element-form/components/frame/src/component.jsx +349 -0
- package/package-form/element-form/components/frame/src/index.js +3 -0
- package/package-form/element-form/components/frame/src/style.css +66 -0
- package/package-form/element-form/components/group/package.json +17 -0
- package/package-form/element-form/components/group/src/component.jsx +314 -0
- package/package-form/element-form/components/group/src/index.js +3 -0
- package/package-form/element-form/components/group/src/style.css +125 -0
- package/package-form/element-form/components/index.js +22 -0
- package/package-form/element-form/components/radio/package.json +17 -0
- package/package-form/element-form/components/radio/src/component.jsx +101 -0
- package/package-form/element-form/components/radio/src/index.js +3 -0
- package/package-form/element-form/components/select/package.json +17 -0
- package/package-form/element-form/components/select/src/component.jsx +52 -0
- package/package-form/element-form/components/select/src/index.js +3 -0
- package/package-form/element-form/components/subform/package.json +14 -0
- package/package-form/element-form/components/subform/src/component.jsx +76 -0
- package/package-form/element-form/components/subform/src/index.js +3 -0
- package/package-form/element-form/components/tree/package.json +17 -0
- package/package-form/element-form/components/tree/src/component.jsx +62 -0
- package/package-form/element-form/components/tree/src/index.js +3 -0
- package/package-form/element-form/components/upload/package.json +17 -0
- package/package-form/element-form/components/upload/src/IconUpload.vue +12 -0
- package/package-form/element-form/components/upload/src/component.jsx +129 -0
- package/package-form/element-form/components/upload/src/index.js +3 -0
- package/package-form/element-form/components/upload/src/style.css +11 -0
- package/package-form/element-form/index.js +8 -0
- package/package-form/element-form/package.json +16 -0
- package/package-form/element-form/src/components/icon/IconWarning.vue +12 -0
- package/package-form/element-form/src/components/index.js +22 -0
- package/package-form/element-form/src/core/alias.js +34 -0
- package/package-form/element-form/src/core/api.js +208 -0
- package/package-form/element-form/src/core/config.js +62 -0
- package/package-form/element-form/src/core/index.js +60 -0
- package/package-form/element-form/src/core/maker.js +76 -0
- package/package-form/element-form/src/core/manager.js +315 -0
- package/package-form/element-form/src/core/provider.js +79 -0
- package/package-form/element-form/src/parsers/datePicker.js +31 -0
- package/package-form/element-form/src/parsers/hidden.js +12 -0
- package/package-form/element-form/src/parsers/index.js +17 -0
- package/package-form/element-form/src/parsers/input.js +21 -0
- package/package-form/element-form/src/parsers/row.js +10 -0
- package/package-form/element-form/src/parsers/select.js +15 -0
- package/package-form/element-form/src/parsers/slider.js +21 -0
- package/package-form/element-form/src/parsers/timePicker.js +17 -0
- package/package-form/element-form/src/style/index.css +52 -0
- package/package.json +17 -0
- package/src/App.vue +28 -0
- package/src/assets/css/element.scss +179 -0
- package/src/assets/css/layout.scss +215 -0
- package/src/assets/css/tailwind.scss +67 -0
- package/src/assets/images/banner.gif +0 -0
- package/src/assets/images/banner.png +0 -0
- package/src/assets/images/bg1.svg +22 -0
- 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 +346 -0
- package/src/components/3dcloudwords/index.vue +99 -0
- package/src/components/3dcloudwords/readme.md +66 -0
- package/src/components/badge/index.js +167 -0
- package/src/components/badge/index.scss +166 -0
- package/src/components/badge/index.vue +98 -0
- package/src/components/badge/readme.md +18 -0
- package/src/components/basic/Finish.vue +107 -0
- package/src/components/basic/button.vue +19 -0
- package/src/components/basic/readme.md +7 -0
- package/src/components/button/index.vue +48 -0
- package/src/components/button/readme.md +62 -0
- package/src/components/carousel/index.vue +104 -0
- package/src/components/carousel/readme.md +12 -0
- package/src/components/chartconfig/index.vue +141 -0
- package/src/components/chartconfig/readme.md +25 -0
- package/src/components/contextMenu/hookContxtMenu.js +41 -0
- package/src/components/contextMenu/index.vue +245 -0
- package/src/components/contextMenu/readme.md +55 -0
- package/src/components/contextMenu/useElementBounding.js +40 -0
- package/src/components/countup/countUp.js +196 -0
- package/src/components/countup/index.vue +112 -0
- package/src/components/countup/readme.md +9 -0
- 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 +117 -0
- package/src/components/empty/empty.vue +120 -0
- package/src/components/empty/index.js +12 -0
- package/src/components/empty/invalid.vue +56 -0
- package/src/components/error/Error.vue +79 -0
- package/src/components/error/readme.md +20 -0
- package/src/components/form/Form.vue +84 -0
- package/src/components/form/FormItem.vue +143 -0
- package/src/components/form/data.js +52 -0
- package/src/components/form/readme.md +69 -0
- package/src/components/layout/banner.vue +412 -0
- package/src/components/layout/bar.vue +43 -0
- package/src/components/layout/layout1.vue +60 -0
- package/src/components/layout/layout2.vue +134 -0
- package/src/components/layout/layout3.vue +107 -0
- package/src/components/layout/layout4.vue +66 -0
- package/src/components/layout/nav.vue +333 -0
- package/src/components/layout/readme.md +61 -0
- package/src/components/loading/index.vue +122 -0
- package/src/components/loading/readme.md +6 -0
- package/src/components/notice/NoticeList.vue +198 -0
- package/src/components/notice/NoticeListPaging.vue +281 -0
- package/src/components/notice/NoticeView.vue +92 -0
- package/src/components/notice/readme.md +1 -0
- package/src/components/pagination/index.vue +100 -0
- package/src/components/pagination/readme.md +19 -0
- package/src/components/pagination/scroll-to.js +51 -0
- package/src/components/progress/bar.vue +72 -0
- package/src/components/progress/progress.vue +58 -0
- package/src/components/screenfull/index.js +3 -0
- package/src/components/screenfull/index.vue +65 -0
- package/src/components/screenfull/package.json +15 -0
- package/src/components/screenfull/readme.md +6 -0
- package/src/components/statisticalCount/index.vue +80 -0
- package/src/components/statisticalCount/readme.md +21 -0
- package/src/components/username/index.vue +79 -0
- package/src/components/username/readme.md +22 -0
- package/src/components/username//346/225/210/346/236/234/345/233/276.png +0 -0
- package/src/index.js +82 -0
- package/src/utils/index.js +32 -0
- package/src/xm_components/HeadSearch/hook/hookSearch.js +96 -0
- package/src/xm_components/HeadSearch/index.vue +206 -0
- package/src/xm_components/HeadSearch/readme.md +12 -0
- 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 +212 -0
- package/src/xm_components/Milestone/readme.md +15 -0
- package/src/xm_components/readme.md +1 -0
- package/utils/coms/load.jsx +10 -0
- package/utils/func.js +32 -0
- package/utils/hookDialog.js +38 -0
- package/utils/hookPage.js +49 -0
- package/utils/index.js +5 -0
- package/utils/lib/console.js +39 -0
- package/utils/lib/debounce.js +19 -0
- package/utils/lib/deepextend.js +51 -0
- package/utils/lib/deepset.js +14 -0
- package/utils/lib/extend.js +28 -0
- package/utils/lib/index.js +13 -0
- package/utils/lib/json.js +90 -0
- package/utils/lib/mergeprops.js +62 -0
- package/utils/lib/mitt.js +43 -0
- package/utils/lib/modify.js +8 -0
- package/utils/lib/slot.js +19 -0
- package/utils/lib/toarray.js +5 -0
- package/utils/lib/tocase.js +11 -0
- package/utils/lib/todate.js +10 -0
- package/utils/lib/toline.js +10 -0
- package/utils/lib/tostring.js +7 -0
- package/utils/lib/type.js +45 -0
- package/utils/lib/unique.js +6 -0
- package/utils/message.js +166 -0
- package/utils/package.json +16 -0
- package/utils/type.js +45 -0
- package/vite.config.js +51 -0
|
@@ -0,0 +1,314 @@
|
|
|
1
|
+
import {hasProperty} from '@bdsoft-element/utils/lib/type';
|
|
2
|
+
import {defineComponent, markRaw, nextTick, watch} from 'vue';
|
|
3
|
+
import deepExtend, {deepCopy} from '@bdsoft-element/utils/lib/deepextend';
|
|
4
|
+
import extend from '@bdsoft-element/utils/lib/extend';
|
|
5
|
+
import './style.css';
|
|
6
|
+
|
|
7
|
+
const NAME = 'fcGroup';
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
export default defineComponent({
|
|
11
|
+
name: NAME,
|
|
12
|
+
props: {
|
|
13
|
+
field: String,
|
|
14
|
+
rule: Array,
|
|
15
|
+
expand: Number,
|
|
16
|
+
options: Object,
|
|
17
|
+
button: {
|
|
18
|
+
type: Boolean,
|
|
19
|
+
default: true
|
|
20
|
+
},
|
|
21
|
+
max: {
|
|
22
|
+
type: Number,
|
|
23
|
+
default: 0
|
|
24
|
+
},
|
|
25
|
+
min: {
|
|
26
|
+
type: Number,
|
|
27
|
+
default: 0
|
|
28
|
+
},
|
|
29
|
+
modelValue: {
|
|
30
|
+
type: Array,
|
|
31
|
+
default: () => []
|
|
32
|
+
},
|
|
33
|
+
defaultValue: Object,
|
|
34
|
+
sortBtn: {
|
|
35
|
+
type: Boolean,
|
|
36
|
+
default: true
|
|
37
|
+
},
|
|
38
|
+
disabled: {
|
|
39
|
+
type: Boolean,
|
|
40
|
+
default: false
|
|
41
|
+
},
|
|
42
|
+
syncDisabled: {
|
|
43
|
+
type: Boolean,
|
|
44
|
+
default: true
|
|
45
|
+
},
|
|
46
|
+
onBeforeRemove: {
|
|
47
|
+
type: Function,
|
|
48
|
+
default: () => {
|
|
49
|
+
}
|
|
50
|
+
},
|
|
51
|
+
onBeforeAdd: {
|
|
52
|
+
type: Function,
|
|
53
|
+
default: () => {
|
|
54
|
+
}
|
|
55
|
+
},
|
|
56
|
+
formCreateInject: Object,
|
|
57
|
+
parse: Function,
|
|
58
|
+
},
|
|
59
|
+
data() {
|
|
60
|
+
return {
|
|
61
|
+
len: 0,
|
|
62
|
+
cacheRule: {},
|
|
63
|
+
cacheValue: {},
|
|
64
|
+
sort: [],
|
|
65
|
+
form: markRaw(this.formCreateInject.form.$form())
|
|
66
|
+
}
|
|
67
|
+
},
|
|
68
|
+
emits: ['update:modelValue', 'change', 'itemMounted', 'remove', 'add'],
|
|
69
|
+
watch: {
|
|
70
|
+
rule: {
|
|
71
|
+
handler(n, o) {
|
|
72
|
+
Object.keys(this.cacheRule).forEach(v => {
|
|
73
|
+
const item = this.cacheRule[v];
|
|
74
|
+
if (item.$f) {
|
|
75
|
+
const val = item.$f.formData();
|
|
76
|
+
if (n === o) {
|
|
77
|
+
item.$f.deferSyncValue(() => {
|
|
78
|
+
deepExtend(item.rule, n);
|
|
79
|
+
item.$f.setValue(val);
|
|
80
|
+
}, true);
|
|
81
|
+
} else {
|
|
82
|
+
const val = item.$f.formData();
|
|
83
|
+
item.$f.once('reloading', () => {
|
|
84
|
+
item.$f.setValue(val);
|
|
85
|
+
})
|
|
86
|
+
item.rule = deepCopy(n);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
})
|
|
90
|
+
},
|
|
91
|
+
deep: true
|
|
92
|
+
},
|
|
93
|
+
expand(n) {
|
|
94
|
+
let d = n - this.modelValue.length;
|
|
95
|
+
if (d > 0) {
|
|
96
|
+
this.expandRule(d);
|
|
97
|
+
}
|
|
98
|
+
},
|
|
99
|
+
modelValue: {
|
|
100
|
+
handler(n) {
|
|
101
|
+
n = n || [];
|
|
102
|
+
let keys = this.sort, total = keys.length, len = total - n.length;
|
|
103
|
+
if (len < 0) {
|
|
104
|
+
for (let i = len; i < 0; i++) {
|
|
105
|
+
this.addRule(n.length + i, true);
|
|
106
|
+
}
|
|
107
|
+
for (let i = 0; i < total; i++) {
|
|
108
|
+
this.setValue(keys[i], n[i]);
|
|
109
|
+
}
|
|
110
|
+
} else {
|
|
111
|
+
if (len > 0) {
|
|
112
|
+
for (let i = 0; i < len; i++) {
|
|
113
|
+
this.removeRule(keys[total - i - 1]);
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
n.forEach((val, i) => {
|
|
117
|
+
this.setValue(keys[i], n[i]);
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
},
|
|
121
|
+
deep: true,
|
|
122
|
+
}
|
|
123
|
+
},
|
|
124
|
+
methods: {
|
|
125
|
+
_value(v) {
|
|
126
|
+
return (v && hasProperty(v, this.field)) ? v[this.field] : v;
|
|
127
|
+
},
|
|
128
|
+
cache(k, val) {
|
|
129
|
+
this.cacheValue[k] = JSON.stringify(val);
|
|
130
|
+
},
|
|
131
|
+
input(value) {
|
|
132
|
+
this.$emit('update:modelValue', value);
|
|
133
|
+
this.$emit('change', value);
|
|
134
|
+
},
|
|
135
|
+
formData(key, formData) {
|
|
136
|
+
const cacheRule = this.cacheRule;
|
|
137
|
+
const keys = this.sort;
|
|
138
|
+
if (keys.filter(k => cacheRule[k].$f).length !== keys.length) {
|
|
139
|
+
return;
|
|
140
|
+
}
|
|
141
|
+
const value = keys.map(k => {
|
|
142
|
+
const data = key === k ? formData : {...this.cacheRule[k].$f.form};
|
|
143
|
+
const value = this.field ? data[this.field] || null : data;
|
|
144
|
+
this.cache(k, value);
|
|
145
|
+
return value;
|
|
146
|
+
});
|
|
147
|
+
this.input(value);
|
|
148
|
+
},
|
|
149
|
+
setValue(key, value) {
|
|
150
|
+
const field = this.field
|
|
151
|
+
if (field) {
|
|
152
|
+
value = {[field]: this._value(value)};
|
|
153
|
+
}
|
|
154
|
+
if (this.cacheValue[key] === JSON.stringify(field ? value[field] : value)) {
|
|
155
|
+
return;
|
|
156
|
+
}
|
|
157
|
+
this.cacheRule[key].$f && this.cacheRule[key].$f.setValue(value);
|
|
158
|
+
this.cache(key, value);
|
|
159
|
+
},
|
|
160
|
+
addRule(i, emit) {
|
|
161
|
+
const rule = this.formCreateInject.form.copyRules(this.rule || []);
|
|
162
|
+
const options = this.options ? {...this.options} : {
|
|
163
|
+
submitBtn: false,
|
|
164
|
+
resetBtn: false,
|
|
165
|
+
};
|
|
166
|
+
if (this.defaultValue) {
|
|
167
|
+
if (!options.formData) options.formData = {};
|
|
168
|
+
const defVal = deepCopy(this.defaultValue);
|
|
169
|
+
extend(options.formData, this.field ? {[this.field]: defVal} : defVal);
|
|
170
|
+
}
|
|
171
|
+
this.parse && this.parse({rule, options, index: this.sort.length});
|
|
172
|
+
this.cacheRule[++this.len] = {rule, options};
|
|
173
|
+
if (emit) {
|
|
174
|
+
nextTick(() => this.$emit('add', rule, Object.keys(this.cacheRule).length - 1));
|
|
175
|
+
}
|
|
176
|
+
},
|
|
177
|
+
add$f(i, key, $f) {
|
|
178
|
+
this.cacheRule[key].$f = $f;
|
|
179
|
+
nextTick(() => {
|
|
180
|
+
this.$emit('itemMounted', $f, Object.keys(this.cacheRule).indexOf(key));
|
|
181
|
+
});
|
|
182
|
+
},
|
|
183
|
+
removeRule(key, emit) {
|
|
184
|
+
const index = Object.keys(this.cacheRule).indexOf(key);
|
|
185
|
+
delete this.cacheRule[key];
|
|
186
|
+
delete this.cacheValue[key];
|
|
187
|
+
if (emit) {
|
|
188
|
+
nextTick(() => this.$emit('remove', index));
|
|
189
|
+
}
|
|
190
|
+
},
|
|
191
|
+
add(i) {
|
|
192
|
+
if (this.disabled || false === this.onBeforeAdd(this.modelValue)) {
|
|
193
|
+
return;
|
|
194
|
+
}
|
|
195
|
+
const value = [...this.modelValue];
|
|
196
|
+
value.push(this.defaultValue ? deepCopy(this.defaultValue) : (this.field ? null : {}));
|
|
197
|
+
this.input(value);
|
|
198
|
+
},
|
|
199
|
+
del(index, key) {
|
|
200
|
+
if (this.disabled || false === this.onBeforeRemove(this.modelValue, index)) {
|
|
201
|
+
return;
|
|
202
|
+
}
|
|
203
|
+
this.removeRule(key, true);
|
|
204
|
+
const value = [...this.modelValue];
|
|
205
|
+
value.splice(index, 1);
|
|
206
|
+
this.input(value);
|
|
207
|
+
},
|
|
208
|
+
addIcon(key) {
|
|
209
|
+
return <div class="_fc-group-btn _fc-group-plus-minus" onClick={this.add}></div>;
|
|
210
|
+
},
|
|
211
|
+
delIcon(index, key) {
|
|
212
|
+
return <div class="_fc-group-btn _fc-group-plus-minus _fc-group-minus"
|
|
213
|
+
onClick={() => this.del(index, key)}></div>
|
|
214
|
+
},
|
|
215
|
+
sortUpIcon(index) {
|
|
216
|
+
return <div class="_fc-group-btn _fc-group-arrow _fc-group-up"
|
|
217
|
+
onClick={() => this.changeSort(index, -1)}></div>
|
|
218
|
+
},
|
|
219
|
+
sortDownIcon(index) {
|
|
220
|
+
return <div class="_fc-group-btn _fc-group-arrow _fc-group-down"
|
|
221
|
+
onClick={() => this.changeSort(index, 1)}></div>
|
|
222
|
+
},
|
|
223
|
+
changeSort(index, sort) {
|
|
224
|
+
const a = this.sort[index];
|
|
225
|
+
this.sort[index] = this.sort[index + sort];
|
|
226
|
+
this.sort[index + sort] = a;
|
|
227
|
+
this.formCreateInject.subForm(this.sort.map(k=>{
|
|
228
|
+
return this.cacheRule[k].$f;
|
|
229
|
+
}));
|
|
230
|
+
this.formData(0);
|
|
231
|
+
},
|
|
232
|
+
makeIcon(total, index, key) {
|
|
233
|
+
if (this.$slots.button) {
|
|
234
|
+
return this.$slots.button({
|
|
235
|
+
total,
|
|
236
|
+
index,
|
|
237
|
+
vm: this,
|
|
238
|
+
key,
|
|
239
|
+
del: () => this.del(index, key),
|
|
240
|
+
add: this.add
|
|
241
|
+
});
|
|
242
|
+
}
|
|
243
|
+
const btn = [];
|
|
244
|
+
if ((!this.max || total < this.max) && total === index + 1) {
|
|
245
|
+
btn.push(this.addIcon(key));
|
|
246
|
+
}
|
|
247
|
+
if (total > this.min) {
|
|
248
|
+
btn.push(this.delIcon(index, key));
|
|
249
|
+
}
|
|
250
|
+
if (this.sortBtn && index) {
|
|
251
|
+
btn.push(this.sortUpIcon(index));
|
|
252
|
+
}
|
|
253
|
+
if (this.sortBtn && index !== total - 1) {
|
|
254
|
+
btn.push(this.sortDownIcon(index));
|
|
255
|
+
}
|
|
256
|
+
return btn;
|
|
257
|
+
},
|
|
258
|
+
emitEvent(name, args, index, key) {
|
|
259
|
+
this.$emit(name, ...args, this.cacheRule[key].$f, index);
|
|
260
|
+
},
|
|
261
|
+
expandRule(n) {
|
|
262
|
+
for (let i = 0; i < n; i++) {
|
|
263
|
+
this.addRule(i);
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
},
|
|
267
|
+
created() {
|
|
268
|
+
watch(() => ({...this.cacheRule}), (n) => {
|
|
269
|
+
this.sort = Object.keys(n);
|
|
270
|
+
}, {immediate: true})
|
|
271
|
+
const d = (this.expand || 0) - this.modelValue.length;
|
|
272
|
+
for (let i = 0; i < this.modelValue.length; i++) {
|
|
273
|
+
this.addRule(i);
|
|
274
|
+
}
|
|
275
|
+
if (d > 0) {
|
|
276
|
+
this.expandRule(d);
|
|
277
|
+
}
|
|
278
|
+
},
|
|
279
|
+
render() {
|
|
280
|
+
const keys = this.sort;
|
|
281
|
+
const button = this.button;
|
|
282
|
+
const Type = this.form;
|
|
283
|
+
const disabled = this.disabled;
|
|
284
|
+
|
|
285
|
+
const children = keys.length === 0 ?
|
|
286
|
+
(this.$slots.default ? (this.$slots.default({
|
|
287
|
+
vm: this,
|
|
288
|
+
add: this.add
|
|
289
|
+
})) : <div key={'a_def'} class="_fc-group-plus-minus _fc-group-add fc-clock"
|
|
290
|
+
onClick={this.add}/>) : keys.map((key, index) => {
|
|
291
|
+
const {rule, options} = this.cacheRule[key];
|
|
292
|
+
const btn = button && !disabled ? this.makeIcon(keys.length, index, key) : [];
|
|
293
|
+
return <div class="_fc-group-container" key={key}>
|
|
294
|
+
<Type
|
|
295
|
+
key={key}
|
|
296
|
+
{...{
|
|
297
|
+
disabled,
|
|
298
|
+
'onUpdate:modelValue': (formData) => this.formData(key, formData),
|
|
299
|
+
'onEmit-event': (name, ...args) => this.emitEvent(name, args, index, key),
|
|
300
|
+
'onUpdate:api': ($f) => this.add$f(index, key, $f),
|
|
301
|
+
inFor: true,
|
|
302
|
+
modelValue: this.field ? {[this.field]: this._value(this.modelValue[index])} : this.modelValue[index],
|
|
303
|
+
rule,
|
|
304
|
+
option: options,
|
|
305
|
+
extendOption: true
|
|
306
|
+
}}
|
|
307
|
+
/>
|
|
308
|
+
<div class="_fc-group-idx">{index + 1}</div>
|
|
309
|
+
{(btn.length) ? <div class="_fc-group-handle fc-clock">{btn}</div> : null}
|
|
310
|
+
</div>
|
|
311
|
+
});
|
|
312
|
+
return <div key={'con'} class={'_fc-group ' + (disabled ? '_fc-group-disabled' : '')}>{children}</div>
|
|
313
|
+
}
|
|
314
|
+
});
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
._fc-group{
|
|
2
|
+
display: flex;
|
|
3
|
+
min-height: 38px;
|
|
4
|
+
justify-content: center;
|
|
5
|
+
flex-direction: column;
|
|
6
|
+
width: 100%;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
._fc-group-disabled ._fc-group-btn, ._fc-group-disabled ._fc-group-add{
|
|
10
|
+
cursor: not-allowed;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
._fc-group-handle {
|
|
14
|
+
display: flex;
|
|
15
|
+
flex-direction: row;
|
|
16
|
+
position: absolute;
|
|
17
|
+
bottom: -15px;
|
|
18
|
+
right: 30px;
|
|
19
|
+
border-radius: 15px;
|
|
20
|
+
border: 1px dashed #d9d9d9;
|
|
21
|
+
padding: 3px 8px;
|
|
22
|
+
background-color: #ffffff;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
._fc-group-btn{
|
|
26
|
+
cursor: pointer;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
._fc-group-idx {
|
|
30
|
+
position: absolute;
|
|
31
|
+
bottom: -15px;
|
|
32
|
+
left: 10px;
|
|
33
|
+
width: 30px;
|
|
34
|
+
height: 30px;
|
|
35
|
+
display: flex;
|
|
36
|
+
align-items: center;
|
|
37
|
+
justify-content: center;
|
|
38
|
+
background: #eee;
|
|
39
|
+
border-radius: 15px;
|
|
40
|
+
font-weight: 700;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
._fc-group-handle ._fc-group-btn + ._fc-group-btn {
|
|
44
|
+
margin-left: 7px;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
._fc-group-container{
|
|
48
|
+
position: relative;
|
|
49
|
+
display: flex;
|
|
50
|
+
flex-direction: column;
|
|
51
|
+
border: 1px dashed #d9d9d9;
|
|
52
|
+
padding: 20px;
|
|
53
|
+
margin: 5px;
|
|
54
|
+
border-radius: 5px;
|
|
55
|
+
margin-bottom: 25px;
|
|
56
|
+
padding-bottom: 25px;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
._fc-group-arrow {
|
|
60
|
+
position: relative;
|
|
61
|
+
width: 20px;
|
|
62
|
+
height: 20px;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
._fc-group-arrow::before {
|
|
66
|
+
content: "";
|
|
67
|
+
position: absolute;
|
|
68
|
+
top: 8px;
|
|
69
|
+
left: 5px;
|
|
70
|
+
width: 9px;
|
|
71
|
+
height: 9px;
|
|
72
|
+
border-left: 2px solid #999;
|
|
73
|
+
border-top: 2px solid #999;
|
|
74
|
+
}
|
|
75
|
+
._fc-group-arrow::before {
|
|
76
|
+
transform: rotate(45deg);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
._fc-group-arrow._fc-group-down {
|
|
80
|
+
transform: rotate(180deg);
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
._fc-group-plus-minus {
|
|
84
|
+
width: 20px;
|
|
85
|
+
height: 20px;
|
|
86
|
+
position: relative;
|
|
87
|
+
cursor: pointer;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
._fc-group-plus-minus::before,
|
|
91
|
+
._fc-group-plus-minus::after {
|
|
92
|
+
content: "";
|
|
93
|
+
position: absolute;
|
|
94
|
+
top: 50%;
|
|
95
|
+
left: 50%;
|
|
96
|
+
width: 60%;
|
|
97
|
+
height: 2px;
|
|
98
|
+
background-color: #409eff;
|
|
99
|
+
transform: translate(-50%, -50%);
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
._fc-group-plus-minus::before {
|
|
103
|
+
transform: translate(-50%, -50%) rotate(90deg);
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
._fc-group-plus-minus._fc-group-minus::before {
|
|
107
|
+
display: none;
|
|
108
|
+
}
|
|
109
|
+
._fc-group-plus-minus._fc-group-minus::after {
|
|
110
|
+
background-color: #f56c6c;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
._fc-group-add{
|
|
115
|
+
cursor: pointer;
|
|
116
|
+
width: 25px;
|
|
117
|
+
height: 25px;
|
|
118
|
+
border: 1px solid rgb(64 158 255 / 50%);
|
|
119
|
+
border-radius: 15px;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
._fc-group-add._fc-group-plus-minus::before, ._fc-group-add._fc-group-plus-minus::after {
|
|
123
|
+
width: 50%;
|
|
124
|
+
}
|
|
125
|
+
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import checkbox from './checkbox/src/index';
|
|
2
|
+
import frame from './frame/src/index';
|
|
3
|
+
import radio from './radio/src/index';
|
|
4
|
+
import select from './select/src/index';
|
|
5
|
+
import tree from './tree/src/index';
|
|
6
|
+
import upload from './upload/src/index';
|
|
7
|
+
import group from './group/src/index';
|
|
8
|
+
import subForm from './subform/src/index';
|
|
9
|
+
import IconWarning from './icon/IconWarning.vue';
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
export default [
|
|
13
|
+
checkbox,
|
|
14
|
+
frame,
|
|
15
|
+
radio,
|
|
16
|
+
select,
|
|
17
|
+
tree,
|
|
18
|
+
upload,
|
|
19
|
+
group,
|
|
20
|
+
subForm,
|
|
21
|
+
IconWarning,
|
|
22
|
+
]
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@bdsoft-element/form-radio",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"description": "",
|
|
5
|
+
"main": "./dist/index.min.js",
|
|
6
|
+
"module": "./dist/index.esm.js",
|
|
7
|
+
"unpkg": "./dist/index.min.js",
|
|
8
|
+
"jsdelivr": "./dist/index.min.js",
|
|
9
|
+
"scripts": {
|
|
10
|
+
"clean": "rimraf dist/",
|
|
11
|
+
"bili": "cross-env bili",
|
|
12
|
+
"build": "npm-run-all clean bili"
|
|
13
|
+
},
|
|
14
|
+
"dependencies": {
|
|
15
|
+
"@bdsoft-element/utils": "workspace:^1.0.1"
|
|
16
|
+
}
|
|
17
|
+
}
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import {computed, defineComponent, ref, resolveComponent, toRef, watch} from 'vue';
|
|
2
|
+
import getSlot from '@bdsoft-element/utils/lib/slot';
|
|
3
|
+
|
|
4
|
+
const NAME = 'fcRadio';
|
|
5
|
+
|
|
6
|
+
export default defineComponent({
|
|
7
|
+
name: NAME,
|
|
8
|
+
inheritAttrs: false,
|
|
9
|
+
props: {
|
|
10
|
+
formCreateInject: Object,
|
|
11
|
+
modelValue: {
|
|
12
|
+
type: [String, Number, Boolean],
|
|
13
|
+
default: ''
|
|
14
|
+
},
|
|
15
|
+
options: Array,
|
|
16
|
+
type: String,
|
|
17
|
+
input: Boolean,
|
|
18
|
+
inputValue: String,
|
|
19
|
+
},
|
|
20
|
+
emits: ['update:modelValue', 'fc.el'],
|
|
21
|
+
setup(props, _) {
|
|
22
|
+
const options = toRef(props.formCreateInject, 'options', []);
|
|
23
|
+
const opt = toRef(props, 'options');
|
|
24
|
+
const value = toRef(props, 'modelValue');
|
|
25
|
+
const inputValue = toRef(props, 'inputValue', '');
|
|
26
|
+
const customValue = ref(inputValue.value);
|
|
27
|
+
const input = toRef(props, 'input', false);
|
|
28
|
+
watch(inputValue, (n) => {
|
|
29
|
+
if (!input.value) {
|
|
30
|
+
customValue.value = n;
|
|
31
|
+
return undefined;
|
|
32
|
+
}
|
|
33
|
+
updateCustomValue(n);
|
|
34
|
+
})
|
|
35
|
+
|
|
36
|
+
const _options = computed(() => {
|
|
37
|
+
let arr = options.value || [];
|
|
38
|
+
if (opt.value) {
|
|
39
|
+
arr = opt.value || [];
|
|
40
|
+
}
|
|
41
|
+
return Array.isArray(arr) ? arr : [];
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
watch(value, (n) => {
|
|
45
|
+
let flag = false;
|
|
46
|
+
if (!inputValue.value && n != null && input.value) {
|
|
47
|
+
flag = _options.value.map(item => {
|
|
48
|
+
return item.value;
|
|
49
|
+
}).indexOf(n) === -1;
|
|
50
|
+
}
|
|
51
|
+
if (flag) {
|
|
52
|
+
customValue.value = n;
|
|
53
|
+
}
|
|
54
|
+
}, {immediate: true});
|
|
55
|
+
|
|
56
|
+
const onInput = (n) => {
|
|
57
|
+
_.emit('update:modelValue', n);
|
|
58
|
+
}
|
|
59
|
+
const updateCustomValue = (n) => {
|
|
60
|
+
const o = customValue.value;
|
|
61
|
+
customValue.value = n;
|
|
62
|
+
if (value.value === o) {
|
|
63
|
+
onInput(n);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
return {
|
|
67
|
+
options: _options,
|
|
68
|
+
value,
|
|
69
|
+
onInput,
|
|
70
|
+
updateCustomValue,
|
|
71
|
+
customValue,
|
|
72
|
+
makeInput(Type) {
|
|
73
|
+
if (!input.value) {
|
|
74
|
+
return undefined;
|
|
75
|
+
}
|
|
76
|
+
return <Type checked={false} value={customValue.value || undefined}
|
|
77
|
+
label={customValue.value || undefined}>
|
|
78
|
+
<ElInput size="small" modelValue={customValue.value}
|
|
79
|
+
onUpdate:modelValue={updateCustomValue}></ElInput>
|
|
80
|
+
</Type>
|
|
81
|
+
},
|
|
82
|
+
}
|
|
83
|
+
},
|
|
84
|
+
render() {
|
|
85
|
+
const name = this.type === 'button' ? 'ElRadioButton' : 'ElRadio';
|
|
86
|
+
const Type = resolveComponent(name);
|
|
87
|
+
return <ElRadioGroup {...this.$attrs} modelValue={this.value} v-slots={getSlot(this.$slots, ['default'])}
|
|
88
|
+
onUpdate:modelValue={this.onInput} ref="el">{this.options.map((opt, index) => {
|
|
89
|
+
const props = {...opt};
|
|
90
|
+
const value = props.value;
|
|
91
|
+
const label = props.label;
|
|
92
|
+
delete props.value;
|
|
93
|
+
delete props.label;
|
|
94
|
+
return <Type {...props} label={value} value={value}
|
|
95
|
+
key={name + index + '-' + value}>{label || value || ''}</Type>
|
|
96
|
+
})}{this.$slots.default?.()}{this.makeInput(Type)}</ElRadioGroup>
|
|
97
|
+
},
|
|
98
|
+
mounted() {
|
|
99
|
+
this.$emit('fc.el', this.$refs.el);
|
|
100
|
+
}
|
|
101
|
+
});
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@bdsoft-element/form-select",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"description": "",
|
|
5
|
+
"main": "./dist/index.min.js",
|
|
6
|
+
"module": "./dist/index.esm.js",
|
|
7
|
+
"unpkg": "./dist/index.min.js",
|
|
8
|
+
"jsdelivr": "./dist/index.min.js",
|
|
9
|
+
"scripts": {
|
|
10
|
+
"clean": "rimraf dist/",
|
|
11
|
+
"bili": "cross-env bili",
|
|
12
|
+
"build": "npm-run-all clean bili"
|
|
13
|
+
},
|
|
14
|
+
"dependencies": {
|
|
15
|
+
"@bdsoft-element/utils": "workspace:^1.0.1"
|
|
16
|
+
}
|
|
17
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import {defineComponent, toRef} from 'vue';
|
|
2
|
+
import getSlot from '@bdsoft-element/utils/lib/slot';
|
|
3
|
+
import is, {hasProperty} from '@bdsoft-element/utils/lib/type';
|
|
4
|
+
|
|
5
|
+
const NAME = 'fcSelect';
|
|
6
|
+
|
|
7
|
+
export default defineComponent({
|
|
8
|
+
name: NAME,
|
|
9
|
+
inheritAttrs: false,
|
|
10
|
+
props: {
|
|
11
|
+
formCreateInject: Object,
|
|
12
|
+
modelValue: {
|
|
13
|
+
type: [Array, String, Number, Boolean, Object],
|
|
14
|
+
default: undefined
|
|
15
|
+
},
|
|
16
|
+
type: String,
|
|
17
|
+
},
|
|
18
|
+
emits: ['update:modelValue', 'fc.el'],
|
|
19
|
+
setup(props) {
|
|
20
|
+
const options = toRef(props.formCreateInject, 'options', []);
|
|
21
|
+
const value = toRef(props, 'modelValue');
|
|
22
|
+
const _options = () => {
|
|
23
|
+
return Array.isArray(options.value) ? options.value : []
|
|
24
|
+
}
|
|
25
|
+
return {
|
|
26
|
+
options: _options,
|
|
27
|
+
value
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
render() {
|
|
31
|
+
const makeOption = (props, index) => {
|
|
32
|
+
return <ElOption {...props} key={'' + index + '-' + props.value}/>;
|
|
33
|
+
}
|
|
34
|
+
const makeOptionGroup = (props, index) => {
|
|
35
|
+
return <ElOptionGroup label={props.label}
|
|
36
|
+
key={'' + index + '-' + props.label}>
|
|
37
|
+
{is.trueArray(props.options) && props.options.map((v, index) => {
|
|
38
|
+
return makeOption(v, index);
|
|
39
|
+
})}
|
|
40
|
+
</ElOptionGroup>;
|
|
41
|
+
}
|
|
42
|
+
const options = this.options();
|
|
43
|
+
return <ElSelect {...this.$attrs} modelValue={this.value}
|
|
44
|
+
onUpdate:modelValue={(v) => this.$emit('update:modelValue', v)}
|
|
45
|
+
v-slots={getSlot(this.$slots, ['default'])} ref="el">{options.map((props, index) => {
|
|
46
|
+
return hasProperty(props || '', 'options') ? makeOptionGroup(props, index) : makeOption(props, index);
|
|
47
|
+
})}{this.$slots.default?.()}</ElSelect>;
|
|
48
|
+
},
|
|
49
|
+
mounted() {
|
|
50
|
+
this.$emit('fc.el', this.$refs.el);
|
|
51
|
+
}
|
|
52
|
+
});
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@bdsoft-element/form-subform",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"description": "",
|
|
5
|
+
"main": "./dist/index.min.js",
|
|
6
|
+
"module": "./dist/index.esm.js",
|
|
7
|
+
"unpkg": "./dist/index.min.js",
|
|
8
|
+
"jsdelivr": "./dist/index.min.js",
|
|
9
|
+
"scripts": {
|
|
10
|
+
"clean": "rimraf dist/",
|
|
11
|
+
"bili": "cross-env bili",
|
|
12
|
+
"build": "npm-run-all clean bili"
|
|
13
|
+
}
|
|
14
|
+
}
|