@alfalab/core-components-date-range-input 3.5.28 → 49.0.0-snapshot-fbb690e
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.responsive.d.ts +30 -6
- package/Component.responsive.js +4 -3
- package/Component.responsive.js.map +1 -0
- package/components/date-range-input/Component.d.ts +208 -11
- package/components/date-range-input/Component.js +26 -27
- package/components/date-range-input/Component.js.map +1 -0
- package/components/date-range-input/index.css +11 -51
- package/components/date-range-input/index.d.ts +1 -1
- package/components/date-range-input/index.js +3 -2
- package/components/date-range-input/index.js.map +1 -0
- package/components/date-range-input/index.module.css.js +8 -0
- package/components/date-range-input/index.module.css.js.map +1 -0
- package/cssm/Component.responsive.d.ts +30 -6
- package/cssm/Component.responsive.js +6 -5
- package/cssm/Component.responsive.js.map +1 -0
- package/cssm/components/date-range-input/Component.d.ts +208 -11
- package/cssm/components/date-range-input/Component.js +24 -23
- package/cssm/components/date-range-input/Component.js.map +1 -0
- package/cssm/components/date-range-input/index.d.ts +1 -1
- package/cssm/components/date-range-input/index.js +3 -2
- package/cssm/components/date-range-input/index.js.map +1 -0
- package/cssm/components/date-range-input/index.module.css +5 -44
- package/cssm/desktop/Component.desktop.d.ts +9 -5
- package/cssm/desktop/Component.desktop.js +5 -4
- package/cssm/desktop/Component.desktop.js.map +1 -0
- package/cssm/desktop/index.d.ts +1 -2
- package/cssm/desktop/index.js +3 -2
- package/cssm/desktop/index.js.map +1 -0
- package/cssm/index.d.ts +2 -3
- package/cssm/index.js +1 -0
- package/cssm/index.js.map +1 -0
- package/cssm/mobile/Component.mobile.d.ts +9 -5
- package/cssm/mobile/Component.mobile.js +5 -4
- package/cssm/mobile/Component.mobile.js.map +1 -0
- package/cssm/mobile/index.d.ts +1 -2
- package/cssm/mobile/index.js +3 -2
- package/cssm/mobile/index.js.map +1 -0
- package/cssm/utils/format.d.ts +7 -8
- package/cssm/utils/format.js +1 -0
- package/cssm/utils/format.js.map +1 -0
- package/cssm/utils/index.d.ts +1 -1
- package/cssm/utils/index.js +9 -8
- package/cssm/utils/index.js.map +1 -0
- package/desktop/Component.desktop.d.ts +9 -5
- package/desktop/Component.desktop.js +5 -4
- package/desktop/Component.desktop.js.map +1 -0
- package/desktop/index.d.ts +1 -2
- package/desktop/index.js +3 -2
- package/desktop/index.js.map +1 -0
- package/esm/Component.responsive.d.ts +30 -6
- package/esm/Component.responsive.js +1 -0
- package/esm/Component.responsive.js.map +1 -0
- package/esm/components/date-range-input/Component.d.ts +208 -11
- package/esm/components/date-range-input/Component.js +2 -3
- package/esm/components/date-range-input/Component.js.map +1 -0
- package/esm/components/date-range-input/index.css +11 -51
- package/esm/components/date-range-input/index.d.ts +1 -1
- package/esm/components/date-range-input/index.js +1 -0
- package/esm/components/date-range-input/index.js.map +1 -0
- package/esm/components/date-range-input/index.module.css.js +6 -0
- package/esm/components/date-range-input/index.module.css.js.map +1 -0
- package/esm/desktop/Component.desktop.d.ts +9 -5
- package/esm/desktop/Component.desktop.js +1 -0
- package/esm/desktop/Component.desktop.js.map +1 -0
- package/esm/desktop/index.d.ts +1 -2
- package/esm/desktop/index.js +1 -0
- package/esm/desktop/index.js.map +1 -0
- package/esm/index.d.ts +2 -3
- package/esm/index.js +1 -0
- package/esm/index.js.map +1 -0
- package/esm/mobile/Component.mobile.d.ts +9 -5
- package/esm/mobile/Component.mobile.js +1 -0
- package/esm/mobile/Component.mobile.js.map +1 -0
- package/esm/mobile/index.d.ts +1 -2
- package/esm/mobile/index.js +1 -0
- package/esm/mobile/index.js.map +1 -0
- package/esm/utils/format.d.ts +7 -8
- package/esm/utils/format.js +1 -0
- package/esm/utils/format.js.map +1 -0
- package/esm/utils/index.d.ts +1 -1
- package/esm/utils/index.js +1 -0
- package/esm/utils/index.js.map +1 -0
- package/index.d.ts +2 -3
- package/index.js +1 -0
- package/index.js.map +1 -0
- package/mobile/Component.mobile.d.ts +9 -5
- package/mobile/Component.mobile.js +5 -4
- package/mobile/Component.mobile.js.map +1 -0
- package/mobile/index.d.ts +1 -2
- package/mobile/index.js +3 -2
- package/mobile/index.js.map +1 -0
- package/modern/Component.responsive.d.ts +30 -6
- package/modern/Component.responsive.js +1 -0
- package/modern/Component.responsive.js.map +1 -0
- package/modern/components/date-range-input/Component.d.ts +208 -11
- package/modern/components/date-range-input/Component.js +2 -3
- package/modern/components/date-range-input/Component.js.map +1 -0
- package/modern/components/date-range-input/index.css +11 -51
- package/modern/components/date-range-input/index.d.ts +1 -1
- package/modern/components/date-range-input/index.js +1 -0
- package/modern/components/date-range-input/index.js.map +1 -0
- package/modern/components/date-range-input/index.module.css.js +6 -0
- package/modern/components/date-range-input/index.module.css.js.map +1 -0
- package/modern/desktop/Component.desktop.d.ts +9 -5
- package/modern/desktop/Component.desktop.js +1 -0
- package/modern/desktop/Component.desktop.js.map +1 -0
- package/modern/desktop/index.d.ts +1 -2
- package/modern/desktop/index.js +1 -0
- package/modern/desktop/index.js.map +1 -0
- package/modern/index.d.ts +2 -3
- package/modern/index.js +1 -0
- package/modern/index.js.map +1 -0
- package/modern/mobile/Component.mobile.d.ts +9 -5
- package/modern/mobile/Component.mobile.js +1 -0
- package/modern/mobile/Component.mobile.js.map +1 -0
- package/modern/mobile/index.d.ts +1 -2
- package/modern/mobile/index.js +1 -0
- package/modern/mobile/index.js.map +1 -0
- package/modern/utils/format.d.ts +7 -8
- package/modern/utils/format.js +1 -0
- package/modern/utils/format.js.map +1 -0
- package/modern/utils/index.d.ts +1 -1
- package/modern/utils/index.js +1 -0
- package/modern/utils/index.js.map +1 -0
- package/moderncssm/Component.responsive.d.ts +30 -6
- package/moderncssm/Component.responsive.js +1 -0
- package/moderncssm/Component.responsive.js.map +1 -0
- package/moderncssm/components/date-range-input/Component.d.ts +208 -11
- package/moderncssm/components/date-range-input/Component.js +1 -0
- package/moderncssm/components/date-range-input/Component.js.map +1 -0
- package/moderncssm/components/date-range-input/index.d.ts +1 -1
- package/moderncssm/components/date-range-input/index.js +1 -0
- package/moderncssm/components/date-range-input/index.js.map +1 -0
- package/moderncssm/components/date-range-input/index.module.css +0 -21
- package/moderncssm/desktop/Component.desktop.d.ts +9 -5
- package/moderncssm/desktop/Component.desktop.js +1 -0
- package/moderncssm/desktop/Component.desktop.js.map +1 -0
- package/moderncssm/desktop/index.d.ts +1 -2
- package/moderncssm/desktop/index.js +1 -0
- package/moderncssm/desktop/index.js.map +1 -0
- package/moderncssm/index.d.ts +2 -3
- package/moderncssm/index.js +1 -0
- package/moderncssm/index.js.map +1 -0
- package/moderncssm/mobile/Component.mobile.d.ts +9 -5
- package/moderncssm/mobile/Component.mobile.js +1 -0
- package/moderncssm/mobile/Component.mobile.js.map +1 -0
- package/moderncssm/mobile/index.d.ts +1 -2
- package/moderncssm/mobile/index.js +1 -0
- package/moderncssm/mobile/index.js.map +1 -0
- package/moderncssm/utils/format.d.ts +7 -8
- package/moderncssm/utils/format.js +1 -0
- package/moderncssm/utils/format.js.map +1 -0
- package/moderncssm/utils/index.d.ts +1 -1
- package/moderncssm/utils/index.js +1 -0
- package/moderncssm/utils/index.js.map +1 -0
- package/package.json +9 -10
- package/utils/format.d.ts +7 -8
- package/utils/format.js +1 -0
- package/utils/format.js.map +1 -0
- package/utils/index.d.ts +1 -1
- package/utils/index.js +9 -8
- package/utils/index.js.map +1 -0
package/moderncssm/index.js
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -1,10 +1,14 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
1
|
import React from 'react';
|
|
3
|
-
import { ConditionalProps, DateRangeInputProps } from
|
|
4
|
-
type DateRangeInputMobileProps = Omit<DateRangeInputProps, 'view' | 'picker' | 'onClose' | 'InputComponent'> & ConditionalProps;
|
|
2
|
+
import { ConditionalProps, DateRangeInputProps } from '../components/date-range-input';
|
|
3
|
+
export declare type DateRangeInputMobileProps = Omit<DateRangeInputProps, 'view' | 'picker' | 'onClose' | 'InputComponent'> & ConditionalProps;
|
|
5
4
|
/**
|
|
6
5
|
* @deprecated
|
|
7
6
|
* use UniversalDateInput instead
|
|
8
7
|
*/
|
|
9
|
-
declare const DateRangeInputMobile: React.ForwardRefExoticComponent<
|
|
10
|
-
|
|
8
|
+
export declare const DateRangeInputMobile: React.ForwardRefExoticComponent<(Omit<Omit<DateRangeInputProps, "view" | "picker" | "onClose" | "InputComponent"> & {
|
|
9
|
+
picker: true;
|
|
10
|
+
onClose?: (() => void) | undefined;
|
|
11
|
+
}, "ref"> | Omit<Omit<DateRangeInputProps, "view" | "picker" | "onClose" | "InputComponent"> & {
|
|
12
|
+
picker?: false | undefined;
|
|
13
|
+
onClose?: undefined;
|
|
14
|
+
}, "ref">) & React.RefAttributes<HTMLInputElement>>;
|
|
@@ -10,3 +10,4 @@ import { DateRangeInput } from '../components/date-range-input/Component.js';
|
|
|
10
10
|
const DateRangeInputMobile = forwardRef((props, ref) => (React.createElement(DateRangeInput, { InputComponent: InputMobile, Calendar: CalendarMobile, view: 'mobile', ...props, ref: ref })));
|
|
11
11
|
|
|
12
12
|
export { DateRangeInputMobile };
|
|
13
|
+
//# sourceMappingURL=Component.mobile.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Component.mobile.js","sources":["../../src/mobile/Component.mobile.tsx"],"sourcesContent":["import React, { forwardRef } from 'react';\n\nimport { CalendarMobile } from '@alfalab/core-components-calendar/mobile';\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nimport { InputProps } from '@alfalab/core-components-input';\nimport { InputMobile } from '@alfalab/core-components-input/mobile';\n\nimport {\n ConditionalProps,\n DateRangeInput,\n DateRangeInputProps,\n} from '../components/date-range-input';\n\nexport type DateRangeInputMobileProps = Omit<\n DateRangeInputProps,\n 'view' | 'picker' | 'onClose' | 'InputComponent'\n> &\n ConditionalProps;\n\n/**\n * @deprecated\n * use UniversalDateInput instead\n */\nexport const DateRangeInputMobile = forwardRef<HTMLInputElement, DateRangeInputMobileProps>(\n (props, ref) => (\n <DateRangeInput\n InputComponent={InputMobile}\n Calendar={CalendarMobile}\n view='mobile'\n {...props}\n ref={ref}\n />\n ),\n);\n"],"names":[],"mappings":";;;;;AAmBA;;;AAGG;AACU,MAAA,oBAAoB,GAAG,UAAU,CAC1C,CAAC,KAAK,EAAE,GAAG,MACP,KAAA,CAAA,aAAA,CAAC,cAAc,EACX,EAAA,cAAc,EAAE,WAAW,EAC3B,QAAQ,EAAE,cAAc,EACxB,IAAI,EAAC,QAAQ,EACT,GAAA,KAAK,EACT,GAAG,EAAE,GAAG,EACV,CAAA,CACL;;;;"}
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
export * from
|
|
2
|
-
export {};
|
|
1
|
+
export * from './Component.mobile';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
declare const DATE_FORMAT = "dd.MM.yyyy";
|
|
2
|
-
declare const DATE_MASK: (string | RegExp)[];
|
|
3
|
-
declare const isCompleteDateInput: (input: string) => boolean;
|
|
4
|
-
declare const parseDateString: (value: string, dateFormat?: string) => Date;
|
|
5
|
-
declare const isValid: (inputValue: string, dateFrom: string, dateTo: string) => boolean;
|
|
6
|
-
declare const format: (value: string) => string;
|
|
7
|
-
declare const parseTimestampToDate: (timestamp: number) => string;
|
|
8
|
-
export { DATE_FORMAT, DATE_MASK, isCompleteDateInput, parseDateString, isValid, format, parseTimestampToDate };
|
|
1
|
+
export declare const DATE_FORMAT = "dd.MM.yyyy";
|
|
2
|
+
export declare const DATE_MASK: (string | RegExp)[];
|
|
3
|
+
export declare const isCompleteDateInput: (input: string) => boolean;
|
|
4
|
+
export declare const parseDateString: (value: string, dateFormat?: string) => Date;
|
|
5
|
+
export declare const isValid: (inputValue: string, dateFrom: string, dateTo: string) => boolean;
|
|
6
|
+
export declare const format: (value: string) => string;
|
|
7
|
+
export declare const parseTimestampToDate: (timestamp: number) => string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"format.js","sources":["../../src/utils/format.ts"],"sourcesContent":["/* eslint-disable no-useless-escape */\n\nimport dateFnsIsValid from 'date-fns/isValid';\nimport parse from 'date-fns/parse';\n\nexport const DATE_FORMAT = 'dd.MM.yyyy';\nexport const DATE_MASK = [\n /\\d/,\n /\\d/,\n '.',\n /\\d/,\n /\\d/,\n '.',\n /\\d/,\n /\\d/,\n /\\d/,\n /\\d/,\n ' ',\n '-',\n ' ',\n /\\d/,\n /\\d/,\n '.',\n /\\d/,\n /\\d/,\n '.',\n /\\d/,\n /\\d/,\n /\\d/,\n /\\d/,\n];\n\nexport const isCompleteDateInput = (input: string) => input.length === DATE_MASK.length;\n\nexport const parseDateString = (value: string, dateFormat = DATE_FORMAT) =>\n parse(value, dateFormat, new Date());\n\nexport const isValid = (inputValue: string, dateFrom: string, dateTo: string) =>\n !inputValue ||\n (isCompleteDateInput(inputValue) &&\n dateFnsIsValid(parseDateString(dateFrom)) &&\n dateFnsIsValid(parseDateString(dateTo)));\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(/\\.$/, '') // 12. => 12\n .replace(/\\ $/, '') // 1 2 => 12\n .replace(/^(\\d\\d\\.\\d\\d\\.\\d\\d\\d\\d)(\\d) - (\\d.*)/, '$1 - $3') // 12.12.20051 - 12.12.200 => 12.12.2005 - 12.12.200\n .replace(/^(\\d\\d\\.\\d\\d\\.\\d\\d\\d\\d) (\\d)- (\\d.*)/, '$1 - $3') // 12.12.2005 1- 12.12.200 => 12.12.2005 - 12.12.200\n .replace(/^(\\d\\d\\.\\d\\d\\.\\d\\d\\d\\d) -(\\d) (\\d.*)/, '$1 - $3') // 12.12.2005 -1 12.12.200 => 12.12.2005 - 12.12.200\n .replace(/^(\\d\\d\\.\\d\\d\\.\\d\\d\\d\\d) - (\\d)(\\d\\d.\\d\\d.\\d\\d\\d)/, '$1 - $3') // 12.12.2005 - 112.12.200 => 12.12.2005 - 12.12.200\n .replace(/^(\\d\\d\\.\\d\\d\\.\\d\\d\\d\\d) - (\\d)(\\d\\d.\\d.\\d\\d\\d\\d)/, '$1 - $3') // 12.12.2005 - 112.1.2001 => 12.12.2005 - 12.1.2001\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.*)/, '$1.$2') // 1212 => 12.12\n .replace(/^(\\d\\d.\\d\\d)(\\d.*)/, '$1.$2') // 12.122 => 12.12.2\n .replace(/^(\\d\\d\\.\\d\\d\\.\\d\\d\\d\\d)(\\d)/, '$1 - $2') // 12.12.20056 => 12.12.2005 - 6\n .replace(/^(\\d\\d\\.\\d\\d\\.\\d\\d\\d\\d) - (\\d\\d)(\\d)/, '$1 - $2.$3') // 12.12.2005 - 123 => 12.12.2005 - 12.3\n .replace(/^(\\d\\d\\.\\d\\d\\.\\d\\d\\d\\d) - (\\d\\d).(\\d\\d)(\\d)/, '$1 - $2.$3.$4') // 12.12.2005 - 12.123 => 12.12.2005 - 12.12.3\n .replace(/^(\\d\\d\\.\\d\\d\\.\\d\\d\\d\\d)- (\\d.*)/, '$1 - $2') // 12.12.2005- 12.12.2005 => 12.12.2005 - 12.12.2005\n .replace(/^(\\d\\d\\.\\d\\d\\.\\d\\d\\d\\d) -(\\d.*)/, '$1 - $2') // 12.12.2005 -12.12.2005 => 12.12.2005 - 12.12.2005\n .replace(/^(\\d\\d\\.\\d\\d\\.\\d\\d\\d\\d) -/, '$1') // 12.12.2005 - => 12.12.2005\n .replace(/^(\\d\\d\\.\\d\\d\\.\\d\\d\\d\\d) (\\d.*)/, '$1 - $2') // 12.12.2005 12.12.2005 => 12.12.2005 - 12.12.2005\n .replace(/^(\\d\\d\\.\\d\\d\\.\\d\\d\\d\\d) {2}(\\d.*)/, '$1 - $2') // 12.12.2005 12.12.2005 => 12.12.2005 - 12.12.2005\n .replace(/^(\\d\\d\\.\\d\\d\\.\\d\\d\\d\\d)-/, '$1') // 12.12.2005- => 12.12.2005\n .replace(/^(\\d\\.\\d\\d\\.\\d\\d\\d\\d)([0-9]*)/, '$1') // 1.12.2005123123 => 1.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)([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') // 1.2.20055125125 => 1.2.2005\n .replace(/^()\\.(\\d)\\.(\\d\\d\\d\\d)([0-9]*)/, '$1.$2.$3'); // .2.2005123123 => .2.2005\n\nexport const parseTimestampToDate = (timestamp: number): string => {\n const date = new Date(timestamp);\n const year = date.getFullYear();\n\n let month: number | string = date.getMonth() + 1;\n let day: number | string = date.getDate();\n\n if (month < 10) {\n month = `0${month}`;\n }\n if (day < 10) {\n day = `0${day}`;\n }\n\n return `${day}.${month}.${year}`;\n};\n"],"names":[],"mappings":";;;AAAA;AAKO,MAAM,WAAW,GAAG;AACd,MAAA,SAAS,GAAG;IACrB,IAAI;IACJ,IAAI;IACJ,GAAG;IACH,IAAI;IACJ,IAAI;IACJ,GAAG;IACH,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,GAAG;IACH,GAAG;IACH,GAAG;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V,QAAA,GAAG,GAAG,CAAA,CAAA,EAAI,GAAG,CAAA,CAAE;AAClB;AAED,IAAA,OAAO,GAAG,GAAG,CAAA,CAAA,EAAI,KAAK,CAAI,CAAA,EAAA,IAAI,EAAE;AACpC;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from
|
|
1
|
+
export * from './format';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@alfalab/core-components-date-range-input",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "49.0.0-snapshot-fbb690e",
|
|
4
4
|
"description": "",
|
|
5
5
|
"keywords": [],
|
|
6
6
|
"license": "MIT",
|
|
@@ -16,19 +16,18 @@
|
|
|
16
16
|
"react-dom": "^16.9.0 || ^17.0.1 || ^18.0.0"
|
|
17
17
|
},
|
|
18
18
|
"dependencies": {
|
|
19
|
-
"@alfalab/core-components-input": "
|
|
20
|
-
"@alfalab/core-components-icon-button": "
|
|
21
|
-
"@alfalab/core-components-calendar": "
|
|
22
|
-
"@alfalab/core-components-mq": "
|
|
23
|
-
"@alfalab/core-components-popover": "
|
|
19
|
+
"@alfalab/core-components-input": "49.0.0-snapshot-fbb690e",
|
|
20
|
+
"@alfalab/core-components-icon-button": "49.0.0-snapshot-fbb690e",
|
|
21
|
+
"@alfalab/core-components-calendar": "49.0.0-snapshot-fbb690e",
|
|
22
|
+
"@alfalab/core-components-mq": "49.0.0-snapshot-fbb690e",
|
|
23
|
+
"@alfalab/core-components-popover": "49.0.0-snapshot-fbb690e",
|
|
24
24
|
"@alfalab/hooks": "^1.13.1",
|
|
25
25
|
"@alfalab/icons-glyph": "^2.210.0",
|
|
26
26
|
"classnames": "^2.5.1",
|
|
27
27
|
"date-fns": "^2.16.1",
|
|
28
28
|
"react-merge-refs": "^1.1.0",
|
|
29
|
-
"tslib": "^2.4.0"
|
|
30
|
-
"@alfalab/core-components-shared": "^0.17.0"
|
|
29
|
+
"tslib": "^2.4.0"
|
|
31
30
|
},
|
|
32
|
-
"themesVersion": "
|
|
33
|
-
"varsVersion": "
|
|
31
|
+
"themesVersion": "49.0.0-snapshot-fbb690e",
|
|
32
|
+
"varsVersion": "49.0.0-snapshot-fbb690e"
|
|
34
33
|
}
|
package/utils/format.d.ts
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
declare const DATE_FORMAT = "dd.MM.yyyy";
|
|
2
|
-
declare const DATE_MASK: (string | RegExp)[];
|
|
3
|
-
declare const isCompleteDateInput: (input: string) => boolean;
|
|
4
|
-
declare const parseDateString: (value: string, dateFormat?: string) => Date;
|
|
5
|
-
declare const isValid: (inputValue: string, dateFrom: string, dateTo: string) => boolean;
|
|
6
|
-
declare const format: (value: string) => string;
|
|
7
|
-
declare const parseTimestampToDate: (timestamp: number) => string;
|
|
8
|
-
export { DATE_FORMAT, DATE_MASK, isCompleteDateInput, parseDateString, isValid, format, parseTimestampToDate };
|
|
1
|
+
export declare const DATE_FORMAT = "dd.MM.yyyy";
|
|
2
|
+
export declare const DATE_MASK: (string | RegExp)[];
|
|
3
|
+
export declare const isCompleteDateInput: (input: string) => boolean;
|
|
4
|
+
export declare const parseDateString: (value: string, dateFormat?: string) => Date;
|
|
5
|
+
export declare const isValid: (inputValue: string, dateFrom: string, dateTo: string) => boolean;
|
|
6
|
+
export declare const format: (value: string) => string;
|
|
7
|
+
export declare const parseTimestampToDate: (timestamp: number) => string;
|
package/utils/format.js
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"format.js","sources":["../src/utils/format.ts"],"sourcesContent":["/* eslint-disable no-useless-escape */\n\nimport dateFnsIsValid from 'date-fns/isValid';\nimport parse from 'date-fns/parse';\n\nexport const DATE_FORMAT = 'dd.MM.yyyy';\nexport const DATE_MASK = [\n /\\d/,\n /\\d/,\n '.',\n /\\d/,\n /\\d/,\n '.',\n /\\d/,\n /\\d/,\n /\\d/,\n /\\d/,\n ' ',\n '-',\n ' ',\n /\\d/,\n /\\d/,\n '.',\n /\\d/,\n /\\d/,\n '.',\n /\\d/,\n /\\d/,\n /\\d/,\n /\\d/,\n];\n\nexport const isCompleteDateInput = (input: string) => input.length === DATE_MASK.length;\n\nexport const parseDateString = (value: string, dateFormat = DATE_FORMAT) =>\n parse(value, dateFormat, new Date());\n\nexport const isValid = (inputValue: string, dateFrom: string, dateTo: string) =>\n !inputValue ||\n (isCompleteDateInput(inputValue) &&\n dateFnsIsValid(parseDateString(dateFrom)) &&\n dateFnsIsValid(parseDateString(dateTo)));\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(/\\.$/, '') // 12. => 12\n .replace(/\\ $/, '') // 1 2 => 12\n .replace(/^(\\d\\d\\.\\d\\d\\.\\d\\d\\d\\d)(\\d) - (\\d.*)/, '$1 - $3') // 12.12.20051 - 12.12.200 => 12.12.2005 - 12.12.200\n .replace(/^(\\d\\d\\.\\d\\d\\.\\d\\d\\d\\d) (\\d)- (\\d.*)/, '$1 - $3') // 12.12.2005 1- 12.12.200 => 12.12.2005 - 12.12.200\n .replace(/^(\\d\\d\\.\\d\\d\\.\\d\\d\\d\\d) -(\\d) (\\d.*)/, '$1 - $3') // 12.12.2005 -1 12.12.200 => 12.12.2005 - 12.12.200\n .replace(/^(\\d\\d\\.\\d\\d\\.\\d\\d\\d\\d) - (\\d)(\\d\\d.\\d\\d.\\d\\d\\d)/, '$1 - $3') // 12.12.2005 - 112.12.200 => 12.12.2005 - 12.12.200\n .replace(/^(\\d\\d\\.\\d\\d\\.\\d\\d\\d\\d) - (\\d)(\\d\\d.\\d.\\d\\d\\d\\d)/, '$1 - $3') // 12.12.2005 - 112.1.2001 => 12.12.2005 - 12.1.2001\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.*)/, '$1.$2') // 1212 => 12.12\n .replace(/^(\\d\\d.\\d\\d)(\\d.*)/, '$1.$2') // 12.122 => 12.12.2\n .replace(/^(\\d\\d\\.\\d\\d\\.\\d\\d\\d\\d)(\\d)/, '$1 - $2') // 12.12.20056 => 12.12.2005 - 6\n .replace(/^(\\d\\d\\.\\d\\d\\.\\d\\d\\d\\d) - (\\d\\d)(\\d)/, '$1 - $2.$3') // 12.12.2005 - 123 => 12.12.2005 - 12.3\n .replace(/^(\\d\\d\\.\\d\\d\\.\\d\\d\\d\\d) - (\\d\\d).(\\d\\d)(\\d)/, '$1 - $2.$3.$4') // 12.12.2005 - 12.123 => 12.12.2005 - 12.12.3\n .replace(/^(\\d\\d\\.\\d\\d\\.\\d\\d\\d\\d)- (\\d.*)/, '$1 - $2') // 12.12.2005- 12.12.2005 => 12.12.2005 - 12.12.2005\n .replace(/^(\\d\\d\\.\\d\\d\\.\\d\\d\\d\\d) -(\\d.*)/, '$1 - $2') // 12.12.2005 -12.12.2005 => 12.12.2005 - 12.12.2005\n .replace(/^(\\d\\d\\.\\d\\d\\.\\d\\d\\d\\d) -/, '$1') // 12.12.2005 - => 12.12.2005\n .replace(/^(\\d\\d\\.\\d\\d\\.\\d\\d\\d\\d) (\\d.*)/, '$1 - $2') // 12.12.2005 12.12.2005 => 12.12.2005 - 12.12.2005\n .replace(/^(\\d\\d\\.\\d\\d\\.\\d\\d\\d\\d) {2}(\\d.*)/, '$1 - $2') // 12.12.2005 12.12.2005 => 12.12.2005 - 12.12.2005\n .replace(/^(\\d\\d\\.\\d\\d\\.\\d\\d\\d\\d)-/, '$1') // 12.12.2005- => 12.12.2005\n .replace(/^(\\d\\.\\d\\d\\.\\d\\d\\d\\d)([0-9]*)/, '$1') // 1.12.2005123123 => 1.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)([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') // 1.2.20055125125 => 1.2.2005\n .replace(/^()\\.(\\d)\\.(\\d\\d\\d\\d)([0-9]*)/, '$1.$2.$3'); // .2.2005123123 => .2.2005\n\nexport const parseTimestampToDate = (timestamp: number): string => {\n const date = new Date(timestamp);\n const year = date.getFullYear();\n\n let month: number | string = date.getMonth() + 1;\n let day: number | string = date.getDate();\n\n if (month < 10) {\n month = `0${month}`;\n }\n if (day < 10) {\n day = `0${day}`;\n }\n\n return `${day}.${month}.${year}`;\n};\n"],"names":["parse","dateFnsIsValid"],"mappings":";;;;;;;;;;;;AAAA;AAKO,IAAM,WAAW,GAAG;AACd,IAAA,SAAS,GAAG;IACrB,IAAI;IACJ,IAAI;IACJ,GAAG;IACH,IAAI;IACJ,IAAI;IACJ,GAAG;IACH,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,GAAG;IACH,GAAG;IACH,GAAG;IACH,IAAI;IACJ,IAAI;IACJ,GAAG;IACH,IAAI;IACJ,IAAI;IACJ,GAAG;IACH,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;;AAGK,IAAA,mBAAmB,GAAG,UAAC,KAAa,EAAK,EAAA,OAAA,KAAK,CAAC,MAAM,KAAK,SAAS,CAAC,MAAM,CAAA;AAE1E,IAAA,eAAe,GAAG,UAAC,K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IAAA,OAAO,UAAG,GAAG,EAAA,GAAA,CAAA,CAAA,MAAA,CAAI,KAAK,EAAI,GAAA,CAAA,CAAA,MAAA,CAAA,IAAI,CAAE;AACpC;;;;;;;;;;"}
|
package/utils/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from
|
|
1
|
+
export * from './format';
|
package/utils/index.js
CHANGED
|
@@ -2,14 +2,15 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var
|
|
5
|
+
var format = require('./format.js');
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
|
|
9
|
-
exports.DATE_FORMAT =
|
|
10
|
-
exports.DATE_MASK =
|
|
11
|
-
exports.format =
|
|
12
|
-
exports.isCompleteDateInput =
|
|
13
|
-
exports.isValid =
|
|
14
|
-
exports.parseDateString =
|
|
15
|
-
exports.parseTimestampToDate =
|
|
9
|
+
exports.DATE_FORMAT = format.DATE_FORMAT;
|
|
10
|
+
exports.DATE_MASK = format.DATE_MASK;
|
|
11
|
+
exports.format = format.format;
|
|
12
|
+
exports.isCompleteDateInput = format.isCompleteDateInput;
|
|
13
|
+
exports.isValid = format.isValid;
|
|
14
|
+
exports.parseDateString = format.parseDateString;
|
|
15
|
+
exports.parseTimestampToDate = format.parseTimestampToDate;
|
|
16
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;"}
|