@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
package/es/mobile.css CHANGED
@@ -28,6 +28,12 @@
28
28
  .van-checkbox-group--horizontal{display:flex;flex-wrap:wrap}
29
29
  :root,:host{--van-checkbox-size: 20px;--van-checkbox-border-color: var(--van-gray-5);--van-checkbox-duration: var(--van-duration-fast);--van-checkbox-label-margin: var(--van-padding-xs);--van-checkbox-label-color: var(--van-text-color);--van-checkbox-checked-icon-color: var(--van-primary-color);--van-checkbox-disabled-icon-color: var(--van-gray-5);--van-checkbox-disabled-label-color: var(--van-text-color-3);--van-checkbox-disabled-background: var(--van-border-color)}.van-checkbox{display:flex;align-items:center;overflow:hidden;cursor:pointer;-webkit-user-select:none;user-select:none}.van-checkbox--disabled{cursor:not-allowed}.van-checkbox--label-disabled{cursor:default}.van-checkbox--horizontal{margin-right:var(--van-padding-sm)}.van-checkbox__icon{flex:none;height:1em;font-size:var(--van-checkbox-size);line-height:1em;cursor:pointer}.van-checkbox__icon .van-icon{display:block;box-sizing:border-box;width:1.25em;height:1.25em;color:transparent;font-size:.8em;line-height:1.25;text-align:center;border:1px solid var(--van-checkbox-border-color);transition-duration:var(--van-checkbox-duration);transition-property:color,border-color,background-color}.van-checkbox__icon--round .van-icon{border-radius:100%}.van-checkbox__icon--indeterminate .van-icon{display:flex;align-items:center;justify-content:center;color:var(--van-white);border-color:var(--van-checkbox-checked-icon-color);background-color:var(--van-checkbox-checked-icon-color)}.van-checkbox__icon--checked .van-icon{color:var(--van-white);background-color:var(--van-checkbox-checked-icon-color);border-color:var(--van-checkbox-checked-icon-color)}.van-checkbox__icon--disabled{cursor:not-allowed}.van-checkbox__icon--disabled .van-icon{background-color:var(--van-checkbox-disabled-background);border-color:var(--van-checkbox-disabled-icon-color)}.van-checkbox__icon--disabled.van-checkbox__icon--checked .van-icon{color:var(--van-checkbox-disabled-icon-color)}.van-checkbox__label{margin-left:var(--van-checkbox-label-margin);color:var(--van-checkbox-label-color);line-height:var(--van-checkbox-size)}.van-checkbox__label--left{margin:0 var(--van-checkbox-label-margin) 0 0}.van-checkbox__label--disabled{color:var(--van-checkbox-disabled-label-color)}
30
30
  :root,:host{--van-field-label-width: 6.2em;--van-field-label-color: var(--van-text-color);--van-field-label-margin-right: var(--van-padding-sm);--van-field-input-text-color: var(--van-text-color);--van-field-input-error-text-color: var(--van-danger-color);--van-field-input-disabled-text-color: var(--van-text-color-3);--van-field-placeholder-text-color: var(--van-text-color-3);--van-field-icon-size: 18px;--van-field-clear-icon-size: 18px;--van-field-clear-icon-color: var(--van-gray-5);--van-field-right-icon-color: var(--van-gray-6);--van-field-error-message-color: var(--van-danger-color);--van-field-error-message-font-size: 12px;--van-field-text-area-min-height: 60px;--van-field-word-limit-color: var(--van-gray-7);--van-field-word-limit-font-size: var(--van-font-size-sm);--van-field-word-limit-line-height: 16px;--van-field-disabled-text-color: var(--van-text-color-3);--van-field-required-mark-color: var(--van-red)}.van-field{flex-wrap:wrap}.van-field__label{flex:none;box-sizing:border-box;width:var(--van-field-label-width);margin-right:var(--van-field-label-margin-right);color:var(--van-field-label-color);text-align:left;word-wrap:break-word}.van-field__label--center{text-align:center}.van-field__label--right{text-align:right}.van-field__label--top{display:flex;width:100%;text-align:left;margin-bottom:var(--van-padding-base);overflow-wrap:break-word}.van-field__label--required:before{margin-right:2px;color:var(--van-field-required-mark-color);content:"*"}.van-field--disabled .van-field__label{color:var(--van-field-disabled-text-color)}.van-field__value{overflow:visible}.van-field__body{display:flex;align-items:center}.van-field__control{display:block;box-sizing:border-box;width:100%;min-width:0;margin:0;padding:0;color:var(--van-field-input-text-color);line-height:inherit;text-align:left;background-color:transparent;border:0;resize:none;-webkit-user-select:auto;user-select:auto}.van-field__control::-webkit-input-placeholder{color:var(--van-field-placeholder-text-color)}.van-field__control::placeholder{color:var(--van-field-placeholder-text-color)}.van-field__control:read-only{cursor:default}.van-field__control:disabled{color:var(--van-field-input-disabled-text-color);cursor:not-allowed;opacity:1;-webkit-text-fill-color:var(--van-field-input-disabled-text-color)}.van-field__control--center{justify-content:center;text-align:center}.van-field__control--right{justify-content:flex-end;text-align:right}.van-field__control--custom{display:flex;align-items:center;min-height:var(--van-cell-line-height)}.van-field__control--error::-webkit-input-placeholder{color:var(--van-field-input-error-text-color);-webkit-text-fill-color:currentColor}.van-field__control--error,.van-field__control--error::placeholder{color:var(--van-field-input-error-text-color);-webkit-text-fill-color:currentColor}.van-field__control--min-height{min-height:var(--van-field-text-area-min-height)}.van-field__control[type=date],.van-field__control[type=time],.van-field__control[type=datetime-local]{min-height:var(--van-cell-line-height)}.van-field__control[type=search]{-webkit-appearance:none}.van-field__clear,.van-field__icon,.van-field__button,.van-field__right-icon{flex-shrink:0}.van-field__clear,.van-field__right-icon{margin-right:calc(var(--van-padding-xs) * -1);padding:0 var(--van-padding-xs);line-height:inherit}.van-field__clear{color:var(--van-field-clear-icon-color);font-size:var(--van-field-clear-icon-size);cursor:pointer}.van-field__left-icon .van-icon,.van-field__right-icon .van-icon{display:block;font-size:var(--van-field-icon-size);line-height:inherit}.van-field__left-icon{margin-right:var(--van-padding-base)}.van-field__right-icon{color:var(--van-field-right-icon-color)}.van-field__button{padding-left:var(--van-padding-xs)}.van-field__error-message{color:var(--van-field-error-message-color);font-size:var(--van-field-error-message-font-size);text-align:left}.van-field__error-message--center{text-align:center}.van-field__error-message--right{text-align:right}.van-field__word-limit{margin-top:var(--van-padding-base);color:var(--van-field-word-limit-color);font-size:var(--van-field-word-limit-font-size);line-height:var(--van-field-word-limit-line-height);text-align:right}
31
+
32
+ .custom-close-icon {
33
+ color: var(--van-field-clear-icon-color);
34
+ font-size: var(--van-field-clear-icon-size);
35
+ cursor: pointer;
36
+ }
31
37
  :root,:host{--van-sticky-z-index: 99}.van-sticky--fixed{position:fixed;z-index:var(--van-sticky-z-index)}
32
38
  :root,:host{--van-tab-text-color: var(--van-gray-7);--van-tab-active-text-color: var(--van-text-color);--van-tab-disabled-text-color: var(--van-text-color-3);--van-tab-font-size: var(--van-font-size-md);--van-tab-line-height: var(--van-line-height-md);--van-tabs-default-color: var(--van-primary-color);--van-tabs-line-height: 44px;--van-tabs-card-height: 30px;--van-tabs-nav-background: var(--van-background-2);--van-tabs-bottom-bar-width: 40px;--van-tabs-bottom-bar-height: 3px;--van-tabs-bottom-bar-color: var(--van-primary-color)}.van-tab{position:relative;display:flex;flex:1;align-items:center;justify-content:center;box-sizing:border-box;padding:0 var(--van-padding-base);color:var(--van-tab-text-color);font-size:var(--van-tab-font-size);line-height:var(--van-tab-line-height);cursor:pointer}.van-tab--active{color:var(--van-tab-active-text-color);font-weight:var(--van-font-bold)}.van-tab--disabled{color:var(--van-tab-disabled-text-color);cursor:not-allowed}.van-tab--grow{flex:1 0 auto;padding:0 var(--van-padding-sm)}.van-tab--shrink{flex:none;padding:0 var(--van-padding-xs)}.van-tab--card{color:var(--van-tabs-default-color);border-right:var(--van-border-width) solid var(--van-tabs-default-color)}.van-tab--card:last-child{border-right:none}.van-tab--card.van-tab--active{color:var(--van-white);background-color:var(--van-tabs-default-color)}.van-tab--card.van-tab--disabled{color:var(--van-tab-disabled-text-color)}.van-tab__text--ellipsis{display:-webkit-box;overflow:hidden;-webkit-line-clamp:1;-webkit-box-orient:vertical}.van-tabs{position:relative}.van-tabs__wrap{overflow:hidden}.van-tabs__wrap--page-top{position:fixed}.van-tabs__wrap--content-bottom{top:auto;bottom:0}.van-tabs__nav{position:relative;display:flex;background:var(--van-tabs-nav-background);-webkit-user-select:none;user-select:none}.van-tabs__nav--complete{overflow-x:auto;overflow-y:hidden;-webkit-overflow-scrolling:touch}.van-tabs__nav--complete::-webkit-scrollbar{display:none}.van-tabs__nav--line{box-sizing:content-box;height:100%;padding-bottom:15px}.van-tabs__nav--line.van-tabs__nav--shrink,.van-tabs__nav--line.van-tabs__nav--complete{padding-right:var(--van-padding-xs);padding-left:var(--van-padding-xs)}.van-tabs__nav--card{box-sizing:border-box;height:var(--van-tabs-card-height);margin:0 var(--van-padding-md);border:var(--van-border-width) solid var(--van-tabs-default-color);border-radius:var(--van-radius-sm)}.van-tabs__nav--card.van-tabs__nav--shrink{display:inline-flex}.van-tabs__line{position:absolute;bottom:15px;left:0;z-index:1;width:var(--van-tabs-bottom-bar-width);height:var(--van-tabs-bottom-bar-height);background:var(--van-tabs-bottom-bar-color);border-radius:var(--van-tabs-bottom-bar-height)}.van-tabs__track{position:relative;display:flex;width:100%;height:100%;will-change:left}.van-tabs__content--animated{overflow:hidden}.van-tabs--line .van-tabs__wrap{height:var(--van-tabs-line-height)}.van-tabs--card>.van-tabs__wrap{height:var(--van-tabs-card-height)}
33
39
  .van-tab__panel,.van-tab__panel-wrapper{flex-shrink:0;box-sizing:border-box;width:100%}.van-tab__panel-wrapper--inactive{height:0;overflow:visible}
@@ -3,14 +3,18 @@
3
3
  /* empty css */
4
4
  /* empty css */
5
5
  /* empty css */
6
- import { createElementBlock, openBlock, Fragment, createVNode, renderSlot, normalizeProps, guardReactiveProps, createSlots, renderList, withCtx } from "vue";
6
+ import { createElementBlock, openBlock, Fragment, createVNode, renderSlot, mergeProps, createSlots, renderList, withCtx } from "vue";
7
+ /* empty css */
7
8
  import _export_sfc from "../../../../../../_virtual/_plugin-vue_export-helper.mjs";
8
9
  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";
9
10
  const _sfc_main = {};
10
11
  function _sfc_render(_ctx, _cache) {
11
12
  const _component_van_field = Field;
12
13
  return openBlock(), createElementBlock(Fragment, null, [
13
- createVNode(_component_van_field, normalizeProps(guardReactiveProps(_ctx.$attrs)), createSlots({ _: 2 }, [
14
+ createVNode(_component_van_field, mergeProps(_ctx.$attrs, {
15
+ clearable: "",
16
+ "clear-trigger": "always"
17
+ }), createSlots({ _: 2 }, [
14
18
  renderList(_ctx.$slots, (item, key) => {
15
19
  return {
16
20
  name: key,
@@ -14,10 +14,11 @@
14
14
  /* empty css */
15
15
  /* empty css */
16
16
  /* empty css */
17
- import { ref, computed, watch, createBlock, openBlock, unref, mergeProps, isRef, withCtx, createVNode } from "vue";
17
+ import { ref, computed, watch, createBlock, openBlock, unref, mergeProps, isRef, createSlots, withCtx, createVNode, withModifiers } from "vue";
18
18
  import { MobileField } from "../field/index.mjs";
19
19
  import hooks from "../../../../../../node_modules/.pnpm/moment@2.30.1/node_modules/moment/dist/moment.mjs";
20
20
  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";
21
+ 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";
21
22
  const _sfc_main = {
22
23
  __name: "FieldCalendarPicker",
23
24
  props: {
@@ -87,6 +88,7 @@ const _sfc_main = {
87
88
  () => props.modelValue,
88
89
  (value) => {
89
90
  if (!value) {
91
+ fieldTextValue.value = "";
90
92
  return;
91
93
  }
92
94
  if (props.calendarType == "single") {
@@ -123,18 +125,19 @@ const _sfc_main = {
123
125
  showCalendar.value = false;
124
126
  };
125
127
  return (_ctx, _cache) => {
128
+ const _component_van_icon = Icon;
126
129
  const _component_van_calendar = Calendar;
127
130
  return openBlock(), createBlock(unref(MobileField), mergeProps(_ctx.$attrs, {
128
131
  modelValue: unref(fieldTextValue),
129
- "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => isRef(fieldTextValue) ? fieldTextValue.value = $event : null),
132
+ "onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => isRef(fieldTextValue) ? fieldTextValue.value = $event : null),
130
133
  "is-link": "",
131
134
  readonly: "",
132
- onClick: _cache[2] || (_cache[2] = ($event) => showCalendar.value = true)
133
- }), {
135
+ onClick: _cache[3] || (_cache[3] = ($event) => showCalendar.value = true)
136
+ }), createSlots({
134
137
  default: withCtx(() => [
135
138
  createVNode(_component_van_calendar, mergeProps(_ctx.$attrs, {
136
139
  show: unref(showCalendar),
137
- "onUpdate:show": _cache[0] || (_cache[0] = ($event) => isRef(showCalendar) ? showCalendar.value = $event : null),
140
+ "onUpdate:show": _cache[1] || (_cache[1] = ($event) => isRef(showCalendar) ? showCalendar.value = $event : null),
138
141
  "default-date": unref(defaultDate),
139
142
  title: __props.title,
140
143
  type: __props.calendarType,
@@ -143,8 +146,20 @@ const _sfc_main = {
143
146
  onConfirm
144
147
  }), null, 16, ["show", "default-date", "title", "type"])
145
148
  ]),
146
- _: 1
147
- }, 16, ["modelValue"]);
149
+ _: 2
150
+ }, [
151
+ unref(fieldTextValue) ? {
152
+ name: "right-icon",
153
+ fn: withCtx(() => [
154
+ createVNode(_component_van_icon, {
155
+ name: "clear",
156
+ class: "custom-close-icon",
157
+ onClick: _cache[0] || (_cache[0] = withModifiers(($event) => defaultDate.value = null, ["stop"]))
158
+ })
159
+ ]),
160
+ key: "0"
161
+ } : void 0
162
+ ]), 1040, ["modelValue"]);
148
163
  };
149
164
  }
150
165
  };
@@ -9,10 +9,11 @@
9
9
  /* empty css */
10
10
  /* empty css */
11
11
  /* empty css */
12
- import { ref, computed, watch, createBlock, openBlock, unref, mergeProps, isRef, withCtx, createVNode } from "vue";
12
+ import { ref, computed, watch, createBlock, openBlock, unref, mergeProps, isRef, createSlots, withCtx, createVNode, withModifiers } from "vue";
13
13
  import { MobileField } from "../field/index.mjs";
14
14
  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";
15
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 { Icon } from "../../../../../../node_modules/.pnpm/vant@4.9.17_vue@3.5.13_typescript@5.7.3_/node_modules/vant/es/icon/index.mjs";
16
17
  const _sfc_main = {
17
18
  __name: "fieldCascaderPicker",
18
19
  props: {
@@ -79,6 +80,10 @@ const _sfc_main = {
79
80
  watch(
80
81
  () => props.modelValue,
81
82
  (value) => {
83
+ if (!value) {
84
+ fieldTextValue.value = "";
85
+ return;
86
+ }
82
87
  fieldTextValue.value = getDisplayValue(
83
88
  props.treeOptions,
84
89
  props.treeOptionsFieldNames,
@@ -92,38 +97,51 @@ const _sfc_main = {
92
97
  showPicker.value = false;
93
98
  };
94
99
  return (_ctx, _cache) => {
100
+ const _component_van_icon = Icon;
95
101
  const _component_van_cascader = Cascader;
96
102
  const _component_van_popup = Popup;
97
103
  return openBlock(), createBlock(unref(MobileField), mergeProps(_ctx.$attrs, {
98
104
  modelValue: unref(fieldTextValue),
99
- "onUpdate:modelValue": _cache[3] || (_cache[3] = ($event) => isRef(fieldTextValue) ? fieldTextValue.value = $event : null),
105
+ "onUpdate:modelValue": _cache[4] || (_cache[4] = ($event) => isRef(fieldTextValue) ? fieldTextValue.value = $event : null),
100
106
  "is-link": "",
101
107
  readonly: "",
102
- onClick: _cache[4] || (_cache[4] = ($event) => showPicker.value = true)
103
- }), {
108
+ onClick: _cache[5] || (_cache[5] = ($event) => showPicker.value = true)
109
+ }), createSlots({
104
110
  default: withCtx(() => [
105
111
  createVNode(_component_van_popup, {
106
112
  show: unref(showPicker),
107
- "onUpdate:show": _cache[2] || (_cache[2] = ($event) => isRef(showPicker) ? showPicker.value = $event : null),
113
+ "onUpdate:show": _cache[3] || (_cache[3] = ($event) => isRef(showPicker) ? showPicker.value = $event : null),
108
114
  "destroy-on-close": "",
109
115
  position: "bottom"
110
116
  }, {
111
117
  default: withCtx(() => [
112
118
  createVNode(_component_van_cascader, mergeProps(_ctx.$attrs, {
113
119
  modelValue: unref(pickerValue),
114
- "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => isRef(pickerValue) ? pickerValue.value = $event : null),
120
+ "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => isRef(pickerValue) ? pickerValue.value = $event : null),
115
121
  options: __props.treeOptions,
116
122
  "field-names": __props.treeOptionsFieldNames,
117
123
  placeholder: "请选择",
118
124
  onFinish,
119
- onClose: _cache[1] || (_cache[1] = ($event) => showPicker.value = false)
125
+ onClose: _cache[2] || (_cache[2] = ($event) => showPicker.value = false)
120
126
  }), null, 16, ["modelValue", "options", "field-names"])
121
127
  ]),
122
128
  _: 1
123
129
  }, 8, ["show"])
124
130
  ]),
125
- _: 1
126
- }, 16, ["modelValue"]);
131
+ _: 2
132
+ }, [
133
+ unref(fieldTextValue) ? {
134
+ name: "right-icon",
135
+ fn: withCtx(() => [
136
+ createVNode(_component_van_icon, {
137
+ name: "clear",
138
+ class: "custom-close-icon",
139
+ onClick: _cache[0] || (_cache[0] = withModifiers(($event) => pickerValue.value = null, ["stop"]))
140
+ })
141
+ ]),
142
+ key: "0"
143
+ } : void 0
144
+ ]), 1040, ["modelValue"]);
127
145
  };
128
146
  }
129
147
  };
@@ -1,4 +1,4 @@
1
- import { computed, createBlock, openBlock, unref, mergeProps, withCtx, createVNode, isRef } from "vue";
1
+ import { computed, createBlock, openBlock, unref, mergeProps, isRef, withCtx, createVNode } from "vue";
2
2
  import { MobileField } from "../field/index.mjs";
3
3
  import { MobileCheckboxGroup } from "../checkboxGroup/index.mjs";
4
4
  const _sfc_main = {
@@ -29,8 +29,19 @@ const _sfc_main = {
29
29
  emit("update:modelValue", val.join(","));
30
30
  }
31
31
  });
32
+ const inputValue = computed({
33
+ get: () => {
34
+ return compValue.value.join(",");
35
+ },
36
+ set: (val) => {
37
+ emit("update:modelValue", val);
38
+ }
39
+ });
32
40
  return (_ctx, _cache) => {
33
- return openBlock(), createBlock(unref(MobileField), mergeProps(_ctx.$attrs, { modelValue: "" }), {
41
+ return openBlock(), createBlock(unref(MobileField), mergeProps(_ctx.$attrs, {
42
+ modelValue: unref(inputValue),
43
+ "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => isRef(inputValue) ? inputValue.value = $event : null)
44
+ }), {
34
45
  input: withCtx(() => [
35
46
  createVNode(unref(MobileCheckboxGroup), mergeProps(_ctx.$attrs, {
36
47
  modelValue: unref(compValue),
@@ -38,7 +49,7 @@ const _sfc_main = {
38
49
  }), null, 16, ["modelValue"])
39
50
  ]),
40
51
  _: 1
41
- }, 16);
52
+ }, 16, ["modelValue"]);
42
53
  };
43
54
  }
44
55
  };
@@ -11,11 +11,13 @@
11
11
  /* empty css */
12
12
  /* empty css */
13
13
  /* empty css */
14
- import { ref, computed, watch, createBlock, openBlock, unref, mergeProps, isRef, withCtx, createVNode } from "vue";
14
+ import { ref, computed, watch, createBlock, openBlock, unref, mergeProps, isRef, createSlots, withCtx, createVNode, withModifiers } from "vue";
15
15
  import { MobileField } from "../field/index.mjs";
16
16
  import hooks from "../../../../../../node_modules/.pnpm/moment@2.30.1/node_modules/moment/dist/moment.mjs";
17
+ import { parseDateFormatter } from "../../../utils/dateUtil.mjs";
17
18
  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
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 { Icon } from "../../../../../../node_modules/.pnpm/vant@4.9.17_vue@3.5.13_typescript@5.7.3_/node_modules/vant/es/icon/index.mjs";
19
21
  const _sfc_main = {
20
22
  __name: "FieldDatePicker",
21
23
  props: {
@@ -23,18 +25,23 @@ const _sfc_main = {
23
25
  type: String,
24
26
  default: ""
25
27
  },
26
- textFormat: {
27
- type: String,
28
- default: "YYYY-MM-DD"
29
- },
30
- valueFormat: {
31
- type: String,
32
- default: "YYYYMMDD"
33
- },
28
+ // textFormat: {
29
+ // type: String,
30
+ // default: "YYYY-MM-DD",
31
+ // },
32
+ // valueFormat: {
33
+ // type: String,
34
+ // default: "YYYYMMDD",
35
+ // },
34
36
  dateColumnsType: {
35
37
  type: String,
36
38
  default: "year,month,day"
37
39
  },
40
+ dateTextFormat: {
41
+ //0:YYYYMMDD;1: YYYY-MM-DD;2:YYYY/MM/DD;3:YYYY年MM月DD日
42
+ type: String,
43
+ default: "1"
44
+ },
38
45
  readonly: false,
39
46
  "is-link": false
40
47
  },
@@ -44,27 +51,53 @@ const _sfc_main = {
44
51
  const fieldTextValue = ref("");
45
52
  const showPicker = ref(false);
46
53
  const emit = __emit;
54
+ let textFormat = parseDateFormatter(
55
+ props.dateTextFormat,
56
+ props.dateColumnsType
57
+ );
58
+ let valueFormat = parseDateFormatter("0", props.dateColumnsType);
47
59
  const pickerValue = computed(() => {
60
+ let date;
48
61
  if (!props.modelValue) {
49
- const date2 = hooks();
50
- return [date2.year(), date2.month() + 1, date2.date()];
62
+ date = hooks();
63
+ } else {
64
+ date = hooks(props.modelValue, valueFormat);
65
+ }
66
+ const year = date.year();
67
+ const month = date.month() + 1;
68
+ const day = date.date();
69
+ let value = [];
70
+ const columnsTypeArr = props.dateColumnsType.split(",");
71
+ if (columnsTypeArr.length == 1) {
72
+ value = [year];
73
+ } else if (columnsTypeArr.length == 2) {
74
+ value = [year, month];
75
+ } else if (columnsTypeArr.length == 3) {
76
+ value = [year, month, day];
51
77
  }
52
- const date = hooks(props.modelValue, props.valueFormat);
53
- const value = [date.year(), date.month() + 1, date.date()];
54
78
  return value;
55
79
  });
56
80
  const columnsType = computed(() => {
57
- return props.dateColumnsType.join(",");
81
+ return props.dateColumnsType.split(",");
58
82
  });
83
+ const formatter = (type, option) => {
84
+ if (type === "year") {
85
+ option.text += "年";
86
+ } else if (type === "month") {
87
+ option.text += "月";
88
+ } else if (type === "day") {
89
+ option.text += "日";
90
+ }
91
+ return option;
92
+ };
59
93
  watch(
60
94
  () => props.modelValue,
61
95
  (value) => {
62
96
  if (!value) {
97
+ fieldTextValue.value = "";
63
98
  return;
64
99
  }
65
- fieldTextValue.value = hooks(value, props.valueFormat).format(
66
- props.textFormat
67
- );
100
+ fieldTextValue.value = hooks(value, valueFormat).format(textFormat);
68
101
  },
69
102
  { immediate: true }
70
103
  );
@@ -72,42 +105,56 @@ const _sfc_main = {
72
105
  const val = hooks(
73
106
  `${selectedValues[0]}${selectedValues[1]}${selectedValues[2]}`,
74
107
  "YYYYMMDD"
75
- ).format(props.valueFormat);
108
+ ).format(valueFormat);
76
109
  emit("update:modelValue", val);
77
110
  showPicker.value = false;
78
111
  };
79
112
  return (_ctx, _cache) => {
113
+ const _component_van_icon = Icon;
80
114
  const _component_van_date_picker = DatePicker;
81
115
  const _component_van_popup = Popup;
82
116
  return openBlock(), createBlock(unref(MobileField), mergeProps(_ctx.$attrs, {
83
117
  modelValue: unref(fieldTextValue),
84
- "onUpdate:modelValue": _cache[3] || (_cache[3] = ($event) => isRef(fieldTextValue) ? fieldTextValue.value = $event : null),
118
+ "onUpdate:modelValue": _cache[4] || (_cache[4] = ($event) => isRef(fieldTextValue) ? fieldTextValue.value = $event : null),
85
119
  "is-link": "",
86
120
  readonly: "",
87
- onClick: _cache[4] || (_cache[4] = ($event) => showPicker.value = true)
88
- }), {
121
+ onClick: _cache[5] || (_cache[5] = ($event) => showPicker.value = true)
122
+ }), createSlots({
89
123
  default: withCtx(() => [
90
124
  createVNode(_component_van_popup, {
91
125
  show: unref(showPicker),
92
- "onUpdate:show": _cache[2] || (_cache[2] = ($event) => isRef(showPicker) ? showPicker.value = $event : null),
126
+ "onUpdate:show": _cache[3] || (_cache[3] = ($event) => isRef(showPicker) ? showPicker.value = $event : null),
93
127
  "destroy-on-close": "",
94
128
  position: "bottom"
95
129
  }, {
96
130
  default: withCtx(() => [
97
131
  createVNode(_component_van_date_picker, mergeProps(_ctx.$attrs, {
98
132
  modelValue: unref(pickerValue),
99
- "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => isRef(pickerValue) ? pickerValue.value = $event : null),
133
+ "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => isRef(pickerValue) ? pickerValue.value = $event : null),
100
134
  readonly: false,
101
135
  onConfirm,
102
136
  columnsType: unref(columnsType),
103
- onCancel: _cache[1] || (_cache[1] = ($event) => showPicker.value = false)
137
+ formatter,
138
+ onCancel: _cache[2] || (_cache[2] = ($event) => showPicker.value = false)
104
139
  }), null, 16, ["modelValue", "columnsType"])
105
140
  ]),
106
141
  _: 1
107
142
  }, 8, ["show"])
108
143
  ]),
109
- _: 1
110
- }, 16, ["modelValue"]);
144
+ _: 2
145
+ }, [
146
+ unref(fieldTextValue) ? {
147
+ name: "right-icon",
148
+ fn: withCtx(() => [
149
+ createVNode(_component_van_icon, {
150
+ name: "clear",
151
+ class: "custom-close-icon",
152
+ onClick: _cache[0] || (_cache[0] = withModifiers(($event) => emit("update:modelValue", null), ["stop"]))
153
+ })
154
+ ]),
155
+ key: "0"
156
+ } : void 0
157
+ ]), 1040, ["modelValue"]);
111
158
  };
112
159
  }
113
160
  };
@@ -11,9 +11,10 @@
11
11
  /* empty css */
12
12
  /* empty css */
13
13
  /* empty css */
14
- import { ref, computed, watch, createBlock, openBlock, unref, mergeProps, isRef, withCtx, createVNode } from "vue";
14
+ import { ref, computed, watch, createBlock, openBlock, unref, mergeProps, isRef, createSlots, withCtx, createVNode, withModifiers } from "vue";
15
15
  import { MobileField } from "../field/index.mjs";
16
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";
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";
17
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";
18
19
  const _sfc_main = {
19
20
  __name: "FieldPicker",
@@ -55,6 +56,7 @@ const _sfc_main = {
55
56
  () => props.modelValue,
56
57
  (value) => {
57
58
  if (!value) {
59
+ fieldTextValue.value = "";
58
60
  return;
59
61
  }
60
62
  const optionItem = props.pickerOptions.find(
@@ -69,19 +71,20 @@ const _sfc_main = {
69
71
  showPicker.value = false;
70
72
  };
71
73
  return (_ctx, _cache) => {
74
+ const _component_van_icon = Icon;
72
75
  const _component_van_picker = Picker;
73
76
  const _component_van_popup = Popup;
74
77
  return openBlock(), createBlock(unref(MobileField), mergeProps(_ctx.$attrs, {
75
78
  modelValue: unref(fieldTextValue),
76
- "onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => isRef(fieldTextValue) ? fieldTextValue.value = $event : null),
79
+ "onUpdate:modelValue": _cache[3] || (_cache[3] = ($event) => isRef(fieldTextValue) ? fieldTextValue.value = $event : null),
77
80
  "is-link": "",
78
81
  readonly: "",
79
- onClick: _cache[3] || (_cache[3] = ($event) => showPicker.value = true)
80
- }), {
82
+ onClick: _cache[4] || (_cache[4] = ($event) => showPicker.value = true)
83
+ }), createSlots({
81
84
  default: withCtx(() => [
82
85
  createVNode(_component_van_popup, {
83
86
  show: unref(showPicker),
84
- "onUpdate:show": _cache[1] || (_cache[1] = ($event) => isRef(showPicker) ? showPicker.value = $event : null),
87
+ "onUpdate:show": _cache[2] || (_cache[2] = ($event) => isRef(showPicker) ? showPicker.value = $event : null),
85
88
  "destroy-on-close": "",
86
89
  position: "bottom"
87
90
  }, {
@@ -92,14 +95,26 @@ const _sfc_main = {
92
95
  "model-value": unref(pickerValue),
93
96
  readonly: false,
94
97
  onConfirm,
95
- onCancel: _cache[0] || (_cache[0] = ($event) => showPicker.value = false)
98
+ onCancel: _cache[1] || (_cache[1] = ($event) => showPicker.value = false)
96
99
  }), null, 16, ["columns", "columns-field-names", "model-value"])
97
100
  ]),
98
101
  _: 1
99
102
  }, 8, ["show"])
100
103
  ]),
101
- _: 1
102
- }, 16, ["modelValue"]);
104
+ _: 2
105
+ }, [
106
+ unref(fieldTextValue) ? {
107
+ name: "right-icon",
108
+ fn: withCtx(() => [
109
+ createVNode(_component_van_icon, {
110
+ name: "clear",
111
+ class: "custom-close-icon",
112
+ onClick: _cache[0] || (_cache[0] = withModifiers(($event) => pickerValue.value = null, ["stop"]))
113
+ })
114
+ ]),
115
+ key: "0"
116
+ } : void 0
117
+ ]), 1040, ["modelValue"]);
103
118
  };
104
119
  }
105
120
  };
@@ -4,7 +4,6 @@ import { MobileRadioGroup } from "../radioGroup/index.mjs";
4
4
  const _sfc_main = {
5
5
  __name: "FieldRadio",
6
6
  setup(__props) {
7
- debugger;
8
7
  return (_ctx, _cache) => {
9
8
  return openBlock(), createBlock(unref(MobileField), normalizeProps(guardReactiveProps(_ctx.$attrs)), {
10
9
  input: withCtx(() => [