schummar-table 0.42.0 → 0.43.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.
@@ -18,7 +18,6 @@ var cell = css({
18
18
  borderBottom: "1px solid var(--table-border-light-color)",
19
19
  whiteSpace: "nowrap",
20
20
  overflow: "hidden",
21
- background: "var(--table-background-color)",
22
21
  "&:not(:empty)": {
23
22
  padding: `calc(var(--spacing) * 0.1) calc(2 * var(--spacing))`
24
23
  }
@@ -31,11 +30,11 @@ var defaultClasses = {
31
30
  }),
32
31
  cell,
33
32
  cellFill: css({
34
- borderBottom: "1px solid var(--table-border-light-color)",
35
- background: "var(--table-background-color)"
33
+ borderBottom: "1px solid var(--table-border-light-color)"
36
34
  }),
37
35
  headerCell: css(cell, {
38
36
  borderBottom: "1px solid var(--table-border-color)",
37
+ background: "var(--table-background-color)",
39
38
  "&:not(:empty)": {
40
39
  padding: `var(--spacing) 0 var(--spacing) calc(2 * var(--spacing))`
41
40
  }
@@ -43,7 +42,8 @@ var defaultClasses = {
43
42
  footerCell: css(cell, {
44
43
  padding: `var(--spacing) calc(2 * var(--spacing))`,
45
44
  borderTop: "1px solid var(--table-border-color)",
46
- borderBottom: "none"
45
+ borderBottom: "none",
46
+ background: "var(--table-background-color)"
47
47
  }),
48
48
  firstCell: css({
49
49
  justifyContent: "start"
@@ -799,4 +799,4 @@ schummar-state/dist/es/react.js:
799
799
  * LICENSE file in the root directory of this source tree.
800
800
  *)
801
801
  */
802
- //# sourceMappingURL=chunk-E2DUBLYQ.js.map
802
+ //# sourceMappingURL=chunk-FTCKJOPQ.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/theme/defaultTheme/popover.tsx","../src/theme/defaultTheme/defaultClasses.ts","../node_modules/schummar-state/src/persist/persistPathHelpers.ts","../node_modules/schummar-state/src/persist/storePersist.ts","../node_modules/schummar-state/src/helpers/hash.ts","../node_modules/schummar-state/node_modules/fast-deep-equal/es6/react.js","../node_modules/schummar-state/src/helpers/stringSelector.ts","../node_modules/schummar-state/src/helpers/throttle.ts","../node_modules/schummar-state/src/store.ts","../node_modules/schummar-state/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.production.min.js","../node_modules/schummar-state/node_modules/use-sync-external-store/shim/index.js","../node_modules/schummar-state/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.production.min.js","../node_modules/schummar-state/node_modules/use-sync-external-store/shim/with-selector.js","../node_modules/schummar-state/src/react/useStoreState.ts","../node_modules/schummar-state/src/react/useStoreProp.ts","../node_modules/schummar-state/src/react/store.ts","../node_modules/schummar-state/src/react/storeScope.tsx","../node_modules/schummar-state/src/react/useResource.ts","../src/theme/tableTheme.tsx","../src/misc/tableSettings.tsx"],"sourcesContent":["import { useLayoutEffect, useRef, useState } from 'react';\nimport { createPortal } from 'react-dom';\nimport type { TableTheme } from '../../types';\nimport { defaultClasses } from './defaultClasses';\n\nconst MARGIN = 10;\nconst MAX_OFFSET = 20;\n\nexport const Popover: TableTheme['components']['Popover'] = ({\n anchorEl,\n open,\n hidden,\n onClose,\n children,\n className,\n backdropClassName,\n align,\n}) => {\n const popper = useRef<HTMLDivElement>(null);\n const [position, setPosition] = useState<{ left: number; top: number }>();\n const [maxHeight, setMaxHeight] = useState(document.documentElement.clientHeight - 2 * MARGIN);\n const [zIndex, setZIndex] = useState(1);\n\n useLayoutEffect(() => {\n if (!anchorEl || !open) {\n setPosition(undefined);\n return;\n }\n\n let last: { left: number; top: number } | undefined;\n\n function check() {\n if (!anchorEl) return;\n const {\n left: anchorLeft,\n bottom: anchorBottom,\n width: anchorWidth,\n } = anchorEl.getBoundingClientRect();\n const { width: popperWidth = 0 } = popper.current?.getBoundingClientRect() ?? {};\n const viewportWidth = document.documentElement.clientWidth;\n const viewportHeight = document.documentElement.clientHeight;\n\n const next = {\n left:\n align === 'center'\n ? anchorLeft + anchorWidth / 2 - popperWidth / 2\n : anchorLeft -\n Math.min(popperWidth ? popperWidth / 2 : Number.POSITIVE_INFINITY, MAX_OFFSET),\n top: anchorBottom,\n };\n\n if (next.left < MARGIN) {\n next.left = MARGIN;\n }\n if (next.left + popperWidth > viewportWidth - MARGIN) {\n next.left = viewportWidth - MARGIN - popperWidth;\n }\n if (next.top < MARGIN) {\n next.top = MARGIN;\n }\n\n if (next.left !== last?.left || next.top !== last?.top) {\n setPosition(next);\n }\n\n setMaxHeight(viewportHeight - MARGIN - next.top);\n\n last = next;\n }\n check();\n\n const handle = setInterval(check, 16);\n return () => {\n clearInterval(handle);\n };\n }, [anchorEl, open, align]);\n\n function updateZIndex(div: HTMLDivElement | null) {\n const ancestors = [];\n for (let node = div?.parentElement; node; node = node.parentElement) {\n ancestors.push(node);\n }\n\n for (const node of ancestors.reverse()) {\n const value = document.defaultView?.getComputedStyle(node).getPropertyValue('z-index');\n\n if (value && !Number.isNaN(Number(value))) {\n setZIndex(Number(value) + 1);\n return;\n }\n }\n }\n\n if (!open) return null;\n\n return (\n <>\n <div\n ref={updateZIndex}\n css={{\n display: 'none',\n }}\n />\n\n {createPortal(\n <>\n <div\n className={backdropClassName}\n css={[\n {\n position: 'fixed',\n left: 0,\n right: 0,\n top: 0,\n bottom: 0,\n zIndex,\n },\n hidden && { display: 'none' },\n ]}\n onClick={() => onClose()}\n />\n\n <div\n ref={popper}\n className={className}\n css={[\n defaultClasses.card,\n {\n position: 'fixed',\n maxWidth: document.documentElement.clientWidth - 2 * MARGIN,\n maxHeight,\n ...position,\n zIndex: zIndex + 1,\n overflowY: 'auto',\n color: 'var(--table-text-color)',\n },\n hidden && { display: 'none' },\n !position && { visibility: 'hidden' },\n ]}\n >\n {children}\n </div>\n </>,\n document.body,\n )}\n </>\n );\n};\n","import { css } from '@emotion/react';\n\nconst cell = css({\n display: 'flex',\n alignItems: 'center',\n borderBottom: '1px solid var(--table-border-light-color)',\n whiteSpace: 'nowrap',\n overflow: 'hidden',\n\n '&:not(:empty)': {\n padding: `calc(var(--spacing) * 0.1) calc(2 * var(--spacing))`,\n },\n});\n\nexport const defaultClasses = {\n table: css({\n position: 'relative',\n display: 'grid',\n color: 'var(--table-text-color)',\n }),\n\n cell,\n\n cellFill: css({\n borderBottom: '1px solid var(--table-border-light-color)',\n }),\n\n headerCell: css(cell, {\n borderBottom: '1px solid var(--table-border-color)',\n background: 'var(--table-background-color)',\n\n '&:not(:empty)': {\n padding: `var(--spacing) 0 var(--spacing) calc(2 * var(--spacing))`,\n },\n }),\n\n footerCell: css(cell, {\n padding: `var(--spacing) calc(2 * var(--spacing))`,\n borderTop: '1px solid var(--table-border-color)',\n borderBottom: 'none',\n background: 'var(--table-background-color)',\n }),\n\n firstCell: css({\n justifyContent: 'start',\n }),\n\n sticky: css({\n position: 'sticky',\n top: 0,\n zIndex: 2,\n }),\n\n stickyBottom: css({\n position: 'sticky',\n bottom: 0,\n zIndex: 2,\n }),\n\n headerFill: css({\n borderBottom: '1px solid var(--table-border-color)',\n background: 'var(--table-background-color)',\n }),\n\n footerFill: css({\n borderTop: '1px solid var(--table-border-color)',\n background: 'var(--table-background-color)',\n }),\n\n text: css({\n minWidth: 0,\n overflow: 'hidden',\n textOverflow: 'ellipsis',\n }),\n\n card: css({\n borderRadius: 4,\n boxShadow: '0px 3px 14px 2px rgb(0 0 0 / 12%)',\n background: 'var(--table-background-color)',\n }),\n\n clearFiltersButton: css({\n padding: `0 calc(2 * var(--spacing))`,\n fontWeight: 'bold',\n position: 'sticky',\n left: 0,\n maxWidth: 'fit-content',\n gridColumn: '2/-1',\n button: {\n color: 'var(--primaryMain) !important',\n border: 'solid 1px',\n borderColor: 'var(--primaryMain) !important',\n margin: 'var(--spacing)',\n },\n }),\n\n details: css(cell, {\n gridColumn: '1 / -1',\n whiteSpace: 'normal',\n }),\n};\n","export type Path = (string | number)[];\n\nexport const isAncestor = (ancestor: Path, path: Path): boolean => {\n return ancestor.length <= path.length && ancestor.every((v, i) => v === '*' || path[i] === '*' || String(v) === String(path[i]));\n};\n\nexport const get = (value: unknown, path: Path): unknown => {\n for (const part of path) {\n if (value instanceof Object && part in value) value = value[part as keyof typeof value];\n else {\n value = undefined;\n break;\n }\n }\n return value;\n};\n\n// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types\nexport const split = (value: any, path: Path): [value: unknown, subValues: { path: Path; value: unknown }[]] => {\n const [first, ...rest] = path;\n if (first === undefined) return [value, []];\n\n if (rest.length === 0) {\n if (first === '*') return [{}, Object.entries(value).map(([k, v]) => ({ path: [k], value: v }))];\n if (!(first in value)) return [value, []];\n const { [first]: subValue, ...newValue } = value;\n return [newValue, [{ path: [first], value: subValue }]];\n }\n\n const newValue = { ...value };\n const subValues = new Array<{ path: Path; value: unknown }>();\n for (const key of first === '*' ? Object.keys(value) : [first]) {\n if (!(newValue[key] instanceof Object)) return [value, []];\n const result = split(newValue[key], rest);\n newValue[key] = result[0];\n subValues.push(...result[1].map((s) => ({ path: [key, ...s.path], value: s.value })));\n }\n return [newValue, subValues];\n};\n","import { Patch } from 'immer';\nimport { Store } from '../store';\nimport { get, isAncestor, Path, split } from './persistPathHelpers';\nimport { PersistPaths } from './persistPaths';\nimport { StorePersistStorage } from './persistStorage';\n\nexport class StorePersist<T> {\n private replayPatches = new Array<Patch>();\n isInitialized = false;\n whenInitialized = this.load();\n private isStopped = false;\n private sub?: () => void;\n private saveQueue = new Array<{ path: Path; t: number }>();\n private isSaving = false;\n private saveTimeout?: ReturnType<typeof setTimeout>;\n private paths: { path: Path; throttleMs?: number }[];\n\n constructor(\n public readonly store: Store<T>,\n public readonly storage: StorePersistStorage,\n public readonly options: {\n paths?: (PersistPaths<T> | { path: PersistPaths<T>; throttleMs?: number })[];\n throttleMs?: number;\n log?: (...args: any[]) => void;\n } = {}\n ) {\n if (!options.paths) {\n this.paths = [{ path: [], throttleMs: options.throttleMs }];\n } else {\n this.paths = options.paths.map((p) => ({\n path: (typeof p === 'object' ? p.path : p).split('.'),\n throttleMs: (typeof p === 'object' ? p.throttleMs : undefined) ?? options.throttleMs,\n }));\n }\n\n this.paths.sort((a, b) => b.path.length - a.path.length);\n this.watch();\n }\n\n private async load() {\n try {\n const storage = this.storage;\n\n let keys;\n if ('keys' in storage) {\n keys = await storage.keys();\n } else {\n const length = storage.length instanceof Function ? await storage.length() : storage.length;\n keys = new Array<string>();\n for (let i = 0; i < length; i++) {\n const key = await storage.key(i);\n if (key !== null) keys.push(key);\n }\n }\n keys.sort((a, b) => a.length - b.length);\n\n const patches = new Array<Patch & { persist: StorePersist<T> }>();\n for (const key of keys) {\n const value = await storage.getItem(key);\n if (value) {\n patches.push({\n path: key.split('.'),\n op: 'replace',\n value: value === 'undefined' ? undefined : JSON.parse(value),\n persist: this,\n });\n }\n }\n\n if (this.isStopped) {\n return false;\n }\n\n if (patches.length > 0) {\n this.store.applyPatches(patches);\n }\n\n this.isInitialized = true;\n if (this.replayPatches.length > 0) {\n this.store.applyPatches(this.replayPatches);\n this.replayPatches = [];\n }\n\n return true;\n } catch (e) {\n (this.options.log ?? console.error)('Failed to load storePersist:', e);\n return false;\n }\n }\n\n private watch() {\n this.sub = this.store.subscribePatches((patches) => {\n for (const patch of patches) {\n if ((patch as any).persist === this) {\n continue;\n } else if (this.isInitialized === true) {\n this.addToSaveQueue(patch.path);\n } else {\n this.replayPatches.push(patch);\n }\n }\n });\n }\n\n private addToSaveQueue(path: Path) {\n const match = this.paths.find((p) => isAncestor(p.path, path));\n if (!match) return;\n\n path = path.slice(0, match.path.length);\n const t = Date.now() + (match.throttleMs ?? 0);\n\n if (this.saveQueue.some((i) => i.t <= t && isAncestor(i.path, path))) return;\n this.saveQueue.push({ path, t });\n this.saveQueue.sort((a, b) => a.t - b.t);\n this.run();\n }\n\n private async run() {\n if (this.saveTimeout) clearTimeout(this.saveTimeout);\n const next = this.saveQueue[0];\n\n if (!next) return;\n if (next.t > Date.now()) {\n this.saveTimeout = setTimeout(() => this.run(), next.t - Date.now());\n return;\n }\n\n try {\n this.isSaving = true;\n this.saveQueue.shift();\n await this.save(next.path);\n } finally {\n this.isSaving = false;\n this.run();\n }\n }\n\n private async save(path: Path) {\n const { store, storage } = this;\n let value = get(store.getState(), path);\n\n const subPaths = this.paths\n .filter((p) => isAncestor(path, p.path) && p.path.length > path.length)\n .map((p) => p.path.slice(path.length));\n\n const subValues = new Array<{ path: Path; value: unknown }>();\n for (const subPath of subPaths) {\n const result = split(value, subPath);\n value = result[0];\n subValues.push(...result[1].map((s) => ({ path: [...path, ...s.path], value: s.value })));\n }\n\n const result = storage.setItem(path.join('.'), JSON.stringify(value) ?? 'undefined');\n if (result instanceof Promise) await result;\n for (const { path, value } of subValues) {\n const result = storage.setItem(path.join('.'), JSON.stringify(value) ?? 'undefined');\n if (result instanceof Promise) await result;\n }\n }\n\n stop(): void {\n this.isStopped = true;\n this.sub?.();\n }\n}\n","export function hash(arg: unknown): string {\n return JSON.stringify({ arg }, (_key, value) => {\n if (value instanceof Object && !(value instanceof Array)) {\n const obj: any = {};\n for (const key of Object.keys(value).sort()) {\n obj[key] = value[key as keyof typeof value];\n }\n return obj;\n }\n return value;\n });\n}\n","'use strict';\n\n// do not edit .js files directly - edit src/index.jst\n\n\n var envHasBigInt64Array = typeof BigInt64Array !== 'undefined';\n\n\nmodule.exports = function equal(a, b) {\n if (a === b) return true;\n\n if (a && b && typeof a == 'object' && typeof b == 'object') {\n if (a.constructor !== b.constructor) return false;\n\n var length, i, keys;\n if (Array.isArray(a)) {\n length = a.length;\n if (length != b.length) return false;\n for (i = length; i-- !== 0;)\n if (!equal(a[i], b[i])) return false;\n return true;\n }\n\n\n if ((a instanceof Map) && (b instanceof Map)) {\n if (a.size !== b.size) return false;\n for (i of a.entries())\n if (!b.has(i[0])) return false;\n for (i of a.entries())\n if (!equal(i[1], b.get(i[0]))) return false;\n return true;\n }\n\n if ((a instanceof Set) && (b instanceof Set)) {\n if (a.size !== b.size) return false;\n for (i of a.entries())\n if (!b.has(i[0])) return false;\n return true;\n }\n\n if (ArrayBuffer.isView(a) && ArrayBuffer.isView(b)) {\n length = a.length;\n if (length != b.length) return false;\n for (i = length; i-- !== 0;)\n if (a[i] !== b[i]) return false;\n return true;\n }\n\n\n if (a.constructor === RegExp) return a.source === b.source && a.flags === b.flags;\n if (a.valueOf !== Object.prototype.valueOf) return a.valueOf() === b.valueOf();\n if (a.toString !== Object.prototype.toString) return a.toString() === b.toString();\n\n keys = Object.keys(a);\n length = keys.length;\n if (length !== Object.keys(b).length) return false;\n\n for (i = length; i-- !== 0;)\n if (!Object.prototype.hasOwnProperty.call(b, keys[i])) return false;\n\n for (i = length; i-- !== 0;) {\n var key = keys[i];\n\n if (key === '_owner' && a.$$typeof) {\n // React-specific: avoid traversing React elements' _owner.\n // _owner contains circular references\n // and is not needed when comparing the actual elements (and not their owners)\n continue;\n }\n\n if (!equal(a[key], b[key])) return false;\n }\n\n return true;\n }\n\n // true if both NaN, false otherwise\n return a!==a && b!==b;\n};\n","type FilterString<T> = T extends string ? T : never;\n\nexport declare type SelectorPaths<T> = FilterString<\n keyof {\n [K in keyof NonNullable<T> as\n | K\n | (0 extends 1 & NonNullable<T>[K]\n ? `${FilterString<K>}.${any}`\n : NonNullable<NonNullable<T>[K]> extends Record<string, unknown>\n ? `${FilterString<K>}.${SelectorPaths<NonNullable<T>[K]>}`\n : never)]: 1;\n }\n>;\n\ntype Value<T, K> = K extends keyof T ? T[K] : K extends keyof NonNullable<T> ? NonNullable<T>[K] | undefined : undefined;\n\nexport type SelectorValue<T, K> = K extends `${infer K}.${infer Rest}` ? SelectorValue<Value<T, K>, Rest> : Value<T, K>;\n\nexport function createSelector<T, S>(stringSelector: string): (state: T) => S {\n const parts = stringSelector.split('.');\n return (state) => parts.reduce<any>((v, p) => (v instanceof Object && p in v ? v[p as keyof typeof v] : undefined), state);\n}\n\nexport function setWithSelector(state: unknown, stringSelector: string, value: unknown): void {\n const parts = stringSelector.split('.');\n const prefix = parts.slice(0, -1);\n const last = parts[parts.length - 1]!;\n\n for (const part of prefix) {\n if (state instanceof Object && part in state) {\n state = state[part as keyof typeof state];\n } else {\n throw Error(`Could not set ${stringSelector} because path ${stringSelector} doesn't exist`);\n }\n }\n\n if (state instanceof Object) {\n state[last as keyof typeof state] = value as any;\n } else {\n throw Error(`Could not set ${stringSelector} because path ${stringSelector} doesn't exist`);\n }\n}\n","export function throttle<Args extends any[]>(fn: (...args: Args) => void, ms: number): (...args: Args) => void {\n let last = 0;\n let lastArgs: Args | undefined;\n let timeout: ReturnType<typeof setTimeout> | undefined;\n\n function run() {\n const args = lastArgs;\n\n last = Date.now();\n lastArgs = undefined;\n timeout = undefined;\n\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n fn(...args!);\n }\n\n return function (...args: Args) {\n const now = Date.now();\n lastArgs = args;\n\n if (timeout) {\n // do nothing\n } else if (now < last + ms) {\n timeout = setTimeout(run, last + ms - now);\n } else {\n run();\n }\n };\n}\n","import eq from 'fast-deep-equal/es6/react';\nimport { applyPatches, Draft, enableMapSet, enablePatches, freeze, Patch, produce } from 'immer';\nimport { Cancel } from './helpers/misc';\nimport { createSelector, SelectorPaths, SelectorValue } from './helpers/stringSelector';\nimport { throttle as throttleFn } from './helpers/throttle';\n\nexport type StoreOptions = {\n /** Log errors. Default: console.error */\n log?: (...data: any[]) => void;\n};\n\nexport type StoreSubscribeOptions = {\n /** Invoke callback immediately with the current value? Default: true */\n runNow?: boolean;\n /** Throttle invocations of callback. */\n throttle?: number;\n /** Comparison function to determine if the data has changed. Default: fast-deep-equal */\n compare?: (a: any, b: any) => boolean;\n};\n\nexport type StoreAddReactionOptions = {\n /** Invoke callback immediately with the current value? Default: true */\n runNow?: boolean;\n /** Comparison function to determine if the data has changed. Default: fast-deep-equal */\n compare?: (a: any, b: any) => boolean;\n};\n\nconst RESTART_UPDATE = Symbol('RESTART_UPDATE');\n\nexport class Store<T> {\n private subscriptions = new Set<(state: T, patches: Patch[]) => void>();\n private batchCounter = 0;\n private reactions = new Set<() => void>();\n private patches = new Array<Patch>();\n private lock?: 'reaction';\n private options;\n\n constructor(private state: T, { log = (...data: any[]) => console.error(...data) }: StoreOptions = {}) {\n freeze(state, true);\n enableMapSet();\n enablePatches();\n\n this.options = {\n log,\n };\n }\n\n getState(): T {\n return this.state;\n }\n\n update(update: (draft: Draft<T>, original: T) => Draft<T> | void | undefined): void {\n this.checkLock();\n\n this.state = produce(\n this.state,\n (draft) => update(draft, this.state),\n (patches) => this.patches.push(...patches)\n );\n\n this.notify();\n }\n\n set(state: T): void {\n this.checkLock();\n\n this.state = produce(\n this.state,\n () => state,\n (patches) => this.patches.push(...patches)\n ) as T;\n\n this.notify();\n }\n\n applyPatches(patches: Patch[]): void {\n this.checkLock();\n\n this.state = applyPatches(this.state, patches);\n this.patches.push(...patches);\n\n this.notify();\n }\n\n batchUpdates(fn: () => void): void {\n try {\n this.batchCounter++;\n fn();\n } finally {\n this.batchCounter--;\n if (this.batchCounter === 0) {\n this.notify();\n }\n }\n }\n\n subscribe(listener: (value: T, prev: T, state: T) => void, options?: StoreSubscribeOptions): Cancel;\n subscribe<S>(selector: (state: T) => S, listener: (value: S, prev: S, state: T) => void, options?: StoreSubscribeOptions): Cancel;\n subscribe<K extends SelectorPaths<T>>(\n selector: K,\n listener: (value: SelectorValue<T, K>, prev: SelectorValue<T, K>, state: T) => void,\n options?: StoreSubscribeOptions\n ): Cancel;\n subscribe<S>(...args: any[]): Cancel {\n let selector: (state: T) => S, listener: (value: S, prev: S, state: T) => void, options: StoreSubscribeOptions | undefined;\n\n if (args[1] instanceof Function) {\n [selector, listener, options] = args;\n if (typeof selector === 'string') {\n selector = createSelector<T, S>(selector);\n }\n } else {\n [selector, listener, options] = [(x) => x as any, ...args];\n }\n\n const { runNow = true, throttle = 0, compare = eq } = options ?? {};\n const throttledListener = throttle ? throttleFn(listener, throttle) : listener;\n\n let value = selector(this.state);\n\n const internalListener = (state: T, _patches: Patch[], init?: boolean) => {\n try {\n const oldValue = value;\n value = selector(state);\n if (!init && compare(value, oldValue)) return;\n (init ? listener : throttledListener)(value, oldValue, this.state);\n } catch (e) {\n this.options.log('Failed to execute listener:', e);\n }\n };\n\n this.subscriptions.add(internalListener);\n if (runNow) internalListener(this.state, [], true);\n return () => {\n this.subscriptions.delete(internalListener);\n };\n }\n\n addReaction(reaction: (value: T, draft: Draft<T>, original: T, prev: T) => void, options?: StoreAddReactionOptions): Cancel;\n addReaction<S>(\n selector: (state: T) => S,\n reaction: (value: S, draft: Draft<T>, original: T, prev: S) => void,\n options?: StoreAddReactionOptions\n ): Cancel;\n addReaction<K extends SelectorPaths<T>>(\n selector: K,\n reaction: (value: SelectorValue<T, K>, draft: Draft<T>, original: T, prev: SelectorValue<T, K>) => void,\n options?: StoreAddReactionOptions\n ): Cancel;\n addReaction<S>(...args: any[]): Cancel {\n let selector: (state: T) => S,\n reaction: (value: S, draft: Draft<T>, original: T, prev: S) => void,\n options: StoreAddReactionOptions | undefined;\n\n if (args[1] instanceof Function) {\n [selector, reaction, options] = args;\n if (typeof selector === 'string') {\n selector = createSelector<T, S>(selector);\n }\n } else {\n [selector, reaction, options] = [(x) => x as any, ...args];\n }\n const { runNow = true, compare = eq } = options ?? {};\n\n let value = selector(this.state);\n\n const internalListener = (init?: boolean) => {\n let hasChanged = false;\n\n try {\n this.lock = 'reaction';\n const oldValue = value;\n value = selector(this.state);\n if (!init && compare(value, oldValue)) return;\n\n this.state = produce(\n this.state,\n (draft) => reaction(value, draft, this.state, oldValue),\n (patches) => {\n hasChanged = true;\n this.patches.push(...patches);\n }\n );\n } catch (e) {\n this.options.log('Failed to execute reaction:', e);\n } finally {\n delete this.lock;\n }\n\n if (hasChanged && !init) throw RESTART_UPDATE;\n if (hasChanged && init) this.notify();\n };\n\n this.reactions.add(internalListener);\n if (runNow) internalListener(true);\n return () => {\n this.reactions.delete(internalListener);\n };\n }\n\n subscribePatches(listener: (patches: Patch[]) => void): Cancel {\n const internalListener = (_state: T, patches: Patch[]) => {\n try {\n listener(patches);\n } catch (e) {\n this.options.log('Failed to execute patch listener:', e);\n }\n };\n\n this.subscriptions.add(internalListener);\n return () => {\n this.subscriptions.delete(internalListener);\n };\n }\n\n private checkLock() {\n if (this.lock === 'reaction') {\n throw Error('You cannot call update from within a reaction. Use the passed draft instead.');\n }\n }\n\n private notify(): void {\n if (this.batchCounter > 0 || this.patches.length === 0) return;\n\n try {\n for (const reaction of this.reactions) {\n reaction();\n }\n } catch (e) {\n return this.notify();\n }\n\n const patches = this.patches;\n this.patches = [];\n\n this.batchUpdates(() => {\n for (const subscription of this.subscriptions) {\n subscription(this.state, patches);\n }\n });\n }\n}\n","/** @license React vundefined\n * use-sync-external-store-shim.production.min.js\n *\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n'use strict';var e=require(\"react\");function h(a,b){return a===b&&(0!==a||1/a===1/b)||a!==a&&b!==b}var k=\"function\"===typeof Object.is?Object.is:h,l=e.useState,m=e.useEffect,n=e.useLayoutEffect,p=e.useDebugValue;function q(a,b){var d=b(),f=l({inst:{value:d,getSnapshot:b}}),c=f[0].inst,g=f[1];n(function(){c.value=d;c.getSnapshot=b;r(c)&&g({inst:c})},[a,d,b]);m(function(){r(c)&&g({inst:c});return a(function(){r(c)&&g({inst:c})})},[a]);p(d);return d}\nfunction r(a){var b=a.getSnapshot;a=a.value;try{var d=b();return!k(a,d)}catch(f){return!0}}function t(a,b){return b()}var u=\"undefined\"===typeof window||\"undefined\"===typeof window.document||\"undefined\"===typeof window.document.createElement?t:q;exports.useSyncExternalStore=void 0!==e.useSyncExternalStore?e.useSyncExternalStore:u;\n","'use strict';\n\nif (process.env.NODE_ENV === 'production') {\n module.exports = require('../cjs/use-sync-external-store-shim.production.min.js');\n} else {\n module.exports = require('../cjs/use-sync-external-store-shim.development.js');\n}\n","/** @license React vundefined\n * use-sync-external-store-shim/with-selector.production.min.js\n *\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n'use strict';var h=require(\"react\"),n=require(\"use-sync-external-store/shim\");function p(a,b){return a===b&&(0!==a||1/a===1/b)||a!==a&&b!==b}var q=\"function\"===typeof Object.is?Object.is:p,r=n.useSyncExternalStore,t=h.useRef,u=h.useEffect,v=h.useMemo,w=h.useDebugValue;\nexports.useSyncExternalStoreWithSelector=function(a,b,e,l,g){var c=t(null);if(null===c.current){var f={hasValue:!1,value:null};c.current=f}else f=c.current;c=v(function(){function a(a){if(!c){c=!0;d=a;a=l(a);if(void 0!==g&&f.hasValue){var b=f.value;if(g(b,a))return k=b}return k=a}b=k;if(q(d,a))return b;var e=l(a);if(void 0!==g&&g(b,e))return b;d=a;return k=e}var c=!1,d,k,m=void 0===e?null:e;return[function(){return a(b())},null===m?void 0:function(){return a(m())}]},[b,e,l,g]);var d=r(a,c[0],c[1]);\nu(function(){f.hasValue=!0;f.value=d},[d]);w(d);return d};\n","'use strict';\n\nif (process.env.NODE_ENV === 'production') {\n module.exports = require('../cjs/use-sync-external-store-shim/with-selector.production.min.js');\n} else {\n module.exports = require('../cjs/use-sync-external-store-shim/with-selector.development.js');\n}\n","import eq from 'fast-deep-equal/es6/react';\nimport { useCallback, useDebugValue } from 'react';\nimport { useSyncExternalStoreWithSelector } from 'use-sync-external-store/shim/with-selector';\nimport { StoreSubscribeOptions } from '..';\nimport { createSelector, SelectorPaths, SelectorValue } from '../helpers/stringSelector';\nimport { Store } from './store';\n\nexport type UseStoreStateOptions = Omit<StoreSubscribeOptions, 'runNow'>;\n\nexport function useStoreState<T>(store: Store<T>, options?: UseStoreStateOptions): T;\nexport function useStoreState<T, S>(store: Store<T>, selector: (state: T) => S, options?: UseStoreStateOptions): S;\nexport function useStoreState<T, K extends SelectorPaths<T>>(\n store: Store<T>,\n selector: K,\n options?: UseStoreStateOptions\n): SelectorValue<T, K>;\nexport function useStoreState<T, S>(store: Store<T>, ...args: any[]): S {\n let selector: (state: T) => S, options: UseStoreStateOptions;\n\n if (args[0] instanceof Function) {\n selector = args[0];\n options = args[1] ?? {};\n } else if (typeof args[0] === 'string') {\n selector = createSelector(args[0]);\n options = args[1] ?? {};\n } else {\n selector = (x) => x as any;\n options = args[0] ?? {};\n }\n\n const subscribe = useCallback(\n (listener: () => void) => {\n return store.subscribe((x) => x, listener, {\n throttle: options.throttle,\n runNow: false,\n compare: (a, b) => a === b,\n });\n },\n [store, options.throttle]\n );\n\n const getSnapshot = useCallback(() => store.getState(), [store]);\n\n const value = useSyncExternalStoreWithSelector(\n //\n subscribe,\n getSnapshot,\n getSnapshot,\n selector,\n options.compare ?? eq\n );\n\n useDebugValue(value);\n return value;\n}\n","import { SelectorPaths, SelectorValue, setWithSelector } from '../helpers/stringSelector';\nimport { Store } from './store';\nimport { useStoreState } from './useStoreState';\n\nexport type UseStorePropResult<T, K extends SelectorPaths<T>> = [value: SelectorValue<T, K>, update: (value: SelectorValue<T, K>) => void];\n\nexport function useStoreProp<T, K extends SelectorPaths<T>>(store: Store<T>, selector: K): UseStorePropResult<T, K> {\n const value = useStoreState(store, selector);\n const update = (value: SelectorValue<T, K>) => store.update((state) => setWithSelector(state, selector, value));\n\n return [value, update];\n}\n","import { Store as BaseStore } from '../store';\nimport { SelectorPaths, SelectorValue } from '../helpers/stringSelector';\nimport { useStoreProp, UseStorePropResult } from './useStoreProp';\nimport { useStoreState, UseStoreStateOptions } from './useStoreState';\n\nexport class Store<T> extends BaseStore<T> {\n useState(options?: { throttle?: number }): T;\n useState<S>(selector: (state: T) => S, options?: UseStoreStateOptions): S;\n useState<K extends SelectorPaths<T>>(selector: K, options?: UseStoreStateOptions): SelectorValue<T, K>;\n useState(...args: any[]): any {\n return useStoreState(this, ...args);\n }\n\n useProp<K extends SelectorPaths<T>>(selector: K): UseStorePropResult<T, K> {\n return useStoreProp(this, selector);\n }\n}\n","import React, { Context, createContext, ReactNode, useContext, useMemo } from 'react';\nimport { SelectorPaths, SelectorValue } from '../helpers/stringSelector';\nimport { Store } from './store';\nimport { useStoreProp, UseStorePropResult } from './useStoreProp';\nimport { useStoreState, UseStoreStateOptions } from './useStoreState';\n\nexport class StoreScope<T> {\n readonly context: Context<Store<T>>;\n\n constructor(public readonly defaultValue: T) {\n this.context = createContext(new Store(defaultValue));\n }\n\n Provider = ({ children, store }: { children: ReactNode; store?: Store<T> }): JSX.Element => {\n const _store = useMemo(() => store ?? new Store(this.defaultValue), [store]);\n\n return <this.context.Provider value={_store}>{children}</this.context.Provider>;\n };\n\n withScope = <Args extends Record<string, unknown>>(Component: (args: Args) => JSX.Element) => {\n return (args: Args): JSX.Element => (\n <this.Provider>\n <Component {...args} />\n </this.Provider>\n );\n };\n\n useStore(): Store<T> {\n return useContext(this.context);\n }\n\n useState(options?: { throttle?: number }): T;\n useState<S>(selector: (state: T) => S, dependencies?: any[], options?: { throttle?: number }): S;\n useState<K extends SelectorPaths<T>>(selector: K, options?: UseStoreStateOptions): SelectorValue<T, K>;\n useState(...args: any[]): any {\n const store = this.useStore();\n return useStoreState(store, ...args);\n }\n\n useProp<K extends SelectorPaths<T>>(selector: K): UseStorePropResult<T, K> {\n const store = this.useStore();\n return useStoreProp(store, selector);\n }\n}\n","import eq from 'fast-deep-equal/es6/react';\nimport { useCallback, useDebugValue, useEffect } from 'react';\nimport { useSyncExternalStoreWithSelector } from 'use-sync-external-store/shim/with-selector';\nimport { ResourceInfo, ResourceInstance, ResourceSubscribeOptions } from '..';\nimport { hash } from '../helpers/hash';\n\nexport type UseResource<Value> = Pick<ResourceInstance<unknown, Value>, 'id' | 'invalidateCache' | 'subscribe' | 'getCache' | 'get'>;\n\nexport type UseResourceOptions = Omit<ResourceSubscribeOptions, 'runNow'> & {\n /** Invalidate the resource on mount, causing it to update in the background */\n updateOnMount?: boolean;\n /** Don't subscribe resource while this is true */\n dormant?: boolean;\n};\n\n/** Subscribe to a resource. This will immediately return cached values, if available, and update for future updates.\n * @param resource the resource to subscribe to.\n * @param options options\n */\nexport function useResource<Value>(resource: UseResource<Value>, options?: UseResourceOptions): ResourceInfo<Value> {\n const { compare, dormant, throttle, updateOnMount, watchOnly } = options ?? {};\n\n useEffect(() => {\n if (updateOnMount && !dormant) {\n resource.invalidateCache();\n }\n }, []);\n\n const subscribe = useCallback(\n (listener: () => void) => {\n if (dormant)\n return () => {\n // nothing to do\n };\n\n return resource.subscribe(listener, {\n watchOnly,\n throttle,\n runNow: false,\n compare,\n });\n },\n [resource.id, watchOnly, dormant, throttle]\n );\n\n const getSnapshot = useCallback(() => resource.getCache(), [resource.id]);\n\n let value = useSyncExternalStoreWithSelector(\n //\n subscribe,\n getSnapshot,\n getSnapshot,\n (x) => x,\n eq\n );\n\n if (dormant) {\n value = { state: 'empty', isLoading: false };\n }\n\n useDebugValue(value);\n return value;\n}\n\n/** Subscribe to a resource. This will immediately return cached values, if available, and update for future updates. While waiting for data, it throws so that the Component will be suspended. If there is an error, it throws.\n * @param resource the resource to subscribe to.\n * @param options options\n */\nexport function useReadResource<Value>(resource: UseResource<Value>, options?: UseResourceOptions): Value {\n const info = useResource(resource, options);\n\n if (info.state === 'error') {\n throw info.error;\n }\n\n if (info.state === 'empty') {\n throw resource.get();\n }\n\n useDebugValue(info.value);\n return info.value;\n}\n\nexport type CombineValues<T> = T extends [UseResource<infer Value>]\n ? [Value]\n : T extends [UseResource<infer Value>, ...infer Rest]\n ? [Value, ...CombineValues<Rest>]\n : T extends readonly UseResource<infer Value>[]\n ? Value[]\n : any[];\n\n/** Combine multiple resources into one that can be fed into useResource or useReadResource. Return value will be an array of the combined resources' values.\n * @param resources resources to be combined\n */\nexport function combineResources<Resources extends readonly UseResource<any>[]>(\n ...resources: Resources\n): UseResource<CombineValues<Resources>> {\n return {\n id: hash(resources.map((resource) => resource.id)),\n\n invalidateCache() {\n for (const resource of resources) {\n resource.invalidateCache();\n }\n },\n\n subscribe(listener, options) {\n const handles = resources.map((resource) => resource.subscribe(listener, options));\n\n return () => {\n for (const handle of handles) {\n handle();\n }\n };\n },\n\n getCache() {\n const caches = resources.map((resource) => resource.getCache());\n const isStale = caches.some((cache) => cache.isStale);\n const isLoading = caches.some((cache) => cache.isLoading);\n\n if (caches.some((resource) => resource.state === 'error')) {\n const error = caches.find((cache) => cache.error !== undefined)?.error;\n return { state: 'error', error, isStale, isLoading };\n }\n\n if (caches.every((resource) => resource.state === 'value')) {\n const value = caches.map((cache) => cache.value) as CombineValues<Resources>;\n return { state: 'value', value, isStale, isLoading };\n }\n\n return { state: 'empty', isLoading };\n },\n\n get() {\n return Promise.all(resources.map((resource) => resource.get())) as Promise<CombineValues<Resources>>;\n },\n };\n}\n","import { Store } from 'schummar-state/react';\nimport type { PartialTableTheme } from '../types';\n\nexport const globalTableTheme = new Store<PartialTableTheme>({});\n\nexport function configureTableTheme(tableTheme: PartialTableTheme) {\n globalTableTheme.set(tableTheme);\n}\n\nexport function mergeThemes<T>(...themes: PartialTableTheme<T>[]): PartialTableTheme<T> {\n return {\n text: Object.assign({}, ...themes.map((theme) => theme.text)),\n classes: Object.assign({}, ...themes.map((theme) => theme.classes)),\n styles: Object.assign({}, ...themes.map((theme) => theme.styles)),\n components: Object.assign({}, ...themes.map((theme) => theme.components)),\n icons: Object.assign({}, ...themes.map((theme) => theme.icons)),\n colors: {\n primary: Object.assign({}, ...themes.map((theme) => theme.colors?.primary)),\n secondary: Object.assign({}, ...themes.map((theme) => theme.colors?.secondary)),\n blocked: Object.assign({}, ...themes.map((theme) => theme.colors?.blocked)),\n background: themes\n .map((theme) => theme.colors?.background)\n .reverse()\n .find((x) => x !== undefined),\n text: themes\n .map((theme) => theme.colors?.text)\n .reverse()\n .find((x) => x !== undefined),\n border: themes\n .map((theme) => theme.colors?.border)\n .reverse()\n .find((x) => x !== undefined),\n borderLight: themes\n .map((theme) => theme.colors?.borderLight)\n .reverse()\n .find((x) => x !== undefined),\n },\n spacing: themes\n .map((theme) => theme.spacing)\n .reverse()\n .find((x) => x !== undefined),\n };\n}\n","import { ReactNode, createContext, useContext } from 'react';\nimport CsvExporter from '../exporters/csvExporter';\nimport { ExporterEntry } from '../exporters/exporter';\nimport { PartialTableTheme } from '../types';\n\nexport interface TableSettingsContextType {\n theme: PartialTableTheme;\n exporters: ExporterEntry[];\n}\n\nexport const TableSettingsContext = createContext<TableSettingsContextType>({\n theme: {},\n exporters: [\n { action: 'copy', exporter: new CsvExporter() },\n { action: 'download', exporter: new CsvExporter() },\n ],\n});\n\nexport function TableSettingsProvider({\n theme,\n exporters,\n additionalExporters,\n children,\n}: Partial<TableSettingsContextType> & {\n additionalExporters?: ExporterEntry[];\n children?: ReactNode;\n}) {\n const inherited = useContext(TableSettingsContext);\n theme ??= inherited.theme;\n exporters ??= inherited.exporters;\n\n if (additionalExporters) {\n exporters = [...exporters, ...additionalExporters];\n }\n\n return (\n <TableSettingsContext.Provider\n value={{\n theme,\n exporters,\n }}\n >\n {children}\n </TableSettingsContext.Provider>\n );\n}\n"],"mappings":";;;;;;;;;AAAA,SAAS,iBAAiB,QAAQ,gBAAgB;AAClD,SAAS,oBAAoB;;;ACD7B,SAAS,WAAW;AAEpB,IAAM,OAAO,IAAI;AAAA,EACf,SAAS;AAAA,EACT,YAAY;AAAA,EACZ,cAAc;AAAA,EACd,YAAY;AAAA,EACZ,UAAU;AAAA,EAEV,iBAAiB;AAAA,IACf,SAAS;AAAA,EACX;AACF,CAAC;AAEM,IAAM,iBAAiB;AAAA,EAC5B,OAAO,IAAI;AAAA,IACT,UAAU;AAAA,IACV,SAAS;AAAA,IACT,OAAO;AAAA,EACT,CAAC;AAAA,EAED;AAAA,EAEA,UAAU,IAAI;AAAA,IACZ,cAAc;AAAA,EAChB,CAAC;AAAA,EAED,YAAY,IAAI,MAAM;AAAA,IACpB,cAAc;AAAA,IACd,YAAY;AAAA,IAEZ,iBAAiB;AAAA,MACf,SAAS;AAAA,IACX;AAAA,EACF,CAAC;AAAA,EAED,YAAY,IAAI,MAAM;AAAA,IACpB,SAAS;AAAA,IACT,WAAW;AAAA,IACX,cAAc;AAAA,IACd,YAAY;AAAA,EACd,CAAC;AAAA,EAED,WAAW,IAAI;AAAA,IACb,gBAAgB;AAAA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p","throttle","eq","throttleFn","e","require$$0","h","n","p","r","u","t","q","shimModule","require$$1","withSelectorModule","useSyncExternalStoreWithSelector","eq","BaseStore","Store","__spreadValues","Store","createContext","useContext","jsx","createContext","useContext"]}
package/dist/index.cjs CHANGED
@@ -860,7 +860,6 @@ var cell = (0, import_react4.css)({
860
860
  borderBottom: "1px solid var(--table-border-light-color)",
861
861
  whiteSpace: "nowrap",
862
862
  overflow: "hidden",
863
- background: "var(--table-background-color)",
864
863
  "&:not(:empty)": {
865
864
  padding: `calc(var(--spacing) * 0.1) calc(2 * var(--spacing))`
866
865
  }
@@ -873,11 +872,11 @@ var defaultClasses = {
873
872
  }),
874
873
  cell,
875
874
  cellFill: (0, import_react4.css)({
876
- borderBottom: "1px solid var(--table-border-light-color)",
877
- background: "var(--table-background-color)"
875
+ borderBottom: "1px solid var(--table-border-light-color)"
878
876
  }),
879
877
  headerCell: (0, import_react4.css)(cell, {
880
878
  borderBottom: "1px solid var(--table-border-color)",
879
+ background: "var(--table-background-color)",
881
880
  "&:not(:empty)": {
882
881
  padding: `var(--spacing) 0 var(--spacing) calc(2 * var(--spacing))`
883
882
  }
@@ -885,7 +884,8 @@ var defaultClasses = {
885
884
  footerCell: (0, import_react4.css)(cell, {
886
885
  padding: `var(--spacing) calc(2 * var(--spacing))`,
887
886
  borderTop: "1px solid var(--table-border-color)",
888
- borderBottom: "none"
887
+ borderBottom: "none",
888
+ background: "var(--table-background-color)"
889
889
  }),
890
890
  firstCell: (0, import_react4.css)({
891
891
  justifyContent: "start"
@@ -1505,17 +1505,21 @@ function useTheme(selector) {
1505
1505
  const memo4 = useTableMemo();
1506
1506
  const _globalTableTheme = globalTableTheme.useState();
1507
1507
  const process = (t2) => {
1508
- var _a2, _b2, _c, _d;
1509
- const cellClass = (_a2 = t2.classes) == null ? void 0 : _a2.cell;
1510
- const cellStyles = (_b2 = t2.styles) == null ? void 0 : _b2.cell;
1511
- const detailsClass = (_c = t2.classes) == null ? void 0 : _c.details;
1512
- const detailsStyles = (_d = t2.styles) == null ? void 0 : _d.details;
1508
+ var _a2, _b2, _c, _d, _e, _f;
1509
+ const rowClass = (_a2 = t2.classes) == null ? void 0 : _a2.row;
1510
+ const rowStyles = (_b2 = t2.styles) == null ? void 0 : _b2.row;
1511
+ const cellClass = (_c = t2.classes) == null ? void 0 : _c.cell;
1512
+ const cellStyles = (_d = t2.styles) == null ? void 0 : _d.cell;
1513
+ const detailsClass = (_e = t2.classes) == null ? void 0 : _e.details;
1514
+ const detailsStyles = (_f = t2.styles) == null ? void 0 : _f.details;
1513
1515
  return __spreadProps(__spreadValues({}, t2), {
1514
1516
  classes: __spreadProps(__spreadValues({}, t2.classes), {
1517
+ row: rowClass instanceof Function || Array.isArray(rowClass) ? memo4("theme.classes.row", rowClass) : rowClass,
1515
1518
  cell: cellClass instanceof Function || Array.isArray(cellClass) ? memo4("theme.classes.cell", cellClass) : cellClass,
1516
1519
  details: detailsClass instanceof Function || Array.isArray(detailsClass) ? memo4("theme.classes.details", detailsClass) : detailsClass
1517
1520
  }),
1518
1521
  styles: __spreadProps(__spreadValues({}, t2.styles), {
1522
+ row: rowStyles instanceof Function || Array.isArray(rowStyles) ? memo4("theme.styles.row", rowStyles) : rowStyles,
1519
1523
  cell: cellStyles instanceof Function || Array.isArray(cellStyles) ? memo4("theme.styles.cell", cellStyles) : cellStyles,
1520
1524
  details: detailsStyles instanceof Function || Array.isArray(detailsStyles) ? memo4("theme.styles.details", detailsStyles) : detailsStyles
1521
1525
  }),
@@ -3097,7 +3101,7 @@ function SelectFilter(_a) {
3097
3101
  }
3098
3102
 
3099
3103
  // src/components/table.tsx
3100
- var import_react39 = require("react");
3104
+ var import_react40 = require("react");
3101
3105
 
3102
3106
  // src/internalState/tableStateStorage.ts
3103
3107
  var import_react22 = require("react");
@@ -3517,6 +3521,7 @@ function calcProps(props) {
3517
3521
  };
3518
3522
  };
3519
3523
  const columns = inputColumns.map(mapColumn);
3524
+ const wrapRow = props.wrapRow && cache("wrapRow", props.wrapRow);
3520
3525
  const wrapCell = props.wrapCell && cache("wrapCell", props.wrapCell);
3521
3526
  const rowAction = props.rowAction instanceof Function || Array.isArray(props.rowAction) ? cache("rowAction", props.rowAction) : props.rowAction;
3522
3527
  const rowDetails = props.rowDetails instanceof Function || Array.isArray(props.rowDetails) ? cache("rowDetails", props.rowDetails) : props.rowDetails;
@@ -3525,6 +3530,7 @@ function calcProps(props) {
3525
3530
  parentId,
3526
3531
  columns,
3527
3532
  columnProps,
3533
+ wrapRow,
3528
3534
  wrapCell,
3529
3535
  rowAction,
3530
3536
  rowDetails,
@@ -4355,7 +4361,8 @@ function Export2() {
4355
4361
  }
4356
4362
 
4357
4363
  // src/components/row.tsx
4358
- var import_react37 = require("react");
4364
+ var import_react37 = require("@emotion/react");
4365
+ var import_react38 = require("react");
4359
4366
 
4360
4367
  // src/misc/calcClassNames.ts
4361
4368
  function calcClassNames(classes, item, index) {
@@ -4555,17 +4562,23 @@ function SelectComponent({ itemId }) {
4555
4562
 
4556
4563
  // src/components/row.tsx
4557
4564
  var import_jsx_runtime33 = require("@emotion/react/jsx-runtime");
4558
- var Row = (0, import_react37.memo)(function Row2({
4565
+ var Row = (0, import_react38.memo)(function Row2({
4559
4566
  itemId,
4560
4567
  rowIndex
4561
4568
  }) {
4569
+ var _a;
4562
4570
  const table = useTableContext();
4563
- const divRef = (0, import_react37.useRef)(null);
4564
- const detailsDivRef = (0, import_react37.useRef)(null);
4571
+ const divRef = (0, import_react38.useRef)(null);
4572
+ const detailsDivRef = (0, import_react38.useRef)(null);
4565
4573
  const classes = useTheme((t2) => t2.classes);
4566
4574
  const styles = useTheme((t2) => t2.styles);
4575
+ const item = table.useState((state) => state.activeItemsById.get(itemId));
4576
+ const wrapRow = (_a = table.useState((state) => state.props.wrapRow)) != null ? _a : (props) => /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", __spreadValues({}, props));
4577
+ const rowClassName = (classes == null ? void 0 : classes.row) instanceof Function ? classes.row(item == null ? void 0 : item.value, rowIndex) : classes == null ? void 0 : classes.row;
4578
+ const rowStyles = (styles == null ? void 0 : styles.row) instanceof Function ? styles.row(item == null ? void 0 : item.value, rowIndex) : styles == null ? void 0 : styles.row;
4579
+ const subgrid = table.useState((state) => state.props.subgrid);
4567
4580
  const {
4568
- className: className2,
4581
+ cellClassName,
4569
4582
  css_,
4570
4583
  indent,
4571
4584
  hasChildren,
@@ -4575,21 +4588,21 @@ var Row = (0, import_react37.memo)(function Row2({
4575
4588
  rowAction,
4576
4589
  hasDetails
4577
4590
  } = table.useState((state) => {
4578
- var _a, _b;
4579
- const item = state.activeItemsById.get(itemId);
4591
+ var _a2, _b;
4592
+ const item2 = state.activeItemsById.get(itemId);
4580
4593
  return {
4581
- className: cx(...calcClassNames(classes, item == null ? void 0 : item.value, rowIndex)),
4582
- css_: calcCss(styles, item == null ? void 0 : item.value, rowIndex),
4583
- indent: item ? getAncestors(state.activeItemsById, item).size : 0,
4584
- hasChildren: !!(item == null ? void 0 : item.children.length),
4585
- hasDeferredChildren: item && ((_b = (_a = state.props).hasDeferredChildren) == null ? void 0 : _b.call(_a, item.value)),
4594
+ cellClassName: cx(...calcClassNames(classes, item2 == null ? void 0 : item2.value, rowIndex)),
4595
+ css_: calcCss(styles, item2 == null ? void 0 : item2.value, rowIndex),
4596
+ indent: item2 ? getAncestors(state.activeItemsById, item2).size : 0,
4597
+ hasChildren: !!(item2 == null ? void 0 : item2.children.length),
4598
+ hasDeferredChildren: item2 && ((_b = (_a2 = state.props).hasDeferredChildren) == null ? void 0 : _b.call(_a2, item2.value)),
4586
4599
  columnIds: state.activeColumns.map((column) => column.id),
4587
4600
  enableSelection: state.props.enableSelection,
4588
- rowAction: state.props.rowAction instanceof Function ? item ? state.props.rowAction(item.value, rowIndex) : null : state.props.rowAction,
4589
- hasDetails: state.props.rowDetails instanceof Function ? item ? !!state.props.rowDetails(item.value, rowIndex) : null : !!state.props.rowDetails
4601
+ rowAction: state.props.rowAction instanceof Function ? item2 ? state.props.rowAction(item2.value, rowIndex) : null : state.props.rowAction,
4602
+ hasDetails: state.props.rowDetails instanceof Function ? item2 ? !!state.props.rowDetails(item2.value, rowIndex) : null : !!state.props.rowDetails
4590
4603
  };
4591
4604
  });
4592
- (0, import_react37.useLayoutEffect)(() => {
4605
+ (0, import_react38.useLayoutEffect)(() => {
4593
4606
  function update() {
4594
4607
  table.update((state) => {
4595
4608
  if (!divRef.current) {
@@ -4610,26 +4623,60 @@ var Row = (0, import_react37.memo)(function Row2({
4610
4623
  handles.forEach((h2) => h2());
4611
4624
  };
4612
4625
  }, [table, itemId, divRef.current, detailsDivRef.current]);
4613
- (0, import_react37.useLayoutEffect)(() => {
4614
- var _a, _b;
4615
- return (_b = (_a = table.getState().props).debugRender) == null ? void 0 : _b.call(_a, "render row", itemId);
4626
+ (0, import_react38.useLayoutEffect)(() => {
4627
+ var _a2, _b;
4628
+ return (_b = (_a2 = table.getState().props).debugRender) == null ? void 0 : _b.call(_a2, "render row", itemId);
4616
4629
  });
4617
- return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { css: { display: "contents" }, children: [
4618
- /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: className2, css: [defaultClasses.cellFill, css_], ref: divRef }),
4619
- /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: className2, css: [defaultClasses.cell, defaultClasses.firstCell, css_], children: [
4620
- indent > 0 && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { css: { width: indent * 20 } }),
4621
- enableSelection && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(SelectComponent, { itemId }),
4622
- (hasChildren || hasDeferredChildren || hasDetails) && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(ExpandControl, { itemId, hasDeferredChildren }),
4623
- rowAction
4624
- ] }),
4625
- columnIds.map((columnId) => /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(ColumnContext.Provider, { value: columnId, children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(Cell, { itemId, rowIndex }) }, columnId)),
4626
- /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: className2, css: [defaultClasses.cellFill, css_] }),
4627
- /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(Details, { ref: detailsDivRef, itemId, rowIndex })
4628
- ] });
4630
+ if (!item) {
4631
+ return null;
4632
+ }
4633
+ return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_react37.ClassNames, { children: ({ css: css4 }) => /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_jsx_runtime33.Fragment, { children: wrapRow(
4634
+ {
4635
+ className: css4([
4636
+ subgrid ? {
4637
+ gridColumn: `1 / -1`,
4638
+ display: "grid",
4639
+ gridTemplateColumns: "subgrid"
4640
+ } : {
4641
+ display: "contents"
4642
+ },
4643
+ rowClassName,
4644
+ rowStyles
4645
+ ]),
4646
+ children: /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(import_jsx_runtime33.Fragment, { children: [
4647
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
4648
+ "div",
4649
+ {
4650
+ className: cellClassName,
4651
+ css: [defaultClasses.cellFill, css_],
4652
+ ref: divRef
4653
+ }
4654
+ ),
4655
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(
4656
+ "div",
4657
+ {
4658
+ className: cellClassName,
4659
+ css: [defaultClasses.cell, defaultClasses.firstCell, css_],
4660
+ children: [
4661
+ indent > 0 && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { css: { width: indent * 20 } }),
4662
+ enableSelection && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(SelectComponent, { itemId }),
4663
+ (hasChildren || hasDeferredChildren || hasDetails) && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(ExpandControl, { itemId, hasDeferredChildren }),
4664
+ rowAction
4665
+ ]
4666
+ }
4667
+ ),
4668
+ columnIds.map((columnId) => /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(ColumnContext.Provider, { value: columnId, children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(Cell, { itemId, rowIndex }) }, columnId)),
4669
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: cellClassName, css: [defaultClasses.cellFill, css_] }),
4670
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(Details, { ref: detailsDivRef, itemId, rowIndex })
4671
+ ] })
4672
+ },
4673
+ item.value,
4674
+ rowIndex
4675
+ ) }) });
4629
4676
  });
4630
4677
 
4631
4678
  // src/components/virtualized.tsx
4632
- var import_react38 = require("react");
4679
+ var import_react39 = require("react");
4633
4680
  var import_jsx_runtime34 = require("@emotion/react/jsx-runtime");
4634
4681
  var findScrollRoot = (x) => {
4635
4682
  const parent = x.parentElement;
@@ -4656,8 +4703,8 @@ function Virtualized(_a) {
4656
4703
  var _a2, _b2;
4657
4704
  const table = useTableContext();
4658
4705
  const virtual = table.useState((state) => state.props.virtual);
4659
- const probeRef = (0, import_react38.useRef)(null);
4660
- const [, setId] = (0, import_react38.useState)({});
4706
+ const probeRef = (0, import_react39.useRef)(null);
4707
+ const [, setId] = (0, import_react39.useState)({});
4661
4708
  const {
4662
4709
  itemIds = [],
4663
4710
  from = 0,
@@ -4708,8 +4755,8 @@ function Virtualized(_a) {
4708
4755
  { throttle: 16 }
4709
4756
  );
4710
4757
  const throttleScroll = (_b2 = (_a2 = typeof virtual === "boolean" ? void 0 : virtual) == null ? void 0 : _a2.throttleScroll) != null ? _b2 : 16;
4711
- const update = (0, import_react38.useMemo)(() => throttle2(() => setId({}), throttleScroll), [throttleScroll]);
4712
- (0, import_react38.useEffect)(() => {
4758
+ const update = (0, import_react39.useMemo)(() => throttle2(() => setId({}), throttleScroll), [throttleScroll]);
4759
+ (0, import_react39.useEffect)(() => {
4713
4760
  if (!virtual || !probeRef.current) return;
4714
4761
  window.addEventListener("scroll", update, true);
4715
4762
  window.addEventListener("resize", update, true);
@@ -4718,8 +4765,8 @@ function Virtualized(_a) {
4718
4765
  window.removeEventListener("resize", update, true);
4719
4766
  };
4720
4767
  }, [update, virtual]);
4721
- (0, import_react38.useEffect)(() => update.cancel, [update]);
4722
- (0, import_react38.useLayoutEffect)(
4768
+ (0, import_react39.useEffect)(() => update.cancel, [update]);
4769
+ (0, import_react39.useLayoutEffect)(
4723
4770
  () => {
4724
4771
  var _a3, _b3;
4725
4772
  return (_b3 = (_a3 = table.getState().props).debugRender) == null ? void 0 : _b3.call(_a3, `Virtualalized render ${from} to ${to}`);
@@ -4745,7 +4792,7 @@ function Table(props) {
4745
4792
  resetState();
4746
4793
  });
4747
4794
  }
4748
- (0, import_react39.useLayoutEffect)(() => {
4795
+ (0, import_react40.useLayoutEffect)(() => {
4749
4796
  var _a, _b;
4750
4797
  return (_b = (_a = table.getState().props).debugRender) == null ? void 0 : _b.call(_a, "render table");
4751
4798
  });
@@ -4753,8 +4800,8 @@ function Table(props) {
4753
4800
  }
4754
4801
  function TableLoadingState({ isHydrated }) {
4755
4802
  const loadingText = useTheme((t2) => t2.text.loading);
4756
- const [showLoading, setShowLoading] = (0, import_react39.useState)(false);
4757
- (0, import_react39.useEffect)(() => {
4803
+ const [showLoading, setShowLoading] = (0, import_react40.useState)(false);
4804
+ (0, import_react40.useEffect)(() => {
4758
4805
  const handle = setTimeout(() => setShowLoading(true), 500);
4759
4806
  return () => clearTimeout(handle);
4760
4807
  });
@@ -4763,7 +4810,7 @@ function TableLoadingState({ isHydrated }) {
4763
4810
  /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(TableInner, { hidden: !isHydrated })
4764
4811
  ] });
4765
4812
  }
4766
- var TableInner = (0, import_react39.memo)(function TableInner2({ hidden }) {
4813
+ var TableInner = (0, import_react40.memo)(function TableInner2({ hidden }) {
4767
4814
  const table = useTableContext();
4768
4815
  const fullWidth = table.useState((state) => state.props.fullWidth);
4769
4816
  const activeColumns = table.useState(
@@ -4792,7 +4839,7 @@ var TableInner = (0, import_react39.memo)(function TableInner2({ hidden }) {
4792
4839
  const enableExport = table.useState((state) => !!state.props.enableExport);
4793
4840
  const cssVariables = useCssVariables();
4794
4841
  const enableClearFiltersButton = table.useState((state) => state.props.enableClearFiltersButton);
4795
- (0, import_react39.useLayoutEffect)(() => {
4842
+ (0, import_react40.useLayoutEffect)(() => {
4796
4843
  var _a, _b;
4797
4844
  return (_b = (_a = table.getState().props).debugRender) == null ? void 0 : _b.call(_a, "render table inner");
4798
4845
  });