antd-mobile 5.9.1 → 5.9.2

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.
@@ -13,11 +13,22 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
13
13
 
14
14
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
15
15
 
16
+ const precisionLengthRecord = {
17
+ year: 1,
18
+ month: 2,
19
+ day: 3,
20
+ hour: 4,
21
+ minute: 5,
22
+ second: 6
23
+ };
24
+
16
25
  const convertDateToStringArray = (date, precision) => {
17
26
  if (precision.includes('week')) {
18
27
  return weekUtils.convertDateToStringArray(date);
19
28
  } else {
20
- return dateUtils.convertDateToStringArray(date);
29
+ const datePrecision = precision;
30
+ const stringArray = dateUtils.convertDateToStringArray(date);
31
+ return stringArray.slice(0, precisionLengthRecord[datePrecision]);
21
32
  }
22
33
  };
23
34
 
@@ -1,4 +1,4 @@
1
- import { FC } from 'react';
1
+ import React, { FC } from 'react';
2
2
  import { NativeProps } from '../../utils/native-props';
3
3
  import { PropagationEvent } from '../../utils/with-stop-propagation';
4
4
  export declare type EllipsisProps = {
@@ -8,5 +8,6 @@ export declare type EllipsisProps = {
8
8
  expandText?: string;
9
9
  collapseText?: string;
10
10
  stopPropagationForActionButtons?: PropagationEvent[];
11
+ onContentClick?: (e: React.MouseEvent<HTMLDivElement, MouseEvent>) => void;
11
12
  } & NativeProps;
12
13
  export declare const Ellipsis: FC<EllipsisProps>;
@@ -27,7 +27,8 @@ const defaultProps = {
27
27
  rows: 1,
28
28
  expandText: '',
29
29
  collapseText: '',
30
- stopPropagationForActionButtons: []
30
+ stopPropagationForActionButtons: [],
31
+ onContentClick: () => {}
31
32
  };
32
33
 
33
34
  const Ellipsis = p => {
@@ -162,7 +163,12 @@ const Ellipsis = p => {
162
163
 
163
164
  return (0, _nativeProps.withNativeProps)(props, _react.default.createElement("div", {
164
165
  ref: rootRef,
165
- className: classPrefix
166
+ className: classPrefix,
167
+ onClick: e => {
168
+ if (e.target === e.currentTarget) {
169
+ props.onContentClick(e);
170
+ }
171
+ }
166
172
  }, renderContent()));
167
173
  };
168
174
 
@@ -1,10 +1,20 @@
1
1
  import * as dateUtils from './date-picker-date-utils';
2
2
  import * as weekUtils from './date-picker-week-utils';
3
+ const precisionLengthRecord = {
4
+ year: 1,
5
+ month: 2,
6
+ day: 3,
7
+ hour: 4,
8
+ minute: 5,
9
+ second: 6
10
+ };
3
11
  export const convertDateToStringArray = (date, precision) => {
4
12
  if (precision.includes('week')) {
5
13
  return weekUtils.convertDateToStringArray(date);
6
14
  } else {
7
- return dateUtils.convertDateToStringArray(date);
15
+ const datePrecision = precision;
16
+ const stringArray = dateUtils.convertDateToStringArray(date);
17
+ return stringArray.slice(0, precisionLengthRecord[datePrecision]);
8
18
  }
9
19
  };
10
20
  export const convertStringArrayToDate = (value, precision) => {
@@ -1,4 +1,4 @@
1
- import { FC } from 'react';
1
+ import React, { FC } from 'react';
2
2
  import { NativeProps } from '../../utils/native-props';
3
3
  import { PropagationEvent } from '../../utils/with-stop-propagation';
4
4
  export declare type EllipsisProps = {
@@ -8,5 +8,6 @@ export declare type EllipsisProps = {
8
8
  expandText?: string;
9
9
  collapseText?: string;
10
10
  stopPropagationForActionButtons?: PropagationEvent[];
11
+ onContentClick?: (e: React.MouseEvent<HTMLDivElement, MouseEvent>) => void;
11
12
  } & NativeProps;
12
13
  export declare const Ellipsis: FC<EllipsisProps>;
@@ -10,7 +10,8 @@ const defaultProps = {
10
10
  rows: 1,
11
11
  expandText: '',
12
12
  collapseText: '',
13
- stopPropagationForActionButtons: []
13
+ stopPropagationForActionButtons: [],
14
+ onContentClick: () => {}
14
15
  };
15
16
  export const Ellipsis = p => {
16
17
  const props = mergeProps(defaultProps, p);
@@ -144,7 +145,12 @@ export const Ellipsis = p => {
144
145
 
145
146
  return withNativeProps(props, React.createElement("div", {
146
147
  ref: rootRef,
147
- className: classPrefix
148
+ className: classPrefix,
149
+ onClick: e => {
150
+ if (e.target === e.currentTarget) {
151
+ props.onContentClick(e);
152
+ }
153
+ }
148
154
  }, renderContent()));
149
155
  };
150
156
 
package/2x/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "antd-mobile",
3
- "version": "5.9.1",
3
+ "version": "5.9.2",
4
4
  "dependencies": {
5
5
  "@floating-ui/dom": "^0.4.2",
6
6
  "@react-spring/web": "^9.4.4",
@@ -37,6 +37,8 @@
37
37
  },
38
38
  "./es": "./es/index.js",
39
39
  "./cjs": "./cjs/index.js",
40
+ "./es/utils/*": "./es/utils/*.js",
41
+ "./es/*": "./es/*/index.js",
40
42
  "./es/": "./es/",
41
43
  "./cjs/": "./cjs/",
42
44
  "./bundle/": "./bundle/",
@@ -11270,11 +11270,21 @@ function convertStringArrayToDate$1(value) {
11270
11270
  const day = dayjs__default["default"]().year(parseInt(yearString)).isoWeek(parseInt(weekString)).isoWeekday(parseInt(weekdayString)).hour(0).minute(0).second(0);
11271
11271
  return day.toDate();
11272
11272
  }
11273
+ const precisionLengthRecord = {
11274
+ year: 1,
11275
+ month: 2,
11276
+ day: 3,
11277
+ hour: 4,
11278
+ minute: 5,
11279
+ second: 6
11280
+ };
11273
11281
  const convertDateToStringArray = (date, precision) => {
11274
11282
  if (precision.includes("week")) {
11275
11283
  return convertDateToStringArray$1(date);
11276
11284
  } else {
11277
- return convertDateToStringArray$2(date);
11285
+ const datePrecision = precision;
11286
+ const stringArray = convertDateToStringArray$2(date);
11287
+ return stringArray.slice(0, precisionLengthRecord[datePrecision]);
11278
11288
  }
11279
11289
  };
11280
11290
  const convertStringArrayToDate = (value, precision) => {
@@ -11870,7 +11880,9 @@ const defaultProps$C = {
11870
11880
  rows: 1,
11871
11881
  expandText: "",
11872
11882
  collapseText: "",
11873
- stopPropagationForActionButtons: []
11883
+ stopPropagationForActionButtons: [],
11884
+ onContentClick: () => {
11885
+ }
11874
11886
  };
11875
11887
  const Ellipsis = (p) => {
11876
11888
  const props = mergeProps(defaultProps$C, p);
@@ -11989,7 +12001,12 @@ const Ellipsis = (p) => {
11989
12001
  };
11990
12002
  return withNativeProps(props, React__default["default"].createElement("div", {
11991
12003
  ref: rootRef,
11992
- className: classPrefix$O
12004
+ className: classPrefix$O,
12005
+ onClick: (e) => {
12006
+ if (e.target === e.currentTarget) {
12007
+ props.onContentClick(e);
12008
+ }
12009
+ }
11993
12010
  }, renderContent()));
11994
12011
  };
11995
12012
  function pxToNumber(value) {
@@ -11261,11 +11261,21 @@ function convertStringArrayToDate$1(value) {
11261
11261
  const day = dayjs().year(parseInt(yearString)).isoWeek(parseInt(weekString)).isoWeekday(parseInt(weekdayString)).hour(0).minute(0).second(0);
11262
11262
  return day.toDate();
11263
11263
  }
11264
+ const precisionLengthRecord = {
11265
+ year: 1,
11266
+ month: 2,
11267
+ day: 3,
11268
+ hour: 4,
11269
+ minute: 5,
11270
+ second: 6
11271
+ };
11264
11272
  const convertDateToStringArray = (date, precision) => {
11265
11273
  if (precision.includes("week")) {
11266
11274
  return convertDateToStringArray$1(date);
11267
11275
  } else {
11268
- return convertDateToStringArray$2(date);
11276
+ const datePrecision = precision;
11277
+ const stringArray = convertDateToStringArray$2(date);
11278
+ return stringArray.slice(0, precisionLengthRecord[datePrecision]);
11269
11279
  }
11270
11280
  };
11271
11281
  const convertStringArrayToDate = (value, precision) => {
@@ -11861,7 +11871,9 @@ const defaultProps$C = {
11861
11871
  rows: 1,
11862
11872
  expandText: "",
11863
11873
  collapseText: "",
11864
- stopPropagationForActionButtons: []
11874
+ stopPropagationForActionButtons: [],
11875
+ onContentClick: () => {
11876
+ }
11865
11877
  };
11866
11878
  const Ellipsis = (p) => {
11867
11879
  const props = mergeProps(defaultProps$C, p);
@@ -11980,7 +11992,12 @@ const Ellipsis = (p) => {
11980
11992
  };
11981
11993
  return withNativeProps(props, React$1.createElement("div", {
11982
11994
  ref: rootRef,
11983
- className: classPrefix$O
11995
+ className: classPrefix$O,
11996
+ onClick: (e) => {
11997
+ if (e.target === e.currentTarget) {
11998
+ props.onContentClick(e);
11999
+ }
12000
+ }
11984
12001
  }, renderContent()));
11985
12002
  };
11986
12003
  function pxToNumber(value) {
@@ -13,11 +13,22 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
13
13
 
14
14
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
15
15
 
16
+ const precisionLengthRecord = {
17
+ year: 1,
18
+ month: 2,
19
+ day: 3,
20
+ hour: 4,
21
+ minute: 5,
22
+ second: 6
23
+ };
24
+
16
25
  const convertDateToStringArray = (date, precision) => {
17
26
  if (precision.includes('week')) {
18
27
  return weekUtils.convertDateToStringArray(date);
19
28
  } else {
20
- return dateUtils.convertDateToStringArray(date);
29
+ const datePrecision = precision;
30
+ const stringArray = dateUtils.convertDateToStringArray(date);
31
+ return stringArray.slice(0, precisionLengthRecord[datePrecision]);
21
32
  }
22
33
  };
23
34
 
@@ -1,4 +1,4 @@
1
- import { FC } from 'react';
1
+ import React, { FC } from 'react';
2
2
  import { NativeProps } from '../../utils/native-props';
3
3
  import { PropagationEvent } from '../../utils/with-stop-propagation';
4
4
  export declare type EllipsisProps = {
@@ -8,5 +8,6 @@ export declare type EllipsisProps = {
8
8
  expandText?: string;
9
9
  collapseText?: string;
10
10
  stopPropagationForActionButtons?: PropagationEvent[];
11
+ onContentClick?: (e: React.MouseEvent<HTMLDivElement, MouseEvent>) => void;
11
12
  } & NativeProps;
12
13
  export declare const Ellipsis: FC<EllipsisProps>;
@@ -27,7 +27,8 @@ const defaultProps = {
27
27
  rows: 1,
28
28
  expandText: '',
29
29
  collapseText: '',
30
- stopPropagationForActionButtons: []
30
+ stopPropagationForActionButtons: [],
31
+ onContentClick: () => {}
31
32
  };
32
33
 
33
34
  const Ellipsis = p => {
@@ -162,7 +163,12 @@ const Ellipsis = p => {
162
163
 
163
164
  return (0, _nativeProps.withNativeProps)(props, _react.default.createElement("div", {
164
165
  ref: rootRef,
165
- className: classPrefix
166
+ className: classPrefix,
167
+ onClick: e => {
168
+ if (e.target === e.currentTarget) {
169
+ props.onContentClick(e);
170
+ }
171
+ }
166
172
  }, renderContent()));
167
173
  };
168
174
 
@@ -1,10 +1,20 @@
1
1
  import * as dateUtils from './date-picker-date-utils';
2
2
  import * as weekUtils from './date-picker-week-utils';
3
+ const precisionLengthRecord = {
4
+ year: 1,
5
+ month: 2,
6
+ day: 3,
7
+ hour: 4,
8
+ minute: 5,
9
+ second: 6
10
+ };
3
11
  export const convertDateToStringArray = (date, precision) => {
4
12
  if (precision.includes('week')) {
5
13
  return weekUtils.convertDateToStringArray(date);
6
14
  } else {
7
- return dateUtils.convertDateToStringArray(date);
15
+ const datePrecision = precision;
16
+ const stringArray = dateUtils.convertDateToStringArray(date);
17
+ return stringArray.slice(0, precisionLengthRecord[datePrecision]);
8
18
  }
9
19
  };
10
20
  export const convertStringArrayToDate = (value, precision) => {
@@ -1,4 +1,4 @@
1
- import { FC } from 'react';
1
+ import React, { FC } from 'react';
2
2
  import { NativeProps } from '../../utils/native-props';
3
3
  import { PropagationEvent } from '../../utils/with-stop-propagation';
4
4
  export declare type EllipsisProps = {
@@ -8,5 +8,6 @@ export declare type EllipsisProps = {
8
8
  expandText?: string;
9
9
  collapseText?: string;
10
10
  stopPropagationForActionButtons?: PropagationEvent[];
11
+ onContentClick?: (e: React.MouseEvent<HTMLDivElement, MouseEvent>) => void;
11
12
  } & NativeProps;
12
13
  export declare const Ellipsis: FC<EllipsisProps>;
@@ -10,7 +10,8 @@ const defaultProps = {
10
10
  rows: 1,
11
11
  expandText: '',
12
12
  collapseText: '',
13
- stopPropagationForActionButtons: []
13
+ stopPropagationForActionButtons: [],
14
+ onContentClick: () => {}
14
15
  };
15
16
  export const Ellipsis = p => {
16
17
  const props = mergeProps(defaultProps, p);
@@ -144,7 +145,12 @@ export const Ellipsis = p => {
144
145
 
145
146
  return withNativeProps(props, React.createElement("div", {
146
147
  ref: rootRef,
147
- className: classPrefix
148
+ className: classPrefix,
149
+ onClick: e => {
150
+ if (e.target === e.currentTarget) {
151
+ props.onContentClick(e);
152
+ }
153
+ }
148
154
  }, renderContent()));
149
155
  };
150
156
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "antd-mobile",
3
- "version": "5.9.1",
3
+ "version": "5.9.2",
4
4
  "dependencies": {
5
5
  "@floating-ui/dom": "^0.4.2",
6
6
  "@react-spring/web": "^9.4.4",
@@ -37,6 +37,8 @@
37
37
  },
38
38
  "./es": "./es/index.js",
39
39
  "./cjs": "./cjs/index.js",
40
+ "./es/utils/*": "./es/utils/*.js",
41
+ "./es/*": "./es/*/index.js",
40
42
  "./es/": "./es/",
41
43
  "./cjs/": "./cjs/",
42
44
  "./bundle/": "./bundle/",