@economic/taco 2.54.0 → 2.55.0-settings.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (81) hide show
  1. package/dist/components/Checkbox/Checkbox.d.ts +7 -2
  2. package/dist/components/List/List.d.ts +2 -2
  3. package/dist/components/List/components/Toggle.d.ts +2 -2
  4. package/dist/components/ModeSwitch/ModeSwitch.d.ts +6 -3
  5. package/dist/components/Provider/Provider.d.ts +7 -6
  6. package/dist/components/Provider/TacoContext.d.ts +7 -0
  7. package/dist/components/Provider/useTacoSettings.d.ts +8 -0
  8. package/dist/components/Report/Report.d.ts +1 -1
  9. package/dist/components/Switch/Switch.d.ts +6 -4
  10. package/dist/esm/index.css +76 -5
  11. package/dist/esm/packages/taco/src/components/Checkbox/Checkbox.js +41 -63
  12. package/dist/esm/packages/taco/src/components/Checkbox/Checkbox.js.map +1 -1
  13. package/dist/esm/packages/taco/src/components/List/components/Toggle.js +14 -4
  14. package/dist/esm/packages/taco/src/components/List/components/Toggle.js.map +1 -1
  15. package/dist/esm/packages/taco/src/components/Listbox/ScrollableList.js +6 -3
  16. package/dist/esm/packages/taco/src/components/Listbox/ScrollableList.js.map +1 -1
  17. package/dist/esm/packages/taco/src/components/ModeSwitch/ModeSwitch.js +34 -12
  18. package/dist/esm/packages/taco/src/components/ModeSwitch/ModeSwitch.js.map +1 -1
  19. package/dist/esm/packages/taco/src/components/Provider/Provider.js +14 -7
  20. package/dist/esm/packages/taco/src/components/Provider/Provider.js.map +1 -1
  21. package/dist/esm/packages/taco/src/components/Provider/TacoContext.js +6 -0
  22. package/dist/esm/packages/taco/src/components/Provider/TacoContext.js.map +1 -0
  23. package/dist/esm/packages/taco/src/components/Provider/useTacoSettings.js +39 -0
  24. package/dist/esm/packages/taco/src/components/Provider/useTacoSettings.js.map +1 -0
  25. package/dist/esm/packages/taco/src/components/Report/Report.js +8 -0
  26. package/dist/esm/packages/taco/src/components/Report/Report.js.map +1 -1
  27. package/dist/esm/packages/taco/src/components/Switch/Switch.js +37 -35
  28. package/dist/esm/packages/taco/src/components/Switch/Switch.js.map +1 -1
  29. package/dist/esm/packages/taco/src/components/Table3/Table3.js +8 -0
  30. package/dist/esm/packages/taco/src/components/Table3/Table3.js.map +1 -1
  31. package/dist/esm/packages/taco/src/components/Table3/components/Columns/Cell/EditingControlCell.js.map +1 -1
  32. package/dist/esm/packages/taco/src/components/Table3/components/Toolbar/Editing/Editing.js.map +1 -1
  33. package/dist/esm/packages/taco/src/hooks/useTaco.js +9 -0
  34. package/dist/esm/packages/taco/src/hooks/useTaco.js.map +1 -0
  35. package/dist/esm/packages/taco/src/index.js +1 -1
  36. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Header/Header.js +1 -0
  37. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Header/Header.js.map +1 -1
  38. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Toolbar/Toolbar.js +6 -4
  39. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Toolbar/Toolbar.js.map +1 -1
  40. package/dist/esm/packages/taco/src/primitives/Table/Core/features/useTableRenderer.js +9 -5
  41. package/dist/esm/packages/taco/src/primitives/Table/Core/features/useTableRenderer.js.map +1 -1
  42. package/dist/esm/packages/taco/src/primitives/Table/Core/useTable.js.map +1 -1
  43. package/dist/esm/packages/taco/src/primitives/Table/types.js.map +1 -1
  44. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/features/useTablePrinting.js +18 -21
  45. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/features/useTablePrinting.js.map +1 -1
  46. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/features/useTableRowActive.js +2 -2
  47. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/features/useTableRowActive.js.map +1 -1
  48. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/listeners/useTableSettingsListener.js +57 -9
  49. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/listeners/useTableSettingsListener.js.map +1 -1
  50. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/useTableManager.js +7 -5
  51. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/useTableManager.js.map +1 -1
  52. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/useTableSettingsPreloader.js +44 -0
  53. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/useTableSettingsPreloader.js.map +1 -0
  54. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/util/settings.js +3 -1
  55. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/util/settings.js.map +1 -1
  56. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/util/setup.js +5 -2
  57. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/util/setup.js.map +1 -1
  58. package/dist/hooks/useTaco.d.ts +1 -0
  59. package/dist/index.css +76 -5
  60. package/dist/primitives/Table/Core/features/useTableRenderer.d.ts +2 -2
  61. package/dist/primitives/Table/Core/useTable.d.ts +4 -4
  62. package/dist/primitives/Table/types.d.ts +16 -6
  63. package/dist/primitives/Table/useTableManager/features/useTablePrinting.d.ts +2 -8
  64. package/dist/primitives/Table/useTableManager/features/useTableRowActive.d.ts +2 -2
  65. package/dist/primitives/Table/useTableManager/listeners/useTableSettingsListener.d.ts +2 -2
  66. package/dist/primitives/Table/useTableManager/useTableSettingsPreloader.d.ts +3 -0
  67. package/dist/primitives/Table/useTableManager/util/settings.d.ts +2 -0
  68. package/dist/taco.cjs.development.js +328 -272
  69. package/dist/taco.cjs.development.js.map +1 -1
  70. package/dist/taco.cjs.production.min.js +1 -1
  71. package/dist/taco.cjs.production.min.js.map +1 -1
  72. package/package.json +3 -3
  73. package/dist/esm/packages/taco/src/hooks/useLocalStorage.js +0 -44
  74. package/dist/esm/packages/taco/src/hooks/useLocalStorage.js.map +0 -1
  75. package/dist/esm/packages/taco/src/hooks/useTacoSettings.js +0 -9
  76. package/dist/esm/packages/taco/src/hooks/useTacoSettings.js.map +0 -1
  77. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/features/useTableSettings.js +0 -69
  78. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/features/useTableSettings.js.map +0 -1
  79. package/dist/hooks/useLocalStorage.d.ts +0 -2
  80. package/dist/hooks/useTacoSettings.d.ts +0 -1
  81. package/dist/primitives/Table/useTableManager/features/useTableSettings.d.ts +0 -3
@@ -1 +1 @@
1
- {"version":3,"file":"Report.js","sources":["../../../../../../../src/components/Report/Report.tsx"],"sourcesContent":["import React from 'react';\nimport { fixedForwardRef } from '../../types';\nimport { useReport } from './useReport';\nimport { Table } from '../../primitives/Table/Core/Table';\nimport { ReportRef, ReportProps, ReportColumnProps, ReportGroupProps } from './types';\n\nconst Column: React.FC<ReportColumnProps<unknown>> & {\n <TType = unknown>(_: ReportColumnProps<TType>): null;\n} = () => null;\n\nColumn.displayName = 'Table3Column';\n\nfunction Group(_: ReportGroupProps) {\n return null;\n}\n\nconst BaseReport = fixedForwardRef(function BaseReport<TType = unknown>(props: ReportProps<TType>, ref: React.Ref<ReportRef>) {\n const report = useReport<TType>(props, ref);\n\n return (\n <Table>\n <Table.Toolbar<TType> table={report} />\n <Table.Grid<TType> data-taco=\"table-report\" table={report} />\n </Table>\n );\n});\n\nexport const Report = fixedForwardRef(function Report<TType = unknown>(props: ReportProps<TType>, ref: React.Ref<ReportRef>) {\n const stringifiedChildren = String(props.children);\n // we force a remount (using key) when the child columns change because there are too many places to add children as an effect\n // this is cheaper from a complexity perspective, and probably performance wise as well\n const key = React.useMemo(() => String('tableKey_' + stringifiedChildren), [stringifiedChildren]);\n return <BaseReport<TType> {...props} key={key} ref={ref} />;\n}) as (<TType = unknown>(props: ReportProps<TType> & React.RefAttributes<ReportRef>) => JSX.Element) & {\n Column: typeof Column;\n Group: typeof Group;\n};\nReport.Column = Column;\nReport.Group = Group;\n\nexport type { ReportRef, ReportProps, ReportColumnProps, ReportGroupProps } from './types';\n"],"names":["Column","displayName","Group","_","BaseReport","fixedForwardRef","props","ref","report","useReport","React","Table","Toolbar","table","Grid","Report","stringifiedChildren","String","children","key","useMemo"],"mappings":";;;;;AAMA,MAAMA,MAAM,GAERA,MAAM,IAAI;AAEdA,MAAM,CAACC,WAAW,GAAG,cAAc;AAEnC,SAASC,KAAKA,CAACC,CAAmB;EAC9B,OAAO,IAAI;AACf;AAEA,MAAMC,UAAU,gBAAGC,eAAe,CAAC,SAASD,UAAUA,CAAkBE,KAAyB,EAAEC,GAAyB;EACxH,MAAMC,MAAM,GAAGC,SAAS,CAAQH,KAAK,EAAEC,GAAG,CAAC;EAE3C,oBACIG,6BAACC,KAAK,qBACFD,6BAACC,KAAK,CAACC,OAAO;IAAQC,KAAK,EAAEL;IAAU,eACvCE,6BAACC,KAAK,CAACG,IAAI;iBAAkB,cAAc;IAACD,KAAK,EAAEL;IAAU,CACzD;AAEhB,CAAC,CAAC;MAEWO,MAAM,gBAAGV,eAAe,CAAC,SAASU,MAAMA,CAAkBT,KAAyB,EAAEC,GAAyB;EACvH,MAAMS,mBAAmB,GAAGC,MAAM,CAACX,KAAK,CAACY,QAAQ,CAAC;;;EAGlD,MAAMC,GAAG,GAAGT,cAAK,CAACU,OAAO,CAAC,MAAMH,MAAM,CAAC,WAAW,GAAGD,mBAAmB,CAAC,EAAE,CAACA,mBAAmB,CAAC,CAAC;EACjG,oBAAON,6BAACN,UAAU,oBAAYE,KAAK;IAAEa,GAAG,EAAEA,GAAG;IAAEZ,GAAG,EAAEA;KAAO;AAC/D,CAAC;AAIDQ,MAAM,CAACf,MAAM,GAAGA,MAAM;AACtBe,MAAM,CAACb,KAAK,GAAGA,KAAK;;;;"}
1
+ {"version":3,"file":"Report.js","sources":["../../../../../../../src/components/Report/Report.tsx"],"sourcesContent":["import React from 'react';\nimport { fixedForwardRef } from '../../types';\nimport { useReport } from './useReport';\nimport { Table } from '../../primitives/Table/Core/Table';\nimport { ReportRef, ReportProps, ReportColumnProps, ReportGroupProps } from './types';\nimport { useTableSettingsPreloader } from '../../primitives/Table/useTableManager/useTableSettingsPreloader';\nimport { Spinner } from '../Spinner/Spinner';\n\nconst Column: React.FC<ReportColumnProps<unknown>> & {\n <TType = unknown>(_: ReportColumnProps<TType>): null;\n} = () => null;\n\nColumn.displayName = 'Table3Column';\n\nfunction Group(_: ReportGroupProps) {\n return null;\n}\n\nconst BaseReport = fixedForwardRef(function BaseReport<TType = unknown>(props: ReportProps<TType>, ref: React.Ref<ReportRef>) {\n const report = useReport<TType>(props, ref);\n\n return (\n <Table>\n <Table.Toolbar<TType> table={report} />\n <Table.Grid<TType> data-taco=\"table-report\" table={report} />\n </Table>\n );\n});\n\nexport const Report = fixedForwardRef(function Report<TType = unknown>(props: ReportProps<TType>, ref: React.Ref<ReportRef>) {\n const stringifiedChildren = String(props.children);\n // we force a remount (using key) when the child columns change because there are too many places to add children as an effect\n // this is cheaper from a complexity perspective, and probably performance wise as well\n const key = React.useMemo(() => String('tableKey_' + stringifiedChildren), [stringifiedChildren]);\n const { loading } = useTableSettingsPreloader(props.id);\n\n if (loading) {\n return <Spinner />;\n }\n\n return <BaseReport<TType> {...props} key={key} ref={ref} />;\n}) as (<TType = unknown>(props: ReportProps<TType> & React.RefAttributes<ReportRef>) => JSX.Element) & {\n Column: typeof Column;\n Group: typeof Group;\n};\nReport.Column = Column;\nReport.Group = Group;\n\nexport type { ReportRef, ReportProps, ReportColumnProps, ReportGroupProps } from './types';\n"],"names":["Column","displayName","Group","_","BaseReport","fixedForwardRef","props","ref","report","useReport","React","Table","Toolbar","table","Grid","Report","stringifiedChildren","String","children","key","useMemo","loading","useTableSettingsPreloader","id","Spinner"],"mappings":";;;;;;;AAQA,MAAMA,MAAM,GAERA,MAAM,IAAI;AAEdA,MAAM,CAACC,WAAW,GAAG,cAAc;AAEnC,SAASC,KAAKA,CAACC,CAAmB;EAC9B,OAAO,IAAI;AACf;AAEA,MAAMC,UAAU,gBAAGC,eAAe,CAAC,SAASD,UAAUA,CAAkBE,KAAyB,EAAEC,GAAyB;EACxH,MAAMC,MAAM,GAAGC,SAAS,CAAQH,KAAK,EAAEC,GAAG,CAAC;EAE3C,oBACIG,6BAACC,KAAK,qBACFD,6BAACC,KAAK,CAACC,OAAO;IAAQC,KAAK,EAAEL;IAAU,eACvCE,6BAACC,KAAK,CAACG,IAAI;iBAAkB,cAAc;IAACD,KAAK,EAAEL;IAAU,CACzD;AAEhB,CAAC,CAAC;MAEWO,MAAM,gBAAGV,eAAe,CAAC,SAASU,MAAMA,CAAkBT,KAAyB,EAAEC,GAAyB;EACvH,MAAMS,mBAAmB,GAAGC,MAAM,CAACX,KAAK,CAACY,QAAQ,CAAC;;;EAGlD,MAAMC,GAAG,GAAGT,cAAK,CAACU,OAAO,CAAC,MAAMH,MAAM,CAAC,WAAW,GAAGD,mBAAmB,CAAC,EAAE,CAACA,mBAAmB,CAAC,CAAC;EACjG,MAAM;IAAEK;GAAS,GAAGC,yBAAyB,CAAChB,KAAK,CAACiB,EAAE,CAAC;EAEvD,IAAIF,OAAO,EAAE;IACT,oBAAOX,6BAACc,OAAO,OAAG;;EAGtB,oBAAOd,6BAACN,UAAU,oBAAYE,KAAK;IAAEa,GAAG,EAAEA,GAAG;IAAEZ,GAAG,EAAEA;KAAO;AAC/D,CAAC;AAIDQ,MAAM,CAACf,MAAM,GAAGA,MAAM;AACtBe,MAAM,CAACb,KAAK,GAAGA,KAAK;;;;"}
@@ -1,48 +1,50 @@
1
1
  import { forwardRef, createElement } from 'react';
2
2
  import cn from 'clsx';
3
- import { useId } from '../../hooks/useId.js';
4
- import { Root, Thumb } from '@radix-ui/react-switch';
3
+ import { useMergedRef } from '../../hooks/useMergedRef.js';
4
+ import { Switch as Switch$1 } from 'react-aria-components';
5
5
 
6
6
  const Switch = /*#__PURE__*/forwardRef(function Switch(props, ref) {
7
7
  const {
8
+ checked,
9
+ defaultChecked,
10
+ readOnly,
8
11
  label,
9
12
  onChange,
13
+ disabled,
14
+ onClick,
15
+ className,
10
16
  ...otherProps
11
17
  } = props;
12
- const id = useId(props.id);
13
- const className = cn('group h-5 w-9 flex flex-shrink-0 rounded-full inline-flex focus-visible:yt-focus', {
14
- 'mr-2': !!label,
15
- 'bg-grey-500 hover:bg-grey-700 aria-checked:bg-blue-500 aria-checked:hover:bg-blue-700': !props.disabled,
16
- 'bg-grey-500/50 aria-checked:bg-blue-500/50 cursor-not-allowed': props.disabled
17
- }, props.className);
18
- let labelledByProps = null;
19
- if (label) {
20
- labelledByProps = {
21
- 'aria-labelledby': `${id}-label`,
22
- id
23
- };
24
- }
25
- const element = /*#__PURE__*/createElement(Root, Object.assign({}, otherProps, labelledByProps, {
26
- className: className,
18
+ const inputRef = useMergedRef(ref);
19
+ const switchContainerClassName = cn('group flex self-start', 'data-[disabled]:text-grey-300 data-[disabled]:cursor-not-allowed');
20
+ const switchClassName = cn('h-5 w-9 flex flex-shrink-0 rounded-full inline-flex cursor-pointer bg-grey-500', 'group-data-[focus-visible]:yt-focus', {
21
+ 'mr-2': !!label
22
+ }, 'group-hover:bg-grey-700',
23
+ // When switch is selected
24
+ 'group-data-[selected]:bg-blue-500',
25
+ // When switch is selected and hovered
26
+ 'group-hover:group-data-[selected]:bg-blue-700',
27
+ // When switch is disabled
28
+ 'group-data-[disabled]:!bg-grey-500/50 group-data-[disabled]:cursor-not-allowed',
29
+ // When switch is disabled and selected
30
+ 'group-data-[disabled]:group-data-[selected]:!bg-blue-500/50', className);
31
+ const switchThumbClassName = cn('pointer-events-none mt-0.5 h-4 w-4 translate-x-[0.15rem] rounded-full bg-white transition-transform will-change-transform', 'group-data-[disabled]:opacity-50', 'group-data-[selected]:translate-x-[1.1rem]');
32
+ return /*#__PURE__*/createElement(Switch$1, Object.assign({}, otherProps, {
33
+ className: switchContainerClassName,
34
+ "data-taco": "switch-container",
35
+ inputRef: inputRef,
36
+ isDisabled: disabled,
37
+ isReadOnly: readOnly,
38
+ isSelected: checked,
39
+ defaultSelected: defaultChecked,
40
+ onChange: onChange
41
+ }), /*#__PURE__*/createElement("span", {
42
+ className: switchClassName,
27
43
  "data-taco": "switch",
28
- onCheckedChange: onChange,
29
- ref: ref
30
- }), /*#__PURE__*/createElement(Thumb, {
31
- className: "pointer-events-none mt-0.5 h-4 w-4 translate-x-[0.15rem] rounded-full bg-white transition-transform will-change-transform group-disabled:opacity-50 group-aria-checked:translate-x-[1.1rem]"
32
- }));
33
- if (label) {
34
- const labelContainerClassName = cn('flex self-start cursor-pointer', {
35
- 'cursor-not-allowed text-grey-300': props.disabled
36
- });
37
- return /*#__PURE__*/createElement("span", {
38
- className: labelContainerClassName,
39
- "data-taco": "switch-container"
40
- }, element, /*#__PURE__*/createElement("label", {
41
- htmlFor: id,
42
- id: `${id}-label`
43
- }, label));
44
- }
45
- return element;
44
+ onClick: onClick
45
+ }, /*#__PURE__*/createElement("span", {
46
+ className: switchThumbClassName
47
+ })), label);
46
48
  });
47
49
  Switch.displayName = 'Switch';
48
50
 
@@ -1 +1 @@
1
- {"version":3,"file":"Switch.js","sources":["../../../../../../../src/components/Switch/Switch.tsx"],"sourcesContent":["import * as React from 'react';\nimport cn from 'clsx';\nimport * as PrimitiveSwitch from '@radix-ui/react-switch';\nimport { useId } from '../../hooks/useId';\n\ntype SwitchBaseProps = Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, 'children' | 'onChange'> & {\n /** Label for the switch */\n label?: React.ReactNode;\n /* Whether user input is required */\n required?: boolean;\n};\n\nexport interface UncontrolledSwitchProps extends SwitchBaseProps {\n checked?: never;\n onChange?: never;\n /* The default checked state (uncontrolled) */\n defaultChecked?: boolean;\n}\n\nexport interface ControlledSwitchProps extends SwitchBaseProps {\n defaultChecked?: never;\n /* The current checked state (controlled) */\n checked: boolean;\n /* Handler called when the checked state changes */\n onChange: (checked: boolean) => void;\n}\n\nexport type SwitchProps = UncontrolledSwitchProps | ControlledSwitchProps;\n\nexport const Switch = React.forwardRef(function Switch(props: SwitchProps, ref: React.Ref<HTMLButtonElement>) {\n const { label, onChange, ...otherProps } = props;\n const id = useId(props.id);\n\n const className = cn(\n 'group h-5 w-9 flex flex-shrink-0 rounded-full inline-flex focus-visible:yt-focus',\n {\n 'mr-2': !!label,\n 'bg-grey-500 hover:bg-grey-700 aria-checked:bg-blue-500 aria-checked:hover:bg-blue-700': !props.disabled,\n 'bg-grey-500/50 aria-checked:bg-blue-500/50 cursor-not-allowed': props.disabled,\n },\n props.className\n );\n\n let labelledByProps: Record<string, string> | null = null;\n\n if (label) {\n labelledByProps = {\n 'aria-labelledby': `${id}-label`,\n id,\n };\n }\n\n const element = (\n <PrimitiveSwitch.Root\n {...otherProps}\n {...labelledByProps}\n className={className}\n data-taco=\"switch\"\n onCheckedChange={onChange}\n ref={ref}>\n <PrimitiveSwitch.Thumb className=\"pointer-events-none mt-0.5 h-4 w-4 translate-x-[0.15rem] rounded-full bg-white transition-transform will-change-transform group-disabled:opacity-50 group-aria-checked:translate-x-[1.1rem]\" />\n </PrimitiveSwitch.Root>\n );\n\n if (label) {\n const labelContainerClassName = cn('flex self-start cursor-pointer', {\n 'cursor-not-allowed text-grey-300': props.disabled,\n });\n\n return (\n <span className={labelContainerClassName} data-taco=\"switch-container\">\n {element}\n <label htmlFor={id} id={`${id}-label`}>\n {label}\n </label>\n </span>\n );\n }\n\n return element;\n});\nSwitch.displayName = 'Switch';\n"],"names":["Switch","React","props","ref","label","onChange","otherProps","id","useId","className","cn","disabled","labelledByProps","element","PrimitiveSwitch","onCheckedChange","labelContainerClassName","htmlFor","displayName"],"mappings":";;;;;MA6BaA,MAAM,gBAAGC,UAAgB,CAAC,SAASD,MAAMA,CAACE,KAAkB,EAAEC,GAAiC;EACxG,MAAM;IAAEC,KAAK;IAAEC,QAAQ;IAAE,GAAGC;GAAY,GAAGJ,KAAK;EAChD,MAAMK,EAAE,GAAGC,KAAK,CAACN,KAAK,CAACK,EAAE,CAAC;EAE1B,MAAME,SAAS,GAAGC,EAAE,CAChB,kFAAkF,EAClF;IACI,MAAM,EAAE,CAAC,CAACN,KAAK;IACf,uFAAuF,EAAE,CAACF,KAAK,CAACS,QAAQ;IACxG,+DAA+D,EAAET,KAAK,CAACS;GAC1E,EACDT,KAAK,CAACO,SAAS,CAClB;EAED,IAAIG,eAAe,GAAkC,IAAI;EAEzD,IAAIR,KAAK,EAAE;IACPQ,eAAe,GAAG;MACd,iBAAiB,EAAE,GAAGL,EAAE,QAAQ;MAChCA;KACH;;EAGL,MAAMM,OAAO,gBACTZ,cAACa,IAAoB,oBACbR,UAAU,EACVM,eAAe;IACnBH,SAAS,EAAEA,SAAS;iBACV,QAAQ;IAClBM,eAAe,EAAEV,QAAQ;IACzBF,GAAG,EAAEA;mBACLF,cAACa,KAAqB;IAACL,SAAS,EAAC;IAAgM,CAExO;EAED,IAAIL,KAAK,EAAE;IACP,MAAMY,uBAAuB,GAAGN,EAAE,CAAC,gCAAgC,EAAE;MACjE,kCAAkC,EAAER,KAAK,CAACS;KAC7C,CAAC;IAEF,oBACIV;MAAMQ,SAAS,EAAEO,uBAAuB;mBAAY;OAC/CH,OAAO,eACRZ;MAAOgB,OAAO,EAAEV,EAAE;MAAEA,EAAE,EAAE,GAAGA,EAAE;OACxBH,KAAK,CACF,CACL;;EAIf,OAAOS,OAAO;AAClB,CAAC;AACDb,MAAM,CAACkB,WAAW,GAAG,QAAQ;;;;"}
1
+ {"version":3,"file":"Switch.js","sources":["../../../../../../../src/components/Switch/Switch.tsx"],"sourcesContent":["import * as React from 'react';\nimport cn from 'clsx';\nimport { Switch as SwitchPrimitive, SwitchProps as SwitchPrimitiveProps } from 'react-aria-components';\n\nimport { useMergedRef } from '../../hooks/useMergedRef';\n\ntype SwitchBaseProps = Omit<SwitchPrimitiveProps, 'onChange' | 'isDisabled' | 'isReadOnly' | 'isSelected' | 'defaultSelected'> & {\n label?: React.ReactNode;\n disabled?: boolean;\n readOnly?: boolean;\n onClick?: (event: React.MouseEvent<HTMLSpanElement>) => void;\n};\n\nexport interface UncontrolledSwitchProps extends SwitchBaseProps {\n checked?: never;\n onChange?: never;\n defaultChecked?: boolean;\n}\n\nexport interface ControlledSwitchProps extends SwitchBaseProps {\n defaultChecked?: never;\n checked: boolean;\n onChange: (checked: boolean) => void;\n}\n\nexport type SwitchProps = UncontrolledSwitchProps | ControlledSwitchProps;\n\nexport const Switch = React.forwardRef(function Switch(props: SwitchProps, ref: React.Ref<HTMLInputElement>) {\n const { checked, defaultChecked, readOnly, label, onChange, disabled, onClick, className, ...otherProps } = props;\n\n const inputRef = useMergedRef<HTMLInputElement>(ref);\n\n const switchContainerClassName = cn(\n 'group flex self-start',\n 'data-[disabled]:text-grey-300 data-[disabled]:cursor-not-allowed'\n );\n\n const switchClassName = cn(\n 'h-5 w-9 flex flex-shrink-0 rounded-full inline-flex cursor-pointer bg-grey-500',\n 'group-data-[focus-visible]:yt-focus',\n {\n 'mr-2': !!label,\n },\n 'group-hover:bg-grey-700',\n // When switch is selected\n 'group-data-[selected]:bg-blue-500',\n // When switch is selected and hovered\n 'group-hover:group-data-[selected]:bg-blue-700',\n // When switch is disabled\n 'group-data-[disabled]:!bg-grey-500/50 group-data-[disabled]:cursor-not-allowed',\n // When switch is disabled and selected\n 'group-data-[disabled]:group-data-[selected]:!bg-blue-500/50',\n className\n );\n\n const switchThumbClassName = cn(\n 'pointer-events-none mt-0.5 h-4 w-4 translate-x-[0.15rem] rounded-full bg-white transition-transform will-change-transform',\n 'group-data-[disabled]:opacity-50',\n 'group-data-[selected]:translate-x-[1.1rem]'\n );\n\n return (\n <SwitchPrimitive\n {...otherProps}\n className={switchContainerClassName}\n data-taco=\"switch-container\"\n inputRef={inputRef}\n isDisabled={disabled}\n isReadOnly={readOnly}\n isSelected={checked}\n defaultSelected={defaultChecked}\n onChange={onChange}>\n <span className={switchClassName} data-taco=\"switch\" onClick={onClick}>\n <span className={switchThumbClassName} />\n </span>\n {label}\n </SwitchPrimitive>\n );\n});\nSwitch.displayName = 'Switch';\n"],"names":["Switch","React","props","ref","checked","defaultChecked","readOnly","label","onChange","disabled","onClick","className","otherProps","inputRef","useMergedRef","switchContainerClassName","cn","switchClassName","switchThumbClassName","SwitchPrimitive","isDisabled","isReadOnly","isSelected","defaultSelected","displayName"],"mappings":";;;;;MA2BaA,MAAM,gBAAGC,UAAgB,CAAC,SAASD,MAAMA,CAACE,KAAkB,EAAEC,GAAgC;EACvG,MAAM;IAAEC,OAAO;IAAEC,cAAc;IAAEC,QAAQ;IAAEC,KAAK;IAAEC,QAAQ;IAAEC,QAAQ;IAAEC,OAAO;IAAEC,SAAS;IAAE,GAAGC;GAAY,GAAGV,KAAK;EAEjH,MAAMW,QAAQ,GAAGC,YAAY,CAAmBX,GAAG,CAAC;EAEpD,MAAMY,wBAAwB,GAAGC,EAAE,CAC/B,uBAAuB,EACvB,kEAAkE,CACrE;EAED,MAAMC,eAAe,GAAGD,EAAE,CACtB,gFAAgF,EAChF,qCAAqC,EACrC;IACI,MAAM,EAAE,CAAC,CAACT;GACb,EACD,yBAAyB;;EAEzB,mCAAmC;;EAEnC,+CAA+C;;EAE/C,gFAAgF;;EAEhF,6DAA6D,EAC7DI,SAAS,CACZ;EAED,MAAMO,oBAAoB,GAAGF,EAAE,CAC3B,2HAA2H,EAC3H,kCAAkC,EAClC,4CAA4C,CAC/C;EAED,oBACIf,cAACkB,QAAe,oBACRP,UAAU;IACdD,SAAS,EAAEI,wBAAwB;iBACzB,kBAAkB;IAC5BF,QAAQ,EAAEA,QAAQ;IAClBO,UAAU,EAAEX,QAAQ;IACpBY,UAAU,EAAEf,QAAQ;IACpBgB,UAAU,EAAElB,OAAO;IACnBmB,eAAe,EAAElB,cAAc;IAC/BG,QAAQ,EAAEA;mBACVP;IAAMU,SAAS,EAAEM,eAAe;iBAAY,QAAQ;IAACP,OAAO,EAAEA;kBAC1DT;IAAMU,SAAS,EAAEO;IAAwB,CACtC,EACNX,KAAK,CACQ;AAE1B,CAAC;AACDP,MAAM,CAACwB,WAAW,GAAG,QAAQ;;;;"}
@@ -1,6 +1,8 @@
1
1
  import React__default from 'react';
2
+ import { Spinner } from '../Spinner/Spinner.js';
2
3
  import { fixedForwardRef } from '../../types.js';
3
4
  import { Table } from '../../primitives/Table/Core/Table.js';
5
+ import { useTableSettingsPreloader } from '../../primitives/Table/useTableManager/useTableSettingsPreloader.js';
4
6
  import { isTableScrolled } from './util/editing.js';
5
7
  import { useTable3 } from './useTable3.js';
6
8
  import { Alert } from './components/Editing/Alert.js';
@@ -67,6 +69,12 @@ const Table3 = /*#__PURE__*/fixedForwardRef(function Table3(props, ref) {
67
69
  // we force a remount (using key) when the child columns change because there are too many places to add children as an effect
68
70
  // this is cheaper from a complexity perspective, and probably performance wise as well
69
71
  const key = React__default.useMemo(() => String('tableKey_' + stringifiedChildren), [stringifiedChildren]);
72
+ const {
73
+ loading
74
+ } = useTableSettingsPreloader(props.id);
75
+ if (loading) {
76
+ return /*#__PURE__*/React__default.createElement(Spinner, null);
77
+ }
70
78
  return /*#__PURE__*/React__default.createElement(BaseTable3, Object.assign({}, props, {
71
79
  key: key,
72
80
  ref: ref
@@ -1 +1 @@
1
- {"version":3,"file":"Table3.js","sources":["../../../../../../../src/components/Table3/Table3.tsx"],"sourcesContent":["import React from 'react';\nimport { fixedForwardRef } from '../../types';\nimport { useTable3 } from './useTable3';\nimport { Table } from '../../primitives/Table/Core/Table';\nimport { Alert } from './components/Editing/Alert';\nimport { Table3Props, Table3Ref, Table3ColumnProps, Table3GroupProps } from './types';\nimport { Editing } from './components/Toolbar/Editing/Editing';\nimport { CreateNewRow } from './components/Row/Editing/CreateNewRow';\nimport { TemporaryRow } from './components/Row/Editing/TemporaryRow';\nimport './style.css';\nimport { isTableScrolled } from './util/editing';\n\nconst Column: React.FC<Table3ColumnProps<unknown>> & {\n <TType = unknown>(_: Table3ColumnProps<TType>): null;\n} = () => null;\n\nColumn.displayName = 'Table3Column';\n\nfunction Group(_: Table3GroupProps) {\n return null;\n}\nGroup.displayName = 'Table3Group';\n\nconst BaseTable3 = fixedForwardRef(function BaseTable3<TType = unknown>(props: Table3Props<TType>, ref: React.Ref<Table3Ref>) {\n const table3 = useTable3<TType>(props, ref);\n\n const gridAttributes = {\n 'data-table-editing-mode': table3.meta.editing?.isEditing\n ? table3.meta.editing?.isDetailedMode\n ? 'detailed'\n : 'normal'\n : undefined,\n enableHorizontalArrowKeyNavigation: table3.meta.editing.isEditing,\n };\n\n const rowsById = table3.instance.getCoreRowModel().rowsById;\n const hasAlertErrors = table3.meta.editing.getErrorsShownInAlert().filter(row => {\n if (table3.meta.server._experimentalDataLoader2) {\n // consumers of dataloader2 need to run a cleanup function, as this would otherwise return false when pages are unloaded.\n return true;\n }\n\n return rowsById[row.rowId];\n }).length;\n\n const hasCreateWorkflow = table3.meta.editing.isEnabled && props.onEditingCreate;\n const isScrolled = isTableScrolled(table3.ref);\n\n let createWorkflow;\n\n if (hasCreateWorkflow) {\n createWorkflow = (\n <CreateNewRow\n buttonRef={table3.meta.editing.createRowButtonRef}\n isScrolled={isScrolled}\n table={table3.instance}\n tableMeta={table3.meta}\n />\n );\n }\n\n return (\n <Table>\n <Table.Toolbar<TType> table={table3}>\n {table3.meta.editing.isEnabled ? (\n <Editing scrollToIndex={table3.renderer.scrollToIndex} table={table3.instance} />\n ) : null}\n </Table.Toolbar>\n {hasAlertErrors ? (\n <Alert\n className=\"mb-4\"\n scrollToIndex={table3.renderer.scrollToIndex}\n table={table3.instance}\n tableRef={table3.ref}\n />\n ) : null}\n <Table.Grid<TType>\n {...gridAttributes}\n data-taco=\"table3\"\n footerRows={hasCreateWorkflow && isScrolled ? createWorkflow : undefined}\n table={table3}>\n {hasCreateWorkflow ? (\n <>\n <TemporaryRow\n createRowButtonRef={table3.meta.editing.createRowButtonRef}\n isScrolled={isScrolled}\n table={table3.instance}\n tableMeta={table3.meta}\n tableRef={table3.ref}\n />\n {!isScrolled ? createWorkflow : null}\n </>\n ) : null}\n </Table.Grid>\n </Table>\n );\n});\n\nexport const Table3 = fixedForwardRef(function Table3<TType = unknown>(props: Table3Props<TType>, ref: React.Ref<Table3Ref>) {\n const stringifiedChildren = String(props.children);\n // we force a remount (using key) when the child columns change because there are too many places to add children as an effect\n // this is cheaper from a complexity perspective, and probably performance wise as well\n const key = React.useMemo(() => String('tableKey_' + stringifiedChildren), [stringifiedChildren]);\n return <BaseTable3<TType> {...props} key={key} ref={ref} />;\n}) as (<TType = unknown>(props: Table3Props<TType> & React.RefAttributes<Table3Ref>) => JSX.Element) & {\n Column: typeof Column;\n Group: typeof Group;\n};\nTable3.Column = Column;\nTable3.Group = Group;\n\nexport type {\n Table3Ref,\n Table3Props,\n Table3ColumnProps,\n Table3GroupProps,\n Table3EditingSaveHandler,\n Table3EditingValidatorFn,\n Table3Texts,\n Table3FeatureProps,\n Table3CommonProps,\n Table3WithoutEditingWithClientProps,\n Table3WithoutEditingWithServerProps,\n Table3WithEditingProps,\n Table3WithEditingWithClientProps,\n Table3WithEditingWithServerProps,\n Table3EditingChangeHandler,\n Table3EditingCreateHandler,\n} from './types';\n"],"names":["Column","displayName","Group","_","BaseTable3","fixedForwardRef","props","ref","table3","useTable3","gridAttributes","_table3$meta$editing","meta","editing","isEditing","_table3$meta$editing2","isDetailedMode","undefined","enableHorizontalArrowKeyNavigation","rowsById","instance","getCoreRowModel","hasAlertErrors","getErrorsShownInAlert","filter","row","server","_experimentalDataLoader2","rowId","length","hasCreateWorkflow","isEnabled","onEditingCreate","isScrolled","isTableScrolled","createWorkflow","React","CreateNewRow","buttonRef","createRowButtonRef","table","tableMeta","Table","Toolbar","Editing","scrollToIndex","renderer","Alert","className","tableRef","Grid","footerRows","TemporaryRow","Table3","stringifiedChildren","String","children","key","useMemo"],"mappings":";;;;;;;;;;AAYA,MAAMA,MAAM,GAERA,MAAM,IAAI;AAEdA,MAAM,CAACC,WAAW,GAAG,cAAc;AAEnC,SAASC,KAAKA,CAACC,CAAmB;EAC9B,OAAO,IAAI;AACf;AACAD,KAAK,CAACD,WAAW,GAAG,aAAa;AAEjC,MAAMG,UAAU,gBAAGC,eAAe,CAAC,SAASD,UAAUA,CAAkBE,KAAyB,EAAEC,GAAyB;;EACxH,MAAMC,MAAM,GAAG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AAK;IAAEmD,GAAG,EAAEA,GAAG;IAAElD,GAAG,EAAEA;KAAO;AAC/D,CAAC;AAID8C,MAAM,CAACrD,MAAM,GAAGA,MAAM;AACtBqD,MAAM,CAACnD,KAAK,GAAGA,KAAK;;;;"}
1
+ {"version":3,"file":"Table3.js","sources":["../../../../../../../src/components/Table3/Table3.tsx"],"sourcesContent":["import React from 'react';\nimport { fixedForwardRef } from '../../types';\nimport { useTable3 } from './useTable3';\nimport { Table } from '../../primitives/Table/Core/Table';\nimport { Alert } from './components/Editing/Alert';\nimport { Table3Props, Table3Ref, Table3ColumnProps, Table3GroupProps } from './types';\nimport { Editing } from './components/Toolbar/Editing/Editing';\nimport { CreateNewRow } from './components/Row/Editing/CreateNewRow';\nimport { TemporaryRow } from './components/Row/Editing/TemporaryRow';\nimport './style.css';\nimport { isTableScrolled } from './util/editing';\nimport { useTableSettingsPreloader } from '../../primitives/Table/useTableManager/useTableSettingsPreloader';\nimport { Spinner } from '../Spinner/Spinner';\n\nconst Column: React.FC<Table3ColumnProps<unknown>> & {\n <TType = unknown>(_: Table3ColumnProps<TType>): null;\n} = () => null;\n\nColumn.displayName = 'Table3Column';\n\nfunction Group(_: Table3GroupProps) {\n return null;\n}\nGroup.displayName = 'Table3Group';\n\nconst BaseTable3 = fixedForwardRef(function BaseTable3<TType = unknown>(props: Table3Props<TType>, ref: React.Ref<Table3Ref>) {\n const table3 = useTable3<TType>(props, ref);\n\n const gridAttributes = {\n 'data-table-editing-mode': table3.meta.editing?.isEditing\n ? table3.meta.editing?.isDetailedMode\n ? 'detailed'\n : 'normal'\n : undefined,\n enableHorizontalArrowKeyNavigation: table3.meta.editing.isEditing,\n };\n\n const rowsById = table3.instance.getCoreRowModel().rowsById;\n const hasAlertErrors = table3.meta.editing.getErrorsShownInAlert().filter(row => {\n if (table3.meta.server._experimentalDataLoader2) {\n // consumers of dataloader2 need to run a cleanup function, as this would otherwise return false when pages are unloaded.\n return true;\n }\n\n return rowsById[row.rowId];\n }).length;\n\n const hasCreateWorkflow = table3.meta.editing.isEnabled && props.onEditingCreate;\n const isScrolled = isTableScrolled(table3.ref);\n\n let createWorkflow;\n\n if (hasCreateWorkflow) {\n createWorkflow = (\n <CreateNewRow\n buttonRef={table3.meta.editing.createRowButtonRef}\n isScrolled={isScrolled}\n table={table3.instance}\n tableMeta={table3.meta}\n />\n );\n }\n\n return (\n <Table>\n <Table.Toolbar<TType> table={table3}>\n {table3.meta.editing.isEnabled ? (\n <Editing scrollToIndex={table3.renderer.scrollToIndex} table={table3.instance} />\n ) : null}\n </Table.Toolbar>\n {hasAlertErrors ? (\n <Alert\n className=\"mb-4\"\n scrollToIndex={table3.renderer.scrollToIndex}\n table={table3.instance}\n tableRef={table3.ref}\n />\n ) : null}\n <Table.Grid<TType>\n {...gridAttributes}\n data-taco=\"table3\"\n footerRows={hasCreateWorkflow && isScrolled ? createWorkflow : undefined}\n table={table3}>\n {hasCreateWorkflow ? (\n <>\n <TemporaryRow\n createRowButtonRef={table3.meta.editing.createRowButtonRef}\n isScrolled={isScrolled}\n table={table3.instance}\n tableMeta={table3.meta}\n tableRef={table3.ref}\n />\n {!isScrolled ? createWorkflow : null}\n </>\n ) : null}\n </Table.Grid>\n </Table>\n );\n});\n\nexport const Table3 = fixedForwardRef(function Table3<TType = unknown>(props: Table3Props<TType>, ref: React.Ref<Table3Ref>) {\n const stringifiedChildren = String(props.children);\n // we force a remount (using key) when the child columns change because there are too many places to add children as an effect\n // this is cheaper from a complexity perspective, and probably performance wise as well\n const key = React.useMemo(() => String('tableKey_' + stringifiedChildren), [stringifiedChildren]);\n const { loading } = useTableSettingsPreloader(props.id);\n\n if (loading) {\n return <Spinner />;\n }\n\n return <BaseTable3<TType> {...props} key={key} ref={ref} />;\n}) as (<TType = unknown>(props: Table3Props<TType> & React.RefAttributes<Table3Ref>) => JSX.Element) & {\n Column: typeof Column;\n Group: typeof Group;\n};\nTable3.Column = Column;\nTable3.Group = Group;\n\nexport type {\n Table3Ref,\n Table3Props,\n Table3ColumnProps,\n Table3GroupProps,\n Table3EditingSaveHandler,\n Table3EditingValidatorFn,\n Table3Texts,\n Table3FeatureProps,\n Table3CommonProps,\n Table3WithoutEditingWithClientProps,\n Table3WithoutEditingWithServerProps,\n Table3WithEditingProps,\n Table3WithEditingWithClientProps,\n Table3WithEditingWithServerProps,\n Table3EditingChangeHandler,\n Table3EditingCreateHandler,\n} from './types';\n"],"names":["Column","displayName","Group","_","BaseTable3","fixedForwardRef","props","ref","table3","useTable3","gridAttributes","_table3$meta$editing","meta","editing","isEditing","_table3$meta$editing2","isDetailedMode","undefined","enableHorizontalArrowKeyNavigation","rowsById","instance","getCoreRowModel","hasAlertErrors","getErrorsShownInAlert","filter","row","server","_experimentalDataLoader2","rowId","length","hasCreateWorkflow","isEnabled","onEditingCreate","isScrolled","isTableScrolled","createWorkflow","React","CreateNewRow","buttonRef","createRowButtonRef","table","tableMeta","Table","Toolbar","Editing","scrollToIndex","renderer","Alert","className","tableRef","Grid","footerRows","TemporaryRow","Table3","stringifiedChildren","String","children","key","useMemo","loading","useTableSettingsPreloader","id","Spinner"],"mappings":";;;;;;;;;;;;AAcA,MAAMA,MAAM,GAERA,MAAM,IAAI;AAEdA,MAAM,CAACC,WAAW,GAAG,cAAc;AAEnC,SAASC,KAAKA,CAACC,CAAmB;EAC9B,OAAO,IAAI;AACf;AACAD,KAAK,CAACD,WAAW,GAAG,aAAa;AAEjC,MAAMG,UAAU,gBAAGC,eAAe,CAAC,SAASD,UAAUA,CAAkBE,KAAyB,EAAEC,GAAyB;;EACxH,MAAMC,MAAM,GAAGC,SAAS,CAAQH,KAAK,EAAEC,GAAG,CAAC;EAE3C,MAAMG,cAAc,GAAG;IACnB,yBAAyB,EAAE,CAAAC,oBAAA,GAAAH,MAAM,CAACI,IAAI,CAACC,OAAO,cAAAF,oBAAA,eAAnBA,oBAAA,CAAqBG,SAAS,GACnD,CAAAC,qBAAA,GAAAP,MAAM,CAACI,IAAI,CAACC,OAAO,cAAAE,q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AACtBqD,MAAM,CAACnD,KAAK,GAAGA,KAAK;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"EditingControlCell.js","sources":["../../../../../../../../../../src/components/Table3/components/Columns/Cell/EditingControlCell.tsx"],"sourcesContent":["import React from 'react';\nimport { TableMeta as ReactTableMeta, ColumnMeta as ReactTableColumnMeta } from '@tanstack/react-table';\nimport { isDate } from 'date-fns';\nimport { Datepicker } from '../../../../Datepicker/Datepicker';\nimport { Switch } from '../../../../Switch/Switch';\nimport { Input } from '../../../../Input/Input';\nimport { TableColumnDataType, TableColumnRendererControl, TableFontSize } from '../../../../../primitives/Table/types';\nimport * as date from '../../../../../utils/date';\nimport { RowMoveIndicator } from './Editing/RowMoveIndicator';\nimport { TextareaWithAutosizing } from './Editing/TextareaWithAutosizing';\nimport { Field } from '../../../../Field/Field';\nimport { isElementInsideOrTriggeredFromContainer } from '../../../../../utils/dom';\nimport { TableCellRendererProps } from '../../../../../primitives/Table/Core/types';\nimport { RowContext } from '../../../../../primitives/Table/Core/components/Row/RowContext';\nimport { getCellAttributes } from '../../../../../primitives/Table/Core/components/Columns/Cell/util';\nimport { useEditingCellAutofocus } from './util';\nimport { isPressingMetaKey } from '../../../../../utils/keyboard';\nimport { Checkbox } from '../../../../Checkbox/Checkbox';\n\nexport function EditingControlCell<TType = unknown>(props: TableCellRendererProps<TType>) {\n const { cell, cellRef, isHighlighted, index } = props;\n const { rowIndex } = React.useContext(RowContext);\n const { table } = cell.getContext();\n const tableMeta = table.options.meta as ReactTableMeta<TType>;\n const columnMeta = cell.column.columnDef.meta as ReactTableColumnMeta<TType, unknown>;\n const isActiveRow = tableMeta.rowActive.rowActiveIndex === rowIndex;\n const type = columnMeta.control ?? 'input';\n const handleFocus = useEditingCellAutofocus<TType>(props);\n const value = cell.getValue();\n\n // some controls, like select2, should trigger cell changed (validation, updates) as the value changes\n const hasNonTextControl = React.useMemo(() => {\n return (\n typeof type === 'function' &&\n !!cellRef.current?.querySelector('[data-taco=\"Select2\"],[data-taco=\"switch\"],[data-taco=\"checkbox\"]')\n );\n }, [cellRef.current]);\n\n const handleChange = React.useCallback(\n (nextValue: unknown) => {\n if (nextValue !== value) {\n tableMeta.editing.setCellValue(cell, rowIndex, nextValue);\n\n if (hasNonTextControl) {\n requestAnimationFrame(() => tableMeta.editing.onCellChanged(cell, rowIndex, nextValue));\n }\n }\n },\n [hasNonTextControl, cell.row.id, cell.column.id, cell.row.original, rowIndex, value]\n );\n\n const blur = React.useCallback(\n function blur() {\n requestAnimationFrame(() => {\n tableMeta.editing.toggleDetailedMode(false);\n tableMeta.editing.onCellChanged(cell, rowIndex, undefined, !hasNonTextControl);\n });\n },\n [hasNonTextControl, cell.row.id, cell.column.id, cell.row.original, rowIndex]\n );\n\n const handleBlur = React.useCallback(\n (event: React.FocusEvent) => {\n if (isElementInsideOrTriggeredFromContainer(event.relatedTarget, event.currentTarget)) {\n return;\n }\n blur();\n },\n [blur]\n );\n\n // ensure that blur runs when the cell gets unmounted (when vertically arrow key navigating)\n React.useEffect(() => {\n const ref = cellRef.current;\n\n return () => {\n if (document.activeElement === ref || isElementInsideOrTriggeredFromContainer(document.activeElement, ref)) {\n blur();\n }\n };\n }, []);\n\n const error = tableMeta.editing.getCellError<TType>(cell);\n\n const controlProps = {\n dataType: columnMeta.dataType,\n fontSize: tableMeta.fontSize.size,\n id: cell.column.id,\n invalid: !!error,\n isDetailedMode: tableMeta.editing.isDetailedMode,\n isTruncated: !!columnMeta.enableTruncate,\n onBlur: handleBlur,\n onChange: handleChange,\n row: cell.row.original,\n rowPendingChanges: tableMeta.editing.getRowValue(cell.row.id),\n tabIndex: isActiveRow ? 0 : -1,\n toggleDetailedMode: tableMeta.editing.toggleDetailedMode,\n type,\n value,\n };\n\n const cellAttributes = {\n ...getCellAttributes(cell, index, isHighlighted),\n 'data-cell-editing-invalid': error ? true : undefined,\n 'data-taco': 'cell-control',\n onFocus: handleFocus,\n ref: cellRef,\n tabIndex: -1,\n };\n\n return (\n <td {...cellAttributes}>\n <Field invalid={!!error} message={error}>\n <MemoedEditingCell<TType> {...controlProps} />\n </Field>\n {\n // we show row move indicator here within the cell rather than the row because it is\n // an editing only feature, and we don't want to leak editing into the shared row component\n }\n <RowMoveIndicator cell={cell} cellRef={cellRef} isActiveRow={isActiveRow} />\n </td>\n );\n}\n\ntype MemoedEditingCellProps<TType = unknown, TValue = unknown> = {\n dataType?: TableColumnDataType;\n fontSize: TableFontSize;\n id: string;\n invalid: boolean;\n isDetailedMode: boolean;\n isTruncated: boolean;\n onBlur: (event: React.FocusEvent) => void;\n onChange: (value: TValue) => void;\n row: TType;\n rowPendingChanges: Partial<TType> | undefined;\n tabIndex?: number;\n toggleDetailedMode: (detailed: React.SetStateAction<boolean>) => void;\n type: TableColumnRendererControl<TType>;\n value: TValue;\n};\n\nconst MemoedEditingCell = React.memo(function MemoedEditingCell<TType = unknown>(props: MemoedEditingCellProps<TType>) {\n const {\n dataType,\n fontSize,\n id,\n invalid,\n isDetailedMode,\n isTruncated,\n onBlur,\n onChange,\n row,\n rowPendingChanges,\n tabIndex = -1,\n toggleDetailedMode,\n type = 'input',\n value,\n } = props;\n const controlRef = React.useRef<HTMLElement>(null);\n const currentValue = row[id];\n const commonProps = {\n onBlur,\n ref: controlRef,\n tabIndex,\n };\n\n const handleInputKeyDown = (event: React.KeyboardEvent<HTMLInputElement | HTMLTextAreaElement>) => {\n const target = event.target as HTMLInputElement | HTMLTextAreaElement;\n\n if (target.readOnly) {\n return;\n }\n\n // prevent active row navigation while in detailed mode\n if (\n isDetailedMode &&\n (event.key === 'ArrowUp' || event.key === 'ArrowDown' || event.key === 'ArrowLeft' || event.key === 'ArrowRight')\n ) {\n event.stopPropagation();\n }\n\n // enter or exit detail mode when pressing enter\n if (event.key === 'Enter') {\n // textareas support shift and enter, don't prevent default in that case\n if (event.shiftKey && isDetailedMode) {\n return;\n }\n\n event.preventDefault();\n\n if (isDetailedMode) {\n target.select?.();\n } else {\n target.setSelectionRange?.(target.value?.length, target.value?.length);\n }\n\n toggleDetailedMode(editing => !editing);\n return;\n }\n\n // reset the value, or exit edit mode when pressing escape\n if (event.key === 'Escape') {\n if (isDetailedMode) {\n event.preventDefault();\n toggleDetailedMode(false);\n\n if (value !== currentValue) {\n props.onChange(currentValue);\n }\n\n // have to let onChange run before selecting, otherwise the value changes\n requestAnimationFrame(() => target.select?.());\n }\n\n return;\n }\n\n // toggle into detailed mode when actually inputting something\n if (!isPressingMetaKey(event) && (/^[a-z0-9]$/i.test(event.key) || event.key === 'Backspace')) {\n toggleDetailedMode(true);\n }\n };\n\n if (typeof type === 'function') {\n const controlFnProps = {\n ...commonProps,\n invalid,\n setValue: onChange,\n onKeyDown: (event: React.KeyboardEvent<HTMLElement>) => {\n const target = (event.target as HTMLElement) || null;\n // it make sense to handle keydown for the custom edititng controls only if target is either input or textarea\n if (target && (target.tagName === 'INPUT' || target.tagName === 'TEXTAREA')) {\n handleInputKeyDown(event as React.KeyboardEvent<HTMLInputElement | HTMLTextAreaElement>);\n }\n },\n value,\n };\n\n return type(controlFnProps, { ...row, ...rowPendingChanges });\n }\n\n if (type === 'switch') {\n return (\n <Switch\n {...commonProps}\n checked={Boolean(value)}\n onChange={onChange}\n ref={controlRef as React.RefObject<HTMLButtonElement>}\n />\n );\n }\n\n if (type === 'checkbox') {\n return (\n <Checkbox\n {...commonProps}\n checked={Boolean(value)}\n onChange={onChange}\n ref={controlRef as React.RefObject<HTMLButtonElement>}\n />\n );\n }\n\n const handleFocus = (event: React.FocusEvent<HTMLInputElement | HTMLTextAreaElement>) => {\n if (!isDetailedMode) {\n event.target.select();\n }\n };\n\n if (type === 'datepicker') {\n const valueAsDate = date.parse(value as Date | string | undefined);\n\n const handleChange = (event: React.ChangeEvent<HTMLInputElement>) => {\n const newDate = (event as any).detail as Date;\n\n if (!valueAsDate || !newDate || (isDate(valueAsDate) && isDate(newDate) && !date.isWeakEqual(valueAsDate, newDate))) {\n props.onChange(newDate);\n }\n };\n\n const handleDatepickerInputKeyDown = (event: React.KeyboardEvent<HTMLInputElement>) => {\n // When in detailed mode, we want to handle the change, when 'Enter' is pressed.\n // To make it possible, we just need to prevent handleInputKeyDown from being executed, and give the full control to Datepicker,\n // by doing this, Datepicker will exit \"detailed mode\" by itself when a valid date change event is triggered.\n // In any other cases we'll just execute the \"handleInputKeyDown\" handler.\n if (isDetailedMode && event.key === 'Enter' && (event.target as HTMLInputElement).value !== '') {\n return;\n }\n\n handleInputKeyDown(event);\n };\n\n return (\n <Datepicker\n {...commonProps}\n invalid={invalid}\n onChange={handleChange}\n onFocus={handleFocus}\n onKeyDown={handleDatepickerInputKeyDown}\n ref={controlRef as React.RefObject<HTMLInputElement>}\n value={valueAsDate}\n />\n );\n }\n\n if (type === 'textarea') {\n const handleChange = (event: React.ChangeEvent<HTMLTextAreaElement>) => {\n onChange(event.target.value);\n };\n\n return (\n <TextareaWithAutosizing\n {...commonProps}\n fontSize={fontSize}\n invalid={invalid}\n isTruncated={isTruncated}\n onChange={handleChange}\n onFocus={handleFocus}\n onKeyDown={handleInputKeyDown}\n ref={controlRef as React.RefObject<HTMLTextAreaElement>}\n value={String(value ?? '')}\n />\n );\n }\n\n const handleChange = (event: React.ChangeEvent<HTMLInputElement>) => {\n onChange(dataType === 'number' && event.target.value ? Number.parseInt(event.target.value) : event.target.value);\n };\n\n return (\n <Input\n {...commonProps}\n invalid={invalid}\n onChange={handleChange}\n onFocus={handleFocus}\n onKeyDown={handleInputKeyDown}\n ref={controlRef as React.RefObject<HTMLInputElement>}\n type={dataType === 'number' ? 'number' : undefined}\n value={dataType === 'number' ? (value as number) : String(value ?? '')}\n />\n );\n}) as <TType = unknown>(props: MemoedEditingCellProps<TType>) => JSX.Element;\n"],"names":["EditingControlCell","props","cell","cellRef","isHighlighted","index","rowIndex","React","useContext","RowContext","table","getContext","tableMeta","options","meta","columnMeta","column","columnDef","isActiveRow","rowActive","rowActiveIndex","type","_columnMeta$control","control","handleFocus","useEditingCellAutofocus","value","getValue","hasNonTextControl","useMemo","_cellRef$current","current","querySelector","handleChange","useCallback","nextValue","editing","setCellValue","requestAnimationFrame","onCellChanged","row","id","original","blur","toggleDetailedMode","undefined","handleBlur","event","isElementInsideOrTriggeredFromContainer","relatedTarget","currentTarget","useEffect","ref","document","activeElement","error","getCellError","controlProps","dataType","fontSize","size","invalid","isDetailedMode","isTruncated","enableTruncate","onBlur","onChange","rowPendingChanges","getRowValue","tabIndex","cellAttributes","getCellAttributes","onFocus","Field","message","MemoedEditingCell","RowMoveIndicator","memo","controlRef","useRef","currentValue","commonProps","handleInputKeyDown","target","readOnly","key","stopPropagation","shiftKey","preventDefault","_target$select","select","call","_target$setSelectionR","_target$value","_target$value2","setSelectionRange","length","_target$select2","isPressingMetaKey","test","controlFnProps","setValue","onKeyDown","tagName","Switch","checked","Boolean","Checkbox","valueAsDate","date","newDate","detail","isDate","handleDatepickerInputKeyDown","Datepicker","TextareaWithAutosizing","String","Number","parseInt","Input"],"mappings":";;;;;;;;;;;;;;;;SAmBgBA,kBAAkBA,CAAkBC,KAAoC;;EACpF,MAAM;IAAEC,IAAI;IAAEC,OAAO;IAAEC,aAAa;IAAEC;GAAO,GAAGJ,KAAK;EACrD,MAAM;IAAEK;GAAU,GAAGC,cAAK,CAACC,UAAU,CAACC,UAAU,CAAC;EACjD,MAAM;IAAEC;GAAO,GAAGR,IAAI,CAACS,UAAU,EAAE;EACnC,MAAMC,SAAS,GAAGF,KAAK,CAACG,OAAO,CAACC,IAA6B;EAC7D,MAAMC,UAAU,GAAGb,IAAI,CAACc,MAAM,CAACC,SAAS,CAACH,IAA4C;EACrF,MAAMI,WAAW,GAAGN,SAAS,CAACO,SAAS,CAACC,cAAc,KAAKd,QAAQ;EACnE,MAAMe,IAAI,IAAAC,mBAAA,GAAGP,UAAU,CAACQ,OAAO,cAAAD,mBAAA,cAAAA,mBAAA,GAAI,OAAO;EAC1C,MAAME,WAAW,GAAGC,uBAAuB,CAAQxB,KAAK,CAAC;EACzD,MAAMyB,KAAK,GAAG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AAG,EAAE0B,UAAkD;MACvDpD,KAAK,EAAE0F,MAAM,CAAC1F,KAAK,aAALA,KAAK,cAALA,KAAK,GAAI,EAAE;OAC3B;;EAIV,MAAMO,YAAY,GAAIc,KAA0C;IAC5DmB,QAAQ,CAACR,QAAQ,KAAK,QAAQ,IAAIX,KAAK,CAACoC,MAAM,CAACzD,KAAK,GAAG2F,MAAM,CAACC,QAAQ,CAACvE,KAAK,CAACoC,MAAM,CAACzD,KAAK,CAAC,GAAGqB,KAAK,CAACoC,MAAM,CAACzD,KAAK,CAAC;GACnH;EAED,oBACInB,6BAACgH,KAAK,oBACEtC,WAAW;IACfpB,OAAO,EAAEA,OAAO;IAChBK,QAAQ,EAAEjC,YAAY;IACtBuC,OAAO,EAAEhD,WAAW;IACpB8E,SAAS,EAAEpB,kBAAkB;IAC7B9B,GAAG,EAAE0B,UAA+C;IACpDzD,IAAI,EAAEqC,QAAQ,KAAK,QAAQ,GAAG,QAAQ,GAAGb,SAAS;IAClDnB,KAAK,EAAEgC,QAAQ,KAAK,QAAQ,GAAIhC,KAAgB,GAAG0F,MAAM,CAAC1F,KAAK,aAALA,KAAK,cAALA,KAAK,GAAI,EAAE;KACvE;AAEV,CAAC,CAA2E;;;;"}
1
+ {"version":3,"file":"EditingControlCell.js","sources":["../../../../../../../../../../src/components/Table3/components/Columns/Cell/EditingControlCell.tsx"],"sourcesContent":["import React from 'react';\nimport { TableMeta as ReactTableMeta, ColumnMeta as ReactTableColumnMeta } from '@tanstack/react-table';\nimport { isDate } from 'date-fns';\nimport { Datepicker } from '../../../../Datepicker/Datepicker';\nimport { Switch } from '../../../../Switch/Switch';\nimport { Input } from '../../../../Input/Input';\nimport { TableColumnDataType, TableColumnRendererControl, TableFontSize } from '../../../../../primitives/Table/types';\nimport * as date from '../../../../../utils/date';\nimport { RowMoveIndicator } from './Editing/RowMoveIndicator';\nimport { TextareaWithAutosizing } from './Editing/TextareaWithAutosizing';\nimport { Field } from '../../../../Field/Field';\nimport { isElementInsideOrTriggeredFromContainer } from '../../../../../utils/dom';\nimport { TableCellRendererProps } from '../../../../../primitives/Table/Core/types';\nimport { RowContext } from '../../../../../primitives/Table/Core/components/Row/RowContext';\nimport { getCellAttributes } from '../../../../../primitives/Table/Core/components/Columns/Cell/util';\nimport { useEditingCellAutofocus } from './util';\nimport { isPressingMetaKey } from '../../../../../utils/keyboard';\nimport { Checkbox } from '../../../../Checkbox/Checkbox';\n\nexport function EditingControlCell<TType = unknown>(props: TableCellRendererProps<TType>) {\n const { cell, cellRef, isHighlighted, index } = props;\n const { rowIndex } = React.useContext(RowContext);\n const { table } = cell.getContext();\n const tableMeta = table.options.meta as ReactTableMeta<TType>;\n const columnMeta = cell.column.columnDef.meta as ReactTableColumnMeta<TType, unknown>;\n const isActiveRow = tableMeta.rowActive.rowActiveIndex === rowIndex;\n const type = columnMeta.control ?? 'input';\n const handleFocus = useEditingCellAutofocus<TType>(props);\n const value = cell.getValue();\n\n // some controls, like select2, should trigger cell changed (validation, updates) as the value changes\n const hasNonTextControl = React.useMemo(() => {\n return (\n typeof type === 'function' &&\n !!cellRef.current?.querySelector('[data-taco=\"Select2\"],[data-taco=\"switch\"],[data-taco=\"checkbox\"]')\n );\n }, [cellRef.current]);\n\n const handleChange = React.useCallback(\n (nextValue: unknown) => {\n if (nextValue !== value) {\n tableMeta.editing.setCellValue(cell, rowIndex, nextValue);\n\n if (hasNonTextControl) {\n requestAnimationFrame(() => tableMeta.editing.onCellChanged(cell, rowIndex, nextValue));\n }\n }\n },\n [hasNonTextControl, cell.row.id, cell.column.id, cell.row.original, rowIndex, value]\n );\n\n const blur = React.useCallback(\n function blur() {\n requestAnimationFrame(() => {\n tableMeta.editing.toggleDetailedMode(false);\n tableMeta.editing.onCellChanged(cell, rowIndex, undefined, !hasNonTextControl);\n });\n },\n [hasNonTextControl, cell.row.id, cell.column.id, cell.row.original, rowIndex]\n );\n\n const handleBlur = React.useCallback(\n (event: React.FocusEvent) => {\n if (isElementInsideOrTriggeredFromContainer(event.relatedTarget, event.currentTarget)) {\n return;\n }\n blur();\n },\n [blur]\n );\n\n // ensure that blur runs when the cell gets unmounted (when vertically arrow key navigating)\n React.useEffect(() => {\n const ref = cellRef.current;\n\n return () => {\n if (document.activeElement === ref || isElementInsideOrTriggeredFromContainer(document.activeElement, ref)) {\n blur();\n }\n };\n }, []);\n\n const error = tableMeta.editing.getCellError<TType>(cell);\n\n const controlProps = {\n dataType: columnMeta.dataType,\n fontSize: tableMeta.fontSize.size,\n id: cell.column.id,\n invalid: !!error,\n isDetailedMode: tableMeta.editing.isDetailedMode,\n isTruncated: !!columnMeta.enableTruncate,\n onBlur: handleBlur,\n onChange: handleChange,\n row: cell.row.original,\n rowPendingChanges: tableMeta.editing.getRowValue(cell.row.id),\n tabIndex: isActiveRow ? 0 : -1,\n toggleDetailedMode: tableMeta.editing.toggleDetailedMode,\n type,\n value,\n };\n\n const cellAttributes = {\n ...getCellAttributes(cell, index, isHighlighted),\n 'data-cell-editing-invalid': error ? true : undefined,\n 'data-taco': 'cell-control',\n onFocus: handleFocus,\n ref: cellRef,\n tabIndex: -1,\n };\n\n return (\n <td {...cellAttributes}>\n <Field invalid={!!error} message={error}>\n <MemoedEditingCell<TType> {...controlProps} />\n </Field>\n {\n // we show row move indicator here within the cell rather than the row because it is\n // an editing only feature, and we don't want to leak editing into the shared row component\n }\n <RowMoveIndicator cell={cell} cellRef={cellRef} isActiveRow={isActiveRow} />\n </td>\n );\n}\n\ntype MemoedEditingCellProps<TType = unknown, TValue = unknown> = {\n dataType?: TableColumnDataType;\n fontSize: TableFontSize;\n id: string;\n invalid: boolean;\n isDetailedMode: boolean;\n isTruncated: boolean;\n onBlur: (event: React.FocusEvent) => void;\n onChange: (value: TValue) => void;\n row: TType;\n rowPendingChanges: Partial<TType> | undefined;\n tabIndex?: number;\n toggleDetailedMode: (detailed: React.SetStateAction<boolean>) => void;\n type: TableColumnRendererControl<TType>;\n value: TValue;\n};\n\nconst MemoedEditingCell = React.memo(function MemoedEditingCell<TType = unknown>(props: MemoedEditingCellProps<TType>) {\n const {\n dataType,\n fontSize,\n id,\n invalid,\n isDetailedMode,\n isTruncated,\n onBlur,\n onChange,\n row,\n rowPendingChanges,\n tabIndex = -1,\n toggleDetailedMode,\n type = 'input',\n value,\n } = props;\n const controlRef = React.useRef<HTMLElement>(null);\n const currentValue = row[id];\n const commonProps = {\n onBlur,\n ref: controlRef,\n tabIndex,\n };\n\n const handleInputKeyDown = (event: React.KeyboardEvent<HTMLInputElement | HTMLTextAreaElement>) => {\n const target = event.target as HTMLInputElement | HTMLTextAreaElement;\n\n if (target.readOnly) {\n return;\n }\n\n // prevent active row navigation while in detailed mode\n if (\n isDetailedMode &&\n (event.key === 'ArrowUp' || event.key === 'ArrowDown' || event.key === 'ArrowLeft' || event.key === 'ArrowRight')\n ) {\n event.stopPropagation();\n }\n\n // enter or exit detail mode when pressing enter\n if (event.key === 'Enter') {\n // textareas support shift and enter, don't prevent default in that case\n if (event.shiftKey && isDetailedMode) {\n return;\n }\n\n event.preventDefault();\n\n if (isDetailedMode) {\n target.select?.();\n } else {\n target.setSelectionRange?.(target.value?.length, target.value?.length);\n }\n\n toggleDetailedMode(editing => !editing);\n return;\n }\n\n // reset the value, or exit edit mode when pressing escape\n if (event.key === 'Escape') {\n if (isDetailedMode) {\n event.preventDefault();\n toggleDetailedMode(false);\n\n if (value !== currentValue) {\n props.onChange(currentValue);\n }\n\n // have to let onChange run before selecting, otherwise the value changes\n requestAnimationFrame(() => target.select?.());\n }\n\n return;\n }\n\n // toggle into detailed mode when actually inputting something\n if (!isPressingMetaKey(event) && (/^[a-z0-9]$/i.test(event.key) || event.key === 'Backspace')) {\n toggleDetailedMode(true);\n }\n };\n\n if (typeof type === 'function') {\n const controlFnProps = {\n ...commonProps,\n invalid,\n setValue: onChange,\n onKeyDown: (event: React.KeyboardEvent<HTMLElement>) => {\n const target = (event.target as HTMLElement) || null;\n // it make sense to handle keydown for the custom edititng controls only if target is either input or textarea\n if (target && (target.tagName === 'INPUT' || target.tagName === 'TEXTAREA')) {\n handleInputKeyDown(event as React.KeyboardEvent<HTMLInputElement | HTMLTextAreaElement>);\n }\n },\n value,\n };\n\n return type(controlFnProps, { ...row, ...rowPendingChanges });\n }\n\n if (type === 'switch') {\n return (\n <Switch\n {...commonProps}\n checked={Boolean(value)}\n onChange={onChange}\n ref={controlRef as React.RefObject<HTMLInputElement>}\n />\n );\n }\n\n if (type === 'checkbox') {\n return (\n <Checkbox\n {...commonProps}\n checked={Boolean(value)}\n onChange={onChange}\n ref={controlRef as React.RefObject<HTMLInputElement>}\n />\n );\n }\n\n const handleFocus = (event: React.FocusEvent<HTMLInputElement | HTMLTextAreaElement>) => {\n if (!isDetailedMode) {\n event.target.select();\n }\n };\n\n if (type === 'datepicker') {\n const valueAsDate = date.parse(value as Date | string | undefined);\n\n const handleChange = (event: React.ChangeEvent<HTMLInputElement>) => {\n const newDate = (event as any).detail as Date;\n\n if (!valueAsDate || !newDate || (isDate(valueAsDate) && isDate(newDate) && !date.isWeakEqual(valueAsDate, newDate))) {\n props.onChange(newDate);\n }\n };\n\n const handleDatepickerInputKeyDown = (event: React.KeyboardEvent<HTMLInputElement>) => {\n // When in detailed mode, we want to handle the change, when 'Enter' is pressed.\n // To make it possible, we just need to prevent handleInputKeyDown from being executed, and give the full control to Datepicker,\n // by doing this, Datepicker will exit \"detailed mode\" by itself when a valid date change event is triggered.\n // In any other cases we'll just execute the \"handleInputKeyDown\" handler.\n if (isDetailedMode && event.key === 'Enter' && (event.target as HTMLInputElement).value !== '') {\n return;\n }\n\n handleInputKeyDown(event);\n };\n\n return (\n <Datepicker\n {...commonProps}\n invalid={invalid}\n onChange={handleChange}\n onFocus={handleFocus}\n onKeyDown={handleDatepickerInputKeyDown}\n ref={controlRef as React.RefObject<HTMLInputElement>}\n value={valueAsDate}\n />\n );\n }\n\n if (type === 'textarea') {\n const handleChange = (event: React.ChangeEvent<HTMLTextAreaElement>) => {\n onChange(event.target.value);\n };\n\n return (\n <TextareaWithAutosizing\n {...commonProps}\n fontSize={fontSize}\n invalid={invalid}\n isTruncated={isTruncated}\n onChange={handleChange}\n onFocus={handleFocus}\n onKeyDown={handleInputKeyDown}\n ref={controlRef as React.RefObject<HTMLTextAreaElement>}\n value={String(value ?? '')}\n />\n );\n }\n\n const handleChange = (event: React.ChangeEvent<HTMLInputElement>) => {\n onChange(dataType === 'number' && event.target.value ? Number.parseInt(event.target.value) : event.target.value);\n };\n\n return (\n <Input\n {...commonProps}\n invalid={invalid}\n onChange={handleChange}\n onFocus={handleFocus}\n onKeyDown={handleInputKeyDown}\n ref={controlRef as React.RefObject<HTMLInputElement>}\n type={dataType === 'number' ? 'number' : undefined}\n value={dataType === 'number' ? (value as number) : String(value ?? '')}\n />\n );\n}) as <TType = unknown>(props: MemoedEditingCellProps<TType>) => JSX.Element;\n"],"names":["EditingControlCell","props","cell","cellRef","isHighlighted","index","rowIndex","React","useContext","RowContext","table","getContext","tableMeta","options","meta","columnMeta","column","columnDef","isActiveRow","rowActive","rowActiveIndex","type","_columnMeta$control","control","handleFocus","useEditingCellAutofocus","value","getValue","hasNonTextControl","useMemo","_cellRef$current","current","querySelector","handleChange","useCallback","nextValue","editing","setCellValue","requestAnimationFrame","onCellChanged","row","id","original","blur","toggleDetailedMode","undefined","handleBlur","event","isElementInsideOrTriggeredFromContainer","relatedTarget","currentTarget","useEffect","ref","document","activeElement","error","getCellError","controlProps","dataType","fontSize","size","invalid","isDetailedMode","isTruncated","enableTruncate","onBlur","onChange","rowPendingChanges","getRowValue","tabIndex","cellAttributes","getCellAttributes","onFocus","Field","message","MemoedEditingCell","RowMoveIndicator","memo","controlRef","useRef","currentValue","commonProps","handleInputKeyDown","target","readOnly","key","stopPropagation","shiftKey","preventDefault","_target$select","select","call","_target$setSelectionR","_target$value","_target$value2","setSelectionRange","length","_target$select2","isPressingMetaKey","test","controlFnProps","setValue","onKeyDown","tagName","Switch","checked","Boolean","Checkbox","valueAsDate","date","newDate","detail","isDate","handle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,UAA+C;IACpDzD,IAAI,EAAEqC,QAAQ,KAAK,QAAQ,GAAG,QAAQ,GAAGb,SAAS;IAClDnB,KAAK,EAAEgC,QAAQ,KAAK,QAAQ,GAAIhC,KAAgB,GAAG0F,MAAM,CAAC1F,KAAK,aAALA,KAAK,cAALA,KAAK,GAAI,EAAE;KACvE;AAEV,CAAC,CAA2E;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"Editing.js","sources":["../../../../../../../../../../src/components/Table3/components/Toolbar/Editing/Editing.tsx"],"sourcesContent":["import React from 'react';\nimport { Table as ReactTable, TableMeta as ReactTableMeta } from '@tanstack/react-table';\nimport { useLocalization } from '../../../../Provider/Localization';\nimport { Tooltip } from '../../../../Tooltip/Tooltip';\nimport { ModeSwitch } from '../../../../ModeSwitch/ModeSwitch';\nimport { Shortcut } from '../../../../Shortcut/Shortcut';\nimport { shortcut } from '../../../util/editing';\n\ntype EditingProps<TType = unknown> = React.HTMLAttributes<HTMLButtonElement> & {\n scrollToIndex: any;\n table: ReactTable<TType>;\n};\n\nexport function Editing<TType = unknown>(props: EditingProps<TType>) {\n const { scrollToIndex, table } = props;\n const { texts } = useLocalization();\n const ref = React.useRef<HTMLButtonElement>(null);\n const tableMeta = table.options.meta as ReactTableMeta<TType>;\n\n const handleChange = (enabled: boolean) => {\n tableMeta.editing.toggleEditing(enabled, table, scrollToIndex);\n tableMeta.onEvent?.('editing-mode', { enabled });\n };\n\n const tooltip = (\n <>\n {texts.table3.editing.buttons.edit.tooltip}\n <Shortcut className=\"ml-2\" keys={shortcut} />\n </>\n );\n\n return (\n <Tooltip title={tooltip}>\n <ModeSwitch data-table=\"editing-toggle\" checked={tableMeta.editing.isEditing} onChange={handleChange} ref={ref} />\n </Tooltip>\n );\n}\n"],"names":["Editing","props","scrollToIndex","table","texts","useLocalization","ref","React","useRef","tableMeta","options","meta","handleChange","enabled","editing","toggleEditing","_tableMeta$onEvent","onEvent","call","tooltip","table3","buttons","edit","Shortcut","className","keys","shortcut","Tooltip","title","ModeSwitch","checked","isEditing","onChange"],"mappings":";;;;;;;SAagBA,OAAOA,CAAkBC,KAA0B;EAC/D,MAAM;IAAEC,aAAa;IAAEC;GAAO,GAAGF,KAAK;EACtC,MAAM;IAAEG;GAAO,GAAGC,eAAe,EAAE;EACnC,MAAMC,GAAG,GAAGC,cAAK,CAACC,MAAM,CAAoB,IAAI,CAAC;EACjD,MAAMC,SAAS,GAAGN,KAAK,CAACO,OAAO,CAACC,IAA6B;EAE7D,MAAMC,YAAY,GAAIC,OAAgB;;IAClCJ,SAAS,CAACK,OAAO,CAACC,aAAa,CAACF,OAAO,EAAEV,KAAK,EAAED,aAAa,CAAC;IAC9D,CAAAc,kBAAA,GAAAP,SAAS,CAACQ,OAAO,cAAAD,kBAAA,uBAAjBA,kBAAA,CAAAE,IAAA,CAAAT,SAAS,EAAW,cAAc,EAAE;MAAEI;KAAS,CAAC;GACnD;EAED,MAAMM,OAAO,gBACTZ,4DACKH,KAAK,CAACgB,MAAM,CAACN,OAAO,CAACO,OAAO,CAACC,IAAI,CAACH,OAAO,eAC1CZ,6BAACgB,QAAQ;IAACC,SAAS,EAAC,MAAM;IAACC,IAAI,EAAEC;IAAY,CAEpD;EAED,oBACInB,6BAACoB,OAAO;IAACC,KAAK,EAAET;kBACZZ,6BAACsB,UAAU;kBAAY,gBAAgB;IAACC,OAAO,EAAErB,SAAS,CAACK,OAAO,CAACiB,SAAS;IAAEC,QAAQ,EAAEpB,YAAY;IAAEN,GAAG,EAAEA;IAAO,CAC5G;AAElB;;;;"}
1
+ {"version":3,"file":"Editing.js","sources":["../../../../../../../../../../src/components/Table3/components/Toolbar/Editing/Editing.tsx"],"sourcesContent":["import React from 'react';\nimport { Table as ReactTable, TableMeta as ReactTableMeta } from '@tanstack/react-table';\nimport { useLocalization } from '../../../../Provider/Localization';\nimport { Tooltip } from '../../../../Tooltip/Tooltip';\nimport { ModeSwitch } from '../../../../ModeSwitch/ModeSwitch';\nimport { Shortcut } from '../../../../Shortcut/Shortcut';\nimport { shortcut } from '../../../util/editing';\n\ntype EditingProps<TType = unknown> = React.HTMLAttributes<HTMLButtonElement> & {\n scrollToIndex: any;\n table: ReactTable<TType>;\n};\n\nexport function Editing<TType = unknown>(props: EditingProps<TType>) {\n const { scrollToIndex, table } = props;\n const { texts } = useLocalization();\n const ref = React.useRef<HTMLInputElement>(null);\n const tableMeta = table.options.meta as ReactTableMeta<TType>;\n\n const handleChange = (enabled: boolean) => {\n tableMeta.editing.toggleEditing(enabled, table, scrollToIndex);\n tableMeta.onEvent?.('editing-mode', { enabled });\n };\n\n const tooltip = (\n <>\n {texts.table3.editing.buttons.edit.tooltip}\n <Shortcut className=\"ml-2\" keys={shortcut} />\n </>\n );\n\n return (\n <Tooltip title={tooltip}>\n <ModeSwitch data-table=\"editing-toggle\" checked={tableMeta.editing.isEditing} onChange={handleChange} ref={ref} />\n </Tooltip>\n );\n}\n"],"names":["Editing","props","scrollToIndex","table","texts","useLocalization","ref","React","useRef","tableMeta","options","meta","handleChange","enabled","editing","toggleEditing","_tableMeta$onEvent","onEvent","call","tooltip","table3","buttons","edit","Shortcut","className","keys","shortcut","Tooltip","title","ModeSwitch","checked","isEditing","onChange"],"mappings":";;;;;;;SAagBA,OAAOA,CAAkBC,KAA0B;EAC/D,MAAM;IAAEC,aAAa;IAAEC;GAAO,GAAGF,KAAK;EACtC,MAAM;IAAEG;GAAO,GAAGC,eAAe,EAAE;EACnC,MAAMC,GAAG,GAAGC,cAAK,CAACC,MAAM,CAAmB,IAAI,CAAC;EAChD,MAAMC,SAAS,GAAGN,KAAK,CAACO,OAAO,CAACC,IAA6B;EAE7D,MAAMC,YAAY,GAAIC,OAAgB;;IAClCJ,SAAS,CAACK,OAAO,CAACC,aAAa,CAACF,OAAO,EAAEV,KAAK,EAAED,aAAa,CAAC;IAC9D,CAAAc,kBAAA,GAAAP,SAAS,CAACQ,OAAO,cAAAD,kBAAA,uBAAjBA,kBAAA,CAAAE,IAAA,CAAAT,SAAS,EAAW,cAAc,EAAE;MAAEI;KAAS,CAAC;GACnD;EAED,MAAMM,OAAO,gBACTZ,4DACKH,KAAK,CAACgB,MAAM,CAACN,OAAO,CAACO,OAAO,CAACC,IAAI,CAACH,OAAO,eAC1CZ,6BAACgB,QAAQ;IAACC,SAAS,EAAC,MAAM;IAACC,IAAI,EAAEC;IAAY,CAEpD;EAED,oBACInB,6BAACoB,OAAO;IAACC,KAAK,EAAET;kBACZZ,6BAACsB,UAAU;kBAAY,gBAAgB;IAACC,OAAO,EAAErB,SAAS,CAACK,OAAO,CAACiB,SAAS;IAAEC,QAAQ,EAAEpB,YAAY;IAAEN,GAAG,EAAEA;IAAO,CAC5G;AAElB;;;;"}
@@ -0,0 +1,9 @@
1
+ import React__default from 'react';
2
+ import { TacoContext } from '../components/Provider/TacoContext.js';
3
+
4
+ function useTaco() {
5
+ return React__default.useContext(TacoContext);
6
+ }
7
+
8
+ export { useTaco };
9
+ //# sourceMappingURL=useTaco.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useTaco.js","sources":["../../../../../../src/hooks/useTaco.ts"],"sourcesContent":["import React from 'react';\nimport { TacoContext } from '../components/Provider/TacoContext';\n\nexport function useTaco() {\n return React.useContext(TacoContext);\n}\n"],"names":["useTaco","React","useContext","TacoContext"],"mappings":";;;SAGgBA,OAAOA;EACnB,OAAOC,cAAK,CAACC,UAAU,CAACC,WAAW,CAAC;AACxC;;;;"}
@@ -51,7 +51,7 @@ export { usePagination } from './components/Pagination/usePagination.js';
51
51
  export { Pagination } from './components/Pagination/Pagination.js';
52
52
  export { Progress } from './components/Progress/Progress.js';
53
53
  export { ToastProvider, useToast } from './components/Toast/Toaster.js';
54
- export { Provider, TacoContext } from './components/Provider/Provider.js';
54
+ export { Provider } from './components/Provider/Provider.js';
55
55
  export { FontSizes, fixedForwardRef } from './types.js';
56
56
  export { TableFilterComparator } from './primitives/Table/types.js';
57
57
  export { DEFAULT_PAGE_SIZE, useTableDataLoader } from './primitives/Table/useTableDataLoader.js';
@@ -191,6 +191,7 @@ const MemoedHeader = /*#__PURE__*/React__default.memo(function MemoedHeader(prop
191
191
  "data-cell-align": isGroup ? 'center' : align,
192
192
  "data-cell-id": id,
193
193
  "data-cell-pinned": isPinned ? isPinned : undefined,
194
+ "data-taco": isGroup ? 'grouped-column-header' : 'column-header',
194
195
  style: style,
195
196
  ref: setRef
196
197
  }), !isPlaceholder ? (/*#__PURE__*/React__default.createElement(HeaderContent, {
@@ -1 +1 @@
1
- {"version":3,"file":"Header.js","sources":["../../../../../../../../../../src/primitives/Table/Core/components/Header/Header.tsx"],"sourcesContent":["import React from 'react';\nimport {\n TableMeta as ReactTableMeta,\n ColumnMeta as ReactTableColumnMeta,\n Header as ReactTableHeader,\n ColumnPinningPosition as ReactTableColumnPinningPosition,\n flexRender,\n} from '@tanstack/react-table';\nimport cn from 'clsx';\nimport { freezeUptoExternalColumn, isInternalColumn, unfreezeAllExternalColumns } from '../../../useTableManager/util/columns';\nimport { Tooltip } from '../../../../../components/Tooltip/Tooltip';\nimport { SortIndicator, getSortAttributes } from './components/SortIndicator';\nimport {\n TableColumnAlignment,\n TableColumnMenu,\n TableColumnSortDirection,\n TableColumnWidth,\n TableFilterComparator,\n} from '../../../types';\nimport { Resizer } from './components/Resizer';\nimport { HeaderMenu } from './components/Menu';\nimport { getIsPinned, useSetInitialColumnSizing } from './util';\n\ninterface HeaderContentProps {\n children: React.ReactNode;\n tooltip?: React.ReactNode;\n isInternalColumnHeader: boolean;\n}\n\nconst HeaderContent = ({ children, tooltip, isInternalColumnHeader }: HeaderContentProps) => {\n if (isInternalColumnHeader || typeof children !== 'string') {\n return <>{children}</>;\n }\n\n return (\n <Tooltip title={String(tooltip ?? children)} placement=\"top\">\n <span className=\"truncate\">{children}</span>\n </Tooltip>\n );\n};\n\nexport type HeaderProps<TType = unknown> = {\n header: ReactTableHeader<TType, unknown>;\n scrollToIndex: (index: number) => void;\n};\n\nexport function Header<TType = unknown>(props: HeaderProps<TType>) {\n const { header, scrollToIndex } = props;\n\n if (header.column.getIsGrouped()) {\n return null;\n }\n\n const { table } = header.getContext();\n\n const tableMeta = table.options.meta as ReactTableMeta<TType>;\n const columnMeta = (header.column.columnDef.meta ?? {}) as ReactTableColumnMeta<TType, unknown>;\n\n const isGroup = !!header.subHeaders.length;\n const isPinned = getIsPinned(header);\n\n const canFilter = !header.isPlaceholder && header.column.getCanFilter() && !!table.options.enableColumnFilters;\n const canHide = !header.isPlaceholder && !isGroup && header.column.getCanHide();\n const canMeasureSize = !!table.getRowModel().rows.length;\n const canPin = !header.isPlaceholder && !isGroup && header.column.getCanPin();\n const canResize = !header.isPlaceholder && !isGroup && header.column.getCanResize();\n const canSort = !header.isPlaceholder && !isGroup && header.column.getCanSort();\n const canGoto = canSort && !header.isPlaceholder && !isGroup && tableMeta.rowGoto.isEnabled && !!header.column.getIsSorted();\n\n const hasMenu = !isInternalColumn(header.id) && (canHide || canGoto || canPin || canSort || !!columnMeta.menu);\n\n const sorting = table.getState().sorting;\n const filters = table.getState().columnFilters;\n const search = table.getState().globalFilter;\n\n // passing header or column results in re-renders on scroll, so anything from those objects as memoed props\n const memoedProps: MemoedHeaderProps = {\n align: columnMeta.align,\n canFilter,\n canHide,\n canGoto,\n canMeasureSize,\n canPin,\n canResize,\n canSort,\n className: cn('group/header', columnMeta.headerClassName),\n children: flexRender(header.column.columnDef.header, header.getContext()),\n colSpan: header.colSpan,\n customMenu: columnMeta.menu,\n defaultWidth: columnMeta.defaultWidth,\n hasMenu,\n id: header.id,\n isFiltered: header.column.getIsFiltered(),\n index: header.index,\n isGroup,\n isPinned,\n isPlaceholder: header.isPlaceholder,\n offset: header.column.getStart(isPinned),\n scrollToIndex,\n setRowActiveIndex: tableMeta.rowActive.setRowActiveIndex,\n setColumnSizing: table.setColumnSizing,\n tooltip: columnMeta.tooltip,\n width: table.getState().columnSizing[header.id],\n };\n\n if (header.isPlaceholder) {\n const nextHeader = header.headerGroup.headers[header.index + 1];\n memoedProps.className = cn('!bg-white before:!content-none', memoedProps.className, {\n 'after:!content-none': nextHeader?.isPlaceholder,\n });\n }\n\n if (canFilter) {\n memoedProps.onFilter = () => {\n header.column.setFilterValue({ comparator: TableFilterComparator.Contains });\n };\n }\n\n if (canGoto) {\n memoedProps.onGoto = ((query: string) => tableMeta.rowGoto.handleGoto?.(header.id, query, sorting, filters, search)) as (\n query: string\n ) => Promise<number>;\n }\n\n if (canHide) {\n memoedProps.onHide = header.column.getToggleVisibilityHandler();\n }\n\n if (canPin) {\n memoedProps.onPin = (index: number | undefined) => {\n // TODO: this can probably be moved to a feature hook\n table.setColumnPinning(pinningState => {\n return {\n ...pinningState,\n left:\n index === undefined\n ? unfreezeAllExternalColumns(pinningState.left)\n : freezeUptoExternalColumn(\n index,\n table.getAllLeafColumns().map(column => column.id)\n ),\n };\n });\n };\n }\n\n if (canResize) {\n memoedProps.isResizing = header.column.getIsResizing();\n memoedProps.onResize = header.getResizeHandler();\n memoedProps.resetSize = header.column.resetSize;\n }\n\n if (canSort) {\n const handleSortToggle = (sortDirection: TableColumnSortDirection | false) => {\n if (sortDirection === false) {\n header.column.clearSorting();\n } else {\n header.column.toggleSorting(sortDirection === 'desc');\n }\n };\n\n memoedProps.onSort = header.column.getToggleSortingHandler();\n memoedProps.onSortToggle = handleSortToggle;\n memoedProps.sortDirection = header.column.getIsSorted();\n }\n\n return <MemoedHeader key={header.id} {...memoedProps} />;\n}\n\nexport type MemoedHeaderProps = {\n align?: TableColumnAlignment;\n canFilter: boolean;\n canHide: boolean;\n canGoto: boolean;\n canMeasureSize: boolean;\n canPin: boolean;\n canResize: boolean;\n canSort: boolean;\n children: JSX.Element | React.ReactNode;\n className?: string;\n colSpan: number;\n customMenu?: TableColumnMenu;\n defaultWidth?: TableColumnWidth;\n hasMenu: boolean;\n id: string;\n index: number;\n isFiltered: boolean;\n isGroup: boolean;\n isPinned?: ReactTableColumnPinningPosition;\n isPlaceholder: boolean;\n isResizing?: boolean;\n offset?: number;\n onFilter?: () => void;\n onGoto?: (query: string) => Promise<number>;\n onHide?: (event: unknown) => void;\n onPin?: (index: number | undefined) => void;\n onResize?: (event: unknown) => void;\n onSort?: (event: unknown) => void;\n onSortToggle?: (sortDirection: TableColumnSortDirection | false) => void;\n resetSize?: () => void;\n scrollToIndex: (index: number) => void;\n setRowActiveIndex: (index: number) => void;\n setColumnSizing: any;\n sortDirection?: TableColumnSortDirection | false;\n tooltip?: string;\n width?: TableColumnWidth;\n};\n\nconst MemoedHeader = React.memo(function MemoedHeader(props: MemoedHeaderProps) {\n const {\n align,\n canFilter,\n canGoto,\n canHide,\n canMeasureSize,\n canPin,\n canResize,\n canSort,\n children,\n className,\n colSpan,\n customMenu,\n defaultWidth,\n hasMenu,\n id,\n index,\n isFiltered,\n isGroup,\n isPinned,\n isPlaceholder,\n isResizing,\n offset,\n onFilter: handleFilter,\n onGoto: handleGoto,\n onHide: handleHide,\n onPin: handlePin,\n onResize: handleResize,\n onSort: handleSort,\n onSortToggle: handleSortToggle,\n resetSize: handleResetSize,\n scrollToIndex,\n setRowActiveIndex,\n setColumnSizing,\n sortDirection,\n tooltip,\n width,\n } = props;\n const [ref, setRef] = React.useState<HTMLTableCellElement | null>(null);\n\n // save column width if none is set\n useSetInitialColumnSizing(id, defaultWidth, width, ref, canMeasureSize, setColumnSizing);\n\n // feature specific styles\n const style: React.CSSProperties = {};\n\n // column groups often span multiple columns\n if (colSpan > 1) {\n style.gridColumn = `span ${colSpan}`;\n }\n\n // pinned columns should be offset from either the left or right\n if (isPinned) {\n style[isPinned] = `${offset}px`;\n }\n\n return (\n <th\n {...getSortAttributes(canSort, handleSort, sortDirection)}\n className={className}\n data-cell-align={isGroup ? 'center' : align}\n data-cell-id={id}\n data-cell-pinned={isPinned ? isPinned : undefined}\n style={style}\n ref={setRef}>\n {!isPlaceholder ? (\n <HeaderContent children={children} tooltip={tooltip} isInternalColumnHeader={!!isInternalColumn(id)} />\n ) : null}\n {sortDirection ? <SortIndicator direction={sortDirection} /> : null}\n {hasMenu ? (\n <HeaderMenu\n canFilter={canFilter}\n canGoto={canGoto}\n canHide={canHide}\n canPin={canPin}\n canSort={canSort}\n className={cn({\n 'ml-auto': align !== 'right',\n 'ml-0': align === 'right',\n })}\n customMenu={customMenu}\n index={index}\n isFiltered={isFiltered}\n onFilter={handleFilter}\n onGoto={handleGoto}\n onHide={handleHide}\n onPin={handlePin}\n onSortToggle={handleSortToggle}\n scrollToIndex={scrollToIndex}\n setRowActiveIndex={setRowActiveIndex}\n sortDirection={sortDirection}\n columnId={id}\n />\n ) : null}\n {canResize ? (\n <Resizer\n headerRef={ref}\n id={id}\n isResizing={isResizing as boolean}\n onResize={handleResize as (event: unknown) => void}\n onResetSize={handleResetSize as () => void}\n setColumnSizing={setColumnSizing}\n width={width}\n />\n ) : null}\n </th>\n );\n});\n"],"names":["HeaderContent","children","tooltip","isInternalColumnHeader","React","Tooltip","title","String","placement","className","Header","props","header","scrollToIndex","column","getIsGrouped","table","getContext","tableMeta","options","meta","columnMeta","_header$column$column","columnDef","isGroup","subHeaders","length","isPinned","getIsPinned","canFilter","isPlaceholder","getCanFilter","enableColumnFilters","canHide","getCanHide","canMeasureSize","getRowModel","rows","canPin","getCanPin","canResize","getCanResize","canSort","getCanSort","canGoto","rowGoto","isEnabled","getIsSorted","hasMenu","isInternalColumn","id","menu","sorting","getState","filters","columnFilters","search","globalFilter","memoedProps","align","cn","headerClassName","flexRender","colSpan","customMenu","defaultWidth","isFiltered","getIsFiltered","index","offset","getStart","setRowActiveIndex","rowActive","setColumnSizing","width","columnSizing","nextHeader","headerGroup","headers","onFilter","setFilterValue","comparator","TableFilterComparator","Contains","onGoto","query","_tableMeta$rowGoto$ha","_tableMeta$rowGoto","handleGoto","call","onHide","getToggleVisibilityHandler","onPin","setColumnPinning","pinningState","left","undefined","unfreezeAllExternalColumns","freezeUptoExternalColumn","getAllLeafColumns","map","isResizing","getIsResizing","onResize","getResizeHandler","resetSize","handleSortToggle","sortDirection","clearSorting","toggleSorting","onSort","getToggleSortingHandler","onSortToggle","MemoedHeader","key","memo","handleFilter","handleHide","handlePin","handleResize","handleSort","handleResetSize","ref","setRef","useState","useSetInitialColumnSizing","style","gridColumn","getSortAttributes","SortIndicator","direction","HeaderMenu","columnId","Resizer","headerRef","onResetSize"],"mappings":";;;;;;;;;;;AA6BA,MAAMA,aAAa,GAAGA,CAAC;EAAEC,QAAQ;EAAEC,OAAO;EAAEC;CAA4C;EACpF,IAAIA,sBAAsB,IAAI,OAAOF,QAAQ,KAAK,QAAQ,EAAE;IACxD,oBAAOG,4DAAGH,QAAQ,CAAI;;EAG1B,oBACIG,6BAACC,OAAO;IAACC,KAAK,EAAEC,MAAM,CAACL,OAAO,aAAPA,OAAO,cAAPA,OAAO,GAAID,QAAQ,CAAC;IAAEO,SAAS,EAAC;kBACnDJ;IAAMK,SAAS,EAAC;KAAYR,QAAQ,CAAQ,CACtC;AAElB,CAAC;SAOeS,MAAMA,CAAkBC,KAAyB;;EAC7D,MAAM;IAAEC,MAAM;IAAEC;GAAe,GAAGF,KAAK;EAEvC,IAAIC,MAAM,CAACE,MAAM,CAACC,YAAY,EAAE,EAAE;IAC9B,OAAO,IAAI;;EAGf,MAAM;IAAEC;GAAO,GAAGJ,MAAM,CAACK,UAAU,EAAE;EAErC,MAAMC,SAAS,GAAGF,KAAK,CAACG,OAAO,CAACC,IAA6B;EAC7D,MAAMC,UAAU,IAAAC,qBAAA,GAAIV,MAAM,CAACE,MAAM,CAACS,SAAS,CAACH,IAAI,cAAAE,qBAAA,cAAAA,qBAAA,GAAI,EAA2C;EAE/F,MAAME,OAAO,GAAG,CAAC,CAACZ,MAAM,CAACa,UAAU,CAACC,MAAM;EAC1C,MAAMC,QAAQ,GAAGC,WAAW,CAAChB,MAAM,CAAC;EAEpC,MAAMiB,SAAS,GAAG,CAACjB,MAAM,CAACkB,aAAa,IAAIlB,MAAM,CAACE,MAAM,CAACiB,YAAY,EAAE,IAAI,CAAC,CAACf,KAAK,CAACG,OAAO,CAACa,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EA,KAAK;IACZF,UAAU,EAAEA,UAAU;IACtBa,QAAQ,EAAEqC,YAAY;IACtBhC,MAAM,EAAEI,UAAU;IAClBE,MAAM,EAAE2B,UAAU;IAClBzB,KAAK,EAAE0B,SAAS;IAChBN,YAAY,EAAEN,gBAAgB;IAC9B7F,aAAa,EAAEA,aAAa;IAC5B0D,iBAAiB,EAAEA,iBAAiB;IACpCoC,aAAa,EAAEA,aAAa;IAC5ByB,QAAQ,EAAElF;IACZ,IACF,IAAI,EACPV,SAAS,iBACNpC,6BAACiI,OAAO;IACJC,SAAS,EAAEZ,GAAG;IACdxE,EAAE,EAAEA,EAAE;IACNmD,UAAU,EAAEA,UAAqB;IACjCE,QAAQ,EAAEgB,YAAwC;IAClDgB,WAAW,EAAEd,eAA6B;IAC1ChD,eAAe,EAAEA,eAAe;IAChCC,KAAK,EAAEA;IACT,IACF,IAAI,CACP;AAEb,CAAC,CAAC;;;;"}
1
+ {"version":3,"file":"Header.js","sources":["../../../../../../../../../../src/primitives/Table/Core/components/Header/Header.tsx"],"sourcesContent":["import React from 'react';\nimport {\n TableMeta as ReactTableMeta,\n ColumnMeta as ReactTableColumnMeta,\n Header as ReactTableHeader,\n ColumnPinningPosition as ReactTableColumnPinningPosition,\n flexRender,\n} from '@tanstack/react-table';\nimport cn from 'clsx';\nimport { freezeUptoExternalColumn, isInternalColumn, unfreezeAllExternalColumns } from '../../../useTableManager/util/columns';\nimport { Tooltip } from '../../../../../components/Tooltip/Tooltip';\nimport { SortIndicator, getSortAttributes } from './components/SortIndicator';\nimport {\n TableColumnAlignment,\n TableColumnMenu,\n TableColumnSortDirection,\n TableColumnWidth,\n TableFilterComparator,\n} from '../../../types';\nimport { Resizer } from './components/Resizer';\nimport { HeaderMenu } from './components/Menu';\nimport { getIsPinned, useSetInitialColumnSizing } from './util';\n\ninterface HeaderContentProps {\n children: React.ReactNode;\n tooltip?: React.ReactNode;\n isInternalColumnHeader: boolean;\n}\n\nconst HeaderContent = ({ children, tooltip, isInternalColumnHeader }: HeaderContentProps) => {\n if (isInternalColumnHeader || typeof children !== 'string') {\n return <>{children}</>;\n }\n\n return (\n <Tooltip title={String(tooltip ?? children)} placement=\"top\">\n <span className=\"truncate\">{children}</span>\n </Tooltip>\n );\n};\n\nexport type HeaderProps<TType = unknown> = {\n header: ReactTableHeader<TType, unknown>;\n scrollToIndex: (index: number) => void;\n};\n\nexport function Header<TType = unknown>(props: HeaderProps<TType>) {\n const { header, scrollToIndex } = props;\n\n if (header.column.getIsGrouped()) {\n return null;\n }\n\n const { table } = header.getContext();\n\n const tableMeta = table.options.meta as ReactTableMeta<TType>;\n const columnMeta = (header.column.columnDef.meta ?? {}) as ReactTableColumnMeta<TType, unknown>;\n\n const isGroup = !!header.subHeaders.length;\n const isPinned = getIsPinned(header);\n\n const canFilter = !header.isPlaceholder && header.column.getCanFilter() && !!table.options.enableColumnFilters;\n const canHide = !header.isPlaceholder && !isGroup && header.column.getCanHide();\n const canMeasureSize = !!table.getRowModel().rows.length;\n const canPin = !header.isPlaceholder && !isGroup && header.column.getCanPin();\n const canResize = !header.isPlaceholder && !isGroup && header.column.getCanResize();\n const canSort = !header.isPlaceholder && !isGroup && header.column.getCanSort();\n const canGoto = canSort && !header.isPlaceholder && !isGroup && tableMeta.rowGoto.isEnabled && !!header.column.getIsSorted();\n\n const hasMenu = !isInternalColumn(header.id) && (canHide || canGoto || canPin || canSort || !!columnMeta.menu);\n\n const sorting = table.getState().sorting;\n const filters = table.getState().columnFilters;\n const search = table.getState().globalFilter;\n\n // passing header or column results in re-renders on scroll, so anything from those objects as memoed props\n const memoedProps: MemoedHeaderProps = {\n align: columnMeta.align,\n canFilter,\n canHide,\n canGoto,\n canMeasureSize,\n canPin,\n canResize,\n canSort,\n className: cn('group/header', columnMeta.headerClassName),\n children: flexRender(header.column.columnDef.header, header.getContext()),\n colSpan: header.colSpan,\n customMenu: columnMeta.menu,\n defaultWidth: columnMeta.defaultWidth,\n hasMenu,\n id: header.id,\n isFiltered: header.column.getIsFiltered(),\n index: header.index,\n isGroup,\n isPinned,\n isPlaceholder: header.isPlaceholder,\n offset: header.column.getStart(isPinned),\n scrollToIndex,\n setRowActiveIndex: tableMeta.rowActive.setRowActiveIndex,\n setColumnSizing: table.setColumnSizing,\n tooltip: columnMeta.tooltip,\n width: table.getState().columnSizing[header.id],\n };\n\n if (header.isPlaceholder) {\n const nextHeader = header.headerGroup.headers[header.index + 1];\n memoedProps.className = cn('!bg-white before:!content-none', memoedProps.className, {\n 'after:!content-none': nextHeader?.isPlaceholder,\n });\n }\n\n if (canFilter) {\n memoedProps.onFilter = () => {\n header.column.setFilterValue({ comparator: TableFilterComparator.Contains });\n };\n }\n\n if (canGoto) {\n memoedProps.onGoto = ((query: string) => tableMeta.rowGoto.handleGoto?.(header.id, query, sorting, filters, search)) as (\n query: string\n ) => Promise<number>;\n }\n\n if (canHide) {\n memoedProps.onHide = header.column.getToggleVisibilityHandler();\n }\n\n if (canPin) {\n memoedProps.onPin = (index: number | undefined) => {\n // TODO: this can probably be moved to a feature hook\n table.setColumnPinning(pinningState => {\n return {\n ...pinningState,\n left:\n index === undefined\n ? unfreezeAllExternalColumns(pinningState.left)\n : freezeUptoExternalColumn(\n index,\n table.getAllLeafColumns().map(column => column.id)\n ),\n };\n });\n };\n }\n\n if (canResize) {\n memoedProps.isResizing = header.column.getIsResizing();\n memoedProps.onResize = header.getResizeHandler();\n memoedProps.resetSize = header.column.resetSize;\n }\n\n if (canSort) {\n const handleSortToggle = (sortDirection: TableColumnSortDirection | false) => {\n if (sortDirection === false) {\n header.column.clearSorting();\n } else {\n header.column.toggleSorting(sortDirection === 'desc');\n }\n };\n\n memoedProps.onSort = header.column.getToggleSortingHandler();\n memoedProps.onSortToggle = handleSortToggle;\n memoedProps.sortDirection = header.column.getIsSorted();\n }\n\n return <MemoedHeader key={header.id} {...memoedProps} />;\n}\n\nexport type MemoedHeaderProps = {\n align?: TableColumnAlignment;\n canFilter: boolean;\n canHide: boolean;\n canGoto: boolean;\n canMeasureSize: boolean;\n canPin: boolean;\n canResize: boolean;\n canSort: boolean;\n children: JSX.Element | React.ReactNode;\n className?: string;\n colSpan: number;\n customMenu?: TableColumnMenu;\n defaultWidth?: TableColumnWidth;\n hasMenu: boolean;\n id: string;\n index: number;\n isFiltered: boolean;\n isGroup: boolean;\n isPinned?: ReactTableColumnPinningPosition;\n isPlaceholder: boolean;\n isResizing?: boolean;\n offset?: number;\n onFilter?: () => void;\n onGoto?: (query: string) => Promise<number>;\n onHide?: (event: unknown) => void;\n onPin?: (index: number | undefined) => void;\n onResize?: (event: unknown) => void;\n onSort?: (event: unknown) => void;\n onSortToggle?: (sortDirection: TableColumnSortDirection | false) => void;\n resetSize?: () => void;\n scrollToIndex: (index: number) => void;\n setRowActiveIndex: (index: number) => void;\n setColumnSizing: any;\n sortDirection?: TableColumnSortDirection | false;\n tooltip?: string;\n width?: TableColumnWidth;\n};\n\nconst MemoedHeader = React.memo(function MemoedHeader(props: MemoedHeaderProps) {\n const {\n align,\n canFilter,\n canGoto,\n canHide,\n canMeasureSize,\n canPin,\n canResize,\n canSort,\n children,\n className,\n colSpan,\n customMenu,\n defaultWidth,\n hasMenu,\n id,\n index,\n isFiltered,\n isGroup,\n isPinned,\n isPlaceholder,\n isResizing,\n offset,\n onFilter: handleFilter,\n onGoto: handleGoto,\n onHide: handleHide,\n onPin: handlePin,\n onResize: handleResize,\n onSort: handleSort,\n onSortToggle: handleSortToggle,\n resetSize: handleResetSize,\n scrollToIndex,\n setRowActiveIndex,\n setColumnSizing,\n sortDirection,\n tooltip,\n width,\n } = props;\n const [ref, setRef] = React.useState<HTMLTableCellElement | null>(null);\n\n // save column width if none is set\n useSetInitialColumnSizing(id, defaultWidth, width, ref, canMeasureSize, setColumnSizing);\n\n // feature specific styles\n const style: React.CSSProperties = {};\n\n // column groups often span multiple columns\n if (colSpan > 1) {\n style.gridColumn = `span ${colSpan}`;\n }\n\n // pinned columns should be offset from either the left or right\n if (isPinned) {\n style[isPinned] = `${offset}px`;\n }\n\n return (\n <th\n {...getSortAttributes(canSort, handleSort, sortDirection)}\n className={className}\n data-cell-align={isGroup ? 'center' : align}\n data-cell-id={id}\n data-cell-pinned={isPinned ? isPinned : undefined}\n data-taco={isGroup ? 'grouped-column-header' : 'column-header'}\n style={style}\n ref={setRef}>\n {!isPlaceholder ? (\n <HeaderContent children={children} tooltip={tooltip} isInternalColumnHeader={!!isInternalColumn(id)} />\n ) : null}\n {sortDirection ? <SortIndicator direction={sortDirection} /> : null}\n {hasMenu ? (\n <HeaderMenu\n canFilter={canFilter}\n canGoto={canGoto}\n canHide={canHide}\n canPin={canPin}\n canSort={canSort}\n className={cn({\n 'ml-auto': align !== 'right',\n 'ml-0': align === 'right',\n })}\n customMenu={customMenu}\n index={index}\n isFiltered={isFiltered}\n onFilter={handleFilter}\n onGoto={handleGoto}\n onHide={handleHide}\n onPin={handlePin}\n onSortToggle={handleSortToggle}\n scrollToIndex={scrollToIndex}\n setRowActiveIndex={setRowActiveIndex}\n sortDirection={sortDirection}\n columnId={id}\n />\n ) : null}\n {canResize ? (\n <Resizer\n headerRef={ref}\n id={id}\n isResizing={isResizing as boolean}\n onResize={handleResize as (event: unknown) => void}\n onResetSize={handleResetSize as () => void}\n setColumnSizing={setColumnSizing}\n width={width}\n />\n ) : null}\n </th>\n );\n});\n"],"names":["HeaderContent","children","tooltip","isInternalColumnHeader","React","Tooltip","title","String","placement","className","Header","props","header","scrollToIndex","column","getIsGrouped","table","getContext","tableMeta","options","meta","columnMeta","_header$column$column","columnDef","isGroup","subHeaders","length","isPinned","getIsPinned","canFilter","isPlaceholder","getCanFilter","enableColumnFilters","canHide","getCanHide","canMeasureSize","getRowModel","rows","canPin","getCanPin","canResize","getCanResize","canSort","getCanSort","canGoto","rowGoto","isEnabled","getIsSorted","hasMenu","isInternalColumn","id","menu","sorting","getState","filters","columnFilters","search","globalFilter","memoedProps","align","cn","headerClassName","flexRender","colSpan","customMenu","defaultWidth","isFiltered","getIsFiltered","index","offset","getStart","setRowActiveIndex","rowActive","setColumnSizing","width","columnSizing","nextHeader","headerGroup","headers","onFilter","setFilterValue","comparator","TableFilterComparator","Contains","onGoto","query","_tableMeta$rowGoto$ha","_tableMeta$rowGoto","handleGoto","call","onHide","getToggleVisibilityHandler","onPin","setColumnPinning","pinningState","left","undefined","unfreezeAllExternalColumns","freezeUptoExternalColumn","getAllLeafColumns","map","isResizing","getIsResizing","onResize","getResizeHandler","resetSize","handleSortToggle","sortDirection","clearSorting","toggleSorting","onSort","getToggleSortingHandler","onSortToggle","MemoedHeader","key","memo","handleFilter","handleHide","handlePin","handleResize","handleSort","handleResetSize","ref","setRef","useState","useSetInitialColumnSizing","style","gridColumn","getSortAttributes","SortIndicator","direction","HeaderMenu","columnId","Resizer","headerRef","onResetSize"],"mappings":";;;;;;;;;;;AA6BA,MAAMA,aAAa,GAAGA,CAAC;EAAEC,QAAQ;EAAEC,OAAO;EAAEC;CAA4C;EACpF,IAAIA,sBAAsB,IAAI,OAAOF,QAAQ,KAAK,QAAQ,EAAE;IACxD,oBAAOG,4DAAGH,QAAQ,CAAI;;EAG1B,oBACIG,6BAACC,OAAO;IAACC,KAAK,EAAEC,MAAM,CAACL,OAAO,aAAPA,OAAO,cAAPA,OAAO,GAAID,QAAQ,CAAC;IAAEO,SAAS,EAAC;kBACnDJ;IAAMK,SAAS,EAAC;KAAYR,QAAQ,CAAQ,CACtC;AAElB,CAAC;SAOeS,MAAMA,CAAkBC,KAAyB;;EAC7D,MAAM;IAAEC,MAAM;IAAEC;GAAe,GAAGF,KAAK;EAEvC,IAAIC,MAAM,CAACE,MAAM,CAACC,YAAY,EAAE,EAAE;IAC9B,OAAO,IAAI;;EAGf,MAAM;IAAEC;GAAO,GAAGJ,MAAM,CAACK,UAAU,EAAE;EAErC,MAAMC,SAAS,GAAGF,KAAK,CAACG,OAAO,CAACC,IAA6B;EAC7D,MAAMC,UAAU,IAAAC,qBAAA,GAAIV,MAAM,CAACE,MAAM,CAACS,SAAS,CA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AAS,EAAEvB;IAAiB,GAAG,IAAI,EAClE3D,OAAO,iBACJ5C,6BAAC+H,UAAU;IACPtG,SAAS,EAAEA,SAAS;IACpBe,OAAO,EAAEA,OAAO;IAChBX,OAAO,EAAEA,OAAO;IAChBK,MAAM,EAAEA,MAAM;IACdI,OAAO,EAAEA,OAAO;IAChBjC,SAAS,EAAEmD,EAAE,CAAC;MACV,SAAS,EAAED,KAAK,KAAK,OAAO;MAC5B,MAAM,EAAEA,KAAK,KAAK;KACrB,CAAC;IACFK,UAAU,EAAEA,UAAU;IACtBI,KAAK,EAAEA,KAAK;IACZF,UAAU,EAAEA,UAAU;IACtBa,QAAQ,EAAEqC,YAAY;IACtBhC,MAAM,EAAEI,UAAU;IAClBE,MAAM,EAAE2B,UAAU;IAClBzB,KAAK,EAAE0B,SAAS;IAChBN,YAAY,EAAEN,gBAAgB;IAC9B7F,aAAa,EAAEA,aAAa;IAC5B0D,iBAAiB,EAAEA,iBAAiB;IACpCoC,aAAa,EAAEA,aAAa;IAC5ByB,QAAQ,EAAElF;IACZ,IACF,IAAI,EACPV,SAAS,iBACNpC,6BAACiI,OAAO;IACJC,SAAS,EAAEZ,GAAG;IACdxE,EAAE,EAAEA,EAAE;IACNmD,UAAU,EAAEA,UAAqB;IACjCE,QAAQ,EAAEgB,YAAwC;IAClDgB,WAAW,EAAEd,eAA6B;IAC1ChD,eAAe,EAAEA,eAAe;IAChCC,KAAK,EAAEA;IACT,IACF,IAAI,CACP;AAEb,CAAC,CAAC;;;;"}
@@ -1,5 +1,6 @@
1
1
  import React__default from 'react';
2
2
  import { Group } from '../../../../../components/Group/Group.js';
3
+ import { getSettings } from '../../../useTableManager/util/settings.js';
3
4
  import { Search } from './components/Search/Search.js';
4
5
  import { Settings } from './components/Settings/Settings.js';
5
6
  import { Print } from './components/Print/Print.js';
@@ -18,15 +19,16 @@ function TableToolbar(props) {
18
19
  const canPrint = table.meta.printing.isEnabled;
19
20
  const canSettings = canChangeSettings(table.instance, table.props.customSettings);
20
21
  const canSearch = table.meta.search.isEnabled;
22
+ const settings = getSettings(table.instance);
21
23
  return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement("div", Object.assign({}, attributes, {
22
24
  className: "mb-4 flex flex-shrink flex-grow-0 flex-wrap gap-2 print:hidden",
23
25
  "data-taco": "table-toolbar"
24
- }), table.props.toolbarLeft, /*#__PURE__*/React__default.createElement(Group, {
26
+ }), typeof table.props.toolbarLeft === 'function' ? table.props.toolbarLeft(settings) : table.props.toolbarLeft, /*#__PURE__*/React__default.createElement(Group, {
25
27
  className: "ml-auto flex-shrink-0 items-center print:hidden"
26
28
  }, customTools, canFilter ? /*#__PURE__*/React__default.createElement(Filters, {
27
29
  length: table.meta.length,
28
30
  table: table.instance
29
- }) : null, table.props.toolbarRight, canPrint ? /*#__PURE__*/React__default.createElement(Print, {
31
+ }) : null, typeof table.props.toolbarRight === 'function' ? table.props.toolbarRight(settings) : table.props.toolbarRight, canPrint ? /*#__PURE__*/React__default.createElement(Print, {
30
32
  table: table.instance,
31
33
  tableId: table.id,
32
34
  tableRef: table.ref
@@ -37,9 +39,9 @@ function TableToolbar(props) {
37
39
  scrollToIndex: table.renderer.scrollToIndex,
38
40
  table: table.instance,
39
41
  tableRef: table.ref
40
- })) : null)), table.props.toolbarPanel ? /*#__PURE__*/React__default.createElement("div", {
42
+ })) : null)), table.props.toolbarPanel ? (/*#__PURE__*/React__default.createElement("div", {
41
43
  className: "mb-4"
42
- }, table.props.toolbarPanel) : undefined);
44
+ }, typeof table.props.toolbarPanel === 'function' ? table.props.toolbarPanel(settings) : table.props.toolbarPanel)) : undefined);
43
45
  }
44
46
  function canChangeSettings(table, customSettings) {
45
47
  const tableMeta = table.options.meta;
@@ -1 +1 @@
1
- {"version":3,"file":"Toolbar.js","sources":["../../../../../../../../../../src/primitives/Table/Core/components/Toolbar/Toolbar.tsx"],"sourcesContent":["import React from 'react';\nimport { Table as ReactTable, TableMeta as ReactTableMeta } from '@tanstack/react-table';\nimport { Group } from '../../../../../components/Group/Group';\nimport { Search } from './components/Search/Search';\nimport { Settings } from './components/Settings/Settings';\nimport { Print } from './components/Print/Print';\nimport { Filters } from './components/Filters/Filters';\nimport { TableCustomSettingsRenderer } from '../../../types';\nimport { useTableReturnValue } from '../../useTable';\n\nexport type TableToolbarProps<TType = unknown> = React.HTMLAttributes<HTMLDivElement> & {\n children?: JSX.Element | null;\n table: useTableReturnValue<TType>;\n};\n\nexport function TableToolbar<TType = unknown>(props: TableToolbarProps<TType>) {\n const { children: customTools, table, ...attributes } = props;\n\n if (!isToolbarVisible<TType>(table, !!customTools)) {\n return null;\n }\n\n const canFilter = table.instance.options.enableColumnFilters;\n const canPrint = table.meta.printing.isEnabled;\n const canSettings = canChangeSettings(table.instance, table.props.customSettings);\n const canSearch = table.meta.search.isEnabled;\n\n return (\n <>\n <div\n {...attributes}\n className=\"mb-4 flex flex-shrink flex-grow-0 flex-wrap gap-2 print:hidden\"\n data-taco=\"table-toolbar\">\n {table.props.toolbarLeft}\n <Group className=\"ml-auto flex-shrink-0 items-center print:hidden\">\n {customTools}\n {canFilter ? <Filters length={table.meta.length} table={table.instance} /> : null}\n {table.props.toolbarRight}\n {canPrint ? <Print table={table.instance} tableId={table.id} tableRef={table.ref} /> : null}\n {canSettings ? <Settings customSettings={table.props.customSettings} table={table.instance} /> : null}\n {canSearch ? (\n <Search scrollToIndex={table.renderer.scrollToIndex} table={table.instance} tableRef={table.ref} />\n ) : null}\n </Group>\n </div>\n {table.props.toolbarPanel ? <div className=\"mb-4\">{table.props.toolbarPanel}</div> : undefined}\n </>\n );\n}\n\nfunction canChangeSettings<TType = unknown>(table: ReactTable<TType>, customSettings?: TableCustomSettingsRenderer) {\n const tableMeta = table.options.meta as ReactTableMeta<TType>;\n\n return (\n table.options.enableHiding ||\n tableMeta.columnOrdering.isEnabled ||\n tableMeta.fontSize.isEnabled ||\n tableMeta.rowHeight.isEnabled ||\n typeof customSettings === 'function'\n );\n}\n\nfunction isToolbarVisible<TType = unknown>(table: useTableReturnValue<TType>, customTools: boolean) {\n const hasInternalToolbar =\n customTools ||\n table.instance.options.enableColumnFilters ||\n table.meta.printing.isEnabled ||\n canChangeSettings(table.instance, table.props.customSettings) ||\n table.meta.search.isEnabled;\n\n return hasInternalToolbar || !!table.props.toolbarLeft || !!table.props.toolbarRight;\n}\n"],"names":["TableToolbar","props","children","customTools","table","attributes","isToolbarVisible","canFilter","instance","options","enableColumnFilters","canPrint","meta","printing","isEnabled","canSettings","canChangeSettings","customSettings","canSearch","search","React","className","toolbarLeft","Group","Filters","length","toolbarRight","Print","tableId","id","tableRef","ref","Settings","Search","scrollToIndex","renderer","toolbarPanel","undefined","tableMeta","enableHiding","columnOrdering","fontSize","rowHeight","hasInternalToolbar"],"mappings":";;;;;;;SAegBA,YAAYA,CAAkBC,KAA+B;EACzE,MAAM;IAAEC,QAAQ,EAAEC,WAAW;IAAEC,KAAK;IAAE,GAAGC;GAAY,GAAGJ,KAAK;EAE7D,IAAI,CAACK,gBAAgB,CAAQF,KAAK,EAAE,CAAC,CAACD,WAAW,CAAC,EAAE;IAChD,OAAO,IAAI;;EAGf,MAAMI,SAAS,GAAGH,KAAK,CAACI,QAAQ,CAACC,OAAO,CAACC,mBAAmB;EAC5D,MAAMC,QAAQ,GAAGP,KAAK,CAACQ,IAAI,CAACC,QAAQ,CAACC,SAAS;EAC9C,MAAMC,WAAW,GAAGC,iBAAiB,CAACZ,KAAK,CAACI,QAAQ,EAAEJ,KAAK,CAACH,KAAK,CAACgB,cAAc,CAAC;EACjF,MAAMC,SAAS,GAAGd,KAAK,CAACQ,IAAI,CAACO,MAAM,CAACL,SAAS;EAE7C,oBACIM,yEACIA,sDACQf,UAAU;IACdgB,SAAS,EAAC,gEAAgE;iBAChE;MACTjB,KAAK,CAACH,KAAK,CAACqB,WAAW,eACxBF,6BAACG,KAAK;IAACF,SAAS,EAAC;KACZlB,WAAW,EACXI,SAAS,gBAAGa,6BAACI,OAAO;I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,OAAO,CAACC,mBAAmB,IAC1CN,KAAK,CAACQ,IAAI,CAACC,QAAQ,CAACC,SAAS,IAC7BE,iBAAiB,CAACZ,KAAK,CAACI,QAAQ,EAAEJ,KAAK,CAACH,KAAK,CAACgB,cAAc,CAAC,IAC7Db,KAAK,CAACQ,IAAI,CAACO,MAAM,CAACL,SAAS;EAE/B,OAAO6B,kBAAkB,IAAI,CAAC,CAACvC,KAAK,CAACH,KAAK,CAACqB,WAAW,IAAI,CAAC,CAAClB,KAAK,CAACH,KAAK,CAACyB,YAAY;AACxF;;;;"}
1
+ {"version":3,"file":"Toolbar.js","sources":["../../../../../../../../../../src/primitives/Table/Core/components/Toolbar/Toolbar.tsx"],"sourcesContent":["import React from 'react';\nimport { Table as ReactTable, TableMeta as ReactTableMeta } from '@tanstack/react-table';\nimport { Group } from '../../../../../components/Group/Group';\nimport { Search } from './components/Search/Search';\nimport { Settings } from './components/Settings/Settings';\nimport { Print } from './components/Print/Print';\nimport { Filters } from './components/Filters/Filters';\nimport { TableCustomSettingsRenderer } from '../../../types';\nimport { useTableReturnValue } from '../../useTable';\nimport { getSettings } from '../../../useTableManager/util/settings';\n\nexport type TableToolbarProps<TType = unknown> = React.HTMLAttributes<HTMLDivElement> & {\n children?: JSX.Element | null;\n table: useTableReturnValue<TType>;\n};\n\nexport function TableToolbar<TType = unknown>(props: TableToolbarProps<TType>) {\n const { children: customTools, table, ...attributes } = props;\n\n if (!isToolbarVisible<TType>(table, !!customTools)) {\n return null;\n }\n\n const canFilter = table.instance.options.enableColumnFilters;\n const canPrint = table.meta.printing.isEnabled;\n const canSettings = canChangeSettings(table.instance, table.props.customSettings);\n const canSearch = table.meta.search.isEnabled;\n\n const settings = getSettings(table.instance);\n\n return (\n <>\n <div\n {...attributes}\n className=\"mb-4 flex flex-shrink flex-grow-0 flex-wrap gap-2 print:hidden\"\n data-taco=\"table-toolbar\">\n {typeof table.props.toolbarLeft === 'function' ? table.props.toolbarLeft(settings) : table.props.toolbarLeft}\n <Group className=\"ml-auto flex-shrink-0 items-center print:hidden\">\n {customTools}\n {canFilter ? <Filters length={table.meta.length} table={table.instance} /> : null}\n {typeof table.props.toolbarRight === 'function'\n ? table.props.toolbarRight(settings)\n : table.props.toolbarRight}\n {canPrint ? <Print table={table.instance} tableId={table.id} tableRef={table.ref} /> : null}\n {canSettings ? <Settings customSettings={table.props.customSettings} table={table.instance} /> : null}\n {canSearch ? (\n <Search scrollToIndex={table.renderer.scrollToIndex} table={table.instance} tableRef={table.ref} />\n ) : null}\n </Group>\n </div>\n {table.props.toolbarPanel ? (\n <div className=\"mb-4\">\n {typeof table.props.toolbarPanel === 'function'\n ? table.props.toolbarPanel(settings)\n : table.props.toolbarPanel}\n </div>\n ) : undefined}\n </>\n );\n}\n\nfunction canChangeSettings<TType = unknown>(table: ReactTable<TType>, customSettings?: TableCustomSettingsRenderer) {\n const tableMeta = table.options.meta as ReactTableMeta<TType>;\n\n return (\n table.options.enableHiding ||\n tableMeta.columnOrdering.isEnabled ||\n tableMeta.fontSize.isEnabled ||\n tableMeta.rowHeight.isEnabled ||\n typeof customSettings === 'function'\n );\n}\n\nfunction isToolbarVisible<TType = unknown>(table: useTableReturnValue<TType>, customTools: boolean) {\n const hasInternalToolbar =\n customTools ||\n table.instance.options.enableColumnFilters ||\n table.meta.printing.isEnabled ||\n canChangeSettings(table.instance, table.props.customSettings) ||\n table.meta.search.isEnabled;\n\n return hasInternalToolbar || !!table.props.toolbarLeft || !!table.props.toolbarRight;\n}\n"],"names":["TableToolbar","props","children","customTools","table","attributes","isToolbarVisible","canFilter","instance","options","enableColumnFilters","canPrint","meta","printing","isEnabled","canSettings","canChangeSettings","customSettings","canSearch","search","settings","getSettings","React","className","toolbarLeft","Group","Filters","length","toolbarRight","Print","tableId","id","tableRef","ref","Settings","Search","scrollToIndex","renderer","toolbarPanel","undefined","tableMeta","enableHiding","columnOrdering","fontSize","rowHeight","hasInternalToolbar"],"mappings":";;;;;;;;SAgBgBA,YAAYA,CAAkB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