2023-04-28 12:22:26 +08:00

1 line
227 KiB
Plaintext

{"version":3,"sources":["webpack:///webpack/universalModuleDefinition?5ca6***","webpack:///webpack/bootstrap e3bd17c0d0c15192fc59?223a***","webpack:///js/gridview.js","webpack:///./src/components/browser.js","webpack:///./src/components/shim_math.js?f16c*","webpack:///./src/components/datagrid/gridview.js","webpack:///external \"$\"?57aa"],"names":["root","factory","exports","module","require","define","amd","this","__WEBPACK_EXTERNAL_MODULE_4__","__webpack_require__","moduleId","installedModules","i","l","modules","call","m","c","value","d","name","getter","o","Object","defineProperty","configurable","enumerable","get","n","__esModule","object","property","prototype","hasOwnProperty","p","s","11","userAgent","navigator","toLowerCase","isMobile","test","isChrome","2","math","trunc","val","Math","floor","ceil","ui","getClientX","e","originalEvent","cx","touches","clientX","undefined","getOffsetLeft","el","left","offsetLeft","offsetParent","func","debounce","method","args","delay","context","window","clearTimeout","tiid","setTimeout","apply","throttle","current","Date","tdate","24","GridView","columns","_source","source","lang","all","ok","reset","virtualCount","VIRTUAL_COUNT","rowHeight","filterRowHeight","total","height","virtual","startIndex","sortIndex","sortDirection","selectedColumnIndex","selectedIndexes","canMultiSelect","allowHtml","oddStyle","$parent","$el","$refs","$elems","$window","willselect","selectedrowchanged","celldblclick","cellclick","rowdblclick","columnchanged","indexOfColumn","target","Array","slice","parentNode","children","indexOf","headerClick","force","_innerwidth","_isdragging","_istouchdown","sortable","tagName","className","classList","contains","sortColumn","data","getDefault","obj","prop","v","getSpecialDefault","def","isArray","join","distinct","key","ckey","dict","length","item","Values","values","k","push","str","String","onFilterChecked","holder","cball","$","__checked","cbs","find","doFillFilterItem","array","onchecked","itemdiv","wrapper","checkbox","displayValue","filterCustom","filter","on","append","label","text","fillFilterItem","grid","items","remove","__filterHeight","sizeHolder","css","itemsHolder","filterValues","filterOnScroll","top","bottomTop","__filterTop","__filterStartIndex","__itemHolder","empty","__checkboxAll","style","filterClick","parent","document","body","closePanel","e1","removeClass","off","divpanel","stopPropagation","th","currentTarget","offset","width","itemHolder","onFillItems","hasSearch","onFillSearch","search","searchHolder","searchbox","allowSearch","searchiconClick","e2","focus","searchicon","addEventListener","REFRESH_INTERVAL","scrollTop","passive","itemdivall","checkboxall","filterSource","innerSource","sort","a","b","citems","Value","DisplayValue","column","boxes","checked","filterFunctions","functionBar","buttonReset","onFilterReset","refreshGrid","afterFilter","addClass","buttonOk","onFilterOK","filters","map","dragStart","orderable","isfixed","_cx","_index","dragmove","isdragging","MINI_DRAG_OFFSET","_offset","columnDragging","dragend","columnDragstop","bindDragmove","bind","resizeStart","preventDefault","_width","baseWidth","fixedColumns","visible","_baseWidth","resizemove","MINI_COLUMN_WIDTH","widthChanging","resizeend","autoResize","widthChanged","bindResizemove","changeColumnWidth","index","isFixed","oldWidth","w","element","header","maxWidth","minWidth","header_fixed","$el_fixed","rows","gridbodyContent","gridbodyContainer","offsetWidth","gridbodyContent_fixed","gridbodyContainer_fixed","gridtotalbody","gridtotalbody_fixed","resize","columnchanging","COLUMN_CHANGED_TYPE","RESIZE","col","dragger","show","draggerCursor","idx","count","_orderIndex","hide","targetIndex","headers","totals","tmp","insertAfter","j","insertBefore","hd","REORDER","keyid","MAX_COLUMN_BIT","_overflows","auto","reload","fixedHeaders","fixedHd","comparer","sortFilter","ta","tb","refresh","SORT","checkAllColumn","check","itemEnabled","enabled","onchanged","checkall","__internal_changed","checkRow","scrollToTop","flag","ROW_HEIGHT","REDUN_NUM","_containerHeight","_bodyRowCount","_scrollTop","gridonscroll","resetScroll","getColumnIndex","istotal","max","rowOnClick","colindex","selectedIndex","selected","ctrlKey","splice","shiftKey","start","end","isEditable","__selected","changes","__changed","fixedRows","colIndex","allowFullrowClick","buttons","TouchEvent","rowOnDblClick","columnIndex","parents","adjustRows","gridcontent","cols","cnt","jGridContent","childrencount","onrowdblclick","onrowclick","row","cell","isurl","type","COLUMN_TYPE","checkit","box","checkinner","lastRow","last","hasClass","gridbodyMouseMove","nowKeyid","display","oldkeyid","overflow","targetContent","scrollWidth","innerText","offsetTop","holderWidth","_bodyClientWidth","maxleft","_scrollLeft","offsetHeight","cssText","tableHeaderMouseEnter","gridbody","gridbody_fixed","createHeader","prefix","table","sortclick","attr","isShrink","_needAutoResize","caption","headerWidth","align","click","drag","allcheck","textStyle","headerTitle","allowFilter","filterclick","isFiltered","split","resizable","tooltip","createBody","delta","wheelDelta","detail","evt","isNaN","position","tbody","MAX_COLUMN_MASK","noHoverHolder","hoverHolder","createTotals","gridtotal","totalbody","html","totalWidth","fillRows","els","maxWidths","vals","editFilter","div","span","chkbox","querySelector","disabled","innerHTML","href","removeAttribute","classFilter","cls","styleFilter","bgFilter","bgColor","backgroundColor","events","attrs","setAttribute","_require","browser","_network","common","input","dropdown","init","_rendering","Error","datagrid","dataCount","scrollToIndex","fixedCount","fixedDatagrid","fixedHeader","fixedTotals","fixedWidth","forEach","loading","hasFixed","ecol","eq","it","scrollLeft","headerTable","marginLeft","hscrolling","fixedGridbody","fixedHeaderTable","headerTable_fixed","fixedHeight","clientHeight","clientWidth","totalheight","gridtotal_fixed","right","bottom","setData","resetFilter","afterResetFilter","t","toppx","deleteRow","moveRow","step","toIndex","closeFilterPanel","visibility","opacity","clearGridWidth","objectid","next","query","applyGridWidth","management","tmpColumns","Result","gridwidth","tmpcol","ColumnKey","Width","Sort","saveColumnInfo","columnWidths","columnwidth","$type","OrderIndex","$values","4","5"],"mappings":"CAAA,SAA2CA,EAAMC,GAC1B,gBAAZC,UAA0C,gBAAXC,QACxCA,OAAOD,QAAUD,EAAQG,QAAQ,MACR,kBAAXC,SAAyBA,OAAOC,IAC9CD,QAAQ,KAAMJ,GACY,gBAAZC,SACdA,QAAQ,eAAiBD,EAAQG,QAAQ,MAEzCJ,EAAK,eAAiBC,EAAQD,EAAQ,IACrCO,KAAM,SAASC,GAClB,M,aCNE,QAASC,GAAoBC,GAG5B,GAAGC,EAAiBD,GACnB,MAAOC,GAAiBD,GAAUR,OAGnC,IAAIC,GAASQ,EAAiBD,IAC7BE,EAAGF,EACHG,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ACA,SAAU/gB,EAAQD,GIjzExBC,EAAOD,QAAUM,GJuzEX2gB,EACA,SAAUhhB,EAAQD","file":"js/gridview.js?ab92a4cdb00c256beafb","sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory(require(\"$\"));\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([\"$\"], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"g5-gridview\"] = factory(require(\"$\"));\n\telse\n\t\troot[\"g5-gridview\"] = factory(root[\"$\"]);\n})(this, function(__WEBPACK_EXTERNAL_MODULE_4__) {\nreturn \n\n\n// WEBPACK FOOTER //\n// webpack/universalModuleDefinition"," \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// identity function for calling harmony imports with the correct context\n \t__webpack_require__.i = function(value) { return value; };\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"/dist/\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 24);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap e3bd17c0d0c15192fc59","(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory(require(\"$\"));\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([\"$\"], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"g5-gridview\"] = factory(require(\"$\"));\n\telse\n\t\troot[\"g5-gridview\"] = factory(root[\"$\"]);\n})(this, function(__WEBPACK_EXTERNAL_MODULE_4__) {\nreturn /******/ (function(modules) { // webpackBootstrap\n/******/ \t// The module cache\n/******/ \tvar installedModules = {};\n/******/\n/******/ \t// The require function\n/******/ \tfunction __webpack_require__(moduleId) {\n/******/\n/******/ \t\t// Check if module is in cache\n/******/ \t\tif(installedModules[moduleId]) {\n/******/ \t\t\treturn installedModules[moduleId].exports;\n/******/ \t\t}\n/******/ \t\t// Create a new module (and put it into the cache)\n/******/ \t\tvar module = installedModules[moduleId] = {\n/******/ \t\t\ti: moduleId,\n/******/ \t\t\tl: false,\n/******/ \t\t\texports: {}\n/******/ \t\t};\n/******/\n/******/ \t\t// Execute the module function\n/******/ \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n/******/\n/******/ \t\t// Flag the module as loaded\n/******/ \t\tmodule.l = true;\n/******/\n/******/ \t\t// Return the exports of the module\n/******/ \t\treturn module.exports;\n/******/ \t}\n/******/\n/******/\n/******/ \t// expose the modules object (__webpack_modules__)\n/******/ \t__webpack_require__.m = modules;\n/******/\n/******/ \t// expose the module cache\n/******/ \t__webpack_require__.c = installedModules;\n/******/\n/******/ \t// identity function for calling harmony imports with the correct context\n/******/ \t__webpack_require__.i = function(value) { return value; };\n/******/\n/******/ \t// define getter function for harmony exports\n/******/ \t__webpack_require__.d = function(exports, name, getter) {\n/******/ \t\tif(!__webpack_require__.o(exports, name)) {\n/******/ \t\t\tObject.defineProperty(exports, name, {\n/******/ \t\t\t\tconfigurable: false,\n/******/ \t\t\t\tenumerable: true,\n/******/ \t\t\t\tget: getter\n/******/ \t\t\t});\n/******/ \t\t}\n/******/ \t};\n/******/\n/******/ \t// getDefaultExport function for compatibility with non-harmony modules\n/******/ \t__webpack_require__.n = function(module) {\n/******/ \t\tvar getter = module && module.__esModule ?\n/******/ \t\t\tfunction getDefault() { return module['default']; } :\n/******/ \t\t\tfunction getModuleExports() { return module; };\n/******/ \t\t__webpack_require__.d(getter, 'a', getter);\n/******/ \t\treturn getter;\n/******/ \t};\n/******/\n/******/ \t// Object.prototype.hasOwnProperty.call\n/******/ \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n/******/\n/******/ \t// __webpack_public_path__\n/******/ \t__webpack_require__.p = \"/dist/\";\n/******/\n/******/ \t// Load entry module and return exports\n/******/ \treturn __webpack_require__(__webpack_require__.s = 24);\n/******/ })\n/************************************************************************/\n/******/ ({\n\n/***/ 11:\n/***/ (function(module, exports) {\n\nmodule.exports = {\n userAgent: navigator.userAgent.toLowerCase(),\n isMobile: function isMobile() {\n return (/mobile/.test(this.userAgent)\n );\n },\n isChrome: function isChrome() {\n return (/chrom(e|ium)/.test(this.userAgent)\n );\n }\n};\n\n/***/ }),\n\n/***/ 2:\n/***/ (function(module, exports) {\n\nmodule.exports = {\n math: {\n trunc: function trunc(val) {\n return (val > 0 ? Math.floor : Math.ceil)(val);\n }\n },\n ui: {\n getClientX: function getClientX(e) {\n if (e == null) {\n return null;\n }\n if (e.originalEvent != null) {\n e = e.originalEvent;\n }\n var cx = e.touches && e.touches[0] && e.touches[0].clientX;\n if (cx === undefined) {\n return e.clientX;\n }\n return cx;\n },\n getOffsetLeft: function getOffsetLeft(el) {\n var left = 0;\n while (el) {\n left += el.offsetLeft;\n el = el.offsetParent;\n }\n return left;\n }\n },\n func: {\n debounce: function debounce(method) {\n for (var _len = arguments.length, args = Array(_len > 3 ? _len - 3 : 0), _key = 3; _key < _len; _key++) {\n args[_key - 3] = arguments[_key];\n }\n\n var delay = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 100;\n var context = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : window;\n\n clearTimeout(method.tiid);\n method.tiid = setTimeout(function () {\n return method.apply(context, args);\n }, delay);\n },\n throttle: function throttle(method) {\n for (var _len2 = arguments.length, args = Array(_len2 > 3 ? _len2 - 3 : 0), _key2 = 3; _key2 < _len2; _key2++) {\n args[_key2 - 3] = arguments[_key2];\n }\n\n var delay = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 100;\n var context = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : window;\n\n clearTimeout(method.tiid);\n var current = new Date();\n if (method.tdate === void 0 || current - method.tdate > delay) {\n method.apply(context, args);\n method.tdate = current;\n } else {\n method.tiid = setTimeout(function () {\n return method.apply(context, args);\n }, delay);\n }\n }\n }\n};\n\n/***/ }),\n\n/***/ 24:\n/***/ (function(module, exports, __webpack_require__) {\n\nvar $ = __webpack_require__(4);\n\nvar _require = __webpack_require__(2),\n math = _require.math,\n ui = _require.ui,\n func = _require.func;\n\nvar browser = __webpack_require__(11);\n__webpack_require__(5);\n\nvar _network = window._network;\n\nvar COLUMN_CHANGED_TYPE = {\n REORDER: 'reorder',\n RESIZE: 'resize',\n SORT: 'sort'\n};\nvar COLUMN_TYPE = {\n common: 0,\n input: 1,\n dropdown: 2,\n checkbox: 3\n};\n\nvar REFRESH_INTERVAL = !browser.isMobile() && browser.isChrome() ? 0 : 32;\n\nvar MAX_COLUMN_BIT = 10;\nvar MAX_COLUMN_MASK = 0x3ff;\nvar VIRTUAL_COUNT = 100;\nvar REDUN_NUM = 4;\nvar MINI_DRAG_OFFSET = 4;\nvar MINI_COLUMN_WIDTH = 50;\n\nfunction GridView(p) {\n this.columns = [];\n this._source = [];\n this.source = this._source;\n this.lang = {\n all: '( All )',\n ok: 'OK',\n reset: 'Reset'\n };\n this.virtualCount = VIRTUAL_COUNT;\n this.rowHeight = 27;\n this.filterRowHeight = 26;\n this.total = null;\n this.height = null;\n this.virtual = false;\n this.startIndex = 0;\n this.sortIndex = -1;\n this.sortDirection = 1;\n this.selectedColumnIndex = -1;\n this.selectedIndexes = [];\n this.canMultiSelect = false;\n this.allowHtml = false;\n this.oddStyle = false;\n\n this.$parent = p;\n this.$el = null;\n this.$refs = {};\n this.$elems = {};\n this.$window = window;\n\n this.willselect = null;\n this.selectedrowchanged = null;\n this.celldblclick = null;\n this.cellclick = null;\n this.rowdblclick = null;\n this.columnchanged = null;\n}\nGridView.prototype = {\n get sortKey() {\n var c = this.columns && this.columns[this.sortIndex];\n return c && c.key;\n },\n get selectedIndex() {\n if (this.selectedIndexes != null && this.selectedIndexes.length > 0) {\n return this.selectedIndexes[0];\n }\n return -1;\n },\n get innerSource() {\n return this._source;\n },\n set innerSource(val) {\n this._source = val;\n this.source = val;\n }\n};\nGridView.COLUMN_TYPE = COLUMN_TYPE;\n\nfunction indexOfColumn(target) {\n return Array.prototype.slice.call(target.parentNode.children).indexOf(target);\n}\n\nfunction headerClick(e, force) {\n if (!force && (this._innerwidth || this._isdragging || !this._istouchdown)) {\n return;\n }\n delete this._istouchdown;\n if (this.sortable && e.target.tagName !== 'INPUT' && e.target.className !== 'data-column-header-filter' && !e.target.classList.contains('arrow') && e.target.tagName.toLowerCase() !== 'use') {\n sortColumn.call(e.data, this);\n }\n}\n\nfunction getDefault(obj, prop) {\n if (obj == null) {\n return '';\n }\n var v = obj[prop];\n if (v === void 0) {\n v = obj;\n }\n return v;\n}\n\nfunction getSpecialDefault(obj, prop) {\n var def = getDefault(obj, prop);\n if (Array.isArray(def)) {\n return def.join(',');\n }\n return def;\n}\n\nfunction distinct(key, ckey) {\n var dict = {};\n for (var i = 0; i < this.length; i += 1) {\n var item = this[i];\n var v = item.Values || item;\n var val = key == null ? v : v[key];\n var prop = getSpecialDefault(val, ckey);\n if (dict[prop] == null) {\n dict[prop] = val;\n }\n }\n if (Object.values == null) {\n Object.values = function (obj) {\n var val = [];\n\n for (var k in obj) {\n if (Object.prototype.hasOwnProperty.call(obj, k)) {\n val.push(obj[k]);\n }\n }\n return val;\n };\n }\n return Object.values(dict);\n}\n\nfunction toLowerCase(str) {\n if (str == null) {\n return String(null);\n }\n return String(str).toLowerCase();\n}\n\nfunction onFilterChecked(holder, cball) {\n return function onchecked(e) {\n if (e != null) {\n var target = $(e.target);\n target.data('item').__checked = target.prop('checked');\n }\n var cbs = holder.find('.data-filter-items-item input');\n for (var i = 0; i < cbs.length; i += 1) {\n if (!$(cbs[i]).prop('checked')) {\n cball.prop('checked', false);\n return;\n }\n }\n cball.prop('checked', true);\n };\n}\n\nfunction doFillFilterItem(holder, array, cball) {\n var onchecked = onFilterChecked(holder, cball);\n for (var i = 0; i < array.length; i += 1) {\n var item = array[i];\n var itemdiv = $('<div class=\"data-filter-items-item\"></div>');\n var wrapper = $('<label></label>');\n var checkbox = $('<input type=\"checkbox\"></input>').data('item', item);\n var displayValue = void 0;\n if (!this.filterCustom && typeof this.filter === 'function') {\n var o = {};\n o[this.key] = item;\n displayValue = this.filter(o);\n } else {\n displayValue = getDefault(item, 'DisplayValue');\n }\n\n checkbox.data('text', displayValue).prop('checked', item.__checked).on('change', onchecked);\n wrapper.append(checkbox);\n wrapper.append($('<layer class=\"check-box-inner\"><svg><use xlink:href=\"#gridview-check\"></use></svg></layer>'));\n var label = $('<span></span>').text(displayValue);\n wrapper.append(label);\n itemdiv.append(wrapper);\n holder.append(itemdiv);\n }\n}\n\nfunction fillFilterItem(grid, holder, items, cball) {\n holder.children('.data-filter-items-sizeholder').remove();\n holder.children('.data-filter-items-contentholder').remove();\n var filterRowHeight = grid.filterRowHeight;\n var height = items.length * filterRowHeight;\n this.__filterHeight = height;\n var sizeHolder = $('<div class=\"data-filter-items-sizeholder\"></div>').css('height', height);\n holder.append(sizeHolder);\n var itemsHolder = $('<div class=\"data-filter-items-contentholder\"></div>').css('top', filterRowHeight);\n holder.data('items', items);\n for (var i = 0; i < items.length; i += 1) {\n var item = items[i];\n item.__checked = this.filterValues == null || this.filterValues.indexOf(getSpecialDefault(item, 'Value')) >= 0;\n }\n var array = void 0;\n if (items.length > 12) {\n array = items.slice(0, 12);\n } else {\n array = items;\n }\n doFillFilterItem.call(this, itemsHolder, array, cball);\n holder.append(itemsHolder);\n}\n\nfunction filterOnScroll(grid, top) {\n var filterRowHeight = grid.filterRowHeight;\n top -= top % (filterRowHeight * 2) + filterRowHeight;\n if (top < 0) {\n top = 0;\n } else {\n var bottomTop = this.__filterHeight - 12 * filterRowHeight;\n if (bottomTop < 0) {\n bottomTop = 0;\n }\n if (top > bottomTop) {\n top = bottomTop;\n }\n }\n if (this.__filterTop !== top) {\n this.__filterTop = top;\n var startIndex = top / filterRowHeight;\n this.__filterStartIndex = startIndex;\n var array = this.__itemHolder.data('items');\n if (startIndex + 12 < array.length) {\n array = array.slice(startIndex, startIndex + 12);\n } else {\n array = array.slice(-12);\n }\n var itemsHolder = this.__itemHolder.children('.data-filter-items-contentholder');\n itemsHolder.empty();\n doFillFilterItem.call(this, itemsHolder, array, this.__checkboxAll);\n\n itemsHolder[0].style.top = top + filterRowHeight + 'px';\n }\n}\n\nfunction filterClick(e) {\n var _this = this;\n\n var grid = e.data;\n var parent = $((grid.$window || window).document.body);\n var closePanel = function closePanel(e1) {\n if (e1 != null) {\n if (e1.target.className === 'data-column-header-filter' || e1.target.classList.contains('arrow') || e1.target.tagName.toLowerCase() === 'use') {\n return;\n }\n }\n var items = _this.__itemHolder.data('items');\n if (items != null) {\n for (var i = 0; i < items.length; i += 1) {\n delete items[i].__checked;\n }\n }\n parent.children('.data-column-header-filter-panel').removeClass('active');\n setTimeout(function () {\n return parent.children('.data-column-header-filter-panel').remove();\n }, 120);\n };\n parent.children('.data-column-header-filter-panel').remove();\n $(document).off('.filterpanel').on('mousedown.filterpanel', closePanel).on('touchstart.filterpanel', closePanel);\n var divpanel = $('<div class=\"data-column-header-filter-panel\"></div>').on('mousedown', function (e1) {\n return e1.stopPropagation();\n }).on('touchstart', function (e1) {\n return e1.stopPropagation();\n });\n var th = $(e.currentTarget).parent();\n var offset = th.offset();\n var width = th.width();\n divpanel.css({\n top: offset.top + th.height(),\n left: offset.left + (width > 200 ? width - 200 : 0)\n });\n\n var itemHolder = $('<div class=\"data-filter-items-holder\"></div>');\n this.__itemHolder = itemHolder;\n if (typeof this.onFillItems === 'function') {\n itemHolder.css('overflow-y', 'hidden');\n var hasSearch = false;\n if (typeof this.onFillSearch === 'function') {\n var search = this.onFillSearch();\n if (search != null) {\n var searchHolder = $('<div class=\"data-filter-search-holder\"></div>');\n searchHolder.append(search);\n divpanel.append(searchHolder);\n hasSearch = true;\n }\n }\n if (!hasSearch) {\n itemHolder.css('height', 280);\n } else {\n itemHolder.css('height', 250);\n }\n divpanel.append(itemHolder);\n this.onFillItems(itemHolder, divpanel);\n } else {\n var searchbox = null;\n if (this.allowSearch !== false) {\n var _searchHolder = $('<div class=\"data-filter-search-holder\"></div>');\n searchbox = $('<input type=\"text\" class=\"data-filter-search-box\"/>');\n var searchiconClick = function searchiconClick(e2) {\n return e2.data.focus();\n };\n var searchicon = $('<svg class=\"data-filter-search-icon\"><use xlink:href=\"#search\"></use></svg>').on('mouseup', searchbox, searchiconClick).on('touchend', searchbox, searchiconClick);\n _searchHolder.append(searchbox, searchicon);\n divpanel.append(_searchHolder);\n }\n itemHolder[0].addEventListener('scroll', function (e2) {\n func.throttle(filterOnScroll, REFRESH_INTERVAL, _this, grid, e2.target.scrollTop);\n }, { passive: true });\n var itemdivall = $('<div class=\"data-filter-items-item\"></div>');\n var wrapper = $('<label></label>');\n var checkboxall = $('<input type=\"checkbox\"></input>');\n this.__checkboxAll = checkboxall;\n wrapper.append(checkboxall);\n wrapper.append($('<layer class=\"check-box-inner\"><svg><use xlink:href=\"#gridview-check\"></use></svg></layer>'));\n wrapper.append($('<span></span>').text(grid.lang.all));\n itemdivall.append(wrapper);\n itemHolder.append(itemdivall);\n var array = void 0;\n if (this.filterSource != null) {\n if (typeof this.filterSource === 'function') {\n array = this.filterSource.call(grid, this);\n } else {\n array = this.filterSource;\n }\n } else {\n array = distinct.call(grid.innerSource, this.key, 'Value').sort(function (a, b) {\n a = getSpecialDefault(a, 'Value');\n b = getSpecialDefault(b, 'Value');\n return a > b ? 1 : a < b ? -1 : 0;\n });\n }\n var citems = array;\n if (array.length > 0) {\n if (array[0] !== Object(array[0])) {\n citems = [];\n for (var i = 0; i < array.length; i += 1) {\n var item = array[i];\n citems.push({\n Value: item,\n DisplayValue: item == null ? '' : item\n });\n }\n }\n }\n fillFilterItem.call(this, grid, itemHolder, citems, checkboxall);\n var onchecked = onFilterChecked(itemHolder.children('.data-filter-items-contentholder'), checkboxall);\n onchecked();\n divpanel.append(itemHolder);\n if (searchbox != null) {\n searchbox.on('input propertychange', {\n column: this,\n grid: grid\n }, function (e2) {\n var key = toLowerCase(e2.currentTarget.value);\n var items = key.length === 0 ? citems : citems.filter(function (a) {\n var displayValue = void 0;\n if (!e2.data.filterCustom && typeof e2.data.filter === 'function') {\n var o = {};\n o[e2.data.key] = a;\n displayValue = e2.data.filter(o);\n } else {\n displayValue = getDefault(a, 'DisplayValue');\n }\n return toLowerCase(displayValue).indexOf(key) >= 0;\n });\n fillFilterItem.call(e2.data.column, e2.data.grid, itemHolder, items, checkboxall);\n });\n } else {\n itemHolder.css('height', 255);\n }\n checkboxall.on('change', function (e2) {\n var boxes = itemHolder.children('.data-filter-items-contentholder').find('.data-filter-items-item input');\n var checked = $(e2.target).prop('checked');\n var i = void 0;\n for (i = 0; i < boxes.length; i += 1) {\n var cb = $(boxes[i]);\n cb.prop('checked', checked);\n }\n var items = itemHolder.data('items');\n for (i = 0; i < items.length; i += 1) {\n items[i].__checked = checked;\n }\n });\n }\n if (this.filterFunctions !== false) {\n var functionBar = $('<div class=\"data-filter-items-function\"></div>');\n var buttonReset = $('<input type=\"button\"></input>').val(grid.lang.reset).on('click', function () {\n delete _this.filterValues;\n if (typeof _this.onFilterReset === 'function') {\n _this.onFilterReset(e);\n } else {\n grid.refreshGrid();\n if (typeof _this.afterFilter === 'function') {\n _this.afterFilter(grid);\n }\n }\n closePanel();\n $(e.currentTarget).removeClass('filtered').addClass('no-filter');\n });\n functionBar.append(buttonReset);\n var buttonOk = $('<input type=\"button\"></input>').val(grid.lang.ok).on('click', function () {\n if (typeof _this.onFilterOK === 'function') {\n _this.onFilterOK(e);\n } else {\n var items = itemHolder.data('items').filter(function (i) {\n return i.__checked !== false;\n });\n var filters = items.map(function (c) {\n var v = getDefault(c, 'Value');\n if (Array.isArray(v)) {\n return v.join(',');\n }\n return v;\n });\n _this.filterValues = filters;\n grid.refreshGrid();\n if (typeof _this.afterFilter === 'function') {\n _this.afterFilter(grid);\n }\n $(e.currentTarget).removeClass('no-filter').addClass('filtered');\n }\n closePanel();\n });\n functionBar.append(buttonOk);\n divpanel.append(functionBar);\n }\n parent.append(divpanel);\n setTimeout(function () {\n return divpanel.addClass('active');\n }, 1);\n}\n\nfunction dragStart(e) {\n var _this2 = this;\n\n this._istouchdown = true;\n if (this.orderable === false || this.isfixed || e.target.tagName === 'INPUT' || e.target.className === 'data-column-header-filter' || e.target.classList.contains('arrow') || e.target.tagName.toLowerCase() === 'use') {\n return;\n }\n\n\n var _cx = ui.getClientX(e);\n var _index = indexOfColumn(e.currentTarget);\n\n var dragmove = function dragmove(e2) {\n var cx = ui.getClientX(e2);\n var offset = cx - _cx;\n var isdragging = _this2._isdragging;\n if (!isdragging && (offset > MINI_DRAG_OFFSET || offset < -MINI_DRAG_OFFSET)) {\n isdragging = true;\n _this2._isdragging = true;\n }\n if (isdragging) {\n if (offset !== _this2._offset) {\n columnDragging.call(e.data, _index, offset, cx);\n _this2._offset = offset;\n }\n }\n };\n var dragend = function dragend(e2) {\n $(e.data.$window || window).off('.dragging');\n if (_this2._isdragging) {\n delete _this2._isdragging;\n delete _this2._offset;\n\n columnDragstop.call(e.data, _index);\n } else if (e2.originalEvent && e2.originalEvent.touches) {\n headerClick.call(_this2, e2);\n }\n };\n var bindDragmove = func.throttle.bind(this, dragmove, REFRESH_INTERVAL, null);\n\n $(e.data.$window || window).on('mousemove.dragging', bindDragmove).on('mouseup.dragging', dragend).on('touchmove.dragging', bindDragmove).on('touchend.dragging', dragend);\n}\n\nfunction resizeStart(e) {\n var _this3 = this;\n\n e.stopPropagation();\n e.preventDefault();\n\n var _cx = ui.getClientX(e);\n var _width = this.width;\n var _index = indexOfColumn(e.currentTarget.parentNode);\n if (this.isfixed) {\n var baseWidth = 0;\n for (var i = 0; i < e.data.fixedColumns.length; i += 1) {\n if (_index !== i && e.data.fixedColumns[i].visible !== false) {\n baseWidth += e.data.fixedColumns[i].width + 1;\n }\n }\n e.data._baseWidth = baseWidth;\n }\n\n var resizemove = function resizemove(e2) {\n var cx = ui.getClientX(e2);\n var val = _width + (cx - _cx);\n if (val < MINI_COLUMN_WIDTH) {\n return;\n }\n _this3._innerwidth = val;\n\n widthChanging.call(e.data, _index, val);\n };\n var resizeend = function resizeend() {\n $(e.data.$window || window).off('.resizing');\n delete e.data._baseWidth;\n var width = _this3._innerwidth;\n if (width != null) {\n _this3.autoResize = false;\n delete _this3._innerwidth;\n\n widthChanged.call(e.data, _index, width);\n }\n };\n var bindResizemove = func.throttle.bind(this, resizemove, REFRESH_INTERVAL, null);\n $(e.data.$window || window).on('mousemove.resizing', bindResizemove).on('mouseup.resizing', resizeend).on('touchmove.resizing', bindResizemove).on('touchend.resizing', resizeend);\n}\n\nfunction changeColumnWidth(index, width) {\n var isFixed = this.columns[index].isfixed;\n var oldWidth = this.columns[index].width;\n var w = width + 'px';\n this.columns[index].width = width;\n this.columns[index].style.width = width;\n this.columns[index].style['max-width'] = width;\n this.columns[index].style['min-width'] = width;\n var element = this.$refs.header[0].children[index];\n element.style.width = w;\n element.style.maxWidth = w;\n element.style.minWidth = w;\n if (isFixed) {\n element = this.$refs.header_fixed[0].children[index];\n element.style.width = w;\n element.style.maxWidth = w;\n element.style.minWidth = w;\n if (this._baseWidth >= 0) {\n this.$el_fixed[0].style.width = this._baseWidth + width + 1 + 'px';\n }\n }\n var rows = this.$elems.gridbodyContent.children;\n if (rows.length > 0) {\n for (var i = 0; i < rows.length; i += 1) {\n element = rows[i].children[index];\n if (element == null) {\n continue;\n }\n element.style.width = w;\n element.style.maxWidth = w;\n element.style.minWidth = w;\n }\n } else {\n width = this.$refs.gridbodyContainer[0].offsetWidth - oldWidth + width;\n this.$refs.gridbodyContainer[0].style.width = width + 'px';\n }\n if (isFixed) {\n rows = this.$elems.gridbodyContent_fixed.children;\n if (rows.length > 0) {\n for (var _i = 0; _i < rows.length; _i += 1) {\n element = rows[_i].children[index];\n if (element == null) {\n continue;\n }\n element.style.width = w;\n element.style.maxWidth = w;\n element.style.minWidth = w;\n }\n } else {\n width = this.$refs.gridbodyContainer_fixed[0].offsetWidth - oldWidth + width;\n this.$refs.gridbodyContainer_fixed[0].style.width = width + 'px';\n }\n }\n if (this.$refs.total != null) {\n element = this.$refs.gridtotalbody[0].children[index].children[0];\n element.style.width = w;\n element.style.maxWidth = w;\n element.style.minWidth = w;\n if (this.$refs.gridtotalbody_fixed != null && this.$refs.gridtotalbody_fixed[0].children[index] != null) {\n element = this.$refs.gridtotalbody_fixed[0].children[index].children[0];\n element.style.width = w;\n element.style.maxWidth = w;\n element.style.minWidth = w;\n }\n }\n}\n\nfunction widthChanging(index, width) {\n changeColumnWidth.call(this, index, width);\n this.resize();\n if (typeof this.columnchanging === 'function') {\n this.columnchanging(COLUMN_CHANGED_TYPE.RESIZE, index, width);\n }\n}\n\nfunction columnDragging(index, offset, clientX) {\n var children = this.$refs.header[0].children;\n var col = children[index];\n this.$refs.dragger.css({\n left: col.offsetLeft + offset,\n width: col.style.width\n }).show();\n this.$refs.draggerCursor.show();\n offset = clientX - ui.getOffsetLeft(col);\n var idx = void 0;\n if (offset < 0) {\n offset = -offset;\n for (var i = index - 1; i >= 0 && offset >= 0; i -= 1) {\n col = children[i];\n if (!col || (' ' + col.className + ' ').indexOf(' data-column-header ') < 0) {\n break;\n }\n if (offset < col.offsetWidth) {\n idx = offset > col.offsetWidth / 2 ? i : i + 1;\n break;\n }\n offset -= col.offsetWidth;\n }\n if (idx == null) {\n idx = 0;\n }\n if (this.fixedColumns != null && idx < this.fixedColumns.length) {\n idx = this.fixedColumns.length;\n }\n } else {\n var count = children.length;\n for (var _i2 = index; _i2 < count - 1 && offset >= 0; _i2 += 1) {\n col = children[_i2];\n if (!col || (' ' + col.className + ' ').indexOf(' data-column-header ') < 0) {\n idx = _i2;\n break;\n }\n if (offset < col.offsetWidth) {\n idx = offset > col.offsetWidth / 2 ? _i2 + 1 : _i2;\n break;\n }\n offset -= col.offsetWidth;\n }\n if (idx == null) {\n idx = count - 1;\n }\n }\n if (idx !== this._orderIndex) {\n this._orderIndex = idx;\n col = children[idx];\n if (!col) {\n return;\n }\n this.$refs.draggerCursor.css('left', col.offsetLeft);\n }\n}\n\nfunction columnDragstop(index) {\n this.$refs.dragger.hide();\n this.$refs.draggerCursor.hide();\n\n if (this._orderIndex >= 0 && this._orderIndex !== index) {\n var targetIndex = this._orderIndex - index;\n if (targetIndex >= 0 && targetIndex <= 1) {\n return;\n }\n var headers = this.$refs.header[0].children;\n var rows = this.$elems.gridbodyContent.children;\n var totals = this.$refs.total && this.$refs.gridtotalbody[0].children;\n\n if (targetIndex > 1) {\n targetIndex = this._orderIndex - 1;\n for (var i = index; i < targetIndex; i += 1) {\n var tmp = this.columns[i];\n this.columns[i] = this.columns[i + 1];\n this.columns[i + 1] = tmp;\n }\n\n $(headers[index]).insertAfter(headers[targetIndex]);\n for (var j = 0; j < rows.length; j += 1) {\n $(rows[j].children[index]).insertAfter(rows[j].children[targetIndex]);\n }\n if (totals != null) {\n $(totals[index]).insertAfter(totals[targetIndex]);\n }\n } else {\n targetIndex = this._orderIndex;\n for (var _i3 = index; _i3 > targetIndex; _i3 -= 1) {\n var _tmp = this.columns[_i3];\n this.columns[_i3] = this.columns[_i3 - 1];\n this.columns[_i3 - 1] = _tmp;\n }\n\n $(headers[index]).insertBefore(headers[targetIndex]);\n for (var _j = 0; _j < rows.length; _j += 1) {\n $(rows[_j].children[index]).insertBefore(rows[_j].children[targetIndex]);\n }\n if (totals != null) {\n $(totals[index]).insertBefore(totals[targetIndex]);\n }\n }\n\n for (var _i4 = 0; _i4 < headers.length; _i4 += 1) {\n var hd = headers[_i4].children[1];\n if (hd == null) {\n break;\n }\n if (hd.className !== 'arrow') {\n this.sortIndex = _i4;\n break;\n }\n }\n\n if (typeof this.columnchanged === 'function') {\n this.columnchanged(COLUMN_CHANGED_TYPE.REORDER, index, targetIndex);\n }\n }\n}\n\nfunction widthChanged(index, width) {\n for (var i = 0; i < this.innerSource.length; i += 1) {\n var keyid = i << MAX_COLUMN_BIT | index;\n if (this._overflows[keyid] != null) {\n delete this._overflows[keyid];\n }\n }\n if (typeof this.columnchanged === 'function') {\n this.columnchanged(COLUMN_CHANGED_TYPE.RESIZE, index, width);\n }\n}\n\nfunction sortColumn(column, auto, reload) {\n var _this4 = this;\n\n var index = this.columns.indexOf(column);\n if (!reload) {\n this.sortIndex = index;\n var headers = this.$refs.header[0].children;\n var fixedHeaders = this.$refs.header_fixed && this.$refs.header_fixed[0].children;\n for (var i = 0; i < headers.length; i += 1) {\n var hd = headers[i].children[1];\n var fixedHd = fixedHeaders && i < fixedHeaders.length && fixedHeaders[i].children[1];\n if (hd == null) {\n break;\n }\n if (i === index) {\n if (!auto && hd.className !== 'arrow') {\n this.sortDirection *= -1;\n }\n hd.className = 'arrow ' + (this.sortDirection > 0 ? 'asc' : 'desc');\n if (fixedHd) {\n fixedHd.className = 'arrow ' + (this.sortDirection > 0 ? 'asc' : 'desc');\n }\n } else if (hd.className !== 'arrow') {\n hd.className = 'arrow';\n if (fixedHd) {\n fixedHd.className = 'arrow';\n }\n }\n }\n }\n var comparer = void 0;\n if (column.sortFilter == null) {\n comparer = function comparer(a, b) {\n var ta = a.Values[column.key];\n var tb = b.Values[column.key];\n if ((ta === void 0 || tb === void 0) && column.filter) {\n a = column.filter(a.Values);\n b = column.filter(b.Values);\n } else {\n a = ta;\n b = tb;\n }\n if (a != null && a.Value !== void 0) {\n a = a.Value;\n }\n if (b != null && b.Value !== void 0) {\n b = b.Value;\n }\n if (a == null && typeof b === 'number') {\n a = 0;\n } else if (typeof a === 'number' && b == null) {\n b = 0;\n } else if (a != null && b == null) {\n return _this4.sortDirection;\n } else if (typeof a === 'string' && typeof b === 'string') {\n a = a.toLowerCase();\n b = b.toLowerCase();\n }\n return a === b ? 0 : (a > b ? 1 : -1) * _this4.sortDirection;\n };\n } else {\n comparer = function comparer(a, b) {\n return column.sortFilter(a, b) * _this4.sortDirection;\n };\n }\n this.source.sort(comparer);\n this.refresh();\n if (!reload && !auto && typeof this.columnchanged === 'function') {\n this.columnchanged(COLUMN_CHANGED_TYPE.SORT, index, this.sortDirection);\n }\n}\n\nfunction checkAllColumn(column, check) {\n if (this.source == null) {\n return;\n }\n var key = column.key;\n var itemEnabled = typeof column.enabled === 'string';\n var onchanged = column.onchanged;\n if (column.checkall != null) {\n column.checkall.call(this, column, check);\n } else {\n for (var i = 0; i < this.source.length; i += 1) {\n var item = this.source[i].Values;\n if (item == null) {\n continue;\n }\n var enabled = itemEnabled ? item[column.enabled] : column.enabled;\n if (enabled !== false) {\n item[key] = check;\n item.__internal_changed = true;\n if (onchanged != null) {\n onchanged.call(this, item, check);\n }\n }\n }\n }\n this.refresh();\n}\n\nfunction checkRow(e, index, col) {\n if (this.source == null) {\n return;\n }\n var item = this.source[this.startIndex + index].Values;\n if (item == null) {\n return;\n }\n var enabled = typeof col.enabled === 'string' ? item[col.enabled] : col.enabled;\n if (enabled !== false) {\n item[col.key] = e.target.checked;\n item.__internal_changed = true;\n if (col.onchanged != null) {\n col.onchanged.call(this, item, e.target.checked);\n }\n }\n}\n\nfunction scrollToTop(top, flag) {\n var ROW_HEIGHT = this.rowHeight;\n top -= top % (ROW_HEIGHT * 2) + REDUN_NUM * ROW_HEIGHT;\n if (top < 0) {\n top = 0;\n } else {\n var bottomTop = this._containerHeight - (flag ? 0 : this._bodyRowCount * ROW_HEIGHT);\n if (bottomTop < 0) {\n bottomTop = 0;\n }\n if (top > bottomTop) {\n top = bottomTop;\n }\n }\n if (this._scrollTop !== top) {\n this._scrollTop = top;\n if (this.virtual) {\n this.startIndex = top / ROW_HEIGHT;\n }\n this.refresh();\n if (this.virtual) {\n this.$refs.gridbodyContent[0].style.top = top + 'px';\n if (this.$refs.gridbodyContent_fixed != null) {\n this.$refs.gridbodyContent_fixed[0].style.top = top + 'px';\n }\n }\n } else if (flag) {\n this.refresh();\n }\n\n return top;\n}\n\nfunction gridonscroll(e) {\n this.resetScroll(e.target);\n if (!this.virtual) {\n return;\n }\n var top = e.target.scrollTop;\n scrollToTop.call(this, top);\n}\n\nfunction getColumnIndex(target, istotal) {\n if (target == null) {\n return -1;\n }\n var parent = void 0;\n\n while ((parent = target.parentNode) != null && (' ' + parent.className + ' ').indexOf(' data-grid-row ') < 0 && (' ' + parent.className + ' ').indexOf(' data-grid-total-body ') < 0) {\n target = parent;\n }\n if (parent == null) {\n return -1;\n }\n\n var max = parent.children.length - (istotal ? 0 : 1);\n for (var i = 0; i < max; i += 1) {\n if (target === parent.children[i]) {\n return i;\n }\n }\n return -1;\n}\n\nfunction rowOnClick(e, index, colindex) {\n var startIndex = this.startIndex;\n var selectedIndex = index + startIndex;\n if (typeof this.willselect === 'function' && !this.willselect(selectedIndex, colindex)) {\n return;\n }\n\n var flag = false;\n var selected = this.selectedIndexes;\n if (this.canMultiSelect) {\n if (e.ctrlKey) {\n var i = selected.indexOf(selectedIndex);\n if (i < 0) {\n selected.push(selectedIndex);\n flag = true;\n } else {\n selected.splice(i, 1);\n flag = true;\n }\n } else if (e.shiftKey && selected.length > 0) {\n if (selected.length > 1 || selected[0] !== selectedIndex) {\n var start = selected[selected.length - 1];\n var end = void 0;\n if (start > selectedIndex) {\n end = start;\n start = selectedIndex;\n } else {\n end = selectedIndex;\n }\n selected.splice(0);\n for (var _i5 = start; _i5 <= end; _i5 += 1) {\n selected.push(_i5);\n }\n flag = true;\n }\n } else if (selected.length !== 1 || selected[0] !== selectedIndex) {\n selected.splice(0, selected.length, selectedIndex);\n flag = true;\n }\n } else if (selected.length !== 1 || selected[0] !== selectedIndex) {\n selected.splice(0, selected.length, selectedIndex);\n flag = true;\n }\n\n if (flag) {\n if (this.isEditable) {\n var length = this.$elems.gridbodyContent.children.length;\n for (var _i6 = 0; _i6 < length; _i6 += 1) {\n var item = this.source[_i6 + startIndex];\n if (selected.indexOf(_i6 + startIndex) >= 0) {\n item.__selected = true;\n } else {\n delete item.__selected;\n }\n var changes = item.Values.__changed;\n if (changes != null) {\n for (var j = 0; j < this.columns.length; j += 1) {\n var col = this.columns[j];\n if (Object.prototype.hasOwnProperty.call(changes, col.key)) {\n if (typeof col.onchanged === 'function') {\n col.onchanged.call(this, item.Values);\n }\n delete changes[col.key];\n }\n }\n }\n }\n this.refresh();\n } else {\n var rows = this.$elems.gridbodyContent.children;\n var fixedRows = this.$elems.gridbodyContent_fixed && this.$elems.gridbodyContent_fixed.children;\n for (var _i7 = 0; _i7 < rows.length; _i7 += 1) {\n if (selected.indexOf(_i7 + startIndex) >= 0) {\n rows[_i7].className = 'data-grid-row data-grid-row-selected';\n if (fixedRows != null) {\n fixedRows[_i7].className = 'data-grid-row data-grid-row-selected';\n }\n } else if (rows[_i7].className !== 'data-grid-row') {\n rows[_i7].className = 'data-grid-row';\n if (fixedRows != null) {\n fixedRows[_i7].className = 'data-grid-row';\n }\n }\n }\n }\n if (typeof this.selectedrowchanged === 'function') {\n this.selectedrowchanged(selectedIndex);\n }\n }\n var colIndex = colindex != null ? colindex : getColumnIndex(e.target);\n this.selectedColumnIndex = colIndex;\n if ((this.allowFullrowClick || colIndex >= 0) && (e.buttons === 1 || e.originalEvent instanceof TouchEvent) && typeof this.cellclick === 'function') {\n if (this.cellclick(selectedIndex, colIndex)) {\n e.stopPropagation();\n e.preventDefault();\n }\n }\n}\n\nfunction rowOnDblClick(e, istotal) {\n if (e.target.tagName === 'INPUT') {\n return;\n }\n var index = istotal ? -1 : this.selectedIndex;\n if (typeof this.rowdblclick === 'function') {\n this.rowdblclick(index);\n }\n if (typeof this.celldblclick === 'function') {\n var columnIndex = istotal ? getColumnIndex($(e.target).parents('.data-grid-total-row')[0], istotal) : this.selectedColumnIndex;\n this.celldblclick(index, columnIndex);\n }\n}\n\nfunction adjustRows(gridcontent, cols) {\n var _this5 = this;\n\n if (this._bodyRowCount == null) {\n return;\n }\n cols = cols || this.columns;\n var cnt = this._bodyRowCount;\n if (!this.virtual || this.source.length < cnt) {\n cnt = this.source.length;\n }\n var jGridContent = $(gridcontent);\n\n var childrencount = gridcontent.children.length - jGridContent.find('tr.data-grid-row-total-holder').length;\n var count = cnt - childrencount;\n if (count > 0) {\n var rows = [];\n var onrowdblclick = function onrowdblclick(e) {\n return rowOnDblClick.call(_this5, e, false);\n };\n\n var _loop = function _loop(i) {\n var onrowclick = function onrowclick(e) {\n return rowOnClick.call(_this5, e, childrencount + i);\n };\n var row = $('<tr class=\"data-grid-row\"></tr>').on('mousedown', onrowclick).on('touchstart', onrowclick).on('dblclick', onrowdblclick);\n\n var _loop2 = function _loop2(j) {\n var col = cols[j];\n var cell = $('<td></td>');\n if (col.visible === false) {\n cell.hide();\n } else {\n cell[0].keyid = childrencount + i << MAX_COLUMN_BIT | j;\n if (col.style != null) {\n cell.css(col.style);\n }\n if (col.istotal) {\n cell.addClass('data-grid-column-total');\n }\n if (col.css != null) {\n cell.css(col.css);\n }\n if (col.isurl) {\n cell.append('<a target=\"_blank\"></a>');\n } else if (col.type === COLUMN_TYPE.checkbox) {\n var checkit = function checkit(e) {\n return checkRow.call(_this5, e, childrencount + i, col);\n };\n var wrapper = $('<label></label>');\n var box = $('<input type=\"checkbox\" />').on('change', checkit);\n var checkinner = $('<layer class=\"check-box-inner\"><svg><use xlink:href=\"#gridview-check\"></use></svg></layer>');\n wrapper.append(box, checkinner);\n cell.append(wrapper);\n } else {\n cell.append('<span></span>');\n }\n }\n row.append(cell);\n };\n\n for (var j = 0; j < cols.length; j += 1) {\n _loop2(j);\n }\n row.append('<td><span></span></td>');\n rows.push(row);\n };\n\n for (var i = 0; i < count; i += 1) {\n _loop(i);\n }\n var lastRow = jGridContent.find('tr').last();\n if (lastRow.hasClass('data-grid-row-total-holder')) {\n lastRow.remove();\n }\n jGridContent.append(rows);\n if (this.total != null) {\n jGridContent.append('<tr class=\"data-grid-row-total-holder\"></tr>');\n }\n } else if (count < 0) {\n count = -count;\n for (var i = 1; i <= count; i += 1) {\n $(gridcontent.children[childrencount - i]).remove();\n }\n }\n}\n\nfunction gridbodyMouseMove(e) {\n var target = e.target;\n if (target.className === 'data-grid-hover-holder') {\n return;\n }\n var parent = void 0;\n\n while ((parent = target.parentNode) != null && (' ' + parent.className + ' ').indexOf(' data-grid-row ') < 0) {\n target = parent;\n }\n var keyid = target.keyid;\n var holder = e.data;\n if (parent == null || keyid == null) {\n holder.nowKeyid = null;\n if (holder.style.display !== 'none') {\n holder.style.display = 'none';\n }\n return;\n }\n var oldkeyid = holder.nowKeyid;\n\n keyid += this.startIndex << MAX_COLUMN_BIT;\n if (keyid === oldkeyid) {\n return;\n }\n var overflow = this._overflows[keyid];\n var targetContent = target;\n if (target.children.length > 0) {\n targetContent = target.children[0];\n }\n if (overflow == null) {\n overflow = targetContent.scrollWidth > targetContent.offsetWidth;\n this._overflows[keyid] = overflow;\n }\n if (overflow) {\n if (holder.style.display !== '') {\n holder.style.display = '';\n }\n if (oldkeyid !== keyid) {\n holder.nowKeyid = keyid;\n holder.innerText = targetContent.innerText;\n var top = this.$refs.gridbodyContent[0].offsetTop + target.offsetTop;\n var left = target.offsetLeft;\n var holderWidth = holder.offsetWidth;\n if (holderWidth > this._bodyClientWidth) {\n holderWidth = this._bodyClientWidth;\n }\n var maxleft = this._bodyClientWidth + this._scrollLeft - holderWidth;\n if (left > maxleft) {\n left = maxleft;\n }\n var height = targetContent.offsetHeight;\n holder.style.cssText = 'top: ' + top + 'px; left: ' + left + 'px; max-width: ' + this._bodyClientWidth + 'px; height: ' + (height - 2) + 'px';\n }\n } else {\n if (oldkeyid != null) {\n holder.nowKeyid = null;\n }\n if (holder.style.display !== 'none') {\n holder.style.display = 'none';\n }\n }\n}\n\nfunction tableHeaderMouseEnter() {\n var holder = this.$refs.gridbody.find('.data-grid-hover-holder')[0];\n if (holder != null) {\n if (holder.nowKeyid != null) {\n holder.nowKeyid = null;\n }\n if (holder.style.display !== 'none') {\n holder.style.display = 'none';\n }\n }\n if (this.$refs.gridbody_fixed != null) {\n holder = this.$refs.gridbody_fixed.find('.data-grid-hover-holder')[0];\n if (holder != null) {\n if (holder.nowKeyid != null) {\n holder.nowKeyid = null;\n }\n if (holder.style.display !== 'none') {\n holder.style.display = 'none';\n }\n }\n }\n}\n\nfunction createHeader(cols) {\n var _this6 = this;\n\n var prefix = cols == null ? '' : '_fixed';\n cols = cols || this.columns;\n var table = $('<table class=\"data-grid-table-header\"></table>');\n var header = $('<tr class=\"data-grid-header\"></tr>');\n table.on('mouseenter', function () {\n return tableHeaderMouseEnter.call(_this6);\n });\n table.append(header);\n\n var sizeHolder = this.$elems.sizeHolder;\n\n var _loop3 = function _loop3(i) {\n var col = cols[i];\n if (col.visible === false) {\n if (col.sortable === true) {\n var sortclick = function sortclick(e) {\n return headerClick.call(col, e, true);\n };\n header.append($('<th class=\"data-column-header\"><div></div><span></span></th>').hide().attr('data-key', col.key).on('mouseup', _this6, sortclick));\n } else {\n header.append($('<th class=\"data-column-header\"><div></div><span></span></th>').hide());\n }\n return 'continue';\n }\n if (col.width > 0 || col.isShrink) {\n col.autoResize = false;\n } else {\n col.autoResize = true;\n _this6._needAutoResize = true;\n sizeHolder.text(col.caption);\n var headerWidth = sizeHolder.width() + 20;\n if (headerWidth < MINI_COLUMN_WIDTH) {\n headerWidth = MINI_COLUMN_WIDTH;\n }\n col.width = headerWidth;\n }\n if (col.align == null) {\n col.align = 'left';\n }\n if (col.istotal) {\n col.sortable = false;\n } else if (col.sortable !== false && col.caption != null && String(col.caption).length > 0) {\n col.sortable = true;\n }\n if (col.isShrink) {\n col.style = { 'text-align': col.align };\n } else {\n col.style = {\n width: col.width,\n 'max-width': col.width,\n 'min-width': col.width,\n 'text-align': col.align\n };\n }\n var click = function click(e) {\n return headerClick.call(col, e);\n };\n var drag = function drag(e) {\n return dragStart.call(col, e);\n };\n var resize = function resize(e) {\n return resizeStart.call(col, e);\n };\n var allcheck = function allcheck(e) {\n return checkAllColumn.call(_this6, col, $(e.target).prop('checked'));\n };\n var th = $('<th class=\"data-column-header\"></th>').attr('data-key', col.key).css(col.style).css('cursor', col.sortable ? 'pointer' : 'auto').on('mouseup', _this6, click).on('touchend', _this6, click).on('mousedown', _this6, drag).on('touchstart', _this6, drag);\n if (col.istotal) {\n th.addClass('data-grid-column-header-total');\n }\n if (col.enabled !== false && col.allcheck && col.type === COLUMN_TYPE.checkbox) {\n var wrapper = $('<label></label>');\n var check = $('<input type=\"checkbox\" />').on('change', allcheck);\n var checkinner = $('<layer class=\"check-box-inner\"><svg><use xlink:href=\"#gridview-check\"></use></svg></layer>');\n wrapper.append(check, checkinner);\n if (col.caption == null || col.caption.length === 0) {\n col.sortable = false;\n }\n th.append($('<div class=\"data-column-header-text\"></div>').css(col.textStyle || {}).append($('<span></span>').append(wrapper, $('<span></span>').text(col.caption).attr('title', _this6.headerTitle !== false ? col.caption : ''))));\n } else if (typeof col.caption === 'function') {\n th.append($('<div class=\"data-column-header-text\"></div>').css(col.textStyle || {}).append(col.caption()));\n } else {\n th.append($('<div class=\"data-column-header-text\"></div>').css(col.textStyle || {}).append($('<span></span>').text(col.caption).attr('title', _this6.headerTitle !== false ? col.caption : '')));\n }\n th.append($('<span class=\"arrow\"></span>'));\n if (col.allowFilter) {\n var filterclick = function filterclick(e) {\n return filterClick.call(col, e);\n };\n var filter = $('<div class=\"data-column-header-filter no-filter\"><svg class=\"arrow no-filter\"><use xlink:href=\"#ellipsis-h\"></use></svg><svg class=\"arrow filtered\"><use xlink:href=\"#filter\"></use></svg></div>').on('mousedown', _this6, filterclick).on('touchstart', _this6, filterclick);\n if (col.isFiltered) {\n filter.removeClass('no-filter').addClass('filtered');\n }\n th.addClass('data-column-header-has-filter').append(filter);\n }\n var split = $('<span class=\"data-column-header-split\"><div></div></span>').on('mousedown', _this6, resize).on('touchstart', _this6, resize);\n if (col.resizable === false) {\n split.css('display', 'none');\n }\n if (col.tooltip != null) {\n var tooltip = col.tooltip;\n if (typeof tooltip === 'function') {\n tooltip = tooltip(col);\n }\n th.attr('title', tooltip);\n }\n th.append(split);\n header.append(th);\n };\n\n for (var i = 0; i < cols.length; i += 1) {\n var _ret3 = _loop3(i);\n\n if (_ret3 === 'continue') continue;\n }\n header.append('<th class=\"data-column-header-holder\">&nbsp;</th>');\n var dragger = $('<div class=\"data-column-header-dragger\"></div>').hide();\n var draggerCursor = $('<div class=\"data-column-header-dragger-cursor\"></div>').hide();\n header.append($('<th></th>').append(dragger, draggerCursor));\n\n sizeHolder.empty();\n this.$refs['headerTable' + prefix] = table;\n this.$refs['header' + prefix] = header;\n this.$refs['dragger' + prefix] = dragger;\n this.$refs['draggerCursor' + prefix] = draggerCursor;\n return table;\n}\n\nfunction createBody(cols) {\n var _this7 = this;\n\n var prefix = cols == null ? '' : '_fixed';\n var gridbody = $('<div class=\"data-grid-body\"></div>');\n if (this.oddStyle) {\n gridbody.addClass('data-grid-odd-style');\n } else {\n gridbody.addClass('data-grid-even-style');\n }\n if (cols == null) {\n gridbody[0].addEventListener('scroll', function (e) {\n if (_this7.$refs.gridbody_fixed != null) {\n _this7.$refs.gridbody_fixed[0].scrollTop = e.target.scrollTop;\n }\n func.throttle(gridonscroll, REFRESH_INTERVAL, _this7, e);\n }, { passive: true });\n } else {\n gridbody.on('mousewheel DOMMouseScroll', function (e) {\n var delta = -e.originalEvent.wheelDelta || e.originalEvent.detail * 40;\n var evt = { target: _this7.$refs.gridbody[0] };\n evt.target.scrollTop += delta;\n gridonscroll.call(_this7, evt);\n });\n }\n cols = cols || this.columns;\n this._containerHeight = this.source.length * this.rowHeight;\n\n var width = void 0;\n if (this._containerHeight === 0) {\n this._containerHeight = 1;\n width = 0;\n for (var i = 0; i < cols.length; i += 1) {\n if (cols[i].visible !== false && !isNaN(cols[i].width)) {\n width += cols[i].width + 1;\n }\n }\n width += 1;\n } else {\n width = null;\n }\n var gridbodyContainer = $('<div></div>').css({\n position: 'relative',\n 'min-width': '100%',\n 'min-height': 1,\n height: this._containerHeight,\n width: width\n });\n gridbody.append(gridbodyContainer);\n\n var gridcontent = $('<table class=\"data-grid-body-content\"><tbody></tbody></table>');\n var tbody = gridcontent.children('tbody')[0];\n gridbodyContainer.append(gridcontent);\n\n adjustRows.call(this, tbody, cols);\n\n var onrowclick = function onrowclick(e) {\n var keyid = e.currentTarget.nowKeyid;\n if (keyid == null) {\n return;\n }\n\n return rowOnClick.call(_this7, e, (keyid >>> MAX_COLUMN_BIT) - _this7.startIndex, keyid & MAX_COLUMN_MASK);\n };\n var onrowdblclick = function onrowdblclick(e) {\n return rowOnDblClick.call(_this7, e, false);\n };\n if (!this.noHoverHolder) {\n var hoverHolder = $('<div class=\"data-grid-hover-holder\"></div>').hide().on('mousedown', onrowclick).on('touchstart', onrowclick).on('dblclick', onrowdblclick);\n gridbodyContainer.append(hoverHolder);\n gridbody.on('mousemove', hoverHolder[0], function (e) {\n return func.throttle(gridbodyMouseMove, REFRESH_INTERVAL, _this7, e);\n });\n }\n\n this.$refs['gridbody' + prefix] = gridbody;\n this.$refs['gridbodyContainer' + prefix] = gridbodyContainer;\n this.$refs['gridbodyContent' + prefix] = gridcontent;\n this.$elems['gridbodyContent' + prefix] = tbody;\n\n this.refresh();\n return gridbody;\n}\n\nfunction createTotals(cols) {\n var _this8 = this;\n\n if (this.total == null) {\n return null;\n }\n var prefix = cols == null ? '' : '_fixed';\n var total = $('<div class=\"data-grid-total\"></div>');\n var gridtotal = $('<table class=\"data-grid-table-total\"></table>');\n total.append(gridtotal);\n var onrowdblclick = function onrowdblclick(e) {\n return rowOnDblClick.call(_this8, e, true);\n };\n var totalbody = $('<tr class=\"data-grid-total-body\"></tr>').on('dblclick', onrowdblclick);\n gridtotal.append(totalbody);\n\n var sizeHolder = this.$elems.sizeHolder;\n cols = cols || this.columns;\n for (var i = 0; i < cols.length; i += 1) {\n var _col = cols[i];\n var _th = $('<th class=\"data-grid-total-row\"></th>');\n if (_col.visible === false) {\n _th.hide();\n } else {\n var val = void 0;\n if (_col.istotal) {\n val = null;\n } else {\n val = this.total[_col.key];\n if (val != null && val.DisplayValue != null) {\n val = val.DisplayValue;\n }\n }\n if (val == null) {\n val = '';\n }\n if (_col.autoResize) {\n sizeHolder.html(val);\n var totalWidth = sizeHolder.width() + 10;\n if (totalWidth > _col.width) {\n var w = totalWidth + 'px';\n this.$refs.header[0].children[i].style.width = w;\n this.$refs.header[0].children[i].style.minWidth = w;\n this.$refs.header[0].children[i].style.maxWidth = w;\n _col.width = totalWidth;\n _col.style.width = totalWidth;\n _col.style['max-width'] = totalWidth;\n _col.style['min-width'] = totalWidth;\n }\n }\n _th.append($('<div></div>').css(_col.style).html(val));\n }\n totalbody.append(_th);\n }\n\n sizeHolder.empty();\n this.$refs['gridtotal' + prefix] = gridtotal;\n this.$refs['gridtotalbody' + prefix] = totalbody;\n this.$refs['total' + prefix] = total;\n return total;\n}\n\nGridView.prototype.init = function init(p) {\n var _this9 = this;\n\n delete this.$elems.sizeHolder;\n delete this.$el;\n this.$refs = {};\n this._rendering = true;\n this._overflows = {};\n this._scrollLeft = 0;\n\n this.innerSource = this.source;\n this.virtual = this.source && this.source.length > this.virtualCount;\n p = p || this.$parent;\n if (typeof p === 'string') {\n p = $(p);\n }\n if (p == null) {\n throw new Error('no specified parent.');\n }\n this.$parent = p;\n var datagrid = $('<div class=\"data-grid\" tabindex=\"0\"></div>');\n datagrid.append('<svg xmlns=\"http://www.w3.org/2000/svg\" style=\"display: none\"><symbol id=\"gridview-check\" viewBox=\"0 0 512 512\"><path d=\"M435.848 83.466L172.804 346.51l-96.652-96.652c-4.686-4.686-12.284-4.686-16.971 0l-28.284 28.284c-4.686 4.686-4.686 12.284 0 16.971l133.421 133.421c4.686 4.686 12.284 4.686 16.971 0l299.813-299.813c4.686-4.686 4.686-12.284 0-16.971l-28.284-28.284c-4.686-4.686-12.284-4.686-16.97 0z\"></path></symbol><symbol id=\"spinner-third\" viewBox=\"0 0 512 512\"><path d=\"M456.433 371.72l-27.79-16.045c-7.192-4.152-10.052-13.136-6.487-20.636 25.82-54.328 23.566-118.602-6.768-171.03-30.265-52.529-84.802-86.621-144.76-91.424C262.35 71.922 256 64.953 256 56.649V24.56c0-9.31 7.916-16.609 17.204-15.96 81.795 5.717 156.412 51.902 197.611 123.408 41.301 71.385 43.99 159.096 8.042 232.792-4.082 8.369-14.361 11.575-22.424 6.92z\"></path></symbol><symbol id=\"ellipsis-h\" viewBox=\"0 0 320 512\"><path d=\"M192 256c0 17.7-14.3 32-32 32s-32-14.3-32-32 14.3-32 32-32 32 14.3 32 32zm88-32c-17.7 0-32 14.3-32 32s14.3 32 32 32 32-14.3 32-32-14.3-32-32-32zm-240 0c-17.7 0-32 14.3-32 32s14.3 32 32 32 32-14.3 32-32-14.3-32-32-32z\"></path></symbol><symbol id=\"filter\" viewBox=\"0 0 512 512\"><path d=\"M479.968 0H32.038C3.613 0-10.729 34.487 9.41 54.627L192 237.255V424a31.996 31.996 0 0 0 10.928 24.082l64 55.983c20.438 17.883 53.072 3.68 53.072-24.082V237.255L502.595 54.627C522.695 34.528 508.45 0 479.968 0zM288 224v256l-64-56V224L32 32h448L288 224z\"></path></symbol><symbol id=\"search\" viewBox=\"0 0 512 512\"><path d=\"M508.5 481.6l-129-129c-2.3-2.3-5.3-3.5-8.5-3.5h-10.3C395 312 416 262.5 416 208 416 93.1 322.9 0 208 0S0 93.1 0 208s93.1 208 208 208c54.5 0 104-21 141.1-55.2V371c0 3.2 1.3 6.2 3.5 8.5l129 129c4.7 4.7 12.3 4.7 17 0l9.9-9.9c4.7-4.7 4.7-12.3 0-17zM208 384c-97.3 0-176-78.7-176-176S110.7 32 208 32s176 78.7 176 176-78.7 176-176 176z\"></path></symbol></svg>');\n var sizeHolder = $('<span class=\"data-grid-size-holder\"></span>');\n datagrid.on('keydown', function (e) {\n var index = _this9.selectedIndex;\n var flag = false;\n if (e.key === 'ArrowUp') {\n flag = true;\n if (index > 1) {\n delete _this9.source[index].__selected;\n index -= 1;\n } else {\n index = 0;\n }\n } else if (e.key === 'ArrowDown') {\n flag = true;\n var dataCount = _this9.source && _this9.source.length || 0;\n if (index < dataCount - 1) {\n delete _this9.source[index].__selected;\n index += 1;\n }\n }\n if (flag) {\n _this9.selectedIndexes = [index];\n _this9.scrollToIndex(index);\n _this9.source[index].__selected = true;\n _this9.refresh();\n if (typeof _this9.selectedrowchanged === 'function') {\n _this9.selectedrowchanged(index);\n }\n return false;\n }\n return true;\n });\n datagrid.append(sizeHolder);\n this.$elems.sizeHolder = sizeHolder;\n p.empty().append(datagrid);\n\n var header = createHeader.call(this);\n var totals = createTotals.call(this);\n\n datagrid.append(header);\n if (totals != null) {\n datagrid.append(totals);\n }\n var body = createBody.call(this);\n body.insertAfter(header);\n\n var fixedCount = 0;\n for (var i = 0; i < this.columns.length; i += 1) {\n if (!this.columns[i].isfixed) {\n break;\n }\n fixedCount += 1;\n }\n if (fixedCount > 0) {\n var fixedColumns = this.columns.slice(0, fixedCount);\n this.fixedColumns = fixedColumns;\n var fixedDatagrid = $('<div class=\"data-grid data-grid-fixed\"></div>');\n p.append(fixedDatagrid);\n var fixedHeader = createHeader.call(this, false);\n var fixedTotals = createTotals.call(this, false);\n\n var fixedWidth = 0;\n\n fixedColumns.forEach(function (c) {\n return fixedWidth += c.visible === false ? 0 : c.width + 1;\n });\n fixedDatagrid.css('width', fixedWidth);\n fixedDatagrid.append(fixedHeader);\n if (fixedTotals != null) {\n fixedDatagrid.append(fixedTotals);\n }\n var fixedBody = createBody.call(this, false);\n fixedBody.insertAfter(fixedHeader);\n\n this.$el_fixed = fixedDatagrid;\n }\n\n sizeHolder.remove();\n\n\n var loading = $('<div class=\"data-grid-loading\"><div><svg class=\"fa-spin fa-loading\"><use xlink:href=\"#spinner-third\"></use></svg></div></div>');\n this.$elems.loading = loading;\n datagrid.append(loading);\n this.$el = datagrid;\n\n delete this._rendering;\n if (this.sortIndex >= 0) {\n sortColumn.call(this, this.columns[this.sortIndex], true);\n } else {\n this.resize();\n }\n};\n\nfunction fillRows(els, cols, maxWidths) {\n var startIndex = this.startIndex;\n var selected = this.selectedIndexes;\n for (var i = 0; i < els.length; i += 1) {\n var vals = this.source[this.startIndex + i];\n if (!vals) {\n continue;\n }\n var item = vals.Values;\n var _row = els[i];\n if (_row.children.length <= 0) {\n continue;\n }\n\n var className = _row.className;\n if (selected.indexOf(i + startIndex) >= 0) {\n if (className !== 'data-grid-row data-grid-row-selected') {\n _row.className = 'data-grid-row data-grid-row-selected';\n }\n } else if (className !== 'data-grid-row') {\n _row.className = 'data-grid-row';\n }\n\n for (var j = 0; j < cols.length; j += 1) {\n var _col2 = cols[j];\n if (_col2.visible === false) {\n continue;\n }\n var val = void 0;\n if (_col2.text != null) {\n val = _col2.text;\n } else if (vals.__selected && typeof _col2.editFilter === 'function') {\n val = _col2.editFilter(item);\n } else if (typeof _col2.filter === 'function') {\n val = _col2.filter(item);\n } else {\n val = item[_col2.key];\n if (val != null && val.DisplayValue != null) {\n val = val.DisplayValue;\n }\n }\n if (val == null) {\n val = '';\n }\n\n var div = _row.children[j];\n var span = div.children[0];\n\n if (_col2.type === COLUMN_TYPE.checkbox) {\n var chkbox = span.querySelector('input');\n var disabled = _col2.enabled;\n if (typeof disabled === 'string') {\n disabled = item[disabled];\n } else if (typeof disabled === 'function') {\n disabled = disabled(item);\n }\n disabled = disabled === false;\n if (chkbox.disabled !== disabled) {\n chkbox.disabled = disabled;\n }\n if (chkbox.checked !== val) {\n chkbox.checked = val;\n }\n } else if (this.allowHtml || _col2.allowHtml) {\n if (val instanceof $) {\n $(span).empty().append(val);\n } else {\n span.innerHTML = val;\n }\n } else {\n span.innerText = val;\n }\n\n if (this._needAutoResize && _col2.autoResize) {\n var width = div.scrollWidth;\n if (width > 0 && maxWidths != null && (maxWidths[j] == null || maxWidths[j] < width)) {\n maxWidths[j] = width;\n maxWidths.flag = true;\n }\n }\n if (_col2.isurl) {\n var href = item[_col2.href];\n if (href != null) {\n href = href.Value || href;\n } else {\n href = '';\n }\n if (href === '' && span.href !== '') {\n span.removeAttribute('href');\n } else if (href !== span.href) {\n span.href = href;\n }\n }\n if (_col2.classFilter != null) {\n var cls = _col2.classFilter(item) || '';\n if (cls !== span.className) {\n span.className = cls;\n }\n }\n if (_col2.styleFilter != null) {\n var style = _col2.styleFilter(item);\n if (span.style.length > 0) {\n span.style.cssText = '';\n }\n\n for (var key in style) {\n if (Object.prototype.hasOwnProperty.call(style, key)) {\n span.style[key] = style[key];\n }\n }\n }\n if (_col2.bgFilter != null) {\n var bgColor = _col2.bgFilter(item);\n div.style.backgroundColor = bgColor || '';\n }\n if (_col2.events != null) {\n for (var _key in _col2.events) {\n if (Object.prototype.hasOwnProperty.call(_col2.events, _key)) {\n span[_key] = _col2.events[_key].bind(item);\n }\n }\n }\n if (_col2.attrs != null) {\n var attrs = _col2.attrs;\n if (typeof attrs === 'function') {\n attrs = attrs(item);\n }\n\n for (var _key2 in attrs) {\n if (Object.prototype.hasOwnProperty.call(attrs, _key2)) {\n span.setAttribute(_key2, attrs[_key2]);\n }\n }\n }\n }\n }\n}\n\nGridView.prototype.refresh = function refresh() {\n if (this.$refs.gridbodyContent == null) {\n throw new Error('the body has not been created.');\n }\n var els = this.$elems.gridbodyContent.children;\n var maxWidths = {};\n fillRows.call(this, els, this.columns, maxWidths);\n if (this.$elems.gridbodyContent_fixed != null) {\n fillRows.call(this, this.$elems.gridbodyContent_fixed.children, this.columns);\n }\n if (this._needAutoResize && maxWidths.flag) {\n delete this._needAutoResize;\n for (var i = 0; i < this.columns.length; i += 1) {\n if (!this.columns[i].autoResize) {\n continue;\n }\n var width = maxWidths[i];\n if (width > 0) {\n changeColumnWidth.call(this, i, width);\n }\n }\n }\n};\n\nGridView.prototype.refreshGrid = function refreshGrid() {\n var _this10 = this;\n\n this.$refs.header.find('.data-column-header-filter').removeClass('filtered').addClass('no-filter');\n var hasFixed = this.$refs.header_fixed != null;\n if (hasFixed) {\n this.$refs.header_fixed.find('.data-column-header-filter').removeClass('filtered').addClass('no-filter');\n }\n for (var i = 0; i < this.columns.length; i += 1) {\n var _col3 = this.columns[i];\n if (_col3.filterValues != null && _col3.filterValues.length > 0) {\n var ecol = this.$refs.header.children().eq(i);\n ecol.find('.data-column-header-filter').removeClass('no-filter').addClass('filtered');\n if (hasFixed) {\n ecol = this.$refs.header_fixed.children().eq(i);\n if (ecol.length > 0) {\n ecol.find('.data-column-header-filter').removeClass('no-filter').addClass('filtered');\n }\n }\n }\n }\n this.source = this.innerSource.filter(function (it) {\n for (var _i8 = 0; _i8 < _this10.columns.length; _i8 += 1) {\n var _col4 = _this10.columns[_i8];\n var v = getSpecialDefault((it.Values || it)[_col4.key], 'Value');\n if (_col4.filterValues != null && _col4.filterValues.indexOf(v) < 0) {\n return false;\n }\n }\n return true;\n });\n if (this.sortIndex >= 0) {\n sortColumn.call(this, this.columns[this.sortIndex], null, true);\n }\n this.reset();\n};\n\nGridView.prototype.resetScroll = function resetScroll(target) {\n if (this.$el == null) {\n throw new Error('grid view has not been initialized.');\n }\n if (target == null) {\n target = this.$refs.gridbody[0];\n }\n var left = target.scrollLeft;\n if (this._scrollLeft !== left) {\n this._scrollLeft = left;\n var l = -left + 'px';\n this.$refs.headerTable[0].style.marginLeft = l;\n\n if (this.$refs.gridtotal != null) {\n this.$refs.gridtotal[0].style.marginLeft = l;\n }\n if (typeof this.hscrolling === 'function') {\n this.hscrolling(-left);\n }\n }\n};\n\nGridView.prototype.resize = function resize(force) {\n if (this._rendering || this.$el == null) {\n return;\n }\n var gridbody = this.$refs.gridbody;\n var fixedGridbody = this.$refs.gridbody_fixed;\n var fixedHeaderTable = this.$refs.headerTable_fixed;\n var height = this.$refs.header.height() + 2;\n var top = gridbody[0].offsetTop;\n if (top !== height) {\n gridbody.css('top', height);\n if (fixedGridbody != null) {\n fixedGridbody.css('top', height);\n }\n if (fixedHeaderTable != null) {\n fixedHeaderTable.css('height', height);\n }\n top = height;\n }\n\n height = this.height;\n if (height == null) {\n height = this.$el.height() - top;\n } else if (height === 0) {\n height = this.$refs.gridbodyContent.height();\n this.$el.css('height', top + height);\n }\n gridbody.css('height', height);\n var fixedHeight = height;\n if (fixedGridbody != null) {\n var offset = gridbody[0].offsetHeight - gridbody[0].clientHeight;\n fixedHeight -= offset;\n fixedGridbody.css('height', fixedHeight);\n if (this.$el_fixed != null) {\n this.$el_fixed.css('height', top + fixedHeight);\n }\n }\n\n var count = math.trunc((height - 1) / this.rowHeight) + REDUN_NUM * 2 + 1;\n if (force || count !== this._bodyRowCount) {\n this._bodyRowCount = count;\n this.reload();\n }\n var width = this.$refs.gridbodyContent.width();\n\n\n var clientWidth = gridbody[0].clientWidth;\n this._bodyClientWidth = clientWidth;\n\n var total = this.$refs.total;\n if (total == null) {\n if (this.$refs.gridbodyContainer.height() !== this._containerHeight) {\n this.$refs.gridbodyContainer.css('height', this._containerHeight);\n if (this.$refs.gridbodyContainer_fixed != null) {\n this.$refs.gridbodyContainer_fixed.css('height', this._containerHeight);\n }\n }\n return;\n }\n var gridtotal = this.$refs.gridtotal;\n if (gridtotal.width() !== width) {\n gridtotal.css('width', width);\n }\n var totalheight = this.$refs.gridtotalbody.height();\n\n if (totalheight > 0 && gridtotal.height() !== totalheight) {\n gridtotal.css('height', totalheight);\n if (this.$refs.gridtotal_fixed != null) {\n this.$refs.gridtotal_fixed.css('height', totalheight);\n }\n if (this.$refs.gridtotalbody_fixed != null) {\n this.$refs.gridtotalbody_fixed.css('height', totalheight);\n this.$refs.gridtotalbody_fixed.children('th:first-child').css('height', totalheight);\n }\n }\n this.$refs.gridbodyContent.find('tr.data-grid-row-total-holder').css('height', totalheight);\n totalheight += this._containerHeight;\n if (this.$refs.gridbodyContainer.height() !== totalheight) {\n this.$refs.gridbodyContainer.css('height', totalheight);\n if (this.$refs.gridbodyContainer_fixed != null) {\n this.$refs.gridbodyContainer_fixed.css('height', totalheight);\n }\n }\n if (clientWidth === 0) {\n return;\n }\n var right = gridbody[0].offsetWidth - clientWidth;\n var style = total[0].style.right;\n if (right > 0 && style === '') {\n total[0].style.right = right + 'px';\n } else if (right === 0 && style !== '') {\n total[0].style.right = '';\n }\n var bottom = gridbody[0].offsetHeight - gridbody[0].clientHeight;\n style = total[0].style.bottom;\n if (bottom > 0 && style === '') {\n total[0].style.bottom = bottom + 'px';\n } else if (bottom === 0 && style !== '') {\n total[0].style.bottom = '';\n }\n};\n\nGridView.prototype.setData = function setData(data) {\n var _this11 = this;\n\n if (this.$el == null) {\n throw new Error('grid view has not been initialized.');\n }\n this._containerHeight = data.length * this.rowHeight;\n this._overflows = {};\n this.selectedColumnIndex = -1;\n\n this.selectedIndexes = [];\n this.startIndex = 0;\n this._scrollTop = 0;\n this.$refs.gridbody[0].scrollTop = 0;\n if (this.$refs.gridbody_fixed != null) {\n this.$refs.gridbody_fixed[0].scrollTop = 0;\n }\n\n this.$refs.gridbodyContent.css('top', 0);\n if (this.$refs.gridbodyContent_fixed != null) {\n this.$refs.gridbodyContent_fixed.css('top', 0);\n }\n this.$refs.gridbodyContainer.css('height', this._containerHeight);\n if (this.$refs.gridbodyContainer_fixed != null) {\n this.$refs.gridbodyContainer_fixed.css('height', this._containerHeight);\n }\n this.virtual = data.length > this.virtualCount;\n this.innerSource = data;\n\n delete this._bodyRowCount;\n\n var headers = this.$refs.header.children('.data-column-header');\n\n var _loop4 = function _loop4(i) {\n var header = $(headers[i]);\n var key = header.attr('data-key');\n if (key != null) {\n var _col5 = _this11.columns.filter(function (c) {\n return c.key === key;\n })[0];\n if (_col5 != null && typeof _col5.caption === 'function') {\n header.children('.data-column-header-text').empty().append(_col5.caption());\n }\n }\n };\n\n for (var i = 0; i < headers.length; i += 1) {\n _loop4(i);\n }\n\n if (this.columns.filter(function (c) {\n return c.filterValues != null;\n }).length > 0) {\n this.refreshGrid();\n } else {\n this.resize();\n\n if (this.sortIndex >= 0) {\n sortColumn.call(this, this.columns[this.sortIndex], true);\n }\n }\n};\n\nGridView.prototype.resetFilter = function resetFilter() {\n this.source = this.innerSource;\n\n for (var i = 0; i < this.columns.length; i += 1) {\n delete this.columns[i].filterValues;\n }\n if (typeof this.afterResetFilter === 'function') {\n this.afterResetFilter();\n }\n this.$refs.header.find('.data-column-header-filter.filtered').removeClass('filtered').addClass('no-filter');\n};\n\nGridView.prototype.scrollToIndex = function scrollToIndex(index) {\n var top = scrollToTop.call(this, index * this.rowHeight, true);\n this.$refs.gridbody.prop('scrollTop', top);\n if (this.$refs.gridbody_fixed != null) {\n this.$refs.gridbody_fixed.prop('scrollTop', top);\n }\n};\n\nGridView.prototype.scrollTop = function scrollTop(top) {\n if (top == null || isNaN(top)) {\n return this.$refs.gridbody.prop('scrollTop');\n }\n this.$refs.gridbody.prop('scrollTop', top);\n if (this.$refs.gridbody_fixed != null) {\n this.$refs.gridbody_fixed.prop('scrollTop', top);\n }\n this.reload();\n};\n\nGridView.prototype.reload = function reload() {\n this._containerHeight = this.source.length * this.rowHeight;\n adjustRows.call(this, this.$elems.gridbodyContent);\n if (this.$elems.gridbodyContent_fixed != null) {\n adjustRows.call(this, this.$elems.gridbodyContent_fixed);\n }\n this.refresh();\n};\n\nGridView.prototype.reset = function reset() {\n var top = this.$refs.gridbody.scrollTop();\n this.resize(true);\n\n if (this.virtual) {\n var t = top - (top % (this.rowHeight * 2) + REDUN_NUM * this.rowHeight);\n if (t < 0) {\n t = 0;\n } else {\n var bottomTop = this._containerHeight - this.$refs.gridbody.height();\n if (t > bottomTop) {\n t = bottomTop;\n }\n }\n this._scrollTop = t;\n var toppx = t + 'px';\n this.$refs.gridbodyContent[0].style.top = toppx;\n if (this.$refs.gridbodyContent_fixed != null) {\n this.$refs.gridbodyContent_fixed[0].style.top = toppx;\n }\n }\n this.$refs.gridbody.prop('scrollTop', top);\n if (this.$refs.gridbody_fixed != null) {\n this.$refs.gridbody_fixed.prop('scrollTop', top);\n }\n};\n\nGridView.prototype.deleteRow = function deleteRow(index) {\n if (this.$el == null) {\n throw new Error('grid view has not been initialized.');\n }\n this.innerSource.splice(index, 1);\n this.reload();\n};\n\nGridView.prototype.moveRow = function moveRow(index, step) {\n var item = this.innerSource[index];\n if (item == null || step === 0) {\n return;\n }\n var toIndex = index + step;\n if (step > 0) {\n if (toIndex >= this.innerSource.length) {\n toIndex = this.innerSource.length - 1;\n }\n } else if (toIndex < 0) {\n toIndex = 0;\n }\n this.innerSource.splice(index, 1);\n this.innerSource.splice(toIndex, 0, item);\n this.refresh();\n};\n\nGridView.prototype.closeFilterPanel = function closeFilterPanel() {\n var parent = $((this.$window || window).document.body);\n parent.children('.data-column-header-filter-panel').remove();\n};\n\nGridView.prototype.loading = function loading(flag) {\n if (flag === false) {\n this.$elems.loading.css({\n visibility: 'hidden',\n opacity: 0\n });\n } else {\n this.$elems.loading.css({\n visibility: 'visible',\n opacity: 1\n });\n }\n};\n\nGridView.clearGridWidth = function clearGridView(objectid, next) {\n _network.query('DeleteManagementGridWidth', [objectid], next, function () {});\n};\n\nGridView.applyGridWidth = function applyGridWidth(objectid, columns, grid, next, prefix) {\n _network.management('GetManagementChartGridLayout', [objectid], function (e) {\n var tmpColumns = columns;\n if (e.Result && e.Result.length > 0) {\n if (typeof prefix === 'function') {\n prefix(e.Result);\n }\n tmpColumns = [];\n for (var i = 0; i < e.Result.length; i += 1) {\n var gridwidth = e.Result[i];\n var tmpcol = void 0;\n for (var j = 0; j < columns.length; j += 1) {\n if (columns[j].name === gridwidth.ColumnKey) {\n columns[j].width = gridwidth.Width;\n var sort = gridwidth.Sort;\n if (sort > 0) {\n grid.sortIndex = tmpColumns.length;\n grid.sortDirection = sort === 2 ? -1 : 1;\n }\n tmpcol = columns[j];\n break;\n }\n }\n if (tmpcol != null) {\n tmpColumns.push(tmpcol);\n }\n }\n }\n grid.columns = tmpColumns;\n grid.init();\n if (next) {\n next();\n }\n }, function () {\n grid.columns = columns;\n grid.init();\n if (next) {\n next();\n }\n });\n};\n\nGridView.saveColumnInfo = function saveColumnInfo(objectid) {\n return function columnchanged() {\n var columnWidths = [];\n for (var i = 0; i < this.columns.length; i += 1) {\n var sort = void 0;\n if (this.sortIndex === i) {\n sort = this.sortDirection === -1 ? 2 : 1;\n } else {\n sort = 0;\n }\n var c = this.columns[i];\n var columnwidth = {\n $type: 'FI.FIC.Contracts.DataObjects.BaseObject.BaseGridWidth, FICIntf',\n ColumnKey: c.name,\n Width: c.autoResize ? -1 : c.width,\n OrderIndex: i,\n Sort: sort\n };\n columnWidths.push(columnwidth);\n }\n _network.query('SaveManagementGridLayout', [{\n $type: 'FI.FIC.Contracts.DataObjects.BaseObject.BaseGridWidth[], FICintf',\n $values: columnWidths\n }, objectid], function () {});\n };\n};\n\nmodule.exports = GridView;\n\n/***/ }),\n\n/***/ 4:\n/***/ (function(module, exports) {\n\nmodule.exports = __WEBPACK_EXTERNAL_MODULE_4__;\n\n/***/ }),\n\n/***/ 5:\n/***/ (function(module, exports) {\n\n// removed by extract-text-webpack-plugin\n\n/***/ })\n\n/******/ });\n});\n\n\n// WEBPACK FOOTER //\n// js/gridview.js?ab92a4cdb00c256beafb","module.exports = {\r\n userAgent: navigator.userAgent.toLowerCase(),\r\n isMobile() {\r\n return /mobile/.test(this.userAgent);\r\n },\r\n isChrome() {\r\n return /chrom(e|ium)/.test(this.userAgent);\r\n },\r\n};\r\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/browser.js","module.exports = {\r\n math: {\r\n trunc(val) {\r\n return (val > 0 ? Math.floor : Math.ceil)(val);\r\n },\r\n },\r\n ui: {\r\n getClientX(e) {\r\n if (e == null) {\r\n return null;\r\n }\r\n if (e.originalEvent != null) {\r\n e = e.originalEvent;\r\n }\r\n const cx = (e.touches && e.touches[0] && e.touches[0].clientX);\r\n if (cx === undefined) {\r\n return e.clientX;\r\n }\r\n return cx;\r\n },\r\n getOffsetLeft(el) {\r\n let left = 0;\r\n while (el) {\r\n left += el.offsetLeft;\r\n el = el.offsetParent;\r\n }\r\n return left;\r\n },\r\n },\r\n func: {\r\n debounce(method, delay = 100, context = window, ...args) {\r\n clearTimeout(method.tiid);\r\n method.tiid = setTimeout(() => method.apply(context, args), delay);\r\n },\r\n throttle(method, delay = 100, context = window, ...args) {\r\n clearTimeout(method.tiid);\r\n const current = new Date();\r\n if (method.tdate === void 0 || current - method.tdate > delay) {\r\n method.apply(context, args);\r\n method.tdate = current;\r\n } else {\r\n method.tiid = setTimeout(() => method.apply(context, args), delay);\r\n }\r\n },\r\n },\r\n};\r\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/shim_math.js","const $ = require('jquery');\r\nconst { math, ui, func } = require('../shim_math');\r\nconst browser = require('../browser');\r\nrequire('./datagrid.css');\r\n\r\nconst _network = window._network;\r\n\r\n// ENUM\r\nconst COLUMN_CHANGED_TYPE = {\r\n REORDER: 'reorder',\r\n RESIZE: 'resize',\r\n SORT: 'sort',\r\n};\r\nconst COLUMN_TYPE = {\r\n common: 0,\r\n input: 1,\r\n dropdown: 2,\r\n checkbox: 3,\r\n};\r\n\r\nconst REFRESH_INTERVAL = (!browser.isMobile() && browser.isChrome()) ? 0 : 32;\r\n\r\nconst MAX_COLUMN_BIT = 10;\r\nconst MAX_COLUMN_MASK = 0x3ff;\r\nconst VIRTUAL_COUNT = 100;\r\nconst REDUN_NUM = 4; // 冗余渲染\r\nconst MINI_DRAG_OFFSET = 4;\r\nconst MINI_COLUMN_WIDTH = 50;\r\n\r\n// GridView 构造器\r\nfunction GridView(p) {\r\n this.columns = [];\r\n this._source = [];\r\n this.source = this._source;\r\n this.lang = {\r\n all: '( All )',\r\n ok: 'OK',\r\n reset: 'Reset',\r\n };\r\n this.virtualCount = VIRTUAL_COUNT;\r\n this.rowHeight = 27;\r\n this.filterRowHeight = 26;\r\n this.total = null;\r\n this.height = null;\r\n this.virtual = false;\r\n this.startIndex = 0;\r\n this.sortIndex = -1;\r\n this.sortDirection = 1;\r\n this.selectedColumnIndex = -1;\r\n this.selectedIndexes = [];\r\n this.canMultiSelect = false;\r\n this.allowHtml = false;\r\n this.oddStyle = false;\r\n // UI\r\n this.$parent = p;\r\n this.$el = null;\r\n this.$refs = {};\r\n this.$elems = {};\r\n this.$window = window;\r\n // Events\r\n this.willselect = null;\r\n this.selectedrowchanged = null;\r\n this.celldblclick = null;\r\n this.cellclick = null;\r\n this.rowdblclick = null;\r\n this.columnchanged = null;\r\n}\r\nGridView.prototype = {\r\n get sortKey() {\r\n const c = this.columns && this.columns[this.sortIndex];\r\n return c && c.key;\r\n },\r\n get selectedIndex() {\r\n if (this.selectedIndexes != null && this.selectedIndexes.length > 0) {\r\n return this.selectedIndexes[0];\r\n }\r\n return -1;\r\n },\r\n get innerSource() {\r\n return this._source;\r\n },\r\n set innerSource(val) {\r\n this._source = val;\r\n this.source = val;\r\n },\r\n};\r\nGridView.COLUMN_TYPE = COLUMN_TYPE;\r\n\r\n// COLUMN\r\n\r\nfunction indexOfColumn(target) {\r\n return Array.prototype.slice.call(target.parentNode.children).indexOf(target);\r\n}\r\n\r\nfunction headerClick(e, force) {\r\n if (!force && (this._innerwidth || this._isdragging || !this._istouchdown)) {\r\n return;\r\n }\r\n delete this._istouchdown;\r\n if (this.sortable && e.target.tagName !== 'INPUT' && e.target.className !== 'data-column-header-filter' && !e.target.classList.contains('arrow') && e.target.tagName.toLowerCase() !== 'use') {\r\n // eslint-disable-next-line no-use-before-define\r\n sortColumn.call(e.data, this);\r\n }\r\n}\r\n\r\nfunction getDefault(obj, prop) {\r\n if (obj == null) {\r\n return '';\r\n }\r\n let v = obj[prop];\r\n if (v === void 0) {\r\n v = obj;\r\n }\r\n return v;\r\n}\r\n\r\nfunction getSpecialDefault(obj, prop) {\r\n const def = getDefault(obj, prop);\r\n if (Array.isArray(def)) {\r\n return def.join(',');\r\n }\r\n return def;\r\n}\r\n\r\nfunction distinct(key, ckey) {\r\n // return this.reduce((array, value) => {\r\n // if (key != null) {\r\n // let flag = false;\r\n // const v = (value.Values || value)[key];\r\n // for (let i = 0; i < array.length; i += 1) {\r\n // const item = array[i];\r\n // const a = getSpecialDefault(item, ckey);\r\n // const b = getSpecialDefault(v, ckey);\r\n // if (a === b) {\r\n // flag = true;\r\n // break;\r\n // }\r\n // }\r\n // if (!flag) {\r\n // array.push(v);\r\n // }\r\n // } else if (array.indexOf(value) < 0) {\r\n // array.push(value);\r\n // }\r\n // return array;\r\n // }, []);\r\n const dict = {};\r\n for (let i = 0; i < this.length; i += 1) {\r\n const item = this[i];\r\n const v = item.Values || item;\r\n const val = key == null ? v : v[key];\r\n const prop = getSpecialDefault(val, ckey);\r\n if (dict[prop] == null) {\r\n dict[prop] = val;\r\n }\r\n }\r\n if (Object.values == null) {\r\n Object.values = (obj) => {\r\n const val = [];\r\n // eslint-disable-next-line no-restricted-syntax\r\n for (const k in obj) {\r\n if (Object.prototype.hasOwnProperty.call(obj, k)) {\r\n val.push(obj[k]);\r\n }\r\n }\r\n return val;\r\n };\r\n }\r\n return Object.values(dict);\r\n}\r\n\r\nfunction toLowerCase(str) {\r\n if (str == null) {\r\n return String(null);\r\n }\r\n return String(str).toLowerCase();\r\n}\r\n\r\nfunction onFilterChecked(holder, cball) {\r\n return function onchecked(e) {\r\n if (e != null) {\r\n const target = $(e.target);\r\n target.data('item').__checked = target.prop('checked');\r\n }\r\n const cbs = holder.find('.data-filter-items-item input');\r\n for (let i = 0; i < cbs.length; i += 1) {\r\n if (!$(cbs[i]).prop('checked')) {\r\n cball.prop('checked', false);\r\n return;\r\n }\r\n }\r\n cball.prop('checked', true);\r\n };\r\n}\r\n\r\nfunction doFillFilterItem(holder, array, cball) {\r\n const onchecked = onFilterChecked(holder, cball);\r\n for (let i = 0; i < array.length; i += 1) {\r\n const item = array[i];\r\n const itemdiv = $('<div class=\"data-filter-items-item\"></div>');\r\n const wrapper = $('<label></label>');\r\n const checkbox = $('<input type=\"checkbox\"></input>').data('item', item);\r\n let displayValue;\r\n if (!this.filterCustom && typeof this.filter === 'function') {\r\n const o = {};\r\n o[this.key] = item;\r\n displayValue = this.filter(o);\r\n } else {\r\n displayValue = getDefault(item, 'DisplayValue');\r\n }\r\n // let checked = this.filterValues == null || this.filterValues.indexOf(getSpecialDefault(item, 'Value')) >= 0;\r\n // if (item.__checked !== undefined) {\r\n // checked = item.__checked;\r\n // }\r\n checkbox.data('text', displayValue)\r\n .prop('checked', item.__checked)\r\n .on('change', onchecked);\r\n wrapper.append(checkbox);\r\n wrapper.append($('<layer class=\"check-box-inner\"><svg><use xlink:href=\"#gridview-check\"></use></svg></layer>'));\r\n const label = $('<span></span>').text(displayValue);\r\n wrapper.append(label);\r\n itemdiv.append(wrapper);\r\n holder.append(itemdiv);\r\n }\r\n}\r\n\r\nfunction fillFilterItem(grid, holder, items, cball) {\r\n holder.children('.data-filter-items-sizeholder').remove();\r\n holder.children('.data-filter-items-contentholder').remove();\r\n const filterRowHeight = grid.filterRowHeight;\r\n const height = items.length * filterRowHeight;\r\n this.__filterHeight = height;\r\n const sizeHolder = $('<div class=\"data-filter-items-sizeholder\"></div>').css('height', height);\r\n holder.append(sizeHolder);\r\n const itemsHolder = $('<div class=\"data-filter-items-contentholder\"></div>').css('top', filterRowHeight);\r\n holder.data('items', items);\r\n for (let i = 0; i < items.length; i += 1) {\r\n const item = items[i];\r\n item.__checked = this.filterValues == null || this.filterValues.indexOf(getSpecialDefault(item, 'Value')) >= 0;\r\n }\r\n let array;\r\n if (items.length > 12) {\r\n array = items.slice(0, 12);\r\n } else {\r\n array = items;\r\n }\r\n doFillFilterItem.call(this, itemsHolder, array, cball);\r\n holder.append(itemsHolder);\r\n}\r\n\r\nfunction filterOnScroll(grid, top) {\r\n const filterRowHeight = grid.filterRowHeight;\r\n top -= (top % (filterRowHeight * 2)) + filterRowHeight;\r\n if (top < 0) {\r\n top = 0;\r\n } else {\r\n let bottomTop = this.__filterHeight - (12 * filterRowHeight);\r\n if (bottomTop < 0) {\r\n bottomTop = 0;\r\n }\r\n if (top > bottomTop) {\r\n top = bottomTop;\r\n }\r\n }\r\n if (this.__filterTop !== top) {\r\n this.__filterTop = top;\r\n const startIndex = top / filterRowHeight;\r\n this.__filterStartIndex = startIndex;\r\n let array = this.__itemHolder.data('items');\r\n if (startIndex + 12 < array.length) {\r\n array = array.slice(startIndex, startIndex + 12);\r\n } else {\r\n array = array.slice(-12);\r\n }\r\n const itemsHolder = this.__itemHolder.children('.data-filter-items-contentholder');\r\n itemsHolder.empty();\r\n doFillFilterItem.call(this, itemsHolder, array, this.__checkboxAll);\r\n // eslint-disable-next-line\r\n // console.log(`top: ${top + filterRowHeight}`);\r\n itemsHolder[0].style.top = `${top + filterRowHeight}px`;\r\n }\r\n}\r\n\r\nfunction filterClick(e) {\r\n // e.stopPropagation();\r\n // e.preventDefault();\r\n\r\n const grid = e.data;\r\n const parent = $((grid.$window || window).document.body);\r\n const closePanel = (e1) => {\r\n if (e1 != null) {\r\n if (e1.target.className === 'data-column-header-filter' || e1.target.classList.contains('arrow') || e1.target.tagName.toLowerCase() === 'use') {\r\n return;\r\n }\r\n }\r\n const items = this.__itemHolder.data('items');\r\n if (items != null) {\r\n for (let i = 0; i < items.length; i += 1) {\r\n delete items[i].__checked;\r\n }\r\n }\r\n parent.children('.data-column-header-filter-panel').removeClass('active');\r\n setTimeout(() => parent.children('.data-column-header-filter-panel').remove(), 120);\r\n };\r\n parent.children('.data-column-header-filter-panel').remove();\r\n $(document)\r\n .off('.filterpanel')\r\n .on('mousedown.filterpanel', closePanel)\r\n .on('touchstart.filterpanel', closePanel);\r\n const divpanel = $('<div class=\"data-column-header-filter-panel\"></div>')\r\n .on('mousedown', e1 => e1.stopPropagation())\r\n .on('touchstart', e1 => e1.stopPropagation());\r\n const th = $(e.currentTarget).parent();\r\n const offset = th.offset();\r\n const width = th.width();\r\n divpanel.css({\r\n top: offset.top + th.height(),\r\n left: offset.left + (width > 200 ? width - 200 : 0),\r\n });\r\n // fill the items\r\n const itemHolder = $('<div class=\"data-filter-items-holder\"></div>');\r\n this.__itemHolder = itemHolder;\r\n if (typeof this.onFillItems === 'function') {\r\n itemHolder.css('overflow-y', 'hidden');\r\n let hasSearch = false;\r\n if (typeof this.onFillSearch === 'function') {\r\n const search = this.onFillSearch();\r\n if (search != null) {\r\n const searchHolder = $('<div class=\"data-filter-search-holder\"></div>');\r\n searchHolder.append(search);\r\n divpanel.append(searchHolder);\r\n hasSearch = true;\r\n }\r\n }\r\n if (!hasSearch) {\r\n itemHolder.css('height', 280);\r\n } else {\r\n itemHolder.css('height', 250);\r\n }\r\n divpanel.append(itemHolder);\r\n this.onFillItems(itemHolder, divpanel);\r\n } else {\r\n // search\r\n let searchbox = null;\r\n if (this.allowSearch !== false) {\r\n const searchHolder = $('<div class=\"data-filter-search-holder\"></div>');\r\n searchbox = $('<input type=\"text\" class=\"data-filter-search-box\"/>');\r\n const searchiconClick = e2 => e2.data.focus();\r\n const searchicon = $('<svg class=\"data-filter-search-icon\"><use xlink:href=\"#search\"></use></svg>')\r\n .on('mouseup', searchbox, searchiconClick)\r\n .on('touchend', searchbox, searchiconClick);\r\n searchHolder.append(searchbox, searchicon);\r\n divpanel.append(searchHolder);\r\n }\r\n itemHolder[0].addEventListener('scroll', (e2) => {\r\n func.throttle(filterOnScroll, REFRESH_INTERVAL, this, grid, e2.target.scrollTop);\r\n }, { passive: true });\r\n const itemdivall = $('<div class=\"data-filter-items-item\"></div>');\r\n const wrapper = $('<label></label>');\r\n const checkboxall = $('<input type=\"checkbox\"></input>');\r\n this.__checkboxAll = checkboxall;\r\n wrapper.append(checkboxall);\r\n wrapper.append($('<layer class=\"check-box-inner\"><svg><use xlink:href=\"#gridview-check\"></use></svg></layer>'));\r\n wrapper.append($('<span></span>').text(grid.lang.all));\r\n itemdivall.append(wrapper);\r\n itemHolder.append(itemdivall);\r\n let array;\r\n if (this.filterSource != null) {\r\n if (typeof this.filterSource === 'function') {\r\n array = this.filterSource.call(grid, this);\r\n } else {\r\n array = this.filterSource;\r\n }\r\n } else {\r\n // const time1 = new Date();\r\n array = distinct.call(grid.innerSource, this.key, 'Value')\r\n .sort((a, b) => {\r\n a = getSpecialDefault(a, 'Value');\r\n b = getSpecialDefault(b, 'Value');\r\n return a > b ? 1 : a < b ? -1 : 0;\r\n });\r\n // const cost = new Date() - time1;\r\n // if (cost > 0) {\r\n // // eslint-disable-next-line\r\n // console.log('time cost: ' + cost.toLocaleString() + 'ms');\r\n // }\r\n }\r\n let citems = array;\r\n if (array.length > 0) {\r\n if (array[0] !== Object(array[0])) {\r\n citems = [];\r\n for (let i = 0; i < array.length; i += 1) {\r\n const item = array[i];\r\n citems.push({\r\n Value: item,\r\n DisplayValue: item == null ? '' : item,\r\n });\r\n }\r\n }\r\n }\r\n fillFilterItem.call(this, grid, itemHolder, citems, checkboxall);\r\n const onchecked = onFilterChecked(\r\n itemHolder.children('.data-filter-items-contentholder'),\r\n checkboxall);\r\n onchecked();\r\n divpanel.append(itemHolder);\r\n if (searchbox != null) {\r\n searchbox.on('input propertychange', {\r\n column: this,\r\n grid,\r\n }, (e2) => {\r\n const key = toLowerCase(e2.currentTarget.value);\r\n const items = key.length === 0 ? citems : citems.filter((a) => {\r\n let displayValue;\r\n if (!e2.data.filterCustom && typeof e2.data.filter === 'function') {\r\n const o = {};\r\n o[e2.data.key] = a;\r\n displayValue = e2.data.filter(o);\r\n } else {\r\n displayValue = getDefault(a, 'DisplayValue');\r\n }\r\n return toLowerCase(displayValue).indexOf(key) >= 0;\r\n });\r\n fillFilterItem.call(e2.data.column, e2.data.grid, itemHolder, items, checkboxall);\r\n });\r\n } else {\r\n itemHolder.css('height', 255);\r\n }\r\n checkboxall.on('change', (e2) => {\r\n const boxes = itemHolder\r\n .children('.data-filter-items-contentholder')\r\n .find('.data-filter-items-item input');\r\n const checked = $(e2.target).prop('checked');\r\n let i;\r\n for (i = 0; i < boxes.length; i += 1) {\r\n const cb = $(boxes[i]);\r\n cb.prop('checked', checked);\r\n }\r\n const items = itemHolder.data('items');\r\n for (i = 0; i < items.length; i += 1) {\r\n items[i].__checked = checked;\r\n }\r\n });\r\n }\r\n if (this.filterFunctions !== false) {\r\n // functions\r\n const functionBar = $('<div class=\"data-filter-items-function\"></div>');\r\n const buttonReset = $('<input type=\"button\"></input>').val(grid.lang.reset)\r\n .on('click', () => {\r\n delete this.filterValues;\r\n if (typeof this.onFilterReset === 'function') {\r\n this.onFilterReset(e);\r\n } else {\r\n grid.refreshGrid();\r\n if (typeof this.afterFilter === 'function') {\r\n this.afterFilter(grid);\r\n }\r\n }\r\n closePanel();\r\n $(e.currentTarget).removeClass('filtered').addClass('no-filter');\r\n });\r\n functionBar.append(buttonReset);\r\n const buttonOk = $('<input type=\"button\"></input>').val(grid.lang.ok)\r\n .on('click', () => {\r\n // const boxes = itemHolder\r\n // .children('.data-filter-items-contentholder')\r\n // .children('.data-filter-items-item')\r\n // .children('input');\r\n // const checked = boxes.filter((i) => {\r\n // const c = $(boxes[i]);\r\n // return c.is(':visible') && c.prop('checked');\r\n // });\r\n // const filters = checked.map((c) => {\r\n // const v = c.data('val');\r\n // if (Array.isArray(v)) {\r\n // return v.join(',');\r\n // }\r\n // return v;\r\n // });\r\n if (typeof this.onFilterOK === 'function') {\r\n this.onFilterOK(e);\r\n } else {\r\n const items = itemHolder.data('items').filter(i => i.__checked !== false);\r\n const filters = items.map((c) => {\r\n const v = getDefault(c, 'Value');\r\n if (Array.isArray(v)) {\r\n return v.join(',');\r\n }\r\n return v;\r\n });\r\n this.filterValues = filters;\r\n grid.refreshGrid();\r\n if (typeof this.afterFilter === 'function') {\r\n this.afterFilter(grid);\r\n }\r\n $(e.currentTarget).removeClass('no-filter').addClass('filtered');\r\n }\r\n closePanel();\r\n });\r\n functionBar.append(buttonOk);\r\n divpanel.append(functionBar);\r\n }\r\n parent.append(divpanel);\r\n setTimeout(() => divpanel.addClass('active'), 1);\r\n // return false;\r\n}\r\n\r\nfunction dragStart(e) {\r\n this._istouchdown = true;\r\n if (this.orderable === false || this.isfixed || e.target.tagName === 'INPUT' || e.target.className === 'data-column-header-filter' || e.target.classList.contains('arrow') || e.target.tagName.toLowerCase() === 'use') {\r\n // TODO: fixed column drag\r\n return;\r\n }\r\n // e.stopPropagation();\r\n // e.preventDefault();\r\n\r\n const _cx = ui.getClientX(e);\r\n const _index = indexOfColumn(e.currentTarget);\r\n\r\n const dragmove = (e2) => {\r\n const cx = ui.getClientX(e2);\r\n const offset = cx - _cx;\r\n let isdragging = this._isdragging;\r\n if (!isdragging && (offset > MINI_DRAG_OFFSET || offset < -MINI_DRAG_OFFSET)) {\r\n isdragging = true;\r\n this._isdragging = true;\r\n }\r\n if (isdragging) {\r\n if (offset !== this._offset) {\r\n // eslint-disable-next-line no-use-before-define\r\n columnDragging.call(e.data, _index, offset, cx);\r\n this._offset = offset;\r\n }\r\n }\r\n };\r\n const dragend = (e2) => {\r\n $(e.data.$window || window).off('.dragging');\r\n if (this._isdragging) {\r\n delete this._isdragging;\r\n delete this._offset;\r\n // eslint-disable-next-line no-use-before-define\r\n columnDragstop.call(e.data, _index);\r\n } else if (e2.originalEvent && e2.originalEvent.touches) {\r\n headerClick.call(this, e2);\r\n }\r\n };\r\n const bindDragmove = func.throttle.bind(this, dragmove, REFRESH_INTERVAL, null);\r\n // const bindDragmove = e2 => func.throttle(dragmove, REFRESH_INTERVAL, null, e2);\r\n $(e.data.$window || window).on('mousemove.dragging', bindDragmove)\r\n .on('mouseup.dragging', dragend)\r\n .on('touchmove.dragging', bindDragmove)\r\n .on('touchend.dragging', dragend);\r\n}\r\n\r\nfunction resizeStart(e) {\r\n e.stopPropagation();\r\n e.preventDefault();\r\n\r\n const _cx = ui.getClientX(e);\r\n const _width = this.width;\r\n const _index = indexOfColumn(e.currentTarget.parentNode);\r\n if (this.isfixed) {\r\n let baseWidth = 0;\r\n for (let i = 0; i < e.data.fixedColumns.length; i += 1) {\r\n if (_index !== i && e.data.fixedColumns[i].visible !== false) {\r\n baseWidth += e.data.fixedColumns[i].width + 1;\r\n }\r\n }\r\n e.data._baseWidth = baseWidth;\r\n }\r\n\r\n const resizemove = (e2) => {\r\n const cx = ui.getClientX(e2);\r\n const val = _width + (cx - _cx);\r\n if (val < MINI_COLUMN_WIDTH) {\r\n return;\r\n }\r\n this._innerwidth = val;\r\n // eslint-disable-next-line no-use-before-define\r\n widthChanging.call(e.data, _index, val);\r\n };\r\n const resizeend = () => {\r\n $(e.data.$window || window).off('.resizing');\r\n delete e.data._baseWidth;\r\n const width = this._innerwidth;\r\n if (width != null) {\r\n // this.width = width;\r\n // this.style.width = width;\r\n this.autoResize = false;\r\n delete this._innerwidth;\r\n // eslint-disable-next-line no-use-before-define\r\n widthChanged.call(e.data, _index, width);\r\n }\r\n };\r\n const bindResizemove = func.throttle.bind(this, resizemove, REFRESH_INTERVAL, null);\r\n $(e.data.$window || window).on('mousemove.resizing', bindResizemove)\r\n .on('mouseup.resizing', resizeend)\r\n .on('touchmove.resizing', bindResizemove)\r\n .on('touchend.resizing', resizeend);\r\n}\r\n\r\n// SUB COMPONENTS TRIGGER\r\n\r\nfunction changeColumnWidth(index, width) {\r\n const isFixed = this.columns[index].isfixed;\r\n const oldWidth = this.columns[index].width;\r\n const w = `${width}px`;\r\n this.columns[index].width = width;\r\n this.columns[index].style.width = width;\r\n this.columns[index].style['max-width'] = width;\r\n this.columns[index].style['min-width'] = width;\r\n let element = this.$refs.header[0].children[index];\r\n element.style.width = w;\r\n element.style.maxWidth = w;\r\n element.style.minWidth = w;\r\n if (isFixed) {\r\n element = this.$refs.header_fixed[0].children[index];\r\n element.style.width = w;\r\n element.style.maxWidth = w;\r\n element.style.minWidth = w;\r\n if (this._baseWidth >= 0) {\r\n this.$el_fixed[0].style.width = `${this._baseWidth + width + 1}px`;\r\n }\r\n }\r\n let rows = this.$elems.gridbodyContent.children;\r\n if (rows.length > 0) {\r\n for (let i = 0; i < rows.length; i += 1) {\r\n element = rows[i].children[index];\r\n if (element == null) {\r\n continue;\r\n }\r\n element.style.width = w;\r\n element.style.maxWidth = w;\r\n element.style.minWidth = w;\r\n }\r\n } else {\r\n width = (this.$refs.gridbodyContainer[0].offsetWidth - oldWidth) + width;\r\n this.$refs.gridbodyContainer[0].style.width = `${width}px`;\r\n }\r\n if (isFixed) {\r\n rows = this.$elems.gridbodyContent_fixed.children;\r\n if (rows.length > 0) {\r\n for (let i = 0; i < rows.length; i += 1) {\r\n element = rows[i].children[index];\r\n if (element == null) {\r\n continue;\r\n }\r\n element.style.width = w;\r\n element.style.maxWidth = w;\r\n element.style.minWidth = w;\r\n }\r\n } else {\r\n width = (this.$refs.gridbodyContainer_fixed[0].offsetWidth - oldWidth) + width;\r\n this.$refs.gridbodyContainer_fixed[0].style.width = `${width}px`;\r\n }\r\n }\r\n if (this.$refs.total != null) {\r\n element = this.$refs.gridtotalbody[0].children[index].children[0];\r\n element.style.width = w;\r\n element.style.maxWidth = w;\r\n element.style.minWidth = w;\r\n if (this.$refs.gridtotalbody_fixed != null && this.$refs.gridtotalbody_fixed[0].children[index] != null) {\r\n element = this.$refs.gridtotalbody_fixed[0].children[index].children[0];\r\n element.style.width = w;\r\n element.style.maxWidth = w;\r\n element.style.minWidth = w;\r\n }\r\n }\r\n}\r\n\r\nfunction widthChanging(index, width) {\r\n changeColumnWidth.call(this, index, width);\r\n this.resize();\r\n if (typeof this.columnchanging === 'function') {\r\n this.columnchanging(COLUMN_CHANGED_TYPE.RESIZE, index, width);\r\n }\r\n}\r\n\r\nfunction columnDragging(index, offset, clientX) {\r\n const children = this.$refs.header[0].children;\r\n let col = children[index];\r\n this.$refs.dragger.css({\r\n left: col.offsetLeft + offset,\r\n width: col.style.width,\r\n }).show();\r\n this.$refs.draggerCursor.show();\r\n offset = clientX - ui.getOffsetLeft(col);\r\n let idx;\r\n if (offset < 0) {\r\n offset = -offset;\r\n for (let i = index - 1; i >= 0 && offset >= 0; i -= 1) {\r\n col = children[i];\r\n if (!col || ` ${col.className} `.indexOf(' data-column-header ') < 0) {\r\n break;\r\n }\r\n if (offset < col.offsetWidth) {\r\n idx = (offset > col.offsetWidth / 2) ? i : i + 1;\r\n break;\r\n }\r\n offset -= col.offsetWidth;\r\n }\r\n if (idx == null) {\r\n idx = 0;\r\n }\r\n if (this.fixedColumns != null && idx < this.fixedColumns.length) {\r\n idx = this.fixedColumns.length;\r\n }\r\n } else {\r\n const count = children.length;\r\n for (let i = index; i < count - 1 && offset >= 0; i += 1) {\r\n col = children[i];\r\n if (!col || ` ${col.className} `.indexOf(' data-column-header ') < 0) {\r\n idx = i;\r\n break;\r\n }\r\n if (offset < col.offsetWidth) {\r\n idx = (offset > col.offsetWidth / 2) ? i + 1 : i;\r\n break;\r\n }\r\n offset -= col.offsetWidth;\r\n }\r\n if (idx == null) {\r\n idx = count - 1;\r\n }\r\n }\r\n if (idx !== this._orderIndex) {\r\n this._orderIndex = idx;\r\n col = children[idx];\r\n if (!col) {\r\n return;\r\n }\r\n this.$refs.draggerCursor.css('left', col.offsetLeft);\r\n }\r\n}\r\n\r\nfunction columnDragstop(index) {\r\n this.$refs.dragger.hide();\r\n this.$refs.draggerCursor.hide();\r\n // 改变列顺序\r\n if (this._orderIndex >= 0 && this._orderIndex !== index) {\r\n let targetIndex = this._orderIndex - index;\r\n if (targetIndex >= 0 && targetIndex <= 1) {\r\n return;\r\n }\r\n const headers = this.$refs.header[0].children;\r\n const rows = this.$elems.gridbodyContent.children;\r\n const totals = this.$refs.total && this.$refs.gridtotalbody[0].children;\r\n // const totalsFixed = this.$refs.total && this.$refs.gridtotalbody_fixed[0].children;\r\n if (targetIndex > 1) {\r\n targetIndex = this._orderIndex - 1;\r\n for (let i = index; i < targetIndex; i += 1) {\r\n const tmp = this.columns[i];\r\n this.columns[i] = this.columns[i + 1];\r\n this.columns[i + 1] = tmp;\r\n }\r\n // 修改 element 位置\r\n $(headers[index]).insertAfter(headers[targetIndex]);\r\n for (let j = 0; j < rows.length; j += 1) {\r\n $(rows[j].children[index]).insertAfter(rows[j].children[targetIndex]);\r\n }\r\n if (totals != null) {\r\n $(totals[index]).insertAfter(totals[targetIndex]);\r\n // if (totalsFixed != null) {\r\n // $(totalsFixed[index]).insertAfter(totalsFixed[targetIndex]);\r\n // }\r\n }\r\n } else {\r\n targetIndex = this._orderIndex;\r\n for (let i = index; i > targetIndex; i -= 1) {\r\n const tmp = this.columns[i];\r\n this.columns[i] = this.columns[i - 1];\r\n this.columns[i - 1] = tmp;\r\n }\r\n // 修改 element 位置\r\n $(headers[index]).insertBefore(headers[targetIndex]);\r\n for (let j = 0; j < rows.length; j += 1) {\r\n $(rows[j].children[index]).insertBefore(rows[j].children[targetIndex]);\r\n }\r\n if (totals != null) {\r\n $(totals[index]).insertBefore(totals[targetIndex]);\r\n // if (totalsFixed != null) {\r\n // $(totalsFixed[index]).insertBefore(totalsFixed[targetIndex]);\r\n // }\r\n }\r\n }\r\n // 刷新 sortIndex\r\n for (let i = 0; i < headers.length; i += 1) {\r\n const hd = headers[i].children[1];\r\n if (hd == null) {\r\n break;\r\n }\r\n if (hd.className !== 'arrow') {\r\n this.sortIndex = i;\r\n break;\r\n }\r\n }\r\n\r\n if (typeof this.columnchanged === 'function') {\r\n this.columnchanged(COLUMN_CHANGED_TYPE.REORDER, index, targetIndex);\r\n }\r\n }\r\n}\r\n\r\nfunction widthChanged(index, width) {\r\n // reset overflow caches\r\n for (let i = 0; i < this.innerSource.length; i += 1) {\r\n // eslint-disable-next-line no-bitwise\r\n const keyid = (i << MAX_COLUMN_BIT) | index;\r\n if (this._overflows[keyid] != null) {\r\n delete this._overflows[keyid];\r\n }\r\n }\r\n if (typeof this.columnchanged === 'function') {\r\n this.columnchanged(COLUMN_CHANGED_TYPE.RESIZE, index, width);\r\n }\r\n}\r\n\r\nfunction sortColumn(column, auto, reload) {\r\n const index = this.columns.indexOf(column);\r\n if (!reload) {\r\n this.sortIndex = index;\r\n const headers = this.$refs.header[0].children;\r\n const fixedHeaders = this.$refs.header_fixed && this.$refs.header_fixed[0].children;\r\n for (let i = 0; i < headers.length; i += 1) {\r\n const hd = headers[i].children[1];\r\n const fixedHd = fixedHeaders && i < fixedHeaders.length && fixedHeaders[i].children[1];\r\n if (hd == null) {\r\n break;\r\n }\r\n if (i === index) {\r\n if (!auto && hd.className !== 'arrow') {\r\n this.sortDirection *= -1;\r\n }\r\n hd.className = `arrow ${(this.sortDirection > 0 ? 'asc' : 'desc')}`;\r\n if (fixedHd) {\r\n fixedHd.className = `arrow ${(this.sortDirection > 0 ? 'asc' : 'desc')}`;\r\n }\r\n } else if (hd.className !== 'arrow') {\r\n hd.className = 'arrow';\r\n if (fixedHd) {\r\n fixedHd.className = 'arrow';\r\n }\r\n }\r\n }\r\n }\r\n let comparer;\r\n if (column.sortFilter == null) {\r\n comparer = (a, b) => {\r\n const ta = a.Values[column.key];\r\n const tb = b.Values[column.key];\r\n if ((ta === void 0 || tb === void 0) && column.filter) {\r\n a = column.filter(a.Values);\r\n b = column.filter(b.Values);\r\n } else {\r\n a = ta;\r\n b = tb;\r\n }\r\n if (a != null && a.Value !== void 0) {\r\n a = a.Value;\r\n }\r\n if (b != null && b.Value !== void 0) {\r\n b = b.Value;\r\n }\r\n if (a == null && typeof b === 'number') {\r\n a = 0;\r\n } else if (typeof a === 'number' && b == null) {\r\n b = 0;\r\n } else if (a != null && b == null) {\r\n return this.sortDirection;\r\n } else if (typeof a === 'string' && typeof b === 'string') {\r\n a = a.toLowerCase();\r\n b = b.toLowerCase();\r\n }\r\n return a === b ? 0 : (a > b ? 1 : -1) * this.sortDirection;\r\n };\r\n } else {\r\n comparer = (a, b) => column.sortFilter(a, b) * this.sortDirection;\r\n }\r\n this.source.sort(comparer);\r\n this.refresh();\r\n if (!reload && !auto && typeof this.columnchanged === 'function') {\r\n this.columnchanged(COLUMN_CHANGED_TYPE.SORT, index, this.sortDirection);\r\n }\r\n}\r\n\r\nfunction checkAllColumn(column, check) {\r\n if (this.source == null) {\r\n return;\r\n }\r\n const key = column.key;\r\n const itemEnabled = typeof column.enabled === 'string';\r\n const onchanged = column.onchanged;\r\n if (column.checkall != null) {\r\n column.checkall.call(this, column, check);\r\n } else {\r\n for (let i = 0; i < this.source.length; i += 1) {\r\n const item = this.source[i].Values;\r\n if (item == null) {\r\n continue;\r\n }\r\n const enabled = itemEnabled ? item[column.enabled] : column.enabled;\r\n if (enabled !== false) {\r\n item[key] = check;\r\n item.__internal_changed = true;\r\n if (onchanged != null) {\r\n onchanged.call(this, item, check);\r\n }\r\n }\r\n }\r\n }\r\n this.refresh();\r\n}\r\n\r\nfunction checkRow(e, index, col) {\r\n if (this.source == null) {\r\n return;\r\n }\r\n const item = this.source[this.startIndex + index].Values;\r\n if (item == null) {\r\n return;\r\n }\r\n const enabled = typeof col.enabled === 'string' ? item[col.enabled] : col.enabled;\r\n if (enabled !== false) {\r\n item[col.key] = e.target.checked;\r\n item.__internal_changed = true;\r\n if (col.onchanged != null) {\r\n col.onchanged.call(this, item, e.target.checked);\r\n }\r\n }\r\n}\r\n\r\n// GRID LOGIC\r\n\r\nfunction scrollToTop(top, flag) {\r\n const ROW_HEIGHT = this.rowHeight;\r\n top -= (top % (ROW_HEIGHT * 2)) + (REDUN_NUM * ROW_HEIGHT);\r\n if (top < 0) {\r\n top = 0;\r\n } else {\r\n let bottomTop = this._containerHeight - (flag ? 0 : (this._bodyRowCount * ROW_HEIGHT));\r\n if (bottomTop < 0) {\r\n bottomTop = 0;\r\n }\r\n if (top > bottomTop) {\r\n top = bottomTop;\r\n }\r\n }\r\n if (this._scrollTop !== top) {\r\n this._scrollTop = top;\r\n if (this.virtual) {\r\n this.startIndex = top / ROW_HEIGHT;\r\n }\r\n this.refresh();\r\n if (this.virtual) {\r\n this.$refs.gridbodyContent[0].style.top = `${top}px`;\r\n if (this.$refs.gridbodyContent_fixed != null) {\r\n this.$refs.gridbodyContent_fixed[0].style.top = `${top}px`;\r\n }\r\n }\r\n } else if (flag) {\r\n this.refresh();\r\n }\r\n\r\n return top;\r\n}\r\n\r\nfunction gridonscroll(e) {\r\n this.resetScroll(e.target);\r\n if (!this.virtual) {\r\n return;\r\n }\r\n const top = e.target.scrollTop;\r\n scrollToTop.call(this, top);\r\n}\r\n\r\nfunction getColumnIndex(target, istotal) {\r\n if (target == null) {\r\n return -1;\r\n }\r\n let parent;\r\n // eslint-disable-next-line\r\n while ((parent = target.parentNode) != null && ` ${parent.className} `.indexOf(' data-grid-row ') < 0 && ` ${parent.className} `.indexOf(' data-grid-total-body ') < 0) {\r\n target = parent;\r\n }\r\n if (parent == null) {\r\n return -1;\r\n }\r\n // return Array.prototype.slice.call(parent.children).indexOf(target);\r\n const max = parent.children.length - (istotal ? 0 : 1);\r\n for (let i = 0; i < max; i += 1) {\r\n if (target === parent.children[i]) {\r\n return i;\r\n }\r\n }\r\n return -1;\r\n}\r\n\r\nfunction rowOnClick(e, index, colindex) {\r\n const startIndex = this.startIndex;\r\n const selectedIndex = index + startIndex;\r\n if (typeof this.willselect === 'function' && !this.willselect(selectedIndex, colindex)) {\r\n return;\r\n }\r\n\r\n // multi-select\r\n let flag = false;\r\n const selected = this.selectedIndexes;\r\n if (this.canMultiSelect) {\r\n if (e.ctrlKey) {\r\n const i = selected.indexOf(selectedIndex);\r\n if (i < 0) {\r\n selected.push(selectedIndex);\r\n flag = true;\r\n } else {\r\n selected.splice(i, 1);\r\n flag = true;\r\n }\r\n } else if (e.shiftKey && selected.length > 0) {\r\n if (selected.length > 1 || selected[0] !== selectedIndex) {\r\n let start = selected[selected.length - 1];\r\n let end;\r\n if (start > selectedIndex) {\r\n end = start;\r\n start = selectedIndex;\r\n } else {\r\n end = selectedIndex;\r\n }\r\n selected.splice(0);\r\n for (let i = start; i <= end; i += 1) {\r\n selected.push(i);\r\n }\r\n flag = true;\r\n }\r\n } else if (selected.length !== 1 || selected[0] !== selectedIndex) {\r\n selected.splice(0, selected.length, selectedIndex);\r\n flag = true;\r\n }\r\n } else if (selected.length !== 1 || selected[0] !== selectedIndex) {\r\n selected.splice(0, selected.length, selectedIndex);\r\n flag = true;\r\n }\r\n // apply style\r\n if (flag) {\r\n if (this.isEditable) {\r\n const length = this.$elems.gridbodyContent.children.length;\r\n for (let i = 0; i < length; i += 1) {\r\n const item = this.source[i + startIndex];\r\n if (selected.indexOf(i + startIndex) >= 0) {\r\n item.__selected = true;\r\n } else {\r\n delete item.__selected;\r\n }\r\n const changes = item.Values.__changed;\r\n if (changes != null) {\r\n for (let j = 0; j < this.columns.length; j += 1) {\r\n const col = this.columns[j];\r\n if (Object.prototype.hasOwnProperty.call(changes, col.key)) {\r\n if (typeof col.onchanged === 'function') {\r\n col.onchanged.call(this, item.Values);\r\n }\r\n delete changes[col.key];\r\n }\r\n }\r\n }\r\n }\r\n this.refresh();\r\n } else {\r\n const rows = this.$elems.gridbodyContent.children;\r\n const fixedRows = this.$elems.gridbodyContent_fixed && this.$elems.gridbodyContent_fixed.children;\r\n for (let i = 0; i < rows.length; i += 1) {\r\n if (selected.indexOf(i + startIndex) >= 0) {\r\n rows[i].className = 'data-grid-row data-grid-row-selected';\r\n if (fixedRows != null) {\r\n fixedRows[i].className = 'data-grid-row data-grid-row-selected';\r\n }\r\n } else if (rows[i].className !== 'data-grid-row') {\r\n rows[i].className = 'data-grid-row';\r\n if (fixedRows != null) {\r\n fixedRows[i].className = 'data-grid-row';\r\n }\r\n }\r\n }\r\n }\r\n if (typeof this.selectedrowchanged === 'function') {\r\n this.selectedrowchanged(selectedIndex);\r\n }\r\n }\r\n const colIndex = colindex != null ? colindex : getColumnIndex(e.target);\r\n this.selectedColumnIndex = colIndex;\r\n if ((this.allowFullrowClick || colIndex >= 0) && (e.buttons === 1 || e.originalEvent instanceof TouchEvent) && typeof this.cellclick === 'function') {\r\n if (this.cellclick(selectedIndex, colIndex)) {\r\n e.stopPropagation();\r\n e.preventDefault();\r\n }\r\n }\r\n // return false;\r\n}\r\n\r\nfunction rowOnDblClick(e, istotal) {\r\n if (e.target.tagName === 'INPUT') {\r\n return;\r\n }\r\n const index = istotal ? -1 : this.selectedIndex;\r\n if (typeof this.rowdblclick === 'function') {\r\n this.rowdblclick(index);\r\n }\r\n if (typeof this.celldblclick === 'function') {\r\n const columnIndex = istotal ? getColumnIndex($(e.target).parents('.data-grid-total-row')[0], istotal) : this.selectedColumnIndex;\r\n this.celldblclick(index, columnIndex);\r\n }\r\n}\r\n\r\nfunction adjustRows(gridcontent, cols) {\r\n if (this._bodyRowCount == null) {\r\n return;\r\n }\r\n cols = cols || this.columns;\r\n let cnt = this._bodyRowCount;\r\n if (!this.virtual || this.source.length < cnt) {\r\n cnt = this.source.length;\r\n }\r\n const jGridContent = $(gridcontent);\r\n\r\n const childrencount = gridcontent.children.length - jGridContent.find('tr.data-grid-row-total-holder').length;\r\n let count = cnt - childrencount;\r\n if (count > 0) {\r\n const rows = [];\r\n const onrowdblclick = e => rowOnDblClick.call(this, e, false);\r\n for (let i = 0; i < count; i += 1) {\r\n const onrowclick = e => rowOnClick.call(this, e, childrencount + i);\r\n const row = $('<tr class=\"data-grid-row\"></tr>')\r\n .on('mousedown', onrowclick)\r\n .on('touchstart', onrowclick)\r\n .on('dblclick', onrowdblclick);\r\n for (let j = 0; j < cols.length; j += 1) {\r\n const col = cols[j];\r\n const cell = $('<td></td>');\r\n if (col.visible === false) {\r\n cell.hide();\r\n } else {\r\n // TODO: 2^10列足够\r\n // eslint-disable-next-line\r\n cell[0].keyid = ((childrencount + i) << MAX_COLUMN_BIT) | j;\r\n if (col.style != null) {\r\n cell.css(col.style);\r\n }\r\n if (col.istotal) {\r\n cell.addClass('data-grid-column-total');\r\n }\r\n if (col.css != null) {\r\n cell.css(col.css);\r\n }\r\n if (col.isurl) {\r\n cell.append('<a target=\"_blank\"></a>');\r\n } else if (col.type === COLUMN_TYPE.checkbox) {\r\n const checkit = e => checkRow.call(this, e, childrencount + i, col);\r\n const wrapper = $('<label></label>');\r\n const box = $('<input type=\"checkbox\" />').on('change', checkit);\r\n const checkinner = $('<layer class=\"check-box-inner\"><svg><use xlink:href=\"#gridview-check\"></use></svg></layer>');\r\n wrapper.append(box, checkinner);\r\n cell.append(wrapper);\r\n } else {\r\n cell.append('<span></span>');\r\n }\r\n }\r\n row.append(cell);\r\n }\r\n row.append('<td><span></span></td>');\r\n rows.push(row);\r\n }\r\n const lastRow = jGridContent.find('tr').last();\r\n if (lastRow.hasClass('data-grid-row-total-holder')) {\r\n lastRow.remove();\r\n }\r\n jGridContent.append(rows);\r\n if (this.total != null) {\r\n jGridContent.append('<tr class=\"data-grid-row-total-holder\"></tr>');\r\n }\r\n } else if (count < 0) {\r\n count = -count;\r\n for (let i = 1; i <= count; i += 1) {\r\n $(gridcontent.children[childrencount - i]).remove();\r\n }\r\n }\r\n}\r\n\r\nfunction gridbodyMouseMove(e) {\r\n let target = e.target;\r\n if (target.className === 'data-grid-hover-holder') {\r\n return;\r\n }\r\n let parent;\r\n // eslint-disable-next-line\r\n while ((parent = target.parentNode) != null && ` ${parent.className} `.indexOf(' data-grid-row ') < 0) {\r\n target = parent;\r\n }\r\n let keyid = target.keyid;\r\n const holder = e.data;\r\n if (parent == null || keyid == null) {\r\n holder.nowKeyid = null;\r\n if (holder.style.display !== 'none') {\r\n holder.style.display = 'none';\r\n }\r\n return;\r\n }\r\n const oldkeyid = holder.nowKeyid;\r\n // eslint-disable-next-line\r\n keyid += this.startIndex << MAX_COLUMN_BIT;\r\n if (keyid === oldkeyid) {\r\n return;\r\n }\r\n let overflow = this._overflows[keyid];\r\n let targetContent = target;\r\n if (target.children.length > 0) {\r\n targetContent = target.children[0];\r\n }\r\n if (overflow == null) {\r\n overflow = targetContent.scrollWidth > targetContent.offsetWidth;\r\n this._overflows[keyid] = overflow;\r\n }\r\n if (overflow) {\r\n // hover on\r\n if (holder.style.display !== '') {\r\n holder.style.display = '';\r\n }\r\n if (oldkeyid !== keyid) {\r\n holder.nowKeyid = keyid;\r\n holder.innerText = targetContent.innerText;\r\n const top = this.$refs.gridbodyContent[0].offsetTop + target.offsetTop;\r\n let left = target.offsetLeft;\r\n let holderWidth = holder.offsetWidth;\r\n if (holderWidth > this._bodyClientWidth) {\r\n holderWidth = this._bodyClientWidth;\r\n }\r\n const maxleft = (this._bodyClientWidth + this._scrollLeft) - holderWidth;\r\n if (left > maxleft) {\r\n left = maxleft;\r\n }\r\n const height = targetContent.offsetHeight;\r\n holder.style.cssText = `top: ${top}px; left: ${left}px; max-width: ${this._bodyClientWidth}px; height: ${height - 2}px`;\r\n }\r\n } else {\r\n if (oldkeyid != null) {\r\n holder.nowKeyid = null;\r\n }\r\n if (holder.style.display !== 'none') {\r\n // hover off\r\n holder.style.display = 'none';\r\n }\r\n }\r\n}\r\n\r\n// CREATE\r\n\r\nfunction tableHeaderMouseEnter() {\r\n let holder = this.$refs.gridbody.find('.data-grid-hover-holder')[0];\r\n if (holder != null) {\r\n if (holder.nowKeyid != null) {\r\n holder.nowKeyid = null;\r\n }\r\n if (holder.style.display !== 'none') {\r\n holder.style.display = 'none';\r\n }\r\n }\r\n if (this.$refs.gridbody_fixed != null) {\r\n holder = this.$refs.gridbody_fixed.find('.data-grid-hover-holder')[0];\r\n if (holder != null) {\r\n if (holder.nowKeyid != null) {\r\n holder.nowKeyid = null;\r\n }\r\n if (holder.style.display !== 'none') {\r\n holder.style.display = 'none';\r\n }\r\n }\r\n }\r\n}\r\n\r\nfunction createHeader(cols) {\r\n const prefix = cols == null ? '' : '_fixed';\r\n cols = cols || this.columns;\r\n const table = $('<table class=\"data-grid-table-header\"></table>');\r\n const header = $('<tr class=\"data-grid-header\"></tr>');\r\n table.on('mouseenter', () => tableHeaderMouseEnter.call(this));\r\n table.append(header);\r\n\r\n // header column\r\n const sizeHolder = this.$elems.sizeHolder;\r\n for (let i = 0; i < cols.length; i += 1) {\r\n const col = cols[i];\r\n if (col.visible === false) {\r\n if (col.sortable === true) {\r\n // eslint-disable-next-line no-return-assign\r\n const sortclick = e => headerClick.call(col, e, true);\r\n header.append($('<th class=\"data-column-header\"><div></div><span></span></th>')\r\n .hide()\r\n .attr('data-key', col.key)\r\n .on('mouseup', this, sortclick));\r\n } else {\r\n header.append($('<th class=\"data-column-header\"><div></div><span></span></th>').hide());\r\n }\r\n continue;\r\n }\r\n if (col.width > 0 || col.isShrink) {\r\n col.autoResize = false;\r\n } else {\r\n col.autoResize = true;\r\n this._needAutoResize = true;\r\n sizeHolder.text(col.caption);\r\n let headerWidth = sizeHolder.width() + 20;\r\n if (headerWidth < MINI_COLUMN_WIDTH) {\r\n headerWidth = MINI_COLUMN_WIDTH;\r\n }\r\n col.width = headerWidth;\r\n }\r\n if (col.align == null) {\r\n col.align = 'left';\r\n }\r\n if (col.istotal) {\r\n col.sortable = false;\r\n } else if (col.sortable !== false && col.caption != null && String(col.caption).length > 0) {\r\n col.sortable = true;\r\n }\r\n if (col.isShrink) {\r\n col.style = { 'text-align': col.align };\r\n } else {\r\n col.style = {\r\n width: col.width,\r\n 'max-width': col.width,\r\n 'min-width': col.width,\r\n 'text-align': col.align,\r\n };\r\n }\r\n const click = e => headerClick.call(col, e);\r\n const drag = e => dragStart.call(col, e);\r\n const resize = e => resizeStart.call(col, e);\r\n const allcheck = e => checkAllColumn.call(this, col, $(e.target).prop('checked'));\r\n const th = $('<th class=\"data-column-header\"></th>').attr('data-key', col.key).css(col.style).css('cursor', col.sortable ? 'pointer' : 'auto')\r\n .on('mouseup', this, click)\r\n .on('touchend', this, click)\r\n .on('mousedown', this, drag)\r\n .on('touchstart', this, drag);\r\n if (col.istotal) {\r\n th.addClass('data-grid-column-header-total');\r\n }\r\n if (col.enabled !== false && col.allcheck && col.type === COLUMN_TYPE.checkbox) {\r\n const wrapper = $('<label></label>');\r\n const check = $('<input type=\"checkbox\" />').on('change', allcheck);\r\n const checkinner = $('<layer class=\"check-box-inner\"><svg><use xlink:href=\"#gridview-check\"></use></svg></layer>');\r\n wrapper.append(check, checkinner);\r\n if (col.caption == null || col.caption.length === 0) {\r\n col.sortable = false;\r\n }\r\n th.append($('<div class=\"data-column-header-text\"></div>').css(col.textStyle || {}).append(\r\n $('<span></span>').append(wrapper, $('<span></span>').text(col.caption).attr('title', this.headerTitle !== false ? col.caption : ''))));\r\n } else if (typeof col.caption === 'function') {\r\n th.append($('<div class=\"data-column-header-text\"></div>').css(col.textStyle || {}).append(col.caption()));\r\n } else {\r\n th.append($('<div class=\"data-column-header-text\"></div>').css(col.textStyle || {}).append($('<span></span>').text(col.caption).attr('title', this.headerTitle !== false ? col.caption : '')));\r\n }\r\n th.append($('<span class=\"arrow\"></span>'));\r\n if (col.allowFilter) {\r\n const filterclick = e => filterClick.call(col, e);\r\n const filter = $('<div class=\"data-column-header-filter no-filter\"><svg class=\"arrow no-filter\"><use xlink:href=\"#ellipsis-h\"></use></svg><svg class=\"arrow filtered\"><use xlink:href=\"#filter\"></use></svg></div>')\r\n .on('mousedown', this, filterclick)\r\n .on('touchstart', this, filterclick);\r\n if (col.isFiltered) {\r\n filter.removeClass('no-filter').addClass('filtered');\r\n }\r\n th.addClass('data-column-header-has-filter').append(filter);\r\n }\r\n const split = $('<span class=\"data-column-header-split\"><div></div></span>')\r\n .on('mousedown', this, resize)\r\n .on('touchstart', this, resize);\r\n if (col.resizable === false) {\r\n split.css('display', 'none');\r\n }\r\n if (col.tooltip != null) {\r\n let tooltip = col.tooltip;\r\n if (typeof tooltip === 'function') {\r\n tooltip = tooltip(col);\r\n }\r\n th.attr('title', tooltip);\r\n }\r\n th.append(split);\r\n header.append(th);\r\n }\r\n header.append('<th class=\"data-column-header-holder\">&nbsp;</th>');\r\n const dragger = $('<div class=\"data-column-header-dragger\"></div>').hide();\r\n const draggerCursor = $('<div class=\"data-column-header-dragger-cursor\"></div>').hide();\r\n header.append($('<th></th>').append(dragger, draggerCursor));\r\n\r\n sizeHolder.empty();\r\n this.$refs[`headerTable${prefix}`] = table;\r\n this.$refs[`header${prefix}`] = header;\r\n this.$refs[`dragger${prefix}`] = dragger;\r\n this.$refs[`draggerCursor${prefix}`] = draggerCursor;\r\n return table;\r\n}\r\n\r\nfunction createBody(cols) {\r\n const prefix = cols == null ? '' : '_fixed';\r\n const gridbody = $('<div class=\"data-grid-body\"></div>');\r\n if (this.oddStyle) {\r\n gridbody.addClass('data-grid-odd-style');\r\n } else {\r\n gridbody.addClass('data-grid-even-style');\r\n }\r\n if (cols == null) {\r\n gridbody[0].addEventListener('scroll', (e) => {\r\n if (this.$refs.gridbody_fixed != null) {\r\n this.$refs.gridbody_fixed[0].scrollTop = e.target.scrollTop;\r\n }\r\n func.throttle(gridonscroll, REFRESH_INTERVAL, this, e);\r\n }, { passive: true });\r\n } else {\r\n gridbody.on('mousewheel DOMMouseScroll', (e) => {\r\n const delta = -e.originalEvent.wheelDelta || (e.originalEvent.detail * 40);\r\n const evt = { target: this.$refs.gridbody[0] };\r\n evt.target.scrollTop += delta;\r\n gridonscroll.call(this, evt);\r\n });\r\n }\r\n cols = cols || this.columns;\r\n this._containerHeight = this.source.length * this.rowHeight;\r\n\r\n let width;\r\n if (this._containerHeight === 0) {\r\n this._containerHeight = 1;\r\n width = 0;\r\n for (let i = 0; i < cols.length; i += 1) {\r\n if (cols[i].visible !== false && !isNaN(cols[i].width)) {\r\n width += cols[i].width + 1;\r\n }\r\n }\r\n width += 1;\r\n } else {\r\n width = null;\r\n }\r\n const gridbodyContainer = $('<div></div>').css({\r\n position: 'relative',\r\n 'min-width': '100%',\r\n 'min-height': 1,\r\n height: this._containerHeight,\r\n width,\r\n });\r\n gridbody.append(gridbodyContainer);\r\n\r\n const gridcontent = $('<table class=\"data-grid-body-content\"><tbody></tbody></table>');\r\n const tbody = gridcontent.children('tbody')[0];\r\n gridbodyContainer.append(gridcontent);\r\n\r\n adjustRows.call(this, tbody, cols);\r\n\r\n const onrowclick = (e) => {\r\n const keyid = e.currentTarget.nowKeyid;\r\n if (keyid == null) {\r\n return;\r\n }\r\n // eslint-disable-next-line\r\n return rowOnClick.call(this, e, (keyid >>> MAX_COLUMN_BIT) - this.startIndex, keyid & MAX_COLUMN_MASK);\r\n };\r\n const onrowdblclick = e => rowOnDblClick.call(this, e, false);\r\n if (!this.noHoverHolder) {\r\n const hoverHolder = $('<div class=\"data-grid-hover-holder\"></div>').hide()\r\n .on('mousedown', onrowclick)\r\n .on('touchstart', onrowclick)\r\n .on('dblclick', onrowdblclick);\r\n gridbodyContainer.append(hoverHolder);\r\n gridbody.on('mousemove', hoverHolder[0], e => func.throttle(gridbodyMouseMove, REFRESH_INTERVAL, this, e));\r\n }\r\n\r\n this.$refs[`gridbody${prefix}`] = gridbody;\r\n this.$refs[`gridbodyContainer${prefix}`] = gridbodyContainer;\r\n this.$refs[`gridbodyContent${prefix}`] = gridcontent;\r\n this.$elems[`gridbodyContent${prefix}`] = tbody;\r\n\r\n this.refresh();\r\n return gridbody;\r\n}\r\n\r\nfunction createTotals(cols) {\r\n if (this.total == null) {\r\n return null;\r\n }\r\n const prefix = cols == null ? '' : '_fixed';\r\n const total = $('<div class=\"data-grid-total\"></div>');\r\n const gridtotal = $('<table class=\"data-grid-table-total\"></table>');\r\n total.append(gridtotal);\r\n const onrowdblclick = e => rowOnDblClick.call(this, e, true);\r\n const totalbody = $('<tr class=\"data-grid-total-body\"></tr>').on('dblclick', onrowdblclick);\r\n gridtotal.append(totalbody);\r\n\r\n const sizeHolder = this.$elems.sizeHolder;\r\n cols = cols || this.columns;\r\n for (let i = 0; i < cols.length; i += 1) {\r\n const col = cols[i];\r\n const th = $('<th class=\"data-grid-total-row\"></th>');\r\n if (col.visible === false) {\r\n th.hide();\r\n } else {\r\n let val;\r\n if (col.istotal) {\r\n val = null;\r\n } else {\r\n val = this.total[col.key];\r\n if (val != null && val.DisplayValue != null) {\r\n val = val.DisplayValue;\r\n }\r\n }\r\n if (val == null) {\r\n val = '';\r\n }\r\n if (col.autoResize) {\r\n sizeHolder.html(val);\r\n const totalWidth = sizeHolder.width() + 10;\r\n if (totalWidth > col.width) {\r\n const w = `${totalWidth}px`;\r\n this.$refs.header[0].children[i].style.width = w;\r\n this.$refs.header[0].children[i].style.minWidth = w;\r\n this.$refs.header[0].children[i].style.maxWidth = w;\r\n col.width = totalWidth;\r\n col.style.width = totalWidth;\r\n col.style['max-width'] = totalWidth;\r\n col.style['min-width'] = totalWidth;\r\n }\r\n }\r\n th.append($('<div></div>').css(col.style).html(val));\r\n }\r\n totalbody.append(th);\r\n }\r\n\r\n sizeHolder.empty();\r\n this.$refs[`gridtotal${prefix}`] = gridtotal;\r\n this.$refs[`gridtotalbody${prefix}`] = totalbody;\r\n this.$refs[`total${prefix}`] = total;\r\n return total;\r\n}\r\n\r\n// 初始化 GridView 结构\r\nGridView.prototype.init = function init(p) {\r\n delete this.$elems.sizeHolder;\r\n delete this.$el;\r\n this.$refs = {};\r\n this._rendering = true;\r\n this._overflows = {};\r\n this._scrollLeft = 0;\r\n\r\n this.innerSource = this.source;\r\n this.virtual = this.source && this.source.length > this.virtualCount;\r\n p = p || this.$parent;\r\n if (typeof p === 'string') {\r\n p = $(p);\r\n }\r\n if (p == null) {\r\n throw new Error('no specified parent.');\r\n }\r\n this.$parent = p;\r\n const datagrid = $('<div class=\"data-grid\" tabindex=\"0\"></div>');\r\n datagrid.append('<svg xmlns=\"http://www.w3.org/2000/svg\" style=\"display: none\"><symbol id=\"gridview-check\" viewBox=\"0 0 512 512\"><path d=\"M435.848 83.466L172.804 346.51l-96.652-96.652c-4.686-4.686-12.284-4.686-16.971 0l-28.284 28.284c-4.686 4.686-4.686 12.284 0 16.971l133.421 133.421c4.686 4.686 12.284 4.686 16.971 0l299.813-299.813c4.686-4.686 4.686-12.284 0-16.971l-28.284-28.284c-4.686-4.686-12.284-4.686-16.97 0z\"></path></symbol><symbol id=\"spinner-third\" viewBox=\"0 0 512 512\"><path d=\"M456.433 371.72l-27.79-16.045c-7.192-4.152-10.052-13.136-6.487-20.636 25.82-54.328 23.566-118.602-6.768-171.03-30.265-52.529-84.802-86.621-144.76-91.424C262.35 71.922 256 64.953 256 56.649V24.56c0-9.31 7.916-16.609 17.204-15.96 81.795 5.717 156.412 51.902 197.611 123.408 41.301 71.385 43.99 159.096 8.042 232.792-4.082 8.369-14.361 11.575-22.424 6.92z\"></path></symbol><symbol id=\"ellipsis-h\" viewBox=\"0 0 320 512\"><path d=\"M192 256c0 17.7-14.3 32-32 32s-32-14.3-32-32 14.3-32 32-32 32 14.3 32 32zm88-32c-17.7 0-32 14.3-32 32s14.3 32 32 32 32-14.3 32-32-14.3-32-32-32zm-240 0c-17.7 0-32 14.3-32 32s14.3 32 32 32 32-14.3 32-32-14.3-32-32-32z\"></path></symbol><symbol id=\"filter\" viewBox=\"0 0 512 512\"><path d=\"M479.968 0H32.038C3.613 0-10.729 34.487 9.41 54.627L192 237.255V424a31.996 31.996 0 0 0 10.928 24.082l64 55.983c20.438 17.883 53.072 3.68 53.072-24.082V237.255L502.595 54.627C522.695 34.528 508.45 0 479.968 0zM288 224v256l-64-56V224L32 32h448L288 224z\"></path></symbol><symbol id=\"search\" viewBox=\"0 0 512 512\"><path d=\"M508.5 481.6l-129-129c-2.3-2.3-5.3-3.5-8.5-3.5h-10.3C395 312 416 262.5 416 208 416 93.1 322.9 0 208 0S0 93.1 0 208s93.1 208 208 208c54.5 0 104-21 141.1-55.2V371c0 3.2 1.3 6.2 3.5 8.5l129 129c4.7 4.7 12.3 4.7 17 0l9.9-9.9c4.7-4.7 4.7-12.3 0-17zM208 384c-97.3 0-176-78.7-176-176S110.7 32 208 32s176 78.7 176 176-78.7 176-176 176z\"></path></symbol></svg>');\r\n const sizeHolder = $('<span class=\"data-grid-size-holder\"></span>');\r\n datagrid.on('keydown', (e) => {\r\n let index = this.selectedIndex;\r\n let flag = false;\r\n if (e.key === 'ArrowUp') {\r\n // up\r\n flag = true;\r\n if (index > 1) {\r\n delete this.source[index].__selected;\r\n index -= 1;\r\n } else {\r\n index = 0;\r\n }\r\n } else if (e.key === 'ArrowDown') {\r\n // down\r\n flag = true;\r\n const dataCount = (this.source && this.source.length) || 0;\r\n if (index < dataCount - 1) {\r\n delete this.source[index].__selected;\r\n index += 1;\r\n }\r\n }\r\n if (flag) {\r\n this.selectedIndexes = [index];\r\n this.scrollToIndex(index);\r\n this.source[index].__selected = true;\r\n this.refresh();\r\n if (typeof this.selectedrowchanged === 'function') {\r\n this.selectedrowchanged(index);\r\n }\r\n return false;\r\n }\r\n return true;\r\n });\r\n datagrid.append(sizeHolder);\r\n this.$elems.sizeHolder = sizeHolder;\r\n p.empty().append(datagrid);\r\n\r\n const header = createHeader.call(this);\r\n const totals = createTotals.call(this);\r\n // datagrid.detach();\r\n datagrid.append(header);\r\n if (totals != null) {\r\n datagrid.append(totals);\r\n }\r\n const body = createBody.call(this);\r\n body.insertAfter(header);\r\n\r\n // fixed-columns\r\n let fixedCount = 0;\r\n for (let i = 0; i < this.columns.length; i += 1) {\r\n if (!this.columns[i].isfixed) {\r\n break;\r\n }\r\n fixedCount += 1;\r\n }\r\n if (fixedCount > 0) {\r\n const fixedColumns = this.columns.slice(0, fixedCount);\r\n this.fixedColumns = fixedColumns;\r\n const fixedDatagrid = $('<div class=\"data-grid data-grid-fixed\"></div>');\r\n p.append(fixedDatagrid);\r\n const fixedHeader = createHeader.call(this, false);\r\n const fixedTotals = createTotals.call(this, false);\r\n // calc the fixed width\r\n let fixedWidth = 0;\r\n // eslint-disable-next-line no-return-assign\r\n fixedColumns.forEach(c => fixedWidth += c.visible === false ? 0 : (c.width + 1));\r\n fixedDatagrid.css('width', fixedWidth);\r\n fixedDatagrid.append(fixedHeader);\r\n if (fixedTotals != null) {\r\n fixedDatagrid.append(fixedTotals);\r\n }\r\n const fixedBody = createBody.call(this, false);\r\n fixedBody.insertAfter(fixedHeader);\r\n\r\n this.$el_fixed = fixedDatagrid;\r\n }\r\n\r\n sizeHolder.remove();\r\n // p.append(datagrid);\r\n\r\n const loading = $('<div class=\"data-grid-loading\"><div><svg class=\"fa-spin fa-loading\"><use xlink:href=\"#spinner-third\"></use></svg></div></div>');\r\n this.$elems.loading = loading;\r\n datagrid.append(loading);\r\n this.$el = datagrid;\r\n\r\n delete this._rendering;\r\n if (this.sortIndex >= 0) {\r\n sortColumn.call(this, this.columns[this.sortIndex], true);\r\n } else {\r\n this.resize();\r\n }\r\n};\r\n\r\nfunction fillRows(els, cols, maxWidths) {\r\n const startIndex = this.startIndex;\r\n const selected = this.selectedIndexes;\r\n for (let i = 0; i < els.length; i += 1) {\r\n const vals = this.source[this.startIndex + i];\r\n if (!vals) {\r\n continue;\r\n }\r\n const item = vals.Values;\r\n const row = els[i];\r\n if (row.children.length <= 0) {\r\n continue;\r\n }\r\n // selectd class\r\n const className = row.className;\r\n if (selected.indexOf(i + startIndex) >= 0) {\r\n if (className !== 'data-grid-row data-grid-row-selected') {\r\n row.className = 'data-grid-row data-grid-row-selected';\r\n }\r\n } else if (className !== 'data-grid-row') {\r\n row.className = 'data-grid-row';\r\n }\r\n // data\r\n for (let j = 0; j < cols.length; j += 1) {\r\n const col = cols[j];\r\n if (col.visible === false) {\r\n continue;\r\n }\r\n let val;\r\n if (col.text != null) {\r\n val = col.text;\r\n } else if (vals.__selected && typeof col.editFilter === 'function') {\r\n val = col.editFilter(item);\r\n } else if (typeof col.filter === 'function') {\r\n val = col.filter(item);\r\n } else {\r\n val = item[col.key];\r\n if (val != null && val.DisplayValue != null) {\r\n val = val.DisplayValue;\r\n }\r\n }\r\n if (val == null) {\r\n val = '';\r\n }\r\n // fill data\r\n const div = row.children[j];\r\n const span = div.children[0];\r\n // span.title = val;\r\n if (col.type === COLUMN_TYPE.checkbox) {\r\n const chkbox = span.querySelector('input');\r\n let disabled = col.enabled;\r\n if (typeof disabled === 'string') {\r\n disabled = item[disabled];\r\n } else if (typeof disabled === 'function') {\r\n disabled = disabled(item);\r\n }\r\n disabled = (disabled === false);\r\n if (chkbox.disabled !== disabled) {\r\n chkbox.disabled = disabled;\r\n }\r\n if (chkbox.checked !== val) {\r\n chkbox.checked = val;\r\n }\r\n } else if (this.allowHtml || col.allowHtml) {\r\n if (val instanceof $) {\r\n $(span).empty().append(val);\r\n } else {\r\n span.innerHTML = val;\r\n }\r\n } else {\r\n span.innerText = val;\r\n }\r\n // auto resize\r\n if (this._needAutoResize && col.autoResize) {\r\n // this.$elems.sizeHolder.innerText = val;\r\n // const width = this.$elems.sizeHolder.offsetWidth + 12;\r\n const width = div.scrollWidth;\r\n if (width > 0 && maxWidths != null && (maxWidths[j] == null || maxWidths[j] < width)) {\r\n maxWidths[j] = width;\r\n maxWidths.flag = true;\r\n }\r\n }\r\n if (col.isurl) {\r\n let href = item[col.href];\r\n if (href != null) {\r\n href = href.Value || href;\r\n } else {\r\n href = '';\r\n }\r\n if (href === '' && span.href !== '') {\r\n span.removeAttribute('href');\r\n } else if (href !== span.href) {\r\n span.href = href;\r\n }\r\n }\r\n if (col.classFilter != null) {\r\n const cls = col.classFilter(item) || '';\r\n if (cls !== span.className) {\r\n span.className = cls;\r\n }\r\n }\r\n if (col.styleFilter != null) {\r\n const style = col.styleFilter(item);\r\n if (span.style.length > 0) {\r\n span.style.cssText = '';\r\n }\r\n // eslint-disable-next-line no-restricted-syntax\r\n for (const key in style) {\r\n if (Object.prototype.hasOwnProperty.call(style, key)) {\r\n span.style[key] = style[key];\r\n }\r\n }\r\n }\r\n if (col.bgFilter != null) {\r\n const bgColor = col.bgFilter(item);\r\n div.style.backgroundColor = bgColor || '';\r\n }\r\n if (col.events != null) {\r\n // eslint-disable-next-line no-restricted-syntax\r\n for (const key in col.events) {\r\n if (Object.prototype.hasOwnProperty.call(col.events, key)) {\r\n span[key] = col.events[key].bind(item);\r\n }\r\n }\r\n }\r\n if (col.attrs != null) {\r\n let attrs = col.attrs;\r\n if (typeof attrs === 'function') {\r\n attrs = attrs(item);\r\n }\r\n // eslint-disable-next-line no-restricted-syntax\r\n for (const key in attrs) {\r\n if (Object.prototype.hasOwnProperty.call(attrs, key)) {\r\n span.setAttribute(key, attrs[key]);\r\n }\r\n }\r\n }\r\n }\r\n }\r\n}\r\n\r\nGridView.prototype.refresh = function refresh() {\r\n if (this.$refs.gridbodyContent == null) {\r\n throw new Error('the body has not been created.');\r\n }\r\n const els = this.$elems.gridbodyContent.children;\r\n const maxWidths = {};\r\n fillRows.call(this, els, this.columns, maxWidths);\r\n if (this.$elems.gridbodyContent_fixed != null) {\r\n fillRows.call(this, this.$elems.gridbodyContent_fixed.children, this.columns); // , this.fixedColumns\r\n }\r\n if (this._needAutoResize && maxWidths.flag) {\r\n delete this._needAutoResize;\r\n for (let i = 0; i < this.columns.length; i += 1) {\r\n if (!this.columns[i].autoResize) {\r\n continue;\r\n }\r\n const width = maxWidths[i];\r\n if (width > 0) {\r\n changeColumnWidth.call(this, i, width);\r\n }\r\n }\r\n // this.resize();\r\n }\r\n};\r\n\r\nGridView.prototype.refreshGrid = function refreshGrid() {\r\n this.$refs.header.find('.data-column-header-filter').removeClass('filtered').addClass('no-filter');\r\n const hasFixed = this.$refs.header_fixed != null;\r\n if (hasFixed) {\r\n this.$refs.header_fixed.find('.data-column-header-filter').removeClass('filtered').addClass('no-filter');\r\n }\r\n for (let i = 0; i < this.columns.length; i += 1) {\r\n const col = this.columns[i];\r\n if (col.filterValues != null && col.filterValues.length > 0) {\r\n let ecol = this.$refs.header.children().eq(i);\r\n ecol.find('.data-column-header-filter').removeClass('no-filter').addClass('filtered');\r\n if (hasFixed) {\r\n ecol = this.$refs.header_fixed.children().eq(i);\r\n if (ecol.length > 0) {\r\n ecol.find('.data-column-header-filter').removeClass('no-filter').addClass('filtered');\r\n }\r\n }\r\n }\r\n }\r\n this.source = this.innerSource.filter((it) => {\r\n for (let i = 0; i < this.columns.length; i += 1) {\r\n const col = this.columns[i];\r\n const v = getSpecialDefault((it.Values || it)[col.key], 'Value');\r\n if (col.filterValues != null && col.filterValues.indexOf(v) < 0) {\r\n return false;\r\n }\r\n }\r\n return true;\r\n });\r\n if (this.sortIndex >= 0) {\r\n sortColumn.call(this, this.columns[this.sortIndex], null, true);\r\n }\r\n this.reset();\r\n};\r\n\r\nGridView.prototype.resetScroll = function resetScroll(target) {\r\n if (this.$el == null) {\r\n throw new Error('grid view has not been initialized.');\r\n }\r\n if (target == null) {\r\n target = this.$refs.gridbody[0];\r\n }\r\n const left = target.scrollLeft;\r\n if (this._scrollLeft !== left) {\r\n this._scrollLeft = left;\r\n const l = `${-left}px`;\r\n this.$refs.headerTable[0].style.marginLeft = l;\r\n // if (this.$refs.headerTable_fixed != null) {\r\n // this.$refs.headerTable_fixed[0].style.marginLeft = l;\r\n // }\r\n if (this.$refs.gridtotal != null) {\r\n this.$refs.gridtotal[0].style.marginLeft = l;\r\n }\r\n if (typeof this.hscrolling === 'function') {\r\n this.hscrolling(-left);\r\n }\r\n }\r\n};\r\n\r\nGridView.prototype.resize = function resize(force) {\r\n if (this._rendering || this.$el == null) {\r\n return;\r\n }\r\n const gridbody = this.$refs.gridbody;\r\n const fixedGridbody = this.$refs.gridbody_fixed;\r\n const fixedHeaderTable = this.$refs.headerTable_fixed;\r\n let height = this.$refs.header.height() + 2;\r\n let top = gridbody[0].offsetTop;\r\n if (top !== height) {\r\n gridbody.css('top', height);\r\n if (fixedGridbody != null) {\r\n fixedGridbody.css('top', height);\r\n }\r\n if (fixedHeaderTable != null) { // && fixedHeaderTable[0].offsetHeight !== height\r\n fixedHeaderTable.css('height', height);\r\n }\r\n top = height;\r\n }\r\n\r\n height = this.height;\r\n if (height == null) {\r\n height = this.$el.height() - top;\r\n } else if (height === 0) {\r\n height = this.$refs.gridbodyContent.height();\r\n this.$el.css('height', top + height);\r\n }\r\n gridbody.css('height', height);\r\n let fixedHeight = height;\r\n if (fixedGridbody != null) {\r\n const offset = gridbody[0].offsetHeight - gridbody[0].clientHeight;\r\n fixedHeight -= offset;\r\n fixedGridbody.css('height', fixedHeight);\r\n if (this.$el_fixed != null) {\r\n this.$el_fixed.css('height', top + fixedHeight);\r\n }\r\n }\r\n // if (this.$el_fixed != null) {\r\n // const offset = gridbody[0].offsetHeight - gridbody[0].clientHeight;\r\n // this.$el_fixed.css('height', (top + height) - offset);\r\n // }\r\n const count = math.trunc((height - 1) / this.rowHeight) + (REDUN_NUM * 2) + 1;\r\n if (force || count !== this._bodyRowCount) {\r\n this._bodyRowCount = count;\r\n this.reload();\r\n }\r\n const width = this.$refs.gridbodyContent.width();\r\n // this.$refs.headerTable.css('width', width);\r\n\r\n const clientWidth = gridbody[0].clientWidth;\r\n this._bodyClientWidth = clientWidth;\r\n\r\n // hscrolling\r\n // if (typeof this.hscrolling === 'function') {\r\n // this.hscrolling(this.$refs.headerTable[0].scrollLeft);\r\n // }\r\n\r\n // total\r\n const total = this.$refs.total;\r\n if (total == null) {\r\n if (this.$refs.gridbodyContainer.height() !== this._containerHeight) {\r\n this.$refs.gridbodyContainer.css('height', this._containerHeight);\r\n if (this.$refs.gridbodyContainer_fixed != null) {\r\n this.$refs.gridbodyContainer_fixed.css('height', this._containerHeight);\r\n }\r\n }\r\n return;\r\n }\r\n const gridtotal = this.$refs.gridtotal;\r\n if (gridtotal.width() !== width) {\r\n gridtotal.css('width', width);\r\n }\r\n let totalheight = this.$refs.gridtotalbody.height();\r\n // if (fixedGridbody != null) {\r\n // fixedHeight -= totalheight;\r\n // fixedGridbody.css('height', fixedHeight);\r\n // if (this.$el_fixed != null) {\r\n // this.$el_fixed.css('height', top + fixedHeight);\r\n // }\r\n // }\r\n if (totalheight > 0 && gridtotal.height() !== totalheight) {\r\n gridtotal.css('height', totalheight);\r\n if (this.$refs.gridtotal_fixed != null) {\r\n this.$refs.gridtotal_fixed.css('height', totalheight);\r\n }\r\n if (this.$refs.gridtotalbody_fixed != null) {\r\n this.$refs.gridtotalbody_fixed.css('height', totalheight);\r\n this.$refs.gridtotalbody_fixed.children('th:first-child').css('height', totalheight);\r\n }\r\n }\r\n this.$refs.gridbodyContent.find('tr.data-grid-row-total-holder').css('height', totalheight);\r\n totalheight += this._containerHeight;\r\n if (this.$refs.gridbodyContainer.height() !== totalheight) {\r\n this.$refs.gridbodyContainer.css('height', totalheight);\r\n if (this.$refs.gridbodyContainer_fixed != null) {\r\n this.$refs.gridbodyContainer_fixed.css('height', totalheight);\r\n }\r\n }\r\n if (clientWidth === 0) {\r\n return;\r\n }\r\n const right = gridbody[0].offsetWidth - clientWidth;\r\n let style = total[0].style.right;\r\n if (right > 0 && style === '') {\r\n total[0].style.right = `${right}px`;\r\n } else if (right === 0 && style !== '') {\r\n total[0].style.right = '';\r\n }\r\n const bottom = gridbody[0].offsetHeight - gridbody[0].clientHeight;\r\n style = total[0].style.bottom;\r\n if (bottom > 0 && style === '') {\r\n total[0].style.bottom = `${bottom}px`;\r\n } else if (bottom === 0 && style !== '') {\r\n total[0].style.bottom = '';\r\n }\r\n};\r\n\r\nGridView.prototype.setData = function setData(data) {\r\n if (this.$el == null) {\r\n throw new Error('grid view has not been initialized.');\r\n }\r\n this._containerHeight = data.length * this.rowHeight;\r\n this._overflows = {};\r\n this.selectedColumnIndex = -1;\r\n // this.selectedIndexes.splice(0);\r\n this.selectedIndexes = [];\r\n this.startIndex = 0;\r\n this._scrollTop = 0;\r\n this.$refs.gridbody[0].scrollTop = 0;\r\n if (this.$refs.gridbody_fixed != null) {\r\n this.$refs.gridbody_fixed[0].scrollTop = 0;\r\n }\r\n\r\n this.$refs.gridbodyContent.css('top', 0);\r\n if (this.$refs.gridbodyContent_fixed != null) {\r\n this.$refs.gridbodyContent_fixed.css('top', 0);\r\n }\r\n this.$refs.gridbodyContainer.css('height', this._containerHeight);\r\n if (this.$refs.gridbodyContainer_fixed != null) {\r\n this.$refs.gridbodyContainer_fixed.css('height', this._containerHeight);\r\n }\r\n this.virtual = data.length > this.virtualCount;\r\n this.innerSource = data;\r\n\r\n // this.resetFilter();\r\n delete this._bodyRowCount;\r\n\r\n const headers = this.$refs.header.children('.data-column-header');\r\n for (let i = 0; i < headers.length; i += 1) {\r\n const header = $(headers[i]);\r\n const key = header.attr('data-key');\r\n if (key != null) {\r\n const col = this.columns.filter(c => c.key === key)[0];\r\n if (col != null && typeof col.caption === 'function') {\r\n header.children('.data-column-header-text').empty().append(col.caption());\r\n }\r\n }\r\n }\r\n\r\n if (this.columns.filter(c => c.filterValues != null).length > 0) {\r\n this.refreshGrid();\r\n } else {\r\n this.resize();\r\n\r\n if (this.sortIndex >= 0) {\r\n sortColumn.call(this, this.columns[this.sortIndex], true);\r\n }\r\n }\r\n};\r\n\r\nGridView.prototype.resetFilter = function resetFilter() {\r\n this.source = this.innerSource;\r\n\r\n // delete the filters\r\n for (let i = 0; i < this.columns.length; i += 1) {\r\n delete this.columns[i].filterValues;\r\n }\r\n if (typeof this.afterResetFilter === 'function') {\r\n this.afterResetFilter();\r\n }\r\n this.$refs.header.find('.data-column-header-filter.filtered').removeClass('filtered').addClass('no-filter');\r\n};\r\n\r\nGridView.prototype.scrollToIndex = function scrollToIndex(index) {\r\n const top = scrollToTop.call(this, index * this.rowHeight, true);\r\n this.$refs.gridbody.prop('scrollTop', top);\r\n if (this.$refs.gridbody_fixed != null) {\r\n this.$refs.gridbody_fixed.prop('scrollTop', top);\r\n }\r\n};\r\n\r\n// eslint-disable-next-line consistent-return\r\nGridView.prototype.scrollTop = function scrollTop(top) {\r\n if (top == null || isNaN(top)) {\r\n return this.$refs.gridbody.prop('scrollTop');\r\n }\r\n this.$refs.gridbody.prop('scrollTop', top);\r\n if (this.$refs.gridbody_fixed != null) {\r\n this.$refs.gridbody_fixed.prop('scrollTop', top);\r\n }\r\n this.reload();\r\n};\r\n\r\nGridView.prototype.reload = function reload() {\r\n this._containerHeight = this.source.length * this.rowHeight;\r\n adjustRows.call(this, this.$elems.gridbodyContent);\r\n if (this.$elems.gridbodyContent_fixed != null) {\r\n adjustRows.call(this, this.$elems.gridbodyContent_fixed); // , this.fixedColumns\r\n }\r\n this.refresh();\r\n};\r\n\r\nGridView.prototype.reset = function reset() {\r\n const top = this.$refs.gridbody.scrollTop();\r\n this.resize(true);\r\n // this.reload();\r\n if (this.virtual) {\r\n let t = top - ((top % (this.rowHeight * 2)) + (REDUN_NUM * this.rowHeight));\r\n if (t < 0) {\r\n t = 0;\r\n } else {\r\n const bottomTop = this._containerHeight - this.$refs.gridbody.height();\r\n if (t > bottomTop) {\r\n t = bottomTop;\r\n }\r\n }\r\n this._scrollTop = t;\r\n const toppx = `${t}px`;\r\n this.$refs.gridbodyContent[0].style.top = toppx;\r\n if (this.$refs.gridbodyContent_fixed != null) {\r\n this.$refs.gridbodyContent_fixed[0].style.top = toppx;\r\n }\r\n }\r\n this.$refs.gridbody.prop('scrollTop', top);\r\n if (this.$refs.gridbody_fixed != null) {\r\n this.$refs.gridbody_fixed.prop('scrollTop', top);\r\n }\r\n};\r\n\r\nGridView.prototype.deleteRow = function deleteRow(index) {\r\n if (this.$el == null) {\r\n throw new Error('grid view has not been initialized.');\r\n }\r\n this.innerSource.splice(index, 1);\r\n this.reload();\r\n};\r\n\r\nGridView.prototype.moveRow = function moveRow(index, step) {\r\n const item = this.innerSource[index];\r\n if (item == null || step === 0) {\r\n return;\r\n }\r\n let toIndex = index + step;\r\n if (step > 0) {\r\n if (toIndex >= this.innerSource.length) {\r\n toIndex = this.innerSource.length - 1;\r\n }\r\n } else if (toIndex < 0) {\r\n toIndex = 0;\r\n }\r\n this.innerSource.splice(index, 1);\r\n this.innerSource.splice(toIndex, 0, item);\r\n this.refresh();\r\n};\r\n\r\nGridView.prototype.closeFilterPanel = function closeFilterPanel() {\r\n const parent = $((this.$window || window).document.body);\r\n parent.children('.data-column-header-filter-panel').remove();\r\n};\r\n\r\nGridView.prototype.loading = function loading(flag) {\r\n if (flag === false) {\r\n this.$elems.loading.css({\r\n visibility: 'hidden',\r\n opacity: 0,\r\n });\r\n } else {\r\n this.$elems.loading.css({\r\n visibility: 'visible',\r\n opacity: 1,\r\n });\r\n }\r\n};\r\n\r\nGridView.clearGridWidth = function clearGridView(objectid, next) {\r\n _network.query('DeleteManagementGridWidth', [objectid], next, () => { });\r\n};\r\n\r\nGridView.applyGridWidth = function applyGridWidth(objectid, columns, grid, next, prefix) {\r\n _network.management('GetManagementChartGridLayout', [objectid], (e) => {\r\n // console.log(e);\r\n let tmpColumns = columns;\r\n if (e.Result && e.Result.length > 0) {\r\n if (typeof prefix === 'function') {\r\n prefix(e.Result);\r\n }\r\n tmpColumns = [];\r\n for (let i = 0; i < e.Result.length; i += 1) {\r\n const gridwidth = e.Result[i];\r\n let tmpcol;\r\n for (let j = 0; j < columns.length; j += 1) {\r\n if (columns[j].name === gridwidth.ColumnKey) {\r\n columns[j].width = gridwidth.Width;\r\n const sort = gridwidth.Sort;\r\n if (sort > 0) {\r\n grid.sortIndex = tmpColumns.length;\r\n grid.sortDirection = (sort === 2) ? -1 : 1;\r\n }\r\n tmpcol = columns[j];\r\n break;\r\n }\r\n }\r\n if (tmpcol != null) {\r\n tmpColumns.push(tmpcol);\r\n }\r\n }\r\n }\r\n grid.columns = tmpColumns;\r\n grid.init();\r\n if (next) {\r\n next();\r\n }\r\n }, () => {\r\n grid.columns = columns;\r\n grid.init();\r\n if (next) {\r\n next();\r\n }\r\n });\r\n};\r\n\r\nGridView.saveColumnInfo = function saveColumnInfo(objectid) {\r\n return function columnchanged() {\r\n const columnWidths = [];\r\n for (let i = 0; i < this.columns.length; i += 1) {\r\n let sort;\r\n if (this.sortIndex === i) {\r\n sort = this.sortDirection === -1 ? 2 : 1;\r\n } else {\r\n sort = 0;\r\n }\r\n const c = this.columns[i];\r\n const columnwidth = {\r\n $type: 'FI.FIC.Contracts.DataObjects.BaseObject.BaseGridWidth, FICIntf',\r\n ColumnKey: c.name,\r\n Width: c.autoResize ? -1 : c.width,\r\n OrderIndex: i,\r\n Sort: sort,\r\n };\r\n columnWidths.push(columnwidth);\r\n }\r\n _network.query('SaveManagementGridLayout', [{\r\n $type: 'FI.FIC.Contracts.DataObjects.BaseObject.BaseGridWidth[], FICintf',\r\n $values: columnWidths,\r\n }, objectid], () => { });\r\n };\r\n};\r\n\r\nmodule.exports = GridView;\r\n\n\n\n// WEBPACK FOOTER //\n// ./src/components/datagrid/gridview.js","module.exports = __WEBPACK_EXTERNAL_MODULE_4__;\n\n\n//////////////////\n// WEBPACK FOOTER\n// external \"$\"\n// module id = 4\n// module chunks = 2 4 5"],"sourceRoot":""}