@dtjoy/dt-design 1.0.5 → 1.0.7

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 (179) hide show
  1. package/esm/_util/easings.js +9 -0
  2. package/esm/_util/extendsObject.js +17 -0
  3. package/esm/_util/getScroll.js +32 -0
  4. package/esm/_util/hooks/index.js +4 -1
  5. package/esm/_util/hooks/useForceUpdate.js +6 -0
  6. package/esm/_util/hooks/useProxyImperativeHandle.js +31 -0
  7. package/esm/_util/hooks/useSyncState.js +20 -0
  8. package/esm/_util/scrollTo.js +38 -0
  9. package/esm/_util/warning.js +63 -0
  10. package/esm/blockHeader/index.js +10 -8
  11. package/esm/blockHeader/style/index.less +143 -143
  12. package/esm/button/index.js +7 -15
  13. package/esm/button/style/index.less +52 -127
  14. package/esm/button/style/mixin.less +34 -42
  15. package/esm/collapsible/index.js +53 -55
  16. package/esm/collapsibleActionItems/index.js +2 -2
  17. package/esm/flex/index.js +1 -1
  18. package/esm/flex/style/index.less +76 -76
  19. package/esm/flex/utils.js +1 -1
  20. package/esm/formList/index.js +13 -11
  21. package/esm/formList/style/index.less +45 -45
  22. package/esm/index.js +3 -1
  23. package/esm/overflowList/index.js +4 -3
  24. package/esm/resize/index.js +1 -1
  25. package/esm/resizeObserver/index.js +3 -2
  26. package/esm/splitter/Panel.js +3 -3
  27. package/esm/splitter/SplitBar.js +8 -7
  28. package/esm/splitter/Splitter.js +5 -4
  29. package/esm/splitter/hooks/useItems.js +2 -2
  30. package/esm/splitter/hooks/useResize.js +5 -5
  31. package/esm/statusTag/index.js +8 -8
  32. package/esm/style/index.less +1 -1
  33. package/esm/style/themes/index.less +2 -2
  34. package/esm/style/themes/variable.less +4 -0
  35. package/esm/table/InternalTable.js +429 -0
  36. package/esm/table/RcTable/VirtualTable.js +9 -0
  37. package/esm/table/RcTable/index.js +9 -0
  38. package/esm/table/Table.js +28 -0
  39. package/esm/table/TableMeasureRowContext.js +3 -0
  40. package/esm/table/hooks/useContainerWidth.js +14 -0
  41. package/esm/table/index.js +2 -0
  42. package/esm/table/interface.js +4 -0
  43. package/esm/table/style/bordered.less +141 -0
  44. package/esm/table/style/fixed.less +88 -0
  45. package/esm/table/style/index.js +2 -0
  46. package/esm/table/style/index.less +150 -0
  47. package/esm/table/style/selection.less +90 -0
  48. package/esm/table/style/sticky.less +55 -0
  49. package/esm/table/style/virtual.less +65 -0
  50. package/esm/table/util.js +33 -0
  51. package/lib/_util/easings.js +15 -0
  52. package/lib/_util/extendsObject.js +20 -0
  53. package/lib/_util/getScroll.js +39 -0
  54. package/lib/_util/hooks/index.js +33 -0
  55. package/lib/_util/hooks/useForceUpdate.js +12 -0
  56. package/lib/_util/hooks/useProxyImperativeHandle.js +40 -0
  57. package/lib/_util/hooks/useSyncState.js +19 -0
  58. package/lib/_util/scrollTo.js +44 -0
  59. package/lib/_util/warning.js +75 -0
  60. package/lib/blockHeader/index.js +10 -8
  61. package/lib/blockHeader/style/index.less +143 -143
  62. package/lib/button/index.js +6 -14
  63. package/lib/button/style/index.less +52 -127
  64. package/lib/button/style/mixin.less +34 -42
  65. package/lib/collapsible/index.js +49 -49
  66. package/lib/collapsibleActionItems/index.js +2 -2
  67. package/lib/flex/index.js +2 -2
  68. package/lib/flex/style/index.less +76 -76
  69. package/lib/flex/utils.js +2 -2
  70. package/lib/formList/index.js +10 -10
  71. package/lib/formList/style/index.less +45 -45
  72. package/lib/index.js +21 -2
  73. package/lib/overflowList/index.js +4 -3
  74. package/lib/resize/index.js +1 -1
  75. package/lib/resizeObserver/index.js +3 -2
  76. package/lib/splitter/Panel.js +3 -3
  77. package/lib/splitter/SplitBar.js +8 -7
  78. package/lib/splitter/Splitter.js +5 -4
  79. package/lib/splitter/hooks/useItems.js +2 -2
  80. package/lib/splitter/hooks/useResize.js +5 -5
  81. package/lib/statusTag/index.js +8 -8
  82. package/lib/style/index.less +1 -1
  83. package/lib/style/themes/index.less +2 -2
  84. package/lib/style/themes/variable.less +4 -0
  85. package/lib/table/InternalTable.js +395 -0
  86. package/lib/table/RcTable/VirtualTable.js +17 -0
  87. package/lib/table/RcTable/index.js +17 -0
  88. package/lib/table/Table.js +37 -0
  89. package/lib/table/TableMeasureRowContext.js +10 -0
  90. package/lib/table/hooks/useContainerWidth.js +20 -0
  91. package/lib/table/index.js +9 -0
  92. package/lib/table/interface.js +8 -0
  93. package/lib/table/style/bordered.less +141 -0
  94. package/lib/table/style/fixed.less +88 -0
  95. package/lib/table/style/index.js +4 -0
  96. package/lib/table/style/index.less +150 -0
  97. package/lib/table/style/selection.less +90 -0
  98. package/lib/table/style/sticky.less +55 -0
  99. package/lib/table/style/virtual.less +65 -0
  100. package/lib/table/util.js +44 -0
  101. package/package.json +82 -66
  102. package/esm/_util/gapSize.d.ts +0 -3
  103. package/esm/_util/hooks/index.d.ts +0 -1
  104. package/esm/_util/hooks/useOrientation.d.ts +0 -2
  105. package/esm/_util/index.d.ts +0 -3
  106. package/esm/_util/isNonNullable.d.ts +0 -2
  107. package/esm/_util/type.d.ts +0 -52
  108. package/esm/blockHeader/index.d.ts +0 -47
  109. package/esm/blockHeader/style/index.d.ts +0 -2
  110. package/esm/button/index.d.ts +0 -10
  111. package/esm/button/style/index.d.ts +0 -2
  112. package/esm/collapsible/index.d.ts +0 -97
  113. package/esm/collapsible/style/index.d.ts +0 -1
  114. package/esm/collapsibleActionItems/index.d.ts +0 -24
  115. package/esm/collapsibleActionItems/style/index.d.ts +0 -2
  116. package/esm/flex/index.d.ts +0 -7
  117. package/esm/flex/interface.d.ts +0 -16
  118. package/esm/flex/style/index.d.ts +0 -2
  119. package/esm/flex/utils.d.ts +0 -7
  120. package/esm/formList/index.d.ts +0 -77
  121. package/esm/formList/style/index.d.ts +0 -2
  122. package/esm/index.d.ts +0 -14
  123. package/esm/overflowList/index.d.ts +0 -39
  124. package/esm/overflowList/style/index.d.ts +0 -2
  125. package/esm/resize/index.d.ts +0 -8
  126. package/esm/resizeObserver/index.d.ts +0 -45
  127. package/esm/splitter/Panel.d.ts +0 -7
  128. package/esm/splitter/SplitBar.d.ts +0 -24
  129. package/esm/splitter/Splitter.d.ts +0 -5
  130. package/esm/splitter/hooks/sizeUtil.d.ts +0 -3
  131. package/esm/splitter/hooks/useItems.d.ts +0 -14
  132. package/esm/splitter/hooks/useResizable.d.ts +0 -10
  133. package/esm/splitter/hooks/useResize.d.ts +0 -6
  134. package/esm/splitter/hooks/useSizes.d.ts +0 -4
  135. package/esm/splitter/index.d.ts +0 -8
  136. package/esm/splitter/interface.d.ts +0 -69
  137. package/esm/splitter/style/index.d.ts +0 -2
  138. package/esm/statusTag/index.d.ts +0 -28
  139. package/esm/statusTag/style/index.d.ts +0 -2
  140. package/esm/style/index.d.ts +0 -1
  141. package/lib/_util/gapSize.d.ts +0 -3
  142. package/lib/_util/hooks/index.d.ts +0 -1
  143. package/lib/_util/hooks/useOrientation.d.ts +0 -2
  144. package/lib/_util/index.d.ts +0 -3
  145. package/lib/_util/isNonNullable.d.ts +0 -2
  146. package/lib/_util/type.d.ts +0 -52
  147. package/lib/blockHeader/index.d.ts +0 -47
  148. package/lib/blockHeader/style/index.d.ts +0 -2
  149. package/lib/button/index.d.ts +0 -10
  150. package/lib/button/style/index.d.ts +0 -2
  151. package/lib/collapsible/index.d.ts +0 -97
  152. package/lib/collapsible/style/index.d.ts +0 -1
  153. package/lib/collapsibleActionItems/index.d.ts +0 -24
  154. package/lib/collapsibleActionItems/style/index.d.ts +0 -2
  155. package/lib/flex/index.d.ts +0 -7
  156. package/lib/flex/interface.d.ts +0 -16
  157. package/lib/flex/style/index.d.ts +0 -2
  158. package/lib/flex/utils.d.ts +0 -7
  159. package/lib/formList/index.d.ts +0 -77
  160. package/lib/formList/style/index.d.ts +0 -2
  161. package/lib/index.d.ts +0 -14
  162. package/lib/overflowList/index.d.ts +0 -39
  163. package/lib/overflowList/style/index.d.ts +0 -2
  164. package/lib/resize/index.d.ts +0 -8
  165. package/lib/resizeObserver/index.d.ts +0 -45
  166. package/lib/splitter/Panel.d.ts +0 -7
  167. package/lib/splitter/SplitBar.d.ts +0 -24
  168. package/lib/splitter/Splitter.d.ts +0 -5
  169. package/lib/splitter/hooks/sizeUtil.d.ts +0 -3
  170. package/lib/splitter/hooks/useItems.d.ts +0 -14
  171. package/lib/splitter/hooks/useResizable.d.ts +0 -10
  172. package/lib/splitter/hooks/useResize.d.ts +0 -6
  173. package/lib/splitter/hooks/useSizes.d.ts +0 -4
  174. package/lib/splitter/index.d.ts +0 -8
  175. package/lib/splitter/interface.d.ts +0 -69
  176. package/lib/splitter/style/index.d.ts +0 -2
  177. package/lib/statusTag/index.d.ts +0 -28
  178. package/lib/statusTag/style/index.d.ts +0 -2
  179. package/lib/style/index.d.ts +0 -1
@@ -0,0 +1,9 @@
1
+ export function easeInOutCubic(t, b, c, d) {
2
+ var cc = c - b;
3
+ t /= d / 2;
4
+ if (t < 1) {
5
+ return cc / 2 * t * t * t + b;
6
+ }
7
+ // biome-ignore lint: it is a common easing function
8
+ return cc / 2 * ((t -= 2) * t * t + 2) + b;
9
+ }
@@ -0,0 +1,17 @@
1
+ function mergeProps() {
2
+ var ret = {};
3
+ for (var _len = arguments.length, items = new Array(_len), _key = 0; _key < _len; _key++) {
4
+ items[_key] = arguments[_key];
5
+ }
6
+ items.forEach(function (item) {
7
+ if (item) {
8
+ Object.keys(item).forEach(function (key) {
9
+ if (item[key] !== undefined) {
10
+ ret[key] = item[key];
11
+ }
12
+ });
13
+ }
14
+ });
15
+ return ret;
16
+ }
17
+ export default mergeProps;
@@ -0,0 +1,32 @@
1
+ import isNonNullable from "./isNonNullable";
2
+ export function isWindow(obj) {
3
+ return isNonNullable(obj) && obj === obj.window;
4
+ }
5
+ var getScroll = function getScroll(target) {
6
+ if (typeof window === 'undefined') {
7
+ /* istanbul ignore next */
8
+ return 0;
9
+ }
10
+ var result = 0;
11
+ if (isWindow(target)) {
12
+ result = target.pageYOffset;
13
+ } else if (target instanceof Document) {
14
+ result = target.documentElement.scrollTop;
15
+ } else if (target instanceof HTMLElement) {
16
+ result = target.scrollTop;
17
+ } else if (target) {
18
+ // According to the type inference, the `target` is `never` type.
19
+ // Since we configured the loose mode type checking, and supports mocking the target with such shape below::
20
+ // `{ documentElement: { scrollLeft: 200, scrollTop: 400 } }`,
21
+ // the program may falls into this branch.
22
+ // Check the corresponding tests for details. Don't sure what is the real scenario this happens.
23
+ /* biome-ignore lint/complexity/useLiteralKeys: target is a never type */ /* eslint-disable-next-line dot-notation */
24
+ result = target['scrollTop'];
25
+ }
26
+ if (target && !isWindow(target) && typeof result !== 'number') {
27
+ var _documentElement, _target$ownerDocument;
28
+ result = (_documentElement = ((_target$ownerDocument = target.ownerDocument) !== null && _target$ownerDocument !== void 0 ? _target$ownerDocument : target).documentElement) === null || _documentElement === void 0 ? void 0 : _documentElement.scrollTop;
29
+ }
30
+ return result;
31
+ };
32
+ export default getScroll;
@@ -1 +1,4 @@
1
- export * from "./useOrientation";
1
+ export * from "./useForceUpdate";
2
+ export * from "./useOrientation";
3
+ export * from "./useProxyImperativeHandle";
4
+ export * from "./useSyncState";
@@ -0,0 +1,6 @@
1
+ import React from 'react';
2
+ export var useForceUpdate = function useForceUpdate() {
3
+ return React.useReducer(function (ori) {
4
+ return ori + 1;
5
+ }, 0);
6
+ };
@@ -0,0 +1,31 @@
1
+ import { useImperativeHandle } from 'react';
2
+ var fillProxy = function fillProxy(element, handler) {
3
+ element._dtProxy = element._dtProxy || {};
4
+ Object.keys(handler).forEach(function (key) {
5
+ if (!(key in element._dtProxy)) {
6
+ var ori = element[key];
7
+ element._dtProxy[key] = ori;
8
+ element[key] = handler[key];
9
+ }
10
+ });
11
+ return element;
12
+ };
13
+ export var useProxyImperativeHandle = function useProxyImperativeHandle(ref, init) {
14
+ return useImperativeHandle(ref, function () {
15
+ var refObj = init();
16
+ var nativeElement = refObj.nativeElement;
17
+ if (typeof Proxy !== 'undefined') {
18
+ return new Proxy(nativeElement, {
19
+ get: function get(obj, prop) {
20
+ if (refObj[prop]) {
21
+ return refObj[prop];
22
+ }
23
+ return Reflect.get(obj, prop);
24
+ }
25
+ });
26
+ }
27
+
28
+ // Fallback of IE
29
+ return fillProxy(nativeElement, refObj);
30
+ });
31
+ };
@@ -0,0 +1,20 @@
1
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
2
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
3
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
4
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
5
+ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
6
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
7
+ import * as React from 'react';
8
+ import { useForceUpdate } from "./useForceUpdate";
9
+ export var useSyncState = function useSyncState(initialValue) {
10
+ var ref = React.useRef(initialValue);
11
+ var _useForceUpdate = useForceUpdate(),
12
+ _useForceUpdate2 = _slicedToArray(_useForceUpdate, 2),
13
+ forceUpdate = _useForceUpdate2[1];
14
+ return [function () {
15
+ return ref.current;
16
+ }, function (newValue) {
17
+ ref.current = newValue;
18
+ forceUpdate();
19
+ }];
20
+ };
@@ -0,0 +1,38 @@
1
+ import raf from '@rc-component/util/lib/raf';
2
+ import { easeInOutCubic } from "./easings";
3
+ import getScroll, { isWindow } from "./getScroll";
4
+ export default function scrollTo(y) {
5
+ var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
6
+ var _options$getContainer = options.getContainer,
7
+ getContainer = _options$getContainer === void 0 ? function () {
8
+ return window;
9
+ } : _options$getContainer,
10
+ callback = options.callback,
11
+ _options$duration = options.duration,
12
+ duration = _options$duration === void 0 ? 450 : _options$duration;
13
+ var container = getContainer();
14
+ var scrollTop = getScroll(container);
15
+ var startTime = Date.now();
16
+ var rafId;
17
+ var frameFunc = function frameFunc() {
18
+ var timestamp = Date.now();
19
+ var time = timestamp - startTime;
20
+ var nextScrollTop = easeInOutCubic(time > duration ? duration : time, scrollTop, y, duration);
21
+ if (isWindow(container)) {
22
+ container.scrollTo(window.pageXOffset, nextScrollTop);
23
+ } else if (container instanceof Document || container.constructor.name === 'HTMLDocument') {
24
+ container.documentElement.scrollTop = nextScrollTop;
25
+ } else {
26
+ container.scrollTop = nextScrollTop;
27
+ }
28
+ if (time < duration) {
29
+ rafId = raf(frameFunc);
30
+ } else if (typeof callback === 'function') {
31
+ callback();
32
+ }
33
+ };
34
+ rafId = raf(frameFunc);
35
+ return function () {
36
+ raf.cancel(rafId);
37
+ };
38
+ }
@@ -0,0 +1,63 @@
1
+ import * as React from 'react';
2
+ import { warning as rcWarning } from '@rc-component/util';
3
+ export function noop() {}
4
+ var rcResetWarned = rcWarning.resetWarned;
5
+ var deprecatedWarnList = null;
6
+ export function resetWarned() {
7
+ deprecatedWarnList = null;
8
+ rcResetWarned();
9
+ }
10
+ var _warning = noop;
11
+ if (process.env.NODE_ENV !== 'production') {
12
+ _warning = function _warning(valid, component, message) {
13
+ rcWarning(valid, "[antd: ".concat(component, "] ").concat(message));
14
+
15
+ // StrictMode will inject console which will not throw warning in React 17.
16
+ if (process.env.NODE_ENV === 'test') {
17
+ resetWarned();
18
+ }
19
+ };
20
+ }
21
+ var warning = _warning;
22
+ export var WarningContext = /*#__PURE__*/React.createContext({});
23
+
24
+ /**
25
+ * This is a hook but we not named as `useWarning`
26
+ * since this is only used in development.
27
+ * We should always wrap this in `if (process.env.NODE_ENV !== 'production')` condition
28
+ */
29
+ export var devUseWarning = process.env.NODE_ENV !== 'production' ? function (component) {
30
+ var _React$useContext = React.useContext(WarningContext),
31
+ strict = _React$useContext.strict;
32
+ var typeWarning = function typeWarning(valid, type, message) {
33
+ if (!valid) {
34
+ if (strict === false && type === 'deprecated') {
35
+ var existWarning = deprecatedWarnList;
36
+ if (!deprecatedWarnList) {
37
+ deprecatedWarnList = {};
38
+ }
39
+ deprecatedWarnList[component] = deprecatedWarnList[component] || [];
40
+ if (!deprecatedWarnList[component].includes(message || '')) {
41
+ deprecatedWarnList[component].push(message || '');
42
+ }
43
+
44
+ // Warning for the first time
45
+ if (!existWarning) {
46
+ console.warn('[antd] There exists deprecated usage in your code:', deprecatedWarnList);
47
+ }
48
+ } else {
49
+ warning(valid, component, message);
50
+ }
51
+ }
52
+ };
53
+ typeWarning.deprecated = function (valid, oldProp, newProp) {
54
+ var message = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : '';
55
+ typeWarning(valid, 'deprecated', "`".concat(oldProp, "` is deprecated. Please use `").concat(newProp, "` instead.").concat(message ? " ".concat(message) : ''));
56
+ };
57
+ return typeWarning;
58
+ } : function () {
59
+ var noopWarning = function noopWarning() {};
60
+ noopWarning.deprecated = noop;
61
+ return noopWarning;
62
+ };
63
+ export default warning;
@@ -15,7 +15,7 @@ import React, { useState } from 'react';
15
15
  import { QuestionCircleOutlined, UpOutlined } from '@ant-design/icons';
16
16
  import { Tooltip } from 'antd';
17
17
  import { globalConfig } from 'antd/es/config-provider';
18
- import classNames from 'classnames';
18
+ import clsx from 'clsx';
19
19
  import "./style";
20
20
  import { toTooltipProps } from "../_util";
21
21
  import Collapsible from "../collapsible";
@@ -25,7 +25,8 @@ function isControlled(props) {
25
25
  var prefixCls = globalConfig().getPrefixCls('block-header');
26
26
  var preTitleRowCls = "".concat(prefixCls, "__title");
27
27
  var BlockHeader = function BlockHeader(props) {
28
- var title = props.title,
28
+ var id = props.id,
29
+ title = props.title,
29
30
  _props$description = props.description,
30
31
  description = _props$description === void 0 ? '' : _props$description,
31
32
  tooltip = props.tooltip,
@@ -63,7 +64,7 @@ var BlockHeader = function BlockHeader(props) {
63
64
  // 只有在有了 children 并且设置了 expand/defaultExpand 的时候才能够展开收起
64
65
  var showCollapse = (typeof expand === 'boolean' || typeof defaultExpand === 'boolean') && children;
65
66
  var tooltipProps = toTooltipProps(tooltip);
66
- var bottomStyle;
67
+ var bottomStyle = {};
67
68
  if (spaceBottom) bottomStyle = showCollapse && !currentExpand ? {
68
69
  marginBottom: 0
69
70
  } : {
@@ -75,10 +76,11 @@ var BlockHeader = function BlockHeader(props) {
75
76
  onExpand === null || onExpand === void 0 || onExpand(expand);
76
77
  };
77
78
  return /*#__PURE__*/React.createElement("div", {
78
- className: classNames("".concat(prefixCls), className),
79
+ id: id,
80
+ className: clsx("".concat(prefixCls), className),
79
81
  style: _objectSpread(_objectSpread({}, bottomStyle), style)
80
82
  }, /*#__PURE__*/React.createElement("div", {
81
- className: classNames(preTitleRowCls, "".concat(preTitleRowCls, "--").concat(size), _defineProperty(_defineProperty({}, "".concat(preTitleRowCls, "--background"), background), "".concat(preTitleRowCls, "--pointer"), showCollapse)),
83
+ className: clsx(preTitleRowCls, "".concat(preTitleRowCls, "--").concat(size), _defineProperty(_defineProperty({}, "".concat(preTitleRowCls, "--background"), background), "".concat(preTitleRowCls, "--pointer"), showCollapse)),
82
84
  style: titleStyle,
83
85
  onClick: function onClick() {
84
86
  return showCollapse && handleExpand(!currentExpand);
@@ -92,7 +94,7 @@ var BlockHeader = function BlockHeader(props) {
92
94
  }, title), tooltipProps !== null && tooltipProps !== void 0 && tooltipProps.title ? /*#__PURE__*/React.createElement("div", {
93
95
  className: "title__tooltip"
94
96
  }, /*#__PURE__*/React.createElement(Tooltip, _extends({}, tooltipProps, {
95
- className: classNames(tooltipProps === null || tooltipProps === void 0 ? void 0 : tooltipProps.className)
97
+ className: clsx(tooltipProps === null || tooltipProps === void 0 ? void 0 : tooltipProps.className)
96
98
  }), /*#__PURE__*/React.createElement(QuestionCircleOutlined, null))) : null, description ? /*#__PURE__*/React.createElement("div", {
97
99
  className: "title__description"
98
100
  }, description) : null), addonAfter && /*#__PURE__*/React.createElement("div", {
@@ -102,14 +104,14 @@ var BlockHeader = function BlockHeader(props) {
102
104
  }, /*#__PURE__*/React.createElement("div", {
103
105
  className: "collapse__text"
104
106
  }, currentExpand ? '收起' : '展开'), /*#__PURE__*/React.createElement(UpOutlined, {
105
- className: classNames('collapse__icon', {
107
+ className: clsx('collapse__icon', {
106
108
  'collapse__icon--up': currentExpand,
107
109
  'collapse__icon--down': !currentExpand
108
110
  })
109
111
  }))), /*#__PURE__*/React.createElement(Collapsible, {
110
112
  isOpen: !currentExpand
111
113
  }, /*#__PURE__*/React.createElement("div", {
112
- className: classNames("".concat(prefixCls, "__content"), contentClassName, _defineProperty({}, "".concat(prefixCls, "__content--active"), currentExpand || !showCollapse)),
114
+ className: clsx("".concat(prefixCls, "__content"), contentClassName, _defineProperty({}, "".concat(prefixCls, "__content--active"), currentExpand || !showCollapse)),
113
115
  style: contentStyle
114
116
  }, children)));
115
117
  };
@@ -1,143 +1,143 @@
1
- @import '../../style/themes/index.less';
2
-
3
- @card_prefix: ~'@{ant-prefix}-block-header';
4
-
5
- .@{card_prefix} {
6
- &__title {
7
- border-radius: 4px;
8
- display: flex;
9
- align-items: center;
10
- justify-content: space-between;
11
- &--large {
12
- .title__box {
13
- line-height: 24px;
14
- .title__text {
15
- font-size: 16px;
16
- }
17
- }
18
- }
19
- &--middle {
20
- .title__box {
21
- line-height: 22px;
22
- .title__text {
23
- font-size: 14px;
24
- }
25
- }
26
- }
27
- &--small {
28
- .title__box {
29
- line-height: 20px;
30
- .title__text {
31
- font-size: 12px;
32
- }
33
- }
34
- }
35
- &--background {
36
- padding: 0 12px;
37
- background-color: #f9f9fa;
38
- &.@{card_prefix}__title {
39
- &--middle,
40
- &--large {
41
- height: 40px;
42
- }
43
- &--small {
44
- height: 32px;
45
- }
46
- }
47
- }
48
- &--pointer {
49
- cursor: pointer;
50
- }
51
- .title {
52
- &__box {
53
- flex: 1;
54
- display: flex;
55
- align-items: center;
56
- }
57
- &__addon-before {
58
- margin-right: 8px;
59
- color: @primary-color;
60
- &--middle {
61
- .addon-before--default {
62
- width: 4px;
63
- height: 16px;
64
- background-color: @primary-color;
65
- }
66
- font-size: 20px;
67
- }
68
- &--small {
69
- .addon-before--default {
70
- width: 4px;
71
- height: 16px;
72
- background-color: @primary-color;
73
- }
74
- font-size: 16px;
75
- }
76
- &--large {
77
- .addon-before--default {
78
- width: 4px;
79
- height: 20px;
80
- background-color: @primary-color;
81
- }
82
- font-size: 24px;
83
- }
84
- }
85
- &__tooltip {
86
- display: flex;
87
- margin-right: 4px;
88
- font-size: 14px;
89
- color: #b1b4c5;
90
- cursor: pointer;
91
- }
92
- &__text {
93
- color: @text-color;
94
- font-weight: 500;
95
- margin-right: 4px;
96
- }
97
- &__description {
98
- display: flex;
99
- align-items: center;
100
- color: @label-color;
101
- font-size: 12px;
102
- }
103
- &__addon-after {
104
- color: @label-color;
105
- }
106
- &__collapse {
107
- color: @label-color;
108
- display: flex;
109
- align-items: center;
110
- cursor: pointer;
111
- user-select: none;
112
- .collapse {
113
- &__text {
114
- font-size: 12px;
115
- margin: 0 4px;
116
- }
117
- &__icon {
118
- font-size: 16px;
119
- transition: transform 0.4s;
120
- &--down {
121
- transform: rotate(-180deg);
122
- }
123
- &--up {
124
- transform: rotate(0deg);
125
- }
126
- }
127
- }
128
- }
129
- }
130
- }
131
- &__content {
132
- padding: 16px 24px;
133
-
134
- // opacity: 0;
135
- // height: 0;
136
- // overflow: hidden;
137
- // transition: opacity 0.5s ease, height 0.5s ease;
138
- &--active {
139
- // opacity: 1;
140
- // height: auto;
141
- }
142
- }
143
- }
1
+ @import '../../style/themes/index.less';
2
+
3
+ @card_prefix: ~'@{ant-prefix}-block-header';
4
+
5
+ .@{card_prefix} {
6
+ &__title {
7
+ border-radius: 4px;
8
+ display: flex;
9
+ align-items: center;
10
+ justify-content: space-between;
11
+ &--large {
12
+ .title__box {
13
+ line-height: 24px;
14
+ .title__text {
15
+ font-size: 16px;
16
+ }
17
+ }
18
+ }
19
+ &--middle {
20
+ .title__box {
21
+ line-height: 22px;
22
+ .title__text {
23
+ font-size: 14px;
24
+ }
25
+ }
26
+ }
27
+ &--small {
28
+ .title__box {
29
+ line-height: 20px;
30
+ .title__text {
31
+ font-size: 12px;
32
+ }
33
+ }
34
+ }
35
+ &--background {
36
+ padding: 0 12px;
37
+ background-color: #f9f9fa;
38
+ &.@{card_prefix}__title {
39
+ &--middle,
40
+ &--large {
41
+ height: 40px;
42
+ }
43
+ &--small {
44
+ height: 32px;
45
+ }
46
+ }
47
+ }
48
+ &--pointer {
49
+ cursor: pointer;
50
+ }
51
+ .title {
52
+ &__box {
53
+ flex: 1;
54
+ display: flex;
55
+ align-items: center;
56
+ }
57
+ &__addon-before {
58
+ margin-right: 8px;
59
+ color: @primary-color;
60
+ &--middle {
61
+ .addon-before--default {
62
+ width: 4px;
63
+ height: 16px;
64
+ background-color: @primary-color;
65
+ }
66
+ font-size: 20px;
67
+ }
68
+ &--small {
69
+ .addon-before--default {
70
+ width: 4px;
71
+ height: 16px;
72
+ background-color: @primary-color;
73
+ }
74
+ font-size: 16px;
75
+ }
76
+ &--large {
77
+ .addon-before--default {
78
+ width: 4px;
79
+ height: 20px;
80
+ background-color: @primary-color;
81
+ }
82
+ font-size: 24px;
83
+ }
84
+ }
85
+ &__tooltip {
86
+ display: flex;
87
+ margin-right: 4px;
88
+ font-size: 14px;
89
+ color: #b1b4c5;
90
+ cursor: pointer;
91
+ }
92
+ &__text {
93
+ color: @text-color;
94
+ font-weight: 500;
95
+ margin-right: 4px;
96
+ }
97
+ &__description {
98
+ display: flex;
99
+ align-items: center;
100
+ color: @label-color;
101
+ font-size: 12px;
102
+ }
103
+ &__addon-after {
104
+ color: @label-color;
105
+ }
106
+ &__collapse {
107
+ color: @label-color;
108
+ display: flex;
109
+ align-items: center;
110
+ cursor: pointer;
111
+ user-select: none;
112
+ .collapse {
113
+ &__text {
114
+ font-size: 12px;
115
+ margin: 0 4px;
116
+ }
117
+ &__icon {
118
+ font-size: 16px;
119
+ transition: transform 0.4s;
120
+ &--down {
121
+ transform: rotate(-180deg);
122
+ }
123
+ &--up {
124
+ transform: rotate(0deg);
125
+ }
126
+ }
127
+ }
128
+ }
129
+ }
130
+ }
131
+ &__content {
132
+ padding: 16px 24px;
133
+
134
+ // opacity: 0;
135
+ // height: 0;
136
+ // overflow: hidden;
137
+ // transition: opacity 0.5s ease, height 0.5s ease;
138
+ &--active {
139
+ // opacity: 1;
140
+ // height: auto;
141
+ }
142
+ }
143
+ }
@@ -1,29 +1,21 @@
1
- var _excluded = ["className", "icon", "children", "size", "type"];
1
+ var _excluded = ["className", "size", "type"];
2
2
  function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
3
3
  function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
4
4
  function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
5
5
  import React from 'react';
6
6
  import { Button as AntdButton } from 'antd';
7
- import { globalConfig } from 'antd/es/config-provider';
8
- import classNames from 'classnames';
7
+ import clsx from 'clsx';
9
8
  import "./style";
10
- export default function Button(_ref) {
9
+ function Button(_ref) {
11
10
  var className = _ref.className,
12
- icon = _ref.icon,
13
- children = _ref.children,
14
11
  _ref$size = _ref.size,
15
12
  size = _ref$size === void 0 ? 'middle' : _ref$size,
16
13
  type = _ref.type,
17
14
  rest = _objectWithoutProperties(_ref, _excluded);
18
- var prefixCls = globalConfig().getPrefixCls('btn');
19
- var typeClassName = type ? "".concat(prefixCls, "--").concat(type) : '';
20
15
  return /*#__PURE__*/React.createElement(AntdButton, _extends({
21
- className: classNames(prefixCls, className, typeClassName),
16
+ className: clsx(className),
22
17
  size: size,
23
18
  type: type
24
- }, rest), icon && /*#__PURE__*/React.createElement("span", {
25
- className: "".concat(prefixCls, "__icon ").concat(prefixCls, "__icon--").concat(size)
26
- }, icon), children && /*#__PURE__*/React.createElement("span", {
27
- className: "".concat(prefixCls, "__text ").concat(prefixCls, "__text--").concat(size)
28
- }, children));
29
- }
19
+ }, rest));
20
+ }
21
+ export default Button;