@dtjoy/dt-design 1.0.6 → 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 (188) 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 +5 -5
  10. package/esm/blockHeader/index.js +13 -15
  11. package/esm/blockHeader/style/index.less +143 -143
  12. package/esm/button/index.js +2 -2
  13. package/esm/collapsible/index.js +53 -55
  14. package/esm/collapsibleActionItems/index.js +2 -2
  15. package/esm/flex/index.js +1 -1
  16. package/esm/flex/style/index.less +76 -76
  17. package/esm/flex/utils.js +1 -1
  18. package/esm/formList/index.js +13 -11
  19. package/esm/formList/style/index.less +45 -45
  20. package/esm/index.js +3 -1
  21. package/esm/overflowList/index.js +4 -3
  22. package/esm/resize/index.js +1 -1
  23. package/esm/resizeObserver/index.js +3 -2
  24. package/esm/splitter/Panel.js +3 -3
  25. package/esm/splitter/SplitBar.js +8 -7
  26. package/esm/splitter/Splitter.js +5 -4
  27. package/esm/splitter/hooks/useItems.js +2 -2
  28. package/esm/splitter/hooks/useResize.js +5 -5
  29. package/esm/statusTag/index.js +8 -8
  30. package/esm/style/index.less +1 -1
  31. package/esm/style/themes/index.less +2 -2
  32. package/esm/style/themes/variable.less +4 -0
  33. package/esm/table/InternalTable.js +429 -0
  34. package/esm/table/RcTable/VirtualTable.js +9 -0
  35. package/esm/table/RcTable/index.js +9 -0
  36. package/esm/table/Table.js +28 -0
  37. package/esm/table/TableMeasureRowContext.js +3 -0
  38. package/esm/table/hooks/useContainerWidth.js +14 -0
  39. package/esm/table/index.js +2 -0
  40. package/esm/table/interface.js +4 -0
  41. package/esm/table/style/bordered.less +141 -0
  42. package/esm/table/style/fixed.less +88 -0
  43. package/esm/table/style/index.js +2 -0
  44. package/esm/table/style/index.less +150 -0
  45. package/esm/table/style/selection.less +90 -0
  46. package/esm/table/style/sticky.less +55 -0
  47. package/esm/table/style/virtual.less +65 -0
  48. package/esm/table/util.js +33 -0
  49. package/lib/_util/easings.js +15 -0
  50. package/lib/_util/extendsObject.js +20 -0
  51. package/lib/_util/getScroll.js +39 -0
  52. package/lib/_util/hooks/index.js +33 -0
  53. package/lib/_util/hooks/useForceUpdate.js +12 -0
  54. package/lib/_util/hooks/useProxyImperativeHandle.js +40 -0
  55. package/lib/_util/hooks/useSyncState.js +19 -0
  56. package/lib/_util/scrollTo.js +44 -0
  57. package/lib/_util/warning.js +7 -8
  58. package/lib/blockHeader/index.js +13 -12
  59. package/lib/blockHeader/style/index.less +143 -143
  60. package/lib/button/index.js +2 -2
  61. package/lib/collapsible/index.js +49 -49
  62. package/lib/collapsibleActionItems/index.js +2 -2
  63. package/lib/flex/index.js +2 -2
  64. package/lib/flex/style/index.less +76 -76
  65. package/lib/flex/utils.js +2 -2
  66. package/lib/formList/index.js +10 -10
  67. package/lib/formList/style/index.less +45 -45
  68. package/lib/index.js +21 -2
  69. package/lib/overflowList/index.js +4 -3
  70. package/lib/resize/index.js +1 -1
  71. package/lib/resizeObserver/index.js +3 -2
  72. package/lib/splitter/Panel.js +3 -3
  73. package/lib/splitter/SplitBar.js +8 -7
  74. package/lib/splitter/Splitter.js +5 -4
  75. package/lib/splitter/hooks/useItems.js +2 -2
  76. package/lib/splitter/hooks/useResize.js +5 -5
  77. package/lib/statusTag/index.js +8 -8
  78. package/lib/style/index.less +1 -1
  79. package/lib/style/themes/index.less +2 -2
  80. package/lib/style/themes/variable.less +4 -0
  81. package/lib/table/InternalTable.js +395 -0
  82. package/lib/table/RcTable/VirtualTable.js +17 -0
  83. package/lib/table/RcTable/index.js +17 -0
  84. package/lib/table/Table.js +37 -0
  85. package/lib/{_util/zindexContext.js → table/TableMeasureRowContext.js} +2 -5
  86. package/lib/table/hooks/useContainerWidth.js +20 -0
  87. package/lib/table/index.js +9 -0
  88. package/lib/table/interface.js +8 -0
  89. package/lib/table/style/bordered.less +141 -0
  90. package/lib/table/style/fixed.less +88 -0
  91. package/lib/table/style/index.js +4 -0
  92. package/lib/table/style/index.less +150 -0
  93. package/lib/table/style/selection.less +90 -0
  94. package/lib/table/style/sticky.less +55 -0
  95. package/lib/table/style/virtual.less +65 -0
  96. package/lib/table/util.js +44 -0
  97. package/package.json +82 -66
  98. package/esm/_util/convertToTooltipProps.d.ts +0 -4
  99. package/esm/_util/convertToTooltipProps.js +0 -15
  100. package/esm/_util/gapSize.d.ts +0 -3
  101. package/esm/_util/hooks/index.d.ts +0 -1
  102. package/esm/_util/hooks/useOrientation.d.ts +0 -2
  103. package/esm/_util/hooks/useZIndex.d.ts +0 -8
  104. package/esm/_util/hooks/useZIndex.js +0 -51
  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/_util/warning.d.ts +0 -31
  109. package/esm/_util/zindexContext.d.ts +0 -3
  110. package/esm/_util/zindexContext.js +0 -6
  111. package/esm/blockHeader/index.d.ts +0 -48
  112. package/esm/blockHeader/style/index.d.ts +0 -2
  113. package/esm/button/index.d.ts +0 -10
  114. package/esm/button/style/index.d.ts +0 -2
  115. package/esm/collapsible/index.d.ts +0 -97
  116. package/esm/collapsible/style/index.d.ts +0 -1
  117. package/esm/collapsibleActionItems/index.d.ts +0 -24
  118. package/esm/collapsibleActionItems/style/index.d.ts +0 -2
  119. package/esm/flex/index.d.ts +0 -7
  120. package/esm/flex/interface.d.ts +0 -16
  121. package/esm/flex/style/index.d.ts +0 -2
  122. package/esm/flex/utils.d.ts +0 -7
  123. package/esm/formList/index.d.ts +0 -77
  124. package/esm/formList/style/index.d.ts +0 -2
  125. package/esm/index.d.ts +0 -14
  126. package/esm/overflowList/index.d.ts +0 -39
  127. package/esm/overflowList/style/index.d.ts +0 -2
  128. package/esm/resize/index.d.ts +0 -8
  129. package/esm/resizeObserver/index.d.ts +0 -45
  130. package/esm/splitter/Panel.d.ts +0 -7
  131. package/esm/splitter/SplitBar.d.ts +0 -24
  132. package/esm/splitter/Splitter.d.ts +0 -5
  133. package/esm/splitter/hooks/sizeUtil.d.ts +0 -3
  134. package/esm/splitter/hooks/useItems.d.ts +0 -14
  135. package/esm/splitter/hooks/useResizable.d.ts +0 -10
  136. package/esm/splitter/hooks/useResize.d.ts +0 -6
  137. package/esm/splitter/hooks/useSizes.d.ts +0 -4
  138. package/esm/splitter/index.d.ts +0 -8
  139. package/esm/splitter/interface.d.ts +0 -69
  140. package/esm/splitter/style/index.d.ts +0 -2
  141. package/esm/statusTag/index.d.ts +0 -28
  142. package/esm/statusTag/style/index.d.ts +0 -2
  143. package/esm/style/index.d.ts +0 -1
  144. package/lib/_util/convertToTooltipProps.d.ts +0 -4
  145. package/lib/_util/convertToTooltipProps.js +0 -21
  146. package/lib/_util/gapSize.d.ts +0 -3
  147. package/lib/_util/hooks/index.d.ts +0 -1
  148. package/lib/_util/hooks/useOrientation.d.ts +0 -2
  149. package/lib/_util/hooks/useZIndex.d.ts +0 -8
  150. package/lib/_util/hooks/useZIndex.js +0 -59
  151. package/lib/_util/index.d.ts +0 -3
  152. package/lib/_util/isNonNullable.d.ts +0 -2
  153. package/lib/_util/type.d.ts +0 -52
  154. package/lib/_util/warning.d.ts +0 -31
  155. package/lib/_util/zindexContext.d.ts +0 -3
  156. package/lib/blockHeader/index.d.ts +0 -48
  157. package/lib/blockHeader/style/index.d.ts +0 -2
  158. package/lib/button/index.d.ts +0 -10
  159. package/lib/button/style/index.d.ts +0 -2
  160. package/lib/collapsible/index.d.ts +0 -97
  161. package/lib/collapsible/style/index.d.ts +0 -1
  162. package/lib/collapsibleActionItems/index.d.ts +0 -24
  163. package/lib/collapsibleActionItems/style/index.d.ts +0 -2
  164. package/lib/flex/index.d.ts +0 -7
  165. package/lib/flex/interface.d.ts +0 -16
  166. package/lib/flex/style/index.d.ts +0 -2
  167. package/lib/flex/utils.d.ts +0 -7
  168. package/lib/formList/index.d.ts +0 -77
  169. package/lib/formList/style/index.d.ts +0 -2
  170. package/lib/index.d.ts +0 -14
  171. package/lib/overflowList/index.d.ts +0 -39
  172. package/lib/overflowList/style/index.d.ts +0 -2
  173. package/lib/resize/index.d.ts +0 -8
  174. package/lib/resizeObserver/index.d.ts +0 -45
  175. package/lib/splitter/Panel.d.ts +0 -7
  176. package/lib/splitter/SplitBar.d.ts +0 -24
  177. package/lib/splitter/Splitter.d.ts +0 -5
  178. package/lib/splitter/hooks/sizeUtil.d.ts +0 -3
  179. package/lib/splitter/hooks/useItems.d.ts +0 -14
  180. package/lib/splitter/hooks/useResizable.d.ts +0 -10
  181. package/lib/splitter/hooks/useResize.d.ts +0 -6
  182. package/lib/splitter/hooks/useSizes.d.ts +0 -4
  183. package/lib/splitter/index.d.ts +0 -8
  184. package/lib/splitter/interface.d.ts +0 -69
  185. package/lib/splitter/style/index.d.ts +0 -2
  186. package/lib/statusTag/index.d.ts +0 -28
  187. package/lib/statusTag/style/index.d.ts +0 -2
  188. package/lib/style/index.d.ts +0 -1
@@ -0,0 +1,39 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ exports.isWindow = isWindow;
8
+ var _isNonNullable = _interopRequireDefault(require("./isNonNullable"));
9
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
10
+ function isWindow(obj) {
11
+ return (0, _isNonNullable.default)(obj) && obj === obj.window;
12
+ }
13
+ const getScroll = target => {
14
+ if (typeof window === 'undefined') {
15
+ /* istanbul ignore next */
16
+ return 0;
17
+ }
18
+ let result = 0;
19
+ if (isWindow(target)) {
20
+ result = target.pageYOffset;
21
+ } else if (target instanceof Document) {
22
+ result = target.documentElement.scrollTop;
23
+ } else if (target instanceof HTMLElement) {
24
+ result = target.scrollTop;
25
+ } else if (target) {
26
+ // According to the type inference, the `target` is `never` type.
27
+ // Since we configured the loose mode type checking, and supports mocking the target with such shape below::
28
+ // `{ documentElement: { scrollLeft: 200, scrollTop: 400 } }`,
29
+ // the program may falls into this branch.
30
+ // Check the corresponding tests for details. Don't sure what is the real scenario this happens.
31
+ /* biome-ignore lint/complexity/useLiteralKeys: target is a never type */ /* eslint-disable-next-line dot-notation */
32
+ result = target['scrollTop'];
33
+ }
34
+ if (target && !isWindow(target) && typeof result !== 'number') {
35
+ result = (target.ownerDocument ?? target).documentElement?.scrollTop;
36
+ }
37
+ return result;
38
+ };
39
+ var _default = exports.default = getScroll;
@@ -3,6 +3,17 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
+ var _useForceUpdate = require("./useForceUpdate");
7
+ Object.keys(_useForceUpdate).forEach(function (key) {
8
+ if (key === "default" || key === "__esModule") return;
9
+ if (key in exports && exports[key] === _useForceUpdate[key]) return;
10
+ Object.defineProperty(exports, key, {
11
+ enumerable: true,
12
+ get: function () {
13
+ return _useForceUpdate[key];
14
+ }
15
+ });
16
+ });
6
17
  var _useOrientation = require("./useOrientation");
7
18
  Object.keys(_useOrientation).forEach(function (key) {
8
19
  if (key === "default" || key === "__esModule") return;
@@ -13,4 +24,26 @@ Object.keys(_useOrientation).forEach(function (key) {
13
24
  return _useOrientation[key];
14
25
  }
15
26
  });
27
+ });
28
+ var _useProxyImperativeHandle = require("./useProxyImperativeHandle");
29
+ Object.keys(_useProxyImperativeHandle).forEach(function (key) {
30
+ if (key === "default" || key === "__esModule") return;
31
+ if (key in exports && exports[key] === _useProxyImperativeHandle[key]) return;
32
+ Object.defineProperty(exports, key, {
33
+ enumerable: true,
34
+ get: function () {
35
+ return _useProxyImperativeHandle[key];
36
+ }
37
+ });
38
+ });
39
+ var _useSyncState = require("./useSyncState");
40
+ Object.keys(_useSyncState).forEach(function (key) {
41
+ if (key === "default" || key === "__esModule") return;
42
+ if (key in exports && exports[key] === _useSyncState[key]) return;
43
+ Object.defineProperty(exports, key, {
44
+ enumerable: true,
45
+ get: function () {
46
+ return _useSyncState[key];
47
+ }
48
+ });
16
49
  });
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.useForceUpdate = void 0;
7
+ var _react = _interopRequireDefault(require("react"));
8
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
9
+ const useForceUpdate = () => {
10
+ return _react.default.useReducer(ori => ori + 1, 0);
11
+ };
12
+ exports.useForceUpdate = useForceUpdate;
@@ -0,0 +1,40 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.useProxyImperativeHandle = void 0;
7
+ var _react = require("react");
8
+ const fillProxy = (element, handler) => {
9
+ element._dtProxy = element._dtProxy || {};
10
+ Object.keys(handler).forEach(key => {
11
+ if (!(key in element._dtProxy)) {
12
+ const ori = element[key];
13
+ element._dtProxy[key] = ori;
14
+ element[key] = handler[key];
15
+ }
16
+ });
17
+ return element;
18
+ };
19
+ const useProxyImperativeHandle = (ref, init) => {
20
+ return (0, _react.useImperativeHandle)(ref, () => {
21
+ const refObj = init();
22
+ const {
23
+ nativeElement
24
+ } = refObj;
25
+ if (typeof Proxy !== 'undefined') {
26
+ return new Proxy(nativeElement, {
27
+ get(obj, prop) {
28
+ if (refObj[prop]) {
29
+ return refObj[prop];
30
+ }
31
+ return Reflect.get(obj, prop);
32
+ }
33
+ });
34
+ }
35
+
36
+ // Fallback of IE
37
+ return fillProxy(nativeElement, refObj);
38
+ });
39
+ };
40
+ exports.useProxyImperativeHandle = useProxyImperativeHandle;
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.useSyncState = void 0;
7
+ var React = _interopRequireWildcard(require("react"));
8
+ var _useForceUpdate = require("./useForceUpdate");
9
+ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
10
+ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
11
+ const useSyncState = initialValue => {
12
+ const ref = React.useRef(initialValue);
13
+ const [, forceUpdate] = (0, _useForceUpdate.useForceUpdate)();
14
+ return [() => ref.current, newValue => {
15
+ ref.current = newValue;
16
+ forceUpdate();
17
+ }];
18
+ };
19
+ exports.useSyncState = useSyncState;
@@ -0,0 +1,44 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = scrollTo;
7
+ var _raf = _interopRequireDefault(require("@rc-component/util/lib/raf"));
8
+ var _easings = require("./easings");
9
+ var _getScroll = _interopRequireWildcard(require("./getScroll"));
10
+ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
11
+ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
12
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
13
+ function scrollTo(y, options = {}) {
14
+ const {
15
+ getContainer = () => window,
16
+ callback,
17
+ duration = 450
18
+ } = options;
19
+ const container = getContainer();
20
+ const scrollTop = (0, _getScroll.default)(container);
21
+ const startTime = Date.now();
22
+ let rafId;
23
+ const frameFunc = () => {
24
+ const timestamp = Date.now();
25
+ const time = timestamp - startTime;
26
+ const nextScrollTop = (0, _easings.easeInOutCubic)(time > duration ? duration : time, scrollTop, y, duration);
27
+ if ((0, _getScroll.isWindow)(container)) {
28
+ container.scrollTo(window.pageXOffset, nextScrollTop);
29
+ } else if (container instanceof Document || container.constructor.name === 'HTMLDocument') {
30
+ container.documentElement.scrollTop = nextScrollTop;
31
+ } else {
32
+ container.scrollTop = nextScrollTop;
33
+ }
34
+ if (time < duration) {
35
+ rafId = (0, _raf.default)(frameFunc);
36
+ } else if (typeof callback === 'function') {
37
+ callback();
38
+ }
39
+ };
40
+ rafId = (0, _raf.default)(frameFunc);
41
+ return () => {
42
+ _raf.default.cancel(rafId);
43
+ };
44
+ }
@@ -7,14 +7,13 @@ exports.devUseWarning = exports.default = exports.WarningContext = void 0;
7
7
  exports.noop = noop;
8
8
  exports.resetWarned = resetWarned;
9
9
  var React = _interopRequireWildcard(require("react"));
10
- var _warning2 = _interopRequireDefault(require("rc-util/lib/warning"));
11
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
10
+ var _util = require("@rc-component/util");
12
11
  function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
13
12
  function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
14
13
  function noop() {}
15
14
  const {
16
15
  resetWarned: rcResetWarned
17
- } = _warning2.default;
16
+ } = _util.warning;
18
17
  let deprecatedWarnList = null;
19
18
  function resetWarned() {
20
19
  deprecatedWarnList = null;
@@ -23,7 +22,7 @@ function resetWarned() {
23
22
  let _warning = noop;
24
23
  if (process.env.NODE_ENV !== 'production') {
25
24
  _warning = (valid, component, message) => {
26
- (0, _warning2.default)(valid, `[antd: ${component}] ${message}`);
25
+ (0, _util.warning)(valid, `[antd: ${component}] ${message}`);
27
26
 
28
27
  // StrictMode will inject console which will not throw warning in React 17.
29
28
  if (process.env.NODE_ENV === 'test') {
@@ -34,10 +33,10 @@ if (process.env.NODE_ENV !== 'production') {
34
33
  const warning = _warning;
35
34
  const WarningContext = exports.WarningContext = /*#__PURE__*/React.createContext({});
36
35
 
37
- /**
38
- * This is a hook but we not named as `useWarning`
39
- * since this is only used in development.
40
- * We should always wrap this in `if (process.env.NODE_ENV !== 'production')` condition
36
+ /**
37
+ * This is a hook but we not named as `useWarning`
38
+ * since this is only used in development.
39
+ * We should always wrap this in `if (process.env.NODE_ENV !== 'production')` condition
41
40
  */
42
41
  const devUseWarning = exports.devUseWarning = process.env.NODE_ENV !== 'production' ? component => {
43
42
  const {
@@ -8,7 +8,7 @@ var _react = _interopRequireWildcard(require("react"));
8
8
  var _icons = require("@ant-design/icons");
9
9
  var _antd = require("antd");
10
10
  var _configProvider = require("antd/es/config-provider");
11
- var _classnames = _interopRequireDefault(require("classnames"));
11
+ var _clsx = _interopRequireDefault(require("clsx"));
12
12
  require("./style");
13
13
  var _util = require("../_util");
14
14
  var _collapsible = _interopRequireDefault(require("../collapsible"));
@@ -21,8 +21,9 @@ function isControlled(props) {
21
21
  }
22
22
  const prefixCls = (0, _configProvider.globalConfig)().getPrefixCls('block-header');
23
23
  const preTitleRowCls = `${prefixCls}__title`;
24
- const BlockHeader = function (props) {
24
+ const BlockHeader = props => {
25
25
  const {
26
+ id,
26
27
  title,
27
28
  description = '',
28
29
  tooltip,
@@ -41,8 +42,7 @@ const BlockHeader = function (props) {
41
42
  className: "addon-before--default"
42
43
  }),
43
44
  onExpand,
44
- titleStyle,
45
- ...rest
45
+ titleStyle
46
46
  } = props;
47
47
  const [internalExpand, setInternalExpand] = (0, _react.useState)(defaultExpand);
48
48
  const currentExpand = isControlled(props) ? expand : internalExpand;
@@ -50,7 +50,7 @@ const BlockHeader = function (props) {
50
50
  // 只有在有了 children 并且设置了 expand/defaultExpand 的时候才能够展开收起
51
51
  const showCollapse = (typeof expand === 'boolean' || typeof defaultExpand === 'boolean') && children;
52
52
  const tooltipProps = (0, _util.toTooltipProps)(tooltip);
53
- let bottomStyle;
53
+ let bottomStyle = {};
54
54
  if (spaceBottom) bottomStyle = showCollapse && !currentExpand ? {
55
55
  marginBottom: 0
56
56
  } : {
@@ -62,13 +62,14 @@ const BlockHeader = function (props) {
62
62
  onExpand?.(expand);
63
63
  };
64
64
  return /*#__PURE__*/_react.default.createElement("div", {
65
- className: (0, _classnames.default)(`${prefixCls}`, className),
65
+ id: id,
66
+ className: (0, _clsx.default)(`${prefixCls}`, className),
66
67
  style: {
67
68
  ...bottomStyle,
68
69
  ...style
69
70
  }
70
71
  }, /*#__PURE__*/_react.default.createElement("div", {
71
- className: (0, _classnames.default)(preTitleRowCls, `${preTitleRowCls}--${size}`, {
72
+ className: (0, _clsx.default)(preTitleRowCls, `${preTitleRowCls}--${size}`, {
72
73
  [`${preTitleRowCls}--background`]: background,
73
74
  [`${preTitleRowCls}--pointer`]: showCollapse
74
75
  }),
@@ -83,7 +84,7 @@ const BlockHeader = function (props) {
83
84
  }, title), tooltipProps?.title ? /*#__PURE__*/_react.default.createElement("div", {
84
85
  className: `title__tooltip`
85
86
  }, /*#__PURE__*/_react.default.createElement(_antd.Tooltip, _extends({}, tooltipProps, {
86
- className: (0, _classnames.default)(tooltipProps?.className)
87
+ className: (0, _clsx.default)(tooltipProps?.className)
87
88
  }), /*#__PURE__*/_react.default.createElement(_icons.QuestionCircleOutlined, null))) : null, description ? /*#__PURE__*/_react.default.createElement("div", {
88
89
  className: `title__description`
89
90
  }, description) : null), addonAfter && /*#__PURE__*/_react.default.createElement("div", {
@@ -93,14 +94,14 @@ const BlockHeader = function (props) {
93
94
  }, /*#__PURE__*/_react.default.createElement("div", {
94
95
  className: "collapse__text"
95
96
  }, currentExpand ? '收起' : '展开'), /*#__PURE__*/_react.default.createElement(_icons.UpOutlined, {
96
- className: (0, _classnames.default)('collapse__icon', {
97
+ className: (0, _clsx.default)('collapse__icon', {
97
98
  'collapse__icon--up': currentExpand,
98
99
  'collapse__icon--down': !currentExpand
99
100
  })
100
- }))), /*#__PURE__*/_react.default.createElement(_collapsible.default, _extends({
101
+ }))), /*#__PURE__*/_react.default.createElement(_collapsible.default, {
101
102
  isOpen: !currentExpand
102
- }, rest), /*#__PURE__*/_react.default.createElement("div", {
103
- className: (0, _classnames.default)(`${prefixCls}__content`, contentClassName, {
103
+ }, /*#__PURE__*/_react.default.createElement("div", {
104
+ className: (0, _clsx.default)(`${prefixCls}__content`, contentClassName, {
104
105
  [`${prefixCls}__content--active`]: currentExpand || !showCollapse
105
106
  }),
106
107
  style: contentStyle
@@ -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
+ }
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.default = void 0;
7
7
  var _react = _interopRequireDefault(require("react"));
8
8
  var _antd = require("antd");
9
- var _classnames = _interopRequireDefault(require("classnames"));
9
+ var _clsx = _interopRequireDefault(require("clsx"));
10
10
  require("./style");
11
11
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
12
12
  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); }
@@ -17,7 +17,7 @@ function Button({
17
17
  ...rest
18
18
  }) {
19
19
  return /*#__PURE__*/_react.default.createElement(_antd.Button, _extends({
20
- className: (0, _classnames.default)(className),
20
+ className: (0, _clsx.default)(className),
21
21
  size: size,
22
22
  type: type
23
23
  }, rest));