intelicoreact 1.3.19 → 1.3.21
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/Atomic/FormElements/ActionAlert/ActionAlert.js +23 -15
- package/dist/Atomic/FormElements/AdvancedStatus/AdvancedStatus.js +23 -15
- package/dist/Atomic/FormElements/Calendar/Calendar.js +124 -69
- package/dist/Atomic/FormElements/CheckboxInput/CheckboxInput.js +36 -27
- package/dist/Atomic/FormElements/CheckboxesLine/CheckboxesLine.js +39 -23
- package/dist/Atomic/FormElements/Datepicker/Datepicker.js +246 -110
- package/dist/Atomic/FormElements/Datepicker/components/Calendar.js +85 -44
- package/dist/Atomic/FormElements/Dropdown/Dropdown.js +414 -246
- package/dist/Atomic/FormElements/Dropdown/components/DropdownLoader.js +9 -5
- package/dist/Atomic/FormElements/DropdownLiveSearch/DropdownLiveSearch.js +165 -93
- package/dist/Atomic/FormElements/FileLoader/FileLoader.js +64 -39
- package/dist/Atomic/FormElements/FileLoader/partial/LoadZone.js +132 -51
- package/dist/Atomic/FormElements/FileLoader/partial/LoadedContent.js +73 -34
- package/dist/Atomic/FormElements/FileLoaderLocal/FileLoaderLocal.js +75 -54
- package/dist/Atomic/FormElements/FileLoaderLocalGroup/FileLoaderLocalGroup.js +110 -67
- package/dist/Atomic/FormElements/FormattedRawSSN/FormattedRawSSN.js +83 -33
- package/dist/Atomic/FormElements/Input/Input.js +253 -161
- package/dist/Atomic/FormElements/InputCalendar/InputCalendar.js +102 -48
- package/dist/Atomic/FormElements/InputColor/InputColor.js +40 -27
- package/dist/Atomic/FormElements/InputCurrency/InputCurrency.js +58 -28
- package/dist/Atomic/FormElements/InputDateRange/InputDateRange.js +176 -108
- package/dist/Atomic/FormElements/InputDateRange/components/DateInput.js +57 -32
- package/dist/Atomic/FormElements/InputDateRange/components/Datepicker.js +302 -184
- package/dist/Atomic/FormElements/InputDateRange/components/OpenedPart.js +157 -85
- package/dist/Atomic/FormElements/InputDateRange/components/SelectItem.js +16 -11
- package/dist/Atomic/FormElements/InputDateRange/dependencies.js +193 -76
- package/dist/Atomic/FormElements/InputLink/InputLink.js +58 -34
- package/dist/Atomic/FormElements/InputMask/InputCarretPosition.js +12 -8
- package/dist/Atomic/FormElements/InputMask/InputMask.js +964 -554
- package/dist/Atomic/FormElements/InputMask/config.js +1 -1
- package/dist/Atomic/FormElements/InputMask/functions.js +43 -17
- package/dist/Atomic/FormElements/InputMask2/InputMask2.js +404 -268
- package/dist/Atomic/FormElements/InputMask2/config.js +1 -1
- package/dist/Atomic/FormElements/InputMask2/functions.js +43 -17
- package/dist/Atomic/FormElements/InputMask3/InputMask3.js +459 -299
- package/dist/Atomic/FormElements/InputMask3/config.js +1 -1
- package/dist/Atomic/FormElements/InputMask3/functions.js +43 -17
- package/dist/Atomic/FormElements/InputWithAction/InputWithAction.js +113 -53
- package/dist/Atomic/FormElements/InputsRow/InputsRow.js +118 -64
- package/dist/Atomic/FormElements/Label/Label.js +23 -13
- package/dist/Atomic/FormElements/MobileCalendar/MobileCalendar.js +349 -217
- package/dist/Atomic/FormElements/MultiSelect/MultiSelect.js +47 -25
- package/dist/Atomic/FormElements/NumericInput/NumericInput.js +207 -133
- package/dist/Atomic/FormElements/RadioGroup/RadioGroup.js +61 -29
- package/dist/Atomic/FormElements/RadioGroupWithInput/RadioGroupWithInput.js +42 -20
- package/dist/Atomic/FormElements/RadioInput/RadioInput.js +33 -22
- package/dist/Atomic/FormElements/RadioRowSwitcher/RadioRowSwitcher.js +43 -20
- package/dist/Atomic/FormElements/RangeCalendar/RangeCalendar.js +101 -54
- package/dist/Atomic/FormElements/RangeInputs/RangeInputs.js +102 -59
- package/dist/Atomic/FormElements/RangeList/RangeList.js +150 -89
- package/dist/Atomic/FormElements/RangeList/partial/RangeListRow.js +29 -23
- package/dist/Atomic/FormElements/RangeSlider/RangeSlider.js +300 -135
- package/dist/Atomic/FormElements/RangeSlider2/RangeSlider2.js +571 -381
- package/dist/Atomic/FormElements/SwitchableRow/SwitchableRow.js +24 -14
- package/dist/Atomic/FormElements/Switcher/Switcher.js +29 -24
- package/dist/Atomic/FormElements/SwitcherCheckbox/SwitcherCheckbox.js +47 -25
- package/dist/Atomic/FormElements/SwitcherHide/SwitcherHide.js +32 -20
- package/dist/Atomic/FormElements/SwitcherRadio/SwitcherRadio.js +55 -32
- package/dist/Atomic/FormElements/SwitcherRange/SwitcherRange.js +42 -22
- package/dist/Atomic/FormElements/SwitcherRangeList/SwitcherRangeList.js +33 -23
- package/dist/Atomic/FormElements/SwitcherTagsDropdown/SwitcherTagsDropdown.js +120 -51
- package/dist/Atomic/FormElements/SwitcherTagsDropdown/partial/States.js +3 -2
- package/dist/Atomic/FormElements/SwitcherTextarea/SwitcherTextarea.js +46 -23
- package/dist/Atomic/FormElements/TagsDropdown/TagsDropdown.js +417 -253
- package/dist/Atomic/FormElements/Text/Text.js +53 -47
- package/dist/Atomic/FormElements/TextSwitcher/TextSwitcher.js +31 -21
- package/dist/Atomic/FormElements/Textarea/Textarea.js +27 -16
- package/dist/Atomic/FormElements/TieredCheckboxes/TieredCheckboxes.js +128 -68
- package/dist/Atomic/FormElements/TieredCheckboxes/partial/AccordionWithCheckbox.js +36 -25
- package/dist/Atomic/FormElements/TimeRange/TimeRange.js +70 -33
- package/dist/Atomic/FormElements/UserContacts/UserContacts.js +124 -58
- package/dist/Atomic/FormElements/UserContacts/partial/defaultIcons.js +91 -0
- package/dist/Atomic/FormElements/VariantsListRadio/VariantsListRadio.js +80 -48
- package/dist/Atomic/FormElements/VariantsListRadio/partials/VariantsListRadioItem.js +42 -32
- package/dist/Atomic/FormElements/WidgetPseudoTable/WidgetPseudoTable.js +60 -40
- package/dist/Atomic/FormElements/WidgetPseudoTable/partial/constructor.js +3 -2
- package/dist/Atomic/FormElements/WidgetWithSwitchableRows/WidgetWithSwitchableRows.js +69 -50
- package/dist/Atomic/FormElements/WidgetWithSwitchableRows/partial/constructor.js +3 -3
- package/dist/Atomic/Layout/Header/Header.js +48 -21
- package/dist/Atomic/Layout/MainMenu/MainMenu.js +79 -36
- package/dist/Atomic/Layout/Spinner/Spinner.js +14 -8
- package/dist/Atomic/UI/Accordion/Accordion.js +48 -18
- package/dist/Atomic/UI/Accordion/AccordionItem.js +60 -35
- package/dist/Atomic/UI/AccordionTable/AccordionTable.js +106 -49
- package/dist/Atomic/UI/AccordionText/AccordionText.js +37 -13
- package/dist/Atomic/UI/AdvancedTag/AdvTag.js +94 -48
- package/dist/Atomic/UI/AdvancedTag/AdvancedTags.js +50 -22
- package/dist/Atomic/UI/Alert/Alert.js +44 -20
- package/dist/Atomic/UI/Arrow/Arrow.js +35 -15
- package/dist/Atomic/UI/Box/Box.js +21 -14
- package/dist/Atomic/UI/Button/Button.js +35 -26
- package/dist/Atomic/UI/ButtonsBar/ButtonsBar.js +31 -22
- package/dist/Atomic/UI/Chart/Chart.js +86 -45
- package/dist/Atomic/UI/Chart/partial/Chart.constants.js +24 -14
- package/dist/Atomic/UI/Chart/partial/ChartTypeSwitcherIcon/ChartTypeSwitcherIcon.js +22 -13
- package/dist/Atomic/UI/Chart/partial/datasetSetters.js +113 -68
- package/dist/Atomic/UI/Chart/partial/optionsConstructor.js +140 -158
- package/dist/Atomic/UI/Chart/partial/optionsSetters.js +42 -26
- package/dist/Atomic/UI/Chart/partial/utils.js +48 -20
- package/dist/Atomic/UI/CircleProgressBar/CircleProgressBar.js +42 -22
- package/dist/Atomic/UI/DateTime/DateTime.js +38 -23
- package/dist/Atomic/UI/DebugContainer/DebugContainer.js +36 -12
- package/dist/Atomic/UI/DebugContainer/useDebugContainer.js +21 -5
- package/dist/Atomic/UI/DoubleString/DoubleString.js +50 -27
- package/dist/Atomic/UI/DynamicIcon/DynamicIcon.js +63 -15
- package/dist/Atomic/UI/ExampleChartIntegration/ExampleChartIntegration.js +157 -62
- package/dist/Atomic/UI/ExampleChartIntegration/partial/utils.js +110 -47
- package/dist/Atomic/UI/Hint/Hint.js +94 -49
- package/dist/Atomic/UI/Modal/Modal.js +179 -149
- package/dist/Atomic/UI/Modal/ModalHOC.js +21 -12
- package/dist/Atomic/UI/Modal/partials/ModalFooter.js +12 -7
- package/dist/Atomic/UI/Modal/partials/ModalTitle.js +21 -17
- package/dist/Atomic/UI/Modal/partials/useMobileModal.js +167 -94
- package/dist/Atomic/UI/ModalBackup/Modal.js +90 -65
- package/dist/Atomic/UI/ModalBackup/ModalHOC.js +21 -12
- package/dist/Atomic/UI/ModalBackup/partials/ModalFooter.js +11 -6
- package/dist/Atomic/UI/ModalBackup/partials/ModalTitle.js +19 -15
- package/dist/Atomic/UI/MonoAccordion/MonoAccordion.js +62 -32
- package/dist/Atomic/UI/NavLine/NavLine.js +211 -120
- package/dist/Atomic/UI/NavLine/Tabs.js +3 -2
- package/dist/Atomic/UI/PageTitle/PageTitle.js +17 -13
- package/dist/Atomic/UI/PieChart/PieChart.js +21 -11
- package/dist/Atomic/UI/Price/Price.js +13 -10
- package/dist/Atomic/UI/PriceRange/PriceRange.js +11 -7
- package/dist/Atomic/UI/ProgressLine/ProgressLine.js +56 -27
- package/dist/Atomic/UI/Status/Status.js +30 -19
- package/dist/Atomic/UI/Table/Partials/TdCell.js +71 -28
- package/dist/Atomic/UI/Table/Partials/TdHeader.js +16 -7
- package/dist/Atomic/UI/Table/Partials/TdRow.js +65 -29
- package/dist/Atomic/UI/Table/Partials/TdTitle.js +40 -16
- package/dist/Atomic/UI/Table/Table.js +47 -27
- package/dist/Atomic/UI/Table/TdTypes/TdActions.js +48 -18
- package/dist/Atomic/UI/Table/TdTypes/TdPriority.js +19 -9
- package/dist/Atomic/UI/Table/TdTypes/TdRange.js +8 -5
- package/dist/Atomic/UI/Table/TdTypes/TdWeight.js +47 -25
- package/dist/Atomic/UI/Tag/Tag.js +48 -20
- package/dist/Atomic/UI/TagList/TagList.js +150 -80
- package/dist/Atomic/UI/UserBox/UserBox.js +26 -14
- package/dist/Classes/AbortableFetch.js +422 -283
- package/dist/Classes/AnimatedHandler.js +56 -44
- package/dist/Classes/RESTAPI/index.js +433 -154
- package/dist/Classes/RESTAPI/partials/AbortableFetch.js +428 -290
- package/dist/Classes/RESTAPI/partials/ApiBase.js +67 -24
- package/dist/Classes/RESTAPI/partials/ApiRequestCreators.js +275 -57
- package/dist/Classes/RESTAPI/partials/ApiUtils.js +377 -146
- package/dist/Classes/RESTAPI/partials/CredentialsProcessing.js +403 -155
- package/dist/Classes/RESTAPI/partials/Utils.js +135 -81
- package/dist/Classes/RESTAPI/partials/_outerDependencies.js +6 -2
- package/dist/Classes/RESTAPI/partials/_utils.js +395 -101
- package/dist/Constants/index.constants.js +15 -8
- package/dist/Functions/Portal.js +33 -14
- package/dist/Functions/customEventListener.js +20 -5
- package/dist/Functions/fieldValueFormatters.js +211 -148
- package/dist/Functions/hooks/useFormFieldsChangesManager.js +137 -75
- package/dist/Functions/locale/createTranslator.js +27 -13
- package/dist/Functions/operations.js +49 -35
- package/dist/Functions/presets/inputMaskPresets.js +27 -25
- package/dist/Functions/presets/inputPresets.js +22 -19
- package/dist/Functions/presets/mobileKeyboardTypesPresets.js +9 -7
- package/dist/Functions/schemas.js +15 -6
- package/dist/Functions/useClickOutside.js +7 -3
- package/dist/Functions/useDebounce.js +25 -11
- package/dist/Functions/useFieldFocus.js +67 -42
- package/dist/Functions/useFormTools/form-drivers/ArrayWithObjects.js +54 -35
- package/dist/Functions/useFormTools/form-drivers/ObjectWithIterableObjects.js +95 -74
- package/dist/Functions/useFormTools/form-drivers/ObjectWithNamedKeyObjects.js +91 -55
- package/dist/Functions/useFormTools/functions/General.js +99 -80
- package/dist/Functions/useFormTools/functions/RenderFields.js +72 -45
- package/dist/Functions/useFormTools/functions/usePrevious.js +7 -3
- package/dist/Functions/useFormTools/index.js +598 -382
- package/dist/Functions/useInputHighlightError.js +52 -27
- package/dist/Functions/useIsMobile.js +36 -13
- package/dist/Functions/useLocalStorage.js +22 -7
- package/dist/Functions/useLocationParams.js +27 -16
- package/dist/Functions/useMetaInfo.js +50 -19
- package/dist/Functions/useMouseUpOutside.js +5 -2
- package/dist/Functions/useOnlineStatus.js +26 -7
- package/dist/Functions/usePasswordChecker.js +77 -42
- package/dist/Functions/usePrevious.js +7 -3
- package/dist/Functions/useResize.js +32 -12
- package/dist/Functions/useScrollTo.js +20 -6
- package/dist/Functions/useToggle.js +30 -10
- package/dist/Functions/utils.js +366 -186
- package/dist/Molecular/CustomIcons/components/AffiliateNetworks.js +32 -21
- package/dist/Molecular/CustomIcons/components/AlertCircle.js +32 -21
- package/dist/Molecular/CustomIcons/components/AppStore.js +36 -25
- package/dist/Molecular/CustomIcons/components/Arrow.js +42 -31
- package/dist/Molecular/CustomIcons/components/ArrowDown.js +24 -13
- package/dist/Molecular/CustomIcons/components/ArrowLeft.js +27 -16
- package/dist/Molecular/CustomIcons/components/ArrowRight.js +27 -16
- package/dist/Molecular/CustomIcons/components/ArrowUp.js +24 -13
- package/dist/Molecular/CustomIcons/components/Bell.js +22 -11
- package/dist/Molecular/CustomIcons/components/Button.js +22 -11
- package/dist/Molecular/CustomIcons/components/Campaigns.js +23 -12
- package/dist/Molecular/CustomIcons/components/Check.js +23 -12
- package/dist/Molecular/CustomIcons/components/Check2.js +22 -11
- package/dist/Molecular/CustomIcons/components/ChevronDown.js +22 -11
- package/dist/Molecular/CustomIcons/components/ChevronDownDisabled.js +22 -11
- package/dist/Molecular/CustomIcons/components/ChevronLeft.js +22 -11
- package/dist/Molecular/CustomIcons/components/ChevronRight.js +22 -11
- package/dist/Molecular/CustomIcons/components/ChevronUp.js +22 -11
- package/dist/Molecular/CustomIcons/components/ChevronUpDown.js +37 -26
- package/dist/Molecular/CustomIcons/components/Close.js +24 -13
- package/dist/Molecular/CustomIcons/components/ColumnsOrder.js +49 -38
- package/dist/Molecular/CustomIcons/components/Delete.js +23 -12
- package/dist/Molecular/CustomIcons/components/Edit.js +22 -11
- package/dist/Molecular/CustomIcons/components/Email.js +40 -29
- package/dist/Molecular/CustomIcons/components/FinturfLogo.js +30 -19
- package/dist/Molecular/CustomIcons/components/FinturfLogo2.js +38 -27
- package/dist/Molecular/CustomIcons/components/Flows.js +22 -11
- package/dist/Molecular/CustomIcons/components/Gift.js +27 -16
- package/dist/Molecular/CustomIcons/components/GoogleAuth.js +36 -25
- package/dist/Molecular/CustomIcons/components/GooglePlay.js +36 -25
- package/dist/Molecular/CustomIcons/components/HelpCircle.js +25 -14
- package/dist/Molecular/CustomIcons/components/HelpCircle2.js +26 -15
- package/dist/Molecular/CustomIcons/components/HelpCircleFilled.js +25 -14
- package/dist/Molecular/CustomIcons/components/Home.js +25 -14
- package/dist/Molecular/CustomIcons/components/Home2.js +28 -17
- package/dist/Molecular/CustomIcons/components/Key.js +30 -19
- package/dist/Molecular/CustomIcons/components/Landers.js +26 -15
- package/dist/Molecular/CustomIcons/components/Lock.js +22 -11
- package/dist/Molecular/CustomIcons/components/Mail.js +30 -19
- package/dist/Molecular/CustomIcons/components/Mastercard.js +72 -61
- package/dist/Molecular/CustomIcons/components/Minus.js +35 -24
- package/dist/Molecular/CustomIcons/components/Offers.js +23 -12
- package/dist/Molecular/CustomIcons/components/Pause.js +35 -24
- package/dist/Molecular/CustomIcons/components/PayPal.js +49 -38
- package/dist/Molecular/CustomIcons/components/PayPalLightLarge.js +36 -25
- package/dist/Molecular/CustomIcons/components/Phone.js +37 -26
- package/dist/Molecular/CustomIcons/components/Play.js +35 -24
- package/dist/Molecular/CustomIcons/components/Plus.js +35 -24
- package/dist/Molecular/CustomIcons/components/Profile.js +27 -16
- package/dist/Molecular/CustomIcons/components/QRCode.js +37 -26
- package/dist/Molecular/CustomIcons/components/Rectangle.js +22 -11
- package/dist/Molecular/CustomIcons/components/Revert.js +25 -14
- package/dist/Molecular/CustomIcons/components/Star.js +21 -10
- package/dist/Molecular/CustomIcons/components/Star2.js +23 -12
- package/dist/Molecular/CustomIcons/components/TrafficSources.js +25 -14
- package/dist/Molecular/CustomIcons/components/Trash.js +22 -11
- package/dist/Molecular/CustomIcons/components/TrashRed.js +22 -11
- package/dist/Molecular/CustomIcons/components/Triggers.js +22 -11
- package/dist/Molecular/CustomIcons/components/User.js +27 -16
- package/dist/Molecular/CustomIcons/components/Visa.js +38 -27
- package/dist/Molecular/CustomIcons/components/X.js +22 -11
- package/dist/Molecular/CustomIcons/index.js +183 -61
- package/dist/Molecular/FormElement/FormElement.js +27 -18
- package/dist/Molecular/FormWithDependOn/FormWithDependOn.js +108 -86
- package/dist/Molecular/FormWithDependOn/partials/_utils.js +34 -29
- package/dist/Molecular/InputAddress/InputAddress.js +312 -176
- package/dist/Molecular/InputPassword/InputPassword.js +39 -15
- package/dist/index.js +3 -1
- package/package.json +1 -1
|
@@ -2,43 +2,57 @@
|
|
|
2
2
|
|
|
3
3
|
(function () {
|
|
4
4
|
Element.prototype._addEventListener = Element.prototype.addEventListener;
|
|
5
|
+
|
|
5
6
|
Element.prototype.addEventListener = function (a, b, c) {
|
|
6
7
|
if (c == undefined) c = false;
|
|
8
|
+
|
|
7
9
|
this._addEventListener(a, b, c);
|
|
10
|
+
|
|
8
11
|
if (!this.eventListenerList) this.eventListenerList = {};
|
|
9
|
-
if (!this.eventListenerList[a]) this.eventListenerList[a] = [];
|
|
10
|
-
|
|
12
|
+
if (!this.eventListenerList[a]) this.eventListenerList[a] = []; //this.removeEventListener(a,b,c); // TODO - handle duplicates..
|
|
13
|
+
|
|
11
14
|
this.eventListenerList[a].push({
|
|
12
15
|
listener: b,
|
|
13
16
|
useCapture: c
|
|
14
17
|
});
|
|
15
18
|
};
|
|
19
|
+
|
|
16
20
|
Element.prototype.getEventListeners = function (a) {
|
|
17
21
|
if (!this.eventListenerList) this.eventListenerList = {};
|
|
18
22
|
if (a == undefined) return this.eventListenerList;
|
|
19
23
|
return this.eventListenerList[a];
|
|
20
24
|
};
|
|
25
|
+
|
|
21
26
|
Element.prototype.clearEventListeners = function (a) {
|
|
22
27
|
if (!this.eventListenerList) this.eventListenerList = {};
|
|
28
|
+
|
|
23
29
|
if (a == undefined) {
|
|
24
|
-
for (var x in this.getEventListeners())
|
|
30
|
+
for (var x in this.getEventListeners()) {
|
|
31
|
+
this.clearEventListeners(x);
|
|
32
|
+
}
|
|
33
|
+
|
|
25
34
|
return;
|
|
26
35
|
}
|
|
36
|
+
|
|
27
37
|
var el = this.getEventListeners(a);
|
|
28
38
|
if (el == undefined) return;
|
|
39
|
+
|
|
29
40
|
for (var i = el.length - 1; i >= 0; --i) {
|
|
30
41
|
var ev = el[i];
|
|
31
42
|
this.removeEventListener(a, ev.listener, ev.useCapture);
|
|
32
43
|
}
|
|
33
44
|
};
|
|
45
|
+
|
|
34
46
|
Element.prototype._removeEventListener = Element.prototype.removeEventListener;
|
|
47
|
+
|
|
35
48
|
Element.prototype.removeEventListener = function (a, b, c) {
|
|
36
49
|
if (c == undefined) c = false;
|
|
50
|
+
|
|
37
51
|
this._removeEventListener(a, b, c);
|
|
52
|
+
|
|
38
53
|
if (!this.eventListenerList) this.eventListenerList = {};
|
|
39
|
-
if (!this.eventListenerList[a]) this.eventListenerList[a] = [];
|
|
54
|
+
if (!this.eventListenerList[a]) this.eventListenerList[a] = []; // Find the event in the list
|
|
40
55
|
|
|
41
|
-
// Find the event in the list
|
|
42
56
|
for (var i = 0; i < this.eventListenerList[a].length; i++) {
|
|
43
57
|
if (this.eventListenerList[a][i].listener == b, this.eventListenerList[a][i].useCapture == c) {
|
|
44
58
|
// Hmm..
|
|
@@ -46,6 +60,7 @@
|
|
|
46
60
|
break;
|
|
47
61
|
}
|
|
48
62
|
}
|
|
63
|
+
|
|
49
64
|
if (this.eventListenerList[a].length == 0) delete this.eventListenerList[a];
|
|
50
65
|
};
|
|
51
66
|
})();
|
|
@@ -6,16 +6,15 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.formatToRemoveComa = exports.formatToPriceWithUSD = exports.formatToPriceWithCurrency = exports.formatToOnlyASCIICodeText = exports.formatToLimitLength = exports.formatToHideValuePartially = exports.formatToHex = exports.formatToAddBitDepthPoints = exports.formatOnlyNumbers = exports.formatNumberValueToMask = exports.formatAsPercentage = exports.filterNumeric = exports.filterFloat = void 0;
|
|
7
7
|
exports.formatToReplaceAllWhiteSpace = formatToReplaceAllWhiteSpace;
|
|
8
8
|
exports.intlNumbersFormatter = exports.getSafelyValue = void 0;
|
|
9
|
+
|
|
9
10
|
var _utils = require("./utils");
|
|
11
|
+
|
|
10
12
|
//? The first word "format" in the function name means a logic
|
|
11
13
|
//? in which the function transforms the incoming value in any case.
|
|
12
|
-
|
|
13
14
|
//? The first word "transform" in the function name means a logic
|
|
14
15
|
//? in which the function converts the whole value, but this is not suitable for sequential input
|
|
15
|
-
|
|
16
16
|
//? The first word "filter" in the function name means a logic
|
|
17
17
|
//? in which the function works as a changer for sequential input
|
|
18
|
-
|
|
19
18
|
// ****************************
|
|
20
19
|
// Base utils
|
|
21
20
|
// ****************************
|
|
@@ -24,127 +23,149 @@ var _utils = require("./utils");
|
|
|
24
23
|
* If the value is not undefined or null, return the value's toString() method, otherwise return an
|
|
25
24
|
* empty string.
|
|
26
25
|
*/
|
|
27
|
-
|
|
26
|
+
var getSafelyValue = function getSafelyValue(value) {
|
|
28
27
|
var _value$toString;
|
|
29
|
-
return value !== undefined && value !== null ? (value === null || value === void 0 || (_value$toString = value.toString) === null || _value$toString === void 0 ? void 0 : _value$toString.call(value)) || '' : '';
|
|
30
|
-
};
|
|
31
28
|
|
|
32
|
-
|
|
29
|
+
return value !== undefined && value !== null ? (value === null || value === void 0 ? void 0 : (_value$toString = value.toString) === null || _value$toString === void 0 ? void 0 : _value$toString.call(value)) || '' : '';
|
|
30
|
+
}; // базовая реализация
|
|
31
|
+
|
|
32
|
+
|
|
33
33
|
exports.getSafelyValue = getSafelyValue;
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
34
|
+
|
|
35
|
+
var intlNumbersFormatter = function intlNumbersFormatter(inputValue) {
|
|
36
|
+
var settings = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
37
|
+
var safelyInputValue = getSafelyValue(inputValue);
|
|
38
|
+
var previousValue = safelyInputValue.slice(0, -1);
|
|
39
|
+
var lastSym = safelyInputValue.slice(-1);
|
|
40
|
+
var value = lastSym === '.' ? previousValue : safelyInputValue;
|
|
40
41
|
if (Number.isNaN(+value) || !getSafelyValue(value)) return '';
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
currencyType = 'USD',
|
|
56
|
-
currencyDisplay: inputCurrencyDisplay
|
|
57
|
-
} = currency;
|
|
58
|
-
let currencyDisplay;
|
|
42
|
+
var _settings$locale = settings.locale,
|
|
43
|
+
locale = _settings$locale === void 0 ? 'en-US' : _settings$locale,
|
|
44
|
+
withSymbol = settings.withSymbol,
|
|
45
|
+
_settings$useGrouping = settings.useGrouping,
|
|
46
|
+
useGrouping = _settings$useGrouping === void 0 ? true : _settings$useGrouping,
|
|
47
|
+
_settings$currency = settings.currency,
|
|
48
|
+
currency = _settings$currency === void 0 ? {} : _settings$currency,
|
|
49
|
+
_settings$fractionDig = settings.fractionDigits,
|
|
50
|
+
fractionDigits = _settings$fractionDig === void 0 ? {} : _settings$fractionDig;
|
|
51
|
+
var _currency$currencyTyp = currency.currencyType,
|
|
52
|
+
currencyType = _currency$currencyTyp === void 0 ? 'USD' : _currency$currencyTyp,
|
|
53
|
+
inputCurrencyDisplay = currency.currencyDisplay;
|
|
54
|
+
var currencyDisplay;
|
|
55
|
+
|
|
59
56
|
switch (inputCurrencyDisplay) {
|
|
60
57
|
case 'name':
|
|
61
58
|
currencyDisplay = 'name';
|
|
62
59
|
break;
|
|
60
|
+
|
|
63
61
|
case 'code':
|
|
64
62
|
currencyDisplay = 'code';
|
|
65
63
|
break;
|
|
64
|
+
|
|
66
65
|
case 'narrowSymbol':
|
|
67
66
|
currencyDisplay = 'narrowSymbol';
|
|
68
67
|
break;
|
|
68
|
+
|
|
69
69
|
default:
|
|
70
70
|
currencyDisplay = 'symbol';
|
|
71
71
|
}
|
|
72
|
-
|
|
72
|
+
|
|
73
|
+
var numberStyle;
|
|
74
|
+
|
|
73
75
|
switch (withSymbol) {
|
|
74
76
|
case 'percent':
|
|
75
77
|
numberStyle = 'percent';
|
|
76
78
|
break;
|
|
79
|
+
|
|
77
80
|
case 'currency':
|
|
78
81
|
numberStyle = 'currency';
|
|
79
82
|
break;
|
|
83
|
+
|
|
80
84
|
default:
|
|
81
85
|
numberStyle = 'decimal';
|
|
82
86
|
break;
|
|
83
87
|
}
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
88
|
+
|
|
89
|
+
var quantity = fractionDigits.quantity,
|
|
90
|
+
_fractionDigits$isRen = fractionDigits.isRenderAlways,
|
|
91
|
+
isRenderAlways = _fractionDigits$isRen === void 0 ? false : _fractionDigits$isRen,
|
|
92
|
+
inputMinimumFractionDigits = fractionDigits.minimumFractionDigits,
|
|
93
|
+
inputMaximumFractionDigits = fractionDigits.maximumFractionDigits,
|
|
94
|
+
conditionallyMinimumFractionDigits = fractionDigits.conditionallyMinimumFractionDigits;
|
|
95
|
+
var dotIndex = safelyInputValue === null || safelyInputValue === void 0 ? void 0 : safelyInputValue.indexOf('.');
|
|
96
|
+
var afterDot = dotIndex !== -1 ? safelyInputValue.slice(dotIndex + 1) : '';
|
|
97
|
+
|
|
98
|
+
var minimumFractionDigits = function () {
|
|
94
99
|
//? Безусловное минимальное количество. Всегда отрендерит дробную часть, в количестве символов сколько указано
|
|
95
|
-
if (typeof inputMinimumFractionDigits === 'number') return inputMinimumFractionDigits;
|
|
96
|
-
|
|
100
|
+
if (typeof inputMinimumFractionDigits === 'number') return inputMinimumFractionDigits; //? Условное минимальное количество. Если есть дробная часть, то отрендерит дробных символов сколько указано
|
|
101
|
+
|
|
97
102
|
if (typeof conditionallyMinimumFractionDigits === 'number') {
|
|
98
103
|
return afterDot && lastSym !== '.' ? conditionallyMinimumFractionDigits : 0;
|
|
99
|
-
}
|
|
100
|
-
//? Дефолтное минимальное количество. Если есть дробная часть, то отрендерит дробных символов столько, сколько есть
|
|
104
|
+
} //? Дефолтное минимальное количество. Если есть дробная часть, то отрендерит дробных символов столько, сколько есть
|
|
101
105
|
//? Флаг isRenderAlways превращает дефолтный кейс в безусловное минимальное количество
|
|
106
|
+
|
|
107
|
+
|
|
102
108
|
return afterDot && lastSym !== '.' ? safelyInputValue.slice(dotIndex).length - 1 : isRenderAlways ? quantity : 0;
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
|
|
109
|
+
}();
|
|
110
|
+
|
|
111
|
+
var priceSettings = {
|
|
112
|
+
useGrouping: useGrouping,
|
|
106
113
|
//группировка разрядов
|
|
107
114
|
style: numberStyle,
|
|
108
115
|
//тип форматирования (валюта или число). decimal - без знака валюты
|
|
109
116
|
currency: currencyType,
|
|
110
117
|
//валюта
|
|
111
|
-
currencyDisplay,
|
|
118
|
+
currencyDisplay: currencyDisplay,
|
|
112
119
|
//валюта в виде символа
|
|
113
120
|
//минимально не надо отображать центы, если их нет, иначе всегда будет .00
|
|
114
|
-
minimumFractionDigits,
|
|
121
|
+
minimumFractionDigits: minimumFractionDigits,
|
|
115
122
|
//! Важно! Если придет велью с количеством дробных разрядов БОЛЬШИМ
|
|
116
123
|
//! чем указано в (inputMaximumFractionDigits ?? quantity) - округлит по правилам округления
|
|
117
124
|
//максимально отображать 2 цифры после запятой, если центы всё же есть
|
|
118
125
|
maximumFractionDigits: inputMaximumFractionDigits !== null && inputMaximumFractionDigits !== void 0 ? inputMaximumFractionDigits : quantity
|
|
119
126
|
};
|
|
120
|
-
|
|
127
|
+
var output;
|
|
128
|
+
|
|
121
129
|
try {
|
|
122
130
|
output = new Intl.NumberFormat(locale, priceSettings).format(value);
|
|
123
131
|
} catch (e) {
|
|
124
132
|
output = value;
|
|
125
133
|
console.warn('Intl.NumberFormat error', e);
|
|
126
134
|
}
|
|
127
|
-
return lastSym === '.' ? output + lastSym : output;
|
|
128
|
-
};
|
|
129
135
|
|
|
130
|
-
|
|
136
|
+
return lastSym === '.' ? output + lastSym : output;
|
|
137
|
+
}; // ****************************
|
|
131
138
|
// format
|
|
132
139
|
// ****************************
|
|
140
|
+
|
|
141
|
+
|
|
133
142
|
exports.intlNumbersFormatter = intlNumbersFormatter;
|
|
134
|
-
|
|
143
|
+
|
|
144
|
+
var formatOnlyNumbers = function formatOnlyNumbers(value) {
|
|
145
|
+
return getSafelyValue(value).replace(/\D/g, '');
|
|
146
|
+
};
|
|
147
|
+
|
|
135
148
|
exports.formatOnlyNumbers = formatOnlyNumbers;
|
|
136
|
-
|
|
149
|
+
|
|
150
|
+
var formatToRemoveComa = function formatToRemoveComa(value) {
|
|
151
|
+
return getSafelyValue(value).replace(/,/g, '');
|
|
152
|
+
};
|
|
153
|
+
|
|
137
154
|
exports.formatToRemoveComa = formatToRemoveComa;
|
|
138
|
-
const formatToAddBitDepthPoints = (value, settings) => intlNumbersFormatter(getSafelyValue(value), {
|
|
139
|
-
fractionDigits: {
|
|
140
|
-
quantity: (settings === null || settings === void 0 ? void 0 : settings.type) === 'int' ? 0 : settings === null || settings === void 0 ? void 0 : settings.decimalPlaces
|
|
141
|
-
}
|
|
142
|
-
});
|
|
143
155
|
|
|
144
|
-
|
|
156
|
+
var formatToAddBitDepthPoints = function formatToAddBitDepthPoints(value, settings) {
|
|
157
|
+
return intlNumbersFormatter(getSafelyValue(value), {
|
|
158
|
+
fractionDigits: {
|
|
159
|
+
quantity: (settings === null || settings === void 0 ? void 0 : settings.type) === 'int' ? 0 : settings === null || settings === void 0 ? void 0 : settings.decimalPlaces
|
|
160
|
+
}
|
|
161
|
+
});
|
|
162
|
+
}; //! Важно! Если придет велью с количеством дробных разрядов БОЛЬШИМ
|
|
145
163
|
//! чем указано в quantity - округлит по правилам округления
|
|
164
|
+
|
|
165
|
+
|
|
146
166
|
exports.formatToAddBitDepthPoints = formatToAddBitDepthPoints;
|
|
147
|
-
|
|
167
|
+
|
|
168
|
+
var formatToPriceWithUSD = function formatToPriceWithUSD(value) {
|
|
148
169
|
if (isNaN(Number(value))) return value;
|
|
149
170
|
return intlNumbersFormatter(getSafelyValue(value), {
|
|
150
171
|
withSymbol: 'currency',
|
|
@@ -156,15 +177,15 @@ const formatToPriceWithUSD = value => {
|
|
|
156
177
|
conditionallyMinimumFractionDigits: 2
|
|
157
178
|
}
|
|
158
179
|
});
|
|
159
|
-
};
|
|
160
|
-
|
|
161
|
-
//! Важно! Если придет велью с количеством дробных разрядов БОЛЬШИМ
|
|
180
|
+
}; //! Важно! Если придет велью с количеством дробных разрядов БОЛЬШИМ
|
|
162
181
|
//! чем указано в quantity - округлит по правилам округления
|
|
163
|
-
|
|
164
182
|
// ToDo - symbolPosition временно не реализовано
|
|
183
|
+
|
|
184
|
+
|
|
165
185
|
exports.formatToPriceWithUSD = formatToPriceWithUSD;
|
|
166
|
-
|
|
167
|
-
|
|
186
|
+
|
|
187
|
+
var formatToPriceWithCurrency = function formatToPriceWithCurrency(value, currencyCode) {
|
|
188
|
+
var symbolPosition = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'before';
|
|
168
189
|
if (isNaN(Number(value))) return value;
|
|
169
190
|
return intlNumbersFormatter(getSafelyValue(value), {
|
|
170
191
|
withSymbol: 'currency',
|
|
@@ -176,38 +197,42 @@ const formatToPriceWithCurrency = function (value, currencyCode) {
|
|
|
176
197
|
conditionallyMinimumFractionDigits: 2
|
|
177
198
|
}
|
|
178
199
|
});
|
|
179
|
-
};
|
|
180
|
-
|
|
181
|
-
//? Добавляет в конец знак %. Работает как с одиночными значениями, так и с диапазонами.
|
|
182
|
-
|
|
200
|
+
}; //? Добавляет в конец знак %. Работает как с одиночными значениями, так и с диапазонами.
|
|
183
201
|
//? value может быть любое, но ожидается что будет
|
|
184
202
|
//? - числом
|
|
185
203
|
//? - строкой в формате "значение"
|
|
186
204
|
//? - строкой в формате "значение - значение" (значение_пробел_тире_пробел_значение)
|
|
187
205
|
//? - объект в формате { from: значение, to: значение }
|
|
188
|
-
|
|
189
206
|
//? Предполагается, что "значение" может быть приведено к числу операторм + (пример: +значение приводится к числу).
|
|
190
207
|
//? Если не может быть приведено, то "значение" вернется как есть, к результату добавится %
|
|
191
|
-
|
|
192
208
|
//? Если "значение" пустое (getSafelyValue(значение) вернет пустую строку),
|
|
193
209
|
//? то это воспринимается как 0, приводится к 0.00%
|
|
194
|
-
|
|
195
210
|
//? Одиноково работает как для ".", так и "," в качестве разделителя дробных разрядов
|
|
196
|
-
|
|
197
211
|
//! Важно! Если придет велью с количеством дробных разрядов БОЛЬШИМ
|
|
198
212
|
//! чем указано в decimalPlaces - округлит по правилам округления
|
|
213
|
+
|
|
214
|
+
|
|
199
215
|
exports.formatToPriceWithCurrency = formatToPriceWithCurrency;
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
216
|
+
|
|
217
|
+
var formatAsPercentage = function formatAsPercentage(value, settings) {
|
|
218
|
+
var _ref = (0, _utils.getIsOnlyAnObject)(settings) ? settings : {},
|
|
219
|
+
_ref$isCommonPercenta = _ref.isCommonPercentageSymbol,
|
|
220
|
+
isCommonPercentageSymbol = _ref$isCommonPercenta === void 0 ? true : _ref$isCommonPercenta,
|
|
221
|
+
_ref$decimalPlaces = _ref.decimalPlaces,
|
|
222
|
+
decimalPlaces = _ref$decimalPlaces === void 0 ? 2 : _ref$decimalPlaces,
|
|
223
|
+
_ref$beforeValueSymbo = _ref.beforeValueSymbol,
|
|
224
|
+
beforeValueSymbol = _ref$beforeValueSymbo === void 0 ? '' : _ref$beforeValueSymbo,
|
|
225
|
+
_ref$afterValueSymbol = _ref.afterValueSymbol,
|
|
226
|
+
afterValueSymbol = _ref$afterValueSymbol === void 0 ? '' : _ref$afterValueSymbol;
|
|
227
|
+
|
|
228
|
+
var safelyInputValue;
|
|
229
|
+
|
|
230
|
+
var checkValue = function checkValue(value) {
|
|
231
|
+
return getSafelyValue(value) || '0';
|
|
232
|
+
};
|
|
233
|
+
|
|
234
|
+
var transform = function transform(valueAsSting) {
|
|
235
|
+
var processedValue = valueAsSting.replace(/,/g, '.');
|
|
211
236
|
if (Number.isNaN(+processedValue)) return processedValue;
|
|
212
237
|
return "".concat(intlNumbersFormatter(getSafelyValue(+processedValue), {
|
|
213
238
|
fractionDigits: {
|
|
@@ -216,6 +241,7 @@ const formatAsPercentage = (value, settings) => {
|
|
|
216
241
|
}
|
|
217
242
|
}));
|
|
218
243
|
};
|
|
244
|
+
|
|
219
245
|
if ((0, _utils.getIsOnlyAnObject)(value)) {
|
|
220
246
|
safelyInputValue = {
|
|
221
247
|
from: checkValue(value.from),
|
|
@@ -223,8 +249,11 @@ const formatAsPercentage = (value, settings) => {
|
|
|
223
249
|
};
|
|
224
250
|
} else {
|
|
225
251
|
safelyInputValue = checkValue(value);
|
|
252
|
+
|
|
226
253
|
if (safelyInputValue.includes(' - ')) {
|
|
227
|
-
|
|
254
|
+
var valuesArr = safelyInputValue.split(' - ').map(function (partOfValue) {
|
|
255
|
+
return partOfValue.trim();
|
|
256
|
+
});
|
|
228
257
|
safelyInputValue = {
|
|
229
258
|
from: checkValue(valuesArr[0]),
|
|
230
259
|
to: checkValue(valuesArr[1])
|
|
@@ -233,30 +262,39 @@ const formatAsPercentage = (value, settings) => {
|
|
|
233
262
|
return "".concat(beforeValueSymbol).concat(transform(safelyInputValue)).concat(afterValueSymbol, "%");
|
|
234
263
|
}
|
|
235
264
|
}
|
|
265
|
+
|
|
236
266
|
if (isCommonPercentageSymbol) return "".concat(beforeValueSymbol).concat(transform(safelyInputValue.from), " - ").concat(transform(safelyInputValue.to)).concat(afterValueSymbol, "%");else return "".concat(beforeValueSymbol).concat(transform(safelyInputValue.from), "% - ").concat(transform(safelyInputValue.to), "%").concat(afterValueSymbol);
|
|
237
|
-
};
|
|
267
|
+
}; // eslint-disable-next-line no-control-regex
|
|
268
|
+
|
|
238
269
|
|
|
239
|
-
// eslint-disable-next-line no-control-regex
|
|
240
270
|
exports.formatAsPercentage = formatAsPercentage;
|
|
241
|
-
const formatToOnlyASCIICodeText = text => getSafelyValue(text).replace(/[^\x00-\x7F]+/g, '');
|
|
242
271
|
|
|
243
|
-
|
|
272
|
+
var formatToOnlyASCIICodeText = function formatToOnlyASCIICodeText(text) {
|
|
273
|
+
return getSafelyValue(text).replace(/[^\x00-\x7F]+/g, '');
|
|
274
|
+
}; // eslint-disable-next-line default-param-last
|
|
275
|
+
|
|
276
|
+
|
|
244
277
|
exports.formatToOnlyASCIICodeText = formatToOnlyASCIICodeText;
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
278
|
+
|
|
279
|
+
var formatNumberValueToMask = function formatNumberValueToMask(inputValue, settings) {
|
|
280
|
+
var safelyInputValue = getSafelyValue(inputValue); // default valueSymbol === 'n', default mask === 'nnn-nnn-nnnn'
|
|
281
|
+
|
|
282
|
+
var _ref2 = settings || {},
|
|
283
|
+
_ref2$mask = _ref2.mask,
|
|
284
|
+
mask = _ref2$mask === void 0 ? 'XXX-XXX-XXXX' : _ref2$mask,
|
|
285
|
+
_ref2$valueSymbol = _ref2.valueSymbol,
|
|
286
|
+
valueSymbol = _ref2$valueSymbol === void 0 ? 'X' : _ref2$valueSymbol,
|
|
287
|
+
_ref2$isReturnAdvance = _ref2.isReturnAdvanced,
|
|
288
|
+
isReturnAdvanced = _ref2$isReturnAdvance === void 0 ? false : _ref2$isReturnAdvance;
|
|
289
|
+
|
|
290
|
+
var processing = mask.split('').reduce(function (acc, item) {
|
|
255
291
|
if (acc.value.length) ++acc.cursorPosition;
|
|
256
292
|
acc.newValue.push(item === valueSymbol && acc.value.length ? acc.value.shift() : item);
|
|
257
293
|
return acc;
|
|
258
294
|
}, {
|
|
259
|
-
value: safelyInputValue.split('').filter(
|
|
295
|
+
value: safelyInputValue.split('').filter(function (sym) {
|
|
296
|
+
return /[0-9]/g.test(sym);
|
|
297
|
+
}),
|
|
260
298
|
newValue: [],
|
|
261
299
|
cursorPosition: 0
|
|
262
300
|
});
|
|
@@ -265,50 +303,49 @@ const formatNumberValueToMask = (inputValue, settings) => {
|
|
|
265
303
|
cursorPosition: processing.cursorPosition
|
|
266
304
|
} : processing.newValue.join('');
|
|
267
305
|
};
|
|
306
|
+
|
|
268
307
|
exports.formatNumberValueToMask = formatNumberValueToMask;
|
|
269
|
-
|
|
270
|
-
|
|
308
|
+
|
|
309
|
+
var formatToLimitLength = function formatToLimitLength(inputValue, limit) {
|
|
310
|
+
var value = getSafelyValue(inputValue);
|
|
271
311
|
return limit && typeof limit === 'number' && !Number.isNaN(limit) && (value === null || value === void 0 ? void 0 : value.length) > limit ? value.substr(0, limit) : value;
|
|
272
312
|
};
|
|
273
|
-
|
|
274
313
|
/**
|
|
275
314
|
* It takes a string and returns a hexadecimal string
|
|
276
315
|
* @param inputValue - The value to be formatted.
|
|
277
316
|
* @param withSharp - boolean - if true, the returned value will have a sharp (#) at the beginning.
|
|
278
317
|
* @returns A function that takes two arguments, inputValue and withSharp.
|
|
279
318
|
*/
|
|
319
|
+
|
|
320
|
+
|
|
280
321
|
exports.formatToLimitLength = formatToLimitLength;
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
const value = getSafelyValue(inputValue);
|
|
322
|
+
|
|
323
|
+
var formatToHex = function formatToHex(_ref3) {
|
|
324
|
+
var inputValue = _ref3.inputValue,
|
|
325
|
+
withSharp = _ref3.withSharp;
|
|
326
|
+
var value = getSafelyValue(inputValue);
|
|
287
327
|
if (withSharp) return "#".concat(value.replace(/[^a-f0-9]/gi, ''));
|
|
288
328
|
return "".concat(value.replace(/[^#a-f0-9]/gi, ''));
|
|
289
329
|
};
|
|
290
|
-
|
|
291
330
|
/**
|
|
292
331
|
* It takes a string and returns a string with all white space removed
|
|
293
332
|
* @param str - The string to be formatted.
|
|
294
333
|
* @returns A string with all white space removed.
|
|
295
334
|
*/
|
|
335
|
+
|
|
336
|
+
|
|
296
337
|
exports.formatToHex = formatToHex;
|
|
338
|
+
|
|
297
339
|
function formatToReplaceAllWhiteSpace(str) {
|
|
298
|
-
|
|
340
|
+
var value = getSafelyValue(str);
|
|
299
341
|
return value.replace(/\s+/g, '');
|
|
300
|
-
}
|
|
301
|
-
|
|
302
|
-
// ****************************
|
|
342
|
+
} // ****************************
|
|
303
343
|
// transform
|
|
304
344
|
// ****************************
|
|
305
|
-
|
|
306
345
|
// ...
|
|
307
|
-
|
|
308
346
|
// ****************************
|
|
309
347
|
// filter
|
|
310
348
|
// ****************************
|
|
311
|
-
|
|
312
349
|
// export const filterFloat = (inputValue, decimalPlaces = null) => {
|
|
313
350
|
// const value = getSafelyValue(inputValue);
|
|
314
351
|
// const replaser = input => ('' + input).replace(/[^\.\d]/g, '');
|
|
@@ -330,51 +367,77 @@ function formatToReplaceAllWhiteSpace(str) {
|
|
|
330
367
|
// return replaser(lastSym === '.' && previousValue.includes('.') ? previousValue : output);
|
|
331
368
|
// };
|
|
332
369
|
|
|
333
|
-
|
|
370
|
+
|
|
371
|
+
var filterFloat = function filterFloat(inputValue) {
|
|
334
372
|
var _output, _output2, _output3, _output4;
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
373
|
+
|
|
374
|
+
var decimalPlaces = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
|
|
375
|
+
var value = getSafelyValue(inputValue);
|
|
376
|
+
|
|
377
|
+
var replacer = function replacer(input) {
|
|
378
|
+
var _ref4;
|
|
379
|
+
|
|
380
|
+
return (_ref4 = '' + input) === null || _ref4 === void 0 ? void 0 : _ref4.replace(/[^\.\d,]/g, '');
|
|
340
381
|
};
|
|
382
|
+
|
|
341
383
|
if (value.length === 1 && (value[0] === '.' || value[0] === ',')) return '0.';
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
384
|
+
var output = value;
|
|
385
|
+
var previousValue = '' + ((_output = output) === null || _output === void 0 ? void 0 : _output.slice(0, -1));
|
|
386
|
+
var lastSym = '' + ((_output2 = output) === null || _output2 === void 0 ? void 0 : _output2.slice(-1));
|
|
387
|
+
|
|
345
388
|
if (decimalPlaces && typeof decimalPlaces === 'number' && previousValue !== null && previousValue !== void 0 && previousValue.includes('.') && (previousValue === null || previousValue === void 0 ? void 0 : previousValue.indexOf('.')) + 1 + decimalPlaces === (previousValue === null || previousValue === void 0 ? void 0 : previousValue.length)) {
|
|
346
389
|
return replacer(previousValue);
|
|
347
390
|
}
|
|
391
|
+
|
|
348
392
|
if ((_output3 = output) !== null && _output3 !== void 0 && _output3.includes('.') && output[((_output4 = output) === null || _output4 === void 0 ? void 0 : _output4.indexOf('.')) + 3] !== undefined && Number(output)) {
|
|
349
393
|
var _Number;
|
|
394
|
+
|
|
350
395
|
output = (_Number = Number(output)) === null || _Number === void 0 ? void 0 : _Number.toFixed(decimalPlaces);
|
|
351
396
|
}
|
|
397
|
+
|
|
352
398
|
return replacer(lastSym === '.' && previousValue !== null && previousValue !== void 0 && previousValue.includes('.') ? previousValue : output);
|
|
353
399
|
};
|
|
400
|
+
|
|
354
401
|
exports.filterFloat = filterFloat;
|
|
355
|
-
|
|
402
|
+
|
|
403
|
+
var filterNumeric = function filterNumeric(value, settings) {
|
|
356
404
|
var _getSafelyValue;
|
|
405
|
+
|
|
357
406
|
value = (_getSafelyValue = getSafelyValue(value)) === null || _getSafelyValue === void 0 ? void 0 : _getSafelyValue.replace(/,/g, '');
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
407
|
+
|
|
408
|
+
var _ref5 = settings || {},
|
|
409
|
+
_ref5$type = _ref5.type,
|
|
410
|
+
type = _ref5$type === void 0 ? 'float' : _ref5$type,
|
|
411
|
+
decimalPlaces = _ref5.decimalPlaces;
|
|
412
|
+
|
|
413
|
+
var executor = type === 'float' ? filterFloat : formatOnlyNumbers;
|
|
363
414
|
return executor(getSafelyValue(value), decimalPlaces);
|
|
364
415
|
};
|
|
416
|
+
|
|
365
417
|
exports.filterNumeric = filterNumeric;
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
418
|
+
|
|
419
|
+
var formatToHideValuePartially = function formatToHideValuePartially(value, settings) {
|
|
420
|
+
var _ref6 = settings || {},
|
|
421
|
+
_ref6$showSymbolsCoun = _ref6.showSymbolsCount,
|
|
422
|
+
showSymbolsCount = _ref6$showSymbolsCoun === void 0 ? 4 : _ref6$showSymbolsCoun,
|
|
423
|
+
_ref6$isVisibleFromFr = _ref6.isVisibleFromFront,
|
|
424
|
+
isVisibleFromFront = _ref6$isVisibleFromFr === void 0 ? false : _ref6$isVisibleFromFr,
|
|
425
|
+
_ref6$isCutOutWhiteSp = _ref6.isCutOutWhiteSpaces,
|
|
426
|
+
isCutOutWhiteSpaces = _ref6$isCutOutWhiteSp === void 0 ? true : _ref6$isCutOutWhiteSp;
|
|
427
|
+
|
|
428
|
+
var safelyValue = getSafelyValue(value);
|
|
429
|
+
var newValue = isCutOutWhiteSpaces ? safelyValue.replace(/\s/g, '') : safelyValue;
|
|
374
430
|
if (newValue.length <= showSymbolsCount) return newValue;
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
431
|
+
|
|
432
|
+
var hide = function hide(val) {
|
|
433
|
+
return val.split('').map(function () {
|
|
434
|
+
return '*';
|
|
435
|
+
}).join('');
|
|
436
|
+
};
|
|
437
|
+
|
|
438
|
+
var visiblePart = isVisibleFromFront ? newValue.slice(0, showSymbolsCount) : newValue.slice(-1 * showSymbolsCount);
|
|
439
|
+
var hiddenPart = isVisibleFromFront ? newValue.slice(showSymbolsCount) : newValue.slice(0, -1 * showSymbolsCount);
|
|
378
440
|
return isVisibleFromFront ? "".concat(visiblePart).concat(hide(hiddenPart)) : "".concat(hide(hiddenPart)).concat(visiblePart);
|
|
379
441
|
};
|
|
442
|
+
|
|
380
443
|
exports.formatToHideValuePartially = formatToHideValuePartially;
|