From 88beab293591ff65458b2fc36de2b585bd29a9ea Mon Sep 17 00:00:00 2001 From: "tien.xuan.vo" Date: Mon, 7 Aug 2017 17:24:06 +0700 Subject: [PATCH] feat(bower): Add bower support --- .gitignore | 1 - bower.json | 14 + dist/autoFitColumns.js | 701 +++++++++++++++++++++++++++++++++ dist/autoFitColumns.js.map | 1 + dist/autoFitColumns.min.js | 2 + dist/autoFitColumns.min.js.map | 1 + 6 files changed, 719 insertions(+), 1 deletion(-) create mode 100644 bower.json create mode 100644 dist/autoFitColumns.js create mode 100644 dist/autoFitColumns.js.map create mode 100644 dist/autoFitColumns.min.js create mode 100644 dist/autoFitColumns.min.js.map diff --git a/.gitignore b/.gitignore index bf5b3b5..7708267 100644 --- a/.gitignore +++ b/.gitignore @@ -19,7 +19,6 @@ typings/ # Misc .ignore/ -dist/ # Editors diff --git a/bower.json b/bower.json new file mode 100644 index 0000000..6aed36a --- /dev/null +++ b/bower.json @@ -0,0 +1,14 @@ +{ + "name": "ui-grid-auto-fit-columns", + "version": "1.1.4", + "authors": [ + "Denis Bendrikov " + ], + "description": "The plugin ensures that the column width will be wide enough for showing the longest data of that column (or column name).", + "homepage": "https://github.com/Den-dp/ui-grid-auto-fit-columns", + "dependencies": {}, + "main": [ + "dist/autoFitColumns.js" + ], + "license": "MIT" +} diff --git a/dist/autoFitColumns.js b/dist/autoFitColumns.js new file mode 100644 index 0000000..e538bef --- /dev/null +++ b/dist/autoFitColumns.js @@ -0,0 +1,701 @@ +(function webpackUniversalModuleDefinition(root, factory) { + if(typeof exports === 'object' && typeof module === 'object') + module.exports = factory(require("angular")); + else if(typeof define === 'function' && define.amd) + define(["angular"], factory); + else { + var a = typeof exports === 'object' ? factory(require("angular")) : factory(root["angular"]); + for(var i in a) (typeof exports === 'object' ? exports : root)[i] = a[i]; + } +})(this, function(__WEBPACK_EXTERNAL_MODULE_1__) { +return /******/ (function(modules) { // webpackBootstrap +/******/ // The module cache +/******/ var installedModules = {}; + +/******/ // The require function +/******/ function __webpack_require__(moduleId) { + +/******/ // Check if module is in cache +/******/ if(installedModules[moduleId]) +/******/ return installedModules[moduleId].exports; + +/******/ // Create a new module (and put it into the cache) +/******/ var module = installedModules[moduleId] = { +/******/ exports: {}, +/******/ id: moduleId, +/******/ loaded: false +/******/ }; + +/******/ // Execute the module function +/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); + +/******/ // Flag the module as loaded +/******/ module.loaded = true; + +/******/ // Return the exports of the module +/******/ return module.exports; +/******/ } + + +/******/ // expose the modules object (__webpack_modules__) +/******/ __webpack_require__.m = modules; + +/******/ // expose the module cache +/******/ __webpack_require__.c = installedModules; + +/******/ // __webpack_public_path__ +/******/ __webpack_require__.p = ""; + +/******/ // Load entry module and return exports +/******/ return __webpack_require__(0); +/******/ }) +/************************************************************************/ +/******/ ([ +/* 0 */ +/***/ function(module, exports, __webpack_require__) { + + "use strict"; + var angular = __webpack_require__(1); + var UiGridAutoFitColumnsService_1 = __webpack_require__(2); + var UiGridAutoFitColumnsDirective_1 = __webpack_require__(17); + Object.defineProperty(exports, "__esModule", { value: true }); + exports.default = angular.module('ui.grid.autoFitColumns', ['ui.grid']) + .service('uiGridAutoFitColumnsService', UiGridAutoFitColumnsService_1.UiGridAutoFitColumnsService) + .directive('uiGridAutoFitColumns', UiGridAutoFitColumnsDirective_1.UiGridAutoFitColumnsDirective) + .name; + + +/***/ }, +/* 1 */ +/***/ function(module, exports) { + + module.exports = __WEBPACK_EXTERNAL_MODULE_1__; + +/***/ }, +/* 2 */ +/***/ function(module, exports, __webpack_require__) { + + "use strict"; + var get = __webpack_require__(3); + var Measurer_1 = __webpack_require__(15); + var UiGridMetrics_1 = __webpack_require__(16); + var UiGridAutoFitColumnsService = (function () { + /*@ngInject*/ + UiGridAutoFitColumnsService.$inject = ["$q", "$filter"]; + function UiGridAutoFitColumnsService($q, $filter) { + this.$q = $q; + this.$filter = $filter; + this.gridMetrics = new UiGridMetrics_1.default(); + } + UiGridAutoFitColumnsService.prototype.initializeGrid = function (grid) { + grid.registerColumnBuilder(this.colAutoFitColumnBuilder.bind(this)); + grid.registerColumnsProcessor(this.columnsProcessor.bind(this), 60); + UiGridAutoFitColumnsService.defaultGridOptions(grid.options); + }; + UiGridAutoFitColumnsService.defaultGridOptions = function (gridOptions) { + // true by default + gridOptions.enableColumnAutoFit = gridOptions.enableColumnAutoFit !== false; + }; + UiGridAutoFitColumnsService.prototype.getFilterIfExists = function (filterName) { + try { + return this.$filter(filterName); + } + catch (e) { + return null; + } + }; + UiGridAutoFitColumnsService.prototype.getFilteredValue = function (value, cellFilter) { + if (cellFilter && cellFilter !== '') { + var filter = this.getFilterIfExists(cellFilter); + if (filter) { + value = filter(value); + } + else { + // https://regex101.com/r/rC5eR5/2 + var re = /([^:]*):([^:]*):?([\s\S]+)?/; + var matches = void 0; + if ((matches = re.exec(cellFilter)) !== null) { + value = this.$filter(matches[1])(value, matches[2], matches[3]); + } + } + } + return value; + }; + UiGridAutoFitColumnsService.prototype.colAutoFitColumnBuilder = function (colDef, col, gridOptions) { + var promises = []; + if (colDef.enableColumnAutoFit === undefined) { + //TODO: make it as col.isResizable() + if (UiGridAutoFitColumnsService.isResizable(colDef)) { + colDef.enableColumnAutoFit = gridOptions.enableColumnAutoFit; + } + else { + colDef.enableColumnAutoFit = false; + } + } + return this.$q.all(promises); + }; + UiGridAutoFitColumnsService.isResizable = function (colDef) { + return !colDef.hasOwnProperty('width'); + }; + UiGridAutoFitColumnsService.prototype.columnsProcessor = function (renderedColumnsToProcess, rows) { + var _this = this; + if (!rows.length) { + return renderedColumnsToProcess; + } + // TODO: respect existing colDef options + // if (col.colDef.enableColumnAutoFitting === false) return; + var optimalWidths = {}; + renderedColumnsToProcess.forEach(function (column) { + if (column.colDef.enableColumnAutoFit) { + var columnKey_1 = column.field || column.name; + optimalWidths[columnKey_1] = Measurer_1.default.measureRoundedTextWidth(column.displayName, _this.gridMetrics.getHeaderFont()) + _this.gridMetrics.getHeaderButtonsWidth(); + rows.forEach(function (row) { + var cellText = get(row.entity, columnKey_1); + if (!!column.colDef.cellFilter) { + cellText = _this.getFilteredValue(cellText, column.colDef.cellFilter); + } + var currentCellWidth = Measurer_1.default.measureRoundedTextWidth(cellText, _this.gridMetrics.getCellFont()); + var optimalCellWidth = currentCellWidth > 300 ? 300 : currentCellWidth; + if (optimalCellWidth > optimalWidths[columnKey_1]) { + optimalWidths[columnKey_1] = optimalCellWidth; + } + }); + column.colDef.width = optimalWidths[columnKey_1] + _this.gridMetrics.getPadding() + _this.gridMetrics.getBorder(); + column.updateColumnDef(column.colDef, false); + } + }); + return renderedColumnsToProcess; + }; + return UiGridAutoFitColumnsService; + }()); + exports.UiGridAutoFitColumnsService = UiGridAutoFitColumnsService; + + +/***/ }, +/* 3 */ +/***/ function(module, exports, __webpack_require__) { + + var baseGet = __webpack_require__(4), + toPath = __webpack_require__(7); + + /** + * Gets the property value at `path` of `object`. If the resolved value is + * `undefined` the `defaultValue` is used in its place. + * + * @static + * @memberOf _ + * @category Object + * @param {Object} object The object to query. + * @param {Array|string} path The path of the property to get. + * @param {*} [defaultValue] The value returned if the resolved value is `undefined`. + * @returns {*} Returns the resolved value. + * @example + * + * var object = { 'a': [{ 'b': { 'c': 3 } }] }; + * + * _.get(object, 'a[0].b.c'); + * // => 3 + * + * _.get(object, ['a', '0', 'b', 'c']); + * // => 3 + * + * _.get(object, 'a.b.c', 'default'); + * // => 'default' + */ + function get(object, path, defaultValue) { + var result = object == null ? undefined : baseGet(object, toPath(path), (path + '')); + return result === undefined ? defaultValue : result; + } + + module.exports = get; + + +/***/ }, +/* 4 */ +/***/ function(module, exports, __webpack_require__) { + + var toObject = __webpack_require__(5); + + /** + * The base implementation of `get` without support for string paths + * and default values. + * + * @private + * @param {Object} object The object to query. + * @param {Array} path The path of the property to get. + * @param {string} [pathKey] The key representation of path. + * @returns {*} Returns the resolved value. + */ + function baseGet(object, path, pathKey) { + if (object == null) { + return; + } + if (pathKey !== undefined && pathKey in toObject(object)) { + path = [pathKey]; + } + var index = 0, + length = path.length; + + while (object != null && index < length) { + object = object[path[index++]]; + } + return (index && index == length) ? object : undefined; + } + + module.exports = baseGet; + + +/***/ }, +/* 5 */ +/***/ function(module, exports, __webpack_require__) { + + var isObject = __webpack_require__(6); + + /** + * Converts `value` to an object if it's not one. + * + * @private + * @param {*} value The value to process. + * @returns {Object} Returns the object. + */ + function toObject(value) { + return isObject(value) ? value : Object(value); + } + + module.exports = toObject; + + +/***/ }, +/* 6 */ +/***/ function(module, exports) { + + /** + * Checks if `value` is the [language type](https://es5.github.io/#x8) of `Object`. + * (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) + * + * @static + * @memberOf _ + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is an object, else `false`. + * @example + * + * _.isObject({}); + * // => true + * + * _.isObject([1, 2, 3]); + * // => true + * + * _.isObject(1); + * // => false + */ + function isObject(value) { + // Avoid a V8 JIT bug in Chrome 19-20. + // See https://code.google.com/p/v8/issues/detail?id=2291 for more details. + var type = typeof value; + return !!value && (type == 'object' || type == 'function'); + } + + module.exports = isObject; + + +/***/ }, +/* 7 */ +/***/ function(module, exports, __webpack_require__) { + + var baseToString = __webpack_require__(8), + isArray = __webpack_require__(9); + + /** Used to match property names within property paths. */ + var rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\n\\]|\\.)*?)\2)\]/g; + + /** Used to match backslashes in property paths. */ + var reEscapeChar = /\\(\\)?/g; + + /** + * Converts `value` to property path array if it's not one. + * + * @private + * @param {*} value The value to process. + * @returns {Array} Returns the property path array. + */ + function toPath(value) { + if (isArray(value)) { + return value; + } + var result = []; + baseToString(value).replace(rePropName, function(match, number, quote, string) { + result.push(quote ? string.replace(reEscapeChar, '$1') : (number || match)); + }); + return result; + } + + module.exports = toPath; + + +/***/ }, +/* 8 */ +/***/ function(module, exports) { + + /** + * Converts `value` to a string if it's not one. An empty string is returned + * for `null` or `undefined` values. + * + * @private + * @param {*} value The value to process. + * @returns {string} Returns the string. + */ + function baseToString(value) { + return value == null ? '' : (value + ''); + } + + module.exports = baseToString; + + +/***/ }, +/* 9 */ +/***/ function(module, exports, __webpack_require__) { + + var getNative = __webpack_require__(10), + isLength = __webpack_require__(14), + isObjectLike = __webpack_require__(13); + + /** `Object#toString` result references. */ + var arrayTag = '[object Array]'; + + /** Used for native method references. */ + var objectProto = Object.prototype; + + /** + * Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring) + * of values. + */ + var objToString = objectProto.toString; + + /* Native method references for those with the same name as other `lodash` methods. */ + var nativeIsArray = getNative(Array, 'isArray'); + + /** + * Checks if `value` is classified as an `Array` object. + * + * @static + * @memberOf _ + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. + * @example + * + * _.isArray([1, 2, 3]); + * // => true + * + * _.isArray(function() { return arguments; }()); + * // => false + */ + var isArray = nativeIsArray || function(value) { + return isObjectLike(value) && isLength(value.length) && objToString.call(value) == arrayTag; + }; + + module.exports = isArray; + + +/***/ }, +/* 10 */ +/***/ function(module, exports, __webpack_require__) { + + var isNative = __webpack_require__(11); + + /** + * Gets the native function at `key` of `object`. + * + * @private + * @param {Object} object The object to query. + * @param {string} key The key of the method to get. + * @returns {*} Returns the function if it's native, else `undefined`. + */ + function getNative(object, key) { + var value = object == null ? undefined : object[key]; + return isNative(value) ? value : undefined; + } + + module.exports = getNative; + + +/***/ }, +/* 11 */ +/***/ function(module, exports, __webpack_require__) { + + var isFunction = __webpack_require__(12), + isObjectLike = __webpack_require__(13); + + /** Used to detect host constructors (Safari > 5). */ + var reIsHostCtor = /^\[object .+?Constructor\]$/; + + /** Used for native method references. */ + var objectProto = Object.prototype; + + /** Used to resolve the decompiled source of functions. */ + var fnToString = Function.prototype.toString; + + /** Used to check objects for own properties. */ + var hasOwnProperty = objectProto.hasOwnProperty; + + /** Used to detect if a method is native. */ + var reIsNative = RegExp('^' + + fnToString.call(hasOwnProperty).replace(/[\\^$.*+?()[\]{}|]/g, '\\$&') + .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$' + ); + + /** + * Checks if `value` is a native function. + * + * @static + * @memberOf _ + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a native function, else `false`. + * @example + * + * _.isNative(Array.prototype.push); + * // => true + * + * _.isNative(_); + * // => false + */ + function isNative(value) { + if (value == null) { + return false; + } + if (isFunction(value)) { + return reIsNative.test(fnToString.call(value)); + } + return isObjectLike(value) && reIsHostCtor.test(value); + } + + module.exports = isNative; + + +/***/ }, +/* 12 */ +/***/ function(module, exports, __webpack_require__) { + + var isObject = __webpack_require__(6); + + /** `Object#toString` result references. */ + var funcTag = '[object Function]'; + + /** Used for native method references. */ + var objectProto = Object.prototype; + + /** + * Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring) + * of values. + */ + var objToString = objectProto.toString; + + /** + * Checks if `value` is classified as a `Function` object. + * + * @static + * @memberOf _ + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. + * @example + * + * _.isFunction(_); + * // => true + * + * _.isFunction(/abc/); + * // => false + */ + function isFunction(value) { + // The use of `Object#toString` avoids issues with the `typeof` operator + // in older versions of Chrome and Safari which return 'function' for regexes + // and Safari 8 which returns 'object' for typed array constructors. + return isObject(value) && objToString.call(value) == funcTag; + } + + module.exports = isFunction; + + +/***/ }, +/* 13 */ +/***/ function(module, exports) { + + /** + * Checks if `value` is object-like. + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is object-like, else `false`. + */ + function isObjectLike(value) { + return !!value && typeof value == 'object'; + } + + module.exports = isObjectLike; + + +/***/ }, +/* 14 */ +/***/ function(module, exports) { + + /** + * Used as the [maximum length](http://ecma-international.org/ecma-262/6.0/#sec-number.max_safe_integer) + * of an array-like value. + */ + var MAX_SAFE_INTEGER = 9007199254740991; + + /** + * Checks if `value` is a valid array-like length. + * + * **Note:** This function is based on [`ToLength`](http://ecma-international.org/ecma-262/6.0/#sec-tolength). + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a valid length, else `false`. + */ + function isLength(value) { + return typeof value == 'number' && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER; + } + + module.exports = isLength; + + +/***/ }, +/* 15 */ +/***/ function(module, exports) { + + "use strict"; + var Measurer = (function () { + function Measurer() { + } + Measurer.measureTextWidth = function (text, font) { + var canvas = Measurer.canvas || (Measurer.canvas = document.createElement('canvas')); + var context = canvas.getContext('2d'); + context.font = font; + var metrics = context.measureText(text); + return metrics.width; + }; + Measurer.measureRoundedTextWidth = function (text, font) { + var width = Measurer.measureTextWidth(text, font); + return Math.floor(width) + 1; + }; + return Measurer; + }()); + exports.Measurer = Measurer; + Object.defineProperty(exports, "__esModule", { value: true }); + exports.default = Measurer; + + +/***/ }, +/* 16 */ +/***/ function(module, exports) { + + "use strict"; + var UiGridMetrics = (function () { + function UiGridMetrics() { + } + UiGridMetrics.prototype.getHeaderFont = function () { + if (this.headerFont) { + return this.headerFont; + } + var header = document.querySelector('.ui-grid-header-cell .ui-grid-cell-contents'); + if (!header) { + throw new Error('not found: .ui-grid-header-cell .ui-grid-cell-contents'); + } + var headerStyle = getComputedStyle(header); + this.headerFont = UiGridMetrics.getFontStringFrom(headerStyle); + return this.headerFont; + }; + UiGridMetrics.prototype.getCellFont = function () { + if (this.cellFont) { + return this.cellFont; + } + var cell = document.querySelector('.ui-grid-cell > .ui-grid-cell-contents'); + if (!cell) { + var element = document.createElement('div'); + element.className = 'ui-grid-cell-contents'; + element.style.cssFloat = 'left'; + angular.element(document.body).append(element); + var cellStyle_1 = getComputedStyle(element); + this.cellFont = UiGridMetrics.getFontStringFrom(cellStyle_1); + angular.element(element).remove(); + return this.cellFont; + } + var cellStyle = getComputedStyle(cell); + this.cellFont = UiGridMetrics.getFontStringFrom(cellStyle); + return this.cellFont; + }; + UiGridMetrics.prototype.getPadding = function () { + if (this.padding) { + return this.padding; + } + var header = document.querySelector('.ui-grid-header-cell .ui-grid-cell-contents'); + if (!header) { + throw new Error('not found: .ui-grid-header-cell .ui-grid-cell-contents'); + } + var _a = getComputedStyle(header), paddingLeft = _a.paddingLeft, paddingRight = _a.paddingRight; + this.padding = parseInt(paddingLeft) + parseInt(paddingRight); + return this.padding; + }; + UiGridMetrics.prototype.getBorder = function () { + if (this.border) { + return this.border; + } + var header = document.querySelector('.ui-grid-header-cell'); + if (!header) { + throw new Error('not found: .ui-grid-header-cell'); + } + var borderRightWidth = getComputedStyle(header).borderRightWidth; + this.border = parseInt(borderRightWidth); + return this.border; + }; + UiGridMetrics.prototype.getHeaderButtonsWidth = function () { + // TODO: lets be more precise + var HEADER_BUTTONS_WIDTH = 25; + return HEADER_BUTTONS_WIDTH; + }; + UiGridMetrics.getFontStringFrom = function (_a) { + var fontStyle = _a.fontStyle, fontVariant = _a.fontVariant, fontWeight = _a.fontWeight, fontSize = _a.fontSize, fontFamily = _a.fontFamily; + // in FF cssStyle.font may be '' so we need to collect it manually + // font: [font-style||font-variant||font-weight] font-size [/line-height] font-family | inherit + return fontStyle + " " + fontVariant + " " + fontWeight + " " + fontSize + " " + fontFamily; + }; + return UiGridMetrics; + }()); + exports.UiGridMetrics = UiGridMetrics; + Object.defineProperty(exports, "__esModule", { value: true }); + exports.default = UiGridMetrics; + + +/***/ }, +/* 17 */ +/***/ function(module, exports) { + + "use strict"; + /*@ngInject*/ + UiGridAutoFitColumnsDirective.$inject = ["uiGridAutoFitColumnsService"]; + function UiGridAutoFitColumnsDirective(uiGridAutoFitColumnsService) { + return { + replace: true, + priority: 0, + require: '^uiGrid', + scope: false, + compile: function () { + return { + pre: function ($scope, $elm, $attrs, uiGridCtrl) { + uiGridAutoFitColumnsService.initializeGrid(uiGridCtrl.grid); + } + }; + } + }; + } + exports.UiGridAutoFitColumnsDirective = UiGridAutoFitColumnsDirective; + + +/***/ } +/******/ ]) +}); +; +//# sourceMappingURL=autoFitColumns.js.map \ No newline at end of file diff --git a/dist/autoFitColumns.js.map b/dist/autoFitColumns.js.map new file mode 100644 index 0000000..123e600 --- /dev/null +++ b/dist/autoFitColumns.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["webpack:///webpack/universalModuleDefinition","webpack:///webpack/bootstrap 44cb53805f1088007aac","webpack:///./src/index.ts","webpack:///external \"angular\"","webpack:///./src/UiGridAutoFitColumnsService.ts","webpack:///./~/lodash/object/get.js","webpack:///./~/lodash/internal/baseGet.js","webpack:///./~/lodash/internal/toObject.js","webpack:///./~/lodash/lang/isObject.js","webpack:///./~/lodash/internal/toPath.js","webpack:///./~/lodash/internal/baseToString.js","webpack:///./~/lodash/lang/isArray.js","webpack:///./~/lodash/internal/getNative.js","webpack:///./~/lodash/lang/isNative.js","webpack:///./~/lodash/lang/isFunction.js","webpack:///./~/lodash/internal/isObjectLike.js","webpack:///./~/lodash/internal/isLength.js","webpack:///./src/Measurer.ts","webpack:///./src/UiGridMetrics.ts","webpack:///./src/UiGridAutoFitColumnsDirective.ts"],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD,O;ACVA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,uBAAe;AACf;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;;AAGA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;;;;;;;ACtCA,KAAY,OAAO,uBAAM,CAAS,CAAC;AACnC,yDAA4C,CAA+B,CAAC;AAC5E,2DAA8C,EAAiC,CAAC;AAEhF;mBAAe,OAAO,CAAC,MAAM,CAAC,wBAAwB,EAAE,CAAC,SAAS,CAAC,CAAC;MAC/D,OAAO,CAAC,6BAA6B,EAAE,yDAA2B,CAAC;MACnE,SAAS,CAAC,sBAAsB,EAAE,6DAA6B,CAAC;M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9C,aAAa,CAAC,WAAS,CAAC,GAAG,gBAAgB,CAAC;qBAChD,CAAC;iBACL,CAAC,CAAC,CAAC;iBAEH,GAA8G;iBAC9G,MAAM,CAAC,eAAe,CAAC,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;aACjD,CAAC;SACL,CAAC,CAAC,CAAC;SACH,GAAgC;KACpC,CAAC;KAEL,EAAC;AAAD,EAAC;AAxGY,MAwGZ;;;;;;;AChID;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAW,OAAO;AAClB,YAAW,aAAa;AACxB,YAAW,EAAE;AACb,cAAa,EAAE;AACf;AACA;AACA,GAA2C;AAC3C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;;;;;;AChCA;;AAEA;AACA;AACA;AACA;AACA;AACA,YAAkB;AAClB,YAAW,MAAM;AACjB,YAAW,OAAO;AAClB,cAAa,EAAE;AACf;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;;;;;;AC5BA;;AAEA;AACA;AACA;AACA;AACA,YAAa;AACb,cAAa,OAAO;AACpB;AACA;AACA;AACA;;AAEA;;;;;;;ACbA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAW,EAAE;AACb,cAAa,QAAQ;AACrB;AACA;AACA,GAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;;;;;;AC3BA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,YAAa;AACb,cAAa,MAAM;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAG;AACH;AACA;;AAEA;;;;;;;AC3BA;AACA;AACA;AACA;AACA;AACA,YAAa;AACb,cAAa,OAAO;AACpB;AACA;AACA;AACA;;AAEA;;;;;;;ACZA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,YAAW,EAAE;AACb,cAAa,QAAQ;AACrB;AACA;AACA;AACA;AACA;AACA,GAA6C;AAC7C;AACA;AACA;AACA;AACA;;AAEA;;;;;;;ACvCA;;AAEA;AACA;AACA;AACA;AACA,YAAkB;AAClB,YAAW,OAAO;AAClB,cAAa,EAAE;AACf;AACA;AACA;AACA;AACA;;AAEA;;;;;;;ACfA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,8BAA2D;AAC3D;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,YAAW,EAAE;AACb,cAAa,QAAQ;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;;;;;;AC/CA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,YAAW,EAAE;AACb,cAAa,QAAQ;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;;;;;;ACrCA;AACA;AACA;AACA;AACA,YAAa;AACb,cAAa,QAAQ;AACrB;AACA;AACA;AACA;;AAEA;;;;;;;ACXA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,YAAa;AACb,cAAa,QAAQ;AACrB;AACA;AACA;AACA;;AAEA;;;;;;;;ACnBA;KAAA;KAeA,CAAC;KAZU,CAA2C;SAC9C,IAAM,MAAM,GAAG,QAAQ,CAAC,MAAM,IAAI,CAAC,QAAQ,CAAC,KAA2C;SACvF,IAAM,OAAO,GAAG,MAAM,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;SACxC,OAAO,CAAC,IAAI,GAAG,IAAI,CAAC;SACpB,IAAM,OAAO,GAAG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,KAAK,EAAE,KAAK;SACZ,OAAO,EAAE;aACL,MAAM,CAAC;iBACH,GAAG,EAAE,SAA0C;qBACiB;iBAChE,CAAC;cACJ,CAAC;SACN,CAAC;MACJ,CAAC;AACN,EAAC;AAde,OAcf","file":"autoFitColumns.js","sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory(require(\"angular\"));\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([\"angular\"], factory);\n\telse {\n\t\tvar a = typeof exports === 'object' ? factory(require(\"angular\")) : factory(root[\"angular\"]);\n\t\tfor(var i in a) (typeof exports === 'object' ? exports : root)[i] = a[i];\n\t}\n})(this, function(__WEBPACK_EXTERNAL_MODULE_1__) {\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\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\texports: {},\n \t\t\tid: moduleId,\n \t\t\tloaded: false\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.loaded = 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// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(0);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap 44cb53805f1088007aac","import * as angular from 'angular';\nimport { UiGridAutoFitColumnsService } from './UiGridAutoFitColumnsService';\nimport { UiGridAutoFitColumnsDirective } from './UiGridAutoFitColumnsDirective';\n\nexport default angular.module('ui.grid.autoFitColumns', ['ui.grid'])\n .service('uiGridAutoFitColumnsService', UiGridAutoFitColumnsService)\n .directive('uiGridAutoFitColumns', UiGridAutoFitColumnsDirective)\n .name;\n\n\n\n// WEBPACK FOOTER //\n// ./src/index.ts","module.exports = __WEBPACK_EXTERNAL_MODULE_1__;\n\n\n//////////////////\n// WEBPACK FOOTER\n// external \"angular\"\n// module id = 1\n// module chunks = 0","import * as get from 'lodash/object/get';\nimport Measurer from './Measurer';\nimport UiGridMetrics from './UiGridMetrics';\n\ninterface IExtendedColumnDef extends uiGrid.IColumnDef {\n enableColumnAutoFit: boolean;\n}\n\ninterface IExtendedGridColumn extends uiGrid.IGridColumn {\n colDef: IExtendedColumnDef;\n}\n\ninterface IExtendedGridInstance extends uiGrid.IGridInstance {\n options: IExtendedGridOptions;\n}\n\ninterface IExtendedGridOptions extends uiGrid.IGridOptions {\n enableColumnAutoFit: boolean;\n}\n\ninterface IAnyFilterPredicateFunc {\n (value: any, firstFlag?: any, secondFlag?: any): string;\n}\n\nexport class UiGridAutoFitColumnsService {\n private gridMetrics: UiGridMetrics;\n\n /*@ngInject*/\n constructor (private $q: angular.IQService, private $filter: angular.IFilterService) {\n this.gridMetrics = new UiGridMetrics();\n }\n\n initializeGrid(grid: IExtendedGridInstance) {\n grid.registerColumnBuilder(this.colAutoFitColumnBuilder.bind(this));\n grid.registerColumnsProcessor(this.columnsProcessor.bind(this), 60);\n\n UiGridAutoFitColumnsService.defaultGridOptions(grid.options);\n }\n\n static defaultGridOptions(gridOptions: IExtendedGridOptions) {\n // true by default\n gridOptions.enableColumnAutoFit = gridOptions.enableColumnAutoFit !== false;\n }\n\n private getFilterIfExists(filterName): any {\n try {\n return this.$filter(filterName);\n } catch (e) {\n return null;\n }\n }\n\n private getFilteredValue(value: string, cellFilter: string) {\n if (cellFilter && cellFilter !== '') {\n const filter = this.getFilterIfExists(cellFilter);\n if (filter) {\n value = filter(value);\n } else {\n // https://regex101.com/r/rC5eR5/2\n const re = /([^:]*):([^:]*):?([\\s\\S]+)?/;\n let matches;\n if ((matches = re.exec(cellFilter)) !== null) {\n value = this.$filter(matches[1])(value, matches[2], matches[3]);\n }\n }\n }\n return value;\n }\n\n colAutoFitColumnBuilder(colDef: IExtendedColumnDef, col: IExtendedGridColumn, gridOptions: IExtendedGridOptions) {\n const promises = [];\n\n if (colDef.enableColumnAutoFit === undefined) {\n //TODO: make it as col.isResizable()\n if (UiGridAutoFitColumnsService.isResizable(colDef)) {\n colDef.enableColumnAutoFit = gridOptions.enableColumnAutoFit;\n } else {\n colDef.enableColumnAutoFit = false;\n }\n }\n\n return this.$q.all(promises);\n }\n\n static isResizable(colDef: IExtendedColumnDef): boolean {\n return !colDef.hasOwnProperty('width');\n }\n\n columnsProcessor(renderedColumnsToProcess?: Array, rows?: Array) {\n if (!rows.length) {\n return renderedColumnsToProcess;\n }\n // TODO: respect existing colDef options\n // if (col.colDef.enableColumnAutoFitting === false) return;\n\n let optimalWidths: {\n [name: string]: number\n } = {};\n\n\n renderedColumnsToProcess.forEach(column => {\n\n if (column.colDef.enableColumnAutoFit) {\n const columnKey = column.field || column.name;\n optimalWidths[columnKey] = Measurer.measureRoundedTextWidth(column.displayName, this.gridMetrics.getHeaderFont()) + this.gridMetrics.getHeaderButtonsWidth();\n\n rows.forEach((row) => {\n let cellText = get(row.entity, columnKey);\n\n if (!!column.colDef.cellFilter) {\n cellText = this.getFilteredValue(cellText, column.colDef.cellFilter);\n }\n\n const currentCellWidth = Measurer.measureRoundedTextWidth(cellText, this.gridMetrics.getCellFont());\n const optimalCellWidth = currentCellWidth > 300 ? 300 : currentCellWidth;\n\n if (optimalCellWidth > optimalWidths[columnKey]) {\n optimalWidths[columnKey] = optimalCellWidth;\n }\n });\n\n column.colDef.width = optimalWidths[columnKey] + this.gridMetrics.getPadding() + this.gridMetrics.getBorder();\n column.updateColumnDef(column.colDef, false);\n }\n });\n return renderedColumnsToProcess;\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/UiGridAutoFitColumnsService.ts","var baseGet = require('../internal/baseGet'),\n toPath = require('../internal/toPath');\n\n/**\n * Gets the property value at `path` of `object`. If the resolved value is\n * `undefined` the `defaultValue` is used in its place.\n *\n * @static\n * @memberOf _\n * @category Object\n * @param {Object} object The object to query.\n * @param {Array|string} path The path of the property to get.\n * @param {*} [defaultValue] The value returned if the resolved value is `undefined`.\n * @returns {*} Returns the resolved value.\n * @example\n *\n * var object = { 'a': [{ 'b': { 'c': 3 } }] };\n *\n * _.get(object, 'a[0].b.c');\n * // => 3\n *\n * _.get(object, ['a', '0', 'b', 'c']);\n * // => 3\n *\n * _.get(object, 'a.b.c', 'default');\n * // => 'default'\n */\nfunction get(object, path, defaultValue) {\n var result = object == null ? undefined : baseGet(object, toPath(path), (path + ''));\n return result === undefined ? defaultValue : result;\n}\n\nmodule.exports = get;\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/lodash/object/get.js\n// module id = 3\n// module chunks = 0","var toObject = require('./toObject');\n\n/**\n * The base implementation of `get` without support for string paths\n * and default values.\n *\n * @private\n * @param {Object} object The object to query.\n * @param {Array} path The path of the property to get.\n * @param {string} [pathKey] The key representation of path.\n * @returns {*} Returns the resolved value.\n */\nfunction baseGet(object, path, pathKey) {\n if (object == null) {\n return;\n }\n if (pathKey !== undefined && pathKey in toObject(object)) {\n path = [pathKey];\n }\n var index = 0,\n length = path.length;\n\n while (object != null && index < length) {\n object = object[path[index++]];\n }\n return (index && index == length) ? object : undefined;\n}\n\nmodule.exports = baseGet;\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/lodash/internal/baseGet.js\n// module id = 4\n// module chunks = 0","var isObject = require('../lang/isObject');\n\n/**\n * Converts `value` to an object if it's not one.\n *\n * @private\n * @param {*} value The value to process.\n * @returns {Object} Returns the object.\n */\nfunction toObject(value) {\n return isObject(value) ? value : Object(value);\n}\n\nmodule.exports = toObject;\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/lodash/internal/toObject.js\n// module id = 5\n// module chunks = 0","/**\n * Checks if `value` is the [language type](https://es5.github.io/#x8) of `Object`.\n * (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)\n *\n * @static\n * @memberOf _\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an object, else `false`.\n * @example\n *\n * _.isObject({});\n * // => true\n *\n * _.isObject([1, 2, 3]);\n * // => true\n *\n * _.isObject(1);\n * // => false\n */\nfunction isObject(value) {\n // Avoid a V8 JIT bug in Chrome 19-20.\n // See https://code.google.com/p/v8/issues/detail?id=2291 for more details.\n var type = typeof value;\n return !!value && (type == 'object' || type == 'function');\n}\n\nmodule.exports = isObject;\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/lodash/lang/isObject.js\n// module id = 6\n// module chunks = 0","var baseToString = require('./baseToString'),\n isArray = require('../lang/isArray');\n\n/** Used to match property names within property paths. */\nvar rePropName = /[^.[\\]]+|\\[(?:(-?\\d+(?:\\.\\d+)?)|([\"'])((?:(?!\\2)[^\\n\\\\]|\\\\.)*?)\\2)\\]/g;\n\n/** Used to match backslashes in property paths. */\nvar reEscapeChar = /\\\\(\\\\)?/g;\n\n/**\n * Converts `value` to property path array if it's not one.\n *\n * @private\n * @param {*} value The value to process.\n * @returns {Array} Returns the property path array.\n */\nfunction toPath(value) {\n if (isArray(value)) {\n return value;\n }\n var result = [];\n baseToString(value).replace(rePropName, function(match, number, quote, string) {\n result.push(quote ? string.replace(reEscapeChar, '$1') : (number || match));\n });\n return result;\n}\n\nmodule.exports = toPath;\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/lodash/internal/toPath.js\n// module id = 7\n// module chunks = 0","/**\n * Converts `value` to a string if it's not one. An empty string is returned\n * for `null` or `undefined` values.\n *\n * @private\n * @param {*} value The value to process.\n * @returns {string} Returns the string.\n */\nfunction baseToString(value) {\n return value == null ? '' : (value + '');\n}\n\nmodule.exports = baseToString;\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/lodash/internal/baseToString.js\n// module id = 8\n// module chunks = 0","var getNative = require('../internal/getNative'),\n isLength = require('../internal/isLength'),\n isObjectLike = require('../internal/isObjectLike');\n\n/** `Object#toString` result references. */\nvar arrayTag = '[object Array]';\n\n/** Used for native method references. */\nvar objectProto = Object.prototype;\n\n/**\n * Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)\n * of values.\n */\nvar objToString = objectProto.toString;\n\n/* Native method references for those with the same name as other `lodash` methods. */\nvar nativeIsArray = getNative(Array, 'isArray');\n\n/**\n * Checks if `value` is classified as an `Array` object.\n *\n * @static\n * @memberOf _\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.\n * @example\n *\n * _.isArray([1, 2, 3]);\n * // => true\n *\n * _.isArray(function() { return arguments; }());\n * // => false\n */\nvar isArray = nativeIsArray || function(value) {\n return isObjectLike(value) && isLength(value.length) && objToString.call(value) == arrayTag;\n};\n\nmodule.exports = isArray;\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/lodash/lang/isArray.js\n// module id = 9\n// module chunks = 0","var isNative = require('../lang/isNative');\n\n/**\n * Gets the native function at `key` of `object`.\n *\n * @private\n * @param {Object} object The object to query.\n * @param {string} key The key of the method to get.\n * @returns {*} Returns the function if it's native, else `undefined`.\n */\nfunction getNative(object, key) {\n var value = object == null ? undefined : object[key];\n return isNative(value) ? value : undefined;\n}\n\nmodule.exports = getNative;\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/lodash/internal/getNative.js\n// module id = 10\n// module chunks = 0","var isFunction = require('./isFunction'),\n isObjectLike = require('../internal/isObjectLike');\n\n/** Used to detect host constructors (Safari > 5). */\nvar reIsHostCtor = /^\\[object .+?Constructor\\]$/;\n\n/** Used for native method references. */\nvar objectProto = Object.prototype;\n\n/** Used to resolve the decompiled source of functions. */\nvar fnToString = Function.prototype.toString;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/** Used to detect if a method is native. */\nvar reIsNative = RegExp('^' +\n fnToString.call(hasOwnProperty).replace(/[\\\\^$.*+?()[\\]{}|]/g, '\\\\$&')\n .replace(/hasOwnProperty|(function).*?(?=\\\\\\()| for .+?(?=\\\\\\])/g, '$1.*?') + '$'\n);\n\n/**\n * Checks if `value` is a native function.\n *\n * @static\n * @memberOf _\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a native function, else `false`.\n * @example\n *\n * _.isNative(Array.prototype.push);\n * // => true\n *\n * _.isNative(_);\n * // => false\n */\nfunction isNative(value) {\n if (value == null) {\n return false;\n }\n if (isFunction(value)) {\n return reIsNative.test(fnToString.call(value));\n }\n return isObjectLike(value) && reIsHostCtor.test(value);\n}\n\nmodule.exports = isNative;\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/lodash/lang/isNative.js\n// module id = 11\n// module chunks = 0","var isObject = require('./isObject');\n\n/** `Object#toString` result references. */\nvar funcTag = '[object Function]';\n\n/** Used for native method references. */\nvar objectProto = Object.prototype;\n\n/**\n * Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)\n * of values.\n */\nvar objToString = objectProto.toString;\n\n/**\n * Checks if `value` is classified as a `Function` object.\n *\n * @static\n * @memberOf _\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.\n * @example\n *\n * _.isFunction(_);\n * // => true\n *\n * _.isFunction(/abc/);\n * // => false\n */\nfunction isFunction(value) {\n // The use of `Object#toString` avoids issues with the `typeof` operator\n // in older versions of Chrome and Safari which return 'function' for regexes\n // and Safari 8 which returns 'object' for typed array constructors.\n return isObject(value) && objToString.call(value) == funcTag;\n}\n\nmodule.exports = isFunction;\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/lodash/lang/isFunction.js\n// module id = 12\n// module chunks = 0","/**\n * Checks if `value` is object-like.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is object-like, else `false`.\n */\nfunction isObjectLike(value) {\n return !!value && typeof value == 'object';\n}\n\nmodule.exports = isObjectLike;\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/lodash/internal/isObjectLike.js\n// module id = 13\n// module chunks = 0","/**\n * Used as the [maximum length](http://ecma-international.org/ecma-262/6.0/#sec-number.max_safe_integer)\n * of an array-like value.\n */\nvar MAX_SAFE_INTEGER = 9007199254740991;\n\n/**\n * Checks if `value` is a valid array-like length.\n *\n * **Note:** This function is based on [`ToLength`](http://ecma-international.org/ecma-262/6.0/#sec-tolength).\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.\n */\nfunction isLength(value) {\n return typeof value == 'number' && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;\n}\n\nmodule.exports = isLength;\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/lodash/internal/isLength.js\n// module id = 14\n// module chunks = 0","export class Measurer {\n private static canvas: HTMLCanvasElement;\n\n static measureTextWidth(text: string, font: string): number{\n const canvas = Measurer.canvas || (Measurer.canvas = document.createElement('canvas'));\n const context = canvas.getContext('2d');\n context.font = font;\n const metrics = context.measureText(text);\n return metrics.width;\n }\n\n static measureRoundedTextWidth(text: string, font: string): number{\n const width = Measurer.measureTextWidth(text, font);\n return Math.floor(width) + 1;\n }\n}\n\nexport default Measurer;\n\n\n\n// WEBPACK FOOTER //\n// ./src/Measurer.ts","export class UiGridMetrics {\n private headerFont: string;\n private cellFont: string;\n private padding: number;\n private border: number;\n\n getHeaderFont(){\n if(this.headerFont){\n return this.headerFont;\n }\n\n let header = document.querySelector('.ui-grid-header-cell .ui-grid-cell-contents');\n\n if(!header) {\n throw new Error('not found: .ui-grid-header-cell .ui-grid-cell-contents');\n }\n\n let headerStyle = getComputedStyle(header);\n this.headerFont = UiGridMetrics.getFontStringFrom(headerStyle);\n return this.headerFont;\n }\n\n getCellFont(){\n if(this.cellFont){\n return this.cellFont;\n }\n\n let cell = document.querySelector('.ui-grid-cell > .ui-grid-cell-contents');\n\n if(!cell){\n let element = document.createElement('div');\n element.className = 'ui-grid-cell-contents';\n element.style.cssFloat = 'left';\n angular.element(document.body).append(element);\n let cellStyle = getComputedStyle(element);\n this.cellFont = UiGridMetrics.getFontStringFrom(cellStyle);\n angular.element(element).remove();\n return this.cellFont;\n }\n\n let cellStyle = getComputedStyle(cell);\n this.cellFont = UiGridMetrics.getFontStringFrom(cellStyle);\n return this.cellFont;\n }\n\n getPadding(){\n if(this.padding){\n return this.padding;\n }\n\n let header = document.querySelector('.ui-grid-header-cell .ui-grid-cell-contents');\n\n if(!header) {\n throw new Error('not found: .ui-grid-header-cell .ui-grid-cell-contents');\n }\n\n let {paddingLeft, paddingRight} = getComputedStyle(header);\n this.padding = parseInt(paddingLeft) + parseInt(paddingRight);\n return this.padding;\n }\n\n getBorder(){\n if(this.border){\n return this.border;\n }\n\n let header = document.querySelector('.ui-grid-header-cell');\n\n if(!header) {\n throw new Error('not found: .ui-grid-header-cell');\n }\n\n let {borderRightWidth} = getComputedStyle(header);\n this.border = parseInt(borderRightWidth);\n return this.border;\n }\n\n getHeaderButtonsWidth(){\n // TODO: lets be more precise\n const HEADER_BUTTONS_WIDTH = 25;\n return HEADER_BUTTONS_WIDTH;\n }\n\n private static getFontStringFrom({fontStyle, fontVariant, fontWeight, fontSize, fontFamily}: CSSStyleDeclaration): string {\n // in FF cssStyle.font may be '' so we need to collect it manually\n // font: [font-style||font-variant||font-weight] font-size [/line-height] font-family | inherit\n return `${fontStyle} ${fontVariant} ${fontWeight} ${fontSize} ${fontFamily}`;\n }\n\n}\n\nexport default UiGridMetrics;\n\n\n\n// WEBPACK FOOTER //\n// ./src/UiGridMetrics.ts","import { UiGridAutoFitColumnsService } from './UiGridAutoFitColumnsService';\n\n/*@ngInject*/\nexport function UiGridAutoFitColumnsDirective (uiGridAutoFitColumnsService: UiGridAutoFitColumnsService) {\n return {\n replace: true,\n priority: 0,\n require: '^uiGrid',\n scope: false,\n compile: function () {\n return {\n pre: function ($scope, $elm, $attrs, uiGridCtrl) {\n uiGridAutoFitColumnsService.initializeGrid(uiGridCtrl.grid);\n }\n };\n }\n };\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/UiGridAutoFitColumnsDirective.ts"],"sourceRoot":""} \ No newline at end of file diff --git a/dist/autoFitColumns.min.js b/dist/autoFitColumns.min.js new file mode 100644 index 0000000..54c30f6 --- /dev/null +++ b/dist/autoFitColumns.min.js @@ -0,0 +1,2 @@ +!function(t,e){if("object"==typeof exports&&"object"==typeof module)module.exports=e(require("angular"));else if("function"==typeof define&&define.amd)define(["angular"],e);else{var r=e("object"==typeof exports?require("angular"):t.angular);for(var n in r)("object"==typeof exports?exports:t)[n]=r[n]}}(this,function(t){return function(t){function e(n){if(r[n])return r[n].exports;var i=r[n]={exports:{},id:n,loaded:!1};return t[n].call(i.exports,i,i.exports,e),i.loaded=!0,i.exports}var r={};return e.m=t,e.c=r,e.p="",e(0)}([function(t,e,r){"use strict";var n=r(1),i=r(2),o=r(17);Object.defineProperty(e,"__esModule",{value:!0}),e.default=n.module("ui.grid.autoFitColumns",["ui.grid"]).service("uiGridAutoFitColumnsService",i.UiGridAutoFitColumnsService).directive("uiGridAutoFitColumns",o.UiGridAutoFitColumnsDirective).name},function(e,r){e.exports=t},function(t,e,r){"use strict";var n=r(3),i=r(15),o=r(16),u=function(){function t(t,e){this.$q=t,this.$filter=e,this.gridMetrics=new o.default}return t.$inject=["$q","$filter"],t.prototype.initializeGrid=function(e){e.registerColumnBuilder(this.colAutoFitColumnBuilder.bind(this)),e.registerColumnsProcessor(this.columnsProcessor.bind(this),60),t.defaultGridOptions(e.options)},t.defaultGridOptions=function(t){t.enableColumnAutoFit=t.enableColumnAutoFit!==!1},t.prototype.getFilterIfExists=function(t){try{return this.$filter(t)}catch(t){return null}},t.prototype.getFilteredValue=function(t,e){if(e&&""!==e){var r=this.getFilterIfExists(e);if(r)t=r(t);else{var n=/([^:]*):([^:]*):?([\s\S]+)?/,i=void 0;null!==(i=n.exec(e))&&(t=this.$filter(i[1])(t,i[2],i[3]))}}return t},t.prototype.colAutoFitColumnBuilder=function(e,r,n){var i=[];return void 0===e.enableColumnAutoFit&&(t.isResizable(e)?e.enableColumnAutoFit=n.enableColumnAutoFit:e.enableColumnAutoFit=!1),this.$q.all(i)},t.isResizable=function(t){return!t.hasOwnProperty("width")},t.prototype.columnsProcessor=function(t,e){var r=this;if(!e.length)return t;var o={};return t.forEach(function(t){if(t.colDef.enableColumnAutoFit){var u=t.field||t.name;o[u]=i.default.measureRoundedTextWidth(t.displayName,r.gridMetrics.getHeaderFont())+r.gridMetrics.getHeaderButtonsWidth(),e.forEach(function(e){var l=n(e.entity,u);t.colDef.cellFilter&&(l=r.getFilteredValue(l,t.colDef.cellFilter));var c=i.default.measureRoundedTextWidth(l,r.gridMetrics.getCellFont()),a=c>300?300:c;a>o[u]&&(o[u]=a)}),t.colDef.width=o[u]+r.gridMetrics.getPadding()+r.gridMetrics.getBorder(),t.updateColumnDef(t.colDef,!1)}}),t},t}();e.UiGridAutoFitColumnsService=u},function(t,e,r){function n(t,e,r){var n=null==t?void 0:i(t,o(e),e+"");return void 0===n?r:n}var i=r(4),o=r(7);t.exports=n},function(t,e,r){function n(t,e,r){if(null!=t){void 0!==r&&r in i(t)&&(e=[r]);for(var n=0,o=e.length;null!=t&&n-1&&t%1==0&&t<=n}var n=9007199254740991;t.exports=r},function(t,e){"use strict";var r=function(){function t(){}return t.measureTextWidth=function(e,r){var n=t.canvas||(t.canvas=document.createElement("canvas")),i=n.getContext("2d");i.font=r;var o=i.measureText(e);return o.width},t.measureRoundedTextWidth=function(e,r){var n=t.measureTextWidth(e,r);return Math.floor(n)+1},t}();e.Measurer=r,Object.defineProperty(e,"__esModule",{value:!0}),e.default=r},function(t,e){"use strict";var r=function(){function t(){}return t.prototype.getHeaderFont=function(){if(this.headerFont)return this.headerFont;var e=document.querySelector(".ui-grid-header-cell .ui-grid-cell-contents");if(!e)throw new Error("not found: .ui-grid-header-cell .ui-grid-cell-contents");var r=getComputedStyle(e);return this.headerFont=t.getFontStringFrom(r),this.headerFont},t.prototype.getCellFont=function(){if(this.cellFont)return this.cellFont;var e=document.querySelector(".ui-grid-cell > .ui-grid-cell-contents");if(!e){var r=document.createElement("div");r.className="ui-grid-cell-contents",r.style.cssFloat="left",angular.element(document.body).append(r);var n=getComputedStyle(r);return this.cellFont=t.getFontStringFrom(n),angular.element(r).remove(),this.cellFont}var i=getComputedStyle(e);return this.cellFont=t.getFontStringFrom(i),this.cellFont},t.prototype.getPadding=function(){if(this.padding)return this.padding;var t=document.querySelector(".ui-grid-header-cell .ui-grid-cell-contents");if(!t)throw new Error("not found: .ui-grid-header-cell .ui-grid-cell-contents");var e=getComputedStyle(t),r=e.paddingLeft,n=e.paddingRight;return this.padding=parseInt(r)+parseInt(n),this.padding},t.prototype.getBorder=function(){if(this.border)return this.border;var t=document.querySelector(".ui-grid-header-cell");if(!t)throw new Error("not found: .ui-grid-header-cell");var e=getComputedStyle(t).borderRightWidth;return this.border=parseInt(e),this.border},t.prototype.getHeaderButtonsWidth=function(){var t=25;return t},t.getFontStringFrom=function(t){var e=t.fontStyle,r=t.fontVariant,n=t.fontWeight,i=t.fontSize,o=t.fontFamily;return e+" "+r+" "+n+" "+i+" "+o},t}();e.UiGridMetrics=r,Object.defineProperty(e,"__esModule",{value:!0}),e.default=r},function(t,e){"use strict";function r(t){return{replace:!0,priority:0,require:"^uiGrid",scope:!1,compile:function(){return{pre:function(e,r,n,i){t.initializeGrid(i.grid)}}}}}r.$inject=["uiGridAutoFitColumnsService"],e.UiGridAutoFitColumnsDirective=r}])}); +//# sourceMappingURL=autoFitColumns.min.js.map \ No newline at end of file diff --git a/dist/autoFitColumns.min.js.map b/dist/autoFitColumns.min.js.map new file mode 100644 index 0000000..5d1d588 --- /dev/null +++ b/dist/autoFitColumns.min.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["webpack:///webpack/universalModuleDefinition","webpack:///autoFitColumns.min.js","webpack:///webpack/bootstrap 2a30a220c7a745a6233b","webpack:///./src/index.ts","webpack:///external \"angular\"","webpack:///./src/UiGridAutoFitColumnsService.ts","webpack:///./~/lodash/object/get.js","webpack:///./~/lodash/internal/baseGet.js","webpack:///./~/lodash/internal/toObject.js","webpack:///./~/lodash/lang/isObject.js","webpack:///./~/lodash/internal/toPath.js","webpack:///./~/lodash/internal/baseToString.js","webpack:///./~/lodash/lang/isArray.js","webpack:///./~/lodash/internal/getNative.js","webpack:///./~/lodash/lang/isNative.js","webpack:///./~/lodash/lang/isFunction.js","webpack:///./~/lodash/internal/isObjectLike.js","webpack:///./~/lodash/internal/isLength.js","webpack:///./src/Measurer.ts","webpack:///./src/UiGridMetrics.ts","webpack:///./src/UiGridAutoFitColumnsDirective.ts"],"names":["root","factory","exports","module","require","define","amd","a","i","this","__WEBPACK_EXTERNAL_MODULE_1__","modules","__webpack_require__","moduleId","installedModules","id","loaded","call","m","c","p","angular","UiGridAutoFitColumnsService_1","UiGridAutoFitColumnsDirective_1","Object","defineProperty","value","default","service","UiGridAutoFitColumnsService","directive","UiGridAutoFitColumnsDirective","name","get","Measurer_1","UiGridMetrics_1","$q","$filter","gridMetrics","$inject","prototype","initializeGrid","grid","registerColumnBuilder","colAutoFitColumnBuilder","bind","registerColumnsProcessor","columnsProcessor","defaultGridOptions","options","gridOptions","enableColumnAutoFit","getFilterIfExists","filterName","e","getFilteredValue","cellFilter","filter","re","matches","exec","colDef","col","promises","undefined","isResizable","all","hasOwnProperty","renderedColumnsToProcess","rows","_this","length","optimalWidths","forEach","column","columnKey_1","field","measureRoundedTextWidth","displayName","getHeaderFont","getHeaderButtonsWidth","row","cellText","entity","currentCellWidth","getCellFont","optimalCellWidth","width","getPadding","getBorder","updateColumnDef","object","path","defaultValue","result","baseGet","toPath","pathKey","toObject","index","isObject","type","isArray","baseToString","replace","rePropName","match","number","quote","string","push","reEscapeChar","getNative","isLength","isObjectLike","arrayTag","objectProto","objToString","toString","nativeIsArray","Array","key","isNative","isFunction","reIsNative","test","fnToString","reIsHostCtor","Function","RegExp","funcTag","MAX_SAFE_INTEGER","Measurer","measureTextWidth","text","font","canvas","document","createElement","context","getContext","metrics","measureText","Math","floor","UiGridMetrics","headerFont","header","querySelector","Error","headerStyle","getComputedStyle","getFontStringFrom","cellFont","cell","element","className","style","cssFloat","body","append","cellStyle_1","remove","cellStyle","padding","_a","paddingLeft","paddingRight","parseInt","border","borderRightWidth","HEADER_BUTTONS_WIDTH","fontStyle","fontVariant","fontWeight","fontSize","fontFamily","uiGridAutoFitColumnsService","priority","scope","compile","pre","$scope","$elm","$attrs","uiGridCtrl"],"mappings":"CAAA,SAAAA,EAAAC,GACA,mBAAAC,UAAA,gBAAAC,QACAA,OAAAD,QAAAD,EAAAG,QAAA,gBACA,sBAAAC,gBAAAC,IACAD,QAAA,WAAAJ,OACA,CACA,GAAAM,GAAAN,EAAA,gBAAAC,SAAAE,QAAA,WAAAJ,EAAA,QACA,QAAAQ,KAAAD,IAAA,gBAAAL,iBAAAF,GAAAQ,GAAAD,EAAAC,KAECC,KAAA,SAAAC,GACD,MCAgB,UAAUC,GCN1B,QAAAC,GAAAC,GAGA,GAAAC,EAAAD,GACA,MAAAC,GAAAD,GAAAX,OAGA,IAAAC,GAAAW,EAAAD,IACAX,WACAa,GAAAF,EACAG,QAAA,EAUA,OANAL,GAAAE,GAAAI,KAAAd,EAAAD,QAAAC,IAAAD,QAAAU,GAGAT,EAAAa,QAAA,EAGAb,EAAAD,QAvBA,GAAAY,KAqCA,OATAF,GAAAM,EAAAP,EAGAC,EAAAO,EAAAL,EAGAF,EAAAQ,EAAA,GAGAR,EAAA,KDgBM,SAAST,EAAQD,EAASU,GAE/B,YExDD,IAAYS,GAAOT,EAAM,GACzBU,EAAAV,EAA4C,GAC5CW,EAAAX,EA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B/pBvB,YnBoqBC,SmBjqBO6B,GAAakJ,GnBkqBhB,OmBhqBGzE,SAAS,EACT0E,SAAO,EACP9K,QAAS,UnBkqBR+K,OmBjqBG,EnBkqBHC,QmBjqBO,WnBkqBH,OmBhqBGC,IAAC,SAAAC,EAAAC,EAAAC,EAAAC,GACHR,EAAAxI,eAAAgJ,EAAA/I,UnBupBbX,EmBjqBUQ,SAAA,+BnBirBVrC,EAAQ6B,8BAAgCA","file":"autoFitColumns.min.js","sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory(require(\"angular\"));\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([\"angular\"], factory);\n\telse {\n\t\tvar a = typeof exports === 'object' ? factory(require(\"angular\")) : factory(root[\"angular\"]);\n\t\tfor(var i in a) (typeof exports === 'object' ? exports : root)[i] = a[i];\n\t}\n})(this, function(__WEBPACK_EXTERNAL_MODULE_1__) {\nreturn \n\n\n// WEBPACK FOOTER //\n// webpack/universalModuleDefinition","(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory(require(\"angular\"));\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([\"angular\"], factory);\n\telse {\n\t\tvar a = typeof exports === 'object' ? factory(require(\"angular\")) : factory(root[\"angular\"]);\n\t\tfor(var i in a) (typeof exports === 'object' ? exports : root)[i] = a[i];\n\t}\n})(this, function(__WEBPACK_EXTERNAL_MODULE_1__) {\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\n/******/ \t\t// Create a new module (and put it into the cache)\n/******/ \t\tvar module = installedModules[moduleId] = {\n/******/ \t\t\texports: {},\n/******/ \t\t\tid: moduleId,\n/******/ \t\t\tloaded: false\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.loaded = 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// __webpack_public_path__\n/******/ \t__webpack_require__.p = \"\";\n\n/******/ \t// Load entry module and return exports\n/******/ \treturn __webpack_require__(0);\n/******/ })\n/************************************************************************/\n/******/ ([\n/* 0 */\n/***/ function(module, exports, __webpack_require__) {\n\n\t\"use strict\";\r\n\tvar angular = __webpack_require__(1);\r\n\tvar UiGridAutoFitColumnsService_1 = __webpack_require__(2);\r\n\tvar UiGridAutoFitColumnsDirective_1 = __webpack_require__(17);\r\n\tObject.defineProperty(exports, \"__esModule\", { value: true });\r\n\texports.default = angular.module('ui.grid.autoFitColumns', ['ui.grid'])\r\n\t .service('uiGridAutoFitColumnsService', UiGridAutoFitColumnsService_1.UiGridAutoFitColumnsService)\r\n\t .directive('uiGridAutoFitColumns', UiGridAutoFitColumnsDirective_1.UiGridAutoFitColumnsDirective)\r\n\t .name;\r\n\n\n/***/ },\n/* 1 */\n/***/ function(module, exports) {\n\n\tmodule.exports = __WEBPACK_EXTERNAL_MODULE_1__;\n\n/***/ },\n/* 2 */\n/***/ function(module, exports, __webpack_require__) {\n\n\t\"use strict\";\r\n\tvar get = __webpack_require__(3);\r\n\tvar Measurer_1 = __webpack_require__(15);\r\n\tvar UiGridMetrics_1 = __webpack_require__(16);\r\n\tvar UiGridAutoFitColumnsService = (function () {\r\n\t /*@ngInject*/\n\t UiGridAutoFitColumnsService.$inject = [\"$q\", \"$filter\"];\r\n\t function UiGridAutoFitColumnsService($q, $filter) {\r\n\t this.$q = $q;\r\n\t this.$filter = $filter;\r\n\t this.gridMetrics = new UiGridMetrics_1.default();\r\n\t }\r\n\t UiGridAutoFitColumnsService.prototype.initializeGrid = function (grid) {\r\n\t grid.registerColumnBuilder(this.colAutoFitColumnBuilder.bind(this));\r\n\t grid.registerColumnsProcessor(this.columnsProcessor.bind(this), 60);\r\n\t UiGridAutoFitColumnsService.defaultGridOptions(grid.options);\r\n\t };\r\n\t UiGridAutoFitColumnsService.defaultGridOptions = function (gridOptions) {\r\n\t // true by default\r\n\t gridOptions.enableColumnAutoFit = gridOptions.enableColumnAutoFit !== false;\r\n\t };\r\n\t UiGridAutoFitColumnsService.prototype.getFilterIfExists = function (filterName) {\r\n\t try {\r\n\t return this.$filter(filterName);\r\n\t }\r\n\t catch (e) {\r\n\t return null;\r\n\t }\r\n\t };\r\n\t UiGridAutoFitColumnsService.prototype.getFilteredValue = function (value, cellFilter) {\r\n\t if (cellFilter && cellFilter !== '') {\r\n\t var filter = this.getFilterIfExists(cellFilter);\r\n\t if (filter) {\r\n\t value = filter(value);\r\n\t }\r\n\t else {\r\n\t // https://regex101.com/r/rC5eR5/2\r\n\t var re = /([^:]*):([^:]*):?([\\s\\S]+)?/;\r\n\t var matches = void 0;\r\n\t if ((matches = re.exec(cellFilter)) !== null) {\r\n\t value = this.$filter(matches[1])(value, matches[2], matches[3]);\r\n\t }\r\n\t }\r\n\t }\r\n\t return value;\r\n\t };\r\n\t UiGridAutoFitColumnsService.prototype.colAutoFitColumnBuilder = function (colDef, col, gridOptions) {\r\n\t var promises = [];\r\n\t if (colDef.enableColumnAutoFit === undefined) {\r\n\t //TODO: make it as col.isResizable()\r\n\t if (UiGridAutoFitColumnsService.isResizable(colDef)) {\r\n\t colDef.enableColumnAutoFit = gridOptions.enableColumnAutoFit;\r\n\t }\r\n\t else {\r\n\t colDef.enableColumnAutoFit = false;\r\n\t }\r\n\t }\r\n\t return this.$q.all(promises);\r\n\t };\r\n\t UiGridAutoFitColumnsService.isResizable = function (colDef) {\r\n\t return !colDef.hasOwnProperty('width');\r\n\t };\r\n\t UiGridAutoFitColumnsService.prototype.columnsProcessor = function (renderedColumnsToProcess, rows) {\r\n\t var _this = this;\r\n\t if (!rows.length) {\r\n\t return renderedColumnsToProcess;\r\n\t }\r\n\t // TODO: respect existing colDef options\r\n\t // if (col.colDef.enableColumnAutoFitting === false) return;\r\n\t var optimalWidths = {};\r\n\t renderedColumnsToProcess.forEach(function (column) {\r\n\t if (column.colDef.enableColumnAutoFit) {\r\n\t var columnKey_1 = column.field || column.name;\r\n\t optimalWidths[columnKey_1] = Measurer_1.default.measureRoundedTextWidth(column.displayName, _this.gridMetrics.getHeaderFont()) + _this.gridMetrics.getHeaderButtonsWidth();\r\n\t rows.forEach(function (row) {\r\n\t var cellText = get(row.entity, columnKey_1);\r\n\t if (!!column.colDef.cellFilter) {\r\n\t cellText = _this.getFilteredValue(cellText, column.colDef.cellFilter);\r\n\t }\r\n\t var currentCellWidth = Measurer_1.default.measureRoundedTextWidth(cellText, _this.gridMetrics.getCellFont());\r\n\t var optimalCellWidth = currentCellWidth > 300 ? 300 : currentCellWidth;\r\n\t if (optimalCellWidth > optimalWidths[columnKey_1]) {\r\n\t optimalWidths[columnKey_1] = optimalCellWidth;\r\n\t }\r\n\t });\r\n\t column.colDef.width = optimalWidths[columnKey_1] + _this.gridMetrics.getPadding() + _this.gridMetrics.getBorder();\r\n\t column.updateColumnDef(column.colDef, false);\r\n\t }\r\n\t });\r\n\t return renderedColumnsToProcess;\r\n\t };\r\n\t return UiGridAutoFitColumnsService;\r\n\t}());\r\n\texports.UiGridAutoFitColumnsService = UiGridAutoFitColumnsService;\r\n\n\n/***/ },\n/* 3 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tvar baseGet = __webpack_require__(4),\n\t toPath = __webpack_require__(7);\n\n\t/**\n\t * Gets the property value at `path` of `object`. If the resolved value is\n\t * `undefined` the `defaultValue` is used in its place.\n\t *\n\t * @static\n\t * @memberOf _\n\t * @category Object\n\t * @param {Object} object The object to query.\n\t * @param {Array|string} path The path of the property to get.\n\t * @param {*} [defaultValue] The value returned if the resolved value is `undefined`.\n\t * @returns {*} Returns the resolved value.\n\t * @example\n\t *\n\t * var object = { 'a': [{ 'b': { 'c': 3 } }] };\n\t *\n\t * _.get(object, 'a[0].b.c');\n\t * // => 3\n\t *\n\t * _.get(object, ['a', '0', 'b', 'c']);\n\t * // => 3\n\t *\n\t * _.get(object, 'a.b.c', 'default');\n\t * // => 'default'\n\t */\n\tfunction get(object, path, defaultValue) {\n\t var result = object == null ? undefined : baseGet(object, toPath(path), (path + ''));\n\t return result === undefined ? defaultValue : result;\n\t}\n\n\tmodule.exports = get;\n\n\n/***/ },\n/* 4 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tvar toObject = __webpack_require__(5);\n\n\t/**\n\t * The base implementation of `get` without support for string paths\n\t * and default values.\n\t *\n\t * @private\n\t * @param {Object} object The object to query.\n\t * @param {Array} path The path of the property to get.\n\t * @param {string} [pathKey] The key representation of path.\n\t * @returns {*} Returns the resolved value.\n\t */\n\tfunction baseGet(object, path, pathKey) {\n\t if (object == null) {\n\t return;\n\t }\n\t if (pathKey !== undefined && pathKey in toObject(object)) {\n\t path = [pathKey];\n\t }\n\t var index = 0,\n\t length = path.length;\n\n\t while (object != null && index < length) {\n\t object = object[path[index++]];\n\t }\n\t return (index && index == length) ? object : undefined;\n\t}\n\n\tmodule.exports = baseGet;\n\n\n/***/ },\n/* 5 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tvar isObject = __webpack_require__(6);\n\n\t/**\n\t * Converts `value` to an object if it's not one.\n\t *\n\t * @private\n\t * @param {*} value The value to process.\n\t * @returns {Object} Returns the object.\n\t */\n\tfunction toObject(value) {\n\t return isObject(value) ? value : Object(value);\n\t}\n\n\tmodule.exports = toObject;\n\n\n/***/ },\n/* 6 */\n/***/ function(module, exports) {\n\n\t/**\n\t * Checks if `value` is the [language type](https://es5.github.io/#x8) of `Object`.\n\t * (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)\n\t *\n\t * @static\n\t * @memberOf _\n\t * @category Lang\n\t * @param {*} value The value to check.\n\t * @returns {boolean} Returns `true` if `value` is an object, else `false`.\n\t * @example\n\t *\n\t * _.isObject({});\n\t * // => true\n\t *\n\t * _.isObject([1, 2, 3]);\n\t * // => true\n\t *\n\t * _.isObject(1);\n\t * // => false\n\t */\n\tfunction isObject(value) {\n\t // Avoid a V8 JIT bug in Chrome 19-20.\n\t // See https://code.google.com/p/v8/issues/detail?id=2291 for more details.\n\t var type = typeof value;\n\t return !!value && (type == 'object' || type == 'function');\n\t}\n\n\tmodule.exports = isObject;\n\n\n/***/ },\n/* 7 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tvar baseToString = __webpack_require__(8),\n\t isArray = __webpack_require__(9);\n\n\t/** Used to match property names within property paths. */\n\tvar rePropName = /[^.[\\]]+|\\[(?:(-?\\d+(?:\\.\\d+)?)|([\"'])((?:(?!\\2)[^\\n\\\\]|\\\\.)*?)\\2)\\]/g;\n\n\t/** Used to match backslashes in property paths. */\n\tvar reEscapeChar = /\\\\(\\\\)?/g;\n\n\t/**\n\t * Converts `value` to property path array if it's not one.\n\t *\n\t * @private\n\t * @param {*} value The value to process.\n\t * @returns {Array} Returns the property path array.\n\t */\n\tfunction toPath(value) {\n\t if (isArray(value)) {\n\t return value;\n\t }\n\t var result = [];\n\t baseToString(value).replace(rePropName, function(match, number, quote, string) {\n\t result.push(quote ? string.replace(reEscapeChar, '$1') : (number || match));\n\t });\n\t return result;\n\t}\n\n\tmodule.exports = toPath;\n\n\n/***/ },\n/* 8 */\n/***/ function(module, exports) {\n\n\t/**\n\t * Converts `value` to a string if it's not one. An empty string is returned\n\t * for `null` or `undefined` values.\n\t *\n\t * @private\n\t * @param {*} value The value to process.\n\t * @returns {string} Returns the string.\n\t */\n\tfunction baseToString(value) {\n\t return value == null ? '' : (value + '');\n\t}\n\n\tmodule.exports = baseToString;\n\n\n/***/ },\n/* 9 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tvar getNative = __webpack_require__(10),\n\t isLength = __webpack_require__(14),\n\t isObjectLike = __webpack_require__(13);\n\n\t/** `Object#toString` result references. */\n\tvar arrayTag = '[object Array]';\n\n\t/** Used for native method references. */\n\tvar objectProto = Object.prototype;\n\n\t/**\n\t * Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)\n\t * of values.\n\t */\n\tvar objToString = objectProto.toString;\n\n\t/* Native method references for those with the same name as other `lodash` methods. */\n\tvar nativeIsArray = getNative(Array, 'isArray');\n\n\t/**\n\t * Checks if `value` is classified as an `Array` object.\n\t *\n\t * @static\n\t * @memberOf _\n\t * @category Lang\n\t * @param {*} value The value to check.\n\t * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.\n\t * @example\n\t *\n\t * _.isArray([1, 2, 3]);\n\t * // => true\n\t *\n\t * _.isArray(function() { return arguments; }());\n\t * // => false\n\t */\n\tvar isArray = nativeIsArray || function(value) {\n\t return isObjectLike(value) && isLength(value.length) && objToString.call(value) == arrayTag;\n\t};\n\n\tmodule.exports = isArray;\n\n\n/***/ },\n/* 10 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tvar isNative = __webpack_require__(11);\n\n\t/**\n\t * Gets the native function at `key` of `object`.\n\t *\n\t * @private\n\t * @param {Object} object The object to query.\n\t * @param {string} key The key of the method to get.\n\t * @returns {*} Returns the function if it's native, else `undefined`.\n\t */\n\tfunction getNative(object, key) {\n\t var value = object == null ? undefined : object[key];\n\t return isNative(value) ? value : undefined;\n\t}\n\n\tmodule.exports = getNative;\n\n\n/***/ },\n/* 11 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tvar isFunction = __webpack_require__(12),\n\t isObjectLike = __webpack_require__(13);\n\n\t/** Used to detect host constructors (Safari > 5). */\n\tvar reIsHostCtor = /^\\[object .+?Constructor\\]$/;\n\n\t/** Used for native method references. */\n\tvar objectProto = Object.prototype;\n\n\t/** Used to resolve the decompiled source of functions. */\n\tvar fnToString = Function.prototype.toString;\n\n\t/** Used to check objects for own properties. */\n\tvar hasOwnProperty = objectProto.hasOwnProperty;\n\n\t/** Used to detect if a method is native. */\n\tvar reIsNative = RegExp('^' +\n\t fnToString.call(hasOwnProperty).replace(/[\\\\^$.*+?()[\\]{}|]/g, '\\\\$&')\n\t .replace(/hasOwnProperty|(function).*?(?=\\\\\\()| for .+?(?=\\\\\\])/g, '$1.*?') + '$'\n\t);\n\n\t/**\n\t * Checks if `value` is a native function.\n\t *\n\t * @static\n\t * @memberOf _\n\t * @category Lang\n\t * @param {*} value The value to check.\n\t * @returns {boolean} Returns `true` if `value` is a native function, else `false`.\n\t * @example\n\t *\n\t * _.isNative(Array.prototype.push);\n\t * // => true\n\t *\n\t * _.isNative(_);\n\t * // => false\n\t */\n\tfunction isNative(value) {\n\t if (value == null) {\n\t return false;\n\t }\n\t if (isFunction(value)) {\n\t return reIsNative.test(fnToString.call(value));\n\t }\n\t return isObjectLike(value) && reIsHostCtor.test(value);\n\t}\n\n\tmodule.exports = isNative;\n\n\n/***/ },\n/* 12 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tvar isObject = __webpack_require__(6);\n\n\t/** `Object#toString` result references. */\n\tvar funcTag = '[object Function]';\n\n\t/** Used for native method references. */\n\tvar objectProto = Object.prototype;\n\n\t/**\n\t * Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)\n\t * of values.\n\t */\n\tvar objToString = objectProto.toString;\n\n\t/**\n\t * Checks if `value` is classified as a `Function` object.\n\t *\n\t * @static\n\t * @memberOf _\n\t * @category Lang\n\t * @param {*} value The value to check.\n\t * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.\n\t * @example\n\t *\n\t * _.isFunction(_);\n\t * // => true\n\t *\n\t * _.isFunction(/abc/);\n\t * // => false\n\t */\n\tfunction isFunction(value) {\n\t // The use of `Object#toString` avoids issues with the `typeof` operator\n\t // in older versions of Chrome and Safari which return 'function' for regexes\n\t // and Safari 8 which returns 'object' for typed array constructors.\n\t return isObject(value) && objToString.call(value) == funcTag;\n\t}\n\n\tmodule.exports = isFunction;\n\n\n/***/ },\n/* 13 */\n/***/ function(module, exports) {\n\n\t/**\n\t * Checks if `value` is object-like.\n\t *\n\t * @private\n\t * @param {*} value The value to check.\n\t * @returns {boolean} Returns `true` if `value` is object-like, else `false`.\n\t */\n\tfunction isObjectLike(value) {\n\t return !!value && typeof value == 'object';\n\t}\n\n\tmodule.exports = isObjectLike;\n\n\n/***/ },\n/* 14 */\n/***/ function(module, exports) {\n\n\t/**\n\t * Used as the [maximum length](http://ecma-international.org/ecma-262/6.0/#sec-number.max_safe_integer)\n\t * of an array-like value.\n\t */\n\tvar MAX_SAFE_INTEGER = 9007199254740991;\n\n\t/**\n\t * Checks if `value` is a valid array-like length.\n\t *\n\t * **Note:** This function is based on [`ToLength`](http://ecma-international.org/ecma-262/6.0/#sec-tolength).\n\t *\n\t * @private\n\t * @param {*} value The value to check.\n\t * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.\n\t */\n\tfunction isLength(value) {\n\t return typeof value == 'number' && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;\n\t}\n\n\tmodule.exports = isLength;\n\n\n/***/ },\n/* 15 */\n/***/ function(module, exports) {\n\n\t\"use strict\";\r\n\tvar Measurer = (function () {\r\n\t function Measurer() {\r\n\t }\r\n\t Measurer.measureTextWidth = function (text, font) {\r\n\t var canvas = Measurer.canvas || (Measurer.canvas = document.createElement('canvas'));\r\n\t var context = canvas.getContext('2d');\r\n\t context.font = font;\r\n\t var metrics = context.measureText(text);\r\n\t return metrics.width;\r\n\t };\r\n\t Measurer.measureRoundedTextWidth = function (text, font) {\r\n\t var width = Measurer.measureTextWidth(text, font);\r\n\t return Math.floor(width) + 1;\r\n\t };\r\n\t return Measurer;\r\n\t}());\r\n\texports.Measurer = Measurer;\r\n\tObject.defineProperty(exports, \"__esModule\", { value: true });\r\n\texports.default = Measurer;\r\n\n\n/***/ },\n/* 16 */\n/***/ function(module, exports) {\n\n\t\"use strict\";\r\n\tvar UiGridMetrics = (function () {\r\n\t function UiGridMetrics() {\r\n\t }\r\n\t UiGridMetrics.prototype.getHeaderFont = function () {\r\n\t if (this.headerFont) {\r\n\t return this.headerFont;\r\n\t }\r\n\t var header = document.querySelector('.ui-grid-header-cell .ui-grid-cell-contents');\r\n\t if (!header) {\r\n\t throw new Error('not found: .ui-grid-header-cell .ui-grid-cell-contents');\r\n\t }\r\n\t var headerStyle = getComputedStyle(header);\r\n\t this.headerFont = UiGridMetrics.getFontStringFrom(headerStyle);\r\n\t return this.headerFont;\r\n\t };\r\n\t UiGridMetrics.prototype.getCellFont = function () {\r\n\t if (this.cellFont) {\r\n\t return this.cellFont;\r\n\t }\r\n\t var cell = document.querySelector('.ui-grid-cell > .ui-grid-cell-contents');\r\n\t if (!cell) {\r\n\t var element = document.createElement('div');\r\n\t element.className = 'ui-grid-cell-contents';\r\n\t element.style.cssFloat = 'left';\r\n\t angular.element(document.body).append(element);\r\n\t var cellStyle_1 = getComputedStyle(element);\r\n\t this.cellFont = UiGridMetrics.getFontStringFrom(cellStyle_1);\r\n\t angular.element(element).remove();\r\n\t return this.cellFont;\r\n\t }\r\n\t var cellStyle = getComputedStyle(cell);\r\n\t this.cellFont = UiGridMetrics.getFontStringFrom(cellStyle);\r\n\t return this.cellFont;\r\n\t };\r\n\t UiGridMetrics.prototype.getPadding = function () {\r\n\t if (this.padding) {\r\n\t return this.padding;\r\n\t }\r\n\t var header = document.querySelector('.ui-grid-header-cell .ui-grid-cell-contents');\r\n\t if (!header) {\r\n\t throw new Error('not found: .ui-grid-header-cell .ui-grid-cell-contents');\r\n\t }\r\n\t var _a = getComputedStyle(header), paddingLeft = _a.paddingLeft, paddingRight = _a.paddingRight;\r\n\t this.padding = parseInt(paddingLeft) + parseInt(paddingRight);\r\n\t return this.padding;\r\n\t };\r\n\t UiGridMetrics.prototype.getBorder = function () {\r\n\t if (this.border) {\r\n\t return this.border;\r\n\t }\r\n\t var header = document.querySelector('.ui-grid-header-cell');\r\n\t if (!header) {\r\n\t throw new Error('not found: .ui-grid-header-cell');\r\n\t }\r\n\t var borderRightWidth = getComputedStyle(header).borderRightWidth;\r\n\t this.border = parseInt(borderRightWidth);\r\n\t return this.border;\r\n\t };\r\n\t UiGridMetrics.prototype.getHeaderButtonsWidth = function () {\r\n\t // TODO: lets be more precise\r\n\t var HEADER_BUTTONS_WIDTH = 25;\r\n\t return HEADER_BUTTONS_WIDTH;\r\n\t };\r\n\t UiGridMetrics.getFontStringFrom = function (_a) {\r\n\t var fontStyle = _a.fontStyle, fontVariant = _a.fontVariant, fontWeight = _a.fontWeight, fontSize = _a.fontSize, fontFamily = _a.fontFamily;\r\n\t // in FF cssStyle.font may be '' so we need to collect it manually\r\n\t // font: [font-style||font-variant||font-weight] font-size [/line-height] font-family | inherit\r\n\t return fontStyle + \" \" + fontVariant + \" \" + fontWeight + \" \" + fontSize + \" \" + fontFamily;\r\n\t };\r\n\t return UiGridMetrics;\r\n\t}());\r\n\texports.UiGridMetrics = UiGridMetrics;\r\n\tObject.defineProperty(exports, \"__esModule\", { value: true });\r\n\texports.default = UiGridMetrics;\r\n\n\n/***/ },\n/* 17 */\n/***/ function(module, exports) {\n\n\t\"use strict\";\r\n\t/*@ngInject*/\n\tUiGridAutoFitColumnsDirective.$inject = [\"uiGridAutoFitColumnsService\"];\r\n\tfunction UiGridAutoFitColumnsDirective(uiGridAutoFitColumnsService) {\r\n\t return {\r\n\t replace: true,\r\n\t priority: 0,\r\n\t require: '^uiGrid',\r\n\t scope: false,\r\n\t compile: function () {\r\n\t return {\r\n\t pre: function ($scope, $elm, $attrs, uiGridCtrl) {\r\n\t uiGridAutoFitColumnsService.initializeGrid(uiGridCtrl.grid);\r\n\t }\r\n\t };\r\n\t }\r\n\t };\r\n\t}\r\n\texports.UiGridAutoFitColumnsDirective = UiGridAutoFitColumnsDirective;\r\n\n\n/***/ }\n/******/ ])\n});\n;\n\n\n// WEBPACK FOOTER //\n// autoFitColumns.min.js"," \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\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\texports: {},\n \t\t\tid: moduleId,\n \t\t\tloaded: false\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.loaded = 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// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(0);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap 2a30a220c7a745a6233b","import * as angular from 'angular';\nimport { UiGridAutoFitColumnsService } from './UiGridAutoFitColumnsService';\nimport { UiGridAutoFitColumnsDirective } from './UiGridAutoFitColumnsDirective';\n\nexport default angular.module('ui.grid.autoFitColumns', ['ui.grid'])\n .service('uiGridAutoFitColumnsService', UiGridAutoFitColumnsService)\n .directive('uiGridAutoFitColumns', UiGridAutoFitColumnsDirective)\n .name;\n\n\n\n// WEBPACK FOOTER //\n// ./src/index.ts","module.exports = __WEBPACK_EXTERNAL_MODULE_1__;\n\n\n//////////////////\n// WEBPACK FOOTER\n// external \"angular\"\n// module id = 1\n// module chunks = 0","import * as get from 'lodash/object/get';\nimport Measurer from './Measurer';\nimport UiGridMetrics from './UiGridMetrics';\n\ninterface IExtendedColumnDef extends uiGrid.IColumnDef {\n enableColumnAutoFit: boolean;\n}\n\ninterface IExtendedGridColumn extends uiGrid.IGridColumn {\n colDef: IExtendedColumnDef;\n}\n\ninterface IExtendedGridInstance extends uiGrid.IGridInstance {\n options: IExtendedGridOptions;\n}\n\ninterface IExtendedGridOptions extends uiGrid.IGridOptions {\n enableColumnAutoFit: boolean;\n}\n\ninterface IAnyFilterPredicateFunc {\n (value: any, firstFlag?: any, secondFlag?: any): string;\n}\n\nexport class UiGridAutoFitColumnsService {\n private gridMetrics: UiGridMetrics;\n\n /*@ngInject*/\n constructor (private $q: angular.IQService, private $filter: angular.IFilterService) {\n this.gridMetrics = new UiGridMetrics();\n }\n\n initializeGrid(grid: IExtendedGridInstance) {\n grid.registerColumnBuilder(this.colAutoFitColumnBuilder.bind(this));\n grid.registerColumnsProcessor(this.columnsProcessor.bind(this), 60);\n\n UiGridAutoFitColumnsService.defaultGridOptions(grid.options);\n }\n\n static defaultGridOptions(gridOptions: IExtendedGridOptions) {\n // true by default\n gridOptions.enableColumnAutoFit = gridOptions.enableColumnAutoFit !== false;\n }\n\n private getFilterIfExists(filterName): any {\n try {\n return this.$filter(filterName);\n } catch (e) {\n return null;\n }\n }\n\n private getFilteredValue(value: string, cellFilter: string) {\n if (cellFilter && cellFilter !== '') {\n const filter = this.getFilterIfExists(cellFilter);\n if (filter) {\n value = filter(value);\n } else {\n // https://regex101.com/r/rC5eR5/2\n const re = /([^:]*):([^:]*):?([\\s\\S]+)?/;\n let matches;\n if ((matches = re.exec(cellFilter)) !== null) {\n value = this.$filter(matches[1])(value, matches[2], matches[3]);\n }\n }\n }\n return value;\n }\n\n colAutoFitColumnBuilder(colDef: IExtendedColumnDef, col: IExtendedGridColumn, gridOptions: IExtendedGridOptions) {\n const promises = [];\n\n if (colDef.enableColumnAutoFit === undefined) {\n //TODO: make it as col.isResizable()\n if (UiGridAutoFitColumnsService.isResizable(colDef)) {\n colDef.enableColumnAutoFit = gridOptions.enableColumnAutoFit;\n } else {\n colDef.enableColumnAutoFit = false;\n }\n }\n\n return this.$q.all(promises);\n }\n\n static isResizable(colDef: IExtendedColumnDef): boolean {\n return !colDef.hasOwnProperty('width');\n }\n\n columnsProcessor(renderedColumnsToProcess?: Array, rows?: Array) {\n if (!rows.length) {\n return renderedColumnsToProcess;\n }\n // TODO: respect existing colDef options\n // if (col.colDef.enableColumnAutoFitting === false) return;\n\n let optimalWidths: {\n [name: string]: number\n } = {};\n\n\n renderedColumnsToProcess.forEach(column => {\n\n if (column.colDef.enableColumnAutoFit) {\n const columnKey = column.field || column.name;\n optimalWidths[columnKey] = Measurer.measureRoundedTextWidth(column.displayName, this.gridMetrics.getHeaderFont()) + this.gridMetrics.getHeaderButtonsWidth();\n\n rows.forEach((row) => {\n let cellText = get(row.entity, columnKey);\n\n if (!!column.colDef.cellFilter) {\n cellText = this.getFilteredValue(cellText, column.colDef.cellFilter);\n }\n\n const currentCellWidth = Measurer.measureRoundedTextWidth(cellText, this.gridMetrics.getCellFont());\n const optimalCellWidth = currentCellWidth > 300 ? 300 : currentCellWidth;\n\n if (optimalCellWidth > optimalWidths[columnKey]) {\n optimalWidths[columnKey] = optimalCellWidth;\n }\n });\n\n column.colDef.width = optimalWidths[columnKey] + this.gridMetrics.getPadding() + this.gridMetrics.getBorder();\n column.updateColumnDef(column.colDef, false);\n }\n });\n return renderedColumnsToProcess;\n }\n\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/UiGridAutoFitColumnsService.ts","var baseGet = require('../internal/baseGet'),\n toPath = require('../internal/toPath');\n\n/**\n * Gets the property value at `path` of `object`. If the resolved value is\n * `undefined` the `defaultValue` is used in its place.\n *\n * @static\n * @memberOf _\n * @category Object\n * @param {Object} object The object to query.\n * @param {Array|string} path The path of the property to get.\n * @param {*} [defaultValue] The value returned if the resolved value is `undefined`.\n * @returns {*} Returns the resolved value.\n * @example\n *\n * var object = { 'a': [{ 'b': { 'c': 3 } }] };\n *\n * _.get(object, 'a[0].b.c');\n * // => 3\n *\n * _.get(object, ['a', '0', 'b', 'c']);\n * // => 3\n *\n * _.get(object, 'a.b.c', 'default');\n * // => 'default'\n */\nfunction get(object, path, defaultValue) {\n var result = object == null ? undefined : baseGet(object, toPath(path), (path + ''));\n return result === undefined ? defaultValue : result;\n}\n\nmodule.exports = get;\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/lodash/object/get.js\n// module id = 3\n// module chunks = 0","var toObject = require('./toObject');\n\n/**\n * The base implementation of `get` without support for string paths\n * and default values.\n *\n * @private\n * @param {Object} object The object to query.\n * @param {Array} path The path of the property to get.\n * @param {string} [pathKey] The key representation of path.\n * @returns {*} Returns the resolved value.\n */\nfunction baseGet(object, path, pathKey) {\n if (object == null) {\n return;\n }\n if (pathKey !== undefined && pathKey in toObject(object)) {\n path = [pathKey];\n }\n var index = 0,\n length = path.length;\n\n while (object != null && index < length) {\n object = object[path[index++]];\n }\n return (index && index == length) ? object : undefined;\n}\n\nmodule.exports = baseGet;\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/lodash/internal/baseGet.js\n// module id = 4\n// module chunks = 0","var isObject = require('../lang/isObject');\n\n/**\n * Converts `value` to an object if it's not one.\n *\n * @private\n * @param {*} value The value to process.\n * @returns {Object} Returns the object.\n */\nfunction toObject(value) {\n return isObject(value) ? value : Object(value);\n}\n\nmodule.exports = toObject;\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/lodash/internal/toObject.js\n// module id = 5\n// module chunks = 0","/**\n * Checks if `value` is the [language type](https://es5.github.io/#x8) of `Object`.\n * (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)\n *\n * @static\n * @memberOf _\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an object, else `false`.\n * @example\n *\n * _.isObject({});\n * // => true\n *\n * _.isObject([1, 2, 3]);\n * // => true\n *\n * _.isObject(1);\n * // => false\n */\nfunction isObject(value) {\n // Avoid a V8 JIT bug in Chrome 19-20.\n // See https://code.google.com/p/v8/issues/detail?id=2291 for more details.\n var type = typeof value;\n return !!value && (type == 'object' || type == 'function');\n}\n\nmodule.exports = isObject;\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/lodash/lang/isObject.js\n// module id = 6\n// module chunks = 0","var baseToString = require('./baseToString'),\n isArray = require('../lang/isArray');\n\n/** Used to match property names within property paths. */\nvar rePropName = /[^.[\\]]+|\\[(?:(-?\\d+(?:\\.\\d+)?)|([\"'])((?:(?!\\2)[^\\n\\\\]|\\\\.)*?)\\2)\\]/g;\n\n/** Used to match backslashes in property paths. */\nvar reEscapeChar = /\\\\(\\\\)?/g;\n\n/**\n * Converts `value` to property path array if it's not one.\n *\n * @private\n * @param {*} value The value to process.\n * @returns {Array} Returns the property path array.\n */\nfunction toPath(value) {\n if (isArray(value)) {\n return value;\n }\n var result = [];\n baseToString(value).replace(rePropName, function(match, number, quote, string) {\n result.push(quote ? string.replace(reEscapeChar, '$1') : (number || match));\n });\n return result;\n}\n\nmodule.exports = toPath;\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/lodash/internal/toPath.js\n// module id = 7\n// module chunks = 0","/**\n * Converts `value` to a string if it's not one. An empty string is returned\n * for `null` or `undefined` values.\n *\n * @private\n * @param {*} value The value to process.\n * @returns {string} Returns the string.\n */\nfunction baseToString(value) {\n return value == null ? '' : (value + '');\n}\n\nmodule.exports = baseToString;\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/lodash/internal/baseToString.js\n// module id = 8\n// module chunks = 0","var getNative = require('../internal/getNative'),\n isLength = require('../internal/isLength'),\n isObjectLike = require('../internal/isObjectLike');\n\n/** `Object#toString` result references. */\nvar arrayTag = '[object Array]';\n\n/** Used for native method references. */\nvar objectProto = Object.prototype;\n\n/**\n * Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)\n * of values.\n */\nvar objToString = objectProto.toString;\n\n/* Native method references for those with the same name as other `lodash` methods. */\nvar nativeIsArray = getNative(Array, 'isArray');\n\n/**\n * Checks if `value` is classified as an `Array` object.\n *\n * @static\n * @memberOf _\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.\n * @example\n *\n * _.isArray([1, 2, 3]);\n * // => true\n *\n * _.isArray(function() { return arguments; }());\n * // => false\n */\nvar isArray = nativeIsArray || function(value) {\n return isObjectLike(value) && isLength(value.length) && objToString.call(value) == arrayTag;\n};\n\nmodule.exports = isArray;\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/lodash/lang/isArray.js\n// module id = 9\n// module chunks = 0","var isNative = require('../lang/isNative');\n\n/**\n * Gets the native function at `key` of `object`.\n *\n * @private\n * @param {Object} object The object to query.\n * @param {string} key The key of the method to get.\n * @returns {*} Returns the function if it's native, else `undefined`.\n */\nfunction getNative(object, key) {\n var value = object == null ? undefined : object[key];\n return isNative(value) ? value : undefined;\n}\n\nmodule.exports = getNative;\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/lodash/internal/getNative.js\n// module id = 10\n// module chunks = 0","var isFunction = require('./isFunction'),\n isObjectLike = require('../internal/isObjectLike');\n\n/** Used to detect host constructors (Safari > 5). */\nvar reIsHostCtor = /^\\[object .+?Constructor\\]$/;\n\n/** Used for native method references. */\nvar objectProto = Object.prototype;\n\n/** Used to resolve the decompiled source of functions. */\nvar fnToString = Function.prototype.toString;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/** Used to detect if a method is native. */\nvar reIsNative = RegExp('^' +\n fnToString.call(hasOwnProperty).replace(/[\\\\^$.*+?()[\\]{}|]/g, '\\\\$&')\n .replace(/hasOwnProperty|(function).*?(?=\\\\\\()| for .+?(?=\\\\\\])/g, '$1.*?') + '$'\n);\n\n/**\n * Checks if `value` is a native function.\n *\n * @static\n * @memberOf _\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a native function, else `false`.\n * @example\n *\n * _.isNative(Array.prototype.push);\n * // => true\n *\n * _.isNative(_);\n * // => false\n */\nfunction isNative(value) {\n if (value == null) {\n return false;\n }\n if (isFunction(value)) {\n return reIsNative.test(fnToString.call(value));\n }\n return isObjectLike(value) && reIsHostCtor.test(value);\n}\n\nmodule.exports = isNative;\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/lodash/lang/isNative.js\n// module id = 11\n// module chunks = 0","var isObject = require('./isObject');\n\n/** `Object#toString` result references. */\nvar funcTag = '[object Function]';\n\n/** Used for native method references. */\nvar objectProto = Object.prototype;\n\n/**\n * Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)\n * of values.\n */\nvar objToString = objectProto.toString;\n\n/**\n * Checks if `value` is classified as a `Function` object.\n *\n * @static\n * @memberOf _\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.\n * @example\n *\n * _.isFunction(_);\n * // => true\n *\n * _.isFunction(/abc/);\n * // => false\n */\nfunction isFunction(value) {\n // The use of `Object#toString` avoids issues with the `typeof` operator\n // in older versions of Chrome and Safari which return 'function' for regexes\n // and Safari 8 which returns 'object' for typed array constructors.\n return isObject(value) && objToString.call(value) == funcTag;\n}\n\nmodule.exports = isFunction;\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/lodash/lang/isFunction.js\n// module id = 12\n// module chunks = 0","/**\n * Checks if `value` is object-like.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is object-like, else `false`.\n */\nfunction isObjectLike(value) {\n return !!value && typeof value == 'object';\n}\n\nmodule.exports = isObjectLike;\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/lodash/internal/isObjectLike.js\n// module id = 13\n// module chunks = 0","/**\n * Used as the [maximum length](http://ecma-international.org/ecma-262/6.0/#sec-number.max_safe_integer)\n * of an array-like value.\n */\nvar MAX_SAFE_INTEGER = 9007199254740991;\n\n/**\n * Checks if `value` is a valid array-like length.\n *\n * **Note:** This function is based on [`ToLength`](http://ecma-international.org/ecma-262/6.0/#sec-tolength).\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.\n */\nfunction isLength(value) {\n return typeof value == 'number' && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;\n}\n\nmodule.exports = isLength;\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/lodash/internal/isLength.js\n// module id = 14\n// module chunks = 0","export class Measurer {\n private static canvas: HTMLCanvasElement;\n\n static measureTextWidth(text: string, font: string): number{\n const canvas = Measurer.canvas || (Measurer.canvas = document.createElement('canvas'));\n const context = canvas.getContext('2d');\n context.font = font;\n const metrics = context.measureText(text);\n return metrics.width;\n }\n\n static measureRoundedTextWidth(text: string, font: string): number{\n const width = Measurer.measureTextWidth(text, font);\n return Math.floor(width) + 1;\n }\n}\n\nexport default Measurer;\n\n\n\n// WEBPACK FOOTER //\n// ./src/Measurer.ts","export class UiGridMetrics {\n private headerFont: string;\n private cellFont: string;\n private padding: number;\n private border: number;\n\n getHeaderFont(){\n if(this.headerFont){\n return this.headerFont;\n }\n\n let header = document.querySelector('.ui-grid-header-cell .ui-grid-cell-contents');\n\n if(!header) {\n throw new Error('not found: .ui-grid-header-cell .ui-grid-cell-contents');\n }\n\n let headerStyle = getComputedStyle(header);\n this.headerFont = UiGridMetrics.getFontStringFrom(headerStyle);\n return this.headerFont;\n }\n\n getCellFont(){\n if(this.cellFont){\n return this.cellFont;\n }\n\n let cell = document.querySelector('.ui-grid-cell > .ui-grid-cell-contents');\n\n if(!cell){\n let element = document.createElement('div');\n element.className = 'ui-grid-cell-contents';\n element.style.cssFloat = 'left';\n angular.element(document.body).append(element);\n let cellStyle = getComputedStyle(element);\n this.cellFont = UiGridMetrics.getFontStringFrom(cellStyle);\n angular.element(element).remove();\n return this.cellFont;\n }\n\n let cellStyle = getComputedStyle(cell);\n this.cellFont = UiGridMetrics.getFontStringFrom(cellStyle);\n return this.cellFont;\n }\n\n getPadding(){\n if(this.padding){\n return this.padding;\n }\n\n let header = document.querySelector('.ui-grid-header-cell .ui-grid-cell-contents');\n\n if(!header) {\n throw new Error('not found: .ui-grid-header-cell .ui-grid-cell-contents');\n }\n\n let {paddingLeft, paddingRight} = getComputedStyle(header);\n this.padding = parseInt(paddingLeft) + parseInt(paddingRight);\n return this.padding;\n }\n\n getBorder(){\n if(this.border){\n return this.border;\n }\n\n let header = document.querySelector('.ui-grid-header-cell');\n\n if(!header) {\n throw new Error('not found: .ui-grid-header-cell');\n }\n\n let {borderRightWidth} = getComputedStyle(header);\n this.border = parseInt(borderRightWidth);\n return this.border;\n }\n\n getHeaderButtonsWidth(){\n // TODO: lets be more precise\n const HEADER_BUTTONS_WIDTH = 25;\n return HEADER_BUTTONS_WIDTH;\n }\n\n private static getFontStringFrom({fontStyle, fontVariant, fontWeight, fontSize, fontFamily}: CSSStyleDeclaration): string {\n // in FF cssStyle.font may be '' so we need to collect it manually\n // font: [font-style||font-variant||font-weight] font-size [/line-height] font-family | inherit\n return `${fontStyle} ${fontVariant} ${fontWeight} ${fontSize} ${fontFamily}`;\n }\n\n}\n\nexport default UiGridMetrics;\n\n\n\n// WEBPACK FOOTER //\n// ./src/UiGridMetrics.ts","import { UiGridAutoFitColumnsService } from './UiGridAutoFitColumnsService';\n\n/*@ngInject*/\nexport function UiGridAutoFitColumnsDirective (uiGridAutoFitColumnsService: UiGridAutoFitColumnsService) {\n return {\n replace: true,\n priority: 0,\n require: '^uiGrid',\n scope: false,\n compile: function () {\n return {\n pre: function ($scope, $elm, $attrs, uiGridCtrl) {\n uiGridAutoFitColumnsService.initializeGrid(uiGridCtrl.grid);\n }\n };\n }\n };\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/UiGridAutoFitColumnsDirective.ts"],"sourceRoot":""} \ No newline at end of file