@leafer-ui/data 1.0.0-alpha.30 → 1.0.0-alpha.31
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 +4 -4
- package/src/TextData.ts +2 -0
- package/src/UIData.ts +24 -10
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@leafer-ui/data",
|
|
3
|
-
"version": "1.0.0-alpha.
|
|
3
|
+
"version": "1.0.0-alpha.31",
|
|
4
4
|
"description": "@leafer-ui/data",
|
|
5
5
|
"author": "Chao (Leafer) Wan",
|
|
6
6
|
"license": "MIT",
|
|
@@ -19,10 +19,10 @@
|
|
|
19
19
|
"leaferjs"
|
|
20
20
|
],
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@leafer/core": "1.0.0-alpha.
|
|
22
|
+
"@leafer/core": "1.0.0-alpha.31"
|
|
23
23
|
},
|
|
24
24
|
"devDependencies": {
|
|
25
|
-
"@leafer/interface": "1.0.0-alpha.
|
|
26
|
-
"@leafer-ui/interface": "1.0.0-alpha.
|
|
25
|
+
"@leafer/interface": "1.0.0-alpha.31",
|
|
26
|
+
"@leafer-ui/interface": "1.0.0-alpha.31"
|
|
27
27
|
}
|
|
28
28
|
}
|
package/src/TextData.ts
CHANGED
|
@@ -21,8 +21,10 @@ export class TextData extends UIData implements ITextData {
|
|
|
21
21
|
|
|
22
22
|
setFontWeight(value: IFontWeight): void {
|
|
23
23
|
if (typeof value === 'string') {
|
|
24
|
+
this.__setInput('fontWeight', value)
|
|
24
25
|
this._fontWeight = fontWeightMap[value] || 400
|
|
25
26
|
} else {
|
|
27
|
+
if (this.__input) this.__removeInput('fontWeight')
|
|
26
28
|
this._fontWeight = value
|
|
27
29
|
}
|
|
28
30
|
}
|
package/src/UIData.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { __Value } from '@leafer/interface'
|
|
1
|
+
import { IBlendMode, __Value } from '@leafer/interface'
|
|
2
2
|
import { LeafData } from '@leafer/core'
|
|
3
3
|
|
|
4
|
-
import { IUI, IUIData, IUnitData } from '@leafer-ui/interface'
|
|
4
|
+
import { IShadowEffect, IUI, IUIData, IUnitData } from '@leafer-ui/interface'
|
|
5
5
|
import { Paint } from '@leafer-ui/external'
|
|
6
6
|
|
|
7
7
|
|
|
@@ -9,6 +9,9 @@ export class UIData extends LeafData implements IUIData {
|
|
|
9
9
|
|
|
10
10
|
public __leaf: IUI
|
|
11
11
|
|
|
12
|
+
public __blendLayer?: boolean
|
|
13
|
+
public _blendMode: string
|
|
14
|
+
|
|
12
15
|
public __isFills?: boolean
|
|
13
16
|
public __isStrokes?: boolean
|
|
14
17
|
|
|
@@ -18,6 +21,15 @@ export class UIData extends LeafData implements IUIData {
|
|
|
18
21
|
protected _shadow?: __Value
|
|
19
22
|
protected _innerShadow?: __Value
|
|
20
23
|
|
|
24
|
+
protected setBlendMode(value: IBlendMode) {
|
|
25
|
+
this._blendMode = value
|
|
26
|
+
if (value === 'pass-through' || !value) {
|
|
27
|
+
if (this.__blendLayer) this.__blendLayer = false
|
|
28
|
+
} else {
|
|
29
|
+
this.__blendLayer = true
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
21
33
|
protected setFill(value: __Value) {
|
|
22
34
|
if (typeof value === 'string' || !value) {
|
|
23
35
|
this._fill = value
|
|
@@ -43,30 +55,32 @@ export class UIData extends LeafData implements IUIData {
|
|
|
43
55
|
}
|
|
44
56
|
|
|
45
57
|
protected setShadow(value: __Value) {
|
|
58
|
+
this.__setInput('shadow', value)
|
|
46
59
|
if (value instanceof Array) {
|
|
47
|
-
|
|
60
|
+
if (value.some((item: IShadowEffect) => item.visible === false)) value = value.filter((item: IShadowEffect) => item.visible !== false)
|
|
61
|
+
this._shadow = value.length ? value : null
|
|
48
62
|
} else if (value) {
|
|
49
|
-
this._shadow = [value]
|
|
63
|
+
this._shadow = (value as IShadowEffect).visible === false ? null : [value]
|
|
50
64
|
} else {
|
|
51
|
-
this._shadow =
|
|
65
|
+
this._shadow = null
|
|
52
66
|
}
|
|
53
67
|
}
|
|
54
68
|
|
|
55
69
|
protected setInnerShadow(value: __Value) {
|
|
70
|
+
this.__setInput('innerShadow', value)
|
|
56
71
|
if (value instanceof Array) {
|
|
57
|
-
|
|
72
|
+
if (value.some((item: IShadowEffect) => item.visible === false)) value = value.filter((item: IShadowEffect) => item.visible !== false)
|
|
73
|
+
this._innerShadow = value.length ? value : null
|
|
58
74
|
} else if (value) {
|
|
59
|
-
this._innerShadow = [value]
|
|
75
|
+
this._innerShadow = (value as IShadowEffect).visible === false ? null : [value]
|
|
60
76
|
} else {
|
|
61
|
-
this.
|
|
77
|
+
this._innerShadow = null
|
|
62
78
|
}
|
|
63
79
|
}
|
|
64
80
|
|
|
65
81
|
}
|
|
66
82
|
|
|
67
83
|
|
|
68
|
-
|
|
69
|
-
|
|
70
84
|
export const UnitConvert = {
|
|
71
85
|
|
|
72
86
|
number(value: number | IUnitData, percentRefer?: number): number {
|