@fecp/mobile 1.0.58 → 1.0.59
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/node_modules/.pnpm/@vant_area-data@2.0.0/node_modules/@vant/area-data/dist/index.esm.mjs +3924 -0
- package/es/packages/mobile/index.mjs +2 -0
- package/es/packages/mobile/src/components/all.mjs +2 -0
- package/es/packages/mobile/src/components/form/fieldArea/FieldArea.vue.mjs +159 -0
- package/es/packages/mobile/src/components/form/fieldArea/index.mjs +10 -0
- package/es/packages/mobile/src/components/form/formItem/FormItem.vue.mjs +2 -0
- package/lib/node_modules/.pnpm/@vant_area-data@2.0.0/node_modules/@vant/area-data/dist/index.esm.js +3924 -0
- package/lib/packages/mobile/index.js +46 -44
- package/lib/packages/mobile/src/components/all.js +46 -44
- package/lib/packages/mobile/src/components/form/fieldArea/FieldArea.vue.js +159 -0
- package/lib/packages/mobile/src/components/form/fieldArea/index.js +10 -0
- package/lib/packages/mobile/src/components/form/formItem/FormItem.vue.js +2 -0
- package/package.json +1 -1
|
@@ -37,6 +37,7 @@ import { MobileFieldTimePicker } from "./src/components/form/fieldTimePicker/ind
|
|
|
37
37
|
import { MobileFieldCascaderPicker } from "./src/components/form/fieldCascaderPicker/index.mjs";
|
|
38
38
|
import { MobileFieldCheckbox } from "./src/components/form/fieldCheckbox/index.mjs";
|
|
39
39
|
import { MobileFieldRadio } from "./src/components/form/fieldRadio/index.mjs";
|
|
40
|
+
import { MobileFieldArea } from "./src/components/form/fieldArea/index.mjs";
|
|
40
41
|
import { MobileForm } from "./src/components/form/form/index.mjs";
|
|
41
42
|
import { MobileFormItem } from "./src/components/form/formItem/index.mjs";
|
|
42
43
|
import { MobileRadioGroup } from "./src/components/form/radioGroup/index.mjs";
|
|
@@ -86,6 +87,7 @@ export {
|
|
|
86
87
|
MobileDropdownMenu,
|
|
87
88
|
MobileEmpty,
|
|
88
89
|
MobileField,
|
|
90
|
+
MobileFieldArea,
|
|
89
91
|
MobileFieldCalendarPicker,
|
|
90
92
|
MobileFieldCascaderPicker,
|
|
91
93
|
MobileFieldCheckbox,
|
|
@@ -34,6 +34,7 @@ import { MobileFieldTimePicker } from "./form/fieldTimePicker/index.mjs";
|
|
|
34
34
|
import { MobileFieldCascaderPicker } from "./form/fieldCascaderPicker/index.mjs";
|
|
35
35
|
import { MobileFieldCheckbox } from "./form/fieldCheckbox/index.mjs";
|
|
36
36
|
import { MobileFieldRadio } from "./form/fieldRadio/index.mjs";
|
|
37
|
+
import { MobileFieldArea } from "./form/fieldArea/index.mjs";
|
|
37
38
|
import { MobileForm } from "./form/form/index.mjs";
|
|
38
39
|
import { MobileFormItem } from "./form/formItem/index.mjs";
|
|
39
40
|
import { MobileRadioGroup } from "./form/radioGroup/index.mjs";
|
|
@@ -72,6 +73,7 @@ export {
|
|
|
72
73
|
MobileDropdownMenu,
|
|
73
74
|
MobileEmpty,
|
|
74
75
|
MobileField,
|
|
76
|
+
MobileFieldArea,
|
|
75
77
|
MobileFieldCalendarPicker,
|
|
76
78
|
MobileFieldCascaderPicker,
|
|
77
79
|
MobileFieldCheckbox,
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
/* empty css */
|
|
2
|
+
/* empty css */
|
|
3
|
+
/* empty css */
|
|
4
|
+
/* empty css */
|
|
5
|
+
/* empty css */
|
|
6
|
+
/* empty css */
|
|
7
|
+
/* empty css */
|
|
8
|
+
/* empty css */
|
|
9
|
+
/* empty css */
|
|
10
|
+
/* empty css */
|
|
11
|
+
/* empty css */
|
|
12
|
+
import { ref, computed, watch, createBlock, openBlock, unref, mergeProps, isRef, createSlots, withCtx, createVNode, withModifiers } from "vue";
|
|
13
|
+
import { MobileField } from "../field/index.mjs";
|
|
14
|
+
import { useCascaderAreaData } from "../../../../../../node_modules/.pnpm/@vant_area-data@2.0.0/node_modules/@vant/area-data/dist/index.esm.mjs";
|
|
15
|
+
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";
|
|
16
|
+
import { Cascader } from "../../../../../../node_modules/.pnpm/vant@4.9.17_vue@3.5.13_typescript@5.7.3_/node_modules/vant/es/cascader/index.mjs";
|
|
17
|
+
import { Icon } from "../../../../../../node_modules/.pnpm/vant@4.9.17_vue@3.5.13_typescript@5.7.3_/node_modules/vant/es/icon/index.mjs";
|
|
18
|
+
const _sfc_main = {
|
|
19
|
+
__name: "FieldArea",
|
|
20
|
+
props: {
|
|
21
|
+
treeOptionsFieldNames: {
|
|
22
|
+
type: Object,
|
|
23
|
+
default: {
|
|
24
|
+
text: "text",
|
|
25
|
+
value: "value",
|
|
26
|
+
children: "children"
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
modelValue: {
|
|
30
|
+
type: String,
|
|
31
|
+
default: ""
|
|
32
|
+
},
|
|
33
|
+
disabled: {
|
|
34
|
+
type: Boolean,
|
|
35
|
+
default: false
|
|
36
|
+
},
|
|
37
|
+
readonly: {
|
|
38
|
+
type: Boolean,
|
|
39
|
+
default: false
|
|
40
|
+
},
|
|
41
|
+
"is-link": false
|
|
42
|
+
},
|
|
43
|
+
emits: ["update:modelValue"],
|
|
44
|
+
setup(__props, { emit: __emit }) {
|
|
45
|
+
const props = __props;
|
|
46
|
+
const finalOptions = ref(useCascaderAreaData());
|
|
47
|
+
const fieldTextValue = ref("");
|
|
48
|
+
const showPicker = ref(false);
|
|
49
|
+
const emit = __emit;
|
|
50
|
+
const pickerValue = computed({
|
|
51
|
+
get: () => {
|
|
52
|
+
const value = props.modelValue.split("/");
|
|
53
|
+
return value[value.length - 1];
|
|
54
|
+
},
|
|
55
|
+
set: (val) => {
|
|
56
|
+
emit("update:modelValue", val);
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
function getDisplayValue(options, fieldNames, modelValue) {
|
|
60
|
+
const { text, value, children } = fieldNames;
|
|
61
|
+
const values = modelValue.split("/");
|
|
62
|
+
const displayValues = [];
|
|
63
|
+
function findValueInOptions(currentOptions, targetValue) {
|
|
64
|
+
for (const option of currentOptions) {
|
|
65
|
+
if (option[value] === targetValue) {
|
|
66
|
+
return option[text];
|
|
67
|
+
}
|
|
68
|
+
if (option[children] && option[children].length > 0) {
|
|
69
|
+
const result = findValueInOptions(option[children], targetValue);
|
|
70
|
+
if (result) {
|
|
71
|
+
return result;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
return null;
|
|
76
|
+
}
|
|
77
|
+
for (const val of values) {
|
|
78
|
+
const displayValue = findValueInOptions(options, val);
|
|
79
|
+
if (displayValue) {
|
|
80
|
+
displayValues.push(displayValue);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
return displayValues.join("/");
|
|
84
|
+
}
|
|
85
|
+
watch(
|
|
86
|
+
[() => props.modelValue, finalOptions],
|
|
87
|
+
([value, options]) => {
|
|
88
|
+
if (!value) {
|
|
89
|
+
fieldTextValue.value = "";
|
|
90
|
+
return;
|
|
91
|
+
}
|
|
92
|
+
fieldTextValue.value = getDisplayValue(
|
|
93
|
+
options,
|
|
94
|
+
props.treeOptionsFieldNames,
|
|
95
|
+
value
|
|
96
|
+
);
|
|
97
|
+
},
|
|
98
|
+
{ immediate: true }
|
|
99
|
+
);
|
|
100
|
+
const onFinish = ({ selectedOptions }) => {
|
|
101
|
+
pickerValue.value = selectedOptions.map((option) => option[props.treeOptionsFieldNames.value]).join("/");
|
|
102
|
+
showPicker.value = false;
|
|
103
|
+
};
|
|
104
|
+
return (_ctx, _cache) => {
|
|
105
|
+
const _component_van_icon = Icon;
|
|
106
|
+
const _component_van_cascader = Cascader;
|
|
107
|
+
const _component_van_popup = Popup;
|
|
108
|
+
return openBlock(), createBlock(unref(MobileField), mergeProps(_ctx.$attrs, {
|
|
109
|
+
modelValue: unref(fieldTextValue),
|
|
110
|
+
"onUpdate:modelValue": _cache[4] || (_cache[4] = ($event) => isRef(fieldTextValue) ? fieldTextValue.value = $event : null),
|
|
111
|
+
isLink: __props.readonly ? false : true,
|
|
112
|
+
readonly: "",
|
|
113
|
+
disabled: __props.disabled,
|
|
114
|
+
onClick: _cache[5] || (_cache[5] = () => {
|
|
115
|
+
if (!__props.readonly) {
|
|
116
|
+
showPicker.value = true;
|
|
117
|
+
}
|
|
118
|
+
})
|
|
119
|
+
}), createSlots({
|
|
120
|
+
default: withCtx(() => [
|
|
121
|
+
createVNode(_component_van_popup, {
|
|
122
|
+
show: unref(showPicker),
|
|
123
|
+
"onUpdate:show": _cache[3] || (_cache[3] = ($event) => isRef(showPicker) ? showPicker.value = $event : null),
|
|
124
|
+
"destroy-on-close": "",
|
|
125
|
+
position: "bottom"
|
|
126
|
+
}, {
|
|
127
|
+
default: withCtx(() => [
|
|
128
|
+
createVNode(_component_van_cascader, mergeProps(_ctx.$attrs, {
|
|
129
|
+
modelValue: unref(pickerValue),
|
|
130
|
+
"onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => isRef(pickerValue) ? pickerValue.value = $event : null),
|
|
131
|
+
options: unref(finalOptions),
|
|
132
|
+
placeholder: "请选择",
|
|
133
|
+
onFinish,
|
|
134
|
+
onClose: _cache[2] || (_cache[2] = ($event) => showPicker.value = false)
|
|
135
|
+
}), null, 16, ["modelValue", "options"])
|
|
136
|
+
]),
|
|
137
|
+
_: 1
|
|
138
|
+
}, 8, ["show"])
|
|
139
|
+
]),
|
|
140
|
+
_: 2
|
|
141
|
+
}, [
|
|
142
|
+
!__props.readonly && !__props.disabled && unref(fieldTextValue) ? {
|
|
143
|
+
name: "right-icon",
|
|
144
|
+
fn: withCtx(() => [
|
|
145
|
+
createVNode(_component_van_icon, {
|
|
146
|
+
name: "clear",
|
|
147
|
+
class: "custom-close-icon",
|
|
148
|
+
onClick: _cache[0] || (_cache[0] = withModifiers(($event) => pickerValue.value = null, ["stop"]))
|
|
149
|
+
})
|
|
150
|
+
]),
|
|
151
|
+
key: "0"
|
|
152
|
+
} : void 0
|
|
153
|
+
]), 1040, ["modelValue", "isLink", "disabled"]);
|
|
154
|
+
};
|
|
155
|
+
}
|
|
156
|
+
};
|
|
157
|
+
export {
|
|
158
|
+
_sfc_main as default
|
|
159
|
+
};
|
|
@@ -40,6 +40,8 @@ const _sfc_main = {
|
|
|
40
40
|
return defineAsyncComponent(() => import("../fieldCheckbox/index.mjs"));
|
|
41
41
|
case "upload":
|
|
42
42
|
return defineAsyncComponent(() => import("../fieldUploader/index.mjs"));
|
|
43
|
+
case "area":
|
|
44
|
+
return defineAsyncComponent(() => import("../fieldArea/index.mjs"));
|
|
43
45
|
}
|
|
44
46
|
});
|
|
45
47
|
const formData = inject("formData");
|