@lax-wp/design-system 0.14.35 → 0.14.36
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/data-display/infinite-table/CellContextMenuPortal.cjs.js +2 -0
- package/dist/components/data-display/infinite-table/CellContextMenuPortal.cjs.js.map +1 -0
- package/dist/components/data-display/infinite-table/CellContextMenuPortal.d.ts +13 -0
- package/dist/components/data-display/infinite-table/CellContextMenuPortal.es.js +174 -0
- package/dist/components/data-display/infinite-table/CellContextMenuPortal.es.js.map +1 -0
- package/dist/components/data-display/infinite-table/body/cell/DataCell.cjs.js +1 -1
- package/dist/components/data-display/infinite-table/body/cell/DataCell.cjs.js.map +1 -1
- package/dist/components/data-display/infinite-table/body/cell/DataCell.es.js +183 -164
- package/dist/components/data-display/infinite-table/body/cell/DataCell.es.js.map +1 -1
- package/dist/components/data-display/infinite-table/constants.cjs.js +1 -1
- package/dist/components/data-display/infinite-table/constants.cjs.js.map +1 -1
- package/dist/components/data-display/infinite-table/constants.d.ts +8 -0
- package/dist/components/data-display/infinite-table/constants.es.js +24 -20
- package/dist/components/data-display/infinite-table/constants.es.js.map +1 -1
- package/dist/components/data-display/infinite-table/context.cjs.js +1 -1
- package/dist/components/data-display/infinite-table/context.cjs.js.map +1 -1
- package/dist/components/data-display/infinite-table/context.d.ts +5 -1
- package/dist/components/data-display/infinite-table/context.es.js +5 -2
- package/dist/components/data-display/infinite-table/context.es.js.map +1 -1
- package/dist/components/data-display/infinite-table/index.cjs.js +1 -1
- package/dist/components/data-display/infinite-table/index.cjs.js.map +1 -1
- package/dist/components/data-display/infinite-table/index.d.ts +1 -1
- package/dist/components/data-display/infinite-table/index.es.js +413 -397
- package/dist/components/data-display/infinite-table/index.es.js.map +1 -1
- package/dist/components/data-display/infinite-table/types.d.ts +65 -0
- package/dist/components/forms/currency-input/CurrencyInputField.cjs.js +1 -1
- package/dist/components/forms/currency-input/CurrencyInputField.cjs.js.map +1 -1
- package/dist/components/forms/currency-input/CurrencyInputField.es.js +24 -24
- package/dist/components/forms/currency-input/CurrencyInputField.es.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/providers/design-system-provider/types.d.ts +1 -0
- package/package.json +1 -1
|
@@ -1,235 +1,254 @@
|
|
|
1
|
-
import { jsxs as $, jsx as
|
|
2
|
-
import { useTheme as
|
|
3
|
-
import { formatDate as
|
|
4
|
-
import { getTableRowBgClassNamesByStatus as
|
|
5
|
-
import { useTableConfig as
|
|
6
|
-
import
|
|
7
|
-
import { Typography as
|
|
8
|
-
import { OpenInNewRounded as
|
|
1
|
+
import { jsxs as $, jsx as r, Fragment as We } from "react/jsx-runtime";
|
|
2
|
+
import { useTheme as Ue } from "../../../../../hooks/useTheme.es.js";
|
|
3
|
+
import { formatDate as J, formatCurrency as fe } from "../../../../../utils/formatters.es.js";
|
|
4
|
+
import { getTableRowBgClassNamesByStatus as Ye } from "../../../../../constants/table.es.js";
|
|
5
|
+
import { useTableConfig as Be } from "../../../../../providers/design-system-provider/hooks.es.js";
|
|
6
|
+
import Q from "../../../../tooltip/Tooltip.es.js";
|
|
7
|
+
import { Typography as Ge } from "../../../typography/Typography.es.js";
|
|
8
|
+
import { OpenInNewRounded as He } from "@mui/icons-material";
|
|
9
9
|
import x from "../../../../../_virtual/index.es.js";
|
|
10
|
-
import
|
|
11
|
-
import { Link as
|
|
12
|
-
import { TableContext as
|
|
13
|
-
import { InlineEditField as
|
|
14
|
-
import { CELL_DEFAULT_RIGHT_OFFSET as
|
|
15
|
-
import { LoadingSpinnerIcon as
|
|
16
|
-
let
|
|
17
|
-
const
|
|
10
|
+
import g, { useContext as Xe, useCallback as C, useState as S, useRef as Z, useEffect as v } from "react";
|
|
11
|
+
import { Link as qe } from "react-router-dom";
|
|
12
|
+
import { TableContext as Je } from "../../context.es.js";
|
|
13
|
+
import { InlineEditField as Qe } from "./InlineEditField.es.js";
|
|
14
|
+
import { CELL_DEFAULT_RIGHT_OFFSET as Ze, CELL_INDENT_PER_LEVEL_PX as P, CELL_STICKY_SHADOW_DARK as Pe, CELL_STICKY_SHADOW_LIGHT as Ee } from "../../constants.es.js";
|
|
15
|
+
import { LoadingSpinnerIcon as E, KeyboardArrowDownIcon as eo, KeyboardArrowRightFilledIcon as oo, LinkIcon as to } from "../../../../icon/icons.generated.es.js";
|
|
16
|
+
let ee;
|
|
17
|
+
const pe = (e) => {
|
|
18
18
|
const o = Number(e);
|
|
19
19
|
if (Number.isNaN(o) || e === null || e === void 0)
|
|
20
20
|
return "0ms";
|
|
21
21
|
if (o >= 864e5) {
|
|
22
|
-
const
|
|
23
|
-
return `${
|
|
22
|
+
const l = Math.floor(o / 864e5), i = Math.floor(o % 864e5 / 36e5), u = Math.floor(o % 36e5 / 6e4), w = Math.floor(o % 6e4 / 1e3);
|
|
23
|
+
return `${l}d ${i}h ${u}m ${w}s`;
|
|
24
24
|
}
|
|
25
25
|
if (o >= 36e5) {
|
|
26
|
-
const
|
|
27
|
-
return `${
|
|
26
|
+
const l = Math.floor(o / 36e5), i = Math.floor(o % 36e5 / 6e4), u = Math.floor(o % 6e4 / 1e3);
|
|
27
|
+
return `${l}h ${i}m ${u}s`;
|
|
28
28
|
}
|
|
29
29
|
if (o >= 6e4) {
|
|
30
|
-
const
|
|
31
|
-
return `${
|
|
30
|
+
const l = Math.floor(o / 6e4), i = Math.floor(o % 6e4 / 1e3);
|
|
31
|
+
return `${l}m ${i}s`;
|
|
32
32
|
}
|
|
33
33
|
return o >= 1e3 ? `${(o / 1e3).toFixed(2)}s` : `${o}ms`;
|
|
34
|
-
},
|
|
34
|
+
}, ro = (e, o, l) => {
|
|
35
|
+
const i = (V) => ["string", "number", "boolean"].includes(typeof V), u = i(e) ? e : o;
|
|
36
|
+
return i(u) ? String(u) : (l?.querySelector("[data-cell-content]") ?? l)?.innerText?.trim() || "";
|
|
37
|
+
}, ao = ({ children: e, withLink: o, linkTo: l, rowData: i, disableRowClick: u }) => o && !u ? /* @__PURE__ */ r(qe, { to: l?.(i?.id, i) || "", children: e }) : e, no = ({
|
|
35
38
|
cell: e,
|
|
36
39
|
id: o,
|
|
37
|
-
nextWidthSum:
|
|
38
|
-
isLastCell:
|
|
39
|
-
rowHovering:
|
|
40
|
-
index:
|
|
41
|
-
isFirstStickyCell:
|
|
42
|
-
handleCellClick:
|
|
40
|
+
nextWidthSum: l,
|
|
41
|
+
isLastCell: i,
|
|
42
|
+
rowHovering: u,
|
|
43
|
+
index: w,
|
|
44
|
+
isFirstStickyCell: V,
|
|
45
|
+
handleCellClick: we,
|
|
43
46
|
currentData: y,
|
|
44
47
|
highlightSubstring: D,
|
|
45
|
-
is_read:
|
|
46
|
-
is_modified:
|
|
47
|
-
is_row_modified:
|
|
48
|
-
is_deleted:
|
|
49
|
-
is_added:
|
|
48
|
+
is_read: so,
|
|
49
|
+
is_modified: oe,
|
|
50
|
+
is_row_modified: te,
|
|
51
|
+
is_deleted: z,
|
|
52
|
+
is_added: F,
|
|
50
53
|
level: b,
|
|
51
54
|
inlineEditing: k,
|
|
52
|
-
isInlineEditing:
|
|
55
|
+
isInlineEditing: m,
|
|
53
56
|
setRowHovering: O,
|
|
54
|
-
handleCellValueChange:
|
|
55
|
-
cellRef:
|
|
56
|
-
handleUpdateCellData:
|
|
57
|
-
registerValidation:
|
|
58
|
-
loadingExpand:
|
|
59
|
-
toggleRowExpand:
|
|
60
|
-
isDraggingOver:
|
|
61
|
-
isLoading:
|
|
62
|
-
is_incomplete:
|
|
63
|
-
pendingEdit:
|
|
64
|
-
hasPendingEdit:
|
|
65
|
-
pendingValidationError:
|
|
57
|
+
handleCellValueChange: he,
|
|
58
|
+
cellRef: ye,
|
|
59
|
+
handleUpdateCellData: be,
|
|
60
|
+
registerValidation: ve,
|
|
61
|
+
loadingExpand: ke,
|
|
62
|
+
toggleRowExpand: re,
|
|
63
|
+
isDraggingOver: xe,
|
|
64
|
+
isLoading: I,
|
|
65
|
+
is_incomplete: ae,
|
|
66
|
+
pendingEdit: s,
|
|
67
|
+
hasPendingEdit: c,
|
|
68
|
+
pendingValidationError: Te
|
|
66
69
|
}) => {
|
|
67
70
|
const {
|
|
68
|
-
cascadingTableConfig:
|
|
69
|
-
originalsOnly:
|
|
70
|
-
maxLevel:
|
|
71
|
-
showNewItem:
|
|
72
|
-
expandedRows:
|
|
73
|
-
rowLinkConfig:
|
|
74
|
-
multiSelectConfig:
|
|
71
|
+
cascadingTableConfig: ne,
|
|
72
|
+
originalsOnly: Ce,
|
|
73
|
+
maxLevel: ge,
|
|
74
|
+
showNewItem: uo,
|
|
75
|
+
expandedRows: _e,
|
|
76
|
+
rowLinkConfig: K,
|
|
77
|
+
multiSelectConfig: Ne,
|
|
75
78
|
cellEditing: A,
|
|
76
|
-
cellEditingValue:
|
|
77
|
-
allowInlineEdit:
|
|
78
|
-
fieldOperationLoading:
|
|
79
|
-
pendingEdits:
|
|
80
|
-
selectedRowId:
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
N.current &&
|
|
87
|
-
}, []),
|
|
88
|
-
L.current && clearTimeout(L.current),
|
|
79
|
+
cellEditingValue: j,
|
|
80
|
+
allowInlineEdit: se,
|
|
81
|
+
fieldOperationLoading: Le,
|
|
82
|
+
pendingEdits: Me,
|
|
83
|
+
selectedRowId: W,
|
|
84
|
+
cellContextMenuConfig: U,
|
|
85
|
+
openCellContextMenu: Y
|
|
86
|
+
} = Xe(Je), $e = W != null && String(W) === String(o), Se = Be(), B = (e?.column?.key ? e?.row?.original?.__cellMetadata?.[e.column.key] : void 0)?.is_locked ?? e?.column?.is_locked, G = (e?.column?.key ? Me?.[o]?.[e.column.key]?.validationError : null) || Te || null, R = k === e.column.key && e?.column?.canEdit && !B && !e?.column?.is_disabled, De = Le === `${o}-${e?.column?.id}`, { theme: Oe } = Ue(), Ie = Oe === "dark", Re = C(() => O(o), [O, o]), Ve = C(() => O(null), [O]), _ = Se?.formatDuration, [n, p] = S(
|
|
87
|
+
e?.column?.dataType === "duration" && e?.value ? _ ? _(e.value) : pe(e.value) : e.value
|
|
88
|
+
), [h, ue] = S(null), [H, ze] = S(!1), [Fe, ie] = S(!1), [Ke, le] = S(!1), N = Z(null), L = Z(), M = Z(), { selectedColumnIds: ce = [] } = Ne || {}, me = !Object.prototype.hasOwnProperty.call(e?.column?.meta ?? {}, "shouldHighlight") || e?.column?.meta?.shouldHighlight, de = C(() => {
|
|
89
|
+
N.current && ze(N.current.scrollWidth > N.current.clientWidth);
|
|
90
|
+
}, []), X = C((t) => {
|
|
91
|
+
L.current && clearTimeout(L.current), t ? ie(!0) : L.current = setTimeout(() => ie(!1), 200);
|
|
92
|
+
}, []), q = C((t) => {
|
|
93
|
+
M.current && clearTimeout(M.current), t ? le(!0) : M.current = setTimeout(() => le(!1), 200);
|
|
89
94
|
}, []), T = x({
|
|
90
|
-
"bg-amber-100 dark:bg-amber-900/30":
|
|
91
|
-
"bg-neutral-100 dark:bg-black-600":
|
|
92
|
-
"bg-error-200 dark:bg-error-900":
|
|
93
|
-
"bg-success-100 dark:bg-success-800":
|
|
94
|
-
"bg-warning-100 dark:bg-warning-950":
|
|
95
|
+
"bg-amber-100 dark:bg-amber-900/30": c,
|
|
96
|
+
"bg-neutral-100 dark:bg-black-600": u === o && !m && !c && !(z || y?.is_deleted) && !(F || y?.is_added),
|
|
97
|
+
"bg-error-200 dark:bg-error-900": u === o && !m && !c && (z || y?.is_deleted),
|
|
98
|
+
"bg-success-100 dark:bg-success-800": u === o && !m && !c && (F || y?.is_added),
|
|
99
|
+
"bg-warning-100 dark:bg-warning-950": u === o && !m && !c && (ae || oe || te || y?.is_row_modified),
|
|
95
100
|
// 'bg-primary-50 dark:bg-black-700': !is_incomplete && !is_read && showNewItem && !isLoading && rowHovering !== id && !isInlineEditing && !hasPendingEdit,
|
|
96
|
-
"bg-warning-50 dark:bg-orange-900": (
|
|
97
|
-
"bg-error-100 dark:bg-error-975": (
|
|
98
|
-
"bg-success-50 dark:bg-success-900": (
|
|
99
|
-
"bg-primary-50 dark:bg-primary-900": (
|
|
100
|
-
"bg-primary-50 dark:bg-primary-800":
|
|
101
|
-
"bg-primary-50 dark:bg-primary-700":
|
|
102
|
-
[
|
|
103
|
-
}), Ae = (
|
|
104
|
-
e.column?.disableRowClick ||
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
const
|
|
108
|
-
|
|
101
|
+
"bg-warning-50 dark:bg-orange-900": (ae || oe || te || y?.is_row_modified) && !I && u !== o && !m && !c,
|
|
102
|
+
"bg-error-100 dark:bg-error-975": (z || y?.is_deleted) && !I && u !== o && !m && !c,
|
|
103
|
+
"bg-success-50 dark:bg-success-900": (F || y?.is_added) && !I && u !== o && !m && !c,
|
|
104
|
+
"bg-primary-50 dark:bg-primary-900": (xe || m) && !c,
|
|
105
|
+
"bg-primary-50 dark:bg-primary-800": ce?.includes(e.column.id) && !m && !c,
|
|
106
|
+
"bg-primary-50 dark:bg-primary-700": $e && u !== o && !m && !c && !I,
|
|
107
|
+
[Ye[e?.row?.original?.__rowBgStatus]]: e?.row?.original?.__rowBgStatus && !m && !c
|
|
108
|
+
}), Ae = (t) => {
|
|
109
|
+
e.column?.disableRowClick || we(t);
|
|
110
|
+
}, je = C((t) => {
|
|
111
|
+
if (U?.isEnabled === !1 || !Y || R) return;
|
|
112
|
+
const a = {
|
|
113
|
+
rowId: o,
|
|
114
|
+
rowData: e?.row?.original ?? {},
|
|
115
|
+
columnKey: e?.column?.key ?? "",
|
|
116
|
+
column: e.column,
|
|
117
|
+
value: e?.value,
|
|
118
|
+
text: ro(n, e?.value, t.currentTarget),
|
|
119
|
+
cell: e
|
|
120
|
+
};
|
|
121
|
+
U?.isDisabledForCell?.(a) || (t.preventDefault(), t.stopPropagation(), Y({ x: t.clientX, y: t.clientY, target: a }));
|
|
122
|
+
}, [U, Y, R, o, e, n]);
|
|
123
|
+
v(() => (e?.row?.original?.status === "running" && e.column?.dataType === "duration" && (ee = setInterval(() => {
|
|
124
|
+
const a = new Date(J(e?.row?.original?.created_at || e?.row?.original?.executed_on, { withTime: !0, format: "yyyy-MM-dd HH:mm:ss" })), f = Math.abs((/* @__PURE__ */ new Date()).getTime() - new Date(a).getTime());
|
|
125
|
+
p(_ ? _(f) : pe(f));
|
|
109
126
|
}, 500)), () => {
|
|
110
|
-
|
|
111
|
-
}), [n, e.value, e?.row?.original?.created_at, e?.row?.original?.executed_on, e?.row?.original?.status, e.column?.dataType,
|
|
112
|
-
(e?.column?.tooltipCellKey || e?.column?.type?.toLowerCase() === "url") && (e?.column?.type?.toLowerCase() === "url" ?
|
|
127
|
+
ee && clearInterval(ee);
|
|
128
|
+
}), [n, e.value, e?.row?.original?.created_at, e?.row?.original?.executed_on, e?.row?.original?.status, e.column?.dataType, _]), v(() => {
|
|
129
|
+
(e?.column?.tooltipCellKey || e?.column?.type?.toLowerCase() === "url") && (e?.column?.type?.toLowerCase() === "url" ? ue(e?.value) : ue(e?.row?.original?.[String(e?.column?.tooltipCellKey)]));
|
|
113
130
|
}, [e?.column?.tooltipCellKey, e?.row?.original, e?.column?.type, e?.value]), v(() => {
|
|
114
131
|
if (e?.column?.type?.toLowerCase() === "currency")
|
|
115
|
-
if (
|
|
116
|
-
const
|
|
117
|
-
|
|
132
|
+
if (s?.value !== void 0) {
|
|
133
|
+
const t = e?.row?.original?.__rawData, a = e?.column?.Header, f = s?.meta?.currency_code || t?.[a]?.currency_code || "USD";
|
|
134
|
+
p(fe(s.value, f));
|
|
118
135
|
} else {
|
|
119
|
-
const
|
|
120
|
-
|
|
136
|
+
const t = e?.row?.original?.__rawData, a = e?.column?.Header;
|
|
137
|
+
p(fe(e?.value, t?.[a]?.currency_code || "USD"));
|
|
121
138
|
}
|
|
122
|
-
}, [e?.value, e?.column?.type, e?.column?.Header, e?.row?.original?.__rawData,
|
|
123
|
-
e?.column?.type?.toLowerCase() === "percentage" && (
|
|
124
|
-
}, [e?.value, e?.column?.type,
|
|
125
|
-
const
|
|
126
|
-
if (["date", "datetime"].includes(
|
|
127
|
-
if (
|
|
128
|
-
const
|
|
129
|
-
f
|
|
130
|
-
} else
|
|
131
|
-
}, [e?.value, e?.column?.type,
|
|
132
|
-
const
|
|
133
|
-
["currency", "percentage", "duration", "boolean", "date", "datetime"].includes(
|
|
134
|
-
}, [e?.value, e?.column?.type, e?.column?.dataType,
|
|
135
|
-
if (e?.column?.type?.toLowerCase() === "boolean" &&
|
|
136
|
-
const
|
|
137
|
-
|
|
139
|
+
}, [e?.value, e?.column?.type, e?.column?.Header, e?.row?.original?.__rawData, s?.value, s?.meta?.currency_code]), v(() => {
|
|
140
|
+
e?.column?.type?.toLowerCase() === "percentage" && (s?.value !== void 0 ? p(s.value?.toString() + "%" || "") : p(e?.value?.toString() + "%" || ""));
|
|
141
|
+
}, [e?.value, e?.column?.type, s?.value]), v(() => {
|
|
142
|
+
const t = e?.column?.type?.toLowerCase() || "";
|
|
143
|
+
if (["date", "datetime"].includes(t))
|
|
144
|
+
if (s?.value !== void 0) {
|
|
145
|
+
const a = t === "datetime", f = J(s.value, { withTime: a, skipTimezone: !0 });
|
|
146
|
+
p(f || s.value);
|
|
147
|
+
} else p(e.value);
|
|
148
|
+
}, [e?.value, e?.column?.type, s?.value]), v(() => {
|
|
149
|
+
const t = e?.column?.type?.toLowerCase() || "";
|
|
150
|
+
["currency", "percentage", "duration", "boolean", "date", "datetime"].includes(t) || (s?.value !== void 0 ? p(s.value) : e?.column?.dataType !== "duration" && p(e.value));
|
|
151
|
+
}, [e?.value, e?.column?.type, e?.column?.dataType, s?.value]), v(() => {
|
|
152
|
+
if (e?.column?.type?.toLowerCase() === "boolean" && se) {
|
|
153
|
+
const t = s?.value !== void 0 ? s.value : e?.value;
|
|
154
|
+
p(t === !0 || t === "true" || t === "True" || t === "Yes" || t === 1 ? "Yes" : "No");
|
|
138
155
|
}
|
|
139
|
-
}, [e?.value, e?.column?.type,
|
|
140
|
-
|
|
156
|
+
}, [e?.value, e?.column?.type, se, s?.value]), v(() => () => {
|
|
157
|
+
L.current && clearTimeout(L.current), M.current && clearTimeout(M.current);
|
|
141
158
|
}, []);
|
|
142
|
-
const
|
|
159
|
+
const d = g.isValidElement(n);
|
|
143
160
|
return /* @__PURE__ */ $(
|
|
144
161
|
"td",
|
|
145
162
|
{
|
|
146
163
|
id: e.value,
|
|
147
164
|
"data-column-key": e?.column?.key,
|
|
148
165
|
...e.getCellProps(),
|
|
149
|
-
onClick:
|
|
166
|
+
onClick: K?.isEnabled ? void 0 : Ae,
|
|
150
167
|
className: x(
|
|
151
168
|
"h-row",
|
|
152
169
|
{
|
|
153
170
|
"sticky left-0": e?.column?.sticky,
|
|
154
171
|
relative: !e?.column?.sticky,
|
|
155
|
-
"w-full":
|
|
172
|
+
"w-full": i,
|
|
156
173
|
"overflow-visible": k === e.column.key,
|
|
157
174
|
/** Chips/badges: avoid vertical clip from overflow-x-hidden + truncate (see isUiElementCell branch below) */
|
|
158
|
-
"overflow-x-hidden overflow-y-visible": k !== e.column.key &&
|
|
159
|
-
"overflow-hidden": k !== e.column.key && !
|
|
175
|
+
"overflow-x-hidden overflow-y-visible": k !== e.column.key && d,
|
|
176
|
+
"overflow-hidden": k !== e.column.key && !d
|
|
160
177
|
},
|
|
161
|
-
|
|
178
|
+
G && !R ? "outline outline-2 outline-error-500 -outline-offset-2 z-[5]" : "",
|
|
162
179
|
`${T || "bg-white dark:bg-black-800"}`
|
|
163
180
|
),
|
|
164
|
-
style: { minWidth: `${e.column.width}px`, maxWidth: `${e.column.width}px`, right: e?.column?.sticky ? `${
|
|
165
|
-
onMouseEnter:
|
|
181
|
+
style: { minWidth: `${e.column.width}px`, maxWidth: `${e.column.width}px`, right: e?.column?.sticky ? `${l}px` : Ze, paddingLeft: b > 0 && w === 0 ? `${b * P}px` : void 0 },
|
|
182
|
+
onMouseEnter: Re,
|
|
166
183
|
onMouseLeave: Ve,
|
|
184
|
+
onContextMenu: je,
|
|
167
185
|
children: [
|
|
168
|
-
/* @__PURE__ */
|
|
169
|
-
/* @__PURE__ */
|
|
170
|
-
const
|
|
171
|
-
return
|
|
186
|
+
/* @__PURE__ */ r(ao, { withLink: K?.isEnabled, linkTo: K?.linkTo || void 0, rowData: e?.row?.original, disableRowClick: e?.column?.disableRowClick, children: (Array.isArray(A) ? A.includes(`${o}-${e?.column?.id}`) : A === `${o}-${e?.column?.id}`) ? /* @__PURE__ */ $("div", { className: "h-row top-0 font-medium font-inter w-full absolute flex items-center px-4", children: [
|
|
187
|
+
/* @__PURE__ */ r("span", { className: "text-neutral-400 dark:text-black-400 truncate", children: (() => {
|
|
188
|
+
const t = `${o}-${e?.column?.id}`, a = typeof j == "object" ? j?.[t] : j, f = e?.column?.type?.toLowerCase();
|
|
189
|
+
return f === "boolean" ? a === !0 || a === "true" || a === "True" ? "Yes" : "No" : (f === "date" || f === "datetime") && a ? J(a, { withTime: f === "datetime", skipTimezone: !0 }) || String(a) : a != null ? String(a) : n;
|
|
172
190
|
})() }),
|
|
173
|
-
/* @__PURE__ */
|
|
174
|
-
] }) : k === e.column.key && e?.column?.canEdit && !
|
|
175
|
-
b > 0 &&
|
|
176
|
-
/* @__PURE__ */
|
|
177
|
-
|
|
191
|
+
/* @__PURE__ */ r("div", { className: "ml-2 flex items-center gap-1.5", children: /* @__PURE__ */ r(E, { className: "spinner text-neutral-600 dark:text-white", size: 12 }) })
|
|
192
|
+
] }) : k === e.column.key && e?.column?.canEdit && !B && !e?.column?.is_disabled ? /* @__PURE__ */ r("div", { className: "h-row w-full absolute top-0 left-0 flex items-center", style: { marginLeft: b > 0 && w === 0 ? `-${b * P}px` : void 0, width: b > 0 && w === 0 ? `calc(100% + ${b * P}px)` : "100%" }, children: /* @__PURE__ */ r(Qe, { cell: e, id: o, inlineEditing: k, cellRef: ye, handleCellValueChange: he, handleUpdateCellData: be, registerValidation: ve }) }) : /* @__PURE__ */ $(We, { children: [
|
|
193
|
+
b > 0 && w === 0 && /* @__PURE__ */ r("div", { className: "h-row border-l border-neutral-300 dark:border-black-600 ml-2" }),
|
|
194
|
+
/* @__PURE__ */ r("div", { className: "min-h-6", children: /* @__PURE__ */ r(
|
|
195
|
+
Q,
|
|
178
196
|
{
|
|
179
|
-
title:
|
|
180
|
-
hideTooltip: !
|
|
197
|
+
title: h && e?.column?.type?.toLowerCase() !== "url" ? h : void 0,
|
|
198
|
+
hideTooltip: !h || e?.column?.type?.toLowerCase() === "url",
|
|
181
199
|
delayShow: !0,
|
|
182
200
|
placement: "top",
|
|
183
201
|
children: /* @__PURE__ */ $(
|
|
184
202
|
"div",
|
|
185
203
|
{
|
|
186
|
-
className: x(`h-row top-0 font-medium font-inter overflow-index-auto whitespace-nowrap text-ellipsis dark:text-black-200 w-full absolute flex items-center ${T || "bg-white dark:bg-black-800"}`,
|
|
187
|
-
style: e?.column?.sticky &&
|
|
204
|
+
className: x(`h-row top-0 font-medium font-inter overflow-index-auto whitespace-nowrap text-ellipsis dark:text-black-200 w-full absolute flex items-center ${T || "bg-white dark:bg-black-800"}`, d ? "overflow-x-hidden overflow-y-visible" : "overflow-x-hidden", { "border border-b-0 border-t-0 border-primary-600 dark:border-blue-800": ce?.includes(e.column.id) }),
|
|
205
|
+
style: e?.column?.sticky && V ? { boxShadow: Ie ? Pe : Ee } : {},
|
|
188
206
|
children: [
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
} }) : /* @__PURE__ */
|
|
192
|
-
|
|
207
|
+
ne?.isCascading && !Ce && w === 0 && /* @__PURE__ */ r("div", { className: x("w-[22px] h-row flex items-center px-4", `${T || "bg-white dark:bg-black-800"}`), id: "cascading", children: ge > b && (e?.row?.original?.__has_children || ne?.showAllDropdown) && /* @__PURE__ */ r("div", { children: ke ? /* @__PURE__ */ r(E, { className: "text-neutral-600 dark:text-white", size: 8 }) : /* @__PURE__ */ r("div", { children: _e?.[o]?.isOpen ? /* @__PURE__ */ r(eo, { size: 20, className: "text-neutral-400 dark:text-neutral-400", onClick: (t) => {
|
|
208
|
+
re(), t.stopPropagation();
|
|
209
|
+
} }) : /* @__PURE__ */ r(oo, { size: 20, className: "text-neutral-400 dark:text-neutral-400", onClick: (t) => {
|
|
210
|
+
re(), t.stopPropagation();
|
|
193
211
|
} }) }) }) }),
|
|
194
|
-
e?.column?.type?.toLowerCase() === "url" &&
|
|
195
|
-
|
|
212
|
+
e?.column?.type?.toLowerCase() === "url" && h ? /* @__PURE__ */ r(
|
|
213
|
+
Q,
|
|
196
214
|
{
|
|
197
|
-
title: /* @__PURE__ */
|
|
198
|
-
/* @__PURE__ */
|
|
199
|
-
/* @__PURE__ */
|
|
200
|
-
/* @__PURE__ */
|
|
215
|
+
title: /* @__PURE__ */ r("div", { onMouseEnter: () => X(!0), onMouseLeave: () => X(!1), children: /* @__PURE__ */ r("a", { href: h, target: "_blank", rel: "noopener noreferrer", onClick: (t) => t.stopPropagation(), children: /* @__PURE__ */ $("div", { className: "flex gap-1 items-center w-full", children: [
|
|
216
|
+
/* @__PURE__ */ r("div", { className: "w-4 h-4", children: /* @__PURE__ */ r(to, { height: 16, width: 16 }) }),
|
|
217
|
+
/* @__PURE__ */ r(Ge, { variant: "medium", size: "small", className: "truncate", appearance: "custom", children: h }),
|
|
218
|
+
/* @__PURE__ */ r(He, { sx: { height: "16px", width: "16px", color: "#016DCF" } })
|
|
201
219
|
] }) }) }),
|
|
202
220
|
placement: "top",
|
|
203
|
-
open:
|
|
204
|
-
onOpenChange:
|
|
221
|
+
open: Fe,
|
|
222
|
+
onOpenChange: X,
|
|
205
223
|
className: "block w-full min-w-0 overflow-hidden",
|
|
206
|
-
children: /* @__PURE__ */
|
|
224
|
+
children: /* @__PURE__ */ r("div", { className: "w-full h-row flex items-center px-4 min-w-0 overflow-hidden text-primary-400", children: /* @__PURE__ */ r("span", { ref: N, "data-cell-content": !0, onMouseEnter: de, className: "truncate w-full", children: D && me && !g.isValidElement(n) && typeof n != "object" ? D(n) : n }) })
|
|
207
225
|
}
|
|
208
|
-
) : /* @__PURE__ */
|
|
209
|
-
|
|
226
|
+
) : /* @__PURE__ */ r(
|
|
227
|
+
Q,
|
|
210
228
|
{
|
|
211
|
-
title:
|
|
229
|
+
title: H && n && !d ? /* @__PURE__ */ r(
|
|
212
230
|
"div",
|
|
213
231
|
{
|
|
214
|
-
onMouseEnter: () =>
|
|
215
|
-
onMouseLeave: () =>
|
|
232
|
+
onMouseEnter: () => q(!0),
|
|
233
|
+
onMouseLeave: () => q(!1),
|
|
216
234
|
className: "max-h-96 overflow-y-auto whitespace-pre-wrap break-words no-scroll",
|
|
217
235
|
children: String(n)
|
|
218
236
|
}
|
|
219
237
|
) : void 0,
|
|
220
238
|
placement: "top",
|
|
221
239
|
delayShow: !0,
|
|
222
|
-
hideTooltip: !!
|
|
223
|
-
open:
|
|
224
|
-
onOpenChange:
|
|
225
|
-
className: x("block w-full min-w-0",
|
|
226
|
-
children: /* @__PURE__ */
|
|
240
|
+
hideTooltip: !!h,
|
|
241
|
+
open: H && !h && !d ? Ke : void 0,
|
|
242
|
+
onOpenChange: H && !h && !d ? q : void 0,
|
|
243
|
+
className: x("block w-full min-w-0", d ? "overflow-x-hidden overflow-y-visible" : "overflow-hidden"),
|
|
244
|
+
children: /* @__PURE__ */ r("div", { className: x("w-full h-row flex items-center px-4 min-w-0", d ? "overflow-x-hidden overflow-y-visible" : "overflow-hidden"), children: /* @__PURE__ */ r(
|
|
227
245
|
"span",
|
|
228
246
|
{
|
|
229
|
-
ref:
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
247
|
+
ref: d ? void 0 : N,
|
|
248
|
+
"data-cell-content": !0,
|
|
249
|
+
onMouseEnter: d ? void 0 : de,
|
|
250
|
+
className: x(d ? "flex min-w-0 max-w-full items-center justify-start gap-1" : "truncate w-full"),
|
|
251
|
+
children: D && me && !g.isValidElement(n) && typeof n != "object" ? D(n) : g.isValidElement(n) ? typeof n.type == "string" ? n : g.cloneElement(n, {
|
|
233
252
|
...n.props,
|
|
234
253
|
containerWidth: e.column.width
|
|
235
254
|
}) : n
|
|
@@ -243,14 +262,14 @@ const me = (e) => {
|
|
|
243
262
|
}
|
|
244
263
|
) })
|
|
245
264
|
] }) }),
|
|
246
|
-
|
|
247
|
-
|
|
265
|
+
G && !R && /* @__PURE__ */ r("div", { className: "absolute bottom-0 left-0 right-0 h-row flex items-end pointer-events-none z-[5]", children: /* @__PURE__ */ r("div", { className: "w-full bg-error-50 dark:bg-error-975 px-1.5 py-0.5 truncate", children: /* @__PURE__ */ r("span", { className: "text-error-600 text-2xs font-medium leading-none", children: G }) }) }),
|
|
266
|
+
De && !(k === e.column.key && e?.column?.canEdit && !B && !e?.column?.is_disabled) && /* @__PURE__ */ r("div", { className: "absolute top-0 right-0 bg-white dark:bg-black-800 rounded-full w-5 h-5 flex items-center justify-center border border-primary-300 dark:border-primary-600 shadow-sm z-10", children: /* @__PURE__ */ r(E, { className: "text-primary-600 dark:text-white", size: 8 }) })
|
|
248
267
|
]
|
|
249
268
|
},
|
|
250
|
-
|
|
269
|
+
w
|
|
251
270
|
);
|
|
252
|
-
},
|
|
271
|
+
}, No = g.memo(no);
|
|
253
272
|
export {
|
|
254
|
-
|
|
273
|
+
No as DataCell
|
|
255
274
|
};
|
|
256
275
|
//# sourceMappingURL=DataCell.es.js.map
|