How to use shiftHome method in Testcafe

Best JavaScript code snippet using testcafe

sf-filemanager-90f6dc.min.js

Source:sf-filemanager-90f6dc.min.js Github

copy

Full Screen

1/******/ (function(modules) { // webpackBootstrap2/******/ // The module cache3/******/ var installedModules = {};4/******/5/******/ // The require function6/******/ function __webpack_require__(moduleId) {7/******/8/******/ // Check if module is in cache9/******/ if(installedModules[moduleId]) {10/******/ return installedModules[moduleId].exports;11/******/ }12/******/ // Create a new module (and put it into the cache)13/******/ var module = installedModules[moduleId] = {14/******/ i: moduleId,15/******/ l: false,16/******/ exports: {}17/******/ };18/******/19/******/ // Execute the module function20/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);21/******/22/******/ // Flag the module as loaded23/******/ module.l = true;24/******/25/******/ // Return the exports of the module26/******/ return module.exports;27/******/ }28/******/29/******/30/******/ // expose the modules object (__webpack_modules__)31/******/ __webpack_require__.m = modules;32/******/33/******/ // expose the module cache34/******/ __webpack_require__.c = installedModules;35/******/36/******/ // define getter function for harmony exports37/******/ __webpack_require__.d = function(exports, name, getter) {38/******/ if(!__webpack_require__.o(exports, name)) {39/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });40/******/ }41/******/ };42/******/43/******/ // define __esModule on exports44/******/ __webpack_require__.r = function(exports) {45/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {46/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });47/******/ }48/******/ Object.defineProperty(exports, '__esModule', { value: true });49/******/ };50/******/51/******/ // create a fake namespace object52/******/ // mode & 1: value is a module id, require it53/******/ // mode & 2: merge all properties of value into the ns54/******/ // mode & 4: return value when already ns object55/******/ // mode & 8|1: behave like require56/******/ __webpack_require__.t = function(value, mode) {57/******/ if(mode & 1) value = __webpack_require__(value);58/******/ if(mode & 8) return value;59/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;60/******/ var ns = Object.create(null);61/******/ __webpack_require__.r(ns);62/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });63/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));64/******/ return ns;65/******/ };66/******/67/******/ // getDefaultExport function for compatibility with non-harmony modules68/******/ __webpack_require__.n = function(module) {69/******/ var getter = module && module.__esModule ?70/******/ function getDefault() { return module['default']; } :71/******/ function getModuleExports() { return module; };72/******/ __webpack_require__.d(getter, 'a', getter);73/******/ return getter;74/******/ };75/******/76/******/ // Object.prototype.hasOwnProperty.call77/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };78/******/79/******/ // __webpack_public_path__80/******/ __webpack_require__.p = "_content/Syncfusion.Blazor/scripts/";81/******/82/******/83/******/ // Load entry module and return exports84/******/ return __webpack_require__(__webpack_require__.s = "./bundles/sf-filemanager.js");85/******/ })86/************************************************************************/87/******/ ({88/***/ "./bundles/sf-filemanager.js":89/*!***********************************!*\90 !*** ./bundles/sf-filemanager.js ***!91 \***********************************/92/*! no exports provided */93/*! all exports used */94/***/ (function(module, __webpack_exports__, __webpack_require__) {95"use strict";96__webpack_require__.r(__webpack_exports__);97/* harmony import */ var _modules_sf_filemanager_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../modules/sf-filemanager.js */ "./modules/sf-filemanager.js");98/* harmony import */ var _modules_sf_filemanager_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_modules_sf_filemanager_js__WEBPACK_IMPORTED_MODULE_0__);99/***/ }),100/***/ "./modules/sf-filemanager.js":101/*!***********************************!*\102 !*** ./modules/sf-filemanager.js ***!103 \***********************************/104/*! no static exports found */105/***/ (function(module, exports) {106window.sfBlazor = window.sfBlazor || {};107window.sfBlazor.FileManager = function () {108 'use strict';109 var TOOLBAR_ID = '_toolbar';110 var ROW = 'e-row';111 var BLUR = 'e-blur';112 var HOVER = 'e-hover';113 var ACTIVE = 'e-active';114 var CLONE = 'e-fe-clone';115 var FULLROW = 'e-fullrow';116 var FOLDER = 'e-fe-folder';117 var LARGE_ICON = 'e-large-icon';118 var DROP_FILE = 'e-fe-drop-file';119 var LARGE_ICONS = 'e-large-icons';120 var DROP_FOLDER = 'e-fe-drop-folder';121 var TD_ELEMENT = 'TD';122 var FOCUSED = 'e-focused';123 var FOCUS = 'e-focus';124 var SfFileManager =125 /** @class */126 function () {127 function SfFileManager(element, ref, properties) {128 this.element = element;129 this.properties = properties;130 this.treeviewEle = element.querySelector('.e-navigation .e-treeview');131 this.dotnetRef = ref;132 if (!sf.base.isNullOrUndefined(this.element)) {133 this.ctrlId = this.element.id; // eslint-disable-next-line134 this.element.blazor__instance = this;135 }136 this.bindKeyboardEvent();137 this.bindTreeViewKeyBoardEvent();138 this.wireEvents();139 }140 SfFileManager.prototype.unWireMobileEvents = function () {141 this.clickObj.destroy();142 };143 SfFileManager.prototype.wireMobileEvents = function () {144 var fileElement; // eslint-disable-next-line145 var proxy = this;146 if (this.properties.view === 'Details') {147 fileElement = this.element.querySelector('.e-view-container .e-grid .e-gridcontent');148 } else {149 fileElement = this.element.querySelector('.e-view-container .e-large-icons');150 }151 this.clickObj = new sf.base.Touch(fileElement, {152 tapHold: function tapHold(e) {153 var targetElement;154 var rowId;155 if (proxy.properties.view === 'Details') {156 targetElement = sf.base.closest(e.originalEvent.target, '.e-row');157 rowId = targetElement ? targetElement.getAttribute('aria-rowindex') : null;158 } else {159 targetElement = sf.base.closest(e.originalEvent.target, 'li.e-list-item');160 rowId = targetElement ? targetElement.getAttribute('data-uid') : null;161 }162 if (targetElement != null && rowId != null) {163 proxy.dotnetRef.invokeMethodAsync('ChangeMobileMultiSelection', rowId);164 }165 }166 });167 };168 SfFileManager.prototype.wireEvents = function () {169 var gridElem = this.element.querySelector('#' + this.properties.id + '_grid');170 if (gridElem) {171 sf.base.EventHandler.add(gridElem, 'dblclick', this.gridBlur, this);172 }173 };174 SfFileManager.prototype.unWireEvents = function () {175 var gridElem = this.element.querySelector('#' + this.properties.id + '_grid');176 if (gridElem) {177 sf.base.EventHandler.remove(gridElem, 'dblclick', this.gridBlur);178 }179 };180 SfFileManager.prototype.adjustHeight = function () {181 var toolbar = sf.base.select('#' + this.element.id + TOOLBAR_ID, this.element);182 var toolBarHeight = toolbar ? toolbar.offsetHeight : 0;183 var breadcrumbBarHeight = this.element.querySelector('.e-address').offsetHeight;184 var gridHeight = this.element.clientHeight - toolBarHeight - breadcrumbBarHeight;185 return sf.base.formatUnit(this.element.clientHeight - toolBarHeight) + ' ' + sf.base.formatUnit(gridHeight);186 };187 SfFileManager.prototype.createDragObj = function () {188 var _this = this;189 var dragEle;190 var dragTarget;191 if (this.properties.view === 'LargeIcons') {192 dragEle = this.element.querySelector('.e-large-icons ul');193 dragTarget = '.' + LARGE_ICON;194 } else {195 dragEle = this.element.querySelector('.e-grid.e-control');196 dragTarget = '.' + ROW;197 }198 if (this.properties.draggable) {199 if (this.dragObj) {200 this.dragObj.destroy();201 }202 if (dragEle) {203 this.dragObj = new sf.base.Draggable(dragEle, {204 cursorAt: {205 left: 44,206 top: 18207 },208 enableTailMode: true,209 dragArea: this.element,210 dragTarget: '.' + FULLROW,211 drag: this.draggingHandler.bind(this),212 dragStart: function dragStart(args) {213 _this.dragStartHandler(args);214 },215 dragStop: this.dragStopHandler.bind(this),216 enableAutoScroll: true,217 helper: this.dragHelper.bind(this)218 });219 }220 } else if (!this.properties.draggable) {221 this.dragObj.destroy();222 }223 if (this.treeviewEle) {224 if (this.treeDragObj) {225 this.treeDragObj.destroy();226 }227 this.treeDragObj = new sf.base.Draggable(this.treeviewEle, {228 cursorAt: {229 left: 44,230 top: 18231 },232 enableTailMode: true,233 dragArea: this.element,234 dragTarget: dragTarget,235 drag: this.draggingHandler.bind(this),236 dragStart: function dragStart(args) {237 _this.dragStartHandler(args);238 },239 dragStop: this.dragStopHandler.bind(this),240 enableAutoScroll: true,241 helper: this.dragHelper.bind(this)242 });243 } else if (!this.properties.draggable) {244 this.treeDragObj.destroy();245 }246 };247 SfFileManager.prototype.dragHelper = function (args) {248 var dragTarget = args.sender.target;249 this.getModule(dragTarget);250 if (this.activeModule === 'largeiconsview' || this.activeModule === 'navigationpane') {251 this.dragLi = sf.base.closest(dragTarget, '.e-list-item');252 } else if (this.activeModule === 'detailsview') {253 this.dragLi = sf.base.closest(dragTarget, 'tr.e-row');254 if (this.dragLi.getAttribute('aria-selected') == 'false') {255 dragTarget.click();256 }257 }258 if (!this.dragLi) {259 return null;260 }261 this.createVirtualDragElement();262 return this.virtualDragElement;263 };264 SfFileManager.prototype.createVirtualDragElement = function () {265 this.updateViewElement();266 this.updateDragValues();267 this.cloneIcon = sf.base.createElement('div', {268 className: 'e-fe-icon ' + this.dragType269 });270 this.cloneName = sf.base.createElement('div', {271 className: 'e-fe-name',272 innerHTML: this.dragName273 });274 var virtualEle = sf.base.createElement('div', {275 className: 'e-fe-content'276 });277 virtualEle.appendChild(this.cloneIcon);278 virtualEle.appendChild(this.cloneName);279 var ele = sf.base.createElement('div', {280 className: CLONE281 });282 ele.appendChild(virtualEle);283 if (this.dragCount > 1) {284 var badge = sf.base.createElement('span', {285 className: 'e-fe-count',286 innerHTML: this.dragCount.toString(10)287 });288 ele.appendChild(badge);289 }290 this.virtualDragElement = ele;291 this.element.appendChild(this.virtualDragElement);292 };293 SfFileManager.prototype.getModule = function (element) {294 if (element) {295 if (sf.base.closest(element, '.' + ROW)) {296 this.activeModule = 'detailsview';297 } else if (sf.base.closest(element, '.' + LARGE_ICON)) {298 this.activeModule = 'largeiconsview';299 } else {300 this.activeModule = 'navigationpane';301 }302 }303 };304 SfFileManager.prototype.getXYValue = function (e, direction) {305 var touchList = e.changedTouches;306 var value;307 if (direction === 'X') {308 value = touchList ? touchList[0].clientX : e.clientX;309 } else {310 value = touchList ? touchList[0].clientY : e.clientY;311 }312 if (!value && e.type === 'focus' && e.target) {313 var rect = e.target.getBoundingClientRect();314 value = rect ? direction === 'X' ? rect.left : rect.top : null;315 }316 return Math.ceil(value);317 };318 SfFileManager.prototype.removeDestroyElement = function () {319 this.dragObj.intDestroy(this.dragStartArgs.event);320 this.dragCancel();321 };322 SfFileManager.prototype.TriggerDragEvent = function (cancel) {323 if (cancel) {324 this.removeDestroyElement();325 }326 };327 SfFileManager.prototype.UpdateGridFocus = function (index) {328 if (this.properties.view == "Details") {329 this.updateViewElement();330 var focusedItem = this.viewElem.querySelectorAll(".e-focused");331 var itemElement = this.viewElem.querySelector('[aria-rowindex="' + index.toString() + '"]');332 if (focusedItem) {333 for (var i = 0; i < focusedItem.length; i++) {334 if (sf.base.closest(focusedItem[i], 'tr').getAttribute('aria-rowindex') != index.toString()) {335 sf.base.closest(focusedItem[i], 'tr').removeAttribute('tabindex');336 sf.base.removeClass([focusedItem[i]], [FOCUS, FOCUSED]);337 }338 }339 }340 if (!sf.base.isNullOrUndefined(itemElement)) {341 this.viewElem.setAttribute('tabindex', '-1');342 itemElement.setAttribute('tabindex', '0');343 sf.base.addClass([itemElement], [FOCUS, FOCUSED]);344 }345 }346 };347 SfFileManager.prototype.TriggerDragStartEvent = function (cancel) {348 if (cancel) {349 this.removeDestroyElement();350 } else {351 this.dragStartArgs.bindEvents(this.dragStartArgs.dragElement);352 var dragArgs = this.dragStartArgs;353 dragArgs.cancel = false;354 this.getModule(this.dragStartArgs.target);355 var rootId = this.element.querySelector('.e-navigation .e-treeview ul li').getAttribute('data-uid');356 if (!this.properties.draggable || this.activeModule === 'navigationpane' && sf.base.closest(this.dragStartArgs.target, 'li').getAttribute('data-uid') === rootId) {357 dragArgs.cancel = true;358 }359 this.removeBlur();360 if (dragArgs.cancel) {361 this.removeDestroyElement();362 } else if (!dragArgs.cancel) {363 this.updateViewElement();364 this.blurActive();365 this.updateDragValues();366 }367 }368 };369 SfFileManager.prototype.dragStartHandler = function (args) {370 this.dragStartArgs = args;371 this.UpdateXY(args);372 this.dotnetRef.invokeMethodAsync('DragStartCall', this.dragLeft, this.dragTop);373 };374 SfFileManager.prototype.blurActive = function () {375 var i = 0;376 var activeElements = this.viewElem.querySelectorAll('.' + ACTIVE);377 while (i < activeElements.length) {378 activeElements[i].classList.add(BLUR);379 i++;380 }381 };382 SfFileManager.prototype.updateViewElement = function () {383 if (this.properties.view === 'LargeIcons') {384 this.viewElem = this.element.querySelector('.' + LARGE_ICONS);385 } else {386 this.viewElem = this.element.querySelector('.e-gridcontent');387 }388 };389 SfFileManager.prototype.getIconClass = function (element) {390 var iconValue = '';391 iconValue = element.querySelector('.e-list-img') ? 'e-fe-image' : element.querySelector('.e-list-icon').classList[1];392 return iconValue;393 };394 SfFileManager.prototype.updateDragValues = function () {395 var activeElements;396 if (this.activeModule === 'largeiconsview') {397 activeElements = this.viewElem.querySelectorAll('.' + ACTIVE);398 this.dragName = activeElements.length > 0 ? activeElements[0].querySelector('.e-list-text').textContent : '';399 this.dragType = activeElements.length > 0 ? this.getIconClass(activeElements[0]) : '';400 } else if (this.activeModule === 'detailsview') {401 activeElements = this.viewElem.querySelectorAll('tr[aria-selected="true"]');402 if (activeElements != null && activeElements.length > 0) {403 this.dragName = activeElements.length > 0 ? activeElements[0].querySelector('.e-fe-text').textContent : '';404 this.dragType = activeElements.length > 0 ? activeElements[0].querySelector('.e-fe-icon').classList[1] : '';405 }406 } else if (this.activeModule === 'navigationpane') {407 this.dragName = this.dragLi.querySelector('.e-list-text').textContent;408 this.dragType = 'e-fe-folder';409 }410 if (activeElements != null) {411 this.dragCount = activeElements.length;412 }413 };414 SfFileManager.prototype.getTargetModule = function (element) {415 if (element) {416 if (sf.base.closest(element, '.e-gridcontent')) {417 this.targetModule = 'detailsview';418 } else if (sf.base.closest(element, '.' + LARGE_ICONS)) {419 this.targetModule = 'largeiconsview';420 } else if (element.classList.contains('e-fullrow') || element.classList.contains('e-icon-expandable')) {421 this.targetModule = 'navigationpane';422 } else if (sf.base.closest(element, '.e-address-list-item')) {423 this.targetModule = 'breadcrumbbar';424 } else {425 this.targetModule = '';426 }427 }428 };429 SfFileManager.prototype.draggingHandler = function (args) {430 var canDrop = false;431 this.updateDragValues();432 this.cloneIcon.setAttribute('class', 'e-fe-icon ' + this.dragType);433 this.cloneName.innerHTML = this.dragName;434 var node = null;435 this.blurActive();436 this.getTargetModule(args.target);437 this.removeDropTarget();438 this.removeBlur('hover');439 if (this.targetModule === 'navigationpane') {440 node = sf.base.closest(args.target, 'li');441 node.classList.add(HOVER, DROP_FOLDER);442 canDrop = true;443 } else if (this.targetModule === 'detailsview') {444 node = sf.base.closest(args.target, 'tr');445 if (node && node.querySelector('.' + FOLDER) && !node.classList.contains(BLUR)) {446 node.classList.add(DROP_FOLDER);447 } else if (node && !node.querySelector('.' + FOLDER) && !node.classList.contains(BLUR)) {448 node.classList.add(DROP_FILE);449 }450 canDrop = true;451 } else if (this.targetModule === 'largeiconsview') {452 node = sf.base.closest(args.target, 'li');453 if (node && node.querySelector('.' + FOLDER) && !node.classList.contains(BLUR)) {454 node.classList.add(HOVER, DROP_FOLDER);455 }456 canDrop = true;457 } else if (this.targetModule === 'breadcrumbbar') {458 canDrop = true;459 }460 this.element.classList.remove('e-fe-drop', 'e-no-drop');461 this.element.classList.add(canDrop ? 'e-fe-drop' : 'e-no-drop');462 this.UpdateXY(args);463 this.dotnetRef.invokeMethodAsync('DraggingCall', this.dragLeft, this.dragTop);464 };465 SfFileManager.prototype.UpdateXY = function (args) {466 this.dragLeft = this.getXYValue(args.event, 'X');467 this.dragTop = this.getXYValue(args.event, 'Y');468 };469 SfFileManager.prototype.dragStopHandler = function (args) {470 var dragArgs = args;471 var isLayout = false;472 dragArgs.cancel = false;473 this.removeDropTarget();474 this.element.classList.remove('e-fe-drop', 'e-no-drop');475 this.dragCancel();476 this.getTargetModule(args.target);477 if (this.targetModule === '' && args.target.classList.contains('e-view-container')) {478 isLayout = true;479 }480 this.removeBlur('hover');481 var targetElement;482 var dataValue;483 if (this.targetModule === 'largeiconsview' || this.targetModule === 'navigationpane' || this.targetModule === 'breadcrumbbar') {484 targetElement = sf.base.closest(args.target, 'li');485 var attr = this.targetModule === 'breadcrumbbar' ? 'data-utext' : 'data-uid';486 dataValue = targetElement ? targetElement.getAttribute(attr) : null;487 } else if (this.targetModule === 'detailsview') {488 targetElement = sf.base.closest(args.target, 'tr');489 dataValue = targetElement ? targetElement.getAttribute('aria-rowindex') : null;490 }491 if (dataValue == null) {492 isLayout = true;493 }494 var treeid = this.treeviewEle ? this.dragLi.getAttribute('data-uid') : null;495 if (this.activeModule === 'detailsview') {496 treeid = this.dragLi.getAttribute('aria-rowindex');497 }498 this.UpdateXY(args); // eslint:disable-next-line499 this.dotnetRef.invokeMethodAsync('DragStopCall', treeid, dataValue, this.targetModule, this.activeModule, isLayout, this.dragLeft, this.dragTop);500 this.dragCount = 0;501 this.dragName = '';502 this.dragType = '';503 };504 SfFileManager.prototype.dragCancel = function () {505 this.removeBlur();506 var virtualEle = sf.base.select('.' + CLONE, this.element);507 if (virtualEle) {508 sf.base.detach(virtualEle);509 }510 };511 SfFileManager.prototype.gridBlur = function (e) {512 var target = e.target;513 if (target.tagName === 'TD') {514 target.blur();515 }516 };517 SfFileManager.prototype.removeItemClass = function (value) {518 var ele = this.element.querySelectorAll('.' + value);519 for (var i = 0; i < ele.length; i++) {520 ele[i].classList.remove(value);521 }522 };523 SfFileManager.prototype.removeDropTarget = function () {524 this.removeItemClass(DROP_FOLDER);525 this.removeItemClass(DROP_FILE);526 };527 SfFileManager.prototype.removeBlur = function (hover) {528 var blurEle = !hover ? this.element.querySelectorAll('.' + BLUR) : this.element.querySelectorAll('.' + HOVER);529 var i = 0;530 while (i < blurEle.length) {531 blurEle[i].classList.remove(!hover ? BLUR : HOVER);532 i++;533 }534 };535 SfFileManager.prototype.bindTreeViewKeyBoardEvent = function () {536 var treeviewElem = this.element.querySelector(".e-navigation");537 var keyConfigs = {538 altEnter: 'alt+enter',539 esc: 'escape',540 del: 'delete',541 ctrlX: 'ctrl+x',542 ctrlC: 'ctrl+c',543 ctrlV: 'ctrl+v',544 f2: 'f2',545 shiftF10: 'shift+f10'546 };547 if (treeviewElem) {548 var keyboardDownModule = new sf.base.KeyboardEvents(treeviewElem, {549 keyAction: this.treeviewKeydownHandler.bind(this),550 keyConfigs: keyConfigs,551 eventName: 'keydown'552 });553 }554 };555 SfFileManager.prototype.bindKeyboardEvent = function () {556 if (this.properties.view === 'Details') {557 var keyConfigs = {558 altEnter: 'alt+enter',559 esc: 'escape',560 tab: 'tab',561 moveDown: 'downarrow',562 ctrlEnd: 'ctrl+end',563 ctrlHome: 'ctrl+home',564 ctrlDown: 'ctrl+downarrow',565 ctrlLeft: 'ctrl+leftarrow',566 ctrlRight: 'ctrl+rightarrow',567 shiftEnd: 'shift+end',568 shiftHome: 'shift+home',569 shiftDown: 'shift+downarrow',570 shiftUp: 'shift+uparrow',571 ctrlUp: 'ctrl+uparrow',572 csEnd: 'ctrl+shift+end',573 csHome: 'ctrl+shift+home',574 csDown: 'ctrl+shift+downarrow',575 csUp: 'ctrl+shift+uparrow',576 space: 'space',577 ctrlSpace: 'ctrl+space',578 shiftSpace: 'shift+space',579 csSpace: 'ctrl+shift+space',580 end: 'end',581 home: 'home',582 moveUp: 'uparrow',583 del: 'delete',584 ctrlX: 'ctrl+x',585 ctrlC: 'ctrl+c',586 ctrlV: 'ctrl+v',587 ctrlShiftN: 'ctrl+shift+n',588 shiftdel: 'shift+delete',589 ctrlD: 'ctrl+d',590 f2: 'f2',591 ctrlA: 'ctrl+a',592 enter: 'enter'593 };594 var gridElem = this.element.querySelector('#' + this.properties.id + '_grid');595 if (gridElem) {596 this.bindKeyboardEvents(keyConfigs, gridElem);597 }598 } else if (this.properties.view === 'LargeIcons') {599 var keyConfigs = {600 altN: 'alt+n',601 f5: 'f5',602 ctrlShift1: 'ctrl+shift+1',603 ctrlShift2: 'ctrl+shift+2',604 ctrlU: 'ctrl+u',605 end: 'end',606 home: 'home',607 tab: 'tab',608 moveDown: 'downarrow',609 moveLeft: 'leftarrow',610 moveRight: 'rightarrow',611 moveUp: 'uparrow',612 ctrlEnd: 'ctrl+end',613 ctrlHome: 'ctrl+home',614 ctrlDown: 'ctrl+downarrow',615 ctrlLeft: 'ctrl+leftarrow',616 ctrlRight: 'ctrl+rightarrow',617 ctrlUp: 'ctrl+uparrow',618 shiftEnd: 'shift+end',619 shiftHome: 'shift+home',620 shiftDown: 'shift+downarrow',621 shiftLeft: 'shift+leftarrow',622 shiftRight: 'shift+rightarrow',623 shiftUp: 'shift+uparrow',624 csEnd: 'ctrl+shift+end',625 csHome: 'ctrl+shift+home',626 csDown: 'ctrl+shift+downarrow',627 csLeft: 'ctrl+shift+leftarrow',628 csRight: 'ctrl+shift+rightarrow',629 csUp: 'ctrl+shift+uparrow',630 space: 'space',631 ctrlSpace: 'ctrl+space',632 shiftSpace: 'shift+space',633 csSpace: 'ctrl+shift+space',634 ctrlA: 'ctrl+a',635 enter: 'enter',636 altEnter: 'alt+enter',637 esc: 'escape',638 del: 'delete',639 ctrlX: 'ctrl+x',640 ctrlC: 'ctrl+c',641 ctrlV: 'ctrl+v',642 f2: 'f2',643 shiftdel: 'shift+delete',644 back: 'backspace',645 ctrlD: 'ctrl+d'646 };647 var largeIcons = this.element.querySelector('#' + this.properties.id + '_largeicons');648 if (largeIcons) {649 this.bindKeyboardEvents(keyConfigs, largeIcons);650 }651 }652 };653 SfFileManager.prototype.bindKeyboardEvents = function (keyConfigs, element) {654 this.keyboardModule = new sf.base.KeyboardEvents(element, {655 keyAction: this.keyupHandler.bind(this),656 keyConfigs: keyConfigs,657 eventName: 'keyup'658 });659 this.keyboardDownModule = new sf.base.KeyboardEvents(element, {660 keyAction: this.keydownHandler.bind(this),661 keyConfigs: keyConfigs,662 eventName: 'keydown'663 });664 };665 SfFileManager.prototype.getRowValue = function () {666 var largeIconEle = this.element.querySelector('#' + this.element.id + '_largeicons');667 var itemList = largeIconEle.querySelectorAll('.e-list-item');668 var perRow = 1;669 if (itemList) {670 for (var i = 0, len = itemList.length - 1; i < len; i++) {671 if (itemList[i].getBoundingClientRect().top === itemList[i + 1].getBoundingClientRect().top) {672 perRow++;673 } else {674 break;675 }676 }677 }678 return perRow;679 }; // eslint-disable-next-line680 SfFileManager.prototype.keyupHandler = function (e) {681 e.preventDefault();682 var perRow = 0;683 if (this.properties.view === 'LargeIcons') {684 perRow = this.getRowValue();685 }686 var action = e.action;687 var actionValue = null;688 switch (action) {689 case 'altN':690 actionValue = 'NewFolder';691 break;692 case 'f5':693 actionValue = 'Refresh';694 break;695 case 'ctrlShift1':696 actionValue = 'DetailsView';697 break;698 case 'ctrlShift2':699 actionValue = 'LargeIconsView';700 break;701 case 'ctrlU':702 actionValue = 'Upload';703 break;704 case 'altEnter':705 actionValue = 'Details';706 break;707 case 'del':708 case 'shiftdel':709 actionValue = 'Delete';710 break;711 case 'enter':712 actionValue = 'Open';713 break;714 case 'ctrlC':715 actionValue = 'Copy';716 break;717 case 'ctrlV':718 actionValue = 'Paste';719 break;720 case 'ctrlX':721 actionValue = 'Cut';722 break;723 case 'ctrlD':724 actionValue = 'Download';725 break;726 case 'f2':727 actionValue = 'Rename';728 break;729 case 'ctrlA':730 actionValue = 'SelectAll';731 break;732 case 'home':733 actionValue = 'Home';734 break;735 case 'end':736 actionValue = 'End';737 break;738 case 'moveDown':739 actionValue = 'MoveDown_' + perRow.toString();740 break;741 case 'moveLeft':742 actionValue = 'MoveLeft';743 break;744 case 'moveRight':745 actionValue = 'MoveRight';746 break;747 case 'moveUp':748 actionValue = 'MoveUp_' + perRow.toString();749 break;750 case 'esc':751 actionValue = 'Esc';752 break;753 case 'ctrlLeft':754 actionValue = 'ControlLeft';755 break;756 case 'ctrlRight':757 actionValue = 'ControlRight';758 break;759 case 'ctrlEnd':760 actionValue = 'ControlEnd';761 break;762 case 'ctrlHome':763 actionValue = 'ControlHome';764 break;765 case 'shiftHome':766 actionValue = 'ShiftHome';767 break;768 case 'shiftEnd':769 actionValue = 'ShiftEnd';770 break;771 case 'shiftLeft':772 actionValue = 'ShiftLeft';773 break;774 case 'shiftRight':775 actionValue = 'ShiftRight';776 break;777 case 'csHome':778 actionValue = 'ControlShiftHome';779 break;780 case 'csEnd':781 actionValue = 'ControlShiftEnd';782 break;783 case 'csLeft':784 actionValue = 'ControlShiftLeft';785 break;786 case 'csRight':787 actionValue = 'ControlShiftRight';788 break;789 case 'ctrlUp':790 actionValue = 'ControlUp_' + perRow.toString();791 break;792 case 'shiftUp':793 actionValue = 'ShiftUp_' + perRow.toString();794 break;795 case 'csUp':796 actionValue = 'ControlShiftUp_' + perRow.toString();797 break;798 case 'ctrlDown':799 actionValue = 'ControlDown_' + perRow.toString();800 break;801 case 'shiftDown':802 actionValue = 'ShiftDown_' + perRow.toString();803 break;804 case 'csDown':805 actionValue = 'ControlShiftDown_' + perRow.toString();806 break;807 case 'space':808 actionValue = 'Space';809 break;810 case 'csSpace':811 actionValue = 'ControlShiftSpace';812 break;813 case 'shiftSpace':814 actionValue = 'ShiftSpace';815 break;816 case 'ctrlSpace':817 actionValue = 'ControlSpace';818 break;819 case 'tab':820 actionValue = 'Tab';821 break;822 }823 if (actionValue) {824 this.dotnetRef.invokeMethodAsync('PerformKeyboardAction', actionValue);825 }826 };827 SfFileManager.prototype.treeviewKeydownHandler = function (e) {828 e.preventDefault();829 if (this.element.querySelector('.e-dialog.e-popup-open') == null) {830 var action = e.action;831 var actionValue = null;832 switch (action) {833 case 'altEnter':834 actionValue = 'Details';835 break;836 case 'esc':837 actionValue = 'Esc';838 break;839 case 'del':840 actionValue = 'Delete';841 break;842 case 'ctrlC':843 actionValue = 'Copy';844 break;845 case 'ctrlV':846 actionValue = 'Paste';847 break;848 case 'ctrlX':849 actionValue = 'Cut';850 break;851 case 'shiftF10':852 actionValue = 'Download';853 break;854 case 'f2':855 actionValue = 'Rename';856 break;857 }858 if (actionValue) {859 this.dotnetRef.invokeMethodAsync('PerformTreeViewKeyboardAction', actionValue);860 }861 }862 };863 SfFileManager.prototype.keydownHandler = function (e) {864 if (this.element.querySelector('.e-dialog.e-popup-open') == null) {865 switch (e.action) {866 case 'end':867 case 'home':868 case 'space':869 case 'ctrlSpace':870 case 'shiftSpace':871 case 'csSpace':872 case 'ctrlA':873 case 'enter':874 case 'altEnter':875 case 'ctrlEnd':876 case 'shiftEnd':877 case 'csEnd':878 case 'ctrlHome':879 case 'shiftHome':880 case 'csHome':881 case 'ctrlDown':882 case 'shiftDown':883 case 'csDown':884 case 'ctrlLeft':885 case 'shiftLeft':886 case 'csLeft':887 case 'esc':888 case 'del':889 case 'shiftdel':890 case 'ctrlC':891 case 'ctrlV':892 case 'ctrlX':893 case 'f2':894 case 'moveDown':895 case 'moveUp':896 case 'ctrlD':897 case 'altN':898 case 'f5':899 case 'ctrlShift1':900 case 'ctrlShift2':901 case 'ctrlU':902 e.preventDefault();903 break;904 default:905 break;906 }907 }908 };909 return SfFileManager;910 }(); // eslint:disable-next-line911 var FileManager = {912 initialize: function initialize(element, dotnetRef, properties, isMobile) {913 new SfFileManager(element, dotnetRef, properties);914 if (properties.draggable) {915 element.blazor__instance.createDragObj();916 }917 element.blazor__instance.isMobile = isMobile;918 return element.blazor__instance.adjustHeight();919 },920 dragStartActionContinue: function dragStartActionContinue(element, cancel) {921 if (element) {922 element.blazor__instance.TriggerDragStartEvent(cancel);923 }924 },925 wireMobileEvents: function wireMobileEvents(element) {926 element.blazor__instance.wireMobileEvents();927 },928 dragActionContinue: function dragActionContinue(element, cancel) {929 if (element) {930 element.blazor__instance.TriggerDragEvent(cancel);931 }932 },933 focusItem: function focusItem(element, selector) {934 if (element) {935 if (element.blazor__instance.properties.view === 'LargeIcons') {936 var focusElement = element.querySelector('.e-list-item.e-large-icon[data-uid="' + selector + '"]');937 if (focusElement) {938 focusElement.focus();939 }940 }941 }942 },943 updateProperties: function updateProperties(element, properties) {944 element.blazor__instance.properties = properties;945 element.blazor__instance.unWireEvents();946 element.blazor__instance.wireEvents();947 if (element.blazor__instance.isMobile) {948 element.blazor__instance.unWireMobileEvents();949 element.blazor__instance.wireMobileEvents();950 }951 return element.blazor__instance.adjustHeight();952 },953 uploadOpen: function uploadOpen(element, id, popupTarget) {954 var uploadElement = (!sf.base.isNullOrUndefined(popupTarget) ? document.querySelector(popupTarget) : element).querySelector('#' + id);955 if (uploadElement) {956 uploadElement.click();957 }958 },959 triggerBlur: function triggerBlur(element) {960 if (element && document.activeElement.tagName === TD_ELEMENT) {961 document.activeElement.blur();962 }963 },964 updateFocus: function updateFocus(element, index) {965 if (element) {966 element.blazor__instance.UpdateGridFocus(index);967 }968 },969 updateView: function updateView(element, view) {970 if (element) {971 element.blazor__instance.properties.view = view;972 element.blazor__instance.keyboardDownModule.destroy();973 element.blazor__instance.keyboardModule.destroy();974 element.blazor__instance.bindKeyboardEvent();975 if (element.blazor__instance.isMobile) {976 element.blazor__instance.unWireMobileEvents();977 element.blazor__instance.wireMobileEvents();978 }979 }980 if (element.blazor__instance.properties.draggable) {981 element.blazor__instance.createDragObj();982 }983 },984 updateGridRow: function updateGridRow(gridEle, index) {985 if (gridEle) {986 var selectedElements = gridEle.querySelectorAll('tr.e-row[tabindex="0"]');987 for (var i = 0; i < selectedElements.length; i++) {988 selectedElements[i].removeAttribute('tabindex');989 }990 var element1 = gridEle.querySelector('[aria-rowindex="' + index + '"]');991 if (element1) {992 element1.setAttribute('tabindex', '0');993 element1.focus();994 }995 }996 },997 focusToolbar: function focusToolbar(element, selector) {998 var focusElement = element.querySelector(selector);999 if (element && focusElement) {1000 focusElement.children[0].focus();1001 }1002 },1003 // eslint-disable-next-line1004 saveFile: function saveFile(filename, url, element) {1005 // eslint-disable-next-line1006 var data = {1007 'action': 'download',1008 'path': filename.path,1009 'names': filename.names,1010 'data': filename.data1011 };1012 var form = sf.base.createElement('form', {1013 id: element.id + '_downloadForm',1014 attrs: {1015 action: url,1016 method: 'post',1017 name: 'downloadForm',1018 'download': ''1019 }1020 });1021 var input = sf.base.createElement('input', {1022 id: element.id + '_hiddenForm',1023 attrs: {1024 name: 'downloadInput',1025 value: JSON.stringify(data),1026 type: 'hidden'1027 }1028 });1029 form.appendChild(input);1030 document.body.appendChild(form);1031 document.forms.namedItem('downloadForm').submit();1032 document.body.removeChild(form);1033 },1034 getTargetElement: function getTargetElement(view, x, y) {1035 var element = document.elementFromPoint(x, y);1036 var targetElement;1037 var menuModel;1038 var treeElement = sf.base.closest(element, 'li[role="treeitem"]');1039 if (!element) {1040 menuModel = {1041 IsFile: false,1042 RowIndex: null,1043 IsFolder: false,1044 IsLayout: false,1045 IsTree: false1046 };1047 } else {1048 if (element.classList.contains('e-yscroll') && element.classList.contains('e-content') || element.classList.contains('e-list-parent') && element.classList.contains('e-ul') || element.classList.contains('e-view-container') || element.classList.contains('e-large-icons') || sf.base.closest(element, '.e-empty.e-view-container')) {1049 menuModel = {1050 IsFile: false,1051 RowIndex: null,1052 IsFolder: false,1053 IsLayout: true,1054 IsTree: false1055 };1056 } else if (treeElement) {1057 var dataid = parseInt(treeElement.getAttribute('data-uid'), 10);1058 menuModel = {1059 IsFile: false,1060 RowIndex: dataid,1061 IsFolder: true,1062 IsLayout: false,1063 IsTree: true1064 };1065 } else {1066 if (view === 'Details') {1067 targetElement = sf.base.closest(element, 'tr');1068 var isFile = !targetElement.querySelector('.e-fe-grid-icon .e-fe-icon').classList.contains('e-fe-folder');1069 var rowIndex = parseInt(targetElement.getAttribute('aria-rowindex'), 10);1070 menuModel = {1071 IsFile: isFile,1072 RowIndex: rowIndex,1073 IsFolder: !isFile,1074 IsLayout: false,1075 IsTree: false1076 };1077 } else if (view === 'LargeIcons') {1078 targetElement = sf.base.closest(element, 'li');1079 var iconEle = targetElement.querySelector('.e-list-icon');1080 var isFile = iconEle ? !iconEle.classList.contains('e-fe-folder') : true;1081 var rowIndex = parseInt(targetElement.getAttribute('data-uid'), 10);1082 menuModel = {1083 IsFile: isFile,1084 RowIndex: rowIndex,1085 IsFolder: !isFile,1086 IsLayout: false,1087 IsTree: false1088 };1089 }1090 }1091 }1092 return menuModel;1093 }1094 };1095 return FileManager;1096}();1097/***/ })...

Full Screen

Full Screen

sf-filemanager-417a94.min.js

Source:sf-filemanager-417a94.min.js Github

copy

Full Screen

1/******/ (function(modules) { // webpackBootstrap2/******/ // The module cache3/******/ var installedModules = {};4/******/5/******/ // The require function6/******/ function __webpack_require__(moduleId) {7/******/8/******/ // Check if module is in cache9/******/ if(installedModules[moduleId]) {10/******/ return installedModules[moduleId].exports;11/******/ }12/******/ // Create a new module (and put it into the cache)13/******/ var module = installedModules[moduleId] = {14/******/ i: moduleId,15/******/ l: false,16/******/ exports: {}17/******/ };18/******/19/******/ // Execute the module function20/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);21/******/22/******/ // Flag the module as loaded23/******/ module.l = true;24/******/25/******/ // Return the exports of the module26/******/ return module.exports;27/******/ }28/******/29/******/30/******/ // expose the modules object (__webpack_modules__)31/******/ __webpack_require__.m = modules;32/******/33/******/ // expose the module cache34/******/ __webpack_require__.c = installedModules;35/******/36/******/ // define getter function for harmony exports37/******/ __webpack_require__.d = function(exports, name, getter) {38/******/ if(!__webpack_require__.o(exports, name)) {39/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });40/******/ }41/******/ };42/******/43/******/ // define __esModule on exports44/******/ __webpack_require__.r = function(exports) {45/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {46/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });47/******/ }48/******/ Object.defineProperty(exports, '__esModule', { value: true });49/******/ };50/******/51/******/ // create a fake namespace object52/******/ // mode & 1: value is a module id, require it53/******/ // mode & 2: merge all properties of value into the ns54/******/ // mode & 4: return value when already ns object55/******/ // mode & 8|1: behave like require56/******/ __webpack_require__.t = function(value, mode) {57/******/ if(mode & 1) value = __webpack_require__(value);58/******/ if(mode & 8) return value;59/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;60/******/ var ns = Object.create(null);61/******/ __webpack_require__.r(ns);62/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });63/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));64/******/ return ns;65/******/ };66/******/67/******/ // getDefaultExport function for compatibility with non-harmony modules68/******/ __webpack_require__.n = function(module) {69/******/ var getter = module && module.__esModule ?70/******/ function getDefault() { return module['default']; } :71/******/ function getModuleExports() { return module; };72/******/ __webpack_require__.d(getter, 'a', getter);73/******/ return getter;74/******/ };75/******/76/******/ // Object.prototype.hasOwnProperty.call77/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };78/******/79/******/ // __webpack_public_path__80/******/ __webpack_require__.p = "_content/Syncfusion.Blazor/scripts/";81/******/82/******/83/******/ // Load entry module and return exports84/******/ return __webpack_require__(__webpack_require__.s = "./bundles/sf-filemanager.js");85/******/ })86/************************************************************************/87/******/ ({88/***/ "./bundles/sf-filemanager.js":89/*!***********************************!*\90 !*** ./bundles/sf-filemanager.js ***!91 \***********************************/92/*! no exports provided */93/*! all exports used */94/***/ (function(module, __webpack_exports__, __webpack_require__) {95"use strict";96__webpack_require__.r(__webpack_exports__);97/* harmony import */ var _modules_sf_filemanager_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../modules/sf-filemanager.js */ "./modules/sf-filemanager.js");98/* harmony import */ var _modules_sf_filemanager_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_modules_sf_filemanager_js__WEBPACK_IMPORTED_MODULE_0__);99/***/ }),100/***/ "./modules/sf-filemanager.js":101/*!***********************************!*\102 !*** ./modules/sf-filemanager.js ***!103 \***********************************/104/*! no static exports found */105/***/ (function(module, exports) {106window.sfBlazor = window.sfBlazor || {};107window.sfBlazor.FileManager = function () {108 'use strict';109 var TOOLBAR_ID = '_toolbar';110 var ROW = 'e-row';111 var BLUR = 'e-blur';112 var HOVER = 'e-hover';113 var ACTIVE = 'e-active';114 var CLONE = 'e-fe-clone';115 var FULLROW = 'e-fullrow';116 var FOLDER = 'e-fe-folder';117 var LARGE_ICON = 'e-large-icon';118 var DROP_FILE = 'e-fe-drop-file';119 var LARGE_ICONS = 'e-large-icons';120 var DROP_FOLDER = 'e-fe-drop-folder';121 var TD_ELEMENT = 'TD';122 var FOCUSED = 'e-focused';123 var FOCUS = 'e-focus';124 var SfFileManager =125 /** @class */126 function () {127 function SfFileManager(element, ref, properties) {128 this.element = element;129 this.properties = properties;130 this.treeviewEle = element.querySelector('.e-navigation .e-treeview');131 this.dotnetRef = ref;132 if (!sf.base.isNullOrUndefined(this.element)) {133 this.ctrlId = this.element.id; // eslint-disable-next-line134 this.element.blazor__instance = this;135 }136 this.bindKeyboardEvent();137 this.bindTreeViewKeyBoardEvent();138 this.wireEvents();139 }140 SfFileManager.prototype.unWireMobileEvents = function () {141 this.clickObj.destroy();142 };143 SfFileManager.prototype.wireMobileEvents = function () {144 var fileElement; // eslint-disable-next-line145 var proxy = this;146 if (this.properties.view === 'Details') {147 fileElement = this.element.querySelector('.e-view-container .e-grid .e-gridcontent');148 } else {149 fileElement = this.element.querySelector('.e-view-container .e-large-icons');150 }151 this.clickObj = new sf.base.Touch(fileElement, {152 tapHold: function tapHold(e) {153 var targetElement;154 var rowId;155 if (proxy.properties.view === 'Details') {156 targetElement = sf.base.closest(e.originalEvent.target, '.e-row');157 rowId = targetElement ? targetElement.getAttribute('aria-rowindex') : null;158 } else {159 targetElement = sf.base.closest(e.originalEvent.target, 'li.e-list-item');160 rowId = targetElement ? targetElement.getAttribute('data-uid') : null;161 }162 if (targetElement != null && rowId != null) {163 proxy.dotnetRef.invokeMethodAsync('ChangeMobileMultiSelection', rowId);164 }165 }166 });167 };168 SfFileManager.prototype.wireEvents = function () {169 var gridElem = this.element.querySelector('#' + this.properties.id + '_grid');170 if (gridElem) {171 sf.base.EventHandler.add(gridElem, 'dblclick', this.gridBlur, this);172 }173 };174 SfFileManager.prototype.unWireEvents = function () {175 var gridElem = this.element.querySelector('#' + this.properties.id + '_grid');176 if (gridElem) {177 sf.base.EventHandler.remove(gridElem, 'dblclick', this.gridBlur);178 }179 };180 SfFileManager.prototype.adjustHeight = function () {181 var toolbar = sf.base.select('#' + this.element.id + TOOLBAR_ID, this.element);182 var toolBarHeight = toolbar ? toolbar.offsetHeight : 0;183 var breadcrumbBarHeight = this.element.querySelector('.e-address').offsetHeight;184 var gridHeight = this.element.clientHeight - toolBarHeight - breadcrumbBarHeight;185 return sf.base.formatUnit(this.element.clientHeight - toolBarHeight) + ' ' + sf.base.formatUnit(gridHeight);186 };187 SfFileManager.prototype.createDragObj = function () {188 var _this = this;189 var dragEle;190 var dragTarget;191 if (this.properties.view === 'LargeIcons') {192 dragEle = this.element.querySelector('.e-large-icons ul');193 dragTarget = '.' + LARGE_ICON;194 } else {195 dragEle = this.element.querySelector('.e-grid.e-control');196 dragTarget = '.' + ROW;197 }198 if (this.properties.draggable) {199 if (this.dragObj) {200 this.dragObj.destroy();201 }202 if (dragEle) {203 this.dragObj = new sf.base.Draggable(dragEle, {204 cursorAt: {205 left: 44,206 top: 18207 },208 enableTailMode: true,209 dragArea: this.element,210 dragTarget: '.' + FULLROW,211 drag: this.draggingHandler.bind(this),212 dragStart: function dragStart(args) {213 _this.dragStartHandler(args);214 },215 dragStop: this.dragStopHandler.bind(this),216 enableAutoScroll: true,217 helper: this.dragHelper.bind(this)218 });219 }220 } else if (!this.properties.draggable) {221 this.dragObj.destroy();222 }223 if (this.treeviewEle) {224 if (this.treeDragObj) {225 this.treeDragObj.destroy();226 }227 this.treeDragObj = new sf.base.Draggable(this.treeviewEle, {228 cursorAt: {229 left: 44,230 top: 18231 },232 enableTailMode: true,233 dragArea: this.element,234 dragTarget: dragTarget,235 drag: this.draggingHandler.bind(this),236 dragStart: function dragStart(args) {237 _this.dragStartHandler(args);238 },239 dragStop: this.dragStopHandler.bind(this),240 enableAutoScroll: true,241 helper: this.dragHelper.bind(this)242 });243 } else if (!this.properties.draggable) {244 this.treeDragObj.destroy();245 }246 };247 SfFileManager.prototype.dragHelper = function (args) {248 var dragTarget = args.sender.target;249 this.getModule(dragTarget);250 if (this.activeModule === 'largeiconsview' || this.activeModule === 'navigationpane') {251 this.dragLi = sf.base.closest(dragTarget, '.e-list-item');252 } else if (this.activeModule === 'detailsview') {253 this.dragLi = sf.base.closest(dragTarget, 'tr.e-row');254 if (this.dragLi.getAttribute('aria-selected') == 'false') {255 dragTarget.click();256 }257 }258 if (!this.dragLi) {259 return null;260 }261 this.createVirtualDragElement();262 return this.virtualDragElement;263 };264 SfFileManager.prototype.createVirtualDragElement = function () {265 this.updateViewElement();266 this.updateDragValues();267 this.cloneIcon = sf.base.createElement('div', {268 className: 'e-fe-icon ' + this.dragType269 });270 this.cloneName = sf.base.createElement('div', {271 className: 'e-fe-name',272 innerHTML: this.dragName273 });274 var virtualEle = sf.base.createElement('div', {275 className: 'e-fe-content'276 });277 virtualEle.appendChild(this.cloneIcon);278 virtualEle.appendChild(this.cloneName);279 var ele = sf.base.createElement('div', {280 className: CLONE281 });282 ele.appendChild(virtualEle);283 if (this.dragCount > 1) {284 var badge = sf.base.createElement('span', {285 className: 'e-fe-count',286 innerHTML: this.dragCount.toString(10)287 });288 ele.appendChild(badge);289 }290 this.virtualDragElement = ele;291 this.element.appendChild(this.virtualDragElement);292 };293 SfFileManager.prototype.getModule = function (element) {294 if (element) {295 if (sf.base.closest(element, '.' + ROW)) {296 this.activeModule = 'detailsview';297 } else if (sf.base.closest(element, '.' + LARGE_ICON)) {298 this.activeModule = 'largeiconsview';299 } else {300 this.activeModule = 'navigationpane';301 }302 }303 };304 SfFileManager.prototype.getXYValue = function (e, direction) {305 var touchList = e.changedTouches;306 var value;307 if (direction === 'X') {308 value = touchList ? touchList[0].clientX : e.clientX;309 } else {310 value = touchList ? touchList[0].clientY : e.clientY;311 }312 if (!value && e.type === 'focus' && e.target) {313 var rect = e.target.getBoundingClientRect();314 value = rect ? direction === 'X' ? rect.left : rect.top : null;315 }316 return Math.ceil(value);317 };318 SfFileManager.prototype.removeDestroyElement = function () {319 this.dragObj.intDestroy(this.dragStartArgs.event);320 this.dragCancel();321 };322 SfFileManager.prototype.TriggerDragEvent = function (cancel) {323 if (cancel) {324 this.removeDestroyElement();325 }326 };327 SfFileManager.prototype.UpdateGridFocus = function (index) {328 if (this.properties.view == "Details") {329 this.updateViewElement();330 var focusedItem = this.viewElem.querySelectorAll(".e-focused");331 var itemElement = this.viewElem.querySelector('[aria-rowindex="' + index.toString() + '"]');332 if (focusedItem) {333 for (var i = 0; i < focusedItem.length; i++) {334 if (sf.base.closest(focusedItem[i], 'tr').getAttribute('aria-rowindex') != index.toString()) {335 sf.base.closest(focusedItem[i], 'tr').removeAttribute('tabindex');336 sf.base.removeClass([focusedItem[i]], [FOCUS, FOCUSED]);337 }338 }339 }340 if (!sf.base.isNullOrUndefined(itemElement)) {341 this.viewElem.setAttribute('tabindex', '-1');342 itemElement.setAttribute('tabindex', '0');343 sf.base.addClass([itemElement], [FOCUS, FOCUSED]);344 }345 }346 };347 SfFileManager.prototype.TriggerDragStartEvent = function (cancel) {348 if (cancel) {349 this.removeDestroyElement();350 } else {351 this.dragStartArgs.bindEvents(this.dragStartArgs.dragElement);352 var dragArgs = this.dragStartArgs;353 dragArgs.cancel = false;354 this.getModule(this.dragStartArgs.target);355 var rootId = this.element.querySelector('.e-navigation .e-treeview ul li').getAttribute('data-uid');356 if (!this.properties.draggable || this.activeModule === 'navigationpane' && sf.base.closest(this.dragStartArgs.target, 'li').getAttribute('data-uid') === rootId) {357 dragArgs.cancel = true;358 }359 this.removeBlur();360 if (dragArgs.cancel) {361 this.removeDestroyElement();362 } else if (!dragArgs.cancel) {363 this.updateViewElement();364 this.blurActive();365 this.updateDragValues();366 }367 }368 };369 SfFileManager.prototype.dragStartHandler = function (args) {370 this.dragStartArgs = args;371 this.UpdateXY(args);372 this.dotnetRef.invokeMethodAsync('DragStartCall', this.dragLeft, this.dragTop);373 };374 SfFileManager.prototype.blurActive = function () {375 var i = 0;376 var activeElements = this.viewElem.querySelectorAll('.' + ACTIVE);377 while (i < activeElements.length) {378 activeElements[i].classList.add(BLUR);379 i++;380 }381 };382 SfFileManager.prototype.updateViewElement = function () {383 if (this.properties.view === 'LargeIcons') {384 this.viewElem = this.element.querySelector('.' + LARGE_ICONS);385 } else {386 this.viewElem = this.element.querySelector('.e-gridcontent');387 }388 };389 SfFileManager.prototype.getIconClass = function (element) {390 var iconValue = '';391 iconValue = element.querySelector('.e-list-img') ? 'e-fe-image' : element.querySelector('.e-list-icon').classList[1];392 return iconValue;393 };394 SfFileManager.prototype.updateDragValues = function () {395 var activeElements;396 if (this.activeModule === 'largeiconsview') {397 activeElements = this.viewElem.querySelectorAll('.' + ACTIVE);398 this.dragName = activeElements.length > 0 ? activeElements[0].querySelector('.e-list-text').textContent : '';399 this.dragType = activeElements.length > 0 ? this.getIconClass(activeElements[0]) : '';400 } else if (this.activeModule === 'detailsview') {401 activeElements = this.viewElem.querySelectorAll('tr[aria-selected="true"]');402 if (activeElements != null && activeElements.length > 0) {403 this.dragName = activeElements.length > 0 ? activeElements[0].querySelector('.e-fe-text').textContent : '';404 this.dragType = activeElements.length > 0 ? activeElements[0].querySelector('.e-fe-icon').classList[1] : '';405 }406 } else if (this.activeModule === 'navigationpane') {407 this.dragName = this.dragLi.querySelector('.e-list-text').textContent;408 this.dragType = 'e-fe-folder';409 }410 if (activeElements != null) {411 this.dragCount = activeElements.length;412 }413 };414 SfFileManager.prototype.getTargetModule = function (element) {415 if (element) {416 if (sf.base.closest(element, '.e-gridcontent')) {417 this.targetModule = 'detailsview';418 } else if (sf.base.closest(element, '.' + LARGE_ICONS)) {419 this.targetModule = 'largeiconsview';420 } else if (element.classList.contains('e-fullrow') || element.classList.contains('e-icon-expandable')) {421 this.targetModule = 'navigationpane';422 } else if (sf.base.closest(element, '.e-address-list-item')) {423 this.targetModule = 'breadcrumbbar';424 } else {425 this.targetModule = '';426 }427 }428 };429 SfFileManager.prototype.draggingHandler = function (args) {430 var canDrop = false;431 this.updateDragValues();432 this.cloneIcon.setAttribute('class', 'e-fe-icon ' + this.dragType);433 this.cloneName.innerHTML = this.dragName;434 var node = null;435 this.blurActive();436 this.getTargetModule(args.target);437 this.removeDropTarget();438 this.removeBlur('hover');439 if (this.targetModule === 'navigationpane') {440 node = sf.base.closest(args.target, 'li');441 node.classList.add(HOVER, DROP_FOLDER);442 canDrop = true;443 } else if (this.targetModule === 'detailsview') {444 node = sf.base.closest(args.target, 'tr');445 if (node && node.querySelector('.' + FOLDER) && !node.classList.contains(BLUR)) {446 node.classList.add(DROP_FOLDER);447 } else if (node && !node.querySelector('.' + FOLDER) && !node.classList.contains(BLUR)) {448 node.classList.add(DROP_FILE);449 }450 canDrop = true;451 } else if (this.targetModule === 'largeiconsview') {452 node = sf.base.closest(args.target, 'li');453 if (node && node.querySelector('.' + FOLDER) && !node.classList.contains(BLUR)) {454 node.classList.add(HOVER, DROP_FOLDER);455 }456 canDrop = true;457 } else if (this.targetModule === 'breadcrumbbar') {458 canDrop = true;459 }460 this.element.classList.remove('e-fe-drop', 'e-no-drop');461 this.element.classList.add(canDrop ? 'e-fe-drop' : 'e-no-drop');462 this.UpdateXY(args);463 this.dotnetRef.invokeMethodAsync('DraggingCall', this.dragLeft, this.dragTop);464 };465 SfFileManager.prototype.UpdateXY = function (args) {466 this.dragLeft = this.getXYValue(args.event, 'X');467 this.dragTop = this.getXYValue(args.event, 'Y');468 };469 SfFileManager.prototype.dragStopHandler = function (args) {470 var dragArgs = args;471 var isLayout = false;472 dragArgs.cancel = false;473 this.removeDropTarget();474 this.element.classList.remove('e-fe-drop', 'e-no-drop');475 this.dragCancel();476 this.getTargetModule(args.target);477 if (this.targetModule === '' && args.target.classList.contains('e-view-container')) {478 isLayout = true;479 }480 this.removeBlur('hover');481 var targetElement;482 var dataValue;483 if (this.targetModule === 'largeiconsview' || this.targetModule === 'navigationpane' || this.targetModule === 'breadcrumbbar') {484 targetElement = sf.base.closest(args.target, 'li');485 var attr = this.targetModule === 'breadcrumbbar' ? 'data-utext' : 'data-uid';486 dataValue = targetElement ? targetElement.getAttribute(attr) : null;487 } else if (this.targetModule === 'detailsview') {488 targetElement = sf.base.closest(args.target, 'tr');489 dataValue = targetElement ? targetElement.getAttribute('aria-rowindex') : null;490 }491 if (dataValue == null) {492 isLayout = true;493 }494 var treeid = this.treeviewEle ? this.dragLi.getAttribute('data-uid') : null;495 if (this.activeModule === 'detailsview') {496 treeid = this.dragLi.getAttribute('aria-rowindex');497 }498 this.UpdateXY(args); // eslint:disable-next-line499 this.dotnetRef.invokeMethodAsync('DragStopCall', treeid, dataValue, this.targetModule, this.activeModule, isLayout, this.dragLeft, this.dragTop);500 this.dragCount = 0;501 this.dragName = '';502 this.dragType = '';503 };504 SfFileManager.prototype.dragCancel = function () {505 this.removeBlur();506 var virtualEle = sf.base.select('.' + CLONE, this.element);507 if (virtualEle) {508 sf.base.detach(virtualEle);509 }510 };511 SfFileManager.prototype.gridBlur = function (e) {512 var target = e.target;513 if (target.tagName === 'TD') {514 target.blur();515 }516 };517 SfFileManager.prototype.removeItemClass = function (value) {518 var ele = this.element.querySelectorAll('.' + value);519 for (var i = 0; i < ele.length; i++) {520 ele[i].classList.remove(value);521 }522 };523 SfFileManager.prototype.removeDropTarget = function () {524 this.removeItemClass(DROP_FOLDER);525 this.removeItemClass(DROP_FILE);526 };527 SfFileManager.prototype.removeBlur = function (hover) {528 var blurEle = !hover ? this.element.querySelectorAll('.' + BLUR) : this.element.querySelectorAll('.' + HOVER);529 var i = 0;530 while (i < blurEle.length) {531 blurEle[i].classList.remove(!hover ? BLUR : HOVER);532 i++;533 }534 };535 SfFileManager.prototype.bindTreeViewKeyBoardEvent = function () {536 var treeviewElem = this.element.querySelector(".e-navigation");537 var keyConfigs = {538 altEnter: 'alt+enter',539 esc: 'escape',540 del: 'delete',541 ctrlX: 'ctrl+x',542 ctrlC: 'ctrl+c',543 ctrlV: 'ctrl+v',544 f2: 'f2',545 shiftF10: 'shift+f10'546 };547 if (treeviewElem) {548 var keyboardDownModule = new sf.base.KeyboardEvents(treeviewElem, {549 keyAction: this.treeviewKeydownHandler.bind(this),550 keyConfigs: keyConfigs,551 eventName: 'keydown'552 });553 }554 };555 SfFileManager.prototype.bindKeyboardEvent = function () {556 if (this.properties.view === 'Details') {557 var keyConfigs = {558 altEnter: 'alt+enter',559 esc: 'escape',560 tab: 'tab',561 moveDown: 'downarrow',562 ctrlEnd: 'ctrl+end',563 ctrlHome: 'ctrl+home',564 ctrlDown: 'ctrl+downarrow',565 ctrlLeft: 'ctrl+leftarrow',566 ctrlRight: 'ctrl+rightarrow',567 shiftEnd: 'shift+end',568 shiftHome: 'shift+home',569 shiftDown: 'shift+downarrow',570 shiftUp: 'shift+uparrow',571 ctrlUp: 'ctrl+uparrow',572 csEnd: 'ctrl+shift+end',573 csHome: 'ctrl+shift+home',574 csDown: 'ctrl+shift+downarrow',575 csUp: 'ctrl+shift+uparrow',576 space: 'space',577 ctrlSpace: 'ctrl+space',578 shiftSpace: 'shift+space',579 csSpace: 'ctrl+shift+space',580 end: 'end',581 home: 'home',582 moveUp: 'uparrow',583 del: 'delete',584 ctrlX: 'ctrl+x',585 ctrlC: 'ctrl+c',586 ctrlV: 'ctrl+v',587 ctrlShiftN: 'ctrl+shift+n',588 shiftdel: 'shift+delete',589 ctrlD: 'ctrl+d',590 f2: 'f2',591 ctrlA: 'ctrl+a',592 enter: 'enter'593 };594 var gridElem = this.element.querySelector('#' + this.properties.id + '_grid');595 if (gridElem) {596 this.bindKeyboardEvents(keyConfigs, gridElem);597 }598 } else if (this.properties.view === 'LargeIcons') {599 var keyConfigs = {600 altN: 'alt+n',601 f5: 'f5',602 ctrlShift1: 'ctrl+shift+1',603 ctrlShift2: 'ctrl+shift+2',604 ctrlU: 'ctrl+u',605 end: 'end',606 home: 'home',607 tab: 'tab',608 moveDown: 'downarrow',609 moveLeft: 'leftarrow',610 moveRight: 'rightarrow',611 moveUp: 'uparrow',612 ctrlEnd: 'ctrl+end',613 ctrlHome: 'ctrl+home',614 ctrlDown: 'ctrl+downarrow',615 ctrlLeft: 'ctrl+leftarrow',616 ctrlRight: 'ctrl+rightarrow',617 ctrlUp: 'ctrl+uparrow',618 shiftEnd: 'shift+end',619 shiftHome: 'shift+home',620 shiftDown: 'shift+downarrow',621 shiftLeft: 'shift+leftarrow',622 shiftRight: 'shift+rightarrow',623 shiftUp: 'shift+uparrow',624 csEnd: 'ctrl+shift+end',625 csHome: 'ctrl+shift+home',626 csDown: 'ctrl+shift+downarrow',627 csLeft: 'ctrl+shift+leftarrow',628 csRight: 'ctrl+shift+rightarrow',629 csUp: 'ctrl+shift+uparrow',630 space: 'space',631 ctrlSpace: 'ctrl+space',632 shiftSpace: 'shift+space',633 csSpace: 'ctrl+shift+space',634 ctrlA: 'ctrl+a',635 enter: 'enter',636 altEnter: 'alt+enter',637 esc: 'escape',638 del: 'delete',639 ctrlX: 'ctrl+x',640 ctrlC: 'ctrl+c',641 ctrlV: 'ctrl+v',642 f2: 'f2',643 shiftdel: 'shift+delete',644 back: 'backspace',645 ctrlD: 'ctrl+d'646 };647 var largeIcons = this.element.querySelector('#' + this.properties.id + '_largeicons');648 if (largeIcons) {649 this.bindKeyboardEvents(keyConfigs, largeIcons);650 }651 }652 };653 SfFileManager.prototype.bindKeyboardEvents = function (keyConfigs, element) {654 this.keyboardModule = new sf.base.KeyboardEvents(element, {655 keyAction: this.keyupHandler.bind(this),656 keyConfigs: keyConfigs,657 eventName: 'keyup'658 });659 this.keyboardDownModule = new sf.base.KeyboardEvents(element, {660 keyAction: this.keydownHandler.bind(this),661 keyConfigs: keyConfigs,662 eventName: 'keydown'663 });664 };665 SfFileManager.prototype.getRowValue = function () {666 var largeIconEle = this.element.querySelector('#' + this.element.id + '_largeicons');667 var itemList = largeIconEle.querySelectorAll('.e-list-item');668 var perRow = 1;669 if (itemList) {670 for (var i = 0, len = itemList.length - 1; i < len; i++) {671 if (itemList[i].getBoundingClientRect().top === itemList[i + 1].getBoundingClientRect().top) {672 perRow++;673 } else {674 break;675 }676 }677 }678 return perRow;679 }; // eslint-disable-next-line680 SfFileManager.prototype.keyupHandler = function (e) {681 e.preventDefault();682 var perRow = 0;683 if (this.properties.view === 'LargeIcons') {684 perRow = this.getRowValue();685 }686 var action = e.action;687 var actionValue = null;688 switch (action) {689 case 'altN':690 actionValue = 'NewFolder';691 break;692 case 'f5':693 actionValue = 'Refresh';694 break;695 case 'ctrlShift1':696 actionValue = 'DetailsView';697 break;698 case 'ctrlShift2':699 actionValue = 'LargeIconsView';700 break;701 case 'ctrlU':702 actionValue = 'Upload';703 break;704 case 'altEnter':705 actionValue = 'Details';706 break;707 case 'del':708 case 'shiftdel':709 actionValue = 'Delete';710 break;711 case 'enter':712 actionValue = 'Open';713 break;714 case 'ctrlC':715 actionValue = 'Copy';716 break;717 case 'ctrlV':718 actionValue = 'Paste';719 break;720 case 'ctrlX':721 actionValue = 'Cut';722 break;723 case 'ctrlD':724 actionValue = 'Download';725 break;726 case 'f2':727 actionValue = 'Rename';728 break;729 case 'ctrlA':730 actionValue = 'SelectAll';731 break;732 case 'home':733 actionValue = 'Home';734 break;735 case 'end':736 actionValue = 'End';737 break;738 case 'moveDown':739 actionValue = 'MoveDown_' + perRow.toString();740 break;741 case 'moveLeft':742 actionValue = 'MoveLeft';743 break;744 case 'moveRight':745 actionValue = 'MoveRight';746 break;747 case 'moveUp':748 actionValue = 'MoveUp_' + perRow.toString();749 break;750 case 'esc':751 actionValue = 'Esc';752 break;753 case 'ctrlLeft':754 actionValue = 'ControlLeft';755 break;756 case 'ctrlRight':757 actionValue = 'ControlRight';758 break;759 case 'ctrlEnd':760 actionValue = 'ControlEnd';761 break;762 case 'ctrlHome':763 actionValue = 'ControlHome';764 break;765 case 'shiftHome':766 actionValue = 'ShiftHome';767 break;768 case 'shiftEnd':769 actionValue = 'ShiftEnd';770 break;771 case 'shiftLeft':772 actionValue = 'ShiftLeft';773 break;774 case 'shiftRight':775 actionValue = 'ShiftRight';776 break;777 case 'csHome':778 actionValue = 'ControlShiftHome';779 break;780 case 'csEnd':781 actionValue = 'ControlShiftEnd';782 break;783 case 'csLeft':784 actionValue = 'ControlShiftLeft';785 break;786 case 'csRight':787 actionValue = 'ControlShiftRight';788 break;789 case 'ctrlUp':790 actionValue = 'ControlUp_' + perRow.toString();791 break;792 case 'shiftUp':793 actionValue = 'ShiftUp_' + perRow.toString();794 break;795 case 'csUp':796 actionValue = 'ControlShiftUp_' + perRow.toString();797 break;798 case 'ctrlDown':799 actionValue = 'ControlDown_' + perRow.toString();800 break;801 case 'shiftDown':802 actionValue = 'ShiftDown_' + perRow.toString();803 break;804 case 'csDown':805 actionValue = 'ControlShiftDown_' + perRow.toString();806 break;807 case 'space':808 actionValue = 'Space';809 break;810 case 'csSpace':811 actionValue = 'ControlShiftSpace';812 break;813 case 'shiftSpace':814 actionValue = 'ShiftSpace';815 break;816 case 'ctrlSpace':817 actionValue = 'ControlSpace';818 break;819 case 'tab':820 actionValue = 'Tab';821 break;822 }823 if (actionValue) {824 this.dotnetRef.invokeMethodAsync('PerformKeyboardAction', actionValue);825 }826 };827 SfFileManager.prototype.treeviewKeydownHandler = function (e) {828 e.preventDefault();829 if (this.element.querySelector('.e-dialog.e-popup-open') == null) {830 var action = e.action;831 var actionValue = null;832 switch (action) {833 case 'altEnter':834 actionValue = 'Details';835 break;836 case 'esc':837 actionValue = 'Esc';838 break;839 case 'del':840 actionValue = 'Delete';841 break;842 case 'ctrlC':843 actionValue = 'Copy';844 break;845 case 'ctrlV':846 actionValue = 'Paste';847 break;848 case 'ctrlX':849 actionValue = 'Cut';850 break;851 case 'shiftF10':852 actionValue = 'Download';853 break;854 case 'f2':855 actionValue = 'Rename';856 break;857 }858 if (actionValue) {859 this.dotnetRef.invokeMethodAsync('PerformTreeViewKeyboardAction', actionValue);860 }861 }862 };863 SfFileManager.prototype.keydownHandler = function (e) {864 if (this.element.querySelector('.e-dialog.e-popup-open') == null) {865 switch (e.action) {866 case 'end':867 case 'home':868 case 'space':869 case 'ctrlSpace':870 case 'shiftSpace':871 case 'csSpace':872 case 'ctrlA':873 case 'enter':874 case 'altEnter':875 case 'ctrlEnd':876 case 'shiftEnd':877 case 'csEnd':878 case 'ctrlHome':879 case 'shiftHome':880 case 'csHome':881 case 'ctrlDown':882 case 'shiftDown':883 case 'csDown':884 case 'ctrlLeft':885 case 'shiftLeft':886 case 'csLeft':887 case 'esc':888 case 'del':889 case 'shiftdel':890 case 'ctrlC':891 case 'ctrlV':892 case 'ctrlX':893 case 'f2':894 case 'moveDown':895 case 'moveUp':896 case 'ctrlD':897 case 'altN':898 case 'f5':899 case 'ctrlShift1':900 case 'ctrlShift2':901 case 'ctrlU':902 e.preventDefault();903 break;904 default:905 break;906 }907 }908 };909 return SfFileManager;910 }(); // eslint:disable-next-line911 var FileManager = {912 initialize: function initialize(element, dotnetRef, properties, isMobile) {913 new SfFileManager(element, dotnetRef, properties);914 if (properties.draggable) {915 element.blazor__instance.createDragObj();916 }917 element.blazor__instance.isMobile = isMobile;918 return element.blazor__instance.adjustHeight();919 },920 dragStartActionContinue: function dragStartActionContinue(element, cancel) {921 if (element) {922 element.blazor__instance.TriggerDragStartEvent(cancel);923 }924 },925 wireMobileEvents: function wireMobileEvents(element) {926 element.blazor__instance.wireMobileEvents();927 },928 dragActionContinue: function dragActionContinue(element, cancel) {929 if (element) {930 element.blazor__instance.TriggerDragEvent(cancel);931 }932 },933 focusItem: function focusItem(element, selector) {934 if (element) {935 if (element.blazor__instance.properties.view === 'LargeIcons') {936 var focusElement = element.querySelector('.e-list-item.e-large-icon[data-uid="' + selector + '"]');937 if (focusElement) {938 focusElement.focus();939 }940 }941 }942 },943 updateProperties: function updateProperties(element, properties) {944 element.blazor__instance.properties = properties;945 element.blazor__instance.unWireEvents();946 element.blazor__instance.wireEvents();947 if (element.blazor__instance.isMobile) {948 element.blazor__instance.unWireMobileEvents();949 element.blazor__instance.wireMobileEvents();950 }951 return element.blazor__instance.adjustHeight();952 },953 uploadOpen: function uploadOpen(element, id, popupTarget) {954 var uploadElement = (!sf.base.isNullOrUndefined(popupTarget) ? document.querySelector(popupTarget) : element).querySelector('#' + id);955 if (uploadElement) {956 uploadElement.click();957 }958 },959 triggerBlur: function triggerBlur(element) {960 if (element && document.activeElement.tagName === TD_ELEMENT) {961 document.activeElement.blur();962 }963 },964 updateFocus: function updateFocus(element, index) {965 if (element) {966 element.blazor__instance.UpdateGridFocus(index);967 }968 },969 updateView: function updateView(element, view) {970 if (element) {971 element.blazor__instance.properties.view = view;972 element.blazor__instance.keyboardDownModule.destroy();973 element.blazor__instance.keyboardModule.destroy();974 element.blazor__instance.bindKeyboardEvent();975 if (element.blazor__instance.isMobile) {976 element.blazor__instance.unWireMobileEvents();977 element.blazor__instance.wireMobileEvents();978 }979 }980 if (element.blazor__instance.properties.draggable) {981 element.blazor__instance.createDragObj();982 }983 },984 updateGridRow: function updateGridRow(gridEle, index) {985 if (gridEle) {986 var selectedElements = gridEle.querySelectorAll('tr.e-row[tabindex="0"]');987 for (var i = 0; i < selectedElements.length; i++) {988 selectedElements[i].removeAttribute('tabindex');989 }990 var element1 = gridEle.querySelector('[aria-rowindex="' + index + '"]');991 if (element1) {992 element1.setAttribute('tabindex', '0');993 element1.focus();994 }995 }996 },997 focusToolbar: function focusToolbar(element, selector) {998 var focusElement = element.querySelector(selector);999 if (element && focusElement) {1000 focusElement.children[0].focus();1001 }1002 },1003 // eslint-disable-next-line1004 saveFile: function saveFile(filename, url, element) {1005 // eslint-disable-next-line1006 var data = {1007 'action': 'download',1008 'path': filename.path,1009 'names': filename.names,1010 'data': filename.data1011 };1012 var form = sf.base.createElement('form', {1013 id: element.id + '_downloadForm',1014 attrs: {1015 action: url,1016 method: 'post',1017 name: 'downloadForm',1018 'download': ''1019 }1020 });1021 var input = sf.base.createElement('input', {1022 id: element.id + '_hiddenForm',1023 attrs: {1024 name: 'downloadInput',1025 value: JSON.stringify(data),1026 type: 'hidden'1027 }1028 });1029 form.appendChild(input);1030 document.body.appendChild(form);1031 document.forms.namedItem('downloadForm').submit();1032 document.body.removeChild(form);1033 },1034 getTargetElement: function getTargetElement(view, x, y) {1035 var element = document.elementFromPoint(x, y);1036 var targetElement;1037 var menuModel;1038 var treeElement = sf.base.closest(element, 'li[role="treeitem"]');1039 if (!element) {1040 menuModel = {1041 IsFile: false,1042 RowIndex: null,1043 IsFolder: false,1044 IsLayout: false,1045 IsTree: false1046 };1047 } else {1048 if (element.classList.contains('e-yscroll') && element.classList.contains('e-content') || element.classList.contains('e-list-parent') && element.classList.contains('e-ul') || element.classList.contains('e-view-container') || element.classList.contains('e-large-icons') || sf.base.closest(element, '.e-empty.e-view-container')) {1049 menuModel = {1050 IsFile: false,1051 RowIndex: null,1052 IsFolder: false,1053 IsLayout: true,1054 IsTree: false1055 };1056 } else if (treeElement) {1057 var dataid = parseInt(treeElement.getAttribute('data-uid'), 10);1058 menuModel = {1059 IsFile: false,1060 RowIndex: dataid,1061 IsFolder: true,1062 IsLayout: false,1063 IsTree: true1064 };1065 } else {1066 if (view === 'Details') {1067 targetElement = sf.base.closest(element, 'tr');1068 var isFile = !targetElement.querySelector('.e-fe-grid-icon .e-fe-icon').classList.contains('e-fe-folder');1069 var rowIndex = parseInt(targetElement.getAttribute('aria-rowindex'), 10);1070 menuModel = {1071 IsFile: isFile,1072 RowIndex: rowIndex,1073 IsFolder: !isFile,1074 IsLayout: false,1075 IsTree: false1076 };1077 } else if (view === 'LargeIcons') {1078 targetElement = sf.base.closest(element, 'li');1079 var iconEle = targetElement.querySelector('.e-list-icon');1080 var isFile = iconEle ? !iconEle.classList.contains('e-fe-folder') : true;1081 var rowIndex = parseInt(targetElement.getAttribute('data-uid'), 10);1082 menuModel = {1083 IsFile: isFile,1084 RowIndex: rowIndex,1085 IsFolder: !isFile,1086 IsLayout: false,1087 IsTree: false1088 };1089 }1090 }1091 }1092 return menuModel;1093 }1094 };1095 return FileManager;1096}();1097/***/ })...

Full Screen

Full Screen

sf-filemanager-9a5877.min.js

Source:sf-filemanager-9a5877.min.js Github

copy

Full Screen

1/******/ (function(modules) { // webpackBootstrap2/******/ // The module cache3/******/ var installedModules = {};4/******/5/******/ // The require function6/******/ function __webpack_require__(moduleId) {7/******/8/******/ // Check if module is in cache9/******/ if(installedModules[moduleId]) {10/******/ return installedModules[moduleId].exports;11/******/ }12/******/ // Create a new module (and put it into the cache)13/******/ var module = installedModules[moduleId] = {14/******/ i: moduleId,15/******/ l: false,16/******/ exports: {}17/******/ };18/******/19/******/ // Execute the module function20/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);21/******/22/******/ // Flag the module as loaded23/******/ module.l = true;24/******/25/******/ // Return the exports of the module26/******/ return module.exports;27/******/ }28/******/29/******/30/******/ // expose the modules object (__webpack_modules__)31/******/ __webpack_require__.m = modules;32/******/33/******/ // expose the module cache34/******/ __webpack_require__.c = installedModules;35/******/36/******/ // define getter function for harmony exports37/******/ __webpack_require__.d = function(exports, name, getter) {38/******/ if(!__webpack_require__.o(exports, name)) {39/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });40/******/ }41/******/ };42/******/43/******/ // define __esModule on exports44/******/ __webpack_require__.r = function(exports) {45/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {46/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });47/******/ }48/******/ Object.defineProperty(exports, '__esModule', { value: true });49/******/ };50/******/51/******/ // create a fake namespace object52/******/ // mode & 1: value is a module id, require it53/******/ // mode & 2: merge all properties of value into the ns54/******/ // mode & 4: return value when already ns object55/******/ // mode & 8|1: behave like require56/******/ __webpack_require__.t = function(value, mode) {57/******/ if(mode & 1) value = __webpack_require__(value);58/******/ if(mode & 8) return value;59/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;60/******/ var ns = Object.create(null);61/******/ __webpack_require__.r(ns);62/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });63/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));64/******/ return ns;65/******/ };66/******/67/******/ // getDefaultExport function for compatibility with non-harmony modules68/******/ __webpack_require__.n = function(module) {69/******/ var getter = module && module.__esModule ?70/******/ function getDefault() { return module['default']; } :71/******/ function getModuleExports() { return module; };72/******/ __webpack_require__.d(getter, 'a', getter);73/******/ return getter;74/******/ };75/******/76/******/ // Object.prototype.hasOwnProperty.call77/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };78/******/79/******/ // __webpack_public_path__80/******/ __webpack_require__.p = "_content/Syncfusion.Blazor/scripts/";81/******/82/******/83/******/ // Load entry module and return exports84/******/ return __webpack_require__(__webpack_require__.s = "./bundles/sf-filemanager.js");85/******/ })86/************************************************************************/87/******/ ({88/***/ "./bundles/sf-filemanager.js":89/*!***********************************!*\90 !*** ./bundles/sf-filemanager.js ***!91 \***********************************/92/*! no exports provided */93/*! all exports used */94/***/ (function(module, __webpack_exports__, __webpack_require__) {95"use strict";96__webpack_require__.r(__webpack_exports__);97/* harmony import */ var _modules_sf_filemanager_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../modules/sf-filemanager.js */ "./modules/sf-filemanager.js");98/* harmony import */ var _modules_sf_filemanager_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_modules_sf_filemanager_js__WEBPACK_IMPORTED_MODULE_0__);99/***/ }),100/***/ "./modules/sf-filemanager.js":101/*!***********************************!*\102 !*** ./modules/sf-filemanager.js ***!103 \***********************************/104/*! no static exports found */105/***/ (function(module, exports) {106window.sfBlazor = window.sfBlazor || {};107window.sfBlazor.FileManager = function () {108 'use strict';109 var TOOLBAR_ID = '_toolbar';110 var ROW = 'e-row';111 var BLUR = 'e-blur';112 var HOVER = 'e-hover';113 var ACTIVE = 'e-active';114 var CLONE = 'e-fe-clone';115 var FULLROW = 'e-fullrow';116 var FOLDER = 'e-fe-folder';117 var LARGE_ICON = 'e-large-icon';118 var DROP_FILE = 'e-fe-drop-file';119 var LARGE_ICONS = 'e-large-icons';120 var DROP_FOLDER = 'e-fe-drop-folder';121 var TD_ELEMENT = 'TD';122 var FOCUSED = 'e-focused';123 var FOCUS = 'e-focus';124 var SfFileManager = function () {125 function SfFileManager(element, ref, properties) {126 this.element = element;127 this.properties = properties;128 this.treeviewEle = element.querySelector('.e-navigation .e-treeview');129 this.dotnetRef = ref;130 if (!sf.base.isNullOrUndefined(this.element)) {131 this.ctrlId = this.element.id; // eslint-disable-next-line132 this.element.blazor__instance = this;133 }134 this.bindKeyboardEvent();135 this.bindTreeViewKeyBoardEvent();136 this.wireEvents();137 }138 SfFileManager.prototype.unWireMobileEvents = function () {139 this.clickObj.destroy();140 };141 SfFileManager.prototype.wireMobileEvents = function () {142 var fileElement; // eslint-disable-next-line143 var proxy = this;144 if (this.properties.view === 'Details') {145 fileElement = this.element.querySelector('.e-view-container .e-grid .e-gridcontent');146 } else {147 fileElement = this.element.querySelector('.e-view-container .e-large-icons');148 }149 this.clickObj = new sf.base.Touch(fileElement, {150 tapHold: function tapHold(e) {151 var targetElement;152 var rowId;153 if (proxy.properties.view === 'Details') {154 targetElement = sf.base.closest(e.originalEvent.target, '.e-row');155 rowId = targetElement ? targetElement.getAttribute('aria-rowindex') : null;156 } else {157 targetElement = sf.base.closest(e.originalEvent.target, 'li.e-list-item');158 rowId = targetElement ? targetElement.getAttribute('data-uid') : null;159 }160 if (targetElement != null && rowId != null) {161 proxy.dotnetRef.invokeMethodAsync('ChangeMobileMultiSelection', rowId);162 }163 }164 });165 };166 SfFileManager.prototype.wireEvents = function () {167 var gridElem = this.element.querySelector('#' + this.properties.id + '_grid');168 if (gridElem) {169 sf.base.EventHandler.add(gridElem, 'dblclick', this.gridBlur, this);170 }171 };172 SfFileManager.prototype.unWireEvents = function () {173 var gridElem = this.element.querySelector('#' + this.properties.id + '_grid');174 if (gridElem) {175 sf.base.EventHandler.remove(gridElem, 'dblclick', this.gridBlur);176 }177 };178 SfFileManager.prototype.adjustHeight = function () {179 var toolbar = sf.base.select('#' + this.element.id + TOOLBAR_ID, this.element);180 var toolBarHeight = toolbar ? toolbar.offsetHeight : 0;181 var breadcrumbBarHeight = this.element.querySelector('.e-address').offsetHeight;182 var gridHeight = this.element.clientHeight - toolBarHeight - breadcrumbBarHeight;183 return sf.base.formatUnit(this.element.clientHeight - toolBarHeight) + ' ' + sf.base.formatUnit(gridHeight);184 };185 SfFileManager.prototype.createDragObj = function () {186 var _this = this;187 var dragEle;188 var dragTarget;189 if (this.properties.view === 'LargeIcons') {190 dragEle = this.element.querySelector('.e-large-icons ul');191 dragTarget = '.' + LARGE_ICON;192 } else {193 dragEle = this.element.querySelector('.e-grid.e-control');194 dragTarget = '.' + ROW;195 }196 if (this.properties.draggable) {197 if (this.dragObj) {198 this.dragObj.destroy();199 }200 if (dragEle) {201 this.dragObj = new sf.base.Draggable(dragEle, {202 cursorAt: {203 left: 44,204 top: 18205 },206 enableTailMode: true,207 dragArea: this.element,208 dragTarget: '.' + FULLROW,209 drag: this.draggingHandler.bind(this),210 dragStart: function dragStart(args) {211 _this.dragStartHandler(args);212 },213 dragStop: this.dragStopHandler.bind(this),214 enableAutoScroll: true,215 helper: this.dragHelper.bind(this)216 });217 }218 } else if (!this.properties.draggable) {219 this.dragObj.destroy();220 }221 if (this.treeviewEle) {222 if (this.treeDragObj) {223 this.treeDragObj.destroy();224 }225 this.treeDragObj = new sf.base.Draggable(this.treeviewEle, {226 cursorAt: {227 left: 44,228 top: 18229 },230 enableTailMode: true,231 dragArea: this.element,232 dragTarget: dragTarget,233 drag: this.draggingHandler.bind(this),234 dragStart: function dragStart(args) {235 _this.dragStartHandler(args);236 },237 dragStop: this.dragStopHandler.bind(this),238 enableAutoScroll: true,239 helper: this.dragHelper.bind(this)240 });241 } else if (!this.properties.draggable) {242 this.treeDragObj.destroy();243 }244 };245 SfFileManager.prototype.dragHelper = function (args) {246 var dragTarget = args.sender.target;247 this.getModule(dragTarget);248 if (this.activeModule === 'largeiconsview' || this.activeModule === 'navigationpane') {249 this.dragLi = sf.base.closest(dragTarget, '.e-list-item');250 } else if (this.activeModule === 'detailsview') {251 this.dragLi = sf.base.closest(dragTarget, 'tr.e-row');252 if (this.dragLi.getAttribute('aria-selected') == 'false') {253 dragTarget.click();254 }255 }256 if (!this.dragLi) {257 return null;258 }259 this.createVirtualDragElement();260 return this.virtualDragElement;261 };262 SfFileManager.prototype.createVirtualDragElement = function () {263 this.updateViewElement();264 this.updateDragValues();265 this.cloneIcon = sf.base.createElement('div', {266 className: 'e-fe-icon ' + this.dragType267 });268 this.cloneName = sf.base.createElement('div', {269 className: 'e-fe-name',270 innerHTML: this.dragName271 });272 var virtualEle = sf.base.createElement('div', {273 className: 'e-fe-content'274 });275 virtualEle.appendChild(this.cloneIcon);276 virtualEle.appendChild(this.cloneName);277 var ele = sf.base.createElement('div', {278 className: CLONE279 });280 ele.appendChild(virtualEle);281 if (this.dragCount > 1) {282 var badge = sf.base.createElement('span', {283 className: 'e-fe-count',284 innerHTML: this.dragCount.toString(10)285 });286 ele.appendChild(badge);287 }288 this.virtualDragElement = ele;289 this.element.appendChild(this.virtualDragElement);290 };291 SfFileManager.prototype.getModule = function (element) {292 if (element) {293 if (sf.base.closest(element, '.' + ROW)) {294 this.activeModule = 'detailsview';295 } else if (sf.base.closest(element, '.' + LARGE_ICON)) {296 this.activeModule = 'largeiconsview';297 } else {298 this.activeModule = 'navigationpane';299 }300 }301 };302 SfFileManager.prototype.getXYValue = function (e, direction) {303 var touchList = e.changedTouches;304 var value;305 if (direction === 'X') {306 value = touchList ? touchList[0].clientX : e.clientX;307 } else {308 value = touchList ? touchList[0].clientY : e.clientY;309 }310 if (!value && e.type === 'focus' && e.target) {311 var rect = e.target.getBoundingClientRect();312 value = rect ? direction === 'X' ? rect.left : rect.top : null;313 }314 return Math.ceil(value);315 };316 SfFileManager.prototype.removeDestroyElement = function () {317 this.dragObj.intDestroy(this.dragStartArgs.event);318 this.dragCancel();319 };320 SfFileManager.prototype.TriggerDragEvent = function (cancel) {321 if (cancel) {322 this.removeDestroyElement();323 }324 };325 SfFileManager.prototype.UpdateGridFocus = function (index) {326 if (this.properties.view == "Details") {327 this.updateViewElement();328 var fItem = sf.base.select('.' + FOCUSED, this.viewElem);329 var itemElement = this.viewElem.querySelector('[aria-rowindex="' + index.toString() + '"]');330 if (fItem) {331 fItem.removeAttribute('tabindex');332 sf.base.removeClass([fItem], [FOCUS, FOCUSED]);333 }334 if (!sf.base.isNullOrUndefined(itemElement)) {335 this.viewElem.setAttribute('tabindex', '-1');336 itemElement.setAttribute('tabindex', '0');337 sf.base.addClass([itemElement], [FOCUS, FOCUSED]);338 }339 }340 };341 SfFileManager.prototype.TriggerDragStartEvent = function (cancel) {342 if (cancel) {343 this.removeDestroyElement();344 } else {345 this.dragStartArgs.bindEvents(this.dragStartArgs.dragElement);346 var dragArgs = this.dragStartArgs;347 dragArgs.cancel = false;348 this.getModule(this.dragStartArgs.target);349 var rootId = this.element.querySelector('.e-navigation .e-treeview ul li').getAttribute('data-uid');350 if (!this.properties.draggable || this.activeModule === 'navigationpane' && sf.base.closest(this.dragStartArgs.target, 'li').getAttribute('data-uid') === rootId) {351 dragArgs.cancel = true;352 }353 this.removeBlur();354 if (dragArgs.cancel) {355 this.removeDestroyElement();356 } else if (!dragArgs.cancel) {357 this.updateViewElement();358 this.blurActive();359 this.updateDragValues();360 }361 }362 };363 SfFileManager.prototype.dragStartHandler = function (args) {364 this.dragStartArgs = args;365 this.UpdateXY(args);366 this.dotnetRef.invokeMethodAsync('DragStartCall', this.dragLeft, this.dragTop);367 };368 SfFileManager.prototype.blurActive = function () {369 var i = 0;370 var activeElements = this.viewElem.querySelectorAll('.' + ACTIVE);371 while (i < activeElements.length) {372 activeElements[i].classList.add(BLUR);373 i++;374 }375 };376 SfFileManager.prototype.updateViewElement = function () {377 if (this.properties.view === 'LargeIcons') {378 this.viewElem = this.element.querySelector('.' + LARGE_ICONS);379 } else {380 this.viewElem = this.element.querySelector('.e-gridcontent');381 }382 };383 SfFileManager.prototype.getIconClass = function (element) {384 var iconValue = '';385 iconValue = element.querySelector('.e-list-img') ? 'e-fe-image' : element.querySelector('.e-list-icon').classList[1];386 return iconValue;387 };388 SfFileManager.prototype.updateDragValues = function () {389 var activeElements;390 if (this.activeModule === 'largeiconsview') {391 activeElements = this.viewElem.querySelectorAll('.' + ACTIVE);392 this.dragName = activeElements.length > 0 ? activeElements[0].querySelector('.e-list-text').textContent : '';393 this.dragType = activeElements.length > 0 ? this.getIconClass(activeElements[0]) : '';394 } else if (this.activeModule === 'detailsview') {395 activeElements = this.viewElem.querySelectorAll('tr[aria-selected="true"]');396 if (activeElements != null && activeElements.length > 0) {397 this.dragName = activeElements.length > 0 ? activeElements[0].querySelector('.e-fe-text').textContent : '';398 this.dragType = activeElements.length > 0 ? activeElements[0].querySelector('.e-fe-icon').classList[1] : '';399 }400 } else if (this.activeModule === 'navigationpane') {401 this.dragName = this.dragLi.querySelector('.e-list-text').textContent;402 this.dragType = 'e-fe-folder';403 }404 if (activeElements != null) {405 this.dragCount = activeElements.length;406 }407 };408 SfFileManager.prototype.getTargetModule = function (element) {409 if (element) {410 if (sf.base.closest(element, '.e-gridcontent')) {411 this.targetModule = 'detailsview';412 } else if (sf.base.closest(element, '.' + LARGE_ICONS)) {413 this.targetModule = 'largeiconsview';414 } else if (element.classList.contains('e-fullrow') || element.classList.contains('e-icon-expandable')) {415 this.targetModule = 'navigationpane';416 } else if (sf.base.closest(element, '.e-address-list-item')) {417 this.targetModule = 'breadcrumbbar';418 } else {419 this.targetModule = '';420 }421 }422 };423 SfFileManager.prototype.draggingHandler = function (args) {424 var canDrop = false;425 this.updateDragValues();426 this.cloneIcon.setAttribute('class', 'e-fe-icon ' + this.dragType);427 this.cloneName.innerHTML = this.dragName;428 var node = null;429 this.blurActive();430 this.getTargetModule(args.target);431 this.removeDropTarget();432 this.removeBlur('hover');433 if (this.targetModule === 'navigationpane') {434 node = sf.base.closest(args.target, 'li');435 node.classList.add(HOVER, DROP_FOLDER);436 canDrop = true;437 } else if (this.targetModule === 'detailsview') {438 node = sf.base.closest(args.target, 'tr');439 if (node && node.querySelector('.' + FOLDER) && !node.classList.contains(BLUR)) {440 node.classList.add(DROP_FOLDER);441 } else if (node && !node.querySelector('.' + FOLDER) && !node.classList.contains(BLUR)) {442 node.classList.add(DROP_FILE);443 }444 canDrop = true;445 } else if (this.targetModule === 'largeiconsview') {446 node = sf.base.closest(args.target, 'li');447 if (node && node.querySelector('.' + FOLDER) && !node.classList.contains(BLUR)) {448 node.classList.add(HOVER, DROP_FOLDER);449 }450 canDrop = true;451 } else if (this.targetModule === 'breadcrumbbar') {452 canDrop = true;453 }454 this.element.classList.remove('e-fe-drop', 'e-no-drop');455 this.element.classList.add(canDrop ? 'e-fe-drop' : 'e-no-drop');456 this.UpdateXY(args);457 this.dotnetRef.invokeMethodAsync('DraggingCall', this.dragLeft, this.dragTop);458 };459 SfFileManager.prototype.UpdateXY = function (args) {460 this.dragLeft = this.getXYValue(args.event, 'X');461 this.dragTop = this.getXYValue(args.event, 'Y');462 };463 SfFileManager.prototype.dragStopHandler = function (args) {464 var dragArgs = args;465 var isLayout = false;466 dragArgs.cancel = false;467 this.removeDropTarget();468 this.element.classList.remove('e-fe-drop', 'e-no-drop');469 this.dragCancel();470 this.getTargetModule(args.target);471 if (this.targetModule === '' && args.target.classList.contains('e-view-container')) {472 isLayout = true;473 }474 this.removeBlur('hover');475 var targetElement;476 var dataValue;477 if (this.targetModule === 'largeiconsview' || this.targetModule === 'navigationpane' || this.targetModule === 'breadcrumbbar') {478 targetElement = sf.base.closest(args.target, 'li');479 var attr = this.targetModule === 'breadcrumbbar' ? 'data-utext' : 'data-uid';480 dataValue = targetElement ? targetElement.getAttribute(attr) : null;481 } else if (this.targetModule === 'detailsview') {482 targetElement = sf.base.closest(args.target, 'tr');483 dataValue = targetElement ? targetElement.getAttribute('aria-rowindex') : null;484 }485 if (dataValue == null) {486 isLayout = true;487 }488 var treeid = this.treeviewEle ? this.dragLi.getAttribute('data-uid') : null;489 if (this.activeModule === 'detailsview') {490 treeid = this.dragLi.getAttribute('aria-rowindex');491 }492 this.UpdateXY(args); // eslint:disable-next-line493 this.dotnetRef.invokeMethodAsync('DragStopCall', treeid, dataValue, this.targetModule, this.activeModule, isLayout, this.dragLeft, this.dragTop);494 this.dragCount = 0;495 this.dragName = '';496 this.dragType = '';497 };498 SfFileManager.prototype.dragCancel = function () {499 this.removeBlur();500 var virtualEle = sf.base.select('.' + CLONE, this.element);501 if (virtualEle) {502 sf.base.detach(virtualEle);503 }504 };505 SfFileManager.prototype.gridBlur = function (e) {506 var target = e.target;507 if (target.tagName === 'TD') {508 target.blur();509 }510 };511 SfFileManager.prototype.removeItemClass = function (value) {512 var ele = this.element.querySelectorAll('.' + value);513 for (var i = 0; i < ele.length; i++) {514 ele[i].classList.remove(value);515 }516 };517 SfFileManager.prototype.removeDropTarget = function () {518 this.removeItemClass(DROP_FOLDER);519 this.removeItemClass(DROP_FILE);520 };521 SfFileManager.prototype.removeBlur = function (hover) {522 var blurEle = !hover ? this.element.querySelectorAll('.' + BLUR) : this.element.querySelectorAll('.' + HOVER);523 var i = 0;524 while (i < blurEle.length) {525 blurEle[i].classList.remove(!hover ? BLUR : HOVER);526 i++;527 }528 };529 SfFileManager.prototype.bindTreeViewKeyBoardEvent = function () {530 var treeviewElem = this.element.querySelector(".e-navigation");531 var keyConfigs = {532 altEnter: 'alt+enter',533 esc: 'escape',534 del: 'delete',535 ctrlX: 'ctrl+x',536 ctrlC: 'ctrl+c',537 ctrlV: 'ctrl+v',538 f2: 'f2',539 shiftF10: 'shift+f10'540 };541 if (treeviewElem) {542 var keyboardDownModule = new sf.base.KeyboardEvents(treeviewElem, {543 keyAction: this.treeviewKeydownHandler.bind(this),544 keyConfigs: keyConfigs,545 eventName: 'keydown'546 });547 }548 };549 SfFileManager.prototype.bindKeyboardEvent = function () {550 if (this.properties.view === 'Details') {551 var keyConfigs = {552 altEnter: 'alt+enter',553 esc: 'escape',554 tab: 'tab',555 moveDown: 'downarrow',556 ctrlEnd: 'ctrl+end',557 ctrlHome: 'ctrl+home',558 ctrlDown: 'ctrl+downarrow',559 ctrlLeft: 'ctrl+leftarrow',560 ctrlRight: 'ctrl+rightarrow',561 shiftEnd: 'shift+end',562 shiftHome: 'shift+home',563 shiftDown: 'shift+downarrow',564 shiftUp: 'shift+uparrow',565 ctrlUp: 'ctrl+uparrow',566 csEnd: 'ctrl+shift+end',567 csHome: 'ctrl+shift+home',568 csDown: 'ctrl+shift+downarrow',569 csUp: 'ctrl+shift+uparrow',570 space: 'space',571 ctrlSpace: 'ctrl+space',572 shiftSpace: 'shift+space',573 csSpace: 'ctrl+shift+space',574 end: 'end',575 home: 'home',576 moveUp: 'uparrow',577 del: 'delete',578 ctrlX: 'ctrl+x',579 ctrlC: 'ctrl+c',580 ctrlV: 'ctrl+v',581 ctrlShiftN: 'ctrl+shift+n',582 shiftdel: 'shift+delete',583 ctrlD: 'ctrl+d',584 f2: 'f2',585 ctrlA: 'ctrl+a',586 enter: 'enter'587 };588 var gridElem = this.element.querySelector('#' + this.properties.id + '_grid');589 if (gridElem) {590 this.bindKeyboardEvents(keyConfigs, gridElem);591 }592 } else if (this.properties.view === 'LargeIcons') {593 var keyConfigs = {594 altN: 'alt+n',595 f5: 'f5',596 ctrlShift1: 'ctrl+shift+1',597 ctrlShift2: 'ctrl+shift+2',598 ctrlU: 'ctrl+u',599 end: 'end',600 home: 'home',601 tab: 'tab',602 moveDown: 'downarrow',603 moveLeft: 'leftarrow',604 moveRight: 'rightarrow',605 moveUp: 'uparrow',606 ctrlEnd: 'ctrl+end',607 ctrlHome: 'ctrl+home',608 ctrlDown: 'ctrl+downarrow',609 ctrlLeft: 'ctrl+leftarrow',610 ctrlRight: 'ctrl+rightarrow',611 ctrlUp: 'ctrl+uparrow',612 shiftEnd: 'shift+end',613 shiftHome: 'shift+home',614 shiftDown: 'shift+downarrow',615 shiftLeft: 'shift+leftarrow',616 shiftRight: 'shift+rightarrow',617 shiftUp: 'shift+uparrow',618 csEnd: 'ctrl+shift+end',619 csHome: 'ctrl+shift+home',620 csDown: 'ctrl+shift+downarrow',621 csLeft: 'ctrl+shift+leftarrow',622 csRight: 'ctrl+shift+rightarrow',623 csUp: 'ctrl+shift+uparrow',624 space: 'space',625 ctrlSpace: 'ctrl+space',626 shiftSpace: 'shift+space',627 csSpace: 'ctrl+shift+space',628 ctrlA: 'ctrl+a',629 enter: 'enter',630 altEnter: 'alt+enter',631 esc: 'escape',632 del: 'delete',633 ctrlX: 'ctrl+x',634 ctrlC: 'ctrl+c',635 ctrlV: 'ctrl+v',636 f2: 'f2',637 shiftdel: 'shift+delete',638 back: 'backspace',639 ctrlD: 'ctrl+d'640 };641 var largeIcons = this.element.querySelector('#' + this.properties.id + '_largeicons');642 if (largeIcons) {643 this.bindKeyboardEvents(keyConfigs, largeIcons);644 }645 }646 };647 SfFileManager.prototype.bindKeyboardEvents = function (keyConfigs, element) {648 this.keyboardModule = new sf.base.KeyboardEvents(element, {649 keyAction: this.keyupHandler.bind(this),650 keyConfigs: keyConfigs,651 eventName: 'keyup'652 });653 this.keyboardDownModule = new sf.base.KeyboardEvents(element, {654 keyAction: this.keydownHandler.bind(this),655 keyConfigs: keyConfigs,656 eventName: 'keydown'657 });658 };659 SfFileManager.prototype.getRowValue = function () {660 var largeIconEle = this.element.querySelector('#' + this.element.id + '_largeicons');661 var itemList = largeIconEle.querySelectorAll('.e-list-item');662 var perRow = 1;663 if (itemList) {664 for (var i = 0, len = itemList.length - 1; i < len; i++) {665 if (itemList[i].getBoundingClientRect().top === itemList[i + 1].getBoundingClientRect().top) {666 perRow++;667 } else {668 break;669 }670 }671 }672 return perRow;673 }; // eslint-disable-next-line674 SfFileManager.prototype.keyupHandler = function (e) {675 e.preventDefault();676 var perRow = 0;677 if (this.properties.view === 'LargeIcons') {678 perRow = this.getRowValue();679 }680 var action = e.action;681 var actionValue = null;682 switch (action) {683 case 'altN':684 actionValue = 'NewFolder';685 break;686 case 'f5':687 actionValue = 'Refresh';688 break;689 case 'ctrlShift1':690 actionValue = 'DetailsView';691 break;692 case 'ctrlShift2':693 actionValue = 'LargeIconsView';694 break;695 case 'ctrlU':696 actionValue = 'Upload';697 break;698 case 'altEnter':699 actionValue = 'Details';700 break;701 case 'del':702 case 'shiftdel':703 actionValue = 'Delete';704 break;705 case 'enter':706 actionValue = 'Open';707 break;708 case 'ctrlC':709 actionValue = 'Copy';710 break;711 case 'ctrlV':712 actionValue = 'Paste';713 break;714 case 'ctrlX':715 actionValue = 'Cut';716 break;717 case 'ctrlD':718 actionValue = 'Download';719 break;720 case 'f2':721 actionValue = 'Rename';722 break;723 case 'ctrlA':724 actionValue = 'SelectAll';725 break;726 case 'home':727 actionValue = 'Home';728 break;729 case 'end':730 actionValue = 'End';731 break;732 case 'moveDown':733 actionValue = 'MoveDown_' + perRow.toString();734 break;735 case 'moveLeft':736 actionValue = 'MoveLeft';737 break;738 case 'moveRight':739 actionValue = 'MoveRight';740 break;741 case 'moveUp':742 actionValue = 'MoveUp_' + perRow.toString();743 break;744 case 'esc':745 actionValue = 'Esc';746 break;747 case 'ctrlLeft':748 actionValue = 'ControlLeft';749 break;750 case 'ctrlRight':751 actionValue = 'ControlRight';752 break;753 case 'ctrlEnd':754 actionValue = 'ControlEnd';755 break;756 case 'ctrlHome':757 actionValue = 'ControlHome';758 break;759 case 'shiftHome':760 actionValue = 'ShiftHome';761 break;762 case 'shiftEnd':763 actionValue = 'ShiftEnd';764 break;765 case 'shiftLeft':766 actionValue = 'ShiftLeft';767 break;768 case 'shiftRight':769 actionValue = 'ShiftRight';770 break;771 case 'csHome':772 actionValue = 'ControlShiftHome';773 break;774 case 'csEnd':775 actionValue = 'ControlShiftEnd';776 break;777 case 'csLeft':778 actionValue = 'ControlShiftLeft';779 break;780 case 'csRight':781 actionValue = 'ControlShiftRight';782 break;783 case 'ctrlUp':784 actionValue = 'ControlUp_' + perRow.toString();785 break;786 case 'shiftUp':787 actionValue = 'ShiftUp_' + perRow.toString();788 break;789 case 'csUp':790 actionValue = 'ControlShiftUp_' + perRow.toString();791 break;792 case 'ctrlDown':793 actionValue = 'ControlDown_' + perRow.toString();794 break;795 case 'shiftDown':796 actionValue = 'ShiftDown_' + perRow.toString();797 break;798 case 'csDown':799 actionValue = 'ControlShiftDown_' + perRow.toString();800 break;801 case 'space':802 actionValue = 'Space';803 break;804 case 'csSpace':805 actionValue = 'ControlShiftSpace';806 break;807 case 'shiftSpace':808 actionValue = 'ShiftSpace';809 break;810 case 'ctrlSpace':811 actionValue = 'ControlSpace';812 break;813 case 'tab':814 actionValue = 'Tab';815 break;816 }817 if (actionValue) {818 this.dotnetRef.invokeMethodAsync('PerformKeyboardAction', actionValue);819 }820 };821 SfFileManager.prototype.treeviewKeydownHandler = function (e) {822 e.preventDefault();823 if (this.element.querySelector('.e-dialog.e-popup-open') == null) {824 var action = e.action;825 var actionValue = null;826 switch (action) {827 case 'altEnter':828 actionValue = 'Details';829 break;830 case 'esc':831 actionValue = 'Esc';832 break;833 case 'del':834 actionValue = 'Delete';835 break;836 case 'ctrlC':837 actionValue = 'Copy';838 break;839 case 'ctrlV':840 actionValue = 'Paste';841 break;842 case 'ctrlX':843 actionValue = 'Cut';844 break;845 case 'shiftF10':846 actionValue = 'Download';847 break;848 case 'f2':849 actionValue = 'Rename';850 break;851 }852 if (actionValue) {853 this.dotnetRef.invokeMethodAsync('TreeViewPerformKeyboardAction', actionValue);854 }855 }856 };857 SfFileManager.prototype.keydownHandler = function (e) {858 if (this.element.querySelector('.e-dialog.e-popup-open') == null) {859 switch (e.action) {860 case 'end':861 case 'home':862 case 'space':863 case 'tab':864 case 'ctrlSpace':865 case 'shiftSpace':866 case 'csSpace':867 case 'ctrlA':868 case 'enter':869 case 'altEnter':870 case 'ctrlEnd':871 case 'shiftEnd':872 case 'csEnd':873 case 'ctrlHome':874 case 'shiftHome':875 case 'csHome':876 case 'ctrlDown':877 case 'shiftDown':878 case 'csDown':879 case 'ctrlLeft':880 case 'shiftLeft':881 case 'csLeft':882 case 'esc':883 case 'del':884 case 'shiftdel':885 case 'ctrlC':886 case 'ctrlV':887 case 'ctrlX':888 case 'f2':889 case 'moveDown':890 case 'moveUp':891 case 'ctrlD':892 case 'altN':893 case 'f5':894 case 'ctrlShift1':895 case 'ctrlShift2':896 case 'ctrlU':897 e.preventDefault();898 break;899 default:900 break;901 }902 }903 };904 return SfFileManager;905 }(); // eslint:disable-next-line906 var FileManager = {907 initialize: function initialize(element, dotnetRef, properties, isMobile) {908 new SfFileManager(element, dotnetRef, properties);909 if (properties.draggable) {910 element.blazor__instance.createDragObj();911 }912 element.blazor__instance.isMobile = isMobile;913 return element.blazor__instance.adjustHeight();914 },915 dragStartActionContinue: function dragStartActionContinue(element, cancel) {916 if (element) {917 element.blazor__instance.TriggerDragStartEvent(cancel);918 }919 },920 wireMobileEvents: function wireMobileEvents(element) {921 element.blazor__instance.wireMobileEvents();922 },923 dragActionContinue: function dragActionContinue(element, cancel) {924 if (element) {925 element.blazor__instance.TriggerDragEvent(cancel);926 }927 },928 updateProperties: function updateProperties(element, properties) {929 element.blazor__instance.properties = properties;930 element.blazor__instance.unWireEvents();931 element.blazor__instance.wireEvents();932 if (element.blazor__instance.isMobile) {933 element.blazor__instance.unWireMobileEvents();934 element.blazor__instance.wireMobileEvents();935 }936 return element.blazor__instance.adjustHeight();937 },938 uploadOpen: function uploadOpen(element, id) {939 var uploadElement = element.querySelector('#' + id);940 if (uploadElement) {941 uploadElement.click();942 }943 },944 triggerBlur: function triggerBlur(element) {945 if (element && document.activeElement.tagName === TD_ELEMENT) {946 document.activeElement.blur();947 }948 },949 updateFocus: function updateFocus(element, index) {950 if (element) {951 element.blazor__instance.UpdateGridFocus(index);952 }953 },954 updateView: function updateView(element, view) {955 if (element) {956 element.blazor__instance.properties.view = view;957 element.blazor__instance.keyboardDownModule.destroy();958 element.blazor__instance.keyboardModule.destroy();959 element.blazor__instance.bindKeyboardEvent();960 if (element.blazor__instance.isMobile) {961 element.blazor__instance.unWireMobileEvents();962 element.blazor__instance.wireMobileEvents();963 }964 }965 if (element.blazor__instance.properties.draggable) {966 element.blazor__instance.createDragObj();967 }968 },969 updateGridRow: function updateGridRow(gridEle, index) {970 if (gridEle) {971 var selectedElements = gridEle.querySelectorAll('tr.e-row[tabindex="0"]');972 for (var i = 0; i < selectedElements.length; i++) {973 selectedElements[i].removeAttribute('tabindex');974 }975 var element1 = gridEle.querySelector('[aria-rowindex="' + index + '"]');976 if (element1) {977 element1.setAttribute('tabindex', '0');978 element1.focus();979 }980 }981 },982 // eslint-disable-next-line983 saveFile: function saveFile(filename, url, element) {984 // eslint-disable-next-line985 var data = {986 'action': 'download',987 'path': filename.path,988 'names': filename.names,989 'data': filename.data990 };991 var form = sf.base.createElement('form', {992 id: element.id + '_downloadForm',993 attrs: {994 action: url,995 method: 'post',996 name: 'downloadForm',997 'download': ''998 }999 });1000 var input = sf.base.createElement('input', {1001 id: element.id + '_hiddenForm',1002 attrs: {1003 name: 'downloadInput',1004 value: JSON.stringify(data),1005 type: 'hidden'1006 }1007 });1008 form.appendChild(input);1009 document.body.appendChild(form);1010 document.forms.namedItem('downloadForm').submit();1011 document.body.removeChild(form);1012 },1013 getTargetElement: function getTargetElement(view, x, y) {1014 var element = document.elementFromPoint(x, y);1015 var targetElement;1016 var menuModel;1017 var treeElement = sf.base.closest(element, 'li[role="treeitem"]');1018 if (!element) {1019 menuModel = {1020 IsFile: false,1021 RowIndex: null,1022 IsFolder: false,1023 IsLayout: false,1024 IsTree: false1025 };1026 } else {1027 if (element.classList.contains('e-yscroll') && element.classList.contains('e-content') || element.classList.contains('e-list-parent') && element.classList.contains('e-ul') || element.classList.contains('e-view-container') || element.classList.contains('e-large-icons') || sf.base.closest(element, '.e-empty.e-view-container')) {1028 menuModel = {1029 IsFile: false,1030 RowIndex: null,1031 IsFolder: false,1032 IsLayout: true,1033 IsTree: false1034 };1035 } else if (treeElement) {1036 var dataid = parseInt(treeElement.getAttribute('data-uid'), 10);1037 menuModel = {1038 IsFile: false,1039 RowIndex: dataid,1040 IsFolder: true,1041 IsLayout: false,1042 IsTree: true1043 };1044 } else {1045 if (view === 'Details') {1046 targetElement = sf.base.closest(element, 'tr');1047 var isFile = !targetElement.querySelector('.e-fe-grid-icon .e-fe-icon').classList.contains('e-fe-folder');1048 var rowIndex = parseInt(targetElement.getAttribute('aria-rowindex'), 10);1049 menuModel = {1050 IsFile: isFile,1051 RowIndex: rowIndex,1052 IsFolder: !isFile,1053 IsLayout: false,1054 IsTree: false1055 };1056 } else if (view === 'LargeIcons') {1057 targetElement = sf.base.closest(element, 'li');1058 var iconEle = targetElement.querySelector('.e-list-icon');1059 var isFile = iconEle ? !iconEle.classList.contains('e-fe-folder') : true;1060 var rowIndex = parseInt(targetElement.getAttribute('data-uid'), 10);1061 menuModel = {1062 IsFile: isFile,1063 RowIndex: rowIndex,1064 IsFolder: !isFile,1065 IsLayout: false,1066 IsTree: false1067 };1068 }1069 }1070 }1071 return menuModel;1072 }1073 };1074 return FileManager;1075}();1076/***/ })...

Full Screen

Full Screen

sf-filemanager.js

Source:sf-filemanager.js Github

copy

Full Screen

1window.sfBlazor = window.sfBlazor || {};2window.sfBlazor.FileManager = (function () {3'use strict';4var TOOLBAR_ID = '_toolbar';5var ROW = 'e-row';6var BLUR = 'e-blur';7var HOVER = 'e-hover';8var ACTIVE = 'e-active';9var CLONE = 'e-fe-clone';10var FULLROW = 'e-fullrow';11var FOLDER = 'e-fe-folder';12var LARGE_ICON = 'e-large-icon';13var DROP_FILE = 'e-fe-drop-file';14var LARGE_ICONS = 'e-large-icons';15var DROP_FOLDER = 'e-fe-drop-folder';16var TD_ELEMENT = 'TD';17var FOCUSED = 'e-focused';18var FOCUS = 'e-focus';19var SfFileManager = /** @class */ (function () {20 function SfFileManager(element, ref, properties) {21 this.element = element;22 this.properties = properties;23 this.treeviewEle = element.querySelector('.e-navigation .e-treeview');24 this.dotnetRef = ref;25 if (!sf.base.isNullOrUndefined(this.element)) {26 this.ctrlId = this.element.id;27 // eslint-disable-next-line28 this.element.blazor__instance = this;29 }30 this.bindKeyboardEvent();31 this.bindTreeViewKeyBoardEvent();32 this.wireEvents();33 }34 SfFileManager.prototype.unWireMobileEvents = function () {35 this.clickObj.destroy();36 };37 SfFileManager.prototype.wireMobileEvents = function () {38 var fileElement;39 // eslint-disable-next-line40 var proxy = this;41 if (this.properties.view === 'Details') {42 fileElement = this.element.querySelector('.e-view-container .e-grid .e-gridcontent');43 }44 else {45 fileElement = this.element.querySelector('.e-view-container .e-large-icons');46 }47 this.clickObj = new sf.base.Touch(fileElement, {48 tapHold: function (e) {49 var targetElement;50 var rowId;51 if (proxy.properties.view === 'Details') {52 targetElement = sf.base.closest(e.originalEvent.target, '.e-row');53 rowId = targetElement ? targetElement.getAttribute('aria-rowindex') : null;54 }55 else {56 targetElement = sf.base.closest(e.originalEvent.target, 'li.e-list-item');57 rowId = targetElement ? targetElement.getAttribute('data-uid') : null;58 }59 if (targetElement != null && rowId != null) {60 proxy.dotnetRef.invokeMethodAsync('ChangeMobileMultiSelection', rowId);61 }62 }63 });64 };65 SfFileManager.prototype.wireEvents = function () {66 var gridElem = this.element.querySelector('#' + this.properties.id + '_grid');67 if (gridElem) {68 sf.base.EventHandler.add(gridElem, 'dblclick', this.gridBlur, this);69 }70 };71 SfFileManager.prototype.unWireEvents = function () {72 var gridElem = this.element.querySelector('#' + this.properties.id + '_grid');73 if (gridElem) {74 sf.base.EventHandler.remove(gridElem, 'dblclick', this.gridBlur);75 }76 };77 SfFileManager.prototype.adjustHeight = function () {78 var toolbar = sf.base.select('#' + this.element.id + TOOLBAR_ID, this.element);79 var toolBarHeight = toolbar ? toolbar.offsetHeight : 0;80 var breadcrumbBarHeight = this.element.querySelector('.e-address').offsetHeight;81 var gridHeight = this.element.clientHeight - toolBarHeight - breadcrumbBarHeight;82 return sf.base.formatUnit(this.element.clientHeight - toolBarHeight) + ' ' + sf.base.formatUnit(gridHeight);83 };84 SfFileManager.prototype.createDragObj = function () {85 var _this = this;86 var dragEle;87 var dragTarget;88 if (this.properties.view === 'LargeIcons') {89 dragEle = this.element.querySelector('.e-large-icons ul');90 dragTarget = '.' + LARGE_ICON;91 }92 else {93 dragEle = this.element.querySelector('.e-grid.e-control');94 dragTarget = '.' + ROW;95 }96 if (this.properties.draggable) {97 if (this.dragObj) {98 this.dragObj.destroy();99 }100 if (dragEle) {101 this.dragObj = new sf.base.Draggable(dragEle, {102 cursorAt: { left: 44, top: 18 },103 enableTailMode: true,104 dragArea: this.element,105 dragTarget: '.' + FULLROW,106 drag: this.draggingHandler.bind(this),107 dragStart: function (args) {108 _this.dragStartHandler(args);109 },110 dragStop: this.dragStopHandler.bind(this),111 enableAutoScroll: true,112 helper: this.dragHelper.bind(this)113 });114 }115 }116 else if (!this.properties.draggable) {117 this.dragObj.destroy();118 }119 if (this.treeviewEle) {120 if (this.treeDragObj) {121 this.treeDragObj.destroy();122 }123 this.treeDragObj = new sf.base.Draggable(this.treeviewEle, {124 cursorAt: { left: 44, top: 18 },125 enableTailMode: true,126 dragArea: this.element,127 dragTarget: dragTarget,128 drag: this.draggingHandler.bind(this),129 dragStart: function (args) {130 _this.dragStartHandler(args);131 },132 dragStop: this.dragStopHandler.bind(this),133 enableAutoScroll: true,134 helper: this.dragHelper.bind(this)135 });136 }137 else if (!this.properties.draggable) {138 this.treeDragObj.destroy();139 }140 };141 SfFileManager.prototype.dragHelper = function (args) {142 var dragTarget = args.sender.target;143 this.getModule(dragTarget);144 if (this.activeModule === 'largeiconsview' || this.activeModule === 'navigationpane') {145 this.dragLi = sf.base.closest(dragTarget, '.e-list-item');146 }147 else if (this.activeModule === 'detailsview') {148 this.dragLi = sf.base.closest(dragTarget, 'tr.e-row');149 if (this.dragLi.getAttribute('aria-selected') == 'false') {150 dragTarget.click();151 }152 }153 if (!this.dragLi) {154 return null;155 }156 this.createVirtualDragElement();157 return this.virtualDragElement;158 };159 SfFileManager.prototype.createVirtualDragElement = function () {160 this.updateViewElement();161 this.updateDragValues();162 this.cloneIcon = sf.base.createElement('div', {163 className: 'e-fe-icon ' + this.dragType164 });165 this.cloneName = sf.base.createElement('div', {166 className: 'e-fe-name',167 innerHTML: this.dragName168 });169 var virtualEle = sf.base.createElement('div', {170 className: 'e-fe-content'171 });172 virtualEle.appendChild(this.cloneIcon);173 virtualEle.appendChild(this.cloneName);174 var ele = sf.base.createElement('div', {175 className: CLONE176 });177 ele.appendChild(virtualEle);178 if (this.dragCount > 1) {179 var badge = sf.base.createElement('span', {180 className: 'e-fe-count',181 innerHTML: (this.dragCount).toString(10)182 });183 ele.appendChild(badge);184 }185 this.virtualDragElement = ele;186 this.element.appendChild(this.virtualDragElement);187 };188 SfFileManager.prototype.getModule = function (element) {189 if (element) {190 if (sf.base.closest(element, '.' + ROW)) {191 this.activeModule = 'detailsview';192 }193 else if (sf.base.closest(element, '.' + LARGE_ICON)) {194 this.activeModule = 'largeiconsview';195 }196 else {197 this.activeModule = 'navigationpane';198 }199 }200 };201 SfFileManager.prototype.getXYValue = function (e, direction) {202 var touchList = e.changedTouches;203 var value;204 if (direction === 'X') {205 value = touchList ? touchList[0].clientX : e.clientX;206 }207 else {208 value = touchList ? touchList[0].clientY : e.clientY;209 }210 if (!value && e.type === 'focus' && e.target) {211 var rect = e.target.getBoundingClientRect();212 value = rect ? (direction === 'X' ? rect.left : rect.top) : null;213 }214 return Math.ceil(value);215 };216 SfFileManager.prototype.removeDestroyElement = function () {217 this.dragObj.intDestroy(this.dragStartArgs.event);218 this.dragCancel();219 };220 SfFileManager.prototype.TriggerDragEvent = function (cancel) {221 if (cancel) {222 this.removeDestroyElement();223 }224 };225 SfFileManager.prototype.UpdateGridFocus = function (index) {226 if (this.properties.view == "Details") {227 this.updateViewElement();228 var focusedItem = this.viewElem.querySelectorAll(".e-focused");229 var itemElement = this.viewElem.querySelector('[aria-rowindex="' + index.toString() + '"]');230 if (focusedItem) {231 for (var i = 0; i < focusedItem.length; i++) {232 if (sf.base.closest(focusedItem[i], 'tr').getAttribute('aria-rowindex') != index.toString()) {233 sf.base.closest(focusedItem[i], 'tr').removeAttribute('tabindex');234 sf.base.removeClass([focusedItem[i]], [FOCUS, FOCUSED]);235 }236 }237 }238 if (!sf.base.isNullOrUndefined(itemElement)) {239 this.viewElem.setAttribute('tabindex', '-1');240 itemElement.setAttribute('tabindex', '0');241 sf.base.addClass([itemElement], [FOCUS, FOCUSED]);242 }243 }244 };245 SfFileManager.prototype.TriggerDragStartEvent = function (cancel) {246 if (cancel) {247 this.removeDestroyElement();248 }249 else {250 this.dragStartArgs.bindEvents(this.dragStartArgs.dragElement);251 var dragArgs = this.dragStartArgs;252 dragArgs.cancel = false;253 this.getModule(this.dragStartArgs.target);254 var rootId = this.element.querySelector('.e-navigation .e-treeview ul li').getAttribute('data-uid');255 if (!this.properties.draggable || ((this.activeModule === 'navigationpane') &&256 (sf.base.closest(this.dragStartArgs.target, 'li').getAttribute('data-uid') === rootId))) {257 dragArgs.cancel = true;258 }259 this.removeBlur();260 if (dragArgs.cancel) {261 this.removeDestroyElement();262 }263 else if (!dragArgs.cancel) {264 this.updateViewElement();265 this.blurActive();266 this.updateDragValues();267 }268 }269 };270 SfFileManager.prototype.dragStartHandler = function (args) {271 this.dragStartArgs = args;272 this.UpdateXY(args);273 this.dotnetRef.invokeMethodAsync('DragStartCall', this.dragLeft, this.dragTop);274 };275 SfFileManager.prototype.blurActive = function () {276 var i = 0;277 var activeElements = this.viewElem.querySelectorAll('.' + ACTIVE);278 while (i < activeElements.length) {279 activeElements[i].classList.add(BLUR);280 i++;281 }282 };283 SfFileManager.prototype.updateViewElement = function () {284 if (this.properties.view === 'LargeIcons') {285 this.viewElem = this.element.querySelector('.' + LARGE_ICONS);286 }287 else {288 this.viewElem = this.element.querySelector('.e-gridcontent');289 }290 };291 SfFileManager.prototype.getIconClass = function (element) {292 var iconValue = '';293 iconValue = element.querySelector('.e-list-img') ? 'e-fe-image' : element.querySelector('.e-list-icon').classList[1];294 return iconValue;295 };296 SfFileManager.prototype.updateDragValues = function () {297 var activeElements;298 if (this.activeModule === 'largeiconsview') {299 activeElements = this.viewElem.querySelectorAll('.' + ACTIVE);300 this.dragName = activeElements.length > 0 ? activeElements[0].querySelector('.e-list-text').textContent : '';301 this.dragType = activeElements.length > 0 ? this.getIconClass(activeElements[0]) : '';302 }303 else if (this.activeModule === 'detailsview') {304 activeElements = this.viewElem.querySelectorAll('tr[aria-selected="true"]');305 if (activeElements != null && activeElements.length > 0) {306 this.dragName = activeElements.length > 0 ? activeElements[0].querySelector('.e-fe-text').textContent : '';307 this.dragType = activeElements.length > 0 ? activeElements[0].querySelector('.e-fe-icon').classList[1] : '';308 }309 }310 else if (this.activeModule === 'navigationpane') {311 this.dragName = this.dragLi.querySelector('.e-list-text').textContent;312 this.dragType = 'e-fe-folder';313 }314 if (activeElements != null) {315 this.dragCount = activeElements.length;316 }317 };318 SfFileManager.prototype.getTargetModule = function (element) {319 if (element) {320 if (sf.base.closest(element, '.e-gridcontent')) {321 this.targetModule = 'detailsview';322 }323 else if (sf.base.closest(element, '.' + LARGE_ICONS)) {324 this.targetModule = 'largeiconsview';325 }326 else if (element.classList.contains('e-fullrow') ||327 element.classList.contains('e-icon-expandable')) {328 this.targetModule = 'navigationpane';329 }330 else if (sf.base.closest(element, '.e-address-list-item')) {331 this.targetModule = 'breadcrumbbar';332 }333 else {334 this.targetModule = '';335 }336 }337 };338 SfFileManager.prototype.draggingHandler = function (args) {339 var canDrop = false;340 this.updateDragValues();341 this.cloneIcon.setAttribute('class', 'e-fe-icon ' + this.dragType);342 this.cloneName.innerHTML = this.dragName;343 var node = null;344 this.blurActive();345 this.getTargetModule(args.target);346 this.removeDropTarget();347 this.removeBlur('hover');348 if (this.targetModule === 'navigationpane') {349 node = sf.base.closest(args.target, 'li');350 node.classList.add(HOVER, DROP_FOLDER);351 canDrop = true;352 }353 else if (this.targetModule === 'detailsview') {354 node = sf.base.closest(args.target, 'tr');355 if (node && node.querySelector('.' + FOLDER) && !node.classList.contains(BLUR)) {356 node.classList.add(DROP_FOLDER);357 }358 else if (node && !node.querySelector('.' + FOLDER) && !node.classList.contains(BLUR)) {359 node.classList.add(DROP_FILE);360 }361 canDrop = true;362 }363 else if (this.targetModule === 'largeiconsview') {364 node = sf.base.closest(args.target, 'li');365 if (node && node.querySelector('.' + FOLDER) && !node.classList.contains(BLUR)) {366 node.classList.add(HOVER, DROP_FOLDER);367 }368 canDrop = true;369 }370 else if (this.targetModule === 'breadcrumbbar') {371 canDrop = true;372 }373 this.element.classList.remove('e-fe-drop', 'e-no-drop');374 this.element.classList.add(canDrop ? 'e-fe-drop' : 'e-no-drop');375 this.UpdateXY(args);376 this.dotnetRef.invokeMethodAsync('DraggingCall', this.dragLeft, this.dragTop);377 };378 SfFileManager.prototype.UpdateXY = function (args) {379 this.dragLeft = this.getXYValue(args.event, 'X');380 this.dragTop = this.getXYValue(args.event, 'Y');381 };382 SfFileManager.prototype.dragStopHandler = function (args) {383 var dragArgs = args;384 var isLayout = false;385 dragArgs.cancel = false;386 this.removeDropTarget();387 this.element.classList.remove('e-fe-drop', 'e-no-drop');388 this.dragCancel();389 this.getTargetModule(args.target);390 if (this.targetModule === '' && args.target.classList.contains('e-view-container')) {391 isLayout = true;392 }393 this.removeBlur('hover');394 var targetElement;395 var dataValue;396 if (this.targetModule === 'largeiconsview' || this.targetModule === 'navigationpane' || this.targetModule === 'breadcrumbbar') {397 targetElement = sf.base.closest(args.target, 'li');398 var attr = this.targetModule === 'breadcrumbbar' ? 'data-utext' : 'data-uid';399 dataValue = targetElement ? targetElement.getAttribute(attr) : null;400 }401 else if (this.targetModule === 'detailsview') {402 targetElement = sf.base.closest(args.target, 'tr');403 dataValue = targetElement ? targetElement.getAttribute('aria-rowindex') : null;404 }405 if (dataValue == null) {406 isLayout = true;407 }408 var treeid = this.treeviewEle ? this.dragLi.getAttribute('data-uid') : null;409 if (this.activeModule === 'detailsview') {410 treeid = this.dragLi.getAttribute('aria-rowindex');411 }412 this.UpdateXY(args);413 // eslint:disable-next-line414 this.dotnetRef.invokeMethodAsync('DragStopCall', treeid, dataValue, this.targetModule, this.activeModule, isLayout, this.dragLeft, this.dragTop);415 this.dragCount = 0;416 this.dragName = '';417 this.dragType = '';418 };419 SfFileManager.prototype.dragCancel = function () {420 this.removeBlur();421 var virtualEle = sf.base.select('.' + CLONE, this.element);422 if (virtualEle) {423 sf.base.detach(virtualEle);424 }425 };426 SfFileManager.prototype.gridBlur = function (e) {427 var target = e.target;428 if (target.tagName === 'TD') {429 target.blur();430 }431 };432 SfFileManager.prototype.removeItemClass = function (value) {433 var ele = this.element.querySelectorAll('.' + value);434 for (var i = 0; i < ele.length; i++) {435 ele[i].classList.remove(value);436 }437 };438 SfFileManager.prototype.removeDropTarget = function () {439 this.removeItemClass(DROP_FOLDER);440 this.removeItemClass(DROP_FILE);441 };442 SfFileManager.prototype.removeBlur = function (hover) {443 var blurEle = (!hover) ? this.element.querySelectorAll('.' + BLUR) :444 this.element.querySelectorAll('.' + HOVER);445 var i = 0;446 while (i < blurEle.length) {447 blurEle[i].classList.remove(!hover ? BLUR : HOVER);448 i++;449 }450 };451 SfFileManager.prototype.bindTreeViewKeyBoardEvent = function () {452 var treeviewElem = this.element.querySelector(".e-navigation");453 var keyConfigs = {454 altEnter: 'alt+enter',455 esc: 'escape',456 del: 'delete',457 ctrlX: 'ctrl+x',458 ctrlC: 'ctrl+c',459 ctrlV: 'ctrl+v',460 f2: 'f2',461 shiftF10: 'shift+f10'462 };463 if (treeviewElem) {464 var keyboardDownModule = new sf.base.KeyboardEvents(treeviewElem, {465 keyAction: this.treeviewKeydownHandler.bind(this),466 keyConfigs: keyConfigs,467 eventName: 'keydown'468 });469 }470 };471 SfFileManager.prototype.bindKeyboardEvent = function () {472 if (this.properties.view === 'Details') {473 var keyConfigs = {474 altEnter: 'alt+enter',475 esc: 'escape',476 tab: 'tab',477 moveDown: 'downarrow',478 ctrlEnd: 'ctrl+end',479 ctrlHome: 'ctrl+home',480 ctrlDown: 'ctrl+downarrow',481 ctrlLeft: 'ctrl+leftarrow',482 ctrlRight: 'ctrl+rightarrow',483 shiftEnd: 'shift+end',484 shiftHome: 'shift+home',485 shiftDown: 'shift+downarrow',486 shiftUp: 'shift+uparrow',487 ctrlUp: 'ctrl+uparrow',488 csEnd: 'ctrl+shift+end',489 csHome: 'ctrl+shift+home',490 csDown: 'ctrl+shift+downarrow',491 csUp: 'ctrl+shift+uparrow',492 space: 'space',493 ctrlSpace: 'ctrl+space',494 shiftSpace: 'shift+space',495 csSpace: 'ctrl+shift+space',496 end: 'end',497 home: 'home',498 moveUp: 'uparrow',499 del: 'delete',500 ctrlX: 'ctrl+x',501 ctrlC: 'ctrl+c',502 ctrlV: 'ctrl+v',503 ctrlShiftN: 'ctrl+shift+n',504 shiftdel: 'shift+delete',505 ctrlD: 'ctrl+d',506 f2: 'f2',507 ctrlA: 'ctrl+a',508 enter: 'enter'509 };510 var gridElem = this.element.querySelector('#' + this.properties.id + '_grid');511 if (gridElem) {512 this.bindKeyboardEvents(keyConfigs, gridElem);513 }514 }515 else if (this.properties.view === 'LargeIcons') {516 var keyConfigs = {517 altN: 'alt+n',518 f5: 'f5',519 ctrlShift1: 'ctrl+shift+1',520 ctrlShift2: 'ctrl+shift+2',521 ctrlU: 'ctrl+u',522 end: 'end',523 home: 'home',524 tab: 'tab',525 moveDown: 'downarrow',526 moveLeft: 'leftarrow',527 moveRight: 'rightarrow',528 moveUp: 'uparrow',529 ctrlEnd: 'ctrl+end',530 ctrlHome: 'ctrl+home',531 ctrlDown: 'ctrl+downarrow',532 ctrlLeft: 'ctrl+leftarrow',533 ctrlRight: 'ctrl+rightarrow',534 ctrlUp: 'ctrl+uparrow',535 shiftEnd: 'shift+end',536 shiftHome: 'shift+home',537 shiftDown: 'shift+downarrow',538 shiftLeft: 'shift+leftarrow',539 shiftRight: 'shift+rightarrow',540 shiftUp: 'shift+uparrow',541 csEnd: 'ctrl+shift+end',542 csHome: 'ctrl+shift+home',543 csDown: 'ctrl+shift+downarrow',544 csLeft: 'ctrl+shift+leftarrow',545 csRight: 'ctrl+shift+rightarrow',546 csUp: 'ctrl+shift+uparrow',547 space: 'space',548 ctrlSpace: 'ctrl+space',549 shiftSpace: 'shift+space',550 csSpace: 'ctrl+shift+space',551 ctrlA: 'ctrl+a',552 enter: 'enter',553 altEnter: 'alt+enter',554 esc: 'escape',555 del: 'delete',556 ctrlX: 'ctrl+x',557 ctrlC: 'ctrl+c',558 ctrlV: 'ctrl+v',559 f2: 'f2',560 shiftdel: 'shift+delete',561 back: 'backspace',562 ctrlD: 'ctrl+d'563 };564 var largeIcons = this.element.querySelector('#' + this.properties.id + '_largeicons');565 if (largeIcons) {566 this.bindKeyboardEvents(keyConfigs, largeIcons);567 }568 }569 };570 SfFileManager.prototype.bindKeyboardEvents = function (keyConfigs, element) {571 this.keyboardModule = new sf.base.KeyboardEvents(element, {572 keyAction: this.keyupHandler.bind(this),573 keyConfigs: keyConfigs,574 eventName: 'keyup'575 });576 this.keyboardDownModule = new sf.base.KeyboardEvents(element, {577 keyAction: this.keydownHandler.bind(this),578 keyConfigs: keyConfigs,579 eventName: 'keydown'580 });581 };582 SfFileManager.prototype.getRowValue = function () {583 var largeIconEle = this.element.querySelector('#' + this.element.id + '_largeicons');584 var itemList = largeIconEle.querySelectorAll('.e-list-item');585 var perRow = 1;586 if (itemList) {587 for (var i = 0, len = itemList.length - 1; i < len; i++) {588 if (itemList[i].getBoundingClientRect().top === itemList[i + 1].getBoundingClientRect().top) {589 perRow++;590 }591 else {592 break;593 }594 }595 }596 return perRow;597 };598 // eslint-disable-next-line599 SfFileManager.prototype.keyupHandler = function (e) {600 e.preventDefault();601 var perRow = 0;602 if (this.properties.view === 'LargeIcons') {603 perRow = this.getRowValue();604 }605 var action = e.action;606 var actionValue = null;607 switch (action) {608 case 'altN':609 actionValue = 'NewFolder';610 break;611 case 'f5':612 actionValue = 'Refresh';613 break;614 case 'ctrlShift1':615 actionValue = 'DetailsView';616 break;617 case 'ctrlShift2':618 actionValue = 'LargeIconsView';619 break;620 case 'ctrlU':621 actionValue = 'Upload';622 break;623 case 'altEnter':624 actionValue = 'Details';625 break;626 case 'del':627 case 'shiftdel':628 actionValue = 'Delete';629 break;630 case 'enter':631 actionValue = 'Open';632 break;633 case 'ctrlC':634 actionValue = 'Copy';635 break;636 case 'ctrlV':637 actionValue = 'Paste';638 break;639 case 'ctrlX':640 actionValue = 'Cut';641 break;642 case 'ctrlD':643 actionValue = 'Download';644 break;645 case 'f2':646 actionValue = 'Rename';647 break;648 case 'ctrlA':649 actionValue = 'SelectAll';650 break;651 case 'home':652 actionValue = 'Home';653 break;654 case 'end':655 actionValue = 'End';656 break;657 case 'moveDown':658 actionValue = 'MoveDown_' + perRow.toString();659 break;660 case 'moveLeft':661 actionValue = 'MoveLeft';662 break;663 case 'moveRight':664 actionValue = 'MoveRight';665 break;666 case 'moveUp':667 actionValue = 'MoveUp_' + perRow.toString();668 break;669 case 'esc':670 actionValue = 'Esc';671 break;672 case 'ctrlLeft':673 actionValue = 'ControlLeft';674 break;675 case 'ctrlRight':676 actionValue = 'ControlRight';677 break;678 case 'ctrlEnd':679 actionValue = 'ControlEnd';680 break;681 case 'ctrlHome':682 actionValue = 'ControlHome';683 break;684 case 'shiftHome':685 actionValue = 'ShiftHome';686 break;687 case 'shiftEnd':688 actionValue = 'ShiftEnd';689 break;690 case 'shiftLeft':691 actionValue = 'ShiftLeft';692 break;693 case 'shiftRight':694 actionValue = 'ShiftRight';695 break;696 case 'csHome':697 actionValue = 'ControlShiftHome';698 break;699 case 'csEnd':700 actionValue = 'ControlShiftEnd';701 break;702 case 'csLeft':703 actionValue = 'ControlShiftLeft';704 break;705 case 'csRight':706 actionValue = 'ControlShiftRight';707 break;708 case 'ctrlUp':709 actionValue = 'ControlUp_' + perRow.toString();710 break;711 case 'shiftUp':712 actionValue = 'ShiftUp_' + perRow.toString();713 break;714 case 'csUp':715 actionValue = 'ControlShiftUp_' + perRow.toString();716 break;717 case 'ctrlDown':718 actionValue = 'ControlDown_' + perRow.toString();719 break;720 case 'shiftDown':721 actionValue = 'ShiftDown_' + perRow.toString();722 break;723 case 'csDown':724 actionValue = 'ControlShiftDown_' + perRow.toString();725 break;726 case 'space':727 actionValue = 'Space';728 break;729 case 'csSpace':730 actionValue = 'ControlShiftSpace';731 break;732 case 'shiftSpace':733 actionValue = 'ShiftSpace';734 break;735 case 'ctrlSpace':736 actionValue = 'ControlSpace';737 break;738 case 'tab':739 actionValue = 'Tab';740 break;741 }742 if (actionValue) {743 this.dotnetRef.invokeMethodAsync('PerformKeyboardAction', actionValue);744 }745 };746 SfFileManager.prototype.treeviewKeydownHandler = function (e) {747 e.preventDefault();748 if (this.element.querySelector('.e-dialog.e-popup-open') == null) {749 var action = e.action;750 var actionValue = null;751 switch (action) {752 case 'altEnter':753 actionValue = 'Details';754 break;755 case 'esc':756 actionValue = 'Esc';757 break;758 case 'del':759 actionValue = 'Delete';760 break;761 case 'ctrlC':762 actionValue = 'Copy';763 break;764 case 'ctrlV':765 actionValue = 'Paste';766 break;767 case 'ctrlX':768 actionValue = 'Cut';769 break;770 case 'shiftF10':771 actionValue = 'Download';772 break;773 case 'f2':774 actionValue = 'Rename';775 break;776 }777 if (actionValue) {778 this.dotnetRef.invokeMethodAsync('PerformTreeViewKeyboardAction', actionValue);779 }780 }781 };782 SfFileManager.prototype.keydownHandler = function (e) {783 if (this.element.querySelector('.e-dialog.e-popup-open') == null) {784 switch (e.action) {785 case 'end':786 case 'home':787 case 'space':788 case 'ctrlSpace':789 case 'shiftSpace':790 case 'csSpace':791 case 'ctrlA':792 case 'enter':793 case 'altEnter':794 case 'ctrlEnd':795 case 'shiftEnd':796 case 'csEnd':797 case 'ctrlHome':798 case 'shiftHome':799 case 'csHome':800 case 'ctrlDown':801 case 'shiftDown':802 case 'csDown':803 case 'ctrlLeft':804 case 'shiftLeft':805 case 'csLeft':806 case 'esc':807 case 'del':808 case 'shiftdel':809 case 'ctrlC':810 case 'ctrlV':811 case 'ctrlX':812 case 'f2':813 case 'moveDown':814 case 'moveUp':815 case 'ctrlD':816 case 'altN':817 case 'f5':818 case 'ctrlShift1':819 case 'ctrlShift2':820 case 'ctrlU':821 e.preventDefault();822 break;823 default:824 break;825 }826 }827 };828 return SfFileManager;829}());830// eslint:disable-next-line831var FileManager = {832 initialize: function (element, dotnetRef, properties, isMobile) {833 new SfFileManager(element, dotnetRef, properties);834 if (properties.draggable) {835 element.blazor__instance.createDragObj();836 }837 element.blazor__instance.isMobile = isMobile;838 return element.blazor__instance.adjustHeight();839 },840 dragStartActionContinue: function (element, cancel) {841 if (element) {842 element.blazor__instance.TriggerDragStartEvent(cancel);843 }844 },845 wireMobileEvents: function (element) {846 element.blazor__instance.wireMobileEvents();847 },848 dragActionContinue: function (element, cancel) {849 if (element) {850 element.blazor__instance.TriggerDragEvent(cancel);851 }852 },853 focusItem: function (element, selector) {854 if (element) {855 if (element.blazor__instance.properties.view === 'LargeIcons') {856 var focusElement = element.querySelector('.e-list-item.e-large-icon[data-uid="' + selector + '"]');857 if (focusElement) {858 focusElement.focus();859 }860 }861 }862 },863 updateProperties: function (element, properties) {864 element.blazor__instance.properties = properties;865 element.blazor__instance.unWireEvents();866 element.blazor__instance.wireEvents();867 if (element.blazor__instance.isMobile) {868 element.blazor__instance.unWireMobileEvents();869 element.blazor__instance.wireMobileEvents();870 }871 return element.blazor__instance.adjustHeight();872 },873 uploadOpen: function (element, id, popupTarget) {874 var uploadElement = (!sf.base.isNullOrUndefined(popupTarget) ? document.querySelector(popupTarget) : element).querySelector('#' + id);875 if (uploadElement) {876 uploadElement.click();877 }878 },879 triggerBlur: function (element) {880 if (element && document.activeElement.tagName === TD_ELEMENT) {881 document.activeElement.blur();882 }883 },884 updateFocus: function (element, index) {885 if (element) {886 element.blazor__instance.UpdateGridFocus(index);887 }888 },889 updateView: function (element, view) {890 if (element) {891 element.blazor__instance.properties.view = view;892 element.blazor__instance.keyboardDownModule.destroy();893 element.blazor__instance.keyboardModule.destroy();894 element.blazor__instance.bindKeyboardEvent();895 if (element.blazor__instance.isMobile) {896 element.blazor__instance.unWireMobileEvents();897 element.blazor__instance.wireMobileEvents();898 }899 }900 if (element.blazor__instance.properties.draggable) {901 element.blazor__instance.createDragObj();902 }903 },904 updateGridRow: function (gridEle, index) {905 if (gridEle) {906 var selectedElements = gridEle.querySelectorAll('tr.e-row[tabindex="0"]');907 for (var i = 0; i < selectedElements.length; i++) {908 selectedElements[i].removeAttribute('tabindex');909 }910 var element1 = gridEle.querySelector('[aria-rowindex="' + index + '"]');911 if (element1) {912 element1.setAttribute('tabindex', '0');913 element1.focus();914 }915 }916 },917 focusToolbar: function (element, selector) {918 var focusElement = element.querySelector(selector);919 if (element && focusElement) {920 focusElement.children[0].focus();921 }922 },923 // eslint-disable-next-line924 saveFile: function (filename, url, element) {925 // eslint-disable-next-line926 var data = { 'action': 'download', 'path': filename.path, 'names': filename.names, 'data': filename.data };927 var form = sf.base.createElement('form', {928 id: element.id + '_downloadForm',929 attrs: { action: url, method: 'post', name: 'downloadForm', 'download': '' }930 });931 var input = sf.base.createElement('input', {932 id: element.id + '_hiddenForm',933 attrs: { name: 'downloadInput', value: JSON.stringify(data), type: 'hidden' }934 });935 form.appendChild(input);936 document.body.appendChild(form);937 document.forms.namedItem('downloadForm').submit();938 document.body.removeChild(form);939 },940 getTargetElement: function (view, x, y) {941 var element = document.elementFromPoint(x, y);942 var targetElement;943 var menuModel;944 var treeElement = sf.base.closest(element, 'li[role="treeitem"]');945 if (!element) {946 menuModel = { IsFile: false, RowIndex: null, IsFolder: false, IsLayout: false, IsTree: false };947 }948 else {949 if ((element.classList.contains('e-yscroll') && element.classList.contains('e-content')) ||950 (element.classList.contains('e-list-parent') && element.classList.contains('e-ul')) ||951 element.classList.contains('e-view-container') || element.classList.contains('e-large-icons')952 || sf.base.closest(element, '.e-empty.e-view-container')) {953 menuModel = { IsFile: false, RowIndex: null, IsFolder: false, IsLayout: true, IsTree: false };954 }955 else if (treeElement) {956 var dataid = parseInt(treeElement.getAttribute('data-uid'), 10);957 menuModel = { IsFile: false, RowIndex: dataid, IsFolder: true, IsLayout: false, IsTree: true };958 }959 else {960 if (view === 'Details') {961 targetElement = sf.base.closest(element, 'tr');962 var isFile = !(targetElement.querySelector('.e-fe-grid-icon .e-fe-icon').classList.contains('e-fe-folder'));963 var rowIndex = parseInt(targetElement.getAttribute('aria-rowindex'), 10);964 menuModel = { IsFile: isFile, RowIndex: rowIndex, IsFolder: !isFile, IsLayout: false, IsTree: false };965 }966 else if (view === 'LargeIcons') {967 targetElement = sf.base.closest(element, 'li');968 var iconEle = targetElement.querySelector('.e-list-icon');969 var isFile = iconEle ? !(iconEle.classList.contains('e-fe-folder')) : true;970 var rowIndex = parseInt(targetElement.getAttribute('data-uid'), 10);971 menuModel = { IsFile: isFile, RowIndex: rowIndex, IsFolder: !isFile, IsLayout: false, IsTree: false };972 }973 }974 }975 return menuModel;976 }977};978return FileManager;...

Full Screen

Full Screen

shortcuts.js

Source:shortcuts.js Github

copy

Full Screen

...319 return Promise.resolve();320}321function shiftUp (element) {322 if (browserUtils.isWebKit && domUtils.isInputElement(element))323 return shiftHome(element);324 if (domUtils.isTextAreaElement(element))325 moveTextAreaCursorUp(element, true);326 return Promise.resolve();327}328function shiftDown (element) {329 if (browserUtils.isWebKit && domUtils.isInputElement(element))330 return shiftEnd(element);331 if (domUtils.isTextAreaElement(element))332 moveTextAreaCursorDown(element, true);333 return Promise.resolve();334}335function shiftLeft (element) {336 if (domUtils.isTextEditableElement(element)) {337 var startPos = textSelection.getSelectionStart(element);...

Full Screen

Full Screen

Sidebar.js

Source:Sidebar.js Github

copy

Full Screen

1import React from 'react';2import './Sidebar.css';3import SidebarOption from './SidebarOption';4import PlayForWorkIcon from '@material-ui/icons/PlayForWork';5import HomeIcon from '@material-ui/icons/Home';6import SearchIcon from '@material-ui/icons/Search';7import MusicNoteIcon from '@material-ui/icons/MusicNote';8import LibraryMusicIcon from '@material-ui/icons/LibraryMusic';9// import SongRow from './librarySection/SongRow';10import SidebarSongRow from './SidebarSongRow';11import IconButton from "@material-ui/core/IconButton";12// import Playlist from '../playlist/Playlist'13import applogo from '../../../../assets/applogo.png';14import Aux from '../../../hoc/Auxiliary';15import CloudUploadIcon from '@material-ui/icons/CloudUpload';16import {Grid,Container} from '@material-ui/core';17import { useContext } from 'react'18import playerContext from '../../../../context/playerContext';19function Sidebar() {20 const { SetCurrent, currentSong, songs } = useContext(playerContext)21 // constructor (props) {22 // super(props);23 // this.state = {24 // shiftHome: false25 // }26 // }27 // showHomeHandler = () => {28 // const doesShowHome = this.state.showHome;29 // this.setState({ showHome : !doesShowHome});30 // }31 return (32 <Aux>33 34 {/* <MusicHomeMainLayout /> */}35 <div className="sidebar">36 {/* <img className="sidebar__logo"37 src="https://encrypted-tbn0.gstatic.com/images?q=tbn%3AANd9GcSFQQDgOVy9n6ikyzSoFjey-JnUI4s6v3WmYb3qA0NfWfEFEAIhfFiynxhrN2vhuzkf3ahbUuX3NzpujqAsQo_SjGm_A3OM7_IG&usqp=CAU&ec=45690272"38 alt=""39 /> */}40 <div className="sidebar__logo">41 {/* <Typography align="center" color="textinherit" gutterBottom>42 <img src={applogo6} style={{height:"35px"}}/>Music on Blockchain43 </Typography> */}44 <IconButton color="inherit" aria-label="menu" className="icon_btn">45 <img src={applogo} style={{height:"30px", marginRight:"7px"}}/>46 <p style={{color:"white",fontSize:"22px" ,fontWeight:"bold"}}>MusicCoin</p>47 </IconButton>48 </div>49 {/* <div onClick={() => this.showHomeHandler()}>50 </div> */}51 <a href="/musicHome" style={{textDecoration:"none"}}>52 <SidebarOption Icon={HomeIcon} title="Home" />53 </a>54 <SidebarOption Icon={SearchIcon} title="Search" />55 <a href="/musicHome/library" style={{textDecoration:"none"}}>56 <SidebarOption Icon={LibraryMusicIcon} title="Library" />57 </a>58 <a href="/musicHome/library/upload" style={{textDecoration:"none"}}>59 <SidebarOption Icon={CloudUploadIcon} title="Upload Your Own" />60 </a>61 {/* <button onClick={() => this.showHomeHandler()}>62 Click Me63 </button> */}64 <br />65 <strong className="sidebar__title">66 PLAYLISTS67 {/* <PlayForWorkIcon /> */}68 </strong>69 <hr />70 {/* <SidebarSongRow /> */}71 <div className="sidebar__songlist">72 <ul className="loi">73 {74 songs.map((song, i) =>75 <li className={'sidebarSongContainer' + (currentSong === i ? 'selected' : '')} key={i} onClick={() => { SetCurrent(i); }} >76 <Grid container className="sidebar__song__row">77 <MusicNoteIcon className="sidbar__songrow__icon"/>78 <span className="song" style={{fontSize: "14px"}}>{song[0]}</span>79 </Grid>80 </li>81 )82 }83 </ul>84 </div>85 </div>86 </Aux>87 );88}...

Full Screen

Full Screen

shortcut-type.js

Source:shortcut-type.js Github

copy

Full Screen

1export default {2 ctrlA: 'ctrl+a',3 backspace: 'backspace',4 delete: 'delete',5 left: 'left',6 right: 'right',7 up: 'up',8 down: 'down',9 shiftLeft: 'shift+left',10 shiftRight: 'shift+right',11 shiftUp: 'shift+up',12 shiftDown: 'shift+down',13 shiftHome: 'shift+home',14 shiftEnd: 'shift+end',15 home: 'home',16 end: 'end',17 enter: 'enter',18 tab: 'tab',19 shiftTab: 'shift+tab',20 esc: 'esc',...

Full Screen

Full Screen

index.js

Source:index.js Github

copy

Full Screen

1'use strict';2import angular from 'angular';3import uiRouter from '@uirouter/angularjs';4import routing from './shift.routes';5// modules6import shiftHome from './shift-home';7export default angular.module('statEngineApp.shift', [uiRouter, shiftHome])8 .config(routing)...

Full Screen

Full Screen

Using AI Code Generation

copy

Full Screen

1import { Selector } from 'testcafe';2test('My first test', async t => {3 .typeText('#developer-name', 'John Smith')4 .click('#submit-button')5 .expect(Selector('#article-header').innerText).eql('Thank you, John Smith!');6});7import { Selector } from 'testcafe';8test('My first test', async t => {9 .typeText('#developer-name', 'John Smith')10 .click('#submit-button')11 .expect(Selector('#article-header').innerText).eql('Thank you, John Smith!');12});13import { Selector } from 'testcafe';14test('My first test', async t => {15 .typeText('#developer-name', 'John Smith')16 .click('#submit-button')17 .expect(Selector('#article-header').innerText).eql('Thank you, John Smith!');18});19import { Selector } from 'testcafe';20test('My first test', async t => {21 .typeText('#developer-name', 'John Smith')22 .click('#submit-button')23 .expect(Selector('#article-header').innerText).eql('Thank you, John Smith!');24});25import { Selector } from 'testcafe';26test('My first test', async t => {27 .typeText('#developer-name', 'John Smith')28 .click('#submit-button')29 .expect(Selector('#article-header').innerText).eql('Thank you, John Smith!');30});31import { Selector } from 'testcafe';

Full Screen

Using AI Code Generation

copy

Full Screen

1import { Selector } from 'testcafe';2test('My first test', async t => {3 .typeText('#developer-name', 'John Smith')4 .click('#submit-button')5 .click('#tried-test-cafe')6 .click('#tried-test-cafe')7 .click('#tried-test-cafe')8 .click('#tried-test-cafe')9 .shiftHome()10 .pressKey('delete');11});

Full Screen

Using AI Code Generation

copy

Full Screen

1import { Selector, t } from 'testcafe';2test('My first test', async t => {3 .typeText('#developer-name', 'John Smith')4 .click('#tried-test-cafe')5 .click('#submit-button');6});

Full Screen

Using AI Code Generation

copy

Full Screen

1import { Selector } from 'testcafe';2test('My test', async t => {3 .typeText('#developer-name', 'Peter')4 .click('#windows')5 .click('#submit-button');6 const articleHeader = await Selector('.result-content').find('h1');7 let headerText = await articleHeader.innerText;8});9import { Selector } from 'testcafe';10test('My test', async t => {11 .typeText('#developer-name', 'Peter')12 .click('#windows')13 .click('#submit-button');14 const articleHeader = await Selector('.result-content').find('h1');15 let headerText = await articleHeader.innerText;16});17import { Selector } from 'testcafe';18test('My test', async t => {19 .typeText('#developer-name', 'Peter')20 .click('#windows')21 .click('#submit-button');22 const articleHeader = await Selector('.result-content').find('h1');23 let headerText = await articleHeader.innerText;24});

Full Screen

Using AI Code Generation

copy

Full Screen

1import { Selector } from 'testcafe';2test('My Test', async t => {3 .click('#populate')4 .click('#submit-button')5 .expect(Selector('#article-header').innerText).eql('Thank you, John Smith!');6});

Full Screen

Using AI Code Generation

copy

Full Screen

1const { ClientFunction } = require('testcafe');2test('My first test', async t => {3 .typeText('#developer-name', 'John Smith')4 .click('#submit-button')5 .click('#tried-test-cafe')6 .click('#macos')7 .click('#submit-button');8 const getLocation = ClientFunction(() => document.location.href);9 const url = await getLocation();10 await t.expect(url).contains('thank-you');11});121. Download the latest release from the [releases](

Full Screen

Using AI Code Generation

copy

Full Screen

1import { Selector } from 'testcafe';2test('My first test', async t => {3 .typeText('#developer-name', 'John Smith')4 .click('#submit-button')5 .expect(Selector('#article-header').innerText).eql('Thank you, John Smith!');6});7import { Selector } from 'testcafe';8test('My first test', async t => {9 .typeText('#developer-name', 'John Smith')10 .click('#submit-button')11 .expect(Selector('#article-header').innerText).eql('Thank you, John Smith!');12});13test('My second test', async t => {14 .click('#populate')15 .click('#submit-button');16});

Full Screen

Using AI Code Generation

copy

Full Screen

1import { Selector } from 'testcafe';2test('My first test', async t => {3 .typeText('#developer-name', 'John Smith')4 .click('#submit-button')5 .wait(3000)6 .click('#tried-test-cafe')7 .pressKey('shift+home')8 .pressKey('delete')9 .typeText('#tried-test-cafe', 'I have tried Test Cafe')10 .wait(3000);11});

Full Screen

Using AI Code Generation

copy

Full Screen

1import { Selector, t } from 'testcafe';2class Test {3 constructor() {4 this.shiftHome = Selector('body').with({ boundTestRun: t }).shiftHome;5 }6}7export default new Test();

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run Testcafe automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful