@stemy/ngx-utils 19.7.0 → 19.7.2
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 +564 -316
- package/fesm2022/stemy-ngx-utils.mjs.map +1 -1
- package/ngx-utils/common-types.d.ts +68 -20
- package/ngx-utils/components/dynamic-table/dynamic-table.component.d.ts +10 -5
- package/ngx-utils/components/interactive-canvas/interactive-canvas.component.d.ts +43 -23
- package/ngx-utils/components/interactive-canvas/interactive-item.component.d.ts +9 -3
- package/ngx-utils/ngx-utils.imports.d.ts +2 -2
- package/ngx-utils/utils/canvas.d.ts +1 -0
- package/ngx-utils/utils/geometry/functions.d.ts +12 -5
- package/ngx-utils/utils/geometry/gjk.d.ts +3 -0
- package/ngx-utils/utils/geometry/index.d.ts +2 -1
- package/ngx-utils/utils/geometry/shapes.d.ts +15 -8
- package/ngx-utils/utils/math.utils.d.ts +35 -1
- package/package.json +1 -1
- package/public_api.d.ts +3 -3
- package/ngx-utils/utils/geometry/distance.d.ts +0 -25
|
@@ -283,9 +283,9 @@ export interface IPaginationData {
|
|
|
283
283
|
}
|
|
284
284
|
export type PaginationDataLoader = (page: number, itemsPerPage: number) => Promise<IPaginationData>;
|
|
285
285
|
export declare class PaginationItemContext {
|
|
286
|
-
item: any;
|
|
287
|
-
parallelItem: any;
|
|
288
|
-
count: number;
|
|
286
|
+
readonly item: any;
|
|
287
|
+
readonly parallelItem: any;
|
|
288
|
+
readonly count: number;
|
|
289
289
|
index: number;
|
|
290
290
|
dataIndex: number;
|
|
291
291
|
constructor(item: any, parallelItem: any, count: number, index: number, dataIndex: number);
|
|
@@ -301,45 +301,92 @@ export interface IPoint {
|
|
|
301
301
|
readonly x: number;
|
|
302
302
|
readonly y: number;
|
|
303
303
|
}
|
|
304
|
+
export interface ShapeIntersection {
|
|
305
|
+
hit: boolean;
|
|
306
|
+
pa?: IPoint;
|
|
307
|
+
pb?: IPoint;
|
|
308
|
+
point?: IPoint;
|
|
309
|
+
}
|
|
310
|
+
export interface ShapeDistance {
|
|
311
|
+
distance: number;
|
|
312
|
+
pa?: IPoint;
|
|
313
|
+
pb?: IPoint;
|
|
314
|
+
}
|
|
304
315
|
export interface IShape extends IPoint {
|
|
305
316
|
readonly center: IPoint;
|
|
306
317
|
support(dir: IPoint): IPoint;
|
|
307
|
-
|
|
308
|
-
|
|
318
|
+
move(pos: IPoint): IShape;
|
|
319
|
+
intersection(shape: IShape): ShapeIntersection;
|
|
320
|
+
intersects(shape: IShape): boolean;
|
|
321
|
+
minDistance(shape: IShape): ShapeDistance;
|
|
322
|
+
distance(shape: IShape): number;
|
|
309
323
|
}
|
|
324
|
+
export type CanvasResizeMode = "fit" | "fill";
|
|
310
325
|
export type CanvasItemDirection = "horizontal" | "vertical" | "free" | "none";
|
|
311
326
|
export type CanvasPaintFunc = (ctx: CanvasRenderingContext2D) => MaybePromise<GlobalCompositeOperation | null>;
|
|
327
|
+
export type RangeCoords = [from: number, to: number];
|
|
328
|
+
export type RectCoords = [left: number, top: number, right: number, bottom: number];
|
|
329
|
+
/**
|
|
330
|
+
* Interface for an interactive canvas params
|
|
331
|
+
*/
|
|
332
|
+
export interface InteractiveCanvasParams {
|
|
333
|
+
xRange?: RangeCoords;
|
|
334
|
+
yRange?: RangeCoords;
|
|
335
|
+
exclusions?: ReadonlyArray<RectCoords>;
|
|
336
|
+
[key: string]: any;
|
|
337
|
+
}
|
|
338
|
+
/**
|
|
339
|
+
* Interface for an interactive canvas item
|
|
340
|
+
*/
|
|
341
|
+
export interface InteractiveCanvasItem {
|
|
342
|
+
readonly position: IPoint;
|
|
343
|
+
readonly shapes: ReadonlyArray<IShape>;
|
|
344
|
+
readonly canvas: InteractiveCanvas;
|
|
345
|
+
readonly index: number;
|
|
346
|
+
readonly active: boolean;
|
|
347
|
+
readonly isValid: boolean;
|
|
348
|
+
readonly validPosition: IPoint;
|
|
349
|
+
draw(ctx: CanvasRenderingContext2D): MaybePromise<void>;
|
|
350
|
+
}
|
|
351
|
+
export type InteractiveCanvasItems = ReadonlyArray<InteractiveCanvasItem>;
|
|
352
|
+
/**
|
|
353
|
+
* Interface for an interactive canvas component
|
|
354
|
+
* Some properties are optional for compatibility with other kind of renderer functions
|
|
355
|
+
*/
|
|
312
356
|
export interface InteractiveCanvas {
|
|
313
|
-
readonly
|
|
314
|
-
readonly
|
|
357
|
+
readonly infinite?: boolean;
|
|
358
|
+
readonly resizeMode?: CanvasResizeMode;
|
|
359
|
+
readonly params?: InteractiveCanvasParams;
|
|
360
|
+
readonly realWidth?: number;
|
|
361
|
+
readonly realHeight?: number;
|
|
362
|
+
readonly $items?: Observable<InteractiveCanvasItems>;
|
|
363
|
+
readonly items?: InteractiveCanvasItems;
|
|
315
364
|
readonly canvas: HTMLCanvasElement;
|
|
365
|
+
readonly lockedItem?: InteractiveCanvasItem;
|
|
366
|
+
readonly selectedItem?: InteractiveCanvasItem;
|
|
367
|
+
hoveredItem?: InteractiveCanvasItem;
|
|
368
|
+
readonly xRange?: RangeCoords;
|
|
369
|
+
readonly yRange?: RangeCoords;
|
|
316
370
|
readonly ratio: number;
|
|
317
371
|
readonly styles: CSSStyleDeclaration;
|
|
318
372
|
readonly ctx: CanvasRenderingContext2D;
|
|
319
373
|
readonly canvasWidth: number;
|
|
320
374
|
readonly canvasHeight: number;
|
|
321
375
|
readonly fullHeight: number;
|
|
376
|
+
readonly viewRatio: number;
|
|
322
377
|
readonly rotation: number;
|
|
323
378
|
readonly basePan: number;
|
|
379
|
+
readonly cycles?: ReadonlyArray<number>;
|
|
380
|
+
readonly exclusions?: ReadonlyArray<IShape>;
|
|
324
381
|
rendered?: boolean;
|
|
325
382
|
tempPaint(cb: CanvasPaintFunc): Promise<void>;
|
|
326
383
|
}
|
|
327
|
-
export
|
|
328
|
-
readonly position: IPoint;
|
|
329
|
-
readonly shapes: ReadonlyArray<IShape>;
|
|
330
|
-
readonly canvas: InteractiveCanvas;
|
|
331
|
-
readonly index: number;
|
|
332
|
-
readonly active: boolean;
|
|
333
|
-
readonly isValid: boolean;
|
|
334
|
-
readonly validPosition: IPoint;
|
|
335
|
-
draw(ctx: CanvasRenderingContext2D): MaybePromise<void>;
|
|
336
|
-
}
|
|
337
|
-
export type InteractiveDrawFn = (ctx: InteractiveCanvas) => void | Promise<void>;
|
|
384
|
+
export type InteractiveCanvasRenderer = (renderCanvas: InteractiveCanvas, renderCtx: Record<string, any>) => MaybePromise<void>;
|
|
338
385
|
export interface InteractivePanEvent {
|
|
339
|
-
|
|
386
|
+
canvas: InteractiveCanvas;
|
|
387
|
+
item: InteractiveCanvasItem;
|
|
340
388
|
deltaX?: number;
|
|
341
389
|
deltaY?: number;
|
|
342
|
-
item?: InteractiveCanvasItem;
|
|
343
390
|
[key: string]: any;
|
|
344
391
|
}
|
|
345
392
|
export interface InteractiveCanvasPointer {
|
|
@@ -477,6 +524,7 @@ export interface ITableTemplates {
|
|
|
477
524
|
export interface ITableDataQuery {
|
|
478
525
|
[column: string]: string | string[] | boolean;
|
|
479
526
|
}
|
|
527
|
+
export type TableDataItems = ReadonlyArray<any>;
|
|
480
528
|
export type TableDataLoader = (page: number, rowsPerPage: number, orderBy: string, orderDescending: boolean, filter: string, query: ITableDataQuery) => Promise<IPaginationData>;
|
|
481
529
|
export type DragDropEvent<K extends string = "item", T = any> = {
|
|
482
530
|
[key in K]: T;
|
|
@@ -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,54 +1,72 @@
|
|
|
1
1
|
import { AfterViewInit, ElementRef, EventEmitter, OnChanges, OnDestroy, OnInit, QueryList, Renderer2 } from "@angular/core";
|
|
2
|
-
import { Subscription } from "rxjs";
|
|
3
|
-
import { CanvasPaintFunc, InteractiveCanvas, InteractiveCanvasItem, InteractiveCanvasPointer,
|
|
2
|
+
import { BehaviorSubject, Subscription } from "rxjs";
|
|
3
|
+
import { CanvasPaintFunc, CanvasResizeMode, InteractiveCanvas, InteractiveCanvasItem, InteractiveCanvasParams, InteractiveCanvasPointer, InteractiveCanvasRenderer, InteractivePanEvent, IPoint, RangeCoords } from "../../common-types";
|
|
4
|
+
import { Point, Rect } from "../../utils/geometry";
|
|
4
5
|
import { InteractiveItemComponent } from "./interactive-item.component";
|
|
5
6
|
import { UniversalService } from "../../services/universal.service";
|
|
6
7
|
import * as i0 from "@angular/core";
|
|
7
8
|
export declare class InteractiveCanvasComponent implements InteractiveCanvas, OnInit, OnDestroy, AfterViewInit, OnChanges {
|
|
8
9
|
readonly renderer: Renderer2;
|
|
9
10
|
readonly universal: UniversalService;
|
|
10
|
-
|
|
11
|
-
|
|
11
|
+
infinite: boolean;
|
|
12
|
+
resizeMode: CanvasResizeMode;
|
|
13
|
+
params: InteractiveCanvasParams;
|
|
14
|
+
/**
|
|
15
|
+
* Real life-size width of the canvas
|
|
16
|
+
*/
|
|
17
|
+
realWidth: number;
|
|
18
|
+
/**
|
|
19
|
+
* Real life-size height of the canvas
|
|
20
|
+
*/
|
|
21
|
+
realHeight: number;
|
|
12
22
|
debug: boolean;
|
|
13
23
|
horizontal: boolean;
|
|
14
24
|
selectedIndex: number;
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
25
|
+
/**
|
|
26
|
+
* Relative offset of the panning. It is based on the rendered canvas height
|
|
27
|
+
*/
|
|
18
28
|
panOffset: number;
|
|
19
|
-
|
|
20
|
-
beforeItems:
|
|
21
|
-
afterItems:
|
|
29
|
+
renderCtx: Record<string, any>;
|
|
30
|
+
beforeItems: ReadonlyArray<InteractiveCanvasRenderer>;
|
|
31
|
+
afterItems: ReadonlyArray<InteractiveCanvasRenderer>;
|
|
22
32
|
selectedIndexChange: EventEmitter<number>;
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
33
|
+
onRotate: EventEmitter<number>;
|
|
34
|
+
onItemPan: EventEmitter<InteractivePanEvent>;
|
|
35
|
+
onItemPanned: EventEmitter<InteractivePanEvent>;
|
|
36
|
+
onPan: EventEmitter<InteractivePanEvent>;
|
|
37
|
+
onPanned: EventEmitter<InteractivePanEvent>;
|
|
38
|
+
readonly $items: BehaviorSubject<InteractiveItemComponent[]>;
|
|
39
|
+
get items(): ReadonlyArray<InteractiveItemComponent>;
|
|
26
40
|
get canvas(): HTMLCanvasElement;
|
|
27
41
|
get lockedItem(): InteractiveItemComponent;
|
|
28
42
|
get selectedItem(): InteractiveItemComponent;
|
|
29
43
|
get hoveredItem(): InteractiveItemComponent;
|
|
44
|
+
set hoveredItem(item: InteractiveItemComponent);
|
|
45
|
+
xRange: RangeCoords;
|
|
46
|
+
yRange: RangeCoords;
|
|
30
47
|
ratio: number;
|
|
31
48
|
styles: CSSStyleDeclaration;
|
|
32
49
|
ctx: CanvasRenderingContext2D;
|
|
33
50
|
canvasWidth: number;
|
|
34
51
|
canvasHeight: number;
|
|
52
|
+
fullHeight: number;
|
|
53
|
+
viewRatio: number;
|
|
35
54
|
rotation: number;
|
|
36
55
|
basePan: number;
|
|
37
|
-
|
|
56
|
+
cycles: number[];
|
|
57
|
+
exclusions: Rect[];
|
|
38
58
|
protected tempCanvas: HTMLCanvasElement;
|
|
39
59
|
protected shouldDraw: boolean;
|
|
40
60
|
protected hoveredIndex: number;
|
|
41
|
-
protected itemComponents: InteractiveItemComponent[];
|
|
42
61
|
protected subscription: Subscription;
|
|
43
62
|
protected containerElem: ElementRef<HTMLDivElement>;
|
|
44
63
|
protected canvasElem: ElementRef<HTMLCanvasElement>;
|
|
45
64
|
protected itemList: QueryList<InteractiveItemComponent>;
|
|
46
65
|
protected touched: boolean;
|
|
47
|
-
protected
|
|
48
|
-
protected
|
|
66
|
+
protected panStartRotation: number;
|
|
67
|
+
protected panStartPos: IPoint;
|
|
49
68
|
protected lockedIndex: number;
|
|
50
|
-
constructor(renderer: Renderer2, universal: UniversalService
|
|
51
|
-
ctrInit(): void;
|
|
69
|
+
constructor(renderer: Renderer2, universal: UniversalService);
|
|
52
70
|
ngOnInit(): void;
|
|
53
71
|
ngOnDestroy(): void;
|
|
54
72
|
ngOnChanges(): void;
|
|
@@ -57,22 +75,24 @@ export declare class InteractiveCanvasComponent implements InteractiveCanvas, On
|
|
|
57
75
|
resize(): void;
|
|
58
76
|
onTouchStart($event: TouchEvent): void;
|
|
59
77
|
onTouchEnd($event: TouchEvent): void;
|
|
60
|
-
onMouseDown(): void;
|
|
78
|
+
onMouseDown($event: MouseEvent): void;
|
|
61
79
|
onMouseUp($event: MouseEvent): void;
|
|
62
80
|
onMouseMove($event: MouseEvent): void;
|
|
63
81
|
onMouseLeave(): void;
|
|
64
|
-
onPanStart(
|
|
65
|
-
|
|
82
|
+
onPanStart(): void;
|
|
83
|
+
onPanMove($event: any): void;
|
|
66
84
|
onPanEnd(): void;
|
|
67
85
|
protected fixRotation(): void;
|
|
68
86
|
protected fixItems(): void;
|
|
69
87
|
protected selectItem(pointer: InteractiveCanvasPointer): void;
|
|
88
|
+
protected toCanvasPoint(pointer: InteractiveCanvasPointer): Point;
|
|
70
89
|
protected getIndexUnderPointer(pointer: InteractiveCanvasPointer): number;
|
|
71
90
|
protected updateCursor(): void;
|
|
72
91
|
protected getCursor(): string;
|
|
73
92
|
protected redraw(): void;
|
|
74
93
|
protected drawItems(): Promise<void>;
|
|
94
|
+
protected drawItem(ctx: CanvasRenderingContext2D, item: InteractiveCanvasItem): Promise<void>;
|
|
75
95
|
protected draw(): Promise<void>;
|
|
76
96
|
static ɵfac: i0.ɵɵFactoryDeclaration<InteractiveCanvasComponent, never>;
|
|
77
|
-
static ɵcmp: i0.ɵɵComponentDeclaration<InteractiveCanvasComponent, "interactive-canvas", never, { "
|
|
97
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<InteractiveCanvasComponent, "interactive-canvas", never, { "infinite": { "alias": "infinite"; "required": false; }; "resizeMode": { "alias": "resizeMode"; "required": false; }; "params": { "alias": "params"; "required": false; }; "realWidth": { "alias": "realWidth"; "required": false; }; "realHeight": { "alias": "realHeight"; "required": false; }; "debug": { "alias": "debug"; "required": false; }; "horizontal": { "alias": "horizontal"; "required": false; }; "selectedIndex": { "alias": "selectedIndex"; "required": false; }; "panOffset": { "alias": "panOffset"; "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>;
|
|
78
98
|
}
|
|
@@ -4,10 +4,11 @@ import { Point } from "../../utils/geometry";
|
|
|
4
4
|
import { MaybePromise } from "../../helper-types";
|
|
5
5
|
import * as i0 from "@angular/core";
|
|
6
6
|
export declare class InteractiveItemComponent implements OnChanges, InteractiveCanvasItem {
|
|
7
|
-
protected cycles: number[];
|
|
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);
|
|
11
12
|
get x(): number;
|
|
12
13
|
set x(value: number);
|
|
13
14
|
get y(): number;
|
|
@@ -27,12 +28,17 @@ export declare class InteractiveItemComponent implements OnChanges, InteractiveC
|
|
|
27
28
|
constructor();
|
|
28
29
|
draw(ctx: CanvasRenderingContext2D): MaybePromise<void>;
|
|
29
30
|
ngOnChanges(): void;
|
|
30
|
-
calcShapes(
|
|
31
|
+
calcShapes(): void;
|
|
31
32
|
hit(point: Point): boolean;
|
|
32
|
-
|
|
33
|
+
moveTo(x: number, y: number): void;
|
|
34
|
+
moveBy(dx: number, dy: number): void;
|
|
35
|
+
moveX(x: number): void;
|
|
36
|
+
moveY(y: number): void;
|
|
33
37
|
moveEnd(): void;
|
|
38
|
+
protected restrictPosition(x: number, y: number): IPoint;
|
|
34
39
|
protected isValidByParams(): boolean;
|
|
35
40
|
protected isValidByDistance(other: InteractiveCanvasItem): boolean;
|
|
41
|
+
protected distToPixels(value: number): number;
|
|
36
42
|
protected getMinDistance(other: InteractiveCanvasItem): number;
|
|
37
43
|
protected calcShape(x: number, y: number): IShape;
|
|
38
44
|
static ɵfac: i0.ɵɵFactoryDeclaration<InteractiveItemComponent, never>;
|
|
@@ -64,8 +64,8 @@ import { UnorderedListComponent } from "./components/unordered-list/unordered-li
|
|
|
64
64
|
import { UploadComponent } from "./components/upload/upload.component";
|
|
65
65
|
export declare const pipes: (typeof FilterPipe | typeof FormatNumberPipe | typeof GlobalTemplatePipe | typeof IncludesPipe | typeof ReducePipe | typeof RoundPipe | typeof SafeHtmlPipe | typeof TranslatePipe)[];
|
|
66
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)[];
|
|
67
|
-
export declare const components: (typeof ChipsComponent | typeof CloseBtnComponent | typeof DropListComponent | typeof DynamicTableComponent | typeof
|
|
68
|
-
export declare const providers: (typeof
|
|
67
|
+
export declare const components: (typeof ChipsComponent | typeof CloseBtnComponent | typeof DropListComponent | typeof DynamicTableComponent | typeof InteractiveCanvasComponent | typeof PaginationMenuComponent | typeof UnorderedListComponent | typeof UploadComponent)[];
|
|
68
|
+
export declare const providers: (typeof UniversalService | typeof StateService | typeof AuthGuard | typeof EventsService | typeof AclService | typeof BaseHttpClient | typeof StorageService | typeof CacheService | typeof BaseHttpService | typeof StaticAuthService | typeof ConfigService | typeof BaseDialogService | typeof ErrorHandlerService | typeof FormatterService | typeof GlobalTemplateService | typeof IconService | typeof StaticLanguageService | typeof OpenApiService | typeof BaseToasterService | typeof ComponentLoaderService | typeof TranslatedUrlSerializer | typeof PromiseService | typeof SocketService | typeof FilterPipe | typeof FormatNumberPipe | typeof GlobalTemplatePipe | typeof IncludesPipe | typeof ReducePipe | typeof RoundPipe | typeof SafeHtmlPipe | typeof TranslatePipe | typeof DeviceDetectorService | {
|
|
69
69
|
provide: import("@angular/core").InjectionToken<import("@angular/platform-browser").EventManagerPlugin[]>;
|
|
70
70
|
useClass: typeof DragDropEventPlugin;
|
|
71
71
|
multi: boolean;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { CanvasColor } from "../common-types";
|
|
2
2
|
export declare function drawRect(ctx: CanvasRenderingContext2D, w: number, h: number): void;
|
|
3
3
|
export declare function drawOval(ctx: CanvasRenderingContext2D, w: number, h: number): void;
|
|
4
|
+
export declare function drawPoint(ctx: CanvasRenderingContext2D): void;
|
|
4
5
|
export declare class CanvasUtils {
|
|
5
6
|
static manipulatePixels(canvas: HTMLCanvasElement, ctx: CanvasRenderingContext2D, colorTransformer: (color: CanvasColor, greyscale?: number) => CanvasColor): void;
|
|
6
7
|
static thresholding(canvas: HTMLCanvasElement, ctx: CanvasRenderingContext2D, threshold: number, colorTransformer: (color: CanvasColor, limit: boolean, greyscale?: number) => CanvasColor): void;
|
|
@@ -1,12 +1,19 @@
|
|
|
1
1
|
import { IPoint } from "../../common-types";
|
|
2
2
|
export declare function dotProduct(a: IPoint, b: IPoint): number;
|
|
3
|
+
export declare function tripleProduct(a: IPoint, b: IPoint, c: IPoint): IPoint;
|
|
3
4
|
export declare function isPoint(v: IPoint | number): v is IPoint;
|
|
5
|
+
export declare function ensurePoint(p: IPoint, fallback?: IPoint): IPoint;
|
|
4
6
|
export declare function perpendicular(p: IPoint): IPoint;
|
|
5
|
-
export declare function
|
|
6
|
-
export declare function
|
|
7
|
-
export declare function
|
|
8
|
-
export declare function
|
|
9
|
-
export declare function
|
|
7
|
+
export declare function negatePt(p: IPoint): IPoint;
|
|
8
|
+
export declare function normalizePt(p: IPoint): IPoint;
|
|
9
|
+
export declare function addPts(a: IPoint, b: IPoint): IPoint;
|
|
10
|
+
export declare function distanceSq(a: IPoint, b: IPoint): number;
|
|
11
|
+
export declare function distance(a: IPoint, b: IPoint): number;
|
|
12
|
+
export declare function lerpPts(a: IPoint, b: IPoint, t: number): IPoint;
|
|
13
|
+
export declare function lengthOfPt(p: IPoint): number;
|
|
14
|
+
export declare function multiplyPts(a: IPoint, b: IPoint | number): IPoint;
|
|
15
|
+
export declare function dividePts(a: IPoint, b: IPoint | number): IPoint;
|
|
16
|
+
export declare function subPts(a: IPoint, b: IPoint): IPoint;
|
|
10
17
|
export declare function rotateDeg(p: IPoint, ang: number): IPoint;
|
|
11
18
|
export declare function rotateRad(p: IPoint, ang: number): IPoint;
|
|
12
19
|
export declare function toDegrees(rad: number): number;
|
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { gjkDistance, gjkIntersection } from "./gjk";
|
|
2
|
+
export { dotProduct, tripleProduct, isPoint, ensurePoint, perpendicular, negatePt, normalizePt, addPts, distanceSq, distance, lerpPts, lengthOfPt, multiplyPts, dividePts, subPts, rotateDeg, rotateRad, toDegrees, toRadians } from "./functions";
|
|
2
3
|
export { Circle, Point, Rect, Oval } from "./shapes";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IPoint, IShape } from "../../common-types";
|
|
1
|
+
import { IPoint, IShape, ShapeDistance, ShapeIntersection } from "../../common-types";
|
|
2
2
|
declare abstract class Shape implements IShape {
|
|
3
3
|
get center(): IPoint;
|
|
4
4
|
get x(): number;
|
|
@@ -6,8 +6,11 @@ declare abstract class Shape implements IShape {
|
|
|
6
6
|
protected pt: IPoint;
|
|
7
7
|
protected constructor(x: number, y: number);
|
|
8
8
|
abstract support(dir: IPoint): IPoint;
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
abstract move(pos: IPoint): IShape;
|
|
10
|
+
intersection(shape: IShape): ShapeIntersection;
|
|
11
|
+
intersects(shape: IShape): boolean;
|
|
12
|
+
minDistance(shape: IShape): ShapeDistance;
|
|
13
|
+
distance(shape: IShape): number;
|
|
11
14
|
}
|
|
12
15
|
export declare class Point extends Shape {
|
|
13
16
|
static Zero: Point;
|
|
@@ -15,11 +18,12 @@ export declare class Point extends Shape {
|
|
|
15
18
|
get perpendicular(): Point;
|
|
16
19
|
constructor(xOrP: number | IPoint, y?: number);
|
|
17
20
|
support(): IPoint;
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
21
|
+
move(pos: IPoint): IShape;
|
|
22
|
+
add(p: IPoint): Point;
|
|
23
|
+
subtract(p: IPoint): Point;
|
|
24
|
+
multiply(p: IPoint | number): Point;
|
|
25
|
+
divide(p: IPoint | number): Point;
|
|
26
|
+
dot(p: IPoint): Point;
|
|
23
27
|
lerp(p: Point, ratio: number): Point;
|
|
24
28
|
perpendicularTo(p: Point, length: number): Point;
|
|
25
29
|
circleWith(a: Point, b: Point): Circle;
|
|
@@ -33,6 +37,7 @@ export declare class Rect extends Shape {
|
|
|
33
37
|
readonly rotation: number;
|
|
34
38
|
constructor(x: number, y: number, width: number, height: number, rotation?: number);
|
|
35
39
|
support(dir: IPoint): IPoint;
|
|
40
|
+
move(pos: IPoint): Rect;
|
|
36
41
|
}
|
|
37
42
|
export declare class Oval extends Shape {
|
|
38
43
|
readonly width: number;
|
|
@@ -40,9 +45,11 @@ export declare class Oval extends Shape {
|
|
|
40
45
|
readonly rotation: number;
|
|
41
46
|
constructor(x: number, y: number, width: number, height: number, rotation?: number);
|
|
42
47
|
support(dir: IPoint): IPoint;
|
|
48
|
+
move(pos: IPoint): Oval;
|
|
43
49
|
}
|
|
44
50
|
export declare class Circle extends Oval {
|
|
45
51
|
readonly radius: number;
|
|
46
52
|
constructor(x: number, y: number, radius: number, rotation?: number);
|
|
53
|
+
move(pos: IPoint): Circle;
|
|
47
54
|
}
|
|
48
55
|
export {};
|
|
@@ -1,5 +1,39 @@
|
|
|
1
|
+
import { RangeCoords } from "../common-types";
|
|
2
|
+
export declare const EPSILON = 1e-9;
|
|
3
|
+
/**
|
|
4
|
+
* Normalize a range
|
|
5
|
+
* @param minOrRange
|
|
6
|
+
* @param max
|
|
7
|
+
*/
|
|
8
|
+
export declare function normalizeRange(minOrRange: number | RangeCoords, max?: number): RangeCoords;
|
|
9
|
+
/**
|
|
10
|
+
* Clamps a value to a range
|
|
11
|
+
* @param value
|
|
12
|
+
* @param min
|
|
13
|
+
* @param max
|
|
14
|
+
*/
|
|
15
|
+
export declare function clamp(value: number, min: number | RangeCoords, max?: number): number;
|
|
16
|
+
/**
|
|
17
|
+
* Clamps a value to a range in a way, that when it is over in one end, then it appears from the other end
|
|
18
|
+
* @param value
|
|
19
|
+
* @param min
|
|
20
|
+
* @param max
|
|
21
|
+
*/
|
|
22
|
+
export declare function overflow(value: number, min: number | RangeCoords, max?: number): number;
|
|
23
|
+
/**
|
|
24
|
+
* Checks if a number is equal to b number with epsilon tolerance
|
|
25
|
+
* @param a
|
|
26
|
+
* @param b
|
|
27
|
+
* @param epsilon
|
|
28
|
+
*/
|
|
29
|
+
export declare function isEqual(a: number, b: number, epsilon?: number): boolean;
|
|
30
|
+
/**
|
|
31
|
+
* Checks if a number is equal to zero with epsilon tolerance
|
|
32
|
+
* @param a
|
|
33
|
+
* @param epsilon
|
|
34
|
+
*/
|
|
35
|
+
export declare function isZero(a: number, epsilon?: number): boolean;
|
|
1
36
|
export declare class MathUtils {
|
|
2
|
-
static readonly EPSILON: number;
|
|
3
37
|
static equal(a: number, b: number, epsilon?: number): boolean;
|
|
4
38
|
static clamp(value: number, min: number, max: number): number;
|
|
5
39
|
static round(value: number, precision?: number, divider?: number): number;
|
package/package.json
CHANGED
package/public_api.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import "zone.js";
|
|
2
2
|
export { MaybePromise, MaybeArray, KeysOfType, ObjOfType, StringKeys, CapitalizeFirst, CamelJoin, PrefixedPick } from "./ngx-utils/helper-types";
|
|
3
|
-
export { DurationUnit, TypedFactoryProvider, TypedValueProvider, TypedExistingProvider, TypedClassProvider, TypedTokenProvider, TypedProvider, CachedFactory, ResolveFactory, IResolveFactory, CanvasColor, IIconService, ITranslation, ITranslations, ILanguageSetting, ILanguageSettings, ILanguageService, IUserData, IAuthService, RouteValidator, IRouteData, IRoute, IAclComponent, IDialogButtonConfig, IDialogConfig, IConfirmMessageConfig, IConfirmDialogConfig, IDialogService, IPromiseService, IRouteStateInfo, NavigationUrlParam, StorageMode, ToastType, IToasterService, IAsyncMessage, AsyncMethod, IconMap, IconProps, ButtonType, ButtonSize, ButtonProps, TabValue, TabOption, ChipValue, ChipStatus, ChipOption, DropdownAttachTo, UnorderedListTemplate, UnorderedListTemplates, UnorderedListStyle, UploadType, IFileUploadResult, IFileUploadProcess, IAjaxRequestDetails, AjaxRequestCallback, ScriptType, ILoadableElement, ILoaderPromises, ISearchObservable, FactoryDependencies, ObjectType, ITimer, IExtraProperties, IGroupMap, TranslationQuery, IPageInfo, IPaginationData, PaginationDataLoader, PaginationItemContext, IPoint, IShape, CanvasItemDirection, CanvasPaintFunc,
|
|
3
|
+
export { DurationUnit, TypedFactoryProvider, TypedValueProvider, TypedExistingProvider, TypedClassProvider, TypedTokenProvider, TypedProvider, CachedFactory, ResolveFactory, IResolveFactory, CanvasColor, IIconService, ITranslation, ITranslations, ILanguageSetting, ILanguageSettings, ILanguageService, IUserData, IAuthService, RouteValidator, IRouteData, IRoute, IAclComponent, IDialogButtonConfig, IDialogConfig, IConfirmMessageConfig, IConfirmDialogConfig, IDialogService, IPromiseService, IRouteStateInfo, NavigationUrlParam, StorageMode, ToastType, IToasterService, IAsyncMessage, AsyncMethod, IconMap, IconProps, ButtonType, ButtonSize, ButtonProps, TabValue, TabOption, ChipValue, ChipStatus, ChipOption, DropdownAttachTo, UnorderedListTemplate, UnorderedListTemplates, UnorderedListStyle, UploadType, IFileUploadResult, IFileUploadProcess, IAjaxRequestDetails, AjaxRequestCallback, ScriptType, ILoadableElement, ILoaderPromises, ISearchObservable, FactoryDependencies, ObjectType, ITimer, IExtraProperties, IGroupMap, TranslationQuery, IPageInfo, IPaginationData, PaginationDataLoader, PaginationItemContext, IPoint, ShapeIntersection, ShapeDistance, IShape, CanvasResizeMode, CanvasItemDirection, CanvasPaintFunc, RangeCoords, RectCoords, InteractiveCanvasParams, InteractiveCanvasItem, InteractiveCanvasItems, InteractiveCanvas, InteractiveCanvasRenderer, InteractivePanEvent, InteractiveCanvasPointer, HttpRequestHeaders, HttpRequestQuery, HttpClientRequestOptions, HttpRequestOptions, UploadData, IIssueContext, IProgress, ProgressListener, CacheExpireMode, IHttpService, IApiService, DynamicSchemaRef, OpenApiSchemaProperty, OpenApiSchema, OpenApiSchemas, TableFilterType, ITableOrders, ITableColumn, ITableColumns, TableColumns, ITableTemplate, ITableTemplates, ITableDataQuery, TableDataItems, TableDataLoader, DragDropEvent, DragEventHandler, ITableDragEvent, DynamicTableDragHandler, ResourceIfContext, CssSelector, CssSelectorList, DynamicComponentLocation, DynamicModuleInfo, DynamicEntryComponents, IConfiguration, IConfigService, ResizeEventStrategy, ErrorHandlerCallback, GlobalComponentModifier, AppInitializerFunc, IModuleConfig, ValuedPromise } from "./ngx-utils/common-types";
|
|
4
4
|
export { ICON_TYPE, ICON_MAP, BUTTON_TYPE, ERROR_HANDLER, STATIC_SCHEMAS, RESIZE_STRATEGY, RESIZE_DELAY, ROOT_ELEMENT, SCRIPT_PARAMS, BASE_CONFIG, CONFIG_SERVICE, APP_BASE_URL, API_SERVICE, EXPRESS_REQUEST, PROMISE_SERVICE, DIALOG_SERVICE, TOASTER_SERVICE, AUTH_SERVICE, LANGUAGE_SERVICE, ICON_SERVICE, OPTIONS_TOKEN } from "./ngx-utils/tokens";
|
|
5
5
|
export { AjaxRequestHandler } from "./ngx-utils/utils/ajax-request-handler";
|
|
6
6
|
export { ArrayUtils } from "./ngx-utils/utils/array.utils";
|
|
@@ -12,12 +12,12 @@ export { FileUtils } from "./ngx-utils/utils/file.utils";
|
|
|
12
12
|
export { ForbiddenZone } from "./ngx-utils/utils/forbidden-zone";
|
|
13
13
|
export { GenericValue } from "./ngx-utils/utils/generic-value";
|
|
14
14
|
export { FileSystemEntryOpenResult, FileSystemEntryOpenCb, FileSystemEntry } from "./ngx-utils/utils/file-system";
|
|
15
|
-
export { dotProduct, isPoint, perpendicular,
|
|
15
|
+
export { dotProduct, tripleProduct, isPoint, ensurePoint, perpendicular, negatePt, normalizePt, addPts, distanceSq, distance, lerpPts, lengthOfPt, multiplyPts, dividePts, subPts, rotateDeg, rotateRad, toDegrees, toRadians, gjkDistance, gjkIntersection, Point, Rect, Oval, Circle } from "./ngx-utils/utils/geometry";
|
|
16
16
|
export { Initializer } from "./ngx-utils/utils/initializer";
|
|
17
17
|
export { JSONfn } from "./ngx-utils/utils/jsonfn";
|
|
18
18
|
export { ReflectUtils } from "./ngx-utils/utils/reflect.utils";
|
|
19
19
|
export { LoaderUtils } from "./ngx-utils/utils/loader.utils";
|
|
20
|
-
export { MathUtils } from "./ngx-utils/utils/math.utils";
|
|
20
|
+
export { EPSILON, normalizeRange, clamp, overflow, MathUtils } from "./ngx-utils/utils/math.utils";
|
|
21
21
|
export { isBrowser, getRoot, hashCode, switchClass, getCssVariables, checkTransitions, getComponentDef, parseSelector, selectorMatchesList, provideEntryComponents, provideWithOptions } from "./ngx-utils/utils/misc";
|
|
22
22
|
export { ObjectUtils } from "./ngx-utils/utils/object.utils";
|
|
23
23
|
export { ObservableUtils, ISubscriberInfo } from "./ngx-utils/utils/observable.utils";
|
|
@@ -1,25 +0,0 @@
|
|
|
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 {};
|