twico-ui 1.14.0 → 1.14.1
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/CHANGELOG.md +7 -0
- package/dist/index.cjs +24 -13
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +15 -0
- package/dist/index.d.ts +15 -0
- package/dist/index.mjs +24 -13
- package/dist/index.mjs.map +1 -1
- package/llms.txt +3 -0
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -1762,6 +1762,14 @@ interface DatatableProps<T = any> extends Omit<React.HTMLAttributes<HTMLDivEleme
|
|
|
1762
1762
|
/** Restrict the toolbar quick-search to these column `field`s (client mode); defaults to every
|
|
1763
1763
|
* visible column. Mirrors `runDatatableQuery`'s `options.searchFields`. */
|
|
1764
1764
|
searchFields?: string[];
|
|
1765
|
+
/** Render the built-in toolbar quick-search box. Set `false` to externalize search — supply your
|
|
1766
|
+
* own input wired to `quickFilter`/`onQuickFilterChange` (mirrors CardGrid). @default true */
|
|
1767
|
+
searchable?: boolean;
|
|
1768
|
+
/** Controlled quick-search string; pair with `onQuickFilterChange` to drive search from outside
|
|
1769
|
+
* (the value still flows into client filtering and the `onServerChange` query). */
|
|
1770
|
+
quickFilter?: string;
|
|
1771
|
+
/** Fires with the new quick-search string as the user types (and when a host sets it). */
|
|
1772
|
+
onQuickFilterChange?: (value: string) => void;
|
|
1765
1773
|
/**
|
|
1766
1774
|
* Actions shown in the toolbar when one or more rows are selected (requires
|
|
1767
1775
|
* `checkboxSelection`). Each handler receives the selected keys, the resolved
|
|
@@ -1982,6 +1990,13 @@ interface DatatableColumn<T = any> {
|
|
|
1982
1990
|
editable?: boolean;
|
|
1983
1991
|
/** Editor type. "select" (or any column with `valueOptions`) renders a dropdown; else a text/number input by column type. */
|
|
1984
1992
|
editType?: "text" | "number" | "select";
|
|
1993
|
+
/** Full escape hatch for the inline cell editor — render your own control (a searchable / creatable /
|
|
1994
|
+
* async `Combobox`, a `MasterCombobox`, …) for a value backed by a large, extensible vocabulary.
|
|
1995
|
+
* Providing it makes the column editable (unless `editable: false`) and takes precedence over the
|
|
1996
|
+
* built-in select/text editor. Call `commit(nextValue)` to save (fires `onRowUpdate`/`onRowsChange`)
|
|
1997
|
+
* or `cancel()` to discard. Twico overlay dropdowns (portaled as `.twc-pop`) are exempt from the
|
|
1998
|
+
* cell's outside-click auto-cancel, so a Combobox popover works inside the cell. */
|
|
1999
|
+
renderEditCell?: (args: { value: any; row: T; field: string; commit: (nextValue: any) => void; cancel: () => void }) => React.ReactNode;
|
|
1985
2000
|
/** Hide the column header ⋮ menu. @default false */
|
|
1986
2001
|
disableColumnMenu?: boolean;
|
|
1987
2002
|
/** Start with this column's cell text wrapped onto multiple lines (the row grows down) instead of
|
package/dist/index.d.ts
CHANGED
|
@@ -1762,6 +1762,14 @@ interface DatatableProps<T = any> extends Omit<React.HTMLAttributes<HTMLDivEleme
|
|
|
1762
1762
|
/** Restrict the toolbar quick-search to these column `field`s (client mode); defaults to every
|
|
1763
1763
|
* visible column. Mirrors `runDatatableQuery`'s `options.searchFields`. */
|
|
1764
1764
|
searchFields?: string[];
|
|
1765
|
+
/** Render the built-in toolbar quick-search box. Set `false` to externalize search — supply your
|
|
1766
|
+
* own input wired to `quickFilter`/`onQuickFilterChange` (mirrors CardGrid). @default true */
|
|
1767
|
+
searchable?: boolean;
|
|
1768
|
+
/** Controlled quick-search string; pair with `onQuickFilterChange` to drive search from outside
|
|
1769
|
+
* (the value still flows into client filtering and the `onServerChange` query). */
|
|
1770
|
+
quickFilter?: string;
|
|
1771
|
+
/** Fires with the new quick-search string as the user types (and when a host sets it). */
|
|
1772
|
+
onQuickFilterChange?: (value: string) => void;
|
|
1765
1773
|
/**
|
|
1766
1774
|
* Actions shown in the toolbar when one or more rows are selected (requires
|
|
1767
1775
|
* `checkboxSelection`). Each handler receives the selected keys, the resolved
|
|
@@ -1982,6 +1990,13 @@ interface DatatableColumn<T = any> {
|
|
|
1982
1990
|
editable?: boolean;
|
|
1983
1991
|
/** Editor type. "select" (or any column with `valueOptions`) renders a dropdown; else a text/number input by column type. */
|
|
1984
1992
|
editType?: "text" | "number" | "select";
|
|
1993
|
+
/** Full escape hatch for the inline cell editor — render your own control (a searchable / creatable /
|
|
1994
|
+
* async `Combobox`, a `MasterCombobox`, …) for a value backed by a large, extensible vocabulary.
|
|
1995
|
+
* Providing it makes the column editable (unless `editable: false`) and takes precedence over the
|
|
1996
|
+
* built-in select/text editor. Call `commit(nextValue)` to save (fires `onRowUpdate`/`onRowsChange`)
|
|
1997
|
+
* or `cancel()` to discard. Twico overlay dropdowns (portaled as `.twc-pop`) are exempt from the
|
|
1998
|
+
* cell's outside-click auto-cancel, so a Combobox popover works inside the cell. */
|
|
1999
|
+
renderEditCell?: (args: { value: any; row: T; field: string; commit: (nextValue: any) => void; cancel: () => void }) => React.ReactNode;
|
|
1985
2000
|
/** Hide the column header ⋮ menu. @default false */
|
|
1986
2001
|
disableColumnMenu?: boolean;
|
|
1987
2002
|
/** Start with this column's cell text wrapped onto multiple lines (the row grows down) instead of
|
package/dist/index.mjs
CHANGED
|
@@ -7070,7 +7070,8 @@ var FIELD_CSS2 = `
|
|
|
7070
7070
|
.twc-field__req { color: var(--color-danger); }
|
|
7071
7071
|
.twc-field__hint { font-size: var(--text-xs); color: var(--color-text-muted); }
|
|
7072
7072
|
.twc-field__error { font-size: var(--text-xs); color: var(--color-danger-subtle-fg); font-weight: var(--font-medium); }
|
|
7073
|
-
|
|
7073
|
+
`;
|
|
7074
|
+
var INPUT_EXTRA_CSS = `
|
|
7074
7075
|
.twc-input {
|
|
7075
7076
|
--_h: var(--control-h-md);
|
|
7076
7077
|
display: flex; align-items: center; gap: var(--space-2);
|
|
@@ -7079,6 +7080,7 @@ var FIELD_CSS2 = `
|
|
|
7079
7080
|
background: var(--color-surface);
|
|
7080
7081
|
border: var(--border-thin) solid var(--color-border);
|
|
7081
7082
|
border-radius: var(--radius-md);
|
|
7083
|
+
overflow: hidden;
|
|
7082
7084
|
transition: border-color var(--duration-fast) var(--ease-standard),
|
|
7083
7085
|
box-shadow var(--duration-fast) var(--ease-standard),
|
|
7084
7086
|
background-color var(--duration-fast) var(--ease-standard);
|
|
@@ -7112,9 +7114,6 @@ var FIELD_CSS2 = `
|
|
|
7112
7114
|
.twc-input__reveal:hover { background: var(--color-surface-sunken); color: var(--color-text); }
|
|
7113
7115
|
.twc-input__reveal:focus-visible { outline: none; box-shadow: var(--ring); }
|
|
7114
7116
|
.twc-input__reveal svg { width: 17px; height: 17px; }
|
|
7115
|
-
`;
|
|
7116
|
-
var INPUT_EXTRA_CSS = `
|
|
7117
|
-
.twc-input { overflow: hidden; }
|
|
7118
7117
|
.twc-input__addon { align-self: stretch; display: inline-flex; align-items: center; padding-inline: var(--space-3);
|
|
7119
7118
|
background: var(--color-surface-sunken); color: var(--color-text-muted); font-size: var(--text-sm);
|
|
7120
7119
|
font-weight: var(--font-semibold); white-space: nowrap; flex: none; }
|
|
@@ -8872,6 +8871,9 @@ function Datatable({
|
|
|
8872
8871
|
rowGrouping = [],
|
|
8873
8872
|
rowNumbers = false,
|
|
8874
8873
|
searchFields = null,
|
|
8874
|
+
searchable = true,
|
|
8875
|
+
quickFilter,
|
|
8876
|
+
onQuickFilterChange,
|
|
8875
8877
|
rowPinning = false,
|
|
8876
8878
|
rowReorder = false,
|
|
8877
8879
|
rowResize = false,
|
|
@@ -8954,7 +8956,13 @@ function Datatable({
|
|
|
8954
8956
|
return { left, right };
|
|
8955
8957
|
});
|
|
8956
8958
|
const [density, setDensity] = React51__default.useState(densityProp);
|
|
8957
|
-
const [
|
|
8959
|
+
const [internalQuick, setInternalQuick] = React51__default.useState("");
|
|
8960
|
+
const quick = quickFilter !== void 0 ? quickFilter : internalQuick;
|
|
8961
|
+
const commitQuick = (v) => {
|
|
8962
|
+
onQuickFilterChange?.(v);
|
|
8963
|
+
if (quickFilter === void 0) setInternalQuick(v);
|
|
8964
|
+
commitPage(0);
|
|
8965
|
+
};
|
|
8958
8966
|
const [selected, setSelected] = React51__default.useState(() => /* @__PURE__ */ new Set());
|
|
8959
8967
|
const [activeRow, setActiveRow] = React51__default.useState(null);
|
|
8960
8968
|
const [activeCell, setActiveCell] = React51__default.useState(null);
|
|
@@ -9834,7 +9842,7 @@ function Datatable({
|
|
|
9834
9842
|
setSelected(/* @__PURE__ */ new Set());
|
|
9835
9843
|
}
|
|
9836
9844
|
const [editing, setEditing] = React51__default.useState(null);
|
|
9837
|
-
const isColEditable = (c) => c.type !== "actions" &&
|
|
9845
|
+
const isColEditable = (c) => c.type !== "actions" && c.editable !== false && (c.editable === true || c.renderEditCell != null || editMode);
|
|
9838
9846
|
function beginEdit(rowK, col, row) {
|
|
9839
9847
|
if (!isColEditable(col)) return;
|
|
9840
9848
|
setEditing({ key: rowK, field: col.field, value: row[col.field] ?? "" });
|
|
@@ -10165,7 +10173,13 @@ function Datatable({
|
|
|
10165
10173
|
!checkboxSelection && reorderable && ci === 0 && !isEditing ? /* @__PURE__ */ jsxs("span", { style: { display: "inline-flex", alignItems: "center", gap: 6, maxWidth: "100%" }, children: [
|
|
10166
10174
|
rowHandle(k, midIdx, row),
|
|
10167
10175
|
/* @__PURE__ */ jsx("span", { style: { overflow: "hidden", textOverflow: "ellipsis" }, children: isActions ? renderActions(c, row) : c.renderCell ? c.renderCell(val, row) : c.valueFormatter ? c.valueFormatter(val, row) : val })
|
|
10168
|
-
] }) : isEditing ?
|
|
10176
|
+
] }) : isEditing ? c.renderEditCell ? (
|
|
10177
|
+
// #236: full escape hatch — the host drops in its own editor (searchable/creatable/
|
|
10178
|
+
// async Combobox, …) and drives the lifecycle via commit/cancel. Wrapped in
|
|
10179
|
+
// .twc-dt__editor-wrap so inline clicks (and any .twc-pop portal dropdown) don't
|
|
10180
|
+
// trip the outside-click auto-cancel.
|
|
10181
|
+
/* @__PURE__ */ jsx("div", { className: "twc-dt__editor-wrap", children: c.renderEditCell({ value: editing.value, row, field: c.field, commit: (v) => commitEdit(v), cancel: cancelEdit }) })
|
|
10182
|
+
) : /* @__PURE__ */ jsx(
|
|
10169
10183
|
EditCell,
|
|
10170
10184
|
{
|
|
10171
10185
|
col: c,
|
|
@@ -10455,13 +10469,10 @@ function Datatable({
|
|
|
10455
10469
|
}
|
|
10456
10470
|
)
|
|
10457
10471
|
] }) : null,
|
|
10458
|
-
/* @__PURE__ */ jsxs("div", { className: "twc-dt__search", children: [
|
|
10472
|
+
searchable ? /* @__PURE__ */ jsxs("div", { className: "twc-dt__search", children: [
|
|
10459
10473
|
/* @__PURE__ */ jsx(Svg, { d: I.search }),
|
|
10460
|
-
/* @__PURE__ */ jsx("input", { placeholder: "Search\u2026", "aria-label": "Search rows", value: quick, onChange: (e) =>
|
|
10461
|
-
|
|
10462
|
-
commitPage(0);
|
|
10463
|
-
} })
|
|
10464
|
-
] })
|
|
10474
|
+
/* @__PURE__ */ jsx("input", { placeholder: "Search\u2026", "aria-label": "Search rows", value: quick, onChange: (e) => commitQuick(e.target.value) })
|
|
10475
|
+
] }) : null
|
|
10465
10476
|
] }),
|
|
10466
10477
|
!pivotActive && activeGroupBy.length ? /* @__PURE__ */ jsxs("div", { className: "twc-dt__groupbar", children: [
|
|
10467
10478
|
/* @__PURE__ */ jsx(Svg, { d: I.group }),
|