@fecp/mobile 1.1.7 → 1.1.8
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.
- package/es/_virtual/less.mjs +2 -0
- package/es/_virtual/less2.mjs +4 -0
- package/es/mobile.css +9 -2
- package/es/node_modules/.pnpm/less@4.2.2/node_modules/less/dist/less.mjs +10504 -0
- package/es/packages/mobile/src/components/feedback/floatingBubble/FloatingBubble.vue.mjs +5 -3
- package/es/packages/mobile/src/components/form/field/Field.vue.mjs +116 -24
- package/es/packages/mobile/src/components/form/field/index.mjs +2 -2
- package/es/packages/mobile/src/components/form/fieldArea/FieldArea.vue.mjs +1 -1
- package/es/packages/mobile/src/components/form/fieldCalendarPicker/FieldCalendarPicker.vue.mjs +1 -1
- package/es/packages/mobile/src/components/form/fieldCascaderPicker/fieldCascaderPicker.vue.mjs +1 -1
- package/es/packages/mobile/src/components/form/fieldDatePicker/FieldDatePicker.vue.mjs +1 -1
- package/es/packages/mobile/src/components/form/fieldDateTimePicker/FieldDateTimePicker.vue.mjs +1 -1
- package/es/packages/mobile/src/components/form/fieldPicker/FieldPicker.vue.mjs +1 -1
- package/es/packages/mobile/src/components/form/fieldTimePicker/FieldTimePicker.vue.mjs +1 -1
- package/es/packages/mobile/src/components/form/form/Form.vue.mjs +8 -4
- package/es/packages/mobile/src/components/form/formItem/FormItem.vue.mjs +2 -1
- package/es/packages/mobile/src/utils/formatterUtil.mjs +84 -5
- package/es/packages/mobile/src/utils/use-cursor.mjs +41 -0
- package/es/packages/mobile/src/utils/use-route.mjs +0 -1
- package/lib/_virtual/less.js +3 -0
- package/lib/_virtual/less2.js +4 -0
- package/lib/mobile.css +9 -2
- package/lib/node_modules/.pnpm/less@4.2.2/node_modules/less/dist/less.js +10504 -0
- package/lib/packages/mobile/src/components/feedback/floatingBubble/FloatingBubble.vue.js +4 -2
- package/lib/packages/mobile/src/components/form/field/Field.vue.js +115 -23
- package/lib/packages/mobile/src/components/form/fieldArea/FieldArea.vue.js +1 -1
- package/lib/packages/mobile/src/components/form/fieldCalendarPicker/FieldCalendarPicker.vue.js +1 -1
- package/lib/packages/mobile/src/components/form/fieldCascaderPicker/fieldCascaderPicker.vue.js +1 -1
- package/lib/packages/mobile/src/components/form/fieldDatePicker/FieldDatePicker.vue.js +1 -1
- package/lib/packages/mobile/src/components/form/fieldDateTimePicker/FieldDateTimePicker.vue.js +1 -1
- package/lib/packages/mobile/src/components/form/fieldPicker/FieldPicker.vue.js +1 -1
- package/lib/packages/mobile/src/components/form/fieldTimePicker/FieldTimePicker.vue.js +1 -1
- package/lib/packages/mobile/src/components/form/form/Form.vue.js +7 -3
- package/lib/packages/mobile/src/components/form/formItem/FormItem.vue.js +2 -1
- package/lib/packages/mobile/src/utils/formatterUtil.js +83 -4
- package/lib/packages/mobile/src/utils/use-cursor.js +41 -0
- package/lib/packages/mobile/src/utils/use-route.js +0 -1
- package/package.json +1 -1
|
@@ -4,6 +4,7 @@ const vue = require("vue");
|
|
|
4
4
|
const FloatingBubble = require("./FloatingBubble.js");
|
|
5
5
|
;/* empty css */
|
|
6
6
|
const useRoute = require("../../../utils/use-route.js");
|
|
7
|
+
require("../../../../../../_virtual/less.js");
|
|
7
8
|
const _sfc_main = {
|
|
8
9
|
__name: "FloatingBubble",
|
|
9
10
|
props: {
|
|
@@ -22,6 +23,7 @@ const _sfc_main = {
|
|
|
22
23
|
setup(__props) {
|
|
23
24
|
const route = useRoute.useRoute();
|
|
24
25
|
const props = __props;
|
|
26
|
+
const dropAxis = vue.ref(props.axis);
|
|
25
27
|
const compMagnetic = vue.computed(() => {
|
|
26
28
|
if (props.axis == "xy") {
|
|
27
29
|
return props.magnetic;
|
|
@@ -30,8 +32,8 @@ const _sfc_main = {
|
|
|
30
32
|
}
|
|
31
33
|
});
|
|
32
34
|
return (_ctx, _cache) => {
|
|
33
|
-
return vue.openBlock(), vue.createBlock(vue.unref(FloatingBubble.default), vue.mergeProps(_ctx.$attrs, {
|
|
34
|
-
axis:
|
|
35
|
+
return vue.openBlock(), vue.createBlock(vue.unref(FloatingBubble.default), vue.mergeProps({ class: "fec-floating-bubble" }, _ctx.$attrs, {
|
|
36
|
+
axis: vue.unref(dropAxis),
|
|
35
37
|
magnetic: compMagnetic.value,
|
|
36
38
|
onClick: vue.unref(route)
|
|
37
39
|
}), vue.createSlots({ _: 2 }, [
|
|
@@ -6,28 +6,120 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
|
|
|
6
6
|
;/* empty css */
|
|
7
7
|
;/* empty css */
|
|
8
8
|
const vue = require("vue");
|
|
9
|
+
require("../../../../../../_virtual/index.js");
|
|
10
|
+
const formatterUtil = require("../../../utils/formatterUtil.js");
|
|
11
|
+
const useCursor = require("../../../utils/use-cursor.js");
|
|
9
12
|
;/* empty css */
|
|
10
|
-
const _pluginVue_exportHelper = require("../../../../../../_virtual/_plugin-vue_export-helper.js");
|
|
11
13
|
const index = require("../../../../../../node_modules/.pnpm/vant@4.9.17_vue@3.5.13_typescript@5.7.3_/node_modules/vant/es/field/index.js");
|
|
12
|
-
const _sfc_main = {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
14
|
+
const _sfc_main = {
|
|
15
|
+
__name: "Field",
|
|
16
|
+
props: {
|
|
17
|
+
modelValue: {
|
|
18
|
+
type: String,
|
|
19
|
+
default: ""
|
|
20
|
+
},
|
|
21
|
+
fieldType: {
|
|
22
|
+
type: String
|
|
23
|
+
},
|
|
24
|
+
disabled: {
|
|
25
|
+
type: Boolean,
|
|
26
|
+
default: false
|
|
27
|
+
},
|
|
28
|
+
clickable: {
|
|
29
|
+
type: Boolean,
|
|
30
|
+
default: false
|
|
31
|
+
},
|
|
32
|
+
dataFormatter: {
|
|
33
|
+
type: String,
|
|
34
|
+
default: ""
|
|
35
|
+
},
|
|
36
|
+
showUnit: {
|
|
37
|
+
type: Boolean,
|
|
38
|
+
default: true
|
|
39
|
+
}
|
|
40
|
+
},
|
|
41
|
+
emits: ["openPicker", "update:modelValue"],
|
|
42
|
+
setup(__props, { emit: __emit }) {
|
|
43
|
+
const props = __props;
|
|
44
|
+
const unit = vue.ref("");
|
|
45
|
+
const fieldInputRef = vue.ref();
|
|
46
|
+
const [recordCursor, setCursor] = useCursor.useCursor();
|
|
47
|
+
const emit = __emit;
|
|
48
|
+
const compValue = vue.computed({
|
|
49
|
+
get: () => {
|
|
50
|
+
return props.modelValue;
|
|
51
|
+
},
|
|
52
|
+
set: (val) => {
|
|
53
|
+
emit("update:modelValue", val);
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
const textValue = vue.computed(() => {
|
|
57
|
+
if (props.fieldType == "text") {
|
|
58
|
+
unit.value = formatterUtil.getUnit(props.dataFormatter);
|
|
59
|
+
return formatterUtil.textFormatter(props.modelValue, props.dataFormatter);
|
|
60
|
+
}
|
|
61
|
+
return props.modelValue;
|
|
62
|
+
});
|
|
63
|
+
const compClickable = vue.computed(() => {
|
|
64
|
+
if (props.disabled) {
|
|
65
|
+
return false;
|
|
66
|
+
}
|
|
67
|
+
return true;
|
|
68
|
+
});
|
|
69
|
+
const handleInput = (e) => {
|
|
70
|
+
const inputElement = e.target;
|
|
71
|
+
recordCursor(inputElement);
|
|
72
|
+
inputElement.value = formatterUtil.textFormatter4Input(
|
|
73
|
+
inputElement.value,
|
|
74
|
+
props.dataFormatter
|
|
75
|
+
);
|
|
76
|
+
setCursor(inputElement);
|
|
77
|
+
const unformattedValue = formatterUtil.reverseTextFormatter(
|
|
78
|
+
inputElement.value,
|
|
79
|
+
props.dataFormatter
|
|
80
|
+
);
|
|
81
|
+
compValue.value = unformattedValue;
|
|
82
|
+
};
|
|
83
|
+
return (_ctx, _cache) => {
|
|
84
|
+
const _component_van_field = index.Field;
|
|
85
|
+
return vue.openBlock(), vue.createElementBlock(vue.Fragment, null, [
|
|
86
|
+
vue.createVNode(_component_van_field, vue.mergeProps(_ctx.$attrs, {
|
|
87
|
+
modelValue: vue.unref(textValue),
|
|
88
|
+
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => vue.isRef(textValue) ? textValue.value = $event : null),
|
|
89
|
+
disabled: __props.disabled,
|
|
90
|
+
clearable: "",
|
|
91
|
+
clickable: vue.unref(compClickable),
|
|
92
|
+
"clear-trigger": "always",
|
|
93
|
+
onClick: _cache[1] || (_cache[1] = ($event) => !__props.disabled && emit("openPicker")),
|
|
94
|
+
ref_key: "fieldInputRef",
|
|
95
|
+
ref: fieldInputRef,
|
|
96
|
+
onInput: handleInput
|
|
97
|
+
}), vue.createSlots({ _: 2 }, [
|
|
98
|
+
vue.renderList(_ctx.$slots, (item, key) => {
|
|
99
|
+
return {
|
|
100
|
+
name: key,
|
|
101
|
+
fn: vue.withCtx(() => [
|
|
102
|
+
vue.renderSlot(_ctx.$slots, key)
|
|
103
|
+
])
|
|
104
|
+
};
|
|
105
|
+
}),
|
|
106
|
+
__props.showUnit && vue.unref(unit) ? {
|
|
107
|
+
name: "button",
|
|
108
|
+
fn: vue.withCtx(() => [
|
|
109
|
+
vue.createTextVNode(vue.toDisplayString(vue.unref(unit)), 1)
|
|
110
|
+
]),
|
|
111
|
+
key: "0"
|
|
112
|
+
} : void 0
|
|
113
|
+
]), 1040, ["modelValue", "disabled", "clickable"]),
|
|
114
|
+
vue.withDirectives(vue.createElementVNode("input", {
|
|
115
|
+
type: "hidden",
|
|
116
|
+
"onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => vue.isRef(compValue) ? compValue.value = $event : null)
|
|
117
|
+
}, null, 512), [
|
|
118
|
+
[vue.vModelText, vue.unref(compValue)]
|
|
119
|
+
]),
|
|
120
|
+
vue.renderSlot(_ctx.$slots, "default")
|
|
121
|
+
], 64);
|
|
122
|
+
};
|
|
123
|
+
}
|
|
124
|
+
};
|
|
125
|
+
exports.default = _sfc_main;
|
|
@@ -142,7 +142,7 @@ const _sfc_main = {
|
|
|
142
142
|
isLink: __props.readonly ? false : true,
|
|
143
143
|
readonly: "",
|
|
144
144
|
disabled: __props.disabled,
|
|
145
|
-
|
|
145
|
+
onOpenPicker: _cache[5] || (_cache[5] = () => {
|
|
146
146
|
if (!__props.readonly) {
|
|
147
147
|
showPicker.value = true;
|
|
148
148
|
}
|
package/lib/packages/mobile/src/components/form/fieldCalendarPicker/FieldCalendarPicker.vue.js
CHANGED
|
@@ -142,7 +142,7 @@ const _sfc_main = {
|
|
|
142
142
|
isLink: __props.readonly ? false : true,
|
|
143
143
|
readonly: "",
|
|
144
144
|
disabled: __props.disabled,
|
|
145
|
-
|
|
145
|
+
onOpenPicker: _cache[3] || (_cache[3] = () => {
|
|
146
146
|
if (!__props.readonly) {
|
|
147
147
|
showCalendar.value = true;
|
|
148
148
|
}
|
package/lib/packages/mobile/src/components/form/fieldCascaderPicker/fieldCascaderPicker.vue.js
CHANGED
|
@@ -137,7 +137,7 @@ const _sfc_main = {
|
|
|
137
137
|
isLink: __props.readonly ? false : true,
|
|
138
138
|
readonly: "",
|
|
139
139
|
disabled: __props.disabled,
|
|
140
|
-
|
|
140
|
+
onOpenPicker: _cache[5] || (_cache[5] = () => {
|
|
141
141
|
if (!__props.readonly) {
|
|
142
142
|
showPicker.value = true;
|
|
143
143
|
}
|
|
@@ -128,7 +128,7 @@ const _sfc_main = {
|
|
|
128
128
|
isLink: __props.readonly ? false : true,
|
|
129
129
|
readonly: "",
|
|
130
130
|
disabled: __props.disabled,
|
|
131
|
-
|
|
131
|
+
onOpenPicker: _cache[5] || (_cache[5] = () => {
|
|
132
132
|
if (!__props.readonly) {
|
|
133
133
|
showPicker.value = true;
|
|
134
134
|
}
|
package/lib/packages/mobile/src/components/form/fieldDateTimePicker/FieldDateTimePicker.vue.js
CHANGED
|
@@ -127,7 +127,7 @@ const _sfc_main = {
|
|
|
127
127
|
isLink: __props.readonly ? false : true,
|
|
128
128
|
readonly: "",
|
|
129
129
|
disabled: __props.disabled,
|
|
130
|
-
|
|
130
|
+
onOpenPicker: _cache[6] || (_cache[6] = () => {
|
|
131
131
|
if (!__props.readonly) {
|
|
132
132
|
showPicker.value = true;
|
|
133
133
|
}
|
|
@@ -117,7 +117,7 @@ const _sfc_main = {
|
|
|
117
117
|
isLink: __props.readonly ? false : true,
|
|
118
118
|
readonly: "",
|
|
119
119
|
disabled: __props.disabled,
|
|
120
|
-
|
|
120
|
+
onOpenPicker: _cache[4] || (_cache[4] = () => {
|
|
121
121
|
if (!__props.readonly) {
|
|
122
122
|
showPicker.value = true;
|
|
123
123
|
}
|
|
@@ -130,7 +130,7 @@ const _sfc_main = {
|
|
|
130
130
|
isLink: __props.readonly ? false : true,
|
|
131
131
|
readonly: "",
|
|
132
132
|
disabled: __props.disabled,
|
|
133
|
-
|
|
133
|
+
onOpenPicker: _cache[5] || (_cache[5] = () => {
|
|
134
134
|
if (!__props.readonly) {
|
|
135
135
|
showPicker.value = true;
|
|
136
136
|
}
|
|
@@ -34,7 +34,7 @@ const _sfc_main = {
|
|
|
34
34
|
default: true
|
|
35
35
|
}
|
|
36
36
|
},
|
|
37
|
-
emits: ["update:modelValue"],
|
|
37
|
+
emits: ["update:modelValue", "submit"],
|
|
38
38
|
setup(__props, { emit: __emit }) {
|
|
39
39
|
const props = __props;
|
|
40
40
|
const emit = __emit;
|
|
@@ -77,12 +77,16 @@ const _sfc_main = {
|
|
|
77
77
|
};
|
|
78
78
|
vue.provide("dicListMap", dicListMap);
|
|
79
79
|
processSlotComponents();
|
|
80
|
+
function submitForm(oriFormData) {
|
|
81
|
+
emit("submit", vue.toRaw(formData.value));
|
|
82
|
+
}
|
|
80
83
|
return (_ctx, _cache) => {
|
|
81
84
|
const _component_van_cell_group = index$1.CellGroup;
|
|
82
85
|
const _component_van_form = index.Form;
|
|
83
86
|
return vue.openBlock(), vue.createBlock(_component_van_form, vue.mergeProps(_ctx.$attrs, {
|
|
84
87
|
required: "auto",
|
|
85
|
-
class: { fecMForm: true, isShadow: __props.isCard && __props.isShadow }
|
|
88
|
+
class: { fecMForm: true, isShadow: __props.isCard && __props.isShadow },
|
|
89
|
+
onSubmit: submitForm
|
|
86
90
|
}), {
|
|
87
91
|
default: vue.withCtx(() => [
|
|
88
92
|
vue.createVNode(_component_van_cell_group, { inset: __props.isCard }, {
|
|
@@ -97,5 +101,5 @@ const _sfc_main = {
|
|
|
97
101
|
};
|
|
98
102
|
}
|
|
99
103
|
};
|
|
100
|
-
const _Form = /* @__PURE__ */ _pluginVue_exportHelper.default(_sfc_main, [["__scopeId", "data-v-
|
|
104
|
+
const _Form = /* @__PURE__ */ _pluginVue_exportHelper.default(_sfc_main, [["__scopeId", "data-v-a3cc552b"]]);
|
|
101
105
|
exports.default = _Form;
|
|
@@ -90,13 +90,14 @@ const _sfc_main = {
|
|
|
90
90
|
return vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(vue.unref(formItem)), vue.mergeProps(_ctx.$attrs, {
|
|
91
91
|
modelValue: vue.unref(compValue),
|
|
92
92
|
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => vue.isRef(compValue) ? compValue.value = $event : null),
|
|
93
|
+
fieldType: __props.fieldType,
|
|
93
94
|
rules: vue.unref(rules),
|
|
94
95
|
required: vue.unref(formItemReadonly) ? false : "auto",
|
|
95
96
|
disabled: vue.unref(formItemDisabled),
|
|
96
97
|
readonly: vue.unref(formItemReadonly),
|
|
97
98
|
placeholder: vue.unref(formItemReadonly) ? "" : __props.placeholder,
|
|
98
99
|
dicList: (_a = vue.unref(dicListMap)) == null ? void 0 : _a[vue.unref(attrs).dicKey]
|
|
99
|
-
}), null, 16, ["modelValue", "rules", "required", "disabled", "readonly", "placeholder", "dicList"]);
|
|
100
|
+
}), null, 16, ["modelValue", "fieldType", "rules", "required", "disabled", "readonly", "placeholder", "dicList"]);
|
|
100
101
|
};
|
|
101
102
|
}
|
|
102
103
|
};
|
|
@@ -53,21 +53,20 @@ const textFormatter = (value, dataFormatter) => {
|
|
|
53
53
|
case "money(yi)":
|
|
54
54
|
return moneyFormatter(value, dataFormatter);
|
|
55
55
|
case "bankCard":
|
|
56
|
-
|
|
56
|
+
value = index.default.toValueString(value);
|
|
57
|
+
value = value.replace(/\s+/g, "");
|
|
58
|
+
return index.default.commafy(value, {
|
|
57
59
|
spaceNumber: 4,
|
|
58
60
|
separator: " "
|
|
59
61
|
});
|
|
60
62
|
case "percent":
|
|
61
63
|
value = index.default.multiply(index.default.toNumber(value), 100);
|
|
62
|
-
value = index.default.toFixed(value, 2);
|
|
63
64
|
return value;
|
|
64
65
|
case "thousand":
|
|
65
66
|
value = index.default.multiply(index.default.toNumber(value), 1e3);
|
|
66
|
-
value = index.default.toFixed(value, 2);
|
|
67
67
|
return value;
|
|
68
68
|
case "tenThousand":
|
|
69
69
|
value = index.default.multiply(index.default.toNumber(value), 1e4);
|
|
70
|
-
value = index.default.toFixed(value, 2);
|
|
71
70
|
return value;
|
|
72
71
|
default:
|
|
73
72
|
return value;
|
|
@@ -91,9 +90,89 @@ const moneyFormatter = (value, dataFormatter) => {
|
|
|
91
90
|
}
|
|
92
91
|
return index.default.commafy(moneyValue, { digits: 2 });
|
|
93
92
|
};
|
|
93
|
+
const textFormatter4Input = (value, dataFormatter) => {
|
|
94
|
+
switch (dataFormatter) {
|
|
95
|
+
case "money(yuan)":
|
|
96
|
+
case "money(wan)":
|
|
97
|
+
case "money(yi)":
|
|
98
|
+
return index.default.toNumberString(index.default.toNumber(value)).replace(
|
|
99
|
+
/\B(?=(\d{3})+(?!\d))/g,
|
|
100
|
+
","
|
|
101
|
+
);
|
|
102
|
+
case "bankCard":
|
|
103
|
+
return index.default.toValueString(value.replace(/\s+/g, "")).replace(
|
|
104
|
+
/\B(?=(\d{4})+(?!\d))/g,
|
|
105
|
+
" "
|
|
106
|
+
);
|
|
107
|
+
default:
|
|
108
|
+
return value;
|
|
109
|
+
}
|
|
110
|
+
};
|
|
111
|
+
const reverseTextFormatter = (value, dataFormatter) => {
|
|
112
|
+
switch (dataFormatter) {
|
|
113
|
+
case "money(yuan)":
|
|
114
|
+
case "money(wan)":
|
|
115
|
+
case "money(yi)":
|
|
116
|
+
return reverseMoneyFormatter(value, dataFormatter);
|
|
117
|
+
case "bankCard":
|
|
118
|
+
return value.replace(/\s+/g, "");
|
|
119
|
+
case "percent":
|
|
120
|
+
value = index.default.divide(index.default.toNumber(value), 100);
|
|
121
|
+
return value;
|
|
122
|
+
case "thousand":
|
|
123
|
+
value = index.default.divide(index.default.toNumber(value), 1e3);
|
|
124
|
+
return value;
|
|
125
|
+
case "tenThousand":
|
|
126
|
+
value = index.default.divide(index.default.toNumber(value), 1e4);
|
|
127
|
+
return value;
|
|
128
|
+
default:
|
|
129
|
+
return value;
|
|
130
|
+
}
|
|
131
|
+
};
|
|
132
|
+
const reverseMoneyFormatter = (value, dataFormatter) => {
|
|
133
|
+
let moneyValue;
|
|
134
|
+
value = value.replace(/,/gi, "");
|
|
135
|
+
switch (dataFormatter) {
|
|
136
|
+
case "money(yuan)":
|
|
137
|
+
moneyValue = index.default.toNumber(value);
|
|
138
|
+
break;
|
|
139
|
+
case "money(wan)":
|
|
140
|
+
moneyValue = index.default.multiply(index.default.toNumber(value), 1e4);
|
|
141
|
+
break;
|
|
142
|
+
case "money(yi)":
|
|
143
|
+
moneyValue = index.default.multiply(index.default.toNumber(value), 1e8);
|
|
144
|
+
break;
|
|
145
|
+
default:
|
|
146
|
+
moneyValue = index.default.toNumber(value);
|
|
147
|
+
break;
|
|
148
|
+
}
|
|
149
|
+
return index.default.toNumberString(moneyValue);
|
|
150
|
+
};
|
|
151
|
+
const getUnit = (dataFormatter) => {
|
|
152
|
+
switch (dataFormatter) {
|
|
153
|
+
case "money(yuan)":
|
|
154
|
+
return "元";
|
|
155
|
+
case "money(wan)":
|
|
156
|
+
return "万";
|
|
157
|
+
case "money(yi)":
|
|
158
|
+
return "亿";
|
|
159
|
+
case "percent":
|
|
160
|
+
return "%";
|
|
161
|
+
case "thousand":
|
|
162
|
+
return "‰";
|
|
163
|
+
case "tenThousand":
|
|
164
|
+
return "‱";
|
|
165
|
+
default:
|
|
166
|
+
return "";
|
|
167
|
+
}
|
|
168
|
+
};
|
|
94
169
|
exports.cascadeFormatter = cascadeFormatter;
|
|
95
170
|
exports.dateFormatter = dateFormatter;
|
|
171
|
+
exports.getUnit = getUnit;
|
|
96
172
|
exports.moneyFormatter = moneyFormatter;
|
|
97
173
|
exports.multipleFormatter = multipleFormatter;
|
|
174
|
+
exports.reverseMoneyFormatter = reverseMoneyFormatter;
|
|
175
|
+
exports.reverseTextFormatter = reverseTextFormatter;
|
|
98
176
|
exports.selectFormatter = selectFormatter;
|
|
99
177
|
exports.textFormatter = textFormatter;
|
|
178
|
+
exports.textFormatter4Input = textFormatter4Input;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
function useCursor() {
|
|
4
|
+
let selectionInfo;
|
|
5
|
+
function recordCursor(inputElement) {
|
|
6
|
+
if (inputElement == void 0) return;
|
|
7
|
+
const { selectionStart, selectionEnd, value } = inputElement;
|
|
8
|
+
if (selectionStart == null || selectionEnd == null) return;
|
|
9
|
+
const beforeTxt = value.slice(0, Math.max(0, selectionStart));
|
|
10
|
+
const afterTxt = value.slice(Math.max(0, selectionEnd));
|
|
11
|
+
selectionInfo = {
|
|
12
|
+
selectionStart,
|
|
13
|
+
selectionEnd,
|
|
14
|
+
value,
|
|
15
|
+
beforeTxt,
|
|
16
|
+
afterTxt
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
function setCursor(inputElement) {
|
|
20
|
+
if (inputElement == void 0 || selectionInfo == void 0) return;
|
|
21
|
+
const { value } = inputElement;
|
|
22
|
+
const { beforeTxt, afterTxt, selectionStart } = selectionInfo;
|
|
23
|
+
if (beforeTxt == void 0 || afterTxt == void 0 || selectionStart == void 0)
|
|
24
|
+
return;
|
|
25
|
+
let startPos = value.length;
|
|
26
|
+
if (value.endsWith(afterTxt)) {
|
|
27
|
+
startPos = value.length - afterTxt.length;
|
|
28
|
+
} else if (value.startsWith(beforeTxt)) {
|
|
29
|
+
startPos = beforeTxt.length;
|
|
30
|
+
} else {
|
|
31
|
+
const beforeLastChar = beforeTxt[selectionStart - 1];
|
|
32
|
+
const newIndex = value.indexOf(beforeLastChar, selectionStart - 1);
|
|
33
|
+
if (newIndex !== -1) {
|
|
34
|
+
startPos = newIndex + 1;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
inputElement.setSelectionRange(startPos, startPos);
|
|
38
|
+
}
|
|
39
|
+
return [recordCursor, setCursor];
|
|
40
|
+
}
|
|
41
|
+
exports.useCursor = useCursor;
|