dtable-utils
Advanced tools
Comparing version 0.0.3-beta.1 to 0.0.3
@@ -1,2 +0,4 @@ | ||
import _defineProperty from '@babel/runtime/helpers/defineProperty'; | ||
import { CellType } from '../constants/cell-type.js'; | ||
import { COLLABORATOR_COLUMN_TYPES, DEFAULT_DATE_FORMAT } from '../constants/column.js'; | ||
import { FORMULA_RESULT_TYPE } from '../constants/formula.js'; | ||
import { DateUtils } from '../date.js'; | ||
@@ -11,56 +13,5 @@ import { getCollaboratorsName } from './collaborator.js'; | ||
import { getMultipleOptionName, getOptionName } from './option.js'; | ||
import { CellType } from '../constants/cell-type.js'; | ||
import { COLLABORATOR_COLUMN_TYPES, DEFAULT_DATE_FORMAT } from '../constants/column.js'; | ||
import { FORMULA_RESULT_TYPE } from '../constants/formula.js'; | ||
var ARRAY_VALUE_COLUMN_TYPES = [CellType.IMAGE, CellType.FILE, CellType.MULTIPLE_SELECT, CellType.COLLABORATOR]; | ||
var _getArrayColumnCellValue = function _getArrayColumnCellValue(cellValue, column, _ref) { | ||
var collaborators = _ref.collaborators, | ||
isArchiveView = _ref.isArchiveView; | ||
if (!cellValue || !Array.isArray(cellValue) || cellValue.length === 0) { | ||
return ''; | ||
} | ||
var key = column.key, | ||
data = column.data; | ||
var _ref2 = data || {}, | ||
array_type = _ref2.array_type, | ||
array_data = _ref2.array_data; | ||
var newColumn = { | ||
key: key, | ||
type: array_type, | ||
data: array_data | ||
}; | ||
// cellValue itself is an array | ||
if ([CellType.FILE, CellType.IMAGE, CellType.COLLABORATOR, CellType.MULTIPLE_SELECT].includes(array_type)) { | ||
return getCellValueStringResult(_defineProperty({}, key, cellValue), newColumn, { | ||
collaborators: collaborators | ||
}); | ||
} | ||
// cellValue itself is a single value | ||
if (array_type === CellType.STRING) { | ||
newColumn.type = CellType.TEXT; | ||
var _result = cellValue.map(function (item) { | ||
return getCellValueStringResult(_defineProperty({}, key, item), newColumn); | ||
}); | ||
return _result.filter(Boolean).join(', '); | ||
} | ||
if (array_type === CellType.BOOL) { | ||
newColumn.type = CellType.CHECKBOX; | ||
var _result2 = cellValue.map(function (item) { | ||
return getCellValueStringResult(_defineProperty({}, key, item), newColumn); | ||
}); | ||
return _result2.filter(Boolean).join(', '); | ||
} | ||
var result = cellValue.map(function (item) { | ||
return getCellValueStringResult(_defineProperty({}, key, item), newColumn, { | ||
collaborators: collaborators, | ||
isArchiveView: isArchiveView | ||
}); | ||
}); | ||
return result.filter(function (item) { | ||
return item || item === 0; | ||
}).join(', '); | ||
}; | ||
/** | ||
@@ -119,3 +70,3 @@ * Get formatted formula result to display. It will not be formatted | ||
* Get formatted cell value to display. | ||
* @param {object} row e.g. { [column.key]: '' } | ||
* @param {object} row e.g. { [column.key]: 'xxx' } | ||
* @param {string} type column type | ||
@@ -125,3 +76,3 @@ * @param {string} key column key | ||
* @param {object} formulaRows formula results of rows. Default as "{}" | ||
* @param {array} collaborators e.g. [{ email, name, ... }, ...]. Default as "[]" | ||
* @param {array} collaborators e.g. [{ email: 'xxx', name: 'xxx' }, ...]. Default as "[]" | ||
* @param {bool} isBaiduMap Determine the way to connect latitude and longitude. Default as true | ||
@@ -132,12 +83,12 @@ * @param {string} geolocationHyphen Used as a connector between province, city, district and detail. Default as empty string | ||
var getCellValueDisplayString = function getCellValueDisplayString(row, type, key) { | ||
var _ref3 = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {}, | ||
data = _ref3.data, | ||
_ref3$formulaRows = _ref3.formulaRows, | ||
formulaRows = _ref3$formulaRows === void 0 ? {} : _ref3$formulaRows, | ||
_ref3$collaborators = _ref3.collaborators, | ||
collaborators = _ref3$collaborators === void 0 ? [] : _ref3$collaborators, | ||
_ref3$isBaiduMap = _ref3.isBaiduMap, | ||
isBaiduMap = _ref3$isBaiduMap === void 0 ? true : _ref3$isBaiduMap, | ||
_ref3$geolocationHyph = _ref3.geolocationHyphen, | ||
geolocationHyphen = _ref3$geolocationHyph === void 0 ? '' : _ref3$geolocationHyph; | ||
var _ref = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {}, | ||
data = _ref.data, | ||
_ref$formulaRows = _ref.formulaRows, | ||
formulaRows = _ref$formulaRows === void 0 ? {} : _ref$formulaRows, | ||
_ref$collaborators = _ref.collaborators, | ||
collaborators = _ref$collaborators === void 0 ? [] : _ref$collaborators, | ||
_ref$isBaiduMap = _ref.isBaiduMap, | ||
isBaiduMap = _ref$isBaiduMap === void 0 ? true : _ref$isBaiduMap, | ||
_ref$geolocationHyphe = _ref.geolocationHyphen, | ||
geolocationHyphen = _ref$geolocationHyphe === void 0 ? '' : _ref$geolocationHyphe; | ||
if (!row) return ''; | ||
@@ -179,5 +130,5 @@ var cellValue = row[key]; | ||
{ | ||
var _ref4 = data || {}, | ||
_ref4$format = _ref4.format, | ||
format = _ref4$format === void 0 ? DEFAULT_DATE_FORMAT : _ref4$format; | ||
var _ref2 = data || {}, | ||
_ref2$format = _ref2.format, | ||
format = _ref2$format === void 0 ? DEFAULT_DATE_FORMAT : _ref2$format; | ||
return getDateDisplayString(cellValue, format); | ||
@@ -218,162 +169,3 @@ } | ||
}; | ||
var getCellValueStringResult = function getCellValueStringResult(row, column) { | ||
var _ref5 = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}, | ||
_ref5$formulaRows = _ref5.formulaRows, | ||
formulaRows = _ref5$formulaRows === void 0 ? {} : _ref5$formulaRows, | ||
_ref5$collaborators = _ref5.collaborators, | ||
collaborators = _ref5$collaborators === void 0 ? [] : _ref5$collaborators, | ||
_ref5$isArchiveView = _ref5.isArchiveView, | ||
isArchiveView = _ref5$isArchiveView === void 0 ? false : _ref5$isArchiveView; | ||
var _ref6 = column || {}, | ||
key = _ref6.key, | ||
type = _ref6.type, | ||
data = _ref6.data; | ||
var cellValue = row[key]; | ||
switch (type) { | ||
case CellType.TEXT: | ||
case CellType.EMAIL: | ||
case CellType.URL: | ||
case CellType.AUTO_NUMBER: | ||
{ | ||
return cellValue || ''; | ||
} | ||
case CellType.RATE: | ||
{ | ||
// number | ||
return cellValue ? String(cellValue) : ''; | ||
} | ||
case CellType.CHECKBOX: | ||
{ | ||
if (typeof cellValue === 'boolean') { | ||
return String(cellValue); | ||
} | ||
return cellValue === 'true' ? 'true' : 'false'; | ||
} | ||
case CellType.LONG_TEXT: | ||
{ | ||
// the data returned by archive view is a string, not a result in long-text format | ||
if (isArchiveView) { | ||
cellValue = { | ||
text: cellValue | ||
}; | ||
} | ||
return getLongtextDisplayString(cellValue); | ||
} | ||
case CellType.NUMBER: | ||
{ | ||
return getNumberDisplayString(cellValue, data); | ||
} | ||
case CellType.DURATION: | ||
{ | ||
return getDurationDisplayString(cellValue, data); | ||
} | ||
case CellType.GEOLOCATION: | ||
{ | ||
return getGeolocationDisplayString(cellValue, data); | ||
} | ||
case CellType.SINGLE_SELECT: | ||
{ | ||
if (!data) return ''; | ||
var options = data.options; | ||
return getOptionName(options, cellValue); | ||
} | ||
case CellType.MULTIPLE_SELECT: | ||
{ | ||
if (!data) return ''; | ||
var _options2 = data.options; | ||
return getMultipleOptionName(_options2, cellValue); | ||
} | ||
case CellType.DATE: | ||
{ | ||
var _ref7 = data || {}, | ||
_ref7$format = _ref7.format, | ||
format = _ref7$format === void 0 ? DEFAULT_DATE_FORMAT : _ref7$format; | ||
// patch: compatible with previous format | ||
var normalizedFormat = format === 'D/M/YYYY' ? format.replace(/D\/M\/YYYY/, 'DD/MM/YYYY') : format; | ||
return getDateDisplayString(cellValue, normalizedFormat); | ||
} | ||
case CellType.CTIME: | ||
case CellType.MTIME: | ||
{ | ||
return DateUtils.format(cellValue, 'YYYY-MM-DD HH:MM:SS'); | ||
} | ||
case CellType.COLLABORATOR: | ||
{ | ||
return getCollaboratorsName(collaborators, cellValue); | ||
} | ||
case CellType.CREATOR: | ||
case CellType.LAST_MODIFIER: | ||
{ | ||
return cellValue === 'anonymous' ? cellValue : getCollaboratorsName(collaborators, [cellValue]); | ||
} | ||
case CellType.LINK: | ||
{ | ||
if (!isArchiveView) { | ||
var formulaRow = formulaRows[row._id] || {}; | ||
cellValue = formulaRow[key]; | ||
} | ||
if (!cellValue || !Array.isArray(cellValue) || cellValue.length === 0) return ''; | ||
var newCellValue = cellValue.map(function (linked) { | ||
return linked.display_value; | ||
}); | ||
var isTwoDimensionalArray = newCellValue.some(function (item) { | ||
return Array.isArray(item); | ||
}); | ||
if (!isTwoDimensionalArray) { | ||
return _getArrayColumnCellValue(newCellValue, column, { | ||
collaborators: collaborators | ||
}); | ||
} | ||
var result = newCellValue.map(function (item) { | ||
return _getArrayColumnCellValue(item, column, { | ||
collaborators: collaborators, | ||
isArchiveView: isArchiveView | ||
}); | ||
}); | ||
return result.filter(Boolean).join(', '); | ||
} | ||
case CellType.FORMULA: | ||
case CellType.LINK_FORMULA: | ||
{ | ||
if (!isArchiveView) { | ||
var _formulaRow = formulaRows[row._id] || {}; | ||
cellValue = _formulaRow[key]; | ||
} | ||
var result_type = data.result_type; | ||
if (result_type === FORMULA_RESULT_TYPE.STRING) { | ||
return cellValue || ''; | ||
} | ||
if (result_type === FORMULA_RESULT_TYPE.BOOL) { | ||
return [true, 'true'].includes(cellValue) ? 'true' : 'false'; | ||
} | ||
if (result_type === FORMULA_RESULT_TYPE.NUMBER) { | ||
// data is stored in the data of the current column | ||
return getNumberDisplayString(cellValue, data); | ||
} | ||
if (result_type === FORMULA_RESULT_TYPE.DATE) { | ||
// data is stored in the data of the current column | ||
var _ref8 = data || {}, | ||
_format = _ref8.format; | ||
return getDateDisplayString(cellValue, _format); | ||
} | ||
// FORMULA_RESULT_TYPE.ARRAY | ||
return _getArrayColumnCellValue(cellValue, column, { | ||
collaborators: collaborators, | ||
isArchiveView: isArchiveView | ||
}); | ||
} | ||
case CellType.FILE: | ||
case CellType.IMAGE: | ||
case CellType.BUTTON: | ||
{ | ||
return ''; | ||
} | ||
default: | ||
{ | ||
return cellValue ? String(cellValue) : ''; | ||
} | ||
} | ||
}; | ||
export { getCellValueDisplayString, getCellValueStringResult, getFormulaDisplayString }; | ||
export { getCellValueDisplayString, getFormulaDisplayString }; |
@@ -1,11 +0,5 @@ | ||
var getCollaborator = function getCollaborator(collaborators, collaboratorEmail) { | ||
return collaborators.find(function (collaborator) { | ||
return collaborator.email === collaboratorEmail; | ||
}); | ||
}; | ||
/** | ||
* Get collaborators name list of given emails | ||
* @param {array} emails e.g. ['email', ...] | ||
* @param {array} collaborators e.g. [{ email, name, ... }, ...] | ||
* @param {array} collaborators e.g. [{ email: 'xxx', name: 'xxx' }, ...] | ||
* @returns name list, array. e.g. ['name1', 'name2'] | ||
@@ -29,3 +23,3 @@ */ | ||
* Get concatenated collaborators names of given emails. | ||
* @param {array} collaborators e.g. [{ email, name, ... }, ...] | ||
* @param {array} collaborators e.g. [{ email: 'xxx', name: 'xxx' }, ...] | ||
* @param {array} emails e.g. ['email', ...] | ||
@@ -40,2 +34,2 @@ * @returns concatenated collaborators names, string. e.g. 'name1, name2' | ||
export { getCollaborator, getCollaboratorsName, getCollaboratorsNames }; | ||
export { getCollaboratorsName, getCollaboratorsNames }; |
/** | ||
* Get signature image url to display | ||
* @param {object} digitalSign object, e.g. { sign_image_url, ... } | ||
* @param {object} digitalSign object, e.g. { sign_image_url: 'xxx' } | ||
* @returns signature image url, string | ||
@@ -5,0 +5,0 @@ */ |
@@ -86,2 +86,2 @@ import { DURATION_FORMATS_MAP, DURATION_FORMATS, DURATION_ZERO_DISPLAY, DURATION_DECIMAL_DIGITS } from '../constants/column.js'; | ||
export { getDurationDisplayString }; | ||
export { getDurationDecimalSuffix, getDurationDisplayString }; |
@@ -1,3 +0,4 @@ | ||
import { GROUP_GEOLOCATION_GRANULARITY } from '../constants/group.js'; | ||
import { isValidPosition } from '../validate/geolocation.js'; | ||
var isValidPosition = function isValidPosition(lng, lat) { | ||
return (lng || lng === 0) && (lat || lat === 0); | ||
}; | ||
@@ -7,3 +8,3 @@ /** | ||
* @param {object} loc | ||
* @param {object} formats , e.g. { geo_format, ... } | ||
* @param {object} formats , e.g. { geo_format: 'xxx' } | ||
* @param {bool} isBaiduMap Determine the way to connect latitude and longitude. Default as true | ||
@@ -80,28 +81,3 @@ * @param {string} hyphen Used as a connector between province, city, district and detail. Default as empty string | ||
}; | ||
var getGeolocationByGranularity = function getGeolocationByGranularity(geolocation, granularity) { | ||
if (!geolocation) return ''; | ||
var province = geolocation.province, | ||
city = geolocation.city, | ||
district = geolocation.district, | ||
country_region = geolocation.country_region; | ||
switch (granularity) { | ||
case GROUP_GEOLOCATION_GRANULARITY.CITY: | ||
{ | ||
return city || ''; | ||
} | ||
case GROUP_GEOLOCATION_GRANULARITY.DISTRICT: | ||
{ | ||
return district || ''; | ||
} | ||
case GROUP_GEOLOCATION_GRANULARITY.COUNTRY: | ||
{ | ||
return country_region || ''; | ||
} | ||
default: | ||
{ | ||
return province || ''; | ||
} | ||
} | ||
}; | ||
export { getGeolocationByGranularity, getGeolocationDisplayString }; | ||
export { getGeolocationDisplayString }; |
/** | ||
* Get text from long-text to display. | ||
* @param {object} longText e.g. { text, ... } | ||
* @param {object} longText e.g. { text: 'xxx' } | ||
* @returns text from long-text, string | ||
@@ -5,0 +5,0 @@ */ |
import { NPminus as minus } from '../helper/number-precision/index.js'; | ||
import { DEFAULT_NUMBER_FORMAT } from '../constants/column.js'; | ||
import { getDurationDisplayString } from './duration.js'; | ||
import { DEFAULT_NUMBER_FORMAT } from '../constants/column.js'; | ||
@@ -11,26 +11,2 @@ var separatorMap = { | ||
}; | ||
var _getDecimalDigits = function _getDecimalDigits(num) { | ||
if (Number.isInteger(num)) { | ||
return 0; | ||
} | ||
var valueArr = (num + '').split('.'); | ||
var digitsLength = valueArr[1] ? valueArr[1].length : 8; | ||
return digitsLength > 8 ? 8 : digitsLength; | ||
}; | ||
var getPrecisionNumber = function getPrecisionNumber(num, formatData) { | ||
var _ref = formatData || {}, | ||
_ref$precision = _ref.precision, | ||
precision = _ref$precision === void 0 ? 2 : _ref$precision, | ||
_ref$enable_precision = _ref.enable_precision, | ||
enable_precision = _ref$enable_precision === void 0 ? false : _ref$enable_precision; | ||
var type = Object.prototype.toString.call(num); | ||
if (type !== '[object Number]') { | ||
if (type === '[object String]' && DISPLAY_INTERNAL_ERRORS.includes(num)) { | ||
return num; | ||
} | ||
return null; | ||
} | ||
var decimalDigits = enable_precision ? precision : _getDecimalDigits(num); | ||
return num.toFixed(decimalDigits); | ||
}; | ||
@@ -62,15 +38,15 @@ /** | ||
}; | ||
var toThousands = function toThousands(number, _ref2) { | ||
var formats = _ref2.formats, | ||
_ref2$isCurrency = _ref2.isCurrency, | ||
isCurrency = _ref2$isCurrency === void 0 ? true : _ref2$isCurrency; | ||
var _ref3 = formats || {}, | ||
_ref3$decimal = _ref3.decimal, | ||
decimal = _ref3$decimal === void 0 ? 'dot' : _ref3$decimal, | ||
_ref3$thousands = _ref3.thousands, | ||
thousands = _ref3$thousands === void 0 ? 'no' : _ref3$thousands, | ||
_ref3$precision = _ref3.precision, | ||
precision = _ref3$precision === void 0 ? 2 : _ref3$precision, | ||
_ref3$enable_precisio = _ref3.enable_precision, | ||
enable_precision = _ref3$enable_precisio === void 0 ? false : _ref3$enable_precisio; | ||
var toThousands = function toThousands(number, _ref) { | ||
var formats = _ref.formats, | ||
_ref$isCurrency = _ref.isCurrency, | ||
isCurrency = _ref$isCurrency === void 0 ? true : _ref$isCurrency; | ||
var _ref2 = formats || {}, | ||
_ref2$decimal = _ref2.decimal, | ||
decimal = _ref2$decimal === void 0 ? 'dot' : _ref2$decimal, | ||
_ref2$thousands = _ref2.thousands, | ||
thousands = _ref2$thousands === void 0 ? 'no' : _ref2$thousands, | ||
_ref2$precision = _ref2.precision, | ||
precision = _ref2$precision === void 0 ? 2 : _ref2$precision, | ||
_ref2$enable_precisio = _ref2.enable_precision, | ||
enable_precision = _ref2$enable_precisio === void 0 ? false : _ref2$enable_precisio; | ||
@@ -147,5 +123,5 @@ // handle numbers in scientific notation | ||
// formats: old version maybe 'null' | ||
var _ref4 = formats || {}, | ||
_ref4$format = _ref4.format, | ||
format = _ref4$format === void 0 ? DEFAULT_NUMBER_FORMAT : _ref4$format; | ||
var _ref3 = formats || {}, | ||
_ref3$format = _ref3.format, | ||
format = _ref3$format === void 0 ? DEFAULT_NUMBER_FORMAT : _ref3$format; | ||
switch (format) { | ||
@@ -249,2 +225,2 @@ case 'number': | ||
export { getNumberDisplayString, getPrecisionNumber, replaceNumberNotAllowInput }; | ||
export { getNumberDisplayString, replaceNumberNotAllowInput }; |
@@ -1,24 +0,14 @@ | ||
import { getColumnOptions } from '../column/option.js'; | ||
var getOption = function getOption(options, optionId) { | ||
return options.find(function (o) { | ||
return o.id === optionId; | ||
}); | ||
}; | ||
/** | ||
* Get option name of the given id | ||
* @param {array} options e.g. [ { id: '', color: '', name: '' } ] | ||
* @param {string} targetOptionId option id | ||
* @param {string} targetOptionID option id | ||
* @returns option name, string | ||
*/ | ||
var getOptionName = function getOptionName(options, targetOptionId) { | ||
if (!targetOptionId || !Array.isArray(options)) return ''; | ||
var targetOption = getOption(options, targetOptionId); | ||
var getOptionName = function getOptionName(options, targetOptionID) { | ||
if (!targetOptionID || !Array.isArray(options)) return ''; | ||
var targetOption = options.find(function (option) { | ||
return option.id === targetOptionID; | ||
}); | ||
return targetOption ? targetOption.name : ''; | ||
}; | ||
var getColumnOptionNameById = function getColumnOptionNameById(column, optionId) { | ||
var options = getColumnOptions(column); | ||
return getOptionName(options, optionId); | ||
}; | ||
@@ -42,2 +32,2 @@ /** | ||
export { getColumnOptionNameById, getMultipleOptionName, getOption, getOptionName }; | ||
export { getMultipleOptionName, getOptionName }; |
import { NPdivide as divide } from '../helper/number-precision/index.js'; | ||
import { isNumber } from '../number.js'; | ||
import { DURATION_FORMATS_MAP, DURATION_FORMATS } from '../constants/column.js'; | ||
@@ -55,52 +53,2 @@ /** | ||
/** | ||
* parse duration to seconds depend on formats | ||
* @param {string} duration | ||
* @param {object} data { duration_format: '' } | ||
* @returns number | ||
*/ | ||
var formatDurationToNumber = function formatDurationToNumber(duration, data) { | ||
if (duration === 0) return 0; | ||
if (!duration) return null; | ||
var _ref2 = data || {}, | ||
duration_format = _ref2.duration_format; | ||
duration_format = duration_format || DURATION_FORMATS_MAP.H_MM; | ||
if (DURATION_FORMATS.findIndex(function (format) { | ||
return format.type === duration_format; | ||
}) < 0) { | ||
return null; | ||
} | ||
var numericDuration = duration - 0; | ||
if (isNumber(numericDuration)) { | ||
return duration_format === DURATION_FORMATS_MAP.H_MM ? numericDuration * 60 : numericDuration; | ||
} | ||
var stringifyDuration = String(duration); | ||
var isNegative = stringifyDuration[0] === '-'; | ||
if (isNegative) { | ||
stringifyDuration = stringifyDuration.substring(1); | ||
} | ||
var timeParts = stringifyDuration.split(/[::]/); // support ':' and ':'. | ||
var timePartsLen = timeParts.length; | ||
var hoursIndex; | ||
var minutesIndex; | ||
var secondsIndex; | ||
if (duration_format === DURATION_FORMATS_MAP.H_MM) { | ||
hoursIndex = timePartsLen - 2; | ||
minutesIndex = timePartsLen - 1; | ||
} else { | ||
hoursIndex = timePartsLen - 3; | ||
minutesIndex = timePartsLen - 2; | ||
secondsIndex = timePartsLen - 1; | ||
} | ||
var hours = timeParts[hoursIndex] - 0; | ||
var minutes = timeParts[minutesIndex] - 0; | ||
var seconds = timeParts[secondsIndex] - 0; | ||
if (!isNumber(hours) && !isNumber(minutes) && !isNumber(seconds)) return null; | ||
hours = isNumber(hours) ? hours : 0; | ||
minutes = isNumber(minutes) ? minutes : 0; | ||
seconds = isNumber(seconds) ? seconds : 0; | ||
var result = hours * 3600 + minutes * 60 + seconds; | ||
return isNegative ? -result : result; | ||
}; | ||
export { formatDurationToNumber, formatStringToNumber, getFloatNumber }; | ||
export { formatStringToNumber, getFloatNumber }; |
@@ -1,2 +0,2 @@ | ||
import { getColumnType } from './core.js'; | ||
import { getColumnType } from './common.js'; | ||
import { DATE_COLUMN_OPTIONS } from '../constants/column.js'; | ||
@@ -3,0 +3,0 @@ |
@@ -1,2 +0,2 @@ | ||
import { getColumnType } from './core.js'; | ||
import { getColumnType } from './common.js'; | ||
import { CellType } from '../constants/cell-type.js'; | ||
@@ -3,0 +3,0 @@ import { NUMERIC_COLUMNS_TYPES } from '../constants/column.js'; |
@@ -1,3 +0,1 @@ | ||
import _typeof from '@babel/runtime/helpers/typeof'; | ||
/** | ||
@@ -17,10 +15,13 @@ * Generate a random string of specified length. | ||
}; | ||
var isEmpty = function isEmpty(val) { | ||
if (val == null) return true; | ||
if (val.length !== undefined) return val.length === 0; | ||
if (val instanceof Date) return false; | ||
if (_typeof(val) === 'object') return Object.keys(val).length === 0; | ||
return false; | ||
var isNumber = function isNumber(num) { | ||
return (num || num === 0) && Object.prototype.toString.call(num) === '[object Number]'; | ||
}; | ||
var isEmptyObject = function isEmptyObject(obj) { | ||
var name; | ||
for (name in obj) { | ||
return false; | ||
} | ||
return true; | ||
}; | ||
export { generatorBase64Code, isEmpty }; | ||
export { generatorBase64Code, isEmptyObject, isNumber }; |
import _defineProperty from '@babel/runtime/helpers/defineProperty'; | ||
import { CellType } from './cell-type.js'; | ||
var _COLUMNS_ICON_CONFIG, _DURATION_DECIMAL_DIG, _DURATION_ZERO_DISPLA, _NOT_SUPPORT_EDIT_COL, _MULTIPLE_CELL_VALUE_, _SINGLE_CELL_VALUE_CO; | ||
var _COLUMNS_ICON_CONFIG, _DURATION_DECIMAL_DIG, _DURATION_ZERO_DISPLA; | ||
var COLUMNS_ICON_CONFIG = (_COLUMNS_ICON_CONFIG = {}, _defineProperty(_COLUMNS_ICON_CONFIG, CellType.DEFAULT, 'dtable-font dtable-icon-single-line-text'), _defineProperty(_COLUMNS_ICON_CONFIG, CellType.TEXT, 'dtable-font dtable-icon-single-line-text'), _defineProperty(_COLUMNS_ICON_CONFIG, CellType.NUMBER, 'dtable-font dtable-icon-number'), _defineProperty(_COLUMNS_ICON_CONFIG, CellType.CHECKBOX, 'dtable-font dtable-icon-check-square-solid'), _defineProperty(_COLUMNS_ICON_CONFIG, CellType.DATE, 'dtable-font dtable-icon-calendar-alt-solid'), _defineProperty(_COLUMNS_ICON_CONFIG, CellType.SINGLE_SELECT, 'dtable-font dtable-icon-single-election'), _defineProperty(_COLUMNS_ICON_CONFIG, CellType.LONG_TEXT, 'dtable-font dtable-icon-long-text'), _defineProperty(_COLUMNS_ICON_CONFIG, CellType.IMAGE, 'dtable-font dtable-icon-picture'), _defineProperty(_COLUMNS_ICON_CONFIG, CellType.FILE, 'dtable-font dtable-icon-file-alt-solid'), _defineProperty(_COLUMNS_ICON_CONFIG, CellType.MULTIPLE_SELECT, 'dtable-font dtable-icon-multiple-selection'), _defineProperty(_COLUMNS_ICON_CONFIG, CellType.COLLABORATOR, 'dtable-font dtable-icon-collaborator'), _defineProperty(_COLUMNS_ICON_CONFIG, CellType.LINK, 'dtable-font dtable-icon-link-other-record'), _defineProperty(_COLUMNS_ICON_CONFIG, CellType.FORMULA, 'dtable-font dtable-icon-formula'), _defineProperty(_COLUMNS_ICON_CONFIG, CellType.LINK_FORMULA, 'dtable-font dtable-icon-link-formulas'), _defineProperty(_COLUMNS_ICON_CONFIG, CellType.CREATOR, 'dtable-font dtable-icon-creator'), _defineProperty(_COLUMNS_ICON_CONFIG, CellType.CTIME, 'dtable-font dtable-icon-creation-time'), _defineProperty(_COLUMNS_ICON_CONFIG, CellType.LAST_MODIFIER, 'dtable-font dtable-icon-creator'), _defineProperty(_COLUMNS_ICON_CONFIG, CellType.MTIME, 'dtable-font dtable-icon-creation-time'), _defineProperty(_COLUMNS_ICON_CONFIG, CellType.GEOLOCATION, 'dtable-font dtable-icon-location'), _defineProperty(_COLUMNS_ICON_CONFIG, CellType.AUTO_NUMBER, 'dtable-font dtable-icon-autonumber'), _defineProperty(_COLUMNS_ICON_CONFIG, CellType.URL, 'dtable-font dtable-icon-url'), _defineProperty(_COLUMNS_ICON_CONFIG, CellType.EMAIL, 'dtable-font dtable-icon-email'), _defineProperty(_COLUMNS_ICON_CONFIG, CellType.DURATION, 'dtable-font dtable-icon-duration'), _defineProperty(_COLUMNS_ICON_CONFIG, CellType.BUTTON, 'dtable-font dtable-icon-button'), _defineProperty(_COLUMNS_ICON_CONFIG, CellType.RATE, 'dtable-font dtable-icon-rate'), _defineProperty(_COLUMNS_ICON_CONFIG, CellType.DIGITAL_SIGN, 'dtable-font dtable-icon-handwritten-signature'), _COLUMNS_ICON_CONFIG); | ||
var COLUMN_OPTIONS = [{ | ||
iconName: 'Basic', | ||
iconClass: '', | ||
isDisabled: true | ||
}, { | ||
iconName: 'Text', | ||
iconClass: COLUMNS_ICON_CONFIG[CellType.TEXT], | ||
type: CellType.TEXT | ||
}, { | ||
iconName: 'Long_Text', | ||
iconClass: COLUMNS_ICON_CONFIG[CellType.LONG_TEXT], | ||
type: CellType.LONG_TEXT | ||
}, { | ||
iconName: 'Number', | ||
iconClass: COLUMNS_ICON_CONFIG[CellType.NUMBER], | ||
type: CellType.NUMBER | ||
}, { | ||
iconName: 'Collaborator', | ||
iconClass: COLUMNS_ICON_CONFIG[CellType.COLLABORATOR], | ||
type: CellType.COLLABORATOR | ||
}, { | ||
iconName: 'Date', | ||
iconClass: COLUMNS_ICON_CONFIG[CellType.DATE], | ||
type: CellType.DATE | ||
}, { | ||
iconName: 'Duration', | ||
iconClass: COLUMNS_ICON_CONFIG[CellType.DURATION], | ||
type: CellType.DURATION | ||
}, { | ||
iconName: 'Single_Select', | ||
iconClass: COLUMNS_ICON_CONFIG[CellType.SINGLE_SELECT], | ||
type: CellType.SINGLE_SELECT | ||
}, { | ||
iconName: 'Multiple_Select', | ||
iconClass: COLUMNS_ICON_CONFIG[CellType.MULTIPLE_SELECT], | ||
type: CellType.MULTIPLE_SELECT | ||
}, { | ||
iconName: 'Image', | ||
iconClass: COLUMNS_ICON_CONFIG[CellType.IMAGE], | ||
type: CellType.IMAGE | ||
}, { | ||
iconName: 'File', | ||
iconClass: COLUMNS_ICON_CONFIG[CellType.FILE], | ||
type: CellType.FILE | ||
}, { | ||
iconName: 'Email', | ||
iconClass: COLUMNS_ICON_CONFIG[CellType.EMAIL], | ||
type: CellType.EMAIL | ||
}, { | ||
iconName: 'URL', | ||
iconClass: COLUMNS_ICON_CONFIG[CellType.URL], | ||
type: CellType.URL | ||
}, { | ||
iconName: 'Checkbox', | ||
iconClass: COLUMNS_ICON_CONFIG[CellType.CHECKBOX], | ||
type: CellType.CHECKBOX | ||
}, { | ||
iconName: 'Rating', | ||
iconClass: COLUMNS_ICON_CONFIG[CellType.RATE], | ||
type: CellType.RATE | ||
}, { | ||
iconName: 'Advanced', | ||
iconClass: '', | ||
isDisabled: true | ||
}, { | ||
iconName: 'Formula', | ||
iconClass: COLUMNS_ICON_CONFIG[CellType.FORMULA], | ||
type: CellType.FORMULA | ||
}, { | ||
iconName: 'Link_formula', | ||
iconClass: COLUMNS_ICON_CONFIG[CellType.LINK_FORMULA], | ||
type: CellType.LINK_FORMULA | ||
}, { | ||
iconName: 'Geolocation', | ||
iconClass: COLUMNS_ICON_CONFIG[CellType.GEOLOCATION], | ||
type: CellType.GEOLOCATION | ||
}, { | ||
iconName: 'Link_to_other_records', | ||
iconClass: COLUMNS_ICON_CONFIG[CellType.LINK], | ||
type: CellType.LINK | ||
}, { | ||
iconName: 'Creator', | ||
iconClass: COLUMNS_ICON_CONFIG[CellType.CREATOR], | ||
type: CellType.CREATOR | ||
}, { | ||
iconName: 'CTime', | ||
iconClass: COLUMNS_ICON_CONFIG[CellType.CTIME], | ||
type: CellType.CTIME | ||
}, { | ||
iconName: 'Last_Modifier', | ||
iconClass: COLUMNS_ICON_CONFIG[CellType.LAST_MODIFIER], | ||
type: CellType.LAST_MODIFIER | ||
}, { | ||
iconName: 'Last_Modified_Time', | ||
iconClass: COLUMNS_ICON_CONFIG[CellType.MTIME], | ||
type: CellType.MTIME | ||
}, { | ||
iconName: 'Auto_number', | ||
iconClass: COLUMNS_ICON_CONFIG[CellType.AUTO_NUMBER], | ||
type: CellType.AUTO_NUMBER | ||
}, { | ||
iconName: 'Button', | ||
iconClass: COLUMNS_ICON_CONFIG[CellType.BUTTON], | ||
type: CellType.BUTTON | ||
}, { | ||
iconName: 'Digital_signature', | ||
iconClass: COLUMNS_ICON_CONFIG[CellType.DIGITAL_SIGN], | ||
type: CellType.DIGITAL_SIGN | ||
}]; | ||
var DATE_COLUMN_OPTIONS = [CellType.DATE, CellType.CTIME, CellType.MTIME]; | ||
@@ -121,3 +12,2 @@ var NUMERIC_COLUMNS_TYPES = [CellType.NUMBER, CellType.DURATION, CellType.RATE]; | ||
var DEFAULT_DATE_FORMAT = 'YYYY-MM-DD'; | ||
var UTC_FORMAT_DEFAULT = 'YYYY-MM-DDTHH:mm:ss.SSSZ'; | ||
var DATE_UNIT = { | ||
@@ -134,7 +24,2 @@ YEAR: 'year', | ||
}; | ||
var DATE_FORMAT_MAP = { | ||
YYYY_MM_DD: 'YYYY-MM-DD', | ||
YYYY_MM_DD_HH_MM: 'YYYY-MM-DD HH:mm', | ||
YYYY_MM_DD_HH_MM_SS: 'YYYY-MM-DD HH:mm:ss' | ||
}; | ||
@@ -161,13 +46,3 @@ // duration | ||
var DEFAULT_NUMBER_FORMAT = 'number'; | ||
var DATE_DEFAULT_TYPES = { | ||
SPECIFIC_DATE: 'specific_date', | ||
CURRENT_DATE: 'current_date', | ||
DAYS_BEFORE: 'days_before', | ||
DAYS_AFTER: 'days_after' | ||
}; | ||
var FILL_DEFAULT_VALUE_COLUMNS_TYPE = [CellType.TEXT, CellType.NUMBER, CellType.SINGLE_SELECT, CellType.RATE, CellType.CHECKBOX, CellType.LONG_TEXT, CellType.DATE, CellType.COLLABORATOR]; | ||
var NOT_SUPPORT_EDIT_COLUMN_TYPE_MAP = (_NOT_SUPPORT_EDIT_COL = {}, _defineProperty(_NOT_SUPPORT_EDIT_COL, CellType.CTIME, true), _defineProperty(_NOT_SUPPORT_EDIT_COL, CellType.MTIME, true), _defineProperty(_NOT_SUPPORT_EDIT_COL, CellType.CREATOR, true), _defineProperty(_NOT_SUPPORT_EDIT_COL, CellType.LAST_MODIFIER, true), _defineProperty(_NOT_SUPPORT_EDIT_COL, CellType.FORMULA, true), _defineProperty(_NOT_SUPPORT_EDIT_COL, CellType.AUTO_NUMBER, true), _defineProperty(_NOT_SUPPORT_EDIT_COL, CellType.BUTTON, true), _defineProperty(_NOT_SUPPORT_EDIT_COL, CellType.LINK_FORMULA, true), _NOT_SUPPORT_EDIT_COL); | ||
var MULTIPLE_CELL_VALUE_COLUMN_TYPE_MAP = (_MULTIPLE_CELL_VALUE_ = {}, _defineProperty(_MULTIPLE_CELL_VALUE_, CellType.MULTIPLE_SELECT, true), _defineProperty(_MULTIPLE_CELL_VALUE_, CellType.COLLABORATOR, true), _defineProperty(_MULTIPLE_CELL_VALUE_, CellType.LINK, true), _MULTIPLE_CELL_VALUE_); | ||
var SINGLE_CELL_VALUE_COLUMN_TYPE_MAP = (_SINGLE_CELL_VALUE_CO = {}, _defineProperty(_SINGLE_CELL_VALUE_CO, CellType.TEXT, true), _defineProperty(_SINGLE_CELL_VALUE_CO, CellType.DATE, true), _defineProperty(_SINGLE_CELL_VALUE_CO, CellType.CTIME, true), _defineProperty(_SINGLE_CELL_VALUE_CO, CellType.MTIME, true), _defineProperty(_SINGLE_CELL_VALUE_CO, CellType.NUMBER, true), _defineProperty(_SINGLE_CELL_VALUE_CO, CellType.CHECKBOX, true), _defineProperty(_SINGLE_CELL_VALUE_CO, CellType.SINGLE_SELECT, true), _defineProperty(_SINGLE_CELL_VALUE_CO, CellType.CREATOR, true), _defineProperty(_SINGLE_CELL_VALUE_CO, CellType.GEOLOCATION, true), _defineProperty(_SINGLE_CELL_VALUE_CO, CellType.FORMULA, true), _defineProperty(_SINGLE_CELL_VALUE_CO, CellType.LINK_FORMULA, true), _defineProperty(_SINGLE_CELL_VALUE_CO, CellType.URL, true), _defineProperty(_SINGLE_CELL_VALUE_CO, CellType.EMAIL, true), _defineProperty(_SINGLE_CELL_VALUE_CO, CellType.DURATION, true), _defineProperty(_SINGLE_CELL_VALUE_CO, CellType.RATE, true), _defineProperty(_SINGLE_CELL_VALUE_CO, CellType.LAST_MODIFIER, true), _defineProperty(_SINGLE_CELL_VALUE_CO, CellType.DIGITAL_SIGN, true), _SINGLE_CELL_VALUE_CO); | ||
export { COLLABORATOR_COLUMN_TYPES, COLUMNS_ICON_CONFIG, COLUMN_OPTIONS, DATE_COLUMN_OPTIONS, DATE_DEFAULT_TYPES, DATE_FORMAT_MAP, DATE_UNIT, DEFAULT_DATE_FORMAT, DEFAULT_NUMBER_FORMAT, DURATION_DECIMAL_DIGITS, DURATION_FORMATS, DURATION_FORMATS_MAP, DURATION_ZERO_DISPLAY, FILL_DEFAULT_VALUE_COLUMNS_TYPE, MULTIPLE_CELL_VALUE_COLUMN_TYPE_MAP, NOT_SUPPORT_EDIT_COLUMN_TYPE_MAP, NUMERIC_COLUMNS_TYPES, SINGLE_CELL_VALUE_COLUMN_TYPE_MAP, UTC_FORMAT_DEFAULT }; | ||
export { COLLABORATOR_COLUMN_TYPES, COLUMNS_ICON_CONFIG, DATE_COLUMN_OPTIONS, DATE_UNIT, DEFAULT_DATE_FORMAT, DEFAULT_NUMBER_FORMAT, DURATION_DECIMAL_DIGITS, DURATION_FORMATS, DURATION_FORMATS_MAP, DURATION_ZERO_DISPLAY, NUMERIC_COLUMNS_TYPES }; |
@@ -6,6 +6,2 @@ export { FILTER_COLUMN_OPTIONS } from './filter-column-options.js'; | ||
var FILTER_CONJUNCTION_TYPE = { | ||
AND: 'And', | ||
OR: 'Or' | ||
}; | ||
var FILTER_ERR_MSG = { | ||
@@ -21,2 +17,2 @@ INVALID_FILTER: 'invalid filter', | ||
export { FILTER_CONJUNCTION_TYPE, FILTER_ERR_MSG }; | ||
export { FILTER_ERR_MSG }; |
import _classCallCheck from '@babel/runtime/helpers/classCallCheck'; | ||
import _createClass from '@babel/runtime/helpers/createClass'; | ||
import { DATE_UNIT, DEFAULT_DATE_FORMAT } from './constants/column.js'; | ||
import { DEFAULT_DATE_FORMAT, DATE_UNIT } from './constants/column.js'; | ||
@@ -5,0 +5,0 @@ var MONTH_QUARTERS = [1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4]; |
export { CellType } from './constants/cell-type.js'; | ||
export { COLLABORATOR_COLUMN_TYPES, COLUMNS_ICON_CONFIG, COLUMN_OPTIONS, DATE_COLUMN_OPTIONS, DATE_DEFAULT_TYPES, DATE_FORMAT_MAP, DATE_UNIT, DEFAULT_DATE_FORMAT, DEFAULT_NUMBER_FORMAT, DURATION_DECIMAL_DIGITS, DURATION_FORMATS, DURATION_FORMATS_MAP, DURATION_ZERO_DISPLAY, FILL_DEFAULT_VALUE_COLUMNS_TYPE, MULTIPLE_CELL_VALUE_COLUMN_TYPE_MAP, NOT_SUPPORT_EDIT_COLUMN_TYPE_MAP, NUMERIC_COLUMNS_TYPES, SINGLE_CELL_VALUE_COLUMN_TYPE_MAP, UTC_FORMAT_DEFAULT } from './constants/column.js'; | ||
export { FILTER_CONJUNCTION_TYPE, FILTER_ERR_MSG } from './constants/filter/index.js'; | ||
export { COLLABORATOR_COLUMN_TYPES, COLUMNS_ICON_CONFIG, DATE_COLUMN_OPTIONS, DEFAULT_DATE_FORMAT, DEFAULT_NUMBER_FORMAT, DURATION_DECIMAL_DIGITS, DURATION_FORMATS, DURATION_FORMATS_MAP, DURATION_ZERO_DISPLAY, NUMERIC_COLUMNS_TYPES } from './constants/column.js'; | ||
export { FILTER_ERR_MSG } from './constants/filter/index.js'; | ||
export { FORMULA_COLUMN_TYPES_MAP, FORMULA_RESULT_TYPE } from './constants/formula.js'; | ||
export { HIGHLIGHT_COLORS, SELECT_OPTION_COLORS } from './constants/select-option.js'; | ||
export { NUMBER_SORTER_COLUMN_TYPES, SORT_COLUMN_OPTIONS, SORT_TYPE, TEXT_SORTER_COLUMN_TYPES } from './constants/sort.js'; | ||
export { DISPLAY_GROUP_DATE_GRANULARITY, DISPLAY_GROUP_GEOLOCATION_GRANULARITY, GROUP_DATE_GRANULARITY, GROUP_GEOLOCATION_GRANULARITY, MAX_GROUP_LEVEL, SUPPORT_GROUP_COLUMN_TYPES } from './constants/group.js'; | ||
export { COLUMN_PERMISSION_TYPE } from './constants/column-permission.js'; | ||
export { REG_NUMBER_DIGIT, REG_STRING_NUMBER_PARTS } from './constants/reg.js'; | ||
export { COLOR_GRADATION_OPTIONS } from './constants/color.js'; | ||
export { HEADER_HEIGHT_TYPE } from './constants/grid-header.js'; | ||
export { generatorBase64Code, isEmpty } from './common.js'; | ||
export { getTableById } from './table/index.js'; | ||
export { convertRow, isTableRows } from './row/core.js'; | ||
export { default as RowColorUtils } from './row/color.js'; | ||
export { getLinkColumnsUsedInFilters, getViewById, isDefaultView, isFilterView, isGroupView, isSortView } from './view/core.js'; | ||
export { getSummaries, getSummariesWithSubgroups, updateGroupSummaries } from './view/summaries.js'; | ||
export { getFormulaColumnsContainLinks, getSortedFormulaColumns, getSortedFormulaColumnsContainLinks, transLink2LinkFormula } from './view/formula.js'; | ||
export { getGroupByPath } from './view/group.js'; | ||
export { getLinkById, getLinkCellValue, getLinkTableID, getLinkedTableID, isValidLink } from './link/core.js'; | ||
export { generatorBase64Code, isEmptyObject, isNumber } from './common.js'; | ||
export { getDateDisplayString } from './cell-value-get/date.js'; | ||
export { getDurationDisplayString } from './cell-value-get/duration.js'; | ||
export { getNumberDisplayString, getPrecisionNumber, replaceNumberNotAllowInput } from './cell-value-get/number.js'; | ||
export { getColumnOptionNameById, getMultipleOptionName, getOption, getOptionName } from './cell-value-get/option.js'; | ||
export { getCollaborator, getCollaboratorsName, getCollaboratorsNames } from './cell-value-get/collaborator.js'; | ||
export { getGeolocationByGranularity, getGeolocationDisplayString } from './cell-value-get/geolocation.js'; | ||
export { getNumberDisplayString, replaceNumberNotAllowInput } from './cell-value-get/number.js'; | ||
export { getMultipleOptionName, getOptionName } from './cell-value-get/option.js'; | ||
export { getCollaboratorsName, getCollaboratorsNames } from './cell-value-get/collaborator.js'; | ||
export { getGeolocationDisplayString } from './cell-value-get/geolocation.js'; | ||
export { getDigitalSignImageUrl } from './cell-value-get/digital-sign.js'; | ||
export { getLongtextDisplayString } from './cell-value-get/long-text.js'; | ||
export { getCellValueDisplayString, getCellValueStringResult, getFormulaDisplayString } from './cell-value-get/cell-value.js'; | ||
export { getRateDisplayString } from './cell-value-get/rate.js'; | ||
export { formatDurationToNumber, formatStringToNumber, getFloatNumber } from './cell-value-set/number.js'; | ||
export { formatTextToDate } from './cell-value-set/date.js'; | ||
export { createOption, generateOptionID, generatorCellOption, generatorCellOptions, getColumnOptions } from './column/option.js'; | ||
export { getCellValueDisplayString, getFormulaDisplayString } from './cell-value-get/cell-value.js'; | ||
export { formatStringToNumber, getFloatNumber } from './cell-value-set/number.js'; | ||
export { getColumnOptions } from './column/common.js'; | ||
export { isDateColumn } from './column/date.js'; | ||
export { isNumberColumn, isNumericColumn } from './column/number.js'; | ||
export { default as ColumnColorUtils } from './column/color.js'; | ||
export { DateUtils } from './date.js'; | ||
export { isNumber, isNumberEqual } from './number.js'; | ||
export { ValidateFilter } from './validate/filter.js'; | ||
export { isValidEmail } from './validate/email.js'; | ||
export { isValidPosition } from './validate/geolocation.js'; | ||
export { deleteInvalidFilter, getFormattedFilter, getFormattedFilterOtherDate, getFormattedFilters, getValidFilters, getValidFiltersWithoutError, otherDate } from './filter/core.js'; | ||
export { checkboxFilter } from './filter/filter-column/checkbox.js'; | ||
export { collaboratorFilter } from './filter/filter-column/collaborator.js'; | ||
export { creatorFilter } from './filter/filter-column/creator.js'; | ||
export { dateFilter } from './filter/filter-column/date.js'; | ||
export { digitalSignFilter } from './filter/filter-column/digital-sign.js'; | ||
export { fileFilter } from './filter/filter-column/file.js'; | ||
export { formulaFilter } from './filter/filter-column/formula.js'; | ||
export { geolocationFilter } from './filter/filter-column/geolocation.js'; | ||
export { textFilter } from './filter/filter-column/text.js'; | ||
export { longTextFilter } from './filter/filter-column/long-text.js'; | ||
export { multipleSelectFilter } from './filter/filter-column/multiple-select.js'; | ||
export { numberFilter } from './filter/filter-column/number.js'; | ||
export { singleSelectFilter } from './filter/filter-column/single-select.js'; | ||
export { linkFilter } from './filter/filter-column/link.js'; | ||
export { filterRow, filterRows, getFilteredRowsWithoutFormulaCalculation } from './filter/filter-row.js'; | ||
export { getValidSorts, isValidSort } from './sort/core.js'; | ||
export { sortCheckbox } from './sort/sort-column/checkbox.js'; | ||
export { sortCollaborator } from './sort/sort-column/collaborator.js'; | ||
export { sortDate } from './sort/sort-column/date.js'; | ||
export { sortByArrayType } from './sort/sort-column/array.js'; | ||
export { sortFormula } from './sort/sort-column/formula.js'; | ||
export { sortLink } from './sort/sort-column/link.js'; | ||
export { getMultipleIndexesOrderbyOptions, sortMultipleSelect } from './sort/sort-column/multiple-select.js'; | ||
export { sortNumber } from './sort/sort-column/number.js'; | ||
export { sortSingleSelect } from './sort/sort-column/single-select.js'; | ||
export { compareString, sortText } from './sort/sort-column/text.js'; | ||
export { deleteInvalidSort, sortRowsWithMultiSorts, sortTableRows } from './sort/sort-row.js'; | ||
export { deleteInvalidGroupby, getValidGroupbys, isValidGroupby } from './group/core.js'; | ||
export { getGroupedRowsWithoutFormulaCalculation, groupTableRows, groupViewRows } from './group/group-row.js'; | ||
export { default as GradientColorUtils } from './color/gradient-color.js'; | ||
export { FILTER_COLUMN_OPTIONS } from './constants/filter/filter-column-options.js'; | ||
@@ -77,3 +27,1 @@ export { FILTER_TERM_MODIFIER_SHOW, FILTER_TERM_MODIFIER_TYPE } from './constants/filter/filter-modifier.js'; | ||
export { filterTermModifierIsWithin, filterTermModifierNotWithin } from './constants/filter/filter-is-within.js'; | ||
export { getTableColumnByKey, getTableColumnByName } from './table/column.js'; | ||
export { getRowById, getRowsByIds } from './table/row.js'; |
@@ -8,3 +8,3 @@ import _typeof from '@babel/runtime/helpers/typeof'; | ||
import { FILTER_ERR_MSG } from '../constants/filter/index.js'; | ||
import { getColumnOptions } from '../column/option.js'; | ||
import { getColumnOptions } from '../column/common.js'; | ||
import { isDateColumn } from '../column/date.js'; | ||
@@ -11,0 +11,0 @@ import { FILTER_PREDICATE_TYPE } from '../constants/filter/filter-predicate.js'; |
@@ -5,3 +5,5 @@ 'use strict'; | ||
var _defineProperty = require('@babel/runtime/helpers/defineProperty'); | ||
var cellType = require('../constants/cell-type.js'); | ||
var column = require('../constants/column.js'); | ||
var formula = require('../constants/formula.js'); | ||
var date$1 = require('../date.js'); | ||
@@ -16,60 +18,5 @@ var collaborator = require('./collaborator.js'); | ||
var option = require('./option.js'); | ||
var cellType = require('../constants/cell-type.js'); | ||
var column = require('../constants/column.js'); | ||
var formula = require('../constants/formula.js'); | ||
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; } | ||
var _defineProperty__default = /*#__PURE__*/_interopDefaultLegacy(_defineProperty); | ||
var ARRAY_VALUE_COLUMN_TYPES = [cellType.CellType.IMAGE, cellType.CellType.FILE, cellType.CellType.MULTIPLE_SELECT, cellType.CellType.COLLABORATOR]; | ||
var _getArrayColumnCellValue = function _getArrayColumnCellValue(cellValue, column, _ref) { | ||
var collaborators = _ref.collaborators, | ||
isArchiveView = _ref.isArchiveView; | ||
if (!cellValue || !Array.isArray(cellValue) || cellValue.length === 0) { | ||
return ''; | ||
} | ||
var key = column.key, | ||
data = column.data; | ||
var _ref2 = data || {}, | ||
array_type = _ref2.array_type, | ||
array_data = _ref2.array_data; | ||
var newColumn = { | ||
key: key, | ||
type: array_type, | ||
data: array_data | ||
}; | ||
// cellValue itself is an array | ||
if ([cellType.CellType.FILE, cellType.CellType.IMAGE, cellType.CellType.COLLABORATOR, cellType.CellType.MULTIPLE_SELECT].includes(array_type)) { | ||
return getCellValueStringResult(_defineProperty__default["default"]({}, key, cellValue), newColumn, { | ||
collaborators: collaborators | ||
}); | ||
} | ||
// cellValue itself is a single value | ||
if (array_type === cellType.CellType.STRING) { | ||
newColumn.type = cellType.CellType.TEXT; | ||
var _result = cellValue.map(function (item) { | ||
return getCellValueStringResult(_defineProperty__default["default"]({}, key, item), newColumn); | ||
}); | ||
return _result.filter(Boolean).join(', '); | ||
} | ||
if (array_type === cellType.CellType.BOOL) { | ||
newColumn.type = cellType.CellType.CHECKBOX; | ||
var _result2 = cellValue.map(function (item) { | ||
return getCellValueStringResult(_defineProperty__default["default"]({}, key, item), newColumn); | ||
}); | ||
return _result2.filter(Boolean).join(', '); | ||
} | ||
var result = cellValue.map(function (item) { | ||
return getCellValueStringResult(_defineProperty__default["default"]({}, key, item), newColumn, { | ||
collaborators: collaborators, | ||
isArchiveView: isArchiveView | ||
}); | ||
}); | ||
return result.filter(function (item) { | ||
return item || item === 0; | ||
}).join(', '); | ||
}; | ||
/** | ||
@@ -128,3 +75,3 @@ * Get formatted formula result to display. It will not be formatted | ||
* Get formatted cell value to display. | ||
* @param {object} row e.g. { [column.key]: '' } | ||
* @param {object} row e.g. { [column.key]: 'xxx' } | ||
* @param {string} type column type | ||
@@ -134,3 +81,3 @@ * @param {string} key column key | ||
* @param {object} formulaRows formula results of rows. Default as "{}" | ||
* @param {array} collaborators e.g. [{ email, name, ... }, ...]. Default as "[]" | ||
* @param {array} collaborators e.g. [{ email: 'xxx', name: 'xxx' }, ...]. Default as "[]" | ||
* @param {bool} isBaiduMap Determine the way to connect latitude and longitude. Default as true | ||
@@ -141,12 +88,12 @@ * @param {string} geolocationHyphen Used as a connector between province, city, district and detail. Default as empty string | ||
var getCellValueDisplayString = function getCellValueDisplayString(row, type, key) { | ||
var _ref3 = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {}, | ||
data = _ref3.data, | ||
_ref3$formulaRows = _ref3.formulaRows, | ||
formulaRows = _ref3$formulaRows === void 0 ? {} : _ref3$formulaRows, | ||
_ref3$collaborators = _ref3.collaborators, | ||
collaborators = _ref3$collaborators === void 0 ? [] : _ref3$collaborators, | ||
_ref3$isBaiduMap = _ref3.isBaiduMap, | ||
isBaiduMap = _ref3$isBaiduMap === void 0 ? true : _ref3$isBaiduMap, | ||
_ref3$geolocationHyph = _ref3.geolocationHyphen, | ||
geolocationHyphen = _ref3$geolocationHyph === void 0 ? '' : _ref3$geolocationHyph; | ||
var _ref = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {}, | ||
data = _ref.data, | ||
_ref$formulaRows = _ref.formulaRows, | ||
formulaRows = _ref$formulaRows === void 0 ? {} : _ref$formulaRows, | ||
_ref$collaborators = _ref.collaborators, | ||
collaborators = _ref$collaborators === void 0 ? [] : _ref$collaborators, | ||
_ref$isBaiduMap = _ref.isBaiduMap, | ||
isBaiduMap = _ref$isBaiduMap === void 0 ? true : _ref$isBaiduMap, | ||
_ref$geolocationHyphe = _ref.geolocationHyphen, | ||
geolocationHyphen = _ref$geolocationHyphe === void 0 ? '' : _ref$geolocationHyphe; | ||
if (!row) return ''; | ||
@@ -188,5 +135,5 @@ var cellValue = row[key]; | ||
{ | ||
var _ref4 = data || {}, | ||
_ref4$format = _ref4.format, | ||
format = _ref4$format === void 0 ? column.DEFAULT_DATE_FORMAT : _ref4$format; | ||
var _ref2 = data || {}, | ||
_ref2$format = _ref2.format, | ||
format = _ref2$format === void 0 ? column.DEFAULT_DATE_FORMAT : _ref2$format; | ||
return date.getDateDisplayString(cellValue, format); | ||
@@ -227,164 +174,4 @@ } | ||
}; | ||
var getCellValueStringResult = function getCellValueStringResult(row, column$1) { | ||
var _ref5 = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}, | ||
_ref5$formulaRows = _ref5.formulaRows, | ||
formulaRows = _ref5$formulaRows === void 0 ? {} : _ref5$formulaRows, | ||
_ref5$collaborators = _ref5.collaborators, | ||
collaborators = _ref5$collaborators === void 0 ? [] : _ref5$collaborators, | ||
_ref5$isArchiveView = _ref5.isArchiveView, | ||
isArchiveView = _ref5$isArchiveView === void 0 ? false : _ref5$isArchiveView; | ||
var _ref6 = column$1 || {}, | ||
key = _ref6.key, | ||
type = _ref6.type, | ||
data = _ref6.data; | ||
var cellValue = row[key]; | ||
switch (type) { | ||
case cellType.CellType.TEXT: | ||
case cellType.CellType.EMAIL: | ||
case cellType.CellType.URL: | ||
case cellType.CellType.AUTO_NUMBER: | ||
{ | ||
return cellValue || ''; | ||
} | ||
case cellType.CellType.RATE: | ||
{ | ||
// number | ||
return cellValue ? String(cellValue) : ''; | ||
} | ||
case cellType.CellType.CHECKBOX: | ||
{ | ||
if (typeof cellValue === 'boolean') { | ||
return String(cellValue); | ||
} | ||
return cellValue === 'true' ? 'true' : 'false'; | ||
} | ||
case cellType.CellType.LONG_TEXT: | ||
{ | ||
// the data returned by archive view is a string, not a result in long-text format | ||
if (isArchiveView) { | ||
cellValue = { | ||
text: cellValue | ||
}; | ||
} | ||
return longText.getLongtextDisplayString(cellValue); | ||
} | ||
case cellType.CellType.NUMBER: | ||
{ | ||
return number.getNumberDisplayString(cellValue, data); | ||
} | ||
case cellType.CellType.DURATION: | ||
{ | ||
return duration.getDurationDisplayString(cellValue, data); | ||
} | ||
case cellType.CellType.GEOLOCATION: | ||
{ | ||
return geolocation.getGeolocationDisplayString(cellValue, data); | ||
} | ||
case cellType.CellType.SINGLE_SELECT: | ||
{ | ||
if (!data) return ''; | ||
var options = data.options; | ||
return option.getOptionName(options, cellValue); | ||
} | ||
case cellType.CellType.MULTIPLE_SELECT: | ||
{ | ||
if (!data) return ''; | ||
var _options2 = data.options; | ||
return option.getMultipleOptionName(_options2, cellValue); | ||
} | ||
case cellType.CellType.DATE: | ||
{ | ||
var _ref7 = data || {}, | ||
_ref7$format = _ref7.format, | ||
format = _ref7$format === void 0 ? column.DEFAULT_DATE_FORMAT : _ref7$format; | ||
// patch: compatible with previous format | ||
var normalizedFormat = format === 'D/M/YYYY' ? format.replace(/D\/M\/YYYY/, 'DD/MM/YYYY') : format; | ||
return date.getDateDisplayString(cellValue, normalizedFormat); | ||
} | ||
case cellType.CellType.CTIME: | ||
case cellType.CellType.MTIME: | ||
{ | ||
return date$1.DateUtils.format(cellValue, 'YYYY-MM-DD HH:MM:SS'); | ||
} | ||
case cellType.CellType.COLLABORATOR: | ||
{ | ||
return collaborator.getCollaboratorsName(collaborators, cellValue); | ||
} | ||
case cellType.CellType.CREATOR: | ||
case cellType.CellType.LAST_MODIFIER: | ||
{ | ||
return cellValue === 'anonymous' ? cellValue : collaborator.getCollaboratorsName(collaborators, [cellValue]); | ||
} | ||
case cellType.CellType.LINK: | ||
{ | ||
if (!isArchiveView) { | ||
var formulaRow = formulaRows[row._id] || {}; | ||
cellValue = formulaRow[key]; | ||
} | ||
if (!cellValue || !Array.isArray(cellValue) || cellValue.length === 0) return ''; | ||
var newCellValue = cellValue.map(function (linked) { | ||
return linked.display_value; | ||
}); | ||
var isTwoDimensionalArray = newCellValue.some(function (item) { | ||
return Array.isArray(item); | ||
}); | ||
if (!isTwoDimensionalArray) { | ||
return _getArrayColumnCellValue(newCellValue, column$1, { | ||
collaborators: collaborators | ||
}); | ||
} | ||
var result = newCellValue.map(function (item) { | ||
return _getArrayColumnCellValue(item, column$1, { | ||
collaborators: collaborators, | ||
isArchiveView: isArchiveView | ||
}); | ||
}); | ||
return result.filter(Boolean).join(', '); | ||
} | ||
case cellType.CellType.FORMULA: | ||
case cellType.CellType.LINK_FORMULA: | ||
{ | ||
if (!isArchiveView) { | ||
var _formulaRow = formulaRows[row._id] || {}; | ||
cellValue = _formulaRow[key]; | ||
} | ||
var result_type = data.result_type; | ||
if (result_type === formula.FORMULA_RESULT_TYPE.STRING) { | ||
return cellValue || ''; | ||
} | ||
if (result_type === formula.FORMULA_RESULT_TYPE.BOOL) { | ||
return [true, 'true'].includes(cellValue) ? 'true' : 'false'; | ||
} | ||
if (result_type === formula.FORMULA_RESULT_TYPE.NUMBER) { | ||
// data is stored in the data of the current column | ||
return number.getNumberDisplayString(cellValue, data); | ||
} | ||
if (result_type === formula.FORMULA_RESULT_TYPE.DATE) { | ||
// data is stored in the data of the current column | ||
var _ref8 = data || {}, | ||
_format = _ref8.format; | ||
return date.getDateDisplayString(cellValue, _format); | ||
} | ||
// FORMULA_RESULT_TYPE.ARRAY | ||
return _getArrayColumnCellValue(cellValue, column$1, { | ||
collaborators: collaborators, | ||
isArchiveView: isArchiveView | ||
}); | ||
} | ||
case cellType.CellType.FILE: | ||
case cellType.CellType.IMAGE: | ||
case cellType.CellType.BUTTON: | ||
{ | ||
return ''; | ||
} | ||
default: | ||
{ | ||
return cellValue ? String(cellValue) : ''; | ||
} | ||
} | ||
}; | ||
exports.getCellValueDisplayString = getCellValueDisplayString; | ||
exports.getCellValueStringResult = getCellValueStringResult; | ||
exports.getFormulaDisplayString = getFormulaDisplayString; |
@@ -5,12 +5,6 @@ 'use strict'; | ||
var getCollaborator = function getCollaborator(collaborators, collaboratorEmail) { | ||
return collaborators.find(function (collaborator) { | ||
return collaborator.email === collaboratorEmail; | ||
}); | ||
}; | ||
/** | ||
* Get collaborators name list of given emails | ||
* @param {array} emails e.g. ['email', ...] | ||
* @param {array} collaborators e.g. [{ email, name, ... }, ...] | ||
* @param {array} collaborators e.g. [{ email: 'xxx', name: 'xxx' }, ...] | ||
* @returns name list, array. e.g. ['name1', 'name2'] | ||
@@ -34,3 +28,3 @@ */ | ||
* Get concatenated collaborators names of given emails. | ||
* @param {array} collaborators e.g. [{ email, name, ... }, ...] | ||
* @param {array} collaborators e.g. [{ email: 'xxx', name: 'xxx' }, ...] | ||
* @param {array} emails e.g. ['email', ...] | ||
@@ -45,4 +39,3 @@ * @returns concatenated collaborators names, string. e.g. 'name1, name2' | ||
exports.getCollaborator = getCollaborator; | ||
exports.getCollaboratorsName = getCollaboratorsName; | ||
exports.getCollaboratorsNames = getCollaboratorsNames; |
@@ -7,3 +7,3 @@ 'use strict'; | ||
* Get signature image url to display | ||
* @param {object} digitalSign object, e.g. { sign_image_url, ... } | ||
* @param {object} digitalSign object, e.g. { sign_image_url: 'xxx' } | ||
* @returns signature image url, string | ||
@@ -10,0 +10,0 @@ */ |
@@ -90,2 +90,3 @@ 'use strict'; | ||
exports.getDurationDecimalSuffix = getDurationDecimalSuffix; | ||
exports.getDurationDisplayString = getDurationDisplayString; |
@@ -5,4 +5,5 @@ 'use strict'; | ||
var group = require('../constants/group.js'); | ||
var geolocation = require('../validate/geolocation.js'); | ||
var isValidPosition = function isValidPosition(lng, lat) { | ||
return (lng || lng === 0) && (lat || lat === 0); | ||
}; | ||
@@ -12,3 +13,3 @@ /** | ||
* @param {object} loc | ||
* @param {object} formats , e.g. { geo_format, ... } | ||
* @param {object} formats , e.g. { geo_format: 'xxx' } | ||
* @param {bool} isBaiduMap Determine the way to connect latitude and longitude. Default as true | ||
@@ -35,3 +36,3 @@ * @param {string} hyphen Used as a connector between province, city, district and detail. Default as empty string | ||
lat = _ref3.lat; | ||
if (!geolocation.isValidPosition(lng, lat)) return ''; | ||
if (!isValidPosition(lng, lat)) return ''; | ||
return isBaiduMap ? "".concat(lng, ", ").concat(lat) : "".concat(lat, ", ").concat(lng); | ||
@@ -86,29 +87,3 @@ } | ||
}; | ||
var getGeolocationByGranularity = function getGeolocationByGranularity(geolocation, granularity) { | ||
if (!geolocation) return ''; | ||
var province = geolocation.province, | ||
city = geolocation.city, | ||
district = geolocation.district, | ||
country_region = geolocation.country_region; | ||
switch (granularity) { | ||
case group.GROUP_GEOLOCATION_GRANULARITY.CITY: | ||
{ | ||
return city || ''; | ||
} | ||
case group.GROUP_GEOLOCATION_GRANULARITY.DISTRICT: | ||
{ | ||
return district || ''; | ||
} | ||
case group.GROUP_GEOLOCATION_GRANULARITY.COUNTRY: | ||
{ | ||
return country_region || ''; | ||
} | ||
default: | ||
{ | ||
return province || ''; | ||
} | ||
} | ||
}; | ||
exports.getGeolocationByGranularity = getGeolocationByGranularity; | ||
exports.getGeolocationDisplayString = getGeolocationDisplayString; |
@@ -7,3 +7,3 @@ 'use strict'; | ||
* Get text from long-text to display. | ||
* @param {object} longText e.g. { text, ... } | ||
* @param {object} longText e.g. { text: 'xxx' } | ||
* @returns text from long-text, string | ||
@@ -10,0 +10,0 @@ */ |
@@ -6,4 +6,4 @@ 'use strict'; | ||
var index = require('../helper/number-precision/index.js'); | ||
var column = require('../constants/column.js'); | ||
var duration = require('./duration.js'); | ||
var column = require('../constants/column.js'); | ||
@@ -16,26 +16,2 @@ var separatorMap = { | ||
}; | ||
var _getDecimalDigits = function _getDecimalDigits(num) { | ||
if (Number.isInteger(num)) { | ||
return 0; | ||
} | ||
var valueArr = (num + '').split('.'); | ||
var digitsLength = valueArr[1] ? valueArr[1].length : 8; | ||
return digitsLength > 8 ? 8 : digitsLength; | ||
}; | ||
var getPrecisionNumber = function getPrecisionNumber(num, formatData) { | ||
var _ref = formatData || {}, | ||
_ref$precision = _ref.precision, | ||
precision = _ref$precision === void 0 ? 2 : _ref$precision, | ||
_ref$enable_precision = _ref.enable_precision, | ||
enable_precision = _ref$enable_precision === void 0 ? false : _ref$enable_precision; | ||
var type = Object.prototype.toString.call(num); | ||
if (type !== '[object Number]') { | ||
if (type === '[object String]' && DISPLAY_INTERNAL_ERRORS.includes(num)) { | ||
return num; | ||
} | ||
return null; | ||
} | ||
var decimalDigits = enable_precision ? precision : _getDecimalDigits(num); | ||
return num.toFixed(decimalDigits); | ||
}; | ||
@@ -67,15 +43,15 @@ /** | ||
}; | ||
var toThousands = function toThousands(number, _ref2) { | ||
var formats = _ref2.formats, | ||
_ref2$isCurrency = _ref2.isCurrency, | ||
isCurrency = _ref2$isCurrency === void 0 ? true : _ref2$isCurrency; | ||
var _ref3 = formats || {}, | ||
_ref3$decimal = _ref3.decimal, | ||
decimal = _ref3$decimal === void 0 ? 'dot' : _ref3$decimal, | ||
_ref3$thousands = _ref3.thousands, | ||
thousands = _ref3$thousands === void 0 ? 'no' : _ref3$thousands, | ||
_ref3$precision = _ref3.precision, | ||
precision = _ref3$precision === void 0 ? 2 : _ref3$precision, | ||
_ref3$enable_precisio = _ref3.enable_precision, | ||
enable_precision = _ref3$enable_precisio === void 0 ? false : _ref3$enable_precisio; | ||
var toThousands = function toThousands(number, _ref) { | ||
var formats = _ref.formats, | ||
_ref$isCurrency = _ref.isCurrency, | ||
isCurrency = _ref$isCurrency === void 0 ? true : _ref$isCurrency; | ||
var _ref2 = formats || {}, | ||
_ref2$decimal = _ref2.decimal, | ||
decimal = _ref2$decimal === void 0 ? 'dot' : _ref2$decimal, | ||
_ref2$thousands = _ref2.thousands, | ||
thousands = _ref2$thousands === void 0 ? 'no' : _ref2$thousands, | ||
_ref2$precision = _ref2.precision, | ||
precision = _ref2$precision === void 0 ? 2 : _ref2$precision, | ||
_ref2$enable_precisio = _ref2.enable_precision, | ||
enable_precision = _ref2$enable_precisio === void 0 ? false : _ref2$enable_precisio; | ||
@@ -152,5 +128,5 @@ // handle numbers in scientific notation | ||
// formats: old version maybe 'null' | ||
var _ref4 = formats || {}, | ||
_ref4$format = _ref4.format, | ||
format = _ref4$format === void 0 ? column.DEFAULT_NUMBER_FORMAT : _ref4$format; | ||
var _ref3 = formats || {}, | ||
_ref3$format = _ref3.format, | ||
format = _ref3$format === void 0 ? column.DEFAULT_NUMBER_FORMAT : _ref3$format; | ||
switch (format) { | ||
@@ -255,3 +231,2 @@ case 'number': | ||
exports.getNumberDisplayString = getNumberDisplayString; | ||
exports.getPrecisionNumber = getPrecisionNumber; | ||
exports.replaceNumberNotAllowInput = replaceNumberNotAllowInput; |
@@ -5,25 +5,15 @@ 'use strict'; | ||
var option = require('../column/option.js'); | ||
var getOption = function getOption(options, optionId) { | ||
return options.find(function (o) { | ||
return o.id === optionId; | ||
}); | ||
}; | ||
/** | ||
* Get option name of the given id | ||
* @param {array} options e.g. [ { id: '', color: '', name: '' } ] | ||
* @param {string} targetOptionId option id | ||
* @param {string} targetOptionID option id | ||
* @returns option name, string | ||
*/ | ||
var getOptionName = function getOptionName(options, targetOptionId) { | ||
if (!targetOptionId || !Array.isArray(options)) return ''; | ||
var targetOption = getOption(options, targetOptionId); | ||
var getOptionName = function getOptionName(options, targetOptionID) { | ||
if (!targetOptionID || !Array.isArray(options)) return ''; | ||
var targetOption = options.find(function (option) { | ||
return option.id === targetOptionID; | ||
}); | ||
return targetOption ? targetOption.name : ''; | ||
}; | ||
var getColumnOptionNameById = function getColumnOptionNameById(column, optionId) { | ||
var options = option.getColumnOptions(column); | ||
return getOptionName(options, optionId); | ||
}; | ||
@@ -47,5 +37,3 @@ /** | ||
exports.getColumnOptionNameById = getColumnOptionNameById; | ||
exports.getMultipleOptionName = getMultipleOptionName; | ||
exports.getOption = getOption; | ||
exports.getOptionName = getOptionName; |
@@ -6,4 +6,2 @@ 'use strict'; | ||
var index = require('../helper/number-precision/index.js'); | ||
var number = require('../number.js'); | ||
var column = require('../constants/column.js'); | ||
@@ -60,54 +58,3 @@ /** | ||
/** | ||
* parse duration to seconds depend on formats | ||
* @param {string} duration | ||
* @param {object} data { duration_format: '' } | ||
* @returns number | ||
*/ | ||
var formatDurationToNumber = function formatDurationToNumber(duration, data) { | ||
if (duration === 0) return 0; | ||
if (!duration) return null; | ||
var _ref2 = data || {}, | ||
duration_format = _ref2.duration_format; | ||
duration_format = duration_format || column.DURATION_FORMATS_MAP.H_MM; | ||
if (column.DURATION_FORMATS.findIndex(function (format) { | ||
return format.type === duration_format; | ||
}) < 0) { | ||
return null; | ||
} | ||
var numericDuration = duration - 0; | ||
if (number.isNumber(numericDuration)) { | ||
return duration_format === column.DURATION_FORMATS_MAP.H_MM ? numericDuration * 60 : numericDuration; | ||
} | ||
var stringifyDuration = String(duration); | ||
var isNegative = stringifyDuration[0] === '-'; | ||
if (isNegative) { | ||
stringifyDuration = stringifyDuration.substring(1); | ||
} | ||
var timeParts = stringifyDuration.split(/[::]/); // support ':' and ':'. | ||
var timePartsLen = timeParts.length; | ||
var hoursIndex; | ||
var minutesIndex; | ||
var secondsIndex; | ||
if (duration_format === column.DURATION_FORMATS_MAP.H_MM) { | ||
hoursIndex = timePartsLen - 2; | ||
minutesIndex = timePartsLen - 1; | ||
} else { | ||
hoursIndex = timePartsLen - 3; | ||
minutesIndex = timePartsLen - 2; | ||
secondsIndex = timePartsLen - 1; | ||
} | ||
var hours = timeParts[hoursIndex] - 0; | ||
var minutes = timeParts[minutesIndex] - 0; | ||
var seconds = timeParts[secondsIndex] - 0; | ||
if (!number.isNumber(hours) && !number.isNumber(minutes) && !number.isNumber(seconds)) return null; | ||
hours = number.isNumber(hours) ? hours : 0; | ||
minutes = number.isNumber(minutes) ? minutes : 0; | ||
seconds = number.isNumber(seconds) ? seconds : 0; | ||
var result = hours * 3600 + minutes * 60 + seconds; | ||
return isNegative ? -result : result; | ||
}; | ||
exports.formatDurationToNumber = formatDurationToNumber; | ||
exports.formatStringToNumber = formatStringToNumber; | ||
exports.getFloatNumber = getFloatNumber; |
@@ -5,3 +5,3 @@ 'use strict'; | ||
var core = require('./core.js'); | ||
var common = require('./common.js'); | ||
var column = require('../constants/column.js'); | ||
@@ -18,5 +18,5 @@ | ||
var isDateColumn = function isDateColumn(column$1) { | ||
return column.DATE_COLUMN_OPTIONS.includes(core.getColumnType(column$1)); | ||
return column.DATE_COLUMN_OPTIONS.includes(common.getColumnType(column$1)); | ||
}; | ||
exports.isDateColumn = isDateColumn; |
@@ -5,3 +5,3 @@ 'use strict'; | ||
var core = require('./core.js'); | ||
var common = require('./common.js'); | ||
var cellType = require('../constants/cell-type.js'); | ||
@@ -19,3 +19,3 @@ var column = require('../constants/column.js'); | ||
var isNumericColumn = function isNumericColumn(column$1) { | ||
return column.NUMERIC_COLUMNS_TYPES.includes(core.getColumnType(column$1)); | ||
return column.NUMERIC_COLUMNS_TYPES.includes(common.getColumnType(column$1)); | ||
}; | ||
@@ -32,3 +32,3 @@ | ||
var isNumberColumn = function isNumberColumn(column) { | ||
return core.getColumnType(column) === cellType.CellType.NUMBER; | ||
return common.getColumnType(column) === cellType.CellType.NUMBER; | ||
}; | ||
@@ -35,0 +35,0 @@ |
@@ -5,8 +5,2 @@ 'use strict'; | ||
var _typeof = require('@babel/runtime/helpers/typeof'); | ||
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; } | ||
var _typeof__default = /*#__PURE__*/_interopDefaultLegacy(_typeof); | ||
/** | ||
@@ -26,11 +20,15 @@ * Generate a random string of specified length. | ||
}; | ||
var isEmpty = function isEmpty(val) { | ||
if (val == null) return true; | ||
if (val.length !== undefined) return val.length === 0; | ||
if (val instanceof Date) return false; | ||
if (_typeof__default["default"](val) === 'object') return Object.keys(val).length === 0; | ||
return false; | ||
var isNumber = function isNumber(num) { | ||
return (num || num === 0) && Object.prototype.toString.call(num) === '[object Number]'; | ||
}; | ||
var isEmptyObject = function isEmptyObject(obj) { | ||
var name; | ||
for (name in obj) { | ||
return false; | ||
} | ||
return true; | ||
}; | ||
exports.generatorBase64Code = generatorBase64Code; | ||
exports.isEmpty = isEmpty; | ||
exports.isEmptyObject = isEmptyObject; | ||
exports.isNumber = isNumber; |
@@ -12,113 +12,4 @@ 'use strict'; | ||
var _COLUMNS_ICON_CONFIG, _DURATION_DECIMAL_DIG, _DURATION_ZERO_DISPLA, _NOT_SUPPORT_EDIT_COL, _MULTIPLE_CELL_VALUE_, _SINGLE_CELL_VALUE_CO; | ||
var _COLUMNS_ICON_CONFIG, _DURATION_DECIMAL_DIG, _DURATION_ZERO_DISPLA; | ||
var COLUMNS_ICON_CONFIG = (_COLUMNS_ICON_CONFIG = {}, _defineProperty__default["default"](_COLUMNS_ICON_CONFIG, cellType.CellType.DEFAULT, 'dtable-font dtable-icon-single-line-text'), _defineProperty__default["default"](_COLUMNS_ICON_CONFIG, cellType.CellType.TEXT, 'dtable-font dtable-icon-single-line-text'), _defineProperty__default["default"](_COLUMNS_ICON_CONFIG, cellType.CellType.NUMBER, 'dtable-font dtable-icon-number'), _defineProperty__default["default"](_COLUMNS_ICON_CONFIG, cellType.CellType.CHECKBOX, 'dtable-font dtable-icon-check-square-solid'), _defineProperty__default["default"](_COLUMNS_ICON_CONFIG, cellType.CellType.DATE, 'dtable-font dtable-icon-calendar-alt-solid'), _defineProperty__default["default"](_COLUMNS_ICON_CONFIG, cellType.CellType.SINGLE_SELECT, 'dtable-font dtable-icon-single-election'), _defineProperty__default["default"](_COLUMNS_ICON_CONFIG, cellType.CellType.LONG_TEXT, 'dtable-font dtable-icon-long-text'), _defineProperty__default["default"](_COLUMNS_ICON_CONFIG, cellType.CellType.IMAGE, 'dtable-font dtable-icon-picture'), _defineProperty__default["default"](_COLUMNS_ICON_CONFIG, cellType.CellType.FILE, 'dtable-font dtable-icon-file-alt-solid'), _defineProperty__default["default"](_COLUMNS_ICON_CONFIG, cellType.CellType.MULTIPLE_SELECT, 'dtable-font dtable-icon-multiple-selection'), _defineProperty__default["default"](_COLUMNS_ICON_CONFIG, cellType.CellType.COLLABORATOR, 'dtable-font dtable-icon-collaborator'), _defineProperty__default["default"](_COLUMNS_ICON_CONFIG, cellType.CellType.LINK, 'dtable-font dtable-icon-link-other-record'), _defineProperty__default["default"](_COLUMNS_ICON_CONFIG, cellType.CellType.FORMULA, 'dtable-font dtable-icon-formula'), _defineProperty__default["default"](_COLUMNS_ICON_CONFIG, cellType.CellType.LINK_FORMULA, 'dtable-font dtable-icon-link-formulas'), _defineProperty__default["default"](_COLUMNS_ICON_CONFIG, cellType.CellType.CREATOR, 'dtable-font dtable-icon-creator'), _defineProperty__default["default"](_COLUMNS_ICON_CONFIG, cellType.CellType.CTIME, 'dtable-font dtable-icon-creation-time'), _defineProperty__default["default"](_COLUMNS_ICON_CONFIG, cellType.CellType.LAST_MODIFIER, 'dtable-font dtable-icon-creator'), _defineProperty__default["default"](_COLUMNS_ICON_CONFIG, cellType.CellType.MTIME, 'dtable-font dtable-icon-creation-time'), _defineProperty__default["default"](_COLUMNS_ICON_CONFIG, cellType.CellType.GEOLOCATION, 'dtable-font dtable-icon-location'), _defineProperty__default["default"](_COLUMNS_ICON_CONFIG, cellType.CellType.AUTO_NUMBER, 'dtable-font dtable-icon-autonumber'), _defineProperty__default["default"](_COLUMNS_ICON_CONFIG, cellType.CellType.URL, 'dtable-font dtable-icon-url'), _defineProperty__default["default"](_COLUMNS_ICON_CONFIG, cellType.CellType.EMAIL, 'dtable-font dtable-icon-email'), _defineProperty__default["default"](_COLUMNS_ICON_CONFIG, cellType.CellType.DURATION, 'dtable-font dtable-icon-duration'), _defineProperty__default["default"](_COLUMNS_ICON_CONFIG, cellType.CellType.BUTTON, 'dtable-font dtable-icon-button'), _defineProperty__default["default"](_COLUMNS_ICON_CONFIG, cellType.CellType.RATE, 'dtable-font dtable-icon-rate'), _defineProperty__default["default"](_COLUMNS_ICON_CONFIG, cellType.CellType.DIGITAL_SIGN, 'dtable-font dtable-icon-handwritten-signature'), _COLUMNS_ICON_CONFIG); | ||
var COLUMN_OPTIONS = [{ | ||
iconName: 'Basic', | ||
iconClass: '', | ||
isDisabled: true | ||
}, { | ||
iconName: 'Text', | ||
iconClass: COLUMNS_ICON_CONFIG[cellType.CellType.TEXT], | ||
type: cellType.CellType.TEXT | ||
}, { | ||
iconName: 'Long_Text', | ||
iconClass: COLUMNS_ICON_CONFIG[cellType.CellType.LONG_TEXT], | ||
type: cellType.CellType.LONG_TEXT | ||
}, { | ||
iconName: 'Number', | ||
iconClass: COLUMNS_ICON_CONFIG[cellType.CellType.NUMBER], | ||
type: cellType.CellType.NUMBER | ||
}, { | ||
iconName: 'Collaborator', | ||
iconClass: COLUMNS_ICON_CONFIG[cellType.CellType.COLLABORATOR], | ||
type: cellType.CellType.COLLABORATOR | ||
}, { | ||
iconName: 'Date', | ||
iconClass: COLUMNS_ICON_CONFIG[cellType.CellType.DATE], | ||
type: cellType.CellType.DATE | ||
}, { | ||
iconName: 'Duration', | ||
iconClass: COLUMNS_ICON_CONFIG[cellType.CellType.DURATION], | ||
type: cellType.CellType.DURATION | ||
}, { | ||
iconName: 'Single_Select', | ||
iconClass: COLUMNS_ICON_CONFIG[cellType.CellType.SINGLE_SELECT], | ||
type: cellType.CellType.SINGLE_SELECT | ||
}, { | ||
iconName: 'Multiple_Select', | ||
iconClass: COLUMNS_ICON_CONFIG[cellType.CellType.MULTIPLE_SELECT], | ||
type: cellType.CellType.MULTIPLE_SELECT | ||
}, { | ||
iconName: 'Image', | ||
iconClass: COLUMNS_ICON_CONFIG[cellType.CellType.IMAGE], | ||
type: cellType.CellType.IMAGE | ||
}, { | ||
iconName: 'File', | ||
iconClass: COLUMNS_ICON_CONFIG[cellType.CellType.FILE], | ||
type: cellType.CellType.FILE | ||
}, { | ||
iconName: 'Email', | ||
iconClass: COLUMNS_ICON_CONFIG[cellType.CellType.EMAIL], | ||
type: cellType.CellType.EMAIL | ||
}, { | ||
iconName: 'URL', | ||
iconClass: COLUMNS_ICON_CONFIG[cellType.CellType.URL], | ||
type: cellType.CellType.URL | ||
}, { | ||
iconName: 'Checkbox', | ||
iconClass: COLUMNS_ICON_CONFIG[cellType.CellType.CHECKBOX], | ||
type: cellType.CellType.CHECKBOX | ||
}, { | ||
iconName: 'Rating', | ||
iconClass: COLUMNS_ICON_CONFIG[cellType.CellType.RATE], | ||
type: cellType.CellType.RATE | ||
}, { | ||
iconName: 'Advanced', | ||
iconClass: '', | ||
isDisabled: true | ||
}, { | ||
iconName: 'Formula', | ||
iconClass: COLUMNS_ICON_CONFIG[cellType.CellType.FORMULA], | ||
type: cellType.CellType.FORMULA | ||
}, { | ||
iconName: 'Link_formula', | ||
iconClass: COLUMNS_ICON_CONFIG[cellType.CellType.LINK_FORMULA], | ||
type: cellType.CellType.LINK_FORMULA | ||
}, { | ||
iconName: 'Geolocation', | ||
iconClass: COLUMNS_ICON_CONFIG[cellType.CellType.GEOLOCATION], | ||
type: cellType.CellType.GEOLOCATION | ||
}, { | ||
iconName: 'Link_to_other_records', | ||
iconClass: COLUMNS_ICON_CONFIG[cellType.CellType.LINK], | ||
type: cellType.CellType.LINK | ||
}, { | ||
iconName: 'Creator', | ||
iconClass: COLUMNS_ICON_CONFIG[cellType.CellType.CREATOR], | ||
type: cellType.CellType.CREATOR | ||
}, { | ||
iconName: 'CTime', | ||
iconClass: COLUMNS_ICON_CONFIG[cellType.CellType.CTIME], | ||
type: cellType.CellType.CTIME | ||
}, { | ||
iconName: 'Last_Modifier', | ||
iconClass: COLUMNS_ICON_CONFIG[cellType.CellType.LAST_MODIFIER], | ||
type: cellType.CellType.LAST_MODIFIER | ||
}, { | ||
iconName: 'Last_Modified_Time', | ||
iconClass: COLUMNS_ICON_CONFIG[cellType.CellType.MTIME], | ||
type: cellType.CellType.MTIME | ||
}, { | ||
iconName: 'Auto_number', | ||
iconClass: COLUMNS_ICON_CONFIG[cellType.CellType.AUTO_NUMBER], | ||
type: cellType.CellType.AUTO_NUMBER | ||
}, { | ||
iconName: 'Button', | ||
iconClass: COLUMNS_ICON_CONFIG[cellType.CellType.BUTTON], | ||
type: cellType.CellType.BUTTON | ||
}, { | ||
iconName: 'Digital_signature', | ||
iconClass: COLUMNS_ICON_CONFIG[cellType.CellType.DIGITAL_SIGN], | ||
type: cellType.CellType.DIGITAL_SIGN | ||
}]; | ||
var DATE_COLUMN_OPTIONS = [cellType.CellType.DATE, cellType.CellType.CTIME, cellType.CellType.MTIME]; | ||
@@ -130,3 +21,2 @@ var NUMERIC_COLUMNS_TYPES = [cellType.CellType.NUMBER, cellType.CellType.DURATION, cellType.CellType.RATE]; | ||
var DEFAULT_DATE_FORMAT = 'YYYY-MM-DD'; | ||
var UTC_FORMAT_DEFAULT = 'YYYY-MM-DDTHH:mm:ss.SSSZ'; | ||
var DATE_UNIT = { | ||
@@ -143,7 +33,2 @@ YEAR: 'year', | ||
}; | ||
var DATE_FORMAT_MAP = { | ||
YYYY_MM_DD: 'YYYY-MM-DD', | ||
YYYY_MM_DD_HH_MM: 'YYYY-MM-DD HH:mm', | ||
YYYY_MM_DD_HH_MM_SS: 'YYYY-MM-DD HH:mm:ss' | ||
}; | ||
@@ -170,19 +55,6 @@ // duration | ||
var DEFAULT_NUMBER_FORMAT = 'number'; | ||
var DATE_DEFAULT_TYPES = { | ||
SPECIFIC_DATE: 'specific_date', | ||
CURRENT_DATE: 'current_date', | ||
DAYS_BEFORE: 'days_before', | ||
DAYS_AFTER: 'days_after' | ||
}; | ||
var FILL_DEFAULT_VALUE_COLUMNS_TYPE = [cellType.CellType.TEXT, cellType.CellType.NUMBER, cellType.CellType.SINGLE_SELECT, cellType.CellType.RATE, cellType.CellType.CHECKBOX, cellType.CellType.LONG_TEXT, cellType.CellType.DATE, cellType.CellType.COLLABORATOR]; | ||
var NOT_SUPPORT_EDIT_COLUMN_TYPE_MAP = (_NOT_SUPPORT_EDIT_COL = {}, _defineProperty__default["default"](_NOT_SUPPORT_EDIT_COL, cellType.CellType.CTIME, true), _defineProperty__default["default"](_NOT_SUPPORT_EDIT_COL, cellType.CellType.MTIME, true), _defineProperty__default["default"](_NOT_SUPPORT_EDIT_COL, cellType.CellType.CREATOR, true), _defineProperty__default["default"](_NOT_SUPPORT_EDIT_COL, cellType.CellType.LAST_MODIFIER, true), _defineProperty__default["default"](_NOT_SUPPORT_EDIT_COL, cellType.CellType.FORMULA, true), _defineProperty__default["default"](_NOT_SUPPORT_EDIT_COL, cellType.CellType.AUTO_NUMBER, true), _defineProperty__default["default"](_NOT_SUPPORT_EDIT_COL, cellType.CellType.BUTTON, true), _defineProperty__default["default"](_NOT_SUPPORT_EDIT_COL, cellType.CellType.LINK_FORMULA, true), _NOT_SUPPORT_EDIT_COL); | ||
var MULTIPLE_CELL_VALUE_COLUMN_TYPE_MAP = (_MULTIPLE_CELL_VALUE_ = {}, _defineProperty__default["default"](_MULTIPLE_CELL_VALUE_, cellType.CellType.MULTIPLE_SELECT, true), _defineProperty__default["default"](_MULTIPLE_CELL_VALUE_, cellType.CellType.COLLABORATOR, true), _defineProperty__default["default"](_MULTIPLE_CELL_VALUE_, cellType.CellType.LINK, true), _MULTIPLE_CELL_VALUE_); | ||
var SINGLE_CELL_VALUE_COLUMN_TYPE_MAP = (_SINGLE_CELL_VALUE_CO = {}, _defineProperty__default["default"](_SINGLE_CELL_VALUE_CO, cellType.CellType.TEXT, true), _defineProperty__default["default"](_SINGLE_CELL_VALUE_CO, cellType.CellType.DATE, true), _defineProperty__default["default"](_SINGLE_CELL_VALUE_CO, cellType.CellType.CTIME, true), _defineProperty__default["default"](_SINGLE_CELL_VALUE_CO, cellType.CellType.MTIME, true), _defineProperty__default["default"](_SINGLE_CELL_VALUE_CO, cellType.CellType.NUMBER, true), _defineProperty__default["default"](_SINGLE_CELL_VALUE_CO, cellType.CellType.CHECKBOX, true), _defineProperty__default["default"](_SINGLE_CELL_VALUE_CO, cellType.CellType.SINGLE_SELECT, true), _defineProperty__default["default"](_SINGLE_CELL_VALUE_CO, cellType.CellType.CREATOR, true), _defineProperty__default["default"](_SINGLE_CELL_VALUE_CO, cellType.CellType.GEOLOCATION, true), _defineProperty__default["default"](_SINGLE_CELL_VALUE_CO, cellType.CellType.FORMULA, true), _defineProperty__default["default"](_SINGLE_CELL_VALUE_CO, cellType.CellType.LINK_FORMULA, true), _defineProperty__default["default"](_SINGLE_CELL_VALUE_CO, cellType.CellType.URL, true), _defineProperty__default["default"](_SINGLE_CELL_VALUE_CO, cellType.CellType.EMAIL, true), _defineProperty__default["default"](_SINGLE_CELL_VALUE_CO, cellType.CellType.DURATION, true), _defineProperty__default["default"](_SINGLE_CELL_VALUE_CO, cellType.CellType.RATE, true), _defineProperty__default["default"](_SINGLE_CELL_VALUE_CO, cellType.CellType.LAST_MODIFIER, true), _defineProperty__default["default"](_SINGLE_CELL_VALUE_CO, cellType.CellType.DIGITAL_SIGN, true), _SINGLE_CELL_VALUE_CO); | ||
exports.COLLABORATOR_COLUMN_TYPES = COLLABORATOR_COLUMN_TYPES; | ||
exports.COLUMNS_ICON_CONFIG = COLUMNS_ICON_CONFIG; | ||
exports.COLUMN_OPTIONS = COLUMN_OPTIONS; | ||
exports.DATE_COLUMN_OPTIONS = DATE_COLUMN_OPTIONS; | ||
exports.DATE_DEFAULT_TYPES = DATE_DEFAULT_TYPES; | ||
exports.DATE_FORMAT_MAP = DATE_FORMAT_MAP; | ||
exports.DATE_UNIT = DATE_UNIT; | ||
@@ -195,7 +67,2 @@ exports.DEFAULT_DATE_FORMAT = DEFAULT_DATE_FORMAT; | ||
exports.DURATION_ZERO_DISPLAY = DURATION_ZERO_DISPLAY; | ||
exports.FILL_DEFAULT_VALUE_COLUMNS_TYPE = FILL_DEFAULT_VALUE_COLUMNS_TYPE; | ||
exports.MULTIPLE_CELL_VALUE_COLUMN_TYPE_MAP = MULTIPLE_CELL_VALUE_COLUMN_TYPE_MAP; | ||
exports.NOT_SUPPORT_EDIT_COLUMN_TYPE_MAP = NOT_SUPPORT_EDIT_COLUMN_TYPE_MAP; | ||
exports.NUMERIC_COLUMNS_TYPES = NUMERIC_COLUMNS_TYPES; | ||
exports.SINGLE_CELL_VALUE_COLUMN_TYPE_MAP = SINGLE_CELL_VALUE_COLUMN_TYPE_MAP; | ||
exports.UTC_FORMAT_DEFAULT = UTC_FORMAT_DEFAULT; |
@@ -10,6 +10,2 @@ 'use strict'; | ||
var FILTER_CONJUNCTION_TYPE = { | ||
AND: 'And', | ||
OR: 'Or' | ||
}; | ||
var FILTER_ERR_MSG = { | ||
@@ -32,3 +28,2 @@ INVALID_FILTER: 'invalid filter', | ||
exports.filterTermModifierNotWithin = filterIsWithin.filterTermModifierNotWithin; | ||
exports.FILTER_CONJUNCTION_TYPE = FILTER_CONJUNCTION_TYPE; | ||
exports.FILTER_ERR_MSG = FILTER_ERR_MSG; |
184
lib/index.js
@@ -10,17 +10,3 @@ 'use strict'; | ||
var selectOption = require('./constants/select-option.js'); | ||
var sort = require('./constants/sort.js'); | ||
var group = require('./constants/group.js'); | ||
var columnPermission = require('./constants/column-permission.js'); | ||
var reg = require('./constants/reg.js'); | ||
var color = require('./constants/color.js'); | ||
var gridHeader = require('./constants/grid-header.js'); | ||
var common = require('./common.js'); | ||
var index$1 = require('./table/index.js'); | ||
var core = require('./row/core.js'); | ||
var color$1 = require('./row/color.js'); | ||
var core$1 = require('./view/core.js'); | ||
var summaries = require('./view/summaries.js'); | ||
var formula$1 = require('./view/formula.js'); | ||
var group$1 = require('./view/group.js'); | ||
var core$2 = require('./link/core.js'); | ||
var date = require('./cell-value-get/date.js'); | ||
@@ -35,45 +21,9 @@ var duration = require('./cell-value-get/duration.js'); | ||
var cellValue = require('./cell-value-get/cell-value.js'); | ||
var rate = require('./cell-value-get/rate.js'); | ||
var number$1 = require('./cell-value-set/number.js'); | ||
var date$1 = require('./cell-value-set/date.js'); | ||
var option$1 = require('./column/option.js'); | ||
var date$2 = require('./column/date.js'); | ||
var common$1 = require('./column/common.js'); | ||
var date$1 = require('./column/date.js'); | ||
var number$2 = require('./column/number.js'); | ||
var color$2 = require('./column/color.js'); | ||
var date$3 = require('./date.js'); | ||
var number$3 = require('./number.js'); | ||
var date$2 = require('./date.js'); | ||
var filter = require('./validate/filter.js'); | ||
var email = require('./validate/email.js'); | ||
var geolocation$1 = require('./validate/geolocation.js'); | ||
var core$3 = require('./filter/core.js'); | ||
var checkbox = require('./filter/filter-column/checkbox.js'); | ||
var collaborator$1 = require('./filter/filter-column/collaborator.js'); | ||
var creator = require('./filter/filter-column/creator.js'); | ||
var date$4 = require('./filter/filter-column/date.js'); | ||
var digitalSign$1 = require('./filter/filter-column/digital-sign.js'); | ||
var file = require('./filter/filter-column/file.js'); | ||
var formula$2 = require('./filter/filter-column/formula.js'); | ||
var geolocation$2 = require('./filter/filter-column/geolocation.js'); | ||
var text = require('./filter/filter-column/text.js'); | ||
var longText$1 = require('./filter/filter-column/long-text.js'); | ||
var multipleSelect = require('./filter/filter-column/multiple-select.js'); | ||
var number$4 = require('./filter/filter-column/number.js'); | ||
var singleSelect = require('./filter/filter-column/single-select.js'); | ||
var link = require('./filter/filter-column/link.js'); | ||
var filterRow = require('./filter/filter-row.js'); | ||
var core$4 = require('./sort/core.js'); | ||
var checkbox$1 = require('./sort/sort-column/checkbox.js'); | ||
var collaborator$2 = require('./sort/sort-column/collaborator.js'); | ||
var date$5 = require('./sort/sort-column/date.js'); | ||
var array = require('./sort/sort-column/array.js'); | ||
var formula$3 = require('./sort/sort-column/formula.js'); | ||
var link$1 = require('./sort/sort-column/link.js'); | ||
var multipleSelect$1 = require('./sort/sort-column/multiple-select.js'); | ||
var number$5 = require('./sort/sort-column/number.js'); | ||
var singleSelect$1 = require('./sort/sort-column/single-select.js'); | ||
var text$1 = require('./sort/sort-column/text.js'); | ||
var sortRow = require('./sort/sort-row.js'); | ||
var core$5 = require('./group/core.js'); | ||
var groupRow = require('./group/group-row.js'); | ||
var gradientColor = require('./color/gradient-color.js'); | ||
var filterColumnOptions = require('./constants/filter/filter-column-options.js'); | ||
@@ -83,4 +33,2 @@ var filterModifier = require('./constants/filter/filter-modifier.js'); | ||
var filterIsWithin = require('./constants/filter/filter-is-within.js'); | ||
var column$1 = require('./table/column.js'); | ||
var row = require('./table/row.js'); | ||
@@ -92,7 +40,3 @@ | ||
exports.COLUMNS_ICON_CONFIG = column.COLUMNS_ICON_CONFIG; | ||
exports.COLUMN_OPTIONS = column.COLUMN_OPTIONS; | ||
exports.DATE_COLUMN_OPTIONS = column.DATE_COLUMN_OPTIONS; | ||
exports.DATE_DEFAULT_TYPES = column.DATE_DEFAULT_TYPES; | ||
exports.DATE_FORMAT_MAP = column.DATE_FORMAT_MAP; | ||
exports.DATE_UNIT = column.DATE_UNIT; | ||
exports.DEFAULT_DATE_FORMAT = column.DEFAULT_DATE_FORMAT; | ||
@@ -104,9 +48,3 @@ exports.DEFAULT_NUMBER_FORMAT = column.DEFAULT_NUMBER_FORMAT; | ||
exports.DURATION_ZERO_DISPLAY = column.DURATION_ZERO_DISPLAY; | ||
exports.FILL_DEFAULT_VALUE_COLUMNS_TYPE = column.FILL_DEFAULT_VALUE_COLUMNS_TYPE; | ||
exports.MULTIPLE_CELL_VALUE_COLUMN_TYPE_MAP = column.MULTIPLE_CELL_VALUE_COLUMN_TYPE_MAP; | ||
exports.NOT_SUPPORT_EDIT_COLUMN_TYPE_MAP = column.NOT_SUPPORT_EDIT_COLUMN_TYPE_MAP; | ||
exports.NUMERIC_COLUMNS_TYPES = column.NUMERIC_COLUMNS_TYPES; | ||
exports.SINGLE_CELL_VALUE_COLUMN_TYPE_MAP = column.SINGLE_CELL_VALUE_COLUMN_TYPE_MAP; | ||
exports.UTC_FORMAT_DEFAULT = column.UTC_FORMAT_DEFAULT; | ||
exports.FILTER_CONJUNCTION_TYPE = index.FILTER_CONJUNCTION_TYPE; | ||
exports.FILTER_ERR_MSG = index.FILTER_ERR_MSG; | ||
@@ -117,55 +55,13 @@ exports.FORMULA_COLUMN_TYPES_MAP = formula.FORMULA_COLUMN_TYPES_MAP; | ||
exports.SELECT_OPTION_COLORS = selectOption.SELECT_OPTION_COLORS; | ||
exports.NUMBER_SORTER_COLUMN_TYPES = sort.NUMBER_SORTER_COLUMN_TYPES; | ||
exports.SORT_COLUMN_OPTIONS = sort.SORT_COLUMN_OPTIONS; | ||
exports.SORT_TYPE = sort.SORT_TYPE; | ||
exports.TEXT_SORTER_COLUMN_TYPES = sort.TEXT_SORTER_COLUMN_TYPES; | ||
exports.DISPLAY_GROUP_DATE_GRANULARITY = group.DISPLAY_GROUP_DATE_GRANULARITY; | ||
exports.DISPLAY_GROUP_GEOLOCATION_GRANULARITY = group.DISPLAY_GROUP_GEOLOCATION_GRANULARITY; | ||
exports.GROUP_DATE_GRANULARITY = group.GROUP_DATE_GRANULARITY; | ||
exports.GROUP_GEOLOCATION_GRANULARITY = group.GROUP_GEOLOCATION_GRANULARITY; | ||
exports.MAX_GROUP_LEVEL = group.MAX_GROUP_LEVEL; | ||
exports.SUPPORT_GROUP_COLUMN_TYPES = group.SUPPORT_GROUP_COLUMN_TYPES; | ||
exports.COLUMN_PERMISSION_TYPE = columnPermission.COLUMN_PERMISSION_TYPE; | ||
exports.REG_NUMBER_DIGIT = reg.REG_NUMBER_DIGIT; | ||
exports.REG_STRING_NUMBER_PARTS = reg.REG_STRING_NUMBER_PARTS; | ||
exports.COLOR_GRADATION_OPTIONS = color.COLOR_GRADATION_OPTIONS; | ||
exports.HEADER_HEIGHT_TYPE = gridHeader.HEADER_HEIGHT_TYPE; | ||
exports.generatorBase64Code = common.generatorBase64Code; | ||
exports.isEmpty = common.isEmpty; | ||
exports.getTableById = index$1.getTableById; | ||
exports.convertRow = core.convertRow; | ||
exports.isTableRows = core.isTableRows; | ||
exports.RowColorUtils = color$1["default"]; | ||
exports.getLinkColumnsUsedInFilters = core$1.getLinkColumnsUsedInFilters; | ||
exports.getViewById = core$1.getViewById; | ||
exports.isDefaultView = core$1.isDefaultView; | ||
exports.isFilterView = core$1.isFilterView; | ||
exports.isGroupView = core$1.isGroupView; | ||
exports.isSortView = core$1.isSortView; | ||
exports.getSummaries = summaries.getSummaries; | ||
exports.getSummariesWithSubgroups = summaries.getSummariesWithSubgroups; | ||
exports.updateGroupSummaries = summaries.updateGroupSummaries; | ||
exports.getFormulaColumnsContainLinks = formula$1.getFormulaColumnsContainLinks; | ||
exports.getSortedFormulaColumns = formula$1.getSortedFormulaColumns; | ||
exports.getSortedFormulaColumnsContainLinks = formula$1.getSortedFormulaColumnsContainLinks; | ||
exports.transLink2LinkFormula = formula$1.transLink2LinkFormula; | ||
exports.getGroupByPath = group$1.getGroupByPath; | ||
exports.getLinkById = core$2.getLinkById; | ||
exports.getLinkCellValue = core$2.getLinkCellValue; | ||
exports.getLinkTableID = core$2.getLinkTableID; | ||
exports.getLinkedTableID = core$2.getLinkedTableID; | ||
exports.isValidLink = core$2.isValidLink; | ||
exports.isEmptyObject = common.isEmptyObject; | ||
exports.isNumber = common.isNumber; | ||
exports.getDateDisplayString = date.getDateDisplayString; | ||
exports.getDurationDisplayString = duration.getDurationDisplayString; | ||
exports.getNumberDisplayString = number.getNumberDisplayString; | ||
exports.getPrecisionNumber = number.getPrecisionNumber; | ||
exports.replaceNumberNotAllowInput = number.replaceNumberNotAllowInput; | ||
exports.getColumnOptionNameById = option.getColumnOptionNameById; | ||
exports.getMultipleOptionName = option.getMultipleOptionName; | ||
exports.getOption = option.getOption; | ||
exports.getOptionName = option.getOptionName; | ||
exports.getCollaborator = collaborator.getCollaborator; | ||
exports.getCollaboratorsName = collaborator.getCollaboratorsName; | ||
exports.getCollaboratorsNames = collaborator.getCollaboratorsNames; | ||
exports.getGeolocationByGranularity = geolocation.getGeolocationByGranularity; | ||
exports.getGeolocationDisplayString = geolocation.getGeolocationDisplayString; | ||
@@ -175,72 +71,12 @@ exports.getDigitalSignImageUrl = digitalSign.getDigitalSignImageUrl; | ||
exports.getCellValueDisplayString = cellValue.getCellValueDisplayString; | ||
exports.getCellValueStringResult = cellValue.getCellValueStringResult; | ||
exports.getFormulaDisplayString = cellValue.getFormulaDisplayString; | ||
exports.getRateDisplayString = rate.getRateDisplayString; | ||
exports.formatDurationToNumber = number$1.formatDurationToNumber; | ||
exports.formatStringToNumber = number$1.formatStringToNumber; | ||
exports.getFloatNumber = number$1.getFloatNumber; | ||
exports.formatTextToDate = date$1.formatTextToDate; | ||
exports.createOption = option$1.createOption; | ||
exports.generateOptionID = option$1.generateOptionID; | ||
exports.generatorCellOption = option$1.generatorCellOption; | ||
exports.generatorCellOptions = option$1.generatorCellOptions; | ||
exports.getColumnOptions = option$1.getColumnOptions; | ||
exports.isDateColumn = date$2.isDateColumn; | ||
exports.getColumnOptions = common$1.getColumnOptions; | ||
exports.isDateColumn = date$1.isDateColumn; | ||
exports.isNumberColumn = number$2.isNumberColumn; | ||
exports.isNumericColumn = number$2.isNumericColumn; | ||
exports.ColumnColorUtils = color$2["default"]; | ||
exports.DateUtils = date$3.DateUtils; | ||
exports.isNumber = number$3.isNumber; | ||
exports.isNumberEqual = number$3.isNumberEqual; | ||
exports.DateUtils = date$2.DateUtils; | ||
exports.ValidateFilter = filter.ValidateFilter; | ||
exports.isValidEmail = email.isValidEmail; | ||
exports.isValidPosition = geolocation$1.isValidPosition; | ||
exports.deleteInvalidFilter = core$3.deleteInvalidFilter; | ||
exports.getFormattedFilter = core$3.getFormattedFilter; | ||
exports.getFormattedFilterOtherDate = core$3.getFormattedFilterOtherDate; | ||
exports.getFormattedFilters = core$3.getFormattedFilters; | ||
exports.getValidFilters = core$3.getValidFilters; | ||
exports.getValidFiltersWithoutError = core$3.getValidFiltersWithoutError; | ||
exports.otherDate = core$3.otherDate; | ||
exports.checkboxFilter = checkbox.checkboxFilter; | ||
exports.collaboratorFilter = collaborator$1.collaboratorFilter; | ||
exports.creatorFilter = creator.creatorFilter; | ||
exports.dateFilter = date$4.dateFilter; | ||
exports.digitalSignFilter = digitalSign$1.digitalSignFilter; | ||
exports.fileFilter = file.fileFilter; | ||
exports.formulaFilter = formula$2.formulaFilter; | ||
exports.geolocationFilter = geolocation$2.geolocationFilter; | ||
exports.textFilter = text.textFilter; | ||
exports.longTextFilter = longText$1.longTextFilter; | ||
exports.multipleSelectFilter = multipleSelect.multipleSelectFilter; | ||
exports.numberFilter = number$4.numberFilter; | ||
exports.singleSelectFilter = singleSelect.singleSelectFilter; | ||
exports.linkFilter = link.linkFilter; | ||
exports.filterRow = filterRow.filterRow; | ||
exports.filterRows = filterRow.filterRows; | ||
exports.getFilteredRowsWithoutFormulaCalculation = filterRow.getFilteredRowsWithoutFormulaCalculation; | ||
exports.getValidSorts = core$4.getValidSorts; | ||
exports.isValidSort = core$4.isValidSort; | ||
exports.sortCheckbox = checkbox$1.sortCheckbox; | ||
exports.sortCollaborator = collaborator$2.sortCollaborator; | ||
exports.sortDate = date$5.sortDate; | ||
exports.sortByArrayType = array.sortByArrayType; | ||
exports.sortFormula = formula$3.sortFormula; | ||
exports.sortLink = link$1.sortLink; | ||
exports.getMultipleIndexesOrderbyOptions = multipleSelect$1.getMultipleIndexesOrderbyOptions; | ||
exports.sortMultipleSelect = multipleSelect$1.sortMultipleSelect; | ||
exports.sortNumber = number$5.sortNumber; | ||
exports.sortSingleSelect = singleSelect$1.sortSingleSelect; | ||
exports.compareString = text$1.compareString; | ||
exports.sortText = text$1.sortText; | ||
exports.deleteInvalidSort = sortRow.deleteInvalidSort; | ||
exports.sortRowsWithMultiSorts = sortRow.sortRowsWithMultiSorts; | ||
exports.sortTableRows = sortRow.sortTableRows; | ||
exports.deleteInvalidGroupby = core$5.deleteInvalidGroupby; | ||
exports.getValidGroupbys = core$5.getValidGroupbys; | ||
exports.isValidGroupby = core$5.isValidGroupby; | ||
exports.getGroupedRowsWithoutFormulaCalculation = groupRow.getGroupedRowsWithoutFormulaCalculation; | ||
exports.groupTableRows = groupRow.groupTableRows; | ||
exports.groupViewRows = groupRow.groupViewRows; | ||
exports.GradientColorUtils = gradientColor["default"]; | ||
exports.FILTER_COLUMN_OPTIONS = filterColumnOptions.FILTER_COLUMN_OPTIONS; | ||
@@ -253,5 +89,1 @@ exports.FILTER_TERM_MODIFIER_SHOW = filterModifier.FILTER_TERM_MODIFIER_SHOW; | ||
exports.filterTermModifierNotWithin = filterIsWithin.filterTermModifierNotWithin; | ||
exports.getTableColumnByKey = column$1.getTableColumnByKey; | ||
exports.getTableColumnByName = column$1.getTableColumnByName; | ||
exports.getRowById = row.getRowById; | ||
exports.getRowsByIds = row.getRowsByIds; |
@@ -12,3 +12,3 @@ 'use strict'; | ||
var index = require('../constants/filter/index.js'); | ||
var option = require('../column/option.js'); | ||
var common = require('../column/common.js'); | ||
var date = require('../column/date.js'); | ||
@@ -311,3 +311,3 @@ var filterPredicate = require('../constants/filter/filter-predicate.js'); | ||
{ | ||
var options = option.getColumnOptions(filterColumn); | ||
var options = common.getColumnOptions(filterColumn); | ||
if (PREDICATES_REQUIRE_ARRAY_TERM.includes(predicate)) { | ||
@@ -354,3 +354,3 @@ if (!this.isValidTermType(term, TERM_TYPE_MAP.ARRAY)) { | ||
// contains deleted option(s) | ||
var _options = option.getColumnOptions(filterColumn); | ||
var _options = common.getColumnOptions(filterColumn); | ||
return this.isValidSelectedOptions(term, _options); | ||
@@ -357,0 +357,0 @@ } |
{ | ||
"name": "dtable-utils", | ||
"version": "0.0.3-beta.1", | ||
"version": "0.0.3", | ||
"description": "dtable common utils", | ||
@@ -9,4 +9,3 @@ "main": "./lib/index.js", | ||
"scripts": { | ||
"test": "jest -c --watchAll", | ||
"test-cov": "jest --coverage --watchAll", | ||
"test": "jest --coverage --watchAll", | ||
"eslint": "eslint ./src/**", | ||
@@ -28,4 +27,3 @@ "build": "rm -rf dist lib es && rollup -c", | ||
"dependencies": { | ||
"dayjs": "1.10.7", | ||
"deep-copy": "^1.4.2" | ||
"dayjs": "1.10.7" | ||
}, | ||
@@ -32,0 +30,0 @@ "devDependencies": { |
@@ -1,14 +0,4 @@ | ||
<h1>dtable-utils</h1> | ||
# dtable-utils | ||
🔧 common utils | ||
<div> | ||
[![Node CI](https://github.com/seafileltd/dtable-utils/actions/workflows/nodejs.yml/badge.svg)](https://github.com/seafileltd/dtable-utils/actions/workflows/nodejs.yml) | ||
[![npm package](https://img.shields.io/npm/v/dtable-utils/latest.svg)](https://www.npmjs.org/package/dtable-utils) | ||
[![JS size](https://img.badgesize.io/https://unpkg.com/dtable-utils@latest/dist/index.js?label=index.js)](https://unpkg.com/dtable-utils@latest/dist/index.js) | ||
</div> | ||
common utils | ||
## 项目结构 | ||
@@ -31,19 +21,1 @@ ```bash | ||
``` | ||
## 安装 | ||
npm 或 yarn 安装 | ||
```bash | ||
# npm | ||
$ npm install dtable-utils --save | ||
# yarn | ||
$ yarn add dtable-utils | ||
``` | ||
## 使用 | ||
```js | ||
import { CellType } from 'dtable-utils'; | ||
``` |
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
1
203601
59
4189
21
- Removeddeep-copy@^1.4.2
- Removeddeep-copy@1.4.2(transitive)