forstok-ui-lib 5.2.37 → 5.2.39
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/dist/index.d.ts +6 -2
- package/dist/index.js +179 -177
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +168 -166
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/components/date/daterange.tsx +5 -5
- package/src/components/datetime/index.tsx +22 -0
- package/src/components/datetime/styles.ts +5 -0
- package/src/components/index.ts +1 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useEffect, useState, useRef } from 'react';
|
|
2
2
|
import DateRangePicker from 'react-daterange-picker';
|
|
3
|
-
import
|
|
3
|
+
import moment from 'moment';
|
|
4
4
|
import { extendMoment } from 'moment-range';
|
|
5
5
|
import { configDateRange } from '../../maps/common';
|
|
6
6
|
import IconComponent from '../icon';
|
|
@@ -12,7 +12,7 @@ import { dateRangeDays, dateRangeStatus } from '../../assets/javascripts/helper'
|
|
|
12
12
|
import 'react-daterange-picker/dist/css/react-calendar.css';
|
|
13
13
|
import './styles.css';
|
|
14
14
|
import { DateRangeContainer, DateRangeControl, DateRangeLabelContainer, DateRangeLabel, DateRangeIndicatorsContainer, DateRangeIndicatorsArrowIconSvg, DateRangeMenuContainer, DateRangeMenu, DateRangeSelection, SelectionDate, DateRangeAside, DateRangePortalContainer, DateRangeIconContainer } from './styles';
|
|
15
|
-
import type { TMouseEvent } from '../../typeds';
|
|
15
|
+
import type { TMouseEvent, TState } from '../../typeds';
|
|
16
16
|
import type { TModerateDateFunction } from './typed';
|
|
17
17
|
|
|
18
18
|
type TDateRange = {
|
|
@@ -25,7 +25,7 @@ type TDateRange = {
|
|
|
25
25
|
evModDate: TModerateDateFunction
|
|
26
26
|
portalId?: string
|
|
27
27
|
isForceUpdate?: boolean
|
|
28
|
-
setForceUpdate?:
|
|
28
|
+
setForceUpdate?: TState<boolean>
|
|
29
29
|
isCheckType?: boolean
|
|
30
30
|
size?: string
|
|
31
31
|
}
|
|
@@ -46,7 +46,7 @@ const DateRangeComponent = ({ mode='default', placeholder, startDate, endDate, r
|
|
|
46
46
|
|
|
47
47
|
const daterangeContainerRef = useRef<HTMLElement | null>(null);
|
|
48
48
|
const buttonRef = useRef<HTMLDivElement | null>(null);
|
|
49
|
-
const newMoment = extendMoment(moment);
|
|
49
|
+
const newMoment = extendMoment(moment as any);
|
|
50
50
|
|
|
51
51
|
const callback = () => {
|
|
52
52
|
setOpen(false);
|
|
@@ -73,7 +73,7 @@ const DateRangeComponent = ({ mode='default', placeholder, startDate, endDate, r
|
|
|
73
73
|
}
|
|
74
74
|
|
|
75
75
|
const evToogleDateRangePicker: TMouseEvent = e => {
|
|
76
|
-
const refEl = (buttonRef && buttonRef.current) ? buttonRef.current :
|
|
76
|
+
const refEl = (buttonRef && buttonRef.current) ? buttonRef.current : null;
|
|
77
77
|
const buttonEl = refEl && (e.target as HTMLDivElement).closest(`.${refEl.classList[0]}`) as HTMLDivElement;
|
|
78
78
|
if (!buttonEl) {
|
|
79
79
|
return;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import moment from 'moment';
|
|
2
|
+
import { DateTimeContainer } from './styles';
|
|
3
|
+
|
|
4
|
+
const DateTimeComponent = ({ dateTimeData }:{ dateTimeData: string }) => {
|
|
5
|
+
const date = moment(dateTimeData, 'YYYY-MM-DD HH:mm:ss ZZ').format('D MMM YYYY,');
|
|
6
|
+
const time = moment(dateTimeData, 'YYYY-MM-DD HH:mm:ss ZZ').format('hh:mm A');
|
|
7
|
+
|
|
8
|
+
return (
|
|
9
|
+
<DateTimeContainer>
|
|
10
|
+
{
|
|
11
|
+
dateTimeData ? (
|
|
12
|
+
<>
|
|
13
|
+
<span>{date}</span>
|
|
14
|
+
<span>{time}</span>
|
|
15
|
+
</>
|
|
16
|
+
) : '-'
|
|
17
|
+
}
|
|
18
|
+
</DateTimeContainer>
|
|
19
|
+
);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export default DateTimeComponent;
|
package/src/components/index.ts
CHANGED
|
@@ -21,6 +21,7 @@ export { default as UploadDragDropComponent } from './upload/drag_drop';
|
|
|
21
21
|
export { default as TextAreaComponent } from './textarea';
|
|
22
22
|
export { default as TextAreaRefComponent } from './textarea/ref';
|
|
23
23
|
export { default as DateRangeComponent } from './date/daterange';
|
|
24
|
+
export { default as DateTimeComponent } from './datetime';
|
|
24
25
|
|
|
25
26
|
export * from './dropdown/typed';
|
|
26
27
|
export * from './message/typed';
|