|
|
|
@ -17,82 +17,112 @@ |
|
|
|
--> |
|
|
|
<ng-container [formGroup]="htmlContainerSettingsForm"> |
|
|
|
<div class="tb-form-panel no-padding no-border relative h-full"> |
|
|
|
<div class="flex flex-row items-center gap-4"> |
|
|
|
<div class="tb-form-panel-title" translate>widgets.html-container.container-type</div> |
|
|
|
<div class="flex flex-row items-center"> |
|
|
|
<tb-toggle-select formControlName="type"> |
|
|
|
<tb-toggle-option [value]="HtmlContainerWidgetType.PLAIN">{{ 'widgets.html-container.type-plain' | translate }}</tb-toggle-option> |
|
|
|
<tb-toggle-option [value]="HtmlContainerWidgetType.ANGULAR">{{ 'widgets.html-container.type-angular' | translate }}</tb-toggle-option> |
|
|
|
</tb-toggle-select> |
|
|
|
</div> |
|
|
|
<mat-tab-group [mat-stretch-tabs]="false" selectedIndex="3" class="flex-1"> |
|
|
|
<mat-tab #resourceTab="matTab"> |
|
|
|
<ng-template mat-tab-label> |
|
|
|
<div [matBadge]="resourcesFormArray.length" [matBadgeHidden]="resourceTab.isActive || !resourcesFormArray.length" |
|
|
|
matBadgeSize="small">{{ 'widgets.html-container.resources' | translate }}</div> |
|
|
|
</ng-template> |
|
|
|
<div class="flex flex-col gap-2 pt-4"> |
|
|
|
@if (resourcesFormArray.length) { |
|
|
|
@for (resourceControl of resourcesControls; track resourceControl; let i = $index) { |
|
|
|
<div class="tb-form-row no-border no-padding" [formGroup]="resourceControl"> |
|
|
|
<tb-resource-autocomplete class="flex-1" |
|
|
|
formControlName="url" |
|
|
|
inlineField |
|
|
|
hideRequiredMarker required |
|
|
|
[allowAutocomplete]="resourceControl.get('isModule').value && htmlContainerSettingsForm.get('type').value === HtmlContainerWidgetType.ANGULAR" |
|
|
|
placeholder="{{ 'widget.resource-url' | translate }}"> |
|
|
|
</tb-resource-autocomplete> |
|
|
|
@if (htmlContainerSettingsForm.get('type').value === HtmlContainerWidgetType.ANGULAR) { |
|
|
|
<mat-checkbox formControlName="isModule"> |
|
|
|
{{ 'widget.resource-is-extension' | translate }} |
|
|
|
</mat-checkbox> |
|
|
|
<div class="tb-html-container-settings-panel flex flex-1 flex-col" tb-fullscreen [fullscreen]="fullscreen"> |
|
|
|
<div class="tb-action-expand-button flex flex-row items-center justify-end"> |
|
|
|
<button mat-stroked-button |
|
|
|
matTooltip="{{ 'widget.toggle-fullscreen' | translate }}" |
|
|
|
matTooltipPosition="above" |
|
|
|
(click)="toggleFullScreen()"> |
|
|
|
<mat-icon>{{ fullscreen ? 'fullscreen_exit' : 'fullscreen' }}</mat-icon> |
|
|
|
<span>{{ (fullscreen ? 'fullscreen.exit' : 'fullscreen.fullscreen') | translate }}</span> |
|
|
|
</button> |
|
|
|
</div> |
|
|
|
<div class="flex flex-1"> |
|
|
|
<mat-tab-group #leftPanel |
|
|
|
[mat-stretch-tabs]="fullscreen" |
|
|
|
[selectedIndex]="fullscreen ? 2 : 3" |
|
|
|
[animationDuration]="tabsAnimationDuration" |
|
|
|
[disablePagination]="fullscreen" |
|
|
|
class="tb-content" |
|
|
|
[class.flex-1]="!fullscreen"> |
|
|
|
<mat-tab #resourceTab="matTab"> |
|
|
|
<ng-template mat-tab-label> |
|
|
|
<div [matBadge]="resourcesFormArray.length" [matBadgeHidden]="resourceTab.isActive || !resourcesFormArray.length" |
|
|
|
matBadgeSize="small">{{ 'widgets.html-container.resources' | translate }}</div> |
|
|
|
</ng-template> |
|
|
|
<div class="flex flex-col gap-2 pt-4" [class.px-2]="fullscreen"> |
|
|
|
@if (resourcesFormArray.length) { |
|
|
|
@for (resourceControl of resourcesControls; track resourceControl; let i = $index) { |
|
|
|
<div class="tb-form-row no-border no-padding" [formGroup]="resourceControl"> |
|
|
|
<tb-resource-autocomplete class="flex-1" |
|
|
|
formControlName="url" |
|
|
|
inlineField |
|
|
|
hideRequiredMarker required |
|
|
|
[allowAutocomplete]="resourceControl.get('isModule').value && htmlContainerSettingsForm.get('type').value === HtmlContainerWidgetType.ANGULAR" |
|
|
|
placeholder="{{ 'widget.resource-url' | translate }}"> |
|
|
|
</tb-resource-autocomplete> |
|
|
|
@if (htmlContainerSettingsForm.get('type').value === HtmlContainerWidgetType.ANGULAR) { |
|
|
|
<mat-checkbox formControlName="isModule"> |
|
|
|
{{ 'widget.resource-is-extension' | translate }} |
|
|
|
</mat-checkbox> |
|
|
|
} |
|
|
|
<button mat-icon-button color="primary" |
|
|
|
(click)="removeResource(i)" |
|
|
|
matTooltip="{{'widget.remove-resource' | translate}}" |
|
|
|
matTooltipPosition="above"> |
|
|
|
<mat-icon>delete</mat-icon> |
|
|
|
</button> |
|
|
|
</div> |
|
|
|
} |
|
|
|
<button mat-icon-button color="primary" |
|
|
|
(click)="removeResource(i)" |
|
|
|
matTooltip="{{'widget.remove-resource' | translate}}" |
|
|
|
} @else { |
|
|
|
<span translate |
|
|
|
class="tb-prompt flex items-center justify-center">widgets.html-container.no-resources</span> |
|
|
|
} |
|
|
|
<div> |
|
|
|
<button mat-raised-button color="primary" |
|
|
|
(click)="addResource()" |
|
|
|
matTooltip="{{'widget.add-resource' | translate}}" |
|
|
|
matTooltipPosition="above"> |
|
|
|
<mat-icon>delete</mat-icon> |
|
|
|
<span translate>action.add</span> |
|
|
|
</button> |
|
|
|
</div> |
|
|
|
} |
|
|
|
} @else { |
|
|
|
<span translate |
|
|
|
class="tb-prompt flex items-center justify-center">widgets.html-container.no-resources</span> |
|
|
|
</div> |
|
|
|
</mat-tab> |
|
|
|
<mat-tab label="{{ 'widgets.html-container.css' | translate }}"> |
|
|
|
<tb-css class="flex-1" |
|
|
|
[fillHeight]="true" |
|
|
|
formControlName="css" |
|
|
|
label="{{ 'widgets.html-container.css' | translate }}"> |
|
|
|
</tb-css> |
|
|
|
</mat-tab> |
|
|
|
<mat-tab label="{{ (htmlContainerSettingsForm.get('type').value === HtmlContainerWidgetType.ANGULAR ? 'widgets.html-container.angular-html-template' : 'widgets.html-container.html') | translate }}"> |
|
|
|
<tb-html class="flex-1" |
|
|
|
[fillHeight]="true" |
|
|
|
formControlName="html" |
|
|
|
label="{{ (htmlContainerSettingsForm.get('type').value === HtmlContainerWidgetType.ANGULAR ? 'widgets.html-container.angular-html-template' : 'widgets.html-container.html') | translate }}"> |
|
|
|
</tb-html> |
|
|
|
</mat-tab> |
|
|
|
@if (!fullscreen) { |
|
|
|
<mat-tab label="{{ 'widgets.html-container.java-script' | translate }}"> |
|
|
|
<ng-container *ngTemplateOutlet="javascript"></ng-container> |
|
|
|
</mat-tab> |
|
|
|
} |
|
|
|
</mat-tab-group> |
|
|
|
<div #rightPanel class="tb-content flex" [class.!hidden]="!fullscreen"> |
|
|
|
@if (fullscreen) { |
|
|
|
<ng-container *ngTemplateOutlet="javascript"></ng-container> |
|
|
|
} |
|
|
|
<div> |
|
|
|
<button mat-raised-button color="primary" |
|
|
|
(click)="addResource()" |
|
|
|
matTooltip="{{'widget.add-resource' | translate}}" |
|
|
|
matTooltipPosition="above"> |
|
|
|
<span translate>action.add</span> |
|
|
|
</button> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</mat-tab> |
|
|
|
<mat-tab label="{{ (htmlContainerSettingsForm.get('type').value === HtmlContainerWidgetType.ANGULAR ? 'widgets.html-container.angular-html-template' : 'widgets.html-container.html') | translate }}"> |
|
|
|
<tb-html class="flex-1" |
|
|
|
[fillHeight]="true" |
|
|
|
formControlName="html" |
|
|
|
label="{{ (htmlContainerSettingsForm.get('type').value === HtmlContainerWidgetType.ANGULAR ? 'widgets.html-container.angular-html-template' : 'widgets.html-container.html') | translate }}"> |
|
|
|
</tb-html> |
|
|
|
</mat-tab> |
|
|
|
<mat-tab label="{{ 'widgets.html-container.css' | translate }}"> |
|
|
|
<tb-css class="flex-1" |
|
|
|
[fillHeight]="true" |
|
|
|
formControlName="css" |
|
|
|
label="{{ 'widgets.html-container.css' | translate }}"> |
|
|
|
</tb-css> |
|
|
|
</mat-tab> |
|
|
|
<mat-tab label="{{ 'widgets.html-container.java-script' | translate }}"> |
|
|
|
<tb-js-func class="flex-1" |
|
|
|
[fillHeight]="true" |
|
|
|
formControlName="js" |
|
|
|
[globalVariables]="functionScopeVariables" |
|
|
|
[editorCompleter]="containerFunctionEditorCompleter" |
|
|
|
[functionArgs]="htmlContainerSettingsForm.get('type').value === HtmlContainerWidgetType.ANGULAR ? ['ctx'] : ['ctx', 'container']" |
|
|
|
withModules |
|
|
|
functionTitle="{{ 'widgets.html-container.js-function' | translate }}"> |
|
|
|
</tb-js-func> |
|
|
|
</mat-tab> |
|
|
|
</mat-tab-group> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</ng-container> |
|
|
|
<ng-template #javascript> |
|
|
|
<ng-container [formGroup]="htmlContainerSettingsForm"> |
|
|
|
<tb-js-func class="flex-1" |
|
|
|
[fillHeight]="true" |
|
|
|
formControlName="js" |
|
|
|
[globalVariables]="functionScopeVariables" |
|
|
|
[editorCompleter]="containerFunctionEditorCompleter" |
|
|
|
[functionArgs]="htmlContainerSettingsForm.get('type').value === HtmlContainerWidgetType.ANGULAR ? ['ctx'] : ['ctx', 'container']" |
|
|
|
withModules |
|
|
|
functionTitle="{{ 'widgets.html-container.js-function' | translate }}"> |
|
|
|
</tb-js-func> |
|
|
|
</ng-container> |
|
|
|
</ng-template> |
|
|
|
|