@leafer-ui/data 1.0.1 → 1.0.3
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 +5 -5
- package/src/CanvasData.ts +6 -1
- package/src/ImageData.ts +1 -1
- package/src/LeaferData.ts +8 -2
- package/src/UIData.ts +7 -2
- package/types/index.d.ts +5 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@leafer-ui/data",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.3",
|
|
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.
|
|
26
|
-
"@leafer-ui/external": "1.0.
|
|
25
|
+
"@leafer/core": "1.0.3",
|
|
26
|
+
"@leafer-ui/external": "1.0.3"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
|
-
"@leafer/interface": "1.0.
|
|
30
|
-
"@leafer-ui/interface": "1.0.
|
|
29
|
+
"@leafer/interface": "1.0.3",
|
|
30
|
+
"@leafer-ui/interface": "1.0.3"
|
|
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/ImageData.ts
CHANGED
|
@@ -16,7 +16,7 @@ export class ImageData extends RectData implements IImageData {
|
|
|
16
16
|
|
|
17
17
|
public __setImageFill(value: string): void {
|
|
18
18
|
if (this.__leaf.image) this.__leaf.image = null;
|
|
19
|
-
(this as IImageInputData).fill = value ? { type: 'image', mode: '
|
|
19
|
+
(this as IImageInputData).fill = value ? { type: 'image', mode: 'stretch', url: value } : undefined
|
|
20
20
|
}
|
|
21
21
|
|
|
22
22
|
public __getData(): IObject {
|
package/src/LeaferData.ts
CHANGED
|
@@ -1,8 +1,14 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { canvasSizeAttrs } from '@leafer/core'
|
|
2
2
|
|
|
3
|
-
import {
|
|
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/src/UIData.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { INumber, IValue, IBoolean, IPathCommandData, IPathString } from '@leafer/interface'
|
|
1
|
+
import { INumber, IValue, IBoolean, IPathCommandData, IPathString, IPointData } from '@leafer/interface'
|
|
2
2
|
import { PathConvert, LeafData, Debug } from '@leafer/core'
|
|
3
3
|
|
|
4
4
|
import { IShadowEffect, IUI, IUIData, IUnitData, ILeafPaint } from '@leafer-ui/interface'
|
|
@@ -12,6 +12,8 @@ export class UIData extends LeafData implements IUIData {
|
|
|
12
12
|
|
|
13
13
|
declare public __leaf: IUI
|
|
14
14
|
|
|
15
|
+
public get scale(): INumber | IPointData { const { scaleX, scaleY } = this as IUIData; return scaleX !== scaleY ? { x: scaleX, y: scaleY } : scaleX }
|
|
16
|
+
|
|
15
17
|
public __blendLayer?: boolean // 非元素属性必须以两个下划线开头
|
|
16
18
|
|
|
17
19
|
public __isFills?: boolean
|
|
@@ -52,9 +54,12 @@ export class UIData extends LeafData implements IUIData {
|
|
|
52
54
|
public get __autoSide() { return !this._width || !this._height }
|
|
53
55
|
public get __autoSize() { return !this._width && !this._height }
|
|
54
56
|
|
|
57
|
+
|
|
55
58
|
protected setVisible(value: IBoolean) {
|
|
56
|
-
if (this.__leaf.leafer) this.__leaf.leafer.watcher.hasVisible = true
|
|
57
59
|
this._visible = value
|
|
60
|
+
|
|
61
|
+
const { leafer } = this.__leaf
|
|
62
|
+
if (leafer) leafer.watcher.hasVisible = true
|
|
58
63
|
}
|
|
59
64
|
|
|
60
65
|
protected setWidth(value: INumber) {
|
package/types/index.d.ts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { INumber, IPointData, IBoolean, 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,
|
|
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;
|
|
7
|
+
get scale(): INumber | IPointData;
|
|
7
8
|
__blendLayer?: boolean;
|
|
8
9
|
__isFills?: boolean;
|
|
9
10
|
__isStrokes?: boolean;
|
|
@@ -45,6 +46,7 @@ declare class BoxData extends GroupData implements IBoxData {
|
|
|
45
46
|
}
|
|
46
47
|
|
|
47
48
|
declare class LeaferData extends GroupData implements ILeaferData {
|
|
49
|
+
__getInputData(): IObject;
|
|
48
50
|
}
|
|
49
51
|
|
|
50
52
|
declare class FrameData extends BoxData implements IFrameData {
|
|
@@ -89,6 +91,7 @@ declare class ImageData extends RectData implements IImageData {
|
|
|
89
91
|
}
|
|
90
92
|
|
|
91
93
|
declare class CanvasData extends RectData implements ICanvasData {
|
|
94
|
+
__getInputData(): IObject;
|
|
92
95
|
}
|
|
93
96
|
|
|
94
97
|
export { BoxData, CanvasData, EllipseData, FrameData, GroupData, ImageData, LeaferData, LineData, PathData, PenData, PolygonData, RectData, StarData, TextData, UIData, UnitConvert };
|