@leafer-ui/data 1.0.1 → 1.0.2

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.1",
3
+ "version": "1.0.2",
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.1",
26
- "@leafer-ui/external": "1.0.1"
25
+ "@leafer/core": "1.0.2",
26
+ "@leafer-ui/external": "1.0.2"
27
27
  },
28
28
  "devDependencies": {
29
- "@leafer/interface": "1.0.1",
30
- "@leafer-ui/interface": "1.0.1"
29
+ "@leafer/interface": "1.0.2",
30
+ "@leafer-ui/interface": "1.0.2"
31
31
  }
32
32
  }
package/src/CanvasData.ts CHANGED
@@ -1,8 +1,13 @@
1
- import { ICanvasData } from '@leafer-ui/interface'
1
+ import { ICanvas, ICanvasData, ICanvasInputData, IObject } from '@leafer-ui/interface'
2
2
 
3
3
  import { RectData } from './RectData'
4
4
 
5
5
 
6
6
  export class CanvasData extends RectData implements ICanvasData {
7
7
 
8
+ public __getInputData(): IObject {
9
+ const data: ICanvasInputData = super.__getInputData()
10
+ data.url = (this.__leaf as ICanvas).canvas.toDataURL('image/png') as string
11
+ return data
12
+ }
8
13
  }
package/src/LeaferData.ts CHANGED
@@ -1,8 +1,14 @@
1
- import { ILeaferData } from '@leafer-ui/interface'
1
+ import { canvasSizeAttrs } from '@leafer/core'
2
2
 
3
- import { GroupData } from './GroupData'
3
+ import { ILeaferData, IObject } from '@leafer-ui/interface'
4
4
 
5
+ import { GroupData } from './GroupData'
5
6
 
6
7
  export class LeaferData extends GroupData implements ILeaferData {
7
8
 
9
+ public __getInputData(): IObject {
10
+ const data = super.__getInputData()
11
+ canvasSizeAttrs.forEach(key => delete (data as IObject)[key])
12
+ return data
13
+ }
8
14
  }
package/types/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { IBoolean, INumber, IValue, IPathCommandData, IPathString } from '@leafer/interface';
2
2
  import { LeafData } from '@leafer/core';
3
- import { IUIData, IUI, IUnitData, IGroupData, IBoxData, ILeaferData, IFrameData, ILineData, IRectData, IEllipseData, IPolygonData, IStarData, IPathData, IPenData, ITextData, IFontWeight, IImageData, IImage, IObject, ICanvasData } from '@leafer-ui/interface';
3
+ import { IUIData, IUI, IUnitData, IGroupData, IBoxData, ILeaferData, IObject, IFrameData, ILineData, IRectData, IEllipseData, IPolygonData, IStarData, IPathData, IPenData, ITextData, IFontWeight, IImageData, IImage, ICanvasData } from '@leafer-ui/interface';
4
4
 
5
5
  declare class UIData extends LeafData implements IUIData {
6
6
  __leaf: IUI;
@@ -45,6 +45,7 @@ declare class BoxData extends GroupData implements IBoxData {
45
45
  }
46
46
 
47
47
  declare class LeaferData extends GroupData implements ILeaferData {
48
+ __getInputData(): IObject;
48
49
  }
49
50
 
50
51
  declare class FrameData extends BoxData implements IFrameData {
@@ -89,6 +90,7 @@ declare class ImageData extends RectData implements IImageData {
89
90
  }
90
91
 
91
92
  declare class CanvasData extends RectData implements ICanvasData {
93
+ __getInputData(): IObject;
92
94
  }
93
95
 
94
96
  export { BoxData, CanvasData, EllipseData, FrameData, GroupData, ImageData, LeaferData, LineData, PathData, PenData, PolygonData, RectData, StarData, TextData, UIData, UnitConvert };