@kdcloudjs/kdesign 1.6.14 → 1.6.15
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 +26 -0
- package/dist/kdesign-complete.less +305 -239
- package/dist/kdesign.css +73 -5
- package/dist/kdesign.css.map +1 -1
- package/dist/kdesign.js +536 -227
- 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/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 +7 -0
- package/es/modal/style/index.less +8 -0
- package/es/select/select.js +11 -8
- 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/interface.d.ts +1 -0
- 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 +32 -17
- package/es/tree/treeHooks.d.ts +3 -3
- package/es/tree/treeHooks.js +7 -7
- package/es/tree/utils/treeUtils.d.ts +19 -6
- package/es/tree/utils/treeUtils.js +183 -33
- 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/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 +7 -0
- package/lib/modal/style/index.less +8 -0
- package/lib/select/select.js +11 -11
- 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/interface.d.ts +1 -0
- 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 +30 -16
- package/lib/tree/treeHooks.d.ts +3 -3
- package/lib/tree/treeHooks.js +6 -6
- package/lib/tree/utils/treeUtils.d.ts +19 -6
- package/lib/tree/utils/treeUtils.js +193 -33
- package/package.json +1 -1
package/es/_utils/usePopper.d.ts
CHANGED
|
@@ -20,6 +20,7 @@ export interface PopperProps {
|
|
|
20
20
|
placement?: PlacementType;
|
|
21
21
|
popperStyle?: React.CSSProperties;
|
|
22
22
|
trigger?: TriggerType | Array<TriggerType>;
|
|
23
|
+
clickToClose?: boolean;
|
|
23
24
|
onTrigger?: (trigger: TriggerType) => void;
|
|
24
25
|
onVisibleChange?: (visible: boolean) => void;
|
|
25
26
|
getTriggerElement?: (locatorNode: HTMLElement) => HTMLElement;
|
package/es/_utils/usePopper.js
CHANGED
|
@@ -152,6 +152,8 @@ function usePopper(locatorElement, popperElement, props) {
|
|
|
152
152
|
defaultVisible = _props$defaultVisible === void 0 ? false : _props$defaultVisible,
|
|
153
153
|
_props$autoPlacement = props.autoPlacement,
|
|
154
154
|
autoPlacement = _props$autoPlacement === void 0 ? true : _props$autoPlacement,
|
|
155
|
+
_props$clickToClose = props.clickToClose,
|
|
156
|
+
clickToClose = _props$clickToClose === void 0 ? true : _props$clickToClose,
|
|
155
157
|
_props$getTriggerElem = props.getTriggerElement,
|
|
156
158
|
getTriggerElement = _props$getTriggerElem === void 0 ? function (locatorNode) {
|
|
157
159
|
return locatorNode;
|
|
@@ -635,7 +637,7 @@ function usePopper(locatorElement, popperElement, props) {
|
|
|
635
637
|
return showPopper(e.type);
|
|
636
638
|
}, mouseEnterDelay * 1000);
|
|
637
639
|
} else if (e.type === 'mouseup' && visible) {
|
|
638
|
-
hidePopper();
|
|
640
|
+
clickToClose && hidePopper();
|
|
639
641
|
} else {
|
|
640
642
|
showPopper(e.type);
|
|
641
643
|
}
|
package/es/button/button.js
CHANGED
|
@@ -129,7 +129,7 @@ var InternalButton = function InternalButton(props, ref) {
|
|
|
129
129
|
className: btnClasses,
|
|
130
130
|
onClick: handleClick,
|
|
131
131
|
disabled: disabled
|
|
132
|
-
}, others), children);
|
|
132
|
+
}, others), iconNode, children);
|
|
133
133
|
|
|
134
134
|
default:
|
|
135
135
|
return /*#__PURE__*/React.createElement("button", _extends({
|
|
@@ -338,6 +338,9 @@
|
|
|
338
338
|
padding: 0;
|
|
339
339
|
min-width: auto;
|
|
340
340
|
}
|
|
341
|
+
.kd-btn-text .kd-btn-iconWrapper-left {
|
|
342
|
+
margin-right: var(--kd-c-button-text-icon-spacing-margin-right, 4px);
|
|
343
|
+
}
|
|
341
344
|
.kd-btn-text:hover {
|
|
342
345
|
color: var(--kd-c-button-text-color-text-hover, var(--kd-g-color-theme-5, #87adff));
|
|
343
346
|
}
|
|
@@ -104,3 +104,4 @@
|
|
|
104
104
|
@btn-large-padding-horizontal: var(~'@{button-custom-prefix}-spacing-padding-horizontal-large', 8px); // 大号 内间距 横向
|
|
105
105
|
@btn-group-dropdown-item-horizontal: var(~'@{button-custom-prefix}-group-dropdown-item-horizonta', 12px);
|
|
106
106
|
@btn-icon-padding-horizontal: var(~'@{button-custom-prefix}-icon-spacing-padding-horizontal', 4px);
|
|
107
|
+
@btn-text-icon-margin-right: var(~'@{button-custom-prefix}-text-icon-spacing-margin-right', 4px);
|
|
@@ -5,6 +5,7 @@ export declare const EffectTypes: ["scrollx", "fade"];
|
|
|
5
5
|
export declare type EffectType = typeof EffectTypes[number];
|
|
6
6
|
export interface CarouselProps {
|
|
7
7
|
autoplay?: boolean;
|
|
8
|
+
jumpNode?: boolean | React.ReactNode[];
|
|
8
9
|
children?: React.ReactNode;
|
|
9
10
|
dotPosition?: string;
|
|
10
11
|
dots?: boolean | {
|
package/es/carousel/carousel.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
import _extends from "@babel/runtime-corejs3/helpers/extends";
|
|
1
2
|
import _defineProperty from "@babel/runtime-corejs3/helpers/defineProperty";
|
|
2
3
|
import _slicedToArray from "@babel/runtime-corejs3/helpers/slicedToArray";
|
|
3
4
|
import _concatInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/concat";
|
|
4
|
-
import React, { useContext, useImperativeHandle } from 'react';
|
|
5
|
+
import React, { isValidElement, useContext, useImperativeHandle } from 'react';
|
|
5
6
|
import classNames from 'classnames';
|
|
6
7
|
import ConfigContext from '../config-provider/ConfigContext';
|
|
7
8
|
import { getCompProps } from '../_utils';
|
|
@@ -13,6 +14,7 @@ import { FadeList } from './fadeList';
|
|
|
13
14
|
import { SlideList } from './slideList';
|
|
14
15
|
import { DisplayList } from './displayList';
|
|
15
16
|
import { Slidebar } from './slidebar';
|
|
17
|
+
import Icon from '../icon';
|
|
16
18
|
export var DotPositionTypes = tuple('top', 'left', 'bottom', 'right');
|
|
17
19
|
export var EffectTypes = tuple('scrollx', 'fade');
|
|
18
20
|
|
|
@@ -24,6 +26,7 @@ var InternalCarousel = function InternalCarousel(props, ref) {
|
|
|
24
26
|
|
|
25
27
|
var carouselProps = getCompProps('Carousel', userDefaultProps, props);
|
|
26
28
|
var autoplay = carouselProps.autoplay,
|
|
29
|
+
jumpNode = carouselProps.jumpNode,
|
|
27
30
|
dotPosition = carouselProps.dotPosition,
|
|
28
31
|
children = carouselProps.children,
|
|
29
32
|
dots = carouselProps.dots,
|
|
@@ -237,6 +240,66 @@ var InternalCarousel = function InternalCarousel(props, ref) {
|
|
|
237
240
|
return content;
|
|
238
241
|
};
|
|
239
242
|
|
|
243
|
+
var renderJumpNode = function renderJumpNode() {
|
|
244
|
+
if ((children === null || children === void 0 ? void 0 : children.length) && jumpNode) {
|
|
245
|
+
var jumpClassPrefix = "".concat(carouselPrefixCls, "-jump");
|
|
246
|
+
|
|
247
|
+
var leftClick = function leftClick(e) {
|
|
248
|
+
e.stopPropagation();
|
|
249
|
+
|
|
250
|
+
if (currentIndex !== 0) {
|
|
251
|
+
prev();
|
|
252
|
+
}
|
|
253
|
+
};
|
|
254
|
+
|
|
255
|
+
var rightClick = function rightClick(e) {
|
|
256
|
+
e.stopPropagation();
|
|
257
|
+
|
|
258
|
+
if (currentIndex !== children.length - 1) {
|
|
259
|
+
next();
|
|
260
|
+
}
|
|
261
|
+
};
|
|
262
|
+
|
|
263
|
+
var mergeNode = function mergeNode(node, type) {
|
|
264
|
+
var onClick = function onClick(evt) {
|
|
265
|
+
var chClick = node.props.onClick;
|
|
266
|
+
|
|
267
|
+
if (type === 'left') {
|
|
268
|
+
leftClick(evt);
|
|
269
|
+
} else {
|
|
270
|
+
rightClick(evt);
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
if (typeof chClick === 'function') {
|
|
274
|
+
chClick(evt);
|
|
275
|
+
}
|
|
276
|
+
};
|
|
277
|
+
|
|
278
|
+
return _extends(_extends({}, node.props), {
|
|
279
|
+
onClick: onClick
|
|
280
|
+
});
|
|
281
|
+
};
|
|
282
|
+
|
|
283
|
+
var leftNode = /*#__PURE__*/React.createElement("div", {
|
|
284
|
+
className: classNames(jumpClassPrefix, "".concat(jumpClassPrefix, "-left"), _defineProperty({}, "".concat(jumpClassPrefix, "-disabled"), currentIndex <= 0))
|
|
285
|
+
}, Array.isArray(jumpNode) && jumpNode.length > 0 && /*#__PURE__*/isValidElement(jumpNode[0]) ? /*#__PURE__*/React.cloneElement(jumpNode[0], mergeNode(jumpNode[0], 'left')) : /*#__PURE__*/React.createElement(Icon, {
|
|
286
|
+
className: "".concat(jumpClassPrefix, "-icon"),
|
|
287
|
+
type: 'arrow-left-circle-solid',
|
|
288
|
+
onClick: leftClick
|
|
289
|
+
}));
|
|
290
|
+
var rightNode = /*#__PURE__*/React.createElement("div", {
|
|
291
|
+
className: classNames(jumpClassPrefix, "".concat(jumpClassPrefix, "-right"), _defineProperty({}, "".concat(jumpClassPrefix, "-disabled"), currentIndex >= children.length - 1))
|
|
292
|
+
}, Array.isArray(jumpNode) && jumpNode.length > 1 && /*#__PURE__*/isValidElement(jumpNode[1]) ? /*#__PURE__*/React.cloneElement(jumpNode[1], mergeNode(jumpNode[1], 'right')) : /*#__PURE__*/React.createElement(Icon, {
|
|
293
|
+
className: "".concat(jumpClassPrefix, "-icon"),
|
|
294
|
+
type: 'arrow-right-circle-solid',
|
|
295
|
+
onClick: rightClick
|
|
296
|
+
}));
|
|
297
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, leftNode, rightNode);
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
return null;
|
|
301
|
+
};
|
|
302
|
+
|
|
240
303
|
return /*#__PURE__*/React.createElement("div", {
|
|
241
304
|
className: rootClassName,
|
|
242
305
|
ref: carouselRef,
|
|
@@ -246,14 +309,14 @@ var InternalCarousel = function InternalCarousel(props, ref) {
|
|
|
246
309
|
style: style,
|
|
247
310
|
onMouseEnter: handleMouseEnter,
|
|
248
311
|
onMouseLeave: handleMouseLeave
|
|
249
|
-
}, (children === null || children === void 0 ? void 0 : children.length)
|
|
312
|
+
}, (children === null || children === void 0 ? void 0 : children.length) ? renderDisplayList() : null, (children === null || children === void 0 ? void 0 : children.length) && showDot() ? /*#__PURE__*/React.createElement(Slidebar, {
|
|
250
313
|
number: children.length,
|
|
251
314
|
currentIndex: currentIndex,
|
|
252
315
|
dotsClassName: dots,
|
|
253
316
|
parentPrefixCls: carouselPrefixCls,
|
|
254
317
|
dotPosition: dotPosition,
|
|
255
318
|
onClick: handleClick
|
|
256
|
-
}));
|
|
319
|
+
}) : null, renderJumpNode());
|
|
257
320
|
};
|
|
258
321
|
|
|
259
322
|
var Carousel = /*#__PURE__*/React.forwardRef(InternalCarousel);
|
|
@@ -290,6 +290,45 @@
|
|
|
290
290
|
background-color: var(--kd-c-carousel-dots-color-hover, #666666);
|
|
291
291
|
opacity: 1;
|
|
292
292
|
}
|
|
293
|
+
.kd-carousel-jump {
|
|
294
|
+
position: absolute;
|
|
295
|
+
top: 50%;
|
|
296
|
+
left: unset;
|
|
297
|
+
right: 16px;
|
|
298
|
+
-webkit-transform: translateY(-50%);
|
|
299
|
+
transform: translateY(-50%);
|
|
300
|
+
}
|
|
301
|
+
.kd-carousel-jump-left {
|
|
302
|
+
left: 16px;
|
|
303
|
+
right: unset;
|
|
304
|
+
}
|
|
305
|
+
.kd-carousel-jump:not(.kd-carousel-jump-disabled) {
|
|
306
|
+
cursor: pointer;
|
|
307
|
+
}
|
|
308
|
+
.kd-carousel-jump > *:first-child {
|
|
309
|
+
display: -webkit-box;
|
|
310
|
+
display: -ms-flexbox;
|
|
311
|
+
display: flex;
|
|
312
|
+
-webkit-box-align: center;
|
|
313
|
+
-ms-flex-align: center;
|
|
314
|
+
align-items: center;
|
|
315
|
+
-webkit-box-pack: center;
|
|
316
|
+
-ms-flex-pack: center;
|
|
317
|
+
justify-content: center;
|
|
318
|
+
}
|
|
319
|
+
.kd-carousel-jump-icon {
|
|
320
|
+
font-size: 20px;
|
|
321
|
+
color: var(--kd-c-carousel-jump-icon-color, #D9D9D9);
|
|
322
|
+
}
|
|
323
|
+
.kd-carousel-jump-icon:hover {
|
|
324
|
+
color: var(--kd-c-carousel-jump-icon-color-hover, #666666);
|
|
325
|
+
}
|
|
326
|
+
.kd-carousel-jump-disabled {
|
|
327
|
+
cursor: not-allowed;
|
|
328
|
+
}
|
|
329
|
+
.kd-carousel-jump-disabled .kd-carousel-jump-icon:hover {
|
|
330
|
+
color: var(--kd-c-carousel-jump-icon-color, #D9D9D9);
|
|
331
|
+
}
|
|
293
332
|
.vertical {
|
|
294
333
|
display: -webkit-box;
|
|
295
334
|
display: -ms-flexbox;
|
|
@@ -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); // 面板指示点的圆角
|
package/es/form/Field.js
CHANGED
|
@@ -105,7 +105,8 @@ var Field = function Field(props) {
|
|
|
105
105
|
var _getInternalHooks = getInternalHooks(INTERNAL_HOOK_KEY),
|
|
106
106
|
registerField = _getInternalHooks.registerField,
|
|
107
107
|
dispatch = _getInternalHooks.dispatch,
|
|
108
|
-
setDefaultValues = _getInternalHooks.setDefaultValues
|
|
108
|
+
setDefaultValues = _getInternalHooks.setDefaultValues,
|
|
109
|
+
deleteField = _getInternalHooks.deleteField;
|
|
109
110
|
|
|
110
111
|
var name = props.name,
|
|
111
112
|
customizeHtmlFor = props.htmlFor,
|
|
@@ -219,6 +220,11 @@ var Field = function Field(props) {
|
|
|
219
220
|
setDefaultValues(_defineProperty({}, name, defaultValue));
|
|
220
221
|
}
|
|
221
222
|
}, [name, registerField]);
|
|
223
|
+
useEffect(function () {
|
|
224
|
+
return function () {
|
|
225
|
+
deleteField(name);
|
|
226
|
+
};
|
|
227
|
+
}, []);
|
|
222
228
|
var formPrefixCls = getPrefixCls === null || getPrefixCls === void 0 ? void 0 : getPrefixCls(prefixCls, 'form', customizePrefixcls);
|
|
223
229
|
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);
|
|
224
230
|
var value = getFieldValue(name);
|
package/es/form/FieldContext.js
CHANGED
package/es/form/hooks/useForm.js
CHANGED
|
@@ -11,8 +11,7 @@ import Schema from 'async-validator';
|
|
|
11
11
|
import cloneDeep from 'lodash/cloneDeep';
|
|
12
12
|
import get from 'lodash/get';
|
|
13
13
|
import merge from 'lodash/merge';
|
|
14
|
-
import set from 'lodash/set';
|
|
15
|
-
|
|
14
|
+
import set from 'lodash/set';
|
|
16
15
|
import devwarning from '../../_utils/devwarning';
|
|
17
16
|
export var INTERNAL_HOOK_KEY = '__KD_INTERNAL_FORM_HOOK__';
|
|
18
17
|
|
|
@@ -21,15 +20,12 @@ var FormStore = /*#__PURE__*/_createClass(function FormStore() {
|
|
|
21
20
|
|
|
22
21
|
_classCallCheck(this, FormStore);
|
|
23
22
|
|
|
24
|
-
this.isMounted = false;
|
|
25
|
-
|
|
23
|
+
this.isMounted = false;
|
|
26
24
|
this.defaultValues = {};
|
|
27
25
|
this.store = {};
|
|
28
26
|
this.fields = {};
|
|
29
27
|
this.errorMessages = {};
|
|
30
|
-
this.callbacks = {};
|
|
31
|
-
// this.forceRootUpdate = forceRootUpdate
|
|
32
|
-
// }
|
|
28
|
+
this.callbacks = {};
|
|
33
29
|
|
|
34
30
|
this.getForm = function () {
|
|
35
31
|
return {
|
|
@@ -58,7 +54,8 @@ var FormStore = /*#__PURE__*/_createClass(function FormStore() {
|
|
|
58
54
|
dispatch: _this.dispatch,
|
|
59
55
|
setDefaultValues: _this.setDefaultValues,
|
|
60
56
|
setCallbacks: _this.setCallbacks,
|
|
61
|
-
registerField: _this.registerField
|
|
57
|
+
registerField: _this.registerField,
|
|
58
|
+
deleteField: _this.deleteField
|
|
62
59
|
};
|
|
63
60
|
};
|
|
64
61
|
|
|
@@ -229,13 +226,6 @@ var FormStore = /*#__PURE__*/_createClass(function FormStore() {
|
|
|
229
226
|
onValuesChange(_defineProperty({}, name, value), cloneDeep(_this.store));
|
|
230
227
|
}
|
|
231
228
|
};
|
|
232
|
-
/**
|
|
233
|
-
* 注册 Field
|
|
234
|
-
* Field 如果带有验证规则的话,则注册时进行校验
|
|
235
|
-
* @param name Field 名称
|
|
236
|
-
* @param field Field 实例
|
|
237
|
-
*/
|
|
238
|
-
|
|
239
229
|
|
|
240
230
|
this.registerField = function (name, field) {
|
|
241
231
|
_this.warningUnhooked();
|
|
@@ -243,6 +233,14 @@ var FormStore = /*#__PURE__*/_createClass(function FormStore() {
|
|
|
243
233
|
_this.fields[name] = field;
|
|
244
234
|
};
|
|
245
235
|
|
|
236
|
+
this.deleteField = function (name) {
|
|
237
|
+
_this.warningUnhooked();
|
|
238
|
+
|
|
239
|
+
Object.hasOwnProperty.call(_this.fields, name) && delete _this.fields[name];
|
|
240
|
+
Object.hasOwnProperty.call(_this.errorMessages, name) && delete _this.errorMessages[name];
|
|
241
|
+
Object.hasOwnProperty.call(_this.store, name) && delete _this.store[name];
|
|
242
|
+
};
|
|
243
|
+
|
|
246
244
|
this.validateFields = function (namePathList) {
|
|
247
245
|
_this.warningUnhooked();
|
|
248
246
|
|
|
@@ -340,16 +338,12 @@ var FormStore = /*#__PURE__*/_createClass(function FormStore() {
|
|
|
340
338
|
});
|
|
341
339
|
|
|
342
340
|
function useForm(form) {
|
|
343
|
-
var formRef = React.useRef();
|
|
341
|
+
var formRef = React.useRef();
|
|
344
342
|
|
|
345
343
|
if (!formRef.current) {
|
|
346
344
|
if (form) {
|
|
347
345
|
formRef.current = form;
|
|
348
346
|
} else {
|
|
349
|
-
// Create a new FormStore if not provided
|
|
350
|
-
// const forceReRender = () => {
|
|
351
|
-
// forceUpdate()
|
|
352
|
-
// }
|
|
353
347
|
var formStore = new FormStore();
|
|
354
348
|
formRef.current = formStore.getForm();
|
|
355
349
|
}
|
package/es/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/es/image/preview.d.ts
CHANGED
package/es/image/preview.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import _extends from "@babel/runtime-corejs3/helpers/extends";
|
|
2
2
|
import _slicedToArray from "@babel/runtime-corejs3/helpers/slicedToArray";
|
|
3
|
+
import _findInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/find";
|
|
3
4
|
import _concatInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/concat";
|
|
4
5
|
import * as React from 'react';
|
|
5
6
|
import ReactDOM from 'react-dom';
|
|
@@ -24,6 +25,7 @@ var Preview = function Preview(props) {
|
|
|
24
25
|
alt = allProps.alt,
|
|
25
26
|
name = allProps.name,
|
|
26
27
|
size = allProps.size,
|
|
28
|
+
scales = allProps.scales,
|
|
27
29
|
visible = allProps.visible,
|
|
28
30
|
onClose = allProps.onClose,
|
|
29
31
|
current = allProps.current,
|
|
@@ -53,14 +55,28 @@ var Preview = function Preview(props) {
|
|
|
53
55
|
scale = _React$useState6[0],
|
|
54
56
|
setScale = _React$useState6[1];
|
|
55
57
|
|
|
58
|
+
var maxScale = scales[scales.length - 1] / 100;
|
|
59
|
+
var minScale = scales[0] / 100;
|
|
56
60
|
React.useEffect(function () {
|
|
57
61
|
if (show) {
|
|
58
62
|
document.body.style.overflow = 'hidden';
|
|
59
63
|
var throMouseWheel = throttle(function (e) {
|
|
60
64
|
if (e.wheelDelta > 0) {
|
|
61
|
-
|
|
65
|
+
if (scale > maxScale) return;
|
|
66
|
+
|
|
67
|
+
if (scale + 0.1 > maxScale) {
|
|
68
|
+
setScale(maxScale);
|
|
69
|
+
} else {
|
|
70
|
+
setScale(scale + 0.1);
|
|
71
|
+
}
|
|
62
72
|
} else if (e.wheelDelta < 0) {
|
|
63
|
-
if (scale
|
|
73
|
+
if (scale < minScale) return;
|
|
74
|
+
|
|
75
|
+
if (scale - 0.1 < minScale) {
|
|
76
|
+
setScale(minScale);
|
|
77
|
+
} else {
|
|
78
|
+
setScale(scale - 0.1);
|
|
79
|
+
}
|
|
64
80
|
}
|
|
65
81
|
}, 200);
|
|
66
82
|
document.addEventListener('mousewheel', throMouseWheel);
|
|
@@ -74,12 +90,18 @@ var Preview = function Preview(props) {
|
|
|
74
90
|
}, [show, scale]);
|
|
75
91
|
|
|
76
92
|
var handleZoomOut = function handleZoomOut() {
|
|
77
|
-
var
|
|
78
|
-
|
|
93
|
+
var nextScale = scales.findLast(function (s) {
|
|
94
|
+
return s / 100 < scale;
|
|
95
|
+
});
|
|
96
|
+
if (nextScale !== undefined) setScale(nextScale / 100);
|
|
79
97
|
};
|
|
80
98
|
|
|
81
99
|
var handleZoomIn = function handleZoomIn() {
|
|
82
|
-
|
|
100
|
+
var nextScale = _findInstanceProperty(scales).call(scales, function (s) {
|
|
101
|
+
return s / 100 > scale;
|
|
102
|
+
});
|
|
103
|
+
|
|
104
|
+
if (nextScale !== undefined) setScale(nextScale / 100);
|
|
83
105
|
};
|
|
84
106
|
|
|
85
107
|
var previewImgProps = {
|
|
@@ -121,11 +143,14 @@ var Preview = function Preview(props) {
|
|
|
121
143
|
}), /*#__PURE__*/React.createElement(Icon, {
|
|
122
144
|
type: "shrink",
|
|
123
145
|
className: classNames({
|
|
124
|
-
disabled: scale <=
|
|
146
|
+
disabled: scale <= minScale
|
|
125
147
|
}),
|
|
126
148
|
onClick: handleZoomOut
|
|
127
149
|
}), /*#__PURE__*/React.createElement(Icon, {
|
|
128
150
|
type: "zoom",
|
|
151
|
+
className: classNames({
|
|
152
|
+
disabled: scale >= maxScale
|
|
153
|
+
}),
|
|
129
154
|
onClick: handleZoomIn
|
|
130
155
|
}), props.type !== 'upload' && operations, props.type !== 'upload' && length && /*#__PURE__*/React.createElement(Icon, {
|
|
131
156
|
type: "arrow-right",
|
package/es/input/style/index.css
CHANGED
|
@@ -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;
|