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