@fecp/mobile 1.0.36 → 1.0.38

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 (29) hide show
  1. package/es/mobile.css +4 -4
  2. package/es/packages/mobile/src/components/dataDisplay/list/List.vue.mjs +6 -3
  3. package/es/packages/mobile/src/components/dataDisplay/table/Table.vue.mjs +41 -6
  4. package/es/packages/mobile/src/components/form/fieldCalendarPicker/FieldCalendarPicker.vue.mjs +8 -4
  5. package/es/packages/mobile/src/components/form/fieldCascaderPicker/fieldCascaderPicker.vue.mjs +8 -4
  6. package/es/packages/mobile/src/components/form/fieldCheckbox/FieldCheckbox.vue.mjs +35 -15
  7. package/es/packages/mobile/src/components/form/fieldDatePicker/FieldDatePicker.vue.mjs +8 -4
  8. package/es/packages/mobile/src/components/form/fieldPicker/FieldPicker.vue.mjs +8 -4
  9. package/es/packages/mobile/src/components/form/fieldRadio/FieldRadio.vue.mjs +54 -5
  10. package/es/packages/mobile/src/components/form/fieldTimePicker/FieldTimePicker.vue.mjs +8 -4
  11. package/es/packages/mobile/src/components/form/form/Form.vue.mjs +16 -0
  12. package/es/packages/mobile/src/components/form/formItem/FormItem.vue.mjs +29 -3
  13. package/es/packages/mobile/src/utils/dateUtil.mjs +30 -0
  14. package/es/packages/mobile/src/utils/formatterUtil.mjs +99 -0
  15. package/lib/mobile.css +4 -4
  16. package/lib/packages/mobile/src/components/dataDisplay/list/List.vue.js +6 -3
  17. package/lib/packages/mobile/src/components/dataDisplay/table/Table.vue.js +40 -5
  18. package/lib/packages/mobile/src/components/form/fieldCalendarPicker/FieldCalendarPicker.vue.js +8 -4
  19. package/lib/packages/mobile/src/components/form/fieldCascaderPicker/fieldCascaderPicker.vue.js +8 -4
  20. package/lib/packages/mobile/src/components/form/fieldCheckbox/FieldCheckbox.vue.js +34 -14
  21. package/lib/packages/mobile/src/components/form/fieldDatePicker/FieldDatePicker.vue.js +8 -4
  22. package/lib/packages/mobile/src/components/form/fieldPicker/FieldPicker.vue.js +8 -4
  23. package/lib/packages/mobile/src/components/form/fieldRadio/FieldRadio.vue.js +53 -4
  24. package/lib/packages/mobile/src/components/form/fieldTimePicker/FieldTimePicker.vue.js +8 -4
  25. package/lib/packages/mobile/src/components/form/form/Form.vue.js +16 -0
  26. package/lib/packages/mobile/src/components/form/formItem/FormItem.vue.js +29 -3
  27. package/lib/packages/mobile/src/utils/dateUtil.js +30 -0
  28. package/lib/packages/mobile/src/utils/formatterUtil.js +99 -0
  29. package/package.json +1 -1
@@ -116,9 +116,13 @@ const _sfc_main = {
116
116
  return openBlock(), createBlock(unref(MobileField), mergeProps(_ctx.$attrs, {
117
117
  modelValue: unref(fieldTextValue),
118
118
  "onUpdate:modelValue": _cache[4] || (_cache[4] = ($event) => isRef(fieldTextValue) ? fieldTextValue.value = $event : null),
119
- "is-link": "",
119
+ isLink: __props.readonly ? false : true,
120
120
  readonly: "",
121
- onClick: _cache[5] || (_cache[5] = ($event) => showPicker.value = true)
121
+ onClick: _cache[5] || (_cache[5] = () => {
122
+ if (!__props.readonly) {
123
+ showPicker.value = true;
124
+ }
125
+ })
122
126
  }), createSlots({
123
127
  default: withCtx(() => [
124
128
  createVNode(_component_van_popup, {
@@ -143,7 +147,7 @@ const _sfc_main = {
143
147
  ]),
144
148
  _: 2
145
149
  }, [
146
- unref(fieldTextValue) ? {
150
+ !__props.readonly && unref(fieldTextValue) ? {
147
151
  name: "right-icon",
148
152
  fn: withCtx(() => [
149
153
  createVNode(_component_van_icon, {
@@ -154,7 +158,7 @@ const _sfc_main = {
154
158
  ]),
155
159
  key: "0"
156
160
  } : void 0
157
- ]), 1040, ["modelValue"]);
161
+ ]), 1040, ["modelValue", "isLink"]);
158
162
  };
159
163
  }
160
164
  };
@@ -77,9 +77,13 @@ const _sfc_main = {
77
77
  return openBlock(), createBlock(unref(MobileField), mergeProps(_ctx.$attrs, {
78
78
  modelValue: unref(fieldTextValue),
79
79
  "onUpdate:modelValue": _cache[3] || (_cache[3] = ($event) => isRef(fieldTextValue) ? fieldTextValue.value = $event : null),
80
- "is-link": "",
80
+ isLink: __props.readonly ? false : true,
81
81
  readonly: "",
82
- onClick: _cache[4] || (_cache[4] = ($event) => showPicker.value = true)
82
+ onClick: _cache[4] || (_cache[4] = () => {
83
+ if (!__props.readonly) {
84
+ showPicker.value = true;
85
+ }
86
+ })
83
87
  }), createSlots({
84
88
  default: withCtx(() => [
85
89
  createVNode(_component_van_popup, {
@@ -103,7 +107,7 @@ const _sfc_main = {
103
107
  ]),
104
108
  _: 2
105
109
  }, [
106
- unref(fieldTextValue) ? {
110
+ !__props.readonly && unref(fieldTextValue) ? {
107
111
  name: "right-icon",
108
112
  fn: withCtx(() => [
109
113
  createVNode(_component_van_icon, {
@@ -114,7 +118,7 @@ const _sfc_main = {
114
118
  ]),
115
119
  key: "0"
116
120
  } : void 0
117
- ]), 1040, ["modelValue"]);
121
+ ]), 1040, ["modelValue", "isLink"]);
118
122
  };
119
123
  }
120
124
  };
@@ -1,16 +1,65 @@
1
- import { createBlock, openBlock, unref, normalizeProps, guardReactiveProps, withCtx, createVNode } from "vue";
1
+ import { computed, createBlock, openBlock, unref, mergeProps, isRef, withCtx, createElementBlock, toDisplayString } from "vue";
2
2
  import { MobileField } from "../field/index.mjs";
3
3
  import { MobileRadioGroup } from "../radioGroup/index.mjs";
4
+ const _hoisted_1 = { key: 1 };
4
5
  const _sfc_main = {
5
6
  __name: "FieldRadio",
6
- setup(__props) {
7
+ props: {
8
+ modelValue: {
9
+ type: String,
10
+ default: ""
11
+ },
12
+ options: {
13
+ type: Array,
14
+ default: []
15
+ },
16
+ fieldNames: {
17
+ type: Object,
18
+ default: {
19
+ text: "text",
20
+ value: "value",
21
+ disabled: "disabled"
22
+ }
23
+ },
24
+ readonly: {
25
+ type: Boolean,
26
+ default: false
27
+ }
28
+ },
29
+ emits: ["update:modelValue"],
30
+ setup(__props, { emit: __emit }) {
31
+ const props = __props;
32
+ const emit = __emit;
33
+ const compValue = computed({
34
+ get: () => {
35
+ return props.modelValue;
36
+ },
37
+ set: (val) => {
38
+ emit("update:modelValue", val);
39
+ }
40
+ });
41
+ const fieldTextValue = computed(() => {
42
+ const selectedOption = props.options.find(
43
+ (option) => option[props.fieldNames.value] === compValue.value
44
+ );
45
+ return selectedOption ? selectedOption[props.fieldNames.text] : "";
46
+ });
7
47
  return (_ctx, _cache) => {
8
- return openBlock(), createBlock(unref(MobileField), normalizeProps(guardReactiveProps(_ctx.$attrs)), {
48
+ return openBlock(), createBlock(unref(MobileField), mergeProps(_ctx.$attrs, {
49
+ readonly: __props.readonly,
50
+ modelValue: unref(fieldTextValue),
51
+ "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => isRef(fieldTextValue) ? fieldTextValue.value = $event : null)
52
+ }), {
9
53
  input: withCtx(() => [
10
- createVNode(unref(MobileRadioGroup), normalizeProps(guardReactiveProps(_ctx.$attrs)), null, 16)
54
+ !__props.readonly ? (openBlock(), createBlock(unref(MobileRadioGroup), mergeProps({ key: 0 }, _ctx.$attrs, {
55
+ options: __props.options,
56
+ fieldNames: __props.fieldNames,
57
+ modelValue: unref(compValue),
58
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => isRef(compValue) ? compValue.value = $event : null)
59
+ }), null, 16, ["options", "fieldNames", "modelValue"])) : (openBlock(), createElementBlock("span", _hoisted_1, toDisplayString(unref(fieldTextValue)), 1))
11
60
  ]),
12
61
  _: 1
13
- }, 16);
62
+ }, 16, ["readonly", "modelValue"]);
14
63
  };
15
64
  }
16
65
  };
@@ -118,9 +118,13 @@ const _sfc_main = {
118
118
  return openBlock(), createBlock(unref(MobileField), mergeProps(_ctx.$attrs, {
119
119
  modelValue: unref(fieldTextValue),
120
120
  "onUpdate:modelValue": _cache[4] || (_cache[4] = ($event) => isRef(fieldTextValue) ? fieldTextValue.value = $event : null),
121
- "is-link": "",
121
+ isLink: __props.readonly ? false : true,
122
122
  readonly: "",
123
- onClick: _cache[5] || (_cache[5] = ($event) => showPicker.value = true)
123
+ onClick: _cache[5] || (_cache[5] = () => {
124
+ if (!__props.readonly) {
125
+ showPicker.value = true;
126
+ }
127
+ })
124
128
  }), createSlots({
125
129
  default: withCtx(() => [
126
130
  createVNode(_component_van_popup, {
@@ -145,7 +149,7 @@ const _sfc_main = {
145
149
  ]),
146
150
  _: 2
147
151
  }, [
148
- unref(fieldTextValue) ? {
152
+ !__props.readonly && unref(fieldTextValue) ? {
149
153
  name: "right-icon",
150
154
  fn: withCtx(() => [
151
155
  createVNode(_component_van_icon, {
@@ -156,7 +160,7 @@ const _sfc_main = {
156
160
  ]),
157
161
  key: "0"
158
162
  } : void 0
159
- ]), 1040, ["modelValue"]);
163
+ ]), 1040, ["modelValue", "isLink"]);
160
164
  };
161
165
  }
162
166
  };
@@ -10,6 +10,14 @@ const _sfc_main = {
10
10
  type: Object,
11
11
  default: {}
12
12
  },
13
+ disabled: {
14
+ type: Boolean,
15
+ default: false
16
+ },
17
+ readonly: {
18
+ type: Boolean,
19
+ default: false
20
+ },
13
21
  isCard: {
14
22
  //卡片风格
15
23
  type: Boolean,
@@ -29,6 +37,14 @@ const _sfc_main = {
29
37
  }
30
38
  });
31
39
  provide("formData", formData);
40
+ provide(
41
+ "formDisabled",
42
+ computed(() => props.disabled)
43
+ );
44
+ provide(
45
+ "formReadonly",
46
+ computed(() => props.readonly)
47
+ );
32
48
  return (_ctx, _cache) => {
33
49
  const _component_van_cell_group = CellGroup;
34
50
  const _component_van_form = Form;
@@ -6,7 +6,16 @@ const _sfc_main = {
6
6
  fieldType: {
7
7
  type: String,
8
8
  default: "text"
9
- }
9
+ },
10
+ disabled: {
11
+ type: Boolean,
12
+ default: false
13
+ },
14
+ readonly: {
15
+ type: Boolean,
16
+ default: false
17
+ },
18
+ placeholder: String
10
19
  },
11
20
  emits: ["update:modelValue"],
12
21
  setup(__props, { emit: __emit }) {
@@ -32,6 +41,20 @@ const _sfc_main = {
32
41
  }
33
42
  });
34
43
  const formData = inject("formData");
44
+ const formDisabled = inject("formDisabled");
45
+ const formReadonly = inject("formReadonly");
46
+ const formItemDisabled = computed(() => {
47
+ if (formDisabled.value) {
48
+ return formDisabled.value;
49
+ }
50
+ return props.disabled;
51
+ });
52
+ const formItemReadonly = computed(() => {
53
+ if (formReadonly.value) {
54
+ return formReadonly.value;
55
+ }
56
+ return props.readonly;
57
+ });
35
58
  const attrs = useAttrs();
36
59
  const emit = __emit;
37
60
  const compValue = computed({
@@ -58,8 +81,11 @@ const _sfc_main = {
58
81
  modelValue: unref(compValue),
59
82
  "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => isRef(compValue) ? compValue.value = $event : null),
60
83
  rules: unref(rules),
61
- required: "auto"
62
- }), null, 16, ["modelValue", "rules"]);
84
+ required: "auto",
85
+ disabled: unref(formItemDisabled),
86
+ readonly: unref(formItemReadonly),
87
+ placeholder: unref(formItemReadonly) ? "" : __props.placeholder
88
+ }), null, 16, ["modelValue", "rules", "disabled", "readonly", "placeholder"]);
63
89
  };
64
90
  }
65
91
  };
@@ -25,6 +25,36 @@ const parseDateFormatter = (textFormatType, columnsType) => {
25
25
  } else if (textFormatType == "3") {
26
26
  return "YYYY年MM月DD日";
27
27
  }
28
+ } else if (columnsTypeArr.length == 4) {
29
+ if (textFormatType == "0") {
30
+ return "YYYYMMDD HH";
31
+ } else if (textFormatType == "1") {
32
+ return "YYYY-MM-DD HH";
33
+ } else if (textFormatType == "2") {
34
+ return "YYYY/MM/DD HH";
35
+ } else if (textFormatType == "3") {
36
+ return "YYYY年MM月DD日 HH";
37
+ }
38
+ } else if (columnsTypeArr.length == 5) {
39
+ if (textFormatType == "0") {
40
+ return "YYYYMMDD HH:mm";
41
+ } else if (textFormatType == "1") {
42
+ return "YYYY-MM-DD HH:mm";
43
+ } else if (textFormatType == "2") {
44
+ return "YYYY/MM/DD HH:mm";
45
+ } else if (textFormatType == "3") {
46
+ return "YYYY年MM月DD日 HH:mm";
47
+ }
48
+ } else if (columnsTypeArr.length == 6) {
49
+ if (textFormatType == "0") {
50
+ return "YYYYMMDD HH:mm:ss";
51
+ } else if (textFormatType == "1") {
52
+ return "YYYY-MM-DD HH:mm:ss";
53
+ } else if (textFormatType == "2") {
54
+ return "YYYY/MM/DD HH:mm:ss";
55
+ } else if (textFormatType == "3") {
56
+ return "YYYY年MM月DD日 HH时mm分ss秒";
57
+ }
28
58
  }
29
59
  };
30
60
  const parseTimeFormatter = (textFormatType, columnsType) => {
@@ -0,0 +1,99 @@
1
+ import hooks from "../../../../node_modules/.pnpm/moment@2.30.1/node_modules/moment/dist/moment.mjs";
2
+ import { parseDateFormatter } from "./dateUtil.mjs";
3
+ import XEUtils from "../../../../_virtual/index.mjs";
4
+ const selectFormatter = (value, options) => {
5
+ const item = options.find((item2) => item2.value === value);
6
+ return item ? item.label : value;
7
+ };
8
+ const multipleFormatter = (value, options) => {
9
+ const values = value == null ? void 0 : value.split("|");
10
+ const labels = [];
11
+ values == null ? void 0 : values.forEach((val) => {
12
+ const option = options.find((opt) => opt.value == val);
13
+ if (option) {
14
+ labels.push(option.label);
15
+ }
16
+ });
17
+ return labels.join(", ");
18
+ };
19
+ const cascadeFormatter = (value, options) => {
20
+ const values = value == null ? void 0 : value.split("/");
21
+ const labels = [];
22
+ let currentOptions = options;
23
+ for (let i = 0; i < (values == null ? void 0 : values.length); i++) {
24
+ const currentValue = values[i];
25
+ const option = currentOptions.find((opt) => opt.value === currentValue);
26
+ if (option) {
27
+ labels.push(option.label);
28
+ if (option.children && i < values.length - 1) {
29
+ currentOptions = option.children;
30
+ }
31
+ } else {
32
+ break;
33
+ }
34
+ }
35
+ return labels.join("/");
36
+ };
37
+ const dateFormatter = (value, dateType, formatterType) => {
38
+ let dateValue;
39
+ if (!isNaN(value) && (value + "").length == 13) {
40
+ dateValue = hooks(Number(value));
41
+ } else {
42
+ dateValue = hooks(value, "YYYYMMDD");
43
+ }
44
+ const textFormat = parseDateFormatter(formatterType, dateType);
45
+ return dateValue.format(textFormat);
46
+ };
47
+ const textFormatter = (value, dataFormatter) => {
48
+ switch (dataFormatter) {
49
+ case "money(yuan)":
50
+ case "money(wan)":
51
+ case "money(yi)":
52
+ return moneyFormatter(value, dataFormatter);
53
+ case "bankCard":
54
+ return XEUtils.commafy(XEUtils.toValueString(value), {
55
+ spaceNumber: 4,
56
+ separator: " "
57
+ });
58
+ case "percent":
59
+ value = XEUtils.multiply(XEUtils.toNumber(value), 100);
60
+ value = XEUtils.toFixed(value, 2);
61
+ return value;
62
+ case "thousand":
63
+ value = XEUtils.multiply(XEUtils.toNumber(value), 1e3);
64
+ value = XEUtils.toFixed(value, 2);
65
+ return value;
66
+ case "tenThousand":
67
+ value = XEUtils.multiply(XEUtils.toNumber(value), 1e4);
68
+ value = XEUtils.toFixed(value, 2);
69
+ return value;
70
+ default:
71
+ return value;
72
+ }
73
+ };
74
+ const moneyFormatter = (value, dataFormatter) => {
75
+ let moneyValue;
76
+ switch (dataFormatter) {
77
+ case "money(yuan)":
78
+ moneyValue = XEUtils.toNumber(value);
79
+ break;
80
+ case "money(wan)":
81
+ moneyValue = XEUtils.divide(XEUtils.toNumber(value), 1e4);
82
+ break;
83
+ case "money(yi)":
84
+ moneyValue = XEUtils.divide(XEUtils.toNumber(value), 1e8);
85
+ break;
86
+ default:
87
+ moneyValue = XEUtils.toNumber(value);
88
+ break;
89
+ }
90
+ return XEUtils.commafy(moneyValue, { digits: 2 });
91
+ };
92
+ export {
93
+ cascadeFormatter,
94
+ dateFormatter,
95
+ moneyFormatter,
96
+ multipleFormatter,
97
+ selectFormatter,
98
+ textFormatter
99
+ };