datastake-daf 0.6.249 → 0.6.251

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.
@@ -20737,12 +20737,29 @@ const DAFSteps = _ref => {
20737
20737
  let {
20738
20738
  direction = "vertical",
20739
20739
  current = 0,
20740
- items = []
20740
+ items = [],
20741
+ scrollThreshold = 4
20741
20742
  } = _ref;
20742
- return /*#__PURE__*/jsxRuntime.jsx(jsxRuntime.Fragment, {
20743
- children: /*#__PURE__*/jsxRuntime.jsx(Widget, {
20744
- title: "Life Cycle",
20745
- className: "with-border-header",
20743
+ const shouldScroll = items.length > scrollThreshold;
20744
+ const scrollableStyles = shouldScroll ? _objectSpread2(_objectSpread2({}, direction === "vertical" ? {
20745
+ maxHeight: "300px",
20746
+ overflowY: "auto",
20747
+ overflowX: "hidden"
20748
+ } : {
20749
+ maxWidth: "100%",
20750
+ overflowX: "auto",
20751
+ overflowY: "hidden",
20752
+ whiteSpace: "nowrap"
20753
+ }), {}, {
20754
+ padding: "8px",
20755
+ marginRight: direction === "vertical" ? "-8px" : "0",
20756
+ paddingRight: direction === "vertical" ? "16px" : "8px"
20757
+ }) : {};
20758
+ return /*#__PURE__*/jsxRuntime.jsx(Widget, {
20759
+ title: "Life Cycle",
20760
+ className: "with-border-header",
20761
+ children: /*#__PURE__*/jsxRuntime.jsx("div", {
20762
+ style: scrollableStyles,
20746
20763
  children: /*#__PURE__*/jsxRuntime.jsx(antd.Steps, {
20747
20764
  direction: direction,
20748
20765
  current: current,
@@ -20757,12 +20774,14 @@ DAFSteps.propTypes = {
20757
20774
  items: PropTypes__default["default"].arrayOf(PropTypes__default["default"].shape({
20758
20775
  title: PropTypes__default["default"].string.isRequired,
20759
20776
  description: PropTypes__default["default"].string
20760
- }))
20777
+ })),
20778
+ scrollThreshold: PropTypes__default["default"].number
20761
20779
  };
20762
20780
  DAFSteps.defaultProps = {
20763
20781
  direction: "vertical",
20764
20782
  current: 0,
20765
- items: []
20783
+ items: [],
20784
+ scrollThreshold: 4
20766
20785
  };
20767
20786
 
20768
20787
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "datastake-daf",
3
- "version": "0.6.249",
3
+ "version": "0.6.251",
4
4
  "dependencies": {
5
5
  "@ant-design/icons": "^5.2.5",
6
6
  "@antv/g2": "^5.1.1",
@@ -17,6 +17,11 @@ VerticalSteps.args = {
17
17
  { title: "Step 1", description: "This is the first step" },
18
18
  { title: "Step 2", description: "This is the second step" },
19
19
  { title: "Step 3", description: "This is the third step" },
20
+ { title: "Step 3", description: "This is the third step" },
21
+ { title: "Step 3", description: "This is the third step" },
22
+ { title: "Step 3", description: "This is the third step" },
23
+ { title: "Step 3", description: "This is the third step" },
24
+ { title: "Step 3", description: "This is the third step" },
20
25
  ],
21
26
  };
22
27
 
@@ -3,16 +3,35 @@ import { Steps } from "antd";
3
3
  import Widget from "../../Dashboard/Widget/index.jsx";
4
4
  import PropTypes from "prop-types";
5
5
 
6
- const DAFSteps = ({ direction = "vertical", current = 0, items = [] }) => {
6
+ const DAFSteps = ({ direction = "vertical", current = 0, items = [], scrollThreshold = 4 }) => {
7
+ const shouldScroll = items.length > scrollThreshold;
8
+
9
+ const scrollableStyles = shouldScroll ? {
10
+ ...(direction === "vertical" ? {
11
+ maxHeight: "300px",
12
+ overflowY: "auto",
13
+ overflowX: "hidden"
14
+ } : {
15
+ maxWidth: "100%",
16
+ overflowX: "auto",
17
+ overflowY: "hidden",
18
+ whiteSpace: "nowrap"
19
+ }),
20
+ padding: "8px",
21
+ marginRight: direction === "vertical" ? "-8px" : "0",
22
+ paddingRight: direction === "vertical" ? "16px" : "8px"
23
+ } : {};
24
+
7
25
  return (
8
- <><Widget title="Life Cycle" className="with-border-header">
9
- <Steps
10
- direction={direction}
11
- current={current}
12
- items={items}
13
- />
26
+ <Widget title="Life Cycle" className="with-border-header">
27
+ <div style={scrollableStyles}>
28
+ <Steps
29
+ direction={direction}
30
+ current={current}
31
+ items={items}
32
+ />
33
+ </div>
14
34
  </Widget>
15
- </>
16
35
  );
17
36
  };
18
37
 
@@ -25,12 +44,14 @@ DAFSteps.propTypes = {
25
44
  description: PropTypes.string,
26
45
  })
27
46
  ),
47
+ scrollThreshold: PropTypes.number,
28
48
  };
29
49
 
30
50
  DAFSteps.defaultProps = {
31
51
  direction: "vertical",
32
52
  current: 0,
33
53
  items: [],
54
+ scrollThreshold: 4,
34
55
  };
35
56
 
36
57
  export default DAFSteps;