@leafer/decorator 1.0.0-beta.7 → 1.0.0-beta.9
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/data.ts +13 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@leafer/decorator",
|
|
3
|
-
"version": "1.0.0-beta.
|
|
3
|
+
"version": "1.0.0-beta.9",
|
|
4
4
|
"description": "@leafer/decorator",
|
|
5
5
|
"author": "Chao (Leafer) Wan",
|
|
6
6
|
"license": "MIT",
|
|
@@ -19,10 +19,10 @@
|
|
|
19
19
|
"leaferjs"
|
|
20
20
|
],
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@leafer/platform": "1.0.0-beta.
|
|
23
|
-
"@leafer/debug": "1.0.0-beta.
|
|
22
|
+
"@leafer/platform": "1.0.0-beta.9",
|
|
23
|
+
"@leafer/debug": "1.0.0-beta.9"
|
|
24
24
|
},
|
|
25
25
|
"devDependencies": {
|
|
26
|
-
"@leafer/interface": "1.0.0-beta.
|
|
26
|
+
"@leafer/interface": "1.0.0-beta.9"
|
|
27
27
|
}
|
|
28
28
|
}
|
package/src/data.ts
CHANGED
|
@@ -223,7 +223,19 @@ export function defineDataProcessor(target: ILeaf, key: string, defaultValue?: _
|
|
|
223
223
|
enumerable: true
|
|
224
224
|
}
|
|
225
225
|
|
|
226
|
-
if (defaultValue === undefined)
|
|
226
|
+
if (defaultValue === undefined) {
|
|
227
|
+
property.get = function () { return this[computedKey] }
|
|
228
|
+
} else if (key === 'width') {
|
|
229
|
+
property.get = function () {
|
|
230
|
+
const v = this[computedKey]
|
|
231
|
+
return v === undefined ? ((this as ILeafData).__naturalWidth || defaultValue) : v
|
|
232
|
+
}
|
|
233
|
+
} else if (key === 'height') {
|
|
234
|
+
property.get = function () {
|
|
235
|
+
const v = this[computedKey]
|
|
236
|
+
return v === undefined ? ((this as ILeafData).__naturalHeight || defaultValue) : v
|
|
237
|
+
}
|
|
238
|
+
}
|
|
227
239
|
|
|
228
240
|
const descriptor = getDescriptor(data, key)
|
|
229
241
|
|