@alfalab/core-components-date-input 1.2.11 → 2.0.0
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 +83 -0
- package/dist/Component.d.ts +16 -18
- package/dist/Component.js +68 -29
- package/dist/cssm/Component.d.ts +16 -18
- package/dist/cssm/Component.js +67 -28
- package/dist/cssm/index.js +7 -7
- package/dist/cssm/utils/format.d.ts +3 -1
- package/dist/cssm/utils/format.js +27 -3
- package/dist/cssm/utils/index.d.ts +0 -1
- package/dist/cssm/utils/index.js +5 -6
- package/dist/cssm/utils/native-supports.d.ts +1 -3
- package/dist/cssm/utils/native-supports.js +0 -4
- package/dist/esm/Component.d.ts +16 -18
- package/dist/esm/Component.js +70 -32
- package/dist/esm/index.css +4 -4
- package/dist/esm/index.js +7 -5
- package/dist/esm/utils/format.d.ts +3 -1
- package/dist/esm/utils/format.js +19 -3
- package/dist/esm/utils/index.d.ts +0 -1
- package/dist/esm/utils/index.js +5 -4
- package/dist/esm/utils/native-supports.d.ts +1 -3
- package/dist/esm/utils/native-supports.js +1 -3
- package/dist/index.css +4 -4
- package/dist/index.js +7 -7
- package/dist/modern/Component.d.ts +16 -18
- package/dist/modern/Component.js +70 -30
- package/dist/modern/index.css +4 -4
- package/dist/modern/index.js +7 -5
- package/dist/modern/utils/format.d.ts +3 -1
- package/dist/modern/utils/format.js +15 -3
- package/dist/modern/utils/index.d.ts +0 -1
- package/dist/modern/utils/index.js +5 -4
- package/dist/modern/utils/native-supports.d.ts +1 -3
- package/dist/modern/utils/native-supports.js +1 -3
- package/dist/utils/format.d.ts +3 -1
- package/dist/utils/format.js +27 -3
- package/dist/utils/index.d.ts +0 -1
- package/dist/utils/index.js +5 -6
- package/dist/utils/native-supports.d.ts +1 -3
- package/dist/utils/native-supports.js +0 -4
- package/package.json +5 -4
- package/dist/cssm/utils/date-correction-pipe.d.ts +0 -9
- package/dist/cssm/utils/date-correction-pipe.js +0 -59
- package/dist/esm/utils/date-correction-pipe.d.ts +0 -9
- package/dist/esm/utils/date-correction-pipe.js +0 -54
- package/dist/modern/utils/date-correction-pipe.d.ts +0 -9
- package/dist/modern/utils/date-correction-pipe.js +0 -52
- package/dist/utils/date-correction-pipe.d.ts +0 -9
- package/dist/utils/date-correction-pipe.js +0 -59
package/dist/cssm/utils/index.js
CHANGED
|
@@ -2,9 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
require('date-fns');
|
|
5
|
+
require('date-fns/parse');
|
|
6
|
+
require('date-fns/format');
|
|
7
|
+
require('date-fns/isValid');
|
|
6
8
|
var utils_format = require('./format.js');
|
|
7
|
-
var utils_dateCorrectionPipe = require('./date-correction-pipe.js');
|
|
8
9
|
var utils_nativeSupports = require('./native-supports.js');
|
|
9
10
|
|
|
10
11
|
|
|
@@ -12,11 +13,9 @@ var utils_nativeSupports = require('./native-supports.js');
|
|
|
12
13
|
exports.DATE_FORMAT = utils_format.DATE_FORMAT;
|
|
13
14
|
exports.DATE_MASK = utils_format.DATE_MASK;
|
|
14
15
|
exports.NATIVE_DATE_FORMAT = utils_format.NATIVE_DATE_FORMAT;
|
|
16
|
+
exports.format = utils_format.format;
|
|
15
17
|
exports.formatDate = utils_format.formatDate;
|
|
16
18
|
exports.isCompleteDateInput = utils_format.isCompleteDateInput;
|
|
19
|
+
exports.isValid = utils_format.isValid;
|
|
17
20
|
exports.parseDateString = utils_format.parseDateString;
|
|
18
|
-
exports.createAutoCorrectedDatePipe = utils_dateCorrectionPipe.createAutoCorrectedDatePipe;
|
|
19
|
-
exports.mask = utils_dateCorrectionPipe.mask;
|
|
20
|
-
exports.IS_BROWSER = utils_nativeSupports.IS_BROWSER;
|
|
21
|
-
exports.SUPPORTS_INPUT_TYPE_DATE = utils_nativeSupports.SUPPORTS_INPUT_TYPE_DATE;
|
|
22
21
|
exports.isInputDateSupported = utils_nativeSupports.isInputDateSupported;
|
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
declare const IS_BROWSER: boolean;
|
|
2
|
-
declare const SUPPORTS_INPUT_TYPE_DATE: boolean;
|
|
3
1
|
/**
|
|
4
2
|
* Возвращает `true`, если поддерживается `input[type="date"]`
|
|
5
3
|
*/
|
|
6
4
|
declare function isInputDateSupported(): boolean;
|
|
7
|
-
export {
|
|
5
|
+
export { isInputDateSupported };
|
|
@@ -2,8 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var IS_BROWSER = typeof window !== 'undefined';
|
|
6
|
-
var SUPPORTS_INPUT_TYPE_DATE = IS_BROWSER && isInputDateSupported();
|
|
7
5
|
/**
|
|
8
6
|
* Возвращает `true`, если поддерживается `input[type="date"]`
|
|
9
7
|
*/
|
|
@@ -15,6 +13,4 @@ function isInputDateSupported() {
|
|
|
15
13
|
return input.value !== value;
|
|
16
14
|
}
|
|
17
15
|
|
|
18
|
-
exports.IS_BROWSER = IS_BROWSER;
|
|
19
|
-
exports.SUPPORTS_INPUT_TYPE_DATE = SUPPORTS_INPUT_TYPE_DATE;
|
|
20
16
|
exports.isInputDateSupported = isInputDateSupported;
|
package/dist/esm/Component.d.ts
CHANGED
|
@@ -1,16 +1,8 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { ChangeEvent } from "react";
|
|
4
|
-
import {
|
|
5
|
-
type DateInputProps = Omit<
|
|
6
|
-
/**
|
|
7
|
-
* Минимальный год, доступный для ввода
|
|
8
|
-
*/
|
|
9
|
-
minYear?: number;
|
|
10
|
-
/**
|
|
11
|
-
* Максимальный год, доступный для ввода
|
|
12
|
-
*/
|
|
13
|
-
maxYear?: number;
|
|
4
|
+
import { InputProps } from "@alfalab/core-components-input";
|
|
5
|
+
type DateInputProps = Omit<InputProps, 'onChange'> & {
|
|
14
6
|
/**
|
|
15
7
|
* Управление нативным режимом на мобильных устройствах
|
|
16
8
|
*/
|
|
@@ -22,16 +14,15 @@ type DateInputProps = Omit<MaskedInputProps, 'onBeforeDisplay' | 'mask' | 'onCha
|
|
|
22
14
|
date: Date;
|
|
23
15
|
value: string;
|
|
24
16
|
}) => void;
|
|
25
|
-
};
|
|
26
|
-
declare const DateInput: React.ForwardRefExoticComponent<Pick<MaskedInputProps, "className" | "dataTestId" | "form" | "label" | "slot" | "style" | "title" | "pattern" | "children" | "leftAddons" | "rightAddons" | "size" | "block" | "colors" | "type" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "id" | "lang" | "placeholder" | "spellCheck" | "tabIndex" | "translate" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "color" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "list" | "step" | "autoFocus" | "disabled" | "formAction" | "formEncType" | "formMethod" | "formNoValidate" | "formTarget" | "name" | "value" | "fieldClassName" | "labelClassName" | "addonsClassName" | "error" | "hint" | "bottomAddons" | "accept" | "alt" | "autoComplete" | "capture" | "checked" | "crossOrigin" | "height" | "max" | "maxLength" | "min" | "minLength" | "multiple" | "readOnly" | "required" | "src" | "width" | "clear" | "success" | "inputClassName" | "focusedClassName" | "filledClassName" | "onClear" | "wrapperRef" | "keepCharPositions"> & {
|
|
27
|
-
/**
|
|
28
|
-
* Минимальный год, доступный для ввода
|
|
29
|
-
*/
|
|
30
|
-
minYear?: number | undefined;
|
|
31
17
|
/**
|
|
32
|
-
*
|
|
18
|
+
* Обработчик окончания ввода
|
|
33
19
|
*/
|
|
34
|
-
|
|
20
|
+
onComplete?: (event: ChangeEvent<HTMLInputElement>, payload: {
|
|
21
|
+
date: Date;
|
|
22
|
+
value: string;
|
|
23
|
+
}) => void;
|
|
24
|
+
};
|
|
25
|
+
declare const DateInput: React.ForwardRefExoticComponent<Pick<InputProps, "className" | "dataTestId" | "form" | "label" | "slot" | "style" | "title" | "pattern" | "children" | "leftAddons" | "rightAddons" | "size" | "block" | "colors" | "type" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "id" | "lang" | "placeholder" | "spellCheck" | "tabIndex" | "translate" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "color" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "list" | "step" | "autoFocus" | "disabled" | "formAction" | "formEncType" | "formMethod" | "formNoValidate" | "formTarget" | "name" | "value" | "fieldClassName" | "labelClassName" | "addonsClassName" | "error" | "hint" | "bottomAddons" | "accept" | "alt" | "autoComplete" | "capture" | "checked" | "crossOrigin" | "height" | "max" | "maxLength" | "min" | "minLength" | "multiple" | "readOnly" | "required" | "src" | "width" | "clear" | "success" | "inputClassName" | "focusedClassName" | "filledClassName" | "onClear" | "wrapperRef"> & {
|
|
35
26
|
/**
|
|
36
27
|
* Управление нативным режимом на мобильных устройствах
|
|
37
28
|
*/
|
|
@@ -43,5 +34,12 @@ declare const DateInput: React.ForwardRefExoticComponent<Pick<MaskedInputProps,
|
|
|
43
34
|
date: Date;
|
|
44
35
|
value: string;
|
|
45
36
|
}) => void) | undefined;
|
|
37
|
+
/**
|
|
38
|
+
* Обработчик окончания ввода
|
|
39
|
+
*/
|
|
40
|
+
onComplete?: ((event: React.ChangeEvent<HTMLInputElement>, payload: {
|
|
41
|
+
date: Date;
|
|
42
|
+
value: string;
|
|
43
|
+
}) => void) | undefined;
|
|
46
44
|
} & React.RefAttributes<HTMLInputElement>>;
|
|
47
45
|
export { DateInputProps, DateInput };
|
package/dist/esm/Component.js
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
import React, {
|
|
2
|
-
import {
|
|
3
|
-
import '
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
1
|
+
import React, { forwardRef, useRef, useState, useCallback, useEffect } from 'react';
|
|
2
|
+
import { Input } from '@alfalab/core-components-input/dist/esm';
|
|
3
|
+
import mergeRefs from 'react-merge-refs';
|
|
4
|
+
import 'date-fns/parse';
|
|
5
|
+
import 'date-fns/format';
|
|
6
|
+
import 'date-fns/isValid';
|
|
7
|
+
import { isValid, DATE_MASK, format, parseDateString, isCompleteDateInput, NATIVE_DATE_FORMAT, formatDate } from './utils/format.js';
|
|
8
|
+
import { isInputDateSupported } from './utils/native-supports.js';
|
|
7
9
|
|
|
8
10
|
/*! *****************************************************************************
|
|
9
11
|
Copyright (c) Microsoft Corporation.
|
|
@@ -44,40 +46,76 @@ function __rest(s, e) {
|
|
|
44
46
|
return t;
|
|
45
47
|
}
|
|
46
48
|
|
|
47
|
-
var styles = {"nativeInput":"date-
|
|
49
|
+
var styles = {"nativeInput":"date-input__nativeInput_1mizx"};
|
|
48
50
|
require('./index.css')
|
|
49
51
|
|
|
50
|
-
var DateInput =
|
|
51
|
-
var
|
|
52
|
-
var
|
|
53
|
-
var shouldRenderNative =
|
|
54
|
-
var
|
|
55
|
-
var
|
|
56
|
-
var
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
}, [maxYear, minYear]);
|
|
62
|
-
var changeHandler = useCallback(function (event, newValue, newDate) {
|
|
63
|
-
if (uncontrolled) {
|
|
64
|
-
setStateValue(newValue);
|
|
52
|
+
var DateInput = forwardRef(function (_a, ref) {
|
|
53
|
+
var _b = _a.mobileMode, mobileMode = _b === void 0 ? 'input' : _b, _c = _a.defaultValue, defaultValue = _c === void 0 ? '' : _c, rightAddons = _a.rightAddons, error = _a.error, propValue = _a.value, onBlur = _a.onBlur, onChange = _a.onChange, onComplete = _a.onComplete, restProps = __rest(_a, ["mobileMode", "defaultValue", "rightAddons", "error", "value", "onBlur", "onChange", "onComplete"]);
|
|
54
|
+
var inputRef = useRef(null);
|
|
55
|
+
var _d = useState(false), shouldRenderNative = _d[0], setShouldRenderNative = _d[1];
|
|
56
|
+
var _e = useState(propValue || defaultValue), value = _e[0], setValue = _e[1];
|
|
57
|
+
var _f = useState(!isValid(propValue)), stateError = _f[0], setStateError = _f[1];
|
|
58
|
+
var handleValueValidity = useCallback(function (inputValue) {
|
|
59
|
+
// Валидируем незаполненное значение только если инпут не в фокусе (блюр, либо установка значения снаружи)
|
|
60
|
+
var validateIncomplete = inputRef.current && document.activeElement !== inputRef.current;
|
|
61
|
+
if (!inputValue || validateIncomplete || inputValue.length >= DATE_MASK.length) {
|
|
62
|
+
setStateError(!isValid(inputValue));
|
|
65
63
|
}
|
|
66
|
-
|
|
67
|
-
onChange(event, { date: newDate, value: newValue });
|
|
68
|
-
}
|
|
69
|
-
}, [onChange, uncontrolled]);
|
|
64
|
+
}, []);
|
|
70
65
|
var handleChange = useCallback(function (event) {
|
|
71
66
|
var newValue = event.target.value;
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
67
|
+
// Позволяем вводить только цифры и точки
|
|
68
|
+
if (/[^\d.]/.test(newValue)) {
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
71
|
+
var dots = newValue.match(/\./g);
|
|
72
|
+
// Не даем вводить больше, чем 2 точки
|
|
73
|
+
if (dots && dots.length > 2) {
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
76
|
+
// Форматируем введенное значение (добавляем точки)
|
|
77
|
+
var formattedValue = format(newValue);
|
|
78
|
+
var date = parseDateString(formattedValue);
|
|
79
|
+
setValue(formattedValue);
|
|
80
|
+
if (onChange)
|
|
81
|
+
onChange(event, { date: date, value: formattedValue });
|
|
82
|
+
if (isCompleteDateInput(formattedValue)) {
|
|
83
|
+
var valid = formattedValue.length > 0 && isValid(formattedValue);
|
|
84
|
+
if (!valid)
|
|
85
|
+
return;
|
|
86
|
+
if (onComplete)
|
|
87
|
+
onComplete(event, { date: date, value: formattedValue });
|
|
88
|
+
}
|
|
89
|
+
}, [onChange, onComplete]);
|
|
75
90
|
var handleNativeInputChange = useCallback(function (event) {
|
|
76
91
|
var newDate = parseDateString(event.target.value, NATIVE_DATE_FORMAT);
|
|
77
92
|
var newValue = event.target.value === '' ? '' : formatDate(newDate);
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
93
|
+
setValue(newValue);
|
|
94
|
+
if (onComplete)
|
|
95
|
+
onComplete(event, { date: newDate, value: newValue });
|
|
96
|
+
if (onChange)
|
|
97
|
+
onChange(event, { date: newDate, value: newValue });
|
|
98
|
+
}, [onComplete, onChange]);
|
|
99
|
+
var handleBlur = useCallback(function (event) {
|
|
100
|
+
handleValueValidity(value);
|
|
101
|
+
if (onBlur)
|
|
102
|
+
onBlur(event);
|
|
103
|
+
}, [handleValueValidity, onBlur, value]);
|
|
104
|
+
useEffect(function () {
|
|
105
|
+
if (mobileMode === 'native' && isInputDateSupported()) {
|
|
106
|
+
setShouldRenderNative(true);
|
|
107
|
+
}
|
|
108
|
+
}, [mobileMode]);
|
|
109
|
+
useEffect(function () {
|
|
110
|
+
if (typeof propValue !== 'undefined') {
|
|
111
|
+
setValue(propValue);
|
|
112
|
+
}
|
|
113
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
114
|
+
}, [propValue]);
|
|
115
|
+
useEffect(function () {
|
|
116
|
+
handleValueValidity(value);
|
|
117
|
+
}, [handleValueValidity, value]);
|
|
118
|
+
return (React.createElement(Input, __assign({}, restProps, { ref: mergeRefs([ref, inputRef]), value: value, inputMode: 'decimal', pattern: '[0-9\\.]*', onChange: handleChange, onBlur: handleBlur, placeholder: '\u0414\u0414.\u041C\u041C.\u0413\u0413\u0413\u0413', error: error || stateError, rightAddons: React.createElement(React.Fragment, null,
|
|
81
119
|
rightAddons,
|
|
82
120
|
shouldRenderNative && (React.createElement("input", { type: 'date', ref: ref, defaultValue: defaultValue, onChange: handleNativeInputChange, className: styles.nativeInput }))) })));
|
|
83
121
|
});
|
package/dist/esm/index.css
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* hash:
|
|
1
|
+
/* hash: 1q7gt */
|
|
2
2
|
:root {
|
|
3
3
|
|
|
4
4
|
/* Hard */
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
|
|
8
8
|
/* Hard up */
|
|
9
9
|
}
|
|
10
|
-
.date-
|
|
10
|
+
.date-input__nativeInput_1mizx {
|
|
11
11
|
opacity: 0;
|
|
12
12
|
position: absolute;
|
|
13
13
|
top: 0;
|
|
@@ -18,9 +18,9 @@
|
|
|
18
18
|
appearance: none;
|
|
19
19
|
z-index: 1
|
|
20
20
|
}
|
|
21
|
-
.date-
|
|
21
|
+
.date-input__nativeInput_1mizx::-webkit-calendar-picker-indicator {
|
|
22
22
|
display: none;
|
|
23
23
|
}
|
|
24
|
-
.date-
|
|
24
|
+
.date-input__nativeInput_1mizx::-webkit-inner-spin-button {
|
|
25
25
|
display: none;
|
|
26
26
|
}
|
package/dist/esm/index.js
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
export { DateInput } from './Component.js';
|
|
2
2
|
import 'react';
|
|
3
|
-
import '@alfalab/core-components-
|
|
4
|
-
import '
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
3
|
+
import '@alfalab/core-components-input/dist/esm';
|
|
4
|
+
import 'react-merge-refs';
|
|
5
|
+
import 'date-fns/parse';
|
|
6
|
+
import 'date-fns/format';
|
|
7
|
+
import 'date-fns/isValid';
|
|
8
|
+
export { DATE_FORMAT, DATE_MASK, NATIVE_DATE_FORMAT, format, formatDate, isCompleteDateInput, isValid, parseDateString } from './utils/format.js';
|
|
9
|
+
export { isInputDateSupported } from './utils/native-supports.js';
|
|
@@ -4,4 +4,6 @@ declare const DATE_MASK: (string | RegExp)[];
|
|
|
4
4
|
declare const isCompleteDateInput: (input: string) => boolean;
|
|
5
5
|
declare const formatDate: (date: number | Date, dateFormat?: string) => string;
|
|
6
6
|
declare const parseDateString: (value: string, dateFormat?: string) => Date;
|
|
7
|
-
|
|
7
|
+
declare const isValid: (inputValue?: string | undefined) => boolean;
|
|
8
|
+
declare const format: (value: string) => string;
|
|
9
|
+
export { DATE_FORMAT, NATIVE_DATE_FORMAT, DATE_MASK, isCompleteDateInput, formatDate, parseDateString, isValid, format };
|
package/dist/esm/utils/format.js
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import
|
|
1
|
+
import parse from 'date-fns/parse';
|
|
2
|
+
import dateFnsFormat from 'date-fns/format';
|
|
3
|
+
import dateFnsIsValid from 'date-fns/isValid';
|
|
2
4
|
|
|
3
5
|
var DATE_FORMAT = 'dd.MM.yyyy';
|
|
4
6
|
var NATIVE_DATE_FORMAT = 'yyyy-MM-dd';
|
|
@@ -6,11 +8,25 @@ var DATE_MASK = [/\d/, /\d/, '.', /\d/, /\d/, '.', /\d/, /\d/, /\d/, /\d/];
|
|
|
6
8
|
var isCompleteDateInput = function (input) { return input.length === DATE_MASK.length; };
|
|
7
9
|
var formatDate = function (date, dateFormat) {
|
|
8
10
|
if (dateFormat === void 0) { dateFormat = DATE_FORMAT; }
|
|
9
|
-
return
|
|
11
|
+
return dateFnsFormat(date, dateFormat);
|
|
10
12
|
};
|
|
11
13
|
var parseDateString = function (value, dateFormat) {
|
|
12
14
|
if (dateFormat === void 0) { dateFormat = DATE_FORMAT; }
|
|
13
15
|
return parse(value, dateFormat, new Date());
|
|
14
16
|
};
|
|
17
|
+
var isValid = function (inputValue) {
|
|
18
|
+
return !inputValue || (isCompleteDateInput(inputValue) && dateFnsIsValid(parseDateString(inputValue)));
|
|
19
|
+
};
|
|
20
|
+
var format = function (value) {
|
|
21
|
+
return value
|
|
22
|
+
.replace(/^(\d\d)(\d)$/, '$1.$2') // 121 => 12.1
|
|
23
|
+
.replace(/^(\d\d)\.(\d\d)(\d)$/, '$1.$2.$3') // 12.122 => 12.12.2
|
|
24
|
+
.replace(/^(\d\d)\d\.(.*)/, '$1.$2') // 123.12.2005 => 12.12.2005
|
|
25
|
+
.replace(/^(\d\d\.\d\d)\d\.(.*)/, '$1.$2') // 12.123.2005 => 12.12.2005
|
|
26
|
+
.replace(/^(\d\d\.\d\d\.\d\d\d\d).*/, '$1') // 12.12.20056 => 12.12.2005
|
|
27
|
+
.replace(/\.$/, '') // 12. => 12
|
|
28
|
+
.replace(/^(\d\d\.\d\d)(\d\d\d\d)/, '$1.$2') // 12.122005 => 12.12.2005
|
|
29
|
+
.replace(/^(\d\d)(\d\d\.\d\d\d\d)/, '$1.$2');
|
|
30
|
+
}; // 1212.2005 => 12.12.2005
|
|
15
31
|
|
|
16
|
-
export { DATE_FORMAT, DATE_MASK, NATIVE_DATE_FORMAT, formatDate, isCompleteDateInput, parseDateString };
|
|
32
|
+
export { DATE_FORMAT, DATE_MASK, NATIVE_DATE_FORMAT, format, formatDate, isCompleteDateInput, isValid, parseDateString };
|
package/dist/esm/utils/index.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import 'date-fns';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
export {
|
|
1
|
+
import 'date-fns/parse';
|
|
2
|
+
import 'date-fns/format';
|
|
3
|
+
import 'date-fns/isValid';
|
|
4
|
+
export { DATE_FORMAT, DATE_MASK, NATIVE_DATE_FORMAT, format, formatDate, isCompleteDateInput, isValid, parseDateString } from './format.js';
|
|
5
|
+
export { isInputDateSupported } from './native-supports.js';
|
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
declare const IS_BROWSER: boolean;
|
|
2
|
-
declare const SUPPORTS_INPUT_TYPE_DATE: boolean;
|
|
3
1
|
/**
|
|
4
2
|
* Возвращает `true`, если поддерживается `input[type="date"]`
|
|
5
3
|
*/
|
|
6
4
|
declare function isInputDateSupported(): boolean;
|
|
7
|
-
export {
|
|
5
|
+
export { isInputDateSupported };
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
var IS_BROWSER = typeof window !== 'undefined';
|
|
2
|
-
var SUPPORTS_INPUT_TYPE_DATE = IS_BROWSER && isInputDateSupported();
|
|
3
1
|
/**
|
|
4
2
|
* Возвращает `true`, если поддерживается `input[type="date"]`
|
|
5
3
|
*/
|
|
@@ -11,4 +9,4 @@ function isInputDateSupported() {
|
|
|
11
9
|
return input.value !== value;
|
|
12
10
|
}
|
|
13
11
|
|
|
14
|
-
export {
|
|
12
|
+
export { isInputDateSupported };
|
package/dist/index.css
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* hash:
|
|
1
|
+
/* hash: 1q7gt */
|
|
2
2
|
:root {
|
|
3
3
|
|
|
4
4
|
/* Hard */
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
|
|
8
8
|
/* Hard up */
|
|
9
9
|
}
|
|
10
|
-
.date-
|
|
10
|
+
.date-input__nativeInput_1mizx {
|
|
11
11
|
opacity: 0;
|
|
12
12
|
position: absolute;
|
|
13
13
|
top: 0;
|
|
@@ -18,9 +18,9 @@
|
|
|
18
18
|
appearance: none;
|
|
19
19
|
z-index: 1
|
|
20
20
|
}
|
|
21
|
-
.date-
|
|
21
|
+
.date-input__nativeInput_1mizx::-webkit-calendar-picker-indicator {
|
|
22
22
|
display: none;
|
|
23
23
|
}
|
|
24
|
-
.date-
|
|
24
|
+
.date-input__nativeInput_1mizx::-webkit-inner-spin-button {
|
|
25
25
|
display: none;
|
|
26
26
|
}
|
package/dist/index.js
CHANGED
|
@@ -4,10 +4,12 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
var Component = require('./Component.js');
|
|
6
6
|
require('react');
|
|
7
|
-
require('@alfalab/core-components-
|
|
8
|
-
require('
|
|
7
|
+
require('@alfalab/core-components-input');
|
|
8
|
+
require('react-merge-refs');
|
|
9
|
+
require('date-fns/parse');
|
|
10
|
+
require('date-fns/format');
|
|
11
|
+
require('date-fns/isValid');
|
|
9
12
|
var utils_format = require('./utils/format.js');
|
|
10
|
-
var utils_dateCorrectionPipe = require('./utils/date-correction-pipe.js');
|
|
11
13
|
var utils_nativeSupports = require('./utils/native-supports.js');
|
|
12
14
|
|
|
13
15
|
|
|
@@ -16,11 +18,9 @@ exports.DateInput = Component.DateInput;
|
|
|
16
18
|
exports.DATE_FORMAT = utils_format.DATE_FORMAT;
|
|
17
19
|
exports.DATE_MASK = utils_format.DATE_MASK;
|
|
18
20
|
exports.NATIVE_DATE_FORMAT = utils_format.NATIVE_DATE_FORMAT;
|
|
21
|
+
exports.format = utils_format.format;
|
|
19
22
|
exports.formatDate = utils_format.formatDate;
|
|
20
23
|
exports.isCompleteDateInput = utils_format.isCompleteDateInput;
|
|
24
|
+
exports.isValid = utils_format.isValid;
|
|
21
25
|
exports.parseDateString = utils_format.parseDateString;
|
|
22
|
-
exports.createAutoCorrectedDatePipe = utils_dateCorrectionPipe.createAutoCorrectedDatePipe;
|
|
23
|
-
exports.mask = utils_dateCorrectionPipe.mask;
|
|
24
|
-
exports.IS_BROWSER = utils_nativeSupports.IS_BROWSER;
|
|
25
|
-
exports.SUPPORTS_INPUT_TYPE_DATE = utils_nativeSupports.SUPPORTS_INPUT_TYPE_DATE;
|
|
26
26
|
exports.isInputDateSupported = utils_nativeSupports.isInputDateSupported;
|
|
@@ -1,16 +1,8 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { ChangeEvent } from "react";
|
|
4
|
-
import {
|
|
5
|
-
type DateInputProps = Omit<
|
|
6
|
-
/**
|
|
7
|
-
* Минимальный год, доступный для ввода
|
|
8
|
-
*/
|
|
9
|
-
minYear?: number;
|
|
10
|
-
/**
|
|
11
|
-
* Максимальный год, доступный для ввода
|
|
12
|
-
*/
|
|
13
|
-
maxYear?: number;
|
|
4
|
+
import { InputProps } from "@alfalab/core-components-input";
|
|
5
|
+
type DateInputProps = Omit<InputProps, 'onChange'> & {
|
|
14
6
|
/**
|
|
15
7
|
* Управление нативным режимом на мобильных устройствах
|
|
16
8
|
*/
|
|
@@ -22,16 +14,15 @@ type DateInputProps = Omit<MaskedInputProps, 'onBeforeDisplay' | 'mask' | 'onCha
|
|
|
22
14
|
date: Date;
|
|
23
15
|
value: string;
|
|
24
16
|
}) => void;
|
|
25
|
-
};
|
|
26
|
-
declare const DateInput: React.ForwardRefExoticComponent<Pick<MaskedInputProps, "className" | "dataTestId" | "form" | "label" | "slot" | "style" | "title" | "pattern" | "children" | "leftAddons" | "rightAddons" | "size" | "block" | "colors" | "type" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "id" | "lang" | "placeholder" | "spellCheck" | "tabIndex" | "translate" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "color" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "list" | "step" | "autoFocus" | "disabled" | "formAction" | "formEncType" | "formMethod" | "formNoValidate" | "formTarget" | "name" | "value" | "fieldClassName" | "labelClassName" | "addonsClassName" | "error" | "hint" | "bottomAddons" | "accept" | "alt" | "autoComplete" | "capture" | "checked" | "crossOrigin" | "height" | "max" | "maxLength" | "min" | "minLength" | "multiple" | "readOnly" | "required" | "src" | "width" | "clear" | "success" | "inputClassName" | "focusedClassName" | "filledClassName" | "onClear" | "wrapperRef" | "keepCharPositions"> & {
|
|
27
|
-
/**
|
|
28
|
-
* Минимальный год, доступный для ввода
|
|
29
|
-
*/
|
|
30
|
-
minYear?: number | undefined;
|
|
31
17
|
/**
|
|
32
|
-
*
|
|
18
|
+
* Обработчик окончания ввода
|
|
33
19
|
*/
|
|
34
|
-
|
|
20
|
+
onComplete?: (event: ChangeEvent<HTMLInputElement>, payload: {
|
|
21
|
+
date: Date;
|
|
22
|
+
value: string;
|
|
23
|
+
}) => void;
|
|
24
|
+
};
|
|
25
|
+
declare const DateInput: React.ForwardRefExoticComponent<Pick<InputProps, "className" | "dataTestId" | "form" | "label" | "slot" | "style" | "title" | "pattern" | "children" | "leftAddons" | "rightAddons" | "size" | "block" | "colors" | "type" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "id" | "lang" | "placeholder" | "spellCheck" | "tabIndex" | "translate" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "color" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "list" | "step" | "autoFocus" | "disabled" | "formAction" | "formEncType" | "formMethod" | "formNoValidate" | "formTarget" | "name" | "value" | "fieldClassName" | "labelClassName" | "addonsClassName" | "error" | "hint" | "bottomAddons" | "accept" | "alt" | "autoComplete" | "capture" | "checked" | "crossOrigin" | "height" | "max" | "maxLength" | "min" | "minLength" | "multiple" | "readOnly" | "required" | "src" | "width" | "clear" | "success" | "inputClassName" | "focusedClassName" | "filledClassName" | "onClear" | "wrapperRef"> & {
|
|
35
26
|
/**
|
|
36
27
|
* Управление нативным режимом на мобильных устройствах
|
|
37
28
|
*/
|
|
@@ -43,5 +34,12 @@ declare const DateInput: React.ForwardRefExoticComponent<Pick<MaskedInputProps,
|
|
|
43
34
|
date: Date;
|
|
44
35
|
value: string;
|
|
45
36
|
}) => void) | undefined;
|
|
37
|
+
/**
|
|
38
|
+
* Обработчик окончания ввода
|
|
39
|
+
*/
|
|
40
|
+
onComplete?: ((event: React.ChangeEvent<HTMLInputElement>, payload: {
|
|
41
|
+
date: Date;
|
|
42
|
+
value: string;
|
|
43
|
+
}) => void) | undefined;
|
|
46
44
|
} & React.RefAttributes<HTMLInputElement>>;
|
|
47
45
|
export { DateInputProps, DateInput };
|