code stringlengths 24 2.07M | docstring stringlengths 25 85.3k | func_name stringlengths 1 92 | language stringclasses 1
value | repo stringlengths 5 64 | path stringlengths 4 172 | url stringlengths 44 218 | license stringclasses 7
values |
|---|---|---|---|---|---|---|---|
updateFormulaChain = function(x, y, records) {
const obj = this;
const cellId = getColumnNameFromId([x, y]);
if (obj.formula[cellId] && obj.formula[cellId].length > 0) {
if (chainLoopProtection[cellId]) {
obj.records[y][x].element.innerHTML = '#ERROR';
obj.formula[cellId] = ... | Update all related cells in the chain | updateFormulaChain | javascript | jspreadsheet/ce | src/utils/internal.js | https://github.com/jspreadsheet/ce/blob/master/src/utils/internal.js | MIT |
updateFormulaChain = function(x, y, records) {
const obj = this;
const cellId = getColumnNameFromId([x, y]);
if (obj.formula[cellId] && obj.formula[cellId].length > 0) {
if (chainLoopProtection[cellId]) {
obj.records[y][x].element.innerHTML = '#ERROR';
obj.formula[cellId] = ... | Update all related cells in the chain | updateFormulaChain | javascript | jspreadsheet/ce | src/utils/internal.js | https://github.com/jspreadsheet/ce/blob/master/src/utils/internal.js | MIT |
updateScroll = function(direction) {
const obj = this;
// Jspreadsheet Container information
const contentRect = obj.content.getBoundingClientRect();
const x1 = contentRect.left;
const y1 = contentRect.top;
const w1 = contentRect.width;
const h1 = contentRect.height;
// Direction Left ... | Update scroll position based on the selection | updateScroll | javascript | jspreadsheet/ce | src/utils/internal.js | https://github.com/jspreadsheet/ce/blob/master/src/utils/internal.js | MIT |
updateScroll = function(direction) {
const obj = this;
// Jspreadsheet Container information
const contentRect = obj.content.getBoundingClientRect();
const x1 = contentRect.left;
const y1 = contentRect.top;
const w1 = contentRect.width;
const h1 = contentRect.height;
// Direction Left ... | Update scroll position based on the selection | updateScroll | javascript | jspreadsheet/ce | src/utils/internal.js | https://github.com/jspreadsheet/ce/blob/master/src/utils/internal.js | MIT |
updateResult = function() {
const obj = this;
let total = 0;
let index = 0;
// Page 1
if (obj.options.lazyLoading == true) {
total = 100;
} else if (obj.options.pagination > 0) {
total = obj.options.pagination;
} else {
if (obj.results) {
total = obj.res... | Update scroll position based on the selection | updateResult | javascript | jspreadsheet/ce | src/utils/internal.js | https://github.com/jspreadsheet/ce/blob/master/src/utils/internal.js | MIT |
updateResult = function() {
const obj = this;
let total = 0;
let index = 0;
// Page 1
if (obj.options.lazyLoading == true) {
total = 100;
} else if (obj.options.pagination > 0) {
total = obj.options.pagination;
} else {
if (obj.results) {
total = obj.res... | Update scroll position based on the selection | updateResult | javascript | jspreadsheet/ce | src/utils/internal.js | https://github.com/jspreadsheet/ce/blob/master/src/utils/internal.js | MIT |
getCell = function(x, y) {
const obj = this;
if (typeof x === 'string') {
// Convert in case name is excel liked ex. A10, BB92
const cell = getIdFromColumnName(x, true);
x = cell[0];
y = cell[1];
}
return obj.records[y][x].element;
} | Get the cell object
@param object cell
@return string value | getCell | javascript | jspreadsheet/ce | src/utils/internal.js | https://github.com/jspreadsheet/ce/blob/master/src/utils/internal.js | MIT |
getCell = function(x, y) {
const obj = this;
if (typeof x === 'string') {
// Convert in case name is excel liked ex. A10, BB92
const cell = getIdFromColumnName(x, true);
x = cell[0];
y = cell[1];
}
return obj.records[y][x].element;
} | Get the cell object
@param object cell
@return string value | getCell | javascript | jspreadsheet/ce | src/utils/internal.js | https://github.com/jspreadsheet/ce/blob/master/src/utils/internal.js | MIT |
getCellFromCoords = function(x, y) {
const obj = this;
return obj.records[y][x].element;
} | Get the cell object from coords
@param object cell
@return string value | getCellFromCoords | javascript | jspreadsheet/ce | src/utils/internal.js | https://github.com/jspreadsheet/ce/blob/master/src/utils/internal.js | MIT |
getCellFromCoords = function(x, y) {
const obj = this;
return obj.records[y][x].element;
} | Get the cell object from coords
@param object cell
@return string value | getCellFromCoords | javascript | jspreadsheet/ce | src/utils/internal.js | https://github.com/jspreadsheet/ce/blob/master/src/utils/internal.js | MIT |
getLabel = function(x, y) {
const obj = this;
if (typeof x === 'string') {
// Convert in case name is excel liked ex. A10, BB92
const cell = getIdFromColumnName(x, true);
x = cell[0];
y = cell[1];
}
return obj.records[y][x].element.innerHTML;
} | Get label
@param object cell
@return string value | getLabel | javascript | jspreadsheet/ce | src/utils/internal.js | https://github.com/jspreadsheet/ce/blob/master/src/utils/internal.js | MIT |
getLabel = function(x, y) {
const obj = this;
if (typeof x === 'string') {
// Convert in case name is excel liked ex. A10, BB92
const cell = getIdFromColumnName(x, true);
x = cell[0];
y = cell[1];
}
return obj.records[y][x].element.innerHTML;
} | Get label
@param object cell
@return string value | getLabel | javascript | jspreadsheet/ce | src/utils/internal.js | https://github.com/jspreadsheet/ce/blob/master/src/utils/internal.js | MIT |
fullscreen = function(activate) {
const spreadsheet = this;
// If activate not defined, get reverse options.fullscreen
if (activate == null) {
activate = ! spreadsheet.config.fullscreen;
}
// If change
if (spreadsheet.config.fullscreen != activate) {
spreadsheet.config.fullscre... | Activate/Disable fullscreen
use programmatically : table.fullscreen(); or table.fullscreen(true); or table.fullscreen(false);
@Param {boolean} activate | fullscreen | javascript | jspreadsheet/ce | src/utils/internal.js | https://github.com/jspreadsheet/ce/blob/master/src/utils/internal.js | MIT |
fullscreen = function(activate) {
const spreadsheet = this;
// If activate not defined, get reverse options.fullscreen
if (activate == null) {
activate = ! spreadsheet.config.fullscreen;
}
// If change
if (spreadsheet.config.fullscreen != activate) {
spreadsheet.config.fullscre... | Activate/Disable fullscreen
use programmatically : table.fullscreen(); or table.fullscreen(true); or table.fullscreen(false);
@Param {boolean} activate | fullscreen | javascript | jspreadsheet/ce | src/utils/internal.js | https://github.com/jspreadsheet/ce/blob/master/src/utils/internal.js | MIT |
getIdFromColumnName = function (id, arr) {
// Get the letters
const t = /^[a-zA-Z]+/.exec(id);
if (t) {
// Base 26 calculation
let code = 0;
for (let i = 0; i < t[0].length; i++) {
code += parseInt(t[0].charCodeAt(i) - 64) * Math.pow(26, (t[0].length - 1 - i));
}... | Convert excel like column to jss id
@param string id
@return string id | getIdFromColumnName | javascript | jspreadsheet/ce | src/utils/internalHelpers.js | https://github.com/jspreadsheet/ce/blob/master/src/utils/internalHelpers.js | MIT |
getIdFromColumnName = function (id, arr) {
// Get the letters
const t = /^[a-zA-Z]+/.exec(id);
if (t) {
// Base 26 calculation
let code = 0;
for (let i = 0; i < t[0].length; i++) {
code += parseInt(t[0].charCodeAt(i) - 64) * Math.pow(26, (t[0].length - 1 - i));
}... | Convert excel like column to jss id
@param string id
@return string id | getIdFromColumnName | javascript | jspreadsheet/ce | src/utils/internalHelpers.js | https://github.com/jspreadsheet/ce/blob/master/src/utils/internalHelpers.js | MIT |
getColumnNameFromId = function (cellId) {
if (! Array.isArray(cellId)) {
cellId = cellId.split('-');
}
return getColumnName(parseInt(cellId[0])) + (parseInt(cellId[1]) + 1);
} | Convert jss id to excel like column name
@param string id
@return string id | getColumnNameFromId | javascript | jspreadsheet/ce | src/utils/internalHelpers.js | https://github.com/jspreadsheet/ce/blob/master/src/utils/internalHelpers.js | MIT |
getColumnNameFromId = function (cellId) {
if (! Array.isArray(cellId)) {
cellId = cellId.split('-');
}
return getColumnName(parseInt(cellId[0])) + (parseInt(cellId[1]) + 1);
} | Convert jss id to excel like column name
@param string id
@return string id | getColumnNameFromId | javascript | jspreadsheet/ce | src/utils/internalHelpers.js | https://github.com/jspreadsheet/ce/blob/master/src/utils/internalHelpers.js | MIT |
getMerge = function(cellName) {
const obj = this;
let data = {};
if (cellName) {
if (obj.options.mergeCells && obj.options.mergeCells[cellName]) {
data = [ obj.options.mergeCells[cellName][0], obj.options.mergeCells[cellName][1] ];
} else {
data = null;
}
... | Merge cells
@param cellName
@param colspan
@param rowspan
@param ignoreHistoryAndEvents | getMerge | javascript | jspreadsheet/ce | src/utils/merges.js | https://github.com/jspreadsheet/ce/blob/master/src/utils/merges.js | MIT |
getMerge = function(cellName) {
const obj = this;
let data = {};
if (cellName) {
if (obj.options.mergeCells && obj.options.mergeCells[cellName]) {
data = [ obj.options.mergeCells[cellName][0], obj.options.mergeCells[cellName][1] ];
} else {
data = null;
}
... | Merge cells
@param cellName
@param colspan
@param rowspan
@param ignoreHistoryAndEvents | getMerge | javascript | jspreadsheet/ce | src/utils/merges.js | https://github.com/jspreadsheet/ce/blob/master/src/utils/merges.js | MIT |
setMerge = function(cellName, colspan, rowspan, ignoreHistoryAndEvents) {
const obj = this;
let test = false;
if (! cellName) {
if (! obj.highlighted.length) {
alert(jSuites.translate('No cells selected'));
return null;
} else {
const x1 = parseInt(obj.h... | Merge cells
@param cellName
@param colspan
@param rowspan
@param ignoreHistoryAndEvents | setMerge | javascript | jspreadsheet/ce | src/utils/merges.js | https://github.com/jspreadsheet/ce/blob/master/src/utils/merges.js | MIT |
setMerge = function(cellName, colspan, rowspan, ignoreHistoryAndEvents) {
const obj = this;
let test = false;
if (! cellName) {
if (! obj.highlighted.length) {
alert(jSuites.translate('No cells selected'));
return null;
} else {
const x1 = parseInt(obj.h... | Merge cells
@param cellName
@param colspan
@param rowspan
@param ignoreHistoryAndEvents | setMerge | javascript | jspreadsheet/ce | src/utils/merges.js | https://github.com/jspreadsheet/ce/blob/master/src/utils/merges.js | MIT |
removeMerge = function(cellName, data, keepOptions) {
const obj = this;
if (obj.options.mergeCells && obj.options.mergeCells[cellName]) {
const cell = getIdFromColumnName(cellName, true);
obj.records[cell[1]][cell[0]].element.removeAttribute('colspan');
obj.records[cell[1]][cell[0]].ele... | Remove merge by cellname
@param cellName | removeMerge | javascript | jspreadsheet/ce | src/utils/merges.js | https://github.com/jspreadsheet/ce/blob/master/src/utils/merges.js | MIT |
removeMerge = function(cellName, data, keepOptions) {
const obj = this;
if (obj.options.mergeCells && obj.options.mergeCells[cellName]) {
const cell = getIdFromColumnName(cellName, true);
obj.records[cell[1]][cell[0]].element.removeAttribute('colspan');
obj.records[cell[1]][cell[0]].ele... | Remove merge by cellname
@param cellName | removeMerge | javascript | jspreadsheet/ce | src/utils/merges.js | https://github.com/jspreadsheet/ce/blob/master/src/utils/merges.js | MIT |
getMeta = function(cell, key) {
const obj = this;
if (! cell) {
return obj.options.meta;
} else {
if (key) {
return obj.options.meta && obj.options.meta[cell] && obj.options.meta[cell][key] ? obj.options.meta[cell][key] : null;
} else {
return obj.options.met... | Get meta information from cell(s)
@return integer | getMeta | javascript | jspreadsheet/ce | src/utils/meta.js | https://github.com/jspreadsheet/ce/blob/master/src/utils/meta.js | MIT |
getMeta = function(cell, key) {
const obj = this;
if (! cell) {
return obj.options.meta;
} else {
if (key) {
return obj.options.meta && obj.options.meta[cell] && obj.options.meta[cell][key] ? obj.options.meta[cell][key] : null;
} else {
return obj.options.met... | Get meta information from cell(s)
@return integer | getMeta | javascript | jspreadsheet/ce | src/utils/meta.js | https://github.com/jspreadsheet/ce/blob/master/src/utils/meta.js | MIT |
setMeta = function(o, k, v) {
const obj = this;
if (! obj.options.meta) {
obj.options.meta = {}
}
if (k && v) {
// Set data value
if (! obj.options.meta[o]) {
obj.options.meta[o] = {};
}
obj.options.meta[o][k] = v;
dispatch.call(obj, 'onchan... | Set meta information to cell(s)
@return integer | setMeta | javascript | jspreadsheet/ce | src/utils/meta.js | https://github.com/jspreadsheet/ce/blob/master/src/utils/meta.js | MIT |
setMeta = function(o, k, v) {
const obj = this;
if (! obj.options.meta) {
obj.options.meta = {}
}
if (k && v) {
// Set data value
if (! obj.options.meta[o]) {
obj.options.meta[o] = {};
}
obj.options.meta[o][k] = v;
dispatch.call(obj, 'onchan... | Set meta information to cell(s)
@return integer | setMeta | javascript | jspreadsheet/ce | src/utils/meta.js | https://github.com/jspreadsheet/ce/blob/master/src/utils/meta.js | MIT |
insertRow = function(mixed, rowNumber, insertBefore) {
const obj = this;
// Configuration
if (obj.options.allowInsertRow != false) {
// Records
var records = [];
// Data to be insert
let data = [];
// The insert could be lead by number of rows or the array of data
... | Insert a new row
@param mixed - number of blank lines to be insert or a single array with the data of the new row
@param rowNumber
@param insertBefore
@return void | insertRow | javascript | jspreadsheet/ce | src/utils/rows.js | https://github.com/jspreadsheet/ce/blob/master/src/utils/rows.js | MIT |
insertRow = function(mixed, rowNumber, insertBefore) {
const obj = this;
// Configuration
if (obj.options.allowInsertRow != false) {
// Records
var records = [];
// Data to be insert
let data = [];
// The insert could be lead by number of rows or the array of data
... | Insert a new row
@param mixed - number of blank lines to be insert or a single array with the data of the new row
@param rowNumber
@param insertBefore
@return void | insertRow | javascript | jspreadsheet/ce | src/utils/rows.js | https://github.com/jspreadsheet/ce/blob/master/src/utils/rows.js | MIT |
deleteRow = function(rowNumber, numOfRows) {
const obj = this;
// Global Configuration
if (obj.options.allowDeleteRow != false) {
if (obj.options.allowDeletingAllRows == true || obj.options.data.length > 1) {
// Delete row definitions
if (rowNumber == undefined) {
... | Delete a row by number
@param integer rowNumber - row number to be excluded
@param integer numOfRows - number of lines
@return void | deleteRow | javascript | jspreadsheet/ce | src/utils/rows.js | https://github.com/jspreadsheet/ce/blob/master/src/utils/rows.js | MIT |
deleteRow = function(rowNumber, numOfRows) {
const obj = this;
// Global Configuration
if (obj.options.allowDeleteRow != false) {
if (obj.options.allowDeletingAllRows == true || obj.options.data.length > 1) {
// Delete row definitions
if (rowNumber == undefined) {
... | Delete a row by number
@param integer rowNumber - row number to be excluded
@param integer numOfRows - number of lines
@return void | deleteRow | javascript | jspreadsheet/ce | src/utils/rows.js | https://github.com/jspreadsheet/ce/blob/master/src/utils/rows.js | MIT |
getHeight = function(row) {
const obj = this;
let data;
if (typeof row === 'undefined') {
// Get height of all rows
data = [];
for (let j = 0; j < obj.rows.length; j++) {
const h = obj.rows[j].element.style.height;
if (h) {
data[j] = h;
... | Get the row height
@param row - row number (first row is: 0)
@return height - current row height | getHeight | javascript | jspreadsheet/ce | src/utils/rows.js | https://github.com/jspreadsheet/ce/blob/master/src/utils/rows.js | MIT |
getHeight = function(row) {
const obj = this;
let data;
if (typeof row === 'undefined') {
// Get height of all rows
data = [];
for (let j = 0; j < obj.rows.length; j++) {
const h = obj.rows[j].element.style.height;
if (h) {
data[j] = h;
... | Get the row height
@param row - row number (first row is: 0)
@return height - current row height | getHeight | javascript | jspreadsheet/ce | src/utils/rows.js | https://github.com/jspreadsheet/ce/blob/master/src/utils/rows.js | MIT |
setHeight = function (row, height, oldHeight) {
const obj = this;
if (height > 0) {
// Oldwidth
if (! oldHeight) {
oldHeight = obj.rows[row].element.getAttribute('height');
if (! oldHeight) {
const rect = obj.rows[row].element.getBoundingClientRect();
... | Set the row height
@param row - row number (first row is: 0)
@param height - new row height
@param oldHeight - old row height | setHeight | javascript | jspreadsheet/ce | src/utils/rows.js | https://github.com/jspreadsheet/ce/blob/master/src/utils/rows.js | MIT |
setHeight = function (row, height, oldHeight) {
const obj = this;
if (height > 0) {
// Oldwidth
if (! oldHeight) {
oldHeight = obj.rows[row].element.getAttribute('height');
if (! oldHeight) {
const rect = obj.rows[row].element.getBoundingClientRect();
... | Set the row height
@param row - row number (first row is: 0)
@param height - new row height
@param oldHeight - old row height | setHeight | javascript | jspreadsheet/ce | src/utils/rows.js | https://github.com/jspreadsheet/ce/blob/master/src/utils/rows.js | MIT |
updateSelection = function(el1, el2, origin) {
const obj = this;
const x1 = el1.getAttribute('data-x');
const y1 = el1.getAttribute('data-y');
let x2, y2;
if (el2) {
x2 = el2.getAttribute('data-x');
y2 = el2.getAttribute('data-y');
} else {
x2 = x1;
y2 = y1;
... | Update selection based on two cells | updateSelection | javascript | jspreadsheet/ce | src/utils/selection.js | https://github.com/jspreadsheet/ce/blob/master/src/utils/selection.js | MIT |
updateSelection = function(el1, el2, origin) {
const obj = this;
const x1 = el1.getAttribute('data-x');
const y1 = el1.getAttribute('data-y');
let x2, y2;
if (el2) {
x2 = el2.getAttribute('data-x');
y2 = el2.getAttribute('data-y');
} else {
x2 = x1;
y2 = y1;
... | Update selection based on two cells | updateSelection | javascript | jspreadsheet/ce | src/utils/selection.js | https://github.com/jspreadsheet/ce/blob/master/src/utils/selection.js | MIT |
removeCopyingSelection = function() {
const copying = document.querySelectorAll('.jss_worksheet .copying');
for (let i = 0; i < copying.length; i++) {
copying[i].classList.remove('copying');
copying[i].classList.remove('copying-left');
copying[i].classList.remove('copying-right');
... | Update selection based on two cells | removeCopyingSelection | javascript | jspreadsheet/ce | src/utils/selection.js | https://github.com/jspreadsheet/ce/blob/master/src/utils/selection.js | MIT |
removeCopyingSelection = function() {
const copying = document.querySelectorAll('.jss_worksheet .copying');
for (let i = 0; i < copying.length; i++) {
copying[i].classList.remove('copying');
copying[i].classList.remove('copying-left');
copying[i].classList.remove('copying-right');
... | Update selection based on two cells | removeCopyingSelection | javascript | jspreadsheet/ce | src/utils/selection.js | https://github.com/jspreadsheet/ce/blob/master/src/utils/selection.js | MIT |
updateSelectionFromCoords = function(x1, y1, x2, y2, origin) {
const obj = this;
// select column
if (y1 == null) {
y1 = 0;
y2 = obj.rows.length - 1;
if (x1 == null) {
return;
}
} else if (x1 == null) {
// select row
x1 = 0;
x2 = obj.... | Update selection based on two cells | updateSelectionFromCoords | javascript | jspreadsheet/ce | src/utils/selection.js | https://github.com/jspreadsheet/ce/blob/master/src/utils/selection.js | MIT |
updateSelectionFromCoords = function(x1, y1, x2, y2, origin) {
const obj = this;
// select column
if (y1 == null) {
y1 = 0;
y2 = obj.rows.length - 1;
if (x1 == null) {
return;
}
} else if (x1 == null) {
// select row
x1 = 0;
x2 = obj.... | Update selection based on two cells | updateSelectionFromCoords | javascript | jspreadsheet/ce | src/utils/selection.js | https://github.com/jspreadsheet/ce/blob/master/src/utils/selection.js | MIT |
getSelectedColumns = function(visibleOnly) {
const obj = this;
if (!obj.selectedCell) {
return [];
}
const result = [];
for (let i = Math.min(obj.selectedCell[0], obj.selectedCell[2]); i <= Math.max(obj.selectedCell[0], obj.selectedCell[2]); i++) {
if (!visibleOnly || obj.headers[... | Get selected column numbers
@return array | getSelectedColumns | javascript | jspreadsheet/ce | src/utils/selection.js | https://github.com/jspreadsheet/ce/blob/master/src/utils/selection.js | MIT |
getSelectedColumns = function(visibleOnly) {
const obj = this;
if (!obj.selectedCell) {
return [];
}
const result = [];
for (let i = Math.min(obj.selectedCell[0], obj.selectedCell[2]); i <= Math.max(obj.selectedCell[0], obj.selectedCell[2]); i++) {
if (!visibleOnly || obj.headers[... | Get selected column numbers
@return array | getSelectedColumns | javascript | jspreadsheet/ce | src/utils/selection.js | https://github.com/jspreadsheet/ce/blob/master/src/utils/selection.js | MIT |
copyData = function(o, d) {
const obj = this;
// Get data from all selected cells
const data = obj.getData(true, false);
// Selected cells
const h = obj.selectedContainer;
// Cells
const x1 = parseInt(o.getAttribute('data-x'));
const y1 = parseInt(o.getAttribute('data-y'));
const ... | Helper function to copy data using the corner icon | copyData | javascript | jspreadsheet/ce | src/utils/selection.js | https://github.com/jspreadsheet/ce/blob/master/src/utils/selection.js | MIT |
copyData = function(o, d) {
const obj = this;
// Get data from all selected cells
const data = obj.getData(true, false);
// Selected cells
const h = obj.selectedContainer;
// Cells
const x1 = parseInt(o.getAttribute('data-x'));
const y1 = parseInt(o.getAttribute('data-y'));
const ... | Helper function to copy data using the corner icon | copyData | javascript | jspreadsheet/ce | src/utils/selection.js | https://github.com/jspreadsheet/ce/blob/master/src/utils/selection.js | MIT |
hash = function(str) {
let hash = 0, i, chr;
if (!str || str.length === 0) {
return hash;
} else {
for (i = 0; i < str.length; i++) {
chr = str.charCodeAt(i);
hash = ((hash << 5) - hash) + chr;
hash |= 0;
}
}
return hash;
} | Helper function to copy data using the corner icon | hash | javascript | jspreadsheet/ce | src/utils/selection.js | https://github.com/jspreadsheet/ce/blob/master/src/utils/selection.js | MIT |
hash = function(str) {
let hash = 0, i, chr;
if (!str || str.length === 0) {
return hash;
} else {
for (i = 0; i < str.length; i++) {
chr = str.charCodeAt(i);
hash = ((hash << 5) - hash) + chr;
hash |= 0;
}
}
return hash;
} | Helper function to copy data using the corner icon | hash | javascript | jspreadsheet/ce | src/utils/selection.js | https://github.com/jspreadsheet/ce/blob/master/src/utils/selection.js | MIT |
conditionalSelectionUpdate = function(type, o, d) {
const obj = this;
if (type == 1) {
if (obj.selectedCell && ((o >= obj.selectedCell[1] && o <= obj.selectedCell[3]) || (d >= obj.selectedCell[1] && d <= obj.selectedCell[3]))) {
obj.resetSelection();
return;
}
} else... | Move coords to A1 in case overlaps with an excluded cell | conditionalSelectionUpdate | javascript | jspreadsheet/ce | src/utils/selection.js | https://github.com/jspreadsheet/ce/blob/master/src/utils/selection.js | MIT |
conditionalSelectionUpdate = function(type, o, d) {
const obj = this;
if (type == 1) {
if (obj.selectedCell && ((o >= obj.selectedCell[1] && o <= obj.selectedCell[3]) || (d >= obj.selectedCell[1] && d <= obj.selectedCell[3]))) {
obj.resetSelection();
return;
}
} else... | Move coords to A1 in case overlaps with an excluded cell | conditionalSelectionUpdate | javascript | jspreadsheet/ce | src/utils/selection.js | https://github.com/jspreadsheet/ce/blob/master/src/utils/selection.js | MIT |
getSelectedRows = function(visibleOnly) {
const obj = this;
if (!obj.selectedCell) {
return [];
}
const result = [];
for (let i = Math.min(obj.selectedCell[1], obj.selectedCell[3]); i <= Math.max(obj.selectedCell[1], obj.selectedCell[3]); i++) {
if (!visibleOnly || obj.rows[i].ele... | Get selected rows numbers
@return array | getSelectedRows | javascript | jspreadsheet/ce | src/utils/selection.js | https://github.com/jspreadsheet/ce/blob/master/src/utils/selection.js | MIT |
getSelectedRows = function(visibleOnly) {
const obj = this;
if (!obj.selectedCell) {
return [];
}
const result = [];
for (let i = Math.min(obj.selectedCell[1], obj.selectedCell[3]); i <= Math.max(obj.selectedCell[1], obj.selectedCell[3]); i++) {
if (!visibleOnly || obj.rows[i].ele... | Get selected rows numbers
@return array | getSelectedRows | javascript | jspreadsheet/ce | src/utils/selection.js | https://github.com/jspreadsheet/ce/blob/master/src/utils/selection.js | MIT |
selectAll = function() {
const obj = this;
if (! obj.selectedCell) {
obj.selectedCell = [];
}
obj.selectedCell[0] = 0;
obj.selectedCell[1] = 0;
obj.selectedCell[2] = obj.headers.length - 1;
obj.selectedCell[3] = obj.records.length - 1;
obj.updateSelectionFromCoords(obj.selecte... | Get selected rows numbers
@return array | selectAll | javascript | jspreadsheet/ce | src/utils/selection.js | https://github.com/jspreadsheet/ce/blob/master/src/utils/selection.js | MIT |
selectAll = function() {
const obj = this;
if (! obj.selectedCell) {
obj.selectedCell = [];
}
obj.selectedCell[0] = 0;
obj.selectedCell[1] = 0;
obj.selectedCell[2] = obj.headers.length - 1;
obj.selectedCell[3] = obj.records.length - 1;
obj.updateSelectionFromCoords(obj.selecte... | Get selected rows numbers
@return array | selectAll | javascript | jspreadsheet/ce | src/utils/selection.js | https://github.com/jspreadsheet/ce/blob/master/src/utils/selection.js | MIT |
getSelection = function() {
const obj = this;
if (!obj.selectedCell) {
return null;
}
return [
Math.min(obj.selectedCell[0], obj.selectedCell[2]),
Math.min(obj.selectedCell[1], obj.selectedCell[3]),
Math.max(obj.selectedCell[0], obj.selectedCell[2]),
Math.max(ob... | Get selected rows numbers
@return array | getSelection | javascript | jspreadsheet/ce | src/utils/selection.js | https://github.com/jspreadsheet/ce/blob/master/src/utils/selection.js | MIT |
getSelection = function() {
const obj = this;
if (!obj.selectedCell) {
return null;
}
return [
Math.min(obj.selectedCell[0], obj.selectedCell[2]),
Math.min(obj.selectedCell[1], obj.selectedCell[3]),
Math.max(obj.selectedCell[0], obj.selectedCell[2]),
Math.max(ob... | Get selected rows numbers
@return array | getSelection | javascript | jspreadsheet/ce | src/utils/selection.js | https://github.com/jspreadsheet/ce/blob/master/src/utils/selection.js | MIT |
getSelected = function(columnNameOnly) {
const obj = this;
const selectedRange = getSelection.call(obj);
if (!selectedRange) {
return [];
}
const cells = [];
for (let y = selectedRange[1]; y <= selectedRange[3]; y++) {
for (let x = selectedRange[0]; x <= selectedRange[2]; x++... | Get selected rows numbers
@return array | getSelected | javascript | jspreadsheet/ce | src/utils/selection.js | https://github.com/jspreadsheet/ce/blob/master/src/utils/selection.js | MIT |
getSelected = function(columnNameOnly) {
const obj = this;
const selectedRange = getSelection.call(obj);
if (!selectedRange) {
return [];
}
const cells = [];
for (let y = selectedRange[1]; y <= selectedRange[3]; y++) {
for (let x = selectedRange[0]; x <= selectedRange[2]; x++... | Get selected rows numbers
@return array | getSelected | javascript | jspreadsheet/ce | src/utils/selection.js | https://github.com/jspreadsheet/ce/blob/master/src/utils/selection.js | MIT |
getRange = function() {
const obj = this;
const selectedRange = getSelection.call(obj);
if (!selectedRange) {
return '';
}
const start = getCellNameFromCoords(selectedRange[0], selectedRange[1]);
const end = getCellNameFromCoords(selectedRange[2], selectedRange[3]);
if (start ===... | Get selected rows numbers
@return array | getRange | javascript | jspreadsheet/ce | src/utils/selection.js | https://github.com/jspreadsheet/ce/blob/master/src/utils/selection.js | MIT |
getRange = function() {
const obj = this;
const selectedRange = getSelection.call(obj);
if (!selectedRange) {
return '';
}
const start = getCellNameFromCoords(selectedRange[0], selectedRange[1]);
const end = getCellNameFromCoords(selectedRange[2], selectedRange[3]);
if (start ===... | Get selected rows numbers
@return array | getRange | javascript | jspreadsheet/ce | src/utils/selection.js | https://github.com/jspreadsheet/ce/blob/master/src/utils/selection.js | MIT |
isSelected = function(x, y) {
const obj = this;
const selection = getSelection.call(obj);
return x >= selection[0] && x <= selection[2] && y >= selection[1] && y <= selection[3];
} | Get selected rows numbers
@return array | isSelected | javascript | jspreadsheet/ce | src/utils/selection.js | https://github.com/jspreadsheet/ce/blob/master/src/utils/selection.js | MIT |
isSelected = function(x, y) {
const obj = this;
const selection = getSelection.call(obj);
return x >= selection[0] && x <= selection[2] && y >= selection[1] && y <= selection[3];
} | Get selected rows numbers
@return array | isSelected | javascript | jspreadsheet/ce | src/utils/selection.js | https://github.com/jspreadsheet/ce/blob/master/src/utils/selection.js | MIT |
getHighlighted = function() {
const obj = this;
const selection = getSelection.call(obj);
if (selection) {
return [selection];
}
return [];
} | Get selected rows numbers
@return array | getHighlighted | javascript | jspreadsheet/ce | src/utils/selection.js | https://github.com/jspreadsheet/ce/blob/master/src/utils/selection.js | MIT |
getHighlighted = function() {
const obj = this;
const selection = getSelection.call(obj);
if (selection) {
return [selection];
}
return [];
} | Get selected rows numbers
@return array | getHighlighted | javascript | jspreadsheet/ce | src/utils/selection.js | https://github.com/jspreadsheet/ce/blob/master/src/utils/selection.js | MIT |
getStyle = function(cell, key) {
const obj = this;
// Cell
if (! cell) {
// Control vars
const data = {};
// Column and row length
const x = obj.options.data[0].length;
const y = obj.options.data.length;
// Go through the columns to get the data
for... | Get style information from cell(s)
@return integer | getStyle | javascript | jspreadsheet/ce | src/utils/style.js | https://github.com/jspreadsheet/ce/blob/master/src/utils/style.js | MIT |
getStyle = function(cell, key) {
const obj = this;
// Cell
if (! cell) {
// Control vars
const data = {};
// Column and row length
const x = obj.options.data[0].length;
const y = obj.options.data.length;
// Go through the columns to get the data
for... | Get style information from cell(s)
@return integer | getStyle | javascript | jspreadsheet/ce | src/utils/style.js | https://github.com/jspreadsheet/ce/blob/master/src/utils/style.js | MIT |
setStyle = function(o, k, v, force, ignoreHistoryAndEvents) {
const obj = this;
const newValue = {};
const oldValue = {};
// Apply style
const applyStyle = function(cellId, key, value) {
// Position
const cell = getIdFromColumnName(cellId, true);
if (obj.records[cell[1]] &... | Set meta information to cell(s)
@return integer | setStyle | javascript | jspreadsheet/ce | src/utils/style.js | https://github.com/jspreadsheet/ce/blob/master/src/utils/style.js | MIT |
setStyle = function(o, k, v, force, ignoreHistoryAndEvents) {
const obj = this;
const newValue = {};
const oldValue = {};
// Apply style
const applyStyle = function(cellId, key, value) {
// Position
const cell = getIdFromColumnName(cellId, true);
if (obj.records[cell[1]] &... | Set meta information to cell(s)
@return integer | setStyle | javascript | jspreadsheet/ce | src/utils/style.js | https://github.com/jspreadsheet/ce/blob/master/src/utils/style.js | MIT |
applyStyle = function(cellId, key, value) {
// Position
const cell = getIdFromColumnName(cellId, true);
if (obj.records[cell[1]] && obj.records[cell[1]][cell[0]] && (obj.records[cell[1]][cell[0]].element.classList.contains('readonly')==false || force)) {
// Current value
... | Set meta information to cell(s)
@return integer | applyStyle | javascript | jspreadsheet/ce | src/utils/style.js | https://github.com/jspreadsheet/ce/blob/master/src/utils/style.js | MIT |
applyStyle = function(cellId, key, value) {
// Position
const cell = getIdFromColumnName(cellId, true);
if (obj.records[cell[1]] && obj.records[cell[1]][cell[0]] && (obj.records[cell[1]][cell[0]].element.classList.contains('readonly')==false || force)) {
// Current value
... | Set meta information to cell(s)
@return integer | applyStyle | javascript | jspreadsheet/ce | src/utils/style.js | https://github.com/jspreadsheet/ce/blob/master/src/utils/style.js | MIT |
resetStyle = function(o, ignoreHistoryAndEvents) {
const obj = this;
const keys = Object.keys(o);
for (let i = 0; i < keys.length; i++) {
// Position
const cell = getIdFromColumnName(keys[i], true);
if (obj.records[cell[1]] && obj.records[cell[1]][cell[0]]) {
obj.records... | Set meta information to cell(s)
@return integer | resetStyle | javascript | jspreadsheet/ce | src/utils/style.js | https://github.com/jspreadsheet/ce/blob/master/src/utils/style.js | MIT |
resetStyle = function(o, ignoreHistoryAndEvents) {
const obj = this;
const keys = Object.keys(o);
for (let i = 0; i < keys.length; i++) {
// Position
const cell = getIdFromColumnName(keys[i], true);
if (obj.records[cell[1]] && obj.records[cell[1]][cell[0]]) {
obj.records... | Set meta information to cell(s)
@return integer | resetStyle | javascript | jspreadsheet/ce | src/utils/style.js | https://github.com/jspreadsheet/ce/blob/master/src/utils/style.js | MIT |
prepareTable = function() {
const obj = this;
// Lazy loading
if (obj.options.lazyLoading == true && (obj.options.tableOverflow != true && obj.parent.config.fullscreen != true)) {
console.error('Jspreadsheet: The lazyloading only works when tableOverflow = yes or fullscreen = yes');
obj.opt... | Prepare the jspreadsheet table
@Param config | prepareTable | javascript | jspreadsheet/ce | src/utils/worksheets.js | https://github.com/jspreadsheet/ce/blob/master/src/utils/worksheets.js | MIT |
prepareTable = function() {
const obj = this;
// Lazy loading
if (obj.options.lazyLoading == true && (obj.options.tableOverflow != true && obj.parent.config.fullscreen != true)) {
console.error('Jspreadsheet: The lazyloading only works when tableOverflow = yes or fullscreen = yes');
obj.opt... | Prepare the jspreadsheet table
@Param config | prepareTable | javascript | jspreadsheet/ce | src/utils/worksheets.js | https://github.com/jspreadsheet/ce/blob/master/src/utils/worksheets.js | MIT |
getNextDefaultWorksheetName = function(spreadsheet) {
const defaultWorksheetNameRegex = /^Sheet(\d+)$/;
let largestWorksheetNumber = 0;
spreadsheet.worksheets.forEach(function(worksheet) {
const regexResult = defaultWorksheetNameRegex.exec(worksheet.options.worksheetName);
if (regexResult)... | Prepare the jspreadsheet table
@Param config | getNextDefaultWorksheetName | javascript | jspreadsheet/ce | src/utils/worksheets.js | https://github.com/jspreadsheet/ce/blob/master/src/utils/worksheets.js | MIT |
getNextDefaultWorksheetName = function(spreadsheet) {
const defaultWorksheetNameRegex = /^Sheet(\d+)$/;
let largestWorksheetNumber = 0;
spreadsheet.worksheets.forEach(function(worksheet) {
const regexResult = defaultWorksheetNameRegex.exec(worksheet.options.worksheetName);
if (regexResult)... | Prepare the jspreadsheet table
@Param config | getNextDefaultWorksheetName | javascript | jspreadsheet/ce | src/utils/worksheets.js | https://github.com/jspreadsheet/ce/blob/master/src/utils/worksheets.js | MIT |
buildWorksheet = async function() {
const obj = this;
const el = obj.element;
const spreadsheet = obj.parent;
if (typeof spreadsheet.plugins === 'object') {
Object.entries(spreadsheet.plugins).forEach(function([, plugin]) {
if (typeof plugin.beforeinit === 'function') {
... | Prepare the jspreadsheet table
@Param config | buildWorksheet | javascript | jspreadsheet/ce | src/utils/worksheets.js | https://github.com/jspreadsheet/ce/blob/master/src/utils/worksheets.js | MIT |
buildWorksheet = async function() {
const obj = this;
const el = obj.element;
const spreadsheet = obj.parent;
if (typeof spreadsheet.plugins === 'object') {
Object.entries(spreadsheet.plugins).forEach(function([, plugin]) {
if (typeof plugin.beforeinit === 'function') {
... | Prepare the jspreadsheet table
@Param config | buildWorksheet | javascript | jspreadsheet/ce | src/utils/worksheets.js | https://github.com/jspreadsheet/ce/blob/master/src/utils/worksheets.js | MIT |
createWorksheetObj = function(options) {
const obj = this;
const spreadsheet = obj.parent;
if (!options.worksheetName) {
options.worksheetName = getNextDefaultWorksheetName(obj.parent);
}
const newWorksheet = {
parent: spreadsheet,
options: options,
filters: [],
... | Prepare the jspreadsheet table
@Param config | createWorksheetObj | javascript | jspreadsheet/ce | src/utils/worksheets.js | https://github.com/jspreadsheet/ce/blob/master/src/utils/worksheets.js | MIT |
createWorksheetObj = function(options) {
const obj = this;
const spreadsheet = obj.parent;
if (!options.worksheetName) {
options.worksheetName = getNextDefaultWorksheetName(obj.parent);
}
const newWorksheet = {
parent: spreadsheet,
options: options,
filters: [],
... | Prepare the jspreadsheet table
@Param config | createWorksheetObj | javascript | jspreadsheet/ce | src/utils/worksheets.js | https://github.com/jspreadsheet/ce/blob/master/src/utils/worksheets.js | MIT |
createWorksheet = function(options) {
const obj = this;
const spreadsheet = obj.parent;
spreadsheet.creationThroughJss = true;
createWorksheetObj.call(obj, options);
spreadsheet.element.tabs.create(options.worksheetName);
} | Prepare the jspreadsheet table
@Param config | createWorksheet | javascript | jspreadsheet/ce | src/utils/worksheets.js | https://github.com/jspreadsheet/ce/blob/master/src/utils/worksheets.js | MIT |
createWorksheet = function(options) {
const obj = this;
const spreadsheet = obj.parent;
spreadsheet.creationThroughJss = true;
createWorksheetObj.call(obj, options);
spreadsheet.element.tabs.create(options.worksheetName);
} | Prepare the jspreadsheet table
@Param config | createWorksheet | javascript | jspreadsheet/ce | src/utils/worksheets.js | https://github.com/jspreadsheet/ce/blob/master/src/utils/worksheets.js | MIT |
openWorksheet = function(position) {
const obj = this;
const spreadsheet = obj.parent;
spreadsheet.element.tabs.open(position);
} | Prepare the jspreadsheet table
@Param config | openWorksheet | javascript | jspreadsheet/ce | src/utils/worksheets.js | https://github.com/jspreadsheet/ce/blob/master/src/utils/worksheets.js | MIT |
openWorksheet = function(position) {
const obj = this;
const spreadsheet = obj.parent;
spreadsheet.element.tabs.open(position);
} | Prepare the jspreadsheet table
@Param config | openWorksheet | javascript | jspreadsheet/ce | src/utils/worksheets.js | https://github.com/jspreadsheet/ce/blob/master/src/utils/worksheets.js | MIT |
deleteWorksheet = function(position) {
const obj = this;
obj.parent.element.tabs.remove(position);
const removedWorksheet = obj.parent.worksheets.splice(position, 1)[0];
dispatch.call(obj.parent, 'ondeleteworksheet', removedWorksheet, position);
} | Prepare the jspreadsheet table
@Param config | deleteWorksheet | javascript | jspreadsheet/ce | src/utils/worksheets.js | https://github.com/jspreadsheet/ce/blob/master/src/utils/worksheets.js | MIT |
deleteWorksheet = function(position) {
const obj = this;
obj.parent.element.tabs.remove(position);
const removedWorksheet = obj.parent.worksheets.splice(position, 1)[0];
dispatch.call(obj.parent, 'ondeleteworksheet', removedWorksheet, position);
} | Prepare the jspreadsheet table
@Param config | deleteWorksheet | javascript | jspreadsheet/ce | src/utils/worksheets.js | https://github.com/jspreadsheet/ce/blob/master/src/utils/worksheets.js | MIT |
function toRawType (value) {
return _toString.call(value).slice(8, -1)
} | Get the raw type string of a value e.g. [object Object] | toRawType | javascript | ustbhuangyi/vue-analysis | vue/dist/vue.common.js | https://github.com/ustbhuangyi/vue-analysis/blob/master/vue/dist/vue.common.js | MIT |
function isPlainObject (obj) {
return _toString.call(obj) === '[object Object]'
} | Strict object type check. Only returns true
for plain JavaScript objects. | isPlainObject | javascript | ustbhuangyi/vue-analysis | vue/dist/vue.common.js | https://github.com/ustbhuangyi/vue-analysis/blob/master/vue/dist/vue.common.js | MIT |
function isRegExp (v) {
return _toString.call(v) === '[object RegExp]'
} | Strict object type check. Only returns true
for plain JavaScript objects. | isRegExp | javascript | ustbhuangyi/vue-analysis | vue/dist/vue.common.js | https://github.com/ustbhuangyi/vue-analysis/blob/master/vue/dist/vue.common.js | MIT |
function isValidArrayIndex (val) {
var n = parseFloat(String(val));
return n >= 0 && Math.floor(n) === n && isFinite(val)
} | Check if val is a valid array index. | isValidArrayIndex | javascript | ustbhuangyi/vue-analysis | vue/dist/vue.common.js | https://github.com/ustbhuangyi/vue-analysis/blob/master/vue/dist/vue.common.js | MIT |
function toString (val) {
return val == null
? ''
: typeof val === 'object'
? JSON.stringify(val, null, 2)
: String(val)
} | Convert a value to a string that is actually rendered. | toString | javascript | ustbhuangyi/vue-analysis | vue/dist/vue.common.js | https://github.com/ustbhuangyi/vue-analysis/blob/master/vue/dist/vue.common.js | MIT |
function toNumber (val) {
var n = parseFloat(val);
return isNaN(n) ? val : n
} | Convert a input value to a number for persistence.
If the conversion fails, return original string. | toNumber | javascript | ustbhuangyi/vue-analysis | vue/dist/vue.common.js | https://github.com/ustbhuangyi/vue-analysis/blob/master/vue/dist/vue.common.js | MIT |
function makeMap (
str,
expectsLowerCase
) {
var map = Object.create(null);
var list = str.split(',');
for (var i = 0; i < list.length; i++) {
map[list[i]] = true;
}
return expectsLowerCase
? function (val) { return map[val.toLowerCase()]; }
: function (val) { return map[val]; }
} | Make a map and return a function for checking if a key
is in that map. | makeMap | javascript | ustbhuangyi/vue-analysis | vue/dist/vue.common.js | https://github.com/ustbhuangyi/vue-analysis/blob/master/vue/dist/vue.common.js | MIT |
function remove (arr, item) {
if (arr.length) {
var index = arr.indexOf(item);
if (index > -1) {
return arr.splice(index, 1)
}
}
} | Remove an item from an array | remove | javascript | ustbhuangyi/vue-analysis | vue/dist/vue.common.js | https://github.com/ustbhuangyi/vue-analysis/blob/master/vue/dist/vue.common.js | MIT |
function hasOwn (obj, key) {
return hasOwnProperty.call(obj, key)
} | Check whether the object has the property. | hasOwn | javascript | ustbhuangyi/vue-analysis | vue/dist/vue.common.js | https://github.com/ustbhuangyi/vue-analysis/blob/master/vue/dist/vue.common.js | MIT |
function cached (fn) {
var cache = Object.create(null);
return (function cachedFn (str) {
var hit = cache[str];
return hit || (cache[str] = fn(str))
})
} | Create a cached version of a pure function. | cached | javascript | ustbhuangyi/vue-analysis | vue/dist/vue.common.js | https://github.com/ustbhuangyi/vue-analysis/blob/master/vue/dist/vue.common.js | MIT |
function polyfillBind (fn, ctx) {
function boundFn (a) {
var l = arguments.length;
return l
? l > 1
? fn.apply(ctx, arguments)
: fn.call(ctx, a)
: fn.call(ctx)
}
boundFn._length = fn.length;
return boundFn
} | Simple bind polyfill for environments that do not support it... e.g.
PhantomJS 1.x. Technically we don't need this anymore since native bind is
now more performant in most browsers, but removing it would be breaking for
code that was able to run in PhantomJS 1.x, so this must be kept for
backwards compatibility. | polyfillBind | javascript | ustbhuangyi/vue-analysis | vue/dist/vue.common.js | https://github.com/ustbhuangyi/vue-analysis/blob/master/vue/dist/vue.common.js | MIT |
function boundFn (a) {
var l = arguments.length;
return l
? l > 1
? fn.apply(ctx, arguments)
: fn.call(ctx, a)
: fn.call(ctx)
} | Simple bind polyfill for environments that do not support it... e.g.
PhantomJS 1.x. Technically we don't need this anymore since native bind is
now more performant in most browsers, but removing it would be breaking for
code that was able to run in PhantomJS 1.x, so this must be kept for
backwards compatibility. | boundFn | javascript | ustbhuangyi/vue-analysis | vue/dist/vue.common.js | https://github.com/ustbhuangyi/vue-analysis/blob/master/vue/dist/vue.common.js | MIT |
function nativeBind (fn, ctx) {
return fn.bind(ctx)
} | Simple bind polyfill for environments that do not support it... e.g.
PhantomJS 1.x. Technically we don't need this anymore since native bind is
now more performant in most browsers, but removing it would be breaking for
code that was able to run in PhantomJS 1.x, so this must be kept for
backwards compatibility. | nativeBind | javascript | ustbhuangyi/vue-analysis | vue/dist/vue.common.js | https://github.com/ustbhuangyi/vue-analysis/blob/master/vue/dist/vue.common.js | MIT |
function toArray (list, start) {
start = start || 0;
var i = list.length - start;
var ret = new Array(i);
while (i--) {
ret[i] = list[i + start];
}
return ret
} | Convert an Array-like object to a real Array. | toArray | javascript | ustbhuangyi/vue-analysis | vue/dist/vue.common.js | https://github.com/ustbhuangyi/vue-analysis/blob/master/vue/dist/vue.common.js | MIT |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.