@revolist/revogrid 3.1.6 → 3.2.4
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/dist/revo-grid/_baseIteratee-af30b221.js +2070 -0
- package/dist/{collection/global/global.js → revo-grid/app-globals-7e6866ba.js} +11 -2
- package/dist/{collection/components/data/columnService.js → revo-grid/columnService-91e552ba.js} +11 -6
- package/dist/revo-grid/consts-ef824e6f.js +46 -0
- package/dist/revo-grid/css-shim-5387c708.js +7 -0
- package/dist/revo-grid/data.store-3263fff9.js +557 -0
- package/dist/revo-grid/debounce-aaa4b4da.js +217 -0
- package/dist/revo-grid/dimension.helpers-a7944fc4.js +340 -0
- package/dist/revo-grid/dispatcher-891af82e.js +24 -0
- package/dist/{cjs/dom-c8b6d1a7.js → revo-grid/dom-21bd1807.js} +4 -3
- package/dist/revo-grid/each-0378e5a3.js +180 -0
- package/dist/{collection/plugins/filter/filter.button.js → revo-grid/filter.button-74c1cd9c.js} +16 -10
- package/dist/revo-grid/identity-c8c7d3d8.js +26 -0
- package/dist/revo-grid/index-8a604c17.js +3067 -0
- package/dist/revo-grid/index.esm.js +3 -0
- package/dist/revo-grid/isString-a51066b5.js +34 -0
- package/dist/revo-grid/isSymbol-e4b5dafe.js +247 -0
- package/dist/revo-grid/keyCodes.utils-bd06e3ba.js +299 -0
- package/dist/revo-grid/keys-70b7c240.js +561 -0
- package/dist/{collection/services/localScrollService.js → revo-grid/localScrollService-e9b73323.js} +8 -2
- package/dist/{esm/revo-grid_11.entry.js → revo-grid/lodash-a0ab4cdd.js} +13773 -24597
- package/dist/{cjs/resize-observer-8dc80084.js → revo-grid/resize-observer-00c48d78.js} +25 -14
- package/dist/revo-grid/revo-grid.entry.js +3484 -0
- package/dist/revo-grid/revo-grid.esm.js +133 -1
- package/dist/revo-grid/revogr-clipboard.entry.js +52 -1
- package/dist/revo-grid/revogr-data.entry.js +152 -0
- package/dist/revo-grid/revogr-edit.entry.js +105 -0
- package/dist/revo-grid/revogr-filter-panel.entry.js +277 -1
- package/dist/revo-grid/revogr-focus.entry.js +41 -0
- package/dist/revo-grid/revogr-header.entry.js +560 -0
- package/dist/revo-grid/revogr-order-editor.entry.js +175 -0
- package/dist/revo-grid/revogr-overlay-selection.entry.js +711 -0
- package/dist/revo-grid/revogr-row-headers.entry.js +73 -0
- package/dist/revo-grid/revogr-scroll-virtual.entry.js +114 -0
- package/dist/revo-grid/revogr-temp-range.entry.js +73 -0
- package/dist/revo-grid/revogr-viewport-scroll.entry.js +340 -0
- package/dist/revo-grid/selection.store.connector-2b613fd0.js +503 -0
- package/dist/{collection/components/overlay/selection.utils.js → revo-grid/selection.utils-a9932db6.js} +15 -9
- package/dist/revo-grid/shadow-css-602a09db.js +390 -0
- package/dist/{collection/themeManager/themeService.js → revo-grid/themeService-ddaaa364.js} +26 -6
- package/dist/revo-grid/toInteger-9e6cbfd2.js +107 -0
- package/dist/revo-grid/toNumber-913b0b72.js +105 -0
- package/dist/{collection/utils/utils.js → revo-grid/utils-2c3b3857.js} +13 -8
- package/dist/revo-grid/viewport.helpers-49d3f031.js +16 -0
- package/dist/{collection/store/viewPort/viewport.helpers.js → revo-grid/viewport.store-ffaaab6d.js} +135 -9
- package/dist/types/components/revo-grid/revo-grid.d.ts +6 -0
- package/dist/types/components.d.ts +110 -58
- package/dist/types/plugins/dispatcher.d.ts +10 -0
- package/dist/types/plugins/moveColumn/columnDragPlugin.d.ts +66 -0
- package/dist/types/plugins/moveColumn/columnOrderHandler.d.ts +12 -0
- package/dist/types/services/resizable.directive.d.ts +1 -1
- package/dist/types/stencil-public-runtime.d.ts +189 -186
- package/package.json +22 -20
- package/custom-element/index.js +0 -28972
- package/custom-element/resize-observer.js +0 -489
- package/dist/cjs/css-shim-e33df79c.js +0 -6
- package/dist/cjs/debounce-e9b040d9.js +0 -575
- package/dist/cjs/index-d3f67f2e.js +0 -1729
- package/dist/cjs/index.cjs.js +0 -2
- package/dist/cjs/loader.cjs.js +0 -35
- package/dist/cjs/revo-grid.cjs.js +0 -73
- package/dist/cjs/revo-grid_11.cjs.entry.js +0 -28056
- package/dist/cjs/revogr-clipboard.cjs.entry.js +0 -53
- package/dist/cjs/revogr-filter-panel.cjs.entry.js +0 -275
- package/dist/collection/collection-manifest.json +0 -25
- package/dist/collection/components/button/button.js +0 -4
- package/dist/collection/components/clipboard/revogr-clipboard.js +0 -121
- package/dist/collection/components/data/cellRenderer.js +0 -24
- package/dist/collection/components/data/revogr-data-style.css +0 -135
- package/dist/collection/components/data/revogr-data.js +0 -322
- package/dist/collection/components/data/rowRenderer.js +0 -6
- package/dist/collection/components/header/headerCellRenderer.js +0 -19
- package/dist/collection/components/header/headerRenderer.js +0 -45
- package/dist/collection/components/header/revogr-header-style.css +0 -198
- package/dist/collection/components/header/revogr-header.js +0 -297
- package/dist/collection/components/order/orderRenderer.js +0 -50
- package/dist/collection/components/order/revogr-order-editor.js +0 -358
- package/dist/collection/components/order/rowOrderService.js +0 -68
- package/dist/collection/components/overlay/autofill.service.js +0 -182
- package/dist/collection/components/overlay/clipboard.service.js +0 -39
- package/dist/collection/components/overlay/editors/edit.utils.js +0 -5
- package/dist/collection/components/overlay/editors/text.js +0 -35
- package/dist/collection/components/overlay/keyboard.service.js +0 -128
- package/dist/collection/components/overlay/revogr-edit-style.css +0 -86
- package/dist/collection/components/overlay/revogr-edit.js +0 -159
- package/dist/collection/components/overlay/revogr-overlay-selection.js +0 -726
- package/dist/collection/components/overlay/revogr-overlay-style.css +0 -98
- package/dist/collection/components/revo-grid/revo-grid-style.css +0 -527
- package/dist/collection/components/revo-grid/revo-grid.js +0 -2186
- package/dist/collection/components/revo-grid/viewport.helpers.js +0 -11
- package/dist/collection/components/revo-grid/viewport.interfaces.js +0 -1
- package/dist/collection/components/revo-grid/viewport.js +0 -18
- package/dist/collection/components/revo-grid/viewport.resize.service.js +0 -21
- package/dist/collection/components/revo-grid/viewport.scrolling.service.js +0 -60
- package/dist/collection/components/revo-grid/viewport.section.js +0 -28
- package/dist/collection/components/revo-grid/viewport.service.js +0 -209
- package/dist/collection/components/rowHeaders/revogr-row-headers.js +0 -210
- package/dist/collection/components/rowHeaders/row-header-render.js +0 -1
- package/dist/collection/components/scroll/revogr-viewport-scroll-style.css +0 -137
- package/dist/collection/components/scroll/revogr-viewport-scroll.js +0 -399
- package/dist/collection/components/scrollable/revogr-scroll-style.css +0 -104
- package/dist/collection/components/scrollable/revogr-scroll-virtual.js +0 -253
- package/dist/collection/components/selection-focus/revogr-focus-style.css +0 -77
- package/dist/collection/components/selection-focus/revogr-focus.js +0 -103
- package/dist/collection/components/selection-temp-range/revogr-temp-range-style.css +0 -98
- package/dist/collection/components/selection-temp-range/revogr-temp-range.js +0 -138
- package/dist/collection/index.js +0 -1
- package/dist/collection/plugins/autoSizeColumn.js +0 -230
- package/dist/collection/plugins/basePlugin.js +0 -27
- package/dist/collection/plugins/export/csv.js +0 -68
- package/dist/collection/plugins/export/export.plugin.js +0 -165
- package/dist/collection/plugins/export/types.js +0 -1
- package/dist/collection/plugins/filter/conditions/equal.js +0 -17
- package/dist/collection/plugins/filter/conditions/number/greaterThan.js +0 -10
- package/dist/collection/plugins/filter/conditions/number/greaterThanOrEqual.js +0 -7
- package/dist/collection/plugins/filter/conditions/number/lessThan.js +0 -12
- package/dist/collection/plugins/filter/conditions/number/lessThanOrEqual.js +0 -7
- package/dist/collection/plugins/filter/conditions/set.js +0 -3
- package/dist/collection/plugins/filter/conditions/string/beginswith.js +0 -17
- package/dist/collection/plugins/filter/conditions/string/contains.js +0 -18
- package/dist/collection/plugins/filter/filter.plugin.js +0 -256
- package/dist/collection/plugins/filter/filter.pop.js +0 -485
- package/dist/collection/plugins/filter/filter.service.js +0 -44
- package/dist/collection/plugins/filter/filter.style.css +0 -239
- package/dist/collection/plugins/filter/filter.types.js +0 -1
- package/dist/collection/plugins/groupingColumn/columnGroupsRenderer.js +0 -30
- package/dist/collection/plugins/groupingColumn/grouping.col.plugin.js +0 -36
- package/dist/collection/plugins/groupingColumn/headerGroupRenderer.js +0 -21
- package/dist/collection/plugins/groupingRow/grouping.const.js +0 -10
- package/dist/collection/plugins/groupingRow/grouping.row.expand.service.js +0 -76
- package/dist/collection/plugins/groupingRow/grouping.row.plugin.js +0 -258
- package/dist/collection/plugins/groupingRow/grouping.row.renderer.js +0 -29
- package/dist/collection/plugins/groupingRow/grouping.row.types.js +0 -1
- package/dist/collection/plugins/groupingRow/grouping.service.js +0 -155
- package/dist/collection/plugins/groupingRow/grouping.trimmed.service.js +0 -57
- package/dist/collection/plugins/sorting/sorting.plugin.js +0 -181
- package/dist/collection/plugins/sorting/sorting.sign.js +0 -6
- package/dist/collection/plugins/stretchPlugin.js +0 -68
- package/dist/collection/plugins/trimmed/trimmed.plugin.js +0 -32
- package/dist/collection/services/cell.helpers.js +0 -7
- package/dist/collection/services/column.data.provider.js +0 -188
- package/dist/collection/services/data.provider.js +0 -47
- package/dist/collection/services/dimension.provider.js +0 -78
- package/dist/collection/services/resizable.directive.js +0 -250
- package/dist/collection/services/selection.store.connector.js +0 -213
- package/dist/collection/services/viewport.provider.js +0 -14
- package/dist/collection/store/dataSource/data.proxy.js +0 -34
- package/dist/collection/store/dataSource/data.store.js +0 -127
- package/dist/collection/store/dimension/dimension.helpers.js +0 -107
- package/dist/collection/store/dimension/dimension.store.js +0 -59
- package/dist/collection/store/selection/selection.helpers.js +0 -53
- package/dist/collection/store/selection/selection.store.js +0 -68
- package/dist/collection/store/selection/selection.store.service.js +0 -35
- package/dist/collection/store/storeTypes.js +0 -5
- package/dist/collection/store/viewPort/viewport.store.js +0 -121
- package/dist/collection/themeManager/theme.compact.js +0 -5
- package/dist/collection/themeManager/theme.default.js +0 -5
- package/dist/collection/themeManager/theme.material.js +0 -5
- package/dist/collection/utils/closestPolifill.js +0 -18
- package/dist/collection/utils/consts.js +0 -19
- package/dist/collection/utils/generateAlphabetHeader.js +0 -20
- package/dist/collection/utils/keyCodes.js +0 -70
- package/dist/collection/utils/keyCodes.utils.js +0 -64
- package/dist/collection/utils/platform.js +0 -5
- package/dist/collection/utils/resizeObserver.js +0 -6
- package/dist/collection/utils/store.utils.js +0 -7
- package/dist/collection/utilsExternal/generate-data.js +0 -132
- package/dist/esm/css-shim-8d75038b.js +0 -4
- package/dist/esm/debounce-8dadcda7.js +0 -558
- package/dist/esm/dom-1b195079.js +0 -73
- package/dist/esm/index-42c84e7c.js +0 -1694
- package/dist/esm/index.js +0 -1
- package/dist/esm/loader.js +0 -31
- package/dist/esm/polyfills/core-js.js +0 -11
- package/dist/esm/polyfills/css-shim.js +0 -1
- package/dist/esm/polyfills/dom.js +0 -79
- package/dist/esm/polyfills/es5-html-element.js +0 -1
- package/dist/esm/polyfills/index.js +0 -34
- package/dist/esm/polyfills/system.js +0 -6
- package/dist/esm/resize-observer-56b7b34f.js +0 -489
- package/dist/esm/revo-grid.js +0 -71
- package/dist/esm/revogr-clipboard.entry.js +0 -49
- package/dist/esm/revogr-filter-panel.entry.js +0 -271
- package/dist/esm-es5/css-shim-8d75038b.js +0 -1
- package/dist/esm-es5/debounce-8dadcda7.js +0 -1
- package/dist/esm-es5/dom-1b195079.js +0 -21
- package/dist/esm-es5/index-42c84e7c.js +0 -1
- package/dist/esm-es5/index.js +0 -0
- package/dist/esm-es5/loader.js +0 -1
- package/dist/esm-es5/resize-observer-56b7b34f.js +0 -1
- package/dist/esm-es5/revo-grid.js +0 -1
- package/dist/esm-es5/revo-grid_11.entry.js +0 -1
- package/dist/esm-es5/revogr-clipboard.entry.js +0 -1
- package/dist/esm-es5/revogr-filter-panel.entry.js +0 -1
- package/dist/index.cjs.js +0 -1
- package/dist/index.js +0 -1
- package/dist/revo-grid/css-shim-88bfb262.system.js +0 -1
- package/dist/revo-grid/css-shim-8d75038b.js +0 -1
- package/dist/revo-grid/debounce-d097578d.js +0 -1
- package/dist/revo-grid/debounce-f40a88f6.system.js +0 -1
- package/dist/revo-grid/dom-1b195079.js +0 -19
- package/dist/revo-grid/dom-ee2dd1b3.system.js +0 -21
- package/dist/revo-grid/index-a15e7527.system.js +0 -1
- package/dist/revo-grid/index-a7f99799.js +0 -1
- package/dist/revo-grid/index.system.js +0 -1
- package/dist/revo-grid/resize-observer-56b7b34f.js +0 -1
- package/dist/revo-grid/resize-observer-7a7b9757.system.js +0 -1
- package/dist/revo-grid/revo-grid.js +0 -132
- package/dist/revo-grid/revo-grid.system.js +0 -1
- package/dist/revo-grid/revo-grid_11.entry.js +0 -1
- package/dist/revo-grid/revo-grid_11.system.entry.js +0 -1
- package/dist/revo-grid/revogr-clipboard.system.entry.js +0 -1
- package/dist/revo-grid/revogr-filter-panel.system.entry.js +0 -1
|
@@ -0,0 +1,390 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Built by Revolist
|
|
3
|
+
*/
|
|
4
|
+
/*
|
|
5
|
+
Stencil Client Platform v2.17.3 | MIT Licensed | https://stenciljs.com
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* @license
|
|
9
|
+
* Copyright Google Inc. All Rights Reserved.
|
|
10
|
+
*
|
|
11
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
12
|
+
* found in the LICENSE file at https://angular.io/license
|
|
13
|
+
*
|
|
14
|
+
* This file is a port of shadowCSS from webcomponents.js to TypeScript.
|
|
15
|
+
* https://github.com/webcomponents/webcomponentsjs/blob/4efecd7e0e/src/ShadowCSS/ShadowCSS.js
|
|
16
|
+
* https://github.com/angular/angular/blob/master/packages/compiler/src/shadow_css.ts
|
|
17
|
+
*/
|
|
18
|
+
const safeSelector = (selector) => {
|
|
19
|
+
const placeholders = [];
|
|
20
|
+
let index = 0;
|
|
21
|
+
// Replaces attribute selectors with placeholders.
|
|
22
|
+
// The WS in [attr="va lue"] would otherwise be interpreted as a selector separator.
|
|
23
|
+
selector = selector.replace(/(\[[^\]]*\])/g, (_, keep) => {
|
|
24
|
+
const replaceBy = `__ph-${index}__`;
|
|
25
|
+
placeholders.push(keep);
|
|
26
|
+
index++;
|
|
27
|
+
return replaceBy;
|
|
28
|
+
});
|
|
29
|
+
// Replaces the expression in `:nth-child(2n + 1)` with a placeholder.
|
|
30
|
+
// WS and "+" would otherwise be interpreted as selector separators.
|
|
31
|
+
const content = selector.replace(/(:nth-[-\w]+)(\([^)]+\))/g, (_, pseudo, exp) => {
|
|
32
|
+
const replaceBy = `__ph-${index}__`;
|
|
33
|
+
placeholders.push(exp);
|
|
34
|
+
index++;
|
|
35
|
+
return pseudo + replaceBy;
|
|
36
|
+
});
|
|
37
|
+
const ss = {
|
|
38
|
+
content,
|
|
39
|
+
placeholders,
|
|
40
|
+
};
|
|
41
|
+
return ss;
|
|
42
|
+
};
|
|
43
|
+
const restoreSafeSelector = (placeholders, content) => {
|
|
44
|
+
return content.replace(/__ph-(\d+)__/g, (_, index) => placeholders[+index]);
|
|
45
|
+
};
|
|
46
|
+
const _polyfillHost = '-shadowcsshost';
|
|
47
|
+
const _polyfillSlotted = '-shadowcssslotted';
|
|
48
|
+
// note: :host-context pre-processed to -shadowcsshostcontext.
|
|
49
|
+
const _polyfillHostContext = '-shadowcsscontext';
|
|
50
|
+
const _parenSuffix = ')(?:\\((' + '(?:\\([^)(]*\\)|[^)(]*)+?' + ')\\))?([^,{]*)';
|
|
51
|
+
const _cssColonHostRe = new RegExp('(' + _polyfillHost + _parenSuffix, 'gim');
|
|
52
|
+
const _cssColonHostContextRe = new RegExp('(' + _polyfillHostContext + _parenSuffix, 'gim');
|
|
53
|
+
const _cssColonSlottedRe = new RegExp('(' + _polyfillSlotted + _parenSuffix, 'gim');
|
|
54
|
+
const _polyfillHostNoCombinator = _polyfillHost + '-no-combinator';
|
|
55
|
+
const _polyfillHostNoCombinatorRe = /-shadowcsshost-no-combinator([^\s]*)/;
|
|
56
|
+
const _shadowDOMSelectorsRe = [/::shadow/g, /::content/g];
|
|
57
|
+
const _selectorReSuffix = '([>\\s~+[.,{:][\\s\\S]*)?$';
|
|
58
|
+
const _polyfillHostRe = /-shadowcsshost/gim;
|
|
59
|
+
const _colonHostRe = /:host/gim;
|
|
60
|
+
const _colonSlottedRe = /::slotted/gim;
|
|
61
|
+
const _colonHostContextRe = /:host-context/gim;
|
|
62
|
+
const _commentRe = /\/\*\s*[\s\S]*?\*\//g;
|
|
63
|
+
const stripComments = (input) => {
|
|
64
|
+
return input.replace(_commentRe, '');
|
|
65
|
+
};
|
|
66
|
+
const _commentWithHashRe = /\/\*\s*#\s*source(Mapping)?URL=[\s\S]+?\*\//g;
|
|
67
|
+
const extractCommentsWithHash = (input) => {
|
|
68
|
+
return input.match(_commentWithHashRe) || [];
|
|
69
|
+
};
|
|
70
|
+
const _ruleRe = /(\s*)([^;\{\}]+?)(\s*)((?:{%BLOCK%}?\s*;?)|(?:\s*;))/g;
|
|
71
|
+
const _curlyRe = /([{}])/g;
|
|
72
|
+
const _selectorPartsRe = /(^.*?[^\\])??((:+)(.*)|$)/;
|
|
73
|
+
const OPEN_CURLY = '{';
|
|
74
|
+
const CLOSE_CURLY = '}';
|
|
75
|
+
const BLOCK_PLACEHOLDER = '%BLOCK%';
|
|
76
|
+
const processRules = (input, ruleCallback) => {
|
|
77
|
+
const inputWithEscapedBlocks = escapeBlocks(input);
|
|
78
|
+
let nextBlockIndex = 0;
|
|
79
|
+
return inputWithEscapedBlocks.escapedString.replace(_ruleRe, (...m) => {
|
|
80
|
+
const selector = m[2];
|
|
81
|
+
let content = '';
|
|
82
|
+
let suffix = m[4];
|
|
83
|
+
let contentPrefix = '';
|
|
84
|
+
if (suffix && suffix.startsWith('{' + BLOCK_PLACEHOLDER)) {
|
|
85
|
+
content = inputWithEscapedBlocks.blocks[nextBlockIndex++];
|
|
86
|
+
suffix = suffix.substring(BLOCK_PLACEHOLDER.length + 1);
|
|
87
|
+
contentPrefix = '{';
|
|
88
|
+
}
|
|
89
|
+
const cssRule = {
|
|
90
|
+
selector,
|
|
91
|
+
content,
|
|
92
|
+
};
|
|
93
|
+
const rule = ruleCallback(cssRule);
|
|
94
|
+
return `${m[1]}${rule.selector}${m[3]}${contentPrefix}${rule.content}${suffix}`;
|
|
95
|
+
});
|
|
96
|
+
};
|
|
97
|
+
const escapeBlocks = (input) => {
|
|
98
|
+
const inputParts = input.split(_curlyRe);
|
|
99
|
+
const resultParts = [];
|
|
100
|
+
const escapedBlocks = [];
|
|
101
|
+
let bracketCount = 0;
|
|
102
|
+
let currentBlockParts = [];
|
|
103
|
+
for (let partIndex = 0; partIndex < inputParts.length; partIndex++) {
|
|
104
|
+
const part = inputParts[partIndex];
|
|
105
|
+
if (part === CLOSE_CURLY) {
|
|
106
|
+
bracketCount--;
|
|
107
|
+
}
|
|
108
|
+
if (bracketCount > 0) {
|
|
109
|
+
currentBlockParts.push(part);
|
|
110
|
+
}
|
|
111
|
+
else {
|
|
112
|
+
if (currentBlockParts.length > 0) {
|
|
113
|
+
escapedBlocks.push(currentBlockParts.join(''));
|
|
114
|
+
resultParts.push(BLOCK_PLACEHOLDER);
|
|
115
|
+
currentBlockParts = [];
|
|
116
|
+
}
|
|
117
|
+
resultParts.push(part);
|
|
118
|
+
}
|
|
119
|
+
if (part === OPEN_CURLY) {
|
|
120
|
+
bracketCount++;
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
if (currentBlockParts.length > 0) {
|
|
124
|
+
escapedBlocks.push(currentBlockParts.join(''));
|
|
125
|
+
resultParts.push(BLOCK_PLACEHOLDER);
|
|
126
|
+
}
|
|
127
|
+
const strEscapedBlocks = {
|
|
128
|
+
escapedString: resultParts.join(''),
|
|
129
|
+
blocks: escapedBlocks,
|
|
130
|
+
};
|
|
131
|
+
return strEscapedBlocks;
|
|
132
|
+
};
|
|
133
|
+
const insertPolyfillHostInCssText = (selector) => {
|
|
134
|
+
selector = selector
|
|
135
|
+
.replace(_colonHostContextRe, _polyfillHostContext)
|
|
136
|
+
.replace(_colonHostRe, _polyfillHost)
|
|
137
|
+
.replace(_colonSlottedRe, _polyfillSlotted);
|
|
138
|
+
return selector;
|
|
139
|
+
};
|
|
140
|
+
const convertColonRule = (cssText, regExp, partReplacer) => {
|
|
141
|
+
// m[1] = :host(-context), m[2] = contents of (), m[3] rest of rule
|
|
142
|
+
return cssText.replace(regExp, (...m) => {
|
|
143
|
+
if (m[2]) {
|
|
144
|
+
const parts = m[2].split(',');
|
|
145
|
+
const r = [];
|
|
146
|
+
for (let i = 0; i < parts.length; i++) {
|
|
147
|
+
const p = parts[i].trim();
|
|
148
|
+
if (!p)
|
|
149
|
+
break;
|
|
150
|
+
r.push(partReplacer(_polyfillHostNoCombinator, p, m[3]));
|
|
151
|
+
}
|
|
152
|
+
return r.join(',');
|
|
153
|
+
}
|
|
154
|
+
else {
|
|
155
|
+
return _polyfillHostNoCombinator + m[3];
|
|
156
|
+
}
|
|
157
|
+
});
|
|
158
|
+
};
|
|
159
|
+
const colonHostPartReplacer = (host, part, suffix) => {
|
|
160
|
+
return host + part.replace(_polyfillHost, '') + suffix;
|
|
161
|
+
};
|
|
162
|
+
const convertColonHost = (cssText) => {
|
|
163
|
+
return convertColonRule(cssText, _cssColonHostRe, colonHostPartReplacer);
|
|
164
|
+
};
|
|
165
|
+
const colonHostContextPartReplacer = (host, part, suffix) => {
|
|
166
|
+
if (part.indexOf(_polyfillHost) > -1) {
|
|
167
|
+
return colonHostPartReplacer(host, part, suffix);
|
|
168
|
+
}
|
|
169
|
+
else {
|
|
170
|
+
return host + part + suffix + ', ' + part + ' ' + host + suffix;
|
|
171
|
+
}
|
|
172
|
+
};
|
|
173
|
+
const convertColonSlotted = (cssText, slotScopeId) => {
|
|
174
|
+
const slotClass = '.' + slotScopeId + ' > ';
|
|
175
|
+
const selectors = [];
|
|
176
|
+
cssText = cssText.replace(_cssColonSlottedRe, (...m) => {
|
|
177
|
+
if (m[2]) {
|
|
178
|
+
const compound = m[2].trim();
|
|
179
|
+
const suffix = m[3];
|
|
180
|
+
const slottedSelector = slotClass + compound + suffix;
|
|
181
|
+
let prefixSelector = '';
|
|
182
|
+
for (let i = m[4] - 1; i >= 0; i--) {
|
|
183
|
+
const char = m[5][i];
|
|
184
|
+
if (char === '}' || char === ',') {
|
|
185
|
+
break;
|
|
186
|
+
}
|
|
187
|
+
prefixSelector = char + prefixSelector;
|
|
188
|
+
}
|
|
189
|
+
const orgSelector = prefixSelector + slottedSelector;
|
|
190
|
+
const addedSelector = `${prefixSelector.trimRight()}${slottedSelector.trim()}`;
|
|
191
|
+
if (orgSelector.trim() !== addedSelector.trim()) {
|
|
192
|
+
const updatedSelector = `${addedSelector}, ${orgSelector}`;
|
|
193
|
+
selectors.push({
|
|
194
|
+
orgSelector,
|
|
195
|
+
updatedSelector,
|
|
196
|
+
});
|
|
197
|
+
}
|
|
198
|
+
return slottedSelector;
|
|
199
|
+
}
|
|
200
|
+
else {
|
|
201
|
+
return _polyfillHostNoCombinator + m[3];
|
|
202
|
+
}
|
|
203
|
+
});
|
|
204
|
+
return {
|
|
205
|
+
selectors,
|
|
206
|
+
cssText,
|
|
207
|
+
};
|
|
208
|
+
};
|
|
209
|
+
const convertColonHostContext = (cssText) => {
|
|
210
|
+
return convertColonRule(cssText, _cssColonHostContextRe, colonHostContextPartReplacer);
|
|
211
|
+
};
|
|
212
|
+
const convertShadowDOMSelectors = (cssText) => {
|
|
213
|
+
return _shadowDOMSelectorsRe.reduce((result, pattern) => result.replace(pattern, ' '), cssText);
|
|
214
|
+
};
|
|
215
|
+
const makeScopeMatcher = (scopeSelector) => {
|
|
216
|
+
const lre = /\[/g;
|
|
217
|
+
const rre = /\]/g;
|
|
218
|
+
scopeSelector = scopeSelector.replace(lre, '\\[').replace(rre, '\\]');
|
|
219
|
+
return new RegExp('^(' + scopeSelector + ')' + _selectorReSuffix, 'm');
|
|
220
|
+
};
|
|
221
|
+
const selectorNeedsScoping = (selector, scopeSelector) => {
|
|
222
|
+
const re = makeScopeMatcher(scopeSelector);
|
|
223
|
+
return !re.test(selector);
|
|
224
|
+
};
|
|
225
|
+
const injectScopingSelector = (selector, scopingSelector) => {
|
|
226
|
+
return selector.replace(_selectorPartsRe, (_, before = '', _colonGroup, colon = '', after = '') => {
|
|
227
|
+
return before + scopingSelector + colon + after;
|
|
228
|
+
});
|
|
229
|
+
};
|
|
230
|
+
const applySimpleSelectorScope = (selector, scopeSelector, hostSelector) => {
|
|
231
|
+
// In Android browser, the lastIndex is not reset when the regex is used in String.replace()
|
|
232
|
+
_polyfillHostRe.lastIndex = 0;
|
|
233
|
+
if (_polyfillHostRe.test(selector)) {
|
|
234
|
+
const replaceBy = `.${hostSelector}`;
|
|
235
|
+
return selector
|
|
236
|
+
.replace(_polyfillHostNoCombinatorRe, (_, selector) => injectScopingSelector(selector, replaceBy))
|
|
237
|
+
.replace(_polyfillHostRe, replaceBy + ' ');
|
|
238
|
+
}
|
|
239
|
+
return scopeSelector + ' ' + selector;
|
|
240
|
+
};
|
|
241
|
+
const applyStrictSelectorScope = (selector, scopeSelector, hostSelector) => {
|
|
242
|
+
const isRe = /\[is=([^\]]*)\]/g;
|
|
243
|
+
scopeSelector = scopeSelector.replace(isRe, (_, ...parts) => parts[0]);
|
|
244
|
+
const className = '.' + scopeSelector;
|
|
245
|
+
const _scopeSelectorPart = (p) => {
|
|
246
|
+
let scopedP = p.trim();
|
|
247
|
+
if (!scopedP) {
|
|
248
|
+
return '';
|
|
249
|
+
}
|
|
250
|
+
if (p.indexOf(_polyfillHostNoCombinator) > -1) {
|
|
251
|
+
scopedP = applySimpleSelectorScope(p, scopeSelector, hostSelector);
|
|
252
|
+
}
|
|
253
|
+
else {
|
|
254
|
+
// remove :host since it should be unnecessary
|
|
255
|
+
const t = p.replace(_polyfillHostRe, '');
|
|
256
|
+
if (t.length > 0) {
|
|
257
|
+
scopedP = injectScopingSelector(t, className);
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
return scopedP;
|
|
261
|
+
};
|
|
262
|
+
const safeContent = safeSelector(selector);
|
|
263
|
+
selector = safeContent.content;
|
|
264
|
+
let scopedSelector = '';
|
|
265
|
+
let startIndex = 0;
|
|
266
|
+
let res;
|
|
267
|
+
const sep = /( |>|\+|~(?!=))\s*/g;
|
|
268
|
+
// If a selector appears before :host it should not be shimmed as it
|
|
269
|
+
// matches on ancestor elements and not on elements in the host's shadow
|
|
270
|
+
// `:host-context(div)` is transformed to
|
|
271
|
+
// `-shadowcsshost-no-combinatordiv, div -shadowcsshost-no-combinator`
|
|
272
|
+
// the `div` is not part of the component in the 2nd selectors and should not be scoped.
|
|
273
|
+
// Historically `component-tag:host` was matching the component so we also want to preserve
|
|
274
|
+
// this behavior to avoid breaking legacy apps (it should not match).
|
|
275
|
+
// The behavior should be:
|
|
276
|
+
// - `tag:host` -> `tag[h]` (this is to avoid breaking legacy apps, should not match anything)
|
|
277
|
+
// - `tag :host` -> `tag [h]` (`tag` is not scoped because it's considered part of a
|
|
278
|
+
// `:host-context(tag)`)
|
|
279
|
+
const hasHost = selector.indexOf(_polyfillHostNoCombinator) > -1;
|
|
280
|
+
// Only scope parts after the first `-shadowcsshost-no-combinator` when it is present
|
|
281
|
+
let shouldScope = !hasHost;
|
|
282
|
+
while ((res = sep.exec(selector)) !== null) {
|
|
283
|
+
const separator = res[1];
|
|
284
|
+
const part = selector.slice(startIndex, res.index).trim();
|
|
285
|
+
shouldScope = shouldScope || part.indexOf(_polyfillHostNoCombinator) > -1;
|
|
286
|
+
const scopedPart = shouldScope ? _scopeSelectorPart(part) : part;
|
|
287
|
+
scopedSelector += `${scopedPart} ${separator} `;
|
|
288
|
+
startIndex = sep.lastIndex;
|
|
289
|
+
}
|
|
290
|
+
const part = selector.substring(startIndex);
|
|
291
|
+
shouldScope = shouldScope || part.indexOf(_polyfillHostNoCombinator) > -1;
|
|
292
|
+
scopedSelector += shouldScope ? _scopeSelectorPart(part) : part;
|
|
293
|
+
// replace the placeholders with their original values
|
|
294
|
+
return restoreSafeSelector(safeContent.placeholders, scopedSelector);
|
|
295
|
+
};
|
|
296
|
+
const scopeSelector = (selector, scopeSelectorText, hostSelector, slotSelector) => {
|
|
297
|
+
return selector
|
|
298
|
+
.split(',')
|
|
299
|
+
.map((shallowPart) => {
|
|
300
|
+
if (slotSelector && shallowPart.indexOf('.' + slotSelector) > -1) {
|
|
301
|
+
return shallowPart.trim();
|
|
302
|
+
}
|
|
303
|
+
if (selectorNeedsScoping(shallowPart, scopeSelectorText)) {
|
|
304
|
+
return applyStrictSelectorScope(shallowPart, scopeSelectorText, hostSelector).trim();
|
|
305
|
+
}
|
|
306
|
+
else {
|
|
307
|
+
return shallowPart.trim();
|
|
308
|
+
}
|
|
309
|
+
})
|
|
310
|
+
.join(', ');
|
|
311
|
+
};
|
|
312
|
+
const scopeSelectors = (cssText, scopeSelectorText, hostSelector, slotSelector, commentOriginalSelector) => {
|
|
313
|
+
return processRules(cssText, (rule) => {
|
|
314
|
+
let selector = rule.selector;
|
|
315
|
+
let content = rule.content;
|
|
316
|
+
if (rule.selector[0] !== '@') {
|
|
317
|
+
selector = scopeSelector(rule.selector, scopeSelectorText, hostSelector, slotSelector);
|
|
318
|
+
}
|
|
319
|
+
else if (rule.selector.startsWith('@media') ||
|
|
320
|
+
rule.selector.startsWith('@supports') ||
|
|
321
|
+
rule.selector.startsWith('@page') ||
|
|
322
|
+
rule.selector.startsWith('@document')) {
|
|
323
|
+
content = scopeSelectors(rule.content, scopeSelectorText, hostSelector, slotSelector);
|
|
324
|
+
}
|
|
325
|
+
const cssRule = {
|
|
326
|
+
selector: selector.replace(/\s{2,}/g, ' ').trim(),
|
|
327
|
+
content,
|
|
328
|
+
};
|
|
329
|
+
return cssRule;
|
|
330
|
+
});
|
|
331
|
+
};
|
|
332
|
+
const scopeCssText = (cssText, scopeId, hostScopeId, slotScopeId, commentOriginalSelector) => {
|
|
333
|
+
cssText = insertPolyfillHostInCssText(cssText);
|
|
334
|
+
cssText = convertColonHost(cssText);
|
|
335
|
+
cssText = convertColonHostContext(cssText);
|
|
336
|
+
const slotted = convertColonSlotted(cssText, slotScopeId);
|
|
337
|
+
cssText = slotted.cssText;
|
|
338
|
+
cssText = convertShadowDOMSelectors(cssText);
|
|
339
|
+
if (scopeId) {
|
|
340
|
+
cssText = scopeSelectors(cssText, scopeId, hostScopeId, slotScopeId);
|
|
341
|
+
}
|
|
342
|
+
cssText = cssText.replace(/-shadowcsshost-no-combinator/g, `.${hostScopeId}`);
|
|
343
|
+
cssText = cssText.replace(/>\s*\*\s+([^{, ]+)/gm, ' $1 ');
|
|
344
|
+
return {
|
|
345
|
+
cssText: cssText.trim(),
|
|
346
|
+
slottedSelectors: slotted.selectors,
|
|
347
|
+
};
|
|
348
|
+
};
|
|
349
|
+
const scopeCss = (cssText, scopeId, commentOriginalSelector) => {
|
|
350
|
+
const hostScopeId = scopeId + '-h';
|
|
351
|
+
const slotScopeId = scopeId + '-s';
|
|
352
|
+
const commentsWithHash = extractCommentsWithHash(cssText);
|
|
353
|
+
cssText = stripComments(cssText);
|
|
354
|
+
const orgSelectors = [];
|
|
355
|
+
if (commentOriginalSelector) {
|
|
356
|
+
const processCommentedSelector = (rule) => {
|
|
357
|
+
const placeholder = `/*!@___${orgSelectors.length}___*/`;
|
|
358
|
+
const comment = `/*!@${rule.selector}*/`;
|
|
359
|
+
orgSelectors.push({ placeholder, comment });
|
|
360
|
+
rule.selector = placeholder + rule.selector;
|
|
361
|
+
return rule;
|
|
362
|
+
};
|
|
363
|
+
cssText = processRules(cssText, (rule) => {
|
|
364
|
+
if (rule.selector[0] !== '@') {
|
|
365
|
+
return processCommentedSelector(rule);
|
|
366
|
+
}
|
|
367
|
+
else if (rule.selector.startsWith('@media') ||
|
|
368
|
+
rule.selector.startsWith('@supports') ||
|
|
369
|
+
rule.selector.startsWith('@page') ||
|
|
370
|
+
rule.selector.startsWith('@document')) {
|
|
371
|
+
rule.content = processRules(rule.content, processCommentedSelector);
|
|
372
|
+
return rule;
|
|
373
|
+
}
|
|
374
|
+
return rule;
|
|
375
|
+
});
|
|
376
|
+
}
|
|
377
|
+
const scoped = scopeCssText(cssText, scopeId, hostScopeId, slotScopeId);
|
|
378
|
+
cssText = [scoped.cssText, ...commentsWithHash].join('\n');
|
|
379
|
+
if (commentOriginalSelector) {
|
|
380
|
+
orgSelectors.forEach(({ placeholder, comment }) => {
|
|
381
|
+
cssText = cssText.replace(placeholder, comment);
|
|
382
|
+
});
|
|
383
|
+
}
|
|
384
|
+
scoped.slottedSelectors.forEach((slottedSelector) => {
|
|
385
|
+
cssText = cssText.replace(slottedSelector.orgSelector, slottedSelector.updatedSelector);
|
|
386
|
+
});
|
|
387
|
+
return cssText;
|
|
388
|
+
};
|
|
389
|
+
|
|
390
|
+
export { scopeCss };
|
|
@@ -1,9 +1,27 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
/*!
|
|
2
|
+
* Built by Revolist
|
|
3
|
+
*/
|
|
4
|
+
class ThemeCompact {
|
|
5
|
+
constructor() {
|
|
6
|
+
this.defaultRowSize = 32;
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
class ThemeDefault {
|
|
11
|
+
constructor() {
|
|
12
|
+
this.defaultRowSize = 27;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
class ThemeMaterial {
|
|
17
|
+
constructor() {
|
|
18
|
+
this.defaultRowSize = 42;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
const DEFAULT_THEME = 'default';
|
|
23
|
+
const allowedThemes = [DEFAULT_THEME, 'material', 'compact', 'darkMaterial', 'darkCompact'];
|
|
24
|
+
class ThemeService {
|
|
7
25
|
constructor(cfg) {
|
|
8
26
|
this.customRowSize = 0;
|
|
9
27
|
this.customRowSize = cfg.rowSize;
|
|
@@ -41,3 +59,5 @@ export default class ThemeService {
|
|
|
41
59
|
return DEFAULT_THEME;
|
|
42
60
|
}
|
|
43
61
|
}
|
|
62
|
+
|
|
63
|
+
export { ThemeService as T };
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Built by Revolist
|
|
3
|
+
*/
|
|
4
|
+
import { t as toNumber_1 } from './toNumber-913b0b72.js';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* The base implementation of `_.findIndex` and `_.findLastIndex` without
|
|
8
|
+
* support for iteratee shorthands.
|
|
9
|
+
*
|
|
10
|
+
* @private
|
|
11
|
+
* @param {Array} array The array to inspect.
|
|
12
|
+
* @param {Function} predicate The function invoked per iteration.
|
|
13
|
+
* @param {number} fromIndex The index to search from.
|
|
14
|
+
* @param {boolean} [fromRight] Specify iterating from right to left.
|
|
15
|
+
* @returns {number} Returns the index of the matched value, else `-1`.
|
|
16
|
+
*/
|
|
17
|
+
function baseFindIndex(array, predicate, fromIndex, fromRight) {
|
|
18
|
+
var length = array.length,
|
|
19
|
+
index = fromIndex + (fromRight ? 1 : -1);
|
|
20
|
+
|
|
21
|
+
while ((fromRight ? index-- : ++index < length)) {
|
|
22
|
+
if (predicate(array[index], index, array)) {
|
|
23
|
+
return index;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
return -1;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
var _baseFindIndex = baseFindIndex;
|
|
30
|
+
|
|
31
|
+
/** Used as references for various `Number` constants. */
|
|
32
|
+
var INFINITY = 1 / 0,
|
|
33
|
+
MAX_INTEGER = 1.7976931348623157e+308;
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Converts `value` to a finite number.
|
|
37
|
+
*
|
|
38
|
+
* @static
|
|
39
|
+
* @memberOf _
|
|
40
|
+
* @since 4.12.0
|
|
41
|
+
* @category Lang
|
|
42
|
+
* @param {*} value The value to convert.
|
|
43
|
+
* @returns {number} Returns the converted number.
|
|
44
|
+
* @example
|
|
45
|
+
*
|
|
46
|
+
* _.toFinite(3.2);
|
|
47
|
+
* // => 3.2
|
|
48
|
+
*
|
|
49
|
+
* _.toFinite(Number.MIN_VALUE);
|
|
50
|
+
* // => 5e-324
|
|
51
|
+
*
|
|
52
|
+
* _.toFinite(Infinity);
|
|
53
|
+
* // => 1.7976931348623157e+308
|
|
54
|
+
*
|
|
55
|
+
* _.toFinite('3.2');
|
|
56
|
+
* // => 3.2
|
|
57
|
+
*/
|
|
58
|
+
function toFinite(value) {
|
|
59
|
+
if (!value) {
|
|
60
|
+
return value === 0 ? value : 0;
|
|
61
|
+
}
|
|
62
|
+
value = toNumber_1(value);
|
|
63
|
+
if (value === INFINITY || value === -INFINITY) {
|
|
64
|
+
var sign = (value < 0 ? -1 : 1);
|
|
65
|
+
return sign * MAX_INTEGER;
|
|
66
|
+
}
|
|
67
|
+
return value === value ? value : 0;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
var toFinite_1 = toFinite;
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* Converts `value` to an integer.
|
|
74
|
+
*
|
|
75
|
+
* **Note:** This method is loosely based on
|
|
76
|
+
* [`ToInteger`](http://www.ecma-international.org/ecma-262/7.0/#sec-tointeger).
|
|
77
|
+
*
|
|
78
|
+
* @static
|
|
79
|
+
* @memberOf _
|
|
80
|
+
* @since 4.0.0
|
|
81
|
+
* @category Lang
|
|
82
|
+
* @param {*} value The value to convert.
|
|
83
|
+
* @returns {number} Returns the converted integer.
|
|
84
|
+
* @example
|
|
85
|
+
*
|
|
86
|
+
* _.toInteger(3.2);
|
|
87
|
+
* // => 3
|
|
88
|
+
*
|
|
89
|
+
* _.toInteger(Number.MIN_VALUE);
|
|
90
|
+
* // => 0
|
|
91
|
+
*
|
|
92
|
+
* _.toInteger(Infinity);
|
|
93
|
+
* // => 1.7976931348623157e+308
|
|
94
|
+
*
|
|
95
|
+
* _.toInteger('3.2');
|
|
96
|
+
* // => 3
|
|
97
|
+
*/
|
|
98
|
+
function toInteger(value) {
|
|
99
|
+
var result = toFinite_1(value),
|
|
100
|
+
remainder = result % 1;
|
|
101
|
+
|
|
102
|
+
return result === result ? (remainder ? result - remainder : result) : 0;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
var toInteger_1 = toInteger;
|
|
106
|
+
|
|
107
|
+
export { _baseFindIndex as _, toFinite_1 as a, toInteger_1 as t };
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Built by Revolist
|
|
3
|
+
*/
|
|
4
|
+
import { i as isSymbol_1, a as isObject_1 } from './isSymbol-e4b5dafe.js';
|
|
5
|
+
|
|
6
|
+
/** Used to match a single whitespace character. */
|
|
7
|
+
var reWhitespace = /\s/;
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Used by `_.trim` and `_.trimEnd` to get the index of the last non-whitespace
|
|
11
|
+
* character of `string`.
|
|
12
|
+
*
|
|
13
|
+
* @private
|
|
14
|
+
* @param {string} string The string to inspect.
|
|
15
|
+
* @returns {number} Returns the index of the last non-whitespace character.
|
|
16
|
+
*/
|
|
17
|
+
function trimmedEndIndex(string) {
|
|
18
|
+
var index = string.length;
|
|
19
|
+
|
|
20
|
+
while (index-- && reWhitespace.test(string.charAt(index))) {}
|
|
21
|
+
return index;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
var _trimmedEndIndex = trimmedEndIndex;
|
|
25
|
+
|
|
26
|
+
/** Used to match leading whitespace. */
|
|
27
|
+
var reTrimStart = /^\s+/;
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* The base implementation of `_.trim`.
|
|
31
|
+
*
|
|
32
|
+
* @private
|
|
33
|
+
* @param {string} string The string to trim.
|
|
34
|
+
* @returns {string} Returns the trimmed string.
|
|
35
|
+
*/
|
|
36
|
+
function baseTrim(string) {
|
|
37
|
+
return string
|
|
38
|
+
? string.slice(0, _trimmedEndIndex(string) + 1).replace(reTrimStart, '')
|
|
39
|
+
: string;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
var _baseTrim = baseTrim;
|
|
43
|
+
|
|
44
|
+
/** Used as references for various `Number` constants. */
|
|
45
|
+
var NAN = 0 / 0;
|
|
46
|
+
|
|
47
|
+
/** Used to detect bad signed hexadecimal string values. */
|
|
48
|
+
var reIsBadHex = /^[-+]0x[0-9a-f]+$/i;
|
|
49
|
+
|
|
50
|
+
/** Used to detect binary string values. */
|
|
51
|
+
var reIsBinary = /^0b[01]+$/i;
|
|
52
|
+
|
|
53
|
+
/** Used to detect octal string values. */
|
|
54
|
+
var reIsOctal = /^0o[0-7]+$/i;
|
|
55
|
+
|
|
56
|
+
/** Built-in method references without a dependency on `root`. */
|
|
57
|
+
var freeParseInt = parseInt;
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* Converts `value` to a number.
|
|
61
|
+
*
|
|
62
|
+
* @static
|
|
63
|
+
* @memberOf _
|
|
64
|
+
* @since 4.0.0
|
|
65
|
+
* @category Lang
|
|
66
|
+
* @param {*} value The value to process.
|
|
67
|
+
* @returns {number} Returns the number.
|
|
68
|
+
* @example
|
|
69
|
+
*
|
|
70
|
+
* _.toNumber(3.2);
|
|
71
|
+
* // => 3.2
|
|
72
|
+
*
|
|
73
|
+
* _.toNumber(Number.MIN_VALUE);
|
|
74
|
+
* // => 5e-324
|
|
75
|
+
*
|
|
76
|
+
* _.toNumber(Infinity);
|
|
77
|
+
* // => Infinity
|
|
78
|
+
*
|
|
79
|
+
* _.toNumber('3.2');
|
|
80
|
+
* // => 3.2
|
|
81
|
+
*/
|
|
82
|
+
function toNumber(value) {
|
|
83
|
+
if (typeof value == 'number') {
|
|
84
|
+
return value;
|
|
85
|
+
}
|
|
86
|
+
if (isSymbol_1(value)) {
|
|
87
|
+
return NAN;
|
|
88
|
+
}
|
|
89
|
+
if (isObject_1(value)) {
|
|
90
|
+
var other = typeof value.valueOf == 'function' ? value.valueOf() : value;
|
|
91
|
+
value = isObject_1(other) ? (other + '') : other;
|
|
92
|
+
}
|
|
93
|
+
if (typeof value != 'string') {
|
|
94
|
+
return value === 0 ? value : +value;
|
|
95
|
+
}
|
|
96
|
+
value = _baseTrim(value);
|
|
97
|
+
var isBinary = reIsBinary.test(value);
|
|
98
|
+
return (isBinary || reIsOctal.test(value))
|
|
99
|
+
? freeParseInt(value.slice(2), isBinary ? 2 : 8)
|
|
100
|
+
: (reIsBadHex.test(value) ? NAN : +value);
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
var toNumber_1 = toNumber;
|
|
104
|
+
|
|
105
|
+
export { toNumber_1 as t };
|