@topconsultnpm/sdkui-react-beta 6.6.85 → 6.6.86
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.
|
@@ -9,6 +9,7 @@ interface ITMDateBoxProps extends IDateBoxOptions {
|
|
|
9
9
|
containerElement?: Element;
|
|
10
10
|
buttons?: any;
|
|
11
11
|
resetTimeToZeroOnKeyPress?: boolean;
|
|
12
|
+
icon?: any;
|
|
12
13
|
}
|
|
13
14
|
declare const TMDateBox: (props: ITMDateBoxProps) => import("react/jsx-runtime").JSX.Element;
|
|
14
15
|
export default TMDateBox;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { jsx as _jsx,
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useEffect, useRef } from 'react';
|
|
3
3
|
import { DateBox } from 'devextreme-react';
|
|
4
4
|
import { DateDisplayTypes, Globalization } from '../../helper';
|
|
@@ -49,25 +49,75 @@ const TMDateBox = (props) => {
|
|
|
49
49
|
return "datetime";
|
|
50
50
|
return props.dateDisplayType == DateDisplayTypes.Date ? "date" : "time";
|
|
51
51
|
};
|
|
52
|
-
return (
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
52
|
+
return (
|
|
53
|
+
// <>
|
|
54
|
+
// <DateBox
|
|
55
|
+
// ref={dateBoxRef}
|
|
56
|
+
// // defaultValue={props.defaultValue}
|
|
57
|
+
// showClearButton={props.showClearButton}
|
|
58
|
+
// dateSerializationFormat={props.useDateSerializationFormat ? 'yyyy-MM-ddTHH:mm:ss' : undefined}
|
|
59
|
+
// disabled={props.disabled}
|
|
60
|
+
// displayFormat={props.displayFormat ?? Globalization.getDateDisplayFormat(props.dateDisplayType)}
|
|
61
|
+
// dropDownOptions={dropDownOptions}
|
|
62
|
+
// label={props.label} labelMode='static'
|
|
63
|
+
// type={getType()}
|
|
64
|
+
// useMaskBehavior={true}
|
|
65
|
+
// height={'28px'}
|
|
66
|
+
// value={props.value}
|
|
67
|
+
// width={props.width}
|
|
68
|
+
// valueChangeEvent='keyup input change'
|
|
69
|
+
// onValueChange={(e) => { props.onValueChange?.(e) }}
|
|
70
|
+
// onKeyUp={(e) => {
|
|
71
|
+
// if (e.event?.code == "Space") {
|
|
72
|
+
// const currentDate = new Date();
|
|
73
|
+
// currentDate.setHours(0, 0, 0, 0);
|
|
74
|
+
// e.component.option("value", currentDate.toISOString());
|
|
75
|
+
// }
|
|
76
|
+
// }}
|
|
77
|
+
// onValueChanged={(e) => {
|
|
78
|
+
// if(resetTimeToZero){
|
|
79
|
+
// // soluzione in https://supportcenter.devexpress.com/ticket/details/t1103734/datebox-how-to-initialize-time-to-00-00-when-key-is-pressed-instead-of-current-time
|
|
80
|
+
// if (props.value != undefined) return;
|
|
81
|
+
// if (!e.value) return;
|
|
82
|
+
// const currentDate = new Date(e.value);
|
|
83
|
+
// currentDate.setHours(0, 0, 0, 0);
|
|
84
|
+
// e.component.option("value", currentDate.toISOString());
|
|
85
|
+
// }
|
|
86
|
+
// }}
|
|
87
|
+
// >
|
|
88
|
+
// {/* {props.buttons?.map((btn: TMEditorButtonData) => {
|
|
89
|
+
// return (
|
|
90
|
+
// <Button key={btn.text}
|
|
91
|
+
// name={btn.text}
|
|
92
|
+
// location="after"
|
|
93
|
+
// options={{
|
|
94
|
+
// icon: ReactDOMServer.renderToString(<IconLayerGroup />),
|
|
95
|
+
// stylingMode: 'text',
|
|
96
|
+
// onClick: () => btn?.onClick?.()
|
|
97
|
+
// }}
|
|
98
|
+
// />
|
|
99
|
+
// )
|
|
100
|
+
// })}
|
|
101
|
+
// <Button name="dropDown" /> */}
|
|
102
|
+
// </DateBox>
|
|
103
|
+
// <TMVilViewer vil={props.validationItems} />
|
|
104
|
+
// </>
|
|
105
|
+
_jsxs("div", { style: { display: 'flex', alignItems: 'center' }, children: [props.icon && (_jsx("span", { style: { marginRight: '8px', display: 'flex', alignItems: 'center' }, children: props.icon })), _jsxs("div", { style: { display: 'flex', flexDirection: 'column', gap: '5px' }, children: [_jsx(DateBox, { ref: dateBoxRef, showClearButton: props.showClearButton, dateSerializationFormat: props.useDateSerializationFormat ? 'yyyy-MM-ddTHH:mm:ss' : undefined, disabled: props.disabled, displayFormat: props.displayFormat ?? Globalization.getDateDisplayFormat(props.dateDisplayType), dropDownOptions: dropDownOptions, label: props.label, labelMode: 'static', type: getType(), useMaskBehavior: true, height: '28px', value: props.value, width: props.width, valueChangeEvent: 'keyup input change', onValueChange: (e) => { props.onValueChange?.(e); }, onKeyUp: (e) => {
|
|
106
|
+
if (e.event?.code == "Space") {
|
|
107
|
+
const currentDate = new Date();
|
|
108
|
+
currentDate.setHours(0, 0, 0, 0);
|
|
109
|
+
e.component.option("value", currentDate.toISOString());
|
|
110
|
+
}
|
|
111
|
+
}, onValueChanged: (e) => {
|
|
112
|
+
if (resetTimeToZero) {
|
|
113
|
+
if (props.value != undefined)
|
|
114
|
+
return;
|
|
115
|
+
if (!e.value)
|
|
116
|
+
return;
|
|
117
|
+
const currentDate = new Date(e.value);
|
|
118
|
+
currentDate.setHours(0, 0, 0, 0);
|
|
119
|
+
e.component.option("value", currentDate.toISOString());
|
|
120
|
+
}
|
|
121
|
+
} }), _jsx(TMVilViewer, { vil: props.validationItems })] })] }));
|
|
72
122
|
};
|
|
73
123
|
export default TMDateBox;
|