@pisell/materials 1.0.444 → 1.0.446

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.
Files changed (147) hide show
  1. package/es/components/button/index.js +0 -2
  2. package/es/components/date-picker/index.js +2 -2
  3. package/es/components/drag-sort-tree/index.d.ts +1 -0
  4. package/es/components/drag-sort-tree/index.js +1 -2
  5. package/es/components/iconfont/index.js +1 -1
  6. package/es/components/pisellInformationEntry/Input/index.js +3 -9
  7. package/es/components/pisellInformationEntry/constants.d.ts +0 -10
  8. package/es/components/pisellInformationEntry/constants.js +0 -10
  9. package/es/components/pisellInformationEntry/index.js +4 -21
  10. package/es/components/pisellInformationEntry/index.less +1 -1
  11. package/es/components/pisellLoading/index.d.ts +0 -2
  12. package/es/components/pisellLoading/index.js +1 -3
  13. package/es/components/pisellWalletPassCard/index.d.ts +0 -2
  14. package/es/components/pisellWalletPassCard/index.js +4 -16
  15. package/es/components/pisellWalletPassCard/index.less +0 -3
  16. package/es/components/record-view/index.d.ts +3 -3
  17. package/es/components/record-view/index.js +16 -20
  18. package/es/components/select-time/RightPanel/index.d.ts +2 -2
  19. package/es/components/select-time/RightPanel/index.js +7 -7
  20. package/es/components/table/Actions/component/ExportImport/index.js +3 -3
  21. package/es/components/table/BasicTable/index.js +1 -7
  22. package/es/components/table/Gallery/components/GalleryItem/components/Title/index.less +1 -1
  23. package/es/components/table/Gallery/components/GalleryItem/index.js +3 -10
  24. package/es/components/table/Gallery/components/GalleryItem/index.less +0 -1
  25. package/es/components/table/Gallery/index.js +4 -14
  26. package/es/components/table/Table/index.js +1 -2
  27. package/es/components/table/Table/utils.d.ts +2 -14
  28. package/es/components/table/Table/utils.js +2 -6
  29. package/es/components/table/hooks/useTableSetting.js +5 -26
  30. package/es/components/table/hooks/useTransDataSource.d.ts +0 -1
  31. package/es/components/table/hooks/useTransDataSource.js +4 -6
  32. package/es/components/table/types.d.ts +0 -2
  33. package/es/components/tabs/index.js +7 -4
  34. package/es/components/virtual-keyboard/Keyboard/index.d.ts +0 -1
  35. package/es/components/virtual-keyboard/Keyboard/index.js +2 -10
  36. package/es/index.d.ts +3 -7
  37. package/es/index.js +3 -7
  38. package/es/locales/en-US.d.ts +0 -14
  39. package/es/locales/en-US.js +1 -16
  40. package/es/locales/zh-CN.d.ts +0 -14
  41. package/es/locales/zh-CN.js +1 -16
  42. package/es/locales/zh-TW.d.ts +0 -14
  43. package/es/locales/zh-TW.js +1 -16
  44. package/es/utils/index.d.ts +0 -1
  45. package/es/utils/index.js +1 -4
  46. package/lib/components/button/index.js +0 -2
  47. package/lib/components/date-picker/index.js +2 -2
  48. package/lib/components/drag-sort-tree/index.d.ts +1 -0
  49. package/lib/components/drag-sort-tree/index.js +1 -0
  50. package/lib/components/iconfont/index.js +1 -1
  51. package/lib/components/pisellInformationEntry/Input/index.js +1 -9
  52. package/lib/components/pisellInformationEntry/constants.d.ts +0 -10
  53. package/lib/components/pisellInformationEntry/constants.js +0 -12
  54. package/lib/components/pisellInformationEntry/index.js +2 -18
  55. package/lib/components/pisellInformationEntry/index.less +1 -1
  56. package/lib/components/pisellLoading/index.d.ts +0 -2
  57. package/lib/components/pisellLoading/index.js +1 -2
  58. package/lib/components/pisellWalletPassCard/index.d.ts +0 -2
  59. package/lib/components/pisellWalletPassCard/index.js +4 -8
  60. package/lib/components/pisellWalletPassCard/index.less +0 -3
  61. package/lib/components/record-view/index.d.ts +3 -3
  62. package/lib/components/record-view/index.js +3 -4
  63. package/lib/components/select-time/RightPanel/index.d.ts +2 -2
  64. package/lib/components/table/Actions/component/ExportImport/index.js +4 -3
  65. package/lib/components/table/BasicTable/index.js +1 -5
  66. package/lib/components/table/Gallery/components/GalleryItem/components/Title/index.less +1 -1
  67. package/lib/components/table/Gallery/components/GalleryItem/index.js +4 -18
  68. package/lib/components/table/Gallery/components/GalleryItem/index.less +0 -1
  69. package/lib/components/table/Gallery/index.js +3 -14
  70. package/lib/components/table/Table/index.js +1 -2
  71. package/lib/components/table/Table/utils.d.ts +2 -14
  72. package/lib/components/table/Table/utils.js +1 -7
  73. package/lib/components/table/hooks/useTableSetting.js +9 -23
  74. package/lib/components/table/hooks/useTransDataSource.d.ts +0 -1
  75. package/lib/components/table/hooks/useTransDataSource.js +4 -5
  76. package/lib/components/table/types.d.ts +0 -2
  77. package/lib/components/tabs/index.js +1 -2
  78. package/lib/components/virtual-keyboard/Keyboard/index.d.ts +0 -1
  79. package/lib/components/virtual-keyboard/Keyboard/index.js +2 -15
  80. package/lib/index.d.ts +3 -7
  81. package/lib/index.js +2 -14
  82. package/lib/locales/en-US.d.ts +0 -14
  83. package/lib/locales/en-US.js +1 -16
  84. package/lib/locales/zh-CN.d.ts +0 -14
  85. package/lib/locales/zh-CN.js +1 -16
  86. package/lib/locales/zh-TW.d.ts +0 -14
  87. package/lib/locales/zh-TW.js +1 -16
  88. package/lib/utils/index.d.ts +0 -1
  89. package/lib/utils/index.js +2 -7
  90. package/lowcode/badge/meta.ts +2 -2
  91. package/lowcode/button/meta.ts +2 -5
  92. package/lowcode/card-pro/meta.ts +338 -0
  93. package/lowcode/card-pro/snippe.ts +39 -0
  94. package/lowcode/section-footers/meta.ts +22 -0
  95. package/lowcode/section-footers/snippe.ts +8 -0
  96. package/lowcode/statistic/meta.ts +1 -1
  97. package/lowcode/timeline/meta.ts +21 -6
  98. package/lowcode/timeline/snippets.ts +10 -2
  99. package/package.json +3 -3
  100. package/es/components/browserSelect/chevron-down.png +0 -0
  101. package/es/components/browserSelect/index.d.ts +0 -15
  102. package/es/components/browserSelect/index.js +0 -36
  103. package/es/components/browserSelect/index.less +0 -18
  104. package/es/components/buttonGroupEdit/index.d.ts +0 -8
  105. package/es/components/buttonGroupEdit/index.js +0 -411
  106. package/es/components/buttonGroupPreview/index.d.ts +0 -20
  107. package/es/components/buttonGroupPreview/index.js +0 -81
  108. package/es/components/date-picker/constants.d.ts +0 -39
  109. package/es/components/date-picker/constants.js +0 -76
  110. package/es/components/date-picker/datePickerCpt.d.ts +0 -8
  111. package/es/components/date-picker/datePickerCpt.js +0 -370
  112. package/es/components/date-picker/hooks/useMediaQuery.d.ts +0 -2
  113. package/es/components/date-picker/hooks/useMediaQuery.js +0 -28
  114. package/es/components/date-picker/index.less +0 -1880
  115. package/es/components/picker-view/index.d.ts +0 -2
  116. package/es/components/picker-view/index.js +0 -2
  117. package/es/components/pisellInformationEntry/hooks/useTerminalPeripherals.d.ts +0 -8
  118. package/es/components/pisellInformationEntry/hooks/useTerminalPeripherals.js +0 -54
  119. package/es/components/pisellTags/index.d.ts +0 -13
  120. package/es/components/pisellTags/index.js +0 -83
  121. package/es/components/pisellTags/index.less +0 -17
  122. package/es/components/pisellTags/utils.d.ts +0 -1
  123. package/es/components/pisellTags/utils.js +0 -89
  124. package/lib/components/browserSelect/chevron-down.png +0 -0
  125. package/lib/components/browserSelect/index.d.ts +0 -15
  126. package/lib/components/browserSelect/index.js +0 -59
  127. package/lib/components/browserSelect/index.less +0 -18
  128. package/lib/components/buttonGroupEdit/index.d.ts +0 -8
  129. package/lib/components/buttonGroupEdit/index.js +0 -234
  130. package/lib/components/buttonGroupPreview/index.d.ts +0 -20
  131. package/lib/components/buttonGroupPreview/index.js +0 -65
  132. package/lib/components/date-picker/constants.d.ts +0 -39
  133. package/lib/components/date-picker/constants.js +0 -78
  134. package/lib/components/date-picker/datePickerCpt.d.ts +0 -8
  135. package/lib/components/date-picker/datePickerCpt.js +0 -403
  136. package/lib/components/date-picker/hooks/useMediaQuery.d.ts +0 -2
  137. package/lib/components/date-picker/hooks/useMediaQuery.js +0 -43
  138. package/lib/components/date-picker/index.less +0 -1880
  139. package/lib/components/picker-view/index.d.ts +0 -2
  140. package/lib/components/picker-view/index.js +0 -36
  141. package/lib/components/pisellInformationEntry/hooks/useTerminalPeripherals.d.ts +0 -8
  142. package/lib/components/pisellInformationEntry/hooks/useTerminalPeripherals.js +0 -83
  143. package/lib/components/pisellTags/index.d.ts +0 -13
  144. package/lib/components/pisellTags/index.js +0 -113
  145. package/lib/components/pisellTags/index.less +0 -17
  146. package/lib/components/pisellTags/utils.d.ts +0 -1
  147. package/lib/components/pisellTags/utils.js +0 -86
@@ -1,65 +0,0 @@
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/buttonGroupPreview/index.tsx
30
- var buttonGroupPreview_exports = {};
31
- __export(buttonGroupPreview_exports, {
32
- default: () => buttonGroupPreview_default
33
- });
34
- module.exports = __toCommonJS(buttonGroupPreview_exports);
35
- var import_react = __toESM(require("react"));
36
- var import_antd = require("antd");
37
- var import_icons = require("@ant-design/icons");
38
- var updateSourceData = ({ buttonConfig, buttonGroupList }) => {
39
- console.log("%c [ 0 ]-43", "font-size:13px; background:#26c778; color:#6affbc;", Object.keys(buttonConfig).length !== 0);
40
- if (Object.keys(buttonConfig).length !== 0) {
41
- return buttonGroupList.map((subArray) => {
42
- return subArray.map((item) => {
43
- if (buttonConfig.hasOwnProperty(item.id)) {
44
- return buttonConfig[item.id];
45
- }
46
- return item;
47
- });
48
- });
49
- }
50
- console.log("%c [ buttonGroupList ]-54", "font-size:13px; background:#721db9; color:#b661fd;", buttonGroupList);
51
- return buttonGroupList;
52
- };
53
- var ButtonGroupPreview = (0, import_react.forwardRef)((props, ref) => {
54
- const { buttonConfig = {}, buttonGroupList = [] } = props;
55
- console.log("%c [ props ]-57", "font-size:13px; background:#305767; color:#749bab;", props);
56
- const sourceDatas = (0, import_react.useMemo)(() => {
57
- return updateSourceData({ buttonConfig, buttonGroupList });
58
- }, [buttonGroupList, buttonConfig]);
59
- return /* @__PURE__ */ import_react.default.createElement(import_antd.Flex, { wrap: true, vertical: true, style: { marginBottom: 10 } }, sourceDatas.map((item, index) => /* @__PURE__ */ import_react.default.createElement(import_antd.Space, { key: index }, item.map((items, index2) => {
60
- const { isMore = false, id = "", menuData = [], children = "默认按钮名称", buttonProps, updateButtonProps = {} } = items;
61
- const btnProps = { ...buttonProps, ...updateButtonProps };
62
- return isMore ? /* @__PURE__ */ import_react.default.createElement(import_antd.Dropdown, { menu: { items: menuData } }, /* @__PURE__ */ import_react.default.createElement(import_antd.Button, null, /* @__PURE__ */ import_react.default.createElement(import_icons.MoreOutlined, null))) : /* @__PURE__ */ import_react.default.createElement(import_antd.Button, { key: id, ...btnProps, children: updateButtonProps.children || children });
63
- }))));
64
- });
65
- var buttonGroupPreview_default = (0, import_react.memo)(ButtonGroupPreview);
@@ -1,39 +0,0 @@
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
- };
@@ -1,78 +0,0 @@
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
- });
@@ -1,8 +0,0 @@
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;
@@ -1,403 +0,0 @@
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;
@@ -1,2 +0,0 @@
1
- declare const useMediaQuery: (query: string) => boolean;
2
- export default useMediaQuery;
@@ -1,43 +0,0 @@
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;