| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 | 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 60× 60× 68× 68× 33× 60× 1× 1× 12× 12× 12× 12× 12× 12× 78× 10× 10× 10× 10× 6× 4× 10× 1× 12× 12× 12× 11× 11× 1× 1× 8× 8× 8× 8× 8× 8× 8× 8× 8× 4× 8× 8× 1× 1× 12× 12× 8× 4× 4× 12× 12× 12× 4× 4× 4× 12× 1× 20× 20× 14× 2× 12× 8× 4× 20× 20× 9× 9× 1× 8× 19× 1× 36× 36× 36× 2× 34× 34× 34× 34× 34× 34× 34× 34× 34× 34× 77× 77× 1× 1× 1× 1× 350× 1× 1× 1× 1× 1× 1× 1× 1× | /* istanbul ignore next */ var __extends = (this && this.__extends) || (function () { var extendStatics = function (d, b) { extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return extendStatics(d, b); }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); /* istanbul ignore next */ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; }; define(["require", "exports", "@syncfusion/ej2-base"], function (require, exports, ej2_base_1) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); function getModel(props, model) { var obj = ej2_base_1.extend({}, props); for (var _i = 0, _a = Object.keys(obj); _i < _a.length; _i++) { var prop = _a[_i]; if ((model).indexOf(prop) < 0) { ej2_base_1.deleteObject(obj, prop); } } return obj; } exports.getModel = getModel; function upDownKeyHandler(ul, keyCode) { var defaultIdx = keyCode === 40 ? 0 : ul.childElementCount - 1; var liIdx = defaultIdx; var li; var selectedLi = ul.querySelector('.e-selected'); Iif (selectedLi) { selectedLi.classList.remove('e-selected'); } for (var i = 0, len = ul.children.length; i < len; i++) { if (ul.children[i].classList.contains('e-focused')) { li = ul.children[i]; liIdx = i; li.classList.remove('e-focused'); if (keyCode === 40) { liIdx++; } else { liIdx--; } if (liIdx === (keyCode === 40 ? ul.childElementCount : -1)) { liIdx = defaultIdx; } } } li = ul.children[liIdx]; liIdx = isValidLI(ul, li, liIdx, keyCode); if (liIdx !== -1) { ej2_base_1.addClass([ul.children[liIdx]], 'e-focused'); ul.children[liIdx].focus(); } } exports.upDownKeyHandler = upDownKeyHandler; function homeEndKeyHandler(ul, keyCode) { Iif (!ul || !ul.children || !ul.children.length) { return; } var selectedLi = ul.querySelector('.e-selected'); Iif (selectedLi) { selectedLi.classList.remove('e-selected'); } var liIdx = keyCode === 36 ? 0 : ul.childElementCount - 1; var li = ul.children[liIdx]; liIdx = getValidHomeEndLI(ul, li, liIdx, keyCode); Eif (liIdx !== -1) { var focusedLi = ul.querySelector('.e-focused'); if (focusedLi) { focusedLi.classList.remove('e-focused'); } ej2_base_1.addClass([ul.children[liIdx]], 'e-focused'); ul.children[liIdx].focus(); } } exports.homeEndKeyHandler = homeEndKeyHandler; function getValidHomeEndLI(ul, li, index, keyCode, count) { if (count === void 0) { count = 0; } if (li.classList.contains('e-separator') || li.classList.contains('e-disabled')) { if (keyCode === 36) { index++; } else { index--; } } Iif (index < 0 || index > ul.childElementCount - 1) { return -1; } li = ul.children[index]; if (li.classList.contains('e-separator') || li.classList.contains('e-disabled')) { count++; Iif (count === ul.childElementCount) { return -1; } index = getValidHomeEndLI(ul, li, index, keyCode, count); } return index; } function isValidLI(ul, li, index, keyCode, count) { if (count === void 0) { count = 0; } if (li.classList.contains('e-separator') || li.classList.contains('e-disabled')) { if (index === (keyCode === 40 ? ul.childElementCount - 1 : 0)) { index = keyCode === 40 ? 0 : ul.childElementCount - 1; } else { if (keyCode === 40) { index++; } else { index--; } } } li = ul.children[index]; if (li.classList.contains('e-separator') || li.classList.contains('e-disabled')) { count++; if (count === ul.childElementCount) { return index = -1; } index = isValidLI(ul, li, index, keyCode, count); } return index; } function setBlankIconStyle(popup, blankIcon) { var blankIconList = [].slice.call(popup.getElementsByClassName('e-blank-icon')); Iif (blankIcon) { var menuItem = [].slice.call(popup.getElementsByClassName('e-item')); menuItem.forEach(function (li) { if (li.style.paddingLeft || li.style.paddingRight) { li.removeAttribute('style'); } }); } if (!blankIconList.length) { return; } var iconLi = popup.querySelector('.e-item:not(.e-blank-icon):not(.e-separator)'); Iif (ej2_base_1.isNullOrUndefined(iconLi)) { return; } Iif (iconLi.classList.contains('e-url')) { iconLi = iconLi.querySelector('.e-menu-url'); } var icon = iconLi.querySelector('.e-menu-icon'); var cssProp; var enableRtl = popup.classList.contains('e-rtl'); Iif (enableRtl) { cssProp = { padding: 'paddingRight', margin: 'marginLeft' }; } else { cssProp = { padding: 'paddingLeft', margin: 'marginRight' }; } var size = parseInt(getComputedStyle(icon).fontSize, 10) + parseInt((enableRtl ? getComputedStyle(icon)[cssProp.margin] : getComputedStyle(icon)[cssProp.margin]), 10) + parseInt(getComputedStyle(iconLi).paddingLeft, 10) + "px"; blankIconList.forEach(function (li) { Iif (li.classList.contains('e-url') && li.querySelector('.e-menu-url')) { li.querySelector('.e-menu-url').style[cssProp.padding] = size; } else { li.style[cssProp.padding] = size; } }); } exports.setBlankIconStyle = setBlankIconStyle; var Item = (function (_super) { __extends(Item, _super); function Item() { return _super !== null && _super.apply(this, arguments) || this; } __decorate([ ej2_base_1.Property('') ], Item.prototype, "iconCss", void 0); __decorate([ ej2_base_1.Property('') ], Item.prototype, "id", void 0); __decorate([ ej2_base_1.Property(false) ], Item.prototype, "separator", void 0); __decorate([ ej2_base_1.Property('') ], Item.prototype, "text", void 0); __decorate([ ej2_base_1.Property('') ], Item.prototype, "url", void 0); __decorate([ ej2_base_1.Property(false) ], Item.prototype, "disabled", void 0); return Item; }(ej2_base_1.ChildProperty)); exports.Item = Item; }); |