@leafer-ui/data 1.3.3 → 1.4.1
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/UIData.ts +20 -13
- package/types/index.d.ts +1 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@leafer-ui/data",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.4.1",
|
|
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.
|
|
26
|
-
"@leafer-ui/external": "1.
|
|
25
|
+
"@leafer/core": "1.4.1",
|
|
26
|
+
"@leafer-ui/external": "1.4.1"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
|
-
"@leafer/interface": "1.
|
|
30
|
-
"@leafer-ui/interface": "1.
|
|
29
|
+
"@leafer/interface": "1.4.1",
|
|
30
|
+
"@leafer-ui/interface": "1.4.1"
|
|
31
31
|
}
|
|
32
32
|
}
|
package/src/UIData.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { INumber, IValue, IBoolean, IPathCommandData, IPathString, IPointData, IPathCommandObject } from '@leafer/interface'
|
|
1
|
+
import { INumber, IValue, IBoolean, IPathCommandData, IPathString, IPointData, IPathCommandObject, IObject, IFilter } from '@leafer/interface'
|
|
2
2
|
import { PathConvert, LeafData, Debug } from '@leafer/core'
|
|
3
3
|
|
|
4
|
-
import {
|
|
4
|
+
import { IUI, IUIData, ILeafPaint } from '@leafer-ui/interface'
|
|
5
5
|
import { Paint, PaintImage } from '@leafer-ui/external'
|
|
6
6
|
|
|
7
7
|
|
|
@@ -136,21 +136,18 @@ export class UIData extends LeafData implements IUIData {
|
|
|
136
136
|
|
|
137
137
|
|
|
138
138
|
protected setShadow(value: IValue) {
|
|
139
|
-
this
|
|
140
|
-
if (value instanceof Array) {
|
|
141
|
-
if (value.some((item: IShadowEffect) => item.visible === false)) value = value.filter((item: IShadowEffect) => item.visible !== false)
|
|
142
|
-
this._shadow = value.length ? value : null
|
|
143
|
-
} else this._shadow = value && (value as IShadowEffect).visible !== false ? [value] : null
|
|
139
|
+
setArray(this, 'shadow', value)
|
|
144
140
|
}
|
|
145
141
|
|
|
146
142
|
protected setInnerShadow(value: IValue) {
|
|
147
|
-
this
|
|
148
|
-
if (value instanceof Array) {
|
|
149
|
-
if (value.some((item: IShadowEffect) => item.visible === false)) value = value.filter((item: IShadowEffect) => item.visible !== false)
|
|
150
|
-
this._innerShadow = value.length ? value : null
|
|
151
|
-
} else this._innerShadow = value && (value as IShadowEffect).visible !== false ? [value] : null
|
|
143
|
+
setArray(this, 'innerShadow', value)
|
|
152
144
|
}
|
|
153
145
|
|
|
146
|
+
protected setFilter(value: IValue) {
|
|
147
|
+
setArray(this, 'filter', value)
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
|
|
154
151
|
// custom
|
|
155
152
|
|
|
156
153
|
public __computePaint(): void {
|
|
@@ -160,4 +157,14 @@ export class UIData extends LeafData implements IUIData {
|
|
|
160
157
|
this.__needComputePaint = false
|
|
161
158
|
}
|
|
162
159
|
|
|
163
|
-
}
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
|
|
163
|
+
function setArray(data: IUIData, key: string, value: IValue) {
|
|
164
|
+
data.__setInput(key, value)
|
|
165
|
+
if (value instanceof Array) {
|
|
166
|
+
if (value.some((item: IFilter) => item.visible === false)) value = value.filter((item: IFilter) => item.visible !== false)
|
|
167
|
+
value.length || (value = null)
|
|
168
|
+
} else value = value && (value as IFilter).visible !== false ? [value] : null;
|
|
169
|
+
(data as IObject)['_' + key] = value
|
|
170
|
+
}
|
package/types/index.d.ts
CHANGED
|
@@ -36,6 +36,7 @@ declare class UIData extends LeafData implements IUIData {
|
|
|
36
36
|
protected setPath(value: IPathCommandData | IPathCommandObject[] | IPathString): void;
|
|
37
37
|
protected setShadow(value: IValue): void;
|
|
38
38
|
protected setInnerShadow(value: IValue): void;
|
|
39
|
+
protected setFilter(value: IValue): void;
|
|
39
40
|
__computePaint(): void;
|
|
40
41
|
}
|
|
41
42
|
|