@scaleflex/widget-utils 4.8.6 → 4.8.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/LinkHelper.js +153 -0
- package/lib/NetworkError.js +30 -0
- package/lib/ProgressTimeout.js +45 -0
- package/lib/RateLimitedQueue.js +197 -0
- package/lib/RequestError.js +38 -0
- package/lib/TranslationMissingKeysConsoleHelper.js +113 -0
- package/lib/Translator.js +200 -0
- package/lib/getLinkWithNewParams.js +13 -0
- package/lib/getMetadataMultiSelectQuery.js +66 -0
- package/lib/getNonce.js +26 -0
- package/lib/getNormalizedItems.js +55 -0
- package/lib/getObjectsMutualProperties.js +32 -0
- package/lib/getRandomNumber.js +12 -0
- package/lib/getSocketHost.js +7 -0
- package/lib/getSpeed.js +8 -0
- package/lib/getTime.js +18 -0
- package/lib/getTimeStamp.js +18 -0
- package/lib/handleError.js +13 -0
- package/lib/handlePressEnter.js +9 -0
- package/lib/handlePromise.js +39 -0
- package/lib/hasProperty.js +3 -0
- package/lib/hexToRgb.js +15 -0
- package/lib/htmlSanitizer.js +6 -0
- package/lib/humanReadableDate.js +45 -0
- package/lib/humanReadableDateWithTranslations.js +29 -0
- package/lib/i18n.client.js +54 -0
- package/lib/ignoreEvent.js +10 -0
- package/lib/index.js +0 -0
- package/lib/injectVirtualPathToFolders.js +24 -0
- package/lib/isAi.js +7 -0
- package/lib/isArchive.js +12 -0
- package/lib/isAudio.js +9 -0
- package/lib/isAudioAndSupportsPlayback.js +10 -0
- package/lib/isCloudimageFastPreviewSupported.js +16 -0
- package/lib/isDOMElement.js +9 -0
- package/lib/isDocument.js +10 -0
- package/lib/isDragDropSupported.js +20 -0
- package/lib/isEmptyObject.js +4 -0
- package/lib/isEps.js +8 -0
- package/lib/isFile.js +5 -0
- package/lib/isFileSupportedByCloudimage.js +14 -0
- package/lib/isFolder.js +4 -0
- package/lib/isFontFile.js +9 -0
- package/lib/isFunction.js +4 -0
- package/lib/isImage.js +11 -0
- package/lib/isJpg.js +8 -0
- package/lib/isMobileDevice.js +12 -0
- package/lib/isNetworkError.js +7 -0
- package/lib/isNumber.js +4 -0
- package/lib/isObjectType.js +5 -0
- package/lib/isObjectURL.js +10 -0
- package/lib/isOpenedFromAdobe.js +3 -0
- package/lib/isOtf.js +10 -0
- package/lib/isPdf.js +9 -0
- package/lib/isPhotoshopFile.js +8 -0
- package/lib/isPreviewSupported.js +12 -0
- package/lib/isPromise.js +5 -0
- package/lib/isPsd.js +8 -0
- package/lib/isScriptFile.js +12 -0
- package/lib/isSupportedVideo.js +8 -0
- package/lib/isSvg.js +5 -0
- package/lib/isTextFile.js +8 -0
- package/lib/isThumbnailCloudimgSupported.js +13 -0
- package/lib/isThumbnailLocallySupported.js +9 -0
- package/lib/isTiff.js +8 -0
- package/lib/isTransparencySupported.js +12 -0
- package/lib/isTtf.js +11 -0
- package/lib/isUploadableFile.js +7 -0
- package/lib/isUrl.js +5 -0
- package/lib/isValidUri.js +18 -0
- package/lib/isVideo.js +8 -0
- package/lib/isVideoResourceIntensive.js +9 -0
- package/lib/literalDateFromDateObj.js +6 -0
- package/lib/logErrorIfDevEnv.js +7 -0
- package/lib/lowercaseFirstLetter.js +4 -0
- package/lib/mapArrayByStep.js +12 -0
- package/lib/mimeTypes.js +60 -0
- package/lib/nanoid.js +18 -0
- package/lib/openLink.js +3 -0
- package/lib/openLinkInNewTab.js +12 -0
- package/lib/prettyETA.js +15 -0
- package/lib/prettyFileSize.js +7 -0
- package/lib/preventDefault.js +4 -0
- package/lib/provideSvgStrWithCurrColor.js +10 -0
- package/lib/recursiveFnCall.js +26 -0
- package/lib/removeAllUrlParams.js +4 -0
- package/lib/removeDuplicatesFromArray.js +20 -0
- package/lib/removeEmptyFolders.js +8 -0
- package/lib/removeFileExtension.js +4 -0
- package/lib/removeUrlParamsWithRegex.js +14 -0
- package/lib/reorder.js +15 -0
- package/lib/requestFile.js +36 -0
- package/lib/rgbToHex.js +4 -0
- package/lib/secondsToTime.js +10 -0
- package/lib/serializeFunction.js +4 -0
- package/lib/settle.js +19 -0
- package/lib/sortEntitiesByName.js +18 -0
- package/lib/splitCamelCase.js +4 -0
- package/lib/splitPathToPathsAndNames.js +25 -0
- package/lib/stopPropagation.js +4 -0
- package/lib/timeZones.js +1 -0
- package/lib/toArray.js +6 -0
- package/lib/toLowerCase.js +5 -0
- package/lib/toggleElementFullscreen.js +27 -0
- package/lib/visibility.js +39 -0
- package/package.json +3 -3
- package/CHANGELOG.md +0 -7431
package/lib/mimeTypes.js
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
// ___Why not add the mime-types package?
|
|
2
|
+
// It's 19.7kB gzipped, and we only need mime types for well-known extensions (for file previews).
|
|
3
|
+
// ___Where to take new extensions from?
|
|
4
|
+
// https://github.com/jshttp/mime-db/blob/master/db.json
|
|
5
|
+
|
|
6
|
+
export default {
|
|
7
|
+
md: 'text/markdown',
|
|
8
|
+
markdown: 'text/markdown',
|
|
9
|
+
mp4: 'video/mp4',
|
|
10
|
+
mp3: 'audio/mp3',
|
|
11
|
+
svg: 'image/svg+xml',
|
|
12
|
+
jpg: 'image/jpeg',
|
|
13
|
+
png: 'image/png',
|
|
14
|
+
gif: 'image/gif',
|
|
15
|
+
heic: 'image/heic',
|
|
16
|
+
heif: 'image/heif',
|
|
17
|
+
tiff: 'image/tiff',
|
|
18
|
+
yaml: 'text/yaml',
|
|
19
|
+
yml: 'text/yaml',
|
|
20
|
+
csv: 'text/csv',
|
|
21
|
+
tsv: 'text/tab-separated-values',
|
|
22
|
+
tab: 'text/tab-separated-values',
|
|
23
|
+
avi: 'video/x-msvideo',
|
|
24
|
+
mks: 'video/x-matroska',
|
|
25
|
+
mkv: 'video/x-matroska',
|
|
26
|
+
mov: 'video/quicktime',
|
|
27
|
+
doc: 'application/msword',
|
|
28
|
+
docm: 'application/vnd.ms-word.document.macroenabled.12',
|
|
29
|
+
docx: 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
|
|
30
|
+
dot: 'application/msword',
|
|
31
|
+
dotm: 'application/vnd.ms-word.template.macroenabled.12',
|
|
32
|
+
dotx: 'application/vnd.openxmlformats-officedocument.wordprocessingml.template',
|
|
33
|
+
xla: 'application/vnd.ms-excel',
|
|
34
|
+
xlam: 'application/vnd.ms-excel.addin.macroenabled.12',
|
|
35
|
+
xlc: 'application/vnd.ms-excel',
|
|
36
|
+
xlf: 'application/x-xliff+xml',
|
|
37
|
+
xlm: 'application/vnd.ms-excel',
|
|
38
|
+
xls: 'application/vnd.ms-excel',
|
|
39
|
+
xlsb: 'application/vnd.ms-excel.sheet.binary.macroenabled.12',
|
|
40
|
+
xlsm: 'application/vnd.ms-excel.sheet.macroenabled.12',
|
|
41
|
+
xlsx: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
|
|
42
|
+
xlt: 'application/vnd.ms-excel',
|
|
43
|
+
xltm: 'application/vnd.ms-excel.template.macroenabled.12',
|
|
44
|
+
xltx: 'application/vnd.openxmlformats-officedocument.spreadsheetml.template',
|
|
45
|
+
xlw: 'application/vnd.ms-excel',
|
|
46
|
+
txt: 'text/plain',
|
|
47
|
+
text: 'text/plain',
|
|
48
|
+
conf: 'text/plain',
|
|
49
|
+
log: 'text/plain',
|
|
50
|
+
eps: 'image/x-eps',
|
|
51
|
+
pdf: 'application/pdf',
|
|
52
|
+
postScript: 'application/postscript',
|
|
53
|
+
psd: 'image/vnd.adobe.photoshop',
|
|
54
|
+
psb: 'image/vnd.adobe.photoshop',
|
|
55
|
+
ttf: 'font/ttf',
|
|
56
|
+
xttf: 'application/x-font-ttf',
|
|
57
|
+
sfnt: 'application/font-sfnt',
|
|
58
|
+
otf: 'application/vnd.ms-opentype',
|
|
59
|
+
fdt: 'text/xml+sfxtemplate'
|
|
60
|
+
};
|
package/lib/nanoid.js
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/* Borrowed from https://github.com/ai/nanoid/blob/3.0.2/non-secure/index.js
|
|
2
|
+
* & https://github.com/reduxjs/redux-toolkit/blob/master/packages/toolkit/src/nanoid.ts
|
|
3
|
+
* This alphabet uses `A-Za-z0-9_-` symbols. A genetic algorithm helped
|
|
4
|
+
* optimize the gzip compression for this alphabet.
|
|
5
|
+
*/
|
|
6
|
+
var urlAlphabet = 'ModuleSymbhasOwnPr-0123456789ABCDEFGHNRVfgctiUvz_KqYTJkLxpZXIjQW';
|
|
7
|
+
var nanoid = function nanoid() {
|
|
8
|
+
var size = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 21;
|
|
9
|
+
var id = '';
|
|
10
|
+
// A compact alternative for `for (var i = 0; i < step; i++)`.
|
|
11
|
+
var i = size;
|
|
12
|
+
while (i--) {
|
|
13
|
+
// `| 0` is more compact and faster than `Math.floor()`.
|
|
14
|
+
id += urlAlphabet[Math.random() * 64 | 0];
|
|
15
|
+
}
|
|
16
|
+
return id;
|
|
17
|
+
};
|
|
18
|
+
export default nanoid;
|
package/lib/openLink.js
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export var openLinkInNewTab = function openLinkInNewTab(href) {
|
|
2
|
+
if (href) {
|
|
3
|
+
var tmpLinkElement = document.createElement('a');
|
|
4
|
+
tmpLinkElement.href = href;
|
|
5
|
+
tmpLinkElement.setAttribute('target', '_blank');
|
|
6
|
+
tmpLinkElement.setAttribute('rel', 'noopener noreferrer');
|
|
7
|
+
tmpLinkElement.style = 'position: absolute; z-index: -1111;';
|
|
8
|
+
document.body.appendChild(tmpLinkElement);
|
|
9
|
+
tmpLinkElement.click();
|
|
10
|
+
document.body.removeChild(tmpLinkElement);
|
|
11
|
+
}
|
|
12
|
+
};
|
package/lib/prettyETA.js
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import secondsToTime from './secondsToTime';
|
|
2
|
+
export default function prettyETA(seconds) {
|
|
3
|
+
if (!seconds) return seconds;
|
|
4
|
+
var time = secondsToTime(seconds);
|
|
5
|
+
|
|
6
|
+
// Only display hours and minutes if they are greater than 0 but always
|
|
7
|
+
// display minutes if hours is being displayed
|
|
8
|
+
// Display a leading zero if the there is a preceding unit: 1m 05s, but 5s
|
|
9
|
+
var hoursStr = time.hours ? time.hours + 'h ' : '';
|
|
10
|
+
var minutesVal = time.hours ? ('0' + time.minutes).substr(-2) : time.minutes;
|
|
11
|
+
var minutesStr = minutesVal ? minutesVal + 'm' : '';
|
|
12
|
+
var secondsVal = minutesVal ? ('0' + time.seconds).substr(-2) : time.seconds;
|
|
13
|
+
var secondsStr = time.hours ? '' : minutesVal ? ' ' + secondsVal + 's' : secondsVal + 's';
|
|
14
|
+
return "".concat(hoursStr).concat(minutesStr).concat(secondsStr);
|
|
15
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
+
import prettierBytes from '@transloadit/prettier-bytes';
|
|
3
|
+
var prettyFileSize = function prettyFileSize() {
|
|
4
|
+
var fileSize = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
|
|
5
|
+
return fileSize && ((fileSize === null || fileSize === void 0 ? void 0 : fileSize.pretty) || (fileSize === null || fileSize === void 0 ? void 0 : fileSize.total_recursive_pretty) || prettierBytes(fileSize && _typeof(fileSize) === 'object' ? fileSize.bytes || fileSize.total_recursive_bytes : fileSize));
|
|
6
|
+
};
|
|
7
|
+
export default prettyFileSize;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
var provideSvgStrWithCurrColor = function provideSvgStrWithCurrColor(svgString) {
|
|
2
|
+
var preparedSvgString = svgString.replaceAll(/(<\?xml.*?>|<!--.*-->)[\r\n]?/gi, '');
|
|
3
|
+
var startOfSvgTagIndex = preparedSvgString.indexOf('<svg');
|
|
4
|
+
// we are checking start of the tag first for making sure we would catch the first end after the svg opening to avoid issues.
|
|
5
|
+
var endOfSvgTagIndex = startOfSvgTagIndex + preparedSvgString.substr(startOfSvgTagIndex).indexOf('>');
|
|
6
|
+
var svgTagWithPreparedColor = "".concat(preparedSvgString.substr(0, endOfSvgTagIndex).replace(/\s*(?:fill|stroke|color)[:=]\s*['"]?.*['"; }]/i, '').trim(), " color=\"currentColor\" fill=\"currentColor\"");
|
|
7
|
+
var restOfSvgElementPreparedColor = preparedSvgString.substr(endOfSvgTagIndex, preparedSvgString.length).replaceAll(/(\s*(?:fill|stroke|color)[:=]\s*['"]?)#?\b(?!\s*?none).+?([\r\n'";})])/gi, '$1currentColor$2').replaceAll(/(\n\t|\n|\t)/g, ' ');
|
|
8
|
+
return svgTagWithPreparedColor + restOfSvgElementPreparedColor;
|
|
9
|
+
};
|
|
10
|
+
export default provideSvgStrWithCurrColor;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Run fn recursively with intervals until fn is defined.
|
|
3
|
+
*/
|
|
4
|
+
var recursiveFnCall = function recursiveFnCall() {
|
|
5
|
+
var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
|
|
6
|
+
_ref$delay = _ref.delay,
|
|
7
|
+
delay = _ref$delay === void 0 ? 500 : _ref$delay,
|
|
8
|
+
getFn = _ref.getFn,
|
|
9
|
+
_ref$maxAttempts = _ref.maxAttempts,
|
|
10
|
+
maxAttempts = _ref$maxAttempts === void 0 ? 20 : _ref$maxAttempts;
|
|
11
|
+
var timeoutCount = 0;
|
|
12
|
+
var _recursiveTimeout = function recursiveTimeout() {
|
|
13
|
+
var _delay = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : delay;
|
|
14
|
+
setTimeout(function () {
|
|
15
|
+
timeoutCount++;
|
|
16
|
+
var fn = getFn();
|
|
17
|
+
if (typeof fn === 'function') {
|
|
18
|
+
fn();
|
|
19
|
+
} else if (timeoutCount <= maxAttempts) {
|
|
20
|
+
_recursiveTimeout();
|
|
21
|
+
}
|
|
22
|
+
}, _delay);
|
|
23
|
+
};
|
|
24
|
+
_recursiveTimeout(0);
|
|
25
|
+
};
|
|
26
|
+
export default recursiveFnCall;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Removes duplicate objects from an array based on a specified unique property.
|
|
3
|
+
*
|
|
4
|
+
* This function iterates through the array and uses a Set to keep track of the unique values
|
|
5
|
+
* of the specified property. If a duplicate value is found, the object is filtered out.
|
|
6
|
+
*
|
|
7
|
+
* @param {Array<Object>} array - The array of objects to be filtered.
|
|
8
|
+
* @param {string} uniqueProperty - The property name to check for uniqueness.
|
|
9
|
+
* @returns {Array<Object>} A new array with duplicate objects removed.
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
var removeDuplicatesFromArray = function removeDuplicatesFromArray(array, uniqueProperty) {
|
|
13
|
+
var seenSet = new Set();
|
|
14
|
+
return array.filter(function (item) {
|
|
15
|
+
var duplicate = seenSet.has(item[uniqueProperty]);
|
|
16
|
+
seenSet.add(item[uniqueProperty]);
|
|
17
|
+
return !duplicate;
|
|
18
|
+
});
|
|
19
|
+
};
|
|
20
|
+
export default removeDuplicatesFromArray;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
var removeEmptyFolders = function removeEmptyFolders(folders) {
|
|
2
|
+
return folders.filter(function (_ref) {
|
|
3
|
+
var files = _ref.files,
|
|
4
|
+
folders = _ref.folders;
|
|
5
|
+
return (files === null || files === void 0 ? void 0 : files.length) > 0 || (folders === null || folders === void 0 ? void 0 : folders.length) > 0;
|
|
6
|
+
});
|
|
7
|
+
};
|
|
8
|
+
export default removeEmptyFolders;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
var removeUrlParamsWithRegex = function removeUrlParamsWithRegex() {
|
|
2
|
+
var url = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
|
|
3
|
+
var params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
|
|
4
|
+
if (!Array.isArray(params) || params.length === 0) return url;
|
|
5
|
+
var updatedUrl = url;
|
|
6
|
+
params.forEach(function (param) {
|
|
7
|
+
var regex = new RegExp("[?&]".concat(param, "=[^&]*(&|$)"));
|
|
8
|
+
updatedUrl = updatedUrl.replace(regex, function (_, p1) {
|
|
9
|
+
return p1 === '&' ? '?' : '';
|
|
10
|
+
});
|
|
11
|
+
});
|
|
12
|
+
return updatedUrl.replace(/[?&]$/, '');
|
|
13
|
+
};
|
|
14
|
+
export default removeUrlParamsWithRegex;
|
package/lib/reorder.js
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
|
|
2
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
3
|
+
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
4
|
+
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
5
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
6
|
+
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
7
|
+
var reorder = function reorder(list, startIndex, endIndex) {
|
|
8
|
+
var result = Array.from(list);
|
|
9
|
+
var _result$splice = result.splice(startIndex, 1),
|
|
10
|
+
_result$splice2 = _slicedToArray(_result$splice, 1),
|
|
11
|
+
removed = _result$splice2[0];
|
|
12
|
+
result.splice(endIndex, 0, removed);
|
|
13
|
+
return result;
|
|
14
|
+
};
|
|
15
|
+
export default reorder;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import RequestError from '@scaleflex/widget-utils/lib/RequestError';
|
|
2
|
+
var requestFile = function requestFile(url, options) {
|
|
3
|
+
return new Promise(function (resolve, reject) {
|
|
4
|
+
var xhr = new XMLHttpRequest();
|
|
5
|
+
xhr.open('GET', url);
|
|
6
|
+
xhr.responseType = 'blob';
|
|
7
|
+
if (options !== null && options !== void 0 && options.headers) {
|
|
8
|
+
Object.keys(options.headers).map(function (headerName) {
|
|
9
|
+
return xhr.setRequestHeader(headerName, options.headers[headerName]);
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
xhr.onload = function () {
|
|
13
|
+
if (xhr.status === 200) {
|
|
14
|
+
resolve(xhr.response);
|
|
15
|
+
} else {
|
|
16
|
+
reject(new Error("Request error (".concat(xhr.status, ")")));
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
xhr.onerror = function () {
|
|
20
|
+
return reject(new RequestError({
|
|
21
|
+
code: xhr.status,
|
|
22
|
+
message: 'Check your internet connection'
|
|
23
|
+
}));
|
|
24
|
+
};
|
|
25
|
+
if (options !== null && options !== void 0 && options.onProgress) {
|
|
26
|
+
xhr.onprogress = function (e) {
|
|
27
|
+
options.onProgress(e.loaded, e.total);
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
if (options !== null && options !== void 0 && options.cancel) {
|
|
31
|
+
options.cancel(xhr);
|
|
32
|
+
}
|
|
33
|
+
xhr.send();
|
|
34
|
+
});
|
|
35
|
+
};
|
|
36
|
+
export default requestFile;
|
package/lib/rgbToHex.js
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export default function secondsToTime(rawSeconds) {
|
|
2
|
+
var hours = Math.floor(rawSeconds / 3600) % 24;
|
|
3
|
+
var minutes = Math.floor(rawSeconds / 60) % 60;
|
|
4
|
+
var seconds = Math.floor(rawSeconds % 60);
|
|
5
|
+
return {
|
|
6
|
+
hours: hours,
|
|
7
|
+
minutes: minutes,
|
|
8
|
+
seconds: seconds
|
|
9
|
+
};
|
|
10
|
+
}
|
package/lib/settle.js
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export default function settle(promises) {
|
|
2
|
+
var resolutions = [];
|
|
3
|
+
var rejections = [];
|
|
4
|
+
function resolved(value) {
|
|
5
|
+
resolutions.push(value);
|
|
6
|
+
}
|
|
7
|
+
function rejected(error) {
|
|
8
|
+
rejections.push(error);
|
|
9
|
+
}
|
|
10
|
+
var wait = Promise.all(promises.map(function (promise) {
|
|
11
|
+
return promise.then(resolved, rejected);
|
|
12
|
+
}));
|
|
13
|
+
return wait.then(function () {
|
|
14
|
+
return {
|
|
15
|
+
successful: resolutions,
|
|
16
|
+
failed: rejections
|
|
17
|
+
};
|
|
18
|
+
});
|
|
19
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
function _toConsumableArray(r) { return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread(); }
|
|
2
|
+
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
3
|
+
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
4
|
+
function _iterableToArray(r) { if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); }
|
|
5
|
+
function _arrayWithoutHoles(r) { if (Array.isArray(r)) return _arrayLikeToArray(r); }
|
|
6
|
+
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
7
|
+
var defaultSortFn = function defaultSortFn(entity1, entity2) {
|
|
8
|
+
return entity1 === null || entity1 === void 0 ? void 0 : entity1.name.localeCompare(entity2 === null || entity2 === void 0 ? void 0 : entity2.name);
|
|
9
|
+
};
|
|
10
|
+
var sortEntitiesByName = function sortEntitiesByName() {
|
|
11
|
+
var ids = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
12
|
+
var entities = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
13
|
+
var sortFn = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : defaultSortFn;
|
|
14
|
+
return _toConsumableArray(ids).sort(function (id1, id2) {
|
|
15
|
+
return sortFn(entities[id1], entities[id2]);
|
|
16
|
+
});
|
|
17
|
+
};
|
|
18
|
+
export default sortEntitiesByName;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export default function splitPathToPathsAndNames() {
|
|
2
|
+
var path = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
|
|
3
|
+
var depth = (path.match(/\//ig) || []).length;
|
|
4
|
+
var startSearchIndex = path.indexOf('/');
|
|
5
|
+
var index;
|
|
6
|
+
var tempPath;
|
|
7
|
+
var tempName;
|
|
8
|
+
var paths = [];
|
|
9
|
+
var names = [];
|
|
10
|
+
for (var i = 0; i < depth; i++) {
|
|
11
|
+
index = path.indexOf('/', startSearchIndex + 1);
|
|
12
|
+
if (index === -1) {
|
|
13
|
+
index = path.length;
|
|
14
|
+
}
|
|
15
|
+
tempPath = path.slice(0, index);
|
|
16
|
+
tempName = path.slice(startSearchIndex + 1, index);
|
|
17
|
+
paths.push(tempPath);
|
|
18
|
+
names.push(tempName);
|
|
19
|
+
startSearchIndex = index;
|
|
20
|
+
}
|
|
21
|
+
return {
|
|
22
|
+
paths: paths,
|
|
23
|
+
names: names
|
|
24
|
+
};
|
|
25
|
+
}
|
package/lib/timeZones.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default ['Africa/Abidjan', 'Africa/Accra', 'Africa/Addis_Ababa', 'Africa/Algiers', 'Africa/Asmara', 'Africa/Asmera', 'Africa/Bamako', 'Africa/Bangui', 'Africa/Banjul', 'Africa/Bissau', 'Africa/Blantyre', 'Africa/Brazzaville', 'Africa/Bujumbura', 'Africa/Cairo', 'Africa/Casablanca', 'Africa/Ceuta', 'Africa/Conakry', 'Africa/Dakar', 'Africa/Dar_es_Salaam', 'Africa/Djibouti', 'Africa/Douala', 'Africa/El_Aaiun', 'Africa/Freetown', 'Africa/Gaborone', 'Africa/Harare', 'Africa/Johannesbur', 'Africa/Juba', 'Africa/Kampala', 'Africa/Khartoum', 'Africa/Kigali', 'Africa/Kinshasa', 'Africa/Lagos', 'Africa/Libreville', 'Africa/Lome', 'Africa/Luanda', 'Africa/Lubumbashi', 'Africa/Lusaka', 'Africa/Malabo', 'Africa/Maputo', 'Africa/Maseru', 'Africa/Mbabane', 'Africa/Mogadishu', 'Africa/Monrovia', 'Africa/Nairobi', 'Africa/Ndjamena', 'Africa/Niamey', 'Africa/Nouakchott', 'Africa/Ouagadougou', 'Africa/Porto-Novo', 'Africa/Sao_Tome', 'Africa/Timbuktu', 'Africa/Tripoli', 'Africa/Tunis', 'Africa/Windhoek', 'America/Adak', 'America/Anchorage', 'America/Anguilla', 'America/Antigua', 'America/Araguaina', 'America/Argentina/Buenos_Aires', 'America/Argentina/Catamarca', 'America/Argentina/ComodRivadavia', 'America/Argentina/Cordoba', 'America/Argentina/Jujuy', 'America/Argentina/La_Rioja', 'America/Argentina/Mendoza', 'America/Argentina/Rio_Gallegos', 'America/Argentina/Salta', 'America/Argentina/San_Juan', 'America/Argentina/San_Luis', 'America/Argentina/Tucuman', 'America/Argentina/Ushuaia', 'America/Aruba', 'America/Asuncion', 'America/Atikokan', 'America/Atka', 'America/Bahia', 'America/Bahia_Banderas', 'America/Barbados', 'America/Belem', 'America/Belize', 'America/Blanc-Sablon', 'America/Boa_Vista', 'America/Bogota', 'America/Boise', 'America/Buenos_Aires', 'America/Cambridge_Bay', 'America/Campo_Grande', 'America/Cancun', 'America/Caracas', 'America/Catamarca', 'America/Cayenne', 'America/Cayman', 'America/Chicago', 'America/Chihuahua', 'America/Coral_Harbour', 'America/Cordoba', 'America/Costa_Rica', 'America/Creston', 'America/Cuiaba', 'America/Curacao', 'America/Danmarkshavn', 'America/Dawson', 'America/Dawson_Creek', 'America/Denver', 'America/Detroit', 'America/Dominica', 'America/Edmonton', 'America/Eirunepe', 'America/El_Salvador', 'America/Fort_Nelson', 'America/Fort_Wayne', 'America/Fortaleza', 'America/Glace_Bay', 'America/Godthab', 'America/Goose_Bay', 'America/Grand_Turk', 'America/Grenada', 'America/Guadeloupe', 'America/Guatemala', 'America/Guayaquil', 'America/Guyana', 'America/Halifax', 'America/Havana', 'America/Hermosillo', 'America/Indiana/Indianapolis', 'America/Indiana/Knox', 'America/Indiana/Marengo', 'America/Indiana/Petersburg', 'America/Indiana/Tell_City', 'America/Indiana/Vevay', 'America/Indiana/Vincennes', 'America/Indiana/Winamac', 'America/Indianapolis', 'America/Inuvik', 'America/Iqaluit', 'America/Jamaica', 'America/Jujuy', 'America/Juneau', 'America/Kentucky/Louisville', 'America/Kentucky/Monticello', 'America/Knox_IN', 'America/Kralendijk', 'America/La_Paz', 'America/Lima', 'America/Los_Angeles', 'America/Louisville', 'America/Lower_Princes', 'America/Maceio', 'America/Managua', 'America/Manaus', 'America/Marigot', 'America/Martinique', 'America/Matamoros', 'America/Mazatlan', 'America/Mendoza', 'America/Menominee', 'America/Merida', 'America/Metlakatla', 'America/Mexico_City', 'America/Miquelon', 'America/Moncton', 'America/Monterrey', 'America/Montevideo', 'America/Montreal', 'America/Montserrat', 'America/Nassau', 'America/New_York', 'America/Nipigon', 'America/Nome', 'America/Noronha', 'America/North_Dakota/Beulah', 'America/North_Dakota/Center', 'America/North_Dakota/New_Salem', 'America/Ojinaga', 'America/Panama', 'America/Pangnirtung', 'America/Paramaribo', 'America/Phoenix', 'America/Port-au-Prince', 'America/Port_of_Spain', 'America/Porto_Acre', 'America/Porto_Velho', 'America/Puerto_Rico', 'America/Punta_Arenas', 'America/Rainy_River', 'America/Rankin_Inlet', 'America/Recife', 'America/Regina', 'America/Resolute', 'America/Rio_Branco', 'America/Rosario', 'America/Santa_Isabel', 'America/Santarem', 'America/Santiago', 'America/Santo_Domingo', 'America/Sao_Paulo', 'America/Scoresbysund', 'America/Shiprock', 'America/Sitka', 'America/St_Barthelemy', 'America/St_Johns', 'America/St_Kitts', 'America/St_Lucia', 'America/St_Thomas', 'America/St_Vincent', 'America/Swift_Current', 'America/Tegucigalpa', 'America/Thule', 'America/Thunder_Bay', 'America/Tijuana', 'America/Toronto', 'America/Tortola', 'America/Vancouver', 'America/Virgin', 'America/Whitehorse', 'America/Winnipeg', 'America/Yakutat', 'America/Yellowknife', 'Antarctica/Casey', 'Antarctica/Davis', 'Antarctica/DumontDUrville', 'Antarctica/Macquarie', 'Antarctica/Mawson', 'Antarctica/McMurdo', 'Antarctica/Palmer', 'Antarctica/Rothera', 'Antarctica/South_Pole', 'Antarctica/Syowa', 'Antarctica/Troll', 'Antarctica/Vostok', 'Arctic/Longyearbyen', 'Asia/Aden', 'Asia/Almaty', 'Asia/Amman', 'Asia/Anadyr', 'Asia/Aqtau', 'Asia/Aqtobe', 'Asia/Ashgabat', 'Asia/Ashkhabad', 'Asia/Atyrau', 'Asia/Baghdad', 'Asia/Bahrain', 'Asia/Baku', 'Asia/Bangkok', 'Asia/Barnaul', 'Asia/Beirut', 'Asia/Bishkek', 'Asia/Brunei', 'Asia/Calcutta', 'Asia/Chita', 'Asia/Choibalsan', 'Asia/Chongqing', 'Asia/Chungking', 'Asia/Colombo', 'Asia/Dacca', 'Asia/Damascus', 'Asia/Dhaka', 'Asia/Dili', 'Asia/Dubai', 'Asia/Dushanbe', 'Asia/Famagusta', 'Asia/Gaza', 'Asia/Harbin', 'Asia/Hebron', 'Asia/Ho_Chi_Minh', 'Asia/Hong_Kong', 'Asia/Hovd', 'Asia/Irkutsk', 'Asia/Istanbul', 'Asia/Jakarta', 'Asia/Jayapura', 'Asia/Jerusalem', 'Asia/Kabul', 'Asia/Kamchatka', 'Asia/Karachi', 'Asia/Kashgar', 'Asia/Kathmandu', 'Asia/Katmandu', 'Asia/Khandyga', 'Asia/Kolkata', 'Asia/Krasnoyarsk', 'Asia/Kuala_Lumpur', 'Asia/Kuching', 'Asia/Kuwait', 'Asia/Macao', 'Asia/Macau', 'Asia/Magadan', 'Asia/Makassar', 'Asia/Manila', 'Asia/Muscat', 'Asia/Nicosia', 'Asia/Novokuznetsk', 'Asia/Novosibirsk', 'Asia/Omsk', 'Asia/Oral', 'Asia/Phnom_Penh', 'Asia/Pontianak', 'Asia/Pyongyang', 'Asia/Qatar', 'Asia/Qyzylorda', 'Asia/Rangoon', 'Asia/Riyadh', 'Asia/Saigon', 'Asia/Sakhalin', 'Asia/Samarkand', 'Asia/Seoul', 'Asia/Shanghai', 'Asia/Singapore', 'Asia/Srednekolymsk', 'Asia/Taipei', 'Asia/Tashkent', 'Asia/Tbilisi', 'Asia/Tehran', 'Asia/Tel_Aviv', 'Asia/Thimbu', 'Asia/Thimphu', 'Asia/Tokyo', 'Asia/Tomsk', 'Asia/Ujung_Pandang', 'Asia/Ulaanbaatar', 'Asia/Ulan_Bator', 'Asia/Urumqi', 'Asia/Ust-Nera', 'Asia/Vientiane', 'Asia/Vladivostok', 'Asia/Yakutsk', 'Asia/Yangon', 'Asia/Yekaterinburg', 'Asia/Yerevan', 'Atlantic/Azores', 'Atlantic/Bermuda', 'Atlantic/Canary', 'Atlantic/Cape_Verde', 'Atlantic/Faeroe', 'Atlantic/Faroe', 'Atlantic/Jan_Mayen', 'Atlantic/Madeira', 'Atlantic/Reykjavik', 'Atlantic/South_Georgia', 'Atlantic/St_Helena', 'Atlantic/Stanley', 'Australia/ACT', 'Australia/Adelaide', 'Australia/Brisbane', 'Australia/Broken_Hill', 'Australia/Canberra', 'Australia/Currie', 'Australia/Darwin', 'Australia/Eucla', 'Australia/Hobart', 'Australia/LHI', 'Australia/Lindeman', 'Australia/Lord_Howe', 'Australia/Melbourne', 'Australia/NSW', 'Australia/North', 'Australia/Perth', 'Australia/Queensland', 'Australia/South', 'Australia/Sydney', 'Australia/Tasmania', 'Australia/Victoria', 'Australia/West', 'Australia/Yancowinna', 'Brazil/Acre', 'Brazil/DeNoronha', 'Brazil/East', 'Brazil/West', 'CET', 'CST6CDT', 'Canada/Atlantic', 'Canada/Central', 'Canada/Eastern', 'Canada/Mountain', 'Canada/Newfoundland', 'Canada/Pacific', 'Canada/Saskatchewan', 'Canada/Yukon', 'Chile/Continental', 'Chile/EasterIsland', 'Cuba', 'EET', 'EST', 'EST5EDT', 'Egypt', 'Eire', 'Etc/GMT', 'Etc/GMT+0', 'Etc/GMT+1', 'Etc/GMT+10', 'Etc/GMT+11', 'Etc/GMT+12', 'Etc/GMT+2', 'Etc/GMT+3', 'Etc/GMT+4', 'Etc/GMT+5', 'Etc/GMT+6', 'Etc/GMT+7', 'Etc/GMT+8', 'Etc/GMT+9', 'Etc/GMT-0', 'Etc/GMT-1', 'Etc/GMT-10', 'Etc/GMT-11', 'Etc/GMT-12', 'Etc/GMT-13', 'Etc/GMT-14', 'Etc/GMT-2', 'Etc/GMT-3', 'Etc/GMT-4', 'Etc/GMT-5', 'Etc/GMT-6', 'Etc/GMT-7', 'Etc/GMT-8', 'Etc/GMT-9', 'Etc/GMT0', 'Etc/Greenwich', 'Etc/UCT', 'Etc/UTC', 'Etc/Universal', 'Etc/Zulu', 'Europe/Amsterdam', 'Europe/Andorra', 'Europe/Astrakhan', 'Europe/Athens', 'Europe/Belfast', 'Europe/Belgrade', 'Europe/Berlin', 'Europe/Bratislava', 'Europe/Brussels', 'Europe/Bucharest', 'Europe/Budapest', 'Europe/Busingen', 'Europe/Chisinau', 'Europe/Copenhagen', 'Europe/Dublin', 'Europe/Gibraltar', 'Europe/Guernsey', 'Europe/Helsinki', 'Europe/Isle_of_Man', 'Europe/Istanbul', 'Europe/Jersey', 'Europe/Kaliningrad', 'Europe/Kiev', 'Europe/Kirov', 'Europe/Lisbon', 'Europe/Ljubljana', 'Europe/London', 'Europe/Luxembourg', 'Europe/Madrid', 'Europe/Malta', 'Europe/Mariehamn', 'Europe/Minsk', 'Europe/Monaco', 'Europe/Moscow', 'Europe/Nicosia', 'Europe/Oslo', 'Europe/Paris', 'Europe/Podgorica', 'Europe/Prague', 'Europe/Riga', 'Europe/Rome', 'Europe/Samara', 'Europe/San_Marino', 'Europe/Sarajevo', 'Europe/Saratov', 'Europe/Simferopol', 'Europe/Skopje', 'Europe/Sofia', 'Europe/Stockholm', 'Europe/Tallinn', 'Europe/Tirane', 'Europe/Tiraspol', 'Europe/Ulyanovsk', 'Europe/Uzhgorod', 'Europe/Vaduz', 'Europe/Vatican', 'Europe/Vienna', 'Europe/Vilnius', 'Europe/Volgograd', 'Europe/Warsaw', 'Europe/Zagreb', 'Europe/Zaporozhye', 'Europe/Zurich', 'GB', 'GB-Eire', 'GMT', 'GMT+0', 'GMT-0', 'GMT0', 'Greenwich', 'HST', 'Hongkong', 'Iceland', 'Indian/Antananarivo', 'Indian/Chagos', 'Indian/Christmas', 'Indian/Cocos', 'Indian/Comoro', 'Indian/Kerguelen', 'Indian/Mahe', 'Indian/Maldives', 'Indian/Mauritius', 'Indian/Mayotte', 'Indian/Reunion', 'Iran', 'Israel', 'Jamaica', 'Japan', 'Kwajalein', 'Libya', 'MET', 'MST', 'MST7MDT', 'Mexico/BajaNorte', 'Mexico/BajaSur', 'Mexico/General', 'NZ', 'NZ-CHAT', 'Navajo', 'PRC', 'PST8PDT', 'Pacific/Apia', 'Pacific/Auckland', 'Pacific/Bougainville', 'Pacific/Chatham', 'Pacific/Chuuk', 'Pacific/Easter', 'Pacific/Efate', 'Pacific/Enderbury', 'Pacific/Fakaofo', 'Pacific/Fiji', 'Pacific/Funafuti', 'Pacific/Galapagos', 'Pacific/Gambier', 'Pacific/Guadalcanal', 'Pacific/Guam', 'Pacific/Honolulu', 'Pacific/Johnston', 'Pacific/Kiritimati', 'Pacific/Kosrae', 'Pacific/Kwajalein', 'Pacific/Majuro', 'Pacific/Marquesas', 'Pacific/Midway', 'Pacific/Nauru', 'Pacific/Niue', 'Pacific/Norfolk', 'Pacific/Noumea', 'Pacific/Pago_Pago', 'Pacific/Palau', 'Pacific/Pitcairn', 'Pacific/Pohnpei', 'Pacific/Ponape', 'Pacific/Port_Moresby', 'Pacific/Rarotonga', 'Pacific/Saipan', 'Pacific/Samoa', 'Pacific/Tahiti', 'Pacific/Tarawa', 'Pacific/Tongatapu', 'Pacific/Truk', 'Pacific/Wake', 'Pacific/Wallis', 'Pacific/Yap', 'Poland', 'Portugal', 'ROC', 'ROK', 'Singapore', 'Turkey', 'UCT', 'US/Alaska', 'US/Aleutian', 'US/Arizona', 'US/Central', 'US/East-Indiana', 'US/Eastern', 'US/Hawaii', 'US/Indiana-Starke', 'US/Michigan', 'US/Mountain', 'US/Pacific', 'US/Pacific-New', 'US/Samoa', 'UTC', 'Universal', 'W-SU', 'WET', 'Zulu'];
|
package/lib/toArray.js
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
var openFullscreen = function openFullscreen(element) {
|
|
2
|
+
if (element.requestFullscreen) {
|
|
3
|
+
element.requestFullscreen();
|
|
4
|
+
} else if (element.webkitRequestFullscreen) {
|
|
5
|
+
element.webkitRequestFullscreen();
|
|
6
|
+
} else if (element.msRequestFullscreen) {
|
|
7
|
+
element.msRequestFullscreen();
|
|
8
|
+
}
|
|
9
|
+
};
|
|
10
|
+
var closeFullscreen = function closeFullscreen() {
|
|
11
|
+
if (document.exitFullscreen) {
|
|
12
|
+
document.exitFullscreen();
|
|
13
|
+
} else if (document.webkitExitFullscreen) {
|
|
14
|
+
document.webkitExitFullscreen();
|
|
15
|
+
} else if (document.msExitFullscreen) {
|
|
16
|
+
document.msExitFullscreen();
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
var toggleElementFullscreen = function toggleElementFullscreen(element) {
|
|
20
|
+
var isFullscreened = Boolean(document.fullscreenElement);
|
|
21
|
+
if (isFullscreened) {
|
|
22
|
+
closeFullscreen();
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
openFullscreen(element);
|
|
26
|
+
};
|
|
27
|
+
export default toggleElementFullscreen;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
3
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
4
|
+
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
5
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
6
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
7
|
+
// TODO (Dima) update the function description according to latest changes
|
|
8
|
+
|
|
9
|
+
import { VISIBILITY_OPTIONS } from './constants';
|
|
10
|
+
export var isVisibilityPublic = function isVisibilityPublic() {
|
|
11
|
+
var _visibility$in_cdn, _visibility$in_cdn$ac, _visibility$in_cdn$ac2;
|
|
12
|
+
var visibility = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
13
|
+
return (visibility === null || visibility === void 0 ? void 0 : (_visibility$in_cdn = visibility.in_cdn) === null || _visibility$in_cdn === void 0 ? void 0 : (_visibility$in_cdn$ac = _visibility$in_cdn.actual) === null || _visibility$in_cdn$ac === void 0 ? void 0 : (_visibility$in_cdn$ac2 = _visibility$in_cdn$ac.indexOf) === null || _visibility$in_cdn$ac2 === void 0 ? void 0 : _visibility$in_cdn$ac2.call(_visibility$in_cdn$ac, 'public')) === 0;
|
|
14
|
+
};
|
|
15
|
+
export var getActualVisibility = function getActualVisibility() {
|
|
16
|
+
var visibility = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
17
|
+
return isVisibilityPublic(visibility) ? VISIBILITY_OPTIONS.PUBLIC.value : VISIBILITY_OPTIONS.NOT_PUBLIC.value;
|
|
18
|
+
};
|
|
19
|
+
export var getVisibilityObject = function getVisibilityObject() {
|
|
20
|
+
var visibility = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
21
|
+
return isVisibilityPublic(visibility) ? VISIBILITY_OPTIONS.PUBLIC : VISIBILITY_OPTIONS.NOT_PUBLIC;
|
|
22
|
+
};
|
|
23
|
+
export var getVisibilityI18nLabel = function getVisibilityI18nLabel() {
|
|
24
|
+
var _VISIBILITY_OPTIONS$v;
|
|
25
|
+
var visibility = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
|
|
26
|
+
return (_VISIBILITY_OPTIONS$v = VISIBILITY_OPTIONS[visibility.toUpperCase()]) === null || _VISIBILITY_OPTIONS$v === void 0 ? void 0 : _VISIBILITY_OPTIONS$v.i18nLabel;
|
|
27
|
+
};
|
|
28
|
+
export var getFileInheritedVisibility = function getFileInheritedVisibility() {
|
|
29
|
+
var _folderVisibility$vis, _folderVisibility$vis2;
|
|
30
|
+
var folderVisibility = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
31
|
+
return {
|
|
32
|
+
in_cdn: _objectSpread(_objectSpread({}, folderVisibility === null || folderVisibility === void 0 ? void 0 : (_folderVisibility$vis = folderVisibility.visibility) === null || _folderVisibility$vis === void 0 ? void 0 : _folderVisibility$vis.in_cdn), {}, {
|
|
33
|
+
set: 'inherited'
|
|
34
|
+
}),
|
|
35
|
+
in_dam: _objectSpread(_objectSpread({}, folderVisibility === null || folderVisibility === void 0 ? void 0 : (_folderVisibility$vis2 = folderVisibility.visibility) === null || _folderVisibility$vis2 === void 0 ? void 0 : _folderVisibility$vis2.in_dam), {}, {
|
|
36
|
+
set: 'inherited'
|
|
37
|
+
})
|
|
38
|
+
};
|
|
39
|
+
};
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"description": "Shared utility functions for filerobot modules",
|
|
4
4
|
"main": "lib/index.js",
|
|
5
5
|
"types": "types/index.d.ts",
|
|
6
|
-
"version": "4.8.
|
|
6
|
+
"version": "4.8.11",
|
|
7
7
|
"files": [
|
|
8
8
|
"/dist",
|
|
9
9
|
"/lib",
|
|
@@ -16,10 +16,10 @@
|
|
|
16
16
|
"dependencies": {
|
|
17
17
|
"@scaleflex/icons": "^3.0.0-beta.11",
|
|
18
18
|
"@scaleflex/ui": "^3.0.0-beta.11",
|
|
19
|
-
"@scaleflex/widget-icons": "^4.8.
|
|
19
|
+
"@scaleflex/widget-icons": "^4.8.11",
|
|
20
20
|
"abortcontroller-polyfill": "^1.4.0",
|
|
21
21
|
"dompurify": "^3.1.6",
|
|
22
22
|
"lodash.throttle": "^4.1.1"
|
|
23
23
|
},
|
|
24
|
-
"gitHead": "
|
|
24
|
+
"gitHead": "4e66456d033b9d9829c3c76a8c29b020dcacae2e"
|
|
25
25
|
}
|