@pinnacle0/web-ui 0.3.21 → 0.3.22

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.
@@ -40,5 +40,5 @@ declare class RouterAwareMenu extends React.PureComponent<Props, State> {
40
40
  renderMenuGroup: (groupItem: NavigationGroupItem<any, any>) => JSX.Element;
41
41
  render(): JSX.Element;
42
42
  }
43
- export declare const Menu: React.ComponentClass<Pick<Props, "siteName" | "navigationService" | "menuExpanded" | "badges">, any> & import("react-router").WithRouterStatics<typeof RouterAwareMenu>;
43
+ export declare const Menu: import("react").ComponentClass<Pick<Props, "siteName" | "navigationService" | "menuExpanded" | "badges">, any> & import("react-router").WithRouterStatics<typeof RouterAwareMenu>;
44
44
  export {};
@@ -26,5 +26,5 @@ declare class RouterAwareNavigator extends React.PureComponent<Props, State> {
26
26
  onTabChange: (url: string) => void;
27
27
  render(): JSX.Element;
28
28
  }
29
- export declare const Navigator: React.ComponentClass<Pick<Props, "navigationService">, any> & import("react-router").WithRouterStatics<typeof RouterAwareNavigator>;
29
+ export declare const Navigator: import("react").ComponentClass<Pick<Props, "navigationService">, any> & import("react-router").WithRouterStatics<typeof RouterAwareNavigator>;
30
30
  export {};
package/core/Card.d.ts CHANGED
@@ -5,6 +5,6 @@ export interface Props extends CardProps {
5
5
  }
6
6
  export declare class Card extends React.PureComponent<Props> {
7
7
  static displayName: string;
8
- static Grid: React.FC<import("antd/lib/card").CardGridProps>;
8
+ static Grid: import("react").FC<import("antd/lib/card").CardGridProps>;
9
9
  render(): JSX.Element;
10
10
  }
@@ -8,7 +8,7 @@ export interface Props extends Omit<CheckboxProps, "value" | "onChange" | "check
8
8
  }
9
9
  export declare class Checkbox extends React.PureComponent<Props> {
10
10
  static displayName: string;
11
- static Group: React.MemoExoticComponent<React.ForwardRefExoticComponent<import("antd/lib/checkbox").CheckboxGroupProps & React.RefAttributes<HTMLDivElement>>>;
11
+ static Group: import("react").MemoExoticComponent<import("react").ForwardRefExoticComponent<import("antd/lib/checkbox").CheckboxGroupProps & import("react").RefAttributes<HTMLDivElement>>>;
12
12
  onChange: (e: CheckboxChangeEvent) => void;
13
13
  render(): JSX.Element;
14
14
  }
@@ -6,7 +6,7 @@ export interface Props extends CollapseProps {
6
6
  }
7
7
  export declare class Collapse extends React.PureComponent<Props> {
8
8
  static displayName: string;
9
- static Panel: React.FC<CollapsePanelProps>;
9
+ static Panel: import("react").FC<CollapsePanelProps>;
10
10
  render(): JSX.Element;
11
11
  }
12
12
  export declare type PanelProps = CollapsePanelProps;
@@ -8,5 +8,5 @@ export interface Props {
8
8
  }
9
9
  export declare class DarkOverlay extends React.PureComponent<Props> {
10
10
  static displayName: string;
11
- render(): React.ReactPortal;
11
+ render(): import("react").ReactPortal;
12
12
  }
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import type { FooterData } from "../type";
3
2
  import type { ItemRenderer, Measure } from "./type";
4
3
  export interface Gap {
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import "./index.less";
3
2
  import type { VirtualFlatListProps } from "./type";
4
3
  /**
@@ -1,3 +1,2 @@
1
- /// <reference types="react" />
2
1
  import type { FlatListProps } from "./type";
3
2
  export declare const FlatList: <T>(props: FlatListProps<T>) => JSX.Element;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import type { Measure } from "../../VirtualFlatList/type";
3
2
  import type { FooterData } from "../../type";
4
3
  import "./index.less";
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import "./index.less";
3
2
  interface Props {
4
3
  loading: boolean;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  interface Props {
3
2
  loading: boolean;
4
3
  message?: string;
package/core/Grid.d.ts CHANGED
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import "antd/lib/grid/style";
3
2
  export declare const Grid: {
4
3
  Row: import("react").ForwardRefExoticComponent<import("antd").RowProps & import("react").RefAttributes<HTMLDivElement>>;
@@ -22,7 +22,7 @@ export interface Props extends Omit<InputProps, ExcludedAntInputKeys>, Controlle
22
22
  }
23
23
  export declare class Input extends React.PureComponent<Props> {
24
24
  static displayName: string;
25
- static Group: React.FC<import("antd/lib/input").GroupProps>;
25
+ static Group: import("react").FC<import("antd/lib/input").GroupProps>;
26
26
  static Readonly: (props: InputReadonlyProps) => JSX.Element;
27
27
  static Search: ({ onChange, ...rest }: InputSearchProps) => JSX.Element;
28
28
  static TextArea: ({ onChange, ...rest }: InputTextAreaProps) => JSX.Element;
@@ -6,8 +6,8 @@ export interface Props extends RadioProps {
6
6
  }
7
7
  export declare class Radio extends React.PureComponent<Props> {
8
8
  static displayName: string;
9
- static Button: React.ForwardRefExoticComponent<import("antd/lib/radio/radioButton").RadioButtonProps & React.RefAttributes<any>>;
10
- static Group: React.MemoExoticComponent<React.ForwardRefExoticComponent<import("antd/lib/radio").RadioGroupProps & React.RefAttributes<HTMLDivElement>>>;
9
+ static Button: import("react").ForwardRefExoticComponent<import("antd/lib/radio/radioButton").RadioButtonProps & import("react").RefAttributes<any>>;
10
+ static Group: import("react").MemoExoticComponent<import("react").ForwardRefExoticComponent<import("antd/lib/radio").RadioGroupProps & import("react").RefAttributes<HTMLDivElement>>>;
11
11
  render(): JSX.Element;
12
12
  }
13
13
  export type { RadioChangeEvent };
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import type { VirtualItem } from "react-virtual";
3
2
  import type { ColumnFixedPosition, VirtualTableColumn, VirtualTableRowExpand, StickyPosition } from "./type";
4
3
  interface Props<RowType extends object> {
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import type { SafeReactChild, StringKey } from "../../internal/type";
3
2
  import type { VirtualTableColumn, VirtualTableRowExpand, VirtualTableRowSelection } from "./type";
4
3
  import "./index.less";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pinnacle0/web-ui",
3
- "version": "0.3.21",
3
+ "version": "0.3.22",
4
4
  "author": "Pinnacle",
5
5
  "license": "MIT",
6
6
  "sideEffects": [
@@ -21,7 +21,7 @@
21
21
  "start": "yarn run-script script/start.ts",
22
22
  "start:mobile": "yarn run-script script/start-mobile.ts",
23
23
  "format": "yarn run-script script/format.ts",
24
- "test": "jest --config config/jest.config.js"
24
+ "test": "jest --config config/jest.config.ts"
25
25
  },
26
26
  "dependencies": {
27
27
  "@ant-design/icons": "4.7.0",
@@ -1,6 +1,8 @@
1
1
  interface DrawPathOptions {
2
2
  strokeColor: string;
3
3
  lineWidth?: number;
4
+ /** shorten the path between node from both ends */
5
+ offset?: number;
4
6
  }
5
7
  /**
6
8
  * This function draws line on canvas between the center of nodes.
@@ -8,7 +10,7 @@ interface DrawPathOptions {
8
10
  * Attention:
9
11
  * canvasContext must share the same offsetParent with the nodes.
10
12
  */
11
- declare function drawPathBetweenNodes(nodes: NodeListOf<Element>, canvasContext: CanvasRenderingContext2D, { strokeColor, lineWidth }: DrawPathOptions): void;
13
+ declare function drawPathBetweenNodes(nodes: NodeListOf<Element>, canvasContext: CanvasRenderingContext2D, { strokeColor, lineWidth, offset }: DrawPathOptions): void;
12
14
  export declare const CanvasUtil: Readonly<{
13
15
  drawPathBetweenNodes: typeof drawPathBetweenNodes;
14
16
  }>;
@@ -14,6 +14,17 @@ var __read = (this && this.__read) || function (o, n) {
14
14
  }
15
15
  return ar;
16
16
  };
17
+ var __values = (this && this.__values) || function(o) {
18
+ var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
19
+ if (m) return m.call(o);
20
+ if (o && typeof o.length === "number") return {
21
+ next: function () {
22
+ if (o && i >= o.length) o = void 0;
23
+ return { value: o && o[i++], done: !o };
24
+ }
25
+ };
26
+ throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
27
+ };
17
28
  /**
18
29
  * This function draws line on canvas between the center of nodes.
19
30
  *
@@ -21,42 +32,61 @@ var __read = (this && this.__read) || function (o, n) {
21
32
  * canvasContext must share the same offsetParent with the nodes.
22
33
  */
23
34
  function drawPathBetweenNodes(nodes, canvasContext, _a) {
24
- var strokeColor = _a.strokeColor, _b = _a.lineWidth, lineWidth = _b === void 0 ? 1 : _b;
35
+ var e_1, _b;
36
+ var strokeColor = _a.strokeColor, _c = _a.lineWidth, lineWidth = _c === void 0 ? 1 : _c, _d = _a.offset, offset = _d === void 0 ? 0 : _d;
37
+ var _e = __read(Array.from(nodes).map(function (_) { return elementCenter(_, canvasContext.canvas.offsetParent); })), first = _e[0], rest = _e.slice(1);
38
+ if (!first)
39
+ return;
40
+ var drawWithOffset = offset > 0;
41
+ var previousPosition = first;
25
42
  canvasContext.save();
26
- canvasContext.beginPath();
27
- var _c = __read(Array.from(nodes).map(function (_) { return elementCenter(_, canvasContext.canvas.offsetParent); })), first = _c[0], rest = _c.slice(1);
28
- if (first) {
29
- canvasContext.moveTo(first.x, first.y);
30
- rest.forEach(function (node) {
31
- if (node) {
32
- canvasContext.lineTo(node.x, node.y);
33
- }
34
- });
35
- }
36
43
  canvasContext.lineWidth = lineWidth;
37
44
  canvasContext.strokeStyle = strokeColor;
38
- canvasContext.stroke();
45
+ if (!drawWithOffset) {
46
+ canvasContext.beginPath();
47
+ canvasContext.moveTo(previousPosition.x, previousPosition.y);
48
+ }
49
+ try {
50
+ for (var rest_1 = __values(rest), rest_1_1 = rest_1.next(); !rest_1_1.done; rest_1_1 = rest_1.next()) {
51
+ var position = rest_1_1.value;
52
+ if (position) {
53
+ if (drawWithOffset) {
54
+ canvasContext.beginPath();
55
+ canvasContext.moveTo(previousPosition.x, previousPosition.y);
56
+ canvasContext.setLineDash([0, offset, Math.sqrt(Math.pow((position.x - previousPosition.x), 2) + Math.pow((position.y - previousPosition.y), 2)) - offset * 2, offset, 0]);
57
+ previousPosition = position;
58
+ }
59
+ canvasContext.lineTo(position.x, position.y);
60
+ if (drawWithOffset)
61
+ canvasContext.stroke();
62
+ }
63
+ }
64
+ }
65
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
66
+ finally {
67
+ try {
68
+ if (rest_1_1 && !rest_1_1.done && (_b = rest_1.return)) _b.call(rest_1);
69
+ }
70
+ finally { if (e_1) throw e_1.error; }
71
+ }
72
+ if (!drawWithOffset)
73
+ canvasContext.stroke();
39
74
  canvasContext.restore();
40
75
  }
41
76
  function elementCenter(element, canvasParentElement) {
42
- if (element) {
43
- var htmlElement = element;
44
- var x = htmlElement.offsetLeft + htmlElement.offsetWidth / 2;
45
- var y = htmlElement.offsetTop + htmlElement.offsetHeight / 2;
46
- var parentElement = htmlElement.offsetParent;
47
- while (parentElement && canvasParentElement && parentElement !== canvasParentElement) {
48
- x = x + parentElement.offsetLeft;
49
- y = y + parentElement.offsetTop;
50
- parentElement = parentElement.offsetParent;
51
- }
52
- return {
53
- x: x,
54
- y: y,
55
- };
56
- }
57
- else {
58
- return null;
77
+ var htmlElement = element;
78
+ var x = htmlElement.offsetLeft + htmlElement.offsetWidth / 2;
79
+ var y = htmlElement.offsetTop + htmlElement.offsetHeight / 2;
80
+ var parentElement = htmlElement.offsetParent;
81
+ while (parentElement && canvasParentElement && parentElement !== canvasParentElement) {
82
+ x = x + parentElement.offsetLeft;
83
+ y = y + parentElement.offsetTop;
84
+ parentElement = parentElement.offsetParent;
59
85
  }
86
+ return {
87
+ x: x,
88
+ y: y,
89
+ };
60
90
  }
61
91
  export var CanvasUtil = Object.freeze({
62
92
  drawPathBetweenNodes: drawPathBetweenNodes,
@@ -1 +1 @@
1
- {"version":3,"file":"CanvasUtil.js","sourceRoot":"","sources":["../../src/util/CanvasUtil.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAIA;;;;;GAKG;AACH,SAAS,oBAAoB,CAAC,KAA0B,EAAE,aAAuC,EAAE,EAA6C;QAA5C,WAAW,iBAAA,EAAE,iBAAa,EAAb,SAAS,mBAAG,CAAC,KAAA;IAC1H,aAAa,CAAC,IAAI,EAAE,CAAC;IACrB,aAAa,CAAC,SAAS,EAAE,CAAC;IACpB,IAAA,KAAA,OAAmB,KAAK,CAA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