@pisell/date-picker 1.0.20 → 1.0.22

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.
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import { Dayjs } from "dayjs";
2
3
  import "./index.less";
3
4
  interface ActionBarProps {
@@ -13,7 +13,7 @@ export interface PisellDateRangePickerProps {
13
13
  [key: string]: any;
14
14
  };
15
15
  placeholder?: string;
16
- disableDate?: (day: Dayjs, position: "start" | "end") => boolean;
16
+ disabledDate?: (day: Dayjs, position: "start" | "end", value: Dayjs[]) => boolean;
17
17
  format?: string;
18
18
  suffixIcon?: React.ReactNode;
19
19
  bordered?: boolean;
@@ -34,7 +34,7 @@ var PisellDateRangePicker = function PisellDateRangePicker(props) {
34
34
  className = props.className,
35
35
  showTime = props.showTime,
36
36
  placeholder = props.placeholder,
37
- disableDate = props.disableDate,
37
+ disabledDate = props.disabledDate,
38
38
  format = props.format,
39
39
  defaultValue = props.defaultValue,
40
40
  suffixIcon = props.suffixIcon,
@@ -97,9 +97,10 @@ var PisellDateRangePicker = function PisellDateRangePicker(props) {
97
97
  }
98
98
  setValue(newVal);
99
99
  };
100
+ var hasPreset = (_presets === null || _presets === void 0 ? void 0 : _presets.length) > 0;
100
101
  useCssVariables({
101
102
  variables: {
102
- '--pisell-date-range-picker-popup-width': "".concat(popupWidth, "px")
103
+ "--pisell-date-range-picker-popup-width": "".concat(hasPreset ? popupWidth + 192 : popupWidth, "px")
103
104
  },
104
105
  dom: document.body
105
106
  });
@@ -118,7 +119,9 @@ var PisellDateRangePicker = function PisellDateRangePicker(props) {
118
119
  onChange: handleChange,
119
120
  onOpen: handleOpen,
120
121
  open: open,
121
- shouldDisableDate: disableDate,
122
+ shouldDisableDate: function shouldDisableDate(current, position) {
123
+ return disabledDate === null || disabledDate === void 0 ? void 0 : disabledDate(current, position, _value);
124
+ },
122
125
  slots: {
123
126
  actionBar: ActionBar,
124
127
  shortcuts: Shortcuts,
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import "./index.less";
2
3
  import { Dayjs } from "dayjs";
3
4
  export declare type PresetType = {
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import { DateOrTimeViewWithMeridiem } from '@mui/x-date-pickers/internals/models';
2
3
  import { DateRangeCalendarProps } from '../DateRangeCalendar';
3
4
  export interface DateRangeViewRendererProps<TDate, TView extends DateOrTimeViewWithMeridiem> extends DateRangeCalendarProps<TDate> {
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import { DateOrTimeViewWithMeridiem } from '@mui/x-date-pickers/internals/models';
2
3
  import { UseDesktopRangePickerParams, UseDesktopRangePickerProps } from './useDesktopRangePicker.types';
3
4
  export declare const useDesktopRangePicker: <TDate, TView extends DateOrTimeViewWithMeridiem, TExternalProps extends UseDesktopRangePickerProps<TDate, TView, any, TExternalProps>>({ props, ...pickerParams }: UseDesktopRangePickerParams<TDate, TView, TExternalProps>) => {
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import { DateOrTimeViewWithMeridiem } from '@mui/x-date-pickers/internals/models';
2
3
  import { UseMobileRangePickerParams, UseMobileRangePickerProps } from './useMobileRangePicker.types';
3
4
  export declare const useMobileRangePicker: <TDate, TView extends DateOrTimeViewWithMeridiem, TExternalProps extends UseMobileRangePickerProps<TDate, TView, any, TExternalProps>>({ props, ...pickerParams }: UseMobileRangePickerParams<TDate, TView, TExternalProps>) => {
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import { DateOrTimeViewWithMeridiem } from '@mui/x-date-pickers/internals/models';
2
3
  import { UseStaticRangePickerParams, UseStaticRangePickerProps } from './useStaticRangePicker.types';
3
4
  /**
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import { Dayjs } from "dayjs";
2
3
  import "./index.less";
3
4
  interface ActionBarProps {
@@ -13,7 +13,7 @@ export interface PisellDateRangePickerProps {
13
13
  [key: string]: any;
14
14
  };
15
15
  placeholder?: string;
16
- disableDate?: (day: Dayjs, position: "start" | "end") => boolean;
16
+ disabledDate?: (day: Dayjs, position: "start" | "end", value: Dayjs[]) => boolean;
17
17
  format?: string;
18
18
  suffixIcon?: React.ReactNode;
19
19
  bordered?: boolean;
@@ -58,7 +58,7 @@ var PisellDateRangePicker = (props) => {
58
58
  className,
59
59
  showTime,
60
60
  placeholder,
61
- disableDate,
61
+ disabledDate,
62
62
  format,
63
63
  defaultValue,
64
64
  suffixIcon,
@@ -116,9 +116,10 @@ var PisellDateRangePicker = (props) => {
116
116
  }
117
117
  setValue(newVal);
118
118
  };
119
+ const hasPreset = (_presets == null ? void 0 : _presets.length) > 0;
119
120
  (0, import_useCssVariables.default)({
120
121
  variables: {
121
- "--pisell-date-range-picker-popup-width": `${popupWidth}px`
122
+ "--pisell-date-range-picker-popup-width": `${hasPreset ? popupWidth + 192 : popupWidth}px`
122
123
  },
123
124
  dom: document.body
124
125
  });
@@ -140,7 +141,7 @@ var PisellDateRangePicker = (props) => {
140
141
  onChange: handleChange,
141
142
  onOpen: handleOpen,
142
143
  open,
143
- shouldDisableDate: disableDate,
144
+ shouldDisableDate: (current, position) => disabledDate == null ? void 0 : disabledDate(current, position, _value),
144
145
  slots: {
145
146
  actionBar: import_ActionBar.default,
146
147
  shortcuts: import_Shortcuts.default,
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import "./index.less";
2
3
  import { Dayjs } from "dayjs";
3
4
  export declare type PresetType = {
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import { DateOrTimeViewWithMeridiem } from '@mui/x-date-pickers/internals/models';
2
3
  import { DateRangeCalendarProps } from '../DateRangeCalendar';
3
4
  export interface DateRangeViewRendererProps<TDate, TView extends DateOrTimeViewWithMeridiem> extends DateRangeCalendarProps<TDate> {
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import { DateOrTimeViewWithMeridiem } from '@mui/x-date-pickers/internals/models';
2
3
  import { UseDesktopRangePickerParams, UseDesktopRangePickerProps } from './useDesktopRangePicker.types';
3
4
  export declare const useDesktopRangePicker: <TDate, TView extends DateOrTimeViewWithMeridiem, TExternalProps extends UseDesktopRangePickerProps<TDate, TView, any, TExternalProps>>({ props, ...pickerParams }: UseDesktopRangePickerParams<TDate, TView, TExternalProps>) => {
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import { DateOrTimeViewWithMeridiem } from '@mui/x-date-pickers/internals/models';
2
3
  import { UseMobileRangePickerParams, UseMobileRangePickerProps } from './useMobileRangePicker.types';
3
4
  export declare const useMobileRangePicker: <TDate, TView extends DateOrTimeViewWithMeridiem, TExternalProps extends UseMobileRangePickerProps<TDate, TView, any, TExternalProps>>({ props, ...pickerParams }: UseMobileRangePickerParams<TDate, TView, TExternalProps>) => {
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import { DateOrTimeViewWithMeridiem } from '@mui/x-date-pickers/internals/models';
2
3
  import { UseStaticRangePickerParams, UseStaticRangePickerProps } from './useStaticRangePicker.types';
3
4
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pisell/date-picker",
3
- "version": "1.0.20",
3
+ "version": "1.0.22",
4
4
  "sideEffects": [
5
5
  "*.less"
6
6
  ],