@antscorp/antsomi-ui 1.3.3-beta.81 → 1.3.3-beta.82
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/es/components/molecules/DatePicker/components/AdvancedPicker/AdvancedPicker.d.ts +4 -6
- package/es/components/molecules/DatePicker/components/AdvancedPicker/AdvancedPicker.js +10 -12
- package/es/components/molecules/DatePicker/components/AdvancedRangePicker/AdvancedRangePicker.js +2 -2
- package/package.json +1 -1
|
@@ -19,15 +19,13 @@ export interface AdvancedPickerProps {
|
|
|
19
19
|
disableBeforeDate?: string;
|
|
20
20
|
errorMessage?: string;
|
|
21
21
|
showTime?: boolean;
|
|
22
|
-
onUpdatedNewDate?: (
|
|
22
|
+
onUpdatedNewDate?: ({ date, option }: {
|
|
23
|
+
date: string;
|
|
24
|
+
option: TOption;
|
|
25
|
+
}) => void;
|
|
23
26
|
onApply?: ({ date, option }: {
|
|
24
27
|
date: string;
|
|
25
28
|
option: TOption;
|
|
26
29
|
}) => void;
|
|
27
|
-
/**
|
|
28
|
-
* Temporary props to get value as object ({ date, option }) when call onUpdatedNewDate()
|
|
29
|
-
* use for cdp semantic calendar
|
|
30
|
-
*/
|
|
31
|
-
getObjectValue?: boolean;
|
|
32
30
|
}
|
|
33
31
|
export declare const AdvancedPicker: React.FC<AdvancedPickerProps>;
|
|
@@ -28,7 +28,7 @@ const { Text } = Typography;
|
|
|
28
28
|
export const AdvancedPicker = props => {
|
|
29
29
|
var _a, _b;
|
|
30
30
|
// Props
|
|
31
|
-
const { label, inputStyle, dateTypeKeysShow, calculationTypeKeysShow, showCalculationTypeCondition, defaultDateTypeKey, valueType, option: propsOption, operatorKey, type, date: propsDate, format, formatInputDisplay, errorMessage, disableAfterDate, disableBeforeDate, showTime, disabled, onUpdatedNewDate, onApply,
|
|
31
|
+
const { label, inputStyle, dateTypeKeysShow, calculationTypeKeysShow, showCalculationTypeCondition, defaultDateTypeKey, valueType, option: propsOption, operatorKey, type, date: propsDate, format, formatInputDisplay, errorMessage, disableAfterDate, disableBeforeDate, showTime, disabled, onUpdatedNewDate, onApply, } = props;
|
|
32
32
|
// Memo
|
|
33
33
|
const newDateTypes = useMemo(() => {
|
|
34
34
|
if (dateTypeKeysShow && dateTypeKeysShow.length) {
|
|
@@ -173,17 +173,15 @@ export const AdvancedPicker = props => {
|
|
|
173
173
|
}
|
|
174
174
|
}
|
|
175
175
|
if (typeof onUpdatedNewDate === 'function' && propsDate !== newDate) {
|
|
176
|
-
onUpdatedNewDate(
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
}
|
|
186
|
-
: newDate);
|
|
176
|
+
onUpdatedNewDate({
|
|
177
|
+
date,
|
|
178
|
+
option: {
|
|
179
|
+
dateType: newDateType.value,
|
|
180
|
+
calculationDate: newDateType.value === 'fix' ? '' : newCalculationDate.value,
|
|
181
|
+
calculationType: newDateType.value === 'fix' ? '' : newCalculationType.value,
|
|
182
|
+
value: newDateType.value === 'fix' ? 0 : value,
|
|
183
|
+
},
|
|
184
|
+
});
|
|
187
185
|
}
|
|
188
186
|
}
|
|
189
187
|
}
|
package/es/components/molecules/DatePicker/components/AdvancedRangePicker/AdvancedRangePicker.js
CHANGED
|
@@ -55,8 +55,8 @@ export const AdvancedRangePicker = props => {
|
|
|
55
55
|
}
|
|
56
56
|
};
|
|
57
57
|
return (React.createElement(Space, { size: 20 },
|
|
58
|
-
React.createElement(AdvancedPicker, { valueType: valueType, disabled: disabled, label: showLabel ? t(translations.datePicker.startDate) || '' : '', date: timeRange.startDate.date, option: omit(timeRange.startDate, 'date'), operatorKey: "between", type: "startDate", format: ADVANCED_RANGE_PICKER_FORMAT.startDate, errorMessage: errorMessage, disableAfterDate: timeRange.endDate.date, showTime: showTime, calculationTypeKeysShow: startDateConfig === null || startDateConfig === void 0 ? void 0 : startDateConfig.calculationTypeKeysShow, showCalculationTypeCondition: showCalculationTypeCondition, onUpdatedNewDate: date => onUpdateTimeRange('startDate', { date }, 'system'), onApply: ({ date, option }) => onUpdateTimeRange('startDate', Object.assign({ date }, option), 'user') }),
|
|
59
|
-
React.createElement(AdvancedPicker, { valueType: valueType, disabled: disabled, label: showLabel ? t(translations.datePicker.endDate) || '' : '', date: timeRange.endDate.date, option: omit(timeRange.endDate, 'date'), operatorKey: "between", type: "endDate", format: ADVANCED_RANGE_PICKER_FORMAT.endDate, errorMessage: errorMessage, showTime: showTime, calculationTypeKeysShow: endDateConfig === null || endDateConfig === void 0 ? void 0 : endDateConfig.calculationTypeKeysShow, showCalculationTypeCondition: showCalculationTypeCondition, onUpdatedNewDate: date => onUpdateTimeRange('endDate', { date }, 'system'), onApply: ({ date, option }) => onUpdateTimeRange('endDate', Object.assign({ date }, option), 'user') })));
|
|
58
|
+
React.createElement(AdvancedPicker, { valueType: valueType, disabled: disabled, label: showLabel ? t(translations.datePicker.startDate) || '' : '', date: timeRange.startDate.date, option: omit(timeRange.startDate, 'date'), operatorKey: "between", type: "startDate", format: ADVANCED_RANGE_PICKER_FORMAT.startDate, errorMessage: errorMessage, disableAfterDate: timeRange.endDate.date, showTime: showTime, calculationTypeKeysShow: startDateConfig === null || startDateConfig === void 0 ? void 0 : startDateConfig.calculationTypeKeysShow, showCalculationTypeCondition: showCalculationTypeCondition, onUpdatedNewDate: ({ date }) => onUpdateTimeRange('startDate', { date }, 'system'), onApply: ({ date, option }) => onUpdateTimeRange('startDate', Object.assign({ date }, option), 'user') }),
|
|
59
|
+
React.createElement(AdvancedPicker, { valueType: valueType, disabled: disabled, label: showLabel ? t(translations.datePicker.endDate) || '' : '', date: timeRange.endDate.date, option: omit(timeRange.endDate, 'date'), operatorKey: "between", type: "endDate", format: ADVANCED_RANGE_PICKER_FORMAT.endDate, errorMessage: errorMessage, showTime: showTime, calculationTypeKeysShow: endDateConfig === null || endDateConfig === void 0 ? void 0 : endDateConfig.calculationTypeKeysShow, showCalculationTypeCondition: showCalculationTypeCondition, onUpdatedNewDate: ({ date }) => onUpdateTimeRange('endDate', { date }, 'system'), onApply: ({ date, option }) => onUpdateTimeRange('endDate', Object.assign({ date }, option), 'user') })));
|
|
60
60
|
};
|
|
61
61
|
AdvancedRangePicker.defaultProps = {
|
|
62
62
|
timeRange: {
|