MCPcopy Index your code
hub / github.com/tinyplex/tinybase / useCells

Function useCells

src/ui-solid-dom/common/hooks.tsx:45–73  ·  view source on GitHub ↗
(
  defaultCellIds: MaybeAccessor<Ids>,
  customCells: MaybeAccessor<
    Ids | {[cellId: Id]: string | CustomCell | CustomResultCell} | undefined
  >,
  defaultCellComponent: () => CellComponent,
)

Source from the content-addressed store, hash-verified

43): Params => args;
44
45export const useCells = (
46 defaultCellIds: MaybeAccessor<Ids>,
47 customCells: MaybeAccessor<
48 Ids | {[cellId: Id]: string | CustomCell | CustomResultCell} | undefined
49 >,
50 defaultCellComponent: () => CellComponent,
51): (() => Cells<any>) =>
52 // eslint-disable-next-line solid/reactivity
53 createMemo(() => {
54 const customCellIds = getValue(customCells);
55 const cellIds =
56 getValue(
57 customCellIds as MaybeAccessor<
58 Ids | {[cellId: Id]: string | CustomCell | CustomResultCell}
59 >,
60 ) ?? getValue(defaultCellIds);
61 const component = defaultCellComponent();
62 return objMap(
63 isArray(cellIds)
64 ? objNew(arrayMap(cellIds, (cellId) => [cellId, cellId]))
65 : cellIds,
66 (labelOrCustomCell, cellId) => ({
67 ...{label: cellId, component},
68 ...(isString(labelOrCustomCell)
69 ? {label: labelOrCustomCell}
70 : labelOrCustomCell),
71 }),
72 );
73 });

Callers 6

TableInHtmlTableFunction · 0.90
RelationshipInHtmlTableFunction · 0.90
ResultTableInHtmlTableFunction · 0.90
SortedTableInHtmlTableFunction · 0.90
SliceInHtmlTableFunction · 0.90

Calls 6

getValueFunction · 0.90
objMapFunction · 0.90
isArrayFunction · 0.90
objNewFunction · 0.90
arrayMapFunction · 0.90
isStringFunction · 0.90

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…