@oceanbase/ui 1.0.0-alpha.10 → 1.0.0-alpha.11

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 (244) hide show
  1. package/dist/ui.min.js +1 -1
  2. package/es/Action/Group.js +1 -0
  3. package/es/Action/Item.js +1 -0
  4. package/es/Action/index.js +1 -0
  5. package/es/BackgroundTaskManager/RefreshMan.js +1 -0
  6. package/es/BackgroundTaskManager/index.js +1 -0
  7. package/es/BasicLayout/Header.js +1 -0
  8. package/es/BasicLayout/index.js +1 -0
  9. package/es/BatchOperationBar/index.js +1 -0
  10. package/es/Boundary/Components/Code.js +1 -0
  11. package/es/Boundary/Components/Exception.js +1 -0
  12. package/es/Boundary/Components/Function.js +1 -0
  13. package/es/Boundary/index.js +1 -0
  14. package/es/ContentWithIcon/index.js +1 -0
  15. package/es/ContentWithQuestion/index.js +1 -0
  16. package/es/DateRanger/PickerPanel.js +1 -0
  17. package/es/DateRanger/Ranger.js +1 -0
  18. package/es/DateRanger/index.js +1 -0
  19. package/es/Dialog/Anchor.js +1 -0
  20. package/es/Dialog/EventProxy.js +1 -0
  21. package/es/Dialog/index.js +1 -0
  22. package/es/DocDialog/index.js +1 -0
  23. package/es/FooterToolbar/index.js +1 -0
  24. package/es/FullscreenBox/index.js +1 -0
  25. package/es/Highlight/DiffView/DiffCells.js +1 -0
  26. package/es/Highlight/DiffView/index.js +1 -0
  27. package/es/Highlight/HighlightCell.js +1 -0
  28. package/es/Highlight/JsonView.js +1 -0
  29. package/es/Highlight/index.js +1 -0
  30. package/es/Highlight/useKeyDownCopyEvent.js +1 -0
  31. package/es/IconFont/index.js +1 -0
  32. package/es/LightFilter/index.js +1 -0
  33. package/es/LocaleDropdown/index.js +1 -0
  34. package/es/Login/ActivateForm.js +1 -0
  35. package/es/Login/LoginForm.js +1 -0
  36. package/es/Login/RegisterForm.js +1 -0
  37. package/es/Login/index.js +1 -0
  38. package/es/Lottie/index.js +1 -0
  39. package/es/NavMenu/index.js +1 -0
  40. package/es/PageContainer/ItemRender.js +1 -0
  41. package/es/PageContainer/index.js +1 -0
  42. package/es/PageLoading/index.js +1 -0
  43. package/es/Password/Content.js +1 -0
  44. package/es/Password/index.js +1 -0
  45. package/es/ProCard/index.js +1 -0
  46. package/es/ProTable/index.js +2 -3
  47. package/es/Ranger/QuickPicker.js +1 -0
  48. package/es/Ranger/Ranger.js +1 -0
  49. package/es/Ranger/index.js +1 -0
  50. package/es/SideTip/Dragger.js +1 -0
  51. package/es/SideTip/IconLoading.js +1 -0
  52. package/es/SideTip/index.js +1 -0
  53. package/es/TagSelect/Group.js +1 -0
  54. package/es/TagSelect/Item.js +1 -0
  55. package/es/TagSelect/index.js +1 -0
  56. package/es/TreeSearch/index.js +1 -0
  57. package/es/Welcome/index.js +1 -0
  58. package/es/Welcome/step.js +1 -0
  59. package/es/_util/index.js +1 -0
  60. package/es/constant/index.js +1 -0
  61. package/es/index.js +1 -0
  62. package/es/locale/LocaleWrapper.js +1 -0
  63. package/es/locale/index.js +1 -0
  64. package/lib/Action/Group.js +189 -162
  65. package/lib/Action/Item.js +47 -65
  66. package/lib/Action/index.js +13 -35
  67. package/lib/Action/style/index.js +25 -43
  68. package/lib/BackgroundTaskManager/RefreshMan.js +34 -50
  69. package/lib/BackgroundTaskManager/constants.js +10 -32
  70. package/lib/BackgroundTaskManager/index.js +118 -126
  71. package/lib/BasicLayout/Header.js +242 -200
  72. package/lib/BasicLayout/index.js +265 -307
  73. package/lib/BasicLayout/locale/en-US.js +16 -34
  74. package/lib/BasicLayout/locale/ja-JP.js +16 -34
  75. package/lib/BasicLayout/locale/zh-CN.js +16 -34
  76. package/lib/BasicLayout/locale/zh-TW.js +16 -34
  77. package/lib/BasicLayout/style/Header.js +41 -60
  78. package/lib/BasicLayout/style/index.js +176 -197
  79. package/lib/BatchOperationBar/index.js +109 -151
  80. package/lib/BatchOperationBar/locale/en-US.js +10 -28
  81. package/lib/BatchOperationBar/locale/ja-JP.js +10 -28
  82. package/lib/BatchOperationBar/locale/zh-CN.js +10 -28
  83. package/lib/BatchOperationBar/locale/zh-TW.js +10 -28
  84. package/lib/BatchOperationBar/style/index.js +30 -46
  85. package/lib/Boundary/Components/Code.js +57 -75
  86. package/lib/Boundary/Components/Exception.js +103 -123
  87. package/lib/Boundary/Components/Function.js +47 -62
  88. package/lib/Boundary/Components/index.js +36 -25
  89. package/lib/Boundary/IBoundary.js +4 -16
  90. package/lib/Boundary/constant.js +16 -38
  91. package/lib/Boundary/index.js +11 -24
  92. package/lib/Boundary/locale/en-US.js +14 -32
  93. package/lib/Boundary/locale/ja-JP.js +14 -32
  94. package/lib/Boundary/locale/zh-CN.js +14 -32
  95. package/lib/Boundary/locale/zh-TW.js +14 -32
  96. package/lib/Boundary/style/index.js +28 -47
  97. package/lib/Boundary/utils.js +9 -31
  98. package/lib/ContentWithIcon/index.js +101 -114
  99. package/lib/ContentWithIcon/style/index.js +17 -36
  100. package/lib/ContentWithQuestion/index.js +40 -52
  101. package/lib/ContentWithQuestion/style/index.js +16 -35
  102. package/lib/DateRanger/PickerPanel.js +343 -325
  103. package/lib/DateRanger/Ranger.js +430 -515
  104. package/lib/DateRanger/constant/index.js +188 -376
  105. package/lib/DateRanger/index.js +45 -64
  106. package/lib/DateRanger/locale/en-US.js +20 -47
  107. package/lib/DateRanger/locale/ja-JP.js +20 -47
  108. package/lib/DateRanger/locale/zh-CN.js +20 -47
  109. package/lib/DateRanger/locale/zh-TW.js +20 -47
  110. package/lib/DateRanger/style/index.js +41 -62
  111. package/lib/DateRanger/typing.js +4 -16
  112. package/lib/Dialog/Anchor.js +70 -95
  113. package/lib/Dialog/Dock.js +14 -36
  114. package/lib/Dialog/EventProxy.js +21 -39
  115. package/lib/Dialog/index.js +327 -370
  116. package/lib/Dialog/locale/en-US.js +8 -26
  117. package/lib/Dialog/locale/ja-JP.js +8 -26
  118. package/lib/Dialog/locale/zh-CN.js +8 -26
  119. package/lib/Dialog/locale/zh-TW.js +8 -26
  120. package/lib/Dialog/style/index.js +58 -76
  121. package/lib/DocDialog/index.js +51 -77
  122. package/lib/DocDialog/locale/en-US.js +5 -23
  123. package/lib/DocDialog/locale/ja-JP.js +5 -23
  124. package/lib/DocDialog/locale/zh-CN.js +5 -23
  125. package/lib/DocDialog/locale/zh-TW.js +5 -23
  126. package/lib/FooterToolbar/index.js +27 -45
  127. package/lib/FooterToolbar/style/index.js +23 -38
  128. package/lib/FullscreenBox/index.js +151 -138
  129. package/lib/FullscreenBox/locale/en-US.js +5 -23
  130. package/lib/FullscreenBox/locale/ja-JP.js +5 -23
  131. package/lib/FullscreenBox/locale/zh-CN.js +5 -23
  132. package/lib/FullscreenBox/locale/zh-TW.js +5 -23
  133. package/lib/FullscreenBox/style/index.js +23 -41
  134. package/lib/Highlight/DiffView/DiffCells.js +34 -54
  135. package/lib/Highlight/DiffView/index.js +165 -163
  136. package/lib/Highlight/HighlightCell.js +28 -47
  137. package/lib/Highlight/JsonView.js +45 -74
  138. package/lib/Highlight/index.js +200 -214
  139. package/lib/Highlight/languages/bash.js +7 -34
  140. package/lib/Highlight/languages/cpp.js +7 -34
  141. package/lib/Highlight/languages/css.js +7 -34
  142. package/lib/Highlight/languages/dockerfile.js +7 -34
  143. package/lib/Highlight/languages/go.js +7 -34
  144. package/lib/Highlight/languages/groovy.js +7 -34
  145. package/lib/Highlight/languages/http.js +7 -34
  146. package/lib/Highlight/languages/java.js +7 -34
  147. package/lib/Highlight/languages/javascript.js +7 -34
  148. package/lib/Highlight/languages/json.js +7 -34
  149. package/lib/Highlight/languages/markdown.js +7 -34
  150. package/lib/Highlight/languages/nginx.js +7 -34
  151. package/lib/Highlight/languages/python.js +7 -34
  152. package/lib/Highlight/languages/ruby.js +7 -34
  153. package/lib/Highlight/languages/solidity.js +7 -34
  154. package/lib/Highlight/languages/sql.js +7 -34
  155. package/lib/Highlight/languages/typescript.js +7 -34
  156. package/lib/Highlight/languages/xml.js +7 -34
  157. package/lib/Highlight/languages/yaml.js +7 -34
  158. package/lib/Highlight/locale/en-US.js +7 -25
  159. package/lib/Highlight/locale/ja-JP.js +7 -25
  160. package/lib/Highlight/locale/zh-CN.js +7 -25
  161. package/lib/Highlight/locale/zh-TW.js +7 -25
  162. package/lib/Highlight/style/index.js +128 -144
  163. package/lib/Highlight/useKeyDownCopyEvent.js +40 -64
  164. package/lib/IconFont/index.js +23 -28
  165. package/lib/LightFilter/index.js +29 -43
  166. package/lib/LightFilter/style/index.js +15 -33
  167. package/lib/LocaleDropdown/index.js +43 -53
  168. package/lib/Login/ActivateForm.js +93 -119
  169. package/lib/Login/LoginForm.js +149 -184
  170. package/lib/Login/RegisterForm.js +122 -163
  171. package/lib/Login/index.js +157 -163
  172. package/lib/Login/locale/en-US.js +31 -49
  173. package/lib/Login/locale/ja-JP.js +31 -49
  174. package/lib/Login/locale/zh-CN.js +31 -49
  175. package/lib/Login/locale/zh-TW.js +30 -48
  176. package/lib/Login/style/index.js +77 -98
  177. package/lib/Lottie/index.js +7 -24
  178. package/lib/NavMenu/index.js +105 -108
  179. package/lib/NavMenu/style/index.js +31 -49
  180. package/lib/PageContainer/ItemRender.js +28 -46
  181. package/lib/PageContainer/index.js +125 -140
  182. package/lib/PageContainer/locale/en-US.js +8 -26
  183. package/lib/PageContainer/locale/ja-JP.js +8 -26
  184. package/lib/PageContainer/locale/zh-CN.js +8 -26
  185. package/lib/PageContainer/locale/zh-TW.js +8 -26
  186. package/lib/PageContainer/style/index.js +19 -40
  187. package/lib/PageLoading/index.js +33 -54
  188. package/lib/Password/Content.js +92 -80
  189. package/lib/Password/index.js +125 -160
  190. package/lib/Password/locale/en-US.js +14 -32
  191. package/lib/Password/locale/ja-JP.js +16 -34
  192. package/lib/Password/locale/zh-CN.js +15 -33
  193. package/lib/Password/locale/zh-TW.js +14 -32
  194. package/lib/ProCard/index.js +77 -98
  195. package/lib/ProCard/style/index.js +21 -39
  196. package/lib/ProTable/index.js +102 -123
  197. package/lib/ProTable/style/index.js +21 -38
  198. package/lib/Ranger/QuickPicker.js +92 -94
  199. package/lib/Ranger/Ranger.js +98 -133
  200. package/lib/Ranger/constant/index.js +115 -266
  201. package/lib/Ranger/index.js +61 -69
  202. package/lib/Ranger/locale/en-US.js +31 -49
  203. package/lib/Ranger/locale/ja-JP.js +31 -49
  204. package/lib/Ranger/locale/zh-CN.js +7 -25
  205. package/lib/Ranger/locale/zh-TW.js +7 -25
  206. package/lib/Ranger/style/index.js +21 -39
  207. package/lib/Ranger/typing.js +4 -16
  208. package/lib/SideTip/Dragger.js +259 -219
  209. package/lib/SideTip/IconLoading.js +43 -74
  210. package/lib/SideTip/index.js +124 -126
  211. package/lib/SideTip/locale/en-US.js +5 -23
  212. package/lib/SideTip/locale/ja-JP.js +5 -23
  213. package/lib/SideTip/locale/zh-CN.js +5 -23
  214. package/lib/SideTip/locale/zh-TW.js +5 -23
  215. package/lib/SideTip/style/index.js +76 -92
  216. package/lib/SideTip/utils.js +40 -61
  217. package/lib/TagSelect/Group.js +64 -83
  218. package/lib/TagSelect/Item.js +68 -91
  219. package/lib/TagSelect/TagSelectContext.js +7 -25
  220. package/lib/TagSelect/index.js +12 -35
  221. package/lib/TagSelect/style/index.js +41 -64
  222. package/lib/TreeSearch/index.js +133 -127
  223. package/lib/TreeSearch/util.js +52 -70
  224. package/lib/Welcome/index.js +142 -117
  225. package/lib/Welcome/locale/en-US.js +8 -26
  226. package/lib/Welcome/locale/ja-JP.js +8 -26
  227. package/lib/Welcome/locale/zh-CN.js +8 -26
  228. package/lib/Welcome/locale/zh-TW.js +8 -26
  229. package/lib/Welcome/step/style/index.js +24 -40
  230. package/lib/Welcome/step.js +63 -59
  231. package/lib/Welcome/style/index.js +58 -70
  232. package/lib/_util/genComponentStyleHook.js +15 -43
  233. package/lib/_util/index.js +38 -43
  234. package/lib/_util/useNavigate.js +11 -26
  235. package/lib/constant/index.js +23 -49
  236. package/lib/index.js +283 -129
  237. package/lib/interface.js +4 -16
  238. package/lib/locale/LocaleWrapper.js +50 -60
  239. package/lib/locale/en-US.js +37 -64
  240. package/lib/locale/index.js +5 -16
  241. package/lib/locale/ja-JP.js +37 -64
  242. package/lib/locale/zh-CN.js +36 -63
  243. package/lib/locale/zh-TW.js +32 -59
  244. package/package.json +3 -3
@@ -1,67 +1,49 @@
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);
1
+ "use strict";
28
2
 
29
- // src/DateRanger/PickerPanel.tsx
30
- var PickerPanel_exports = {};
31
- __export(PickerPanel_exports, {
32
- default: () => PickerPanel_default
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
33
5
  });
34
- module.exports = __toCommonJS(PickerPanel_exports);
35
- var import_react = __toESM(require("react"));
36
- var import_dayjs = __toESM(require("rc-picker/es/generate/dayjs"));
37
- var import_moment = __toESM(require("rc-picker/es/generate/moment"));
38
- var import_useCSSVarCls = __toESM(require("antd/es/config-provider/hooks/useCSSVarCls"));
39
- var import_style = __toESM(require("antd/es/date-picker/style/index"));
40
- var import_rc_picker = require("rc-picker");
41
- var import_classnames = __toESM(require("classnames"));
42
- var import_design = require("@oceanbase/design");
43
- var import_lodash = require("lodash");
44
- var import_moment2 = __toESM(require("moment"));
45
- var import_dayjs2 = __toESM(require("dayjs"));
46
- var import_constant = require("./constant");
47
- var import_jsx_runtime = require("react/jsx-runtime");
48
- var ALL_ERROR_TYPE_LIST = ["endDate", "startDate", "endTime", "startTime"];
49
- var CLICK_STATE = {
50
- START: "START",
51
- END: "END"
6
+ exports.default = void 0;
7
+ var _react = _interopRequireWildcard(require("react"));
8
+ var _dayjs = _interopRequireDefault(require("rc-picker/es/generate/dayjs"));
9
+ var _moment = _interopRequireDefault(require("rc-picker/es/generate/moment"));
10
+ var _useCSSVarCls = _interopRequireDefault(require("antd/es/config-provider/hooks/useCSSVarCls"));
11
+ var _index = _interopRequireDefault(require("antd/es/date-picker/style/index"));
12
+ var _rcPicker = require("rc-picker");
13
+ var _classnames = _interopRequireDefault(require("classnames"));
14
+ var _design = require("@oceanbase/design");
15
+ var _lodash = require("lodash");
16
+ var _moment2 = _interopRequireDefault(require("moment"));
17
+ var _dayjs2 = _interopRequireDefault(require("dayjs"));
18
+ var _constant = require("./constant");
19
+ var _jsxRuntime = require("react/jsx-runtime");
20
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
21
+ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
22
+ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
23
+ "use client";
24
+ const ALL_ERROR_TYPE_LIST = ['endDate', 'startDate', 'endTime', 'startTime'];
25
+ /**
26
+ * 点击交互/时间选择交互
27
+ * - 首次点击时,开始时间和结束时间都置为所点击的时间
28
+ * - 第二次点击时,根据点击的时间,判断是开始时间还是结束时间进行赋值
29
+ * - 新一轮交互开始...
30
+ */
31
+ const CLICK_STATE = {
32
+ START: 'START',
33
+ END: 'END'
52
34
  };
53
- var useClickFSA = () => {
54
- const [state, setState] = (0, import_react.useState)(CLICK_STATE.END);
35
+ const useClickFSA = () => {
36
+ const [state, setState] = (0, _react.useState)(CLICK_STATE.END);
55
37
  const next = () => {
56
- setState((ps) => {
38
+ setState(ps => {
57
39
  return ps === CLICK_STATE.START ? CLICK_STATE.END : CLICK_STATE.START;
58
40
  });
59
41
  };
60
42
  return [state, next];
61
43
  };
62
- var prefixCls = "ant-picker";
63
- var TIME_FORMAT = "HH:mm:ss";
64
- var InternalPickerPanel = (props) => {
44
+ const prefixCls = 'ant-picker';
45
+ const TIME_FORMAT = 'HH:mm:ss';
46
+ const InternalPickerPanel = props => {
65
47
  const {
66
48
  defaultValue,
67
49
  isMoment,
@@ -69,51 +51,53 @@ var InternalPickerPanel = (props) => {
69
51
  tip,
70
52
  rules,
71
53
  required = true,
72
- onOk = import_lodash.noop,
73
- onCancel = import_lodash.noop,
54
+ onOk = _lodash.noop,
55
+ onCancel = _lodash.noop,
74
56
  disabledDate,
75
57
  hideSecond
76
58
  } = props;
77
- const { getPrefixCls } = (0, import_react.useContext)(import_design.ConfigProvider.ConfigContext);
78
- const prefix = getPrefixCls("ranger-picker-panel");
79
- const rootCls = (0, import_useCSSVarCls.default)(prefixCls);
80
- const [wrapCSSVar, hashId, cssVarCls] = (0, import_style.default)(prefixCls, rootCls);
59
+ const {
60
+ getPrefixCls
61
+ } = (0, _react.useContext)(_design.ConfigProvider.ConfigContext);
62
+ const prefix = getPrefixCls('ranger-picker-panel');
63
+ const rootCls = (0, _useCSSVarCls.default)(prefixCls);
64
+ const [wrapCSSVar, hashId, cssVarCls] = (0, _index.default)(prefixCls, rootCls);
81
65
  const [clickFSA, clickFSANext] = useClickFSA();
82
66
  const [defaultS, defaultE] = defaultValue;
83
- const [calendarValue, setCalendarValue] = import_react.default.useState(defaultValue);
84
- const [internalHoverValues, setInternalHoverValues] = import_react.default.useState(null);
85
- const [activeIndex, setActiveIndex] = import_react.default.useState(0);
86
- const isEn = (locale == null ? void 0 : locale.antLocale) === "en";
87
- const DATE_FORMAT = isEn ? import_constant.DATE_TIME_MONTH_FORMAT : import_constant.DATE_TIME_MONTH_FORMAT_CN;
88
- const getDateInstance = (0, import_react.useCallback)(
89
- (v, format, strict) => {
90
- return isMoment ? (0, import_moment2.default)(v, format, strict) : (0, import_dayjs2.default)(v, format, strict);
91
- },
92
- [isMoment]
93
- );
94
- const hoverValues = import_react.default.useMemo(() => {
67
+ const [calendarValue, setCalendarValue] = _react.default.useState(defaultValue);
68
+ const [internalHoverValues, setInternalHoverValues] = _react.default.useState(null);
69
+ const [activeIndex, setActiveIndex] = _react.default.useState(0);
70
+ const isEn = locale?.antLocale === 'en';
71
+
72
+ //
73
+ const DATE_FORMAT = isEn ? _constant.DATE_TIME_MONTH_FORMAT : _constant.DATE_TIME_MONTH_FORMAT_CN;
74
+ const getDateInstance = (0, _react.useCallback)((v, format, strict) => {
75
+ return isMoment ? (0, _moment2.default)(v, format, strict) : (0, _dayjs2.default)(v, format, strict);
76
+ }, [isMoment]);
77
+ const hoverValues = _react.default.useMemo(() => {
95
78
  return internalHoverValues || calendarValue;
96
79
  }, [internalHoverValues, calendarValue]);
97
- const fillCalendarValue = (date, index) => (
98
- // Trigger change only when date changed
99
- fillIndex(calendarValue, index, date)
100
- );
80
+
81
+ // ======================== Change ========================
82
+ const fillCalendarValue = (date, index) =>
83
+ // Trigger change only when date changed
84
+ fillIndex(calendarValue, index, date);
101
85
  function fillIndex(ori, index, value) {
102
86
  const clone = [...ori];
103
87
  clone[index] = value;
104
88
  return clone;
105
89
  }
106
- const onPanelHover = (date) => {
107
- setInternalHoverValues(
108
- date && clickFSA === CLICK_STATE.START ? fillCalendarValue(date, activeIndex) : null
109
- );
90
+ const onPanelHover = date => {
91
+ setInternalHoverValues(date && clickFSA === CLICK_STATE.START ? fillCalendarValue(date, activeIndex) : null);
110
92
  };
93
+
94
+ // 对日期进行排序
111
95
  const formatValues = [...calendarValue].sort((a, b) => {
112
- return (a == null ? void 0 : a.valueOf()) - (b == null ? void 0 : b.valueOf());
113
- }).map((item) => {
114
- return item == null ? void 0 : item.format(DATE_FORMAT);
96
+ return a?.valueOf() - b?.valueOf();
97
+ }).map(item => {
98
+ return item?.format(DATE_FORMAT);
115
99
  });
116
- const [form] = import_design.Form.useForm();
100
+ const [form] = _design.Form.useForm();
117
101
  const [_sDate, _eDate] = formatValues;
118
102
  const setFormatDateToForm = () => {
119
103
  form.setFieldsValue({
@@ -121,270 +105,304 @@ var InternalPickerPanel = (props) => {
121
105
  endDate: getDateInstance(_eDate)
122
106
  });
123
107
  };
124
- (0, import_react.useEffect)(() => {
108
+ (0, _react.useEffect)(() => {
125
109
  setFormatDateToForm();
126
110
  }, [_sDate, _eDate]);
127
- const defaultTime = (0, import_react.useMemo)(() => {
111
+ const defaultTime = (0, _react.useMemo)(() => {
128
112
  return getDateInstance();
129
113
  }, []);
130
- const [errorMessage, setErrorMessage] = (0, import_react.useState)("");
131
- const [errorTypeList, setErrorTypeList] = (0, import_react.useState)([]);
114
+ const [errorMessage, setErrorMessage] = (0, _react.useState)('');
115
+ const [errorTypeList, setErrorTypeList] = (0, _react.useState)([]);
132
116
  const errorTypeMap = errorTypeList.reduce((pre, errorKey) => {
133
- pre[errorKey] = "error";
117
+ pre[errorKey] = 'error';
134
118
  return pre;
135
119
  }, {});
136
- const formatDate = (v) => {
120
+ const formatDate = v => {
137
121
  const date = getDateInstance(v, DATE_FORMAT, true);
138
122
  return date.isValid() ? date.format(DATE_FORMAT) : null;
139
123
  };
140
- const validateInputDate = (e) => {
124
+ const validateInputDate = e => {
141
125
  const v = e.target.value;
142
126
  return formatDate(v);
143
127
  };
144
- return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: (0, import_classnames.default)(prefix), children: [
145
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_design.Space, { direction: "vertical", size: 12, style: { margin: "12px 0" }, children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
146
- import_design.Form,
147
- {
128
+ return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
129
+ className: (0, _classnames.default)(prefix),
130
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_design.Space, {
131
+ direction: "vertical",
132
+ size: 12,
133
+ style: {
134
+ margin: '12px 0'
135
+ },
136
+ children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_design.Form, {
148
137
  layout: "vertical",
149
138
  autoComplete: "off",
150
139
  requiredMark: false,
151
- style: { width: 280 },
152
- form,
153
- children: [
154
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_design.Row, { gutter: 12, style: { marginBottom: 4 }, children: [
155
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_design.Col, { span: 12, style: { paddingLeft: 12 }, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
156
- import_design.Form.Item,
157
- {
158
- name: "startDate",
159
- label: locale.startDate,
160
- validateStatus: errorTypeMap["startDate"],
161
- style: { marginBottom: 8 },
162
- rules: [{ required: true }],
163
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
164
- import_design.DatePicker,
165
- {
166
- format: {
167
- format: "YYYY-MM-DD",
168
- type: "mask"
169
- },
170
- style: { width: 128 },
171
- open: false,
172
- suffixIcon: null,
173
- allowClear: false,
174
- onBlur: (e) => {
175
- const v = validateInputDate(e);
176
- if (v) {
177
- form.setFieldValue("startDate", getDateInstance(v));
178
- setCalendarValue(([, eDate]) => {
179
- return [getDateInstance(v), eDate];
180
- });
181
- } else {
182
- setFormatDateToForm();
183
- }
184
- }
185
- }
186
- )
187
- }
188
- ) }),
189
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_design.Col, { span: 12, style: { paddingRight: 8 }, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
190
- import_design.Form.Item,
191
- {
192
- name: "startTime",
193
- label: locale.startTime,
194
- style: { marginBottom: 8 },
195
- validateStatus: errorTypeMap["startTime"],
196
- initialValue: defaultS || defaultTime,
197
- rules: [{ required: true }],
198
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
199
- import_design.TimePicker,
200
- {
201
- allowClear: false,
202
- suffixIcon: null,
203
- needConfirm: false,
204
- getPopupContainer: (triggerNode) => triggerNode.parentNode,
205
- style: { width: "100%" },
206
- format: {
207
- format: hideSecond ? "HH:mm" : "HH:mm:ss",
208
- type: "mask"
209
- }
210
- }
211
- )
212
- }
213
- ) })
214
- ] }),
215
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_design.Row, { gutter: 12, children: [
216
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_design.Col, { span: 12, style: { paddingLeft: 12 }, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
217
- import_design.Form.Item,
218
- {
219
- name: "endDate",
220
- label: locale.endDate,
221
- style: { marginBottom: 0 },
222
- validateStatus: errorTypeMap["endDate"],
223
- rules: [{ required: true }],
224
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
225
- import_design.DatePicker,
226
- {
227
- format: {
228
- format: "YYYY-MM-DD",
229
- type: "mask"
230
- },
231
- style: { width: 128 },
232
- open: false,
233
- suffixIcon: null,
234
- allowClear: false,
235
- onBlur: (e) => {
236
- const v = validateInputDate(e);
237
- if (v) {
238
- form.setFieldValue("endDate", getDateInstance(v));
239
- setCalendarValue(([sDate]) => {
240
- return [sDate, getDateInstance(v)];
241
- });
242
- } else {
243
- setFormatDateToForm();
244
- }
245
- }
246
- }
247
- )
248
- }
249
- ) }),
250
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_design.Col, { span: 12, style: { paddingRight: 8 }, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
251
- import_design.Form.Item,
252
- {
253
- name: "endTime",
254
- label: locale.endTime,
255
- style: { marginBottom: 0 },
256
- validateStatus: errorTypeMap["endTime"],
257
- initialValue: defaultE || defaultTime,
258
- rules: [{ required: true }],
259
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
260
- import_design.TimePicker,
261
- {
262
- allowClear: false,
263
- suffixIcon: null,
264
- needConfirm: false,
265
- getPopupContainer: (triggerNode) => triggerNode.parentNode,
266
- style: { width: "100%" },
267
- format: {
268
- format: hideSecond ? "HH:mm" : "HH:mm:ss",
269
- type: "mask"
270
- }
271
- }
272
- )
273
- }
274
- ) })
275
- ] })
276
- ]
277
- }
278
- ) }),
279
- wrapCSSVar(
280
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
281
- "div",
282
- {
283
- className: (0, import_classnames.default)("ant-picker-dropdown", hashId, cssVarCls, rootCls),
140
+ style: {
141
+ width: 280
142
+ },
143
+ form: form,
144
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_design.Row, {
145
+ gutter: 12,
284
146
  style: {
285
- position: "initial",
286
- pointerEvents: "auto"
147
+ marginBottom: 4
287
148
  },
288
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
289
- import_rc_picker.PickerPanel,
290
- {
291
- prefixCls,
292
- generateConfig: isMoment ? import_moment.default : import_dayjs.default,
293
- value: calendarValue,
294
- disabledDate,
295
- onHover: (...res) => {
296
- onPanelHover(res[0]);
149
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_design.Col, {
150
+ span: 12,
151
+ style: {
152
+ paddingLeft: 12
153
+ },
154
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_design.Form.Item, {
155
+ name: "startDate",
156
+ label: locale.startDate,
157
+ validateStatus: errorTypeMap['startDate'],
158
+ style: {
159
+ marginBottom: 8
297
160
  },
298
- onSelect: (...res) => {
299
- clickFSANext();
300
- if (clickFSA === CLICK_STATE.END) {
301
- setCalendarValue([res[0], res[0]]);
302
- } else {
303
- setCalendarValue(fillCalendarValue(res[0], activeIndex));
161
+ rules: [{
162
+ required: true
163
+ }],
164
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_design.DatePicker, {
165
+ format: {
166
+ format: 'YYYY-MM-DD',
167
+ type: 'mask'
168
+ },
169
+ style: {
170
+ width: 128
171
+ },
172
+ open: false,
173
+ suffixIcon: null,
174
+ allowClear: false,
175
+ onBlur: e => {
176
+ const v = validateInputDate(e);
177
+ if (v) {
178
+ form.setFieldValue('startDate', getDateInstance(v));
179
+ setCalendarValue(([, eDate]) => {
180
+ return [getDateInstance(v), eDate];
181
+ });
182
+ } else {
183
+ setFormatDateToForm();
184
+ }
304
185
  }
305
- setActiveIndex((index) => {
306
- return index + 1 === 2 ? 0 : index + 1;
307
- });
186
+ })
187
+ })
188
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_design.Col, {
189
+ span: 12,
190
+ style: {
191
+ paddingRight: 8
192
+ },
193
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_design.Form.Item, {
194
+ name: "startTime",
195
+ label: locale.startTime,
196
+ style: {
197
+ marginBottom: 8
308
198
  },
309
- hoverRangeValue: hoverValues,
310
- activeOffset: 0,
311
- allowEmpty: [false, false],
312
- mode: "date",
313
- internalMode: "date",
314
- picker: "date",
315
- locale,
316
- showNow: false,
317
- range: true,
318
- needConfirm: false
319
- }
320
- )
321
- }
322
- )
323
- ),
324
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_design.Divider, { style: { margin: "8px 0" } }),
325
- tip && !errorMessage && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_design.Alert, { message: tip, type: "info", style: { marginBottom: 8 }, showIcon: true }),
326
- errorMessage && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_design.Alert, { message: errorMessage, type: "error", style: { marginBottom: 8 }, showIcon: true }),
327
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
328
- import_design.Space,
329
- {
330
- style: {
331
- width: "100%",
332
- justifyContent: "flex-end",
333
- padding: "0 12px 4px 0"
334
- },
335
- children: [
336
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
337
- import_design.Button,
338
- {
339
- size: "small",
340
- onClick: () => {
341
- onCancel();
199
+ validateStatus: errorTypeMap['startTime'],
200
+ initialValue: defaultS || defaultTime,
201
+ rules: [{
202
+ required: true
203
+ }],
204
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_design.TimePicker, {
205
+ allowClear: false,
206
+ suffixIcon: null,
207
+ needConfirm: false,
208
+ getPopupContainer: triggerNode => triggerNode.parentNode,
209
+ style: {
210
+ width: '100%'
211
+ },
212
+ format: {
213
+ format: hideSecond ? 'HH:mm' : 'HH:mm:ss',
214
+ type: 'mask'
215
+ }
216
+ })
217
+ })
218
+ })]
219
+ }), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_design.Row, {
220
+ gutter: 12,
221
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_design.Col, {
222
+ span: 12,
223
+ style: {
224
+ paddingLeft: 12
225
+ },
226
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_design.Form.Item, {
227
+ name: "endDate",
228
+ label: locale.endDate,
229
+ style: {
230
+ marginBottom: 0
342
231
  },
343
- children: locale.cancel
344
- }
345
- ),
346
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
347
- import_design.Button,
348
- {
349
- size: "small",
350
- type: "primary",
351
- onClick: () => {
352
- form.validateFields().then((values) => {
353
- const { startDate, startTime, endDate, endTime } = values;
354
- const [sTime, eTime] = startDate.isSame(endDate) ? [startTime, endTime].sort((a, b) => {
355
- return (a == null ? void 0 : a.valueOf()) - (b == null ? void 0 : b.valueOf());
356
- }) : [startTime, endTime];
357
- const start = `${formatDate(startDate)} ${sTime.format(TIME_FORMAT)}`;
358
- const end = `${formatDate(endDate)} ${eTime.format(TIME_FORMAT)}`;
359
- let errorList = [];
360
- let message = "";
361
- rules == null ? void 0 : rules.some((item) => {
362
- if (typeof (item == null ? void 0 : item.validator) === "function") {
363
- const errorType = item.validator([start, end]);
364
- if (errorType) {
365
- errorList = Array.isArray(errorType) ? errorType : [errorType];
366
- message = item.message;
367
- return true;
368
- }
369
- }
370
- return false;
371
- });
372
- if (errorList.length > 0) {
373
- setErrorTypeList(errorList.includes("all") ? ALL_ERROR_TYPE_LIST : errorList);
374
- setErrorMessage(message);
232
+ validateStatus: errorTypeMap['endDate'],
233
+ rules: [{
234
+ required: true
235
+ }],
236
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_design.DatePicker, {
237
+ format: {
238
+ format: 'YYYY-MM-DD',
239
+ type: 'mask'
240
+ },
241
+ style: {
242
+ width: 128
243
+ },
244
+ open: false,
245
+ suffixIcon: null,
246
+ allowClear: false,
247
+ onBlur: e => {
248
+ const v = validateInputDate(e);
249
+ if (v) {
250
+ form.setFieldValue('endDate', getDateInstance(v));
251
+ setCalendarValue(([sDate]) => {
252
+ return [sDate, getDateInstance(v)];
253
+ });
375
254
  } else {
376
- setErrorMessage("");
377
- setErrorTypeList([]);
378
- onOk([start, end]);
255
+ setFormatDateToForm();
379
256
  }
380
- });
257
+ }
258
+ })
259
+ })
260
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_design.Col, {
261
+ span: 12,
262
+ style: {
263
+ paddingRight: 8
264
+ },
265
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_design.Form.Item, {
266
+ name: "endTime",
267
+ label: locale.endTime,
268
+ style: {
269
+ marginBottom: 0
381
270
  },
382
- children: locale.confirm
383
- }
384
- )
385
- ]
271
+ validateStatus: errorTypeMap['endTime'],
272
+ initialValue: defaultE || defaultTime,
273
+ rules: [{
274
+ required: true
275
+ }],
276
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_design.TimePicker, {
277
+ allowClear: false,
278
+ suffixIcon: null,
279
+ needConfirm: false,
280
+ getPopupContainer: triggerNode => triggerNode.parentNode,
281
+ style: {
282
+ width: '100%'
283
+ },
284
+ format: {
285
+ format: hideSecond ? 'HH:mm' : 'HH:mm:ss',
286
+ type: 'mask'
287
+ }
288
+ })
289
+ })
290
+ })]
291
+ })]
292
+ })
293
+ }), wrapCSSVar( /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
294
+ className: (0, _classnames.default)('ant-picker-dropdown', hashId, cssVarCls, rootCls),
295
+ style: {
296
+ position: 'initial',
297
+ pointerEvents: 'auto'
298
+ },
299
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_rcPicker.PickerPanel, {
300
+ prefixCls: prefixCls
301
+ // @ts-ignore
302
+ ,
303
+ generateConfig: isMoment ? _moment.default : _dayjs.default
304
+ // @ts-ignore
305
+ ,
306
+ value: calendarValue,
307
+ disabledDate: disabledDate,
308
+ onHover: (...res) => {
309
+ onPanelHover(res[0]);
310
+ },
311
+ onSelect: (...res) => {
312
+ clickFSANext();
313
+ if (clickFSA === CLICK_STATE.END) {
314
+ setCalendarValue([res[0], res[0]]);
315
+ } else {
316
+ setCalendarValue(fillCalendarValue(res[0], activeIndex));
317
+ }
318
+ setActiveIndex(index => {
319
+ return index + 1 === 2 ? 0 : index + 1;
320
+ });
321
+ },
322
+ hoverRangeValue: hoverValues,
323
+ activeOffset: 0,
324
+ allowEmpty: [false, false],
325
+ mode: "date",
326
+ internalMode: "date",
327
+ picker: "date",
328
+ locale: locale,
329
+ showNow: false,
330
+ range: true,
331
+ needConfirm: false
332
+ })
333
+ })), /*#__PURE__*/(0, _jsxRuntime.jsx)(_design.Divider, {
334
+ style: {
335
+ margin: '8px 0'
386
336
  }
387
- )
388
- ] });
337
+ }), tip && !errorMessage && /*#__PURE__*/(0, _jsxRuntime.jsx)(_design.Alert, {
338
+ message: tip,
339
+ type: "info",
340
+ style: {
341
+ marginBottom: 8
342
+ },
343
+ showIcon: true
344
+ }), errorMessage && /*#__PURE__*/(0, _jsxRuntime.jsx)(_design.Alert, {
345
+ message: errorMessage,
346
+ type: "error",
347
+ style: {
348
+ marginBottom: 8
349
+ },
350
+ showIcon: true
351
+ }), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_design.Space, {
352
+ style: {
353
+ width: '100%',
354
+ justifyContent: 'flex-end',
355
+ padding: '0 12px 4px 0'
356
+ },
357
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_design.Button, {
358
+ size: "small",
359
+ onClick: () => {
360
+ onCancel();
361
+ },
362
+ children: locale.cancel
363
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_design.Button, {
364
+ size: "small",
365
+ type: "primary",
366
+ onClick: () => {
367
+ form.validateFields().then(values => {
368
+ const {
369
+ startDate,
370
+ startTime,
371
+ endDate,
372
+ endTime
373
+ } = values;
374
+ // 日期同一天时对时间进行排序,保证开始时间在结束时间之前
375
+ const [sTime, eTime] = startDate.isSame(endDate) ? [startTime, endTime].sort((a, b) => {
376
+ return a?.valueOf() - b?.valueOf();
377
+ }) : [startTime, endTime];
378
+ const start = `${formatDate(startDate)} ${sTime.format(TIME_FORMAT)}`;
379
+ const end = `${formatDate(endDate)} ${eTime.format(TIME_FORMAT)}`;
380
+ let errorList = [];
381
+ let message = '';
382
+ rules?.some(item => {
383
+ if (typeof item?.validator === 'function') {
384
+ const errorType = item.validator([start, end]);
385
+ if (errorType) {
386
+ errorList = Array.isArray(errorType) ? errorType : [errorType];
387
+ message = item.message;
388
+ return true;
389
+ }
390
+ }
391
+ return false;
392
+ });
393
+ if (errorList.length > 0) {
394
+ setErrorTypeList(errorList.includes('all') ? ALL_ERROR_TYPE_LIST : errorList);
395
+ setErrorMessage(message);
396
+ } else {
397
+ setErrorMessage('');
398
+ setErrorTypeList([]);
399
+ onOk([start, end]);
400
+ }
401
+ });
402
+ },
403
+ children: locale.confirm
404
+ })]
405
+ })]
406
+ });
389
407
  };
390
- var PickerPanel_default = InternalPickerPanel;
408
+ var _default = exports.default = InternalPickerPanel;