@syncfusion/ej2-vue-navigations
Version:
A package of Essential JS 2 navigation components such as Tree-view, Tab, Toolbar, Context-menu, and Accordion which is used to navigate from one page to another for Vue
129 lines (128 loc) • 6.2 kB
JavaScript
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
}
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
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;
};
import { isUndefined } from '@syncfusion/ej2-base';
import { ComponentBase, EJComponentDecorator } from '@syncfusion/ej2-vue-base';
import { Accordion } from '@syncfusion/ej2-navigations';
import { AccordionItemsDirective, AccordionItemDirective, AccordionItemsPlugin, AccordionItemPlugin } from './items.directive';
export var properties = ['animation', 'dataSource', 'enableHtmlSanitizer', 'enablePersistence', 'enableRtl', 'expandMode', 'expandedIndices', 'headerTemplate', 'height', 'itemTemplate', 'items', 'locale', 'width', 'clicked', 'created', 'destroyed', 'expanded', 'expanding'];
export var modelProps = ['expandedIndices'];
/**
* Represents the VueJS Accoridon Component.
* ```html
* <ejs-accordion></ejs-accordion>
* ```
*/
var AccordionComponent = /** @class */ (function (_super) {
__extends(AccordionComponent, _super);
function AccordionComponent() {
var _this = _super.call(this) || this;
_this.propKeys = properties;
_this.models = modelProps;
_this.hasChildDirective = true;
_this.hasInjectedModules = false;
_this.tagMapper = { "e-accordionitems": "e-accordionitem" };
_this.tagNameMapper = { "e-accordionitems": "e-items" };
_this.ej2Instances = new Accordion({});
_this.ej2Instances._trigger = _this.ej2Instances.trigger;
_this.ej2Instances.trigger = _this.trigger;
_this.bindProperties();
_this.ej2Instances._setProperties = _this.ej2Instances.setProperties;
_this.ej2Instances.setProperties = _this.setProperties;
return _this;
}
AccordionComponent.prototype.setProperties = function (prop, muteOnChange) {
var _this = this;
if (this.ej2Instances && this.ej2Instances._setProperties) {
this.ej2Instances._setProperties(prop, muteOnChange);
}
if (prop && this.models && this.models.length) {
Object.keys(prop).map(function (key) {
_this.models.map(function (model) {
if ((key === model) && !(/datasource/i.test(key))) {
_this.$emit('update:' + key, prop[key]);
}
});
});
}
};
AccordionComponent.prototype.trigger = function (eventName, eventProp, successHandler) {
if ((eventName === 'change' || eventName === 'input') && this.models && (this.models.length !== 0)) {
var key = this.models.toString().match(/checked|value/) || [];
var propKey = key[0];
if (eventProp && key && !isUndefined(eventProp[propKey])) {
this.$emit('update:' + propKey, eventProp[propKey]);
this.$emit('modelchanged', eventProp[propKey]);
}
}
else if ((eventName === 'actionBegin' && eventProp.requestType === 'dateNavigate') && this.models && (this.models.length !== 0)) {
var key = this.models.toString().match(/currentView|selectedDate/) || [];
var propKey = key[0];
if (eventProp && key && !isUndefined(eventProp[propKey])) {
this.$emit('update:' + propKey, eventProp[propKey]);
this.$emit('modelchanged', eventProp[propKey]);
}
}
if (this.ej2Instances && this.ej2Instances._trigger) {
this.ej2Instances._trigger(eventName, eventProp, successHandler);
}
};
AccordionComponent.prototype.render = function (createElement) {
return createElement('div', this.$slots.default);
};
AccordionComponent.prototype.addItem = function (item, index) {
return this.ej2Instances.addItem(item, index);
};
AccordionComponent.prototype.enableItem = function (index, isEnable) {
return this.ej2Instances.enableItem(index, isEnable);
};
AccordionComponent.prototype.expandItem = function (isExpand, index) {
return this.ej2Instances.expandItem(isExpand, index);
};
AccordionComponent.prototype.hideItem = function (index, isHidden) {
return this.ej2Instances.hideItem(index, isHidden);
};
AccordionComponent.prototype.refresh = function () {
return this.ej2Instances.refresh();
};
AccordionComponent.prototype.removeItem = function (index) {
return this.ej2Instances.removeItem(index);
};
AccordionComponent.prototype.select = function (index) {
return this.ej2Instances.select(index);
};
AccordionComponent = __decorate([
EJComponentDecorator({
props: properties,
model: {
event: 'modelchanged'
}
})
], AccordionComponent);
return AccordionComponent;
}(ComponentBase));
export { AccordionComponent };
export var AccordionPlugin = {
name: 'ejs-accordion',
install: function (Vue) {
Vue.component(AccordionPlugin.name, AccordionComponent);
Vue.component(AccordionItemPlugin.name, AccordionItemDirective);
Vue.component(AccordionItemsPlugin.name, AccordionItemsDirective);
}
};