@kdcloudjs/kdesign 1.2.2 → 1.3.1
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/CHANGELOG.md +47 -0
- package/dist/kdesign-complete.less +42 -81
- package/dist/kdesign.css +56 -119
- package/dist/kdesign.css.map +1 -1
- package/dist/kdesign.js +165 -117
- package/dist/kdesign.js.map +1 -1
- package/dist/kdesign.min.css +3 -3
- package/dist/kdesign.min.js +8 -8
- package/dist/kdesign.min.js.map +1 -1
- package/es/badge/style/index.css +3 -4
- package/es/badge/style/index.less +3 -4
- package/es/badge/style/token.less +1 -0
- package/es/button/style/index.css +3 -3
- package/es/button/style/token.less +3 -3
- package/es/carousel/style/index.css +11 -86
- package/es/carousel/style/index.less +3 -60
- package/es/checkbox/checkbox.js +4 -2
- package/es/checkbox/style/index.css +7 -0
- package/es/checkbox/style/index.less +7 -0
- package/es/config-provider/compDefaultProps.d.ts +1 -0
- package/es/config-provider/compDefaultProps.js +2 -1
- package/es/dropdown/style/index.css +5 -5
- package/es/form/Field.d.ts +2 -1
- package/es/form/Field.js +39 -22
- package/es/form/Form.js +7 -2
- package/es/form/hooks/useForm.js +1 -0
- package/es/form/interface.d.ts +5 -0
- package/es/input-number/inputNumber.d.ts +1 -0
- package/es/input-number/inputNumber.js +3 -2
- package/es/locale/locale.d.ts +1 -0
- package/es/locale/zh-CN.d.ts +1 -0
- package/es/locale/zh-CN.js +2 -1
- package/es/menu/subMenu.js +6 -2
- package/es/popconfirm/style/index.css +5 -5
- package/es/select/index.d.ts +2 -2
- package/es/select/interface.d.ts +7 -7
- package/es/select/select.js +12 -1
- package/es/select/style/index.css +13 -7
- package/es/select/style/index.less +14 -6
- package/es/select/style/token.less +4 -1
- package/es/style/mixins/index.less +5 -5
- package/es/tooltip/style/index.css +8 -8
- package/es/tooltip/style/index.less +2 -2
- package/lib/badge/style/index.css +3 -4
- package/lib/badge/style/index.less +3 -4
- package/lib/badge/style/token.less +1 -0
- package/lib/button/style/index.css +3 -3
- package/lib/button/style/token.less +3 -3
- package/lib/carousel/style/index.css +11 -86
- package/lib/carousel/style/index.less +3 -60
- package/lib/checkbox/checkbox.js +4 -2
- package/lib/checkbox/style/index.css +7 -0
- package/lib/checkbox/style/index.less +7 -0
- package/lib/config-provider/compDefaultProps.d.ts +1 -0
- package/lib/config-provider/compDefaultProps.js +2 -1
- package/lib/dropdown/style/index.css +5 -5
- package/lib/form/Field.d.ts +2 -1
- package/lib/form/Field.js +42 -24
- package/lib/form/Form.js +7 -2
- package/lib/form/hooks/useForm.js +1 -0
- package/lib/form/interface.d.ts +5 -0
- package/lib/input-number/inputNumber.d.ts +1 -0
- package/lib/input-number/inputNumber.js +3 -2
- package/lib/locale/locale.d.ts +1 -0
- package/lib/locale/zh-CN.d.ts +1 -0
- package/lib/locale/zh-CN.js +2 -1
- package/lib/menu/subMenu.js +6 -2
- package/lib/popconfirm/style/index.css +5 -5
- package/lib/select/index.d.ts +2 -2
- package/lib/select/interface.d.ts +7 -7
- package/lib/select/select.js +12 -1
- package/lib/select/style/index.css +13 -7
- package/lib/select/style/index.less +14 -6
- package/lib/select/style/token.less +4 -1
- package/lib/style/mixins/index.less +5 -5
- package/lib/tooltip/style/index.css +8 -8
- package/lib/tooltip/style/index.less +2 -2
- package/package.json +1 -1
|
@@ -10,71 +10,11 @@
|
|
|
10
10
|
overflow: hidden;
|
|
11
11
|
flex: 1;
|
|
12
12
|
}
|
|
13
|
-
&-slidelist {
|
|
14
|
-
list-style: none;
|
|
15
|
-
display: flex;
|
|
16
|
-
flex-direction: row;
|
|
17
|
-
width: 100%;
|
|
18
|
-
&-item {
|
|
19
|
-
flex-shrink: 0;
|
|
20
|
-
height: 100%;
|
|
21
|
-
width: 100%;
|
|
22
|
-
overflow: hidden;
|
|
23
|
-
border-radius: @carousel-boder-radius;
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
&-fadelist {
|
|
27
|
-
list-style: none;
|
|
28
|
-
display: flex;
|
|
29
|
-
flex-direction: row;
|
|
30
|
-
flex: 1;
|
|
31
|
-
position: relative;
|
|
32
|
-
&-item {
|
|
33
|
-
opacity: 1;
|
|
34
|
-
position: relative;
|
|
35
|
-
flex-shrink: 0;
|
|
36
|
-
height: 100%;
|
|
37
|
-
width: 100%;
|
|
38
|
-
&-animation {
|
|
39
|
-
transition: opacity 0.3s ease;
|
|
40
|
-
}
|
|
41
|
-
&-none-animation {
|
|
42
|
-
transition: none;
|
|
43
|
-
}
|
|
44
|
-
&-not-hidden {
|
|
45
|
-
opacity: 1;
|
|
46
|
-
}
|
|
47
|
-
&-hidden {
|
|
48
|
-
opacity: 0;
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
&-displaylist {
|
|
53
|
-
list-style: none;
|
|
54
|
-
display: flex;
|
|
55
|
-
flex-direction: row;
|
|
56
|
-
flex: 1;
|
|
57
|
-
position: relative;
|
|
58
|
-
&-item {
|
|
59
|
-
display: block;
|
|
60
|
-
position: relative;
|
|
61
|
-
flex-shrink: 0;
|
|
62
|
-
height: 100%;
|
|
63
|
-
width: 100%;
|
|
64
|
-
&-not-hidden {
|
|
65
|
-
display: block;
|
|
66
|
-
}
|
|
67
|
-
&-hidden {
|
|
68
|
-
display: none;
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
13
|
|
|
73
14
|
&-list {
|
|
74
15
|
list-style: none;
|
|
75
16
|
display: flex;
|
|
76
17
|
flex-direction: row;
|
|
77
|
-
flex: 1;
|
|
78
18
|
position: relative;
|
|
79
19
|
|
|
80
20
|
&-item {
|
|
@@ -85,6 +25,7 @@
|
|
|
85
25
|
}
|
|
86
26
|
|
|
87
27
|
&-slide {
|
|
28
|
+
width: 100%;
|
|
88
29
|
.@{carousel-prefix-cls}-list-item {
|
|
89
30
|
opacity: 1;
|
|
90
31
|
border-radius: @carousel-boder-radius;
|
|
@@ -104,6 +45,7 @@
|
|
|
104
45
|
}
|
|
105
46
|
|
|
106
47
|
&-fade {
|
|
48
|
+
flex: 1;
|
|
107
49
|
.@{carousel-prefix-cls}-list-item {
|
|
108
50
|
opacity: 1;
|
|
109
51
|
&-animation {
|
|
@@ -122,6 +64,7 @@
|
|
|
122
64
|
}
|
|
123
65
|
|
|
124
66
|
&-display {
|
|
67
|
+
width: 100%;
|
|
125
68
|
.@{carousel-prefix-cls}-list-item {
|
|
126
69
|
display: block;
|
|
127
70
|
&-not-hidden {
|
package/lib/checkbox/checkbox.js
CHANGED
|
@@ -64,7 +64,8 @@ var InternalCheckbox = function InternalCheckbox(props, ref) {
|
|
|
64
64
|
children = CheckboxProps.children,
|
|
65
65
|
style = CheckboxProps.style,
|
|
66
66
|
value = CheckboxProps.value,
|
|
67
|
-
indeterminate = CheckboxProps.indeterminate
|
|
67
|
+
indeterminate = CheckboxProps.indeterminate,
|
|
68
|
+
name = CheckboxProps.name;
|
|
68
69
|
|
|
69
70
|
var getChecked = function getChecked() {
|
|
70
71
|
return (0, _isBoolean.default)(checked) ? checked : defaultChecked;
|
|
@@ -134,7 +135,8 @@ var InternalCheckbox = function InternalCheckbox(props, ref) {
|
|
|
134
135
|
ref: ref,
|
|
135
136
|
value: value,
|
|
136
137
|
checked: selected,
|
|
137
|
-
disabled: disabled
|
|
138
|
+
disabled: disabled,
|
|
139
|
+
name: name
|
|
138
140
|
})), children && /*#__PURE__*/_react.default.createElement("span", {
|
|
139
141
|
className: "".concat(checkboxPrefixCls, "-children")
|
|
140
142
|
}, children), !isDefaultType() && /*#__PURE__*/_react.default.createElement("span", {
|
|
@@ -151,6 +151,10 @@
|
|
|
151
151
|
-ms-flex-align: center;
|
|
152
152
|
align-items: center;
|
|
153
153
|
z-index: 999;
|
|
154
|
+
-webkit-user-select: none;
|
|
155
|
+
-moz-user-select: none;
|
|
156
|
+
-ms-user-select: none;
|
|
157
|
+
user-select: none;
|
|
154
158
|
}
|
|
155
159
|
.kd-checkbox-children .kd-input-underline {
|
|
156
160
|
background-color: transparent;
|
|
@@ -383,3 +387,6 @@
|
|
|
383
387
|
.kd-checkbox-default.checked .kd-checkbox-children {
|
|
384
388
|
color: var(--kd-c-checkbox-color-text-primary, #212121);
|
|
385
389
|
}
|
|
390
|
+
.kd-checkbox-default-indeterminate .kd-checkbox-children {
|
|
391
|
+
color: var(--kd-c-checkbox-color-text-primary, #212121);
|
|
392
|
+
}
|
|
@@ -38,6 +38,8 @@
|
|
|
38
38
|
justify-content: center;
|
|
39
39
|
align-items: center;
|
|
40
40
|
z-index: 999;
|
|
41
|
+
user-select: none;
|
|
42
|
+
|
|
41
43
|
.kd-input-underline {
|
|
42
44
|
background-color: transparent;
|
|
43
45
|
border-bottom: none;
|
|
@@ -249,4 +251,9 @@
|
|
|
249
251
|
color: @checkbox-font-color;
|
|
250
252
|
}
|
|
251
253
|
}
|
|
254
|
+
&-indeterminate {
|
|
255
|
+
.@{checkbox-prefix-cls}-children {
|
|
256
|
+
color: @checkbox-font-color;
|
|
257
|
+
}
|
|
258
|
+
}
|
|
252
259
|
}
|
|
@@ -151,7 +151,7 @@
|
|
|
151
151
|
.kd-dropdown.arrow::before {
|
|
152
152
|
position: absolute;
|
|
153
153
|
z-index: -2;
|
|
154
|
-
background:
|
|
154
|
+
background: var(--kd-g-color-background, #fff);
|
|
155
155
|
border-style: solid;
|
|
156
156
|
border-width: var(--arrowSize);
|
|
157
157
|
-webkit-transform: rotate(45deg);
|
|
@@ -176,7 +176,7 @@
|
|
|
176
176
|
top: var(--arrowSpill);
|
|
177
177
|
-webkit-box-shadow: -2px -2px calc(10px - 1px) rgba(0, 0, 0, 0.1);
|
|
178
178
|
box-shadow: -2px -2px calc(10px - 1px) rgba(0, 0, 0, 0.1);
|
|
179
|
-
border-color: var(--kd-g-color-
|
|
179
|
+
border-color: var(--kd-g-color-background, #fff) transparent transparent var(--kd-g-color-background, #fff);
|
|
180
180
|
}
|
|
181
181
|
.kd-dropdown.arrow.topLeft::before,
|
|
182
182
|
.kd-dropdown.arrow.top::before,
|
|
@@ -185,7 +185,7 @@
|
|
|
185
185
|
bottom: var(--arrowSpill);
|
|
186
186
|
-webkit-box-shadow: 3px 3px calc(10px + 1px) rgba(0, 0, 0, 0.15);
|
|
187
187
|
box-shadow: 3px 3px calc(10px + 1px) rgba(0, 0, 0, 0.15);
|
|
188
|
-
border-color: transparent var(--kd-g-color-
|
|
188
|
+
border-color: transparent var(--kd-g-color-background, #fff) var(--kd-g-color-background, #fff) transparent;
|
|
189
189
|
}
|
|
190
190
|
.kd-dropdown.arrow.leftTop::before,
|
|
191
191
|
.kd-dropdown.arrow.left::before,
|
|
@@ -194,7 +194,7 @@
|
|
|
194
194
|
right: var(--arrowSpill);
|
|
195
195
|
-webkit-box-shadow: 3px 0 10px rgba(0, 0, 0, 0.12), 0 -2px 10px rgba(204, 149, 149, 0.12);
|
|
196
196
|
box-shadow: 3px 0 10px rgba(0, 0, 0, 0.12), 0 -2px 10px rgba(204, 149, 149, 0.12);
|
|
197
|
-
border-color: var(--kd-g-color-
|
|
197
|
+
border-color: var(--kd-g-color-background, #fff) var(--kd-g-color-background, #fff) transparent transparent;
|
|
198
198
|
}
|
|
199
199
|
.kd-dropdown.arrow.rightTop::before,
|
|
200
200
|
.kd-dropdown.arrow.right::before,
|
|
@@ -203,7 +203,7 @@
|
|
|
203
203
|
left: var(--arrowSpill);
|
|
204
204
|
-webkit-box-shadow: 0 3px 10px rgba(0, 0, 0, 0.1), -2px 0 10px rgba(0, 0, 0, 0.1);
|
|
205
205
|
box-shadow: 0 3px 10px rgba(0, 0, 0, 0.1), -2px 0 10px rgba(0, 0, 0, 0.1);
|
|
206
|
-
border-color: transparent transparent var(--kd-g-color-
|
|
206
|
+
border-color: transparent transparent var(--kd-g-color-background, #fff) var(--kd-g-color-background, #fff);
|
|
207
207
|
}
|
|
208
208
|
.kd-dropdown-menu {
|
|
209
209
|
max-height: var(--kd-c-dropdown-menu-sizing-max-height, 336px);
|
package/lib/form/Field.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { NamePath, LabelAlign, Rule } from './interface';
|
|
|
3
3
|
export interface FormItemProps {
|
|
4
4
|
children?: React.ReactNode;
|
|
5
5
|
className?: string;
|
|
6
|
-
defaultValue?:
|
|
6
|
+
defaultValue?: any;
|
|
7
7
|
disabled?: boolean;
|
|
8
8
|
hidden?: boolean;
|
|
9
9
|
label?: string | number;
|
|
@@ -15,6 +15,7 @@ export interface FormItemProps {
|
|
|
15
15
|
rules?: Rule[];
|
|
16
16
|
validateTrigger?: string | string[];
|
|
17
17
|
wrapperWidth?: string | number;
|
|
18
|
+
valuePropName?: string;
|
|
18
19
|
}
|
|
19
20
|
declare const Field: React.FC<FormItemProps>;
|
|
20
21
|
export default Field;
|
package/lib/form/Field.js
CHANGED
|
@@ -13,7 +13,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
13
13
|
});
|
|
14
14
|
exports.default = void 0;
|
|
15
15
|
|
|
16
|
-
var
|
|
16
|
+
var _extends5 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/extends"));
|
|
17
17
|
|
|
18
18
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/defineProperty"));
|
|
19
19
|
|
|
@@ -23,8 +23,12 @@ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime-corejs3/hel
|
|
|
23
23
|
|
|
24
24
|
var _getOwnPropertySymbols = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/object/get-own-property-symbols"));
|
|
25
25
|
|
|
26
|
+
var _concat = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/concat"));
|
|
27
|
+
|
|
26
28
|
var _map = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/map"));
|
|
27
29
|
|
|
30
|
+
var _includes = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/includes"));
|
|
31
|
+
|
|
28
32
|
var _react = _interopRequireWildcard(require("react"));
|
|
29
33
|
|
|
30
34
|
var _get = _interopRequireDefault(require("lodash/get"));
|
|
@@ -65,6 +69,7 @@ var __rest = void 0 && (void 0).__rest || function (s, e) {
|
|
|
65
69
|
};
|
|
66
70
|
|
|
67
71
|
var DEFAULT_TRIGGER = 'onChange';
|
|
72
|
+
var FormEventValuePropNames = ['value', 'checked'];
|
|
68
73
|
|
|
69
74
|
var generateEventHandler = function generateEventHandler(handler, validateTrigger) {
|
|
70
75
|
var eventHandler = {};
|
|
@@ -85,7 +90,7 @@ var generateEventHandler = function generateEventHandler(handler, validateTrigge
|
|
|
85
90
|
};
|
|
86
91
|
|
|
87
92
|
var Field = function Field(props) {
|
|
88
|
-
var _classnames,
|
|
93
|
+
var _classnames, _context2;
|
|
89
94
|
|
|
90
95
|
(0, _devwarning.default)(! /*#__PURE__*/_react.default.isValidElement(props.children), 'Form.Item', 'Children of Form.Item is not a valid element');
|
|
91
96
|
(0, _devwarning.default)(!props.name, 'Form.Item', 'Form.Item must have a name');
|
|
@@ -107,7 +112,8 @@ var Field = function Field(props) {
|
|
|
107
112
|
getFieldError = fieldContext.getFieldError,
|
|
108
113
|
getInternalHooks = fieldContext.getInternalHooks,
|
|
109
114
|
vertical = fieldContext.vertical,
|
|
110
|
-
getDefaultValue = fieldContext.getDefaultValue
|
|
115
|
+
getDefaultValue = fieldContext.getDefaultValue,
|
|
116
|
+
local = fieldContext.local;
|
|
111
117
|
|
|
112
118
|
var _getInternalHooks = getInternalHooks(_useForm.INTERNAL_HOOK_KEY),
|
|
113
119
|
registerField = _getInternalHooks.registerField,
|
|
@@ -128,7 +134,9 @@ var Field = function Field(props) {
|
|
|
128
134
|
rules = _props$rules === void 0 ? [] : _props$rules,
|
|
129
135
|
wrapperWidth = props.wrapperWidth,
|
|
130
136
|
validateTrigger = props.validateTrigger,
|
|
131
|
-
defaultValue = props.defaultValue
|
|
137
|
+
defaultValue = props.defaultValue,
|
|
138
|
+
_props$valuePropName = props.valuePropName,
|
|
139
|
+
valuePropName = _props$valuePropName === void 0 ? 'value' : _props$valuePropName;
|
|
132
140
|
|
|
133
141
|
var onStoreChange = function onStoreChange(stores, _namePathList, source) {
|
|
134
142
|
var prev = stores.prev,
|
|
@@ -162,8 +170,11 @@ var Field = function Field(props) {
|
|
|
162
170
|
if (Array.isArray(rules) && !rules.some(function (rule) {
|
|
163
171
|
return Object.prototype.hasOwnProperty.call(rule, 'required');
|
|
164
172
|
}) && required) {
|
|
173
|
+
var _context;
|
|
174
|
+
|
|
165
175
|
rules.push({
|
|
166
|
-
required: true
|
|
176
|
+
required: true,
|
|
177
|
+
message: (0, _concat.default)(_context = "".concat(local && local.requiredMessage)).call(_context, label)
|
|
167
178
|
});
|
|
168
179
|
}
|
|
169
180
|
|
|
@@ -200,10 +211,22 @@ var Field = function Field(props) {
|
|
|
200
211
|
var value = getFieldValue(name);
|
|
201
212
|
var validateMessage = getFieldError(name);
|
|
202
213
|
|
|
203
|
-
var
|
|
214
|
+
var getInputValueFormProp = function getInputValueFormProp(evt) {
|
|
204
215
|
var _a;
|
|
205
216
|
|
|
206
|
-
var inputValue
|
|
217
|
+
var inputValue;
|
|
218
|
+
|
|
219
|
+
if (Object.prototype.hasOwnProperty.call(evt, 'target') && (0, _includes.default)(FormEventValuePropNames).call(FormEventValuePropNames, valuePropName)) {
|
|
220
|
+
inputValue = (_a = evt.target) === null || _a === void 0 ? void 0 : _a[valuePropName];
|
|
221
|
+
} else {
|
|
222
|
+
inputValue = evt;
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
return inputValue;
|
|
226
|
+
};
|
|
227
|
+
|
|
228
|
+
var handleValueChange = _react.default.useCallback(function (evt) {
|
|
229
|
+
var inputValue = getInputValueFormProp(evt);
|
|
207
230
|
dispatch({
|
|
208
231
|
type: 'updateValue',
|
|
209
232
|
namePath: name,
|
|
@@ -218,9 +241,11 @@ var Field = function Field(props) {
|
|
|
218
241
|
});
|
|
219
242
|
}, [name]);
|
|
220
243
|
|
|
221
|
-
var trigger = (0,
|
|
244
|
+
var trigger = (0, _extends5.default)((0, _defineProperty2.default)({}, DEFAULT_TRIGGER, handleValueChange), generateEventHandler(handleValueValidate, validateTrigger));
|
|
222
245
|
|
|
223
246
|
var mergeProps = function mergeProps(fa, ch) {
|
|
247
|
+
var _extends3;
|
|
248
|
+
|
|
224
249
|
if (!ch) {
|
|
225
250
|
return {};
|
|
226
251
|
}
|
|
@@ -231,17 +256,13 @@ var Field = function Field(props) {
|
|
|
231
256
|
|
|
232
257
|
var _ch$props = ch.props,
|
|
233
258
|
chChange = _ch$props.onChange,
|
|
234
|
-
chValue = _ch$props
|
|
259
|
+
chValue = _ch$props[valuePropName],
|
|
235
260
|
chDisabled = _ch$props.disabled,
|
|
236
261
|
chDefaultValue = _ch$props.defaultValue;
|
|
237
262
|
|
|
238
263
|
var onChange = function onChange(evt) {
|
|
239
264
|
if (chValue === undefined) {
|
|
240
|
-
|
|
241
|
-
setFieldValue(evt);
|
|
242
|
-
} else {
|
|
243
|
-
setFieldValue(evt.target.value);
|
|
244
|
-
}
|
|
265
|
+
setFieldValue(getInputValueFormProp(evt));
|
|
245
266
|
}
|
|
246
267
|
|
|
247
268
|
if (typeof faChange === 'function') {
|
|
@@ -264,12 +285,10 @@ var Field = function Field(props) {
|
|
|
264
285
|
forceUpdate();
|
|
265
286
|
}
|
|
266
287
|
|
|
267
|
-
return (0,
|
|
288
|
+
return (0, _extends5.default)((0, _extends5.default)({}, rest), (_extends3 = {
|
|
268
289
|
onChange: onChange,
|
|
269
|
-
defaultValue: defaultValue
|
|
270
|
-
|
|
271
|
-
disabled: chDisabled || faDisabled
|
|
272
|
-
});
|
|
290
|
+
defaultValue: defaultValue
|
|
291
|
+
}, (0, _defineProperty2.default)(_extends3, valuePropName, fieldValue), (0, _defineProperty2.default)(_extends3, "disabled", chDisabled || faDisabled), _extends3));
|
|
273
292
|
};
|
|
274
293
|
|
|
275
294
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
@@ -282,11 +301,10 @@ var Field = function Field(props) {
|
|
|
282
301
|
}), /*#__PURE__*/_react.default.createElement(_FieldWrapper.default, {
|
|
283
302
|
width: wrapperWidth,
|
|
284
303
|
validateMessage: validateMessage
|
|
285
|
-
}, (0, _map.default)(
|
|
286
|
-
var keys = mergeProps((0,
|
|
287
|
-
disabled: disabled
|
|
288
|
-
|
|
289
|
-
}, trigger), {
|
|
304
|
+
}, (0, _map.default)(_context2 = (0, _reactChildren.toArray)(children)).call(_context2, function (child, index) {
|
|
305
|
+
var keys = mergeProps((0, _extends5.default)((0, _extends5.default)((0, _defineProperty2.default)({
|
|
306
|
+
disabled: disabled
|
|
307
|
+
}, valuePropName, value), trigger), {
|
|
290
308
|
key: index
|
|
291
309
|
}), child);
|
|
292
310
|
return child ? /*#__PURE__*/_react.default.cloneElement(child, keys) : child;
|
package/lib/form/Form.js
CHANGED
|
@@ -60,9 +60,13 @@ var Form = function Form(props, ref) {
|
|
|
60
60
|
var _useContext = (0, _react.useContext)(_configProvider.ConfigContext),
|
|
61
61
|
getPrefixCls = _useContext.getPrefixCls,
|
|
62
62
|
prefixCls = _useContext.prefixCls,
|
|
63
|
-
userDefaultProps = _useContext.compDefaultProps
|
|
63
|
+
userDefaultProps = _useContext.compDefaultProps,
|
|
64
|
+
globalLocale = _useContext.locale;
|
|
64
65
|
|
|
65
66
|
var formProps = (0, _utils.getCompProps)('Form', userDefaultProps, props);
|
|
67
|
+
var formLang = globalLocale.getCompLangMsg({
|
|
68
|
+
componentName: 'Form'
|
|
69
|
+
});
|
|
66
70
|
|
|
67
71
|
var children = formProps.children,
|
|
68
72
|
defaultValues = formProps.defaultValues,
|
|
@@ -116,9 +120,10 @@ var Form = function Form(props, ref) {
|
|
|
116
120
|
labelAlign: labelAlign,
|
|
117
121
|
labelWidth: labelWidth,
|
|
118
122
|
wrapperWidth: wrapperWidth,
|
|
123
|
+
local: formLang,
|
|
119
124
|
vertical: layout === 'vertical'
|
|
120
125
|
});
|
|
121
|
-
}, [formInstance, labelAlign, labelWidth, wrapperWidth, layout]);
|
|
126
|
+
}, [formInstance, labelAlign, labelWidth, wrapperWidth, layout, formLang]);
|
|
122
127
|
|
|
123
128
|
var handleSubmit = function handleSubmit(evt) {
|
|
124
129
|
evt.preventDefault();
|
package/lib/form/interface.d.ts
CHANGED
|
@@ -25,11 +25,16 @@ export interface FormInstance<Values = any> {
|
|
|
25
25
|
submit: () => void;
|
|
26
26
|
getInternalHooks: (secret: string) => InternalHooks | null;
|
|
27
27
|
}
|
|
28
|
+
export interface InnerLocale {
|
|
29
|
+
locale: string;
|
|
30
|
+
requiredMessage: string;
|
|
31
|
+
}
|
|
28
32
|
export interface InternalFormInstance extends FormInstance {
|
|
29
33
|
labelWidth?: string | number;
|
|
30
34
|
labelAlign?: LabelAlign;
|
|
31
35
|
wrapperWidth?: string | number;
|
|
32
36
|
vertical?: boolean;
|
|
37
|
+
local?: InnerLocale;
|
|
33
38
|
getInternalHooks: (key: string) => InternalHooks | null;
|
|
34
39
|
}
|
|
35
40
|
export declare type Stores = {
|
|
@@ -21,6 +21,7 @@ export interface InputNumberProps extends InputProps {
|
|
|
21
21
|
mustInPrecisionScope?: boolean;
|
|
22
22
|
stepOption?: StepOption;
|
|
23
23
|
stepperrref?: any;
|
|
24
|
+
formatter?: (value: string | undefined) => string;
|
|
24
25
|
}
|
|
25
26
|
declare const InputNumber: React.ForwardRefExoticComponent<InputNumberProps & React.RefAttributes<unknown>>;
|
|
26
27
|
export default InputNumber;
|
|
@@ -84,7 +84,8 @@ var InternalInputNumber = function InternalInputNumber(props, ref) {
|
|
|
84
84
|
maxMark = inputNumberProps.maxMark,
|
|
85
85
|
prefix = inputNumberProps.prefix,
|
|
86
86
|
suffix = inputNumberProps.suffix,
|
|
87
|
-
|
|
87
|
+
formatter = inputNumberProps.formatter,
|
|
88
|
+
others = __rest(inputNumberProps, ["value", "defaultValue", "mustInScope", "decimalLength", "mustInPrecisionScope", "digitLength", "onChange", "symbol", "zeroShow", "showDecimalTailZero", "code", "roundMethod", "mask", "stepOption", "min", "minMark", "max", "maxMark", "prefix", "suffix", "formatter"]);
|
|
88
89
|
|
|
89
90
|
var initVal = value === undefined ? defaultValue : value;
|
|
90
91
|
|
|
@@ -364,7 +365,7 @@ var InternalInputNumber = function InternalInputNumber(props, ref) {
|
|
|
364
365
|
});
|
|
365
366
|
return /*#__PURE__*/_react.default.createElement(_input.default, (0, _extends2.default)({}, others, {
|
|
366
367
|
ref: inputNumberRef,
|
|
367
|
-
value: inputValue,
|
|
368
|
+
value: inputValue ? (formatter === null || formatter === void 0 ? void 0 : formatter(inputValue)) || inputValue : inputValue,
|
|
368
369
|
prefix: prefix,
|
|
369
370
|
suffix: suffix,
|
|
370
371
|
onChange: handleChange,
|
package/lib/locale/locale.d.ts
CHANGED
|
@@ -84,6 +84,7 @@ declare class LocaleCache {
|
|
|
84
84
|
'Filter.and': string;
|
|
85
85
|
'Filter.settings': string;
|
|
86
86
|
'Filter.schemeNamePlaceholder': string;
|
|
87
|
+
'Form.requiredMessage': string;
|
|
87
88
|
'DatePicker.placeholder': string;
|
|
88
89
|
'DatePicker.yearPlaceholder': string;
|
|
89
90
|
'DatePicker.quarterPlaceholder': string;
|
package/lib/locale/zh-CN.d.ts
CHANGED
|
@@ -58,6 +58,7 @@ declare const locale: {
|
|
|
58
58
|
'Filter.and': string;
|
|
59
59
|
'Filter.settings': string;
|
|
60
60
|
'Filter.schemeNamePlaceholder': string;
|
|
61
|
+
'Form.requiredMessage': string;
|
|
61
62
|
'DatePicker.placeholder': string;
|
|
62
63
|
'DatePicker.yearPlaceholder': string;
|
|
63
64
|
'DatePicker.quarterPlaceholder': string;
|
package/lib/locale/zh-CN.js
CHANGED
|
@@ -72,7 +72,8 @@ var locale = (0, _extends2.default)((0, _extends2.default)({
|
|
|
72
72
|
'Filter.query': '查询',
|
|
73
73
|
'Filter.and': '并且',
|
|
74
74
|
'Filter.settings': '设置',
|
|
75
|
-
'Filter.schemeNamePlaceholder': '请输入方案名称'
|
|
75
|
+
'Filter.schemeNamePlaceholder': '请输入方案名称',
|
|
76
|
+
'Form.requiredMessage': '请输入您的'
|
|
76
77
|
});
|
|
77
78
|
var _default = locale;
|
|
78
79
|
exports.default = _default;
|
package/lib/menu/subMenu.js
CHANGED
|
@@ -241,6 +241,11 @@ var SubMenu = function SubMenu(props) {
|
|
|
241
241
|
|
|
242
242
|
// 保存路径
|
|
243
243
|
info.keyPath = (0, _concat.default)(_context = info.keyPath).call(_context, [keyValue]);
|
|
244
|
+
|
|
245
|
+
if (triggerSubMenuAction === 'click' && mode === 'vertical') {
|
|
246
|
+
closeSubMenu();
|
|
247
|
+
}
|
|
248
|
+
|
|
244
249
|
restProps.handleOnClick && restProps.handleOnClick(info);
|
|
245
250
|
}; // 子菜单展开收缩
|
|
246
251
|
|
|
@@ -390,8 +395,7 @@ var SubMenu = function SubMenu(props) {
|
|
|
390
395
|
return /*#__PURE__*/React.createElement("li", (0, _extends2.default)({
|
|
391
396
|
ref: subMenuRef,
|
|
392
397
|
className: (0, _classnames.default)(prefixCls, className, (_classNames2 = {}, (0, _defineProperty2.default)(_classNames2, "".concat(prefixCls, "-collapsed"), collapsed), (0, _defineProperty2.default)(_classNames2, "".concat(prefixCls, "-disabled"), disabled), (0, _defineProperty2.default)(_classNames2, "".concat(prefixCls, "-hover"), !disabled && isVisible), _classNames2)),
|
|
393
|
-
key: keyValue
|
|
394
|
-
title: title
|
|
398
|
+
key: keyValue
|
|
395
399
|
}, mouseEvent, {
|
|
396
400
|
style: style
|
|
397
401
|
}), /*#__PURE__*/React.createElement("div", {
|
|
@@ -142,7 +142,7 @@
|
|
|
142
142
|
.kd-popconfirm.arrow::before {
|
|
143
143
|
position: absolute;
|
|
144
144
|
z-index: -2;
|
|
145
|
-
background:
|
|
145
|
+
background: var(--kd-c-popconfirm-color-background, var(--kd-g-color-background, #fff));
|
|
146
146
|
border-style: solid;
|
|
147
147
|
border-width: var(--arrowSize);
|
|
148
148
|
-webkit-transform: rotate(45deg);
|
|
@@ -167,7 +167,7 @@
|
|
|
167
167
|
top: var(--arrowSpill);
|
|
168
168
|
-webkit-box-shadow: -2px -2px calc(16px - 1px) rgba(0, 0, 0, 0.1);
|
|
169
169
|
box-shadow: -2px -2px calc(16px - 1px) rgba(0, 0, 0, 0.1);
|
|
170
|
-
border-color: var(--kd-g-color-
|
|
170
|
+
border-color: var(--kd-c-popconfirm-color-background, var(--kd-g-color-background, #fff)) transparent transparent var(--kd-c-popconfirm-color-background, var(--kd-g-color-background, #fff));
|
|
171
171
|
}
|
|
172
172
|
.kd-popconfirm.arrow.topLeft::before,
|
|
173
173
|
.kd-popconfirm.arrow.top::before,
|
|
@@ -176,7 +176,7 @@
|
|
|
176
176
|
bottom: var(--arrowSpill);
|
|
177
177
|
-webkit-box-shadow: 3px 3px calc(16px + 1px) rgba(0, 0, 0, 0.15);
|
|
178
178
|
box-shadow: 3px 3px calc(16px + 1px) rgba(0, 0, 0, 0.15);
|
|
179
|
-
border-color: transparent var(--kd-g-color-
|
|
179
|
+
border-color: transparent var(--kd-c-popconfirm-color-background, var(--kd-g-color-background, #fff)) var(--kd-c-popconfirm-color-background, var(--kd-g-color-background, #fff)) transparent;
|
|
180
180
|
}
|
|
181
181
|
.kd-popconfirm.arrow.leftTop::before,
|
|
182
182
|
.kd-popconfirm.arrow.left::before,
|
|
@@ -185,7 +185,7 @@
|
|
|
185
185
|
right: var(--arrowSpill);
|
|
186
186
|
-webkit-box-shadow: 3px 0 16px rgba(0, 0, 0, 0.12), 0 -2px 16px rgba(204, 149, 149, 0.12);
|
|
187
187
|
box-shadow: 3px 0 16px rgba(0, 0, 0, 0.12), 0 -2px 16px rgba(204, 149, 149, 0.12);
|
|
188
|
-
border-color: var(--kd-g-color-
|
|
188
|
+
border-color: var(--kd-c-popconfirm-color-background, var(--kd-g-color-background, #fff)) var(--kd-c-popconfirm-color-background, var(--kd-g-color-background, #fff)) transparent transparent;
|
|
189
189
|
}
|
|
190
190
|
.kd-popconfirm.arrow.rightTop::before,
|
|
191
191
|
.kd-popconfirm.arrow.right::before,
|
|
@@ -194,7 +194,7 @@
|
|
|
194
194
|
left: var(--arrowSpill);
|
|
195
195
|
-webkit-box-shadow: 0 3px 16px rgba(0, 0, 0, 0.1), -2px 0 16px rgba(0, 0, 0, 0.1);
|
|
196
196
|
box-shadow: 0 3px 16px rgba(0, 0, 0, 0.1), -2px 0 16px rgba(0, 0, 0, 0.1);
|
|
197
|
-
border-color: transparent transparent var(--kd-g-color-
|
|
197
|
+
border-color: transparent transparent var(--kd-c-popconfirm-color-background, var(--kd-g-color-background, #fff)) var(--kd-c-popconfirm-color-background, var(--kd-g-color-background, #fff));
|
|
198
198
|
}
|
|
199
199
|
.kd-popconfirm-content {
|
|
200
200
|
-webkit-box-sizing: border-box;
|
package/lib/select/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import { ISelectProps } from './interface';
|
|
2
|
+
import { ISelectProps, SelectValue } from './interface';
|
|
3
3
|
import Option from './option';
|
|
4
|
-
interface CompoundedComponent extends React.ForwardRefExoticComponent<ISelectProps & React.RefAttributes<HTMLElement>> {
|
|
4
|
+
interface CompoundedComponent extends React.ForwardRefExoticComponent<ISelectProps<SelectValue> & React.RefAttributes<HTMLElement>> {
|
|
5
5
|
Option: typeof Option;
|
|
6
6
|
}
|
|
7
7
|
declare const Select: CompoundedComponent;
|
|
@@ -43,17 +43,17 @@ export interface OptionsType {
|
|
|
43
43
|
value?: string;
|
|
44
44
|
label?: React.ReactNode;
|
|
45
45
|
}
|
|
46
|
-
export declare type SelectValue = string | string[] | number | number[] | LabeledValue | LabeledValue[] | null;
|
|
47
|
-
export interface ISelectProps<T
|
|
46
|
+
export declare type SelectValue = string | string[] | number | number[] | LabeledValue | LabeledValue[] | null | undefined;
|
|
47
|
+
export interface ISelectProps<T extends SelectValue> extends AbstractSelectProps {
|
|
48
48
|
value?: T;
|
|
49
49
|
defaultValue?: T;
|
|
50
50
|
mode?: Mode;
|
|
51
51
|
autoFocus?: boolean;
|
|
52
|
-
onChange?: (value
|
|
53
|
-
onSelect?: (value
|
|
54
|
-
onBlur?: (value
|
|
52
|
+
onChange?: (value?: T, option?: React.ReactElement<any> | React.ReactElement<any>[]) => void;
|
|
53
|
+
onSelect?: (value?: T extends (infer I)[] ? I : T, option?: React.ReactElement<any>) => void;
|
|
54
|
+
onBlur?: (value?: T) => void;
|
|
55
55
|
onFocus?: () => void;
|
|
56
|
-
onSearch?: () => void;
|
|
56
|
+
onSearch?: (value?: string) => void;
|
|
57
57
|
onClear?: () => void;
|
|
58
|
-
onDropdownVisibleChange?: (value
|
|
58
|
+
onDropdownVisibleChange?: (value?: T) => void;
|
|
59
59
|
}
|
package/lib/select/select.js
CHANGED
|
@@ -258,8 +258,19 @@ var InternalSelect = function InternalSelect(props, ref) {
|
|
|
258
258
|
onDropdownVisibleChange && onDropdownVisibleChange(!optionShow);
|
|
259
259
|
} // handleClear()
|
|
260
260
|
|
|
261
|
-
};
|
|
261
|
+
};
|
|
262
|
+
|
|
263
|
+
(0, _react.useEffect)(function () {
|
|
264
|
+
selectionRef.current.addEventListener('mouseup', function (e) {
|
|
265
|
+
var _a;
|
|
266
|
+
|
|
267
|
+
var isCloseBtn = ((_a = e === null || e === void 0 ? void 0 : e.target) === null || _a === void 0 ? void 0 : _a.className.indexOf('kd-tag-close-icon')) > -1;
|
|
262
268
|
|
|
269
|
+
if (isCloseBtn) {
|
|
270
|
+
e.stopPropagation();
|
|
271
|
+
}
|
|
272
|
+
});
|
|
273
|
+
}, []); // 点击下拉列表中某项回调
|
|
263
274
|
|
|
264
275
|
var handleOption = function handleOption(key, label, isSelected) {
|
|
265
276
|
var _a, _b, _c;
|