@kdcloudjs/kdesign 1.6.7 → 1.6.10
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 +27 -0
- package/dist/kdesign-complete.less +5 -21
- package/dist/kdesign.css +19 -19
- package/dist/kdesign.css.map +1 -1
- package/dist/kdesign.js +125 -92
- package/dist/kdesign.js.map +1 -1
- package/dist/kdesign.min.css +3 -3
- package/dist/kdesign.min.js +6 -6
- package/dist/kdesign.min.js.map +1 -1
- package/es/date-picker/date-picker.js +3 -1
- package/es/date-picker/range-picker.d.ts +1 -0
- package/es/date-picker/range-picker.js +4 -2
- package/es/dropdown/style/index.css +0 -18
- package/es/dropdown/style/index.less +0 -21
- package/es/form/Field.js +5 -1
- package/es/form/FieldContext.js +1 -0
- package/es/form/hooks/useForm.js +3 -3
- package/es/form/interface.d.ts +1 -0
- package/es/menu/style/index.css +18 -0
- package/es/menu/style/mixin.less +5 -0
- package/es/slider/slider.js +15 -13
- package/es/upload/interface.d.ts +7 -0
- package/es/upload/upload.js +96 -73
- package/lib/date-picker/date-picker.js +3 -1
- package/lib/date-picker/range-picker.d.ts +1 -0
- package/lib/date-picker/range-picker.js +4 -2
- package/lib/dropdown/style/index.css +0 -18
- package/lib/dropdown/style/index.less +0 -21
- package/lib/form/Field.js +5 -1
- package/lib/form/FieldContext.js +1 -0
- package/lib/form/hooks/useForm.js +3 -3
- package/lib/form/interface.d.ts +1 -0
- package/lib/menu/style/index.css +18 -0
- package/lib/menu/style/mixin.less +5 -0
- package/lib/slider/slider.js +14 -12
- package/lib/upload/interface.d.ts +7 -0
- package/lib/upload/upload.js +96 -73
- package/package.json +1 -1
|
@@ -68,6 +68,7 @@ function DatePicker(props) {
|
|
|
68
68
|
disabledHours = datePickerProps.disabledHours,
|
|
69
69
|
disabledMinutes = datePickerProps.disabledMinutes,
|
|
70
70
|
disabledSeconds = datePickerProps.disabledSeconds,
|
|
71
|
+
getPopupContainer = datePickerProps.getPopupContainer,
|
|
71
72
|
panelRender = datePickerProps.panelRender,
|
|
72
73
|
renderExtraFooter = datePickerProps.renderExtraFooter,
|
|
73
74
|
onChange = datePickerProps.onChange,
|
|
@@ -435,7 +436,8 @@ function DatePicker(props) {
|
|
|
435
436
|
popperClassName: dropdownClassName,
|
|
436
437
|
popperStyle: popupStyle,
|
|
437
438
|
visible: openValue,
|
|
438
|
-
placement: 'bottomLeft'
|
|
439
|
+
placement: 'bottomLeft',
|
|
440
|
+
getPopupContainer: getPopupContainer
|
|
439
441
|
});
|
|
440
442
|
}
|
|
441
443
|
|
|
@@ -28,6 +28,7 @@ export interface RangePickerSharedProps {
|
|
|
28
28
|
activePickerIndex?: 0 | 1;
|
|
29
29
|
dateRender?: RangeDateRender;
|
|
30
30
|
panelRender?: (originPanel: React.ReactNode) => React.ReactNode;
|
|
31
|
+
getPopupContainer?: (node: HTMLElement) => HTMLElement;
|
|
31
32
|
}
|
|
32
33
|
declare type OmitPickerProps<Props> = Omit<Props, 'value' | 'defaultValue' | 'defaultPickerValue' | 'placeholder' | 'disabled' | 'disabledTimePanel' | 'showToday' | 'showTime' | 'mode' | 'onChange' | 'onSelect' | 'onPanelChange' | 'pickerValue' | 'onPickerValueChange' | 'onOk' | 'dateRender'>;
|
|
33
34
|
export declare type RangeShowTimeObject = Omit<SharedTimeProps, 'defaultValue'> & {
|
|
@@ -113,7 +113,8 @@ function DatePicker(props) {
|
|
|
113
113
|
onCalendarChange = datePickerProps.onCalendarChange,
|
|
114
114
|
onFocus = datePickerProps.onFocus,
|
|
115
115
|
onBlur = datePickerProps.onBlur,
|
|
116
|
-
_onOk = datePickerProps.onOk
|
|
116
|
+
_onOk = datePickerProps.onOk,
|
|
117
|
+
getPopupContainer = datePickerProps.getPopupContainer;
|
|
117
118
|
var needConfirmButton = picker === 'date' && !!showTime || picker === 'time';
|
|
118
119
|
|
|
119
120
|
var datePickerLang = _extends({}, globalLocale.getCompLangMsg({
|
|
@@ -768,7 +769,8 @@ function DatePicker(props) {
|
|
|
768
769
|
popperClassName: className,
|
|
769
770
|
popperStyle: style,
|
|
770
771
|
visible: mergedOpen,
|
|
771
|
-
placement: 'bottomLeft'
|
|
772
|
+
placement: 'bottomLeft',
|
|
773
|
+
getPopupContainer: getPopupContainer
|
|
772
774
|
});
|
|
773
775
|
}
|
|
774
776
|
|
|
@@ -104,24 +104,6 @@
|
|
|
104
104
|
/* 多行显示省略号 */
|
|
105
105
|
/* 单行显示省略号 */
|
|
106
106
|
/** 浮层箭头样式 **/
|
|
107
|
-
.kd-dropdown-link {
|
|
108
|
-
color: var(--kd-g-color-theme, #5582f3);
|
|
109
|
-
text-decoration: none;
|
|
110
|
-
background-color: transparent;
|
|
111
|
-
outline: noned;
|
|
112
|
-
cursor: pointer;
|
|
113
|
-
-webkit-transition: color var(--kd-g-duration, 0.3s), background-color var(--kd-g-duration, 0.3s);
|
|
114
|
-
transition: color var(--kd-g-duration, 0.3s), background-color var(--kd-g-duration, 0.3s);
|
|
115
|
-
-webkit-text-decoration-skip: objects;
|
|
116
|
-
}
|
|
117
|
-
.kd-dropdown-link.disabled,
|
|
118
|
-
.kd-dropdown-link.disabled:hover {
|
|
119
|
-
cursor: default;
|
|
120
|
-
color: var(--kd-g-color-disabled, #b2b2b2);
|
|
121
|
-
}
|
|
122
|
-
.kd-dropdown-link:hover {
|
|
123
|
-
color: var(--kd-g-color-theme-5, #87adff);
|
|
124
|
-
}
|
|
125
107
|
.kd-dropdown-trigger {
|
|
126
108
|
outline: none;
|
|
127
109
|
}
|
|
@@ -4,30 +4,9 @@
|
|
|
4
4
|
|
|
5
5
|
@dropdown-prefix-cls: ~'@{kd-prefix}-dropdown';
|
|
6
6
|
@dropdown-trigger-prefix-cls: ~'@{dropdown-prefix-cls}-trigger';
|
|
7
|
-
@dropdown-link-prefix-cls: ~'@{dropdown-prefix-cls}-link';
|
|
8
7
|
|
|
9
8
|
@dropdown-line-height: 18px;
|
|
10
9
|
|
|
11
|
-
.@{dropdown-link-prefix-cls} {
|
|
12
|
-
color: @color-theme;
|
|
13
|
-
text-decoration: none;
|
|
14
|
-
background-color: transparent;
|
|
15
|
-
outline: noned;
|
|
16
|
-
cursor: pointer;
|
|
17
|
-
transition: color @duration-promptly, background-color @duration-promptly;
|
|
18
|
-
-webkit-text-decoration-skip: objects;
|
|
19
|
-
|
|
20
|
-
&.disabled,
|
|
21
|
-
&.disabled:hover {
|
|
22
|
-
cursor: default;
|
|
23
|
-
color: @color-disabled;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
&:hover {
|
|
27
|
-
color: @color-theme-hover;
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
|
|
31
10
|
.@{dropdown-trigger-prefix-cls} {
|
|
32
11
|
outline: none;
|
|
33
12
|
}
|
package/es/form/Field.js
CHANGED
|
@@ -99,6 +99,7 @@ var Field = function Field(props) {
|
|
|
99
99
|
vertical = fieldContext.vertical,
|
|
100
100
|
getDefaultValue = fieldContext.getDefaultValue,
|
|
101
101
|
local = fieldContext.local,
|
|
102
|
+
setRules = fieldContext.setRules,
|
|
102
103
|
formDisabled = fieldContext.disabled;
|
|
103
104
|
|
|
104
105
|
var _getInternalHooks = getInternalHooks(INTERNAL_HOOK_KEY),
|
|
@@ -174,7 +175,7 @@ var Field = function Field(props) {
|
|
|
174
175
|
|
|
175
176
|
return false;
|
|
176
177
|
});
|
|
177
|
-
var mergedRequired = required ||
|
|
178
|
+
var mergedRequired = required || rulesRequired;
|
|
178
179
|
|
|
179
180
|
if (Array.isArray(rules) && !rules.some(function (rule) {
|
|
180
181
|
return Object.prototype.hasOwnProperty.call(rule, 'required');
|
|
@@ -214,6 +215,9 @@ var Field = function Field(props) {
|
|
|
214
215
|
setDefaultValues(_defineProperty({}, name, defaultValue));
|
|
215
216
|
}
|
|
216
217
|
}, [name, registerField]);
|
|
218
|
+
useEffect(function () {
|
|
219
|
+
setRules(name, mergeRules);
|
|
220
|
+
}, [mergedRequired, name, mergeRules]);
|
|
217
221
|
var formPrefixCls = getPrefixCls === null || getPrefixCls === void 0 ? void 0 : getPrefixCls(prefixCls, 'form', customizePrefixcls);
|
|
218
222
|
var formItemClassName = classnames((_classnames = {}, _defineProperty(_classnames, "".concat(formPrefixCls), true), _defineProperty(_classnames, "".concat(formPrefixCls, "-field"), true), _defineProperty(_classnames, "".concat(formPrefixCls, "-field-hidden"), hidden), _defineProperty(_classnames, "".concat(formPrefixCls, "-field-vertical"), vertical), _classnames), className);
|
|
219
223
|
var value = getFieldValue(name);
|
package/es/form/FieldContext.js
CHANGED
|
@@ -14,6 +14,7 @@ var context = /*#__PURE__*/React.createContext({
|
|
|
14
14
|
resetFields: warningFunc,
|
|
15
15
|
setFieldsValue: warningFunc,
|
|
16
16
|
setFieldValue: warningFunc,
|
|
17
|
+
setRules: warningFunc,
|
|
17
18
|
submit: warningFunc,
|
|
18
19
|
validateFields: warningFunc,
|
|
19
20
|
getInternalHooks: function getInternalHooks() {
|
package/es/form/hooks/useForm.js
CHANGED
|
@@ -42,6 +42,7 @@ var FormStore = /*#__PURE__*/_createClass(function FormStore() {
|
|
|
42
42
|
resetFields: _this.resetFields,
|
|
43
43
|
setFieldValue: _this.setFieldValue,
|
|
44
44
|
setFieldsValue: _this.setFieldsValue,
|
|
45
|
+
setRules: _this.setRules,
|
|
45
46
|
validateFields: _this.validateFields,
|
|
46
47
|
submit: _this.submit,
|
|
47
48
|
getInternalHooks: _this.getInternalHooks
|
|
@@ -295,17 +296,16 @@ var FormStore = /*#__PURE__*/_createClass(function FormStore() {
|
|
|
295
296
|
_this.notifyObservers(_this.store, namePathList || [], 'validateFinish');
|
|
296
297
|
}).catch(function (_ref2) {
|
|
297
298
|
var errorInfos = _ref2.errorInfos;
|
|
299
|
+
_this.errorMessages = {};
|
|
298
300
|
var _errorInfos$fields = errorInfos.fields,
|
|
299
301
|
fields = _errorInfos$fields === void 0 ? {} : _errorInfos$fields;
|
|
300
302
|
|
|
301
303
|
_Object$keys(fields).forEach(function (name) {
|
|
302
|
-
// 取第一个错误的信息
|
|
303
304
|
_this.errorMessages[name] = fields[name][0].message;
|
|
304
305
|
});
|
|
305
306
|
|
|
306
307
|
_this.notifyObservers(_this.store, namePathList || [], 'validateFinish');
|
|
307
|
-
});
|
|
308
|
-
|
|
308
|
+
});
|
|
309
309
|
return validatePromise;
|
|
310
310
|
};
|
|
311
311
|
|
package/es/form/interface.d.ts
CHANGED
|
@@ -21,6 +21,7 @@ export interface FormInstance<Values = any> {
|
|
|
21
21
|
resetFields: (fields?: NamePath[]) => void;
|
|
22
22
|
setFieldsValue: (value: Values) => void;
|
|
23
23
|
setFieldValue: (name: NamePath, value: Values) => void;
|
|
24
|
+
setRules: (name: NamePath, rules: any) => void;
|
|
24
25
|
validateFields: (namePathList?: NamePath[]) => Promise<Values>;
|
|
25
26
|
submit: () => void;
|
|
26
27
|
getInternalHooks: (secret: string) => InternalHooks | null;
|
package/es/menu/style/index.css
CHANGED
|
@@ -129,6 +129,12 @@
|
|
|
129
129
|
color: var(--kd-c-menu-light-color-text, var(--kd-g-color-text-primary, #212121));
|
|
130
130
|
background: #fafafa;
|
|
131
131
|
}
|
|
132
|
+
.menu-light-base .kd-menu-submenu:not(.kd-menu-submenu-disabled):not(.kd-menu-submenu-active):hover,
|
|
133
|
+
.menu-light-base .kd-menu-submenu-hover {
|
|
134
|
+
background-color: var(--kd-c-menu-light-color-background-hover, #f5f5f5);
|
|
135
|
+
color: var(--kd-c-menu-light-color-text-hover, var(--kd-g-color-text-primary, #212121));
|
|
136
|
+
border: none;
|
|
137
|
+
}
|
|
132
138
|
.menu-light-base .kd-menu-item:not(.kd-menu-item-disabled):not(.kd-menu-item-active):hover {
|
|
133
139
|
background-color: var(--kd-c-menu-light-color-background-hover, #f5f5f5);
|
|
134
140
|
color: var(--kd-c-menu-light-color-text-hover, var(--kd-g-color-text-primary, #212121));
|
|
@@ -477,6 +483,12 @@
|
|
|
477
483
|
color: var(--kd-c-menu-light-color-text, var(--kd-g-color-text-primary, #212121));
|
|
478
484
|
background: #fafafa;
|
|
479
485
|
}
|
|
486
|
+
.kd-menu-light .kd-menu-submenu:not(.kd-menu-submenu-disabled):not(.kd-menu-submenu-active):hover,
|
|
487
|
+
.kd-menu-light .kd-menu-submenu-hover {
|
|
488
|
+
background-color: var(--kd-c-menu-light-color-background-hover, #f5f5f5);
|
|
489
|
+
color: var(--kd-c-menu-light-color-text-hover, var(--kd-g-color-text-primary, #212121));
|
|
490
|
+
border: none;
|
|
491
|
+
}
|
|
480
492
|
.kd-menu-light .kd-menu-item:not(.kd-menu-item-disabled):not(.kd-menu-item-active):hover {
|
|
481
493
|
background-color: var(--kd-c-menu-light-color-background-hover, #f5f5f5);
|
|
482
494
|
color: var(--kd-c-menu-light-color-text-hover, var(--kd-g-color-text-primary, #212121));
|
|
@@ -569,6 +581,12 @@
|
|
|
569
581
|
color: var(--kd-c-menu-light-color-text, var(--kd-g-color-text-primary, #212121));
|
|
570
582
|
background: #fafafa;
|
|
571
583
|
}
|
|
584
|
+
.kd-menu-popper.light .kd-menu-submenu:not(.kd-menu-submenu-disabled):not(.kd-menu-submenu-active):hover,
|
|
585
|
+
.kd-menu-popper.light .kd-menu-submenu-hover {
|
|
586
|
+
background-color: var(--kd-c-menu-light-color-background-hover, #f5f5f5);
|
|
587
|
+
color: var(--kd-c-menu-light-color-text-hover, var(--kd-g-color-text-primary, #212121));
|
|
588
|
+
border: none;
|
|
589
|
+
}
|
|
572
590
|
.kd-menu-popper.light .kd-menu-item:not(.kd-menu-item-disabled):not(.kd-menu-item-active):hover {
|
|
573
591
|
background-color: var(--kd-c-menu-light-color-background-hover, #f5f5f5);
|
|
574
592
|
color: var(--kd-c-menu-light-color-text-hover, var(--kd-g-color-text-primary, #212121));
|
package/es/menu/style/mixin.less
CHANGED
|
@@ -107,6 +107,11 @@
|
|
|
107
107
|
background: #fafafa;
|
|
108
108
|
}
|
|
109
109
|
|
|
110
|
+
.@{submenu-prefix-cls}:not(.@{submenu-prefix-cls}-disabled):not(.@{submenu-prefix-cls}-active):hover,
|
|
111
|
+
.@{submenu-prefix-cls}-hover {
|
|
112
|
+
.menu-light-hover();
|
|
113
|
+
}
|
|
114
|
+
|
|
110
115
|
.@{menuitem-prefix-cls}:not(.@{menuitem-prefix-cls}-disabled):not(.@{menuitem-prefix-cls}-active):hover {
|
|
111
116
|
.menu-light-hover();
|
|
112
117
|
}
|
package/es/slider/slider.js
CHANGED
|
@@ -16,7 +16,7 @@ var __rest = this && this.__rest || function (s, e) {
|
|
|
16
16
|
return t;
|
|
17
17
|
};
|
|
18
18
|
|
|
19
|
-
import React, { useContext, useEffect, useRef
|
|
19
|
+
import React, { useContext, useEffect, useRef } from 'react';
|
|
20
20
|
import classNames from 'classnames';
|
|
21
21
|
import ConfigContext from '../config-provider/ConfigContext';
|
|
22
22
|
import { getCompProps } from '../_utils';
|
|
@@ -75,11 +75,11 @@ var InteranalSlider = function InteranalSlider(props, ref) {
|
|
|
75
75
|
value = _useMergedState2[0],
|
|
76
76
|
setValue = _useMergedState2[1];
|
|
77
77
|
|
|
78
|
-
var
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
78
|
+
var isDragging = useRef(false);
|
|
79
|
+
var valueRef = useRef(useMergedState(0, {
|
|
80
|
+
defaultValue: defaultValue,
|
|
81
|
+
value: propsValue
|
|
82
|
+
}));
|
|
83
83
|
var mouseOffset;
|
|
84
84
|
|
|
85
85
|
var addDocumentMouseEvents = function addDocumentMouseEvents() {
|
|
@@ -151,11 +151,11 @@ var InteranalSlider = function InteranalSlider(props, ref) {
|
|
|
151
151
|
var onEnd = function onEnd() {
|
|
152
152
|
removeDocumentEvents();
|
|
153
153
|
|
|
154
|
-
if (
|
|
155
|
-
onAfterChange && onAfterChange(
|
|
154
|
+
if (isDragging.current) {
|
|
155
|
+
onAfterChange && onAfterChange(valueRef.current);
|
|
156
156
|
}
|
|
157
157
|
|
|
158
|
-
|
|
158
|
+
isDragging.current = false;
|
|
159
159
|
};
|
|
160
160
|
|
|
161
161
|
var handleTouchStart = function handleTouchStart() {// console.log('object :>> ', 'object', addDocumentMouseEvents)
|
|
@@ -178,11 +178,12 @@ var InteranalSlider = function InteranalSlider(props, ref) {
|
|
|
178
178
|
} // 设置状态值
|
|
179
179
|
|
|
180
180
|
|
|
181
|
-
|
|
181
|
+
isDragging.current = true;
|
|
182
182
|
var newV = calcValueByPos(position);
|
|
183
183
|
|
|
184
184
|
if (newV !== value) {
|
|
185
185
|
setValue(newV);
|
|
186
|
+
valueRef.current = newV;
|
|
186
187
|
}
|
|
187
188
|
|
|
188
189
|
onChange && onChange(newV); // 监听document的鼠标事件
|
|
@@ -209,11 +210,11 @@ var InteranalSlider = function InteranalSlider(props, ref) {
|
|
|
209
210
|
if (!sliderRef.current) {
|
|
210
211
|
removeDocumentEvents();
|
|
211
212
|
|
|
212
|
-
if (
|
|
213
|
+
if (isDragging.current) {
|
|
213
214
|
onAfterChange(value);
|
|
214
215
|
}
|
|
215
216
|
|
|
216
|
-
|
|
217
|
+
isDragging.current = false;
|
|
217
218
|
return;
|
|
218
219
|
}
|
|
219
220
|
|
|
@@ -222,6 +223,7 @@ var InteranalSlider = function InteranalSlider(props, ref) {
|
|
|
222
223
|
|
|
223
224
|
if (newV !== value) {
|
|
224
225
|
setValue(newV);
|
|
226
|
+
valueRef.current = newV;
|
|
225
227
|
}
|
|
226
228
|
|
|
227
229
|
onChange && onChange(newV);
|
|
@@ -239,7 +241,7 @@ var InteranalSlider = function InteranalSlider(props, ref) {
|
|
|
239
241
|
style: style,
|
|
240
242
|
onTouchStart: disabled ? noop : handleTouchStart,
|
|
241
243
|
onMouseDown: disabled ? noop : handleMouseDown,
|
|
242
|
-
onMouseUp
|
|
244
|
+
// onMouseUp={disabled ? noop : handleMouseUp}
|
|
243
245
|
onKeyDown: disabled ? noop : handleKeyDown,
|
|
244
246
|
onFocus: disabled ? noop : handleFocus,
|
|
245
247
|
onBlur: disabled ? noop : handleBlur
|
package/es/upload/interface.d.ts
CHANGED
|
@@ -141,4 +141,11 @@ export interface UploadRequestOption<T = any> {
|
|
|
141
141
|
headers?: HttpRequestHeader;
|
|
142
142
|
method: UploadRequestMethod;
|
|
143
143
|
}
|
|
144
|
+
export interface IFileItem {
|
|
145
|
+
file: UploadFile;
|
|
146
|
+
prefixCls: string;
|
|
147
|
+
listType: string;
|
|
148
|
+
handleReUpload: (file: UploadFile, e: React.MouseEvent) => void;
|
|
149
|
+
handleRemove: (file: UploadFile, e: React.MouseEvent) => void;
|
|
150
|
+
}
|
|
144
151
|
export {};
|
package/es/upload/upload.js
CHANGED
|
@@ -109,6 +109,7 @@ var InternalUpload = function InternalUpload(props, ref) {
|
|
|
109
109
|
onRemove = allProps.onRemove,
|
|
110
110
|
directory = allProps.directory,
|
|
111
111
|
className = allProps.className,
|
|
112
|
+
itemRender = allProps.itemRender,
|
|
112
113
|
showUploadList = allProps.showUploadList,
|
|
113
114
|
customPrefixcls = allProps.prefixCls;
|
|
114
115
|
|
|
@@ -359,13 +360,6 @@ var InternalUpload = function InternalUpload(props, ref) {
|
|
|
359
360
|
directory: directory ? 'directory' : undefined,
|
|
360
361
|
webkitdirectory: directory ? 'webkitdirectory' : undefined
|
|
361
362
|
};
|
|
362
|
-
var mapStatus = {
|
|
363
|
-
uploading: 'loadding',
|
|
364
|
-
error: 'warning-solid',
|
|
365
|
-
done: 'attachment',
|
|
366
|
-
success: 'attachment',
|
|
367
|
-
notStart: 'attachment'
|
|
368
|
-
};
|
|
369
363
|
var dragEvents = {};
|
|
370
364
|
|
|
371
365
|
var _React$useState3 = React.useState(false),
|
|
@@ -461,76 +455,105 @@ var InternalUpload = function InternalUpload(props, ref) {
|
|
|
461
455
|
}, inputFileProps, {
|
|
462
456
|
ref: mergedRef
|
|
463
457
|
}))))), showUploadList && _mapInstanceProperty(fileList).call(fileList, function (file) {
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
title: file.name
|
|
479
|
-
}, file.name), /*#__PURE__*/React.createElement("span", {
|
|
480
|
-
className: _concatInstanceProperty(_context11 = "".concat(prefixCls, "-")).call(_context11, listType, "-list-item-size")
|
|
481
|
-
}, "(", getFileSize(file.size), ")"), /*#__PURE__*/React.createElement("div", {
|
|
482
|
-
className: _concatInstanceProperty(_context12 = "".concat(prefixCls, "-")).call(_context12, listType, "-list-item-action")
|
|
483
|
-
}, file.status === 'error' && /*#__PURE__*/React.createElement("a", {
|
|
484
|
-
href: "true",
|
|
485
|
-
className: _concatInstanceProperty(_context13 = "".concat(prefixCls, "-")).call(_context13, listType, "-list-item-reupload"),
|
|
486
|
-
onClick: handleReUpload.bind(_this, file)
|
|
487
|
-
}, "\u91CD\u65B0\u4E0A\u4F20"), /*#__PURE__*/React.createElement("a", {
|
|
488
|
-
href: "true",
|
|
489
|
-
className: _concatInstanceProperty(_context14 = "".concat(prefixCls, "-")).call(_context14, listType, "-list-item-delete"),
|
|
490
|
-
onClick: handleRemove.bind(_this, file)
|
|
491
|
-
}, "\u5220\u9664"))) : file.status === 'uploading' ? /*#__PURE__*/React.createElement("div", {
|
|
492
|
-
className: _concatInstanceProperty(_context15 = "".concat(prefixCls, "-")).call(_context15, listType, "-list-item-loading")
|
|
493
|
-
}, /*#__PURE__*/React.createElement(Progress, {
|
|
494
|
-
percent: file.percent,
|
|
495
|
-
textMap: ['文件上传中'],
|
|
496
|
-
showInfo: false
|
|
497
|
-
})) : file.status === 'error' ? /*#__PURE__*/React.createElement("div", {
|
|
498
|
-
className: _concatInstanceProperty(_context16 = "".concat(prefixCls, "-")).call(_context16, listType, "-list-item-error")
|
|
499
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
500
|
-
className: _concatInstanceProperty(_context17 = "".concat(prefixCls, "-")).call(_context17, listType, "-list-item-error-text")
|
|
501
|
-
}, /*#__PURE__*/React.createElement(Icon, {
|
|
502
|
-
type: mapStatus[file.status],
|
|
503
|
-
style: {
|
|
504
|
-
verticalAlign: 'top'
|
|
505
|
-
}
|
|
506
|
-
}), "\u4E0A\u4F20\u5931\u8D25"), /*#__PURE__*/React.createElement("div", {
|
|
507
|
-
className: _concatInstanceProperty(_context18 = "".concat(prefixCls, "-")).call(_context18, listType, "-list-item-action")
|
|
508
|
-
}, /*#__PURE__*/React.createElement("a", {
|
|
509
|
-
href: "true",
|
|
510
|
-
className: _concatInstanceProperty(_context19 = "".concat(prefixCls, "-")).call(_context19, listType, "-list-item-reupload"),
|
|
511
|
-
onClick: handleReUpload.bind(_this, file)
|
|
512
|
-
}, "\u91CD\u65B0\u4E0A\u4F20"), /*#__PURE__*/React.createElement("a", {
|
|
513
|
-
href: "true",
|
|
514
|
-
className: _concatInstanceProperty(_context20 = "".concat(prefixCls, "-")).call(_context20, listType, "-list-item-delete"),
|
|
515
|
-
onClick: handleRemove.bind(_this, file)
|
|
516
|
-
}, "\u5220\u9664"))) : /*#__PURE__*/React.createElement(Image, {
|
|
517
|
-
previewType: "upload",
|
|
518
|
-
name: file.name,
|
|
519
|
-
size: getFileSize(file.size),
|
|
520
|
-
src: file.thumbUrl || file.url,
|
|
521
|
-
style: {
|
|
522
|
-
width: '100%',
|
|
523
|
-
height: '100%'
|
|
524
|
-
},
|
|
525
|
-
operations: [/*#__PURE__*/React.createElement(Icon, {
|
|
526
|
-
key: "1",
|
|
527
|
-
type: "delete",
|
|
528
|
-
onClick: handleRemove.bind(_this, file)
|
|
529
|
-
})]
|
|
458
|
+
return itemRender ? itemRender( /*#__PURE__*/React.createElement(Item, _extends({}, {
|
|
459
|
+
file: file,
|
|
460
|
+
prefixCls: prefixCls,
|
|
461
|
+
listType: listType,
|
|
462
|
+
handleReUpload: handleReUpload,
|
|
463
|
+
handleRemove: handleRemove
|
|
464
|
+
})), file, setFileList) : /*#__PURE__*/React.createElement(Item, _extends({
|
|
465
|
+
key: file.uid
|
|
466
|
+
}, {
|
|
467
|
+
file: file,
|
|
468
|
+
prefixCls: prefixCls,
|
|
469
|
+
listType: listType,
|
|
470
|
+
handleReUpload: handleReUpload,
|
|
471
|
+
handleRemove: handleRemove
|
|
530
472
|
}));
|
|
531
473
|
})));
|
|
532
474
|
};
|
|
533
475
|
|
|
476
|
+
var Item = function Item(_ref3) {
|
|
477
|
+
var _context8, _context9, _context10, _context11, _context12, _context13, _context14, _context15, _context16, _context17, _context18, _context19, _context20;
|
|
478
|
+
|
|
479
|
+
var file = _ref3.file,
|
|
480
|
+
prefixCls = _ref3.prefixCls,
|
|
481
|
+
listType = _ref3.listType,
|
|
482
|
+
handleReUpload = _ref3.handleReUpload,
|
|
483
|
+
handleRemove = _ref3.handleRemove;
|
|
484
|
+
var mapStatus = {
|
|
485
|
+
uploading: 'loadding',
|
|
486
|
+
error: 'warning-solid',
|
|
487
|
+
done: 'attachment',
|
|
488
|
+
success: 'attachment',
|
|
489
|
+
notStart: 'attachment'
|
|
490
|
+
};
|
|
491
|
+
return /*#__PURE__*/React.createElement("li", {
|
|
492
|
+
className: classNames(_concatInstanceProperty(_context8 = "".concat(prefixCls, "-")).call(_context8, listType, "-list-item"), {
|
|
493
|
+
error: file.status === 'error'
|
|
494
|
+
})
|
|
495
|
+
}, listType === 'text' ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("span", {
|
|
496
|
+
className: _concatInstanceProperty(_context9 = "".concat(prefixCls, "-")).call(_context9, listType, "-list-item-icon")
|
|
497
|
+
}, /*#__PURE__*/React.createElement(Icon, {
|
|
498
|
+
spin: file.status === 'uploading',
|
|
499
|
+
type: mapStatus[file.status]
|
|
500
|
+
})), /*#__PURE__*/React.createElement("span", {
|
|
501
|
+
className: _concatInstanceProperty(_context10 = "".concat(prefixCls, "-")).call(_context10, listType, "-list-item-name"),
|
|
502
|
+
title: file.name
|
|
503
|
+
}, file.name), /*#__PURE__*/React.createElement("span", {
|
|
504
|
+
className: _concatInstanceProperty(_context11 = "".concat(prefixCls, "-")).call(_context11, listType, "-list-item-size")
|
|
505
|
+
}, "(", getFileSize(file.size), ")"), /*#__PURE__*/React.createElement("div", {
|
|
506
|
+
className: _concatInstanceProperty(_context12 = "".concat(prefixCls, "-")).call(_context12, listType, "-list-item-action")
|
|
507
|
+
}, file.status === 'error' && /*#__PURE__*/React.createElement("a", {
|
|
508
|
+
href: "true",
|
|
509
|
+
className: _concatInstanceProperty(_context13 = "".concat(prefixCls, "-")).call(_context13, listType, "-list-item-reupload"),
|
|
510
|
+
onClick: handleReUpload.bind(_this, file)
|
|
511
|
+
}, "\u91CD\u65B0\u4E0A\u4F20"), /*#__PURE__*/React.createElement("a", {
|
|
512
|
+
href: "true",
|
|
513
|
+
className: _concatInstanceProperty(_context14 = "".concat(prefixCls, "-")).call(_context14, listType, "-list-item-delete"),
|
|
514
|
+
onClick: handleRemove.bind(_this, file)
|
|
515
|
+
}, "\u5220\u9664"))) : file.status === 'uploading' ? /*#__PURE__*/React.createElement("div", {
|
|
516
|
+
className: _concatInstanceProperty(_context15 = "".concat(prefixCls, "-")).call(_context15, listType, "-list-item-loading")
|
|
517
|
+
}, /*#__PURE__*/React.createElement(Progress, {
|
|
518
|
+
percent: file.percent,
|
|
519
|
+
textMap: ['文件上传中'],
|
|
520
|
+
showInfo: false
|
|
521
|
+
})) : file.status === 'error' ? /*#__PURE__*/React.createElement("div", {
|
|
522
|
+
className: _concatInstanceProperty(_context16 = "".concat(prefixCls, "-")).call(_context16, listType, "-list-item-error")
|
|
523
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
524
|
+
className: _concatInstanceProperty(_context17 = "".concat(prefixCls, "-")).call(_context17, listType, "-list-item-error-text")
|
|
525
|
+
}, /*#__PURE__*/React.createElement(Icon, {
|
|
526
|
+
type: mapStatus[file.status],
|
|
527
|
+
style: {
|
|
528
|
+
verticalAlign: 'top'
|
|
529
|
+
}
|
|
530
|
+
}), "\u4E0A\u4F20\u5931\u8D25"), /*#__PURE__*/React.createElement("div", {
|
|
531
|
+
className: _concatInstanceProperty(_context18 = "".concat(prefixCls, "-")).call(_context18, listType, "-list-item-action")
|
|
532
|
+
}, /*#__PURE__*/React.createElement("a", {
|
|
533
|
+
href: "true",
|
|
534
|
+
className: _concatInstanceProperty(_context19 = "".concat(prefixCls, "-")).call(_context19, listType, "-list-item-reupload"),
|
|
535
|
+
onClick: handleReUpload.bind(_this, file)
|
|
536
|
+
}, "\u91CD\u65B0\u4E0A\u4F20"), /*#__PURE__*/React.createElement("a", {
|
|
537
|
+
href: "true",
|
|
538
|
+
className: _concatInstanceProperty(_context20 = "".concat(prefixCls, "-")).call(_context20, listType, "-list-item-delete"),
|
|
539
|
+
onClick: handleRemove.bind(_this, file)
|
|
540
|
+
}, "\u5220\u9664"))) : /*#__PURE__*/React.createElement(Image, {
|
|
541
|
+
previewType: "upload",
|
|
542
|
+
name: file.name,
|
|
543
|
+
size: getFileSize(file.size),
|
|
544
|
+
src: file.thumbUrl || file.url,
|
|
545
|
+
style: {
|
|
546
|
+
width: '100%',
|
|
547
|
+
height: '100%'
|
|
548
|
+
},
|
|
549
|
+
operations: [/*#__PURE__*/React.createElement(Icon, {
|
|
550
|
+
key: "1",
|
|
551
|
+
type: "delete",
|
|
552
|
+
onClick: handleRemove.bind(_this, file)
|
|
553
|
+
})]
|
|
554
|
+
}));
|
|
555
|
+
};
|
|
556
|
+
|
|
534
557
|
var Upload = /*#__PURE__*/React.forwardRef(InternalUpload);
|
|
535
558
|
Upload.displayName = 'Upload';
|
|
536
559
|
export default Upload;
|
|
@@ -105,6 +105,7 @@ function DatePicker(props) {
|
|
|
105
105
|
disabledHours = datePickerProps.disabledHours,
|
|
106
106
|
disabledMinutes = datePickerProps.disabledMinutes,
|
|
107
107
|
disabledSeconds = datePickerProps.disabledSeconds,
|
|
108
|
+
getPopupContainer = datePickerProps.getPopupContainer,
|
|
108
109
|
panelRender = datePickerProps.panelRender,
|
|
109
110
|
renderExtraFooter = datePickerProps.renderExtraFooter,
|
|
110
111
|
onChange = datePickerProps.onChange,
|
|
@@ -473,7 +474,8 @@ function DatePicker(props) {
|
|
|
473
474
|
popperClassName: dropdownClassName,
|
|
474
475
|
popperStyle: popupStyle,
|
|
475
476
|
visible: openValue,
|
|
476
|
-
placement: 'bottomLeft'
|
|
477
|
+
placement: 'bottomLeft',
|
|
478
|
+
getPopupContainer: getPopupContainer
|
|
477
479
|
});
|
|
478
480
|
}
|
|
479
481
|
|
|
@@ -28,6 +28,7 @@ export interface RangePickerSharedProps {
|
|
|
28
28
|
activePickerIndex?: 0 | 1;
|
|
29
29
|
dateRender?: RangeDateRender;
|
|
30
30
|
panelRender?: (originPanel: React.ReactNode) => React.ReactNode;
|
|
31
|
+
getPopupContainer?: (node: HTMLElement) => HTMLElement;
|
|
31
32
|
}
|
|
32
33
|
declare type OmitPickerProps<Props> = Omit<Props, 'value' | 'defaultValue' | 'defaultPickerValue' | 'placeholder' | 'disabled' | 'disabledTimePanel' | 'showToday' | 'showTime' | 'mode' | 'onChange' | 'onSelect' | 'onPanelChange' | 'pickerValue' | 'onPickerValueChange' | 'onOk' | 'dateRender'>;
|
|
33
34
|
export declare type RangeShowTimeObject = Omit<SharedTimeProps, 'defaultValue'> & {
|
|
@@ -157,7 +157,8 @@ function DatePicker(props) {
|
|
|
157
157
|
onCalendarChange = datePickerProps.onCalendarChange,
|
|
158
158
|
onFocus = datePickerProps.onFocus,
|
|
159
159
|
onBlur = datePickerProps.onBlur,
|
|
160
|
-
_onOk = datePickerProps.onOk
|
|
160
|
+
_onOk = datePickerProps.onOk,
|
|
161
|
+
getPopupContainer = datePickerProps.getPopupContainer;
|
|
161
162
|
var needConfirmButton = picker === 'date' && !!showTime || picker === 'time';
|
|
162
163
|
var datePickerLang = (0, _extends2.default)({}, globalLocale.getCompLangMsg({
|
|
163
164
|
componentName: 'DatePicker'
|
|
@@ -820,7 +821,8 @@ function DatePicker(props) {
|
|
|
820
821
|
popperClassName: className,
|
|
821
822
|
popperStyle: style,
|
|
822
823
|
visible: mergedOpen,
|
|
823
|
-
placement: 'bottomLeft'
|
|
824
|
+
placement: 'bottomLeft',
|
|
825
|
+
getPopupContainer: getPopupContainer
|
|
824
826
|
});
|
|
825
827
|
}
|
|
826
828
|
|
|
@@ -104,24 +104,6 @@
|
|
|
104
104
|
/* 多行显示省略号 */
|
|
105
105
|
/* 单行显示省略号 */
|
|
106
106
|
/** 浮层箭头样式 **/
|
|
107
|
-
.kd-dropdown-link {
|
|
108
|
-
color: var(--kd-g-color-theme, #5582f3);
|
|
109
|
-
text-decoration: none;
|
|
110
|
-
background-color: transparent;
|
|
111
|
-
outline: noned;
|
|
112
|
-
cursor: pointer;
|
|
113
|
-
-webkit-transition: color var(--kd-g-duration, 0.3s), background-color var(--kd-g-duration, 0.3s);
|
|
114
|
-
transition: color var(--kd-g-duration, 0.3s), background-color var(--kd-g-duration, 0.3s);
|
|
115
|
-
-webkit-text-decoration-skip: objects;
|
|
116
|
-
}
|
|
117
|
-
.kd-dropdown-link.disabled,
|
|
118
|
-
.kd-dropdown-link.disabled:hover {
|
|
119
|
-
cursor: default;
|
|
120
|
-
color: var(--kd-g-color-disabled, #b2b2b2);
|
|
121
|
-
}
|
|
122
|
-
.kd-dropdown-link:hover {
|
|
123
|
-
color: var(--kd-g-color-theme-5, #87adff);
|
|
124
|
-
}
|
|
125
107
|
.kd-dropdown-trigger {
|
|
126
108
|
outline: none;
|
|
127
109
|
}
|
|
@@ -4,30 +4,9 @@
|
|
|
4
4
|
|
|
5
5
|
@dropdown-prefix-cls: ~'@{kd-prefix}-dropdown';
|
|
6
6
|
@dropdown-trigger-prefix-cls: ~'@{dropdown-prefix-cls}-trigger';
|
|
7
|
-
@dropdown-link-prefix-cls: ~'@{dropdown-prefix-cls}-link';
|
|
8
7
|
|
|
9
8
|
@dropdown-line-height: 18px;
|
|
10
9
|
|
|
11
|
-
.@{dropdown-link-prefix-cls} {
|
|
12
|
-
color: @color-theme;
|
|
13
|
-
text-decoration: none;
|
|
14
|
-
background-color: transparent;
|
|
15
|
-
outline: noned;
|
|
16
|
-
cursor: pointer;
|
|
17
|
-
transition: color @duration-promptly, background-color @duration-promptly;
|
|
18
|
-
-webkit-text-decoration-skip: objects;
|
|
19
|
-
|
|
20
|
-
&.disabled,
|
|
21
|
-
&.disabled:hover {
|
|
22
|
-
cursor: default;
|
|
23
|
-
color: @color-disabled;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
&:hover {
|
|
27
|
-
color: @color-theme-hover;
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
|
|
31
10
|
.@{dropdown-trigger-prefix-cls} {
|
|
32
11
|
outline: none;
|
|
33
12
|
}
|
package/lib/form/Field.js
CHANGED
|
@@ -138,6 +138,7 @@ var Field = function Field(props) {
|
|
|
138
138
|
vertical = fieldContext.vertical,
|
|
139
139
|
getDefaultValue = fieldContext.getDefaultValue,
|
|
140
140
|
local = fieldContext.local,
|
|
141
|
+
setRules = fieldContext.setRules,
|
|
141
142
|
formDisabled = fieldContext.disabled;
|
|
142
143
|
|
|
143
144
|
var _getInternalHooks = getInternalHooks(_useForm.INTERNAL_HOOK_KEY),
|
|
@@ -213,7 +214,7 @@ var Field = function Field(props) {
|
|
|
213
214
|
|
|
214
215
|
return false;
|
|
215
216
|
});
|
|
216
|
-
var mergedRequired = required ||
|
|
217
|
+
var mergedRequired = required || rulesRequired;
|
|
217
218
|
|
|
218
219
|
if (Array.isArray(rules) && !rules.some(function (rule) {
|
|
219
220
|
return Object.prototype.hasOwnProperty.call(rule, 'required');
|
|
@@ -254,6 +255,9 @@ var Field = function Field(props) {
|
|
|
254
255
|
setDefaultValues((0, _defineProperty2.default)({}, name, defaultValue));
|
|
255
256
|
}
|
|
256
257
|
}, [name, registerField]);
|
|
258
|
+
(0, _react.useEffect)(function () {
|
|
259
|
+
setRules(name, mergeRules);
|
|
260
|
+
}, [mergedRequired, name, mergeRules]);
|
|
257
261
|
var formPrefixCls = getPrefixCls === null || getPrefixCls === void 0 ? void 0 : getPrefixCls(prefixCls, 'form', customizePrefixcls);
|
|
258
262
|
var formItemClassName = (0, _classnames2.default)((_classnames = {}, (0, _defineProperty2.default)(_classnames, "".concat(formPrefixCls), true), (0, _defineProperty2.default)(_classnames, "".concat(formPrefixCls, "-field"), true), (0, _defineProperty2.default)(_classnames, "".concat(formPrefixCls, "-field-hidden"), hidden), (0, _defineProperty2.default)(_classnames, "".concat(formPrefixCls, "-field-vertical"), vertical), _classnames), className);
|
|
259
263
|
var value = getFieldValue(name);
|