@rozie-ui/data-table-solid 0.3.2 → 0.4.0

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/index.mjs CHANGED
@@ -1730,12 +1730,6 @@ function DataTable(_props) {
1730
1730
  const m = editMetaOf(colId);
1731
1731
  return m && m.editorOptions != null ? m.editorOptions : [];
1732
1732
  }
1733
- function hasEditorSlot(colId) {
1734
- return editorTypeOf(colId) === "custom" && !!(_props.editorSlot ?? _props.slots?.["editor"]);
1735
- }
1736
- function hasFilterSlot() {
1737
- return !!(_props.filterSlot ?? _props.slots?.["filter"]);
1738
- }
1739
1733
  function columnIsFilterable(colId) {
1740
1734
  const d = defFor(colId);
1741
1735
  return !!(d && d.filterable);
@@ -1744,11 +1738,9 @@ function DataTable(_props) {
1744
1738
  const d = defFor(colId);
1745
1739
  return d ? d.header : colId;
1746
1740
  }
1747
- function headerWidth(colId) {
1748
- if (tick() < 0 || !table) return null;
1749
- const col = table.getColumn(colId);
1750
- if (!col) return null;
1751
- const w = col.getSize();
1741
+ function headerWidth(header) {
1742
+ if (tick() < 0 || !header || typeof header.getSize !== "function") return null;
1743
+ const w = header.getSize();
1752
1744
  return w != null && w > 0 ? w + "px" : null;
1753
1745
  }
1754
1746
  function onResizeStart(colId, evt) {
@@ -1812,11 +1804,11 @@ function DataTable(_props) {
1812
1804
  if (side === "right") return "position:sticky;right:" + (col.getAfter ? col.getAfter("right") : 0) + "px;z-index:" + zIndex + ";";
1813
1805
  return "";
1814
1806
  }
1815
- function thStyle(colId) {
1807
+ function thStyle(header) {
1816
1808
  let s = "";
1817
- const w = headerWidth(colId);
1809
+ const w = headerWidth(header);
1818
1810
  if (w) s += "width:" + w + ";";
1819
- s += pinStyle(colId, 2);
1811
+ s += pinStyle(header && header.column ? header.column.id : null, 2);
1820
1812
  return s;
1821
1813
  }
1822
1814
  function onGlobalFilterInput(evt) {
@@ -3172,8 +3164,9 @@ function DataTable(_props) {
3172
3164
  fillEdgeScrollRaf = null;
3173
3165
  }
3174
3166
  }
3175
- function cellIndexFromPoint(clientX, clientY) {
3176
- if (typeof document === "undefined" || !document.elementFromPoint) return null;
3167
+ const FILL_HITTEST_PROBE_RADIUS_PX = 8;
3168
+ const FILL_HITTEST_PROBE_STEP_PX = 2;
3169
+ function resolveCellAt(clientX, clientY) {
3177
3170
  let el = document.elementFromPoint(clientX, clientY);
3178
3171
  while (el && el.shadowRoot && el.shadowRoot.elementFromPoint) {
3179
3172
  const inner = el.shadowRoot.elementFromPoint(clientX, clientY);
@@ -3194,6 +3187,18 @@ function DataTable(_props) {
3194
3187
  c
3195
3188
  };
3196
3189
  }
3190
+ function cellIndexFromPoint(clientX, clientY) {
3191
+ if (typeof document === "undefined" || !document.elementFromPoint) return null;
3192
+ const direct = resolveCellAt(clientX, clientY);
3193
+ if (direct) return direct;
3194
+ for (let d = FILL_HITTEST_PROBE_STEP_PX; d <= FILL_HITTEST_PROBE_RADIUS_PX; d += FILL_HITTEST_PROBE_STEP_PX) {
3195
+ const right = resolveCellAt(clientX + d, clientY);
3196
+ if (right) return right;
3197
+ const left = resolveCellAt(clientX - d, clientY);
3198
+ if (left) return left;
3199
+ }
3200
+ return null;
3201
+ }
3197
3202
  function onFillHandlePointerDown(e) {
3198
3203
  if (!e) return;
3199
3204
  if (e.preventDefault) e.preventDefault();
@@ -3366,12 +3371,24 @@ function DataTable(_props) {
3366
3371
  const row = (rows() || [])[editingRow()];
3367
3372
  return row ? row.id : null;
3368
3373
  }
3369
- function focusEditorWhenReady(selectAll = true) {
3374
+ function resolveEditFocusCellEl(rowIndex, colIndex) {
3375
+ if (rowIndex == null || colIndex == null || rowIndex < 0 || colIndex < 0) return null;
3376
+ return resolveCellEl(String(rowIndex), colIndex);
3377
+ }
3378
+ function focusEditorWhenReady(rowIndex, colIndex, selectAll = true) {
3370
3379
  if (!gridRoot) return;
3371
- if (editFocusColId() != null && hasEditorSlot(editFocusColId())) return;
3372
3380
  let attempts = 0;
3373
3381
  const tryFocus = () => {
3374
- const el = gridRoot ? gridRoot.querySelector("[data-editing-cell]") : null;
3382
+ const cellEl = resolveEditFocusCellEl(rowIndex, colIndex);
3383
+ const el = cellEl && cellEl.querySelector ? cellEl.querySelector("[data-editing-cell][data-builtin-editor]") : null;
3384
+ if (!el) {
3385
+ if (cellEl && cellEl.querySelector ? cellEl.querySelector("[data-editing-cell]") : null) return;
3386
+ attempts = attempts + 1;
3387
+ if (attempts >= 30) return;
3388
+ if (typeof requestAnimationFrame === "function") requestAnimationFrame(tryFocus);
3389
+ else setTimeout(tryFocus, 16);
3390
+ return;
3391
+ }
3375
3392
  const ae = gridRoot && gridRoot.getRootNode ? gridRoot.getRootNode().activeElement : null;
3376
3393
  if (ae && el && ae !== el && ae.closest && gridRoot.contains(ae) && ae.hasAttribute && ae.hasAttribute("data-editing-cell")) {
3377
3394
  const aeCell = ae.closest("[data-grid-cell]");
@@ -3380,17 +3397,10 @@ function DataTable(_props) {
3380
3397
  const elCol = elCell ? elCell.getAttribute("data-col-index") : null;
3381
3398
  if (aeCol != null && aeCol !== elCol) return;
3382
3399
  }
3383
- if (el) {
3384
- el.focus();
3385
- if (selectAll && el.select) try {
3386
- el.select();
3387
- } catch (e) {}
3388
- return;
3389
- }
3390
- attempts = attempts + 1;
3391
- if (attempts >= 30) return;
3392
- if (typeof requestAnimationFrame === "function") requestAnimationFrame(tryFocus);
3393
- else setTimeout(tryFocus, 16);
3400
+ el.focus();
3401
+ if (selectAll && el.select) try {
3402
+ el.select();
3403
+ } catch (e) {}
3394
3404
  };
3395
3405
  if (typeof requestAnimationFrame === "function") requestAnimationFrame(tryFocus);
3396
3406
  else setTimeout(tryFocus, 0);
@@ -3421,7 +3431,7 @@ function DataTable(_props) {
3421
3431
  setActiveInControl(true);
3422
3432
  setEditVer(editVer() + 1);
3423
3433
  setEditFocusColId(colId);
3424
- focusEditorWhenReady(seed == null);
3434
+ focusEditorWhenReady(rowIndex, colIndex, seed == null);
3425
3435
  }
3426
3436
  function focusCellWhenReady(row, col) {
3427
3437
  if (!gridRoot) return;
@@ -3489,7 +3499,7 @@ function DataTable(_props) {
3489
3499
  const err = runValidator(colId, newValue, rowOriginal);
3490
3500
  if (err !== true) {
3491
3501
  setInvalid(err);
3492
- focusEditorWhenReady();
3502
+ focusEditorWhenReady(editingRow(), editingCol());
3493
3503
  return false;
3494
3504
  }
3495
3505
  setInvalid("");
@@ -3582,12 +3592,10 @@ function DataTable(_props) {
3582
3592
  }
3583
3593
  function focusRowEditorAt(rowIndex, colIndex) {
3584
3594
  if (!gridRoot) return;
3585
- const colId = columnIdAt(rowIndex, colIndex);
3586
- if (colId != null && hasEditorSlot(colId)) return;
3587
3595
  let attempts = 0;
3588
3596
  const tryFocus = () => {
3589
3597
  const cellEl = resolveCellEl(String(rowIndex), colIndex);
3590
- const ed = cellEl && cellEl.querySelector ? cellEl.querySelector("[data-editing-cell]") : null;
3598
+ const ed = cellEl && cellEl.querySelector ? cellEl.querySelector("[data-editing-cell][data-builtin-editor]") : null;
3591
3599
  if (ed) {
3592
3600
  ed.focus();
3593
3601
  if (ed.select) try {
@@ -3595,6 +3603,7 @@ function DataTable(_props) {
3595
3603
  } catch (e) {}
3596
3604
  return;
3597
3605
  }
3606
+ if (cellEl && cellEl.querySelector ? cellEl.querySelector("[data-editing-cell]") : null) return;
3598
3607
  attempts = attempts + 1;
3599
3608
  if (attempts >= 30) return;
3600
3609
  if (typeof requestAnimationFrame === "function") requestAnimationFrame(tryFocus);
@@ -3626,7 +3635,7 @@ function DataTable(_props) {
3626
3635
  setActiveInControl(true);
3627
3636
  setEditVer(editVer() + 1);
3628
3637
  setEditFocusColId(editable[0].colId);
3629
- focusEditorWhenReady();
3638
+ focusEditorWhenReady(rowIndex, editable[0].colIndex);
3630
3639
  }
3631
3640
  function commitRow() {
3632
3641
  if (editingRowIndex() == null) return false;
@@ -4103,14 +4112,18 @@ function DataTable(_props) {
4103
4112
  "rdt-expander-th": isExpanderColumn(header().column.id),
4104
4113
  "rdt-th-resizing": columnIsResizing(header().column.id),
4105
4114
  "rdt-cell-active": isActiveCell("__header", headerColIndexOf(hg(), header()), hgLevel())
4106
- })} role="columnheader" data-col={rozieAttr(header().column.id)} data-grid-cell="" data-row="__header" data-header-level={rozieAttr(hgLevel())} colSpan={rozieAttr(header().colSpan > 1 ? header().colSpan : null)} data-col-index={rozieAttr(headerColIndexOf(hg(), header()))} tabIndex={rozieAttr(cellTabindex("__header", headerColIndexOf(hg(), header()), hgLevel()))} aria-sort={rozieAttr(ariaSortFor(header().column.id))} style={parseInlineStyle(thStyle(header().column.id))} data-rozie-s-d5dcab4c="">
4115
+ })} role="columnheader" data-col={rozieAttr(header().column.id)} data-grid-cell="" data-row="__header" data-header-level={rozieAttr(hgLevel())} colSpan={rozieAttr(header().colSpan > 1 ? header().colSpan : null)} data-col-index={rozieAttr(headerColIndexOf(hg(), header()))} tabIndex={rozieAttr(cellTabindex("__header", headerColIndexOf(hg(), header()), hgLevel()))} aria-sort={rozieAttr(ariaSortFor(header().column.id))} style={parseInlineStyle(thStyle(header()))} data-rozie-s-d5dcab4c="">
4107
4116
 
4108
4117
 
4109
4118
  {<Show when={isSelectColumn(header().column.id)} fallback={<Show when={isExpanderColumn(header().column.id)} fallback={<span style={{ display: "contents" }} data-rozie-s-d5dcab4c="">
4110
4119
 
4111
4120
  {<Show when={header().column.getCanSort && header().column.getCanSort()} fallback={<span style={{ display: "contents" }} data-rozie-s-d5dcab4c="">
4112
4121
  <span class={"rdt-header-label"} data-rozie-s-d5dcab4c="">
4113
- {(_props.colHeaderSlot ?? _props.slots?.["colHeader"])?.({
4122
+ {_props.slots?.[`colHeader-${header().column.id}`]?.({
4123
+ columnId: header().column.id,
4124
+ column: header().column,
4125
+ label: headerLabel(header().column.id)
4126
+ }) ?? (_props.colHeaderSlot ?? _props.slots?.["colHeader"])?.({
4114
4127
  columnId: header().column.id,
4115
4128
  column: header().column,
4116
4129
  label: headerLabel(header().column.id)
@@ -4121,7 +4134,11 @@ function DataTable(_props) {
4121
4134
  }} data-rozie-s-d5dcab4c="">
4122
4135
 
4123
4136
  <span class={"rdt-header-label"} data-rozie-s-d5dcab4c="">
4124
- {(_props.colHeaderSlot ?? _props.slots?.["colHeader"])?.({
4137
+ {_props.slots?.[`colHeader-${header().column.id}`]?.({
4138
+ columnId: header().column.id,
4139
+ column: header().column,
4140
+ label: headerLabel(header().column.id)
4141
+ }) ?? (_props.colHeaderSlot ?? _props.slots?.["colHeader"])?.({
4125
4142
  columnId: header().column.id,
4126
4143
  column: header().column,
4127
4144
  label: headerLabel(header().column.id)
@@ -4165,18 +4182,24 @@ function DataTable(_props) {
4165
4182
  {<Show when={hasAnyFilterableColumn()}><tr class={"rdt-filter-row"} data-rozie-s-d5dcab4c="">
4166
4183
  <Key each={headerGroups()[headerGroups().length - 1].headers} by={(header) => header.id}>{(header) => <th class={"rdt-filter-cell"} role="presentation" style={parseInlineStyle(pinStyle(header().column.id))} data-rozie-s-d5dcab4c="">
4167
4184
  {<Show when={isSelectColumn(header().column.id)} fallback={<Show when={isExpanderColumn(header().column.id)} fallback={<span style={{ display: "contents" }} data-rozie-s-d5dcab4c="">
4168
- {<Show when={columnIsFilterable(header().column.id) && !hasFilterSlot()}><input type="text" aria-label={rozieAttr("Filter " + headerLabel(header().column.id))} class={"rdt-col-filter"} value={columnFilterValue(header().column.id)} onInput={($event) => {
4169
- onColumnFilterInput(header().column.id, $event);
4170
- }} onClick={($event) => {
4171
- stopEvent($event);
4172
- }} data-rozie-s-d5dcab4c="" /></Show>}{<Show when={columnIsFilterable(header().column.id)}><span style={{ display: "contents" }} data-rozie-s-d5dcab4c="">
4173
- {(_props.filterSlot ?? _props.slots?.["filter"])?.({
4185
+ {<Show when={columnIsFilterable(header().column.id)}><span style={{ display: "contents" }} data-rozie-s-d5dcab4c="">
4186
+ {_props.slots?.[`filter-${header().column.id}`]?.({
4174
4187
  columnId: header().column.id,
4175
4188
  value: columnFilterValue(header().column.id),
4176
4189
  uniqueValues: getFacetedUniqueValues$1(header().column.id),
4177
4190
  minMax: getFacetedMinMaxValues$1(header().column.id),
4178
4191
  setFilter: setColumnFilter
4179
- })}
4192
+ }) ?? (_props.filterSlot ?? _props.slots?.["filter"])?.({
4193
+ columnId: header().column.id,
4194
+ value: columnFilterValue(header().column.id),
4195
+ uniqueValues: getFacetedUniqueValues$1(header().column.id),
4196
+ minMax: getFacetedMinMaxValues$1(header().column.id),
4197
+ setFilter: setColumnFilter
4198
+ }) ?? <input type="text" aria-label={rozieAttr("Filter " + headerLabel(header().column.id))} class={"rdt-col-filter"} value={columnFilterValue(header().column.id)} onInput={($event) => {
4199
+ onColumnFilterInput(header().column.id, $event);
4200
+ }} onClick={($event) => {
4201
+ stopEvent($event);
4202
+ }} data-rozie-s-d5dcab4c="" />}
4180
4203
  </span></Show>}</span>}><span style={{ display: "contents" }} data-rozie-s-d5dcab4c="" /></Show>}><span style={{ display: "contents" }} data-rozie-s-d5dcab4c="" /></Show>}</th>}</Key>
4181
4204
  </tr></Show>}</thead>
4182
4205
 
@@ -4192,26 +4215,55 @@ function DataTable(_props) {
4192
4215
  })} role={rozieAttr(cellRole())} data-col={rozieAttr(cell().column.id)} data-grid-cell="" data-row={rozieAttr(rowIndexOf(row()))} data-col-index={rozieAttr(colIndexOf(row(), cell()))} tabIndex={rozieAttr(cellTabindex(String(rowIndexOf(row())), colIndexOf(row(), cell())))} style={parseInlineStyle(bodyCellStyle(row(), cell().column.id))} aria-invalid={rozieAttr(cellAriaInvalid(rowIndexOf(row()), colIndexOf(row(), cell())))} data-in-range={rozieAttr(inRange(rowIndexOf(row()), colIndexOf(row(), cell())) ? "true" : null)} data-agg-cell={rozieAttr(cellIsAggregated(cell()) ? cell().column.id : null)} data-rozie-s-d5dcab4c="">
4193
4216
 
4194
4217
  {<Show when={isExpanderColumn(cell().column.id)} fallback={<Show when={isSelectColumn(cell().column.id)} fallback={<Show when={cellIsGrouped(cell())} fallback={<Show when={isEditing(rowIndexOf(row()), colIndexOf(row(), cell()))} fallback={<Show when={cellIsPlaceholder(cell())} fallback={<span class={"rdt-cell-value"} data-rozie-s-d5dcab4c="">
4195
- {(_props.cellSlot ?? _props.slots?.["cell"])?.({
4218
+ {_props.slots?.[`cell-${cell().column.id}`]?.({
4219
+ columnId: cell().column.id,
4220
+ column: cell().column,
4221
+ row: cellSlotRow(row()),
4222
+ value: cell().getValue()
4223
+ }) ?? (_props.cellSlot ?? _props.slots?.["cell"])?.({
4196
4224
  columnId: cell().column.id,
4197
4225
  column: cell().column,
4198
4226
  row: cellSlotRow(row()),
4199
4227
  value: cell().getValue()
4200
4228
  }) ?? rozieDisplay(cell().getValue())}
4201
4229
  </span>}><span style={{ display: "contents" }} data-rozie-s-d5dcab4c="" /></Show>}><span style={{ display: "contents" }} data-rozie-s-d5dcab4c="">
4202
- {<Show when={hasEditorSlot(cell().column.id)} fallback={<Show when={editorTypeOf(cell().column.id) === "number"} fallback={<Show when={editorTypeOf(cell().column.id) === "select"} fallback={<Show when={editorTypeOf(cell().column.id) === "checkbox"} fallback={<input type="text" data-editing-cell="" class={"rdt-cell-editor"} value={editorValueFor(cell().column.id)} onInput={($event) => {
4230
+ {<Show when={editorTypeOf(cell().column.id) === "number"} fallback={<Show when={editorTypeOf(cell().column.id) === "select"} fallback={<Show when={editorTypeOf(cell().column.id) === "checkbox"} fallback={<Show when={editorTypeOf(cell().column.id) === "custom"} fallback={<input type="text" data-editing-cell="" data-builtin-editor="" class={"rdt-cell-editor"} value={editorValueFor(cell().column.id)} onInput={($event) => {
4231
+ onCellEditorInput(cell().column.id, $event);
4232
+ }} onKeyDown={($event) => {
4233
+ onEditorKeyDown($event);
4234
+ }} onBlur={($event) => {
4235
+ onEditorBlur($event);
4236
+ }} data-rozie-s-d5dcab4c="" />}><span style={{ display: "contents" }} data-rozie-s-d5dcab4c="">
4237
+ {_props.slots?.[`editor-${cell().column.id}`]?.({
4238
+ columnId: cell().column.id,
4239
+ column: cell().column,
4240
+ row: cellSlotRow(row()),
4241
+ value: editorValueFor(cell().column.id),
4242
+ commit: editorCommitFor(cell().column.id),
4243
+ cancel: editorCancelFor(),
4244
+ autofocus: editorAutofocusFor(cell().column.id, rowIndexOf(row()))
4245
+ }) ?? (_props.editorSlot ?? _props.slots?.["editor"])?.({
4246
+ columnId: cell().column.id,
4247
+ column: cell().column,
4248
+ row: cellSlotRow(row()),
4249
+ value: editorValueFor(cell().column.id),
4250
+ commit: editorCommitFor(cell().column.id),
4251
+ cancel: editorCancelFor(),
4252
+ autofocus: editorAutofocusFor(cell().column.id, rowIndexOf(row()))
4253
+ }) ?? <input type="text" data-editing-cell="" data-builtin-editor="" class={"rdt-cell-editor"} value={editorValueFor(cell().column.id)} onInput={($event) => {
4203
4254
  onCellEditorInput(cell().column.id, $event);
4204
4255
  }} onKeyDown={($event) => {
4205
4256
  onEditorKeyDown($event);
4206
4257
  }} onBlur={($event) => {
4207
4258
  onEditorBlur($event);
4208
- }} data-rozie-s-d5dcab4c="" />}><input type="checkbox" data-editing-cell="" class={"rdt-cell-editor"} checked={editorCheckedFor(cell().column.id)} onChange={($event) => {
4259
+ }} data-rozie-s-d5dcab4c="" />}
4260
+ </span></Show>}><input type="checkbox" data-editing-cell="" data-builtin-editor="" class={"rdt-cell-editor"} checked={editorCheckedFor(cell().column.id)} onChange={($event) => {
4209
4261
  onCellEditorCheckbox(cell().column.id, $event);
4210
4262
  }} onKeyDown={($event) => {
4211
4263
  onEditorKeyDown($event);
4212
4264
  }} onBlur={($event) => {
4213
4265
  onEditorBlur($event);
4214
- }} data-rozie-s-d5dcab4c="" /></Show>}><select data-editing-cell="" class={"rdt-cell-editor"} value={editorValueFor(cell().column.id)} onChange={($event) => {
4266
+ }} data-rozie-s-d5dcab4c="" /></Show>}><select data-editing-cell="" data-builtin-editor="" class={"rdt-cell-editor"} value={editorValueFor(cell().column.id)} onChange={($event) => {
4215
4267
  onCellEditorInput(cell().column.id, $event);
4216
4268
  }} onKeyDown={($event) => {
4217
4269
  onEditorKeyDown($event);
@@ -4219,28 +4271,23 @@ function DataTable(_props) {
4219
4271
  onEditorBlur($event);
4220
4272
  }} data-rozie-s-d5dcab4c="">
4221
4273
  <Key each={editorOptionsOf(cell().column.id)} by={(opt) => opt.value}>{(opt) => <option value={rozieAttr(opt().value)} data-rozie-s-d5dcab4c="">{rozieDisplay(opt().label)}</option>}</Key>
4222
- </select></Show>}><input type="number" data-editing-cell="" class={"rdt-cell-editor"} value={editorValueFor(cell().column.id)} onInput={($event) => {
4274
+ </select></Show>}><input type="number" data-editing-cell="" data-builtin-editor="" class={"rdt-cell-editor"} value={editorValueFor(cell().column.id)} onInput={($event) => {
4223
4275
  onCellEditorInput(cell().column.id, $event);
4224
4276
  }} onKeyDown={($event) => {
4225
4277
  onEditorKeyDown($event);
4226
4278
  }} onBlur={($event) => {
4227
4279
  onEditorBlur($event);
4228
- }} data-rozie-s-d5dcab4c="" /></Show>}><span style={{ display: "contents" }} data-rozie-s-d5dcab4c="">
4229
- {(_props.editorSlot ?? _props.slots?.["editor"])?.({
4230
- columnId: cell().column.id,
4231
- column: cell().column,
4232
- row: cellSlotRow(row()),
4233
- value: editorValueFor(cell().column.id),
4234
- commit: editorCommitFor(cell().column.id),
4235
- cancel: editorCancelFor(),
4236
- autofocus: editorAutofocusFor(cell().column.id, rowIndexOf(row()))
4237
- })}
4238
- </span></Show>}</span></Show>}><span style={{ display: "contents" }} data-rozie-s-d5dcab4c="">
4280
+ }} data-rozie-s-d5dcab4c="" /></Show>}</span></Show>}><span style={{ display: "contents" }} data-rozie-s-d5dcab4c="">
4239
4281
  <button type="button" data-expander="" aria-expanded={!!rowIsExpanded(row())} aria-label={rozieAttr(rowIsExpanded(row()) ? "Collapse group" : "Expand group")} class={"rdt-expander rdt-group-toggle"} onClick={($event) => {
4240
4282
  onToggleExpand(row(), $event);
4241
4283
  }} data-rozie-s-d5dcab4c="">{rozieDisplay(rowIsExpanded(row()) ? "▾" : "▸")}</button>
4242
4284
  <span class={"rdt-group-value"} data-rozie-s-d5dcab4c="">
4243
- {(_props.cellSlot ?? _props.slots?.["cell"])?.({
4285
+ {_props.slots?.[`cell-${cell().column.id}`]?.({
4286
+ columnId: cell().column.id,
4287
+ column: cell().column,
4288
+ row: cellSlotRow(row()),
4289
+ value: cell().getValue()
4290
+ }) ?? (_props.cellSlot ?? _props.slots?.["cell"])?.({
4244
4291
  columnId: cell().column.id,
4245
4292
  column: cell().column,
4246
4293
  row: cellSlotRow(row()),
@@ -4295,11 +4342,15 @@ function DataTable(_props) {
4295
4342
  "rdt-expander-th": isExpanderColumn(wh().header.column.id),
4296
4343
  "rdt-th-resizing": columnIsResizing(wh().header.column.id),
4297
4344
  "rdt-cell-active": isActiveCell("__header", headerColIndexOf(hg(), wh().header), hgLevel())
4298
- })} role="columnheader" data-col={rozieAttr(wh().header.column.id)} data-grid-cell="" data-row="__header" data-header-level={rozieAttr(hgLevel())} colSpan={rozieAttr(wh().span > 1 ? wh().span : null)} data-col-index={rozieAttr(headerColIndexOf(hg(), wh().header))} tabIndex={rozieAttr(cellTabindex("__header", headerColIndexOf(hg(), wh().header), hgLevel()))} aria-sort={rozieAttr(ariaSortFor(wh().header.column.id))} style={parseInlineStyle(thStyle(wh().header.column.id))} data-rozie-s-d5dcab4c="">
4345
+ })} role="columnheader" data-col={rozieAttr(wh().header.column.id)} data-grid-cell="" data-row="__header" data-header-level={rozieAttr(hgLevel())} colSpan={rozieAttr(wh().span > 1 ? wh().span : null)} data-col-index={rozieAttr(headerColIndexOf(hg(), wh().header))} tabIndex={rozieAttr(cellTabindex("__header", headerColIndexOf(hg(), wh().header), hgLevel()))} aria-sort={rozieAttr(ariaSortFor(wh().header.column.id))} style={parseInlineStyle(thStyle(wh().header))} data-rozie-s-d5dcab4c="">
4299
4346
  {<Show when={isSelectColumn(wh().header.column.id)} fallback={<Show when={isExpanderColumn(wh().header.column.id)} fallback={<span style={{ display: "contents" }} data-rozie-s-d5dcab4c="">
4300
4347
  {<Show when={wh().header.column.getCanSort && wh().header.column.getCanSort()} fallback={<span style={{ display: "contents" }} data-rozie-s-d5dcab4c="">
4301
4348
  <span class={"rdt-header-label"} data-rozie-s-d5dcab4c="">
4302
- {(_props.colHeaderSlot ?? _props.slots?.["colHeader"])?.({
4349
+ {_props.slots?.[`colHeader-${wh().header.column.id}`]?.({
4350
+ columnId: wh().header.column.id,
4351
+ column: wh().header.column,
4352
+ label: headerLabel(wh().header.column.id)
4353
+ }) ?? (_props.colHeaderSlot ?? _props.slots?.["colHeader"])?.({
4303
4354
  columnId: wh().header.column.id,
4304
4355
  column: wh().header.column,
4305
4356
  label: headerLabel(wh().header.column.id)
@@ -4309,7 +4360,11 @@ function DataTable(_props) {
4309
4360
  onHeaderSort(wh().header.column.id, $event);
4310
4361
  }} data-rozie-s-d5dcab4c="">
4311
4362
  <span class={"rdt-header-label"} data-rozie-s-d5dcab4c="">
4312
- {(_props.colHeaderSlot ?? _props.slots?.["colHeader"])?.({
4363
+ {_props.slots?.[`colHeader-${wh().header.column.id}`]?.({
4364
+ columnId: wh().header.column.id,
4365
+ column: wh().header.column,
4366
+ label: headerLabel(wh().header.column.id)
4367
+ }) ?? (_props.colHeaderSlot ?? _props.slots?.["colHeader"])?.({
4313
4368
  columnId: wh().header.column.id,
4314
4369
  column: wh().header.column,
4315
4370
  label: headerLabel(wh().header.column.id)
@@ -4353,18 +4408,24 @@ function DataTable(_props) {
4353
4408
  {<Show when={hasAnyFilterableColumn()}><tr class={"rdt-filter-row"} data-rozie-s-d5dcab4c="">
4354
4409
  {<Show when={colsWindowed()}><th class={"rdt-col-spacer"} aria-hidden="true" style={parseInlineStyle("width:" + colPadLeft() + "px;padding:0;border:0")} data-rozie-s-d5dcab4c="" /></Show>}<Key each={windowedHeadersFor(headerGroups()[headerGroups().length - 1], headerGroups().length - 1)} by={(wh) => wh.header.id}>{(wh) => <th class={"rdt-filter-cell"} role="presentation" data-col={rozieAttr(wh().header.column.id)} style={parseInlineStyle(pinStyle(wh().header.column.id))} data-rozie-s-d5dcab4c="">
4355
4410
  {<Show when={isSelectColumn(wh().header.column.id)} fallback={<Show when={isExpanderColumn(wh().header.column.id)} fallback={<span style={{ display: "contents" }} data-rozie-s-d5dcab4c="">
4356
- {<Show when={columnIsFilterable(wh().header.column.id) && !hasFilterSlot()}><input type="text" aria-label={rozieAttr("Filter " + headerLabel(wh().header.column.id))} class={"rdt-col-filter"} value={columnFilterValue(wh().header.column.id)} onInput={($event) => {
4357
- onColumnFilterInput(wh().header.column.id, $event);
4358
- }} onClick={($event) => {
4359
- stopEvent($event);
4360
- }} data-rozie-s-d5dcab4c="" /></Show>}{<Show when={columnIsFilterable(wh().header.column.id)}><span style={{ display: "contents" }} data-rozie-s-d5dcab4c="">
4361
- {(_props.filterSlot ?? _props.slots?.["filter"])?.({
4411
+ {<Show when={columnIsFilterable(wh().header.column.id)}><span style={{ display: "contents" }} data-rozie-s-d5dcab4c="">
4412
+ {_props.slots?.[`filter-${wh().header.column.id}`]?.({
4413
+ columnId: wh().header.column.id,
4414
+ value: columnFilterValue(wh().header.column.id),
4415
+ uniqueValues: getFacetedUniqueValues$1(wh().header.column.id),
4416
+ minMax: getFacetedMinMaxValues$1(wh().header.column.id),
4417
+ setFilter: setColumnFilter
4418
+ }) ?? (_props.filterSlot ?? _props.slots?.["filter"])?.({
4362
4419
  columnId: wh().header.column.id,
4363
4420
  value: columnFilterValue(wh().header.column.id),
4364
4421
  uniqueValues: getFacetedUniqueValues$1(wh().header.column.id),
4365
4422
  minMax: getFacetedMinMaxValues$1(wh().header.column.id),
4366
4423
  setFilter: setColumnFilter
4367
- })}
4424
+ }) ?? <input type="text" aria-label={rozieAttr("Filter " + headerLabel(wh().header.column.id))} class={"rdt-col-filter"} value={columnFilterValue(wh().header.column.id)} onInput={($event) => {
4425
+ onColumnFilterInput(wh().header.column.id, $event);
4426
+ }} onClick={($event) => {
4427
+ stopEvent($event);
4428
+ }} data-rozie-s-d5dcab4c="" />}
4368
4429
  </span></Show>}</span>}><span style={{ display: "contents" }} data-rozie-s-d5dcab4c="" /></Show>}><span style={{ display: "contents" }} data-rozie-s-d5dcab4c="" /></Show>}</th>}</Key>
4369
4430
  {<Show when={colsWindowed()}><th class={"rdt-col-spacer"} aria-hidden="true" style={parseInlineStyle("width:" + colPadRight() + "px;padding:0;border:0")} data-rozie-s-d5dcab4c="" /></Show>}</tr></Show>}</thead>
4370
4431
 
@@ -4388,26 +4449,55 @@ function DataTable(_props) {
4388
4449
  })} role={rozieAttr(cellRole())} data-col={rozieAttr(cell().column.id)} data-grid-cell="" data-row={rozieAttr(wr().vi.index)} data-col-index={rozieAttr(colIndexOf(wr().row, cell()))} tabIndex={rozieAttr(cellTabindex(String(wr().vi.index), colIndexOf(wr().row, cell())))} style={parseInlineStyle(bodyCellStyle(wr().row, cell().column.id))} aria-invalid={rozieAttr(cellAriaInvalid(wr().vi.index, colIndexOf(wr().row, cell())))} data-in-range={rozieAttr(inRange(wr().vi.index, colIndexOf(wr().row, cell())) ? "true" : null)} data-agg-cell={rozieAttr(cellIsAggregated(cell()) ? cell().column.id : null)} data-rozie-s-d5dcab4c="">
4389
4450
 
4390
4451
  {<Show when={isExpanderColumn(cell().column.id)} fallback={<Show when={isSelectColumn(cell().column.id)} fallback={<Show when={cellIsGrouped(cell())} fallback={<Show when={isEditing(wr().vi.index, colIndexOf(wr().row, cell()))} fallback={<Show when={cellIsPlaceholder(cell())} fallback={<span class={"rdt-cell-value"} data-rozie-s-d5dcab4c="">
4391
- {(_props.cellSlot ?? _props.slots?.["cell"])?.({
4452
+ {_props.slots?.[`cell-${cell().column.id}`]?.({
4453
+ columnId: cell().column.id,
4454
+ column: cell().column,
4455
+ row: cellSlotRow(wr().row),
4456
+ value: cell().getValue()
4457
+ }) ?? (_props.cellSlot ?? _props.slots?.["cell"])?.({
4392
4458
  columnId: cell().column.id,
4393
4459
  column: cell().column,
4394
4460
  row: cellSlotRow(wr().row),
4395
4461
  value: cell().getValue()
4396
4462
  }) ?? rozieDisplay(cell().getValue())}
4397
4463
  </span>}><span style={{ display: "contents" }} data-rozie-s-d5dcab4c="" /></Show>}><span style={{ display: "contents" }} data-rozie-s-d5dcab4c="">
4398
- {<Show when={hasEditorSlot(cell().column.id)} fallback={<Show when={editorTypeOf(cell().column.id) === "number"} fallback={<Show when={editorTypeOf(cell().column.id) === "select"} fallback={<Show when={editorTypeOf(cell().column.id) === "checkbox"} fallback={<input type="text" data-editing-cell="" class={"rdt-cell-editor"} value={editorValueFor(cell().column.id)} onInput={($event) => {
4464
+ {<Show when={editorTypeOf(cell().column.id) === "number"} fallback={<Show when={editorTypeOf(cell().column.id) === "select"} fallback={<Show when={editorTypeOf(cell().column.id) === "checkbox"} fallback={<Show when={editorTypeOf(cell().column.id) === "custom"} fallback={<input type="text" data-editing-cell="" data-builtin-editor="" class={"rdt-cell-editor"} value={editorValueFor(cell().column.id)} onInput={($event) => {
4465
+ onCellEditorInput(cell().column.id, $event);
4466
+ }} onKeyDown={($event) => {
4467
+ onEditorKeyDown($event);
4468
+ }} onBlur={($event) => {
4469
+ onEditorBlur($event);
4470
+ }} data-rozie-s-d5dcab4c="" />}><span style={{ display: "contents" }} data-rozie-s-d5dcab4c="">
4471
+ {_props.slots?.[`editor-${cell().column.id}`]?.({
4472
+ columnId: cell().column.id,
4473
+ column: cell().column,
4474
+ row: cellSlotRow(wr().row),
4475
+ value: editorValueFor(cell().column.id),
4476
+ commit: editorCommitFor(cell().column.id),
4477
+ cancel: editorCancelFor(),
4478
+ autofocus: editorAutofocusFor(cell().column.id, wr().vi.index)
4479
+ }) ?? (_props.editorSlot ?? _props.slots?.["editor"])?.({
4480
+ columnId: cell().column.id,
4481
+ column: cell().column,
4482
+ row: cellSlotRow(wr().row),
4483
+ value: editorValueFor(cell().column.id),
4484
+ commit: editorCommitFor(cell().column.id),
4485
+ cancel: editorCancelFor(),
4486
+ autofocus: editorAutofocusFor(cell().column.id, wr().vi.index)
4487
+ }) ?? <input type="text" data-editing-cell="" data-builtin-editor="" class={"rdt-cell-editor"} value={editorValueFor(cell().column.id)} onInput={($event) => {
4399
4488
  onCellEditorInput(cell().column.id, $event);
4400
4489
  }} onKeyDown={($event) => {
4401
4490
  onEditorKeyDown($event);
4402
4491
  }} onBlur={($event) => {
4403
4492
  onEditorBlur($event);
4404
- }} data-rozie-s-d5dcab4c="" />}><input type="checkbox" data-editing-cell="" class={"rdt-cell-editor"} checked={editorCheckedFor(cell().column.id)} onChange={($event) => {
4493
+ }} data-rozie-s-d5dcab4c="" />}
4494
+ </span></Show>}><input type="checkbox" data-editing-cell="" data-builtin-editor="" class={"rdt-cell-editor"} checked={editorCheckedFor(cell().column.id)} onChange={($event) => {
4405
4495
  onCellEditorCheckbox(cell().column.id, $event);
4406
4496
  }} onKeyDown={($event) => {
4407
4497
  onEditorKeyDown($event);
4408
4498
  }} onBlur={($event) => {
4409
4499
  onEditorBlur($event);
4410
- }} data-rozie-s-d5dcab4c="" /></Show>}><select data-editing-cell="" class={"rdt-cell-editor"} value={editorValueFor(cell().column.id)} onChange={($event) => {
4500
+ }} data-rozie-s-d5dcab4c="" /></Show>}><select data-editing-cell="" data-builtin-editor="" class={"rdt-cell-editor"} value={editorValueFor(cell().column.id)} onChange={($event) => {
4411
4501
  onCellEditorInput(cell().column.id, $event);
4412
4502
  }} onKeyDown={($event) => {
4413
4503
  onEditorKeyDown($event);
@@ -4415,28 +4505,23 @@ function DataTable(_props) {
4415
4505
  onEditorBlur($event);
4416
4506
  }} data-rozie-s-d5dcab4c="">
4417
4507
  <Key each={editorOptionsOf(cell().column.id)} by={(opt) => opt.value}>{(opt) => <option value={rozieAttr(opt().value)} data-rozie-s-d5dcab4c="">{rozieDisplay(opt().label)}</option>}</Key>
4418
- </select></Show>}><input type="number" data-editing-cell="" class={"rdt-cell-editor"} value={editorValueFor(cell().column.id)} onInput={($event) => {
4508
+ </select></Show>}><input type="number" data-editing-cell="" data-builtin-editor="" class={"rdt-cell-editor"} value={editorValueFor(cell().column.id)} onInput={($event) => {
4419
4509
  onCellEditorInput(cell().column.id, $event);
4420
4510
  }} onKeyDown={($event) => {
4421
4511
  onEditorKeyDown($event);
4422
4512
  }} onBlur={($event) => {
4423
4513
  onEditorBlur($event);
4424
- }} data-rozie-s-d5dcab4c="" /></Show>}><span style={{ display: "contents" }} data-rozie-s-d5dcab4c="">
4425
- {(_props.editorSlot ?? _props.slots?.["editor"])?.({
4426
- columnId: cell().column.id,
4427
- column: cell().column,
4428
- row: cellSlotRow(wr().row),
4429
- value: editorValueFor(cell().column.id),
4430
- commit: editorCommitFor(cell().column.id),
4431
- cancel: editorCancelFor(),
4432
- autofocus: editorAutofocusFor(cell().column.id, wr().vi.index)
4433
- })}
4434
- </span></Show>}</span></Show>}><span style={{ display: "contents" }} data-rozie-s-d5dcab4c="">
4514
+ }} data-rozie-s-d5dcab4c="" /></Show>}</span></Show>}><span style={{ display: "contents" }} data-rozie-s-d5dcab4c="">
4435
4515
  <button type="button" data-expander="" aria-expanded={!!rowIsExpanded(wr().row)} aria-label={rozieAttr(rowIsExpanded(wr().row) ? "Collapse group" : "Expand group")} class={"rdt-expander rdt-group-toggle"} onClick={($event) => {
4436
4516
  onToggleExpand(wr().row, $event);
4437
4517
  }} data-rozie-s-d5dcab4c="">{rozieDisplay(rowIsExpanded(wr().row) ? "▾" : "▸")}</button>
4438
4518
  <span class={"rdt-group-value"} data-rozie-s-d5dcab4c="">
4439
- {(_props.cellSlot ?? _props.slots?.["cell"])?.({
4519
+ {_props.slots?.[`cell-${cell().column.id}`]?.({
4520
+ columnId: cell().column.id,
4521
+ column: cell().column,
4522
+ row: cellSlotRow(wr().row),
4523
+ value: cell().getValue()
4524
+ }) ?? (_props.cellSlot ?? _props.slots?.["cell"])?.({
4440
4525
  columnId: cell().column.id,
4441
4526
  column: cell().column,
4442
4527
  row: cellSlotRow(wr().row),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rozie-ui/data-table-solid",
3
- "version": "0.3.2",
3
+ "version": "0.4.0",
4
4
  "type": "module",
5
5
  "private": false,
6
6
  "license": "MIT",
@@ -46,7 +46,7 @@
46
46
  ],
47
47
  "dependencies": {
48
48
  "@solid-primitives/keyed": "^1.5.3",
49
- "@rozie/runtime-solid": "0.7.2"
49
+ "@rozie/runtime-solid": "0.7.3"
50
50
  },
51
51
  "peerDependencies": {
52
52
  "solid-js": "^1.8",