@fecp/mobile 1.0.18 → 1.0.20
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/es/mobile.css +5 -5
- package/es/node_modules/.pnpm/vant@4.9.17_vue@3.5.13_typescript@5.7.3_/node_modules/vant/es/picker/Picker.mjs +2 -2
- package/es/node_modules/.pnpm/vant@4.9.17_vue@3.5.13_typescript@5.7.3_/node_modules/vant/es/picker-group/PickerGroup.mjs +3 -4
- package/es/packages/mobile/index.mjs +6 -12
- package/es/packages/mobile/src/components/all.mjs +6 -12
- package/es/packages/mobile/src/components/form/field/Field.vue.mjs +21 -28
- package/es/packages/mobile/src/components/form/field/index.mjs +2 -2
- package/es/packages/mobile/src/components/form/fieldCalendarPicker/FieldCalendarPicker.vue.mjs +26 -36
- package/es/packages/mobile/src/components/form/fieldCascaderPicker/fieldCascaderPicker.vue.mjs +36 -46
- package/es/packages/mobile/src/components/form/fieldCheckbox/FieldCheckbox.vue.mjs +47 -0
- package/es/packages/mobile/src/components/form/fieldCheckbox/index.mjs +10 -0
- package/es/packages/mobile/src/components/form/fieldDatePicker/FieldDatePicker.vue.mjs +34 -44
- package/es/packages/mobile/src/components/form/fieldPicker/FieldPicker.vue.mjs +34 -44
- package/es/packages/mobile/src/components/form/fieldRadio/FieldRadio.vue.mjs +19 -0
- package/es/packages/mobile/src/components/form/fieldRadio/index.mjs +10 -0
- package/es/packages/mobile/src/components/form/fieldTimePicker/FieldTimePicker.vue.mjs +33 -43
- package/es/packages/mobile/src/components/form/form/Form.vue.mjs +18 -2
- package/es/packages/mobile/src/components/form/formItem/FormItem.vue.mjs +70 -0
- package/es/packages/mobile/src/components/form/formItem/index.mjs +7 -0
- package/es/packages/mobile/src/utils/formRule.mjs +49 -11
- package/lib/mobile.css +5 -5
- package/lib/node_modules/.pnpm/vant@4.9.17_vue@3.5.13_typescript@5.7.3_/node_modules/vant/es/picker-group/PickerGroup.js +2 -3
- package/lib/packages/mobile/index.js +62 -68
- package/lib/packages/mobile/src/components/all.js +62 -68
- package/lib/packages/mobile/src/components/form/field/Field.vue.js +20 -27
- package/lib/packages/mobile/src/components/form/fieldCalendarPicker/FieldCalendarPicker.vue.js +25 -35
- package/lib/packages/mobile/src/components/form/fieldCascaderPicker/fieldCascaderPicker.vue.js +35 -45
- package/lib/packages/mobile/src/components/form/fieldCheckbox/FieldCheckbox.vue.js +47 -0
- package/lib/packages/mobile/src/components/form/fieldCheckbox/index.js +10 -0
- package/lib/packages/mobile/src/components/form/fieldDatePicker/FieldDatePicker.vue.js +33 -43
- package/lib/packages/mobile/src/components/form/fieldPicker/FieldPicker.vue.js +33 -43
- package/lib/packages/mobile/src/components/form/fieldRadio/FieldRadio.vue.js +19 -0
- package/lib/packages/mobile/src/components/form/fieldRadio/index.js +10 -0
- package/lib/packages/mobile/src/components/form/fieldTimePicker/FieldTimePicker.vue.js +32 -42
- package/lib/packages/mobile/src/components/form/form/Form.vue.js +17 -1
- package/lib/packages/mobile/src/components/form/formItem/FormItem.vue.js +70 -0
- package/lib/packages/mobile/src/components/form/formItem/index.js +7 -0
- package/lib/packages/mobile/src/utils/formRule.js +49 -11
- package/package.json +1 -1
|
@@ -11,13 +11,11 @@
|
|
|
11
11
|
/* empty css */
|
|
12
12
|
/* empty css */
|
|
13
13
|
/* empty css */
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
import { ref, computed, watch, createElementBlock, openBlock, Fragment, createVNode, mergeProps, unref, isRef, createSlots, renderList, withCtx, renderSlot } from "vue";
|
|
14
|
+
import { ref, computed, watch, createBlock, openBlock, unref, mergeProps, isRef, withCtx, createVNode } from "vue";
|
|
15
|
+
import { MobileField } from "../field/index.mjs";
|
|
17
16
|
import hooks from "../../../../../../node_modules/.pnpm/moment@2.30.1/node_modules/moment/dist/moment.mjs";
|
|
18
|
-
import { Field } from "../../../../../../node_modules/.pnpm/vant@4.9.17_vue@3.5.13_typescript@5.7.3_/node_modules/vant/es/field/index.mjs";
|
|
19
|
-
import { Popup } from "../../../../../../node_modules/.pnpm/vant@4.9.17_vue@3.5.13_typescript@5.7.3_/node_modules/vant/es/popup/index.mjs";
|
|
20
17
|
import { DatePicker } from "../../../../../../node_modules/.pnpm/vant@4.9.17_vue@3.5.13_typescript@5.7.3_/node_modules/vant/es/date-picker/index.mjs";
|
|
18
|
+
import { Popup } from "../../../../../../node_modules/.pnpm/vant@4.9.17_vue@3.5.13_typescript@5.7.3_/node_modules/vant/es/popup/index.mjs";
|
|
21
19
|
const _sfc_main = {
|
|
22
20
|
__name: "FieldDatePicker",
|
|
23
21
|
props: {
|
|
@@ -32,7 +30,9 @@ const _sfc_main = {
|
|
|
32
30
|
valueFormat: {
|
|
33
31
|
type: String,
|
|
34
32
|
default: "YYYYMMDD"
|
|
35
|
-
}
|
|
33
|
+
},
|
|
34
|
+
readonly: false,
|
|
35
|
+
"is-link": false
|
|
36
36
|
},
|
|
37
37
|
emits: ["update:modelValue"],
|
|
38
38
|
setup(__props, { emit: __emit }) {
|
|
@@ -70,46 +70,36 @@ const _sfc_main = {
|
|
|
70
70
|
showPicker.value = false;
|
|
71
71
|
};
|
|
72
72
|
return (_ctx, _cache) => {
|
|
73
|
-
const _component_van_field = Field;
|
|
74
73
|
const _component_van_date_picker = DatePicker;
|
|
75
74
|
const _component_van_popup = Popup;
|
|
76
|
-
return openBlock(),
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
"onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => isRef(pickerValue) ? pickerValue.value = $event : null),
|
|
105
|
-
readonly: false,
|
|
106
|
-
onConfirm,
|
|
107
|
-
onCancel: _cache[3] || (_cache[3] = ($event) => showPicker.value = false)
|
|
108
|
-
}), null, 16, ["modelValue"])
|
|
109
|
-
]),
|
|
110
|
-
_: 1
|
|
111
|
-
}, 8, ["show"])
|
|
112
|
-
], 64);
|
|
75
|
+
return openBlock(), createBlock(unref(MobileField), mergeProps(_ctx.$attrs, {
|
|
76
|
+
modelValue: unref(fieldTextValue),
|
|
77
|
+
"onUpdate:modelValue": _cache[3] || (_cache[3] = ($event) => isRef(fieldTextValue) ? fieldTextValue.value = $event : null),
|
|
78
|
+
"is-link": "",
|
|
79
|
+
readonly: "",
|
|
80
|
+
onClick: _cache[4] || (_cache[4] = ($event) => showPicker.value = true)
|
|
81
|
+
}), {
|
|
82
|
+
default: withCtx(() => [
|
|
83
|
+
createVNode(_component_van_popup, {
|
|
84
|
+
show: unref(showPicker),
|
|
85
|
+
"onUpdate:show": _cache[2] || (_cache[2] = ($event) => isRef(showPicker) ? showPicker.value = $event : null),
|
|
86
|
+
"destroy-on-close": "",
|
|
87
|
+
position: "bottom"
|
|
88
|
+
}, {
|
|
89
|
+
default: withCtx(() => [
|
|
90
|
+
createVNode(_component_van_date_picker, mergeProps(_ctx.$attrs, {
|
|
91
|
+
modelValue: unref(pickerValue),
|
|
92
|
+
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => isRef(pickerValue) ? pickerValue.value = $event : null),
|
|
93
|
+
readonly: false,
|
|
94
|
+
onConfirm,
|
|
95
|
+
onCancel: _cache[1] || (_cache[1] = ($event) => showPicker.value = false)
|
|
96
|
+
}), null, 16, ["modelValue"])
|
|
97
|
+
]),
|
|
98
|
+
_: 1
|
|
99
|
+
}, 8, ["show"])
|
|
100
|
+
]),
|
|
101
|
+
_: 1
|
|
102
|
+
}, 16, ["modelValue"]);
|
|
113
103
|
};
|
|
114
104
|
}
|
|
115
105
|
};
|
|
@@ -11,11 +11,9 @@
|
|
|
11
11
|
/* empty css */
|
|
12
12
|
/* empty css */
|
|
13
13
|
/* empty css */
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
import { ref, computed, watch, createElementBlock, openBlock, Fragment, createVNode, mergeProps, unref, isRef, createSlots, renderList, withCtx, renderSlot } from "vue";
|
|
14
|
+
import { ref, computed, watch, createBlock, openBlock, unref, mergeProps, isRef, withCtx, createVNode } from "vue";
|
|
15
|
+
import { MobileField } from "../field/index.mjs";
|
|
17
16
|
import { Picker } from "../../../../../../node_modules/.pnpm/vant@4.9.17_vue@3.5.13_typescript@5.7.3_/node_modules/vant/es/picker/index.mjs";
|
|
18
|
-
import { Field } from "../../../../../../node_modules/.pnpm/vant@4.9.17_vue@3.5.13_typescript@5.7.3_/node_modules/vant/es/field/index.mjs";
|
|
19
17
|
import { Popup } from "../../../../../../node_modules/.pnpm/vant@4.9.17_vue@3.5.13_typescript@5.7.3_/node_modules/vant/es/popup/index.mjs";
|
|
20
18
|
const _sfc_main = {
|
|
21
19
|
__name: "FieldPicker",
|
|
@@ -34,7 +32,9 @@ const _sfc_main = {
|
|
|
34
32
|
modelValue: {
|
|
35
33
|
type: String,
|
|
36
34
|
default: ""
|
|
37
|
-
}
|
|
35
|
+
},
|
|
36
|
+
readonly: false,
|
|
37
|
+
"is-link": false
|
|
38
38
|
},
|
|
39
39
|
emits: ["update:modelValue"],
|
|
40
40
|
setup(__props, { emit: __emit }) {
|
|
@@ -69,47 +69,37 @@ const _sfc_main = {
|
|
|
69
69
|
showPicker.value = false;
|
|
70
70
|
};
|
|
71
71
|
return (_ctx, _cache) => {
|
|
72
|
-
const _component_van_field = Field;
|
|
73
72
|
const _component_van_picker = Picker;
|
|
74
73
|
const _component_van_popup = Popup;
|
|
75
|
-
return openBlock(),
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
"model-value": unref(pickerValue),
|
|
105
|
-
readonly: false,
|
|
106
|
-
onConfirm,
|
|
107
|
-
onCancel: _cache[2] || (_cache[2] = ($event) => showPicker.value = false)
|
|
108
|
-
}), null, 16, ["columns", "columns-field-names", "model-value"])
|
|
109
|
-
]),
|
|
110
|
-
_: 1
|
|
111
|
-
}, 8, ["show"])
|
|
112
|
-
], 64);
|
|
74
|
+
return openBlock(), createBlock(unref(MobileField), mergeProps(_ctx.$attrs, {
|
|
75
|
+
modelValue: unref(fieldTextValue),
|
|
76
|
+
"onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => isRef(fieldTextValue) ? fieldTextValue.value = $event : null),
|
|
77
|
+
"is-link": "",
|
|
78
|
+
readonly: "",
|
|
79
|
+
onClick: _cache[3] || (_cache[3] = ($event) => showPicker.value = true)
|
|
80
|
+
}), {
|
|
81
|
+
default: withCtx(() => [
|
|
82
|
+
createVNode(_component_van_popup, {
|
|
83
|
+
show: unref(showPicker),
|
|
84
|
+
"onUpdate:show": _cache[1] || (_cache[1] = ($event) => isRef(showPicker) ? showPicker.value = $event : null),
|
|
85
|
+
"destroy-on-close": "",
|
|
86
|
+
position: "bottom"
|
|
87
|
+
}, {
|
|
88
|
+
default: withCtx(() => [
|
|
89
|
+
createVNode(_component_van_picker, mergeProps(_ctx.$attrs, {
|
|
90
|
+
columns: __props.columns,
|
|
91
|
+
"columns-field-names": __props.columnsFieldNames,
|
|
92
|
+
"model-value": unref(pickerValue),
|
|
93
|
+
readonly: false,
|
|
94
|
+
onConfirm,
|
|
95
|
+
onCancel: _cache[0] || (_cache[0] = ($event) => showPicker.value = false)
|
|
96
|
+
}), null, 16, ["columns", "columns-field-names", "model-value"])
|
|
97
|
+
]),
|
|
98
|
+
_: 1
|
|
99
|
+
}, 8, ["show"])
|
|
100
|
+
]),
|
|
101
|
+
_: 1
|
|
102
|
+
}, 16, ["modelValue"]);
|
|
113
103
|
};
|
|
114
104
|
}
|
|
115
105
|
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { createBlock, openBlock, unref, normalizeProps, guardReactiveProps, withCtx, createVNode } from "vue";
|
|
2
|
+
import { MobileField } from "../field/index.mjs";
|
|
3
|
+
import { MobileRadioGroup } from "../radioGroup/index.mjs";
|
|
4
|
+
const _sfc_main = {
|
|
5
|
+
__name: "FieldRadio",
|
|
6
|
+
setup(__props) {
|
|
7
|
+
return (_ctx, _cache) => {
|
|
8
|
+
return openBlock(), createBlock(unref(MobileField), normalizeProps(guardReactiveProps(_ctx.$attrs)), {
|
|
9
|
+
input: withCtx(() => [
|
|
10
|
+
createVNode(unref(MobileRadioGroup), normalizeProps(guardReactiveProps(_ctx.$attrs)), null, 16)
|
|
11
|
+
]),
|
|
12
|
+
_: 1
|
|
13
|
+
}, 16);
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
export {
|
|
18
|
+
_sfc_main as default
|
|
19
|
+
};
|
|
@@ -11,12 +11,10 @@
|
|
|
11
11
|
/* empty css */
|
|
12
12
|
/* empty css */
|
|
13
13
|
/* empty css */
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
import { ref, computed, watch, createElementBlock, openBlock, Fragment, createVNode, mergeProps, unref, isRef, createSlots, renderList, withCtx, renderSlot } from "vue";
|
|
14
|
+
import { ref, computed, watch, createBlock, openBlock, unref, mergeProps, isRef, withCtx, createVNode } from "vue";
|
|
15
|
+
import { MobileField } from "../field/index.mjs";
|
|
17
16
|
import hooks from "../../../../../../node_modules/.pnpm/moment@2.30.1/node_modules/moment/dist/moment.mjs";
|
|
18
17
|
import { TimePicker } from "../../../../../../node_modules/.pnpm/vant@4.9.17_vue@3.5.13_typescript@5.7.3_/node_modules/vant/es/time-picker/index.mjs";
|
|
19
|
-
import { Field } from "../../../../../../node_modules/.pnpm/vant@4.9.17_vue@3.5.13_typescript@5.7.3_/node_modules/vant/es/field/index.mjs";
|
|
20
18
|
import { Popup } from "../../../../../../node_modules/.pnpm/vant@4.9.17_vue@3.5.13_typescript@5.7.3_/node_modules/vant/es/popup/index.mjs";
|
|
21
19
|
const _sfc_main = {
|
|
22
20
|
__name: "FieldTimePicker",
|
|
@@ -32,7 +30,9 @@ const _sfc_main = {
|
|
|
32
30
|
valueFormat: {
|
|
33
31
|
type: String,
|
|
34
32
|
default: "HH:mm:ss"
|
|
35
|
-
}
|
|
33
|
+
},
|
|
34
|
+
readonly: false,
|
|
35
|
+
"is-link": false
|
|
36
36
|
},
|
|
37
37
|
emits: ["update:modelValue"],
|
|
38
38
|
setup(__props, { emit: __emit }) {
|
|
@@ -70,46 +70,36 @@ const _sfc_main = {
|
|
|
70
70
|
showPicker.value = false;
|
|
71
71
|
};
|
|
72
72
|
return (_ctx, _cache) => {
|
|
73
|
-
const _component_van_field = Field;
|
|
74
73
|
const _component_van_time_picker = TimePicker;
|
|
75
74
|
const _component_van_popup = Popup;
|
|
76
|
-
return openBlock(),
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
"onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => isRef(pickerValue) ? pickerValue.value = $event : null),
|
|
105
|
-
readonly: false,
|
|
106
|
-
onConfirm,
|
|
107
|
-
onCancel: _cache[3] || (_cache[3] = ($event) => showPicker.value = false)
|
|
108
|
-
}), null, 16, ["modelValue"])
|
|
109
|
-
]),
|
|
110
|
-
_: 1
|
|
111
|
-
}, 8, ["show"])
|
|
112
|
-
], 64);
|
|
75
|
+
return openBlock(), createBlock(unref(MobileField), mergeProps(_ctx.$attrs, {
|
|
76
|
+
modelValue: unref(fieldTextValue),
|
|
77
|
+
"onUpdate:modelValue": _cache[3] || (_cache[3] = ($event) => isRef(fieldTextValue) ? fieldTextValue.value = $event : null),
|
|
78
|
+
"is-link": "",
|
|
79
|
+
readonly: "",
|
|
80
|
+
onClick: _cache[4] || (_cache[4] = ($event) => showPicker.value = true)
|
|
81
|
+
}), {
|
|
82
|
+
default: withCtx(() => [
|
|
83
|
+
createVNode(_component_van_popup, {
|
|
84
|
+
show: unref(showPicker),
|
|
85
|
+
"onUpdate:show": _cache[2] || (_cache[2] = ($event) => isRef(showPicker) ? showPicker.value = $event : null),
|
|
86
|
+
"destroy-on-close": "",
|
|
87
|
+
position: "bottom"
|
|
88
|
+
}, {
|
|
89
|
+
default: withCtx(() => [
|
|
90
|
+
createVNode(_component_van_time_picker, mergeProps(_ctx.$attrs, {
|
|
91
|
+
modelValue: unref(pickerValue),
|
|
92
|
+
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => isRef(pickerValue) ? pickerValue.value = $event : null),
|
|
93
|
+
readonly: false,
|
|
94
|
+
onConfirm,
|
|
95
|
+
onCancel: _cache[1] || (_cache[1] = ($event) => showPicker.value = false)
|
|
96
|
+
}), null, 16, ["modelValue"])
|
|
97
|
+
]),
|
|
98
|
+
_: 1
|
|
99
|
+
}, 8, ["show"])
|
|
100
|
+
]),
|
|
101
|
+
_: 1
|
|
102
|
+
}, 16, ["modelValue"]);
|
|
113
103
|
};
|
|
114
104
|
}
|
|
115
105
|
};
|
|
@@ -1,18 +1,34 @@
|
|
|
1
1
|
/* empty css */
|
|
2
2
|
/* empty css */
|
|
3
|
-
import { createBlock, openBlock, mergeProps, withCtx, createVNode, renderSlot } from "vue";
|
|
3
|
+
import { computed, provide, createBlock, openBlock, mergeProps, withCtx, createVNode, renderSlot } from "vue";
|
|
4
4
|
import { Form } from "../../../../../../node_modules/.pnpm/vant@4.9.17_vue@3.5.13_typescript@5.7.3_/node_modules/vant/es/form/index.mjs";
|
|
5
5
|
import { CellGroup } from "../../../../../../node_modules/.pnpm/vant@4.9.17_vue@3.5.13_typescript@5.7.3_/node_modules/vant/es/cell-group/index.mjs";
|
|
6
6
|
const _sfc_main = {
|
|
7
7
|
__name: "Form",
|
|
8
8
|
props: {
|
|
9
|
+
modelValue: {
|
|
10
|
+
type: Object,
|
|
11
|
+
default: {}
|
|
12
|
+
},
|
|
9
13
|
isCard: {
|
|
10
14
|
//卡片风格
|
|
11
15
|
type: Boolean,
|
|
12
16
|
default: false
|
|
13
17
|
}
|
|
14
18
|
},
|
|
15
|
-
|
|
19
|
+
emits: ["update:modelValue"],
|
|
20
|
+
setup(__props, { emit: __emit }) {
|
|
21
|
+
const props = __props;
|
|
22
|
+
const emit = __emit;
|
|
23
|
+
const formData = computed({
|
|
24
|
+
get: () => {
|
|
25
|
+
return props.modelValue;
|
|
26
|
+
},
|
|
27
|
+
set: (val) => {
|
|
28
|
+
emit("update:modelValue", val);
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
provide("formData", formData);
|
|
16
32
|
return (_ctx, _cache) => {
|
|
17
33
|
const _component_van_cell_group = CellGroup;
|
|
18
34
|
const _component_van_form = Form;
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { computed, defineAsyncComponent, inject, useAttrs, createBlock, openBlock, resolveDynamicComponent, unref, mergeProps, isRef } from "vue";
|
|
2
|
+
import { parseRule } from "../../../utils/formRule.mjs";
|
|
3
|
+
const _sfc_main = {
|
|
4
|
+
__name: "FormItem",
|
|
5
|
+
props: {
|
|
6
|
+
fieldType: {
|
|
7
|
+
type: String,
|
|
8
|
+
default: "text"
|
|
9
|
+
}
|
|
10
|
+
},
|
|
11
|
+
emits: ["update:modelValue"],
|
|
12
|
+
setup(__props, { emit: __emit }) {
|
|
13
|
+
const props = __props;
|
|
14
|
+
const formItem = computed(() => {
|
|
15
|
+
return defineAsyncComponent(() => {
|
|
16
|
+
switch (props.fieldType) {
|
|
17
|
+
case "text":
|
|
18
|
+
return import("../field/index.mjs");
|
|
19
|
+
case "picker":
|
|
20
|
+
return import("../fieldPicker/index.mjs");
|
|
21
|
+
case "cascader":
|
|
22
|
+
return import("../fieldCascaderPicker/index.mjs");
|
|
23
|
+
case "calendar":
|
|
24
|
+
return import("../fieldCalendarPicker/index.mjs");
|
|
25
|
+
case "date":
|
|
26
|
+
return import("../fieldDatePicker/index.mjs");
|
|
27
|
+
case "time":
|
|
28
|
+
return import("../fieldTimePicker/index.mjs");
|
|
29
|
+
case "radio":
|
|
30
|
+
return import("../fieldRadio/index.mjs");
|
|
31
|
+
case "checkbox":
|
|
32
|
+
return import("../fieldCheckbox/index.mjs");
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
});
|
|
36
|
+
const formData = inject("formData");
|
|
37
|
+
const attrs = useAttrs();
|
|
38
|
+
const emit = __emit;
|
|
39
|
+
const compValue = computed({
|
|
40
|
+
get: () => {
|
|
41
|
+
var _a;
|
|
42
|
+
if (formData) {
|
|
43
|
+
return (_a = formData.value) == null ? void 0 : _a[attrs.name];
|
|
44
|
+
}
|
|
45
|
+
return props.modelValue;
|
|
46
|
+
},
|
|
47
|
+
set: (val) => {
|
|
48
|
+
if (formData) {
|
|
49
|
+
formData.value[attrs.name] = val;
|
|
50
|
+
} else {
|
|
51
|
+
emit("update:modelValue", val);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
const rules = computed(() => {
|
|
56
|
+
return parseRule(attrs);
|
|
57
|
+
});
|
|
58
|
+
return (_ctx, _cache) => {
|
|
59
|
+
return openBlock(), createBlock(resolveDynamicComponent(unref(formItem)), mergeProps(_ctx.$attrs, {
|
|
60
|
+
modelValue: unref(compValue),
|
|
61
|
+
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => isRef(compValue) ? compValue.value = $event : null),
|
|
62
|
+
rules: unref(rules),
|
|
63
|
+
required: "auto"
|
|
64
|
+
}), null, 16, ["modelValue", "rules"]);
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
};
|
|
68
|
+
export {
|
|
69
|
+
_sfc_main as default
|
|
70
|
+
};
|
|
@@ -3,18 +3,32 @@ const parseRule = ({ label, isRequired, ruleType }) => {
|
|
|
3
3
|
if (isRequired) {
|
|
4
4
|
ruleList.push({ required: true, message: `请填写${label}` });
|
|
5
5
|
}
|
|
6
|
+
const errorMessage = `请填写正确的${label}`;
|
|
7
|
+
const validateEmpty = false;
|
|
6
8
|
switch (ruleType) {
|
|
7
9
|
case "email":
|
|
8
10
|
var pattern = /^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/;
|
|
9
|
-
ruleList.push({
|
|
11
|
+
ruleList.push({
|
|
12
|
+
pattern,
|
|
13
|
+
message: errorMessage,
|
|
14
|
+
validateEmpty
|
|
15
|
+
});
|
|
10
16
|
break;
|
|
11
17
|
case "phone":
|
|
12
18
|
var pattern = /^((\+?86)|(\(\+86\)))?(1[3-9]\d{9})$/;
|
|
13
|
-
ruleList.push({
|
|
19
|
+
ruleList.push({
|
|
20
|
+
pattern,
|
|
21
|
+
message: errorMessage,
|
|
22
|
+
validateEmpty
|
|
23
|
+
});
|
|
14
24
|
break;
|
|
15
25
|
case "mobile":
|
|
16
26
|
var pattern = /^([0-9]{3,4}-)?[0-9]{7,8}$/;
|
|
17
|
-
ruleList.push({
|
|
27
|
+
ruleList.push({
|
|
28
|
+
pattern,
|
|
29
|
+
message: errorMessage,
|
|
30
|
+
validateEmpty
|
|
31
|
+
});
|
|
18
32
|
break;
|
|
19
33
|
case "mobilephone":
|
|
20
34
|
let validatorMobilephone = function(value) {
|
|
@@ -23,10 +37,14 @@ const parseRule = ({ label, isRequired, ruleType }) => {
|
|
|
23
37
|
if (isMob.test(value) || isPhone.test(value)) {
|
|
24
38
|
return true;
|
|
25
39
|
} else {
|
|
26
|
-
return
|
|
40
|
+
return false;
|
|
27
41
|
}
|
|
28
42
|
};
|
|
29
|
-
ruleList.push({
|
|
43
|
+
ruleList.push({
|
|
44
|
+
validator: validatorMobilephone,
|
|
45
|
+
message: errorMessage,
|
|
46
|
+
validateEmpty
|
|
47
|
+
});
|
|
30
48
|
break;
|
|
31
49
|
case "idNo":
|
|
32
50
|
let validatorIdNo = function(value) {
|
|
@@ -35,26 +53,46 @@ const parseRule = ({ label, isRequired, ruleType }) => {
|
|
|
35
53
|
if (reg15.test(value) || reg18.test(value)) {
|
|
36
54
|
return true;
|
|
37
55
|
} else {
|
|
38
|
-
return
|
|
56
|
+
return false;
|
|
39
57
|
}
|
|
40
58
|
};
|
|
41
|
-
ruleList.push({
|
|
59
|
+
ruleList.push({
|
|
60
|
+
validator: validatorIdNo,
|
|
61
|
+
message: errorMessage,
|
|
62
|
+
validateEmpty
|
|
63
|
+
});
|
|
42
64
|
break;
|
|
43
65
|
case "usci":
|
|
44
66
|
var pattern = /^([0-9A-HJ-NPQRTUWXY]{2}\d{6}[0-9A-HJ-NPQRTUWXY]{10}|[1-9]\d{14})$/;
|
|
45
|
-
ruleList.push({
|
|
67
|
+
ruleList.push({
|
|
68
|
+
pattern,
|
|
69
|
+
message: errorMessage,
|
|
70
|
+
validateEmpty
|
|
71
|
+
});
|
|
46
72
|
break;
|
|
47
73
|
case "postcode":
|
|
48
74
|
var pattern = /^[0-9]{6}$/;
|
|
49
|
-
ruleList.push({
|
|
75
|
+
ruleList.push({
|
|
76
|
+
pattern,
|
|
77
|
+
message: errorMessage,
|
|
78
|
+
validateEmpty
|
|
79
|
+
});
|
|
50
80
|
break;
|
|
51
81
|
case "fax":
|
|
52
82
|
var pattern = /^([0-9]{3,4}-)?[0-9]{7,8}$/;
|
|
53
|
-
ruleList.push({
|
|
83
|
+
ruleList.push({
|
|
84
|
+
pattern,
|
|
85
|
+
message: errorMessage,
|
|
86
|
+
validateEmpty
|
|
87
|
+
});
|
|
54
88
|
break;
|
|
55
89
|
case "bankcard":
|
|
56
90
|
var pattern = /^[1-9]\d{7,29}$/;
|
|
57
|
-
ruleList.push({
|
|
91
|
+
ruleList.push({
|
|
92
|
+
pattern,
|
|
93
|
+
message: errorMessage,
|
|
94
|
+
validateEmpty
|
|
95
|
+
});
|
|
58
96
|
break;
|
|
59
97
|
}
|
|
60
98
|
return ruleList;
|