@economic/taco 17.0.0-EC-00123-table3-bundle.1 → 17.0.0-alpha-rules.0
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/dist/charts/components/types.d.ts +1 -1
- package/dist/charts/components/useChartData.cjs +1 -2
- package/dist/charts/components/useChartData.js +1 -2
- package/dist/components/Datepicker/useDatepicker.cjs +3 -3
- package/dist/components/Datepicker/useDatepicker.js +3 -3
- package/dist/components/Provider/Localization.cjs +2 -18
- package/dist/components/Provider/Localization.d.ts +7 -14
- package/dist/components/Provider/Localization.js +2 -18
- package/dist/components/Table3/components/Columns/Cell/EditingControlCell.cjs +17 -16
- package/dist/components/Table3/components/Columns/Cell/EditingControlCell.js +18 -17
- package/dist/index.cjs +0 -4
- package/dist/index.js +1 -5
- package/dist/primitives/Table/Core/components/Body/Body.cjs +1 -1
- package/dist/primitives/Table/Core/components/Body/Body.js +1 -1
- package/dist/primitives/Table/Core/components/Footer/Summary.cjs +4 -6
- package/dist/primitives/Table/Core/components/Footer/Summary.js +4 -6
- package/dist/primitives/Table/Core/components/Header/Header.cjs +3 -7
- package/dist/primitives/Table/Core/components/Header/Header.d.ts +2 -4
- package/dist/primitives/Table/Core/components/Header/Header.js +4 -8
- package/dist/primitives/Table/Core/components/Header/components/Resizer.cjs +3 -11
- package/dist/primitives/Table/Core/components/Header/components/Resizer.d.ts +4 -6
- package/dist/primitives/Table/Core/components/Header/components/Resizer.js +3 -11
- package/dist/primitives/Table/Core/components/Header/util.d.ts +2 -3
- package/dist/primitives/Table/Core/components/Toolbar/components/Filters/ManageFiltersPopover.cjs +4 -7
- package/dist/primitives/Table/Core/components/Toolbar/components/Filters/ManageFiltersPopover.js +4 -7
- package/dist/primitives/Table/Core/features/useTableRenderer.cjs +0 -10
- package/dist/primitives/Table/Core/features/useTableRenderer.js +0 -10
- package/dist/primitives/Table/Core/features/useTableStyleGrid.cjs +2 -7
- package/dist/primitives/Table/Core/features/useTableStyleGrid.js +3 -8
- package/dist/primitives/Table/types.d.ts +2 -5
- package/dist/primitives/Table/useTableManager/listeners/useTableFontSizeListener.cjs +0 -3
- package/dist/primitives/Table/useTableManager/listeners/useTableFontSizeListener.js +0 -3
- package/dist/primitives/Table/useTableManager/useTableManager.cjs +0 -3
- package/dist/primitives/Table/useTableManager/useTableManager.d.ts +2 -4
- package/dist/primitives/Table/useTableManager/useTableManager.js +0 -3
- package/dist/primitives/Table/useTableManager/util/columns.cjs +0 -8
- package/dist/primitives/Table/useTableManager/util/columns.d.ts +2 -5
- package/dist/primitives/Table/useTableManager/util/columns.js +0 -8
- package/dist/primitives/Table/useTableManager/util/dataTypes.cjs +10 -29
- package/dist/primitives/Table/useTableManager/util/dataTypes.d.ts +2 -5
- package/dist/primitives/Table/useTableManager/util/dataTypes.js +12 -31
- package/dist/primitives/Table/useTableManager/util/filtering.cjs +1 -1
- package/dist/primitives/Table/useTableManager/util/filtering.js +2 -2
- package/dist/primitives/Table/useTableManager/util/rows.cjs +2 -10
- package/dist/primitives/Table/useTableManager/util/rows.d.ts +4 -1
- package/dist/primitives/Table/useTableManager/util/rows.js +2 -10
- package/dist/primitives/Table/useTableManager/util/search.cjs +1 -1
- package/dist/primitives/Table/useTableManager/util/search.js +1 -1
- package/dist/primitives/Table/useTableManager/util/settings.cjs +1 -1
- package/dist/primitives/Table/useTableManager/util/settings.d.ts +3 -4
- package/dist/primitives/Table/useTableManager/util/settings.js +1 -1
- package/dist/primitives/Table/useTableManager/util/setup.cjs +0 -1
- package/dist/primitives/Table/useTableManager/util/setup.d.ts +4 -4
- package/dist/primitives/Table/useTableManager/util/setup.js +0 -1
- package/dist/utils/dataTypes.cjs +34 -84
- package/dist/utils/dataTypes.d.ts +4 -28
- package/dist/utils/dataTypes.js +22 -72
- package/dist/utils/date.cjs +4 -47
- package/dist/utils/date.d.ts +0 -5
- package/dist/utils/date.js +4 -47
- package/package.json +4 -4
- package/dist/components/Table3/components/Columns/Cell/Editing/NumberInput.cjs +0 -39
- package/dist/components/Table3/components/Columns/Cell/Editing/NumberInput.d.ts +0 -10
- package/dist/components/Table3/components/Columns/Cell/Editing/NumberInput.js +0 -39
- package/dist/primitives/Table/useTableManager/features/useTableColumnSizing.cjs +0 -32
- package/dist/primitives/Table/useTableManager/features/useTableColumnSizing.d.ts +0 -5
- package/dist/primitives/Table/useTableManager/features/useTableColumnSizing.js +0 -32
|
@@ -57,7 +57,7 @@ export type CartesianChartProps<TData extends object> = {
|
|
|
57
57
|
} & ChartProps;
|
|
58
58
|
export type PolarChartProps = {
|
|
59
59
|
/** Format the displayed value
|
|
60
|
-
* @default
|
|
60
|
+
* @default Intl.NumberFormat
|
|
61
61
|
*/
|
|
62
62
|
formatter?: ChartValueFormatter;
|
|
63
63
|
/** Text representation of data, used in tooltips and totals */
|
|
@@ -3,12 +3,11 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
|
3
3
|
const React = require("react");
|
|
4
4
|
const color = require("../utils/color.cjs");
|
|
5
5
|
const Localization = require("../../components/Provider/Localization.cjs");
|
|
6
|
-
const dataTypes = require("../../utils/dataTypes.cjs");
|
|
7
6
|
function useChart(children, options) {
|
|
8
7
|
const [activeIndex, setActiveIndex] = React.useState();
|
|
9
8
|
const [hiddenItems, toggleItem] = useChartDataHiddenState();
|
|
10
9
|
const localization = Localization.useLocalization();
|
|
11
|
-
const defaultFormatter = (value) =>
|
|
10
|
+
const defaultFormatter = (value) => new Intl.NumberFormat(localization.locale, { minimumFractionDigits: 2 }).format(value);
|
|
12
11
|
const globalFormatter = options?.formatter ?? defaultFormatter;
|
|
13
12
|
const { items, shapes } = React.useMemo(() => {
|
|
14
13
|
const items2 = React.Children.toArray(children).filter((child) => React.isValidElement(child)).map((child) => {
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import React__default from "react";
|
|
2
2
|
import { getThemeColor } from "../utils/color.js";
|
|
3
3
|
import { useLocalization } from "../../components/Provider/Localization.js";
|
|
4
|
-
import { formatNumber } from "../../utils/dataTypes.js";
|
|
5
4
|
function useChart(children, options) {
|
|
6
5
|
const [activeIndex, setActiveIndex] = React__default.useState();
|
|
7
6
|
const [hiddenItems, toggleItem] = useChartDataHiddenState();
|
|
8
7
|
const localization = useLocalization();
|
|
9
|
-
const defaultFormatter = (value) =>
|
|
8
|
+
const defaultFormatter = (value) => new Intl.NumberFormat(localization.locale, { minimumFractionDigits: 2 }).format(value);
|
|
10
9
|
const globalFormatter = options?.formatter ?? defaultFormatter;
|
|
11
10
|
const { items, shapes } = React__default.useMemo(() => {
|
|
12
11
|
const items2 = React__default.Children.toArray(children).filter((child) => React__default.isValidElement(child)).map((child) => {
|
|
@@ -33,7 +33,7 @@ const useDatepicker = ({ defaultValue: _, calendar, onBlur, onChange, value, ...
|
|
|
33
33
|
if (formattedValue !== internalValue) {
|
|
34
34
|
setInternalValue(formattedValue ?? "");
|
|
35
35
|
}
|
|
36
|
-
}, [value
|
|
36
|
+
}, [value]);
|
|
37
37
|
const isDisabledDay = React__namespace.useMemo(() => {
|
|
38
38
|
if (originalValueAsDate && calendar?.disabledDays) {
|
|
39
39
|
return reactDayPicker.isMatch(originalValueAsDate, calendar?.disabledDays);
|
|
@@ -44,11 +44,11 @@ const useDatepicker = ({ defaultValue: _, calendar, onBlur, onChange, value, ...
|
|
|
44
44
|
event.persist();
|
|
45
45
|
const valueAsDate = date.parseFromCustomString(
|
|
46
46
|
event.target.value,
|
|
47
|
-
|
|
47
|
+
"dd.mm.yy",
|
|
48
48
|
originalValueAsDate?.getMonth(),
|
|
49
49
|
originalValueAsDate?.getFullYear()
|
|
50
50
|
);
|
|
51
|
-
const formattedValue = valueAsDate ? date.format(valueAsDate
|
|
51
|
+
const formattedValue = valueAsDate ? date.format(valueAsDate) || "" : "";
|
|
52
52
|
event.target.value = formattedValue;
|
|
53
53
|
const isEmpty = !event.target.value.trim();
|
|
54
54
|
if (onChange) {
|
|
@@ -14,7 +14,7 @@ const useDatepicker = ({ defaultValue: _, calendar, onBlur, onChange, value, ...
|
|
|
14
14
|
if (formattedValue !== internalValue) {
|
|
15
15
|
setInternalValue(formattedValue ?? "");
|
|
16
16
|
}
|
|
17
|
-
}, [value
|
|
17
|
+
}, [value]);
|
|
18
18
|
const isDisabledDay = React.useMemo(() => {
|
|
19
19
|
if (originalValueAsDate && calendar?.disabledDays) {
|
|
20
20
|
return isMatch(originalValueAsDate, calendar?.disabledDays);
|
|
@@ -25,11 +25,11 @@ const useDatepicker = ({ defaultValue: _, calendar, onBlur, onChange, value, ...
|
|
|
25
25
|
event.persist();
|
|
26
26
|
const valueAsDate = parseFromCustomString(
|
|
27
27
|
event.target.value,
|
|
28
|
-
|
|
28
|
+
"dd.mm.yy",
|
|
29
29
|
originalValueAsDate?.getMonth(),
|
|
30
30
|
originalValueAsDate?.getFullYear()
|
|
31
31
|
);
|
|
32
|
-
const formattedValue = valueAsDate ? format(valueAsDate
|
|
32
|
+
const formattedValue = valueAsDate ? format(valueAsDate) || "" : "";
|
|
33
33
|
event.target.value = formattedValue;
|
|
34
34
|
const isEmpty = !event.target.value.trim();
|
|
35
35
|
if (onChange) {
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
3
|
const React = require("react");
|
|
4
|
-
const date = require("../../utils/date.cjs");
|
|
5
4
|
function _interopNamespaceDefault(e) {
|
|
6
5
|
const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
|
|
7
6
|
if (e) {
|
|
@@ -349,27 +348,12 @@ const defaultLocalizationContext = {
|
|
|
349
348
|
locale: "da-DK",
|
|
350
349
|
texts: defaultLocalisationTexts,
|
|
351
350
|
formatting: {
|
|
352
|
-
date:
|
|
353
|
-
time: date.MASK_TIME
|
|
351
|
+
date: "dd.mm.yy"
|
|
354
352
|
}
|
|
355
353
|
};
|
|
356
354
|
const LocalizationContext = React__namespace.createContext(defaultLocalizationContext);
|
|
357
|
-
const fillInFormattingDefaults = (localization) => ({
|
|
358
|
-
...localization,
|
|
359
|
-
formatting: {
|
|
360
|
-
...localization.formatting,
|
|
361
|
-
date: localization.formatting.date || date.MASK_DATE,
|
|
362
|
-
time: localization.formatting.time || date.MASK_TIME,
|
|
363
|
-
numberDecimalSeparator: localization.formatting.numberDecimalSeparator || void 0,
|
|
364
|
-
numberGroupSeparator: localization.formatting.numberGroupSeparator || void 0
|
|
365
|
-
}
|
|
366
|
-
});
|
|
367
355
|
const LocalizationProvider = ({ localization, children }) => {
|
|
368
|
-
|
|
369
|
-
() => localization ? fillInFormattingDefaults(localization) : defaultLocalizationContext,
|
|
370
|
-
[localization]
|
|
371
|
-
);
|
|
372
|
-
return /* @__PURE__ */ React__namespace.createElement(LocalizationContext.Provider, { value }, children);
|
|
356
|
+
return /* @__PURE__ */ React__namespace.createElement(LocalizationContext.Provider, { value: localization ?? defaultLocalizationContext }, children);
|
|
373
357
|
};
|
|
374
358
|
const useLocalization = () => React__namespace.useContext(LocalizationContext);
|
|
375
359
|
exports.LocalizationContext = LocalizationContext;
|
|
@@ -61,26 +61,19 @@ export type LocalizationTexts = {
|
|
|
61
61
|
/** Localized texts and aria-labels for [Drawer](component:drawer) component */
|
|
62
62
|
drawer: DrawerTexts;
|
|
63
63
|
};
|
|
64
|
-
export type LocalizationFormatting = {
|
|
65
|
-
/** Date mask built from the `dd`, `mm`, `yy` and `yyyy` tokens. Default value is `dd.mm.yy` */
|
|
66
|
-
date: string;
|
|
67
|
-
/** Time mask built from the `HH`, `mm` and `ss` tokens. Default value is `HH:mm` */
|
|
68
|
-
time?: string;
|
|
69
|
-
/** Decimal separator, derived from `locale` when omitted or empty */
|
|
70
|
-
numberDecimalSeparator?: string;
|
|
71
|
-
/** Thousands separator, derived from `locale` when omitted or empty */
|
|
72
|
-
numberGroupSeparator?: string;
|
|
73
|
-
};
|
|
74
64
|
export type Localization = {
|
|
75
65
|
/**
|
|
76
|
-
*
|
|
77
|
-
* Default value is `
|
|
66
|
+
* Provide the language code used in application.
|
|
67
|
+
* Default value is `en-GB`
|
|
78
68
|
*/
|
|
79
69
|
locale: string;
|
|
80
70
|
/** Provide the texts and aria-labels for components used within the provider */
|
|
81
71
|
texts: LocalizationTexts;
|
|
82
|
-
/**
|
|
83
|
-
formatting:
|
|
72
|
+
/** Provide the formatting */
|
|
73
|
+
formatting: {
|
|
74
|
+
/** Default value is `dd.mm.yy` */
|
|
75
|
+
date: string;
|
|
76
|
+
};
|
|
84
77
|
};
|
|
85
78
|
export declare const defaultLocalisationTexts: {
|
|
86
79
|
banner: {
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
import { MASK_TIME, MASK_DATE } from "../../utils/date.js";
|
|
3
2
|
const defaultLocalisationTexts = {
|
|
4
3
|
banner: {
|
|
5
4
|
close: "Close"
|
|
@@ -330,27 +329,12 @@ const defaultLocalizationContext = {
|
|
|
330
329
|
locale: "da-DK",
|
|
331
330
|
texts: defaultLocalisationTexts,
|
|
332
331
|
formatting: {
|
|
333
|
-
date:
|
|
334
|
-
time: MASK_TIME
|
|
332
|
+
date: "dd.mm.yy"
|
|
335
333
|
}
|
|
336
334
|
};
|
|
337
335
|
const LocalizationContext = React.createContext(defaultLocalizationContext);
|
|
338
|
-
const fillInFormattingDefaults = (localization) => ({
|
|
339
|
-
...localization,
|
|
340
|
-
formatting: {
|
|
341
|
-
...localization.formatting,
|
|
342
|
-
date: localization.formatting.date || MASK_DATE,
|
|
343
|
-
time: localization.formatting.time || MASK_TIME,
|
|
344
|
-
numberDecimalSeparator: localization.formatting.numberDecimalSeparator || void 0,
|
|
345
|
-
numberGroupSeparator: localization.formatting.numberGroupSeparator || void 0
|
|
346
|
-
}
|
|
347
|
-
});
|
|
348
336
|
const LocalizationProvider = ({ localization, children }) => {
|
|
349
|
-
|
|
350
|
-
() => localization ? fillInFormattingDefaults(localization) : defaultLocalizationContext,
|
|
351
|
-
[localization]
|
|
352
|
-
);
|
|
353
|
-
return /* @__PURE__ */ React.createElement(LocalizationContext.Provider, { value }, children);
|
|
337
|
+
return /* @__PURE__ */ React.createElement(LocalizationContext.Provider, { value: localization ?? defaultLocalizationContext }, children);
|
|
354
338
|
};
|
|
355
339
|
const useLocalization = () => React.useContext(LocalizationContext);
|
|
356
340
|
export {
|
|
@@ -10,7 +10,6 @@ const rows = require("../../../../../primitives/Table/useTableManager/util/rows.
|
|
|
10
10
|
const date = require("../../../../../utils/date.cjs");
|
|
11
11
|
const dom = require("../../../../../utils/dom.cjs");
|
|
12
12
|
const keyboard = require("../../../../../utils/keyboard.cjs");
|
|
13
|
-
const NumberInput = require("./Editing/NumberInput.cjs");
|
|
14
13
|
const RowMoveIndicator = require("./Editing/RowMoveIndicator.cjs");
|
|
15
14
|
const TextareaWithAutosizing = require("./Editing/TextareaWithAutosizing.cjs");
|
|
16
15
|
const util = require("./util.cjs");
|
|
@@ -87,7 +86,7 @@ function EditingControlCell(props) {
|
|
|
87
86
|
invalid: !!error,
|
|
88
87
|
isDetailedMode: tableMeta.editing.isDetailedMode,
|
|
89
88
|
isTruncated: !!columnMeta?.enableTruncate,
|
|
90
|
-
|
|
89
|
+
locale: locale.locale,
|
|
91
90
|
onBlur: handleBlur,
|
|
92
91
|
onChange: handleChange,
|
|
93
92
|
onExitDetailedMode: handleExitDetailedMode,
|
|
@@ -117,7 +116,7 @@ const MemoedEditingCell = React.memo(function MemoedEditingCell2(props) {
|
|
|
117
116
|
invalid,
|
|
118
117
|
isDetailedMode,
|
|
119
118
|
isTruncated,
|
|
120
|
-
|
|
119
|
+
locale,
|
|
121
120
|
onBlur,
|
|
122
121
|
onChange,
|
|
123
122
|
onExitDetailedMode,
|
|
@@ -257,7 +256,7 @@ const MemoedEditingCell = React.memo(function MemoedEditingCell2(props) {
|
|
|
257
256
|
}
|
|
258
257
|
const handleChange = (event) => {
|
|
259
258
|
const dataTypeProps = dataTypes.getDataTypeProperties(dataType);
|
|
260
|
-
onChange(dataTypeProps.parse?.(event.target.value,
|
|
259
|
+
onChange(dataTypeProps.parse?.(event.target.value, locale) ?? event.target.value);
|
|
261
260
|
};
|
|
262
261
|
if (type === "textarea") {
|
|
263
262
|
return /* @__PURE__ */ React.createElement(
|
|
@@ -276,17 +275,19 @@ const MemoedEditingCell = React.memo(function MemoedEditingCell2(props) {
|
|
|
276
275
|
}
|
|
277
276
|
);
|
|
278
277
|
}
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
278
|
+
return /* @__PURE__ */ React.createElement(
|
|
279
|
+
Input.Input,
|
|
280
|
+
{
|
|
281
|
+
...commonProps,
|
|
282
|
+
invalid,
|
|
283
|
+
onChange: handleChange,
|
|
284
|
+
onFocus: handleFocus,
|
|
285
|
+
onKeyDown: handleInputKeyDown,
|
|
286
|
+
onPaste: handlePaste,
|
|
287
|
+
ref: controlRef,
|
|
288
|
+
type: dataType === "number" ? "number" : void 0,
|
|
289
|
+
value: dataType === "number" ? value : String(value ?? "")
|
|
290
|
+
}
|
|
291
|
+
);
|
|
291
292
|
});
|
|
292
293
|
exports.EditingControlCell = EditingControlCell;
|
|
@@ -3,12 +3,11 @@ import React__default from "react";
|
|
|
3
3
|
import { useLazyEffect } from "../../../../../hooks/useLazyEffect.js";
|
|
4
4
|
import { getCellAttributes } from "../../../../../primitives/Table/Core/components/Columns/Cell/util.js";
|
|
5
5
|
import { RowContext } from "../../../../../primitives/Table/Core/components/Row/RowContext.js";
|
|
6
|
-
import {
|
|
6
|
+
import { getDataTypeProperties } from "../../../../../primitives/Table/useTableManager/util/dataTypes.js";
|
|
7
7
|
import { getTableMeta } from "../../../../../primitives/Table/useTableManager/util/rows.js";
|
|
8
8
|
import { parse, isWeakEqual } from "../../../../../utils/date.js";
|
|
9
9
|
import { isElementInsideOrTriggeredFromContainer } from "../../../../../utils/dom.js";
|
|
10
10
|
import { isPressingMetaKey } from "../../../../../utils/keyboard.js";
|
|
11
|
-
import { NumberInput } from "./Editing/NumberInput.js";
|
|
12
11
|
import { RowMoveIndicator } from "./Editing/RowMoveIndicator.js";
|
|
13
12
|
import { TextareaWithAutosizing } from "./Editing/TextareaWithAutosizing.js";
|
|
14
13
|
import { useEditingCellAutofocus } from "./util.js";
|
|
@@ -85,7 +84,7 @@ function EditingControlCell(props) {
|
|
|
85
84
|
invalid: !!error,
|
|
86
85
|
isDetailedMode: tableMeta.editing.isDetailedMode,
|
|
87
86
|
isTruncated: !!columnMeta?.enableTruncate,
|
|
88
|
-
|
|
87
|
+
locale: locale.locale,
|
|
89
88
|
onBlur: handleBlur,
|
|
90
89
|
onChange: handleChange,
|
|
91
90
|
onExitDetailedMode: handleExitDetailedMode,
|
|
@@ -115,7 +114,7 @@ const MemoedEditingCell = React__default.memo(function MemoedEditingCell2(props)
|
|
|
115
114
|
invalid,
|
|
116
115
|
isDetailedMode,
|
|
117
116
|
isTruncated,
|
|
118
|
-
|
|
117
|
+
locale,
|
|
119
118
|
onBlur,
|
|
120
119
|
onChange,
|
|
121
120
|
onExitDetailedMode,
|
|
@@ -255,7 +254,7 @@ const MemoedEditingCell = React__default.memo(function MemoedEditingCell2(props)
|
|
|
255
254
|
}
|
|
256
255
|
const handleChange = (event) => {
|
|
257
256
|
const dataTypeProps = getDataTypeProperties(dataType);
|
|
258
|
-
onChange(dataTypeProps.parse?.(event.target.value,
|
|
257
|
+
onChange(dataTypeProps.parse?.(event.target.value, locale) ?? event.target.value);
|
|
259
258
|
};
|
|
260
259
|
if (type === "textarea") {
|
|
261
260
|
return /* @__PURE__ */ React__default.createElement(
|
|
@@ -274,18 +273,20 @@ const MemoedEditingCell = React__default.memo(function MemoedEditingCell2(props)
|
|
|
274
273
|
}
|
|
275
274
|
);
|
|
276
275
|
}
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
276
|
+
return /* @__PURE__ */ React__default.createElement(
|
|
277
|
+
Input,
|
|
278
|
+
{
|
|
279
|
+
...commonProps,
|
|
280
|
+
invalid,
|
|
281
|
+
onChange: handleChange,
|
|
282
|
+
onFocus: handleFocus,
|
|
283
|
+
onKeyDown: handleInputKeyDown,
|
|
284
|
+
onPaste: handlePaste,
|
|
285
|
+
ref: controlRef,
|
|
286
|
+
type: dataType === "number" ? "number" : void 0,
|
|
287
|
+
value: dataType === "number" ? value : String(value ?? "")
|
|
288
|
+
}
|
|
289
|
+
);
|
|
289
290
|
});
|
|
290
291
|
export {
|
|
291
292
|
EditingControlCell
|
package/dist/index.cjs
CHANGED
|
@@ -97,11 +97,7 @@ exports.TableFilterComparator = types$1.TableFilterComparator;
|
|
|
97
97
|
exports.DEFAULT_PAGE_SIZE = useTableDataLoader.DEFAULT_PAGE_SIZE;
|
|
98
98
|
exports.useTableDataLoader = useTableDataLoader.useTableDataLoader;
|
|
99
99
|
exports.useTableDataLoader2 = useTableDataLoader2.useTableDataLoader2;
|
|
100
|
-
exports.DATETIME_SEPARATOR = date.DATETIME_SEPARATOR;
|
|
101
|
-
exports.MASK_DATE = date.MASK_DATE;
|
|
102
|
-
exports.MASK_TIME = date.MASK_TIME;
|
|
103
100
|
exports.format = date.format;
|
|
104
|
-
exports.formatTime = date.formatTime;
|
|
105
101
|
exports.isWeakEqual = date.isWeakEqual;
|
|
106
102
|
exports.parse = date.parse;
|
|
107
103
|
exports.parseFromCustomString = date.parseFromCustomString;
|
package/dist/index.js
CHANGED
|
@@ -5,7 +5,7 @@ import * as Collection from "./primitives/Collection/Collection.js";
|
|
|
5
5
|
import { TableFilterComparator } from "./primitives/Table/types.js";
|
|
6
6
|
import { DEFAULT_PAGE_SIZE, useTableDataLoader } from "./primitives/Table/useTableDataLoader.js";
|
|
7
7
|
import { useTableDataLoader2 } from "./primitives/Table/useTableDataLoader2.js";
|
|
8
|
-
import {
|
|
8
|
+
import { format, isWeakEqual, parse, parseFromCustomString, parseFromISOString } from "./utils/date.js";
|
|
9
9
|
import { createShortcutKeyDownHandler, isMacOs, isPressingMetaKey, shouldTriggerShortcut } from "./utils/keyboard.js";
|
|
10
10
|
import { mergeRefs } from "./utils/mergeRefs.js";
|
|
11
11
|
import { useBoundaryOverflowDetection } from "./hooks/useBoundaryOverflowDetection.js";
|
|
@@ -108,7 +108,6 @@ export {
|
|
|
108
108
|
Checkbox,
|
|
109
109
|
Collection as CollectionPrimitive,
|
|
110
110
|
Combobox,
|
|
111
|
-
DATETIME_SEPARATOR,
|
|
112
111
|
DEFAULT_PAGE_SIZE,
|
|
113
112
|
Datepicker,
|
|
114
113
|
Dialog,
|
|
@@ -135,8 +134,6 @@ export {
|
|
|
135
134
|
List,
|
|
136
135
|
LocalizationContext,
|
|
137
136
|
LocalizationProvider,
|
|
138
|
-
MASK_DATE,
|
|
139
|
-
MASK_TIME,
|
|
140
137
|
Menu,
|
|
141
138
|
Navigation2,
|
|
142
139
|
OverflowGroup,
|
|
@@ -175,7 +172,6 @@ export {
|
|
|
175
172
|
defaultLocalizationContext,
|
|
176
173
|
fixedForwardRef,
|
|
177
174
|
format,
|
|
178
|
-
formatTime,
|
|
179
175
|
getNavigationLinkClasses,
|
|
180
176
|
getNextIndexFromKey,
|
|
181
177
|
icons,
|
|
@@ -66,7 +66,7 @@ function Body(props) {
|
|
|
66
66
|
};
|
|
67
67
|
const handleMouseMove = React__default.useCallback(
|
|
68
68
|
(event) => {
|
|
69
|
-
if (!(event.target instanceof
|
|
69
|
+
if (!(event.target instanceof HTMLElement)) {
|
|
70
70
|
return;
|
|
71
71
|
}
|
|
72
72
|
const currentTable = ref.current?.closest("table");
|
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
3
|
const React = require("react");
|
|
4
|
-
const dataTypes = require("../../../../../utils/dataTypes.cjs");
|
|
5
4
|
const rows = require("../../../useTableManager/util/rows.cjs");
|
|
6
5
|
const Localization = require("../../../../../components/Provider/Localization.cjs");
|
|
7
6
|
function Summary(props) {
|
|
8
7
|
const { table } = props;
|
|
9
|
-
const
|
|
10
|
-
const { texts } = localization;
|
|
8
|
+
const { locale, texts } = Localization.useLocalization();
|
|
11
9
|
const tableMeta = rows.getTableMeta(table);
|
|
12
10
|
const length = tableMeta.length;
|
|
13
11
|
const currentLength = table.getRowModel().rows.length;
|
|
@@ -16,14 +14,14 @@ function Summary(props) {
|
|
|
16
14
|
const rowsSelectedLength = Object.keys(table.getState().rowSelection).length;
|
|
17
15
|
if (rowsSelectedLength > 0) {
|
|
18
16
|
label = texts.table.footer.summary.selected;
|
|
19
|
-
count = /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("strong", null,
|
|
17
|
+
count = /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("strong", null, new Intl.NumberFormat(locale).format(rowsSelectedLength)), " ", texts.table.footer.summary.count, " ", /* @__PURE__ */ React.createElement("strong", null, new Intl.NumberFormat(locale).format(length)));
|
|
20
18
|
} else if (!tableMeta.server.isEnabled && (table.getState().columnFilters?.length || // filtered data
|
|
21
19
|
!!table.getState().globalFilter && table.options.enableGlobalFilter)) {
|
|
22
20
|
label = texts.table.footer.summary.records;
|
|
23
|
-
count = /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("strong", { "data-taco": "table-footer-current-count" },
|
|
21
|
+
count = /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("strong", { "data-taco": "table-footer-current-count" }, new Intl.NumberFormat(locale).format(currentLength)), " ", texts.table.footer.summary.count, " ", /* @__PURE__ */ React.createElement("strong", { "data-taco": "table-footer-total-count" }, new Intl.NumberFormat(locale).format(length)));
|
|
24
22
|
} else {
|
|
25
23
|
label = texts.table.footer.summary.records;
|
|
26
|
-
count = /* @__PURE__ */ React.createElement("strong", { "data-taco": "table-footer-total-count" },
|
|
24
|
+
count = /* @__PURE__ */ React.createElement("strong", { "data-taco": "table-footer-total-count" }, new Intl.NumberFormat(locale).format(length));
|
|
27
25
|
}
|
|
28
26
|
return /* @__PURE__ */ React.createElement(
|
|
29
27
|
"div",
|
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
import React__default from "react";
|
|
2
|
-
import { formatNumber } from "../../../../../utils/dataTypes.js";
|
|
3
2
|
import { getTableMeta } from "../../../useTableManager/util/rows.js";
|
|
4
3
|
import { useLocalization } from "../../../../../components/Provider/Localization.js";
|
|
5
4
|
function Summary(props) {
|
|
6
5
|
const { table } = props;
|
|
7
|
-
const
|
|
8
|
-
const { texts } = localization;
|
|
6
|
+
const { locale, texts } = useLocalization();
|
|
9
7
|
const tableMeta = getTableMeta(table);
|
|
10
8
|
const length = tableMeta.length;
|
|
11
9
|
const currentLength = table.getRowModel().rows.length;
|
|
@@ -14,14 +12,14 @@ function Summary(props) {
|
|
|
14
12
|
const rowsSelectedLength = Object.keys(table.getState().rowSelection).length;
|
|
15
13
|
if (rowsSelectedLength > 0) {
|
|
16
14
|
label = texts.table.footer.summary.selected;
|
|
17
|
-
count = /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, /* @__PURE__ */ React__default.createElement("strong", null,
|
|
15
|
+
count = /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, /* @__PURE__ */ React__default.createElement("strong", null, new Intl.NumberFormat(locale).format(rowsSelectedLength)), " ", texts.table.footer.summary.count, " ", /* @__PURE__ */ React__default.createElement("strong", null, new Intl.NumberFormat(locale).format(length)));
|
|
18
16
|
} else if (!tableMeta.server.isEnabled && (table.getState().columnFilters?.length || // filtered data
|
|
19
17
|
!!table.getState().globalFilter && table.options.enableGlobalFilter)) {
|
|
20
18
|
label = texts.table.footer.summary.records;
|
|
21
|
-
count = /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, /* @__PURE__ */ React__default.createElement("strong", { "data-taco": "table-footer-current-count" },
|
|
19
|
+
count = /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, /* @__PURE__ */ React__default.createElement("strong", { "data-taco": "table-footer-current-count" }, new Intl.NumberFormat(locale).format(currentLength)), " ", texts.table.footer.summary.count, " ", /* @__PURE__ */ React__default.createElement("strong", { "data-taco": "table-footer-total-count" }, new Intl.NumberFormat(locale).format(length)));
|
|
22
20
|
} else {
|
|
23
21
|
label = texts.table.footer.summary.records;
|
|
24
|
-
count = /* @__PURE__ */ React__default.createElement("strong", { "data-taco": "table-footer-total-count" },
|
|
22
|
+
count = /* @__PURE__ */ React__default.createElement("strong", { "data-taco": "table-footer-total-count" }, new Intl.NumberFormat(locale).format(length));
|
|
25
23
|
}
|
|
26
24
|
return /* @__PURE__ */ React__default.createElement(
|
|
27
25
|
"div",
|
|
@@ -63,10 +63,9 @@ function Header(props) {
|
|
|
63
63
|
parentId: header.column.parent?.id,
|
|
64
64
|
scrollToIndex,
|
|
65
65
|
setRowActiveIndex: tableMeta.rowActive.setRowActiveIndex,
|
|
66
|
-
|
|
67
|
-
setColumnSizing: columns.getColumnSizingSetter(table),
|
|
66
|
+
setColumnSizing: table.setColumnSizing,
|
|
68
67
|
tooltip: columnMeta?.tooltip,
|
|
69
|
-
width:
|
|
68
|
+
width: table.getState().columnSizing[header.id]
|
|
70
69
|
};
|
|
71
70
|
if (header.isPlaceholder) {
|
|
72
71
|
const nextHeader = header.headerGroup.headers[header.index + 1];
|
|
@@ -143,7 +142,7 @@ const MemoedHeader = React.memo(function MemoedHeader2(props) {
|
|
|
143
142
|
isGroup,
|
|
144
143
|
isPinned,
|
|
145
144
|
isPlaceholder,
|
|
146
|
-
isResizing
|
|
145
|
+
isResizing,
|
|
147
146
|
offset,
|
|
148
147
|
onFilter: handleFilter,
|
|
149
148
|
onGoto: handleGoto,
|
|
@@ -155,7 +154,6 @@ const MemoedHeader = React.memo(function MemoedHeader2(props) {
|
|
|
155
154
|
resetSize: handleResetSize,
|
|
156
155
|
scrollToIndex,
|
|
157
156
|
setRowActiveIndex,
|
|
158
|
-
setColumnResized,
|
|
159
157
|
setColumnSizing,
|
|
160
158
|
sortDirection,
|
|
161
159
|
tooltip,
|
|
@@ -215,13 +213,11 @@ const MemoedHeader = React.memo(function MemoedHeader2(props) {
|
|
|
215
213
|
canResize ? /* @__PURE__ */ React.createElement(
|
|
216
214
|
Resizer.Resizer,
|
|
217
215
|
{
|
|
218
|
-
defaultWidth,
|
|
219
216
|
headerRef: ref,
|
|
220
217
|
id,
|
|
221
218
|
isResizing,
|
|
222
219
|
onResize: handleResize,
|
|
223
220
|
onResetSize: handleResetSize,
|
|
224
|
-
setColumnResized,
|
|
225
221
|
setColumnSizing,
|
|
226
222
|
width
|
|
227
223
|
}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import { Header as ReactTableHeader, ColumnPinningPosition as ReactTableColumnPinningPosition } from '@tanstack/react-table';
|
|
1
|
+
import { Header as ReactTableHeader, ColumnPinningPosition as ReactTableColumnPinningPosition, Updater, ColumnSizingState } from '@tanstack/react-table';
|
|
2
2
|
import { default as React } from 'react';
|
|
3
3
|
import { TableColumnAlignment, TableColumnMenu, TableColumnSortDirection, TableColumnWidth } from '../../../types';
|
|
4
|
-
import { TableColumnSizingSetter } from '../../../useTableManager/util/columns';
|
|
5
4
|
export type HeaderProps<TType = unknown> = {
|
|
6
5
|
header: ReactTableHeader<TType, unknown>;
|
|
7
6
|
scrollToIndex: (index: number) => void;
|
|
@@ -42,8 +41,7 @@ export type MemoedHeaderProps = {
|
|
|
42
41
|
resetSize?: () => void;
|
|
43
42
|
scrollToIndex: (index: number) => void;
|
|
44
43
|
setRowActiveIndex: (index: number) => void;
|
|
45
|
-
|
|
46
|
-
setColumnSizing: TableColumnSizingSetter;
|
|
44
|
+
setColumnSizing: (updater: Updater<ColumnSizingState>) => void;
|
|
47
45
|
sortDirection?: TableColumnSortDirection | false;
|
|
48
46
|
tooltip?: string;
|
|
49
47
|
width?: TableColumnWidth;
|
|
@@ -2,7 +2,7 @@ import { flexRender } from "@tanstack/react-table";
|
|
|
2
2
|
import cn from "clsx";
|
|
3
3
|
import React__default from "react";
|
|
4
4
|
import { TableFilterComparator } from "../../../types.js";
|
|
5
|
-
import { isInternalColumn,
|
|
5
|
+
import { isInternalColumn, unfreezeAllExternalColumns, freezeUptoExternalColumn } from "../../../useTableManager/util/columns.js";
|
|
6
6
|
import { getTableMeta } from "../../../useTableManager/util/rows.js";
|
|
7
7
|
import { HeaderMenu } from "./components/Menu.js";
|
|
8
8
|
import { Resizer } from "./components/Resizer.js";
|
|
@@ -61,10 +61,9 @@ function Header(props) {
|
|
|
61
61
|
parentId: header.column.parent?.id,
|
|
62
62
|
scrollToIndex,
|
|
63
63
|
setRowActiveIndex: tableMeta.rowActive.setRowActiveIndex,
|
|
64
|
-
|
|
65
|
-
setColumnSizing: getColumnSizingSetter(table),
|
|
64
|
+
setColumnSizing: table.setColumnSizing,
|
|
66
65
|
tooltip: columnMeta?.tooltip,
|
|
67
|
-
width:
|
|
66
|
+
width: table.getState().columnSizing[header.id]
|
|
68
67
|
};
|
|
69
68
|
if (header.isPlaceholder) {
|
|
70
69
|
const nextHeader = header.headerGroup.headers[header.index + 1];
|
|
@@ -141,7 +140,7 @@ const MemoedHeader = React__default.memo(function MemoedHeader2(props) {
|
|
|
141
140
|
isGroup,
|
|
142
141
|
isPinned,
|
|
143
142
|
isPlaceholder,
|
|
144
|
-
isResizing
|
|
143
|
+
isResizing,
|
|
145
144
|
offset,
|
|
146
145
|
onFilter: handleFilter,
|
|
147
146
|
onGoto: handleGoto,
|
|
@@ -153,7 +152,6 @@ const MemoedHeader = React__default.memo(function MemoedHeader2(props) {
|
|
|
153
152
|
resetSize: handleResetSize,
|
|
154
153
|
scrollToIndex,
|
|
155
154
|
setRowActiveIndex,
|
|
156
|
-
setColumnResized,
|
|
157
155
|
setColumnSizing,
|
|
158
156
|
sortDirection,
|
|
159
157
|
tooltip,
|
|
@@ -213,13 +211,11 @@ const MemoedHeader = React__default.memo(function MemoedHeader2(props) {
|
|
|
213
211
|
canResize ? /* @__PURE__ */ React__default.createElement(
|
|
214
212
|
Resizer,
|
|
215
213
|
{
|
|
216
|
-
defaultWidth,
|
|
217
214
|
headerRef: ref,
|
|
218
215
|
id,
|
|
219
216
|
isResizing,
|
|
220
217
|
onResize: handleResize,
|
|
221
218
|
onResetSize: handleResetSize,
|
|
222
|
-
setColumnResized,
|
|
223
219
|
setColumnSizing,
|
|
224
220
|
width
|
|
225
221
|
}
|
|
@@ -5,7 +5,7 @@ const React = require("react");
|
|
|
5
5
|
const Localization = require("../../../../../../components/Provider/Localization.cjs");
|
|
6
6
|
const Tooltip = require("../../../../../../components/Tooltip/Tooltip.cjs");
|
|
7
7
|
function Resizer(props) {
|
|
8
|
-
const {
|
|
8
|
+
const { headerRef, id, isResizing, onResetSize, onResize, setColumnSizing, width } = props;
|
|
9
9
|
const { texts } = Localization.useLocalization();
|
|
10
10
|
const handleClick = (event) => {
|
|
11
11
|
event.stopPropagation();
|
|
@@ -13,16 +13,8 @@ function Resizer(props) {
|
|
|
13
13
|
};
|
|
14
14
|
const handleResize = (event) => {
|
|
15
15
|
if (event.detail >= 2) {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
onResetSize?.();
|
|
19
|
-
} else {
|
|
20
|
-
setColumnSizing((sizes) => ({ ...sizes, [id]: defaultWidth }));
|
|
21
|
-
}
|
|
22
|
-
return;
|
|
23
|
-
}
|
|
24
|
-
setColumnResized(id, true);
|
|
25
|
-
if (!Number.isInteger(width) && headerRef) {
|
|
16
|
+
onResetSize();
|
|
17
|
+
} else if (!Number.isInteger(width) && headerRef) {
|
|
26
18
|
setColumnSizing((sizes) => ({
|
|
27
19
|
...sizes,
|
|
28
20
|
[id]: headerRef.getBoundingClientRect().width
|
|
@@ -1,15 +1,13 @@
|
|
|
1
|
+
import { ColumnSizingState, Updater } from '@tanstack/react-table';
|
|
1
2
|
import { default as React } from 'react';
|
|
2
3
|
import { TableColumnWidth } from '../../../../types';
|
|
3
|
-
import { TableColumnSizingSetter } from '../../../../useTableManager/util/columns';
|
|
4
4
|
type Props = {
|
|
5
|
-
defaultWidth?: TableColumnWidth;
|
|
6
5
|
headerRef: HTMLTableCellElement | null;
|
|
7
6
|
id: string;
|
|
8
7
|
isResizing: boolean;
|
|
9
|
-
onResize
|
|
10
|
-
onResetSize
|
|
11
|
-
|
|
12
|
-
setColumnSizing: TableColumnSizingSetter;
|
|
8
|
+
onResize: (event: unknown) => void;
|
|
9
|
+
onResetSize: () => void;
|
|
10
|
+
setColumnSizing: (updater: Updater<ColumnSizingState>) => void;
|
|
13
11
|
width?: TableColumnWidth;
|
|
14
12
|
};
|
|
15
13
|
export declare function Resizer(props: Props): React.JSX.Element;
|