@stemy/ngx-utils 19.7.0 → 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 +129 -63
- package/fesm2022/stemy-ngx-utils.mjs.map +1 -1
- package/ngx-utils/common-types.d.ts +32 -16
- package/ngx-utils/components/dynamic-table/dynamic-table.component.d.ts +10 -5
- package/ngx-utils/components/interactive-canvas/interactive-canvas.component.d.ts +19 -12
- package/ngx-utils/components/interactive-canvas/interactive-item.component.d.ts +5 -3
- package/ngx-utils/utils/math.utils.d.ts +1 -1
- package/package.json +1 -1
- package/public_api.d.ts +1 -1
|
@@ -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);
|
|
@@ -309,37 +309,52 @@ export interface IShape extends IPoint {
|
|
|
309
309
|
}
|
|
310
310
|
export type CanvasItemDirection = "horizontal" | "vertical" | "free" | "none";
|
|
311
311
|
export type CanvasPaintFunc = (ctx: CanvasRenderingContext2D) => MaybePromise<GlobalCompositeOperation | null>;
|
|
312
|
+
/**
|
|
313
|
+
* Interface for an interactive canvas item
|
|
314
|
+
*/
|
|
315
|
+
export interface InteractiveCanvasItem {
|
|
316
|
+
readonly position: IPoint;
|
|
317
|
+
readonly shapes: ReadonlyArray<IShape>;
|
|
318
|
+
readonly canvas: InteractiveCanvas;
|
|
319
|
+
readonly index: number;
|
|
320
|
+
readonly active: boolean;
|
|
321
|
+
readonly isValid: boolean;
|
|
322
|
+
readonly validPosition: IPoint;
|
|
323
|
+
draw(ctx: CanvasRenderingContext2D): MaybePromise<void>;
|
|
324
|
+
}
|
|
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
|
+
*/
|
|
312
330
|
export interface InteractiveCanvas {
|
|
313
331
|
readonly params?: Record<string, any>;
|
|
314
|
-
readonly items?:
|
|
332
|
+
readonly $items?: Observable<InteractiveCanvasItems>;
|
|
333
|
+
readonly items?: InteractiveCanvasItems;
|
|
315
334
|
readonly canvas: HTMLCanvasElement;
|
|
335
|
+
readonly lockedItem?: InteractiveCanvasItem;
|
|
336
|
+
readonly selectedItem?: InteractiveCanvasItem;
|
|
337
|
+
hoveredItem?: InteractiveCanvasItem;
|
|
316
338
|
readonly ratio: number;
|
|
317
339
|
readonly styles: CSSStyleDeclaration;
|
|
318
340
|
readonly ctx: CanvasRenderingContext2D;
|
|
319
341
|
readonly canvasWidth: number;
|
|
320
342
|
readonly canvasHeight: number;
|
|
321
343
|
readonly fullHeight: number;
|
|
344
|
+
readonly viewRatio: number;
|
|
322
345
|
readonly rotation: number;
|
|
323
346
|
readonly basePan: number;
|
|
347
|
+
readonly cycles?: ReadonlyArray<number>;
|
|
324
348
|
rendered?: boolean;
|
|
325
349
|
tempPaint(cb: CanvasPaintFunc): Promise<void>;
|
|
326
350
|
}
|
|
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>;
|
|
351
|
+
export type InteractiveCanvasRenderer = (renderCanvas: InteractiveCanvas, renderCtx: Record<string, any>) => MaybePromise<void>;
|
|
338
352
|
export interface InteractivePanEvent {
|
|
353
|
+
canvas: InteractiveCanvas;
|
|
354
|
+
item: InteractiveCanvasItem;
|
|
339
355
|
pointers?: any[];
|
|
340
356
|
deltaX?: number;
|
|
341
357
|
deltaY?: number;
|
|
342
|
-
item?: InteractiveCanvasItem;
|
|
343
358
|
[key: string]: any;
|
|
344
359
|
}
|
|
345
360
|
export interface InteractiveCanvasPointer {
|
|
@@ -477,6 +492,7 @@ export interface ITableTemplates {
|
|
|
477
492
|
export interface ITableDataQuery {
|
|
478
493
|
[column: string]: string | string[] | boolean;
|
|
479
494
|
}
|
|
495
|
+
export type TableDataItems = ReadonlyArray<any>;
|
|
480
496
|
export type TableDataLoader = (page: number, rowsPerPage: number, orderBy: string, orderDescending: boolean, filter: string, query: ITableDataQuery) => Promise<IPaginationData>;
|
|
481
497
|
export type DragDropEvent<K extends string = "item", T = any> = {
|
|
482
498
|
[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,6 +1,6 @@
|
|
|
1
1
|
import { AfterViewInit, ElementRef, EventEmitter, OnChanges, OnDestroy, OnInit, QueryList, Renderer2 } from "@angular/core";
|
|
2
|
-
import { Subscription } from "rxjs";
|
|
3
|
-
import { CanvasPaintFunc, InteractiveCanvas,
|
|
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
5
|
import { UniversalService } from "../../services/universal.service";
|
|
6
6
|
import * as i0 from "@angular/core";
|
|
@@ -17,16 +17,22 @@ export declare class InteractiveCanvasComponent implements InteractiveCanvas, On
|
|
|
17
17
|
realHeight: number;
|
|
18
18
|
panOffset: number;
|
|
19
19
|
params: Record<string, any>;
|
|
20
|
-
|
|
21
|
-
|
|
20
|
+
renderCtx: Record<string, any>;
|
|
21
|
+
beforeItems: ReadonlyArray<InteractiveCanvasRenderer>;
|
|
22
|
+
afterItems: ReadonlyArray<InteractiveCanvasRenderer>;
|
|
22
23
|
selectedIndexChange: EventEmitter<number>;
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
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>;
|
|
26
31
|
get canvas(): HTMLCanvasElement;
|
|
27
32
|
get lockedItem(): InteractiveItemComponent;
|
|
28
33
|
get selectedItem(): InteractiveItemComponent;
|
|
29
34
|
get hoveredItem(): InteractiveItemComponent;
|
|
35
|
+
set hoveredItem(item: InteractiveItemComponent);
|
|
30
36
|
ratio: number;
|
|
31
37
|
styles: CSSStyleDeclaration;
|
|
32
38
|
ctx: CanvasRenderingContext2D;
|
|
@@ -34,11 +40,12 @@ export declare class InteractiveCanvasComponent implements InteractiveCanvas, On
|
|
|
34
40
|
canvasHeight: number;
|
|
35
41
|
rotation: number;
|
|
36
42
|
basePan: number;
|
|
43
|
+
cycles: number[];
|
|
37
44
|
fullHeight: number;
|
|
45
|
+
viewRatio: number;
|
|
38
46
|
protected tempCanvas: HTMLCanvasElement;
|
|
39
47
|
protected shouldDraw: boolean;
|
|
40
48
|
protected hoveredIndex: number;
|
|
41
|
-
protected itemComponents: InteractiveItemComponent[];
|
|
42
49
|
protected subscription: Subscription;
|
|
43
50
|
protected containerElem: ElementRef<HTMLDivElement>;
|
|
44
51
|
protected canvasElem: ElementRef<HTMLCanvasElement>;
|
|
@@ -57,12 +64,12 @@ export declare class InteractiveCanvasComponent implements InteractiveCanvas, On
|
|
|
57
64
|
resize(): void;
|
|
58
65
|
onTouchStart($event: TouchEvent): void;
|
|
59
66
|
onTouchEnd($event: TouchEvent): void;
|
|
60
|
-
onMouseDown(): void;
|
|
67
|
+
onMouseDown($event: MouseEvent): void;
|
|
61
68
|
onMouseUp($event: MouseEvent): void;
|
|
62
69
|
onMouseMove($event: MouseEvent): void;
|
|
63
70
|
onMouseLeave(): void;
|
|
64
|
-
onPanStart(
|
|
65
|
-
|
|
71
|
+
onPanStart(): void;
|
|
72
|
+
onPanMove($event: any): void;
|
|
66
73
|
onPanEnd(): void;
|
|
67
74
|
protected fixRotation(): void;
|
|
68
75
|
protected fixItems(): void;
|
|
@@ -74,5 +81,5 @@ export declare class InteractiveCanvasComponent implements InteractiveCanvas, On
|
|
|
74
81
|
protected drawItems(): Promise<void>;
|
|
75
82
|
protected draw(): Promise<void>;
|
|
76
83
|
static ɵfac: i0.ɵɵFactoryDeclaration<InteractiveCanvasComponent, never>;
|
|
77
|
-
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; }; "beforeItems": { "alias": "beforeItems"; "required": false; }; "afterItems": { "alias": "afterItems"; "required": false; }; }, { "selectedIndexChange": "selectedIndexChange"; "
|
|
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>;
|
|
78
85
|
}
|
|
@@ -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,13 @@ 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
|
+
moveBy(dx: number, dy: number): void;
|
|
33
34
|
moveEnd(): void;
|
|
34
35
|
protected isValidByParams(): boolean;
|
|
35
36
|
protected isValidByDistance(other: InteractiveCanvasItem): boolean;
|
|
37
|
+
protected distToPixels(value: number): number;
|
|
36
38
|
protected getMinDistance(other: InteractiveCanvasItem): number;
|
|
37
39
|
protected calcShape(x: number, y: number): IShape;
|
|
38
40
|
static ɵfac: i0.ɵɵFactoryDeclaration<InteractiveItemComponent, never>;
|
|
@@ -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;
|
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, IShape, CanvasItemDirection, CanvasPaintFunc, 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";
|