d2coreui 23.0.56 → 23.0.57
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/CHANGELOG.md +29 -0
- package/components/date/dateRangeInputAdvancedPanel.js +19 -19
- package/components/date/dateRangeInputAdvancedPanel.js.map +1 -1
- package/components/date/dateTimeInput.d.ts +12 -3
- package/components/date/dateTimeInput.js +133 -72
- package/components/date/dateTimeInput.js.map +1 -1
- package/components/grid/config/dataGridEditor.d.ts +4 -3
- package/components/grid/config/dataGridEditor.js +16 -4
- package/components/grid/config/dataGridEditor.js.map +1 -1
- package/components/grid/dataGrid.d.ts +19 -5
- package/components/grid/dataGrid.js +9 -5
- package/components/grid/dataGrid.js.map +1 -1
- package/components/grid/export/contextMenu.d.ts +3 -2
- package/components/grid/export/contextMenu.js.map +1 -1
- package/components/grid/extendedDataGrid.d.ts +11 -4
- package/components/grid/extendedDataGrid.js +34 -24
- package/components/grid/extendedDataGrid.js.map +1 -1
- package/components/modal/impl/draggableModalInner.js +22 -10
- package/components/modal/impl/draggableModalInner.js.map +1 -1
- package/components/modal/impl/draggableModalReducer.d.ts +2 -3
- package/components/modal/impl/draggableModalReducer.js +9 -7
- package/components/modal/impl/draggableModalReducer.js.map +1 -1
- package/components/modal/modalDialog.d.ts +2 -1
- package/components/modal/modalDialog.js +2 -1
- package/components/modal/modalDialog.js.map +1 -1
- package/i18n/components.cs.json +2 -0
- package/i18n/components.sk.json +2 -0
- package/i18n/components.uk.json +2 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,34 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 23.0.57
|
|
4
|
+
|
|
5
|
+
- `DateTimeInput` / `DateRangeInput`: `autoWidth` measures the right width with a theme `fontFamily` that is not a
|
|
6
|
+
valid unquoted CSS name (e.g. `"72"`); the input was too narrow and cut the value.
|
|
7
|
+
- `DateRangeInput`: in the advanced popup the begin / both / end time shift icons sit below the duration buttons,
|
|
8
|
+
so that "Now", "Hour" and "15 min" of the three columns are in one row.
|
|
9
|
+
- `DataGrid` / `ExtendedDataGrid`: the `oddRowBackgroundColor` of a `theme` passed in is applied; rows without a
|
|
10
|
+
background color from `rowStyleRules` no longer get an inline `background-color: inherit` that overrode it. The
|
|
11
|
+
default theme keeps odd rows unstriped unless the new antd token `gridOddRowBg` is set (`ConfigProvider`
|
|
12
|
+
`theme={{token: {gridOddRowBg: "#fafafa"}}}`).
|
|
13
|
+
- `ModalDialog`: a dialog opened larger than the window is shrunk to the window minus the margin a maximized dialog
|
|
14
|
+
keeps, and centred, instead of filling the window edge to edge.
|
|
15
|
+
- `ModalDialog`: a dialog kept in the DOM (`destroyOnHidden={false}`) opens on top of the modals opened since its first
|
|
16
|
+
opening, instead of under them.
|
|
17
|
+
- `DataGrid` / `ExtendedDataGrid`: changing the table configuration (column order, width, sort, …) no longer makes
|
|
18
|
+
ag-grid log `Updated property onShowUtcOffset` in development - the time format props stay out of `AgGridReact`.
|
|
19
|
+
- `DataGrid`: `onLoadData`, `defaultRowStyleRules` and the time format props no longer reach `AgGridReact`, which
|
|
20
|
+
warned about them as invalid grid options.
|
|
21
|
+
- `DataGrid` / `ExtendedDataGrid`: `showUtcOffset` takes a `UtcOffsetMode` of `d2core/i18n/localeHolder` - besides
|
|
22
|
+
`true` / `false` also `"hourLetter"` (the repeated hour at the end of the daylight saving time as `A2:00` / `B2:00`)
|
|
23
|
+
and `"offsetInFold"` (the UTC offset only in that hour); the table settings offer all four. `DataGrid` without
|
|
24
|
+
`showUtcOffset` follows the global mode of `LocaleHolder.setUtcOffsetMode`.
|
|
25
|
+
- `DateTimeInput` / `DateRangeInput`: a mask with `HH?` shows and takes the repeated hour as `A2` / `B2` - an hour
|
|
26
|
+
typed there without the letter is the second one (`B`) and a letter outside that hour is invalid; a mask with `Z?`
|
|
27
|
+
shows the UTC offset at every time, so that the input keeps its layout.
|
|
28
|
+
- `DateTimeInput` / `DateRangeInput`: a time skipped at the start of the daylight saving time (29.03. 02:30) and a day
|
|
29
|
+
that does not exist (31.02.) are invalid with any mask, instead of being silently moved to another time; the input
|
|
30
|
+
no longer keeps showing such a typed text while it holds the moved value.
|
|
31
|
+
|
|
3
32
|
## 23.0.56
|
|
4
33
|
|
|
5
34
|
- Components styled through `WithCss` (`DateTimeInput`, `DateRangeInput`, `DurationInput`, grid, pagination, …) take
|
|
@@ -6,25 +6,25 @@ import { createStyles } from "antd-style";
|
|
|
6
6
|
import WithCss from "../style/withCss";
|
|
7
7
|
const useStyles = createStyles(({ token, css }) => {
|
|
8
8
|
return {
|
|
9
|
-
panel: css `
|
|
10
|
-
color: ${token.colorTextSecondary};
|
|
9
|
+
panel: css `
|
|
10
|
+
color: ${token.colorTextSecondary};
|
|
11
11
|
`,
|
|
12
12
|
// the popup grows with a long date-time mask - the columns share the extra width, never below their content
|
|
13
|
-
columns: css `
|
|
14
|
-
display: flex;
|
|
15
|
-
align-items: flex-start;
|
|
16
|
-
gap: 24px;
|
|
17
|
-
margin-bottom: 8px;
|
|
13
|
+
columns: css `
|
|
14
|
+
display: flex;
|
|
15
|
+
align-items: flex-start;
|
|
16
|
+
gap: 24px;
|
|
17
|
+
margin-bottom: 8px;
|
|
18
18
|
`,
|
|
19
|
-
column: css `
|
|
20
|
-
flex: 1 1 0;
|
|
21
|
-
min-width: max-content;
|
|
19
|
+
column: css `
|
|
20
|
+
flex: 1 1 0;
|
|
21
|
+
min-width: max-content;
|
|
22
22
|
`,
|
|
23
|
-
timeShiftIcon: css `
|
|
24
|
-
color: ${token.colorTextSecondary};
|
|
23
|
+
timeShiftIcon: css `
|
|
24
|
+
color: ${token.colorTextSecondary};
|
|
25
25
|
`,
|
|
26
|
-
timeShiftIconChecked: css `
|
|
27
|
-
color: ${token.colorPrimary};
|
|
26
|
+
timeShiftIconChecked: css `
|
|
27
|
+
color: ${token.colorPrimary};
|
|
28
28
|
`,
|
|
29
29
|
};
|
|
30
30
|
});
|
|
@@ -122,15 +122,15 @@ export default class DateRangeInputAdvancedPanel extends React.Component {
|
|
|
122
122
|
this.renderButton(i18n("Year"), () => this.props.onBeginIntervalChange("year"))),
|
|
123
123
|
React.createElement(Space, { className: styles.column, direction: "vertical" },
|
|
124
124
|
this.renderSectionTitle(i18n("Duration and Time Shift")),
|
|
125
|
-
React.createElement("div", { style: { display: "flex", justifyContent: "center", alignItems: "center" } },
|
|
126
|
-
this.renderTimeShiftIcon("begin", styles),
|
|
127
|
-
this.renderTimeShiftIcon("both", styles),
|
|
128
|
-
this.renderTimeShiftIcon("end", styles)),
|
|
129
125
|
this.renderButtonWithTimeShift(i18n("Hour"), () => this.props.onIntervalDurationChange("hour"), (direction) => this.props.onTimeShift(timeShiftBegin, timeShiftEnd, "hour", direction)),
|
|
130
126
|
this.renderButtonWithTimeShift(i18n("Day"), () => this.props.onIntervalDurationChange("day"), (direction) => this.props.onTimeShift(timeShiftBegin, timeShiftEnd, "day", direction)),
|
|
131
127
|
this.renderButtonWithTimeShift(i18n("Week"), () => this.props.onIntervalDurationChange("week"), (direction) => this.props.onTimeShift(timeShiftBegin, timeShiftEnd, "week", direction)),
|
|
132
128
|
this.renderButtonWithTimeShift(i18n("Month"), () => this.props.onIntervalDurationChange("month"), (direction) => this.props.onTimeShift(timeShiftBegin, timeShiftEnd, "month", direction)),
|
|
133
|
-
this.renderButtonWithTimeShift(i18n("Year"), () => this.props.onIntervalDurationChange("year"), (direction) => this.props.onTimeShift(timeShiftBegin, timeShiftEnd, "year", direction))
|
|
129
|
+
this.renderButtonWithTimeShift(i18n("Year"), () => this.props.onIntervalDurationChange("year"), (direction) => this.props.onTimeShift(timeShiftBegin, timeShiftEnd, "year", direction)),
|
|
130
|
+
React.createElement("div", { style: { display: "flex", justifyContent: "center", alignItems: "center" } },
|
|
131
|
+
this.renderTimeShiftIcon("begin", styles),
|
|
132
|
+
this.renderTimeShiftIcon("both", styles),
|
|
133
|
+
this.renderTimeShiftIcon("end", styles))),
|
|
134
134
|
!this.props.compact &&
|
|
135
135
|
React.createElement(Space, { className: styles.column, direction: "vertical" },
|
|
136
136
|
this.renderSectionTitle(i18n("Interval End")),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dateRangeInputAdvancedPanel.js","sourceRoot":"","sources":["../../../../components/date/dateRangeInputAdvancedPanel.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAC,MAAM,EAAE,OAAO,EAAE,KAAK,EAAC,MAAM,MAAM,CAAC;AAC5C,OAAO,IAAI,MAAM,kBAAkB,CAAC;AAGpC,OAAO,IAAI,MAAM,sCAAsC,CAAC;AACxD,OAAO,EAAC,YAAY,EAAC,MAAM,YAAY,CAAC;AACxC,OAAO,OAAO,MAAM,kBAAkB,CAAC;AAEvC,MAAM,SAAS,GAAG,YAAY,CAAC,CAAC,EAAC,KAAK,EAAE,GAAG,EAAC,EAAE,EAAE;IAC5C,OAAO;QACH,KAAK,EAAE,GAAG,CAAA;qBACG,KAAK,CAAC,kBAAkB;SACpC;QACD,4GAA4G;QAC5G,OAAO,EAAE,GAAG,CAAA;;;;;SAKX;QACD,MAAM,EAAE,GAAG,CAAA;;;SAGV;QACD,aAAa,EAAE,GAAG,CAAA;qBACL,KAAK,CAAC,kBAAkB;SACpC;QACD,oBAAoB,EAAE,GAAG,CAAA;qBACZ,KAAK,CAAC,YAAY;SAC9B;KACJ,CAAA;AACL,CAAC,CAAC,CAAC;AAEH,kFAAkF;AAClF,MAAM,CAAN,IAAY,kBAKX;AALD,WAAY,kBAAkB;IAC1B,8CAA8C;IAC9C,qEAAS,CAAA;IACT,+CAA+C;IAC/C,qEAAS,CAAA;AACb,CAAC,EALW,kBAAkB,KAAlB,kBAAkB,QAK7B;AAwCD;;;GAGG;AACH,MAAM,CAAC,OAAO,OAAO,2BAA4B,SAAQ,KAAK,CAAC,SAA6E;IACxI,YAAY,KAAiD;QACzD,KAAK,CAAC,KAAK,CAAC,CAAC;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,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,wBAAwB,CAAC,MAAM,CAAC,EAAE,CAAC,SAAS,EAAE,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,cAAc,EAAE,YAAY,EAAE,MAAM,EAAE,SAAS,CAAC,CAAC,CACpL;gBACP,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO;oBAChB,oBAAC,KAAK,IAAC,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,EAAC,UAAU;wBAChD,IAAI,CAAC,kBAAkB,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;wBAC7C,IAAI,CAAC,YAAY,CAAC,QAAQ,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,mBAAmB,CAAC,WAAW,CAAC,CAAC;wBAC9E,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,mBAAmB,CAAC,MAAM,CAAC,CAAC;wBAC7E,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,mBAAmB,CAAC,KAAK,CAAC,CAAC,CACxE,CAEV,CACJ,CACK,CACd,CAAC;IACN,CAAC;CAEJ","sourcesContent":["import React from \"react\";\r\nimport {Button, Divider, Space} from \"antd\";\r\nimport i18n from \"d2core/i18n/i18n\";\r\nimport {OpUnitType} from \"dayjs\";\r\nimport {DurationUnitType} from \"d2core/dayjs/duration\";\r\nimport Icon from \"@ant-design/icons/es/components/Icon\";\r\nimport {createStyles} from \"antd-style\";\r\nimport WithCss from \"../style/withCss\";\r\n\r\nconst useStyles = createStyles(({token, css}) => {\r\n return {\r\n panel: css`\r\n color: ${token.colorTextSecondary};\r\n `,\r\n // the popup grows with a long date-time mask - the columns share the extra width, never below their content\r\n columns: css`\r\n display: flex;\r\n align-items: flex-start;\r\n gap: 24px;\r\n margin-bottom: 8px;\r\n `,\r\n column: css`\r\n flex: 1 1 0;\r\n min-width: max-content;\r\n `,\r\n timeShiftIcon: css`\r\n color: ${token.colorTextSecondary};\r\n `,\r\n timeShiftIconChecked: css`\r\n color: ${token.colorPrimary};\r\n `,\r\n }\r\n});\r\n\r\n/** Direction of a time shift requested by {@link DateRangeInputAdvancedPanel}. */\r\nexport enum TimeShiftDirection {\r\n /** Shift forward in time (the \"+\" button). */\r\n INCREMENT,\r\n /** Shift backward in time (the \"-\" button). */\r\n DECREMENT,\r\n}\r\n\r\n/** Props of {@link DateRangeInputAdvancedPanel}. */\r\ninterface DateRangeInputAdvancedPanelProps {\r\n /** Hides the \"Interval End\" column. */\r\n compact?: boolean\r\n\r\n /**\r\n * Called by the \"Interval Begin\" buttons: `\"15minutes\"` (Now), `\"day\"` (Today), `\"week\"`, `\"month\"`, `\"year\"`.\r\n * `DateRangeInput` sets the begin to the start of that unit containing now (the current quarter-hour for `\"15minutes\"`).\r\n */\r\n onBeginIntervalChange(unit: OpUnitType | \"15minutes\"): void\r\n\r\n /**\r\n * Called by the duration buttons (`\"hour\"`, `\"day\"`, `\"week\"`, `\"month\"`, `\"year\"`).\r\n * `DateRangeInput` sets the end to begin + 1 unit - 1 ms.\r\n */\r\n onIntervalDurationChange(unitOfTime: DurationUnitType): void\r\n\r\n /**\r\n * Called by the \"-\"/\"+\" buttons beside a duration button.\r\n * @param shiftBegin whether the begin is to be shifted - per the begin/both/end toggle icons (both by default)\r\n * @param shiftEnd whether the end is to be shifted\r\n * @param unitOfTime shift by one of this unit\r\n */\r\n onTimeShift(shiftBegin: boolean, shiftEnd: boolean, unitOfTime: DurationUnitType, direction: TimeShiftDirection): void\r\n\r\n /**\r\n * Called by the \"Interval End\" buttons: `\"15minutes\"`, `\"hour\"`, `\"day\"`.\r\n * `DateRangeInput` sets the end to 1 ms before the start of that unit containing now.\r\n */\r\n onEndIntervalChange(unit: OpUnitType | \"15minutes\"): void\r\n}\r\n\r\ninterface DateRangeInputAdvancedPanelState {\r\n timeShiftBegin: boolean\r\n timeShiftBoth: boolean\r\n timeShiftEnd: boolean\r\n}\r\n\r\n/**\r\n * Shortcut buttons of the `DateRangeInputMode.ADVANCED` popup of `DateRangeInput`: interval begin,\r\n * duration with time shift, and interval end. It only reports which button was pressed; the caller computes the range.\r\n */\r\nexport default class DateRangeInputAdvancedPanel extends React.Component<DateRangeInputAdvancedPanelProps, DateRangeInputAdvancedPanelState> {\r\n constructor(props: Readonly<DateRangeInputAdvancedPanelProps>) {\r\n super(props);\r\n\r\n this.state = {\r\n timeShiftBegin: false,\r\n timeShiftBoth: true,\r\n timeShiftEnd: false,\r\n }\r\n }\r\n\r\n private renderSectionTitle(title: React.ReactNode) {\r\n return (\r\n <span style={{display: \"block\", fontWeight: \"bold\", textAlign: \"center\", marginBottom: 4}}>\r\n {title}\r\n </span>\r\n );\r\n }\r\n\r\n private renderButton(title: React.ReactNode, callback: () => void) {\r\n return (\r\n <Button\r\n size=\"small\"\r\n block\r\n onClick={callback}\r\n >\r\n {title}\r\n </Button>\r\n );\r\n }\r\n\r\n private renderButtonWithTimeShift(title: React.ReactNode, onClick: () => void, onTimeShift: (direction: TimeShiftDirection) => void) {\r\n const timeShiftDisabled = !this.state.timeShiftBegin && !this.state.timeShiftEnd && !this.state.timeShiftBoth;\r\n\r\n return (\r\n <Space.Compact block size=\"small\">\r\n <Button\r\n disabled={timeShiftDisabled}\r\n icon=\"-\"\r\n onClick={() => onTimeShift(TimeShiftDirection.DECREMENT)}\r\n />\r\n <Button\r\n size=\"small\"\r\n block\r\n onClick={onClick}\r\n >\r\n {title}\r\n </Button>\r\n <Button\r\n disabled={timeShiftDisabled}\r\n icon=\"+\"\r\n onClick={() => onTimeShift(TimeShiftDirection.INCREMENT)}\r\n />\r\n </Space.Compact>\r\n );\r\n }\r\n\r\n private renderTimeShiftIcon(shiftType: \"begin\" | \"both\" | \"end\", styles: ReturnType<typeof useStyles>[\"styles\"]) {\r\n let checked = false;\r\n if (shiftType === \"begin\") {\r\n checked = this.state.timeShiftBegin;\r\n } else if (shiftType === \"both\") {\r\n checked = this.state.timeShiftBoth;\r\n } else if (shiftType === \"end\") {\r\n checked = this.state.timeShiftEnd;\r\n }\r\n\r\n return (\r\n <Icon component={() =>\r\n <svg\r\n className={`icon ${checked ? styles.timeShiftIconChecked : styles.timeShiftIcon}`}\r\n viewBox=\"64 64 896 896\"\r\n version=\"1.1\"\r\n width={40}\r\n height={40}\r\n cursor=\"pointer\"\r\n onClick={() => {\r\n if (shiftType === \"begin\") {\r\n this.setState({\r\n timeShiftBegin: !this.state.timeShiftBegin,\r\n timeShiftBoth: false,\r\n timeShiftEnd: false\r\n });\r\n } else if (shiftType === \"both\") {\r\n this.setState({\r\n timeShiftBegin: false,\r\n timeShiftBoth: !this.state.timeShiftBoth,\r\n timeShiftEnd: false\r\n });\r\n } else if (shiftType === \"end\") {\r\n this.setState({\r\n timeShiftBegin: false,\r\n timeShiftBoth: false,\r\n timeShiftEnd: !this.state.timeShiftEnd\r\n });\r\n }\r\n }}\r\n >\r\n <path\r\n d=\"m 880.43128,184.00001 h -168 v -64 c 0,-4.4 -3.6,-8 -8,-8 h -56 c -4.4,0 -8,3.6 -8,8 v 64 h -256 v -64 c 0,-4.4 -3.6,-8 -8,-8 h -56 c -4.4,0 -8,3.6 -8,8 v 64 h -168 c -17.7,0 -32,14.3 -32,32 v 664 c 0,17.7 14.3,32 32,32 h 736 c 17.7,0 32,-14.3 32,-32 v -664 c 0,-17.7 -14.3,-32 -32,-32 z m -40,656 h -656 v -380 h 656 z m -656,-448 v -136 h 128 v 48 c 0,4.4 3.6,8 8,8 h 56 c 4.4,0 8,-3.6 8,-8 v -48 h 256 v 48 c 0,4.4 3.6,8 8,8 h 56 c 4.4,0 8,-3.6 8,-8 v -48 h 128 v 136 z\"\r\n id=\"path2231\"\r\n style={{fill: \"currentcolor\"}}\r\n />\r\n {[\"begin\", \"end\"].includes(shiftType) &&\r\n <g id=\"g41\">\r\n <g id=\"path2822\"/>\r\n <g id=\"path2824\"/>\r\n <g id=\"path2826\"\r\n transform={shiftType === \"end\" ? \"rotate(180,512.9334,646.24561)\" : \"unset\"}>\r\n <path\r\n id=\"path50\"\r\n style={{fill: \"currentcolor\"}}\r\n d=\"m 358.80859,510.14062 a 34.41795,34.41795 0 0 0 -23.58789,9.24219 L 226.40625,620.82422 a 34.41795,34.41795 0 0 0 -1.70508,48.64453 34.41795,34.41795 0 0 0 48.64453,1.70703 l 108.8125,-101.4414 a 34.41795,34.41795 0 0 0 1.70703,-48.64454 34.41795,34.41795 0 0 0 -25.05664,-10.94922 z M 249.87565,645.99998 358.68957,544.55871 M 249.7207,611.58203 a 34.41795,34.41795 0 0 0 -24.90625,10.82813 34.41795,34.41795 0 0 0 1.47071,48.65234 l 108.29492,101.93164 a 34.41795,34.41795 0 0 0 48.65234,-1.4707 34.41795,34.41795 0 0 0 -1.47265,-48.65235 L 273.46484,620.9375 a 34.41795,34.41795 0 0 0 -23.74414,-9.35547 z m 0.15495,34.41795 108.29422,101.93273 M 264.8125,610.01953 A 35.98045,35.98045 0 0 0 228.83203,646 35.98045,35.98045 0 0 0 264.8125,681.98047 H 550.48633 A 35.98045,35.98045 0 0 0 586.4668,646 35.98045,35.98045 0 0 0 550.48633,610.01953 Z m 285.67298,35.98045 h -285.6727\"/>\r\n </g>\r\n </g>\r\n }\r\n {shiftType === \"both\" &&\r\n <g id=\"g65\" transform=\"rotate(180,512.9334,646.0254)\">\r\n <path\r\n id=\"path63\"\r\n style={{fill: \"currentcolor\"}}\r\n d=\"m 358.80859,510.14062 a 34.41795,34.41795 0 0 0 -23.58789,9.24219 L 226.40625,620.82422 a 34.41795,34.41795 0 0 0 -1.70508,48.64453 34.41795,34.41795 0 0 0 48.64453,1.70703 l 108.8125,-101.4414 a 34.41795,34.41795 0 0 0 1.70703,-48.64454 34.41795,34.41795 0 0 0 -25.05664,-10.94922 z M 249.87565,645.99998 358.68957,544.55871 M 249.7207,611.58203 a 34.41795,34.41795 0 0 0 -24.90625,10.82813 34.41795,34.41795 0 0 0 1.47071,48.65234 l 108.29492,101.93164 a 34.41795,34.41795 0 0 0 48.65234,-1.4707 34.41795,34.41795 0 0 0 -1.47265,-48.65235 L 273.46484,620.9375 a 34.41795,34.41795 0 0 0 -23.74414,-9.35547 z m 0.15495,34.41795 108.29422,101.93273 M 264.8125,610.01953 A 35.98045,35.98045 0 0 0 228.83203,646 35.98045,35.98045 0 0 0 264.8125,681.98047 H 550.48633 A 35.98045,35.98045 0 0 0 586.4668,646 35.98045,35.98045 0 0 0 550.48633,610.01953 Z m 285.67298,35.98045 h -285.6727 m 402.24543,135.9102 a -34.41795,-34.41795 0 0 0 23.58789,-9.24219 L 799.46055,671.22658 a -34.41795,-34.41795 0 0 0 1.70508,-48.64453 -34.41795,-34.41795 0 0 0 -48.64453,-1.70703 l -108.8125,101.4414 a -34.41795,-34.41795 0 0 0 -1.70703,48.64454 -34.41795,-34.41795 0 0 0 25.05664,10.94922 z M 775.99115,646.05082 667.17723,747.49209 M 776.1461,680.46877 a -34.41795,-34.41795 0 0 0 24.90625,-10.82813 -34.41795,-34.41795 0 0 0 -1.47071,-48.65234 L 691.28672,519.05666 a -34.41795,-34.41795 0 0 0 -48.65234,1.4707 -34.41795,-34.41795 0 0 0 1.47265,48.65235 L 752.40196,671.1133 a -34.41795,-34.41795 0 0 0 23.74414,9.35547 z M 775.99115,646.05082 667.69693,544.11809 M 761.0543,682.03127 A -35.98045,-35.98045 0 0 0 797.03477,646.0508 -35.98045,-35.98045 0 0 0 761.0543,610.07033 H 475.38047 A -35.98045,-35.98045 0 0 0 439.4,646.0508 -35.98045,-35.98045 0 0 0 475.38047,682.03127 Z M 475.38132,646.05082 h 285.6727\"/>\r\n </g>\r\n }\r\n </svg>\r\n }/>\r\n );\r\n }\r\n\r\n render() {\r\n const timeShiftBegin = this.state.timeShiftBegin || this.state.timeShiftBoth;\r\n const timeShiftEnd = this.state.timeShiftEnd || this.state.timeShiftBoth;\r\n\r\n return (\r\n <WithCss useStyles={useStyles}>{({styles}) =>\r\n <div className={styles.panel}>\r\n <Divider style={{margin: \"8px 0px 6px\"}}/>\r\n <div className={styles.columns}>\r\n <Space className={styles.column} direction=\"vertical\">\r\n {this.renderSectionTitle(i18n(\"Interval Begin\"))}\r\n {this.renderButton(i18n(\"Now\"), () => this.props.onBeginIntervalChange(\"15minutes\"))}\r\n {this.renderButton(i18n(\"Today\"), () => this.props.onBeginIntervalChange(\"day\"))}\r\n {this.renderButton(i18n(\"Week\"), () => this.props.onBeginIntervalChange(\"week\"))}\r\n {this.renderButton(i18n(\"Month\"), () => this.props.onBeginIntervalChange(\"month\"))}\r\n {this.renderButton(i18n(\"Year\"), () => this.props.onBeginIntervalChange(\"year\"))}\r\n </Space>\r\n <Space className={styles.column} direction=\"vertical\">\r\n {this.renderSectionTitle(i18n(\"Duration and Time Shift\"))}\r\n <div style={{display: \"flex\", justifyContent: \"center\", alignItems: \"center\"}}>\r\n {this.renderTimeShiftIcon(\"begin\", styles)}\r\n {this.renderTimeShiftIcon(\"both\", styles)}\r\n {this.renderTimeShiftIcon(\"end\", styles)}\r\n </div>\r\n {this.renderButtonWithTimeShift(i18n(\"Hour\"), () => this.props.onIntervalDurationChange(\"hour\"), (direction) => this.props.onTimeShift(timeShiftBegin, timeShiftEnd, \"hour\", direction))}\r\n {this.renderButtonWithTimeShift(i18n(\"Day\"), () => this.props.onIntervalDurationChange(\"day\"), (direction) => this.props.onTimeShift(timeShiftBegin, timeShiftEnd, \"day\", direction))}\r\n {this.renderButtonWithTimeShift(i18n(\"Week\"), () => this.props.onIntervalDurationChange(\"week\"), (direction) => this.props.onTimeShift(timeShiftBegin, timeShiftEnd, \"week\", direction))}\r\n {this.renderButtonWithTimeShift(i18n(\"Month\"), () => this.props.onIntervalDurationChange(\"month\"), (direction) => this.props.onTimeShift(timeShiftBegin, timeShiftEnd, \"month\", direction))}\r\n {this.renderButtonWithTimeShift(i18n(\"Year\"), () => this.props.onIntervalDurationChange(\"year\"), (direction) => this.props.onTimeShift(timeShiftBegin, timeShiftEnd, \"year\", direction))}\r\n </Space>\r\n {!this.props.compact &&\r\n <Space className={styles.column} direction=\"vertical\">\r\n {this.renderSectionTitle(i18n(\"Interval End\"))}\r\n {this.renderButton(\"15 min\", () => this.props.onEndIntervalChange(\"15minutes\"))}\r\n {this.renderButton(i18n(\"Hour\"), () => this.props.onEndIntervalChange(\"hour\"))}\r\n {this.renderButton(i18n(\"Day\"), () => this.props.onEndIntervalChange(\"day\"))}\r\n </Space>\r\n }\r\n </div>\r\n </div>\r\n }</WithCss>\r\n );\r\n }\r\n\r\n}"]}
|
|
1
|
+
{"version":3,"file":"dateRangeInputAdvancedPanel.js","sourceRoot":"","sources":["../../../../components/date/dateRangeInputAdvancedPanel.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAC,MAAM,EAAE,OAAO,EAAE,KAAK,EAAC,MAAM,MAAM,CAAC;AAC5C,OAAO,IAAI,MAAM,kBAAkB,CAAC;AAGpC,OAAO,IAAI,MAAM,sCAAsC,CAAC;AACxD,OAAO,EAAC,YAAY,EAAC,MAAM,YAAY,CAAC;AACxC,OAAO,OAAO,MAAM,kBAAkB,CAAC;AAEvC,MAAM,SAAS,GAAG,YAAY,CAAC,CAAC,EAAC,KAAK,EAAE,GAAG,EAAC,EAAE,EAAE;IAC5C,OAAO;QACH,KAAK,EAAE,GAAG,CAAA;qBACG,KAAK,CAAC,kBAAkB;SACpC;QACD,4GAA4G;QAC5G,OAAO,EAAE,GAAG,CAAA;;;;;SAKX;QACD,MAAM,EAAE,GAAG,CAAA;;;SAGV;QACD,aAAa,EAAE,GAAG,CAAA;qBACL,KAAK,CAAC,kBAAkB;SACpC;QACD,oBAAoB,EAAE,GAAG,CAAA;qBACZ,KAAK,CAAC,YAAY;SAC9B;KACJ,CAAA;AACL,CAAC,CAA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} from \"antd\";\nimport i18n from \"d2core/i18n/i18n\";\nimport {OpUnitType} from \"dayjs\";\nimport {DurationUnitType} from \"d2core/dayjs/duration\";\nimport Icon from \"@ant-design/icons/es/components/Icon\";\nimport {createStyles} from \"antd-style\";\nimport WithCss from \"../style/withCss\";\n\nconst useStyles = createStyles(({token, css}) => {\n return {\n panel: css`\n color: ${token.colorTextSecondary};\n `,\n // the popup grows with a long date-time mask - the columns share the extra width, never below their content\n columns: css`\n display: flex;\n align-items: flex-start;\n gap: 24px;\n margin-bottom: 8px;\n `,\n column: css`\n flex: 1 1 0;\n min-width: max-content;\n `,\n timeShiftIcon: css`\n color: ${token.colorTextSecondary};\n `,\n timeShiftIconChecked: css`\n color: ${token.colorPrimary};\n `,\n }\n});\n\n/** Direction of a time shift requested by {@link DateRangeInputAdvancedPanel}. */\nexport enum TimeShiftDirection {\n /** Shift forward in time (the \"+\" button). */\n INCREMENT,\n /** Shift backward in time (the \"-\" button). */\n DECREMENT,\n}\n\n/** Props of {@link DateRangeInputAdvancedPanel}. */\ninterface DateRangeInputAdvancedPanelProps {\n /** Hides the \"Interval End\" column. */\n compact?: boolean\n\n /**\n * Called by the \"Interval Begin\" buttons: `\"15minutes\"` (Now), `\"day\"` (Today), `\"week\"`, `\"month\"`, `\"year\"`.\n * `DateRangeInput` sets the begin to the start of that unit containing now (the current quarter-hour for `\"15minutes\"`).\n */\n onBeginIntervalChange(unit: OpUnitType | \"15minutes\"): void\n\n /**\n * Called by the duration buttons (`\"hour\"`, `\"day\"`, `\"week\"`, `\"month\"`, `\"year\"`).\n * `DateRangeInput` sets the end to begin + 1 unit - 1 ms.\n */\n onIntervalDurationChange(unitOfTime: DurationUnitType): void\n\n /**\n * Called by the \"-\"/\"+\" buttons beside a duration button.\n * @param shiftBegin whether the begin is to be shifted - per the begin/both/end toggle icons (both by default)\n * @param shiftEnd whether the end is to be shifted\n * @param unitOfTime shift by one of this unit\n */\n onTimeShift(shiftBegin: boolean, shiftEnd: boolean, unitOfTime: DurationUnitType, direction: TimeShiftDirection): void\n\n /**\n * Called by the \"Interval End\" buttons: `\"15minutes\"`, `\"hour\"`, `\"day\"`.\n * `DateRangeInput` sets the end to 1 ms before the start of that unit containing now.\n */\n onEndIntervalChange(unit: OpUnitType | \"15minutes\"): void\n}\n\ninterface DateRangeInputAdvancedPanelState {\n timeShiftBegin: boolean\n timeShiftBoth: boolean\n timeShiftEnd: boolean\n}\n\n/**\n * Shortcut buttons of the `DateRangeInputMode.ADVANCED` popup of `DateRangeInput`: interval begin,\n * duration with time shift, and interval end. It only reports which button was pressed; the caller computes the range.\n */\nexport default class DateRangeInputAdvancedPanel extends React.Component<DateRangeInputAdvancedPanelProps, DateRangeInputAdvancedPanelState> {\n constructor(props: Readonly<DateRangeInputAdvancedPanelProps>) {\n super(props);\n\n this.state = {\n timeShiftBegin: false,\n timeShiftBoth: true,\n timeShiftEnd: false,\n }\n }\n\n private renderSectionTitle(title: React.ReactNode) {\n return (\n <span style={{display: \"block\", fontWeight: \"bold\", textAlign: \"center\", marginBottom: 4}}>\n {title}\n </span>\n );\n }\n\n private renderButton(title: React.ReactNode, callback: () => void) {\n return (\n <Button\n size=\"small\"\n block\n onClick={callback}\n >\n {title}\n </Button>\n );\n }\n\n private renderButtonWithTimeShift(title: React.ReactNode, onClick: () => void, onTimeShift: (direction: TimeShiftDirection) => void) {\n const timeShiftDisabled = !this.state.timeShiftBegin && !this.state.timeShiftEnd && !this.state.timeShiftBoth;\n\n return (\n <Space.Compact block size=\"small\">\n <Button\n disabled={timeShiftDisabled}\n icon=\"-\"\n onClick={() => onTimeShift(TimeShiftDirection.DECREMENT)}\n />\n <Button\n size=\"small\"\n block\n onClick={onClick}\n >\n {title}\n </Button>\n <Button\n disabled={timeShiftDisabled}\n icon=\"+\"\n onClick={() => onTimeShift(TimeShiftDirection.INCREMENT)}\n />\n </Space.Compact>\n );\n }\n\n private renderTimeShiftIcon(shiftType: \"begin\" | \"both\" | \"end\", styles: ReturnType<typeof useStyles>[\"styles\"]) {\n let checked = false;\n if (shiftType === \"begin\") {\n checked = this.state.timeShiftBegin;\n } else if (shiftType === \"both\") {\n checked = this.state.timeShiftBoth;\n } else if (shiftType === \"end\") {\n checked = this.state.timeShiftEnd;\n }\n\n return (\n <Icon component={() =>\n <svg\n className={`icon ${checked ? styles.timeShiftIconChecked : styles.timeShiftIcon}`}\n viewBox=\"64 64 896 896\"\n version=\"1.1\"\n width={40}\n height={40}\n cursor=\"pointer\"\n onClick={() => {\n if (shiftType === \"begin\") {\n this.setState({\n timeShiftBegin: !this.state.timeShiftBegin,\n timeShiftBoth: false,\n timeShiftEnd: false\n });\n } else if (shiftType === \"both\") {\n this.setState({\n timeShiftBegin: false,\n timeShiftBoth: !this.state.timeShiftBoth,\n timeShiftEnd: false\n });\n } else if (shiftType === \"end\") {\n this.setState({\n timeShiftBegin: false,\n timeShiftBoth: false,\n timeShiftEnd: !this.state.timeShiftEnd\n });\n }\n }}\n >\n <path\n d=\"m 880.43128,184.00001 h -168 v -64 c 0,-4.4 -3.6,-8 -8,-8 h -56 c -4.4,0 -8,3.6 -8,8 v 64 h -256 v -64 c 0,-4.4 -3.6,-8 -8,-8 h -56 c -4.4,0 -8,3.6 -8,8 v 64 h -168 c -17.7,0 -32,14.3 -32,32 v 664 c 0,17.7 14.3,32 32,32 h 736 c 17.7,0 32,-14.3 32,-32 v -664 c 0,-17.7 -14.3,-32 -32,-32 z m -40,656 h -656 v -380 h 656 z m -656,-448 v -136 h 128 v 48 c 0,4.4 3.6,8 8,8 h 56 c 4.4,0 8,-3.6 8,-8 v -48 h 256 v 48 c 0,4.4 3.6,8 8,8 h 56 c 4.4,0 8,-3.6 8,-8 v -48 h 128 v 136 z\"\n id=\"path2231\"\n style={{fill: \"currentcolor\"}}\n />\n {[\"begin\", \"end\"].includes(shiftType) &&\n <g id=\"g41\">\n <g id=\"path2822\"/>\n <g id=\"path2824\"/>\n <g id=\"path2826\"\n transform={shiftType === \"end\" ? \"rotate(180,512.9334,646.24561)\" : \"unset\"}>\n <path\n id=\"path50\"\n style={{fill: \"currentcolor\"}}\n d=\"m 358.80859,510.14062 a 34.41795,34.41795 0 0 0 -23.58789,9.24219 L 226.40625,620.82422 a 34.41795,34.41795 0 0 0 -1.70508,48.64453 34.41795,34.41795 0 0 0 48.64453,1.70703 l 108.8125,-101.4414 a 34.41795,34.41795 0 0 0 1.70703,-48.64454 34.41795,34.41795 0 0 0 -25.05664,-10.94922 z M 249.87565,645.99998 358.68957,544.55871 M 249.7207,611.58203 a 34.41795,34.41795 0 0 0 -24.90625,10.82813 34.41795,34.41795 0 0 0 1.47071,48.65234 l 108.29492,101.93164 a 34.41795,34.41795 0 0 0 48.65234,-1.4707 34.41795,34.41795 0 0 0 -1.47265,-48.65235 L 273.46484,620.9375 a 34.41795,34.41795 0 0 0 -23.74414,-9.35547 z m 0.15495,34.41795 108.29422,101.93273 M 264.8125,610.01953 A 35.98045,35.98045 0 0 0 228.83203,646 35.98045,35.98045 0 0 0 264.8125,681.98047 H 550.48633 A 35.98045,35.98045 0 0 0 586.4668,646 35.98045,35.98045 0 0 0 550.48633,610.01953 Z m 285.67298,35.98045 h -285.6727\"/>\n </g>\n </g>\n }\n {shiftType === \"both\" &&\n <g id=\"g65\" transform=\"rotate(180,512.9334,646.0254)\">\n <path\n id=\"path63\"\n style={{fill: \"currentcolor\"}}\n d=\"m 358.80859,510.14062 a 34.41795,34.41795 0 0 0 -23.58789,9.24219 L 226.40625,620.82422 a 34.41795,34.41795 0 0 0 -1.70508,48.64453 34.41795,34.41795 0 0 0 48.64453,1.70703 l 108.8125,-101.4414 a 34.41795,34.41795 0 0 0 1.70703,-48.64454 34.41795,34.41795 0 0 0 -25.05664,-10.94922 z M 249.87565,645.99998 358.68957,544.55871 M 249.7207,611.58203 a 34.41795,34.41795 0 0 0 -24.90625,10.82813 34.41795,34.41795 0 0 0 1.47071,48.65234 l 108.29492,101.93164 a 34.41795,34.41795 0 0 0 48.65234,-1.4707 34.41795,34.41795 0 0 0 -1.47265,-48.65235 L 273.46484,620.9375 a 34.41795,34.41795 0 0 0 -23.74414,-9.35547 z m 0.15495,34.41795 108.29422,101.93273 M 264.8125,610.01953 A 35.98045,35.98045 0 0 0 228.83203,646 35.98045,35.98045 0 0 0 264.8125,681.98047 H 550.48633 A 35.98045,35.98045 0 0 0 586.4668,646 35.98045,35.98045 0 0 0 550.48633,610.01953 Z m 285.67298,35.98045 h -285.6727 m 402.24543,135.9102 a -34.41795,-34.41795 0 0 0 23.58789,-9.24219 L 799.46055,671.22658 a -34.41795,-34.41795 0 0 0 1.70508,-48.64453 -34.41795,-34.41795 0 0 0 -48.64453,-1.70703 l -108.8125,101.4414 a -34.41795,-34.41795 0 0 0 -1.70703,48.64454 -34.41795,-34.41795 0 0 0 25.05664,10.94922 z M 775.99115,646.05082 667.17723,747.49209 M 776.1461,680.46877 a -34.41795,-34.41795 0 0 0 24.90625,-10.82813 -34.41795,-34.41795 0 0 0 -1.47071,-48.65234 L 691.28672,519.05666 a -34.41795,-34.41795 0 0 0 -48.65234,1.4707 -34.41795,-34.41795 0 0 0 1.47265,48.65235 L 752.40196,671.1133 a -34.41795,-34.41795 0 0 0 23.74414,9.35547 z M 775.99115,646.05082 667.69693,544.11809 M 761.0543,682.03127 A -35.98045,-35.98045 0 0 0 797.03477,646.0508 -35.98045,-35.98045 0 0 0 761.0543,610.07033 H 475.38047 A -35.98045,-35.98045 0 0 0 439.4,646.0508 -35.98045,-35.98045 0 0 0 475.38047,682.03127 Z M 475.38132,646.05082 h 285.6727\"/>\n </g>\n }\n </svg>\n }/>\n );\n }\n\n render() {\n const timeShiftBegin = this.state.timeShiftBegin || this.state.timeShiftBoth;\n const timeShiftEnd = this.state.timeShiftEnd || this.state.timeShiftBoth;\n\n return (\n <WithCss useStyles={useStyles}>{({styles}) =>\n <div className={styles.panel}>\n <Divider style={{margin: \"8px 0px 6px\"}}/>\n <div className={styles.columns}>\n <Space className={styles.column} direction=\"vertical\">\n {this.renderSectionTitle(i18n(\"Interval Begin\"))}\n {this.renderButton(i18n(\"Now\"), () => this.props.onBeginIntervalChange(\"15minutes\"))}\n {this.renderButton(i18n(\"Today\"), () => this.props.onBeginIntervalChange(\"day\"))}\n {this.renderButton(i18n(\"Week\"), () => this.props.onBeginIntervalChange(\"week\"))}\n {this.renderButton(i18n(\"Month\"), () => this.props.onBeginIntervalChange(\"month\"))}\n {this.renderButton(i18n(\"Year\"), () => this.props.onBeginIntervalChange(\"year\"))}\n </Space>\n <Space className={styles.column} direction=\"vertical\">\n {this.renderSectionTitle(i18n(\"Duration and Time Shift\"))}\n {this.renderButtonWithTimeShift(i18n(\"Hour\"), () => this.props.onIntervalDurationChange(\"hour\"), (direction) => this.props.onTimeShift(timeShiftBegin, timeShiftEnd, \"hour\", direction))}\n {this.renderButtonWithTimeShift(i18n(\"Day\"), () => this.props.onIntervalDurationChange(\"day\"), (direction) => this.props.onTimeShift(timeShiftBegin, timeShiftEnd, \"day\", direction))}\n {this.renderButtonWithTimeShift(i18n(\"Week\"), () => this.props.onIntervalDurationChange(\"week\"), (direction) => this.props.onTimeShift(timeShiftBegin, timeShiftEnd, \"week\", direction))}\n {this.renderButtonWithTimeShift(i18n(\"Month\"), () => this.props.onIntervalDurationChange(\"month\"), (direction) => this.props.onTimeShift(timeShiftBegin, timeShiftEnd, \"month\", direction))}\n {this.renderButtonWithTimeShift(i18n(\"Year\"), () => this.props.onIntervalDurationChange(\"year\"), (direction) => this.props.onTimeShift(timeShiftBegin, timeShiftEnd, \"year\", direction))}\n <div style={{display: \"flex\", justifyContent: \"center\", alignItems: \"center\"}}>\n {this.renderTimeShiftIcon(\"begin\", styles)}\n {this.renderTimeShiftIcon(\"both\", styles)}\n {this.renderTimeShiftIcon(\"end\", styles)}\n </div>\n </Space>\n {!this.props.compact &&\n <Space className={styles.column} direction=\"vertical\">\n {this.renderSectionTitle(i18n(\"Interval End\"))}\n {this.renderButton(\"15 min\", () => this.props.onEndIntervalChange(\"15minutes\"))}\n {this.renderButton(i18n(\"Hour\"), () => this.props.onEndIntervalChange(\"hour\"))}\n {this.renderButton(i18n(\"Day\"), () => this.props.onEndIntervalChange(\"day\"))}\n </Space>\n }\n </div>\n </div>\n }</WithCss>\n );\n }\n\n}"]}
|
|
@@ -15,8 +15,12 @@ interface DateTimeInputProps extends Omit<HTMLAttributes<HTMLDivElement>, "onCha
|
|
|
15
15
|
* Editable tokens: `YYYY`, `YY`, `MM`, `DD`, `HH`, `mm`, `ss`, `SSS` and the UTC offset `Z` (`+02:00`) or
|
|
16
16
|
* `ZZ` (`+0200`); other characters are literals. Fields missing from the mask are taken from the start
|
|
17
17
|
* of the current day. A 2-digit year keeps the century of the previous value (without one, `> 70` means 19xx,
|
|
18
|
-
* otherwise 20xx).
|
|
19
|
-
*
|
|
18
|
+
* otherwise 20xx). A wall clock inside a DST gap and a day that does not exist (31.02.) are invalid.
|
|
19
|
+
* Including the UTC offset makes both instants of a DST fold enterable. `Z?` (`d2core/dayjs/ambiguousTime`) is shown as `Z` - always, so that the input
|
|
20
|
+
* does not change its layout while typed into.
|
|
21
|
+
* `HH?` (`d2core/dayjs/ambiguousTime`) is the hour shown as `A2` / `B2` in the repeated hour of a DST fold; `A` or
|
|
22
|
+
* `B` typed in place of the leading digit picks the occurrence, a repeated hour typed without it is the second
|
|
23
|
+
* one (`B`), a letter outside a DST fold is invalid.
|
|
20
24
|
*/
|
|
21
25
|
mask: string;
|
|
22
26
|
/**
|
|
@@ -129,7 +133,7 @@ interface MaskSegment {
|
|
|
129
133
|
index: number;
|
|
130
134
|
/** length of the segment in the rendered value */
|
|
131
135
|
length: number;
|
|
132
|
-
/** numeric field description - undefined for the UTC-offset segment */
|
|
136
|
+
/** numeric field description - undefined for the UTC-offset segment; the `HH?` segment has the `HH` entry */
|
|
133
137
|
entry: InfoEntry | undefined;
|
|
134
138
|
min: number;
|
|
135
139
|
max: number;
|
|
@@ -166,6 +170,11 @@ export default class DateTimeInput extends React.Component<DateTimeInputProps, D
|
|
|
166
170
|
/** The underlying `<input>` element, `undefined` before mount or with {@link DateTimeInputProps.renderAsCalendar}. */
|
|
167
171
|
get input(): HTMLInputElement | undefined;
|
|
168
172
|
private getLayout;
|
|
173
|
+
/**
|
|
174
|
+
* A typed text can stand for a value shown differently (`02` of a repeated hour is `B2`). When that value is the
|
|
175
|
+
* current one, the `value` prop does not change and MaskedInput would keep the typed text.
|
|
176
|
+
*/
|
|
177
|
+
private rewriteInputIfShownDifferently;
|
|
169
178
|
/** Moves the keyboard focus to the text input. */
|
|
170
179
|
focus(): void;
|
|
171
180
|
private canStep;
|
|
@@ -23,86 +23,87 @@ import { createStyles } from "antd-style";
|
|
|
23
23
|
import WithCss from "d2coreui/components/style/withCss";
|
|
24
24
|
import i18n from "d2core/i18n/i18n";
|
|
25
25
|
import { DEFAULT_FORMAT_CHARACTERS, ESCAPE_CHAR } from "d2coreui/components/input/mask/helpers";
|
|
26
|
+
import { AMBIGUOUS_HOUR_TOKEN, AMBIGUOUS_UTC_OFFSET_TOKEN, getWallClockInstants, replaceAmbiguousTimeTokens } from "d2core/dayjs/ambiguousTime";
|
|
26
27
|
const useStyles = createStyles(({ token, css }, props) => {
|
|
27
28
|
// antd colours prefix/suffix by status in every variant except borderless
|
|
28
29
|
const statusAffix = props.variant !== "borderless";
|
|
29
30
|
return {
|
|
30
|
-
dateTimeInputCalendar: css `
|
|
31
|
-
// adaptations of date-picker calendar styles
|
|
32
|
-
.ant-picker-cell-in-view.ant-picker-cell-selected .ant-picker-cell-inner:not(.date-picker-item-marked) {
|
|
33
|
-
color: inherit;
|
|
34
|
-
background: inherit;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
.ant-picker-panel:focus > .ant-picker-date-panel .ant-picker-cell-in-view.ant-picker-cell-selected .ant-picker-cell-inner:before {
|
|
38
|
-
position: absolute;
|
|
39
|
-
top: 0;
|
|
40
|
-
right: 0;
|
|
41
|
-
bottom: 0;
|
|
42
|
-
left: 0;
|
|
43
|
-
z-index: 1;
|
|
44
|
-
border: ${token.lineWidth}px ${token.lineType} ${token.colorPrimary};
|
|
45
|
-
border-radius: ${token.borderRadiusSM}px;
|
|
46
|
-
content: '';
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
.ant-picker-content thead {
|
|
50
|
-
user-select: none;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
// plays the role of antd's selected cell
|
|
54
|
-
.date-picker-item-marked {
|
|
55
|
-
color: ${token.colorTextLightSolid};
|
|
56
|
-
background: ${token.colorPrimary};
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
.ant-picker-cell-in-view.ant-picker-cell-today .ant-picker-cell-inner::before {
|
|
60
|
-
border: ${token.lineWidth}px ${token.lineType} ${token.colorPrimary};
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
// antd's cellHoverBg, text colour is left untouched on hover
|
|
64
|
-
.ant-picker-cell:hover:not(.ant-picker-cell-in-view) .ant-picker-cell-inner, .ant-picker-cell:hover:not(.ant-picker-cell-selected):not(.ant-picker-cell-range-start):not(.ant-picker-cell-range-end):not(.ant-picker-cell-range-hover-start):not(.ant-picker-cell-range-hover-end) .ant-picker-cell-inner {
|
|
65
|
-
background: ${token.controlItemBgHover};
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
.ant-picker-body {
|
|
69
|
-
padding-bottom: 0 !important;
|
|
70
|
-
}
|
|
31
|
+
dateTimeInputCalendar: css `
|
|
32
|
+
// adaptations of date-picker calendar styles
|
|
33
|
+
.ant-picker-cell-in-view.ant-picker-cell-selected .ant-picker-cell-inner:not(.date-picker-item-marked) {
|
|
34
|
+
color: inherit;
|
|
35
|
+
background: inherit;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
.ant-picker-panel:focus > .ant-picker-date-panel .ant-picker-cell-in-view.ant-picker-cell-selected .ant-picker-cell-inner:before {
|
|
39
|
+
position: absolute;
|
|
40
|
+
top: 0;
|
|
41
|
+
right: 0;
|
|
42
|
+
bottom: 0;
|
|
43
|
+
left: 0;
|
|
44
|
+
z-index: 1;
|
|
45
|
+
border: ${token.lineWidth}px ${token.lineType} ${token.colorPrimary};
|
|
46
|
+
border-radius: ${token.borderRadiusSM}px;
|
|
47
|
+
content: '';
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
.ant-picker-content thead {
|
|
51
|
+
user-select: none;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
// plays the role of antd's selected cell
|
|
55
|
+
.date-picker-item-marked {
|
|
56
|
+
color: ${token.colorTextLightSolid};
|
|
57
|
+
background: ${token.colorPrimary};
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
.ant-picker-cell-in-view.ant-picker-cell-today .ant-picker-cell-inner::before {
|
|
61
|
+
border: ${token.lineWidth}px ${token.lineType} ${token.colorPrimary};
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
// antd's cellHoverBg, text colour is left untouched on hover
|
|
65
|
+
.ant-picker-cell:hover:not(.ant-picker-cell-in-view) .ant-picker-cell-inner, .ant-picker-cell:hover:not(.ant-picker-cell-selected):not(.ant-picker-cell-range-start):not(.ant-picker-cell-range-end):not(.ant-picker-cell-range-hover-start):not(.ant-picker-cell-range-hover-end) .ant-picker-cell-inner {
|
|
66
|
+
background: ${token.controlItemBgHover};
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
.ant-picker-body {
|
|
70
|
+
padding-bottom: 0 !important;
|
|
71
|
+
}
|
|
71
72
|
`,
|
|
72
73
|
// the calendar icon is centred on this wrapper, not on the root, which a flex parent may stretch; as a block
|
|
73
74
|
// it would put the inline-block antd input on a line box and grow by the descender gap
|
|
74
|
-
inputWrapper: css `
|
|
75
|
-
display: flex;
|
|
76
|
-
position: relative;
|
|
75
|
+
inputWrapper: css `
|
|
76
|
+
display: flex;
|
|
77
|
+
position: relative;
|
|
77
78
|
`,
|
|
78
|
-
suffixIconHost: css `
|
|
79
|
-
display: flex;
|
|
80
|
-
align-items: center;
|
|
81
|
-
justify-content: center;
|
|
79
|
+
suffixIconHost: css `
|
|
80
|
+
display: flex;
|
|
81
|
+
align-items: center;
|
|
82
|
+
justify-content: center;
|
|
82
83
|
`,
|
|
83
|
-
suffixIcon: css `
|
|
84
|
-
color: ${token.colorTextQuaternary};
|
|
84
|
+
suffixIcon: css `
|
|
85
|
+
color: ${token.colorTextQuaternary};
|
|
85
86
|
`,
|
|
86
87
|
// antd colours the affix by status - see `genOutlinedStatusStyle.affixColor`
|
|
87
|
-
suffixIconError: css `
|
|
88
|
-
${statusAffix ? `color: ${token.colorError};` : ""}
|
|
88
|
+
suffixIconError: css `
|
|
89
|
+
${statusAffix ? `color: ${token.colorError};` : ""}
|
|
89
90
|
`,
|
|
90
|
-
suffixIconWarning: css `
|
|
91
|
-
${statusAffix ? `color: ${token.colorWarning};` : ""}
|
|
91
|
+
suffixIconWarning: css `
|
|
92
|
+
${statusAffix ? `color: ${token.colorWarning};` : ""}
|
|
92
93
|
`,
|
|
93
|
-
suffixIconDisabled: css `
|
|
94
|
-
color: ${token.colorTextDisabled};
|
|
94
|
+
suffixIconDisabled: css `
|
|
95
|
+
color: ${token.colorTextDisabled};
|
|
95
96
|
`,
|
|
96
97
|
/**
|
|
97
98
|
* antd's borderless/filled status styles colour the value text and are not guarded
|
|
98
99
|
* against the disabled state - pickers keep colorTextDisabled, so match the picker.
|
|
99
100
|
* Applied only for a truly disabled component, never for `inputDisabled` (open popup).
|
|
100
101
|
*/
|
|
101
|
-
disabledText: css `
|
|
102
|
-
&& input[disabled] {
|
|
103
|
-
color: ${token.colorTextDisabled};
|
|
104
|
-
-webkit-text-fill-color: ${token.colorTextDisabled};
|
|
105
|
-
}
|
|
102
|
+
disabledText: css `
|
|
103
|
+
&& input[disabled] {
|
|
104
|
+
color: ${token.colorTextDisabled};
|
|
105
|
+
-webkit-text-fill-color: ${token.colorTextDisabled};
|
|
106
|
+
}
|
|
106
107
|
`,
|
|
107
108
|
};
|
|
108
109
|
});
|
|
@@ -127,8 +128,11 @@ const OFFSET_TOKENS = [
|
|
|
127
128
|
* a literal of the generated pattern - letters of the mask are always turned into field slots.
|
|
128
129
|
*/
|
|
129
130
|
const SIGN_FORMAT_CHAR = "S";
|
|
130
|
-
|
|
131
|
+
/** MaskedInput format character for the leading position of the `HH?` hour - a digit, or `A`/`B` of a DST fold. */
|
|
132
|
+
const HOUR_LETTER_FORMAT_CHAR = "F";
|
|
133
|
+
const MASK_FORMAT_CHARACTERS = {
|
|
131
134
|
[SIGN_FORMAT_CHAR]: { validate: (char) => char === "+" || char === "-" },
|
|
135
|
+
[HOUR_LETTER_FORMAT_CHAR]: { validate: (char) => /^[0-9ABab]$/.test(char), transform: (char) => char.toUpperCase() },
|
|
132
136
|
};
|
|
133
137
|
const MAX_UTC_OFFSET_MINUTES = 14 * 60;
|
|
134
138
|
const MIN_TIME = dayjs.unix(0);
|
|
@@ -160,10 +164,13 @@ function findInfoEntry(token) {
|
|
|
160
164
|
return undefined;
|
|
161
165
|
}
|
|
162
166
|
function escapePatternChar(char) {
|
|
163
|
-
return char in DEFAULT_FORMAT_CHARACTERS || char
|
|
167
|
+
return char in DEFAULT_FORMAT_CHARACTERS || char in MASK_FORMAT_CHARACTERS || char === ESCAPE_CHAR
|
|
164
168
|
? ESCAPE_CHAR + char
|
|
165
169
|
: char;
|
|
166
170
|
}
|
|
171
|
+
function toInputMask(mask) {
|
|
172
|
+
return replaceAmbiguousTimeTokens(mask, (token) => token === AMBIGUOUS_UTC_OFFSET_TOKEN ? "Z" : token);
|
|
173
|
+
}
|
|
167
174
|
/**
|
|
168
175
|
* Walks the mask once and records, for every editable field, where it lands in the value as
|
|
169
176
|
* dayjs renders it. Both the MaskedInput pattern and the parser positions are derived from
|
|
@@ -186,6 +193,14 @@ function buildMaskLayout(mask) {
|
|
|
186
193
|
i += offset.token.length;
|
|
187
194
|
continue;
|
|
188
195
|
}
|
|
196
|
+
if (mask.startsWith(AMBIGUOUS_HOUR_TOKEN, i)) {
|
|
197
|
+
const found = findInfoEntry("HH");
|
|
198
|
+
segments.push({ token: AMBIGUOUS_HOUR_TOKEN, index: renderIndex, length: 2, entry: found.entry, min: found.min, max: found.max });
|
|
199
|
+
pattern += HOUR_LETTER_FORMAT_CHAR + "1";
|
|
200
|
+
renderIndex += 2;
|
|
201
|
+
i += AMBIGUOUS_HOUR_TOKEN.length;
|
|
202
|
+
continue;
|
|
203
|
+
}
|
|
189
204
|
const token = NUMBER_TOKENS.find((t) => mask.startsWith(t, i));
|
|
190
205
|
const found = token !== undefined ? findInfoEntry(token) : undefined;
|
|
191
206
|
if (token !== undefined && found !== undefined) {
|
|
@@ -204,6 +219,14 @@ function buildMaskLayout(mask) {
|
|
|
204
219
|
}
|
|
205
220
|
const CALENDAR_ICON_WIDTH = 28;
|
|
206
221
|
let measureContext = null;
|
|
222
|
+
// CSS takes an unquoted family name only if it is made of identifiers - the canvas ignores the whole `font` when one
|
|
223
|
+
// is not (e.g. the token `fontFamily: "72"`) and keeps measuring in its default 10px font
|
|
224
|
+
function quoteFontFamilies(fontFamily) {
|
|
225
|
+
return fontFamily.split(",")
|
|
226
|
+
.map((family) => family.trim())
|
|
227
|
+
.map((family) => /^["']/.test(family) || /^-?[a-zA-Z_][\w-]*(\s+-?[a-zA-Z_][\w-]*)*$/.test(family) ? family : `"${family}"`)
|
|
228
|
+
.join(", ");
|
|
229
|
+
}
|
|
207
230
|
function measureTextWidth(text, font) {
|
|
208
231
|
measureContext !== null && measureContext !== void 0 ? measureContext : (measureContext = document.createElement("canvas").getContext("2d"));
|
|
209
232
|
if (!measureContext) {
|
|
@@ -248,7 +271,7 @@ export default class DateTimeInput extends React.Component {
|
|
|
248
271
|
}
|
|
249
272
|
};
|
|
250
273
|
this.layoutMask = props.mask;
|
|
251
|
-
this.layout = buildMaskLayout(props.mask);
|
|
274
|
+
this.layout = buildMaskLayout(toInputMask(props.mask));
|
|
252
275
|
this.state = {
|
|
253
276
|
valid: DateTimeInput.isValidValue(props.value, props.minDateTime, props.maxDateTime, props.allowClear),
|
|
254
277
|
currentPos: null,
|
|
@@ -298,10 +321,25 @@ export default class DateTimeInput extends React.Component {
|
|
|
298
321
|
getLayout() {
|
|
299
322
|
if (this.layoutMask !== this.props.mask) {
|
|
300
323
|
this.layoutMask = this.props.mask;
|
|
301
|
-
this.layout = buildMaskLayout(this.props.mask);
|
|
324
|
+
this.layout = buildMaskLayout(toInputMask(this.props.mask));
|
|
302
325
|
}
|
|
303
326
|
return this.layout;
|
|
304
327
|
}
|
|
328
|
+
/**
|
|
329
|
+
* A typed text can stand for a value shown differently (`02` of a repeated hour is `B2`). When that value is the
|
|
330
|
+
* current one, the `value` prop does not change and MaskedInput would keep the typed text.
|
|
331
|
+
*/
|
|
332
|
+
rewriteInputIfShownDifferently(inputString, time) {
|
|
333
|
+
const maskedInput = this.inputRef.current;
|
|
334
|
+
const shown = time.locale("locale.d2000").format(toInputMask(this.props.mask));
|
|
335
|
+
if (maskedInput === null || shown === inputString) {
|
|
336
|
+
return;
|
|
337
|
+
}
|
|
338
|
+
const { selectionStart, selectionEnd } = maskedInput.input;
|
|
339
|
+
maskedInput.mask.setValue(shown);
|
|
340
|
+
maskedInput.setInputValue(maskedInput.mask.getValue());
|
|
341
|
+
maskedInput.input.setSelectionRange(selectionStart, selectionEnd);
|
|
342
|
+
}
|
|
305
343
|
/** Moves the keyboard focus to the text input. */
|
|
306
344
|
focus() {
|
|
307
345
|
var _a;
|
|
@@ -491,8 +529,10 @@ export default class DateTimeInput extends React.Component {
|
|
|
491
529
|
*/
|
|
492
530
|
getInputTextWidth(fontFamily, fontSize) {
|
|
493
531
|
// all digits as "0" so that the width holds for any value, not just today's
|
|
494
|
-
|
|
495
|
-
|
|
532
|
+
// and as the widest hour of a DST fold
|
|
533
|
+
const mask = toInputMask(this.props.mask).replace(AMBIGUOUS_HOUR_TOKEN, "[B0]");
|
|
534
|
+
const sample = dayjs().locale("locale.d2000").format(mask).replace(/\d/g, "0");
|
|
535
|
+
return Math.ceil(measureTextWidth(sample, `${fontSize}px ${quoteFontFamilies(fontFamily)}`));
|
|
496
536
|
}
|
|
497
537
|
/** Renders the masked input with its calendar icon, without the popup. */
|
|
498
538
|
renderInput() {
|
|
@@ -530,7 +570,7 @@ export default class DateTimeInput extends React.Component {
|
|
|
530
570
|
event.stopPropagation();
|
|
531
571
|
}
|
|
532
572
|
} },
|
|
533
|
-
React.createElement(MaskedInput, { mask: this.getLayout().pattern, formatCharacters:
|
|
573
|
+
React.createElement(MaskedInput, { mask: this.getLayout().pattern, formatCharacters: MASK_FORMAT_CHARACTERS, variant: variant, status: mergedStatus, ref: this.inputRef, style: maskedInputStyle, size: size, value: (this.state.focused || unix !== D2000UnixTimeNullValue * 1000) ? ((_a = value === null || value === void 0 ? void 0 : value.locale("locale.d2000").format(toInputMask(this.props.mask))) !== null && _a !== void 0 ? _a : "") : "", placeholder: (!this.state.focused && unix === D2000UnixTimeNullValue * 1000) ? "Null Time" : undefined, onFocus: (event => {
|
|
534
574
|
event.target.selectionStart = event.target.selectionEnd = this.state.currentPos;
|
|
535
575
|
this.setState({ focused: true });
|
|
536
576
|
}), onBlur: () => {
|
|
@@ -540,6 +580,7 @@ export default class DateTimeInput extends React.Component {
|
|
|
540
580
|
const value = DateTimeInput.parseDateTimeFormat(this.props.value, inputString, this.getLayout(), event.target.selectionStart);
|
|
541
581
|
const valid = DateTimeInput.isValidValue(value.time, this.props.minDateTime, this.props.maxDateTime, this.props.allowClear) || (!!this.props.allowClear && !inputString);
|
|
542
582
|
if (value.time !== undefined && valid) {
|
|
583
|
+
this.rewriteInputIfShownDifferently(inputString, value.time);
|
|
543
584
|
onChange === null || onChange === void 0 ? void 0 : onChange(value.time.clone());
|
|
544
585
|
}
|
|
545
586
|
else if (!!this.props.allowClear && !inputString) {
|
|
@@ -642,6 +683,7 @@ export default class DateTimeInput extends React.Component {
|
|
|
642
683
|
// fields the mask does not carry keep the value they have in `base`
|
|
643
684
|
const nominal = DateTimeInput.toWallClock(base);
|
|
644
685
|
let time = base;
|
|
686
|
+
let occurrence = undefined;
|
|
645
687
|
// iterated in DATE_TIME_DATA_MAP order, not in mask order - the day has to be set after
|
|
646
688
|
// the year and the month so that it is not clamped by the month it is temporarily in
|
|
647
689
|
for (const v of DATE_TIME_DATA_MAP) {
|
|
@@ -649,7 +691,12 @@ export default class DateTimeInput extends React.Component {
|
|
|
649
691
|
if (segment === undefined) {
|
|
650
692
|
continue;
|
|
651
693
|
}
|
|
652
|
-
let
|
|
694
|
+
let text = value.substring(segment.index, segment.index + segment.length);
|
|
695
|
+
if (segment.token === AMBIGUOUS_HOUR_TOKEN && (text[0] === "A" || text[0] === "B")) {
|
|
696
|
+
occurrence = text[0];
|
|
697
|
+
text = text.substring(1);
|
|
698
|
+
}
|
|
699
|
+
let val = Number(text);
|
|
653
700
|
if (isNaN(val) || val < segment.min || val > segment.max) {
|
|
654
701
|
return invalid;
|
|
655
702
|
}
|
|
@@ -663,14 +710,28 @@ export default class DateTimeInput extends React.Component {
|
|
|
663
710
|
nominal[v.part] = val;
|
|
664
711
|
time = time === null || time === void 0 ? void 0 : time.set(v.unit === "d" ? 'D' : v.unit, val);
|
|
665
712
|
}
|
|
666
|
-
// `time` has already
|
|
667
|
-
// the
|
|
668
|
-
// of a DST fold are reachable
|
|
713
|
+
// `time` has already rolled a wall clock that does not exist (DST gap, 31.02.) over to another one, so the
|
|
714
|
+
// instant is rebuilt from the typed reading - with the UTC offset when the mask carries it, so that both sides
|
|
715
|
+
// of a DST fold are reachable
|
|
669
716
|
const offsetSegment = layout.segments.find((s) => s.entry === undefined);
|
|
670
717
|
if (offsetSegment !== undefined) {
|
|
671
718
|
const offset = DateTimeInput.parseUtcOffset(value.substring(offsetSegment.index, offsetSegment.index + offsetSegment.length));
|
|
672
719
|
time = offset === undefined ? undefined : DateTimeInput.resolveWallClock(nominal, offset);
|
|
673
720
|
}
|
|
721
|
+
else {
|
|
722
|
+
const utcMs = Date.UTC(nominal.y, nominal.M, nominal.D, nominal.h, nominal.m, nominal.s, nominal.ms);
|
|
723
|
+
const instants = getWallClockInstants(utcMs, (ms) => dayjs(ms))
|
|
724
|
+
.filter((instant) => DateTimeInput.isSameWallClock(DateTimeInput.toWallClock(instant), nominal));
|
|
725
|
+
if (occurrence !== undefined) {
|
|
726
|
+
time = instants.length === 2 ? instants[occurrence === "A" ? 0 : 1] : undefined;
|
|
727
|
+
}
|
|
728
|
+
else if (instants.length === 0) {
|
|
729
|
+
time = undefined;
|
|
730
|
+
}
|
|
731
|
+
else if (layout.segments.some((s) => s.token === AMBIGUOUS_HOUR_TOKEN)) {
|
|
732
|
+
time = instants[instants.length - 1];
|
|
733
|
+
}
|
|
734
|
+
}
|
|
674
735
|
if (time === undefined) {
|
|
675
736
|
return invalid;
|
|
676
737
|
}
|