@economic/taco 17.1.0-EC-91962-test-release.0 → 17.2.0-EC-005678-test-tanstack-virtual.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/Bar/BarChart.cjs +39 -21
- package/dist/charts/components/Bar/BarChart.d.ts +8 -0
- package/dist/charts/components/Bar/BarChart.js +40 -22
- package/dist/charts/components/Pie/PaddedSector.cjs +80 -0
- package/dist/charts/components/Pie/PaddedSector.d.ts +7 -0
- package/dist/charts/components/Pie/PaddedSector.js +63 -0
- package/dist/charts/components/Pie/util.cjs +5 -3
- package/dist/charts/components/Pie/util.d.ts +1 -0
- package/dist/charts/components/Pie/util.js +5 -3
- package/dist/components/AlertDialog/AlertDialog.d.ts +30 -0
- package/dist/components/AlertDialog/Context.d.ts +9 -0
- package/dist/components/AlertDialog/components/Content.d.ts +18 -0
- package/dist/components/AlertDialog/components/Footer.d.ts +18 -0
- package/dist/components/AlertDialog/components/Trigger.d.ts +6 -0
- package/dist/components/Table3/Table3.cjs +7 -1
- package/dist/components/Table3/Table3.js +7 -1
- package/dist/components/Table3/components/Row/Editing/CreateNewRow.cjs +28 -2
- package/dist/components/Table3/components/Row/Editing/CreateNewRow.d.ts +7 -2
- package/dist/components/Table3/components/Row/Editing/CreateNewRow.js +28 -2
- package/dist/components/Table3/features/useTableEditing.cjs +4 -3
- package/dist/components/Table3/features/useTableEditing.js +4 -3
- package/dist/components/Table3/listeners/useTableEditingListener.cjs +2 -5
- package/dist/components/Table3/listeners/useTableEditingListener.d.ts +6 -3
- package/dist/components/Table3/listeners/useTableEditingListener.js +2 -5
- package/dist/components/Table3/useTable3.cjs +1 -1
- package/dist/components/Table3/useTable3.js +1 -1
- package/dist/components/Table3/util/editing.cjs +23 -3
- package/dist/components/Table3/util/editing.js +24 -4
- package/dist/index.cjs +1 -0
- package/dist/index.js +2 -1
- package/package.json +4 -4
|
@@ -66,29 +66,46 @@ function BarChart(props) {
|
|
|
66
66
|
)), showLegend ? /* @__PURE__ */ React.createElement(Legend.Legend, { items, hoverIndex: activeIndex, onHover: setActiveIndex, onToggle: toggleItem }) : null);
|
|
67
67
|
}
|
|
68
68
|
const renderBars = (shapes, showLabels = false, stacked = false, isHorizontal = false) => {
|
|
69
|
-
return shapes.map((shape, index) =>
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
...shape,
|
|
74
|
-
activeBar: { fillOpacity: 1, strokeWidth: 0 },
|
|
75
|
-
maxBarSize: BAR_WIDTH,
|
|
76
|
-
radius: getRadius(index, shapes.length, !!stacked, isHorizontal),
|
|
77
|
-
stackId: stacked ? "stack" : void 0,
|
|
78
|
-
strokeWidth: 0
|
|
79
|
-
},
|
|
80
|
-
showLabels ? /* @__PURE__ */ React.createElement(
|
|
81
|
-
RechartsPrimitive__namespace.LabelList,
|
|
69
|
+
return shapes.map((shape, index) => {
|
|
70
|
+
const hasSeparator = stacked && index > 0;
|
|
71
|
+
return /* @__PURE__ */ React.createElement(
|
|
72
|
+
RechartsPrimitive__namespace.Bar,
|
|
82
73
|
{
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
74
|
+
key: `${index}-${shape.dataKey}`,
|
|
75
|
+
...shape,
|
|
76
|
+
activeBar: hasSeparator ? (shapeProps) => renderStackedSegment({ ...shapeProps, fillOpacity: 1, strokeWidth: 0 }, isHorizontal) : { fillOpacity: 1, strokeWidth: 0 },
|
|
77
|
+
maxBarSize: BAR_WIDTH,
|
|
78
|
+
radius: getRadius(index, shapes.length, !!stacked, isHorizontal),
|
|
79
|
+
shape: hasSeparator ? (shapeProps) => renderStackedSegment(shapeProps, isHorizontal) : void 0,
|
|
80
|
+
stackId: stacked ? "stack" : void 0,
|
|
81
|
+
strokeWidth: 0
|
|
82
|
+
},
|
|
83
|
+
showLabels ? /* @__PURE__ */ React.createElement(
|
|
84
|
+
RechartsPrimitive__namespace.LabelList,
|
|
85
|
+
{
|
|
86
|
+
position: isHorizontal ? "insideRight" : "top",
|
|
87
|
+
formatter: shape.formatter,
|
|
88
|
+
offset: 6,
|
|
89
|
+
fill: isHorizontal ? color.getInverseThemeColor(shape.color ?? "") : "black",
|
|
90
|
+
fontSize: 11
|
|
91
|
+
}
|
|
92
|
+
) : null
|
|
93
|
+
);
|
|
94
|
+
});
|
|
91
95
|
};
|
|
96
|
+
const STACK_SEPARATOR_WIDTH = 2;
|
|
97
|
+
function renderStackedSegment(props, isHorizontal) {
|
|
98
|
+
const { x = 0, width = 0, height = 0 } = props;
|
|
99
|
+
const size = isHorizontal ? width : height;
|
|
100
|
+
if (Math.abs(size) <= STACK_SEPARATOR_WIDTH) {
|
|
101
|
+
return /* @__PURE__ */ React.createElement(RechartsPrimitive__namespace.Rectangle, { ...props });
|
|
102
|
+
}
|
|
103
|
+
const inset = Math.sign(size) * STACK_SEPARATOR_WIDTH;
|
|
104
|
+
if (isHorizontal) {
|
|
105
|
+
return /* @__PURE__ */ React.createElement(RechartsPrimitive__namespace.Rectangle, { ...props, x: x + inset, width: width - inset });
|
|
106
|
+
}
|
|
107
|
+
return /* @__PURE__ */ React.createElement(RechartsPrimitive__namespace.Rectangle, { ...props, height: height - inset });
|
|
108
|
+
}
|
|
92
109
|
function getRadius(index, length, stacked, isHorizontal) {
|
|
93
110
|
if (stacked) {
|
|
94
111
|
if (index === 0) {
|
|
@@ -107,3 +124,4 @@ function Bar(_) {
|
|
|
107
124
|
BarChart.Bar = Bar;
|
|
108
125
|
exports.BarChart = BarChart;
|
|
109
126
|
exports.renderBars = renderBars;
|
|
127
|
+
exports.renderStackedSegment = renderStackedSegment;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
2
|
import { ChartChildProps, CartesianChartProps } from '../types';
|
|
3
3
|
import { ChartShape } from '../useChartData';
|
|
4
|
+
import * as RechartsPrimitive from 'recharts';
|
|
4
5
|
export type BarChartProps<TData extends object> = {
|
|
5
6
|
/** Orientation of the bars
|
|
6
7
|
* @default false
|
|
@@ -23,4 +24,11 @@ export declare namespace BarChart {
|
|
|
23
24
|
* Helper function to render bar shapes as Recharts Bar primitives. Extracted to be reusable across BarChart and ComposedChart.
|
|
24
25
|
*/
|
|
25
26
|
export declare const renderBars: (shapes: ChartShape[], showLabels?: boolean, stacked?: boolean | "expand", isHorizontal?: boolean) => React.JSX.Element[];
|
|
27
|
+
type RectangleProps = React.ComponentProps<typeof RechartsPrimitive.Rectangle>;
|
|
28
|
+
/**
|
|
29
|
+
* Bar shape for every stack segment except the first: insets the edge facing the previous segment,
|
|
30
|
+
* so neighbouring segments are separated by empty space.
|
|
31
|
+
*/
|
|
32
|
+
export declare function renderStackedSegment(props: RectangleProps, isHorizontal: boolean): React.JSX.Element;
|
|
26
33
|
export type BarChartBarProps<TData extends object> = ChartChildProps<TData>;
|
|
34
|
+
export {};
|
|
@@ -47,29 +47,46 @@ function BarChart(props) {
|
|
|
47
47
|
)), showLegend ? /* @__PURE__ */ React__default.createElement(Legend, { items, hoverIndex: activeIndex, onHover: setActiveIndex, onToggle: toggleItem }) : null);
|
|
48
48
|
}
|
|
49
49
|
const renderBars = (shapes, showLabels = false, stacked = false, isHorizontal = false) => {
|
|
50
|
-
return shapes.map((shape, index) =>
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
...shape,
|
|
55
|
-
activeBar: { fillOpacity: 1, strokeWidth: 0 },
|
|
56
|
-
maxBarSize: BAR_WIDTH,
|
|
57
|
-
radius: getRadius(index, shapes.length, !!stacked, isHorizontal),
|
|
58
|
-
stackId: stacked ? "stack" : void 0,
|
|
59
|
-
strokeWidth: 0
|
|
60
|
-
},
|
|
61
|
-
showLabels ? /* @__PURE__ */ React__default.createElement(
|
|
62
|
-
RechartsPrimitive.LabelList,
|
|
50
|
+
return shapes.map((shape, index) => {
|
|
51
|
+
const hasSeparator = stacked && index > 0;
|
|
52
|
+
return /* @__PURE__ */ React__default.createElement(
|
|
53
|
+
RechartsPrimitive.Bar,
|
|
63
54
|
{
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
55
|
+
key: `${index}-${shape.dataKey}`,
|
|
56
|
+
...shape,
|
|
57
|
+
activeBar: hasSeparator ? (shapeProps) => renderStackedSegment({ ...shapeProps, fillOpacity: 1, strokeWidth: 0 }, isHorizontal) : { fillOpacity: 1, strokeWidth: 0 },
|
|
58
|
+
maxBarSize: BAR_WIDTH,
|
|
59
|
+
radius: getRadius(index, shapes.length, !!stacked, isHorizontal),
|
|
60
|
+
shape: hasSeparator ? (shapeProps) => renderStackedSegment(shapeProps, isHorizontal) : void 0,
|
|
61
|
+
stackId: stacked ? "stack" : void 0,
|
|
62
|
+
strokeWidth: 0
|
|
63
|
+
},
|
|
64
|
+
showLabels ? /* @__PURE__ */ React__default.createElement(
|
|
65
|
+
RechartsPrimitive.LabelList,
|
|
66
|
+
{
|
|
67
|
+
position: isHorizontal ? "insideRight" : "top",
|
|
68
|
+
formatter: shape.formatter,
|
|
69
|
+
offset: 6,
|
|
70
|
+
fill: isHorizontal ? getInverseThemeColor(shape.color ?? "") : "black",
|
|
71
|
+
fontSize: 11
|
|
72
|
+
}
|
|
73
|
+
) : null
|
|
74
|
+
);
|
|
75
|
+
});
|
|
72
76
|
};
|
|
77
|
+
const STACK_SEPARATOR_WIDTH = 2;
|
|
78
|
+
function renderStackedSegment(props, isHorizontal) {
|
|
79
|
+
const { x = 0, width = 0, height = 0 } = props;
|
|
80
|
+
const size = isHorizontal ? width : height;
|
|
81
|
+
if (Math.abs(size) <= STACK_SEPARATOR_WIDTH) {
|
|
82
|
+
return /* @__PURE__ */ React__default.createElement(RechartsPrimitive.Rectangle, { ...props });
|
|
83
|
+
}
|
|
84
|
+
const inset = Math.sign(size) * STACK_SEPARATOR_WIDTH;
|
|
85
|
+
if (isHorizontal) {
|
|
86
|
+
return /* @__PURE__ */ React__default.createElement(RechartsPrimitive.Rectangle, { ...props, x: x + inset, width: width - inset });
|
|
87
|
+
}
|
|
88
|
+
return /* @__PURE__ */ React__default.createElement(RechartsPrimitive.Rectangle, { ...props, height: height - inset });
|
|
89
|
+
}
|
|
73
90
|
function getRadius(index, length, stacked, isHorizontal) {
|
|
74
91
|
if (stacked) {
|
|
75
92
|
if (index === 0) {
|
|
@@ -88,5 +105,6 @@ function Bar(_) {
|
|
|
88
105
|
BarChart.Bar = Bar;
|
|
89
106
|
export {
|
|
90
107
|
BarChart,
|
|
91
|
-
renderBars
|
|
108
|
+
renderBars,
|
|
109
|
+
renderStackedSegment
|
|
92
110
|
};
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const cn = require("clsx");
|
|
4
|
+
const React = require("react");
|
|
5
|
+
const RechartsPrimitive = require("recharts");
|
|
6
|
+
function _interopNamespaceDefault(e) {
|
|
7
|
+
const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
|
|
8
|
+
if (e) {
|
|
9
|
+
for (const k in e) {
|
|
10
|
+
if (k !== "default") {
|
|
11
|
+
const d = Object.getOwnPropertyDescriptor(e, k);
|
|
12
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
get: () => e[k]
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
n.default = e;
|
|
20
|
+
return Object.freeze(n);
|
|
21
|
+
}
|
|
22
|
+
const RechartsPrimitive__namespace = /* @__PURE__ */ _interopNamespaceDefault(RechartsPrimitive);
|
|
23
|
+
const SEGMENT_SEPARATOR_WIDTH = 2;
|
|
24
|
+
const HALF_SEPARATOR = SEGMENT_SEPARATOR_WIDTH / 2;
|
|
25
|
+
const RADIAN = Math.PI / 180;
|
|
26
|
+
function polarToCartesian(cx, cy, radius, angle) {
|
|
27
|
+
return {
|
|
28
|
+
x: cx + Math.cos(-RADIAN * angle) * radius,
|
|
29
|
+
y: cy + Math.sin(-RADIAN * angle) * radius
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
function getTrim(radius) {
|
|
33
|
+
return Math.asin(HALF_SEPARATOR / radius) / RADIAN;
|
|
34
|
+
}
|
|
35
|
+
function PaddedSector(props) {
|
|
36
|
+
const { className, cx = 0, cy = 0, endAngle = 0, fill, innerRadius = 0, opacity, outerRadius = 0, startAngle = 0 } = props;
|
|
37
|
+
const sweep = Math.abs(endAngle - startAngle);
|
|
38
|
+
if (outerRadius <= HALF_SEPARATOR || sweep >= 360 || sweep <= 2 * getTrim(outerRadius)) {
|
|
39
|
+
return /* @__PURE__ */ React.createElement(RechartsPrimitive__namespace.Sector, { ...props });
|
|
40
|
+
}
|
|
41
|
+
const outerTrim = getTrim(outerRadius);
|
|
42
|
+
const direction = Math.sign(endAngle - startAngle);
|
|
43
|
+
const sweepFlag = direction < 0 ? 1 : 0;
|
|
44
|
+
const outerStart = polarToCartesian(cx, cy, outerRadius, startAngle + direction * outerTrim);
|
|
45
|
+
const outerEnd = polarToCartesian(cx, cy, outerRadius, endAngle - direction * outerTrim);
|
|
46
|
+
const outerArc = `A ${outerRadius},${outerRadius},0,${sweep - 2 * outerTrim > 180 ? 1 : 0},${sweepFlag},${outerEnd.x},${outerEnd.y}`;
|
|
47
|
+
let path;
|
|
48
|
+
if (innerRadius <= HALF_SEPARATOR || sweep <= 2 * getTrim(innerRadius)) {
|
|
49
|
+
if (sweep > 180) {
|
|
50
|
+
const startFoot = polarToCartesian(cx, cy, HALF_SEPARATOR, startAngle + direction * 90);
|
|
51
|
+
const endFoot = polarToCartesian(cx, cy, HALF_SEPARATOR, endAngle - direction * 90);
|
|
52
|
+
path = [
|
|
53
|
+
`M ${startFoot.x},${startFoot.y}`,
|
|
54
|
+
`L ${outerStart.x},${outerStart.y}`,
|
|
55
|
+
outerArc,
|
|
56
|
+
`L ${endFoot.x},${endFoot.y}`,
|
|
57
|
+
"Z"
|
|
58
|
+
];
|
|
59
|
+
} else {
|
|
60
|
+
const apexRadius = HALF_SEPARATOR / Math.sin(sweep / 2 * RADIAN);
|
|
61
|
+
const apex = polarToCartesian(cx, cy, apexRadius, (startAngle + endAngle) / 2);
|
|
62
|
+
path = [`M ${apex.x},${apex.y}`, `L ${outerStart.x},${outerStart.y}`, outerArc, "Z"];
|
|
63
|
+
}
|
|
64
|
+
} else {
|
|
65
|
+
const innerTrim = getTrim(innerRadius);
|
|
66
|
+
const innerStart = polarToCartesian(cx, cy, innerRadius, startAngle + direction * innerTrim);
|
|
67
|
+
const innerEnd = polarToCartesian(cx, cy, innerRadius, endAngle - direction * innerTrim);
|
|
68
|
+
const innerArc = `A ${innerRadius},${innerRadius},0,${sweep - 2 * innerTrim > 180 ? 1 : 0},${1 - sweepFlag},${innerStart.x},${innerStart.y}`;
|
|
69
|
+
path = [
|
|
70
|
+
`M ${innerStart.x},${innerStart.y}`,
|
|
71
|
+
`L ${outerStart.x},${outerStart.y}`,
|
|
72
|
+
outerArc,
|
|
73
|
+
`L ${innerEnd.x},${innerEnd.y}`,
|
|
74
|
+
innerArc,
|
|
75
|
+
"Z"
|
|
76
|
+
];
|
|
77
|
+
}
|
|
78
|
+
return /* @__PURE__ */ React.createElement("path", { className: cn("recharts-sector", className), d: path.join(" "), fill, opacity });
|
|
79
|
+
}
|
|
80
|
+
exports.PaddedSector = PaddedSector;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { PieSectorDataItem } from 'recharts/types/polar/Pie';
|
|
3
|
+
/**
|
|
4
|
+
* Pie or donut sector with both straight edges inset by half the separator width, so neighbouring
|
|
5
|
+
* segments sit exactly one separator width apart along their whole length.
|
|
6
|
+
*/
|
|
7
|
+
export declare function PaddedSector(props: PieSectorDataItem): React.JSX.Element;
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import cn from "clsx";
|
|
2
|
+
import React__default from "react";
|
|
3
|
+
import * as RechartsPrimitive from "recharts";
|
|
4
|
+
const SEGMENT_SEPARATOR_WIDTH = 2;
|
|
5
|
+
const HALF_SEPARATOR = SEGMENT_SEPARATOR_WIDTH / 2;
|
|
6
|
+
const RADIAN = Math.PI / 180;
|
|
7
|
+
function polarToCartesian(cx, cy, radius, angle) {
|
|
8
|
+
return {
|
|
9
|
+
x: cx + Math.cos(-RADIAN * angle) * radius,
|
|
10
|
+
y: cy + Math.sin(-RADIAN * angle) * radius
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
function getTrim(radius) {
|
|
14
|
+
return Math.asin(HALF_SEPARATOR / radius) / RADIAN;
|
|
15
|
+
}
|
|
16
|
+
function PaddedSector(props) {
|
|
17
|
+
const { className, cx = 0, cy = 0, endAngle = 0, fill, innerRadius = 0, opacity, outerRadius = 0, startAngle = 0 } = props;
|
|
18
|
+
const sweep = Math.abs(endAngle - startAngle);
|
|
19
|
+
if (outerRadius <= HALF_SEPARATOR || sweep >= 360 || sweep <= 2 * getTrim(outerRadius)) {
|
|
20
|
+
return /* @__PURE__ */ React__default.createElement(RechartsPrimitive.Sector, { ...props });
|
|
21
|
+
}
|
|
22
|
+
const outerTrim = getTrim(outerRadius);
|
|
23
|
+
const direction = Math.sign(endAngle - startAngle);
|
|
24
|
+
const sweepFlag = direction < 0 ? 1 : 0;
|
|
25
|
+
const outerStart = polarToCartesian(cx, cy, outerRadius, startAngle + direction * outerTrim);
|
|
26
|
+
const outerEnd = polarToCartesian(cx, cy, outerRadius, endAngle - direction * outerTrim);
|
|
27
|
+
const outerArc = `A ${outerRadius},${outerRadius},0,${sweep - 2 * outerTrim > 180 ? 1 : 0},${sweepFlag},${outerEnd.x},${outerEnd.y}`;
|
|
28
|
+
let path;
|
|
29
|
+
if (innerRadius <= HALF_SEPARATOR || sweep <= 2 * getTrim(innerRadius)) {
|
|
30
|
+
if (sweep > 180) {
|
|
31
|
+
const startFoot = polarToCartesian(cx, cy, HALF_SEPARATOR, startAngle + direction * 90);
|
|
32
|
+
const endFoot = polarToCartesian(cx, cy, HALF_SEPARATOR, endAngle - direction * 90);
|
|
33
|
+
path = [
|
|
34
|
+
`M ${startFoot.x},${startFoot.y}`,
|
|
35
|
+
`L ${outerStart.x},${outerStart.y}`,
|
|
36
|
+
outerArc,
|
|
37
|
+
`L ${endFoot.x},${endFoot.y}`,
|
|
38
|
+
"Z"
|
|
39
|
+
];
|
|
40
|
+
} else {
|
|
41
|
+
const apexRadius = HALF_SEPARATOR / Math.sin(sweep / 2 * RADIAN);
|
|
42
|
+
const apex = polarToCartesian(cx, cy, apexRadius, (startAngle + endAngle) / 2);
|
|
43
|
+
path = [`M ${apex.x},${apex.y}`, `L ${outerStart.x},${outerStart.y}`, outerArc, "Z"];
|
|
44
|
+
}
|
|
45
|
+
} else {
|
|
46
|
+
const innerTrim = getTrim(innerRadius);
|
|
47
|
+
const innerStart = polarToCartesian(cx, cy, innerRadius, startAngle + direction * innerTrim);
|
|
48
|
+
const innerEnd = polarToCartesian(cx, cy, innerRadius, endAngle - direction * innerTrim);
|
|
49
|
+
const innerArc = `A ${innerRadius},${innerRadius},0,${sweep - 2 * innerTrim > 180 ? 1 : 0},${1 - sweepFlag},${innerStart.x},${innerStart.y}`;
|
|
50
|
+
path = [
|
|
51
|
+
`M ${innerStart.x},${innerStart.y}`,
|
|
52
|
+
`L ${outerStart.x},${outerStart.y}`,
|
|
53
|
+
outerArc,
|
|
54
|
+
`L ${innerEnd.x},${innerEnd.y}`,
|
|
55
|
+
innerArc,
|
|
56
|
+
"Z"
|
|
57
|
+
];
|
|
58
|
+
}
|
|
59
|
+
return /* @__PURE__ */ React__default.createElement("path", { className: cn("recharts-sector", className), d: path.join(" "), fill, opacity });
|
|
60
|
+
}
|
|
61
|
+
export {
|
|
62
|
+
PaddedSector
|
|
63
|
+
};
|
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
|
3
3
|
const React = require("react");
|
|
4
4
|
const RechartsPrimitive = require("recharts");
|
|
5
5
|
const useChartData = require("../useChartData.cjs");
|
|
6
|
+
const PaddedSector = require("./PaddedSector.cjs");
|
|
6
7
|
function _interopNamespaceDefault(e) {
|
|
7
8
|
const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
|
|
8
9
|
if (e) {
|
|
@@ -42,7 +43,8 @@ function usePieChart(children, options) {
|
|
|
42
43
|
endAngle: -270,
|
|
43
44
|
stroke: "0",
|
|
44
45
|
labelLine: false,
|
|
45
|
-
outerRadius: radius
|
|
46
|
+
outerRadius: radius,
|
|
47
|
+
shape: (props) => /* @__PURE__ */ React.createElement(PaddedSector.PaddedSector, { ...props })
|
|
46
48
|
};
|
|
47
49
|
return { pieProps, radius, setRadius, items, activeIndex, setActiveIndex, globalFormatter, toggleItem, shapes };
|
|
48
50
|
}
|
|
@@ -50,8 +52,8 @@ const PIE_CHART_HOVER = 10;
|
|
|
50
52
|
const PIE_CHART_HOVER_OFFSET = 2;
|
|
51
53
|
function ActiveShape(props) {
|
|
52
54
|
const { outerRadius = 0, ...attributes } = props;
|
|
53
|
-
return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(
|
|
54
|
-
|
|
55
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(PaddedSector.PaddedSector, { ...props }), /* @__PURE__ */ React.createElement(
|
|
56
|
+
PaddedSector.PaddedSector,
|
|
55
57
|
{
|
|
56
58
|
...attributes,
|
|
57
59
|
innerRadius: outerRadius + PIE_CHART_HOVER_OFFSET,
|
|
@@ -15,6 +15,7 @@ export declare function usePieChart<TData extends object>(children: React.ReactN
|
|
|
15
15
|
stroke: string;
|
|
16
16
|
labelLine: boolean;
|
|
17
17
|
outerRadius: number;
|
|
18
|
+
shape: (props: PieSectorDataItem) => React.JSX.Element;
|
|
18
19
|
};
|
|
19
20
|
radius: number;
|
|
20
21
|
setRadius: (width: number) => void;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React__default from "react";
|
|
2
2
|
import * as RechartsPrimitive from "recharts";
|
|
3
3
|
import { useChart } from "../useChartData.js";
|
|
4
|
+
import { PaddedSector } from "./PaddedSector.js";
|
|
4
5
|
const PIE_ACTIVE_WIDTH = 10;
|
|
5
6
|
const PIE_ACTIVE_WIDTH_OFFSET = 2;
|
|
6
7
|
function usePieChart(children, options) {
|
|
@@ -23,7 +24,8 @@ function usePieChart(children, options) {
|
|
|
23
24
|
endAngle: -270,
|
|
24
25
|
stroke: "0",
|
|
25
26
|
labelLine: false,
|
|
26
|
-
outerRadius: radius
|
|
27
|
+
outerRadius: radius,
|
|
28
|
+
shape: (props) => /* @__PURE__ */ React__default.createElement(PaddedSector, { ...props })
|
|
27
29
|
};
|
|
28
30
|
return { pieProps, radius, setRadius, items, activeIndex, setActiveIndex, globalFormatter, toggleItem, shapes };
|
|
29
31
|
}
|
|
@@ -31,8 +33,8 @@ const PIE_CHART_HOVER = 10;
|
|
|
31
33
|
const PIE_CHART_HOVER_OFFSET = 2;
|
|
32
34
|
function ActiveShape(props) {
|
|
33
35
|
const { outerRadius = 0, ...attributes } = props;
|
|
34
|
-
return /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, /* @__PURE__ */ React__default.createElement(
|
|
35
|
-
|
|
36
|
+
return /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, /* @__PURE__ */ React__default.createElement(PaddedSector, { ...props }), /* @__PURE__ */ React__default.createElement(
|
|
37
|
+
PaddedSector,
|
|
36
38
|
{
|
|
37
39
|
...attributes,
|
|
38
40
|
innerRadius: outerRadius + PIE_CHART_HOVER_OFFSET,
|
|
@@ -2,6 +2,9 @@ import { AlertDialogContentProps, AlertDialogTitleProps, AlertDialogDescriptionP
|
|
|
2
2
|
import { AlertDialogCancelProps, AlertDialogActionProps, AlertDialogFooterProps } from './components/Footer';
|
|
3
3
|
import { AlertDialogTriggerProps } from './components/Trigger';
|
|
4
4
|
import * as React from 'react';
|
|
5
|
+
/**
|
|
6
|
+
* @deprecated Use `Dialog` instead.
|
|
7
|
+
*/
|
|
5
8
|
export type AlertDialogProps = {
|
|
6
9
|
children: React.ReactNode | React.ReactNode[];
|
|
7
10
|
/**
|
|
@@ -24,13 +27,40 @@ export type AlertDialogProps = {
|
|
|
24
27
|
*/
|
|
25
28
|
variant?: 'warning' | 'error' | 'information';
|
|
26
29
|
};
|
|
30
|
+
/**
|
|
31
|
+
* @deprecated Use `Dialog` instead.
|
|
32
|
+
*/
|
|
27
33
|
export type ForwardedAlertDialogWithStatics = React.ForwardRefExoticComponent<AlertDialogProps & React.RefAttributes<HTMLElement>> & {
|
|
34
|
+
/**
|
|
35
|
+
* @deprecated Use `Dialog` instead.
|
|
36
|
+
*/
|
|
28
37
|
Trigger: React.ForwardRefExoticComponent<AlertDialogTriggerProps & React.RefAttributes<HTMLButtonElement>>;
|
|
38
|
+
/**
|
|
39
|
+
* @deprecated Use `Dialog` instead.
|
|
40
|
+
*/
|
|
29
41
|
Content: React.ForwardRefExoticComponent<AlertDialogContentProps & React.RefAttributes<HTMLDivElement>>;
|
|
42
|
+
/**
|
|
43
|
+
* @deprecated Use `Dialog` instead.
|
|
44
|
+
*/
|
|
30
45
|
Title: React.ForwardRefExoticComponent<AlertDialogTitleProps & React.RefAttributes<HTMLHeadingElement>>;
|
|
46
|
+
/**
|
|
47
|
+
* @deprecated Use `Dialog` instead.
|
|
48
|
+
*/
|
|
31
49
|
Description: React.ForwardRefExoticComponent<AlertDialogDescriptionProps & React.RefAttributes<HTMLParagraphElement>>;
|
|
50
|
+
/**
|
|
51
|
+
* @deprecated Use `Dialog` instead.
|
|
52
|
+
*/
|
|
32
53
|
Footer: React.ForwardRefExoticComponent<AlertDialogFooterProps & React.RefAttributes<HTMLDivElement>>;
|
|
54
|
+
/**
|
|
55
|
+
* @deprecated Use `Dialog` instead.
|
|
56
|
+
*/
|
|
33
57
|
Action: React.ForwardRefExoticComponent<AlertDialogActionProps & React.RefAttributes<HTMLButtonElement>>;
|
|
58
|
+
/**
|
|
59
|
+
* @deprecated Use `Dialog` instead.
|
|
60
|
+
*/
|
|
34
61
|
Cancel: React.ForwardRefExoticComponent<AlertDialogCancelProps & React.RefAttributes<HTMLButtonElement>>;
|
|
35
62
|
};
|
|
63
|
+
/**
|
|
64
|
+
* @deprecated Use `Dialog` instead.
|
|
65
|
+
*/
|
|
36
66
|
export declare const AlertDialog: ForwardedAlertDialogWithStatics;
|
|
@@ -1,7 +1,16 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* @deprecated Use `Dialog` instead.
|
|
4
|
+
*/
|
|
2
5
|
export type AlertDialogContext = {
|
|
3
6
|
props: Record<string, unknown>;
|
|
4
7
|
ref: React.Ref<HTMLElement>;
|
|
5
8
|
};
|
|
9
|
+
/**
|
|
10
|
+
* @deprecated Use `Dialog` instead.
|
|
11
|
+
*/
|
|
6
12
|
export declare const AlertDialogContext: React.Context<AlertDialogContext>;
|
|
13
|
+
/**
|
|
14
|
+
* @deprecated Use `Dialog` instead.
|
|
15
|
+
*/
|
|
7
16
|
export declare const useCurrentAlertDialog: () => AlertDialogContext;
|
|
@@ -1,13 +1,31 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* @deprecated Use `Dialog` instead.
|
|
4
|
+
*/
|
|
2
5
|
export type AlertDialogTitleProps = React.HTMLAttributes<HTMLHeadingElement>;
|
|
6
|
+
/**
|
|
7
|
+
* @deprecated Use `Dialog` instead.
|
|
8
|
+
*/
|
|
3
9
|
export declare const Title: React.ForwardRefExoticComponent<AlertDialogTitleProps & React.RefAttributes<HTMLHeadingElement>>;
|
|
10
|
+
/**
|
|
11
|
+
* @deprecated Use `Dialog` instead.
|
|
12
|
+
*/
|
|
4
13
|
export type AlertDialogDescriptionProps = React.HTMLAttributes<HTMLParagraphElement>;
|
|
14
|
+
/**
|
|
15
|
+
* @deprecated Use `Dialog` instead.
|
|
16
|
+
*/
|
|
5
17
|
export declare const Description: React.ForwardRefExoticComponent<AlertDialogDescriptionProps & React.RefAttributes<HTMLParagraphElement>>;
|
|
18
|
+
/**
|
|
19
|
+
* @deprecated Use `Dialog` instead.
|
|
20
|
+
*/
|
|
6
21
|
export type AlertDialogContentProps = Omit<React.HTMLAttributes<HTMLDivElement>, 'children'> & {
|
|
7
22
|
/** An accessible label to be announced when the dialog is opened */
|
|
8
23
|
'aria-label': string;
|
|
9
24
|
children: React.ReactNode;
|
|
10
25
|
};
|
|
26
|
+
/**
|
|
27
|
+
* @deprecated Use `Dialog` instead.
|
|
28
|
+
*/
|
|
11
29
|
export declare const Content: React.ForwardRefExoticComponent<Omit<React.HTMLAttributes<HTMLDivElement>, "children"> & {
|
|
12
30
|
/** An accessible label to be announced when the dialog is opened */
|
|
13
31
|
'aria-label': string;
|
|
@@ -1,15 +1,33 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* @deprecated Use `Dialog` instead.
|
|
4
|
+
*/
|
|
2
5
|
export type AlertDialogFooterProps = React.HTMLAttributes<HTMLDivElement>;
|
|
6
|
+
/**
|
|
7
|
+
* @deprecated Use `Dialog` instead.
|
|
8
|
+
*/
|
|
3
9
|
export declare const Footer: React.ForwardRefExoticComponent<AlertDialogFooterProps & React.RefAttributes<HTMLDivElement>>;
|
|
10
|
+
/**
|
|
11
|
+
* @deprecated Use `Dialog` instead.
|
|
12
|
+
*/
|
|
4
13
|
export type AlertDialogCancelProps = React.HTMLAttributes<HTMLButtonElement> & {
|
|
5
14
|
children: React.ReactElement;
|
|
6
15
|
};
|
|
16
|
+
/**
|
|
17
|
+
* @deprecated Use `Dialog` instead.
|
|
18
|
+
*/
|
|
7
19
|
export declare const Cancel: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLButtonElement> & {
|
|
8
20
|
children: React.ReactElement;
|
|
9
21
|
} & React.RefAttributes<HTMLButtonElement>>;
|
|
22
|
+
/**
|
|
23
|
+
* @deprecated Use `Dialog` instead.
|
|
24
|
+
*/
|
|
10
25
|
export type AlertDialogActionProps = React.HTMLAttributes<HTMLButtonElement> & {
|
|
11
26
|
children: React.ReactElement;
|
|
12
27
|
};
|
|
28
|
+
/**
|
|
29
|
+
* @deprecated Use `Dialog` instead.
|
|
30
|
+
*/
|
|
13
31
|
export declare const Action: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLButtonElement> & {
|
|
14
32
|
children: React.ReactElement;
|
|
15
33
|
} & React.RefAttributes<HTMLButtonElement>>;
|
|
@@ -1,7 +1,13 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* @deprecated Use `Dialog` instead.
|
|
4
|
+
*/
|
|
2
5
|
export type AlertDialogTriggerProps = React.HTMLAttributes<HTMLButtonElement> & {
|
|
3
6
|
children: React.ReactElement;
|
|
4
7
|
};
|
|
8
|
+
/**
|
|
9
|
+
* @deprecated Use `Dialog` instead.
|
|
10
|
+
*/
|
|
5
11
|
export declare const Trigger: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLButtonElement> & {
|
|
6
12
|
children: React.ReactElement;
|
|
7
13
|
} & React.RefAttributes<HTMLButtonElement>>;
|
|
@@ -32,7 +32,12 @@ const BaseTable3 = types.fixedForwardRef(function BaseTable32(props, ref) {
|
|
|
32
32
|
return table3.meta.editing.hasChanges(row.rowId);
|
|
33
33
|
});
|
|
34
34
|
const hasCreateWorkflow = table3.meta.editing.isEnabled && props.onEditingCreate;
|
|
35
|
-
const [hasScrollbar,
|
|
35
|
+
const [hasScrollbar, isScrolledToBottom] = editing.isTableScrolled(table3.ref);
|
|
36
|
+
const isScrolled = isScrolledToBottom && table3.meta.footer.isEnabled;
|
|
37
|
+
const restoreCreateRowFocus = React.useRef(false);
|
|
38
|
+
React.useEffect(() => {
|
|
39
|
+
restoreCreateRowFocus.current = false;
|
|
40
|
+
});
|
|
36
41
|
let createWorkflow;
|
|
37
42
|
if (hasCreateWorkflow) {
|
|
38
43
|
createWorkflow = /* @__PURE__ */ React.createElement(
|
|
@@ -40,6 +45,7 @@ const BaseTable3 = types.fixedForwardRef(function BaseTable32(props, ref) {
|
|
|
40
45
|
{
|
|
41
46
|
buttonRef: table3.meta.editing.createRowButtonRef,
|
|
42
47
|
hasScrollbar,
|
|
48
|
+
restoreFocusRef: restoreCreateRowFocus,
|
|
43
49
|
table: table3.instance,
|
|
44
50
|
tableMeta: table3.meta,
|
|
45
51
|
tableRef: table3.ref
|
|
@@ -30,7 +30,12 @@ const BaseTable3 = fixedForwardRef(function BaseTable32(props, ref) {
|
|
|
30
30
|
return table3.meta.editing.hasChanges(row.rowId);
|
|
31
31
|
});
|
|
32
32
|
const hasCreateWorkflow = table3.meta.editing.isEnabled && props.onEditingCreate;
|
|
33
|
-
const [hasScrollbar,
|
|
33
|
+
const [hasScrollbar, isScrolledToBottom] = isTableScrolled(table3.ref);
|
|
34
|
+
const isScrolled = isScrolledToBottom && table3.meta.footer.isEnabled;
|
|
35
|
+
const restoreCreateRowFocus = React__default.useRef(false);
|
|
36
|
+
React__default.useEffect(() => {
|
|
37
|
+
restoreCreateRowFocus.current = false;
|
|
38
|
+
});
|
|
34
39
|
let createWorkflow;
|
|
35
40
|
if (hasCreateWorkflow) {
|
|
36
41
|
createWorkflow = /* @__PURE__ */ React__default.createElement(
|
|
@@ -38,6 +43,7 @@ const BaseTable3 = fixedForwardRef(function BaseTable32(props, ref) {
|
|
|
38
43
|
{
|
|
39
44
|
buttonRef: table3.meta.editing.createRowButtonRef,
|
|
40
45
|
hasScrollbar,
|
|
46
|
+
restoreFocusRef: restoreCreateRowFocus,
|
|
41
47
|
table: table3.instance,
|
|
42
48
|
tableMeta: table3.meta,
|
|
43
49
|
tableRef: table3.ref
|
|
@@ -9,8 +9,34 @@ const Shortcut = require("../../../../Shortcut/Shortcut.cjs");
|
|
|
9
9
|
const SCROLL_NEAR_BOTTOM_THRESHOLD_PX = 80;
|
|
10
10
|
const SCROLL_DELAY_MS = 150;
|
|
11
11
|
function CreateNewRow(props) {
|
|
12
|
-
const { buttonRef, hasScrollbar, table, tableMeta, tableRef } = props;
|
|
12
|
+
const { buttonRef, hasScrollbar, restoreFocusRef, table, tableMeta, tableRef } = props;
|
|
13
13
|
const { texts } = Localization.useLocalization();
|
|
14
|
+
const rowRef = React.useRef(null);
|
|
15
|
+
React.useLayoutEffect(() => {
|
|
16
|
+
const row = rowRef.current;
|
|
17
|
+
let frame;
|
|
18
|
+
let isPending = false;
|
|
19
|
+
const getButton = () => row?.querySelector("button") ?? null;
|
|
20
|
+
if (restoreFocusRef.current) {
|
|
21
|
+
restoreFocusRef.current = false;
|
|
22
|
+
isPending = true;
|
|
23
|
+
frame = requestAnimationFrame(() => {
|
|
24
|
+
isPending = false;
|
|
25
|
+
if (!document.activeElement || document.activeElement === document.body) {
|
|
26
|
+
getButton()?.focus();
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
return () => {
|
|
31
|
+
if (frame !== void 0) {
|
|
32
|
+
cancelAnimationFrame(frame);
|
|
33
|
+
}
|
|
34
|
+
const button = getButton();
|
|
35
|
+
if (isPending || button && document.activeElement === button) {
|
|
36
|
+
restoreFocusRef.current = true;
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
}, [restoreFocusRef]);
|
|
14
40
|
const temporaryRows = tableMeta.editing.temporaryRows;
|
|
15
41
|
const temporaryRowId = temporaryRows[0]?.[tableMeta.rowIdentityAccessor] ?? "";
|
|
16
42
|
const isDisabled = !!table.getState().globalFilter || !!table.getState().columnFilters?.length || !!temporaryRowId && !!tableMeta.editing.hasRowErrors(temporaryRowId);
|
|
@@ -42,7 +68,7 @@ function CreateNewRow(props) {
|
|
|
42
68
|
"bottom-0": !tableMeta.footer.isEnabled,
|
|
43
69
|
"!border-t-[0] border-b": !hasScrollbar
|
|
44
70
|
});
|
|
45
|
-
return /* @__PURE__ */ React.createElement("tr", { "data-row-create": true, className, tabIndex: -1 }, /* @__PURE__ */ React.createElement("td", { className: "col-span-full !bg-gray-50/50 !px-1" }, /* @__PURE__ */ React.createElement(
|
|
71
|
+
return /* @__PURE__ */ React.createElement("tr", { "data-row-create": true, className, ref: rowRef, tabIndex: -1 }, /* @__PURE__ */ React.createElement("td", { className: "col-span-full !bg-gray-50/50 !px-1" }, /* @__PURE__ */ React.createElement(
|
|
46
72
|
Button.LegacyButton,
|
|
47
73
|
{
|
|
48
74
|
appearance: "transparent",
|
|
@@ -1,12 +1,17 @@
|
|
|
1
1
|
import { Table as ReactTable, TableMeta as ReactTableMeta } from '@tanstack/react-table';
|
|
2
2
|
import { default as React } from 'react';
|
|
3
3
|
import { TableRef } from '../../../../../primitives/Table/types';
|
|
4
|
+
type CreateNewRowMeta<TType> = Pick<ReactTableMeta<TType>, 'rowIdentityAccessor'> & {
|
|
5
|
+
editing: Pick<ReactTableMeta<TType>['editing'], 'createRow' | 'getRowStatus' | 'hasRowErrors' | 'temporaryRows'>;
|
|
6
|
+
footer: Pick<ReactTableMeta<TType>['footer'], 'isEnabled'>;
|
|
7
|
+
};
|
|
4
8
|
type CreateNewRowProps<TType = unknown> = {
|
|
5
9
|
buttonRef: React.Ref<HTMLButtonElement>;
|
|
6
10
|
hasScrollbar: boolean;
|
|
11
|
+
restoreFocusRef: React.RefObject<boolean>;
|
|
7
12
|
table: ReactTable<TType>;
|
|
8
|
-
tableMeta:
|
|
9
|
-
tableRef: React.RefObject<TableRef>;
|
|
13
|
+
tableMeta: CreateNewRowMeta<TType>;
|
|
14
|
+
tableRef: React.RefObject<TableRef | null>;
|
|
10
15
|
};
|
|
11
16
|
export declare function CreateNewRow<TType = unknown>(props: CreateNewRowProps<TType>): React.JSX.Element;
|
|
12
17
|
export {};
|
|
@@ -7,8 +7,34 @@ import { Shortcut } from "../../../../Shortcut/Shortcut.js";
|
|
|
7
7
|
const SCROLL_NEAR_BOTTOM_THRESHOLD_PX = 80;
|
|
8
8
|
const SCROLL_DELAY_MS = 150;
|
|
9
9
|
function CreateNewRow(props) {
|
|
10
|
-
const { buttonRef, hasScrollbar, table, tableMeta, tableRef } = props;
|
|
10
|
+
const { buttonRef, hasScrollbar, restoreFocusRef, table, tableMeta, tableRef } = props;
|
|
11
11
|
const { texts } = useLocalization();
|
|
12
|
+
const rowRef = React__default.useRef(null);
|
|
13
|
+
React__default.useLayoutEffect(() => {
|
|
14
|
+
const row = rowRef.current;
|
|
15
|
+
let frame;
|
|
16
|
+
let isPending = false;
|
|
17
|
+
const getButton = () => row?.querySelector("button") ?? null;
|
|
18
|
+
if (restoreFocusRef.current) {
|
|
19
|
+
restoreFocusRef.current = false;
|
|
20
|
+
isPending = true;
|
|
21
|
+
frame = requestAnimationFrame(() => {
|
|
22
|
+
isPending = false;
|
|
23
|
+
if (!document.activeElement || document.activeElement === document.body) {
|
|
24
|
+
getButton()?.focus();
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
return () => {
|
|
29
|
+
if (frame !== void 0) {
|
|
30
|
+
cancelAnimationFrame(frame);
|
|
31
|
+
}
|
|
32
|
+
const button = getButton();
|
|
33
|
+
if (isPending || button && document.activeElement === button) {
|
|
34
|
+
restoreFocusRef.current = true;
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
}, [restoreFocusRef]);
|
|
12
38
|
const temporaryRows = tableMeta.editing.temporaryRows;
|
|
13
39
|
const temporaryRowId = temporaryRows[0]?.[tableMeta.rowIdentityAccessor] ?? "";
|
|
14
40
|
const isDisabled = !!table.getState().globalFilter || !!table.getState().columnFilters?.length || !!temporaryRowId && !!tableMeta.editing.hasRowErrors(temporaryRowId);
|
|
@@ -40,7 +66,7 @@ function CreateNewRow(props) {
|
|
|
40
66
|
"bottom-0": !tableMeta.footer.isEnabled,
|
|
41
67
|
"!border-t-[0] border-b": !hasScrollbar
|
|
42
68
|
});
|
|
43
|
-
return /* @__PURE__ */ React__default.createElement("tr", { "data-row-create": true, className, tabIndex: -1 }, /* @__PURE__ */ React__default.createElement("td", { className: "col-span-full !bg-gray-50/50 !px-1" }, /* @__PURE__ */ React__default.createElement(
|
|
69
|
+
return /* @__PURE__ */ React__default.createElement("tr", { "data-row-create": true, className, ref: rowRef, tabIndex: -1 }, /* @__PURE__ */ React__default.createElement("td", { className: "col-span-full !bg-gray-50/50 !px-1" }, /* @__PURE__ */ React__default.createElement(
|
|
44
70
|
LegacyButton,
|
|
45
71
|
{
|
|
46
72
|
appearance: "transparent",
|
|
@@ -24,7 +24,8 @@ function useTableEditing(isEnabled = false, defaultToggleEditing = false, handle
|
|
|
24
24
|
}, [isEditing]);
|
|
25
25
|
function toggleEditing(enabled, table, scrollToIndex) {
|
|
26
26
|
const tableMeta = rows.getTableMeta(table);
|
|
27
|
-
|
|
27
|
+
const isEnabled2 = typeof enabled === "function" ? enabled(tableMeta.editing.isEditing) : enabled;
|
|
28
|
+
if (isEnabled2) {
|
|
28
29
|
const index = tableMeta.rowActive.rowActiveIndex ?? 0;
|
|
29
30
|
if (tableMeta.rowActive.rowActiveIndex === void 0) {
|
|
30
31
|
tableMeta.rowActive.setRowActiveIndex(index);
|
|
@@ -32,11 +33,11 @@ function useTableEditing(isEnabled = false, defaultToggleEditing = false, handle
|
|
|
32
33
|
if (!editing.isTemporaryRow(table.getRowModel().rows[index]?.id)) {
|
|
33
34
|
scrollToIndex(index);
|
|
34
35
|
}
|
|
35
|
-
} else if (!
|
|
36
|
+
} else if (!isEnabled2) {
|
|
36
37
|
toggleDetailedMode(false);
|
|
37
38
|
setLastFocusedCellIndex(void 0);
|
|
38
39
|
}
|
|
39
|
-
setEditing(
|
|
40
|
+
setEditing(isEnabled2);
|
|
40
41
|
pendingChangesFns.saveChanges(table);
|
|
41
42
|
}
|
|
42
43
|
async function createRow(table, row) {
|
|
@@ -22,7 +22,8 @@ function useTableEditing(isEnabled = false, defaultToggleEditing = false, handle
|
|
|
22
22
|
}, [isEditing]);
|
|
23
23
|
function toggleEditing(enabled, table, scrollToIndex) {
|
|
24
24
|
const tableMeta = getTableMeta(table);
|
|
25
|
-
|
|
25
|
+
const isEnabled2 = typeof enabled === "function" ? enabled(tableMeta.editing.isEditing) : enabled;
|
|
26
|
+
if (isEnabled2) {
|
|
26
27
|
const index = tableMeta.rowActive.rowActiveIndex ?? 0;
|
|
27
28
|
if (tableMeta.rowActive.rowActiveIndex === void 0) {
|
|
28
29
|
tableMeta.rowActive.setRowActiveIndex(index);
|
|
@@ -30,11 +31,11 @@ function useTableEditing(isEnabled = false, defaultToggleEditing = false, handle
|
|
|
30
31
|
if (!isTemporaryRow(table.getRowModel().rows[index]?.id)) {
|
|
31
32
|
scrollToIndex(index);
|
|
32
33
|
}
|
|
33
|
-
} else if (!
|
|
34
|
+
} else if (!isEnabled2) {
|
|
34
35
|
toggleDetailedMode(false);
|
|
35
36
|
setLastFocusedCellIndex(void 0);
|
|
36
37
|
}
|
|
37
|
-
setEditing(
|
|
38
|
+
setEditing(isEnabled2);
|
|
38
39
|
pendingChangesFns.saveChanges(table);
|
|
39
40
|
}
|
|
40
41
|
async function createRow(table, row) {
|
|
@@ -3,22 +3,19 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
|
3
3
|
const React = require("react");
|
|
4
4
|
const useGlobalKeyDown = require("../../../hooks/useGlobalKeyDown.cjs");
|
|
5
5
|
const useLazyEffect = require("../../../hooks/useLazyEffect.cjs");
|
|
6
|
-
const rows = require("../../../primitives/Table/useTableManager/util/rows.cjs");
|
|
7
6
|
const search = require("../../../primitives/Table/useTableManager/util/search.cjs");
|
|
8
7
|
const dom = require("../../../utils/dom.cjs");
|
|
9
8
|
const editing = require("../util/editing.cjs");
|
|
10
9
|
const Localization = require("../../Provider/Localization.cjs");
|
|
11
|
-
function useTableEditingListener(table, tableRef, scrollToIndex) {
|
|
12
|
-
const tableMeta = rows.getTableMeta(table);
|
|
10
|
+
function useTableEditingListener(table, tableMeta, tableRef, scrollToIndex) {
|
|
13
11
|
const localization = Localization.useLocalization();
|
|
14
12
|
const hasChanges = tableMeta.editing.hasChanges();
|
|
15
13
|
React.useEffect(() => {
|
|
16
14
|
function showUnsavedChangesWarning(event) {
|
|
17
15
|
if (tableMeta.editing.isEditing && hasChanges) {
|
|
16
|
+
event.preventDefault();
|
|
18
17
|
event.returnValue = true;
|
|
19
|
-
return true;
|
|
20
18
|
}
|
|
21
|
-
return false;
|
|
22
19
|
}
|
|
23
20
|
window.addEventListener("beforeunload", showUnsavedChangesWarning);
|
|
24
21
|
return () => {
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
import { Table as ReactTable } from '@tanstack/react-table';
|
|
1
|
+
import { Table as ReactTable, TableMeta as ReactTableMeta } from '@tanstack/react-table';
|
|
2
2
|
import { default as React } from 'react';
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
type TableEditingListenerMeta<TType> = {
|
|
4
|
+
editing: Pick<ReactTableMeta<TType>['editing'], 'hasChanges' | 'hasSaved' | 'isEditing' | 'isEnabled' | 'saveChanges' | 'toggleEditing'>;
|
|
5
|
+
};
|
|
6
|
+
export declare function useTableEditingListener<TType = unknown>(table: ReactTable<TType>, tableMeta: TableEditingListenerMeta<TType>, tableRef: React.RefObject<HTMLElement | null>, scrollToIndex: (index: number) => void): void;
|
|
7
|
+
export {};
|
|
@@ -1,22 +1,19 @@
|
|
|
1
1
|
import React__default from "react";
|
|
2
2
|
import { useGlobalKeyDown } from "../../../hooks/useGlobalKeyDown.js";
|
|
3
3
|
import { useLazyEffect } from "../../../hooks/useLazyEffect.js";
|
|
4
|
-
import { getTableMeta } from "../../../primitives/Table/useTableManager/util/rows.js";
|
|
5
4
|
import { resetHighlightedColumnIndexes } from "../../../primitives/Table/useTableManager/util/search.js";
|
|
6
5
|
import { isElementInsideOrTriggeredFromContainer } from "../../../utils/dom.js";
|
|
7
6
|
import { shortcut } from "../util/editing.js";
|
|
8
7
|
import { useLocalization } from "../../Provider/Localization.js";
|
|
9
|
-
function useTableEditingListener(table, tableRef, scrollToIndex) {
|
|
10
|
-
const tableMeta = getTableMeta(table);
|
|
8
|
+
function useTableEditingListener(table, tableMeta, tableRef, scrollToIndex) {
|
|
11
9
|
const localization = useLocalization();
|
|
12
10
|
const hasChanges = tableMeta.editing.hasChanges();
|
|
13
11
|
React__default.useEffect(() => {
|
|
14
12
|
function showUnsavedChangesWarning(event) {
|
|
15
13
|
if (tableMeta.editing.isEditing && hasChanges) {
|
|
14
|
+
event.preventDefault();
|
|
16
15
|
event.returnValue = true;
|
|
17
|
-
return true;
|
|
18
16
|
}
|
|
19
|
-
return false;
|
|
20
17
|
}
|
|
21
18
|
window.addEventListener("beforeunload", showUnsavedChangesWarning);
|
|
22
19
|
return () => {
|
|
@@ -91,7 +91,7 @@ function useTable3(props, ref) {
|
|
|
91
91
|
toggleEditing(true);
|
|
92
92
|
}
|
|
93
93
|
}, []);
|
|
94
|
-
useTableEditingListener.useTableEditingListener(table.instance, table.ref, table.renderer.scrollToIndex);
|
|
94
|
+
useTableEditingListener.useTableEditingListener(table.instance, table.meta, table.ref, table.renderer.scrollToIndex);
|
|
95
95
|
React.useEffect(() => {
|
|
96
96
|
const tableRef = table.ref.current;
|
|
97
97
|
if (tableRef) {
|
|
@@ -89,7 +89,7 @@ function useTable3(props, ref) {
|
|
|
89
89
|
toggleEditing(true);
|
|
90
90
|
}
|
|
91
91
|
}, []);
|
|
92
|
-
useTableEditingListener(table.instance, table.ref, table.renderer.scrollToIndex);
|
|
92
|
+
useTableEditingListener(table.instance, table.meta, table.ref, table.renderer.scrollToIndex);
|
|
93
93
|
React__default.useEffect(() => {
|
|
94
94
|
const tableRef = table.ref.current;
|
|
95
95
|
if (tableRef) {
|
|
@@ -20,8 +20,26 @@ function willRowMoveAfterSearch(cell, change, table, localization) {
|
|
|
20
20
|
if (!table.options.enableGlobalFilter || !searchQuery) {
|
|
21
21
|
return false;
|
|
22
22
|
}
|
|
23
|
-
const
|
|
24
|
-
|
|
23
|
+
const originalWithChange = { ...cell.row.original, [cell.column.id]: change };
|
|
24
|
+
const getValueWithChange = (columnId) => columnId === cell.column.id ? change : cell.row.getValue(columnId);
|
|
25
|
+
return !table.getAllLeafColumns().some((column) => {
|
|
26
|
+
if (!column.getCanGlobalFilter()) {
|
|
27
|
+
return false;
|
|
28
|
+
}
|
|
29
|
+
const { dataType, dataTypeOptions } = column.columnDef.meta ?? {};
|
|
30
|
+
try {
|
|
31
|
+
return !!search.isMatched(
|
|
32
|
+
searchQuery,
|
|
33
|
+
getValueWithChange(column.id),
|
|
34
|
+
originalWithChange,
|
|
35
|
+
dataType,
|
|
36
|
+
dataTypeOptions,
|
|
37
|
+
localization
|
|
38
|
+
);
|
|
39
|
+
} catch {
|
|
40
|
+
return false;
|
|
41
|
+
}
|
|
42
|
+
});
|
|
25
43
|
}
|
|
26
44
|
function willRowMoveAfterFilter(cell, change, localization) {
|
|
27
45
|
if (!cell.column.getIsFiltered()) {
|
|
@@ -94,9 +112,11 @@ function isTemporaryRow(rowId) {
|
|
|
94
112
|
return String(rowId).startsWith(TEMPORARY_ROW_ID_PREFIX);
|
|
95
113
|
}
|
|
96
114
|
const shortcut = { key: "e", meta: true, shift: false };
|
|
115
|
+
const parsePixels = (value) => Number.parseFloat(value || "0");
|
|
97
116
|
function isTableScrolled(ref) {
|
|
98
117
|
if (ref.current) {
|
|
99
|
-
const
|
|
118
|
+
const tbody = ref.current.querySelector("tbody");
|
|
119
|
+
const height = parsePixels(tbody?.style.height) + parsePixels(tbody?.style.paddingBottom);
|
|
100
120
|
const hasVerticalScrollbar = ref.current.scrollHeight > ref.current.clientHeight;
|
|
101
121
|
return [hasVerticalScrollbar, height > ref.current.scrollHeight];
|
|
102
122
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { columnFilterFn } from "../../../primitives/Table/useTableManager/util/filtering.js";
|
|
2
|
-
import {
|
|
2
|
+
import { isMatched } from "../../../primitives/Table/useTableManager/util/search.js";
|
|
3
3
|
function willRowMove(cell, change, rowIndex, localization) {
|
|
4
4
|
const { table } = cell.getContext();
|
|
5
5
|
if (willRowMoveAfterSearch(cell, change, table, localization)) {
|
|
@@ -18,8 +18,26 @@ function willRowMoveAfterSearch(cell, change, table, localization) {
|
|
|
18
18
|
if (!table.options.enableGlobalFilter || !searchQuery) {
|
|
19
19
|
return false;
|
|
20
20
|
}
|
|
21
|
-
const
|
|
22
|
-
|
|
21
|
+
const originalWithChange = { ...cell.row.original, [cell.column.id]: change };
|
|
22
|
+
const getValueWithChange = (columnId) => columnId === cell.column.id ? change : cell.row.getValue(columnId);
|
|
23
|
+
return !table.getAllLeafColumns().some((column) => {
|
|
24
|
+
if (!column.getCanGlobalFilter()) {
|
|
25
|
+
return false;
|
|
26
|
+
}
|
|
27
|
+
const { dataType, dataTypeOptions } = column.columnDef.meta ?? {};
|
|
28
|
+
try {
|
|
29
|
+
return !!isMatched(
|
|
30
|
+
searchQuery,
|
|
31
|
+
getValueWithChange(column.id),
|
|
32
|
+
originalWithChange,
|
|
33
|
+
dataType,
|
|
34
|
+
dataTypeOptions,
|
|
35
|
+
localization
|
|
36
|
+
);
|
|
37
|
+
} catch {
|
|
38
|
+
return false;
|
|
39
|
+
}
|
|
40
|
+
});
|
|
23
41
|
}
|
|
24
42
|
function willRowMoveAfterFilter(cell, change, localization) {
|
|
25
43
|
if (!cell.column.getIsFiltered()) {
|
|
@@ -92,9 +110,11 @@ function isTemporaryRow(rowId) {
|
|
|
92
110
|
return String(rowId).startsWith(TEMPORARY_ROW_ID_PREFIX);
|
|
93
111
|
}
|
|
94
112
|
const shortcut = { key: "e", meta: true, shift: false };
|
|
113
|
+
const parsePixels = (value) => Number.parseFloat(value || "0");
|
|
95
114
|
function isTableScrolled(ref) {
|
|
96
115
|
if (ref.current) {
|
|
97
|
-
const
|
|
116
|
+
const tbody = ref.current.querySelector("tbody");
|
|
117
|
+
const height = parsePixels(tbody?.style.height) + parsePixels(tbody?.style.paddingBottom);
|
|
98
118
|
const hasVerticalScrollbar = ref.current.scrollHeight > ref.current.clientHeight;
|
|
99
119
|
return [hasVerticalScrollbar, height > ref.current.scrollHeight];
|
|
100
120
|
}
|
package/dist/index.cjs
CHANGED
|
@@ -135,6 +135,7 @@ exports.BadgeIcon = BadgeIcon.BadgeIcon;
|
|
|
135
135
|
exports.Banner = Banner.Banner;
|
|
136
136
|
exports.BarChart = BarChart.BarChart;
|
|
137
137
|
exports.renderBars = BarChart.renderBars;
|
|
138
|
+
exports.renderStackedSegment = BarChart.renderStackedSegment;
|
|
138
139
|
exports.BarLineChart = BarLineChart.BarLineChart;
|
|
139
140
|
exports.Breadcrumbs = Breadcrumbs.Breadcrumbs;
|
|
140
141
|
exports.Button = Button.Button;
|
package/dist/index.js
CHANGED
|
@@ -28,7 +28,7 @@ import { Backdrop } from "./components/Backdrop/Backdrop.js";
|
|
|
28
28
|
import { Badge } from "./components/Badge/Badge.js";
|
|
29
29
|
import { BadgeIcon } from "./components/BadgeIcon/BadgeIcon.js";
|
|
30
30
|
import { Banner } from "./components/Banner/Banner.js";
|
|
31
|
-
import { BarChart, renderBars } from "./charts/components/Bar/BarChart.js";
|
|
31
|
+
import { BarChart, renderBars, renderStackedSegment } from "./charts/components/Bar/BarChart.js";
|
|
32
32
|
import { BarLineChart } from "./charts/components/Composed/BarLineChart.js";
|
|
33
33
|
import { Breadcrumbs } from "./components/Breadcrumbs/Breadcrumbs.js";
|
|
34
34
|
import { Button } from "./components/actions/Button/Button.js";
|
|
@@ -188,6 +188,7 @@ export {
|
|
|
188
188
|
parseFromISOString,
|
|
189
189
|
renderBars,
|
|
190
190
|
renderLines,
|
|
191
|
+
renderStackedSegment,
|
|
191
192
|
shouldTriggerShortcut,
|
|
192
193
|
useBoundaryOverflowDetection,
|
|
193
194
|
useBoundingClientRectListener,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@economic/taco",
|
|
3
|
-
"version": "17.
|
|
3
|
+
"version": "17.2.0-EC-005678-test-tanstack-virtual.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.cjs",
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
"@react-aria/focus": "^3.19.0",
|
|
52
52
|
"@react-aria/interactions": "^3.12.0",
|
|
53
53
|
"@tanstack/react-table": "^8.21.3",
|
|
54
|
-
"@tanstack/react-virtual": "3.14.
|
|
54
|
+
"@tanstack/react-virtual": "3.14.28",
|
|
55
55
|
"date-fns": "^4.4.0",
|
|
56
56
|
"lodash": "^4.18.1",
|
|
57
57
|
"motion": "12.42.2",
|
|
@@ -70,7 +70,7 @@
|
|
|
70
70
|
"@svgr/cli": "^8.1.0",
|
|
71
71
|
"@testing-library/jest-dom": "^7.0.1",
|
|
72
72
|
"@testing-library/react": "^16.3.3",
|
|
73
|
-
"@testing-library/user-event": "^14.6.
|
|
73
|
+
"@testing-library/user-event": "^14.6.13",
|
|
74
74
|
"@types/lodash": "^4.17.27",
|
|
75
75
|
"@types/node": "^22.20.5",
|
|
76
76
|
"@types/react": "19.2.18",
|
|
@@ -90,5 +90,5 @@
|
|
|
90
90
|
"vitest": "^4.1.12",
|
|
91
91
|
"vitest-fail-on-console": "^0.10.1"
|
|
92
92
|
},
|
|
93
|
-
"gitHead": "
|
|
93
|
+
"gitHead": "9f6a5293c40c6b57e94cd562c28bb00a29def006"
|
|
94
94
|
}
|