@deepnoid/ui 0.1.201 → 0.1.203
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/.turbo/turbo-build.log +147 -147
- package/dist/{chunk-YBXBTE5T.mjs → chunk-COGGK5Q6.mjs} +1 -1
- package/dist/{chunk-75ZDPLJ4.mjs → chunk-K2RW5KLO.mjs} +20 -0
- package/dist/{chunk-KYWCJIXI.mjs → chunk-W3V4SZV5.mjs} +24 -68
- package/dist/components/picker/index.js +17 -0
- package/dist/components/picker/index.mjs +2 -2
- package/dist/components/picker/timePicker.js +508 -60
- package/dist/components/picker/timePicker.mjs +10 -2
- package/dist/components/select/index.js +476 -28
- package/dist/components/select/index.mjs +9 -1
- package/dist/components/select/select.d.mts +1 -0
- package/dist/components/select/select.d.ts +1 -0
- package/dist/components/select/select.js +476 -28
- package/dist/components/select/select.mjs +9 -1
- package/dist/components/table/index.js +19 -63
- package/dist/components/table/index.mjs +1 -1
- package/dist/components/table/table-body.js +19 -63
- package/dist/components/table/table-body.mjs +1 -1
- package/dist/components/table/table-head.d.mts +1 -1
- package/dist/components/table/table-head.d.ts +1 -1
- package/dist/components/table/table-head.js +19 -63
- package/dist/components/table/table-head.mjs +1 -1
- package/dist/components/table/table.js +19 -63
- package/dist/components/table/table.mjs +1 -1
- package/dist/index.js +36 -63
- package/dist/index.mjs +3 -3
- package/package.json +1 -1
|
@@ -16,12 +16,12 @@ import {
|
|
|
16
16
|
} from "./chunk-27Y6K5NK.mjs";
|
|
17
17
|
|
|
18
18
|
// src/components/table/table-head.tsx
|
|
19
|
-
import {
|
|
19
|
+
import { useLayoutEffect as useLayoutEffect2, useRef as useRef2, useState as useState3 } from "react";
|
|
20
20
|
|
|
21
21
|
// src/components/table/table.tsx
|
|
22
22
|
import {
|
|
23
23
|
forwardRef,
|
|
24
|
-
useEffect
|
|
24
|
+
useEffect,
|
|
25
25
|
useImperativeHandle,
|
|
26
26
|
useMemo,
|
|
27
27
|
useState as useState2
|
|
@@ -29,7 +29,7 @@ import {
|
|
|
29
29
|
import { tv } from "tailwind-variants";
|
|
30
30
|
|
|
31
31
|
// src/components/table/table-body.tsx
|
|
32
|
-
import {
|
|
32
|
+
import { useLayoutEffect, useRef, useState } from "react";
|
|
33
33
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
34
34
|
function TableCell({
|
|
35
35
|
row,
|
|
@@ -41,53 +41,31 @@ function TableCell({
|
|
|
41
41
|
}) {
|
|
42
42
|
var _a, _b;
|
|
43
43
|
const value = row[column.field];
|
|
44
|
-
const formattedValue = ((_a = column.valueFormatter) == null ? void 0 : _a.call(column, { value, field: column.field }))
|
|
44
|
+
const formattedValue = (_b = (_a = column.valueFormatter) == null ? void 0 : _a.call(column, { value, field: column.field })) != null ? _b : value;
|
|
45
45
|
const content = column.renderCell ? column.renderCell({ id: row.id, field: column.field, value, formattedValue, row }) : formattedValue;
|
|
46
|
+
const isTextContent = ["string", "number"].includes(typeof content) || content === null || content === void 0;
|
|
46
47
|
const tdRef = useRef(null);
|
|
47
48
|
const [showTitle, setShowTitle] = useState(false);
|
|
48
|
-
|
|
49
|
-
const checkOverflow = (el) => {
|
|
50
|
-
if (el.scrollWidth > el.clientWidth) {
|
|
51
|
-
return true;
|
|
52
|
-
}
|
|
53
|
-
const children = Array.from(el.children);
|
|
54
|
-
for (const child of children) {
|
|
55
|
-
if (child.scrollWidth > child.clientWidth) {
|
|
56
|
-
return true;
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
return false;
|
|
60
|
-
};
|
|
61
|
-
useEffect(() => {
|
|
49
|
+
useLayoutEffect(() => {
|
|
62
50
|
if (tdRef.current && isTextContent) {
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
setShowTitle(checkOverflow(tdRef.current));
|
|
66
|
-
}
|
|
67
|
-
}, 0);
|
|
51
|
+
const el = tdRef.current;
|
|
52
|
+
setShowTitle(el.scrollWidth > el.clientWidth);
|
|
68
53
|
}
|
|
69
54
|
}, [content, isTextContent]);
|
|
70
55
|
return /* @__PURE__ */ jsx(
|
|
71
56
|
"td",
|
|
72
57
|
{
|
|
73
58
|
ref: tdRef,
|
|
74
|
-
className: clsx(
|
|
75
|
-
slots.td(),
|
|
76
|
-
classNames == null ? void 0 : classNames.td,
|
|
77
|
-
column.className,
|
|
78
|
-
isTextContent && "truncate",
|
|
79
|
-
isTextContent && "[&>*]:inline-block [&>*]:max-w-full [&>*]:truncate [&>*]:align-middle"
|
|
80
|
-
),
|
|
59
|
+
className: clsx(slots.td(), classNames == null ? void 0 : classNames.td, column.className, isTextContent && "truncate"),
|
|
81
60
|
style: {
|
|
82
61
|
...getCellStyle(column),
|
|
83
62
|
maxWidth: column.width || "150px",
|
|
84
63
|
textAlign: column.align || "center",
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
}
|
|
64
|
+
whiteSpace: isTextContent ? "nowrap" : "normal",
|
|
65
|
+
overflow: isTextContent ? "hidden" : "visible",
|
|
66
|
+
textOverflow: isTextContent ? "ellipsis" : void 0
|
|
89
67
|
},
|
|
90
|
-
title: showTitle ? String(
|
|
68
|
+
title: showTitle && isTextContent ? String(content != null ? content : "") : void 0,
|
|
91
69
|
children: content
|
|
92
70
|
},
|
|
93
71
|
`${row.id}-${column.field}-${colIdx}-${rowIndex}`
|
|
@@ -194,10 +172,10 @@ var Table = forwardRef((originalProps, ref) => {
|
|
|
194
172
|
const checkboxWidth = rowCheckbox ? 40 : 0;
|
|
195
173
|
return columnsWidth + checkboxWidth;
|
|
196
174
|
}, [columns, rowCheckbox]);
|
|
197
|
-
|
|
175
|
+
useEffect(() => {
|
|
198
176
|
onCheckedRowsChange == null ? void 0 : onCheckedRowsChange(getCheckedRowData(checkedRowIds));
|
|
199
177
|
}, [checkedRowIds]);
|
|
200
|
-
|
|
178
|
+
useEffect(() => {
|
|
201
179
|
const currentRowIds = new Set(rows.map((row) => row.id));
|
|
202
180
|
const ids = Array.from(checkedRowIds);
|
|
203
181
|
const hasValidCheckedRows = ids.every((id) => currentRowIds.has(id));
|
|
@@ -561,37 +539,13 @@ function TableHeaderCell({
|
|
|
561
539
|
}) {
|
|
562
540
|
const thRef = useRef2(null);
|
|
563
541
|
const [showTitle, setShowTitle] = useState3(false);
|
|
564
|
-
|
|
565
|
-
if (
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
const children = Array.from(el.children);
|
|
569
|
-
for (const child of children) {
|
|
570
|
-
if (child.scrollWidth > child.clientWidth) {
|
|
571
|
-
return true;
|
|
572
|
-
}
|
|
573
|
-
}
|
|
574
|
-
return false;
|
|
575
|
-
};
|
|
576
|
-
const extractTextFromContent = (node) => {
|
|
577
|
-
if (typeof node === "string" || typeof node === "number") {
|
|
578
|
-
return String(node);
|
|
579
|
-
}
|
|
580
|
-
if (isValidElement(node)) {
|
|
581
|
-
return String(node.props.children || "");
|
|
582
|
-
}
|
|
583
|
-
return "";
|
|
584
|
-
};
|
|
585
|
-
useEffect3(() => {
|
|
586
|
-
if (thRef.current && !isCheckbox) {
|
|
587
|
-
setTimeout(() => {
|
|
588
|
-
if (thRef.current) {
|
|
589
|
-
setShowTitle(checkOverflow(thRef.current));
|
|
590
|
-
}
|
|
591
|
-
}, 0);
|
|
542
|
+
useLayoutEffect2(() => {
|
|
543
|
+
if (!isCheckbox && thRef.current) {
|
|
544
|
+
const el = thRef.current;
|
|
545
|
+
setShowTitle(el.scrollWidth > el.clientWidth);
|
|
592
546
|
}
|
|
593
547
|
}, [content, isCheckbox]);
|
|
594
|
-
const titleText = !isCheckbox && showTitle ?
|
|
548
|
+
const titleText = !isCheckbox && showTitle ? typeof content === "string" || typeof content === "number" ? String(content) : "" : void 0;
|
|
595
549
|
return /* @__PURE__ */ jsx3(
|
|
596
550
|
"th",
|
|
597
551
|
{
|
|
@@ -604,7 +558,10 @@ function TableHeaderCell({
|
|
|
604
558
|
flexShrink: 0,
|
|
605
559
|
flexGrow: 0,
|
|
606
560
|
boxSizing: "border-box"
|
|
607
|
-
} : column ? {
|
|
561
|
+
} : column ? {
|
|
562
|
+
...getCellStyle(column),
|
|
563
|
+
textAlign: "center"
|
|
564
|
+
} : void 0,
|
|
608
565
|
title: titleText,
|
|
609
566
|
children: content
|
|
610
567
|
}
|
|
@@ -613,7 +570,6 @@ function TableHeaderCell({
|
|
|
613
570
|
var TableHead = ({
|
|
614
571
|
slots,
|
|
615
572
|
columns,
|
|
616
|
-
color,
|
|
617
573
|
size,
|
|
618
574
|
rowCheckbox = false,
|
|
619
575
|
hasCheckedRows,
|
|
@@ -7156,6 +7156,7 @@ var Select = (0, import_react8.forwardRef)((originalProps, ref) => {
|
|
|
7156
7156
|
dropdownIconName = "brace-up",
|
|
7157
7157
|
optionIconName,
|
|
7158
7158
|
optionIconPlacement,
|
|
7159
|
+
clearable,
|
|
7159
7160
|
...inputProps
|
|
7160
7161
|
} = props;
|
|
7161
7162
|
const slots = (0, import_react8.useMemo)(() => select({ ...variantProps }), [variantProps]);
|
|
@@ -7209,6 +7210,11 @@ var Select = (0, import_react8.forwardRef)((originalProps, ref) => {
|
|
|
7209
7210
|
setSelectedOptions(nextOptions);
|
|
7210
7211
|
onChange == null ? void 0 : onChange(nextOptions);
|
|
7211
7212
|
};
|
|
7213
|
+
const handleClear = (e) => {
|
|
7214
|
+
e.stopPropagation();
|
|
7215
|
+
setSelectedOptions([]);
|
|
7216
|
+
onChange == null ? void 0 : onChange([]);
|
|
7217
|
+
};
|
|
7212
7218
|
(0, import_react8.useEffect)(() => {
|
|
7213
7219
|
const handleClickOutside = (e) => {
|
|
7214
7220
|
var _a2;
|
|
@@ -7335,6 +7341,17 @@ var Select = (0, import_react8.forwardRef)((originalProps, ref) => {
|
|
|
7335
7341
|
}
|
|
7336
7342
|
),
|
|
7337
7343
|
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("input", { type: "hidden", name: inputProps.name, value: selectedValue }),
|
|
7344
|
+
clearable && selectedOptions.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
7345
|
+
icon_button_default,
|
|
7346
|
+
{
|
|
7347
|
+
name: "close",
|
|
7348
|
+
variant: "ghost",
|
|
7349
|
+
size: "sm",
|
|
7350
|
+
color: "neutral",
|
|
7351
|
+
onClick: handleClear,
|
|
7352
|
+
classNames: { base: "pr-[2px]" }
|
|
7353
|
+
}
|
|
7354
|
+
),
|
|
7338
7355
|
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
7339
7356
|
Icon_default,
|
|
7340
7357
|
{
|
|
@@ -9,9 +9,9 @@ import {
|
|
|
9
9
|
} from "../../chunk-XZYQFBCT.mjs";
|
|
10
10
|
import {
|
|
11
11
|
timePicker_default
|
|
12
|
-
} from "../../chunk-
|
|
12
|
+
} from "../../chunk-COGGK5Q6.mjs";
|
|
13
13
|
import "../../chunk-QCEKPS7U.mjs";
|
|
14
|
-
import "../../chunk-
|
|
14
|
+
import "../../chunk-K2RW5KLO.mjs";
|
|
15
15
|
import "../../chunk-2GCSFWHD.mjs";
|
|
16
16
|
import "../../chunk-3RTVVQA3.mjs";
|
|
17
17
|
import "../../chunk-MY5U63QO.mjs";
|