@lobehub/charts 1.9.5 → 1.9.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.
@@ -13,12 +13,15 @@ export interface Bar {
13
13
  export interface BarListProps extends HTMLAttributes<HTMLDivElement> {
14
14
  color?: string;
15
15
  data: Bar[];
16
+ height?: string | number;
16
17
  leftLabel?: ReactNode;
18
+ loading?: boolean;
17
19
  onValueChange?: (payload: Bar) => void;
18
20
  rightLabel?: ReactNode;
19
21
  showAnimation?: boolean;
20
22
  sortOrder?: 'ascending' | 'descending' | 'none';
21
23
  valueFormatter?: ValueFormatter;
24
+ width?: string | number;
22
25
  }
23
26
  declare const BarList: React.ForwardRefExoticComponent<BarListProps & React.RefAttributes<HTMLDivElement>>;
24
27
  export default BarList;
@@ -3,8 +3,9 @@
3
3
  import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
4
4
  import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
5
5
  import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
6
- var _excluded = ["data", "color", "valueFormatter", "showAnimation", "onValueChange", "sortOrder", "className", "leftLabel", "rightLabel", "style"];
6
+ var _excluded = ["data", "color", "valueFormatter", "showAnimation", "onValueChange", "sortOrder", "className", "leftLabel", "rightLabel", "style", "loading", "width", "height"];
7
7
  import A from '@lobehub/ui/es/A';
8
+ import { Skeleton } from 'antd';
8
9
  import React, { forwardRef, useMemo } from 'react';
9
10
  import { Flexbox } from 'react-layout-kit';
10
11
  import { useThemeColorRange } from "../hooks/useThemeColorRange";
@@ -32,6 +33,10 @@ var BarList = /*#__PURE__*/forwardRef(function (props, ref) {
32
33
  leftLabel = props.leftLabel,
33
34
  rightLabel = props.rightLabel,
34
35
  style = props.style,
36
+ loading = props.loading,
37
+ _props$width = props.width,
38
+ width = _props$width === void 0 ? '100%' : _props$width,
39
+ height = props.height,
35
40
  rest = _objectWithoutProperties(props, _excluded);
36
41
  var sortedData = useMemo(function () {
37
42
  if (sortOrder === 'none') {
@@ -49,6 +54,14 @@ var BarList = /*#__PURE__*/forwardRef(function (props, ref) {
49
54
  return item.value === 0 ? 0 : Math.max(item.value / maxValue * 100, 2);
50
55
  });
51
56
  }, [sortedData]);
57
+ if (loading || !data) return /*#__PURE__*/_jsx(Skeleton.Button, {
58
+ active: true,
59
+ block: true,
60
+ style: {
61
+ height: height,
62
+ width: width
63
+ }
64
+ });
52
65
  var rowHeight = 32;
53
66
  var labelHeight = 20;
54
67
  return /*#__PURE__*/_jsxs(Flexbox, _objectSpread(_objectSpread({
@@ -59,8 +72,10 @@ var BarList = /*#__PURE__*/forwardRef(function (props, ref) {
59
72
  justify: 'space-between',
60
73
  ref: ref,
61
74
  style: _objectSpread({
75
+ minHeight: height,
62
76
  position: 'relative'
63
- }, style)
77
+ }, style),
78
+ width: width
64
79
  }, rest), {}, {
65
80
  children: [/*#__PURE__*/_jsxs(Flexbox, {
66
81
  flex: 1,
@@ -46,6 +46,7 @@ var ChartTooltip = function ChartTooltip(_ref2) {
46
46
  paddingBlock: 8,
47
47
  paddingInline: 16,
48
48
  style: {
49
+ flexDirection: 'column-reverse',
49
50
  marginTop: 4
50
51
  },
51
52
  children: filteredPayload.map(function (_ref3, idx) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lobehub/charts",
3
- "version": "1.9.5",
3
+ "version": "1.9.7",
4
4
  "description": "React modern charts components built on recharts",
5
5
  "keywords": [
6
6
  "lobehub",