form-driver 0.4.17 → 0.4.18
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/dist/m3.js +1 -1
- package/es/m3.js +4 -3
- package/lib/m3.js +4 -3
- package/package.json +1 -1
- package/src/ui/editor/basic/ASpecInputBox.tsx +80 -69
- package/types/ui/editor/basic/ASpecInputBox.d.ts +1 -1
package/es/m3.js
CHANGED
|
@@ -19224,7 +19224,7 @@ var ASpecInputBox = /*#__PURE__*/function (_BaseViewer) {
|
|
|
19224
19224
|
children: [item.country, " +", item.value]
|
|
19225
19225
|
}, item.countryCode);
|
|
19226
19226
|
})
|
|
19227
|
-
}), jsx(
|
|
19227
|
+
}), jsx(InputNumber, {
|
|
19228
19228
|
style: {
|
|
19229
19229
|
width: "calc(100% - " + selectWidth + "px)"
|
|
19230
19230
|
},
|
|
@@ -19232,9 +19232,10 @@ var ASpecInputBox = /*#__PURE__*/function (_BaseViewer) {
|
|
|
19232
19232
|
bordered: !this.props.hideBorder,
|
|
19233
19233
|
disabled: this.props.disable,
|
|
19234
19234
|
defaultValue: phoneValue.phone,
|
|
19235
|
-
|
|
19235
|
+
min: "0",
|
|
19236
|
+
onChange: function onChange(value) {
|
|
19236
19237
|
var updated = _objectSpread$l(_objectSpread$l({}, _this.getPhoneValue()), {}, {
|
|
19237
|
-
phone:
|
|
19238
|
+
phone: value
|
|
19238
19239
|
});
|
|
19239
19240
|
|
|
19240
19241
|
_this.changeValueEx(updated, false, false);
|
package/lib/m3.js
CHANGED
|
@@ -19248,7 +19248,7 @@ var ASpecInputBox = /*#__PURE__*/function (_BaseViewer) {
|
|
|
19248
19248
|
children: [item.country, " +", item.value]
|
|
19249
19249
|
}, item.countryCode);
|
|
19250
19250
|
})
|
|
19251
|
-
}), jsxRuntime.jsx(antd.
|
|
19251
|
+
}), jsxRuntime.jsx(antd.InputNumber, {
|
|
19252
19252
|
style: {
|
|
19253
19253
|
width: "calc(100% - " + selectWidth + "px)"
|
|
19254
19254
|
},
|
|
@@ -19256,9 +19256,10 @@ var ASpecInputBox = /*#__PURE__*/function (_BaseViewer) {
|
|
|
19256
19256
|
bordered: !this.props.hideBorder,
|
|
19257
19257
|
disabled: this.props.disable,
|
|
19258
19258
|
defaultValue: phoneValue.phone,
|
|
19259
|
-
|
|
19259
|
+
min: "0",
|
|
19260
|
+
onChange: function onChange(value) {
|
|
19260
19261
|
var updated = _objectSpread$l(_objectSpread$l({}, _this.getPhoneValue()), {}, {
|
|
19261
|
-
phone:
|
|
19262
|
+
phone: value
|
|
19262
19263
|
});
|
|
19263
19264
|
|
|
19264
19265
|
_this.changeValueEx(updated, false, false);
|
package/package.json
CHANGED
|
@@ -1,18 +1,17 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import _ from "lodash"
|
|
3
|
-
import { Input, Select } from "antd";
|
|
4
|
-
import { BaseViewer } from
|
|
5
|
-
import { AREA_CODE_LIST } from
|
|
2
|
+
import _ from "lodash";
|
|
3
|
+
import { Input, InputNumber, Select } from "antd";
|
|
4
|
+
import { BaseViewer } from "../../BaseViewer";
|
|
5
|
+
import { AREA_CODE_LIST } from "../../../data/areaCodeData";
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* 手机号/邮箱等输入框
|
|
9
9
|
* cnPhone/tel/email
|
|
10
|
-
*
|
|
10
|
+
*
|
|
11
11
|
* 当 type 为 tel 或 cnPhone 时,渲染为区号选择器 + 手机号输入框的复合组件
|
|
12
12
|
* 数据格式为 {areaCode: "86", phone: "13800138000"}
|
|
13
13
|
*/
|
|
14
14
|
export class ASpecInputBox extends BaseViewer {
|
|
15
|
-
|
|
16
15
|
/**
|
|
17
16
|
* 判断当前 schema 类型是否为手机号类型
|
|
18
17
|
*/
|
|
@@ -42,54 +41,65 @@ export class ASpecInputBox extends BaseViewer {
|
|
|
42
41
|
const phoneValue = this.getPhoneValue();
|
|
43
42
|
const selectWidth = 120;
|
|
44
43
|
|
|
45
|
-
return
|
|
46
|
-
<
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
this.
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
44
|
+
return (
|
|
45
|
+
<Input.Group compact key={this.props.path}>
|
|
46
|
+
<Select
|
|
47
|
+
style={{ width: selectWidth }}
|
|
48
|
+
value={phoneValue.areaCode}
|
|
49
|
+
showSearch
|
|
50
|
+
optionLabelProp="shortLabel"
|
|
51
|
+
filterOption={(input, option) => {
|
|
52
|
+
const searchText = input.toLowerCase();
|
|
53
|
+
// 支持按区号、国家中文名、英文名搜索
|
|
54
|
+
const country = (
|
|
55
|
+
((option as any)?.["data-country"] as string) || ""
|
|
56
|
+
).toLowerCase();
|
|
57
|
+
const englishName = (
|
|
58
|
+
((option as any)?.["data-english"] as string) || ""
|
|
59
|
+
).toLowerCase();
|
|
60
|
+
const value = (option?.value as string) || "";
|
|
61
|
+
return (
|
|
62
|
+
value.includes(searchText) ||
|
|
63
|
+
country.includes(searchText) ||
|
|
64
|
+
englishName.includes(searchText)
|
|
65
|
+
);
|
|
66
|
+
}}
|
|
67
|
+
disabled={this.props.disable}
|
|
68
|
+
onChange={(newAreaCode: string) => {
|
|
69
|
+
const updated = { ...this.getPhoneValue(), areaCode: newAreaCode };
|
|
70
|
+
this.changeValueEx(updated, false, true);
|
|
71
|
+
}}
|
|
72
|
+
>
|
|
73
|
+
{AREA_CODE_LIST.map((item) => (
|
|
74
|
+
<Select.Option
|
|
75
|
+
key={item.countryCode}
|
|
76
|
+
value={item.value}
|
|
77
|
+
shortLabel={`+${item.value}`}
|
|
78
|
+
data-country={item.country}
|
|
79
|
+
data-english={item.englishName}
|
|
80
|
+
>
|
|
81
|
+
{item.country} +{item.value}
|
|
82
|
+
</Select.Option>
|
|
83
|
+
))}
|
|
84
|
+
</Select>
|
|
85
|
+
<InputNumber
|
|
86
|
+
style={{ width: `calc(100% - ${selectWidth}px)` }}
|
|
87
|
+
placeholder={super.getPlaceholder()}
|
|
88
|
+
bordered={!this.props.hideBorder}
|
|
89
|
+
disabled={this.props.disable}
|
|
90
|
+
defaultValue={phoneValue.phone}
|
|
91
|
+
min={"0"}
|
|
92
|
+
key={this.props.path + "/phone/" + this.state.ctrlVersion}
|
|
93
|
+
onChange={(value) => {
|
|
94
|
+
const updated = { ...this.getPhoneValue(), phone: value };
|
|
95
|
+
this.changeValueEx(updated, false, false);
|
|
96
|
+
}}
|
|
97
|
+
onBlur={() => {
|
|
98
|
+
this.changeValueEx(this.getPhoneValue(), false, true);
|
|
99
|
+
}}
|
|
100
|
+
/>
|
|
101
|
+
</Input.Group>
|
|
102
|
+
);
|
|
93
103
|
}
|
|
94
104
|
|
|
95
105
|
element() {
|
|
@@ -100,20 +110,21 @@ export class ASpecInputBox extends BaseViewer {
|
|
|
100
110
|
|
|
101
111
|
// 其他类型(如 email):保持原有纯 Input 行为
|
|
102
112
|
const p = this.props.schema.props ?? {};
|
|
103
|
-
const deepCloneP = _.cloneDeep(p)
|
|
104
|
-
const selfOnChange = p.onChange
|
|
105
|
-
delete deepCloneP.onChange
|
|
106
|
-
|
|
107
|
-
return
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
113
|
+
const deepCloneP = _.cloneDeep(p);
|
|
114
|
+
const selfOnChange = p.onChange;
|
|
115
|
+
delete deepCloneP.onChange;
|
|
116
|
+
|
|
117
|
+
return (
|
|
118
|
+
<Input
|
|
119
|
+
{...super.antProp()}
|
|
120
|
+
defaultValue={super.getValue()}
|
|
121
|
+
onBlur={() => this.changeValueEx(super.getValue(), false, true)}
|
|
122
|
+
onChange={(v) => {
|
|
123
|
+
this.changeValueEx(v.target.value, false, false);
|
|
124
|
+
selfOnChange && selfOnChange(v);
|
|
125
|
+
}}
|
|
126
|
+
{...deepCloneP}
|
|
127
|
+
/>
|
|
128
|
+
);
|
|
117
129
|
}
|
|
118
130
|
}
|
|
119
|
-
|