@leafer-ui/data 1.0.0-rc.8 → 1.0.0-rc.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@leafer-ui/data",
3
- "version": "1.0.0-rc.8",
3
+ "version": "1.0.0-rc.9",
4
4
  "description": "@leafer-ui/data",
5
5
  "author": "Chao (Leafer) Wan",
6
6
  "license": "MIT",
@@ -22,11 +22,11 @@
22
22
  "leaferjs"
23
23
  ],
24
24
  "dependencies": {
25
- "@leafer/core": "1.0.0-rc.8",
26
- "@leafer-ui/external": "1.0.0-rc.8"
25
+ "@leafer/core": "1.0.0-rc.9",
26
+ "@leafer-ui/external": "1.0.0-rc.9"
27
27
  },
28
28
  "devDependencies": {
29
- "@leafer/interface": "1.0.0-rc.8",
30
- "@leafer-ui/interface": "1.0.0-rc.8"
29
+ "@leafer/interface": "1.0.0-rc.9",
30
+ "@leafer-ui/interface": "1.0.0-rc.9"
31
31
  }
32
32
  }
@@ -0,0 +1,8 @@
1
+ import { IArrowData } from "@leafer-ui/interface"
2
+
3
+ import { LineData } from "./LineData"
4
+
5
+
6
+ export class ArrowData extends LineData implements IArrowData {
7
+
8
+ }
package/src/ImageData.ts CHANGED
@@ -1,8 +1,33 @@
1
- import { IImageData } from '@leafer-ui/interface'
1
+ import { IImageData, IImageInputData, IImage, IObject } from '@leafer-ui/interface'
2
2
 
3
3
  import { RectData } from './RectData'
4
4
 
5
5
 
6
6
  export class ImageData extends RectData implements IImageData {
7
7
 
8
+ declare public __leaf: IImage
9
+
10
+ protected _url: string
11
+
12
+ protected setUrl(value: string) {
13
+ this.__setImageFill(value)
14
+ this._url = value
15
+ }
16
+
17
+ public __setImageFill(value: string): void {
18
+ if (this.__leaf.image) this.__leaf.image = null;
19
+ (this as IImageInputData).fill = value ? { type: 'image', mode: 'strench', url: value } : undefined
20
+ }
21
+
22
+ public __getData(): IObject {
23
+ const data = super.__getData()
24
+ delete data.fill
25
+ return data
26
+ }
27
+
28
+ public __getInputData(): IObject {
29
+ const data = super.__getInputData()
30
+ delete data.fill
31
+ return data
32
+ }
8
33
  }
package/src/index.ts CHANGED
@@ -6,6 +6,7 @@ export { LeaferData } from './LeaferData'
6
6
  export { FrameData } from './FrameData'
7
7
 
8
8
  export { LineData } from './LineData'
9
+ export { ArrowData } from './ArrowData'
9
10
  export { RectData } from './RectData'
10
11
  export { EllipseData } from './EllipseData'
11
12
  export { PolygonData } from './PolygonData'
package/types/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { IBoolean, INumber, IValue, IPathCommandData } from '@leafer/interface';
2
2
  import { LeafData } from '@leafer/core';
3
- import { IUIData, IUI, IUnitData, IGroupData, IBoxData, ILeaferData, IFrameData, ILineData, IRectData, IEllipseData, IPolygonData, IStarData, IPathString, IPenData, ITextData, IFontWeight, IImageData, ICanvasData } from '@leafer-ui/interface';
3
+ import { IUIData, IUI, IUnitData, IGroupData, IBoxData, ILeaferData, IFrameData, ILineData, IArrowData, IRectData, IEllipseData, IPolygonData, IStarData, IPathString, IPenData, ITextData, IFontWeight, IImageData, IImage, IObject, ICanvasData } from '@leafer-ui/interface';
4
4
 
5
5
  declare class UIData extends LeafData implements IUIData {
6
6
  __leaf: IUI;
@@ -47,6 +47,9 @@ declare class FrameData extends BoxData implements IFrameData {
47
47
  declare class LineData extends UIData implements ILineData {
48
48
  }
49
49
 
50
+ declare class ArrowData extends LineData implements IArrowData {
51
+ }
52
+
50
53
  declare class RectData extends UIData implements IRectData {
51
54
  get __boxStroke(): boolean;
52
55
  }
@@ -75,9 +78,15 @@ declare class TextData extends UIData implements ITextData {
75
78
  }
76
79
 
77
80
  declare class ImageData extends RectData implements IImageData {
81
+ __leaf: IImage;
82
+ protected _url: string;
83
+ protected setUrl(value: string): void;
84
+ __setImageFill(value: string): void;
85
+ __getData(): IObject;
86
+ __getInputData(): IObject;
78
87
  }
79
88
 
80
89
  declare class CanvasData extends RectData implements ICanvasData {
81
90
  }
82
91
 
83
- export { BoxData, CanvasData, EllipseData, FrameData, GroupData, ImageData, LeaferData, LineData, PathData, PenData, PolygonData, RectData, StarData, TextData, UIData, UnitConvert };
92
+ export { ArrowData, BoxData, CanvasData, EllipseData, FrameData, GroupData, ImageData, LeaferData, LineData, PathData, PenData, PolygonData, RectData, StarData, TextData, UIData, UnitConvert };