@nickeylin/antd-mobile-pro 2.0.2 → 2.1.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/cjs/components/checkbox/checkbox.d.ts +1 -1
- package/dist/cjs/components/checkbox/index.d.ts +1 -1
- package/dist/cjs/components/index.d.ts +1 -0
- package/dist/cjs/components/index.js +3 -0
- package/dist/cjs/components/popup-page/popup-page.d.ts +1 -0
- package/dist/cjs/components/popup-page/popup-page.js +30 -6
- package/dist/cjs/components/popup-page/style.less +4 -0
- package/dist/cjs/components/pro-calendar/index.d.ts +10 -0
- package/dist/cjs/components/pro-calendar/index.js +42 -0
- package/dist/cjs/components/pro-calendar/pro-calendar.d.ts +37 -0
- package/dist/cjs/components/pro-calendar/pro-calendar.js +173 -0
- package/dist/cjs/components/pro-calendar/style.less +105 -0
- package/dist/cjs/components/pro-calendar/utils.d.ts +32 -0
- package/dist/cjs/components/pro-calendar/utils.js +175 -0
- package/dist/cjs/components/pro-calendar-picker/index.d.ts +3 -2
- package/dist/cjs/components/pro-calendar-picker/index.js +3 -2
- package/dist/cjs/components/pro-calendar-picker/pro-calendar-picker.d.ts +13 -0
- package/dist/cjs/components/pro-calendar-picker/pro-calendar-picker.js +141 -0
- package/dist/cjs/components/pro-calendar-picker/style.less +38 -0
- package/dist/cjs/components/pro-form/pro-form-item-calendar-picker.d.ts +1 -1
- package/dist/cjs/components/pro-form/pro-form-item-calendar-picker.js +12 -6
- package/dist/cjs/components/styles/global.less +6 -0
- package/dist/cjs/components/tree-picker/index.d.ts +1 -1
- package/dist/cjs/components/tree-picker/tree-picker.d.ts +1 -1
- package/dist/cjs/locales/base.d.ts +4 -0
- package/dist/cjs/locales/en-US.d.ts +4 -0
- package/dist/es/components/checkbox/checkbox.d.ts +1 -1
- package/dist/es/components/checkbox/index.d.ts +1 -1
- package/dist/es/components/index.d.ts +1 -0
- package/dist/es/components/index.js +1 -0
- package/dist/es/components/popup-page/popup-page.d.ts +1 -0
- package/dist/es/components/popup-page/popup-page.js +32 -11
- package/dist/es/components/popup-page/style.less +4 -0
- package/dist/es/components/pro-calendar/index.d.ts +10 -0
- package/dist/es/components/pro-calendar/index.js +8 -0
- package/dist/es/components/pro-calendar/pro-calendar.d.ts +37 -0
- package/dist/es/components/pro-calendar/pro-calendar.js +138 -0
- package/dist/es/components/pro-calendar/style.less +105 -0
- package/dist/es/components/pro-calendar/utils.d.ts +32 -0
- package/dist/es/components/pro-calendar/utils.js +138 -0
- package/dist/es/components/pro-calendar-picker/index.d.ts +3 -2
- package/dist/es/components/pro-calendar-picker/index.js +2 -1
- package/dist/es/components/pro-calendar-picker/pro-calendar-picker.d.ts +13 -0
- package/dist/es/components/pro-calendar-picker/pro-calendar-picker.js +124 -0
- package/dist/es/components/pro-calendar-picker/style.less +38 -0
- package/dist/es/components/pro-form/pro-form-item-calendar-picker.d.ts +1 -1
- package/dist/es/components/pro-form/pro-form-item-calendar-picker.js +8 -8
- package/dist/es/components/styles/global.less +6 -0
- package/dist/es/components/tree-picker/index.d.ts +1 -1
- package/dist/es/components/tree-picker/tree-picker.d.ts +1 -1
- package/dist/es/locales/base.d.ts +4 -0
- package/dist/es/locales/en-US.d.ts +4 -0
- package/dist/umd/antd-mobile-pro.min.css +1 -1
- package/dist/umd/antd-mobile-pro.min.js +1 -1
- package/package.json +3 -2
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
+
mod
|
|
26
|
+
));
|
|
27
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
|
+
|
|
29
|
+
// src/components/pro-calendar/utils.ts
|
|
30
|
+
var utils_exports = {};
|
|
31
|
+
__export(utils_exports, {
|
|
32
|
+
HALF_DAY_PERIOD: () => HALF_DAY_PERIOD,
|
|
33
|
+
HALF_DAY_PERIOD_NAMES: () => HALF_DAY_PERIOD_NAMES,
|
|
34
|
+
classesForDate: () => classesForDate,
|
|
35
|
+
computeDays: () => computeDays,
|
|
36
|
+
formatProCalendarDate: () => formatProCalendarDate,
|
|
37
|
+
formatProCalendarDateValues: () => formatProCalendarDateValues,
|
|
38
|
+
mergeDates: () => mergeDates
|
|
39
|
+
});
|
|
40
|
+
module.exports = __toCommonJS(utils_exports);
|
|
41
|
+
var import_dayjs = __toESM(require("dayjs"));
|
|
42
|
+
var HALF_DAY_PERIOD = /* @__PURE__ */ ((HALF_DAY_PERIOD2) => {
|
|
43
|
+
HALF_DAY_PERIOD2[HALF_DAY_PERIOD2["ALL"] = 0] = "ALL";
|
|
44
|
+
HALF_DAY_PERIOD2[HALF_DAY_PERIOD2["AM"] = 1] = "AM";
|
|
45
|
+
HALF_DAY_PERIOD2[HALF_DAY_PERIOD2["PM"] = 2] = "PM";
|
|
46
|
+
HALF_DAY_PERIOD2[HALF_DAY_PERIOD2["NIGHT"] = 3] = "NIGHT";
|
|
47
|
+
return HALF_DAY_PERIOD2;
|
|
48
|
+
})(HALF_DAY_PERIOD || {});
|
|
49
|
+
var HALF_DAY_PERIOD_NAMES = {
|
|
50
|
+
[0 /* ALL */]: "全天",
|
|
51
|
+
[1 /* AM */]: "上午",
|
|
52
|
+
[2 /* PM */]: "下午",
|
|
53
|
+
[3 /* NIGHT */]: "晚上"
|
|
54
|
+
};
|
|
55
|
+
function mergeDates(dates) {
|
|
56
|
+
const sortedDates = dates.slice().sort((a, b) => {
|
|
57
|
+
return (0, import_dayjs.default)(a).diff(b, "day");
|
|
58
|
+
});
|
|
59
|
+
const [begin, end] = sortedDates;
|
|
60
|
+
const beginDay = (0, import_dayjs.default)(begin);
|
|
61
|
+
if (beginDay.isSame(end, "day")) {
|
|
62
|
+
if (!begin.period || !end.period) {
|
|
63
|
+
begin.period = void 0;
|
|
64
|
+
return [end];
|
|
65
|
+
}
|
|
66
|
+
if (begin.period === end.period) {
|
|
67
|
+
return [begin];
|
|
68
|
+
}
|
|
69
|
+
if ([begin.period, end.period].includes(1 /* AM */)) {
|
|
70
|
+
begin.period = void 0;
|
|
71
|
+
return [begin];
|
|
72
|
+
}
|
|
73
|
+
return sortedDates;
|
|
74
|
+
}
|
|
75
|
+
if (begin.period === 1 /* AM */) {
|
|
76
|
+
begin.period = void 0;
|
|
77
|
+
}
|
|
78
|
+
if (end.period && end.period >= 2 /* PM */) {
|
|
79
|
+
end.period = void 0;
|
|
80
|
+
}
|
|
81
|
+
return [begin, end];
|
|
82
|
+
}
|
|
83
|
+
function classesForDate(date, rangeValue) {
|
|
84
|
+
const dd = (0, import_dayjs.default)(date);
|
|
85
|
+
const [begin, end] = rangeValue;
|
|
86
|
+
let isAm = false;
|
|
87
|
+
let isPm = false;
|
|
88
|
+
let isNight = false;
|
|
89
|
+
let isAllDay = false;
|
|
90
|
+
let isCover = false;
|
|
91
|
+
let isBegin = false;
|
|
92
|
+
let isEnd = false;
|
|
93
|
+
if (begin) {
|
|
94
|
+
if (dd.isSame(begin, "day")) {
|
|
95
|
+
isAm = begin.period === 1 /* AM */;
|
|
96
|
+
isPm = begin.period === 2 /* PM */;
|
|
97
|
+
isNight = begin.period === 3 /* NIGHT */;
|
|
98
|
+
isAllDay = !begin.period;
|
|
99
|
+
isBegin = true;
|
|
100
|
+
if (!end) {
|
|
101
|
+
isEnd = true;
|
|
102
|
+
} else if (!begin.period || begin.period === 1 /* AM */) {
|
|
103
|
+
isCover = true;
|
|
104
|
+
}
|
|
105
|
+
} else if (end && dd.isSame(end, "day")) {
|
|
106
|
+
isAm = end.period === 1 /* AM */;
|
|
107
|
+
isPm = end.period === 2 /* PM */;
|
|
108
|
+
isNight = end.period === 3 /* NIGHT */;
|
|
109
|
+
isAllDay = !end.period;
|
|
110
|
+
isEnd = true;
|
|
111
|
+
isCover = !!end.period && end.period >= 2 /* PM */;
|
|
112
|
+
} else if (end) {
|
|
113
|
+
isCover = dd.isAfter(begin, "day") && dd.isBefore(end, "day");
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
return {
|
|
117
|
+
am: isAm,
|
|
118
|
+
pm: isPm,
|
|
119
|
+
night: isNight,
|
|
120
|
+
allday: isAllDay,
|
|
121
|
+
begin: isBegin,
|
|
122
|
+
end: isEnd,
|
|
123
|
+
cover: isCover,
|
|
124
|
+
weekend: dd.day() === 0 || dd.day() === 6
|
|
125
|
+
};
|
|
126
|
+
}
|
|
127
|
+
function formatProCalendarDate(date) {
|
|
128
|
+
if (!date) {
|
|
129
|
+
return "";
|
|
130
|
+
}
|
|
131
|
+
const dateStr = (0, import_dayjs.default)(date).format("YYYY-MM-DD");
|
|
132
|
+
const periodStr = !date.period ? "" : HALF_DAY_PERIOD_NAMES[date.period];
|
|
133
|
+
return [dateStr, periodStr].filter((v) => !!v).join(" ");
|
|
134
|
+
}
|
|
135
|
+
function formatProCalendarDateValues(dates) {
|
|
136
|
+
if (!dates) {
|
|
137
|
+
return "";
|
|
138
|
+
}
|
|
139
|
+
const arr = Array.isArray(dates) ? dates : [dates];
|
|
140
|
+
return arr.map(formatProCalendarDate).join(" ~ ");
|
|
141
|
+
}
|
|
142
|
+
function computeDays(value) {
|
|
143
|
+
if (!value) {
|
|
144
|
+
return 0;
|
|
145
|
+
}
|
|
146
|
+
const rangeValue = Array.isArray(value) ? value : [value];
|
|
147
|
+
const [begin, end] = rangeValue;
|
|
148
|
+
if (!end) {
|
|
149
|
+
if (!begin.period)
|
|
150
|
+
return 1;
|
|
151
|
+
if (begin.period === 3 /* NIGHT */)
|
|
152
|
+
return 0;
|
|
153
|
+
return 0.5;
|
|
154
|
+
}
|
|
155
|
+
let days = (0, import_dayjs.default)(end).diff((0, import_dayjs.default)(begin), "day") + 1;
|
|
156
|
+
if (begin.period === 2 /* PM */) {
|
|
157
|
+
days -= 0.5;
|
|
158
|
+
} else if (begin.period === 3 /* NIGHT */) {
|
|
159
|
+
days -= 1;
|
|
160
|
+
}
|
|
161
|
+
if (end.period === 1 /* AM */) {
|
|
162
|
+
days -= 0.5;
|
|
163
|
+
}
|
|
164
|
+
return days;
|
|
165
|
+
}
|
|
166
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
167
|
+
0 && (module.exports = {
|
|
168
|
+
HALF_DAY_PERIOD,
|
|
169
|
+
HALF_DAY_PERIOD_NAMES,
|
|
170
|
+
classesForDate,
|
|
171
|
+
computeDays,
|
|
172
|
+
formatProCalendarDate,
|
|
173
|
+
formatProCalendarDateValues,
|
|
174
|
+
mergeDates
|
|
175
|
+
});
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
-
import ProCalendarPicker from './picker';
|
|
1
|
+
import ProCalendarPicker from './pro-calendar-picker';
|
|
2
|
+
import './style.less';
|
|
2
3
|
export default ProCalendarPicker;
|
|
3
|
-
export type { ProCalendarPickerActions, ProCalendarPickerProps, } from './picker';
|
|
4
|
+
export type { ProCalendarPickerActions, ProCalendarPickerProps, } from './pro-calendar-picker';
|
|
@@ -32,5 +32,6 @@ __export(pro_calendar_picker_exports, {
|
|
|
32
32
|
default: () => pro_calendar_picker_default
|
|
33
33
|
});
|
|
34
34
|
module.exports = __toCommonJS(pro_calendar_picker_exports);
|
|
35
|
-
var
|
|
36
|
-
var
|
|
35
|
+
var import_pro_calendar_picker = __toESM(require("./pro-calendar-picker"));
|
|
36
|
+
var import_style = require("./style.less");
|
|
37
|
+
var pro_calendar_picker_default = import_pro_calendar_picker.default;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { CalendarRef } from 'antd-mobile';
|
|
2
|
+
import { PickerActions } from 'antd-mobile/es/components/picker';
|
|
3
|
+
import { ReactNode } from 'react';
|
|
4
|
+
import { ProCalendarDate, ProCalendarProps } from '../pro-calendar';
|
|
5
|
+
export interface ProCalendarPickerActions extends Partial<CalendarRef>, PickerActions {
|
|
6
|
+
}
|
|
7
|
+
export type ProCalendarPickerValue = ProCalendarDate | ProCalendarDate[] | null | undefined;
|
|
8
|
+
export type ProCalendarPickerProps = ProCalendarProps & {
|
|
9
|
+
allowClear?: boolean;
|
|
10
|
+
children?: (value: ProCalendarPickerValue, action: ProCalendarPickerActions) => ReactNode;
|
|
11
|
+
};
|
|
12
|
+
declare const ProCalendarPicker: import("react").ForwardRefExoticComponent<ProCalendarPickerProps & import("react").RefAttributes<ProCalendarPickerActions>>;
|
|
13
|
+
export default ProCalendarPicker;
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
+
mod
|
|
26
|
+
));
|
|
27
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
|
+
|
|
29
|
+
// src/components/pro-calendar-picker/pro-calendar-picker.tsx
|
|
30
|
+
var pro_calendar_picker_exports = {};
|
|
31
|
+
__export(pro_calendar_picker_exports, {
|
|
32
|
+
default: () => pro_calendar_picker_default
|
|
33
|
+
});
|
|
34
|
+
module.exports = __toCommonJS(pro_calendar_picker_exports);
|
|
35
|
+
var import_ahooks = require("ahooks");
|
|
36
|
+
var import_antd_mobile = require("antd-mobile");
|
|
37
|
+
var import_antd_mobile_icons = require("antd-mobile-icons");
|
|
38
|
+
var import_lodash = require("lodash");
|
|
39
|
+
var import_react = require("react");
|
|
40
|
+
var import_bem = require("../../utils/bem");
|
|
41
|
+
var import_pro_calendar = __toESM(require("../pro-calendar"));
|
|
42
|
+
var bem = (0, import_bem.cn)("calendar-picker");
|
|
43
|
+
var ProCalendarPickerRaw = ({
|
|
44
|
+
children,
|
|
45
|
+
allowClear = false,
|
|
46
|
+
selectionMode = "single",
|
|
47
|
+
value: valueProp,
|
|
48
|
+
onChange,
|
|
49
|
+
...props
|
|
50
|
+
}, ref) => {
|
|
51
|
+
const [value, setValue] = (0, import_ahooks.useControllableValue)(
|
|
52
|
+
(0, import_lodash.pickBy)({
|
|
53
|
+
value: valueProp,
|
|
54
|
+
onChange
|
|
55
|
+
})
|
|
56
|
+
);
|
|
57
|
+
const [visible, setVisible] = (0, import_react.useState)(false);
|
|
58
|
+
const [tempValue, setTempValue] = (0, import_react.useState)(valueProp);
|
|
59
|
+
(0, import_react.useEffect)(() => {
|
|
60
|
+
if (visible)
|
|
61
|
+
setTempValue(value ?? null);
|
|
62
|
+
}, [value, visible]);
|
|
63
|
+
const calendarRef = (0, import_react.useRef)(null);
|
|
64
|
+
const action = (0, import_react.useMemo)(() => {
|
|
65
|
+
return {
|
|
66
|
+
...calendarRef.current,
|
|
67
|
+
open() {
|
|
68
|
+
setVisible(true);
|
|
69
|
+
},
|
|
70
|
+
close() {
|
|
71
|
+
setVisible(false);
|
|
72
|
+
},
|
|
73
|
+
toggle() {
|
|
74
|
+
setVisible((v) => !v);
|
|
75
|
+
}
|
|
76
|
+
};
|
|
77
|
+
}, []);
|
|
78
|
+
(0, import_react.useImperativeHandle)(ref, () => action);
|
|
79
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null, children == null ? void 0 : children(value, action), /* @__PURE__ */ React.createElement(
|
|
80
|
+
import_antd_mobile.Popup,
|
|
81
|
+
{
|
|
82
|
+
visible,
|
|
83
|
+
onClose: () => setVisible(false),
|
|
84
|
+
className: bem("popup"),
|
|
85
|
+
destroyOnClose: true
|
|
86
|
+
},
|
|
87
|
+
/* @__PURE__ */ React.createElement("div", { className: bem("popup-head") }, allowClear && /* @__PURE__ */ React.createElement(
|
|
88
|
+
import_antd_mobile.Button,
|
|
89
|
+
{
|
|
90
|
+
color: "default",
|
|
91
|
+
fill: "none",
|
|
92
|
+
size: "small",
|
|
93
|
+
className: bem("popup-head__clear"),
|
|
94
|
+
onClick: () => {
|
|
95
|
+
setValue(void 0);
|
|
96
|
+
setVisible(false);
|
|
97
|
+
}
|
|
98
|
+
},
|
|
99
|
+
"清除"
|
|
100
|
+
), /* @__PURE__ */ React.createElement("div", { className: bem("popup-head__title") }, "日期选择"), /* @__PURE__ */ React.createElement(
|
|
101
|
+
import_antd_mobile.Button,
|
|
102
|
+
{
|
|
103
|
+
color: "default",
|
|
104
|
+
fill: "none",
|
|
105
|
+
size: "small",
|
|
106
|
+
className: bem("popup-head__close"),
|
|
107
|
+
onClick: () => {
|
|
108
|
+
setVisible(false);
|
|
109
|
+
}
|
|
110
|
+
},
|
|
111
|
+
/* @__PURE__ */ React.createElement(import_antd_mobile_icons.CloseOutline, null)
|
|
112
|
+
)),
|
|
113
|
+
/* @__PURE__ */ React.createElement(
|
|
114
|
+
import_pro_calendar.default,
|
|
115
|
+
{
|
|
116
|
+
selectionMode,
|
|
117
|
+
value: tempValue ?? null,
|
|
118
|
+
onChange: (v) => {
|
|
119
|
+
setTempValue(v);
|
|
120
|
+
},
|
|
121
|
+
...props,
|
|
122
|
+
ref: calendarRef
|
|
123
|
+
}
|
|
124
|
+
),
|
|
125
|
+
/* @__PURE__ */ React.createElement("div", { className: bem("popup-footer") }, /* @__PURE__ */ React.createElement(
|
|
126
|
+
import_antd_mobile.Button,
|
|
127
|
+
{
|
|
128
|
+
block: true,
|
|
129
|
+
color: "primary",
|
|
130
|
+
onClick: () => {
|
|
131
|
+
console.log("setValue", tempValue);
|
|
132
|
+
setValue(tempValue);
|
|
133
|
+
setVisible(false);
|
|
134
|
+
}
|
|
135
|
+
},
|
|
136
|
+
"确定"
|
|
137
|
+
), /* @__PURE__ */ React.createElement(import_antd_mobile.SafeArea, { position: "bottom" }))
|
|
138
|
+
));
|
|
139
|
+
};
|
|
140
|
+
var ProCalendarPicker = (0, import_react.forwardRef)(ProCalendarPickerRaw);
|
|
141
|
+
var pro_calendar_picker_default = ProCalendarPicker;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
@import '../styles/variable.less';
|
|
2
|
+
|
|
3
|
+
@class-prefix-pro-calendar-picker:~ '@{adm-pro-prefix}-calendar-picker';
|
|
4
|
+
.@{class-prefix-pro-calendar-picker} {
|
|
5
|
+
&__popup-head {
|
|
6
|
+
font-size: var(--adm-font-size-9);
|
|
7
|
+
color: var(--adm-color-text);
|
|
8
|
+
position: relative;
|
|
9
|
+
border-bottom: 1px solid var(--adm-color-border);
|
|
10
|
+
margin-bottom: 10px;
|
|
11
|
+
& &__clear {
|
|
12
|
+
position: absolute;
|
|
13
|
+
left: 6px;
|
|
14
|
+
top: 0;
|
|
15
|
+
bottom: 0;
|
|
16
|
+
margin: auto;
|
|
17
|
+
padding: 6px 12px;
|
|
18
|
+
height: 30px;
|
|
19
|
+
}
|
|
20
|
+
&__title {
|
|
21
|
+
text-align: center;
|
|
22
|
+
line-height: 45px;
|
|
23
|
+
}
|
|
24
|
+
& &__close {
|
|
25
|
+
position: absolute;
|
|
26
|
+
right: 6px;
|
|
27
|
+
top: 0;
|
|
28
|
+
bottom: 0;
|
|
29
|
+
margin: auto;
|
|
30
|
+
padding: 6px 12px;
|
|
31
|
+
height: 30px;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
&__popup-footer {
|
|
35
|
+
padding: var(--adm-padding-m) var(--adm-padding-l);
|
|
36
|
+
border-top: 1px solid var(--adm-color-border);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { FC } from 'react';
|
|
2
2
|
import { ProCalendarPickerProps } from '../pro-calendar-picker';
|
|
3
3
|
import { ProFormItemFieldProps } from './pro-form-item';
|
|
4
|
-
export type ProFormCalendarPickerProps = ProFormItemFieldProps<ProCalendarPickerProps> & Pick<ProCalendarPickerProps, '
|
|
4
|
+
export type ProFormCalendarPickerProps = ProFormItemFieldProps<ProCalendarPickerProps> & Pick<ProCalendarPickerProps, 'selectionMode' | 'min' | 'max' | 'enableHalfDay'>;
|
|
5
5
|
declare const ProFormCalendarPicker: FC<ProFormCalendarPickerProps>;
|
|
6
6
|
export default ProFormCalendarPicker;
|
|
@@ -33,6 +33,7 @@ __export(pro_form_item_calendar_picker_exports, {
|
|
|
33
33
|
});
|
|
34
34
|
module.exports = __toCommonJS(pro_form_item_calendar_picker_exports);
|
|
35
35
|
var import_config_provider = require("../config-provider");
|
|
36
|
+
var import_pro_calendar = __toESM(require("../pro-calendar"));
|
|
36
37
|
var import_pro_calendar_picker = __toESM(require("../pro-calendar-picker"));
|
|
37
38
|
var import_pro_form_item = __toESM(require("./pro-form-item"));
|
|
38
39
|
var import_utils = require("./utils");
|
|
@@ -41,20 +42,25 @@ var ProFormCalendarPicker = (p) => {
|
|
|
41
42
|
const {
|
|
42
43
|
fieldProps,
|
|
43
44
|
placeholder = locale.common.selectPlaceholder,
|
|
44
|
-
|
|
45
|
+
selectionMode,
|
|
45
46
|
min,
|
|
46
47
|
max,
|
|
47
|
-
|
|
48
|
+
enableHalfDay,
|
|
48
49
|
onClick,
|
|
49
50
|
...props
|
|
50
51
|
} = p;
|
|
51
|
-
const calendarProps = {
|
|
52
|
+
const calendarProps = {
|
|
53
|
+
selectionMode,
|
|
54
|
+
min,
|
|
55
|
+
max,
|
|
56
|
+
enableHalfDay,
|
|
57
|
+
...fieldProps
|
|
58
|
+
};
|
|
52
59
|
const readonly = (0, import_utils.useReadonly)(props);
|
|
53
60
|
return /* @__PURE__ */ React.createElement(
|
|
54
61
|
import_pro_form_item.default,
|
|
55
62
|
{
|
|
56
63
|
...props,
|
|
57
|
-
trigger: "onConfirm",
|
|
58
64
|
onClick: (e, pickerRef) => {
|
|
59
65
|
var _a;
|
|
60
66
|
(_a = pickerRef.current) == null ? void 0 : _a.open();
|
|
@@ -62,12 +68,12 @@ var ProFormCalendarPicker = (p) => {
|
|
|
62
68
|
}
|
|
63
69
|
},
|
|
64
70
|
/* @__PURE__ */ React.createElement(import_pro_calendar_picker.default, { ...calendarProps }, (val) => {
|
|
65
|
-
const value =
|
|
71
|
+
const value = import_pro_calendar.default.defaultFormat(val);
|
|
66
72
|
return /* @__PURE__ */ React.createElement(
|
|
67
73
|
import_pro_form_item.ProFormItemValue,
|
|
68
74
|
{
|
|
69
75
|
placeholder,
|
|
70
|
-
value: value
|
|
76
|
+
value: value || void 0,
|
|
71
77
|
readonly
|
|
72
78
|
}
|
|
73
79
|
);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import prompt from './prompt';
|
|
3
3
|
import './tree-picker.less';
|
|
4
|
-
declare const TreePicker: (<T extends import("..").TreeDataNode<object> = import("..").TreeDataNode<object>>(props: Omit<import("..").PopupPickerMixinProps<T | T[]>, "fieldNames"> & Pick<import("..").TreeProps<T>, "
|
|
4
|
+
declare const TreePicker: (<T extends import("..").TreeDataNode<object> = import("..").TreeDataNode<object>>(props: Omit<import("..").PopupPickerMixinProps<T | T[]>, "fieldNames"> & Pick<import("..").TreeProps<T>, "search" | "fieldNames" | "request" | "params" | "rowKey" | "dataSource"> & {
|
|
5
5
|
treeProps?: Omit<import("..").TreeProps<T>, "rowKey"> | undefined;
|
|
6
6
|
multiple?: boolean | undefined;
|
|
7
7
|
} & {
|
|
@@ -9,7 +9,7 @@ export type TreePickerProps<T extends TreeDataNode<object> = TreeDataNode<object
|
|
|
9
9
|
*/
|
|
10
10
|
multiple?: boolean;
|
|
11
11
|
} & NativeProps;
|
|
12
|
-
declare const TreePicker: <T extends TreeDataNode<object> = TreeDataNode<object>>(props: Omit<PopupPickerMixinProps<T | T[]>, "fieldNames"> & Pick<TreeProps<T>, "
|
|
12
|
+
declare const TreePicker: <T extends TreeDataNode<object> = TreeDataNode<object>>(props: Omit<PopupPickerMixinProps<T | T[]>, "fieldNames"> & Pick<TreeProps<T>, "search" | "fieldNames" | "request" | "params" | "rowKey" | "dataSource"> & {
|
|
13
13
|
treeProps?: Omit<TreeProps<T>, "rowKey"> | undefined;
|
|
14
14
|
/**
|
|
15
15
|
* 启用多选时,将启用复选框禁用选择,即点击整行会选中复选框
|
|
@@ -12,6 +12,7 @@ declare const base: {
|
|
|
12
12
|
confirm: string;
|
|
13
13
|
start: string;
|
|
14
14
|
end: string;
|
|
15
|
+
startAndEnd: string;
|
|
15
16
|
today: string;
|
|
16
17
|
markItems: string[];
|
|
17
18
|
yearAndMonth: string;
|
|
@@ -112,6 +113,9 @@ declare const base: {
|
|
|
112
113
|
Modal: {
|
|
113
114
|
ok: string;
|
|
114
115
|
};
|
|
116
|
+
NumberKeyboard: {
|
|
117
|
+
backspace: string;
|
|
118
|
+
};
|
|
115
119
|
PasscodeInput: {
|
|
116
120
|
name: string;
|
|
117
121
|
};
|
|
@@ -11,6 +11,7 @@ declare const enUS: {
|
|
|
11
11
|
confirm: string;
|
|
12
12
|
start: string;
|
|
13
13
|
end: string;
|
|
14
|
+
startAndEnd: string;
|
|
14
15
|
today: string;
|
|
15
16
|
markItems: string[];
|
|
16
17
|
yearAndMonth: string;
|
|
@@ -111,6 +112,9 @@ declare const enUS: {
|
|
|
111
112
|
Modal: {
|
|
112
113
|
ok: string;
|
|
113
114
|
};
|
|
115
|
+
NumberKeyboard: {
|
|
116
|
+
backspace: string;
|
|
117
|
+
};
|
|
114
118
|
PasscodeInput: {
|
|
115
119
|
name: string;
|
|
116
120
|
};
|
|
@@ -17,7 +17,7 @@ declare const Checkbox: import("react").ForwardRefExoticComponent<{
|
|
|
17
17
|
onClick?: ((event: import("react").MouseEvent<HTMLLabelElement, MouseEvent>) => void) | undefined;
|
|
18
18
|
} & {
|
|
19
19
|
className?: string | undefined;
|
|
20
|
-
style?: (import("react").CSSProperties & Partial<Record<"--
|
|
20
|
+
style?: (import("react").CSSProperties & Partial<Record<"--gap" | "--icon-size" | "--font-size", string>>) | undefined;
|
|
21
21
|
tabIndex?: number | undefined;
|
|
22
22
|
} & import("react").AriaAttributes & {
|
|
23
23
|
shape?: "circle" | "square" | undefined;
|
|
@@ -14,7 +14,7 @@ declare const Checkbox: import("react").ForwardRefExoticComponent<{
|
|
|
14
14
|
onClick?: ((event: import("react").MouseEvent<HTMLLabelElement, MouseEvent>) => void) | undefined;
|
|
15
15
|
} & {
|
|
16
16
|
className?: string | undefined;
|
|
17
|
-
style?: (import("react").CSSProperties & Partial<Record<"--
|
|
17
|
+
style?: (import("react").CSSProperties & Partial<Record<"--gap" | "--icon-size" | "--font-size", string>>) | undefined;
|
|
18
18
|
tabIndex?: number | undefined;
|
|
19
19
|
} & import("react").AriaAttributes & {
|
|
20
20
|
shape?: "circle" | "square" | undefined;
|
|
@@ -19,6 +19,7 @@ export { default as Money, type MoneyProps } from './money';
|
|
|
19
19
|
export { default as Page, type PageBodyProps, type PageFooterProps, type PageProps, type PageToolbarProps, } from './page';
|
|
20
20
|
export { default as PopupPage, type PopupPageProps } from './popup-page';
|
|
21
21
|
export { createPopupPickerPrompt, usePopupPickerMixin, type PopupPickerActions, type PopupPickerMixinProps, } from './popup-picker-base';
|
|
22
|
+
export { default as ProCalendar, type ProCalendarDate, type ProCalendarProps, } from './pro-calendar';
|
|
22
23
|
export { default as ProCalendarPicker, type ProCalendarPickerActions, type ProCalendarPickerProps, } from './pro-calendar-picker';
|
|
23
24
|
export * from './pro-form';
|
|
24
25
|
export { default as ProList, type ProListAction, type ProListPaginationProps, type ProListProps, } from './pro-list';
|
|
@@ -19,6 +19,7 @@ export { default as Money } from "./money";
|
|
|
19
19
|
export { default as Page } from "./page";
|
|
20
20
|
export { default as PopupPage } from "./popup-page";
|
|
21
21
|
export { createPopupPickerPrompt, usePopupPickerMixin } from "./popup-picker-base";
|
|
22
|
+
export { default as ProCalendar } from "./pro-calendar";
|
|
22
23
|
export { default as ProCalendarPicker } from "./pro-calendar-picker";
|
|
23
24
|
export * from "./pro-form";
|
|
24
25
|
export { default as ProList } from "./pro-list";
|
|
@@ -5,6 +5,7 @@ import { PageProps } from '../page';
|
|
|
5
5
|
export type PopupPageProps = Omit<PopupProps, 'showCloseButton' | 'children'> & Omit<PageProps, 'style'> & {
|
|
6
6
|
pageStyle?: PageProps['style'];
|
|
7
7
|
pageClassName?: PageProps['className'];
|
|
8
|
+
closeButtonPosition?: 'left' | 'right';
|
|
8
9
|
} & NativeProps<'--page-height'>;
|
|
9
10
|
declare const PopupPage: FC<PopupPageProps>;
|
|
10
11
|
export default PopupPage;
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
2
2
|
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
3
3
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
4
|
-
var _excluded = ["children", "className", "visible", "onClose", "pageStyle", "pageClassName", "navbar", "loading", "error", "onBack", "title"];
|
|
4
|
+
var _excluded = ["children", "className", "visible", "onClose", "pageStyle", "pageClassName", "navbar", "loading", "error", "onBack", "title", "closeButtonPosition"];
|
|
5
5
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
6
6
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
7
7
|
import { useMergedState } from '@nickeylin/rc-utils';
|
|
8
8
|
import { Popup } from 'antd-mobile';
|
|
9
9
|
import { CloseOutline } from 'antd-mobile-icons';
|
|
10
10
|
import classNames from 'classnames';
|
|
11
|
+
import { useMemo } from 'react';
|
|
11
12
|
import { cn } from "../../utils/bem";
|
|
12
13
|
import Page from "../page";
|
|
13
14
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
@@ -24,6 +25,8 @@ var PopupPage = function PopupPage(_ref) {
|
|
|
24
25
|
error = _ref.error,
|
|
25
26
|
_onBack = _ref.onBack,
|
|
26
27
|
title = _ref.title,
|
|
28
|
+
_ref$closeButtonPosit = _ref.closeButtonPosition,
|
|
29
|
+
closeButtonPosition = _ref$closeButtonPosit === void 0 ? 'left' : _ref$closeButtonPosit,
|
|
27
30
|
props = _objectWithoutProperties(_ref, _excluded);
|
|
28
31
|
var _useMergedState = useMergedState(false, {
|
|
29
32
|
value: visibleProp,
|
|
@@ -34,28 +37,46 @@ var PopupPage = function PopupPage(_ref) {
|
|
|
34
37
|
_useMergedState2 = _slicedToArray(_useMergedState, 2),
|
|
35
38
|
visible = _useMergedState2[0],
|
|
36
39
|
setVisible = _useMergedState2[1];
|
|
40
|
+
var pageProps = useMemo(function () {
|
|
41
|
+
if (closeButtonPosition === 'right') {
|
|
42
|
+
return {
|
|
43
|
+
navbar: _objectSpread({
|
|
44
|
+
right: /*#__PURE__*/_jsx(CloseOutline, {
|
|
45
|
+
className: bem('close-button'),
|
|
46
|
+
onClick: function onClick() {
|
|
47
|
+
setVisible(false);
|
|
48
|
+
_onBack === null || _onBack === void 0 || _onBack();
|
|
49
|
+
}
|
|
50
|
+
})
|
|
51
|
+
}, navbar)
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
return {
|
|
55
|
+
navbar: _objectSpread({
|
|
56
|
+
backIcon: /*#__PURE__*/_jsx(CloseOutline, {})
|
|
57
|
+
}, navbar),
|
|
58
|
+
onBack: function onBack() {
|
|
59
|
+
setVisible(false);
|
|
60
|
+
_onBack === null || _onBack === void 0 || _onBack();
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
}, [closeButtonPosition, navbar, _onBack, setVisible]);
|
|
37
64
|
return /*#__PURE__*/_jsx(Popup, _objectSpread(_objectSpread({}, props), {}, {
|
|
38
65
|
visible: visible,
|
|
39
66
|
onClose: function onClose() {
|
|
40
67
|
return setVisible(false);
|
|
41
68
|
},
|
|
42
69
|
className: classNames(bem(), className),
|
|
43
|
-
children: /*#__PURE__*/_jsx(Page, {
|
|
70
|
+
children: /*#__PURE__*/_jsx(Page, _objectSpread(_objectSpread({
|
|
44
71
|
style: pageStyle,
|
|
45
|
-
className: pageClassName
|
|
46
|
-
|
|
47
|
-
backIcon: /*#__PURE__*/_jsx(CloseOutline, {})
|
|
48
|
-
}, navbar),
|
|
72
|
+
className: pageClassName
|
|
73
|
+
}, pageProps), {}, {
|
|
49
74
|
loading: loading,
|
|
50
75
|
error: error,
|
|
51
76
|
title: title,
|
|
52
77
|
showNavBar: true,
|
|
53
|
-
onBack: function onBack() {
|
|
54
|
-
setVisible(false);
|
|
55
|
-
_onBack === null || _onBack === void 0 || _onBack();
|
|
56
|
-
},
|
|
57
78
|
children: children
|
|
58
|
-
})
|
|
79
|
+
}))
|
|
59
80
|
}));
|
|
60
81
|
};
|
|
61
82
|
export default PopupPage;
|