trotl-table 1.0.66 → 1.0.67

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/Table.cjs.js CHANGED
@@ -10347,9 +10347,46 @@ function TableInner({
10347
10347
 
10348
10348
  // Input column type (editable text)
10349
10349
  if (col && col.type === 'input') {
10350
- return /*#__PURE__*/React.createElement("span", {
10351
- title: translate("noData")
10352
- }, "...");
10350
+ const text = isNoData ? "" : v == null ? "" : String(v);
10351
+ return /*#__PURE__*/React.createElement("input", {
10352
+ type: "text",
10353
+ className: "table-cell-input",
10354
+ value: text,
10355
+ placeholder: isNoData ? "..." : undefined,
10356
+ title: isNoData ? translate("noData") : text,
10357
+ onClick: e => {
10358
+ e.stopPropagation();
10359
+ triggerCellCallback(row, col, text);
10360
+ },
10361
+ onChange: e => {
10362
+ const next = e.target.value;
10363
+ setLocalData(prev => {
10364
+ if (isGrouped) {
10365
+ return prev.map(g => ({
10366
+ ...g,
10367
+ rows: (g.rows || []).map(r => r.id === row.id ? {
10368
+ ...r,
10369
+ [accessor]: next
10370
+ } : r)
10371
+ }));
10372
+ }
10373
+ return (prev || []).map(r => r.id === row.id ? {
10374
+ ...r,
10375
+ [accessor]: next
10376
+ } : r);
10377
+ });
10378
+ refreshTriggerRef.current?.();
10379
+ try {
10380
+ onCellChangeRef.current?.(row, accessor, next);
10381
+ } catch (err) {
10382
+ console.error('onCellChange error', err);
10383
+ }
10384
+ },
10385
+ style: {
10386
+ border: "1px solid var(--border-light, #ccc)",
10387
+ padding: "2px 4px"
10388
+ }
10389
+ });
10353
10390
  }
10354
10391
 
10355
10392
  // If column has dateFormat, format value as date/time