@stemy/ngx-utils 19.6.12 → 19.7.1
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/fesm2022/stemy-ngx-utils.mjs +740 -803
- package/fesm2022/stemy-ngx-utils.mjs.map +1 -1
- package/ngx-utils/common-types.d.ts +47 -45
- package/ngx-utils/components/dynamic-table/dynamic-table.component.d.ts +10 -5
- package/ngx-utils/components/interactive-canvas/interactive-canvas.component.d.ts +42 -19
- package/ngx-utils/components/interactive-canvas/interactive-circle.component.d.ts +4 -8
- package/ngx-utils/components/interactive-canvas/interactive-item.component.d.ts +27 -23
- package/ngx-utils/components/interactive-canvas/interactive-rect.component.d.ts +6 -9
- package/ngx-utils/ngx-utils.imports.d.ts +2 -5
- package/ngx-utils/tokens.d.ts +1 -2
- package/ngx-utils/utils/{canvas.utils.d.ts → canvas.d.ts} +2 -0
- package/ngx-utils/utils/geometry/distance.d.ts +25 -0
- package/ngx-utils/utils/geometry/functions.d.ts +13 -0
- package/ngx-utils/utils/geometry/index.d.ts +2 -0
- package/ngx-utils/utils/geometry/shapes.d.ts +48 -0
- package/ngx-utils/utils/math.utils.d.ts +1 -1
- package/ngx-utils/utils/misc.d.ts +2 -1
- package/package.json +1 -1
- package/public_api.d.ts +5 -8
- package/ngx-utils/services/wasm.service.d.ts +0 -25
- package/ngx-utils/utils/geometry.d.ts +0 -46
- package/ngx-utils/utils/vector.d.ts +0 -23
- package/ngx-utils/utils/wasi.d.ts +0 -26
- package/ngx-utils/utils/wasm-worker-proxy.d.ts +0 -17
- package/ngx-utils/utils/with-options-provider.d.ts +0 -3
|
@@ -3,7 +3,7 @@ import { HttpClient, HttpHeaders } from "@angular/common/http";
|
|
|
3
3
|
import { ActivatedRouteSnapshot, Data, LoadChildrenCallback, Route, Routes, UrlTree } from "@angular/router";
|
|
4
4
|
import { Observable } from "rxjs";
|
|
5
5
|
import { DurationLikeObject } from "luxon";
|
|
6
|
-
import { StringKeys } from "./helper-types";
|
|
6
|
+
import { MaybePromise, StringKeys } from "./helper-types";
|
|
7
7
|
export type DurationUnit = StringKeys<DurationLikeObject>;
|
|
8
8
|
export interface TypedFactoryProvider<T> {
|
|
9
9
|
useFactory: (...args: any[]) => T;
|
|
@@ -173,32 +173,6 @@ export interface IPromiseService {
|
|
|
173
173
|
resolve<T>(value: T | PromiseLike<T>): Promise<T>;
|
|
174
174
|
reject<T>(value: T | PromiseLike<T>): Promise<T>;
|
|
175
175
|
}
|
|
176
|
-
export type TypedArray = Int8Array | Int16Array | Int32Array | Uint8Array | Uint8ClampedArray | Uint16Array | Uint32Array | Float32Array | Float64Array;
|
|
177
|
-
export interface IWasmExports {
|
|
178
|
-
HEAP8: Int8Array;
|
|
179
|
-
HEAP16: Int16Array;
|
|
180
|
-
HEAP32: Int32Array;
|
|
181
|
-
HEAPU8: Uint8Array;
|
|
182
|
-
HEAPU16: Uint16Array;
|
|
183
|
-
HEAPU32: Uint32Array;
|
|
184
|
-
HEAPF32: Float32Array;
|
|
185
|
-
HEAPF64: Float64Array;
|
|
186
|
-
memory: WebAssembly.Memory;
|
|
187
|
-
[key: string]: any;
|
|
188
|
-
}
|
|
189
|
-
export interface IWasi {
|
|
190
|
-
instantiate(bytes: ArrayBuffer): Promise<IWasmExports>;
|
|
191
|
-
}
|
|
192
|
-
export interface IWasm {
|
|
193
|
-
writeArrayToMemory(array: TypedArray): Promise<number> | number;
|
|
194
|
-
readArrayFromMemory<T = TypedArray>(pointer: number, array: T): Promise<T> | T;
|
|
195
|
-
[key: string]: (...args: any[]) => any;
|
|
196
|
-
}
|
|
197
|
-
export interface IWasmAsync {
|
|
198
|
-
writeArrayToMemory(array: TypedArray): Promise<number>;
|
|
199
|
-
readArrayFromMemory<T = TypedArray>(pointer: number, array: T): T;
|
|
200
|
-
[key: string]: (...args: any[]) => Promise<any>;
|
|
201
|
-
}
|
|
202
176
|
export interface IAsyncMessage {
|
|
203
177
|
message: string;
|
|
204
178
|
context?: any;
|
|
@@ -309,9 +283,9 @@ export interface IPaginationData {
|
|
|
309
283
|
}
|
|
310
284
|
export type PaginationDataLoader = (page: number, itemsPerPage: number) => Promise<IPaginationData>;
|
|
311
285
|
export declare class PaginationItemContext {
|
|
312
|
-
item: any;
|
|
313
|
-
parallelItem: any;
|
|
314
|
-
count: number;
|
|
286
|
+
readonly item: any;
|
|
287
|
+
readonly parallelItem: any;
|
|
288
|
+
readonly count: number;
|
|
315
289
|
index: number;
|
|
316
290
|
dataIndex: number;
|
|
317
291
|
constructor(item: any, parallelItem: any, count: number, index: number, dataIndex: number);
|
|
@@ -328,31 +302,59 @@ export interface IPoint {
|
|
|
328
302
|
readonly y: number;
|
|
329
303
|
}
|
|
330
304
|
export interface IShape extends IPoint {
|
|
331
|
-
|
|
305
|
+
readonly center: IPoint;
|
|
306
|
+
support(dir: IPoint): IPoint;
|
|
307
|
+
distance(p: IPoint): number;
|
|
308
|
+
minDistance(shape: IShape): number;
|
|
332
309
|
}
|
|
333
|
-
export type CanvasItemShape = "rect" | "circle";
|
|
334
310
|
export type CanvasItemDirection = "horizontal" | "vertical" | "free" | "none";
|
|
335
|
-
export
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
readonly fullHeight: number;
|
|
340
|
-
readonly ctx: CanvasRenderingContext2D;
|
|
341
|
-
}
|
|
311
|
+
export type CanvasPaintFunc = (ctx: CanvasRenderingContext2D) => MaybePromise<GlobalCompositeOperation | null>;
|
|
312
|
+
/**
|
|
313
|
+
* Interface for an interactive canvas item
|
|
314
|
+
*/
|
|
342
315
|
export interface InteractiveCanvasItem {
|
|
343
316
|
readonly position: IPoint;
|
|
344
|
-
readonly shape: CanvasItemShape;
|
|
345
317
|
readonly shapes: ReadonlyArray<IShape>;
|
|
346
|
-
readonly
|
|
318
|
+
readonly canvas: InteractiveCanvas;
|
|
347
319
|
readonly index: number;
|
|
348
|
-
|
|
320
|
+
readonly active: boolean;
|
|
321
|
+
readonly isValid: boolean;
|
|
322
|
+
readonly validPosition: IPoint;
|
|
323
|
+
draw(ctx: CanvasRenderingContext2D): MaybePromise<void>;
|
|
349
324
|
}
|
|
350
|
-
export type
|
|
325
|
+
export type InteractiveCanvasItems = ReadonlyArray<InteractiveCanvasItem>;
|
|
326
|
+
/**
|
|
327
|
+
* Interface for an interactive canvas component
|
|
328
|
+
* Some properties are optional for compatibility with other kind of renderer functions
|
|
329
|
+
*/
|
|
330
|
+
export interface InteractiveCanvas {
|
|
331
|
+
readonly params?: Record<string, any>;
|
|
332
|
+
readonly $items?: Observable<InteractiveCanvasItems>;
|
|
333
|
+
readonly items?: InteractiveCanvasItems;
|
|
334
|
+
readonly canvas: HTMLCanvasElement;
|
|
335
|
+
readonly lockedItem?: InteractiveCanvasItem;
|
|
336
|
+
readonly selectedItem?: InteractiveCanvasItem;
|
|
337
|
+
hoveredItem?: InteractiveCanvasItem;
|
|
338
|
+
readonly ratio: number;
|
|
339
|
+
readonly styles: CSSStyleDeclaration;
|
|
340
|
+
readonly ctx: CanvasRenderingContext2D;
|
|
341
|
+
readonly canvasWidth: number;
|
|
342
|
+
readonly canvasHeight: number;
|
|
343
|
+
readonly fullHeight: number;
|
|
344
|
+
readonly viewRatio: number;
|
|
345
|
+
readonly rotation: number;
|
|
346
|
+
readonly basePan: number;
|
|
347
|
+
readonly cycles?: ReadonlyArray<number>;
|
|
348
|
+
rendered?: boolean;
|
|
349
|
+
tempPaint(cb: CanvasPaintFunc): Promise<void>;
|
|
350
|
+
}
|
|
351
|
+
export type InteractiveCanvasRenderer = (renderCanvas: InteractiveCanvas, renderCtx: Record<string, any>) => MaybePromise<void>;
|
|
351
352
|
export interface InteractivePanEvent {
|
|
353
|
+
canvas: InteractiveCanvas;
|
|
354
|
+
item: InteractiveCanvasItem;
|
|
352
355
|
pointers?: any[];
|
|
353
356
|
deltaX?: number;
|
|
354
357
|
deltaY?: number;
|
|
355
|
-
item?: InteractiveCanvasItem;
|
|
356
358
|
[key: string]: any;
|
|
357
359
|
}
|
|
358
360
|
export interface InteractiveCanvasPointer {
|
|
@@ -490,6 +492,7 @@ export interface ITableTemplates {
|
|
|
490
492
|
export interface ITableDataQuery {
|
|
491
493
|
[column: string]: string | string[] | boolean;
|
|
492
494
|
}
|
|
495
|
+
export type TableDataItems = ReadonlyArray<any>;
|
|
493
496
|
export type TableDataLoader = (page: number, rowsPerPage: number, orderBy: string, orderDescending: boolean, filter: string, query: ITableDataQuery) => Promise<IPaginationData>;
|
|
494
497
|
export type DragDropEvent<K extends string = "item", T = any> = {
|
|
495
498
|
[key in K]: T;
|
|
@@ -552,7 +555,6 @@ export interface IModuleConfig {
|
|
|
552
555
|
promiseService?: Type<IPromiseService>;
|
|
553
556
|
configService?: Type<IConfigService>;
|
|
554
557
|
dialogService?: Type<IDialogService>;
|
|
555
|
-
wasiImplementation?: Type<IWasi>;
|
|
556
558
|
iconType?: Type<IconProps>;
|
|
557
559
|
iconMap?: IconMap;
|
|
558
560
|
buttonType?: Type<ButtonProps>;
|
|
@@ -1,17 +1,18 @@
|
|
|
1
|
-
import { AfterContentInit, AfterViewInit, ElementRef, OnChanges, QueryList, SimpleChanges, TemplateRef } from "@angular/core";
|
|
2
|
-
import { DragEventHandler, IPaginationData, ITableColumns, ITableDataQuery, ITableTemplates, PaginationItemContext, TableColumns, TableDataLoader } from "../../common-types";
|
|
1
|
+
import { AfterContentInit, AfterViewInit, ElementRef, OnChanges, OnDestroy, QueryList, SimpleChanges, TemplateRef } from "@angular/core";
|
|
2
|
+
import { DragEventHandler, IPaginationData, ITableColumns, ITableDataQuery, ITableTemplates, PaginationItemContext, TableColumns, TableDataItems, TableDataLoader } from "../../common-types";
|
|
3
3
|
import { DynamicTableTemplateDirective } from "../../directives/dynamic-table-template.directive";
|
|
4
4
|
import { PaginationDirective } from "../../directives/pagination.directive";
|
|
5
5
|
import { DropdownDirective } from "../../directives/dropdown.directive";
|
|
6
|
+
import { Observable, Subscription } from "rxjs";
|
|
6
7
|
import * as i0 from "@angular/core";
|
|
7
|
-
export declare class DynamicTableComponent implements AfterContentInit, AfterViewInit, OnChanges {
|
|
8
|
+
export declare class DynamicTableComponent implements AfterContentInit, AfterViewInit, OnChanges, OnDestroy {
|
|
8
9
|
protected element: ElementRef<HTMLElement>;
|
|
9
10
|
dataLoader: TableDataLoader;
|
|
10
|
-
data:
|
|
11
|
+
data: TableDataItems | Observable<TableDataItems>;
|
|
11
12
|
selected: any;
|
|
12
13
|
page: number;
|
|
13
14
|
urlParam: string;
|
|
14
|
-
parallelData:
|
|
15
|
+
parallelData: TableDataItems;
|
|
15
16
|
columns: TableColumns;
|
|
16
17
|
/**
|
|
17
18
|
* Parameter for displaying a simple filter search box
|
|
@@ -52,7 +53,10 @@ export declare class DynamicTableComponent implements AfterContentInit, AfterVie
|
|
|
52
53
|
hasQuery: boolean;
|
|
53
54
|
realColumns: ITableColumns;
|
|
54
55
|
cols: string[];
|
|
56
|
+
sortable: boolean;
|
|
55
57
|
get items(): any[];
|
|
58
|
+
protected localData: TableDataItems;
|
|
59
|
+
protected subscription: Subscription;
|
|
56
60
|
rowTemplate: TemplateRef<any>;
|
|
57
61
|
wrapperTemplate: TemplateRef<any>;
|
|
58
62
|
columnsTemplate: TemplateRef<any>;
|
|
@@ -65,6 +69,7 @@ export declare class DynamicTableComponent implements AfterContentInit, AfterVie
|
|
|
65
69
|
setProperty(name: string, value: any): void;
|
|
66
70
|
ngAfterContentInit(): void;
|
|
67
71
|
ngAfterViewInit(): void;
|
|
72
|
+
ngOnDestroy(): void;
|
|
68
73
|
ngOnChanges(changes: SimpleChanges): void;
|
|
69
74
|
onDragStart(ev: DragEvent, elem: HTMLElement, item: any): void;
|
|
70
75
|
onDragEnter(ev: DragEvent, elem: HTMLElement, item: any): void;
|
|
@@ -1,31 +1,51 @@
|
|
|
1
1
|
import { AfterViewInit, ElementRef, EventEmitter, OnChanges, OnDestroy, OnInit, QueryList, Renderer2 } from "@angular/core";
|
|
2
|
-
import { Subscription } from "rxjs";
|
|
3
|
-
import { InteractiveCanvas, InteractiveCanvasPointer,
|
|
2
|
+
import { BehaviorSubject, Subscription } from "rxjs";
|
|
3
|
+
import { CanvasPaintFunc, InteractiveCanvas, InteractiveCanvasPointer, InteractiveCanvasRenderer, InteractivePanEvent } from "../../common-types";
|
|
4
4
|
import { InteractiveItemComponent } from "./interactive-item.component";
|
|
5
|
+
import { UniversalService } from "../../services/universal.service";
|
|
5
6
|
import * as i0 from "@angular/core";
|
|
6
7
|
export declare class InteractiveCanvasComponent implements InteractiveCanvas, OnInit, OnDestroy, AfterViewInit, OnChanges {
|
|
7
|
-
|
|
8
|
+
readonly renderer: Renderer2;
|
|
9
|
+
readonly universal: UniversalService;
|
|
10
|
+
readonly element: ElementRef<HTMLElement>;
|
|
11
|
+
readonly rootElement: HTMLElement;
|
|
12
|
+
debug: boolean;
|
|
8
13
|
horizontal: boolean;
|
|
9
14
|
selectedIndex: number;
|
|
10
15
|
resizeMode: "fit" | "fill";
|
|
11
16
|
realWidth: number;
|
|
12
17
|
realHeight: number;
|
|
13
|
-
|
|
18
|
+
panOffset: number;
|
|
19
|
+
params: Record<string, any>;
|
|
20
|
+
renderCtx: Record<string, any>;
|
|
21
|
+
beforeItems: ReadonlyArray<InteractiveCanvasRenderer>;
|
|
22
|
+
afterItems: ReadonlyArray<InteractiveCanvasRenderer>;
|
|
14
23
|
selectedIndexChange: EventEmitter<number>;
|
|
15
|
-
|
|
16
|
-
|
|
24
|
+
onRotate: EventEmitter<number>;
|
|
25
|
+
onItemPan: EventEmitter<InteractivePanEvent>;
|
|
26
|
+
onItemPanned: EventEmitter<InteractivePanEvent>;
|
|
27
|
+
onPan: EventEmitter<InteractivePanEvent>;
|
|
28
|
+
onPanned: EventEmitter<InteractivePanEvent>;
|
|
29
|
+
readonly $items: BehaviorSubject<InteractiveItemComponent[]>;
|
|
30
|
+
get items(): ReadonlyArray<InteractiveItemComponent>;
|
|
31
|
+
get canvas(): HTMLCanvasElement;
|
|
32
|
+
get lockedItem(): InteractiveItemComponent;
|
|
33
|
+
get selectedItem(): InteractiveItemComponent;
|
|
34
|
+
get hoveredItem(): InteractiveItemComponent;
|
|
35
|
+
set hoveredItem(item: InteractiveItemComponent);
|
|
17
36
|
ratio: number;
|
|
18
|
-
|
|
37
|
+
styles: CSSStyleDeclaration;
|
|
19
38
|
ctx: CanvasRenderingContext2D;
|
|
20
|
-
|
|
39
|
+
canvasWidth: number;
|
|
40
|
+
canvasHeight: number;
|
|
21
41
|
rotation: number;
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
42
|
+
basePan: number;
|
|
43
|
+
cycles: number[];
|
|
44
|
+
fullHeight: number;
|
|
45
|
+
viewRatio: number;
|
|
46
|
+
protected tempCanvas: HTMLCanvasElement;
|
|
25
47
|
protected shouldDraw: boolean;
|
|
26
|
-
protected panOffset: number;
|
|
27
48
|
protected hoveredIndex: number;
|
|
28
|
-
protected items: ReadonlyArray<InteractiveItemComponent>;
|
|
29
49
|
protected subscription: Subscription;
|
|
30
50
|
protected containerElem: ElementRef<HTMLDivElement>;
|
|
31
51
|
protected canvasElem: ElementRef<HTMLCanvasElement>;
|
|
@@ -34,29 +54,32 @@ export declare class InteractiveCanvasComponent implements InteractiveCanvas, On
|
|
|
34
54
|
protected deltaX: number;
|
|
35
55
|
protected deltaY: number;
|
|
36
56
|
protected lockedIndex: number;
|
|
37
|
-
constructor(renderer: Renderer2);
|
|
57
|
+
constructor(renderer: Renderer2, universal: UniversalService, element: ElementRef<HTMLElement>, rootElement: HTMLElement);
|
|
58
|
+
ctrInit(): void;
|
|
38
59
|
ngOnInit(): void;
|
|
39
60
|
ngOnDestroy(): void;
|
|
40
61
|
ngOnChanges(): void;
|
|
41
62
|
ngAfterViewInit(): void;
|
|
63
|
+
tempPaint(cb: CanvasPaintFunc): Promise<void>;
|
|
42
64
|
resize(): void;
|
|
43
65
|
onTouchStart($event: TouchEvent): void;
|
|
44
66
|
onTouchEnd($event: TouchEvent): void;
|
|
45
|
-
onMouseDown(): void;
|
|
67
|
+
onMouseDown($event: MouseEvent): void;
|
|
46
68
|
onMouseUp($event: MouseEvent): void;
|
|
47
69
|
onMouseMove($event: MouseEvent): void;
|
|
48
70
|
onMouseLeave(): void;
|
|
49
|
-
onPanStart(
|
|
50
|
-
|
|
71
|
+
onPanStart(): void;
|
|
72
|
+
onPanMove($event: any): void;
|
|
51
73
|
onPanEnd(): void;
|
|
52
|
-
protected
|
|
74
|
+
protected fixRotation(): void;
|
|
53
75
|
protected fixItems(): void;
|
|
54
76
|
protected selectItem(pointer: InteractiveCanvasPointer): void;
|
|
55
77
|
protected getIndexUnderPointer(pointer: InteractiveCanvasPointer): number;
|
|
56
78
|
protected updateCursor(): void;
|
|
57
79
|
protected getCursor(): string;
|
|
58
80
|
protected redraw(): void;
|
|
81
|
+
protected drawItems(): Promise<void>;
|
|
59
82
|
protected draw(): Promise<void>;
|
|
60
83
|
static ɵfac: i0.ɵɵFactoryDeclaration<InteractiveCanvasComponent, never>;
|
|
61
|
-
static ɵcmp: i0.ɵɵComponentDeclaration<InteractiveCanvasComponent, "interactive-canvas", never, { "horizontal": { "alias": "horizontal"; "required": false; }; "selectedIndex": { "alias": "selectedIndex"; "required": false; }; "resizeMode": { "alias": "resizeMode"; "required": false; }; "realWidth": { "alias": "realWidth"; "required": false; }; "realHeight": { "alias": "realHeight"; "required": false; }; "
|
|
84
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<InteractiveCanvasComponent, "interactive-canvas", never, { "debug": { "alias": "debug"; "required": false; }; "horizontal": { "alias": "horizontal"; "required": false; }; "selectedIndex": { "alias": "selectedIndex"; "required": false; }; "resizeMode": { "alias": "resizeMode"; "required": false; }; "realWidth": { "alias": "realWidth"; "required": false; }; "realHeight": { "alias": "realHeight"; "required": false; }; "panOffset": { "alias": "panOffset"; "required": false; }; "params": { "alias": "params"; "required": false; }; "renderCtx": { "alias": "renderCtx"; "required": false; }; "beforeItems": { "alias": "beforeItems"; "required": false; }; "afterItems": { "alias": "afterItems"; "required": false; }; }, { "selectedIndexChange": "selectedIndexChange"; "onRotate": "onRotate"; "onItemPan": "onItemPan"; "onItemPanned": "onItemPanned"; "onPan": "onPan"; "onPanned": "onPanned"; }, ["itemList"], never, false, never>;
|
|
62
85
|
}
|
|
@@ -1,15 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { IShape } from "../../common-types";
|
|
2
2
|
import { InteractiveItemComponent } from "./interactive-item.component";
|
|
3
|
-
import { InteractiveCanvasComponent } from "./interactive-canvas.component";
|
|
4
3
|
import * as i0 from "@angular/core";
|
|
5
4
|
export declare class InteractiveCircleComponent extends InteractiveItemComponent {
|
|
6
|
-
protected iCanvas: InteractiveCanvasComponent;
|
|
7
5
|
radius: number;
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
calcShape(x: number, y: number): IShape;
|
|
12
|
-
draw(ctx: CanvasRenderingContext2D, scale?: number): void;
|
|
6
|
+
constructor();
|
|
7
|
+
draw(ctx: CanvasRenderingContext2D): void;
|
|
8
|
+
protected calcShape(x: number, y: number): IShape;
|
|
13
9
|
static ɵfac: i0.ɵɵFactoryDeclaration<InteractiveCircleComponent, never>;
|
|
14
10
|
static ɵcmp: i0.ɵɵComponentDeclaration<InteractiveCircleComponent, "interactive-circle", never, { "radius": { "alias": "radius"; "required": false; }; }, {}, never, never, false, never>;
|
|
15
11
|
}
|
|
@@ -1,38 +1,42 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { CanvasItemDirection, CanvasItemShape, InteractiveCanvas, InteractiveCanvasItem, InteractivePanEvent, IPoint, IShape } from "../../common-types";
|
|
1
|
+
import { OnChanges } from "@angular/core";
|
|
2
|
+
import { CanvasItemDirection, InteractiveCanvas, InteractiveCanvasItem, IPoint, IShape } from "../../common-types";
|
|
4
3
|
import { Point } from "../../utils/geometry";
|
|
4
|
+
import { MaybePromise } from "../../helper-types";
|
|
5
5
|
import * as i0 from "@angular/core";
|
|
6
|
-
export declare class InteractiveItemComponent implements
|
|
7
|
-
protected cycles: number[];
|
|
6
|
+
export declare class InteractiveItemComponent implements OnChanges, InteractiveCanvasItem {
|
|
8
7
|
protected pos: Point;
|
|
9
8
|
protected mShapes: IShape[];
|
|
10
|
-
|
|
9
|
+
get shapes(): ReadonlyArray<IShape>;
|
|
10
|
+
get hovered(): boolean;
|
|
11
|
+
set hovered(value: boolean);
|
|
12
|
+
get x(): number;
|
|
11
13
|
set x(value: number);
|
|
14
|
+
get y(): number;
|
|
12
15
|
set y(value: number);
|
|
16
|
+
get position(): IPoint;
|
|
13
17
|
set position(value: IPoint);
|
|
14
|
-
|
|
18
|
+
get isValid(): boolean;
|
|
19
|
+
get validPosition(): IPoint;
|
|
20
|
+
set validPosition(value: IPoint);
|
|
15
21
|
direction: CanvasItemDirection;
|
|
16
22
|
disabled: boolean;
|
|
17
|
-
|
|
18
|
-
onPan: EventEmitter<InteractivePanEvent>;
|
|
19
|
-
onPanStart: EventEmitter<InteractivePanEvent>;
|
|
20
|
-
onPanEnd: EventEmitter<InteractivePanEvent>;
|
|
21
|
-
active: boolean;
|
|
23
|
+
canvas: InteractiveCanvas;
|
|
22
24
|
index: number;
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
get x(): number;
|
|
27
|
-
get y(): number;
|
|
28
|
-
get shape(): CanvasItemShape;
|
|
25
|
+
active: boolean;
|
|
26
|
+
protected valid: boolean;
|
|
27
|
+
protected validPos: Point;
|
|
29
28
|
constructor();
|
|
30
|
-
|
|
29
|
+
draw(ctx: CanvasRenderingContext2D): MaybePromise<void>;
|
|
31
30
|
ngOnChanges(): void;
|
|
32
|
-
calcShapes(
|
|
31
|
+
calcShapes(): void;
|
|
33
32
|
hit(point: Point): boolean;
|
|
34
|
-
|
|
35
|
-
|
|
33
|
+
moveBy(dx: number, dy: number): void;
|
|
34
|
+
moveEnd(): void;
|
|
35
|
+
protected isValidByParams(): boolean;
|
|
36
|
+
protected isValidByDistance(other: InteractiveCanvasItem): boolean;
|
|
37
|
+
protected distToPixels(value: number): number;
|
|
38
|
+
protected getMinDistance(other: InteractiveCanvasItem): number;
|
|
39
|
+
protected calcShape(x: number, y: number): IShape;
|
|
36
40
|
static ɵfac: i0.ɵɵFactoryDeclaration<InteractiveItemComponent, never>;
|
|
37
|
-
static ɵcmp: i0.ɵɵComponentDeclaration<InteractiveItemComponent, "__interactive-item__", never, { "x": { "alias": "x"; "required": false; }; "y": { "alias": "y"; "required": false; }; "position": { "alias": "position"; "required": false; }; "
|
|
41
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<InteractiveItemComponent, "__interactive-item__", never, { "x": { "alias": "x"; "required": false; }; "y": { "alias": "y"; "required": false; }; "position": { "alias": "position"; "required": false; }; "direction": { "alias": "direction"; "required": false; }; "disabled": { "alias": "disabled"; "required": false; }; }, {}, never, never, false, never>;
|
|
38
42
|
}
|
|
@@ -1,16 +1,13 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { IShape } from "../../common-types";
|
|
2
2
|
import { InteractiveItemComponent } from "./interactive-item.component";
|
|
3
|
-
import { InteractiveCanvasComponent } from "./interactive-canvas.component";
|
|
4
3
|
import * as i0 from "@angular/core";
|
|
5
4
|
export declare class InteractiveRectComponent extends InteractiveItemComponent {
|
|
6
|
-
protected iCanvas: InteractiveCanvasComponent;
|
|
7
5
|
width: number;
|
|
8
6
|
height: number;
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
calcShape(x: number, y: number): IShape;
|
|
13
|
-
draw(ctx: CanvasRenderingContext2D, scale?: number): void;
|
|
7
|
+
rotation: number;
|
|
8
|
+
constructor();
|
|
9
|
+
draw(ctx: CanvasRenderingContext2D): void;
|
|
10
|
+
protected calcShape(x: number, y: number): IShape;
|
|
14
11
|
static ɵfac: i0.ɵɵFactoryDeclaration<InteractiveRectComponent, never>;
|
|
15
|
-
static ɵcmp: i0.ɵɵComponentDeclaration<InteractiveRectComponent, "interactive-rect", never, { "width": { "alias": "width"; "required": false; }; "height": { "alias": "height"; "required": false; }; }, {}, never, never, false, never>;
|
|
12
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<InteractiveRectComponent, "interactive-rect", never, { "width": { "alias": "width"; "required": false; }; "height": { "alias": "height"; "required": false; }; "rotation": { "alias": "rotation"; "required": false; }; }, {}, never, never, false, never>;
|
|
16
13
|
}
|
|
@@ -25,7 +25,6 @@ import { CacheService } from "./services/cache.service";
|
|
|
25
25
|
import { ComponentLoaderService } from "./services/component-loader.service";
|
|
26
26
|
import { TranslatedUrlSerializer } from "./services/translated-url.serializer";
|
|
27
27
|
import { UniversalService } from "./services/universal.service";
|
|
28
|
-
import { WasmService } from "./services/wasm.service";
|
|
29
28
|
import { DragDropEventPlugin } from "./plugins/drag-drop-event.plugin";
|
|
30
29
|
import { ResizeEventPlugin } from "./plugins/resize-event.plugin";
|
|
31
30
|
import { ScrollEventPlugin } from "./plugins/scroll-event.plugin";
|
|
@@ -60,15 +59,13 @@ import { CloseBtnComponent } from "./components/close-btn/close-btn.component";
|
|
|
60
59
|
import { DropListComponent } from "./components/drop-list/drop-list.component";
|
|
61
60
|
import { DynamicTableComponent } from "./components/dynamic-table/dynamic-table.component";
|
|
62
61
|
import { InteractiveCanvasComponent } from "./components/interactive-canvas/interactive-canvas.component";
|
|
63
|
-
import { InteractiveCircleComponent } from "./components/interactive-canvas/interactive-circle.component";
|
|
64
|
-
import { InteractiveRectComponent } from "./components/interactive-canvas/interactive-rect.component";
|
|
65
62
|
import { PaginationMenuComponent } from "./components/pagination-menu/pagination-menu.component";
|
|
66
63
|
import { UnorderedListComponent } from "./components/unordered-list/unordered-list.component";
|
|
67
64
|
import { UploadComponent } from "./components/upload/upload.component";
|
|
68
65
|
export declare const pipes: (typeof FilterPipe | typeof FormatNumberPipe | typeof GlobalTemplatePipe | typeof IncludesPipe | typeof ReducePipe | typeof RoundPipe | typeof SafeHtmlPipe | typeof TranslatePipe)[];
|
|
69
66
|
export declare const directives: (typeof AsyncMethodBase | typeof AsyncMethodTargetDirective | typeof BackgroundDirective | typeof ComponentLoaderDirective | typeof DynamicTableTemplateDirective | typeof GlobalTemplateDirective | typeof IconDirective | typeof NgxTemplateOutletDirective | typeof PaginationDirective | typeof PaginationItemDirective | typeof ResourceIfDirective | typeof StickyDirective | typeof StickyClassDirective | typeof DropdownDirective | typeof DropdownContentDirective | typeof TabsItemDirective | typeof UnorderedListItemDirective | typeof UnorderedListTemplateDirective)[];
|
|
70
|
-
export declare const components: (typeof ChipsComponent | typeof CloseBtnComponent | typeof DropListComponent | typeof DynamicTableComponent | typeof
|
|
71
|
-
export declare const providers: (typeof
|
|
67
|
+
export declare const components: (typeof ChipsComponent | typeof CloseBtnComponent | typeof DropListComponent | typeof DynamicTableComponent | typeof PaginationMenuComponent | typeof InteractiveCanvasComponent | typeof UnorderedListComponent | typeof UploadComponent)[];
|
|
68
|
+
export declare const providers: (typeof FilterPipe | typeof FormatNumberPipe | typeof GlobalTemplatePipe | typeof IncludesPipe | typeof ReducePipe | typeof RoundPipe | typeof SafeHtmlPipe | typeof TranslatePipe | typeof BaseHttpClient | typeof BaseHttpService | typeof AuthGuard | typeof AclService | typeof StaticAuthService | typeof ConfigService | typeof BaseDialogService | typeof ErrorHandlerService | typeof EventsService | typeof FormatterService | typeof GlobalTemplateService | typeof IconService | typeof StaticLanguageService | typeof OpenApiService | typeof PromiseService | typeof SocketService | typeof StateService | typeof StorageService | typeof BaseToasterService | typeof CacheService | typeof ComponentLoaderService | typeof TranslatedUrlSerializer | typeof UniversalService | typeof DeviceDetectorService | {
|
|
72
69
|
provide: import("@angular/core").InjectionToken<import("@angular/platform-browser").EventManagerPlugin[]>;
|
|
73
70
|
useClass: typeof DragDropEventPlugin;
|
|
74
71
|
multi: boolean;
|
package/ngx-utils/tokens.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { InjectionToken, Type } from "@angular/core";
|
|
2
2
|
import { Request } from "express";
|
|
3
|
-
import { ButtonProps, DynamicEntryComponents, DynamicModuleInfo, ErrorHandlerCallback, IApiService, IAuthService, IConfigService, IConfiguration, IconMap, IconProps, IDialogService, IIconService, ILanguageService, IPromiseService, IToasterService,
|
|
3
|
+
import { ButtonProps, DynamicEntryComponents, DynamicModuleInfo, ErrorHandlerCallback, IApiService, IAuthService, IConfigService, IConfiguration, IconMap, IconProps, IDialogService, IIconService, ILanguageService, IPromiseService, IToasterService, OpenApiSchemas, ResizeEventStrategy } from "./common-types";
|
|
4
4
|
export declare const ICON_TYPE: InjectionToken<Type<IconProps>>;
|
|
5
5
|
export declare const ICON_MAP: InjectionToken<IconMap>;
|
|
6
6
|
export declare const BUTTON_TYPE: InjectionToken<Type<ButtonProps>>;
|
|
@@ -12,7 +12,6 @@ export declare const TOASTER_SERVICE: InjectionToken<IToasterService>;
|
|
|
12
12
|
export declare const DIALOG_SERVICE: InjectionToken<IDialogService<any>>;
|
|
13
13
|
export declare const SOCKET_IO_PATH: InjectionToken<string>;
|
|
14
14
|
export declare const PROMISE_SERVICE: InjectionToken<IPromiseService>;
|
|
15
|
-
export declare const WASI_IMPLEMENTATION: InjectionToken<Type<IWasi>>;
|
|
16
15
|
export declare const EXPRESS_REQUEST: InjectionToken<Request>;
|
|
17
16
|
export declare const API_SERVICE: InjectionToken<IApiService>;
|
|
18
17
|
export declare const DYNAMIC_ENTRY_COMPONENTS: InjectionToken<DynamicEntryComponents[]>;
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { CanvasColor } from "../common-types";
|
|
2
|
+
export declare function drawRect(ctx: CanvasRenderingContext2D, w: number, h: number): void;
|
|
3
|
+
export declare function drawOval(ctx: CanvasRenderingContext2D, w: number, h: number): void;
|
|
2
4
|
export declare class CanvasUtils {
|
|
3
5
|
static manipulatePixels(canvas: HTMLCanvasElement, ctx: CanvasRenderingContext2D, colorTransformer: (color: CanvasColor, greyscale?: number) => CanvasColor): void;
|
|
4
6
|
static thresholding(canvas: HTMLCanvasElement, ctx: CanvasRenderingContext2D, threshold: number, colorTransformer: (color: CanvasColor, limit: boolean, greyscale?: number) => CanvasColor): void;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { IPoint, IShape } from "../../common-types";
|
|
2
|
+
interface SimplexLine {
|
|
3
|
+
p: IPoint;
|
|
4
|
+
a: IPoint;
|
|
5
|
+
b: IPoint;
|
|
6
|
+
}
|
|
7
|
+
type Simplex = SimplexLine[];
|
|
8
|
+
interface ClosestPointResult {
|
|
9
|
+
simplex: Simplex;
|
|
10
|
+
closest: IPoint;
|
|
11
|
+
bary: number[];
|
|
12
|
+
}
|
|
13
|
+
export declare function closestPointToOrigin(simplex: Simplex): ClosestPointResult;
|
|
14
|
+
/**
|
|
15
|
+
* ====== GJK distance (2D) ======
|
|
16
|
+
* We keep, for each simplex vertex, the Minkowski point p = a - b and the witnesses a,b.
|
|
17
|
+
* @param A
|
|
18
|
+
* @param B
|
|
19
|
+
*/
|
|
20
|
+
export declare function gjkDistance(A: IShape, B: IShape): {
|
|
21
|
+
distance: number;
|
|
22
|
+
pa: IPoint;
|
|
23
|
+
pb: IPoint;
|
|
24
|
+
};
|
|
25
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { IPoint } from "../../common-types";
|
|
2
|
+
export declare function dotProduct(a: IPoint, b: IPoint): number;
|
|
3
|
+
export declare function isPoint(v: IPoint | number): v is IPoint;
|
|
4
|
+
export declare function perpendicular(p: IPoint): IPoint;
|
|
5
|
+
export declare function ptAdd(a: IPoint, b: IPoint): IPoint;
|
|
6
|
+
export declare function ptDistance(a: IPoint, b: IPoint): number;
|
|
7
|
+
export declare function ptLength(p: IPoint): number;
|
|
8
|
+
export declare function ptMultiply(a: IPoint, b: IPoint | number): IPoint;
|
|
9
|
+
export declare function ptSubtract(a: IPoint, b: IPoint): IPoint;
|
|
10
|
+
export declare function rotateDeg(p: IPoint, ang: number): IPoint;
|
|
11
|
+
export declare function rotateRad(p: IPoint, ang: number): IPoint;
|
|
12
|
+
export declare function toDegrees(rad: number): number;
|
|
13
|
+
export declare function toRadians(deg: number): number;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { IPoint, IShape } from "../../common-types";
|
|
2
|
+
declare abstract class Shape implements IShape {
|
|
3
|
+
get center(): IPoint;
|
|
4
|
+
get x(): number;
|
|
5
|
+
get y(): number;
|
|
6
|
+
protected pt: IPoint;
|
|
7
|
+
protected constructor(x: number, y: number);
|
|
8
|
+
abstract support(dir: IPoint): IPoint;
|
|
9
|
+
distance(p: IPoint): number;
|
|
10
|
+
minDistance(shape: IShape): number;
|
|
11
|
+
}
|
|
12
|
+
export declare class Point extends Shape {
|
|
13
|
+
static Zero: Point;
|
|
14
|
+
get length(): number;
|
|
15
|
+
get perpendicular(): Point;
|
|
16
|
+
constructor(xOrP: number | IPoint, y?: number);
|
|
17
|
+
support(): IPoint;
|
|
18
|
+
add(p: Point): Point;
|
|
19
|
+
sub(p: Point): Point;
|
|
20
|
+
mul(p: Point | number): Point;
|
|
21
|
+
dot(p: Point): Point;
|
|
22
|
+
distance(p: IPoint): number;
|
|
23
|
+
lerp(p: Point, ratio: number): Point;
|
|
24
|
+
perpendicularTo(p: Point, length: number): Point;
|
|
25
|
+
circleWith(a: Point, b: Point): Circle;
|
|
26
|
+
tangents(c: Circle): Point[];
|
|
27
|
+
angle(p: Point): number;
|
|
28
|
+
rotateAround(p: Point, angle: number): Point;
|
|
29
|
+
}
|
|
30
|
+
export declare class Rect extends Shape {
|
|
31
|
+
readonly width: number;
|
|
32
|
+
readonly height: number;
|
|
33
|
+
readonly rotation: number;
|
|
34
|
+
constructor(x: number, y: number, width: number, height: number, rotation?: number);
|
|
35
|
+
support(dir: IPoint): IPoint;
|
|
36
|
+
}
|
|
37
|
+
export declare class Oval extends Shape {
|
|
38
|
+
readonly width: number;
|
|
39
|
+
readonly height: number;
|
|
40
|
+
readonly rotation: number;
|
|
41
|
+
constructor(x: number, y: number, width: number, height: number, rotation?: number);
|
|
42
|
+
support(dir: IPoint): IPoint;
|
|
43
|
+
}
|
|
44
|
+
export declare class Circle extends Oval {
|
|
45
|
+
readonly radius: number;
|
|
46
|
+
constructor(x: number, y: number, radius: number, rotation?: number);
|
|
47
|
+
}
|
|
48
|
+
export {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
export declare const EPSILON = 1e-9;
|
|
1
2
|
export declare class MathUtils {
|
|
2
|
-
static readonly EPSILON: number;
|
|
3
3
|
static equal(a: number, b: number, epsilon?: number): boolean;
|
|
4
4
|
static clamp(value: number, min: number, max: number): number;
|
|
5
5
|
static round(value: number, precision?: number, divider?: number): number;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Type, ValueProvider, ɵComponentDef as ComponentDef } from "@angular/core";
|
|
2
|
-
import { CssSelector, CssSelectorList } from "../common-types";
|
|
2
|
+
import { CssSelector, CssSelectorList, TypedFactoryProvider } from "../common-types";
|
|
3
3
|
export declare function isBrowser(): boolean;
|
|
4
4
|
/**
|
|
5
5
|
* Returns an elements root
|
|
@@ -20,3 +20,4 @@ export declare function getComponentDef<T>(type: Type<T>): ComponentDef<T>;
|
|
|
20
20
|
export declare function parseSelector(selector: string | CssSelector): CssSelector;
|
|
21
21
|
export declare function selectorMatchesList(list: CssSelectorList, selector: CssSelector): boolean;
|
|
22
22
|
export declare function provideEntryComponents(components: Type<any>[], moduleId?: string): ValueProvider;
|
|
23
|
+
export declare function provideWithOptions<O extends Object, T = any>(type: Type<T>, options: O): TypedFactoryProvider<T>;
|