@pisell/materials 1.0.352 → 1.0.354
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 +11 -11
- package/build/lowcode/assets-dev.json +2 -2
- package/build/lowcode/assets-prod.json +11 -11
- package/build/lowcode/index.js +1 -1
- package/build/lowcode/meta.js +1 -1
- package/build/lowcode/preview.js +8 -8
- package/build/lowcode/render/default/view.css +1 -1
- package/build/lowcode/render/default/view.js +14 -14
- package/build/lowcode/view.css +1 -1
- package/build/lowcode/view.js +13 -13
- 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 +280 -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 +1847 -0
- package/es/locales/en-US.d.ts +12 -0
- package/es/locales/en-US.js +14 -1
- package/es/locales/zh-CN.d.ts +12 -0
- package/es/locales/zh-CN.js +14 -1
- package/es/locales/zh-TW.d.ts +12 -0
- package/es/locales/zh-TW.js +14 -1
- 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 +292 -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 +1847 -0
- package/lib/locales/en-US.d.ts +12 -0
- package/lib/locales/en-US.js +14 -1
- package/lib/locales/zh-CN.d.ts +12 -0
- package/lib/locales/zh-CN.js +14 -1
- package/lib/locales/zh-TW.d.ts +12 -0
- package/lib/locales/zh-TW.js +14 -1
- package/package.json +3 -3
package/es/locales/en-US.d.ts
CHANGED
|
@@ -97,5 +97,17 @@ declare const _default: {
|
|
|
97
97
|
'table-action-export-import-log-copy': string;
|
|
98
98
|
'table-action-export-import-table-success-copy': string;
|
|
99
99
|
'drag-sort-tree-unavailable-today-tip': string;
|
|
100
|
+
'date-picker-today': string;
|
|
101
|
+
'date-picker-yesterday': string;
|
|
102
|
+
'date-picker-tomorrow': string;
|
|
103
|
+
'date-picker-next_monday': string;
|
|
104
|
+
'date-picker-last_friday': string;
|
|
105
|
+
'date-picker-first_day_of_this_month': string;
|
|
106
|
+
'date-picker-last_day_of_this_month': string;
|
|
107
|
+
'date-picker-first_day_of_next_month': string;
|
|
108
|
+
'date-picker-last_day_of_last_month': string;
|
|
109
|
+
'date-picker-invalid-date': string;
|
|
110
|
+
"date-picker-apply": string;
|
|
111
|
+
'date-picker-shortcut-custom': string;
|
|
100
112
|
};
|
|
101
113
|
export default _default;
|
package/es/locales/en-US.js
CHANGED
|
@@ -118,5 +118,18 @@ export default {
|
|
|
118
118
|
'table-action-export-import-log-err-log': 'Failure Log',
|
|
119
119
|
'table-action-export-import-log-copy': 'Copy',
|
|
120
120
|
'table-action-export-import-table-success-copy': 'Copy Success',
|
|
121
|
-
'drag-sort-tree-unavailable-today-tip': 'Unavailable today'
|
|
121
|
+
'drag-sort-tree-unavailable-today-tip': 'Unavailable today',
|
|
122
|
+
// 日期组件
|
|
123
|
+
'date-picker-today': 'Today',
|
|
124
|
+
'date-picker-yesterday': 'Yesterday',
|
|
125
|
+
'date-picker-tomorrow': 'Tomorrow',
|
|
126
|
+
'date-picker-next_monday': 'Next monday',
|
|
127
|
+
'date-picker-last_friday': 'Last friday',
|
|
128
|
+
'date-picker-first_day_of_this_month': 'First day of this month',
|
|
129
|
+
'date-picker-last_day_of_this_month': 'Last day of this month',
|
|
130
|
+
'date-picker-first_day_of_next_month': 'First day of next month',
|
|
131
|
+
'date-picker-last_day_of_last_month': 'Last day of last month',
|
|
132
|
+
'date-picker-invalid-date': 'Invalid date',
|
|
133
|
+
"date-picker-apply": "Apply",
|
|
134
|
+
'date-picker-shortcut-custom': 'Custom'
|
|
122
135
|
};
|
package/es/locales/zh-CN.d.ts
CHANGED
|
@@ -97,5 +97,17 @@ declare const _default: {
|
|
|
97
97
|
'table-action-export-import-log-copy': string;
|
|
98
98
|
'table-action-export-import-table-success-copy': string;
|
|
99
99
|
'drag-sort-tree-unavailable-today-tip': string;
|
|
100
|
+
'date-picker-today': string;
|
|
101
|
+
'date-picker-yesterday': string;
|
|
102
|
+
'date-picker-tomorrow': string;
|
|
103
|
+
'date-picker-next_monday': string;
|
|
104
|
+
'date-picker-last_friday': string;
|
|
105
|
+
'date-picker-first_day_of_this_month': string;
|
|
106
|
+
'date-picker-last_day_of_this_month': string;
|
|
107
|
+
'date-picker-first_day_of_next_month': string;
|
|
108
|
+
'date-picker-last_day_of_last_month': string;
|
|
109
|
+
'date-picker-invalid-date': string;
|
|
110
|
+
"date-picker-apply": string;
|
|
111
|
+
'date-picker-shortcut-custom': string;
|
|
100
112
|
};
|
|
101
113
|
export default _default;
|
package/es/locales/zh-CN.js
CHANGED
|
@@ -118,5 +118,18 @@ export default {
|
|
|
118
118
|
'table-action-export-import-log-err-log': '失败日志',
|
|
119
119
|
'table-action-export-import-log-copy': '复制',
|
|
120
120
|
'table-action-export-import-table-success-copy': '复制成功',
|
|
121
|
-
'drag-sort-tree-unavailable-today-tip': '今日不可用'
|
|
121
|
+
'drag-sort-tree-unavailable-today-tip': '今日不可用',
|
|
122
|
+
// 日期组件
|
|
123
|
+
'date-picker-today': '今天',
|
|
124
|
+
'date-picker-yesterday': '昨天',
|
|
125
|
+
'date-picker-tomorrow': '明天',
|
|
126
|
+
'date-picker-next_monday': '下个星期一',
|
|
127
|
+
'date-picker-last_friday': '上个星期五',
|
|
128
|
+
'date-picker-first_day_of_this_month': '本月的第一天',
|
|
129
|
+
'date-picker-last_day_of_this_month': '本月的最后一天',
|
|
130
|
+
'date-picker-first_day_of_next_month': '下个月的第一天',
|
|
131
|
+
'date-picker-last_day_of_last_month': '上个月的最后一天',
|
|
132
|
+
'date-picker-invalid-date': '无效日期',
|
|
133
|
+
"date-picker-apply": "确定",
|
|
134
|
+
'date-picker-shortcut-custom': '自定义'
|
|
122
135
|
};
|
package/es/locales/zh-TW.d.ts
CHANGED
|
@@ -97,5 +97,17 @@ declare const _default: {
|
|
|
97
97
|
'table-action-export-import-log-copy': string;
|
|
98
98
|
'table-action-export-import-table-success-copy': string;
|
|
99
99
|
'drag-sort-tree-unavailable-today-tip': string;
|
|
100
|
+
'date-picker-today': string;
|
|
101
|
+
'date-picker-yesterday': string;
|
|
102
|
+
'date-picker-tomorrow': string;
|
|
103
|
+
'date-picker-next_monday': string;
|
|
104
|
+
'date-picker-last_friday': string;
|
|
105
|
+
'date-picker-first_day_of_this_month': string;
|
|
106
|
+
'date-picker-last_day_of_this_month': string;
|
|
107
|
+
'date-picker-first_day_of_next_month': string;
|
|
108
|
+
'date-picker-last_day_of_last_month': string;
|
|
109
|
+
'date-picker-invalid-date': string;
|
|
110
|
+
"date-picker-apply": string;
|
|
111
|
+
'date-picker-shortcut-custom': string;
|
|
100
112
|
};
|
|
101
113
|
export default _default;
|
package/es/locales/zh-TW.js
CHANGED
|
@@ -118,5 +118,18 @@ export default {
|
|
|
118
118
|
'table-action-export-import-log-err-log': '失敗日誌',
|
|
119
119
|
'table-action-export-import-log-copy': '復製',
|
|
120
120
|
'table-action-export-import-table-success-copy': '復製成功',
|
|
121
|
-
'drag-sort-tree-unavailable-today-tip': '今日不可用'
|
|
121
|
+
'drag-sort-tree-unavailable-today-tip': '今日不可用',
|
|
122
|
+
// 日期组件
|
|
123
|
+
'date-picker-today': '今天',
|
|
124
|
+
'date-picker-yesterday': '昨天',
|
|
125
|
+
'date-picker-tomorrow': '明天',
|
|
126
|
+
'date-picker-next_monday': '下個星期一',
|
|
127
|
+
'date-picker-last_friday': '上個星期五',
|
|
128
|
+
'date-picker-first_day_of_this_month': '本月的第一天',
|
|
129
|
+
'date-picker-last_day_of_this_month': '本月的最後一天',
|
|
130
|
+
'date-picker-first_day_of_next_month': '下個月的第一天',
|
|
131
|
+
'date-picker-last_day_of_last_month': '上個月的最後一天',
|
|
132
|
+
'date-picker-invalid-date': '無效日期',
|
|
133
|
+
"date-picker-apply": "确定",
|
|
134
|
+
'date-picker-shortcut-custom': '自定義'
|
|
122
135
|
};
|
|
Binary file
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import "./index.less";
|
|
3
|
+
interface BrowserSelectProps extends React.DetailedHTMLProps<React.SelectHTMLAttributes<HTMLSelectElement>, HTMLSelectElement> {
|
|
4
|
+
options: any[];
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* @title: 系统级别的下拉框
|
|
8
|
+
* @description:
|
|
9
|
+
* @param {BrowserSelectProps} props
|
|
10
|
+
* @return {*}
|
|
11
|
+
* @Author: zhiwei.Wang
|
|
12
|
+
* @Date: 2024-01-30 16:43
|
|
13
|
+
*/
|
|
14
|
+
declare const BrowserSelect: (props: BrowserSelectProps) => React.JSX.Element;
|
|
15
|
+
export default BrowserSelect;
|
|
@@ -0,0 +1,59 @@
|
|
|
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/browserSelect/index.tsx
|
|
30
|
+
var browserSelect_exports = {};
|
|
31
|
+
__export(browserSelect_exports, {
|
|
32
|
+
default: () => browserSelect_default
|
|
33
|
+
});
|
|
34
|
+
module.exports = __toCommonJS(browserSelect_exports);
|
|
35
|
+
var import_react = __toESM(require("react"));
|
|
36
|
+
var import_classnames = __toESM(require("classnames"));
|
|
37
|
+
var import_index = require("./index.less");
|
|
38
|
+
var BrowserSelect = (props) => {
|
|
39
|
+
const { options, ...resetProps } = props;
|
|
40
|
+
const _options = (0, import_react.useMemo)(() => {
|
|
41
|
+
return (props.options || []).map((d) => {
|
|
42
|
+
return /* @__PURE__ */ import_react.default.createElement("option", { value: d.value, key: d.value }, d.label);
|
|
43
|
+
});
|
|
44
|
+
}, [props.options]);
|
|
45
|
+
return /* @__PURE__ */ import_react.default.createElement(
|
|
46
|
+
"select",
|
|
47
|
+
{
|
|
48
|
+
...resetProps,
|
|
49
|
+
className: (0, import_classnames.default)("date-picker-pisell-browser-select", resetProps.className),
|
|
50
|
+
onChange: (e) => {
|
|
51
|
+
var _a;
|
|
52
|
+
e.persist();
|
|
53
|
+
(_a = resetProps.onChange) == null ? void 0 : _a.call(resetProps, e);
|
|
54
|
+
}
|
|
55
|
+
},
|
|
56
|
+
_options
|
|
57
|
+
);
|
|
58
|
+
};
|
|
59
|
+
var browserSelect_default = BrowserSelect;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
.date-picker-pisell-browser-select {
|
|
2
|
+
padding: 9px 16px;
|
|
3
|
+
border-radius: 8px;
|
|
4
|
+
background-color: #fff;
|
|
5
|
+
background-image: url('./chevron-down.png');
|
|
6
|
+
color: var(--Gray-true-900, #141414);
|
|
7
|
+
font-size: 16px;
|
|
8
|
+
font-style: normal;
|
|
9
|
+
font-weight: 600;
|
|
10
|
+
border: 1px solid var(--Gray-300, #D0D5DD);
|
|
11
|
+
cursor: pointer;
|
|
12
|
+
appearance: none;
|
|
13
|
+
-webkit-appearance: none;
|
|
14
|
+
-moz-appearance: none;
|
|
15
|
+
background-position: right 10px center;
|
|
16
|
+
background-size: 12px;
|
|
17
|
+
background-repeat: no-repeat;
|
|
18
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import dayjs from 'dayjs';
|
|
2
|
+
export declare const presetDetailMap: {
|
|
3
|
+
today: {
|
|
4
|
+
getValue: () => dayjs.Dayjs;
|
|
5
|
+
label: () => any;
|
|
6
|
+
};
|
|
7
|
+
yesterday: {
|
|
8
|
+
getValue: () => dayjs.Dayjs;
|
|
9
|
+
label: () => any;
|
|
10
|
+
};
|
|
11
|
+
tomorrow: {
|
|
12
|
+
getValue: () => dayjs.Dayjs;
|
|
13
|
+
label: () => any;
|
|
14
|
+
};
|
|
15
|
+
next_monday: {
|
|
16
|
+
getValue: () => dayjs.Dayjs;
|
|
17
|
+
label: () => any;
|
|
18
|
+
};
|
|
19
|
+
last_friday: {
|
|
20
|
+
getValue: () => dayjs.Dayjs;
|
|
21
|
+
label: () => any;
|
|
22
|
+
};
|
|
23
|
+
first_day_of_this_month: {
|
|
24
|
+
getValue: () => dayjs.Dayjs;
|
|
25
|
+
label: () => any;
|
|
26
|
+
};
|
|
27
|
+
last_day_of_this_month: {
|
|
28
|
+
getValue: () => dayjs.Dayjs;
|
|
29
|
+
label: () => any;
|
|
30
|
+
};
|
|
31
|
+
first_day_of_next_month: {
|
|
32
|
+
getValue: () => dayjs.Dayjs;
|
|
33
|
+
label: () => any;
|
|
34
|
+
};
|
|
35
|
+
last_day_of_last_month: {
|
|
36
|
+
getValue: () => dayjs.Dayjs;
|
|
37
|
+
label: () => any;
|
|
38
|
+
};
|
|
39
|
+
};
|
|
@@ -0,0 +1,78 @@
|
|
|
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/constants.ts
|
|
30
|
+
var constants_exports = {};
|
|
31
|
+
__export(constants_exports, {
|
|
32
|
+
presetDetailMap: () => presetDetailMap
|
|
33
|
+
});
|
|
34
|
+
module.exports = __toCommonJS(constants_exports);
|
|
35
|
+
var import_dayjs = __toESM(require("dayjs"));
|
|
36
|
+
var import_locales = require("../../locales");
|
|
37
|
+
var presetDetailMap = {
|
|
38
|
+
today: {
|
|
39
|
+
getValue: () => (0, import_dayjs.default)().startOf("day"),
|
|
40
|
+
label: () => (0, import_locales.getText)("date-picker-today")
|
|
41
|
+
},
|
|
42
|
+
yesterday: {
|
|
43
|
+
getValue: () => (0, import_dayjs.default)().add(-1, "d").startOf("day"),
|
|
44
|
+
label: () => (0, import_locales.getText)("date-picker-yesterday")
|
|
45
|
+
},
|
|
46
|
+
tomorrow: {
|
|
47
|
+
getValue: () => (0, import_dayjs.default)().add(1, "d").startOf("day"),
|
|
48
|
+
label: () => (0, import_locales.getText)("date-picker-tomorrow")
|
|
49
|
+
},
|
|
50
|
+
next_monday: {
|
|
51
|
+
getValue: () => (0, import_dayjs.default)().startOf("week").add(8, "day").startOf("day"),
|
|
52
|
+
label: () => (0, import_locales.getText)("date-picker-next_monday")
|
|
53
|
+
},
|
|
54
|
+
last_friday: {
|
|
55
|
+
getValue: () => (0, import_dayjs.default)().subtract(1, "week").startOf("week").add(5, "day").startOf("day"),
|
|
56
|
+
label: () => (0, import_locales.getText)("date-picker-last_friday")
|
|
57
|
+
},
|
|
58
|
+
first_day_of_this_month: {
|
|
59
|
+
getValue: () => (0, import_dayjs.default)().startOf("month").startOf("day"),
|
|
60
|
+
label: () => (0, import_locales.getText)("date-picker-first_day_of_this_month")
|
|
61
|
+
},
|
|
62
|
+
last_day_of_this_month: {
|
|
63
|
+
getValue: () => (0, import_dayjs.default)().endOf("month").startOf("day"),
|
|
64
|
+
label: () => (0, import_locales.getText)("date-picker-last_day_of_this_month")
|
|
65
|
+
},
|
|
66
|
+
first_day_of_next_month: {
|
|
67
|
+
getValue: () => (0, import_dayjs.default)().endOf("month").add(1, "day").startOf("day"),
|
|
68
|
+
label: () => (0, import_locales.getText)("date-picker-first_day_of_next_month")
|
|
69
|
+
},
|
|
70
|
+
last_day_of_last_month: {
|
|
71
|
+
getValue: () => (0, import_dayjs.default)().startOf("month").subtract(1, "day").startOf("day"),
|
|
72
|
+
label: () => (0, import_locales.getText)("date-picker-last_day_of_last_month")
|
|
73
|
+
}
|
|
74
|
+
};
|
|
75
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
76
|
+
0 && (module.exports = {
|
|
77
|
+
presetDetailMap
|
|
78
|
+
});
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { PickerDateProps } from 'antd/es/date-picker/generatePicker';
|
|
3
|
+
import { Dayjs } from 'dayjs';
|
|
4
|
+
import './index.less';
|
|
5
|
+
interface DatePickerCptProps extends PickerDateProps<Dayjs> {
|
|
6
|
+
}
|
|
7
|
+
declare const DatePickerCpt: (props: DatePickerCptProps) => React.JSX.Element;
|
|
8
|
+
export default DatePickerCpt;
|
|
@@ -0,0 +1,292 @@
|
|
|
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_antd = require("antd");
|
|
38
|
+
var import_browserSelect = __toESM(require("../browserSelect"));
|
|
39
|
+
var import_utils = require("@pisell/utils");
|
|
40
|
+
var import_constants = require("./constants");
|
|
41
|
+
var import_locales = require("../../locales");
|
|
42
|
+
var import_useResponsive = __toESM(require("../../hooks/useResponsive"));
|
|
43
|
+
var import_index = require("./index.less");
|
|
44
|
+
var isValidDate = (dateString, format) => {
|
|
45
|
+
const date = window.dayjs(dateString, format, true);
|
|
46
|
+
return date.isValid();
|
|
47
|
+
};
|
|
48
|
+
(0, import_useResponsive.configResponsive)({
|
|
49
|
+
phone: 0,
|
|
50
|
+
ipad: 768,
|
|
51
|
+
pc: 1080
|
|
52
|
+
});
|
|
53
|
+
var DatePickerCpt = (props) => {
|
|
54
|
+
const { mode, onChange, value, format: propsFormat } = props;
|
|
55
|
+
const { locale } = (0, import_react.useContext)(import_antd.ConfigProvider.ConfigContext);
|
|
56
|
+
const [currentShortcut, setCurrentShortcut] = (0, import_react.useState)("");
|
|
57
|
+
const [open, setOpen] = (0, import_react.useState)(false);
|
|
58
|
+
const [popupOpen, setPopupOpen] = (0, import_react.useState)(false);
|
|
59
|
+
const [_value, setValue] = (0, import_react.useState)(value);
|
|
60
|
+
const [valueStr, setValueStr] = (0, import_react.useState)("");
|
|
61
|
+
const [error, setError] = (0, import_react.useState)(false);
|
|
62
|
+
const ref = (0, import_react.useRef)(null);
|
|
63
|
+
const responsive = (0, import_useResponsive.default)();
|
|
64
|
+
const isDesktop = !("ontouchstart" in window || navigator.maxTouchPoints);
|
|
65
|
+
(0, import_react.useEffect)(() => {
|
|
66
|
+
document.body.id = "body";
|
|
67
|
+
}, []);
|
|
68
|
+
(0, import_react.useEffect)(() => {
|
|
69
|
+
setValue(value);
|
|
70
|
+
}, [value]);
|
|
71
|
+
(0, import_react.useEffect)(() => {
|
|
72
|
+
setValueStr((_value == null ? void 0 : _value.format(format)) || "");
|
|
73
|
+
}, [_value]);
|
|
74
|
+
const customPresetItems = (0, import_react.useMemo)(() => {
|
|
75
|
+
const preset = [
|
|
76
|
+
{
|
|
77
|
+
label: import_constants.presetDetailMap["today"].label(),
|
|
78
|
+
value: "today"
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
label: import_constants.presetDetailMap["yesterday"].label(),
|
|
82
|
+
value: "yesterday"
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
label: import_constants.presetDetailMap["tomorrow"].label(),
|
|
86
|
+
value: "tomorrow"
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
label: import_constants.presetDetailMap["next_monday"].label(),
|
|
90
|
+
value: "next_monday"
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
label: import_constants.presetDetailMap["last_friday"].label(),
|
|
94
|
+
value: "last_friday"
|
|
95
|
+
},
|
|
96
|
+
{
|
|
97
|
+
label: import_constants.presetDetailMap["first_day_of_this_month"].label(),
|
|
98
|
+
value: "first_day_of_this_month"
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
label: import_constants.presetDetailMap["last_day_of_this_month"].label(),
|
|
102
|
+
value: "last_day_of_this_month"
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
label: import_constants.presetDetailMap["first_day_of_next_month"].label(),
|
|
106
|
+
value: "first_day_of_next_month"
|
|
107
|
+
},
|
|
108
|
+
{
|
|
109
|
+
label: import_constants.presetDetailMap["last_day_of_last_month"].label(),
|
|
110
|
+
value: "last_day_of_last_month"
|
|
111
|
+
}
|
|
112
|
+
];
|
|
113
|
+
if (!currentShortcut) {
|
|
114
|
+
preset.push({
|
|
115
|
+
label: (0, import_locales.getText)("date-picker-shortcut-custom"),
|
|
116
|
+
value: "custom"
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
return preset;
|
|
120
|
+
}, [currentShortcut]);
|
|
121
|
+
const format = (0, import_react.useMemo)(() => {
|
|
122
|
+
if (propsFormat) {
|
|
123
|
+
if ((0, import_utils.isFunction)(propsFormat)) {
|
|
124
|
+
return propsFormat(value);
|
|
125
|
+
}
|
|
126
|
+
return propsFormat;
|
|
127
|
+
}
|
|
128
|
+
let localeValue = locale == null ? void 0 : locale.locale;
|
|
129
|
+
return localeValue === "en" || localeValue === "en-US" ? "DD/MM/YYYY" : "YYYY/MM/DD";
|
|
130
|
+
}, [propsFormat, locale]);
|
|
131
|
+
const handleSelectChange = (e) => {
|
|
132
|
+
var _a;
|
|
133
|
+
const shortcut = e.target.value;
|
|
134
|
+
setCurrentShortcut(shortcut);
|
|
135
|
+
const date = (_a = import_constants.presetDetailMap[shortcut]) == null ? void 0 : _a.getValue();
|
|
136
|
+
setValue(date);
|
|
137
|
+
handleOk(date);
|
|
138
|
+
};
|
|
139
|
+
const handleTodayClick = () => {
|
|
140
|
+
const val = (0, import_dayjs.default)().startOf("day");
|
|
141
|
+
handleChange(val);
|
|
142
|
+
};
|
|
143
|
+
const handleOpenChange = (visible) => {
|
|
144
|
+
if (!visible) {
|
|
145
|
+
setOpen(visible);
|
|
146
|
+
setTimeout(() => {
|
|
147
|
+
var _a;
|
|
148
|
+
setPopupOpen(visible);
|
|
149
|
+
(_a = ref.current) == null ? void 0 : _a.blur();
|
|
150
|
+
});
|
|
151
|
+
return;
|
|
152
|
+
}
|
|
153
|
+
setOpen(visible);
|
|
154
|
+
setPopupOpen(visible);
|
|
155
|
+
};
|
|
156
|
+
const handleOk = (val) => {
|
|
157
|
+
const returnValue = val || _value;
|
|
158
|
+
onChange == null ? void 0 : onChange(returnValue, returnValue == null ? void 0 : returnValue.format(format));
|
|
159
|
+
handleOpenChange(false);
|
|
160
|
+
};
|
|
161
|
+
const handleChange = (val, valStr) => {
|
|
162
|
+
setError(false);
|
|
163
|
+
setCurrentShortcut("");
|
|
164
|
+
setValue(val);
|
|
165
|
+
handleOk(val);
|
|
166
|
+
};
|
|
167
|
+
const handleApply = () => {
|
|
168
|
+
if (error)
|
|
169
|
+
return;
|
|
170
|
+
handleOk();
|
|
171
|
+
};
|
|
172
|
+
const handleDataStrChange = (e) => {
|
|
173
|
+
const val = e.target.value;
|
|
174
|
+
setValueStr(val);
|
|
175
|
+
if (isValidDate(val, format)) {
|
|
176
|
+
setError(false);
|
|
177
|
+
const valDate = (0, import_dayjs.default)(val, format);
|
|
178
|
+
setValue(valDate);
|
|
179
|
+
} else {
|
|
180
|
+
setError(true);
|
|
181
|
+
}
|
|
182
|
+
};
|
|
183
|
+
if (!mode || mode === "date") {
|
|
184
|
+
return /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, /* @__PURE__ */ import_react.default.createElement(
|
|
185
|
+
import_antd.DatePicker,
|
|
186
|
+
{
|
|
187
|
+
ref,
|
|
188
|
+
showNow: false,
|
|
189
|
+
onChange: handleChange,
|
|
190
|
+
open: popupOpen,
|
|
191
|
+
value: _value,
|
|
192
|
+
onOpenChange: (o) => {
|
|
193
|
+
if (!o) {
|
|
194
|
+
return;
|
|
195
|
+
}
|
|
196
|
+
handleOpenChange(o);
|
|
197
|
+
},
|
|
198
|
+
mode: "date",
|
|
199
|
+
picker: "date",
|
|
200
|
+
popupClassName: "date-picker-popup-wrap",
|
|
201
|
+
format: currentShortcut ? () => import_constants.presetDetailMap[currentShortcut].label() : format,
|
|
202
|
+
panelRender: (panelNode) => {
|
|
203
|
+
const dom = /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-lowcode-date-picker-custom-wrap" }, /* @__PURE__ */ import_react.default.createElement(
|
|
204
|
+
"div",
|
|
205
|
+
{
|
|
206
|
+
className: "pisell-lowcode-date-picker-custom-action",
|
|
207
|
+
onMouseDown: (e) => {
|
|
208
|
+
e.stopPropagation();
|
|
209
|
+
}
|
|
210
|
+
},
|
|
211
|
+
/* @__PURE__ */ import_react.default.createElement("div", { style: { width: "50%" } }, /* @__PURE__ */ import_react.default.createElement(
|
|
212
|
+
import_antd.Input,
|
|
213
|
+
{
|
|
214
|
+
size: "large",
|
|
215
|
+
placeholder: (0, import_dayjs.default)().format(format),
|
|
216
|
+
value: valueStr,
|
|
217
|
+
onChange: handleDataStrChange
|
|
218
|
+
}
|
|
219
|
+
), error && /* @__PURE__ */ import_react.default.createElement("span", { className: "date-picker-error" }, (0, import_locales.getText)("date-picker-invalid-date"))),
|
|
220
|
+
/* @__PURE__ */ import_react.default.createElement(
|
|
221
|
+
import_browserSelect.default,
|
|
222
|
+
{
|
|
223
|
+
value: currentShortcut || "custom",
|
|
224
|
+
className: "date-picker-toolbar-select",
|
|
225
|
+
options: customPresetItems,
|
|
226
|
+
size: "large",
|
|
227
|
+
onChange: handleSelectChange,
|
|
228
|
+
style: { width: "50%" }
|
|
229
|
+
}
|
|
230
|
+
)
|
|
231
|
+
), panelNode), /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-lowcode-custom-footer" }, /* @__PURE__ */ import_react.default.createElement(
|
|
232
|
+
"span",
|
|
233
|
+
{
|
|
234
|
+
className: "pisell-lowcode-custom-footer-today",
|
|
235
|
+
onClick: handleTodayClick
|
|
236
|
+
},
|
|
237
|
+
(0, import_locales.getText)("date-picker-today")
|
|
238
|
+
), /* @__PURE__ */ import_react.default.createElement(import_antd.Button, { type: "primary", size: "large", onClick: handleApply }, (0, import_locales.getText)("date-picker-apply"))));
|
|
239
|
+
if (isDesktop) {
|
|
240
|
+
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));
|
|
241
|
+
}
|
|
242
|
+
if (responsive === "phone") {
|
|
243
|
+
return /* @__PURE__ */ import_react.default.createElement(
|
|
244
|
+
import_antd.Drawer,
|
|
245
|
+
{
|
|
246
|
+
placement: "bottom",
|
|
247
|
+
open,
|
|
248
|
+
height: 565,
|
|
249
|
+
closable: false,
|
|
250
|
+
styles: {
|
|
251
|
+
content: {
|
|
252
|
+
borderRadius: "8px 8px 0 0"
|
|
253
|
+
}
|
|
254
|
+
},
|
|
255
|
+
bodyStyle: { padding: 0 },
|
|
256
|
+
maskClosable: false
|
|
257
|
+
},
|
|
258
|
+
/* @__PURE__ */ import_react.default.createElement(
|
|
259
|
+
"div",
|
|
260
|
+
{
|
|
261
|
+
className: "pisell-lowcode-picker-custom-dropdown pisell-lowcode-date-picker-custom-popup-wrap",
|
|
262
|
+
onMouseDown: (e) => e.stopPropagation()
|
|
263
|
+
},
|
|
264
|
+
/* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-lowcode-picker-panel-container pisell-lowcode-picker-date-panel-container" }, dom)
|
|
265
|
+
)
|
|
266
|
+
);
|
|
267
|
+
}
|
|
268
|
+
return /* @__PURE__ */ import_react.default.createElement(
|
|
269
|
+
import_antd.Modal,
|
|
270
|
+
{
|
|
271
|
+
width: 458,
|
|
272
|
+
open,
|
|
273
|
+
footer: null,
|
|
274
|
+
closable: false,
|
|
275
|
+
wrapClassName: "pisell-lowcode-date-picker-modal"
|
|
276
|
+
},
|
|
277
|
+
/* @__PURE__ */ import_react.default.createElement(
|
|
278
|
+
"div",
|
|
279
|
+
{
|
|
280
|
+
className: "pisell-lowcode-picker-custom-dropdown pisell-lowcode-date-picker-custom-popup-wrap",
|
|
281
|
+
onMouseDown: (e) => e.stopPropagation()
|
|
282
|
+
},
|
|
283
|
+
/* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-lowcode-picker-panel-container pisell-lowcode-picker-date-panel-container" }, dom)
|
|
284
|
+
)
|
|
285
|
+
);
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
));
|
|
289
|
+
}
|
|
290
|
+
return /* @__PURE__ */ import_react.default.createElement(import_antd.DatePicker, { ...props });
|
|
291
|
+
};
|
|
292
|
+
var datePickerCpt_default = DatePickerCpt;
|