@oinone/kunlun-event 6.2.0
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/dist/oinone-kunlun-event.esm.js +15 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/src/bus/abstract/AbstractEventConsumer.d.ts +17 -0
- package/dist/types/src/bus/abstract/AbstractEventEngine.d.ts +21 -0
- package/dist/types/src/bus/abstract/AbstractEventProducer.d.ts +15 -0
- package/dist/types/src/bus/abstract/index.d.ts +2 -0
- package/dist/types/src/bus/bus/basic.d.ts +12 -0
- package/dist/types/src/bus/bus/html-event.d.ts +6 -0
- package/dist/types/src/bus/bus/html-keyboard-event.d.ts +6 -0
- package/dist/types/src/bus/bus/index.d.ts +18 -0
- package/dist/types/src/bus/hook/consumer.d.ts +1 -0
- package/dist/types/src/bus/hook/index.d.ts +2 -0
- package/dist/types/src/bus/hook/producer.d.ts +1 -0
- package/dist/types/src/bus/index.d.ts +5 -0
- package/dist/types/src/bus/operator/consumer.d.ts +11 -0
- package/dist/types/src/bus/operator/index.d.ts +2 -0
- package/dist/types/src/bus/operator/producer.d.ts +10 -0
- package/dist/types/src/bus/spi/consumer.d.ts +8 -0
- package/dist/types/src/bus/spi/index.d.ts +2 -0
- package/dist/types/src/bus/spi/producer.d.ts +8 -0
- package/dist/types/src/bus/typing/basic.d.ts +64 -0
- package/dist/types/src/bus/typing/category.d.ts +5 -0
- package/dist/types/src/bus/typing/index.d.ts +3 -0
- package/dist/types/src/bus/typing/keyboard.d.ts +16 -0
- package/dist/types/src/effects/effectbox.d.ts +3 -0
- package/dist/types/src/effects/fieldEffects.d.ts +61 -0
- package/dist/types/src/effects/index.d.ts +2 -0
- package/dist/types/src/effects/viewEffects.d.ts +69 -0
- package/dist/types/src/helper.d.ts +14 -0
- package/dist/types/src/html-event/basic/AbstractHTMLEventProducer.d.ts +7 -0
- package/dist/types/src/html-event/basic/HTMLEventConsumer.d.ts +4 -0
- package/dist/types/src/html-event/basic/HTMLEventProducer.d.ts +5 -0
- package/dist/types/src/html-event/basic/index.d.ts +3 -0
- package/dist/types/src/html-event/index.d.ts +2 -0
- package/dist/types/src/html-event/keyboard/HTMLKeyboardEventConsumer.d.ts +14 -0
- package/dist/types/src/html-event/keyboard/HTMLKeyboardEventProducer.d.ts +16 -0
- package/dist/types/src/html-event/keyboard/index.d.ts +2 -0
- package/dist/types/src/index.d.ts +6 -0
- package/dist/types/src/lifecycle/heart.d.ts +75 -0
- package/dist/types/src/lifecycle/index.d.ts +2 -0
- package/dist/types/src/lifecycle/lifecycle.d.ts +7 -0
- package/dist/types/src/typing/index.d.ts +1 -0
- package/dist/types/src/typing/lifecycle.d.ts +92 -0
- package/index.ts +1 -0
- package/package.json +19 -0
- package/rollup.config.js +4 -0
- package/src/bus/abstract/AbstractEventConsumer.ts +79 -0
- package/src/bus/abstract/AbstractEventEngine.ts +79 -0
- package/src/bus/abstract/AbstractEventProducer.ts +64 -0
- package/src/bus/abstract/index.ts +2 -0
- package/src/bus/bus/basic.ts +124 -0
- package/src/bus/bus/html-event.ts +43 -0
- package/src/bus/bus/html-keyboard-event.ts +46 -0
- package/src/bus/bus/index.ts +46 -0
- package/src/bus/hook/consumer.ts +1 -0
- package/src/bus/hook/index.ts +2 -0
- package/src/bus/hook/producer.ts +1 -0
- package/src/bus/index.ts +5 -0
- package/src/bus/operator/consumer.ts +83 -0
- package/src/bus/operator/index.ts +2 -0
- package/src/bus/operator/producer.ts +56 -0
- package/src/bus/spi/consumer.ts +34 -0
- package/src/bus/spi/index.ts +2 -0
- package/src/bus/spi/producer.ts +27 -0
- package/src/bus/typing/basic.ts +126 -0
- package/src/bus/typing/category.ts +6 -0
- package/src/bus/typing/index.ts +3 -0
- package/src/bus/typing/keyboard.ts +21 -0
- package/src/effects/effectbox.ts +22 -0
- package/src/effects/fieldEffects.ts +99 -0
- package/src/effects/index.ts +2 -0
- package/src/effects/viewEffects.ts +111 -0
- package/src/helper.ts +31 -0
- package/src/html-event/basic/AbstractHTMLEventProducer.ts +30 -0
- package/src/html-event/basic/HTMLEventConsumer.ts +26 -0
- package/src/html-event/basic/HTMLEventProducer.ts +10 -0
- package/src/html-event/basic/index.ts +3 -0
- package/src/html-event/index.ts +2 -0
- package/src/html-event/keyboard/HTMLKeyboardEventConsumer.ts +160 -0
- package/src/html-event/keyboard/HTMLKeyboardEventProducer.ts +72 -0
- package/src/html-event/keyboard/index.ts +2 -0
- package/src/index.ts +6 -0
- package/src/lifecycle/heart.ts +160 -0
- package/src/lifecycle/index.ts +2 -0
- package/src/lifecycle/lifecycle.ts +29 -0
- package/src/typing/index.ts +1 -0
- package/src/typing/lifecycle.ts +104 -0
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import{useCurrentInstance as e,useEnv as t}from"@oinone/kunlun-environment";import{instantiate as i,KeyboardEventHelper as r}from"@oinone/kunlun-shared";import{SPIOperator as s}from"@oinone/kunlun-spi";
|
|
2
|
+
/*! *****************************************************************************
|
|
3
|
+
Copyright (c) Microsoft Corporation.
|
|
4
|
+
|
|
5
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
6
|
+
purpose with or without fee is hereby granted.
|
|
7
|
+
|
|
8
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
9
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
10
|
+
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
11
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
12
|
+
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
13
|
+
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
14
|
+
PERFORMANCE OF THIS SOFTWARE.
|
|
15
|
+
***************************************************************************** */function n(e,t,i,r){return new(i||(i=Promise))((function(s,n){function o(e){try{a(r.next(e))}catch(e){n(e)}}function c(e){try{a(r.throw(e))}catch(e){n(e)}}function a(e){var t;e.done?s(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(o,c)}a((r=r.apply(e,t||[])).next())}))}const o=Symbol("__event_bus_consumer");function c(e,t){return s.register(o,e,t)}function a(e){return s.selector(o,e)}s.createStorage({key:o,matchKeys:["category","type"]});const u=Symbol("__event_bus_producer");function d(e,t){return s.register(u,e,t)}function l(e){return s.selector(u,e)}s.createStorage({key:u,matchKeys:["category","type"]});class _{static getConsumers(e){return _.consumers.get(_.generatorKeyByMessage(e))}static construct(t,r,s){var n;const o=a(t);if(!o)throw new Error(`Unsupported consumer. category: ${t.category}, type: ${t.type}`);const c=i(o,t.type,r,s);return c.el=null===(n=e().currentInstance)||void 0===n?void 0:n.vNode.el,c}static init(e){const t=_.generatorKeyByEngine(e);let i=_.consumers.get(t);i||(i=[],_.consumers.set(t,i)),i.push(e),e.start()}static dispose(e){const t=_.generatorKeyByEngine(e),i=e.key,r=_.consumers.get(t);if(!r)return!1;const s=r.findIndex((e=>e.key===i));if(-1===s)return!1;const n=r.splice(s,1);for(const e of n)e.dispose();return!0}static generatorKey(e,t){return`${e}#${t}`}static generatorKeyByEngine(e){return`${e.category}#${e.type}`}static generatorKeyByMessage(e){return`${e.category}#${e.type}`}}_.consumers=new Map;class E{static getProducer(e,t){return E.producers.get(E.generatorKey(e,t))}static construct(e,t){const r=l(e);if(!r)throw new Error(`Unsupported producer. category: ${e.category}, type: ${e.type}`);return i(r,e.type,t)}static init(e){const t=E.generatorKeyByEngine(e);E.dispose(t),E.producers.set(t,e),e.start()}static dispose(e){const t=E.producers.get(e);return t&&(E.producers.delete(e),t.isDisposed||t.dispose()),t}static generatorKey(e,t){return`${e}#${t}`}static generatorKeyByEngine(e){return`${e.category}#${e.type}`}}E.producers=new Map;class p{constructor(e,t){this._key=this.generatorKey(),this._category=e,this._type=t,this._isActivated=!1,this._isDisposed=!1}get key(){return this._key}get category(){return this._category}get type(){return this._type}get isActivated(){return this._isActivated}get isDisposed(){return this._isDisposed}start(){return!this.isActivated&&(this._isActivated=!0,this.$$start(),!0)}$$start(){}stop(){return!!this.isActivated&&(this._isActivated=!1,this.$$stop(),!0)}$$stop(){}dispose(){return!this.isDisposed&&(this.isActivated&&this.stop(),this._isDisposed=!0,this.$$dispose(),!0)}$$dispose(){}}let y=0;class h extends p{constructor(e,t,i){super(e,t),this._rawConvert=(null==i?void 0:i.convert)||this.$$convert,this._rawPublish=(null==i?void 0:i.publish)||this.$$publish}get rawConvert(){return this._rawConvert}get rawPublish(){return this._rawPublish}convert(e){return this.rawConvert(this,e)}publish(e){this.rawPublish(this,e)}$$publish(e,t){const i=this.convert(t);if(!i)return;const r=_.getConsumers(i);r&&r.length&&r.filter((e=>e.filter(t,i))).map((e=>n(this,void 0,void 0,(function*(){return e.consumer(i)}))))}generatorKey(){return"event_producer_"+y++}$$dispose(){E.dispose(E.generatorKeyByEngine(this))}}let f=0;class g extends p{constructor(e,t,i,r){super(e,t),this._config=(null==r?void 0:r.config)||{},this._rawFilter=(null==r?void 0:r.filter)||this.$$filter.bind(this),this._rawConsumer=i}get config(){return this._config}get rawFilter(){return this._rawFilter}get rawConsumer(){return this._rawConsumer}filter(e,t){return!!this.isActivated&&this.rawFilter(e,t)}$$filter(e,t){return!0}consumer(e){return this.rawConsumer(this,e)}generatorKey(){return"event_consumer_"+f++}$$dispose(){_.dispose(this)}}class I{static init(e,t){const{category:i,type:r}=e;let s=E.getProducer(i,r);return s||(s=E.construct({category:i,type:r},t),E.init(s)),s}static startProducer(e){const{category:t,type:i}=e,r=E.getProducer(t,i);return!!r&&r.start()}static stopProducer(e){const{category:t,type:i}=e,r=E.getProducer(t,i);return!!r&&r.stop()}static publish(e,t){const{category:i,type:r}=e,s=E.getProducer(i,r);if(!s)throw new Error("Invalid producer. please initialize the producer before publish.");s.publish(t)}static subscribe(e,t,i){const r=_.construct(e,t,i);return _.init(r),I.consumerMap.set(t,r),r}static unsubscribe(e){const t=I.consumerMap.get(e);return t&&(I.consumerMap.delete(e),_.dispose(t)),t}static startConsumer(e){const t=I.consumerMap.get(e);return!!t&&t.start()}static stopConsumer(e){const t=I.consumerMap.get(e);return!!t&&t.stop()}}var V,b;I.consumerMap=new Map,function(e){e.global="global",e.view="view",e.current="current"}(V||(V={})),function(e){e.html="html",e.keyboard="keyboard"}(b||(b={}));const w=["keypress","keyup","keydown"];class F{static init(e){return I.init({category:b.html,type:e})}static dispose(e){return E.dispose(`${b.html}#${e}`)}static subscribe(e,t,i,r=!0){return r&&F.init(e),I.subscribe({category:b.html,type:e},t,i)}}const O="global";class N{static init(){return I.init({category:b.keyboard,type:O})}static dispose(){return E.dispose(`${b.keyboard}#${O}`)}static subscribe(e,t,i,r=!0){return r&&N.init(),I.subscribe({category:b.keyboard,type:e},t,i)}}class D{}D.init=I.init,D.startProducer=I.startProducer,D.stopProducer=I.stopProducer,D.publish=I.publish,D.subscribe=I.subscribe,D.unsubscribe=I.unsubscribe,D.start=I.startConsumer,D.stop=I.stopConsumer,D.disposeProducer=E.dispose,D.disposeConsumer=_.dispose,D.subscribeHTMLEvent=F.subscribe,D.subscribeKeyboardEvent=N.subscribe;class m extends h{constructor(e,t,i){super(e,t,i)}$$convert(e,t){return{category:this.category,type:this.type,origin:t}}$$start(){document.addEventListener(this.type,this.publish.bind(this))}$$stop(){document.removeEventListener(this.type,this.publish.bind(this))}}class T extends g{constructor(e,t,i){super(b.html,e,t,i)}}c({category:b.html},T);class A extends m{constructor(e,t){super(b.html,e,t)}}d({category:b.html},A);class v extends g{constructor(e,t,i,r){super(e,t,i,r),this.initConfig()}initConfig(){const{config:e}=this;null==e.scope&&(e.scope=V.view),void 0===e.ctrl&&(e.ctrl=!1),void 0===e.shift&&(e.shift=!1),void 0===e.alt&&(e.alt=!1)}$$filter(e,i){const{scope:r,ctrl:s,alt:n,shift:o}=this.config;let c=!1;switch(r){case V.global:case V.current:c=!0;break;case V.view:{const{el:e}=this;if(!e)break;const{x:i,y:r}=e.getBoundingClientRect(),s=t().clickVisibleArea[0];if(s){const{el:t,x:n,y:o,ex:a,ey:u}=s;if(t)t.contains(e)&&(c=!0);else if(n<=i&&i<=a&&o<=r&&r<=u){c=!0;break}}break}}return!!c&&((null==s||s===i.ctrl)&&((null==o||o===i.shift)&&(null==n||n===i.alt)))}}class C extends v{constructor(e,t,i){super(b.html,e,t,i)}}class S extends v{constructor(e,t,i){super(b.keyboard,e,t,i)}}c({category:b.html,type:w},C),c({category:b.keyboard},S);class U extends m{$$convert(e,t){const i=r.newInstance(t);if(!i.isStateKey())return{category:this.category,type:this.type,origin:t,code:t.code,key:t.key,ctrl:i.isPressCtrl(),alt:i.isPressAlt(),shift:i.isPressShift()}}}class L extends U{constructor(e,t){super(b.html,e,t)}}class $ extends U{constructor(e,t){super(b.keyboard,e,t)}$$convert(e,t){const i=super.$$convert(e,t);return i&&(i.type=t.key),i}onKeydown(e){this.publish(e)}$$start(){document.addEventListener("keydown",this.onKeydown.bind(this))}$$stop(){document.removeEventListener("keydown",this.onKeydown.bind(this))}}var B,M,W,k;d({category:b.html,type:w},L),d({category:b.keyboard},$),function(e){e.FIELD="Field",e.VIEW="View",e.ACTION="Action"}(B||(B={})),function(e){e.ON_VIEW_BEFORE_CREATED="onViewBeforeCreated",e.ON_VIEW_CREATED="onViewCreated",e.ON_VIEW_BEFORE_MOUNT="onViewBeforeMount",e.ON_VIEW_MOUNTED="onViewMounted",e.ON_VIEW_BEFORE_UPDATE="onViewBeforeUpdate",e.ON_VIEW_UPDATED="onViewUpdated",e.ON_VIEW_ACTIVATED="onViewActivated",e.ON_VIEW_BEFORE_UNMOUNT="onViewBeforeUnmount",e.ON_VIEW_UNMOUNTED="onViewUnmounted",e.ON_VIEW_SUBMIT="onViewSubmit",e.ON_VIEW_SUBMIT_START="onViewSubmitStart",e.ON_VIEW_SUBMIT_END="onViewSubmitEnd",e.ON_VIEW_SUBMIT_SUCCESS="onViewSubmitSuccess",e.ON_VIEW_SUBMIT_FAILED="onViewSubmitFailed",e.ON_VIEW_VALIDATE_START="onViewValidateStart",e.ON_VIEW_VALIDATE_SUCCESS="onViewValidateSuccess",e.ON_VIEW_VALIDATE_FAILED="onViewValidateFailed",e.ON_VIEW_VALIDATE_END="onViewValidateEnd",e.ON_FIELD_BEFORE_CREATED="onFieldBeforeCreated",e.ON_FIELD_CREATED="onFieldCreated",e.ON_FIELD_BEFORE_MOUNT="onFieldBeforeMount",e.ON_FIELD_MOUNTED="onFieldMounted",e.ON_FIELD_BEFORE_UPDATE="onFieldBeforeUpdate",e.ON_FIELD_UPDATED="onFieldUpdated",e.ON_FIELD_ACTIVATED="onFieldActivated",e.ON_FIELD_BEFORE_UNMOUNT="onFieldBeforeUnmount",e.ON_FIELD_UNMOUNTED="onFieldUnmounted",e.ON_FIELD_FOCUS="onFieldFocus",e.ON_FIELD_CHANGE="onFieldChange",e.ON_FIELD_BLUR="onFieldBlur",e.ON_FIELD_VALIDATE_START="onFieldValidateStart",e.ON_FIELD_VALIDATE_SUCCESS="onFieldValidateSuccess",e.ON_FIELD_VALIDATE_FAILED="onFieldValidateFailed",e.ON_FIELD_VALIDATE_END="onFieldValidateEnd"}(M||(M={})),function(e){e.viewBeforeCreated="onViewBeforeCreated",e.viewCreated="onViewCreated",e.viewBeforeMount="onViewBeforeMount",e.viewMounted="onViewMounted",e.viewBeforeUpdate="onViewBeforeUpdate",e.viewUpdated="onViewUpdated",e.viewActivated="onViewActivated",e.viewBeforeUnmount="onViewBeforeUnmount",e.viewUnmounted="onViewUnmounted",e.viewSubmit="onViewSubmit",e.viewSubmitStart="onViewSubmitStart",e.viewSubmitEnd="onViewSubmitEnd",e.viewSubmitSuccess="onViewSubmitSuccess",e.viewSubmitFailed="onViewSubmitFailed",e.viewValidateStart="onViewValidateStart",e.viewValidateSuccess="onViewValidateSuccess",e.viewValidateFailed="onViewValidateFailed",e.viewValidateEnd="onViewValidateEnd"}(W||(W={})),function(e){e.beforeCreated="onFieldBeforeCreated",e.created="onFieldCreated",e.beforeMount="onFieldBeforeMount",e.mount="onFieldMounted",e.beforeUpdate="onFieldBeforeUpdate",e.updated="onViewUpdated",e.beforeUnmount="onFieldBeforeUnmount",e.unmounted="onFieldUnmounted",e.focus="onFieldFocus",e.change="onFieldChange",e.blur="onFieldBlur",e.validateStart="onFieldValidateStart",e.validateSuccess="onFieldValidateSuccess",e.validateFailed="onFieldValidateFailed",e.validateEnd="onFieldValidateEnd"}(k||(k={}));const R=e=>t=>P(t)===`[object ${e}]`,P=e=>Object.prototype.toString.call(e),x=e=>"function"==typeof e,K=Array.isArray,j=R("Object"),H=R("String"),z=R("Boolean"),G=R("Number"),q=e=>e&&e instanceof Map,J=e=>e&&e instanceof Set,Q=e=>e&&e instanceof WeakMap,X=e=>e&&e instanceof WeakSet,Y=e=>G(e)||/^\d+$/.test(e),Z=e=>"object"==typeof e,ee=R("RegExp");class te{constructor(e){if(!x(e))throw new Error("life cycle callback must be function");this.listener=this.buildListener(e)}buildListener(e){return t=>{x(e)&&e(t)}}notify(e){this.listener.call(e,e)}}class ie{static initialize(e){this.lifeCycles=e}static getLifeCycleIndex(e){return this.lifeCycles.findIndex((t=>t.type===e))}static getLifeCycle(){return this.lifeCycles}static getLifeCycleByType(e){const t=this.getLifeCycleIndex(e);return t>=0?this.lifeCycles[t]:null}static setType(e){this.heartType=e}static setLifeCycle(e,t,i){if(!(H(e)&&H(t)&&i instanceof te))return!1;if(!this.heartType)throw new Error('set fail, use "LifeCycleHeart.setType(type)" first, then call "setLifeCycle"');const r=this.getLifeCycleIndex(e);r>=0?t&&this.lifeCycles[r].pattern.push({identifier:t,lifes:[i]}):this.lifeCycles.push({type:e,registryType:this.heartType,pattern:[{identifier:t,lifes:[i]}]}),this.heartType=null}static publish(e,t,i){if(!e||!t||!i)return!1;const r=this.getLifeCycleIndex(e);if(r>=0&&t){const e=this.lifeCycles[r].pattern.find((e=>e.identifier===t));e&&e.lifes.forEach((e=>{e.notify(i)}))}}static disposeLifeCycle(e){}static dispose(e){this.lifeCycles.forEach((t=>{const i=t.pattern.findIndex((t=>t.identifier===e));i>=0&&t.pattern.splice(i,1)}))}}function re(e,t){return(i,r)=>{if(!H(i))throw new Error("arg[0] must be string, but now is "+typeof i);if(r){if(!x(r))throw new Error("arg[1] must be function");ie.setType(t),ie.setLifeCycle(e,i,new te(r))}}}function se(e){return re(e,B.FIELD)}ie.lifeCycles=[],ie.heartType=null;const ne=se(M.ON_FIELD_BEFORE_CREATED),oe=se(M.ON_FIELD_CREATED),ce=se(M.ON_FIELD_BEFORE_MOUNT),ae=se(M.ON_FIELD_MOUNTED),ue=se(M.ON_FIELD_BEFORE_UPDATE),de=se(M.ON_FIELD_UPDATED),le=se(M.ON_FIELD_BEFORE_UNMOUNT),_e=se(M.ON_FIELD_UNMOUNTED),Ee=se(M.ON_FIELD_VALIDATE_START),pe=se(M.ON_FIELD_VALIDATE_SUCCESS),ye=se(M.ON_FIELD_VALIDATE_FAILED),he=se(M.ON_FIELD_VALIDATE_END),fe=se(M.ON_FIELD_FOCUS),ge=se(M.ON_FIELD_CHANGE),Ie=se(M.ON_FIELD_BLUR);function Ve(e){return re(e,B.VIEW)}const be=Ve(M.ON_VIEW_BEFORE_CREATED),we=Ve(M.ON_VIEW_CREATED),Fe=Ve(M.ON_VIEW_BEFORE_MOUNT),Oe=Ve(M.ON_VIEW_MOUNTED),Ne=Ve(M.ON_VIEW_BEFORE_UPDATE),De=Ve(M.ON_VIEW_UPDATED),me=Ve(M.ON_VIEW_BEFORE_UNMOUNT),Te=Ve(M.ON_VIEW_UNMOUNTED),Ae=Ve(M.ON_VIEW_SUBMIT),ve=Ve(M.ON_VIEW_SUBMIT_START),Ce=Ve(M.ON_VIEW_SUBMIT_SUCCESS),Se=Ve(M.ON_VIEW_SUBMIT_FAILED),Ue=Ve(M.ON_VIEW_SUBMIT_END),Le=Ve(M.ON_VIEW_VALIDATE_START),$e=Ve(M.ON_VIEW_VALIDATE_SUCCESS),Be=Ve(M.ON_VIEW_VALIDATE_FAILED),Me=Ve(M.ON_VIEW_VALIDATE_END);export{g as AbstractEventConsumer,h as AbstractEventProducer,m as AbstractHTMLEventProducer,D as EventBus,b as EventCategory,V as EventConsumerScope,k as FieldEventNames,T as HTMLEventConsumer,A as HTMLEventProducer,C as HTMLKeyboardEventConsumer,L as HTMLKeyboardEventProducer,S as KeyboardEventConsumer,$ as KeyboardEventProducer,w as KeyboardTypes,te as LifeCycle,ie as LifeCycleHeart,M as LifeCycleTypes,B as RegistryType,W as ViewEventNames,K as isArr,z as isBool,x as isFn,q as isMap,G as isNum,Y as isNumberLike,Z as isObj,j as isPlainObj,ee as isRegExp,J as isSet,H as isStr,Q as isWeakMap,X as isWeakSet,ne as onFieldBeforeCreate,ce as onFieldBeforeMount,le as onFieldBeforeUnmount,ue as onFieldBeforeUpdate,Ie as onFieldBlur,oe as onFieldCreated,fe as onFieldFocus,ae as onFieldMounted,_e as onFieldUnmounted,de as onFieldUpdated,he as onFieldValidateEnd,ye as onFieldValidateFailed,Ee as onFieldValidateStart,pe as onFieldValidateSuccess,ge as onFieldValueChange,be as onViewBeforeCreated,Fe as onViewBeforeMount,me as onViewBeforeUnmount,Ne as onViewBeforeUpdate,we as onViewCreated,Oe as onViewMounted,Ae as onViewSubmit,Ue as onViewSubmitEnd,Se as onViewSubmitFailed,ve as onViewSubmitStart,Ce as onViewSubmitSuccess,Te as onViewUnmounted,De as onViewUpdated,Me as onViewValidateEnd,Be as onViewValidateFailed,Le as onViewValidateStart,$e as onViewValidateSuccess,c as registerEventConsumer,d as registerEventProducer,a as selectorEventConsumer,l as selectorEventProducer};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './src';
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { EventCategoryType, EventConsumer, EventConsumerConfig, EventConsumerFilter, EventConsumerFunction, EventConsumerOptions, EventMessage } from '../typing';
|
|
2
|
+
import { AbstractEventEngine } from './AbstractEventEngine';
|
|
3
|
+
export declare abstract class AbstractEventConsumer<K = string, EV = unknown, V = EV, M extends EventMessage<V> = EventMessage<V>, C extends EventConsumerConfig = EventConsumerConfig> extends AbstractEventEngine<K> implements EventConsumer<K, EV, V, M, C> {
|
|
4
|
+
el: HTMLElement | undefined;
|
|
5
|
+
private readonly _config;
|
|
6
|
+
private readonly _rawFilter;
|
|
7
|
+
private readonly _rawConsumer;
|
|
8
|
+
protected constructor(category: EventCategoryType, type: K, consumer: EventConsumerFunction<K, EV, V, M, C>, options?: EventConsumerOptions<EV, V, M, C>);
|
|
9
|
+
get config(): C;
|
|
10
|
+
protected get rawFilter(): EventConsumerFilter<EV, V, M>;
|
|
11
|
+
protected get rawConsumer(): EventConsumerFunction<K, EV, V, M, C>;
|
|
12
|
+
filter(ev: EV, message: M): boolean;
|
|
13
|
+
protected $$filter(ev: EV, message: M): boolean;
|
|
14
|
+
consumer(message: M): void;
|
|
15
|
+
protected generatorKey(): string;
|
|
16
|
+
protected $$dispose(): void;
|
|
17
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { EventCategoryType, EventEngine } from '../typing';
|
|
2
|
+
export declare abstract class AbstractEventEngine<K = string> implements EventEngine<K> {
|
|
3
|
+
private readonly _key;
|
|
4
|
+
private readonly _category;
|
|
5
|
+
private readonly _type;
|
|
6
|
+
private _isActivated;
|
|
7
|
+
private _isDisposed;
|
|
8
|
+
protected constructor(category: EventCategoryType, type: K);
|
|
9
|
+
get key(): string;
|
|
10
|
+
get category(): EventCategoryType;
|
|
11
|
+
get type(): K;
|
|
12
|
+
get isActivated(): boolean;
|
|
13
|
+
get isDisposed(): boolean;
|
|
14
|
+
start(): boolean;
|
|
15
|
+
protected $$start(): void;
|
|
16
|
+
stop(): boolean;
|
|
17
|
+
protected $$stop(): void;
|
|
18
|
+
dispose(): boolean;
|
|
19
|
+
protected $$dispose(): void;
|
|
20
|
+
protected abstract generatorKey(): string;
|
|
21
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { EventCategoryType, EventConvertFunction, EventMessage, EventProducer, EventProducerOptions, EventPublishFunction } from '../typing';
|
|
2
|
+
import { AbstractEventEngine } from './AbstractEventEngine';
|
|
3
|
+
export declare abstract class AbstractEventProducer<K = string, EV = unknown, V = EV> extends AbstractEventEngine<K> implements EventProducer<K, EV, V> {
|
|
4
|
+
private readonly _rawConvert;
|
|
5
|
+
private readonly _rawPublish;
|
|
6
|
+
protected constructor(category: EventCategoryType, type: K, options?: EventProducerOptions<K, EV, V>);
|
|
7
|
+
get rawConvert(): EventConvertFunction<K, EV, V>;
|
|
8
|
+
get rawPublish(): EventPublishFunction<K, EV, V>;
|
|
9
|
+
convert(ev: EV): EventMessage<V> | undefined;
|
|
10
|
+
protected abstract $$convert(self: EventProducer<K, EV, V>, ev: EV): EventMessage<V> | undefined;
|
|
11
|
+
publish(ev: EV): void;
|
|
12
|
+
protected $$publish(self: EventProducer<K, EV, V>, ev: EV): void;
|
|
13
|
+
protected generatorKey(): string;
|
|
14
|
+
protected $$dispose(): void;
|
|
15
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { EventConsumer, EventConsumerConfig, EventConsumerFunction, EventConsumerOptions, EventEngineOptions, EventMessage, EventProducer, EventProducerOptions } from '../typing';
|
|
2
|
+
export declare class Basic {
|
|
3
|
+
private static consumerMap;
|
|
4
|
+
static init<K = string, EV = unknown, V = EV>(options: EventEngineOptions, producerOptions?: EventProducerOptions<K, EV, V>): EventProducer<K, EV, V>;
|
|
5
|
+
static startProducer(options: EventEngineOptions): boolean;
|
|
6
|
+
static stopProducer(options: EventEngineOptions): boolean;
|
|
7
|
+
static publish<K = string, EV = unknown, V = EV>(options: EventEngineOptions, ev: EV): void;
|
|
8
|
+
static subscribe<K = string, EV = unknown, V = EV, M extends EventMessage<V> = EventMessage<V>, C extends EventConsumerConfig = EventConsumerConfig>(options: EventEngineOptions, consumerFn: EventConsumerFunction<K, EV, V, M, C>, consumerOptions?: EventConsumerOptions<EV, V, M, C>): EventConsumer<K, EV, V, M, C>;
|
|
9
|
+
static unsubscribe<K = string, EV = unknown, V = EV, M extends EventMessage<V> = EventMessage<V>, C extends EventConsumerConfig = EventConsumerConfig>(consumerFn: EventConsumerFunction<K, EV, V, M, C>): EventConsumer<K, EV, V> | undefined;
|
|
10
|
+
static startConsumer<K = string, EV = unknown, V = EV, M extends EventMessage<V> = EventMessage<V>, C extends EventConsumerConfig = EventConsumerConfig>(consumerFn: EventConsumerFunction<K, EV, V, M, C>): boolean;
|
|
11
|
+
static stopConsumer<K = string, EV = unknown, V = EV, M extends EventMessage<V> = EventMessage<V>, C extends EventConsumerConfig = EventConsumerConfig>(consumerFn: EventConsumerFunction<K, EV, V, M, C>): boolean;
|
|
12
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { EventConsumer, EventConsumerConfig, EventConsumerFunction, EventConsumerOptions, EventMessage, EventProducer } from '../typing';
|
|
2
|
+
export declare class HTMLEvent {
|
|
3
|
+
static init<K extends keyof HTMLElementEventMap, EV = HTMLElementEventMap[K]>(type: K | '*'): EventProducer<K, EV>;
|
|
4
|
+
static dispose<K extends keyof HTMLElementEventMap>(type: K | '*'): EventProducer<K, HTMLElementEventMap[K]> | undefined;
|
|
5
|
+
static subscribe<K extends keyof HTMLElementEventMap, EV = HTMLElementEventMap[K], V = EV, M extends EventMessage<V> = EventMessage<V>, C extends EventConsumerConfig = EventConsumerConfig>(type: K | '*', consumerFn: EventConsumerFunction<K, EV, V, M, C>, consumerOptions?: EventConsumerOptions<EV, V, M, C>, autoInitProducer?: boolean): EventConsumer<K, EV, V, M, C>;
|
|
6
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { EventConsumer, EventConsumerFunction, EventConsumerOptions, EventProducer, HTMLKeyboardEventConsumerConfig, KeyboardEventMessage } from '../typing';
|
|
2
|
+
export declare class HTMLKeyboardEvent {
|
|
3
|
+
static init(): EventProducer;
|
|
4
|
+
static dispose(): EventProducer | undefined;
|
|
5
|
+
static subscribe(type: string | '*', consumerFn: EventConsumerFunction<string, KeyboardEvent, KeyboardEvent, KeyboardEventMessage, HTMLKeyboardEventConsumerConfig>, consumerOptions?: EventConsumerOptions<KeyboardEvent, KeyboardEvent, KeyboardEventMessage, HTMLKeyboardEventConsumerConfig>, autoInitProducer?: boolean): EventConsumer<string, KeyboardEvent, KeyboardEvent, KeyboardEventMessage, HTMLKeyboardEventConsumerConfig>;
|
|
6
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { ConsumerOperator, ProducerOperator } from '../operator';
|
|
2
|
+
import { Basic } from './basic';
|
|
3
|
+
import { HTMLEvent } from './html-event';
|
|
4
|
+
import { HTMLKeyboardEvent } from './html-keyboard-event';
|
|
5
|
+
export declare class EventBus {
|
|
6
|
+
static init: typeof Basic.init;
|
|
7
|
+
static startProducer: typeof Basic.startProducer;
|
|
8
|
+
static stopProducer: typeof Basic.stopProducer;
|
|
9
|
+
static publish: typeof Basic.publish;
|
|
10
|
+
static subscribe: typeof Basic.subscribe;
|
|
11
|
+
static unsubscribe: typeof Basic.unsubscribe;
|
|
12
|
+
static start: typeof Basic.startConsumer;
|
|
13
|
+
static stop: typeof Basic.stopConsumer;
|
|
14
|
+
static disposeProducer: typeof ProducerOperator.dispose;
|
|
15
|
+
static disposeConsumer: typeof ConsumerOperator.dispose;
|
|
16
|
+
static subscribeHTMLEvent: typeof HTMLEvent.subscribe;
|
|
17
|
+
static subscribeKeyboardEvent: typeof HTMLKeyboardEvent.subscribe;
|
|
18
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { EventConsumer, EventConsumerConfig, EventConsumerFunction, EventConsumerOptions, EventEngineOptions, EventMessage } from '../typing';
|
|
2
|
+
export declare class ConsumerOperator {
|
|
3
|
+
private static consumers;
|
|
4
|
+
static getConsumers(message: EventMessage): EventConsumer<unknown, unknown, unknown, EventMessage<unknown>, EventConsumerConfig>[] | undefined;
|
|
5
|
+
static construct<K = string, EV = unknown, V = EV, M extends EventMessage<V> = EventMessage<V>, C extends EventConsumerConfig = EventConsumerConfig>(options: EventEngineOptions, consumer: EventConsumerFunction<K, EV, V, M, C>, consumerOptions?: EventConsumerOptions<EV, V, M, C>): EventConsumer<K, EV, V, M, C>;
|
|
6
|
+
static init<K = string, EV = unknown, V = EV>(consumer: EventConsumer<K, EV, V>): void;
|
|
7
|
+
static dispose<K = string, EV = unknown, V = EV>(consumer: EventConsumer<K, EV, V>): boolean;
|
|
8
|
+
static generatorKey(category: string, type: string): string;
|
|
9
|
+
static generatorKeyByEngine<K = string, EV = unknown, V = EV>(consumer: EventConsumer<K, EV, V>): string;
|
|
10
|
+
static generatorKeyByMessage(message: EventMessage): string;
|
|
11
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { EventCategoryType, EventEngineOptions, EventProducer, EventProducerOptions } from '../typing';
|
|
2
|
+
export declare class ProducerOperator {
|
|
3
|
+
private static producers;
|
|
4
|
+
static getProducer<K = string, EV = unknown, V = EV>(category: EventCategoryType, type: string): EventProducer<K, EV, V> | undefined;
|
|
5
|
+
static construct<K = string, EV = unknown, V = EV>(options: EventEngineOptions, producerOptions?: EventProducerOptions<K, EV, V>): EventProducer<K, EV, V>;
|
|
6
|
+
static init<K = string, EV = unknown, V = EV>(producer: EventProducer<K, EV, V>): void;
|
|
7
|
+
static dispose<K = string, EV = unknown, V = EV>(key: string): EventProducer<K, EV, V> | undefined;
|
|
8
|
+
static generatorKey(category: string, type: string): string;
|
|
9
|
+
static generatorKeyByEngine<K = string, EV = unknown, V = EV>(producer: EventProducer<K, EV, V>): string;
|
|
10
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { SPIOptions } from '@oinone/kunlun-spi';
|
|
2
|
+
import { EventCategoryType, EventConsumerConfig, EventConsumerConstructor, EventMessage } from '../typing';
|
|
3
|
+
export interface EventBusConsumerOptions extends SPIOptions {
|
|
4
|
+
category: EventCategoryType | EventCategoryType[];
|
|
5
|
+
type?: string | string[];
|
|
6
|
+
}
|
|
7
|
+
export declare function registerEventConsumer<K = string, EV = unknown, V = EV, M extends EventMessage<V> = EventMessage<V>, C extends EventConsumerConfig = EventConsumerConfig>(options: EventBusConsumerOptions, constructor: EventConsumerConstructor<K, EV, V, M, C>): boolean;
|
|
8
|
+
export declare function selectorEventConsumer<K = string, EV = unknown, V = EV, M extends EventMessage<V> = EventMessage<V>, C extends EventConsumerConfig = EventConsumerConfig>(options: EventBusConsumerOptions): EventConsumerConstructor<K, EV, V, M, C> | undefined;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { SPIOptions } from '@oinone/kunlun-spi';
|
|
2
|
+
import { EventCategoryType, EventProducerConstructor } from '../typing';
|
|
3
|
+
export interface EventBusProducerOptions extends SPIOptions {
|
|
4
|
+
category: EventCategoryType | EventCategoryType[];
|
|
5
|
+
type?: string | string[];
|
|
6
|
+
}
|
|
7
|
+
export declare function registerEventProducer<K = string, EV = unknown, V = EV>(options: EventBusProducerOptions, constructor: EventProducerConstructor<K, EV, V>): boolean;
|
|
8
|
+
export declare function selectorEventProducer<K = string, EV = unknown, V = EV>(options: EventBusProducerOptions): EventProducerConstructor<K, EV, V> | undefined;
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { EventCategoryType } from './category';
|
|
2
|
+
export interface EventEngine<K = string> {
|
|
3
|
+
key: string;
|
|
4
|
+
category: EventCategoryType;
|
|
5
|
+
type: K;
|
|
6
|
+
isActivated: boolean;
|
|
7
|
+
isDisposed: boolean;
|
|
8
|
+
start(): boolean;
|
|
9
|
+
stop(): boolean;
|
|
10
|
+
dispose(): boolean;
|
|
11
|
+
}
|
|
12
|
+
export interface EventProducer<K = string, EV = unknown, V = EV> extends EventEngine<K> {
|
|
13
|
+
convert(ev: EV): EventMessage<V> | undefined;
|
|
14
|
+
publish(ev: EV): void;
|
|
15
|
+
}
|
|
16
|
+
export declare type EventProducerConstructor<K = string, EV = unknown, V = EV> = (new (type: string, options?: EventProducerOptions<K, EV, V>) => EventProducer<K, EV, V>) | EventProducer<K, EV, V>;
|
|
17
|
+
export interface EventProducerOptions<K = string, EV = unknown, V = EV> {
|
|
18
|
+
convert?: EventConvertFunction<K, EV, V>;
|
|
19
|
+
publish?: EventPublishFunction<K, EV, V>;
|
|
20
|
+
}
|
|
21
|
+
export declare type EventConvertFunction<K = string, EV = unknown, V = EV> = (self: EventProducer<K, EV, V>, ev: EV) => EventMessage<V> | undefined;
|
|
22
|
+
export declare type EventPublishFunction<K = string, EV = unknown, V = EV> = (self: EventProducer<K, EV, V>, ev: EV) => void;
|
|
23
|
+
export interface EventConsumer<K = string, EV = unknown, V = EV, M extends EventMessage<V> = EventMessage<V>, C extends EventConsumerConfig = EventConsumerConfig> extends EventEngine<K> {
|
|
24
|
+
el?: HTMLElement;
|
|
25
|
+
config: C;
|
|
26
|
+
filter(ev: EV, message: M): boolean;
|
|
27
|
+
consumer(message: M): void;
|
|
28
|
+
}
|
|
29
|
+
export declare type EventConsumerConstructor<K = string, EV = unknown, V = EV, M extends EventMessage<V> = EventMessage<V>, C extends EventConsumerConfig = EventConsumerConfig> = new (type: string, consumer: EventConsumerFunction<K, EV, V, M, C>, options?: EventConsumerOptions<EV, V, M, C>) => EventConsumer<K, EV, V, M, C>;
|
|
30
|
+
export interface EventConsumerOptions<EV = unknown, V = EV, M extends EventMessage<V> = EventMessage<V>, C extends EventConsumerConfig = EventConsumerConfig> {
|
|
31
|
+
config?: C;
|
|
32
|
+
filter?: EventConsumerFilter<EV, V, M>;
|
|
33
|
+
}
|
|
34
|
+
export interface EventConsumerConfig {
|
|
35
|
+
/**
|
|
36
|
+
* 作用范围
|
|
37
|
+
*/
|
|
38
|
+
scope?: EventConsumerScope;
|
|
39
|
+
/**
|
|
40
|
+
* 指针悬浮时启用
|
|
41
|
+
*/
|
|
42
|
+
pointerActivated?: boolean;
|
|
43
|
+
/**
|
|
44
|
+
* 隐藏时禁用
|
|
45
|
+
*/
|
|
46
|
+
invisibleDeactivated?: boolean;
|
|
47
|
+
[key: string]: unknown;
|
|
48
|
+
}
|
|
49
|
+
export declare type EventConsumerFilter<EV = unknown, V = EV, M extends EventMessage<V> = EventMessage<V>> = (ev: EV, message: M) => boolean;
|
|
50
|
+
export declare type EventConsumerFunction<K = string, EV = unknown, V = EV, M extends EventMessage<V> = EventMessage<V>, C extends EventConsumerConfig = EventConsumerConfig> = (self: EventConsumer, message: M) => void;
|
|
51
|
+
export interface EventMessage<V = unknown> {
|
|
52
|
+
category: EventCategoryType;
|
|
53
|
+
type: string;
|
|
54
|
+
origin: V;
|
|
55
|
+
}
|
|
56
|
+
export declare type EventEngineOptions = {
|
|
57
|
+
category: EventCategoryType;
|
|
58
|
+
type: string | '*';
|
|
59
|
+
};
|
|
60
|
+
export declare enum EventConsumerScope {
|
|
61
|
+
global = "global",
|
|
62
|
+
view = "view",
|
|
63
|
+
current = "current"
|
|
64
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { EventConsumerConfig, EventMessage } from './basic';
|
|
2
|
+
export interface KeyboardEventMessage extends EventMessage<KeyboardEvent> {
|
|
3
|
+
code: string;
|
|
4
|
+
key: string;
|
|
5
|
+
ctrl: boolean;
|
|
6
|
+
alt: boolean;
|
|
7
|
+
shift: boolean;
|
|
8
|
+
}
|
|
9
|
+
export declare type KeyboardKeys = '*' | string | string[];
|
|
10
|
+
export declare type KeyboardType = 'keypress' | 'keyup' | 'keydown';
|
|
11
|
+
export declare const KeyboardTypes: KeyboardType[];
|
|
12
|
+
export interface HTMLKeyboardEventConsumerConfig extends EventConsumerConfig {
|
|
13
|
+
ctrl?: boolean;
|
|
14
|
+
alt?: boolean;
|
|
15
|
+
shift?: boolean;
|
|
16
|
+
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 字段生命周期 字段创建前
|
|
3
|
+
*/
|
|
4
|
+
declare const onFieldBeforeCreate: (type: string, callback?: ((ctx: any) => void) | undefined) => void;
|
|
5
|
+
/**
|
|
6
|
+
* 字段生命周期 字段已被创建
|
|
7
|
+
*/
|
|
8
|
+
declare const onFieldCreated: (type: string, callback?: ((ctx: any) => void) | undefined) => void;
|
|
9
|
+
/**
|
|
10
|
+
* 字段生命周期 字段挂载前
|
|
11
|
+
*/
|
|
12
|
+
declare const onFieldBeforeMount: (type: string, callback?: ((ctx: any) => void) | undefined) => void;
|
|
13
|
+
/**
|
|
14
|
+
* 字段生命周期 字段已经挂载在页面上
|
|
15
|
+
*/
|
|
16
|
+
declare const onFieldMounted: (type: string, callback?: ((ctx: any) => void) | undefined) => void;
|
|
17
|
+
/**
|
|
18
|
+
* 字段生命周期 字段修改前
|
|
19
|
+
*/
|
|
20
|
+
declare const onFieldBeforeUpdate: (type: string, callback?: ((ctx: any) => void) | undefined) => void;
|
|
21
|
+
/**
|
|
22
|
+
* 字段生命周期 字段已被修改
|
|
23
|
+
*/
|
|
24
|
+
declare const onFieldUpdated: (type: string, callback?: ((ctx: any) => void) | undefined) => void;
|
|
25
|
+
/**
|
|
26
|
+
* 字段生命周期 字段销毁前
|
|
27
|
+
*/
|
|
28
|
+
declare const onFieldBeforeUnmount: (type: string, callback?: ((ctx: any) => void) | undefined) => void;
|
|
29
|
+
/**
|
|
30
|
+
* 字段生命周期 字段已被销毁
|
|
31
|
+
*/
|
|
32
|
+
declare const onFieldUnmounted: (type: string, callback?: ((ctx: any) => void) | undefined) => void;
|
|
33
|
+
/**
|
|
34
|
+
* 字段生命周期 单字段校验 校验开始
|
|
35
|
+
*/
|
|
36
|
+
declare const onFieldValidateStart: (type: string, callback?: ((ctx: any) => void) | undefined) => void;
|
|
37
|
+
/**
|
|
38
|
+
* 字段生命周期 单字段校验 校验成功
|
|
39
|
+
*/
|
|
40
|
+
declare const onFieldValidateSuccess: (type: string, callback?: ((ctx: any) => void) | undefined) => void;
|
|
41
|
+
/**
|
|
42
|
+
* 字段生命周期 单字段校验 校验失败
|
|
43
|
+
*/
|
|
44
|
+
declare const onFieldValidateFailed: (type: string, callback?: ((ctx: any) => void) | undefined) => void;
|
|
45
|
+
/**
|
|
46
|
+
* 字段生命周期 单字段校验 校验结束
|
|
47
|
+
*/
|
|
48
|
+
declare const onFieldValidateEnd: (type: string, callback?: ((ctx: any) => void) | undefined) => void;
|
|
49
|
+
/**
|
|
50
|
+
* 字段生命周期 字段获得焦点
|
|
51
|
+
*/
|
|
52
|
+
declare const onFieldFocus: (type: string, callback?: ((ctx: any) => void) | undefined) => void;
|
|
53
|
+
/**
|
|
54
|
+
* 字段生命周期 字段的值发生的修改(只有该字段发生了change方法才会触发,否则不触发)
|
|
55
|
+
*/
|
|
56
|
+
declare const onFieldValueChange: (type: string, callback?: ((ctx: any) => void) | undefined) => void;
|
|
57
|
+
/**
|
|
58
|
+
* 字段生命周期 字段失去焦点
|
|
59
|
+
*/
|
|
60
|
+
declare const onFieldBlur: (type: string, callback?: ((ctx: any) => void) | undefined) => void;
|
|
61
|
+
export { onFieldBeforeCreate, onFieldCreated, onFieldBeforeMount, onFieldMounted, onFieldBeforeUpdate, onFieldUpdated, onFieldBeforeUnmount, onFieldUnmounted, onFieldValidateStart, onFieldValidateSuccess, onFieldValidateFailed, onFieldValidateEnd, onFieldFocus, onFieldValueChange, onFieldBlur };
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 视图生命周期 视图创建前
|
|
3
|
+
*/
|
|
4
|
+
declare const onViewBeforeCreated: (type: string, callback?: ((ctx: any) => void) | undefined) => void;
|
|
5
|
+
/**
|
|
6
|
+
* 视图生命周期 视图已被创建
|
|
7
|
+
*/
|
|
8
|
+
declare const onViewCreated: (type: string, callback?: ((ctx: any) => void) | undefined) => void;
|
|
9
|
+
/**
|
|
10
|
+
* 视图生命周期 视图挂载前
|
|
11
|
+
*/
|
|
12
|
+
declare const onViewBeforeMount: (type: string, callback?: ((ctx: any) => void) | undefined) => void;
|
|
13
|
+
/**
|
|
14
|
+
* 视图生命周期 视图已经挂载在页面上
|
|
15
|
+
*/
|
|
16
|
+
declare const onViewMounted: (type: string, callback?: ((ctx: any) => void) | undefined) => void;
|
|
17
|
+
/**
|
|
18
|
+
* 视图生命周期 视图修改前
|
|
19
|
+
*/
|
|
20
|
+
declare const onViewBeforeUpdate: (type: string, callback?: ((ctx: any) => void) | undefined) => void;
|
|
21
|
+
/**
|
|
22
|
+
* 视图生命周期 视图已被修改
|
|
23
|
+
*/
|
|
24
|
+
declare const onViewUpdated: (type: string, callback?: ((ctx: any) => void) | undefined) => void;
|
|
25
|
+
/**
|
|
26
|
+
* 视图生命周期 视图销毁前
|
|
27
|
+
*/
|
|
28
|
+
declare const onViewBeforeUnmount: (type: string, callback?: ((ctx: any) => void) | undefined) => void;
|
|
29
|
+
/**
|
|
30
|
+
* 视图生命周期 视图已被销毁
|
|
31
|
+
*/
|
|
32
|
+
declare const onViewUnmounted: (type: string, callback?: ((ctx: any) => void) | undefined) => void;
|
|
33
|
+
/**
|
|
34
|
+
* 视图生命周期 视图数据提交
|
|
35
|
+
*/
|
|
36
|
+
declare const onViewSubmit: (type: string, callback?: ((ctx: any) => void) | undefined) => void;
|
|
37
|
+
/**
|
|
38
|
+
* 视图生命周期 视图数据开始提交
|
|
39
|
+
*/
|
|
40
|
+
declare const onViewSubmitStart: (type: string, callback?: ((ctx: any) => void) | undefined) => void;
|
|
41
|
+
/**
|
|
42
|
+
* 视图生命周期 视图数据提交成功
|
|
43
|
+
*/
|
|
44
|
+
declare const onViewSubmitSuccess: (type: string, callback?: ((ctx: any) => void) | undefined) => void;
|
|
45
|
+
/**
|
|
46
|
+
* 视图生命周期 视图数据提交失败
|
|
47
|
+
*/
|
|
48
|
+
declare const onViewSubmitFailed: (type: string, callback?: ((ctx: any) => void) | undefined) => void;
|
|
49
|
+
/**
|
|
50
|
+
* 视图生命周期 视图数据提交结束
|
|
51
|
+
*/
|
|
52
|
+
declare const onViewSubmitEnd: (type: string, callback?: ((ctx: any) => void) | undefined) => void;
|
|
53
|
+
/**
|
|
54
|
+
* 视图生命周期 视图开始校验,只有表单页才会触发
|
|
55
|
+
*/
|
|
56
|
+
declare const onViewValidateStart: (type: string, callback?: ((ctx: any) => void) | undefined) => void;
|
|
57
|
+
/**
|
|
58
|
+
* 视图生命周期 视图校验成功,只有表单页才会触发
|
|
59
|
+
*/
|
|
60
|
+
declare const onViewValidateSuccess: (type: string, callback?: ((ctx: any) => void) | undefined) => void;
|
|
61
|
+
/**
|
|
62
|
+
* 视图生命周期 视图校验失败,只有表单页才会触发
|
|
63
|
+
*/
|
|
64
|
+
declare const onViewValidateFailed: (type: string, callback?: ((ctx: any) => void) | undefined) => void;
|
|
65
|
+
/**
|
|
66
|
+
* 视图生命周期 视图校验结束,只有表单页才会触发
|
|
67
|
+
*/
|
|
68
|
+
declare const onViewValidateEnd: (type: string, callback?: ((ctx: any) => void) | undefined) => void;
|
|
69
|
+
export { onViewBeforeCreated, onViewCreated, onViewBeforeMount, onViewMounted, onViewBeforeUpdate, onViewUpdated, onViewBeforeUnmount, onViewUnmounted, onViewSubmit, onViewSubmitStart, onViewSubmitSuccess, onViewSubmitFailed, onViewSubmitEnd, onViewValidateStart, onViewValidateSuccess, onViewValidateFailed, onViewValidateEnd };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
declare const isFn: (val: any) => val is Function;
|
|
2
|
+
declare const isArr: (arg: any) => arg is any[];
|
|
3
|
+
declare const isPlainObj: (obj: unknown) => obj is object;
|
|
4
|
+
declare const isStr: (obj: unknown) => obj is string;
|
|
5
|
+
declare const isBool: (obj: unknown) => obj is boolean;
|
|
6
|
+
declare const isNum: (obj: unknown) => obj is number;
|
|
7
|
+
declare const isMap: (val: any) => val is Map<any, any>;
|
|
8
|
+
declare const isSet: (val: any) => val is Set<any>;
|
|
9
|
+
declare const isWeakMap: (val: any) => val is WeakMap<any, any>;
|
|
10
|
+
declare const isWeakSet: (val: any) => val is WeakSet<any>;
|
|
11
|
+
declare const isNumberLike: (index: any) => index is number;
|
|
12
|
+
declare const isObj: (val: unknown) => val is object;
|
|
13
|
+
declare const isRegExp: (obj: unknown) => obj is RegExp;
|
|
14
|
+
export { isFn, isArr, isPlainObj, isStr, isBool, isNum, isMap, isSet, isWeakMap, isWeakSet, isNumberLike, isObj, isRegExp };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { AbstractEventProducer, EventCategoryType, EventMessage, EventProducer, EventProducerOptions } from '../../bus';
|
|
2
|
+
export declare abstract class AbstractHTMLEventProducer<K extends keyof HTMLElementEventMap, EV extends HTMLElementEventMap[K] = HTMLElementEventMap[K]> extends AbstractEventProducer<K, HTMLElementEventMap[K]> {
|
|
3
|
+
protected constructor(category: EventCategoryType, type: K, options?: EventProducerOptions<K, HTMLElementEventMap[K]>);
|
|
4
|
+
protected $$convert(self: EventProducer<K, EV>, ev: EV): EventMessage<EV> | undefined;
|
|
5
|
+
protected $$start(): void;
|
|
6
|
+
protected $$stop(): void;
|
|
7
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { AbstractEventConsumer, EventConsumerConfig, EventConsumerFunction, EventConsumerOptions, EventMessage } from '../../bus';
|
|
2
|
+
export declare class HTMLEventConsumer<K extends keyof HTMLElementEventMap, M extends EventMessage<HTMLElementEventMap[K]> = EventMessage<HTMLElementEventMap[K]>, C extends EventConsumerConfig = EventConsumerConfig> extends AbstractEventConsumer<K, HTMLElementEventMap[K], HTMLElementEventMap[K], M, C> {
|
|
3
|
+
constructor(type: K, consumer: EventConsumerFunction<K, HTMLElementEventMap[K], HTMLElementEventMap[K], M, C>, options?: EventConsumerOptions<HTMLElementEventMap[K], HTMLElementEventMap[K], M, C>);
|
|
4
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { EventProducerOptions } from '../../bus';
|
|
2
|
+
import { AbstractHTMLEventProducer } from './AbstractHTMLEventProducer';
|
|
3
|
+
export declare class HTMLEventProducer<K extends keyof HTMLElementEventMap> extends AbstractHTMLEventProducer<K> {
|
|
4
|
+
constructor(type: K, options?: EventProducerOptions<K, HTMLElementEventMap[K]>);
|
|
5
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { AbstractEventConsumer, EventCategoryType, EventConsumerFunction, EventConsumerOptions, HTMLKeyboardEventConsumerConfig, KeyboardEventMessage } from '../../bus';
|
|
2
|
+
declare type KeyboardEventConsumerOptions = EventConsumerOptions<KeyboardEvent, KeyboardEvent, KeyboardEventMessage, HTMLKeyboardEventConsumerConfig>;
|
|
3
|
+
declare class AbstractKeyboardEventConsumer extends AbstractEventConsumer<string, KeyboardEvent, KeyboardEvent, KeyboardEventMessage, HTMLKeyboardEventConsumerConfig> {
|
|
4
|
+
constructor(category: EventCategoryType, type: string, consumer: EventConsumerFunction<string, KeyboardEvent, KeyboardEvent, KeyboardEventMessage, HTMLKeyboardEventConsumerConfig>, options?: KeyboardEventConsumerOptions);
|
|
5
|
+
protected initConfig(): void;
|
|
6
|
+
protected $$filter(ev: KeyboardEvent, message: KeyboardEventMessage): boolean;
|
|
7
|
+
}
|
|
8
|
+
export declare class HTMLKeyboardEventConsumer extends AbstractKeyboardEventConsumer {
|
|
9
|
+
constructor(type: string, consumer: EventConsumerFunction<string, KeyboardEvent, KeyboardEvent, KeyboardEventMessage, HTMLKeyboardEventConsumerConfig>, options?: KeyboardEventConsumerOptions);
|
|
10
|
+
}
|
|
11
|
+
export declare class KeyboardEventConsumer extends AbstractKeyboardEventConsumer {
|
|
12
|
+
constructor(type: string, consumer: EventConsumerFunction<string, KeyboardEvent, KeyboardEvent, KeyboardEventMessage, HTMLKeyboardEventConsumerConfig>, options?: KeyboardEventConsumerOptions);
|
|
13
|
+
}
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { EventProducer, EventProducerOptions, KeyboardEventMessage, KeyboardType } from '../../bus';
|
|
2
|
+
import { AbstractHTMLEventProducer } from '../basic';
|
|
3
|
+
declare abstract class AbstractHTMLKeyboardEventProducer<K extends KeyboardType> extends AbstractHTMLEventProducer<K, KeyboardEvent> {
|
|
4
|
+
protected $$convert(self: EventProducer<K, KeyboardEvent>, ev: KeyboardEvent): KeyboardEventMessage | undefined;
|
|
5
|
+
}
|
|
6
|
+
export declare class HTMLKeyboardEventProducer<K extends KeyboardType> extends AbstractHTMLKeyboardEventProducer<K> {
|
|
7
|
+
constructor(type: K, options?: EventProducerOptions<K, KeyboardEvent>);
|
|
8
|
+
}
|
|
9
|
+
export declare class KeyboardEventProducer<K extends KeyboardType> extends AbstractHTMLKeyboardEventProducer<K> {
|
|
10
|
+
constructor(type: K, options?: EventProducerOptions<K, KeyboardEvent>);
|
|
11
|
+
protected $$convert(self: EventProducer<K, KeyboardEvent>, ev: KeyboardEvent): KeyboardEventMessage | undefined;
|
|
12
|
+
protected onKeydown(ev: KeyboardEvent): void;
|
|
13
|
+
protected $$start(): void;
|
|
14
|
+
protected $$stop(): void;
|
|
15
|
+
}
|
|
16
|
+
export {};
|