@sme.up/ketchup 8.0.0 → 8.0.1
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/cjs/{f-button-49b2c37c.js → f-button-c0ede055.js} +2 -2
- package/dist/cjs/{f-cell-9a6bc55c.js → f-cell-1c17dbac.js} +17 -10
- package/dist/cjs/{f-checkbox-593f72c3.js → f-checkbox-1148e791.js} +1 -1
- package/dist/cjs/{f-chip-dee84122.js → f-chip-bace36bb.js} +3 -3
- package/dist/cjs/{f-image-27f965ff.js → f-image-22174590.js} +2 -2
- package/dist/cjs/{f-paginator-utils-4a30189d.js → f-paginator-utils-e21e1f06.js} +3 -3
- package/dist/cjs/{f-text-field-04a663b4.js → f-text-field-503f2bb0.js} +83 -9
- package/dist/cjs/{index-74433248.js → index-1f177abc.js} +0 -3
- package/dist/cjs/ketchup.cjs.js +2 -2
- package/dist/cjs/kup-accordion.cjs.entry.js +3 -3
- package/dist/cjs/kup-autocomplete_27.cjs.entry.js +778 -740
- package/dist/cjs/kup-box.cjs.entry.js +10 -10
- package/dist/cjs/kup-calendar.cjs.entry.js +5 -5
- package/dist/cjs/kup-cell.cjs.entry.js +7 -7
- package/dist/cjs/kup-dash-list.cjs.entry.js +3 -4
- package/dist/cjs/kup-dash_2.cjs.entry.js +2 -2
- package/dist/cjs/kup-dashboard.cjs.entry.js +6 -6
- package/dist/cjs/kup-drawer.cjs.entry.js +2 -2
- package/dist/cjs/kup-echart.cjs.entry.js +2 -2
- package/dist/cjs/kup-family-tree.cjs.entry.js +4 -4
- package/dist/cjs/kup-iframe.cjs.entry.js +2 -2
- package/dist/cjs/kup-image-list.cjs.entry.js +8 -8
- package/dist/cjs/kup-lazy.cjs.entry.js +2 -2
- package/dist/cjs/kup-magic-box.cjs.entry.js +3 -3
- package/dist/cjs/{kup-manager-2ff5d258.js → kup-manager-b994cf71.js} +88 -16
- package/dist/cjs/kup-nav-bar.cjs.entry.js +2 -2
- package/dist/cjs/kup-numeric-picker.cjs.entry.js +3 -3
- package/dist/cjs/kup-photo-frame.cjs.entry.js +2 -2
- package/dist/cjs/kup-planner.cjs.entry.js +3 -3
- package/dist/cjs/kup-probe.cjs.entry.js +2 -2
- package/dist/cjs/kup-qlik.cjs.entry.js +2 -2
- package/dist/cjs/kup-snackbar.cjs.entry.js +12 -4
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/collection/assets/data-table.js +44 -0
- package/dist/collection/components/kup-dash-list/kup-dash-list.js +1 -3
- package/dist/collection/components/kup-data-table/kup-data-table-state.js +1 -1
- package/dist/collection/components/kup-snackbar/kup-snackbar.js +27 -0
- package/dist/collection/components/kup-text-field/kup-text-field-declarations.js +3 -0
- package/dist/collection/components/kup-text-field/kup-text-field.js +109 -10
- package/dist/collection/f-components/f-cell/f-cell.js +12 -5
- package/dist/collection/f-components/f-text-field/f-text-field.js +80 -6
- package/dist/collection/managers/kup-math/kup-math.js +85 -4
- package/dist/collection/utils/utils.js +1 -10
- package/dist/components/kup-autocomplete2.js +543 -349
- package/dist/components/kup-dash-list.js +2 -3
- package/dist/components/kup-dashboard.js +1 -1
- package/dist/components/kup-data-table.js +1 -1
- package/dist/components/kup-date-picker.js +1 -1
- package/dist/components/kup-dialog.js +1 -1
- package/dist/components/kup-dropdown-button.js +1 -1
- package/dist/components/kup-echart2.js +1 -1
- package/dist/components/kup-family-tree.js +1 -1
- package/dist/components/kup-form.js +1 -1
- package/dist/components/kup-gauge.js +1 -1
- package/dist/components/kup-image-list.js +1 -1
- package/dist/components/kup-image.js +1 -1
- package/dist/components/kup-list.js +1 -1
- package/dist/components/kup-magic-box.js +1 -1
- package/dist/components/kup-numeric-picker.js +1 -1
- package/dist/components/kup-planner.js +1 -1
- package/dist/components/kup-progress-bar.js +1 -1
- package/dist/components/kup-radio.js +1 -1
- package/dist/components/kup-rating.js +1 -1
- package/dist/components/kup-snackbar.js +8 -0
- package/dist/components/kup-spinner.js +1 -1
- package/dist/components/kup-switch.js +1 -1
- package/dist/components/kup-tab-bar.js +1 -1
- package/dist/components/kup-text-field.js +1 -1
- package/dist/components/kup-time-picker.js +1 -1
- package/dist/components/kup-tree.js +1 -1
- package/dist/esm/{f-button-744cf1f6.js → f-button-c377973d.js} +2 -2
- package/dist/esm/{f-cell-b319c869.js → f-cell-e5a98bc8.js} +17 -10
- package/dist/esm/{f-checkbox-ec85b437.js → f-checkbox-9b3f5f5b.js} +1 -1
- package/dist/esm/{f-chip-7e3e4180.js → f-chip-c8a18c48.js} +3 -3
- package/dist/esm/{f-image-098c26ce.js → f-image-5cbdf39d.js} +2 -2
- package/dist/esm/{f-paginator-utils-674cb2ae.js → f-paginator-utils-a1dab059.js} +3 -3
- package/dist/esm/{f-text-field-c38ef113.js → f-text-field-dafb7c8b.js} +83 -9
- package/dist/esm/{index-b326ffc9.js → index-8bd38435.js} +1 -3
- package/dist/esm/ketchup.js +3 -3
- package/dist/esm/kup-accordion.entry.js +3 -3
- package/dist/esm/kup-autocomplete_27.entry.js +778 -740
- package/dist/esm/kup-box.entry.js +10 -10
- package/dist/esm/kup-calendar.entry.js +5 -5
- package/dist/esm/kup-cell.entry.js +7 -7
- package/dist/esm/kup-dash-list.entry.js +3 -4
- package/dist/esm/kup-dash_2.entry.js +2 -2
- package/dist/esm/kup-dashboard.entry.js +6 -6
- package/dist/esm/kup-drawer.entry.js +2 -2
- package/dist/esm/kup-echart.entry.js +2 -2
- package/dist/esm/kup-family-tree.entry.js +4 -4
- package/dist/esm/kup-iframe.entry.js +2 -2
- package/dist/esm/kup-image-list.entry.js +8 -8
- package/dist/esm/kup-lazy.entry.js +2 -2
- package/dist/esm/kup-magic-box.entry.js +3 -3
- package/dist/esm/{kup-manager-b41eb2a8.js → kup-manager-3594cde8.js} +88 -16
- package/dist/esm/kup-nav-bar.entry.js +2 -2
- package/dist/esm/kup-numeric-picker.entry.js +3 -3
- package/dist/esm/kup-photo-frame.entry.js +2 -2
- package/dist/esm/kup-planner.entry.js +3 -3
- package/dist/esm/kup-probe.entry.js +2 -2
- package/dist/esm/kup-qlik.entry.js +2 -2
- package/dist/esm/kup-snackbar.entry.js +12 -4
- package/dist/esm/loader.js +3 -3
- package/dist/ketchup/ketchup.esm.js +1 -1
- package/dist/ketchup/{p-3efe7f43.entry.js → p-017418e7.entry.js} +1 -1
- package/dist/ketchup/{p-395e1960.entry.js → p-22e72f06.entry.js} +1 -1
- package/dist/ketchup/{p-77e3d537.js → p-2d32e3cd.js} +1 -1
- package/dist/ketchup/{p-5ce2b4fc.entry.js → p-31abf4b6.entry.js} +1 -1
- package/dist/ketchup/{p-b244f5ca.entry.js → p-37ada0f0.entry.js} +1 -1
- package/dist/ketchup/{p-a877a87b.entry.js → p-38f16697.entry.js} +2 -2
- package/dist/ketchup/{p-9700eb32.js → p-4638fbff.js} +1 -1
- package/dist/ketchup/{p-af82131e.entry.js → p-473d2bea.entry.js} +1 -1
- package/dist/ketchup/{p-da891093.entry.js → p-4c56e199.entry.js} +1 -1
- package/dist/ketchup/{p-a9b7533b.entry.js → p-5205286a.entry.js} +1 -1
- package/dist/ketchup/p-61319cfa.js +1 -0
- package/dist/ketchup/{p-ef614656.js → p-6762d447.js} +1 -1
- package/dist/ketchup/p-6c726886.entry.js +1 -0
- package/dist/ketchup/{p-0b91f5f8.entry.js → p-7be5ef32.entry.js} +1 -1
- package/dist/ketchup/{p-3b41aca7.entry.js → p-7f4f5f0f.entry.js} +1 -1
- package/dist/ketchup/{p-b032f47d.entry.js → p-80815edf.entry.js} +1 -1
- package/dist/ketchup/p-8b248655.js +1 -0
- package/dist/ketchup/{p-d4ece435.js → p-9dcfbb1e.js} +2 -2
- package/dist/ketchup/{p-c26975bf.js → p-9f9b6656.js} +1 -1
- package/dist/ketchup/{p-4325d965.entry.js → p-9fc6a9a8.entry.js} +1 -1
- package/dist/ketchup/{p-940a5feb.js → p-acaa171f.js} +3 -3
- package/dist/ketchup/{p-4ae2ca6f.entry.js → p-afff7a6e.entry.js} +1 -1
- package/dist/ketchup/{p-bd42562d.entry.js → p-b718af72.entry.js} +1 -1
- package/dist/ketchup/p-bf4a881b.js +1 -0
- package/dist/ketchup/{p-d739710a.entry.js → p-ce5b6ce7.entry.js} +1 -1
- package/dist/ketchup/p-cf322853.entry.js +1 -0
- package/dist/ketchup/{p-bb17c1ba.entry.js → p-d1164680.entry.js} +1 -1
- package/dist/ketchup/p-d4eb9a76.entry.js +1 -0
- package/dist/ketchup/p-d76be079.entry.js +1 -0
- package/dist/ketchup/{p-e02b5141.entry.js → p-ed7e118e.entry.js} +1 -1
- package/dist/ketchup/{p-a7e19620.entry.js → p-ef0b4f19.entry.js} +1 -1
- package/dist/types/components/kup-data-table/kup-data-table-state.d.ts +1 -1
- package/dist/types/components/kup-snackbar/kup-snackbar.d.ts +5 -0
- package/dist/types/components/kup-text-field/kup-text-field-declarations.d.ts +3 -0
- package/dist/types/components/kup-text-field/kup-text-field.d.ts +20 -2
- package/dist/types/components.d.ts +34 -0
- package/dist/types/f-components/f-text-field/f-text-field-declarations.d.ts +3 -0
- package/dist/types/managers/kup-math/kup-math-declarations.d.ts +6 -0
- package/dist/types/managers/kup-math/kup-math.d.ts +26 -2
- package/dist/types/utils/utils.d.ts +0 -1
- package/package.json +1 -1
- package/dist/ketchup/p-0b0b61cb.entry.js +0 -1
- package/dist/ketchup/p-5d398e42.js +0 -1
- package/dist/ketchup/p-c8b7790a.entry.js +0 -1
- package/dist/ketchup/p-c968e93d.entry.js +0 -1
- package/dist/ketchup/p-d98fdb9b.js +0 -1
- package/dist/ketchup/p-df316daf.entry.js +0 -1
- package/dist/ketchup/p-e714f4dc.js +0 -1
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { getAssetPath, h } from '@stencil/core';
|
|
2
2
|
import { KupThemeIconValues } from '../../managers/kup-theme/kup-theme-declarations';
|
|
3
|
+
const dom = document.documentElement;
|
|
3
4
|
/*-------------------------------------------------*/
|
|
4
5
|
/* C o m p o n e n t */
|
|
5
6
|
/*-------------------------------------------------*/
|
|
@@ -14,6 +15,7 @@ export const FTextField = (props, children) => {
|
|
|
14
15
|
/* M e t h o d s */
|
|
15
16
|
/*-------------------------------------------------*/
|
|
16
17
|
function setContent(props) {
|
|
18
|
+
var _a, _b;
|
|
17
19
|
const isOutlined = props.textArea || props.outlined;
|
|
18
20
|
let labelEl;
|
|
19
21
|
let iconEl;
|
|
@@ -47,17 +49,79 @@ function setContent(props) {
|
|
|
47
49
|
'mdc-text-field--with-leading-icon': props.icon && !props.trailingIcon,
|
|
48
50
|
'mdc-text-field--with-trailing-icon': props.icon && props.trailingIcon,
|
|
49
51
|
};
|
|
50
|
-
|
|
52
|
+
let value = props.value;
|
|
53
|
+
let inputType = (_a = props.inputType) !== null && _a !== void 0 ? _a : 'text';
|
|
54
|
+
let persManageForNumberFormat = false;
|
|
55
|
+
if (props.inputType === 'number' && props.decimals && props.decimals > 0) {
|
|
56
|
+
inputType = 'text';
|
|
57
|
+
persManageForNumberFormat = true;
|
|
58
|
+
}
|
|
59
|
+
if (props.inputType === 'number') {
|
|
60
|
+
const options = {
|
|
61
|
+
allowNegative: (_b = props.allowNegative) !== null && _b !== void 0 ? _b : true,
|
|
62
|
+
decimal: props.decimals,
|
|
63
|
+
group: props.group,
|
|
64
|
+
integer: props.integers,
|
|
65
|
+
};
|
|
66
|
+
value = formatValue(value, options, false);
|
|
67
|
+
}
|
|
68
|
+
return (h("div", { class: classObj }, props.textArea && props.maxLength ? (h("div", { class: "mdc-text-field-character-counter" }, "'0 / ' + ", props.maxLength)) : undefined, !props.trailingIcon ? iconEl : undefined, props.textArea ? (h("span", { class: "mdc-text-field__resizer" }, h("textarea", { class: "mdc-text-field__input", disabled: props.disabled, readOnly: props.readOnly, maxlength: props.maxLength, value: value, onBlur: props.onBlur, onClick: props.onClick, onChange: props.onChange, onFocus: props.onFocus, onInput: props.onInput, onKeyDown: props.onKeyDown }))) : (h("input", { inputmode: props.inputMode ? props.inputMode : undefined, type: inputType, step: props.step, min: props.min, max: props.max, name: props.name, class: "mdc-text-field__input", disabled: props.disabled, readOnly: props.readOnly, placeholder: props.fullWidth && !props.outlined
|
|
51
69
|
? props.label
|
|
52
|
-
: undefined, maxlength: props.maxLength, value:
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
70
|
+
: undefined, maxlength: props.maxLength, value: value, onBlur: (e) => {
|
|
71
|
+
var _a;
|
|
72
|
+
if (persManageForNumberFormat) {
|
|
73
|
+
const options = {
|
|
74
|
+
allowNegative: (_a = props.allowNegative) !== null && _a !== void 0 ? _a : true,
|
|
75
|
+
decimal: props.decimals,
|
|
76
|
+
group: props.group,
|
|
77
|
+
integer: props.integers,
|
|
78
|
+
};
|
|
79
|
+
e.target.value = formatValue(e.target.value, options, true);
|
|
80
|
+
}
|
|
81
|
+
if (props.onBlur) {
|
|
82
|
+
props.onBlur(e);
|
|
83
|
+
}
|
|
84
|
+
}, onChange: (e) => {
|
|
85
|
+
var _a;
|
|
86
|
+
if (persManageForNumberFormat) {
|
|
87
|
+
const options = {
|
|
88
|
+
allowNegative: (_a = props.allowNegative) !== null && _a !== void 0 ? _a : true,
|
|
89
|
+
decimal: props.decimals,
|
|
90
|
+
group: props.group,
|
|
91
|
+
integer: props.integers,
|
|
92
|
+
};
|
|
93
|
+
e.target.value = formatValue(e.target.value, options, true);
|
|
56
94
|
}
|
|
57
95
|
if (props.onChange) {
|
|
58
96
|
props.onChange(e);
|
|
59
97
|
}
|
|
60
|
-
}, onClick: props.onClick, onFocus: props.onFocus, onInput: props.onInput, onKeyDown: props.onKeyDown
|
|
98
|
+
}, onClick: props.onClick, onFocus: props.onFocus, onInput: props.onInput, onKeyDown: props.onKeyDown, onKeyPress: (e) => {
|
|
99
|
+
var _a;
|
|
100
|
+
if (!persManageForNumberFormat) {
|
|
101
|
+
return;
|
|
102
|
+
}
|
|
103
|
+
if (e.ctrlKey) {
|
|
104
|
+
return;
|
|
105
|
+
}
|
|
106
|
+
if (e.key.length > 1) {
|
|
107
|
+
return;
|
|
108
|
+
}
|
|
109
|
+
const options = {
|
|
110
|
+
allowNegative: (_a = props.allowNegative) !== null && _a !== void 0 ? _a : true,
|
|
111
|
+
decimal: props.decimals,
|
|
112
|
+
group: props.group,
|
|
113
|
+
integer: props.integers,
|
|
114
|
+
};
|
|
115
|
+
let component = e.target;
|
|
116
|
+
let value = component.value;
|
|
117
|
+
let beginVal = value.substring(0, component.selectionStart);
|
|
118
|
+
let endVal = value.substring(component.selectionEnd, component.selectionEnd + value.length - 1);
|
|
119
|
+
let val = beginVal + e.key + endVal;
|
|
120
|
+
if (!dom.ketchup.math.matchNumericValueWithOptions(val, options)) {
|
|
121
|
+
e.preventDefault();
|
|
122
|
+
return;
|
|
123
|
+
}
|
|
124
|
+
} })), props.isClearable ? (h("span", { class: `mdc-text-field__icon kup-icon ${KupThemeIconValues.CLEAR.replace('--', '')}`, onClick: props.onClearIconClick })) : undefined, props.trailingIcon ? iconEl : undefined, !props.fullWidth && !isOutlined ? labelEl : undefined, isOutlined ? (h("div", { class: "mdc-notched-outline" }, h("div", { class: "mdc-notched-outline__leading" }), h("div", { class: "mdc-notched-outline__notch" }, labelEl), h("div", { class: "mdc-notched-outline__trailing" }))) : (h("span", { class: "mdc-line-ripple" }))));
|
|
61
125
|
}
|
|
62
126
|
function setHelper(props) {
|
|
63
127
|
if (props.helperEnabled !== false) {
|
|
@@ -75,3 +139,13 @@ function setHelper(props) {
|
|
|
75
139
|
}
|
|
76
140
|
}
|
|
77
141
|
}
|
|
142
|
+
const formatValue = function (value, options, inputIsLocalized) {
|
|
143
|
+
let formatedValue = value;
|
|
144
|
+
if (!formatedValue) {
|
|
145
|
+
return formatedValue;
|
|
146
|
+
}
|
|
147
|
+
if (formatedValue == '-') {
|
|
148
|
+
return '';
|
|
149
|
+
}
|
|
150
|
+
return dom.ketchup.math.format(formatedValue, dom.ketchup.math.createFormatPattern(options.group, options.decimal), inputIsLocalized);
|
|
151
|
+
};
|
|
@@ -102,10 +102,11 @@ export class KupMath {
|
|
|
102
102
|
* Formats the input number with the specified format of the currently set locale.
|
|
103
103
|
* @param {string | String | number} input - Input number which will be automatically "numberified".
|
|
104
104
|
* @param {string} format - Desired format. Defaults to '0,0.00' (i.e.: 2,000,000.51).
|
|
105
|
+
* @param {boolean} inputIsLocalized Numberifies assuming the input string is in the current KupMath locale's format.
|
|
105
106
|
* @returns {string} Formatted number.
|
|
106
107
|
*/
|
|
107
|
-
format(input, format) {
|
|
108
|
-
const n = this.numberify(input);
|
|
108
|
+
format(input, format, inputIsLocalized) {
|
|
109
|
+
const n = this.numberify(input, inputIsLocalized);
|
|
109
110
|
if (!format) {
|
|
110
111
|
const positiveN = Math.abs(n);
|
|
111
112
|
const decimals = positiveN - Math.floor(positiveN);
|
|
@@ -116,8 +117,88 @@ export class KupMath {
|
|
|
116
117
|
format = '0,0';
|
|
117
118
|
}
|
|
118
119
|
}
|
|
119
|
-
|
|
120
|
-
|
|
120
|
+
return this.numeral(n).format(format);
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* Created the string for format a number
|
|
124
|
+
* @param {boolean} thousandPoint - show thousandPoint
|
|
125
|
+
* @param {number} decimals - number of decimals
|
|
126
|
+
*/
|
|
127
|
+
createFormatPattern(thousandPoint, decimals) {
|
|
128
|
+
var format = '0';
|
|
129
|
+
if (thousandPoint) {
|
|
130
|
+
format += ',000';
|
|
131
|
+
}
|
|
132
|
+
if (decimals && decimals > 0) {
|
|
133
|
+
format += '.';
|
|
134
|
+
for (let i = 0; i < decimals; i++) {
|
|
135
|
+
format += '0';
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
return format;
|
|
139
|
+
}
|
|
140
|
+
/**
|
|
141
|
+
* Returns the decimal separator of current browser
|
|
142
|
+
* @returns current decimal separator, by locale
|
|
143
|
+
*/
|
|
144
|
+
decimalSeparator() {
|
|
145
|
+
const numberWithGroupAndDecimalSeparator = 1000.1;
|
|
146
|
+
return Intl.NumberFormat(this.locale)
|
|
147
|
+
.formatToParts(numberWithGroupAndDecimalSeparator)
|
|
148
|
+
.find((part) => part.type === 'decimal').value;
|
|
149
|
+
}
|
|
150
|
+
/**
|
|
151
|
+
* Returns the group separator of current browser
|
|
152
|
+
* @returns current group separator, by locale
|
|
153
|
+
*/
|
|
154
|
+
groupSeparator() {
|
|
155
|
+
const numberWithGroupAndDecimalSeparator = 1000.1;
|
|
156
|
+
return Intl.NumberFormat(this.locale)
|
|
157
|
+
.formatToParts(numberWithGroupAndDecimalSeparator)
|
|
158
|
+
.find((part) => part.type === 'group').value;
|
|
159
|
+
}
|
|
160
|
+
/**
|
|
161
|
+
* Checks if an input string matches options, for desired formatted decimal number (integer digits, decimal digits)
|
|
162
|
+
* @param value the input value to check
|
|
163
|
+
* @param options options for customize the check
|
|
164
|
+
* @returns an object from applying the regular expression for check
|
|
165
|
+
*/
|
|
166
|
+
matchNumericValueWithOptions(value, options) {
|
|
167
|
+
// see https://github.com/24eme/jquery-input-number-format.git
|
|
168
|
+
let found = undefined;
|
|
169
|
+
let integerPartSuffix = '+';
|
|
170
|
+
if (options.integer && options.integer > 0) {
|
|
171
|
+
integerPartSuffix = '{0,' + options.integer + '}';
|
|
172
|
+
}
|
|
173
|
+
let regexp = '^[0-9]' + integerPartSuffix;
|
|
174
|
+
if (options.allowNegative) {
|
|
175
|
+
regexp = '^-{0,1}[0-9]' + integerPartSuffix;
|
|
176
|
+
}
|
|
177
|
+
if (options.decimal && options.decimal > 0) {
|
|
178
|
+
regexp +=
|
|
179
|
+
'([' +
|
|
180
|
+
this.decimalSeparator() +
|
|
181
|
+
'][0-9]{0,' +
|
|
182
|
+
options.decimal +
|
|
183
|
+
'})?';
|
|
184
|
+
let regexpObj = new RegExp(regexp + '$');
|
|
185
|
+
found = value.match(regexpObj);
|
|
186
|
+
if (!found) {
|
|
187
|
+
regexp =
|
|
188
|
+
'^[' +
|
|
189
|
+
this.decimalSeparator() +
|
|
190
|
+
'][0-9]{0,' +
|
|
191
|
+
options.decimal +
|
|
192
|
+
'}';
|
|
193
|
+
regexpObj = new RegExp(regexp + '$');
|
|
194
|
+
found = value.match(regexpObj);
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
else {
|
|
198
|
+
let regexpObj = new RegExp(regexp + '$');
|
|
199
|
+
found = value.match(regexpObj);
|
|
200
|
+
}
|
|
201
|
+
return found;
|
|
121
202
|
}
|
|
122
203
|
/**
|
|
123
204
|
* Returns a number from a non-specified input type between string, number, or String.
|
|
@@ -15,12 +15,6 @@ export function identify(array) {
|
|
|
15
15
|
}
|
|
16
16
|
}
|
|
17
17
|
}
|
|
18
|
-
function getSeparator(locale, separatorType) {
|
|
19
|
-
const numberWithGroupAndDecimalSeparator = 1000.1;
|
|
20
|
-
return Intl.NumberFormat(locale)
|
|
21
|
-
.formatToParts(numberWithGroupAndDecimalSeparator)
|
|
22
|
-
.find((part) => part.type === separatorType).value;
|
|
23
|
-
}
|
|
24
18
|
export function getCurrentDateFormatFromBrowserLocale() {
|
|
25
19
|
const formatObj = new Intl.DateTimeFormat(dom.ketchup.dates.getLocale()).formatToParts(new Date());
|
|
26
20
|
let dateFormat = formatObj
|
|
@@ -155,7 +149,7 @@ export function unformattedStringToFormattedStringNumber(input, decimals, type)
|
|
|
155
149
|
* @returns number as string, formatted by locale US, decimal separator . (like java decimal numbers), without group separator
|
|
156
150
|
**/
|
|
157
151
|
export function formattedStringToUnformattedStringNumber(input, type) {
|
|
158
|
-
return numberStringToNumberString(input, type,
|
|
152
|
+
return numberStringToNumberString(input, type, dom.ketchup.math.decimalSeparator());
|
|
159
153
|
}
|
|
160
154
|
/**
|
|
161
155
|
* @param input number as string, formatted by locale US, decimal separator . (like java decimal numbers), with group separator
|
|
@@ -192,9 +186,6 @@ function numberStringToNumberString(input, type, decFmt) {
|
|
|
192
186
|
let unf = stringToNumber(input);
|
|
193
187
|
return _numberToString(unf, -1, 'en-US', false);
|
|
194
188
|
}
|
|
195
|
-
export function getDecimalSeparator(locale) {
|
|
196
|
-
return getSeparator(locale, 'decimal');
|
|
197
|
-
}
|
|
198
189
|
function countDecimals(value) {
|
|
199
190
|
if (Math.floor(value) === value)
|
|
200
191
|
return 0;
|