@economic/taco 2.37.2 → 2.39.0
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/components/OverflowGroup/OverflowGroup.d.ts +1 -0
- package/dist/components/Select2/Select2.d.ts +6 -1
- package/dist/components/Select2/components/Context.d.ts +3 -1
- package/dist/components/Select2/types.d.ts +3 -1
- package/dist/components/Tabs/Tabs.d.ts +5 -0
- package/dist/esm/index.css +5 -1
- package/dist/esm/packages/taco/src/components/OverflowGroup/OverflowGroup.js +3 -1
- package/dist/esm/packages/taco/src/components/OverflowGroup/OverflowGroup.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Select2/Select2.js +10 -5
- package/dist/esm/packages/taco/src/components/Select2/Select2.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Select2/components/Context.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Select2/components/Create.js +35 -12
- package/dist/esm/packages/taco/src/components/Select2/components/Create.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Select2/components/Trigger.js +15 -17
- package/dist/esm/packages/taco/src/components/Select2/components/Trigger.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Select2/utilities.js +1 -1
- package/dist/esm/packages/taco/src/components/Select2/utilities.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/Row/Row.js +2 -1
- package/dist/esm/packages/taco/src/components/Table3/components/Row/Row.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/util/editing.js +7 -2
- package/dist/esm/packages/taco/src/components/Table3/util/editing.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Tabs/Tabs.js +12 -3
- package/dist/esm/packages/taco/src/components/Tabs/Tabs.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/Core/Table.js +2 -1
- package/dist/esm/packages/taco/src/primitives/Table/Core/Table.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/Core/components/Columns/Internal/Drag.js +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/Core/components/Columns/Internal/Drag.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/Core/components/Columns/Internal/Selection.js +8 -5
- package/dist/esm/packages/taco/src/primitives/Table/Core/components/Columns/Internal/Selection.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/Core/components/Header/Header.js +3 -0
- package/dist/esm/packages/taco/src/primitives/Table/Core/components/Header/Header.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/Core/components/Header/components/Resizer.js +15 -9
- package/dist/esm/packages/taco/src/primitives/Table/Core/components/Header/components/Resizer.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/Core/components/Row/BuiltIns/DisplayRow.js +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/Core/components/Row/BuiltIns/DisplayRow.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/Core/features/useTableRenderer.js +3 -4
- package/dist/esm/packages/taco/src/primitives/Table/Core/features/useTableRenderer.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/types.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/useTableManager/features/useTableRowSelection.js +4 -3
- package/dist/esm/packages/taco/src/primitives/Table/useTableManager/features/useTableRowSelection.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/useTableManager/listeners/useTableRowSelectionListener.js +7 -6
- package/dist/esm/packages/taco/src/primitives/Table/useTableManager/listeners/useTableRowSelectionListener.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/useTableManager/useTableManager.js +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/useTableManager/useTableManager.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/useTableManager/util/presets.js +2 -2
- package/dist/esm/packages/taco/src/primitives/Table/useTableManager/util/presets.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/useTableManager/util/setup.js +5 -2
- package/dist/esm/packages/taco/src/primitives/Table/useTableManager/util/setup.js.map +1 -1
- package/dist/esm/packages/taco/src/utils/dom.js +9 -1
- package/dist/esm/packages/taco/src/utils/dom.js.map +1 -1
- package/dist/index.css +5 -1
- package/dist/primitives/Table/Core/components/Header/Header.d.ts +1 -0
- package/dist/primitives/Table/Core/components/Header/components/Resizer.d.ts +1 -0
- package/dist/primitives/Table/Core/components/Toolbar/components/Filters/components/FilterColumn.d.ts +1 -1
- package/dist/primitives/Table/types.d.ts +4 -3
- package/dist/taco.cjs.development.js +137 -77
- package/dist/taco.cjs.development.js.map +1 -1
- package/dist/taco.cjs.production.min.js +1 -1
- package/dist/taco.cjs.production.min.js.map +1 -1
- package/dist/utils/dom.d.ts +1 -0
- package/package.json +2 -2
@@ -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 } 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, onClick, 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 // 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\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 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 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\">\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 key={String(open)} 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};\n\nconst MultipleValue = ({ valuesAsChildren, placeholder }: MultipleValueProps) => {\n const { disabled, open, readOnly, setValue, tags } = useSelect2Context();\n const [contentRef, setContentRef] = React.useState<HTMLDivElement | null>(null);\n const boundaryIndex = contentRef ? getIndexOfFirstChildOverflowingParent(contentRef, 30) : undefined;\n\n const createClickHandler = tagValue => event => {\n event?.stopPropagation();\n event?.preventDefault();\n\n if (!disabled && !readOnly) {\n setValue(tagValue);\n }\n };\n\n return (\n <div className=\"relative flex items-center gap-1 overflow-hidden\">\n <div className=\"flex gap-1 truncate\" ref={el => setContentRef(el)}>\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 onDelete={open ? createClickHandler(child.props.value) : undefined}\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","onClick","tabIndex","otherProps","fontSize","highlighted","invalid","open","getInputClasses","replace","getFontSize","_props$className","includes","handleClick","event","preventDefault","handleFocus","currentTarget","querySelector","_window$getSelection","_window$getSelection$","window","getSelection","selectAllChildren","call","onFocus","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","content","ScrollArea","length","child","key","String","onDelete","stopPropagation","MultipleValue","style","width","_buttonRef$current","current","offsetWidth","contentRef","setContentRef","useState","boundaryIndex","getIndexOfFirstChildOverflowingParent","createClickHandler","tagValue","el","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;KA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IACtB,OAAOA,KAAK,CAACsB,QAAQ,CAAC4C,KAAK,CAAC3E,KAAK,CAACS,KAAK,CAAC;;EAG5C,OAAOkE,KAAK,CAAC3E,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 } from '../../Badge/Badge';\nimport { getInputClasses } from '../../Input/util';\nimport { Select2OptionValue } from '../types';\nimport { useSelect2Context } from './Context';\nimport { Select2OptionProps } from './Option';\nimport { getIndexOfFirstChildOverflowingParent } 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, onClick, 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 // 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\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 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","onClick","tabIndex","otherProps","fontSize","highlighted","invalid","open","getInputClasses","replace","getFontSize","_props$className","includes","handleClick","event","preventDefault","handleFocus","currentTarget","querySelector","_window$getSelection","_window$getSelection$","window","getSelection","selectAllChildren","call","onFocus","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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,aAAa,EAAE;MACzB,oBACI3F,6BAACiG,OAAO;QAAClB,GAAG,EAAEC,MAAM,CAACF,KAAK,CAAC/E,KAAK,CAACS,KAAK,CAAC;QAAE0F,KAAK,EAAElB,MAAM,CAACF,KAAK,CAAC/E,KAAK,CAACmB,QAAQ;SACtE4E,GAAG,CACE;;IAIlB,OAAOA,GAAG;GACb,CACJ,CACC,EACLH,aAAa,KAAK9E,SAAS,IAAI8E,aAAa,KAAK,IAAI,IAAIA,aAAa,GAAGxB,gBAAgB,CAACU,MAAM,GAAG,CAAC,kBACjG7E,6BAACiG,OAAO;IACJC,KAAK,EAAE/B,gBAAgB,CAClBgC,KAAK,CAACR,aAAa,GAAG,CAAC,CAAC,CACxBvB,GAAG,CAACU,KAAK,IAAKA,KAAK,GAAGE,MAAM,CAACF,KAAK,CAAC/E,KAAK,CAACmB,QAAQ,CAAC,GAAG,EAAG,CAAC,CACzDkF,IAAI,CAAC,IAAI;kBACdpG,6BAACqG,KAAK;IAACpG,SAAS,EAAC;UAAkBkE,gBAAgB,CAACU,MAAM,IAAIc,aAAa,GAAG,CAAC,CAAC,CAAS,CACnF,IACV,IAAI,CACN;AAEd,CAAC;AAED,MAAMnC,YAAY,GAAIhD,KAA8B,IAAMsE,KAA8B;EACpF,IAAIpE,KAAK,CAACC,OAAO,CAACH,KAAK,CAAC,EAAE;IACtB,OAAOA,KAAK,CAACsB,QAAQ,CAACgD,KAAK,CAAC/E,KAAK,CAACS,KAAK,CAAC;;EAG5C,OAAOsE,KAAK,CAAC/E,KAAK,CAACS,KAAK,KAAKA,KAAK;AACtC,CAAC;;;;"}
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import cn from 'clsx';
|
2
2
|
import { FontSizes } from '../../types.js';
|
3
3
|
|
4
|
-
const createOptionClassName = (shouldPauseHoverState = false) => cn('group mb-px flex w-full text-sm flex-shrink-0 font-normal cursor-pointer items-center rounded bg-white px-2 leading-8 text-black aria-hidden:hidden gap-1.5 bg-white aria-current:wcag-grey-200 aria-disabled:text-black/25 aria-disabled:pointer-events-none', {
|
4
|
+
const createOptionClassName = (shouldPauseHoverState = false) => cn('group mb-px flex w-full text-sm flex-shrink-0 font-normal cursor-pointer items-center rounded bg-white px-2 leading-8 text-black aria-hidden:hidden gap-1.5 bg-white aria-current:wcag-grey-200 aria-disabled:text-black/25 aria-disabled:pointer-events-none !justify-normal', {
|
5
5
|
'hover:wcag-grey-200': !shouldPauseHoverState
|
6
6
|
});
|
7
7
|
const createCollectionClassName = () => 'flex flex-col gap-px';
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"utilities.js","sources":["../../../../../../../src/components/Select2/utilities.ts"],"sourcesContent":["import cn from 'clsx';\nimport { FontSize, FontSizes } from '../../types';\n\nexport const createOptionClassName = (shouldPauseHoverState = false) =>\n cn(\n 'group mb-px flex w-full text-sm flex-shrink-0 font-normal cursor-pointer items-center rounded bg-white px-2 leading-8 text-black aria-hidden:hidden gap-1.5 bg-white aria-current:wcag-grey-200 aria-disabled:text-black/25 aria-disabled:pointer-events-none',\n\n {\n 'hover:wcag-grey-200': !shouldPauseHoverState,\n }\n );\n\nexport const createCollectionClassName = () => 'flex flex-col gap-px';\n\nexport const getFontSize = (fontSize?: FontSize) => {\n switch (fontSize) {\n case FontSizes.small:\n return 'text-xs';\n\n case FontSizes.large:\n return 'text-base';\n\n case FontSizes.medium:\n default:\n return 'text-sm';\n }\n};\n"],"names":["createOptionClassName","shouldPauseHoverState","cn","createCollectionClassName","getFontSize","fontSize","FontSizes","small","large","medium"],"mappings":";;;MAGaA,qBAAqB,GAAGA,CAACC,qBAAqB,GAAG,KAAK,KAC/DC,EAAE,CACE,+
|
1
|
+
{"version":3,"file":"utilities.js","sources":["../../../../../../../src/components/Select2/utilities.ts"],"sourcesContent":["import cn from 'clsx';\nimport { FontSize, FontSizes } from '../../types';\n\nexport const createOptionClassName = (shouldPauseHoverState = false) =>\n cn(\n 'group mb-px flex w-full text-sm flex-shrink-0 font-normal cursor-pointer items-center rounded bg-white px-2 leading-8 text-black aria-hidden:hidden gap-1.5 bg-white aria-current:wcag-grey-200 aria-disabled:text-black/25 aria-disabled:pointer-events-none !justify-normal',\n\n {\n 'hover:wcag-grey-200': !shouldPauseHoverState,\n }\n );\n\nexport const createCollectionClassName = () => 'flex flex-col gap-px';\n\nexport const getFontSize = (fontSize?: FontSize) => {\n switch (fontSize) {\n case FontSizes.small:\n return 'text-xs';\n\n case FontSizes.large:\n return 'text-base';\n\n case FontSizes.medium:\n default:\n return 'text-sm';\n }\n};\n"],"names":["createOptionClassName","shouldPauseHoverState","cn","createCollectionClassName","getFontSize","fontSize","FontSizes","small","large","medium"],"mappings":";;;MAGaA,qBAAqB,GAAGA,CAACC,qBAAqB,GAAG,KAAK,KAC/DC,EAAE,CACE,+QAA+Q,EAE/Q;EACI,qBAAqB,EAAE,CAACD;CAC3B;MAGIE,yBAAyB,GAAGA,MAAM;MAElCC,WAAW,GAAIC,QAAmB;EAC3C,QAAQA,QAAQ;IACZ,KAAKC,SAAS,CAACC,KAAK;MAChB,OAAO,SAAS;IAEpB,KAAKD,SAAS,CAACE,KAAK;MAChB,OAAO,WAAW;IAEtB,KAAKF,SAAS,CAACG,MAAM;IACrB;MACI,OAAO,SAAS;;AAE5B;;;;"}
|
@@ -1,4 +1,5 @@
|
|
1
1
|
import React__default from 'react';
|
2
|
+
import { setDataFocusAttribute } from '../../../../utils/dom.js';
|
2
3
|
import { DisplayRow } from '../../../../primitives/Table/Core/components/Row/BuiltIns/DisplayRow.js';
|
3
4
|
import { useAugmentedFocusManager } from '../../../../primitives/Table/Core/components/Body/util.js';
|
4
5
|
import { SaveStatus } from './Editing/SaveStatus.js';
|
@@ -14,7 +15,7 @@ function Row(props) {
|
|
14
15
|
const isActiveRow = tableMeta.rowActive.rowActiveIndex === index;
|
15
16
|
React__default.useEffect(() => {
|
16
17
|
if (tableMeta.editing.isEditing && isActiveRow && tableMeta.editing.lastFocusedCellIndex === undefined) {
|
17
|
-
focusManager.focusFirst();
|
18
|
+
setDataFocusAttribute(focusManager.focusFirst());
|
18
19
|
}
|
19
20
|
}, [tableMeta.editing.isEditing, tableMeta.rowActive.rowActiveIndex, tableMeta.editing.lastFocusedCellIndex]);
|
20
21
|
const handleFocus = React__default.useCallback(event => {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"Row.js","sources":["../../../../../../../../../src/components/Table3/components/Row/Row.tsx"],"sourcesContent":["import React from 'react';\nimport { TableMeta as ReactTableMeta } from '@tanstack/react-table';\nimport { DisplayRow, DisplayRowProps } from '../../../../primitives/Table/Core/components/Row/BuiltIns/DisplayRow';\nimport { SaveStatus } from './Editing/SaveStatus';\nimport { useAugmentedFocusManager } from '../../../../primitives/Table/Core/components/Body/util';\n\nexport function Row<TType = unknown>(props: DisplayRowProps<TType>) {\n const { row, index, table } = props;\n const focusManager = useAugmentedFocusManager();\n const tableMeta = table.options.meta as ReactTableMeta<TType>;\n const isActiveRow = tableMeta.rowActive.rowActiveIndex === index;\n\n React.useEffect(() => {\n if (tableMeta.editing.isEditing && isActiveRow && tableMeta.editing.lastFocusedCellIndex === undefined) {\n focusManager.focusFirst();\n }\n }, [tableMeta.editing.isEditing, tableMeta.rowActive.rowActiveIndex, tableMeta.editing.lastFocusedCellIndex]);\n\n const handleFocus = React.useCallback(\n (event: React.FocusEvent<HTMLTableRowElement>) => {\n if (tableMeta.editing.isEditing) {\n const cellIndex = Number(event.target.closest('td')?.getAttribute('data-cell-index') ?? undefined);\n\n if (!isNaN(cellIndex)) {\n tableMeta.editing.setLastFocusedCellIndex(Number(cellIndex));\n }\n }\n },\n [tableMeta.editing.isEditing, isActiveRow]\n );\n\n const attributes = {\n 'data-row-editing-invalid':\n tableMeta.editing.isEnabled && tableMeta.editing.hasRowErrors(row.id)\n ? !tableMeta.editing.hasRowErrorsSeen(row.id)\n ? 'unseen'\n : true\n : undefined,\n 'data-row-editing-status':\n tableMeta.editing.isEnabled && tableMeta.editing.getRowSaveStatus(row.id)\n ? tableMeta.editing.getRowSaveStatus(row.id)\n : undefined,\n onFocus: handleFocus,\n };\n\n return (\n <DisplayRow<TType> {...props} {...attributes}>\n {tableMeta.editing.getRowSaveStatus(row.id) ? <SaveStatus rowId={row.id} table={table} /> : null}\n </DisplayRow>\n );\n}\n"],"names":["Row","props","row","index","table","focusManager","useAugmentedFocusManager","tableMeta","options","meta","isActiveRow","rowActive","rowActiveIndex","React","useEffect","editing","isEditing","lastFocusedCellIndex","undefined","focusFirst","handleFocus","useCallback","event","_event$target$closest","_event$target$closest2","cellIndex","Number","target","closest","getAttribute","isNaN","setLastFocusedCellIndex","attributes","isEnabled","hasRowErrors","id","hasRowErrorsSeen","getRowSaveStatus","onFocus","DisplayRow","SaveStatus","rowId"],"mappings":"
|
1
|
+
{"version":3,"file":"Row.js","sources":["../../../../../../../../../src/components/Table3/components/Row/Row.tsx"],"sourcesContent":["import React from 'react';\nimport { TableMeta as ReactTableMeta } from '@tanstack/react-table';\nimport { DisplayRow, DisplayRowProps } from '../../../../primitives/Table/Core/components/Row/BuiltIns/DisplayRow';\nimport { SaveStatus } from './Editing/SaveStatus';\nimport { useAugmentedFocusManager } from '../../../../primitives/Table/Core/components/Body/util';\nimport { setDataFocusAttribute } from '../../../../utils/dom';\n\nexport function Row<TType = unknown>(props: DisplayRowProps<TType>) {\n const { row, index, table } = props;\n const focusManager = useAugmentedFocusManager();\n const tableMeta = table.options.meta as ReactTableMeta<TType>;\n const isActiveRow = tableMeta.rowActive.rowActiveIndex === index;\n\n React.useEffect(() => {\n if (tableMeta.editing.isEditing && isActiveRow && tableMeta.editing.lastFocusedCellIndex === undefined) {\n setDataFocusAttribute(focusManager.focusFirst());\n }\n }, [tableMeta.editing.isEditing, tableMeta.rowActive.rowActiveIndex, tableMeta.editing.lastFocusedCellIndex]);\n\n const handleFocus = React.useCallback(\n (event: React.FocusEvent<HTMLTableRowElement>) => {\n if (tableMeta.editing.isEditing) {\n const cellIndex = Number(event.target.closest('td')?.getAttribute('data-cell-index') ?? undefined);\n\n if (!isNaN(cellIndex)) {\n tableMeta.editing.setLastFocusedCellIndex(Number(cellIndex));\n }\n }\n },\n [tableMeta.editing.isEditing, isActiveRow]\n );\n\n const attributes = {\n 'data-row-editing-invalid':\n tableMeta.editing.isEnabled && tableMeta.editing.hasRowErrors(row.id)\n ? !tableMeta.editing.hasRowErrorsSeen(row.id)\n ? 'unseen'\n : true\n : undefined,\n 'data-row-editing-status':\n tableMeta.editing.isEnabled && tableMeta.editing.getRowSaveStatus(row.id)\n ? tableMeta.editing.getRowSaveStatus(row.id)\n : undefined,\n onFocus: handleFocus,\n };\n\n return (\n <DisplayRow<TType> {...props} {...attributes}>\n {tableMeta.editing.getRowSaveStatus(row.id) ? <SaveStatus rowId={row.id} table={table} /> : null}\n </DisplayRow>\n );\n}\n"],"names":["Row","props","row","index","table","focusManager","useAugmentedFocusManager","tableMeta","options","meta","isActiveRow","rowActive","rowActiveIndex","React","useEffect","editing","isEditing","lastFocusedCellIndex","undefined","setDataFocusAttribute","focusFirst","handleFocus","useCallback","event","_event$target$closest","_event$target$closest2","cellIndex","Number","target","closest","getAttribute","isNaN","setLastFocusedCellIndex","attributes","isEnabled","hasRowErrors","id","hasRowErrorsSeen","getRowSaveStatus","onFocus","DisplayRow","SaveStatus","rowId"],"mappings":";;;;;;SAOgBA,GAAGA,CAAkBC,KAA6B;EAC9D,MAAM;IAAEC,GAAG;IAAEC,KAAK;IAAEC;GAAO,GAAGH,KAAK;EACnC,MAAMI,YAAY,GAAGC,wBAAwB,EAAE;EAC/C,MAAMC,SAAS,GAAGH,KAAK,CAACI,OAAO,CAACC,IAA6B;EAC7D,MAAMC,WAAW,GAAGH,SAAS,CAACI,SAAS,CAACC,cAAc,KAAKT,KAAK;EAEhEU,cAAK,CAACC,SAAS,CAAC;IACZ,IAAIP,SAAS,CAACQ,OAAO,CAACC,SAAS,IAAIN,WAAW,IAAIH,SAAS,CAACQ,OAAO,CAACE,oBAAoB,KAAKC,SAAS,EAAE;MACpGC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,CAACkC,EAAE,CAAC,GAC1ClB,SAAS;IACnBqB,OAAO,EAAElB;GACZ;EAED,oBACIR,6BAAC2B,UAAU,oBAAYvC,KAAK,EAAMgC,UAAU,GACvC1B,SAAS,CAACQ,OAAO,CAACuB,gBAAgB,CAACpC,GAAG,CAACkC,EAAE,CAAC,gBAAGvB,6BAAC4B,UAAU;IAACC,KAAK,EAAExC,GAAG,CAACkC,EAAE;IAAEhC,KAAK,EAAEA;IAAS,GAAG,IAAI,CACvF;AAErB;;;;"}
|
@@ -1,3 +1,4 @@
|
|
1
|
+
import { setDataFocusAttribute } from '../../../utils/dom.js';
|
1
2
|
import { globalFilterFn, columnFilterFn } from '../../../primitives/Table/useTableManager/util/filtering.js';
|
2
3
|
|
3
4
|
function willRowMove(cell, change, rowIndex) {
|
@@ -80,8 +81,12 @@ function willRowMoveAfterSorting(cell, change, rowIndex) {
|
|
80
81
|
function animateCreateRow(id) {
|
81
82
|
const templateRow = document.querySelector(`[data-row-id="${id}"]`);
|
82
83
|
if (templateRow) {
|
83
|
-
|
84
|
-
|
84
|
+
const firstCell = templateRow.querySelector(':first-child');
|
85
|
+
const checkbox = firstCell === null || firstCell === void 0 ? void 0 : firstCell.querySelector('[data-taco="checkbox"]');
|
86
|
+
firstCell === null || firstCell === void 0 ? void 0 : firstCell.focus();
|
87
|
+
if (checkbox) {
|
88
|
+
setDataFocusAttribute(checkbox);
|
89
|
+
}
|
85
90
|
templateRow.scrollIntoView();
|
86
91
|
const keyframes = [{
|
87
92
|
background: '#b2c7ef'
|
@@ -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, globalFilterFn } from '../../../primitives/Table/useTableManager/util/filtering';\n\nexport function willRowMove<TType = unknown>(cell: ReactTableCell<TType, unknown>, change: unknown, rowIndex: number) {\n const { table } = cell.getContext();\n\n if (willRowMoveAfterSearch<TType>(cell, change, table)) {\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) {\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);\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 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 function animateCreateRow(id) {\n const templateRow = document.querySelector(`[data-row-id=\"${id}\"]`);\n\n if (templateRow) {\n
|
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, globalFilterFn } from '../../../primitives/Table/useTableManager/util/filtering';\nimport { setDataFocusAttribute } from '../../../utils/dom';\n\nexport function willRowMove<TType = unknown>(cell: ReactTableCell<TType, unknown>, change: unknown, rowIndex: number) {\n const { table } = cell.getContext();\n\n if (willRowMoveAfterSearch<TType>(cell, change, table)) {\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) {\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);\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 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 function animateCreateRow(id) {\n const templateRow = document.querySelector(`[data-row-id=\"${id}\"]`);\n\n if (templateRow) {\n const firstCell = templateRow.querySelector(':first-child') as HTMLElement;\n const checkbox = firstCell?.querySelector('[data-taco=\"checkbox\"]');\n firstCell?.focus();\n\n if (checkbox) {\n setDataFocusAttribute(checkbox);\n }\n\n templateRow.scrollIntoView();\n\n const keyframes = [{ background: '#b2c7ef' }, { background: '#ebebeb' }];\n\n for (const child of templateRow.children) {\n child.animate(keyframes, { duration: 1000, easing: 'ease-out' });\n }\n }\n}\n"],"names":["willRowMove","cell","change","rowIndex","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","animateCreateRow","templateRow","document","querySelector","firstCell","checkbox","focus","setDataFocusAttribute","scrollIntoView","keyframes","background","child","children","animate","duration","easing"],"mappings":";;;SAKgBA,WAAWA,CAAkBC,IAAoC,EAAEC,MAAe,EAAEC,QAAgB;EAChH,MAAM;IAAEC;GAAO,GAAGH,IAAI,CAACI,UAAU,EAAE;EAEnC,IAAIC,sBAAsB,CAAQL,IAAI,EAAEC,MAAM,EAAEE,KAAK,CAAC,EAAE;IACpD,OAAO,QAAQ;GAClB,MAAM,IAAIG,sBAAsB,CAAQN,IAAI,EAAEC,MAAM,CAAC,EAAE;IACpD,OAAO,QAAQ;GAClB,MAAM,IAAIM,uBAAuB,CAAQP,IAAI,EAAEC,MAAM,EAAEC,QAAQ,CAAC,EAAE;IAC/D,OAAO,SAAS;;EAGpB,OAAOM,SAAS;AACpB;AAEA,SAASH,sBAAsBA,CAC3BL,IAAoC,EACpCC,MAAe,EACfE,KAAwB;EAExB,MAAMM,WAAW,GAAGN,KAAK,CAACO,QAAQ,EAAE,CAACC,YAAY;EAEjD,IAAI,CAACR,KAAK,CAACS,OAAO,CAACC,kBAAkB,IAAI,CAACJ,WAAW,EAAE;IACnD,OAAO,KAAK;;EAGhB,MAAMK,aAAa,GAAG;IAAE,GAAGd,IAAI,CAACe,GAAG;IAAEC,QAAQ,EAAE;MAAE,GAAGhB,IAAI,CAACe,GAAG,CAACC,QAAQ;MAAE,CAAChB,IAAI,CAACiB,MAAM,CAACC,EAAE,GAAGjB;;GAAU;EACnG,OAAO,CAACkB,cAAc,CAACL,aAAa,EAAEd,IAAI,CAACiB,MAAM,CAACC,EAAE,EAAET,WAAW,CAAC;AACtE;AAEA,SAASH,sBAAsBA,CAAkBN,IAAoC,EAAEC,MAAe;E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AACF,QAAQ,CAAC;;IAGnCJ,WAAW,CAACO,cAAc,EAAE;IAE5B,MAAMC,SAAS,GAAG,CAAC;MAAEC,UAAU,EAAE;KAAW,EAAE;MAAEA,UAAU,EAAE;KAAW,CAAC;IAExE,KAAK,MAAMC,KAAK,IAAIV,WAAW,CAACW,QAAQ,EAAE;MACtCD,KAAK,CAACE,OAAO,CAACJ,SAAS,EAAE;QAAEK,QAAQ,EAAE,IAAI;QAAEC,MAAM,EAAE;OAAY,CAAC;;;AAG5E;;;;"}
|
@@ -2,6 +2,8 @@ import { forwardRef, createElement } from 'react';
|
|
2
2
|
import cn from 'clsx';
|
3
3
|
import { Tooltip } from '../Tooltip/Tooltip.js';
|
4
4
|
import { getButtonClasses } from '../Button/util.js';
|
5
|
+
import { Button } from '../Button/Button.js';
|
6
|
+
import { OverflowGroup } from '../OverflowGroup/OverflowGroup.js';
|
5
7
|
import { Root, List, Trigger, Content } from '@radix-ui/react-tabs';
|
6
8
|
|
7
9
|
const Tabs = /*#__PURE__*/forwardRef(function Tabs(props, ref) {
|
@@ -28,11 +30,18 @@ const Tabs = /*#__PURE__*/forwardRef(function Tabs(props, ref) {
|
|
28
30
|
}), children);
|
29
31
|
});
|
30
32
|
const TabList = /*#__PURE__*/forwardRef(function Tab(props, ref) {
|
31
|
-
const
|
33
|
+
const {
|
34
|
+
children
|
35
|
+
} = props;
|
36
|
+
const className = cn('border-grey-300 flex flex-row m-0 mb-4 print:hidden', 'aria-orientation-horizontal:border-b', 'aria-orientation-vertical:border-r aria-orientation-vertical:m-0 aria-orientation-vertical:mr-4 aria-orientation-vertical:flex-col', props.className);
|
32
37
|
return /*#__PURE__*/createElement(List, Object.assign({}, props, {
|
33
38
|
className: className,
|
34
39
|
ref: ref
|
35
|
-
})
|
40
|
+
}), /*#__PURE__*/createElement(OverflowGroup, {
|
41
|
+
wrapChild: true,
|
42
|
+
className: "w-full",
|
43
|
+
moreButton: text => /*#__PURE__*/createElement(Button, null, text)
|
44
|
+
}, children));
|
36
45
|
});
|
37
46
|
const TabTrigger = /*#__PURE__*/forwardRef(function Tab(props, ref) {
|
38
47
|
const {
|
@@ -42,7 +51,7 @@ const TabTrigger = /*#__PURE__*/forwardRef(function Tab(props, ref) {
|
|
42
51
|
tooltip,
|
43
52
|
...otherProps
|
44
53
|
} = props;
|
45
|
-
const triggerClassName = cn('group relative p-0.5 outline-none disabled:cursor-not-allowed disabled:text-black/50',
|
54
|
+
const triggerClassName = cn(props.className, 'group relative p-0.5 outline-none disabled:cursor-not-allowed disabled:text-black/50',
|
46
55
|
// horizontal
|
47
56
|
'[[aria-orientation="horizontal"]_&]:pb-1',
|
48
57
|
// horizontal
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"Tabs.js","sources":["../../../../../../../src/components/Tabs/Tabs.tsx"],"sourcesContent":["import * as React from 'react';\nimport cn from 'clsx';\nimport * as TabsPrimitive from '@radix-ui/react-tabs';\nimport { Orientation } from '../../types';\nimport { getButtonClasses } from '../Button/util';\nimport { Tooltip } from '../Tooltip/Tooltip';\n\nexport type TabsProps = React.HTMLAttributes<HTMLDivElement> & {\n /**\n * The controlled value of the tab to activate. Should be used in conjunction with `onChange`.\n */\n id?: string;\n /**\n * Set which tab is selected on mount.\n * This has to be one of the existing ids provided for tabs\n */\n defaultId?: string;\n /**\n * Content should be one or an array of `Tabs.Trigger` components inside `Tabs.List` and then\n * followed by one or an array of `Tabs.Content`.\n * *Note* that there can also be tabs that are rendered conditionally.\n */\n children: React.ReactNode;\n /**\n * Define orientation of tabs.\n * @defaultValue horizontal\n */\n orientation?: Orientation;\n /**\n * Callback that is called when tab is changed.\n */\n onChange?: (id: string) => void;\n};\n\nexport type TabListProps = React.HTMLAttributes<HTMLDivElement>;\n\nexport type TabTriggerProps = React.HTMLAttributes<HTMLButtonElement> & {\n /**\n * A unique value that associates the trigger with a content.\n */\n id: string;\n /**\n * When true, prevents the user from interacting with the tab.\n */\n disabled?: boolean;\n /** A tooltip to show when hovering over the trigger */\n tooltip?: string | JSX.Element;\n};\n\nexport type TabContentProps = React.HTMLAttributes<HTMLDivElement> & {\n /**\n * A unique value that associates the content with a trigger.\n */\n id: string;\n};\n\nexport type ForwardedTabsWithStatics = React.ForwardRefExoticComponent<TabsProps & React.RefAttributes<HTMLDivElement>> & {\n /** Tab list component containing all tab triggers, rendered in a `Tabs` group component */\n List: React.ForwardRefExoticComponent<TabListProps & React.RefAttributes<HTMLDivElement>>;\n /** Tab trigger component rendered in a `Tabs.List` component */\n Trigger: React.ForwardRefExoticComponent<TabTriggerProps & React.RefAttributes<HTMLButtonElement>>;\n /** Tab content component rendered in a `Tabs` group component */\n Content: React.ForwardRefExoticComponent<TabContentProps & React.RefAttributes<HTMLDivElement>>;\n};\n\nexport const Tabs = React.forwardRef(function Tabs(props: TabsProps, ref: React.Ref<HTMLDivElement>) {\n const { id, defaultId, children, onChange, orientation = 'horizontal', ...otherProps } = props;\n const className = cn(\n {\n 'flex w-full': orientation === 'vertical',\n },\n props.className\n );\n\n return (\n <TabsPrimitive.Root\n {...otherProps}\n className={className}\n data-taco=\"tabs\"\n defaultValue={defaultId}\n dir=\"ltr\"\n onValueChange={onChange}\n orientation={orientation}\n ref={ref}\n value={id}>\n {children}\n </TabsPrimitive.Root>\n );\n}) as ForwardedTabsWithStatics;\n\nconst TabList = React.forwardRef(function Tab(props: TabListProps, ref: React.Ref<HTMLDivElement>) {\n const className = cn(\n 'border-grey-300 flex flex-row m-0 mb-4',\n 'aria-orientation-horizontal:border-b',\n 'aria-orientation-vertical:border-r aria-orientation-vertical:m-0 aria-orientation-vertical:mr-4 aria-orientation-vertical:flex-col
|
1
|
+
{"version":3,"file":"Tabs.js","sources":["../../../../../../../src/components/Tabs/Tabs.tsx"],"sourcesContent":["import * as React from 'react';\nimport cn from 'clsx';\nimport * as TabsPrimitive from '@radix-ui/react-tabs';\nimport { Orientation } from '../../types';\nimport { getButtonClasses } from '../Button/util';\nimport { Tooltip } from '../Tooltip/Tooltip';\nimport { OverflowGroup } from '../OverflowGroup/OverflowGroup';\nimport { Button } from '../Button/Button';\n\nexport type TabsProps = React.HTMLAttributes<HTMLDivElement> & {\n /**\n * The controlled value of the tab to activate. Should be used in conjunction with `onChange`.\n */\n id?: string;\n /**\n * Set which tab is selected on mount.\n * This has to be one of the existing ids provided for tabs\n */\n defaultId?: string;\n /**\n * Content should be one or an array of `Tabs.Trigger` components inside `Tabs.List` and then\n * followed by one or an array of `Tabs.Content`.\n * *Note* that there can also be tabs that are rendered conditionally.\n */\n children: React.ReactNode;\n /**\n * Define orientation of tabs.\n * @defaultValue horizontal\n */\n orientation?: Orientation;\n /**\n * Callback that is called when tab is changed.\n */\n onChange?: (id: string) => void;\n};\n\nexport type TabListProps = React.HTMLAttributes<HTMLDivElement>;\n\nexport type TabTriggerProps = React.HTMLAttributes<HTMLButtonElement> & {\n /**\n * A unique value that associates the trigger with a content.\n */\n id: string;\n /**\n * When true, prevents the user from interacting with the tab.\n */\n disabled?: boolean;\n /** A tooltip to show when hovering over the trigger */\n tooltip?: string | JSX.Element;\n};\n\nexport type TabContentProps = React.HTMLAttributes<HTMLDivElement> & {\n /**\n * A unique value that associates the content with a trigger.\n */\n id: string;\n\n /**\n * Used to force mounting when more control is needed. Useful when\n * controlling animation with React animation libraries.\n */\n forceMount?: true;\n};\n\nexport type ForwardedTabsWithStatics = React.ForwardRefExoticComponent<TabsProps & React.RefAttributes<HTMLDivElement>> & {\n /** Tab list component containing all tab triggers, rendered in a `Tabs` group component */\n List: React.ForwardRefExoticComponent<TabListProps & React.RefAttributes<HTMLDivElement>>;\n /** Tab trigger component rendered in a `Tabs.List` component */\n Trigger: React.ForwardRefExoticComponent<TabTriggerProps & React.RefAttributes<HTMLButtonElement>>;\n /** Tab content component rendered in a `Tabs` group component */\n Content: React.ForwardRefExoticComponent<TabContentProps & React.RefAttributes<HTMLDivElement>>;\n};\n\nexport const Tabs = React.forwardRef(function Tabs(props: TabsProps, ref: React.Ref<HTMLDivElement>) {\n const { id, defaultId, children, onChange, orientation = 'horizontal', ...otherProps } = props;\n const className = cn(\n {\n 'flex w-full': orientation === 'vertical',\n },\n props.className\n );\n\n return (\n <TabsPrimitive.Root\n {...otherProps}\n className={className}\n data-taco=\"tabs\"\n defaultValue={defaultId}\n dir=\"ltr\"\n onValueChange={onChange}\n orientation={orientation}\n ref={ref}\n value={id}>\n {children}\n </TabsPrimitive.Root>\n );\n}) as ForwardedTabsWithStatics;\n\nconst TabList = React.forwardRef(function Tab(props: TabListProps, ref: React.Ref<HTMLDivElement>) {\n const { children } = props;\n const className = cn(\n 'border-grey-300 flex flex-row m-0 mb-4 print:hidden',\n 'aria-orientation-horizontal:border-b',\n 'aria-orientation-vertical:border-r aria-orientation-vertical:m-0 aria-orientation-vertical:mr-4 aria-orientation-vertical:flex-col',\n props.className\n );\n\n return (\n <TabsPrimitive.List {...props} className={className} ref={ref}>\n <OverflowGroup wrapChild className=\"w-full\" moreButton={(text: string) => <Button>{text}</Button>}>\n {children}\n </OverflowGroup>\n </TabsPrimitive.List>\n );\n});\n\nconst TabTrigger = React.forwardRef(function Tab(props: TabTriggerProps, ref: React.Ref<HTMLButtonElement>) {\n const { children, id, disabled, tooltip, ...otherProps } = props;\n\n const triggerClassName = cn(\n props.className,\n 'group relative p-0.5 outline-none disabled:cursor-not-allowed disabled:text-black/50',\n // horizontal\n '[[aria-orientation=\"horizontal\"]_&]:pb-1',\n // horizontal\n '[[aria-orientation=\"vertical\"]_&]:pr-1'\n );\n const buttonClassName = cn(\n getButtonClasses(),\n 'group-focus-visible:yt-focus-inset group-enabled:group-hover:wcag-grey-200 pointer-events-none rounded px-3'\n );\n const activeClassName = cn(\n 'pointer-events-none absolute hidden bg-blue-500 group-aria-selected:flex',\n // horizontal\n '[[aria-orientation=\"horizontal\"]_&]:rounded-t-sm [[aria-orientation=\"horizontal\"]_&]:bottom-0 [[aria-orientation=\"horizontal\"]_&]:left-0 [[aria-orientation=\"horizontal\"]_&]:right-0 [[aria-orientation=\"horizontal\"]_&]:-mb-px [[aria-orientation=\"horizontal\"]_&]:h-0.5',\n // vertical\n '[[aria-orientation=\"vertical\"]_&]:rounded-l-sm [[aria-orientation=\"vertical\"]_&]:right-0 [[aria-orientation=\"vertical\"]_&]:top-0 [[aria-orientation=\"vertical\"]_&]:bottom-0 [[aria-orientation=\"vertical\"]_&]:-mr-px [[aria-orientation=\"vertical\"]_&]:w-0.5'\n );\n\n const trigger = (\n <TabsPrimitive.Trigger {...otherProps} className={triggerClassName} disabled={disabled} ref={ref} value={id}>\n <span className={buttonClassName}>{children}</span>\n <span className={activeClassName} />\n </TabsPrimitive.Trigger>\n );\n\n if (tooltip) {\n return <Tooltip title={tooltip}>{trigger}</Tooltip>;\n }\n\n return trigger;\n});\n\nconst TabContent = React.forwardRef(function Tab(props: TabContentProps, ref: React.Ref<HTMLDivElement>) {\n const { id, ...otherProps } = props;\n const className = cn('[&[data-orientation=\"vertical\"]]:grow outline-none', props.className);\n\n return <TabsPrimitive.Content {...otherProps} className={className} ref={ref} value={id} />;\n});\n\nTabs.List = TabList;\nTabs.Trigger = TabTrigger;\nTabs.Content = TabContent;\n"],"names":["Tabs","React","props","ref","id","defaultId","children","onChange","orientation","otherProps","className","cn","TabsPrimitive","defaultValue","dir","onValueChange","value","TabList","Tab","OverflowGroup","wrapChild","moreButton","text","Button","TabTrigger","disabled","tooltip","triggerClassName","buttonClassName","getButtonClasses","activeClassName","trigger","Tooltip","title","TabContent","List","Trigger","Content"],"mappings":";;;;;;;;MAyEaA,IAAI,gBAAGC,UAAgB,CAAC,SAASD,IAAIA,CAACE,KAAgB,EAAEC,GAA8B;EAC/F,MAAM;IAAEC,EAAE;IAAEC,SAAS;IAAEC,QAAQ;IAAEC,QAAQ;IAAEC,WAAW,GAAG,YAAY;IAAE,GAAGC;GAAY,GAAGP,KAAK;EAC9F,MAAMQ,SAAS,GAAGC,EAAE,CAChB;IACI,aAAa,EAAEH,WAAW,KAAK;GAClC,EACDN,KAAK,CAACQ,SAAS,CAClB;EA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AAO,gBACT9B,cAACW,OAAqB,oBAAKH,UAAU;IAAEC,SAAS,EAAEiB,gBAAgB;IAAEF,QAAQ,EAAEA,QAAQ;IAAEtB,GAAG,EAAEA,GAAG;IAAEa,KAAK,EAAEZ;mBACrGH;IAAMS,SAAS,EAAEkB;KAAkBtB,QAAQ,CAAQ,eACnDL;IAAMS,SAAS,EAAEoB;IAAmB,CAE3C;EAED,IAAIJ,OAAO,EAAE;IACT,oBAAOzB,cAAC+B,OAAO;MAACC,KAAK,EAAEP;OAAUK,OAAO,CAAW;;EAGvD,OAAOA,OAAO;AAClB,CAAC,CAAC;AAEF,MAAMG,UAAU,gBAAGjC,UAAgB,CAAC,SAASiB,GAAGA,CAAChB,KAAsB,EAAEC,GAA8B;EACnG,MAAM;IAAEC,EAAE;IAAE,GAAGK;GAAY,GAAGP,KAAK;EACnC,MAAMQ,SAAS,GAAGC,EAAE,CAAC,oDAAoD,EAAET,KAAK,CAACQ,SAAS,CAAC;EAE3F,oBAAOT,cAACW,OAAqB,oBAAKH,UAAU;IAAEC,SAAS,EAAEA,SAAS;IAAEP,GAAG,EAAEA,GAAG;IAAEa,KAAK,EAAEZ;KAAM;AAC/F,CAAC,CAAC;AAEFJ,IAAI,CAACmC,IAAI,GAAGlB,OAAO;AACnBjB,IAAI,CAACoC,OAAO,GAAGZ,UAAU;AACzBxB,IAAI,CAACqC,OAAO,GAAGH,UAAU;;;;"}
|
@@ -1,5 +1,6 @@
|
|
1
1
|
import React__default from 'react';
|
2
2
|
import { FocusScope } from '@react-aria/focus';
|
3
|
+
import { ROW_HEIGHT_ESTIMATES } from './util/rows.js';
|
3
4
|
import { Header } from './components/Header/Header.js';
|
4
5
|
import { Body } from './components/Body/Body.js';
|
5
6
|
import { Foot } from './components/Footer/Footer.js';
|
@@ -65,7 +66,7 @@ function TableGrid(props) {
|
|
65
66
|
scrollToIndex: table.renderer.scrollToIndex,
|
66
67
|
style: props.children ? {
|
67
68
|
...table.renderer.style,
|
68
|
-
height: table.renderer.style.height +
|
69
|
+
height: table.renderer.style.height + ROW_HEIGHT_ESTIMATES[table.meta.rowHeight.height]
|
69
70
|
} : table.renderer.style
|
70
71
|
}, table.renderer.rows, props.children), table.meta.footer.isEnabled ? /*#__PURE__*/React__default.createElement(Foot, {
|
71
72
|
table: table.instance
|
@@ -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 './style.css';\nimport { TableEmptyStateReason } from '../types';\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 getFilterReason<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 filterReason = getFilterReason(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 {filterReason ? (\n <EmptyStateBody emptyState={props.table.props.emptyState} reason={filterReason} />\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 ? {
|
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 './style.css';\nimport { TableEmptyStateReason } from '../types';\nimport { ROW_HEIGHT_ESTIMATES } from './util/rows';\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 getFilterReason<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 filterReason = getFilterReason(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 {filterReason ? (\n <EmptyStateBody emptyState={props.table.props.emptyState} reason={filterReason} />\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","getFilterReason","table","instance","getFilteredRowModel","rows","length","getCoreRowModel","state","getState","meta","search","enableGlobalFilter","globalFilter","enableHorizontalArrowKeyNavigation","attributes","handleFocus","rowActive","rowActiveIndex","undefined","event","renderer","scrollToIndex","filterReason","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,eAAeA,CAAkBC,KAAiC;EACvE,IAAIA,KAAK,CAACC,QAAQ,CAACC,mBAAmB,EAAE,CAACC,IAAI,CAACC,MAAM,KAAK,CAAC,IAAIJ,KAAK,CAACC,QAAQ,CAACI,eAAe,E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K,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;;;;"}
|
package/dist/esm/packages/taco/src/primitives/Table/Core/components/Columns/Internal/Drag.js
CHANGED
@@ -18,7 +18,7 @@ function Cell(context) {
|
|
18
18
|
const onDragStart = event => {
|
19
19
|
var _tableMeta$rowDrag$se, _tableMeta$rowDrag, _tableMeta$rowDrag$ha, _tableMeta$rowDrag2;
|
20
20
|
let rows = [row];
|
21
|
-
if (
|
21
|
+
if (row.getCanSelect()) {
|
22
22
|
rows = row.getIsSelected() ? table.getSelectedRowModel().rows : [row, ...table.getSelectedRowModel().rows];
|
23
23
|
}
|
24
24
|
const data = rows.map(row => row.original);
|
package/dist/esm/packages/taco/src/primitives/Table/Core/components/Columns/Internal/Drag.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"Drag.js","sources":["../../../../../../../../../../../src/primitives/Table/Core/components/Columns/Internal/Drag.tsx"],"sourcesContent":["import React from 'react';\nimport { CellContext as ReactTableCellContext, TableMeta as ReactTableMeta } from '@tanstack/react-table';\nimport { useLocalization } from '../../../../../../components/Provider/Localization';\nimport { useTableManagerInternalColumn } from '../../../../useTableManager/types';\nimport { Icon } from '../../../../../../components/Icon/Icon';\n\nconst GHOST_ELEMENT_ID = 'taco_table_dragging';\n\nfunction Header() {\n return null;\n}\n\nfunction Cell<TType = unknown>(context: ReactTableCellContext<TType, unknown>) {\n const { row, table } = context;\n const { texts } = useLocalization();\n const tableMeta = context.table.options.meta as ReactTableMeta<TType>;\n\n const onDragStart = (event: React.DragEvent): void => {\n let rows = [row];\n\n if (
|
1
|
+
{"version":3,"file":"Drag.js","sources":["../../../../../../../../../../../src/primitives/Table/Core/components/Columns/Internal/Drag.tsx"],"sourcesContent":["import React from 'react';\nimport { CellContext as ReactTableCellContext, TableMeta as ReactTableMeta } from '@tanstack/react-table';\nimport { useLocalization } from '../../../../../../components/Provider/Localization';\nimport { useTableManagerInternalColumn } from '../../../../useTableManager/types';\nimport { Icon } from '../../../../../../components/Icon/Icon';\n\nconst GHOST_ELEMENT_ID = 'taco_table_dragging';\n\nfunction Header() {\n return null;\n}\n\nfunction Cell<TType = unknown>(context: ReactTableCellContext<TType, unknown>) {\n const { row, table } = context;\n const { texts } = useLocalization();\n const tableMeta = context.table.options.meta as ReactTableMeta<TType>;\n\n const onDragStart = (event: React.DragEvent): void => {\n let rows = [row];\n\n if (row.getCanSelect()) {\n rows = row.getIsSelected() ? table.getSelectedRowModel().rows : [row, ...table.getSelectedRowModel().rows];\n }\n\n const data = rows.map(row => row.original);\n\n tableMeta.rowDrag.setDragging?.(\n rows.reduce((dragging, rowBeingDragged) => ({ ...dragging, [rowBeingDragged.id]: true }), {})\n );\n\n // set a default data value so that the consumer doesn't have to\n event.dataTransfer.setData('text', JSON.stringify(data));\n\n const showPlaceholder = (text: string) => {\n const ghost = document.createElement('div');\n ghost.id = GHOST_ELEMENT_ID;\n ghost.className = 'wcag-blue rounded flex w-48 p-4 absolute -ml-[100vw]';\n ghost.innerText = text;\n document.body.appendChild(ghost);\n event.dataTransfer.setDragImage(ghost, 0, 0);\n };\n\n const setDataTransfer = (text: string) => event.dataTransfer.setData('text', text);\n\n tableMeta.rowDrag.handleRowDrag?.(data, showPlaceholder, setDataTransfer);\n };\n\n const handleDragEnd = (): void => {\n document.getElementById(GHOST_ELEMENT_ID)?.remove();\n tableMeta.rowDrag.setDragging?.({});\n };\n\n return (\n <div draggable onDragStart={onDragStart} onDragOver={event => event.preventDefault()} onDragEnd={handleDragEnd}>\n <Icon\n aria-label={texts.table.columns.drag.tooltip}\n name=\"drag\"\n className=\"text-grey-darkest invisible -mt-1 ml-[2px] cursor-grab active:cursor-grabbing group-hover/row:visible group-[[aria-grabbed='true']]/row:text-white\"\n />\n </div>\n );\n}\n\nexport const renderer: useTableManagerInternalColumn = {\n header: Header,\n renderer: Cell,\n size: 20,\n meta: {\n align: 'center',\n className: '!px-0 !pb-0 justify-end',\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":["GHOST_ELEMENT_ID","Header","Cell","context","row","table","texts","useLocalization","tableMeta","options","meta","onDragStart","event","rows","getCanSelect","getIsSelected","getSelectedRowModel","data","map","original","_tableMeta$rowDrag$se","_tableMeta$rowDrag","rowDrag","setDragging","call","reduce","dragging","rowBeingDragged","id","dataTransfer","setData","JSON","stringify","showPlaceholder","text","ghost","document","createElement","className","innerText","body","appendChild","setDragImage","setDataTransfer","_tableMeta$rowDrag$ha","_tableMeta$rowDrag2","handleRowDrag","handleDragEnd","_document$getElementB","getElementById","remove","_tableMeta$rowDrag$se2","_tableMeta$rowDrag3","React","draggable","onDragOver","preventDefault","onDragEnd","Icon","columns","drag","tooltip","name","renderer","header","size","align","enableSearch","headerClassName"],"mappings":";;;;AAMA,MAAMA,gBAAgB,GAAG,qBAAqB;AAE9C,SAASC,MAAMA;EACX,OAAO,IAAI;AACf;AAEA,SAASC,IAAIA,CAAkBC,OAA8C;EACzE,MAAM;IAAEC,GAAG;IAAEC;GAAO,GAAGF,OAAO;EAC9B,MAAM;IAAEG;GAAO,GAAGC,eAAe,EAAE;EACnC,MAAMC,SA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,KAAK,CAACiB,YAAY,CAACC,OAAO,CAAC,MAAM,EAAEI,IAAI,CAAC;IAElF,CAAAU,qBAAA,IAAAC,mBAAA,GAAArC,SAAS,CAACc,OAAO,EAACwB,aAAa,cAAAF,qBAAA,uBAA/BA,qBAAA,CAAApB,IAAA,CAAAqB,mBAAA,EAAkC5B,IAAI,EAAEgB,eAAe,EAAEU,eAAe,CAAC;GAC5E;EAED,MAAMI,aAAa,GAAGA;;IAClB,CAAAC,qBAAA,GAAAZ,QAAQ,CAACa,cAAc,CAACjD,gBAAgB,CAAC,cAAAgD,qBAAA,uBAAzCA,qBAAA,CAA2CE,MAAM,EAAE;IACnD,CAAAC,sBAAA,IAAAC,mBAAA,GAAA5C,SAAS,CAACc,OAAO,EAACC,WAAW,cAAA4B,sBAAA,uBAA7BA,sBAAA,CAAA3B,IAAA,CAAA4B,mBAAA,EAAgC,EAAE,CAAC;GACtC;EAED,oBACIC;IAAKC,SAAS;IAAC3C,WAAW,EAAEA,WAAW;IAAE4C,UAAU,EAAE3C,KAAK,IAAIA,KAAK,CAAC4C,cAAc,EAAE;IAAEC,SAAS,EAAEV;kBAC7FM,6BAACK,IAAI;kBACWpD,KAAK,CAACD,KAAK,CAACsD,OAAO,CAACC,IAAI,CAACC,OAAO;IAC5CC,IAAI,EAAC,MAAM;IACXxB,SAAS,EAAC;IACZ,CACA;AAEd;MAEayB,QAAQ,GAAkC;EACnDC,MAAM,EAAE/D,MAAM;EACd8D,QAAQ,EAAE7D,IAAI;EACd+D,IAAI,EAAE,EAAE;EACRvD,IAAI,EAAE;IACFwD,KAAK,EAAE,QAAQ;IACf5B,SAAS,EAAE,yBAAyB;;IAEpC6B,YAAY,EAAE,KAAK;IACnBH,MAAM,EAAE,EAAE;IACVI,eAAe,EAAE;;;;;;"}
|
package/dist/esm/packages/taco/src/primitives/Table/Core/components/Columns/Internal/Selection.js
CHANGED
@@ -42,9 +42,8 @@ function Header(context) {
|
|
42
42
|
}, /*#__PURE__*/React__default.createElement(Checkbox, {
|
43
43
|
"aria-label": title,
|
44
44
|
className: "hover:border-blue !-mt-px",
|
45
|
-
key: String(`${isAllRowsSelected}_${isSomeRowsSelected}`),
|
46
45
|
checked: isAllRowsSelected,
|
47
|
-
indeterminate: isSomeRowsSelected,
|
46
|
+
indeterminate: isSomeRowsSelected && !isAllRowsSelected,
|
48
47
|
loading: tableMeta.server.loadAllStatus === TableServerLoadAllState.Loading,
|
49
48
|
onChange: handleChange
|
50
49
|
}));
|
@@ -73,6 +72,7 @@ function Cell(context) {
|
|
73
72
|
return null;
|
74
73
|
}
|
75
74
|
const isSelected = row.getIsGrouped() ? row.getIsAllSubRowsSelected() : row.getIsSelected();
|
75
|
+
const canSelect = row.getCanSelect();
|
76
76
|
const title = isSelected ? texts.table.columns.select.deselect : texts.table.columns.select.select;
|
77
77
|
if (table.options.enableMultiRowSelection) {
|
78
78
|
const handleClick = function (event) {
|
@@ -91,7 +91,7 @@ function Cell(context) {
|
|
91
91
|
function _temp4() {
|
92
92
|
table.setRowSelection(currentRowSelection => ({
|
93
93
|
...currentRowSelection,
|
94
|
-
...selectedRows.reduce((state, row) => ({
|
94
|
+
...selectedRows.filter(row => row.getCanSelect()).reduce((state, row) => ({
|
95
95
|
...state,
|
96
96
|
[row.id]: true
|
97
97
|
}), {})
|
@@ -119,6 +119,7 @@ function Cell(context) {
|
|
119
119
|
}
|
120
120
|
};
|
121
121
|
return /*#__PURE__*/React__default.createElement(Tooltip, {
|
122
|
+
hidden: !canSelect,
|
122
123
|
title: /*#__PURE__*/React__default.createElement(React__default.Fragment, null, title, /*#__PURE__*/React__default.createElement(Shortcut, {
|
123
124
|
className: "ml-2",
|
124
125
|
keys: "Space"
|
@@ -128,11 +129,12 @@ function Cell(context) {
|
|
128
129
|
className: "!mt-0",
|
129
130
|
checked: isSelected,
|
130
131
|
onClick: handleClick,
|
132
|
+
disabled: !canSelect,
|
131
133
|
// this is necessary to remove console spam from eslint
|
132
134
|
onChange: () => false
|
133
135
|
}));
|
134
136
|
} else {
|
135
|
-
const className = cn('!mt-0', getRadioClassnames());
|
137
|
+
const className = cn('!mt-0', getRadioClassnames(!canSelect));
|
136
138
|
const handleClick = event => {
|
137
139
|
event.stopPropagation();
|
138
140
|
row.toggleSelected();
|
@@ -140,7 +142,8 @@ function Cell(context) {
|
|
140
142
|
};
|
141
143
|
return /*#__PURE__*/React__default.createElement("button", {
|
142
144
|
className: className,
|
143
|
-
"aria-checked": isSelected,
|
145
|
+
"aria-checked": canSelect && isSelected,
|
146
|
+
disabled: !canSelect,
|
144
147
|
onClick: handleClick,
|
145
148
|
role: "radio",
|
146
149
|
type: "button"
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"Selection.js","sources":["../../../../../../../../../../../src/primitives/Table/Core/components/Columns/Internal/Selection.tsx"],"sourcesContent":["import React from 'react';\nimport {\n HeaderContext as ReactTableHeaderContext,\n CellContext as ReactTableCellContext,\n TableMeta as ReactTableMeta,\n RowSelectionState,\n} from '@tanstack/react-table';\nimport cn from 'clsx';\nimport { useLocalization } from '../../../../../../components/Provider/Localization';\nimport { Tooltip } from '../../../../../../components/Tooltip/Tooltip';\nimport { Checkbox } from '../../../../../../components/Checkbox/Checkbox';\nimport { Shortcut } from '../../../../../../components/Shortcut/Shortcut';\nimport { getRadioClassnames } from '../../../../../../components/RadioGroup/util';\nimport { TableServerLoadAllState } from '../../../../types';\nimport { RowContext } from '../../Row/RowContext';\nimport { useTableManagerInternalColumn } from '../../../../useTableManager/types';\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 (table.options.enableMultiRowSelection) {\n const isAllRowsSelected = table.getIsAllRowsSelected();\n const isSomeRowsSelected = table.getIsSomeRowsSelected();\n const title = isAllRowsSelected ? texts.table.columns.select.deselectAll : texts.table.columns.select.selectAll;\n\n const handleChange = async (checked: boolean) => {\n // load all data if that is possible\n if (tableMeta.server.loadAllIfNeeded) {\n // don't pass the search query because we need all data - not filtered data\n await tableMeta.server.loadAllIfNeeded(table.getState().sorting, table.getState().columnFilters);\n }\n\n table.toggleAllRowsSelected(checked);\n };\n\n return (\n <Tooltip title={title}>\n <Checkbox\n aria-label={title}\n className=\"hover:border-blue !-mt-px\"\n key={String(`${isAllRowsSelected}_${isSomeRowsSelected}`)}\n checked={isAllRowsSelected}\n indeterminate={isSomeRowsSelected}\n loading={tableMeta.server.loadAllStatus === TableServerLoadAllState.Loading}\n onChange={handleChange}\n />\n </Tooltip>\n );\n }\n\n return null;\n}\n\nconst toggleBetween = (fromRowIndex: number, toRowIndex: number): [number, number] => {\n const fromIndex = toRowIndex < fromRowIndex ? toRowIndex : fromRowIndex;\n const toIndex = toRowIndex > fromRowIndex ? toRowIndex : fromRowIndex;\n\n return [fromIndex, toIndex];\n};\n\nfunction Cell<TType = unknown>(context: ReactTableCellContext<TType, unknown>) {\n const { texts } = useLocalization();\n const { row, table } = context;\n const { rowIndex } = React.useContext(RowContext);\n const tableMeta = table.options.meta as ReactTableMeta<TType>;\n\n if (table.options.enableGrouping && table.getState().grouping?.length && !row.getIsGrouped()) {\n return null;\n }\n\n const isSelected = row.getIsGrouped() ? row.getIsAllSubRowsSelected() : row.getIsSelected();\n const title = isSelected ? texts.table.columns.select.deselect : texts.table.columns.select.select;\n\n if (table.options.enableMultiRowSelection) {\n const handleClick = async (event: React.MouseEvent) => {\n event.stopPropagation();\n\n if (row.getIsGrouped()) {\n row.subRows.forEach(row => row.toggleSelected());\n } else if (event.shiftKey) {\n const [fromIndex, toIndex] = toggleBetween(tableMeta.rowSelection.lastSelectedRowIndex.current ?? 0, rowIndex);\n const selectedRows = table.getRowModel().rows.slice(fromIndex, toIndex + 1);\n\n if (tableMeta.server.loadAllIfNeeded && selectedRows.some(row => row.original === undefined)) {\n // don't pass the search query because we need all data - not filtered data\n await tableMeta.server.loadAllIfNeeded(table.getState().sorting, table.getState().columnFilters);\n }\n\n table.setRowSelection((currentRowSelection: RowSelectionState) => ({\n ...currentRowSelection,\n ...selectedRows.reduce((state, row) => ({ ...state, [row.id]: true }), {}),\n }));\n } else {\n row.toggleSelected();\n }\n\n tableMeta.rowSelection.lastSelectedRowIndex.current = row.index;\n };\n\n return (\n <Tooltip\n title={\n <>\n {title}\n <Shortcut className=\"ml-2\" keys=\"Space\" />\n </>\n }>\n <Checkbox\n aria-label={title}\n className=\"!mt-0\"\n checked={isSelected}\n onClick={handleClick}\n // this is necessary to remove console spam from eslint\n onChange={() => false}\n />\n </Tooltip>\n );\n } else {\n const className = cn('!mt-0', getRadioClassnames());\n\n const handleClick = (event: React.MouseEvent): void => {\n event.stopPropagation();\n row.toggleSelected();\n tableMeta.rowSelection.lastSelectedRowIndex.current = row.index;\n };\n\n return (\n <button className={className} aria-checked={isSelected} onClick={handleClick} role=\"radio\" type=\"button\">\n {isSelected ? <span className=\"h-2 w-2 rounded-full bg-white\" /> : null}\n </button>\n );\n }\n}\n\nexport const renderer: useTableManagerInternalColumn = {\n header: Header,\n renderer: Cell,\n size: 40,\n meta: {\n align: 'center',\n className: '!px-1',\n // TODO: remove when table3 is migrated, this satisfies the legacy table3 type\n enableSearch: false,\n header: '',\n headerClassName: '!px-1',\n },\n};\n"],"names":["Header","context","texts","useLocalization","table","tableMeta","options","meta","enableMultiRowSelection","isAllRowsSelected","getIsAllRowsSelected","isSomeRowsSelected","getIsSomeRowsSelected","title","columns","select","deselectAll","selectAll","handleChange","checked","toggleAllRowsSelected","_temp","server","loadAllIfNeeded","Promise","resolve","getState","sorting","columnFilters","then","_temp2","e","reject","React","Tooltip","Checkbox","className","key","String","indeterminate","loading","loadAllStatus","TableServerLoadAllState","Loading","onChange","toggleBetween","fromRowIndex","toRowIndex","fromIndex","toIndex","Cell","row","rowIndex","useContext","RowContext","enableGrouping","_table$getState$group","grouping","length","getIsGrouped","isSelected","getIsAllSubRowsSelected","getIsSelected","deselect","handleClick","event","rowSelection","lastSelectedRowIndex","current","index","stopPropagation","_temp6","subRows","forEach","toggleSelected","_temp5","shiftKey","_tableMeta$rowSelecti","_temp4","setRowSelection","currentRowSelection","selectedRows","reduce","state","id","getRowModel","rows","slice","_temp3","some","original","undefined","_temp7","Shortcut","keys","onClick","cn","getRadioClassnames","role","type","renderer","header","size","align","enableSearch","headerClassName"],"mappings":";;;;;;;;;;AAiBA,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,IAAIH,KAAK,CAACE,OAAO,CAACE,uBAAuB,EAAE;IACvC,MAAMC,iBAAiB,GAAGL,KAAK,CAACM,oBAAoB,EAAE;IACtD,MAAMC,kBAAkB,GAAGP,KAAK,CAACQ,qBAAqB,EAAE;IACxD,MAAMC,KAAK,GAAGJ,iBAAiB,GAAGP,KAAK,CAACE,KAAK,CAACU,OAAO,CAACC,MAAM,CAACC,WAAW,GAAGd,KAAK,CAACE,KAAK,CAACU,OAAO,CAACC,MAAM,CAACE,SAAS;IAE/G,MAAMC,YAAY,aAAUC,OAAgB;MAAA;;UAOxCf,KAAK,CAACgB,qBAAqB,CAACD,OAAO,CAAC;;QAAC,MAAAE,KAAA;UAAA,IALjChB,SAAS,CAACiB,MAAM,CAACC,eAAe;;YAChC,OAAAC,OAAA,CAAAC,OAAA,CACMpB,SAAS,CAACiB,MAAM,CAACC,eAAe,CAACnB,KAAK,CAACsB,QAAQ,EAAE,CAACC,OAAO,EAAEvB,KAAK,CAACsB,QAAQ,EAAE,CAACE,aAAa,CAAC,EAAAC,IAAA;;;;QAHpG,OAAAL,OAAA,CAAAC,OAAA,CAAAJ,KAAA,IAAAA,KAAA,CAAAQ,IAAA,GAAAR,KAAA,CAAAQ,IAAA,CAAAC,MAAA,IAAAA,MAAA,CAAAT,KAAA;OAOH,QAAAU,CAAA;QAAA,O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A,KAAK,CAACK,eAAe,EAAE;MACvBnB,GAAG,CAACuB,cAAc,EAAE;MACpBrE,SAAS,CAAC6D,YAAY,CAACC,oBAAoB,CAACC,OAAO,GAAGjB,GAAG,CAACkB,KAAK;KAClE;IAED,oBACIpC;MAAQG,SAAS,EAAEA,SAAS;sBAAgBwB,UAAU;MAAEmC,OAAO,EAAE/B,WAAW;MAAEkC,IAAI,EAAC,OAAO;MAACC,IAAI,EAAC;OAC3FvC,UAAU,gBAAG3B;MAAMG,SAAS,EAAC;MAAkC,GAAG,IAAI,CAClE;;AAGrB;MAEagE,QAAQ,GAAkC;EACnDC,MAAM,EAAErG,MAAM;EACdoG,QAAQ,EAAElD,IAAI;EACdoD,IAAI,EAAE,EAAE;EACR/F,IAAI,EAAE;IACFgG,KAAK,EAAE,QAAQ;IACfnE,SAAS,EAAE,OAAO;;IAElBoE,YAAY,EAAE,KAAK;IACnBH,MAAM,EAAE,EAAE;IACVI,eAAe,EAAE;;;;;;"}
|
1
|
+
{"version":3,"file":"Selection.js","sources":["../../../../../../../../../../../src/primitives/Table/Core/components/Columns/Internal/Selection.tsx"],"sourcesContent":["import React from 'react';\nimport {\n HeaderContext as ReactTableHeaderContext,\n CellContext as ReactTableCellContext,\n TableMeta as ReactTableMeta,\n RowSelectionState,\n} from '@tanstack/react-table';\nimport cn from 'clsx';\nimport { useLocalization } from '../../../../../../components/Provider/Localization';\nimport { Tooltip } from '../../../../../../components/Tooltip/Tooltip';\nimport { Checkbox } from '../../../../../../components/Checkbox/Checkbox';\nimport { Shortcut } from '../../../../../../components/Shortcut/Shortcut';\nimport { getRadioClassnames } from '../../../../../../components/RadioGroup/util';\nimport { TableServerLoadAllState } from '../../../../types';\nimport { RowContext } from '../../Row/RowContext';\nimport { useTableManagerInternalColumn } from '../../../../useTableManager/types';\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 (table.options.enableMultiRowSelection) {\n const isAllRowsSelected = table.getIsAllRowsSelected();\n const isSomeRowsSelected = table.getIsSomeRowsSelected();\n const title = isAllRowsSelected ? texts.table.columns.select.deselectAll : texts.table.columns.select.selectAll;\n\n const handleChange = async (checked: boolean) => {\n // load all data if that is possible\n if (tableMeta.server.loadAllIfNeeded) {\n // don't pass the search query because we need all data - not filtered data\n await tableMeta.server.loadAllIfNeeded(table.getState().sorting, table.getState().columnFilters);\n }\n\n table.toggleAllRowsSelected(checked);\n };\n\n return (\n <Tooltip title={title}>\n <Checkbox\n aria-label={title}\n className=\"hover:border-blue !-mt-px\"\n checked={isAllRowsSelected}\n indeterminate={isSomeRowsSelected && !isAllRowsSelected}\n loading={tableMeta.server.loadAllStatus === TableServerLoadAllState.Loading}\n onChange={handleChange}\n />\n </Tooltip>\n );\n }\n\n return null;\n}\n\nconst toggleBetween = (fromRowIndex: number, toRowIndex: number): [number, number] => {\n const fromIndex = toRowIndex < fromRowIndex ? toRowIndex : fromRowIndex;\n const toIndex = toRowIndex > fromRowIndex ? toRowIndex : fromRowIndex;\n\n return [fromIndex, toIndex];\n};\n\nfunction Cell<TType = unknown>(context: ReactTableCellContext<TType, unknown>) {\n const { texts } = useLocalization();\n const { row, table } = context;\n const { rowIndex } = React.useContext(RowContext);\n const tableMeta = table.options.meta as ReactTableMeta<TType>;\n\n if (table.options.enableGrouping && table.getState().grouping?.length && !row.getIsGrouped()) {\n return null;\n }\n\n const isSelected = row.getIsGrouped() ? row.getIsAllSubRowsSelected() : row.getIsSelected();\n const canSelect = row.getCanSelect();\n const title = isSelected ? texts.table.columns.select.deselect : texts.table.columns.select.select;\n\n if (table.options.enableMultiRowSelection) {\n const handleClick = async (event: React.MouseEvent) => {\n event.stopPropagation();\n\n if (row.getIsGrouped()) {\n row.subRows.forEach(row => row.toggleSelected());\n } else if (event.shiftKey) {\n const [fromIndex, toIndex] = toggleBetween(tableMeta.rowSelection.lastSelectedRowIndex.current ?? 0, rowIndex);\n const selectedRows = table.getRowModel().rows.slice(fromIndex, toIndex + 1);\n\n if (tableMeta.server.loadAllIfNeeded && selectedRows.some(row => row.original === undefined)) {\n // don't pass the search query because we need all data - not filtered data\n await tableMeta.server.loadAllIfNeeded(table.getState().sorting, table.getState().columnFilters);\n }\n\n table.setRowSelection((currentRowSelection: RowSelectionState) => ({\n ...currentRowSelection,\n ...selectedRows.filter(row => row.getCanSelect()).reduce((state, row) => ({ ...state, [row.id]: true }), {}),\n }));\n } else {\n row.toggleSelected();\n }\n\n tableMeta.rowSelection.lastSelectedRowIndex.current = row.index;\n };\n\n return (\n <Tooltip\n hidden={!canSelect}\n title={\n <>\n {title}\n <Shortcut className=\"ml-2\" keys=\"Space\" />\n </>\n }>\n <Checkbox\n aria-label={title}\n className=\"!mt-0\"\n checked={isSelected}\n onClick={handleClick}\n disabled={!canSelect}\n // this is necessary to remove console spam from eslint\n onChange={() => false}\n />\n </Tooltip>\n );\n } else {\n const className = cn('!mt-0', getRadioClassnames(!canSelect));\n\n const handleClick = (event: React.MouseEvent): void => {\n event.stopPropagation();\n row.toggleSelected();\n tableMeta.rowSelection.lastSelectedRowIndex.current = row.index;\n };\n\n return (\n <button\n className={className}\n aria-checked={canSelect && isSelected}\n disabled={!canSelect}\n onClick={handleClick}\n role=\"radio\"\n type=\"button\">\n {isSelected ? <span className=\"h-2 w-2 rounded-full bg-white\" /> : null}\n </button>\n );\n }\n}\n\nexport const renderer: useTableManagerInternalColumn = {\n header: Header,\n renderer: Cell,\n size: 40,\n meta: {\n align: 'center',\n className: '!px-1',\n // TODO: remove when table3 is migrated, this satisfies the legacy table3 type\n enableSearch: false,\n header: '',\n headerClassName: '!px-1',\n },\n};\n"],"names":["Header","context","texts","useLocalization","table","tableMeta","options","meta","enableMultiRowSelection","isAllRowsSelected","getIsAllRowsSelected","isSomeRowsSelected","getIsSomeRowsSelected","title","columns","select","deselectAll","selectAll","handleChange","checked","toggleAllRowsSelected","_temp","server","loadAllIfNeeded","Promise","resolve","getState","sorting","columnFilters","then","_temp2","e","reject","React","Tooltip","Checkbox","className","indeterminate","loading","loadAllStatus","TableServerLoadAllState","Loading","onChange","toggleBetween","fromRowIndex","toRowIndex","fromIndex","toIndex","Cell","row","rowIndex","useContext","RowContext","enableGrouping","_table$getState$group","grouping","length","getIsGrouped","isSelected","getIsAllSubRowsSelected","getIsSelected","canSelect","getCanSelect","deselect","handleClick","event","rowSelection","lastSelectedRowIndex","current","index","stopPropagation","_temp6","subRows","forEach","toggleSelected","_temp5","shiftKey","_tableMeta$rowSelecti","_temp4","setRowSelection","currentRowSelection","selectedRows","filter","reduce","state","id","getRowModel","rows","slice","_temp3","some","original","undefined","_temp7","hidden","Shortcut","keys","onClick","disabled","cn","getRadioClassnames","role","type","renderer","header","size","align","enableSearch","headerClassName"],"mappings":";;;;;;;;;;AAiBA,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,IAAIH,KAAK,CAACE,OAAO,CAACE,uBAAuB,EAAE;IACvC,MAAMC,iBAAiB,GAAGL,KAAK,CAACM,oBAAoB,EAAE;IACtD,MAAMC,kBAAkB,GAAGP,KAAK,CAACQ,qBAAqB,EAAE;IACxD,MAAMC,KAAK,GAAGJ,iBAAiB,GAAGP,KAAK,CAACE,KAAK,CAACU,OAAO,CAACC,MAAM,CAACC,WAAW,GAAGd,KAAK,CAACE,KAAK,CAACU,OAAO,CAACC,MAAM,CAACE,SAAS;IAE/G,MAAMC,YAAY,aAAUC,OAAgB;MAAA;;UAOxCf,KAAK,CAACgB,qBAAqB,CAACD,OAAO,CAAC;;QAAC,MAAAE,KAAA;UAAA,IALjChB,SAAS,CAACiB,MAAM,CAACC,eAAe;;YAChC,OAAAC,OAAA,CAAAC,OAAA,CACMpB,SAAS,CAACiB,MAAM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