d2coreui 23.0.35 → 23.0.37

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.
@@ -20,13 +20,19 @@ import i18n from "d2core/i18n/i18n";
20
20
  import DateRangeInputAdvancedPanel, { TimeShiftDirection } from "./dateRangeInputAdvancedPanel";
21
21
  import WithCss from "../style/withCss";
22
22
  import { createStyles } from "antd-style";
23
- const useStyles = createStyles(({ token, css }) => {
23
+ const useStyles = createStyles(({ token, css }, props) => {
24
+ const { size = 'middle' } = props;
25
+ const heightMap = {
26
+ small: token.controlHeightSM,
27
+ middle: token.controlHeight,
28
+ large: token.controlHeightLG,
29
+ };
24
30
  return {
25
31
  baseLayout: css `
26
32
  display: inline-block;
27
33
  position: relative;
28
34
  width: 100%;
29
- height: ${token.controlHeight}px;
35
+ height: ${heightMap[size]}px;
30
36
  padding: 0;
31
37
  color: ${token.colorText};
32
38
  font-size: ${token.fontSize}px;
@@ -35,9 +41,38 @@ const useStyles = createStyles(({ token, css }) => {
35
41
  border: 1px solid ${token.colorBorder};
36
42
  border-radius: ${token.borderRadius}px;
37
43
  transition: all ${token.motionDurationMid};
44
+
45
+ .ant-space-compact & {
46
+ border-radius: 0;
47
+ }
48
+
49
+ .ant-space-compact > *:not(:last-child) & {
50
+ width: calc(100% + 1px);
51
+ }
52
+
53
+ .ant-space-compact > *:first-child & {
54
+ border-start-start-radius: ${token.borderRadius}px;
55
+ border-end-start-radius: ${token.borderRadius}px;
56
+ border-inline-end-width: 1px;
57
+ }
58
+
59
+ .ant-space-compact > *:last-child & {
60
+ border-start-end-radius: ${token.borderRadius}px;
61
+ border-end-end-radius: ${token.borderRadius}px;
62
+ }
63
+
64
+ .ant-space-compact > *:first-child:last-child & {
65
+ border-radius: ${token.borderRadius}px;
66
+ }
67
+
68
+ &:focus-within {
69
+ border-color: ${token.colorPrimaryHover};
70
+ z-index: 3;
71
+ }
38
72
 
39
73
  &:hover {
40
74
  border-color: ${token.colorPrimaryHover};
75
+ z-index: 3;
41
76
  }
42
77
 
43
78
  &.disabled {
@@ -269,15 +304,15 @@ export default class DateRangeInput extends React.Component {
269
304
  _b.call(_a))));
270
305
  }
271
306
  renderInput() {
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"]);
307
+ const _a = this.props, { className, fromValue, toValue, onChange, style, allowClear, renderAsCalendar, hidePopup, align, disabled, defaultMode, onModeChange, confirmButtonsRenderer, onPopupVisibleChange, size } = _a, props = __rest(_a, ["className", "fromValue", "toValue", "onChange", "style", "allowClear", "renderAsCalendar", "hidePopup", "align", "disabled", "defaultMode", "onModeChange", "confirmButtonsRenderer", "onPopupVisibleChange", "size"]);
273
308
  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" : "") },
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) => {
309
+ React.createElement(WithCss, { useStyles: useStyles, props: { size } }, (context) => React.createElement("div", { style: { display: "flex", justifyContent: "space-between", paddingRight: 8 }, className: context.styles.baseLayout + (disabled || this.state.popupVisible ? " disabled" : "") },
310
+ React.createElement(DateTimeInput, Object.assign({ value: fromValue }, props, { disabled: disabled, inputDisabled: this.state.popupVisible, allowClear: allowClear, bordered: false, hidePopup: true, size: size, style: { width: "auto" }, inputStyle: { paddingRight: 2 }, onChange: (value) => {
276
311
  var _a, _b;
277
312
  (_b = (_a = this.props).onChange) === null || _b === void 0 ? void 0 : _b.call(_a, value, this.props.toValue);
278
313
  } })),
279
314
  React.createElement("span", { style: { alignSelf: "center" } }, "\u27F7"),
280
- React.createElement(DateTimeInput, Object.assign({ value: toValue }, props, { disabled: disabled, inputDisabled: this.state.popupVisible, allowClear: allowClear, bordered: false, hidePopup: true, style: { width: "auto" }, inputStyle: { paddingLeft: 2 }, onChange: (value) => {
315
+ React.createElement(DateTimeInput, Object.assign({ value: toValue }, props, { disabled: disabled, inputDisabled: this.state.popupVisible, allowClear: allowClear, bordered: false, hidePopup: true, size: size, style: { width: "auto" }, inputStyle: { paddingLeft: 2 }, onChange: (value) => {
281
316
  var _a, _b;
282
317
  (_b = (_a = this.props).onChange) === null || _b === void 0 ? void 0 : _b.call(_a, this.props.fromValue, value);
283
318
  } })),
@@ -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,2BAA2B,CAAC;AACtD,OAAO,IAAI,MAAM,kBAAkB,CAAC;AACpC,OAAO,2BAA2B,EAAE,EAAC,kBAAkB,EAAC,MAAM,+BAA+B,CAAC;AAE9F,OAAO,OAAO,MAAM,kBAAkB,CAAC;AACvC,OAAO,EAAC,YAAY,EAAC,MAAM,YAAY,CAAC;AAEx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,IAAI,IAAI,CAAC,KAAK,CAAC,gBAAgB,EAAE,CAAC;YAC9B,OAAO,IAAI,CAAC,WAAW,EAAE,CAAC;QAC9B,CAAC;aAAM,IAAI,IAAI,CAAC,KAAK,CAAC,SAAS,EAAE,CAAC;YAC9B,OAAO,IAAI,CAAC,WAAW,EAAE,CAAC;QAC9B,CAAC;aAAM,CAAC;YACJ,OAAO,CACH,oBAAC,OAAO,IAAC,KAAK,EAAE,OAAO,EACd,GAAG,EAAE,mBAAmB,GAAG,IAAI,CAAC,KAAK,CAAC,aAAa,EACnD,OAAO,EAAE,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,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\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}"]}
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,2BAA2B,CAAC;AACtD,OAAO,IAAI,MAAM,kBAAkB,CAAC;AACpC,OAAO,2BAA2B,EAAE,EAAC,kBAAkB,EAAC,MAAM,+BAA+B,CAAC;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O,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\nimport WithCss from \"../style/withCss\";\r\nimport {createStyles} from \"antd-style\";\r\n\r\nconst useStyles = createStyles(({token, css}, props: {size: SizeType}) => {\r\n const {size = 'middle'} = props;\r\n\r\n const heightMap: Record<NonNullable<SizeType>, number> = {\r\n small: token.controlHeightSM,\r\n middle: token.controlHeight,\r\n large: token.controlHeightLG,\r\n };\r\n\r\n return {\r\n baseLayout: css`\r\n display: inline-block;\r\n position: relative;\r\n width: 100%;\r\n height: ${heightMap[size]}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 .ant-space-compact & {\r\n border-radius: 0;\r\n }\r\n\r\n .ant-space-compact > *:not(:last-child) & {\r\n width: calc(100% + 1px);\r\n }\r\n\r\n .ant-space-compact > *:first-child & {\r\n border-start-start-radius: ${token.borderRadius}px;\r\n border-end-start-radius: ${token.borderRadius}px;\r\n border-inline-end-width: 1px;\r\n }\r\n\r\n .ant-space-compact > *:last-child & {\r\n border-start-end-radius: ${token.borderRadius}px;\r\n border-end-end-radius: ${token.borderRadius}px;\r\n }\r\n\r\n .ant-space-compact > *:first-child:last-child & {\r\n border-radius: ${token.borderRadius}px;\r\n }\r\n \r\n &:focus-within {\r\n border-color: ${token.colorPrimaryHover};\r\n z-index: 3;\r\n }\r\n\r\n &:hover {\r\n border-color: ${token.colorPrimaryHover};\r\n z-index: 3;\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 size,\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} props={{size}}>\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 size={size}\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 size={size}\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}"]}
@@ -48,7 +48,7 @@ export declare function parseDuration(value: string, mask: string, cursorPos?: n
48
48
  export default class DurationInput extends React.Component<DurationInputProps, DurationInputState> {
49
49
  private inputRef;
50
50
  constructor(props: Readonly<DurationInputProps>);
51
- componentDidUpdate(): void;
51
+ componentDidUpdate(prevProps: Readonly<DurationInputProps>, _prevState: Readonly<DurationInputState>): void;
52
52
  recalc(): void;
53
53
  increment(): void;
54
54
  decrement(): void;
@@ -242,17 +242,20 @@ export default class DurationInput extends React.Component {
242
242
  this.increment = this.increment.bind(this);
243
243
  this.decrement = this.decrement.bind(this);
244
244
  }
245
- componentDidUpdate() {
245
+ componentDidUpdate(prevProps, _prevState) {
246
+ var _a, _b;
246
247
  if (this.inputRef.current !== null) {
247
248
  this.inputRef.current.input.selectionStart = this.state.selectionStart;
248
249
  this.inputRef.current.input.selectionEnd = this.state.selectionEnd;
249
250
  }
250
- const value = formatDuration(this.props.value, this.props.mask);
251
- if (this.state.value !== value) {
252
- this.setState({
253
- value: value,
254
- valid: isDuration(this.props.value),
255
- });
251
+ if (((_a = prevProps.value) === null || _a === void 0 ? void 0 : _a.asMilliseconds()) !== ((_b = this.props.value) === null || _b === void 0 ? void 0 : _b.asMilliseconds())) {
252
+ const value = formatDuration(this.props.value, this.props.mask);
253
+ if (this.state.value !== value) {
254
+ this.setState({
255
+ value: value,
256
+ valid: isDuration(this.props.value),
257
+ });
258
+ }
256
259
  }
257
260
  }
258
261
  recalc() {
@@ -268,20 +271,32 @@ export default class DurationInput extends React.Component {
268
271
  }
269
272
  }
270
273
  increment() {
271
- var _a, _b, _c, _d, _e;
274
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
272
275
  if (this.state.currentInfo.info !== undefined && checkValue(this.state.currentInfo, this.props.value, 1)) {
273
- (_b = (_a = this.props).onChange) === null || _b === void 0 ? void 0 : _b.call(_a, (_d = (_c = this.props.value) === null || _c === void 0 ? void 0 : _c.add(1, this.state.currentInfo.info.unit)) !== null && _d !== void 0 ? _d : null);
274
- this.setState({ selectionEnd: this.state.selectionStart });
276
+ const duration = (_b = (_a = this.props.value) === null || _a === void 0 ? void 0 : _a.add(1, this.state.currentInfo.info.unit)) !== null && _b !== void 0 ? _b : null;
277
+ (_d = (_c = this.props).onChange) === null || _d === void 0 ? void 0 : _d.call(_c, duration);
278
+ const value = formatDuration(duration, this.props.mask);
279
+ this.setState({
280
+ value: value,
281
+ selectionStart: (_f = (_e = this.inputRef.current) === null || _e === void 0 ? void 0 : _e.input.selectionStart) !== null && _f !== void 0 ? _f : null,
282
+ selectionEnd: (_h = (_g = this.inputRef.current) === null || _g === void 0 ? void 0 : _g.input.selectionEnd) !== null && _h !== void 0 ? _h : null
283
+ });
275
284
  }
276
- (_e = this.inputRef.current) === null || _e === void 0 ? void 0 : _e.focus();
285
+ (_j = this.inputRef.current) === null || _j === void 0 ? void 0 : _j.focus();
277
286
  }
278
287
  decrement() {
279
- var _a, _b, _c, _d, _e;
288
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
280
289
  if (this.state.currentInfo.info !== undefined && checkValue(this.state.currentInfo, this.props.value, -1)) {
281
- (_b = (_a = this.props).onChange) === null || _b === void 0 ? void 0 : _b.call(_a, (_d = (_c = this.props.value) === null || _c === void 0 ? void 0 : _c.subtract(1, this.state.currentInfo.info.unit)) !== null && _d !== void 0 ? _d : null);
282
- this.setState({ selectionEnd: this.state.selectionStart });
290
+ const duration = (_b = (_a = this.props.value) === null || _a === void 0 ? void 0 : _a.subtract(1, this.state.currentInfo.info.unit)) !== null && _b !== void 0 ? _b : null;
291
+ (_d = (_c = this.props).onChange) === null || _d === void 0 ? void 0 : _d.call(_c, duration);
292
+ const value = formatDuration(duration, this.props.mask);
293
+ this.setState({
294
+ value: value,
295
+ selectionStart: (_f = (_e = this.inputRef.current) === null || _e === void 0 ? void 0 : _e.input.selectionStart) !== null && _f !== void 0 ? _f : null,
296
+ selectionEnd: (_h = (_g = this.inputRef.current) === null || _g === void 0 ? void 0 : _g.input.selectionEnd) !== null && _h !== void 0 ? _h : null
297
+ });
283
298
  }
284
- (_e = this.inputRef.current) === null || _e === void 0 ? void 0 : _e.focus();
299
+ (_j = this.inputRef.current) === null || _j === void 0 ? void 0 : _j.focus();
285
300
  }
286
301
  get input() {
287
302
  var _a;
@@ -336,6 +351,8 @@ export default class DurationInput extends React.Component {
336
351
  valid: isDuration(value.time),
337
352
  currentInfo: value,
338
353
  value: event.target.value,
354
+ selectionStart: event.target.selectionStart,
355
+ selectionEnd: event.target.selectionEnd
339
356
  });
340
357
  } })),
341
358
  !predefinedValues && !disabled &&
@@ -1 +1 @@
1
- {"version":3,"file":"durationInput.js","sourceRoot":"","sources":["../../../../components/date/durationInput.tsx"],"names":[],"mappings":";;;;;;;;;;;AAAA,OAAO,KAAkC,MAAM,OAAO,CAAC;AACvD,OAAO,WAAW,MAAM,uCAAuC,CA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C,gBAAgB;KAC5C,CAAC,CAAA;AACN,CAAC;AAED,SAAS,eAAe,CAAC,IAAY,EAAE,OAAe;IAClD,IAAI,OAAO,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC;QACxB,MAAM,EAAE,GAAG,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;QAChC,MAAM,IAAI,GAAG,iBAAiB,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,CAAC;QAE/D,IAAI,IAAI,EAAE,CAAC;YACP,MAAM,KAAK,GAAe;gBACtB,MAAM,EAAE,CAAC;gBACT,KAAK,EAAE,CAAC;gBACR,SAAS,EAAE,IAAI;aAClB,CAAA;YAED,KAAK,IAAI,CAAC,GAAG,OAAO,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;gBAC7C,MAAM,CAAC,GAAG,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;gBAEzB,IAAI,CAAC,KAAK,EAAE,EAAE,CAAC;oBACX,KAAK,CAAC,MAAM,EAAE,CAAC;gBACnB,CAAC;qBAAM,CAAC;oBACJ,MAAM;gBACV,CAAC;YACL,CAAC;YAED,OAAO,KAAK,CAAC;QACjB,CAAC;IACL,CAAC;IAED,OAAO,SAAS,CAAC;AACrB,CAAC","sourcesContent":["import React, {HTMLAttributes, RefObject} from \"react\";\r\nimport MaskedInput from \"d2coreui/components/input/maskedInput\";\r\nimport dayjs, {isDuration, ManipulateType} from \"dayjs\";\r\nimport {Duration} from \"d2core/dayjs/duration\";\r\nimport {LocaleHolder} from \"d2core/i18n/localeHolder\";\r\nimport {AutoComplete} from \"antd\";\r\nimport DropdownArrow from \"../icons/dropdownArrow\";\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 &.input-number {\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 .handler-wrap {\r\n position: absolute;\r\n top: 0;\r\n right: 0;\r\n width: 22px;\r\n height: 100%;\r\n background: ${token.colorBgContainer};\r\n border-inline-start: ${token.lineWidth}px ${token.lineType} ${token.colorBorder};\r\n border-radius: 0 ${token.borderRadius}px ${token.borderRadius}px 0;\r\n display: flex;\r\n flex-direction: column;\r\n opacity: 0;\r\n transition: opacity ${token.motionDurationMid};\r\n\r\n .number-handler {\r\n display: flex;\r\n align-items: center;\r\n justify-content: center;\r\n flex: 1;\r\n width: 100%;\r\n height: 50%;\r\n overflow: hidden;\r\n color: ${token.colorTextDescription};\r\n line-height: 1;\r\n user-select: none;\r\n transition: all ${token.motionDurationMid};\r\n cursor: pointer;\r\n border-inline-start: ${token.lineWidth}px ${token.lineType} transparent;\r\n\r\n &:hover:not(&-up-disabled):not(&-down-disabled) {\r\n flex: 1.5; /* This button grows */\r\n color: ${token.colorPrimary};\r\n background: ${token.colorFillAlter};\r\n }\r\n \r\n &:hover {\r\n color: ${token.colorPrimary};\r\n }\r\n\r\n &:active {\r\n background: ${token.colorFillAlter};\r\n }\r\n\r\n .anticon {\r\n display: inline-block;\r\n font-size: 7px;\r\n }\r\n }\r\n\r\n .number-handler-up {\r\n border-top-right-radius: ${token.borderRadius}px;\r\n }\r\n\r\n .number-handler-down {\r\n border-top: ${token.lineWidth}px ${token.lineType} ${token.colorBorder};\r\n border-bottom-right-radius: ${token.borderRadius}px;\r\n }\r\n\r\n .number-handler-up-disabled,\r\n .number-handler-down-disabled {\r\n cursor: not-allowed;\r\n color: ${token.colorTextDisabled};\r\n\r\n &:hover {\r\n color: ${token.colorTextDisabled};\r\n }\r\n }\r\n }\r\n\r\n &:hover .handler-wrap {\r\n opacity: 1;\r\n }\r\n }\r\n `,\r\n\r\n // Specific to the UP handler\r\n handlerUp: css`\r\n border-top-right-radius: ${token.borderRadius}px;\r\n \r\n /* The line between UP and DOWN */\r\n border-bottom: ${token.lineWidth}px ${token.lineType} ${token.colorBorder};\r\n `,\r\n\r\n // Specific to the DOWN handler\r\n handlerDown: css`\r\n border-bottom-right-radius: ${token.borderRadius}px;\r\n `,\r\n\r\n // Icon container\r\n handlerIcon: css`\r\n display: inline-block;\r\n font-style: normal;\r\n line-height: 0;\r\n text-transform: none;\r\n `\r\n }\r\n})\r\n\r\ninterface DurationInputProps extends Omit<HTMLAttributes<HTMLDivElement>, \"onChange\"> {\r\n mask: string\r\n value: Duration | null\r\n onChange?: (time: Duration | null) => void\r\n predefinedValues?: { key: string, value: string }[]\r\n disabled?: boolean\r\n inputStyle?: React.CSSProperties\r\n autoFocus?: boolean\r\n size?: SizeType;\r\n}\r\n\r\ninterface DurationInputState {\r\n valid: boolean\r\n selectionStart: number | null\r\n selectionEnd: number | null\r\n currentInfo: MaskResult\r\n opened: boolean\r\n value: string\r\n}\r\n\r\ninterface MaskResult {\r\n time?: Duration\r\n info?: InfoEntry\r\n infoFromMask?: EntryValue[]\r\n length: number\r\n}\r\n\r\ninterface InfoEntry {\r\n key: string\r\n min: number\r\n max: number\r\n minLen: number\r\n maxLen: number\r\n mult: number\r\n unit: ManipulateType\r\n}\r\n\r\ninterface EntryValue {\r\n length: number\r\n infoEntry: InfoEntry\r\n value: number\r\n}\r\n\r\nconst DURATION_DATA_MAP: InfoEntry[] = [\r\n {key: \"SSS\", min: 0, max: 999, minLen: 3, maxLen: 3, mult: 1, unit: \"ms\"},\r\n {key: \"s\", min: 0, max: 59, minLen: 1, maxLen: 2, mult: 1000, unit: \"s\"},\r\n {key: \"m\", min: 0, max: 59, minLen: 1, maxLen: 2, mult: 60 * 1000, unit: \"m\"},\r\n {key: \"H\", min: 0, max: 23, minLen: 1, maxLen: 2, mult: 60 * 60 * 1000, unit: \"h\"},\r\n {key: \"D\", min: 0, max: 24854, minLen: 1, maxLen: 5, mult: 24 * 60 * 60 * 1000, unit: \"d\"},\r\n];\r\n\r\nexport const MAX_VALID_DURATION = 24854 * 24 * 60 * 60 * 1000 + 23 * 60 * 60 * 1000 + 59 * 60 * 1000 + 59 * 1000 + 499;\r\n\r\nexport function parseDuration(value: string, mask: string, cursorPos?: number, maskResult?: MaskResult): Duration | null {\r\n let result: Duration = dayjs.duration(0);\r\n const clearMaskResult = () => {\r\n if (maskResult) {\r\n maskResult.info = undefined;\r\n maskResult.length = 0;\r\n maskResult.infoFromMask = undefined;\r\n maskResult.time = undefined;\r\n }\r\n }\r\n let maskPos: number = 0;\r\n let valPos: number;\r\n\r\n for (valPos = 0; valPos < value.length; valPos++) {\r\n const c: string = value.charAt(valPos);\r\n\r\n if (['D', 'H', 'm', 's', 'S'].includes(mask.charAt(maskPos))) { // je to maska\r\n if (/\\d/.test(c)) {\r\n const entry: EntryValue | undefined = getInfoFromMask(mask, maskPos);\r\n\r\n if (entry) {\r\n let str = c;\r\n\r\n while (/\\d/.test(value.charAt(valPos + 1))) {\r\n valPos++;\r\n str += value.charAt(valPos);\r\n }\r\n\r\n if (str.length !== entry.length) {\r\n clearMaskResult();\r\n return null;\r\n }\r\n\r\n const time: number = parseInt(str);\r\n\r\n result = result.add(dayjs.duration(time, entry.infoEntry.unit));\r\n if (maskResult) {\r\n const item: EntryValue = {\r\n value: time,\r\n length: str.length,\r\n infoEntry: entry.infoEntry,\r\n }\r\n\r\n if (maskResult.infoFromMask) {\r\n maskResult.infoFromMask.push(item);\r\n } else {\r\n maskResult.infoFromMask = [item];\r\n }\r\n }\r\n maskPos += entry.length;\r\n\r\n if (cursorPos !== undefined && maskResult !== undefined && cursorPos >= valPos - str.length + 1 && cursorPos <= valPos + 1) {\r\n maskResult.info = entry.infoEntry;\r\n maskResult.length = str.length;\r\n }\r\n } else {\r\n clearMaskResult();\r\n return null;\r\n }\r\n } else {\r\n // non-numeric character when value expected\r\n clearMaskResult();\r\n return null;\r\n }\r\n } else {\r\n if (c === mask.charAt(maskPos)) {\r\n // skip special characters\r\n maskPos++;\r\n }\r\n }\r\n }\r\n\r\n if (maskPos === mask.length && valPos === value.length && result.asMilliseconds() <= MAX_VALID_DURATION) {\r\n if (maskResult !== undefined) {\r\n maskResult.time = result;\r\n }\r\n return result;\r\n }\r\n\r\n clearMaskResult();\r\n return null;\r\n}\r\n\r\nexport default class DurationInput extends React.Component<DurationInputProps, DurationInputState> {\r\n private inputRef: RefObject<MaskedInput> = React.createRef();\r\n\r\n constructor(props: Readonly<DurationInputProps>) {\r\n super(props);\r\n this.state = {\r\n valid: isDuration(props.value),\r\n selectionStart: null,\r\n selectionEnd: null,\r\n currentInfo: {\r\n info: undefined,\r\n infoFromMask: undefined,\r\n time: undefined,\r\n length: 0\r\n },\r\n opened: false,\r\n value: formatDuration(props.value, props.mask),\r\n };\r\n\r\n this.recalc = this.recalc.bind(this);\r\n this.increment = this.increment.bind(this);\r\n this.decrement = this.decrement.bind(this);\r\n }\r\n\r\n componentDidUpdate(): void {\r\n if (this.inputRef.current !== null) {\r\n this.inputRef.current.input.selectionStart = this.state.selectionStart;\r\n this.inputRef.current.input.selectionEnd = this.state.selectionEnd;\r\n }\r\n\r\n const value: string = formatDuration(this.props.value, this.props.mask);\r\n\r\n if (this.state.value !== value) {\r\n this.setState({\r\n value: value,\r\n valid: isDuration(this.props.value),\r\n });\r\n }\r\n }\r\n\r\n recalc(): void {\r\n if (this.inputRef.current !== null) {\r\n const value: MaskResult = {length: 0};\r\n parseDuration(this.inputRef.current.input.value, this.props.mask, this.inputRef.current.input.selectionStart ?? undefined, value);\r\n this.setState({\r\n currentInfo: value,\r\n selectionStart: this.inputRef.current.input.selectionStart,\r\n selectionEnd: this.inputRef.current.input.selectionEnd,\r\n });\r\n }\r\n }\r\n\r\n increment(): void {\r\n if (this.state.currentInfo.info !== undefined && checkValue(this.state.currentInfo, this.props.value, 1)) {\r\n this.props.onChange?.(this.props.value?.add(1, this.state.currentInfo.info.unit) ?? null);\r\n this.setState({selectionEnd: this.state.selectionStart});\r\n }\r\n\r\n this.inputRef.current?.focus();\r\n }\r\n\r\n decrement(): void {\r\n if (this.state.currentInfo.info !== undefined && checkValue(this.state.currentInfo, this.props.value, -1)) {\r\n this.props.onChange?.(this.props.value?.subtract(1, this.state.currentInfo.info.unit) ?? null);\r\n this.setState({selectionEnd: this.state.selectionStart});\r\n }\r\n\r\n this.inputRef.current?.focus();\r\n }\r\n\r\n get input() {\r\n return this.inputRef.current?.input;\r\n }\r\n\r\n focus() {\r\n this.inputRef.current?.focus();\r\n }\r\n\r\n render() {\r\n const {mask, value, onChange, style, disabled, predefinedValues, autoFocus, size, className, ...props} = this.props;\r\n const incrementButtonDisabled = this.state.currentInfo.info === undefined || !checkValue(this.state.currentInfo, this.props.value, 1);\r\n const decrementButtonDisabled = this.state.currentInfo.info === undefined || !checkValue(this.state.currentInfo, this.props.value, -1);\r\n\r\n return (\r\n <WithCss useStyles={useStyles}>\r\n {(context) =>\r\n <div style={style} {...props}\r\n className={(className ? className + \" \" : \"\") + (!predefinedValues ? \"input-number\" : \"\") + \" \" + context.styles.baseLayout + \" \" + (disabled ? \"disabled\" : \"\")}\r\n onKeyDown={(event) => {\r\n if (event.code === \"ArrowUp\") { // up\r\n this.increment();\r\n event.preventDefault();\r\n event.stopPropagation();\r\n } else if (event.code === \"ArrowDown\") { // down\r\n this.decrement();\r\n event.preventDefault();\r\n event.stopPropagation();\r\n }\r\n }}\r\n >\r\n <AutoComplete\r\n className={this.state.valid ? \"\" : \"invalid\"}\r\n options={this.state.opened ? predefinedValues?.map(v => {\r\n return {value: v.value, label: v.key}\r\n }) : []}\r\n defaultOpen={false}\r\n defaultActiveFirstOption={false}\r\n defaultValue={undefined}\r\n disabled={disabled}\r\n autoFocus={autoFocus}\r\n style={{width: \"100%\", height: \"inherit\"}}\r\n value={this.state.valid ? this.state.value : \"\"}\r\n onSelect={(e) => {\r\n const val: Duration = dayjs.duration(Number(e));\r\n this.setState({\r\n opened: false,\r\n valid: isDuration(val),\r\n value: formatDuration(val, this.props.mask),\r\n });\r\n onChange?.(val === undefined ? null : val);\r\n }}\r\n onBlur={() => {\r\n this.setState({opened: false});\r\n }}>\r\n <MaskedInput mask={this.props.mask.replace(/[a-zA-Z]/g, '1')}\r\n ref={this.inputRef}\r\n style={{\r\n border: predefinedValues ? undefined : \"none\",\r\n ...this.props.inputStyle\r\n }}\r\n size={size}\r\n placeholder={this.props.mask.replace(/[a-zA-Z]/g, '_')}\r\n autoFocus={autoFocus}\r\n onFocus={(event => {\r\n event.target.selectionStart = event.target.selectionEnd = this.state.selectionStart;\r\n })}\r\n suffix={\r\n this.props.predefinedValues !== undefined && this.props.predefinedValues.length > 0 &&\r\n <DropdownArrow opened={this.state.opened}\r\n onClick={() => {\r\n if (!this.props.disabled) {\r\n this.setState({opened: !this.state.opened});\r\n }\r\n }}/>\r\n }\r\n onMouseUp={this.recalc}\r\n onKeyUp={this.recalc}\r\n onChange={(event) => {\r\n const value: MaskResult = {length: 0};\r\n parseDuration(event.target.value, this.props.mask, event.target.selectionStart ?? undefined, value);\r\n onChange?.(value.time === undefined ? null : value.time);\r\n this.setState({\r\n valid: isDuration(value.time),\r\n currentInfo: value,\r\n value: event.target.value,\r\n });\r\n }}\r\n />\r\n </AutoComplete>\r\n {!predefinedValues && !disabled &&\r\n <div className=\"handler-wrap\">\r\n <span onClick={this.increment}\r\n className={`number-handler number-handler-up ${incrementButtonDisabled ? \"number-handler-up-disabled\" : \"\"}`}>\r\n <span className=\"anticon anticon-up number-handler-up-inner\">\r\n <svg viewBox=\"64 64 896 896\" focusable=\"false\" data-icon=\"up\" width=\"1em\" height=\"1em\" fill=\"currentColor\" aria-hidden=\"true\">\r\n <path\r\n 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\"></path>\r\n </svg>\r\n </span>\r\n </span>\r\n <span onClick={this.decrement}\r\n className={`number-handler number-handler-down ${decrementButtonDisabled ? \"number-handler-down-disabled\" : \"\"}`}>\r\n <span className=\"anticon anticon-down number-handler-down-inner\">\r\n <svg viewBox=\"64 64 896 896\" focusable=\"false\" data-icon=\"down\" width=\"1em\" height=\"1em\" fill=\"currentColor\" aria-hidden=\"true\">\r\n <path\r\n 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\"></path>\r\n </svg>\r\n </span>\r\n </span>\r\n </div>\r\n }\r\n </div>\r\n }\r\n </WithCss>\r\n );\r\n }\r\n}\r\n\r\nfunction checkValue(info: MaskResult, value: Duration | null, offset = 0): boolean {\r\n const currentMillis = value ? value.add(offset, info.info?.unit).asMilliseconds() : 0;\r\n const maxValues = info?.infoFromMask ? info.infoFromMask.map((i) => (i.length !== i.infoEntry.maxLen ? (Math.pow(10, i.length) - 1) : i.infoEntry.max) * i.infoEntry.mult) : [];\r\n const maxMaskedValue = info?.infoFromMask ? maxValues.reduce((p, n) => p + n, 0) : 0;\r\n return !!value && currentMillis >= 0 && currentMillis <= MAX_VALID_DURATION && currentMillis <= maxMaskedValue;\r\n}\r\n\r\nfunction formatDuration(value: Duration | null, mask: string): string {\r\n //@ts-ignore\r\n return (isDuration(value) ? value : dayjs.duration(0)).locale(\"locale.d2000\").format(mask, {\r\n trim: false,\r\n decimalSeparator: LocaleHolder.decimalSeparator,\r\n useGrouping: false,\r\n groupingSeparator: \"\",\r\n userLocale: LocaleHolder.formattingLocale\r\n })\r\n}\r\n\r\nfunction getInfoFromMask(mask: string, fromPos: number): EntryValue | undefined {\r\n if (fromPos < mask.length) {\r\n const ch = mask.charAt(fromPos);\r\n const info = DURATION_DATA_MAP.find((d) => d.key.includes(ch));\r\n\r\n if (info) {\r\n const entry: EntryValue = {\r\n length: 1,\r\n value: 0,\r\n infoEntry: info,\r\n }\r\n\r\n for (let i = fromPos + 1; i < mask.length; i++) {\r\n const c = mask.charAt(i);\r\n\r\n if (c === ch) {\r\n entry.length++;\r\n } else {\r\n break;\r\n }\r\n }\r\n\r\n return entry;\r\n }\r\n }\r\n\r\n return undefined;\r\n}"]}
1
+ {"version":3,"file":"durationInput.js","sourceRoot":"","sources":["../../../../components/date/durationInput.tsx"],"names":[],"mappings":";;;;;;;;;;;AAAA,OAAO,KAAkC,MAAM,OAAO,CAAC;AACvD,OAAO,WAAW,MAAM,uCAAuC,CAAC;AAChE,OAAO,KAAK,EAAE,EAAC,UAAU,EAAiB,MAAM,OAAO,CAAC;AAExD,OAAO,EAAC,YAAY,EAAC,MAAM,0BAA0B,CAAC;AACtD,OAAO,EAAC,YAAY,EAAC,MAAM,MAAM,CAAC;AAClC,OAAO,aAAa,MAAM,wBAAwB,CAAC;AAEnD,OAAO,OAAO,MAAM,kBAAkB,CAAC;AACvC,OAAO,EAAC,YAAY,EAAC,MAAM,YAAY,CAAC;AAExC,MAAM,SAAS,GAAG,YAAY,CAAC,CAAC,EAAC,KAAK,EAAE,GAAG,EAAC,EAAE,EAAE;IAC5C,OAAO;QACH,UAAU,EAAE,GAAG,CAAA;;;;;0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C;qBAAM,CAAC;oBACJ,MAAM;gBACV,CAAC;YACL,CAAC;YAED,OAAO,KAAK,CAAC;QACjB,CAAC;IACL,CAAC;IAED,OAAO,SAAS,CAAC;AACrB,CAAC","sourcesContent":["import React, {HTMLAttributes, RefObject} from \"react\";\r\nimport MaskedInput from \"d2coreui/components/input/maskedInput\";\r\nimport dayjs, {isDuration, ManipulateType} from \"dayjs\";\r\nimport {Duration} from \"d2core/dayjs/duration\";\r\nimport {LocaleHolder} from \"d2core/i18n/localeHolder\";\r\nimport {AutoComplete} from \"antd\";\r\nimport DropdownArrow from \"../icons/dropdownArrow\";\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 &.input-number {\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 .handler-wrap {\r\n position: absolute;\r\n top: 0;\r\n right: 0;\r\n width: 22px;\r\n height: 100%;\r\n background: ${token.colorBgContainer};\r\n border-inline-start: ${token.lineWidth}px ${token.lineType} ${token.colorBorder};\r\n border-radius: 0 ${token.borderRadius}px ${token.borderRadius}px 0;\r\n display: flex;\r\n flex-direction: column;\r\n opacity: 0;\r\n transition: opacity ${token.motionDurationMid};\r\n\r\n .number-handler {\r\n display: flex;\r\n align-items: center;\r\n justify-content: center;\r\n flex: 1;\r\n width: 100%;\r\n height: 50%;\r\n overflow: hidden;\r\n color: ${token.colorTextDescription};\r\n line-height: 1;\r\n user-select: none;\r\n transition: all ${token.motionDurationMid};\r\n cursor: pointer;\r\n border-inline-start: ${token.lineWidth}px ${token.lineType} transparent;\r\n\r\n &:hover:not(&-up-disabled):not(&-down-disabled) {\r\n flex: 1.5; /* This button grows */\r\n color: ${token.colorPrimary};\r\n background: ${token.colorFillAlter};\r\n }\r\n \r\n &:hover {\r\n color: ${token.colorPrimary};\r\n }\r\n\r\n &:active {\r\n background: ${token.colorFillAlter};\r\n }\r\n\r\n .anticon {\r\n display: inline-block;\r\n font-size: 7px;\r\n }\r\n }\r\n\r\n .number-handler-up {\r\n border-top-right-radius: ${token.borderRadius}px;\r\n }\r\n\r\n .number-handler-down {\r\n border-top: ${token.lineWidth}px ${token.lineType} ${token.colorBorder};\r\n border-bottom-right-radius: ${token.borderRadius}px;\r\n }\r\n\r\n .number-handler-up-disabled,\r\n .number-handler-down-disabled {\r\n cursor: not-allowed;\r\n color: ${token.colorTextDisabled};\r\n\r\n &:hover {\r\n color: ${token.colorTextDisabled};\r\n }\r\n }\r\n }\r\n\r\n &:hover .handler-wrap {\r\n opacity: 1;\r\n }\r\n }\r\n `,\r\n\r\n // Specific to the UP handler\r\n handlerUp: css`\r\n border-top-right-radius: ${token.borderRadius}px;\r\n \r\n /* The line between UP and DOWN */\r\n border-bottom: ${token.lineWidth}px ${token.lineType} ${token.colorBorder};\r\n `,\r\n\r\n // Specific to the DOWN handler\r\n handlerDown: css`\r\n border-bottom-right-radius: ${token.borderRadius}px;\r\n `,\r\n\r\n // Icon container\r\n handlerIcon: css`\r\n display: inline-block;\r\n font-style: normal;\r\n line-height: 0;\r\n text-transform: none;\r\n `\r\n }\r\n})\r\n\r\ninterface DurationInputProps extends Omit<HTMLAttributes<HTMLDivElement>, \"onChange\"> {\r\n mask: string\r\n value: Duration | null\r\n onChange?: (time: Duration | null) => void\r\n predefinedValues?: { key: string, value: string }[]\r\n disabled?: boolean\r\n inputStyle?: React.CSSProperties\r\n autoFocus?: boolean\r\n size?: SizeType;\r\n}\r\n\r\ninterface DurationInputState {\r\n valid: boolean\r\n selectionStart: number | null\r\n selectionEnd: number | null\r\n currentInfo: MaskResult\r\n opened: boolean\r\n value: string\r\n}\r\n\r\ninterface MaskResult {\r\n time?: Duration\r\n info?: InfoEntry\r\n infoFromMask?: EntryValue[]\r\n length: number\r\n}\r\n\r\ninterface InfoEntry {\r\n key: string\r\n min: number\r\n max: number\r\n minLen: number\r\n maxLen: number\r\n mult: number\r\n unit: ManipulateType\r\n}\r\n\r\ninterface EntryValue {\r\n length: number\r\n infoEntry: InfoEntry\r\n value: number\r\n}\r\n\r\nconst DURATION_DATA_MAP: InfoEntry[] = [\r\n {key: \"SSS\", min: 0, max: 999, minLen: 3, maxLen: 3, mult: 1, unit: \"ms\"},\r\n {key: \"s\", min: 0, max: 59, minLen: 1, maxLen: 2, mult: 1000, unit: \"s\"},\r\n {key: \"m\", min: 0, max: 59, minLen: 1, maxLen: 2, mult: 60 * 1000, unit: \"m\"},\r\n {key: \"H\", min: 0, max: 23, minLen: 1, maxLen: 2, mult: 60 * 60 * 1000, unit: \"h\"},\r\n {key: \"D\", min: 0, max: 24854, minLen: 1, maxLen: 5, mult: 24 * 60 * 60 * 1000, unit: \"d\"},\r\n];\r\n\r\nexport const MAX_VALID_DURATION = 24854 * 24 * 60 * 60 * 1000 + 23 * 60 * 60 * 1000 + 59 * 60 * 1000 + 59 * 1000 + 499;\r\n\r\nexport function parseDuration(value: string, mask: string, cursorPos?: number, maskResult?: MaskResult): Duration | null {\r\n let result: Duration = dayjs.duration(0);\r\n const clearMaskResult = () => {\r\n if (maskResult) {\r\n maskResult.info = undefined;\r\n maskResult.length = 0;\r\n maskResult.infoFromMask = undefined;\r\n maskResult.time = undefined;\r\n }\r\n }\r\n let maskPos: number = 0;\r\n let valPos: number;\r\n\r\n for (valPos = 0; valPos < value.length; valPos++) {\r\n const c: string = value.charAt(valPos);\r\n\r\n if (['D', 'H', 'm', 's', 'S'].includes(mask.charAt(maskPos))) { // je to maska\r\n if (/\\d/.test(c)) {\r\n const entry: EntryValue | undefined = getInfoFromMask(mask, maskPos);\r\n\r\n if (entry) {\r\n let str = c;\r\n\r\n while (/\\d/.test(value.charAt(valPos + 1))) {\r\n valPos++;\r\n str += value.charAt(valPos);\r\n }\r\n\r\n if (str.length !== entry.length) {\r\n clearMaskResult();\r\n return null;\r\n }\r\n\r\n const time: number = parseInt(str);\r\n\r\n result = result.add(dayjs.duration(time, entry.infoEntry.unit));\r\n if (maskResult) {\r\n const item: EntryValue = {\r\n value: time,\r\n length: str.length,\r\n infoEntry: entry.infoEntry,\r\n }\r\n\r\n if (maskResult.infoFromMask) {\r\n maskResult.infoFromMask.push(item);\r\n } else {\r\n maskResult.infoFromMask = [item];\r\n }\r\n }\r\n maskPos += entry.length;\r\n\r\n if (cursorPos !== undefined && maskResult !== undefined && cursorPos >= valPos - str.length + 1 && cursorPos <= valPos + 1) {\r\n maskResult.info = entry.infoEntry;\r\n maskResult.length = str.length;\r\n }\r\n } else {\r\n clearMaskResult();\r\n return null;\r\n }\r\n } else {\r\n // non-numeric character when value expected\r\n clearMaskResult();\r\n return null;\r\n }\r\n } else {\r\n if (c === mask.charAt(maskPos)) {\r\n // skip special characters\r\n maskPos++;\r\n }\r\n }\r\n }\r\n\r\n if (maskPos === mask.length && valPos === value.length && result.asMilliseconds() <= MAX_VALID_DURATION) {\r\n if (maskResult !== undefined) {\r\n maskResult.time = result;\r\n }\r\n return result;\r\n }\r\n\r\n clearMaskResult();\r\n return null;\r\n}\r\n\r\nexport default class DurationInput extends React.Component<DurationInputProps, DurationInputState> {\r\n private inputRef: RefObject<MaskedInput> = React.createRef();\r\n\r\n constructor(props: Readonly<DurationInputProps>) {\r\n super(props);\r\n this.state = {\r\n valid: isDuration(props.value),\r\n selectionStart: null,\r\n selectionEnd: null,\r\n currentInfo: {\r\n info: undefined,\r\n infoFromMask: undefined,\r\n time: undefined,\r\n length: 0\r\n },\r\n opened: false,\r\n value: formatDuration(props.value, props.mask),\r\n };\r\n\r\n this.recalc = this.recalc.bind(this);\r\n this.increment = this.increment.bind(this);\r\n this.decrement = this.decrement.bind(this);\r\n }\r\n\r\n componentDidUpdate(prevProps: Readonly<DurationInputProps>, _prevState: Readonly<DurationInputState>): void {\r\n if (this.inputRef.current !== null) {\r\n this.inputRef.current.input.selectionStart = this.state.selectionStart;\r\n this.inputRef.current.input.selectionEnd = this.state.selectionEnd;\r\n }\r\n\r\n if (prevProps.value?.asMilliseconds() !== this.props.value?.asMilliseconds()) {\r\n const value: string = formatDuration(this.props.value, this.props.mask);\r\n\r\n if (this.state.value !== value) {\r\n this.setState({\r\n value: value,\r\n valid: isDuration(this.props.value),\r\n });\r\n }\r\n }\r\n }\r\n\r\n recalc(): void {\r\n if (this.inputRef.current !== null) {\r\n const value: MaskResult = {length: 0};\r\n parseDuration(this.inputRef.current.input.value, this.props.mask, this.inputRef.current.input.selectionStart ?? undefined, value);\r\n this.setState({\r\n currentInfo: value,\r\n selectionStart: this.inputRef.current.input.selectionStart,\r\n selectionEnd: this.inputRef.current.input.selectionEnd,\r\n });\r\n }\r\n }\r\n\r\n increment(): void {\r\n if (this.state.currentInfo.info !== undefined && checkValue(this.state.currentInfo, this.props.value, 1)) {\r\n const duration = this.props.value?.add(1, this.state.currentInfo.info.unit) ?? null;\r\n\r\n this.props.onChange?.(duration);\r\n const value: string = formatDuration(duration, this.props.mask);\r\n\r\n this.setState({\r\n value: value,\r\n selectionStart: this.inputRef.current?.input.selectionStart ?? null,\r\n selectionEnd: this.inputRef.current?.input.selectionEnd ?? null\r\n });\r\n }\r\n\r\n this.inputRef.current?.focus();\r\n }\r\n\r\n decrement(): void {\r\n if (this.state.currentInfo.info !== undefined && checkValue(this.state.currentInfo, this.props.value, -1)) {\r\n const duration = this.props.value?.subtract(1, this.state.currentInfo.info.unit) ?? null;\r\n\r\n this.props.onChange?.(duration);\r\n const value: string = formatDuration(duration, this.props.mask);\r\n\r\n this.setState({\r\n value: value,\r\n selectionStart: this.inputRef.current?.input.selectionStart ?? null,\r\n selectionEnd: this.inputRef.current?.input.selectionEnd ?? null\r\n });\r\n }\r\n\r\n this.inputRef.current?.focus();\r\n }\r\n\r\n get input() {\r\n return this.inputRef.current?.input;\r\n }\r\n\r\n focus() {\r\n this.inputRef.current?.focus();\r\n }\r\n\r\n render() {\r\n const {mask, value, onChange, style, disabled, predefinedValues, autoFocus, size, className, ...props} = this.props;\r\n const incrementButtonDisabled = this.state.currentInfo.info === undefined || !checkValue(this.state.currentInfo, this.props.value, 1);\r\n const decrementButtonDisabled = this.state.currentInfo.info === undefined || !checkValue(this.state.currentInfo, this.props.value, -1);\r\n\r\n return (\r\n <WithCss useStyles={useStyles}>\r\n {(context) =>\r\n <div style={style} {...props}\r\n className={(className ? className + \" \" : \"\") + (!predefinedValues ? \"input-number\" : \"\") + \" \" + context.styles.baseLayout + \" \" + (disabled ? \"disabled\" : \"\")}\r\n onKeyDown={(event) => {\r\n if (event.code === \"ArrowUp\") { // up\r\n this.increment();\r\n event.preventDefault();\r\n event.stopPropagation();\r\n } else if (event.code === \"ArrowDown\") { // down\r\n this.decrement();\r\n event.preventDefault();\r\n event.stopPropagation();\r\n }\r\n }}\r\n >\r\n <AutoComplete\r\n className={this.state.valid ? \"\" : \"invalid\"}\r\n options={this.state.opened ? predefinedValues?.map(v => {\r\n return {value: v.value, label: v.key}\r\n }) : []}\r\n defaultOpen={false}\r\n defaultActiveFirstOption={false}\r\n defaultValue={undefined}\r\n disabled={disabled}\r\n autoFocus={autoFocus}\r\n style={{width: \"100%\", height: \"inherit\"}}\r\n value={this.state.valid ? this.state.value : \"\"}\r\n onSelect={(e) => {\r\n const val: Duration = dayjs.duration(Number(e));\r\n this.setState({\r\n opened: false,\r\n valid: isDuration(val),\r\n value: formatDuration(val, this.props.mask),\r\n });\r\n onChange?.(val === undefined ? null : val);\r\n }}\r\n onBlur={() => {\r\n this.setState({opened: false});\r\n }}>\r\n <MaskedInput mask={this.props.mask.replace(/[a-zA-Z]/g, '1')}\r\n ref={this.inputRef}\r\n style={{\r\n border: predefinedValues ? undefined : \"none\",\r\n ...this.props.inputStyle\r\n }}\r\n size={size}\r\n placeholder={this.props.mask.replace(/[a-zA-Z]/g, '_')}\r\n autoFocus={autoFocus}\r\n onFocus={(event => {\r\n event.target.selectionStart = event.target.selectionEnd = this.state.selectionStart;\r\n })}\r\n suffix={\r\n this.props.predefinedValues !== undefined && this.props.predefinedValues.length > 0 &&\r\n <DropdownArrow opened={this.state.opened}\r\n onClick={() => {\r\n if (!this.props.disabled) {\r\n this.setState({opened: !this.state.opened});\r\n }\r\n }}/>\r\n }\r\n onMouseUp={this.recalc}\r\n onKeyUp={this.recalc}\r\n onChange={(event) => {\r\n const value: MaskResult = {length: 0};\r\n parseDuration(event.target.value, this.props.mask, event.target.selectionStart ?? undefined, value);\r\n onChange?.(value.time === undefined ? null : value.time);\r\n this.setState({\r\n valid: isDuration(value.time),\r\n currentInfo: value,\r\n value: event.target.value,\r\n selectionStart: event.target.selectionStart,\r\n selectionEnd: event.target.selectionEnd\r\n });\r\n }}\r\n />\r\n </AutoComplete>\r\n {!predefinedValues && !disabled &&\r\n <div className=\"handler-wrap\">\r\n <span onClick={this.increment}\r\n className={`number-handler number-handler-up ${incrementButtonDisabled ? \"number-handler-up-disabled\" : \"\"}`}>\r\n <span className=\"anticon anticon-up number-handler-up-inner\">\r\n <svg viewBox=\"64 64 896 896\" focusable=\"false\" data-icon=\"up\" width=\"1em\" height=\"1em\" fill=\"currentColor\" aria-hidden=\"true\">\r\n <path\r\n 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\"></path>\r\n </svg>\r\n </span>\r\n </span>\r\n <span onClick={this.decrement}\r\n className={`number-handler number-handler-down ${decrementButtonDisabled ? \"number-handler-down-disabled\" : \"\"}`}>\r\n <span className=\"anticon anticon-down number-handler-down-inner\">\r\n <svg viewBox=\"64 64 896 896\" focusable=\"false\" data-icon=\"down\" width=\"1em\" height=\"1em\" fill=\"currentColor\" aria-hidden=\"true\">\r\n <path\r\n 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\"></path>\r\n </svg>\r\n </span>\r\n </span>\r\n </div>\r\n }\r\n </div>\r\n }\r\n </WithCss>\r\n );\r\n }\r\n}\r\n\r\nfunction checkValue(info: MaskResult, value: Duration | null, offset = 0): boolean {\r\n const currentMillis = value ? value.add(offset, info.info?.unit).asMilliseconds() : 0;\r\n const maxValues = info?.infoFromMask ? info.infoFromMask.map((i) => (i.length !== i.infoEntry.maxLen ? (Math.pow(10, i.length) - 1) : i.infoEntry.max) * i.infoEntry.mult) : [];\r\n const maxMaskedValue = info?.infoFromMask ? maxValues.reduce((p, n) => p + n, 0) : 0;\r\n return !!value && currentMillis >= 0 && currentMillis <= MAX_VALID_DURATION && currentMillis <= maxMaskedValue;\r\n}\r\n\r\nfunction formatDuration(value: Duration | null, mask: string): string {\r\n //@ts-ignore\r\n return (isDuration(value) ? value : dayjs.duration(0)).locale(\"locale.d2000\").format(mask, {\r\n trim: false,\r\n decimalSeparator: LocaleHolder.decimalSeparator,\r\n useGrouping: false,\r\n groupingSeparator: \"\",\r\n userLocale: LocaleHolder.formattingLocale\r\n })\r\n}\r\n\r\nfunction getInfoFromMask(mask: string, fromPos: number): EntryValue | undefined {\r\n if (fromPos < mask.length) {\r\n const ch = mask.charAt(fromPos);\r\n const info = DURATION_DATA_MAP.find((d) => d.key.includes(ch));\r\n\r\n if (info) {\r\n const entry: EntryValue = {\r\n length: 1,\r\n value: 0,\r\n infoEntry: info,\r\n }\r\n\r\n for (let i = fromPos + 1; i < mask.length; i++) {\r\n const c = mask.charAt(i);\r\n\r\n if (c === ch) {\r\n entry.length++;\r\n } else {\r\n break;\r\n }\r\n }\r\n\r\n return entry;\r\n }\r\n }\r\n\r\n return undefined;\r\n}"]}
@@ -799,10 +799,10 @@ export class RangeSelector extends BeanStub {
799
799
  return isRowNumberCol(currentColumn);
800
800
  }
801
801
  dispatchChangedEvent(started, finished, id) {
802
+ const allNodesToBeSelected = [];
802
803
  this.cellRanges.map((cellRange) => {
803
804
  let currentRow = this.getRangeStartRow(cellRange);
804
805
  const lastRow = this.getRangeEndRow(cellRange);
805
- const nodesToBeSelected = [];
806
806
  while (true) {
807
807
  const finishedAllRows = _missing(currentRow) || !currentRow || this.before(lastRow, currentRow);
808
808
  if (finishedAllRows || !currentRow || !cellRange.columns) {
@@ -810,19 +810,20 @@ export class RangeSelector extends BeanStub {
810
810
  }
811
811
  const rowNode = _getRowNode(this.beans, currentRow);
812
812
  if (!rowNode) {
813
+ currentRow = _getRowBelow(this.beans, currentRow);
813
814
  break;
814
815
  }
815
816
  if (!rowNode.isSelected()) {
816
817
  rowNode.setSelected(true);
817
818
  }
818
- nodesToBeSelected.push(rowNode.data);
819
+ allNodesToBeSelected.push(rowNode.data);
819
820
  currentRow = _getRowBelow(this.beans, currentRow);
820
821
  }
821
- this.gridApi.getSelectedNodes().forEach((node) => {
822
- if (!nodesToBeSelected.some(nodeToBeSelected => node.data === nodeToBeSelected)) {
823
- node.setSelected(false);
824
- }
825
- });
822
+ });
823
+ this.gridApi.getSelectedNodes().forEach((node) => {
824
+ if (!allNodesToBeSelected.some((nodeToBeSelected) => node.data === nodeToBeSelected)) {
825
+ node.setSelected(false);
826
+ }
826
827
  });
827
828
  this.eventSvc.dispatchEvent({
828
829
  type: 'cellSelectionChanged',