@capillarytech/blaze-ui 5.1.17 → 5.1.19
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/.DS_Store +0 -0
- package/CapCollapsibleNavbar/index.js +8 -2
- package/CapCollapsibleNavbar/index.js.map +1 -1
- package/CapCondition/index.js +8 -2
- package/CapCondition/index.js.map +1 -1
- package/CapDatePicker/index.js +8 -2
- package/CapDatePicker/index.js.map +1 -1
- package/CapDateTimePicker/README.md +136 -0
- package/CapDateTimePicker/index.d.ts +13 -0
- package/CapDateTimePicker/index.d.ts.map +1 -0
- package/CapDateTimePicker/index.js +112 -99
- package/CapDateTimePicker/index.js.map +1 -1
- package/CapDateTimePicker/messages.d.ts +17 -0
- package/CapDateTimePicker/messages.d.ts.map +1 -0
- package/CapDateTimePicker/types.d.ts +89 -0
- package/CapDateTimePicker/types.d.ts.map +1 -0
- package/CapDateTimeRangePicker/index.js +8 -2
- package/CapDateTimeRangePicker/index.js.map +1 -1
- package/CapEventCalendar/index.js +8 -2
- package/CapEventCalendar/index.js.map +1 -1
- package/CapLanguageProvider/index.js +8 -2
- package/CapLanguageProvider/index.js.map +1 -1
- package/CapNotificationDropdown/index.js +8 -2
- package/CapNotificationDropdown/index.js.map +1 -1
- package/CapReorderComponent/README.md +179 -0
- package/CapReorderComponent/Status.md +41 -0
- package/CapReorderComponent/index.d.ts +11 -0
- package/CapReorderComponent/index.d.ts.map +1 -0
- package/CapReorderComponent/index.js +48 -46
- package/CapReorderComponent/index.js.map +1 -1
- package/CapReorderComponent/types.d.ts +16 -0
- package/CapReorderComponent/types.d.ts.map +1 -0
- package/CapTimePicker/index.js +8 -2
- package/CapTimePicker/index.js.map +1 -1
- package/index.d.ts +4 -0
- package/index.d.ts.map +1 -1
- package/index.js +2223 -50
- package/index.js.map +1 -1
- package/package.json +1 -1
- package/utils/dayjs.d.ts +2 -0
- package/utils/dayjs.d.ts.map +1 -1
- package/utils/getCapThemeConfig.d.ts.map +1 -1
- package/utils/index.js +2 -0
- package/utils/index.js.map +1 -1
- package/.npmrc +0 -2
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
# CapDateTimePicker
|
|
2
|
+
|
|
3
|
+
A wrapper around Ant Design's DatePicker with `showTime` support, timezone-aware date parsing, and a consistent API for datetime selection in Capillary applications.
|
|
4
|
+
|
|
5
|
+
## Migration from Ant Design v3 to v6
|
|
6
|
+
|
|
7
|
+
### Breaking Changes
|
|
8
|
+
|
|
9
|
+
#### 1. API Changes
|
|
10
|
+
|
|
11
|
+
| v3 API | v6 API | Status | Migration Guide |
|
|
12
|
+
|--------|--------|--------|-----------------|
|
|
13
|
+
| `dateRender` | `cellRender` | Deprecated | Replace `dateRender` with `cellRender`. Backward compatibility maintained. |
|
|
14
|
+
| `dropdownClassName` | `popupClassName` | Deprecated | Replace `dropdownClassName` with `popupClassName`. Backward compatibility maintained. |
|
|
15
|
+
| `dropdownStyle` | `popupStyle` | Deprecated | Replace `dropdownStyle` with `popupStyle`. Backward compatibility maintained. |
|
|
16
|
+
| `getCalendarContainer` | `getPopupContainer` | Deprecated | Replace `getCalendarContainer` with `getPopupContainer`. Backward compatibility maintained. |
|
|
17
|
+
| `open` | `popupOpen` | Deprecated | Replace `open` with `popupOpen`. Backward compatibility maintained. |
|
|
18
|
+
| `onOpenChange` | `onPopupOpenChange` | Deprecated | Replace `onOpenChange` with `onPopupOpenChange`. Backward compatibility maintained. |
|
|
19
|
+
| `showToday` | N/A | Deprecated | This prop is deprecated. Today button behavior is now handled internally by Ant Design. Backward compatibility maintained but discouraged. |
|
|
20
|
+
| `renderExtraFooter` | Custom Panel | Deprecated | This prop is discouraged. Consider using custom panel components instead. Backward compatibility maintained but discouraged. |
|
|
21
|
+
|
|
22
|
+
#### 2. Date Library Migration
|
|
23
|
+
|
|
24
|
+
The component continues to support both Moment.js and Day.js objects for backward compatibility:
|
|
25
|
+
|
|
26
|
+
- **Props accepting dates**: `value` now accepts `Dayjs | Moment | string | null`
|
|
27
|
+
- **Callbacks returning dates**: `onChange` returns the same type as the input (`Dayjs` if `Dayjs` was passed, `Moment` if `Moment` was passed)
|
|
28
|
+
|
|
29
|
+
**Migration Path for Consumers:**
|
|
30
|
+
```javascript
|
|
31
|
+
// Before (moment) - still works
|
|
32
|
+
import moment from 'moment-timezone';
|
|
33
|
+
<CapDateTimePicker
|
|
34
|
+
value={moment('2024-01-15 10:30')}
|
|
35
|
+
onChange={(momentObj) => console.log(momentObj.format())}
|
|
36
|
+
/>
|
|
37
|
+
|
|
38
|
+
// After (dayjs) - preferred
|
|
39
|
+
import dayjs from '@dayjs';
|
|
40
|
+
<CapDateTimePicker
|
|
41
|
+
value={dayjs('2024-01-15 10:30')}
|
|
42
|
+
onChange={(dayjsObj) => console.log(dayjsObj.format())}
|
|
43
|
+
/>
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
### Backward Compatibility
|
|
47
|
+
|
|
48
|
+
All deprecated props still work but log a warning in development:
|
|
49
|
+
|
|
50
|
+
- **`dateRender`**: Still works but mapped to `cellRender` internally. Use `cellRender` instead.
|
|
51
|
+
- **`dropdownClassName`**: Still works. Use `popupClassName` instead.
|
|
52
|
+
- **`dropdownStyle`**: Still works. Use `popupStyle` instead.
|
|
53
|
+
- **`getCalendarContainer`**: Still works. Use `getPopupContainer` instead.
|
|
54
|
+
- **`open`**: Still works. Use `popupOpen` instead.
|
|
55
|
+
- **`onOpenChange`**: Still works. Use `onPopupOpenChange` instead.
|
|
56
|
+
- **`showToday`**: Still works but is deprecated.
|
|
57
|
+
- **`renderExtraFooter`**: Still works but is discouraged.
|
|
58
|
+
|
|
59
|
+
### Style Changes
|
|
60
|
+
|
|
61
|
+
The SCSS file (`styles.scss`) targets v3 class names (`.ant-calendar-*`) and is preserved as-is in this migration pass. Full SCSS migration to v6 class names (`.ant-picker-*`) will be done in a subsequent pass.
|
|
62
|
+
|
|
63
|
+
**Theme config**: `DatePicker.cellHoverBg` added to `getCapThemeConfig.ts` to control date cell hover background color.
|
|
64
|
+
|
|
65
|
+
### Code Improvements
|
|
66
|
+
|
|
67
|
+
1. **Removed PropTypes**: Replaced with TypeScript interfaces in `types.ts`
|
|
68
|
+
2. **Removed defaultProps**: Default values moved to function argument destructuring
|
|
69
|
+
3. **Using deprecation warning utility**: `logDeprecationWarning` for consistent warnings
|
|
70
|
+
4. **Type safety**: Full TypeScript support with proper Dayjs/Moment union types
|
|
71
|
+
5. **Backward compatibility**: All deprecated props mapped using nullish coalescing (`??`)
|
|
72
|
+
|
|
73
|
+
### What Stayed the Same
|
|
74
|
+
|
|
75
|
+
- `injectIntl` HOC pattern for i18n (no consumer-facing change)
|
|
76
|
+
- Timezone-aware date parsing logic
|
|
77
|
+
- Internal open/close state management for OK button behavior
|
|
78
|
+
- `showTime` config with timezone-aware `defaultValue`
|
|
79
|
+
- Calendar icon suffix
|
|
80
|
+
- `okText` from i18n messages
|
|
81
|
+
|
|
82
|
+
### What Changed
|
|
83
|
+
|
|
84
|
+
- **Updated**: Import from `antd-v5` (v6 compatible)
|
|
85
|
+
- **Removed**: `import 'antd/lib/date-picker/style/css'`
|
|
86
|
+
- **Removed**: PropTypes dependency
|
|
87
|
+
- **Removed**: `defaultProps` assignment
|
|
88
|
+
- **Updated**: Multiple deprecated props migrated to v6 API (with backward compatibility)
|
|
89
|
+
- **Added**: `cellRender` support (v6 replacement for `dateRender`)
|
|
90
|
+
- **Added**: `popupClassName`, `popupStyle`, `getPopupContainer`, `popupOpen`, `onPopupOpenChange`
|
|
91
|
+
|
|
92
|
+
## Usage
|
|
93
|
+
|
|
94
|
+
```tsx
|
|
95
|
+
import CapDateTimePicker from '@capillarytech/blaze-ui/components/CapDateTimePicker';
|
|
96
|
+
import dayjs from '@dayjs';
|
|
97
|
+
|
|
98
|
+
function MyComponent() {
|
|
99
|
+
const [date, setDate] = useState(null);
|
|
100
|
+
|
|
101
|
+
return (
|
|
102
|
+
<CapDateTimePicker
|
|
103
|
+
value={date}
|
|
104
|
+
onChange={(newDate) => setDate(newDate)}
|
|
105
|
+
timezone="Asia/Kolkata"
|
|
106
|
+
showTime={{ format: 'HH:mm' }}
|
|
107
|
+
format="DD-MM-YYYY | HH:mm"
|
|
108
|
+
popupClassName="my-custom-popup"
|
|
109
|
+
/>
|
|
110
|
+
);
|
|
111
|
+
}
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
## Props
|
|
115
|
+
|
|
116
|
+
See `types.ts` for complete prop definitions. Key props:
|
|
117
|
+
|
|
118
|
+
- `value`: `Dayjs | Moment | string | null`
|
|
119
|
+
- `onChange`: `(value: Dayjs | Moment | null, dateString: string) => void`
|
|
120
|
+
- `timezone`: Timezone string (default: `'Asia/Kolkata'`)
|
|
121
|
+
- `showTime`: `boolean | { format?: string }` (default: `{ format: 'HH:mm' }`)
|
|
122
|
+
- `format`: Date format string (default: `'DD-MM-YYYY | HH:mm'`)
|
|
123
|
+
- `cellRender`: Custom cell renderer (v6 API)
|
|
124
|
+
- `popupClassName`: Custom class for popup (v6 API)
|
|
125
|
+
- `popupStyle`: Custom style for popup (v6 API)
|
|
126
|
+
- `getPopupContainer`: Container for popup (v6 API)
|
|
127
|
+
- `popupOpen`: Whether popup is open (v6 API)
|
|
128
|
+
- `onPopupOpenChange`: Callback when popup open state changes (v6 API)
|
|
129
|
+
- `dateRender`: Deprecated — use `cellRender` instead
|
|
130
|
+
- `dropdownClassName`: Deprecated — use `popupClassName` instead
|
|
131
|
+
- `dropdownStyle`: Deprecated — use `popupStyle` instead
|
|
132
|
+
- `getCalendarContainer`: Deprecated — use `getPopupContainer` instead
|
|
133
|
+
- `open`: Deprecated — use `popupOpen` instead
|
|
134
|
+
- `onOpenChange`: Deprecated — use `onPopupOpenChange` instead
|
|
135
|
+
- `showToday`: Deprecated — handled internally by Ant Design
|
|
136
|
+
- `renderExtraFooter`: Deprecated — consider custom panel components
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
*
|
|
3
|
+
* CapDateTimePicker
|
|
4
|
+
*
|
|
5
|
+
*/
|
|
6
|
+
import React from 'react';
|
|
7
|
+
import type { InternalProps } from './types';
|
|
8
|
+
declare const _default: React.FC<import("react-intl").WithIntlProps<InternalProps>> & {
|
|
9
|
+
WrappedComponent: React.ComponentType<InternalProps>;
|
|
10
|
+
};
|
|
11
|
+
export default _default;
|
|
12
|
+
export type { CapDateTimePickerProps } from './types';
|
|
13
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../components/CapDateTimePicker/index.tsx"],"names":[],"mappings":"AAAA;;;;GAIG;AAMH,OAAO,KAAoC,MAAM,OAAO,CAAC;AAiBzD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;;;;AA8K7C,wBAA6C;AAC7C,YAAY,EAAE,sBAAsB,EAAE,MAAM,SAAS,CAAC"}
|
|
@@ -2973,6 +2973,24 @@ var _default = exports["default"] = SvgCircleDollar;
|
|
|
2973
2973
|
|
|
2974
2974
|
/***/ }),
|
|
2975
2975
|
|
|
2976
|
+
/***/ 19224:
|
|
2977
|
+
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
2978
|
+
|
|
2979
|
+
"use strict";
|
|
2980
|
+
|
|
2981
|
+
|
|
2982
|
+
exports.__esModule = true;
|
|
2983
|
+
exports["default"] = logDeprecationWarning;
|
|
2984
|
+
var _isNil = _interopRequireDefault(__webpack_require__(69843));
|
|
2985
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
2986
|
+
function logDeprecationWarning(componentName, deprecatedPropName, deprecatedPropValue, replacementPropName) {
|
|
2987
|
+
// @ts-ignore - process.env is provided by webpack/build tools
|
|
2988
|
+
if (false) // removed by dead control flow
|
|
2989
|
+
{}
|
|
2990
|
+
}
|
|
2991
|
+
|
|
2992
|
+
/***/ }),
|
|
2993
|
+
|
|
2976
2994
|
/***/ 19561:
|
|
2977
2995
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
2978
2996
|
|
|
@@ -3756,7 +3774,7 @@ var _default = exports["default"] = SvgFile;
|
|
|
3756
3774
|
|
|
3757
3775
|
|
|
3758
3776
|
exports.__esModule = true;
|
|
3759
|
-
exports.TIME_UNITS = exports.FORMAT_TOKENS = void 0;
|
|
3777
|
+
exports.TIME_UNITS = exports.FORMAT_TOKENS = exports.DEFAULT_TIMEZONE = void 0;
|
|
3760
3778
|
exports.dayjsToMoment = dayjsToMoment;
|
|
3761
3779
|
exports["default"] = void 0;
|
|
3762
3780
|
exports.hasMomentTimezoneSupport = hasMomentTimezoneSupport;
|
|
@@ -3952,6 +3970,8 @@ const FORMAT_TOKENS = exports.FORMAT_TOKENS = {
|
|
|
3952
3970
|
MONTH_FULL: 'MMMM',
|
|
3953
3971
|
YEAR: 'YYYY',
|
|
3954
3972
|
YEAR_SHORT: 'YY',
|
|
3973
|
+
// Cap UI datetime picker format (DD-MM-YYYY | HH:mm)
|
|
3974
|
+
DATE_TIME: 'DD-MM-YYYY | HH:mm',
|
|
3955
3975
|
// Localized formats
|
|
3956
3976
|
DATE_LOCALIZED_SHORT: 'l',
|
|
3957
3977
|
DATETIME_LOCALIZED_SHORT: 'll',
|
|
@@ -3962,6 +3982,7 @@ const FORMAT_TOKENS = exports.FORMAT_TOKENS = {
|
|
|
3962
3982
|
DATETIME_LOCALIZED_LONG_TIME: 'LLL',
|
|
3963
3983
|
DATETIME_LOCALIZED_LONG_TIME_WEEKDAY: 'LLLL'
|
|
3964
3984
|
};
|
|
3985
|
+
const DEFAULT_TIMEZONE = exports.DEFAULT_TIMEZONE = 'Asia/Kolkata';
|
|
3965
3986
|
function logDevError(message, error) {
|
|
3966
3987
|
if (false) // removed by dead control flow
|
|
3967
3988
|
{}
|
|
@@ -4042,7 +4063,10 @@ function momentToDayjs(value) {
|
|
|
4042
4063
|
const tz = value.tz();
|
|
4043
4064
|
if (tz) {
|
|
4044
4065
|
// Has a named timezone - preserve it
|
|
4045
|
-
|
|
4066
|
+
// dayjs.utc(date) is required here: dayjs(date) anchors to the system local timezone,
|
|
4067
|
+
// causing .tz() to only re-label without converting hours. dayjs.utc(date) creates a
|
|
4068
|
+
// UTC-mode dayjs, which .tz() correctly converts to the target timezone for display.
|
|
4069
|
+
dayjsObj = _dayjs.default.utc(date).tz(tz);
|
|
4046
4070
|
|
|
4047
4071
|
// WORKAROUND: dayjs-timezone-iana-plugin doesn't persist timezone name in standard way
|
|
4048
4072
|
// Store it manually in $x for round-trip conversion fidelity
|
|
@@ -5342,17 +5366,17 @@ exports.scope = exports["default"] = void 0;
|
|
|
5342
5366
|
var _reactIntl = __webpack_require__(46407);
|
|
5343
5367
|
const scope = exports.scope = 'app.commonUtils.capUiLibrary.capDateTimePicker';
|
|
5344
5368
|
var _default = exports["default"] = (0, _reactIntl.defineMessages)({
|
|
5345
|
-
selectDateAndTime: {
|
|
5346
|
-
id: scope + ".selectDateAndTime",
|
|
5347
|
-
defaultMessage: 'Select date & time'
|
|
5348
|
-
},
|
|
5349
|
-
selectButton: {
|
|
5350
|
-
id: scope + ".selectButton",
|
|
5351
|
-
defaultMessage: 'Select'
|
|
5352
|
-
},
|
|
5353
5369
|
selectDateTimePlaceHolder: {
|
|
5354
5370
|
id: scope + ".selectDateTimePlaceHolder",
|
|
5355
5371
|
defaultMessage: 'Select date | time'
|
|
5372
|
+
},
|
|
5373
|
+
selectLabel: {
|
|
5374
|
+
id: scope + ".selectLabel",
|
|
5375
|
+
defaultMessage: 'Select'
|
|
5376
|
+
},
|
|
5377
|
+
todayLabel: {
|
|
5378
|
+
id: scope + ".todayLabel",
|
|
5379
|
+
defaultMessage: 'Today'
|
|
5356
5380
|
}
|
|
5357
5381
|
});
|
|
5358
5382
|
|
|
@@ -7800,24 +7824,11 @@ var ___CSS_LOADER_API_NO_SOURCEMAP_IMPORT___ = __webpack_require__(31601);
|
|
|
7800
7824
|
var ___CSS_LOADER_API_IMPORT___ = __webpack_require__(76314);
|
|
7801
7825
|
var ___CSS_LOADER_EXPORT___ = ___CSS_LOADER_API_IMPORT___(___CSS_LOADER_API_NO_SOURCEMAP_IMPORT___);
|
|
7802
7826
|
// Module
|
|
7803
|
-
___CSS_LOADER_EXPORT___.push([module.id, `.cap-date-time-picker__calendar-icon{color:#091e42}.cap-date-time-
|
|
7827
|
+
___CSS_LOADER_EXPORT___.push([module.id, `.cap-date-time-picker__calendar-icon{color:#091e42}.cap-date-time-picker__calendar-popup .ant-picker-footer .ant-picker-ranges{width:100%;display:flex;align-items:center;justify-content:flex-start;gap:1.142rem;padding:.571rem 1.142rem .857rem 1.142rem}.cap-date-time-picker__calendar-popup .ant-picker-footer .ant-picker-ranges .ant-picker-ok{order:0;margin-inline-start:0}.cap-date-time-picker__calendar-popup .ant-picker-footer .ant-picker-ranges .ant-picker-ok>button{background:#47af46;border:none;border-radius:.285rem;padding:0 2rem;height:2.285rem;line-height:2.285rem;font-weight:500;color:#fff;box-shadow:none}.cap-date-time-picker__calendar-popup .ant-picker-footer .ant-picker-ranges .ant-picker-ok>button>span{display:none}.cap-date-time-picker__calendar-popup .ant-picker-footer .ant-picker-ranges .ant-picker-ok>button::after{content:var(--cap-datetime-select-label, "Select");font-size:1rem}.cap-date-time-picker__calendar-popup .ant-picker-footer .ant-picker-ranges .ant-picker-ok>button:disabled{background:#a1d8a0;cursor:not-allowed}.cap-date-time-picker__calendar-popup .ant-picker-footer .ant-picker-ranges .ant-picker-now{order:1}.cap-date-time-picker__calendar-popup .ant-picker-footer .ant-picker-ranges .ant-picker-now>a{font-size:0;font-weight:500;color:#2466ea}.cap-date-time-picker__calendar-popup .ant-picker-footer .ant-picker-ranges .ant-picker-now>a::after{content:var(--cap-datetime-today-label, "Today");font-size:1rem;vertical-align:sub}`, ""]);
|
|
7804
7828
|
// Exports
|
|
7805
7829
|
___CSS_LOADER_EXPORT___.locals = {
|
|
7806
7830
|
"cap-date-time-picker__calendar-icon": `cap-date-time-picker__calendar-icon`,
|
|
7807
|
-
"cap-date-time-
|
|
7808
|
-
"ant-calendar-picker-input": `ant-calendar-picker-input`,
|
|
7809
|
-
"calendar-popup": `calendar-popup`,
|
|
7810
|
-
"ant-calendar-ok-btn": `ant-calendar-ok-btn`,
|
|
7811
|
-
"ant-calendar-today-btn": `ant-calendar-today-btn`,
|
|
7812
|
-
"ant-calendar-time-picker-btn": `ant-calendar-time-picker-btn`,
|
|
7813
|
-
"ant-calendar-today": `ant-calendar-today`,
|
|
7814
|
-
"ant-calendar-date": `ant-calendar-date`,
|
|
7815
|
-
"ant-calendar-selected-day": `ant-calendar-selected-day`,
|
|
7816
|
-
"ant-calendar-footer": `ant-calendar-footer`,
|
|
7817
|
-
"ant-calendar-footer-btn": `ant-calendar-footer-btn`,
|
|
7818
|
-
"ant-calendar-ok-btn-disabled": `ant-calendar-ok-btn-disabled`,
|
|
7819
|
-
"ant-calendar-time-picker-btn-disabled": `ant-calendar-time-picker-btn-disabled`,
|
|
7820
|
-
"ant-calendar-time-picker-cell-selected": `ant-calendar-time-picker-cell-selected`
|
|
7831
|
+
"cap-date-time-picker__calendar-popup": `cap-date-time-picker__calendar-popup`
|
|
7821
7832
|
};
|
|
7822
7833
|
module.exports = ___CSS_LOADER_EXPORT___;
|
|
7823
7834
|
|
|
@@ -11252,14 +11263,6 @@ var _default = exports["default"] = SvgWechatOutline;
|
|
|
11252
11263
|
|
|
11253
11264
|
/***/ }),
|
|
11254
11265
|
|
|
11255
|
-
/***/ 61545:
|
|
11256
|
-
/***/ ((module) => {
|
|
11257
|
-
|
|
11258
|
-
"use strict";
|
|
11259
|
-
module.exports = require("antd/lib/date-picker/style/css");
|
|
11260
|
-
|
|
11261
|
-
/***/ }),
|
|
11262
|
-
|
|
11263
11266
|
/***/ 61779:
|
|
11264
11267
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
11265
11268
|
|
|
@@ -11585,6 +11588,14 @@ var _default = exports["default"] = SvgDisneyHotstar;
|
|
|
11585
11588
|
|
|
11586
11589
|
/***/ }),
|
|
11587
11590
|
|
|
11591
|
+
/***/ 64273:
|
|
11592
|
+
/***/ ((module) => {
|
|
11593
|
+
|
|
11594
|
+
"use strict";
|
|
11595
|
+
module.exports = require("antd-v5");
|
|
11596
|
+
|
|
11597
|
+
/***/ }),
|
|
11598
|
+
|
|
11588
11599
|
/***/ 64284:
|
|
11589
11600
|
/***/ ((module) => {
|
|
11590
11601
|
|
|
@@ -16476,14 +16487,6 @@ module.exports = require("dayjs/plugin/advancedFormat");
|
|
|
16476
16487
|
|
|
16477
16488
|
/***/ }),
|
|
16478
16489
|
|
|
16479
|
-
/***/ 97185:
|
|
16480
|
-
/***/ ((module) => {
|
|
16481
|
-
|
|
16482
|
-
"use strict";
|
|
16483
|
-
module.exports = require("antd");
|
|
16484
|
-
|
|
16485
|
-
/***/ }),
|
|
16486
|
-
|
|
16487
16490
|
/***/ 97849:
|
|
16488
16491
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
16489
16492
|
|
|
@@ -16729,44 +16732,70 @@ var exports = __webpack_exports__;
|
|
|
16729
16732
|
|
|
16730
16733
|
exports.__esModule = true;
|
|
16731
16734
|
exports["default"] = void 0;
|
|
16732
|
-
var
|
|
16733
|
-
__webpack_require__(61545);
|
|
16735
|
+
var _antdV = __webpack_require__(64273);
|
|
16734
16736
|
var _classnames = _interopRequireDefault(__webpack_require__(46942));
|
|
16735
|
-
var _propTypes = _interopRequireDefault(__webpack_require__(43363));
|
|
16736
16737
|
var _react = _interopRequireWildcard(__webpack_require__(9206));
|
|
16737
16738
|
var _reactIntl = __webpack_require__(46407);
|
|
16738
16739
|
var _dayjs = _interopRequireWildcard(__webpack_require__(25549));
|
|
16739
16740
|
var _CapIcon = _interopRequireDefault(__webpack_require__(65124));
|
|
16741
|
+
var _logDeprecationWarning = _interopRequireDefault(__webpack_require__(19224));
|
|
16740
16742
|
var _messages = _interopRequireDefault(__webpack_require__(32528));
|
|
16741
|
-
__webpack_require__(2580);
|
|
16743
|
+
var _styles = _interopRequireDefault(__webpack_require__(2580));
|
|
16742
16744
|
var _jsxRuntime = __webpack_require__(74848);
|
|
16743
|
-
const _excluded = ["intl", "className", "value", "onChange", "dateRender", "showTime", "format", "placeholder", "timezone", "disabledTime", "renderExtraFooter", "showToday", "onOk", "onPanelChange"];
|
|
16745
|
+
const _excluded = ["intl", "className", "value", "onChange", "cellRender", "dateRender", "showTime", "format", "placeholder", "timezone", "disabledTime", "renderExtraFooter", "showToday", "onOk", "onPanelChange", "popupClassName", "dropdownClassName", "popupStyle", "dropdownStyle", "getPopupContainer", "getCalendarContainer", "popupOpen", "open", "onPopupOpenChange", "onOpenChange"];
|
|
16746
|
+
/**
|
|
16747
|
+
*
|
|
16748
|
+
* CapDateTimePicker
|
|
16749
|
+
*
|
|
16750
|
+
*/
|
|
16744
16751
|
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
16745
16752
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
16746
16753
|
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
16747
16754
|
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
|
|
16748
16755
|
const clsPrefix = 'cap-date-time-picker';
|
|
16749
16756
|
const CapDateTimePicker = _ref => {
|
|
16757
|
+
var _ref2;
|
|
16750
16758
|
let {
|
|
16751
16759
|
intl: {
|
|
16752
16760
|
formatMessage
|
|
16753
16761
|
},
|
|
16754
|
-
className,
|
|
16755
|
-
value,
|
|
16756
|
-
onChange,
|
|
16762
|
+
className = '',
|
|
16763
|
+
value = null,
|
|
16764
|
+
onChange = () => {},
|
|
16765
|
+
cellRender,
|
|
16757
16766
|
dateRender,
|
|
16758
|
-
showTime
|
|
16759
|
-
|
|
16760
|
-
|
|
16761
|
-
|
|
16767
|
+
showTime = {
|
|
16768
|
+
format: _dayjs.FORMAT_TOKENS.TIME_24H
|
|
16769
|
+
},
|
|
16770
|
+
format = _dayjs.FORMAT_TOKENS.DATE_TIME,
|
|
16771
|
+
placeholder = '',
|
|
16772
|
+
timezone = _dayjs.DEFAULT_TIMEZONE,
|
|
16762
16773
|
disabledTime,
|
|
16763
16774
|
renderExtraFooter,
|
|
16764
16775
|
showToday,
|
|
16765
16776
|
onOk,
|
|
16766
|
-
onPanelChange
|
|
16777
|
+
onPanelChange,
|
|
16778
|
+
popupClassName,
|
|
16779
|
+
dropdownClassName,
|
|
16780
|
+
popupStyle,
|
|
16781
|
+
dropdownStyle,
|
|
16782
|
+
getPopupContainer,
|
|
16783
|
+
getCalendarContainer,
|
|
16784
|
+
popupOpen,
|
|
16785
|
+
open: openProp,
|
|
16786
|
+
onPopupOpenChange,
|
|
16787
|
+
onOpenChange
|
|
16767
16788
|
} = _ref,
|
|
16768
16789
|
rest = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
16769
|
-
|
|
16790
|
+
(0, _logDeprecationWarning.default)('CapDateTimePicker', 'dateRender', dateRender, 'cellRender');
|
|
16791
|
+
(0, _logDeprecationWarning.default)('CapDateTimePicker', 'dropdownClassName', dropdownClassName, 'popupClassName');
|
|
16792
|
+
(0, _logDeprecationWarning.default)('CapDateTimePicker', 'dropdownStyle', dropdownStyle, 'popupStyle');
|
|
16793
|
+
(0, _logDeprecationWarning.default)('CapDateTimePicker', 'getCalendarContainer', getCalendarContainer, 'getPopupContainer');
|
|
16794
|
+
(0, _logDeprecationWarning.default)('CapDateTimePicker', 'open', openProp, 'popupOpen');
|
|
16795
|
+
(0, _logDeprecationWarning.default)('CapDateTimePicker', 'onOpenChange', onOpenChange, 'onPopupOpenChange');
|
|
16796
|
+
(0, _logDeprecationWarning.default)('CapDateTimePicker', 'showToday', showToday, 'N/A (handled internally)');
|
|
16797
|
+
(0, _logDeprecationWarning.default)('CapDateTimePicker', 'renderExtraFooter', renderExtraFooter, 'custom panel components');
|
|
16798
|
+
const [isPickerOpen, setIsPickerOpen] = (0, _react.useState)(false);
|
|
16770
16799
|
const skipNextCloseRef = (0, _react.useRef)(false);
|
|
16771
16800
|
|
|
16772
16801
|
// Detect if consumer is using moment
|
|
@@ -16801,19 +16830,22 @@ const CapDateTimePicker = _ref => {
|
|
|
16801
16830
|
|
|
16802
16831
|
// Handle calendar change
|
|
16803
16832
|
const handleChange = (newValue, dateString) => {
|
|
16833
|
+
if (Array.isArray(newValue) || Array.isArray(dateString)) return;
|
|
16804
16834
|
const parsedValue = parseDateTime(newValue);
|
|
16805
16835
|
|
|
16806
16836
|
// Return the same type the consumer passed in
|
|
16807
16837
|
const result = (0, _dayjs.normalizeDateValue)(isConsumerUsingMoment, parsedValue);
|
|
16808
|
-
onChange(result, dateString);
|
|
16838
|
+
onChange(result != null ? result : null, dateString != null ? dateString : '');
|
|
16809
16839
|
};
|
|
16810
16840
|
const handleOpenChange = nextOpen => {
|
|
16811
|
-
|
|
16841
|
+
setIsPickerOpen(nextOpen);
|
|
16842
|
+
onPopupOpenChange == null || onPopupOpenChange(nextOpen);
|
|
16843
|
+
onOpenChange == null || onOpenChange(nextOpen);
|
|
16812
16844
|
};
|
|
16813
|
-
const handleOk =
|
|
16845
|
+
const handleOk = date => {
|
|
16814
16846
|
skipNextCloseRef.current = false;
|
|
16815
|
-
|
|
16816
|
-
onOk == null || onOk();
|
|
16847
|
+
setIsPickerOpen(false);
|
|
16848
|
+
onOk == null || onOk(date);
|
|
16817
16849
|
};
|
|
16818
16850
|
|
|
16819
16851
|
// Get the current value in the correct timezone
|
|
@@ -16821,17 +16853,31 @@ const CapDateTimePicker = _ref => {
|
|
|
16821
16853
|
if (!value) return null;
|
|
16822
16854
|
return parseDateTime(value);
|
|
16823
16855
|
}, [value, timezone]);
|
|
16824
|
-
|
|
16856
|
+
|
|
16857
|
+
// Backward compatibility: map deprecated props to new props
|
|
16858
|
+
const finalPopupClassName = (0, _classnames.default)(_styles.default[clsPrefix + "__calendar-popup"], popupClassName != null ? popupClassName : dropdownClassName);
|
|
16859
|
+
const labelVars = {
|
|
16860
|
+
'--cap-datetime-select-label': "'" + formatMessage(_messages.default.selectLabel) + "'",
|
|
16861
|
+
'--cap-datetime-today-label': "'" + formatMessage(_messages.default.todayLabel) + "'"
|
|
16862
|
+
};
|
|
16863
|
+
const finalPopupStyle = _extends({}, labelVars, popupStyle != null ? popupStyle : dropdownStyle);
|
|
16864
|
+
const finalGetPopupContainer = getPopupContainer != null ? getPopupContainer : getCalendarContainer;
|
|
16865
|
+
const finalOpen = (_ref2 = popupOpen != null ? popupOpen : openProp) != null ? _ref2 : isPickerOpen;
|
|
16866
|
+
|
|
16867
|
+
// Backward compatibility: map deprecated dateRender to cellRender
|
|
16868
|
+
const finalCellRender = cellRender != null ? cellRender : dateRender ? current => dateRender(current, todayDate) : undefined;
|
|
16869
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_antdV.DatePicker, _extends({
|
|
16825
16870
|
className: (0, _classnames.default)(clsPrefix, className),
|
|
16826
16871
|
showTime: showTimeConfig,
|
|
16827
16872
|
format: format,
|
|
16828
16873
|
placeholder: placeholder || formatMessage(_messages.default.selectDateTimePlaceHolder),
|
|
16829
16874
|
value: currentValue,
|
|
16830
16875
|
onChange: handleChange,
|
|
16831
|
-
|
|
16832
|
-
|
|
16833
|
-
|
|
16834
|
-
|
|
16876
|
+
cellRender: finalCellRender,
|
|
16877
|
+
popupClassName: finalPopupClassName,
|
|
16878
|
+
popupStyle: finalPopupStyle,
|
|
16879
|
+
getPopupContainer: finalGetPopupContainer,
|
|
16880
|
+
open: finalOpen,
|
|
16835
16881
|
onOk: handleOk,
|
|
16836
16882
|
onOpenChange: handleOpenChange,
|
|
16837
16883
|
onPanelChange: onPanelChange,
|
|
@@ -16842,43 +16888,10 @@ const CapDateTimePicker = _ref => {
|
|
|
16842
16888
|
suffixIcon: /*#__PURE__*/(0, _jsxRuntime.jsx)(_CapIcon.default, {
|
|
16843
16889
|
type: "calendar",
|
|
16844
16890
|
size: "m",
|
|
16845
|
-
className: clsPrefix + "__calendar-icon"
|
|
16891
|
+
className: _styles.default[clsPrefix + "__calendar-icon"]
|
|
16846
16892
|
})
|
|
16847
16893
|
}, rest));
|
|
16848
16894
|
};
|
|
16849
|
-
|
|
16850
|
-
/* ── prop types & defaults ────────────────────────────────── */
|
|
16851
|
-
CapDateTimePicker.propTypes = {
|
|
16852
|
-
intl: _reactIntl.intlShape.isRequired,
|
|
16853
|
-
className: _propTypes.default.string,
|
|
16854
|
-
value: _propTypes.default.oneOfType([_propTypes.default.object,
|
|
16855
|
-
// Moment or dayjs
|
|
16856
|
-
_propTypes.default.string // ISO date
|
|
16857
|
-
]),
|
|
16858
|
-
onChange: _propTypes.default.func,
|
|
16859
|
-
dateRender: _propTypes.default.func,
|
|
16860
|
-
showTime: _propTypes.default.oneOfType([_propTypes.default.bool, _propTypes.default.object]),
|
|
16861
|
-
format: _propTypes.default.string,
|
|
16862
|
-
placeholder: _propTypes.default.string,
|
|
16863
|
-
timezone: _propTypes.default.string,
|
|
16864
|
-
disabledTime: _propTypes.default.func,
|
|
16865
|
-
renderExtraFooter: _propTypes.default.func,
|
|
16866
|
-
showToday: _propTypes.default.bool,
|
|
16867
|
-
onOk: _propTypes.default.func,
|
|
16868
|
-
onPanelChange: _propTypes.default.func
|
|
16869
|
-
};
|
|
16870
|
-
CapDateTimePicker.defaultProps = {
|
|
16871
|
-
className: '',
|
|
16872
|
-
value: null,
|
|
16873
|
-
onChange: () => {},
|
|
16874
|
-
showTime: {
|
|
16875
|
-
format: 'HH:mm'
|
|
16876
|
-
},
|
|
16877
|
-
format: 'DD-MM-YYYY | HH:mm',
|
|
16878
|
-
placeholder: '',
|
|
16879
|
-
timezone: 'Asia/Kolkata',
|
|
16880
|
-
showToday: true
|
|
16881
|
-
};
|
|
16882
16895
|
var _default = exports["default"] = (0, _reactIntl.injectIntl)(CapDateTimePicker);
|
|
16883
16896
|
})();
|
|
16884
16897
|
|