build commit

This commit is contained in:
Faris Ansari 2018-04-15 22:20:33 +05:30
parent 98afce65ac
commit 8509df7093
9 changed files with 215 additions and 129 deletions

View File

@ -242,10 +242,12 @@ var isObject_1 = isObject;
var commonjsGlobal = typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
/** Detect free variable `global` from Node.js. */
var freeGlobal = typeof commonjsGlobal == 'object' && commonjsGlobal && commonjsGlobal.Object === Object && commonjsGlobal;
var _freeGlobal = freeGlobal;
/** Detect free variable `self`. */
var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
/** Used as a reference to the global object. */
@ -253,16 +255,34 @@ var root = _freeGlobal || freeSelf || Function('return this')();
var _root = root;
/**
* Gets the timestamp of the number of milliseconds that have elapsed since
* the Unix epoch (1 January 1970 00:00:00 UTC).
*
* @static
* @memberOf _
* @since 2.4.0
* @category Date
* @returns {number} Returns the timestamp.
* @example
*
* _.defer(function(stamp) {
* console.log(_.now() - stamp);
* }, _.now());
* // => Logs the number of milliseconds it took for the deferred invocation.
*/
var now = function() {
return _root.Date.now();
};
var now_1 = now;
/** Built-in value references. */
var Symbol = _root.Symbol;
var _Symbol = Symbol;
/** Used for built-in method references. */
var objectProto = Object.prototype;
/** Used to check objects for own properties. */
@ -330,6 +350,7 @@ function objectToString(value) {
var _objectToString = objectToString;
/** `Object#toString` result references. */
var nullTag = '[object Null]';
var undefinedTag = '[object Undefined]';
@ -384,6 +405,7 @@ function isObjectLike(value) {
var isObjectLike_1 = isObjectLike;
/** `Object#toString` result references. */
var symbolTag = '[object Symbol]';
/**
@ -410,6 +432,7 @@ function isSymbol(value) {
var isSymbol_1 = isSymbol;
/** Used as references for various `Number` constants. */
var NAN = 0 / 0;
/** Used to match leading and trailing whitespace. */
@ -473,6 +496,7 @@ function toNumber(value) {
var toNumber_1 = toNumber;
/** Error message constants. */
var FUNC_ERROR_TEXT = 'Expected a function';
/* Built-in method references for those with the same name as other `lodash` methods. */
@ -659,6 +683,7 @@ function debounce(func, wait, options) {
var debounce_1 = debounce;
/** Error message constants. */
var FUNC_ERROR_TEXT$1 = 'Expected a function';
/**
@ -965,7 +990,6 @@ class DataManager {
prepareCell(content, i) {
const cell = {
content: '',
align: 'left',
sortOrder: 'none',
colIndex: i,
column: this.columns[i]
@ -1934,7 +1958,7 @@ class CellManager {
this.activateEditing(cell);
});
this.keyboard.on('enter', (e) => {
this.keyboard.on('enter', () => {
if (this.$focusedCell && !this.$editingCell) {
// enter keypress on focused cell
this.activateEditing(this.$focusedCell);
@ -1993,13 +2017,11 @@ class CellManager {
return true;
};
['left', 'right', 'up', 'down', 'tab', 'shift+tab'].map(
direction => this.keyboard.on(direction, () => focusCell(direction))
);
['left', 'right', 'up', 'down', 'tab', 'shift+tab']
.map(direction => this.keyboard.on(direction, () => focusCell(direction)));
['left', 'right', 'up', 'down'].map(
direction => this.keyboard.on('ctrl+' + direction, () => focusLastCell(direction))
);
['left', 'right', 'up', 'down']
.map(direction => this.keyboard.on(`ctrl+${direction}`, () => focusLastCell(direction)));
this.keyboard.on('esc', () => {
this.deactivateEditing();
@ -2008,9 +2030,7 @@ class CellManager {
if (this.options.inlineFilters) {
this.keyboard.on('ctrl+f', (e) => {
const $cell = $.closest('.data-table-cell', e.target);
let {
colIndex
} = $.data($cell);
const { colIndex } = $.data($cell);
this.activateFilter(colIndex);
return true;
@ -2035,10 +2055,9 @@ class CellManager {
return $selectionCursor;
};
['left', 'right', 'up', 'down'].map(
direction => this.keyboard.on('shift+' + direction,
() => this.selectArea(getNextSelectionCursor(direction)))
);
['left', 'right', 'up', 'down']
.map(direction =>
this.keyboard.on(`shift+${direction}`, () => this.selectArea(getNextSelectionCursor(direction))));
}
bindCopyCellContents() {
@ -2186,7 +2205,7 @@ class CellManager {
// valid selection
this.$selectionCursor = $selectionCursor;
}
};
}
_selectArea($cell1, $cell2) {
if ($cell1 === $cell2) return false;
@ -2200,13 +2219,15 @@ class CellManager {
}
getCellsInRange($cell1, $cell2) {
let colIndex1, rowIndex1, colIndex2, rowIndex2;
let colIndex1;
let rowIndex1;
let colIndex2;
let rowIndex2;
if (typeof $cell1 === 'number') {
[colIndex1, rowIndex1, colIndex2, rowIndex2] = arguments;
[colIndex1, rowIndex1, colIndex2, rowIndex2] = arguments; // eslint-disable-line
} else
if (typeof $cell1 === 'object') {
if (!($cell1 && $cell2)) {
return false;
}
@ -2232,17 +2253,17 @@ class CellManager {
return false;
}
let cells = [];
const cells = [];
let colIndex = colIndex1;
let rowIndex = rowIndex1;
let rowIndices = [];
const rowIndices = [];
while (rowIndex <= rowIndex2) {
rowIndices.push(rowIndex);
rowIndex++;
rowIndex += 1;
}
rowIndices.map(rowIndex => {
rowIndices.map((rowIndex) => {
while (colIndex <= colIndex2) {
cells.push([colIndex, rowIndex]);
colIndex++;
@ -2964,9 +2985,7 @@ class BodyRenderer {
scrollElem: this.bodyScrollable,
contentElem: $('tbody', this.bodyScrollable),
callbacks: {
clusterChanged: () => {
this.restoreState();
}
clusterChanged: () => this.restoreState()
},
/* eslint-disable */
show_no_data_row: false,
@ -3003,7 +3022,7 @@ class BodyRenderer {
}
getDataForClusterize(rows) {
return rows.map((row) => this.rowmanager.getRowHTML(row, row.meta));
return rows.map(row => this.rowmanager.getRowHTML(row, row.meta));
}
getBodyHTML(rows) {
@ -3627,8 +3646,8 @@ var name = "frappe-datatable";
var version = "0.0.4";
var description = "A modern datatable library for the web";
var main = "dist/frappe-datatable.cjs.js";
var scripts = {"start":"yarn run dev","build":"rollup -c","dev":"rollup -c -w","test":"mocha --compilers js:babel-core/register --colors ./test/*.spec.js","test:watch":"mocha --compilers js:babel-core/register --colors -w ./test/*.spec.js"};
var devDependencies = {"chai":"3.5.0","cssnano":"^3.10.0","deepmerge":"^2.0.1","eslint":"3.19.0","eslint-loader":"1.7.1","mocha":"3.3.0","postcss-cssnext":"^3.1.0","postcss-nested":"^3.0.0","precss":"^3.1.0","rollup-plugin-commonjs":"^8.3.0","rollup-plugin-json":"^2.3.0","rollup-plugin-node-resolve":"^3.0.3","rollup-plugin-postcss":"^1.2.8","rollup-plugin-uglify":"^3.0.0"};
var scripts = {"start":"yarn run dev","build":"rollup -c","production":"rollup -c --production","build:docs":"rollup -c --docs","dev":"rollup -c -w","test":"mocha --compilers js:babel-core/register --colors ./test/*.spec.js"};
var devDependencies = {"chai":"3.5.0","deepmerge":"^2.0.1","eslint-config-airbnb":"^16.1.0","eslint-config-airbnb-base":"^12.1.0","eslint-plugin-import":"^2.11.0","mocha":"3.3.0","postcss-cssnext":"^3.1.0","postcss-nested":"^3.0.0","rollup-plugin-commonjs":"^8.3.0","rollup-plugin-eslint":"^4.0.0","rollup-plugin-json":"^2.3.0","rollup-plugin-node-resolve":"^3.0.3","rollup-plugin-postcss":"^1.2.8","rollup-plugin-uglify-es":"^0.0.1"};
var repository = {"type":"git","url":"https://github.com/frappe/datatable.git"};
var keywords = ["datatable","data","grid","table"];
var author = "Faris Ansari";

View File

@ -222,7 +222,7 @@
display: none;
padding: 8px;
padding: 0.5rem;
background: #fff;
background-color: #fff;
z-index: 1;
height: 100%;
}
@ -236,7 +236,7 @@
}
.data-table-cell.editing .edit-cell {
border: 2px solid rgb(82, 146, 247);
border: 2px solid rgb(255, 160, 10);
display: block;
}

View File

@ -241,10 +241,12 @@ var isObject_1 = isObject;
var commonjsGlobal = typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
/** Detect free variable `global` from Node.js. */
var freeGlobal = typeof commonjsGlobal == 'object' && commonjsGlobal && commonjsGlobal.Object === Object && commonjsGlobal;
var _freeGlobal = freeGlobal;
/** Detect free variable `self`. */
var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
/** Used as a reference to the global object. */
@ -252,16 +254,34 @@ var root = _freeGlobal || freeSelf || Function('return this')();
var _root = root;
/**
* Gets the timestamp of the number of milliseconds that have elapsed since
* the Unix epoch (1 January 1970 00:00:00 UTC).
*
* @static
* @memberOf _
* @since 2.4.0
* @category Date
* @returns {number} Returns the timestamp.
* @example
*
* _.defer(function(stamp) {
* console.log(_.now() - stamp);
* }, _.now());
* // => Logs the number of milliseconds it took for the deferred invocation.
*/
var now = function() {
return _root.Date.now();
};
var now_1 = now;
/** Built-in value references. */
var Symbol = _root.Symbol;
var _Symbol = Symbol;
/** Used for built-in method references. */
var objectProto = Object.prototype;
/** Used to check objects for own properties. */
@ -329,6 +349,7 @@ function objectToString(value) {
var _objectToString = objectToString;
/** `Object#toString` result references. */
var nullTag = '[object Null]';
var undefinedTag = '[object Undefined]';
@ -383,6 +404,7 @@ function isObjectLike(value) {
var isObjectLike_1 = isObjectLike;
/** `Object#toString` result references. */
var symbolTag = '[object Symbol]';
/**
@ -409,6 +431,7 @@ function isSymbol(value) {
var isSymbol_1 = isSymbol;
/** Used as references for various `Number` constants. */
var NAN = 0 / 0;
/** Used to match leading and trailing whitespace. */
@ -472,6 +495,7 @@ function toNumber(value) {
var toNumber_1 = toNumber;
/** Error message constants. */
var FUNC_ERROR_TEXT = 'Expected a function';
/* Built-in method references for those with the same name as other `lodash` methods. */
@ -658,6 +682,7 @@ function debounce(func, wait, options) {
var debounce_1 = debounce;
/** Error message constants. */
var FUNC_ERROR_TEXT$1 = 'Expected a function';
/**
@ -964,7 +989,6 @@ class DataManager {
prepareCell(content, i) {
const cell = {
content: '',
align: 'left',
sortOrder: 'none',
colIndex: i,
column: this.columns[i]
@ -1933,7 +1957,7 @@ class CellManager {
this.activateEditing(cell);
});
this.keyboard.on('enter', (e) => {
this.keyboard.on('enter', () => {
if (this.$focusedCell && !this.$editingCell) {
// enter keypress on focused cell
this.activateEditing(this.$focusedCell);
@ -1992,13 +2016,11 @@ class CellManager {
return true;
};
['left', 'right', 'up', 'down', 'tab', 'shift+tab'].map(
direction => this.keyboard.on(direction, () => focusCell(direction))
);
['left', 'right', 'up', 'down', 'tab', 'shift+tab']
.map(direction => this.keyboard.on(direction, () => focusCell(direction)));
['left', 'right', 'up', 'down'].map(
direction => this.keyboard.on('ctrl+' + direction, () => focusLastCell(direction))
);
['left', 'right', 'up', 'down']
.map(direction => this.keyboard.on(`ctrl+${direction}`, () => focusLastCell(direction)));
this.keyboard.on('esc', () => {
this.deactivateEditing();
@ -2007,9 +2029,7 @@ class CellManager {
if (this.options.inlineFilters) {
this.keyboard.on('ctrl+f', (e) => {
const $cell = $.closest('.data-table-cell', e.target);
let {
colIndex
} = $.data($cell);
const { colIndex } = $.data($cell);
this.activateFilter(colIndex);
return true;
@ -2034,10 +2054,9 @@ class CellManager {
return $selectionCursor;
};
['left', 'right', 'up', 'down'].map(
direction => this.keyboard.on('shift+' + direction,
() => this.selectArea(getNextSelectionCursor(direction)))
);
['left', 'right', 'up', 'down']
.map(direction =>
this.keyboard.on(`shift+${direction}`, () => this.selectArea(getNextSelectionCursor(direction))));
}
bindCopyCellContents() {
@ -2185,7 +2204,7 @@ class CellManager {
// valid selection
this.$selectionCursor = $selectionCursor;
}
};
}
_selectArea($cell1, $cell2) {
if ($cell1 === $cell2) return false;
@ -2199,13 +2218,15 @@ class CellManager {
}
getCellsInRange($cell1, $cell2) {
let colIndex1, rowIndex1, colIndex2, rowIndex2;
let colIndex1;
let rowIndex1;
let colIndex2;
let rowIndex2;
if (typeof $cell1 === 'number') {
[colIndex1, rowIndex1, colIndex2, rowIndex2] = arguments;
[colIndex1, rowIndex1, colIndex2, rowIndex2] = arguments; // eslint-disable-line
} else
if (typeof $cell1 === 'object') {
if (!($cell1 && $cell2)) {
return false;
}
@ -2231,17 +2252,17 @@ class CellManager {
return false;
}
let cells = [];
const cells = [];
let colIndex = colIndex1;
let rowIndex = rowIndex1;
let rowIndices = [];
const rowIndices = [];
while (rowIndex <= rowIndex2) {
rowIndices.push(rowIndex);
rowIndex++;
rowIndex += 1;
}
rowIndices.map(rowIndex => {
rowIndices.map((rowIndex) => {
while (colIndex <= colIndex2) {
cells.push([colIndex, rowIndex]);
colIndex++;
@ -2963,9 +2984,7 @@ class BodyRenderer {
scrollElem: this.bodyScrollable,
contentElem: $('tbody', this.bodyScrollable),
callbacks: {
clusterChanged: () => {
this.restoreState();
}
clusterChanged: () => this.restoreState()
},
/* eslint-disable */
show_no_data_row: false,
@ -3002,7 +3021,7 @@ class BodyRenderer {
}
getDataForClusterize(rows) {
return rows.map((row) => this.rowmanager.getRowHTML(row, row.meta));
return rows.map(row => this.rowmanager.getRowHTML(row, row.meta));
}
getBodyHTML(rows) {
@ -3626,8 +3645,8 @@ var name = "frappe-datatable";
var version = "0.0.4";
var description = "A modern datatable library for the web";
var main = "dist/frappe-datatable.cjs.js";
var scripts = {"start":"yarn run dev","build":"rollup -c","dev":"rollup -c -w","test":"mocha --compilers js:babel-core/register --colors ./test/*.spec.js","test:watch":"mocha --compilers js:babel-core/register --colors -w ./test/*.spec.js"};
var devDependencies = {"chai":"3.5.0","cssnano":"^3.10.0","deepmerge":"^2.0.1","eslint":"3.19.0","eslint-loader":"1.7.1","mocha":"3.3.0","postcss-cssnext":"^3.1.0","postcss-nested":"^3.0.0","precss":"^3.1.0","rollup-plugin-commonjs":"^8.3.0","rollup-plugin-json":"^2.3.0","rollup-plugin-node-resolve":"^3.0.3","rollup-plugin-postcss":"^1.2.8","rollup-plugin-uglify":"^3.0.0"};
var scripts = {"start":"yarn run dev","build":"rollup -c","production":"rollup -c --production","build:docs":"rollup -c --docs","dev":"rollup -c -w","test":"mocha --compilers js:babel-core/register --colors ./test/*.spec.js"};
var devDependencies = {"chai":"3.5.0","deepmerge":"^2.0.1","eslint-config-airbnb":"^16.1.0","eslint-config-airbnb-base":"^12.1.0","eslint-plugin-import":"^2.11.0","mocha":"3.3.0","postcss-cssnext":"^3.1.0","postcss-nested":"^3.0.0","rollup-plugin-commonjs":"^8.3.0","rollup-plugin-eslint":"^4.0.0","rollup-plugin-json":"^2.3.0","rollup-plugin-node-resolve":"^3.0.3","rollup-plugin-postcss":"^1.2.8","rollup-plugin-uglify-es":"^0.0.1"};
var repository = {"type":"git","url":"https://github.com/frappe/datatable.git"};
var keywords = ["datatable","data","grid","table"];
var author = "Faris Ansari";

1
dist/frappe-datatable.min.css vendored Normal file
View File

@ -0,0 +1 @@
.data-table{position:relative;overflow:auto}.data-table *,.data-table :after,.data-table :before{-webkit-box-sizing:border-box;box-sizing:border-box}.data-table button,.data-table input{overflow:visible;font-family:inherit;font-size:inherit;line-height:inherit;margin:0;padding:0}.data-table .input-style{outline:none;width:100%;border:none}.data-table *,.data-table :focus{outline:none;border-radius:0;-webkit-box-shadow:none;box-shadow:none}.data-table table{border-collapse:collapse}.data-table table td{padding:0;border:1px solid #d1d8dd}.data-table thead td{border-bottom-width:1px}.data-table .freeze-container{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;-ms-flex-line-pack:center;align-content:center;position:absolute;left:0;right:0;top:0;bottom:0;background-color:#f5f7fa;opacity:.5;font-size:2em}.data-table .freeze-container span{position:absolute;top:50%;-webkit-transform:translateY(-50%);transform:translateY(-50%)}.data-table .hide{display:none}.data-table .toast-message{position:absolute;bottom:16px;bottom:1rem;left:50%;-webkit-transform:translateX(-50%);transform:translateX(-50%)}.data-table .toast-message span{display:inline-block;background-color:rgba(0,0,0,.8);color:#dfe2e5;border-radius:3px;padding:8px 16px;padding:.5rem 1rem}.body-scrollable{max-height:500px;overflow:auto;border-bottom:1px solid #d1d8dd}.body-scrollable.row-highlight-all .data-table-row:not(.row-unhighlight){background-color:#f5f7fa}.body-scrollable .no-data td{text-align:center;padding:8px;padding:.5rem}.data-table-header{position:absolute;top:0;left:0;background-color:#fff;font-weight:700}.data-table-header .content span:not(.column-resizer){cursor:pointer}.data-table-header .column-resizer{display:none;position:absolute;right:0;top:0;width:4px;width:.25rem;height:100%;background-color:#5292f7;cursor:col-resize}.data-table-header .data-table-dropdown{position:absolute;right:10px;display:-webkit-inline-box;display:-ms-inline-flexbox;display:inline-flex;vertical-align:top;text-align:left}.data-table-header .data-table-dropdown.is-active .data-table-dropdown-list,.data-table-header .data-table-dropdown.is-active .data-table-dropdown-toggle{display:block}.data-table-header .data-table-dropdown-toggle{display:none;background-color:transparent;border:none}.data-table-header .data-table-dropdown-list{display:none;font-weight:400;position:absolute;min-width:128px;min-width:8rem;top:100%;right:0;z-index:1;background-color:#fff;border-radius:3px;-webkit-box-shadow:0 2px 3px hsla(0,0%,4%,.1),0 0 0 1px hsla(0,0%,4%,.1);box-shadow:0 2px 3px hsla(0,0%,4%,.1),0 0 0 1px hsla(0,0%,4%,.1);padding-bottom:8px;padding-bottom:.5rem;padding-top:8px;padding-top:.5rem}.data-table-header .data-table-dropdown-list>div{padding:8px 16px;padding:.5rem 1rem}.data-table-header .data-table-dropdown-list>div:hover{background-color:#f5f7fa}.data-table-header .data-table-cell.remove-column{background-color:#fd8b8b;-webkit-transition:background-color .3s ease-in-out;transition:background-color .3s ease-in-out}.data-table-header .data-table-cell.sortable-chosen{background-color:#f5f7fa}.data-table-cell{position:relative}.data-table-cell .content{padding:8px;padding:.5rem;border:2px solid transparent;height:100%}.data-table-cell .content.ellipsis{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.data-table-cell .edit-cell{display:none;padding:8px;padding:.5rem;background-color:#fff;z-index:1;height:100%}.data-table-cell.selected .content{border:2px solid #5292f7}.data-table-cell.editing .content{display:none}.data-table-cell.editing .edit-cell{border:2px solid #ffa00a;border-style:dashed;display:block}.data-table-cell.highlight{background-color:#f5f7fa}.data-table-cell:hover .column-resizer{display:inline-block}.data-table-cell:hover .data-table-dropdown-toggle{display:block}.data-table-cell .tree-node{display:inline-block;position:relative}.data-table-cell .toggle{display:inline-block;position:absolute;padding:0 4px;cursor:pointer}.data-table-cell .toggle:before{content:"▼"}.data-table-cell.tree-close .toggle:before{content:"►"}.data-table-row.row-highlight{background-color:#f5f7fa}.noselect{-webkit-touch-callout:none;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}body.data-table-resize{cursor:col-resize}

1
dist/frappe-datatable.min.js vendored Normal file

File diff suppressed because one or more lines are too long

View File

@ -108,6 +108,12 @@
background-color: #f5f7fa;
}
.body-scrollable .no-data td {
text-align: center;
padding: 8px;
padding: 0.5rem;
}
.data-table-header {
position: absolute;
top: 0;
@ -203,6 +209,7 @@
padding: 8px;
padding: 0.5rem;
border: 2px solid transparent;
height: 100%;
}
.data-table-cell .content.ellipsis {
@ -215,7 +222,7 @@
display: none;
padding: 8px;
padding: 0.5rem;
background: #fff;
background-color: #fff;
z-index: 1;
height: 100%;
}
@ -229,7 +236,7 @@
}
.data-table-cell.editing .edit-cell {
border: 2px solid rgb(82, 146, 247);
border: 2px solid rgb(255, 160, 10);
display: block;
}

View File

@ -241,10 +241,12 @@ var isObject_1 = isObject;
var commonjsGlobal = typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
/** Detect free variable `global` from Node.js. */
var freeGlobal = typeof commonjsGlobal == 'object' && commonjsGlobal && commonjsGlobal.Object === Object && commonjsGlobal;
var _freeGlobal = freeGlobal;
/** Detect free variable `self`. */
var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
/** Used as a reference to the global object. */
@ -252,16 +254,34 @@ var root = _freeGlobal || freeSelf || Function('return this')();
var _root = root;
/**
* Gets the timestamp of the number of milliseconds that have elapsed since
* the Unix epoch (1 January 1970 00:00:00 UTC).
*
* @static
* @memberOf _
* @since 2.4.0
* @category Date
* @returns {number} Returns the timestamp.
* @example
*
* _.defer(function(stamp) {
* console.log(_.now() - stamp);
* }, _.now());
* // => Logs the number of milliseconds it took for the deferred invocation.
*/
var now = function() {
return _root.Date.now();
};
var now_1 = now;
/** Built-in value references. */
var Symbol = _root.Symbol;
var _Symbol = Symbol;
/** Used for built-in method references. */
var objectProto = Object.prototype;
/** Used to check objects for own properties. */
@ -329,6 +349,7 @@ function objectToString(value) {
var _objectToString = objectToString;
/** `Object#toString` result references. */
var nullTag = '[object Null]';
var undefinedTag = '[object Undefined]';
@ -383,6 +404,7 @@ function isObjectLike(value) {
var isObjectLike_1 = isObjectLike;
/** `Object#toString` result references. */
var symbolTag = '[object Symbol]';
/**
@ -409,6 +431,7 @@ function isSymbol(value) {
var isSymbol_1 = isSymbol;
/** Used as references for various `Number` constants. */
var NAN = 0 / 0;
/** Used to match leading and trailing whitespace. */
@ -472,6 +495,7 @@ function toNumber(value) {
var toNumber_1 = toNumber;
/** Error message constants. */
var FUNC_ERROR_TEXT = 'Expected a function';
/* Built-in method references for those with the same name as other `lodash` methods. */
@ -658,6 +682,7 @@ function debounce(func, wait, options) {
var debounce_1 = debounce;
/** Error message constants. */
var FUNC_ERROR_TEXT$1 = 'Expected a function';
/**
@ -964,7 +989,6 @@ class DataManager {
prepareCell(content, i) {
const cell = {
content: '',
align: 'left',
sortOrder: 'none',
colIndex: i,
column: this.columns[i]
@ -3229,8 +3253,9 @@ class Style {
}
setDefaultCellHeight() {
if (this.options.dynamicRowHeight) return;
if (this.__cellHeightSet) return;
const $firstCell = $('.data-table-cell', this.instance.bodyScrollable);
const $firstCell = $('.data-table-cell[data-is-header]', this.instance.header);
if (!$firstCell) return;
const height = this.options.cellHeight || $.style($firstCell, 'height');
@ -3281,6 +3306,14 @@ class Style {
width: width + 'px'
});
const $body = $('.data-table-body', this.bodyScrollable);
if ($body) {
$.style($body, {
height: '0px'
});
}
$.style(this.bodyScrollable, {
marginTop: $.style(this.header, 'height') + 'px'
});
@ -3418,7 +3451,8 @@ var DEFAULT_OPTIONS = {
cellHeight: null,
inlineFilters: false,
treeView: false,
checkedRowStatus: true
checkedRowStatus: true,
dynamicRowHeight: false
};
class DataTable {
@ -3613,11 +3647,11 @@ class DataTable {
DataTable.instances = 0;
var name = "frappe-datatable";
var version = "0.0.3";
var version = "0.0.4";
var description = "A modern datatable library for the web";
var main = "dist/frappe-datatable.cjs.js";
var scripts = {"start":"yarn run dev","build":"rollup -c","dev":"rollup -c -w","test":"mocha --compilers js:babel-core/register --colors ./test/*.spec.js","test:watch":"mocha --compilers js:babel-core/register --colors -w ./test/*.spec.js"};
var devDependencies = {"chai":"3.5.0","cssnano":"^3.10.0","deepmerge":"^2.0.1","eslint":"3.19.0","eslint-loader":"1.7.1","mocha":"3.3.0","postcss-cssnext":"^3.1.0","postcss-nested":"^3.0.0","precss":"^3.1.0","rollup-plugin-commonjs":"^8.3.0","rollup-plugin-json":"^2.3.0","rollup-plugin-node-resolve":"^3.0.3","rollup-plugin-postcss":"^1.2.8","rollup-plugin-uglify":"^3.0.0"};
var scripts = {"start":"yarn run dev","build":"rollup -c","production":"rollup -c --production","build:docs":"rollup -c --docs","dev":"rollup -c -w","test":"mocha --compilers js:babel-core/register --colors ./test/*.spec.js"};
var devDependencies = {"chai":"3.5.0","deepmerge":"^2.0.1","mocha":"3.3.0","postcss-cssnext":"^3.1.0","postcss-nested":"^3.0.0","rollup-plugin-commonjs":"^8.3.0","rollup-plugin-eslint":"^4.0.0","rollup-plugin-json":"^2.3.0","rollup-plugin-node-resolve":"^3.0.3","rollup-plugin-postcss":"^1.2.8","rollup-plugin-uglify-es":"^0.0.1"};
var repository = {"type":"git","url":"https://github.com/frappe/datatable.git"};
var keywords = ["datatable","data","grid","table"];
var author = "Faris Ansari";

View File

@ -6,7 +6,7 @@
html, body {
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
font-size: 14px;
font-size: 12px;
}
code {
@ -35,7 +35,6 @@ h2 {
flex-direction: column;
align-items: center;
padding: 4rem;
text-align: center;
}
.showcase p {
@ -62,4 +61,9 @@ h2 {
footer {
border-top: 1px solid #d1d8dd;
}
.data-table-header {
background: #f7fafc;
color: #8d99a6;
}

View File

@ -9,7 +9,8 @@ const {
// Hero
let datatable1 = new DataTable('.example-1 .target', {
columns,
data
data,
checkboxColumn: true
});
// Formatted Cells
@ -39,65 +40,65 @@ let datatable5 = new DataTable('.example-5', getTreeData());
datatable5.showToastMessage('Expand/Collapse tree nodes');
function getSampleData(multiplier) {
let columns = ['Name', 'Position', 'Office', 'Extn.', 'Start Date', 'Salary'];
let columns = ['Name', 'Position', 'Office', {name: 'Extn.', width: 75}, 'Start Date', 'Salary'];
let data = [
['Tiger Nixon', 'System Architect', 'Edinburgh', '5421', '2011/04/25', '320,800'],
['Garrett Winters', 'Accountant', 'Tokyo', '8422', '2011/07/25', '170,750'],
['Ashton Cox', 'Junior Technical Author', 'San Francisco', '1562', '2009/01/12', '86,000'],
['Cedric Kelly', 'Senior Javascript Developer', 'Edinburgh', '6224', '2012/03/29', '433,060'],
['Airi Satou', 'Accountant', 'Tokyo', '5407', '2008/11/28', '162,700'],
['Brielle Williamson', 'Integration Specialist', 'New York', '4804', '2012/12/02', '372,000'],
['Herrod Chandler', 'Sales Assistant', 'San Francisco', '9608', '2012/08/06', '137,500'],
['Rhona Davidson', 'Integration Specialist', 'Tokyo', '6200', '2010/10/14', '327,900'],
['Colleen Hurst', 'Javascript Developer', 'San Francisco', '2360', '2009/09/15', '205,500'],
['Sonya Frost', 'Software Engineer', 'Edinburgh', '1667', '2008/12/13', '103,600'],
['Jena Gaines', 'Office Manager', 'London', '3814', '2008/12/19', '90,560'],
['Quinn Flynn', 'Support Lead', 'Edinburgh', '9497', '2013/03/03', '342,000'],
['Charde Marshall', 'Regional Director', 'San Francisco', '6741', '2008/10/16', '470,600'],
['Haley Kennedy', 'Senior Marketing Designer', 'London', '3597', '2012/12/18', '313,500'],
['Tatyana Fitzpatrick', 'Regional Director', 'London', '1965', '2010/03/17', '385,750'],
['Michael Silva', 'Marketing Designer', 'London', '1581', '2012/11/27', '198,500'],
['Paul Byrd', 'Chief Financial Officer (CFO)', 'New York', '3059', '2010/06/09', '725,000'],
['Gloria Little', 'Systems Administrator', 'New York', '1721', '2009/04/10', '237,500'],
['Bradley Greer', 'Software Engineer', 'London', '2558', '2012/10/13', '132,000'],
['Dai Rios', 'Personnel Lead', 'Edinburgh', '2290', '2012/09/26', '217,500'],
['Jenette Caldwell', 'Development Lead', 'New York', '1937', '2011/09/03', '345,000'],
['Yuri Berry', 'Chief Marketing Officer (CMO)', 'New York', '6154', '2009/06/25', '675,000'],
['Caesar Vance', 'Pre-Sales Support', 'New York', '8330', '2011/12/12', '106,450'],
['Doris Wilder', 'Sales Assistant', 'Sidney', '3023', '2010/09/20', '85,600'],
['Angelica Ramos', 'Chief Executive Officer (CEO)', 'London', '5797', '2009/10/09', '1,200,000'],
['Gavin Joyce', 'Developer', 'Edinburgh', '8822', '2010/12/22', '92,575'],
['Jennifer Chang', 'Regional Director', 'Singapore', '9239', '2010/11/14', '357,650'],
['Brenden Wagner', 'Software Engineer', 'San Francisco', '1314', '2011/06/07', '206,850'],
['Fiona Green', 'Chief Operating Officer (COO)', 'San Francisco', '2947', '2010/03/11', '850,000'],
['Shou Itou', 'Regional Marketing', 'Tokyo', '8899', '2011/08/14', '163,000'],
['Michelle House', 'Integration Specialist', 'Sidney', '2769', '2011/06/02', '95,400'],
['Suki Burks', 'Developer', 'London', '6832', '2009/10/22', '114,500'],
['Prescott Bartlett', 'Technical Author', 'London', '3606', '2011/05/07', '145,000'],
['Gavin Cortez', 'Team Leader', 'San Francisco', '2860', '2008/10/26', '235,500'],
['Martena Mccray', 'Post-Sales support', 'Edinburgh', '8240', '2011/03/09', '324,050'],
['Unity Butler', 'Marketing Designer', 'San Francisco', '5384', '2009/12/09', '85,675'],
['Howard Hatfield', 'Office Manager', 'San Francisco', '7031', '2008/12/16', '164,500'],
['Hope Fuentes', 'Secretary', 'San Francisco', '6318', '2010/02/12', '109,850'],
['Vivian Harrell', 'Financial Controller', 'San Francisco', '9422', '2009/02/14', '452,500'],
['Timothy Mooney', 'Office Manager', 'London', '7580', '2008/12/11', '136,200'],
['Jackson Bradshaw', 'Director', 'New York', '1042', '2008/09/26', '645,750'],
['Olivia Liang', 'Support Engineer', 'Singapore', '2120', '2011/02/03', '234,500'],
['Bruno Nash', 'Software Engineer', 'London', '6222', '2011/05/03', '163,500'],
['Sakura Yamamoto', 'Support Engineer', 'Tokyo', '9383', '2009/08/19', '139,575'],
['Thor Walton', 'Developer', 'New York', '8327', '2013/08/11', '98,540'],
['Finn Camacho', 'Support Engineer', 'San Francisco', '2927', '2009/07/07', '87,500'],
['Serge Baldwin', 'Data Coordinator', 'Singapore', '8352', '2012/04/09', '138,575'],
['Zenaida Frank', 'Software Engineer', 'New York', '7439', '2010/01/04', '125,250'],
['Zorita Serrano', 'Software Engineer', 'San Francisco', '4389', '2012/06/01', '115,000'],
['Jennifer Acosta', 'Junior Javascript Developer', 'Edinburgh', '3431', '2013/02/01', '75,650'],
['Cara Stevens', 'Sales Assistant', 'New York', '3990', '2011/12/06', '145,600'],
['Hermione Butler', 'Regional Director', 'London', '1016', '2011/03/21', '356,250'],
['Lael Greer', 'Systems Administrator', 'London', '6733', '2009/02/27', '103,500'],
['Jonas Alexander', 'Developer', 'San Francisco', '8196', '2010/07/14', '86,500'],
['Shad Decker', 'Regional Director', 'Edinburgh', '6373', '2008/11/13', '183,000'],
['Michael Bruce', 'Javascript Developer', 'Singapore', '5384', '2011/06/27', '183,000'],
['Donna Snider', 'Customer Support', 'New York', '4226', '2011/01/25', '112,000']
['Tiger Nixon', 'System Architect', 'Edinburgh', 5421, '2011/04/25', '320,800'],
['Garrett Winters', 'Accountant', 'Tokyo', 8422, '2011/07/25', '170,750'],
['Ashton Cox', 'Junior Technical Author', 'San Francisco', 1562, '2009/01/12', '86,000'],
['Cedric Kelly', 'Senior Javascript Developer', 'Edinburgh', 6224, '2012/03/29', '433,060'],
['Airi Satou', 'Accountant', 'Tokyo', 5407, '2008/11/28', '162,700'],
['Brielle Williamson', 'Integration Specialist', 'New York', 4804, '2012/12/02', '372,000'],
['Herrod Chandler', 'Sales Assistant', 'San Francisco', 9608, '2012/08/06', '137,500'],
['Rhona Davidson', 'Integration Specialist', 'Tokyo', 6200, '2010/10/14', '327,900'],
['Colleen Hurst', 'Javascript Developer', 'San Francisco', 2360, '2009/09/15', '205,500'],
['Sonya Frost', 'Software Engineer', 'Edinburgh', 1667, '2008/12/13', '103,600'],
['Jena Gaines', 'Office Manager', 'London', 3814, '2008/12/19', '90,560'],
['Quinn Flynn', 'Support Lead', 'Edinburgh', 9497, '2013/03/03', '342,000'],
['Charde Marshall', 'Regional Director', 'San Francisco', 6741, '2008/10/16', '470,600'],
['Haley Kennedy', 'Senior Marketing Designer', 'London', 3597, '2012/12/18', '313,500'],
['Tatyana Fitzpatrick', 'Regional Director', 'London', 1965, '2010/03/17', '385,750'],
['Michael Silva', 'Marketing Designer', 'London', 1581, '2012/11/27', '198,500'],
['Paul Byrd', 'Chief Financial Officer (CFO)', 'New York', 3059, '2010/06/09', '725,000'],
['Gloria Little', 'Systems Administrator', 'New York', 1721, '2009/04/10', '237,500'],
['Bradley Greer', 'Software Engineer', 'London', 2558, '2012/10/13', '132,000'],
['Dai Rios', 'Personnel Lead', 'Edinburgh', 2290, '2012/09/26', '217,500'],
['Jenette Caldwell', 'Development Lead', 'New York', 1937, '2011/09/03', '345,000'],
['Yuri Berry', 'Chief Marketing Officer (CMO)', 'New York', 6154, '2009/06/25', '675,000'],
['Caesar Vance', 'Pre-Sales Support', 'New York', 8330, '2011/12/12', '106,450'],
['Doris Wilder', 'Sales Assistant', 'Sidney', 3023, '2010/09/20', '85,600'],
['Angelica Ramos', 'Chief Executive Officer (CEO)', 'London', 5797, '2009/10/09', '1,200,000'],
['Gavin Joyce', 'Developer', 'Edinburgh', 8822, '2010/12/22', '92,575'],
['Jennifer Chang', 'Regional Director', 'Singapore', 9239, '2010/11/14', '357,650'],
['Brenden Wagner', 'Software Engineer', 'San Francisco', 1314, '2011/06/07', '206,850'],
['Fiona Green', 'Chief Operating Officer (COO)', 'San Francisco', 2947, '2010/03/11', '850,000'],
['Shou Itou', 'Regional Marketing', 'Tokyo', 8899, '2011/08/14', '163,000'],
['Michelle House', 'Integration Specialist', 'Sidney', 2769, '2011/06/02', '95,400'],
['Suki Burks', 'Developer', 'London', 6832, '2009/10/22', '114,500'],
['Prescott Bartlett', 'Technical Author', 'London', 3606, '2011/05/07', '145,000'],
['Gavin Cortez', 'Team Leader', 'San Francisco', 2860, '2008/10/26', '235,500'],
['Martena Mccray', 'Post-Sales support', 'Edinburgh', 8240, '2011/03/09', '324,050'],
['Unity Butler', 'Marketing Designer', 'San Francisco', 5384, '2009/12/09', '85,675'],
['Howard Hatfield', 'Office Manager', 'San Francisco', 7031, '2008/12/16', '164,500'],
['Hope Fuentes', 'Secretary', 'San Francisco', 6318, '2010/02/12', '109,850'],
['Vivian Harrell', 'Financial Controller', 'San Francisco', 9422, '2009/02/14', '452,500'],
['Timothy Mooney', 'Office Manager', 'London', 7580, '2008/12/11', '136,200'],
['Jackson Bradshaw', 'Director', 'New York', 1042, '2008/09/26', '645,750'],
['Olivia Liang', 'Support Engineer', 'Singapore', 2120, '2011/02/03', '234,500'],
['Bruno Nash', 'Software Engineer', 'London', 6222, '2011/05/03', '163,500'],
['Sakura Yamamoto', 'Support Engineer', 'Tokyo', 9383, '2009/08/19', '139,575'],
['Thor Walton', 'Developer', 'New York', 8327, '2013/08/11', '98,540'],
['Finn Camacho', 'Support Engineer', 'San Francisco', 2927, '2009/07/07', '87,500'],
['Serge Baldwin', 'Data Coordinator', 'Singapore', 8352, '2012/04/09', '138,575'],
['Zenaida Frank', 'Software Engineer', 'New York', 7439, '2010/01/04', '125,250'],
['Zorita Serrano', 'Software Engineer', 'San Francisco', 4389, '2012/06/01', '115,000'],
['Jennifer Acosta', 'Junior Javascript Developer', 'Edinburgh', 3431, '2013/02/01', '75,650'],
['Cara Stevens', 'Sales Assistant', 'New York', 3990, '2011/12/06', '145,600'],
['Hermione Butler', 'Regional Director', 'London', 1016, '2011/03/21', '356,250'],
['Lael Greer', 'Systems Administrator', 'London', 6733, '2009/02/27', '103,500'],
['Jonas Alexander', 'Developer', 'San Francisco', 8196, '2010/07/14', '86,500'],
['Shad Decker', 'Regional Director', 'Edinburgh', 6373, '2008/11/13', '183,000'],
['Michael Bruce', 'Javascript Developer', 'Singapore', 5384, '2011/06/27', '183,000'],
['Donna Snider', 'Customer Support', 'New York', 4226, '2011/01/25', '112,000']
];
if (multiplier) {