@kdcloudjs/kdesign 1.6.14 → 1.6.16
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 +53 -0
- package/dist/kdesign-complete.less +307 -239
- package/dist/kdesign.css +77 -5
- package/dist/kdesign.css.map +1 -1
- package/dist/kdesign.js +950 -347
- package/dist/kdesign.js.map +1 -1
- package/dist/kdesign.min.css +4 -4
- package/dist/kdesign.min.js +8 -8
- package/dist/kdesign.min.js.map +1 -1
- package/es/_utils/usePopper.d.ts +1 -0
- package/es/_utils/usePopper.js +3 -1
- package/es/button/button.js +1 -1
- package/es/button/style/index.css +3 -0
- package/es/button/style/index.less +4 -0
- package/es/button/style/token.less +1 -0
- package/es/carousel/carousel.d.ts +1 -0
- package/es/carousel/carousel.js +66 -3
- package/es/carousel/style/index.css +39 -0
- package/es/carousel/style/index.less +40 -0
- package/es/carousel/style/token.less +2 -0
- package/es/config-provider/compDefaultProps.d.ts +1 -0
- package/es/config-provider/compDefaultProps.js +2 -1
- package/es/date-picker/range/input-range.js +1 -1
- package/es/date-picker/single/input-date.js +1 -1
- package/es/form/Field.js +7 -1
- package/es/form/FieldContext.js +1 -0
- package/es/form/hooks/useForm.js +14 -20
- package/es/form/interface.d.ts +1 -0
- package/es/image/preview.d.ts +1 -0
- package/es/image/preview.js +31 -6
- package/es/input/style/index.css +4 -3
- package/es/input/style/index.less +230 -227
- package/es/input/style/token.less +11 -12
- package/es/modal/modal.js +4 -8
- package/es/modal/style/index.css +11 -0
- package/es/modal/style/index.less +10 -0
- package/es/select/select.js +15 -11
- package/es/style/core/motion/other.less +9 -0
- package/es/style/icon/kdicon.css +3 -1
- package/es/style/icon/kdicon.woff +0 -0
- package/es/style/index.css +16 -0
- package/es/table/feature/useFooterDataSource.d.ts +3 -0
- package/es/table/feature/useFooterDataSource.js +11 -0
- package/es/table/interface.d.ts +2 -0
- package/es/table/table.js +10 -9
- package/es/tooltip/tooltip.d.ts +1 -1
- package/es/tooltip/tooltip.js +10 -2
- package/es/tree/tree.d.ts +8 -0
- package/es/tree/tree.js +46 -17
- package/es/tree/treeHooks.d.ts +3 -3
- package/es/tree/treeHooks.js +9 -9
- package/es/tree/utils/treeUtils.d.ts +20 -6
- package/es/tree/utils/treeUtils.js +222 -40
- package/lib/_utils/usePopper.d.ts +1 -0
- package/lib/_utils/usePopper.js +3 -1
- package/lib/button/button.js +1 -1
- package/lib/button/style/index.css +3 -0
- package/lib/button/style/index.less +4 -0
- package/lib/button/style/token.less +1 -0
- package/lib/carousel/carousel.d.ts +1 -0
- package/lib/carousel/carousel.js +69 -2
- package/lib/carousel/style/index.css +39 -0
- package/lib/carousel/style/index.less +40 -0
- package/lib/carousel/style/token.less +2 -0
- package/lib/config-provider/compDefaultProps.d.ts +1 -0
- package/lib/config-provider/compDefaultProps.js +2 -1
- package/lib/date-picker/range/input-range.js +1 -1
- package/lib/date-picker/single/input-date.js +1 -1
- package/lib/form/Field.js +7 -1
- package/lib/form/FieldContext.js +1 -0
- package/lib/form/hooks/useForm.js +13 -20
- package/lib/form/interface.d.ts +1 -0
- package/lib/image/preview.d.ts +1 -0
- package/lib/image/preview.js +31 -6
- package/lib/input/style/index.css +4 -3
- package/lib/input/style/index.less +230 -227
- package/lib/input/style/token.less +11 -12
- package/lib/modal/modal.js +4 -8
- package/lib/modal/style/index.css +11 -0
- package/lib/modal/style/index.less +10 -0
- package/lib/select/select.js +15 -14
- package/lib/style/core/motion/other.less +9 -0
- package/lib/style/icon/kdicon.css +3 -1
- package/lib/style/icon/kdicon.woff +0 -0
- package/lib/style/index.css +16 -0
- package/lib/table/feature/useFooterDataSource.d.ts +3 -0
- package/lib/table/feature/useFooterDataSource.js +19 -0
- package/lib/table/interface.d.ts +2 -0
- package/lib/table/table.js +11 -9
- package/lib/tooltip/tooltip.d.ts +1 -1
- package/lib/tooltip/tooltip.js +16 -5
- package/lib/tree/tree.d.ts +8 -0
- package/lib/tree/tree.js +45 -16
- package/lib/tree/treeHooks.d.ts +3 -3
- package/lib/tree/treeHooks.js +8 -8
- package/lib/tree/utils/treeUtils.d.ts +20 -6
- package/lib/tree/utils/treeUtils.js +234 -39
- package/package.json +1 -1
|
@@ -132,6 +132,46 @@
|
|
|
132
132
|
}
|
|
133
133
|
}
|
|
134
134
|
}
|
|
135
|
+
|
|
136
|
+
&-jump {
|
|
137
|
+
position: absolute;
|
|
138
|
+
top: 50%;
|
|
139
|
+
left: unset;
|
|
140
|
+
right: 16px;
|
|
141
|
+
transform: translateY(-50%);
|
|
142
|
+
|
|
143
|
+
&-left {
|
|
144
|
+
left: 16px;
|
|
145
|
+
right: unset;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
&:not(.@{carousel-prefix-cls}-jump-disabled) {
|
|
149
|
+
cursor: pointer;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
> *:first-child {
|
|
153
|
+
display: flex;
|
|
154
|
+
align-items: center;
|
|
155
|
+
justify-content: center;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
&-icon {
|
|
159
|
+
font-size: 20px;
|
|
160
|
+
color: @carousel-jump-icon-color;
|
|
161
|
+
|
|
162
|
+
&:hover {
|
|
163
|
+
color: @carousel-jump-icon-color-hover;
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
&-disabled {
|
|
168
|
+
cursor: not-allowed;
|
|
169
|
+
|
|
170
|
+
.@{carousel-prefix-cls}-jump-icon:hover {
|
|
171
|
+
color: @carousel-jump-icon-color;
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
}
|
|
135
175
|
}
|
|
136
176
|
.vertical {
|
|
137
177
|
display: flex;
|
|
@@ -3,6 +3,8 @@
|
|
|
3
3
|
// color
|
|
4
4
|
@carousel-dots-color-background: var(~'@{carousel-prefix}-dots-color-background', #D8D8D8); // 面板指示点的背景色
|
|
5
5
|
@carousel-dots-color-background-active: var(~'@{carousel-prefix}-dots-color-hover', #666666); // 面板指示点的背景色
|
|
6
|
+
@carousel-jump-icon-color: var(~'@{carousel-prefix}-jump-icon-color', #D9D9D9);
|
|
7
|
+
@carousel-jump-icon-color-hover: var(~'@{carousel-prefix}-jump-icon-color-hover', #666666);
|
|
6
8
|
|
|
7
9
|
// radius
|
|
8
10
|
@carousel-dots-boder-radius: var(~'@{carousel-prefix}-dots-border-radius', 2px); // 面板指示点的圆角
|
|
@@ -167,7 +167,7 @@ function InputDate(props, ref) {
|
|
|
167
167
|
}
|
|
168
168
|
|
|
169
169
|
var getSuffixNode = function getSuffixNode() {
|
|
170
|
-
if (isMouseEnter && (startHoverValue || endHoverValue || startText || endText)) {
|
|
170
|
+
if (isMouseEnter && (startHoverValue || endHoverValue || startText || endText) && allowClear) {
|
|
171
171
|
return clearNode;
|
|
172
172
|
}
|
|
173
173
|
|
|
@@ -87,7 +87,7 @@ function InputDate(props, ref) {
|
|
|
87
87
|
var placeholder = (0, _utils.getPlaceholder)(picker, locale, propsPlaceholder);
|
|
88
88
|
|
|
89
89
|
var getSuffixNode = function getSuffixNode() {
|
|
90
|
-
if (isMouseEnter && (hoverValue || text)) {
|
|
90
|
+
if (isMouseEnter && (hoverValue || text) && allowClear) {
|
|
91
91
|
return null;
|
|
92
92
|
}
|
|
93
93
|
|
package/lib/form/Field.js
CHANGED
|
@@ -145,7 +145,8 @@ var Field = function Field(props) {
|
|
|
145
145
|
var _getInternalHooks = getInternalHooks(_useForm.INTERNAL_HOOK_KEY),
|
|
146
146
|
registerField = _getInternalHooks.registerField,
|
|
147
147
|
dispatch = _getInternalHooks.dispatch,
|
|
148
|
-
setDefaultValues = _getInternalHooks.setDefaultValues
|
|
148
|
+
setDefaultValues = _getInternalHooks.setDefaultValues,
|
|
149
|
+
deleteField = _getInternalHooks.deleteField;
|
|
149
150
|
|
|
150
151
|
var name = props.name,
|
|
151
152
|
customizeHtmlFor = props.htmlFor,
|
|
@@ -261,6 +262,11 @@ var Field = function Field(props) {
|
|
|
261
262
|
setDefaultValues((0, _defineProperty2.default)({}, name, defaultValue));
|
|
262
263
|
}
|
|
263
264
|
}, [name, registerField]);
|
|
265
|
+
(0, _react.useEffect)(function () {
|
|
266
|
+
return function () {
|
|
267
|
+
deleteField(name);
|
|
268
|
+
};
|
|
269
|
+
}, []);
|
|
264
270
|
var formPrefixCls = getPrefixCls === null || getPrefixCls === void 0 ? void 0 : getPrefixCls(prefixCls, 'form', customizePrefixcls);
|
|
265
271
|
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);
|
|
266
272
|
var value = getFieldValue(name);
|
package/lib/form/FieldContext.js
CHANGED
|
@@ -37,22 +37,18 @@ var _set = _interopRequireDefault(require("lodash/set"));
|
|
|
37
37
|
|
|
38
38
|
var _devwarning = _interopRequireDefault(require("../../_utils/devwarning"));
|
|
39
39
|
|
|
40
|
-
// import useForceUpdate from './useForceUpdate'
|
|
41
40
|
var INTERNAL_HOOK_KEY = '__KD_INTERNAL_FORM_HOOK__';
|
|
42
41
|
exports.INTERNAL_HOOK_KEY = INTERNAL_HOOK_KEY;
|
|
43
42
|
var FormStore = /*#__PURE__*/(0, _createClass2.default)(function FormStore() {
|
|
44
43
|
var _this = this;
|
|
45
44
|
|
|
46
45
|
(0, _classCallCheck2.default)(this, FormStore);
|
|
47
|
-
this.isMounted = false;
|
|
48
|
-
|
|
46
|
+
this.isMounted = false;
|
|
49
47
|
this.defaultValues = {};
|
|
50
48
|
this.store = {};
|
|
51
49
|
this.fields = {};
|
|
52
50
|
this.errorMessages = {};
|
|
53
|
-
this.callbacks = {};
|
|
54
|
-
// this.forceRootUpdate = forceRootUpdate
|
|
55
|
-
// }
|
|
51
|
+
this.callbacks = {};
|
|
56
52
|
|
|
57
53
|
this.getForm = function () {
|
|
58
54
|
return {
|
|
@@ -81,7 +77,8 @@ var FormStore = /*#__PURE__*/(0, _createClass2.default)(function FormStore() {
|
|
|
81
77
|
dispatch: _this.dispatch,
|
|
82
78
|
setDefaultValues: _this.setDefaultValues,
|
|
83
79
|
setCallbacks: _this.setCallbacks,
|
|
84
|
-
registerField: _this.registerField
|
|
80
|
+
registerField: _this.registerField,
|
|
81
|
+
deleteField: _this.deleteField
|
|
85
82
|
};
|
|
86
83
|
};
|
|
87
84
|
|
|
@@ -252,13 +249,6 @@ var FormStore = /*#__PURE__*/(0, _createClass2.default)(function FormStore() {
|
|
|
252
249
|
onValuesChange((0, _defineProperty2.default)({}, name, value), (0, _cloneDeep.default)(_this.store));
|
|
253
250
|
}
|
|
254
251
|
};
|
|
255
|
-
/**
|
|
256
|
-
* 注册 Field
|
|
257
|
-
* Field 如果带有验证规则的话,则注册时进行校验
|
|
258
|
-
* @param name Field 名称
|
|
259
|
-
* @param field Field 实例
|
|
260
|
-
*/
|
|
261
|
-
|
|
262
252
|
|
|
263
253
|
this.registerField = function (name, field) {
|
|
264
254
|
_this.warningUnhooked();
|
|
@@ -266,6 +256,14 @@ var FormStore = /*#__PURE__*/(0, _createClass2.default)(function FormStore() {
|
|
|
266
256
|
_this.fields[name] = field;
|
|
267
257
|
};
|
|
268
258
|
|
|
259
|
+
this.deleteField = function (name) {
|
|
260
|
+
_this.warningUnhooked();
|
|
261
|
+
|
|
262
|
+
Object.hasOwnProperty.call(_this.fields, name) && delete _this.fields[name];
|
|
263
|
+
Object.hasOwnProperty.call(_this.errorMessages, name) && delete _this.errorMessages[name];
|
|
264
|
+
Object.hasOwnProperty.call(_this.store, name) && delete _this.store[name];
|
|
265
|
+
};
|
|
266
|
+
|
|
269
267
|
this.validateFields = function (namePathList) {
|
|
270
268
|
_this.warningUnhooked();
|
|
271
269
|
|
|
@@ -362,17 +360,12 @@ var FormStore = /*#__PURE__*/(0, _createClass2.default)(function FormStore() {
|
|
|
362
360
|
});
|
|
363
361
|
|
|
364
362
|
function useForm(form) {
|
|
365
|
-
var formRef = _react.default.useRef();
|
|
366
|
-
|
|
363
|
+
var formRef = _react.default.useRef();
|
|
367
364
|
|
|
368
365
|
if (!formRef.current) {
|
|
369
366
|
if (form) {
|
|
370
367
|
formRef.current = form;
|
|
371
368
|
} else {
|
|
372
|
-
// Create a new FormStore if not provided
|
|
373
|
-
// const forceReRender = () => {
|
|
374
|
-
// forceUpdate()
|
|
375
|
-
// }
|
|
376
369
|
var formStore = new FormStore();
|
|
377
370
|
formRef.current = formStore.getForm();
|
|
378
371
|
}
|
package/lib/form/interface.d.ts
CHANGED
|
@@ -75,6 +75,7 @@ export interface InternalHooks {
|
|
|
75
75
|
registerField: (name: NamePath, field: {
|
|
76
76
|
current: FieldInstance;
|
|
77
77
|
}) => void;
|
|
78
|
+
deleteField: (name: NamePath) => void;
|
|
78
79
|
}
|
|
79
80
|
export declare type NotifySource = 'externalUpdateValue' | 'updateValue' | 'reset' | 'validateField' | 'validateFinish';
|
|
80
81
|
export interface ValidateErrorEntity<Values = any> {
|
package/lib/image/preview.d.ts
CHANGED
package/lib/image/preview.js
CHANGED
|
@@ -13,6 +13,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
13
13
|
});
|
|
14
14
|
exports.default = void 0;
|
|
15
15
|
|
|
16
|
+
var _find = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/find"));
|
|
17
|
+
|
|
16
18
|
var _concat = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/concat"));
|
|
17
19
|
|
|
18
20
|
var _extends2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/extends"));
|
|
@@ -53,6 +55,7 @@ var Preview = function Preview(props) {
|
|
|
53
55
|
alt = allProps.alt,
|
|
54
56
|
name = allProps.name,
|
|
55
57
|
size = allProps.size,
|
|
58
|
+
scales = allProps.scales,
|
|
56
59
|
visible = allProps.visible,
|
|
57
60
|
onClose = allProps.onClose,
|
|
58
61
|
current = allProps.current,
|
|
@@ -82,14 +85,28 @@ var Preview = function Preview(props) {
|
|
|
82
85
|
scale = _React$useState6[0],
|
|
83
86
|
setScale = _React$useState6[1];
|
|
84
87
|
|
|
88
|
+
var maxScale = scales[scales.length - 1] / 100;
|
|
89
|
+
var minScale = scales[0] / 100;
|
|
85
90
|
React.useEffect(function () {
|
|
86
91
|
if (show) {
|
|
87
92
|
document.body.style.overflow = 'hidden';
|
|
88
93
|
var throMouseWheel = (0, _throttle.default)(function (e) {
|
|
89
94
|
if (e.wheelDelta > 0) {
|
|
90
|
-
|
|
95
|
+
if (scale > maxScale) return;
|
|
96
|
+
|
|
97
|
+
if (scale + 0.1 > maxScale) {
|
|
98
|
+
setScale(maxScale);
|
|
99
|
+
} else {
|
|
100
|
+
setScale(scale + 0.1);
|
|
101
|
+
}
|
|
91
102
|
} else if (e.wheelDelta < 0) {
|
|
92
|
-
if (scale
|
|
103
|
+
if (scale < minScale) return;
|
|
104
|
+
|
|
105
|
+
if (scale - 0.1 < minScale) {
|
|
106
|
+
setScale(minScale);
|
|
107
|
+
} else {
|
|
108
|
+
setScale(scale - 0.1);
|
|
109
|
+
}
|
|
93
110
|
}
|
|
94
111
|
}, 200);
|
|
95
112
|
document.addEventListener('mousewheel', throMouseWheel);
|
|
@@ -103,12 +120,17 @@ var Preview = function Preview(props) {
|
|
|
103
120
|
}, [show, scale]);
|
|
104
121
|
|
|
105
122
|
var handleZoomOut = function handleZoomOut() {
|
|
106
|
-
var
|
|
107
|
-
|
|
123
|
+
var nextScale = scales.findLast(function (s) {
|
|
124
|
+
return s / 100 < scale;
|
|
125
|
+
});
|
|
126
|
+
if (nextScale !== undefined) setScale(nextScale / 100);
|
|
108
127
|
};
|
|
109
128
|
|
|
110
129
|
var handleZoomIn = function handleZoomIn() {
|
|
111
|
-
|
|
130
|
+
var nextScale = (0, _find.default)(scales).call(scales, function (s) {
|
|
131
|
+
return s / 100 > scale;
|
|
132
|
+
});
|
|
133
|
+
if (nextScale !== undefined) setScale(nextScale / 100);
|
|
112
134
|
};
|
|
113
135
|
|
|
114
136
|
var previewImgProps = {
|
|
@@ -150,11 +172,14 @@ var Preview = function Preview(props) {
|
|
|
150
172
|
}), /*#__PURE__*/React.createElement(_icon.default, {
|
|
151
173
|
type: "shrink",
|
|
152
174
|
className: (0, _classnames.default)({
|
|
153
|
-
disabled: scale <=
|
|
175
|
+
disabled: scale <= minScale
|
|
154
176
|
}),
|
|
155
177
|
onClick: handleZoomOut
|
|
156
178
|
}), /*#__PURE__*/React.createElement(_icon.default, {
|
|
157
179
|
type: "zoom",
|
|
180
|
+
className: (0, _classnames.default)({
|
|
181
|
+
disabled: scale >= maxScale
|
|
182
|
+
}),
|
|
158
183
|
onClick: handleZoomIn
|
|
159
184
|
}), props.type !== 'upload' && operations, props.type !== 'upload' && length && /*#__PURE__*/React.createElement(_icon.default, {
|
|
160
185
|
type: "arrow-right",
|
|
@@ -259,6 +259,7 @@ textarea {
|
|
|
259
259
|
padding: var(--kd-c-input-spacing-padding-vertical-small, 3px) var(--kd-c-input-spacing-padding-horizontal-small, 9px);
|
|
260
260
|
}
|
|
261
261
|
.kd-input-wrapper {
|
|
262
|
+
padding-left: var(--kd-c-input-wrapper-padding-left, 0px) !important;
|
|
262
263
|
width: 100%;
|
|
263
264
|
min-width: 0;
|
|
264
265
|
border: var(--kd-c-input-sizing-border, 1px) solid var(--kd-c-input-color-border-disabled, var(--kd-g-color-border-strong, #d9d9d9));
|
|
@@ -306,7 +307,7 @@ textarea {
|
|
|
306
307
|
}
|
|
307
308
|
.kd-input-wrapper .kd-input {
|
|
308
309
|
border: none;
|
|
309
|
-
padding-left:
|
|
310
|
+
padding-left: var(--kd-c-input-padding-left, 9px);
|
|
310
311
|
padding-right: 0;
|
|
311
312
|
height: 100%;
|
|
312
313
|
}
|
|
@@ -453,8 +454,8 @@ textarea {
|
|
|
453
454
|
font-size: 14px;
|
|
454
455
|
font-variant: tabular-nums;
|
|
455
456
|
list-style: none;
|
|
456
|
-
-webkit-font-feature-settings:
|
|
457
|
-
font-feature-settings:
|
|
457
|
+
-webkit-font-feature-settings: 'tnum';
|
|
458
|
+
font-feature-settings: 'tnum';
|
|
458
459
|
position: relative;
|
|
459
460
|
display: -webkit-box;
|
|
460
461
|
display: -ms-flexbox;
|