@progress/kendo-react-dateinputs 9.0.0-develop.5 → 9.0.0-develop.7

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.
@@ -5,4 +5,4 @@
5
5
  * Licensed under commercial license. See LICENSE.md in the package root for more information
6
6
  *-------------------------------------------------------------------------------------------
7
7
  */
8
- "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("react"),l=require("@progress/kendo-react-labels");function s(e){const n=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const t in e)if(t!=="default"){const o=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(n,t,o.get?o:{enumerable:!0,get:()=>e[t]})}}return n.default=e,Object.freeze(n)}const r=s(a),c=e=>{const[n,t]=r.useState(!1),o=()=>{e.current&&t(!!e.current.text)};return r.useEffect(o),{editorValue:n}},i=e=>{const{dateInput:n,...t}=e,o=c(n);return r.createElement(l.FloatingLabel,{...t,...o})};exports.PickerFloatingLabel=i;exports.usePickerFloatingLabel=c;
8
+ "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("react"),s=require("@progress/kendo-react-labels");function i(e){const n=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const t in e)if(t!=="default"){const r=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(n,t,r.get?r:{enumerable:!0,get:()=>e[t]})}}return n.default=e,Object.freeze(n)}const o=i(l),a=e=>{const[n,t]=o.useState(!1),r=()=>{var c;e.current&&t(!!((c=e.current.element)!=null&&c.value||e.current.text))};return o.useEffect(r),{editorValue:n}},u=e=>{const{dateInput:n,...t}=e,r=a(n);return o.createElement(s.FloatingLabel,{...t,...r})};exports.PickerFloatingLabel=u;exports.usePickerFloatingLabel=a;
@@ -7,19 +7,20 @@
7
7
  */
8
8
  "use client";
9
9
  import * as n from "react";
10
- import { FloatingLabel as s } from "@progress/kendo-react-labels";
10
+ import { FloatingLabel as c } from "@progress/kendo-react-labels";
11
11
  const a = (e) => {
12
12
  const [t, o] = n.useState(!1), r = () => {
13
- e.current && o(!!e.current.text);
13
+ var s;
14
+ e.current && o(!!((s = e.current.element) != null && s.value || e.current.text));
14
15
  };
15
16
  return n.useEffect(r), {
16
17
  editorValue: t
17
18
  };
18
- }, l = (e) => {
19
+ }, i = (e) => {
19
20
  const { dateInput: t, ...o } = e, r = a(t);
20
- return /* @__PURE__ */ n.createElement(s, { ...o, ...r });
21
+ return /* @__PURE__ */ n.createElement(c, { ...o, ...r });
21
22
  };
22
23
  export {
23
- l as PickerFloatingLabel,
24
+ i as PickerFloatingLabel,
24
25
  a as usePickerFloatingLabel
25
26
  };
package/index.d.mts CHANGED
@@ -7,8 +7,11 @@
7
7
  */
8
8
  import { ButtonHandle } from '@progress/kendo-react-buttons';
9
9
  import { ButtonProps } from '@progress/kendo-react-buttons';
10
+ import { DateFieldNameOptions } from '@progress/kendo-intl';
10
11
  import { DateFormatOptions } from '@progress/kendo-react-intl';
12
+ import { DateFormatOptions as DateFormatOptions_2 } from '@progress/kendo-intl';
11
13
  import { DateFormatPart } from '@progress/kendo-react-intl';
14
+ import { DateFormatPart as DateFormatPart_2 } from '@progress/kendo-intl';
12
15
  import { DateInputsClassStructure } from '@progress/kendo-react-common';
13
16
  import { FormComponent } from '@progress/kendo-react-common';
14
17
  import { FormComponentProps } from '@progress/kendo-react-common';
@@ -17,6 +20,7 @@ import { ForwardRefExoticComponent } from 'react';
17
20
  import { IntlService } from '@progress/kendo-react-intl';
18
21
  import { JSX as JSX_2 } from 'react/jsx-runtime';
19
22
  import { LocalizationService } from '@progress/kendo-react-intl';
23
+ import { NumberFormatOptions } from '@progress/kendo-intl';
20
24
  import { PopupProps } from '@progress/kendo-react-popup';
21
25
  import PropTypes from 'prop-types';
22
26
  import * as React_2 from 'react';
@@ -639,6 +643,25 @@ export declare interface DateInputIncrementalSteps {
639
643
  second?: number;
640
644
  }
641
645
 
646
+ declare class DateInputIntl {
647
+ private service;
648
+ format: (format: string, ...values: any[]) => string;
649
+ toString: (value: any, format: any, localeId?: string) => string;
650
+ formatDate: (value: Date, format?: string | DateFormatOptions_2, localeId?: string) => string;
651
+ parseDate: (value: string, format?: string | DateFormatOptions_2 | string[] | DateFormatOptions_2[], localeId?: string) => Date;
652
+ parseNumber: (value: string, format?: string | NumberFormatOptions, localeId?: string) => number;
653
+ formatNumber: (value: number, format: string | NumberFormatOptions, localeId?: string) => string;
654
+ splitDateFormat: (format: string | DateFormatOptions_2, localeId?: string) => DateFormatPart_2[];
655
+ numberSymbols: (localeId?: string) => void;
656
+ firstDay: (localeId?: string) => number;
657
+ weekendRange: (localeId?: string) => any;
658
+ dateFieldName: (options: DateFieldNameOptions, localeId?: string) => string;
659
+ dateFormatNames: (localeId: any, options: any) => any;
660
+ cldr: any;
661
+ localeId: string;
662
+ constructor(service: IntlService);
663
+ }
664
+
642
665
  /**
643
666
  * Represents the props of the [KendoReact DateInput component]({% slug overview_dateinput %}). The generic argument is passed to the `onChange` property and is used as a target in the [`DateInputChangeEvent`]({% slug api_dateinputs_dateinputchangeevent %}) interface.
644
667
  */
@@ -985,30 +1008,14 @@ export declare class DateInputWithoutContext extends React_2.Component<DateInput
985
1008
  autoFocus: boolean;
986
1009
  };
987
1010
  private kendoDate;
988
- private currentFormat;
1011
+ private kendoDateObject;
1012
+ private mounted;
989
1013
  private valueDuringOnChange;
990
- private paste;
991
1014
  private _element;
992
1015
  private _wrapper;
1016
+ private _nativeEvent;
993
1017
  private get _inputId();
994
- private _lastSelectedSymbol;
995
1018
  constructor(props: DateInputProps);
996
- /**
997
- * @hidden
998
- */
999
- componentDidMount(): void;
1000
- /**
1001
- * @hidden
1002
- */
1003
- componentDidUpdate(_: any, prevState: any): void;
1004
- /**
1005
- * @hidden
1006
- */
1007
- componentWillUnmount(): void;
1008
- /**
1009
- * @hidden
1010
- */
1011
- render(): any;
1012
1019
  /**
1013
1020
  * Gets the value of the DateInput.
1014
1021
  */
@@ -1019,6 +1026,7 @@ export declare class DateInputWithoutContext extends React_2.Component<DateInput
1019
1026
  get name(): string | undefined;
1020
1027
  protected get min(): Date;
1021
1028
  protected get max(): Date;
1029
+ protected get isInSegmentSelection(): Date;
1022
1030
  /**
1023
1031
  * @hidden
1024
1032
  */
@@ -1075,34 +1083,64 @@ export declare class DateInputWithoutContext extends React_2.Component<DateInput
1075
1083
  * @hidden
1076
1084
  */
1077
1085
  protected get wrapper(): HTMLSpanElement | null;
1086
+ /**
1087
+ * @hidden
1088
+ */
1089
+ get options(): {
1090
+ format: string | DateFormatOptions | undefined;
1091
+ steps: DateInputIncrementalSteps | undefined;
1092
+ formatPlaceholder: string;
1093
+ placeholder: string | null | undefined;
1094
+ selectPreviousSegmentOnBackspace: boolean;
1095
+ allowCaretMode: boolean;
1096
+ value: Date | null;
1097
+ intlService: DateInputIntl;
1098
+ enableMouseWheel: boolean;
1099
+ autoCorrectParts: boolean;
1100
+ autoSwitchParts: boolean;
1101
+ autoSwitchKeys: never[];
1102
+ twoDigitYearMax: number;
1103
+ };
1104
+ /**
1105
+ * @hidden
1106
+ */
1107
+ componentDidMount(): void;
1108
+ /**
1109
+ * @hidden
1110
+ */
1111
+ componentDidUpdate(prevProps: DateInputProps): void;
1112
+ /**
1113
+ * @hidden
1114
+ */
1115
+ componentWillUnmount(): void;
1116
+ /**
1117
+ * @hidden
1118
+ */
1119
+ render(): any;
1078
1120
  /**
1079
1121
  * @hidden
1080
1122
  */
1081
1123
  intl(): IntlService;
1124
+ /**
1125
+ * @hidden
1126
+ */
1127
+ private intlProvider;
1128
+ get intlCommon(): IntlService;
1082
1129
  /**
1083
1130
  * @hidden
1084
1131
  */
1085
1132
  protected setValidity: () => void;
1086
1133
  protected updateOnPaste: (event: React_2.SyntheticEvent<HTMLInputElement>) => void;
1087
1134
  private spinnersMouseDown;
1088
- private handlePaste;
1089
1135
  private handleClick;
1090
- private elementChange;
1091
- private elementClick;
1092
1136
  private nativeWheel;
1093
- private wheel;
1094
1137
  private increasePart;
1095
1138
  private decreasePart;
1096
- private elementKeyDown;
1097
1139
  private elementOnFocus;
1098
1140
  private elementOnBlur;
1099
- private get selection();
1100
- private setSelection;
1101
1141
  private triggerChange;
1102
- private selectionBySymbol;
1103
- private selectionByIndex;
1104
- private switchDateSegment;
1105
- private modifyDateSegmentValue;
1142
+ private onChange;
1143
+ private initKendoDate;
1106
1144
  }
1107
1145
 
1108
1146
  /** @hidden */
@@ -1941,9 +1979,6 @@ export declare class DateRangePickerWithoutContext extends React_2.Component<Dat
1941
1979
  disabled: PropTypes.Requireable<boolean>;
1942
1980
  spinners: PropTypes.Requireable<boolean>;
1943
1981
  name: PropTypes.Requireable<string>;
1944
- /**
1945
- * @hidden
1946
- */
1947
1982
  dir: PropTypes.Requireable<string>;
1948
1983
  label: PropTypes.Requireable<string>;
1949
1984
  id: PropTypes.Requireable<string>;
package/index.d.ts CHANGED
@@ -7,8 +7,11 @@
7
7
  */
8
8
  import { ButtonHandle } from '@progress/kendo-react-buttons';
9
9
  import { ButtonProps } from '@progress/kendo-react-buttons';
10
+ import { DateFieldNameOptions } from '@progress/kendo-intl';
10
11
  import { DateFormatOptions } from '@progress/kendo-react-intl';
12
+ import { DateFormatOptions as DateFormatOptions_2 } from '@progress/kendo-intl';
11
13
  import { DateFormatPart } from '@progress/kendo-react-intl';
14
+ import { DateFormatPart as DateFormatPart_2 } from '@progress/kendo-intl';
12
15
  import { DateInputsClassStructure } from '@progress/kendo-react-common';
13
16
  import { FormComponent } from '@progress/kendo-react-common';
14
17
  import { FormComponentProps } from '@progress/kendo-react-common';
@@ -17,6 +20,7 @@ import { ForwardRefExoticComponent } from 'react';
17
20
  import { IntlService } from '@progress/kendo-react-intl';
18
21
  import { JSX as JSX_2 } from 'react/jsx-runtime';
19
22
  import { LocalizationService } from '@progress/kendo-react-intl';
23
+ import { NumberFormatOptions } from '@progress/kendo-intl';
20
24
  import { PopupProps } from '@progress/kendo-react-popup';
21
25
  import PropTypes from 'prop-types';
22
26
  import * as React_2 from 'react';
@@ -639,6 +643,25 @@ export declare interface DateInputIncrementalSteps {
639
643
  second?: number;
640
644
  }
641
645
 
646
+ declare class DateInputIntl {
647
+ private service;
648
+ format: (format: string, ...values: any[]) => string;
649
+ toString: (value: any, format: any, localeId?: string) => string;
650
+ formatDate: (value: Date, format?: string | DateFormatOptions_2, localeId?: string) => string;
651
+ parseDate: (value: string, format?: string | DateFormatOptions_2 | string[] | DateFormatOptions_2[], localeId?: string) => Date;
652
+ parseNumber: (value: string, format?: string | NumberFormatOptions, localeId?: string) => number;
653
+ formatNumber: (value: number, format: string | NumberFormatOptions, localeId?: string) => string;
654
+ splitDateFormat: (format: string | DateFormatOptions_2, localeId?: string) => DateFormatPart_2[];
655
+ numberSymbols: (localeId?: string) => void;
656
+ firstDay: (localeId?: string) => number;
657
+ weekendRange: (localeId?: string) => any;
658
+ dateFieldName: (options: DateFieldNameOptions, localeId?: string) => string;
659
+ dateFormatNames: (localeId: any, options: any) => any;
660
+ cldr: any;
661
+ localeId: string;
662
+ constructor(service: IntlService);
663
+ }
664
+
642
665
  /**
643
666
  * Represents the props of the [KendoReact DateInput component]({% slug overview_dateinput %}). The generic argument is passed to the `onChange` property and is used as a target in the [`DateInputChangeEvent`]({% slug api_dateinputs_dateinputchangeevent %}) interface.
644
667
  */
@@ -985,30 +1008,14 @@ export declare class DateInputWithoutContext extends React_2.Component<DateInput
985
1008
  autoFocus: boolean;
986
1009
  };
987
1010
  private kendoDate;
988
- private currentFormat;
1011
+ private kendoDateObject;
1012
+ private mounted;
989
1013
  private valueDuringOnChange;
990
- private paste;
991
1014
  private _element;
992
1015
  private _wrapper;
1016
+ private _nativeEvent;
993
1017
  private get _inputId();
994
- private _lastSelectedSymbol;
995
1018
  constructor(props: DateInputProps);
996
- /**
997
- * @hidden
998
- */
999
- componentDidMount(): void;
1000
- /**
1001
- * @hidden
1002
- */
1003
- componentDidUpdate(_: any, prevState: any): void;
1004
- /**
1005
- * @hidden
1006
- */
1007
- componentWillUnmount(): void;
1008
- /**
1009
- * @hidden
1010
- */
1011
- render(): any;
1012
1019
  /**
1013
1020
  * Gets the value of the DateInput.
1014
1021
  */
@@ -1019,6 +1026,7 @@ export declare class DateInputWithoutContext extends React_2.Component<DateInput
1019
1026
  get name(): string | undefined;
1020
1027
  protected get min(): Date;
1021
1028
  protected get max(): Date;
1029
+ protected get isInSegmentSelection(): Date;
1022
1030
  /**
1023
1031
  * @hidden
1024
1032
  */
@@ -1075,34 +1083,64 @@ export declare class DateInputWithoutContext extends React_2.Component<DateInput
1075
1083
  * @hidden
1076
1084
  */
1077
1085
  protected get wrapper(): HTMLSpanElement | null;
1086
+ /**
1087
+ * @hidden
1088
+ */
1089
+ get options(): {
1090
+ format: string | DateFormatOptions | undefined;
1091
+ steps: DateInputIncrementalSteps | undefined;
1092
+ formatPlaceholder: string;
1093
+ placeholder: string | null | undefined;
1094
+ selectPreviousSegmentOnBackspace: boolean;
1095
+ allowCaretMode: boolean;
1096
+ value: Date | null;
1097
+ intlService: DateInputIntl;
1098
+ enableMouseWheel: boolean;
1099
+ autoCorrectParts: boolean;
1100
+ autoSwitchParts: boolean;
1101
+ autoSwitchKeys: never[];
1102
+ twoDigitYearMax: number;
1103
+ };
1104
+ /**
1105
+ * @hidden
1106
+ */
1107
+ componentDidMount(): void;
1108
+ /**
1109
+ * @hidden
1110
+ */
1111
+ componentDidUpdate(prevProps: DateInputProps): void;
1112
+ /**
1113
+ * @hidden
1114
+ */
1115
+ componentWillUnmount(): void;
1116
+ /**
1117
+ * @hidden
1118
+ */
1119
+ render(): any;
1078
1120
  /**
1079
1121
  * @hidden
1080
1122
  */
1081
1123
  intl(): IntlService;
1124
+ /**
1125
+ * @hidden
1126
+ */
1127
+ private intlProvider;
1128
+ get intlCommon(): IntlService;
1082
1129
  /**
1083
1130
  * @hidden
1084
1131
  */
1085
1132
  protected setValidity: () => void;
1086
1133
  protected updateOnPaste: (event: React_2.SyntheticEvent<HTMLInputElement>) => void;
1087
1134
  private spinnersMouseDown;
1088
- private handlePaste;
1089
1135
  private handleClick;
1090
- private elementChange;
1091
- private elementClick;
1092
1136
  private nativeWheel;
1093
- private wheel;
1094
1137
  private increasePart;
1095
1138
  private decreasePart;
1096
- private elementKeyDown;
1097
1139
  private elementOnFocus;
1098
1140
  private elementOnBlur;
1099
- private get selection();
1100
- private setSelection;
1101
1141
  private triggerChange;
1102
- private selectionBySymbol;
1103
- private selectionByIndex;
1104
- private switchDateSegment;
1105
- private modifyDateSegmentValue;
1142
+ private onChange;
1143
+ private initKendoDate;
1106
1144
  }
1107
1145
 
1108
1146
  /** @hidden */
@@ -1941,9 +1979,6 @@ export declare class DateRangePickerWithoutContext extends React_2.Component<Dat
1941
1979
  disabled: PropTypes.Requireable<boolean>;
1942
1980
  spinners: PropTypes.Requireable<boolean>;
1943
1981
  name: PropTypes.Requireable<string>;
1944
- /**
1945
- * @hidden
1946
- */
1947
1982
  dir: PropTypes.Requireable<string>;
1948
1983
  label: PropTypes.Requireable<string>;
1949
1984
  id: PropTypes.Requireable<string>;
@@ -10,7 +10,7 @@ const e = {
10
10
  name: "@progress/kendo-react-dateinputs",
11
11
  productName: "KendoReact",
12
12
  productCodes: ["KENDOUIREACT", "KENDOUICOMPLETE"],
13
- publishDate: 1729596460,
13
+ publishDate: 1729694300,
14
14
  version: "",
15
15
  licensingDocsUrl: "https://www.telerik.com/kendo-react-ui/components/my-license/?utm_medium=product&utm_source=kendoreact&utm_campaign=kendo-ui-react-purchase-license-keys-warning"
16
16
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@progress/kendo-react-dateinputs",
3
- "version": "9.0.0-develop.5",
3
+ "version": "9.0.0-develop.7",
4
4
  "description": "React DateInput is a perfect input component for handling quick and efficient date values. KendoReact Date Inputs package",
5
5
  "author": "Progress",
6
6
  "license": "SEE LICENSE IN LICENSE.md",
@@ -24,12 +24,13 @@
24
24
  "peerDependencies": {
25
25
  "@progress/kendo-date-math": "^1.4.0",
26
26
  "@progress/kendo-licensing": "^1.3.4",
27
- "@progress/kendo-react-buttons": "9.0.0-develop.5",
28
- "@progress/kendo-react-common": "9.0.0-develop.5",
29
- "@progress/kendo-react-intl": "9.0.0-develop.5",
30
- "@progress/kendo-react-labels": "9.0.0-develop.5",
31
- "@progress/kendo-react-layout": "9.0.0-develop.5",
32
- "@progress/kendo-react-popup": "9.0.0-develop.5",
27
+ "@progress/kendo-dateinputs-common": "0.3.5",
28
+ "@progress/kendo-react-buttons": "9.0.0-develop.7",
29
+ "@progress/kendo-react-common": "9.0.0-develop.7",
30
+ "@progress/kendo-react-intl": "9.0.0-develop.7",
31
+ "@progress/kendo-react-labels": "9.0.0-develop.7",
32
+ "@progress/kendo-react-layout": "9.0.0-develop.7",
33
+ "@progress/kendo-react-popup": "9.0.0-develop.7",
33
34
  "@progress/kendo-svg-icons": "^3.0.0",
34
35
  "react": "^16.8.2 || ^17.0.0 || ^18.0.0",
35
36
  "react-dom": "^16.8.2 || ^17.0.0 || ^18.0.0"
@@ -1,8 +0,0 @@
1
- /**
2
- * @license
3
- *-------------------------------------------------------------------------------------------
4
- * Copyright © 2024 Progress Software Corporation. All rights reserved.
5
- * Licensed under commercial license. See LICENSE.md in the package root for more information
6
- *-------------------------------------------------------------------------------------------
7
- */
8
- "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("@progress/kendo-date-math"),p=require("./mask.js"),M=require("../utils.js");class y{constructor(t,e,s){this.year=!0,this.month=!0,this.date=!0,this.hours=!0,this.minutes=!0,this.seconds=!0,this.milliseconds=!0,this.leadingZero=null,this.typedMonthPart="",this.knownParts="adHhmMsEy",this.symbols={E:"E",H:"H",M:"M",a:"a",d:"d",h:"h",m:"m",s:"s",y:"y"},this._value=r.getDate(new Date),this.intlProvider=t,this.formatPlaceholder=e,this.format=s,this.monthNames=this.allFormatedMonths()}get intl(){return this.intlProvider()}get value(){return this._value}setValue(t){t?r.isEqual(t,this._value)||(this._value=r.cloneDate(t),this.modifyExisting(!0)):(this._value=r.getDate(new Date),this.modifyExisting(!1))}hasValue(){const t=(e,s)=>e||s.type!=="literal"&&s.type!=="dayperiod"&&this.getExisting(s.pattern[0]);return this.intl.splitDateFormat(this.format).reduce(t,!1)}getDateObject(){for(let t=0;t<this.knownParts.length;t++)if(!this.getExisting(this.knownParts[t]))return null;return r.cloneDate(this.value)}getTextAndFormat(){return this.merge(this.intl.formatDate(this.value,this.format),this.dateFormatString(this.value,this.format))}modifyExisting(t){const e=this.dateFormatString(this.value,this.format).symbols;for(let s=0;s<e.length;s++)this.setExisting(e[s],t)}getExisting(t){switch(t){case"y":return this.year;case"M":case"L":return this.month;case"d":return this.date;case"E":return this.date&&this.month&&this.year;case"h":case"H":return this.hours;case"m":return this.minutes;case"s":return this.seconds;default:return!0}}setExisting(t,e){switch(t){case"y":this.year=e,e===!1&&this._value.setFullYear(2e3);break;case"M":this.month=e,e===!1&&this._value.setMonth(0);break;case"d":this.date=e;break;case"h":case"H":this.hours=e;break;case"m":this.minutes=e;break;case"s":this.seconds=e;break;default:return}}modifyPart(t,e){let s=r.cloneDate(this.value);switch(t){case"y":s.setFullYear(s.getFullYear()+e);break;case"M":s=r.addMonths(this.value,e);break;case"d":case"E":s.setDate(s.getDate()+e);break;case"h":case"H":s.setHours(s.getHours()+e);break;case"m":s.setMinutes(s.getMinutes()+e);break;case"s":s.setSeconds(s.getSeconds()+e);break;case"a":s.setHours(s.getHours()+12*e);break}this.setExisting(t,!0),this._value=s}parsePart(t,e){if(this.resetLeadingZero(),!e)return this.setExisting(t,!1),{value:null};const s=this.intl.formatDate(this.value,this.format),n=this.dateFormatString(this.value,this.format),h=n.symbols;let i=!1,l="",o="",m="";for(let u=0;u<s.length;u++)h[u]===t?(o+=this.getExisting(t)?s[u]:"0",i=!0):i?m+=s[u]:l+=s[u];let a=null;const c=this.matchMonth(e);for(;o.length>0&&o.charAt(0)==="0";)o=o.slice(1);o.length>=4&&(o="");for(let u=0;u<2;u++){const g=o+e,f=parseInt(g,10);if(a=this.intl.parseDate(l+g+m,this.format),!a&&!isNaN(f)&&!isNaN(parseInt(e,10))){if(t==="M"&&!c){const d=f-1;d>-1&&d<12&&(a=r.cloneDate(this.value),a.setMonth(d),a.getMonth()!==d&&(a=r.lastDayOfMonth(r.addMonths(a,-1))))}t==="y"&&(a=r.createDate(parseInt(g,10),this.month?this.value.getMonth():0,this.date?this.value.getDate():1,this.hours?this.value.getHours():0,this.minutes?this.value.getMinutes():0,this.seconds?this.value.getSeconds():0,this.milliseconds?this.value.getMilliseconds():0),this.date&&a.getDate()!==this.value.getDate()&&(a=r.lastDayOfMonth(r.addMonths(a,-1))))}if(a)return this._value=a,this.setExisting(t,!0),{value:this.value};o=""}return c&&(a=this.intl.parseDate(l+c+m,this.format),a)?(this._value=a,this.setExisting(t,!0),{value:this.value}):(e==="0"&&(this.leadingZero=this.isAbbrMonth(n.partMap,t)?null:{[t]:!0},this.setExisting(t,!1)),{value:null})}symbolMap(t){return this.intl.splitDateFormat(this.format).reduce(M.dateSymbolMap,{})[t]}resetLeadingZero(){const t=this.leadingZero!==null;return this.leadingZero=null,t}isAbbrMonth(t,e){const s=this.partPattern(t,e);return s.type==="month"&&s.names}partPattern(t,e){return t.filter(s=>s.pattern.indexOf(e)!==-1)[0]}matchMonth(t){if(this.typedMonthPart+=t.toLowerCase(),this.monthNames.length===0)return"";for(;this.typedMonthPart.length>0;){for(let s=0;s<this.monthNames.length;s++)if(this.monthNames[s].toLowerCase().indexOf(this.typedMonthPart)===0)return this.monthNames[s];const e=parseInt(this.typedMonthPart,10);if(e>=1&&e<=12&&e.toString()===this.typedMonthPart)return this.monthNames[e-1];this.typedMonthPart=this.typedMonthPart.substring(1,this.typedMonthPart.length)}return""}allFormatedMonths(){const t=this.intl.splitDateFormat(this.format);for(let e=0;e<t.length;e++)if(t[e].type==="month"&&t[e].names)return this.intl.dateFormatNames(t[e].names);return[]}dateFormatString(t,e){const s=this.intl.splitDateFormat(e),n=[],h=[];for(let l=0;l<s.length;l++){let o=this.intl.formatDate(t,{pattern:s[l].pattern}).length;for(;o>0;)n.push(this.symbols[s[l].pattern[0]]||"_"),h.push(s[l]),o--}const i=new p.Mask;return i.symbols=n.join(""),i.partMap=h,i}merge(t,e){let s="",n="";const h=e.symbols;for(let i=h.length-1;i>=0;i--)if(this.knownParts.indexOf(h[i])===-1||this.getExisting(h[i]))s=t[i]+s,n=h[i]+n;else{const l=h[i];for(;i>=0&&l===h[i];)i--;for(i++,this.leadingZero&&this.leadingZero[l]?s="0"+s:s=this.dateFieldName(e.partMap[i])+s;n.length<s.length;)n=h[i]+n}return{text:s,format:n}}dateFieldName(t){const e=this.formatPlaceholder||"wide";return e[t.type]?e[t.type]:e==="formatPattern"?t.pattern:this.intl.dateFieldName(Object.assign(t,{nameType:e}))}}exports.KendoDate=y;
@@ -1,234 +0,0 @@
1
- /**
2
- * @license
3
- *-------------------------------------------------------------------------------------------
4
- * Copyright © 2024 Progress Software Corporation. All rights reserved.
5
- * Licensed under commercial license. See LICENSE.md in the package root for more information
6
- *-------------------------------------------------------------------------------------------
7
- */
8
- "use client";
9
- import { getDate as M, isEqual as v, cloneDate as m, addMonths as f, lastDayOfMonth as y, createDate as P } from "@progress/kendo-date-math";
10
- import { Mask as x } from "./mask.mjs";
11
- import { dateSymbolMap as D } from "../utils.mjs";
12
- class k {
13
- constructor(t, e, s) {
14
- this.year = !0, this.month = !0, this.date = !0, this.hours = !0, this.minutes = !0, this.seconds = !0, this.milliseconds = !0, this.leadingZero = null, this.typedMonthPart = "", this.knownParts = "adHhmMsEy", this.symbols = {
15
- E: "E",
16
- H: "H",
17
- M: "M",
18
- a: "a",
19
- d: "d",
20
- h: "h",
21
- m: "m",
22
- s: "s",
23
- y: "y"
24
- }, this._value = M(/* @__PURE__ */ new Date()), this.intlProvider = t, this.formatPlaceholder = e, this.format = s, this.monthNames = this.allFormatedMonths();
25
- }
26
- get intl() {
27
- return this.intlProvider();
28
- }
29
- get value() {
30
- return this._value;
31
- }
32
- setValue(t) {
33
- t ? v(t, this._value) || (this._value = m(t), this.modifyExisting(!0)) : (this._value = M(/* @__PURE__ */ new Date()), this.modifyExisting(!1));
34
- }
35
- hasValue() {
36
- const t = (e, s) => e || s.type !== "literal" && s.type !== "dayperiod" && this.getExisting(s.pattern[0]);
37
- return this.intl.splitDateFormat(this.format).reduce(t, !1);
38
- }
39
- getDateObject() {
40
- for (let t = 0; t < this.knownParts.length; t++)
41
- if (!this.getExisting(this.knownParts[t]))
42
- return null;
43
- return m(this.value);
44
- }
45
- getTextAndFormat() {
46
- return this.merge(
47
- this.intl.formatDate(this.value, this.format),
48
- this.dateFormatString(this.value, this.format)
49
- );
50
- }
51
- modifyExisting(t) {
52
- const e = this.dateFormatString(this.value, this.format).symbols;
53
- for (let s = 0; s < e.length; s++)
54
- this.setExisting(e[s], t);
55
- }
56
- getExisting(t) {
57
- switch (t) {
58
- case "y":
59
- return this.year;
60
- case "M":
61
- case "L":
62
- return this.month;
63
- case "d":
64
- return this.date;
65
- case "E":
66
- return this.date && this.month && this.year;
67
- case "h":
68
- case "H":
69
- return this.hours;
70
- case "m":
71
- return this.minutes;
72
- case "s":
73
- return this.seconds;
74
- default:
75
- return !0;
76
- }
77
- }
78
- setExisting(t, e) {
79
- switch (t) {
80
- case "y":
81
- this.year = e, e === !1 && this._value.setFullYear(2e3);
82
- break;
83
- case "M":
84
- this.month = e, e === !1 && this._value.setMonth(0);
85
- break;
86
- case "d":
87
- this.date = e;
88
- break;
89
- case "h":
90
- case "H":
91
- this.hours = e;
92
- break;
93
- case "m":
94
- this.minutes = e;
95
- break;
96
- case "s":
97
- this.seconds = e;
98
- break;
99
- default:
100
- return;
101
- }
102
- }
103
- modifyPart(t, e) {
104
- let s = m(this.value);
105
- switch (t) {
106
- case "y":
107
- s.setFullYear(s.getFullYear() + e);
108
- break;
109
- case "M":
110
- s = f(this.value, e);
111
- break;
112
- case "d":
113
- case "E":
114
- s.setDate(s.getDate() + e);
115
- break;
116
- case "h":
117
- case "H":
118
- s.setHours(s.getHours() + e);
119
- break;
120
- case "m":
121
- s.setMinutes(s.getMinutes() + e);
122
- break;
123
- case "s":
124
- s.setSeconds(s.getSeconds() + e);
125
- break;
126
- case "a":
127
- s.setHours(s.getHours() + 12 * e);
128
- break;
129
- }
130
- this.setExisting(t, !0), this._value = s;
131
- }
132
- parsePart(t, e) {
133
- if (this.resetLeadingZero(), !e)
134
- return this.setExisting(t, !1), { value: null };
135
- const s = this.intl.formatDate(this.value, this.format), r = this.dateFormatString(this.value, this.format), n = r.symbols;
136
- let i = !1, h = "", l = "", d = "";
137
- for (let o = 0; o < s.length; o++)
138
- n[o] === t ? (l += this.getExisting(t) ? s[o] : "0", i = !0) : i ? d += s[o] : h += s[o];
139
- let a = null;
140
- const c = this.matchMonth(e);
141
- for (; l.length > 0 && l.charAt(0) === "0"; )
142
- l = l.slice(1);
143
- l.length >= 4 && (l = "");
144
- for (let o = 0; o < 2; o++) {
145
- const g = l + e, p = parseInt(g, 10);
146
- if (a = this.intl.parseDate(h + g + d, this.format), !a && !isNaN(p) && !isNaN(parseInt(e, 10))) {
147
- if (t === "M" && !c) {
148
- const u = p - 1;
149
- u > -1 && u < 12 && (a = m(this.value), a.setMonth(u), a.getMonth() !== u && (a = y(f(a, -1))));
150
- }
151
- t === "y" && (a = P(
152
- parseInt(g, 10),
153
- this.month ? this.value.getMonth() : 0,
154
- this.date ? this.value.getDate() : 1,
155
- this.hours ? this.value.getHours() : 0,
156
- this.minutes ? this.value.getMinutes() : 0,
157
- this.seconds ? this.value.getSeconds() : 0,
158
- this.milliseconds ? this.value.getMilliseconds() : 0
159
- ), this.date && a.getDate() !== this.value.getDate() && (a = y(f(a, -1))));
160
- }
161
- if (a)
162
- return this._value = a, this.setExisting(t, !0), { value: this.value };
163
- l = "";
164
- }
165
- return c && (a = this.intl.parseDate(h + c + d, this.format), a) ? (this._value = a, this.setExisting(t, !0), { value: this.value }) : (e === "0" && (this.leadingZero = this.isAbbrMonth(r.partMap, t) ? null : { [t]: !0 }, this.setExisting(t, !1)), { value: null });
166
- }
167
- symbolMap(t) {
168
- return this.intl.splitDateFormat(this.format).reduce(D, {})[t];
169
- }
170
- resetLeadingZero() {
171
- const t = this.leadingZero !== null;
172
- return this.leadingZero = null, t;
173
- }
174
- isAbbrMonth(t, e) {
175
- const s = this.partPattern(t, e);
176
- return s.type === "month" && s.names;
177
- }
178
- partPattern(t, e) {
179
- return t.filter((s) => s.pattern.indexOf(e) !== -1)[0];
180
- }
181
- matchMonth(t) {
182
- if (this.typedMonthPart += t.toLowerCase(), this.monthNames.length === 0)
183
- return "";
184
- for (; this.typedMonthPart.length > 0; ) {
185
- for (let s = 0; s < this.monthNames.length; s++)
186
- if (this.monthNames[s].toLowerCase().indexOf(this.typedMonthPart) === 0)
187
- return this.monthNames[s];
188
- const e = parseInt(this.typedMonthPart, 10);
189
- if (e >= 1 && e <= 12 && e.toString() === this.typedMonthPart)
190
- return this.monthNames[e - 1];
191
- this.typedMonthPart = this.typedMonthPart.substring(1, this.typedMonthPart.length);
192
- }
193
- return "";
194
- }
195
- allFormatedMonths() {
196
- const t = this.intl.splitDateFormat(this.format);
197
- for (let e = 0; e < t.length; e++)
198
- if (t[e].type === "month" && t[e].names)
199
- return this.intl.dateFormatNames(t[e].names);
200
- return [];
201
- }
202
- dateFormatString(t, e) {
203
- const s = this.intl.splitDateFormat(e), r = [], n = [];
204
- for (let h = 0; h < s.length; h++) {
205
- let l = this.intl.formatDate(t, { pattern: s[h].pattern }).length;
206
- for (; l > 0; )
207
- r.push(this.symbols[s[h].pattern[0]] || "_"), n.push(s[h]), l--;
208
- }
209
- const i = new x();
210
- return i.symbols = r.join(""), i.partMap = n, i;
211
- }
212
- merge(t, e) {
213
- let s = "", r = "";
214
- const n = e.symbols;
215
- for (let i = n.length - 1; i >= 0; i--)
216
- if (this.knownParts.indexOf(n[i]) === -1 || this.getExisting(n[i]))
217
- s = t[i] + s, r = n[i] + r;
218
- else {
219
- const h = n[i];
220
- for (; i >= 0 && h === n[i]; )
221
- i--;
222
- for (i++, this.leadingZero && this.leadingZero[h] ? s = "0" + s : s = this.dateFieldName(e.partMap[i]) + s; r.length < s.length; )
223
- r = n[i] + r;
224
- }
225
- return { text: s, format: r };
226
- }
227
- dateFieldName(t) {
228
- const e = this.formatPlaceholder || "wide";
229
- return e[t.type] ? e[t.type] : e === "formatPattern" ? t.pattern : this.intl.dateFieldName(Object.assign(t, { nameType: e }));
230
- }
231
- }
232
- export {
233
- k as KendoDate
234
- };
@@ -1,8 +0,0 @@
1
- /**
2
- * @license
3
- *-------------------------------------------------------------------------------------------
4
- * Copyright © 2024 Progress Software Corporation. All rights reserved.
5
- * Licensed under commercial license. See LICENSE.md in the package root for more information
6
- *-------------------------------------------------------------------------------------------
7
- */
8
- "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});class s{constructor(){this.symbols="",this.partMap=[]}}exports.Mask=s;