@kdcloudjs/kdesign 1.8.1 → 1.8.3

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.
@@ -54,6 +54,17 @@ var InternalCarousel = function InternalCarousel(props, ref) {
54
54
  var carouselRef = React.useRef();
55
55
  var listRef = React.useRef();
56
56
  var autoplayRef = React.useRef();
57
+ var processChildren = function processChildren(children) {
58
+ var childCount = React.Children.count(children);
59
+ if (childCount === 0) {
60
+ return [];
61
+ } else if (childCount === 1) {
62
+ return [children];
63
+ } else {
64
+ return React.Children.toArray(children);
65
+ }
66
+ };
67
+ var tempChild = processChildren(children);
57
68
  var isScrollxEffect = React.useMemo(function () {
58
69
  return effect === 'scrollx';
59
70
  }, [effect]);
@@ -73,16 +84,18 @@ var InternalCarousel = function InternalCarousel(props, ref) {
73
84
  }, [itemWidth]);
74
85
  var setScrollXEffectStyle = React.useCallback(function () {
75
86
  var _context;
76
- if (!listRef.current) return;
87
+ var tempChild = processChildren(children);
88
+ if (!listRef.current || tempChild.length <= 1) return;
77
89
  listRef.current.style.cssText = needAnimation ? _concatInstanceProperty(_context = "transform: translateX(".concat(posX, "px); transition:all 0.3s ")).call(_context, easing) : "transform: translateX(".concat(posX, "px); transition:none");
78
90
  }, [children === null || children === void 0 ? void 0 : children.length, needAnimation, easing, posX]);
79
91
  var jumpTo = React.useCallback(function (index, needAnimation) {
92
+ var tempChild = processChildren(children);
80
93
  if (isFadeEffect) {
81
- if (index === -1 || index === children.length) index = 0;
94
+ if (index === -1 || index === tempChild.length) index = 0;
82
95
  beforeChange && beforeChange(currentIndex, index);
83
96
  setCurrentIndex(index);
84
97
  setNeedAnimation(needAnimation);
85
- } else if (index >= -1 && index <= children.length) {
98
+ } else if (index >= -1 && index <= tempChild.length) {
86
99
  beforeChange && beforeChange(currentIndex, index);
87
100
  setCurrentIndex(index);
88
101
  setNeedAnimation(needAnimation);
@@ -169,8 +182,9 @@ var InternalCarousel = function InternalCarousel(props, ref) {
169
182
  setNeedAnimation(true);
170
183
  }, [beforeChange, currentIndex]);
171
184
  var handleTransitionEnd = React.useCallback(function () {
172
- if (!autoplay || !(children === null || children === void 0 ? void 0 : children.length)) return;
173
- var childrenL = children.length;
185
+ var tempChild = processChildren(children);
186
+ if (!autoplay || !(tempChild === null || tempChild === void 0 ? void 0 : tempChild.length)) return;
187
+ var childrenL = tempChild.length;
174
188
  var newCurrentIndex = currentIndex;
175
189
  if (isScrollxEffect) {
176
190
  if (currentIndex === -1) {
@@ -192,10 +206,11 @@ var InternalCarousel = function InternalCarousel(props, ref) {
192
206
  }, [play, autoplay]);
193
207
  var rootClassName = classNames(className, _defineProperty({}, "".concat(carouselPrefixCls, "-root"), true));
194
208
  var renderDisplayList = function renderDisplayList() {
209
+ var tempChild = processChildren(children);
195
210
  var content;
196
211
  if (isFadeEffect) {
197
212
  content = /*#__PURE__*/React.createElement(FadeList, {
198
- items: children,
213
+ items: tempChild,
199
214
  parentPrefixCls: carouselPrefixCls,
200
215
  needAnimation: needAnimation,
201
216
  currentIndex: currentIndex,
@@ -204,14 +219,14 @@ var InternalCarousel = function InternalCarousel(props, ref) {
204
219
  });
205
220
  } else if (isNoneEffect) {
206
221
  content = /*#__PURE__*/React.createElement(DisplayList, {
207
- items: children,
222
+ items: tempChild,
208
223
  parentPrefixCls: carouselPrefixCls,
209
224
  currentIndex: currentIndex,
210
225
  ref: listRef
211
226
  });
212
227
  } else {
213
228
  content = /*#__PURE__*/React.createElement(SlideList, {
214
- items: children,
229
+ items: tempChild,
215
230
  parentPrefixCls: carouselPrefixCls,
216
231
  currentIndex: currentIndex,
217
232
  ref: listRef
@@ -220,7 +235,8 @@ var InternalCarousel = function InternalCarousel(props, ref) {
220
235
  return content;
221
236
  };
222
237
  var renderJumpNode = function renderJumpNode() {
223
- if ((children === null || children === void 0 ? void 0 : children.length) && jumpNode) {
238
+ var tempChild = processChildren(children);
239
+ if ((tempChild === null || tempChild === void 0 ? void 0 : tempChild.length) && jumpNode) {
224
240
  var jumpClassPrefix = "".concat(carouselPrefixCls, "-jump");
225
241
  var leftClick = function leftClick(e) {
226
242
  e.stopPropagation();
@@ -230,7 +246,7 @@ var InternalCarousel = function InternalCarousel(props, ref) {
230
246
  };
231
247
  var rightClick = function rightClick(e) {
232
248
  e.stopPropagation();
233
- if (currentIndex !== children.length - 1) {
249
+ if (currentIndex !== tempChild.length - 1) {
234
250
  next();
235
251
  }
236
252
  };
@@ -258,7 +274,7 @@ var InternalCarousel = function InternalCarousel(props, ref) {
258
274
  onClick: leftClick
259
275
  }));
260
276
  var rightNode = /*#__PURE__*/React.createElement("div", {
261
- className: classNames(jumpClassPrefix, "".concat(jumpClassPrefix, "-right"), _defineProperty({}, "".concat(jumpClassPrefix, "-disabled"), currentIndex >= children.length - 1))
277
+ className: classNames(jumpClassPrefix, "".concat(jumpClassPrefix, "-right"), _defineProperty({}, "".concat(jumpClassPrefix, "-disabled"), currentIndex >= tempChild.length - 1))
262
278
  }, Array.isArray(jumpNode) && jumpNode.length > 1 && /*#__PURE__*/isValidElement(jumpNode[1]) ? /*#__PURE__*/React.cloneElement(jumpNode[1], mergeNode(jumpNode[1], 'right')) : /*#__PURE__*/React.createElement(Icon, {
263
279
  className: "".concat(jumpClassPrefix, "-icon"),
264
280
  type: 'arrow-right-circle-solid',
@@ -277,8 +293,8 @@ var InternalCarousel = function InternalCarousel(props, ref) {
277
293
  style: style,
278
294
  onMouseEnter: handleMouseEnter,
279
295
  onMouseLeave: handleMouseLeave
280
- }, (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, {
281
- number: children.length,
296
+ }, (tempChild === null || tempChild === void 0 ? void 0 : tempChild.length) ? renderDisplayList() : null, (tempChild === null || tempChild === void 0 ? void 0 : tempChild.length) && showDot() ? /*#__PURE__*/React.createElement(Slidebar, {
297
+ number: tempChild.length,
282
298
  currentIndex: currentIndex,
283
299
  dotsClassName: dots,
284
300
  parentPrefixCls: carouselPrefixCls,
@@ -13,7 +13,7 @@ export var SlideList = /*#__PURE__*/React.forwardRef(function (props, ref) {
13
13
  var listPrefixCls = "".concat(parentPrefixCls, "-list");
14
14
  var renderItems = function renderItems() {
15
15
  var _context;
16
- var _items = _concatInstanceProperty(_context = _sliceInstanceProperty(items).call(items, -1)).call(_context, items, _sliceInstanceProperty(items).call(items, 0, 1)); // 首位分别添加一项
16
+ var _items = items.length > 1 ? _concatInstanceProperty(_context = _sliceInstanceProperty(items).call(items, -1)).call(_context, items, _sliceInstanceProperty(items).call(items, 0, 1)) : items; // 首位分别添加一项
17
17
  return _mapInstanceProperty(_items).call(_items, function (item, index) {
18
18
  return /*#__PURE__*/React.createElement("li", {
19
19
  className: classNames("".concat(listPrefixCls, "-item"), _defineProperty({}, "".concat(listPrefixCls, "-item-active"), currentIndex === index - 1)),
@@ -108,12 +108,12 @@ var PreviewGroup = function PreviewGroup(_ref) {
108
108
  onPrevious: onPrevious
109
109
  };
110
110
  return /*#__PURE__*/React.createElement(React.Fragment, null, images.length > 1 ? _mapInstanceProperty(_context3 = React.Children).call(_context3, children, function (image, index) {
111
- var _a;
111
+ var _a, _b;
112
112
  return /*#__PURE__*/React.cloneElement(image, {
113
113
  key: image.key || index,
114
114
  preview: false,
115
115
  ref: refs[index],
116
- onClick: onPreview.bind(null, index, (_a = image === null || image === void 0 ? void 0 : image.props) === null || _a === void 0 ? void 0 : _a.src)
116
+ onClick: ((_a = image === null || image === void 0 ? void 0 : image.props) === null || _a === void 0 ? void 0 : _a.preview) !== false ? onPreview.bind(null, index, (_b = image === null || image === void 0 ? void 0 : image.props) === null || _b === void 0 ? void 0 : _b.src) : undefined
117
117
  });
118
118
  }) : children, exit && /*#__PURE__*/React.createElement(Preview, _extends({}, previewProps)));
119
119
  };
@@ -148,13 +148,13 @@ var DrawingBoard = /*#__PURE__*/forwardRef(function (props, ref) {
148
148
  d: "M9.16767025,16.9762781 C9.5300869,17.3386948 9.5300869,17.9262881 9.16767025,18.2887049 C8.84552213,18.6108529 8.34545651,18.6466472 7.98377112,18.3960875 L7.85524348,18.2887049 L0.815437446,11.2488988 C-0.203859357,10.229602 -0.267565411,8.61657722 0.624319283,7.52306442 L0.815437446,7.31161852 L7.85524348,0.271812484 C8.21766013,-0.0906041612 8.80525361,-0.0906041612 9.16767025,0.271812484 C9.48981838,0.593960608 9.5256126,1.09402626 9.27505297,1.45571158 L9.16767025,1.58423925 L2.39801882,8.35223283 L18.7197413,8.35223283 C24.8235066,8.35223283 28,11.88167 28,18.5605173 C28,25.0286774 25.0409921,28.8154573 19.1996764,29.6367412 L18.7197413,29.6968277 L3.87132753,29.6968277 C3.358793,29.6968277 2.94330165,29.2813365 2.94330165,28.7688019 C2.94330165,28.3132156 3.27159111,27.9343054 3.70451369,27.8557278 L3.87132753,27.840776 L18.6172581,27.846452 C23.6969089,27.2820464 26.1439483,24.2912204 26.1439483,18.5605173 C26.1439483,13.0283959 23.8870007,10.3626156 19.1446408,10.2148013 L18.7197413,10.2082845 L2.39987488,10.2082845 L9.16767025,16.9762781 Z",
149
149
  id: "\u8DEF\u5F84",
150
150
  fill: "currentColor"
151
- }))))) : null, onClear ? /*#__PURE__*/React.createElement(Icon, {
151
+ }))))) : null, /*#__PURE__*/React.createElement(Icon, {
152
152
  type: "delete",
153
153
  className: "".concat(prefixCls, "-drawing-board-clear"),
154
154
  onClick: function onClick() {
155
155
  return handleOnClear();
156
156
  }
157
- }) : null), /*#__PURE__*/React.createElement("span", {
157
+ })), /*#__PURE__*/React.createElement("span", {
158
158
  className: "".concat(prefixCls, "-drawing-board-tip")
159
159
  }, isEmpty ? signatureLangMsg === null || signatureLangMsg === void 0 ? void 0 : signatureLangMsg.pleaseWriteHere : ''), /*#__PURE__*/React.createElement("canvas", {
160
160
  ref: canvasRef
@@ -229,7 +229,12 @@ var Signature = function Signature(props) {
229
229
  id: "\u5F62\u72B6",
230
230
  fill: "#666666"
231
231
  }))))));
232
- return /*#__PURE__*/React.createElement(React.Fragment, null, dataUrl ? /*#__PURE__*/React.createElement(Image, {
232
+ return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
233
+ className: signatureClass,
234
+ ref: triggerRef,
235
+ style: style
236
+ }, dataUrl ? /*#__PURE__*/React.createElement(Image, {
237
+ className: "".concat(signaturePrefixCls, "-image"),
233
238
  preview: preview,
234
239
  src: dataUrl,
235
240
  title: "\u5220\u9664",
@@ -241,13 +246,11 @@ var Signature = function Signature(props) {
241
246
  }
242
247
  })] : undefined
243
248
  }) : /*#__PURE__*/React.createElement("div", {
244
- className: signatureClass,
245
- ref: triggerRef,
246
- onClick: handleOnClick,
247
- style: style
249
+ className: "".concat(signaturePrefixCls, "-empty"),
250
+ onClick: handleOnClick
248
251
  }, /*#__PURE__*/React.createElement(Icon, {
249
252
  type: "edit"
250
- }), /*#__PURE__*/React.createElement("span", null, signatureLangMsg === null || signatureLangMsg === void 0 ? void 0 : signatureLangMsg.clickToSign)), /*#__PURE__*/React.createElement(Modal, _extends({
253
+ }), /*#__PURE__*/React.createElement("span", null, signatureLangMsg === null || signatureLangMsg === void 0 ? void 0 : signatureLangMsg.clickToSign))), /*#__PURE__*/React.createElement(Modal, _extends({
251
254
  width: containerWidth,
252
255
  height: containerHeight,
253
256
  ref: modalRef,
@@ -106,9 +106,25 @@
106
106
  .kd-signature {
107
107
  -webkit-box-sizing: border-box;
108
108
  box-sizing: border-box;
109
- border: 1px dashed #e5e5e5;
110
109
  width: 100%;
111
110
  height: 100%;
111
+ }
112
+ .kd-signature-image {
113
+ width: 100%;
114
+ height: 100%;
115
+ -webkit-box-sizing: border-box;
116
+ box-sizing: border-box;
117
+ }
118
+ .kd-signature-image img {
119
+ width: 100%;
120
+ height: 100%;
121
+ }
122
+ .kd-signature-empty {
123
+ -webkit-box-sizing: border-box;
124
+ box-sizing: border-box;
125
+ width: 100%;
126
+ height: 100%;
127
+ border: 1px dashed #e5e5e5;
112
128
  display: -webkit-box;
113
129
  display: -ms-flexbox;
114
130
  display: flex;
@@ -130,7 +146,7 @@
130
146
  -webkit-transition: border-color var(--kd-c-signature-motion-duration, var(--kd-g-duration, 0.3s)), background-color var(--kd-c-signature-motion-duration, var(--kd-g-duration, 0.3s));
131
147
  transition: border-color var(--kd-c-signature-motion-duration, var(--kd-g-duration, 0.3s)), background-color var(--kd-c-signature-motion-duration, var(--kd-g-duration, 0.3s));
132
148
  }
133
- .kd-signature:hover {
149
+ .kd-signature-empty:hover {
134
150
  border-color: var(--kd-c-signature-border-color-hover, var(--kd-g-color-theme-5, #87adff));
135
151
  background-color: var(--kd-c-signature-bg-color-hover, var(--kd-g-color-theme-1, #f2f8ff));
136
152
  }
@@ -5,22 +5,36 @@
5
5
 
6
6
  .@{signature-prefix-cls} {
7
7
  box-sizing: border-box;
8
- border: 1px dashed #e5e5e5;
9
8
  width: 100%;
10
9
  height: 100%;
11
- display: flex;
12
- flex-direction: column;
13
- justify-content: center;
14
- align-items: center;
15
- background: @signature-bg-color;
16
- color: @signature-color-text;
17
- font-size: @signature-font-size;
18
- cursor: pointer;
19
- border-radius: @signature-border-radius;
20
- transition: border-color @signature-transition-duration, background-color @signature-transition-duration;
21
- &:hover {
22
- border-color: @signature-border-color-hover;
23
- background-color: @signature-bg-color-hover;
10
+ &-image {
11
+ width: 100%;
12
+ height: 100%;
13
+ box-sizing: border-box;
14
+ img {
15
+ width: 100%;
16
+ height: 100%;
17
+ }
18
+ }
19
+ &-empty {
20
+ box-sizing: border-box;
21
+ width: 100%;
22
+ height: 100%;
23
+ border: 1px dashed #e5e5e5;
24
+ display: flex;
25
+ flex-direction: column;
26
+ justify-content: center;
27
+ align-items: center;
28
+ background: @signature-bg-color;
29
+ color: @signature-color-text;
30
+ font-size: @signature-font-size;
31
+ cursor: pointer;
32
+ border-radius: @signature-border-radius;
33
+ transition: border-color @signature-transition-duration, background-color @signature-transition-duration;
34
+ &:hover {
35
+ border-color: @signature-border-color-hover;
36
+ background-color: @signature-bg-color-hover;
37
+ }
24
38
  }
25
39
  }
26
40
  .@{signature-prefix-cls}.@{signature-prefix-cls}-disabled {
@@ -68,6 +68,17 @@ var InternalCarousel = function InternalCarousel(props, ref) {
68
68
  var carouselRef = _react.default.useRef();
69
69
  var listRef = _react.default.useRef();
70
70
  var autoplayRef = _react.default.useRef();
71
+ var processChildren = function processChildren(children) {
72
+ var childCount = _react.default.Children.count(children);
73
+ if (childCount === 0) {
74
+ return [];
75
+ } else if (childCount === 1) {
76
+ return [children];
77
+ } else {
78
+ return _react.default.Children.toArray(children);
79
+ }
80
+ };
81
+ var tempChild = processChildren(children);
71
82
  var isScrollxEffect = _react.default.useMemo(function () {
72
83
  return effect === 'scrollx';
73
84
  }, [effect]);
@@ -87,16 +98,18 @@ var InternalCarousel = function InternalCarousel(props, ref) {
87
98
  }, [itemWidth]);
88
99
  var setScrollXEffectStyle = _react.default.useCallback(function () {
89
100
  var _context;
90
- if (!listRef.current) return;
101
+ var tempChild = processChildren(children);
102
+ if (!listRef.current || tempChild.length <= 1) return;
91
103
  listRef.current.style.cssText = needAnimation ? (0, _concat.default)(_context = "transform: translateX(".concat(posX, "px); transition:all 0.3s ")).call(_context, easing) : "transform: translateX(".concat(posX, "px); transition:none");
92
104
  }, [children === null || children === void 0 ? void 0 : children.length, needAnimation, easing, posX]);
93
105
  var jumpTo = _react.default.useCallback(function (index, needAnimation) {
106
+ var tempChild = processChildren(children);
94
107
  if (isFadeEffect) {
95
- if (index === -1 || index === children.length) index = 0;
108
+ if (index === -1 || index === tempChild.length) index = 0;
96
109
  beforeChange && beforeChange(currentIndex, index);
97
110
  setCurrentIndex(index);
98
111
  setNeedAnimation(needAnimation);
99
- } else if (index >= -1 && index <= children.length) {
112
+ } else if (index >= -1 && index <= tempChild.length) {
100
113
  beforeChange && beforeChange(currentIndex, index);
101
114
  setCurrentIndex(index);
102
115
  setNeedAnimation(needAnimation);
@@ -183,8 +196,9 @@ var InternalCarousel = function InternalCarousel(props, ref) {
183
196
  setNeedAnimation(true);
184
197
  }, [beforeChange, currentIndex]);
185
198
  var handleTransitionEnd = _react.default.useCallback(function () {
186
- if (!autoplay || !(children === null || children === void 0 ? void 0 : children.length)) return;
187
- var childrenL = children.length;
199
+ var tempChild = processChildren(children);
200
+ if (!autoplay || !(tempChild === null || tempChild === void 0 ? void 0 : tempChild.length)) return;
201
+ var childrenL = tempChild.length;
188
202
  var newCurrentIndex = currentIndex;
189
203
  if (isScrollxEffect) {
190
204
  if (currentIndex === -1) {
@@ -206,10 +220,11 @@ var InternalCarousel = function InternalCarousel(props, ref) {
206
220
  }, [play, autoplay]);
207
221
  var rootClassName = (0, _classnames.default)(className, (0, _defineProperty2.default)({}, "".concat(carouselPrefixCls, "-root"), true));
208
222
  var renderDisplayList = function renderDisplayList() {
223
+ var tempChild = processChildren(children);
209
224
  var content;
210
225
  if (isFadeEffect) {
211
226
  content = /*#__PURE__*/_react.default.createElement(_fadeList.FadeList, {
212
- items: children,
227
+ items: tempChild,
213
228
  parentPrefixCls: carouselPrefixCls,
214
229
  needAnimation: needAnimation,
215
230
  currentIndex: currentIndex,
@@ -218,14 +233,14 @@ var InternalCarousel = function InternalCarousel(props, ref) {
218
233
  });
219
234
  } else if (isNoneEffect) {
220
235
  content = /*#__PURE__*/_react.default.createElement(_displayList.DisplayList, {
221
- items: children,
236
+ items: tempChild,
222
237
  parentPrefixCls: carouselPrefixCls,
223
238
  currentIndex: currentIndex,
224
239
  ref: listRef
225
240
  });
226
241
  } else {
227
242
  content = /*#__PURE__*/_react.default.createElement(_slideList.SlideList, {
228
- items: children,
243
+ items: tempChild,
229
244
  parentPrefixCls: carouselPrefixCls,
230
245
  currentIndex: currentIndex,
231
246
  ref: listRef
@@ -234,7 +249,8 @@ var InternalCarousel = function InternalCarousel(props, ref) {
234
249
  return content;
235
250
  };
236
251
  var renderJumpNode = function renderJumpNode() {
237
- if ((children === null || children === void 0 ? void 0 : children.length) && jumpNode) {
252
+ var tempChild = processChildren(children);
253
+ if ((tempChild === null || tempChild === void 0 ? void 0 : tempChild.length) && jumpNode) {
238
254
  var jumpClassPrefix = "".concat(carouselPrefixCls, "-jump");
239
255
  var leftClick = function leftClick(e) {
240
256
  e.stopPropagation();
@@ -244,7 +260,7 @@ var InternalCarousel = function InternalCarousel(props, ref) {
244
260
  };
245
261
  var rightClick = function rightClick(e) {
246
262
  e.stopPropagation();
247
- if (currentIndex !== children.length - 1) {
263
+ if (currentIndex !== tempChild.length - 1) {
248
264
  next();
249
265
  }
250
266
  };
@@ -272,7 +288,7 @@ var InternalCarousel = function InternalCarousel(props, ref) {
272
288
  onClick: leftClick
273
289
  }));
274
290
  var rightNode = /*#__PURE__*/_react.default.createElement("div", {
275
- className: (0, _classnames.default)(jumpClassPrefix, "".concat(jumpClassPrefix, "-right"), (0, _defineProperty2.default)({}, "".concat(jumpClassPrefix, "-disabled"), currentIndex >= children.length - 1))
291
+ className: (0, _classnames.default)(jumpClassPrefix, "".concat(jumpClassPrefix, "-right"), (0, _defineProperty2.default)({}, "".concat(jumpClassPrefix, "-disabled"), currentIndex >= tempChild.length - 1))
276
292
  }, Array.isArray(jumpNode) && jumpNode.length > 1 && /*#__PURE__*/(0, _react.isValidElement)(jumpNode[1]) ? /*#__PURE__*/_react.default.cloneElement(jumpNode[1], mergeNode(jumpNode[1], 'right')) : /*#__PURE__*/_react.default.createElement(_icon.default, {
277
293
  className: "".concat(jumpClassPrefix, "-icon"),
278
294
  type: 'arrow-right-circle-solid',
@@ -291,8 +307,8 @@ var InternalCarousel = function InternalCarousel(props, ref) {
291
307
  style: style,
292
308
  onMouseEnter: handleMouseEnter,
293
309
  onMouseLeave: handleMouseLeave
294
- }, (children === null || children === void 0 ? void 0 : children.length) ? renderDisplayList() : null, (children === null || children === void 0 ? void 0 : children.length) && showDot() ? /*#__PURE__*/_react.default.createElement(_slidebar.Slidebar, {
295
- number: children.length,
310
+ }, (tempChild === null || tempChild === void 0 ? void 0 : tempChild.length) ? renderDisplayList() : null, (tempChild === null || tempChild === void 0 ? void 0 : tempChild.length) && showDot() ? /*#__PURE__*/_react.default.createElement(_slidebar.Slidebar, {
311
+ number: tempChild.length,
296
312
  currentIndex: currentIndex,
297
313
  dotsClassName: dots,
298
314
  parentPrefixCls: carouselPrefixCls,
@@ -20,7 +20,7 @@ var SlideList = /*#__PURE__*/_react.default.forwardRef(function (props, ref) {
20
20
  var listPrefixCls = "".concat(parentPrefixCls, "-list");
21
21
  var renderItems = function renderItems() {
22
22
  var _context;
23
- var _items = (0, _concat.default)(_context = (0, _slice.default)(items).call(items, -1)).call(_context, items, (0, _slice.default)(items).call(items, 0, 1)); // 首位分别添加一项
23
+ var _items = items.length > 1 ? (0, _concat.default)(_context = (0, _slice.default)(items).call(items, -1)).call(_context, items, (0, _slice.default)(items).call(items, 0, 1)) : items; // 首位分别添加一项
24
24
  return (0, _map.default)(_items).call(_items, function (item, index) {
25
25
  return /*#__PURE__*/_react.default.createElement("li", {
26
26
  className: (0, _classnames.default)("".concat(listPrefixCls, "-item"), (0, _defineProperty2.default)({}, "".concat(listPrefixCls, "-item-active"), currentIndex === index - 1)),
@@ -120,12 +120,12 @@ var PreviewGroup = function PreviewGroup(_ref) {
120
120
  onPrevious: onPrevious
121
121
  };
122
122
  return /*#__PURE__*/React.createElement(React.Fragment, null, images.length > 1 ? (0, _map.default)(_context3 = React.Children).call(_context3, children, function (image, index) {
123
- var _a;
123
+ var _a, _b;
124
124
  return /*#__PURE__*/React.cloneElement(image, {
125
125
  key: image.key || index,
126
126
  preview: false,
127
127
  ref: refs[index],
128
- onClick: onPreview.bind(null, index, (_a = image === null || image === void 0 ? void 0 : image.props) === null || _a === void 0 ? void 0 : _a.src)
128
+ onClick: ((_a = image === null || image === void 0 ? void 0 : image.props) === null || _a === void 0 ? void 0 : _a.preview) !== false ? onPreview.bind(null, index, (_b = image === null || image === void 0 ? void 0 : image.props) === null || _b === void 0 ? void 0 : _b.src) : undefined
129
129
  });
130
130
  }) : children, exit && /*#__PURE__*/React.createElement(_preview.default, (0, _extends2.default)({}, previewProps)));
131
131
  };
@@ -160,13 +160,13 @@ var DrawingBoard = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
160
160
  d: "M9.16767025,16.9762781 C9.5300869,17.3386948 9.5300869,17.9262881 9.16767025,18.2887049 C8.84552213,18.6108529 8.34545651,18.6466472 7.98377112,18.3960875 L7.85524348,18.2887049 L0.815437446,11.2488988 C-0.203859357,10.229602 -0.267565411,8.61657722 0.624319283,7.52306442 L0.815437446,7.31161852 L7.85524348,0.271812484 C8.21766013,-0.0906041612 8.80525361,-0.0906041612 9.16767025,0.271812484 C9.48981838,0.593960608 9.5256126,1.09402626 9.27505297,1.45571158 L9.16767025,1.58423925 L2.39801882,8.35223283 L18.7197413,8.35223283 C24.8235066,8.35223283 28,11.88167 28,18.5605173 C28,25.0286774 25.0409921,28.8154573 19.1996764,29.6367412 L18.7197413,29.6968277 L3.87132753,29.6968277 C3.358793,29.6968277 2.94330165,29.2813365 2.94330165,28.7688019 C2.94330165,28.3132156 3.27159111,27.9343054 3.70451369,27.8557278 L3.87132753,27.840776 L18.6172581,27.846452 C23.6969089,27.2820464 26.1439483,24.2912204 26.1439483,18.5605173 C26.1439483,13.0283959 23.8870007,10.3626156 19.1446408,10.2148013 L18.7197413,10.2082845 L2.39987488,10.2082845 L9.16767025,16.9762781 Z",
161
161
  id: "\u8DEF\u5F84",
162
162
  fill: "currentColor"
163
- }))))) : null, onClear ? /*#__PURE__*/_react.default.createElement(_icon.default, {
163
+ }))))) : null, /*#__PURE__*/_react.default.createElement(_icon.default, {
164
164
  type: "delete",
165
165
  className: "".concat(prefixCls, "-drawing-board-clear"),
166
166
  onClick: function onClick() {
167
167
  return handleOnClear();
168
168
  }
169
- }) : null), /*#__PURE__*/_react.default.createElement("span", {
169
+ })), /*#__PURE__*/_react.default.createElement("span", {
170
170
  className: "".concat(prefixCls, "-drawing-board-tip")
171
171
  }, isEmpty ? signatureLangMsg === null || signatureLangMsg === void 0 ? void 0 : signatureLangMsg.pleaseWriteHere : ''), /*#__PURE__*/_react.default.createElement("canvas", {
172
172
  ref: canvasRef
@@ -242,7 +242,12 @@ var Signature = function Signature(props) {
242
242
  id: "\u5F62\u72B6",
243
243
  fill: "#666666"
244
244
  }))))));
245
- return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, dataUrl ? /*#__PURE__*/_react.default.createElement(_image.default, {
245
+ return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("div", {
246
+ className: signatureClass,
247
+ ref: triggerRef,
248
+ style: style
249
+ }, dataUrl ? /*#__PURE__*/_react.default.createElement(_image.default, {
250
+ className: "".concat(signaturePrefixCls, "-image"),
246
251
  preview: preview,
247
252
  src: dataUrl,
248
253
  title: "\u5220\u9664",
@@ -254,13 +259,11 @@ var Signature = function Signature(props) {
254
259
  }
255
260
  })] : undefined
256
261
  }) : /*#__PURE__*/_react.default.createElement("div", {
257
- className: signatureClass,
258
- ref: triggerRef,
259
- onClick: handleOnClick,
260
- style: style
262
+ className: "".concat(signaturePrefixCls, "-empty"),
263
+ onClick: handleOnClick
261
264
  }, /*#__PURE__*/_react.default.createElement(_icon.default, {
262
265
  type: "edit"
263
- }), /*#__PURE__*/_react.default.createElement("span", null, signatureLangMsg === null || signatureLangMsg === void 0 ? void 0 : signatureLangMsg.clickToSign)), /*#__PURE__*/_react.default.createElement(_modal.default, (0, _extends2.default)({
266
+ }), /*#__PURE__*/_react.default.createElement("span", null, signatureLangMsg === null || signatureLangMsg === void 0 ? void 0 : signatureLangMsg.clickToSign))), /*#__PURE__*/_react.default.createElement(_modal.default, (0, _extends2.default)({
264
267
  width: containerWidth,
265
268
  height: containerHeight,
266
269
  ref: modalRef,
@@ -106,9 +106,25 @@
106
106
  .kd-signature {
107
107
  -webkit-box-sizing: border-box;
108
108
  box-sizing: border-box;
109
- border: 1px dashed #e5e5e5;
110
109
  width: 100%;
111
110
  height: 100%;
111
+ }
112
+ .kd-signature-image {
113
+ width: 100%;
114
+ height: 100%;
115
+ -webkit-box-sizing: border-box;
116
+ box-sizing: border-box;
117
+ }
118
+ .kd-signature-image img {
119
+ width: 100%;
120
+ height: 100%;
121
+ }
122
+ .kd-signature-empty {
123
+ -webkit-box-sizing: border-box;
124
+ box-sizing: border-box;
125
+ width: 100%;
126
+ height: 100%;
127
+ border: 1px dashed #e5e5e5;
112
128
  display: -webkit-box;
113
129
  display: -ms-flexbox;
114
130
  display: flex;
@@ -130,7 +146,7 @@
130
146
  -webkit-transition: border-color var(--kd-c-signature-motion-duration, var(--kd-g-duration, 0.3s)), background-color var(--kd-c-signature-motion-duration, var(--kd-g-duration, 0.3s));
131
147
  transition: border-color var(--kd-c-signature-motion-duration, var(--kd-g-duration, 0.3s)), background-color var(--kd-c-signature-motion-duration, var(--kd-g-duration, 0.3s));
132
148
  }
133
- .kd-signature:hover {
149
+ .kd-signature-empty:hover {
134
150
  border-color: var(--kd-c-signature-border-color-hover, var(--kd-g-color-theme-5, #87adff));
135
151
  background-color: var(--kd-c-signature-bg-color-hover, var(--kd-g-color-theme-1, #f2f8ff));
136
152
  }
@@ -5,22 +5,36 @@
5
5
 
6
6
  .@{signature-prefix-cls} {
7
7
  box-sizing: border-box;
8
- border: 1px dashed #e5e5e5;
9
8
  width: 100%;
10
9
  height: 100%;
11
- display: flex;
12
- flex-direction: column;
13
- justify-content: center;
14
- align-items: center;
15
- background: @signature-bg-color;
16
- color: @signature-color-text;
17
- font-size: @signature-font-size;
18
- cursor: pointer;
19
- border-radius: @signature-border-radius;
20
- transition: border-color @signature-transition-duration, background-color @signature-transition-duration;
21
- &:hover {
22
- border-color: @signature-border-color-hover;
23
- background-color: @signature-bg-color-hover;
10
+ &-image {
11
+ width: 100%;
12
+ height: 100%;
13
+ box-sizing: border-box;
14
+ img {
15
+ width: 100%;
16
+ height: 100%;
17
+ }
18
+ }
19
+ &-empty {
20
+ box-sizing: border-box;
21
+ width: 100%;
22
+ height: 100%;
23
+ border: 1px dashed #e5e5e5;
24
+ display: flex;
25
+ flex-direction: column;
26
+ justify-content: center;
27
+ align-items: center;
28
+ background: @signature-bg-color;
29
+ color: @signature-color-text;
30
+ font-size: @signature-font-size;
31
+ cursor: pointer;
32
+ border-radius: @signature-border-radius;
33
+ transition: border-color @signature-transition-duration, background-color @signature-transition-duration;
34
+ &:hover {
35
+ border-color: @signature-border-color-hover;
36
+ background-color: @signature-bg-color-hover;
37
+ }
24
38
  }
25
39
  }
26
40
  .@{signature-prefix-cls}.@{signature-prefix-cls}-disabled {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kdcloudjs/kdesign",
3
- "version": "1.8.1",
3
+ "version": "1.8.3",
4
4
  "description": "KDesign 金蝶前端react 组件库",
5
5
  "title": "kdesign",
6
6
  "keywords": [