You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
125 lines
6.5 KiB
JavaScript
125 lines
6.5 KiB
JavaScript
"use strict";
|
|
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
};
|
|
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
};
|
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
var core_1 = require("@angular/core");
|
|
var animations_1 = require("@angular/animations");
|
|
var common_1 = require("@angular/common");
|
|
var shared_1 = require("../common/shared");
|
|
var idx = 0;
|
|
var Fieldset = /** @class */ (function () {
|
|
function Fieldset(el) {
|
|
this.el = el;
|
|
this.collapsed = false;
|
|
this.collapsedChange = new core_1.EventEmitter();
|
|
this.onBeforeToggle = new core_1.EventEmitter();
|
|
this.onAfterToggle = new core_1.EventEmitter();
|
|
this.transitionOptions = '400ms cubic-bezier(0.86, 0, 0.07, 1)';
|
|
this.id = "ui-fieldset-" + idx++;
|
|
}
|
|
Fieldset.prototype.toggle = function (event) {
|
|
if (this.animating) {
|
|
return false;
|
|
}
|
|
this.animating = true;
|
|
this.onBeforeToggle.emit({ originalEvent: event, collapsed: this.collapsed });
|
|
if (this.collapsed)
|
|
this.expand(event);
|
|
else
|
|
this.collapse(event);
|
|
this.onAfterToggle.emit({ originalEvent: event, collapsed: this.collapsed });
|
|
event.preventDefault();
|
|
};
|
|
Fieldset.prototype.expand = function (event) {
|
|
this.collapsed = false;
|
|
this.collapsedChange.emit(this.collapsed);
|
|
};
|
|
Fieldset.prototype.collapse = function (event) {
|
|
this.collapsed = true;
|
|
this.collapsedChange.emit(this.collapsed);
|
|
};
|
|
Fieldset.prototype.getBlockableElement = function () {
|
|
return this.el.nativeElement.children[0];
|
|
};
|
|
Fieldset.prototype.onToggleDone = function (event) {
|
|
this.animating = false;
|
|
};
|
|
__decorate([
|
|
core_1.Input(),
|
|
__metadata("design:type", String)
|
|
], Fieldset.prototype, "legend", void 0);
|
|
__decorate([
|
|
core_1.Input(),
|
|
__metadata("design:type", Boolean)
|
|
], Fieldset.prototype, "toggleable", void 0);
|
|
__decorate([
|
|
core_1.Input(),
|
|
__metadata("design:type", Boolean)
|
|
], Fieldset.prototype, "collapsed", void 0);
|
|
__decorate([
|
|
core_1.Output(),
|
|
__metadata("design:type", core_1.EventEmitter)
|
|
], Fieldset.prototype, "collapsedChange", void 0);
|
|
__decorate([
|
|
core_1.Output(),
|
|
__metadata("design:type", core_1.EventEmitter)
|
|
], Fieldset.prototype, "onBeforeToggle", void 0);
|
|
__decorate([
|
|
core_1.Output(),
|
|
__metadata("design:type", core_1.EventEmitter)
|
|
], Fieldset.prototype, "onAfterToggle", void 0);
|
|
__decorate([
|
|
core_1.Input(),
|
|
__metadata("design:type", Object)
|
|
], Fieldset.prototype, "style", void 0);
|
|
__decorate([
|
|
core_1.Input(),
|
|
__metadata("design:type", String)
|
|
], Fieldset.prototype, "styleClass", void 0);
|
|
__decorate([
|
|
core_1.Input(),
|
|
__metadata("design:type", String)
|
|
], Fieldset.prototype, "transitionOptions", void 0);
|
|
Fieldset = __decorate([
|
|
core_1.Component({
|
|
selector: 'p-fieldset',
|
|
template: "\n <fieldset [attr.id]=\"id\" [ngClass]=\"{'ui-fieldset ui-widget ui-widget-content ui-corner-all': true, 'ui-fieldset-toggleable': toggleable}\" [ngStyle]=\"style\" [class]=\"styleClass\">\n <legend class=\"ui-fieldset-legend ui-corner-all ui-state-default ui-unselectable-text\">\n <ng-container *ngIf=\"toggleable; else legendContent\">\n <a tabindex=\"0\" (click)=\"toggle($event)\" (keydown.enter)=\"toggle($event)\" [attr.aria-controls]=\"id + '-content'\" [attr.aria-expanded]=\"!collapsed\">\n <ng-container *ngTemplateOutlet=\"legendContent\"></ng-container>\n </a>\n </ng-container>\n <ng-template #legendContent>\n <span class=\"ui-fieldset-toggler pi\" *ngIf=\"toggleable\" [ngClass]=\"{'pi-minus': !collapsed,'pi-plus':collapsed}\"></span>\n <span class=\"ui-fieldset-legend-text\">{{legend}}</span>\n <ng-content select=\"p-header\"></ng-content>\n </ng-template>\n </legend>\n <div [attr.id]=\"id + '-content'\" class=\"ui-fieldset-content-wrapper\" [@fieldsetContent]=\"collapsed ? {value: 'hidden', params: {transitionParams: transitionOptions}} : {value: 'visible', params: {transitionParams: transitionOptions}}\" \n [ngClass]=\"{'ui-fieldset-content-wrapper-overflown': collapsed||animating}\" [attr.aria-hidden]=\"collapsed\"\n (@fieldsetContent.done)=\"onToggleDone($event)\" role=\"region\">\n <div class=\"ui-fieldset-content\">\n <ng-content></ng-content>\n </div>\n </div>\n </fieldset>\n ",
|
|
animations: [
|
|
animations_1.trigger('fieldsetContent', [
|
|
animations_1.state('hidden', animations_1.style({
|
|
height: '0px'
|
|
})),
|
|
animations_1.state('visible', animations_1.style({
|
|
height: '*'
|
|
})),
|
|
animations_1.transition('visible => hidden', animations_1.animate('{{transitionParams}}')),
|
|
animations_1.transition('hidden => visible', animations_1.animate('{{transitionParams}}'))
|
|
])
|
|
]
|
|
}),
|
|
__metadata("design:paramtypes", [core_1.ElementRef])
|
|
], Fieldset);
|
|
return Fieldset;
|
|
}());
|
|
exports.Fieldset = Fieldset;
|
|
var FieldsetModule = /** @class */ (function () {
|
|
function FieldsetModule() {
|
|
}
|
|
FieldsetModule = __decorate([
|
|
core_1.NgModule({
|
|
imports: [common_1.CommonModule],
|
|
exports: [Fieldset, shared_1.SharedModule],
|
|
declarations: [Fieldset]
|
|
})
|
|
], FieldsetModule);
|
|
return FieldsetModule;
|
|
}());
|
|
exports.FieldsetModule = FieldsetModule;
|
|
//# sourceMappingURL=fieldset.js.map
|