@fecp/mobile 1.1.8 → 1.1.9

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.
@@ -23,6 +23,10 @@ const _sfc_main = {
23
23
  type: Boolean,
24
24
  default: false
25
25
  },
26
+ readonly: {
27
+ type: Boolean,
28
+ default: false
29
+ },
26
30
  clickable: {
27
31
  type: Boolean,
28
32
  default: false
@@ -54,12 +58,16 @@ const _sfc_main = {
54
58
  const textValue = computed(() => {
55
59
  if (props.fieldType == "text") {
56
60
  unit.value = getUnit(props.dataFormatter);
57
- return textFormatter(props.modelValue, props.dataFormatter);
61
+ if (props.readonly) {
62
+ return textFormatter(props.modelValue, props.dataFormatter);
63
+ } else {
64
+ return textFormatter4Input(props.modelValue, props.dataFormatter);
65
+ }
58
66
  }
59
67
  return props.modelValue;
60
68
  });
61
69
  const compClickable = computed(() => {
62
- if (props.disabled) {
70
+ if (props.disabled || props.readonly) {
63
71
  return false;
64
72
  }
65
73
  return true;
@@ -85,6 +93,7 @@ const _sfc_main = {
85
93
  modelValue: unref(textValue),
86
94
  "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => isRef(textValue) ? textValue.value = $event : null),
87
95
  disabled: __props.disabled,
96
+ readonly: __props.readonly,
88
97
  clearable: "",
89
98
  clickable: unref(compClickable),
90
99
  "clear-trigger": "always",
@@ -108,7 +117,7 @@ const _sfc_main = {
108
117
  ]),
109
118
  key: "0"
110
119
  } : void 0
111
- ]), 1040, ["modelValue", "disabled", "clickable"]),
120
+ ]), 1040, ["modelValue", "disabled", "readonly", "clickable"]),
112
121
  withDirectives(createElementVNode("input", {
113
122
  type: "hidden",
114
123
  "onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => isRef(compValue) ? compValue.value = $event : null)
@@ -89,6 +89,9 @@ const moneyFormatter = (value, dataFormatter) => {
89
89
  return XEUtils.commafy(moneyValue, { digits: 2 });
90
90
  };
91
91
  const textFormatter4Input = (value, dataFormatter) => {
92
+ if (!value) {
93
+ return value;
94
+ }
92
95
  switch (dataFormatter) {
93
96
  case "money(yuan)":
94
97
  case "money(wan)":
@@ -107,6 +110,9 @@ const textFormatter4Input = (value, dataFormatter) => {
107
110
  }
108
111
  };
109
112
  const reverseTextFormatter = (value, dataFormatter) => {
113
+ if (!value) {
114
+ return value;
115
+ }
110
116
  switch (dataFormatter) {
111
117
  case "money(yuan)":
112
118
  case "money(wan)":
@@ -25,6 +25,10 @@ const _sfc_main = {
25
25
  type: Boolean,
26
26
  default: false
27
27
  },
28
+ readonly: {
29
+ type: Boolean,
30
+ default: false
31
+ },
28
32
  clickable: {
29
33
  type: Boolean,
30
34
  default: false
@@ -56,12 +60,16 @@ const _sfc_main = {
56
60
  const textValue = vue.computed(() => {
57
61
  if (props.fieldType == "text") {
58
62
  unit.value = formatterUtil.getUnit(props.dataFormatter);
59
- return formatterUtil.textFormatter(props.modelValue, props.dataFormatter);
63
+ if (props.readonly) {
64
+ return formatterUtil.textFormatter(props.modelValue, props.dataFormatter);
65
+ } else {
66
+ return formatterUtil.textFormatter4Input(props.modelValue, props.dataFormatter);
67
+ }
60
68
  }
61
69
  return props.modelValue;
62
70
  });
63
71
  const compClickable = vue.computed(() => {
64
- if (props.disabled) {
72
+ if (props.disabled || props.readonly) {
65
73
  return false;
66
74
  }
67
75
  return true;
@@ -87,6 +95,7 @@ const _sfc_main = {
87
95
  modelValue: vue.unref(textValue),
88
96
  "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => vue.isRef(textValue) ? textValue.value = $event : null),
89
97
  disabled: __props.disabled,
98
+ readonly: __props.readonly,
90
99
  clearable: "",
91
100
  clickable: vue.unref(compClickable),
92
101
  "clear-trigger": "always",
@@ -110,7 +119,7 @@ const _sfc_main = {
110
119
  ]),
111
120
  key: "0"
112
121
  } : void 0
113
- ]), 1040, ["modelValue", "disabled", "clickable"]),
122
+ ]), 1040, ["modelValue", "disabled", "readonly", "clickable"]),
114
123
  vue.withDirectives(vue.createElementVNode("input", {
115
124
  type: "hidden",
116
125
  "onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => vue.isRef(compValue) ? compValue.value = $event : null)
@@ -91,6 +91,9 @@ const moneyFormatter = (value, dataFormatter) => {
91
91
  return index.default.commafy(moneyValue, { digits: 2 });
92
92
  };
93
93
  const textFormatter4Input = (value, dataFormatter) => {
94
+ if (!value) {
95
+ return value;
96
+ }
94
97
  switch (dataFormatter) {
95
98
  case "money(yuan)":
96
99
  case "money(wan)":
@@ -109,6 +112,9 @@ const textFormatter4Input = (value, dataFormatter) => {
109
112
  }
110
113
  };
111
114
  const reverseTextFormatter = (value, dataFormatter) => {
115
+ if (!value) {
116
+ return value;
117
+ }
112
118
  switch (dataFormatter) {
113
119
  case "money(yuan)":
114
120
  case "money(wan)":
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fecp/mobile",
3
- "version": "1.1.8",
3
+ "version": "1.1.9",
4
4
  "main": "lib/packages/mobile/index.js",
5
5
  "module": "es/packages/mobile/index.mjs",
6
6
  "files": [