@fecp/mobile 1.0.24 → 1.0.26

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.
Files changed (21) hide show
  1. package/es/mobile.css +6 -0
  2. package/es/packages/mobile/src/components/form/field/Field.vue.mjs +6 -2
  3. package/es/packages/mobile/src/components/form/fieldCalendarPicker/FieldCalendarPicker.vue.mjs +22 -7
  4. package/es/packages/mobile/src/components/form/fieldCascaderPicker/fieldCascaderPicker.vue.mjs +27 -9
  5. package/es/packages/mobile/src/components/form/fieldCheckbox/FieldCheckbox.vue.mjs +14 -3
  6. package/es/packages/mobile/src/components/form/fieldDatePicker/FieldDatePicker.vue.mjs +73 -26
  7. package/es/packages/mobile/src/components/form/fieldPicker/FieldPicker.vue.mjs +23 -8
  8. package/es/packages/mobile/src/components/form/fieldRadio/FieldRadio.vue.mjs +0 -1
  9. package/es/packages/mobile/src/components/form/fieldTimePicker/FieldTimePicker.vue.mjs +72 -24
  10. package/es/packages/mobile/src/utils/dateUtil.mjs +54 -0
  11. package/lib/mobile.css +6 -0
  12. package/lib/packages/mobile/src/components/form/field/Field.vue.js +5 -1
  13. package/lib/packages/mobile/src/components/form/fieldCalendarPicker/FieldCalendarPicker.vue.js +21 -6
  14. package/lib/packages/mobile/src/components/form/fieldCascaderPicker/fieldCascaderPicker.vue.js +26 -8
  15. package/lib/packages/mobile/src/components/form/fieldCheckbox/FieldCheckbox.vue.js +13 -2
  16. package/lib/packages/mobile/src/components/form/fieldDatePicker/FieldDatePicker.vue.js +72 -25
  17. package/lib/packages/mobile/src/components/form/fieldPicker/FieldPicker.vue.js +22 -7
  18. package/lib/packages/mobile/src/components/form/fieldRadio/FieldRadio.vue.js +0 -1
  19. package/lib/packages/mobile/src/components/form/fieldTimePicker/FieldTimePicker.vue.js +71 -23
  20. package/lib/packages/mobile/src/utils/dateUtil.js +54 -0
  21. package/package.json +1 -1
@@ -16,6 +16,7 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
16
16
  const vue = require("vue");
17
17
  const index = require("../field/index.js");
18
18
  const index$2 = require("../../../../../../node_modules/.pnpm/vant@4.9.17_vue@3.5.13_typescript@5.7.3_/node_modules/vant/es/picker/index.js");
19
+ const index$3 = require("../../../../../../node_modules/.pnpm/vant@4.9.17_vue@3.5.13_typescript@5.7.3_/node_modules/vant/es/icon/index.js");
19
20
  const index$1 = require("../../../../../../node_modules/.pnpm/vant@4.9.17_vue@3.5.13_typescript@5.7.3_/node_modules/vant/es/popup/index.js");
20
21
  const _sfc_main = {
21
22
  __name: "FieldPicker",
@@ -57,6 +58,7 @@ const _sfc_main = {
57
58
  () => props.modelValue,
58
59
  (value) => {
59
60
  if (!value) {
61
+ fieldTextValue.value = "";
60
62
  return;
61
63
  }
62
64
  const optionItem = props.pickerOptions.find(
@@ -71,19 +73,20 @@ const _sfc_main = {
71
73
  showPicker.value = false;
72
74
  };
73
75
  return (_ctx, _cache) => {
76
+ const _component_van_icon = index$3.Icon;
74
77
  const _component_van_picker = index$2.Picker;
75
78
  const _component_van_popup = index$1.Popup;
76
79
  return vue.openBlock(), vue.createBlock(vue.unref(index.MobileField), vue.mergeProps(_ctx.$attrs, {
77
80
  modelValue: vue.unref(fieldTextValue),
78
- "onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => vue.isRef(fieldTextValue) ? fieldTextValue.value = $event : null),
81
+ "onUpdate:modelValue": _cache[3] || (_cache[3] = ($event) => vue.isRef(fieldTextValue) ? fieldTextValue.value = $event : null),
79
82
  "is-link": "",
80
83
  readonly: "",
81
- onClick: _cache[3] || (_cache[3] = ($event) => showPicker.value = true)
82
- }), {
84
+ onClick: _cache[4] || (_cache[4] = ($event) => showPicker.value = true)
85
+ }), vue.createSlots({
83
86
  default: vue.withCtx(() => [
84
87
  vue.createVNode(_component_van_popup, {
85
88
  show: vue.unref(showPicker),
86
- "onUpdate:show": _cache[1] || (_cache[1] = ($event) => vue.isRef(showPicker) ? showPicker.value = $event : null),
89
+ "onUpdate:show": _cache[2] || (_cache[2] = ($event) => vue.isRef(showPicker) ? showPicker.value = $event : null),
87
90
  "destroy-on-close": "",
88
91
  position: "bottom"
89
92
  }, {
@@ -94,14 +97,26 @@ const _sfc_main = {
94
97
  "model-value": vue.unref(pickerValue),
95
98
  readonly: false,
96
99
  onConfirm,
97
- onCancel: _cache[0] || (_cache[0] = ($event) => showPicker.value = false)
100
+ onCancel: _cache[1] || (_cache[1] = ($event) => showPicker.value = false)
98
101
  }), null, 16, ["columns", "columns-field-names", "model-value"])
99
102
  ]),
100
103
  _: 1
101
104
  }, 8, ["show"])
102
105
  ]),
103
- _: 1
104
- }, 16, ["modelValue"]);
106
+ _: 2
107
+ }, [
108
+ vue.unref(fieldTextValue) ? {
109
+ name: "right-icon",
110
+ fn: vue.withCtx(() => [
111
+ vue.createVNode(_component_van_icon, {
112
+ name: "clear",
113
+ class: "custom-close-icon",
114
+ onClick: _cache[0] || (_cache[0] = vue.withModifiers(($event) => pickerValue.value = null, ["stop"]))
115
+ })
116
+ ]),
117
+ key: "0"
118
+ } : void 0
119
+ ]), 1040, ["modelValue"]);
105
120
  };
106
121
  }
107
122
  };
@@ -6,7 +6,6 @@ const index$1 = require("../radioGroup/index.js");
6
6
  const _sfc_main = {
7
7
  __name: "FieldRadio",
8
8
  setup(__props) {
9
- debugger;
10
9
  return (_ctx, _cache) => {
11
10
  return vue.openBlock(), vue.createBlock(vue.unref(index.MobileField), vue.normalizeProps(vue.guardReactiveProps(_ctx.$attrs)), {
12
11
  input: vue.withCtx(() => [
@@ -16,8 +16,10 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
16
16
  const vue = require("vue");
17
17
  const index = require("../field/index.js");
18
18
  const moment = require("../../../../../../node_modules/.pnpm/moment@2.30.1/node_modules/moment/dist/moment.js");
19
+ const dateUtil = require("../../../utils/dateUtil.js");
19
20
  const index$2 = require("../../../../../../node_modules/.pnpm/vant@4.9.17_vue@3.5.13_typescript@5.7.3_/node_modules/vant/es/time-picker/index.js");
20
21
  const index$1 = require("../../../../../../node_modules/.pnpm/vant@4.9.17_vue@3.5.13_typescript@5.7.3_/node_modules/vant/es/popup/index.js");
22
+ const index$3 = require("../../../../../../node_modules/.pnpm/vant@4.9.17_vue@3.5.13_typescript@5.7.3_/node_modules/vant/es/icon/index.js");
21
23
  const _sfc_main = {
22
24
  __name: "FieldTimePicker",
23
25
  props: {
@@ -25,13 +27,18 @@ const _sfc_main = {
25
27
  type: String,
26
28
  default: ""
27
29
  },
28
- textFormat: {
30
+ // textFormat: {
31
+ // type: String,
32
+ // default: "HH:mm:ss",
33
+ // },
34
+ // valueFormat: {
35
+ // type: String,
36
+ // default: "HH:mm:ss",
37
+ // },
38
+ timeTextFormat: {
39
+ //0:HH:mm:ss;1: HH时mm分ss秒
29
40
  type: String,
30
- default: "HH:mm:ss"
31
- },
32
- valueFormat: {
33
- type: String,
34
- default: "HH:mm:ss"
41
+ default: "0"
35
42
  },
36
43
  timeColumnsType: {
37
44
  type: String,
@@ -47,27 +54,54 @@ const _sfc_main = {
47
54
  const fieldTextValue = vue.ref("");
48
55
  const showPicker = vue.ref(false);
49
56
  const emit = __emit;
57
+ let textFormat = dateUtil.parseTimeFormatter(
58
+ props.timeTextFormat,
59
+ props.timeColumnsType
60
+ );
61
+ let valueFormat = dateUtil.parseTimeFormatter("0", props.timeColumnsType);
50
62
  const pickerValue = vue.computed(() => {
63
+ let date;
51
64
  if (!props.modelValue) {
52
- const date2 = moment.default();
53
- return [date2.hours(), date2.minutes(), date2.seconds()];
65
+ date = moment.default();
66
+ } else {
67
+ date = moment.default(props.modelValue, props.valueFormat);
68
+ }
69
+ const hours = date.hours();
70
+ const minutes = date.minutes();
71
+ const seconds = date.seconds();
72
+ let value = [];
73
+ const columnsTypeArr = props.timeColumnsType.split(",");
74
+ if (columnsTypeArr.length == 1) {
75
+ value = [hours];
76
+ } else if (columnsTypeArr.length == 2) {
77
+ value = [hours, minutes];
78
+ } else if (columnsTypeArr.length == 3) {
79
+ value = [hours, minutes, seconds];
54
80
  }
55
- const date = moment.default(props.modelValue, props.valueFormat);
56
- const value = [date.hours(), date.minutes(), date.seconds()];
57
81
  return value;
58
82
  });
59
83
  const columnsType = vue.computed(() => {
60
- return props.timeColumnsType.join(",");
84
+ return props.timeColumnsType.split(",");
61
85
  });
86
+ const formatter = (type, option) => {
87
+ console.log(type);
88
+ if (type === "hour") {
89
+ option.text += "时";
90
+ } else if (type === "minute") {
91
+ option.text += "分";
92
+ } else if (type === "second") {
93
+ option.text += "秒";
94
+ }
95
+ return option;
96
+ };
62
97
  vue.watch(
63
98
  () => props.modelValue,
64
99
  (value) => {
65
100
  if (!value) {
101
+ fieldTextValue.value = "";
66
102
  return;
67
103
  }
68
- fieldTextValue.value = moment.default(value, props.valueFormat).format(
69
- props.textFormat
70
- );
104
+ fieldTextValue.value = moment.default(value, valueFormat).format(textFormat);
71
105
  },
72
106
  { immediate: true }
73
107
  );
@@ -75,42 +109,56 @@ const _sfc_main = {
75
109
  const val = moment.default(
76
110
  `${selectedValues[0]}${selectedValues[1]}${selectedValues[2]}`,
77
111
  "HH:mm:ss"
78
- ).format(props.valueFormat);
112
+ ).format(valueFormat);
79
113
  emit("update:modelValue", val);
80
114
  showPicker.value = false;
81
115
  };
82
116
  return (_ctx, _cache) => {
117
+ const _component_van_icon = index$3.Icon;
83
118
  const _component_van_time_picker = index$2.TimePicker;
84
119
  const _component_van_popup = index$1.Popup;
85
120
  return vue.openBlock(), vue.createBlock(vue.unref(index.MobileField), vue.mergeProps(_ctx.$attrs, {
86
121
  modelValue: vue.unref(fieldTextValue),
87
- "onUpdate:modelValue": _cache[3] || (_cache[3] = ($event) => vue.isRef(fieldTextValue) ? fieldTextValue.value = $event : null),
122
+ "onUpdate:modelValue": _cache[4] || (_cache[4] = ($event) => vue.isRef(fieldTextValue) ? fieldTextValue.value = $event : null),
88
123
  "is-link": "",
89
124
  readonly: "",
90
- onClick: _cache[4] || (_cache[4] = ($event) => showPicker.value = true)
91
- }), {
125
+ onClick: _cache[5] || (_cache[5] = ($event) => showPicker.value = true)
126
+ }), vue.createSlots({
92
127
  default: vue.withCtx(() => [
93
128
  vue.createVNode(_component_van_popup, {
94
129
  show: vue.unref(showPicker),
95
- "onUpdate:show": _cache[2] || (_cache[2] = ($event) => vue.isRef(showPicker) ? showPicker.value = $event : null),
130
+ "onUpdate:show": _cache[3] || (_cache[3] = ($event) => vue.isRef(showPicker) ? showPicker.value = $event : null),
96
131
  "destroy-on-close": "",
97
132
  position: "bottom"
98
133
  }, {
99
134
  default: vue.withCtx(() => [
100
135
  vue.createVNode(_component_van_time_picker, vue.mergeProps(_ctx.$attrs, {
101
136
  modelValue: vue.unref(pickerValue),
102
- "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => vue.isRef(pickerValue) ? pickerValue.value = $event : null),
137
+ "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => vue.isRef(pickerValue) ? pickerValue.value = $event : null),
103
138
  readonly: false,
104
139
  columnsType: vue.unref(columnsType),
140
+ formatter,
105
141
  onConfirm,
106
- onCancel: _cache[1] || (_cache[1] = ($event) => showPicker.value = false)
142
+ onCancel: _cache[2] || (_cache[2] = ($event) => showPicker.value = false)
107
143
  }), null, 16, ["modelValue", "columnsType"])
108
144
  ]),
109
145
  _: 1
110
146
  }, 8, ["show"])
111
147
  ]),
112
- _: 1
113
- }, 16, ["modelValue"]);
148
+ _: 2
149
+ }, [
150
+ vue.unref(fieldTextValue) ? {
151
+ name: "right-icon",
152
+ fn: vue.withCtx(() => [
153
+ vue.createVNode(_component_van_icon, {
154
+ name: "clear",
155
+ class: "custom-close-icon",
156
+ onClick: _cache[0] || (_cache[0] = vue.withModifiers(($event) => emit("update:modelValue", null), ["stop"]))
157
+ })
158
+ ]),
159
+ key: "0"
160
+ } : void 0
161
+ ]), 1040, ["modelValue"]);
114
162
  };
115
163
  }
116
164
  };
@@ -0,0 +1,54 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const parseDateFormatter = (textFormatType, columnsType) => {
4
+ const columnsTypeArr = columnsType.split(",");
5
+ if (columnsTypeArr.length == 1) {
6
+ if (textFormatType == "3") {
7
+ return "YYYY年";
8
+ }
9
+ return "YYYY";
10
+ } else if (columnsTypeArr.length == 2) {
11
+ if (textFormatType == "0") {
12
+ return "YYYYMM";
13
+ } else if (textFormatType == "1") {
14
+ return "YYYY-MM";
15
+ } else if (textFormatType == "2") {
16
+ return "YYYY/MM";
17
+ } else if (textFormatType == "3") {
18
+ return "YYYY年MM月";
19
+ }
20
+ } else if (columnsTypeArr.length == 3) {
21
+ if (textFormatType == "0") {
22
+ return "YYYYMMDD";
23
+ } else if (textFormatType == "1") {
24
+ return "YYYY-MM-DD";
25
+ } else if (textFormatType == "2") {
26
+ return "YYYY/MM/DD";
27
+ } else if (textFormatType == "3") {
28
+ return "YYYY年MM月DD日";
29
+ }
30
+ }
31
+ };
32
+ const parseTimeFormatter = (textFormatType, columnsType) => {
33
+ const columnsTypeArr = columnsType.split(",");
34
+ if (columnsTypeArr.length == 1) {
35
+ if (textFormatType == "1") {
36
+ return "HH时";
37
+ }
38
+ return "HH";
39
+ } else if (columnsTypeArr.length == 2) {
40
+ if (textFormatType == "0") {
41
+ return "HH:mm";
42
+ } else if (textFormatType == "1") {
43
+ return "HH时mm分";
44
+ }
45
+ } else if (columnsTypeArr.length == 3) {
46
+ if (textFormatType == "0") {
47
+ return "HH:mm:ss";
48
+ } else if (textFormatType == "1") {
49
+ return "HH时mm分ss秒";
50
+ }
51
+ }
52
+ };
53
+ exports.parseDateFormatter = parseDateFormatter;
54
+ exports.parseTimeFormatter = parseTimeFormatter;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fecp/mobile",
3
- "version": "1.0.24",
3
+ "version": "1.0.26",
4
4
  "main": "lib/packages/mobile/index.js",
5
5
  "module": "es/packages/mobile/index.mjs",
6
6
  "files": [