@tensor_1/react 2.14.2 → 2.16.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/README.md +5 -0
- package/dist/ChartCore-Do6gRBN3.d.cts +44 -0
- package/dist/chart-preset.cjs +41 -9
- package/dist/chart-preset.d.cts +2 -2
- package/dist/chart-preset.d.ts +1 -1
- package/dist/chart-preset.js +4 -1
- package/dist/chart.cjs +41 -9
- package/dist/chart.d.cts +2 -2
- package/dist/chart.d.ts +1 -1
- package/dist/chart.js +4 -1
- package/dist/combobox-model.d.ts +9 -0
- package/dist/combobox-model.js +10 -0
- package/dist/components/AsyncOperationStatus.d.ts +16 -0
- package/dist/components/AsyncOperationStatus.js +24 -0
- package/dist/components/Breadcrumbs.d.ts +18 -0
- package/dist/components/Breadcrumbs.js +14 -0
- package/dist/components/Card.d.ts +11 -2
- package/dist/components/Card.js +16 -1
- package/dist/components/Chart.d.ts +1 -1
- package/dist/components/Chart.js +4 -1
- package/dist/components/ChartCore.d.ts +24 -3
- package/dist/components/ChartCore.js +38 -9
- package/dist/components/CollapsibleSection.d.ts +11 -0
- package/dist/components/CollapsibleSection.js +17 -0
- package/dist/components/Combobox.d.ts +19 -0
- package/dist/components/Combobox.js +120 -0
- package/dist/components/DetailPage.d.ts +33 -0
- package/dist/components/DetailPage.js +19 -0
- package/dist/components/Dialogs.d.ts +35 -0
- package/dist/components/Dialogs.js +55 -0
- package/dist/components/Flow.d.ts +26 -0
- package/dist/components/Flow.js +48 -0
- package/dist/components/Modal.d.ts +3 -1
- package/dist/components/Modal.js +6 -4
- package/dist/components/Pipeline.d.ts +25 -0
- package/dist/components/Pipeline.js +65 -0
- package/dist/components/RelatedLinks.d.ts +16 -0
- package/dist/components/RelatedLinks.js +14 -0
- package/dist/components/RelativeTime.d.ts +23 -0
- package/dist/components/RelativeTime.js +40 -0
- package/dist/components/Sidebar.d.ts +7 -2
- package/dist/components/Sidebar.js +27 -9
- package/dist/components/States.d.ts +23 -4
- package/dist/components/States.js +28 -6
- package/dist/components/TableControls.d.ts +77 -0
- package/dist/components/TableControls.js +61 -0
- package/dist/components/ToggleRow.d.ts +14 -0
- package/dist/components/ToggleRow.js +16 -0
- package/dist/index.cjs +1392 -786
- package/dist/index.d.cts +323 -8
- package/dist/index.d.ts +16 -2
- package/dist/index.js +40 -2
- package/dist/relative-time-clock.d.ts +4 -0
- package/dist/relative-time-clock.js +33 -0
- package/dist/relative-time-model.d.ts +9 -0
- package/dist/relative-time-model.js +16 -0
- package/package.json +1 -1
- package/dist/ChartCore-Bt1C84ty.d.cts +0 -22
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
const clocks = /* @__PURE__ */ new Map();
|
|
2
|
+
const getClock = (interval) => {
|
|
3
|
+
let clock = clocks.get(interval);
|
|
4
|
+
if (!clock) {
|
|
5
|
+
clock = { now: Date.now(), listeners: /* @__PURE__ */ new Set() };
|
|
6
|
+
clocks.set(interval, clock);
|
|
7
|
+
}
|
|
8
|
+
return clock;
|
|
9
|
+
};
|
|
10
|
+
const readRelativeClock = (interval) => getClock(interval).now;
|
|
11
|
+
function subscribeRelativeClock(interval, listener) {
|
|
12
|
+
if (interval <= 0 || typeof window === "undefined") return () => {
|
|
13
|
+
};
|
|
14
|
+
const clock = getClock(interval);
|
|
15
|
+
clock.listeners.add(listener);
|
|
16
|
+
if (!clock.timer) {
|
|
17
|
+
clock.timer = window.setInterval(() => {
|
|
18
|
+
clock.now = Date.now();
|
|
19
|
+
clock.listeners.forEach((notify) => notify());
|
|
20
|
+
}, interval);
|
|
21
|
+
}
|
|
22
|
+
return () => {
|
|
23
|
+
clock.listeners.delete(listener);
|
|
24
|
+
if (clock.listeners.size === 0 && clock.timer) {
|
|
25
|
+
window.clearInterval(clock.timer);
|
|
26
|
+
clock.timer = void 0;
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
export {
|
|
31
|
+
readRelativeClock,
|
|
32
|
+
subscribeRelativeClock
|
|
33
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
type RelativeTimeUnit = 'second' | 'minute' | 'hour' | 'day';
|
|
2
|
+
interface RelativeTimeValue {
|
|
3
|
+
value: number;
|
|
4
|
+
unit: RelativeTimeUnit;
|
|
5
|
+
}
|
|
6
|
+
declare function parseDateValue(value: Date | number | string): Date | null;
|
|
7
|
+
declare function relativeTimeValue(date: Date, now: Date): RelativeTimeValue;
|
|
8
|
+
|
|
9
|
+
export { type RelativeTimeUnit, type RelativeTimeValue, parseDateValue, relativeTimeValue };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
function parseDateValue(value) {
|
|
2
|
+
const date = value instanceof Date ? new Date(value.getTime()) : new Date(value);
|
|
3
|
+
return Number.isNaN(date.getTime()) ? null : date;
|
|
4
|
+
}
|
|
5
|
+
function relativeTimeValue(date, now) {
|
|
6
|
+
const seconds = (date.getTime() - now.getTime()) / 1e3;
|
|
7
|
+
const absolute = Math.abs(seconds);
|
|
8
|
+
if (absolute < 60) return { value: Math.round(seconds), unit: "second" };
|
|
9
|
+
if (absolute < 3600) return { value: Math.round(seconds / 60), unit: "minute" };
|
|
10
|
+
if (absolute < 86400) return { value: Math.round(seconds / 3600), unit: "hour" };
|
|
11
|
+
return { value: Math.round(seconds / 86400), unit: "day" };
|
|
12
|
+
}
|
|
13
|
+
export {
|
|
14
|
+
parseDateValue,
|
|
15
|
+
relativeTimeValue
|
|
16
|
+
};
|
package/package.json
CHANGED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { CSSProperties, ReactNode } from 'react';
|
|
2
|
-
import { EChartsOption, ECharts } from 'echarts';
|
|
3
|
-
|
|
4
|
-
declare function uixChartPalette(): string[];
|
|
5
|
-
interface ChartTableRow {
|
|
6
|
-
[key: string]: string | number;
|
|
7
|
-
}
|
|
8
|
-
interface ChartProps {
|
|
9
|
-
option: EChartsOption;
|
|
10
|
-
title?: string;
|
|
11
|
-
subtitle?: string;
|
|
12
|
-
height?: string | number;
|
|
13
|
-
className?: string;
|
|
14
|
-
style?: CSSProperties;
|
|
15
|
-
ariaLabel?: string;
|
|
16
|
-
tableData?: ChartTableRow[];
|
|
17
|
-
tableHeaders?: string[];
|
|
18
|
-
onReady?: (chart: ECharts) => void;
|
|
19
|
-
header?: ReactNode;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
export { type ChartProps as C, type ChartTableRow as a, uixChartPalette as u };
|