@wemake4u/form-player-se 1.0.31 → 1.0.32
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/esm2022/lib/components/actionsCellRenderer/actionsCellRenderer.component.mjs +29 -16
- package/esm2022/lib/components/hostCellRenderer/hostCellRenderer.component.mjs +3 -2
- package/esm2022/lib/directives/grid.directive.mjs +82 -24
- package/esm2022/lib/directives/validationpatch.directive.mjs +44 -2
- package/esm2022/lib/dynamic-fields/dynamic-fields.component.mjs +24 -11
- package/esm2022/lib/dynamic-form/dynamic-form.component.mjs +24 -19
- package/esm2022/lib/services/cache.service.mjs +86 -0
- package/esm2022/lib/services/dialog.service.mjs +2 -2
- package/esm2022/lib/services/formatter.service.mjs +2 -2
- package/esm2022/lib/services/function.service.mjs +14 -3
- package/esm2022/lib/services/grid.service.mjs +46 -26
- package/esm2022/lib/services/programmability.service.mjs +27 -30
- package/esm2022/lib/services/scope.service.mjs +3 -2
- package/esm2022/lib/services/toast.service.mjs +2 -2
- package/esm2022/lib/services/validation.service.mjs +2 -2
- package/esm2022/lib/services/weak.service.mjs +6 -1
- package/esm2022/lib/utils/bound.mjs +12 -0
- package/esm2022/lib/utils/groupByRow.mjs +2 -1
- package/esm2022/lib/utils/proxy.mjs +55 -0
- package/fesm2022/wemake4u-form-player-se.mjs +420 -142
- package/fesm2022/wemake4u-form-player-se.mjs.map +1 -1
- package/lib/components/actionsCellRenderer/actionsCellRenderer.component.d.ts +4 -0
- package/lib/directives/grid.directive.d.ts +17 -4
- package/lib/directives/validationpatch.directive.d.ts +9 -0
- package/lib/dynamic-fields/dynamic-fields.component.d.ts +5 -4
- package/lib/dynamic-form/dynamic-form.component.d.ts +5 -3
- package/lib/services/cache.service.d.ts +21 -0
- package/lib/services/function.service.d.ts +2 -0
- package/lib/services/grid.service.d.ts +11 -5
- package/lib/services/programmability.service.d.ts +4 -3
- package/lib/services/weak.service.d.ts +1 -0
- package/lib/utils/{functions.d.ts → bound.d.ts} +0 -1
- package/lib/utils/groupByRow.d.ts +1 -0
- package/lib/utils/proxy.d.ts +2 -0
- package/package.json +1 -1
- package/esm2022/lib/utils/functions.mjs +0 -31
|
@@ -10,9 +10,13 @@ export declare class ActionsCellRendererComponent implements ICellRendererAngula
|
|
|
10
10
|
evaluateBoolean(value: boolean | string | null): boolean | null;
|
|
11
11
|
evaluateString(value: string | null): string;
|
|
12
12
|
clickButton(action: any, event: any): any;
|
|
13
|
+
private cacheContext;
|
|
14
|
+
private getCacheControl;
|
|
15
|
+
private getOptions;
|
|
13
16
|
private getData;
|
|
14
17
|
private getRowIndex;
|
|
15
18
|
private getFormGroup;
|
|
19
|
+
private getCacheContext;
|
|
16
20
|
static ɵfac: i0.ɵɵFactoryDeclaration<ActionsCellRendererComponent, never>;
|
|
17
21
|
static ɵcmp: i0.ɵɵComponentDeclaration<ActionsCellRendererComponent, "ng-component", never, {}, {}, never, never, true, never>;
|
|
18
22
|
}
|
|
@@ -2,35 +2,48 @@ import { OnChanges, SimpleChanges } from '@angular/core';
|
|
|
2
2
|
import { FormGroup } from '@angular/forms';
|
|
3
3
|
import { AgGridAngular } from 'ag-grid-angular';
|
|
4
4
|
import { GridService } from '../services/grid.service';
|
|
5
|
+
import { CacheContextService } from '../services/cache.service';
|
|
5
6
|
import { LanguageService } from '@wemake4u/interact';
|
|
6
7
|
import * as i0 from "@angular/core";
|
|
7
8
|
export declare class GridDirective implements OnChanges {
|
|
8
9
|
private grid;
|
|
9
10
|
private gridService;
|
|
11
|
+
private cacheContext;
|
|
10
12
|
private languageService;
|
|
11
13
|
rowSource: any;
|
|
12
14
|
columnDefs: any;
|
|
15
|
+
selectable: boolean | null;
|
|
16
|
+
multiSelect: boolean | null;
|
|
17
|
+
suppressActions: boolean | null;
|
|
13
18
|
formGroup: FormGroup;
|
|
14
19
|
component: any;
|
|
15
20
|
private destroyRef;
|
|
16
|
-
constructor(grid: AgGridAngular, gridService: GridService, languageService: LanguageService);
|
|
21
|
+
constructor(grid: AgGridAngular, gridService: GridService, cacheContext: CacheContextService, languageService: LanguageService);
|
|
17
22
|
ngOnChanges(changes: SimpleChanges): void;
|
|
18
23
|
private gridApi;
|
|
19
24
|
private isGridReady;
|
|
20
25
|
private noData;
|
|
26
|
+
private prepareContext;
|
|
21
27
|
private applyResult;
|
|
22
28
|
private setRowData;
|
|
23
29
|
private setDataSource;
|
|
24
30
|
private isArray;
|
|
25
31
|
private isDataSource;
|
|
26
32
|
private onGridReady;
|
|
27
|
-
private
|
|
33
|
+
private isRowSourceChanged;
|
|
34
|
+
private onRowSourceChanged;
|
|
35
|
+
private isColumnDefsChanged;
|
|
36
|
+
private onColumnDefsChanged;
|
|
37
|
+
private isSelectionChanged;
|
|
38
|
+
private onSelectionChanged;
|
|
39
|
+
private isSuppressActionChanged;
|
|
40
|
+
private onSuppressAction;
|
|
28
41
|
private showLoading;
|
|
29
42
|
private showLoadError;
|
|
30
43
|
private get language();
|
|
31
44
|
private locale;
|
|
32
45
|
private wrapObservable;
|
|
33
46
|
private wrapRowsSource;
|
|
34
|
-
static ɵfac: i0.ɵɵFactoryDeclaration<GridDirective, [{ host: true; }, null, null]>;
|
|
35
|
-
static ɵdir: i0.ɵɵDirectiveDeclaration<GridDirective, "[rowSource], [columnDefs]", never, { "rowSource": { "alias": "rowSource"; "required": false; }; "columnDefs": { "alias": "columnDefs"; "required": false; }; "formGroup": { "alias": "formGroup"; "required": false; }; "component": { "alias": "register"; "required": false; }; }, {}, never, never, true, never>;
|
|
47
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<GridDirective, [{ host: true; }, null, null, null]>;
|
|
48
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<GridDirective, "[rowSource], [columnDefs], [selectable], [multiSelect], [suppressActions]", never, { "rowSource": { "alias": "rowSource"; "required": false; }; "columnDefs": { "alias": "columnDefs"; "required": false; }; "selectable": { "alias": "selectable"; "required": false; }; "multiSelect": { "alias": "multiSelect"; "required": false; }; "suppressActions": { "alias": "suppressActions"; "required": false; }; "formGroup": { "alias": "formGroup"; "required": false; }; "component": { "alias": "register"; "required": false; }; }, {}, never, never, true, never>;
|
|
36
49
|
}
|
|
@@ -2,6 +2,15 @@ import { SirioValidationDirective } from 'ngx-sirio-lib';
|
|
|
2
2
|
import * as i0 from "@angular/core";
|
|
3
3
|
export declare class ValidationPatchDirective extends SirioValidationDirective {
|
|
4
4
|
subscribeToNgControlChanges(): void;
|
|
5
|
+
checkValidation(): void;
|
|
6
|
+
cleanupValidation(): void;
|
|
7
|
+
setValid(): void;
|
|
8
|
+
setInvalid(): void;
|
|
9
|
+
setWarning(): void;
|
|
10
|
+
setPending(): void;
|
|
11
|
+
private applyClass;
|
|
12
|
+
private waitUntilSettled;
|
|
13
|
+
private getRenderer;
|
|
5
14
|
static ɵfac: i0.ɵɵFactoryDeclaration<ValidationPatchDirective, never>;
|
|
6
15
|
static ɵdir: i0.ɵɵDirectiveDeclaration<ValidationPatchDirective, "[validation]", never, {}, {}, never, never, true, never>;
|
|
7
16
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { OnInit, ElementRef, AfterViewInit
|
|
1
|
+
import { OnInit, ElementRef, AfterViewInit } from '@angular/core';
|
|
2
2
|
import { IDynamicFieldsComponent } from './dynamic-fields.interface';
|
|
3
3
|
import { FormGroup, FormArray, AbstractControl } from '@angular/forms';
|
|
4
4
|
import { SafeHtml, SafeResourceUrl } from '@angular/platform-browser';
|
|
@@ -36,10 +36,10 @@ export declare class DynamicFieldsComponent implements OnInit, AfterViewInit, ID
|
|
|
36
36
|
private chart;
|
|
37
37
|
private dialog;
|
|
38
38
|
private el;
|
|
39
|
-
private cdr;
|
|
40
39
|
rows: Array<any> | undefined;
|
|
41
40
|
formGroup: FormGroup;
|
|
42
41
|
alignment: string;
|
|
42
|
+
readOnly: boolean | null;
|
|
43
43
|
Texts: {
|
|
44
44
|
i18n: {
|
|
45
45
|
it: {
|
|
@@ -322,7 +322,7 @@ export declare class DynamicFieldsComponent implements OnInit, AfterViewInit, ID
|
|
|
322
322
|
LoadingFailed: string;
|
|
323
323
|
ConfirmDelete: string;
|
|
324
324
|
};
|
|
325
|
-
constructor(sanitizer: SanitizeService, markdown: MarkdownService, mime: MimeService, programmability: ProgrammabilityService, weak: WeakService, register: RegisterService, metadata: MetadataService, languageService: LanguageService, global: GlobalService, formService: FormService, grid: GridService, chart: ChartService, dialog: DialogService, el: ElementRef
|
|
325
|
+
constructor(sanitizer: SanitizeService, markdown: MarkdownService, mime: MimeService, programmability: ProgrammabilityService, weak: WeakService, register: RegisterService, metadata: MetadataService, languageService: LanguageService, global: GlobalService, formService: FormService, grid: GridService, chart: ChartService, dialog: DialogService, el: ElementRef);
|
|
326
326
|
ngOnInit(): void;
|
|
327
327
|
ngAfterViewInit(): void;
|
|
328
328
|
getRegister(): RegisterService;
|
|
@@ -334,6 +334,7 @@ export declare class DynamicFieldsComponent implements OnInit, AfterViewInit, ID
|
|
|
334
334
|
evaluateBoolean(value: boolean | string | null): boolean | null;
|
|
335
335
|
evaluateNumber(value: number | string | null): number | null;
|
|
336
336
|
evaluateUrl(value: string | null): SafeResourceUrl;
|
|
337
|
+
evaluateHeight(value: number | string | null): string | null;
|
|
337
338
|
evaluateTemplate(value: string | null): string;
|
|
338
339
|
evaluate(text: string | null, cacheable?: boolean): any;
|
|
339
340
|
evaluateColor(value: string | null): ButtonColors | null;
|
|
@@ -395,5 +396,5 @@ export declare class DynamicFieldsComponent implements OnInit, AfterViewInit, ID
|
|
|
395
396
|
private getAsObservable;
|
|
396
397
|
private configureDatepicker;
|
|
397
398
|
static ɵfac: i0.ɵɵFactoryDeclaration<DynamicFieldsComponent, never>;
|
|
398
|
-
static ɵcmp: i0.ɵɵComponentDeclaration<DynamicFieldsComponent, "app-dynamic-fields", never, { "rows": { "alias": "rows"; "required": false; }; "formGroup": { "alias": "formGroup"; "required": false; }; "alignment": { "alias": "alignment"; "required": false; }; }, {}, never, never, true, never>;
|
|
399
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<DynamicFieldsComponent, "app-dynamic-fields", never, { "rows": { "alias": "rows"; "required": false; }; "formGroup": { "alias": "formGroup"; "required": false; }; "alignment": { "alias": "alignment"; "required": false; }; "readOnly": { "alias": "readOnly"; "required": false; }; }, {}, never, never, true, never>;
|
|
399
400
|
}
|
|
@@ -28,6 +28,7 @@ export declare class DynamicFormComponent implements OnChanges, OnDestroy {
|
|
|
28
28
|
private injector;
|
|
29
29
|
schema: any;
|
|
30
30
|
formGroup: FormGroup;
|
|
31
|
+
readOnly: boolean | null;
|
|
31
32
|
value: any;
|
|
32
33
|
strict: boolean;
|
|
33
34
|
showNav: boolean;
|
|
@@ -344,7 +345,6 @@ export declare class DynamicFormComponent implements OnChanges, OnDestroy {
|
|
|
344
345
|
isChanged(): boolean;
|
|
345
346
|
isValid(): boolean;
|
|
346
347
|
private valueChangesSubscription;
|
|
347
|
-
private onCommandSubscription;
|
|
348
348
|
private _forms;
|
|
349
349
|
private _activeNav;
|
|
350
350
|
private defaultValue;
|
|
@@ -352,9 +352,11 @@ export declare class DynamicFormComponent implements OnChanges, OnDestroy {
|
|
|
352
352
|
private onChangeSchema;
|
|
353
353
|
private onChangeValue;
|
|
354
354
|
private suspendValueChanges;
|
|
355
|
-
private internalChange;
|
|
356
355
|
private registerHandlers;
|
|
357
356
|
private clearHandlers;
|
|
357
|
+
private emittedValues;
|
|
358
|
+
private isEmittedValue;
|
|
359
|
+
private emitValueChange;
|
|
358
360
|
refresh(): void;
|
|
359
361
|
private getNext;
|
|
360
362
|
private getPrevious;
|
|
@@ -379,5 +381,5 @@ export declare class DynamicFormComponent implements OnChanges, OnDestroy {
|
|
|
379
381
|
private getDefaultValue;
|
|
380
382
|
private splitPath;
|
|
381
383
|
static ɵfac: i0.ɵɵFactoryDeclaration<DynamicFormComponent, never>;
|
|
382
|
-
static ɵcmp: i0.ɵɵComponentDeclaration<DynamicFormComponent, "app-dynamic-form", never, { "schema": { "alias": "schema"; "required": false; }; "formGroup": { "alias": "formGroup"; "required": false; }; "value": { "alias": "value"; "required": false; }; "strict": { "alias": "strict"; "required": false; }; "showNav": { "alias": "showNav"; "required": false; }; "showNavButton": { "alias": "showNavButton"; "required": false; }; "showProgress": { "alias": "showProgress"; "required": false; }; "showFormTitle": { "alias": "showFormTitle"; "required": false; }; "progressStatus": { "alias": "progressStatus"; "required": false; }; "activeNav": { "alias": "activeNav"; "required": false; }; }, { "valueChange": "valueChange"; "initialized": "initialized"; "activeNavChange": "activeNavChange"; }, never, never, true, never>;
|
|
384
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<DynamicFormComponent, "app-dynamic-form", never, { "schema": { "alias": "schema"; "required": false; }; "formGroup": { "alias": "formGroup"; "required": false; }; "readOnly": { "alias": "readOnly"; "required": false; }; "value": { "alias": "value"; "required": false; }; "strict": { "alias": "strict"; "required": false; }; "showNav": { "alias": "showNav"; "required": false; }; "showNavButton": { "alias": "showNavButton"; "required": false; }; "showProgress": { "alias": "showProgress"; "required": false; }; "showFormTitle": { "alias": "showFormTitle"; "required": false; }; "progressStatus": { "alias": "progressStatus"; "required": false; }; "activeNav": { "alias": "activeNav"; "required": false; }; }, { "valueChange": "valueChange"; "initialized": "initialized"; "activeNavChange": "activeNavChange"; }, never, never, true, never>;
|
|
383
385
|
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { EvaluateOptions, ProgrammabilityService } from '../services/programmability.service';
|
|
2
|
+
import { FormGroup } from '@angular/forms';
|
|
3
|
+
import * as i0 from "@angular/core";
|
|
4
|
+
export declare class CacheContextService {
|
|
5
|
+
private programmability;
|
|
6
|
+
constructor(programmability: ProgrammabilityService);
|
|
7
|
+
evaluateString(cacheControl: any, formGroup: FormGroup, value: string | null, options?: EvaluateOptions): string;
|
|
8
|
+
evaluateBoolean(cacheControl: any, formGroup: FormGroup, value: boolean | string | null, options?: EvaluateOptions): boolean | null;
|
|
9
|
+
evaluateNumber(cacheControl: any, formGroup: FormGroup, value: number | string | null, options?: EvaluateOptions): number | null;
|
|
10
|
+
evaluate(cacheControl: any, formGroup: FormGroup, value: string | null, options?: EvaluateOptions): any;
|
|
11
|
+
evaluateTemplate(cacheControl: any, formGroup: FormGroup, value: string | null, options?: EvaluateOptions): any;
|
|
12
|
+
evaluateUnary(cacheControl: any, formGroup: FormGroup, value: string | null, input: any, options?: EvaluateOptions): any;
|
|
13
|
+
invalidate(cacheControl: any): void;
|
|
14
|
+
invalidateAll(): void;
|
|
15
|
+
private getOptions;
|
|
16
|
+
private call;
|
|
17
|
+
private isExpression;
|
|
18
|
+
private cache;
|
|
19
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<CacheContextService, never>;
|
|
20
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<CacheContextService>;
|
|
21
|
+
}
|
|
@@ -2,6 +2,7 @@ import { Injector } from '@angular/core';
|
|
|
2
2
|
import { MetadataService } from '../services/metadata.service';
|
|
3
3
|
import { DialogService, DialogOptions } from '../services/dialog.service';
|
|
4
4
|
import { IEvaluatorProvider } from '../services/programmability.service';
|
|
5
|
+
import { Observable } from 'rxjs';
|
|
5
6
|
import * as i0 from "@angular/core";
|
|
6
7
|
export declare class FunctionService implements IEvaluatorProvider {
|
|
7
8
|
private metadata;
|
|
@@ -9,6 +10,7 @@ export declare class FunctionService implements IEvaluatorProvider {
|
|
|
9
10
|
private injector;
|
|
10
11
|
constructor(metadata: MetadataService, dialog: DialogService, injector: Injector);
|
|
11
12
|
invokable(func: any): Function;
|
|
13
|
+
executeOnce<T>(observable: Observable<T>, callback: any): void;
|
|
12
14
|
openForm(template: string | object, options: DialogOptions): void;
|
|
13
15
|
getContext(): Record<string, any>;
|
|
14
16
|
static ɵfac: i0.ɵɵFactoryDeclaration<FunctionService, never>;
|
|
@@ -1,21 +1,25 @@
|
|
|
1
|
-
import { Module, ColDef, GridOptions } from 'ag-grid-community';
|
|
1
|
+
import { Module, RowSelectionOptions, ColDef, GridOptions, GridApi } from 'ag-grid-community';
|
|
2
2
|
import { FormGroup } from '@angular/forms';
|
|
3
3
|
import { FormatterService } from '../services/formatter.service';
|
|
4
4
|
import { ProgrammabilityService } from '../services/programmability.service';
|
|
5
|
+
import { WeakService } from '../services/weak.service';
|
|
5
6
|
import { LanguageService } from '@wemake4u/interact';
|
|
6
7
|
import * as i0 from "@angular/core";
|
|
7
8
|
export declare class GridService {
|
|
8
9
|
private formatter;
|
|
9
10
|
private languageService;
|
|
10
11
|
private programmability;
|
|
11
|
-
|
|
12
|
+
private weak;
|
|
13
|
+
constructor(formatter: FormatterService, languageService: LanguageService, programmability: ProgrammabilityService, weak: WeakService);
|
|
12
14
|
getModules(): Module[];
|
|
13
15
|
getOptions(component: any, formGroup: FormGroup): GridOptions;
|
|
14
16
|
getColumnDefs(component: any, columns: any, formGroup: FormGroup): ColDef[];
|
|
15
17
|
onSelectionChanged(component: any, formGroup: FormGroup, event: any): any;
|
|
18
|
+
getCacheKey(): string;
|
|
19
|
+
invalidateOptions(component: any): void;
|
|
16
20
|
private get language();
|
|
17
21
|
private locale;
|
|
18
|
-
|
|
22
|
+
resizeGrid(component: any, api: GridApi): void;
|
|
19
23
|
private hasActions;
|
|
20
24
|
private hasRowNumbers;
|
|
21
25
|
private createColumnDefs;
|
|
@@ -40,11 +44,13 @@ export declare class GridService {
|
|
|
40
44
|
private setPinned;
|
|
41
45
|
private setWidth;
|
|
42
46
|
private setValueFormatter;
|
|
43
|
-
|
|
47
|
+
getRowSelection(component: any, formGroup: FormGroup): RowSelectionOptions | undefined;
|
|
44
48
|
private onRowSelectable;
|
|
45
49
|
private onRowSelected;
|
|
46
50
|
private onRowSelecting;
|
|
47
|
-
private
|
|
51
|
+
private suppressActions;
|
|
52
|
+
private selectable;
|
|
53
|
+
private multiSelect;
|
|
48
54
|
private getPaginable;
|
|
49
55
|
private getPageSize;
|
|
50
56
|
private getTexts;
|
|
@@ -29,12 +29,12 @@ export declare class ProgrammabilityService implements OnDestroy {
|
|
|
29
29
|
ngOnDestroy(): void;
|
|
30
30
|
isExpression(text: string | null): boolean;
|
|
31
31
|
getExpression(text: string | null): string;
|
|
32
|
-
evaluateString(formGroup: FormGroup, value: string | null): string;
|
|
32
|
+
evaluateString(formGroup: FormGroup, value: string | null, options?: EvaluateOptions): string;
|
|
33
33
|
evaluateBoolean(formGroup: FormGroup, value: boolean | string | null, options?: EvaluateOptions): boolean | null;
|
|
34
|
-
evaluateNumber(formGroup: FormGroup, value: number | string | null): number | null;
|
|
34
|
+
evaluateNumber(formGroup: FormGroup, value: number | string | null, options?: EvaluateOptions): number | null;
|
|
35
35
|
evaluate(formGroup: FormGroup, value: string | null, options?: EvaluateOptions): any;
|
|
36
36
|
evaluateTemplate(formGroup: FormGroup, value: string | null, options?: EvaluateOptions): any;
|
|
37
|
-
evaluateUnary(formGroup: FormGroup, value: string | null, input: any): any;
|
|
37
|
+
evaluateUnary(formGroup: FormGroup, value: string | null, input: any, options?: EvaluateOptions): any;
|
|
38
38
|
invalidate(value: string | null): void;
|
|
39
39
|
watch(formGroup: FormGroup, dependencies: (string | string[])[], callback: () => void): void;
|
|
40
40
|
getDependencies(expression: string): (string | string[])[];
|
|
@@ -69,6 +69,7 @@ export interface IEvaluatorProvider {
|
|
|
69
69
|
}
|
|
70
70
|
export interface EvaluateOptions {
|
|
71
71
|
cacheable?: boolean;
|
|
72
|
+
ignoreDeps?: boolean;
|
|
72
73
|
extendContext?: ExtendContextFn;
|
|
73
74
|
}
|
|
74
75
|
export type ExtendContextFn = () => Record<string, any>;
|
|
@@ -5,6 +5,7 @@ export declare class WeakService {
|
|
|
5
5
|
exists(source: object, key: string): boolean;
|
|
6
6
|
call<T>(source: object, key: string, func: () => T, reusable?: ((value: T) => boolean) | null, store?: ((value: T) => any) | null): T;
|
|
7
7
|
invalidate(source: object, key: string): void;
|
|
8
|
+
invalidateAll(source: object): void;
|
|
8
9
|
static ɵfac: i0.ɵɵFactoryDeclaration<WeakService, never>;
|
|
9
10
|
static ɵprov: i0.ɵɵInjectableDeclaration<WeakService>;
|
|
10
11
|
}
|
package/package.json
CHANGED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
export function ToBoundArrows(instance, methodNames) {
|
|
2
|
-
const result = {};
|
|
3
|
-
for (const name of methodNames) {
|
|
4
|
-
const original = instance[name];
|
|
5
|
-
if (typeof original === 'function') {
|
|
6
|
-
result[name] = (...args) => original.apply(instance, args);
|
|
7
|
-
}
|
|
8
|
-
}
|
|
9
|
-
return result;
|
|
10
|
-
}
|
|
11
|
-
export function ToProxy(instance) {
|
|
12
|
-
if (!instance) {
|
|
13
|
-
return instance;
|
|
14
|
-
}
|
|
15
|
-
return new Proxy(instance, {
|
|
16
|
-
get: (target, property) => {
|
|
17
|
-
let value = undefined;
|
|
18
|
-
if (property in target) {
|
|
19
|
-
value = Reflect.get(target, property, target);
|
|
20
|
-
}
|
|
21
|
-
if (typeof value === 'function') {
|
|
22
|
-
return (...args) => value.apply(instance, args);
|
|
23
|
-
}
|
|
24
|
-
else if (typeof value === 'object' && value !== null) {
|
|
25
|
-
return ToProxy(value);
|
|
26
|
-
}
|
|
27
|
-
return value;
|
|
28
|
-
}
|
|
29
|
-
});
|
|
30
|
-
}
|
|
31
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZnVuY3Rpb25zLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vLi4vcHJvamVjdHMvbmd4LXNpcmlvL3NyYy9saWIvdXRpbHMvZnVuY3Rpb25zLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE1BQU0sVUFBVSxhQUFhLENBQzNCLFFBQVcsRUFDWCxXQUF3QjtJQUN4QixNQUFNLE1BQU0sR0FBd0IsRUFBRSxDQUFDO0lBRXZDLEtBQUssTUFBTSxJQUFJLElBQUksV0FBVyxFQUFFLENBQUM7UUFDL0IsTUFBTSxRQUFRLEdBQUcsUUFBUSxDQUFDLElBQUksQ0FBQyxDQUFDO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