@wemake4u/form-player-se 1.0.5 → 1.0.7
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/controls/factory.mjs +5 -1
- package/esm2022/lib/directives/accordionpanel.directive.mjs +27 -0
- package/esm2022/lib/directives/collapse.directive.mjs +143 -0
- package/esm2022/lib/directives/date.directive.mjs +2 -2
- package/esm2022/lib/directives/disableform.directive.mjs +42 -0
- package/esm2022/lib/directives/framesecurity.directive.mjs +66 -0
- package/esm2022/lib/directives/repeat.directive.mjs +3 -11
- package/esm2022/lib/directives/tabcontrol.directive.mjs +46 -0
- package/esm2022/lib/directives/text.directive.mjs +100 -0
- package/esm2022/lib/dynamic-fields/dynamic-fields.component.mjs +33 -16
- package/esm2022/lib/dynamic-form/dynamic-form.component.mjs +119 -41
- package/esm2022/lib/locale/locale-it.mjs +4 -2
- package/esm2022/lib/services/feel.service.mjs +1 -1
- package/esm2022/lib/services/metadata.service.mjs +29 -0
- package/esm2022/lib/services/programmability.service.mjs +2 -1
- package/esm2022/lib/utils/groupByRow.mjs +2 -1
- package/fesm2022/wemake4u-form-player-se.mjs +537 -119
- package/fesm2022/wemake4u-form-player-se.mjs.map +1 -1
- package/lib/directives/accordionpanel.directive.d.ts +7 -0
- package/lib/directives/collapse.directive.d.ts +31 -0
- package/lib/directives/repeat.directive.d.ts +0 -1
- package/lib/directives/tabcontrol.directive.d.ts +14 -0
- package/lib/directives/text.directive.d.ts +20 -0
- package/lib/dynamic-fields/dynamic-fields.component.d.ts +7 -1
- package/lib/dynamic-form/dynamic-form.component.d.ts +12 -1
- package/lib/locale/locale-it.d.ts +2 -0
- package/lib/services/metadata.service.d.ts +13 -0
- package/lib/utils/gridCells.d.ts +4 -0
- package/lib/utils/groupByRow.d.ts +2 -0
- package/package.json +2 -2
- package/esm2022/lib/directives/disable-form.directive.mjs +0 -42
- package/esm2022/lib/directives/frame-security.directive.mjs +0 -66
- /package/lib/directives/{disable-form.directive.d.ts → disableform.directive.d.ts} +0 -0
- /package/lib/directives/{frame-security.directive.d.ts → framesecurity.directive.d.ts} +0 -0
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { SirioAccordionPanelComponent } from 'ngx-sirio-lib';
|
|
2
|
+
import * as i0 from "@angular/core";
|
|
3
|
+
export declare class AccordionPanelDirective {
|
|
4
|
+
constructor(panel: SirioAccordionPanelComponent);
|
|
5
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<AccordionPanelDirective, [{ host: true; }]>;
|
|
6
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<AccordionPanelDirective, "[accordionPanel]", never, {}, {}, never, never, true, never>;
|
|
7
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { ElementRef, Renderer2, OnChanges, SimpleChanges, OnDestroy } from '@angular/core';
|
|
2
|
+
import * as i0 from "@angular/core";
|
|
3
|
+
export declare class CollapseDirective implements OnChanges, OnDestroy {
|
|
4
|
+
private el;
|
|
5
|
+
private renderer;
|
|
6
|
+
maxHeight: number | null;
|
|
7
|
+
private currentHeight;
|
|
8
|
+
private button;
|
|
9
|
+
private iconSpan;
|
|
10
|
+
private expanded;
|
|
11
|
+
private viewInitialized;
|
|
12
|
+
private timeoutFocusOut;
|
|
13
|
+
private unlistenFocusOut;
|
|
14
|
+
constructor(el: ElementRef, renderer: Renderer2);
|
|
15
|
+
ngAfterViewInit(): void;
|
|
16
|
+
ngOnChanges(changes: SimpleChanges): void;
|
|
17
|
+
private applyCollapseLogic;
|
|
18
|
+
private applyStyle;
|
|
19
|
+
private resetStyles;
|
|
20
|
+
private applyButton;
|
|
21
|
+
private resetButton;
|
|
22
|
+
private applyFocusHandler;
|
|
23
|
+
private resetFocusHandler;
|
|
24
|
+
private toggleExpand;
|
|
25
|
+
private expand;
|
|
26
|
+
private collapse;
|
|
27
|
+
private updateIcon;
|
|
28
|
+
ngOnDestroy(): void;
|
|
29
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<CollapseDirective, never>;
|
|
30
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<CollapseDirective, "[collapse]", never, { "maxHeight": { "alias": "collapse"; "required": false; }; }, {}, never, never, true, never>;
|
|
31
|
+
}
|
|
@@ -6,7 +6,6 @@ export declare class RepeatDirective implements OnChanges {
|
|
|
6
6
|
repeat: any;
|
|
7
7
|
constructor(controlContainer: ControlContainer);
|
|
8
8
|
ngOnChanges(changes: SimpleChanges): void;
|
|
9
|
-
private resizeArray;
|
|
10
9
|
static ɵfac: i0.ɵɵFactoryDeclaration<RepeatDirective, never>;
|
|
11
10
|
static ɵdir: i0.ɵɵDirectiveDeclaration<RepeatDirective, "[repeat]", never, { "repeat": { "alias": "repeat"; "required": false; }; }, {}, never, never, true, never>;
|
|
12
11
|
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { OnInit, OnDestroy } from '@angular/core';
|
|
2
|
+
import { SirioTabComponent } from 'ngx-sirio-lib';
|
|
3
|
+
import * as i0 from "@angular/core";
|
|
4
|
+
export declare class TabControlDirective implements OnInit, OnDestroy {
|
|
5
|
+
private sirioTab;
|
|
6
|
+
constructor(sirioTab: SirioTabComponent);
|
|
7
|
+
ngOnInit(): void;
|
|
8
|
+
ngOnDestroy(): void;
|
|
9
|
+
private tabChangeSub;
|
|
10
|
+
private HandleIndexChange;
|
|
11
|
+
private validateIndex;
|
|
12
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<TabControlDirective, [{ host: true; }]>;
|
|
13
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<TabControlDirective, "[tabControl]", never, {}, {}, never, never, true, never>;
|
|
14
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { Renderer2, OnChanges, AfterViewInit, SimpleChanges } from '@angular/core';
|
|
2
|
+
import { SirioInputComponent } from 'ngx-sirio-lib';
|
|
3
|
+
import * as i0 from "@angular/core";
|
|
4
|
+
export declare class TextDirective implements OnChanges, AfterViewInit {
|
|
5
|
+
private sirioInput;
|
|
6
|
+
private renderer;
|
|
7
|
+
textcase: '' | 'uppercase' | 'lowercase';
|
|
8
|
+
maxlength: number | null;
|
|
9
|
+
constructor(sirioInput: SirioInputComponent, renderer: Renderer2);
|
|
10
|
+
ngAfterViewInit(): void;
|
|
11
|
+
ngOnChanges(changes: SimpleChanges): void;
|
|
12
|
+
private coerceValue;
|
|
13
|
+
private applyCase;
|
|
14
|
+
private applyMaxLength;
|
|
15
|
+
private configureTextCase;
|
|
16
|
+
private configureMaxLength;
|
|
17
|
+
private replaceInputValue;
|
|
18
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<TextDirective, [{ host: true; }, null]>;
|
|
19
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<TextDirective, "[textcase], [maxlength]", never, { "textcase": { "alias": "textcase"; "required": false; }; "maxlength": { "alias": "maxlength"; "required": false; }; }, {}, never, never, true, never>;
|
|
20
|
+
}
|
|
@@ -9,6 +9,7 @@ import { EventService } from '../services/event.service';
|
|
|
9
9
|
import { FormatterService } from '../services/formatter.service';
|
|
10
10
|
import { WeakService } from '../services/weak.service';
|
|
11
11
|
import { RegisterService } from '../services/register.service';
|
|
12
|
+
import { MetadataService } from '../services/metadata.service';
|
|
12
13
|
import { ButtonColors } from 'ngx-sirio-lib';
|
|
13
14
|
import { Observable } from 'rxjs';
|
|
14
15
|
import { SirioFileUploadComponent, NgxSirioEvent } from 'ngx-sirio-lib';
|
|
@@ -23,6 +24,7 @@ export declare class DynamicFieldsComponent implements OnInit, AfterViewInit {
|
|
|
23
24
|
private formatter;
|
|
24
25
|
private weak;
|
|
25
26
|
private register;
|
|
27
|
+
private metadata;
|
|
26
28
|
private el;
|
|
27
29
|
rows: Array<any> | undefined;
|
|
28
30
|
formGroup: FormGroup;
|
|
@@ -42,8 +44,10 @@ export declare class DynamicFieldsComponent implements OnInit, AfterViewInit {
|
|
|
42
44
|
Size: string;
|
|
43
45
|
Type: string;
|
|
44
46
|
Actions: string;
|
|
47
|
+
ReadMore: string;
|
|
48
|
+
ReadLess: string;
|
|
45
49
|
};
|
|
46
|
-
constructor(sanitizer: SanitizeService, markdown: MarkdownService, mime: MimeService, programmability: ProgrammabilityService, events: EventService, formatter: FormatterService, weak: WeakService, register: RegisterService, el: ElementRef);
|
|
50
|
+
constructor(sanitizer: SanitizeService, markdown: MarkdownService, mime: MimeService, programmability: ProgrammabilityService, events: EventService, formatter: FormatterService, weak: WeakService, register: RegisterService, metadata: MetadataService, el: ElementRef);
|
|
47
51
|
ngOnInit(): void;
|
|
48
52
|
ngAfterViewInit(): void;
|
|
49
53
|
getRegister(): RegisterService;
|
|
@@ -57,6 +61,8 @@ export declare class DynamicFieldsComponent implements OnInit, AfterViewInit {
|
|
|
57
61
|
evaluateTemplate(value: string | null): string;
|
|
58
62
|
evaluate(text: string | null, cacheable?: boolean): any;
|
|
59
63
|
evaluateColor(value: string | null): ButtonColors | null;
|
|
64
|
+
evaluateConditional(conditional: any): boolean;
|
|
65
|
+
getTemplate(value: string): any;
|
|
60
66
|
getFormGroup(control: AbstractControl | null): FormGroup;
|
|
61
67
|
getFormArray(control: AbstractControl | null): FormArray;
|
|
62
68
|
getControlFromPath(path: string | null): AbstractControl | null;
|
|
@@ -2,6 +2,7 @@ import { OnChanges, OnDestroy, SimpleChanges, EventEmitter } from '@angular/core
|
|
|
2
2
|
import { FormBuilder, FormGroup } from '@angular/forms';
|
|
3
3
|
import { ProgrammabilityService } from '../services/programmability.service';
|
|
4
4
|
import { CommandEvent, EventService } from '../services/event.service';
|
|
5
|
+
import { MetadataService } from '../services/metadata.service';
|
|
5
6
|
import { SirioStepperProgressStatus } from 'ngx-sirio-lib';
|
|
6
7
|
import { RegisterService } from '../services/register.service';
|
|
7
8
|
import { Control } from '../controls/control';
|
|
@@ -11,6 +12,7 @@ export declare class DynamicFormComponent implements OnChanges, OnDestroy {
|
|
|
11
12
|
private programmability;
|
|
12
13
|
private events;
|
|
13
14
|
private registerService;
|
|
15
|
+
private metadata;
|
|
14
16
|
schema: any;
|
|
15
17
|
formGroup: FormGroup;
|
|
16
18
|
value: any;
|
|
@@ -22,7 +24,7 @@ export declare class DynamicFormComponent implements OnChanges, OnDestroy {
|
|
|
22
24
|
initialized: EventEmitter<FormGroup<any>>;
|
|
23
25
|
onCommand: EventEmitter<CommandEvent>;
|
|
24
26
|
activeNavChange: EventEmitter<any>;
|
|
25
|
-
constructor(fb: FormBuilder, programmability: ProgrammabilityService, events: EventService, registerService: RegisterService);
|
|
27
|
+
constructor(fb: FormBuilder, programmability: ProgrammabilityService, events: EventService, registerService: RegisterService, metadata: MetadataService);
|
|
26
28
|
Texts: {
|
|
27
29
|
TypeToSearch: string;
|
|
28
30
|
Upload: string;
|
|
@@ -39,6 +41,8 @@ export declare class DynamicFormComponent implements OnChanges, OnDestroy {
|
|
|
39
41
|
Size: string;
|
|
40
42
|
Type: string;
|
|
41
43
|
Actions: string;
|
|
44
|
+
ReadMore: string;
|
|
45
|
+
ReadLess: string;
|
|
42
46
|
};
|
|
43
47
|
ngOnDestroy(): void;
|
|
44
48
|
private internalChange;
|
|
@@ -60,6 +64,7 @@ export declare class DynamicFormComponent implements OnChanges, OnDestroy {
|
|
|
60
64
|
private onCommandSubscription;
|
|
61
65
|
private _forms;
|
|
62
66
|
private _activeNav;
|
|
67
|
+
private defaultValue;
|
|
63
68
|
private getNext;
|
|
64
69
|
private getPrevious;
|
|
65
70
|
private getMaxNav;
|
|
@@ -69,11 +74,17 @@ export declare class DynamicFormComponent implements OnChanges, OnDestroy {
|
|
|
69
74
|
private clearHandlers;
|
|
70
75
|
private buildForm;
|
|
71
76
|
private addControls;
|
|
77
|
+
private createFormArray;
|
|
78
|
+
private resizeFormArray;
|
|
72
79
|
private applyPath;
|
|
73
80
|
private getValidators;
|
|
74
81
|
private validateFn;
|
|
75
82
|
private invalidateFn;
|
|
76
83
|
private isFormComponent;
|
|
84
|
+
private isContainerComponent;
|
|
85
|
+
private isArrayComponent;
|
|
86
|
+
private getArrayItem;
|
|
87
|
+
private getContainers;
|
|
77
88
|
private getUpdateOn;
|
|
78
89
|
private getDefaultValue;
|
|
79
90
|
private splitPath;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import * as i0 from "@angular/core";
|
|
2
|
+
export declare class MetadataService {
|
|
3
|
+
constructor();
|
|
4
|
+
setSchema(schema: any): void;
|
|
5
|
+
getSchema(): any;
|
|
6
|
+
setForms(forms: any[]): void;
|
|
7
|
+
getForms(): any[];
|
|
8
|
+
getFormByName(name: string): any;
|
|
9
|
+
private schema;
|
|
10
|
+
private forms;
|
|
11
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<MetadataService, never>;
|
|
12
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<MetadataService>;
|
|
13
|
+
}
|
package/lib/utils/gridCells.d.ts
CHANGED
|
@@ -20,6 +20,8 @@ export declare class ObjectURLRendererComponent implements ICellRendererAngularC
|
|
|
20
20
|
Size: string;
|
|
21
21
|
Type: string;
|
|
22
22
|
Actions: string;
|
|
23
|
+
ReadMore: string;
|
|
24
|
+
ReadLess: string;
|
|
23
25
|
};
|
|
24
26
|
agInit(params: ICellRendererParams): void;
|
|
25
27
|
onClick(event: Event): void;
|
|
@@ -45,6 +47,8 @@ export declare class DeleteRowCellRenderer implements ICellRendererAngularComp {
|
|
|
45
47
|
Size: string;
|
|
46
48
|
Type: string;
|
|
47
49
|
Actions: string;
|
|
50
|
+
ReadMore: string;
|
|
51
|
+
ReadLess: string;
|
|
48
52
|
};
|
|
49
53
|
agInit(params: any): void;
|
|
50
54
|
onClick(event: Event): void;
|
|
@@ -5,6 +5,7 @@ interface Form {
|
|
|
5
5
|
title: string;
|
|
6
6
|
disabled: string | boolean | null;
|
|
7
7
|
path: string | null;
|
|
8
|
+
isTemplate: boolean | null;
|
|
8
9
|
components: Component[];
|
|
9
10
|
}
|
|
10
11
|
interface Component {
|
|
@@ -32,6 +33,7 @@ interface RowGroup {
|
|
|
32
33
|
interface GroupedForm {
|
|
33
34
|
id: string;
|
|
34
35
|
title: string;
|
|
36
|
+
isTemplate: boolean | null;
|
|
35
37
|
rows: RowGroup[];
|
|
36
38
|
[key: string]: any;
|
|
37
39
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wemake4u/form-player-se",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.7",
|
|
4
4
|
"peerDependencies": {
|
|
5
5
|
"@angular/cdk": "^18.2.0",
|
|
6
6
|
"@angular/common": "^18.2.0",
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
"@types/sanitize-html": "2.13.0",
|
|
20
20
|
"@types/vanillajs-datepicker": "^1.3.4",
|
|
21
21
|
"feelers": "^1.4.0",
|
|
22
|
-
"feelin": "3.
|
|
22
|
+
"feelin": "4.3.0",
|
|
23
23
|
"marked": "15.0.7",
|
|
24
24
|
"mime-db": "1.53.0",
|
|
25
25
|
"sanitize-html": "^2.13.0",
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import { Directive, Input } from '@angular/core';
|
|
2
|
-
import { FormGroup } from '@angular/forms';
|
|
3
|
-
import * as i0 from "@angular/core";
|
|
4
|
-
export class DisableFormDirective {
|
|
5
|
-
templateRef;
|
|
6
|
-
viewContainer;
|
|
7
|
-
config;
|
|
8
|
-
constructor(templateRef, viewContainer) {
|
|
9
|
-
this.templateRef = templateRef;
|
|
10
|
-
this.viewContainer = viewContainer;
|
|
11
|
-
}
|
|
12
|
-
ngOnChanges(changes) {
|
|
13
|
-
if (this.hasValue(this.config.path) && this.config.formGroup) {
|
|
14
|
-
var formGroup = this.config.formGroup.get(this.config.path);
|
|
15
|
-
if (formGroup instanceof FormGroup) {
|
|
16
|
-
if (this.config.disabled) {
|
|
17
|
-
formGroup.disable({ emitEvent: false });
|
|
18
|
-
}
|
|
19
|
-
else {
|
|
20
|
-
formGroup.enable({ emitEvent: false });
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
this.viewContainer.clear();
|
|
25
|
-
}
|
|
26
|
-
hasValue(value) {
|
|
27
|
-
return value != null && value.trim().length > 0;
|
|
28
|
-
}
|
|
29
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: DisableFormDirective, deps: [{ token: i0.TemplateRef }, { token: i0.ViewContainerRef }], target: i0.ɵɵFactoryTarget.Directive });
|
|
30
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "18.2.13", type: DisableFormDirective, isStandalone: true, selector: "[disableForm]", inputs: { config: ["disableForm", "config"] }, usesOnChanges: true, ngImport: i0 });
|
|
31
|
-
}
|
|
32
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: DisableFormDirective, decorators: [{
|
|
33
|
-
type: Directive,
|
|
34
|
-
args: [{
|
|
35
|
-
selector: '[disableForm]',
|
|
36
|
-
standalone: true
|
|
37
|
-
}]
|
|
38
|
-
}], ctorParameters: () => [{ type: i0.TemplateRef }, { type: i0.ViewContainerRef }], propDecorators: { config: [{
|
|
39
|
-
type: Input,
|
|
40
|
-
args: ['disableForm']
|
|
41
|
-
}] } });
|
|
42
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZGlzYWJsZS1mb3JtLmRpcmVjdGl2ZS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uLy4uL3Byb2plY3RzL25neC1zaXJpby9zcmMvbGliL2RpcmVjdGl2ZXMvZGlzYWJsZS1mb3JtLmRpcmVjdGl2ZS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEVBQUUsU0FBUyxFQUFFLEtBQUssRUFBMkQsTUFBTSxlQUFlLENBQUM7QUFDMUcsT0FBTyxFQUFFLFNBQVMsRUFBRSxNQUFNLGdCQUF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HVlKHRoaXMuY29uZmlnLnBhdGgpICYmIHRoaXMuY29uZmlnLmZvcm1Hcm91cCkge1xyXG4gICAgICB2YXIgZm9ybUdyb3VwID0gdGhpcy5jb25maWcuZm9ybUdyb3VwLmdldCh0aGlzLmNvbmZpZy5wYXRoKTtcclxuICAgICAgaWYgKGZvcm1Hcm91cCBpbnN0YW5jZW9mIEZvcm1Hcm91cCkge1xyXG4gICAgICAgIGlmICh0aGlzLmNvbmZpZy5kaXNhYmxlZCkge1xyXG4gICAgICAgICAgZm9ybUdyb3VwLmRpc2FibGUoeyBlbWl0RXZlbnQ6IGZhbHNlIH0pO1xyXG4gICAgICAgIH0gZWxzZSB7XHJcbiAgICAgICAgICBmb3JtR3JvdXAuZW5hYmxlKHsgZW1pdEV2ZW50OiBmYWxzZSB9KTtcclxuICAgICAgICB9XHJcbiAgICAgIH1cclxuICAgIH1cclxuICAgIFxyXG4gICAgdGhpcy52aWV3Q29udGFpbmVyLmNsZWFyKCk7XHJcbiAgfVxyXG5cclxuICBwcml2YXRlIGhhc1ZhbHVlKHZhbHVlOiBzdHJpbmcgfCBudWxsKTogYm9vbGVhbiB7XHJcbiAgICByZXR1cm4gdmFsdWUgIT0gbnVsbCAmJiB2YWx1ZS50cmltKCkubGVuZ3RoID4gMDtcclxuICB9XHJcbn1cclxuIl19
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
import { Directive, Input } from '@angular/core';
|
|
2
|
-
import * as i0 from "@angular/core";
|
|
3
|
-
export class FrameSecurityDirective {
|
|
4
|
-
el;
|
|
5
|
-
renderer;
|
|
6
|
-
frameSecurity = null;
|
|
7
|
-
constructor(el, renderer) {
|
|
8
|
-
this.el = el;
|
|
9
|
-
this.renderer = renderer;
|
|
10
|
-
}
|
|
11
|
-
ngAfterViewInit() {
|
|
12
|
-
const frame = this.el.nativeElement;
|
|
13
|
-
const sandbox = this.getSandBox(this.frameSecurity);
|
|
14
|
-
if (sandbox)
|
|
15
|
-
this.renderer.setAttribute(frame, 'sandbox', sandbox);
|
|
16
|
-
const allow = this.getAllow(this.frameSecurity);
|
|
17
|
-
if (allow)
|
|
18
|
-
this.renderer.setAttribute(frame, 'allow', allow);
|
|
19
|
-
}
|
|
20
|
-
getSandBox(security) {
|
|
21
|
-
let allowedProperties = [
|
|
22
|
-
"allowScripts",
|
|
23
|
-
"allowSameOrigin",
|
|
24
|
-
"allowForms",
|
|
25
|
-
"allowModals",
|
|
26
|
-
"allowPopups",
|
|
27
|
-
"allowTopNavigation",
|
|
28
|
-
"allowStorageAccessByUserActivation"
|
|
29
|
-
];
|
|
30
|
-
let sandBox = Object.entries(security)
|
|
31
|
-
.filter(([key, value]) => value === true && allowedProperties.includes(key))
|
|
32
|
-
.map(([key]) => this.camelToKebabCase(key))
|
|
33
|
-
.join(' ');
|
|
34
|
-
return sandBox;
|
|
35
|
-
}
|
|
36
|
-
;
|
|
37
|
-
getAllow(security) {
|
|
38
|
-
let allowedProperties = [
|
|
39
|
-
"fullscreen",
|
|
40
|
-
"geolocation",
|
|
41
|
-
"camera",
|
|
42
|
-
"microphone"
|
|
43
|
-
];
|
|
44
|
-
let allow = Object.entries(security)
|
|
45
|
-
.filter(([key, value]) => value === true && allowedProperties.includes(key))
|
|
46
|
-
.map(([key]) => key)
|
|
47
|
-
.join(' ');
|
|
48
|
-
return allow;
|
|
49
|
-
}
|
|
50
|
-
;
|
|
51
|
-
camelToKebabCase(str) {
|
|
52
|
-
return str.replace(/[A-Z]/g, (match) => '-' + match.toLowerCase());
|
|
53
|
-
}
|
|
54
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: FrameSecurityDirective, deps: [{ token: i0.ElementRef }, { token: i0.Renderer2 }], target: i0.ɵɵFactoryTarget.Directive });
|
|
55
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "18.2.13", type: FrameSecurityDirective, isStandalone: true, selector: "[frameSecurity]", inputs: { frameSecurity: "frameSecurity" }, ngImport: i0 });
|
|
56
|
-
}
|
|
57
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: FrameSecurityDirective, decorators: [{
|
|
58
|
-
type: Directive,
|
|
59
|
-
args: [{
|
|
60
|
-
selector: '[frameSecurity]',
|
|
61
|
-
standalone: true
|
|
62
|
-
}]
|
|
63
|
-
}], ctorParameters: () => [{ type: i0.ElementRef }, { type: i0.Renderer2 }], propDecorators: { frameSecurity: [{
|
|
64
|
-
type: Input
|
|
65
|
-
}] } });
|
|
66
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZnJhbWUtc2VjdXJpdHkuZGlyZWN0aXZlLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vLi4vcHJvamVjdHMvbmd4LXNpcmlvL3NyYy9saWIvZGlyZWN0aXZlcy9mcmFtZS1zZWN1cml0eS5kaXJlY3RpdmUudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxFQUFFLFNBQVMsRUFBRSxLQUFLLEVBQXdDLE1BQU0sZUFBZSxDQUFDOztBQU12RixNQUFNLE9BQU8sc0JBQXNCO0lBR2I7SUFBd0I7SUFGbkMsYUFBYSxHQUFRLElBQUksQ0FBQztJQUVuQyxZQUFvQixFQUFjLEVBQVUsUUFBbUI7UUFBM0MsT0FBRSxHQUFGLEVBQUUsQ0FBWTtRQUFVLGFBQVEsR0FBUixRQUFRLENBQVc7SUFBSSxDQUFDO0lBRXBFLGVBQWU7UUFDYixNQUFNLEtBQUssR0FBRyxJQUFJLENBQUMsRUFBRSxDQUFDLGFBQWEsQ0FBQztRQUVwQyxNQUFNLE9BQU8sR0FBRyxJQUFJLENBQUMsVUFBVSxDQUFDLElBQUksQ0FBQyxhQUFhLENBQUMsQ0FBQztRQUVwRCxJQUFJLE9BQU87WUFDVCxJQUFJLENBQUMsUUFBU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fVxyXG59XHJcbiJdfQ==
|
|
File without changes
|
|
File without changes
|