@dwightbcoder/action-ui
Advanced tools
Comparing version 1.3.36 to 1.3.37
@@ -7,2 +7,3 @@ "use strict";var ActionUI=function(e){"use strict";/** | ||
* Model | ||
* @version 20230914 | ||
* @description Observable data object | ||
@@ -13,6 +14,6 @@ */class l{constructor(e={},t=null){let o=null;try{o=new Proxy(this,{set:this.constructor._proxySet,deleteProperty:this.constructor._proxyDelete})}catch(t){o=new Proxy(this,{set:this.constructor._proxySet})}// Set private properties | ||
sync(e){return e&&(e=t({},e,!0),t(this,e)),this}// Add watcher callback | ||
watch(e){return this._watchers.push(e),this}clearChanges(){return this._changes={},this}triggerChanges(e){return e&&t(this._changes,e),this._trigger(!0)}// @deprecated | ||
watch(e){return this._watchers.push(e),this}clearChanges(){return this._changes={},this}triggerChanges(e){for(const t in e)e.hasOwnProperty(t)&&"_"!=t[0]&&this._change(t,e[t],this[t])}// @deprecated | ||
_privatize(){for(let e in this)"_"==e[0]&&Object.defineProperty(this,e,{enumerable:!1})}// Trigger all watcher callbacks | ||
_trigger(e=!1){if(window.clearTimeout(this._timer),this._timer=null,e||0<Object.keys(this._changes).length){let e=this._watchers;for(let t in e)e[t].call(this,this._changes);null!=this._parent&&this._parent.model.triggerChanges({child:this,changes:this._changes}),this._changes={}}}// Log property change | ||
_change(e,t,o){this._changes[e]={value:t,originalValue:o},this._timer||(this._timer=window.setTimeout(()=>this._trigger(),this._options.triggerDelay))}static _proxySet(e,t,o){let n=e[t];if(e[t]&&e[t]instanceof l)e[t].sync(o);else if(window.Reflect&&window.Reflect.set)!(o instanceof Object)||Array.isArray(o)||o instanceof l||"_"==t[0]||(o=new l(o,{model:e,property:t})),Reflect.set(e,t,o);else throw"Missing Model dependency: Reflect.set()";return"_"==t[0]?(Object.defineProperty(e,t,{enumerable:!1}),!0):(e._change(t,o,n),!0)}static _proxyDelete(e,t){if(t in e){let o=e[t];delete e[t],e._change(t,void 0,o)}return!0}}/** | ||
_trigger(e=!1){if(window.clearTimeout(this._timer),this._timer=null,e||0<Object.keys(this._changes).length){let e=this._watchers;for(let t in e)e[t].call(this,this._changes);null!=this._parent&&null!=this._parent.property&&"_"!=this._parent.property[0]&&this._parent.model.triggerChanges({child:this,changes:this._changes}),this._changes={}}}// Log property change | ||
_change(e,t,o){this._changes[e]={value:t,originalValue:o},window.clearTimeout(this._timer),this._timer=window.setTimeout(()=>this._trigger(),this._options.triggerDelay)}static _proxySet(e,t,o){let n=e[t];if(e[t]&&e[t]instanceof l)e[t].sync(o);else if(window.Reflect&&window.Reflect.set)!(o instanceof Object)||Array.isArray(o)||o instanceof l||"_"==t[0]||(o=new l(o,{model:e,property:t})),Reflect.set(e,t,o);else throw"Missing Model dependency: Reflect.set()";return"_"==t[0]?(Object.defineProperty(e,t,{enumerable:!1}),!0):(e._change(t,o,n),!0)}static _proxyDelete(e,t){if(t in e){let o=e[t];delete e[t],e._change(t,void 0,o)}return!0}}/** | ||
* @class Action | ||
@@ -19,0 +20,0 @@ * @version 20230829 |
@@ -5,2 +5,3 @@ import * as Util from "./util.js"; | ||
* Model | ||
* @version 20230914 | ||
* @description Observable data object | ||
@@ -96,4 +97,9 @@ */ | ||
{ | ||
if (changes) Util.deepAssign(this._changes, changes) | ||
return this._trigger(true) | ||
for (const i in changes) | ||
{ | ||
if (changes.hasOwnProperty(i) && i[0] != "_") | ||
{ | ||
this._change(i, changes[i], this[i]) | ||
} | ||
} | ||
} | ||
@@ -126,4 +132,4 @@ | ||
} | ||
if (this._parent != null) | ||
if (this._parent != null && this._parent.property != null && this._parent.property[0] != '_') | ||
{ | ||
@@ -142,7 +148,5 @@ this._parent.model.triggerChanges({ child: this, changes: this._changes}) | ||
this._changes[prop] = { value: value, originalValue: originalValue } | ||
if (!this._timer) | ||
{ | ||
this._timer = window.setTimeout(() => this._trigger(), this._options.triggerDelay) | ||
} | ||
window.clearTimeout(this._timer) | ||
this._timer = window.setTimeout(() => this._trigger(), this._options.triggerDelay) | ||
} | ||
@@ -149,0 +153,0 @@ |
{ | ||
"name": "@dwightbcoder/action-ui", | ||
"version": "1.3.36", | ||
"version": "1.3.37", | ||
"description": "Action UI is a Javascript framework to simplify connecting actions to user interface elements", | ||
@@ -5,0 +5,0 @@ "main": "dist/action-ui.min.js", |
@@ -5,2 +5,3 @@ import * as Util from "./util.js"; | ||
* Model | ||
* @version 20230914 | ||
* @description Observable data object | ||
@@ -96,4 +97,9 @@ */ | ||
{ | ||
if (changes) Util.deepAssign(this._changes, changes) | ||
return this._trigger(true) | ||
for (const i in changes) | ||
{ | ||
if (changes.hasOwnProperty(i) && i[0] != "_") | ||
{ | ||
this._change(i, changes[i], this[i]) | ||
} | ||
} | ||
} | ||
@@ -126,4 +132,4 @@ | ||
} | ||
if (this._parent != null) | ||
if (this._parent != null && this._parent.property != null && this._parent.property[0] != '_') | ||
{ | ||
@@ -142,7 +148,5 @@ this._parent.model.triggerChanges({ child: this, changes: this._changes}) | ||
this._changes[prop] = { value: value, originalValue: originalValue } | ||
if (!this._timer) | ||
{ | ||
this._timer = window.setTimeout(() => this._trigger(), this._options.triggerDelay) | ||
} | ||
window.clearTimeout(this._timer) | ||
this._timer = window.setTimeout(() => this._trigger(), this._options.triggerDelay) | ||
} | ||
@@ -149,0 +153,0 @@ |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
442506
11610