@kdcloudjs/kdesign 1.6.8 → 1.6.11

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.
Files changed (40) hide show
  1. package/CHANGELOG.md +27 -0
  2. package/dist/kdesign-complete.less +5 -21
  3. package/dist/kdesign.css +19 -19
  4. package/dist/kdesign.css.map +1 -1
  5. package/dist/kdesign.js +117 -84
  6. package/dist/kdesign.js.map +1 -1
  7. package/dist/kdesign.min.css +3 -3
  8. package/dist/kdesign.min.js +6 -6
  9. package/dist/kdesign.min.js.map +1 -1
  10. package/es/date-picker/date-picker.js +3 -1
  11. package/es/date-picker/range-picker.d.ts +1 -0
  12. package/es/date-picker/range-picker.js +4 -2
  13. package/es/dropdown/style/index.css +0 -18
  14. package/es/dropdown/style/index.less +0 -21
  15. package/es/form/Field.js +5 -1
  16. package/es/form/FieldContext.js +1 -0
  17. package/es/form/hooks/useForm.js +3 -3
  18. package/es/form/interface.d.ts +1 -0
  19. package/es/menu/style/index.css +18 -0
  20. package/es/menu/style/mixin.less +5 -0
  21. package/es/select/interface.d.ts +1 -0
  22. package/es/select/select.js +7 -5
  23. package/es/upload/interface.d.ts +7 -0
  24. package/es/upload/upload.js +96 -73
  25. package/lib/date-picker/date-picker.js +3 -1
  26. package/lib/date-picker/range-picker.d.ts +1 -0
  27. package/lib/date-picker/range-picker.js +4 -2
  28. package/lib/dropdown/style/index.css +0 -18
  29. package/lib/dropdown/style/index.less +0 -21
  30. package/lib/form/Field.js +5 -1
  31. package/lib/form/FieldContext.js +1 -0
  32. package/lib/form/hooks/useForm.js +3 -3
  33. package/lib/form/interface.d.ts +1 -0
  34. package/lib/menu/style/index.css +18 -0
  35. package/lib/menu/style/mixin.less +5 -0
  36. package/lib/select/interface.d.ts +1 -0
  37. package/lib/select/select.js +7 -5
  38. package/lib/upload/interface.d.ts +7 -0
  39. package/lib/upload/upload.js +96 -73
  40. package/package.json +1 -1
@@ -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));
@@ -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
  }
@@ -36,6 +36,7 @@ export interface AbstractSelectProps extends PopperProps {
36
36
  maxTagPlaceholder?: React.ReactNode | ((omittedValues: LabeledValue[]) => React.ReactNode);
37
37
  filterOption?: boolean | ((inputValue: string, option?: OptionsType) => boolean);
38
38
  optionFilterProp?: string;
39
+ optionLabelProp?: string;
39
40
  }
40
41
  export interface LabeledValue {
41
42
  key?: string;
@@ -313,20 +313,22 @@ var InternalSelect = function InternalSelect(props, ref) {
313
313
  var getOptionLabel = (0, _react.useCallback)(function (obj) {
314
314
  var _a;
315
315
 
316
+ var text = 'options' in selectProps ? 'label' : optionLabelProp;
317
+
316
318
  if (obj.props) {
317
- if (optionLabelProp) {
318
- return obj === null || obj === void 0 ? void 0 : obj.props[optionLabelProp];
319
+ if (text) {
320
+ return obj === null || obj === void 0 ? void 0 : obj.props[text];
319
321
  }
320
322
 
321
323
  return (_a = obj.props) === null || _a === void 0 ? void 0 : _a.children;
322
324
  } else {
323
- if (optionLabelProp) {
324
- return obj[optionLabelProp];
325
+ if (text) {
326
+ return obj[text];
325
327
  }
326
328
  }
327
329
 
328
330
  return obj === null || obj === void 0 ? void 0 : obj.label;
329
- }, [optionLabelProp]); // 点击下拉列表中某项回调
331
+ }, [optionLabelProp, selectProps]); // 点击下拉列表中某项回调
330
332
 
331
333
  var handleOption = function handleOption(key, label, isSelected) {
332
334
  var onSelect = selectProps.onSelect,
@@ -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 {};
@@ -147,6 +147,7 @@ var InternalUpload = function InternalUpload(props, ref) {
147
147
  onRemove = allProps.onRemove,
148
148
  directory = allProps.directory,
149
149
  className = allProps.className,
150
+ itemRender = allProps.itemRender,
150
151
  showUploadList = allProps.showUploadList,
151
152
  customPrefixcls = allProps.prefixCls;
152
153
 
@@ -391,13 +392,6 @@ var InternalUpload = function InternalUpload(props, ref) {
391
392
  directory: directory ? 'directory' : undefined,
392
393
  webkitdirectory: directory ? 'webkitdirectory' : undefined
393
394
  };
394
- var mapStatus = {
395
- uploading: 'loadding',
396
- error: 'warning-solid',
397
- done: 'attachment',
398
- success: 'attachment',
399
- notStart: 'attachment'
400
- };
401
395
  var dragEvents = {};
402
396
 
403
397
  var _React$useState3 = React.useState(false),
@@ -493,76 +487,105 @@ var InternalUpload = function InternalUpload(props, ref) {
493
487
  }, inputFileProps, {
494
488
  ref: mergedRef
495
489
  }))))), showUploadList && (0, _map.default)(fileList).call(fileList, function (file) {
496
- var _context8, _context9, _context10, _context11, _context12, _context13, _context14, _context15, _context16, _context17, _context18, _context19, _context20;
497
-
498
- return /*#__PURE__*/React.createElement("li", {
499
- key: file.uid,
500
- className: (0, _classnames.default)((0, _concat.default)(_context8 = "".concat(prefixCls, "-")).call(_context8, listType, "-list-item"), {
501
- error: file.status === 'error'
502
- })
503
- }, listType === 'text' ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("span", {
504
- className: (0, _concat.default)(_context9 = "".concat(prefixCls, "-")).call(_context9, listType, "-list-item-icon")
505
- }, /*#__PURE__*/React.createElement(_icon.default, {
506
- spin: file.status === 'uploading',
507
- type: mapStatus[file.status]
508
- })), /*#__PURE__*/React.createElement("span", {
509
- className: (0, _concat.default)(_context10 = "".concat(prefixCls, "-")).call(_context10, listType, "-list-item-name"),
510
- title: file.name
511
- }, file.name), /*#__PURE__*/React.createElement("span", {
512
- className: (0, _concat.default)(_context11 = "".concat(prefixCls, "-")).call(_context11, listType, "-list-item-size")
513
- }, "(", (0, _utils2.getFileSize)(file.size), ")"), /*#__PURE__*/React.createElement("div", {
514
- className: (0, _concat.default)(_context12 = "".concat(prefixCls, "-")).call(_context12, listType, "-list-item-action")
515
- }, file.status === 'error' && /*#__PURE__*/React.createElement("a", {
516
- href: "true",
517
- className: (0, _concat.default)(_context13 = "".concat(prefixCls, "-")).call(_context13, listType, "-list-item-reupload"),
518
- onClick: handleReUpload.bind(_this, file)
519
- }, "\u91CD\u65B0\u4E0A\u4F20"), /*#__PURE__*/React.createElement("a", {
520
- href: "true",
521
- className: (0, _concat.default)(_context14 = "".concat(prefixCls, "-")).call(_context14, listType, "-list-item-delete"),
522
- onClick: handleRemove.bind(_this, file)
523
- }, "\u5220\u9664"))) : file.status === 'uploading' ? /*#__PURE__*/React.createElement("div", {
524
- className: (0, _concat.default)(_context15 = "".concat(prefixCls, "-")).call(_context15, listType, "-list-item-loading")
525
- }, /*#__PURE__*/React.createElement(_progress.default, {
526
- percent: file.percent,
527
- textMap: ['文件上传中'],
528
- showInfo: false
529
- })) : file.status === 'error' ? /*#__PURE__*/React.createElement("div", {
530
- className: (0, _concat.default)(_context16 = "".concat(prefixCls, "-")).call(_context16, listType, "-list-item-error")
531
- }, /*#__PURE__*/React.createElement("div", {
532
- className: (0, _concat.default)(_context17 = "".concat(prefixCls, "-")).call(_context17, listType, "-list-item-error-text")
533
- }, /*#__PURE__*/React.createElement(_icon.default, {
534
- type: mapStatus[file.status],
535
- style: {
536
- verticalAlign: 'top'
537
- }
538
- }), "\u4E0A\u4F20\u5931\u8D25"), /*#__PURE__*/React.createElement("div", {
539
- className: (0, _concat.default)(_context18 = "".concat(prefixCls, "-")).call(_context18, listType, "-list-item-action")
540
- }, /*#__PURE__*/React.createElement("a", {
541
- href: "true",
542
- className: (0, _concat.default)(_context19 = "".concat(prefixCls, "-")).call(_context19, listType, "-list-item-reupload"),
543
- onClick: handleReUpload.bind(_this, file)
544
- }, "\u91CD\u65B0\u4E0A\u4F20"), /*#__PURE__*/React.createElement("a", {
545
- href: "true",
546
- className: (0, _concat.default)(_context20 = "".concat(prefixCls, "-")).call(_context20, listType, "-list-item-delete"),
547
- onClick: handleRemove.bind(_this, file)
548
- }, "\u5220\u9664"))) : /*#__PURE__*/React.createElement(_image.default, {
549
- previewType: "upload",
550
- name: file.name,
551
- size: (0, _utils2.getFileSize)(file.size),
552
- src: file.thumbUrl || file.url,
553
- style: {
554
- width: '100%',
555
- height: '100%'
556
- },
557
- operations: [/*#__PURE__*/React.createElement(_icon.default, {
558
- key: "1",
559
- type: "delete",
560
- onClick: handleRemove.bind(_this, file)
561
- })]
490
+ return itemRender ? itemRender( /*#__PURE__*/React.createElement(Item, (0, _extends2.default)({}, {
491
+ file: file,
492
+ prefixCls: prefixCls,
493
+ listType: listType,
494
+ handleReUpload: handleReUpload,
495
+ handleRemove: handleRemove
496
+ })), file, setFileList) : /*#__PURE__*/React.createElement(Item, (0, _extends2.default)({
497
+ key: file.uid
498
+ }, {
499
+ file: file,
500
+ prefixCls: prefixCls,
501
+ listType: listType,
502
+ handleReUpload: handleReUpload,
503
+ handleRemove: handleRemove
562
504
  }));
563
505
  })));
564
506
  };
565
507
 
508
+ var Item = function Item(_ref3) {
509
+ var _context8, _context9, _context10, _context11, _context12, _context13, _context14, _context15, _context16, _context17, _context18, _context19, _context20;
510
+
511
+ var file = _ref3.file,
512
+ prefixCls = _ref3.prefixCls,
513
+ listType = _ref3.listType,
514
+ handleReUpload = _ref3.handleReUpload,
515
+ handleRemove = _ref3.handleRemove;
516
+ var mapStatus = {
517
+ uploading: 'loadding',
518
+ error: 'warning-solid',
519
+ done: 'attachment',
520
+ success: 'attachment',
521
+ notStart: 'attachment'
522
+ };
523
+ return /*#__PURE__*/React.createElement("li", {
524
+ className: (0, _classnames.default)((0, _concat.default)(_context8 = "".concat(prefixCls, "-")).call(_context8, listType, "-list-item"), {
525
+ error: file.status === 'error'
526
+ })
527
+ }, listType === 'text' ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("span", {
528
+ className: (0, _concat.default)(_context9 = "".concat(prefixCls, "-")).call(_context9, listType, "-list-item-icon")
529
+ }, /*#__PURE__*/React.createElement(_icon.default, {
530
+ spin: file.status === 'uploading',
531
+ type: mapStatus[file.status]
532
+ })), /*#__PURE__*/React.createElement("span", {
533
+ className: (0, _concat.default)(_context10 = "".concat(prefixCls, "-")).call(_context10, listType, "-list-item-name"),
534
+ title: file.name
535
+ }, file.name), /*#__PURE__*/React.createElement("span", {
536
+ className: (0, _concat.default)(_context11 = "".concat(prefixCls, "-")).call(_context11, listType, "-list-item-size")
537
+ }, "(", (0, _utils2.getFileSize)(file.size), ")"), /*#__PURE__*/React.createElement("div", {
538
+ className: (0, _concat.default)(_context12 = "".concat(prefixCls, "-")).call(_context12, listType, "-list-item-action")
539
+ }, file.status === 'error' && /*#__PURE__*/React.createElement("a", {
540
+ href: "true",
541
+ className: (0, _concat.default)(_context13 = "".concat(prefixCls, "-")).call(_context13, listType, "-list-item-reupload"),
542
+ onClick: handleReUpload.bind(_this, file)
543
+ }, "\u91CD\u65B0\u4E0A\u4F20"), /*#__PURE__*/React.createElement("a", {
544
+ href: "true",
545
+ className: (0, _concat.default)(_context14 = "".concat(prefixCls, "-")).call(_context14, listType, "-list-item-delete"),
546
+ onClick: handleRemove.bind(_this, file)
547
+ }, "\u5220\u9664"))) : file.status === 'uploading' ? /*#__PURE__*/React.createElement("div", {
548
+ className: (0, _concat.default)(_context15 = "".concat(prefixCls, "-")).call(_context15, listType, "-list-item-loading")
549
+ }, /*#__PURE__*/React.createElement(_progress.default, {
550
+ percent: file.percent,
551
+ textMap: ['文件上传中'],
552
+ showInfo: false
553
+ })) : file.status === 'error' ? /*#__PURE__*/React.createElement("div", {
554
+ className: (0, _concat.default)(_context16 = "".concat(prefixCls, "-")).call(_context16, listType, "-list-item-error")
555
+ }, /*#__PURE__*/React.createElement("div", {
556
+ className: (0, _concat.default)(_context17 = "".concat(prefixCls, "-")).call(_context17, listType, "-list-item-error-text")
557
+ }, /*#__PURE__*/React.createElement(_icon.default, {
558
+ type: mapStatus[file.status],
559
+ style: {
560
+ verticalAlign: 'top'
561
+ }
562
+ }), "\u4E0A\u4F20\u5931\u8D25"), /*#__PURE__*/React.createElement("div", {
563
+ className: (0, _concat.default)(_context18 = "".concat(prefixCls, "-")).call(_context18, listType, "-list-item-action")
564
+ }, /*#__PURE__*/React.createElement("a", {
565
+ href: "true",
566
+ className: (0, _concat.default)(_context19 = "".concat(prefixCls, "-")).call(_context19, listType, "-list-item-reupload"),
567
+ onClick: handleReUpload.bind(_this, file)
568
+ }, "\u91CD\u65B0\u4E0A\u4F20"), /*#__PURE__*/React.createElement("a", {
569
+ href: "true",
570
+ className: (0, _concat.default)(_context20 = "".concat(prefixCls, "-")).call(_context20, listType, "-list-item-delete"),
571
+ onClick: handleRemove.bind(_this, file)
572
+ }, "\u5220\u9664"))) : /*#__PURE__*/React.createElement(_image.default, {
573
+ previewType: "upload",
574
+ name: file.name,
575
+ size: (0, _utils2.getFileSize)(file.size),
576
+ src: file.thumbUrl || file.url,
577
+ style: {
578
+ width: '100%',
579
+ height: '100%'
580
+ },
581
+ operations: [/*#__PURE__*/React.createElement(_icon.default, {
582
+ key: "1",
583
+ type: "delete",
584
+ onClick: handleRemove.bind(_this, file)
585
+ })]
586
+ }));
587
+ };
588
+
566
589
  var Upload = /*#__PURE__*/React.forwardRef(InternalUpload);
567
590
  Upload.displayName = 'Upload';
568
591
  var _default = Upload;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kdcloudjs/kdesign",
3
- "version": "1.6.8",
3
+ "version": "1.6.11",
4
4
  "description": "KDesign 金蝶前端react 组件库",
5
5
  "title": "kdesign",
6
6
  "keywords": [