@skbkontur/react-ui 6.1.4-ff219.0 → 6.1.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/CHANGELOG.md +12 -0
- package/components/Autocomplete/Autocomplete.js +2 -3
- package/components/Autocomplete/Autocomplete.js.map +1 -1
- package/components/FxInput/FxInput.js +2 -2
- package/components/FxInput/FxInput.js.map +1 -1
- package/components/MaskedInput/MaskedInput.d.ts +0 -2
- package/components/MaskedInput/MaskedInput.js +0 -6
- package/components/MaskedInput/MaskedInput.js.map +1 -1
- package/components/TokenInput/TokenInput.d.ts +7 -3
- package/components/TokenInput/TokenInput.js +0 -1
- package/components/TokenInput/TokenInput.js.map +1 -1
- package/index.d.ts +0 -1
- package/index.js +0 -1
- package/index.js.map +1 -1
- package/internal/CustomComboBox/ComboBoxView.js +2 -2
- package/internal/CustomComboBox/ComboBoxView.js.map +1 -1
- package/internal/Popup/PopupPin.js +8 -6
- package/internal/Popup/PopupPin.js.map +1 -1
- package/internal/themes/BasicTheme.d.ts +162 -0
- package/internal/themes/BasicTheme.js +162 -0
- package/internal/themes/BasicTheme.js.map +1 -1
- package/lib/events/keyListener.js +6 -0
- package/lib/events/keyListener.js.map +1 -1
- package/lib/events/keyboard/KeyboardEventCodes.d.ts +0 -2
- package/lib/events/keyboard/KeyboardEventCodes.js +0 -2
- package/lib/events/keyboard/KeyboardEventCodes.js.map +1 -1
- package/lib/events/keyboard/KeyboardMapKeys.js +0 -2
- package/lib/events/keyboard/KeyboardMapKeys.js.map +1 -1
- package/lib/events/keyboard/identifiers.d.ts +0 -2
- package/lib/events/keyboard/identifiers.js +0 -6
- package/lib/events/keyboard/identifiers.js.map +1 -1
- package/lib/featureFlagsContext/ReactUIFeatureFlagsContext.d.ts +0 -2
- package/lib/featureFlagsContext/ReactUIFeatureFlagsContext.js +0 -1
- package/lib/featureFlagsContext/ReactUIFeatureFlagsContext.js.map +1 -1
- package/package.json +1 -4
- package/components/MaskedInputV2/MaskedInputV2.d.ts +0 -57
- package/components/MaskedInputV2/MaskedInputV2.helpers.d.ts +0 -9
- package/components/MaskedInputV2/MaskedInputV2.helpers.js +0 -17
- package/components/MaskedInputV2/MaskedInputV2.helpers.js.map +0 -1
- package/components/MaskedInputV2/MaskedInputV2.js +0 -234
- package/components/MaskedInputV2/MaskedInputV2.js.map +0 -1
- package/components/MaskedInputV2/MaskedInputV2.styles.d.ts +0 -7
- package/components/MaskedInputV2/MaskedInputV2.styles.js +0 -19
- package/components/MaskedInputV2/MaskedInputV2.styles.js.map +0 -1
- package/components/MaskedInputV2/index.d.ts +0 -1
- package/components/MaskedInputV2/index.js +0 -2
- package/components/MaskedInputV2/index.js.map +0 -1
- package/components/MaskedInputV2/internal/MaskOverlay.d.ts +0 -19
- package/components/MaskedInputV2/internal/MaskOverlay.js +0 -54
- package/components/MaskedInputV2/internal/MaskOverlay.js.map +0 -1
- package/components/MaskedInputV2/internal/MaskedCore.d.ts +0 -8
- package/components/MaskedInputV2/internal/MaskedCore.js +0 -101
- package/components/MaskedInputV2/internal/MaskedCore.js.map +0 -1
- package/components/MaskedInputV2/internal/MaskedCore.types.d.ts +0 -30
- package/components/MaskedInputV2/internal/MaskedCore.types.js +0 -2
- package/components/MaskedInputV2/internal/MaskedCore.types.js.map +0 -1
- package/components/MaskedInputV2/internal/MaskedInternal.styles.d.ts +0 -15
- package/components/MaskedInputV2/internal/MaskedInternal.styles.js +0 -34
- package/components/MaskedInputV2/internal/MaskedInternal.styles.js.map +0 -1
- package/components/MaskedInputV2/internal/buildSlotMap.d.ts +0 -11
- package/components/MaskedInputV2/internal/buildSlotMap.js +0 -37
- package/components/MaskedInputV2/internal/buildSlotMap.js.map +0 -1
- package/components/MaskedInputV2/internal/extractRaw.d.ts +0 -10
- package/components/MaskedInputV2/internal/extractRaw.js +0 -16
- package/components/MaskedInputV2/internal/extractRaw.js.map +0 -1
- package/components/MaskedInputV2/internal/findNearestRawLeft.d.ts +0 -10
- package/components/MaskedInputV2/internal/findNearestRawLeft.js +0 -18
- package/components/MaskedInputV2/internal/findNearestRawLeft.js.map +0 -1
- package/components/MaskedInputV2/internal/helpers.d.ts +0 -5
- package/components/MaskedInputV2/internal/helpers.js +0 -6
- package/components/MaskedInputV2/internal/helpers.js.map +0 -1
- package/components/MaskedInputV2/internal/maskedCoreClipboard.d.ts +0 -25
- package/components/MaskedInputV2/internal/maskedCoreClipboard.js +0 -30
- package/components/MaskedInputV2/internal/maskedCoreClipboard.js.map +0 -1
- package/components/MaskedInputV2/internal/maskedCoreDeletion.d.ts +0 -28
- package/components/MaskedInputV2/internal/maskedCoreDeletion.js +0 -70
- package/components/MaskedInputV2/internal/maskedCoreDeletion.js.map +0 -1
- package/components/MaskedInputV2/internal/maskedCoreInputChange.d.ts +0 -35
- package/components/MaskedInputV2/internal/maskedCoreInputChange.js +0 -31
- package/components/MaskedInputV2/internal/maskedCoreInputChange.js.map +0 -1
- package/components/MaskedInputV2/internal/maskedCoreNavigation.d.ts +0 -13
- package/components/MaskedInputV2/internal/maskedCoreNavigation.js +0 -79
- package/components/MaskedInputV2/internal/maskedCoreNavigation.js.map +0 -1
- package/components/MaskedInputV2/internal/stripMaskChars.d.ts +0 -11
- package/components/MaskedInputV2/internal/stripMaskChars.js +0 -20
- package/components/MaskedInputV2/internal/stripMaskChars.js.map +0 -1
- package/components/MaskedInputV2/internal/types.d.ts +0 -74
- package/components/MaskedInputV2/internal/types.js +0 -2
- package/components/MaskedInputV2/internal/types.js.map +0 -1
- package/components/MaskedInputV2/internal/useMaskEngine.d.ts +0 -42
- package/components/MaskedInputV2/internal/useMaskEngine.js +0 -82
- package/components/MaskedInputV2/internal/useMaskEngine.js.map +0 -1
- package/components/MaskedInputV2/internal/useMaskedCoreHandlers.d.ts +0 -28
- package/components/MaskedInputV2/internal/useMaskedCoreHandlers.js +0 -190
- package/components/MaskedInputV2/internal/useMaskedCoreHandlers.js.map +0 -1
- package/components/MaskedInputV2/react-imask/imask/controls/html-input-mask-element.d.ts +0 -16
- package/components/MaskedInputV2/react-imask/imask/controls/html-input-mask-element.js +0 -59
- package/components/MaskedInputV2/react-imask/imask/controls/html-input-mask-element.js.map +0 -1
- package/components/MaskedInputV2/react-imask/imask/controls/html-mask-element.d.ts +0 -20
- package/components/MaskedInputV2/react-imask/imask/controls/html-mask-element.js +0 -106
- package/components/MaskedInputV2/react-imask/imask/controls/html-mask-element.js.map +0 -1
- package/components/MaskedInputV2/react-imask/imask/controls/input-history.d.ts +0 -17
- package/components/MaskedInputV2/react-imask/imask/controls/input-history.js +0 -49
- package/components/MaskedInputV2/react-imask/imask/controls/input-history.js.map +0 -1
- package/components/MaskedInputV2/react-imask/imask/controls/input.d.ts +0 -95
- package/components/MaskedInputV2/react-imask/imask/controls/input.js +0 -420
- package/components/MaskedInputV2/react-imask/imask/controls/input.js.map +0 -1
- package/components/MaskedInputV2/react-imask/imask/controls/mask-element.d.ts +0 -30
- package/components/MaskedInputV2/react-imask/imask/controls/mask-element.js +0 -59
- package/components/MaskedInputV2/react-imask/imask/controls/mask-element.js.map +0 -1
- package/components/MaskedInputV2/react-imask/imask/core/action-details.d.ts +0 -30
- package/components/MaskedInputV2/react-imask/imask/core/action-details.js +0 -100
- package/components/MaskedInputV2/react-imask/imask/core/action-details.js.map +0 -1
- package/components/MaskedInputV2/react-imask/imask/core/change-details.d.ts +0 -20
- package/components/MaskedInputV2/react-imask/imask/core/change-details.js +0 -46
- package/components/MaskedInputV2/react-imask/imask/core/change-details.js.map +0 -1
- package/components/MaskedInputV2/react-imask/imask/core/continuous-tail-details.d.ts +0 -21
- package/components/MaskedInputV2/react-imask/imask/core/continuous-tail-details.js +0 -52
- package/components/MaskedInputV2/react-imask/imask/core/continuous-tail-details.js.map +0 -1
- package/components/MaskedInputV2/react-imask/imask/core/holder.d.ts +0 -34
- package/components/MaskedInputV2/react-imask/imask/core/holder.js +0 -38
- package/components/MaskedInputV2/react-imask/imask/core/holder.js.map +0 -1
- package/components/MaskedInputV2/react-imask/imask/core/tail-details.d.ts +0 -20
- package/components/MaskedInputV2/react-imask/imask/core/tail-details.js +0 -2
- package/components/MaskedInputV2/react-imask/imask/core/tail-details.js.map +0 -1
- package/components/MaskedInputV2/react-imask/imask/core/utils.d.ts +0 -24
- package/components/MaskedInputV2/react-imask/imask/core/utils.js +0 -100
- package/components/MaskedInputV2/react-imask/imask/core/utils.js.map +0 -1
- package/components/MaskedInputV2/react-imask/imask/imask.d.ts +0 -5
- package/components/MaskedInputV2/react-imask/imask/imask.js +0 -7
- package/components/MaskedInputV2/react-imask/imask/imask.js.map +0 -1
- package/components/MaskedInputV2/react-imask/imask/index.d.ts +0 -17
- package/components/MaskedInputV2/react-imask/imask/index.js +0 -16
- package/components/MaskedInputV2/react-imask/imask/index.js.map +0 -1
- package/components/MaskedInputV2/react-imask/imask/masked/base.d.ts +0 -114
- package/components/MaskedInputV2/react-imask/imask/masked/base.js +0 -411
- package/components/MaskedInputV2/react-imask/imask/masked/base.js.map +0 -1
- package/components/MaskedInputV2/react-imask/imask/masked/factory.d.ts +0 -62
- package/components/MaskedInputV2/react-imask/imask/masked/factory.js +0 -96
- package/components/MaskedInputV2/react-imask/imask/masked/factory.js.map +0 -1
- package/components/MaskedInputV2/react-imask/imask/masked/pattern.d.ts +0 -101
- package/components/MaskedInputV2/react-imask/imask/masked/pattern.js +0 -543
- package/components/MaskedInputV2/react-imask/imask/masked/pattern.js.map +0 -1
- package/components/MaskedInputV2/react-imask/imask/masked/patterns/block.d.ts +0 -30
- package/components/MaskedInputV2/react-imask/imask/masked/patterns/block.js +0 -2
- package/components/MaskedInputV2/react-imask/imask/masked/patterns/block.js.map +0 -1
- package/components/MaskedInputV2/react-imask/imask/masked/patterns/chunk-tail-details.d.ts +0 -21
- package/components/MaskedInputV2/react-imask/imask/masked/patterns/chunk-tail-details.js +0 -180
- package/components/MaskedInputV2/react-imask/imask/masked/patterns/chunk-tail-details.js.map +0 -1
- package/components/MaskedInputV2/react-imask/imask/masked/patterns/cursor.d.ts +0 -31
- package/components/MaskedInputV2/react-imask/imask/masked/patterns/cursor.js +0 -163
- package/components/MaskedInputV2/react-imask/imask/masked/patterns/cursor.js.map +0 -1
- package/components/MaskedInputV2/react-imask/imask/masked/patterns/fixed-definition.d.ts +0 -42
- package/components/MaskedInputV2/react-imask/imask/masked/patterns/fixed-definition.js +0 -158
- package/components/MaskedInputV2/react-imask/imask/masked/patterns/fixed-definition.js.map +0 -1
- package/components/MaskedInputV2/react-imask/imask/masked/patterns/input-definition.d.ts +0 -56
- package/components/MaskedInputV2/react-imask/imask/masked/patterns/input-definition.js +0 -185
- package/components/MaskedInputV2/react-imask/imask/masked/patterns/input-definition.js.map +0 -1
- package/components/MaskedInputV2/react-imask/imask/masked/regexp.d.ts +0 -17
- package/components/MaskedInputV2/react-imask/imask/masked/regexp.js +0 -36
- package/components/MaskedInputV2/react-imask/imask/masked/regexp.js.map +0 -1
- package/components/MaskedInputV2/react-imask/index.d.ts +0 -3
- package/components/MaskedInputV2/react-imask/index.js +0 -4
- package/components/MaskedInputV2/react-imask/index.js.map +0 -1
- package/components/MaskedInputV2/react-imask/input.d.ts +0 -8
- package/components/MaskedInputV2/react-imask/input.js +0 -35
- package/components/MaskedInputV2/react-imask/input.js.map +0 -1
- package/components/MaskedInputV2/react-imask/mixin.d.ts +0 -31
- package/components/MaskedInputV2/react-imask/mixin.js +0 -246
- package/components/MaskedInputV2/react-imask/mixin.js.map +0 -1
- package/internal/FeaturedMaskedInput/FeaturedMaskedInput.d.ts +0 -4
- package/internal/FeaturedMaskedInput/FeaturedMaskedInput.js +0 -24
- package/internal/FeaturedMaskedInput/FeaturedMaskedInput.js.map +0 -1
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) {
|
|
2
|
-
if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
|
|
3
|
-
return cooked;
|
|
4
|
-
};
|
|
5
|
-
import { UI_FONT_NAME, injectGlobalFont } from '../../lib/styles/UiFont.js';
|
|
6
|
-
import { memoizeGetStyles, prefix } from '../../lib/theming/Emotion.js';
|
|
7
|
-
export var globalClasses = prefix('masked-input-v2')({
|
|
8
|
-
root: 'root',
|
|
9
|
-
});
|
|
10
|
-
export var getStyles = memoizeGetStyles(function (emotion) {
|
|
11
|
-
injectGlobalFont(emotion);
|
|
12
|
-
return {
|
|
13
|
-
root: function (t) {
|
|
14
|
-
return emotion.css(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n font-family: ", ", ", ";\n font-variant-numeric: tabular-nums;\n "], ["\n font-family: ", ", ", ";\n font-variant-numeric: tabular-nums;\n "])), UI_FONT_NAME, t.baseFontFamily);
|
|
15
|
-
},
|
|
16
|
-
};
|
|
17
|
-
});
|
|
18
|
-
var templateObject_1;
|
|
19
|
-
//# sourceMappingURL=MaskedInputV2.styles.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"MaskedInputV2.styles.js","sourceRoot":"","sources":["MaskedInputV2.styles.ts"],"names":[],"mappings":";;;;AAEA,OAAO,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAC5E,OAAO,EAAE,gBAAgB,EAAE,MAAM,EAAE,MAAM,8BAA8B,CAAC;AAGxE,MAAM,CAAC,IAAM,aAAa,GAAG,MAAM,CAAC,iBAAiB,CAAC,CAAC;IACrD,IAAI,EAAE,MAAM;CACb,CAAC,CAAC;AAEH,MAAM,CAAC,IAAM,SAAS,GAAG,gBAAgB,CAAC,UAAC,OAAgB;IACzD,gBAAgB,CAAC,OAAO,CAAC,CAAC;IAC1B,OAAO;QACL,IAAI,YAAC,CAAQ;YACX,OAAO,OAAO,CAAC,GAAG,4JAAA,yBACD,EAAY,IAAK,EAAgB,wDAEjD,KAFgB,YAAY,EAAK,CAAC,CAAC,cAAc,EAEhD;QACJ,CAAC;KACF,CAAC;AACJ,CAAC,CAAC,CAAC","sourcesContent":["import type { Emotion } from '@emotion/css/create-instance';\n\nimport { UI_FONT_NAME, injectGlobalFont } from '../../lib/styles/UiFont.js';\nimport { memoizeGetStyles, prefix } from '../../lib/theming/Emotion.js';\nimport type { Theme } from '../../lib/theming/Theme.js';\n\nexport const globalClasses = prefix('masked-input-v2')({\n root: 'root',\n});\n\nexport const getStyles = memoizeGetStyles((emotion: Emotion) => {\n injectGlobalFont(emotion);\n return {\n root(t: Theme) {\n return emotion.css`\n font-family: ${UI_FONT_NAME}, ${t.baseFontFamily};\n font-variant-numeric: tabular-nums;\n `;\n },\n };\n});\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { MaskedInputV2, getSafeMaskInputType, type MaskedInputV2Props, type MaskedInputV2OnBeforePasteValue, type MaskInputType, } from './MaskedInputV2.js';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,aAAa,EACb,oBAAoB,GAIrB,MAAM,oBAAoB,CAAC","sourcesContent":["export {\n MaskedInputV2,\n getSafeMaskInputType,\n type MaskedInputV2Props,\n type MaskedInputV2OnBeforePasteValue,\n type MaskInputType,\n} from './MaskedInputV2.js';\n"]}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
interface MaskOverlayProps {
|
|
3
|
-
typedValue: string;
|
|
4
|
-
displayValue: string;
|
|
5
|
-
selectionStart: number;
|
|
6
|
-
selectionEnd: number;
|
|
7
|
-
disabled?: boolean;
|
|
8
|
-
textAlign?: React.CSSProperties['textAlign'];
|
|
9
|
-
containerRef?: React.RefObject<HTMLSpanElement | null>;
|
|
10
|
-
colored?: boolean;
|
|
11
|
-
}
|
|
12
|
-
/**
|
|
13
|
-
* Абсолютно позиционированный слой над <input>.
|
|
14
|
-
* Input делается прозрачным (color: transparent), а весь текст
|
|
15
|
-
* (typedValue + maskPart) рендерится здесь с раскраской.
|
|
16
|
-
* Так textAlign input'а и overlay совпадают идеально.
|
|
17
|
-
*/
|
|
18
|
-
export declare function MaskOverlay({ typedValue, displayValue, selectionStart, selectionEnd, disabled, textAlign, containerRef, colored, }: MaskOverlayProps): React.JSX.Element | null;
|
|
19
|
-
export {};
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
import { cx } from '@emotion/css';
|
|
2
|
-
import React, { useContext } from 'react';
|
|
3
|
-
import { useStyles } from '../../../lib/renderEnvironment/index.js';
|
|
4
|
-
import { ThemeContext } from '../../../lib/theming/ThemeContext.js';
|
|
5
|
-
import { getStyles, globalClasses } from './MaskedInternal.styles.js';
|
|
6
|
-
function splitTextBySelection(text, textStartOffset, selectionStart, selectionEnd) {
|
|
7
|
-
if (selectionStart === selectionEnd) {
|
|
8
|
-
return [text, '', ''];
|
|
9
|
-
}
|
|
10
|
-
var localStart = Math.max(0, selectionStart - textStartOffset);
|
|
11
|
-
var localEnd = Math.min(text.length, selectionEnd - textStartOffset);
|
|
12
|
-
if (localEnd <= localStart) {
|
|
13
|
-
return [text, '', ''];
|
|
14
|
-
}
|
|
15
|
-
return [text.slice(0, localStart), text.slice(localStart, localEnd), text.slice(localEnd)];
|
|
16
|
-
}
|
|
17
|
-
/**
|
|
18
|
-
* Абсолютно позиционированный слой над <input>.
|
|
19
|
-
* Input делается прозрачным (color: transparent), а весь текст
|
|
20
|
-
* (typedValue + maskPart) рендерится здесь с раскраской.
|
|
21
|
-
* Так textAlign input'а и overlay совпадают идеально.
|
|
22
|
-
*/
|
|
23
|
-
export function MaskOverlay(_a) {
|
|
24
|
-
var typedValue = _a.typedValue, displayValue = _a.displayValue, selectionStart = _a.selectionStart, selectionEnd = _a.selectionEnd, disabled = _a.disabled, textAlign = _a.textAlign, containerRef = _a.containerRef, _b = _a.colored, colored = _b === void 0 ? true : _b;
|
|
25
|
-
var theme = useContext(ThemeContext);
|
|
26
|
-
var styles = useStyles(getStyles);
|
|
27
|
-
var maskPart = displayValue.slice(typedValue.length);
|
|
28
|
-
var disabledClass = disabled && globalClasses.disabled;
|
|
29
|
-
var coloredClass = colored && globalClasses.colored;
|
|
30
|
-
var selectedSegmentClass = styles.selectedSegment();
|
|
31
|
-
if (!typedValue && !maskPart) {
|
|
32
|
-
return null;
|
|
33
|
-
}
|
|
34
|
-
function renderSegment(text, offset, segmentClassName) {
|
|
35
|
-
var _a = splitTextBySelection(text, offset, selectionStart, selectionEnd), before = _a[0], selected = _a[1], after = _a[2];
|
|
36
|
-
return (React.createElement(React.Fragment, null,
|
|
37
|
-
before ? React.createElement("span", { className: segmentClassName }, before) : null,
|
|
38
|
-
selected ? React.createElement("span", { className: selectedSegmentClass }, selected) : null,
|
|
39
|
-
after ? React.createElement("span", { className: segmentClassName }, after) : null));
|
|
40
|
-
}
|
|
41
|
-
return (React.createElement("span", { ref: containerRef, "aria-hidden": "true", className: styles.overlay() },
|
|
42
|
-
React.createElement("span", { "data-tid": "masked-input-overlay", style: {
|
|
43
|
-
display: 'inline-block',
|
|
44
|
-
width: '100%',
|
|
45
|
-
whiteSpace: 'nowrap',
|
|
46
|
-
textAlign: textAlign,
|
|
47
|
-
lineHeight: 'inherit',
|
|
48
|
-
} },
|
|
49
|
-
typedValue ? renderSegment(typedValue, 0, cx(styles.typed(theme), disabledClass, coloredClass)) : null,
|
|
50
|
-
maskPart
|
|
51
|
-
? renderSegment(maskPart, typedValue.length, cx(styles.mask(theme), disabledClass, coloredClass))
|
|
52
|
-
: null)));
|
|
53
|
-
}
|
|
54
|
-
//# sourceMappingURL=MaskOverlay.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"MaskOverlay.js","sourceRoot":"","sources":["MaskOverlay.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,cAAc,CAAC;AAClC,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAE1C,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACpE,OAAO,E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,QAAQ;gBACP,CAAC,CAAC,aAAa,CAAC,QAAQ,EAAE,UAAU,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,aAAa,EAAE,YAAY,CAAC,CAAC;gBACjG,CAAC,CAAC,IAAI,CACH,CACF,CACR,CAAC;AACJ,CAAC","sourcesContent":["import { cx } from '@emotion/css';\nimport React, { useContext } from 'react';\n\nimport { useStyles } from '../../../lib/renderEnvironment/index.js';\nimport { ThemeContext } from '../../../lib/theming/ThemeContext.js';\nimport { getStyles, globalClasses } from './MaskedInternal.styles.js';\n\ninterface MaskOverlayProps {\n typedValue: string;\n displayValue: string;\n selectionStart: number;\n selectionEnd: number;\n disabled?: boolean;\n textAlign?: React.CSSProperties['textAlign'];\n containerRef?: React.RefObject<HTMLSpanElement | null>;\n colored?: boolean;\n}\n\nfunction splitTextBySelection(\n text: string,\n textStartOffset: number,\n selectionStart: number,\n selectionEnd: number,\n): [string, string, string] {\n if (selectionStart === selectionEnd) {\n return [text, '', ''];\n }\n\n const localStart = Math.max(0, selectionStart - textStartOffset);\n const localEnd = Math.min(text.length, selectionEnd - textStartOffset);\n\n if (localEnd <= localStart) {\n return [text, '', ''];\n }\n\n return [text.slice(0, localStart), text.slice(localStart, localEnd), text.slice(localEnd)];\n}\n\n/**\n * Абсолютно позиционированный слой над <input>.\n * Input делается прозрачным (color: transparent), а весь текст\n * (typedValue + maskPart) рендерится здесь с раскраской.\n * Так textAlign input'а и overlay совпадают идеально.\n */\nexport function MaskOverlay({\n typedValue,\n displayValue,\n selectionStart,\n selectionEnd,\n disabled,\n textAlign,\n containerRef,\n colored = true,\n}: MaskOverlayProps) {\n const theme = useContext(ThemeContext);\n const styles = useStyles(getStyles);\n const maskPart = displayValue.slice(typedValue.length);\n\n const disabledClass = disabled && globalClasses.disabled;\n const coloredClass = colored && globalClasses.colored;\n const selectedSegmentClass = styles.selectedSegment();\n\n if (!typedValue && !maskPart) {\n return null;\n }\n\n function renderSegment(text: string, offset: number, segmentClassName: string) {\n const [before, selected, after] = splitTextBySelection(text, offset, selectionStart, selectionEnd);\n\n return (\n <>\n {before ? <span className={segmentClassName}>{before}</span> : null}\n {selected ? <span className={selectedSegmentClass}>{selected}</span> : null}\n {after ? <span className={segmentClassName}>{after}</span> : null}\n </>\n );\n }\n\n return (\n <span ref={containerRef} aria-hidden=\"true\" className={styles.overlay()}>\n <span\n data-tid=\"masked-input-overlay\"\n style={{\n display: 'inline-block',\n width: '100%',\n whiteSpace: 'nowrap',\n textAlign,\n lineHeight: 'inherit',\n }}\n >\n {typedValue ? renderSegment(typedValue, 0, cx(styles.typed(theme), disabledClass, coloredClass)) : null}\n {maskPart\n ? renderSegment(maskPart, typedValue.length, cx(styles.mask(theme), disabledClass, coloredClass))\n : null}\n </span>\n </span>\n );\n}\n"]}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import type { InputElement } from '../../Input/Input.typings.js';
|
|
2
|
-
import type { MaskedCoreProps } from './MaskedCore.types.js';
|
|
3
|
-
export type { MaskedCoreProps } from './MaskedCore.types.js';
|
|
4
|
-
/**
|
|
5
|
-
* Headless-слой MaskedInputV2: прозрачный `<input>` для ввода и {@link MaskOverlay} для отображения маски.
|
|
6
|
-
* Управляется через {@link useMaskedCoreHandlers}.
|
|
7
|
-
*/
|
|
8
|
-
export declare const MaskedCore: import("../../../lib/forwardRefAndName.js").ReactUIComponentWithRef<InputElement | null, MaskedCoreProps> & Record<never, never>;
|
|
@@ -1,101 +0,0 @@
|
|
|
1
|
-
var __assign = (this && this.__assign) || function () {
|
|
2
|
-
__assign = Object.assign || function(t) {
|
|
3
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
-
s = arguments[i];
|
|
5
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
-
t[p] = s[p];
|
|
7
|
-
}
|
|
8
|
-
return t;
|
|
9
|
-
};
|
|
10
|
-
return __assign.apply(this, arguments);
|
|
11
|
-
};
|
|
12
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
13
|
-
var t = {};
|
|
14
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
15
|
-
t[p] = s[p];
|
|
16
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
17
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
18
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
19
|
-
t[p[i]] = s[p[i]];
|
|
20
|
-
}
|
|
21
|
-
return t;
|
|
22
|
-
};
|
|
23
|
-
import { cx } from '@emotion/css';
|
|
24
|
-
import React, { useContext, useEffect, useImperativeHandle, useLayoutEffect, useRef } from 'react';
|
|
25
|
-
import { forwardRefAndName } from '../../../lib/forwardRefAndName.js';
|
|
26
|
-
import { useStyles } from '../../../lib/renderEnvironment/index.js';
|
|
27
|
-
import { ThemeContext } from '../../../lib/theming/ThemeContext.js';
|
|
28
|
-
import { getStyles, globalClasses } from './MaskedInternal.styles.js';
|
|
29
|
-
import { MaskOverlay } from './MaskOverlay.js';
|
|
30
|
-
import { useMaskedCoreHandlers } from './useMaskedCoreHandlers.js';
|
|
31
|
-
/**
|
|
32
|
-
* Headless-слой MaskedInputV2: прозрачный `<input>` для ввода и {@link MaskOverlay} для отображения маски.
|
|
33
|
-
* Управляется через {@link useMaskedCoreHandlers}.
|
|
34
|
-
*/
|
|
35
|
-
export var MaskedCore = forwardRefAndName('MaskedCore', function MaskedCore(props, ref) {
|
|
36
|
-
var _a;
|
|
37
|
-
var maskState = props.maskState, slotMap = props.slotMap, engine = props.engine, focused = props.focused, currentRaw = props.currentRaw, onRawChange = props.onRawChange, onUnexpectedInput = props.onUnexpectedInput, onUndo = props.onUndo, onRedo = props.onRedo, coreInputRef = props.coreInputRef, _b = props.colored, colored = _b === void 0 ? true : _b, onKeyDown = props.onKeyDown, onMouseUp = props.onMouseUp, onInput = props.onInput, onSelect = props.onSelect, onFocus = props.onFocus, onPaste = props.onPaste, onBlur = props.onBlur, placeholder = props.placeholder, className = props.className, disabled = props.disabled, rest = __rest(props, ["maskState", "slotMap", "engine", "focused", "currentRaw", "onRawChange", "onUnexpectedInput", "onUndo", "onRedo", "coreInputRef", "colored", "onKeyDown", "onMouseUp", "onInput", "onSelect", "onFocus", "onPaste", "onBlur", "placeholder", "className", "disabled"]);
|
|
38
|
-
var styles = useStyles(getStyles);
|
|
39
|
-
var overlayRef = useRef(null);
|
|
40
|
-
var theme = useContext(ThemeContext);
|
|
41
|
-
var _c = useMaskedCoreHandlers({
|
|
42
|
-
maskState: maskState,
|
|
43
|
-
slotMap: slotMap,
|
|
44
|
-
engine: engine,
|
|
45
|
-
currentRaw: currentRaw,
|
|
46
|
-
onRawChange: onRawChange,
|
|
47
|
-
onUnexpectedInput: onUnexpectedInput,
|
|
48
|
-
onUndo: onUndo,
|
|
49
|
-
onRedo: onRedo,
|
|
50
|
-
coreInputRef: coreInputRef,
|
|
51
|
-
onKeyDown: onKeyDown,
|
|
52
|
-
onMouseUp: onMouseUp,
|
|
53
|
-
onInput: onInput,
|
|
54
|
-
onSelect: onSelect,
|
|
55
|
-
onFocus: onFocus,
|
|
56
|
-
onPaste: onPaste,
|
|
57
|
-
}), pendingCursorRef = _c.pendingCursorRef, selectionRange = _c.selectionRange, syncSelection = _c.syncSelection, handleChange = _c.handleChange, handleKeyDown = _c.handleKeyDown, handleSelect = _c.handleSelect, handlePaste = _c.handlePaste, handleCopy = _c.handleCopy, handleCut = _c.handleCut, handleInput = _c.handleInput, handleMouseUp = _c.handleMouseUp, handleFocus = _c.handleFocus;
|
|
58
|
-
useImperativeHandle(ref, function () { return ({
|
|
59
|
-
input: coreInputRef.current,
|
|
60
|
-
getRootNode: function () { return coreInputRef.current; },
|
|
61
|
-
}); }, [coreInputRef]);
|
|
62
|
-
useLayoutEffect(function () {
|
|
63
|
-
var _a;
|
|
64
|
-
if (pendingCursorRef.current !== null) {
|
|
65
|
-
var pos = pendingCursorRef.current;
|
|
66
|
-
pendingCursorRef.current = null;
|
|
67
|
-
(_a = coreInputRef.current) === null || _a === void 0 ? void 0 : _a.setSelectionRange(pos, pos);
|
|
68
|
-
if (coreInputRef.current) {
|
|
69
|
-
syncSelection(coreInputRef.current);
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
syncOverlayScroll();
|
|
73
|
-
});
|
|
74
|
-
useEffect(function () {
|
|
75
|
-
if (!focused) {
|
|
76
|
-
return;
|
|
77
|
-
}
|
|
78
|
-
var el = coreInputRef.current;
|
|
79
|
-
if (!el) {
|
|
80
|
-
return;
|
|
81
|
-
}
|
|
82
|
-
var handleSelectionChange = function () {
|
|
83
|
-
if (document.activeElement === el) {
|
|
84
|
-
syncSelection(el);
|
|
85
|
-
}
|
|
86
|
-
};
|
|
87
|
-
document.addEventListener('selectionchange', handleSelectionChange);
|
|
88
|
-
return function () { return document.removeEventListener('selectionchange', handleSelectionChange); };
|
|
89
|
-
}, [focused, syncSelection]);
|
|
90
|
-
function syncOverlayScroll() {
|
|
91
|
-
if (overlayRef.current && coreInputRef.current) {
|
|
92
|
-
overlayRef.current.style.transform = "translateX(-".concat(coreInputRef.current.scrollLeft, "px)");
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
var hasMaskPart = maskState.displayValue.length > maskState.typedValue.length;
|
|
96
|
-
var showOverlay = hasMaskPart || (focused && maskState.typedValue.length > 0);
|
|
97
|
-
return (React.createElement(React.Fragment, null,
|
|
98
|
-
React.createElement("input", __assign({}, rest, { placeholder: showOverlay ? undefined : placeholder, "aria-disabled": disabled, disabled: disabled, ref: coreInputRef, className: cx(globalClasses.input, styles.input(theme), showOverlay && globalClasses.masked, className), value: maskState.typedValue, onChange: handleChange, onKeyDown: handleKeyDown, onSelect: handleSelect, onPaste: handlePaste, onCopy: handleCopy, onCut: handleCut, onFocus: handleFocus, onBlur: onBlur, onInput: handleInput, onMouseUp: handleMouseUp, onScroll: syncOverlayScroll })),
|
|
99
|
-
showOverlay && (React.createElement(MaskOverlay, { containerRef: overlayRef, typedValue: maskState.typedValue, displayValue: maskState.displayValue, selectionStart: selectionRange.start, selectionEnd: selectionRange.end, disabled: disabled, textAlign: (_a = rest.style) === null || _a === void 0 ? void 0 : _a.textAlign, colored: colored }))));
|
|
100
|
-
});
|
|
101
|
-
//# sourceMappingURL=MaskedCore.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"MaskedCore.js","sourceRoot":"","sources":["MaskedCore.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,cAAc,CAAC;AAClC,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,SAAS,EAAE,mBAAmB,EAAE,eAAe,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAEnG,OAAO,EAAE,iBAAiB,EAAE,MAAM,mCAAmC,CAAC;AACtE,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACpE,OAAO,EAAE,YAAY,EAAE,MAAM,sCAAsC,CAAC;AAGpE,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AACtE,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AAInE;;;GAGG;AACH,MAAM,CAAC,IAAM,UAAU,GAAG,iBAAiB,CACzC,YAAY,EACZ,SAAS,UAAU,CAAC,KAAsB,EAAE,GAA4C;;IAEpF,IAAA,SAAS,GAsBP,KAAK,UAtBE,EACT,OAAO,GAqBL,KAAK,QArBA,EACP,MAAM,GAoBJ,KAAK,OApBD,EACN,OAAO,GAmBL,KAAK,QAnBA,EACP,UAAU,GAkBR,KAAK,WAlBG,EACV,WAAW,GAiBT,KAAK,YAjBI,EACX,iBAAiB,GAgBf,KAAK,kBAhBU,E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AAO,EAAE,OAAO,GAChB,CACH,CACA,CACJ,CAAC;AACJ,CAAC,CACF,CAAC","sourcesContent":["import { cx } from '@emotion/css';\nimport React, { useContext, useEffect, useImperativeHandle, useLayoutEffect, useRef } from 'react';\n\nimport { forwardRefAndName } from '../../../lib/forwardRefAndName.js';\nimport { useStyles } from '../../../lib/renderEnvironment/index.js';\nimport { ThemeContext } from '../../../lib/theming/ThemeContext.js';\nimport type { InputElement } from '../../Input/Input.typings.js';\nimport type { MaskedCoreProps } from './MaskedCore.types.js';\nimport { getStyles, globalClasses } from './MaskedInternal.styles.js';\nimport { MaskOverlay } from './MaskOverlay.js';\nimport { useMaskedCoreHandlers } from './useMaskedCoreHandlers.js';\n\nexport type { MaskedCoreProps } from './MaskedCore.types.js';\n\n/**\n * Headless-слой MaskedInputV2: прозрачный `<input>` для ввода и {@link MaskOverlay} для отображения маски.\n * Управляется через {@link useMaskedCoreHandlers}.\n */\nexport const MaskedCore = forwardRefAndName(\n 'MaskedCore',\n function MaskedCore(props: MaskedCoreProps, ref: React.ForwardedRef<InputElement | null>) {\n const {\n maskState,\n slotMap,\n engine,\n focused,\n currentRaw,\n onRawChange,\n onUnexpectedInput,\n onUndo,\n onRedo,\n coreInputRef,\n colored = true,\n onKeyDown,\n onMouseUp,\n onInput,\n onSelect,\n onFocus,\n onPaste,\n onBlur,\n placeholder,\n className,\n disabled,\n ...rest\n } = props;\n\n const styles = useStyles(getStyles);\n const overlayRef = useRef<HTMLSpanElement>(null);\n const theme = useContext(ThemeContext);\n\n const {\n pendingCursorRef,\n selectionRange,\n syncSelection,\n handleChange,\n handleKeyDown,\n handleSelect,\n handlePaste,\n handleCopy,\n handleCut,\n handleInput,\n handleMouseUp,\n handleFocus,\n } = useMaskedCoreHandlers({\n maskState,\n slotMap,\n engine,\n currentRaw,\n onRawChange,\n onUnexpectedInput,\n onUndo,\n onRedo,\n coreInputRef,\n onKeyDown,\n onMouseUp,\n onInput,\n onSelect,\n onFocus,\n onPaste,\n });\n\n useImperativeHandle(\n ref,\n () => ({\n input: coreInputRef.current,\n getRootNode: () => coreInputRef.current,\n }),\n [coreInputRef],\n );\n\n useLayoutEffect(() => {\n if (pendingCursorRef.current !== null) {\n const pos = pendingCursorRef.current;\n pendingCursorRef.current = null;\n coreInputRef.current?.setSelectionRange(pos, pos);\n if (coreInputRef.current) {\n syncSelection(coreInputRef.current);\n }\n }\n syncOverlayScroll();\n });\n\n useEffect(() => {\n if (!focused) {\n return;\n }\n\n const el = coreInputRef.current;\n if (!el) {\n return;\n }\n\n const handleSelectionChange = () => {\n if (document.activeElement === el) {\n syncSelection(el);\n }\n };\n\n document.addEventListener('selectionchange', handleSelectionChange);\n return () => document.removeEventListener('selectionchange', handleSelectionChange);\n }, [focused, syncSelection]);\n\n function syncOverlayScroll() {\n if (overlayRef.current && coreInputRef.current) {\n overlayRef.current.style.transform = `translateX(-${coreInputRef.current.scrollLeft}px)`;\n }\n }\n\n const hasMaskPart = maskState.displayValue.length > maskState.typedValue.length;\n const showOverlay = hasMaskPart || (focused && maskState.typedValue.length > 0);\n\n return (\n <>\n <input\n {...rest}\n placeholder={showOverlay ? undefined : placeholder}\n aria-disabled={disabled}\n disabled={disabled}\n ref={coreInputRef}\n className={cx(globalClasses.input, styles.input(theme), showOverlay && globalClasses.masked, className)}\n value={maskState.typedValue}\n onChange={handleChange}\n onKeyDown={handleKeyDown}\n onSelect={handleSelect}\n onPaste={handlePaste}\n onCopy={handleCopy}\n onCut={handleCut}\n onFocus={handleFocus}\n onBlur={onBlur}\n onInput={handleInput}\n onMouseUp={handleMouseUp}\n onScroll={syncOverlayScroll}\n />\n {showOverlay && (\n <MaskOverlay\n containerRef={overlayRef}\n typedValue={maskState.typedValue}\n displayValue={maskState.displayValue}\n selectionStart={selectionRange.start}\n selectionEnd={selectionRange.end}\n disabled={disabled}\n textAlign={rest.style?.textAlign}\n colored={colored}\n />\n )}\n </>\n );\n },\n);\n"]}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import type React from 'react';
|
|
2
|
-
import type { InputElement } from '../../Input/Input.typings.js';
|
|
3
|
-
import type { MaskEngine, MaskState, SlotMap } from './types.js';
|
|
4
|
-
/**
|
|
5
|
-
* Пропсы headless-слоя {@link MaskedCore}: прозрачный `<input>` + overlay маски.
|
|
6
|
-
*/
|
|
7
|
-
export interface MaskedCoreProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, 'value' | 'onChange' | 'defaultValue'> {
|
|
8
|
-
/** Вычисленное состояние маски для отображения. */
|
|
9
|
-
maskState: MaskState;
|
|
10
|
-
/** Карта слотов для clipboard/delete/navigation. */
|
|
11
|
-
slotMap: SlotMap;
|
|
12
|
-
/** Headless IMask-движок. */
|
|
13
|
-
engine: MaskEngine;
|
|
14
|
-
/** Поле в фокусе — влияет на lazy-режим displayValue. */
|
|
15
|
-
focused: boolean;
|
|
16
|
-
/** Текущее raw-значение (источник истины). */
|
|
17
|
-
currentRaw: string;
|
|
18
|
-
/** Колбэк изменения raw от пользовательского ввода или paste. */
|
|
19
|
-
onRawChange: (newRaw: string, source: 'input' | 'paste', cursorPos?: number) => void;
|
|
20
|
-
/** Колбэк отклонённого ввода (невалидный символ или граничное удаление). */
|
|
21
|
-
onUnexpectedInput: () => void;
|
|
22
|
-
onUndo?: () => void;
|
|
23
|
-
onRedo?: () => void;
|
|
24
|
-
/** Ref на нативный `<input>` внутри MaskedCore. */
|
|
25
|
-
coreInputRef: React.RefObject<HTMLInputElement | null>;
|
|
26
|
-
/** Раскрашивать ли символы маски в overlay. @default true */
|
|
27
|
-
colored?: boolean;
|
|
28
|
-
}
|
|
29
|
-
/** Ref, который MaskedCore пробрасывает наружу для совместимости с Input.refInput. */
|
|
30
|
-
export type MaskedCoreRef = InputElement | null;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"MaskedCore.types.js","sourceRoot":"","sources":["MaskedCore.types.ts"],"names":[],"mappings":"","sourcesContent":["import type React from 'react';\n\nimport type { InputElement } from '../../Input/Input.typings.js';\nimport type { MaskEngine, MaskState, SlotMap } from './types.js';\n\n/**\n * Пропсы headless-слоя {@link MaskedCore}: прозрачный `<input>` + overlay маски.\n */\nexport interface MaskedCoreProps extends Omit<\n React.InputHTMLAttributes<HTMLInputElement>,\n 'value' | 'onChange' | 'defaultValue'\n> {\n /** Вычисленное состояние маски для отображения. */\n maskState: MaskState;\n /** Карта слотов для clipboard/delete/navigation. */\n slotMap: SlotMap;\n /** Headless IMask-движок. */\n engine: MaskEngine;\n /** Поле в фокусе — влияет на lazy-режим displayValue. */\n focused: boolean;\n /** Текущее raw-значение (источник истины). */\n currentRaw: string;\n /** Колбэк изменения raw от пользовательского ввода или paste. */\n onRawChange: (newRaw: string, source: 'input' | 'paste', cursorPos?: number) => void;\n /** Колбэк отклонённого ввода (невалидный символ или граничное удаление). */\n onUnexpectedInput: () => void;\n onUndo?: () => void;\n onRedo?: () => void;\n /** Ref на нативный `<input>` внутри MaskedCore. */\n coreInputRef: React.RefObject<HTMLInputElement | null>;\n /** Раскрашивать ли символы маски в overlay. @default true */\n colored?: boolean;\n}\n\n/** Ref, который MaskedCore пробрасывает наружу для совместимости с Input.refInput. */\nexport type MaskedCoreRef = InputElement | null;\n"]}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import type { Theme } from '../../../lib/theming/Theme.js';
|
|
2
|
-
export declare const globalClasses: {
|
|
3
|
-
input: string;
|
|
4
|
-
disabled: string;
|
|
5
|
-
selected: string;
|
|
6
|
-
masked: string;
|
|
7
|
-
colored: string;
|
|
8
|
-
};
|
|
9
|
-
export declare const getStyles: import("../../../lib/theming/Emotion.js").StylesGetter<{
|
|
10
|
-
input(t: Theme): string;
|
|
11
|
-
overlay(): string;
|
|
12
|
-
typed(t: Theme): string;
|
|
13
|
-
mask(t: Theme): string;
|
|
14
|
-
selectedSegment(): string;
|
|
15
|
-
}>;
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) {
|
|
2
|
-
if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
|
|
3
|
-
return cooked;
|
|
4
|
-
};
|
|
5
|
-
import { memoizeGetStyles, prefix } from '../../../lib/theming/Emotion.js';
|
|
6
|
-
export var globalClasses = prefix('masked-internal')({
|
|
7
|
-
input: 'input',
|
|
8
|
-
disabled: 'disabled',
|
|
9
|
-
selected: 'selected',
|
|
10
|
-
masked: 'masked',
|
|
11
|
-
colored: 'colored',
|
|
12
|
-
});
|
|
13
|
-
export var getStyles = memoizeGetStyles(function (_a) {
|
|
14
|
-
var css = _a.css;
|
|
15
|
-
return ({
|
|
16
|
-
input: function (t) {
|
|
17
|
-
return css(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n color-scheme: ", ";\n\n &:-internal-autofill-selected {\n background-color: ", " !important;\n background-image: none !important;\n color: ", " !important;\n }\n\n &:-webkit-autofill,\n &:-webkit-autofill:hover,\n &:-webkit-autofill:focus {\n -webkit-box-shadow: 0 0 0 1000px ", " inset;\n box-shadow: 0 0 0 1000px ", " inset;\n -webkit-text-fill-color: ", " !important;\n color: ", " !important;\n transition:\n background-color 0s 600000s,\n color 0s 600000s !important;\n }\n\n &:disabled {\n color: ", ";\n\n &:-internal-autofill-selected {\n background-color: ", " !important;\n }\n\n &:-webkit-autofill,\n &:-webkit-autofill:hover,\n &:-webkit-autofill:focus {\n -webkit-box-shadow: 0 0 0 1000px ", " inset;\n box-shadow: 0 0 0 1000px ", " inset;\n }\n }\n\n &.", " {\n color: transparent;\n -webkit-text-fill-color: transparent;\n caret-color: ", ";\n\n &::selection {\n background-color: transparent !important;\n color: transparent !important;\n -webkit-text-fill-color: transparent !important;\n }\n\n /* \u0422\u0435\u043A\u0441\u0442 \u0440\u0438\u0441\u0443\u0435\u0442 MaskOverlay; \u0431\u0440\u0430\u0443\u0437\u0435\u0440 \u043F\u0440\u0438 autofill \u043D\u0435 \u0434\u043E\u043B\u0436\u0435\u043D \u043F\u0435\u0440\u0435\u0431\u0438\u0432\u0430\u0442\u044C fill-color. */\n &:-internal-autofill-selected {\n color: transparent !important;\n }\n\n &:-webkit-autofill,\n &:-webkit-autofill:hover,\n &:-webkit-autofill:focus {\n -webkit-text-fill-color: transparent !important;\n color: transparent !important;\n }\n }\n "], ["\n color-scheme: ", ";\n\n &:-internal-autofill-selected {\n background-color: ", " !important;\n background-image: none !important;\n color: ", " !important;\n }\n\n &:-webkit-autofill,\n &:-webkit-autofill:hover,\n &:-webkit-autofill:focus {\n -webkit-box-shadow: 0 0 0 1000px ", " inset;\n box-shadow: 0 0 0 1000px ", " inset;\n -webkit-text-fill-color: ", " !important;\n color: ", " !important;\n transition:\n background-color 0s 600000s,\n color 0s 600000s !important;\n }\n\n &:disabled {\n color: ", ";\n\n &:-internal-autofill-selected {\n background-color: ", " !important;\n }\n\n &:-webkit-autofill,\n &:-webkit-autofill:hover,\n &:-webkit-autofill:focus {\n -webkit-box-shadow: 0 0 0 1000px ", " inset;\n box-shadow: 0 0 0 1000px ", " inset;\n }\n }\n\n &.", " {\n color: transparent;\n -webkit-text-fill-color: transparent;\n caret-color: ", ";\n\n &::selection {\n background-color: transparent !important;\n color: transparent !important;\n -webkit-text-fill-color: transparent !important;\n }\n\n /* \u0422\u0435\u043A\u0441\u0442 \u0440\u0438\u0441\u0443\u0435\u0442 MaskOverlay; \u0431\u0440\u0430\u0443\u0437\u0435\u0440 \u043F\u0440\u0438 autofill \u043D\u0435 \u0434\u043E\u043B\u0436\u0435\u043D \u043F\u0435\u0440\u0435\u0431\u0438\u0432\u0430\u0442\u044C fill-color. */\n &:-internal-autofill-selected {\n color: transparent !important;\n }\n\n &:-webkit-autofill,\n &:-webkit-autofill:hover,\n &:-webkit-autofill:focus {\n -webkit-text-fill-color: transparent !important;\n color: transparent !important;\n }\n }\n "])), t.inputColorScheme, t.inputBg, t.inputTextColor, t.inputBg, t.inputBg, t.inputTextColor, t.inputTextColor, t.inputTextColorDisabled, t.inputDisabledBg, t.inputDisabledBg, t.inputDisabledBg, globalClasses.masked, t.inputTextColor);
|
|
18
|
-
},
|
|
19
|
-
overlay: function () {
|
|
20
|
-
return css(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n position: absolute;\n inset: 0;\n pointer-events: none;\n user-select: none;\n overflow: hidden;\n display: flex;\n align-items: center;\n z-index: 2;\n "], ["\n position: absolute;\n inset: 0;\n pointer-events: none;\n user-select: none;\n overflow: hidden;\n display: flex;\n align-items: center;\n z-index: 2;\n "])));
|
|
21
|
-
},
|
|
22
|
-
typed: function (t) {
|
|
23
|
-
return css(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n white-space: pre;\n color: ", ";\n\n &.", " {\n color: ", ";\n }\n "], ["\n white-space: pre;\n color: ", ";\n\n &.", " {\n color: ", ";\n }\n "])), t.inputTextColor, globalClasses.disabled, t.inputTextColorDisabled);
|
|
24
|
-
},
|
|
25
|
-
mask: function (t) {
|
|
26
|
-
return css(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n white-space: pre;\n color: ", ";\n\n &.", " {\n color: ", ";\n }\n\n &.", " {\n color: ", ";\n }\n "], ["\n white-space: pre;\n color: ", ";\n\n &.", " {\n color: ", ";\n }\n\n &.", " {\n color: ", ";\n }\n "])), t.inputTextColor, globalClasses.colored, t.inputPlaceholderColor, globalClasses.disabled, t.inputTextColorDisabled);
|
|
27
|
-
},
|
|
28
|
-
selectedSegment: function () {
|
|
29
|
-
return css(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n background-color: #3390ff;\n color: #fff !important;\n -webkit-text-fill-color: #fff !important;\n "], ["\n background-color: #3390ff;\n color: #fff !important;\n -webkit-text-fill-color: #fff !important;\n "])));
|
|
30
|
-
},
|
|
31
|
-
});
|
|
32
|
-
});
|
|
33
|
-
var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5;
|
|
34
|
-
//# sourceMappingURL=MaskedInternal.styles.js.map
|
|
@@ -1 +0,0 @@
|
|
|
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cAAc,EAErB,aAAa,CAAC,QAAQ,EACf,CAAC,CAAC,sBAAsB,EAEnC;QACJ,CAAC;QACD,IAAI,YAAC,CAAQ;YACX,OAAO,GAAG,0NAAA,0CAEC,EAAgB,eAErB,EAAqB,qBACd,EAAuB,wBAG9B,EAAsB,qBACf,EAAwB,kBAEpC,KATU,CAAC,CAAC,cAAc,EAErB,aAAa,CAAC,OAAO,EACd,CAAC,CAAC,qBAAqB,EAG9B,aAAa,CAAC,QAAQ,EACf,CAAC,CAAC,sBAAsB,EAEnC;QACJ,CAAC;QACD,eAAe;YACb,OAAO,GAAG,6LAAA,0HAIT,KAAC;QACJ,CAAC;KACF,CAAC;AA1G8D,CA0G9D,CAAC,CAAC","sourcesContent":["import type { Emotion } from '@emotion/css/create-instance';\n\nimport { memoizeGetStyles, prefix } from '../../../lib/theming/Emotion.js';\nimport type { Theme } from '../../../lib/theming/Theme.js';\n\nexport const globalClasses = prefix('masked-internal')({\n input: 'input',\n disabled: 'disabled',\n selected: 'selected',\n masked: 'masked',\n colored: 'colored',\n});\n\nexport const getStyles = memoizeGetStyles(({ css }: Emotion) => ({\n input(t: Theme) {\n return css`\n color-scheme: ${t.inputColorScheme};\n\n &:-internal-autofill-selected {\n background-color: ${t.inputBg} !important;\n background-image: none !important;\n color: ${t.inputTextColor} !important;\n }\n\n &:-webkit-autofill,\n &:-webkit-autofill:hover,\n &:-webkit-autofill:focus {\n -webkit-box-shadow: 0 0 0 1000px ${t.inputBg} inset;\n box-shadow: 0 0 0 1000px ${t.inputBg} inset;\n -webkit-text-fill-color: ${t.inputTextColor} !important;\n color: ${t.inputTextColor} !important;\n transition:\n background-color 0s 600000s,\n color 0s 600000s !important;\n }\n\n &:disabled {\n color: ${t.inputTextColorDisabled};\n\n &:-internal-autofill-selected {\n background-color: ${t.inputDisabledBg} !important;\n }\n\n &:-webkit-autofill,\n &:-webkit-autofill:hover,\n &:-webkit-autofill:focus {\n -webkit-box-shadow: 0 0 0 1000px ${t.inputDisabledBg} inset;\n box-shadow: 0 0 0 1000px ${t.inputDisabledBg} inset;\n }\n }\n\n &.${globalClasses.masked} {\n color: transparent;\n -webkit-text-fill-color: transparent;\n caret-color: ${t.inputTextColor};\n\n &::selection {\n background-color: transparent !important;\n color: transparent !important;\n -webkit-text-fill-color: transparent !important;\n }\n\n /* Текст рисует MaskOverlay; браузер при autofill не должен перебивать fill-color. */\n &:-internal-autofill-selected {\n color: transparent !important;\n }\n\n &:-webkit-autofill,\n &:-webkit-autofill:hover,\n &:-webkit-autofill:focus {\n -webkit-text-fill-color: transparent !important;\n color: transparent !important;\n }\n }\n `;\n },\n overlay() {\n return css`\n position: absolute;\n inset: 0;\n pointer-events: none;\n user-select: none;\n overflow: hidden;\n display: flex;\n align-items: center;\n z-index: 2;\n `;\n },\n typed(t: Theme) {\n return css`\n white-space: pre;\n color: ${t.inputTextColor};\n\n &.${globalClasses.disabled} {\n color: ${t.inputTextColorDisabled};\n }\n `;\n },\n mask(t: Theme) {\n return css`\n white-space: pre;\n color: ${t.inputTextColor};\n\n &.${globalClasses.colored} {\n color: ${t.inputPlaceholderColor};\n }\n\n &.${globalClasses.disabled} {\n color: ${t.inputTextColorDisabled};\n }\n `;\n },\n selectedSegment() {\n return css`\n background-color: #3390ff;\n color: #fff !important;\n -webkit-text-fill-color: #fff !important;\n `;\n },\n}));\n"]}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import type { MaskedPattern } from '../react-imask/imask/index.js';
|
|
2
|
-
import type { SlotMap } from './types.js';
|
|
3
|
-
/**
|
|
4
|
-
* Строит карту соответствия позиций displayValue и raw-слотов для текущей маски.
|
|
5
|
-
* Временно сбрасывает IMask в пустое состояние с `lazy: false`, чтобы получить
|
|
6
|
-
* полный шаблон с плейсхолдерами (например, `"__.__"` для `mask="99.99"`).
|
|
7
|
-
*
|
|
8
|
-
* @param imask — IMask-инстанс с настроенной маской.
|
|
9
|
-
* @returns карта пользовательских слотов и отображения masked ↔ raw.
|
|
10
|
-
*/
|
|
11
|
-
export declare function buildSlotMap(imask: MaskedPattern): SlotMap;
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Строит карту соответствия позиций displayValue и raw-слотов для текущей маски.
|
|
3
|
-
* Временно сбрасывает IMask в пустое состояние с `lazy: false`, чтобы получить
|
|
4
|
-
* полный шаблон с плейсхолдерами (например, `"__.__"` для `mask="99.99"`).
|
|
5
|
-
*
|
|
6
|
-
* @param imask — IMask-инстанс с настроенной маской.
|
|
7
|
-
* @returns карта пользовательских слотов и отображения masked ↔ raw.
|
|
8
|
-
*/
|
|
9
|
-
export function buildSlotMap(imask) {
|
|
10
|
-
var _a, _b, _c;
|
|
11
|
-
// Сохраняем состояние
|
|
12
|
-
var savedRaw = imask.unmaskedValue;
|
|
13
|
-
var savedLazy = (_c = (_b = (_a = imask._masked) === null || _a === void 0 ? void 0 : _a.options) === null || _b === void 0 ? void 0 : _b.lazy) !== null && _c !== void 0 ? _c : true;
|
|
14
|
-
// Получаем пустой шаблон: "_._._" для mask="99.99"
|
|
15
|
-
imask.unmaskedValue = '';
|
|
16
|
-
imask.updateOptions({ lazy: false });
|
|
17
|
-
var emptyDisplay = imask.displayValue;
|
|
18
|
-
// Восстанавливаем состояние
|
|
19
|
-
imask.unmaskedValue = savedRaw;
|
|
20
|
-
imask.updateOptions({ lazy: savedLazy });
|
|
21
|
-
var placeholderChar = imask.placeholderChar;
|
|
22
|
-
var userSlots = [];
|
|
23
|
-
var maskedToRaw = [];
|
|
24
|
-
var rawToMasked = [];
|
|
25
|
-
for (var i = 0; i < emptyDisplay.length; i++) {
|
|
26
|
-
if (emptyDisplay[i] === placeholderChar) {
|
|
27
|
-
rawToMasked.push(i);
|
|
28
|
-
maskedToRaw.push(userSlots.length);
|
|
29
|
-
userSlots.push(i);
|
|
30
|
-
}
|
|
31
|
-
else {
|
|
32
|
-
maskedToRaw.push(null);
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
return { userSlots: userSlots, maskedToRaw: maskedToRaw, rawToMasked: rawToMasked };
|
|
36
|
-
}
|
|
37
|
-
//# sourceMappingURL=buildSlotMap.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"buildSlotMap.js","sourceRoot":"","sources":["buildSlotMap.ts"],"names":[],"mappings":"AAGA;;;;;;;GAOG;AACH,MAAM,UAAU,YAAY,CAAC,KAAoB;;IAC/C,sBAAsB;IACtB,IAAM,QAAQ,GAAG,KAAK,CAAC,aAAa,CAAC;IACrC,IAAM,SAAS,GAAG,MAAA,MAAA,MAAC,KAAa,CAAC,OAAO,0CAAE,OAAO,0CAAE,IAAI,mCAAI,IAAI,CAAC;IAEhE,mDAAmD;IACnD,KAAK,CAAC,aAAa,GAAG,EAAE,CAAC;IACzB,KAAK,CAAC,aAAa,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC;IACrC,IAAM,YAAY,GAAG,KAAK,CAAC,YAAY,CAAC;IAExC,4BAA4B;IAC5B,KAAK,CAAC,aAAa,GAAG,QAAQ,CAAC;IAC/B,KAAK,CAAC,aAAa,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC,CAAC;IAEzC,IAAM,eAAe,GAAG,KAAK,CAAC,eAAe,CAAC;IAC9C,IAAM,SAAS,GAAa,EAAE,CAAC;IAC/B,IAAM,WAAW,GAAyB,EAAE,CAAC;IAC7C,IAAM,WAAW,GAAa,EAAE,CAAC;IAEjC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,YAAY,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QAC7C,IAAI,YAAY,CAAC,CAAC,CAAC,KAAK,eAAe,EAAE,CAAC;YACxC,WAAW,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;YACpB,WAAW,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;YACnC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QACpB,CAAC;aAAM,CAAC;YACN,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACzB,CAAC;IACH,CAAC;IAED,OAAO,EAAE,SAAS,WAAA,EAAE,WAAW,aAAA,EAAE,WAAW,aAAA,EAAE,CAAC;AACjD,CAAC","sourcesContent":["import type { MaskedPattern } from '../react-imask/imask/index.js';\nimport type { SlotMap } from './types.js';\n\n/**\n * Строит карту соответствия позиций displayValue и raw-слотов для текущей маски.\n * Временно сбрасывает IMask в пустое состояние с `lazy: false`, чтобы получить\n * полный шаблон с плейсхолдерами (например, `\"__.__\"` для `mask=\"99.99\"`).\n *\n * @param imask — IMask-инстанс с настроенной маской.\n * @returns карта пользовательских слотов и отображения masked ↔ raw.\n */\nexport function buildSlotMap(imask: MaskedPattern): SlotMap {\n // Сохраняем состояние\n const savedRaw = imask.unmaskedValue;\n const savedLazy = (imask as any)._masked?.options?.lazy ?? true;\n\n // Получаем пустой шаблон: \"_._._\" для mask=\"99.99\"\n imask.unmaskedValue = '';\n imask.updateOptions({ lazy: false });\n const emptyDisplay = imask.displayValue;\n\n // Восстанавливаем состояние\n imask.unmaskedValue = savedRaw;\n imask.updateOptions({ lazy: savedLazy });\n\n const placeholderChar = imask.placeholderChar;\n const userSlots: number[] = [];\n const maskedToRaw: Array<number | null> = [];\n const rawToMasked: number[] = [];\n\n for (let i = 0; i < emptyDisplay.length; i++) {\n if (emptyDisplay[i] === placeholderChar) {\n rawToMasked.push(i);\n maskedToRaw.push(userSlots.length);\n userSlots.push(i);\n } else {\n maskedToRaw.push(null);\n }\n }\n\n return { userSlots, maskedToRaw, rawToMasked };\n}\n"]}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import type { MaskEngine } from './types.js';
|
|
2
|
-
/**
|
|
3
|
-
* Извлекает raw (unmasked) значение из masked или unmasked строки.
|
|
4
|
-
* Принимает любой формат — IMask сам разберёт.
|
|
5
|
-
*
|
|
6
|
-
* @param value — значение из props или буфера обмена (masked/unmasked).
|
|
7
|
-
* @param engine — движок маски с IMask-инстансом.
|
|
8
|
-
* @returns строка только из пользовательских символов без литералов маски.
|
|
9
|
-
*/
|
|
10
|
-
export declare function extractRaw(value: string | number | null | undefined, engine: Pick<MaskEngine, 'imask'>): string;
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Извлекает raw (unmasked) значение из masked или unmasked строки.
|
|
3
|
-
* Принимает любой формат — IMask сам разберёт.
|
|
4
|
-
*
|
|
5
|
-
* @param value — значение из props или буфера обмена (masked/unmasked).
|
|
6
|
-
* @param engine — движок маски с IMask-инстансом.
|
|
7
|
-
* @returns строка только из пользовательских символов без литералов маски.
|
|
8
|
-
*/
|
|
9
|
-
export function extractRaw(value, engine) {
|
|
10
|
-
if (value === null || value === undefined || value === '') {
|
|
11
|
-
return '';
|
|
12
|
-
}
|
|
13
|
-
engine.imask.value = String(value);
|
|
14
|
-
return engine.imask.rawInputValue;
|
|
15
|
-
}
|
|
16
|
-
//# sourceMappingURL=extractRaw.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"extractRaw.js","sourceRoot":"","sources":["extractRaw.ts"],"names":[],"mappings":"AAEA;;;;;;;GAOG;AACH,MAAM,UAAU,UAAU,CAAC,KAAyC,EAAE,MAAiC;IACrG,IAAI,KAAK,KAAK,IAAI,IAAI,KAAK,KAAK,SAAS,IAAI,KAAK,KAAK,EAAE,EAAE,CAAC;QAC1D,OAAO,EAAE,CAAC;IACZ,CAAC;IACD,MAAM,CAAC,KAAK,CAAC,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC;IACnC,OAAO,MAAM,CAAC,KAAK,CAAC,aAAa,CAAC;AACpC,CAAC","sourcesContent":["import type { MaskEngine } from './types.js';\n\n/**\n * Извлекает raw (unmasked) значение из masked или unmasked строки.\n * Принимает любой формат — IMask сам разберёт.\n *\n * @param value — значение из props или буфера обмена (masked/unmasked).\n * @param engine — движок маски с IMask-инстансом.\n * @returns строка только из пользовательских символов без литералов маски.\n */\nexport function extractRaw(value: string | number | null | undefined, engine: Pick<MaskEngine, 'imask'>): string {\n if (value === null || value === undefined || value === '') {\n return '';\n }\n engine.imask.value = String(value);\n return engine.imask.rawInputValue;\n}\n"]}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import type { SlotMap } from './types.js';
|
|
2
|
-
/**
|
|
3
|
-
* Для позиции курсора на фиксированном символе маски ищет позицию вставки
|
|
4
|
-
* после ближайшего пользовательского слота слева.
|
|
5
|
-
*
|
|
6
|
-
* @param maskedPos — позиция курсора в displayValue.
|
|
7
|
-
* @param slotMap — карта соответствия позиций маски и raw-слотов.
|
|
8
|
-
* @returns индекс в raw для вставки; `0`, если слева нет пользовательских слотов.
|
|
9
|
-
*/
|
|
10
|
-
export declare function findNearestRawLeft(maskedPos: number, slotMap: SlotMap): number;
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Для позиции курсора на фиксированном символе маски ищет позицию вставки
|
|
3
|
-
* после ближайшего пользовательского слота слева.
|
|
4
|
-
*
|
|
5
|
-
* @param maskedPos — позиция курсора в displayValue.
|
|
6
|
-
* @param slotMap — карта соответствия позиций маски и raw-слотов.
|
|
7
|
-
* @returns индекс в raw для вставки; `0`, если слева нет пользовательских слотов.
|
|
8
|
-
*/
|
|
9
|
-
export function findNearestRawLeft(maskedPos, slotMap) {
|
|
10
|
-
for (var i = maskedPos - 1; i >= 0; i--) {
|
|
11
|
-
var raw = slotMap.maskedToRaw[i];
|
|
12
|
-
if (raw !== null && raw !== undefined) {
|
|
13
|
-
return raw + 1;
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
return 0;
|
|
17
|
-
}
|
|
18
|
-
//# sourceMappingURL=findNearestRawLeft.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"findNearestRawLeft.js","sourceRoot":"","sources":["findNearestRawLeft.ts"],"names":[],"mappings":"AAEA;;;;;;;GAOG;AACH,MAAM,UAAU,kBAAkB,CAAC,SAAiB,EAAE,OAAgB;IACpE,KAAK,IAAI,CAAC,GAAG,SAAS,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;QACxC,IAAM,GAAG,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC;QACnC,IAAI,GAAG,KAAK,IAAI,IAAI,GAAG,KAAK,SAAS,EAAE,CAAC;YACtC,OAAO,GAAG,GAAG,CAAC,CAAC;QACjB,CAAC;IACH,CAAC;IACD,OAAO,CAAC,CAAC;AACX,CAAC","sourcesContent":["import type { SlotMap } from './types.js';\n\n/**\n * Для позиции курсора на фиксированном символе маски ищет позицию вставки\n * после ближайшего пользовательского слота слева.\n *\n * @param maskedPos — позиция курсора в displayValue.\n * @param slotMap — карта соответствия позиций маски и raw-слотов.\n * @returns индекс в raw для вставки; `0`, если слева нет пользовательских слотов.\n */\nexport function findNearestRawLeft(maskedPos: number, slotMap: SlotMap): number {\n for (let i = maskedPos - 1; i >= 0; i--) {\n const raw = slotMap.maskedToRaw[i];\n if (raw !== null && raw !== undefined) {\n return raw + 1;\n }\n }\n return 0;\n}\n"]}
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
/** Re-export утилит работы с маской из отдельных модулей. */
|
|
2
|
-
export { buildSlotMap } from './buildSlotMap.js';
|
|
3
|
-
export { extractRaw } from './extractRaw.js';
|
|
4
|
-
export { findNearestRawLeft } from './findNearestRawLeft.js';
|
|
5
|
-
export { stripMaskChars } from './stripMaskChars.js';
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
/** Re-export утилит работы с маской из отдельных модулей. */
|
|
2
|
-
export { buildSlotMap } from './buildSlotMap.js';
|
|
3
|
-
export { extractRaw } from './extractRaw.js';
|
|
4
|
-
export { findNearestRawLeft } from './findNearestRawLeft.js';
|
|
5
|
-
export { stripMaskChars } from './stripMaskChars.js';
|
|
6
|
-
//# sourceMappingURL=helpers.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"helpers.js","sourceRoot":"","sources":["helpers.ts"],"names":[],"mappings":"AAAA,6DAA6D;AAC7D,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC","sourcesContent":["/** Re-export утилит работы с маской из отдельных модулей. */\nexport { buildSlotMap } from './buildSlotMap.js';\nexport { extractRaw } from './extractRaw.js';\nexport { findNearestRawLeft } from './findNearestRawLeft.js';\nexport { stripMaskChars } from './stripMaskChars.js';\n"]}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import type { SlotMap } from './types.js';
|
|
2
|
-
/**
|
|
3
|
-
* Возвращает текст для буфера обмена при copy/cut.
|
|
4
|
-
* В отличие от raw, включает литералы маски из displayValue.
|
|
5
|
-
*
|
|
6
|
-
* @param displayValue — полное отображаемое значение маски.
|
|
7
|
-
* @param start — начало выделения в displayValue.
|
|
8
|
-
* @param end — конец выделения в displayValue.
|
|
9
|
-
*/
|
|
10
|
-
export declare function getMaskedCopyText(displayValue: string, start: number, end: number): string;
|
|
11
|
-
/** Результат cut: новое raw и позиция курсора. */
|
|
12
|
-
export interface MaskedCutResult {
|
|
13
|
-
newRaw: string;
|
|
14
|
-
cursorPos: number;
|
|
15
|
-
}
|
|
16
|
-
/**
|
|
17
|
-
* Удаляет из raw пользовательские символы, попавшие в выделение displayValue.
|
|
18
|
-
*
|
|
19
|
-
* @param start — начало выделения в displayValue.
|
|
20
|
-
* @param end — конец выделения в displayValue.
|
|
21
|
-
* @param currentRaw — текущее raw-значение.
|
|
22
|
-
* @param slotMap — карта слотов маски.
|
|
23
|
-
* @returns новое raw и позицию курсора после cut.
|
|
24
|
-
*/
|
|
25
|
-
export declare function computeMaskedCut(start: number, end: number, currentRaw: string, slotMap: SlotMap): MaskedCutResult;
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Возвращает текст для буфера обмена при copy/cut.
|
|
3
|
-
* В отличие от raw, включает литералы маски из displayValue.
|
|
4
|
-
*
|
|
5
|
-
* @param displayValue — полное отображаемое значение маски.
|
|
6
|
-
* @param start — начало выделения в displayValue.
|
|
7
|
-
* @param end — конец выделения в displayValue.
|
|
8
|
-
*/
|
|
9
|
-
export function getMaskedCopyText(displayValue, start, end) {
|
|
10
|
-
return displayValue.slice(start, end);
|
|
11
|
-
}
|
|
12
|
-
/**
|
|
13
|
-
* Удаляет из raw пользовательские символы, попавшие в выделение displayValue.
|
|
14
|
-
*
|
|
15
|
-
* @param start — начало выделения в displayValue.
|
|
16
|
-
* @param end — конец выделения в displayValue.
|
|
17
|
-
* @param currentRaw — текущее raw-значение.
|
|
18
|
-
* @param slotMap — карта слотов маски.
|
|
19
|
-
* @returns новое raw и позицию курсора после cut.
|
|
20
|
-
*/
|
|
21
|
-
export function computeMaskedCut(start, end, currentRaw, slotMap) {
|
|
22
|
-
var _a, _b;
|
|
23
|
-
var rawStart = (_a = slotMap.maskedToRaw[start]) !== null && _a !== void 0 ? _a : 0;
|
|
24
|
-
var rawEndEntry = slotMap.maskedToRaw[end - 1];
|
|
25
|
-
var rawEnd = rawEndEntry !== null && rawEndEntry !== undefined ? rawEndEntry + 1 : rawStart;
|
|
26
|
-
var newRaw = currentRaw.slice(0, rawStart) + currentRaw.slice(rawEnd);
|
|
27
|
-
var cursorPos = (_b = slotMap.rawToMasked[rawStart]) !== null && _b !== void 0 ? _b : 0;
|
|
28
|
-
return { newRaw: newRaw, cursorPos: cursorPos };
|
|
29
|
-
}
|
|
30
|
-
//# sourceMappingURL=maskedCoreClipboard.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"maskedCoreClipboard.js","sourceRoot":"","sources":["maskedCoreClipboard.ts"],"names":[],"mappings":"AAEA;;;;;;;GAOG;AACH,MAAM,UAAU,iBAAiB,CAAC,YAAoB,EAAE,KAAa,EAAE,GAAW;IAChF,OAAO,YAAY,CAAC,KAAK,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;AACxC,CAAC;AAQD;;;;;;;;GAQG;AACH,MAAM,UAAU,gBAAgB,CAAC,KAAa,EAAE,GAAW,EAAE,UAAkB,EAAE,OAAgB;;IAC/F,IAAM,QAAQ,GAAG,MAAA,OAAO,CAAC,WAAW,CAAC,KAAK,CAAC,mCAAI,CAAC,CAAC;IACjD,IAAM,WAAW,GAAG,OAAO,CAAC,WAAW,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC;IACjD,IAAM,MAAM,GAAG,WAAW,KAAK,IAAI,IAAI,WAAW,KAAK,SAAS,CAAC,CAAC,CAAC,WAAW,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC;IAC9F,IAAM,MAAM,GAAG,UAAU,CAAC,KAAK,CAAC,CAAC,EAAE,QAAQ,CAAC,GAAG,UAAU,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;IACxE,IAAM,SAAS,GAAG,MAAA,OAAO,CAAC,WAAW,CAAC,QAAQ,CAAC,mCAAI,CAAC,CAAC;IAErD,OAAO,EAAE,MAAM,QAAA,EAAE,SAAS,WAAA,EAAE,CAAC;AAC/B,CAAC","sourcesContent":["import type { SlotMap } from './types.js';\n\n/**\n * Возвращает текст для буфера обмена при copy/cut.\n * В отличие от raw, включает литералы маски из displayValue.\n *\n * @param displayValue — полное отображаемое значение маски.\n * @param start — начало выделения в displayValue.\n * @param end — конец выделения в displayValue.\n */\nexport function getMaskedCopyText(displayValue: string, start: number, end: number): string {\n return displayValue.slice(start, end);\n}\n\n/** Результат cut: новое raw и позиция курсора. */\nexport interface MaskedCutResult {\n newRaw: string;\n cursorPos: number;\n}\n\n/**\n * Удаляет из raw пользовательские символы, попавшие в выделение displayValue.\n *\n * @param start — начало выделения в displayValue.\n * @param end — конец выделения в displayValue.\n * @param currentRaw — текущее raw-значение.\n * @param slotMap — карта слотов маски.\n * @returns новое raw и позицию курсора после cut.\n */\nexport function computeMaskedCut(start: number, end: number, currentRaw: string, slotMap: SlotMap): MaskedCutResult {\n const rawStart = slotMap.maskedToRaw[start] ?? 0;\n const rawEndEntry = slotMap.maskedToRaw[end - 1];\n const rawEnd = rawEndEntry !== null && rawEndEntry !== undefined ? rawEndEntry + 1 : rawStart;\n const newRaw = currentRaw.slice(0, rawStart) + currentRaw.slice(rawEnd);\n const cursorPos = slotMap.rawToMasked[rawStart] ?? 0;\n\n return { newRaw, cursorPos };\n}\n"]}
|