@etsoo/shared 1.1.28 → 1.1.31
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/__tests__/EHistory.ts +3 -13
- package/lib/cjs/index.d.ts +2 -0
- package/lib/cjs/index.js +2 -0
- package/lib/cjs/types/EHistory.d.ts +7 -2
- package/lib/cjs/types/EHistory.js +15 -1
- package/lib/mjs/index.d.ts +2 -0
- package/lib/mjs/index.js +2 -0
- package/lib/mjs/types/EHistory.d.ts +7 -2
- package/lib/mjs/types/EHistory.js +14 -1
- package/package.json +1 -1
- package/src/index.ts +2 -0
- package/src/types/EHistory.ts +15 -8
package/__tests__/EHistory.ts
CHANGED
|
@@ -1,17 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
EHistory,
|
|
3
|
-
EHistoryEventData,
|
|
4
|
-
EHistoryEventType
|
|
5
|
-
} from '../src/types/EHistory';
|
|
6
|
-
import { EventBase } from '../src/types/EventClass';
|
|
1
|
+
import { EHistory, EHistoryEvent } from '../src/types/EHistory';
|
|
7
2
|
|
|
8
3
|
// Extended for tests
|
|
9
|
-
class
|
|
10
|
-
class LHistory extends EHistory<number, EHistoryEventData> {
|
|
11
|
-
protected createEvent(type: EHistoryEventType, index: number) {
|
|
12
|
-
return new LHistoryEvent(this, type, { index });
|
|
13
|
-
}
|
|
14
|
-
}
|
|
4
|
+
class LHistory extends EHistory<number> {}
|
|
15
5
|
|
|
16
6
|
test('Tests for history', () => {
|
|
17
7
|
const history = new LHistory();
|
|
@@ -37,7 +27,7 @@ test('Tests for history', () => {
|
|
|
37
27
|
|
|
38
28
|
test('Tests for events', () => {
|
|
39
29
|
const navigatorFn = jest.fn();
|
|
40
|
-
const navigatorStopFn = jest.fn((event:
|
|
30
|
+
const navigatorStopFn = jest.fn((event: EHistoryEvent) => {
|
|
41
31
|
event.stopImmediatePropagation();
|
|
42
32
|
});
|
|
43
33
|
const clearFn = jest.fn();
|
package/lib/cjs/index.d.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
export * from './types/DelayedExecutorType';
|
|
2
2
|
export * from './types/EColor';
|
|
3
|
+
export * from './types/EHistory';
|
|
4
|
+
export * from './types/EventClass';
|
|
3
5
|
export * from './types/FormData';
|
|
4
6
|
export * from './storage/IStorage';
|
|
5
7
|
export * from './storage/WindowStorage';
|
package/lib/cjs/index.js
CHANGED
|
@@ -16,6 +16,8 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./types/DelayedExecutorType"), exports);
|
|
18
18
|
__exportStar(require("./types/EColor"), exports);
|
|
19
|
+
__exportStar(require("./types/EHistory"), exports);
|
|
20
|
+
__exportStar(require("./types/EventClass"), exports);
|
|
19
21
|
__exportStar(require("./types/FormData"), exports);
|
|
20
22
|
__exportStar(require("./storage/IStorage"), exports);
|
|
21
23
|
__exportStar(require("./storage/WindowStorage"), exports);
|
|
@@ -12,10 +12,15 @@ export interface EHistoryEventData {
|
|
|
12
12
|
*/
|
|
13
13
|
index: number;
|
|
14
14
|
}
|
|
15
|
+
/**
|
|
16
|
+
* ETSOO Extended history event
|
|
17
|
+
*/
|
|
18
|
+
export declare class EHistoryEvent extends EventBase<EHistoryEventType, EHistoryEventData> {
|
|
19
|
+
}
|
|
15
20
|
/**
|
|
16
21
|
* ETSOO Extended abstract history class
|
|
17
22
|
*/
|
|
18
|
-
export declare abstract class EHistory<T
|
|
23
|
+
export declare abstract class EHistory<T> extends EventClass<EHistoryEventType, EHistoryEventData> {
|
|
19
24
|
private _index;
|
|
20
25
|
/**
|
|
21
26
|
* States
|
|
@@ -46,7 +51,7 @@ export declare abstract class EHistory<T, D extends EHistoryEventData> extends E
|
|
|
46
51
|
* @param type Type
|
|
47
52
|
* @param index Current index
|
|
48
53
|
*/
|
|
49
|
-
protected
|
|
54
|
+
protected createEvent(type: EHistoryEventType, index: number): EHistoryEvent;
|
|
50
55
|
/**
|
|
51
56
|
* Forward to the next state
|
|
52
57
|
*/
|
|
@@ -1,7 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.EHistory = void 0;
|
|
3
|
+
exports.EHistory = exports.EHistoryEvent = void 0;
|
|
4
4
|
const EventClass_1 = require("./EventClass");
|
|
5
|
+
/**
|
|
6
|
+
* ETSOO Extended history event
|
|
7
|
+
*/
|
|
8
|
+
class EHistoryEvent extends EventClass_1.EventBase {
|
|
9
|
+
}
|
|
10
|
+
exports.EHistoryEvent = EHistoryEvent;
|
|
5
11
|
/**
|
|
6
12
|
* ETSOO Extended abstract history class
|
|
7
13
|
*/
|
|
@@ -50,6 +56,14 @@ class EHistory extends EventClass_1.EventClass {
|
|
|
50
56
|
this._index = -1;
|
|
51
57
|
this.trigger(this.createEvent('clear', this._index));
|
|
52
58
|
}
|
|
59
|
+
/**
|
|
60
|
+
* Create event
|
|
61
|
+
* @param type Type
|
|
62
|
+
* @param index Current index
|
|
63
|
+
*/
|
|
64
|
+
createEvent(type, index) {
|
|
65
|
+
return new EHistoryEvent(this, type, { index });
|
|
66
|
+
}
|
|
53
67
|
/**
|
|
54
68
|
* Forward to the next state
|
|
55
69
|
*/
|
package/lib/mjs/index.d.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
export * from './types/DelayedExecutorType';
|
|
2
2
|
export * from './types/EColor';
|
|
3
|
+
export * from './types/EHistory';
|
|
4
|
+
export * from './types/EventClass';
|
|
3
5
|
export * from './types/FormData';
|
|
4
6
|
export * from './storage/IStorage';
|
|
5
7
|
export * from './storage/WindowStorage';
|
package/lib/mjs/index.js
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
export * from './types/DelayedExecutorType';
|
|
2
2
|
export * from './types/EColor';
|
|
3
|
+
export * from './types/EHistory';
|
|
4
|
+
export * from './types/EventClass';
|
|
3
5
|
export * from './types/FormData';
|
|
4
6
|
export * from './storage/IStorage';
|
|
5
7
|
export * from './storage/WindowStorage';
|
|
@@ -12,10 +12,15 @@ export interface EHistoryEventData {
|
|
|
12
12
|
*/
|
|
13
13
|
index: number;
|
|
14
14
|
}
|
|
15
|
+
/**
|
|
16
|
+
* ETSOO Extended history event
|
|
17
|
+
*/
|
|
18
|
+
export declare class EHistoryEvent extends EventBase<EHistoryEventType, EHistoryEventData> {
|
|
19
|
+
}
|
|
15
20
|
/**
|
|
16
21
|
* ETSOO Extended abstract history class
|
|
17
22
|
*/
|
|
18
|
-
export declare abstract class EHistory<T
|
|
23
|
+
export declare abstract class EHistory<T> extends EventClass<EHistoryEventType, EHistoryEventData> {
|
|
19
24
|
private _index;
|
|
20
25
|
/**
|
|
21
26
|
* States
|
|
@@ -46,7 +51,7 @@ export declare abstract class EHistory<T, D extends EHistoryEventData> extends E
|
|
|
46
51
|
* @param type Type
|
|
47
52
|
* @param index Current index
|
|
48
53
|
*/
|
|
49
|
-
protected
|
|
54
|
+
protected createEvent(type: EHistoryEventType, index: number): EHistoryEvent;
|
|
50
55
|
/**
|
|
51
56
|
* Forward to the next state
|
|
52
57
|
*/
|
|
@@ -1,4 +1,9 @@
|
|
|
1
|
-
import { EventClass } from './EventClass';
|
|
1
|
+
import { EventBase, EventClass } from './EventClass';
|
|
2
|
+
/**
|
|
3
|
+
* ETSOO Extended history event
|
|
4
|
+
*/
|
|
5
|
+
export class EHistoryEvent extends EventBase {
|
|
6
|
+
}
|
|
2
7
|
/**
|
|
3
8
|
* ETSOO Extended abstract history class
|
|
4
9
|
*/
|
|
@@ -47,6 +52,14 @@ export class EHistory extends EventClass {
|
|
|
47
52
|
this._index = -1;
|
|
48
53
|
this.trigger(this.createEvent('clear', this._index));
|
|
49
54
|
}
|
|
55
|
+
/**
|
|
56
|
+
* Create event
|
|
57
|
+
* @param type Type
|
|
58
|
+
* @param index Current index
|
|
59
|
+
*/
|
|
60
|
+
createEvent(type, index) {
|
|
61
|
+
return new EHistoryEvent(this, type, { index });
|
|
62
|
+
}
|
|
50
63
|
/**
|
|
51
64
|
* Forward to the next state
|
|
52
65
|
*/
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
package/src/types/EHistory.ts
CHANGED
|
@@ -15,13 +15,21 @@ export interface EHistoryEventData {
|
|
|
15
15
|
index: number;
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
+
/**
|
|
19
|
+
* ETSOO Extended history event
|
|
20
|
+
*/
|
|
21
|
+
export class EHistoryEvent extends EventBase<
|
|
22
|
+
EHistoryEventType,
|
|
23
|
+
EHistoryEventData
|
|
24
|
+
> {}
|
|
25
|
+
|
|
18
26
|
/**
|
|
19
27
|
* ETSOO Extended abstract history class
|
|
20
28
|
*/
|
|
21
|
-
export abstract class EHistory<
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
>
|
|
29
|
+
export abstract class EHistory<T> extends EventClass<
|
|
30
|
+
EHistoryEventType,
|
|
31
|
+
EHistoryEventData
|
|
32
|
+
> {
|
|
25
33
|
// Index
|
|
26
34
|
private _index: number = -1;
|
|
27
35
|
|
|
@@ -74,10 +82,9 @@ export abstract class EHistory<
|
|
|
74
82
|
* @param type Type
|
|
75
83
|
* @param index Current index
|
|
76
84
|
*/
|
|
77
|
-
protected
|
|
78
|
-
type
|
|
79
|
-
|
|
80
|
-
): EventBase<EHistoryEventType, D>;
|
|
85
|
+
protected createEvent(type: EHistoryEventType, index: number) {
|
|
86
|
+
return new EHistoryEvent(this, type, { index });
|
|
87
|
+
}
|
|
81
88
|
|
|
82
89
|
/**
|
|
83
90
|
* Forward to the next state
|