@pisell/materials 1.0.407 → 1.0.409
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/build/lowcode/assets-daily.json +13 -13
- package/build/lowcode/assets-dev.json +4 -4
- package/build/lowcode/assets-prod.json +13 -13
- package/build/lowcode/index.js +1 -1
- package/build/lowcode/meta.js +2 -2
- package/build/lowcode/preview.js +142 -142
- package/build/lowcode/render/default/view.css +1 -1
- package/build/lowcode/render/default/view.js +59 -16
- package/build/lowcode/view.css +1 -1
- package/build/lowcode/view.js +62 -19
- package/es/components/browserSelect/chevron-down.png +0 -0
- package/es/components/browserSelect/index.d.ts +15 -0
- package/es/components/browserSelect/index.js +36 -0
- package/es/components/browserSelect/index.less +18 -0
- package/es/components/date-picker/constants.d.ts +39 -0
- package/es/components/date-picker/constants.js +76 -0
- package/es/components/date-picker/datePickerCpt.d.ts +8 -0
- package/es/components/date-picker/datePickerCpt.js +370 -0
- package/es/components/date-picker/hooks/useMediaQuery.d.ts +2 -0
- package/es/components/date-picker/hooks/useMediaQuery.js +28 -0
- package/es/components/date-picker/index.js +2 -2
- package/es/components/date-picker/index.less +1880 -0
- package/es/components/drag-sort-tree/index.d.ts +0 -1
- package/es/components/drag-sort-tree/index.js +2 -1
- package/es/components/page/index.js +4 -2
- package/es/components/picker-view/index.d.ts +2 -0
- package/es/components/picker-view/index.js +2 -0
- package/es/components/pisell-config-provider/index.js +2 -0
- package/es/components/pisellModal/components/functions/index.d.ts +23 -5
- package/es/components/pisellModal/components/functions/index.js +7 -2
- package/es/components/pisellModal/index.d.ts +20 -5
- package/es/components/pisellTags/index.d.ts +13 -0
- package/es/components/pisellTags/index.js +83 -0
- package/es/components/pisellTags/index.less +17 -0
- package/es/components/pisellTags/utils.d.ts +1 -0
- package/es/components/pisellTags/utils.js +89 -0
- package/es/components/table/Actions/component/ExportImport/components/ExportFile/index.d.ts +3 -3
- package/es/components/table/Actions/component/ExportImport/components/ExportFile/index.js +33 -48
- package/es/components/table/Actions/component/ExportImport/components/ExportTable/function.js +9 -9
- package/es/components/table/Actions/component/ExportImport/components/ImportLog/index.d.ts +3 -3
- package/es/components/table/Actions/component/ExportImport/components/ImportLog/index.js +28 -43
- package/es/components/table/Actions/component/ExportImport/components/ImportTable/index.d.ts +3 -3
- package/es/components/table/Actions/component/ExportImport/components/ImportTable/index.js +45 -44
- package/es/components/table/Actions/component/ExportImport/index.d.ts +3 -3
- package/es/components/table/Actions/component/ExportImport/index.js +34 -25
- package/es/components/table/Actions/component/ExportImport/utils/index.d.ts +9 -0
- package/es/components/table/Actions/component/ExportImport/utils/index.js +11 -0
- package/es/components/table/BasicTable/index.js +5 -3
- package/es/components/table/Gallery/index.js +2 -1
- package/es/components/table/Table/fields/rangePicker/Edit/index.js +13 -11
- package/es/components/table/Table/index.d.ts +2 -2
- package/es/components/table/Table/index.js +68 -42
- package/es/components/table/Table/index.less +3 -0
- package/es/components/table/Table/utils.d.ts +14 -2
- package/es/components/table/Table/utils.js +6 -2
- package/es/components/table/View/index.d.ts +2 -2
- package/es/components/table/View/index.js +27 -16
- package/es/components/table/hooks/useGenScroll.js +1 -1
- package/es/components/table/hooks/useTableSetting.js +29 -7
- package/es/components/table/hooks/useTransDataSource.d.ts +1 -0
- package/es/components/table/hooks/useTransDataSource.js +8 -6
- package/es/components/table/index.js +7 -5
- package/es/components/table/index.less +9 -0
- package/es/components/table/serve.d.ts +3 -1
- package/es/components/table/serve.js +71 -9
- package/es/components/table/types.d.ts +17 -4
- package/es/index.d.ts +3 -1
- package/es/index.js +3 -1
- package/es/locales/en-US.d.ts +12 -0
- package/es/locales/en-US.js +13 -0
- package/es/locales/zh-CN.d.ts +12 -0
- package/es/locales/zh-CN.js +13 -0
- package/es/locales/zh-TW.d.ts +12 -0
- package/es/locales/zh-TW.js +13 -0
- package/lib/components/browserSelect/chevron-down.png +0 -0
- package/lib/components/browserSelect/index.d.ts +15 -0
- package/lib/components/browserSelect/index.js +59 -0
- package/lib/components/browserSelect/index.less +18 -0
- package/lib/components/date-picker/constants.d.ts +39 -0
- package/lib/components/date-picker/constants.js +78 -0
- package/lib/components/date-picker/datePickerCpt.d.ts +8 -0
- package/lib/components/date-picker/datePickerCpt.js +403 -0
- package/lib/components/date-picker/hooks/useMediaQuery.d.ts +2 -0
- package/lib/components/date-picker/hooks/useMediaQuery.js +43 -0
- package/lib/components/date-picker/index.js +2 -2
- package/lib/components/date-picker/index.less +1880 -0
- package/lib/components/drag-sort-tree/index.d.ts +0 -1
- package/lib/components/drag-sort-tree/index.js +0 -1
- package/lib/components/page/index.js +3 -2
- package/lib/components/picker-view/index.d.ts +2 -0
- package/lib/components/picker-view/index.js +36 -0
- package/lib/components/pisell-config-provider/index.js +2 -0
- package/lib/components/pisellModal/components/functions/index.d.ts +23 -5
- package/lib/components/pisellModal/components/functions/index.js +13 -7
- package/lib/components/pisellModal/index.d.ts +20 -5
- package/lib/components/pisellTags/index.d.ts +13 -0
- package/lib/components/pisellTags/index.js +113 -0
- package/lib/components/pisellTags/index.less +17 -0
- package/lib/components/pisellTags/utils.d.ts +1 -0
- package/lib/components/pisellTags/utils.js +86 -0
- package/lib/components/table/Actions/component/ExportImport/components/ExportFile/index.d.ts +3 -3
- package/lib/components/table/Actions/component/ExportImport/components/ExportFile/index.js +9 -22
- package/lib/components/table/Actions/component/ExportImport/components/ExportTable/function.js +3 -8
- package/lib/components/table/Actions/component/ExportImport/components/ImportLog/index.d.ts +3 -3
- package/lib/components/table/Actions/component/ExportImport/components/ImportLog/index.js +9 -22
- package/lib/components/table/Actions/component/ExportImport/components/ImportTable/index.d.ts +3 -3
- package/lib/components/table/Actions/component/ExportImport/components/ImportTable/index.js +5 -8
- package/lib/components/table/Actions/component/ExportImport/index.d.ts +3 -3
- package/lib/components/table/Actions/component/ExportImport/index.js +15 -8
- package/lib/components/table/Actions/component/ExportImport/utils/index.d.ts +9 -0
- package/lib/components/table/Actions/component/ExportImport/utils/index.js +31 -0
- package/lib/components/table/BasicTable/index.js +2 -3
- package/lib/components/table/Gallery/index.js +2 -1
- package/lib/components/table/Table/fields/rangePicker/Edit/index.js +1 -9
- package/lib/components/table/Table/index.d.ts +2 -2
- package/lib/components/table/Table/index.js +61 -34
- package/lib/components/table/Table/index.less +3 -0
- package/lib/components/table/Table/utils.d.ts +14 -2
- package/lib/components/table/Table/utils.js +7 -1
- package/lib/components/table/View/index.d.ts +2 -2
- package/lib/components/table/View/index.js +28 -19
- package/lib/components/table/hooks/useGenScroll.js +1 -1
- package/lib/components/table/hooks/useTableSetting.js +26 -11
- package/lib/components/table/hooks/useTransDataSource.d.ts +1 -0
- package/lib/components/table/hooks/useTransDataSource.js +6 -5
- package/lib/components/table/index.js +4 -4
- package/lib/components/table/index.less +9 -0
- package/lib/components/table/serve.d.ts +3 -1
- package/lib/components/table/serve.js +38 -6
- package/lib/components/table/types.d.ts +17 -4
- package/lib/index.d.ts +3 -1
- package/lib/index.js +6 -0
- package/lib/locales/en-US.d.ts +12 -0
- package/lib/locales/en-US.js +13 -0
- package/lib/locales/zh-CN.d.ts +12 -0
- package/lib/locales/zh-CN.js +13 -0
- package/lib/locales/zh-TW.d.ts +12 -0
- package/lib/locales/zh-TW.js +13 -0
- package/lowcode/table/meta.ts +26 -18
- package/lowcode/table/snippets.ts +2 -3
- package/package.json +3 -3
- package/dist/umd/materials.min.css +0 -1
- package/dist/umd/materials.min.js +0 -1
- package/dist/umd/static/DotsSix.57d66266.svg +0 -1
- package/dist/umd/static/arrow-left.e542294f.svg +0 -1
- package/dist/umd/static/arrow-right.763f03e0.svg +0 -1
- package/dist/umd/static/filter-lines.04a54ae9.svg +0 -1
- package/dist/umd/static/help-circle.31c9be40.svg +0 -1
- package/dist/umd/static/switch-vertical-01.7ebe3ba8.svg +0 -1
|
@@ -0,0 +1,403 @@
|
|
|
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/date-picker/datePickerCpt.tsx
|
|
30
|
+
var datePickerCpt_exports = {};
|
|
31
|
+
__export(datePickerCpt_exports, {
|
|
32
|
+
default: () => datePickerCpt_default
|
|
33
|
+
});
|
|
34
|
+
module.exports = __toCommonJS(datePickerCpt_exports);
|
|
35
|
+
var import_react = __toESM(require("react"));
|
|
36
|
+
var import_dayjs = __toESM(require("dayjs"));
|
|
37
|
+
var import_classnames = __toESM(require("classnames"));
|
|
38
|
+
var import_antd = require("antd");
|
|
39
|
+
var import_browserSelect = __toESM(require("../browserSelect"));
|
|
40
|
+
var import_utils = require("@pisell/utils");
|
|
41
|
+
var import_constants = require("./constants");
|
|
42
|
+
var import_locales = require("../../locales");
|
|
43
|
+
var import_useResponsive = __toESM(require("../../hooks/useResponsive"));
|
|
44
|
+
var import_index = require("./index.less");
|
|
45
|
+
var isValidDate = (dateString, format) => {
|
|
46
|
+
const date = window.dayjs(dateString, format, true);
|
|
47
|
+
return date.isValid();
|
|
48
|
+
};
|
|
49
|
+
(0, import_useResponsive.configResponsive)({
|
|
50
|
+
phone: 0,
|
|
51
|
+
ipad: 768,
|
|
52
|
+
pc: 1080
|
|
53
|
+
});
|
|
54
|
+
var DatePickerCpt = (props) => {
|
|
55
|
+
const {
|
|
56
|
+
picker,
|
|
57
|
+
onChange,
|
|
58
|
+
value,
|
|
59
|
+
format: propsFormat,
|
|
60
|
+
defaultValue,
|
|
61
|
+
showTime,
|
|
62
|
+
...others
|
|
63
|
+
} = props;
|
|
64
|
+
const { locale } = (0, import_react.useContext)(import_antd.ConfigProvider.ConfigContext);
|
|
65
|
+
const [currentShortcut, setCurrentShortcut] = (0, import_react.useState)("");
|
|
66
|
+
const [open, setOpen] = (0, import_react.useState)(false);
|
|
67
|
+
const [popupOpen, setPopupOpen] = (0, import_react.useState)(false);
|
|
68
|
+
const [_value, setValue] = (0, import_react.useState)(value);
|
|
69
|
+
const [valueStr, setValueStr] = (0, import_react.useState)("");
|
|
70
|
+
const [error, setError] = (0, import_react.useState)(false);
|
|
71
|
+
const ref = (0, import_react.useRef)(null);
|
|
72
|
+
const panelRef = (0, import_react.useRef)(null);
|
|
73
|
+
const canClose = (0, import_react.useRef)(true);
|
|
74
|
+
const [panelTimeWidth, setPanelTimeWidth] = (0, import_react.useState)(0);
|
|
75
|
+
const responsive = (0, import_useResponsive.default)();
|
|
76
|
+
const isDesktop = !("ontouchstart" in window || navigator.maxTouchPoints);
|
|
77
|
+
(0, import_react.useEffect)(() => {
|
|
78
|
+
document.body.id = "body";
|
|
79
|
+
}, []);
|
|
80
|
+
(0, import_react.useEffect)(() => {
|
|
81
|
+
setValue(value);
|
|
82
|
+
}, [value]);
|
|
83
|
+
(0, import_react.useEffect)(() => {
|
|
84
|
+
setValueStr((_value == null ? void 0 : _value.format(format || "YYYY-MM-DD")) || "");
|
|
85
|
+
}, [_value]);
|
|
86
|
+
const customPresetItems = (0, import_react.useMemo)(() => {
|
|
87
|
+
const preset = [
|
|
88
|
+
{
|
|
89
|
+
label: import_constants.presetDetailMap["today"].label(),
|
|
90
|
+
value: "today"
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
label: import_constants.presetDetailMap["yesterday"].label(),
|
|
94
|
+
value: "yesterday"
|
|
95
|
+
},
|
|
96
|
+
{
|
|
97
|
+
label: import_constants.presetDetailMap["tomorrow"].label(),
|
|
98
|
+
value: "tomorrow"
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
label: import_constants.presetDetailMap["next_monday"].label(),
|
|
102
|
+
value: "next_monday"
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
label: import_constants.presetDetailMap["last_friday"].label(),
|
|
106
|
+
value: "last_friday"
|
|
107
|
+
},
|
|
108
|
+
{
|
|
109
|
+
label: import_constants.presetDetailMap["first_day_of_this_month"].label(),
|
|
110
|
+
value: "first_day_of_this_month"
|
|
111
|
+
},
|
|
112
|
+
{
|
|
113
|
+
label: import_constants.presetDetailMap["last_day_of_this_month"].label(),
|
|
114
|
+
value: "last_day_of_this_month"
|
|
115
|
+
},
|
|
116
|
+
{
|
|
117
|
+
label: import_constants.presetDetailMap["first_day_of_next_month"].label(),
|
|
118
|
+
value: "first_day_of_next_month"
|
|
119
|
+
},
|
|
120
|
+
{
|
|
121
|
+
label: import_constants.presetDetailMap["last_day_of_last_month"].label(),
|
|
122
|
+
value: "last_day_of_last_month"
|
|
123
|
+
}
|
|
124
|
+
];
|
|
125
|
+
if (!currentShortcut) {
|
|
126
|
+
preset.push({
|
|
127
|
+
label: (0, import_locales.getText)("date-picker-shortcut-custom"),
|
|
128
|
+
value: "custom"
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
|
+
return preset;
|
|
132
|
+
}, [currentShortcut]);
|
|
133
|
+
const format = (0, import_react.useMemo)(() => {
|
|
134
|
+
if (propsFormat) {
|
|
135
|
+
if ((0, import_utils.isFunction)(propsFormat)) {
|
|
136
|
+
return propsFormat(value);
|
|
137
|
+
}
|
|
138
|
+
return propsFormat;
|
|
139
|
+
}
|
|
140
|
+
let localeValue = locale == null ? void 0 : locale.locale;
|
|
141
|
+
return localeValue === "en" || localeValue === "en-US" ? "DD/MM/YYYY" : "YYYY/MM/DD";
|
|
142
|
+
}, [propsFormat, locale]);
|
|
143
|
+
const handleSelectChange = (e) => {
|
|
144
|
+
var _a;
|
|
145
|
+
canClose.current = true;
|
|
146
|
+
const shortcut = e.target.value;
|
|
147
|
+
setCurrentShortcut(shortcut);
|
|
148
|
+
const date = (_a = import_constants.presetDetailMap[shortcut]) == null ? void 0 : _a.getValue();
|
|
149
|
+
setValue(date);
|
|
150
|
+
handleOk(date);
|
|
151
|
+
};
|
|
152
|
+
const handleTodayClick = () => {
|
|
153
|
+
const val = (0, import_dayjs.default)().startOf("day");
|
|
154
|
+
handleChange(val);
|
|
155
|
+
handleOpenChange(false);
|
|
156
|
+
};
|
|
157
|
+
const handleOpenChange = (visible) => {
|
|
158
|
+
if (!visible) {
|
|
159
|
+
setOpen(visible);
|
|
160
|
+
setTimeout(() => {
|
|
161
|
+
var _a;
|
|
162
|
+
setPopupOpen(visible);
|
|
163
|
+
(_a = ref.current) == null ? void 0 : _a.blur();
|
|
164
|
+
});
|
|
165
|
+
return;
|
|
166
|
+
}
|
|
167
|
+
setOpen(visible);
|
|
168
|
+
setPopupOpen(visible);
|
|
169
|
+
};
|
|
170
|
+
const handleOk = (val) => {
|
|
171
|
+
const returnValue = val || _value;
|
|
172
|
+
onChange == null ? void 0 : onChange(returnValue, returnValue == null ? void 0 : returnValue.format("YYYY-MM-DD"));
|
|
173
|
+
handleOpenChange(false);
|
|
174
|
+
};
|
|
175
|
+
const handleChange = (val, valStr, isNotChange) => {
|
|
176
|
+
if (!showTime) {
|
|
177
|
+
canClose.current = true;
|
|
178
|
+
}
|
|
179
|
+
setError(false);
|
|
180
|
+
setCurrentShortcut("");
|
|
181
|
+
setValue(val);
|
|
182
|
+
if (!isNotChange) {
|
|
183
|
+
handleOk(val);
|
|
184
|
+
}
|
|
185
|
+
};
|
|
186
|
+
const handleApply = () => {
|
|
187
|
+
if (error)
|
|
188
|
+
return;
|
|
189
|
+
handleOk();
|
|
190
|
+
};
|
|
191
|
+
const handleDataStrChange = (e) => {
|
|
192
|
+
const val = e.target.value;
|
|
193
|
+
setValueStr(val);
|
|
194
|
+
if (isValidDate(val, format)) {
|
|
195
|
+
setError(false);
|
|
196
|
+
const valDate = (0, import_dayjs.default)(val, format);
|
|
197
|
+
setValue(valDate);
|
|
198
|
+
} else {
|
|
199
|
+
setError(true);
|
|
200
|
+
}
|
|
201
|
+
};
|
|
202
|
+
(0, import_react.useEffect)(() => {
|
|
203
|
+
var _a;
|
|
204
|
+
let width = 0;
|
|
205
|
+
const childElements = ((_a = panelRef.current) == null ? void 0 : _a.getElementsByClassName(
|
|
206
|
+
"pisell-lowcode-picker-time-panel"
|
|
207
|
+
)) || [];
|
|
208
|
+
if (childElements.length > 0) {
|
|
209
|
+
const childElement = childElements[0];
|
|
210
|
+
width = childElement.offsetWidth;
|
|
211
|
+
}
|
|
212
|
+
if (width > 0) {
|
|
213
|
+
setPanelTimeWidth(width);
|
|
214
|
+
}
|
|
215
|
+
}, [open]);
|
|
216
|
+
const handleSelect = (val) => {
|
|
217
|
+
canClose.current = !showTime;
|
|
218
|
+
setValue(val);
|
|
219
|
+
};
|
|
220
|
+
const handleTimeChange = (val) => {
|
|
221
|
+
setValue(
|
|
222
|
+
(preVal) => {
|
|
223
|
+
var _a, _b;
|
|
224
|
+
return ((_b = (_a = preVal == null ? void 0 : preVal.set("hour", (val == null ? void 0 : val.get("hour")) || 0)) == null ? void 0 : _a.set("minute", (val == null ? void 0 : val.get("minute")) || 0)) == null ? void 0 : _b.set("second", (val == null ? void 0 : val.get("second")) || 0)) || null;
|
|
225
|
+
}
|
|
226
|
+
);
|
|
227
|
+
};
|
|
228
|
+
const timeInputProps = (0, import_react.useMemo)(() => {
|
|
229
|
+
let step = 1;
|
|
230
|
+
let _format = "";
|
|
231
|
+
if ((showTime == null ? void 0 : showTime.format) === "HH:mm") {
|
|
232
|
+
step = void 0;
|
|
233
|
+
_format = "HH:mm";
|
|
234
|
+
} else if ((showTime == null ? void 0 : showTime.format) === "HH:mm:ss" || showTime) {
|
|
235
|
+
step = 1;
|
|
236
|
+
_format = "HH:mm:ss";
|
|
237
|
+
}
|
|
238
|
+
return {
|
|
239
|
+
step,
|
|
240
|
+
onChange: (e) => {
|
|
241
|
+
const val = e.target.value;
|
|
242
|
+
handleTimeChange(window.dayjs(val, _format));
|
|
243
|
+
},
|
|
244
|
+
value: _value == null ? void 0 : _value.format(_format)
|
|
245
|
+
};
|
|
246
|
+
}, [showTime, _value]);
|
|
247
|
+
if (!picker || picker === "date") {
|
|
248
|
+
return /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, /* @__PURE__ */ import_react.default.createElement(
|
|
249
|
+
import_antd.DatePicker,
|
|
250
|
+
{
|
|
251
|
+
...others,
|
|
252
|
+
ref,
|
|
253
|
+
onSelect: handleSelect,
|
|
254
|
+
showTime: isDesktop ? showTime : false,
|
|
255
|
+
defaultValue,
|
|
256
|
+
showNow: false,
|
|
257
|
+
onChange: (val, valStr) => handleChange(val, valStr, !isDesktop && showTime),
|
|
258
|
+
open: popupOpen,
|
|
259
|
+
renderExtraFooter: !(!showTime || isDesktop) ? () => {
|
|
260
|
+
return /* @__PURE__ */ import_react.default.createElement(
|
|
261
|
+
"div",
|
|
262
|
+
{
|
|
263
|
+
onMouseDown: (e) => {
|
|
264
|
+
canClose.current = false;
|
|
265
|
+
e.stopPropagation();
|
|
266
|
+
}
|
|
267
|
+
},
|
|
268
|
+
/* @__PURE__ */ import_react.default.createElement("div", { className: "date-picker-time-label" }, "Time"),
|
|
269
|
+
/* @__PURE__ */ import_react.default.createElement("div", null, /* @__PURE__ */ import_react.default.createElement(
|
|
270
|
+
"input",
|
|
271
|
+
{
|
|
272
|
+
type: "time",
|
|
273
|
+
className: "date-picker-input-time",
|
|
274
|
+
...timeInputProps
|
|
275
|
+
}
|
|
276
|
+
))
|
|
277
|
+
);
|
|
278
|
+
} : void 0,
|
|
279
|
+
className: (0, import_classnames.default)(
|
|
280
|
+
"pisell-lowcode-mode-date-picker",
|
|
281
|
+
others.className
|
|
282
|
+
),
|
|
283
|
+
value: _value,
|
|
284
|
+
onOpenChange: (o) => {
|
|
285
|
+
if (!o && (!canClose.current || showTime)) {
|
|
286
|
+
return;
|
|
287
|
+
}
|
|
288
|
+
handleOpenChange(o);
|
|
289
|
+
},
|
|
290
|
+
mode: "date",
|
|
291
|
+
picker: "date",
|
|
292
|
+
popupClassName: "date-picker-popup-wrap",
|
|
293
|
+
format: currentShortcut ? () => import_constants.presetDetailMap[currentShortcut].label() : format,
|
|
294
|
+
panelRender: (panelNode) => {
|
|
295
|
+
const dom = /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, /* @__PURE__ */ import_react.default.createElement(
|
|
296
|
+
"div",
|
|
297
|
+
{
|
|
298
|
+
className: (0, import_classnames.default)(
|
|
299
|
+
"pisell-lowcode-date-picker-custom-wrap",
|
|
300
|
+
{
|
|
301
|
+
["pisell-lowcode-date-picker-custom-wrap-show-time"]: showTime
|
|
302
|
+
}
|
|
303
|
+
),
|
|
304
|
+
ref: panelRef
|
|
305
|
+
},
|
|
306
|
+
!showTime && /* @__PURE__ */ import_react.default.createElement(
|
|
307
|
+
"div",
|
|
308
|
+
{
|
|
309
|
+
className: "pisell-lowcode-date-picker-custom-action",
|
|
310
|
+
onMouseDown: (e) => {
|
|
311
|
+
canClose.current = false;
|
|
312
|
+
e.stopPropagation();
|
|
313
|
+
},
|
|
314
|
+
style: {
|
|
315
|
+
width: `calc(100% - 48px - ${panelTimeWidth}px)`
|
|
316
|
+
}
|
|
317
|
+
},
|
|
318
|
+
/* @__PURE__ */ import_react.default.createElement("div", { style: { width: "50%" } }, /* @__PURE__ */ import_react.default.createElement(
|
|
319
|
+
import_antd.Input,
|
|
320
|
+
{
|
|
321
|
+
size: "large",
|
|
322
|
+
placeholder: (0, import_dayjs.default)().format(
|
|
323
|
+
format || "YYYY-MM-DD"
|
|
324
|
+
),
|
|
325
|
+
value: valueStr,
|
|
326
|
+
onChange: handleDataStrChange
|
|
327
|
+
}
|
|
328
|
+
), error && /* @__PURE__ */ import_react.default.createElement("span", { className: "date-picker-error" }, (0, import_locales.getText)("date-picker-invalid-date"))),
|
|
329
|
+
/* @__PURE__ */ import_react.default.createElement(
|
|
330
|
+
import_browserSelect.default,
|
|
331
|
+
{
|
|
332
|
+
value: currentShortcut || "custom",
|
|
333
|
+
className: "date-picker-toolbar-select",
|
|
334
|
+
options: customPresetItems,
|
|
335
|
+
size: "large",
|
|
336
|
+
onChange: handleSelectChange,
|
|
337
|
+
style: { width: "50%" }
|
|
338
|
+
}
|
|
339
|
+
)
|
|
340
|
+
),
|
|
341
|
+
panelNode
|
|
342
|
+
), /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-lowcode-custom-footer" }, /* @__PURE__ */ import_react.default.createElement(
|
|
343
|
+
"span",
|
|
344
|
+
{
|
|
345
|
+
className: "pisell-lowcode-custom-footer-today",
|
|
346
|
+
onClick: handleTodayClick
|
|
347
|
+
},
|
|
348
|
+
(0, import_locales.getText)("date-picker-today")
|
|
349
|
+
), /* @__PURE__ */ import_react.default.createElement(import_antd.Button, { type: "primary", size: "large", onClick: handleApply }, (0, import_locales.getText)("date-picker-apply"))));
|
|
350
|
+
if (isDesktop) {
|
|
351
|
+
return /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-lowcode-date-picker-custom-popup-wrap pisell-lowcode-date-picker-dropdown-mode" }, /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-lowcode-date-picker-custom-wrap" }, dom));
|
|
352
|
+
}
|
|
353
|
+
if (responsive === "phone") {
|
|
354
|
+
return /* @__PURE__ */ import_react.default.createElement(
|
|
355
|
+
import_antd.Drawer,
|
|
356
|
+
{
|
|
357
|
+
placement: "bottom",
|
|
358
|
+
open,
|
|
359
|
+
height: "auto",
|
|
360
|
+
closable: false,
|
|
361
|
+
styles: {
|
|
362
|
+
content: {
|
|
363
|
+
borderRadius: "8px 8px 0 0"
|
|
364
|
+
}
|
|
365
|
+
},
|
|
366
|
+
bodyStyle: { padding: 0 },
|
|
367
|
+
maskClosable: false
|
|
368
|
+
},
|
|
369
|
+
/* @__PURE__ */ import_react.default.createElement(
|
|
370
|
+
"div",
|
|
371
|
+
{
|
|
372
|
+
className: "pisell-lowcode-picker-custom-dropdown pisell-lowcode-date-picker-custom-popup-wrap",
|
|
373
|
+
onMouseDown: (e) => e.stopPropagation()
|
|
374
|
+
},
|
|
375
|
+
/* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-lowcode-picker-panel-container pisell-lowcode-picker-date-panel-container" }, dom)
|
|
376
|
+
)
|
|
377
|
+
);
|
|
378
|
+
}
|
|
379
|
+
return /* @__PURE__ */ import_react.default.createElement(
|
|
380
|
+
import_antd.Modal,
|
|
381
|
+
{
|
|
382
|
+
width: 458,
|
|
383
|
+
open,
|
|
384
|
+
footer: null,
|
|
385
|
+
closable: false,
|
|
386
|
+
wrapClassName: "pisell-lowcode-date-picker-modal"
|
|
387
|
+
},
|
|
388
|
+
/* @__PURE__ */ import_react.default.createElement(
|
|
389
|
+
"div",
|
|
390
|
+
{
|
|
391
|
+
className: "pisell-lowcode-picker-custom-dropdown pisell-lowcode-date-picker-custom-popup-wrap",
|
|
392
|
+
onMouseDown: (e) => e.stopPropagation()
|
|
393
|
+
},
|
|
394
|
+
/* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-lowcode-picker-panel-container pisell-lowcode-picker-date-panel-container" }, dom)
|
|
395
|
+
)
|
|
396
|
+
);
|
|
397
|
+
}
|
|
398
|
+
}
|
|
399
|
+
));
|
|
400
|
+
}
|
|
401
|
+
return /* @__PURE__ */ import_react.default.createElement(import_antd.DatePicker, { ...props });
|
|
402
|
+
};
|
|
403
|
+
var datePickerCpt_default = DatePickerCpt;
|
|
@@ -0,0 +1,43 @@
|
|
|
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
|
+
|
|
19
|
+
// src/components/date-picker/hooks/useMediaQuery.ts
|
|
20
|
+
var useMediaQuery_exports = {};
|
|
21
|
+
__export(useMediaQuery_exports, {
|
|
22
|
+
default: () => useMediaQuery_default
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(useMediaQuery_exports);
|
|
25
|
+
var import_react = require("react");
|
|
26
|
+
var useMediaQuery = (query) => {
|
|
27
|
+
const [matches, setMatches] = (0, import_react.useState)(false);
|
|
28
|
+
(0, import_react.useEffect)(() => {
|
|
29
|
+
const mediaQuery = window.matchMedia(query);
|
|
30
|
+
if (mediaQuery.matches !== matches) {
|
|
31
|
+
setMatches(mediaQuery.matches);
|
|
32
|
+
}
|
|
33
|
+
const handleMediaQueryChange = (event) => {
|
|
34
|
+
setMatches(event.matches);
|
|
35
|
+
};
|
|
36
|
+
mediaQuery.addEventListener("change", handleMediaQueryChange);
|
|
37
|
+
return () => {
|
|
38
|
+
mediaQuery.removeEventListener("change", handleMediaQueryChange);
|
|
39
|
+
};
|
|
40
|
+
}, [query]);
|
|
41
|
+
return matches;
|
|
42
|
+
};
|
|
43
|
+
var useMediaQuery_default = useMediaQuery;
|
|
@@ -32,15 +32,15 @@ __export(date_picker_exports, {
|
|
|
32
32
|
default: () => date_picker_default
|
|
33
33
|
});
|
|
34
34
|
module.exports = __toCommonJS(date_picker_exports);
|
|
35
|
-
var import_antd = require("antd");
|
|
36
35
|
var import_hoc = require("../../utils/hoc");
|
|
37
36
|
var import_dayjs = __toESM(require("dayjs"));
|
|
38
37
|
var import_date_picker = require("@pisell/date-picker");
|
|
39
38
|
var import_localeData = __toESM(require("dayjs/plugin/localeData"));
|
|
40
39
|
var import_weekday = __toESM(require("dayjs/plugin/weekday"));
|
|
40
|
+
var import_datePickerCpt = __toESM(require("./datePickerCpt"));
|
|
41
41
|
import_dayjs.default.extend(import_weekday.default);
|
|
42
42
|
import_dayjs.default.extend(import_localeData.default);
|
|
43
|
-
var DatePicker = (0, import_hoc.withMomentProps)(
|
|
43
|
+
var DatePicker = (0, import_hoc.withMomentProps)(import_datePickerCpt.default, [
|
|
44
44
|
"defaultPickerValue",
|
|
45
45
|
"defaultValue",
|
|
46
46
|
"showTime.defaultValue",
|