@leafer/display-module 1.8.0 → 1.9.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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@leafer/display-module",
3
- "version": "1.8.0",
3
+ "version": "1.9.1",
4
4
  "description": "@leafer/display-module",
5
5
  "author": "Chao (Leafer) Wan",
6
6
  "license": "MIT",
@@ -22,12 +22,13 @@
22
22
  "leaferjs"
23
23
  ],
24
24
  "dependencies": {
25
- "@leafer/helper": "1.8.0",
26
- "@leafer/event": "1.8.0",
27
- "@leafer/math": "1.8.0",
28
- "@leafer/debug": "1.8.0"
25
+ "@leafer/helper": "1.9.1",
26
+ "@leafer/event": "1.9.1",
27
+ "@leafer/math": "1.9.1",
28
+ "@leafer/data": "1.9.1",
29
+ "@leafer/debug": "1.9.1"
29
30
  },
30
31
  "devDependencies": {
31
- "@leafer/interface": "1.8.0"
32
+ "@leafer/interface": "1.9.1"
32
33
  }
33
34
  }
@@ -1,9 +1,9 @@
1
1
  import { ILeafDataProxyModule, IObject, IValue } from '@leafer/interface'
2
- import { PropertyEvent } from '@leafer/event'
2
+ import { PropertyEvent, LeaferEvent, leaferTransformAttrMap } from '@leafer/event'
3
+ import { isObject, isFinite, isUndefined } from '@leafer/data'
3
4
  import { Debug } from '@leafer/debug'
4
5
 
5
6
 
6
- const { isFinite } = Number
7
7
  const debug = Debug.get('setAttr')
8
8
 
9
9
  export const LeafDataProxy: ILeafDataProxyModule = {
@@ -13,12 +13,12 @@ export const LeafDataProxy: ILeafDataProxyModule = {
13
13
 
14
14
  const oldValue = this.__.__getInput(name)
15
15
 
16
- if (checkFiniteNumber && !isFinite(newValue) && newValue !== undefined) { // 警告 NaN、Infinity、-Infinity、null、非有效数字
16
+ if (checkFiniteNumber && !isFinite(newValue) && !isUndefined(newValue)) { // 警告 NaN、Infinity、-Infinity、null、非有效数字
17
17
  debug.warn(this.innerName, name, newValue)
18
18
  newValue = undefined // must
19
19
  }
20
20
 
21
- if (typeof newValue === 'object' || oldValue !== newValue) {
21
+ if (isObject(newValue) || oldValue !== newValue) {
22
22
 
23
23
  this.__realSetAttr(name, newValue)
24
24
 
@@ -27,6 +27,11 @@ export const LeafDataProxy: ILeafDataProxyModule = {
27
27
 
28
28
  if (this.isLeafer) {
29
29
  this.emitEvent(new PropertyEvent(PropertyEvent.LEAFER_CHANGE, this, name, oldValue, newValue))
30
+ const transformEventName = leaferTransformAttrMap[name]
31
+ if (transformEventName) {
32
+ this.emitEvent(new LeaferEvent(transformEventName, this))
33
+ this.emitEvent(new LeaferEvent(LeaferEvent.TRANSFORM, this))
34
+ }
30
35
  } else {
31
36
  if (this.hasEvent(CHANGE)) this.emitEvent(event)
32
37
  }
@@ -51,7 +56,7 @@ export const LeafDataProxy: ILeafDataProxyModule = {
51
56
  const data = this.__ as IObject
52
57
  data[name] = newValue
53
58
  if (this.__proxyData) this.setProxyAttr(name, newValue)
54
- if (data.normalStyle) this.lockNormalStyle || data.normalStyle[name] === undefined || (data.normalStyle[name] = newValue)
59
+ if (data.normalStyle) this.lockNormalStyle || isUndefined(data.normalStyle[name]) || (data.normalStyle[name] = newValue)
55
60
  },
56
61
 
57
62