@bifrostui/react 1.4.7-beta.0 → 1.4.8-beta.0
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/dist/DatePicker/DatePicker.d.ts +1 -1
- package/dist/DatePicker/DatePicker.js +22 -22
- package/dist/DatePicker/DatePicker.types.d.ts +1 -8
- package/dist/DatePicker/DatePicker.types.js +0 -20
- package/dist/DatePicker/constants.d.ts +9 -0
- package/dist/DatePicker/constants.js +37 -0
- package/dist/DatePicker/index.d.ts +1 -0
- package/dist/DatePicker/index.js +3 -0
- package/dist/DesktopDatePicker/DesktopDatePicker.types.d.ts +1 -1
- package/dist/DesktopDateTimePicker/DesktopDateTimePicker.types.d.ts +1 -1
- package/dist/DesktopTimePicker/DesktopTimePicker.types.d.ts +1 -1
- package/dist/DesktopTimePicker/useGetTimePickerContent.js +5 -2
- package/dist/Modal/Modal.miniapp.d.ts +1 -1
- package/dist/SwipeAction/SwipeAction.js +11 -11
- package/dist/SwipeAction/SwipeAction.types.d.ts +1 -9
- package/dist/SwipeAction/SwipeAction.types.js +0 -24
- package/dist/SwipeAction/constants.d.ts +9 -0
- package/dist/SwipeAction/constants.js +39 -0
- package/dist/SwipeAction/index.d.ts +1 -0
- package/dist/SwipeAction/index.js +5 -0
- package/es/DatePicker/DatePicker.js +1 -3
- package/es/DatePicker/DatePicker.types.d.ts +1 -8
- package/es/DatePicker/constants.d.ts +9 -0
- package/es/DatePicker/constants.js +14 -0
- package/es/DatePicker/index.d.ts +1 -0
- package/es/DatePicker/index.js +2 -0
- package/es/DesktopDatePicker/DesktopDatePicker.types.d.ts +1 -1
- package/es/DesktopDateTimePicker/DesktopDateTimePicker.types.d.ts +1 -1
- package/es/DesktopTimePicker/DesktopTimePicker.types.d.ts +1 -1
- package/es/DesktopTimePicker/useGetTimePickerContent.js +5 -2
- package/es/SwipeAction/SwipeAction.js +1 -4
- package/es/SwipeAction/SwipeAction.types.d.ts +1 -9
- package/es/SwipeAction/constants.d.ts +9 -0
- package/es/SwipeAction/constants.js +15 -0
- package/es/SwipeAction/index.d.ts +1 -0
- package/es/SwipeAction/index.js +3 -0
- package/package.json +5 -5
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { DatePickerProps } from './DatePicker.types';
|
|
3
|
-
declare const DatePicker: React.ForwardRefExoticComponent<Omit<DatePickerProps<"div", Omit<import("../Picker").PickerProps<"div", import("..").DrawerProps>, "defaultValue" | "
|
|
3
|
+
declare const DatePicker: React.ForwardRefExoticComponent<Omit<DatePickerProps<"div", Omit<import("../Picker").PickerProps<"div", import("..").DrawerProps>, "defaultValue" | "onChange" | "value" | "onClose" | "onConfirm">>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
4
4
|
export default DatePicker;
|
|
@@ -62,15 +62,15 @@ module.exports = __toCommonJS(DatePicker_exports);
|
|
|
62
62
|
var import_react = __toESM(require("react"));
|
|
63
63
|
var import_clsx = __toESM(require("clsx"));
|
|
64
64
|
var import_utils = require("@bifrostui/utils");
|
|
65
|
-
var import_DatePicker = require("./DatePicker.types");
|
|
66
65
|
var import_Picker = __toESM(require("../Picker"));
|
|
67
66
|
var import_locales = require("../locales");
|
|
67
|
+
var import_constants = require("./constants");
|
|
68
68
|
const MIN_DATE = new Date((/* @__PURE__ */ new Date()).getFullYear() - 10, 0, 1);
|
|
69
69
|
const MAX_DATE = new Date((/* @__PURE__ */ new Date()).getFullYear() + 10, 11, 31);
|
|
70
70
|
const DEFAULT_PICKER = [
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
71
|
+
import_constants.DatePickerType.YEAR,
|
|
72
|
+
import_constants.DatePickerType.MONTH,
|
|
73
|
+
import_constants.DatePickerType.DAY
|
|
74
74
|
];
|
|
75
75
|
function isValidDate(value) {
|
|
76
76
|
return value instanceof Date && !Number.isNaN(value.getTime());
|
|
@@ -87,17 +87,17 @@ const getMaxDay = (year, monthIndex) => {
|
|
|
87
87
|
};
|
|
88
88
|
const getDateTypeValue = (date, type) => {
|
|
89
89
|
switch (type) {
|
|
90
|
-
case
|
|
90
|
+
case import_constants.DatePickerType.YEAR:
|
|
91
91
|
return date.getFullYear();
|
|
92
|
-
case
|
|
92
|
+
case import_constants.DatePickerType.MONTH:
|
|
93
93
|
return date.getMonth() + 1;
|
|
94
|
-
case
|
|
94
|
+
case import_constants.DatePickerType.DAY:
|
|
95
95
|
return date.getDate();
|
|
96
|
-
case
|
|
96
|
+
case import_constants.DatePickerType.HOUR:
|
|
97
97
|
return date.getHours();
|
|
98
|
-
case
|
|
98
|
+
case import_constants.DatePickerType.MINUTE:
|
|
99
99
|
return date.getMinutes();
|
|
100
|
-
case
|
|
100
|
+
case import_constants.DatePickerType.SECOND:
|
|
101
101
|
return date.getSeconds();
|
|
102
102
|
default:
|
|
103
103
|
throw new Error(`\u9519\u8BEF\u7684picker\u7C7B\u578B\uFF1A${type}`);
|
|
@@ -163,10 +163,10 @@ const DatePicker = (0, import_react.forwardRef)((props, ref) => {
|
|
|
163
163
|
return;
|
|
164
164
|
const current = new Date(currentDate);
|
|
165
165
|
switch (views[columnIndex]) {
|
|
166
|
-
case
|
|
166
|
+
case import_constants.DatePickerType.YEAR:
|
|
167
167
|
current.setFullYear(value[columnIndex]);
|
|
168
168
|
break;
|
|
169
|
-
case
|
|
169
|
+
case import_constants.DatePickerType.MONTH: {
|
|
170
170
|
const selectedMaxDay = getMaxDay(
|
|
171
171
|
current.getFullYear(),
|
|
172
172
|
Number(value[columnIndex]) - 1
|
|
@@ -177,16 +177,16 @@ const DatePicker = (0, import_react.forwardRef)((props, ref) => {
|
|
|
177
177
|
current.setMonth(value[columnIndex] - 1);
|
|
178
178
|
break;
|
|
179
179
|
}
|
|
180
|
-
case
|
|
180
|
+
case import_constants.DatePickerType.DAY:
|
|
181
181
|
current.setDate(value[columnIndex]);
|
|
182
182
|
break;
|
|
183
|
-
case
|
|
183
|
+
case import_constants.DatePickerType.HOUR:
|
|
184
184
|
current.setHours(value[columnIndex]);
|
|
185
185
|
break;
|
|
186
|
-
case
|
|
186
|
+
case import_constants.DatePickerType.MINUTE:
|
|
187
187
|
current.setMinutes(value[columnIndex]);
|
|
188
188
|
break;
|
|
189
|
-
case
|
|
189
|
+
case import_constants.DatePickerType.SECOND:
|
|
190
190
|
current.setSeconds(value[columnIndex]);
|
|
191
191
|
break;
|
|
192
192
|
default:
|
|
@@ -287,22 +287,22 @@ const DatePicker = (0, import_react.forwardRef)((props, ref) => {
|
|
|
287
287
|
for (let i = 0; i < views.length; i += 1) {
|
|
288
288
|
const type = views[i];
|
|
289
289
|
switch (type) {
|
|
290
|
-
case
|
|
290
|
+
case import_constants.DatePickerType.YEAR:
|
|
291
291
|
ranges.push([minYear, maxYear]);
|
|
292
292
|
break;
|
|
293
|
-
case
|
|
293
|
+
case import_constants.DatePickerType.MONTH:
|
|
294
294
|
ranges.push([minMonth, maxMonth]);
|
|
295
295
|
break;
|
|
296
|
-
case
|
|
296
|
+
case import_constants.DatePickerType.DAY:
|
|
297
297
|
ranges.push([minDate, maxDate]);
|
|
298
298
|
break;
|
|
299
|
-
case
|
|
299
|
+
case import_constants.DatePickerType.HOUR:
|
|
300
300
|
ranges.push([minHour, maxHour]);
|
|
301
301
|
break;
|
|
302
|
-
case
|
|
302
|
+
case import_constants.DatePickerType.MINUTE:
|
|
303
303
|
ranges.push([minMinute, maxMinute]);
|
|
304
304
|
break;
|
|
305
|
-
case
|
|
305
|
+
case import_constants.DatePickerType.SECOND:
|
|
306
306
|
ranges.push([minSeconds, maxSeconds]);
|
|
307
307
|
break;
|
|
308
308
|
default:
|
|
@@ -1,14 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { OverrideProps } from '@bifrostui/types';
|
|
3
3
|
import { PickerProps, IPickerOptionItem } from '../Picker';
|
|
4
|
-
|
|
5
|
-
YEAR = "year",
|
|
6
|
-
MONTH = "month",
|
|
7
|
-
DAY = "day",
|
|
8
|
-
HOUR = "hour",
|
|
9
|
-
MINUTE = "minute",
|
|
10
|
-
SECOND = "second"
|
|
11
|
-
}
|
|
4
|
+
import { DatePickerType } from './constants';
|
|
12
5
|
export type DatePickerOption = IPickerOptionItem & {
|
|
13
6
|
value: number;
|
|
14
7
|
};
|
|
@@ -2,10 +2,6 @@ var __defProp = Object.defineProperty;
|
|
|
2
2
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
3
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
4
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
-
var __export = (target, all) => {
|
|
6
|
-
for (var name in all)
|
|
7
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
-
};
|
|
9
5
|
var __copyProps = (to, from, except, desc) => {
|
|
10
6
|
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
7
|
for (let key of __getOwnPropNames(from))
|
|
@@ -16,20 +12,4 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
16
12
|
};
|
|
17
13
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
14
|
var DatePicker_types_exports = {};
|
|
19
|
-
__export(DatePicker_types_exports, {
|
|
20
|
-
DatePickerType: () => DatePickerType
|
|
21
|
-
});
|
|
22
15
|
module.exports = __toCommonJS(DatePicker_types_exports);
|
|
23
|
-
var DatePickerType = /* @__PURE__ */ ((DatePickerType2) => {
|
|
24
|
-
DatePickerType2["YEAR"] = "year";
|
|
25
|
-
DatePickerType2["MONTH"] = "month";
|
|
26
|
-
DatePickerType2["DAY"] = "day";
|
|
27
|
-
DatePickerType2["HOUR"] = "hour";
|
|
28
|
-
DatePickerType2["MINUTE"] = "minute";
|
|
29
|
-
DatePickerType2["SECOND"] = "second";
|
|
30
|
-
return DatePickerType2;
|
|
31
|
-
})(DatePickerType || {});
|
|
32
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
33
|
-
0 && (module.exports = {
|
|
34
|
-
DatePickerType
|
|
35
|
-
});
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
var constants_exports = {};
|
|
19
|
+
__export(constants_exports, {
|
|
20
|
+
DatePickerType: () => DatePickerType,
|
|
21
|
+
default: () => constants_default
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(constants_exports);
|
|
24
|
+
var DatePickerType = /* @__PURE__ */ ((DatePickerType2) => {
|
|
25
|
+
DatePickerType2["YEAR"] = "year";
|
|
26
|
+
DatePickerType2["MONTH"] = "month";
|
|
27
|
+
DatePickerType2["DAY"] = "day";
|
|
28
|
+
DatePickerType2["HOUR"] = "hour";
|
|
29
|
+
DatePickerType2["MINUTE"] = "minute";
|
|
30
|
+
DatePickerType2["SECOND"] = "second";
|
|
31
|
+
return DatePickerType2;
|
|
32
|
+
})(DatePickerType || {});
|
|
33
|
+
var constants_default = DatePickerType;
|
|
34
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
35
|
+
0 && (module.exports = {
|
|
36
|
+
DatePickerType
|
|
37
|
+
});
|
package/dist/DatePicker/index.js
CHANGED
|
@@ -29,13 +29,16 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
29
29
|
var DatePicker_exports = {};
|
|
30
30
|
__export(DatePicker_exports, {
|
|
31
31
|
DatePicker: () => import_DatePicker.default,
|
|
32
|
+
DatePickerType: () => import_constants.DatePickerType,
|
|
32
33
|
default: () => import_DatePicker.default
|
|
33
34
|
});
|
|
34
35
|
module.exports = __toCommonJS(DatePicker_exports);
|
|
35
36
|
var import_DatePicker = __toESM(require("./DatePicker"));
|
|
36
37
|
__reExport(DatePicker_exports, require("./DatePicker.types"), module.exports);
|
|
38
|
+
var import_constants = require("./constants");
|
|
37
39
|
// Annotate the CommonJS export names for ESM import in node:
|
|
38
40
|
0 && (module.exports = {
|
|
39
41
|
DatePicker,
|
|
42
|
+
DatePickerType,
|
|
40
43
|
...require("./DatePicker.types")
|
|
41
44
|
});
|
|
@@ -153,7 +153,7 @@ export type DesktopDatePickerProps<D extends React.ElementType = 'div', P = {}>
|
|
|
153
153
|
/**
|
|
154
154
|
* DesktopPickerProps
|
|
155
155
|
*/
|
|
156
|
-
DesktopPickerProps?: DesktopPickerProps
|
|
156
|
+
DesktopPickerProps?: Omit<DesktopPickerProps, 'open'>;
|
|
157
157
|
/**
|
|
158
158
|
* CalendarProps
|
|
159
159
|
*/
|
|
@@ -153,7 +153,7 @@ export type DateTimePickerProps<D extends React.ElementType = 'div', P = {}> = O
|
|
|
153
153
|
/**
|
|
154
154
|
* DesktopPickerProps
|
|
155
155
|
*/
|
|
156
|
-
DesktopPickerProps?: DesktopPickerProps
|
|
156
|
+
DesktopPickerProps?: Omit<DesktopPickerProps, 'open'>;
|
|
157
157
|
/**
|
|
158
158
|
* CalendarProps
|
|
159
159
|
*/
|
|
@@ -144,8 +144,11 @@ const useGetTimePickerContent = (props) => {
|
|
|
144
144
|
e.stopPropagation();
|
|
145
145
|
if (disabled || selectedValue === item.value)
|
|
146
146
|
return;
|
|
147
|
-
|
|
148
|
-
|
|
147
|
+
let validTime = timeValue;
|
|
148
|
+
if (!timeValue) {
|
|
149
|
+
const validMinTime = (0, import_utils.calculateValidMinTime)(disabledTimeView, minTime);
|
|
150
|
+
validTime = validMinTime;
|
|
151
|
+
}
|
|
149
152
|
const updateHour = (hour) => validTime.format("A") === "PM" ? hour + 12 : hour;
|
|
150
153
|
const getValidTimeValue = (view, newTimeValue) => {
|
|
151
154
|
var _a2, _b;
|
|
@@ -12,5 +12,5 @@ declare const Modal: React.ForwardRefExoticComponent<Omit<ViewProps & {
|
|
|
12
12
|
keepMounted?: boolean;
|
|
13
13
|
} & import("@bifrostui/types").ICommonProps & Omit<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
|
|
14
14
|
ref?: React.Ref<HTMLDivElement>;
|
|
15
|
-
}, keyof import("@bifrostui/types").ICommonProps | "
|
|
15
|
+
}, "open" | keyof import("@bifrostui/types").ICommonProps | "container" | "disablePortal" | "hideBackdrop" | "BackdropProps" | "onClose" | "disableScrollLock" | "keepMounted">, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
16
16
|
export default Modal;
|
|
@@ -80,7 +80,7 @@ var import_react = __toESM(require("react"));
|
|
|
80
80
|
var import_clsx = __toESM(require("clsx"));
|
|
81
81
|
var import_utils = require("@bifrostui/utils");
|
|
82
82
|
var import_SwipeActionContext = __toESM(require("./SwipeActionContext"));
|
|
83
|
-
var
|
|
83
|
+
var import_constants = require("./constants");
|
|
84
84
|
var import_SwipeAction2 = require("./SwipeAction.css");
|
|
85
85
|
const classPrefix = "bui-swipe-action";
|
|
86
86
|
const SwipeAction = /* @__PURE__ */ import_react.default.forwardRef(
|
|
@@ -115,7 +115,7 @@ const SwipeAction = /* @__PURE__ */ import_react.default.forwardRef(
|
|
|
115
115
|
const currentX = (0, import_react.useRef)(0);
|
|
116
116
|
const isDragging = (0, import_react.useRef)(false);
|
|
117
117
|
let pretranslateX = 0;
|
|
118
|
-
let dragPhase =
|
|
118
|
+
let dragPhase = import_constants.DragPhaseEnum.START;
|
|
119
119
|
const dragThreshold = 5;
|
|
120
120
|
const leftWidthCache = (0, import_react.useRef)(0);
|
|
121
121
|
const rightWidthCache = (0, import_react.useRef)(0);
|
|
@@ -151,7 +151,7 @@ const SwipeAction = /* @__PURE__ */ import_react.default.forwardRef(
|
|
|
151
151
|
getRightRefWidth();
|
|
152
152
|
};
|
|
153
153
|
const handleTouchStart = (e) => {
|
|
154
|
-
dragPhase =
|
|
154
|
+
dragPhase = import_constants.DragPhaseEnum.START;
|
|
155
155
|
const isMaskEle = e.target.id === "content-mask";
|
|
156
156
|
if (isDragging.current || disabled || isMaskEle)
|
|
157
157
|
return;
|
|
@@ -163,8 +163,8 @@ const SwipeAction = /* @__PURE__ */ import_react.default.forwardRef(
|
|
|
163
163
|
(e) => __async(void 0, null, function* () {
|
|
164
164
|
if (!isDragging.current || disabled)
|
|
165
165
|
return;
|
|
166
|
-
if (dragPhase ===
|
|
167
|
-
dragPhase =
|
|
166
|
+
if (dragPhase === import_constants.DragPhaseEnum.START) {
|
|
167
|
+
dragPhase = import_constants.DragPhaseEnum.MOVE;
|
|
168
168
|
}
|
|
169
169
|
touch.move(e);
|
|
170
170
|
currentX.current = touch.deltaX.current - startingX.current;
|
|
@@ -188,9 +188,9 @@ const SwipeAction = /* @__PURE__ */ import_react.default.forwardRef(
|
|
|
188
188
|
const shouldOpen = targetX > 0 && pretranslateX <= 0 || targetX < 0 && pretranslateX >= 0 || isSpecial;
|
|
189
189
|
if (shouldOpen) {
|
|
190
190
|
if (targetX > 0) {
|
|
191
|
-
resStr =
|
|
191
|
+
resStr = import_constants.SideTypeEnum.LEFT;
|
|
192
192
|
} else if (targetX < 0) {
|
|
193
|
-
resStr =
|
|
193
|
+
resStr = import_constants.SideTypeEnum.RIGHT;
|
|
194
194
|
}
|
|
195
195
|
setIsOpen(true);
|
|
196
196
|
} else {
|
|
@@ -203,8 +203,8 @@ const SwipeAction = /* @__PURE__ */ import_react.default.forwardRef(
|
|
|
203
203
|
const handleTouchEnd = (e) => __async(void 0, null, function* () {
|
|
204
204
|
if (!isDragging.current)
|
|
205
205
|
return;
|
|
206
|
-
if (dragPhase ===
|
|
207
|
-
dragPhase =
|
|
206
|
+
if (dragPhase === import_constants.DragPhaseEnum.MOVE) {
|
|
207
|
+
dragPhase = import_constants.DragPhaseEnum.END;
|
|
208
208
|
}
|
|
209
209
|
const leftWidth = yield getLefRefWidth();
|
|
210
210
|
const rightWidth = yield getRightRefWidth();
|
|
@@ -218,7 +218,7 @@ const SwipeAction = /* @__PURE__ */ import_react.default.forwardRef(
|
|
|
218
218
|
} else if (currentX.current < -rightWidth * threshold) {
|
|
219
219
|
targetX = -rightWidth;
|
|
220
220
|
}
|
|
221
|
-
if (dragPhase ===
|
|
221
|
+
if (dragPhase === import_constants.DragPhaseEnum.END || import_utils.isMini) {
|
|
222
222
|
emitActionsReveal(targetX);
|
|
223
223
|
console.log("handleTouchEnd\uFF1A", targetX, e);
|
|
224
224
|
setTranslateX(targetX);
|
|
@@ -266,7 +266,7 @@ const SwipeAction = /* @__PURE__ */ import_react.default.forwardRef(
|
|
|
266
266
|
(0, import_react.useImperativeHandle)(ref, () => ({
|
|
267
267
|
show: (params) => __async(void 0, null, function* () {
|
|
268
268
|
let targetX = 0;
|
|
269
|
-
if (params && params.side ===
|
|
269
|
+
if (params && params.side === import_constants.SideTypeEnum.RIGHT) {
|
|
270
270
|
targetX = -(yield getRightRefWidth());
|
|
271
271
|
} else {
|
|
272
272
|
targetX = yield getLefRefWidth();
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { OverrideProps, ThemeColor } from '@bifrostui/types';
|
|
2
2
|
import React from 'react';
|
|
3
|
+
import { SideTypeEnum } from './constants';
|
|
3
4
|
export type SwipeActionProps<D extends React.ElementType = 'div', P = {}> = OverrideProps<{
|
|
4
5
|
props: P & {
|
|
5
6
|
/**
|
|
@@ -71,13 +72,4 @@ export type SwipeActionRef = {
|
|
|
71
72
|
open: boolean;
|
|
72
73
|
ref?: HTMLDivElement;
|
|
73
74
|
};
|
|
74
|
-
export declare enum SideTypeEnum {
|
|
75
|
-
LEFT = "left",
|
|
76
|
-
RIGHT = "right"
|
|
77
|
-
}
|
|
78
|
-
export declare enum DragPhaseEnum {
|
|
79
|
-
START = 1,
|
|
80
|
-
MOVE = 2,
|
|
81
|
-
END = 3
|
|
82
|
-
}
|
|
83
75
|
export {};
|
|
@@ -2,10 +2,6 @@ var __defProp = Object.defineProperty;
|
|
|
2
2
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
3
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
4
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
-
var __export = (target, all) => {
|
|
6
|
-
for (var name in all)
|
|
7
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
-
};
|
|
9
5
|
var __copyProps = (to, from, except, desc) => {
|
|
10
6
|
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
7
|
for (let key of __getOwnPropNames(from))
|
|
@@ -16,24 +12,4 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
16
12
|
};
|
|
17
13
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
14
|
var SwipeAction_types_exports = {};
|
|
19
|
-
__export(SwipeAction_types_exports, {
|
|
20
|
-
DragPhaseEnum: () => DragPhaseEnum,
|
|
21
|
-
SideTypeEnum: () => SideTypeEnum
|
|
22
|
-
});
|
|
23
15
|
module.exports = __toCommonJS(SwipeAction_types_exports);
|
|
24
|
-
var SideTypeEnum = /* @__PURE__ */ ((SideTypeEnum2) => {
|
|
25
|
-
SideTypeEnum2["LEFT"] = "left";
|
|
26
|
-
SideTypeEnum2["RIGHT"] = "right";
|
|
27
|
-
return SideTypeEnum2;
|
|
28
|
-
})(SideTypeEnum || {});
|
|
29
|
-
var DragPhaseEnum = /* @__PURE__ */ ((DragPhaseEnum2) => {
|
|
30
|
-
DragPhaseEnum2[DragPhaseEnum2["START"] = 1] = "START";
|
|
31
|
-
DragPhaseEnum2[DragPhaseEnum2["MOVE"] = 2] = "MOVE";
|
|
32
|
-
DragPhaseEnum2[DragPhaseEnum2["END"] = 3] = "END";
|
|
33
|
-
return DragPhaseEnum2;
|
|
34
|
-
})(DragPhaseEnum || {});
|
|
35
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
36
|
-
0 && (module.exports = {
|
|
37
|
-
DragPhaseEnum,
|
|
38
|
-
SideTypeEnum
|
|
39
|
-
});
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
var constants_exports = {};
|
|
19
|
+
__export(constants_exports, {
|
|
20
|
+
DragPhaseEnum: () => DragPhaseEnum,
|
|
21
|
+
SideTypeEnum: () => SideTypeEnum
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(constants_exports);
|
|
24
|
+
var SideTypeEnum = /* @__PURE__ */ ((SideTypeEnum2) => {
|
|
25
|
+
SideTypeEnum2["LEFT"] = "left";
|
|
26
|
+
SideTypeEnum2["RIGHT"] = "right";
|
|
27
|
+
return SideTypeEnum2;
|
|
28
|
+
})(SideTypeEnum || {});
|
|
29
|
+
var DragPhaseEnum = /* @__PURE__ */ ((DragPhaseEnum2) => {
|
|
30
|
+
DragPhaseEnum2[DragPhaseEnum2["START"] = 1] = "START";
|
|
31
|
+
DragPhaseEnum2[DragPhaseEnum2["MOVE"] = 2] = "MOVE";
|
|
32
|
+
DragPhaseEnum2[DragPhaseEnum2["END"] = 3] = "END";
|
|
33
|
+
return DragPhaseEnum2;
|
|
34
|
+
})(DragPhaseEnum || {});
|
|
35
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
36
|
+
0 && (module.exports = {
|
|
37
|
+
DragPhaseEnum,
|
|
38
|
+
SideTypeEnum
|
|
39
|
+
});
|
|
@@ -28,6 +28,8 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
28
28
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
29
|
var SwipeAction_exports = {};
|
|
30
30
|
__export(SwipeAction_exports, {
|
|
31
|
+
DragPhaseEnum: () => import_constants.DragPhaseEnum,
|
|
32
|
+
SideTypeEnum: () => import_constants.SideTypeEnum,
|
|
31
33
|
SwipeAction: () => import_SwipeAction2.default,
|
|
32
34
|
SwipeActionItem: () => import_SwipeActionItem.default,
|
|
33
35
|
default: () => import_SwipeAction.default
|
|
@@ -37,8 +39,11 @@ __reExport(SwipeAction_exports, require("./SwipeAction.types"), module.exports);
|
|
|
37
39
|
var import_SwipeAction = __toESM(require("./SwipeAction"));
|
|
38
40
|
var import_SwipeAction2 = __toESM(require("./SwipeAction"));
|
|
39
41
|
var import_SwipeActionItem = __toESM(require("./SwipeActionItem"));
|
|
42
|
+
var import_constants = require("./constants");
|
|
40
43
|
// Annotate the CommonJS export names for ESM import in node:
|
|
41
44
|
0 && (module.exports = {
|
|
45
|
+
DragPhaseEnum,
|
|
46
|
+
SideTypeEnum,
|
|
42
47
|
SwipeAction,
|
|
43
48
|
SwipeActionItem,
|
|
44
49
|
...require("./SwipeAction.types")
|
|
@@ -32,11 +32,9 @@ var __objRest = (source, exclude) => {
|
|
|
32
32
|
import React, { forwardRef, useEffect, useState } from "react";
|
|
33
33
|
import clsx from "clsx";
|
|
34
34
|
import { useValue } from "@bifrostui/utils";
|
|
35
|
-
import {
|
|
36
|
-
DatePickerType
|
|
37
|
-
} from "./DatePicker.types";
|
|
38
35
|
import Picker from "../Picker";
|
|
39
36
|
import { useLocaleText } from "../locales";
|
|
37
|
+
import { DatePickerType } from "./constants";
|
|
40
38
|
const MIN_DATE = new Date((/* @__PURE__ */ new Date()).getFullYear() - 10, 0, 1);
|
|
41
39
|
const MAX_DATE = new Date((/* @__PURE__ */ new Date()).getFullYear() + 10, 11, 31);
|
|
42
40
|
const DEFAULT_PICKER = [
|
|
@@ -1,14 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { OverrideProps } from '@bifrostui/types';
|
|
3
3
|
import { PickerProps, IPickerOptionItem } from '../Picker';
|
|
4
|
-
|
|
5
|
-
YEAR = "year",
|
|
6
|
-
MONTH = "month",
|
|
7
|
-
DAY = "day",
|
|
8
|
-
HOUR = "hour",
|
|
9
|
-
MINUTE = "minute",
|
|
10
|
-
SECOND = "second"
|
|
11
|
-
}
|
|
4
|
+
import { DatePickerType } from './constants';
|
|
12
5
|
export type DatePickerOption = IPickerOptionItem & {
|
|
13
6
|
value: number;
|
|
14
7
|
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
var DatePickerType = /* @__PURE__ */ ((DatePickerType2) => {
|
|
2
|
+
DatePickerType2["YEAR"] = "year";
|
|
3
|
+
DatePickerType2["MONTH"] = "month";
|
|
4
|
+
DatePickerType2["DAY"] = "day";
|
|
5
|
+
DatePickerType2["HOUR"] = "hour";
|
|
6
|
+
DatePickerType2["MINUTE"] = "minute";
|
|
7
|
+
DatePickerType2["SECOND"] = "second";
|
|
8
|
+
return DatePickerType2;
|
|
9
|
+
})(DatePickerType || {});
|
|
10
|
+
var constants_default = DatePickerType;
|
|
11
|
+
export {
|
|
12
|
+
DatePickerType,
|
|
13
|
+
constants_default as default
|
|
14
|
+
};
|
package/es/DatePicker/index.d.ts
CHANGED
package/es/DatePicker/index.js
CHANGED
|
@@ -153,7 +153,7 @@ export type DesktopDatePickerProps<D extends React.ElementType = 'div', P = {}>
|
|
|
153
153
|
/**
|
|
154
154
|
* DesktopPickerProps
|
|
155
155
|
*/
|
|
156
|
-
DesktopPickerProps?: DesktopPickerProps
|
|
156
|
+
DesktopPickerProps?: Omit<DesktopPickerProps, 'open'>;
|
|
157
157
|
/**
|
|
158
158
|
* CalendarProps
|
|
159
159
|
*/
|
|
@@ -153,7 +153,7 @@ export type DateTimePickerProps<D extends React.ElementType = 'div', P = {}> = O
|
|
|
153
153
|
/**
|
|
154
154
|
* DesktopPickerProps
|
|
155
155
|
*/
|
|
156
|
-
DesktopPickerProps?: DesktopPickerProps
|
|
156
|
+
DesktopPickerProps?: Omit<DesktopPickerProps, 'open'>;
|
|
157
157
|
/**
|
|
158
158
|
* CalendarProps
|
|
159
159
|
*/
|
|
@@ -118,8 +118,11 @@ const useGetTimePickerContent = (props) => {
|
|
|
118
118
|
e.stopPropagation();
|
|
119
119
|
if (disabled || selectedValue === item.value)
|
|
120
120
|
return;
|
|
121
|
-
|
|
122
|
-
|
|
121
|
+
let validTime = timeValue;
|
|
122
|
+
if (!timeValue) {
|
|
123
|
+
const validMinTime = calculateValidMinTime(disabledTimeView, minTime);
|
|
124
|
+
validTime = validMinTime;
|
|
125
|
+
}
|
|
123
126
|
const updateHour = (hour) => validTime.format("A") === "PM" ? hour + 12 : hour;
|
|
124
127
|
const getValidTimeValue = (view, newTimeValue) => {
|
|
125
128
|
var _a2, _b;
|
|
@@ -62,10 +62,7 @@ import {
|
|
|
62
62
|
throttle
|
|
63
63
|
} from "@bifrostui/utils";
|
|
64
64
|
import BuiSwipeActionContext from "./SwipeActionContext";
|
|
65
|
-
import {
|
|
66
|
-
SideTypeEnum,
|
|
67
|
-
DragPhaseEnum
|
|
68
|
-
} from "./SwipeAction.types";
|
|
65
|
+
import { DragPhaseEnum, SideTypeEnum } from "./constants";
|
|
69
66
|
import "./SwipeAction.css";
|
|
70
67
|
const classPrefix = "bui-swipe-action";
|
|
71
68
|
const SwipeAction = /* @__PURE__ */ React.forwardRef(
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { OverrideProps, ThemeColor } from '@bifrostui/types';
|
|
2
2
|
import React from 'react';
|
|
3
|
+
import { SideTypeEnum } from './constants';
|
|
3
4
|
export type SwipeActionProps<D extends React.ElementType = 'div', P = {}> = OverrideProps<{
|
|
4
5
|
props: P & {
|
|
5
6
|
/**
|
|
@@ -71,13 +72,4 @@ export type SwipeActionRef = {
|
|
|
71
72
|
open: boolean;
|
|
72
73
|
ref?: HTMLDivElement;
|
|
73
74
|
};
|
|
74
|
-
export declare enum SideTypeEnum {
|
|
75
|
-
LEFT = "left",
|
|
76
|
-
RIGHT = "right"
|
|
77
|
-
}
|
|
78
|
-
export declare enum DragPhaseEnum {
|
|
79
|
-
START = 1,
|
|
80
|
-
MOVE = 2,
|
|
81
|
-
END = 3
|
|
82
|
-
}
|
|
83
75
|
export {};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
var SideTypeEnum = /* @__PURE__ */ ((SideTypeEnum2) => {
|
|
2
|
+
SideTypeEnum2["LEFT"] = "left";
|
|
3
|
+
SideTypeEnum2["RIGHT"] = "right";
|
|
4
|
+
return SideTypeEnum2;
|
|
5
|
+
})(SideTypeEnum || {});
|
|
6
|
+
var DragPhaseEnum = /* @__PURE__ */ ((DragPhaseEnum2) => {
|
|
7
|
+
DragPhaseEnum2[DragPhaseEnum2["START"] = 1] = "START";
|
|
8
|
+
DragPhaseEnum2[DragPhaseEnum2["MOVE"] = 2] = "MOVE";
|
|
9
|
+
DragPhaseEnum2[DragPhaseEnum2["END"] = 3] = "END";
|
|
10
|
+
return DragPhaseEnum2;
|
|
11
|
+
})(DragPhaseEnum || {});
|
|
12
|
+
export {
|
|
13
|
+
DragPhaseEnum,
|
|
14
|
+
SideTypeEnum
|
|
15
|
+
};
|
package/es/SwipeAction/index.js
CHANGED
|
@@ -2,7 +2,10 @@ export * from "./SwipeAction.types";
|
|
|
2
2
|
import { default as default2 } from "./SwipeAction";
|
|
3
3
|
import { default as default3 } from "./SwipeAction";
|
|
4
4
|
import { default as default4 } from "./SwipeActionItem";
|
|
5
|
+
import { SideTypeEnum, DragPhaseEnum } from "./constants";
|
|
5
6
|
export {
|
|
7
|
+
DragPhaseEnum,
|
|
8
|
+
SideTypeEnum,
|
|
6
9
|
default3 as SwipeAction,
|
|
7
10
|
default4 as SwipeActionItem,
|
|
8
11
|
default2 as default
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bifrostui/react",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.8-beta.0",
|
|
4
4
|
"description": "React components for building mobile application",
|
|
5
5
|
"homepage": "http://bui.taopiaopiao.com",
|
|
6
6
|
"license": "MIT",
|
|
@@ -33,10 +33,10 @@
|
|
|
33
33
|
"clsx": "^1.2.1",
|
|
34
34
|
"dayjs": "^1.11.7",
|
|
35
35
|
"swiper": "^8.1.5",
|
|
36
|
-
"@bifrostui/icons": "1.4.
|
|
37
|
-
"@bifrostui/
|
|
38
|
-
"@bifrostui/
|
|
39
|
-
"@bifrostui/utils": "1.4.
|
|
36
|
+
"@bifrostui/icons": "1.4.8-beta.0",
|
|
37
|
+
"@bifrostui/styles": "1.4.8-beta.0",
|
|
38
|
+
"@bifrostui/types": "1.4.8-beta.0",
|
|
39
|
+
"@bifrostui/utils": "1.4.8-beta.0"
|
|
40
40
|
},
|
|
41
41
|
"peerDependencies": {
|
|
42
42
|
"@tarojs/components": "^3.0.0",
|