@pisell/date-picker 1.0.68 → 1.0.69

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.
@@ -17,6 +17,7 @@ import 'dayjs/locale/zh-cn';
17
17
  import 'dayjs/locale/en';
18
18
  import 'dayjs/locale/zh-tw';
19
19
  import "./index.less";
20
+ import { isMobile } from "../utils";
20
21
  var transDayjsArr = function transDayjsArr(dayjsArr, defaultValue) {
21
22
  var _newArr;
22
23
  var newArr = dayjsArr || defaultValue || [null, null];
@@ -95,6 +96,7 @@ var PisellDateRangePicker = function PisellDateRangePicker(props) {
95
96
  propsOnChange === null || propsOnChange === void 0 ? void 0 : propsOnChange(_value);
96
97
  };
97
98
  var _presets = useMemo(function () {
99
+ if (isMobile()) return [];
98
100
  return presets.map(function (item) {
99
101
  var getValue = function getValue() {
100
102
  if (typeof item.getValue === "function") {
@@ -216,6 +218,9 @@ var PisellDateRangePicker = function PisellDateRangePicker(props) {
216
218
  disablePortal: disablePortal,
217
219
  placement: placement
218
220
  },
221
+ dialog: {
222
+ disablePortal: disablePortal
223
+ },
219
224
  mobilePaper: {
220
225
  className: popupClassName
221
226
  }
@@ -5,7 +5,7 @@ export declare const splitDateRangeSections: (sections: RangeFieldSection[]) =>
5
5
  };
6
6
  export declare const removeLastSeparator: (dateSections: RangeFieldSection[]) => (RangeFieldSection | {
7
7
  separator: null;
8
- dateName: "end" | "start";
8
+ dateName: "start" | "end";
9
9
  value: string;
10
10
  format: string;
11
11
  maxLength: number | null;
@@ -1 +1,3 @@
1
1
  export declare const getCurrentLocale: () => string;
2
+ export declare const isBrowser: boolean;
3
+ export declare const isMobile: () => boolean;
package/es/utils/index.js CHANGED
@@ -1,5 +1,13 @@
1
+ import { isMobile as isMobileUtils } from "@pisell/utils";
1
2
  export var getCurrentLocale = function getCurrentLocale() {
2
3
  var locale = localStorage.getItem('umi_locale') || 'en-US';
3
4
  //@ts-ignore
4
5
  return locale;
6
+ };
7
+ export var isBrowser = !!(typeof window !== 'undefined' && window.document && window.document.createElement);
8
+ export var isMobile = function isMobile() {
9
+ if (isBrowser) {
10
+ return window.innerWidth <= 768 || isMobileUtils();
11
+ }
12
+ return isMobileUtils();
5
13
  };
@@ -45,6 +45,7 @@ var import_zh_cn = require("dayjs/locale/zh-cn");
45
45
  var import_en = require("dayjs/locale/en");
46
46
  var import_zh_tw = require("dayjs/locale/zh-tw");
47
47
  var import_index = require("./index.less");
48
+ var import_utils2 = require("../utils");
48
49
  var transDayjsArr = (dayjsArr, defaultValue) => {
49
50
  let newArr = dayjsArr || defaultValue || [null, null];
50
51
  if ((dayjsArr == null ? void 0 : dayjsArr.length) === 0) {
@@ -112,6 +113,8 @@ var PisellDateRangePicker = (props) => {
112
113
  propsOnChange == null ? void 0 : propsOnChange(_value);
113
114
  };
114
115
  const _presets = (0, import_react.useMemo)(() => {
116
+ if ((0, import_utils2.isMobile)())
117
+ return [];
115
118
  return presets.map((item) => {
116
119
  const getValue = () => {
117
120
  if (typeof item.getValue === "function") {
@@ -233,6 +236,9 @@ var PisellDateRangePicker = (props) => {
233
236
  disablePortal,
234
237
  placement
235
238
  },
239
+ dialog: {
240
+ disablePortal
241
+ },
236
242
  mobilePaper: {
237
243
  className: popupClassName
238
244
  }
@@ -5,7 +5,7 @@ export declare const splitDateRangeSections: (sections: RangeFieldSection[]) =>
5
5
  };
6
6
  export declare const removeLastSeparator: (dateSections: RangeFieldSection[]) => (RangeFieldSection | {
7
7
  separator: null;
8
- dateName: "end" | "start";
8
+ dateName: "start" | "end";
9
9
  value: string;
10
10
  format: string;
11
11
  maxLength: number | null;
@@ -1 +1,3 @@
1
1
  export declare const getCurrentLocale: () => string;
2
+ export declare const isBrowser: boolean;
3
+ export declare const isMobile: () => boolean;
@@ -19,14 +19,26 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
19
19
  // src/utils/index.ts
20
20
  var utils_exports = {};
21
21
  __export(utils_exports, {
22
- getCurrentLocale: () => getCurrentLocale
22
+ getCurrentLocale: () => getCurrentLocale,
23
+ isBrowser: () => isBrowser,
24
+ isMobile: () => isMobile
23
25
  });
24
26
  module.exports = __toCommonJS(utils_exports);
27
+ var import_utils = require("@pisell/utils");
25
28
  var getCurrentLocale = () => {
26
29
  let locale = localStorage.getItem("umi_locale") || "en-US";
27
30
  return locale;
28
31
  };
32
+ var isBrowser = !!(typeof window !== "undefined" && window.document && window.document.createElement);
33
+ var isMobile = () => {
34
+ if (isBrowser) {
35
+ return window.innerWidth <= 768 || (0, import_utils.isMobile)();
36
+ }
37
+ return (0, import_utils.isMobile)();
38
+ };
29
39
  // Annotate the CommonJS export names for ESM import in node:
30
40
  0 && (module.exports = {
31
- getCurrentLocale
41
+ getCurrentLocale,
42
+ isBrowser,
43
+ isMobile
32
44
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pisell/date-picker",
3
- "version": "1.0.68",
3
+ "version": "1.0.69",
4
4
  "sideEffects": [
5
5
  "*.less"
6
6
  ],