diff --git a/Angular-Sample/my-diagram/.browserslistrc b/Angular-Sample/my-diagram/.browserslistrc new file mode 100644 index 0000000..4f9ac26 --- /dev/null +++ b/Angular-Sample/my-diagram/.browserslistrc @@ -0,0 +1,16 @@ +# This file is used by the build system to adjust CSS and JS output to support the specified browsers below. +# For additional information regarding the format and rule options, please see: +# https://github.com/browserslist/browserslist#queries + +# For the full list of supported browsers by the Angular framework, please see: +# https://angular.io/guide/browser-support + +# You can see what browsers were selected by your queries by running: +# npx browserslist + +last 1 Chrome version +last 1 Firefox version +last 2 Edge major versions +last 2 Safari major versions +last 2 iOS major versions +Firefox ESR diff --git a/Angular-Sample/my-diagram/.editorconfig b/Angular-Sample/my-diagram/.editorconfig new file mode 100644 index 0000000..59d9a3a --- /dev/null +++ b/Angular-Sample/my-diagram/.editorconfig @@ -0,0 +1,16 @@ +# Editor configuration, see https://editorconfig.org +root = true + +[*] +charset = utf-8 +indent_style = space +indent_size = 2 +insert_final_newline = true +trim_trailing_whitespace = true + +[*.ts] +quote_type = single + +[*.md] +max_line_length = off +trim_trailing_whitespace = false diff --git a/Angular-Sample/my-diagram/.gitignore b/Angular-Sample/my-diagram/.gitignore new file mode 100644 index 0000000..105c00f --- /dev/null +++ b/Angular-Sample/my-diagram/.gitignore @@ -0,0 +1,46 @@ +# See http://help.github.com/ignore-files/ for more about ignoring files. + +# compiled output +/dist +/tmp +/out-tsc +# Only exists if Bazel was run +/bazel-out + +# dependencies +/node_modules + +# profiling files +chrome-profiler-events*.json + +# IDEs and editors +/.idea +.project +.classpath +.c9/ +*.launch +.settings/ +*.sublime-workspace + +# IDE - VSCode +.vscode/* +!.vscode/settings.json +!.vscode/tasks.json +!.vscode/launch.json +!.vscode/extensions.json +.history/* + +# misc +/.angular/cache +/.sass-cache +/connect.lock +/coverage +/libpeerconnection.log +npm-debug.log +yarn-error.log +testem.log +/typings + +# System Files +.DS_Store +Thumbs.db diff --git a/Angular-Sample/my-diagram/README.md b/Angular-Sample/my-diagram/README.md new file mode 100644 index 0000000..7bba630 --- /dev/null +++ b/Angular-Sample/my-diagram/README.md @@ -0,0 +1,27 @@ +# MyDiagram + +This project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 13.1.2. + +## Development server + +Run `ng serve` for a dev server. Navigate to `http://localhost:4200/`. The app will automatically reload if you change any of the source files. + +## Code scaffolding + +Run `ng generate component component-name` to generate a new component. You can also use `ng generate directive|pipe|service|class|guard|interface|enum|module`. + +## Build + +Run `ng build` to build the project. The build artifacts will be stored in the `dist/` directory. + +## Running unit tests + +Run `ng test` to execute the unit tests via [Karma](https://karma-runner.github.io). + +## Running end-to-end tests + +Run `ng e2e` to execute the end-to-end tests via a platform of your choice. To use this command, you need to first add a package that implements end-to-end testing capabilities. + +## Further help + +To get more help on the Angular CLI use `ng help` or go check out the [Angular CLI Overview and Command Reference](https://angular.io/cli) page. diff --git a/Angular-Sample/my-diagram/angular.json b/Angular-Sample/my-diagram/angular.json new file mode 100644 index 0000000..0d4f664 --- /dev/null +++ b/Angular-Sample/my-diagram/angular.json @@ -0,0 +1,106 @@ +{ + "$schema": "./node_modules/@angular/cli/lib/config/schema.json", + "version": 1, + "newProjectRoot": "projects", + "projects": { + "my-diagram": { + "projectType": "application", + "schematics": { + "@schematics/angular:application": { + "strict": true + } + }, + "root": "", + "sourceRoot": "src", + "prefix": "app", + "architect": { + "build": { + "builder": "@angular-devkit/build-angular:browser", + "options": { + "outputPath": "dist/my-diagram", + "index": "src/index.html", + "main": "src/main.ts", + "polyfills": "src/polyfills.ts", + "tsConfig": "tsconfig.app.json", + "assets": [ + "src/favicon.ico", + "src/assets" + ], + "styles": [ + "src/styles.css" + ], + "scripts": [] + }, + "configurations": { + "production": { + "budgets": [ + { + "type": "initial", + "maximumWarning": "500kb", + "maximumError": "1mb" + }, + { + "type": "anyComponentStyle", + "maximumWarning": "2kb", + "maximumError": "4kb" + } + ], + "fileReplacements": [ + { + "replace": "src/environments/environment.ts", + "with": "src/environments/environment.prod.ts" + } + ], + "outputHashing": "all" + }, + "development": { + "buildOptimizer": false, + "optimization": false, + "vendorChunk": true, + "extractLicenses": false, + "sourceMap": true, + "namedChunks": true + } + }, + "defaultConfiguration": "production" + }, + "serve": { + "builder": "@angular-devkit/build-angular:dev-server", + "configurations": { + "production": { + "browserTarget": "my-diagram:build:production" + }, + "development": { + "browserTarget": "my-diagram:build:development" + } + }, + "defaultConfiguration": "development" + }, + "extract-i18n": { + "builder": "@angular-devkit/build-angular:extract-i18n", + "options": { + "browserTarget": "my-diagram:build" + } + }, + "test": { + "builder": "@angular-devkit/build-angular:karma", + "options": { + "main": "src/test.ts", + "polyfills": "src/polyfills.ts", + "tsConfig": "tsconfig.spec.json", + "karmaConfig": "karma.conf.js", + "assets": [ + "src/favicon.ico", + "src/assets" + ], + "styles": [ + "src/styles.css" + ], + "scripts": [] + } + } + } + } + }, + "defaultProject": "my-diagram" +} diff --git a/Angular-Sample/my-diagram/karma.conf.js b/Angular-Sample/my-diagram/karma.conf.js new file mode 100644 index 0000000..08b56e5 --- /dev/null +++ b/Angular-Sample/my-diagram/karma.conf.js @@ -0,0 +1,44 @@ +// Karma configuration file, see link for more information +// https://karma-runner.github.io/1.0/config/configuration-file.html + +module.exports = function (config) { + config.set({ + basePath: '', + frameworks: ['jasmine', '@angular-devkit/build-angular'], + plugins: [ + require('karma-jasmine'), + require('karma-chrome-launcher'), + require('karma-jasmine-html-reporter'), + require('karma-coverage'), + require('@angular-devkit/build-angular/plugins/karma') + ], + client: { + jasmine: { + // you can add configuration options for Jasmine here + // the possible options are listed at https://jasmine.github.io/api/edge/Configuration.html + // for example, you can disable the random execution with `random: false` + // or set a specific seed with `seed: 4321` + }, + clearContext: false // leave Jasmine Spec Runner output visible in browser + }, + jasmineHtmlReporter: { + suppressAll: true // removes the duplicated traces + }, + coverageReporter: { + dir: require('path').join(__dirname, './coverage/my-diagram'), + subdir: '.', + reporters: [ + { type: 'html' }, + { type: 'text-summary' } + ] + }, + reporters: ['progress', 'kjhtml'], + port: 9876, + colors: true, + logLevel: config.LOG_INFO, + autoWatch: true, + browsers: ['Chrome'], + singleRun: false, + restartOnFileChange: true + }); +}; diff --git a/Angular-Sample/my-diagram/package.json b/Angular-Sample/my-diagram/package.json new file mode 100644 index 0000000..194a5a5 --- /dev/null +++ b/Angular-Sample/my-diagram/package.json @@ -0,0 +1,40 @@ +{ + "name": "my-diagram", + "version": "0.0.0", + "scripts": { + "ng": "ng", + "start": "ng serve", + "build": "ng build", + "watch": "ng build --watch --configuration development", + "test": "ng test" + }, + "private": true, + "dependencies": { + "@angular/animations": "~13.1.0", + "@angular/common": "~13.1.0", + "@angular/compiler": "~13.1.0", + "@angular/core": "~13.1.0", + "@angular/forms": "~13.1.0", + "@angular/platform-browser": "~13.1.0", + "@angular/platform-browser-dynamic": "~13.1.0", + "@angular/router": "~13.1.0", + "@syncfusion/ej2-angular-diagrams": "*", + "rxjs": "~7.4.0", + "tslib": "^2.3.0", + "zone.js": "~0.11.4" + }, + "devDependencies": { + "@angular-devkit/build-angular": "~13.1.2", + "@angular/cli": "~13.1.2", + "@angular/compiler-cli": "~13.1.0", + "@types/jasmine": "~3.10.0", + "@types/node": "^12.11.1", + "jasmine-core": "~3.10.0", + "karma": "~6.3.0", + "karma-chrome-launcher": "~3.1.0", + "karma-coverage": "~2.1.0", + "karma-jasmine": "~4.0.0", + "karma-jasmine-html-reporter": "~1.7.0", + "typescript": "~4.5.2" + } +} diff --git a/Angular-Sample/my-diagram/src/app/app.component.css b/Angular-Sample/my-diagram/src/app/app.component.css new file mode 100644 index 0000000..e69de29 diff --git a/Angular-Sample/my-diagram/src/app/app.component.html b/Angular-Sample/my-diagram/src/app/app.component.html new file mode 100644 index 0000000..be741e6 --- /dev/null +++ b/Angular-Sample/my-diagram/src/app/app.component.html @@ -0,0 +1,34 @@ + + + + + + + +
+ * let dataManager: DataManager = new DataManager([{ ID: '10' }, { ID: '2' }, { ID: '1' }, { ID: '20' }]);
+ * let query: Query = new Query();
+ * query.sortBy('ID', (x: string, y: string): number => { return parseInt(x, 10) - parseInt(y, 10) });
+ * let promise: Promise< Object > = query.execute(dataManager);
+ * promise.then((e: { result: Object }) => { });
+ *
+ */
+ Query.prototype.execute = function (dataManager, done, fail, always) {
+ dataManager = dataManager || this.dataManager;
+ if (dataManager) {
+ return dataManager.executeQuery(this, done, fail, always);
+ }
+ return _util__WEBPACK_IMPORTED_MODULE_0__["DataUtil"].throwError('Query - execute() : dataManager needs to be is set using "using" function or should be passed as argument');
+ };
+ /**
+ * Executes query with the local datasource.
+ *
+ * @param {DataManager} dataManager - Defines the DataManager.
+ */
+ Query.prototype.executeLocal = function (dataManager) {
+ dataManager = dataManager || this.dataManager;
+ if (dataManager) {
+ return dataManager.executeLocal(this);
+ }
+ return _util__WEBPACK_IMPORTED_MODULE_0__["DataUtil"].throwError('Query - executeLocal() : dataManager needs to be is set using "using" function or should be passed as argument');
+ };
+ /**
+ * Creates deep copy of the Query object.
+ */
+ Query.prototype.clone = function () {
+ var cloned = new Query();
+ cloned.queries = this.queries.slice(0);
+ cloned.key = this.key;
+ cloned.isChild = this.isChild;
+ cloned.dataManager = this.dataManager;
+ cloned.fromTable = this.fromTable;
+ cloned.params = this.params.slice(0);
+ cloned.expands = this.expands.slice(0);
+ cloned.sortedColumns = this.sortedColumns.slice(0);
+ cloned.groupedColumns = this.groupedColumns.slice(0);
+ cloned.subQuerySelector = this.subQuerySelector;
+ cloned.subQuery = this.subQuery;
+ cloned.fKey = this.fKey;
+ cloned.isCountRequired = this.isCountRequired;
+ cloned.distincts = this.distincts.slice(0);
+ cloned.lazyLoad = this.lazyLoad.slice(0);
+ return cloned;
+ };
+ /**
+ * Specifies the name of table to retrieve data in query execution.
+ *
+ * @param {string} tableName - Defines the table name.
+ */
+ Query.prototype.from = function (tableName) {
+ this.fromTable = tableName;
+ return this;
+ };
+ /**
+ * Adds additional parameter which will be sent along with the request which will be generated while DataManager execute.
+ *
+ * @param {string} key - Defines the key of additional parameter.
+ * @param {Function|string} value - Defines the value for the key.
+ */
+ Query.prototype.addParams = function (key, value) {
+ if (typeof value === 'function') {
+ this.params.push({ key: key, fn: value });
+ }
+ else {
+ this.params.push({ key: key, value: value });
+ }
+ return this;
+ };
+ /**
+ * @param fields
+ * @hidden
+ */
+ Query.prototype.distinct = function (fields) {
+ if (typeof fields === 'string') {
+ this.distincts = [].slice.call([fields], 0);
+ }
+ else {
+ this.distincts = fields.slice(0);
+ }
+ return this;
+ };
+ /**
+ * Expands the related table.
+ *
+ * @param {string|Object[]} tables
+ */
+ Query.prototype.expand = function (tables) {
+ if (typeof tables === 'string') {
+ this.expands = [].slice.call([tables], 0);
+ }
+ else {
+ this.expands = tables.slice(0);
+ }
+ return this;
+ };
+ /**
+ * Filter data with given filter criteria.
+ *
+ * @param {string|Predicate} fieldName - Defines the column field or Predicate.
+ * @param {string} operator - Defines the operator how to filter data.
+ * @param {string|number|boolean} value - Defines the values to match with data.
+ * @param {boolean} ignoreCase - If ignore case set to false, then filter data with exact match or else
+ * filter data with case insensitive.
+ * @param ignoreAccent
+ * @param matchCase
+ */
+ Query.prototype.where = function (fieldName, operator, value, ignoreCase, ignoreAccent, matchCase) {
+ operator = operator ? (operator).toLowerCase() : null;
+ var predicate = null;
+ if (typeof fieldName === 'string') {
+ predicate = new Predicate(fieldName, operator, value, ignoreCase, ignoreAccent, matchCase);
+ }
+ else if (fieldName instanceof Predicate) {
+ predicate = fieldName;
+ }
+ this.queries.push({
+ fn: 'onWhere',
+ e: predicate
+ });
+ return this;
+ };
+ /**
+ * Search data with given search criteria.
+ *
+ * @param {string|number|boolean} searchKey - Defines the search key.
+ * @param {string|string[]} fieldNames - Defines the collection of column fields.
+ * @param {string} operator - Defines the operator how to search data.
+ * @param {boolean} ignoreCase - If ignore case set to false, then filter data with exact match or else
+ * filter data with case insensitive.
+ * @param ignoreAccent
+ */
+ Query.prototype.search = function (searchKey, fieldNames, operator, ignoreCase, ignoreAccent) {
+ if (typeof fieldNames === 'string') {
+ fieldNames = [fieldNames];
+ }
+ if (!operator || operator === 'none') {
+ operator = 'contains';
+ }
+ var comparer = _util__WEBPACK_IMPORTED_MODULE_0__["DataUtil"].fnOperators[operator];
+ this.queries.push({
+ fn: 'onSearch',
+ e: {
+ fieldNames: fieldNames,
+ operator: operator,
+ searchKey: searchKey,
+ ignoreCase: ignoreCase,
+ ignoreAccent: ignoreAccent,
+ comparer: comparer
+ }
+ });
+ return this;
+ };
+ /**
+ * Sort the data with given sort criteria.
+ * By default, sort direction is ascending.
+ *
+ * @param {string|string[]} fieldName - Defines the single or collection of column fields.
+ * @param {string|Function} comparer - Defines the sort direction or custom sort comparer function.
+ * @param isFromGroup
+ */
+ Query.prototype.sortBy = function (fieldName, comparer, isFromGroup) {
+ return this.sortByForeignKey(fieldName, comparer, isFromGroup);
+ };
+ /**
+ * Sort the data with given sort criteria.
+ * By default, sort direction is ascending.
+ *
+ * @param {string|string[]} fieldName - Defines the single or collection of column fields.
+ * @param {string|Function} comparer - Defines the sort direction or custom sort comparer function.
+ * @param isFromGroup
+ * @param {string} direction - Defines the sort direction .
+ */
+ Query.prototype.sortByForeignKey = function (fieldName, comparer, isFromGroup, direction) {
+ var order = !Object(_ej2_base__WEBPACK_IMPORTED_MODULE_1__["isNullOrUndefined"])(direction) ? direction : 'ascending';
+ var sorts;
+ var temp;
+ if (typeof fieldName === 'string' && _util__WEBPACK_IMPORTED_MODULE_0__["DataUtil"].endsWith(fieldName.toLowerCase(), ' desc')) {
+ fieldName = fieldName.replace(/ desc$/i, '');
+ comparer = 'descending';
+ }
+ if (!comparer || typeof comparer === 'string') {
+ order = comparer ? comparer.toLowerCase() : 'ascending';
+ comparer = _util__WEBPACK_IMPORTED_MODULE_0__["DataUtil"].fnSort(comparer);
+ }
+ if (isFromGroup) {
+ sorts = Query.filterQueries(this.queries, 'onSortBy');
+ for (var i = 0; i < sorts.length; i++) {
+ temp = sorts[i].e.fieldName;
+ if (typeof temp === 'string') {
+ if (temp === fieldName) {
+ return this;
+ }
+ }
+ else if (temp instanceof Array) {
+ for (var j = 0; j < temp.length; j++) {
+ if (temp[j] === fieldName || fieldName.toLowerCase() === temp[j] + ' desc') {
+ return this;
+ }
+ }
+ }
+ }
+ }
+ this.queries.push({
+ fn: 'onSortBy',
+ e: {
+ fieldName: fieldName,
+ comparer: comparer,
+ direction: order
+ }
+ });
+ return this;
+ };
+ /**
+ * Sorts data in descending order.
+ *
+ * @param {string} fieldName - Defines the column field.
+ */
+ Query.prototype.sortByDesc = function (fieldName) {
+ return this.sortBy(fieldName, 'descending');
+ };
+ /**
+ * Groups data with the given field name.
+ *
+ * @param {string} fieldName - Defines the column field.
+ * @param fn
+ * @param format
+ */
+ Query.prototype.group = function (fieldName, fn, format) {
+ this.sortBy(fieldName, null, true);
+ this.queries.push({
+ fn: 'onGroup',
+ e: {
+ fieldName: fieldName,
+ comparer: fn ? fn : null,
+ format: format ? format : null
+ }
+ });
+ return this;
+ };
+ /**
+ * Gets data based on the given page index and size.
+ *
+ * @param {number} pageIndex - Defines the current page index.
+ * @param {number} pageSize - Defines the no of records per page.
+ */
+ Query.prototype.page = function (pageIndex, pageSize) {
+ this.queries.push({
+ fn: 'onPage',
+ e: {
+ pageIndex: pageIndex,
+ pageSize: pageSize
+ }
+ });
+ return this;
+ };
+ /**
+ * Gets data based on the given start and end index.
+ *
+ * @param {number} start - Defines the start index of the datasource.
+ * @param {number} end - Defines the end index of the datasource.
+ */
+ Query.prototype.range = function (start, end) {
+ this.queries.push({
+ fn: 'onRange',
+ e: {
+ start: start,
+ end: end
+ }
+ });
+ return this;
+ };
+ /**
+ * Gets data from the top of the data source based on given number of records count.
+ *
+ * @param {number} nos - Defines the no of records to retrieve from datasource.
+ */
+ Query.prototype.take = function (nos) {
+ this.queries.push({
+ fn: 'onTake',
+ e: {
+ nos: nos
+ }
+ });
+ return this;
+ };
+ /**
+ * Skips data with given number of records count from the top of the data source.
+ *
+ * @param {number} nos - Defines the no of records skip in the datasource.
+ */
+ Query.prototype.skip = function (nos) {
+ this.queries.push({
+ fn: 'onSkip',
+ e: { nos: nos }
+ });
+ return this;
+ };
+ /**
+ * Selects specified columns from the data source.
+ *
+ * @param {string|string[]} fieldNames - Defines the collection of column fields.
+ */
+ Query.prototype.select = function (fieldNames) {
+ if (typeof fieldNames === 'string') {
+ fieldNames = [].slice.call([fieldNames], 0);
+ }
+ this.queries.push({
+ fn: 'onSelect',
+ e: { fieldNames: fieldNames }
+ });
+ return this;
+ };
+ /**
+ * Gets the records in hierarchical relationship from two tables. It requires the foreign key to relate two tables.
+ *
+ * @param {Query} query - Defines the query to relate two tables.
+ * @param {Function} selectorFn - Defines the custom function to select records.
+ */
+ Query.prototype.hierarchy = function (query, selectorFn) {
+ this.subQuerySelector = selectorFn;
+ this.subQuery = query;
+ return this;
+ };
+ /**
+ * Sets the foreign key which is used to get data from the related table.
+ *
+ * @param {string} key - Defines the foreign key.
+ */
+ Query.prototype.foreignKey = function (key) {
+ this.fKey = key;
+ return this;
+ };
+ /**
+ * It is used to get total number of records in the DataManager execution result.
+ */
+ Query.prototype.requiresCount = function () {
+ this.isCountRequired = true;
+ return this;
+ };
+ //type - sum, avg, min, max
+ /**
+ * Aggregate the data with given type and field name.
+ *
+ * @param {string} type - Defines the aggregate type.
+ * @param {string} field - Defines the column field to aggregate.
+ */
+ Query.prototype.aggregate = function (type, field) {
+ this.queries.push({
+ fn: 'onAggregates',
+ e: { field: field, type: type }
+ });
+ return this;
+ };
+ /**
+ * Pass array of filterColumn query for performing filter operation.
+ *
+ * @param {QueryOptions[]} queries
+ * @param {string} name
+ * @hidden
+ */
+ Query.filterQueries = function (queries, name) {
+ return queries.filter(function (q) {
+ return q.fn === name;
+ });
+ };
+ /**
+ * To get the list of queries which is already filtered in current data source.
+ *
+ * @param {Object[]} queries
+ * @param {string[]} singles
+ * @hidden
+ */
+ Query.filterQueryLists = function (queries, singles) {
+ var filtered = queries.filter(function (q) {
+ return singles.indexOf(q.fn) !== -1;
+ });
+ var res = {};
+ for (var i = 0; i < filtered.length; i++) {
+ if (!res[filtered[i].fn]) {
+ res[filtered[i].fn] = filtered[i].e;
+ }
+ }
+ return res;
+ };
+ return Query;
+}());
+
+/**
+ * Predicate class is used to generate complex filter criteria.
+ * This will be used by DataManager to perform multiple filtering operation.
+ */
+var Predicate = /** @__PURE__ @class */ (function () {
+ /**
+ * Constructor for Predicate class.
+ *
+ * @param {string|Predicate} field
+ * @param {string} operator
+ * @param {string|number|boolean|Predicate|Predicate[]} value
+ * @param {boolean=false} ignoreCase
+ * @param ignoreAccent
+ * @param {boolean} matchCase
+ * @hidden
+ */
+ function Predicate(field, operator, value, ignoreCase, ignoreAccent, matchCase) {
+ if (ignoreCase === void 0) { ignoreCase = false; }
+ /** @hidden */
+ this.ignoreAccent = false;
+ /** @hidden */
+ this.isComplex = false;
+ if (typeof field === 'string') {
+ this.field = field;
+ this.operator = operator.toLowerCase();
+ this.value = value;
+ this.matchCase = matchCase;
+ this.ignoreCase = ignoreCase;
+ this.ignoreAccent = ignoreAccent;
+ this.isComplex = false;
+ this.comparer = _util__WEBPACK_IMPORTED_MODULE_0__["DataUtil"].fnOperators.processOperator(this.operator);
+ }
+ else if (field instanceof Predicate && value instanceof Predicate || value instanceof Array) {
+ this.isComplex = true;
+ this.condition = operator.toLowerCase();
+ this.predicates = [field];
+ this.matchCase = field.matchCase;
+ this.ignoreCase = field.ignoreCase;
+ this.ignoreAccent = field.ignoreAccent;
+ if (value instanceof Array) {
+ [].push.apply(this.predicates, value);
+ }
+ else {
+ this.predicates.push(value);
+ }
+ }
+ return this;
+ }
+ /**
+ * Adds n-number of new predicates on existing predicate with “and” condition.
+ *
+ * @param {Object[]} args - Defines the collection of predicates.
+ */
+ Predicate.and = function () {
+ var args = [];
+ for (var _i = 0; _i < arguments.length; _i++) {
+ args[_i] = arguments[_i];
+ }
+ return Predicate.combinePredicates([].slice.call(args, 0), 'and');
+ };
+ /**
+ * Adds new predicate on existing predicate with “and” condition.
+ *
+ * @param {string} field - Defines the column field.
+ * @param {string} operator - Defines the operator how to filter data.
+ * @param {string} value - Defines the values to match with data.
+ * @param {boolean} ignoreCase? - If ignore case set to false, then filter data with exact match or else
+ * filter data with case insensitive.
+ * @param ignoreCase
+ * @param ignoreAccent
+ */
+ Predicate.prototype.and = function (field, operator, value, ignoreCase, ignoreAccent) {
+ return Predicate.combine(this, field, operator, value, 'and', ignoreCase, ignoreAccent);
+ };
+ /**
+ * Adds n-number of new predicates on existing predicate with “or” condition.
+ *
+ * @param {Object[]} args - Defines the collection of predicates.
+ */
+ Predicate.or = function () {
+ var args = [];
+ for (var _i = 0; _i < arguments.length; _i++) {
+ args[_i] = arguments[_i];
+ }
+ return Predicate.combinePredicates([].slice.call(args, 0), 'or');
+ };
+ /**
+ * Adds new predicate on existing predicate with “or” condition.
+ *
+ * @param {string} field - Defines the column field.
+ * @param {string} operator - Defines the operator how to filter data.
+ * @param {string} value - Defines the values to match with data.
+ * @param {boolean} ignoreCase? - If ignore case set to false, then filter data with exact match or else
+ * filter data with case insensitive.
+ * @param ignoreCase
+ * @param ignoreAccent
+ */
+ Predicate.prototype.or = function (field, operator, value, ignoreCase, ignoreAccent) {
+ return Predicate.combine(this, field, operator, value, 'or', ignoreCase, ignoreAccent);
+ };
+ /**
+ * Adds n-number of new predicates on existing predicate with “and not” condition.
+ *
+ * @param {Object[]} args - Defines the collection of predicates.
+ */
+ Predicate.ornot = function () {
+ var args = [];
+ for (var _i = 0; _i < arguments.length; _i++) {
+ args[_i] = arguments[_i];
+ }
+ return Predicate.combinePredicates([].slice.call(args, 0), 'or not');
+ };
+ /**
+ * Adds new predicate on existing predicate with “and not” condition.
+ *
+ * @param {string} field - Defines the column field.
+ * @param {string} operator - Defines the operator how to filter data.
+ * @param {string} value - Defines the values to match with data.
+ * @param {boolean} ignoreCase? - If ignore case set to false, then filter data with exact match or else
+ * filter data with case insensitive.
+ * @param ignoreCase
+ * @param ignoreAccent
+ */
+ Predicate.prototype.ornot = function (field, operator, value, ignoreCase, ignoreAccent) {
+ return Predicate.combine(this, field, operator, value, 'ornot', ignoreCase, ignoreAccent);
+ };
+ /**
+ * Adds n-number of new predicates on existing predicate with “and not” condition.
+ *
+ * @param {Object[]} args - Defines the collection of predicates.
+ */
+ Predicate.andnot = function () {
+ var args = [];
+ for (var _i = 0; _i < arguments.length; _i++) {
+ args[_i] = arguments[_i];
+ }
+ return Predicate.combinePredicates([].slice.call(args, 0), 'and not');
+ };
+ /**
+ * Adds new predicate on existing predicate with “and not” condition.
+ *
+ * @param {string} field - Defines the column field.
+ * @param {string} operator - Defines the operator how to filter data.
+ * @param {string} value - Defines the values to match with data.
+ * @param {boolean} ignoreCase? - If ignore case set to false, then filter data with exact match or else
+ * filter data with case insensitive.
+ * @param ignoreCase
+ * @param ignoreAccent
+ */
+ Predicate.prototype.andnot = function (field, operator, value, ignoreCase, ignoreAccent) {
+ return Predicate.combine(this, field, operator, value, 'andnot', ignoreCase, ignoreAccent);
+ };
+ /**
+ * Converts plain JavaScript object to Predicate object.
+ *
+ * @param {Predicate[]|Predicate} json - Defines single or collection of Predicate.
+ */
+ Predicate.fromJson = function (json) {
+ if (json instanceof Array) {
+ var res = [];
+ for (var i = 0, len = json.length; i < len; i++) {
+ res.push(this.fromJSONData(json[i]));
+ }
+ return res;
+ }
+ var pred = json;
+ return this.fromJSONData(pred);
+ };
+ /**
+ * Validate the record based on the predicates.
+ *
+ * @param {Object} record - Defines the datasource record.
+ */
+ Predicate.prototype.validate = function (record) {
+ var predicate = this.predicates ? this.predicates : [];
+ var ret;
+ var isAnd;
+ if (!this.isComplex && this.comparer) {
+ if (this.condition && this.condition.indexOf('not') !== -1) {
+ this.condition = this.condition.split('not')[0] === '' ? undefined : this.condition.split('not')[0];
+ return !this.comparer.call(this, _util__WEBPACK_IMPORTED_MODULE_0__["DataUtil"].getObject(this.field, record), this.value, this.ignoreCase, this.ignoreAccent);
+ }
+ else {
+ return this.comparer.call(this, _util__WEBPACK_IMPORTED_MODULE_0__["DataUtil"].getObject(this.field, record), this.value, this.ignoreCase, this.ignoreAccent);
+ }
+ }
+ if (this.condition && this.condition.indexOf('not') !== -1) {
+ isAnd = this.condition.indexOf('and') !== -1;
+ }
+ else {
+ isAnd = this.condition === 'and';
+ }
+ for (var i = 0; i < predicate.length; i++) {
+ if (i > 0 && this.condition && this.condition.indexOf('not') !== -1) {
+ predicate[i].condition = predicate[i].condition ? predicate[i].condition + 'not' : 'not';
+ }
+ ret = predicate[i].validate(record);
+ if (isAnd) {
+ if (!ret) {
+ return false;
+ }
+ }
+ else {
+ if (ret) {
+ return true;
+ }
+ }
+ }
+ return isAnd;
+ };
+ /**
+ * Converts predicates to plain JavaScript.
+ * This method is uses Json stringify when serializing Predicate object.
+ */
+ Predicate.prototype.toJson = function () {
+ var predicates;
+ var p;
+ if (this.isComplex) {
+ predicates = [];
+ p = this.predicates;
+ for (var i = 0; i < p.length; i++) {
+ predicates.push(p[i].toJson());
+ }
+ }
+ return {
+ isComplex: this.isComplex,
+ field: this.field,
+ operator: this.operator,
+ value: this.value,
+ ignoreCase: this.ignoreCase,
+ ignoreAccent: this.ignoreAccent,
+ condition: this.condition,
+ predicates: predicates,
+ matchCase: this.matchCase
+ };
+ };
+ Predicate.combinePredicates = function (predicates, operator) {
+ if (predicates.length === 1) {
+ if (!(predicates[0] instanceof Array)) {
+ return predicates[0];
+ }
+ predicates = predicates[0];
+ }
+ return new Predicate(predicates[0], operator, predicates.slice(1));
+ };
+ Predicate.combine = function (pred, field, operator, value, condition, ignoreCase, ignoreAccent) {
+ if (field instanceof Predicate) {
+ return Predicate[condition](pred, field);
+ }
+ if (typeof field === 'string') {
+ return Predicate[condition](pred, new Predicate(field, operator, value, ignoreCase, ignoreAccent));
+ }
+ return _util__WEBPACK_IMPORTED_MODULE_0__["DataUtil"].throwError('Predicate - ' + condition + ' : invalid arguments');
+ };
+ Predicate.fromJSONData = function (json) {
+ var preds = json.predicates || [];
+ var len = preds.length;
+ var predicates = [];
+ var result;
+ for (var i = 0; i < len; i++) {
+ predicates.push(this.fromJSONData(preds[i]));
+ }
+ if (!json.isComplex) {
+ result = new Predicate(json.field, json.operator, json.value, json.ignoreCase, json.ignoreAccent);
+ }
+ else {
+ result = new Predicate(predicates[0], json.condition, predicates.slice(1));
+ }
+ return result;
+ };
+ return Predicate;
+}());
+
+
+
+/***/ }),
+
+/***/ "./ej2-resources/22.1.37/scripts/ej2-data/util.js":
+/*!********************************************************!*\
+ !*** ./ej2-resources/22.1.37/scripts/ej2-data/util.js ***!
+ \********************************************************/
+/*! exports provided: DataUtil */
+/***/ (function(module, __webpack_exports__, __webpack_require__) {
+
+"use strict";
+__webpack_require__.r(__webpack_exports__);
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "DataUtil", function() { return DataUtil; });
+/* harmony import */ var _ej2_base__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../ej2-base */ "./ej2-resources/22.1.37/scripts/ej2-base/index.js");
+/* harmony import */ var _manager__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./manager */ "./ej2-resources/22.1.37/scripts/ej2-data/manager.js");
+/* harmony import */ var _query__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./query */ "./ej2-resources/22.1.37/scripts/ej2-data/query.js");
+/* eslint-disable valid-jsdoc */
+/* eslint-disable security/detect-object-injection */
+
+
+
+var consts = { GroupGuid: '{271bbba0-1ee7}' };
+/**
+ * Data manager common utility methods.
+ *
+ * @hidden
+ */
+var DataUtil = /** @__PURE__ @class */ (function () {
+ function DataUtil() {
+ }
+ /**
+ * Returns the value by invoking the provided parameter function.
+ * If the paramater is not of type function then it will be returned as it is.
+ *
+ * @param {Function|string|string[]|number} value
+ * @param {Object} inst?
+ * @param inst
+ * @hidden
+ */
+ DataUtil.getValue = function (value, inst) {
+ if (typeof value === 'function') {
+ return value.call(inst || {});
+ }
+ return value;
+ };
+ /**
+ * Returns true if the input string ends with given string.
+ *
+ * @param {string} input
+ * @param {string} substr
+ */
+ DataUtil.endsWith = function (input, substr) {
+ return input.slice && input.slice(-substr.length) === substr;
+ };
+ /**
+ * Returns true if the input string not ends with given string.
+ *
+ * @param {string} input
+ * @param {string} substr
+ */
+ DataUtil.notEndsWith = function (input, substr) {
+ return input.slice && input.slice(-substr.length) !== substr;
+ };
+ /**
+ * Returns true if the input string starts with given string.
+ *
+ * @param {string} str
+ * @param {string} startstr
+ * @param input
+ * @param start
+ */
+ DataUtil.startsWith = function (input, start) {
+ return input.slice(0, start.length) === start;
+ };
+ /**
+ * Returns true if the input string not starts with given string.
+ *
+ * @param {string} str
+ * @param {string} startstr
+ * @param input
+ * @param start
+ */
+ DataUtil.notStartsWith = function (input, start) {
+ return input.slice(0, start.length) !== start;
+ };
+ /**
+ * Returns true if the input string pattern(wildcard) matches with given string.
+ *
+ * @param {string} str
+ * @param {string} startstr
+ * @param input
+ * @param pattern
+ */
+ DataUtil.wildCard = function (input, pattern) {
+ var asteriskSplit;
+ var optionalSplit;
+ // special character allowed search
+ if (pattern.indexOf('(') !== -1) {
+ pattern = pattern.split('(').join('[(]');
+ }
+ if (pattern.indexOf(')') !== -1) {
+ pattern = pattern.split(')').join('[)]');
+ }
+ if (pattern.indexOf('*') !== -1) {
+ if (pattern.charAt(0) !== '*') {
+ pattern = '^' + pattern;
+ }
+ if (pattern.charAt(pattern.length - 1) !== '*') {
+ pattern = pattern + '$';
+ }
+ asteriskSplit = pattern.split('*');
+ for (var i = 0; i < asteriskSplit.length; i++) {
+ if (asteriskSplit[i].indexOf('.') === -1) {
+ asteriskSplit[i] = asteriskSplit[i] + '.*';
+ }
+ else {
+ asteriskSplit[i] = asteriskSplit[i] + '*';
+ }
+ }
+ pattern = asteriskSplit.join('');
+ }
+ if (pattern.indexOf('%3f') !== -1 || pattern.indexOf('?') !== -1) {
+ optionalSplit = pattern.indexOf('%3f') !== -1 ? pattern.split('%3f') : pattern.split('?');
+ pattern = optionalSplit.join('.');
+ }
+ // eslint-disable-next-line security/detect-non-literal-regexp
+ var regexPattern = new RegExp(pattern, 'g');
+ return regexPattern.test(input);
+ };
+ /**
+ * Returns true if the input string pattern(like) matches with given string.
+ *
+ * @param {string} str
+ * @param {string} startstr
+ * @param input
+ * @param pattern
+ */
+ DataUtil.like = function (input, pattern) {
+ if (pattern.indexOf('%') !== -1) {
+ if (pattern.charAt(0) === '%' && pattern.lastIndexOf('%') < 2) {
+ pattern = pattern.substring(1, pattern.length);
+ return DataUtil.startsWith(DataUtil.toLowerCase(input), DataUtil.toLowerCase(pattern));
+ }
+ else if (pattern.charAt(pattern.length - 1) === '%' && pattern.indexOf('%') > pattern.length - 3) {
+ pattern = pattern.substring(0, pattern.length - 1);
+ return DataUtil.endsWith(DataUtil.toLowerCase(input), DataUtil.toLowerCase(pattern));
+ }
+ else if (pattern.lastIndexOf('%') !== pattern.indexOf('%') && pattern.lastIndexOf('%') > pattern.indexOf('%') + 1) {
+ pattern = pattern.substring(pattern.indexOf('%') + 1, pattern.lastIndexOf('%'));
+ return input.indexOf(pattern) !== -1;
+ }
+ else {
+ return input.indexOf(pattern) !== -1;
+ }
+ }
+ else {
+ return false;
+ }
+ };
+ /**
+ * To return the sorting function based on the string.
+ *
+ * @param {string} order
+ * @hidden
+ */
+ DataUtil.fnSort = function (order) {
+ order = order ? DataUtil.toLowerCase(order) : 'ascending';
+ if (order === 'ascending') {
+ return this.fnAscending;
+ }
+ return this.fnDescending;
+ };
+ /**
+ * Comparer function which is used to sort the data in ascending order.
+ *
+ * @param {string|number} x
+ * @param {string|number} y
+ * @returns number
+ */
+ DataUtil.fnAscending = function (x, y) {
+ if (Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["isNullOrUndefined"])(x) && Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["isNullOrUndefined"])(y)) {
+ return -1;
+ }
+ if (y === null || y === undefined) {
+ return -1;
+ }
+ if (typeof x === 'string') {
+ return x.localeCompare(y);
+ }
+ if (x === null || x === undefined) {
+ return 1;
+ }
+ return x - y;
+ };
+ /**
+ * Comparer function which is used to sort the data in descending order.
+ *
+ * @param {string|number} x
+ * @param {string|number} y
+ * @returns number
+ */
+ DataUtil.fnDescending = function (x, y) {
+ if (Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["isNullOrUndefined"])(x) && Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["isNullOrUndefined"])(y)) {
+ return -1;
+ }
+ if (y === null || y === undefined) {
+ return 1;
+ }
+ if (typeof x === 'string') {
+ return x.localeCompare(y) * -1;
+ }
+ if (x === null || x === undefined) {
+ return -1;
+ }
+ return y - x;
+ };
+ DataUtil.extractFields = function (obj, fields) {
+ var newObj = {};
+ for (var i = 0; i < fields.length; i++) {
+ newObj = this.setValue(fields[i], this.getObject(fields[i], obj), newObj);
+ }
+ return newObj;
+ };
+ /**
+ * Select objects by given fields from jsonArray.
+ *
+ * @param {Object[]} jsonArray
+ * @param {string[]} fields
+ */
+ DataUtil.select = function (jsonArray, fields) {
+ var newData = [];
+ for (var i = 0; i < jsonArray.length; i++) {
+ newData.push(this.extractFields(jsonArray[i], fields));
+ }
+ return newData;
+ };
+ /**
+ * Group the input data based on the field name.
+ * It also performs aggregation of the grouped records based on the aggregates paramater.
+ *
+ * @param {Object[]} jsonArray
+ * @param {string} field?
+ * @param {Object[]} agg?
+ * @param {number} level?
+ * @param {Object[]} groupDs?
+ * @param field
+ * @param aggregates
+ * @param level
+ * @param groupDs
+ * @param format
+ * @param isLazyLoad
+ */
+ DataUtil.group = function (jsonArray, field, aggregates, level, groupDs, format, isLazyLoad) {
+ level = level || 1;
+ var jsonData = jsonArray;
+ var guid = 'GroupGuid';
+ if (jsonData.GroupGuid === consts[guid]) {
+ var _loop_1 = function (j) {
+ if (!Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["isNullOrUndefined"])(groupDs)) {
+ var indx = -1;
+ var temp = groupDs.filter(function (e) { return e.key === jsonData[j].key; });
+ indx = groupDs.indexOf(temp[0]);
+ jsonData[j].items = this_1.group(jsonData[j].items, field, aggregates, jsonData.level + 1, groupDs[indx].items, format, isLazyLoad);
+ jsonData[j].count = groupDs[indx].count;
+ }
+ else {
+ jsonData[j].items = this_1.group(jsonData[j].items, field, aggregates, jsonData.level + 1, null, format, isLazyLoad);
+ jsonData[j].count = jsonData[j].items.length;
+ }
+ };
+ var this_1 = this;
+ for (var j = 0; j < jsonData.length; j++) {
+ _loop_1(j);
+ }
+ jsonData.childLevels += 1;
+ return jsonData;
+ }
+ var grouped = {};
+ var groupedArray = [];
+ groupedArray.GroupGuid = consts[guid];
+ groupedArray.level = level;
+ groupedArray.childLevels = 0;
+ groupedArray.records = jsonData;
+ var _loop_2 = function (i) {
+ var val = this_2.getVal(jsonData, i, field);
+ if (!Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["isNullOrUndefined"])(format)) {
+ val = format(val, field);
+ }
+ if (!grouped[val]) {
+ grouped[val] = {
+ key: val,
+ count: 0,
+ items: [],
+ aggregates: {},
+ field: field
+ };
+ groupedArray.push(grouped[val]);
+ if (!Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["isNullOrUndefined"])(groupDs)) {
+ var tempObj = groupDs.filter(function (e) { return e.key === grouped[val].key; });
+ grouped[val].count = tempObj[0].count;
+ }
+ }
+ grouped[val].count = !Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["isNullOrUndefined"])(groupDs) ? grouped[val].count : grouped[val].count += 1;
+ if (!isLazyLoad || (isLazyLoad && aggregates.length)) {
+ grouped[val].items.push(jsonData[i]);
+ }
+ };
+ var this_2 = this;
+ for (var i = 0; i < jsonData.length; i++) {
+ _loop_2(i);
+ }
+ if (aggregates && aggregates.length) {
+ var _loop_3 = function (i) {
+ var res = {};
+ var fn = void 0;
+ var aggs = aggregates;
+ for (var j = 0; j < aggregates.length; j++) {
+ fn = DataUtil.aggregates[aggregates[j].type];
+ if (!Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["isNullOrUndefined"])(groupDs)) {
+ var temp = groupDs.filter(function (e) { return e.key === groupedArray[i].key; });
+ if (fn) {
+ res[aggs[j].field + ' - ' + aggs[j].type] = fn(temp[0].items, aggs[j].field);
+ }
+ }
+ else {
+ if (fn) {
+ res[aggs[j].field + ' - ' + aggs[j].type] = fn(groupedArray[i].items, aggs[j].field);
+ }
+ }
+ }
+ groupedArray[i].aggregates = res;
+ };
+ for (var i = 0; i < groupedArray.length; i++) {
+ _loop_3(i);
+ }
+ }
+ if (isLazyLoad && groupedArray.length && aggregates.length) {
+ for (var i = 0; i < groupedArray.length; i++) {
+ groupedArray[i].items = [];
+ }
+ }
+ return jsonData.length && groupedArray || jsonData;
+ };
+ /**
+ * It is used to categorize the multiple items based on a specific field in jsonArray.
+ * The hierarchical queries are commonly required when you use foreign key binding.
+ *
+ * @param {string} fKey
+ * @param {string} from
+ * @param {Object[]} source
+ * @param {Group} lookup?
+ * @param {string} pKey?
+ * @param lookup
+ * @param pKey
+ * @hidden
+ */
+ DataUtil.buildHierarchy = function (fKey, from, source, lookup, pKey) {
+ var i;
+ var grp = {};
+ var temp;
+ if (lookup.result) {
+ lookup = lookup.result;
+ }
+ if (lookup.GroupGuid) {
+ this.throwError('DataManager: Do not have support Grouping in hierarchy');
+ }
+ for (i = 0; i < lookup.length; i++) {
+ var fKeyData = this.getObject(fKey, lookup[i]);
+ temp = grp[fKeyData] || (grp[fKeyData] = []);
+ temp.push(lookup[i]);
+ }
+ for (i = 0; i < source.length; i++) {
+ var fKeyData = this.getObject(pKey || fKey, source[i]);
+ source[i][from] = grp[fKeyData];
+ }
+ };
+ /**
+ * The method used to get the field names which started with specified characters.
+ *
+ * @param {Object} obj
+ * @param {string[]} fields?
+ * @param {string} prefix?
+ * @param fields
+ * @param prefix
+ * @hidden
+ */
+ DataUtil.getFieldList = function (obj, fields, prefix) {
+ if (prefix === undefined) {
+ prefix = '';
+ }
+ if (fields === undefined || fields === null) {
+ return this.getFieldList(obj, [], prefix);
+ }
+ var copyObj = obj;
+ var keys = Object.keys(obj);
+ for (var _i = 0, keys_1 = keys; _i < keys_1.length; _i++) {
+ var prop = keys_1[_i];
+ if (typeof copyObj[prop] === 'object' && !(copyObj[prop] instanceof Array)) {
+ this.getFieldList(copyObj[prop], fields, prefix + prop + '.');
+ }
+ else {
+ fields.push(prefix + prop);
+ }
+ }
+ return fields;
+ };
+ /**
+ * Gets the value of the property in the given object.
+ * The complex object can be accessed by providing the field names concatenated with dot(.).
+ *
+ * @param {string} nameSpace - The name of the property to be accessed.
+ * @param {Object} from - Defines the source object.
+ */
+ DataUtil.getObject = function (nameSpace, from) {
+ if (!nameSpace) {
+ return from;
+ }
+ if (!from) {
+ return undefined;
+ }
+ if (nameSpace.indexOf('.') === -1) {
+ var lowerCaseNameSpace = nameSpace.charAt(0).toLowerCase() + nameSpace.slice(1);
+ var upperCaseNameSpace = nameSpace.charAt(0).toUpperCase() + nameSpace.slice(1);
+ if (!Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["isNullOrUndefined"])(from[nameSpace])) {
+ return from[nameSpace];
+ }
+ else {
+ if (!Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["isNullOrUndefined"])(from[lowerCaseNameSpace])) {
+ return from[lowerCaseNameSpace];
+ }
+ else if (!Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["isNullOrUndefined"])(from[upperCaseNameSpace])) {
+ return from[upperCaseNameSpace];
+ }
+ else {
+ return null;
+ }
+ }
+ }
+ var value = from;
+ var splits = nameSpace.split('.');
+ for (var i = 0; i < splits.length; i++) {
+ if (value == null) {
+ break;
+ }
+ value = value[splits[i]];
+ if (value === undefined) {
+ var casing = splits[i].charAt(0).toUpperCase() + splits[i].slice(1);
+ value = from[casing] || from[casing.charAt(0).toLowerCase() + casing.slice(1)] || null;
+ }
+ from = value;
+ }
+ return value;
+ };
+ /**
+ * To set value for the nameSpace in desired object.
+ *
+ * @param {string} nameSpace - String value to the get the inner object.
+ * @param {Object} value - Value that you need to set.
+ * @param {Object} obj - Object to get the inner object value.
+ * @return { [key: string]: Object; } | Object
+ * @hidden
+ */
+ DataUtil.setValue = function (nameSpace, value, obj) {
+ var keys = nameSpace.toString().split('.');
+ var start = obj || {};
+ var fromObj = start;
+ var i;
+ var length = keys.length;
+ var key;
+ for (i = 0; i < length; i++) {
+ key = keys[i];
+ if (i + 1 === length) {
+ fromObj[key] = value === undefined ? undefined : value;
+ }
+ else if (Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["isNullOrUndefined"])(fromObj[key])) {
+ fromObj[key] = {};
+ }
+ fromObj = fromObj[key];
+ }
+ return start;
+ };
+ /**
+ * Sort the given data based on the field and comparer.
+ *
+ * @param {Object[]} ds - Defines the input data.
+ * @param {string} field - Defines the field to be sorted.
+ * @param {Function} comparer - Defines the comparer function used to sort the records.
+ */
+ DataUtil.sort = function (ds, field, comparer) {
+ if (ds.length <= 1) {
+ return ds;
+ }
+ var middle = parseInt((ds.length / 2).toString(), 10);
+ var left = ds.slice(0, middle);
+ var right = ds.slice(middle);
+ left = this.sort(left, field, comparer);
+ right = this.sort(right, field, comparer);
+ return this.merge(left, right, field, comparer);
+ };
+ DataUtil.ignoreDiacritics = function (value) {
+ if (typeof value !== 'string') {
+ return value;
+ }
+ var result = value.split('');
+ var newValue = result.map(function (temp) { return temp in DataUtil.diacritics ? DataUtil.diacritics[temp] : temp; });
+ return newValue.join('');
+ };
+ DataUtil.merge = function (left, right, fieldName, comparer) {
+ var result = [];
+ var current;
+ while (left.length > 0 || right.length > 0) {
+ if (left.length > 0 && right.length > 0) {
+ if (comparer) {
+ current = comparer(this.getVal(left, 0, fieldName), this.getVal(right, 0, fieldName), left[0], right[0]) <= 0 ? left : right;
+ }
+ else {
+ current = left[0][fieldName] < left[0][fieldName] ? left : right;
+ }
+ }
+ else {
+ current = left.length > 0 ? left : right;
+ }
+ result.push(current.shift());
+ }
+ return result;
+ };
+ DataUtil.getVal = function (array, index, field) {
+ return field ? this.getObject(field, array[index]) : array[index];
+ };
+ DataUtil.toLowerCase = function (val) {
+ return val ? typeof val === 'string' ? val.toLowerCase() : val.toString() : (val === 0 || val === false) ? val.toString() : '';
+ };
+ /**
+ * To perform the filter operation with specified adaptor and returns the result.
+ *
+ * @param {Object} adaptor
+ * @param {string} fnName
+ * @param {Object} param1?
+ * @param {Object} param2?
+ * @param param1
+ * @param param2
+ * @hidden
+ */
+ DataUtil.callAdaptorFunction = function (adaptor, fnName, param1, param2) {
+ if (fnName in adaptor) {
+ var res = adaptor[fnName](param1, param2);
+ if (!Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["isNullOrUndefined"])(res)) {
+ param1 = res;
+ }
+ }
+ return param1;
+ };
+ DataUtil.getAddParams = function (adp, dm, query) {
+ var req = {};
+ DataUtil.callAdaptorFunction(adp, 'addParams', {
+ dm: dm,
+ query: query,
+ params: query.params,
+ reqParams: req
+ });
+ return req;
+ };
+ /**
+ * Checks wheather the given input is a plain object or not.
+ *
+ * @param {Object|Object[]} obj
+ */
+ DataUtil.isPlainObject = function (obj) {
+ return (!!obj) && (obj.constructor === Object);
+ };
+ /**
+ * Returns true when the browser cross origin request.
+ */
+ DataUtil.isCors = function () {
+ var xhr = null;
+ var request = 'XMLHttpRequest';
+ try {
+ xhr = new window[request]();
+ }
+ catch (e) {
+ // No exception handling
+ }
+ return !!xhr && ('withCredentials' in xhr);
+ };
+ /**
+ * Generate random GUID value which will be prefixed with the given value.
+ *
+ * @param {string} prefix
+ */
+ DataUtil.getGuid = function (prefix) {
+ var hexs = '0123456789abcdef';
+ var rand;
+ return (prefix || '') + '00000000-0000-4000-0000-000000000000'.replace(/0/g, function (val, i) {
+ if ('crypto' in window && 'getRandomValues' in crypto) {
+ var arr = new Uint8Array(1);
+ window.crypto.getRandomValues(arr);
+ rand = arr[0] % 16 | 0;
+ }
+ else {
+ rand = Math.random() * 16 | 0;
+ }
+ return hexs[i === 19 ? rand & 0x3 | 0x8 : rand];
+ });
+ };
+ /**
+ * Checks wheather the given value is null or not.
+ *
+ * @param {string|Object} val
+ * @returns boolean
+ */
+ DataUtil.isNull = function (val) {
+ return val === undefined || val === null;
+ };
+ /**
+ * To get the required items from collection of objects.
+ *
+ * @param {Object[]} array
+ * @param {string} field
+ * @param {Function} comparer
+ * @returns Object
+ * @hidden
+ */
+ DataUtil.getItemFromComparer = function (array, field, comparer) {
+ var keyVal;
+ var current;
+ var key;
+ var i = 0;
+ var castRequired = typeof DataUtil.getVal(array, 0, field) === 'string';
+ if (array.length) {
+ while (Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["isNullOrUndefined"])(keyVal) && i < array.length) {
+ keyVal = DataUtil.getVal(array, i, field);
+ key = array[i++];
+ }
+ }
+ for (; i < array.length; i++) {
+ current = DataUtil.getVal(array, i, field);
+ if (Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["isNullOrUndefined"])(current)) {
+ continue;
+ }
+ if (castRequired) {
+ keyVal = +keyVal;
+ current = +current;
+ }
+ if (comparer(keyVal, current) > 0) {
+ keyVal = current;
+ key = array[i];
+ }
+ }
+ return key;
+ };
+ /**
+ * To get distinct values of Array or Array of Objects.
+ *
+ * @param {Object[]} json
+ * @param {string} field
+ * @param fieldName
+ * @param {boolean} requiresCompleteRecord
+ * @returns Object[]
+ * * distinct array of objects is return when requiresCompleteRecord set as true.
+ * @hidden
+ */
+ DataUtil.distinct = function (json, fieldName, requiresCompleteRecord) {
+ requiresCompleteRecord = Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["isNullOrUndefined"])(requiresCompleteRecord) ? false : requiresCompleteRecord;
+ var result = [];
+ var val;
+ var tmp = {};
+ json.forEach(function (data, index) {
+ val = typeof (json[index]) === 'object' ? DataUtil.getVal(json, index, fieldName) : json[index];
+ if (!(val in tmp)) {
+ result.push(!requiresCompleteRecord ? val : json[index]);
+ tmp[val] = 1;
+ }
+ });
+ return result;
+ };
+ /**
+ * Process the given records based on the datamanager string.
+ *
+ * @param {string} datamanager
+ * @param dm
+ * @param {Object[]} records
+ */
+ DataUtil.processData = function (dm, records) {
+ var query = this.prepareQuery(dm);
+ var sampledata = new _manager__WEBPACK_IMPORTED_MODULE_1__["DataManager"](records);
+ if (dm.requiresCounts) {
+ query.requiresCount();
+ }
+ /* eslint-disable @typescript-eslint/no-explicit-any */
+ // tslint:disable-next-line:no-any
+ var result = sampledata.executeLocal(query);
+ /* eslint-enable @typescript-eslint/no-explicit-any */
+ var returnValue = {
+ result: dm.requiresCounts ? result.result : result,
+ count: result.count,
+ aggregates: JSON.stringify(result.aggregates)
+ };
+ return dm.requiresCounts ? returnValue : result;
+ };
+ DataUtil.prepareQuery = function (dm) {
+ var _this = this;
+ var query = new _query__WEBPACK_IMPORTED_MODULE_2__["Query"]();
+ if (dm.select) {
+ query.select(dm.select);
+ }
+ if (dm.where) {
+ var where = DataUtil.parse.parseJson(dm.where);
+ where.filter(function (pred) {
+ if (Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["isNullOrUndefined"])(pred.condition)) {
+ query.where(pred.field, pred.operator, pred.value, pred.ignoreCase, pred.ignoreAccent);
+ }
+ else {
+ var predicateList = [];
+ if (pred.field) {
+ predicateList.push(new _query__WEBPACK_IMPORTED_MODULE_2__["Predicate"](pred.field, pred.operator, pred.value, pred.ignoreCase, pred.ignoreAccent));
+ }
+ else {
+ predicateList = predicateList.concat(_this.getPredicate(pred.predicates));
+ }
+ if (pred.condition === 'or') {
+ query.where(_query__WEBPACK_IMPORTED_MODULE_2__["Predicate"].or(predicateList));
+ }
+ else if (pred.condition === 'and') {
+ query.where(_query__WEBPACK_IMPORTED_MODULE_2__["Predicate"].and(predicateList));
+ }
+ }
+ });
+ }
+ if (dm.search) {
+ var search = DataUtil.parse.parseJson(dm.search);
+ // tslint:disable-next-line:no-string-literal
+ search.filter(function (e) { return query.search(e.key, e.fields, e['operator'],
+ // tslint:disable-next-line:no-string-literal
+ e['ignoreCase'], e['ignoreAccent']); });
+ }
+ if (dm.aggregates) {
+ dm.aggregates.filter(function (e) { return query.aggregate(e.type, e.field); });
+ }
+ if (dm.sorted) {
+ dm.sorted.filter(function (e) { return query.sortBy(e.name, e.direction); });
+ }
+ if (dm.skip) {
+ query.skip(dm.skip);
+ }
+ if (dm.take) {
+ query.take(dm.take);
+ }
+ if (dm.group) {
+ dm.group.filter(function (grp) { return query.group(grp); });
+ }
+ return query;
+ };
+ DataUtil.getPredicate = function (pred) {
+ var mainPred = [];
+ for (var i = 0; i < pred.length; i++) {
+ var e = pred[i];
+ if (e.field) {
+ mainPred.push(new _query__WEBPACK_IMPORTED_MODULE_2__["Predicate"](e.field, e.operator, e.value, e.ignoreCase, e.ignoreAccent));
+ }
+ else {
+ var childPred = [];
+ // tslint:disable-next-line:typedef
+ var cpre = this.getPredicate(e.predicates);
+ for (var _i = 0, _a = Object.keys(cpre); _i < _a.length; _i++) {
+ var prop = _a[_i];
+ childPred.push(cpre[prop]);
+ }
+ mainPred.push(e.condition === 'or' ? _query__WEBPACK_IMPORTED_MODULE_2__["Predicate"].or(childPred) : _query__WEBPACK_IMPORTED_MODULE_2__["Predicate"].and(childPred));
+ }
+ }
+ return mainPred;
+ };
+ /**
+ * Specifies the value which will be used to adjust the date value to server timezone.
+ *
+ * @default null
+ */
+ DataUtil.serverTimezoneOffset = null;
+ /**
+ * Species whether are not to be parsed with serverTimezoneOffset value.
+ *
+ * @hidden
+ */
+ DataUtil.timeZoneHandling = true;
+ /**
+ * Throw error with the given string as message.
+ *
+ * @param {string} er
+ * @param error
+ */
+ DataUtil.throwError = function (error) {
+ try {
+ throw new Error(error);
+ }
+ catch (e) {
+ // eslint-disable-next-line no-throw-literal
+ throw e.message + '\n' + e.stack;
+ }
+ };
+ DataUtil.aggregates = {
+ /**
+ * Calculate sum of the given field in the data.
+ *
+ * @param {Object[]} ds
+ * @param {string} field
+ */
+ sum: function (ds, field) {
+ var result = 0;
+ var val;
+ var castRequired = typeof DataUtil.getVal(ds, 0, field) !== 'number';
+ for (var i = 0; i < ds.length; i++) {
+ val = DataUtil.getVal(ds, i, field);
+ if (!isNaN(val) && val !== null) {
+ if (castRequired) {
+ val = +val;
+ }
+ result += val;
+ }
+ }
+ return result;
+ },
+ /**
+ * Calculate average value of the given field in the data.
+ *
+ * @param {Object[]} ds
+ * @param {string} field
+ */
+ average: function (ds, field) {
+ return DataUtil.aggregates.sum(ds, field) / ds.length;
+ },
+ /**
+ * Returns the min value of the data based on the field.
+ *
+ * @param {Object[]} ds
+ * @param {string|Function} field
+ */
+ min: function (ds, field) {
+ var comparer;
+ if (typeof field === 'function') {
+ comparer = field;
+ field = null;
+ }
+ return DataUtil.getObject(field, DataUtil.getItemFromComparer(ds, field, comparer || DataUtil.fnAscending));
+ },
+ /**
+ * Returns the max value of the data based on the field.
+ *
+ * @param {Object[]} ds
+ * @param {string} field
+ * @returns number
+ */
+ max: function (ds, field) {
+ var comparer;
+ if (typeof field === 'function') {
+ comparer = field;
+ field = null;
+ }
+ return DataUtil.getObject(field, DataUtil.getItemFromComparer(ds, field, comparer || DataUtil.fnDescending));
+ },
+ /**
+ * Returns the total number of true value present in the data based on the given boolean field name.
+ *
+ * @param {Object[]} ds
+ * @param {string} field
+ */
+ truecount: function (ds, field) {
+ return new _manager__WEBPACK_IMPORTED_MODULE_1__["DataManager"](ds).executeLocal(new _query__WEBPACK_IMPORTED_MODULE_2__["Query"]().where(field, 'equal', true, true)).length;
+ },
+ /**
+ * Returns the total number of false value present in the data based on the given boolean field name.
+ *
+ * @param {Object[]} ds
+ * @param {string} field
+ */
+ falsecount: function (ds, field) {
+ return new _manager__WEBPACK_IMPORTED_MODULE_1__["DataManager"](ds).executeLocal(new _query__WEBPACK_IMPORTED_MODULE_2__["Query"]().where(field, 'equal', false, true)).length;
+ },
+ /**
+ * Returns the length of the given data.
+ *
+ * @param {Object[]} ds
+ * @param {string} field?
+ * @param field
+ * @returns number
+ */
+ count: function (ds, field) {
+ return ds.length;
+ }
+ };
+ /**
+ * Specifies the Object with filter operators.
+ */
+ DataUtil.operatorSymbols = {
+ '<': 'lessthan',
+ '>': 'greaterthan',
+ '<=': 'lessthanorequal',
+ '>=': 'greaterthanorequal',
+ '==': 'equal',
+ '!=': 'notequal',
+ '*=': 'contains',
+ '$=': 'endswith',
+ '^=': 'startswith'
+ };
+ /**
+ * Specifies the Object with filter operators which will be used for OData filter query generation.
+ * * It will be used for date/number type filter query.
+ */
+ DataUtil.odBiOperator = {
+ '<': ' lt ',
+ '>': ' gt ',
+ '<=': ' le ',
+ '>=': ' ge ',
+ '==': ' eq ',
+ '!=': ' ne ',
+ 'lessthan': ' lt ',
+ 'lessthanorequal': ' le ',
+ 'greaterthan': ' gt ',
+ 'greaterthanorequal': ' ge ',
+ 'equal': ' eq ',
+ 'notequal': ' ne '
+ };
+ /**
+ * Specifies the Object with filter operators which will be used for OData filter query generation.
+ * It will be used for string type filter query.
+ */
+ DataUtil.odUniOperator = {
+ '$=': 'endswith',
+ '^=': 'startswith',
+ '*=': 'substringof',
+ 'endswith': 'endswith',
+ 'startswith': 'startswith',
+ 'contains': 'substringof',
+ 'doesnotendwith': 'not endswith',
+ 'doesnotstartwith': 'not startswith',
+ 'doesnotcontain': 'not substringof',
+ 'wildcard': 'wildcard',
+ 'like': 'like'
+ };
+ /**
+ * Specifies the Object with filter operators which will be used for ODataV4 filter query generation.
+ * It will be used for string type filter query.
+ */
+ DataUtil.odv4UniOperator = {
+ '$=': 'endswith',
+ '^=': 'startswith',
+ '*=': 'contains',
+ 'endswith': 'endswith',
+ 'startswith': 'startswith',
+ 'contains': 'contains',
+ 'doesnotendwith': 'not endswith',
+ 'doesnotstartwith': 'not startswith',
+ 'doesnotcontain': 'not contains',
+ 'wildcard': 'wildcard',
+ 'like': 'like'
+ };
+ DataUtil.diacritics = {
+ '\u24B6': 'A',
+ '\uFF21': 'A',
+ '\u00C0': 'A',
+ '\u00C1': 'A',
+ '\u00C2': 'A',
+ '\u1EA6': 'A',
+ '\u1EA4': 'A',
+ '\u1EAA': 'A',
+ '\u1EA8': 'A',
+ '\u00C3': 'A',
+ '\u0100': 'A',
+ '\u0102': 'A',
+ '\u1EB0': 'A',
+ '\u1EAE': 'A',
+ '\u1EB4': 'A',
+ '\u1EB2': 'A',
+ '\u0226': 'A',
+ '\u01E0': 'A',
+ '\u00C4': 'A',
+ '\u01DE': 'A',
+ '\u1EA2': 'A',
+ '\u00C5': 'A',
+ '\u01FA': 'A',
+ '\u01CD': 'A',
+ '\u0200': 'A',
+ '\u0202': 'A',
+ '\u1EA0': 'A',
+ '\u1EAC': 'A',
+ '\u1EB6': 'A',
+ '\u1E00': 'A',
+ '\u0104': 'A',
+ '\u023A': 'A',
+ '\u2C6F': 'A',
+ '\uA732': 'AA',
+ '\u00C6': 'AE',
+ '\u01FC': 'AE',
+ '\u01E2': 'AE',
+ '\uA734': 'AO',
+ '\uA736': 'AU',
+ '\uA738': 'AV',
+ '\uA73A': 'AV',
+ '\uA73C': 'AY',
+ '\u24B7': 'B',
+ '\uFF22': 'B',
+ '\u1E02': 'B',
+ '\u1E04': 'B',
+ '\u1E06': 'B',
+ '\u0243': 'B',
+ '\u0182': 'B',
+ '\u0181': 'B',
+ '\u24B8': 'C',
+ '\uFF23': 'C',
+ '\u0106': 'C',
+ '\u0108': 'C',
+ '\u010A': 'C',
+ '\u010C': 'C',
+ '\u00C7': 'C',
+ '\u1E08': 'C',
+ '\u0187': 'C',
+ '\u023B': 'C',
+ '\uA73E': 'C',
+ '\u24B9': 'D',
+ '\uFF24': 'D',
+ '\u1E0A': 'D',
+ '\u010E': 'D',
+ '\u1E0C': 'D',
+ '\u1E10': 'D',
+ '\u1E12': 'D',
+ '\u1E0E': 'D',
+ '\u0110': 'D',
+ '\u018B': 'D',
+ '\u018A': 'D',
+ '\u0189': 'D',
+ '\uA779': 'D',
+ '\u01F1': 'DZ',
+ '\u01C4': 'DZ',
+ '\u01F2': 'Dz',
+ '\u01C5': 'Dz',
+ '\u24BA': 'E',
+ '\uFF25': 'E',
+ '\u00C8': 'E',
+ '\u00C9': 'E',
+ '\u00CA': 'E',
+ '\u1EC0': 'E',
+ '\u1EBE': 'E',
+ '\u1EC4': 'E',
+ '\u1EC2': 'E',
+ '\u1EBC': 'E',
+ '\u0112': 'E',
+ '\u1E14': 'E',
+ '\u1E16': 'E',
+ '\u0114': 'E',
+ '\u0116': 'E',
+ '\u00CB': 'E',
+ '\u1EBA': 'E',
+ '\u011A': 'E',
+ '\u0204': 'E',
+ '\u0206': 'E',
+ '\u1EB8': 'E',
+ '\u1EC6': 'E',
+ '\u0228': 'E',
+ '\u1E1C': 'E',
+ '\u0118': 'E',
+ '\u1E18': 'E',
+ '\u1E1A': 'E',
+ '\u0190': 'E',
+ '\u018E': 'E',
+ '\u24BB': 'F',
+ '\uFF26': 'F',
+ '\u1E1E': 'F',
+ '\u0191': 'F',
+ '\uA77B': 'F',
+ '\u24BC': 'G',
+ '\uFF27': 'G',
+ '\u01F4': 'G',
+ '\u011C': 'G',
+ '\u1E20': 'G',
+ '\u011E': 'G',
+ '\u0120': 'G',
+ '\u01E6': 'G',
+ '\u0122': 'G',
+ '\u01E4': 'G',
+ '\u0193': 'G',
+ '\uA7A0': 'G',
+ '\uA77D': 'G',
+ '\uA77E': 'G',
+ '\u24BD': 'H',
+ '\uFF28': 'H',
+ '\u0124': 'H',
+ '\u1E22': 'H',
+ '\u1E26': 'H',
+ '\u021E': 'H',
+ '\u1E24': 'H',
+ '\u1E28': 'H',
+ '\u1E2A': 'H',
+ '\u0126': 'H',
+ '\u2C67': 'H',
+ '\u2C75': 'H',
+ '\uA78D': 'H',
+ '\u24BE': 'I',
+ '\uFF29': 'I',
+ '\u00CC': 'I',
+ '\u00CD': 'I',
+ '\u00CE': 'I',
+ '\u0128': 'I',
+ '\u012A': 'I',
+ '\u012C': 'I',
+ '\u0130': 'I',
+ '\u00CF': 'I',
+ '\u1E2E': 'I',
+ '\u1EC8': 'I',
+ '\u01CF': 'I',
+ '\u0208': 'I',
+ '\u020A': 'I',
+ '\u1ECA': 'I',
+ '\u012E': 'I',
+ '\u1E2C': 'I',
+ '\u0197': 'I',
+ '\u24BF': 'J',
+ '\uFF2A': 'J',
+ '\u0134': 'J',
+ '\u0248': 'J',
+ '\u24C0': 'K',
+ '\uFF2B': 'K',
+ '\u1E30': 'K',
+ '\u01E8': 'K',
+ '\u1E32': 'K',
+ '\u0136': 'K',
+ '\u1E34': 'K',
+ '\u0198': 'K',
+ '\u2C69': 'K',
+ '\uA740': 'K',
+ '\uA742': 'K',
+ '\uA744': 'K',
+ '\uA7A2': 'K',
+ '\u24C1': 'L',
+ '\uFF2C': 'L',
+ '\u013F': 'L',
+ '\u0139': 'L',
+ '\u013D': 'L',
+ '\u1E36': 'L',
+ '\u1E38': 'L',
+ '\u013B': 'L',
+ '\u1E3C': 'L',
+ '\u1E3A': 'L',
+ '\u0141': 'L',
+ '\u023D': 'L',
+ '\u2C62': 'L',
+ '\u2C60': 'L',
+ '\uA748': 'L',
+ '\uA746': 'L',
+ '\uA780': 'L',
+ '\u01C7': 'LJ',
+ '\u01C8': 'Lj',
+ '\u24C2': 'M',
+ '\uFF2D': 'M',
+ '\u1E3E': 'M',
+ '\u1E40': 'M',
+ '\u1E42': 'M',
+ '\u2C6E': 'M',
+ '\u019C': 'M',
+ '\u24C3': 'N',
+ '\uFF2E': 'N',
+ '\u01F8': 'N',
+ '\u0143': 'N',
+ '\u00D1': 'N',
+ '\u1E44': 'N',
+ '\u0147': 'N',
+ '\u1E46': 'N',
+ '\u0145': 'N',
+ '\u1E4A': 'N',
+ '\u1E48': 'N',
+ '\u0220': 'N',
+ '\u019D': 'N',
+ '\uA790': 'N',
+ '\uA7A4': 'N',
+ '\u01CA': 'NJ',
+ '\u01CB': 'Nj',
+ '\u24C4': 'O',
+ '\uFF2F': 'O',
+ '\u00D2': 'O',
+ '\u00D3': 'O',
+ '\u00D4': 'O',
+ '\u1ED2': 'O',
+ '\u1ED0': 'O',
+ '\u1ED6': 'O',
+ '\u1ED4': 'O',
+ '\u00D5': 'O',
+ '\u1E4C': 'O',
+ '\u022C': 'O',
+ '\u1E4E': 'O',
+ '\u014C': 'O',
+ '\u1E50': 'O',
+ '\u1E52': 'O',
+ '\u014E': 'O',
+ '\u022E': 'O',
+ '\u0230': 'O',
+ '\u00D6': 'O',
+ '\u022A': 'O',
+ '\u1ECE': 'O',
+ '\u0150': 'O',
+ '\u01D1': 'O',
+ '\u020C': 'O',
+ '\u020E': 'O',
+ '\u01A0': 'O',
+ '\u1EDC': 'O',
+ '\u1EDA': 'O',
+ '\u1EE0': 'O',
+ '\u1EDE': 'O',
+ '\u1EE2': 'O',
+ '\u1ECC': 'O',
+ '\u1ED8': 'O',
+ '\u01EA': 'O',
+ '\u01EC': 'O',
+ '\u00D8': 'O',
+ '\u01FE': 'O',
+ '\u0186': 'O',
+ '\u019F': 'O',
+ '\uA74A': 'O',
+ '\uA74C': 'O',
+ '\u01A2': 'OI',
+ '\uA74E': 'OO',
+ '\u0222': 'OU',
+ '\u24C5': 'P',
+ '\uFF30': 'P',
+ '\u1E54': 'P',
+ '\u1E56': 'P',
+ '\u01A4': 'P',
+ '\u2C63': 'P',
+ '\uA750': 'P',
+ '\uA752': 'P',
+ '\uA754': 'P',
+ '\u24C6': 'Q',
+ '\uFF31': 'Q',
+ '\uA756': 'Q',
+ '\uA758': 'Q',
+ '\u024A': 'Q',
+ '\u24C7': 'R',
+ '\uFF32': 'R',
+ '\u0154': 'R',
+ '\u1E58': 'R',
+ '\u0158': 'R',
+ '\u0210': 'R',
+ '\u0212': 'R',
+ '\u1E5A': 'R',
+ '\u1E5C': 'R',
+ '\u0156': 'R',
+ '\u1E5E': 'R',
+ '\u024C': 'R',
+ '\u2C64': 'R',
+ '\uA75A': 'R',
+ '\uA7A6': 'R',
+ '\uA782': 'R',
+ '\u24C8': 'S',
+ '\uFF33': 'S',
+ '\u1E9E': 'S',
+ '\u015A': 'S',
+ '\u1E64': 'S',
+ '\u015C': 'S',
+ '\u1E60': 'S',
+ '\u0160': 'S',
+ '\u1E66': 'S',
+ '\u1E62': 'S',
+ '\u1E68': 'S',
+ '\u0218': 'S',
+ '\u015E': 'S',
+ '\u2C7E': 'S',
+ '\uA7A8': 'S',
+ '\uA784': 'S',
+ '\u24C9': 'T',
+ '\uFF34': 'T',
+ '\u1E6A': 'T',
+ '\u0164': 'T',
+ '\u1E6C': 'T',
+ '\u021A': 'T',
+ '\u0162': 'T',
+ '\u1E70': 'T',
+ '\u1E6E': 'T',
+ '\u0166': 'T',
+ '\u01AC': 'T',
+ '\u01AE': 'T',
+ '\u023E': 'T',
+ '\uA786': 'T',
+ '\uA728': 'TZ',
+ '\u24CA': 'U',
+ '\uFF35': 'U',
+ '\u00D9': 'U',
+ '\u00DA': 'U',
+ '\u00DB': 'U',
+ '\u0168': 'U',
+ '\u1E78': 'U',
+ '\u016A': 'U',
+ '\u1E7A': 'U',
+ '\u016C': 'U',
+ '\u00DC': 'U',
+ '\u01DB': 'U',
+ '\u01D7': 'U',
+ '\u01D5': 'U',
+ '\u01D9': 'U',
+ '\u1EE6': 'U',
+ '\u016E': 'U',
+ '\u0170': 'U',
+ '\u01D3': 'U',
+ '\u0214': 'U',
+ '\u0216': 'U',
+ '\u01AF': 'U',
+ '\u1EEA': 'U',
+ '\u1EE8': 'U',
+ '\u1EEE': 'U',
+ '\u1EEC': 'U',
+ '\u1EF0': 'U',
+ '\u1EE4': 'U',
+ '\u1E72': 'U',
+ '\u0172': 'U',
+ '\u1E76': 'U',
+ '\u1E74': 'U',
+ '\u0244': 'U',
+ '\u24CB': 'V',
+ '\uFF36': 'V',
+ '\u1E7C': 'V',
+ '\u1E7E': 'V',
+ '\u01B2': 'V',
+ '\uA75E': 'V',
+ '\u0245': 'V',
+ '\uA760': 'VY',
+ '\u24CC': 'W',
+ '\uFF37': 'W',
+ '\u1E80': 'W',
+ '\u1E82': 'W',
+ '\u0174': 'W',
+ '\u1E86': 'W',
+ '\u1E84': 'W',
+ '\u1E88': 'W',
+ '\u2C72': 'W',
+ '\u24CD': 'X',
+ '\uFF38': 'X',
+ '\u1E8A': 'X',
+ '\u1E8C': 'X',
+ '\u24CE': 'Y',
+ '\uFF39': 'Y',
+ '\u1EF2': 'Y',
+ '\u00DD': 'Y',
+ '\u0176': 'Y',
+ '\u1EF8': 'Y',
+ '\u0232': 'Y',
+ '\u1E8E': 'Y',
+ '\u0178': 'Y',
+ '\u1EF6': 'Y',
+ '\u1EF4': 'Y',
+ '\u01B3': 'Y',
+ '\u024E': 'Y',
+ '\u1EFE': 'Y',
+ '\u24CF': 'Z',
+ '\uFF3A': 'Z',
+ '\u0179': 'Z',
+ '\u1E90': 'Z',
+ '\u017B': 'Z',
+ '\u017D': 'Z',
+ '\u1E92': 'Z',
+ '\u1E94': 'Z',
+ '\u01B5': 'Z',
+ '\u0224': 'Z',
+ '\u2C7F': 'Z',
+ '\u2C6B': 'Z',
+ '\uA762': 'Z',
+ '\u24D0': 'a',
+ '\uFF41': 'a',
+ '\u1E9A': 'a',
+ '\u00E0': 'a',
+ '\u00E1': 'a',
+ '\u00E2': 'a',
+ '\u1EA7': 'a',
+ '\u1EA5': 'a',
+ '\u1EAB': 'a',
+ '\u1EA9': 'a',
+ '\u00E3': 'a',
+ '\u0101': 'a',
+ '\u0103': 'a',
+ '\u1EB1': 'a',
+ '\u1EAF': 'a',
+ '\u1EB5': 'a',
+ '\u1EB3': 'a',
+ '\u0227': 'a',
+ '\u01E1': 'a',
+ '\u00E4': 'a',
+ '\u01DF': 'a',
+ '\u1EA3': 'a',
+ '\u00E5': 'a',
+ '\u01FB': 'a',
+ '\u01CE': 'a',
+ '\u0201': 'a',
+ '\u0203': 'a',
+ '\u1EA1': 'a',
+ '\u1EAD': 'a',
+ '\u1EB7': 'a',
+ '\u1E01': 'a',
+ '\u0105': 'a',
+ '\u2C65': 'a',
+ '\u0250': 'a',
+ '\uA733': 'aa',
+ '\u00E6': 'ae',
+ '\u01FD': 'ae',
+ '\u01E3': 'ae',
+ '\uA735': 'ao',
+ '\uA737': 'au',
+ '\uA739': 'av',
+ '\uA73B': 'av',
+ '\uA73D': 'ay',
+ '\u24D1': 'b',
+ '\uFF42': 'b',
+ '\u1E03': 'b',
+ '\u1E05': 'b',
+ '\u1E07': 'b',
+ '\u0180': 'b',
+ '\u0183': 'b',
+ '\u0253': 'b',
+ '\u24D2': 'c',
+ '\uFF43': 'c',
+ '\u0107': 'c',
+ '\u0109': 'c',
+ '\u010B': 'c',
+ '\u010D': 'c',
+ '\u00E7': 'c',
+ '\u1E09': 'c',
+ '\u0188': 'c',
+ '\u023C': 'c',
+ '\uA73F': 'c',
+ '\u2184': 'c',
+ '\u24D3': 'd',
+ '\uFF44': 'd',
+ '\u1E0B': 'd',
+ '\u010F': 'd',
+ '\u1E0D': 'd',
+ '\u1E11': 'd',
+ '\u1E13': 'd',
+ '\u1E0F': 'd',
+ '\u0111': 'd',
+ '\u018C': 'd',
+ '\u0256': 'd',
+ '\u0257': 'd',
+ '\uA77A': 'd',
+ '\u01F3': 'dz',
+ '\u01C6': 'dz',
+ '\u24D4': 'e',
+ '\uFF45': 'e',
+ '\u00E8': 'e',
+ '\u00E9': 'e',
+ '\u00EA': 'e',
+ '\u1EC1': 'e',
+ '\u1EBF': 'e',
+ '\u1EC5': 'e',
+ '\u1EC3': 'e',
+ '\u1EBD': 'e',
+ '\u0113': 'e',
+ '\u1E15': 'e',
+ '\u1E17': 'e',
+ '\u0115': 'e',
+ '\u0117': 'e',
+ '\u00EB': 'e',
+ '\u1EBB': 'e',
+ '\u011B': 'e',
+ '\u0205': 'e',
+ '\u0207': 'e',
+ '\u1EB9': 'e',
+ '\u1EC7': 'e',
+ '\u0229': 'e',
+ '\u1E1D': 'e',
+ '\u0119': 'e',
+ '\u1E19': 'e',
+ '\u1E1B': 'e',
+ '\u0247': 'e',
+ '\u025B': 'e',
+ '\u01DD': 'e',
+ '\u24D5': 'f',
+ '\uFF46': 'f',
+ '\u1E1F': 'f',
+ '\u0192': 'f',
+ '\uA77C': 'f',
+ '\u24D6': 'g',
+ '\uFF47': 'g',
+ '\u01F5': 'g',
+ '\u011D': 'g',
+ '\u1E21': 'g',
+ '\u011F': 'g',
+ '\u0121': 'g',
+ '\u01E7': 'g',
+ '\u0123': 'g',
+ '\u01E5': 'g',
+ '\u0260': 'g',
+ '\uA7A1': 'g',
+ '\u1D79': 'g',
+ '\uA77F': 'g',
+ '\u24D7': 'h',
+ '\uFF48': 'h',
+ '\u0125': 'h',
+ '\u1E23': 'h',
+ '\u1E27': 'h',
+ '\u021F': 'h',
+ '\u1E25': 'h',
+ '\u1E29': 'h',
+ '\u1E2B': 'h',
+ '\u1E96': 'h',
+ '\u0127': 'h',
+ '\u2C68': 'h',
+ '\u2C76': 'h',
+ '\u0265': 'h',
+ '\u0195': 'hv',
+ '\u24D8': 'i',
+ '\uFF49': 'i',
+ '\u00EC': 'i',
+ '\u00ED': 'i',
+ '\u00EE': 'i',
+ '\u0129': 'i',
+ '\u012B': 'i',
+ '\u012D': 'i',
+ '\u00EF': 'i',
+ '\u1E2F': 'i',
+ '\u1EC9': 'i',
+ '\u01D0': 'i',
+ '\u0209': 'i',
+ '\u020B': 'i',
+ '\u1ECB': 'i',
+ '\u012F': 'i',
+ '\u1E2D': 'i',
+ '\u0268': 'i',
+ '\u0131': 'i',
+ '\u24D9': 'j',
+ '\uFF4A': 'j',
+ '\u0135': 'j',
+ '\u01F0': 'j',
+ '\u0249': 'j',
+ '\u24DA': 'k',
+ '\uFF4B': 'k',
+ '\u1E31': 'k',
+ '\u01E9': 'k',
+ '\u1E33': 'k',
+ '\u0137': 'k',
+ '\u1E35': 'k',
+ '\u0199': 'k',
+ '\u2C6A': 'k',
+ '\uA741': 'k',
+ '\uA743': 'k',
+ '\uA745': 'k',
+ '\uA7A3': 'k',
+ '\u24DB': 'l',
+ '\uFF4C': 'l',
+ '\u0140': 'l',
+ '\u013A': 'l',
+ '\u013E': 'l',
+ '\u1E37': 'l',
+ '\u1E39': 'l',
+ '\u013C': 'l',
+ '\u1E3D': 'l',
+ '\u1E3B': 'l',
+ '\u017F': 'l',
+ '\u0142': 'l',
+ '\u019A': 'l',
+ '\u026B': 'l',
+ '\u2C61': 'l',
+ '\uA749': 'l',
+ '\uA781': 'l',
+ '\uA747': 'l',
+ '\u01C9': 'lj',
+ '\u24DC': 'm',
+ '\uFF4D': 'm',
+ '\u1E3F': 'm',
+ '\u1E41': 'm',
+ '\u1E43': 'm',
+ '\u0271': 'm',
+ '\u026F': 'm',
+ '\u24DD': 'n',
+ '\uFF4E': 'n',
+ '\u01F9': 'n',
+ '\u0144': 'n',
+ '\u00F1': 'n',
+ '\u1E45': 'n',
+ '\u0148': 'n',
+ '\u1E47': 'n',
+ '\u0146': 'n',
+ '\u1E4B': 'n',
+ '\u1E49': 'n',
+ '\u019E': 'n',
+ '\u0272': 'n',
+ '\u0149': 'n',
+ '\uA791': 'n',
+ '\uA7A5': 'n',
+ '\u01CC': 'nj',
+ '\u24DE': 'o',
+ '\uFF4F': 'o',
+ '\u00F2': 'o',
+ '\u00F3': 'o',
+ '\u00F4': 'o',
+ '\u1ED3': 'o',
+ '\u1ED1': 'o',
+ '\u1ED7': 'o',
+ '\u1ED5': 'o',
+ '\u00F5': 'o',
+ '\u1E4D': 'o',
+ '\u022D': 'o',
+ '\u1E4F': 'o',
+ '\u014D': 'o',
+ '\u1E51': 'o',
+ '\u1E53': 'o',
+ '\u014F': 'o',
+ '\u022F': 'o',
+ '\u0231': 'o',
+ '\u00F6': 'o',
+ '\u022B': 'o',
+ '\u1ECF': 'o',
+ '\u0151': 'o',
+ '\u01D2': 'o',
+ '\u020D': 'o',
+ '\u020F': 'o',
+ '\u01A1': 'o',
+ '\u1EDD': 'o',
+ '\u1EDB': 'o',
+ '\u1EE1': 'o',
+ '\u1EDF': 'o',
+ '\u1EE3': 'o',
+ '\u1ECD': 'o',
+ '\u1ED9': 'o',
+ '\u01EB': 'o',
+ '\u01ED': 'o',
+ '\u00F8': 'o',
+ '\u01FF': 'o',
+ '\u0254': 'o',
+ '\uA74B': 'o',
+ '\uA74D': 'o',
+ '\u0275': 'o',
+ '\u01A3': 'oi',
+ '\u0223': 'ou',
+ '\uA74F': 'oo',
+ '\u24DF': 'p',
+ '\uFF50': 'p',
+ '\u1E55': 'p',
+ '\u1E57': 'p',
+ '\u01A5': 'p',
+ '\u1D7D': 'p',
+ '\uA751': 'p',
+ '\uA753': 'p',
+ '\uA755': 'p',
+ '\u24E0': 'q',
+ '\uFF51': 'q',
+ '\u024B': 'q',
+ '\uA757': 'q',
+ '\uA759': 'q',
+ '\u24E1': 'r',
+ '\uFF52': 'r',
+ '\u0155': 'r',
+ '\u1E59': 'r',
+ '\u0159': 'r',
+ '\u0211': 'r',
+ '\u0213': 'r',
+ '\u1E5B': 'r',
+ '\u1E5D': 'r',
+ '\u0157': 'r',
+ '\u1E5F': 'r',
+ '\u024D': 'r',
+ '\u027D': 'r',
+ '\uA75B': 'r',
+ '\uA7A7': 'r',
+ '\uA783': 'r',
+ '\u24E2': 's',
+ '\uFF53': 's',
+ '\u00DF': 's',
+ '\u015B': 's',
+ '\u1E65': 's',
+ '\u015D': 's',
+ '\u1E61': 's',
+ '\u0161': 's',
+ '\u1E67': 's',
+ '\u1E63': 's',
+ '\u1E69': 's',
+ '\u0219': 's',
+ '\u015F': 's',
+ '\u023F': 's',
+ '\uA7A9': 's',
+ '\uA785': 's',
+ '\u1E9B': 's',
+ '\u24E3': 't',
+ '\uFF54': 't',
+ '\u1E6B': 't',
+ '\u1E97': 't',
+ '\u0165': 't',
+ '\u1E6D': 't',
+ '\u021B': 't',
+ '\u0163': 't',
+ '\u1E71': 't',
+ '\u1E6F': 't',
+ '\u0167': 't',
+ '\u01AD': 't',
+ '\u0288': 't',
+ '\u2C66': 't',
+ '\uA787': 't',
+ '\uA729': 'tz',
+ '\u24E4': 'u',
+ '\uFF55': 'u',
+ '\u00F9': 'u',
+ '\u00FA': 'u',
+ '\u00FB': 'u',
+ '\u0169': 'u',
+ '\u1E79': 'u',
+ '\u016B': 'u',
+ '\u1E7B': 'u',
+ '\u016D': 'u',
+ '\u00FC': 'u',
+ '\u01DC': 'u',
+ '\u01D8': 'u',
+ '\u01D6': 'u',
+ '\u01DA': 'u',
+ '\u1EE7': 'u',
+ '\u016F': 'u',
+ '\u0171': 'u',
+ '\u01D4': 'u',
+ '\u0215': 'u',
+ '\u0217': 'u',
+ '\u01B0': 'u',
+ '\u1EEB': 'u',
+ '\u1EE9': 'u',
+ '\u1EEF': 'u',
+ '\u1EED': 'u',
+ '\u1EF1': 'u',
+ '\u1EE5': 'u',
+ '\u1E73': 'u',
+ '\u0173': 'u',
+ '\u1E77': 'u',
+ '\u1E75': 'u',
+ '\u0289': 'u',
+ '\u24E5': 'v',
+ '\uFF56': 'v',
+ '\u1E7D': 'v',
+ '\u1E7F': 'v',
+ '\u028B': 'v',
+ '\uA75F': 'v',
+ '\u028C': 'v',
+ '\uA761': 'vy',
+ '\u24E6': 'w',
+ '\uFF57': 'w',
+ '\u1E81': 'w',
+ '\u1E83': 'w',
+ '\u0175': 'w',
+ '\u1E87': 'w',
+ '\u1E85': 'w',
+ '\u1E98': 'w',
+ '\u1E89': 'w',
+ '\u2C73': 'w',
+ '\u24E7': 'x',
+ '\uFF58': 'x',
+ '\u1E8B': 'x',
+ '\u1E8D': 'x',
+ '\u24E8': 'y',
+ '\uFF59': 'y',
+ '\u1EF3': 'y',
+ '\u00FD': 'y',
+ '\u0177': 'y',
+ '\u1EF9': 'y',
+ '\u0233': 'y',
+ '\u1E8F': 'y',
+ '\u00FF': 'y',
+ '\u1EF7': 'y',
+ '\u1E99': 'y',
+ '\u1EF5': 'y',
+ '\u01B4': 'y',
+ '\u024F': 'y',
+ '\u1EFF': 'y',
+ '\u24E9': 'z',
+ '\uFF5A': 'z',
+ '\u017A': 'z',
+ '\u1E91': 'z',
+ '\u017C': 'z',
+ '\u017E': 'z',
+ '\u1E93': 'z',
+ '\u1E95': 'z',
+ '\u01B6': 'z',
+ '\u0225': 'z',
+ '\u0240': 'z',
+ '\u2C6C': 'z',
+ '\uA763': 'z',
+ '\u0386': '\u0391',
+ '\u0388': '\u0395',
+ '\u0389': '\u0397',
+ '\u038A': '\u0399',
+ '\u03AA': '\u0399',
+ '\u038C': '\u039F',
+ '\u038E': '\u03A5',
+ '\u03AB': '\u03A5',
+ '\u038F': '\u03A9',
+ '\u03AC': '\u03B1',
+ '\u03AD': '\u03B5',
+ '\u03AE': '\u03B7',
+ '\u03AF': '\u03B9',
+ '\u03CA': '\u03B9',
+ '\u0390': '\u03B9',
+ '\u03CC': '\u03BF',
+ '\u03CD': '\u03C5',
+ '\u03CB': '\u03C5',
+ '\u03B0': '\u03C5',
+ '\u03C9': '\u03C9',
+ '\u03C2': '\u03C3'
+ };
+ DataUtil.fnOperators = {
+ /**
+ * Returns true when the actual input is equal to the given input.
+ *
+ * @param {string|number|boolean} actual
+ * @param {string|number|boolean} expected
+ * @param {boolean} ignoreCase?
+ * @param {boolean} ignoreAccent?
+ * @param ignoreCase
+ * @param ignoreAccent
+ */
+ equal: function (actual, expected, ignoreCase, ignoreAccent) {
+ if (ignoreAccent) {
+ actual = DataUtil.ignoreDiacritics(actual);
+ expected = DataUtil.ignoreDiacritics(expected);
+ }
+ if (ignoreCase) {
+ return DataUtil.toLowerCase(actual) === DataUtil.toLowerCase(expected);
+ }
+ return actual === expected;
+ },
+ /**
+ * Returns true when the actual input is not equal to the given input.
+ *
+ * @param {string|number|boolean} actual
+ * @param {string|number|boolean} expected
+ * @param {boolean} ignoreCase?
+ * @param ignoreCase
+ * @param ignoreAccent
+ */
+ notequal: function (actual, expected, ignoreCase, ignoreAccent) {
+ if (ignoreAccent) {
+ actual = DataUtil.ignoreDiacritics(actual);
+ expected = DataUtil.ignoreDiacritics(expected);
+ }
+ return !DataUtil.fnOperators.equal(actual, expected, ignoreCase);
+ },
+ /**
+ * Returns true when the actual input is less than to the given input.
+ *
+ * @param {string|number|boolean} actual
+ * @param {string|number|boolean} expected
+ * @param {boolean} ignoreCase?
+ * @param ignoreCase
+ */
+ lessthan: function (actual, expected, ignoreCase) {
+ if (ignoreCase) {
+ return DataUtil.toLowerCase(actual) < DataUtil.toLowerCase(expected);
+ }
+ if (Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["isNullOrUndefined"])(actual)) {
+ actual = undefined;
+ }
+ return actual < expected;
+ },
+ /**
+ * Returns true when the actual input is greater than to the given input.
+ *
+ * @param {string|number|boolean} actual
+ * @param {string|number|boolean} expected
+ * @param {boolean} ignoreCase?
+ * @param ignoreCase
+ */
+ greaterthan: function (actual, expected, ignoreCase) {
+ if (ignoreCase) {
+ return DataUtil.toLowerCase(actual) > DataUtil.toLowerCase(expected);
+ }
+ return actual > expected;
+ },
+ /**
+ * Returns true when the actual input is less than or equal to the given input.
+ *
+ * @param {string|number|boolean} actual
+ * @param {string|number|boolean} expected
+ * @param {boolean} ignoreCase?
+ * @param ignoreCase
+ */
+ lessthanorequal: function (actual, expected, ignoreCase) {
+ if (ignoreCase) {
+ return DataUtil.toLowerCase(actual) <= DataUtil.toLowerCase(expected);
+ }
+ if (Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["isNullOrUndefined"])(actual)) {
+ actual = undefined;
+ }
+ return actual <= expected;
+ },
+ /**
+ * Returns true when the actual input is greater than or equal to the given input.
+ *
+ * @param {string|number|boolean} actual
+ * @param {string|number|boolean} expected
+ * @param {boolean} ignoreCase?
+ * @param ignoreCase
+ */
+ greaterthanorequal: function (actual, expected, ignoreCase) {
+ if (ignoreCase) {
+ return DataUtil.toLowerCase(actual) >= DataUtil.toLowerCase(expected);
+ }
+ return actual >= expected;
+ },
+ /**
+ * Returns true when the actual input contains the given string.
+ *
+ * @param {string|number} actual
+ * @param {string|number} expected
+ * @param {boolean} ignoreCase?
+ * @param ignoreCase
+ * @param ignoreAccent
+ */
+ contains: function (actual, expected, ignoreCase, ignoreAccent) {
+ if (ignoreAccent) {
+ actual = DataUtil.ignoreDiacritics(actual);
+ expected = DataUtil.ignoreDiacritics(expected);
+ }
+ if (ignoreCase) {
+ return !Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["isNullOrUndefined"])(actual) && !Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["isNullOrUndefined"])(expected) &&
+ DataUtil.toLowerCase(actual).indexOf(DataUtil.toLowerCase(expected)) !== -1;
+ }
+ return !Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["isNullOrUndefined"])(actual) && !Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["isNullOrUndefined"])(expected) &&
+ actual.toString().indexOf(expected) !== -1;
+ },
+ /**
+ * Returns true when the actual input not contains the given string.
+ *
+ * @param {string|number} actual
+ * @param {string|number} expected
+ * @param {boolean} ignoreCase?
+ */
+ doesnotcontain: function (actual, expected, ignoreCase, ignoreAccent) {
+ if (ignoreAccent) {
+ actual = DataUtil.ignoreDiacritics(actual);
+ expected = DataUtil.ignoreDiacritics(expected);
+ }
+ if (ignoreCase) {
+ return !Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["isNullOrUndefined"])(actual) && !Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["isNullOrUndefined"])(expected) &&
+ DataUtil.toLowerCase(actual).indexOf(DataUtil.toLowerCase(expected)) === -1;
+ }
+ return !Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["isNullOrUndefined"])(actual) && !Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["isNullOrUndefined"])(expected) &&
+ actual.toString().indexOf(expected) === -1;
+ },
+ /**
+ * Returns true when the given input value is not null.
+ *
+ * @param {string|number} actual
+ * @returns boolean
+ */
+ isnotnull: function (actual) {
+ return actual !== null && actual !== undefined;
+ },
+ /**
+ * Returns true when the given input value is null.
+ *
+ * @param {string|number} actual
+ * @returns boolean
+ */
+ isnull: function (actual) {
+ return actual === null || actual === undefined;
+ },
+ /**
+ * Returns true when the actual input starts with the given string
+ *
+ * @param {string} actual
+ * @param {string} expected
+ * @param {boolean} ignoreCase?
+ * @param ignoreCase
+ * @param ignoreAccent
+ */
+ startswith: function (actual, expected, ignoreCase, ignoreAccent) {
+ if (ignoreAccent) {
+ actual = DataUtil.ignoreDiacritics(actual);
+ expected = DataUtil.ignoreDiacritics(expected);
+ }
+ if (ignoreCase) {
+ return actual && expected && DataUtil.startsWith(DataUtil.toLowerCase(actual), DataUtil.toLowerCase(expected));
+ }
+ return actual && expected && DataUtil.startsWith(actual, expected);
+ },
+ /**
+ * Returns true when the actual input not starts with the given string
+ *
+ * @param {string} actual
+ * @param {string} expected
+ * @param {boolean} ignoreCase?
+ */
+ doesnotstartwith: function (actual, expected, ignoreCase, ignoreAccent) {
+ if (ignoreAccent) {
+ actual = DataUtil.ignoreDiacritics(actual);
+ expected = DataUtil.ignoreDiacritics(expected);
+ }
+ if (ignoreCase) {
+ return actual && expected && DataUtil.notStartsWith(DataUtil.toLowerCase(actual), DataUtil.toLowerCase(expected));
+ }
+ return actual && expected && DataUtil.notStartsWith(actual, expected);
+ },
+ /**
+ * Returns true when the actual input like with the given string.
+ *
+ * @param {string} actual
+ * @param {string} expected
+ * @param {boolean} ignoreCase?
+ */
+ like: function (actual, expected, ignoreCase, ignoreAccent) {
+ if (ignoreAccent) {
+ actual = DataUtil.ignoreDiacritics(actual);
+ expected = DataUtil.ignoreDiacritics(expected);
+ }
+ if (ignoreCase) {
+ return actual && expected && DataUtil.like(DataUtil.toLowerCase(actual), DataUtil.toLowerCase(expected));
+ }
+ return actual && expected && DataUtil.like(actual, expected);
+ },
+ /**
+ * Returns true when the given input value is empty.
+ *
+ * @param {string|number} actual
+ * @returns boolean
+ */
+ isempty: function (actual) {
+ return actual === undefined || actual === '';
+ },
+ /**
+ * Returns true when the given input value is not empty.
+ *
+ * @param {string|number} actual
+ * @returns boolean
+ */
+ isnotempty: function (actual) {
+ return actual !== undefined && actual !== '';
+ },
+ /**
+ * Returns true when the actual input pattern(wildcard) matches with the given string.
+ *
+ * @param {string|Date} actual
+ * @param {string} expected
+ * @param {boolean} ignoreCase?
+ */
+ wildcard: function (actual, expected, ignoreCase, ignoreAccent) {
+ if (ignoreAccent) {
+ actual = DataUtil.ignoreDiacritics(actual);
+ expected = DataUtil.ignoreDiacritics(expected);
+ }
+ if (ignoreCase) {
+ return (actual || typeof actual === 'boolean') && expected && typeof actual !== 'object' &&
+ DataUtil.wildCard(DataUtil.toLowerCase(actual), DataUtil.toLowerCase(expected));
+ }
+ return (actual || typeof actual === 'boolean') && expected && DataUtil.wildCard(actual, expected);
+ },
+ /**
+ * Returns true when the actual input ends with the given string.
+ *
+ * @param {string} actual
+ * @param {string} expected
+ * @param {boolean} ignoreCase?
+ * @param ignoreCase
+ * @param ignoreAccent
+ */
+ endswith: function (actual, expected, ignoreCase, ignoreAccent) {
+ if (ignoreAccent) {
+ actual = DataUtil.ignoreDiacritics(actual);
+ expected = DataUtil.ignoreDiacritics(expected);
+ }
+ if (ignoreCase) {
+ return actual && expected && DataUtil.endsWith(DataUtil.toLowerCase(actual), DataUtil.toLowerCase(expected));
+ }
+ return actual && expected && DataUtil.endsWith(actual, expected);
+ },
+ /**
+ * Returns true when the actual input not ends with the given string.
+ *
+ * @param {string} actual
+ * @param {string} expected
+ * @param {boolean} ignoreCase?
+ */
+ doesnotendwith: function (actual, expected, ignoreCase, ignoreAccent) {
+ if (ignoreAccent) {
+ actual = DataUtil.ignoreDiacritics(actual);
+ expected = DataUtil.ignoreDiacritics(expected);
+ }
+ if (ignoreCase) {
+ return actual && expected && DataUtil.notEndsWith(DataUtil.toLowerCase(actual), DataUtil.toLowerCase(expected));
+ }
+ return actual && expected && DataUtil.notEndsWith(actual, expected);
+ },
+ /**
+ * It will return the filter operator based on the filter symbol.
+ *
+ * @param {string} operator
+ * @hidden
+ */
+ processSymbols: function (operator) {
+ var fnName = DataUtil.operatorSymbols[operator];
+ if (fnName) {
+ var fn = DataUtil.fnOperators[fnName];
+ return fn;
+ }
+ return DataUtil.throwError('Query - Process Operator : Invalid operator');
+ },
+ /**
+ * It will return the valid filter operator based on the specified operators.
+ *
+ * @param {string} operator
+ * @hidden
+ */
+ processOperator: function (operator) {
+ var fn = DataUtil.fnOperators[operator];
+ if (fn) {
+ return fn;
+ }
+ return DataUtil.fnOperators.processSymbols(operator);
+ }
+ };
+ /**
+ * To perform the parse operation on JSON data, like convert to string from JSON or convert to JSON from string.
+ */
+ DataUtil.parse = {
+ /**
+ * Parse the given string to the plain JavaScript object.
+ *
+ * @param {string|Object|Object[]} jsonText
+ */
+ parseJson: function (jsonText) {
+ if (typeof jsonText === 'string') {
+ jsonText = JSON.parse(jsonText, DataUtil.parse.jsonReviver);
+ }
+ else if (jsonText instanceof Array) {
+ DataUtil.parse.iterateAndReviveArray(jsonText);
+ }
+ else if (typeof jsonText === 'object' && jsonText !== null) {
+ DataUtil.parse.iterateAndReviveJson(jsonText);
+ }
+ return jsonText;
+ },
+ /**
+ * It will perform on array of values.
+ *
+ * @param {string[]|Object[]} array
+ * @hidden
+ */
+ iterateAndReviveArray: function (array) {
+ for (var i = 0; i < array.length; i++) {
+ if (typeof array[i] === 'object' && array[i] !== null) {
+ DataUtil.parse.iterateAndReviveJson(array[i]);
+ // eslint-disable-next-line no-useless-escape
+ }
+ else if (typeof array[i] === 'string' && !/^[\s]*\[|^[\s]*\{(.)+:|\"/g.test(array[i])) {
+ array[i] = DataUtil.parse.jsonReviver('', array[i]);
+ }
+ else {
+ array[i] = DataUtil.parse.parseJson(array[i]);
+ }
+ }
+ },
+ /**
+ * It will perform on JSON values
+ *
+ * @param {JSON} json
+ * @hidden
+ */
+ iterateAndReviveJson: function (json) {
+ var value;
+ var keys = Object.keys(json);
+ for (var _i = 0, keys_2 = keys; _i < keys_2.length; _i++) {
+ var prop = keys_2[_i];
+ if (DataUtil.startsWith(prop, '__')) {
+ continue;
+ }
+ value = json[prop];
+ if (typeof value === 'object') {
+ if (value instanceof Array) {
+ DataUtil.parse.iterateAndReviveArray(value);
+ }
+ else if (value) {
+ DataUtil.parse.iterateAndReviveJson(value);
+ }
+ }
+ else {
+ json[prop] = DataUtil.parse.jsonReviver(json[prop], value);
+ }
+ }
+ },
+ /**
+ * It will perform on JSON values
+ *
+ * @param {string} field
+ * @param {string|Date} value
+ * @hidden
+ */
+ jsonReviver: function (field, value) {
+ if (typeof value === 'string') {
+ // eslint-disable-next-line security/detect-unsafe-regex
+ var ms = /^\/Date\(([+-]?[0-9]+)([+-][0-9]{4})?\)\/$/.exec(value);
+ var offSet = DataUtil.timeZoneHandling ? DataUtil.serverTimezoneOffset : null;
+ if (ms) {
+ return DataUtil.dateParse.toTimeZone(new Date(parseInt(ms[1], 10)), offSet, true);
+ // eslint-disable-next-line no-useless-escape, security/detect-unsafe-regex
+ }
+ else if (/^(\d{4}\-\d\d\-\d\d([tT][\d:\.]*){1})([zZ]|([+\-])(\d\d):?(\d\d))?$/.test(value)) {
+ var isUTC = value.indexOf('Z') > -1 || value.indexOf('z') > -1;
+ var arr = value.split(/[^0-9.]/);
+ if (isUTC) {
+ if (arr[5].indexOf('.') > -1) {
+ var secondsMs = arr[5].split('.');
+ arr[5] = secondsMs[0];
+ arr[6] = new Date(value).getUTCMilliseconds().toString();
+ }
+ else {
+ arr[6] = '00';
+ }
+ value = DataUtil.dateParse
+ .toTimeZone(new Date(parseInt(arr[0], 10), parseInt(arr[1], 10) - 1, parseInt(arr[2], 10), parseInt(arr[3], 10), parseInt(arr[4], 10), parseInt(arr[5], 10), parseInt(arr[6], 10)), DataUtil.serverTimezoneOffset, false);
+ }
+ else {
+ var utcFormat = new Date(parseInt(arr[0], 10), parseInt(arr[1], 10) - 1, parseInt(arr[2], 10), parseInt(arr[3], 10), parseInt(arr[4], 10), parseInt(arr[5], 10));
+ var hrs = parseInt(arr[6], 10);
+ var mins = parseInt(arr[7], 10);
+ if (isNaN(hrs) && isNaN(mins)) {
+ return utcFormat;
+ }
+ if (value.indexOf('+') > -1) {
+ utcFormat.setHours(utcFormat.getHours() - hrs, utcFormat.getMinutes() - mins);
+ }
+ else {
+ utcFormat.setHours(utcFormat.getHours() + hrs, utcFormat.getMinutes() + mins);
+ }
+ value = DataUtil.dateParse
+ .toTimeZone(utcFormat, DataUtil.serverTimezoneOffset, false);
+ }
+ if (DataUtil.serverTimezoneOffset == null) {
+ value = DataUtil.dateParse.addSelfOffset(value);
+ }
+ }
+ else if (/^\d{4}-\d{2}-\d{2}$/.test(value)) {
+ var arr = value.split(/[^0-9.]/);
+ return new Date(parseInt(arr[0], 10), parseInt(arr[1], 10) - 1, parseInt(arr[2], 10));
+ }
+ }
+ return value;
+ },
+ /**
+ * Check wheather the given value is JSON or not.
+ *
+ * @param {Object[]} jsonData
+ */
+ isJson: function (jsonData) {
+ if (typeof jsonData[0] === 'string') {
+ return jsonData;
+ }
+ return DataUtil.parse.parseJson(jsonData);
+ },
+ /**
+ * Checks wheather the given value is GUID or not.
+ *
+ * @param {string} value
+ */
+ isGuid: function (value) {
+ // eslint-disable-next-line security/detect-unsafe-regex
+ var regex = /[A-Fa-f0-9]{8}(?:-[A-Fa-f0-9]{4}){3}-[A-Fa-f0-9]{12}/i;
+ var match = regex.exec(value);
+ return match != null;
+ },
+ /**
+ * The method used to replace the value based on the type.
+ *
+ * @param {Object} value
+ * @param {boolean} stringify
+ * @hidden
+ */
+ replacer: function (value, stringify) {
+ if (DataUtil.isPlainObject(value)) {
+ return DataUtil.parse.jsonReplacer(value, stringify);
+ }
+ if (value instanceof Array) {
+ return DataUtil.parse.arrayReplacer(value);
+ }
+ if (value instanceof Date) {
+ return DataUtil.parse.jsonReplacer({ val: value }, stringify).val;
+ }
+ return value;
+ },
+ /**
+ * It will replace the JSON value.
+ *
+ * @param {string} key
+ * @param {Object} val
+ * @param stringify
+ * @hidden
+ */
+ jsonReplacer: function (val, stringify) {
+ var value;
+ var keys = Object.keys(val);
+ for (var _i = 0, keys_3 = keys; _i < keys_3.length; _i++) {
+ var prop = keys_3[_i];
+ value = val[prop];
+ if (!(value instanceof Date)) {
+ continue;
+ }
+ var d = value;
+ if (DataUtil.serverTimezoneOffset == null) {
+ val[prop] = DataUtil.dateParse.toTimeZone(d, null).toJSON();
+ }
+ else {
+ d = new Date(+d + DataUtil.serverTimezoneOffset * 3600000);
+ val[prop] = DataUtil.dateParse.toTimeZone(DataUtil.dateParse.addSelfOffset(d), null).toJSON();
+ }
+ }
+ return val;
+ },
+ /**
+ * It will replace the Array of value.
+ *
+ * @param {string} key
+ * @param {Object[]} val
+ * @hidden
+ */
+ arrayReplacer: function (val) {
+ for (var i = 0; i < val.length; i++) {
+ if (DataUtil.isPlainObject(val[i])) {
+ val[i] = DataUtil.parse.jsonReplacer(val[i]);
+ }
+ else if (val[i] instanceof Date) {
+ val[i] = DataUtil.parse.jsonReplacer({ date: val[i] }).date;
+ }
+ }
+ return val;
+ },
+ /**
+ * It will replace the Date object with respective to UTC format value.
+ *
+ * @param {string} key
+ * @param {any} value
+ * @hidden
+ */
+ /* eslint-disable @typescript-eslint/no-explicit-any */
+ /* tslint:disable-next-line:no-any */
+ jsonDateReplacer: function (key, value) {
+ /* eslint-enable @typescript-eslint/no-explicit-any */
+ if (key === 'value' && value) {
+ if (typeof value === 'string') {
+ // eslint-disable-next-line security/detect-unsafe-regex
+ var ms = /^\/Date\(([+-]?[0-9]+)([+-][0-9]{4})?\)\/$/.exec(value);
+ if (ms) {
+ value = DataUtil.dateParse.toTimeZone(new Date(parseInt(ms[1], 10)), null, true);
+ // eslint-disable-next-line no-useless-escape, security/detect-unsafe-regex
+ }
+ else if (/^(\d{4}\-\d\d\-\d\d([tT][\d:\.]*){1})([zZ]|([+\-])(\d\d):?(\d\d))?$/.test(value)) {
+ var arr = value.split(/[^0-9]/);
+ value = DataUtil.dateParse
+ .toTimeZone(new Date(parseInt(arr[0], 10), parseInt(arr[1], 10) - 1, parseInt(arr[2], 10), parseInt(arr[3], 10), parseInt(arr[4], 10), parseInt(arr[5], 10)), null, true);
+ }
+ }
+ if (value instanceof Date) {
+ value = DataUtil.dateParse.addSelfOffset(value);
+ if (DataUtil.serverTimezoneOffset === null) {
+ return DataUtil.dateParse.toTimeZone(DataUtil.dateParse.addSelfOffset(value), null).toJSON();
+ }
+ else {
+ value = DataUtil.dateParse.toTimeZone(value, (((value.getTimezoneOffset() / 60) * 2)
+ - DataUtil.serverTimezoneOffset), false);
+ return value.toJSON();
+ }
+ }
+ }
+ return value;
+ }
+ };
+ /**
+ * @hidden
+ */
+ DataUtil.dateParse = {
+ addSelfOffset: function (input) {
+ return new Date(+input - (input.getTimezoneOffset() * 60000));
+ },
+ toUTC: function (input) {
+ return new Date(+input + (input.getTimezoneOffset() * 60000));
+ },
+ toTimeZone: function (input, offset, utc) {
+ if (offset === null) {
+ return input;
+ }
+ var unix = utc ? DataUtil.dateParse.toUTC(input) : input;
+ return new Date(+unix - (offset * 3600000));
+ },
+ toLocalTime: function (input) {
+ var datefn = input;
+ var timeZone = -datefn.getTimezoneOffset();
+ var differenceString = timeZone >= 0 ? '+' : '-';
+ var localtimefn = function (num) {
+ var norm = Math.floor(Math.abs(num));
+ return (norm < 10 ? '0' : '') + norm;
+ };
+ var val = datefn.getFullYear() + '-' + localtimefn(datefn.getMonth() + 1) + '-' + localtimefn(datefn.getDate()) +
+ 'T' + localtimefn(datefn.getHours()) +
+ ':' + localtimefn(datefn.getMinutes()) +
+ ':' + localtimefn(datefn.getSeconds()) +
+ differenceString + localtimefn(timeZone / 60) +
+ ':' + localtimefn(timeZone % 60);
+ return val;
+ }
+ };
+ return DataUtil;
+}());
+
+
+
+/***/ }),
+
+/***/ "./ej2-resources/22.1.37/scripts/ej2-diagrams/diagram/blazor-tooltip/blazor-Tooltip.js":
+/*!*********************************************************************************************!*\
+ !*** ./ej2-resources/22.1.37/scripts/ej2-diagrams/diagram/blazor-tooltip/blazor-Tooltip.js ***!
+ \*********************************************************************************************/
+/*! exports provided: BlazorAnimation, BlazorTooltip */
+/***/ (function(module, __webpack_exports__, __webpack_require__) {
+
+"use strict";
+__webpack_require__.r(__webpack_exports__);
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "BlazorAnimation", function() { return BlazorAnimation; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "BlazorTooltip", function() { return BlazorTooltip; });
+/* harmony import */ var _ej2_base__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../../ej2-base */ "./ej2-resources/22.1.37/scripts/ej2-base/index.js");
+/* harmony import */ var _position__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./position */ "./ej2-resources/22.1.37/scripts/ej2-diagrams/diagram/blazor-tooltip/position.js");
+/* harmony import */ var _collision__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./collision */ "./ej2-resources/22.1.37/scripts/ej2-diagrams/diagram/blazor-tooltip/collision.js");
+var __extends = (undefined && undefined.__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 = (undefined && undefined.__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;
+};
+/* eslint-disable valid-jsdoc */
+/* eslint-disable jsdoc/require-param */
+/* eslint-disable @typescript-eslint/no-unused-vars */
+/* eslint-disable @typescript-eslint/ban-types */
+
+
+
+
+
+
+/**
+ * Animation options that are common for both open and close actions of the Tooltip
+ *
+ * @private
+ */
+var BlazorAnimation = /** @__PURE__ @class */ (function (_super) {
+ __extends(BlazorAnimation, _super);
+ function BlazorAnimation() {
+ return _super !== null && _super.apply(this, arguments) || this;
+ }
+ __decorate([
+ Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["Property"])({ effect: 'FadeIn', duration: 150, delay: 0 })
+ ], BlazorAnimation.prototype, "open", void 0);
+ __decorate([
+ Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["Property"])({ effect: 'FadeOut', duration: 150, delay: 0 })
+ ], BlazorAnimation.prototype, "close", void 0);
+ return BlazorAnimation;
+}(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["ChildProperty"]));
+
+var SHOW_POINTER_TIP_GAP = 0;
+var HIDE_POINTER_TIP_GAP = 8;
+var POINTER_ADJUST = 2;
+var ROOT = 'e-tooltip';
+var RTL = 'e-rtl';
+var DEVICE = 'e-bigger';
+var CLOSE = 'e-tooltip-close';
+var TOOLTIP_WRAP = 'e-tooltip-wrap';
+var CONTENT = 'e-tip-content';
+var ARROW_TIP = 'e-arrow-tip';
+var ARROW_TIP_OUTER = 'e-arrow-tip-outer';
+var ARROW_TIP_INNER = 'e-arrow-tip-inner';
+var TIP_BOTTOM = 'e-tip-bottom';
+var TIP_TOP = 'e-tip-top';
+var TIP_LEFT = 'e-tip-left';
+var TIP_RIGHT = 'e-tip-right';
+var POPUP_ROOT = 'e-popup';
+var POPUP_OPEN = 'e-popup-open';
+var POPUP_CLOSE = 'e-popup-close';
+var POPUP_LIB = 'e-lib';
+var HIDE_POPUP = 'e-hidden';
+var CLASSNAMES = {
+ ROOT: 'e-popup',
+ RTL: 'e-rtl',
+ OPEN: 'e-popup-open',
+ CLOSE: 'e-popup-close'
+};
+/**
+ * @private
+ */
+var BlazorTooltip = /** @__PURE__ @class */ (function () {
+ function BlazorTooltip(diagram) {
+ this.isBlazorTooltip = false;
+ this.contentEvent = null;
+ /** @private */
+ this.width = 'auto';
+ /** @private */
+ this.height = 'auto';
+ /** @private */
+ this.content = '';
+ /** @private */
+ this.target = '';
+ /** @private */
+ this.position = 'TopCenter';
+ /** @private */
+ this.offsetX = 0;
+ /** @private */
+ this.offsetY = 0;
+ /** @private */
+ this.tipPointerPosition = 'Auto';
+ /** @private */
+ this.openDelay = 0;
+ /** @private */
+ this.closeDelay = 0;
+ /** @private */
+ this.cssClass = '';
+ this.element = diagram;
+ this.tipClass = TIP_BOTTOM;
+ this.tooltipPositionX = 'Center';
+ this.tooltipPositionY = 'Top';
+ this.isHidden = true;
+ this.showTipPointer = true;
+ }
+ /**
+ * @private
+ */
+ BlazorTooltip.prototype.open = function (target, showAnimation, e) {
+ if (Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["isNullOrUndefined"])(this.animation.open)) {
+ this.animation.open = this.element.tooltip && this.element.tooltip.animation &&
+ this.element.tooltip.animation.open;
+ }
+ this.showTooltip(target, showAnimation);
+ };
+ /**
+ * @private
+ */
+ BlazorTooltip.prototype.updateTooltip = function (target) {
+ if (this.tooltipEle) {
+ this.addDescribedBy(target, this.ctrlId + '_content');
+ this.renderContent(target);
+ this.reposition(target);
+ this.adjustArrow(target, this.position, this.tooltipPositionX, this.tooltipPositionY);
+ }
+ };
+ BlazorTooltip.prototype.formatPosition = function () {
+ var _a, _b;
+ if (this.position.indexOf('Top') === 0 || this.position.indexOf('Bottom') === 0) {
+ _a = this.position.split(/(?=[A-Z])/), this.tooltipPositionY = _a[0], this.tooltipPositionX = _a[1];
+ }
+ else {
+ _b = this.position.split(/(?=[A-Z])/), this.tooltipPositionX = _b[0], this.tooltipPositionY = _b[1];
+ }
+ };
+ /**
+ * @private
+ */
+ BlazorTooltip.prototype.destroy = function () {
+ //No code
+ };
+ /**
+ * @private
+ */
+ BlazorTooltip.prototype.close = function () {
+ if (this.tooltipEle) {
+ Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["removeClass"])([this.tooltipEle], POPUP_CLOSE);
+ Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["addClass"])([this.tooltipEle], POPUP_OPEN);
+ _ej2_base__WEBPACK_IMPORTED_MODULE_0__["Animation"].stop(this.tooltipEle);
+ var animationOptions = void 0;
+ // eslint-disable-next-line @typescript-eslint/no-this-alias
+ var currentTooltip_1 = this;
+ currentTooltip_1.isHidden = true;
+ if (this.animation.close) {
+ animationOptions = {
+ name: this.animation.close.effect,
+ duration: this.animation.close.duration || 0,
+ delay: this.animation.close.delay || 0,
+ timingFunction: 'easeOut'
+ };
+ }
+ if (!Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["isNullOrUndefined"])(animationOptions)) {
+ animationOptions.end = function () {
+ if (currentTooltip_1.isHidden) {
+ Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["remove"])(currentTooltip_1.tooltipEle);
+ currentTooltip_1.tooltipEle = null;
+ }
+ };
+ new _ej2_base__WEBPACK_IMPORTED_MODULE_0__["Animation"](animationOptions).animate(this.tooltipEle);
+ }
+ else {
+ Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["removeClass"])([this.tooltipEle], CLASSNAMES.OPEN);
+ Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["addClass"])([this.tooltipEle], CLASSNAMES.CLOSE);
+ Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["remove"])(this.tooltipEle);
+ this.tooltipEle = null;
+ }
+ }
+ };
+ /**
+ * @private
+ */
+ BlazorTooltip.prototype.showTooltip = function (target, showAnimation, e) {
+ var _this = this;
+ clearTimeout(this.showTimer);
+ clearTimeout(this.hideTimer);
+ this.tooltipEventArgs = {
+ type: e ? e.type : null, cancel: false, target: target, event: e ? e : null,
+ element: this.tooltipEle, isInteracted: !Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["isNullOrUndefined"])(e)
+ };
+ var observeCallback = function (beforeRenderArgs) {
+ _this.beforeRenderCallback(beforeRenderArgs, target, e, showAnimation);
+ };
+ this.element.trigger('beforeRender', this.tooltipEventArgs, observeCallback.bind(this));
+ };
+ BlazorTooltip.prototype.beforeRenderCallback = function (beforeRenderArgs, target, e, showAnimation) {
+ this.formatPosition();
+ var isBlazorTooltipRendered = false;
+ if (beforeRenderArgs.cancel) {
+ this.isHidden = true;
+ // this.clear();
+ }
+ else {
+ this.isHidden = false;
+ if (Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["isNullOrUndefined"])(this.tooltipEle)) {
+ this.ctrlId = this.element.element.id;
+ this.tooltipEle = Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["createElement"])('div', {
+ className: TOOLTIP_WRAP + ' ' + POPUP_ROOT + ' ' + POPUP_LIB, attrs: {
+ role: 'tooltip', 'aria-hidden': 'false', 'id': this.ctrlId + '_content'
+ }, styles: 'width:' +
+ Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["formatUnit"])(this.width) + ';height:' + Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["formatUnit"])(this.height) + ';position:absolute; pointer-events:none;'
+ });
+ this.beforeRenderBlazor(target, this);
+ _ej2_base__WEBPACK_IMPORTED_MODULE_0__["Animation"].stop(this.tooltipEle);
+ this.afterRenderBlazor(target, e, showAnimation, this);
+ }
+ else {
+ if (target) {
+ this.addDescribedBy(target, this.ctrlId + '_content');
+ this.renderContent(target);
+ _ej2_base__WEBPACK_IMPORTED_MODULE_0__["Animation"].stop(this.tooltipEle);
+ this.reposition(target);
+ this.afterRenderBlazor(target, e, showAnimation, this);
+ this.adjustArrow(target, this.position, this.tooltipPositionX, this.tooltipPositionY);
+ }
+ }
+ }
+ };
+ BlazorTooltip.prototype.afterRenderBlazor = function (target, e, showAnimation, ctrlObj) {
+ var _this = this;
+ if (target) {
+ Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["removeClass"])([ctrlObj.tooltipEle], POPUP_OPEN);
+ Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["addClass"])([ctrlObj.tooltipEle], POPUP_CLOSE);
+ ctrlObj.tooltipEventArgs = {
+ type: e ? e.type : null, cancel: false, target: target, event: e ? e : null,
+ element: ctrlObj.tooltipEle, isInteracted: !Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["isNullOrUndefined"])(e)
+ };
+ var animation = void 0;
+ if (this.animation.open) {
+ animation = {
+ name: this.animation.open.effect,
+ duration: this.animation.open.duration || 0,
+ delay: this.animation.open.delay || 0,
+ timingFunction: 'easeIn'
+ };
+ }
+ if (!Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["isNullOrUndefined"])(animation)) {
+ animation.begin = function () {
+ Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["removeClass"])([ctrlObj.tooltipEle], CLASSNAMES.CLOSE);
+ Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["addClass"])([ctrlObj.tooltipEle], CLASSNAMES.OPEN);
+ };
+ animation.end = function () {
+ _this.element.trigger('open');
+ };
+ new _ej2_base__WEBPACK_IMPORTED_MODULE_0__["Animation"](animation).animate(this.tooltipEle);
+ }
+ else {
+ Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["removeClass"])([ctrlObj.tooltipEle], POPUP_CLOSE);
+ Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["addClass"])([ctrlObj.tooltipEle], POPUP_OPEN);
+ }
+ }
+ };
+ BlazorTooltip.prototype.setTipClass = function (position) {
+ if (position.indexOf('Right') === 0) {
+ this.tipClass = TIP_LEFT;
+ }
+ else if (position.indexOf('Bottom') === 0) {
+ this.tipClass = TIP_TOP;
+ }
+ else if (position.indexOf('Left') === 0) {
+ this.tipClass = TIP_RIGHT;
+ }
+ else {
+ this.tipClass = TIP_BOTTOM;
+ }
+ };
+ BlazorTooltip.prototype.renderArrow = function () {
+ this.setTipClass(this.position);
+ var tip = Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["createElement"])('div', { className: ARROW_TIP + ' ' + this.tipClass });
+ tip.appendChild(Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["createElement"])('div', { className: ARROW_TIP_OUTER + ' ' + this.tipClass }));
+ tip.appendChild(Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["createElement"])('div', { className: ARROW_TIP_INNER + ' ' + this.tipClass }));
+ this.tooltipEle.appendChild(tip);
+ };
+ BlazorTooltip.prototype.getTooltipPosition = function (target) {
+ this.tooltipEle.style.display = 'block';
+ var pos = Object(_position__WEBPACK_IMPORTED_MODULE_1__["calculatePosition"])(target, this.tooltipPositionX, this.tooltipPositionY);
+ var offsetPos = this.calculateTooltipOffset(this.position);
+ var elePos = this.collisionFlipFit(target, pos.left + offsetPos.left, pos.top + offsetPos.top);
+ this.tooltipEle.style.display = '';
+ return elePos;
+ };
+ BlazorTooltip.prototype.checkCollision = function (target, x, y) {
+ var elePos = {
+ left: x, top: y, position: this.position,
+ horizontal: this.tooltipPositionX, vertical: this.tooltipPositionY
+ };
+ var affectedPos = Object(_collision__WEBPACK_IMPORTED_MODULE_2__["isCollide"])(this.tooltipEle, (this.target ? this.element.element : null), x, y);
+ if (affectedPos.length > 0) {
+ elePos.horizontal = affectedPos.indexOf('left') >= 0 ? 'Right' : affectedPos.indexOf('right') >= 0 ? 'Left' :
+ this.tooltipPositionX;
+ elePos.vertical = affectedPos.indexOf('top') >= 0 ? 'Bottom' : affectedPos.indexOf('bottom') >= 0 ? 'Top' :
+ this.tooltipPositionY;
+ }
+ return elePos;
+ };
+ BlazorTooltip.prototype.collisionFlipFit = function (target, x, y) {
+ var elePos = this.checkCollision(target, x, y);
+ var newpos = elePos.position;
+ if (this.tooltipPositionY !== elePos.vertical) {
+ newpos = ((this.position.indexOf('Bottom') === 0 || this.position.indexOf('Top') === 0) ?
+ elePos.vertical + this.tooltipPositionX : this.tooltipPositionX + elePos.vertical);
+ }
+ if (this.tooltipPositionX !== elePos.horizontal) {
+ if (newpos.indexOf('Left') === 0) {
+ elePos.vertical = (newpos === 'LeftTop' || newpos === 'LeftCenter') ? 'Top' : 'Bottom';
+ newpos = (elePos.vertical + 'Left');
+ }
+ if (newpos.indexOf('Right') === 0) {
+ elePos.vertical = (newpos === 'RightTop' || newpos === 'RightCenter') ? 'Top' : 'Bottom';
+ newpos = (elePos.vertical + 'Right');
+ }
+ elePos.horizontal = this.tooltipPositionX;
+ }
+ this.tooltipEventArgs = {
+ type: null, cancel: false, target: target, event: null,
+ element: this.tooltipEle, collidedPosition: newpos
+ };
+ this.element.trigger('beforeCollision', this.tooltipEventArgs);
+ if (elePos.position !== newpos) {
+ var pos = Object(_position__WEBPACK_IMPORTED_MODULE_1__["calculatePosition"])(target, elePos.horizontal, elePos.vertical);
+ this.adjustArrow(target, newpos, elePos.horizontal, elePos.vertical);
+ var offsetPos = this.calculateTooltipOffset(newpos);
+ offsetPos.top -= (('TopBottom'.indexOf(this.position.split(/(?=[A-Z])/)[0]) !== -1) &&
+ ('TopBottom'.indexOf(newpos.split(/(?=[A-Z])/)[0]) !== -1)) ? (2 * this.offsetY) : 0;
+ offsetPos.left -= (('RightLeft'.indexOf(this.position.split(/(?=[A-Z])/)[0]) !== -1) &&
+ ('RightLeft'.indexOf(newpos.split(/(?=[A-Z])/)[0]) !== -1)) ? (2 * this.offsetX) : 0;
+ elePos.position = newpos;
+ elePos.left = pos.left + offsetPos.left;
+ elePos.top = pos.top + offsetPos.top;
+ }
+ else {
+ this.adjustArrow(target, newpos, elePos.horizontal, elePos.vertical);
+ }
+ var eleOffset = { left: elePos.left, top: elePos.top };
+ var left = Object(_collision__WEBPACK_IMPORTED_MODULE_2__["fit"])(this.tooltipEle, (this.target ? this.element.element : null), { X: true, Y: false }, eleOffset).left;
+ this.tooltipEle.style.display = 'block';
+ if (this.showTipPointer && (newpos.indexOf('Bottom') === 0 || newpos.indexOf('Top') === 0)) {
+ var arrowEle = this.tooltipEle.querySelector('.' + ARROW_TIP);
+ var arrowleft = parseInt(arrowEle.style.left, 10) - (left - elePos.left);
+ if (arrowleft < 0) {
+ arrowleft = 0;
+ }
+ else if ((arrowleft + arrowEle.offsetWidth) > this.tooltipEle.clientWidth) {
+ arrowleft = this.tooltipEle.clientWidth - arrowEle.offsetWidth;
+ }
+ arrowEle.style.left = arrowleft.toString() + 'px';
+ }
+ this.tooltipEle.style.display = '';
+ eleOffset.left = left;
+ return eleOffset;
+ };
+ BlazorTooltip.prototype.calculateTooltipOffset = function (position) {
+ var pos = { top: 0, left: 0 };
+ var tooltipEleWidth = this.tooltipEle.offsetWidth;
+ var tooltipEleHeight = this.tooltipEle.offsetHeight;
+ var arrowEle = this.tooltipEle.querySelector('.' + ARROW_TIP);
+ var tipWidth = arrowEle ? arrowEle.offsetWidth : 0;
+ var tipHeight = arrowEle ? arrowEle.offsetHeight : 0;
+ var tipAdjust = (this.showTipPointer ? SHOW_POINTER_TIP_GAP : HIDE_POINTER_TIP_GAP);
+ var tipHeightAdjust = (tipHeight / 2) + POINTER_ADJUST + (this.tooltipEle.offsetHeight - this.tooltipEle.clientHeight);
+ var tipWidthAdjust = (tipWidth / 2) + POINTER_ADJUST + (this.tooltipEle.offsetWidth - this.tooltipEle.clientWidth);
+ switch (position) {
+ case 'RightTop':
+ pos.left += tipWidth + tipAdjust;
+ pos.top -= tooltipEleHeight - tipHeightAdjust;
+ break;
+ case 'RightCenter':
+ pos.left += tipWidth + tipAdjust;
+ pos.top -= (tooltipEleHeight / 2);
+ break;
+ case 'RightBottom':
+ pos.left += tipWidth + tipAdjust;
+ pos.top -= (tipHeightAdjust);
+ break;
+ case 'BottomRight':
+ pos.top += (tipHeight + tipAdjust);
+ pos.left -= (tipWidthAdjust);
+ break;
+ case 'BottomCenter':
+ pos.top += (tipHeight + tipAdjust);
+ pos.left -= (tooltipEleWidth / 2);
+ break;
+ case 'BottomLeft':
+ pos.top += (tipHeight + tipAdjust);
+ pos.left -= (tooltipEleWidth - tipWidthAdjust);
+ break;
+ case 'LeftBottom':
+ pos.left -= (tipWidth + tooltipEleWidth + tipAdjust);
+ pos.top -= (tipHeightAdjust);
+ break;
+ case 'LeftCenter':
+ pos.left -= (tipWidth + tooltipEleWidth + tipAdjust);
+ pos.top -= (tooltipEleHeight / 2);
+ break;
+ case 'LeftTop':
+ pos.left -= (tipWidth + tooltipEleWidth + tipAdjust);
+ pos.top -= (tooltipEleHeight - tipHeightAdjust);
+ break;
+ case 'TopLeft':
+ pos.top -= (tooltipEleHeight + tipHeight + tipAdjust);
+ pos.left -= (tooltipEleWidth - tipWidthAdjust);
+ break;
+ case 'TopRight':
+ pos.top -= (tooltipEleHeight + tipHeight + tipAdjust);
+ pos.left -= (tipWidthAdjust);
+ break;
+ default:
+ pos.top -= (tooltipEleHeight + tipHeight + tipAdjust);
+ pos.left -= (tooltipEleWidth / 2);
+ break;
+ }
+ pos.left += this.offsetX;
+ pos.top += this.offsetY;
+ return pos;
+ };
+ BlazorTooltip.prototype.reposition = function (target) {
+ var elePos = this.getTooltipPosition(target);
+ this.tooltipEle.style.left = elePos.left + 'px';
+ this.tooltipEle.style.top = elePos.top + 'px';
+ };
+ BlazorTooltip.prototype.beforeRenderBlazor = function (target, ctrlObj) {
+ if (target) {
+ if (_ej2_base__WEBPACK_IMPORTED_MODULE_0__["Browser"].isDevice) {
+ Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["addClass"])([ctrlObj.tooltipEle], DEVICE);
+ }
+ if (ctrlObj.width !== 'auto') {
+ ctrlObj.tooltipEle.style.maxWidth = Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["formatUnit"])(ctrlObj.width);
+ }
+ ctrlObj.tooltipEle.appendChild(Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["createElement"])('div', { className: CONTENT + ' ' + 'e-diagramTooltip-content' }));
+ document.body.appendChild(ctrlObj.tooltipEle);
+ Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["addClass"])([ctrlObj.tooltipEle], POPUP_OPEN);
+ Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["removeClass"])([ctrlObj.tooltipEle], HIDE_POPUP);
+ ctrlObj.addDescribedBy(target, ctrlObj.ctrlId + '_content');
+ ctrlObj.renderContent(target);
+ Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["addClass"])([ctrlObj.tooltipEle], POPUP_OPEN);
+ if (this.showTipPointer) {
+ ctrlObj.renderArrow();
+ }
+ var elePos = this.getTooltipPosition(target);
+ this.tooltipEle.classList.remove(POPUP_LIB);
+ this.tooltipEle.style.left = elePos.left + 'px';
+ this.tooltipEle.style.top = elePos.top + 'px';
+ ctrlObj.reposition(target);
+ ctrlObj.adjustArrow(target, ctrlObj.position, ctrlObj.tooltipPositionX, ctrlObj.tooltipPositionY);
+ }
+ };
+ BlazorTooltip.prototype.addDescribedBy = function (target, id) {
+ var describedby = (target.getAttribute('aria-describedby') || '').split(/\s+/);
+ if (describedby.indexOf(id) < 0) {
+ describedby.push(id);
+ }
+ Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["attributes"])(target, { 'aria-describedby': describedby.join(' ').trim(), 'data-tooltip-id': id });
+ };
+ BlazorTooltip.prototype.renderContent = function (target) {
+ var tooltipContent = this.tooltipEle.querySelector('.' + CONTENT);
+ if (this.cssClass) {
+ Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["addClass"])([this.tooltipEle], this.cssClass.split(' '));
+ }
+ if (target && !Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["isNullOrUndefined"])(target.getAttribute('title'))) {
+ target.setAttribute('data-content', target.getAttribute('title'));
+ target.removeAttribute('title');
+ }
+ if (!Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["isNullOrUndefined"])(this.content)) {
+ if (this.isBlazorTooltip || !(false)) {
+ tooltipContent.innerHTML = '';
+ if (this.content instanceof HTMLElement) {
+ tooltipContent.appendChild(this.content);
+ }
+ else if (typeof this.content === 'string' && this.content.indexOf('e-inherit CSS class to inherit the background and color from AppBar.
+ */
+var AppBar = /** @__PURE__ @class */ (function (_super) {
+ __extends(AppBar, _super);
+ /**
+ * Constructor for creating the AppBar widget
+ *
+ * @param {AppBarModel} options Accepts the AppBar model properties to initiate the rendering
+ * @param {string | HTMLElement} element Accepts the DOM element reference
+ */
+ function AppBar(options, element) {
+ return _super.call(this, options, element) || this;
+ }
+ /**
+ * Removes the control from the DOM and also removes all its related events.
+ *
+ * @returns {void}
+ */
+ AppBar.prototype.destroy = function () {
+ _super.prototype.destroy.call(this);
+ this.element.classList.remove(CLS_APPBAR);
+ this.element.removeAttribute('style');
+ this.element.removeAttribute('role');
+ };
+ AppBar.prototype.getModuleName = function () {
+ return 'appbar';
+ };
+ AppBar.prototype.getPersistData = function () {
+ return this.addOnPersist([]);
+ };
+ AppBar.prototype.preRender = function () {
+ // pre render code
+ };
+ AppBar.prototype.render = function () {
+ if (this.element.tagName !== 'HEADER') {
+ this.element.setAttribute('role', 'header');
+ }
+ if (this.cssClass) {
+ Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["addClass"])([this.element], this.cssClass.split(' '));
+ }
+ if (this.position === 'Bottom') {
+ this.element.classList.add(CLS_HORIZONTAL_BOTTOM);
+ }
+ if (this.isSticky) {
+ this.element.classList.add(CLS_STICKY);
+ }
+ if (this.enableRtl) {
+ this.element.classList.add(CLS_RTL);
+ }
+ this.setHeightMode();
+ this.setColorMode();
+ if (!Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["isNullOrUndefined"])(this.htmlAttributes)) {
+ this.setHtmlAttributes(this.htmlAttributes, this.element);
+ }
+ };
+ AppBar.prototype.onPropertyChanged = function (newProp, oldProp) {
+ for (var _i = 0, _a = Object.keys(newProp); _i < _a.length; _i++) {
+ var prop = _a[_i];
+ switch (prop) {
+ case 'mode':
+ Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["removeClass"])([this.element], [CLS_DENSE, CLS_PROMINENT]);
+ this.setHeightMode();
+ break;
+ case 'position':
+ if (this.position === 'Bottom') {
+ Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["addClass"])([this.element], CLS_HORIZONTAL_BOTTOM);
+ }
+ else {
+ Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["removeClass"])([this.element], CLS_HORIZONTAL_BOTTOM);
+ }
+ break;
+ case 'cssClass':
+ if (oldProp.cssClass) {
+ Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["removeClass"])([this.element], oldProp.cssClass.split(' '));
+ }
+ if (newProp.cssClass) {
+ Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["addClass"])([this.element], newProp.cssClass.split(' '));
+ }
+ break;
+ case 'isSticky':
+ if (this.isSticky) {
+ Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["addClass"])([this.element], CLS_STICKY);
+ }
+ else {
+ Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["removeClass"])([this.element], CLS_STICKY);
+ }
+ break;
+ case 'htmlAttributes':
+ if (!Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["isNullOrUndefined"])(this.htmlAttributes)) {
+ if (!Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["isNullOrUndefined"])(oldProp.htmlAttributes)) {
+ var keys = Object.keys(oldProp.htmlAttributes);
+ for (var _b = 0, keys_1 = keys; _b < keys_1.length; _b++) {
+ var key = keys_1[_b];
+ if (key === 'class') {
+ Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["removeClass"])([this.element], oldProp.htmlAttributes["" + key]);
+ }
+ else {
+ this.element.removeAttribute(key);
+ }
+ }
+ }
+ this.setHtmlAttributes(newProp.htmlAttributes, this.element);
+ }
+ break;
+ case 'colorMode':
+ Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["removeClass"])([this.element], [CLS_DARK, CLS_PRIMARY, CLS_INHERIT, CLS_LIGHT]);
+ this.setColorMode();
+ break;
+ case 'enableRtl':
+ if (this.enableRtl) {
+ Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["addClass"])([this.element], CLS_RTL);
+ }
+ else {
+ Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["removeClass"])([this.element], CLS_RTL);
+ }
+ break;
+ }
+ }
+ };
+ AppBar.prototype.setHtmlAttributes = function (attribute, element) {
+ var keys = Object.keys(attribute);
+ for (var _i = 0, keys_2 = keys; _i < keys_2.length; _i++) {
+ var key = keys_2[_i];
+ if (key === 'class') {
+ Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["addClass"])([element], attribute["" + key]);
+ }
+ else {
+ element.setAttribute(key, attribute["" + key]);
+ }
+ }
+ };
+ AppBar.prototype.setHeightMode = function () {
+ if (this.mode === 'Prominent') {
+ this.element.classList.add(CLS_PROMINENT);
+ }
+ else if (this.mode === 'Dense') {
+ this.element.classList.add(CLS_DENSE);
+ }
+ };
+ AppBar.prototype.setColorMode = function () {
+ switch (this.colorMode) {
+ case 'Light':
+ this.element.classList.add(CLS_LIGHT);
+ break;
+ case 'Dark':
+ this.element.classList.add(CLS_DARK);
+ break;
+ case 'Primary':
+ this.element.classList.add(CLS_PRIMARY);
+ break;
+ case 'Inherit':
+ this.element.classList.add(CLS_INHERIT);
+ break;
+ }
+ };
+ __decorate([
+ Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["Property"])('Regular')
+ ], AppBar.prototype, "mode", void 0);
+ __decorate([
+ Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["Property"])('Top')
+ ], AppBar.prototype, "position", void 0);
+ __decorate([
+ Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["Property"])()
+ ], AppBar.prototype, "cssClass", void 0);
+ __decorate([
+ Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["Property"])(false)
+ ], AppBar.prototype, "isSticky", void 0);
+ __decorate([
+ Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["Property"])()
+ ], AppBar.prototype, "htmlAttributes", void 0);
+ __decorate([
+ Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["Property"])('Light')
+ ], AppBar.prototype, "colorMode", void 0);
+ __decorate([
+ Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["Event"])()
+ ], AppBar.prototype, "created", void 0);
+ __decorate([
+ Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["Event"])()
+ ], AppBar.prototype, "destroyed", void 0);
+ AppBar = __decorate([
+ _ej2_base__WEBPACK_IMPORTED_MODULE_0__["NotifyPropertyChanges"]
+ ], AppBar);
+ return AppBar;
+}(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["Component"]));
+
+
+
+/***/ }),
+
+/***/ "./ej2-resources/22.1.37/scripts/ej2-navigations/appbar/index.js":
+/*!***********************************************************************!*\
+ !*** ./ej2-resources/22.1.37/scripts/ej2-navigations/appbar/index.js ***!
+ \***********************************************************************/
+/*! exports provided: AppBar */
+/***/ (function(module, __webpack_exports__, __webpack_require__) {
+
+"use strict";
+__webpack_require__.r(__webpack_exports__);
+/* harmony import */ var _appbar__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./appbar */ "./ej2-resources/22.1.37/scripts/ej2-navigations/appbar/appbar.js");
+/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "AppBar", function() { return _appbar__WEBPACK_IMPORTED_MODULE_0__["AppBar"]; });
+
+/** AppBar export modules */
+
+
+
+/***/ }),
+
+/***/ "./ej2-resources/22.1.37/scripts/ej2-navigations/breadcrumb/breadcrumb.js":
+/*!********************************************************************************!*\
+ !*** ./ej2-resources/22.1.37/scripts/ej2-navigations/breadcrumb/breadcrumb.js ***!
+ \********************************************************************************/
+/*! exports provided: BreadcrumbOverflowMode, BreadcrumbItem, Breadcrumb */
+/***/ (function(module, __webpack_exports__, __webpack_require__) {
+
+"use strict";
+__webpack_require__.r(__webpack_exports__);
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "BreadcrumbOverflowMode", function() { return BreadcrumbOverflowMode; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "BreadcrumbItem", function() { return BreadcrumbItem; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Breadcrumb", function() { return Breadcrumb; });
+/* harmony import */ var _ej2_base__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../ej2-base */ "./ej2-resources/22.1.37/scripts/ej2-base/index.js");
+/* harmony import */ var _ej2_lists__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../ej2-lists */ "./ej2-resources/22.1.37/scripts/ej2-lists/index.js");
+/* harmony import */ var _ej2_popups__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../ej2-popups */ "./ej2-resources/22.1.37/scripts/ej2-popups/index.js");
+var __extends = (undefined && undefined.__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 = (undefined && undefined.__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 ICONRIGHT = 'e-icon-right';
+var ITEMTEXTCLASS = 'e-breadcrumb-text';
+var ICONCLASS = 'e-breadcrumb-icon';
+var MENUCLASS = 'e-breadcrumb-menu';
+var ITEMCLASS = 'e-breadcrumb-item';
+var POPUPCLASS = 'e-breadcrumb-popup';
+var WRAPMODECLASS = 'e-breadcrumb-wrap-mode';
+var SCROLLMODECLASS = 'e-breadcrumb-scroll-mode';
+var TABINDEX = 'tabindex';
+var DISABLEDCLASS = 'e-disabled';
+var ARIADISABLED = 'aria-disabled';
+var DOT = '.';
+/**
+ * Defines the Breadcrumb overflow modes.
+ */
+var BreadcrumbOverflowMode;
+(function (BreadcrumbOverflowMode) {
+ /**
+ * Hidden mode shows the maximum number of items possible in the container space and hides the remaining items.
+ * Clicking on a previous item will make the hidden item visible.
+ */
+ BreadcrumbOverflowMode["Hidden"] = "Hidden";
+ /**
+ * Collapsed mode shows the first and last Breadcrumb items and hides the remaining items with a collapsed icon.
+ * When the collapsed icon is clicked, all items become visible and navigable.
+ */
+ BreadcrumbOverflowMode["Collapsed"] = "Collapsed";
+ /**
+ * Menu mode shows the number of Breadcrumb items that can be accommodated within the container space and creates a submenu with the remaining items.
+ */
+ BreadcrumbOverflowMode["Menu"] = "Menu";
+ /**
+ * Wrap mode wraps the items to multiple lines when the Breadcrumb’s width exceeds the container space.
+ */
+ BreadcrumbOverflowMode["Wrap"] = "Wrap";
+ /**
+ * Scroll mode shows an HTML scroll bar when the Breadcrumb’s width exceeds the container space.
+ */
+ BreadcrumbOverflowMode["Scroll"] = "Scroll";
+ /**
+ * None mode shows all the items in a single line.
+ */
+ BreadcrumbOverflowMode["None"] = "None";
+})(BreadcrumbOverflowMode || (BreadcrumbOverflowMode = {}));
+var BreadcrumbItem = /** @__PURE__ @class */ (function (_super) {
+ __extends(BreadcrumbItem, _super);
+ function BreadcrumbItem() {
+ return _super !== null && _super.apply(this, arguments) || this;
+ }
+ __decorate([
+ Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["Property"])('')
+ ], BreadcrumbItem.prototype, "text", void 0);
+ __decorate([
+ Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["Property"])('')
+ ], BreadcrumbItem.prototype, "url", void 0);
+ __decorate([
+ Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["Property"])(null)
+ ], BreadcrumbItem.prototype, "iconCss", void 0);
+ __decorate([
+ Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["Property"])(false)
+ ], BreadcrumbItem.prototype, "disabled", void 0);
+ return BreadcrumbItem;
+}(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["ChildProperty"]));
+
+/**
+ * Breadcrumb is a graphical user interface that helps to identify or highlight the current location within a hierarchical structure of websites.
+ * The aim is to make the user aware of their current position in a hierarchy of website links.
+ * ```html
+ *
+ * ```
+ * ```typescript
+ *
+ * ```
+ */
+var Breadcrumb = /** @__PURE__ @class */ (function (_super) {
+ __extends(Breadcrumb, _super);
+ /**
+ * Constructor for creating the widget.
+ *
+ * @private
+ * @param {BreadcrumbModel} options - Specifies the Breadcrumb model.
+ * @param {string | HTMLElement} element - Specifies the element.
+ */
+ function Breadcrumb(options, element) {
+ var _this = _super.call(this, options, element) || this;
+ _this.isPopupCreated = false;
+ return _this;
+ }
+ /**
+ * @private
+ * @returns {void}
+ */
+ Breadcrumb.prototype.preRender = function () {
+ // pre render code
+ };
+ /**
+ * Initialize the control rendering.
+ *
+ * @private
+ * @returns {void}
+ */
+ Breadcrumb.prototype.render = function () {
+ this.initialize();
+ this.renderItems(this.items);
+ this.wireEvents();
+ };
+ Breadcrumb.prototype.initialize = function () {
+ this._maxItems = this.maxItems;
+ this.element.setAttribute('aria-label', 'breadcrumb');
+ if (this.cssClass) {
+ Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["addClass"])([this.element], this.cssClass.replace(/\s+/g, ' ').trim().split(' '));
+ }
+ if (this.enableRtl) {
+ this.element.classList.add('e-rtl');
+ }
+ if (this.disabled) {
+ this.element.classList.add(DISABLEDCLASS);
+ this.element.setAttribute(ARIADISABLED, 'true');
+ }
+ if (this.overflowMode === 'Wrap') {
+ this.element.classList.add(WRAPMODECLASS);
+ }
+ else if (this.overflowMode === 'Scroll') {
+ this.element.classList.add(SCROLLMODECLASS);
+ }
+ this.initItems();
+ this.initPvtProps();
+ };
+ Breadcrumb.prototype.initPvtProps = function () {
+ if (this.overflowMode === 'Hidden' && this._maxItems > 0) {
+ this.endIndex = this.getEndIndex();
+ this.startIndex = this.endIndex + 1 - (this._maxItems - 1);
+ }
+ if (this.overflowMode === 'Menu') {
+ if (this._maxItems >= 0) {
+ this.startIndex = this._maxItems > 1 ? 1 : 0;
+ this.endIndex = this.getEndIndex();
+ this.popupUl = this.createElement('ul', { attrs: { TABINDEX: '0', 'role': 'menu' } });
+ }
+ else {
+ this.startIndex = this.endIndex = null;
+ }
+ }
+ };
+ Breadcrumb.prototype.getEndIndex = function () {
+ var _this = this;
+ var endIndex;
+ if (this.activeItem) {
+ this.items.forEach(function (item, idx) {
+ if (item.url === _this.activeItem || item.text === _this.activeItem) {
+ endIndex = idx;
+ }
+ });
+ }
+ else {
+ endIndex = this.items.length - 1;
+ }
+ return endIndex;
+ };
+ Breadcrumb.prototype.initItems = function () {
+ if (!this.items.length) {
+ var baseUri = void 0;
+ var uri = void 0;
+ var items = [];
+ if (this.url) {
+ var url = new URL(this.url, window.location.origin);
+ baseUri = url.origin + '/';
+ uri = url.href.split(baseUri)[1].split('/');
+ }
+ else {
+ baseUri = window.location.origin + '/';
+ uri = window.location.href.split(baseUri)[1].split('/');
+ }
+ items.push({ iconCss: 'e-icons e-home', url: baseUri });
+ for (var i = 0; i < uri.length; i++) {
+ if (uri[i]) {
+ items.push({ text: uri[i], url: baseUri + uri[i] });
+ baseUri += uri[i] + '/';
+ }
+ }
+ this.setProperties({ items: items }, true);
+ }
+ };
+ Breadcrumb.prototype.renderItems = function (items) {
+ var _this = this;
+ var item;
+ var isSingleLevel;
+ var isIconRight = this.element.classList.contains(ICONRIGHT);
+ var itemsLength = items.length;
+ if (itemsLength) {
+ var isActiveItem = void 0;
+ var isLastItem = void 0;
+ var isLastItemInPopup_1;
+ var j_1 = 0;
+ var wrapDiv = void 0;
+ var len = (itemsLength * 2) - 1;
+ var isItemCancelled_1 = false;
+ var ol = this.createElement('ol', { className: this.overflowMode === 'Wrap' ? 'e-breadcrumb-wrapped-ol' : '' });
+ var firstOl = this.createElement('ol', { className: this.overflowMode === 'Wrap' ? 'e-breadcrumb-first-ol' : '' });
+ var showIcon = this.hasField(items, 'iconCss');
+ var isCollasped = (this.overflowMode === 'Collapsed' && this._maxItems > 0 && itemsLength > this._maxItems && !this.isExpanded);
+ var isDefaultOverflowMode_1 = (this.overflowMode === 'Hidden' && this._maxItems > 0);
+ if (this.overflowMode === 'Menu' && this.popupUl) {
+ this.popupUl.innerHTML = '';
+ }
+ var listBaseOptions = {
+ moduleName: this.getModuleName(),
+ showIcon: showIcon,
+ itemNavigable: true,
+ itemCreated: function (args) {
+ var isLastItem = args.curData.isLastItem;
+ if (isLastItem && args.item.children.length && !_this.itemTemplate) {
+ delete args.curData.isLastItem;
+ if (!isLastItemInPopup_1 && !_this.enableActiveItemNavigation) {
+ args.item.innerHTML = _this.createElement('span', { className: ITEMTEXTCLASS, innerHTML: args.item.children[0].innerHTML }).outerHTML;
+ }
+ }
+ if (args.curData.iconCss && !args.curData.text && !_this.itemTemplate) {
+ args.item.classList.add('e-icon-item');
+ }
+ if (isDefaultOverflowMode_1) {
+ args.item.setAttribute('item-index', j_1.toString());
+ }
+ var eventArgs = {
+ item: Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["extend"])({}, args.curData.properties ?
+ args.curData.properties : args.curData), element: args.item, cancel: false
+ };
+ _this.trigger('beforeItemRender', eventArgs);
+ isItemCancelled_1 = eventArgs.cancel;
+ var containsRightIcon = (isIconRight || eventArgs.element.classList.contains(ICONRIGHT));
+ if (containsRightIcon && args.curData.iconCss && !_this.itemTemplate) {
+ args.item.querySelector('.e-anchor-wrap').appendChild(args.item.querySelector(DOT + ICONCLASS));
+ }
+ if (eventArgs.item.disabled) {
+ args.item.setAttribute(ARIADISABLED, 'true');
+ args.item.classList.add(DISABLEDCLASS);
+ }
+ if ((eventArgs.item.disabled || _this.disabled) && args.item.children.length && !_this.itemTemplate) {
+ args.item.children[0].setAttribute(TABINDEX, '-1');
+ }
+ if (args.curData.isEmptyUrl) {
+ args.item.children[0].removeAttribute('href');
+ if ((!isLastItem || (isLastItem && _this.enableActiveItemNavigation)) && !(eventArgs.item.disabled
+ || _this.disabled)) {
+ args.item.children[0].setAttribute(TABINDEX, '0');
+ _ej2_base__WEBPACK_IMPORTED_MODULE_0__["EventHandler"].add(args.item.children[0], 'keydown', _this.keyDownHandler, _this);
+ }
+ }
+ args.item.removeAttribute('role');
+ if (isLastItem) {
+ args.item.setAttribute('data-active-item', '');
+ }
+ if (!_this.itemTemplate) {
+ _this.beforeItemRenderChanges(args.curData, eventArgs.item, args.item, containsRightIcon);
+ }
+ }
+ };
+ for (var i = 0; i < len; (i % 2 && j_1++), i++) {
+ isActiveItem = (this.activeItem && (this.activeItem === items[j_1].url ||
+ this.activeItem === items[j_1].text));
+ if (isCollasped && i > 1 && i < len - 2) {
+ continue;
+ }
+ else if (isDefaultOverflowMode_1 && ((j_1 < this.startIndex || j_1 > this.endIndex)
+ && (i % 2 ? j_1 !== this.startIndex - 1 : true)) && j_1 !== 0) {
+ continue;
+ }
+ if (i % 2) {
+ // separator item
+ wrapDiv = this.createElement('div', { className: 'e-breadcrumb-item-wrapper' });
+ listBaseOptions.template = this.separatorTemplate ? this.separatorTemplate : '/';
+ listBaseOptions.itemClass = 'e-breadcrumb-separator';
+ isSingleLevel = false;
+ item = [{ previousItem: items[j_1], nextItem: items[j_1 + 1] }];
+ }
+ else {
+ // list item
+ listBaseOptions.itemClass = '';
+ if (this.itemTemplate) {
+ listBaseOptions.template = this.itemTemplate;
+ isSingleLevel = false;
+ }
+ else {
+ isSingleLevel = true;
+ }
+ item = [Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["extend"])({}, items[j_1].properties ?
+ items[j_1].properties
+ : items[j_1])];
+ if (!item[0].url && !this.itemTemplate) {
+ item = [Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["extend"])({}, item[0], { isEmptyUrl: true, url: '#' })];
+ }
+ isLastItem = (isDefaultOverflowMode_1 || this.overflowMode === 'Menu') && (j_1 === this.endIndex);
+ if (((i === len - 1 || isLastItem) && !this.itemTemplate) || isActiveItem) {
+ item[0].isLastItem = true;
+ }
+ }
+ var parent_1 = ol;
+ var lastPopupItemIdx = this.startIndex + this.endIndex - this._maxItems;
+ if (this.overflowMode === 'Menu' && ((j_1 >= this.startIndex && (j_1 <= lastPopupItemIdx && (i % 2 ? !(j_1 === lastPopupItemIdx) : true)) && this.endIndex >= this._maxItems && this._maxItems > 0) || this._maxItems === 0)) {
+ if (i % 2) {
+ continue;
+ }
+ else {
+ parent_1 = this.popupUl;
+ if (isLastItem) {
+ isLastItemInPopup_1 = true;
+ }
+ }
+ }
+ else if (this.overflowMode === 'Wrap') {
+ if (i === 0) {
+ parent_1 = firstOl;
+ }
+ else {
+ parent_1 = wrapDiv;
+ }
+ }
+ var li = _ej2_lists__WEBPACK_IMPORTED_MODULE_1__["ListBase"].createList(this.createElement, item, listBaseOptions, isSingleLevel, this).childNodes;
+ if (!isItemCancelled_1) {
+ Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["append"])(li, parent_1);
+ }
+ else if (isDefaultOverflowMode_1 || isCollasped || this.overflowMode === 'Menu' || this.overflowMode === 'Wrap') {
+ items.splice(j_1, 1);
+ this.initPvtProps();
+ return this.reRenderItems();
+ }
+ else if ((i === len - 1 || isLastItem)) {
+ Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["remove"])(parent_1.lastElementChild);
+ }
+ if (this.overflowMode === 'Wrap' && i !== 0 && i % 2 === 0) {
+ ol.appendChild(wrapDiv);
+ }
+ if (isCollasped && i === 1) {
+ var li_1 = this.createElement('li', { className: 'e-icons e-breadcrumb-collapsed', attrs: { TABINDEX: '0' } });
+ _ej2_base__WEBPACK_IMPORTED_MODULE_0__["EventHandler"].add(li_1, 'keyup', this.expandHandler, this);
+ ol.appendChild(li_1);
+ }
+ if (this.overflowMode === 'Menu' && this.startIndex === i && this.endIndex >= this._maxItems && this._maxItems >= 0) {
+ var menu = this.getMenuElement();
+ _ej2_base__WEBPACK_IMPORTED_MODULE_0__["EventHandler"].add(menu, 'keyup', this.keyDownHandler, this);
+ ol.appendChild(menu);
+ }
+ if (isActiveItem || isLastItem) {
+ break;
+ }
+ if (isItemCancelled_1) {
+ i++;
+ }
+ }
+ if (this.isReact) {
+ this.renderReactTemplates();
+ }
+ if (this.overflowMode === 'Wrap') {
+ this.element.appendChild(firstOl);
+ }
+ this.element.appendChild(ol);
+ this.calculateMaxItems();
+ }
+ };
+ Breadcrumb.prototype.calculateMaxItems = function () {
+ if (this.overflowMode === 'Hidden' || this.overflowMode === 'Collapsed' || this.overflowMode === 'Menu') {
+ var maxItems = void 0;
+ var width = this.element.offsetWidth;
+ var liElems = [].slice.call(this.element.children[0].children).reverse();
+ var liWidth = this.overflowMode === 'Menu' ? 0 : liElems[liElems.length - 1].offsetWidth + (liElems[liElems.length - 2] ? liElems[liElems.length - 2].offsetWidth : 0);
+ if (this.overflowMode === 'Menu') {
+ var menuEle = this.getMenuElement();
+ this.element.appendChild(menuEle);
+ liWidth += menuEle.offsetWidth;
+ Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["remove"])(menuEle);
+ }
+ for (var i = 0; i < liElems.length - 2; i++) {
+ if (liWidth > width) {
+ maxItems = Math.ceil((i - 1) / 2) + ((this.overflowMode === 'Menu' && i <= 2) ? 0 : 1);
+ if (((this.maxItems > maxItems && !(this.maxItems > -1 && maxItems === -1)) ||
+ this.maxItems === -1) && this._maxItems !== maxItems) {
+ this._maxItems = maxItems;
+ this.initPvtProps();
+ return this.reRenderItems();
+ }
+ else {
+ break;
+ }
+ }
+ else {
+ if (this.overflowMode === 'Menu' && i === 2) {
+ liWidth += liElems[liElems.length - 1].offsetWidth + liElems[liElems.length - 2].offsetWidth;
+ if (liWidth > width) {
+ this._maxItems = 1;
+ this.initPvtProps();
+ return this.reRenderItems();
+ }
+ }
+ if (!(this.overflowMode === 'Menu' && liElems[i].classList.contains(MENUCLASS))) {
+ liWidth += liElems[i].offsetWidth;
+ }
+ }
+ }
+ }
+ else if ((this.overflowMode === 'Wrap' || this.overflowMode === 'Scroll') && this._maxItems > 0) {
+ var width = 0;
+ var liElems = this.element.querySelectorAll(DOT + ITEMCLASS);
+ if (liElems.length > this._maxItems + this._maxItems - 1) {
+ for (var i = this.overflowMode === 'Wrap' ? 1 : 0; i < this._maxItems + this._maxItems - 1; i++) {
+ width += liElems[i].offsetWidth;
+ }
+ width = width + 5 + (parseInt(getComputedStyle(this.element.children[0]).paddingLeft, 10) * 2);
+ if (this.overflowMode === 'Wrap') {
+ this.element.querySelector('.e-breadcrumb-wrapped-ol').style.width = width + 'px';
+ }
+ else {
+ this.element.style.width = width + 'px';
+ }
+ }
+ }
+ };
+ Breadcrumb.prototype.hasField = function (items, field) {
+ for (var i = 0, len = items.length; i < len; i++) {
+ if (items[i]["" + field]) {
+ return true;
+ }
+ }
+ return false;
+ };
+ Breadcrumb.prototype.getMenuElement = function () {
+ return this.createElement('li', { className: 'e-icons e-breadcrumb-menu', attrs: { TABINDEX: '0' } });
+ };
+ Breadcrumb.prototype.beforeItemRenderChanges = function (prevItem, currItem, elem, isRightIcon) {
+ var wrapElem = elem.querySelector('.e-anchor-wrap');
+ if (currItem.text !== prevItem.text) {
+ wrapElem.childNodes.forEach(function (child) {
+ if (child.nodeType === Node.TEXT_NODE) {
+ child.textContent = currItem.text;
+ }
+ });
+ }
+ if (currItem.iconCss !== prevItem.iconCss && wrapElem) { // wrapElem - for checking it is item not a separator
+ var iconElem = elem.querySelector(DOT + ICONCLASS);
+ if (iconElem) {
+ if (currItem.iconCss) {
+ Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["removeClass"])([iconElem], prevItem.iconCss.split(' '));
+ Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["addClass"])([iconElem], currItem.iconCss.split(' '));
+ }
+ else {
+ Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["remove"])(iconElem);
+ }
+ }
+ else if (currItem.iconCss) {
+ var iconElem_1 = this.createElement('span', { className: ICONCLASS + ' ' + currItem.iconCss });
+ if (isRightIcon) {
+ Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["append"])([iconElem_1], wrapElem);
+ }
+ else {
+ wrapElem.insertBefore(iconElem_1, wrapElem.childNodes[0]);
+ }
+ }
+ }
+ if (currItem.url !== prevItem.url && this.enableNavigation) {
+ var anchor = elem.querySelector('a.' + ITEMTEXTCLASS);
+ if (anchor) {
+ if (currItem.url) {
+ anchor.setAttribute('href', currItem.url);
+ }
+ else {
+ anchor.removeAttribute('href');
+ }
+ }
+ }
+ };
+ Breadcrumb.prototype.reRenderItems = function () {
+ this.element.innerHTML = '';
+ this.renderItems(this.items);
+ };
+ Breadcrumb.prototype.clickHandler = function (e) {
+ var li = Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["closest"])(e.target, DOT + ITEMCLASS + ':not(.e-breadcrumb-separator)');
+ if (!this.enableNavigation) {
+ e.preventDefault();
+ }
+ if (li && (Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["closest"])(e.target, DOT + ITEMTEXTCLASS) || this.itemTemplate)) {
+ var idx = void 0;
+ if (this.overflowMode === 'Wrap') {
+ idx = [].slice.call(this.element.querySelectorAll(DOT + ITEMCLASS)).indexOf(li);
+ }
+ else {
+ idx = [].slice.call(li.parentElement.children).indexOf(li);
+ }
+ if (this.overflowMode === 'Menu') {
+ if (Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["closest"])(e.target, DOT + POPUPCLASS)) {
+ idx += this.startIndex;
+ this.endIndex = idx;
+ if (e.type === 'keydown') {
+ this.documentClickHandler(e);
+ }
+ }
+ else if (this.element.querySelector(DOT + MENUCLASS)) {
+ if (idx > [].slice.call(this.element.children[0].children).indexOf(this.element.querySelector(DOT + MENUCLASS))) {
+ idx += (this.popupUl.childElementCount * 2) - 2;
+ idx = Math.floor(idx / 2);
+ this.endIndex = idx;
+ }
+ else {
+ this.startIndex = this.endIndex = idx;
+ }
+ }
+ else {
+ idx = Math.floor(idx / 2);
+ this.startIndex = this.endIndex = idx;
+ }
+ }
+ else {
+ idx = Math.floor(idx / 2);
+ }
+ if (this.overflowMode === 'Hidden' && this._maxItems > 0 && this.endIndex !== 0) {
+ idx = parseInt(li.getAttribute('item-index'), 10);
+ if (this.startIndex > 1) {
+ this.startIndex -= (this.endIndex - idx);
+ }
+ this.endIndex = idx;
+ }
+ this.trigger('itemClick', { element: li, item: this.items[idx], event: e });
+ this.activeItem = this.items[idx].url || this.items[idx].text;
+ this.dataBind();
+ }
+ if (e.target.classList.contains('e-breadcrumb-collapsed')) {
+ this.isExpanded = true;
+ this.reRenderItems();
+ }
+ if (e.target.classList.contains(MENUCLASS) && !this.isPopupCreated) {
+ this.renderPopup();
+ }
+ };
+ Breadcrumb.prototype.renderPopup = function () {
+ var _this = this;
+ var wrapper = this.createElement('div', { className: POPUPCLASS + ' ' + this.cssClass + (this.enableRtl ? ' e-rtl' : '') });
+ document.body.appendChild(wrapper);
+ this.isPopupCreated = true;
+ this.popupObj = new _ej2_popups__WEBPACK_IMPORTED_MODULE_2__["Popup"](wrapper, {
+ content: this.popupUl,
+ relateTo: this.element.querySelector(DOT + MENUCLASS),
+ enableRtl: this.enableRtl,
+ position: { X: 'left', Y: 'bottom' },
+ collision: { X: 'fit', Y: 'flip' },
+ open: function () {
+ _this.popupUl.focus();
+ }
+ });
+ this.popupWireEvents();
+ this.popupObj.show();
+ };
+ Breadcrumb.prototype.documentClickHandler = function (e) {
+ if (this.overflowMode === 'Menu' && this.popupObj && this.popupObj.element.classList.contains('e-popup-open') && !Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["closest"])(e.target, DOT + MENUCLASS)) {
+ this.popupObj.hide();
+ this.popupObj.destroy();
+ this.isPopupCreated = false;
+ Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["detach"])(this.popupObj.element);
+ }
+ };
+ Breadcrumb.prototype.resize = function () {
+ this._maxItems = this.maxItems;
+ this.initPvtProps();
+ this.reRenderItems();
+ };
+ Breadcrumb.prototype.expandHandler = function (e) {
+ if (e.key === 'Enter') {
+ this.isExpanded = true;
+ this.reRenderItems();
+ }
+ };
+ Breadcrumb.prototype.keyDownHandler = function (e) {
+ if (e.key === 'Enter') {
+ this.clickHandler(e);
+ }
+ };
+ Breadcrumb.prototype.popupKeyDownHandler = function (e) {
+ if (e.key === 'Escape') {
+ this.documentClickHandler(e);
+ }
+ };
+ /**
+ * Called internally if any of the property value changed.
+ *
+ * @private
+ * @param {BreadcrumbModel} newProp - Specifies the new properties.
+ * @param {BreadcrumbModel} oldProp - Specifies the old properties.
+ * @returns {void}
+ */
+ Breadcrumb.prototype.onPropertyChanged = function (newProp, oldProp) {
+ for (var _i = 0, _a = Object.keys(newProp); _i < _a.length; _i++) {
+ var prop = _a[_i];
+ switch (prop) {
+ case 'items':
+ case 'enableActiveItemNavigation':
+ this.reRenderItems();
+ break;
+ case 'activeItem':
+ this._maxItems = this.maxItems;
+ this.initPvtProps();
+ this.reRenderItems();
+ break;
+ case 'overflowMode':
+ case 'maxItems':
+ this._maxItems = this.maxItems;
+ this.initPvtProps();
+ this.reRenderItems();
+ if (oldProp.overflowMode === 'Wrap') {
+ this.element.classList.remove(WRAPMODECLASS);
+ }
+ else if (newProp.overflowMode === 'Wrap') {
+ this.element.classList.add(WRAPMODECLASS);
+ }
+ if (oldProp.overflowMode === 'Scroll') {
+ this.element.classList.remove(SCROLLMODECLASS);
+ }
+ else if (newProp.overflowMode === 'Scroll') {
+ this.element.classList.add(SCROLLMODECLASS);
+ }
+ break;
+ case 'url':
+ this.initItems();
+ this.reRenderItems();
+ break;
+ case 'cssClass':
+ if (oldProp.cssClass) {
+ Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["removeClass"])([this.element], oldProp.cssClass.split(' '));
+ }
+ if (newProp.cssClass) {
+ Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["addClass"])([this.element], newProp.cssClass.replace(/\s+/g, ' ').trim().split(' '));
+ }
+ if ((oldProp.cssClass && oldProp.cssClass.indexOf(ICONRIGHT) > -1) && !(newProp.cssClass &&
+ newProp.cssClass.indexOf(ICONRIGHT) > -1) || !(oldProp.cssClass && oldProp.cssClass.indexOf(ICONRIGHT) > -1) &&
+ (newProp.cssClass && newProp.cssClass.indexOf(ICONRIGHT) > -1)) {
+ this.reRenderItems();
+ }
+ break;
+ case 'enableRtl':
+ this.element.classList.toggle('e-rtl');
+ break;
+ case 'disabled':
+ this.element.classList.toggle(DISABLEDCLASS);
+ this.element.setAttribute(ARIADISABLED, newProp.disabled + '');
+ break;
+ }
+ }
+ };
+ Breadcrumb.prototype.wireEvents = function () {
+ this.delegateClickHanlder = this.documentClickHandler.bind(this);
+ _ej2_base__WEBPACK_IMPORTED_MODULE_0__["EventHandler"].add(document, 'click', this.delegateClickHanlder, this);
+ _ej2_base__WEBPACK_IMPORTED_MODULE_0__["EventHandler"].add(this.element, 'click', this.clickHandler, this);
+ window.addEventListener('resize', this.resize.bind(this));
+ };
+ Breadcrumb.prototype.popupWireEvents = function () {
+ _ej2_base__WEBPACK_IMPORTED_MODULE_0__["EventHandler"].add(this.popupObj.element, 'click', this.clickHandler, this);
+ _ej2_base__WEBPACK_IMPORTED_MODULE_0__["EventHandler"].add(this.popupObj.element, 'keydown', this.popupKeyDownHandler, this);
+ };
+ Breadcrumb.prototype.unWireEvents = function () {
+ _ej2_base__WEBPACK_IMPORTED_MODULE_0__["EventHandler"].remove(document, 'click', this.delegateClickHanlder);
+ _ej2_base__WEBPACK_IMPORTED_MODULE_0__["EventHandler"].remove(this.element, 'click', this.clickHandler);
+ window.removeEventListener('resize', this.resize.bind(this));
+ if (this.popupObj) {
+ _ej2_base__WEBPACK_IMPORTED_MODULE_0__["EventHandler"].remove(this.popupObj.element, 'click', this.clickHandler);
+ _ej2_base__WEBPACK_IMPORTED_MODULE_0__["EventHandler"].remove(this.popupObj.element, 'keydown', this.popupKeyDownHandler);
+ }
+ };
+ /**
+ * Get the properties to be maintained in the persisted state.
+ *
+ * @returns {string} - Persist data
+ */
+ Breadcrumb.prototype.getPersistData = function () {
+ return this.addOnPersist(['activeItem']);
+ };
+ /**
+ * Get module name.
+ *
+ * @private
+ * @returns {string} - Module Name
+ */
+ Breadcrumb.prototype.getModuleName = function () {
+ return 'breadcrumb';
+ };
+ /**
+ * Destroys the widget.
+ *
+ * @returns {void}
+ */
+ Breadcrumb.prototype.destroy = function () {
+ var _this = this;
+ var classes = [];
+ var attributes = ['aria-label'];
+ if (this.cssClass) {
+ classes.concat(this.cssClass.split(' '));
+ }
+ if (this.enableRtl) {
+ classes.push('e-rtl');
+ }
+ if (this.disabled) {
+ classes.push(DISABLEDCLASS);
+ attributes.push(ARIADISABLED);
+ }
+ if (this.overflowMode === 'Wrap') {
+ classes.push(WRAPMODECLASS);
+ }
+ else if (this.overflowMode === 'Scroll') {
+ classes.push(SCROLLMODECLASS);
+ }
+ this.unWireEvents();
+ this.element.innerHTML = '';
+ Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["removeClass"])([this.element], classes);
+ attributes.forEach(function (attribute) {
+ _this.element.removeAttribute(attribute);
+ });
+ _super.prototype.destroy.call(this);
+ };
+ __decorate([
+ Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["Property"])('')
+ ], Breadcrumb.prototype, "url", void 0);
+ __decorate([
+ Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["Collection"])([], BreadcrumbItem)
+ ], Breadcrumb.prototype, "items", void 0);
+ __decorate([
+ Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["Property"])('')
+ ], Breadcrumb.prototype, "activeItem", void 0);
+ __decorate([
+ Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["Property"])(-1)
+ ], Breadcrumb.prototype, "maxItems", void 0);
+ __decorate([
+ Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["Property"])('Menu')
+ ], Breadcrumb.prototype, "overflowMode", void 0);
+ __decorate([
+ Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["Property"])('')
+ ], Breadcrumb.prototype, "cssClass", void 0);
+ __decorate([
+ Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["Property"])(null)
+ ], Breadcrumb.prototype, "itemTemplate", void 0);
+ __decorate([
+ Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["Property"])('/')
+ ], Breadcrumb.prototype, "separatorTemplate", void 0);
+ __decorate([
+ Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["Property"])(true)
+ ], Breadcrumb.prototype, "enableNavigation", void 0);
+ __decorate([
+ Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["Property"])(false)
+ ], Breadcrumb.prototype, "enableActiveItemNavigation", void 0);
+ __decorate([
+ Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["Property"])(false)
+ ], Breadcrumb.prototype, "disabled", void 0);
+ __decorate([
+ Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["Property"])('')
+ ], Breadcrumb.prototype, "locale", void 0);
+ __decorate([
+ Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["Event"])()
+ ], Breadcrumb.prototype, "beforeItemRender", void 0);
+ __decorate([
+ Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["Event"])()
+ ], Breadcrumb.prototype, "itemClick", void 0);
+ __decorate([
+ Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["Event"])()
+ ], Breadcrumb.prototype, "created", void 0);
+ Breadcrumb = __decorate([
+ _ej2_base__WEBPACK_IMPORTED_MODULE_0__["NotifyPropertyChanges"]
+ ], Breadcrumb);
+ return Breadcrumb;
+}(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["Component"]));
+
+
+
+/***/ }),
+
+/***/ "./ej2-resources/22.1.37/scripts/ej2-navigations/breadcrumb/index.js":
+/*!***************************************************************************!*\
+ !*** ./ej2-resources/22.1.37/scripts/ej2-navigations/breadcrumb/index.js ***!
+ \***************************************************************************/
+/*! exports provided: BreadcrumbOverflowMode, BreadcrumbItem, Breadcrumb */
+/***/ (function(module, __webpack_exports__, __webpack_require__) {
+
+"use strict";
+__webpack_require__.r(__webpack_exports__);
+/* harmony import */ var _breadcrumb__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./breadcrumb */ "./ej2-resources/22.1.37/scripts/ej2-navigations/breadcrumb/breadcrumb.js");
+/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "BreadcrumbOverflowMode", function() { return _breadcrumb__WEBPACK_IMPORTED_MODULE_0__["BreadcrumbOverflowMode"]; });
+
+/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "BreadcrumbItem", function() { return _breadcrumb__WEBPACK_IMPORTED_MODULE_0__["BreadcrumbItem"]; });
+
+/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Breadcrumb", function() { return _breadcrumb__WEBPACK_IMPORTED_MODULE_0__["Breadcrumb"]; });
+
+/**
+ * Breadcrumb modules
+ */
+
+
+
+/***/ }),
+
+/***/ "./ej2-resources/22.1.37/scripts/ej2-navigations/carousel/carousel.js":
+/*!****************************************************************************!*\
+ !*** ./ej2-resources/22.1.37/scripts/ej2-navigations/carousel/carousel.js ***!
+ \****************************************************************************/
+/*! exports provided: CarouselSwipeMode, CarouselItem, Carousel */
+/***/ (function(module, __webpack_exports__, __webpack_require__) {
+
+"use strict";
+__webpack_require__.r(__webpack_exports__);
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "CarouselSwipeMode", function() { return CarouselSwipeMode; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "CarouselItem", function() { return CarouselItem; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Carousel", function() { return Carousel; });
+/* harmony import */ var _ej2_base__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../ej2-base */ "./ej2-resources/22.1.37/scripts/ej2-base/index.js");
+/* harmony import */ var _ej2_buttons__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../ej2-buttons */ "./ej2-resources/22.1.37/scripts/ej2-buttons/index.js");
+var __extends = (undefined && undefined.__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 = (undefined && undefined.__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;
+};
+/* eslint-disable @typescript-eslint/no-explicit-any */
+
+
+
+
+// Constant variables
+var CLS_CAROUSEL = 'e-carousel';
+var CLS_ACTIVE = 'e-active';
+var CLS_RTL = 'e-rtl';
+var CLS_PARTIAL = 'e-partial';
+var CLS_SWIPE = 'e-swipe';
+var CLS_SLIDE_CONTAINER = 'e-carousel-slide-container';
+var CLS_ITEMS = 'e-carousel-items';
+var CLS_CLONED = 'e-cloned';
+var CLS_ITEM = 'e-carousel-item';
+var CLS_PREVIOUS = 'e-previous';
+var CLS_NEXT = 'e-next';
+var CLS_PREV_ICON = 'e-previous-icon';
+var CLS_NEXT_ICON = 'e-next-icon';
+var CLS_NAVIGATORS = 'e-carousel-navigators';
+var CLS_INDICATORS = 'e-carousel-indicators';
+var CLS_INDICATOR_BARS = 'e-indicator-bars';
+var CLS_INDICATOR_BAR = 'e-indicator-bar';
+var CLS_INDICATOR = 'e-indicator';
+var CLS_ICON = 'e-icons';
+var CLS_PLAY_PAUSE = 'e-play-pause';
+var CLS_PLAY_ICON = 'e-play-icon';
+var CLS_PAUSE_ICON = 'e-pause-icon';
+var CLS_PREV_BUTTON = 'e-previous-button';
+var CLS_NEXT_BUTTON = 'e-next-button';
+var CLS_PLAY_BUTTON = 'e-play-button';
+var CLS_FLAT = 'e-flat';
+var CLS_ROUND = 'e-round';
+var CLS_HOVER_ARROWS = 'e-hover-arrows';
+var CLS_HOVER = 'e-carousel-hover';
+var CLS_TEMPLATE = 'e-template';
+var CLS_SLIDE_ANIMATION = 'e-carousel-slide-animation';
+var CLS_FADE_ANIMATION = 'e-carousel-fade-animation';
+var CLS_CUSTOM_ANIMATION = 'e-carousel-custom-animation';
+var CLS_ANIMATION_NONE = 'e-carousel-animation-none';
+var CLS_PREV_SLIDE = 'e-prev';
+var CLS_NEXT_SLIDE = 'e-next';
+var CLS_TRANSITION_START = 'e-transition-start';
+var CLS_TRANSITION_END = 'e-transition-end';
+/**
+ * Specifies the action (touch & mouse) which enables the slide swiping action in carousel.
+ * * Touch - Enables or disables the swiping action in touch interaction.
+ * * Mouse - Enables or disables the swiping action in mouse interaction.
+ * @aspNumberEnum
+ */
+var CarouselSwipeMode;
+(function (CarouselSwipeMode) {
+ /** Enables or disables the swiping action in touch interaction. */
+ CarouselSwipeMode[CarouselSwipeMode["Touch"] = 1] = "Touch";
+ /** Enables or disables the swiping action in mouse interaction. */
+ CarouselSwipeMode[CarouselSwipeMode["Mouse"] = 2] = "Mouse";
+})(CarouselSwipeMode || (CarouselSwipeMode = {}));
+/** Specifies the carousel individual item. */
+var CarouselItem = /** @__PURE__ @class */ (function (_super) {
+ __extends(CarouselItem, _super);
+ function CarouselItem() {
+ return _super !== null && _super.apply(this, arguments) || this;
+ }
+ __decorate([
+ Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["Property"])()
+ ], CarouselItem.prototype, "cssClass", void 0);
+ __decorate([
+ Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["Property"])()
+ ], CarouselItem.prototype, "interval", void 0);
+ __decorate([
+ Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["Property"])()
+ ], CarouselItem.prototype, "template", void 0);
+ __decorate([
+ Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["Property"])()
+ ], CarouselItem.prototype, "htmlAttributes", void 0);
+ return CarouselItem;
+}(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["ChildProperty"]));
+
+var Carousel = /** @__PURE__ @class */ (function (_super) {
+ __extends(Carousel, _super);
+ /**
+ * Constructor for creating the Carousel widget
+ *
+ * @param {CarouselModel} options Accepts the carousel model properties to initiate the rendering
+ * @param {string | HTMLElement} element Accepts the DOM element reference
+ */
+ function Carousel(options, element) {
+ var _this = _super.call(this, options, element) || this;
+ _this.isSwipe = false;
+ return _this;
+ }
+ Carousel.prototype.getModuleName = function () {
+ return CLS_CAROUSEL.replace('e-', '');
+ };
+ Carousel.prototype.getPersistData = function () {
+ return this.addOnPersist(['selectedIndex']);
+ };
+ Carousel.prototype.preRender = function () {
+ this.keyConfigs = {
+ home: 'home',
+ end: 'end',
+ space: 'space',
+ moveLeft: 'leftarrow',
+ moveRight: 'rightarrow',
+ moveUp: 'uparrow',
+ moveDown: 'downarrow'
+ };
+ var defaultLocale = {
+ nextSlide: 'Next slide',
+ of: 'of',
+ pauseSlideTransition: 'Pause slide transition',
+ playSlideTransition: 'Play slide transition',
+ previousSlide: 'Previous slide',
+ slide: 'Slide',
+ slideShow: 'Slide show'
+ };
+ this.localeObj = new _ej2_base__WEBPACK_IMPORTED_MODULE_0__["L10n"](this.getModuleName(), defaultLocale, this.locale);
+ };
+ Carousel.prototype.render = function () {
+ this.initialize();
+ this.renderSlides();
+ this.renderNavigators();
+ this.renderPlayButton();
+ this.renderIndicators();
+ this.applyAnimation();
+ this.wireEvents();
+ };
+ Carousel.prototype.onPropertyChanged = function (newProp, oldProp) {
+ var target;
+ var rtlElement;
+ for (var _i = 0, _a = Object.keys(newProp); _i < _a.length; _i++) {
+ var prop = _a[_i];
+ switch (prop) {
+ case 'animationEffect':
+ this.applyAnimation();
+ break;
+ case 'cssClass':
+ Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["classList"])(this.element, [newProp.cssClass], [oldProp.cssClass]);
+ break;
+ case 'selectedIndex':
+ this.setActiveSlide(this.selectedIndex, oldProp.selectedIndex > this.selectedIndex ? 'Previous' : 'Next');
+ this.autoSlide();
+ break;
+ case 'htmlAttributes':
+ if (!Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["isNullOrUndefined"])(this.htmlAttributes)) {
+ this.setHtmlAttributes(this.htmlAttributes, this.element);
+ }
+ break;
+ case 'enableTouchSwipe':
+ if (!this.enableTouchSwipe && this.touchModule) {
+ this.touchModule.destroy();
+ }
+ if (this.element.querySelector("." + CLS_ITEMS)) {
+ this.renderTouchActions();
+ }
+ break;
+ case 'loop':
+ if (this.loop && Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["isNullOrUndefined"])(this.autoSlideInterval)) {
+ this.applySlideInterval();
+ }
+ this.handleNavigatorsActions(this.selectedIndex);
+ if (this.partialVisible || !(this.swipeMode === (~CarouselSwipeMode.Touch & ~CarouselSwipeMode.Mouse))) {
+ this.reRenderSlides();
+ }
+ break;
+ case 'enableRtl':
+ rtlElement = [].slice.call(this.element.querySelectorAll("." + CLS_PREV_BUTTON + ",\n ." + CLS_NEXT_BUTTON + ", ." + CLS_PLAY_BUTTON));
+ rtlElement.push(this.element);
+ if (this.enableRtl) {
+ Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["addClass"])(rtlElement, CLS_RTL);
+ }
+ else {
+ Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["removeClass"])(rtlElement, CLS_RTL);
+ }
+ if (this.partialVisible || !(this.swipeMode === (~CarouselSwipeMode.Touch & ~CarouselSwipeMode.Mouse))) {
+ var cloneCount = this.loop ? this.getNumOfItems() : 0;
+ var slideWidth = this.itemsContainer.firstElementChild.clientWidth;
+ this.itemsContainer.style.transform = this.getTranslateX(slideWidth, this.selectedIndex + cloneCount);
+ }
+ break;
+ case 'buttonsVisibility':
+ target = this.element.querySelector("." + CLS_NAVIGATORS);
+ if (target) {
+ switch (this.buttonsVisibility) {
+ case 'Hidden':
+ this.resetTemplates(['previousButtonTemplate', 'nextButtonTemplate']);
+ Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["remove"])(target);
+ break;
+ case 'VisibleOnHover':
+ Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["addClass"])([].slice.call(target.childNodes), CLS_HOVER_ARROWS);
+ break;
+ case 'Visible':
+ Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["removeClass"])([].slice.call(target.childNodes), CLS_HOVER_ARROWS);
+ break;
+ }
+ }
+ else {
+ this.renderNavigators();
+ this.renderPlayButton();
+ }
+ break;
+ case 'width':
+ Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["setStyleAttribute"])(this.element, { 'width': Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["formatUnit"])(this.width) });
+ break;
+ case 'height':
+ Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["setStyleAttribute"])(this.element, { 'height': Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["formatUnit"])(this.height) });
+ break;
+ case 'autoPlay':
+ if (this.showPlayButton && Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["isNullOrUndefined"])(this.playButtonTemplate)) {
+ this.playButtonClickHandler(null, true);
+ }
+ this.autoSlide();
+ break;
+ case 'interval':
+ this.autoSlide();
+ break;
+ case 'showIndicators':
+ case 'indicatorsType':
+ target = this.element.querySelector("." + CLS_INDICATORS);
+ if (target) {
+ this.resetTemplates(['indicatorsTemplate']);
+ Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["remove"])(target);
+ }
+ this.renderIndicators();
+ break;
+ case 'showPlayButton':
+ target = this.element.querySelector("." + CLS_PLAY_PAUSE);
+ if (!this.showPlayButton && target) {
+ Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["remove"])(target);
+ this.resetTemplates(['playButtonTemplate']);
+ }
+ this.renderPlayButton();
+ break;
+ case 'items':
+ case 'dataSource':
+ this.reRenderSlides();
+ break;
+ case 'partialVisible':
+ if (this.partialVisible) {
+ Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["addClass"])([this.element], CLS_PARTIAL);
+ }
+ else {
+ Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["removeClass"])([this.element], CLS_PARTIAL);
+ }
+ this.reRenderSlides();
+ break;
+ case 'swipeMode':
+ _ej2_base__WEBPACK_IMPORTED_MODULE_0__["EventHandler"].remove(this.element, 'mousedown touchstart', this.swipeStart);
+ _ej2_base__WEBPACK_IMPORTED_MODULE_0__["EventHandler"].remove(this.element, 'mousemove touchmove', this.swiping);
+ _ej2_base__WEBPACK_IMPORTED_MODULE_0__["EventHandler"].remove(this.element, 'mouseup touchend', this.swipStop);
+ this.swipeModehandlers();
+ this.reRenderSlides();
+ break;
+ }
+ }
+ };
+ Carousel.prototype.reRenderSlides = function () {
+ var target = this.element.querySelector("." + CLS_ITEMS);
+ if (target) {
+ this.resetTemplates(['itemTemplate']);
+ Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["remove"])(target);
+ }
+ this.renderSlides();
+ };
+ Carousel.prototype.initialize = function () {
+ var carouselClasses = [];
+ if (this.cssClass) {
+ carouselClasses.push(this.cssClass);
+ }
+ if (this.enableRtl) {
+ carouselClasses.push(CLS_RTL);
+ }
+ if (this.partialVisible) {
+ carouselClasses.push(CLS_PARTIAL);
+ }
+ if (!(this.swipeMode === (~CarouselSwipeMode.Touch & ~CarouselSwipeMode.Mouse))) {
+ carouselClasses.push(CLS_SWIPE);
+ }
+ Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["addClass"])([this.element], carouselClasses);
+ Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["setStyleAttribute"])(this.element, { 'width': Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["formatUnit"])(this.width), 'height': Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["formatUnit"])(this.height) });
+ Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["attributes"])(this.element, { 'tabindex': '0', 'aria-roledescription': 'carousel', 'aria-label': this.localeObj.getConstant('slideShow') });
+ if (!Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["isNullOrUndefined"])(this.htmlAttributes)) {
+ this.setHtmlAttributes(this.htmlAttributes, this.element);
+ }
+ };
+ Carousel.prototype.renderSlides = function () {
+ var _this = this;
+ var slideContainer = this.element.querySelector('.' + CLS_SLIDE_CONTAINER);
+ if (!slideContainer) {
+ slideContainer = this.createElement('div', { className: CLS_SLIDE_CONTAINER });
+ this.element.appendChild(slideContainer);
+ }
+ this.itemsContainer = this.createElement('div', { className: CLS_ITEMS, attrs: { 'aria-live': this.autoPlay ? 'off' : 'polite' } });
+ slideContainer.appendChild(this.itemsContainer);
+ var numOfItems = this.getNumOfItems();
+ if (numOfItems > 0 && this.loop) {
+ if (this.items.length > 0) {
+ this.items.slice(-numOfItems).forEach(function (item, index) {
+ _this.renderSlide(item, item.template, index, _this.itemsContainer, true);
+ });
+ }
+ else if (this.dataSource.length > 0) {
+ this.dataSource.slice(-numOfItems).forEach(function (item, index) {
+ _this.renderSlide(item, _this.itemTemplate, index, _this.itemsContainer, true);
+ });
+ }
+ }
+ if (this.items.length > 0) {
+ this.slideItems = this.items;
+ this.items.forEach(function (item, index) {
+ _this.renderSlide(item, item.template, index, _this.itemsContainer);
+ });
+ }
+ else if (this.dataSource.length > 0) {
+ this.slideItems = this.dataSource;
+ this.dataSource.forEach(function (item, index) {
+ _this.renderSlide(item, _this.itemTemplate, index, _this.itemsContainer);
+ });
+ }
+ if (numOfItems > 0 && this.loop) {
+ if (this.items.length > 0) {
+ this.items.slice(0, numOfItems).forEach(function (item, index) {
+ _this.renderSlide(item, item.template, index, _this.itemsContainer, true);
+ });
+ }
+ else if (this.dataSource.length > 0) {
+ this.dataSource.slice(0, numOfItems).forEach(function (item, index) {
+ _this.renderSlide(item, _this.itemTemplate, index, _this.itemsContainer, true);
+ });
+ }
+ }
+ this.renderTemplates();
+ this.itemsContainer.style.setProperty('--carousel-items-count', "" + this.itemsContainer.children.length);
+ var slideWidth = Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["isNullOrUndefined"])(this.itemsContainer.firstElementChild) ? 0 :
+ this.itemsContainer.firstElementChild.clientWidth;
+ this.itemsContainer.style.transitionProperty = 'none';
+ var cloneCount = this.loop ? numOfItems : 0;
+ this.itemsContainer.style.transform = this.getTranslateX(slideWidth, this.selectedIndex + cloneCount);
+ this.autoSlide();
+ this.renderTouchActions();
+ this.renderKeyboardActions();
+ };
+ Carousel.prototype.getTranslateX = function (slideWidth, count) {
+ if (count === void 0) { count = 1; }
+ return this.enableRtl ? "translateX(" + (slideWidth) * (count) + "px)" :
+ "translateX(" + -(slideWidth) * (count) + "px)";
+ };
+ Carousel.prototype.renderSlide = function (item, itemTemplate, index, container, isClone) {
+ if (isClone === void 0) { isClone = false; }
+ var itemEle = this.createElement('div', {
+ id: Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["getUniqueID"])('carousel_item'),
+ className: CLS_ITEM + " " + (item.cssClass ? item.cssClass : '') + " " + (this.selectedIndex === index && !isClone ? CLS_ACTIVE : ''),
+ attrs: {
+ 'aria-hidden': this.selectedIndex === index && !isClone ? 'false' : 'true', 'data-index': index.toString(),
+ 'aria-role': 'group', 'aria-roledescription': 'slide'
+ }
+ });
+ if (isClone) {
+ itemEle.classList.add(CLS_CLONED);
+ }
+ if (!Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["isNullOrUndefined"])(item.htmlAttributes)) {
+ this.setHtmlAttributes(item.htmlAttributes, itemEle);
+ }
+ var templateId = this.element.id + '_template';
+ var template = this.templateParser(itemTemplate)(item, this, 'itemTemplate', templateId, false);
+ Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["append"])(template, itemEle);
+ container.appendChild(itemEle);
+ };
+ Carousel.prototype.renderNavigators = function () {
+ if (this.buttonsVisibility === 'Hidden') {
+ return;
+ }
+ var navigators = this.createElement('div', { className: CLS_NAVIGATORS });
+ var itemsContainer = this.element.querySelector("." + CLS_SLIDE_CONTAINER);
+ itemsContainer.insertAdjacentElement('afterend', navigators);
+ if (!Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["isNullOrUndefined"])(this.slideItems) && this.slideItems.length > 1) {
+ this.renderNavigatorButton('Previous');
+ this.renderNavigatorButton('Next');
+ }
+ this.renderTemplates();
+ };
+ Carousel.prototype.renderNavigatorButton = function (direction) {
+ var buttonContainer = this.createElement('div', {
+ className: (direction === 'Previous' ? CLS_PREVIOUS : CLS_NEXT) + ' ' + (this.buttonsVisibility === 'VisibleOnHover' ? CLS_HOVER_ARROWS : '')
+ });
+ if (direction === 'Previous' && this.previousButtonTemplate) {
+ Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["addClass"])([buttonContainer], CLS_TEMPLATE);
+ var templateId = this.element.id + '_previousButtonTemplate';
+ var template = this.templateParser(this.previousButtonTemplate)({ type: 'Previous' }, this, 'previousButtonTemplate', templateId, false);
+ Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["append"])(template, buttonContainer);
+ }
+ else if (direction === 'Next' && this.nextButtonTemplate) {
+ Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["addClass"])([buttonContainer], CLS_TEMPLATE);
+ var templateId = this.element.id + '_nextButtonTemplate';
+ var template = this.templateParser(this.nextButtonTemplate)({ type: 'Next' }, this, 'nextButtonTemplate', templateId, false);
+ Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["append"])(template, buttonContainer);
+ }
+ else {
+ var button = this.createElement('button', {
+ attrs: { 'aria-label': this.localeObj.getConstant(direction === 'Previous' ? 'previousSlide' : 'nextSlide'), 'type': 'button' }
+ });
+ var buttonObj = new _ej2_buttons__WEBPACK_IMPORTED_MODULE_1__["Button"]({
+ cssClass: CLS_FLAT + ' ' + CLS_ROUND + ' ' + (direction === 'Previous' ? CLS_PREV_BUTTON : CLS_NEXT_BUTTON),
+ iconCss: CLS_ICON + ' ' + (direction === 'Previous' ? CLS_PREV_ICON : CLS_NEXT_ICON),
+ enableRtl: this.enableRtl,
+ disabled: !this.loop && this.selectedIndex === (direction === 'Previous' ? 0 : this.slideItems.length - 1)
+ });
+ buttonObj.appendTo(button);
+ buttonContainer.appendChild(button);
+ }
+ this.element.querySelector('.' + CLS_NAVIGATORS).appendChild(buttonContainer);
+ _ej2_base__WEBPACK_IMPORTED_MODULE_0__["EventHandler"].add(buttonContainer, 'click', this.navigatorClickHandler, this);
+ };
+ Carousel.prototype.renderPlayButton = function () {
+ if (Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["isNullOrUndefined"])(this.slideItems) || this.buttonsVisibility === 'Hidden' || !this.showPlayButton || this.slideItems.length <= 1) {
+ return;
+ }
+ var playPauseWrap = this.createElement('div', {
+ className: CLS_PLAY_PAUSE + ' ' + (this.buttonsVisibility === 'VisibleOnHover' ? CLS_HOVER_ARROWS : '')
+ });
+ if (this.playButtonTemplate) {
+ Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["addClass"])([playPauseWrap], CLS_TEMPLATE);
+ var templateId = this.element.id + '_playButtonTemplate';
+ var template = this.templateParser(this.playButtonTemplate)({}, this, 'playButtonTemplate', templateId, false);
+ Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["append"])(template, playPauseWrap);
+ }
+ else {
+ var playButton = this.createElement('button', {
+ attrs: { 'aria-label': this.localeObj.getConstant(this.autoPlay ? 'pauseSlideTransition' : 'playSlideTransition'), 'type': 'button' }
+ });
+ var isLastSlide = this.selectedIndex === this.slideItems.length - 1 && !this.loop;
+ var buttonObj = new _ej2_buttons__WEBPACK_IMPORTED_MODULE_1__["Button"]({
+ cssClass: CLS_FLAT + ' ' + CLS_ROUND + ' ' + CLS_PLAY_BUTTON,
+ iconCss: CLS_ICON + ' ' + (this.autoPlay && !isLastSlide ? CLS_PAUSE_ICON : CLS_PLAY_ICON),
+ isToggle: true,
+ enableRtl: this.enableRtl
+ });
+ if (isLastSlide) {
+ this.setProperties({ autoPlay: false }, true);
+ playButton.setAttribute('aria-label', this.localeObj.getConstant('playSlideTransition'));
+ this.itemsContainer.setAttribute('aria-live', 'polite');
+ }
+ buttonObj.appendTo(playButton);
+ playPauseWrap.appendChild(playButton);
+ }
+ var navigators = this.element.querySelector("." + CLS_NAVIGATORS);
+ navigators.insertBefore(playPauseWrap, navigators.lastElementChild);
+ this.renderTemplates();
+ _ej2_base__WEBPACK_IMPORTED_MODULE_0__["EventHandler"].add(playPauseWrap, 'click', this.playButtonClickHandler, this);
+ };
+ Carousel.prototype.renderIndicators = function () {
+ var _this = this;
+ if (!this.showIndicators) {
+ return;
+ }
+ var indicatorClass = 'e-default';
+ if (!this.indicatorsTemplate) {
+ indicatorClass = "e-" + this.indicatorsType.toLowerCase();
+ }
+ var indicatorWrap = this.createElement('div', { className: CLS_INDICATORS + " " + indicatorClass });
+ var indicatorBars = this.createElement('div', { className: CLS_INDICATOR_BARS });
+ indicatorWrap.appendChild(indicatorBars);
+ var progress;
+ if (this.slideItems) {
+ switch (this.indicatorsType) {
+ case 'Fraction':
+ if (this.indicatorsTemplate) {
+ this.renderIndicatorTemplate(indicatorBars, this.selectedIndex + 1);
+ }
+ else {
+ indicatorBars.innerText = this.selectedIndex + 1 + " / " + this.slideItems.length;
+ }
+ break;
+ case 'Progress':
+ if (this.indicatorsTemplate) {
+ this.renderIndicatorTemplate(indicatorBars, this.selectedIndex + 1);
+ }
+ else {
+ progress = this.createElement('div', { className: CLS_INDICATOR_BAR });
+ progress.style.setProperty('--carousel-items-current', "" + (this.selectedIndex + 1));
+ progress.style.setProperty('--carousel-items-count', "" + this.slideItems.length);
+ indicatorBars.appendChild(progress);
+ }
+ break;
+ case 'Default':
+ case 'Dynamic':
+ this.slideItems.forEach(function (item, index) {
+ var indicatorBar = _this.createElement('div', {
+ className: CLS_INDICATOR_BAR + ' ' + (_this.selectedIndex === index ? CLS_ACTIVE : _this.selectedIndex - 1 === index ? CLS_PREV_SLIDE : _this.selectedIndex + 1 === index ? CLS_NEXT_SLIDE : ''),
+ attrs: { 'data-index': index.toString(), 'aria-current': _this.selectedIndex === index ? 'true' : 'false' }
+ });
+ indicatorBar.style.setProperty('--carousel-items-current', "" + _this.selectedIndex);
+ if (_this.indicatorsTemplate) {
+ _this.renderIndicatorTemplate(indicatorBar, index);
+ }
+ else if (_this.indicatorsType === 'Default') {
+ var indicator = _this.createElement('button', { className: CLS_INDICATOR, attrs: { 'type': 'button', 'aria-label': _this.localeObj.getConstant('slide') + ' ' + (index + 1) + ' ' + _this.localeObj.getConstant('of') + ' ' + _this.slideItems.length } });
+ indicatorBar.appendChild(indicator);
+ indicator.appendChild(_this.createElement('div', {}));
+ var buttonObj = new _ej2_buttons__WEBPACK_IMPORTED_MODULE_1__["Button"]({ cssClass: 'e-flat e-small' });
+ buttonObj.appendTo(indicator);
+ }
+ indicatorBars.appendChild(indicatorBar);
+ if (_this.indicatorsType === 'Default') {
+ _ej2_base__WEBPACK_IMPORTED_MODULE_0__["EventHandler"].add(indicatorBar, 'click', _this.indicatorClickHandler, _this);
+ }
+ });
+ break;
+ }
+ }
+ this.element.appendChild(indicatorWrap);
+ };
+ Carousel.prototype.renderIndicatorTemplate = function (indicatorBar, index) {
+ if (index === void 0) { index = 0; }
+ Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["addClass"])([indicatorBar], CLS_TEMPLATE);
+ var templateId = this.element.id + '_indicatorsTemplate';
+ var template = this.templateParser(this.indicatorsTemplate)({ index: index, selectedIndex: this.selectedIndex }, this, 'indicatorsTemplate', templateId, false);
+ Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["append"])(template, indicatorBar);
+ };
+ Carousel.prototype.renderKeyboardActions = function () {
+ this.keyModule = new _ej2_base__WEBPACK_IMPORTED_MODULE_0__["KeyboardEvents"](this.element, { keyAction: this.keyHandler.bind(this), keyConfigs: this.keyConfigs });
+ };
+ Carousel.prototype.renderTouchActions = function () {
+ if (!this.enableTouchSwipe) {
+ return;
+ }
+ this.touchModule = new _ej2_base__WEBPACK_IMPORTED_MODULE_0__["Touch"](this.element, { swipe: this.swipeHandler.bind(this) });
+ };
+ Carousel.prototype.applyAnimation = function () {
+ Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["removeClass"])([this.element], [CLS_CUSTOM_ANIMATION, CLS_FADE_ANIMATION, CLS_SLIDE_ANIMATION, CLS_ANIMATION_NONE]);
+ switch (this.animationEffect) {
+ case 'Slide':
+ Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["addClass"])([this.element], CLS_SLIDE_ANIMATION);
+ break;
+ case 'Fade':
+ Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["addClass"])([this.element], CLS_FADE_ANIMATION);
+ break;
+ case 'None':
+ Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["addClass"])([this.element], CLS_ANIMATION_NONE);
+ break;
+ case 'Custom':
+ Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["addClass"])([this.element], CLS_CUSTOM_ANIMATION);
+ break;
+ }
+ };
+ Carousel.prototype.autoSlide = function () {
+ if (Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["isNullOrUndefined"])(this.slideItems) || this.slideItems.length <= 1) {
+ return;
+ }
+ this.resetSlideInterval();
+ this.applySlideInterval();
+ };
+ Carousel.prototype.autoSlideChange = function () {
+ var activeSlide = this.element.querySelector("." + CLS_ACTIVE);
+ if (Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["isNullOrUndefined"])(activeSlide)) {
+ return;
+ }
+ var activeIndex = parseInt(activeSlide.dataset.index, 10);
+ if (!this.loop && activeIndex === this.slideItems.length - 1) {
+ this.resetSlideInterval();
+ }
+ else {
+ var index = (activeIndex + 1) % this.slideItems.length;
+ if (!this.element.classList.contains(CLS_HOVER)) {
+ this.setActiveSlide(index, 'Next');
+ }
+ this.autoSlide();
+ }
+ };
+ Carousel.prototype.applySlideInterval = function () {
+ var _this = this;
+ if (!this.autoPlay || this.element.classList.contains(CLS_HOVER)) {
+ return;
+ }
+ var itemInterval = this.interval;
+ if (this.items.length > 0 && !Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["isNullOrUndefined"])(this.items[this.selectedIndex].interval)) {
+ itemInterval = this.items[this.selectedIndex].interval;
+ }
+ this.autoSlideInterval = setInterval(function () { return _this.autoSlideChange(); }, itemInterval);
+ };
+ Carousel.prototype.resetSlideInterval = function () {
+ clearInterval(this.autoSlideInterval);
+ this.autoSlideInterval = null;
+ };
+ Carousel.prototype.getSlideIndex = function (direction) {
+ var currentIndex = this.selectedIndex;
+ if (direction === 'Previous') {
+ currentIndex--;
+ if (currentIndex < 0) {
+ currentIndex = this.slideItems.length - 1;
+ }
+ }
+ else {
+ currentIndex++;
+ if (currentIndex === this.slideItems.length) {
+ currentIndex = 0;
+ }
+ }
+ return currentIndex;
+ };
+ Carousel.prototype.setActiveSlide = function (currentIndex, direction, isSwiped) {
+ var _this = this;
+ if (isSwiped === void 0) { isSwiped = false; }
+ if (this.element.querySelectorAll("." + CLS_ITEM + "." + CLS_PREV_SLIDE + ",." + CLS_ITEM + "." + CLS_NEXT_SLIDE).length > 0) {
+ return;
+ }
+ var allSlides = [].slice.call(this.element.querySelectorAll("." + CLS_ITEM + ":not(.e-cloned)"));
+ var activeSlide = this.element.querySelector("." + CLS_ITEM + "." + CLS_ACTIVE);
+ if (Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["isNullOrUndefined"])(activeSlide) && this.showIndicators) {
+ var activeIndicator = this.element.querySelector("." + CLS_INDICATOR_BAR + "." + CLS_ACTIVE);
+ var activeIndex_1 = parseInt(activeIndicator.dataset.index, 10);
+ Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["addClass"])([allSlides[parseInt(activeIndex_1.toString(), 10)]], CLS_ACTIVE);
+ return;
+ }
+ else if (Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["isNullOrUndefined"])(activeSlide)) {
+ Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["addClass"])([allSlides[parseInt(currentIndex.toString(), 10)]], CLS_ACTIVE);
+ return;
+ }
+ var activeIndex = parseInt(activeSlide.dataset.index, 10);
+ var currentSlide = allSlides[parseInt(currentIndex.toString(), 10)];
+ var eventArgs = {
+ currentIndex: activeIndex,
+ nextIndex: currentIndex,
+ currentSlide: activeSlide,
+ nextSlide: currentSlide,
+ slideDirection: direction,
+ isSwiped: isSwiped,
+ cancel: false
+ };
+ this.trigger('slideChanging', eventArgs, function (args) {
+ if (args.cancel) {
+ return;
+ }
+ _this.setProperties({ selectedIndex: currentIndex }, true);
+ Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["attributes"])(args.currentSlide, { 'aria-hidden': 'true' });
+ Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["attributes"])(args.nextSlide, { 'aria-hidden': 'false' });
+ _this.refreshIndicators(activeIndex, currentIndex);
+ _this.slideChangedEventArgs = {
+ currentIndex: args.nextIndex,
+ previousIndex: args.currentIndex,
+ currentSlide: args.nextSlide,
+ previousSlide: args.currentSlide,
+ slideDirection: direction,
+ isSwiped: isSwiped
+ };
+ var slideWidth = allSlides[parseInt(currentIndex.toString(), 10)].clientWidth;
+ var numOfItems = _this.getNumOfItems();
+ if (!_this.isSwipe) {
+ _this.itemsContainer.style.transitionDuration = '0.6s';
+ }
+ _this.isSwipe = false;
+ if ((_this.animationEffect === 'Fade')) {
+ _this.itemsContainer.classList.add('e-fade-in-out');
+ }
+ else {
+ _this.itemsContainer.style.transitionProperty = 'transform';
+ }
+ if (_this.loop) {
+ if (_this.slideChangedEventArgs.currentIndex === 0 && _this.slideChangedEventArgs.slideDirection === 'Next') {
+ _this.itemsContainer.style.transform = _this.getTranslateX(slideWidth, allSlides.length + numOfItems);
+ }
+ else if (_this.slideChangedEventArgs.currentIndex === _this.slideItems.length - 1 && _this.slideChangedEventArgs.slideDirection === 'Previous') {
+ _this.itemsContainer.style.transform = _this.partialVisible ? _this.getTranslateX(slideWidth) : 'translateX(0px)';
+ }
+ else {
+ _this.itemsContainer.style.transform = _this.getTranslateX(slideWidth, currentIndex + numOfItems);
+ }
+ }
+ else {
+ _this.itemsContainer.style.transform = _this.getTranslateX(slideWidth, currentIndex);
+ }
+ if (_this.animationEffect === 'Slide') {
+ if (direction === 'Previous') {
+ Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["addClass"])([args.nextSlide], CLS_PREV_SLIDE);
+ args.nextSlide.setAttribute('data-slide-height', args.nextSlide.offsetHeight.toString());
+ Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["addClass"])([args.currentSlide, args.nextSlide], CLS_TRANSITION_END);
+ }
+ else {
+ Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["addClass"])([args.nextSlide], CLS_NEXT_SLIDE);
+ args.nextSlide.setAttribute('data-slide-height', args.nextSlide.offsetHeight.toString());
+ Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["addClass"])([args.currentSlide, args.nextSlide], CLS_TRANSITION_START);
+ }
+ }
+ else if (_this.animationEffect === 'Fade') {
+ Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["removeClass"])([args.currentSlide], CLS_ACTIVE);
+ Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["addClass"])([args.nextSlide], CLS_ACTIVE);
+ }
+ else if (_this.animationEffect === 'Custom') {
+ if (direction === 'Previous') {
+ Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["addClass"])([args.nextSlide], CLS_NEXT_SLIDE);
+ Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["addClass"])([args.currentSlide], CLS_PREV_SLIDE);
+ }
+ else {
+ Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["addClass"])([args.currentSlide], CLS_PREV_SLIDE);
+ Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["addClass"])([args.nextSlide], CLS_NEXT_SLIDE);
+ }
+ }
+ else {
+ _this.onTransitionEnd();
+ }
+ _this.handleNavigatorsActions(currentIndex);
+ });
+ };
+ Carousel.prototype.onTransitionEnd = function () {
+ var _this = this;
+ Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["removeClass"])(this.element.querySelectorAll("." + CLS_ITEMS), 'e-fade-in-out');
+ var numOfItems = this.getNumOfItems();
+ if (this.slideChangedEventArgs) {
+ this.itemsContainer.style.transitionProperty = 'none';
+ if (this.loop && (this.slideChangedEventArgs.currentIndex === 0 && this.slideChangedEventArgs.slideDirection === 'Next' ||
+ this.slideChangedEventArgs.currentIndex === this.slideItems.length - 1 && this.slideChangedEventArgs.slideDirection === 'Previous')) {
+ var slideWidth = this.slideChangedEventArgs.currentSlide.clientWidth;
+ this.itemsContainer.style.transform = this.getTranslateX(slideWidth, this.slideChangedEventArgs.currentIndex + numOfItems);
+ }
+ Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["addClass"])([this.slideChangedEventArgs.currentSlide], CLS_ACTIVE);
+ Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["removeClass"])([this.slideChangedEventArgs.previousSlide], CLS_ACTIVE);
+ this.trigger('slideChanged', this.slideChangedEventArgs, function () {
+ Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["removeClass"])(_this.element.querySelectorAll("." + CLS_ITEM), [CLS_PREV_SLIDE, CLS_NEXT_SLIDE, CLS_TRANSITION_START, CLS_TRANSITION_END]);
+ _this.slideChangedEventArgs = null;
+ });
+ }
+ };
+ Carousel.prototype.refreshIndicators = function (activeIndex, currentIndex) {
+ var _this = this;
+ var slideIndicator = this.element.querySelector("." + CLS_INDICATOR_BARS);
+ if (Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["isNullOrUndefined"])(slideIndicator)) {
+ return;
+ }
+ var indicators = [].slice.call(slideIndicator.childNodes);
+ switch (this.indicatorsType) {
+ case 'Default':
+ case 'Dynamic':
+ Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["attributes"])(indicators[parseInt(activeIndex.toString(), 10)], { 'aria-current': 'false' });
+ Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["attributes"])(indicators[parseInt(currentIndex.toString(), 10)], { 'aria-current': 'true' });
+ Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["removeClass"])(indicators, [CLS_ACTIVE, CLS_PREV_SLIDE, CLS_NEXT_SLIDE]);
+ Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["addClass"])([indicators[parseInt(currentIndex.toString(), 10)]], CLS_ACTIVE);
+ if (indicators[currentIndex - 1]) {
+ Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["addClass"])([indicators[currentIndex - 1]], CLS_PREV_SLIDE);
+ }
+ if (indicators[currentIndex + 1]) {
+ Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["addClass"])([indicators[currentIndex + 1]], CLS_NEXT_SLIDE);
+ }
+ indicators.forEach(function (item) { return item.style.setProperty('--carousel-items-current', "" + _this.selectedIndex); });
+ break;
+ case 'Fraction':
+ if (this.indicatorsTemplate) {
+ if (slideIndicator.children.length > 0) {
+ slideIndicator.removeChild(slideIndicator.firstElementChild);
+ }
+ this.renderIndicatorTemplate(slideIndicator, currentIndex + 1);
+ }
+ else {
+ slideIndicator.innerText = this.selectedIndex + 1 + " / " + this.slideItems.length;
+ }
+ break;
+ case 'Progress':
+ if (this.indicatorsTemplate) {
+ if (slideIndicator.children.length > 0) {
+ slideIndicator.removeChild(slideIndicator.firstElementChild);
+ }
+ this.renderIndicatorTemplate(slideIndicator, currentIndex + 1);
+ }
+ else {
+ slideIndicator.firstElementChild.style.setProperty('--carousel-items-current', "" + (this.selectedIndex + 1));
+ }
+ break;
+ }
+ };
+ Carousel.prototype.setHtmlAttributes = function (attribute, element) {
+ var keys = Object.keys(attribute);
+ for (var _i = 0, keys_1 = keys; _i < keys_1.length; _i++) {
+ var key = keys_1[_i];
+ if (key === 'class') {
+ Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["addClass"])([element], attribute["" + key]);
+ }
+ else {
+ element.setAttribute(key, attribute["" + key]);
+ }
+ }
+ };
+ Carousel.prototype.templateParser = function (template) {
+ if (template) {
+ try {
+ if (typeof template !== 'function' && document.querySelectorAll(template).length) {
+ return Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["compile"])(document.querySelector(template).innerHTML.trim());
+ }
+ else {
+ return Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["compile"])(template);
+ }
+ }
+ catch (error) {
+ return Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["compile"])(template);
+ }
+ }
+ return undefined;
+ };
+ Carousel.prototype.getNavigatorState = function (target, isPrevious) {
+ var button = target.querySelector("." + (isPrevious ? CLS_PREV_BUTTON : CLS_NEXT_BUTTON));
+ if (button) {
+ var buttonObj = Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["getInstance"])(button, _ej2_buttons__WEBPACK_IMPORTED_MODULE_1__["Button"]);
+ return buttonObj.disabled;
+ }
+ return false;
+ };
+ Carousel.prototype.navigatorClickHandler = function (e) {
+ var target = e.currentTarget;
+ var isDisabled = this.getNavigatorState(target, target.classList.contains(CLS_PREVIOUS));
+ if (isDisabled) {
+ return;
+ }
+ var direction = target.classList.contains(CLS_PREVIOUS) ? 'Previous' : 'Next';
+ this.setActiveSlide(this.getSlideIndex(direction), direction);
+ this.autoSlide();
+ };
+ Carousel.prototype.indicatorClickHandler = function (e) {
+ var target = Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["closest"])(e.target, "." + CLS_INDICATOR_BAR);
+ var index = parseInt(target.dataset.index, 10);
+ if (this.selectedIndex !== index) {
+ this.setActiveSlide(index, this.selectedIndex > index ? 'Previous' : 'Next');
+ this.autoSlide();
+ }
+ };
+ Carousel.prototype.playButtonClickHandler = function (e, isPropertyChange) {
+ if (isPropertyChange === void 0) { isPropertyChange = false; }
+ var playButton = this.element.querySelector("." + CLS_PLAY_BUTTON);
+ if (playButton) {
+ var buttonObj = Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["getInstance"])(playButton, _ej2_buttons__WEBPACK_IMPORTED_MODULE_1__["Button"]);
+ if (!isPropertyChange) {
+ this.setProperties({ autoPlay: !this.autoPlay }, true);
+ }
+ playButton.setAttribute('aria-label', this.localeObj.getConstant(this.autoPlay ? 'pauseSlideTransition' : 'playSlideTransition'));
+ buttonObj.iconCss = CLS_ICON + ' ' + (this.autoPlay ? CLS_PAUSE_ICON : CLS_PLAY_ICON);
+ buttonObj.dataBind();
+ this.itemsContainer.setAttribute('aria-live', this.autoPlay ? 'off' : 'polite');
+ if (this.autoPlay && !this.loop && this.selectedIndex === this.slideItems.length - 1) {
+ this.setActiveSlide(0, 'Next');
+ }
+ this.autoSlide();
+ }
+ };
+ Carousel.prototype.keyHandler = function (e) {
+ var direction;
+ var slideIndex;
+ var isSlideTransition = false;
+ var target = e.target;
+ e.preventDefault();
+ switch (e.action) {
+ case 'space':
+ if (this.showIndicators && target.classList.contains(CLS_INDICATOR)) {
+ target.click();
+ }
+ else if (target.classList.contains(CLS_CAROUSEL) || target.classList.contains(CLS_PLAY_BUTTON)) {
+ this.playButtonClickHandler(e);
+ }
+ else if (target.classList.contains(CLS_NEXT_BUTTON)) {
+ this.next();
+ }
+ else if (target.classList.contains(CLS_PREV_BUTTON)) {
+ this.prev();
+ }
+ break;
+ case 'end':
+ slideIndex = this.slideItems.length - 1;
+ direction = 'Next';
+ isSlideTransition = true;
+ break;
+ case 'home':
+ slideIndex = 0;
+ direction = 'Previous';
+ isSlideTransition = true;
+ break;
+ case 'moveUp':
+ case 'moveLeft':
+ case 'moveDown':
+ case 'moveRight':
+ if (this.showIndicators && Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["isNullOrUndefined"])(this.indicatorsTemplate)) {
+ this.element.focus();
+ }
+ direction = (e.action === 'moveUp' || e.action === 'moveLeft') ? 'Previous' : 'Next';
+ slideIndex = this.getSlideIndex(direction);
+ isSlideTransition = !this.isSuspendSlideTransition(slideIndex, direction);
+ break;
+ }
+ if (isSlideTransition) {
+ this.setActiveSlide(slideIndex, direction);
+ this.autoSlide();
+ isSlideTransition = false;
+ }
+ };
+ Carousel.prototype.swipeHandler = function (e) {
+ if (this.element.classList.contains(CLS_HOVER) || Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["isNullOrUndefined"])(this.slideItems) || this.slideItems.length <= 1) {
+ return;
+ }
+ var direction = (e.swipeDirection === 'Right') ? 'Previous' : 'Next';
+ var slideIndex = this.getSlideIndex(direction);
+ if (!this.isSuspendSlideTransition(slideIndex, direction)) {
+ this.setActiveSlide(slideIndex, direction, true);
+ this.autoSlide();
+ }
+ };
+ Carousel.prototype.isSuspendSlideTransition = function (index, direction) {
+ return !this.loop && (direction === 'Next' && index === 0 || direction === 'Previous' && index === this.slideItems.length - 1);
+ };
+ Carousel.prototype.handleNavigatorsActions = function (index) {
+ if (this.buttonsVisibility === 'Hidden') {
+ return;
+ }
+ if (this.showPlayButton) {
+ var playButton = this.element.querySelector("." + CLS_PLAY_BUTTON);
+ var isLastSlide = this.selectedIndex === this.slideItems.length - 1 && !this.loop;
+ var isButtonUpdate = Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["isNullOrUndefined"])(this.playButtonTemplate) && playButton && isLastSlide;
+ if (Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["isNullOrUndefined"])(this.playButtonTemplate) && playButton && !isLastSlide) {
+ isButtonUpdate = !playButton.classList.contains(CLS_ACTIVE);
+ }
+ if (isButtonUpdate) {
+ this.setProperties({ autoPlay: !isLastSlide }, true);
+ playButton.setAttribute('aria-label', this.localeObj.getConstant(this.autoPlay ? 'pauseSlideTransition' : 'playSlideTransition'));
+ this.itemsContainer.setAttribute('aria-live', this.autoPlay ? 'off' : 'polite');
+ var buttonObj = Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["getInstance"])(playButton, _ej2_buttons__WEBPACK_IMPORTED_MODULE_1__["Button"]);
+ buttonObj.iconCss = CLS_ICON + ' ' + (this.autoPlay ? CLS_PAUSE_ICON : CLS_PLAY_ICON);
+ buttonObj.dataBind();
+ }
+ }
+ var prevButton = this.element.querySelector("." + CLS_PREV_BUTTON);
+ if (prevButton && Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["isNullOrUndefined"])(this.previousButtonTemplate)) {
+ var buttonObj = Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["getInstance"])(prevButton, _ej2_buttons__WEBPACK_IMPORTED_MODULE_1__["Button"]);
+ buttonObj.disabled = !this.loop && index === 0;
+ buttonObj.dataBind();
+ }
+ var nextButton = this.element.querySelector("." + CLS_NEXT_BUTTON);
+ if (nextButton && Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["isNullOrUndefined"])(this.nextButtonTemplate)) {
+ var buttonObj = Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["getInstance"])(nextButton, _ej2_buttons__WEBPACK_IMPORTED_MODULE_1__["Button"]);
+ buttonObj.disabled = !this.loop && index === this.slideItems.length - 1;
+ buttonObj.dataBind();
+ }
+ };
+ Carousel.prototype.onHoverActions = function (e) {
+ var navigator = this.element.querySelector("." + CLS_NAVIGATORS);
+ switch (e.type) {
+ case 'mouseenter':
+ if (this.buttonsVisibility === 'VisibleOnHover' && navigator) {
+ Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["removeClass"])([].slice.call(navigator.childNodes), CLS_HOVER_ARROWS);
+ }
+ if (this.pauseOnHover) {
+ Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["addClass"])([this.element], CLS_HOVER);
+ }
+ break;
+ case 'mouseleave':
+ if (this.buttonsVisibility === 'VisibleOnHover' && navigator) {
+ Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["addClass"])([].slice.call(navigator.childNodes), CLS_HOVER_ARROWS);
+ }
+ Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["removeClass"])([this.element], CLS_HOVER);
+ break;
+ }
+ this.autoSlide();
+ };
+ Carousel.prototype.onFocusActions = function (e) {
+ switch (e.type) {
+ case 'focusin':
+ Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["addClass"])([this.element], CLS_HOVER);
+ break;
+ case 'focusout':
+ Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["removeClass"])([this.element], CLS_HOVER);
+ break;
+ }
+ this.autoSlide();
+ };
+ Carousel.prototype.destroyButtons = function () {
+ var buttonCollections = [].slice.call(this.element.querySelectorAll('.e-control.e-btn'));
+ for (var _i = 0, buttonCollections_1 = buttonCollections; _i < buttonCollections_1.length; _i++) {
+ var button = buttonCollections_1[_i];
+ var instance = Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["getInstance"])(button, _ej2_buttons__WEBPACK_IMPORTED_MODULE_1__["Button"]);
+ if (instance) {
+ instance.destroy();
+ }
+ }
+ };
+ Carousel.prototype.getNumOfItems = function () {
+ return this.partialVisible ? 2 : 1;
+ };
+ Carousel.prototype.getTranslateValue = function (element) {
+ var style = getComputedStyle(element);
+ return window.WebKitCSSMatrix ?
+ new WebKitCSSMatrix(style.webkitTransform).m41 : 0;
+ };
+ Carousel.prototype.swipeStart = function (e) {
+ if (!this.timeStampStart) {
+ this.timeStampStart = Date.now();
+ }
+ this.isSwipe = false;
+ this.itemsContainer.classList.add('e-swipe-start');
+ this.prevPageX = e.touches ? e.touches[0].pageX : e.pageX;
+ this.initialTranslate = this.getTranslateValue(this.itemsContainer);
+ };
+ Carousel.prototype.swiping = function (e) {
+ if (!this.itemsContainer.classList.contains('e-swipe-start')) {
+ return;
+ }
+ e.preventDefault();
+ var pageX = e.touches ? e.touches[0].pageX : e.pageX;
+ var positionDiff = this.prevPageX - (pageX);
+ if (!this.loop && ((this.enableRtl && ((this.selectedIndex === 0 && positionDiff > 0) ||
+ (this.selectedIndex === this.itemsContainer.childElementCount - 1 && positionDiff < 0))) ||
+ (!this.enableRtl && ((this.selectedIndex === 0 && positionDiff < 0) ||
+ (this.selectedIndex === this.itemsContainer.childElementCount - 1 && positionDiff > 0))))) {
+ return;
+ }
+ this.itemsContainer.style.transform = "translateX(" + (this.initialTranslate + (this.enableRtl ? positionDiff : -positionDiff)) + "px)";
+ };
+ Carousel.prototype.swipStop = function () {
+ this.isSwipe = true;
+ var time = Date.now() - this.timeStampStart;
+ var distanceX = this.getTranslateValue(this.itemsContainer) - this.initialTranslate;
+ distanceX = distanceX < 0 ? distanceX * -1 : distanceX;
+ if (this.isSwipe) {
+ var offsetDist = distanceX * (_ej2_base__WEBPACK_IMPORTED_MODULE_0__["Browser"].isDevice ? 6 : 1.66);
+ this.itemsContainer.style.transitionDuration = (((_ej2_base__WEBPACK_IMPORTED_MODULE_0__["Browser"].isDevice ? distanceX : offsetDist) / time) / 10) + 's';
+ }
+ var slideWidth = this.itemsContainer.firstElementChild.clientWidth;
+ var threshold = slideWidth / 2;
+ this.itemsContainer.classList.remove('e-swipe-start');
+ var value = this.getTranslateValue(this.itemsContainer);
+ if (value - this.initialTranslate < -threshold) {
+ this.swipeNavigation(!this.enableRtl);
+ }
+ else if (value - this.initialTranslate > threshold) {
+ this.swipeNavigation(this.enableRtl);
+ }
+ else {
+ this.itemsContainer.style.transform = "translateX(" + this.initialTranslate + "px)";
+ if (this.animationEffect === 'Fade') {
+ this.itemsContainer.classList.add('e-fade-in-out');
+ }
+ }
+ };
+ Carousel.prototype.swipeNavigation = function (isRtl) {
+ if (isRtl) {
+ this.next();
+ }
+ else {
+ this.prev();
+ }
+ };
+ Carousel.prototype.swipeModehandlers = function () {
+ if ((this.swipeMode & CarouselSwipeMode.Touch) === CarouselSwipeMode.Touch) {
+ _ej2_base__WEBPACK_IMPORTED_MODULE_0__["EventHandler"].add(this.itemsContainer, 'touchstart', this.swipeStart, this);
+ _ej2_base__WEBPACK_IMPORTED_MODULE_0__["EventHandler"].add(this.itemsContainer, 'touchmove', this.swiping, this);
+ _ej2_base__WEBPACK_IMPORTED_MODULE_0__["EventHandler"].add(this.itemsContainer, 'touchend', this.swipStop, this);
+ }
+ if ((this.swipeMode & CarouselSwipeMode.Mouse) === CarouselSwipeMode.Mouse) {
+ _ej2_base__WEBPACK_IMPORTED_MODULE_0__["EventHandler"].add(this.itemsContainer, 'mousedown', this.swipeStart, this);
+ _ej2_base__WEBPACK_IMPORTED_MODULE_0__["EventHandler"].add(this.itemsContainer, 'mousemove', this.swiping, this);
+ _ej2_base__WEBPACK_IMPORTED_MODULE_0__["EventHandler"].add(this.itemsContainer, 'mouseup', this.swipStop, this);
+ }
+ if ((this.swipeMode === 0) && (this.swipeMode & CarouselSwipeMode.Mouse & CarouselSwipeMode.Touch) ===
+ (CarouselSwipeMode.Mouse & CarouselSwipeMode.Touch)) {
+ _ej2_base__WEBPACK_IMPORTED_MODULE_0__["EventHandler"].add(this.itemsContainer, 'mousedown touchstart', this.swipeStart, this);
+ _ej2_base__WEBPACK_IMPORTED_MODULE_0__["EventHandler"].add(this.itemsContainer, 'mousemove touchmove', this.swiping, this);
+ _ej2_base__WEBPACK_IMPORTED_MODULE_0__["EventHandler"].add(this.itemsContainer, 'mouseup touchend', this.swipStop, this);
+ }
+ };
+ Carousel.prototype.wireEvents = function () {
+ if (!(this.animationEffect === 'Custom')) {
+ this.swipeModehandlers();
+ }
+ _ej2_base__WEBPACK_IMPORTED_MODULE_0__["EventHandler"].add(this.element, 'focusin focusout', this.onFocusActions, this);
+ _ej2_base__WEBPACK_IMPORTED_MODULE_0__["EventHandler"].add(this.element, 'mouseenter mouseleave', this.onHoverActions, this);
+ _ej2_base__WEBPACK_IMPORTED_MODULE_0__["EventHandler"].add(this.element.firstElementChild, 'animationend', this.onTransitionEnd, this);
+ _ej2_base__WEBPACK_IMPORTED_MODULE_0__["EventHandler"].add(this.element.firstElementChild, 'transitionend', this.onTransitionEnd, this);
+ };
+ Carousel.prototype.unWireEvents = function () {
+ var _this = this;
+ var indicators = [].slice.call(this.element.querySelectorAll("." + CLS_INDICATOR_BAR));
+ indicators.forEach(function (indicator) {
+ _ej2_base__WEBPACK_IMPORTED_MODULE_0__["EventHandler"].remove(indicator, 'click', _this.indicatorClickHandler);
+ });
+ var navigators = [].slice.call(this.element.querySelectorAll("." + CLS_PREVIOUS + ",." + CLS_NEXT));
+ navigators.forEach(function (navigator) {
+ _ej2_base__WEBPACK_IMPORTED_MODULE_0__["EventHandler"].remove(navigator, 'click', _this.navigatorClickHandler);
+ });
+ var playIcon = this.element.querySelector("." + CLS_PLAY_PAUSE);
+ if (playIcon) {
+ _ej2_base__WEBPACK_IMPORTED_MODULE_0__["EventHandler"].remove(playIcon, 'click', this.playButtonClickHandler);
+ }
+ _ej2_base__WEBPACK_IMPORTED_MODULE_0__["EventHandler"].remove(this.element.firstElementChild, 'animationend', this.onTransitionEnd);
+ _ej2_base__WEBPACK_IMPORTED_MODULE_0__["EventHandler"].remove(this.element.firstElementChild, 'transitionend', this.onTransitionEnd);
+ _ej2_base__WEBPACK_IMPORTED_MODULE_0__["EventHandler"].clearEvents(this.element);
+ };
+ /**
+ * Method to transit from the current slide to the previous slide.
+ *
+ * @returns {void}
+ */
+ Carousel.prototype.prev = function () {
+ if (!this.loop && this.selectedIndex === 0) {
+ return;
+ }
+ var index = (this.selectedIndex === 0) ? this.slideItems.length - 1 : this.selectedIndex - 1;
+ this.setActiveSlide(index, 'Previous');
+ this.autoSlide();
+ };
+ /**
+ * Method to transit from the current slide to the next slide.
+ *
+ * @returns {void}
+ */
+ Carousel.prototype.next = function () {
+ if (!this.loop && this.selectedIndex === this.slideItems.length - 1) {
+ return;
+ }
+ var index = (this.selectedIndex === this.slideItems.length - 1) ? 0 : this.selectedIndex + 1;
+ this.setActiveSlide(index, 'Next');
+ this.autoSlide();
+ };
+ /**
+ * Method to play the slides programmatically.
+ *
+ * @returns {void}
+ */
+ Carousel.prototype.play = function () {
+ var playIcon = this.element.querySelector("." + CLS_PLAY_ICON);
+ if (this.showPlayButton && playIcon) {
+ Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["classList"])(playIcon, [CLS_PAUSE_ICON], [CLS_PLAY_ICON]);
+ var playButton = this.element.querySelector("." + CLS_PLAY_BUTTON);
+ playButton.setAttribute('aria-label', this.localeObj.getConstant('pauseSlideTransition'));
+ }
+ this.setProperties({ autoPlay: true }, true);
+ this.itemsContainer.setAttribute('aria-live', 'off');
+ this.applySlideInterval();
+ };
+ /**
+ * Method to pause the slides programmatically.
+ *
+ * @returns {void}
+ */
+ Carousel.prototype.pause = function () {
+ var pauseIcon = this.element.querySelector("." + CLS_PAUSE_ICON);
+ if (this.showPlayButton && pauseIcon) {
+ var playButton = this.element.querySelector("." + CLS_PLAY_BUTTON);
+ playButton.setAttribute('aria-label', this.localeObj.getConstant('playSlideTransition'));
+ Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["classList"])(pauseIcon, [CLS_PLAY_ICON], [CLS_PAUSE_ICON]);
+ }
+ this.setProperties({ autoPlay: false }, true);
+ this.itemsContainer.setAttribute('aria-live', 'off');
+ this.resetSlideInterval();
+ };
+ /**
+ * Method to render react and angular templates
+ *
+ * @returns {void}
+ * @private
+ */
+ Carousel.prototype.renderTemplates = function () {
+ if (this.isAngular || this.isReact) {
+ this.renderReactTemplates();
+ }
+ };
+ /**
+ * Method to reset react and angular templates
+ *
+ * @param {string[]} templates Accepts the template ID
+ * @returns {void}
+ * @private
+ */
+ Carousel.prototype.resetTemplates = function (templates) {
+ if (this.isAngular || this.isReact) {
+ this.clearTemplate(templates);
+ }
+ };
+ /**
+ * Method for destroy the carousel component.
+ *
+ * @returns {void}
+ */
+ Carousel.prototype.destroy = function () {
+ var _this = this;
+ this.resetTemplates();
+ if (this.touchModule) {
+ this.touchModule.destroy();
+ this.touchModule = null;
+ }
+ this.keyModule.destroy();
+ this.keyModule = null;
+ this.resetSlideInterval();
+ this.destroyButtons();
+ this.unWireEvents();
+ [].slice.call(this.element.children).forEach(function (ele) { _this.element.removeChild(ele); });
+ Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["removeClass"])([this.element], [CLS_CAROUSEL, this.cssClass, CLS_RTL]);
+ ['tabindex', 'role', 'style'].forEach(function (attr) { _this.element.removeAttribute(attr); });
+ _super.prototype.destroy.call(this);
+ };
+ __decorate([
+ Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["Collection"])([], CarouselItem)
+ ], Carousel.prototype, "items", void 0);
+ __decorate([
+ Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["Property"])('Slide')
+ ], Carousel.prototype, "animationEffect", void 0);
+ __decorate([
+ Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["Property"])()
+ ], Carousel.prototype, "previousButtonTemplate", void 0);
+ __decorate([
+ Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["Property"])()
+ ], Carousel.prototype, "nextButtonTemplate", void 0);
+ __decorate([
+ Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["Property"])()
+ ], Carousel.prototype, "indicatorsTemplate", void 0);
+ __decorate([
+ Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["Property"])()
+ ], Carousel.prototype, "playButtonTemplate", void 0);
+ __decorate([
+ Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["Property"])()
+ ], Carousel.prototype, "cssClass", void 0);
+ __decorate([
+ Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["Property"])([])
+ ], Carousel.prototype, "dataSource", void 0);
+ __decorate([
+ Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["Property"])()
+ ], Carousel.prototype, "itemTemplate", void 0);
+ __decorate([
+ Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["Property"])(0)
+ ], Carousel.prototype, "selectedIndex", void 0);
+ __decorate([
+ Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["Property"])('100%')
+ ], Carousel.prototype, "width", void 0);
+ __decorate([
+ Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["Property"])('100%')
+ ], Carousel.prototype, "height", void 0);
+ __decorate([
+ Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["Property"])(5000)
+ ], Carousel.prototype, "interval", void 0);
+ __decorate([
+ Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["Property"])(true)
+ ], Carousel.prototype, "autoPlay", void 0);
+ __decorate([
+ Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["Property"])(true)
+ ], Carousel.prototype, "pauseOnHover", void 0);
+ __decorate([
+ Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["Property"])(true)
+ ], Carousel.prototype, "loop", void 0);
+ __decorate([
+ Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["Property"])(false)
+ ], Carousel.prototype, "showPlayButton", void 0);
+ __decorate([
+ Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["Property"])(true)
+ ], Carousel.prototype, "enableTouchSwipe", void 0);
+ __decorate([
+ Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["Property"])(true)
+ ], Carousel.prototype, "showIndicators", void 0);
+ __decorate([
+ Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["Property"])('Default')
+ ], Carousel.prototype, "indicatorsType", void 0);
+ __decorate([
+ Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["Property"])('Visible')
+ ], Carousel.prototype, "buttonsVisibility", void 0);
+ __decorate([
+ Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["Property"])(false)
+ ], Carousel.prototype, "partialVisible", void 0);
+ __decorate([
+ Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["Property"])(CarouselSwipeMode.Touch)
+ ], Carousel.prototype, "swipeMode", void 0);
+ __decorate([
+ Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["Property"])()
+ ], Carousel.prototype, "htmlAttributes", void 0);
+ __decorate([
+ Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["Event"])()
+ ], Carousel.prototype, "slideChanging", void 0);
+ __decorate([
+ Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["Event"])()
+ ], Carousel.prototype, "slideChanged", void 0);
+ Carousel = __decorate([
+ _ej2_base__WEBPACK_IMPORTED_MODULE_0__["NotifyPropertyChanges"]
+ ], Carousel);
+ return Carousel;
+}(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["Component"]));
+
+
+
+/***/ }),
+
+/***/ "./ej2-resources/22.1.37/scripts/ej2-navigations/carousel/index.js":
+/*!*************************************************************************!*\
+ !*** ./ej2-resources/22.1.37/scripts/ej2-navigations/carousel/index.js ***!
+ \*************************************************************************/
+/*! exports provided: CarouselSwipeMode, CarouselItem, Carousel */
+/***/ (function(module, __webpack_exports__, __webpack_require__) {
+
+"use strict";
+__webpack_require__.r(__webpack_exports__);
+/* harmony import */ var _carousel__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./carousel */ "./ej2-resources/22.1.37/scripts/ej2-navigations/carousel/carousel.js");
+/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "CarouselSwipeMode", function() { return _carousel__WEBPACK_IMPORTED_MODULE_0__["CarouselSwipeMode"]; });
+
+/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "CarouselItem", function() { return _carousel__WEBPACK_IMPORTED_MODULE_0__["CarouselItem"]; });
+
+/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Carousel", function() { return _carousel__WEBPACK_IMPORTED_MODULE_0__["Carousel"]; });
+
+/** Carousel export modules */
+
+
+
+/***/ }),
+
+/***/ "./ej2-resources/22.1.37/scripts/ej2-navigations/common/h-scroll.js":
+/*!**************************************************************************!*\
+ !*** ./ej2-resources/22.1.37/scripts/ej2-navigations/common/h-scroll.js ***!
+ \**************************************************************************/
+/*! exports provided: HScroll */
+/***/ (function(module, __webpack_exports__, __webpack_require__) {
+
+"use strict";
+__webpack_require__.r(__webpack_exports__);
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "HScroll", function() { return HScroll; });
+/* harmony import */ var _ej2_base__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../ej2-base */ "./ej2-resources/22.1.37/scripts/ej2-base/index.js");
+var __extends = (undefined && undefined.__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 = (undefined && undefined.__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 CLS_ROOT = 'e-hscroll';
+var CLS_RTL = 'e-rtl';
+var CLS_DISABLE = 'e-overlay';
+var CLS_HSCROLLBAR = 'e-hscroll-bar';
+var CLS_HSCROLLCON = 'e-hscroll-content';
+var CLS_NAVARROW = 'e-nav-arrow';
+var CLS_NAVRIGHTARROW = 'e-nav-right-arrow';
+var CLS_NAVLEFTARROW = 'e-nav-left-arrow';
+var CLS_HSCROLLNAV = 'e-scroll-nav';
+var CLS_HSCROLLNAVRIGHT = 'e-scroll-right-nav';
+var CLS_HSCROLLNAVLEFT = 'e-scroll-left-nav';
+var CLS_DEVICE = 'e-scroll-device';
+var CLS_OVERLAY = 'e-scroll-overlay';
+var CLS_RIGHTOVERLAY = 'e-scroll-right-overlay';
+var CLS_LEFTOVERLAY = 'e-scroll-left-overlay';
+var OVERLAY_MAXWID = 40;
+/**
+ * HScroll module is introduces horizontal scroller when content exceeds the current viewing area.
+ * It can be useful for the components like Toolbar, Tab which needs horizontal scrolling alone.
+ * Hidden content can be view by touch moving or icon click.
+ * ```html
+ *
+ *
+ * ```
+ */
+var HScroll = /** @__PURE__ @class */ (function (_super) {
+ __extends(HScroll, _super);
+ /**
+ * Initializes a new instance of the HScroll class.
+ *
+ * @param {HScrollModel} options - Specifies HScroll model properties as options.
+ * @param {string | HTMLElement} element - Specifies the element for which horizontal scrolling applies.
+ */
+ function HScroll(options, element) {
+ return _super.call(this, options, element) || this;
+ }
+ /**
+ * Initialize the event handler
+ *
+ * @private
+ * @returns {void}
+ */
+ HScroll.prototype.preRender = function () {
+ this.browser = _ej2_base__WEBPACK_IMPORTED_MODULE_0__["Browser"].info.name;
+ this.browserCheck = this.browser === 'mozilla';
+ this.isDevice = _ej2_base__WEBPACK_IMPORTED_MODULE_0__["Browser"].isDevice;
+ this.customStep = true;
+ var element = this.element;
+ this.ieCheck = this.browser === 'edge' || this.browser === 'msie';
+ this.initialize();
+ if (element.id === '') {
+ element.id = Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["getUniqueID"])('hscroll');
+ this.uniqueId = true;
+ }
+ element.style.display = 'block';
+ if (this.enableRtl) {
+ element.classList.add(CLS_RTL);
+ }
+ };
+ /**
+ * To Initialize the horizontal scroll rendering
+ *
+ * @private
+ * @returns {void}
+ */
+ HScroll.prototype.render = function () {
+ this.touchModule = new _ej2_base__WEBPACK_IMPORTED_MODULE_0__["Touch"](this.element, { scroll: this.touchHandler.bind(this), swipe: this.swipeHandler.bind(this) });
+ _ej2_base__WEBPACK_IMPORTED_MODULE_0__["EventHandler"].add(this.scrollEle, 'scroll', this.scrollHandler, this);
+ if (!this.isDevice) {
+ this.createNavIcon(this.element);
+ }
+ else {
+ this.element.classList.add(CLS_DEVICE);
+ this.createOverlay(this.element);
+ }
+ this.setScrollState();
+ };
+ HScroll.prototype.setScrollState = function () {
+ if (Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["isNullOrUndefined"])(this.scrollStep) || this.scrollStep < 0) {
+ this.scrollStep = this.scrollEle.offsetWidth;
+ this.customStep = false;
+ }
+ else {
+ this.customStep = true;
+ }
+ };
+ HScroll.prototype.initialize = function () {
+ var scrollEle = this.createElement('div', { className: CLS_HSCROLLCON });
+ var scrollDiv = this.createElement('div', { className: CLS_HSCROLLBAR });
+ scrollDiv.setAttribute('tabindex', '-1');
+ var ele = this.element;
+ var innerEle = [].slice.call(ele.children);
+ for (var _i = 0, innerEle_1 = innerEle; _i < innerEle_1.length; _i++) {
+ var ele_1 = innerEle_1[_i];
+ scrollEle.appendChild(ele_1);
+ }
+ scrollDiv.appendChild(scrollEle);
+ ele.appendChild(scrollDiv);
+ scrollDiv.style.overflowX = 'hidden';
+ this.scrollEle = scrollDiv;
+ this.scrollItems = scrollEle;
+ };
+ HScroll.prototype.getPersistData = function () {
+ var keyEntity = ['scrollStep'];
+ return this.addOnPersist(keyEntity);
+ };
+ /**
+ * Returns the current module name.
+ *
+ * @returns {string} - It returns the current module name.
+ * @private
+ */
+ HScroll.prototype.getModuleName = function () {
+ return 'hScroll';
+ };
+ /**
+ * Removes the control from the DOM and also removes all its related events.
+ *
+ * @returns {void}
+ */
+ HScroll.prototype.destroy = function () {
+ var ele = this.element;
+ ele.style.display = '';
+ ele.classList.remove(CLS_ROOT);
+ ele.classList.remove(CLS_DEVICE);
+ ele.classList.remove(CLS_RTL);
+ var nav = Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["selectAll"])('.e-' + ele.id + '_nav.' + CLS_HSCROLLNAV, ele);
+ var overlay = Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["selectAll"])('.' + CLS_OVERLAY, ele);
+ [].slice.call(overlay).forEach(function (ele) {
+ Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["detach"])(ele);
+ });
+ for (var _i = 0, _a = [].slice.call(this.scrollItems.children); _i < _a.length; _i++) {
+ var elem = _a[_i];
+ ele.appendChild(elem);
+ }
+ if (this.uniqueId) {
+ this.element.removeAttribute('id');
+ }
+ Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["detach"])(this.scrollEle);
+ if (nav.length > 0) {
+ Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["detach"])(nav[0]);
+ if (!Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["isNullOrUndefined"])(nav[1])) {
+ Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["detach"])(nav[1]);
+ }
+ }
+ _ej2_base__WEBPACK_IMPORTED_MODULE_0__["EventHandler"].remove(this.scrollEle, 'scroll', this.scrollHandler);
+ this.touchModule.destroy();
+ this.touchModule = null;
+ _super.prototype.destroy.call(this);
+ };
+ /**
+ * Specifies the value to disable/enable the HScroll component.
+ * When set to `true` , the component will be disabled.
+ *
+ * @param {boolean} value - Based on this Boolean value, HScroll will be enabled (false) or disabled (true).
+ * @returns {void}.
+ */
+ HScroll.prototype.disable = function (value) {
+ var navEles = Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["selectAll"])('.e-scroll-nav:not(.' + CLS_DISABLE + ')', this.element);
+ if (value) {
+ this.element.classList.add(CLS_DISABLE);
+ }
+ else {
+ this.element.classList.remove(CLS_DISABLE);
+ }
+ [].slice.call(navEles).forEach(function (el) {
+ el.setAttribute('tabindex', !value ? '0' : '-1');
+ });
+ };
+ HScroll.prototype.createOverlay = function (element) {
+ var id = element.id.concat('_nav');
+ var rightOverlayEle = this.createElement('div', { className: CLS_OVERLAY + ' ' + CLS_RIGHTOVERLAY });
+ var clsRight = 'e-' + element.id.concat('_nav ' + CLS_HSCROLLNAV + ' ' + CLS_HSCROLLNAVRIGHT);
+ var rightEle = this.createElement('div', { id: id.concat('_right'), className: clsRight });
+ var navItem = this.createElement('div', { className: CLS_NAVRIGHTARROW + ' ' + CLS_NAVARROW + ' e-icons' });
+ rightEle.appendChild(navItem);
+ var leftEle = this.createElement('div', { className: CLS_OVERLAY + ' ' + CLS_LEFTOVERLAY });
+ if (this.ieCheck) {
+ rightEle.classList.add('e-ie-align');
+ }
+ element.appendChild(rightOverlayEle);
+ element.appendChild(rightEle);
+ element.insertBefore(leftEle, element.firstChild);
+ this.eventBinding([rightEle]);
+ };
+ HScroll.prototype.createNavIcon = function (element) {
+ var id = element.id.concat('_nav');
+ var clsRight = 'e-' + element.id.concat('_nav ' + CLS_HSCROLLNAV + ' ' + CLS_HSCROLLNAVRIGHT);
+ var rightAttributes = { 'role': 'button', 'id': id.concat('_right'), 'aria-label': 'Scroll right' };
+ var nav = this.createElement('div', { className: clsRight, attrs: rightAttributes });
+ nav.setAttribute('aria-disabled', 'false');
+ var navItem = this.createElement('div', { className: CLS_NAVRIGHTARROW + ' ' + CLS_NAVARROW + ' e-icons' });
+ var clsLeft = 'e-' + element.id.concat('_nav ' + CLS_HSCROLLNAV + ' ' + CLS_HSCROLLNAVLEFT);
+ var leftAttributes = { 'role': 'button', 'id': id.concat('_left'), 'aria-label': 'Scroll left' };
+ var navEle = this.createElement('div', { className: clsLeft + ' ' + CLS_DISABLE, attrs: leftAttributes });
+ navEle.setAttribute('aria-disabled', 'true');
+ var navLeftItem = this.createElement('div', { className: CLS_NAVLEFTARROW + ' ' + CLS_NAVARROW + ' e-icons' });
+ navEle.appendChild(navLeftItem);
+ nav.appendChild(navItem);
+ element.appendChild(nav);
+ element.insertBefore(navEle, element.firstChild);
+ if (this.ieCheck) {
+ nav.classList.add('e-ie-align');
+ navEle.classList.add('e-ie-align');
+ }
+ this.eventBinding([nav, navEle]);
+ };
+ HScroll.prototype.onKeyPress = function (e) {
+ var _this = this;
+ if (e.key === 'Enter') {
+ var timeoutFun_1 = function () {
+ _this.keyTimeout = true;
+ _this.eleScrolling(10, e.target, true);
+ };
+ this.keyTimer = window.setTimeout(function () {
+ timeoutFun_1();
+ }, 100);
+ }
+ };
+ HScroll.prototype.onKeyUp = function (e) {
+ if (e.key !== 'Enter') {
+ return;
+ }
+ if (this.keyTimeout) {
+ this.keyTimeout = false;
+ }
+ else {
+ e.target.click();
+ }
+ clearTimeout(this.keyTimer);
+ };
+ HScroll.prototype.eventBinding = function (ele) {
+ var _this = this;
+ [].slice.call(ele).forEach(function (el) {
+ new _ej2_base__WEBPACK_IMPORTED_MODULE_0__["Touch"](el, { tapHold: _this.tabHoldHandler.bind(_this), tapHoldThreshold: 500 });
+ el.addEventListener('keydown', _this.onKeyPress.bind(_this));
+ el.addEventListener('keyup', _this.onKeyUp.bind(_this));
+ el.addEventListener('mouseup', _this.repeatScroll.bind(_this));
+ el.addEventListener('touchend', _this.repeatScroll.bind(_this));
+ el.addEventListener('contextmenu', function (e) {
+ e.preventDefault();
+ });
+ _ej2_base__WEBPACK_IMPORTED_MODULE_0__["EventHandler"].add(el, 'click', _this.clickEventHandler, _this);
+ });
+ };
+ HScroll.prototype.repeatScroll = function () {
+ clearInterval(this.timeout);
+ };
+ HScroll.prototype.tabHoldHandler = function (e) {
+ var _this = this;
+ var trgt = e.originalEvent.target;
+ trgt = this.contains(trgt, CLS_HSCROLLNAV) ? trgt.firstElementChild : trgt;
+ var scrollDis = 10;
+ var timeoutFun = function () {
+ _this.eleScrolling(scrollDis, trgt, true);
+ };
+ this.timeout = window.setInterval(function () {
+ timeoutFun();
+ }, 50);
+ };
+ HScroll.prototype.contains = function (ele, className) {
+ return ele.classList.contains(className);
+ };
+ HScroll.prototype.eleScrolling = function (scrollDis, trgt, isContinuous) {
+ var rootEle = this.element;
+ var classList = trgt.classList;
+ if (classList.contains(CLS_HSCROLLNAV)) {
+ classList = trgt.querySelector('.' + CLS_NAVARROW).classList;
+ }
+ if (this.contains(rootEle, CLS_RTL) && this.browserCheck) {
+ scrollDis = -scrollDis;
+ }
+ if ((!this.contains(rootEle, CLS_RTL) || this.browserCheck) || this.ieCheck) {
+ if (classList.contains(CLS_NAVRIGHTARROW)) {
+ this.frameScrollRequest(scrollDis, 'add', isContinuous);
+ }
+ else {
+ this.frameScrollRequest(scrollDis, '', isContinuous);
+ }
+ }
+ else {
+ if (classList.contains(CLS_NAVLEFTARROW)) {
+ this.frameScrollRequest(scrollDis, 'add', isContinuous);
+ }
+ else {
+ this.frameScrollRequest(scrollDis, '', isContinuous);
+ }
+ }
+ };
+ HScroll.prototype.clickEventHandler = function (e) {
+ this.eleScrolling(this.scrollStep, e.target, false);
+ };
+ HScroll.prototype.swipeHandler = function (e) {
+ var swipeEle = this.scrollEle;
+ var distance;
+ if (e.velocity <= 1) {
+ distance = e.distanceX / (e.velocity * 10);
+ }
+ else {
+ distance = e.distanceX / e.velocity;
+ }
+ var start = 0.5;
+ var animate = function () {
+ var step = Math.sin(start);
+ if (step <= 0) {
+ window.cancelAnimationFrame(step);
+ }
+ else {
+ if (e.swipeDirection === 'Left') {
+ swipeEle.scrollLeft += distance * step;
+ }
+ else if (e.swipeDirection === 'Right') {
+ swipeEle.scrollLeft -= distance * step;
+ }
+ start -= 0.5;
+ window.requestAnimationFrame(animate);
+ }
+ };
+ animate();
+ };
+ HScroll.prototype.scrollUpdating = function (scrollVal, action) {
+ if (action === 'add') {
+ this.scrollEle.scrollLeft += scrollVal;
+ }
+ else {
+ this.scrollEle.scrollLeft -= scrollVal;
+ }
+ if (this.enableRtl && this.scrollEle.scrollLeft > 0) {
+ this.scrollEle.scrollLeft = 0;
+ }
+ };
+ HScroll.prototype.frameScrollRequest = function (scrollVal, action, isContinuous) {
+ var _this = this;
+ var step = 10;
+ if (isContinuous) {
+ this.scrollUpdating(scrollVal, action);
+ return;
+ }
+ if (!this.customStep) {
+ [].slice.call(Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["selectAll"])('.' + CLS_OVERLAY, this.element)).forEach(function (el) {
+ scrollVal -= el.offsetWidth;
+ });
+ }
+ var animate = function () {
+ var scrollValue;
+ var scrollStep;
+ if (_this.contains(_this.element, CLS_RTL) && _this.browserCheck) {
+ scrollValue = -scrollVal;
+ scrollStep = -step;
+ }
+ else {
+ scrollValue = scrollVal;
+ scrollStep = step;
+ }
+ if (scrollValue < step) {
+ window.cancelAnimationFrame(scrollStep);
+ }
+ else {
+ _this.scrollUpdating(scrollStep, action);
+ scrollVal -= scrollStep;
+ window.requestAnimationFrame(animate);
+ }
+ };
+ animate();
+ };
+ HScroll.prototype.touchHandler = function (e) {
+ var ele = this.scrollEle;
+ var distance = e.distanceX;
+ if ((this.ieCheck) && this.contains(this.element, CLS_RTL)) {
+ distance = -distance;
+ }
+ if (e.scrollDirection === 'Left') {
+ ele.scrollLeft = ele.scrollLeft + distance;
+ }
+ else if (e.scrollDirection === 'Right') {
+ ele.scrollLeft = ele.scrollLeft - distance;
+ }
+ };
+ HScroll.prototype.arrowDisabling = function (addDisable, removeDisable) {
+ if (this.isDevice) {
+ var arrowEle = Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["isNullOrUndefined"])(addDisable) ? removeDisable : addDisable;
+ var arrowIcon = arrowEle.querySelector('.' + CLS_NAVARROW);
+ if (Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["isNullOrUndefined"])(addDisable)) {
+ Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["classList"])(arrowIcon, [CLS_NAVRIGHTARROW], [CLS_NAVLEFTARROW]);
+ }
+ else {
+ Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["classList"])(arrowIcon, [CLS_NAVLEFTARROW], [CLS_NAVRIGHTARROW]);
+ }
+ }
+ else if (addDisable && removeDisable) {
+ addDisable.classList.add(CLS_DISABLE);
+ addDisable.setAttribute('aria-disabled', 'true');
+ addDisable.removeAttribute('tabindex');
+ removeDisable.classList.remove(CLS_DISABLE);
+ removeDisable.setAttribute('aria-disabled', 'false');
+ removeDisable.setAttribute('tabindex', '0');
+ }
+ this.repeatScroll();
+ };
+ HScroll.prototype.scrollHandler = function (e) {
+ var target = e.target;
+ var width = target.offsetWidth;
+ var rootEle = this.element;
+ var navLeftEle = this.element.querySelector('.' + CLS_HSCROLLNAVLEFT);
+ var navRightEle = this.element.querySelector('.' + CLS_HSCROLLNAVRIGHT);
+ var leftOverlay = this.element.querySelector('.' + CLS_LEFTOVERLAY);
+ var rightOverlay = this.element.querySelector('.' + CLS_RIGHTOVERLAY);
+ var scrollLeft = target.scrollLeft;
+ if (scrollLeft <= 0) {
+ scrollLeft = -scrollLeft;
+ }
+ if (this.isDevice) {
+ if (this.enableRtl && !(this.browserCheck || this.ieCheck)) {
+ leftOverlay = this.element.querySelector('.' + CLS_RIGHTOVERLAY);
+ rightOverlay = this.element.querySelector('.' + CLS_LEFTOVERLAY);
+ }
+ if (scrollLeft < OVERLAY_MAXWID) {
+ leftOverlay.style.width = scrollLeft + 'px';
+ }
+ else {
+ leftOverlay.style.width = '40px';
+ }
+ if ((target.scrollWidth - Math.ceil(width + scrollLeft)) < OVERLAY_MAXWID) {
+ rightOverlay.style.width = (target.scrollWidth - Math.ceil(width + scrollLeft)) + 'px';
+ }
+ else {
+ rightOverlay.style.width = '40px';
+ }
+ }
+ if (scrollLeft === 0) {
+ this.arrowDisabling(navLeftEle, navRightEle);
+ }
+ else if (Math.ceil(width + scrollLeft + .1) >= target.scrollWidth) {
+ this.arrowDisabling(navRightEle, navLeftEle);
+ }
+ else {
+ var disEle = this.element.querySelector('.' + CLS_HSCROLLNAV + '.' + CLS_DISABLE);
+ if (disEle) {
+ disEle.classList.remove(CLS_DISABLE);
+ disEle.setAttribute('aria-disabled', 'false');
+ disEle.setAttribute('tabindex', '0');
+ }
+ }
+ };
+ /**
+ * Gets called when the model property changes.The data that describes the old and new values of property that changed.
+ *
+ * @param {HScrollModel} newProp - It contains the new value of data.
+ * @param {HScrollModel} oldProp - It contains the old value of data.
+ * @returns {void}
+ * @private
+ */
+ HScroll.prototype.onPropertyChanged = function (newProp, oldProp) {
+ for (var _i = 0, _a = Object.keys(newProp); _i < _a.length; _i++) {
+ var prop = _a[_i];
+ switch (prop) {
+ case 'scrollStep':
+ this.setScrollState();
+ break;
+ case 'enableRtl':
+ newProp.enableRtl ? this.element.classList.add(CLS_RTL) : this.element.classList.remove(CLS_RTL);
+ break;
+ }
+ }
+ };
+ __decorate([
+ Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["Property"])(null)
+ ], HScroll.prototype, "scrollStep", void 0);
+ HScroll = __decorate([
+ _ej2_base__WEBPACK_IMPORTED_MODULE_0__["NotifyPropertyChanges"]
+ ], HScroll);
+ return HScroll;
+}(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["Component"]));
+
+
+
+/***/ }),
+
+/***/ "./ej2-resources/22.1.37/scripts/ej2-navigations/common/index.js":
+/*!***********************************************************************!*\
+ !*** ./ej2-resources/22.1.37/scripts/ej2-navigations/common/index.js ***!
+ \***********************************************************************/
+/*! exports provided: HScroll, VScroll, addScrolling, destroyScroll, MenuAnimationSettings, MenuItem, FieldSettings */
+/***/ (function(module, __webpack_exports__, __webpack_require__) {
+
+"use strict";
+__webpack_require__.r(__webpack_exports__);
+/* harmony import */ var _h_scroll__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./h-scroll */ "./ej2-resources/22.1.37/scripts/ej2-navigations/common/h-scroll.js");
+/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "HScroll", function() { return _h_scroll__WEBPACK_IMPORTED_MODULE_0__["HScroll"]; });
+
+/* harmony import */ var _v_scroll__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./v-scroll */ "./ej2-resources/22.1.37/scripts/ej2-navigations/common/v-scroll.js");
+/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "VScroll", function() { return _v_scroll__WEBPACK_IMPORTED_MODULE_1__["VScroll"]; });
+
+/* harmony import */ var _menu_scroll__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./menu-scroll */ "./ej2-resources/22.1.37/scripts/ej2-navigations/common/menu-scroll.js");
+/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "addScrolling", function() { return _menu_scroll__WEBPACK_IMPORTED_MODULE_2__["addScrolling"]; });
+
+/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "destroyScroll", function() { return _menu_scroll__WEBPACK_IMPORTED_MODULE_2__["destroyScroll"]; });
+
+/* harmony import */ var _menu_base__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./menu-base */ "./ej2-resources/22.1.37/scripts/ej2-navigations/common/menu-base.js");
+/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "MenuAnimationSettings", function() { return _menu_base__WEBPACK_IMPORTED_MODULE_3__["MenuAnimationSettings"]; });
+
+/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "MenuItem", function() { return _menu_base__WEBPACK_IMPORTED_MODULE_3__["MenuItem"]; });
+
+/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "FieldSettings", function() { return _menu_base__WEBPACK_IMPORTED_MODULE_3__["FieldSettings"]; });
+
+/**
+ * Navigation Common modules
+ */
+
+
+
+
+
+
+
+/***/ }),
+
+/***/ "./ej2-resources/22.1.37/scripts/ej2-navigations/common/menu-base.js":
+/*!***************************************************************************!*\
+ !*** ./ej2-resources/22.1.37/scripts/ej2-navigations/common/menu-base.js ***!
+ \***************************************************************************/
+/*! exports provided: FieldSettings, MenuItem, MenuAnimationSettings, MenuBase */
+/***/ (function(module, __webpack_exports__, __webpack_require__) {
+
+"use strict";
+__webpack_require__.r(__webpack_exports__);
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "FieldSettings", function() { return FieldSettings; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MenuItem", function() { return MenuItem; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MenuAnimationSettings", function() { return MenuAnimationSettings; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MenuBase", function() { return MenuBase; });
+/* harmony import */ var _ej2_base__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../ej2-base */ "./ej2-resources/22.1.37/scripts/ej2-base/index.js");
+/* harmony import */ var _ej2_lists__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../ej2-lists */ "./ej2-resources/22.1.37/scripts/ej2-lists/index.js");
+/* harmony import */ var _ej2_popups__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../ej2-popups */ "./ej2-resources/22.1.37/scripts/ej2-popups/index.js");
+/* harmony import */ var _common_h_scroll__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../common/h-scroll */ "./ej2-resources/22.1.37/scripts/ej2-navigations/common/h-scroll.js");
+/* harmony import */ var _common_v_scroll__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../common/v-scroll */ "./ej2-resources/22.1.37/scripts/ej2-navigations/common/v-scroll.js");
+/* harmony import */ var _common_menu_scroll__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../common/menu-scroll */ "./ej2-resources/22.1.37/scripts/ej2-navigations/common/menu-scroll.js");
+var __extends = (undefined && undefined.__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 = (undefined && undefined.__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 ENTER = 'enter';
+var ESCAPE = 'escape';
+var FOCUSED = 'e-focused';
+var HEADER = 'e-menu-header';
+var SELECTED = 'e-selected';
+var SEPARATOR = 'e-separator';
+var UPARROW = 'uparrow';
+var DOWNARROW = 'downarrow';
+var LEFTARROW = 'leftarrow';
+var RIGHTARROW = 'rightarrow';
+var HOME = 'home';
+var END = 'end';
+var TAB = 'tab';
+var CARET = 'e-caret';
+var ITEM = 'e-menu-item';
+var DISABLED = 'e-disabled';
+var HIDE = 'e-menu-hide';
+var ICONS = 'e-icons';
+var RTL = 'e-rtl';
+var POPUP = 'e-menu-popup';
+var TEMPLATE_PROPERTY = 'Template';
+/**
+ * Configures the field options of the Menu.
+ */
+var FieldSettings = /** @__PURE__ @class */ (function (_super) {
+ __extends(FieldSettings, _super);
+ function FieldSettings() {
+ return _super !== null && _super.apply(this, arguments) || this;
+ }
+ __decorate([
+ Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["Property"])('id')
+ ], FieldSettings.prototype, "itemId", void 0);
+ __decorate([
+ Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["Property"])('parentId')
+ ], FieldSettings.prototype, "parentId", void 0);
+ __decorate([
+ Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["Property"])('text')
+ ], FieldSettings.prototype, "text", void 0);
+ __decorate([
+ Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["Property"])('iconCss')
+ ], FieldSettings.prototype, "iconCss", void 0);
+ __decorate([
+ Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["Property"])('url')
+ ], FieldSettings.prototype, "url", void 0);
+ __decorate([
+ Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["Property"])('separator')
+ ], FieldSettings.prototype, "separator", void 0);
+ __decorate([
+ Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["Property"])('items')
+ ], FieldSettings.prototype, "children", void 0);
+ return FieldSettings;
+}(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["ChildProperty"]));
+
+/**
+ * Specifies menu items.
+ */
+var MenuItem = /** @__PURE__ @class */ (function (_super) {
+ __extends(MenuItem, _super);
+ function MenuItem() {
+ return _super !== null && _super.apply(this, arguments) || this;
+ }
+ __decorate([
+ Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["Property"])(null)
+ ], MenuItem.prototype, "iconCss", void 0);
+ __decorate([
+ Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["Property"])('')
+ ], MenuItem.prototype, "id", void 0);
+ __decorate([
+ Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["Property"])(false)
+ ], MenuItem.prototype, "separator", void 0);
+ __decorate([
+ Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["Collection"])([], MenuItem)
+ ], MenuItem.prototype, "items", void 0);
+ __decorate([
+ Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["Property"])('')
+ ], MenuItem.prototype, "text", void 0);
+ __decorate([
+ Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["Property"])('')
+ ], MenuItem.prototype, "url", void 0);
+ return MenuItem;
+}(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["ChildProperty"]));
+
+/**
+ * Animation configuration settings.
+ */
+var MenuAnimationSettings = /** @__PURE__ @class */ (function (_super) {
+ __extends(MenuAnimationSettings, _super);
+ function MenuAnimationSettings() {
+ return _super !== null && _super.apply(this, arguments) || this;
+ }
+ __decorate([
+ Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["Property"])('SlideDown')
+ ], MenuAnimationSettings.prototype, "effect", void 0);
+ __decorate([
+ Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["Property"])(400)
+ ], MenuAnimationSettings.prototype, "duration", void 0);
+ __decorate([
+ Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["Property"])('ease')
+ ], MenuAnimationSettings.prototype, "easing", void 0);
+ return MenuAnimationSettings;
+}(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["ChildProperty"]));
+
+/**
+ * Base class for Menu and ContextMenu components.
+ *
+ * @private
+ */
+var MenuBase = /** @__PURE__ @class */ (function (_super) {
+ __extends(MenuBase, _super);
+ /**
+ * Constructor for creating the widget.
+ *
+ * @private
+ * @param {MenuBaseModel} options - Specifies the menu base model
+ * @param {string | HTMLUListElement} element - Specifies the element
+ */
+ function MenuBase(options, element) {
+ var _this = _super.call(this, options, element) || this;
+ _this.navIdx = [];
+ _this.animation = new _ej2_base__WEBPACK_IMPORTED_MODULE_0__["Animation"]({});
+ _this.isTapHold = false;
+ _this.tempItem = [];
+ _this.showSubMenuOn = 'Auto';
+ return _this;
+ }
+ /**
+ * Initialized third party configuration settings.
+ *
+ * @private
+ * @returns {void}
+ */
+ MenuBase.prototype.preRender = function () {
+ if (!this.isMenu) {
+ var ul = void 0;
+ if (this.element.tagName === 'EJS-CONTEXTMENU') {
+ ul = this.createElement('ul', {
+ id: Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["getUniqueID"])(this.getModuleName()), className: 'e-control e-lib e-' + this.getModuleName()
+ });
+ var ejInst = Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["getValue"])('ej2_instances', this.element);
+ Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["removeClass"])([this.element], ['e-control', 'e-lib', 'e-' + this.getModuleName()]);
+ this.clonedElement = this.element;
+ this.element = ul;
+ Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["setValue"])('ej2_instances', ejInst, this.element);
+ }
+ else {
+ ul = this.createElement('ul', { id: Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["getUniqueID"])(this.getModuleName()) });
+ Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["append"])([].slice.call(this.element.cloneNode(true).children), ul);
+ var refEle = this.element.nextElementSibling;
+ if (refEle) {
+ this.element.parentElement.insertBefore(ul, refEle);
+ }
+ else {
+ this.element.parentElement.appendChild(ul);
+ }
+ this.clonedElement = ul;
+ }
+ this.clonedElement.style.display = 'none';
+ }
+ if (this.element.tagName === 'EJS-MENU') {
+ var ele = this.element;
+ var ejInstance = Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["getValue"])('ej2_instances', ele);
+ var ul = this.createElement('ul');
+ var wrapper = this.createElement('EJS-MENU', { className: 'e-' + this.getModuleName() + '-wrapper' });
+ for (var idx = 0, len = ele.attributes.length; idx < len; idx++) {
+ ul.setAttribute(ele.attributes[idx].nodeName, ele.attributes[idx].nodeValue);
+ }
+ ele.parentNode.insertBefore(wrapper, ele);
+ Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["detach"])(ele);
+ ele = ul;
+ wrapper.appendChild(ele);
+ Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["setValue"])('ej2_instances', ejInstance, ele);
+ this.clonedElement = wrapper;
+ this.element = ele;
+ if (!this.element.id) {
+ this.element.id = Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["getUniqueID"])(this.getModuleName());
+ }
+ }
+ };
+ /**
+ * Initialize the control rendering.
+ *
+ * @private
+ * @returns {void}
+ */
+ MenuBase.prototype.render = function () {
+ var _this = this;
+ this.initialize();
+ this.renderItems();
+ this.wireEvents();
+ this.renderComplete();
+ var wrapper = this.getWrapper();
+ // eslint-disable-next-line
+ if (this.template && this.enableScrolling && (this.isReact || this.isAngular)) {
+ requestAnimationFrame(function () {
+ Object(_common_menu_scroll__WEBPACK_IMPORTED_MODULE_5__["addScrolling"])(_this.createElement, wrapper, _this.element, 'hscroll', _this.enableRtl);
+ });
+ }
+ };
+ MenuBase.prototype.initialize = function () {
+ var wrapper = this.getWrapper();
+ if (!wrapper) {
+ wrapper = this.createElement('div', { className: 'e-' + this.getModuleName() + '-wrapper' });
+ if (this.isMenu) {
+ this.element.parentElement.insertBefore(wrapper, this.element);
+ }
+ else {
+ document.body.appendChild(wrapper);
+ }
+ }
+ if (this.cssClass) {
+ Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["addClass"])([wrapper], this.cssClass.replace(/\s+/g, ' ').trim().split(' '));
+ }
+ if (this.enableRtl) {
+ wrapper.classList.add(RTL);
+ }
+ wrapper.appendChild(this.element);
+ if (this.isMenu && this.hamburgerMode) {
+ if (!this.target) {
+ this.createHeaderContainer(wrapper);
+ }
+ }
+ this.defaultOption = this.showItemOnClick;
+ };
+ MenuBase.prototype.renderItems = function () {
+ if (!this.items.length) {
+ var items = _ej2_lists__WEBPACK_IMPORTED_MODULE_1__["ListBase"].createJsonFromElement(this.element, { fields: { child: 'items' } });
+ this.setProperties({ items: items }, true);
+ if (Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["isBlazor"])() && !this.isMenu) {
+ this.element = this.removeChildElement(this.element);
+ }
+ else {
+ this.element.innerHTML = '';
+ }
+ }
+ var ul = this.createItems(this.items);
+ Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["append"])(Array.prototype.slice.call(ul.children), this.element);
+ this.element.classList.add('e-menu-parent');
+ if (this.isMenu) {
+ if (!this.hamburgerMode && this.element.classList.contains('e-vertical')) {
+ this.setBlankIconStyle(this.element);
+ }
+ if (this.enableScrolling) {
+ var wrapper = this.getWrapper();
+ if (this.element.classList.contains('e-vertical')) {
+ Object(_common_menu_scroll__WEBPACK_IMPORTED_MODULE_5__["addScrolling"])(this.createElement, wrapper, this.element, 'vscroll', this.enableRtl);
+ }
+ else {
+ Object(_common_menu_scroll__WEBPACK_IMPORTED_MODULE_5__["addScrolling"])(this.createElement, wrapper, this.element, 'hscroll', this.enableRtl);
+ }
+ }
+ }
+ };
+ MenuBase.prototype.wireEvents = function () {
+ var wrapper = this.getWrapper();
+ if (this.target) {
+ var target = void 0;
+ var targetElems = Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["selectAll"])(this.target);
+ for (var i = 0, len = targetElems.length; i < len; i++) {
+ target = targetElems[i];
+ if (this.isMenu) {
+ _ej2_base__WEBPACK_IMPORTED_MODULE_0__["EventHandler"].add(target, 'click', this.menuHeaderClickHandler, this);
+ }
+ else {
+ if (_ej2_base__WEBPACK_IMPORTED_MODULE_0__["Browser"].isIos) {
+ new _ej2_base__WEBPACK_IMPORTED_MODULE_0__["Touch"](target, { tapHold: this.touchHandler.bind(this) });
+ }
+ else {
+ _ej2_base__WEBPACK_IMPORTED_MODULE_0__["EventHandler"].add(target, 'contextmenu', this.cmenuHandler, this);
+ }
+ }
+ }
+ this.targetElement = target;
+ if (!this.isMenu) {
+ _ej2_base__WEBPACK_IMPORTED_MODULE_0__["EventHandler"].add(this.targetElement, 'mousewheel DOMMouseScroll', this.scrollHandler, this);
+ for (var _i = 0, _a = Object(_ej2_popups__WEBPACK_IMPORTED_MODULE_2__["getScrollableParent"])(this.targetElement); _i < _a.length; _i++) {
+ var parent_1 = _a[_i];
+ _ej2_base__WEBPACK_IMPORTED_MODULE_0__["EventHandler"].add(parent_1, 'mousewheel DOMMouseScroll', this.scrollHandler, this);
+ }
+ }
+ }
+ if (!_ej2_base__WEBPACK_IMPORTED_MODULE_0__["Browser"].isDevice) {
+ this.delegateMoverHandler = this.moverHandler.bind(this);
+ this.delegateMouseDownHandler = this.mouseDownHandler.bind(this);
+ _ej2_base__WEBPACK_IMPORTED_MODULE_0__["EventHandler"].add(this.isMenu ? document : wrapper, 'mouseover', this.delegateMoverHandler, this);
+ _ej2_base__WEBPACK_IMPORTED_MODULE_0__["EventHandler"].add(document, 'mousedown', this.delegateMouseDownHandler, this);
+ }
+ this.delegateClickHandler = this.clickHandler.bind(this);
+ _ej2_base__WEBPACK_IMPORTED_MODULE_0__["EventHandler"].add(document, 'click', this.delegateClickHandler, this);
+ this.wireKeyboardEvent(wrapper);
+ this.rippleFn = Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["rippleEffect"])(wrapper, { selector: '.' + ITEM });
+ };
+ MenuBase.prototype.wireKeyboardEvent = function (element) {
+ var keyConfigs = {
+ downarrow: DOWNARROW,
+ uparrow: UPARROW,
+ enter: ENTER,
+ leftarrow: LEFTARROW,
+ rightarrow: RIGHTARROW,
+ escape: ESCAPE
+ };
+ if (this.isMenu) {
+ keyConfigs.home = HOME;
+ keyConfigs.end = END;
+ keyConfigs.tab = TAB;
+ }
+ new _ej2_base__WEBPACK_IMPORTED_MODULE_0__["KeyboardEvents"](element, {
+ keyAction: this.keyBoardHandler.bind(this),
+ keyConfigs: keyConfigs
+ });
+ };
+ MenuBase.prototype.mouseDownHandler = function (e) {
+ if (Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["closest"])(e.target, '.e-' + this.getModuleName() + '-wrapper') !== this.getWrapper()
+ && (!Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["closest"])(e.target, '.e-' + this.getModuleName() + '-popup'))) {
+ this.closeMenu(this.isMenu ? null : this.navIdx.length, e);
+ }
+ };
+ MenuBase.prototype.keyHandler = function (e) {
+ if (e.keyCode === 38 || e.keyCode === 40) {
+ if (e.target && (e.target.classList.contains('e-contextmenu') || e.target.classList.contains('e-menu-item'))) {
+ e.preventDefault();
+ }
+ }
+ };
+ MenuBase.prototype.keyBoardHandler = function (e) {
+ var actionName = '';
+ var trgt = e.target;
+ var actionNeeded = this.isMenu && !this.hamburgerMode && !this.element.classList.contains('e-vertical')
+ && this.navIdx.length < 1;
+ e.preventDefault();
+ if (this.enableScrolling && e.keyCode === 13 && trgt.classList.contains('e-scroll-nav')) {
+ this.removeLIStateByClass([FOCUSED, SELECTED], [Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["closest"])(trgt, '.e-' + this.getModuleName() + '-wrapper')]);
+ }
+ if (actionNeeded) {
+ switch (e.action) {
+ case RIGHTARROW:
+ actionName = RIGHTARROW;
+ e.action = DOWNARROW;
+ break;
+ case LEFTARROW:
+ actionName = LEFTARROW;
+ e.action = UPARROW;
+ break;
+ case DOWNARROW:
+ actionName = DOWNARROW;
+ e.action = RIGHTARROW;
+ break;
+ case UPARROW:
+ actionName = UPARROW;
+ e.action = '';
+ break;
+ }
+ }
+ else if (this.enableRtl) {
+ switch (e.action) {
+ case LEFTARROW:
+ actionNeeded = true;
+ actionName = LEFTARROW;
+ e.action = RIGHTARROW;
+ break;
+ case RIGHTARROW:
+ actionNeeded = true;
+ actionName = RIGHTARROW;
+ e.action = LEFTARROW;
+ break;
+ }
+ }
+ switch (e.action) {
+ case DOWNARROW:
+ case UPARROW:
+ case END:
+ case HOME:
+ case TAB:
+ this.upDownKeyHandler(e);
+ break;
+ case RIGHTARROW:
+ this.rightEnterKeyHandler(e);
+ break;
+ case LEFTARROW:
+ this.leftEscKeyHandler(e);
+ break;
+ case ENTER:
+ if (this.hamburgerMode && trgt.tagName === 'SPAN' && trgt.classList.contains('e-menu-icon')) {
+ this.menuHeaderClickHandler(e);
+ }
+ else {
+ this.rightEnterKeyHandler(e);
+ }
+ break;
+ case ESCAPE:
+ this.leftEscKeyHandler(e);
+ break;
+ }
+ if (actionNeeded) {
+ e.action = actionName;
+ }
+ };
+ MenuBase.prototype.upDownKeyHandler = function (e) {
+ var cul = this.getUlByNavIdx();
+ var defaultIdx = (e.action === DOWNARROW || e.action === HOME || e.action === TAB) ? 0 : cul.childElementCount - 1;
+ var fliIdx = defaultIdx;
+ var fli = this.getLIByClass(cul, FOCUSED);
+ if (fli) {
+ if (e.action !== END && e.action !== HOME) {
+ fliIdx = this.getIdx(cul, fli);
+ }
+ fli.classList.remove(FOCUSED);
+ if (e.action !== END && e.action !== HOME) {
+ if (e.action === DOWNARROW) {
+ fliIdx++;
+ }
+ else {
+ fliIdx--;
+ }
+ if (fliIdx === (e.action === DOWNARROW ? cul.childElementCount : -1)) {
+ fliIdx = defaultIdx;
+ }
+ }
+ }
+ var cli = cul.children[fliIdx];
+ fliIdx = this.isValidLI(cli, fliIdx, e.action);
+ cul.children[fliIdx].classList.add(FOCUSED);
+ cul.children[fliIdx].focus();
+ };
+ MenuBase.prototype.isValidLI = function (cli, index, action) {
+ var cul = this.getUlByNavIdx();
+ var defaultIdx = (action === DOWNARROW || action === HOME || action === TAB) ? 0 : cul.childElementCount - 1;
+ if (cli.classList.contains(SEPARATOR) || cli.classList.contains(DISABLED) || cli.classList.contains(HIDE)) {
+ if (action === DOWNARROW && index === cul.childElementCount - 1) {
+ index = defaultIdx;
+ }
+ else if (action === UPARROW && index === 0) {
+ index = defaultIdx;
+ }
+ else if ((action === DOWNARROW) || (action === RIGHTARROW)) {
+ index++;
+ }
+ else {
+ index--;
+ }
+ }
+ cli = cul.children[index];
+ if (cli.classList.contains(SEPARATOR) || cli.classList.contains(DISABLED) || cli.classList.contains(HIDE)) {
+ index = this.isValidLI(cli, index, action);
+ }
+ return index;
+ };
+ MenuBase.prototype.getUlByNavIdx = function (navIdxLen) {
+ var _this = this;
+ if (navIdxLen === void 0) { navIdxLen = this.navIdx.length; }
+ if (this.isMenu) {
+ var popup = [this.getWrapper()].concat([].slice.call(Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["selectAll"])('.' + POPUP)))[navIdxLen];
+ var popups_1 = [];
+ var allPopup = Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["selectAll"])('.' + POPUP);
+ allPopup.forEach(function (elem) {
+ if (_this.element.id === elem.id.split('-')[2]) {
+ popups_1.push(elem);
+ }
+ });
+ popup = [this.getWrapper()].concat([].slice.call(popups_1))[navIdxLen];
+ return Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["isNullOrUndefined"])(popup) ? null : Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["select"])('.e-menu-parent', popup);
+ }
+ else {
+ return this.getWrapper().children[navIdxLen];
+ }
+ };
+ MenuBase.prototype.rightEnterKeyHandler = function (e) {
+ var eventArgs;
+ var cul = this.getUlByNavIdx();
+ var fli = this.getLIByClass(cul, FOCUSED);
+ if (fli) {
+ var fliIdx = this.getIdx(cul, fli);
+ var navIdx = this.navIdx.concat(fliIdx);
+ var item = this.getItem(navIdx);
+ if (item.items.length) {
+ this.navIdx.push(fliIdx);
+ this.keyType = 'right';
+ this.action = e.action;
+ this.openMenu(fli, item, -1, -1, e);
+ }
+ else {
+ if (e.action === ENTER) {
+ if (this.isMenu && this.navIdx.length === 0) {
+ this.removeLIStateByClass([SELECTED], [this.getWrapper()]);
+ }
+ else {
+ fli.classList.remove(FOCUSED);
+ }
+ fli.classList.add(SELECTED);
+ eventArgs = { element: fli, item: item, event: e };
+ this.trigger('select', eventArgs);
+ this.closeMenu(null, e);
+ }
+ }
+ }
+ };
+ MenuBase.prototype.leftEscKeyHandler = function (e) {
+ if (this.navIdx.length) {
+ this.keyType = 'left';
+ this.closeMenu(this.navIdx.length, e);
+ }
+ else {
+ if (e.action === ESCAPE) {
+ this.closeMenu(null, e);
+ }
+ }
+ };
+ MenuBase.prototype.scrollHandler = function (e) {
+ this.closeMenu(null, e);
+ };
+ MenuBase.prototype.touchHandler = function (e) {
+ this.isTapHold = true;
+ this.cmenuHandler(e.originalEvent);
+ };
+ MenuBase.prototype.cmenuHandler = function (e) {
+ e.preventDefault();
+ this.currentTarget = e.target;
+ this.isCMenu = true;
+ this.pageX = e.changedTouches ? e.changedTouches[0].pageX + 1 : e.pageX + 1;
+ this.pageY = e.changedTouches ? e.changedTouches[0].pageY + 1 : e.pageY + 1;
+ this.closeMenu(null, e);
+ if (this.isCMenu) {
+ if (this.canOpen(e.target)) {
+ this.openMenu(null, null, this.pageY, this.pageX, e);
+ }
+ this.isCMenu = false;
+ }
+ };
+ // eslint:disable-next-line:max-func-body-length
+ MenuBase.prototype.closeMenu = function (ulIndex, e, isIterated) {
+ var _this = this;
+ if (ulIndex === void 0) { ulIndex = 0; }
+ if (e === void 0) { e = null; }
+ if (this.isMenuVisible()) {
+ var sli = void 0;
+ var item_1;
+ var wrapper_1 = this.getWrapper();
+ var beforeCloseArgs = void 0;
+ var items_1;
+ var popups = this.getPopups();
+ var isClose = false;
+ var cnt = this.isMenu ? popups.length + 1 : wrapper_1.childElementCount;
+ var ul_1 = this.isMenu && cnt !== 1 ? Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["select"])('.e-ul', popups[cnt - 2])
+ : Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["selectAll"])('.e-menu-parent', wrapper_1)[cnt - 1];
+ if (this.isMenu && ul_1.classList.contains('e-menu')) {
+ sli = this.getLIByClass(ul_1, SELECTED);
+ if (sli) {
+ sli.classList.remove(SELECTED);
+ }
+ isClose = true;
+ }
+ if (!isClose) {
+ var liElem_1 = e && e.target && this.getLI(e.target);
+ if (liElem_1) {
+ this.cli = liElem_1;
+ }
+ else {
+ this.cli = ul_1.children[0];
+ }
+ item_1 = this.navIdx.length ? this.getItem(this.navIdx) : null;
+ items_1 = item_1 ? item_1.items : this.items;
+ beforeCloseArgs = { element: ul_1, parentItem: item_1, items: items_1, event: e, cancel: false, isFocused: true };
+ this.trigger('beforeClose', beforeCloseArgs, function (observedCloseArgs) {
+ var popupEle;
+ var closeArgs;
+ var popupId = '';
+ var popupObj;
+ var isOpen = !observedCloseArgs.cancel;
+ if (isOpen || _this.isCMenu) {
+ if (_this.isMenu) {
+ popupEle = Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["closest"])(ul_1, '.' + POPUP);
+ if (_this.hamburgerMode) {
+ popupEle.parentElement.style.minHeight = '';
+ Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["closest"])(ul_1, '.e-menu-item').setAttribute('aria-expanded', 'false');
+ }
+ _this.unWireKeyboardEvent(popupEle);
+ Object(_common_menu_scroll__WEBPACK_IMPORTED_MODULE_5__["destroyScroll"])(Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["getInstance"])(popupEle.children[0], _common_v_scroll__WEBPACK_IMPORTED_MODULE_4__["VScroll"]), popupEle.children[0]);
+ popupObj = Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["getInstance"])(popupEle, _ej2_popups__WEBPACK_IMPORTED_MODULE_2__["Popup"]);
+ popupObj.hide();
+ popupId = popupEle.id;
+ popupObj.destroy();
+ Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["detach"])(popupEle);
+ }
+ else {
+ _this.toggleAnimation(ul_1, false);
+ }
+ closeArgs = { element: ul_1, parentItem: item_1, items: items_1 };
+ _this.trigger('onClose', closeArgs);
+ _this.navIdx.pop();
+ if (!_this.isMenu) {
+ _ej2_base__WEBPACK_IMPORTED_MODULE_0__["EventHandler"].remove(ul_1, 'keydown', _this.keyHandler);
+ if (_this.keyType === 'right') {
+ _this.keyType = '';
+ }
+ }
+ }
+ _this.updateReactTemplate();
+ var trgtliId;
+ var closedLi;
+ var trgtLi;
+ var trgtpopUp = _this.getWrapper() && _this.getUlByNavIdx();
+ if (_this.isCMenu) {
+ if (_this.canOpen(e.target)) {
+ _this.openMenu(null, null, _this.pageY, _this.pageX, e);
+ }
+ _this.isCMenu = false;
+ }
+ if (_this.isMenu && trgtpopUp && popupId.length) {
+ // eslint-disable-next-line
+ trgtliId = new RegExp('(.*)-ej2menu-' + _this.element.id + '-popup').exec(popupId)[1];
+ closedLi = trgtpopUp.querySelector('[id="' + trgtliId + '"]');
+ trgtLi = (liElem_1 && trgtpopUp.querySelector('[id="' + liElem_1.id + '"]'));
+ }
+ else if (trgtpopUp) {
+ closedLi = trgtpopUp.querySelector('.e-menu-item.e-selected');
+ trgtLi = (liElem_1 && trgtpopUp.querySelector('[id="' + liElem_1.id + '"]'));
+ }
+ var submenus = liElem_1 && liElem_1.querySelectorAll('.e-menu-item');
+ if (isOpen && _this.hamburgerMode && ulIndex && !(submenus.length)) {
+ _this.afterCloseMenu(e);
+ }
+ else if (isOpen && !_this.hamburgerMode && closedLi && !trgtLi && _this.keyType !== 'left' && (_this.navIdx.length || !_this.isMenu && _this.navIdx.length === 0)) {
+ var ele = (e && e.target.classList.contains('e-vscroll'))
+ ? Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["closest"])(e.target, '.e-menu-wrapper') : null;
+ if (ele) {
+ ele = ele.querySelector('.e-menu-item');
+ if (_this.showItemOnClick || (ele && _this.getIndex(ele.id, true).length <= _this.navIdx.length)) {
+ _this.closeMenu(_this.navIdx[_this.navIdx.length - 1], e, true);
+ }
+ }
+ else {
+ _this.closeMenu(_this.navIdx[_this.navIdx.length - 1], e);
+ }
+ }
+ else if (isOpen && !isIterated && !ulIndex && ((_this.hamburgerMode && _this.navIdx.length) ||
+ _this.navIdx.length === 1 && liElem_1 && trgtpopUp !== liElem_1.parentElement)) {
+ _this.closeMenu(null, e);
+ }
+ else if (isOpen && Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["isNullOrUndefined"])(ulIndex) && _this.navIdx.length) {
+ _this.closeMenu(null, e);
+ }
+ else if (isOpen && !_this.isMenu && !ulIndex && _this.navIdx.length === 0 && !_this.isMenusClosed) {
+ _this.isMenusClosed = true;
+ _this.closeMenu(0, e);
+ }
+ else if (isOpen && _this.isMenu && e && e.target &&
+ _this.navIdx.length !== 0 && Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["closest"])(e.target, '.e-menu-parent.e-control')) {
+ _this.closeMenu(0, e);
+ }
+ else if (isOpen && !_this.isMenu && Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["selectAll"])('.e-menu-parent', wrapper_1)[ulIndex - 1] && e.which === 3) {
+ _this.closeMenu(null, e);
+ }
+ else {
+ if (isOpen && (_this.keyType === 'right' || _this.keyType === 'click')) {
+ _this.afterCloseMenu(e);
+ }
+ else {
+ var cul = _this.getUlByNavIdx();
+ var sli_1 = _this.getLIByClass(cul, SELECTED);
+ if (sli_1) {
+ sli_1.setAttribute('aria-expanded', 'false');
+ sli_1.classList.remove(SELECTED);
+ if (observedCloseArgs.isFocused && liElem_1 || _this.keyType === 'left') {
+ sli_1.classList.add(FOCUSED);
+ if (!e.target || !e.target.classList.contains('e-edit-template')) {
+ sli_1.focus();
+ }
+ }
+ }
+ if (!isOpen && _this.hamburgerMode && liElem_1 && liElem_1.getAttribute('aria-expanded') === 'false' &&
+ liElem_1.getAttribute('aria-haspopup') === 'true') {
+ if (Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["closest"])(liElem_1, '.e-menu-parent.e-control')) {
+ _this.navIdx = [];
+ }
+ else {
+ _this.navIdx.pop();
+ }
+ _this.navIdx.push(_this.cliIdx);
+ var item_2 = _this.getItem(_this.navIdx);
+ liElem_1.setAttribute('aria-expanded', 'true');
+ _this.openMenu(liElem_1, item_2, -1, -1, e);
+ }
+ }
+ if (_this.navIdx.length < 1) {
+ if (_this.showSubMenuOn === 'Hover' || _this.showSubMenuOn === 'Click') {
+ _this.showItemOnClick = _this.defaultOption;
+ _this.showSubMenuOn = 'Auto';
+ }
+ }
+ }
+ _this.removeStateWrapper();
+ });
+ }
+ }
+ };
+ MenuBase.prototype.updateReactTemplate = function () {
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
+ if (this.isReact && this.template && this.navIdx.length === 0) {
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
+ var portals = this.portals.splice(0, this.items.length);
+ this.clearTemplate(['template']);
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
+ this.portals = portals;
+ this.renderReactTemplates();
+ }
+ };
+ MenuBase.prototype.getMenuItemModel = function (item, level) {
+ if (Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["isNullOrUndefined"])(item)) {
+ return null;
+ }
+ if (Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["isNullOrUndefined"])(level)) {
+ level = 0;
+ }
+ var fields = this.getFields(level);
+ return { text: item[fields.text], id: item[fields.id], items: item[fields.child], separator: item[fields.separator],
+ iconCss: item[fields.iconCss], url: item[fields.url] };
+ };
+ MenuBase.prototype.getPopups = function () {
+ var _this = this;
+ var popups = [];
+ [].slice.call(document.querySelectorAll('.' + POPUP)).forEach(function (elem) {
+ if (!Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["isNullOrUndefined"])(elem.querySelector('.' + ITEM)) && _this.getIndex(elem.querySelector('.' + ITEM).id, true).length) {
+ popups.push(elem);
+ }
+ });
+ return popups;
+ };
+ MenuBase.prototype.isMenuVisible = function () {
+ return (this.navIdx.length > 0 || (this.element.classList.contains('e-contextmenu') && Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["isVisible"])(this.element).valueOf()));
+ };
+ MenuBase.prototype.canOpen = function (target) {
+ var canOpen = true;
+ if (this.filter) {
+ canOpen = false;
+ var filter = this.filter.split(' ');
+ for (var i = 0, len = filter.length; i < len; i++) {
+ if (Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["closest"])(target, '.' + filter[i])) {
+ canOpen = true;
+ break;
+ }
+ }
+ }
+ return canOpen;
+ };
+ MenuBase.prototype.openMenu = function (li, item, top, left, e, target) {
+ var _this = this;
+ if (top === void 0) { top = 0; }
+ if (left === void 0) { left = 0; }
+ if (e === void 0) { e = null; }
+ if (target === void 0) { target = this.targetElement; }
+ var wrapper = this.getWrapper();
+ this.lItem = li;
+ var elemId = this.element.id !== '' ? this.element.id : 'menu';
+ this.isMenusClosed = false;
+ if (Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["isNullOrUndefined"])(top)) {
+ top = -1;
+ }
+ if (Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["isNullOrUndefined"])(left)) {
+ left = -1;
+ }
+ if (li) {
+ this.uList = this.createItems(item[this.getField('children', this.navIdx.length - 1)]);
+ if (!this.isMenu && _ej2_base__WEBPACK_IMPORTED_MODULE_0__["Browser"].isDevice) {
+ wrapper.lastChild.style.display = 'none';
+ var data = {
+ text: item[this.getField('text')].toString(), iconCss: ICONS + ' e-previous'
+ };
+ var hdata = new MenuItem(this.items[0], 'items', data, true);
+ var hli = this.createItems([hdata]).children[0];
+ hli.classList.add(HEADER);
+ this.uList.insertBefore(hli, this.uList.children[0]);
+ }
+ if (this.isMenu) {
+ this.popupWrapper = this.createElement('div', {
+ className: 'e-' + this.getModuleName() + '-wrapper ' + POPUP, id: li.id + '-ej2menu-' + elemId + '-popup'
+ });
+ if (this.hamburgerMode) {
+ top = li.offsetHeight;
+ li.appendChild(this.popupWrapper);
+ }
+ else {
+ document.body.appendChild(this.popupWrapper);
+ }
+ this.isNestedOrVertical = this.element.classList.contains('e-vertical') || this.navIdx.length !== 1;
+ this.popupObj = this.generatePopup(this.popupWrapper, this.uList, li, this.isNestedOrVertical);
+ if (this.template) {
+ this.renderReactTemplates();
+ }
+ if (this.hamburgerMode) {
+ this.calculateIndentSize(this.uList, li);
+ }
+ else {
+ if (this.cssClass) {
+ Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["addClass"])([this.popupWrapper], this.cssClass.replace(/\s+/g, ' ').trim().split(' '));
+ }
+ this.popupObj.hide();
+ }
+ if (!this.hamburgerMode && !this.showItemOnClick && this.hoverDelay) {
+ window.clearInterval(this.timer);
+ this.timer = window.setTimeout(function () { _this.triggerBeforeOpen(li, _this.uList, item, e, 0, 0, 'menu'); }, this.hoverDelay);
+ }
+ else {
+ this.triggerBeforeOpen(li, this.uList, item, e, 0, 0, 'menu');
+ }
+ }
+ else {
+ this.uList.style.zIndex = this.element.style.zIndex;
+ wrapper.appendChild(this.uList);
+ if (!this.showItemOnClick && this.hoverDelay) {
+ window.clearInterval(this.timer);
+ this.timer = window.setTimeout(function () { _this.triggerBeforeOpen(li, _this.uList, item, e, top, left, 'none'); }, this.hoverDelay);
+ }
+ else {
+ this.triggerBeforeOpen(li, this.uList, item, e, top, left, 'none');
+ }
+ }
+ }
+ else {
+ this.uList = this.element;
+ this.uList.style.zIndex = Object(_ej2_popups__WEBPACK_IMPORTED_MODULE_2__["getZindexPartial"])(target ? target : this.element).toString();
+ if (Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["isNullOrUndefined"])(e)) {
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
+ var ev = document.createEvent('MouseEvents');
+ ev.initEvent("click", true, false);
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
+ var targetEvent = this.copyObject(ev, {});
+ targetEvent.target = targetEvent.srcElement = target;
+ targetEvent.currentTarget = target;
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
+ this.triggerBeforeOpen(li, this.uList, item, targetEvent, top, left, 'none');
+ }
+ else {
+ this.triggerBeforeOpen(li, this.uList, item, e, top, left, 'none');
+ }
+ }
+ };
+ MenuBase.prototype.copyObject = function (source, destination) {
+ for (var prop in source) {
+ destination["" + prop] = source["" + prop];
+ }
+ return destination;
+ };
+ MenuBase.prototype.calculateIndentSize = function (ul, li) {
+ var liStyle = getComputedStyle(li);
+ var liIndent = parseInt(liStyle.textIndent, 10);
+ if (this.navIdx.length < 2 && !li.classList.contains('e-blankicon')) {
+ liIndent *= 2;
+ }
+ else {
+ liIndent += (liIndent / 4);
+ }
+ ul.style.textIndent = liIndent + 'px';
+ var blankIconElem = ul.querySelectorAll('.e-blankicon');
+ if (blankIconElem && blankIconElem.length) {
+ var menuIconElem = ul.querySelector('.e-menu-icon');
+ var menuIconElemStyle = getComputedStyle(menuIconElem);
+ var blankIconIndent = (parseInt(menuIconElemStyle.marginRight, 10) + menuIconElem.offsetWidth + liIndent);
+ for (var i = 0; i < blankIconElem.length; i++) {
+ blankIconElem[i].style.textIndent = blankIconIndent + 'px';
+ }
+ }
+ };
+ MenuBase.prototype.generatePopup = function (popupWrapper, ul, li, isNestedOrVertical) {
+ var _this = this;
+ var popupObj = new _ej2_popups__WEBPACK_IMPORTED_MODULE_2__["Popup"](popupWrapper, {
+ actionOnScroll: this.hamburgerMode ? 'none' : 'reposition',
+ relateTo: li,
+ collision: this.hamburgerMode ? { X: 'none', Y: 'none' } : { X: isNestedOrVertical ||
+ this.enableRtl ? 'none' : 'flip', Y: 'fit' },
+ position: (isNestedOrVertical && !this.hamburgerMode) ? { X: 'right', Y: 'top' } : { X: 'left', Y: 'bottom' },
+ targetType: 'relative',
+ enableRtl: this.enableRtl,
+ content: ul,
+ open: function () {
+ var scrollEle = Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["select"])('.e-menu-vscroll', popupObj.element);
+ if (scrollEle) {
+ scrollEle.style.height = 'inherit';
+ scrollEle.style.maxHeight = '';
+ }
+ var ul = Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["select"])('.e-ul', popupObj.element);
+ popupObj.element.style.maxHeight = '';
+ ul.focus();
+ _this.triggerOpen(ul);
+ }
+ });
+ return popupObj;
+ };
+ MenuBase.prototype.createHeaderContainer = function (wrapper) {
+ wrapper = wrapper || this.getWrapper();
+ var spanElem = this.createElement('span', { className: 'e-' + this.getModuleName() + '-header' });
+ var tempTitle = (this.enableHtmlSanitizer) ? _ej2_base__WEBPACK_IMPORTED_MODULE_0__["SanitizeHtmlHelper"].sanitize(this.title) : this.title;
+ var spanTitle = this.createElement('span', {
+ className: 'e-' + this.getModuleName() + '-title', innerHTML: tempTitle
+ });
+ var spanIcon = this.createElement('span', {
+ className: 'e-icons e-' + this.getModuleName() + '-icon', attrs: { 'tabindex': '0' }
+ });
+ spanElem.appendChild(spanTitle);
+ spanElem.appendChild(spanIcon);
+ wrapper.insertBefore(spanElem, this.element);
+ };
+ MenuBase.prototype.openHamburgerMenu = function (e) {
+ if (this.hamburgerMode) {
+ this.triggerBeforeOpen(null, this.element, null, e, 0, 0, 'hamburger');
+ }
+ };
+ MenuBase.prototype.closeHamburgerMenu = function (e) {
+ var _this = this;
+ var beforeCloseArgs = { element: this.element, parentItem: null, event: e,
+ items: this.items, cancel: false };
+ this.trigger('beforeClose', beforeCloseArgs, function (observedHamburgerCloseArgs) {
+ if (!observedHamburgerCloseArgs.cancel) {
+ _this.closeMenu(null, e);
+ _this.element.classList.add('e-hide-menu');
+ _this.trigger('onClose', { element: _this.element, parentItem: null, items: _this.items });
+ }
+ });
+ };
+ MenuBase.prototype.callFit = function (element, x, y, top, left) {
+ return Object(_ej2_popups__WEBPACK_IMPORTED_MODULE_2__["fit"])(element, null, { X: x, Y: y }, { top: top, left: left });
+ };
+ MenuBase.prototype.triggerBeforeOpen = function (li, ul, item, e, top, left, type) {
+ var _this = this;
+ var items = li ? item[this.getField('children', this.navIdx.length - 1)] : this.items;
+ var eventArgs = {
+ element: ul, items: items, parentItem: item, event: e, cancel: false, top: top, left: left, showSubMenuOn: 'Auto'
+ };
+ var menuType = type;
+ this.trigger('beforeOpen', eventArgs, function (observedOpenArgs) {
+ switch (menuType) {
+ case 'menu':
+ if (!_this.hamburgerMode) {
+ if (observedOpenArgs.showSubMenuOn !== 'Auto') {
+ _this.showItemOnClick = !_this.defaultOption;
+ _this.showSubMenuOn = observedOpenArgs.showSubMenuOn;
+ }
+ _this.top = observedOpenArgs.top;
+ _this.left = observedOpenArgs.left;
+ }
+ _this.popupWrapper.style.display = 'block';
+ if (!_this.hamburgerMode) {
+ _this.popupWrapper.style.maxHeight = _this.popupWrapper.getBoundingClientRect().height + 'px';
+ if (_this.enableScrolling) {
+ Object(_common_menu_scroll__WEBPACK_IMPORTED_MODULE_5__["addScrolling"])(_this.createElement, _this.popupWrapper, _this.uList, 'vscroll', _this.enableRtl);
+ }
+ _this.checkScrollOffset(e);
+ }
+ if (!_this.hamburgerMode && !_this.left && !_this.top) {
+ _this.popupObj.refreshPosition(_this.lItem, true);
+ _this.left = parseInt(_this.popupWrapper.style.left, 10);
+ _this.top = parseInt(_this.popupWrapper.style.top, 10);
+ if (_this.enableRtl) {
+ _this.left =
+ _this.isNestedOrVertical ? _this.left - _this.popupWrapper.offsetWidth - _this.lItem.parentElement.offsetWidth + 2
+ : _this.left - _this.popupWrapper.offsetWidth + _this.lItem.offsetWidth;
+ }
+ // eslint-disable-next-line
+ if (_this.template && (_this.isReact || _this.isAngular)) {
+ requestAnimationFrame(function () {
+ _this.collision();
+ _this.popupWrapper.style.display = '';
+ });
+ }
+ else {
+ _this.collision();
+ _this.popupWrapper.style.display = '';
+ }
+ }
+ else {
+ _this.popupObj.collision = { X: 'none', Y: 'none' };
+ _this.popupWrapper.style.display = '';
+ }
+ break;
+ case 'none':
+ _this.top = observedOpenArgs.top;
+ _this.left = observedOpenArgs.left;
+ break;
+ case 'hamburger':
+ if (!observedOpenArgs.cancel) {
+ _this.element.classList.remove('e-hide-menu');
+ _this.triggerOpen(_this.element);
+ }
+ break;
+ }
+ if (menuType !== 'hamburger') {
+ if (observedOpenArgs.cancel) {
+ if (_this.isMenu) {
+ _this.popupObj.destroy();
+ Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["detach"])(_this.popupWrapper);
+ }
+ else if (ul.className.indexOf('e-ul') > -1) {
+ Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["detach"])(ul);
+ }
+ _this.navIdx.pop();
+ }
+ else {
+ if (_this.isMenu) {
+ if (_this.hamburgerMode) {
+ _this.popupWrapper.style.top = _this.top + 'px';
+ _this.popupWrapper.style.left = 0 + 'px';
+ _this.toggleAnimation(_this.popupWrapper);
+ }
+ else {
+ _this.setBlankIconStyle(_this.popupWrapper);
+ _this.wireKeyboardEvent(_this.popupWrapper);
+ Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["rippleEffect"])(_this.popupWrapper, { selector: '.' + ITEM });
+ _this.popupWrapper.style.left = _this.left + 'px';
+ _this.popupWrapper.style.top = _this.top + 'px';
+ var animationOptions = _this.animationSettings.effect !== 'None' ? {
+ name: _this.animationSettings.effect, duration: _this.animationSettings.duration,
+ timingFunction: _this.animationSettings.easing
+ } : null;
+ _this.popupObj.show(animationOptions, _this.lItem);
+ }
+ }
+ else {
+ _this.setBlankIconStyle(_this.uList);
+ _this.setPosition(_this.lItem, _this.uList, _this.top, _this.left);
+ _this.toggleAnimation(_this.uList);
+ }
+ }
+ }
+ if (_this.keyType === 'right') {
+ var cul = _this.getUlByNavIdx();
+ li.classList.remove(FOCUSED);
+ if (_this.isMenu && _this.navIdx.length === 1) {
+ _this.removeLIStateByClass([SELECTED], [_this.getWrapper()]);
+ }
+ li.classList.add(SELECTED);
+ if (_this.action === ENTER) {
+ var eventArgs_1 = { element: li, item: item, event: e };
+ _this.trigger('select', eventArgs_1);
+ }
+ li.focus();
+ cul = _this.getUlByNavIdx();
+ var index = _this.isValidLI(cul.children[0], 0, _this.action);
+ cul.children[index].classList.add(FOCUSED);
+ cul.children[index].focus();
+ }
+ });
+ };
+ MenuBase.prototype.collision = function () {
+ var collide;
+ collide = Object(_ej2_popups__WEBPACK_IMPORTED_MODULE_2__["isCollide"])(this.popupWrapper, null, this.left, this.top);
+ if ((this.isNestedOrVertical || this.enableRtl) && (collide.indexOf('right') > -1
+ || collide.indexOf('left') > -1)) {
+ this.popupObj.collision.X = 'none';
+ var offWidth = Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["closest"])(this.lItem, '.e-' + this.getModuleName() + '-wrapper').offsetWidth;
+ this.left =
+ this.enableRtl ? Object(_ej2_popups__WEBPACK_IMPORTED_MODULE_2__["calculatePosition"])(this.lItem, this.isNestedOrVertical ? 'right' : 'left', 'top').left
+ : this.left - this.popupWrapper.offsetWidth - offWidth + 2;
+ }
+ collide = Object(_ej2_popups__WEBPACK_IMPORTED_MODULE_2__["isCollide"])(this.popupWrapper, null, this.left, this.top);
+ if (collide.indexOf('left') > -1 || collide.indexOf('right') > -1) {
+ this.left = this.callFit(this.popupWrapper, true, false, this.top, this.left).left;
+ }
+ this.popupWrapper.style.left = this.left + 'px';
+ };
+ MenuBase.prototype.setBlankIconStyle = function (menu) {
+ var blankIconList = [].slice.call(menu.getElementsByClassName('e-blankicon'));
+ if (!blankIconList.length) {
+ return;
+ }
+ var iconLi = menu.querySelector('.e-menu-item:not(.e-blankicon):not(.e-separator)');
+ if (!iconLi) {
+ return;
+ }
+ var icon = iconLi.querySelector('.e-menu-icon');
+ if (!icon) {
+ return;
+ }
+ var cssProp = this.enableRtl ? { padding: 'paddingRight', margin: 'marginLeft' } :
+ { padding: 'paddingLeft', margin: 'marginRight' };
+ var iconCssProps = getComputedStyle(icon);
+ var iconSize = parseInt(iconCssProps.fontSize, 10);
+ if (!!parseInt(iconCssProps.width, 10) && parseInt(iconCssProps.width, 10) > iconSize) {
+ iconSize = parseInt(iconCssProps.width, 10);
+ }
+ // eslint:disable
+ var size = iconSize + parseInt(
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
+ iconCssProps[cssProp.margin], 10) + parseInt(getComputedStyle(iconLi)[cssProp.padding], 10) + "px";
+ blankIconList.forEach(function (li) {
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
+ li.style[cssProp.padding] = size;
+ });
+ // eslint:enable
+ };
+ MenuBase.prototype.checkScrollOffset = function (e) {
+ var wrapper = this.getWrapper();
+ if (wrapper.children[0].classList.contains('e-menu-hscroll') && this.navIdx.length === 1) {
+ var trgt = Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["isNullOrUndefined"])(e) ? this.element : Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["closest"])(e.target, '.' + ITEM);
+ var offsetEle = Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["select"])('.e-hscroll-bar', wrapper);
+ if (offsetEle.scrollLeft > trgt.offsetLeft) {
+ offsetEle.scrollLeft -= (offsetEle.scrollLeft - trgt.offsetLeft);
+ }
+ var offsetLeft = offsetEle.scrollLeft + offsetEle.offsetWidth;
+ var offsetRight = trgt.offsetLeft + trgt.offsetWidth;
+ if (offsetLeft < offsetRight) {
+ offsetEle.scrollLeft += (offsetRight - offsetLeft);
+ }
+ }
+ };
+ MenuBase.prototype.setPosition = function (li, ul, top, left) {
+ var px = 'px';
+ this.toggleVisiblity(ul);
+ if (ul === this.element || (left > -1 && top > -1)) {
+ var collide = Object(_ej2_popups__WEBPACK_IMPORTED_MODULE_2__["isCollide"])(ul, null, left, top);
+ if (collide.indexOf('right') > -1) {
+ left = left - ul.offsetWidth;
+ }
+ if (collide.indexOf('bottom') > -1) {
+ var offset = this.callFit(ul, false, true, top, left);
+ top = offset.top - 20;
+ if (top < 0) {
+ var newTop = (pageYOffset + document.documentElement.clientHeight) - ul.getBoundingClientRect().height;
+ if (newTop > -1) {
+ top = newTop;
+ }
+ }
+ }
+ collide = Object(_ej2_popups__WEBPACK_IMPORTED_MODULE_2__["isCollide"])(ul, null, left, top);
+ if (collide.indexOf('left') > -1) {
+ var offset = this.callFit(ul, true, false, top, left);
+ left = offset.left;
+ }
+ }
+ else {
+ if (_ej2_base__WEBPACK_IMPORTED_MODULE_0__["Browser"].isDevice) {
+ top = Number(this.element.style.top.replace(px, ''));
+ left = Number(this.element.style.left.replace(px, ''));
+ }
+ else {
+ var x = this.enableRtl ? 'left' : 'right';
+ var offset = Object(_ej2_popups__WEBPACK_IMPORTED_MODULE_2__["calculatePosition"])(li, x, 'top');
+ top = offset.top;
+ left = offset.left;
+ var collide = Object(_ej2_popups__WEBPACK_IMPORTED_MODULE_2__["isCollide"])(ul, null, this.enableRtl ? left - ul.offsetWidth : left, top);
+ var xCollision = collide.indexOf('left') > -1 || collide.indexOf('right') > -1;
+ if (xCollision) {
+ offset = Object(_ej2_popups__WEBPACK_IMPORTED_MODULE_2__["calculatePosition"])(li, this.enableRtl ? 'right' : 'left', 'top');
+ left = offset.left;
+ }
+ if (this.enableRtl || xCollision) {
+ left = (this.enableRtl && xCollision) ? left : left - ul.offsetWidth;
+ }
+ if (collide.indexOf('bottom') > -1) {
+ offset = this.callFit(ul, false, true, top, left);
+ top = offset.top;
+ }
+ }
+ }
+ this.toggleVisiblity(ul, false);
+ ul.style.top = top + px;
+ ul.style.left = left + px;
+ };
+ MenuBase.prototype.toggleVisiblity = function (ul, isVisible) {
+ if (isVisible === void 0) { isVisible = true; }
+ ul.style.visibility = isVisible ? 'hidden' : '';
+ ul.style.display = isVisible ? 'block' : 'none';
+ };
+ MenuBase.prototype.createItems = function (items) {
+ var _this = this;
+ var level = this.navIdx ? this.navIdx.length : 0;
+ var fields = this.getFields(level);
+ var showIcon = this.hasField(items, this.getField('iconCss', level));
+ var listBaseOptions = {
+ showIcon: showIcon,
+ moduleName: 'menu',
+ fields: fields,
+ template: this.template,
+ itemNavigable: true,
+ itemCreating: function (args) {
+ if (!args.curData[args.fields[fields.id]]) {
+ args.curData[args.fields[fields.id]] = Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["getUniqueID"])('menuitem');
+ }
+ if (Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["isNullOrUndefined"])(args.curData.htmlAttributes)) {
+ args.curData.htmlAttributes = {};
+ }
+ Object.assign(args.curData.htmlAttributes, { role: 'menuitem', tabindex: '-1' });
+ if (_this.isMenu && !args.curData[_this.getField('separator', level)]) {
+ args.curData.htmlAttributes['aria-label'] = args.curData[args.fields.text] ?
+ args.curData[args.fields.text] : args.curData[args.fields.id];
+ }
+ if (args.curData[args.fields[fields.iconCss]] === '') {
+ args.curData[args.fields[fields.iconCss]] = null;
+ }
+ },
+ itemCreated: function (args) {
+ if (args.curData[_this.getField('separator', level)]) {
+ args.item.classList.add(SEPARATOR);
+ args.item.setAttribute('role', 'separator');
+ }
+ if (showIcon && !args.curData[args.fields.iconCss]
+ && !args.curData[_this.getField('separator', level)]) {
+ args.item.classList.add('e-blankicon');
+ }
+ if (args.curData[args.fields.child]
+ && args.curData[args.fields.child].length) {
+ var span = _this.createElement('span', { className: ICONS + ' ' + CARET });
+ args.item.appendChild(span);
+ args.item.setAttribute('aria-haspopup', 'true');
+ args.item.setAttribute('aria-expanded', 'false');
+ args.item.classList.add('e-menu-caret-icon');
+ }
+ if (_this.isMenu && _this.template) {
+ args.item.setAttribute('id', args.curData[args.fields.id].toString());
+ args.item.removeAttribute('data-uid');
+ if (args.item.classList.contains('e-level-1')) {
+ args.item.classList.remove('e-level-1');
+ }
+ if (args.item.classList.contains('e-has-child')) {
+ args.item.classList.remove('e-has-child');
+ }
+ args.item.removeAttribute('aria-level');
+ }
+ var eventArgs = { item: args.curData, element: args.item };
+ _this.trigger('beforeItemRender', eventArgs);
+ }
+ };
+ this.setProperties({ 'items': this.items }, true);
+ if (this.isMenu) {
+ listBaseOptions.templateID = this.element.id + TEMPLATE_PROPERTY;
+ }
+ var ul = _ej2_lists__WEBPACK_IMPORTED_MODULE_1__["ListBase"].createList(this.createElement, items, listBaseOptions, !this.template, this);
+ ul.setAttribute('tabindex', '0');
+ if (this.isMenu) {
+ ul.setAttribute('role', 'menu');
+ }
+ else {
+ ul.setAttribute('role', 'menubar');
+ }
+ return ul;
+ };
+ MenuBase.prototype.moverHandler = function (e) {
+ var trgt = e.target;
+ this.liTrgt = trgt;
+ var cli = this.getLI(trgt);
+ var wrapper = cli ? Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["closest"])(cli, '.e-' + this.getModuleName() + '-wrapper') : this.getWrapper();
+ var hdrWrapper = this.getWrapper();
+ var regex = new RegExp('-ej2menu-(.*)-popup');
+ var ulId;
+ var isDifferentElem = false;
+ if (!wrapper) {
+ return;
+ }
+ if (wrapper.id !== '') {
+ ulId = regex.exec(wrapper.id)[1];
+ }
+ else {
+ ulId = wrapper.querySelector('ul').id;
+ }
+ if (ulId !== this.element.id) {
+ this.removeLIStateByClass([FOCUSED, SELECTED], [this.getWrapper()]);
+ if (this.navIdx.length) {
+ isDifferentElem = true;
+ }
+ else {
+ return;
+ }
+ }
+ if (cli && Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["closest"])(cli, '.e-' + this.getModuleName() + '-wrapper') && !isDifferentElem) {
+ this.removeLIStateByClass([FOCUSED], this.isMenu ? [wrapper].concat(this.getPopups()) : [wrapper]);
+ this.removeLIStateByClass([FOCUSED], this.isMenu ? [hdrWrapper].concat(this.getPopups()) : [hdrWrapper]);
+ cli.classList.add(FOCUSED);
+ if (!this.showItemOnClick) {
+ this.clickHandler(e);
+ }
+ }
+ else if (this.isMenu && this.showItemOnClick && !isDifferentElem) {
+ this.removeLIStateByClass([FOCUSED], [wrapper].concat(this.getPopups()));
+ }
+ if (this.isMenu) {
+ if (!this.showItemOnClick && (trgt.parentElement !== wrapper && !Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["closest"])(trgt, '.e-' + this.getModuleName() + '-popup'))
+ && (!cli || (cli && !this.getIndex(cli.id, true).length)) && this.showSubMenuOn !== 'Hover') {
+ this.removeLIStateByClass([FOCUSED], [wrapper]);
+ if (this.navIdx.length) {
+ this.isClosed = true;
+ this.closeMenu(null, e);
+ }
+ }
+ else if (isDifferentElem && !this.showItemOnClick) {
+ if (this.navIdx.length) {
+ this.isClosed = true;
+ this.closeMenu(null, e);
+ }
+ }
+ if (!this.isClosed) {
+ this.removeStateWrapper();
+ }
+ this.isClosed = false;
+ }
+ };
+ MenuBase.prototype.removeStateWrapper = function () {
+ if (this.liTrgt) {
+ var wrapper = Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["closest"])(this.liTrgt, '.e-menu-vscroll');
+ if (this.liTrgt.tagName === 'DIV' && wrapper) {
+ this.removeLIStateByClass([FOCUSED, SELECTED], [wrapper]);
+ }
+ }
+ };
+ MenuBase.prototype.removeLIStateByClass = function (classList, element) {
+ var li;
+ var _loop_1 = function (i) {
+ classList.forEach(function (className) {
+ li = Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["select"])('.' + className, element[i]);
+ if (li) {
+ li.classList.remove(className);
+ }
+ });
+ };
+ for (var i = 0; i < element.length; i++) {
+ _loop_1(i);
+ }
+ };
+ MenuBase.prototype.getField = function (propName, level) {
+ if (level === void 0) { level = 0; }
+ var fieldName = this.fields["" + propName];
+ return typeof fieldName === 'string' ? fieldName :
+ (!fieldName[level] ? fieldName[fieldName.length - 1].toString()
+ : fieldName[level].toString());
+ };
+ MenuBase.prototype.getFields = function (level) {
+ if (level === void 0) { level = 0; }
+ return {
+ id: this.getField('itemId', level),
+ iconCss: this.getField('iconCss', level),
+ text: this.getField('text', level),
+ url: this.getField('url', level),
+ child: this.getField('children', level),
+ separator: this.getField('separator', level)
+ };
+ };
+ MenuBase.prototype.hasField = function (items, field) {
+ for (var i = 0, len = items.length; i < len; i++) {
+ if (items[i]["" + field]) {
+ return true;
+ }
+ }
+ return false;
+ };
+ MenuBase.prototype.menuHeaderClickHandler = function (e) {
+ if (Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["closest"])(e.target, '.e-menu-wrapper').querySelector('ul.e-menu-parent').id !== this.element.id) {
+ return;
+ }
+ if (this.element.className.indexOf('e-hide-menu') > -1) {
+ this.openHamburgerMenu(e);
+ }
+ else {
+ this.closeHamburgerMenu(e);
+ }
+ };
+ MenuBase.prototype.clickHandler = function (e) {
+ if (this.isTapHold) {
+ this.isTapHold = false;
+ }
+ else {
+ var wrapper = this.getWrapper();
+ var trgt = e.target;
+ var cli = this.cli = this.getLI(trgt);
+ var regex = new RegExp('-ej2menu-(.*)-popup');
+ var cliWrapper = cli ? Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["closest"])(cli, '.e-' + this.getModuleName() + '-wrapper') : null;
+ var isInstLI = cli && cliWrapper && (this.isMenu ? this.getIndex(cli.id, true).length > 0
+ : wrapper.firstElementChild.id === cliWrapper.firstElementChild.id);
+ if (_ej2_base__WEBPACK_IMPORTED_MODULE_0__["Browser"].isDevice && this.isMenu) {
+ this.removeLIStateByClass([FOCUSED], [wrapper].concat(this.getPopups()));
+ this.mouseDownHandler(e);
+ }
+ if (cli && cliWrapper && this.isMenu) {
+ var cliWrapperId = cliWrapper.id ? regex.exec(cliWrapper.id)[1] : cliWrapper.querySelector('.e-menu-parent').id;
+ if (this.element.id !== cliWrapperId) {
+ return;
+ }
+ }
+ if (isInstLI && e.type === 'click' && !cli.classList.contains(HEADER)) {
+ this.setLISelected(cli);
+ var navIdx = this.getIndex(cli.id, true);
+ var item = this.getItem(navIdx);
+ var eventArgs = { element: cli, item: item, event: e };
+ this.trigger('select', eventArgs);
+ }
+ if (isInstLI && (e.type === 'mouseover' || _ej2_base__WEBPACK_IMPORTED_MODULE_0__["Browser"].isDevice || this.showItemOnClick)) {
+ var ul = void 0;
+ if (cli.classList.contains(HEADER)) {
+ ul = wrapper.children[this.navIdx.length - 1];
+ this.toggleAnimation(ul);
+ var sli = this.getLIByClass(ul, SELECTED);
+ if (sli) {
+ sli.classList.remove(SELECTED);
+ }
+ Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["detach"])(cli.parentNode);
+ this.navIdx.pop();
+ }
+ else {
+ if (!cli.classList.contains(SEPARATOR)) {
+ this.showSubMenu = true;
+ var cul = cli.parentNode;
+ this.cliIdx = this.getIdx(cul, cli);
+ if (this.isMenu || !_ej2_base__WEBPACK_IMPORTED_MODULE_0__["Browser"].isDevice) {
+ var culIdx = this.isMenu ? Array.prototype.indexOf.call([wrapper].concat(this.getPopups()), Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["closest"])(cul, '.' + 'e-' + this.getModuleName() + '-wrapper'))
+ : this.getIdx(wrapper, cul);
+ if (this.navIdx[culIdx] === this.cliIdx) {
+ this.showSubMenu = false;
+ }
+ if (culIdx !== this.navIdx.length && (e.type !== 'mouseover' || this.showSubMenu)) {
+ var sli = this.getLIByClass(cul, SELECTED);
+ if (sli) {
+ sli.classList.remove(SELECTED);
+ }
+ this.isClosed = true;
+ this.keyType = 'click';
+ if (this.showItemOnClick) {
+ this.setLISelected(cli);
+ }
+ this.closeMenu(culIdx + 1, e);
+ if (this.showItemOnClick) {
+ this.setLISelected(cli);
+ }
+ }
+ }
+ if (!this.isClosed) {
+ this.afterCloseMenu(e);
+ }
+ this.isClosed = false;
+ }
+ }
+ }
+ else {
+ if (this.isMenu && trgt.tagName === 'DIV' && this.navIdx.length && Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["closest"])(trgt, '.e-menu-vscroll')) {
+ var popupEle = Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["closest"])(trgt, '.' + POPUP);
+ var cIdx = Array.prototype.indexOf.call(this.getPopups(), popupEle) + 1;
+ if (cIdx < this.navIdx.length) {
+ this.closeMenu(cIdx + 1, e);
+ if (popupEle) {
+ this.removeLIStateByClass([FOCUSED, SELECTED], [popupEle]);
+ }
+ }
+ }
+ else if (this.isMenu && this.hamburgerMode && trgt.tagName === 'SPAN'
+ && trgt.classList.contains('e-menu-icon')) {
+ this.menuHeaderClickHandler(e);
+ }
+ else {
+ if (trgt.tagName !== 'UL' || (this.isMenu ? trgt.parentElement.classList.contains('e-menu-wrapper') &&
+ !this.getIndex(trgt.querySelector('.' + ITEM).id, true).length : trgt.parentElement !== wrapper)) {
+ if (!cli) {
+ this.removeLIStateByClass([SELECTED], [wrapper]);
+ }
+ if (!cli || !cli.querySelector('.' + CARET)) {
+ this.closeMenu(null, e);
+ }
+ }
+ }
+ }
+ }
+ };
+ MenuBase.prototype.afterCloseMenu = function (e) {
+ var isHeader;
+ if (this.showSubMenu) {
+ if (this.showItemOnClick && this.navIdx.length === 0) {
+ isHeader = Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["closest"])(e.target, '.e-menu-parent.e-control');
+ }
+ else {
+ isHeader = Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["closest"])(this.element, '.e-menu-parent.e-control');
+ }
+ var idx = this.navIdx.concat(this.cliIdx);
+ var item = this.getItem(idx);
+ if (item && item[this.getField('children', idx.length - 1)] &&
+ item[this.getField('children', idx.length - 1)].length) {
+ if (e.type === 'mouseover' || (_ej2_base__WEBPACK_IMPORTED_MODULE_0__["Browser"].isDevice && this.isMenu)) {
+ this.setLISelected(this.cli);
+ }
+ if ((!this.hamburgerMode && isHeader) || (this.hamburgerMode && this.cli.getAttribute('aria-expanded') === 'false')) {
+ this.cli.setAttribute('aria-expanded', 'true');
+ this.navIdx.push(this.cliIdx);
+ this.openMenu(this.cli, item, null, null, e);
+ }
+ }
+ else {
+ if (e.type !== 'mouseover') {
+ this.closeMenu(null, e);
+ }
+ }
+ if (!isHeader) {
+ var cul = this.getUlByNavIdx();
+ var sli = this.getLIByClass(cul, SELECTED);
+ if (sli) {
+ sli.setAttribute('aria-expanded', 'false');
+ sli.classList.remove(SELECTED);
+ }
+ }
+ }
+ this.keyType = '';
+ };
+ MenuBase.prototype.setLISelected = function (li) {
+ var sli = this.getLIByClass(li.parentElement, SELECTED);
+ if (sli) {
+ sli.classList.remove(SELECTED);
+ }
+ if (!this.isMenu) {
+ li.classList.remove(FOCUSED);
+ }
+ li.classList.add(SELECTED);
+ };
+ MenuBase.prototype.getLIByClass = function (ul, classname) {
+ for (var i = 0, len = ul.children.length; i < len; i++) {
+ if (ul.children[i].classList.contains(classname)) {
+ return ul.children[i];
+ }
+ }
+ return null;
+ };
+ /**
+ * This method is used to get the index of the menu item in the Menu based on the argument.
+ *
+ * @param {MenuItem | string} item - item be passed to get the index | id to be passed to get the item index.
+ * @param {boolean} isUniqueId - Set `true` if it is a unique id.
+ * @returns {void}
+ */
+ MenuBase.prototype.getItemIndex = function (item, isUniqueId) {
+ var idx;
+ if (typeof item === 'string') {
+ idx = item;
+ }
+ else {
+ idx = item.id;
+ }
+ var isText = (isUniqueId === false) ? false : true;
+ var navIdx = this.getIndex(idx, isText);
+ return navIdx;
+ };
+ /**
+ * This method is used to set the menu item in the Menu based on the argument.
+ *
+ * @param {MenuItem} item - item need to be updated.
+ * @param {string} id - id / text to be passed to update the item.
+ * @param {boolean} isUniqueId - Set `true` if it is a unique id.
+ * @returns {void}
+ */
+ MenuBase.prototype.setItem = function (item, id, isUniqueId) {
+ var idx;
+ if (isUniqueId) {
+ idx = id ? id : item.id;
+ }
+ else {
+ idx = id ? id : item.text;
+ }
+ var navIdx = this.getIndex(idx, isUniqueId);
+ var newItem = this.getItem(navIdx);
+ Object.assign(newItem, item);
+ };
+ MenuBase.prototype.getItem = function (navIdx) {
+ navIdx = navIdx.slice();
+ var idx = navIdx.pop();
+ var items = this.getItems(navIdx);
+ return items[idx];
+ };
+ MenuBase.prototype.getItems = function (navIdx) {
+ var items = this.items;
+ for (var i = 0; i < navIdx.length; i++) {
+ items = items[navIdx[i]][this.getField('children', i)];
+ }
+ return items;
+ };
+ MenuBase.prototype.setItems = function (newItems, navIdx) {
+ var items = this.getItems(navIdx);
+ items.splice(0, items.length);
+ for (var i = 0; i < newItems.length; i++) {
+ items.splice(i, 0, newItems[i]);
+ }
+ };
+ MenuBase.prototype.getIdx = function (ul, li, skipHdr) {
+ if (skipHdr === void 0) { skipHdr = true; }
+ var idx = Array.prototype.indexOf.call(ul.children, li);
+ if (skipHdr && ul.children[0].classList.contains(HEADER)) {
+ idx--;
+ }
+ return idx;
+ };
+ MenuBase.prototype.getLI = function (elem) {
+ if (elem.tagName === 'LI' && elem.classList.contains('e-menu-item')) {
+ return elem;
+ }
+ return Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["closest"])(elem, 'li.e-menu-item');
+ };
+ MenuBase.prototype.updateItemsByNavIdx = function () {
+ var items = this.items;
+ var count = 0;
+ for (var index = 0; index < this.navIdx.length; index++) {
+ items = items[index].items;
+ if (!items) {
+ break;
+ }
+ count++;
+ var ul = this.getUlByNavIdx(count);
+ if (!ul) {
+ break;
+ }
+ this.updateItem(ul, items);
+ }
+ };
+ MenuBase.prototype.removeChildElement = function (elem) {
+ while (elem.firstElementChild) {
+ elem.removeChild(elem.firstElementChild);
+ }
+ return elem;
+ };
+ /**
+ * Called internally if any of the property value changed.
+ *
+ * @private
+ * @param {MenuBaseModel} newProp - Specifies the new properties
+ * @param {MenuBaseModel} oldProp - Specifies the old properties
+ * @returns {void}
+ */
+ MenuBase.prototype.onPropertyChanged = function (newProp, oldProp) {
+ var _this = this;
+ var wrapper = this.getWrapper();
+ var _loop_2 = function (prop) {
+ switch (prop) {
+ case 'cssClass':
+ if (oldProp.cssClass) {
+ Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["removeClass"])([wrapper], oldProp.cssClass.split(' '));
+ }
+ if (newProp.cssClass) {
+ Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["addClass"])([wrapper], newProp.cssClass.replace(/\s+/g, ' ').trim().split(' '));
+ }
+ break;
+ case 'enableRtl':
+ wrapper.classList.toggle(RTL);
+ break;
+ case 'showItemOnClick':
+ this_1.unWireEvents();
+ this_1.showItemOnClick = newProp.showItemOnClick;
+ this_1.wireEvents();
+ break;
+ case 'enableScrolling':
+ if (newProp.enableScrolling) {
+ var ul_2;
+ if (this_1.element.classList.contains('e-vertical')) {
+ Object(_common_menu_scroll__WEBPACK_IMPORTED_MODULE_5__["addScrolling"])(this_1.createElement, wrapper, this_1.element, 'vscroll', this_1.enableRtl);
+ }
+ else {
+ Object(_common_menu_scroll__WEBPACK_IMPORTED_MODULE_5__["addScrolling"])(this_1.createElement, wrapper, this_1.element, 'hscroll', this_1.enableRtl);
+ }
+ this_1.getPopups().forEach(function (wrapper) {
+ ul_2 = Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["select"])('.e-ul', wrapper);
+ Object(_common_menu_scroll__WEBPACK_IMPORTED_MODULE_5__["addScrolling"])(_this.createElement, wrapper, ul_2, 'vscroll', _this.enableRtl);
+ });
+ }
+ else {
+ var ul_3 = wrapper.children[0];
+ if (this_1.element.classList.contains('e-vertical')) {
+ Object(_common_menu_scroll__WEBPACK_IMPORTED_MODULE_5__["destroyScroll"])(Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["getInstance"])(ul_3, _common_v_scroll__WEBPACK_IMPORTED_MODULE_4__["VScroll"]), ul_3);
+ }
+ else {
+ Object(_common_menu_scroll__WEBPACK_IMPORTED_MODULE_5__["destroyScroll"])(Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["getInstance"])(ul_3, _common_h_scroll__WEBPACK_IMPORTED_MODULE_3__["HScroll"]), ul_3);
+ }
+ wrapper.style.overflow = '';
+ wrapper.appendChild(this_1.element);
+ this_1.getPopups().forEach(function (wrapper) {
+ ul_3 = wrapper.children[0];
+ Object(_common_menu_scroll__WEBPACK_IMPORTED_MODULE_5__["destroyScroll"])(Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["getInstance"])(ul_3, _common_v_scroll__WEBPACK_IMPORTED_MODULE_4__["VScroll"]), ul_3);
+ wrapper.style.overflow = '';
+ });
+ }
+ break;
+ case 'items': {
+ var idx = void 0;
+ var navIdx = void 0;
+ var item = void 0;
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
+ if (this_1.isReact && this_1.template) {
+ this_1.clearTemplate(['template']);
+ }
+ if (!Object.keys(oldProp.items).length) {
+ this_1.updateItem(this_1.element, this_1.items);
+ if (this_1.enableScrolling && this_1.element.parentElement.classList.contains('e-custom-scroll')) {
+ if (this_1.element.classList.contains('e-vertical')) {
+ Object(_common_menu_scroll__WEBPACK_IMPORTED_MODULE_5__["addScrolling"])(this_1.createElement, wrapper, this_1.element, 'vscroll', this_1.enableRtl);
+ }
+ else {
+ Object(_common_menu_scroll__WEBPACK_IMPORTED_MODULE_5__["addScrolling"])(this_1.createElement, wrapper, this_1.element, 'hscroll', this_1.enableRtl);
+ }
+ }
+ if (!this_1.hamburgerMode) {
+ for (var i = 1, count = wrapper.childElementCount; i < count; i++) {
+ Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["detach"])(wrapper.lastElementChild);
+ }
+ }
+ this_1.navIdx = [];
+ }
+ else {
+ var keys = Object.keys(newProp.items);
+ for (var i = 0; i < keys.length; i++) {
+ navIdx = this_1.getChangedItemIndex(newProp, [], Number(keys[i]));
+ if (navIdx.length <= this_1.getWrapper().children.length) {
+ idx = navIdx.pop();
+ item = this_1.getItems(navIdx);
+ this_1.insertAfter([item[idx]], item[idx].text);
+ this_1.removeItem(item, navIdx, idx);
+ this_1.setItems(item, navIdx);
+ }
+ navIdx.length = 0;
+ }
+ }
+ break;
+ }
+ }
+ };
+ var this_1 = this;
+ for (var _i = 0, _a = Object.keys(newProp); _i < _a.length; _i++) {
+ var prop = _a[_i];
+ _loop_2(prop);
+ }
+ };
+ MenuBase.prototype.updateItem = function (ul, items) {
+ if (Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["isBlazor"])() && !this.isMenu) {
+ ul = this.removeChildElement(ul);
+ }
+ else {
+ if (this.enableScrolling) {
+ var wrapper1 = this.getWrapper();
+ var ul1 = wrapper1.children[0];
+ if (this.element.classList.contains('e-vertical')) {
+ Object(_common_menu_scroll__WEBPACK_IMPORTED_MODULE_5__["destroyScroll"])(Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["getInstance"])(ul1, _common_v_scroll__WEBPACK_IMPORTED_MODULE_4__["VScroll"]), ul1);
+ }
+ else {
+ Object(_common_menu_scroll__WEBPACK_IMPORTED_MODULE_5__["destroyScroll"])(Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["getInstance"])(ul1, _common_h_scroll__WEBPACK_IMPORTED_MODULE_3__["HScroll"]), ul1);
+ }
+ }
+ ul.innerHTML = '';
+ }
+ var lis = [].slice.call(this.createItems(items).children);
+ lis.forEach(function (li) {
+ ul.appendChild(li);
+ });
+ };
+ MenuBase.prototype.getChangedItemIndex = function (newProp, index, idx) {
+ index.push(idx);
+ var key = Object.keys(newProp.items[idx]).pop();
+ if (key === 'items') {
+ var item = newProp.items[idx];
+ var popStr = Object.keys(item.items).pop();
+ if (popStr) {
+ this.getChangedItemIndex(item, index, Number(popStr));
+ }
+ }
+ else {
+ if (key === 'isParentArray' && index.length > 1) {
+ index.pop();
+ }
+ }
+ return index;
+ };
+ MenuBase.prototype.removeItem = function (item, navIdx, idx) {
+ item.splice(idx, 1);
+ var uls = this.getWrapper().children;
+ if (navIdx.length < uls.length) {
+ Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["detach"])(uls[navIdx.length].children[idx]);
+ }
+ };
+ /**
+ * Used to unwire the bind events.
+ *
+ * @private
+ * @param {string} targetSelctor - Specifies the target selector
+ * @returns {void}
+ */
+ MenuBase.prototype.unWireEvents = function (targetSelctor) {
+ if (targetSelctor === void 0) { targetSelctor = this.target; }
+ var wrapper = this.getWrapper();
+ if (targetSelctor) {
+ var target = void 0;
+ var touchModule = void 0;
+ var targetElems = Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["selectAll"])(targetSelctor);
+ for (var i = 0, len = targetElems.length; i < len; i++) {
+ target = targetElems[i];
+ if (this.isMenu) {
+ _ej2_base__WEBPACK_IMPORTED_MODULE_0__["EventHandler"].remove(target, 'click', this.menuHeaderClickHandler);
+ }
+ else {
+ if (_ej2_base__WEBPACK_IMPORTED_MODULE_0__["Browser"].isIos) {
+ touchModule = Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["getInstance"])(target, _ej2_base__WEBPACK_IMPORTED_MODULE_0__["Touch"]);
+ if (touchModule) {
+ touchModule.destroy();
+ }
+ }
+ else {
+ _ej2_base__WEBPACK_IMPORTED_MODULE_0__["EventHandler"].remove(target, 'contextmenu', this.cmenuHandler);
+ }
+ }
+ }
+ if (!this.isMenu) {
+ _ej2_base__WEBPACK_IMPORTED_MODULE_0__["EventHandler"].remove(this.targetElement, 'mousewheel DOMMouseScroll', this.scrollHandler);
+ for (var _i = 0, _a = Object(_ej2_popups__WEBPACK_IMPORTED_MODULE_2__["getScrollableParent"])(this.targetElement); _i < _a.length; _i++) {
+ var parent_2 = _a[_i];
+ _ej2_base__WEBPACK_IMPORTED_MODULE_0__["EventHandler"].remove(parent_2, 'mousewheel DOMMouseScroll', this.scrollHandler);
+ }
+ }
+ }
+ if (!_ej2_base__WEBPACK_IMPORTED_MODULE_0__["Browser"].isDevice) {
+ _ej2_base__WEBPACK_IMPORTED_MODULE_0__["EventHandler"].remove(this.isMenu ? document : wrapper, 'mouseover', this.delegateMoverHandler);
+ _ej2_base__WEBPACK_IMPORTED_MODULE_0__["EventHandler"].remove(document, 'mousedown', this.delegateMouseDownHandler);
+ }
+ _ej2_base__WEBPACK_IMPORTED_MODULE_0__["EventHandler"].remove(document, 'click', this.delegateClickHandler);
+ this.unWireKeyboardEvent(wrapper);
+ this.rippleFn();
+ };
+ MenuBase.prototype.unWireKeyboardEvent = function (element) {
+ var keyboardModule = Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["getInstance"])(element, _ej2_base__WEBPACK_IMPORTED_MODULE_0__["KeyboardEvents"]);
+ if (keyboardModule) {
+ keyboardModule.destroy();
+ }
+ };
+ MenuBase.prototype.toggleAnimation = function (ul, isMenuOpen) {
+ var _this = this;
+ if (isMenuOpen === void 0) { isMenuOpen = true; }
+ var pUlHeight;
+ var pElement;
+ if (this.animationSettings.effect === 'None' || !isMenuOpen) {
+ this.end(ul, isMenuOpen);
+ }
+ else {
+ this.animation.animate(ul, {
+ name: this.animationSettings.effect,
+ duration: this.animationSettings.duration,
+ timingFunction: this.animationSettings.easing,
+ begin: function (options) {
+ if (_this.hamburgerMode) {
+ pElement = options.element.parentElement;
+ options.element.style.position = 'absolute';
+ pUlHeight = pElement.offsetHeight;
+ options.element.style.maxHeight = options.element.offsetHeight + 'px';
+ pElement.style.maxHeight = '';
+ }
+ else {
+ options.element.style.display = 'block';
+ options.element.style.maxHeight = options.element.getBoundingClientRect().height + 'px';
+ }
+ },
+ progress: function (options) {
+ if (_this.hamburgerMode) {
+ pElement.style.minHeight = (pUlHeight + options.element.offsetHeight) + 'px';
+ }
+ },
+ end: function (options) {
+ if (_this.hamburgerMode) {
+ options.element.style.position = '';
+ options.element.style.maxHeight = '';
+ pElement.style.minHeight = '';
+ options.element.style.top = 0 + 'px';
+ options.element.children[0].focus();
+ _this.triggerOpen(options.element.children[0]);
+ }
+ else {
+ _this.end(options.element, isMenuOpen);
+ }
+ }
+ });
+ }
+ };
+ MenuBase.prototype.triggerOpen = function (ul) {
+ var item = this.navIdx.length ? this.getItem(this.navIdx) : null;
+ var eventArgs = {
+ element: ul, parentItem: item, items: item ? item.items : this.items
+ };
+ this.trigger('onOpen', eventArgs);
+ if (!this.isMenu) {
+ _ej2_base__WEBPACK_IMPORTED_MODULE_0__["EventHandler"].add(ul, 'keydown', this.keyHandler, this);
+ }
+ };
+ MenuBase.prototype.end = function (ul, isMenuOpen) {
+ if (isMenuOpen) {
+ ul.style.display = 'block';
+ ul.style.maxHeight = '';
+ this.triggerOpen(ul);
+ if (ul.querySelector('.' + FOCUSED)) {
+ ul.querySelector('.' + FOCUSED).focus();
+ }
+ else {
+ var ele = this.getWrapper().children[this.getIdx(this.getWrapper(), ul) - 1];
+ if (this.currentTarget) {
+ if (!(this.currentTarget.classList.contains('e-numerictextbox') || this.currentTarget.classList.contains('e-textbox') || this.currentTarget.tagName === 'INPUT')) {
+ if (ele) {
+ ele.querySelector('.' + SELECTED).focus();
+ }
+ else {
+ this.element.focus();
+ }
+ }
+ }
+ else {
+ if (ele) {
+ ele.querySelector('.' + SELECTED).focus();
+ }
+ else {
+ this.element.focus();
+ }
+ }
+ }
+ }
+ else {
+ if (ul === this.element) {
+ var fli = this.getLIByClass(this.element, FOCUSED);
+ if (fli) {
+ fli.classList.remove(FOCUSED);
+ }
+ var sli = this.getLIByClass(this.element, SELECTED);
+ if (sli) {
+ sli.classList.remove(SELECTED);
+ }
+ ul.style.display = 'none';
+ }
+ else {
+ Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["detach"])(ul);
+ }
+ }
+ };
+ /**
+ * Get the properties to be maintained in the persisted state.
+ *
+ * @returns {string} - Persist data
+ */
+ MenuBase.prototype.getPersistData = function () {
+ return '';
+ };
+ /**
+ * Get wrapper element.
+ *
+ * @returns {Element} - Wrapper element
+ * @private
+ */
+ MenuBase.prototype.getWrapper = function () {
+ return Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["closest"])(this.element, '.e-' + this.getModuleName() + '-wrapper');
+ };
+ MenuBase.prototype.getIndex = function (data, isUniqueId, items, nIndex, isCallBack, level) {
+ if (items === void 0) { items = this.items; }
+ if (nIndex === void 0) { nIndex = []; }
+ if (isCallBack === void 0) { isCallBack = false; }
+ if (level === void 0) { level = 0; }
+ var item;
+ level = isCallBack ? level + 1 : 0;
+ for (var i = 0, len = items.length; i < len; i++) {
+ item = items[i];
+ if ((isUniqueId ? item[this.getField('itemId', level)] : item[this.getField('text', level)]) === data) {
+ nIndex.push(i);
+ break;
+ }
+ else if (item[this.getField('children', level)]
+ && item[this.getField('children', level)].length) {
+ nIndex = this.getIndex(data, isUniqueId, item[this.getField('children', level)], nIndex, true, level);
+ if (nIndex[nIndex.length - 1] === -1) {
+ if (i !== len - 1) {
+ nIndex.pop();
+ }
+ }
+ else {
+ nIndex.unshift(i);
+ break;
+ }
+ }
+ else {
+ if (i === len - 1) {
+ nIndex.push(-1);
+ }
+ }
+ }
+ return (!isCallBack && nIndex[0] === -1) ? [] : nIndex;
+ };
+ /**
+ * This method is used to enable or disable the menu items in the Menu based on the items and enable argument.
+ *
+ * @param {string[]} items - Text items that needs to be enabled/disabled.
+ * @param {boolean} enable - Set `true`/`false` to enable/disable the list items.
+ * @param {boolean} isUniqueId - Set `true` if it is a unique id.
+ * @returns {void}
+ */
+ MenuBase.prototype.enableItems = function (items, enable, isUniqueId) {
+ if (enable === void 0) { enable = true; }
+ var ul;
+ var idx;
+ var navIdx;
+ var disabled = DISABLED;
+ var skipItem;
+ for (var i = 0; i < items.length; i++) {
+ navIdx = this.getIndex(items[i], isUniqueId);
+ if (this.navIdx.length) {
+ if (navIdx.length !== 1) {
+ skipItem = false;
+ for (var i_1 = 0, len = navIdx.length - 1; i_1 < len; i_1++) {
+ if (navIdx[i_1] !== this.navIdx[i_1]) {
+ skipItem = true;
+ break;
+ }
+ }
+ if (skipItem) {
+ continue;
+ }
+ }
+ }
+ else {
+ if (navIdx.length !== 1) {
+ continue;
+ }
+ }
+ idx = navIdx.pop();
+ ul = this.getUlByNavIdx(navIdx.length);
+ if (ul && !Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["isNullOrUndefined"])(idx)) {
+ if (enable) {
+ if (this.isMenu) {
+ ul.children[idx].classList.remove(disabled);
+ ul.children[idx].removeAttribute('aria-disabled');
+ }
+ else {
+ if (_ej2_base__WEBPACK_IMPORTED_MODULE_0__["Browser"].isDevice && !ul.classList.contains('e-contextmenu')) {
+ ul.children[idx + 1].classList.remove(disabled);
+ }
+ else {
+ ul.children[idx].classList.remove(disabled);
+ }
+ }
+ }
+ else {
+ if (this.isMenu) {
+ ul.children[idx].classList.add(disabled);
+ ul.children[idx].setAttribute('aria-disabled', 'true');
+ }
+ else {
+ if (_ej2_base__WEBPACK_IMPORTED_MODULE_0__["Browser"].isDevice && !ul.classList.contains('e-contextmenu')) {
+ ul.children[idx + 1].classList.add(disabled);
+ }
+ else {
+ ul.children[idx].classList.add(disabled);
+ }
+ }
+ }
+ }
+ }
+ };
+ /**
+ * This method is used to show the menu items in the Menu based on the items text.
+ *
+ * @param {string[]} items - Text items that needs to be shown.
+ * @param {boolean} isUniqueId - Set `true` if it is a unique id.
+ * @returns {void}
+ */
+ MenuBase.prototype.showItems = function (items, isUniqueId) {
+ this.showHideItems(items, false, isUniqueId);
+ };
+ /**
+ * This method is used to hide the menu items in the Menu based on the items text.
+ *
+ * @param {string[]} items - Text items that needs to be hidden.
+ * @param {boolean} isUniqueId - Set `true` if it is a unique id.
+ * @returns {void}
+ */
+ MenuBase.prototype.hideItems = function (items, isUniqueId) {
+ this.showHideItems(items, true, isUniqueId);
+ };
+ MenuBase.prototype.showHideItems = function (items, ishide, isUniqueId) {
+ var ul;
+ var index;
+ var navIdx;
+ for (var i = 0; i < items.length; i++) {
+ navIdx = this.getIndex(items[i], isUniqueId);
+ index = navIdx.pop();
+ ul = this.getUlByNavIdx(navIdx.length);
+ if (ul) {
+ var validUl = isUniqueId ? ul.children[index].id : ul.children[index].textContent;
+ if (ishide && validUl === items[i]) {
+ ul.children[index].classList.add(HIDE);
+ }
+ else {
+ ul.children[index].classList.remove(HIDE);
+ }
+ }
+ }
+ };
+ /**
+ * It is used to remove the menu items from the Menu based on the items text.
+ *
+ * @param {string[]} items Text items that needs to be removed.
+ * @param {boolean} isUniqueId - Set `true` if it is a unique id.
+ * @returns {void}
+ */
+ MenuBase.prototype.removeItems = function (items, isUniqueId) {
+ var idx;
+ var navIdx;
+ var iitems;
+ for (var i = 0; i < items.length; i++) {
+ navIdx = this.getIndex(items[i], isUniqueId);
+ idx = navIdx.pop();
+ iitems = this.getItems(navIdx);
+ if (!Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["isNullOrUndefined"])(idx)) {
+ this.removeItem(iitems, navIdx, idx);
+ }
+ }
+ };
+ /**
+ * It is used to insert the menu items after the specified menu item text.
+ *
+ * @param {MenuItemModel[]} items - Items that needs to be inserted.
+ * @param {string} text - Text item after that the element to be inserted.
+ * @param {boolean} isUniqueId - Set `true` if it is a unique id.
+ * @returns {void}
+ */
+ MenuBase.prototype.insertAfter = function (items, text, isUniqueId) {
+ this.insertItems(items, text, isUniqueId);
+ };
+ /**
+ * It is used to insert the menu items before the specified menu item text.
+ *
+ * @param {MenuItemModel[]} items - Items that needs to be inserted.
+ * @param {string} text - Text item before that the element to be inserted.
+ * @param {boolean} isUniqueId - Set `true` if it is a unique id.
+ * @returns {void}
+ */
+ MenuBase.prototype.insertBefore = function (items, text, isUniqueId) {
+ this.insertItems(items, text, isUniqueId, false);
+ };
+ MenuBase.prototype.insertItems = function (items, text, isUniqueId, isAfter) {
+ if (isAfter === void 0) { isAfter = true; }
+ var li;
+ var idx;
+ var navIdx;
+ var iitems;
+ var menuitem;
+ for (var i = 0; i < items.length; i++) {
+ navIdx = this.getIndex(text, isUniqueId);
+ idx = navIdx.pop();
+ iitems = this.getItems(navIdx);
+ menuitem = new MenuItem(iitems[0], 'items', items[i], true);
+ iitems.splice(isAfter ? idx + 1 : idx, 0, menuitem);
+ var uls = this.isMenu ? [this.getWrapper()].concat(this.getPopups()) : [].slice.call(this.getWrapper().children);
+ if (!Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["isNullOrUndefined"])(idx) && navIdx.length < uls.length) {
+ idx = isAfter ? idx + 1 : idx;
+ li = this.createItems(iitems).children[idx];
+ var ul = this.isMenu ? Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["select"])('.e-menu-parent', uls[navIdx.length]) : uls[navIdx.length];
+ ul.insertBefore(li, ul.children[idx]);
+ }
+ }
+ };
+ MenuBase.prototype.removeAttributes = function () {
+ var _this = this;
+ ['top', 'left', 'display', 'z-index'].forEach(function (key) {
+ _this.element.style.removeProperty(key);
+ });
+ ['role', 'tabindex', 'class', 'style'].forEach(function (key) {
+ if (key === 'class' && _this.element.classList.contains('e-menu-parent')) {
+ _this.element.classList.remove('e-menu-parent');
+ }
+ if (['class', 'style'].indexOf(key) === -1 || !_this.element.getAttribute(key)) {
+ _this.element.removeAttribute(key);
+ }
+ if (_this.isMenu && key === 'class' && _this.element.classList.contains('e-vertical')) {
+ _this.element.classList.remove('e-vertical');
+ }
+ });
+ };
+ /**
+ * Destroys the widget.
+ *
+ * @returns {void}
+ */
+ MenuBase.prototype.destroy = function () {
+ var wrapper = this.getWrapper();
+ if (wrapper) {
+ this.unWireEvents();
+ if (!this.isMenu) {
+ this.clonedElement.style.display = '';
+ if (this.clonedElement.tagName === 'EJS-CONTEXTMENU') {
+ Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["addClass"])([this.clonedElement], ['e-control', 'e-lib', 'e-' + this.getModuleName()]);
+ this.element = this.clonedElement;
+ }
+ else {
+ if (this.refreshing && this.clonedElement.childElementCount && this.clonedElement.children[0].tagName === 'LI') {
+ this.setProperties({ 'items': [] }, true);
+ }
+ if (document.getElementById(this.clonedElement.id)) {
+ var refEle = this.clonedElement.nextElementSibling;
+ if (refEle && refEle !== wrapper) {
+ this.clonedElement.parentElement.insertBefore(this.element, refEle);
+ }
+ else {
+ this.clonedElement.parentElement.appendChild(this.element);
+ }
+ if (Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["isBlazor"])() && !this.isMenu) {
+ this.element = this.removeChildElement(this.element);
+ }
+ else {
+ this.element.innerHTML = '';
+ }
+ Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["append"])([].slice.call(this.clonedElement.children), this.element);
+ Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["detach"])(this.clonedElement);
+ this.removeAttributes();
+ }
+ }
+ this.clonedElement = null;
+ }
+ else {
+ this.closeMenu();
+ if (Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["isBlazor"])() && !this.isMenu) {
+ this.element = this.removeChildElement(this.element);
+ }
+ else {
+ this.element.innerHTML = '';
+ }
+ this.removeAttributes();
+ wrapper.parentNode.insertBefore(this.element, wrapper);
+ this.clonedElement = null;
+ }
+ if (this.isMenu && this.clonedElement) {
+ Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["detach"])(this.element);
+ wrapper.style.display = '';
+ wrapper.classList.remove('e-' + this.getModuleName() + '-wrapper');
+ wrapper.removeAttribute('data-ripple');
+ }
+ else {
+ Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["detach"])(wrapper);
+ }
+ _super.prototype.destroy.call(this);
+ if (this.template) {
+ this.clearTemplate(['template']);
+ }
+ }
+ this.rippleFn = null;
+ };
+ __decorate([
+ Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["Event"])()
+ ], MenuBase.prototype, "beforeItemRender", void 0);
+ __decorate([
+ Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["Event"])()
+ ], MenuBase.prototype, "beforeOpen", void 0);
+ __decorate([
+ Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["Event"])()
+ ], MenuBase.prototype, "onOpen", void 0);
+ __decorate([
+ Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["Event"])()
+ ], MenuBase.prototype, "beforeClose", void 0);
+ __decorate([
+ Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["Event"])()
+ ], MenuBase.prototype, "onClose", void 0);
+ __decorate([
+ Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["Event"])()
+ ], MenuBase.prototype, "select", void 0);
+ __decorate([
+ Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["Event"])()
+ ], MenuBase.prototype, "created", void 0);
+ __decorate([
+ Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["Property"])('')
+ ], MenuBase.prototype, "cssClass", void 0);
+ __decorate([
+ Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["Property"])(0)
+ ], MenuBase.prototype, "hoverDelay", void 0);
+ __decorate([
+ Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["Property"])(false)
+ ], MenuBase.prototype, "showItemOnClick", void 0);
+ __decorate([
+ Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["Property"])('')
+ ], MenuBase.prototype, "target", void 0);
+ __decorate([
+ Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["Property"])('')
+ ], MenuBase.prototype, "filter", void 0);
+ __decorate([
+ Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["Property"])(null)
+ ], MenuBase.prototype, "template", void 0);
+ __decorate([
+ Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["Property"])(false)
+ ], MenuBase.prototype, "enableScrolling", void 0);
+ __decorate([
+ Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["Property"])(false)
+ ], MenuBase.prototype, "enableHtmlSanitizer", void 0);
+ __decorate([
+ Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["Complex"])({ itemId: 'id', text: 'text', parentId: 'parentId', iconCss: 'iconCss', url: 'url', separator: 'separator', children: 'items' }, FieldSettings)
+ ], MenuBase.prototype, "fields", void 0);
+ __decorate([
+ Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["Collection"])([], MenuItem)
+ ], MenuBase.prototype, "items", void 0);
+ __decorate([
+ Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["Complex"])({ duration: 400, easing: 'ease', effect: 'SlideDown' }, MenuAnimationSettings)
+ ], MenuBase.prototype, "animationSettings", void 0);
+ MenuBase = __decorate([
+ _ej2_base__WEBPACK_IMPORTED_MODULE_0__["NotifyPropertyChanges"]
+ ], MenuBase);
+ return MenuBase;
+}(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["Component"]));
+
+
+
+/***/ }),
+
+/***/ "./ej2-resources/22.1.37/scripts/ej2-navigations/common/menu-scroll.js":
+/*!*****************************************************************************!*\
+ !*** ./ej2-resources/22.1.37/scripts/ej2-navigations/common/menu-scroll.js ***!
+ \*****************************************************************************/
+/*! exports provided: addScrolling, destroyScroll */
+/***/ (function(module, __webpack_exports__, __webpack_require__) {
+
+"use strict";
+__webpack_require__.r(__webpack_exports__);
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "addScrolling", function() { return addScrolling; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "destroyScroll", function() { return destroyScroll; });
+/* harmony import */ var _ej2_base__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../ej2-base */ "./ej2-resources/22.1.37/scripts/ej2-base/index.js");
+/* harmony import */ var _v_scroll__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./v-scroll */ "./ej2-resources/22.1.37/scripts/ej2-navigations/common/v-scroll.js");
+/* harmony import */ var _h_scroll__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./h-scroll */ "./ej2-resources/22.1.37/scripts/ej2-navigations/common/h-scroll.js");
+
+
+
+/**
+ * Used to add scroll in menu.
+ *
+ * @param {createElementType} createElement - Specifies the create element model
+ * @param {HTMLElement} container - Specifies the element container
+ * @param {HTMLElement} content - Specifies the content element
+ * @param {string} scrollType - Specifies the scroll type
+ * @param {boolean} enableRtl - Specifies the enable RTL property
+ * @param {boolean} offset - Specifies the offset value
+ * @returns {HTMLElement} - Element
+ * @hidden
+ */
+function addScrolling(createElement, container, content, scrollType, enableRtl, offset) {
+ var containerOffset;
+ var contentOffset;
+ var parentElem = container.parentElement;
+ if (scrollType === 'vscroll') {
+ containerOffset = offset || container.getBoundingClientRect().height;
+ contentOffset = content.getBoundingClientRect().height;
+ }
+ else {
+ containerOffset = container.getBoundingClientRect().width;
+ contentOffset = content.getBoundingClientRect().width;
+ }
+ if (containerOffset < contentOffset) {
+ return createScrollbar(createElement, container, content, scrollType, enableRtl, offset);
+ }
+ else if (parentElem) {
+ var width = parentElem.getBoundingClientRect().width;
+ if (width < containerOffset && scrollType === 'hscroll') {
+ contentOffset = width;
+ container.style.maxWidth = width + 'px';
+ return createScrollbar(createElement, container, content, scrollType, enableRtl, offset);
+ }
+ return content;
+ }
+ else {
+ return content;
+ }
+}
+/**
+ * Used to create scroll bar in menu.
+ *
+ * @param {createElementType} createElement - Specifies the create element model
+ * @param {HTMLElement} container - Specifies the element container
+ * @param {HTMLElement} content - Specifies the content element
+ * @param {string} scrollType - Specifies the scroll type
+ * @param {boolean} enableRtl - Specifies the enable RTL property
+ * @param {boolean} offset - Specifies the offset value
+ * @returns {HTMLElement} - Element
+ * @hidden
+ */
+function createScrollbar(createElement, container, content, scrollType, enableRtl, offset) {
+ var scrollEle = createElement('div', { className: 'e-menu-' + scrollType });
+ container.appendChild(scrollEle);
+ scrollEle.appendChild(content);
+ if (offset) {
+ scrollEle.style.overflow = 'hidden';
+ scrollEle.style.height = offset + 'px';
+ }
+ else {
+ scrollEle.style.maxHeight = container.style.maxHeight;
+ container.style.overflow = 'hidden';
+ }
+ var scrollObj;
+ if (scrollType === 'vscroll') {
+ scrollObj = new _v_scroll__WEBPACK_IMPORTED_MODULE_1__["VScroll"]({ enableRtl: enableRtl }, scrollEle);
+ scrollObj.scrollStep = Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["select"])('.e-' + scrollType + '-bar', container).offsetHeight / 2;
+ }
+ else {
+ scrollObj = new _h_scroll__WEBPACK_IMPORTED_MODULE_2__["HScroll"]({ enableRtl: enableRtl }, scrollEle);
+ scrollObj.scrollStep = Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["select"])('.e-' + scrollType + '-bar', container).offsetWidth;
+ }
+ return scrollEle;
+}
+/**
+ * Used to destroy the scroll option.
+ *
+ * @param {VScroll | HScroll} scrollObj - Specifies the scroller object
+ * @param {Element} element - Specifies the element
+ * @param {HTMLElement} skipEle - Specifies the skip element
+ * @returns {void}
+ * @hidden
+ */
+function destroyScroll(scrollObj, element, skipEle) {
+ if (scrollObj) {
+ var menu = Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["select"])('.e-menu-parent', element);
+ if (menu) {
+ if (!skipEle || skipEle === menu) {
+ scrollObj.destroy();
+ element.parentElement.appendChild(menu);
+ Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["detach"])(element);
+ }
+ }
+ else {
+ scrollObj.destroy();
+ Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["detach"])(element);
+ }
+ }
+}
+
+
+/***/ }),
+
+/***/ "./ej2-resources/22.1.37/scripts/ej2-navigations/common/v-scroll.js":
+/*!**************************************************************************!*\
+ !*** ./ej2-resources/22.1.37/scripts/ej2-navigations/common/v-scroll.js ***!
+ \**************************************************************************/
+/*! exports provided: VScroll */
+/***/ (function(module, __webpack_exports__, __webpack_require__) {
+
+"use strict";
+__webpack_require__.r(__webpack_exports__);
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "VScroll", function() { return VScroll; });
+/* harmony import */ var _ej2_base__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../ej2-base */ "./ej2-resources/22.1.37/scripts/ej2-base/index.js");
+var __extends = (undefined && undefined.__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 = (undefined && undefined.__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 CLS_ROOT = 'e-vscroll';
+var CLS_RTL = 'e-rtl';
+var CLS_DISABLE = 'e-overlay';
+var CLS_VSCROLLBAR = 'e-vscroll-bar';
+var CLS_VSCROLLCON = 'e-vscroll-content';
+var CLS_NAVARROW = 'e-nav-arrow';
+var CLS_NAVUPARROW = 'e-nav-up-arrow';
+var CLS_NAVDOWNARROW = 'e-nav-down-arrow';
+var CLS_VSCROLLNAV = 'e-scroll-nav';
+var CLS_VSCROLLNAVUP = 'e-scroll-up-nav';
+var CLS_VSCROLLNAVDOWN = 'e-scroll-down-nav';
+var CLS_DEVICE = 'e-scroll-device';
+var CLS_OVERLAY = 'e-scroll-overlay';
+var CLS_UPOVERLAY = 'e-scroll-up-overlay';
+var CLS_DOWNOVERLAY = 'e-scroll-down-overlay';
+var OVERLAY_MAXWID = 40;
+/**
+ * VScroll module is introduces vertical scroller when content exceeds the current viewing area.
+ * It can be useful for the components like Toolbar, Tab which needs vertical scrolling alone.
+ * Hidden content can be view by touch moving or icon click.
+ * ```html
+ *
+ *
+ * ```
+ */
+var VScroll = /** @__PURE__ @class */ (function (_super) {
+ __extends(VScroll, _super);
+ /**
+ * Initializes a new instance of the VScroll class.
+ *
+ * @param {VScrollModel} options - Specifies VScroll model properties as options.
+ * @param {string | HTMLElement} element - Specifies the element for which vertical scrolling applies.
+ */
+ function VScroll(options, element) {
+ return _super.call(this, options, element) || this;
+ }
+ /**
+ * Initialize the event handler
+ *
+ * @private
+ * @returns {void}
+ */
+ VScroll.prototype.preRender = function () {
+ this.browser = _ej2_base__WEBPACK_IMPORTED_MODULE_0__["Browser"].info.name;
+ this.browserCheck = this.browser === 'mozilla';
+ this.isDevice = _ej2_base__WEBPACK_IMPORTED_MODULE_0__["Browser"].isDevice;
+ this.customStep = true;
+ var ele = this.element;
+ this.ieCheck = this.browser === 'edge' || this.browser === 'msie';
+ this.initialize();
+ if (ele.id === '') {
+ ele.id = Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["getUniqueID"])('vscroll');
+ this.uniqueId = true;
+ }
+ ele.style.display = 'block';
+ if (this.enableRtl) {
+ ele.classList.add(CLS_RTL);
+ }
+ };
+ /**
+ * To Initialize the vertical scroll rendering
+ *
+ * @private
+ * @returns {void}
+ */
+ VScroll.prototype.render = function () {
+ this.touchModule = new _ej2_base__WEBPACK_IMPORTED_MODULE_0__["Touch"](this.element, { scroll: this.touchHandler.bind(this), swipe: this.swipeHandler.bind(this) });
+ _ej2_base__WEBPACK_IMPORTED_MODULE_0__["EventHandler"].add(this.scrollEle, 'scroll', this.scrollEventHandler, this);
+ if (!this.isDevice) {
+ this.createNavIcon(this.element);
+ }
+ else {
+ this.element.classList.add(CLS_DEVICE);
+ this.createOverlayElement(this.element);
+ }
+ this.setScrollState();
+ _ej2_base__WEBPACK_IMPORTED_MODULE_0__["EventHandler"].add(this.element, 'wheel', this.wheelEventHandler, this);
+ };
+ VScroll.prototype.setScrollState = function () {
+ if (Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["isNullOrUndefined"])(this.scrollStep) || this.scrollStep < 0) {
+ this.scrollStep = this.scrollEle.offsetHeight;
+ this.customStep = false;
+ }
+ else {
+ this.customStep = true;
+ }
+ };
+ VScroll.prototype.initialize = function () {
+ var scrollCnt = Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["createElement"])('div', { className: CLS_VSCROLLCON });
+ var scrollBar = Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["createElement"])('div', { className: CLS_VSCROLLBAR });
+ scrollBar.setAttribute('tabindex', '-1');
+ var ele = this.element;
+ var innerEle = [].slice.call(ele.children);
+ for (var _i = 0, innerEle_1 = innerEle; _i < innerEle_1.length; _i++) {
+ var ele_1 = innerEle_1[_i];
+ scrollCnt.appendChild(ele_1);
+ }
+ scrollBar.appendChild(scrollCnt);
+ ele.appendChild(scrollBar);
+ scrollBar.style.overflow = 'hidden';
+ this.scrollEle = scrollBar;
+ this.scrollItems = scrollCnt;
+ };
+ VScroll.prototype.getPersistData = function () {
+ var keyEntity = ['scrollStep'];
+ return this.addOnPersist(keyEntity);
+ };
+ /**
+ * Returns the current module name.
+ *
+ * @returns {string} - It returns the current module name.
+ * @private
+ */
+ VScroll.prototype.getModuleName = function () {
+ return 'vScroll';
+ };
+ /**
+ * Removes the control from the DOM and also removes all its related events.
+ *
+ * @returns {void}
+ */
+ VScroll.prototype.destroy = function () {
+ var el = this.element;
+ el.style.display = '';
+ Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["removeClass"])([this.element], [CLS_ROOT, CLS_DEVICE, CLS_RTL]);
+ var navs = Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["selectAll"])('.e-' + el.id + '_nav.' + CLS_VSCROLLNAV, el);
+ var overlays = Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["selectAll"])('.' + CLS_OVERLAY, el);
+ [].slice.call(overlays).forEach(function (ele) {
+ Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["detach"])(ele);
+ });
+ for (var _i = 0, _a = [].slice.call(this.scrollItems.children); _i < _a.length; _i++) {
+ var elem = _a[_i];
+ el.appendChild(elem);
+ }
+ if (this.uniqueId) {
+ this.element.removeAttribute('id');
+ }
+ Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["detach"])(this.scrollEle);
+ if (navs.length > 0) {
+ Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["detach"])(navs[0]);
+ if (!Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["isNullOrUndefined"])(navs[1])) {
+ Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["detach"])(navs[1]);
+ }
+ }
+ _ej2_base__WEBPACK_IMPORTED_MODULE_0__["EventHandler"].remove(this.scrollEle, 'scroll', this.scrollEventHandler);
+ this.touchModule.destroy();
+ this.touchModule = null;
+ _super.prototype.destroy.call(this);
+ };
+ /**
+ * Specifies the value to disable/enable the VScroll component.
+ * When set to `true` , the component will be disabled.
+ *
+ * @param {boolean} value - Based on this Boolean value, VScroll will be enabled (false) or disabled (true).
+ * @returns {void}.
+ */
+ VScroll.prototype.disable = function (value) {
+ var navEle = Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["selectAll"])('.e-scroll-nav:not(.' + CLS_DISABLE + ')', this.element);
+ if (value) {
+ this.element.classList.add(CLS_DISABLE);
+ }
+ else {
+ this.element.classList.remove(CLS_DISABLE);
+ }
+ [].slice.call(navEle).forEach(function (el) {
+ el.setAttribute('tabindex', !value ? '0' : '-1');
+ });
+ };
+ VScroll.prototype.createOverlayElement = function (element) {
+ var id = element.id.concat('_nav');
+ var downOverlayEle = Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["createElement"])('div', { className: CLS_OVERLAY + ' ' + CLS_DOWNOVERLAY });
+ var clsDown = 'e-' + element.id.concat('_nav ' + CLS_VSCROLLNAV + ' ' + CLS_VSCROLLNAVDOWN);
+ var downEle = Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["createElement"])('div', { id: id.concat('down'), className: clsDown });
+ var navItem = Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["createElement"])('div', { className: CLS_NAVDOWNARROW + ' ' + CLS_NAVARROW + ' e-icons' });
+ downEle.appendChild(navItem);
+ var upEle = Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["createElement"])('div', { className: CLS_OVERLAY + ' ' + CLS_UPOVERLAY });
+ if (this.ieCheck) {
+ downEle.classList.add('e-ie-align');
+ }
+ element.appendChild(downOverlayEle);
+ element.appendChild(downEle);
+ element.insertBefore(upEle, element.firstChild);
+ this.eventBinding([downEle]);
+ };
+ VScroll.prototype.createNavIcon = function (element) {
+ var id = element.id.concat('_nav');
+ var clsDown = 'e-' + element.id.concat('_nav ' + CLS_VSCROLLNAV + ' ' + CLS_VSCROLLNAVDOWN);
+ var nav = Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["createElement"])('div', { id: id.concat('_down'), className: clsDown });
+ nav.setAttribute('aria-disabled', 'false');
+ var navItem = Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["createElement"])('div', { className: CLS_NAVDOWNARROW + ' ' + CLS_NAVARROW + ' e-icons' });
+ var clsUp = 'e-' + element.id.concat('_nav ' + CLS_VSCROLLNAV + ' ' + CLS_VSCROLLNAVUP);
+ var navElement = Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["createElement"])('div', { id: id.concat('_up'), className: clsUp + ' ' + CLS_DISABLE });
+ navElement.setAttribute('aria-disabled', 'true');
+ var navUpItem = Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["createElement"])('div', { className: CLS_NAVUPARROW + ' ' + CLS_NAVARROW + ' e-icons' });
+ navElement.appendChild(navUpItem);
+ nav.appendChild(navItem);
+ nav.setAttribute('tabindex', '0');
+ element.appendChild(nav);
+ element.insertBefore(navElement, element.firstChild);
+ if (this.ieCheck) {
+ nav.classList.add('e-ie-align');
+ navElement.classList.add('e-ie-align');
+ }
+ this.eventBinding([nav, navElement]);
+ };
+ VScroll.prototype.onKeyPress = function (ev) {
+ var _this = this;
+ if (ev.key === 'Enter') {
+ var timeoutFun_1 = function () {
+ _this.keyTimeout = true;
+ _this.eleScrolling(10, ev.target, true);
+ };
+ this.keyTimer = window.setTimeout(function () {
+ timeoutFun_1();
+ }, 100);
+ }
+ };
+ VScroll.prototype.onKeyUp = function (ev) {
+ if (ev.key !== 'Enter') {
+ return;
+ }
+ if (this.keyTimeout) {
+ this.keyTimeout = false;
+ }
+ else {
+ ev.target.click();
+ }
+ clearTimeout(this.keyTimer);
+ };
+ VScroll.prototype.eventBinding = function (element) {
+ var _this = this;
+ [].slice.call(element).forEach(function (ele) {
+ new _ej2_base__WEBPACK_IMPORTED_MODULE_0__["Touch"](ele, { tapHold: _this.tabHoldHandler.bind(_this), tapHoldThreshold: 500 });
+ ele.addEventListener('keydown', _this.onKeyPress.bind(_this));
+ ele.addEventListener('keyup', _this.onKeyUp.bind(_this));
+ ele.addEventListener('mouseup', _this.repeatScroll.bind(_this));
+ ele.addEventListener('touchend', _this.repeatScroll.bind(_this));
+ ele.addEventListener('contextmenu', function (e) {
+ e.preventDefault();
+ });
+ _ej2_base__WEBPACK_IMPORTED_MODULE_0__["EventHandler"].add(ele, 'click', _this.clickEventHandler, _this);
+ });
+ };
+ VScroll.prototype.repeatScroll = function () {
+ clearInterval(this.timeout);
+ };
+ VScroll.prototype.tabHoldHandler = function (ev) {
+ var _this = this;
+ var trgt = ev.originalEvent.target;
+ trgt = this.contains(trgt, CLS_VSCROLLNAV) ? trgt.firstElementChild : trgt;
+ var scrollDistance = 10;
+ var timeoutFun = function () {
+ _this.eleScrolling(scrollDistance, trgt, true);
+ };
+ this.timeout = window.setInterval(function () {
+ timeoutFun();
+ }, 50);
+ };
+ VScroll.prototype.contains = function (element, className) {
+ return element.classList.contains(className);
+ };
+ VScroll.prototype.eleScrolling = function (scrollDis, trgt, isContinuous) {
+ var classList = trgt.classList;
+ if (classList.contains(CLS_VSCROLLNAV)) {
+ classList = trgt.querySelector('.' + CLS_NAVARROW).classList;
+ }
+ if (classList.contains(CLS_NAVDOWNARROW)) {
+ this.frameScrollRequest(scrollDis, 'add', isContinuous);
+ }
+ else if (classList.contains(CLS_NAVUPARROW)) {
+ this.frameScrollRequest(scrollDis, '', isContinuous);
+ }
+ };
+ VScroll.prototype.clickEventHandler = function (event) {
+ this.eleScrolling(this.scrollStep, event.target, false);
+ };
+ VScroll.prototype.wheelEventHandler = function (e) {
+ e.preventDefault();
+ this.frameScrollRequest(this.scrollStep, (e.deltaY > 0 ? 'add' : ''), false);
+ };
+ VScroll.prototype.swipeHandler = function (e) {
+ var swipeElement = this.scrollEle;
+ var distance;
+ if (e.velocity <= 1) {
+ distance = e.distanceY / (e.velocity * 10);
+ }
+ else {
+ distance = e.distanceY / e.velocity;
+ }
+ var start = 0.5;
+ var animate = function () {
+ var step = Math.sin(start);
+ if (step <= 0) {
+ window.cancelAnimationFrame(step);
+ }
+ else {
+ if (e.swipeDirection === 'Up') {
+ swipeElement.scrollTop += distance * step;
+ }
+ else if (e.swipeDirection === 'Down') {
+ swipeElement.scrollTop -= distance * step;
+ }
+ start -= 0.02;
+ window.requestAnimationFrame(animate);
+ }
+ };
+ animate();
+ };
+ VScroll.prototype.scrollUpdating = function (scrollVal, action) {
+ if (action === 'add') {
+ this.scrollEle.scrollTop += scrollVal;
+ }
+ else {
+ this.scrollEle.scrollTop -= scrollVal;
+ }
+ };
+ VScroll.prototype.frameScrollRequest = function (scrollValue, action, isContinuous) {
+ var _this = this;
+ var step = 10;
+ if (isContinuous) {
+ this.scrollUpdating(scrollValue, action);
+ return;
+ }
+ if (!this.customStep) {
+ [].slice.call(Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["selectAll"])('.' + CLS_OVERLAY, this.element)).forEach(function (el) {
+ scrollValue -= el.offsetHeight;
+ });
+ }
+ var animate = function () {
+ if (scrollValue < step) {
+ window.cancelAnimationFrame(step);
+ }
+ else {
+ _this.scrollUpdating(step, action);
+ scrollValue -= step;
+ window.requestAnimationFrame(animate);
+ }
+ };
+ animate();
+ };
+ VScroll.prototype.touchHandler = function (e) {
+ var el = this.scrollEle;
+ var distance = e.distanceY;
+ if (e.scrollDirection === 'Up') {
+ el.scrollTop = el.scrollTop + distance;
+ }
+ else if (e.scrollDirection === 'Down') {
+ el.scrollTop = el.scrollTop - distance;
+ }
+ };
+ VScroll.prototype.arrowDisabling = function (addDisableCls, removeDisableCls) {
+ if (this.isDevice) {
+ var arrowEle = Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["isNullOrUndefined"])(addDisableCls) ? removeDisableCls : addDisableCls;
+ var arrowIcon = arrowEle.querySelector('.' + CLS_NAVARROW);
+ if (Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["isNullOrUndefined"])(addDisableCls)) {
+ Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["classList"])(arrowIcon, [CLS_NAVDOWNARROW], [CLS_NAVUPARROW]);
+ }
+ else {
+ Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["classList"])(arrowIcon, [CLS_NAVUPARROW], [CLS_NAVDOWNARROW]);
+ }
+ }
+ else {
+ addDisableCls.classList.add(CLS_DISABLE);
+ addDisableCls.setAttribute('aria-disabled', 'true');
+ addDisableCls.removeAttribute('tabindex');
+ removeDisableCls.classList.remove(CLS_DISABLE);
+ removeDisableCls.setAttribute('aria-disabled', 'false');
+ removeDisableCls.setAttribute('tabindex', '0');
+ }
+ this.repeatScroll();
+ };
+ VScroll.prototype.scrollEventHandler = function (e) {
+ var target = e.target;
+ var height = target.offsetHeight;
+ var navUpEle = this.element.querySelector('.' + CLS_VSCROLLNAVUP);
+ var navDownEle = this.element.querySelector('.' + CLS_VSCROLLNAVDOWN);
+ var upOverlay = this.element.querySelector('.' + CLS_UPOVERLAY);
+ var downOverlay = this.element.querySelector('.' + CLS_DOWNOVERLAY);
+ var scrollTop = target.scrollTop;
+ if (scrollTop <= 0) {
+ scrollTop = -scrollTop;
+ }
+ if (this.isDevice) {
+ if (scrollTop < OVERLAY_MAXWID) {
+ upOverlay.style.height = scrollTop + 'px';
+ }
+ else {
+ upOverlay.style.height = '40px';
+ }
+ if ((target.scrollHeight - Math.ceil(height + scrollTop)) < OVERLAY_MAXWID) {
+ downOverlay.style.height = (target.scrollHeight - Math.ceil(height + scrollTop)) + 'px';
+ }
+ else {
+ downOverlay.style.height = '40px';
+ }
+ }
+ if (scrollTop === 0) {
+ this.arrowDisabling(navUpEle, navDownEle);
+ }
+ else if (Math.ceil(height + scrollTop + .1) >= target.scrollHeight) {
+ this.arrowDisabling(navDownEle, navUpEle);
+ }
+ else {
+ var disEle = this.element.querySelector('.' + CLS_VSCROLLNAV + '.' + CLS_DISABLE);
+ if (disEle) {
+ disEle.classList.remove(CLS_DISABLE);
+ disEle.setAttribute('aria-disabled', 'false');
+ disEle.setAttribute('tabindex', '0');
+ }
+ }
+ };
+ /**
+ * Gets called when the model property changes.The data that describes the old and new values of property that changed.
+ *
+ * @param {VScrollModel} newProp - It contains the new value of data.
+ * @param {VScrollModel} oldProp - It contains the old value of data.
+ * @returns {void}
+ * @private
+ */
+ VScroll.prototype.onPropertyChanged = function (newProp, oldProp) {
+ for (var _i = 0, _a = Object.keys(newProp); _i < _a.length; _i++) {
+ var prop = _a[_i];
+ switch (prop) {
+ case 'scrollStep':
+ this.setScrollState();
+ break;
+ case 'enableRtl':
+ if (newProp.enableRtl) {
+ this.element.classList.add(CLS_RTL);
+ }
+ else {
+ this.element.classList.remove(CLS_RTL);
+ }
+ break;
+ }
+ }
+ };
+ __decorate([
+ Object(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["Property"])(null)
+ ], VScroll.prototype, "scrollStep", void 0);
+ VScroll = __decorate([
+ _ej2_base__WEBPACK_IMPORTED_MODULE_0__["NotifyPropertyChanges"]
+ ], VScroll);
+ return VScroll;
+}(_ej2_base__WEBPACK_IMPORTED_MODULE_0__["Component"]));
+
+
+
+/***/ }),
+
+/***/ "./ej2-resources/22.1.37/scripts/ej2-navigations/context-menu/context-menu.js":
+/*!************************************************************************************!*\
+ !*** ./ej2-resources/22.1.37/scripts/ej2-navigations/context-menu/context-menu.js ***!
+ \************************************************************************************/
+/*! exports provided: ContextMenu */
+/***/ (function(module, __webpack_exports__, __webpack_require__) {
+
+"use strict";
+__webpack_require__.r(__webpack_exports__);
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ContextMenu", function() { return ContextMenu; });
+/* harmony import */ var _ej2_base__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../ej2-base */ "./ej2-resources/22.1.37/scripts/ej2-base/index.js");
+/* harmony import */ var _ej2_popups__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../ej2-popups */ "./ej2-resources/22.1.37/scripts/ej2-popups/index.js");
+/* harmony import */ var _common_menu_base__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../common/menu-base */ "./ej2-resources/22.1.37/scripts/ej2-navigations/common/menu-base.js");
+var __extends = (undefined && undefined.__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 = (undefined && undefined.__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;
+};
+/* eslint-disable @typescript-eslint/triple-slash-reference */
+///