@ztwoint/z-ui 0.1.125 → 0.1.127
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/components/dynamic-table/z2-table-pagination.js +22 -15
- package/dist/components/primitives/chart-card/builders/chart-builder-factory.js +17 -0
- package/dist/components/{chart-card → primitives/chart-card}/chart-card.js +2 -2
- package/dist/components/primitives/chart-card/config/colors.js +39 -0
- package/dist/components/primitives/popconfirm/popconfirm.const.d.ts +20 -0
- package/dist/components/primitives/popconfirm/popconfirm.const.js +22 -0
- package/dist/components/primitives/popconfirm/popconfirm.d.ts +4 -0
- package/dist/components/primitives/popconfirm/popconfirm.hook.d.ts +14 -0
- package/dist/components/primitives/popconfirm/popconfirm.hook.js +32 -0
- package/dist/components/primitives/popconfirm/popconfirm.js +78 -0
- package/dist/components/primitives/popconfirm/popconfirm.type.d.ts +24 -0
- package/dist/components/primitives/popconfirm/popconfirm.utils.d.ts +3 -0
- package/dist/components/primitives/popconfirm/popconfirm.utils.js +6 -0
- package/dist/components/primitives/select-compact/select-compact.js +17 -0
- package/dist/components/{table-card → primitives/table-card}/table-card.type.d.ts +3 -3
- package/dist/components/table/components/cell/avatar-cell.js +4 -4
- package/dist/components/table/table-provider.js +4 -4
- package/dist/components/table-filter/table-filter.context.js +3 -12
- package/dist/css/styles/tailwind.css +1 -1
- package/dist/index.d.ts +4 -3
- package/dist/index.js +346 -362
- package/dist/types/components/primitives/popconfirm/popconfirm.const.d.ts +20 -0
- package/dist/types/components/primitives/popconfirm/popconfirm.d.ts +4 -0
- package/dist/types/components/primitives/popconfirm/popconfirm.hook.d.ts +14 -0
- package/dist/types/components/primitives/popconfirm/popconfirm.type.d.ts +24 -0
- package/dist/types/components/primitives/popconfirm/popconfirm.utils.d.ts +3 -0
- package/dist/types/components/{table-card → primitives/table-card}/table-card.type.d.ts +4 -4
- package/dist/types/index.d.ts +4 -3
- package/package.json +1 -1
- package/dist/components/chart-card/builders/chart-builder-factory.js +0 -23
- package/dist/components/chart-card/config/colors.js +0 -49
- package/dist/components/select-compact/select-compact.js +0 -17
- package/dist/components/table-card/table-card.js +0 -215
- package/dist/components/table-filter/close-filter-confirm/filter-confirmation-dialog.js +0 -20
- package/dist/components/table-filter/close-filter-confirm/filter-confirmation-dialog.utils.js +0 -20
- package/dist/components/table-filter/filters/boolean.js +0 -67
- package/dist/components/table-filter/filters/checkbox.js +0 -70
- package/dist/components/table-filter/filters/number/filter-input-field.js +0 -38
- package/dist/components/table-filter/filters/number/number.hook.js +0 -33
- package/dist/components/table-filter/filters/number/number.js +0 -55
- package/dist/components/table-filter/filters/text.js +0 -50
- package/dist/components/table-filter/index.js +0 -11
- package/dist/components/table-filter/selected-filters-display/selected-filters-display.js +0 -31
- package/dist/components/table-filter/selected-filters-display/selected-filters-display.utils.js +0 -23
- package/dist/components/table-filter/table-filter-button.js +0 -181
- package/dist/components/table-filter/table-filter-column-button.js +0 -113
- package/dist/components/table-filter/table-filter-provider.js +0 -32
- package/dist/components/table-filter/table-filter.hook.js +0 -72
- package/dist/components/table-filter/table-filter.utils.js +0 -12
- /package/dist/components/{chart-card → primitives/chart-card}/builders/bar-chart-builder.d.ts +0 -0
- /package/dist/components/{chart-card → primitives/chart-card}/builders/bar-chart-builder.js +0 -0
- /package/dist/components/{chart-card → primitives/chart-card}/builders/chart-builder-factory.d.ts +0 -0
- /package/dist/components/{chart-card → primitives/chart-card}/builders/line-chart-builder.d.ts +0 -0
- /package/dist/components/{chart-card → primitives/chart-card}/builders/line-chart-builder.js +0 -0
- /package/dist/components/{chart-card → primitives/chart-card}/builders/pie-chart-builder.d.ts +0 -0
- /package/dist/components/{chart-card → primitives/chart-card}/builders/pie-chart-builder.js +0 -0
- /package/dist/components/{chart-card → primitives/chart-card}/chart-card-states.d.ts +0 -0
- /package/dist/components/{chart-card → primitives/chart-card}/chart-card-states.js +0 -0
- /package/dist/components/{chart-card → primitives/chart-card}/chart-card.config.types.d.ts +0 -0
- /package/dist/components/{chart-card → primitives/chart-card}/chart-card.d.ts +0 -0
- /package/dist/components/{chart-card → primitives/chart-card}/chart-card.types.d.ts +0 -0
- /package/dist/components/{chart-card → primitives/chart-card}/config/colors.d.ts +0 -0
- /package/dist/components/{chart-card → primitives/chart-card}/config/defaults.d.ts +0 -0
- /package/dist/components/{chart-card → primitives/chart-card}/config/defaults.js +0 -0
- /package/dist/components/{chart-card → primitives/chart-card}/index.d.ts +0 -0
- /package/dist/components/{chart-card → primitives/chart-card}/validators/config-validator.d.ts +0 -0
- /package/dist/components/{chart-card → primitives/chart-card}/validators/config-validator.js +0 -0
- /package/dist/components/{select-compact → primitives/select-compact}/select-compact.d.ts +0 -0
- /package/dist/components/{table-card → primitives/table-card}/index.d.ts +0 -0
- /package/dist/components/{table-card → primitives/table-card}/table-card.d.ts +0 -0
- /package/dist/types/components/{chart-card → primitives/chart-card}/builders/bar-chart-builder.d.ts +0 -0
- /package/dist/types/components/{chart-card → primitives/chart-card}/builders/chart-builder-factory.d.ts +0 -0
- /package/dist/types/components/{chart-card → primitives/chart-card}/builders/line-chart-builder.d.ts +0 -0
- /package/dist/types/components/{chart-card → primitives/chart-card}/builders/pie-chart-builder.d.ts +0 -0
- /package/dist/types/components/{chart-card → primitives/chart-card}/chart-card-states.d.ts +0 -0
- /package/dist/types/components/{chart-card → primitives/chart-card}/chart-card.config.types.d.ts +0 -0
- /package/dist/types/components/{chart-card → primitives/chart-card}/chart-card.d.ts +0 -0
- /package/dist/types/components/{chart-card → primitives/chart-card}/chart-card.types.d.ts +0 -0
- /package/dist/types/components/{chart-card → primitives/chart-card}/config/colors.d.ts +0 -0
- /package/dist/types/components/{chart-card → primitives/chart-card}/config/defaults.d.ts +0 -0
- /package/dist/types/components/{chart-card → primitives/chart-card}/index.d.ts +0 -0
- /package/dist/types/components/{chart-card → primitives/chart-card}/validators/config-validator.d.ts +0 -0
- /package/dist/types/components/{select-compact → primitives/select-compact}/select-compact.d.ts +0 -0
- /package/dist/types/components/{table-card → primitives/table-card}/index.d.ts +0 -0
- /package/dist/types/components/{table-card → primitives/table-card}/table-card.d.ts +0 -0
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import { jsx as t, jsxs as l, Fragment as f } from "react/jsx-runtime";
|
|
2
|
-
import { useZ2Table as
|
|
2
|
+
import { useZ2Table as k } from "./z2-table-context.js";
|
|
3
3
|
import { Z2Skeleton as N } from "../skeleton/skeleton.js";
|
|
4
4
|
import { Button as s } from "../button/button.js";
|
|
5
5
|
import "react";
|
|
6
|
-
import { cn as
|
|
7
|
-
import { Z2Select as
|
|
6
|
+
import { cn as z } from "../../lib/utils.js";
|
|
7
|
+
import { Z2Select as I, Z2SelectTrigger as L, Z2SelectValue as T, Z2SelectContent as Z, Z2SelectItem as G } from "../select/z2-select.js";
|
|
8
8
|
import $ from "../assets/icons/double-chevron-left.js";
|
|
9
9
|
import j from "../assets/icons/double-chevron-right.js";
|
|
10
10
|
import B from "../assets/icons/chevron-left.js";
|
|
11
11
|
import M from "../assets/icons/chevron-right.js";
|
|
12
12
|
import { Input as D } from "../input/input.js";
|
|
13
13
|
function X(P) {
|
|
14
|
-
var
|
|
15
|
-
const { table: a, recordCount: g, isLoading: h } =
|
|
14
|
+
var v;
|
|
15
|
+
const { table: a, recordCount: g, isLoading: h } = k(), e = { ...{
|
|
16
16
|
showSizeToggle: !1,
|
|
17
17
|
sizes: [25, 50, 100],
|
|
18
18
|
sizesLabel: "Show",
|
|
@@ -27,7 +27,7 @@ function X(P) {
|
|
|
27
27
|
nextPageLabel: "Go to next page",
|
|
28
28
|
ellipsisText: "...",
|
|
29
29
|
showGoToPage: !1
|
|
30
|
-
}, ...P }, r = " rtl:transform rtl:rotate-180", i = a.getState().pagination.pageIndex, c = a.getState().pagination.pageSize, x = i * c + 1,
|
|
30
|
+
}, ...P }, r = " rtl:transform rtl:rotate-180", i = a.getState().pagination.pageIndex, c = a.getState().pagination.pageSize, x = i * c + 1, b = Math.min((i + 1) * c, g), p = a.getPageCount(), w = e != null && e.info ? e.info.replace("{from}", x.toString()).replace("{to}", b.toString()).replace("{count}", g.toString()) : `${x} - ${b} of ${g}`, d = (e == null ? void 0 : e.moreLimit) || 5, m = Math.floor(i / d) * d, u = Math.min(m + d, p), S = () => {
|
|
31
31
|
const o = [];
|
|
32
32
|
for (let n = m; n < u; n++)
|
|
33
33
|
o.push(
|
|
@@ -36,6 +36,7 @@ function X(P) {
|
|
|
36
36
|
{
|
|
37
37
|
size: "small",
|
|
38
38
|
variant: "stroke",
|
|
39
|
+
type: "button",
|
|
39
40
|
disabled: i === n,
|
|
40
41
|
onClick: () => {
|
|
41
42
|
i !== n && a.setPageIndex(n);
|
|
@@ -51,14 +52,16 @@ function X(P) {
|
|
|
51
52
|
{
|
|
52
53
|
size: "small",
|
|
53
54
|
variant: "stroke",
|
|
55
|
+
type: "button",
|
|
54
56
|
onClick: () => a.setPageIndex(m - 1),
|
|
55
57
|
label: e.ellipsisText
|
|
56
58
|
}
|
|
57
|
-
) : null,
|
|
59
|
+
) : null, y = () => u < p ? /* @__PURE__ */ t(
|
|
58
60
|
s,
|
|
59
61
|
{
|
|
60
62
|
variant: "stroke",
|
|
61
63
|
size: "small",
|
|
64
|
+
type: "button",
|
|
62
65
|
onClick: () => a.setPageIndex(u),
|
|
63
66
|
label: e.ellipsisText
|
|
64
67
|
}
|
|
@@ -67,17 +70,17 @@ function X(P) {
|
|
|
67
70
|
"div",
|
|
68
71
|
{
|
|
69
72
|
"data-slot": "data-grid-pagination",
|
|
70
|
-
className:
|
|
73
|
+
className: z(
|
|
71
74
|
"flex flex-wrap flex-col sm:flex-row justify-between items-center gap-2.5 py-2.5 sm:py-0 grow",
|
|
72
75
|
e == null ? void 0 : e.className
|
|
73
76
|
),
|
|
74
77
|
children: [
|
|
75
|
-
/* @__PURE__ */ t("div", { className: "flex flex-wrap items-center space-x-2.5
|
|
76
|
-
/* @__PURE__ */ t("div", { className: "flex flex-col sm:flex-row justify-center sm:justify-end items-center gap-2.5
|
|
78
|
+
/* @__PURE__ */ t("div", { className: "flex flex-wrap items-center space-x-2.5 order-2 sm:order-1", children: h ? e == null ? void 0 : e.infoSkeleton : /* @__PURE__ */ t(f, { children: /* @__PURE__ */ t("div", { className: "leading-none-medium-sm text-neutral-secondary text-nowrap", children: w }) }) }),
|
|
79
|
+
/* @__PURE__ */ t("div", { className: "flex flex-col sm:flex-row justify-center sm:justify-end items-center gap-2.5 order-1 sm:order-2", children: h ? e == null ? void 0 : e.sizesSkeleton : /* @__PURE__ */ l(f, { children: [
|
|
77
80
|
e.showSizeToggle && /* @__PURE__ */ l(f, { children: [
|
|
78
81
|
/* @__PURE__ */ t("div", { className: "leading-none-medium-sm text-neutral-secondary", children: e.rowsPerPageLabel }),
|
|
79
82
|
/* @__PURE__ */ l(
|
|
80
|
-
|
|
83
|
+
I,
|
|
81
84
|
{
|
|
82
85
|
value: `${c}`,
|
|
83
86
|
onValueChange: (o) => {
|
|
@@ -85,8 +88,8 @@ function X(P) {
|
|
|
85
88
|
a.setPageSize(n);
|
|
86
89
|
},
|
|
87
90
|
children: [
|
|
88
|
-
/* @__PURE__ */ t(
|
|
89
|
-
/* @__PURE__ */ t(Z, { side: "top", className: "min-w-[50px]", children: (
|
|
91
|
+
/* @__PURE__ */ t(L, { className: "w-fit", size: "sm", children: /* @__PURE__ */ t(T, { placeholder: `${c}` }) }),
|
|
92
|
+
/* @__PURE__ */ t(Z, { side: "top", className: "min-w-[50px]", children: (v = e == null ? void 0 : e.sizes) == null ? void 0 : v.map((o) => /* @__PURE__ */ t(G, { value: `${o}`, children: o }, o)) })
|
|
90
93
|
]
|
|
91
94
|
}
|
|
92
95
|
)
|
|
@@ -110,12 +113,13 @@ function X(P) {
|
|
|
110
113
|
}
|
|
111
114
|
)
|
|
112
115
|
] }),
|
|
113
|
-
|
|
116
|
+
p > 1 && /* @__PURE__ */ l("div", { className: "flex items-center space-x-1 order-1 sm:order-2", children: [
|
|
114
117
|
/* @__PURE__ */ t(
|
|
115
118
|
s,
|
|
116
119
|
{
|
|
117
120
|
size: "small",
|
|
118
121
|
variant: "stroke",
|
|
122
|
+
type: "button",
|
|
119
123
|
className: r,
|
|
120
124
|
onClick: () => a.firstPage(),
|
|
121
125
|
disabled: !a.getCanPreviousPage(),
|
|
@@ -128,6 +132,7 @@ function X(P) {
|
|
|
128
132
|
{
|
|
129
133
|
size: "small",
|
|
130
134
|
variant: "stroke",
|
|
135
|
+
type: "button",
|
|
131
136
|
className: r,
|
|
132
137
|
onClick: () => a.previousPage(),
|
|
133
138
|
disabled: !a.getCanPreviousPage(),
|
|
@@ -137,12 +142,13 @@ function X(P) {
|
|
|
137
142
|
),
|
|
138
143
|
C(),
|
|
139
144
|
S(),
|
|
140
|
-
|
|
145
|
+
y(),
|
|
141
146
|
/* @__PURE__ */ t(
|
|
142
147
|
s,
|
|
143
148
|
{
|
|
144
149
|
size: "small",
|
|
145
150
|
variant: "stroke",
|
|
151
|
+
type: "button",
|
|
146
152
|
className: r,
|
|
147
153
|
onClick: () => a.nextPage(),
|
|
148
154
|
disabled: !a.getCanNextPage(),
|
|
@@ -155,6 +161,7 @@ function X(P) {
|
|
|
155
161
|
{
|
|
156
162
|
size: "small",
|
|
157
163
|
variant: "stroke",
|
|
164
|
+
type: "button",
|
|
158
165
|
className: r,
|
|
159
166
|
onClick: () => a.lastPage(),
|
|
160
167
|
disabled: !a.getCanNextPage(),
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { buildBarChartOptions as e } from "./bar-chart-builder.js";
|
|
2
|
+
import { buildLineChartOptions as n } from "./line-chart-builder.js";
|
|
3
|
+
import { buildPieChartOptions as u } from "./pie-chart-builder.js";
|
|
4
|
+
const a = {
|
|
5
|
+
line: n,
|
|
6
|
+
bar: e,
|
|
7
|
+
pie: u
|
|
8
|
+
};
|
|
9
|
+
function h(r, i, o, p) {
|
|
10
|
+
const t = a[r.type];
|
|
11
|
+
if (!t)
|
|
12
|
+
throw new Error(`Unsupported chart type: ${r.type}`);
|
|
13
|
+
return t(r, i, o, p);
|
|
14
|
+
}
|
|
15
|
+
export {
|
|
16
|
+
h as buildChartOptions
|
|
17
|
+
};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { jsx as a } from "react/jsx-runtime";
|
|
2
2
|
import * as p from "react";
|
|
3
|
-
import { cn as w } from "
|
|
3
|
+
import { cn as w } from "../../../lib/utils.js";
|
|
4
4
|
import { validateChartConfig as S, validateChartData as E } from "./validators/config-validator.js";
|
|
5
5
|
import { buildChartOptions as O } from "./builders/chart-builder-factory.js";
|
|
6
|
-
import { Chart as R } from "
|
|
6
|
+
import { Chart as R } from "../../chart/chart.js";
|
|
7
7
|
import { LoadingState as V, ErrorState as l, EmptyState as $ } from "./chart-card-states.js";
|
|
8
8
|
function D({
|
|
9
9
|
config: t,
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
const e = {
|
|
2
|
+
default: ["#2563eb", "#7c3aed", "#d97706", "#16a34a", "#dc2626", "#0284c7"]
|
|
3
|
+
}, f = {
|
|
4
|
+
basic: e.default,
|
|
5
|
+
smooth: ["#1d4ed8", "#38bdf8", "#22d3ee", "#6366f1"]
|
|
6
|
+
}, E = {
|
|
7
|
+
basic: e.default,
|
|
8
|
+
stacked: ["#0284c7", "#38bdf8", "#60a5fa", "#93c5fd"]
|
|
9
|
+
}, o = {
|
|
10
|
+
basic: e.default,
|
|
11
|
+
donut: ["#2563eb", "#7c3aed", "#d97706", "#16a34a", "#dc2626", "#0284c7", "#8b5cf6", "#f59e0b"]
|
|
12
|
+
}, T = {
|
|
13
|
+
line: f,
|
|
14
|
+
bar: E,
|
|
15
|
+
pie: o
|
|
16
|
+
}, n = {
|
|
17
|
+
text: {
|
|
18
|
+
primary: "#000000",
|
|
19
|
+
secondary: "#5d5d5d"
|
|
20
|
+
},
|
|
21
|
+
border: {
|
|
22
|
+
light: "#e7e7e7",
|
|
23
|
+
default: "#d1d1d1"
|
|
24
|
+
},
|
|
25
|
+
background: {
|
|
26
|
+
default: "#ffffff"
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
function r(t, a) {
|
|
30
|
+
var d;
|
|
31
|
+
const c = ((d = T[t]) == null ? void 0 : d[a]) ?? e.default;
|
|
32
|
+
return Array.from(c);
|
|
33
|
+
}
|
|
34
|
+
export {
|
|
35
|
+
T as CHART_THEME_PALETTES,
|
|
36
|
+
e as COLOR_PALETTES,
|
|
37
|
+
n as UI_COLORS,
|
|
38
|
+
r as getThemePalette
|
|
39
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export declare const POPCONFIRM_PLACEMENTS: {
|
|
2
|
+
readonly TOP: "top";
|
|
3
|
+
readonly TOP_LEFT: "topLeft";
|
|
4
|
+
readonly TOP_RIGHT: "topRight";
|
|
5
|
+
readonly BOTTOM: "bottom";
|
|
6
|
+
readonly BOTTOM_LEFT: "bottomLeft";
|
|
7
|
+
readonly BOTTOM_RIGHT: "bottomRight";
|
|
8
|
+
readonly LEFT: "left";
|
|
9
|
+
readonly LEFT_TOP: "leftTop";
|
|
10
|
+
readonly LEFT_BOTTOM: "leftBottom";
|
|
11
|
+
readonly RIGHT: "right";
|
|
12
|
+
readonly RIGHT_TOP: "rightTop";
|
|
13
|
+
readonly RIGHT_BOTTOM: "rightBottom";
|
|
14
|
+
};
|
|
15
|
+
export type PopconfirmPlacement = (typeof POPCONFIRM_PLACEMENTS)[keyof typeof POPCONFIRM_PLACEMENTS];
|
|
16
|
+
export declare const POPCONFIRM_DEFAULT_CONFIG: {
|
|
17
|
+
readonly okText: "OK";
|
|
18
|
+
readonly cancelText: "Cancel";
|
|
19
|
+
readonly placement: PopconfirmPlacement;
|
|
20
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
const T = {
|
|
2
|
+
TOP: "top",
|
|
3
|
+
TOP_LEFT: "topLeft",
|
|
4
|
+
TOP_RIGHT: "topRight",
|
|
5
|
+
BOTTOM: "bottom",
|
|
6
|
+
BOTTOM_LEFT: "bottomLeft",
|
|
7
|
+
BOTTOM_RIGHT: "bottomRight",
|
|
8
|
+
LEFT: "left",
|
|
9
|
+
LEFT_TOP: "leftTop",
|
|
10
|
+
LEFT_BOTTOM: "leftBottom",
|
|
11
|
+
RIGHT: "right",
|
|
12
|
+
RIGHT_TOP: "rightTop",
|
|
13
|
+
RIGHT_BOTTOM: "rightBottom"
|
|
14
|
+
}, t = {
|
|
15
|
+
okText: "OK",
|
|
16
|
+
cancelText: "Cancel",
|
|
17
|
+
placement: T.TOP
|
|
18
|
+
};
|
|
19
|
+
export {
|
|
20
|
+
t as POPCONFIRM_DEFAULT_CONFIG,
|
|
21
|
+
T as POPCONFIRM_PLACEMENTS
|
|
22
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
interface UsePopconfirmProps {
|
|
2
|
+
open?: boolean;
|
|
3
|
+
onOpenChange?: (open: boolean) => void;
|
|
4
|
+
onConfirm?: () => void | Promise<void>;
|
|
5
|
+
onCancel?: () => void;
|
|
6
|
+
}
|
|
7
|
+
export declare const usePopconfirm: (props: UsePopconfirmProps) => {
|
|
8
|
+
open: boolean;
|
|
9
|
+
confirmLoading: boolean;
|
|
10
|
+
handleOpenChange: (newOpen: boolean) => void;
|
|
11
|
+
handleConfirm: () => Promise<void>;
|
|
12
|
+
handleCancel: () => void;
|
|
13
|
+
};
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { useState as i, useCallback as a } from "react";
|
|
2
|
+
const g = (f) => {
|
|
3
|
+
const { open: c, onOpenChange: o, onConfirm: t, onCancel: e } = f, [m, d] = i(!1), [p, l] = i(!1), s = c !== void 0, u = s ? c : m, n = a(
|
|
4
|
+
(r) => {
|
|
5
|
+
s || d(r), o == null || o(r);
|
|
6
|
+
},
|
|
7
|
+
[s, o]
|
|
8
|
+
), C = a(async () => {
|
|
9
|
+
if (t) {
|
|
10
|
+
l(!0);
|
|
11
|
+
try {
|
|
12
|
+
await t(), n(!1);
|
|
13
|
+
} catch (r) {
|
|
14
|
+
console.error("Popconfirm confirm error:", r);
|
|
15
|
+
} finally {
|
|
16
|
+
l(!1);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
}, [t, n]), h = a(() => {
|
|
20
|
+
e == null || e(), n(!1);
|
|
21
|
+
}, [e, n]);
|
|
22
|
+
return {
|
|
23
|
+
open: u,
|
|
24
|
+
confirmLoading: p,
|
|
25
|
+
handleOpenChange: n,
|
|
26
|
+
handleConfirm: C,
|
|
27
|
+
handleCancel: h
|
|
28
|
+
};
|
|
29
|
+
};
|
|
30
|
+
export {
|
|
31
|
+
g as usePopconfirm
|
|
32
|
+
};
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { jsxs as d, jsx as a } from "react/jsx-runtime";
|
|
2
|
+
import { Popover as L, PopoverTrigger as R, PopoverContent as z } from "../../popover/popover.js";
|
|
3
|
+
import { Button as s } from "../../button/button.js";
|
|
4
|
+
import { POPCONFIRM_DEFAULT_CONFIG as l } from "./popconfirm.const.js";
|
|
5
|
+
import { usePopconfirm as A } from "./popconfirm.hook.js";
|
|
6
|
+
import { mapPlacementToRadixAlign as I, mapPlacementToRadixSide as _ } from "./popconfirm.utils.js";
|
|
7
|
+
import "react";
|
|
8
|
+
import { cn as f } from "../../../lib/utils.js";
|
|
9
|
+
const D = ({
|
|
10
|
+
title: h,
|
|
11
|
+
children: g,
|
|
12
|
+
onConfirm: x,
|
|
13
|
+
onCancel: c,
|
|
14
|
+
okText: N = l.okText,
|
|
15
|
+
cancelText: C = l.cancelText,
|
|
16
|
+
placement: r = l.placement,
|
|
17
|
+
open: p,
|
|
18
|
+
onOpenChange: v,
|
|
19
|
+
disabled: n = !1,
|
|
20
|
+
okButtonProps: e,
|
|
21
|
+
cancelButtonProps: i,
|
|
22
|
+
className: b
|
|
23
|
+
}) => {
|
|
24
|
+
const { open: O, confirmLoading: m, handleOpenChange: T, handleConfirm: w, handleCancel: j } = A({
|
|
25
|
+
open: p,
|
|
26
|
+
onOpenChange: v,
|
|
27
|
+
onConfirm: x,
|
|
28
|
+
onCancel: c
|
|
29
|
+
}), y = _(r), F = I(r);
|
|
30
|
+
return /* @__PURE__ */ d(L, { open: n ? !1 : O, onOpenChange: T, children: [
|
|
31
|
+
/* @__PURE__ */ a(R, { asChild: !0, disabled: n, "data-slot": "popconfirm-trigger", children: g }),
|
|
32
|
+
/* @__PURE__ */ a(
|
|
33
|
+
z,
|
|
34
|
+
{
|
|
35
|
+
side: y,
|
|
36
|
+
align: F,
|
|
37
|
+
sideOffset: 8,
|
|
38
|
+
className: f("p-3 w-auto min-w-[200px]", b),
|
|
39
|
+
"data-slot": "popconfirm-content",
|
|
40
|
+
children: /* @__PURE__ */ d("div", { className: "flex flex-col gap-3", children: [
|
|
41
|
+
/* @__PURE__ */ a("div", { className: "text-text-neutral-primary text-sm leading-medium-sm", children: h }),
|
|
42
|
+
/* @__PURE__ */ d("div", { className: "flex justify-end gap-2", children: [
|
|
43
|
+
/* @__PURE__ */ a(
|
|
44
|
+
s,
|
|
45
|
+
{
|
|
46
|
+
onClick: j,
|
|
47
|
+
variant: "stroke",
|
|
48
|
+
shade: "neutral",
|
|
49
|
+
size: "small",
|
|
50
|
+
disabled: m || (i == null ? void 0 : i.disabled),
|
|
51
|
+
className: f("min-w-16", i == null ? void 0 : i.className),
|
|
52
|
+
"data-slot": "popconfirm-cancel-button",
|
|
53
|
+
children: C
|
|
54
|
+
}
|
|
55
|
+
),
|
|
56
|
+
/* @__PURE__ */ a(
|
|
57
|
+
s,
|
|
58
|
+
{
|
|
59
|
+
onClick: w,
|
|
60
|
+
variant: "filled",
|
|
61
|
+
shade: "brand",
|
|
62
|
+
size: "small",
|
|
63
|
+
disabled: m || (e == null ? void 0 : e.disabled) || (i == null ? void 0 : i.disabled),
|
|
64
|
+
className: f("min-w-16", e == null ? void 0 : e.className),
|
|
65
|
+
"data-slot": "popconfirm-ok-button",
|
|
66
|
+
children: e != null && e.loading || m ? "Loading..." : N
|
|
67
|
+
}
|
|
68
|
+
)
|
|
69
|
+
] })
|
|
70
|
+
] })
|
|
71
|
+
}
|
|
72
|
+
)
|
|
73
|
+
] });
|
|
74
|
+
};
|
|
75
|
+
D.displayName = "Popconfirm";
|
|
76
|
+
export {
|
|
77
|
+
D as Popconfirm
|
|
78
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { PopconfirmPlacement } from './popconfirm.const';
|
|
3
|
+
export interface PopconfirmProps {
|
|
4
|
+
title: ReactNode;
|
|
5
|
+
children: ReactNode;
|
|
6
|
+
onConfirm?: () => void | Promise<void>;
|
|
7
|
+
onCancel?: () => void;
|
|
8
|
+
okText?: string;
|
|
9
|
+
cancelText?: string;
|
|
10
|
+
placement?: PopconfirmPlacement;
|
|
11
|
+
open?: boolean;
|
|
12
|
+
onOpenChange?: (open: boolean) => void;
|
|
13
|
+
disabled?: boolean;
|
|
14
|
+
okButtonProps?: {
|
|
15
|
+
loading?: boolean;
|
|
16
|
+
disabled?: boolean;
|
|
17
|
+
className?: string;
|
|
18
|
+
};
|
|
19
|
+
cancelButtonProps?: {
|
|
20
|
+
disabled?: boolean;
|
|
21
|
+
className?: string;
|
|
22
|
+
};
|
|
23
|
+
className?: string;
|
|
24
|
+
}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { PopconfirmPlacement } from './popconfirm.const';
|
|
2
|
+
export declare const mapPlacementToRadixSide: (placement: PopconfirmPlacement) => "top" | "bottom" | "left" | "right";
|
|
3
|
+
export declare const mapPlacementToRadixAlign: (placement: PopconfirmPlacement) => "start" | "center" | "end";
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { POPCONFIRM_PLACEMENTS as O } from "./popconfirm.const.js";
|
|
2
|
+
const _ = (T) => T === O.TOP || T === O.TOP_LEFT || T === O.TOP_RIGHT ? "top" : T === O.BOTTOM || T === O.BOTTOM_LEFT || T === O.BOTTOM_RIGHT ? "bottom" : T === O.LEFT || T === O.LEFT_TOP || T === O.LEFT_BOTTOM ? "left" : T === O.RIGHT || T === O.RIGHT_TOP || T === O.RIGHT_BOTTOM ? "right" : "top", P = (T) => T === O.TOP_LEFT || T === O.BOTTOM_LEFT || T === O.LEFT_TOP || T === O.RIGHT_TOP ? "start" : T === O.TOP_RIGHT || T === O.BOTTOM_RIGHT || T === O.LEFT_BOTTOM || T === O.RIGHT_BOTTOM ? "end" : "center";
|
|
3
|
+
export {
|
|
4
|
+
P as mapPlacementToRadixAlign,
|
|
5
|
+
_ as mapPlacementToRadixSide
|
|
6
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { jsxs as u, jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import { Z2Select as m, Z2SelectTrigger as S, Z2SelectValue as i, Z2SelectContent as Z, Z2SelectItem as d } from "../../select/z2-select.js";
|
|
3
|
+
function v({
|
|
4
|
+
value: r,
|
|
5
|
+
onChange: t,
|
|
6
|
+
options: c,
|
|
7
|
+
placeholder: a = "Select field",
|
|
8
|
+
className: n
|
|
9
|
+
}) {
|
|
10
|
+
return /* @__PURE__ */ u(m, { value: r || "", onValueChange: t, children: [
|
|
11
|
+
/* @__PURE__ */ e(S, { className: n, children: /* @__PURE__ */ e(i, { placeholder: a }) }),
|
|
12
|
+
/* @__PURE__ */ e(Z, { children: !!c && c.map((l) => /* @__PURE__ */ e(d, { value: l.value, children: l.label }, l.value)) })
|
|
13
|
+
] });
|
|
14
|
+
}
|
|
15
|
+
export {
|
|
16
|
+
v as Z2SelectCompact
|
|
17
|
+
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
|
-
import { TableProps, TableSchema, TableSearch, TableSort } from '
|
|
3
|
-
import { TableFilter, FilterRule, FilterSchema } from '
|
|
4
|
-
import { PaginationProps, PaginationInfoProps, PaginationQuickJumperProps } from '
|
|
2
|
+
import { TableProps, TableSchema, TableSearch, TableSort } from '../../table/table.type';
|
|
3
|
+
import { TableFilter, FilterRule, FilterSchema } from '../../table-filter/table-filter.type';
|
|
4
|
+
import { PaginationProps, PaginationInfoProps, PaginationQuickJumperProps } from '../../table/components/pagination/pagination.type';
|
|
5
5
|
export interface TableCardProps {
|
|
6
6
|
dataSource: Record<string, unknown>[];
|
|
7
7
|
schema: TableSchema;
|
|
@@ -32,7 +32,9 @@ import "../../table-provider.js";
|
|
|
32
32
|
import { Avatar as l } from "../../../avatar/avatar.js";
|
|
33
33
|
import "../../table.context.js";
|
|
34
34
|
import "../../../tooltip/tooltip.js";
|
|
35
|
-
import "../../../table-filter/
|
|
35
|
+
import "../../../table-filter/table-filter.context.js";
|
|
36
|
+
import "@radix-ui/react-popover";
|
|
37
|
+
import "react-virtuoso";
|
|
36
38
|
import "../../../badge/badge.js";
|
|
37
39
|
import "../../../text-preset/text-preset.js";
|
|
38
40
|
import "react-dom";
|
|
@@ -41,12 +43,10 @@ import "../../../../node_modules/@atlaskit/pragmatic-drag-and-drop/dist/esm/ledg
|
|
|
41
43
|
import "@radix-ui/react-slot";
|
|
42
44
|
import "../../../radio/z2-radio.js";
|
|
43
45
|
import "../../../segmented-control/item.js";
|
|
44
|
-
import "
|
|
46
|
+
import "../../../primitives/popconfirm/popconfirm.js";
|
|
45
47
|
import "../../../dynamic-table/z2-table.js";
|
|
46
48
|
import "../../../dynamic-table/z2-table-context.js";
|
|
47
49
|
import "../../../chart/chart.js";
|
|
48
|
-
import "../../../chart-card/config/defaults.js";
|
|
49
|
-
import "../../../chart-card/config/colors.js";
|
|
50
50
|
import "../../../z2map/map.js";
|
|
51
51
|
import "../../../z2map/map.constants.js";
|
|
52
52
|
import "../../../z2map/components/map-pin.js";
|
|
@@ -36,7 +36,9 @@ import "../stepper/stepper.js";
|
|
|
36
36
|
import "../stepper-item/stepper-item.js";
|
|
37
37
|
import "@radix-ui/react-tabs";
|
|
38
38
|
import "../tooltip/tooltip.js";
|
|
39
|
-
import "../table-filter/
|
|
39
|
+
import "../table-filter/table-filter.context.js";
|
|
40
|
+
import "@radix-ui/react-popover";
|
|
41
|
+
import "react-virtuoso";
|
|
40
42
|
import "../badge/badge.js";
|
|
41
43
|
import "../avatar/avatar.js";
|
|
42
44
|
import "../text-preset/text-preset.js";
|
|
@@ -46,12 +48,10 @@ import "../../node_modules/@atlaskit/pragmatic-drag-and-drop/dist/esm/ledger/dis
|
|
|
46
48
|
import "@radix-ui/react-slot";
|
|
47
49
|
import "../radio/z2-radio.js";
|
|
48
50
|
import "../segmented-control/item.js";
|
|
49
|
-
import "
|
|
51
|
+
import "../primitives/popconfirm/popconfirm.js";
|
|
50
52
|
import "../dynamic-table/z2-table.js";
|
|
51
53
|
import "../dynamic-table/z2-table-context.js";
|
|
52
54
|
import "../chart/chart.js";
|
|
53
|
-
import "../chart-card/config/defaults.js";
|
|
54
|
-
import "../chart-card/config/colors.js";
|
|
55
55
|
import "../z2map/map.js";
|
|
56
56
|
import "../z2map/map.constants.js";
|
|
57
57
|
import "../z2map/components/map-pin.js";
|
|
@@ -1,13 +1,4 @@
|
|
|
1
|
-
import * as
|
|
2
|
-
|
|
1
|
+
import * as t from "react";
|
|
2
|
+
t.createContext(
|
|
3
3
|
void 0
|
|
4
|
-
)
|
|
5
|
-
const t = e.useContext(o);
|
|
6
|
-
if (t === void 0)
|
|
7
|
-
throw new Error("useTableFilterContext must be used within a TableFilterProvider");
|
|
8
|
-
return t;
|
|
9
|
-
};
|
|
10
|
-
export {
|
|
11
|
-
o as TableFilterContext,
|
|
12
|
-
r as useTableFilterContext
|
|
13
|
-
};
|
|
4
|
+
);
|