@leafer-ui/data 1.0.0-rc.12 → 1.0.0-rc.16
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/PathData.ts +2 -18
- package/src/UIData.ts +19 -4
- package/src/index.ts +0 -1
- package/types/index.d.ts +8 -10
- package/src/ArrowData.ts +0 -8
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@leafer-ui/data",
|
|
3
|
-
"version": "1.0.0-rc.
|
|
3
|
+
"version": "1.0.0-rc.16",
|
|
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.
|
|
26
|
-
"@leafer-ui/external": "1.0.0-rc.
|
|
25
|
+
"@leafer/core": "1.0.0-rc.16",
|
|
26
|
+
"@leafer-ui/external": "1.0.0-rc.16"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
|
-
"@leafer/interface": "1.0.0-rc.
|
|
30
|
-
"@leafer-ui/interface": "1.0.0-rc.
|
|
29
|
+
"@leafer/interface": "1.0.0-rc.16",
|
|
30
|
+
"@leafer-ui/interface": "1.0.0-rc.16"
|
|
31
31
|
}
|
|
32
32
|
}
|
package/src/PathData.ts
CHANGED
|
@@ -1,24 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { PathConvert } from '@leafer/core'
|
|
1
|
+
import { IPathData } from '@leafer-ui/interface'
|
|
3
2
|
|
|
4
|
-
import { IPathString } from '@leafer-ui/interface'
|
|
5
3
|
import { UIData } from "./UIData"
|
|
6
4
|
|
|
7
5
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
export class PathData extends UIData {
|
|
11
|
-
|
|
12
|
-
protected _path: IPathCommandData
|
|
13
|
-
|
|
14
|
-
protected setPath(value: IPathCommandData | IPathString) {
|
|
15
|
-
if (typeof value === 'string') {
|
|
16
|
-
this.__setInput('path', value)
|
|
17
|
-
this._path = parse(value)
|
|
18
|
-
} else {
|
|
19
|
-
if (this.__input) this.__removeInput('path')
|
|
20
|
-
this._path = value
|
|
21
|
-
}
|
|
22
|
-
}
|
|
6
|
+
export class PathData extends UIData implements IPathData {
|
|
23
7
|
|
|
24
8
|
}
|
package/src/UIData.ts
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import { INumber, IValue, IBoolean } from '@leafer/interface'
|
|
2
|
-
import { LeafData, Debug } from '@leafer/core'
|
|
1
|
+
import { INumber, IValue, IBoolean, IPathCommandData, IPathString } from '@leafer/interface'
|
|
2
|
+
import { PathConvert, LeafData, Debug } from '@leafer/core'
|
|
3
3
|
|
|
4
4
|
import { IShadowEffect, IUI, IUIData, IUnitData, ILeafPaint } from '@leafer-ui/interface'
|
|
5
5
|
import { Paint, PaintImage } from '@leafer-ui/external'
|
|
6
6
|
|
|
7
7
|
|
|
8
|
+
const { parse } = PathConvert
|
|
8
9
|
const emptyPaint: ILeafPaint = {}
|
|
9
10
|
const debug = Debug.get('UIData')
|
|
10
11
|
export class UIData extends LeafData implements IUIData {
|
|
@@ -40,12 +41,15 @@ export class UIData extends LeafData implements IUIData {
|
|
|
40
41
|
protected _fill?: IValue
|
|
41
42
|
protected _stroke?: IValue
|
|
42
43
|
|
|
44
|
+
protected _path: IPathCommandData
|
|
45
|
+
|
|
43
46
|
protected _shadow?: IValue
|
|
44
47
|
protected _innerShadow?: IValue
|
|
45
48
|
|
|
46
49
|
public get __autoWidth() { return !this._width }
|
|
47
50
|
public get __autoHeight() { return !this._height }
|
|
48
|
-
public get
|
|
51
|
+
public get __autoSide() { return !this._width || !this._height }
|
|
52
|
+
public get __autoSize() { return !this._width && !this._height }
|
|
49
53
|
|
|
50
54
|
protected setVisible(value: IBoolean) {
|
|
51
55
|
if (this.__leaf.leafer) this.__leaf.leafer.watcher.hasVisible = true
|
|
@@ -74,7 +78,7 @@ export class UIData extends LeafData implements IUIData {
|
|
|
74
78
|
|
|
75
79
|
|
|
76
80
|
protected setFill(value: IValue) {
|
|
77
|
-
if (this.__naturalWidth) this.
|
|
81
|
+
if (this.__naturalWidth) this.__removeNaturalSize()
|
|
78
82
|
if (typeof value === 'string' || !value) {
|
|
79
83
|
if (this.__isFills) {
|
|
80
84
|
this.__removeInput('fill')
|
|
@@ -109,6 +113,17 @@ export class UIData extends LeafData implements IUIData {
|
|
|
109
113
|
}
|
|
110
114
|
|
|
111
115
|
|
|
116
|
+
protected setPath(value: IPathCommandData | IPathString) {
|
|
117
|
+
if (typeof value === 'string') {
|
|
118
|
+
this.__setInput('path', value)
|
|
119
|
+
this._path = parse(value)
|
|
120
|
+
} else {
|
|
121
|
+
if (this.__input) this.__removeInput('path')
|
|
122
|
+
this._path = value
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
|
|
112
127
|
protected setShadow(value: IValue) {
|
|
113
128
|
this.__setInput('shadow', value)
|
|
114
129
|
if (value instanceof Array) {
|
package/src/index.ts
CHANGED
|
@@ -6,7 +6,6 @@ export { LeaferData } from './LeaferData'
|
|
|
6
6
|
export { FrameData } from './FrameData'
|
|
7
7
|
|
|
8
8
|
export { LineData } from './LineData'
|
|
9
|
-
export { ArrowData } from './ArrowData'
|
|
10
9
|
export { RectData } from './RectData'
|
|
11
10
|
export { EllipseData } from './EllipseData'
|
|
12
11
|
export { PolygonData } from './PolygonData'
|
package/types/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { IBoolean, INumber, IValue, IPathCommandData } from '@leafer/interface';
|
|
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,
|
|
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';
|
|
4
4
|
|
|
5
5
|
declare class UIData extends LeafData implements IUIData {
|
|
6
6
|
__leaf: IUI;
|
|
@@ -16,16 +16,19 @@ declare class UIData extends LeafData implements IUIData {
|
|
|
16
16
|
protected _height?: INumber;
|
|
17
17
|
protected _fill?: IValue;
|
|
18
18
|
protected _stroke?: IValue;
|
|
19
|
+
protected _path: IPathCommandData;
|
|
19
20
|
protected _shadow?: IValue;
|
|
20
21
|
protected _innerShadow?: IValue;
|
|
21
22
|
get __autoWidth(): boolean;
|
|
22
23
|
get __autoHeight(): boolean;
|
|
23
|
-
get
|
|
24
|
+
get __autoSide(): boolean;
|
|
25
|
+
get __autoSize(): boolean;
|
|
24
26
|
protected setVisible(value: IBoolean): void;
|
|
25
27
|
protected setWidth(value: INumber): void;
|
|
26
28
|
protected setHeight(value: INumber): void;
|
|
27
29
|
protected setFill(value: IValue): void;
|
|
28
30
|
protected setStroke(value: IValue): void;
|
|
31
|
+
protected setPath(value: IPathCommandData | IPathString): void;
|
|
29
32
|
protected setShadow(value: IValue): void;
|
|
30
33
|
protected setInnerShadow(value: IValue): void;
|
|
31
34
|
__computePaint(): void;
|
|
@@ -50,9 +53,6 @@ declare class FrameData extends BoxData implements IFrameData {
|
|
|
50
53
|
declare class LineData extends UIData implements ILineData {
|
|
51
54
|
}
|
|
52
55
|
|
|
53
|
-
declare class ArrowData extends LineData implements IArrowData {
|
|
54
|
-
}
|
|
55
|
-
|
|
56
56
|
declare class RectData extends UIData implements IRectData {
|
|
57
57
|
get __boxStroke(): boolean;
|
|
58
58
|
}
|
|
@@ -67,9 +67,7 @@ declare class PolygonData extends UIData implements IPolygonData {
|
|
|
67
67
|
declare class StarData extends UIData implements IStarData {
|
|
68
68
|
}
|
|
69
69
|
|
|
70
|
-
declare class PathData extends UIData {
|
|
71
|
-
protected _path: IPathCommandData;
|
|
72
|
-
protected setPath(value: IPathCommandData | IPathString): void;
|
|
70
|
+
declare class PathData extends UIData implements IPathData {
|
|
73
71
|
}
|
|
74
72
|
|
|
75
73
|
declare class PenData extends GroupData implements IPenData {
|
|
@@ -92,4 +90,4 @@ declare class ImageData extends RectData implements IImageData {
|
|
|
92
90
|
declare class CanvasData extends RectData implements ICanvasData {
|
|
93
91
|
}
|
|
94
92
|
|
|
95
|
-
export {
|
|
93
|
+
export { BoxData, CanvasData, EllipseData, FrameData, GroupData, ImageData, LeaferData, LineData, PathData, PenData, PolygonData, RectData, StarData, TextData, UIData, UnitConvert };
|