@alfalab/core-components-date-input 4.4.16 → 4.4.17-snapshot-1393ffa
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/Component.js +12 -13
- package/Component.js.map +1 -0
- package/cssm/Component.js +12 -11
- package/cssm/Component.js.map +1 -0
- package/cssm/index.js +12 -11
- package/cssm/index.js.map +1 -0
- package/cssm/index.module.css +5 -24
- package/{Component.d.ts → cssm/src/Component.d.ts} +4 -7
- package/cssm/src/index.d.ts +2 -0
- package/cssm/src/utils/format.d.ts +8 -0
- package/cssm/src/utils/index.d.ts +2 -0
- package/cssm/{utils → src/utils}/native-supports.d.ts +1 -2
- package/cssm/utils/format.js +1 -0
- package/cssm/utils/format.js.map +1 -0
- package/cssm/utils/index.js +12 -11
- package/cssm/utils/index.js.map +1 -0
- package/cssm/utils/native-supports.js +1 -0
- package/cssm/utils/native-supports.js.map +1 -0
- package/esm/Component.js +3 -4
- package/esm/Component.js.map +1 -0
- package/esm/index.css +7 -27
- package/esm/index.js +1 -0
- package/esm/index.js.map +1 -0
- package/esm/index.module.css.js +6 -0
- package/esm/index.module.css.js.map +1 -0
- package/{cssm → esm/src}/Component.d.ts +4 -7
- package/esm/src/index.d.ts +2 -0
- package/esm/src/utils/format.d.ts +8 -0
- package/esm/src/utils/index.d.ts +2 -0
- package/esm/{utils → src/utils}/native-supports.d.ts +1 -2
- package/esm/utils/format.js +1 -0
- package/esm/utils/format.js.map +1 -0
- package/esm/utils/index.js +1 -0
- package/esm/utils/index.js.map +1 -0
- package/esm/utils/native-supports.js +1 -0
- package/esm/utils/native-supports.js.map +1 -0
- package/index.css +7 -27
- package/index.js +12 -11
- package/index.js.map +1 -0
- package/index.module.css.js +8 -0
- package/index.module.css.js.map +1 -0
- package/modern/Component.js +3 -4
- package/modern/Component.js.map +1 -0
- package/modern/index.css +7 -27
- package/modern/index.js +1 -0
- package/modern/index.js.map +1 -0
- package/modern/index.module.css.js +6 -0
- package/modern/index.module.css.js.map +1 -0
- package/{esm → modern/src}/Component.d.ts +4 -7
- package/modern/src/index.d.ts +2 -0
- package/modern/src/utils/format.d.ts +8 -0
- package/modern/src/utils/index.d.ts +2 -0
- package/modern/{utils → src/utils}/native-supports.d.ts +1 -2
- package/modern/utils/format.js +1 -0
- package/modern/utils/format.js.map +1 -0
- package/modern/utils/index.js +1 -0
- package/modern/utils/index.js.map +1 -0
- package/modern/utils/native-supports.js +1 -0
- package/modern/utils/native-supports.js.map +1 -0
- package/moderncssm/Component.js +2 -1
- package/moderncssm/Component.js.map +1 -0
- package/moderncssm/index.js +1 -0
- package/moderncssm/index.js.map +1 -0
- package/moderncssm/index.module.css +3 -3
- package/{modern → moderncssm/src}/Component.d.ts +4 -7
- package/moderncssm/src/index.d.ts +2 -0
- package/moderncssm/src/utils/format.d.ts +8 -0
- package/moderncssm/src/utils/index.d.ts +2 -0
- package/moderncssm/{utils → src/utils}/native-supports.d.ts +1 -2
- package/moderncssm/utils/format.js +1 -0
- package/moderncssm/utils/format.js.map +1 -0
- package/moderncssm/utils/index.js +1 -0
- package/moderncssm/utils/index.js.map +1 -0
- package/moderncssm/utils/native-supports.js +1 -0
- package/moderncssm/utils/native-supports.js.map +1 -0
- package/package.json +4 -4
- package/src/Component.d.ts +46 -0
- package/src/index.d.ts +2 -0
- package/src/utils/format.d.ts +8 -0
- package/src/utils/index.d.ts +2 -0
- package/src/utils/native-supports.d.ts +4 -0
- package/utils/format.js +1 -0
- package/utils/format.js.map +1 -0
- package/utils/index.js +12 -11
- package/utils/index.js.map +1 -0
- package/utils/native-supports.js +1 -0
- package/utils/native-supports.js.map +1 -0
- package/cssm/index.d.ts +0 -2
- package/cssm/utils/format.d.ts +0 -9
- package/cssm/utils/index.d.ts +0 -2
- package/esm/index.d.ts +0 -2
- package/esm/utils/format.d.ts +0 -9
- package/esm/utils/index.d.ts +0 -2
- package/index.d.ts +0 -2
- package/modern/index.d.ts +0 -2
- package/modern/utils/format.d.ts +0 -9
- package/modern/utils/index.d.ts +0 -2
- package/moderncssm/Component.d.ts +0 -49
- package/moderncssm/index.d.ts +0 -2
- package/moderncssm/utils/format.d.ts +0 -9
- package/moderncssm/utils/index.d.ts +0 -2
- package/utils/format.d.ts +0 -9
- package/utils/index.d.ts +0 -2
- package/utils/native-supports.d.ts +0 -5
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"format.js","sources":["../../../src/utils/format.ts"],"sourcesContent":["import dateFnsFormat from 'date-fns/format';\nimport dateFnsIsValid from 'date-fns/isValid';\nimport parse from 'date-fns/parse';\n\nexport const DATE_FORMAT = 'dd.MM.yyyy';\nexport const NATIVE_DATE_FORMAT = 'yyyy-MM-dd';\nexport const DATE_MASK = [/\\d/, /\\d/, '.', /\\d/, /\\d/, '.', /\\d/, /\\d/, /\\d/, /\\d/];\n\nexport const isCompleteDateInput = (input: string) => input.length === DATE_MASK.length;\n\nexport const formatDate = (date: Date | number, dateFormat = DATE_FORMAT) =>\n dateFnsFormat(date, dateFormat);\n\nexport const parseDateString = (value: string, dateFormat = DATE_FORMAT) =>\n parse(value, dateFormat, new Date());\n\nexport const isValid = (inputValue?: string) =>\n !inputValue || (isCompleteDateInput(inputValue) && dateFnsIsValid(parseDateString(inputValue)));\n\nexport const format = (value: string): string =>\n value\n .replace(/^(\\d\\d)(\\d)$/, '$1.$2') // 121 => 12.1\n .replace(/^(\\d\\d)\\.(\\d\\d)(\\d)$/, '$1.$2.$3') // 12.122 => 12.12.2\n .replace(/^(\\d\\d)\\d\\.(.*)/, '$1.$2') // 123.12.2005 => 12.12.2005\n .replace(/^(\\d\\d\\.\\d\\d)\\d\\.(.*)/, '$1.$2') // 12.123.2005 => 12.12.2005\n .replace(/^(\\d\\d\\.\\d\\d\\.\\d\\d\\d\\d).*/, '$1') // 12.12.20056 => 12.12.2005\n .replace(/\\.$/, '') // 12. => 12\n .replace(/^(\\d\\d\\.\\d\\d)(\\d\\d\\d\\d)/, '$1.$2') // 12.122005 => 12.12.2005\n .replace(/^(\\d\\d)(\\d\\d\\.\\d\\d\\d\\d)/, '$1.$2') // 1212.2005 => 12.12.2005\n .replace(/^(\\d\\.\\d\\d\\.\\d\\d\\d\\d)([0-9]*)/, '$1') // 1.12.2005123123 => 01.12.2005\n .replace(/^(\\d\\d\\.\\d\\.\\d\\d\\d\\d)([0-9]*)/, '$1') // 01.2.20055125125 => 01.2.2005\n .replace(/^(\\d\\.\\d\\.\\d\\d\\d\\d)([0-9]*)/, '$1') // 1.2.20055125125 => 1.2.2005\n .replace(/^(\\d)\\.(\\d\\d)([0-9]*)\\.(\\d\\d\\d\\d)/, '$1.$2.$4') // 1.123123.2005 => 1.12.2005\n .replace(/^(\\d\\d)\\.()\\.(\\d\\d\\d\\d)([0-9]*)/, '$1.$2.$3') // 01..2005123123 => 01..2005\n .replace(/^(\\d)\\.()\\.(\\d\\d\\d\\d)([0-9]*)/, '$1.$2.$3') // 1..2005123123 => 1..2005\n .replace(/^()\\.()\\.(\\d\\d\\d\\d)([0-9]*)/, '$1.$2.$3') // ..2005123123 => ..2005\n .replace(/^()\\.(\\d)\\.(\\d\\d\\d\\d)([0-9]*)/, '$1.$2.$3'); // .2.2005123123 => .2.2005\n"],"names":[],"mappings":";;;;AAIO,MAAM,WAAW,GAAG;AACpB,MAAM,kBAAkB,GAAG;AACrB,MAAA,SAAS,GAAG,CAAC,IAAI,EAAE,IAAI,EAAE,GAAG,EAAE,IAAI,EAAE,IAAI,EAAE,GAAG,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI;AAErE,MAAA,mBAAmB,GAAG,CAAC,KAAa,KAAK,KAAK,CAAC,MAAM,KAAK,SAAS,CAAC;AAEpE,MAAA,UAAU,GAAG,CAAC,IAAmB,EAAE,UAAU,GAAG,WAAW,KACpE,aAAa,CAAC,IAAI,EAAE,UAAU;MAErB,eAAe,GAAG,CAAC,KAAa,EAAE,UAAU,GAAG,WAAW,KACnE,KAAK,CAAC,KAAK,EAAE,UAAU,EAAE,IAAI,IAAI,EAAE;AAE1B,MAAA,OAAO,GAAG,CAAC,UAAmB,KACvC,CAAC,UAAU,KAAK,mBAAmB,CAAC,UAAU,CAAC,IAAI,cAAc,CAAC,eAAe,CAAC,UAAU,CAAC,CAAC;MAErF,MAAM,GAAG,CAAC,KAAa,KAChC;AACK,KAAA,OAAO,CAAC,cAAc,EAAE,OAAO,CAAC;AAChC,KAAA,OAAO,CAAC,sBAAsB,EAAE,UAAU,CAAC;AAC3C,KAAA,OAAO,CAAC,iBAAiB,EAAE,OAAO,CAAC;AACnC,KAAA,OAAO,CAAC,uBAAuB,EAAE,OAAO,CAAC;AACzC,KAAA,OAAO,CAAC,2BAA2B,EAAE,IAAI,CAAC;AAC1C,KAAA,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC;AAClB,KAAA,OAAO,CAAC,yBAAyB,EAAE,OAAO,CAAC;AAC3C,KAAA,OAAO,CAAC,yBAAyB,EAAE,OAAO,CAAC;AAC3C,KAAA,OAAO,CAAC,+BAA+B,EAAE,IAAI,CAAC;AAC9C,KAAA,OAAO,CAAC,+BAA+B,EAAE,IAAI,CAAC;AAC9C,KAAA,OAAO,CAAC,6BAA6B,EAAE,IAAI,CAAC;AAC5C,KAAA,OAAO,CAAC,mCAAmC,EAAE,UAAU,CAAC;AACxD,KAAA,OAAO,CAAC,iCAAiC,EAAE,UAAU,CAAC;AACtD,KAAA,OAAO,CAAC,+BAA+B,EAAE,UAAU,CAAC;AACpD,KAAA,OAAO,CAAC,6BAA6B,EAAE,UAAU,CAAC;AAClD,KAAA,OAAO,CAAC,+BAA+B,EAAE,UAAU,EAAE;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"native-supports.js","sources":["../../../src/utils/native-supports.ts"],"sourcesContent":["/**\n * Возвращает `true`, если поддерживается `input[type=\"date\"]`\n */\nexport function isInputDateSupported() {\n const input = document.createElement('input');\n const value = 'a';\n\n input.setAttribute('type', 'date');\n input.setAttribute('value', value);\n\n return input.value !== value;\n}\n"],"names":[],"mappings":"AAAA;;AAEG;SACa,oBAAoB,GAAA;IAChC,MAAM,KAAK,GAAG,QAAQ,CAAC,aAAa,CAAC,OAAO,CAAC;IAC7C,MAAM,KAAK,GAAG,GAAG;AAEjB,IAAA,KAAK,CAAC,YAAY,CAAC,MAAM,EAAE,MAAM,CAAC;AAClC,IAAA,KAAK,CAAC,YAAY,CAAC,OAAO,EAAE,KAAK,CAAC;AAElC,IAAA,OAAO,KAAK,CAAC,KAAK,KAAK,KAAK;AAChC;;;;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@alfalab/core-components-date-input",
|
|
3
|
-
"version": "4.4.
|
|
3
|
+
"version": "4.4.17-snapshot-1393ffa",
|
|
4
4
|
"description": "",
|
|
5
5
|
"keywords": [],
|
|
6
6
|
"license": "MIT",
|
|
@@ -15,11 +15,11 @@
|
|
|
15
15
|
"react": "^16.9.0 || ^17.0.1 || ^18.0.0"
|
|
16
16
|
},
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"@alfalab/core-components-input": "
|
|
18
|
+
"@alfalab/core-components-input": "15.5.5-snapshot-1393ffa",
|
|
19
19
|
"date-fns": "^2.16.1",
|
|
20
20
|
"react-merge-refs": "^1.1.0",
|
|
21
21
|
"tslib": "^2.4.0"
|
|
22
22
|
},
|
|
23
|
-
"themesVersion": "
|
|
24
|
-
"varsVersion": "9.
|
|
23
|
+
"themesVersion": "14.0.0-snapshot-1393ffa",
|
|
24
|
+
"varsVersion": "9.20.1-snapshot-1393ffa"
|
|
25
25
|
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import React, { ChangeEvent } from 'react';
|
|
2
|
+
import { InputProps } from '@alfalab/core-components-input';
|
|
3
|
+
export declare type DateInputProps = Omit<InputProps, 'onChange'> & {
|
|
4
|
+
/**
|
|
5
|
+
* Управление нативным режимом на мобильных устройствах
|
|
6
|
+
*/
|
|
7
|
+
mobileMode?: 'input' | 'native';
|
|
8
|
+
/**
|
|
9
|
+
* Обработчик изменения значения
|
|
10
|
+
*/
|
|
11
|
+
onChange?: (event: ChangeEvent<HTMLInputElement>, payload: {
|
|
12
|
+
date: Date;
|
|
13
|
+
value: string;
|
|
14
|
+
}) => void;
|
|
15
|
+
/**
|
|
16
|
+
* Обработчик окончания ввода
|
|
17
|
+
*/
|
|
18
|
+
onComplete?: (event: ChangeEvent<HTMLInputElement>, payload: {
|
|
19
|
+
date: Date;
|
|
20
|
+
value: string;
|
|
21
|
+
}) => void;
|
|
22
|
+
};
|
|
23
|
+
/**
|
|
24
|
+
* @deprecated
|
|
25
|
+
* use UniversalDateInput instead
|
|
26
|
+
*/
|
|
27
|
+
export declare const DateInput: React.ForwardRefExoticComponent<Omit<InputProps, "onChange"> & {
|
|
28
|
+
/**
|
|
29
|
+
* Управление нативным режимом на мобильных устройствах
|
|
30
|
+
*/
|
|
31
|
+
mobileMode?: "input" | "native" | undefined;
|
|
32
|
+
/**
|
|
33
|
+
* Обработчик изменения значения
|
|
34
|
+
*/
|
|
35
|
+
onChange?: ((event: ChangeEvent<HTMLInputElement>, payload: {
|
|
36
|
+
date: Date;
|
|
37
|
+
value: string;
|
|
38
|
+
}) => void) | undefined;
|
|
39
|
+
/**
|
|
40
|
+
* Обработчик окончания ввода
|
|
41
|
+
*/
|
|
42
|
+
onComplete?: ((event: ChangeEvent<HTMLInputElement>, payload: {
|
|
43
|
+
date: Date;
|
|
44
|
+
value: string;
|
|
45
|
+
}) => void) | undefined;
|
|
46
|
+
} & React.RefAttributes<HTMLInputElement>>;
|
package/src/index.d.ts
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export declare const DATE_FORMAT = "dd.MM.yyyy";
|
|
2
|
+
export declare const NATIVE_DATE_FORMAT = "yyyy-MM-dd";
|
|
3
|
+
export declare const DATE_MASK: (string | RegExp)[];
|
|
4
|
+
export declare const isCompleteDateInput: (input: string) => boolean;
|
|
5
|
+
export declare const formatDate: (date: Date | number, dateFormat?: string) => string;
|
|
6
|
+
export declare const parseDateString: (value: string, dateFormat?: string) => Date;
|
|
7
|
+
export declare const isValid: (inputValue?: string) => boolean;
|
|
8
|
+
export declare const format: (value: string) => string;
|
package/utils/format.js
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"format.js","sources":["../../src/utils/format.ts"],"sourcesContent":["import dateFnsFormat from 'date-fns/format';\nimport dateFnsIsValid from 'date-fns/isValid';\nimport parse from 'date-fns/parse';\n\nexport const DATE_FORMAT = 'dd.MM.yyyy';\nexport const NATIVE_DATE_FORMAT = 'yyyy-MM-dd';\nexport const DATE_MASK = [/\\d/, /\\d/, '.', /\\d/, /\\d/, '.', /\\d/, /\\d/, /\\d/, /\\d/];\n\nexport const isCompleteDateInput = (input: string) => input.length === DATE_MASK.length;\n\nexport const formatDate = (date: Date | number, dateFormat = DATE_FORMAT) =>\n dateFnsFormat(date, dateFormat);\n\nexport const parseDateString = (value: string, dateFormat = DATE_FORMAT) =>\n parse(value, dateFormat, new Date());\n\nexport const isValid = (inputValue?: string) =>\n !inputValue || (isCompleteDateInput(inputValue) && dateFnsIsValid(parseDateString(inputValue)));\n\nexport const format = (value: string): string =>\n value\n .replace(/^(\\d\\d)(\\d)$/, '$1.$2') // 121 => 12.1\n .replace(/^(\\d\\d)\\.(\\d\\d)(\\d)$/, '$1.$2.$3') // 12.122 => 12.12.2\n .replace(/^(\\d\\d)\\d\\.(.*)/, '$1.$2') // 123.12.2005 => 12.12.2005\n .replace(/^(\\d\\d\\.\\d\\d)\\d\\.(.*)/, '$1.$2') // 12.123.2005 => 12.12.2005\n .replace(/^(\\d\\d\\.\\d\\d\\.\\d\\d\\d\\d).*/, '$1') // 12.12.20056 => 12.12.2005\n .replace(/\\.$/, '') // 12. => 12\n .replace(/^(\\d\\d\\.\\d\\d)(\\d\\d\\d\\d)/, '$1.$2') // 12.122005 => 12.12.2005\n .replace(/^(\\d\\d)(\\d\\d\\.\\d\\d\\d\\d)/, '$1.$2') // 1212.2005 => 12.12.2005\n .replace(/^(\\d\\.\\d\\d\\.\\d\\d\\d\\d)([0-9]*)/, '$1') // 1.12.2005123123 => 01.12.2005\n .replace(/^(\\d\\d\\.\\d\\.\\d\\d\\d\\d)([0-9]*)/, '$1') // 01.2.20055125125 => 01.2.2005\n .replace(/^(\\d\\.\\d\\.\\d\\d\\d\\d)([0-9]*)/, '$1') // 1.2.20055125125 => 1.2.2005\n .replace(/^(\\d)\\.(\\d\\d)([0-9]*)\\.(\\d\\d\\d\\d)/, '$1.$2.$4') // 1.123123.2005 => 1.12.2005\n .replace(/^(\\d\\d)\\.()\\.(\\d\\d\\d\\d)([0-9]*)/, '$1.$2.$3') // 01..2005123123 => 01..2005\n .replace(/^(\\d)\\.()\\.(\\d\\d\\d\\d)([0-9]*)/, '$1.$2.$3') // 1..2005123123 => 1..2005\n .replace(/^()\\.()\\.(\\d\\d\\d\\d)([0-9]*)/, '$1.$2.$3') // ..2005123123 => ..2005\n .replace(/^()\\.(\\d)\\.(\\d\\d\\d\\d)([0-9]*)/, '$1.$2.$3'); // .2.2005123123 => .2.2005\n"],"names":["dateFnsFormat","parse","dateFnsIsValid"],"mappings":";;;;;;;;;;;;;;AAIO,IAAM,WAAW,GAAG;AACpB,IAAM,kBAAkB,GAAG;AACrB,IAAA,SAAS,GAAG,CAAC,IAAI,EAAE,IAAI,EAAE,GAAG,EAAE,IAAI,EAAE,IAAI,EAAE,GAAG,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI;AAErE,IAAA,mBAAmB,GAAG,UAAC,KAAa,EAAK,EAAA,OAAA,KAAK,CAAC,MAAM,KAAK,SAAS,CAAC,MAAM,CAAA;AAE1E,IAAA,UAAU,GAAG,UAAC,IAAmB,EAAE,UAAwB,EAAA;AAAxB,IAAA,IAAA,UAAA,KAAA,MAAA,EAAA,EAAA,UAAwB,GAAA,WAAA,CAAA;AACpE,IAAA,OAAAA,8BAAa,CAAC,IAAI,EAAE,UAAU,CAAC;AAA/B;AAES,IAAA,eAAe,GAAG,UAAC,KAAa,EAAE,UAAwB,EAAA;AAAxB,IAAA,IAAA,UAAA,KAAA,MAAA,EAAA,EAAA,UAAwB,GAAA,WAAA,CAAA;IACnE,OAAAC,sBAAK,CAAC,KAAK,EAAE,UAAU,EAAE,IAAI,IAAI,EAAE,CAAC;AAApC;AAEG,IAAM,OAAO,GAAG,UAAC,UAAmB,EAAA;AACvC,IAAA,OAAA,CAAC,UAAU,KAAK,mBAAmB,CAAC,UAAU,CAAC,IAAIC,+BAAc,CAAC,eAAe,CAAC,UAAU,CAAC,CAAC,CAAC;AAA/F;AAEG,IAAM,MAAM,GAAG,UAAC,KAAa,EAAA;AAChC,IAAA,OAAA;AACK,SAAA,OAAO,CAAC,cAAc,EAAE,OAAO,CAAC;AAChC,SAAA,OAAO,CAAC,sBAAsB,EAAE,UAAU,CAAC;AAC3C,SAAA,OAAO,CAAC,iBAAiB,EAAE,OAAO,CAAC;AACnC,SAAA,OAAO,CAAC,uBAAuB,EAAE,OAAO,CAAC;AACzC,SAAA,OAAO,CAAC,2BAA2B,EAAE,IAAI,CAAC;AAC1C,SAAA,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC;AAClB,SAAA,OAAO,CAAC,yBAAyB,EAAE,OAAO,CAAC;AAC3C,SAAA,OAAO,CAAC,yBAAyB,EAAE,OAAO,CAAC;AAC3C,SAAA,OAAO,CAAC,+BAA+B,EAAE,IAAI,CAAC;AAC9C,SAAA,OAAO,CAAC,+BAA+B,EAAE,IAAI,CAAC;AAC9C,SAAA,OAAO,CAAC,6BAA6B,EAAE,IAAI,CAAC;AAC5C,SAAA,OAAO,CAAC,mCAAmC,EAAE,UAAU,CAAC;AACxD,SAAA,OAAO,CAAC,iCAAiC,EAAE,UAAU,CAAC;AACtD,SAAA,OAAO,CAAC,+BAA+B,EAAE,UAAU,CAAC;AACpD,SAAA,OAAO,CAAC,6BAA6B,EAAE,UAAU,CAAC;AAClD,SAAA,OAAO,CAAC,+BAA+B,EAAE,UAAU,CAAC;AAhBzD,EAgB0D;;;;;;;;;;;"}
|
package/utils/index.js
CHANGED
|
@@ -2,17 +2,18 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var
|
|
6
|
-
var
|
|
5
|
+
var format = require('./format.js');
|
|
6
|
+
var nativeSupports = require('./native-supports.js');
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
|
|
10
|
-
exports.DATE_FORMAT =
|
|
11
|
-
exports.DATE_MASK =
|
|
12
|
-
exports.NATIVE_DATE_FORMAT =
|
|
13
|
-
exports.format =
|
|
14
|
-
exports.formatDate =
|
|
15
|
-
exports.isCompleteDateInput =
|
|
16
|
-
exports.isValid =
|
|
17
|
-
exports.parseDateString =
|
|
18
|
-
exports.isInputDateSupported =
|
|
10
|
+
exports.DATE_FORMAT = format.DATE_FORMAT;
|
|
11
|
+
exports.DATE_MASK = format.DATE_MASK;
|
|
12
|
+
exports.NATIVE_DATE_FORMAT = format.NATIVE_DATE_FORMAT;
|
|
13
|
+
exports.format = format.format;
|
|
14
|
+
exports.formatDate = format.formatDate;
|
|
15
|
+
exports.isCompleteDateInput = format.isCompleteDateInput;
|
|
16
|
+
exports.isValid = format.isValid;
|
|
17
|
+
exports.parseDateString = format.parseDateString;
|
|
18
|
+
exports.isInputDateSupported = nativeSupports.isInputDateSupported;
|
|
19
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;"}
|
package/utils/native-supports.js
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"native-supports.js","sources":["../../src/utils/native-supports.ts"],"sourcesContent":["/**\n * Возвращает `true`, если поддерживается `input[type=\"date\"]`\n */\nexport function isInputDateSupported() {\n const input = document.createElement('input');\n const value = 'a';\n\n input.setAttribute('type', 'date');\n input.setAttribute('value', value);\n\n return input.value !== value;\n}\n"],"names":[],"mappings":";;;;AAAA;;AAEG;SACa,oBAAoB,GAAA;IAChC,IAAM,KAAK,GAAG,QAAQ,CAAC,aAAa,CAAC,OAAO,CAAC;IAC7C,IAAM,KAAK,GAAG,GAAG;AAEjB,IAAA,KAAK,CAAC,YAAY,CAAC,MAAM,EAAE,MAAM,CAAC;AAClC,IAAA,KAAK,CAAC,YAAY,CAAC,OAAO,EAAE,KAAK,CAAC;AAElC,IAAA,OAAO,KAAK,CAAC,KAAK,KAAK,KAAK;AAChC;;;;"}
|
package/cssm/index.d.ts
DELETED
package/cssm/utils/format.d.ts
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
declare const DATE_FORMAT = "dd.MM.yyyy";
|
|
2
|
-
declare const NATIVE_DATE_FORMAT = "yyyy-MM-dd";
|
|
3
|
-
declare const DATE_MASK: (string | RegExp)[];
|
|
4
|
-
declare const isCompleteDateInput: (input: string) => boolean;
|
|
5
|
-
declare const formatDate: (date: Date | number, dateFormat?: string) => string;
|
|
6
|
-
declare const parseDateString: (value: string, dateFormat?: string) => Date;
|
|
7
|
-
declare const isValid: (inputValue?: string) => boolean;
|
|
8
|
-
declare const format: (value: string) => string;
|
|
9
|
-
export { DATE_FORMAT, NATIVE_DATE_FORMAT, DATE_MASK, isCompleteDateInput, formatDate, parseDateString, isValid, format };
|
package/cssm/utils/index.d.ts
DELETED
package/esm/index.d.ts
DELETED
package/esm/utils/format.d.ts
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
declare const DATE_FORMAT = "dd.MM.yyyy";
|
|
2
|
-
declare const NATIVE_DATE_FORMAT = "yyyy-MM-dd";
|
|
3
|
-
declare const DATE_MASK: (string | RegExp)[];
|
|
4
|
-
declare const isCompleteDateInput: (input: string) => boolean;
|
|
5
|
-
declare const formatDate: (date: Date | number, dateFormat?: string) => string;
|
|
6
|
-
declare const parseDateString: (value: string, dateFormat?: string) => Date;
|
|
7
|
-
declare const isValid: (inputValue?: string) => boolean;
|
|
8
|
-
declare const format: (value: string) => string;
|
|
9
|
-
export { DATE_FORMAT, NATIVE_DATE_FORMAT, DATE_MASK, isCompleteDateInput, formatDate, parseDateString, isValid, format };
|
package/esm/utils/index.d.ts
DELETED
package/index.d.ts
DELETED
package/modern/index.d.ts
DELETED
package/modern/utils/format.d.ts
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
declare const DATE_FORMAT = "dd.MM.yyyy";
|
|
2
|
-
declare const NATIVE_DATE_FORMAT = "yyyy-MM-dd";
|
|
3
|
-
declare const DATE_MASK: (string | RegExp)[];
|
|
4
|
-
declare const isCompleteDateInput: (input: string) => boolean;
|
|
5
|
-
declare const formatDate: (date: Date | number, dateFormat?: string) => string;
|
|
6
|
-
declare const parseDateString: (value: string, dateFormat?: string) => Date;
|
|
7
|
-
declare const isValid: (inputValue?: string) => boolean;
|
|
8
|
-
declare const format: (value: string) => string;
|
|
9
|
-
export { DATE_FORMAT, NATIVE_DATE_FORMAT, DATE_MASK, isCompleteDateInput, formatDate, parseDateString, isValid, format };
|
package/modern/utils/index.d.ts
DELETED
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
|
-
import React from 'react';
|
|
3
|
-
import { ChangeEvent } from "react";
|
|
4
|
-
import { InputProps } from "@alfalab/core-components-input";
|
|
5
|
-
type DateInputProps = Omit<InputProps, 'onChange'> & {
|
|
6
|
-
/**
|
|
7
|
-
* Управление нативным режимом на мобильных устройствах
|
|
8
|
-
*/
|
|
9
|
-
mobileMode?: 'input' | 'native';
|
|
10
|
-
/**
|
|
11
|
-
* Обработчик изменения значения
|
|
12
|
-
*/
|
|
13
|
-
onChange?: (event: ChangeEvent<HTMLInputElement>, payload: {
|
|
14
|
-
date: Date;
|
|
15
|
-
value: string;
|
|
16
|
-
}) => void;
|
|
17
|
-
/**
|
|
18
|
-
* Обработчик окончания ввода
|
|
19
|
-
*/
|
|
20
|
-
onComplete?: (event: ChangeEvent<HTMLInputElement>, payload: {
|
|
21
|
-
date: Date;
|
|
22
|
-
value: string;
|
|
23
|
-
}) => void;
|
|
24
|
-
};
|
|
25
|
-
/**
|
|
26
|
-
* @deprecated
|
|
27
|
-
* use UniversalDateInput instead
|
|
28
|
-
*/
|
|
29
|
-
declare const DateInput: React.ForwardRefExoticComponent<Omit<InputProps, "onChange"> & {
|
|
30
|
-
/**
|
|
31
|
-
* Управление нативным режимом на мобильных устройствах
|
|
32
|
-
*/
|
|
33
|
-
mobileMode?: "input" | "native" | undefined;
|
|
34
|
-
/**
|
|
35
|
-
* Обработчик изменения значения
|
|
36
|
-
*/
|
|
37
|
-
onChange?: ((event: ChangeEvent<HTMLInputElement>, payload: {
|
|
38
|
-
date: Date;
|
|
39
|
-
value: string;
|
|
40
|
-
}) => void) | undefined;
|
|
41
|
-
/**
|
|
42
|
-
* Обработчик окончания ввода
|
|
43
|
-
*/
|
|
44
|
-
onComplete?: ((event: ChangeEvent<HTMLInputElement>, payload: {
|
|
45
|
-
date: Date;
|
|
46
|
-
value: string;
|
|
47
|
-
}) => void) | undefined;
|
|
48
|
-
} & React.RefAttributes<HTMLInputElement>>;
|
|
49
|
-
export { DateInputProps, DateInput };
|
package/moderncssm/index.d.ts
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
declare const DATE_FORMAT = "dd.MM.yyyy";
|
|
2
|
-
declare const NATIVE_DATE_FORMAT = "yyyy-MM-dd";
|
|
3
|
-
declare const DATE_MASK: (string | RegExp)[];
|
|
4
|
-
declare const isCompleteDateInput: (input: string) => boolean;
|
|
5
|
-
declare const formatDate: (date: Date | number, dateFormat?: string) => string;
|
|
6
|
-
declare const parseDateString: (value: string, dateFormat?: string) => Date;
|
|
7
|
-
declare const isValid: (inputValue?: string) => boolean;
|
|
8
|
-
declare const format: (value: string) => string;
|
|
9
|
-
export { DATE_FORMAT, NATIVE_DATE_FORMAT, DATE_MASK, isCompleteDateInput, formatDate, parseDateString, isValid, format };
|
package/utils/format.d.ts
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
declare const DATE_FORMAT = "dd.MM.yyyy";
|
|
2
|
-
declare const NATIVE_DATE_FORMAT = "yyyy-MM-dd";
|
|
3
|
-
declare const DATE_MASK: (string | RegExp)[];
|
|
4
|
-
declare const isCompleteDateInput: (input: string) => boolean;
|
|
5
|
-
declare const formatDate: (date: Date | number, dateFormat?: string) => string;
|
|
6
|
-
declare const parseDateString: (value: string, dateFormat?: string) => Date;
|
|
7
|
-
declare const isValid: (inputValue?: string) => boolean;
|
|
8
|
-
declare const format: (value: string) => string;
|
|
9
|
-
export { DATE_FORMAT, NATIVE_DATE_FORMAT, DATE_MASK, isCompleteDateInput, formatDate, parseDateString, isValid, format };
|
package/utils/index.d.ts
DELETED