d2coreui 23.0.59 → 23.0.61
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 +35 -0
- package/README.md +1 -1
- package/components/date/dateTimeInput.d.ts +4 -9
- package/components/date/dateTimeInput.js +19 -34
- package/components/date/dateTimeInput.js.map +1 -1
- package/components/date/durationInput.js +6 -6
- package/components/date/durationInput.js.map +1 -1
- package/components/grid/dataGrid.d.ts +34 -1
- package/components/grid/dataGrid.js +93 -59
- package/components/grid/dataGrid.js.map +1 -1
- package/components/grid/export/contextMenu.d.ts +13 -3
- package/components/grid/export/contextMenu.js +69 -31
- package/components/grid/export/contextMenu.js.map +1 -1
- package/components/grid/export/worker/csvExport.js +3 -1
- package/components/grid/export/worker/csvExport.js.map +1 -1
- package/components/grid/extendedDataGrid.d.ts +21 -4
- package/components/grid/extendedDataGrid.js +21 -3
- package/components/grid/extendedDataGrid.js.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,40 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 23.0.61
|
|
4
|
+
|
|
5
|
+
- `DataGrid` / `ExtendedDataGrid`: `exportData(exportType, options)` exports the grid to a TXT, CSV or PDF file or to
|
|
6
|
+
the clipboard the same way as the toolbar export menu, so that the export can be started from a custom button
|
|
7
|
+
outside the grid; `options.onlySelectedRows` exports only the selected rows and `options.pageOrientation` sets the
|
|
8
|
+
PDF page orientation. `toolbar.hideExportButton` hides the built-in export menu button.
|
|
9
|
+
- `grid/export/contextMenu`: `runExport(exportType, props)` runs one export of the menu built by `getContextMenu`.
|
|
10
|
+
- `grid/export/contextMenu` / `DataGrid`: a failed export no longer leaves the grid exporting with the export menu
|
|
11
|
+
items disabled - `onExport(false)` is called also after a failure, and the progress notification is replaced by an
|
|
12
|
+
error one. For the PDF export `onExport(false)` comes once the file is saved, not when its generation starts. Clicks
|
|
13
|
+
on custom menu items no longer call `onExport`.
|
|
14
|
+
- `DataGrid` / `grid/export/contextMenu`: the CSV export starts with a UTF-8 BOM, so that Excel shows characters with
|
|
15
|
+
diacritics correctly instead of opening the file in the ANSI code page.
|
|
16
|
+
|
|
17
|
+
## 23.0.60
|
|
18
|
+
|
|
19
|
+
- `ExtendedDataGrid`: `GridConfiguration.showUtcOffset` and `defaultShowUtcOffset` are no longer `true` by default -
|
|
20
|
+
without them the grid follows the global mode of `LocaleHolder.setUtcOffsetMode`. Pass `showUtcOffset: true` in
|
|
21
|
+
`defaultGridConfiguration` to keep the UTC offset in a grid.
|
|
22
|
+
- `ExtendedDataGrid`: `getGridDateTimeFormat(configuration)` returns the date-time format the grid's date-time columns
|
|
23
|
+
use (year, milliseconds and UTC offset of the table settings), for columns that format date-time values themselves.
|
|
24
|
+
- `DataGrid`: the `dateColumn`, `dateTimeColumn` and `fromNowDateTimeColumn` columns show a missing value and the D2000
|
|
25
|
+
null time as an empty cell (also in the copied and exported text) instead of `---`, `Null Time` or a date in 1972,
|
|
26
|
+
and the column filters and the quick filter no longer match the null time by its 1972 date. The time `0` is shown
|
|
27
|
+
as its date in 1970 in `dateTimeColumn` too, instead of an empty cell.
|
|
28
|
+
- `DataGrid`: Ctrl+Enter in a cell editor works like Enter instead of ag-grid's bulk edit, which wrote the value into
|
|
29
|
+
every cell of the selected rows.
|
|
30
|
+
- `DateTimeInput`: the D2000 null time is recognized (shown empty with the `Null Time` placeholder) also after
|
|
31
|
+
`setUnixTimeConversion(UnixTimeConversionEnum.FROM_MILIS)`, not only in the seconds mode.
|
|
32
|
+
- `DateTimeInput` / `DateRangeInput`: with a `Z` / `ZZ` mask the UTC offset no longer has to be typed - an empty or
|
|
33
|
+
mismatching offset is completed from the typed date and time (in the repeated hour of the daylight saving time to
|
|
34
|
+
the second one, as `B` of `HH?`), instead of leaving the value invalid until the exact offset is typed.
|
|
35
|
+
- `DurationInput`: no longer fails with `isDuration is not a function` in a Vite production build of an application,
|
|
36
|
+
when the component is loaded before the dayjs duration plugin of `d2core/dayjs` is applied.
|
|
37
|
+
|
|
3
38
|
## 23.0.59
|
|
4
39
|
|
|
5
40
|
- `DataGrid` / `ExtendedDataGrid`: `toolbar.compact` for a narrow (mobile) screen - the export and table settings
|
package/README.md
CHANGED
|
@@ -103,7 +103,7 @@ All paths are relative to `d2coreui/components/`.
|
|
|
103
103
|
| `grid/cell/tableDefaultRowStyleRules` | `RowStyleRule`, `GridRowStyle` and the default row style rules. |
|
|
104
104
|
| `grid/config/*` | Table configuration UI: `DataGridEditor`, `ColumnTransfer`, `RowStylePicker`, row height helpers. |
|
|
105
105
|
| `grid/filter/*` | Column filters and `WildcardQuickFilterEngine` (`*` / `?` quick filter). |
|
|
106
|
-
| `grid/export/contextMenu` | `getContextMenu` - row context menu with export (CSV, TXT, PDF, clipboard). |
|
|
106
|
+
| `grid/export/contextMenu` | `getContextMenu` - row context menu with export (CSV, TXT, PDF, clipboard); `runExport` - one export started outside the menu. |
|
|
107
107
|
| `grid/export/progressPopup` | Export progress notification. |
|
|
108
108
|
| `grid/header/simpleHeader`, `grid/panel/*`, `grid/detail/*` | Header, pagination, overlay and detail panel components used by the grids. |
|
|
109
109
|
| `grid/columnUtils` | `ColumnUtils.mergeColumnsState`. |
|
|
@@ -16,8 +16,10 @@ interface DateTimeInputProps extends Omit<HTMLAttributes<HTMLDivElement>, "onCha
|
|
|
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
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.
|
|
20
|
-
*
|
|
19
|
+
* Including the UTC offset makes both instants of a DST fold enterable. The offset does not have to be typed - an
|
|
20
|
+
* empty or mismatching one is completed from the wall clock, in a DST fold to the second instant (as `B` of `HH?`).
|
|
21
|
+
* `Z?` (`d2core/dayjs/ambiguousTime`) is shown as `Z` - always, so that the input does not change its layout while
|
|
22
|
+
* typed into.
|
|
21
23
|
* `HH?` (`d2core/dayjs/ambiguousTime`) is the hour shown as `A2` / `B2` in the repeated hour of a DST fold; `A` or
|
|
22
24
|
* `B` typed in place of the leading digit picks the occurrence, a repeated hour typed without it is the second
|
|
23
25
|
* one (`B`), a letter outside a DST fold is invalid.
|
|
@@ -210,13 +212,6 @@ export default class DateTimeInput extends React.Component<DateTimeInputProps, D
|
|
|
210
212
|
/** the two instants of a DST fold share the wall clock and differ only in the UTC offset */
|
|
211
213
|
private static isSameWallClock;
|
|
212
214
|
private static parseUtcOffset;
|
|
213
|
-
/**
|
|
214
|
-
* Picks the instant that shows the given wall clock at the given UTC offset. Inside a DST
|
|
215
|
-
* fold two instants share the wall clock and the offset is what tells them apart; inside a
|
|
216
|
-
* DST gap no instant matches, so the value is reported as invalid. A wall clock that does
|
|
217
|
-
* not exist at all (31.02.) is rejected by the same check rather than rolled over.
|
|
218
|
-
*/
|
|
219
|
-
private static resolveWallClock;
|
|
220
215
|
private static checkDateValueValidity;
|
|
221
216
|
private static parseDateTimeFormat;
|
|
222
217
|
private static isValidValue;
|
|
@@ -18,7 +18,7 @@ import dayjs from "d2core/dayjs";
|
|
|
18
18
|
import { CalendarOutlined } from "@ant-design/icons";
|
|
19
19
|
import { Button, Calendar, Divider, Select, Tooltip } from "antd";
|
|
20
20
|
import { Key } from "ts-key-enum";
|
|
21
|
-
import { D2000UnixTimeNullValue } from "d2core/types/unixTimeUtils";
|
|
21
|
+
import { D2000UnixTimeNullValue, unixTimeToMoment } from "d2core/types/unixTimeUtils";
|
|
22
22
|
import { createStyles } from "antd-style";
|
|
23
23
|
import WithCss from "d2coreui/components/style/withCss";
|
|
24
24
|
import i18n from "d2core/i18n/i18n";
|
|
@@ -537,7 +537,7 @@ export default class DateTimeInput extends React.Component {
|
|
|
537
537
|
/** Renders the masked input with its calendar icon, without the popup. */
|
|
538
538
|
renderInput() {
|
|
539
539
|
const _a = this.props, { mask, value, onChange, onInvalidValue, style, disabled, inputDisabled, variant, hidePopup, renderAsCalendar, allowClear, minDateTime, maxDateTime, onDateItemMouseDown, onDateItemMouseOver, onDateItemMouseUp, markedDateInterval, inputStyle, getPopupContainer, autoFocus, className, size, status, autoWidth } = _a, props = __rest(_a, ["mask", "value", "onChange", "onInvalidValue", "style", "disabled", "inputDisabled", "variant", "hidePopup", "renderAsCalendar", "allowClear", "minDateTime", "maxDateTime", "onDateItemMouseDown", "onDateItemMouseOver", "onDateItemMouseUp", "markedDateInterval", "inputStyle", "getPopupContainer", "autoFocus", "className", "size", "status", "autoWidth"]);
|
|
540
|
-
const
|
|
540
|
+
const isNullTime = (value === null || value === void 0 ? void 0 : value.valueOf()) === unixTimeToMoment(D2000UnixTimeNullValue).valueOf();
|
|
541
541
|
// an unparseable input is an error even when the caller reports no status
|
|
542
542
|
const mergedStatus = status || (!this.state.valid ? "error" : "");
|
|
543
543
|
// the root has to stay a plain DOM element - Tooltip in render() clones it to inject
|
|
@@ -570,7 +570,7 @@ export default class DateTimeInput extends React.Component {
|
|
|
570
570
|
event.stopPropagation();
|
|
571
571
|
}
|
|
572
572
|
} },
|
|
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 ||
|
|
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 || !isNullTime) ? ((_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 && isNullTime) ? "Null Time" : undefined, onFocus: (event => {
|
|
574
574
|
event.target.selectionStart = event.target.selectionEnd = this.state.currentPos;
|
|
575
575
|
this.setState({ focused: true });
|
|
576
576
|
}), onBlur: () => {
|
|
@@ -656,19 +656,6 @@ export default class DateTimeInput extends React.Component {
|
|
|
656
656
|
}
|
|
657
657
|
return match[1] === "-" ? -minutes : minutes;
|
|
658
658
|
}
|
|
659
|
-
/**
|
|
660
|
-
* Picks the instant that shows the given wall clock at the given UTC offset. Inside a DST
|
|
661
|
-
* fold two instants share the wall clock and the offset is what tells them apart; inside a
|
|
662
|
-
* DST gap no instant matches, so the value is reported as invalid. A wall clock that does
|
|
663
|
-
* not exist at all (31.02.) is rejected by the same check rather than rolled over.
|
|
664
|
-
*/
|
|
665
|
-
static resolveWallClock(nominal, offsetMinutes) {
|
|
666
|
-
const utcMs = Date.UTC(nominal.y, nominal.M, nominal.D, nominal.h, nominal.m, nominal.s, nominal.ms);
|
|
667
|
-
const candidate = dayjs(utcMs - offsetMinutes * 60000);
|
|
668
|
-
return candidate.utcOffset() === offsetMinutes && DateTimeInput.isSameWallClock(DateTimeInput.toWallClock(candidate), nominal)
|
|
669
|
-
? candidate
|
|
670
|
-
: undefined;
|
|
671
|
-
}
|
|
672
659
|
static checkDateValueValidity(value, offset, unit) {
|
|
673
660
|
if (value === null) {
|
|
674
661
|
return false;
|
|
@@ -677,7 +664,7 @@ export default class DateTimeInput extends React.Component {
|
|
|
677
664
|
return v.isValid() && v.isSameOrAfter(dayjs(0));
|
|
678
665
|
}
|
|
679
666
|
static parseDateTimeFormat(previousTime, value, layout, cursorPos) {
|
|
680
|
-
var _a;
|
|
667
|
+
var _a, _b;
|
|
681
668
|
const invalid = { time: undefined, info: undefined, length: 0 };
|
|
682
669
|
const base = dayjs().startOf("day");
|
|
683
670
|
// fields the mask does not carry keep the value they have in `base`
|
|
@@ -711,33 +698,31 @@ export default class DateTimeInput extends React.Component {
|
|
|
711
698
|
time = time === null || time === void 0 ? void 0 : time.set(v.unit === "d" ? 'D' : v.unit, val);
|
|
712
699
|
}
|
|
713
700
|
// `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
|
|
715
|
-
|
|
701
|
+
// instant is rebuilt from the typed reading
|
|
702
|
+
const utcMs = Date.UTC(nominal.y, nominal.M, nominal.D, nominal.h, nominal.m, nominal.s, nominal.ms);
|
|
703
|
+
const instants = getWallClockInstants(utcMs, (ms) => dayjs(ms))
|
|
704
|
+
.filter((instant) => DateTimeInput.isSameWallClock(DateTimeInput.toWallClock(instant), nominal));
|
|
716
705
|
const offsetSegment = layout.segments.find((s) => s.entry === undefined);
|
|
717
706
|
if (offsetSegment !== undefined) {
|
|
707
|
+
// the typed offset only picks a side of a DST fold - a missing or mismatching one is completed from the wall clock
|
|
718
708
|
const offset = DateTimeInput.parseUtcOffset(value.substring(offsetSegment.index, offsetSegment.index + offsetSegment.length));
|
|
719
|
-
time =
|
|
709
|
+
time = (_a = instants.find((instant) => instant.utcOffset() === offset)) !== null && _a !== void 0 ? _a : instants[instants.length - 1];
|
|
720
710
|
}
|
|
721
|
-
else {
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
time = undefined;
|
|
730
|
-
}
|
|
731
|
-
else if (layout.segments.some((s) => s.token === AMBIGUOUS_HOUR_TOKEN)) {
|
|
732
|
-
time = instants[instants.length - 1];
|
|
733
|
-
}
|
|
711
|
+
else if (occurrence !== undefined) {
|
|
712
|
+
time = instants.length === 2 ? instants[occurrence === "A" ? 0 : 1] : undefined;
|
|
713
|
+
}
|
|
714
|
+
else if (instants.length === 0) {
|
|
715
|
+
time = undefined;
|
|
716
|
+
}
|
|
717
|
+
else if (layout.segments.some((s) => s.token === AMBIGUOUS_HOUR_TOKEN)) {
|
|
718
|
+
time = instants[instants.length - 1];
|
|
734
719
|
}
|
|
735
720
|
if (time === undefined) {
|
|
736
721
|
return invalid;
|
|
737
722
|
}
|
|
738
723
|
const current = cursorPos === null ? undefined
|
|
739
724
|
: layout.segments.find((s) => cursorPos >= s.index && cursorPos <= s.index + s.length);
|
|
740
|
-
return { time, info: current, length: (
|
|
725
|
+
return { time, info: current, length: (_b = current === null || current === void 0 ? void 0 : current.length) !== null && _b !== void 0 ? _b : 0 };
|
|
741
726
|
}
|
|
742
727
|
static isValidValue(value, minDateTime, maxDateTime, allowClear) {
|
|
743
728
|
return (!!value && value.isValid() && (!minDateTime || value.isSameOrAfter(minDateTime)) && (!maxDateTime || value.isSameOrBefore(maxDateTime))) || (!!allowClear && value === null);
|