d2coreui 23.0.33 → 23.0.35
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/components/date/dateRangeInput.js +38 -7
- package/components/date/dateRangeInput.js.map +1 -1
- package/components/date/durationInput.js +176 -53
- package/components/date/durationInput.js.map +1 -1
- package/components/grid/dataGrid.d.ts +1 -0
- package/components/grid/dataGrid.js +45 -19
- package/components/grid/dataGrid.js.map +1 -1
- package/components/grid/panel/dataGridPagination.js +1 -1
- package/components/grid/panel/dataGridPagination.js.map +1 -1
- package/components/picker/enumValuePicker.d.ts +12 -4
- package/components/picker/enumValuePicker.js +27 -6
- package/components/picker/enumValuePicker.js.map +1 -1
- package/package.json +1 -1
- package/components/style/withInputNumberCss.d.ts +0 -6
- package/components/style/withInputNumberCss.js +0 -13
- package/components/style/withInputNumberCss.js.map +0 -1
- package/style/ag-grid/_ag-theme-antd-vars.scss +0 -195
- package/style/ag-grid/ag-theme-antd.scss +0 -87
- package/style/ag-grid/aggrid.scss +0 -12
- package/style/flexLayout/new/_base.scss +0 -616
- package/style/flexLayout/new/flexLayoutBase.scss +0 -622
- package/style/flexLayout/new/light.scss +0 -107
- package/style/flexLayout/old/_base.scss +0 -551
- package/style/flexLayout/old/light.scss +0 -16
|
@@ -18,6 +18,41 @@ import memoizeOne from "memoize-one";
|
|
|
18
18
|
import KeyboardUtils from "../keyboard/keyboardUtils";
|
|
19
19
|
import i18n from "d2core/i18n/i18n";
|
|
20
20
|
import DateRangeInputAdvancedPanel, { TimeShiftDirection } from "./dateRangeInputAdvancedPanel";
|
|
21
|
+
import WithCss from "../style/withCss";
|
|
22
|
+
import { createStyles } from "antd-style";
|
|
23
|
+
const useStyles = createStyles(({ token, css }) => {
|
|
24
|
+
return {
|
|
25
|
+
baseLayout: css `
|
|
26
|
+
display: inline-block;
|
|
27
|
+
position: relative;
|
|
28
|
+
width: 100%;
|
|
29
|
+
height: ${token.controlHeight}px;
|
|
30
|
+
padding: 0;
|
|
31
|
+
color: ${token.colorText};
|
|
32
|
+
font-size: ${token.fontSize}px;
|
|
33
|
+
line-height: ${token.lineHeight};
|
|
34
|
+
background-color: ${token.colorBgContainer};
|
|
35
|
+
border: 1px solid ${token.colorBorder};
|
|
36
|
+
border-radius: ${token.borderRadius}px;
|
|
37
|
+
transition: all ${token.motionDurationMid};
|
|
38
|
+
|
|
39
|
+
&:hover {
|
|
40
|
+
border-color: ${token.colorPrimaryHover};
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
&.disabled {
|
|
44
|
+
color: ${token.colorTextDisabled};
|
|
45
|
+
background-color: ${token.colorBgContainerDisabled};
|
|
46
|
+
border-color: ${token.colorBorder};
|
|
47
|
+
cursor: not-allowed;
|
|
48
|
+
|
|
49
|
+
&:hover {
|
|
50
|
+
border-color: ${token.colorBorder};
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
`
|
|
54
|
+
};
|
|
55
|
+
});
|
|
21
56
|
export var DateRangeInputMode;
|
|
22
57
|
(function (DateRangeInputMode) {
|
|
23
58
|
DateRangeInputMode[DateRangeInputMode["SIMPLE"] = 0] = "SIMPLE";
|
|
@@ -235,12 +270,8 @@ export default class DateRangeInput extends React.Component {
|
|
|
235
270
|
}
|
|
236
271
|
renderInput() {
|
|
237
272
|
const _a = this.props, { className, fromValue, toValue, onChange, style, allowClear, renderAsCalendar, hidePopup, align, disabled, defaultMode, onModeChange, confirmButtonsRenderer, onPopupVisibleChange } = _a, props = __rest(_a, ["className", "fromValue", "toValue", "onChange", "style", "allowClear", "renderAsCalendar", "hidePopup", "align", "disabled", "defaultMode", "onModeChange", "confirmButtonsRenderer", "onPopupVisibleChange"]);
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
customClassName += " ant-input-disabled";
|
|
241
|
-
}
|
|
242
|
-
return (React.createElement("div", { style: Object.assign(Object.assign({}, style), { padding: 0, position: "relative" }), className: customClassName, onFocus: this.props.onFocus, onBlur: this.props.onBlur },
|
|
243
|
-
React.createElement("div", { style: { display: "flex", justifyContent: "space-between", paddingRight: 8 } },
|
|
273
|
+
return (React.createElement("div", { style: Object.assign(Object.assign({}, style), { padding: 0, position: "relative" }), className: className, onFocus: this.props.onFocus, onBlur: this.props.onBlur },
|
|
274
|
+
React.createElement(WithCss, { useStyles: useStyles }, (context) => React.createElement("div", { style: { display: "flex", justifyContent: "space-between", paddingRight: 8 }, className: context.styles.baseLayout + (disabled || this.state.popupVisible ? " disabled" : "") },
|
|
244
275
|
React.createElement(DateTimeInput, Object.assign({ value: fromValue }, props, { disabled: disabled, inputDisabled: this.state.popupVisible, allowClear: allowClear, bordered: false, hidePopup: true, style: { width: "auto" }, inputStyle: { paddingRight: 2 }, onChange: (value) => {
|
|
245
276
|
var _a, _b;
|
|
246
277
|
(_b = (_a = this.props).onChange) === null || _b === void 0 ? void 0 : _b.call(_a, value, this.props.toValue);
|
|
@@ -264,7 +295,7 @@ export default class DateRangeInput extends React.Component {
|
|
|
264
295
|
(_b = (_a = this.props).onFocus) === null || _b === void 0 ? void 0 : _b.call(_a);
|
|
265
296
|
}
|
|
266
297
|
}
|
|
267
|
-
} }))));
|
|
298
|
+
} })))));
|
|
268
299
|
}
|
|
269
300
|
render() {
|
|
270
301
|
if (this.props.renderAsCalendar) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dateRangeInput.js","sourceRoot":"","sources":["../../../../components/date/dateRangeInput.tsx"],"names":[],"mappings":";;;;;;;;;;;AAAA,OAAO,KAAuB,MAAM,OAAO,CAAC;AAC5C,OAAO,KAAc,MAAM,OAAO,CAAC;AACnC,OAAO,EAAC,gBAAgB,EAAC,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAC,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,OAAO,EAAC,MAAM,MAAM,CAAC;AACnD,OAAO,aAAa,MAAM,iBAAiB,CAAC;AAC5C,OAAO,UAAU,MAAM,aAAa,CAAC;AAErC,OAAO,aAAa,MAAM,2BA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C,aAAa,CAAC,EACnD,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,KAAK,EACvB,SAAS,EAAE,IAAI,CAAC,KAAK,CAAC,SAAS,EAC/B,iBAAiB,EAAE,EAAC,KAAK,EAAE,aAAa,EAAC,EACzC,YAAY,EAAE,CAAC,OAAO,EAAE,EAAE;;oBACtB,IAAI,OAAO,EAAE,CAAC;wBACV,MAAA,MAAA,IAAI,CAAC,KAAK,EAAC,OAAO,kDAAI,CAAC;oBAC3B,CAAC;yBAAM,CAAC;wBACJ,MAAA,MAAA,IAAI,CAAC,KAAK,EAAC,MAAM,kDAAI,CAAC;oBAC1B,CAAC;oBACD,IAAI,CAAC,QAAQ,CAAC,EAAC,YAAY,EAAE,OAAO,EAAC,CAAC,CAAC;gBAC3C,CAAC,EACD,KAAK,EAAE,IAAI,CAAC,WAAW,EAAE,IAC7B,IAAI,CAAC,WAAW,EAAE,CACb,CACb,CAAC;QACN,CAAC;IACL,CAAC;CACJ","sourcesContent":["import React, {HTMLAttributes} from \"react\";\r\nimport dayjs, {Dayjs} from \"dayjs\";\r\nimport {CalendarOutlined} from \"@ant-design/icons\";\r\nimport {Divider, Switch, Tag, Tooltip} from \"antd\";\r\nimport DateTimeInput from \"./dateTimeInput\";\r\nimport memoizeOne from \"memoize-one\";\r\nimport {TooltipPlacement} from \"antd/es/tooltip\";\r\nimport KeyboardUtils from \"../keyboard/keyboardUtils\";\r\nimport i18n from \"d2core/i18n/i18n\";\r\nimport DateRangeInputAdvancedPanel, {TimeShiftDirection} from \"./dateRangeInputAdvancedPanel\";\r\nimport {SizeType} from \"antd/lib/config-provider/SizeContext\";\r\n\r\nexport enum DateRangeInputMode {\r\n SIMPLE,\r\n ADVANCED,\r\n}\r\n\r\nexport interface DateRangeInputProps extends Omit<HTMLAttributes<HTMLDivElement>, \"onChange\"> {\r\n mask: string\r\n fromValue: Dayjs | null\r\n toValue: Dayjs | null\r\n onChange?: (fromValue: Dayjs | null, toValue: Dayjs | null) => void\r\n onInvalidValue?: (input: string) => void\r\n disabled?: boolean\r\n minDateTime?: Dayjs\r\n maxDateTime?: Dayjs\r\n // allows to set no (null) date by datepicker\r\n allowClear?: boolean\r\n ranges?: { [rangeName: string]: () => [Dayjs, Dayjs] }\r\n size?: SizeType;\r\n compact?: boolean\r\n\r\n hidePopup?: boolean\r\n renderAsCalendar?: boolean\r\n placement?: TooltipPlacement\r\n align?: {\r\n points?: [string, string];\r\n offset?: [number, number];\r\n targetOffset?: [number, number];\r\n overflow?: {\r\n adjustX?: boolean;\r\n adjustY?: boolean;\r\n };\r\n useCssRight?: boolean;\r\n useCssBottom?: boolean;\r\n useCssTransform?: boolean;\r\n }\r\n\r\n defaultMode?: DateRangeInputMode\r\n\r\n onModeChange?(mode: DateRangeInputMode): void\r\n\r\n onFocus?(): void\r\n\r\n onBlur?(): void\r\n\r\n confirmButtonsRenderer?(): React.ReactNode\r\n\r\n onPopupVisibleChange?(visible: boolean): void\r\n}\r\n\r\ninterface DateRangeInputState {\r\n valid: boolean\r\n selectionStartDate: Dayjs | null\r\n popupKeyIndex: number\r\n popupVisible: boolean\r\n\r\n mode?: DateRangeInputMode\r\n}\r\n\r\nexport default class DateRangeInput extends React.Component<DateRangeInputProps, DateRangeInputState> {\r\n constructor(props: Readonly<DateRangeInputProps>) {\r\n super(props);\r\n this.state = {\r\n valid: !!props.fromValue && props.fromValue.isValid() && !!props.toValue && props.toValue.isValid(),\r\n selectionStartDate: null,\r\n popupKeyIndex: 0,\r\n popupVisible: false,\r\n\r\n mode: props.compact ? undefined : props.defaultMode ?? DateRangeInputMode.SIMPLE,\r\n };\r\n this.getDefaultSelectedDateForFromPanel = memoizeOne(this.getDefaultSelectedDateForFromPanel.bind(this));\r\n }\r\n\r\n componentDidUpdate(_prevProps: Readonly<DateRangeInputProps>, prevState: Readonly<DateRangeInputState>) {\r\n if (prevState.popupVisible !== this.state.popupVisible && this.props.onPopupVisibleChange) {\r\n this.props.onPopupVisibleChange(this.state.popupVisible);\r\n }\r\n }\r\n\r\n getDefaultSelectedDateForFromPanel(fromDate: Dayjs | null, toDate: Dayjs | null): Dayjs {\r\n if (!!fromDate && !!toDate && fromDate.isSame(toDate, \"date\")) {\r\n return fromDate.clone().subtract(1, \"month\");\r\n } else {\r\n return fromDate ?? dayjs().startOf(\"day\").subtract(1, \"month\");\r\n }\r\n }\r\n\r\n private getFromValue(date: Dayjs) {\r\n return (this.props.fromValue?.clone() ?? dayjs().startOf(\"day\")).year(date.year()).month(date.month()).date(date.date());\r\n }\r\n\r\n private getToValue(date: Dayjs) {\r\n return (this.props.toValue?.clone() ?? dayjs().endOf(\"day\")).year(date.year()).month(date.month()).date(date.date());\r\n }\r\n\r\n closePopup() {\r\n // close tooltip\r\n this.setState({popupKeyIndex: this.state.popupKeyIndex + 1, popupVisible: false});\r\n this.props.onPopupVisibleChange?.(false);\r\n }\r\n\r\n private onChange(fromValue: Dayjs | null, toValue: Dayjs | null) {\r\n if (this.props.minDateTime && fromValue?.isBefore(this.props.minDateTime)) {\r\n fromValue = this.props.minDateTime;\r\n }\r\n if (this.props.maxDateTime && toValue?.isAfter(this.props.maxDateTime)) {\r\n toValue = this.props.maxDateTime;\r\n }\r\n this.props.onChange?.(fromValue, toValue);\r\n }\r\n\r\n private renderSimplePart() {\r\n const {\r\n fromValue,\r\n toValue,\r\n onChange,\r\n style,\r\n allowClear,\r\n renderAsCalendar,\r\n hidePopup,\r\n align,\r\n defaultMode,\r\n onModeChange,\r\n confirmButtonsRenderer,\r\n onPopupVisibleChange,\r\n ...props\r\n } = this.props;\r\n const markedDateInterval: [Dayjs, Dayjs] | undefined = this.props.fromValue && this.props.toValue ? [this.props.fromValue, this.props.toValue] : undefined;\r\n\r\n return (\r\n <div>\r\n <div style={{display: \"flex\"}}>\r\n <DateTimeInput value={fromValue} {...props}\r\n allowClear={allowClear}\r\n renderAsCalendar\r\n style={{width: \"100%\"}}\r\n onChange={(date) => {\r\n if (date) {\r\n const fromValue = this.getFromValue(date);\r\n const toValue = this.getToValue(date);\r\n this.props.onChange?.(fromValue, toValue);\r\n }\r\n }}\r\n defaultSelectedDate={this.getDefaultSelectedDateForFromPanel(fromValue, toValue)}\r\n markedDateInterval={markedDateInterval}\r\n onDateItemMouseDown={(date) => {\r\n this.setState({selectionStartDate: date});\r\n const dateFrom = this.getFromValue(date);\r\n const dateTo = this.getToValue(date);\r\n this.props.onChange?.(dateFrom, dateTo);\r\n }}\r\n onDateItemMouseOver={(date) => {\r\n if (KeyboardUtils.isMouseDown() && !!this.state.selectionStartDate) {\r\n let dateFrom: Dayjs;\r\n let dateTo: Dayjs;\r\n if (this.state.selectionStartDate.isBefore(date)) {\r\n dateFrom = this.state.selectionStartDate;\r\n dateTo = date;\r\n } else {\r\n dateFrom = date;\r\n dateTo = this.state.selectionStartDate;\r\n }\r\n dateFrom = this.getFromValue(dateFrom);\r\n dateTo = this.getToValue(dateTo);\r\n this.props.onChange?.(dateFrom, dateTo);\r\n }\r\n }}\r\n onDateItemMouseUp={(_date) => {\r\n this.setState({selectionStartDate: null});\r\n }}\r\n ignoreKeyStrokes\r\n />\r\n <Divider type=\"vertical\" style={{height: \"auto\"}}/>\r\n <DateTimeInput value={toValue} {...props}\r\n renderAsCalendar\r\n allowClear={allowClear}\r\n style={{width: \"100%\"}}\r\n onChange={(date) => {\r\n if (date) {\r\n const fromValue = this.getFromValue(date);\r\n const toValue = this.getToValue(date);\r\n this.props.onChange?.(fromValue, toValue);\r\n }\r\n }}\r\n markedDateInterval={markedDateInterval}\r\n onDateItemMouseDown={(date) => {\r\n this.setState({selectionStartDate: date});\r\n const dateFrom = this.getFromValue(date);\r\n const dateTo = this.getToValue(date);\r\n this.props.onChange?.(dateFrom, dateTo);\r\n }}\r\n onDateItemMouseOver={(date) => {\r\n if (KeyboardUtils.isMouseDown() && !!this.state.selectionStartDate) {\r\n let dateFrom: Dayjs;\r\n let dateTo: Dayjs;\r\n if (this.state.selectionStartDate.isBefore(date)) {\r\n dateFrom = this.state.selectionStartDate;\r\n dateTo = date;\r\n } else {\r\n dateFrom = date;\r\n dateTo = this.state.selectionStartDate;\r\n }\r\n dateFrom = this.getFromValue(dateFrom);\r\n dateTo = this.getToValue(dateTo);\r\n this.props.onChange?.(dateFrom, dateTo);\r\n }\r\n }}\r\n onDateItemMouseUp={(_date) => {\r\n this.setState({selectionStartDate: null});\r\n }}\r\n ignoreKeyStrokes\r\n />\r\n </div>\r\n <div style={{borderTop: \"1px solid #ddd\", paddingTop: 6}}>\r\n {\r\n this.props.ranges && Object.keys(this.props.ranges).map((rangeName, index) => {\r\n return (<Tag style={{userSelect: \"none\", cursor: \"pointer\"}} color=\"blue\"\r\n key={`range-${index}`}\r\n onClick={() => {\r\n const rangeFunction = this.props.ranges?.[rangeName];\r\n if (rangeFunction) {\r\n const range = rangeFunction();\r\n this.props.onChange?.(range[0], range[1]);\r\n }\r\n }}>\r\n {rangeName}</Tag>);\r\n })\r\n }\r\n </div>\r\n </div>\r\n )\r\n }\r\n\r\n private renderAdvancedPart() {\r\n const {\r\n fromValue,\r\n toValue,\r\n onChange,\r\n style,\r\n allowClear,\r\n renderAsCalendar,\r\n hidePopup,\r\n align,\r\n defaultMode,\r\n compact,\r\n onModeChange,\r\n confirmButtonsRenderer,\r\n onPopupVisibleChange,\r\n ...props\r\n } = this.props;\r\n return (\r\n <div>\r\n <div style={{display: \"flex\", gap: 8}}>\r\n <DateTimeInput\r\n {...props}\r\n style={{flexGrow: 1}}\r\n value={fromValue}\r\n onChange={(value) => {\r\n this.props.onChange?.(value, this.props.toValue);\r\n }}\r\n />\r\n {!compact &&\r\n <span style={{margin: 4, color: \"rgba(0, 0, 0, 0.65)\", textAlign: \"center\"}}>{\"\\u27F7\"}</span>\r\n }\r\n <DateTimeInput\r\n {...props}\r\n style={{flexGrow: 1}}\r\n value={toValue}\r\n onChange={(value) => {\r\n this.props.onChange?.(this.props.fromValue, value);\r\n }}\r\n />\r\n </div>\r\n <DateRangeInputAdvancedPanel\r\n compact={compact}\r\n onBeginIntervalChange={unit => {\r\n let from: Dayjs;\r\n if (unit === \"15minutes\") {\r\n const roundedMinutes = Math.floor(dayjs().minute() / 15) * 15;\r\n from = dayjs().startOf(\"hour\").minute(roundedMinutes);\r\n } else {\r\n from = dayjs().startOf(unit);\r\n }\r\n this.onChange(from, this.props.toValue);\r\n }}\r\n onIntervalDurationChange={unitOfTime => {\r\n if (this.props.fromValue) {\r\n let to: Dayjs = this.props.fromValue.clone().add(1, unitOfTime).subtract(1, \"millisecond\")\r\n this.onChange(this.props.fromValue, to);\r\n }\r\n }}\r\n onTimeShift={(shiftBegin, shiftEnd, unitOfTime, type) => {\r\n let fromValue = this.props.fromValue ?? null;\r\n let toValue = this.props.toValue ?? null;\r\n\r\n if (shiftBegin && fromValue) {\r\n if (type === TimeShiftDirection.INCREMENT) {\r\n fromValue = fromValue.add(1, unitOfTime);\r\n } else if (type === TimeShiftDirection.DECREMENT) {\r\n fromValue = fromValue.subtract(1, unitOfTime);\r\n }\r\n }\r\n\r\n if (shiftEnd && toValue) {\r\n if (type === TimeShiftDirection.INCREMENT) {\r\n toValue = toValue.add(1, unitOfTime);\r\n } else if (type === TimeShiftDirection.DECREMENT) {\r\n toValue = toValue.subtract(1, unitOfTime);\r\n }\r\n }\r\n\r\n this.onChange(fromValue, toValue);\r\n }}\r\n onEndIntervalChange={unit => {\r\n let to: Dayjs;\r\n if (unit === \"15minutes\") {\r\n const roundedMinutes = Math.floor(dayjs().minute() / 15) * 15;\r\n to = dayjs().startOf(\"hour\").minute(roundedMinutes).subtract(1, \"millisecond\");\r\n } else {\r\n to = dayjs().startOf(unit).subtract(1, \"millisecond\");\r\n }\r\n this.onChange(this.props.fromValue, to);\r\n }}\r\n />\r\n </div>\r\n )\r\n }\r\n\r\n renderPopup(): React.ReactElement {\r\n return (\r\n <div onFocus={this.props.onFocus} onBlur={this.props.onBlur}>\r\n {this.props.compact && this.renderAdvancedPart()}\r\n {this.state.mode === DateRangeInputMode.SIMPLE && this.renderSimplePart()}\r\n {this.state.mode === DateRangeInputMode.ADVANCED && this.renderAdvancedPart()}\r\n <div style={{height: 28, display: \"flex\", justifyContent: \"space-between\", alignItems: \"flex-end\"}}>\r\n <div>\r\n {!this.props.compact &&\r\n <Switch\r\n checked={this.state.mode === DateRangeInputMode.ADVANCED}\r\n onChange={checked => {\r\n const mode = checked ? DateRangeInputMode.ADVANCED : DateRangeInputMode.SIMPLE;\r\n this.setState({mode: mode});\r\n this.props.onModeChange?.(mode);\r\n }}\r\n checkedChildren={i18n(\"Advanced Mode\")}\r\n unCheckedChildren={i18n(\"Simple Mode\")}\r\n />\r\n }\r\n </div>\r\n {this.props.confirmButtonsRenderer?.()}\r\n </div>\r\n </div>\r\n );\r\n }\r\n\r\n renderInput() {\r\n const {\r\n className,\r\n fromValue,\r\n toValue,\r\n onChange,\r\n style,\r\n allowClear,\r\n renderAsCalendar,\r\n hidePopup,\r\n align,\r\n disabled,\r\n defaultMode,\r\n onModeChange,\r\n confirmButtonsRenderer,\r\n onPopupVisibleChange,\r\n ...props\r\n } = this.props;\r\n\r\n let customClassName = `ant-input ant-input-outlined ${className ?? \"\"}`;\r\n if (disabled || this.state.popupVisible) {\r\n customClassName += \" ant-input-disabled\";\r\n }\r\n\r\n return (\r\n <div style={{...style, padding: 0, position: \"relative\"}} className={customClassName}\r\n onFocus={this.props.onFocus}\r\n onBlur={this.props.onBlur}>\r\n <div style={{display: \"flex\", justifyContent: \"space-between\", paddingRight: 8}}>\r\n <DateTimeInput value={fromValue} {...props}\r\n disabled={disabled}\r\n inputDisabled={this.state.popupVisible}\r\n allowClear={allowClear}\r\n bordered={false}\r\n hidePopup={true}\r\n style={{width: \"auto\"}}\r\n inputStyle={{paddingRight: 2}}\r\n onChange={(value) => {\r\n this.props.onChange?.(value, this.props.toValue);\r\n }}\r\n />\r\n <span style={{alignSelf: \"center\"}}>{\"\\u27F7\"}</span>\r\n <DateTimeInput value={toValue} {...props}\r\n disabled={disabled}\r\n inputDisabled={this.state.popupVisible}\r\n allowClear={allowClear}\r\n bordered={false}\r\n hidePopup={true}\r\n style={{width: \"auto\"}}\r\n inputStyle={{paddingLeft: 2}}\r\n onChange={(value) => {\r\n this.props.onChange?.(this.props.fromValue, value);\r\n }}\r\n />\r\n {!hidePopup && !renderAsCalendar &&\r\n <CalendarOutlined\r\n style={{cursor: (disabled || this.state.popupVisible) ? \"not-allowed\" : \"pointer\"}}\r\n onClick={(event) => {\r\n if (!disabled && document.createEvent) {\r\n if (this.state.popupVisible) {\r\n this.closePopup();\r\n } else {\r\n var ev = document.createEvent('HTMLEvents');\r\n ev.initEvent('contextmenu', true, false);\r\n event.target.dispatchEvent(ev);\r\n this.props.onFocus?.();\r\n }\r\n }\r\n }}\r\n />\r\n }\r\n </div>\r\n </div>\r\n );\r\n }\r\n\r\n render(): any {\r\n if (this.props.renderAsCalendar) {\r\n return this.renderPopup();\r\n } else if (this.props.hidePopup) {\r\n return this.renderInput();\r\n } else {\r\n return (\r\n <Tooltip color={\"white\"}\r\n key={\"date-range-popup-\" + this.state.popupKeyIndex}\r\n trigger={this.props.disabled ? [] : [\"contextMenu\"]}\r\n align={this.props.align}\r\n placement={this.props.placement}\r\n overlayInnerStyle={{width: \"fit-content\"}}\r\n onOpenChange={(visible) => {\r\n if (visible) {\r\n this.props.onFocus?.();\r\n } else {\r\n this.props.onBlur?.();\r\n }\r\n this.setState({popupVisible: visible});\r\n }}\r\n title={this.renderPopup()}>\r\n {this.renderInput()}\r\n </Tooltip>\r\n );\r\n }\r\n }\r\n}"]}
|
|
1
|
+
{"version":3,"file":"dateRangeInput.js","sourceRoot":"","sources":["../../../../components/date/dateRangeInput.tsx"],"names":[],"mappings":";;;;;;;;;;;AAAA,OAAO,KAAuB,MAAM,OAAO,CAAC;AAC5C,OAAO,KAAc,MAAM,OAAO,CAAC;AACnC,OAAO,EAAC,gBAAgB,EAAC,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAC,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,OAAO,EAAC,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AC,CAAC,CAAC;gBAC3C,CAAC,EACD,KAAK,EAAE,IAAI,CAAC,WAAW,EAAE,IAC7B,IAAI,CAAC,WAAW,EAAE,CACb,CACb,CAAC;QACN,CAAC;IACL,CAAC;CACJ","sourcesContent":["import React, {HTMLAttributes} from \"react\";\r\nimport dayjs, {Dayjs} from \"dayjs\";\r\nimport {CalendarOutlined} from \"@ant-design/icons\";\r\nimport {Divider, Switch, Tag, Tooltip} from \"antd\";\r\nimport DateTimeInput from \"./dateTimeInput\";\r\nimport memoizeOne from \"memoize-one\";\r\nimport {TooltipPlacement} from \"antd/es/tooltip\";\r\nimport KeyboardUtils from \"../keyboard/keyboardUtils\";\r\nimport i18n from \"d2core/i18n/i18n\";\r\nimport DateRangeInputAdvancedPanel, {TimeShiftDirection} from \"./dateRangeInputAdvancedPanel\";\r\nimport {SizeType} from \"antd/lib/config-provider/SizeContext\";\r\nimport WithCss from \"../style/withCss\";\r\nimport {createStyles} from \"antd-style\";\r\n\r\nconst useStyles = createStyles(({token, css}) => {\r\n return {\r\n baseLayout: css`\r\n display: inline-block;\r\n position: relative;\r\n width: 100%;\r\n height: ${token.controlHeight}px;\r\n padding: 0;\r\n color: ${token.colorText};\r\n font-size: ${token.fontSize}px;\r\n line-height: ${token.lineHeight};\r\n background-color: ${token.colorBgContainer};\r\n border: 1px solid ${token.colorBorder};\r\n border-radius: ${token.borderRadius}px;\r\n transition: all ${token.motionDurationMid};\r\n\r\n &:hover {\r\n border-color: ${token.colorPrimaryHover};\r\n }\r\n\r\n &.disabled {\r\n color: ${token.colorTextDisabled};\r\n background-color: ${token.colorBgContainerDisabled};\r\n border-color: ${token.colorBorder};\r\n cursor: not-allowed;\r\n\r\n &:hover {\r\n border-color: ${token.colorBorder};\r\n }\r\n }\r\n `\r\n }\r\n})\r\n\r\nexport enum DateRangeInputMode {\r\n SIMPLE,\r\n ADVANCED,\r\n}\r\n\r\nexport interface DateRangeInputProps extends Omit<HTMLAttributes<HTMLDivElement>, \"onChange\"> {\r\n mask: string\r\n fromValue: Dayjs | null\r\n toValue: Dayjs | null\r\n onChange?: (fromValue: Dayjs | null, toValue: Dayjs | null) => void\r\n onInvalidValue?: (input: string) => void\r\n disabled?: boolean\r\n minDateTime?: Dayjs\r\n maxDateTime?: Dayjs\r\n // allows to set no (null) date by datepicker\r\n allowClear?: boolean\r\n ranges?: { [rangeName: string]: () => [Dayjs, Dayjs] }\r\n size?: SizeType;\r\n compact?: boolean\r\n\r\n hidePopup?: boolean\r\n renderAsCalendar?: boolean\r\n placement?: TooltipPlacement\r\n align?: {\r\n points?: [string, string];\r\n offset?: [number, number];\r\n targetOffset?: [number, number];\r\n overflow?: {\r\n adjustX?: boolean;\r\n adjustY?: boolean;\r\n };\r\n useCssRight?: boolean;\r\n useCssBottom?: boolean;\r\n useCssTransform?: boolean;\r\n }\r\n\r\n defaultMode?: DateRangeInputMode\r\n\r\n onModeChange?(mode: DateRangeInputMode): void\r\n\r\n onFocus?(): void\r\n\r\n onBlur?(): void\r\n\r\n confirmButtonsRenderer?(): React.ReactNode\r\n\r\n onPopupVisibleChange?(visible: boolean): void\r\n}\r\n\r\ninterface DateRangeInputState {\r\n valid: boolean\r\n selectionStartDate: Dayjs | null\r\n popupKeyIndex: number\r\n popupVisible: boolean\r\n\r\n mode?: DateRangeInputMode\r\n}\r\n\r\nexport default class DateRangeInput extends React.Component<DateRangeInputProps, DateRangeInputState> {\r\n constructor(props: Readonly<DateRangeInputProps>) {\r\n super(props);\r\n this.state = {\r\n valid: !!props.fromValue && props.fromValue.isValid() && !!props.toValue && props.toValue.isValid(),\r\n selectionStartDate: null,\r\n popupKeyIndex: 0,\r\n popupVisible: false,\r\n\r\n mode: props.compact ? undefined : props.defaultMode ?? DateRangeInputMode.SIMPLE,\r\n };\r\n this.getDefaultSelectedDateForFromPanel = memoizeOne(this.getDefaultSelectedDateForFromPanel.bind(this));\r\n }\r\n\r\n componentDidUpdate(_prevProps: Readonly<DateRangeInputProps>, prevState: Readonly<DateRangeInputState>) {\r\n if (prevState.popupVisible !== this.state.popupVisible && this.props.onPopupVisibleChange) {\r\n this.props.onPopupVisibleChange(this.state.popupVisible);\r\n }\r\n }\r\n\r\n getDefaultSelectedDateForFromPanel(fromDate: Dayjs | null, toDate: Dayjs | null): Dayjs {\r\n if (!!fromDate && !!toDate && fromDate.isSame(toDate, \"date\")) {\r\n return fromDate.clone().subtract(1, \"month\");\r\n } else {\r\n return fromDate ?? dayjs().startOf(\"day\").subtract(1, \"month\");\r\n }\r\n }\r\n\r\n private getFromValue(date: Dayjs) {\r\n return (this.props.fromValue?.clone() ?? dayjs().startOf(\"day\")).year(date.year()).month(date.month()).date(date.date());\r\n }\r\n\r\n private getToValue(date: Dayjs) {\r\n return (this.props.toValue?.clone() ?? dayjs().endOf(\"day\")).year(date.year()).month(date.month()).date(date.date());\r\n }\r\n\r\n closePopup() {\r\n // close tooltip\r\n this.setState({popupKeyIndex: this.state.popupKeyIndex + 1, popupVisible: false});\r\n this.props.onPopupVisibleChange?.(false);\r\n }\r\n\r\n private onChange(fromValue: Dayjs | null, toValue: Dayjs | null) {\r\n if (this.props.minDateTime && fromValue?.isBefore(this.props.minDateTime)) {\r\n fromValue = this.props.minDateTime;\r\n }\r\n if (this.props.maxDateTime && toValue?.isAfter(this.props.maxDateTime)) {\r\n toValue = this.props.maxDateTime;\r\n }\r\n this.props.onChange?.(fromValue, toValue);\r\n }\r\n\r\n private renderSimplePart() {\r\n const {\r\n fromValue,\r\n toValue,\r\n onChange,\r\n style,\r\n allowClear,\r\n renderAsCalendar,\r\n hidePopup,\r\n align,\r\n defaultMode,\r\n onModeChange,\r\n confirmButtonsRenderer,\r\n onPopupVisibleChange,\r\n ...props\r\n } = this.props;\r\n const markedDateInterval: [Dayjs, Dayjs] | undefined = this.props.fromValue && this.props.toValue ? [this.props.fromValue, this.props.toValue] : undefined;\r\n\r\n return (\r\n <div>\r\n <div style={{display: \"flex\"}}>\r\n <DateTimeInput value={fromValue} {...props}\r\n allowClear={allowClear}\r\n renderAsCalendar\r\n style={{width: \"100%\"}}\r\n onChange={(date) => {\r\n if (date) {\r\n const fromValue = this.getFromValue(date);\r\n const toValue = this.getToValue(date);\r\n this.props.onChange?.(fromValue, toValue);\r\n }\r\n }}\r\n defaultSelectedDate={this.getDefaultSelectedDateForFromPanel(fromValue, toValue)}\r\n markedDateInterval={markedDateInterval}\r\n onDateItemMouseDown={(date) => {\r\n this.setState({selectionStartDate: date});\r\n const dateFrom = this.getFromValue(date);\r\n const dateTo = this.getToValue(date);\r\n this.props.onChange?.(dateFrom, dateTo);\r\n }}\r\n onDateItemMouseOver={(date) => {\r\n if (KeyboardUtils.isMouseDown() && !!this.state.selectionStartDate) {\r\n let dateFrom: Dayjs;\r\n let dateTo: Dayjs;\r\n if (this.state.selectionStartDate.isBefore(date)) {\r\n dateFrom = this.state.selectionStartDate;\r\n dateTo = date;\r\n } else {\r\n dateFrom = date;\r\n dateTo = this.state.selectionStartDate;\r\n }\r\n dateFrom = this.getFromValue(dateFrom);\r\n dateTo = this.getToValue(dateTo);\r\n this.props.onChange?.(dateFrom, dateTo);\r\n }\r\n }}\r\n onDateItemMouseUp={(_date) => {\r\n this.setState({selectionStartDate: null});\r\n }}\r\n ignoreKeyStrokes\r\n />\r\n <Divider type=\"vertical\" style={{height: \"auto\"}}/>\r\n <DateTimeInput value={toValue} {...props}\r\n renderAsCalendar\r\n allowClear={allowClear}\r\n style={{width: \"100%\"}}\r\n onChange={(date) => {\r\n if (date) {\r\n const fromValue = this.getFromValue(date);\r\n const toValue = this.getToValue(date);\r\n this.props.onChange?.(fromValue, toValue);\r\n }\r\n }}\r\n markedDateInterval={markedDateInterval}\r\n onDateItemMouseDown={(date) => {\r\n this.setState({selectionStartDate: date});\r\n const dateFrom = this.getFromValue(date);\r\n const dateTo = this.getToValue(date);\r\n this.props.onChange?.(dateFrom, dateTo);\r\n }}\r\n onDateItemMouseOver={(date) => {\r\n if (KeyboardUtils.isMouseDown() && !!this.state.selectionStartDate) {\r\n let dateFrom: Dayjs;\r\n let dateTo: Dayjs;\r\n if (this.state.selectionStartDate.isBefore(date)) {\r\n dateFrom = this.state.selectionStartDate;\r\n dateTo = date;\r\n } else {\r\n dateFrom = date;\r\n dateTo = this.state.selectionStartDate;\r\n }\r\n dateFrom = this.getFromValue(dateFrom);\r\n dateTo = this.getToValue(dateTo);\r\n this.props.onChange?.(dateFrom, dateTo);\r\n }\r\n }}\r\n onDateItemMouseUp={(_date) => {\r\n this.setState({selectionStartDate: null});\r\n }}\r\n ignoreKeyStrokes\r\n />\r\n </div>\r\n <div style={{borderTop: \"1px solid #ddd\", paddingTop: 6}}>\r\n {\r\n this.props.ranges && Object.keys(this.props.ranges).map((rangeName, index) => {\r\n return (<Tag style={{userSelect: \"none\", cursor: \"pointer\"}} color=\"blue\"\r\n key={`range-${index}`}\r\n onClick={() => {\r\n const rangeFunction = this.props.ranges?.[rangeName];\r\n if (rangeFunction) {\r\n const range = rangeFunction();\r\n this.props.onChange?.(range[0], range[1]);\r\n }\r\n }}>\r\n {rangeName}</Tag>);\r\n })\r\n }\r\n </div>\r\n </div>\r\n )\r\n }\r\n\r\n private renderAdvancedPart() {\r\n const {\r\n fromValue,\r\n toValue,\r\n onChange,\r\n style,\r\n allowClear,\r\n renderAsCalendar,\r\n hidePopup,\r\n align,\r\n defaultMode,\r\n compact,\r\n onModeChange,\r\n confirmButtonsRenderer,\r\n onPopupVisibleChange,\r\n ...props\r\n } = this.props;\r\n return (\r\n <div>\r\n <div style={{display: \"flex\", gap: 8}}>\r\n <DateTimeInput\r\n {...props}\r\n style={{flexGrow: 1}}\r\n value={fromValue}\r\n onChange={(value) => {\r\n this.props.onChange?.(value, this.props.toValue);\r\n }}\r\n />\r\n {!compact &&\r\n <span style={{margin: 4, color: \"rgba(0, 0, 0, 0.65)\", textAlign: \"center\"}}>{\"\\u27F7\"}</span>\r\n }\r\n <DateTimeInput\r\n {...props}\r\n style={{flexGrow: 1}}\r\n value={toValue}\r\n onChange={(value) => {\r\n this.props.onChange?.(this.props.fromValue, value);\r\n }}\r\n />\r\n </div>\r\n <DateRangeInputAdvancedPanel\r\n compact={compact}\r\n onBeginIntervalChange={unit => {\r\n let from: Dayjs;\r\n if (unit === \"15minutes\") {\r\n const roundedMinutes = Math.floor(dayjs().minute() / 15) * 15;\r\n from = dayjs().startOf(\"hour\").minute(roundedMinutes);\r\n } else {\r\n from = dayjs().startOf(unit);\r\n }\r\n this.onChange(from, this.props.toValue);\r\n }}\r\n onIntervalDurationChange={unitOfTime => {\r\n if (this.props.fromValue) {\r\n let to: Dayjs = this.props.fromValue.clone().add(1, unitOfTime).subtract(1, \"millisecond\")\r\n this.onChange(this.props.fromValue, to);\r\n }\r\n }}\r\n onTimeShift={(shiftBegin, shiftEnd, unitOfTime, type) => {\r\n let fromValue = this.props.fromValue ?? null;\r\n let toValue = this.props.toValue ?? null;\r\n\r\n if (shiftBegin && fromValue) {\r\n if (type === TimeShiftDirection.INCREMENT) {\r\n fromValue = fromValue.add(1, unitOfTime);\r\n } else if (type === TimeShiftDirection.DECREMENT) {\r\n fromValue = fromValue.subtract(1, unitOfTime);\r\n }\r\n }\r\n\r\n if (shiftEnd && toValue) {\r\n if (type === TimeShiftDirection.INCREMENT) {\r\n toValue = toValue.add(1, unitOfTime);\r\n } else if (type === TimeShiftDirection.DECREMENT) {\r\n toValue = toValue.subtract(1, unitOfTime);\r\n }\r\n }\r\n\r\n this.onChange(fromValue, toValue);\r\n }}\r\n onEndIntervalChange={unit => {\r\n let to: Dayjs;\r\n if (unit === \"15minutes\") {\r\n const roundedMinutes = Math.floor(dayjs().minute() / 15) * 15;\r\n to = dayjs().startOf(\"hour\").minute(roundedMinutes).subtract(1, \"millisecond\");\r\n } else {\r\n to = dayjs().startOf(unit).subtract(1, \"millisecond\");\r\n }\r\n this.onChange(this.props.fromValue, to);\r\n }}\r\n />\r\n </div>\r\n )\r\n }\r\n\r\n renderPopup(): React.ReactElement {\r\n return (\r\n <div onFocus={this.props.onFocus} onBlur={this.props.onBlur}>\r\n {this.props.compact && this.renderAdvancedPart()}\r\n {this.state.mode === DateRangeInputMode.SIMPLE && this.renderSimplePart()}\r\n {this.state.mode === DateRangeInputMode.ADVANCED && this.renderAdvancedPart()}\r\n <div style={{height: 28, display: \"flex\", justifyContent: \"space-between\", alignItems: \"flex-end\"}}>\r\n <div>\r\n {!this.props.compact &&\r\n <Switch\r\n checked={this.state.mode === DateRangeInputMode.ADVANCED}\r\n onChange={checked => {\r\n const mode = checked ? DateRangeInputMode.ADVANCED : DateRangeInputMode.SIMPLE;\r\n this.setState({mode: mode});\r\n this.props.onModeChange?.(mode);\r\n }}\r\n checkedChildren={i18n(\"Advanced Mode\")}\r\n unCheckedChildren={i18n(\"Simple Mode\")}\r\n />\r\n }\r\n </div>\r\n {this.props.confirmButtonsRenderer?.()}\r\n </div>\r\n </div>\r\n );\r\n }\r\n\r\n renderInput() {\r\n const {\r\n className,\r\n fromValue,\r\n toValue,\r\n onChange,\r\n style,\r\n allowClear,\r\n renderAsCalendar,\r\n hidePopup,\r\n align,\r\n disabled,\r\n defaultMode,\r\n onModeChange,\r\n confirmButtonsRenderer,\r\n onPopupVisibleChange,\r\n ...props\r\n } = this.props;\r\n\r\n return (\r\n <div style={{...style, padding: 0, position: \"relative\"}} className={className}\r\n onFocus={this.props.onFocus}\r\n onBlur={this.props.onBlur}>\r\n <WithCss useStyles={useStyles}>\r\n {(context) =>\r\n <div style={{display: \"flex\", justifyContent: \"space-between\", paddingRight: 8}}\r\n className={context.styles.baseLayout + (disabled || this.state.popupVisible ? \" disabled\" : \"\")}>\r\n <DateTimeInput value={fromValue} {...props}\r\n disabled={disabled}\r\n inputDisabled={this.state.popupVisible}\r\n allowClear={allowClear}\r\n bordered={false}\r\n hidePopup={true}\r\n style={{width: \"auto\"}}\r\n inputStyle={{paddingRight: 2}}\r\n onChange={(value) => {\r\n this.props.onChange?.(value, this.props.toValue);\r\n }}\r\n />\r\n <span style={{alignSelf: \"center\"}}>{\"\\u27F7\"}</span>\r\n <DateTimeInput value={toValue} {...props}\r\n disabled={disabled}\r\n inputDisabled={this.state.popupVisible}\r\n allowClear={allowClear}\r\n bordered={false}\r\n hidePopup={true}\r\n style={{width: \"auto\"}}\r\n inputStyle={{paddingLeft: 2}}\r\n onChange={(value) => {\r\n this.props.onChange?.(this.props.fromValue, value);\r\n }}\r\n />\r\n {!hidePopup && !renderAsCalendar &&\r\n <CalendarOutlined\r\n style={{cursor: (disabled || this.state.popupVisible) ? \"not-allowed\" : \"pointer\"}}\r\n onClick={(event) => {\r\n if (!disabled && document.createEvent) {\r\n if (this.state.popupVisible) {\r\n this.closePopup();\r\n } else {\r\n var ev = document.createEvent('HTMLEvents');\r\n ev.initEvent('contextmenu', true, false);\r\n event.target.dispatchEvent(ev);\r\n this.props.onFocus?.();\r\n }\r\n }\r\n }}\r\n />\r\n }\r\n </div>\r\n }\r\n </WithCss>\r\n </div>\r\n );\r\n }\r\n\r\n render(): any {\r\n if (this.props.renderAsCalendar) {\r\n return this.renderPopup();\r\n } else if (this.props.hidePopup) {\r\n return this.renderInput();\r\n } else {\r\n return (\r\n <Tooltip color={\"white\"}\r\n key={\"date-range-popup-\" + this.state.popupKeyIndex}\r\n trigger={this.props.disabled ? [] : [\"contextMenu\"]}\r\n align={this.props.align}\r\n placement={this.props.placement}\r\n overlayInnerStyle={{width: \"fit-content\"}}\r\n onOpenChange={(visible) => {\r\n if (visible) {\r\n this.props.onFocus?.();\r\n } else {\r\n this.props.onBlur?.();\r\n }\r\n this.setState({popupVisible: visible});\r\n }}\r\n title={this.renderPopup()}>\r\n {this.renderInput()}\r\n </Tooltip>\r\n );\r\n }\r\n }\r\n}"]}
|
|
@@ -15,7 +15,131 @@ import dayjs, { isDuration } from "dayjs";
|
|
|
15
15
|
import { LocaleHolder } from "d2core/i18n/localeHolder";
|
|
16
16
|
import { AutoComplete } from "antd";
|
|
17
17
|
import DropdownArrow from "../icons/dropdownArrow";
|
|
18
|
-
import
|
|
18
|
+
import WithCss from "../style/withCss";
|
|
19
|
+
import { createStyles } from "antd-style";
|
|
20
|
+
const useStyles = createStyles(({ token, css }) => {
|
|
21
|
+
return {
|
|
22
|
+
baseLayout: css `
|
|
23
|
+
&.input-number {
|
|
24
|
+
display: inline-block;
|
|
25
|
+
position: relative;
|
|
26
|
+
width: 100%;
|
|
27
|
+
height: ${token.controlHeight}px;
|
|
28
|
+
padding: 0;
|
|
29
|
+
color: ${token.colorText};
|
|
30
|
+
font-size: ${token.fontSize}px;
|
|
31
|
+
line-height: ${token.lineHeight};
|
|
32
|
+
background-color: ${token.colorBgContainer};
|
|
33
|
+
border: 1px solid ${token.colorBorder};
|
|
34
|
+
border-radius: ${token.borderRadius}px;
|
|
35
|
+
transition: all ${token.motionDurationMid};
|
|
36
|
+
|
|
37
|
+
&:hover {
|
|
38
|
+
border-color: ${token.colorPrimaryHover};
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
&.disabled {
|
|
42
|
+
color: ${token.colorTextDisabled};
|
|
43
|
+
background-color: ${token.colorBgContainerDisabled};
|
|
44
|
+
border-color: ${token.colorBorder};
|
|
45
|
+
cursor: not-allowed;
|
|
46
|
+
|
|
47
|
+
&:hover {
|
|
48
|
+
border-color: ${token.colorBorder};
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
.handler-wrap {
|
|
53
|
+
position: absolute;
|
|
54
|
+
top: 0;
|
|
55
|
+
right: 0;
|
|
56
|
+
width: 22px;
|
|
57
|
+
height: 100%;
|
|
58
|
+
background: ${token.colorBgContainer};
|
|
59
|
+
border-inline-start: ${token.lineWidth}px ${token.lineType} ${token.colorBorder};
|
|
60
|
+
border-radius: 0 ${token.borderRadius}px ${token.borderRadius}px 0;
|
|
61
|
+
display: flex;
|
|
62
|
+
flex-direction: column;
|
|
63
|
+
opacity: 0;
|
|
64
|
+
transition: opacity ${token.motionDurationMid};
|
|
65
|
+
|
|
66
|
+
.number-handler {
|
|
67
|
+
display: flex;
|
|
68
|
+
align-items: center;
|
|
69
|
+
justify-content: center;
|
|
70
|
+
flex: 1;
|
|
71
|
+
width: 100%;
|
|
72
|
+
height: 50%;
|
|
73
|
+
overflow: hidden;
|
|
74
|
+
color: ${token.colorTextDescription};
|
|
75
|
+
line-height: 1;
|
|
76
|
+
user-select: none;
|
|
77
|
+
transition: all ${token.motionDurationMid};
|
|
78
|
+
cursor: pointer;
|
|
79
|
+
border-inline-start: ${token.lineWidth}px ${token.lineType} transparent;
|
|
80
|
+
|
|
81
|
+
&:hover:not(&-up-disabled):not(&-down-disabled) {
|
|
82
|
+
flex: 1.5; /* This button grows */
|
|
83
|
+
color: ${token.colorPrimary};
|
|
84
|
+
background: ${token.colorFillAlter};
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
&:hover {
|
|
88
|
+
color: ${token.colorPrimary};
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
&:active {
|
|
92
|
+
background: ${token.colorFillAlter};
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
.anticon {
|
|
96
|
+
display: inline-block;
|
|
97
|
+
font-size: 7px;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
.number-handler-up {
|
|
102
|
+
border-top-right-radius: ${token.borderRadius}px;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
.number-handler-down {
|
|
106
|
+
border-top: ${token.lineWidth}px ${token.lineType} ${token.colorBorder};
|
|
107
|
+
border-bottom-right-radius: ${token.borderRadius}px;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
.number-handler-up-disabled,
|
|
111
|
+
.number-handler-down-disabled {
|
|
112
|
+
cursor: not-allowed;
|
|
113
|
+
color: ${token.colorTextDisabled};
|
|
114
|
+
|
|
115
|
+
&:hover {
|
|
116
|
+
color: ${token.colorTextDisabled};
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
&:hover .handler-wrap {
|
|
122
|
+
opacity: 1;
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
`,
|
|
126
|
+
handlerUp: css `
|
|
127
|
+
border-top-right-radius: ${token.borderRadius}px;
|
|
128
|
+
|
|
129
|
+
/* The line between UP and DOWN */
|
|
130
|
+
border-bottom: ${token.lineWidth}px ${token.lineType} ${token.colorBorder};
|
|
131
|
+
`,
|
|
132
|
+
handlerDown: css `
|
|
133
|
+
border-bottom-right-radius: ${token.borderRadius}px;
|
|
134
|
+
`,
|
|
135
|
+
handlerIcon: css `
|
|
136
|
+
display: inline-block;
|
|
137
|
+
font-style: normal;
|
|
138
|
+
line-height: 0;
|
|
139
|
+
text-transform: none;
|
|
140
|
+
`
|
|
141
|
+
};
|
|
142
|
+
});
|
|
19
143
|
const DURATION_DATA_MAP = [
|
|
20
144
|
{ key: "SSS", min: 0, max: 999, minLen: 3, maxLen: 3, mult: 1, unit: "ms" },
|
|
21
145
|
{ key: "s", min: 0, max: 59, minLen: 1, maxLen: 2, mult: 1000, unit: "s" },
|
|
@@ -171,60 +295,59 @@ export default class DurationInput extends React.Component {
|
|
|
171
295
|
const _a = this.props, { mask, value, onChange, style, disabled, predefinedValues, autoFocus, size, className } = _a, props = __rest(_a, ["mask", "value", "onChange", "style", "disabled", "predefinedValues", "autoFocus", "size", "className"]);
|
|
172
296
|
const incrementButtonDisabled = this.state.currentInfo.info === undefined || !checkValue(this.state.currentInfo, this.props.value, 1);
|
|
173
297
|
const decrementButtonDisabled = this.state.currentInfo.info === undefined || !checkValue(this.state.currentInfo, this.props.value, -1);
|
|
174
|
-
return (React.createElement(
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
298
|
+
return (React.createElement(WithCss, { useStyles: useStyles }, (context) => React.createElement("div", Object.assign({ style: style }, props, { className: (className ? className + " " : "") + (!predefinedValues ? "input-number" : "") + " " + context.styles.baseLayout + " " + (disabled ? "disabled" : ""), onKeyDown: (event) => {
|
|
299
|
+
if (event.code === "ArrowUp") {
|
|
300
|
+
this.increment();
|
|
301
|
+
event.preventDefault();
|
|
302
|
+
event.stopPropagation();
|
|
303
|
+
}
|
|
304
|
+
else if (event.code === "ArrowDown") {
|
|
305
|
+
this.decrement();
|
|
306
|
+
event.preventDefault();
|
|
307
|
+
event.stopPropagation();
|
|
308
|
+
}
|
|
309
|
+
} }),
|
|
310
|
+
React.createElement(AutoComplete, { className: this.state.valid ? "" : "invalid", options: this.state.opened ? predefinedValues === null || predefinedValues === void 0 ? void 0 : predefinedValues.map(v => {
|
|
311
|
+
return { value: v.value, label: v.key };
|
|
312
|
+
}) : [], defaultOpen: false, defaultActiveFirstOption: false, defaultValue: undefined, disabled: disabled, autoFocus: autoFocus, style: { width: "100%", height: "inherit" }, value: this.state.valid ? this.state.value : "", onSelect: (e) => {
|
|
313
|
+
const val = dayjs.duration(Number(e));
|
|
314
|
+
this.setState({
|
|
315
|
+
opened: false,
|
|
316
|
+
valid: isDuration(val),
|
|
317
|
+
value: formatDuration(val, this.props.mask),
|
|
318
|
+
});
|
|
319
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(val === undefined ? null : val);
|
|
320
|
+
}, onBlur: () => {
|
|
321
|
+
this.setState({ opened: false });
|
|
322
|
+
} },
|
|
323
|
+
React.createElement(MaskedInput, { mask: this.props.mask.replace(/[a-zA-Z]/g, '1'), ref: this.inputRef, style: Object.assign({ border: predefinedValues ? undefined : "none" }, this.props.inputStyle), size: size, placeholder: this.props.mask.replace(/[a-zA-Z]/g, '_'), autoFocus: autoFocus, onFocus: (event => {
|
|
324
|
+
event.target.selectionStart = event.target.selectionEnd = this.state.selectionStart;
|
|
325
|
+
}), suffix: this.props.predefinedValues !== undefined && this.props.predefinedValues.length > 0 &&
|
|
326
|
+
React.createElement(DropdownArrow, { opened: this.state.opened, onClick: () => {
|
|
327
|
+
if (!this.props.disabled) {
|
|
328
|
+
this.setState({ opened: !this.state.opened });
|
|
329
|
+
}
|
|
330
|
+
} }), onMouseUp: this.recalc, onKeyUp: this.recalc, onChange: (event) => {
|
|
331
|
+
var _a;
|
|
332
|
+
const value = { length: 0 };
|
|
333
|
+
parseDuration(event.target.value, this.props.mask, (_a = event.target.selectionStart) !== null && _a !== void 0 ? _a : undefined, value);
|
|
334
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(value.time === undefined ? null : value.time);
|
|
191
335
|
this.setState({
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
value:
|
|
336
|
+
valid: isDuration(value.time),
|
|
337
|
+
currentInfo: value,
|
|
338
|
+
value: event.target.value,
|
|
195
339
|
});
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
} },
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
} }), onMouseUp: this.recalc, onKeyUp: this.recalc, onChange: (event) => {
|
|
208
|
-
var _a;
|
|
209
|
-
const value = { length: 0 };
|
|
210
|
-
parseDuration(event.target.value, this.props.mask, (_a = event.target.selectionStart) !== null && _a !== void 0 ? _a : undefined, value);
|
|
211
|
-
onChange === null || onChange === void 0 ? void 0 : onChange(value.time === undefined ? null : value.time);
|
|
212
|
-
this.setState({
|
|
213
|
-
valid: isDuration(value.time),
|
|
214
|
-
currentInfo: value,
|
|
215
|
-
value: event.target.value,
|
|
216
|
-
});
|
|
217
|
-
} })),
|
|
218
|
-
!predefinedValues && !disabled &&
|
|
219
|
-
React.createElement("div", { className: "ant-input-number-handler-wrap" },
|
|
220
|
-
React.createElement("span", { onClick: this.increment, className: `ant-input-number-handler ant-input-number-handler-up ${incrementButtonDisabled ? "ant-input-number-handler-up-disabled" : ""}` },
|
|
221
|
-
React.createElement("span", { className: "anticon anticon-up ant-input-number-handler-up-inner" },
|
|
222
|
-
React.createElement("svg", { viewBox: "64 64 896 896", focusable: "false", "data-icon": "up", width: "1em", height: "1em", fill: "currentColor", "aria-hidden": "true" },
|
|
223
|
-
React.createElement("path", { d: "M890.5 755.3L537.9 269.2c-12.8-17.6-39-17.6-51.7 0L133.5 755.3A8 8 0 00140 768h75c5.1 0 9.9-2.5 12.9-6.6L512 369.8l284.1 391.6c3 4.1 7.8 6.6 12.9 6.6h75c6.5 0 10.3-7.4 6.5-12.7z" })))),
|
|
224
|
-
React.createElement("span", { onClick: this.decrement, className: `ant-input-number-handler ant-input-number-handler-down ${decrementButtonDisabled ? "ant-input-number-handler-down-disabled" : ""}` },
|
|
225
|
-
React.createElement("span", { className: "anticon anticon-down ant-input-number-handler-down-inner" },
|
|
226
|
-
React.createElement("svg", { viewBox: "64 64 896 896", focusable: "false", "data-icon": "down", width: "1em", height: "1em", fill: "currentColor", "aria-hidden": "true" },
|
|
227
|
-
React.createElement("path", { d: "M884 256h-75c-5.1 0-9.9 2.5-12.9 6.6L512 654.2 227.9 262.6c-3-4.1-7.8-6.6-12.9-6.6h-75c-6.5 0-10.3 7.4-6.5 12.7l352.6 486.1c12.8 17.6 39 17.6 51.7 0l352.6-486.1c3.9-5.3.1-12.7-6.4-12.7z" }))))))));
|
|
340
|
+
} })),
|
|
341
|
+
!predefinedValues && !disabled &&
|
|
342
|
+
React.createElement("div", { className: "handler-wrap" },
|
|
343
|
+
React.createElement("span", { onClick: this.increment, className: `number-handler number-handler-up ${incrementButtonDisabled ? "number-handler-up-disabled" : ""}` },
|
|
344
|
+
React.createElement("span", { className: "anticon anticon-up number-handler-up-inner" },
|
|
345
|
+
React.createElement("svg", { viewBox: "64 64 896 896", focusable: "false", "data-icon": "up", width: "1em", height: "1em", fill: "currentColor", "aria-hidden": "true" },
|
|
346
|
+
React.createElement("path", { d: "M890.5 755.3L537.9 269.2c-12.8-17.6-39-17.6-51.7 0L133.5 755.3A8 8 0 00140 768h75c5.1 0 9.9-2.5 12.9-6.6L512 369.8l284.1 391.6c3 4.1 7.8 6.6 12.9 6.6h75c6.5 0 10.3-7.4 6.5-12.7z" })))),
|
|
347
|
+
React.createElement("span", { onClick: this.decrement, className: `number-handler number-handler-down ${decrementButtonDisabled ? "number-handler-down-disabled" : ""}` },
|
|
348
|
+
React.createElement("span", { className: "anticon anticon-down number-handler-down-inner" },
|
|
349
|
+
React.createElement("svg", { viewBox: "64 64 896 896", focusable: "false", "data-icon": "down", width: "1em", height: "1em", fill: "currentColor", "aria-hidden": "true" },
|
|
350
|
+
React.createElement("path", { d: "M884 256h-75c-5.1 0-9.9 2.5-12.9 6.6L512 654.2 227.9 262.6c-3-4.1-7.8-6.6-12.9-6.6h-75c-6.5 0-10.3 7.4-6.5 12.7l352.6 486.1c12.8 17.6 39 17.6 51.7 0l352.6-486.1c3.9-5.3.1-12.7-6.4-12.7z" }))))))));
|
|
228
351
|
}
|
|
229
352
|
}
|
|
230
353
|
function checkValue(info, value, offset = 0) {
|