x4js 1.6.4 → 1.6.5
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/lib/cjs/x4js.js +2 -2
- package/lib/cjs/x4js.js.map +3 -3
- package/lib/esm/x4js.mjs +7 -7
- package/lib/esm/x4js.mjs.map +2 -2
- package/lib/src/base_component.ts +2 -2
- package/lib/src/datastore.ts +2 -2
- package/lib/src/icon.ts +2 -2
- package/lib/src/router.ts +2 -2
- package/lib/src/x4events.ts +2 -2
- package/lib/types/x4js.d.ts +8 -8
- package/package.json +1 -1
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
*
|
|
29
29
|
**/
|
|
30
30
|
|
|
31
|
-
import { EventMap, MapEvents,
|
|
31
|
+
import { EventMap, MapEvents, EvSource, EvTimer } from './x4events';
|
|
32
32
|
|
|
33
33
|
/**
|
|
34
34
|
* Timer Callback
|
|
@@ -61,7 +61,7 @@ export interface BaseComponentProps<T = BaseComponentEventMap> {
|
|
|
61
61
|
*/
|
|
62
62
|
|
|
63
63
|
export class BaseComponent< P extends BaseComponentProps<BaseComponentEventMap>, E extends BaseComponentEventMap >
|
|
64
|
-
extends
|
|
64
|
+
extends EvSource< E > {
|
|
65
65
|
|
|
66
66
|
protected m_props: P;
|
|
67
67
|
#m_timers: Map<string, Function>;
|
package/lib/src/datastore.ts
CHANGED
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
|
|
30
30
|
import { ajaxRequest } from './request';
|
|
31
31
|
import { isArray, isString } from './tools';
|
|
32
|
-
import { BasicEvent, EvChange,
|
|
32
|
+
import { BasicEvent, EvChange, EvSource, EventMap, } from './x4events';
|
|
33
33
|
import { BaseComponent, BaseComponentEventMap, BaseComponentProps } from './base_component';
|
|
34
34
|
|
|
35
35
|
export type ChangeCallback = (type: string, id?: any) => void;
|
|
@@ -621,7 +621,7 @@ interface DataStoreEventMap extends EventMap {
|
|
|
621
621
|
*
|
|
622
622
|
*/
|
|
623
623
|
|
|
624
|
-
export class DataStore<T extends Record = Record> extends
|
|
624
|
+
export class DataStore<T extends Record = Record> extends EvSource<DataStoreEventMap> {
|
|
625
625
|
|
|
626
626
|
protected m_model: T;
|
|
627
627
|
protected m_fields: FieldInfo[];
|
package/lib/src/icon.ts
CHANGED
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
import { Component, CProps } from './component'
|
|
31
31
|
import { Stylesheet } from './styles'
|
|
32
32
|
import { HtmlString, isString } from './tools';
|
|
33
|
-
import { BasicEvent,
|
|
33
|
+
import { BasicEvent, EventMap, EvSource } from './x4events';
|
|
34
34
|
|
|
35
35
|
// ============================================================================
|
|
36
36
|
// [ICON]
|
|
@@ -83,7 +83,7 @@ function trimQuotes( str:string ): string {
|
|
|
83
83
|
return str;
|
|
84
84
|
}
|
|
85
85
|
|
|
86
|
-
class Loader extends
|
|
86
|
+
class Loader extends EvSource<LoadingEventMap> {
|
|
87
87
|
svgs: Map<string,string>;
|
|
88
88
|
|
|
89
89
|
constructor( ) {
|
package/lib/src/router.ts
CHANGED
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
|
|
30
30
|
import { x4document } from './x4dom'
|
|
31
31
|
|
|
32
|
-
import {
|
|
32
|
+
import { EvSource, EvError, EventMap } from "./x4events"
|
|
33
33
|
|
|
34
34
|
type RouteHandler = ( params: any, path: string ) => void;
|
|
35
35
|
|
|
@@ -120,7 +120,7 @@ interface RouterEventMap extends EventMap {
|
|
|
120
120
|
*/
|
|
121
121
|
|
|
122
122
|
|
|
123
|
-
export class Router extends
|
|
123
|
+
export class Router extends EvSource< RouterEventMap > {
|
|
124
124
|
|
|
125
125
|
private m_routes: Route[];
|
|
126
126
|
private m_useHash: boolean;
|
package/lib/src/x4events.ts
CHANGED
|
@@ -241,7 +241,7 @@ export type MapEvents<Type> = {
|
|
|
241
241
|
* doit: EvDoIt;
|
|
242
242
|
* }
|
|
243
243
|
*
|
|
244
|
-
* let ee = new
|
|
244
|
+
* let ee = new EvSource<TestEventMap>(null);
|
|
245
245
|
* ee.listen({
|
|
246
246
|
* doit: (e) => {
|
|
247
247
|
* console.log(e);
|
|
@@ -267,7 +267,7 @@ export type MapEvents<Type> = {
|
|
|
267
267
|
* ```
|
|
268
268
|
*/
|
|
269
269
|
|
|
270
|
-
export class
|
|
270
|
+
export class EvSource<Q extends EventMap, T extends EventTypes = MapEvents<Q>> {
|
|
271
271
|
|
|
272
272
|
private m_source: unknown;
|
|
273
273
|
private m_eventRegistry: Map<string, EventCallback[]>;
|
package/lib/types/x4js.d.ts
CHANGED
|
@@ -219,7 +219,7 @@ declare module 'x4events' {
|
|
|
219
219
|
* doit: EvDoIt;
|
|
220
220
|
* }
|
|
221
221
|
*
|
|
222
|
-
* let ee = new
|
|
222
|
+
* let ee = new EvSource<TestEventMap>(null);
|
|
223
223
|
* ee.listen({
|
|
224
224
|
* doit: (e) => {
|
|
225
225
|
* console.log(e);
|
|
@@ -244,7 +244,7 @@ declare module 'x4events' {
|
|
|
244
244
|
* }
|
|
245
245
|
* ```
|
|
246
246
|
*/
|
|
247
|
-
export class
|
|
247
|
+
export class EvSource<Q extends EventMap, T extends EventTypes = MapEvents<Q>> {
|
|
248
248
|
private m_source;
|
|
249
249
|
private m_eventRegistry;
|
|
250
250
|
private m_defaultHandlers;
|
|
@@ -352,7 +352,7 @@ declare module 'base_component' {
|
|
|
352
352
|
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
353
353
|
*
|
|
354
354
|
**/
|
|
355
|
-
import { EventMap, MapEvents,
|
|
355
|
+
import { EventMap, MapEvents, EvSource, EvTimer } from 'x4events';
|
|
356
356
|
/**
|
|
357
357
|
* Timer Callback
|
|
358
358
|
* @see EvTimer, startTimer, stopTimer
|
|
@@ -376,7 +376,7 @@ declare module 'base_component' {
|
|
|
376
376
|
/**
|
|
377
377
|
* BaseComponent class
|
|
378
378
|
*/
|
|
379
|
-
export class BaseComponent<P extends BaseComponentProps<BaseComponentEventMap>, E extends BaseComponentEventMap> extends
|
|
379
|
+
export class BaseComponent<P extends BaseComponentProps<BaseComponentEventMap>, E extends BaseComponentEventMap> extends EvSource<E> {
|
|
380
380
|
#private;
|
|
381
381
|
protected m_props: P;
|
|
382
382
|
constructor(props: P);
|
|
@@ -1913,7 +1913,7 @@ declare module 'router' {
|
|
|
1913
1913
|
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
|
1914
1914
|
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
1915
1915
|
**/
|
|
1916
|
-
import {
|
|
1916
|
+
import { EvSource, EvError, EventMap } from 'x4events';
|
|
1917
1917
|
type RouteHandler = (params: any, path: string) => void;
|
|
1918
1918
|
interface RouterEventMap extends EventMap {
|
|
1919
1919
|
error: EvError;
|
|
@@ -1941,7 +1941,7 @@ declare module 'router' {
|
|
|
1941
1941
|
* router.init( );
|
|
1942
1942
|
* ```
|
|
1943
1943
|
*/
|
|
1944
|
-
export class Router extends
|
|
1944
|
+
export class Router extends EvSource<RouterEventMap> {
|
|
1945
1945
|
private m_routes;
|
|
1946
1946
|
private m_useHash;
|
|
1947
1947
|
constructor(useHash?: boolean);
|
|
@@ -3835,7 +3835,7 @@ declare module 'datastore' {
|
|
|
3835
3835
|
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
|
3836
3836
|
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
3837
3837
|
**/
|
|
3838
|
-
import { BasicEvent, EvChange,
|
|
3838
|
+
import { BasicEvent, EvChange, EvSource, EventMap } from 'x4events';
|
|
3839
3839
|
import { BaseComponent, BaseComponentEventMap, BaseComponentProps } from 'base_component';
|
|
3840
3840
|
export type ChangeCallback = (type: string, id?: any) => void;
|
|
3841
3841
|
export type CalcCallback = () => string;
|
|
@@ -4042,7 +4042,7 @@ declare module 'datastore' {
|
|
|
4042
4042
|
/**
|
|
4043
4043
|
*
|
|
4044
4044
|
*/
|
|
4045
|
-
export class DataStore<T extends Record = Record> extends
|
|
4045
|
+
export class DataStore<T extends Record = Record> extends EvSource<DataStoreEventMap> {
|
|
4046
4046
|
protected m_model: T;
|
|
4047
4047
|
protected m_fields: FieldInfo[];
|
|
4048
4048
|
protected m_records: T[];
|