@mescius/wijmo.angular2legacy.directivebase 5.20252.43-nightly.d20251107.t173019 → 5.20252.43-nightly.d20251112.t011705
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/es2015-commonjs.js +2 -2
- package/es2015-esm.js +2 -2
- package/es5-esm.js +1 -1
- package/index.d.ts +1 -1
- package/index.js +1 -1
- package/package.json +2 -2
package/es2015-commonjs.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
*
|
|
3
|
-
* Wijmo Library 5.20252.43-nightly.
|
|
3
|
+
* Wijmo Library 5.20252.43-nightly.d20251112.t011705
|
|
4
4
|
* https://developer.mescius.com/wijmo
|
|
5
5
|
*
|
|
6
6
|
* Copyright(c) MESCIUS inc. All rights reserved.
|
|
@@ -11,4 +11,4 @@
|
|
|
11
11
|
*
|
|
12
12
|
*/
|
|
13
13
|
|
|
14
|
-
"use strict";var __importStar=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var i in e)Object.hasOwnProperty.call(e,i)&&(t[i]=e[i]);t.default=e;return t};Object.defineProperty(exports,"__esModule",{value:!0});const core_1=require("@angular/core"),wijmo=__importStar(require("@mescius/wijmo"));class WjOptions{}WjOptions.asyncBindings=!0;exports.WjOptions=WjOptions;class WjComponentResolvedMetadata{constructor(e){this.changeEventMap=[];this.allImplEvents=[];this.resolveChangeEventMap(e)}resolveChangeEventMap(e){let t=this.changeEventMap,i=e.outputs,r=e.changeEvents||{};t.splice(0,t.length);this.allImplEvents=[];if(!i||!i.length)return;let n=i.map(e=>e.split(":")).map(e=>({implName:e[0].trim(),exposeName:e[1]&&e[1].trim()}));this.allImplEvents=n.map(e=>e.implName);let s=n.filter(e=>e.implName&&e.exposeName);for(let e of s){if(Ng2Utils.getWjEventName(e.implName)){let i={eventImpl:e.implName,event:e.exposeName},n=r[e.exposeName];n&&n.length&&(i.props=n.map(e=>{return{prop:e,evExposed:Ng2Utils.getChangeEventNameExposed(e),evImpl:Ng2Utils.getChangeEventNameImplemented(e)}}));t.push(i)}}for(let e in r)if(e.indexOf(".")>-1){let i={eventImpl:null,event:e,props:r[e].map(e=>{return{prop:e,evExposed:Ng2Utils.getChangeEventNameExposed(e),evImpl:Ng2Utils.getChangeEventNameImplemented(e)}})};t.push(i)}}}exports.WjComponentResolvedMetadata=WjComponentResolvedMetadata;class WjDirectiveBehavior{constructor(e,t,i,r){this._pendingEvents=[];this.isInitialized=!1;this.isDestroyed=!1;this.nzRun=e=>e();this.directive=e;this.elementRef=t;this.injector=i;this._overrideDirectiveMethods();let n=this.nz=i.get(core_1.NgZone);n&&(this.nzRun=n.run.bind(n));this.injectedParent=r;let s=this.typeData=e.constructor[WjDirectiveBehavior.directiveTypeDataProp];null==s.siblingId&&(s.siblingId=++WjDirectiveBehavior.siblingDirId+"");let o=e.constructor[WjDirectiveBehavior.directiveResolvedTypeDataProp];o?this.resolvedTypeData=o:e.constructor[WjDirectiveBehavior.directiveResolvedTypeDataProp]=o=this.resolvedTypeData=new WjComponentResolvedMetadata(s);e[WjDirectiveBehavior.BehaviourRefProp]=this;i[WjDirectiveBehavior.BehaviourRefProp]=this;e[WjDirectiveBehavior.isInitializedPropAttr]=!1;this._createEvents();this._setupAsChild();this._isHostElement()&&t.nativeElement.setAttribute(WjDirectiveBehavior.siblingDirIdAttr,s.siblingId);this.subscribeToEvents(!1);this.directive instanceof wijmo.Control&&(this.directive.workingAs="Angular2")}static getHostElement(e,t){WjDirectiveBehavior.ngZone=t.get(core_1.NgZone);return e.nativeElement}static attach(e,t,i,r){return new WjDirectiveBehavior(e,t,i,r)}static getZone(e){const t=WjDirectiveBehavior.getBehavior(e);return t&&t.nz||WjDirectiveBehavior.ngZone}ngOnInit(){this.isInitialized=!0;this._initParent();this.subscribeToEvents(!0)}ngAfterViewInit(){this.directive[WjDirectiveBehavior.isInitializedPropAttr]=!0;setTimeout(()=>{this.isDestroyed||this.directive[WjDirectiveBehavior.initializedEventAttr].emit(void 0)})}ngOnDestroy(){if(!this.isDestroyed){this.isDestroyed=!0;var e=this.directive;this._siblingInsertedMO&&this._siblingInsertedMO.disconnect();if(this._isChild()&&this.parentBehavior){let i=this.parentBehavior.directive,r=this._getParentProp();if(!this.parentBehavior.isDestroyed&&i&&r&&e){let n=i[r];if(wijmo.isArray(n)&&n){var t=n.indexOf(e);t>=0&&n.splice(t,1)}}}if(e instanceof wijmo.Control&&e.hostElement){let t=this.elementRef.nativeElement,i=t&&t.parentNode,r=i?Array.prototype.indexOf.call(i.childNodes,t):-1;e.dispose();if(r>-1&&Array.prototype.indexOf.call(i.childNodes,t)<0){t.textContent="";r<i.childNodes.length&&i.replaceChild(t,i.childNodes[r])}}this.injector[WjDirectiveBehavior.BehaviourRefProp]=null}}static instantiateTemplate(e,t,i,r=!1,n={}){var s,o=t.createEmbeddedView(i,n,t.length),a=o.rootNodes;if(r&&1===a.length)s=a[0];else{s=document.createElement("div");for(let e of a)s.appendChild(e)}e&&e.appendChild(s);return{viewRef:o,rootElement:s}}getPropChangeEvent(e){let t=this.typeData.changeEvents;if(t)for(let i in t)if(t[i].indexOf(e)>-1)return i;return null}_createEvents(){let e=this.resolvedTypeData.allImplEvents;for(let t of e)this.directive[t]=new core_1.EventEmitter(!1)}_overrideDirectiveMethods(){const e=this.directive;if(e instanceof wijmo.Control){const t=e._resizeObserverCallback.bind(e);e._resizeObserverCallback=function(e){core_1.NgZone.isInAngularZone()?t(e):WjDirectiveBehavior.getZone(this).run(()=>{t(e)})}.bind(e)}}subscribeToEvents(e){var t=this.resolvedTypeData.changeEventMap;e=!!e;for(let i of t)e!==i.event.indexOf(".")<0&&this.addHandlers(i);if(e)for(let e of t)this.triggerPropChangeEvents(e,!0)}addHandlers(e){let t=this.directive;WjDirectiveBehavior.evaluatePath(t,e.event).addHandler((i,r)=>{this.nzRun(()=>{this.isInitialized&&this.triggerPropChangeEvents(e);e.eventImpl&&this._triggerEvent(t[e.eventImpl],r,e.props&&e.props.length>0)})})}triggerPropChangeEvents(e,t=!0){let i=this.directive;if(e.props&&e.props.length)for(let r of e.props)this._triggerEvent(i[r.evImpl],i[r.prop],t)}_setupAsChild(){if(this._isChild()){this._isHostElement()&&(this.elementRef.nativeElement.style.display="none");this.parentBehavior=WjDirectiveBehavior.getBehavior(this.injectedParent)}}_isAsyncBinding(){let e=this.directive[WjDirectiveBehavior.asyncBindingUpdatePropAttr];return null==e?WjOptions.asyncBindings:e}_isChild(){return this._isParentInitializer()||this._isParentReferencer()}_isParentInitializer(){return null!=this.directive[WjDirectiveBehavior.parPropAttr]}_isParentReferencer(){return!!this.typeData.parentRefProperty}_getParentProp(){return this.directive[WjDirectiveBehavior.parPropAttr]}_getParentReferenceProperty(){return this.typeData.parentRefProperty}_useParentObj(){return!1}_parentInCtor(){return this._isParentReferencer()&&""==this._getParentReferenceProperty()}_initParent(){if(this.parentBehavior&&!this._useParentObj()){var e=this.parentBehavior.directive,t=this._getParentProp(),i=this.directive;if(this._isParentInitializer()){this._getParentProp();let r=e[t];if(wijmo.isArray(r)){let e=this._isHostElement(),t=e?this._getSiblingIndex():-1;(t<0||t>=r.length)&&(t=r.length);r.splice(t,0,i);if(e){const e=this.elementRef.nativeElement;this._siblingInsertedMO=new MutationObserver(this._siblingInserted.bind(this));this._siblingInsertedMO.observe(e,{childList:!0})}}else e[t]=i}this._isParentReferencer()&&!this._parentInCtor()&&(i[this._getParentReferenceProperty()]=e)}}_getSiblingIndex(){var e=this.elementRef.nativeElement,t=e.parentElement;if(!t)return-1;for(var i=t.childNodes,r=-1,n=this.typeData.siblingId,s=0;s<i.length;s++){var o=i[s];if(1==o.nodeType&&o.getAttribute(WjDirectiveBehavior.siblingDirIdAttr)==n){++r;if(o===e)return r}}return-1}_siblingInserted(e){for(let t of e)if("childList"===t.type&&t.addedNodes.length>0){if(Array.from(t.addedNodes).some(e=>e===this.elementRef.nativeElement)){const e=this._getSiblingIndex(),t=this.parentBehavior.directive[this._getParentProp()],i=this.directive,r=t.indexOf(i);if(e>=0&&r>=0&&e!==r){t.splice(r,1);const n=Math.min(e,t.length);t.splice(n,0,i)}}}}_isHostElement(){return this.elementRef.nativeElement.nodeType===Node.ELEMENT_NODE}_triggerEvent(e,t,i){if(i&&this._isAsyncBinding()){let i={event:e,args:t};this._pendingEvents.push(i);null==this._pendingEventsTO&&(this._pendingEventsTO=setTimeout(()=>{this._triggerPendingEvents(!1)},0))}else e.emit(t)}_triggerPendingEvents(e){if(null!=this._pendingEventsTO){clearTimeout(this._pendingEventsTO);this._pendingEventsTO=null}if(this.isDestroyed)return;let t=[].concat(this._pendingEvents);this._pendingEvents.splice(0,this._pendingEvents.length);for(let e of t)e.event.emit(e.args);e&&this._pendingEvents.length&&this._triggerPendingEvents(!0)}flushPendingEvents(){this._triggerPendingEvents(!0)}static evaluatePath(e,t){this._pathBinding.path=t;return this._pathBinding.getValue(e)}static getBehavior(e){return e?e[WjDirectiveBehavior.BehaviourRefProp]:null}}WjDirectiveBehavior.directiveTypeDataProp="meta";WjDirectiveBehavior.directiveResolvedTypeDataProp="_wjResolvedMeta";WjDirectiveBehavior.BehaviourRefProp="_wjBehaviour";WjDirectiveBehavior.parPropAttr="wjProperty";WjDirectiveBehavior.wjModelPropAttr="wjModelProperty";WjDirectiveBehavior.initializedEventAttr="initialized";WjDirectiveBehavior.isInitializedPropAttr="isInitialized";WjDirectiveBehavior.siblingDirIdAttr="wj-directive-id";WjDirectiveBehavior.asyncBindingUpdatePropAttr="asyncBindings";WjDirectiveBehavior.siblingDirId=0;WjDirectiveBehavior.wijmoComponentProviderId="WjComponent";WjDirectiveBehavior.outsideZoneEvents={pointermove:!0,pointerover:!0,mousemove:!0,wheel:!0,touchmove:!0,pointerenter:!0,pointerleave:!0,pointerout:!0,mouseover:!0,mouseenter:!0,mouseleave:!0,mouseout:!0};WjDirectiveBehavior._pathBinding=new wijmo.Binding("");exports.WjDirectiveBehavior=WjDirectiveBehavior;class Ng2Utils{static initEvents(e,t){var i=[];for(let e of t){let t=e.props;e.event&&e.eventImpl&&i.push(e.eventImpl+":"+e.event);if(t&&t.length)for(let e of t)i.push(e.evImpl+":"+e.evExposed)}return i}static getChangeEventNameImplemented(e){return Ng2Utils.getChangeEventNameExposed(e)+Ng2Utils.changeEventImplementSuffix}static getChangeEventNameExposed(e){return e+"Change"}static getWjEventNameImplemented(e){return e+Ng2Utils.wjEventImplementSuffix}static getWjEventName(e){if(e){const t=Ng2Utils.wjEventImplementSuffix;let i=e.length-t.length;if(i>0&&e.substr(i)===t)return e.substr(0,i)}return null}static getBaseType(e){let t;return e&&(t=Object.getPrototypeOf(e.prototype))&&t.constructor}static getAnnotations(e){return Reflect.getMetadata("annotations",e)}static getAnnotation(e,t){if(t&&e)for(let i of e)if(i instanceof t)return i;return null}static getTypeAnnotation(e,t,i){for(let r=e;r;r=i?null:Ng2Utils.getBaseType(r)){let e=Ng2Utils.getAnnotation(Ng2Utils.getAnnotations(r),t);if(e)return e}return null}static equals(e,t){return e!=e&&t!=t||wijmo.DateTime.equals(e,t)||e===t}static _copy(e,t,i,r,n){if(e&&t)for(let s in t)if(r||"_"!==s[0]){let r=t[s];if(!n||n(s,r)){let t=e[s];wijmo.isArray(r)?e[s]=(!wijmo.isArray(t)||i?[]:t).concat(r):void 0!==r&&(e[s]=r)}}}}Ng2Utils.changeEventImplementSuffix="PC";Ng2Utils.wjEventImplementSuffix="Ng";exports.Ng2Utils=Ng2Utils;class WjValueAccessor{constructor(e){this._writeQnt=0;this._isSubscribed=!1;this._dirUpdateQnt=0;this._onChange=e=>{};this._onTouched=()=>{};this._directive=e;this._behavior=WjDirectiveBehavior.getBehavior(e)}writeValue(e){this._modelValue=e;++this._writeQnt;if(this._directive.isInitialized){this._ensureInitEhUnsubscribed();this._updateDirective()}else if(!this._dirInitEh){let e=this._directive.initialized;this._dirInitEh=e.subscribe(()=>{this._updateDirective();this._ensureInitEhUnsubscribed()})}}registerOnChange(e){this._onChange=e}registerOnTouched(e){this._onTouched=e}setDisabledState(e){let t=this._directive;t instanceof wijmo.Control&&(t.isDisabled=e)}_updateDirective(){if(!this._isFirstChange()||null!=this._modelValue){this._ensureNgModelProp();if(this._directive&&this._ngModelProp){let e=this._modelValue;""===e&&(e=null);this._dirUpdateQnt++;try{this._directive[this._ngModelProp]=e}finally{this._dirUpdateQnt--}}this._ensureSubscribed()}}_ensureSubscribed(){if(this._isSubscribed)return;let e=this._directive;if(e){this._ensureNgModelProp();let t=this._ngModelProp=e[WjDirectiveBehavior.wjModelPropAttr];if(t){let i=this._behavior.getPropChangeEvent(t);i&&e[i].addHandler(this._dirValChgEh,this)}e instanceof wijmo.Control&&e.lostFocus.addHandler(this._dirLostFocusEh,this);this._isSubscribed=!0}}_ensureNgModelProp(){!this._ngModelProp&&this._directive&&(this._ngModelProp=this._directive[WjDirectiveBehavior.wjModelPropAttr])}_ensureInitEhUnsubscribed(){if(this._dirInitEh){this._dirInitEh.unsubscribe();this._dirInitEh=null}}_isFirstChange(){return this._writeQnt<2}_dirValChgEh(e,t){if(this._onChange&&this._directive&&this._ngModelProp){let e=this._directive[this._ngModelProp],t=this._modelValue;""===t&&(t=null);if(!(this._dirUpdateQnt>0&&_isNullOrEmpty(t)&&_isNullOrEmpty(e)||Ng2Utils.equals(t,e))||wijmo.isArray(e)){this._modelValue=e;this._onChange(e)}}}_dirLostFocusEh(e,t){this._onTouched&&this._onTouched()}}exports.WjValueAccessor=WjValueAccessor;function WjValueAccessorFactory(e){return new WjValueAccessor(e)}exports.WjValueAccessorFactory=WjValueAccessorFactory;function _isNullOrEmpty(e){return null==e||""===e}
|
|
14
|
+
"use strict";var __importStar=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var i in e)Object.hasOwnProperty.call(e,i)&&(t[i]=e[i]);t.default=e;return t};Object.defineProperty(exports,"__esModule",{value:!0});const core_1=require("@angular/core"),wijmo=__importStar(require("@mescius/wijmo"));class WjOptions{}WjOptions.asyncBindings=!0;exports.WjOptions=WjOptions;class WjComponentResolvedMetadata{constructor(e){this.changeEventMap=[];this.allImplEvents=[];this.resolveChangeEventMap(e)}resolveChangeEventMap(e){let t=this.changeEventMap,i=e.outputs,r=e.changeEvents||{};t.splice(0,t.length);this.allImplEvents=[];if(!i||!i.length)return;let n=i.map(e=>e.split(":")).map(e=>({implName:e[0].trim(),exposeName:e[1]&&e[1].trim()}));this.allImplEvents=n.map(e=>e.implName);let s=n.filter(e=>e.implName&&e.exposeName);for(let e of s){if(Ng2Utils.getWjEventName(e.implName)){let i={eventImpl:e.implName,event:e.exposeName},n=r[e.exposeName];n&&n.length&&(i.props=n.map(e=>({prop:e,evExposed:Ng2Utils.getChangeEventNameExposed(e),evImpl:Ng2Utils.getChangeEventNameImplemented(e)})));t.push(i)}}for(let e in r)if(e.indexOf(".")>-1){let i={eventImpl:null,event:e,props:r[e].map(e=>({prop:e,evExposed:Ng2Utils.getChangeEventNameExposed(e),evImpl:Ng2Utils.getChangeEventNameImplemented(e)}))};t.push(i)}}}exports.WjComponentResolvedMetadata=WjComponentResolvedMetadata;class WjDirectiveBehavior{constructor(e,t,i,r){this._pendingEvents=[];this.isInitialized=!1;this.isDestroyed=!1;this.nzRun=e=>e();this.directive=e;this.elementRef=t;this.injector=i;this._overrideDirectiveMethods();let n=this.nz=i.get(core_1.NgZone);n&&(this.nzRun=n.run.bind(n));this.injectedParent=r;let s=this.typeData=e.constructor[WjDirectiveBehavior.directiveTypeDataProp];null==s.siblingId&&(s.siblingId=++WjDirectiveBehavior.siblingDirId+"");let o=e.constructor[WjDirectiveBehavior.directiveResolvedTypeDataProp];o?this.resolvedTypeData=o:e.constructor[WjDirectiveBehavior.directiveResolvedTypeDataProp]=o=this.resolvedTypeData=new WjComponentResolvedMetadata(s);e[WjDirectiveBehavior.BehaviourRefProp]=this;i[WjDirectiveBehavior.BehaviourRefProp]=this;e[WjDirectiveBehavior.isInitializedPropAttr]=!1;this._createEvents();this._setupAsChild();this._isHostElement()&&t.nativeElement.setAttribute(WjDirectiveBehavior.siblingDirIdAttr,s.siblingId);this.subscribeToEvents(!1);this.directive instanceof wijmo.Control&&(this.directive.workingAs="Angular2")}static getHostElement(e,t){WjDirectiveBehavior.ngZone=t.get(core_1.NgZone);return e.nativeElement}static attach(e,t,i,r){return new WjDirectiveBehavior(e,t,i,r)}static getZone(e){const t=WjDirectiveBehavior.getBehavior(e);return t&&t.nz||WjDirectiveBehavior.ngZone}ngOnInit(){this.isInitialized=!0;this._initParent();this.subscribeToEvents(!0)}ngAfterViewInit(){this.directive[WjDirectiveBehavior.isInitializedPropAttr]=!0;setTimeout(()=>{this.isDestroyed||this.directive[WjDirectiveBehavior.initializedEventAttr].emit(void 0)})}ngOnDestroy(){if(!this.isDestroyed){this.isDestroyed=!0;var e=this.directive;this._siblingInsertedMO&&this._siblingInsertedMO.disconnect();if(this._isChild()&&this.parentBehavior){let i=this.parentBehavior.directive,r=this._getParentProp();if(!this.parentBehavior.isDestroyed&&i&&r&&e){let n=i[r];if(wijmo.isArray(n)&&n){var t=n.indexOf(e);t>=0&&n.splice(t,1)}}}if(e instanceof wijmo.Control&&e.hostElement){let t=this.elementRef.nativeElement,i=t&&t.parentNode,r=i?Array.prototype.indexOf.call(i.childNodes,t):-1;e.dispose();if(r>-1&&Array.prototype.indexOf.call(i.childNodes,t)<0){t.textContent="";r<i.childNodes.length&&i.replaceChild(t,i.childNodes[r])}}this.injector[WjDirectiveBehavior.BehaviourRefProp]=null}}static instantiateTemplate(e,t,i,r=!1,n={}){var s,o=t.createEmbeddedView(i,n,t.length),a=o.rootNodes;if(r&&1===a.length)s=a[0];else{s=document.createElement("div");for(let e of a)s.appendChild(e)}e&&e.appendChild(s);return{viewRef:o,rootElement:s}}getPropChangeEvent(e){let t=this.typeData.changeEvents;if(t)for(let i in t)if(t[i].indexOf(e)>-1)return i;return null}_createEvents(){let e=this.resolvedTypeData.allImplEvents;for(let t of e)this.directive[t]=new core_1.EventEmitter(!1)}_overrideDirectiveMethods(){const e=this.directive;if(e instanceof wijmo.Control){const t=e._resizeObserverCallback.bind(e);e._resizeObserverCallback=function(e){core_1.NgZone.isInAngularZone()?t(e):WjDirectiveBehavior.getZone(this).run(()=>{t(e)})}.bind(e)}}subscribeToEvents(e){var t=this.resolvedTypeData.changeEventMap;e=!!e;for(let i of t)e!==i.event.indexOf(".")<0&&this.addHandlers(i);if(e)for(let e of t)this.triggerPropChangeEvents(e,!0)}addHandlers(e){let t=this.directive;WjDirectiveBehavior.evaluatePath(t,e.event).addHandler((i,r)=>{this.nzRun(()=>{this.isInitialized&&this.triggerPropChangeEvents(e);e.eventImpl&&this._triggerEvent(t[e.eventImpl],r,e.props&&e.props.length>0)})})}triggerPropChangeEvents(e,t=!0){let i=this.directive;if(e.props&&e.props.length)for(let r of e.props)this._triggerEvent(i[r.evImpl],i[r.prop],t)}_setupAsChild(){if(this._isChild()){this._isHostElement()&&(this.elementRef.nativeElement.style.display="none");this.parentBehavior=WjDirectiveBehavior.getBehavior(this.injectedParent)}}_isAsyncBinding(){let e=this.directive[WjDirectiveBehavior.asyncBindingUpdatePropAttr];return null==e?WjOptions.asyncBindings:e}_isChild(){return this._isParentInitializer()||this._isParentReferencer()}_isParentInitializer(){return null!=this.directive[WjDirectiveBehavior.parPropAttr]}_isParentReferencer(){return!!this.typeData.parentRefProperty}_getParentProp(){return this.directive[WjDirectiveBehavior.parPropAttr]}_getParentReferenceProperty(){return this.typeData.parentRefProperty}_useParentObj(){return!1}_parentInCtor(){return this._isParentReferencer()&&""==this._getParentReferenceProperty()}_initParent(){if(this.parentBehavior&&!this._useParentObj()){var e=this.parentBehavior.directive,t=this._getParentProp(),i=this.directive;if(this._isParentInitializer()){this._getParentProp();let r=e[t];if(wijmo.isArray(r)){let e=this._isHostElement(),t=e?this._getSiblingIndex():-1;(t<0||t>=r.length)&&(t=r.length);r.splice(t,0,i);if(e){const e=this.elementRef.nativeElement;this._siblingInsertedMO=new MutationObserver(this._siblingInserted.bind(this));this._siblingInsertedMO.observe(e,{childList:!0})}}else e[t]=i}this._isParentReferencer()&&!this._parentInCtor()&&(i[this._getParentReferenceProperty()]=e)}}_getSiblingIndex(){var e=this.elementRef.nativeElement,t=e.parentElement;if(!t)return-1;for(var i=t.childNodes,r=-1,n=this.typeData.siblingId,s=0;s<i.length;s++){var o=i[s];if(1==o.nodeType&&o.getAttribute(WjDirectiveBehavior.siblingDirIdAttr)==n){++r;if(o===e)return r}}return-1}_siblingInserted(e){for(let t of e)if("childList"===t.type&&t.addedNodes.length>0){if(Array.from(t.addedNodes).some(e=>e===this.elementRef.nativeElement)){const e=this._getSiblingIndex(),t=this.parentBehavior.directive[this._getParentProp()],i=this.directive,r=t.indexOf(i);if(e>=0&&r>=0&&e!==r){t.splice(r,1);const n=Math.min(e,t.length);t.splice(n,0,i)}}}}_isHostElement(){return this.elementRef.nativeElement.nodeType===Node.ELEMENT_NODE}_triggerEvent(e,t,i){if(i&&this._isAsyncBinding()){let i={event:e,args:t};this._pendingEvents.push(i);null==this._pendingEventsTO&&(this._pendingEventsTO=setTimeout(()=>{this._triggerPendingEvents(!1)},0))}else e.emit(t)}_triggerPendingEvents(e){if(null!=this._pendingEventsTO){clearTimeout(this._pendingEventsTO);this._pendingEventsTO=null}if(this.isDestroyed)return;let t=[].concat(this._pendingEvents);this._pendingEvents.splice(0,this._pendingEvents.length);for(let e of t)e.event.emit(e.args);e&&this._pendingEvents.length&&this._triggerPendingEvents(!0)}flushPendingEvents(){this._triggerPendingEvents(!0)}static evaluatePath(e,t){this._pathBinding.path=t;return this._pathBinding.getValue(e)}static getBehavior(e){return e?e[WjDirectiveBehavior.BehaviourRefProp]:null}}WjDirectiveBehavior.directiveTypeDataProp="meta";WjDirectiveBehavior.directiveResolvedTypeDataProp="_wjResolvedMeta";WjDirectiveBehavior.BehaviourRefProp="_wjBehaviour";WjDirectiveBehavior.parPropAttr="wjProperty";WjDirectiveBehavior.wjModelPropAttr="wjModelProperty";WjDirectiveBehavior.initializedEventAttr="initialized";WjDirectiveBehavior.isInitializedPropAttr="isInitialized";WjDirectiveBehavior.siblingDirIdAttr="wj-directive-id";WjDirectiveBehavior.asyncBindingUpdatePropAttr="asyncBindings";WjDirectiveBehavior.siblingDirId=0;WjDirectiveBehavior.wijmoComponentProviderId="WjComponent";WjDirectiveBehavior.outsideZoneEvents={pointermove:!0,pointerover:!0,mousemove:!0,wheel:!0,touchmove:!0,pointerenter:!0,pointerleave:!0,pointerout:!0,mouseover:!0,mouseenter:!0,mouseleave:!0,mouseout:!0};WjDirectiveBehavior._pathBinding=new wijmo.Binding("");exports.WjDirectiveBehavior=WjDirectiveBehavior;class Ng2Utils{static initEvents(e,t){var i=[];for(let e of t){let t=e.props;e.event&&e.eventImpl&&i.push(e.eventImpl+":"+e.event);if(t&&t.length)for(let e of t)i.push(e.evImpl+":"+e.evExposed)}return i}static getChangeEventNameImplemented(e){return Ng2Utils.getChangeEventNameExposed(e)+Ng2Utils.changeEventImplementSuffix}static getChangeEventNameExposed(e){return e+"Change"}static getWjEventNameImplemented(e){return e+Ng2Utils.wjEventImplementSuffix}static getWjEventName(e){if(e){const t=Ng2Utils.wjEventImplementSuffix;let i=e.length-t.length;if(i>0&&e.substr(i)===t)return e.substr(0,i)}return null}static getBaseType(e){let t;return e&&(t=Object.getPrototypeOf(e.prototype))&&t.constructor}static getAnnotations(e){return Reflect.getMetadata("annotations",e)}static getAnnotation(e,t){if(t&&e)for(let i of e)if(i instanceof t)return i;return null}static getTypeAnnotation(e,t,i){for(let r=e;r;r=i?null:Ng2Utils.getBaseType(r)){let e=Ng2Utils.getAnnotation(Ng2Utils.getAnnotations(r),t);if(e)return e}return null}static equals(e,t){return e!=e&&t!=t||wijmo.DateTime.equals(e,t)||e===t}static _copy(e,t,i,r,n){if(e&&t)for(let s in t)if(r||"_"!==s[0]){let r=t[s];if(!n||n(s,r)){let t=e[s];wijmo.isArray(r)?e[s]=(!wijmo.isArray(t)||i?[]:t).concat(r):void 0!==r&&(e[s]=r)}}}}Ng2Utils.changeEventImplementSuffix="PC";Ng2Utils.wjEventImplementSuffix="Ng";exports.Ng2Utils=Ng2Utils;class WjValueAccessor{constructor(e){this._writeQnt=0;this._isSubscribed=!1;this._dirUpdateQnt=0;this._onChange=e=>{};this._onTouched=()=>{};this._directive=e;this._behavior=WjDirectiveBehavior.getBehavior(e)}writeValue(e){this._modelValue=e;++this._writeQnt;if(this._directive.isInitialized){this._ensureInitEhUnsubscribed();this._updateDirective()}else if(!this._dirInitEh){let e=this._directive.initialized;this._dirInitEh=e.subscribe(()=>{this._updateDirective();this._ensureInitEhUnsubscribed()})}}registerOnChange(e){this._onChange=e}registerOnTouched(e){this._onTouched=e}setDisabledState(e){let t=this._directive;t instanceof wijmo.Control&&(t.isDisabled=e)}_updateDirective(){if(!this._isFirstChange()||null!=this._modelValue){this._ensureNgModelProp();if(this._directive&&this._ngModelProp){let e=this._modelValue;""===e&&(e=null);this._dirUpdateQnt++;try{this._directive[this._ngModelProp]=e}finally{this._dirUpdateQnt--}}this._ensureSubscribed()}}_ensureSubscribed(){if(this._isSubscribed)return;let e=this._directive;if(e){this._ensureNgModelProp();let t=this._ngModelProp=e[WjDirectiveBehavior.wjModelPropAttr];if(t){let i=this._behavior.getPropChangeEvent(t);i&&e[i].addHandler(this._dirValChgEh,this)}e instanceof wijmo.Control&&e.lostFocus.addHandler(this._dirLostFocusEh,this);this._isSubscribed=!0}}_ensureNgModelProp(){!this._ngModelProp&&this._directive&&(this._ngModelProp=this._directive[WjDirectiveBehavior.wjModelPropAttr])}_ensureInitEhUnsubscribed(){if(this._dirInitEh){this._dirInitEh.unsubscribe();this._dirInitEh=null}}_isFirstChange(){return this._writeQnt<2}_dirValChgEh(e,t){if(this._onChange&&this._directive&&this._ngModelProp){let e=this._directive[this._ngModelProp],t=this._modelValue;""===t&&(t=null);if(!(this._dirUpdateQnt>0&&_isNullOrEmpty(t)&&_isNullOrEmpty(e)||Ng2Utils.equals(t,e))||wijmo.isArray(e)){this._modelValue=e;this._onChange(e)}}}_dirLostFocusEh(e,t){this._onTouched&&this._onTouched()}}exports.WjValueAccessor=WjValueAccessor;function WjValueAccessorFactory(e){return new WjValueAccessor(e)}exports.WjValueAccessorFactory=WjValueAccessorFactory;function _isNullOrEmpty(e){return null==e||""===e}
|
package/es2015-esm.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
*
|
|
3
|
-
* Wijmo Library 5.20252.43-nightly.
|
|
3
|
+
* Wijmo Library 5.20252.43-nightly.d20251112.t011705
|
|
4
4
|
* https://developer.mescius.com/wijmo
|
|
5
5
|
*
|
|
6
6
|
* Copyright(c) MESCIUS inc. All rights reserved.
|
|
@@ -11,4 +11,4 @@
|
|
|
11
11
|
*
|
|
12
12
|
*/
|
|
13
13
|
|
|
14
|
-
import{EventEmitter,NgZone}from"@angular/core";import*as wijmo from"@mescius/wijmo";export class WjOptions{}WjOptions.asyncBindings=!0;export class WjComponentResolvedMetadata{constructor(e){this.changeEventMap=[];this.allImplEvents=[];this.resolveChangeEventMap(e)}resolveChangeEventMap(e){let t=this.changeEventMap,i=e.outputs,r=e.changeEvents||{};t.splice(0,t.length);this.allImplEvents=[];if(!i||!i.length)return;let n=i.map(e=>e.split(":")).map(e=>({implName:e[0].trim(),exposeName:e[1]&&e[1].trim()}));this.allImplEvents=n.map(e=>e.implName);let s=n.filter(e=>e.implName&&e.exposeName);for(let e of s){if(Ng2Utils.getWjEventName(e.implName)){let i={eventImpl:e.implName,event:e.exposeName},n=r[e.exposeName];n&&n.length&&(i.props=n.map(e=>{return{prop:e,evExposed:Ng2Utils.getChangeEventNameExposed(e),evImpl:Ng2Utils.getChangeEventNameImplemented(e)}}));t.push(i)}}for(let e in r)if(e.indexOf(".")>-1){let i={eventImpl:null,event:e,props:r[e].map(e=>{return{prop:e,evExposed:Ng2Utils.getChangeEventNameExposed(e),evImpl:Ng2Utils.getChangeEventNameImplemented(e)}})};t.push(i)}}}export class WjDirectiveBehavior{constructor(e,t,i,r){this._pendingEvents=[];this.isInitialized=!1;this.isDestroyed=!1;this.nzRun=e=>e();this.directive=e;this.elementRef=t;this.injector=i;this._overrideDirectiveMethods();let n=this.nz=i.get(NgZone);n&&(this.nzRun=n.run.bind(n));this.injectedParent=r;let s=this.typeData=e.constructor[WjDirectiveBehavior.directiveTypeDataProp];null==s.siblingId&&(s.siblingId=++WjDirectiveBehavior.siblingDirId+"");let o=e.constructor[WjDirectiveBehavior.directiveResolvedTypeDataProp];o?this.resolvedTypeData=o:e.constructor[WjDirectiveBehavior.directiveResolvedTypeDataProp]=o=this.resolvedTypeData=new WjComponentResolvedMetadata(s);e[WjDirectiveBehavior.BehaviourRefProp]=this;i[WjDirectiveBehavior.BehaviourRefProp]=this;e[WjDirectiveBehavior.isInitializedPropAttr]=!1;this._createEvents();this._setupAsChild();this._isHostElement()&&t.nativeElement.setAttribute(WjDirectiveBehavior.siblingDirIdAttr,s.siblingId);this.subscribeToEvents(!1);this.directive instanceof wijmo.Control&&(this.directive.workingAs="Angular2")}static getHostElement(e,t){WjDirectiveBehavior.ngZone=t.get(NgZone);return e.nativeElement}static attach(e,t,i,r){return new WjDirectiveBehavior(e,t,i,r)}static getZone(e){const t=WjDirectiveBehavior.getBehavior(e);return t&&t.nz||WjDirectiveBehavior.ngZone}ngOnInit(){this.isInitialized=!0;this._initParent();this.subscribeToEvents(!0)}ngAfterViewInit(){this.directive[WjDirectiveBehavior.isInitializedPropAttr]=!0;setTimeout(()=>{this.isDestroyed||this.directive[WjDirectiveBehavior.initializedEventAttr].emit(void 0)})}ngOnDestroy(){if(!this.isDestroyed){this.isDestroyed=!0;var e=this.directive;this._siblingInsertedMO&&this._siblingInsertedMO.disconnect();if(this._isChild()&&this.parentBehavior){let i=this.parentBehavior.directive,r=this._getParentProp();if(!this.parentBehavior.isDestroyed&&i&&r&&e){let n=i[r];if(wijmo.isArray(n)&&n){var t=n.indexOf(e);t>=0&&n.splice(t,1)}}}if(e instanceof wijmo.Control&&e.hostElement){let t=this.elementRef.nativeElement,i=t&&t.parentNode,r=i?Array.prototype.indexOf.call(i.childNodes,t):-1;e.dispose();if(r>-1&&Array.prototype.indexOf.call(i.childNodes,t)<0){t.textContent="";r<i.childNodes.length&&i.replaceChild(t,i.childNodes[r])}}this.injector[WjDirectiveBehavior.BehaviourRefProp]=null}}static instantiateTemplate(e,t,i,r=!1,n={}){var s,o=t.createEmbeddedView(i,n,t.length),a=o.rootNodes;if(r&&1===a.length)s=a[0];else{s=document.createElement("div");for(let e of a)s.appendChild(e)}e&&e.appendChild(s);return{viewRef:o,rootElement:s}}getPropChangeEvent(e){let t=this.typeData.changeEvents;if(t)for(let i in t)if(t[i].indexOf(e)>-1)return i;return null}_createEvents(){let e=this.resolvedTypeData.allImplEvents;for(let t of e)this.directive[t]=new EventEmitter(!1)}_overrideDirectiveMethods(){const e=this.directive;if(e instanceof wijmo.Control){const t=e._resizeObserverCallback.bind(e);e._resizeObserverCallback=function(e){NgZone.isInAngularZone()?t(e):WjDirectiveBehavior.getZone(this).run(()=>{t(e)})}.bind(e)}}subscribeToEvents(e){var t=this.resolvedTypeData.changeEventMap;e=!!e;for(let i of t)e!==i.event.indexOf(".")<0&&this.addHandlers(i);if(e)for(let e of t)this.triggerPropChangeEvents(e,!0)}addHandlers(e){let t=this.directive;WjDirectiveBehavior.evaluatePath(t,e.event).addHandler((i,r)=>{this.nzRun(()=>{this.isInitialized&&this.triggerPropChangeEvents(e);e.eventImpl&&this._triggerEvent(t[e.eventImpl],r,e.props&&e.props.length>0)})})}triggerPropChangeEvents(e,t=!0){let i=this.directive;if(e.props&&e.props.length)for(let r of e.props)this._triggerEvent(i[r.evImpl],i[r.prop],t)}_setupAsChild(){if(this._isChild()){this._isHostElement()&&(this.elementRef.nativeElement.style.display="none");this.parentBehavior=WjDirectiveBehavior.getBehavior(this.injectedParent)}}_isAsyncBinding(){let e=this.directive[WjDirectiveBehavior.asyncBindingUpdatePropAttr];return null==e?WjOptions.asyncBindings:e}_isChild(){return this._isParentInitializer()||this._isParentReferencer()}_isParentInitializer(){return null!=this.directive[WjDirectiveBehavior.parPropAttr]}_isParentReferencer(){return!!this.typeData.parentRefProperty}_getParentProp(){return this.directive[WjDirectiveBehavior.parPropAttr]}_getParentReferenceProperty(){return this.typeData.parentRefProperty}_useParentObj(){return!1}_parentInCtor(){return this._isParentReferencer()&&""==this._getParentReferenceProperty()}_initParent(){if(this.parentBehavior&&!this._useParentObj()){var e=this.parentBehavior.directive,t=this._getParentProp(),i=this.directive;if(this._isParentInitializer()){this._getParentProp();let r=e[t];if(wijmo.isArray(r)){let e=this._isHostElement(),t=e?this._getSiblingIndex():-1;(t<0||t>=r.length)&&(t=r.length);r.splice(t,0,i);if(e){const e=this.elementRef.nativeElement;this._siblingInsertedMO=new MutationObserver(this._siblingInserted.bind(this));this._siblingInsertedMO.observe(e,{childList:!0})}}else e[t]=i}this._isParentReferencer()&&!this._parentInCtor()&&(i[this._getParentReferenceProperty()]=e)}}_getSiblingIndex(){var e=this.elementRef.nativeElement,t=e.parentElement;if(!t)return-1;for(var i=t.childNodes,r=-1,n=this.typeData.siblingId,s=0;s<i.length;s++){var o=i[s];if(1==o.nodeType&&o.getAttribute(WjDirectiveBehavior.siblingDirIdAttr)==n){++r;if(o===e)return r}}return-1}_siblingInserted(e){for(let t of e)if("childList"===t.type&&t.addedNodes.length>0){if(Array.from(t.addedNodes).some(e=>e===this.elementRef.nativeElement)){const e=this._getSiblingIndex(),t=this.parentBehavior.directive[this._getParentProp()],i=this.directive,r=t.indexOf(i);if(e>=0&&r>=0&&e!==r){t.splice(r,1);const n=Math.min(e,t.length);t.splice(n,0,i)}}}}_isHostElement(){return this.elementRef.nativeElement.nodeType===Node.ELEMENT_NODE}_triggerEvent(e,t,i){if(i&&this._isAsyncBinding()){let i={event:e,args:t};this._pendingEvents.push(i);null==this._pendingEventsTO&&(this._pendingEventsTO=setTimeout(()=>{this._triggerPendingEvents(!1)},0))}else e.emit(t)}_triggerPendingEvents(e){if(null!=this._pendingEventsTO){clearTimeout(this._pendingEventsTO);this._pendingEventsTO=null}if(this.isDestroyed)return;let t=[].concat(this._pendingEvents);this._pendingEvents.splice(0,this._pendingEvents.length);for(let e of t)e.event.emit(e.args);e&&this._pendingEvents.length&&this._triggerPendingEvents(!0)}flushPendingEvents(){this._triggerPendingEvents(!0)}static evaluatePath(e,t){this._pathBinding.path=t;return this._pathBinding.getValue(e)}static getBehavior(e){return e?e[WjDirectiveBehavior.BehaviourRefProp]:null}}WjDirectiveBehavior.directiveTypeDataProp="meta";WjDirectiveBehavior.directiveResolvedTypeDataProp="_wjResolvedMeta";WjDirectiveBehavior.BehaviourRefProp="_wjBehaviour";WjDirectiveBehavior.parPropAttr="wjProperty";WjDirectiveBehavior.wjModelPropAttr="wjModelProperty";WjDirectiveBehavior.initializedEventAttr="initialized";WjDirectiveBehavior.isInitializedPropAttr="isInitialized";WjDirectiveBehavior.siblingDirIdAttr="wj-directive-id";WjDirectiveBehavior.asyncBindingUpdatePropAttr="asyncBindings";WjDirectiveBehavior.siblingDirId=0;WjDirectiveBehavior.wijmoComponentProviderId="WjComponent";WjDirectiveBehavior.outsideZoneEvents={pointermove:!0,pointerover:!0,mousemove:!0,wheel:!0,touchmove:!0,pointerenter:!0,pointerleave:!0,pointerout:!0,mouseover:!0,mouseenter:!0,mouseleave:!0,mouseout:!0};WjDirectiveBehavior._pathBinding=new wijmo.Binding("");export class Ng2Utils{static initEvents(e,t){var i=[];for(let e of t){let t=e.props;e.event&&e.eventImpl&&i.push(e.eventImpl+":"+e.event);if(t&&t.length)for(let e of t)i.push(e.evImpl+":"+e.evExposed)}return i}static getChangeEventNameImplemented(e){return Ng2Utils.getChangeEventNameExposed(e)+Ng2Utils.changeEventImplementSuffix}static getChangeEventNameExposed(e){return e+"Change"}static getWjEventNameImplemented(e){return e+Ng2Utils.wjEventImplementSuffix}static getWjEventName(e){if(e){const t=Ng2Utils.wjEventImplementSuffix;let i=e.length-t.length;if(i>0&&e.substr(i)===t)return e.substr(0,i)}return null}static getBaseType(e){let t;return e&&(t=Object.getPrototypeOf(e.prototype))&&t.constructor}static getAnnotations(e){return Reflect.getMetadata("annotations",e)}static getAnnotation(e,t){if(t&&e)for(let i of e)if(i instanceof t)return i;return null}static getTypeAnnotation(e,t,i){for(let r=e;r;r=i?null:Ng2Utils.getBaseType(r)){let e=Ng2Utils.getAnnotation(Ng2Utils.getAnnotations(r),t);if(e)return e}return null}static equals(e,t){return e!=e&&t!=t||wijmo.DateTime.equals(e,t)||e===t}static _copy(e,t,i,r,n){if(e&&t)for(let s in t)if(r||"_"!==s[0]){let r=t[s];if(!n||n(s,r)){let t=e[s];wijmo.isArray(r)?e[s]=(!wijmo.isArray(t)||i?[]:t).concat(r):void 0!==r&&(e[s]=r)}}}}Ng2Utils.changeEventImplementSuffix="PC";Ng2Utils.wjEventImplementSuffix="Ng";export class WjValueAccessor{constructor(e){this._writeQnt=0;this._isSubscribed=!1;this._dirUpdateQnt=0;this._onChange=e=>{};this._onTouched=()=>{};this._directive=e;this._behavior=WjDirectiveBehavior.getBehavior(e)}writeValue(e){this._modelValue=e;++this._writeQnt;if(this._directive.isInitialized){this._ensureInitEhUnsubscribed();this._updateDirective()}else if(!this._dirInitEh){let e=this._directive.initialized;this._dirInitEh=e.subscribe(()=>{this._updateDirective();this._ensureInitEhUnsubscribed()})}}registerOnChange(e){this._onChange=e}registerOnTouched(e){this._onTouched=e}setDisabledState(e){let t=this._directive;t instanceof wijmo.Control&&(t.isDisabled=e)}_updateDirective(){if(!this._isFirstChange()||null!=this._modelValue){this._ensureNgModelProp();if(this._directive&&this._ngModelProp){let e=this._modelValue;""===e&&(e=null);this._dirUpdateQnt++;try{this._directive[this._ngModelProp]=e}finally{this._dirUpdateQnt--}}this._ensureSubscribed()}}_ensureSubscribed(){if(this._isSubscribed)return;let e=this._directive;if(e){this._ensureNgModelProp();let t=this._ngModelProp=e[WjDirectiveBehavior.wjModelPropAttr];if(t){let i=this._behavior.getPropChangeEvent(t);i&&e[i].addHandler(this._dirValChgEh,this)}e instanceof wijmo.Control&&e.lostFocus.addHandler(this._dirLostFocusEh,this);this._isSubscribed=!0}}_ensureNgModelProp(){!this._ngModelProp&&this._directive&&(this._ngModelProp=this._directive[WjDirectiveBehavior.wjModelPropAttr])}_ensureInitEhUnsubscribed(){if(this._dirInitEh){this._dirInitEh.unsubscribe();this._dirInitEh=null}}_isFirstChange(){return this._writeQnt<2}_dirValChgEh(e,t){if(this._onChange&&this._directive&&this._ngModelProp){let e=this._directive[this._ngModelProp],t=this._modelValue;""===t&&(t=null);if(!(this._dirUpdateQnt>0&&_isNullOrEmpty(t)&&_isNullOrEmpty(e)||Ng2Utils.equals(t,e))||wijmo.isArray(e)){this._modelValue=e;this._onChange(e)}}}_dirLostFocusEh(e,t){this._onTouched&&this._onTouched()}}export function WjValueAccessorFactory(e){return new WjValueAccessor(e)}function _isNullOrEmpty(e){return null==e||""===e}
|
|
14
|
+
import{EventEmitter,NgZone}from"@angular/core";import*as wijmo from"@mescius/wijmo";export class WjOptions{}WjOptions.asyncBindings=!0;export class WjComponentResolvedMetadata{constructor(e){this.changeEventMap=[];this.allImplEvents=[];this.resolveChangeEventMap(e)}resolveChangeEventMap(e){let t=this.changeEventMap,i=e.outputs,r=e.changeEvents||{};t.splice(0,t.length);this.allImplEvents=[];if(!i||!i.length)return;let n=i.map(e=>e.split(":")).map(e=>({implName:e[0].trim(),exposeName:e[1]&&e[1].trim()}));this.allImplEvents=n.map(e=>e.implName);let s=n.filter(e=>e.implName&&e.exposeName);for(let e of s){if(Ng2Utils.getWjEventName(e.implName)){let i={eventImpl:e.implName,event:e.exposeName},n=r[e.exposeName];n&&n.length&&(i.props=n.map(e=>({prop:e,evExposed:Ng2Utils.getChangeEventNameExposed(e),evImpl:Ng2Utils.getChangeEventNameImplemented(e)})));t.push(i)}}for(let e in r)if(e.indexOf(".")>-1){let i={eventImpl:null,event:e,props:r[e].map(e=>({prop:e,evExposed:Ng2Utils.getChangeEventNameExposed(e),evImpl:Ng2Utils.getChangeEventNameImplemented(e)}))};t.push(i)}}}export class WjDirectiveBehavior{constructor(e,t,i,r){this._pendingEvents=[];this.isInitialized=!1;this.isDestroyed=!1;this.nzRun=e=>e();this.directive=e;this.elementRef=t;this.injector=i;this._overrideDirectiveMethods();let n=this.nz=i.get(NgZone);n&&(this.nzRun=n.run.bind(n));this.injectedParent=r;let s=this.typeData=e.constructor[WjDirectiveBehavior.directiveTypeDataProp];null==s.siblingId&&(s.siblingId=++WjDirectiveBehavior.siblingDirId+"");let o=e.constructor[WjDirectiveBehavior.directiveResolvedTypeDataProp];o?this.resolvedTypeData=o:e.constructor[WjDirectiveBehavior.directiveResolvedTypeDataProp]=o=this.resolvedTypeData=new WjComponentResolvedMetadata(s);e[WjDirectiveBehavior.BehaviourRefProp]=this;i[WjDirectiveBehavior.BehaviourRefProp]=this;e[WjDirectiveBehavior.isInitializedPropAttr]=!1;this._createEvents();this._setupAsChild();this._isHostElement()&&t.nativeElement.setAttribute(WjDirectiveBehavior.siblingDirIdAttr,s.siblingId);this.subscribeToEvents(!1);this.directive instanceof wijmo.Control&&(this.directive.workingAs="Angular2")}static getHostElement(e,t){WjDirectiveBehavior.ngZone=t.get(NgZone);return e.nativeElement}static attach(e,t,i,r){return new WjDirectiveBehavior(e,t,i,r)}static getZone(e){const t=WjDirectiveBehavior.getBehavior(e);return t&&t.nz||WjDirectiveBehavior.ngZone}ngOnInit(){this.isInitialized=!0;this._initParent();this.subscribeToEvents(!0)}ngAfterViewInit(){this.directive[WjDirectiveBehavior.isInitializedPropAttr]=!0;setTimeout(()=>{this.isDestroyed||this.directive[WjDirectiveBehavior.initializedEventAttr].emit(void 0)})}ngOnDestroy(){if(!this.isDestroyed){this.isDestroyed=!0;var e=this.directive;this._siblingInsertedMO&&this._siblingInsertedMO.disconnect();if(this._isChild()&&this.parentBehavior){let i=this.parentBehavior.directive,r=this._getParentProp();if(!this.parentBehavior.isDestroyed&&i&&r&&e){let n=i[r];if(wijmo.isArray(n)&&n){var t=n.indexOf(e);t>=0&&n.splice(t,1)}}}if(e instanceof wijmo.Control&&e.hostElement){let t=this.elementRef.nativeElement,i=t&&t.parentNode,r=i?Array.prototype.indexOf.call(i.childNodes,t):-1;e.dispose();if(r>-1&&Array.prototype.indexOf.call(i.childNodes,t)<0){t.textContent="";r<i.childNodes.length&&i.replaceChild(t,i.childNodes[r])}}this.injector[WjDirectiveBehavior.BehaviourRefProp]=null}}static instantiateTemplate(e,t,i,r=!1,n={}){var s,o=t.createEmbeddedView(i,n,t.length),a=o.rootNodes;if(r&&1===a.length)s=a[0];else{s=document.createElement("div");for(let e of a)s.appendChild(e)}e&&e.appendChild(s);return{viewRef:o,rootElement:s}}getPropChangeEvent(e){let t=this.typeData.changeEvents;if(t)for(let i in t)if(t[i].indexOf(e)>-1)return i;return null}_createEvents(){let e=this.resolvedTypeData.allImplEvents;for(let t of e)this.directive[t]=new EventEmitter(!1)}_overrideDirectiveMethods(){const e=this.directive;if(e instanceof wijmo.Control){const t=e._resizeObserverCallback.bind(e);e._resizeObserverCallback=function(e){NgZone.isInAngularZone()?t(e):WjDirectiveBehavior.getZone(this).run(()=>{t(e)})}.bind(e)}}subscribeToEvents(e){var t=this.resolvedTypeData.changeEventMap;e=!!e;for(let i of t)e!==i.event.indexOf(".")<0&&this.addHandlers(i);if(e)for(let e of t)this.triggerPropChangeEvents(e,!0)}addHandlers(e){let t=this.directive;WjDirectiveBehavior.evaluatePath(t,e.event).addHandler((i,r)=>{this.nzRun(()=>{this.isInitialized&&this.triggerPropChangeEvents(e);e.eventImpl&&this._triggerEvent(t[e.eventImpl],r,e.props&&e.props.length>0)})})}triggerPropChangeEvents(e,t=!0){let i=this.directive;if(e.props&&e.props.length)for(let r of e.props)this._triggerEvent(i[r.evImpl],i[r.prop],t)}_setupAsChild(){if(this._isChild()){this._isHostElement()&&(this.elementRef.nativeElement.style.display="none");this.parentBehavior=WjDirectiveBehavior.getBehavior(this.injectedParent)}}_isAsyncBinding(){let e=this.directive[WjDirectiveBehavior.asyncBindingUpdatePropAttr];return null==e?WjOptions.asyncBindings:e}_isChild(){return this._isParentInitializer()||this._isParentReferencer()}_isParentInitializer(){return null!=this.directive[WjDirectiveBehavior.parPropAttr]}_isParentReferencer(){return!!this.typeData.parentRefProperty}_getParentProp(){return this.directive[WjDirectiveBehavior.parPropAttr]}_getParentReferenceProperty(){return this.typeData.parentRefProperty}_useParentObj(){return!1}_parentInCtor(){return this._isParentReferencer()&&""==this._getParentReferenceProperty()}_initParent(){if(this.parentBehavior&&!this._useParentObj()){var e=this.parentBehavior.directive,t=this._getParentProp(),i=this.directive;if(this._isParentInitializer()){this._getParentProp();let r=e[t];if(wijmo.isArray(r)){let e=this._isHostElement(),t=e?this._getSiblingIndex():-1;(t<0||t>=r.length)&&(t=r.length);r.splice(t,0,i);if(e){const e=this.elementRef.nativeElement;this._siblingInsertedMO=new MutationObserver(this._siblingInserted.bind(this));this._siblingInsertedMO.observe(e,{childList:!0})}}else e[t]=i}this._isParentReferencer()&&!this._parentInCtor()&&(i[this._getParentReferenceProperty()]=e)}}_getSiblingIndex(){var e=this.elementRef.nativeElement,t=e.parentElement;if(!t)return-1;for(var i=t.childNodes,r=-1,n=this.typeData.siblingId,s=0;s<i.length;s++){var o=i[s];if(1==o.nodeType&&o.getAttribute(WjDirectiveBehavior.siblingDirIdAttr)==n){++r;if(o===e)return r}}return-1}_siblingInserted(e){for(let t of e)if("childList"===t.type&&t.addedNodes.length>0){if(Array.from(t.addedNodes).some(e=>e===this.elementRef.nativeElement)){const e=this._getSiblingIndex(),t=this.parentBehavior.directive[this._getParentProp()],i=this.directive,r=t.indexOf(i);if(e>=0&&r>=0&&e!==r){t.splice(r,1);const n=Math.min(e,t.length);t.splice(n,0,i)}}}}_isHostElement(){return this.elementRef.nativeElement.nodeType===Node.ELEMENT_NODE}_triggerEvent(e,t,i){if(i&&this._isAsyncBinding()){let i={event:e,args:t};this._pendingEvents.push(i);null==this._pendingEventsTO&&(this._pendingEventsTO=setTimeout(()=>{this._triggerPendingEvents(!1)},0))}else e.emit(t)}_triggerPendingEvents(e){if(null!=this._pendingEventsTO){clearTimeout(this._pendingEventsTO);this._pendingEventsTO=null}if(this.isDestroyed)return;let t=[].concat(this._pendingEvents);this._pendingEvents.splice(0,this._pendingEvents.length);for(let e of t)e.event.emit(e.args);e&&this._pendingEvents.length&&this._triggerPendingEvents(!0)}flushPendingEvents(){this._triggerPendingEvents(!0)}static evaluatePath(e,t){this._pathBinding.path=t;return this._pathBinding.getValue(e)}static getBehavior(e){return e?e[WjDirectiveBehavior.BehaviourRefProp]:null}}WjDirectiveBehavior.directiveTypeDataProp="meta";WjDirectiveBehavior.directiveResolvedTypeDataProp="_wjResolvedMeta";WjDirectiveBehavior.BehaviourRefProp="_wjBehaviour";WjDirectiveBehavior.parPropAttr="wjProperty";WjDirectiveBehavior.wjModelPropAttr="wjModelProperty";WjDirectiveBehavior.initializedEventAttr="initialized";WjDirectiveBehavior.isInitializedPropAttr="isInitialized";WjDirectiveBehavior.siblingDirIdAttr="wj-directive-id";WjDirectiveBehavior.asyncBindingUpdatePropAttr="asyncBindings";WjDirectiveBehavior.siblingDirId=0;WjDirectiveBehavior.wijmoComponentProviderId="WjComponent";WjDirectiveBehavior.outsideZoneEvents={pointermove:!0,pointerover:!0,mousemove:!0,wheel:!0,touchmove:!0,pointerenter:!0,pointerleave:!0,pointerout:!0,mouseover:!0,mouseenter:!0,mouseleave:!0,mouseout:!0};WjDirectiveBehavior._pathBinding=new wijmo.Binding("");export class Ng2Utils{static initEvents(e,t){var i=[];for(let e of t){let t=e.props;e.event&&e.eventImpl&&i.push(e.eventImpl+":"+e.event);if(t&&t.length)for(let e of t)i.push(e.evImpl+":"+e.evExposed)}return i}static getChangeEventNameImplemented(e){return Ng2Utils.getChangeEventNameExposed(e)+Ng2Utils.changeEventImplementSuffix}static getChangeEventNameExposed(e){return e+"Change"}static getWjEventNameImplemented(e){return e+Ng2Utils.wjEventImplementSuffix}static getWjEventName(e){if(e){const t=Ng2Utils.wjEventImplementSuffix;let i=e.length-t.length;if(i>0&&e.substr(i)===t)return e.substr(0,i)}return null}static getBaseType(e){let t;return e&&(t=Object.getPrototypeOf(e.prototype))&&t.constructor}static getAnnotations(e){return Reflect.getMetadata("annotations",e)}static getAnnotation(e,t){if(t&&e)for(let i of e)if(i instanceof t)return i;return null}static getTypeAnnotation(e,t,i){for(let r=e;r;r=i?null:Ng2Utils.getBaseType(r)){let e=Ng2Utils.getAnnotation(Ng2Utils.getAnnotations(r),t);if(e)return e}return null}static equals(e,t){return e!=e&&t!=t||wijmo.DateTime.equals(e,t)||e===t}static _copy(e,t,i,r,n){if(e&&t)for(let s in t)if(r||"_"!==s[0]){let r=t[s];if(!n||n(s,r)){let t=e[s];wijmo.isArray(r)?e[s]=(!wijmo.isArray(t)||i?[]:t).concat(r):void 0!==r&&(e[s]=r)}}}}Ng2Utils.changeEventImplementSuffix="PC";Ng2Utils.wjEventImplementSuffix="Ng";export class WjValueAccessor{constructor(e){this._writeQnt=0;this._isSubscribed=!1;this._dirUpdateQnt=0;this._onChange=e=>{};this._onTouched=()=>{};this._directive=e;this._behavior=WjDirectiveBehavior.getBehavior(e)}writeValue(e){this._modelValue=e;++this._writeQnt;if(this._directive.isInitialized){this._ensureInitEhUnsubscribed();this._updateDirective()}else if(!this._dirInitEh){let e=this._directive.initialized;this._dirInitEh=e.subscribe(()=>{this._updateDirective();this._ensureInitEhUnsubscribed()})}}registerOnChange(e){this._onChange=e}registerOnTouched(e){this._onTouched=e}setDisabledState(e){let t=this._directive;t instanceof wijmo.Control&&(t.isDisabled=e)}_updateDirective(){if(!this._isFirstChange()||null!=this._modelValue){this._ensureNgModelProp();if(this._directive&&this._ngModelProp){let e=this._modelValue;""===e&&(e=null);this._dirUpdateQnt++;try{this._directive[this._ngModelProp]=e}finally{this._dirUpdateQnt--}}this._ensureSubscribed()}}_ensureSubscribed(){if(this._isSubscribed)return;let e=this._directive;if(e){this._ensureNgModelProp();let t=this._ngModelProp=e[WjDirectiveBehavior.wjModelPropAttr];if(t){let i=this._behavior.getPropChangeEvent(t);i&&e[i].addHandler(this._dirValChgEh,this)}e instanceof wijmo.Control&&e.lostFocus.addHandler(this._dirLostFocusEh,this);this._isSubscribed=!0}}_ensureNgModelProp(){!this._ngModelProp&&this._directive&&(this._ngModelProp=this._directive[WjDirectiveBehavior.wjModelPropAttr])}_ensureInitEhUnsubscribed(){if(this._dirInitEh){this._dirInitEh.unsubscribe();this._dirInitEh=null}}_isFirstChange(){return this._writeQnt<2}_dirValChgEh(e,t){if(this._onChange&&this._directive&&this._ngModelProp){let e=this._directive[this._ngModelProp],t=this._modelValue;""===t&&(t=null);if(!(this._dirUpdateQnt>0&&_isNullOrEmpty(t)&&_isNullOrEmpty(e)||Ng2Utils.equals(t,e))||wijmo.isArray(e)){this._modelValue=e;this._onChange(e)}}}_dirLostFocusEh(e,t){this._onTouched&&this._onTouched()}}export function WjValueAccessorFactory(e){return new WjValueAccessor(e)}function _isNullOrEmpty(e){return null==e||""===e}
|
package/es5-esm.js
CHANGED
package/index.d.ts
CHANGED
package/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mescius/wijmo.angular2legacy.directivebase",
|
|
3
|
-
"version": "5.20252.43-nightly.
|
|
3
|
+
"version": "5.20252.43-nightly.d20251112.t011705",
|
|
4
4
|
"description": "UI library for pure JS, Angular, React, Vue and more...",
|
|
5
5
|
"author": "MESCIUS inc",
|
|
6
6
|
"license": "Commercial",
|
|
7
7
|
"main": "./index.js",
|
|
8
8
|
"types": "./index.d.ts",
|
|
9
9
|
"dependencies": {
|
|
10
|
-
"@mescius/wijmo": "5.20252.43-nightly.
|
|
10
|
+
"@mescius/wijmo": "5.20252.43-nightly.d20251112.t011705"
|
|
11
11
|
},
|
|
12
12
|
"homepage": "https://developer.mescius.com/wijmo",
|
|
13
13
|
"bugs": {
|