@fecp/mobile 1.0.6 → 1.0.8
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/moment@2.30.1/node_modules/moment/dist/moment.mjs +3997 -0
- package/es/packages/mobile/index.mjs +10 -0
- package/es/packages/mobile/src/components/all.mjs +8 -0
- package/es/packages/mobile/src/components/form/fieldCalendarPicker/FieldCalendarPicker.vue.mjs +156 -0
- package/es/packages/mobile/src/components/form/fieldCalendarPicker/index.mjs +10 -0
- package/es/packages/mobile/src/components/form/fieldCascaderPicker/fieldCascaderPicker.vue.mjs +142 -0
- package/es/packages/mobile/src/components/form/fieldCascaderPicker/index.mjs +10 -0
- package/es/packages/mobile/src/components/form/fieldDatePicker/FieldDatePicker.vue.mjs +110 -0
- package/es/packages/mobile/src/components/form/fieldDatePicker/index.mjs +10 -0
- package/es/packages/mobile/src/components/form/fieldPicker/FieldPicker.vue.mjs +24 -16
- package/es/packages/mobile/src/components/form/fieldTimePicker/FieldTimePicker.vue.mjs +110 -0
- package/es/packages/mobile/src/components/form/fieldTimePicker/index.mjs +10 -0
- package/lib/node_modules/.pnpm/moment@2.30.1/node_modules/moment/dist/moment.js +3997 -0
- package/lib/packages/mobile/index.js +66 -56
- package/lib/packages/mobile/src/components/all.js +54 -46
- package/lib/packages/mobile/src/components/form/fieldCalendarPicker/FieldCalendarPicker.vue.js +156 -0
- package/lib/packages/mobile/src/components/form/fieldCalendarPicker/index.js +10 -0
- package/lib/packages/mobile/src/components/form/fieldCascaderPicker/fieldCascaderPicker.vue.js +142 -0
- package/lib/packages/mobile/src/components/form/fieldCascaderPicker/index.js +10 -0
- package/lib/packages/mobile/src/components/form/fieldDatePicker/FieldDatePicker.vue.js +110 -0
- package/lib/packages/mobile/src/components/form/fieldDatePicker/index.js +10 -0
- package/lib/packages/mobile/src/components/form/fieldPicker/FieldPicker.vue.js +23 -15
- package/lib/packages/mobile/src/components/form/fieldTimePicker/FieldTimePicker.vue.js +110 -0
- package/lib/packages/mobile/src/components/form/fieldTimePicker/index.js +10 -0
- package/package.json +1 -1
|
@@ -30,6 +30,10 @@ import { MobileCheckboxGroup } from "./src/components/form/checkboxGroup/index.m
|
|
|
30
30
|
import { MobileDatePicker } from "./src/components/form/datePicker/index.mjs";
|
|
31
31
|
import { MobileField } from "./src/components/form/field/index.mjs";
|
|
32
32
|
import { MobileFieldPicker } from "./src/components/form/fieldPicker/index.mjs";
|
|
33
|
+
import { MobileFieldCalendarPicker } from "./src/components/form/fieldCalendarPicker/index.mjs";
|
|
34
|
+
import { MobileFieldDatePicker } from "./src/components/form/fieldDatePicker/index.mjs";
|
|
35
|
+
import { MobileFieldTimePicker } from "./src/components/form/fieldTimePicker/index.mjs";
|
|
36
|
+
import { MobileFieldCascaderPicker } from "./src/components/form/fieldCascaderPicker/index.mjs";
|
|
33
37
|
import { MobileForm } from "./src/components/form/form/index.mjs";
|
|
34
38
|
import { MobilePicker } from "./src/components/form/picker/index.mjs";
|
|
35
39
|
import { MobilePickerGroup } from "./src/components/form/pickerGroup/index.mjs";
|
|
@@ -54,6 +58,7 @@ import { MobileTabbar } from "./src/components/navigation/tabbar/index.mjs";
|
|
|
54
58
|
import { MobileTabbarItem } from "./src/components/navigation/tabbarItem/index.mjs";
|
|
55
59
|
import { MobileTreeSelect } from "./src/components/navigation/treeSelect/index.mjs";
|
|
56
60
|
import { closeDialog, showConfirmDialog, showDialog } from "../../node_modules/.pnpm/vant@4.9.17_vue@3.5.13_typescript@5.7.3_/node_modules/vant/es/dialog/function-call.mjs";
|
|
61
|
+
import { showImagePreview } from "../../node_modules/.pnpm/vant@4.9.17_vue@3.5.13_typescript@5.7.3_/node_modules/vant/es/image-preview/function-call.mjs";
|
|
57
62
|
import { closeNotify, showNotify } from "../../node_modules/.pnpm/vant@4.9.17_vue@3.5.13_typescript@5.7.3_/node_modules/vant/es/notify/function-call.mjs";
|
|
58
63
|
import { allowMultipleToast, closeToast, showFailToast, showLoadingToast, showSuccessToast, showToast } from "../../node_modules/.pnpm/vant@4.9.17_vue@3.5.13_typescript@5.7.3_/node_modules/vant/es/toast/function-call.mjs";
|
|
59
64
|
const index = {
|
|
@@ -82,7 +87,11 @@ export {
|
|
|
82
87
|
MobileDropdownMenu,
|
|
83
88
|
MobileEmpty,
|
|
84
89
|
MobileField,
|
|
90
|
+
MobileFieldCalendarPicker,
|
|
91
|
+
MobileFieldCascaderPicker,
|
|
92
|
+
MobileFieldDatePicker,
|
|
85
93
|
MobileFieldPicker,
|
|
94
|
+
MobileFieldTimePicker,
|
|
86
95
|
MobileFloatingBubble,
|
|
87
96
|
MobileFloatingPanel,
|
|
88
97
|
MobileForm,
|
|
@@ -126,6 +135,7 @@ export {
|
|
|
126
135
|
showConfirmDialog,
|
|
127
136
|
showDialog,
|
|
128
137
|
showFailToast,
|
|
138
|
+
showImagePreview,
|
|
129
139
|
showLoadingToast,
|
|
130
140
|
showNotify,
|
|
131
141
|
showSuccessToast,
|
|
@@ -29,6 +29,10 @@ import { MobileCheckboxGroup } from "./form/checkboxGroup/index.mjs";
|
|
|
29
29
|
import { MobileDatePicker } from "./form/datePicker/index.mjs";
|
|
30
30
|
import { MobileField } from "./form/field/index.mjs";
|
|
31
31
|
import { MobileFieldPicker } from "./form/fieldPicker/index.mjs";
|
|
32
|
+
import { MobileFieldCalendarPicker } from "./form/fieldCalendarPicker/index.mjs";
|
|
33
|
+
import { MobileFieldDatePicker } from "./form/fieldDatePicker/index.mjs";
|
|
34
|
+
import { MobileFieldTimePicker } from "./form/fieldTimePicker/index.mjs";
|
|
35
|
+
import { MobileFieldCascaderPicker } from "./form/fieldCascaderPicker/index.mjs";
|
|
32
36
|
import { MobileForm } from "./form/form/index.mjs";
|
|
33
37
|
import { MobilePicker } from "./form/picker/index.mjs";
|
|
34
38
|
import { MobilePickerGroup } from "./form/pickerGroup/index.mjs";
|
|
@@ -71,7 +75,11 @@ export {
|
|
|
71
75
|
MobileDropdownMenu,
|
|
72
76
|
MobileEmpty,
|
|
73
77
|
MobileField,
|
|
78
|
+
MobileFieldCalendarPicker,
|
|
79
|
+
MobileFieldCascaderPicker,
|
|
80
|
+
MobileFieldDatePicker,
|
|
74
81
|
MobileFieldPicker,
|
|
82
|
+
MobileFieldTimePicker,
|
|
75
83
|
MobileFloatingBubble,
|
|
76
84
|
MobileFloatingPanel,
|
|
77
85
|
MobileForm,
|
package/es/packages/mobile/src/components/form/fieldCalendarPicker/FieldCalendarPicker.vue.mjs
ADDED
|
@@ -0,0 +1,156 @@
|
|
|
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
|
+
/* empty css */
|
|
13
|
+
/* empty css */
|
|
14
|
+
/* empty css */
|
|
15
|
+
/* empty css */
|
|
16
|
+
/* empty css */
|
|
17
|
+
/* empty css */
|
|
18
|
+
/* empty css */
|
|
19
|
+
import { ref, computed, watch, createElementBlock, openBlock, Fragment, createVNode, mergeProps, unref, isRef, createSlots, renderList, withCtx, renderSlot } from "vue";
|
|
20
|
+
import hooks from "../../../../../../node_modules/.pnpm/moment@2.30.1/node_modules/moment/dist/moment.mjs";
|
|
21
|
+
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";
|
|
22
|
+
import { Calendar } from "../../../../../../node_modules/.pnpm/vant@4.9.17_vue@3.5.13_typescript@5.7.3_/node_modules/vant/es/calendar/index.mjs";
|
|
23
|
+
const _sfc_main = {
|
|
24
|
+
__name: "FieldCalendarPicker",
|
|
25
|
+
props: {
|
|
26
|
+
title: {
|
|
27
|
+
type: String,
|
|
28
|
+
default: "日期选择"
|
|
29
|
+
},
|
|
30
|
+
calendarType: {
|
|
31
|
+
type: String,
|
|
32
|
+
default: "single"
|
|
33
|
+
},
|
|
34
|
+
textFormat: {
|
|
35
|
+
type: String,
|
|
36
|
+
default: "YYYY-MM-DD"
|
|
37
|
+
},
|
|
38
|
+
valueFormat: {
|
|
39
|
+
type: String,
|
|
40
|
+
default: "YYYYMMDD"
|
|
41
|
+
},
|
|
42
|
+
modelValue: {
|
|
43
|
+
type: String,
|
|
44
|
+
default: ""
|
|
45
|
+
}
|
|
46
|
+
},
|
|
47
|
+
emits: ["update:modelValue"],
|
|
48
|
+
setup(__props, { emit: __emit }) {
|
|
49
|
+
const props = __props;
|
|
50
|
+
const fieldTextValue = ref("");
|
|
51
|
+
const showCalendar = ref(false);
|
|
52
|
+
const emit = __emit;
|
|
53
|
+
const defaultDate = computed({
|
|
54
|
+
get: () => {
|
|
55
|
+
if (props.calendarType == "single") {
|
|
56
|
+
try {
|
|
57
|
+
return hooks(props.modelValue, props.valueFormat).toDate();
|
|
58
|
+
} catch (error) {
|
|
59
|
+
return /* @__PURE__ */ new Date();
|
|
60
|
+
}
|
|
61
|
+
} else if (props.calendarType == "multiple") {
|
|
62
|
+
try {
|
|
63
|
+
return props.modelValue.map(
|
|
64
|
+
(value) => hooks(value, props.valueFormat).toDate()
|
|
65
|
+
);
|
|
66
|
+
} catch (error) {
|
|
67
|
+
return [/* @__PURE__ */ new Date()];
|
|
68
|
+
}
|
|
69
|
+
} else if (props.calendarType == "range") {
|
|
70
|
+
try {
|
|
71
|
+
return props.modelValue.map(
|
|
72
|
+
(value) => hooks(value, props.valueFormat).toDate()
|
|
73
|
+
);
|
|
74
|
+
} catch (error) {
|
|
75
|
+
return [];
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
},
|
|
79
|
+
set: (val) => {
|
|
80
|
+
emit("update:modelValue", val);
|
|
81
|
+
}
|
|
82
|
+
});
|
|
83
|
+
watch(
|
|
84
|
+
() => props.modelValue,
|
|
85
|
+
(value) => {
|
|
86
|
+
if (props.calendarType == "single") {
|
|
87
|
+
fieldTextValue.value = hooks(value, props.valueFormat).format(
|
|
88
|
+
props.textFormat
|
|
89
|
+
);
|
|
90
|
+
} else if (props.calendarType == "multiple") {
|
|
91
|
+
if (Array.isArray(value)) {
|
|
92
|
+
fieldTextValue.value = `选择了 ${value.length} 个日期`;
|
|
93
|
+
}
|
|
94
|
+
} else if (props.calendarType == "range") {
|
|
95
|
+
if (Array.isArray(value)) {
|
|
96
|
+
const [start, end] = value;
|
|
97
|
+
fieldTextValue.value = `${hooks(start, props.valueFormat).format(
|
|
98
|
+
props.textFormat
|
|
99
|
+
)} 至 ${hooks(end, props.valueFormat).format(props.textFormat)}`;
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
},
|
|
103
|
+
{ immediate: true }
|
|
104
|
+
);
|
|
105
|
+
const onConfirm = (values) => {
|
|
106
|
+
if (props.calendarType == "single") {
|
|
107
|
+
defaultDate.value = hooks(values).format(props.valueFormat);
|
|
108
|
+
} else if (props.calendarType == "multiple") {
|
|
109
|
+
defaultDate.value = values.map(
|
|
110
|
+
(value) => hooks(value).format(props.valueFormat)
|
|
111
|
+
);
|
|
112
|
+
} else if (props.calendarType == "range") {
|
|
113
|
+
defaultDate.value = values.map(
|
|
114
|
+
(value) => hooks(value).format(props.valueFormat)
|
|
115
|
+
);
|
|
116
|
+
}
|
|
117
|
+
showCalendar.value = false;
|
|
118
|
+
};
|
|
119
|
+
return (_ctx, _cache) => {
|
|
120
|
+
const _component_van_field = Field;
|
|
121
|
+
const _component_van_calendar = Calendar;
|
|
122
|
+
return openBlock(), createElementBlock(Fragment, null, [
|
|
123
|
+
createVNode(_component_van_field, mergeProps({
|
|
124
|
+
modelValue: unref(fieldTextValue),
|
|
125
|
+
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => isRef(fieldTextValue) ? fieldTextValue.value = $event : null),
|
|
126
|
+
"is-link": "",
|
|
127
|
+
readonly: "",
|
|
128
|
+
name: "picker"
|
|
129
|
+
}, _ctx.$attrs, {
|
|
130
|
+
onClick: _cache[1] || (_cache[1] = ($event) => showCalendar.value = true)
|
|
131
|
+
}), createSlots({ _: 2 }, [
|
|
132
|
+
renderList(_ctx.$slots, (item, key) => {
|
|
133
|
+
return {
|
|
134
|
+
name: key,
|
|
135
|
+
fn: withCtx(() => [
|
|
136
|
+
renderSlot(_ctx.$slots, key)
|
|
137
|
+
])
|
|
138
|
+
};
|
|
139
|
+
})
|
|
140
|
+
]), 1040, ["modelValue"]),
|
|
141
|
+
createVNode(_component_van_calendar, mergeProps(_ctx.$attrs, {
|
|
142
|
+
show: unref(showCalendar),
|
|
143
|
+
"onUpdate:show": _cache[2] || (_cache[2] = ($event) => isRef(showCalendar) ? showCalendar.value = $event : null),
|
|
144
|
+
"default-date": unref(defaultDate),
|
|
145
|
+
title: __props.title,
|
|
146
|
+
type: __props.calendarType,
|
|
147
|
+
"switch-mode": "year-month",
|
|
148
|
+
onConfirm
|
|
149
|
+
}), null, 16, ["show", "default-date", "title", "type"])
|
|
150
|
+
], 64);
|
|
151
|
+
};
|
|
152
|
+
}
|
|
153
|
+
};
|
|
154
|
+
export {
|
|
155
|
+
_sfc_main as default
|
|
156
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import _sfc_main from "./FieldCalendarPicker.vue.mjs";
|
|
2
|
+
import install from "../../../utils/install.mjs";
|
|
3
|
+
const MobileFieldCalendarPicker = install.withInstall(
|
|
4
|
+
"MobileFieldCalendarPicker",
|
|
5
|
+
_sfc_main
|
|
6
|
+
);
|
|
7
|
+
export {
|
|
8
|
+
MobileFieldCalendarPicker,
|
|
9
|
+
MobileFieldCalendarPicker as default
|
|
10
|
+
};
|
package/es/packages/mobile/src/components/form/fieldCascaderPicker/fieldCascaderPicker.vue.mjs
ADDED
|
@@ -0,0 +1,142 @@
|
|
|
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
|
+
/* empty css */
|
|
13
|
+
/* empty css */
|
|
14
|
+
import { ref, computed, watch, createElementBlock, openBlock, Fragment, createVNode, mergeProps, unref, isRef, createSlots, renderList, withCtx, renderSlot } from "vue";
|
|
15
|
+
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";
|
|
16
|
+
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";
|
|
17
|
+
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";
|
|
18
|
+
const _sfc_main = {
|
|
19
|
+
__name: "fieldCascaderPicker",
|
|
20
|
+
props: {
|
|
21
|
+
options: {
|
|
22
|
+
type: Array,
|
|
23
|
+
default: []
|
|
24
|
+
},
|
|
25
|
+
fieldNames: {
|
|
26
|
+
type: Object,
|
|
27
|
+
default: {
|
|
28
|
+
text: "text",
|
|
29
|
+
value: "value",
|
|
30
|
+
children: "children"
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
modelValue: {
|
|
34
|
+
type: String,
|
|
35
|
+
default: ""
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
emits: ["update:modelValue"],
|
|
39
|
+
setup(__props, { emit: __emit }) {
|
|
40
|
+
const props = __props;
|
|
41
|
+
const fieldTextValue = ref("");
|
|
42
|
+
const showPicker = ref(false);
|
|
43
|
+
const emit = __emit;
|
|
44
|
+
const pickerValue = computed({
|
|
45
|
+
get: () => {
|
|
46
|
+
const value = props.modelValue.split("/");
|
|
47
|
+
return value[value.length - 1];
|
|
48
|
+
},
|
|
49
|
+
set: (val) => {
|
|
50
|
+
emit("update:modelValue", val);
|
|
51
|
+
}
|
|
52
|
+
});
|
|
53
|
+
function getDisplayValue(options, fieldNames, modelValue) {
|
|
54
|
+
const { text, value, children } = fieldNames;
|
|
55
|
+
const values = modelValue.split("/");
|
|
56
|
+
const displayValues = [];
|
|
57
|
+
function findValueInOptions(currentOptions, targetValue) {
|
|
58
|
+
for (const option of currentOptions) {
|
|
59
|
+
if (option[value] === targetValue) {
|
|
60
|
+
return option[text];
|
|
61
|
+
}
|
|
62
|
+
if (option[children] && option[children].length > 0) {
|
|
63
|
+
const result = findValueInOptions(option[children], targetValue);
|
|
64
|
+
if (result) {
|
|
65
|
+
return result;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
return null;
|
|
70
|
+
}
|
|
71
|
+
for (const val of values) {
|
|
72
|
+
const displayValue = findValueInOptions(options, val);
|
|
73
|
+
if (displayValue) {
|
|
74
|
+
displayValues.push(displayValue);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
return displayValues.join("/");
|
|
78
|
+
}
|
|
79
|
+
watch(
|
|
80
|
+
() => props.modelValue,
|
|
81
|
+
(value) => {
|
|
82
|
+
fieldTextValue.value = getDisplayValue(
|
|
83
|
+
props.options,
|
|
84
|
+
props.fieldNames,
|
|
85
|
+
value
|
|
86
|
+
);
|
|
87
|
+
},
|
|
88
|
+
{ immediate: true }
|
|
89
|
+
);
|
|
90
|
+
const onFinish = ({ selectedOptions }) => {
|
|
91
|
+
pickerValue.value = selectedOptions.map((option) => option[props.fieldNames.value]).join("/");
|
|
92
|
+
showPicker.value = false;
|
|
93
|
+
};
|
|
94
|
+
return (_ctx, _cache) => {
|
|
95
|
+
const _component_van_field = Field;
|
|
96
|
+
const _component_van_cascader = Cascader;
|
|
97
|
+
const _component_van_popup = Popup;
|
|
98
|
+
return openBlock(), createElementBlock(Fragment, null, [
|
|
99
|
+
createVNode(_component_van_field, mergeProps({
|
|
100
|
+
modelValue: unref(fieldTextValue),
|
|
101
|
+
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => isRef(fieldTextValue) ? fieldTextValue.value = $event : null),
|
|
102
|
+
"is-link": "",
|
|
103
|
+
readonly: "",
|
|
104
|
+
name: "picker"
|
|
105
|
+
}, _ctx.$attrs, {
|
|
106
|
+
onClick: _cache[1] || (_cache[1] = ($event) => showPicker.value = true)
|
|
107
|
+
}), createSlots({ _: 2 }, [
|
|
108
|
+
renderList(_ctx.$slots, (item, key) => {
|
|
109
|
+
return {
|
|
110
|
+
name: key,
|
|
111
|
+
fn: withCtx(() => [
|
|
112
|
+
renderSlot(_ctx.$slots, key)
|
|
113
|
+
])
|
|
114
|
+
};
|
|
115
|
+
})
|
|
116
|
+
]), 1040, ["modelValue"]),
|
|
117
|
+
createVNode(_component_van_popup, {
|
|
118
|
+
show: unref(showPicker),
|
|
119
|
+
"onUpdate:show": _cache[4] || (_cache[4] = ($event) => isRef(showPicker) ? showPicker.value = $event : null),
|
|
120
|
+
"destroy-on-close": "",
|
|
121
|
+
position: "bottom"
|
|
122
|
+
}, {
|
|
123
|
+
default: withCtx(() => [
|
|
124
|
+
createVNode(_component_van_cascader, mergeProps(_ctx.$attrs, {
|
|
125
|
+
modelValue: unref(pickerValue),
|
|
126
|
+
"onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => isRef(pickerValue) ? pickerValue.value = $event : null),
|
|
127
|
+
options: __props.options,
|
|
128
|
+
"field-names": _ctx.columnsFieldNames,
|
|
129
|
+
placeholder: "请选择",
|
|
130
|
+
onFinish,
|
|
131
|
+
onClose: _cache[3] || (_cache[3] = ($event) => showPicker.value = false)
|
|
132
|
+
}), null, 16, ["modelValue", "options", "field-names"])
|
|
133
|
+
]),
|
|
134
|
+
_: 1
|
|
135
|
+
}, 8, ["show"])
|
|
136
|
+
], 64);
|
|
137
|
+
};
|
|
138
|
+
}
|
|
139
|
+
};
|
|
140
|
+
export {
|
|
141
|
+
_sfc_main as default
|
|
142
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import _sfc_main from "./fieldCascaderPicker.vue.mjs";
|
|
2
|
+
import install from "../../../utils/install.mjs";
|
|
3
|
+
const MobileFieldCascaderPicker = install.withInstall(
|
|
4
|
+
"MobileFieldCascaderPicker",
|
|
5
|
+
_sfc_main
|
|
6
|
+
);
|
|
7
|
+
export {
|
|
8
|
+
MobileFieldCascaderPicker,
|
|
9
|
+
MobileFieldCascaderPicker as default
|
|
10
|
+
};
|
|
@@ -0,0 +1,110 @@
|
|
|
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
|
+
/* empty css */
|
|
13
|
+
/* empty css */
|
|
14
|
+
/* empty css */
|
|
15
|
+
/* empty css */
|
|
16
|
+
import { ref, computed, watch, createElementBlock, openBlock, Fragment, createVNode, mergeProps, unref, isRef, createSlots, renderList, withCtx, renderSlot } from "vue";
|
|
17
|
+
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
|
+
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";
|
|
21
|
+
const _sfc_main = {
|
|
22
|
+
__name: "FieldDatePicker",
|
|
23
|
+
props: {
|
|
24
|
+
modelValue: {
|
|
25
|
+
type: String,
|
|
26
|
+
default: ""
|
|
27
|
+
},
|
|
28
|
+
textFormat: {
|
|
29
|
+
type: String,
|
|
30
|
+
default: "YYYY-MM-DD"
|
|
31
|
+
},
|
|
32
|
+
valueFormat: {
|
|
33
|
+
type: String,
|
|
34
|
+
default: "YYYYMMDD"
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
emits: ["update:modelValue"],
|
|
38
|
+
setup(__props, { emit: __emit }) {
|
|
39
|
+
const props = __props;
|
|
40
|
+
const fieldTextValue = ref("");
|
|
41
|
+
const showPicker = ref(false);
|
|
42
|
+
const emit = __emit;
|
|
43
|
+
const pickerValue = computed(() => {
|
|
44
|
+
const date = hooks(props.modelValue, props.valueFormat);
|
|
45
|
+
const value = [date.year(), date.month() + 1, date.date()];
|
|
46
|
+
return value;
|
|
47
|
+
});
|
|
48
|
+
watch(
|
|
49
|
+
() => props.modelValue,
|
|
50
|
+
(value) => {
|
|
51
|
+
fieldTextValue.value = hooks(value, props.valueFormat).format(
|
|
52
|
+
props.textFormat
|
|
53
|
+
);
|
|
54
|
+
},
|
|
55
|
+
{ immediate: true }
|
|
56
|
+
);
|
|
57
|
+
const onConfirm = ({ selectedValues, selectedOptions, selectedIndexes }) => {
|
|
58
|
+
const val = hooks(
|
|
59
|
+
`${selectedValues[0]}${selectedValues[1]}${selectedValues[2]}`,
|
|
60
|
+
"YYYYMMDD"
|
|
61
|
+
).format(props.valueFormat);
|
|
62
|
+
emit("update:modelValue", val);
|
|
63
|
+
showPicker.value = false;
|
|
64
|
+
};
|
|
65
|
+
return (_ctx, _cache) => {
|
|
66
|
+
const _component_van_field = Field;
|
|
67
|
+
const _component_van_date_picker = DatePicker;
|
|
68
|
+
const _component_van_popup = Popup;
|
|
69
|
+
return openBlock(), createElementBlock(Fragment, null, [
|
|
70
|
+
createVNode(_component_van_field, mergeProps({
|
|
71
|
+
modelValue: unref(fieldTextValue),
|
|
72
|
+
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => isRef(fieldTextValue) ? fieldTextValue.value = $event : null),
|
|
73
|
+
"is-link": "",
|
|
74
|
+
readonly: "",
|
|
75
|
+
name: "picker"
|
|
76
|
+
}, _ctx.$attrs, {
|
|
77
|
+
onClick: _cache[1] || (_cache[1] = ($event) => showPicker.value = true)
|
|
78
|
+
}), createSlots({ _: 2 }, [
|
|
79
|
+
renderList(_ctx.$slots, (item, key) => {
|
|
80
|
+
return {
|
|
81
|
+
name: key,
|
|
82
|
+
fn: withCtx(() => [
|
|
83
|
+
renderSlot(_ctx.$slots, key)
|
|
84
|
+
])
|
|
85
|
+
};
|
|
86
|
+
})
|
|
87
|
+
]), 1040, ["modelValue"]),
|
|
88
|
+
createVNode(_component_van_popup, {
|
|
89
|
+
show: unref(showPicker),
|
|
90
|
+
"onUpdate:show": _cache[4] || (_cache[4] = ($event) => isRef(showPicker) ? showPicker.value = $event : null),
|
|
91
|
+
"destroy-on-close": "",
|
|
92
|
+
position: "bottom"
|
|
93
|
+
}, {
|
|
94
|
+
default: withCtx(() => [
|
|
95
|
+
createVNode(_component_van_date_picker, mergeProps(_ctx.$attrs, {
|
|
96
|
+
modelValue: unref(pickerValue),
|
|
97
|
+
"onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => isRef(pickerValue) ? pickerValue.value = $event : null),
|
|
98
|
+
onConfirm,
|
|
99
|
+
onCancel: _cache[3] || (_cache[3] = ($event) => showPicker.value = false)
|
|
100
|
+
}), null, 16, ["modelValue"])
|
|
101
|
+
]),
|
|
102
|
+
_: 1
|
|
103
|
+
}, 8, ["show"])
|
|
104
|
+
], 64);
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
};
|
|
108
|
+
export {
|
|
109
|
+
_sfc_main as default
|
|
110
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import _sfc_main from "./FieldDatePicker.vue.mjs";
|
|
2
|
+
import install from "../../../utils/install.mjs";
|
|
3
|
+
const MobileFieldDatePicker = install.withInstall(
|
|
4
|
+
"MobileFieldDatePicker",
|
|
5
|
+
_sfc_main
|
|
6
|
+
);
|
|
7
|
+
export {
|
|
8
|
+
MobileFieldDatePicker,
|
|
9
|
+
MobileFieldDatePicker as default
|
|
10
|
+
};
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
/* empty css */
|
|
14
14
|
/* empty css */
|
|
15
15
|
/* empty css */
|
|
16
|
-
import { computed,
|
|
16
|
+
import { ref, computed, watch, createElementBlock, openBlock, Fragment, createVNode, mergeProps, unref, isRef, createSlots, renderList, withCtx, renderSlot } from "vue";
|
|
17
17
|
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
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
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";
|
|
@@ -32,29 +32,37 @@ const _sfc_main = {
|
|
|
32
32
|
}
|
|
33
33
|
},
|
|
34
34
|
modelValue: {
|
|
35
|
-
type:
|
|
36
|
-
default:
|
|
35
|
+
type: String,
|
|
36
|
+
default: ""
|
|
37
37
|
}
|
|
38
38
|
},
|
|
39
|
-
emits: ["update:modelValue"
|
|
39
|
+
emits: ["update:modelValue"],
|
|
40
40
|
setup(__props, { emit: __emit }) {
|
|
41
41
|
const props = __props;
|
|
42
|
+
const fieldTextValue = ref("");
|
|
43
|
+
const showPicker = ref(false);
|
|
42
44
|
const emit = __emit;
|
|
43
|
-
const
|
|
45
|
+
const pickerValue = computed({
|
|
44
46
|
get: () => {
|
|
45
|
-
|
|
46
|
-
return value;
|
|
47
|
+
const value = props.modelValue;
|
|
48
|
+
return [value];
|
|
47
49
|
},
|
|
48
50
|
set: (val) => {
|
|
49
51
|
emit("update:modelValue", val);
|
|
50
52
|
}
|
|
51
53
|
});
|
|
52
|
-
|
|
53
|
-
|
|
54
|
+
watch(
|
|
55
|
+
() => props.modelValue,
|
|
56
|
+
(value) => {
|
|
57
|
+
const optionItem = props.columns.find(
|
|
58
|
+
(item) => item[props.columnsFieldNames.value] == value
|
|
59
|
+
);
|
|
60
|
+
fieldTextValue.value = optionItem == null ? void 0 : optionItem[props.columnsFieldNames.text];
|
|
61
|
+
},
|
|
62
|
+
{ immediate: true }
|
|
63
|
+
);
|
|
54
64
|
const onConfirm = ({ selectedValues, selectedOptions }) => {
|
|
55
|
-
|
|
56
|
-
fieldValue.value = (_a = selectedOptions[0]) == null ? void 0 : _a.text;
|
|
57
|
-
pickerValue.value = selectedValues;
|
|
65
|
+
pickerValue.value = selectedValues[0];
|
|
58
66
|
showPicker.value = false;
|
|
59
67
|
};
|
|
60
68
|
return (_ctx, _cache) => {
|
|
@@ -63,8 +71,8 @@ const _sfc_main = {
|
|
|
63
71
|
const _component_van_popup = Popup;
|
|
64
72
|
return openBlock(), createElementBlock(Fragment, null, [
|
|
65
73
|
createVNode(_component_van_field, mergeProps({
|
|
66
|
-
modelValue: unref(
|
|
67
|
-
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => isRef(
|
|
74
|
+
modelValue: unref(fieldTextValue),
|
|
75
|
+
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => isRef(fieldTextValue) ? fieldTextValue.value = $event : null),
|
|
68
76
|
"is-link": "",
|
|
69
77
|
readonly: "",
|
|
70
78
|
name: "picker"
|
|
@@ -87,13 +95,13 @@ const _sfc_main = {
|
|
|
87
95
|
position: "bottom"
|
|
88
96
|
}, {
|
|
89
97
|
default: withCtx(() => [
|
|
90
|
-
createVNode(_component_van_picker, {
|
|
98
|
+
createVNode(_component_van_picker, mergeProps(_ctx.$attrs, {
|
|
91
99
|
columns: __props.columns,
|
|
92
100
|
"columns-field-names": __props.columnsFieldNames,
|
|
93
101
|
"model-value": unref(pickerValue),
|
|
94
102
|
onConfirm,
|
|
95
103
|
onCancel: _cache[2] || (_cache[2] = ($event) => showPicker.value = false)
|
|
96
|
-
}, null,
|
|
104
|
+
}), null, 16, ["columns", "columns-field-names", "model-value"])
|
|
97
105
|
]),
|
|
98
106
|
_: 1
|
|
99
107
|
}, 8, ["show"])
|