@economic/taco 2.46.9 → 2.47.0-alpha.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (58) hide show
  1. package/dist/components/Report/Report.d.ts +1 -1
  2. package/dist/components/Select2/components/Option.d.ts +4 -4
  3. package/dist/components/Table3/components/Row/Editing/CreateNewRow.d.ts +1 -2
  4. package/dist/components/Table3/components/Row/Editing/TemporaryRow.d.ts +1 -0
  5. package/dist/components/Table3/util/editing.d.ts +3 -0
  6. package/dist/esm/index.css +13 -4
  7. package/dist/esm/packages/taco/src/charts/utils/color.js.map +1 -1
  8. package/dist/esm/packages/taco/src/components/Badge/Badge.js +9 -6
  9. package/dist/esm/packages/taco/src/components/Badge/Badge.js.map +1 -1
  10. package/dist/esm/packages/taco/src/components/Select2/components/Option.js +7 -5
  11. package/dist/esm/packages/taco/src/components/Select2/components/Option.js.map +1 -1
  12. package/dist/esm/packages/taco/src/components/Select2/components/Trigger.js +56 -19
  13. package/dist/esm/packages/taco/src/components/Select2/components/Trigger.js.map +1 -1
  14. package/dist/esm/packages/taco/src/components/Table3/Table3.js +15 -7
  15. package/dist/esm/packages/taco/src/components/Table3/Table3.js.map +1 -1
  16. package/dist/esm/packages/taco/src/components/Table3/components/Row/Editing/CreateNewRow.js +2 -4
  17. package/dist/esm/packages/taco/src/components/Table3/components/Row/Editing/CreateNewRow.js.map +1 -1
  18. package/dist/esm/packages/taco/src/components/Table3/components/Row/Editing/TemporaryRow.js +3 -3
  19. package/dist/esm/packages/taco/src/components/Table3/components/Row/Editing/TemporaryRow.js.map +1 -1
  20. package/dist/esm/packages/taco/src/components/Table3/util/editing.js +9 -1
  21. package/dist/esm/packages/taco/src/components/Table3/util/editing.js.map +1 -1
  22. package/dist/esm/packages/taco/src/components/Tag/Tag.js +6 -4
  23. package/dist/esm/packages/taco/src/components/Tag/Tag.js.map +1 -1
  24. package/dist/esm/packages/taco/src/primitives/Table/Core/Table.js +2 -1
  25. package/dist/esm/packages/taco/src/primitives/Table/Core/Table.js.map +1 -1
  26. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Columns/Internal/Expansion.js +4 -0
  27. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Columns/Internal/Expansion.js.map +1 -1
  28. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Footer/Footer.js +7 -2
  29. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Footer/Footer.js.map +1 -1
  30. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Toolbar/components/Filters/FilterContext.js +6 -0
  31. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Toolbar/components/Filters/FilterContext.js.map +1 -0
  32. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Toolbar/components/Filters/ManageFiltersPopover.js +5 -3
  33. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Toolbar/components/Filters/ManageFiltersPopover.js.map +1 -1
  34. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Toolbar/components/Filters/components/Filter.js +0 -2
  35. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Toolbar/components/Filters/components/Filter.js.map +1 -1
  36. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Toolbar/components/Filters/components/FilterColumn.js +2 -1
  37. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Toolbar/components/Filters/components/FilterColumn.js.map +1 -1
  38. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Toolbar/components/Filters/components/FilterValue.js +3 -1
  39. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Toolbar/components/Filters/components/FilterValue.js.map +1 -1
  40. package/dist/esm/packages/taco/src/primitives/Table/types.js.map +1 -1
  41. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/features/useTableRowExpansion.js +2 -1
  42. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/features/useTableRowExpansion.js.map +1 -1
  43. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/useTableManager.js +1 -1
  44. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/useTableManager.js.map +1 -1
  45. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/util/presets.js +7 -1
  46. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/util/presets.js.map +1 -1
  47. package/dist/index.css +13 -4
  48. package/dist/primitives/Table/Core/Table.d.ts +1 -0
  49. package/dist/primitives/Table/Core/components/Toolbar/components/Filters/FilterContext.d.ts +3 -0
  50. package/dist/primitives/Table/Core/components/Toolbar/components/Filters/components/Filter.d.ts +0 -1
  51. package/dist/primitives/Table/Core/components/Toolbar/components/Filters/components/FilterColumn.d.ts +0 -3
  52. package/dist/primitives/Table/types.d.ts +2 -1
  53. package/dist/primitives/Table/useTableManager/features/useTableRowExpansion.d.ts +2 -1
  54. package/dist/taco.cjs.development.js +137 -61
  55. package/dist/taco.cjs.development.js.map +1 -1
  56. package/dist/taco.cjs.production.min.js +1 -1
  57. package/dist/taco.cjs.production.min.js.map +1 -1
  58. package/package.json +2 -3
@@ -1 +1 @@
1
- {"version":3,"file":"Trigger.js","sources":["../../../../../../../../src/components/Select2/components/Trigger.tsx"],"sourcesContent":["import React from 'react';\nimport cn from 'clsx';\nimport { Tag } from '../../Tag/Tag';\nimport { Tooltip } from '../../Tooltip/Tooltip';\nimport { Icon } from '../../Icon/Icon';\nimport { Badge } from '../../Badge/Badge';\nimport { getInputClasses } from '../../Input/util';\nimport { Select2OptionValue } from '../types';\nimport { useSelect2Context } from './Context';\nimport { Select2OptionProps } from './Option';\nimport { getIndexOfFirstChildOverflowingParent, isElementInsideOrTriggeredFromContainer } from '../../../utils/dom';\nimport { ScrollArea } from '../../ScrollArea/ScrollArea';\nimport { useMergedRef } from '../../../hooks/useMergedRef';\nimport { getFontSize } from '../utilities';\n\ntype Select2TriggerProps = Omit<React.HTMLAttributes<HTMLButtonElement>, 'children' | 'defaultValue' | 'onChange' | 'value'> & {\n emptyValue?: Select2OptionValue;\n placeholder?: string;\n children: React.ReactElement<Select2OptionProps>[];\n};\n\nconst Placeholder = ({ disabled, readOnly, ...props }) => {\n if (readOnly) {\n return null;\n }\n return <div {...props} className={cn({ 'text-grey-700': disabled, 'text-grey-500': !disabled })} />;\n};\n\nexport const Trigger = React.forwardRef<HTMLButtonElement, Select2TriggerProps>(function Select2Trigger(props, ref) {\n const { multiple, value } = useSelect2Context();\n\n if (Array.isArray(value) || multiple) {\n const values = Array.isArray(value) ? value : value !== undefined ? [value] : undefined;\n return <Multiple {...props} ref={ref} values={values} />;\n }\n\n return <Single {...props} ref={ref} value={value} />;\n});\n\ntype ButtonProps = React.HTMLAttributes<HTMLButtonElement> &\n Omit<Select2TriggerProps, 'children' | 'open' | 'setValue' | 'value'>;\n\nconst Button = React.forwardRef<HTMLButtonElement, ButtonProps>(function Select2TriggerButton(props, ref) {\n const { children, onBlur, onClick, onFocus, tabIndex = 0, ...otherProps } = props;\n const { disabled, fontSize, highlighted, invalid, open, readOnly } = useSelect2Context();\n\n const className = cn(\n 'px-1.5 h-fit',\n getInputClasses({ ...props, disabled, highlighted, invalid, readOnly })\n .replace('w-full', '')\n .replace('px-2', ''),\n getFontSize(fontSize),\n {\n 'select-text': readOnly,\n 'w-full': !props.className?.includes('w-'),\n },\n props.className\n );\n\n const handleClick = (event: React.MouseEvent<HTMLButtonElement>) => {\n if (disabled || readOnly) {\n event.preventDefault();\n return;\n }\n\n if (typeof onClick === 'function') {\n onClick(event);\n }\n };\n\n let handleBlur;\n\n if (typeof onBlur === 'function') {\n // we might be focusing on an input or something inside the dropdown that was triggered by the select\n // so see if the element gaining focus is inside a portal and look up its controller\n // if we don't do this, things like validate on blur occur while simply opening the select\n handleBlur = (event: React.FocusEvent<HTMLButtonElement>) => {\n if (isElementInsideOrTriggeredFromContainer(event.relatedTarget, event.currentTarget)) {\n return;\n }\n\n onBlur(event);\n };\n }\n\n // select the value text if the select is readonly\n const handleFocus = (event: React.FocusEvent<HTMLButtonElement>) => {\n if (readOnly) {\n const value = event.currentTarget.querySelector(':first-child');\n\n if (value) {\n window.getSelection()?.selectAllChildren?.(value);\n }\n }\n\n if (typeof onFocus === 'function') {\n onFocus(event);\n }\n };\n\n return (\n <button\n {...otherProps}\n aria-invalid={invalid ? true : undefined}\n aria-readonly={readOnly ? true : undefined}\n className={className}\n disabled={disabled}\n onClick={handleClick}\n onBlur={handleBlur}\n onFocus={handleFocus}\n ref={ref}\n role=\"combobox\"\n tabIndex={disabled ? -1 : tabIndex}\n type=\"button\">\n {children}\n {readOnly ? null : <Icon name={open ? 'chevron-up' : 'chevron-down'} className=\"pointer-events-none -mr-1 ml-auto\" />}\n </button>\n );\n});\n\ntype SingleProps = Omit<Select2TriggerProps, 'value'> & { value?: Select2OptionValue; placeholder?: string };\n\nconst Single = React.forwardRef<HTMLButtonElement, SingleProps>(function Select2TriggerSingle(props, ref) {\n const { children, emptyValue, value, placeholder, ...buttonProps } = props;\n const { disabled, readOnly, tags } = useSelect2Context();\n const contentClassName = cn('truncate items-center gap-1');\n\n const currentValue = children.find(matchesValue(value));\n\n let output;\n\n if (placeholder && currentValue === undefined) {\n output = (\n <Placeholder disabled={disabled} readOnly={readOnly}>\n {placeholder}\n </Placeholder>\n );\n } else if (currentValue) {\n if (tags && emptyValue !== value) {\n output = (\n <Tag\n className=\"truncate\"\n color={currentValue.props.color}\n disabled={disabled}\n icon={currentValue.props.prefix}\n readOnly={readOnly}>\n {currentValue.props.children}\n </Tag>\n );\n } else {\n output = (\n <>\n {currentValue.props.prefix ? (\n typeof currentValue.props.prefix === 'string' ? (\n <Icon name={currentValue.props.prefix} className=\"mr-1 !h-5 !w-5\" />\n ) : (\n currentValue.props.prefix\n )\n ) : null}\n {currentValue.props.children}\n </>\n );\n }\n }\n\n return (\n <Button {...buttonProps} ref={ref}>\n <div className={contentClassName}>{output}</div>\n </Button>\n );\n});\n\ntype MultipleProps = Omit<Select2TriggerProps, 'value'> & {\n values?: Select2OptionValue[];\n};\n\nconst Multiple = React.forwardRef<HTMLButtonElement, MultipleProps>(function Select2TriggerMultiple(props, ref) {\n const { children, emptyValue: _, values = [], placeholder, ...buttonProps } = props;\n const { disabled, open, readOnly, setValue, tags } = useSelect2Context();\n const buttonRef = useMergedRef<HTMLButtonElement>(ref);\n\n const valuesAsChildren = values\n .map(value => children.find(c => c.props.value === value))\n .filter(c => !!c) as React.ReactElement<Select2OptionProps>[];\n\n const forwardClick = event => {\n event.preventDefault();\n buttonRef.current?.click();\n };\n\n let content;\n let { className } = buttonProps;\n\n if (open) {\n className = cn('!absolute z-20 !h-fit', buttonProps.className);\n content = (\n <ScrollArea className=\"my-1 flex max-h-[5.5rem] flex-col\" onClick={forwardClick}>\n <div className=\"flex flex-wrap gap-1\">\n {valuesAsChildren.length === 0 ? (\n <Placeholder disabled={disabled} readOnly={readOnly}>\n {placeholder}\n </Placeholder>\n ) : (\n valuesAsChildren.map(child => (\n <Tag\n key={String(child.props.value)}\n className=\"truncate\"\n color={tags ? child.props.color : undefined}\n disabled={disabled}\n icon={child.props.prefix}\n onDelete={event => {\n event?.stopPropagation();\n event?.preventDefault();\n\n if (!disabled && !readOnly) {\n setValue(child.props.value);\n }\n }}\n readOnly={readOnly}>\n {child.props.children}\n </Tag>\n ))\n )}\n </div>\n </ScrollArea>\n );\n } else {\n content = <MultipleValue onClick={forwardClick} valuesAsChildren={valuesAsChildren} placeholder={placeholder} />;\n }\n\n return (\n <div\n className=\"relative inline-flex h-fit flex-grow\"\n data-taco=\"select2-container\"\n style={{ width: open ? buttonRef.current?.offsetWidth : undefined }}>\n <Button {...buttonProps} className={className} ref={buttonRef}>\n {content}\n </Button>\n </div>\n );\n});\n\ntype MultipleValueProps = Omit<Select2TriggerProps, 'value' | 'children'> & {\n valuesAsChildren: React.ReactElement<Select2OptionProps>[];\n placeholder?: string;\n onClick?: (event: any) => void;\n};\n\nconst MultipleValue = ({ onClick, valuesAsChildren, placeholder }: MultipleValueProps) => {\n const { disabled, readOnly, tags } = useSelect2Context();\n const [contentRef, setContentRef] = React.useState<HTMLDivElement | null>(null);\n const boundaryIndex = contentRef ? getIndexOfFirstChildOverflowingParent(contentRef, 30) : undefined;\n\n return (\n <div className=\"relative flex w-full items-center gap-1 overflow-hidden\" onClick={onClick}>\n <div className=\"flex flex-1 gap-1 truncate\" ref={ref => setContentRef(ref)}>\n {valuesAsChildren.length === 0 ? (\n <Placeholder disabled={disabled} readOnly={readOnly}>\n {placeholder}\n </Placeholder>\n ) : (\n valuesAsChildren.map((child, index) => {\n const tag = (\n <Tag\n key={String(child.props.value)}\n className={cn('cursor-pointer', {\n truncate: index === boundaryIndex,\n hidden: boundaryIndex !== undefined && boundaryIndex !== null ? index > boundaryIndex : false,\n })}\n color={tags ? child.props.color : undefined}\n disabled={disabled}\n icon={child.props.prefix}\n readOnly={readOnly}>\n {child.props.children}\n </Tag>\n );\n\n if (index === boundaryIndex) {\n return (\n <Tooltip key={String(child.props.value)} title={String(child.props.children)}>\n {tag}\n </Tooltip>\n );\n }\n\n return tag;\n })\n )}\n </div>\n {boundaryIndex !== undefined && boundaryIndex !== null && boundaryIndex < valuesAsChildren.length - 1 ? (\n <Tooltip\n title={valuesAsChildren\n .slice(boundaryIndex + 1)\n .map(child => (child ? String(child.props.children) : ''))\n .join(', ')}>\n <Badge className=\"flex-shrink-0\">+{valuesAsChildren.length - (boundaryIndex + 1)}</Badge>\n </Tooltip>\n ) : null}\n </div>\n );\n};\n\nconst matchesValue = (value: undefined | any | any[]) => (child: React.ReactElement<any>) => {\n if (Array.isArray(value)) {\n return value.includes(child.props.value);\n }\n\n return child.props.value === value;\n};\n"],"names":["Placeholder","disabled","readOnly","props","React","className","cn","Trigger","forwardRef","Select2Trigger","ref","multiple","value","useSelect2Context","Array","isArray","values","undefined","Multiple","Single","Button","Select2TriggerButton","children","onBlur","onClick","onFocus","tabIndex","otherProps","fontSize","highlighted","invalid","open","getInputClasses","replace","getFontSize","_props$className","includes","handleClick","event","preventDefault","handleBlur","isElementInsideOrTriggeredFromContainer","relatedTarget","currentTarget","handleFocus","querySelector","_window$getSelection","_window$getSelection$","window","getSelection","selectAllChildren","call","role","type","Icon","name","Select2TriggerSingle","emptyValue","placeholder","buttonProps","tags","contentClassName","currentValue","find","matchesValue","output","Tag","color","icon","prefix","Select2TriggerMultiple","_","setValue","buttonRef","useMergedRef","valuesAsChildren","map","c","filter","forwardClick","_buttonRef$current","current","click","content","ScrollArea","length","child","key","String","onDelete","stopPropagation","MultipleValue","style","width","_buttonRef$current2","offsetWidth","contentRef","setContentRef","useState","boundaryIndex","getIndexOfFirstChildOverflowingParent","index","tag","truncate","hidden","Tooltip","title","slice","join","Badge"],"mappings":";;;;;;;;;;;;;AAqBA,MAAMA,WAAW,GAAGA,CAAC;EAAEC,QAAQ;EAAEC,QAAQ;EAAE,GAAGC;CAAO;EACjD,IAAID,QAAQ,EAAE;IACV,OAAO,IAAI;;EAEf,oBAAOE,sDAASD,KAAK;IAAEE,SAAS,EAAEC,EAAE,CAAC;MAAE,eAAe,EAAEL,QAAQ;MAAE,eAAe,EAAE,CAACA;KAAU;KAAK;AACvG,CAAC;MAEYM,OAAO,gBAAGH,cAAK,CAACI,UAAU,CAAyC,SAASC,cAAcA,CAACN,KAAK,EAAEO,GAAG;EAC9G,MAAM;IAAEC,QAAQ;IAAEC;GAAO,GAAGC,iBAAiB,EAAE;EAE/C,IAAIC,KAAK,CAACC,OAAO,CAACH,KAAK,CAAC,IAAID,QAAQ,EAAE;IAClC,MAAMK,MAAM,GAAGF,KAAK,CAACC,OAAO,CAACH,KAAK,CAAC,GAAGA,KAAK,GAAGA,KAAK,KAAKK,SAAS,GAAG,CAACL,KAAK,CAAC,GAAGK,SAAS;IACvF,oBAAOb,6BAACc,QAAQ,oBAAKf,KAAK;MAAEO,GAAG,EAAEA,GAAG;MAAEM,MAAM,EAAEA;OAAU;;EAG5D,oBAAOZ,6BAACe,MAAM,oBAAKhB,KAAK;IAAEO,GAAG,EAAEA,GAAG;IAAEE,KAAK,EAAEA;KAAS;AACxD,CAAC;AAKD,MAAMQ,MAAM,gBAAGhB,cAAK,CAACI,UAAU,CAAiC,SAASa,oBAAoBA,CAAClB,KAAK,EAAE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AAK,CAAC;QAAE8F,KAAK,EAAElB,MAAM,CAACF,KAAK,CAACnF,KAAK,CAACmB,QAAQ;SACtEgF,GAAG,CACE;;IAIlB,OAAOA,GAAG;GACb,CACJ,CACC,EACLH,aAAa,KAAKlF,SAAS,IAAIkF,aAAa,KAAK,IAAI,IAAIA,aAAa,GAAGxB,gBAAgB,CAACU,MAAM,GAAG,CAAC,iBACjGjF,6BAACqG,OAAO;IACJC,KAAK,EAAE/B,gBAAgB,CAClBgC,KAAK,CAACR,aAAa,GAAG,CAAC,CAAC,CACxBvB,GAAG,CAACU,KAAK,IAAKA,KAAK,GAAGE,MAAM,CAACF,KAAK,CAACnF,KAAK,CAACmB,QAAQ,CAAC,GAAG,EAAG,CAAC,CACzDsF,IAAI,CAAC,IAAI;kBACdxG,6BAACyG,KAAK;IAACxG,SAAS,EAAC;UAAkBsE,gBAAgB,CAACU,MAAM,IAAIc,aAAa,GAAG,CAAC,CAAC,CAAS,CACnF,IACV,IAAI,CACN;AAEd,CAAC;AAED,MAAMnC,YAAY,GAAIpD,KAA8B,IAAM0E,KAA8B;EACpF,IAAIxE,KAAK,CAACC,OAAO,CAACH,KAAK,CAAC,EAAE;IACtB,OAAOA,KAAK,CAACwB,QAAQ,CAACkD,KAAK,CAACnF,KAAK,CAACS,KAAK,CAAC;;EAG5C,OAAO0E,KAAK,CAACnF,KAAK,CAACS,KAAK,KAAKA,KAAK;AACtC,CAAC;;;;"}
1
+ {"version":3,"file":"Trigger.js","sources":["../../../../../../../../src/components/Select2/components/Trigger.tsx"],"sourcesContent":["import React from 'react';\nimport cn from 'clsx';\nimport { Tag } from '../../Tag/Tag';\nimport { Tooltip } from '../../Tooltip/Tooltip';\nimport { Icon } from '../../Icon/Icon';\nimport { Badge, BadgeProps } from '../../Badge/Badge';\nimport { getInputClasses } from '../../Input/util';\nimport { Select2OptionValue } from '../types';\nimport { useSelect2Context } from './Context';\nimport { Select2OptionProps } from './Option';\nimport { getIndexOfFirstChildOverflowingParent, isElementInsideOrTriggeredFromContainer } from '../../../utils/dom';\nimport { ScrollArea } from '../../ScrollArea/ScrollArea';\nimport { useMergedRef } from '../../../hooks/useMergedRef';\nimport { getFontSize } from '../utilities';\n\ntype Select2TriggerProps = Omit<React.HTMLAttributes<HTMLButtonElement>, 'children' | 'defaultValue' | 'onChange' | 'value'> & {\n emptyValue?: Select2OptionValue;\n placeholder?: string;\n children: React.ReactElement<Select2OptionProps>[];\n};\n\nconst Placeholder = ({ disabled, readOnly, ...props }) => {\n if (readOnly) {\n return null;\n }\n return <div {...props} className={cn({ 'text-grey-700': disabled, 'text-grey-500': !disabled })} />;\n};\n\nexport const Trigger = React.forwardRef<HTMLButtonElement, Select2TriggerProps>(function Select2Trigger(props, ref) {\n const { multiple, value } = useSelect2Context();\n\n if (Array.isArray(value) || multiple) {\n const values = Array.isArray(value) ? value : value !== undefined ? [value] : undefined;\n return <Multiple {...props} ref={ref} values={values} />;\n }\n\n return <Single {...props} ref={ref} value={value} />;\n});\n\ntype ButtonProps = React.HTMLAttributes<HTMLButtonElement> &\n Omit<Select2TriggerProps, 'children' | 'open' | 'setValue' | 'value'>;\n\nconst Button = React.forwardRef<HTMLButtonElement, ButtonProps>(function Select2TriggerButton(props, ref) {\n const { children, onBlur, onClick, onFocus, tabIndex = 0, ...otherProps } = props;\n const { disabled, fontSize, highlighted, invalid, open, readOnly } = useSelect2Context();\n\n const className = cn(\n 'px-1.5 h-fit',\n getInputClasses({ ...props, disabled, highlighted, invalid, readOnly })\n .replace('w-full', '')\n .replace('px-2', ''),\n getFontSize(fontSize),\n {\n 'select-text': readOnly,\n 'w-full': !props.className?.includes('w-'),\n },\n props.className\n );\n\n const handleClick = (event: React.MouseEvent<HTMLButtonElement>) => {\n if (disabled || readOnly) {\n event.preventDefault();\n return;\n }\n\n if (typeof onClick === 'function') {\n onClick(event);\n }\n };\n\n let handleBlur;\n\n if (typeof onBlur === 'function') {\n // we might be focusing on an input or something inside the dropdown that was triggered by the select\n // so see if the element gaining focus is inside a portal and look up its controller\n // if we don't do this, things like validate on blur occur while simply opening the select\n handleBlur = (event: React.FocusEvent<HTMLButtonElement>) => {\n if (isElementInsideOrTriggeredFromContainer(event.relatedTarget, event.currentTarget)) {\n return;\n }\n\n onBlur(event);\n };\n }\n\n // select the value text if the select is readonly\n const handleFocus = (event: React.FocusEvent<HTMLButtonElement>) => {\n if (readOnly) {\n const value = event.currentTarget.querySelector(':first-child');\n\n if (value) {\n window.getSelection()?.selectAllChildren?.(value);\n }\n }\n\n if (typeof onFocus === 'function') {\n onFocus(event);\n }\n };\n\n return (\n <button\n {...otherProps}\n aria-invalid={invalid ? true : undefined}\n aria-readonly={readOnly ? true : undefined}\n className={className}\n disabled={disabled}\n onClick={handleClick}\n onBlur={handleBlur}\n onFocus={handleFocus}\n ref={ref}\n role=\"combobox\"\n tabIndex={disabled ? -1 : tabIndex}\n type=\"button\">\n {children}\n {readOnly ? null : <Icon name={open ? 'chevron-up' : 'chevron-down'} className=\"pointer-events-none -mr-1 ml-auto\" />}\n </button>\n );\n});\n\ntype SingleProps = Omit<Select2TriggerProps, 'value'> & { value?: Select2OptionValue; placeholder?: string };\n\nconst Single = React.forwardRef<HTMLButtonElement, SingleProps>(function Select2TriggerSingle(props, ref) {\n const { children, emptyValue, value, placeholder, ...buttonProps } = props;\n const { disabled, readOnly, tags } = useSelect2Context();\n const contentClassName = cn('truncate flex items-center gap-1');\n\n const currentValue = children.find(matchesValue(value));\n\n let output;\n\n if (placeholder && currentValue === undefined) {\n output = (\n <Placeholder disabled={disabled} readOnly={readOnly}>\n {placeholder}\n </Placeholder>\n );\n } else if (currentValue) {\n if (tags && emptyValue !== value) {\n if (typeof currentValue.props.children === 'string')\n output = (\n <Tag\n className=\"truncate\"\n color={currentValue.props.color}\n disabled={disabled}\n icon={currentValue.props.prefix}\n readOnly={readOnly}>\n {currentValue.props.children}\n </Tag>\n );\n else output = currentValue.props.children;\n } else {\n output = (\n <>\n {currentValue.props.prefix ? (\n typeof currentValue.props.prefix === 'string' ? (\n <Icon name={currentValue.props.prefix} className=\"mr-1 !h-5 !w-5\" />\n ) : (\n currentValue.props.prefix\n )\n ) : null}\n {currentValue.props.children}\n </>\n );\n }\n }\n\n return (\n <Button {...buttonProps} ref={ref}>\n <div className={contentClassName}>{output}</div>\n </Button>\n );\n});\n\ntype MultipleProps = Omit<Select2TriggerProps, 'value'> & {\n values?: Select2OptionValue[];\n};\n\nconst Multiple = React.forwardRef<HTMLButtonElement, MultipleProps>(function Select2TriggerMultiple(props, ref) {\n const { children, emptyValue: _, values = [], placeholder, ...buttonProps } = props;\n const { disabled, open, readOnly, setValue, tags } = useSelect2Context();\n const buttonRef = useMergedRef<HTMLButtonElement>(ref);\n\n const valuesAsChildren = values\n .map(value => children.find(c => c.props.value === value))\n .filter(c => !!c) as React.ReactElement<Select2OptionProps>[];\n\n const forwardClick = event => {\n event.preventDefault();\n buttonRef.current?.click();\n };\n\n let content;\n let { className } = buttonProps;\n\n if (open) {\n className = cn('!absolute z-20 !h-fit', buttonProps.className);\n content = (\n <ScrollArea className=\"my-1 flex max-h-[5.5rem] flex-col\" onClick={forwardClick}>\n <div className=\"flex flex-wrap gap-1\">\n {valuesAsChildren.length === 0 ? (\n <Placeholder disabled={disabled} readOnly={readOnly}>\n {placeholder}\n </Placeholder>\n ) : (\n valuesAsChildren.map(child =>\n typeof child.props.children === 'string' ? (\n <Tag\n key={String(child.props.value)}\n className=\"truncate\"\n color={tags ? child.props.color : undefined}\n disabled={disabled}\n icon={child.props.prefix}\n onDelete={event => {\n event?.stopPropagation();\n event?.preventDefault();\n\n if (!disabled && !readOnly) {\n setValue(child.props.value);\n }\n }}\n readOnly={readOnly}>\n {child.props.children}\n </Tag>\n ) : (\n React.cloneElement(\n child.props.children as React.ReactElement<\n typeof Badge & {\n children: BadgeProps['children'];\n className: BadgeProps['className'];\n }\n >,\n {\n key: String(child.props.value),\n className: '!pr-0 !pl-1.5',\n children: (\n <span className=\"flex items-center\">\n {(child.props.children as React.ReactElement).props.children}\n <Icon\n name=\"close\"\n onClick={event => {\n event?.stopPropagation();\n event?.preventDefault();\n\n if (!disabled && !readOnly) {\n setValue(child.props.value);\n }\n }}\n className=\"ml-0.5 !h-5 !w-5 shrink-0 cursor-pointer rounded-r p-0.5 hover:bg-black/5\"\n />\n </span>\n ),\n }\n )\n )\n )\n )}\n </div>\n </ScrollArea>\n );\n } else {\n content = <MultipleValue onClick={forwardClick} valuesAsChildren={valuesAsChildren} placeholder={placeholder} />;\n }\n\n return (\n <div\n className=\"relative inline-flex h-fit flex-grow\"\n data-taco=\"select2-container\"\n style={{ width: open ? buttonRef.current?.offsetWidth : undefined }}>\n <Button {...buttonProps} className={className} ref={buttonRef}>\n {content}\n </Button>\n </div>\n );\n});\n\ntype MultipleValueProps = Omit<Select2TriggerProps, 'value' | 'children'> & {\n valuesAsChildren: React.ReactElement<Select2OptionProps>[];\n placeholder?: string;\n onClick?: (event: any) => void;\n};\n\nconst MultipleValue = ({ onClick, valuesAsChildren, placeholder }: MultipleValueProps) => {\n const { disabled, readOnly, tags } = useSelect2Context();\n const [contentRef, setContentRef] = React.useState<HTMLDivElement | null>(null);\n const boundaryIndex = contentRef ? getIndexOfFirstChildOverflowingParent(contentRef, 30) : undefined;\n\n // Retrieves the relevant text content from any JSX.Element passed as a select option, handling nested elements, arrays, and direct text\n const getTooltipTitle = (child: React.ReactElement): string | string[] => {\n const children = child.props.children;\n\n if (typeof children === 'string') return children;\n if (typeof children.props.children === 'string') {\n return children.props.children;\n }\n\n if (Array.isArray(children.props.children)) {\n return children.props.children.filter(item => typeof item === 'string');\n }\n\n return '';\n };\n\n return (\n <div className=\"relative flex w-full items-center gap-1 overflow-hidden\" onClick={onClick}>\n <div className=\"flex flex-1 gap-1 truncate\" ref={ref => setContentRef(ref)}>\n {valuesAsChildren.length === 0 ? (\n <Placeholder disabled={disabled} readOnly={readOnly}>\n {placeholder}\n </Placeholder>\n ) : (\n valuesAsChildren.map((child, index) => {\n const classNames = {\n truncate: index === boundaryIndex,\n hidden: boundaryIndex !== undefined && boundaryIndex !== null ? index > boundaryIndex : false,\n };\n let output;\n if (typeof child.props.children === 'string') {\n output = (\n <Tag\n key={String(child.props.value)}\n className={cn('cursor-pointer', classNames)}\n color={tags ? child.props.color : undefined}\n disabled={disabled}\n icon={child.props.prefix}\n readOnly={readOnly}>\n {child.props.children}\n </Tag>\n );\n } else\n output = React.cloneElement(\n child.props.children as React.ReactElement<\n typeof Badge & {\n className: BadgeProps['className'];\n }\n >,\n {\n className: cn('cursor-pointer', { 'shrink-0': index !== boundaryIndex }, classNames),\n key: String(child.props.value),\n }\n );\n\n if (index === boundaryIndex) {\n return (\n <Tooltip key={String(child.props.value)} title={String(getTooltipTitle(child))}>\n {output}\n </Tooltip>\n );\n }\n\n return output;\n })\n )}\n </div>\n\n {boundaryIndex !== undefined && boundaryIndex !== null && boundaryIndex < valuesAsChildren.length - 1 ? (\n <Tooltip\n title={valuesAsChildren\n .slice(boundaryIndex + 1)\n .map(child => (child ? String(getTooltipTitle(child)) : ''))\n .join(', ')}>\n <Badge className=\"flex-shrink-0\">+{valuesAsChildren.length - (boundaryIndex + 1)}</Badge>\n </Tooltip>\n ) : null}\n </div>\n );\n};\n\nconst matchesValue = (value: undefined | any | any[]) => (child: React.ReactElement<any>) => {\n if (Array.isArray(value)) {\n return value.includes(child.props.value);\n }\n\n return child.props.value === value;\n};\n"],"names":["Placeholder","disabled","readOnly","props","React","className","cn","Trigger","forwardRef","Select2Trigger","ref","multiple","value","useSelect2Context","Array","isArray","values","undefined","Multiple","Single","Button","Select2TriggerButton","children","onBlur","onClick","onFocus","tabIndex","otherProps","fontSize","highlighted","invalid","open","getInputClasses","replace","getFontSize","_props$className","includes","handleClick","event","preventDefault","handleBlur","isElementInsideOrTriggeredFromContainer","relatedTarget","currentTarget","handleFocus","querySelector","_window$getSelection","_window$getSelection$","window","getSelection","selectAllChildren","call","role","type","Icon","name","Select2TriggerSingle","emptyValue","placeholder","buttonProps","tags","contentClassName","currentValue","find","matchesValue","output","Tag","color","icon","prefix","Select2TriggerMultiple","_","setValue","buttonRef","useMergedRef","valuesAsChildren","map","c","filter","forwardClick","_buttonRef$current","current","click","content","ScrollArea","length","child","key","String","onDelete","stopPropagation","cloneElement","MultipleValue","style","width","_buttonRef$current2","offsetWidth","contentRef","setContentRef","useState","boundaryIndex","getIndexOfFirstChildOverflowingParent","getTooltipTitle","item","index","classNames","truncate","hidden","Tooltip","title","slice","join","Badge"],"mappings":";;;;;;;;;;;;;AAqBA,MAAMA,WAAW,GAAGA,CAAC;EAAEC,QAAQ;EAAEC,QAAQ;EAAE,GAAGC;CAAO;EACjD,IAAID,QAAQ,EAAE;IACV,OAAO,IAAI;;EAEf,oBAAOE,sDAASD,KAAK;IAAEE,SAAS,EAAEC,EAAE,CAAC;MAAE,eAAe,EAAEL,QAAQ;MAAE,eAAe,EAAE,CAACA;KAAU;KAAK;AACvG,CAAC;MAEYM,OAAO,gBAAGH,cAAK,CAACI,UAAU,CAAyC,SAASC,cAAcA,CAACN,KAAK,EAAEO,GAAG;EAC9G,MAAM;IAAEC,QAAQ;IAAEC;GAAO,GAAGC,iBAAiB,EAAE;EAE/C,IAAIC,KAAK,CAACC,OAAO,CAACH,KAAK,CAAC,IAAID,QAAQ,EAAE;IAClC,MAAMK,MAAM,GAAGF,KAAK,CAACC,OAAO,CAACH,KAAK,CAAC,GAAGA,KAAK,GAAGA,KAAK,KAAKK,SAAS,GAAG,CAACL,KAAK,CAAC,GAAGK,SAAS;IACvF,oBAAOb,6BAACc,QAAQ,oBAAKf,KAAK;MAAEO,GAAG,EAAEA,GAAG;MAAEM,MAAM,EAAEA;OAAU;;EAG5D,oBAAOZ,6BAACe,MAAM,oBAAKhB,KAAK;IAAEO,GAAG,EAAEA,GAAG;IAAEE,KAAK,EAAEA;KAAS;AACxD,CAAC;AAKD,MAAMQ,MAAM,gBAAGhB,cAAK,CAACI,UAAU,CAAiC,SAASa,oBAAoBA,CAAClB,KAAK,EAAEO,GA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,CAACwB,QAAQ,CAACkD,KAAK,CAACnF,KAAK,CAACS,KAAK,CAAC;;EAG5C,OAAO0E,KAAK,CAACnF,KAAK,CAACS,KAAK,KAAKA,KAAK;AACtC,CAAC;;;;"}
@@ -1,6 +1,7 @@
1
1
  import React__default from 'react';
2
2
  import { fixedForwardRef } from '../../types.js';
3
3
  import { Table } from '../../primitives/Table/Core/Table.js';
4
+ import { isTableScrolled } from './util/editing.js';
4
5
  import { useTable3 } from './useTable3.js';
5
6
  import { Alert } from './components/Editing/Alert.js';
6
7
  import { Editing } from './components/Toolbar/Editing/Editing.js';
@@ -24,6 +25,17 @@ const BaseTable3 = /*#__PURE__*/fixedForwardRef(function BaseTable3(props, ref)
24
25
  };
25
26
  const hasAlertErrors = table3.meta.editing.getErrorsShownInAlert().length;
26
27
  const hasCreateWorkflow = table3.meta.editing.isEnabled && props.onEditingCreate;
28
+ const isScrolled = isTableScrolled(table3.ref);
29
+ let createWorkflow;
30
+ if (hasCreateWorkflow) {
31
+ createWorkflow = /*#__PURE__*/React__default.createElement(CreateNewRow, {
32
+ buttonRef: table3.meta.editing.createRowButtonRef,
33
+ isScrolled: isScrolled,
34
+ scrollToIndex: table3.renderer.scrollToIndex,
35
+ table: table3.instance,
36
+ tableMeta: table3.meta
37
+ });
38
+ }
27
39
  return /*#__PURE__*/React__default.createElement(Table, null, /*#__PURE__*/React__default.createElement(Table.Toolbar, {
28
40
  table: table3
29
41
  }, table3.meta.editing.isEnabled ? (/*#__PURE__*/React__default.createElement(Editing, {
@@ -36,19 +48,15 @@ const BaseTable3 = /*#__PURE__*/fixedForwardRef(function BaseTable3(props, ref)
36
48
  tableRef: table3.ref
37
49
  })) : null, /*#__PURE__*/React__default.createElement(Table.Grid, Object.assign({}, gridAttributes, {
38
50
  "data-taco": "table3",
51
+ footerRows: hasCreateWorkflow && isScrolled ? createWorkflow : undefined,
39
52
  table: table3
40
53
  }), hasCreateWorkflow ? (/*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(TemporaryRow, {
41
54
  createRowButtonRef: table3.meta.editing.createRowButtonRef,
55
+ isScrolled: isScrolled,
42
56
  table: table3.instance,
43
57
  tableMeta: table3.meta,
44
58
  tableRef: table3.ref
45
- }), /*#__PURE__*/React__default.createElement(CreateNewRow, {
46
- buttonRef: table3.meta.editing.createRowButtonRef,
47
- scrollToIndex: table3.renderer.scrollToIndex,
48
- table: table3.instance,
49
- tableMeta: table3.meta,
50
- tableRef: table3.ref
51
- }))) : null));
59
+ }), !isScrolled ? createWorkflow : null)) : null));
52
60
  });
53
61
  const Table3 = /*#__PURE__*/fixedForwardRef(function Table3(props, ref) {
54
62
  const stringifiedChildren = String(props.children);
@@ -1 +1 @@
1
- {"version":3,"file":"Table3.js","sources":["../../../../../../../src/components/Table3/Table3.tsx"],"sourcesContent":["import React from 'react';\nimport { fixedForwardRef } from '../../types';\nimport { useTable3 } from './useTable3';\nimport { Table } from '../../primitives/Table/Core/Table';\nimport { Alert } from './components/Editing/Alert';\nimport { Table3Props, Table3Ref, Table3ColumnProps, Table3GroupProps } from './types';\nimport { Editing } from './components/Toolbar/Editing/Editing';\nimport { CreateNewRow } from './components/Row/Editing/CreateNewRow';\nimport { TemporaryRow } from './components/Row/Editing/TemporaryRow';\nimport './style.css';\n\nfunction Column<TType = unknown>(_: Table3ColumnProps<TType>) {\n return null;\n}\nColumn.displayName = 'Table3Column';\n\nfunction Group(_: Table3GroupProps) {\n return null;\n}\nGroup.displayName = 'Table3Group';\n\nconst BaseTable3 = fixedForwardRef(function BaseTable3<TType = unknown>(props: Table3Props<TType>, ref: React.Ref<Table3Ref>) {\n const table3 = useTable3<TType>(props, ref);\n\n const gridAttributes = {\n 'data-table-editing-mode': table3.meta.editing?.isEditing\n ? table3.meta.editing?.isDetailedMode\n ? 'detailed'\n : 'normal'\n : undefined,\n enableHorizontalArrowKeyNavigation: table3.meta.editing.isEditing,\n };\n\n const hasAlertErrors = table3.meta.editing.getErrorsShownInAlert().length;\n const hasCreateWorkflow = table3.meta.editing.isEnabled && props.onEditingCreate;\n\n return (\n <Table>\n <Table.Toolbar<TType> table={table3}>\n {table3.meta.editing.isEnabled ? (\n <Editing scrollToIndex={table3.renderer.scrollToIndex} table={table3.instance} />\n ) : null}\n </Table.Toolbar>\n {hasAlertErrors ? (\n <Alert\n className=\"mb-4\"\n scrollToIndex={table3.renderer.scrollToIndex}\n table={table3.instance}\n tableRef={table3.ref}\n />\n ) : null}\n <Table.Grid<TType> {...gridAttributes} data-taco=\"table3\" table={table3}>\n {hasCreateWorkflow ? (\n <>\n <TemporaryRow\n createRowButtonRef={table3.meta.editing.createRowButtonRef}\n table={table3.instance}\n tableMeta={table3.meta}\n tableRef={table3.ref}\n />\n <CreateNewRow\n buttonRef={table3.meta.editing.createRowButtonRef}\n scrollToIndex={table3.renderer.scrollToIndex}\n table={table3.instance}\n tableMeta={table3.meta}\n tableRef={table3.ref}\n />\n </>\n ) : null}\n </Table.Grid>\n </Table>\n );\n});\n\nexport const Table3 = fixedForwardRef(function Table3<TType = unknown>(props: Table3Props<TType>, ref: React.Ref<Table3Ref>) {\n const stringifiedChildren = String(props.children);\n // we force a remount (using key) when the child columns change because there are too many places to add children as an effect\n // this is cheaper from a complexity perspective, and probably performance wise as well\n const key = React.useMemo(() => String('tableKey_' + stringifiedChildren), [stringifiedChildren]);\n return <BaseTable3<TType> {...props} key={key} ref={ref} />;\n}) as (<TType = unknown>(props: Table3Props<TType> & React.RefAttributes<Table3Ref>) => JSX.Element) & {\n Column: typeof Column;\n Group: typeof Group;\n};\nTable3.Column = Column;\nTable3.Group = Group;\n\nexport type {\n Table3Ref,\n Table3Props,\n Table3ColumnProps,\n Table3GroupProps,\n Table3EditingSaveHandler,\n Table3EditingValidatorFn,\n Table3Texts,\n Table3FeatureProps,\n Table3CommonProps,\n Table3WithoutEditingWithClientProps,\n Table3WithoutEditingWithServerProps,\n Table3WithEditingProps,\n Table3WithEditingWithClientProps,\n Table3WithEditingWithServerProps,\n Table3EditingChangeHandler,\n Table3EditingCreateHandler,\n} from './types';\n"],"names":["Column","_","displayName","Group","BaseTable3","fixedForwardRef","props","ref","table3","useTable3","gridAttributes","_table3$meta$editing","meta","editing","isEditing","_table3$meta$editing2","isDetailedMode","undefined","enableHorizontalArrowKeyNavigation","hasAlertErrors","getErrorsShownInAlert","length","hasCreateWorkflow","isEnabled","onEditingCreate","React","Table","Toolbar","table","Editing","scrollToIndex","renderer","instance","Alert","className","tableRef","Grid","TemporaryRow","createRowButtonRef","tableMeta","CreateNewRow","buttonRef","Table3","stringifiedChildren","String","children","key","useMemo"],"mappings":";;;;;;;;;AAWA,SAASA,MAAMA,CAAkBC,CAA2B;EACxD,OAAO,IAAI;AACf;AACAD,MAAM,CAACE,WAAW,GAAG,cAAc;AAEnC,SAASC,KAAKA,CAACF,CAAmB;EAC9B,OAAO,IAAI;AACf;AACAE,KAAK,CAACD,WAAW,GAAG,aAAa;AAEjC,MAAME,UAAU,gBAAGC,eAAe,CAAC,SAASD,UAAUA,CAAkBE,KAAyB,EAAEC,GAAyB;;EACxH,MAAMC,MAAM,GAAGC,SAAS,CAAQH,KAAK,EAAEC,GAAG,CAAC;EAE3C,MAAMG,cAAc,GAAG;IACnB,yBAAyB,EAAE,CAAAC,oBAAA,GAAAH,MAAM,CAACI,IAAI,CAACC,OAAO,cAAAF,oBAAA,eAAnBA,oBAAA,CAAqBG,SAAS,GACnD,CAAAC,qBAAA,GAAAP,MAAM,CAACI,IAAI,CAACC,OAAO,cAAAE,qBAAA,eAAnBA,qBAAA,CAAqBC,cAAc,GAC/B,UAAU,GACV,QAAQ,GACZC,SAAS;IACfC,kCAAkC,EAAEV,MAAM,CAACI,IAAI,CAACC,OAAO,CAACC;GAC3D;EAED,MAAMK,cAAc,GAAGX,MAAM,CAACI,IAAI,CAACC,OAAO,CAACO,qBAAqB,EAAE,CAACC,MAAM;EACzE,MAAMC,iBAAiB,GAAGd,MAAM,CAACI,IAAI,CAACC,OAAO,CAACU,SAAS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mBAAmB,GAAGC,MAAM,CAACtC,KAAK,CAACuC,QAAQ,CAAC;;;EAGlD,MAAMC,GAAG,GAAGrB,cAAK,CAACsB,OAAO,CAAC,MAAMH,MAAM,CAAC,WAAW,GAAGD,mBAAmB,CAAC,EAAE,CAACA,mBAAmB,CAAC,CAAC;EACjG,oBAAOlB,6BAACrB,UAAU,oBAAYE,KAAK;IAAEwC,GAAG,EAAEA,GAAG;IAAEvC,GAAG,EAAEA;KAAO;AAC/D,CAAC;AAIDmC,MAAM,CAAC1C,MAAM,GAAGA,MAAM;AACtB0C,MAAM,CAACvC,KAAK,GAAGA,KAAK;;;;"}
1
+ {"version":3,"file":"Table3.js","sources":["../../../../../../../src/components/Table3/Table3.tsx"],"sourcesContent":["import React from 'react';\nimport { fixedForwardRef } from '../../types';\nimport { useTable3 } from './useTable3';\nimport { Table } from '../../primitives/Table/Core/Table';\nimport { Alert } from './components/Editing/Alert';\nimport { Table3Props, Table3Ref, Table3ColumnProps, Table3GroupProps } from './types';\nimport { Editing } from './components/Toolbar/Editing/Editing';\nimport { CreateNewRow } from './components/Row/Editing/CreateNewRow';\nimport { TemporaryRow } from './components/Row/Editing/TemporaryRow';\nimport './style.css';\nimport { isTableScrolled } from './util/editing';\n\nfunction Column<TType = unknown>(_: Table3ColumnProps<TType>) {\n return null;\n}\nColumn.displayName = 'Table3Column';\n\nfunction Group(_: Table3GroupProps) {\n return null;\n}\nGroup.displayName = 'Table3Group';\n\nconst BaseTable3 = fixedForwardRef(function BaseTable3<TType = unknown>(props: Table3Props<TType>, ref: React.Ref<Table3Ref>) {\n const table3 = useTable3<TType>(props, ref);\n\n const gridAttributes = {\n 'data-table-editing-mode': table3.meta.editing?.isEditing\n ? table3.meta.editing?.isDetailedMode\n ? 'detailed'\n : 'normal'\n : undefined,\n enableHorizontalArrowKeyNavigation: table3.meta.editing.isEditing,\n };\n\n const hasAlertErrors = table3.meta.editing.getErrorsShownInAlert().length;\n const hasCreateWorkflow = table3.meta.editing.isEnabled && props.onEditingCreate;\n const isScrolled = isTableScrolled(table3.ref);\n\n let createWorkflow;\n\n if (hasCreateWorkflow) {\n createWorkflow = (\n <CreateNewRow\n buttonRef={table3.meta.editing.createRowButtonRef}\n isScrolled={isScrolled}\n scrollToIndex={table3.renderer.scrollToIndex}\n table={table3.instance}\n tableMeta={table3.meta}\n />\n );\n }\n\n return (\n <Table>\n <Table.Toolbar<TType> table={table3}>\n {table3.meta.editing.isEnabled ? (\n <Editing scrollToIndex={table3.renderer.scrollToIndex} table={table3.instance} />\n ) : null}\n </Table.Toolbar>\n {hasAlertErrors ? (\n <Alert\n className=\"mb-4\"\n scrollToIndex={table3.renderer.scrollToIndex}\n table={table3.instance}\n tableRef={table3.ref}\n />\n ) : null}\n <Table.Grid<TType>\n {...gridAttributes}\n data-taco=\"table3\"\n footerRows={hasCreateWorkflow && isScrolled ? createWorkflow : undefined}\n table={table3}>\n {hasCreateWorkflow ? (\n <>\n <TemporaryRow\n createRowButtonRef={table3.meta.editing.createRowButtonRef}\n isScrolled={isScrolled}\n table={table3.instance}\n tableMeta={table3.meta}\n tableRef={table3.ref}\n />\n {!isScrolled ? createWorkflow : null}\n </>\n ) : null}\n </Table.Grid>\n </Table>\n );\n});\n\nexport const Table3 = fixedForwardRef(function Table3<TType = unknown>(props: Table3Props<TType>, ref: React.Ref<Table3Ref>) {\n const stringifiedChildren = String(props.children);\n // we force a remount (using key) when the child columns change because there are too many places to add children as an effect\n // this is cheaper from a complexity perspective, and probably performance wise as well\n const key = React.useMemo(() => String('tableKey_' + stringifiedChildren), [stringifiedChildren]);\n return <BaseTable3<TType> {...props} key={key} ref={ref} />;\n}) as (<TType = unknown>(props: Table3Props<TType> & React.RefAttributes<Table3Ref>) => JSX.Element) & {\n Column: typeof Column;\n Group: typeof Group;\n};\nTable3.Column = Column;\nTable3.Group = Group;\n\nexport type {\n Table3Ref,\n Table3Props,\n Table3ColumnProps,\n Table3GroupProps,\n Table3EditingSaveHandler,\n Table3EditingValidatorFn,\n Table3Texts,\n Table3FeatureProps,\n Table3CommonProps,\n Table3WithoutEditingWithClientProps,\n Table3WithoutEditingWithServerProps,\n Table3WithEditingProps,\n Table3WithEditingWithClientProps,\n Table3WithEditingWithServerProps,\n Table3EditingChangeHandler,\n Table3EditingCreateHandler,\n} from './types';\n"],"names":["Column","_","displayName","Group","BaseTable3","fixedForwardRef","props","ref","table3","useTable3","gridAttributes","_table3$meta$editing","meta","editing","isEditing","_table3$meta$editing2","isDetailedMode","undefined","enableHorizontalArrowKeyNavigation","hasAlertErrors","getErrorsShownInAlert","length","hasCreateWorkflow","isEnabled","onEditingCreate","isScrolled","isTableScrolled","createWorkflow","React","CreateNewRow","buttonRef","createRowButtonRef","scrollToIndex","renderer","table","instance","tableMeta","Table","Toolbar","Editing","Alert","className","tableRef","Grid","footerRows","TemporaryRow","Table3","stringifiedChildren","String","children","key","useMemo"],"mappings":";;;;;;;;;;AAYA,SAASA,MAAMA,CAAkBC,CAA2B;EACxD,OAAO,IAAI;AACf;AACAD,MAAM,CAACE,WAAW,GAAG,cAAc;AAEnC,SAASC,KAAKA,CAACF,CAAmB;EAC9B,OAAO,IAAI;AACf;AACAE,KAAK,CAACD,WAAW,GAAG,aAAa;AAEjC,MAAME,UAAU,gBAAGC,eAAe,CAAC,SAASD,UAAUA,CAAkBE,KAAyB,EAAEC,GAAyB;;EACxH,MAAMC,MAAM,GAAGC,SAAS,CAAQH,KAAK,EAAEC,GAAG,CAAC;EAE3C,MAAMG,cAAc,GAAG;IACnB,yBAAyB,EAAE,CAAAC,oBAAA,GAAAH,MAAM,CAACI,IAAI,CAACC,OAAO,cAAAF,oBAAA,eAAnBA,oBAAA,CAAqBG,SAAS,GACnD,CAAAC,qBAAA,GAAAP,MAAM,CAACI,IAAI,CAACC,OAAO,cAAAE,qBAAA,eAAnBA,qBAAA,CAAqBC,cAAc,GAC/B,UAAU,GACV,QAAQ,GACZC,SAAS;IACfC,kCAAkC,EAAEV,MAAM,CAACI,IAAI,CAACC,O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EACIA,6BAACiB,YAAY;IACTd,kBAAkB,EAAEvB,MAAM,CAACI,IAAI,CAACC,OAAO,CAACkB,kBAAkB;IAC1DN,UAAU,EAAEA,UAAU;IACtBS,KAAK,EAAE1B,MAAM,CAAC2B,QAAQ;IACtBC,SAAS,EAAE5B,MAAM,CAACI,IAAI;IACtB8B,QAAQ,EAAElC,MAAM,CAACD;IACnB,EACD,CAACkB,UAAU,GAAGE,cAAc,GAAG,IAAI,CACrC,IACH,IAAI,CACC,CACT;AAEhB,CAAC,CAAC;MAEWmB,MAAM,gBAAGzC,eAAe,CAAC,SAASyC,MAAMA,CAAkBxC,KAAyB,EAAEC,GAAyB;EACvH,MAAMwC,mBAAmB,GAAGC,MAAM,CAAC1C,KAAK,CAAC2C,QAAQ,CAAC;;;EAGlD,MAAMC,GAAG,GAAGtB,cAAK,CAACuB,OAAO,CAAC,MAAMH,MAAM,CAAC,WAAW,GAAGD,mBAAmB,CAAC,EAAE,CAACA,mBAAmB,CAAC,CAAC;EACjG,oBAAOnB,6BAACxB,UAAU,oBAAYE,KAAK;IAAE4C,GAAG,EAAEA,GAAG;IAAE3C,GAAG,EAAEA;KAAO;AAC/D,CAAC;AAIDuC,MAAM,CAAC9C,MAAM,GAAGA,MAAM;AACtB8C,MAAM,CAAC3C,KAAK,GAAGA,KAAK;;;;"}
@@ -9,10 +9,10 @@ function CreateNewRow(props) {
9
9
  var _temporaryRows$0$tabl, _temporaryRows$, _table$getState$colum;
10
10
  const {
11
11
  buttonRef,
12
+ isScrolled,
12
13
  scrollToIndex,
13
14
  table,
14
- tableMeta,
15
- tableRef
15
+ tableMeta
16
16
  } = props;
17
17
  const {
18
18
  texts
@@ -45,11 +45,9 @@ function CreateNewRow(props) {
45
45
  keys: shortcut
46
46
  });
47
47
  }
48
- const isScrolled = tableRef.current ? tableRef.current.scrollHeight > tableRef.current.clientHeight : false;
49
48
  const className = cn('group/row border-grey-300 !sticky z-[21]', {
50
49
  'bottom-10': tableMeta.footer.isEnabled,
51
50
  'bottom-0': !tableMeta.footer.isEnabled,
52
- 'border-t-2': isScrolled,
53
51
  'border-b': !isScrolled
54
52
  });
55
53
  return /*#__PURE__*/React__default.createElement("tr", {
@@ -1 +1 @@
1
- {"version":3,"file":"CreateNewRow.js","sources":["../../../../../../../../../../src/components/Table3/components/Row/Editing/CreateNewRow.tsx"],"sourcesContent":["import React from 'react';\nimport { Table as ReactTable, TableMeta as ReactTableMeta } from '@tanstack/react-table';\nimport clsx from 'clsx';\nimport { Button } from '../../../../Button/Button';\nimport { useLocalization } from '../../../../Provider/Localization';\nimport { Icon } from '../../../../Icon/Icon';\nimport { Table3EditingCreateHandler } from '../../../types';\nimport { TableRef } from '../../../../../primitives/Table/types';\nimport { Shortcut } from '../../../../Shortcut/Shortcut';\n\ntype CreateNewRowProps<TType = unknown> = {\n buttonRef: React.Ref<HTMLButtonElement>;\n onEditingCreate?: Table3EditingCreateHandler<TType>;\n scrollToIndex: (index: number) => void;\n table: ReactTable<TType>;\n tableMeta: ReactTableMeta<TType>;\n tableRef: React.RefObject<TableRef>;\n};\n\nexport function CreateNewRow<TType = unknown>(props: CreateNewRowProps<TType>) {\n const { buttonRef, scrollToIndex, table, tableMeta, tableRef } = props;\n const { texts } = useLocalization();\n\n const temporaryRows = tableMeta.editing.temporaryRows as TType[];\n const temporaryRowId: string = temporaryRows[0]?.[tableMeta.rowIdentityAccessor as string] ?? '';\n\n const isDisabled =\n !!table.getState().globalFilter ||\n !!table.getState().columnFilters?.length ||\n (!!temporaryRowId && !!tableMeta.editing.hasRowErrors(temporaryRowId));\n const isSaving = !!temporaryRowId && tableMeta.editing.getRowStatus(temporaryRowId) === 'saving';\n\n const handleCreate = async () => {\n if (isDisabled) {\n return;\n }\n\n await tableMeta.editing.createRow(table, scrollToIndex);\n };\n const shortcut = { key: 'Enter', meta: true };\n\n let tooltip;\n\n if (isSaving) {\n tooltip = texts.table3.editing.buttons.create.saving;\n } else if (isDisabled) {\n tooltip = texts.table3.editing.buttons.create.disabled;\n } else {\n tooltip = <Shortcut keys={shortcut} />;\n }\n\n const isScrolled = tableRef.current ? tableRef.current.scrollHeight > tableRef.current.clientHeight : false;\n\n const className = clsx('group/row border-grey-300 !sticky z-[21]', {\n 'bottom-10': tableMeta.footer.isEnabled,\n 'bottom-0': !tableMeta.footer.isEnabled,\n 'border-t-2': isScrolled,\n 'border-b': !isScrolled,\n });\n\n return (\n <tr data-row-create className={className} tabIndex={-1}>\n <td className=\"!bg-grey-50 col-span-full !border-b-0 !px-1\">\n <Button\n appearance=\"transparent\"\n className=\"group-hover:bg-grey-200 sticky left-[4px]\"\n disabled={isDisabled}\n onClick={handleCreate}\n ref={buttonRef}\n shortcut={shortcut}\n tooltip={tooltip}>\n <Icon name=\"circle-plus\" />\n {texts.table3.editing.buttons.create.label}\n </Button>\n </td>\n </tr>\n );\n}\n"],"names":["CreateNewRow","props","buttonRef","scrollToIndex","table","tableMeta","tableRef","texts","useLocalization","temporaryRows","editing","temporaryRowId","_temporaryRows$0$tabl","_temporaryRows$","rowIdentityAccessor","isDisabled","getState","globalFilter","_table$getState$colum","columnFilters","length","hasRowErrors","isSaving","getRowStatus","handleCreate","Promise","resolve","createRow","then","e","reject","shortcut","key","meta","tooltip","table3","buttons","create","saving","disabled","React","Shortcut","keys","isScrolled","current","scrollHeight","clientHeight","className","clsx","footer","isEnabled","tabIndex","Button","appearance","onClick","ref","Icon","name","label"],"mappings":";;;;;;;SAmBgBA,YAAYA,CAAkBC,KAA+B;;EACzE,MAAM;IAAEC,SAAS;IAAEC,aAAa;IAAEC,KAAK;IAAEC,SAAS;IAAEC;GAAU,GAAGL,KAAK;EACtE,MAAM;IAAEM;GAAO,GAAGC,eAAe,EAAE;EAEnC,MAAMC,aAAa,GAAGJ,SAAS,CAACK,OAAO,CAACD,aAAwB;EAChE,MAAME,cAAc,IAAAC,qBAAA,IAAAC,eAAA,GAAWJ,aAAa,CAAC,CAAC,CAAC,cAAAI,eAAA,uBAAhBA,eAAA,CAAmBR,S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ACC,YAAY,GAAGvC,QAAQ,CAACsC,OAAO,CAACE,YAAY,GAAG,KAAK;EAE3G,MAAMC,SAAS,GAAGC,EAAI,CAAC,0CAA0C,EAAE;IAC/D,WAAW,EAAE3C,SAAS,CAAC4C,MAAM,CAACC,SAAS;IACvC,UAAU,EAAE,CAAC7C,SAAS,CAAC4C,MAAM,CAACC,SAAS;IACvC,YAAY,EAAEP,UAAU;IACxB,UAAU,EAAE,CAACA;GAChB,CAAC;EAEF,oBACIH;;IAAoBO,SAAS,EAAEA,SAAS;IAAEI,QAAQ,EAAE,CAAC;kBACjDX;IAAIO,SAAS,EAAC;kBACVP,6BAACY,MAAM;IACHC,UAAU,EAAC,aAAa;IACxBN,SAAS,EAAC,2CAA2C;IACrDR,QAAQ,EAAExB,UAAU;IACpBuC,OAAO,EAAE9B,YAAY;IACrB+B,GAAG,EAAErD,SAAS;IACd6B,QAAQ,EAAEA,QAAQ;IAClBG,OAAO,EAAEA;kBACTM,6BAACgB,IAAI;IAACC,IAAI,EAAC;IAAgB,EAC1BlD,KAAK,CAAC4B,MAAM,CAACzB,OAAO,CAAC0B,OAAO,CAACC,MAAM,CAACqB,KAAK,CACrC,CACR,CACJ;AAEb;;;;"}
1
+ {"version":3,"file":"CreateNewRow.js","sources":["../../../../../../../../../../src/components/Table3/components/Row/Editing/CreateNewRow.tsx"],"sourcesContent":["import React from 'react';\nimport { Table as ReactTable, TableMeta as ReactTableMeta } from '@tanstack/react-table';\nimport clsx from 'clsx';\nimport { Button } from '../../../../Button/Button';\nimport { useLocalization } from '../../../../Provider/Localization';\nimport { Icon } from '../../../../Icon/Icon';\nimport { Table3EditingCreateHandler } from '../../../types';\nimport { Shortcut } from '../../../../Shortcut/Shortcut';\n\ntype CreateNewRowProps<TType = unknown> = {\n buttonRef: React.Ref<HTMLButtonElement>;\n isScrolled: boolean;\n onEditingCreate?: Table3EditingCreateHandler<TType>;\n scrollToIndex: (index: number) => void;\n table: ReactTable<TType>;\n tableMeta: ReactTableMeta<TType>;\n};\n\nexport function CreateNewRow<TType = unknown>(props: CreateNewRowProps<TType>) {\n const { buttonRef, isScrolled, scrollToIndex, table, tableMeta } = props;\n const { texts } = useLocalization();\n\n const temporaryRows = tableMeta.editing.temporaryRows as TType[];\n const temporaryRowId: string = temporaryRows[0]?.[tableMeta.rowIdentityAccessor as string] ?? '';\n\n const isDisabled =\n !!table.getState().globalFilter ||\n !!table.getState().columnFilters?.length ||\n (!!temporaryRowId && !!tableMeta.editing.hasRowErrors(temporaryRowId));\n const isSaving = !!temporaryRowId && tableMeta.editing.getRowStatus(temporaryRowId) === 'saving';\n\n const handleCreate = async () => {\n if (isDisabled) {\n return;\n }\n\n await tableMeta.editing.createRow(table, scrollToIndex);\n };\n const shortcut = { key: 'Enter', meta: true };\n\n let tooltip;\n\n if (isSaving) {\n tooltip = texts.table3.editing.buttons.create.saving;\n } else if (isDisabled) {\n tooltip = texts.table3.editing.buttons.create.disabled;\n } else {\n tooltip = <Shortcut keys={shortcut} />;\n }\n\n const className = clsx('group/row border-grey-300 !sticky z-[21]', {\n 'bottom-10': tableMeta.footer.isEnabled,\n 'bottom-0': !tableMeta.footer.isEnabled,\n 'border-b': !isScrolled,\n });\n\n return (\n <tr data-row-create className={className} tabIndex={-1}>\n <td className=\"!bg-grey-50 col-span-full !border-b-0 !px-1\">\n <Button\n appearance=\"transparent\"\n className=\"group-hover:bg-grey-200 sticky left-[4px]\"\n disabled={isDisabled}\n onClick={handleCreate}\n ref={buttonRef}\n shortcut={shortcut}\n tooltip={tooltip}>\n <Icon name=\"circle-plus\" />\n {texts.table3.editing.buttons.create.label}\n </Button>\n </td>\n </tr>\n );\n}\n"],"names":["CreateNewRow","props","buttonRef","isScrolled","scrollToIndex","table","tableMeta","texts","useLocalization","temporaryRows","editing","temporaryRowId","_temporaryRows$0$tabl","_temporaryRows$","rowIdentityAccessor","isDisabled","getState","globalFilter","_table$getState$colum","columnFilters","length","hasRowErrors","isSaving","getRowStatus","handleCreate","Promise","resolve","createRow","then","e","reject","shortcut","key","meta","tooltip","table3","buttons","create","saving","disabled","React","Shortcut","keys","className","clsx","footer","isEnabled","tabIndex","Button","appearance","onClick","ref","Icon","name","label"],"mappings":";;;;;;;SAkBgBA,YAAYA,CAAkBC,KAA+B;;EACzE,MAAM;IAAEC,SAAS;IAAEC,UAAU;IAAEC,aAAa;IAAEC,KAAK;IAAEC;GAAW,GAAGL,KAAK;EACxE,MAAM;IAAEM;GAAO,GAAGC,eAAe,EAAE;EAEnC,MAAMC,aAAa,GAAGH,SAAS,CAACI,OAAO,CAACD,aAAwB;EAChE,MAAME,cAAc,IAAAC,qBAAA,IAAAC,eAAA,GAAWJ,aAAa,CAAC,CAAC,CAAC,cAAAI,eAAA,uBAAhBA,eAAA,CAAmBP,SAAS,CAACQ,mBAA6B,CAAC,cAAAF,qBAAA,cAAAA,qBAAA,GAAI,EAAE;EAEhG,MAAMG,UAAU,GACZ,CAAC,CAACV,KAAK,CAACW,QAAQ,EAAE,CAACC,YAAY,IAC/B,CAAC,GAAAC,qBAAA,GAACb,KAAK,CAACW,QAAQ,EAAE,CAACG,aAAa,cAAAD,qBAAA,eAA9BA,qBAAA,CAAgCE,MAAM,KACvC,CAAC,CAACT,cAAc,IAAI,CAAC,CAACL,SAAS,CAACI,OAAO,CAACW,YAAY,CAACV,cAAc,CAAE;EAC1E,MAAMW,QAAQ,GAAG,CAAC,CAACX,cAAc,IAAIL,SAAS,CAACI,OAAO,CAACa,YAAY,CAACZ,cAAc,CAAC,KAAK,QAAQ;EAEhG,MAAMa,YAAY;IAAA;MACd,IAAIT,UAAU,EAAE;QACZ,OAAAU,OAAA,CAAAC,OAAA;;MACH,OAAAD,OAAA,CAAAC,OAAA,CAEKpB,SAAS,CAACI,OAAO,CAACiB,SAAS,CAACtB,KAAK,EAAED,aAAa,CAAC,EAAAwB,IAAA;KAC1D,QAAAC,CAAA;MAAA,OAAAJ,OAAA,CAAAK,MAAA,CAAAD,CAAA;;;EACD,MAAME,QAAQ,GAAG;IAAEC,GAAG,EAAE,OAAO;IAAEC,IAAI,EAAE;GAAM;EAE7C,IAAIC,OAAO;EAEX,IAAIZ,QAAQ,EAAE;IACVY,OAAO,GAAG3B,KAAK,CAAC4B,MAAM,CAACzB,OAAO,CAAC0B,OAAO,CAACC,MAAM,CAACC,MAAM;GACvD,MAAM,IAAIvB,UAAU,EAAE;IACnBmB,OAAO,GAAG3B,KAAK,CAAC4B,MAAM,CAACzB,OAAO,CAAC0B,OAAO,CAACC,MAAM,CAACE,QAAQ;GACzD,MAAM;IACHL,OAAO,gBAAGM,6BAACC,QAAQ;MAACC,IAAI,EAAEX;MAAY;;EAG1C,MAAMY,SAAS,GAAGC,EAAI,CAAC,0CAA0C,EAAE;IAC/D,WAAW,EAAEtC,SAAS,CAACuC,MAAM,CAACC,SAAS;IACvC,UAAU,EAAE,CAACxC,SAAS,CAACuC,MAAM,CAACC,SAAS;IACvC,UAAU,EAAE,CAAC3C;GAChB,CAAC;EAEF,oBACIqC;;IAAoBG,SAAS,EAAEA,SAAS;IAAEI,QAAQ,EAAE,CAAC;kBACjDP;IAAIG,SAAS,EAAC;kBACVH,6BAACQ,MAAM;IACHC,UAAU,EAAC,aAAa;IACxBN,SAAS,EAAC,2CAA2C;IACrDJ,QAAQ,EAAExB,UAAU;IACpBmC,OAAO,EAAE1B,YAAY;IACrB2B,GAAG,EAAEjD,SAAS;IACd6B,QAAQ,EAAEA,QAAQ;IAClBG,OAAO,EAAEA;kBACTM,6BAACY,IAAI;IAACC,IAAI,EAAC;IAAgB,EAC1B9C,KAAK,CAAC4B,MAAM,CAACzB,OAAO,CAAC0B,OAAO,CAACC,MAAM,CAACiB,KAAK,CACrC,CACR,CACJ;AAEb;;;;"}
@@ -8,6 +8,7 @@ import { RENDERERS } from '../../../useTable3.js';
8
8
  function TemporaryRow(props) {
9
9
  const {
10
10
  createRowButtonRef,
11
+ isScrolled,
11
12
  table,
12
13
  tableMeta,
13
14
  tableRef
@@ -70,10 +71,9 @@ function TemporaryRow(props) {
70
71
  }
71
72
  }
72
73
  };
73
- const isScrolled = tableRef.current ? tableRef.current.scrollHeight > tableRef.current.clientHeight : false;
74
74
  const className = cn('group/row border-grey-300 !sticky z-[22]', {
75
- 'bottom-[calc(5rem_+_3px)] data-[row-editing-move]:bottom-[calc(5rem_+_2px)]': tableMeta.footer.isEnabled,
76
- 'bottom-[calc(2.5rem_+_3px)] data-[row-editing-move]:bottom-[calc(2.5rem_+_2px)]': !tableMeta.footer.isEnabled,
75
+ 'bottom-[calc(5rem_+_2px)] data-[row-editing-move]:bottom-[calc(5rem_+_2px)]': tableMeta.footer.isEnabled,
76
+ 'bottom-[calc(2.5rem_+_2px)] data-[row-editing-move]:bottom-[calc(2.5rem_+_2px)]': !tableMeta.footer.isEnabled,
77
77
  'border-t-2 shadow-[0px_-5px_20px_0px_rgba(0,0,0,0.1)] [&>td]:!border-b-0': isScrolled
78
78
  });
79
79
  return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, table.getBottomRows().map(row => (/*#__PURE__*/React__default.createElement(Row, {
@@ -1 +1 @@
1
- {"version":3,"file":"TemporaryRow.js","sources":["../../../../../../../../../../src/components/Table3/components/Row/Editing/TemporaryRow.tsx"],"sourcesContent":["import React from 'react';\nimport { Table as ReactTable, TableMeta as ReactTableMeta } from '@tanstack/react-table';\nimport clsx from 'clsx';\nimport { Row } from '../../../../../primitives/Table/Core/components/Row/Row';\nimport { RENDERERS } from '../../../useTable3';\nimport { isElementTriggeredFromContainer } from '../../../../../utils/dom';\nimport { TableRef } from '../../../../../primitives/Table/types';\nimport { TEMPORARY_ROW_ID_PREFIX } from '../../../util/editing';\n\ntype TemporaryRowProps<TType = unknown> = {\n createRowButtonRef: React.RefObject<HTMLButtonElement>;\n table: ReactTable<TType>;\n tableMeta: ReactTableMeta<TType>;\n tableRef: React.RefObject<TableRef>;\n};\n\nexport function TemporaryRow<TType = unknown>(props: TemporaryRowProps<TType>) {\n const { createRowButtonRef, table, tableMeta, tableRef } = props;\n\n const handleKeyDown = async (event: React.KeyboardEvent<HTMLTableRowElement>) => {\n if (event.key === 'ArrowDown') {\n event.preventDefault();\n\n if (!isElementTriggeredFromContainer(event.target as Element, event.currentTarget)) {\n const saved = await tableMeta.editing.saveChanges(table);\n\n if (saved) {\n createRowButtonRef.current?.focus();\n }\n }\n } else if (event.key === 'ArrowUp') {\n event.preventDefault();\n event.stopPropagation();\n\n if (tableRef.current) {\n const availableRows = Array.from(\n tableRef.current.querySelectorAll(`tbody tr:not([data-row-id^='${TEMPORARY_ROW_ID_PREFIX}'])`) ?? []\n );\n\n const footerHeight = tableRef.current.querySelector('tfoot')?.getBoundingClientRect().height ?? 0;\n const newRowHeight = event.currentTarget.getBoundingClientRect().height;\n const visibleHeight = tableRef.current.clientHeight - footerHeight - newRowHeight;\n const tableTopOffset = tableRef.current.getBoundingClientRect().top;\n\n let nextRowIndex;\n\n // iterate available rows in reverse order, since we're working at the bottom\n for (let index = availableRows.length - 1; index >= 0; index--) {\n const rowRect = availableRows[index].getBoundingClientRect();\n const topPlusHalfRow = rowRect.top + rowRect.height / 2;\n\n if (topPlusHalfRow - tableTopOffset <= visibleHeight) {\n nextRowIndex = index;\n break;\n }\n }\n\n if (nextRowIndex) {\n tableMeta.rowActive.setRowActiveIndex(\n Number(availableRows[nextRowIndex < 0 ? 0 : nextRowIndex].getAttribute('data-row-index'))\n );\n }\n }\n }\n };\n\n const handleKeyDownCapture = (event: React.KeyboardEvent<HTMLTableRowElement>) => {\n if (event.key === 'ArrowLeft' && tableMeta.editing.lastFocusedCellIndex === 0) {\n event.preventDefault();\n event.stopPropagation();\n } else if (event.key === 'ArrowRight' && tableMeta.editing.lastFocusedCellIndex) {\n if (tableMeta.editing.lastFocusedCellIndex === table.getVisibleFlatColumns().length - 1) {\n event.preventDefault();\n event.stopPropagation();\n }\n }\n };\n\n const isScrolled = tableRef.current ? tableRef.current.scrollHeight > tableRef.current.clientHeight : false;\n\n const className = clsx('group/row border-grey-300 !sticky z-[22]', {\n 'bottom-[calc(5rem_+_3px)] data-[row-editing-move]:bottom-[calc(5rem_+_2px)]': tableMeta.footer.isEnabled,\n 'bottom-[calc(2.5rem_+_3px)] data-[row-editing-move]:bottom-[calc(2.5rem_+_2px)]': !tableMeta.footer.isEnabled,\n 'border-t-2 shadow-[0px_-5px_20px_0px_rgba(0,0,0,0.1)] [&>td]:!border-b-0': isScrolled,\n });\n\n return (\n <>\n {table.getBottomRows().map(row => (\n <Row<TType>\n key={row.id}\n cellRenderer={RENDERERS.cell}\n index={tableMeta.length}\n measureRow={() => null}\n renderer={RENDERERS.row}\n row={row}\n table={table}\n className={className}\n onKeyDown={handleKeyDown}\n onKeyDownCapture={handleKeyDownCapture}\n hideInternalColumns\n hideRowActions={!tableMeta.editing.isEditing}\n />\n ))}\n </>\n );\n}\n"],"names":["TemporaryRow","props","createRowButtonRef","table","tableMeta","tableRef","handleKeyDown","event","key","preventDefault","_temp","isElementTriggeredFromContainer","target","currentTarget","Promise","resolve","editing","saveChanges","then","saved","_createRowButtonRef$c","current","focus","stopPropagation","_tableRef$current$que","_tableRef$current$que2","_tableRef$current$que3","availableRows","Array","from","querySelectorAll","TEMPORARY_ROW_ID_PREFIX","footerHeight","querySelector","getBoundingClientRect","height","newRowHeight","visibleHeight","clientHeight","tableTopOffset","top","nextRowIndex","index","length","rowRect","topPlusHalfRow","rowActive","setRowActiveIndex","Number","getAttribute","_temp2","e","reject","handleKeyDownCapture","lastFocusedCellIndex","getVisibleFlatColumns","isScrolled","scrollHeight","className","clsx","footer","isEnabled","React","getBottomRows","map","row","Row","id","cellRenderer","RENDERERS","cell","measureRow","renderer","onKeyDown","onKeyDownCapture","hideInternalColumns","hideRowActions","isEditing"],"mappings":";;;;;;;SAgBgBA,YAAYA,CAAkBC,KAA+B;EACzE,MAAM;IAAEC,kBAAkB;IAAEC,KAAK;IAAEC,SAAS;IAAEC;GAAU,GAAGJ,KAAK;EAEhE,MAAMK,aAAa,aAAUC,KAA+C;IAAA;;YACpEA,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,oBAAoB,KAAKnD,KAAK,CAACoD,qBAAqB,EAAE,CAACZ,MAAM,GAAG,CAAC,EAAE;QACrFpC,KAAK,CAACE,cAAc,EAAE;QACtBF,KAAK,CAACgB,eAAe,EAAE;;;GAGlC;EAED,MAAMiC,UAAU,GAAGnD,QAAQ,CAACgB,OAAO,GAAGhB,QAAQ,CAACgB,OAAO,CAACoC,YAAY,GAAGpD,QAAQ,CAACgB,OAAO,CAACiB,YAAY,GAAG,KAAK;EAE3G,MAAMoB,SAAS,GAAGC,EAAI,CAAC,0CAA0C,EAAE;IAC/D,6EAA6E,EAAEvD,SAAS,CAACwD,MAAM,CAACC,SAAS;IACzG,iFAAiF,EAAE,CAACzD,SAAS,CAACwD,MAAM,CAACC,SAAS;IAC9G,0EAA0E,EAAEL;GAC/E,CAAC;EAEF,oBACIM,4DACK3D,KAAK,CAAC4D,aAAa,EAAE,CAACC,GAAG,CAACC,GAAG,kBAC1BH,6BAACI,GAAG;IACA1D,GAAG,EAAEyD,GAAG,CAACE,EAAE;IACXC,YAAY,EAAEC,SAAS,CAACC,IAAI;IAC5B5B,KAAK,EAAEtC,SAAS,CAACuC,MAAM;IACvB4B,UAAU,EAAEA,MAAM,IAAI;IACtBC,QAAQ,EAAEH,SAAS,CAACJ,GAAG;IACvBA,GAAG,EAAEA,GAAG;IACR9D,KAAK,EAAEA,KAAK;IACZuD,SAAS,EAAEA,SAAS;IACpBe,SAAS,EAAEnE,aAAa;IACxBoE,gBAAgB,EAAErB,oBAAoB;IACtCsB,mBAAmB;IACnBC,cAAc,EAAE,CAACxE,SAAS,CAACY,OAAO,CAAC6D;IACrC,CACL,CAAC,CACH;AAEX;;;;"}
1
+ {"version":3,"file":"TemporaryRow.js","sources":["../../../../../../../../../../src/components/Table3/components/Row/Editing/TemporaryRow.tsx"],"sourcesContent":["import React from 'react';\nimport { Table as ReactTable, TableMeta as ReactTableMeta } from '@tanstack/react-table';\nimport clsx from 'clsx';\nimport { Row } from '../../../../../primitives/Table/Core/components/Row/Row';\nimport { RENDERERS } from '../../../useTable3';\nimport { isElementTriggeredFromContainer } from '../../../../../utils/dom';\nimport { TableRef } from '../../../../../primitives/Table/types';\nimport { TEMPORARY_ROW_ID_PREFIX } from '../../../util/editing';\n\ntype TemporaryRowProps<TType = unknown> = {\n createRowButtonRef: React.RefObject<HTMLButtonElement>;\n isScrolled: boolean;\n table: ReactTable<TType>;\n tableMeta: ReactTableMeta<TType>;\n tableRef: React.RefObject<TableRef>;\n};\n\nexport function TemporaryRow<TType = unknown>(props: TemporaryRowProps<TType>) {\n const { createRowButtonRef, isScrolled, table, tableMeta, tableRef } = props;\n\n const handleKeyDown = async (event: React.KeyboardEvent<HTMLTableRowElement>) => {\n if (event.key === 'ArrowDown') {\n event.preventDefault();\n\n if (!isElementTriggeredFromContainer(event.target as Element, event.currentTarget)) {\n const saved = await tableMeta.editing.saveChanges(table);\n\n if (saved) {\n createRowButtonRef.current?.focus();\n }\n }\n } else if (event.key === 'ArrowUp') {\n event.preventDefault();\n event.stopPropagation();\n\n if (tableRef.current) {\n const availableRows = Array.from(\n tableRef.current.querySelectorAll(`tbody tr:not([data-row-id^='${TEMPORARY_ROW_ID_PREFIX}'])`) ?? []\n );\n\n const footerHeight = tableRef.current.querySelector('tfoot')?.getBoundingClientRect().height ?? 0;\n const newRowHeight = event.currentTarget.getBoundingClientRect().height;\n const visibleHeight = tableRef.current.clientHeight - footerHeight - newRowHeight;\n const tableTopOffset = tableRef.current.getBoundingClientRect().top;\n\n let nextRowIndex;\n\n // iterate available rows in reverse order, since we're working at the bottom\n for (let index = availableRows.length - 1; index >= 0; index--) {\n const rowRect = availableRows[index].getBoundingClientRect();\n const topPlusHalfRow = rowRect.top + rowRect.height / 2;\n\n if (topPlusHalfRow - tableTopOffset <= visibleHeight) {\n nextRowIndex = index;\n break;\n }\n }\n\n if (nextRowIndex) {\n tableMeta.rowActive.setRowActiveIndex(\n Number(availableRows[nextRowIndex < 0 ? 0 : nextRowIndex].getAttribute('data-row-index'))\n );\n }\n }\n }\n };\n\n const handleKeyDownCapture = (event: React.KeyboardEvent<HTMLTableRowElement>) => {\n if (event.key === 'ArrowLeft' && tableMeta.editing.lastFocusedCellIndex === 0) {\n event.preventDefault();\n event.stopPropagation();\n } else if (event.key === 'ArrowRight' && tableMeta.editing.lastFocusedCellIndex) {\n if (tableMeta.editing.lastFocusedCellIndex === table.getVisibleFlatColumns().length - 1) {\n event.preventDefault();\n event.stopPropagation();\n }\n }\n };\n\n const className = clsx('group/row border-grey-300 !sticky z-[22]', {\n 'bottom-[calc(5rem_+_2px)] data-[row-editing-move]:bottom-[calc(5rem_+_2px)]': tableMeta.footer.isEnabled,\n 'bottom-[calc(2.5rem_+_2px)] data-[row-editing-move]:bottom-[calc(2.5rem_+_2px)]': !tableMeta.footer.isEnabled,\n 'border-t-2 shadow-[0px_-5px_20px_0px_rgba(0,0,0,0.1)] [&>td]:!border-b-0': isScrolled,\n });\n\n return (\n <>\n {table.getBottomRows().map(row => (\n <Row<TType>\n key={row.id}\n cellRenderer={RENDERERS.cell}\n index={tableMeta.length}\n measureRow={() => null}\n renderer={RENDERERS.row}\n row={row}\n table={table}\n className={className}\n onKeyDown={handleKeyDown}\n onKeyDownCapture={handleKeyDownCapture}\n hideInternalColumns\n hideRowActions={!tableMeta.editing.isEditing}\n />\n ))}\n </>\n );\n}\n"],"names":["TemporaryRow","props","createRowButtonRef","isScrolled","table","tableMeta","tableRef","handleKeyDown","event","key","preventDefault","_temp","isElementTriggeredFromContainer","target","currentTarget","Promise","resolve","editing","saveChanges","then","saved","_createRowButtonRef$c","current","focus","stopPropagation","_tableRef$current$que","_tableRef$current$que2","_tableRef$current$que3","availableRows","Array","from","querySelectorAll","TEMPORARY_ROW_ID_PREFIX","footerHeight","querySelector","getBoundingClientRect","height","newRowHeight","visibleHeight","clientHeight","tableTopOffset","top","nextRowIndex","index","length","rowRect","topPlusHalfRow","rowActive","setRowActiveIndex","Number","getAttribute","_temp2","e","reject","handleKeyDownCapture","lastFocusedCellIndex","getVisibleFlatColumns","className","clsx","footer","isEnabled","React","getBottomRows","map","row","Row","id","cellRenderer","RENDERERS","cell","measureRow","renderer","onKeyDown","onKeyDownCapture","hideInternalColumns","hideRowActions","isEditing"],"mappings":";;;;;;;SAiBgBA,YAAYA,CAAkBC,KAA+B;EACzE,MAAM;IAAEC,kBAAkB;IAAEC,UAAU;IAAEC,KAAK;IAAEC,SAAS;IAAEC;GAAU,GAAGL,KAAK;EAE5E,MAAMM,aAAa,aAAUC,KAA+C;IAAA;;YACpEA,KAAK,CAACC,GAAG,KAAK,WAAW;UACzBD,KAAK,CAACE,cAAc,EAAE;UAAC,MAAAC,KAAA;YAAA,IAEnB,CAACC,+BAA+B,CAACJ,KAAK,CAACK,MAAiB,EAAEL,KAAK,CAACM,aAAa,CAAC;cAAA,OAAAC,OAAA,CAAAC,OAAA,CAC1DX,SAAS,CAACY,OAAO,CAACC,WAAW,CAACd,KAAK,CAAC,EAAAe,IAAA,WAAlDC,KAAK;gBAAA,IAEPA,KAAK;kBAAA,IAAAC,qBAAA;kBACL,CAAAA,qBAAA,GAAAnB,kBAAkB,CAACoB,OAAO,cAAAD,qBAAA,uBAA1BA,qBAAA,CAA4BE,KAAK,EAAE;;;;;UAAC,IAAAZ,KAAA,IAAAA,KAAA,CAAAQ,IAAA,SAAAR,KAAA,CAAAQ,IAAA;eAGzC,IAAIX,KAAK,CAACC,GAAG,KAAK,SAAS,EAAE;UAChCD,KAAK,CAACE,cAAc,EAAE;UACtBF,KAAK,CAACgB,eAAe,EAAE;UAEvB,IAAIlB,QAAQ,CAACgB,OAAO,EAAE;YAAA,IAAAG,qBAAA,EAAAC,sBAAA,EAAAC,sBAAA;YAClB,MAAMC,aAAa,GAAGC,KAAK,CAACC,IAAI,EAAAL,qBAAA,GAC5BnB,QAAQ,CAACgB,OAAO,CAACS,gBAAgB,CAAC,+BAA+BC,uBAAuB,KAAK,CAAC,cAAAP,qBAAA,cAAAA,qBAAA,GAAI,EAAE,C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-92,6 +92,14 @@ const shortcut = {
92
92
  meta: true,
93
93
  shift: false
94
94
  };
95
+ function isTableScrolled(ref) {
96
+ if (ref.current) {
97
+ var _ref$current, _ref$current$querySel, _ref$current2, _ref$current2$querySe;
98
+ const height = parseFloat(((_ref$current = ref.current) === null || _ref$current === void 0 ? void 0 : (_ref$current$querySel = _ref$current.querySelector('tbody')) === null || _ref$current$querySel === void 0 ? void 0 : _ref$current$querySel.style.height) || '0') + parseFloat(((_ref$current2 = ref.current) === null || _ref$current2 === void 0 ? void 0 : (_ref$current2$querySe = _ref$current2.querySelector('tbody')) === null || _ref$current2$querySe === void 0 ? void 0 : _ref$current2$querySe.style.paddingBottom) || '0');
99
+ return height > ref.current.scrollHeight;
100
+ }
101
+ return false;
102
+ }
95
103
 
96
- export { TEMPORARY_ROW_ID_PREFIX, isTemporaryRow, shortcut, willRowMove };
104
+ export { TEMPORARY_ROW_ID_PREFIX, isTableScrolled, isTemporaryRow, shortcut, willRowMove };
97
105
  //# sourceMappingURL=editing.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"editing.js","sources":["../../../../../../../../src/components/Table3/util/editing.ts"],"sourcesContent":["import { Cell as ReactTableCell, Row as ReactTableRow, Table as ReactTable } from '@tanstack/react-table';\nimport { TableFilterValue } from '../../../primitives/Table/types';\nimport { columnFilterFn } from '../../../primitives/Table/useTableManager/util/filtering';\nimport { globalFilterFn } from '../../../primitives/Table/useTableManager/util/search';\nimport { Localization } from '../../Provider/Localization';\n\nexport function willRowMove<TType = unknown>(\n cell: ReactTableCell<TType, unknown>,\n change: unknown,\n rowIndex: number,\n localization: Localization\n) {\n const { table } = cell.getContext();\n\n if (willRowMoveAfterSearch<TType>(cell, change, table, localization)) {\n return 'search';\n } else if (willRowMoveAfterFilter<TType>(cell, change)) {\n return 'filter';\n } else if (willRowMoveAfterSorting<TType>(cell, change, rowIndex)) {\n return 'sorting';\n }\n\n return undefined;\n}\n\nfunction willRowMoveAfterSearch<TType = unknown>(\n cell: ReactTableCell<TType, unknown>,\n change: unknown,\n table: ReactTable<TType>,\n localization: Localization\n) {\n const searchQuery = table.getState().globalFilter;\n\n if (!table.options.enableGlobalFilter || !searchQuery) {\n return false;\n }\n\n const rowWithChange = { ...cell.row, original: { ...cell.row.original, [cell.column.id]: change } };\n return !globalFilterFn(rowWithChange, cell.column.id, searchQuery, localization);\n}\n\nfunction willRowMoveAfterFilter<TType = unknown>(cell: ReactTableCell<TType, unknown>, change: unknown) {\n if (!cell.column.getIsFiltered()) {\n return false;\n }\n\n return !columnFilterFn(change, cell.column.getFilterValue() as TableFilterValue);\n}\n\nfunction willRowMoveAfterSorting<TType = unknown>(cell: ReactTableCell<TType, unknown>, change: unknown, rowIndex: number) {\n if (!cell.column.getIsSorted()) {\n return false;\n }\n\n const { table } = cell.getContext();\n const rows = table.getRowModel().rows;\n\n const miniSortRows: ReactTableRow<TType>[] = [\n {\n ...cell.row,\n original: {\n ...cell.row.original,\n [cell.column.id]: change,\n },\n getValue: () => change as any,\n },\n ];\n\n let index = 0;\n\n if (rowIndex > 0) {\n miniSortRows.unshift(rows[rowIndex - 1]);\n index = 1;\n }\n\n if (rowIndex < rows.length - 1) {\n miniSortRows.push(rows[rowIndex + 1]);\n }\n\n const resortedRows = [...miniSortRows].sort((rowA, rowB) => {\n const sortFn = cell.column.getSortingFn();\n const sortUndefined = cell.column.columnDef.sortUndefined;\n\n if (!table.options.manualSorting && sortUndefined) {\n const aValue = rowA.getValue(cell.column.id);\n const bValue = rowB.getValue(cell.column.id);\n\n const aUndefined = aValue === undefined;\n const bUndefined = bValue === undefined;\n\n if (aUndefined || bUndefined) {\n if (sortUndefined === 'first') return aUndefined ? -1 : 1;\n if (sortUndefined === 'last') return aUndefined ? 1 : -1;\n\n return aUndefined && bUndefined ? 0 : aUndefined ? sortUndefined : -sortUndefined;\n }\n }\n\n return sortFn(rowA, rowB, cell.column.id);\n });\n\n if (cell.column.getIsSorted() === 'desc') {\n resortedRows.reverse();\n }\n\n return resortedRows[index]?.id !== cell.row.id;\n}\n\nexport const TEMPORARY_ROW_ID_PREFIX = 'temp-';\n\nexport function isTemporaryRow(rowId: string) {\n if (rowId === undefined) {\n return false;\n }\n\n return String(rowId).startsWith(TEMPORARY_ROW_ID_PREFIX);\n}\n\nexport const shortcut = { key: 'e', meta: true, shift: false };\n"],"names":["willRowMove","cell","change","rowIndex","localization","table","getContext","willRowMoveAfterSearch","willRowMoveAfterFilter","willRowMoveAfterSorting","undefined","searchQuery","getState","globalFilter","options","enableGlobalFilter","rowWithChange","row","original","column","id","globalFilterFn","getIsFiltered","columnFilterFn","getFilterValue","getIsSorted","rows","getRowModel","miniSortRows","getValue","index","unshift","length","push","resortedRows","sort","rowA","rowB","sortFn","getSortingFn","sortUndefined","columnDef","manualSorting","aValue","bValue","aUndefined","bUndefined","reverse","_resortedRows$index","TEMPORARY_ROW_ID_PREFIX","isTemporaryRow","rowId","String","startsWith","shortcut","key","meta","shift"],"mappings":";;;SAMgBA,WAAWA,CACvBC,IAAoC,EACpCC,MAAe,EACfC,QAAgB,EAChBC,YAA0B;EAE1B,MAAM;IAAEC;GAAO,GAAGJ,IAAI,CAACK,UAAU,EAAE;EAEnC,IAAIC,sBAAsB,CAAQN,IAAI,EAAEC,MAAM,EAAEG,KAAK,EAAED,YAAY,CAAC,EAAE;IAClE,OAAO,QAAQ;GAClB,MAAM,IAAII,sBAAsB,CAAQP,IAAI,EAAEC,MAAM,CAAC,EAAE;IACpD,OAAO,QAAQ;GAClB,MAAM,IAAIO,uBAAuB,CAAQR,IAAI,EAAEC,MAAM,EAAEC,QAAQ,CAAC,EAAE;IAC/D,OAAO,SAAS;;EAGpB,OAAOO,SAAS;AACpB;AAEA,SAASH,sBAAsBA,CAC3BN,IAAoC,EACpCC,MAAe,EACfG,KAAwB,EACxBD,YAA0B;EAE1B,MAAMO,WAAW,GAAGN,KAAK,CAACO,QAAQ,EAAE,CAACC,YAAY;EAEjD,IAAI,CAACR,KAAK,CAACS,OAAO,CAACC,kBAA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YAAY,CAACa,OAAO,EAAE;;EAG1B,OAAO,EAAAC,mBAAA,GAAAd,YAAY,CAACJ,KAAK,CAAC,cAAAkB,mBAAA,uBAAnBA,mBAAA,CAAqB5B,EAAE,MAAKnB,IAAI,CAACgB,GAAG,CAACG,EAAE;AAClD;MAEa6B,uBAAuB,GAAG;SAEvBC,cAAcA,CAACC,KAAa;EACxC,IAAIA,KAAK,KAAKzC,SAAS,EAAE;IACrB,OAAO,KAAK;;EAGhB,OAAO0C,MAAM,CAACD,KAAK,CAAC,CAACE,UAAU,CAACJ,uBAAuB,CAAC;AAC5D;MAEaK,QAAQ,GAAG;EAAEC,GAAG,EAAE,GAAG;EAAEC,IAAI,EAAE,IAAI;EAAEC,KAAK,EAAE;;;;;"}
1
+ {"version":3,"file":"editing.js","sources":["../../../../../../../../src/components/Table3/util/editing.ts"],"sourcesContent":["import React from 'react';\nimport { Cell as ReactTableCell, Row as ReactTableRow, Table as ReactTable } from '@tanstack/react-table';\nimport { TableFilterValue, TableRef } from '../../../primitives/Table/types';\nimport { columnFilterFn } from '../../../primitives/Table/useTableManager/util/filtering';\nimport { globalFilterFn } from '../../../primitives/Table/useTableManager/util/search';\nimport { Localization } from '../../Provider/Localization';\n\nexport function willRowMove<TType = unknown>(\n cell: ReactTableCell<TType, unknown>,\n change: unknown,\n rowIndex: number,\n localization: Localization\n) {\n const { table } = cell.getContext();\n\n if (willRowMoveAfterSearch<TType>(cell, change, table, localization)) {\n return 'search';\n } else if (willRowMoveAfterFilter<TType>(cell, change)) {\n return 'filter';\n } else if (willRowMoveAfterSorting<TType>(cell, change, rowIndex)) {\n return 'sorting';\n }\n\n return undefined;\n}\n\nfunction willRowMoveAfterSearch<TType = unknown>(\n cell: ReactTableCell<TType, unknown>,\n change: unknown,\n table: ReactTable<TType>,\n localization: Localization\n) {\n const searchQuery = table.getState().globalFilter;\n\n if (!table.options.enableGlobalFilter || !searchQuery) {\n return false;\n }\n\n const rowWithChange = { ...cell.row, original: { ...cell.row.original, [cell.column.id]: change } };\n return !globalFilterFn(rowWithChange, cell.column.id, searchQuery, localization);\n}\n\nfunction willRowMoveAfterFilter<TType = unknown>(cell: ReactTableCell<TType, unknown>, change: unknown) {\n if (!cell.column.getIsFiltered()) {\n return false;\n }\n\n return !columnFilterFn(change, cell.column.getFilterValue() as TableFilterValue);\n}\n\nfunction willRowMoveAfterSorting<TType = unknown>(cell: ReactTableCell<TType, unknown>, change: unknown, rowIndex: number) {\n if (!cell.column.getIsSorted()) {\n return false;\n }\n\n const { table } = cell.getContext();\n const rows = table.getRowModel().rows;\n\n const miniSortRows: ReactTableRow<TType>[] = [\n {\n ...cell.row,\n original: {\n ...cell.row.original,\n [cell.column.id]: change,\n },\n getValue: () => change as any,\n },\n ];\n\n let index = 0;\n\n if (rowIndex > 0) {\n miniSortRows.unshift(rows[rowIndex - 1]);\n index = 1;\n }\n\n if (rowIndex < rows.length - 1) {\n miniSortRows.push(rows[rowIndex + 1]);\n }\n\n const resortedRows = [...miniSortRows].sort((rowA, rowB) => {\n const sortFn = cell.column.getSortingFn();\n const sortUndefined = cell.column.columnDef.sortUndefined;\n\n if (!table.options.manualSorting && sortUndefined) {\n const aValue = rowA.getValue(cell.column.id);\n const bValue = rowB.getValue(cell.column.id);\n\n const aUndefined = aValue === undefined;\n const bUndefined = bValue === undefined;\n\n if (aUndefined || bUndefined) {\n if (sortUndefined === 'first') return aUndefined ? -1 : 1;\n if (sortUndefined === 'last') return aUndefined ? 1 : -1;\n\n return aUndefined && bUndefined ? 0 : aUndefined ? sortUndefined : -sortUndefined;\n }\n }\n\n return sortFn(rowA, rowB, cell.column.id);\n });\n\n if (cell.column.getIsSorted() === 'desc') {\n resortedRows.reverse();\n }\n\n return resortedRows[index]?.id !== cell.row.id;\n}\n\nexport const TEMPORARY_ROW_ID_PREFIX = 'temp-';\n\nexport function isTemporaryRow(rowId: string) {\n if (rowId === undefined) {\n return false;\n }\n\n return String(rowId).startsWith(TEMPORARY_ROW_ID_PREFIX);\n}\n\nexport const shortcut = { key: 'e', meta: true, shift: false };\n\nexport function isTableScrolled(ref: React.RefObject<TableRef>) {\n if (ref.current) {\n const height =\n parseFloat(ref.current?.querySelector('tbody')?.style.height || '0') +\n parseFloat(ref.current?.querySelector('tbody')?.style.paddingBottom || '0');\n\n return height > ref.current.scrollHeight;\n }\n\n return false;\n}\n"],"names":["willRowMove","cell","change","rowIndex","localization","table","getContext","willRowMoveAfterSearch","willRowMoveAfterFilter","willRowMoveAfterSorting","undefined","searchQuery","getState","globalFilter","options","enableGlobalFilter","rowWithChange","row","original","column","id","globalFilterFn","getIsFiltered","columnFilterFn","getFilterValue","getIsSorted","rows","getRowModel","miniSortRows","getValue","index","unshift","length","push","resortedRows","sort","rowA","rowB","sortFn","getSortingFn","sortUndefined","columnDef","manualSorting","aValue","bValue","aUndefined","bUndefined","reverse","_resortedRows$index","TEMPORARY_ROW_ID_PREFIX","isTemporaryRow","rowId","String","startsWith","shortcut","key","meta","shift","isTableScrolled","ref","current","_ref$current","_ref$current$querySel","_ref$current2","_ref$current2$querySe","height","parseFloat","querySelector","style","paddingBottom","scrollHeight"],"mappings":";;;SAOgBA,WAAWA,CACvBC,IAAoC,EACpCC,MAAe,EACfC,QAAgB,EAChBC,YAA0B;EAE1B,MAAM;IAAEC;GAAO,GAAGJ,IAAI,CAACK,UAAU,EAAE;EAEnC,IAAIC,sBAAsB,CAAQN,IAAI,EAAEC,MAAM,EAAEG,KAAK,EAAED,YAAY,CAAC,EAAE;IAClE,OAAO,QAAQ;GAClB,MAAM,IAAII,sBAAsB,CAAQP,IAAI,EAAEC,MAAM,CAAC,EAAE;IACpD,OAAO,QAAQ;GAClB,MAAM,IAAIO,uBAAuB,CAAQR,IAAI,EAAEC,MAAM,EAAEC,QAAQ,CAAC,EAAE;IAC/D,OAAO,SAAS;;EAGpB,OAAOO,SAAS;AACpB;AAEA,SAASH,sBAAsBA,CAC3BN,IAAoC,EACpCC,MAAe,EACfG,KAAwB,EACxBD,YAA0B;EAE1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+25,16 @@ const Tag = /*#__PURE__*/React__default.forwardRef((props, ref) => {
25
25
  ref: ref,
26
26
  "data-taco": "tag"
27
27
  }), /*#__PURE__*/React__default.createElement("span", {
28
- className: "truncate px-2",
28
+ className: "flex items-center truncate px-2",
29
29
  ref: textRef
30
30
  }, icon ? typeof icon === 'string' ? (/*#__PURE__*/React__default.createElement(Icon, {
31
31
  name: icon,
32
- className: "-ml-1 -mt-0.5 mr-1 !h-5 !w-5"
32
+ className: "-ml-1 mr-1 !h-5 !w-5"
33
33
  })) : (/*#__PURE__*/React__default.cloneElement(icon, {
34
- className: 'mr-1 -ml-1 -mt-0.5 !h-5 !w-5'
35
- })) : null, children), onDelete ? (/*#__PURE__*/React__default.createElement(Icon, {
34
+ className: 'mr-1 -ml-1 !h-5 !w-5'
35
+ })) : null, /*#__PURE__*/React__default.createElement("span", {
36
+ className: "truncate"
37
+ }, children)), onDelete ? (/*#__PURE__*/React__default.createElement(Icon, {
36
38
  name: "close",
37
39
  onClick: onDelete,
38
40
  className: "-ml-1.5 !h-6 !w-5 flex-shrink-0 cursor-pointer rounded-r p-0.5 hover:bg-black/5"
@@ -1 +1 @@
1
- {"version":3,"file":"Tag.js","sources":["../../../../../../../src/components/Tag/Tag.tsx"],"sourcesContent":["import React from 'react';\nimport cn from 'clsx';\nimport { Icon, IconName, IconProps } from '../Icon/Icon';\nimport { Color } from '../../types';\nimport { getSubtleColorShadeClasses } from '../../utils/tailwind';\n\nexport type TagProps = Omit<React.HTMLAttributes<HTMLSpanElement>, 'children'> & {\n children: string;\n color?: Color;\n disabled?: boolean;\n icon?: React.ReactElement<IconProps> | IconName;\n readOnly?: boolean;\n onDelete?: (event: React.MouseEvent<SVGSVGElement>) => void;\n};\n\nexport const Tag = React.forwardRef<HTMLSpanElement, TagProps>((props, ref) => {\n const { children, color, disabled, icon, readOnly, onDelete, ...otherProps } = props;\n const textRef = React.useRef<HTMLDivElement>(null);\n\n const className = cn(\n 'inline-flex items-center rounded h-6 cursor-default',\n {\n 'opacity-50': disabled,\n 'hover:bg-opacity-75': !disabled,\n 'cursor-pointer': !!otherProps.onClick,\n 'pointer-events-none': disabled || readOnly,\n },\n getSubtleColorShadeClasses(color),\n props.className\n );\n\n return (\n <span {...otherProps} className={className} ref={ref} data-taco=\"tag\">\n <span className=\"truncate px-2\" ref={textRef}>\n {icon ? (\n typeof icon === 'string' ? (\n <Icon name={icon} className=\"-ml-1 -mt-0.5 mr-1 !h-5 !w-5\" />\n ) : (\n React.cloneElement(icon, { className: 'mr-1 -ml-1 -mt-0.5 !h-5 !w-5' })\n )\n ) : null}\n {children}\n </span>\n {onDelete ? (\n <Icon\n name=\"close\"\n onClick={onDelete}\n className=\"-ml-1.5 !h-6 !w-5 flex-shrink-0 cursor-pointer rounded-r p-0.5 hover:bg-black/5\"\n />\n ) : null}\n </span>\n );\n});\n"],"names":["Tag","React","forwardRef","props","ref","children","color","disabled","icon","readOnly","onDelete","otherProps","textRef","useRef","className","cn","onClick","getSubtleColorShadeClasses","Icon","name","cloneElement"],"mappings":";;;;;MAeaA,GAAG,gBAAGC,cAAK,CAACC,UAAU,CAA4B,CAACC,KAAK,EAAEC,GAAG;EACtE,MAAM;IAAEC,QAAQ;IAAEC,KAAK;IAAEC,QAAQ;IAAEC,IAAI;IAAEC,QAAQ;IAAEC,QAAQ;IAAE,GAAGC;GAAY,GAAGR,KAAK;EACpF,MAAMS,OAAO,GAAGX,cAAK,CAACY,MAAM,CAAiB,IAAI,CAAC;EAElD,MAAMC,SAAS,GAAGC,EAAE,CAChB,qDAAqD,EACrD;IACI,YAAY,EAAER,QAAQ;IACtB,qBAAqB,EAAE,CAACA,QAAQ;IAChC,gBAAgB,EAAE,CAAC,CAACI,UAAU,CAACK,OAAO;IACtC,qBAAqB,EAAET,QAAQ,IAAIE;GACtC,EACDQ,0BAA0B,CAACX,KAAK,CAAC,EACjCH,KAAK,CAACW,SAAS,CAClB;EAED,oBACIb,uDAAUU,UAAU;IAAEG,SAAS,EAAEA,SAAS;IAAEV,GAAG,EAAEA,GAAG;iBAAY;mBAC5DH;IAAMa,SAAS,EAAC,eAAe;IAACV,GAAG,EAAEQ;KAChCJ,IAAI,GACD,OAAOA,IAAI,KAAK,QAAQ,iBACpBP,6BAACiB,IAAI;IAACC,IAAI,EAAEX,IAAI;IAAEM,SAAS,EAAC;IAAiC,kBAE7Db,cAAK,CAACmB,YAAY,CAACZ,IAAI,EAAE;IAAEM,SAAS,EAAE;GAAgC,CAAC,CAC1E,GACD,IAAI,EACPT,QAAQ,CACN,EACNK,QAAQ,iBACLT,6BAACiB,IAAI;IACDC,IAAI,EAAC,OAAO;IACZH,OAAO,EAAEN,QAAQ;IACjBI,SAAS,EAAC;IACZ,IACF,IAAI,CACL;AAEf,CAAC;;;;"}
1
+ {"version":3,"file":"Tag.js","sources":["../../../../../../../src/components/Tag/Tag.tsx"],"sourcesContent":["import React from 'react';\nimport cn from 'clsx';\nimport { Icon, IconName, IconProps } from '../Icon/Icon';\nimport { Color } from '../../types';\nimport { getSubtleColorShadeClasses } from '../../utils/tailwind';\n\nexport type TagProps = Omit<React.HTMLAttributes<HTMLSpanElement>, 'children'> & {\n children: string;\n color?: Color;\n disabled?: boolean;\n icon?: React.ReactElement<IconProps> | IconName;\n readOnly?: boolean;\n onDelete?: (event: React.MouseEvent<SVGSVGElement>) => void;\n};\n\nexport const Tag = React.forwardRef<HTMLSpanElement, TagProps>((props, ref) => {\n const { children, color, disabled, icon, readOnly, onDelete, ...otherProps } = props;\n const textRef = React.useRef<HTMLDivElement>(null);\n\n const className = cn(\n 'inline-flex items-center rounded h-6 cursor-default',\n {\n 'opacity-50': disabled,\n 'hover:bg-opacity-75': !disabled,\n 'cursor-pointer': !!otherProps.onClick,\n 'pointer-events-none': disabled || readOnly,\n },\n getSubtleColorShadeClasses(color),\n props.className\n );\n\n return (\n <span {...otherProps} className={className} ref={ref} data-taco=\"tag\">\n <span className=\"flex items-center truncate px-2\" ref={textRef}>\n {icon ? (\n typeof icon === 'string' ? (\n <Icon name={icon} className=\"-ml-1 mr-1 !h-5 !w-5\" />\n ) : (\n React.cloneElement(icon, { className: 'mr-1 -ml-1 !h-5 !w-5' })\n )\n ) : null}\n <span className=\"truncate\">{children}</span>\n </span>\n {onDelete ? (\n <Icon\n name=\"close\"\n onClick={onDelete}\n className=\"-ml-1.5 !h-6 !w-5 flex-shrink-0 cursor-pointer rounded-r p-0.5 hover:bg-black/5\"\n />\n ) : null}\n </span>\n );\n});\n"],"names":["Tag","React","forwardRef","props","ref","children","color","disabled","icon","readOnly","onDelete","otherProps","textRef","useRef","className","cn","onClick","getSubtleColorShadeClasses","Icon","name","cloneElement"],"mappings":";;;;;MAeaA,GAAG,gBAAGC,cAAK,CAACC,UAAU,CAA4B,CAACC,KAAK,EAAEC,GAAG;EACtE,MAAM;IAAEC,QAAQ;IAAEC,KAAK;IAAEC,QAAQ;IAAEC,IAAI;IAAEC,QAAQ;IAAEC,QAAQ;IAAE,GAAGC;GAAY,GAAGR,KAAK;EACpF,MAAMS,OAAO,GAAGX,cAAK,CAACY,MAAM,CAAiB,IAAI,CAAC;EAElD,MAAMC,SAAS,GAAGC,EAAE,CAChB,qDAAqD,EACrD;IACI,YAAY,EAAER,QAAQ;IACtB,qBAAqB,EAAE,CAACA,QAAQ;IAChC,gBAAgB,EAAE,CAAC,CAACI,UAAU,CAACK,OAAO;IACtC,qBAAqB,EAAET,QAAQ,IAAIE;GACtC,EACDQ,0BAA0B,CAACX,KAAK,CAAC,EACjCH,KAAK,CAACW,SAAS,CAClB;EAED,oBACIb,uDAAUU,UAAU;IAAEG,SAAS,EAAEA,SAAS;IAAEV,GAAG,EAAEA,GAAG;iBAAY;mBAC5DH;IAAMa,SAAS,EAAC,iCAAiC;IAACV,GAAG,EAAEQ;KAClDJ,IAAI,GACD,OAAOA,IAAI,KAAK,QAAQ,iBACpBP,6BAACiB,IAAI;IAACC,IAAI,EAAEX,IAAI;IAAEM,SAAS,EAAC;IAAyB,kBAErDb,cAAK,CAACmB,YAAY,CAACZ,IAAI,EAAE;IAAEM,SAAS,EAAE;GAAwB,CAAC,CAClE,GACD,IAAI,eACRb;IAAMa,SAAS,EAAC;KAAYT,QAAQ,CAAQ,CACzC,EACNK,QAAQ,iBACLT,6BAACiB,IAAI;IACDC,IAAI,EAAC,OAAO;IACZH,OAAO,EAAEN,QAAQ;IACjBI,SAAS,EAAC;IACZ,IACF,IAAI,CACL;AAEf,CAAC;;;;"}
@@ -29,6 +29,7 @@ function TableGrid(props) {
29
29
  var _table$state$grouping;
30
30
  const {
31
31
  enableHorizontalArrowKeyNavigation,
32
+ footerRows,
32
33
  table,
33
34
  ...attributes
34
35
  } = props;
@@ -71,7 +72,7 @@ function TableGrid(props) {
71
72
  } : table.renderer.style
72
73
  }, table.renderer.rows, props.children), table.meta.footer.isEnabled ? /*#__PURE__*/React__default.createElement(Foot, {
73
74
  table: table.instance
74
- }) : null)))));
75
+ }, footerRows) : null)))));
75
76
  }
76
77
 
77
78
  export { Table, TableGrid };
@@ -1 +1 @@
1
- {"version":3,"file":"Table.js","sources":["../../../../../../../../src/primitives/Table/Core/Table.tsx"],"sourcesContent":["import React from 'react';\nimport { FocusScope } from '@react-aria/focus';\nimport { Header } from './components/Header/Header';\nimport { Body } from './components/Body/Body';\nimport { Foot } from './components/Footer/Footer';\nimport { EmptyStateBody } from './components/Body/EmptyStateBody';\nimport { useTableReturnValue } from './useTable';\nimport { TableToolbar } from './components/Toolbar/Toolbar';\nimport { TableEmptyStateReason } from '../types';\nimport { ROW_HEIGHT_ESTIMATES } from './util/rows';\nimport './style.css';\n\ntype TableProps = {\n children: JSX.Element | Array<JSX.Element | null>;\n};\n\nexport function Table(props: TableProps) {\n return <>{props.children}</>;\n}\nTable.Toolbar = TableToolbar;\nTable.Grid = TableGrid;\n\nexport type TableGridProps<TType = unknown> = React.TableHTMLAttributes<HTMLTableElement> & {\n 'data-taco': string;\n enableHorizontalArrowKeyNavigation?: boolean;\n table: useTableReturnValue<TType>;\n};\n\nfunction getEmptyStateReason<TType = unknown>(table: useTableReturnValue<TType>): TableEmptyStateReason | null {\n if (table.instance.getFilteredRowModel().rows.length === 0 && table.instance.getCoreRowModel().rows.length !== 0) {\n const state = table.instance.getState();\n\n if (table.meta.search.enableGlobalFilter && !!state.globalFilter) {\n return 'searching';\n }\n\n return 'filtering';\n }\n if (table.instance.getCoreRowModel().rows.length === 0) {\n return 'empty';\n }\n\n return null;\n}\n\nexport function TableGrid<TType = unknown>(props: TableGridProps<TType>) {\n const { enableHorizontalArrowKeyNavigation, table, ...attributes } = props;\n const handleFocus =\n table.meta.rowActive.rowActiveIndex === undefined\n ? (event: React.FocusEvent) => {\n table.meta.rowActive.handleFocus(event, table.meta.length, table.renderer.scrollToIndex);\n }\n : undefined;\n const emptyStateReason = getEmptyStateReason(table);\n\n return (\n <>\n <style>{table.stylesheet}</style>\n <FocusScope>\n <table\n {...attributes}\n id={table.id}\n data-table-font-size={table.meta.fontSize.size}\n data-table-grouped={!!table.state.grouping?.length}\n data-table-horizontally-scrolled={table.meta.columnFreezing.isHorizontallyScrolled ? true : undefined}\n data-table-status={table.meta.server.isEnabled ? (table.meta.server.isReady ? 'ready' : undefined) : 'ready'}\n data-table-pause-hover={table.meta.rowActive.isHoverStatePaused ? true : undefined}\n data-table-resizing={table.state.columnSizingInfo.isResizingColumn ? true : undefined}\n data-table-row-height={table.meta.rowHeight.height}\n onFocus={handleFocus}\n onScroll={table.meta.columnFreezing.handleScroll}\n ref={table.ref}\n style={table.style}\n tabIndex={-1}>\n <thead>\n {table.instance.getHeaderGroups().map(headerGroup => (\n <tr key={headerGroup.id}>\n {headerGroup.headers.map(props => (\n <Header key={props.id} header={props} scrollToIndex={table.renderer.scrollToIndex} />\n ))}\n </tr>\n ))}\n </thead>\n {emptyStateReason ? (\n <EmptyStateBody\n emptyState={props.table.props.emptyState}\n isReady={table.meta.server.isEnabled ? table.meta.server.isReady : true}\n reason={emptyStateReason}\n />\n ) : (\n <>\n <Body\n enableHorizontalArrowKeyNavigation={enableHorizontalArrowKeyNavigation}\n table={table.instance}\n tableElement={table.ref.current}\n scrollToIndex={table.renderer.scrollToIndex}\n style={\n props.children\n ? {\n ...table.renderer.style,\n height:\n (table.renderer.style.height as number) +\n ROW_HEIGHT_ESTIMATES[table.meta.rowHeight.height],\n }\n : table.renderer.style\n }>\n {table.renderer.rows}\n {props.children}\n </Body>\n {table.meta.footer.isEnabled ? <Foot table={table.instance} /> : null}\n </>\n )}\n </table>\n </FocusScope>\n </>\n );\n}\n"],"names":["Table","props","React","children","Toolbar","TableToolbar","Grid","TableGrid","getEmptyStateReason","table","instance","getFilteredRowModel","rows","length","getCoreRowModel","state","getState","meta","search","enableGlobalFilter","globalFilter","enableHorizontalArrowKeyNavigation","attributes","handleFocus","rowActive","rowActiveIndex","undefined","event","renderer","scrollToIndex","emptyStateReason","stylesheet","FocusScope","id","fontSize","size","_table$state$grouping","grouping","columnFreezing","isHorizontallyScrolled","server","isEnabled","isReady","isHoverStatePaused","columnSizingInfo","isResizingColumn","rowHeight","height","onFocus","onScroll","handleScroll","ref","style","tabIndex","getHeaderGroups","map","headerGroup","key","headers","Header","header","EmptyStateBody","emptyState","reason","Body","tableElement","current","ROW_HEIGHT_ESTIMATES","footer","Foot"],"mappings":";;;;;;;;;SAgBgBA,KAAKA,CAACC,KAAiB;EACnC,oBAAOC,4DAAGD,KAAK,CAACE,QAAQ,CAAI;AAChC;AACAH,KAAK,CAACI,OAAO,GAAGC,YAAY;AAC5BL,KAAK,CAACM,IAAI,GAAGC,SAAS;AAQtB,SAASC,mBAAmBA,CAAkBC,KAAiC;EAC3E,IAAIA,KAAK,CAACC,QAAQ,CAACC,mBAAmB,EAAE,CAACC,IAAI,CAACC,MAAM,KAAK,CAAC,IAAIJ,KAAK,CAACC,QAAQ,CAACI,eAAe,EAAE,CAACF,IAAI,CAACC,MAAM,KAAK,CAAC,EAAE;IAC9G,MAAME,KAAK,GAAGN,KAAK,CAACC,QAAQ,CAACM,QAAQ,EAAE;IAEv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rC,aAAa,EAAEpB,KAAK,CAACmB,QAAQ,CAACC,aAAa;IAC3CuB,KAAK,EACDnD,KAAK,CAACE,QAAQ,GACR;MACI,GAAGM,KAAK,CAACmB,QAAQ,CAACwB,KAAK;MACvBL,MAAM,EACDtC,KAAK,CAACmB,QAAQ,CAACwB,KAAK,CAACL,MAAiB,GACvCoB,oBAAoB,CAAC1D,KAAK,CAACQ,IAAI,CAAC6B,SAAS,CAACC,MAAM;KACvD,GACDtC,KAAK,CAACmB,QAAQ,CAACwB;KAExB3C,KAAK,CAACmB,QAAQ,CAAChB,IAAI,EACnBX,KAAK,CAACE,QAAQ,CACZ,EACNM,KAAK,CAACQ,IAAI,CAACmD,MAAM,CAAC3B,SAAS,gBAAGvC,6BAACmE,IAAI;IAAC5D,KAAK,EAAEA,KAAK,CAACC;IAAY,GAAG,IAAI,CACtE,CACN,CACG,CACC,CACd;AAEX;;;;"}
1
+ {"version":3,"file":"Table.js","sources":["../../../../../../../../src/primitives/Table/Core/Table.tsx"],"sourcesContent":["import React from 'react';\nimport { FocusScope } from '@react-aria/focus';\nimport { Header } from './components/Header/Header';\nimport { Body } from './components/Body/Body';\nimport { Foot } from './components/Footer/Footer';\nimport { EmptyStateBody } from './components/Body/EmptyStateBody';\nimport { useTableReturnValue } from './useTable';\nimport { TableToolbar } from './components/Toolbar/Toolbar';\nimport { TableEmptyStateReason } from '../types';\nimport { ROW_HEIGHT_ESTIMATES } from './util/rows';\nimport './style.css';\n\ntype TableProps = {\n children: JSX.Element | Array<JSX.Element | null>;\n};\n\nexport function Table(props: TableProps) {\n return <>{props.children}</>;\n}\nTable.Toolbar = TableToolbar;\nTable.Grid = TableGrid;\n\nexport type TableGridProps<TType = unknown> = React.TableHTMLAttributes<HTMLTableElement> & {\n 'data-taco': string;\n enableHorizontalArrowKeyNavigation?: boolean;\n footerRows?: null | JSX.Element | JSX.Element[];\n table: useTableReturnValue<TType>;\n};\n\nfunction getEmptyStateReason<TType = unknown>(table: useTableReturnValue<TType>): TableEmptyStateReason | null {\n if (table.instance.getFilteredRowModel().rows.length === 0 && table.instance.getCoreRowModel().rows.length !== 0) {\n const state = table.instance.getState();\n\n if (table.meta.search.enableGlobalFilter && !!state.globalFilter) {\n return 'searching';\n }\n\n return 'filtering';\n }\n if (table.instance.getCoreRowModel().rows.length === 0) {\n return 'empty';\n }\n\n return null;\n}\n\nexport function TableGrid<TType = unknown>(props: TableGridProps<TType>) {\n const { enableHorizontalArrowKeyNavigation, footerRows, table, ...attributes } = props;\n const handleFocus =\n table.meta.rowActive.rowActiveIndex === undefined\n ? (event: React.FocusEvent) => {\n table.meta.rowActive.handleFocus(event, table.meta.length, table.renderer.scrollToIndex);\n }\n : undefined;\n const emptyStateReason = getEmptyStateReason(table);\n\n return (\n <>\n <style>{table.stylesheet}</style>\n <FocusScope>\n <table\n {...attributes}\n id={table.id}\n data-table-font-size={table.meta.fontSize.size}\n data-table-grouped={!!table.state.grouping?.length}\n data-table-horizontally-scrolled={table.meta.columnFreezing.isHorizontallyScrolled ? true : undefined}\n data-table-status={table.meta.server.isEnabled ? (table.meta.server.isReady ? 'ready' : undefined) : 'ready'}\n data-table-pause-hover={table.meta.rowActive.isHoverStatePaused ? true : undefined}\n data-table-resizing={table.state.columnSizingInfo.isResizingColumn ? true : undefined}\n data-table-row-height={table.meta.rowHeight.height}\n onFocus={handleFocus}\n onScroll={table.meta.columnFreezing.handleScroll}\n ref={table.ref}\n style={table.style}\n tabIndex={-1}>\n <thead>\n {table.instance.getHeaderGroups().map(headerGroup => (\n <tr key={headerGroup.id}>\n {headerGroup.headers.map(props => (\n <Header key={props.id} header={props} scrollToIndex={table.renderer.scrollToIndex} />\n ))}\n </tr>\n ))}\n </thead>\n {emptyStateReason ? (\n <EmptyStateBody\n emptyState={props.table.props.emptyState}\n isReady={table.meta.server.isEnabled ? table.meta.server.isReady : true}\n reason={emptyStateReason}\n />\n ) : (\n <>\n <Body\n enableHorizontalArrowKeyNavigation={enableHorizontalArrowKeyNavigation}\n table={table.instance}\n tableElement={table.ref.current}\n scrollToIndex={table.renderer.scrollToIndex}\n style={\n props.children\n ? {\n ...table.renderer.style,\n height:\n (table.renderer.style.height as number) +\n ROW_HEIGHT_ESTIMATES[table.meta.rowHeight.height],\n }\n : table.renderer.style\n }>\n {table.renderer.rows}\n {props.children}\n </Body>\n {table.meta.footer.isEnabled ? <Foot table={table.instance}>{footerRows}</Foot> : null}\n </>\n )}\n </table>\n </FocusScope>\n </>\n );\n}\n"],"names":["Table","props","React","children","Toolbar","TableToolbar","Grid","TableGrid","getEmptyStateReason","table","instance","getFilteredRowModel","rows","length","getCoreRowModel","state","getState","meta","search","enableGlobalFilter","globalFilter","enableHorizontalArrowKeyNavigation","footerRows","attributes","handleFocus","rowActive","rowActiveIndex","undefined","event","renderer","scrollToIndex","emptyStateReason","stylesheet","FocusScope","id","fontSize","size","_table$state$grouping","grouping","columnFreezing","isHorizontallyScrolled","server","isEnabled","isReady","isHoverStatePaused","columnSizingInfo","isResizingColumn","rowHeight","height","onFocus","onScroll","handleScroll","ref","style","tabIndex","getHeaderGroups","map","headerGroup","key","headers","Header","header","EmptyStateBody","emptyState","reason","Body","tableElement","current","ROW_HEIGHT_ESTIMATES","footer","Foot"],"mappings":";;;;;;;;;SAgBgBA,KAAKA,CAACC,KAAiB;EACnC,oBAAOC,4DAAGD,KAAK,CAACE,QAAQ,CAAI;AAChC;AACAH,KAAK,CAACI,OAAO,GAAGC,YAAY;AAC5BL,KAAK,CAACM,IAAI,GAAGC,SAAS;AAStB,SAASC,mBAAmBA,CAAkBC,KAAiC;EAC3E,IAAIA,KAAK,CAACC,QAAQ,CAACC,mBAAmB,EAAE,CAACC,IAAI,CAACC,MAAM,KAAK,CAAC,IAAIJ,KAAK,CAACC,QAAQ,CAACI,eAAe,EAAE,CAACF,IAAI,CAACC,MAAM,KAAK,CAAC,EAAE;IAC9G,MAAME,KAAK,GAAGN,KAAK,CAACC,QAAQ,CAACM,QAAQ,EAAE;IAEvC,IAAIP,K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O;IAC/BrC,aAAa,EAAErB,KAAK,CAACoB,QAAQ,CAACC,aAAa;IAC3CuB,KAAK,EACDpD,KAAK,CAACE,QAAQ,GACR;MACI,GAAGM,KAAK,CAACoB,QAAQ,CAACwB,KAAK;MACvBL,MAAM,EACDvC,KAAK,CAACoB,QAAQ,CAACwB,KAAK,CAACL,MAAiB,GACvCoB,oBAAoB,CAAC3D,KAAK,CAACQ,IAAI,CAAC8B,SAAS,CAACC,MAAM;KACvD,GACDvC,KAAK,CAACoB,QAAQ,CAACwB;KAExB5C,KAAK,CAACoB,QAAQ,CAACjB,IAAI,EACnBX,KAAK,CAACE,QAAQ,CACZ,EACNM,KAAK,CAACQ,IAAI,CAACoD,MAAM,CAAC3B,SAAS,gBAAGxC,6BAACoE,IAAI;IAAC7D,KAAK,EAAEA,KAAK,CAACC;KAAWY,UAAU,CAAQ,GAAG,IAAI,CACvF,CACN,CACG,CACC,CACd;AAEX;;;;"}
@@ -11,6 +11,10 @@ function Header(context) {
11
11
  const {
12
12
  table
13
13
  } = context;
14
+ const tableMeta = table.options.meta;
15
+ if (!tableMeta.rowExpansion.canExpandAll) {
16
+ return null;
17
+ }
14
18
  const isSomeRowsExpanded = table.getIsSomeRowsExpanded();
15
19
  const handleClick = event => {
16
20
  event.stopPropagation();
@@ -1 +1 @@
1
- {"version":3,"file":"Expansion.js","sources":["../../../../../../../../../../../src/primitives/Table/Core/components/Columns/Internal/Expansion.tsx"],"sourcesContent":["import React from 'react';\nimport {\n HeaderContext as ReactTableHeaderContext,\n CellContext as ReactTableCellContext,\n TableMeta as ReactTableMeta,\n} from '@tanstack/react-table';\nimport { useLocalization } from '../../../../../../components/Provider/Localization';\nimport { Tooltip } from '../../../../../../components/Tooltip/Tooltip';\nimport { IconButton } from '../../../../../../components/IconButton/IconButton';\nimport { useTableManagerInternalColumn } from '../../../../useTableManager/types';\nimport { RowContext } from '../../Row/RowContext';\n\nfunction Header<TType = unknown>(context: ReactTableHeaderContext<TType, unknown>) {\n const { texts } = useLocalization();\n const { table } = context;\n\n const isSomeRowsExpanded = table.getIsSomeRowsExpanded();\n\n const handleClick = event => {\n event.stopPropagation();\n table.toggleAllRowsExpanded(!isSomeRowsExpanded);\n };\n\n const title = isSomeRowsExpanded ? texts.table.columns.expansion.collapseAll : texts.table.columns.expansion.expandAll;\n\n return (\n <Tooltip title={title}>\n <IconButton\n appearance=\"transparent\"\n icon={isSomeRowsExpanded ? 'chevron-down-double' : 'chevron-right-double'}\n onClick={handleClick}\n tabIndex={-1}\n title={title}\n />\n </Tooltip>\n );\n}\n\nfunction Cell<TType = unknown>(context: ReactTableCellContext<TType, unknown>) {\n const { texts } = useLocalization();\n const { hideInternalColumns } = React.useContext(RowContext);\n const tableMeta = context.table.options.meta as ReactTableMeta<TType>;\n\n if (hideInternalColumns) {\n return null;\n }\n\n const hasExpandedRow = tableMeta.rowExpansion.rowExpansionRenderer?.(context.row.original);\n\n if (hasExpandedRow) {\n const isActiveRow = tableMeta.rowActive.rowActiveIndex === context.row.index;\n const isExpanded = context.row.getIsExpanded();\n\n const handleClick = event => {\n event.stopPropagation();\n context.row.toggleExpanded();\n };\n\n const title = isExpanded ? texts.table.columns.expansion.collapse : texts.table.columns.expansion.expand;\n const tabIndex = isActiveRow ? 0 : -1;\n\n return (\n <Tooltip title={title}>\n <IconButton\n appearance=\"discrete\"\n icon={isExpanded ? 'chevron-down' : 'chevron-right'}\n onClick={handleClick}\n tabIndex={tabIndex}\n title={title}\n />\n </Tooltip>\n );\n }\n\n return null;\n}\n\nexport const renderer: useTableManagerInternalColumn = {\n header: Header,\n renderer: Cell,\n size: 40,\n meta: {\n align: 'center',\n // TODO: remove when table3 is migrated, this satisfies the legacy table3 type\n enableSearch: false,\n header: '',\n headerClassName: '!p-0',\n },\n};\n"],"names":["Header","context","texts","useLocalization","table","isSomeRowsExpanded","getIsSomeRowsExpanded","handleClick","event","stopPropagation","toggleAllRowsExpanded","title","columns","expansion","collapseAll","expandAll","React","Tooltip","IconButton","appearance","icon","onClick","tabIndex","Cell","hideInternalColumns","useContext","RowContext","tableMeta","options","meta","hasExpandedRow","_tableMeta$rowExpansi","_tableMeta$rowExpansi2","rowExpansion","rowExpansionRenderer","call","row","original","isActiveRow","rowActive","rowActiveIndex","index","isExpanded","getIsExpanded","toggleExpanded","collapse","expand","renderer","header","size","align","enableSearch","headerClassName"],"mappings":";;;;;;AAYA,SAASA,MAAMA,CAAkBC,OAAgD;EAC7E,MAAM;IAAEC;GAAO,GAAGC,eAAe,EAAE;EACnC,MAAM;IAAEC;GAAO,GAAGH,OAAO;EAEzB,MAAMI,kBAAkB,GAAGD,KAAK,CAACE,qBAAqB,EAAE;EAExD,MAAMC,WAAW,GAAGC,KAAK;IACrBA,KAAK,CAACC,eAAe,EAAE;IACvBL,KAAK,CAACM,qBAAqB,CAAC,CAACL,kBAAkB,CAAC;GACnD;EAED,MAAMM,KAAK,GAAGN,kBAAkB,GAAGH,KAAK,CAACE,KAAK,CAACQ,OAAO,CAACC,SAAS,CAACC,WAAW,GAAGZ,KAAK,CAACE,KAAK,CAACQ,OAAO,CAACC,SAAS,CAACE,SAAS;EAEtH,oBACIC,6BAACC,OAAO;IAACN,KAAK,EAAEA;kBACZK,6BAACE,UAAU;IACPC,UAAU,EAAC,aAAa;IACxBC,IAAI,EAAEf,kBAAkB,GAAG,qBAAqB,GAAG,sBAAsB;IACzEgB,OAAO,EAAEd,WAAW;IACpBe,QAAQ,EAAE,CAAC,CAAC;IACZX,KAAK,EAAEA;IACT,CACI;AAElB;AAEA,SAASY,IAAIA,CAAkBtB,OAA8C;;EACzE,MAAM;IAAEC;GAAO,GAAGC,eAAe,EAAE;EACnC,MAAM;IAAEqB;GAAqB,GAAGR,cAAK,CAACS,UAAU,CAACC,UAAU,CAAC;EAC5D,MAAMC,SAAS,GAAG1B,OAAO,CAACG,KAAK,CAACwB,OAAO,CAACC,IAA6B;EAErE,IAAIL,mBAAmB,EAAE;IACrB,OAAO,IAAI;;EAGf,MAAMM,cAAc,IA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../../../../../../../../../../../src/primitives/Table/Core/components/Columns/Internal/Expansion.tsx"],"sourcesContent":["import React from 'react';\nimport {\n HeaderContext as ReactTableHeaderContext,\n CellContext as ReactTableCellContext,\n TableMeta as ReactTableMeta,\n} from '@tanstack/react-table';\nimport { useLocalization } from '../../../../../../components/Provider/Localization';\nimport { Tooltip } from '../../../../../../components/Tooltip/Tooltip';\nimport { IconButton } from '../../../../../../components/IconButton/IconButton';\nimport { useTableManagerInternalColumn } from '../../../../useTableManager/types';\nimport { RowContext } from '../../Row/RowContext';\n\nfunction Header<TType = unknown>(context: ReactTableHeaderContext<TType, unknown>) {\n const { texts } = useLocalization();\n const { table } = context;\n const tableMeta = table.options.meta as ReactTableMeta<TType>;\n\n if (!tableMeta.rowExpansion.canExpandAll) {\n return null;\n }\n\n const isSomeRowsExpanded = table.getIsSomeRowsExpanded();\n\n const handleClick = event => {\n event.stopPropagation();\n table.toggleAllRowsExpanded(!isSomeRowsExpanded);\n };\n\n const title = isSomeRowsExpanded ? texts.table.columns.expansion.collapseAll : texts.table.columns.expansion.expandAll;\n\n return (\n <Tooltip title={title}>\n <IconButton\n appearance=\"transparent\"\n icon={isSomeRowsExpanded ? 'chevron-down-double' : 'chevron-right-double'}\n onClick={handleClick}\n tabIndex={-1}\n title={title}\n />\n </Tooltip>\n );\n}\n\nfunction Cell<TType = unknown>(context: ReactTableCellContext<TType, unknown>) {\n const { texts } = useLocalization();\n const { hideInternalColumns } = React.useContext(RowContext);\n const tableMeta = context.table.options.meta as ReactTableMeta<TType>;\n\n if (hideInternalColumns) {\n return null;\n }\n\n const hasExpandedRow = tableMeta.rowExpansion.rowExpansionRenderer?.(context.row.original);\n\n if (hasExpandedRow) {\n const isActiveRow = tableMeta.rowActive.rowActiveIndex === context.row.index;\n const isExpanded = context.row.getIsExpanded();\n\n const handleClick = event => {\n event.stopPropagation();\n context.row.toggleExpanded();\n };\n\n const title = isExpanded ? texts.table.columns.expansion.collapse : texts.table.columns.expansion.expand;\n const tabIndex = isActiveRow ? 0 : -1;\n\n return (\n <Tooltip title={title}>\n <IconButton\n appearance=\"discrete\"\n icon={isExpanded ? 'chevron-down' : 'chevron-right'}\n onClick={handleClick}\n tabIndex={tabIndex}\n title={title}\n />\n </Tooltip>\n );\n }\n\n return null;\n}\n\nexport const renderer: useTableManagerInternalColumn = {\n header: Header,\n renderer: Cell,\n size: 40,\n meta: {\n align: 'center',\n // TODO: remove when table3 is migrated, this satisfies the legacy table3 type\n enableSearch: false,\n header: '',\n headerClassName: '!p-0',\n },\n};\n"],"names":["Header","context","texts","useLocalization","table","tableMeta","options","meta","rowExpansion","canExpandAll","isSomeRowsExpanded","getIsSomeRowsExpanded","handleClick","event","stopPropagation","toggleAllRowsExpanded","title","columns","expansion","collapseAll","expandAll","React","Tooltip","IconButton","appearance","icon","onClick","tabIndex","Cell","hideInternalColumns","useContext","RowContext","hasExpandedRow","_tableMeta$rowExpansi","_tableMeta$rowExpansi2","rowExpansionRenderer","call","row","original","isActiveRow","rowActive","rowActiveIndex","index","isExpanded","getIsExpanded","toggleExpanded","collapse","expand","renderer","header","size","align","enableSearch","headerClassName"],"mappings":";;;;;;AAYA,SAASA,MAAMA,CAAkBC,OAAgD;EAC7E,MAAM;IAAEC;GAAO,GAAGC,eAAe,EAAE;EACnC,MAAM;IAAEC;GAAO,GAAGH,OAAO;EACzB,MAAMI,SAAS,GAAGD,KAAK,CAACE,OAAO,CAACC,IAA6B;EAE7D,IAAI,CAACF,SAAS,CAACG,YAAY,CAACC,YAAY,EAAE;IACtC,OAAO,IAAI;;EAGf,MAAMC,kBAAkB,GAAGN,KAAK,CAACO,qBAAqB,EAAE;EAExD,MAAMC,WAAW,GAAGC,KAAK;IACrBA,KAAK,CAACC,eAAe,EAAE;IACvBV,KAAK,CAACW,qBAAqB,CAAC,CAACL,kBAAkB,CAAC;GACnD;EAED,MAAMM,KAAK,GAAGN,kBAAkB,GAAGR,KAAK,CAACE,KAAK,CAACa,OAAO,CAACC,SAAS,CAACC,W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