@cloudtower/eagle 0.31.7 → 0.31.9

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 (42) hide show
  1. package/dist/cjs/core/BytePerSecond/index.js +45 -0
  2. package/dist/cjs/core/TableForm/Columns/AffixColumn.js +1 -1
  3. package/dist/cjs/core/TableForm/Columns/CheckboxColumn.js +1 -1
  4. package/dist/cjs/core/TableForm/Columns/InputColumn.js +1 -0
  5. package/dist/cjs/core/TableForm/TableFormHeaderCell.js +40 -20
  6. package/dist/cjs/core/TableForm/index.js +4 -11
  7. package/dist/cjs/core/index.js +15 -12
  8. package/dist/cjs/coreX/ChartWithTooltip/index.js +14 -12
  9. package/dist/cjs/coreX/UnitWithChart/index.js +14 -12
  10. package/dist/cjs/index.js +239 -237
  11. package/dist/cjs/legacy-antd.js +111 -109
  12. package/dist/cjs/stats1.html +1 -1
  13. package/dist/cjs/utils/tower.js +17 -0
  14. package/dist/components.css +2841 -2812
  15. package/dist/esm/core/BytePerSecond/index.js +39 -0
  16. package/dist/esm/core/TableForm/Columns/AffixColumn.js +1 -1
  17. package/dist/esm/core/TableForm/Columns/CheckboxColumn.js +1 -1
  18. package/dist/esm/core/TableForm/Columns/InputColumn.js +1 -0
  19. package/dist/esm/core/TableForm/TableFormHeaderCell.js +37 -17
  20. package/dist/esm/core/TableForm/index.js +5 -12
  21. package/dist/esm/core/index.js +3 -1
  22. package/dist/esm/coreX/ChartWithTooltip/index.js +2 -0
  23. package/dist/esm/coreX/UnitWithChart/index.js +2 -0
  24. package/dist/esm/index.js +1 -0
  25. package/dist/esm/legacy-antd.js +2 -0
  26. package/dist/esm/stats1.html +1 -1
  27. package/dist/esm/utils/tower.js +17 -1
  28. package/dist/src/core/BytePerSecond/index.d.ts +3 -0
  29. package/dist/src/core/TableForm/types.d.ts +92 -1
  30. package/dist/src/core/Tooltip/EllipsisTooltipContent.d.ts +4 -0
  31. package/dist/src/core/Tooltip/index.d.ts +1 -0
  32. package/dist/src/core/Tooltip/tooltip.type.d.ts +22 -0
  33. package/dist/src/core/Tooltip/tooltip.widget.d.ts +5 -0
  34. package/dist/src/core/index.d.ts +3 -0
  35. package/dist/src/coreX/UnitWithChart/index.d.ts +1 -0
  36. package/dist/src/spec/base.d.ts +1 -0
  37. package/dist/src/utils/tower.d.ts +1 -0
  38. package/dist/stories/docs/core/BytePerSecond.stories.d.ts +17 -0
  39. package/dist/stories/docs/core/EllipsisTooltipContent.stories.d.ts +24 -0
  40. package/dist/stories/docs/core/TableForm.stories.d.ts +45 -13
  41. package/dist/style.css +2780 -2756
  42. package/package.json +4 -4
@@ -123,6 +123,22 @@ function formatBytes(bytes, decimals = 2) {
123
123
  unit: units[i]
124
124
  };
125
125
  }
126
+ function formatBytePerSecond(bytes, decimals = 2) {
127
+ if (bytes <= 0 || bytes === MAGIC_METRIC_NULL) {
128
+ return {
129
+ value: 0,
130
+ unit: "B/s"
131
+ };
132
+ }
133
+ const k = 1024;
134
+ const units = ["B/s", "KiB/s", "MiB/s", "GiB/s", "TiB/s", "PiB/s"];
135
+ let i = Math.floor(Math.log(bytes) / Math.log(k));
136
+ i = i < 0 ? 0 : i > units.length - 1 ? units.length - 1 : i;
137
+ return {
138
+ value: parseFloat((bytes / Math.pow(k, i)).toFixed(decimals)),
139
+ unit: units[i]
140
+ };
141
+ }
126
142
  function formatPercent(input, decimals = 2, saturated = true) {
127
143
  if (input === MAGIC_METRIC_NULL) {
128
144
  input = 0;
@@ -170,4 +186,4 @@ function formatSpeed(input, decimals = 0) {
170
186
  };
171
187
  }
172
188
 
173
- export { DAY, HOUR, MAGIC_METRIC_NULL, MINUTE, SECOND, WEEK, formatBitPerSecond, formatBits, formatBps, formatBytes, formatFrequency, formatPercent, formatSeconds, formatSpeed };
189
+ export { DAY, HOUR, MAGIC_METRIC_NULL, MINUTE, SECOND, WEEK, formatBitPerSecond, formatBits, formatBps, formatBytePerSecond, formatBytes, formatFrequency, formatPercent, formatSeconds, formatSpeed };
@@ -0,0 +1,3 @@
1
+ import { UnitFn } from "../Units/units.type";
2
+ declare const BytePerSecond: UnitFn;
3
+ export default BytePerSecond;
@@ -21,13 +21,42 @@ export type CustomizedColumnRenderProps = {
21
21
  error?: boolean;
22
22
  };
23
23
  export type TableFormColumn = {
24
+ /**
25
+ * 列类型,指定后会使用 ColumnBodyImpls 枚举渲染单元格,否则使用 render 函数渲染
26
+ * @enum {number}
27
+ */
24
28
  type?: keyof typeof ColumnBodyImpls;
25
- title?: string;
29
+ /**
30
+ * 列标题
31
+ */
32
+ title?: string | React.ReactNode;
33
+ /**
34
+ * 列唯一标识
35
+ */
26
36
  key: string;
37
+ /**
38
+ * 列副标题,只在 `disableBatchFilling` 为 `false`,且 `type` 为 'text' 时生效
39
+ */
27
40
  subTitle?: string;
41
+ /**
42
+ * 列副标题颜色
43
+ */
28
44
  subTitleColor?: "" | "primary" | "success" | "warning" | "danger";
45
+ /**
46
+ * 列副标题渲染函数,优先级高于 `subTitle`,即使 `disableBatchFilling` 为 `true` 也会生效
47
+ */
48
+ subTitleRender?: (props: CustomizedColumnRenderProps) => React.ReactNode;
49
+ /**
50
+ * 列单元格图标
51
+ */
29
52
  bodyIcon?: any;
53
+ /**
54
+ * 列单元格错误图标
55
+ */
30
56
  bodyErrorIcon?: any;
57
+ /**
58
+ * 列宽度
59
+ */
31
60
  width?: number | string;
32
61
  displayText?: string;
33
62
  defaultValue?: any;
@@ -37,9 +66,21 @@ export type TableFormColumn = {
37
66
  disablePrefix?: boolean;
38
67
  disableSuffix?: boolean;
39
68
  customData?: any;
69
+ /**
70
+ * 列对齐方式
71
+ */
40
72
  align?: "left" | "right" | "center";
73
+ /**
74
+ * 列行描述渲染函数
75
+ */
41
76
  renderDescription?: (props: RenderRowDescriptionProps) => React.ReactNode;
77
+ /**
78
+ * 列单元格渲染函数
79
+ */
42
80
  render?: (props: CustomizedColumnRenderProps) => React.ReactNode;
81
+ /**
82
+ * 列验证函数
83
+ */
43
84
  validator?: (params: {
44
85
  value: any;
45
86
  rowIndex?: number;
@@ -124,28 +165,62 @@ export type TableFormErrorsType = (string | {
124
165
  [columnKey: string]: string | null;
125
166
  } | null)[];
126
167
  export type TableFormProps = {
168
+ /**
169
+ * 表格默认数据
170
+ */
127
171
  defaultData?: DataType[];
172
+ /**
173
+ * 表格列配置
174
+ */
128
175
  columns: TableFormColumn[];
176
+ /**
177
+ * 表格是否禁用单元格默认控件
178
+ */
129
179
  disabled?: boolean;
180
+ /**
181
+ * 表格行添加配置
182
+ */
130
183
  rowAddConfig?: RowAddConfigurations;
131
184
  /**
132
185
  * @deprecated use "row" configuration instead
133
186
  */
134
187
  deleteConfig?: DeletableConfigurations;
188
+ /**
189
+ * 表格大小
190
+ */
135
191
  size?: "default" | "large" | "small";
136
192
  /**
137
193
  * @deprecated use "row" configuration instead
138
194
  */
139
195
  draggable?: boolean;
196
+ /**
197
+ * 表格是否禁用批量填充
198
+ */
140
199
  disableBatchFilling?: boolean;
200
+ /**
201
+ * 表格类名
202
+ */
141
203
  className?: string;
142
204
  /**
143
205
  * @deprecated use "row" configuration instead
144
206
  */
145
207
  rowSplitType?: TableFormRowSplitType;
208
+ /**
209
+ * 表格验证触发类型,使用 ValidateTriggerType 枚举
210
+ * @enum {number}
211
+ */
146
212
  validateTriggerType?: ValidateTriggerType;
213
+ /**
214
+ * 表格最大高度
215
+ */
147
216
  maxHeight?: number | string;
217
+ /**
218
+ * 表格行配置
219
+ */
148
220
  row?: TableFormRowConfiguration;
221
+ /**
222
+ * 表格行错误信息
223
+ */
149
224
  errors?: TableFormErrorsType;
150
225
  /**
151
226
  * @deprecated use "row" configuration instead
@@ -155,10 +230,26 @@ export type TableFormProps = {
155
230
  * @deprecated use "row" configuration instead
156
231
  */
157
232
  rowValidator?: (rowIndex: number, rowData: DataType) => string | undefined;
233
+ /**
234
+ * 表格头部数据变化的回调
235
+ */
158
236
  onHeaderChange?: (data: any[], columnKey: string) => void;
237
+ /**
238
+ * 表格头部数据失去焦点时的回调
239
+ */
159
240
  onHeaderBlur?: (data: any[]) => void;
241
+ /**
242
+ * 表格行数据变化的回调
243
+ */
160
244
  onBodyChange?: (value: DataType[], rowIndex?: number, columnKey?: string) => void;
245
+ /**
246
+ * 表格行数据失去焦点时的回调
247
+ */
161
248
  onBodyBlur?: (value: DataType, rowIndex?: number, columnKey?: string) => void;
249
+ /**
250
+ * 是否隐藏空表格
251
+ */
252
+ hideEmptyTable?: boolean;
162
253
  };
163
254
  export type TableFormHandle = {
164
255
  setData: (data: DataType[]) => void;
@@ -0,0 +1,4 @@
1
+ import React from "react";
2
+ import { EllipsisContentType } from "./tooltip.type";
3
+ declare const EllipsisTooltipContent: ({ tooltip, maxHeight, contentWrapperClassName, ellipsisTips, }: EllipsisContentType) => React.JSX.Element;
4
+ export default EllipsisTooltipContent;
@@ -2,4 +2,5 @@ import React from "react";
2
2
  import { TooltipProps } from "./tooltip.type";
3
3
  declare const Tooltip: React.FunctionComponent<TooltipProps>;
4
4
  export default Tooltip;
5
+ export * from "./EllipsisTooltipContent";
5
6
  export * from "./tooltip.type";
@@ -1,3 +1,5 @@
1
+ /// <reference types="react" />
2
+ import { LinariaClassName } from "@linaria/core";
1
3
  import { TooltipProps as AntdTooltipProps } from "antd/lib/tooltip";
2
4
  export type TooltipProps = AntdTooltipProps & {
3
5
  /**
@@ -5,3 +7,23 @@ export type TooltipProps = AntdTooltipProps & {
5
7
  */
6
8
  followMouse?: boolean;
7
9
  };
10
+ export type EllipsisContentType = {
11
+ /**
12
+ * tooltip content 内容
13
+ */
14
+ tooltip: React.ReactNode;
15
+ /**
16
+ * 内容区的最大高度
17
+ *
18
+ * e.g. 文本限制行数 = 行数 * line-height
19
+ */
20
+ maxHeight?: number;
21
+ /**
22
+ * 自定义样式类名
23
+ */
24
+ contentWrapperClassName?: LinariaClassName;
25
+ /**
26
+ * 多行溢出省略提示
27
+ */
28
+ ellipsisTips?: string;
29
+ };
@@ -0,0 +1,5 @@
1
+ /// <reference types="react" />
2
+ declare const Tooltip: {
3
+ ellipsisContent: ({ tooltip, maxHeight, contentWrapperClassName, ellipsisTips, }: import("./tooltip.type").EllipsisContentType) => import("react").JSX.Element;
4
+ };
5
+ export default Tooltip;
@@ -15,6 +15,7 @@ export * from "./Button";
15
15
  export * from "./ButtonGroup";
16
16
  export * from "./ButtonGroup";
17
17
  export * from "./Byte";
18
+ export * from "./BytePerSecond";
18
19
  export * from "./Calendar";
19
20
  export * from "./Card";
20
21
  export * from "./Cascader";
@@ -90,6 +91,7 @@ export * from "./Skeleton";
90
91
  export declare const units: {
91
92
  Percent: import("./Units").PercentFn;
92
93
  Byte: import("./Units").UnitFn;
94
+ BytePerSecond: import("./Units").UnitFn;
93
95
  Frequency: import("./Units").UnitFn;
94
96
  Speed: import("./Units").UnitFn;
95
97
  Bps: import("./Units").UnitFn;
@@ -112,6 +114,7 @@ export { default as Breadcrumb } from "./Breadcrumb";
112
114
  export { default as Button } from "./Button";
113
115
  export { default as ButtonGroup } from "./ButtonGroup";
114
116
  export { default as Byte } from "./Byte";
117
+ export { default as BytePerSecond } from "./BytePerSecond";
115
118
  export { default as Calendar } from "./Calendar";
116
119
  export { default as Card } from "./Card";
117
120
  export { default as Checkbox } from "./Checkbox";
@@ -2,6 +2,7 @@ import React from "react";
2
2
  declare const units: {
3
3
  Percent: import("../..").PercentFn;
4
4
  Byte: import("../..").UnitFn;
5
+ BytePerSecond: import("../..").UnitFn;
5
6
  Frequency: import("../..").UnitFn;
6
7
  Speed: import("../..").UnitFn;
7
8
  Bps: import("../..").UnitFn;
@@ -139,6 +139,7 @@ export interface Kit<V = any, T extends HTMLElement = HTMLElement> {
139
139
  units: {
140
140
  Percent: PercentFn;
141
141
  Byte: UnitFn;
142
+ BytePerSecond: UnitFn;
142
143
  Frequency: UnitFn;
143
144
  Speed: UnitFn;
144
145
  Second: UnitFn;
@@ -47,6 +47,7 @@ export declare const GBps: number;
47
47
  export declare const TBps: number;
48
48
  export declare function formatBps(input: number, decimals?: number): FormattedResult;
49
49
  export declare function formatBytes(bytes: number, decimals?: number): FormattedResult;
50
+ export declare function formatBytePerSecond(bytes: number, decimals?: number): FormattedResult;
50
51
  export declare function formatPercent(input: number, decimals?: number, saturated?: boolean): {
51
52
  value: string;
52
53
  numberValue: number;
@@ -0,0 +1,17 @@
1
+ import React from "react";
2
+ declare const _default: import("@storybook/types").ComponentAnnotations<import("@storybook/react/dist/types-0fc72a6d").R, import("../../../src").RawValue & {
3
+ emptyProps?: import("../../../src").IEmptyProps | undefined;
4
+ } & {
5
+ children?: React.ReactNode;
6
+ }>;
7
+ export default _default;
8
+ export declare const Simple: import("@storybook/types").AnnotatedStoryFn<import("@storybook/react/dist/types-0fc72a6d").R, import("../../../src").RawValue & {
9
+ emptyProps?: import("../../../src").IEmptyProps | undefined;
10
+ } & {
11
+ children?: React.ReactNode;
12
+ }>;
13
+ export declare const Empty: import("@storybook/types").AnnotatedStoryFn<import("@storybook/react/dist/types-0fc72a6d").R, import("../../../src").RawValue & {
14
+ emptyProps?: import("../../../src").IEmptyProps | undefined;
15
+ } & {
16
+ children?: React.ReactNode;
17
+ }>;
@@ -0,0 +1,24 @@
1
+ import EllipsisTooltipContent from "../../../src/core/Tooltip/EllipsisTooltipContent";
2
+ import { StoryObj } from "@storybook/react";
3
+ import React from "react";
4
+ /**
5
+ * * Tooltip content 组件
6
+ * * 搭配 Tooltip 与 OverflowTooltip 使用
7
+ * * 使用时,Tooltip 与 OverflowTooltip 需要配合 destroyTooltipOnHide 为 true 使用
8
+ * * 自定义 props 已在表格进行说明
9
+ */
10
+ declare const meta: {
11
+ component: ({ tooltip, maxHeight, contentWrapperClassName, ellipsisTips, }: import("../../../src/core/Tooltip").EllipsisContentType) => React.JSX.Element;
12
+ title: "Core/EllipsisTooltipContent | Tooltip content 过长省略";
13
+ parameters: {
14
+ design: {
15
+ type: string;
16
+ url: string;
17
+ };
18
+ };
19
+ };
20
+ export default meta;
21
+ type Story = StoryObj<typeof EllipsisTooltipContent>;
22
+ export declare const ellipsisTooltipsContentInTooltip: Story;
23
+ export declare const ellipsisTooltipsContentInOverflowTooltip: Story;
24
+ export declare const ellipsisTooltipsReactNodeContentInTooltip: Story;
@@ -1,17 +1,49 @@
1
+ import { TableFormHandle, TableFormProps } from "../../../src/core/TableForm/types";
1
2
  import React from "react";
2
- declare const story: {
3
- title: string;
4
- };
5
- export declare const Basic: {
6
- (): React.JSX.Element;
7
- story: {
8
- name: string;
9
- parameters: {
10
- design: {
11
- type: string;
12
- url: string;
13
- };
3
+ declare const meta: {
4
+ component: React.ForwardRefExoticComponent<TableFormProps & React.RefAttributes<TableFormHandle>>;
5
+ title: "Core/TableForm | 表格表单";
6
+ parameters: {
7
+ design: {
8
+ type: string;
9
+ url: string;
14
10
  };
15
11
  };
16
12
  };
17
- export default story;
13
+ export default meta;
14
+ export declare const BatchInput: {
15
+ render: () => React.JSX.Element;
16
+ };
17
+ export declare const DynamicRows: {
18
+ render: () => React.JSX.Element;
19
+ };
20
+ export declare const Draggable: {
21
+ render: () => React.JSX.Element;
22
+ };
23
+ export declare const NormalValidate: {
24
+ render: () => React.JSX.Element;
25
+ };
26
+ export declare const LazyValidate: {
27
+ render: () => React.JSX.Element;
28
+ };
29
+ export declare const AggressiveValidate: {
30
+ render: () => React.JSX.Element;
31
+ };
32
+ export declare const RowConfig: {
33
+ render: () => React.JSX.Element;
34
+ };
35
+ export declare const ErrorsConfig: {
36
+ render: () => React.JSX.Element;
37
+ };
38
+ export declare const ErrorsConfigWithAsyncErr: {
39
+ render: () => React.JSX.Element;
40
+ };
41
+ export declare const ShowTableFormWhenNoData: {
42
+ render: () => React.JSX.Element;
43
+ };
44
+ export declare const HideTableFormWhenNoData: {
45
+ render: () => React.JSX.Element;
46
+ };
47
+ export declare const TitleAndSubTitle: {
48
+ render: () => React.JSX.Element;
49
+ };