@vunk/form 1.1.76 → 1.1.79
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/components/_plugin-vue_export-helper.mjs +9 -0
- package/components/button/{index.js → index.mjs} +33 -29
- package/components/button/src/ctx.d.ts +30 -30
- package/components/button/src/index.vue.d.ts +69 -69
- package/components/cascader/index.css +0 -2
- package/components/cascader/{index.js → index.mjs} +22 -22
- package/components/cascader/src/ctx.d.ts +37 -45
- package/components/cascader/src/index.vue.d.ts +92 -92
- package/components/cascader/src/use.d.ts +1 -1
- package/components/checkbox/index.css +0 -9
- package/components/checkbox/{index.js → index.mjs} +45 -42
- package/components/checkbox/src/ctx.d.ts +29 -32
- package/components/checkbox/src/index.vue.d.ts +65 -65
- package/components/color-picker/{index.js → index.mjs} +24 -23
- package/components/color-picker/src/ctx.d.ts +29 -29
- package/components/color-picker/src/index.vue.d.ts +77 -64
- package/components/date-picker/{index.js → index.mjs} +28 -25
- package/components/date-picker/src/ctx.d.ts +49 -49
- package/components/date-picker/src/index.vue.d.ts +104 -104
- package/components/download-plus/index.css +0 -6
- package/components/download-plus/{index.js → index.mjs} +119 -147
- package/components/download-plus/src/api.d.ts +1 -1
- package/components/download-plus/src/ctx.d.ts +27 -26
- package/components/download-plus/src/index.vue.d.ts +59 -59
- package/components/esri-input-geojson/index.css +0 -10
- package/components/esri-input-geojson/index.mjs +1109 -0
- package/components/esri-input-geojson/src/append.vue.d.ts +1 -1
- package/components/esri-input-geojson/src/ctx.d.ts +49 -72
- package/components/esri-input-geojson/src/index.vue.d.ts +138 -158
- package/components/esri-input-geojson/src/types.d.ts +0 -1
- package/components/esri-input-geojson/src/viewer.vue.d.ts +18 -19
- package/components/form/{index.js → index.mjs} +31 -27
- package/components/form/src/ctx.d.ts +13 -297
- package/components/form/src/index.vue.d.ts +97 -659
- package/components/form-item/index.css +0 -8
- package/components/form-item/{index.js → index.mjs} +22 -19
- package/components/form-item/src/ctx.d.ts +13 -11
- package/components/form-item/src/index.vue.d.ts +20 -20
- package/components/form-item-renderer/{index.js → index.mjs} +9 -7
- package/components/form-item-renderer/src/index.vue.d.ts +1 -1
- package/components/form-item-renderer-template/{index.js → index.mjs} +7 -7
- package/components/geoinput/{index.js → index.mjs} +10 -17
- package/components/geoinput/src/ctx.d.ts +48 -60
- package/components/geoinput/src/index.vue.d.ts +114 -132
- package/components/geoinput-read/index.css +0 -2
- package/components/geoinput-read/{index.js → index.mjs} +101 -109
- package/components/geoinput-read/src/core.vue.d.ts +123 -142
- package/components/geoinput-read/src/ctx.d.ts +50 -74
- package/components/geoinput-read/src/index.vue.d.ts +102 -120
- package/components/geoinput-update/index.css +0 -6
- package/components/geoinput-update/index.mjs +399 -0
- package/components/geoinput-update/src/ctx.d.ts +49 -69
- package/components/geoinput-update/src/index.vue.d.ts +126 -141
- package/components/index.mjs +11 -0
- package/components/index2.mjs +306 -0
- package/components/index3.mjs +484 -0
- package/components/input/{index.js → index.mjs} +31 -27
- package/components/input/src/ctx.d.ts +47 -66
- package/components/input/src/index.vue.d.ts +101 -113
- package/components/input-link/index.css +0 -2
- package/components/input-link/index.mjs +151 -0
- package/components/input-link/src/ctx.d.ts +40 -56
- package/components/input-link/src/index.vue.d.ts +89 -101
- package/components/input-number/index.css +0 -2
- package/components/input-number/{index.js → index.mjs} +25 -25
- package/components/input-number/src/ctx.d.ts +31 -37
- package/components/input-number/src/index.vue.d.ts +71 -71
- package/components/radio/index.css +0 -6
- package/components/radio/{index.js → index.mjs} +50 -47
- package/components/radio/src/ctx.d.ts +29 -29
- package/components/radio/src/index.vue.d.ts +64 -64
- package/components/select/index.css +0 -2
- package/components/select/{index.js → index.mjs} +49 -48
- package/components/select/src/ctx.d.ts +31 -85
- package/components/select/src/index.vue.d.ts +121 -230
- package/components/slider/{index.js → index.mjs} +28 -24
- package/components/slider/src/ctx.d.ts +35 -35
- package/components/slider/src/index.vue.d.ts +93 -93
- package/components/switch/index.css +0 -2
- package/components/switch/{index.js → index.mjs} +29 -24
- package/components/switch/src/ctx.d.ts +40 -40
- package/components/switch/src/index.vue.d.ts +91 -91
- package/components/templates-default/index.mjs +302 -0
- package/components/templates-default/src/ctx.d.ts +2 -4
- package/components/templates-default/src/index.vue.d.ts +2 -8
- package/components/templates-element-plus/index.mjs +106 -0
- package/components/templates-esri/index.mjs +59 -0
- package/components/templates-layout/index.css +0 -3
- package/components/templates-layout/index.mjs +131 -0
- package/components/templates-mapbox/index.mjs +59 -0
- package/components/upload/index.css +0 -7
- package/components/upload/index.mjs +501 -0
- package/components/upload/src/ctx.d.ts +36 -38
- package/components/upload/src/file.vue.d.ts +22 -21
- package/components/upload/src/index.vue.d.ts +78 -78
- package/components/upload-plus/index.css +4 -8
- package/components/upload-plus/{index.js → index.mjs} +9497 -926
- package/components/upload-plus/src/api.d.ts +1 -1
- package/components/upload-plus/src/ctx.d.ts +25 -28
- package/components/upload-plus/src/index.vue.d.ts +58 -58
- package/components/van-cascader/index.css +0 -2
- package/components/van-cascader/{index.js → index.mjs} +41 -44
- package/components/van-cascader/src/ctx.d.ts +35 -35
- package/components/van-cascader/src/index.vue.d.ts +82 -82
- package/components/var-datetime-picker/index.css +0 -2
- package/components/var-datetime-picker/index.mjs +324 -0
- package/components/var-datetime-picker/src/ctx.d.ts +27 -26
- package/components/var-datetime-picker/src/index.vue.d.ts +57 -57
- package/components/vditor/{index.js → index.mjs} +9 -14
- package/components/vditor/src/ctx.d.ts +2 -1
- package/components/vditor/src/index.vue.d.ts +2 -3
- package/composables/index.mjs +85 -0
- package/composables/useSourceManager.d.ts +2 -2
- package/defaults.d.ts +1 -1
- package/index.css +4 -169
- package/index.d.ts +1 -1
- package/index.esm.js +44 -1
- package/package.json +246 -2
- package/shared/const/index.d.ts +1 -1
- package/shared/const/index.mjs +56 -0
- package/shared/element-plus/ctx.d.ts +26 -94
- package/shared/element-plus/index.mjs +285 -0
- package/shared/element-plus/instances.d.ts +29 -28
- package/shared/form/index.mjs +30 -0
- package/shared/helper/index.mjs +9 -0
- package/shared/index.mjs +1 -0
- package/shared/infer-prop/index.mjs +34 -0
- package/shared/progress-it/index.mjs +38 -0
- package/shared/rules/index.mjs +53 -0
- package/shared/upload/index.mjs +771 -0
- package/components/button/src/ctx.js +0 -1
- package/components/cascader/src/ctx.js +0 -1
- package/components/cascader/src/types.js +0 -1
- package/components/cascader/src/use.js +0 -1
- package/components/checkbox/src/ctx.js +0 -1
- package/components/checkbox/src/index.css +0 -1
- package/components/checkbox/src/types.js +0 -1
- package/components/color-picker/index.css +0 -1
- package/components/color-picker/src/ctx.js +0 -1
- package/components/color-picker/src/index.css +0 -1
- package/components/color-picker/src/types.js +0 -1
- package/components/date-picker/index.css +0 -1
- package/components/date-picker/src/ctx.js +0 -1
- package/components/date-picker/src/index.css +0 -1
- package/components/date-picker/src/types.js +0 -1
- package/components/download-plus/src/api.js +0 -1
- package/components/download-plus/src/const.js +0 -1
- package/components/download-plus/src/ctx.js +0 -1
- package/components/download-plus/src/index.css +0 -1
- package/components/download-plus/src/types.js +0 -1
- package/components/esri-input-geojson/index.js +0 -1563
- package/components/esri-input-geojson/src/const.js +0 -1
- package/components/esri-input-geojson/src/ctx.js +0 -1
- package/components/esri-input-geojson/src/index.css +0 -1
- package/components/esri-input-geojson/src/types.js +0 -1
- package/components/form/index.css +0 -1
- package/components/form/src/ctx.js +0 -1
- package/components/form/src/index.css +0 -1
- package/components/form/src/types.js +0 -1
- package/components/form/src/utils.js +0 -1
- package/components/form-item/src/ctx.js +0 -1
- package/components/form-item/src/index.css +0 -1
- package/components/form-item/src/types.js +0 -1
- package/components/form-item-renderer/index.css +0 -1
- package/components/form-item-renderer/src/ctx.js +0 -1
- package/components/form-item-renderer/src/index.css +0 -1
- package/components/form-item-renderer/src/symbols.js +0 -1
- package/components/form-item-renderer/src/types.js +0 -1
- package/components/form-item-renderer-template/index.css +0 -1
- package/components/form-item-renderer-template/src/ctx.js +0 -1
- package/components/form-item-renderer-template/src/index.css +0 -1
- package/components/form-item-renderer-template/src/types.js +0 -1
- package/components/geoinput/index.css +0 -1
- package/components/geoinput/src/ctx.js +0 -1
- package/components/geoinput/src/index.css +0 -1
- package/components/geoinput/src/types.js +0 -1
- package/components/geoinput-read/src/ctx.js +0 -1
- package/components/geoinput-read/src/index.css +0 -1
- package/components/geoinput-read/src/types.js +0 -1
- package/components/geoinput-update/index.js +0 -930
- package/components/geoinput-update/src/ctx.js +0 -1
- package/components/geoinput-update/src/index.css +0 -1
- package/components/geoinput-update/src/types.js +0 -1
- package/components/input/index.css +0 -1
- package/components/input/src/ctx.js +0 -1
- package/components/input/src/index.css +0 -1
- package/components/input/src/types.js +0 -1
- package/components/input-link/index.js +0 -163
- package/components/input-link/src/ctx.js +0 -1
- package/components/input-link/src/index.css +0 -1
- package/components/input-link/src/types.js +0 -1
- package/components/input-number/src/ctx.js +0 -1
- package/components/input-number/src/index.css +0 -1
- package/components/input-number/src/types.js +0 -1
- package/components/radio/src/ctx.js +0 -1
- package/components/radio/src/index.css +0 -1
- package/components/radio/src/types.js +0 -1
- package/components/select/src/ctx.js +0 -1
- package/components/select/src/index.css +0 -1
- package/components/select/src/types.js +0 -1
- package/components/slider/index.css +0 -1
- package/components/slider/src/ctx.js +0 -1
- package/components/slider/src/index.css +0 -1
- package/components/slider/src/types.js +0 -1
- package/components/switch/src/ctx.js +0 -1
- package/components/switch/src/index.css +0 -1
- package/components/switch/src/types.js +0 -1
- package/components/templates-default/index.css +0 -1
- package/components/templates-default/index.js +0 -347
- package/components/templates-default/src/ctx.js +0 -1
- package/components/templates-default/src/index.css +0 -1
- package/components/templates-default/src/types.js +0 -1
- package/components/templates-element-plus/index.css +0 -1
- package/components/templates-element-plus/index.js +0 -110
- package/components/templates-element-plus/src/ctx.js +0 -1
- package/components/templates-element-plus/src/index.css +0 -1
- package/components/templates-element-plus/src/types.js +0 -1
- package/components/templates-esri/index.css +0 -1
- package/components/templates-esri/index.js +0 -65
- package/components/templates-esri/src/ctx.js +0 -1
- package/components/templates-esri/src/index.css +0 -1
- package/components/templates-esri/src/types.js +0 -1
- package/components/templates-layout/index.js +0 -141
- package/components/templates-layout/src/ctx.js +0 -1
- package/components/templates-layout/src/index.css +0 -1
- package/components/templates-layout/src/types.js +0 -1
- package/components/templates-mapbox/index.css +0 -1
- package/components/templates-mapbox/index.js +0 -65
- package/components/templates-mapbox/src/ctx.js +0 -1
- package/components/templates-mapbox/src/index.css +0 -1
- package/components/templates-mapbox/src/types.js +0 -1
- package/components/upload/index.js +0 -565
- package/components/upload/src/ctx.js +0 -1
- package/components/upload/src/index.css +0 -1
- package/components/upload/src/types.js +0 -1
- package/components/upload-plus/src/api.js +0 -28
- package/components/upload-plus/src/const.js +0 -1
- package/components/upload-plus/src/ctx.js +0 -1
- package/components/upload-plus/src/index.css +0 -1
- package/components/upload-plus/src/types.js +0 -1
- package/components/van-cascader/src/ctx.js +0 -1
- package/components/van-cascader/src/index.css +0 -1
- package/components/van-cascader/src/types.js +0 -1
- package/components/var-datetime-picker/index.js +0 -299
- package/components/var-datetime-picker/src/const.js +0 -1
- package/components/var-datetime-picker/src/ctx.js +0 -1
- package/components/var-datetime-picker/src/index.css +0 -1
- package/components/var-datetime-picker/src/types.js +0 -1
- package/components/vditor/index.css +0 -1
- package/components/vditor/src/ctx.js +0 -1
- package/components/vditor/src/index.css +0 -1
- package/components/vditor/src/types.js +0 -1
- package/composables/index.css +0 -1
- package/composables/index.js +0 -1
- package/shared/const/index.css +0 -1
- package/shared/const/index.js +0 -1
- package/shared/element-plus/index.css +0 -1
- package/shared/element-plus/index.js +0 -1
- package/shared/form/index.css +0 -1
- package/shared/form/index.js +0 -1
- package/shared/helper/index.css +0 -1
- package/shared/helper/index.js +0 -1
- package/shared/index.css +0 -1
- package/shared/index.js +0 -1
- package/shared/infer-prop/index.css +0 -1
- package/shared/infer-prop/index.js +0 -1
- package/shared/progress-it/index.css +0 -1
- package/shared/progress-it/index.js +0 -1
- package/shared/rules/index.css +0 -1
- package/shared/rules/index.js +0 -1
- package/shared/types/form/index.css +0 -1
- package/shared/types/form/index.js +0 -1
- package/shared/types/index.css +0 -1
- package/shared/types/index.js +0 -1
- package/shared/types/source/index.css +0 -1
- package/shared/types/source/index.js +0 -1
- package/shared/types/source-manager/index.css +0 -1
- package/shared/types/source-manager/index.js +0 -1
- package/shared/upload/index.css +0 -1
- package/shared/upload/index.js +0 -1
- /package/{components/button/index.css → shared/types/form/index.mjs} +0 -0
- /package/{components/button/src/index.css → shared/types/index.mjs} +0 -0
- /package/{components/cascader/src/index.css → shared/types/source/index.mjs} +0 -0
- /package/{components/button/src/types.js → shared/types/source-manager/index.mjs} +0 -0
|
@@ -0,0 +1,285 @@
|
|
|
1
|
+
import { timePickerDefaultProps, useTooltipContentProps, tagProps, inputProps, inputEmits, formProps, formEmits, formItemProps, switchProps, switchEmits, inputNumberProps, inputNumberEmits, radioGroupProps, radioGroupEmits, checkboxGroupProps, checkboxGroupEmits, uploadProps, colorPickerProps, colorPickerEmits, buttonProps, buttonEmits, cascaderProps, cascaderEmits, sliderProps, sliderEmits, version } from 'element-plus';
|
|
2
|
+
import { bindPropsFactory, onEmitsFactory } from '@vunk/core/shared/utils-vue';
|
|
3
|
+
import { defineComponent, openBlock, createElementBlock, createElementVNode } from 'vue';
|
|
4
|
+
|
|
5
|
+
/*! Element Plus Icons Vue v2.3.1 */
|
|
6
|
+
|
|
7
|
+
var arrow_down_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
|
|
8
|
+
name: "ArrowDown",
|
|
9
|
+
__name: "arrow-down",
|
|
10
|
+
setup(__props) {
|
|
11
|
+
return (_ctx, _cache) => (openBlock(), createElementBlock("svg", {
|
|
12
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
13
|
+
viewBox: "0 0 1024 1024"
|
|
14
|
+
}, [
|
|
15
|
+
createElementVNode("path", {
|
|
16
|
+
fill: "currentColor",
|
|
17
|
+
d: "M831.872 340.864 512 652.672 192.128 340.864a30.592 30.592 0 0 0-42.752 0 29.12 29.12 0 0 0 0 41.6L489.664 714.24a32 32 0 0 0 44.672 0l340.288-331.712a29.12 29.12 0 0 0 0-41.728 30.592 30.592 0 0 0-42.752 0z"
|
|
18
|
+
})
|
|
19
|
+
]));
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
// src/components/arrow-down.vue
|
|
24
|
+
var arrow_down_default = arrow_down_vue_vue_type_script_setup_true_lang_default;
|
|
25
|
+
var circle_close_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
|
|
26
|
+
name: "CircleClose",
|
|
27
|
+
__name: "circle-close",
|
|
28
|
+
setup(__props) {
|
|
29
|
+
return (_ctx, _cache) => (openBlock(), createElementBlock("svg", {
|
|
30
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
31
|
+
viewBox: "0 0 1024 1024"
|
|
32
|
+
}, [
|
|
33
|
+
createElementVNode("path", {
|
|
34
|
+
fill: "currentColor",
|
|
35
|
+
d: "m466.752 512-90.496-90.496a32 32 0 0 1 45.248-45.248L512 466.752l90.496-90.496a32 32 0 1 1 45.248 45.248L557.248 512l90.496 90.496a32 32 0 1 1-45.248 45.248L512 557.248l-90.496 90.496a32 32 0 0 1-45.248-45.248z"
|
|
36
|
+
}),
|
|
37
|
+
createElementVNode("path", {
|
|
38
|
+
fill: "currentColor",
|
|
39
|
+
d: "M512 896a384 384 0 1 0 0-768 384 384 0 0 0 0 768m0 64a448 448 0 1 1 0-896 448 448 0 0 1 0 896"
|
|
40
|
+
})
|
|
41
|
+
]));
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
// src/components/circle-close.vue
|
|
46
|
+
var circle_close_default = circle_close_vue_vue_type_script_setup_true_lang_default;
|
|
47
|
+
|
|
48
|
+
const datePickerProps = {
|
|
49
|
+
...timePickerDefaultProps,
|
|
50
|
+
type: {
|
|
51
|
+
type: String,
|
|
52
|
+
default: "date"
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
const datePickerEmits = {
|
|
56
|
+
"update:modelValue": null,
|
|
57
|
+
"change": null,
|
|
58
|
+
"focus": null,
|
|
59
|
+
"blur": null,
|
|
60
|
+
"calendar-change": null,
|
|
61
|
+
"panel-change": null,
|
|
62
|
+
"visible-change": null,
|
|
63
|
+
"keydown": null
|
|
64
|
+
};
|
|
65
|
+
const selectProps = {
|
|
66
|
+
name: String,
|
|
67
|
+
id: String,
|
|
68
|
+
modelValue: {
|
|
69
|
+
type: [Array, String, Number, Boolean, Object],
|
|
70
|
+
default: void 0
|
|
71
|
+
},
|
|
72
|
+
autocomplete: {
|
|
73
|
+
type: String,
|
|
74
|
+
default: "off"
|
|
75
|
+
},
|
|
76
|
+
automaticDropdown: Boolean,
|
|
77
|
+
size: {
|
|
78
|
+
type: String
|
|
79
|
+
},
|
|
80
|
+
effect: {
|
|
81
|
+
type: String,
|
|
82
|
+
default: "light"
|
|
83
|
+
},
|
|
84
|
+
disabled: Boolean,
|
|
85
|
+
clearable: Boolean,
|
|
86
|
+
filterable: Boolean,
|
|
87
|
+
allowCreate: Boolean,
|
|
88
|
+
loading: Boolean,
|
|
89
|
+
popperClass: {
|
|
90
|
+
type: String,
|
|
91
|
+
default: ""
|
|
92
|
+
},
|
|
93
|
+
remote: Boolean,
|
|
94
|
+
loadingText: String,
|
|
95
|
+
noMatchText: String,
|
|
96
|
+
noDataText: String,
|
|
97
|
+
remoteMethod: Function,
|
|
98
|
+
filterMethod: Function,
|
|
99
|
+
multiple: Boolean,
|
|
100
|
+
multipleLimit: {
|
|
101
|
+
type: Number,
|
|
102
|
+
default: 0
|
|
103
|
+
},
|
|
104
|
+
placeholder: {
|
|
105
|
+
type: String
|
|
106
|
+
},
|
|
107
|
+
defaultFirstOption: Boolean,
|
|
108
|
+
reserveKeyword: {
|
|
109
|
+
type: Boolean,
|
|
110
|
+
default: true
|
|
111
|
+
},
|
|
112
|
+
valueKey: {
|
|
113
|
+
type: String,
|
|
114
|
+
default: "value"
|
|
115
|
+
},
|
|
116
|
+
collapseTags: Boolean,
|
|
117
|
+
collapseTagsTooltip: {
|
|
118
|
+
type: Boolean,
|
|
119
|
+
default: false
|
|
120
|
+
},
|
|
121
|
+
teleported: useTooltipContentProps.teleported,
|
|
122
|
+
persistent: {
|
|
123
|
+
type: Boolean,
|
|
124
|
+
default: true
|
|
125
|
+
},
|
|
126
|
+
clearIcon: {
|
|
127
|
+
type: [String, Object],
|
|
128
|
+
default: circle_close_default
|
|
129
|
+
},
|
|
130
|
+
fitInputWidth: {
|
|
131
|
+
type: Boolean,
|
|
132
|
+
default: false
|
|
133
|
+
},
|
|
134
|
+
suffixIcon: {
|
|
135
|
+
type: [String, Object],
|
|
136
|
+
default: arrow_down_default
|
|
137
|
+
},
|
|
138
|
+
// eslint-disable-next-line vue/require-prop-types
|
|
139
|
+
tagType: { ...tagProps.type, default: "info" }
|
|
140
|
+
};
|
|
141
|
+
const selectEmits = {
|
|
142
|
+
"update:modelValue": null,
|
|
143
|
+
"change": null,
|
|
144
|
+
"remove-tag": null,
|
|
145
|
+
"clear": null,
|
|
146
|
+
"visible-change": null,
|
|
147
|
+
"focus": null,
|
|
148
|
+
"blur": null
|
|
149
|
+
};
|
|
150
|
+
|
|
151
|
+
const createInputBindProps = bindPropsFactory(inputProps);
|
|
152
|
+
const createInputOnEmits = onEmitsFactory(inputEmits);
|
|
153
|
+
const createFormBindProps = bindPropsFactory(formProps);
|
|
154
|
+
const createFormOnEmits = onEmitsFactory(formEmits);
|
|
155
|
+
const createFormItemBindProps = bindPropsFactory(formItemProps);
|
|
156
|
+
const createSwitchBindProps = bindPropsFactory(switchProps);
|
|
157
|
+
const createSwitchOnEmits = onEmitsFactory(switchEmits);
|
|
158
|
+
const createSelectBindProps = bindPropsFactory(selectProps);
|
|
159
|
+
const createSelectOnEmits = onEmitsFactory(selectEmits);
|
|
160
|
+
const createDatePickerBindProps = bindPropsFactory(datePickerProps);
|
|
161
|
+
const createDatePickerOnEmits = onEmitsFactory(datePickerEmits);
|
|
162
|
+
const createInputNumberBindProps = bindPropsFactory(inputNumberProps);
|
|
163
|
+
const createInputNumberOnEmits = onEmitsFactory(inputNumberEmits);
|
|
164
|
+
const createRadioGroupBindProps = bindPropsFactory(radioGroupProps);
|
|
165
|
+
const createRadioGroupOnEmits = onEmitsFactory(radioGroupEmits);
|
|
166
|
+
const createCheckboxGroupBindProps = bindPropsFactory(checkboxGroupProps);
|
|
167
|
+
const createCheckboxGroupOnEmits = onEmitsFactory(checkboxGroupEmits);
|
|
168
|
+
const createUploadBindProps = bindPropsFactory(uploadProps);
|
|
169
|
+
const createColorPickerBindProps = bindPropsFactory(colorPickerProps);
|
|
170
|
+
const createColorPickerOnEmits = onEmitsFactory(colorPickerEmits);
|
|
171
|
+
const createButtonBindProps = bindPropsFactory(buttonProps);
|
|
172
|
+
const createButtonOnEmits = onEmitsFactory(buttonEmits);
|
|
173
|
+
const createCascaderBindProps = bindPropsFactory(cascaderProps);
|
|
174
|
+
const createCascaderOnEmits = onEmitsFactory(cascaderEmits);
|
|
175
|
+
const createSliderBindProps = bindPropsFactory(sliderProps);
|
|
176
|
+
const createSliderOnEmits = onEmitsFactory(sliderEmits);
|
|
177
|
+
|
|
178
|
+
const semver = /^[v^~<>=]*?(\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+))?(?:-([\da-z\-]+(?:\.[\da-z\-]+)*))?(?:\+[\da-z\-]+(?:\.[\da-z\-]+)*)?)?)?$/i;
|
|
179
|
+
const validateAndParse = (version) => {
|
|
180
|
+
if (typeof version !== 'string') {
|
|
181
|
+
throw new TypeError('Invalid argument expected string');
|
|
182
|
+
}
|
|
183
|
+
const match = version.match(semver);
|
|
184
|
+
if (!match) {
|
|
185
|
+
throw new Error(`Invalid argument not valid semver ('${version}' received)`);
|
|
186
|
+
}
|
|
187
|
+
match.shift();
|
|
188
|
+
return match;
|
|
189
|
+
};
|
|
190
|
+
const isWildcard = (s) => s === '*' || s === 'x' || s === 'X';
|
|
191
|
+
const tryParse = (v) => {
|
|
192
|
+
const n = parseInt(v, 10);
|
|
193
|
+
return isNaN(n) ? v : n;
|
|
194
|
+
};
|
|
195
|
+
const forceType = (a, b) => typeof a !== typeof b ? [String(a), String(b)] : [a, b];
|
|
196
|
+
const compareStrings = (a, b) => {
|
|
197
|
+
if (isWildcard(a) || isWildcard(b))
|
|
198
|
+
return 0;
|
|
199
|
+
const [ap, bp] = forceType(tryParse(a), tryParse(b));
|
|
200
|
+
if (ap > bp)
|
|
201
|
+
return 1;
|
|
202
|
+
if (ap < bp)
|
|
203
|
+
return -1;
|
|
204
|
+
return 0;
|
|
205
|
+
};
|
|
206
|
+
const compareSegments = (a, b) => {
|
|
207
|
+
for (let i = 0; i < Math.max(a.length, b.length); i++) {
|
|
208
|
+
const r = compareStrings(a[i] || '0', b[i] || '0');
|
|
209
|
+
if (r !== 0)
|
|
210
|
+
return r;
|
|
211
|
+
}
|
|
212
|
+
return 0;
|
|
213
|
+
};
|
|
214
|
+
|
|
215
|
+
/**
|
|
216
|
+
* Compare [semver](https://semver.org/) version strings to find greater, equal or lesser.
|
|
217
|
+
* This library supports the full semver specification, including comparing versions with different number of digits like `1.0.0`, `1.0`, `1`, and pre-release versions like `1.0.0-alpha`.
|
|
218
|
+
* @param v1 - First version to compare
|
|
219
|
+
* @param v2 - Second version to compare
|
|
220
|
+
* @returns Numeric value compatible with the [Array.sort(fn) interface](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort#Parameters).
|
|
221
|
+
*/
|
|
222
|
+
const compareVersions = (v1, v2) => {
|
|
223
|
+
// validate input and split into segments
|
|
224
|
+
const n1 = validateAndParse(v1);
|
|
225
|
+
const n2 = validateAndParse(v2);
|
|
226
|
+
// pop off the patch
|
|
227
|
+
const p1 = n1.pop();
|
|
228
|
+
const p2 = n2.pop();
|
|
229
|
+
// validate numbers
|
|
230
|
+
const r = compareSegments(n1, n2);
|
|
231
|
+
if (r !== 0)
|
|
232
|
+
return r;
|
|
233
|
+
// validate pre-release
|
|
234
|
+
if (p1 && p2) {
|
|
235
|
+
return compareSegments(p1.split('.'), p2.split('.'));
|
|
236
|
+
}
|
|
237
|
+
else if (p1 || p2) {
|
|
238
|
+
return p1 ? -1 : 1;
|
|
239
|
+
}
|
|
240
|
+
return 0;
|
|
241
|
+
};
|
|
242
|
+
|
|
243
|
+
/**
|
|
244
|
+
* Compare [semver](https://semver.org/) version strings using the specified operator.
|
|
245
|
+
*
|
|
246
|
+
* @param v1 First version to compare
|
|
247
|
+
* @param v2 Second version to compare
|
|
248
|
+
* @param operator Allowed arithmetic operator to use
|
|
249
|
+
* @returns `true` if the comparison between the firstVersion and the secondVersion satisfies the operator, `false` otherwise.
|
|
250
|
+
*
|
|
251
|
+
* @example
|
|
252
|
+
* ```
|
|
253
|
+
* compare('10.1.8', '10.0.4', '>'); // return true
|
|
254
|
+
* compare('10.0.1', '10.0.1', '='); // return true
|
|
255
|
+
* compare('10.1.1', '10.2.2', '<'); // return true
|
|
256
|
+
* compare('10.1.1', '10.2.2', '<='); // return true
|
|
257
|
+
* compare('10.1.1', '10.2.2', '>='); // return false
|
|
258
|
+
* ```
|
|
259
|
+
*/
|
|
260
|
+
const compare = (v1, v2, operator) => {
|
|
261
|
+
// validate input operator
|
|
262
|
+
assertValidOperator(operator);
|
|
263
|
+
// since result of compareVersions can only be -1 or 0 or 1
|
|
264
|
+
// a simple map can be used to replace switch
|
|
265
|
+
const res = compareVersions(v1, v2);
|
|
266
|
+
return operatorResMap[operator].includes(res);
|
|
267
|
+
};
|
|
268
|
+
const operatorResMap = {
|
|
269
|
+
'>': [1],
|
|
270
|
+
'>=': [0, 1],
|
|
271
|
+
'=': [0],
|
|
272
|
+
'<=': [-1, 0],
|
|
273
|
+
'<': [-1],
|
|
274
|
+
'!=': [-1, 1],
|
|
275
|
+
};
|
|
276
|
+
const allowedOperators = Object.keys(operatorResMap);
|
|
277
|
+
const assertValidOperator = (op) => {
|
|
278
|
+
if (allowedOperators.indexOf(op) === -1) {
|
|
279
|
+
throw new Error(`Invalid operator, expected one of ${allowedOperators.join('|')}`);
|
|
280
|
+
}
|
|
281
|
+
};
|
|
282
|
+
|
|
283
|
+
const isGte2_6_0 = compare(version, "2.6.0", ">=");
|
|
284
|
+
|
|
285
|
+
export { createButtonBindProps, createButtonOnEmits, createCascaderBindProps, createCascaderOnEmits, createCheckboxGroupBindProps, createCheckboxGroupOnEmits, createColorPickerBindProps, createColorPickerOnEmits, createDatePickerBindProps, createDatePickerOnEmits, createFormBindProps, createFormItemBindProps, createFormOnEmits, createInputBindProps, createInputNumberBindProps, createInputNumberOnEmits, createInputOnEmits, createRadioGroupBindProps, createRadioGroupOnEmits, createSelectBindProps, createSelectOnEmits, createSliderBindProps, createSliderOnEmits, createSwitchBindProps, createSwitchOnEmits, createUploadBindProps, datePickerEmits, datePickerProps, isGte2_6_0, selectEmits, selectProps };
|
|
@@ -1,55 +1,56 @@
|
|
|
1
|
+
import { ComponentSize, DatePickType } from 'element-plus';
|
|
1
2
|
import { PropType, Component } from 'vue';
|
|
2
3
|
export declare const datePickerProps: {
|
|
3
4
|
type: {
|
|
4
|
-
type: PropType<
|
|
5
|
+
type: PropType<DatePickType>;
|
|
5
6
|
default: string;
|
|
6
7
|
};
|
|
7
8
|
ariaLabel: StringConstructor;
|
|
8
9
|
emptyValues: ArrayConstructor;
|
|
9
10
|
valueOnClear: import("element-plus/es/utils").EpPropFinalized<readonly [StringConstructor, NumberConstructor, BooleanConstructor, FunctionConstructor], unknown, unknown, undefined, boolean>;
|
|
10
11
|
disabledDate: {
|
|
11
|
-
readonly type: PropType<Function>;
|
|
12
|
+
readonly type: import("vue").PropType<Function>;
|
|
12
13
|
readonly required: false;
|
|
13
|
-
readonly validator: (val: unknown) => boolean;
|
|
14
|
+
readonly validator: ((val: unknown) => boolean) | undefined;
|
|
14
15
|
__epPropKey: true;
|
|
15
16
|
};
|
|
16
17
|
cellClassName: {
|
|
17
|
-
readonly type: PropType<Function>;
|
|
18
|
+
readonly type: import("vue").PropType<Function>;
|
|
18
19
|
readonly required: false;
|
|
19
|
-
readonly validator: (val: unknown) => boolean;
|
|
20
|
+
readonly validator: ((val: unknown) => boolean) | undefined;
|
|
20
21
|
__epPropKey: true;
|
|
21
22
|
};
|
|
22
23
|
shortcuts: import("element-plus/es/utils").EpPropFinalized<ArrayConstructor, unknown, unknown, () => never[], boolean>;
|
|
23
24
|
arrowControl: BooleanConstructor;
|
|
24
25
|
label: import("element-plus/es/utils").EpPropFinalized<StringConstructor, unknown, unknown, undefined, boolean>;
|
|
25
|
-
tabindex: import("element-plus/es/utils").EpPropFinalized<(new (...args: any[]) => string | number) | (() => string | number) | ((new (...args: any[]) => string | number) | (() => string | number))[], unknown, unknown, 0, boolean>;
|
|
26
|
+
tabindex: import("element-plus/es/utils").EpPropFinalized<(new (...args: any[]) => (string | number) & {}) | (() => string | number) | ((new (...args: any[]) => (string | number) & {}) | (() => string | number))[], unknown, unknown, 0, boolean>;
|
|
26
27
|
validateEvent: import("element-plus/es/utils").EpPropFinalized<BooleanConstructor, unknown, unknown, true, boolean>;
|
|
27
28
|
unlinkPanels: BooleanConstructor;
|
|
28
29
|
disabledHours: {
|
|
29
|
-
readonly type: PropType<import("element-plus/es/components/time-picker/src/props/shared").GetDisabledHours>;
|
|
30
|
+
readonly type: import("vue").PropType<import("element-plus/es/components/time-picker/src/props/shared").GetDisabledHours>;
|
|
30
31
|
readonly required: false;
|
|
31
|
-
readonly validator: (val: unknown) => boolean;
|
|
32
|
+
readonly validator: ((val: unknown) => boolean) | undefined;
|
|
32
33
|
__epPropKey: true;
|
|
33
34
|
};
|
|
34
35
|
disabledMinutes: {
|
|
35
|
-
readonly type: PropType<import("element-plus/es/components/time-picker/src/props/shared").GetDisabledMinutes>;
|
|
36
|
+
readonly type: import("vue").PropType<import("element-plus/es/components/time-picker/src/props/shared").GetDisabledMinutes>;
|
|
36
37
|
readonly required: false;
|
|
37
|
-
readonly validator: (val: unknown) => boolean;
|
|
38
|
+
readonly validator: ((val: unknown) => boolean) | undefined;
|
|
38
39
|
__epPropKey: true;
|
|
39
40
|
};
|
|
40
41
|
disabledSeconds: {
|
|
41
|
-
readonly type: PropType<import("element-plus/es/components/time-picker/src/props/shared").GetDisabledSeconds>;
|
|
42
|
+
readonly type: import("vue").PropType<import("element-plus/es/components/time-picker/src/props/shared").GetDisabledSeconds>;
|
|
42
43
|
readonly required: false;
|
|
43
|
-
readonly validator: (val: unknown) => boolean;
|
|
44
|
+
readonly validator: ((val: unknown) => boolean) | undefined;
|
|
44
45
|
__epPropKey: true;
|
|
45
46
|
};
|
|
46
47
|
id: {
|
|
47
|
-
readonly type: PropType<import("element-plus/es/utils").EpPropMergeType<(new (...args: any[]) => string
|
|
48
|
+
readonly type: import("vue").PropType<import("element-plus/es/utils").EpPropMergeType<(new (...args: any[]) => import("element-plus").SingleOrRange<string> & {}) | (() => import("element-plus").SingleOrRange<string>) | ((new (...args: any[]) => import("element-plus").SingleOrRange<string> & {}) | (() => import("element-plus").SingleOrRange<string>))[], unknown, unknown>>;
|
|
48
49
|
readonly required: false;
|
|
49
|
-
readonly validator: (val: unknown) => boolean;
|
|
50
|
+
readonly validator: ((val: unknown) => boolean) | undefined;
|
|
50
51
|
__epPropKey: true;
|
|
51
52
|
};
|
|
52
|
-
name: import("element-plus/es/utils").EpPropFinalized<(new (...args: any[]) => string
|
|
53
|
+
name: import("element-plus/es/utils").EpPropFinalized<(new (...args: any[]) => import("element-plus").SingleOrRange<string> & {}) | (() => import("element-plus").SingleOrRange<string>) | ((new (...args: any[]) => import("element-plus").SingleOrRange<string> & {}) | (() => import("element-plus").SingleOrRange<string>))[], unknown, unknown, "", boolean>;
|
|
53
54
|
popperClass: import("element-plus/es/utils").EpPropFinalized<StringConstructor, unknown, unknown, "", boolean>;
|
|
54
55
|
format: StringConstructor;
|
|
55
56
|
valueFormat: StringConstructor;
|
|
@@ -57,37 +58,37 @@ export declare const datePickerProps: {
|
|
|
57
58
|
timeFormat: StringConstructor;
|
|
58
59
|
clearable: import("element-plus/es/utils").EpPropFinalized<BooleanConstructor, unknown, unknown, true, boolean>;
|
|
59
60
|
clearIcon: {
|
|
60
|
-
readonly type: PropType<unknown
|
|
61
|
+
readonly type: import("vue").PropType<import("element-plus/es/utils").EpPropMergeType<(new (...args: any[]) => (string | Component<any, any, any, import("vue").ComputedOptions, import("vue").MethodOptions>) & {}) | (() => string | Component<any, any, any, import("vue").ComputedOptions, import("vue").MethodOptions>) | ((new (...args: any[]) => (string | Component<any, any, any, import("vue").ComputedOptions, import("vue").MethodOptions>) & {}) | (() => string | Component<any, any, any, import("vue").ComputedOptions, import("vue").MethodOptions>))[], unknown, unknown>>;
|
|
61
62
|
readonly required: false;
|
|
62
|
-
readonly validator: (val: unknown) => boolean;
|
|
63
|
+
readonly validator: ((val: unknown) => boolean) | undefined;
|
|
63
64
|
__epPropKey: true;
|
|
64
65
|
};
|
|
65
66
|
editable: import("element-plus/es/utils").EpPropFinalized<BooleanConstructor, unknown, unknown, true, boolean>;
|
|
66
67
|
prefixIcon: import("element-plus/es/utils").EpPropFinalized<(new (...args: any[]) => (string | Component<any, any, any, import("vue").ComputedOptions, import("vue").MethodOptions>) & {}) | (() => string | Component<any, any, any, import("vue").ComputedOptions, import("vue").MethodOptions>) | ((new (...args: any[]) => (string | Component<any, any, any, import("vue").ComputedOptions, import("vue").MethodOptions>) & {}) | (() => string | Component<any, any, any, import("vue").ComputedOptions, import("vue").MethodOptions>))[], unknown, unknown, "", boolean>;
|
|
67
68
|
size: {
|
|
68
|
-
readonly type: PropType<import("element-plus/es/utils").EpPropMergeType<StringConstructor, "" | "default" | "small" | "large", never>>;
|
|
69
|
+
readonly type: import("vue").PropType<import("element-plus/es/utils").EpPropMergeType<StringConstructor, "" | "default" | "small" | "large", never>>;
|
|
69
70
|
readonly required: false;
|
|
70
|
-
readonly validator: (val: unknown) => boolean;
|
|
71
|
+
readonly validator: ((val: unknown) => boolean) | undefined;
|
|
71
72
|
__epPropKey: true;
|
|
72
73
|
};
|
|
73
74
|
readonly: BooleanConstructor;
|
|
74
75
|
disabled: BooleanConstructor;
|
|
75
76
|
placeholder: import("element-plus/es/utils").EpPropFinalized<StringConstructor, unknown, unknown, "", boolean>;
|
|
76
77
|
popperOptions: import("element-plus/es/utils").EpPropFinalized<(new (...args: any[]) => Partial<import("element-plus").Options>) | (() => Partial<import("element-plus").Options>) | ((new (...args: any[]) => Partial<import("element-plus").Options>) | (() => Partial<import("element-plus").Options>))[], unknown, unknown, () => {}, boolean>;
|
|
77
|
-
modelValue: import("element-plus/es/utils").EpPropFinalized<(new (...args: any[]) =>
|
|
78
|
+
modelValue: import("element-plus/es/utils").EpPropFinalized<(new (...args: any[]) => import("element-plus").ModelValueType & {}) | (() => import("element-plus").ModelValueType) | ((new (...args: any[]) => import("element-plus").ModelValueType & {}) | (() => import("element-plus").ModelValueType))[], unknown, unknown, "", boolean>;
|
|
78
79
|
rangeSeparator: import("element-plus/es/utils").EpPropFinalized<StringConstructor, unknown, unknown, "-", boolean>;
|
|
79
80
|
startPlaceholder: StringConstructor;
|
|
80
81
|
endPlaceholder: StringConstructor;
|
|
81
82
|
defaultValue: {
|
|
82
|
-
readonly type: PropType<import("element-plus/es/utils").EpPropMergeType<(new (...args: any[]) => Date | [Date, Date]) | (() => import("element-plus").SingleOrRange<Date>) | ((new (...args: any[]) => Date | [Date, Date]) | (() => import("element-plus").SingleOrRange<Date>))[], unknown, unknown>>;
|
|
83
|
+
readonly type: import("vue").PropType<import("element-plus/es/utils").EpPropMergeType<(new (...args: any[]) => Date | [Date, Date]) | (() => import("element-plus").SingleOrRange<Date>) | ((new (...args: any[]) => Date | [Date, Date]) | (() => import("element-plus").SingleOrRange<Date>))[], unknown, unknown>>;
|
|
83
84
|
readonly required: false;
|
|
84
|
-
readonly validator: (val: unknown) => boolean;
|
|
85
|
+
readonly validator: ((val: unknown) => boolean) | undefined;
|
|
85
86
|
__epPropKey: true;
|
|
86
87
|
};
|
|
87
88
|
defaultTime: {
|
|
88
|
-
readonly type: PropType<import("element-plus/es/utils").EpPropMergeType<(new (...args: any[]) => Date | [Date, Date]) | (() => import("element-plus").SingleOrRange<Date>) | ((new (...args: any[]) => Date | [Date, Date]) | (() => import("element-plus").SingleOrRange<Date>))[], unknown, unknown>>;
|
|
89
|
+
readonly type: import("vue").PropType<import("element-plus/es/utils").EpPropMergeType<(new (...args: any[]) => Date | [Date, Date]) | (() => import("element-plus").SingleOrRange<Date>) | ((new (...args: any[]) => Date | [Date, Date]) | (() => import("element-plus").SingleOrRange<Date>))[], unknown, unknown>>;
|
|
89
90
|
readonly required: false;
|
|
90
|
-
readonly validator: (val: unknown) => boolean;
|
|
91
|
+
readonly validator: ((val: unknown) => boolean) | undefined;
|
|
91
92
|
__epPropKey: true;
|
|
92
93
|
};
|
|
93
94
|
isRange: BooleanConstructor;
|
|
@@ -106,7 +107,7 @@ export declare const selectProps: {
|
|
|
106
107
|
name: StringConstructor;
|
|
107
108
|
id: StringConstructor;
|
|
108
109
|
modelValue: {
|
|
109
|
-
type: (
|
|
110
|
+
type: (ObjectConstructor | BooleanConstructor | StringConstructor | NumberConstructor | ArrayConstructor)[];
|
|
110
111
|
default: any;
|
|
111
112
|
};
|
|
112
113
|
autocomplete: {
|
|
@@ -115,10 +116,10 @@ export declare const selectProps: {
|
|
|
115
116
|
};
|
|
116
117
|
automaticDropdown: BooleanConstructor;
|
|
117
118
|
size: {
|
|
118
|
-
type: PropType<
|
|
119
|
+
type: PropType<ComponentSize>;
|
|
119
120
|
};
|
|
120
121
|
effect: {
|
|
121
|
-
type: PropType<string>;
|
|
122
|
+
type: PropType<"light" | "dark" | string>;
|
|
122
123
|
default: string;
|
|
123
124
|
};
|
|
124
125
|
disabled: BooleanConstructor;
|
|
@@ -179,7 +180,7 @@ export declare const selectProps: {
|
|
|
179
180
|
default: string;
|
|
180
181
|
type: PropType<import("element-plus/es/utils").EpPropMergeType<StringConstructor, "success" | "warning" | "info" | "primary" | "danger", unknown>>;
|
|
181
182
|
required: false;
|
|
182
|
-
validator: (val: unknown) => boolean;
|
|
183
|
+
validator: ((val: unknown) => boolean) | undefined;
|
|
183
184
|
__epPropKey: true;
|
|
184
185
|
};
|
|
185
186
|
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { ElMessage } from 'element-plus';
|
|
2
|
+
|
|
3
|
+
const validateCatch = (err, init = {}) => {
|
|
4
|
+
let msg = "";
|
|
5
|
+
msg += init.prefix || "";
|
|
6
|
+
for (const key in err) {
|
|
7
|
+
err[key].forEach((v) => {
|
|
8
|
+
msg += v.message + ";";
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
msg += init.suffix || "";
|
|
12
|
+
ElMessage({
|
|
13
|
+
type: "warning",
|
|
14
|
+
message: msg
|
|
15
|
+
});
|
|
16
|
+
};
|
|
17
|
+
const genTemplateIfFunc = (templateIfRaw) => {
|
|
18
|
+
if (typeof templateIfRaw === "boolean") {
|
|
19
|
+
const flag = templateIfRaw;
|
|
20
|
+
return () => flag;
|
|
21
|
+
} else if (typeof templateIfRaw === "string") {
|
|
22
|
+
const templateIf = new Function("data", templateIfRaw);
|
|
23
|
+
return templateIf;
|
|
24
|
+
} else if (typeof templateIfRaw === "function") {
|
|
25
|
+
return templateIfRaw;
|
|
26
|
+
}
|
|
27
|
+
return () => true;
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
export { genTemplateIfFunc, validateCatch };
|
package/shared/index.mjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { CORE_FORM_TEMPLATE_OPTIONS, CORE_FORM_TEMPLATE_REFLECT } from './const/index.mjs';
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
const inferString = (item) => ({
|
|
2
|
+
prop: item.prop,
|
|
3
|
+
type: "String"
|
|
4
|
+
});
|
|
5
|
+
const inferBoolean = (item) => ({
|
|
6
|
+
prop: item.prop,
|
|
7
|
+
type: "Boolean"
|
|
8
|
+
});
|
|
9
|
+
const inferNumber = (item) => {
|
|
10
|
+
const info = {
|
|
11
|
+
prop: item.prop,
|
|
12
|
+
type: "Number"
|
|
13
|
+
};
|
|
14
|
+
if (item.precision) {
|
|
15
|
+
info.precision = item.precision;
|
|
16
|
+
}
|
|
17
|
+
return info;
|
|
18
|
+
};
|
|
19
|
+
const inferDate = (item) => ({
|
|
20
|
+
prop: item.prop,
|
|
21
|
+
type: "Date"
|
|
22
|
+
});
|
|
23
|
+
const propInfoAction = {
|
|
24
|
+
VkfSelect: inferString,
|
|
25
|
+
VkfRadio: inferString,
|
|
26
|
+
VkfCheckbox: inferString,
|
|
27
|
+
VkfColorPicker: inferString,
|
|
28
|
+
VkfInputNumber: inferNumber,
|
|
29
|
+
VkfSwitch: inferBoolean,
|
|
30
|
+
VkfUpload: inferString,
|
|
31
|
+
VkfDatePicker: inferDate
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
export { propInfoAction };
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
const ifElse = (fn1, fn2, fn3) => (x) => fn1(x) ? fn2(x) : fn3(x);
|
|
2
|
+
const progress = (effect, option) => (state) => {
|
|
3
|
+
const $data = {
|
|
4
|
+
interval: 100,
|
|
5
|
+
speed: 0.01,
|
|
6
|
+
...option,
|
|
7
|
+
percent: 0,
|
|
8
|
+
timeLine: 0,
|
|
9
|
+
timer: void 0
|
|
10
|
+
};
|
|
11
|
+
const $stateInitFlow = ($data2) => ifElse(
|
|
12
|
+
(state2) => Boolean(state2),
|
|
13
|
+
(state2) => effect(1, state2),
|
|
14
|
+
(state2) => setInterval(() => {
|
|
15
|
+
$data2.timeLine++;
|
|
16
|
+
$data2.percent = state2 ? 1 : (-1 / ($data2.speed * $data2.timeLine + 1) + 1) * 1;
|
|
17
|
+
effect($data2.percent, state2);
|
|
18
|
+
}, $data2.interval)
|
|
19
|
+
);
|
|
20
|
+
$data.timer = $stateInitFlow($data)(state);
|
|
21
|
+
const setter = (newState) => {
|
|
22
|
+
if (typeof newState !== "boolean") {
|
|
23
|
+
$data.timer && clearInterval($data.timer);
|
|
24
|
+
$data.percent = 1;
|
|
25
|
+
effect($data.percent, "fail");
|
|
26
|
+
return setter;
|
|
27
|
+
}
|
|
28
|
+
if (newState) {
|
|
29
|
+
$data.timer && clearInterval($data.timer);
|
|
30
|
+
$data.percent = 1;
|
|
31
|
+
effect($data.percent, newState);
|
|
32
|
+
}
|
|
33
|
+
return setter;
|
|
34
|
+
};
|
|
35
|
+
return setter;
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
export { progress as default };
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
const PATTERN = {
|
|
2
|
+
/**
|
|
3
|
+
* 由数字、26个英文字母或者下划线以及中文组成的字符串
|
|
4
|
+
*/
|
|
5
|
+
normal: /^[\u4e00-\u9fa5_a-zA-Z0-9]+$/,
|
|
6
|
+
/**
|
|
7
|
+
* 只能由 中文 和 英文 组成
|
|
8
|
+
*/
|
|
9
|
+
normalName: /^[\u4e00-\u9fa5_a-zA-Z]+$/,
|
|
10
|
+
/**
|
|
11
|
+
* 只能由数字、字母、下划线组成, 且不能以下划线和数字开头
|
|
12
|
+
*/
|
|
13
|
+
code: /^[a-zA-Z][a-zA-Z0-9_]*$/,
|
|
14
|
+
/**
|
|
15
|
+
* 只能由数字或字母组成, 且不能以数字开头
|
|
16
|
+
*/
|
|
17
|
+
strictCode: /^[a-zA-Z][a-zA-Z0-9]*$/,
|
|
18
|
+
/**
|
|
19
|
+
* 只能由字母、数字或特殊字符组成,且长度在8到16之间
|
|
20
|
+
*/
|
|
21
|
+
password: /^[a-zA-Z0-9~!@#$%^&*()_+|<>?:{}\.]{8,16}$/,
|
|
22
|
+
/**
|
|
23
|
+
* 要求密码必须同时包含至少一个小写字母、大写字母和数字,且长度在8到16之间。
|
|
24
|
+
*/
|
|
25
|
+
strictPassword: /^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)[^]{8,16}$/,
|
|
26
|
+
/**
|
|
27
|
+
* 正确的手机号码
|
|
28
|
+
*/
|
|
29
|
+
phone: /^1[3456789]\d{9}$/
|
|
30
|
+
};
|
|
31
|
+
const PATTERN_OPTIONS = [
|
|
32
|
+
{ label: "\u5E38\u89C4", value: PATTERN.normal, title: "\u7531\u6570\u5B57\u300126\u4E2A\u82F1\u6587\u5B57\u6BCD\u6216\u8005\u4E0B\u5212\u7EBF\u4EE5\u53CA\u4E2D\u6587\u7EC4\u6210\u7684\u5B57\u7B26\u4E32" },
|
|
33
|
+
{
|
|
34
|
+
label: "\u5E38\u89C4\u59D3\u540D",
|
|
35
|
+
value: PATTERN.normalName,
|
|
36
|
+
title: "\u53EA\u80FD\u7531 \u4E2D\u6587 \u548C \u82F1\u6587 \u7EC4\u6210"
|
|
37
|
+
},
|
|
38
|
+
{ label: "\u5BC6\u7801", value: PATTERN.password, title: "\u53EA\u80FD\u7531\u5B57\u6BCD\u3001\u6570\u5B57\u6216\u7279\u6B8A\u5B57\u7B26\u7EC4\u6210\uFF0C\u4E14\u957F\u5EA6\u57288\u523016\u4E4B\u95F4" },
|
|
39
|
+
{ label: "\u4E25\u683C\u5BC6\u7801", value: PATTERN.strictPassword, title: "\u8981\u6C42\u5BC6\u7801\u5FC5\u987B\u540C\u65F6\u5305\u542B\u81F3\u5C11\u4E00\u4E2A\u5C0F\u5199\u5B57\u6BCD\u3001\u5927\u5199\u5B57\u6BCD\u548C\u6570\u5B57\uFF0C\u4E14\u957F\u5EA6\u57288\u523016\u4E4B\u95F4\u3002" },
|
|
40
|
+
{ label: "\u624B\u673A\u53F7", value: PATTERN.phone, title: "\u6B63\u786E\u7684\u624B\u673A\u53F7\u7801" },
|
|
41
|
+
{
|
|
42
|
+
label: "\u7F16\u7801",
|
|
43
|
+
value: PATTERN.code,
|
|
44
|
+
title: "\u53EA\u80FD\u7531\u6570\u5B57\u3001\u5B57\u6BCD\u3001\u4E0B\u5212\u7EBF\u7EC4\u6210, \u4E14\u4E0D\u80FD\u4EE5\u4E0B\u5212\u7EBF\u548C\u6570\u5B57\u5F00\u5934"
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
label: "\u4E25\u683C\u7F16\u7801",
|
|
48
|
+
value: PATTERN.strictCode,
|
|
49
|
+
title: "\u53EA\u80FD\u7531\u6570\u5B57\u6216\u5B57\u6BCD\u7EC4\u6210, \u4E14\u4E0D\u80FD\u4EE5\u6570\u5B57\u5F00\u5934"
|
|
50
|
+
}
|
|
51
|
+
];
|
|
52
|
+
|
|
53
|
+
export { PATTERN, PATTERN_OPTIONS };
|