@economic/taco 2.35.0 → 2.35.1
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/components/Select2/Select2.d.ts +4 -25
- package/dist/esm/packages/taco/src/components/Select2/Select2.js +1 -39
- package/dist/esm/packages/taco/src/components/Select2/Select2.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/Core/components/Toolbar/components/Filters/components/FilterColumn.js +4 -3
- package/dist/esm/packages/taco/src/primitives/Table/Core/components/Toolbar/components/Filters/components/FilterColumn.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/Core/components/Toolbar/components/Filters/components/FilterComparator.js +4 -3
- package/dist/esm/packages/taco/src/primitives/Table/Core/components/Toolbar/components/Filters/components/FilterComparator.js.map +1 -1
- package/dist/primitives/Table/Core/components/Toolbar/components/Filters/components/FilterColumn.d.ts +1 -1
- package/dist/taco.cjs.development.js +9 -43
- package/dist/taco.cjs.development.js.map +1 -1
- package/dist/taco.cjs.production.min.js +1 -1
- package/dist/taco.cjs.production.min.js.map +1 -1
- package/package.json +2 -2
@@ -3,8 +3,7 @@ import { Select2Children, Select2CreateHandler, Select2DeleteHandler, Select2Edi
|
|
3
3
|
import { Select2OptionProps } from './components/Option';
|
4
4
|
import { Select2GroupProps } from './components/Group';
|
5
5
|
import { Select2TitleProps } from './components/Title';
|
6
|
-
import {
|
7
|
-
import { DialogProps } from '../Dialog/Dialog';
|
6
|
+
import { FontSize } from '../../types';
|
8
7
|
declare type Select2Texts = {
|
9
8
|
allSelect: string;
|
10
9
|
allDeselect: string;
|
@@ -20,8 +19,7 @@ declare type Select2Texts = {
|
|
20
19
|
deselectAll: string;
|
21
20
|
deselectAllResults: string;
|
22
21
|
};
|
23
|
-
declare type
|
24
|
-
declare type Select2BaseProps = Omit<React.HTMLAttributes<HTMLButtonElement>, 'children' | 'defaultValue' | 'onChange' | 'value'> & {
|
22
|
+
declare type Select2Props = Omit<React.HTMLAttributes<HTMLButtonElement>, 'children' | 'defaultValue' | 'onChange' | 'value'> & {
|
25
23
|
/** Autofocus Select2 when loaded **/
|
26
24
|
autoFocus?: boolean;
|
27
25
|
/** Array of options in Select2 */
|
@@ -46,6 +44,8 @@ declare type Select2BaseProps = Omit<React.HTMLAttributes<HTMLButtonElement>, 'c
|
|
46
44
|
name?: string;
|
47
45
|
/** Handler called when user chooses an option from the provided options **/
|
48
46
|
onChange?: (value: Select2Value) => void;
|
47
|
+
/** Handler called when user creates a new option **/
|
48
|
+
onCreate?: Select2CreateHandler;
|
49
49
|
/** Handler called when user deletes an option **/
|
50
50
|
onDelete?: Select2DeleteHandler;
|
51
51
|
/** Handler called when user edits an option **/
|
@@ -60,27 +60,6 @@ declare type Select2BaseProps = Omit<React.HTMLAttributes<HTMLButtonElement>, 'c
|
|
60
60
|
/** Value of the input in select2 */
|
61
61
|
value?: Select2Value;
|
62
62
|
};
|
63
|
-
export interface OnCreateSelect2Props extends Select2BaseProps {
|
64
|
-
/** Handler called when user creates a new option with a label **/
|
65
|
-
onCreate?: Select2CreateHandler;
|
66
|
-
/** Title for button which triggers the dialog **/
|
67
|
-
dialogTriggerTitle?: never;
|
68
|
-
/** Option to disable button which triggers the create dialog **/
|
69
|
-
dialogTriggerDisabled?: never;
|
70
|
-
/** Dialog for create new option **/
|
71
|
-
dialog?: never;
|
72
|
-
}
|
73
|
-
export interface OnCreateInDialogSelect2Props extends Select2BaseProps {
|
74
|
-
/** Handler called when user creates a new option in a dialog **/
|
75
|
-
onCreate: Select2CreateHandler;
|
76
|
-
/** Title for button which triggers the dialog **/
|
77
|
-
dialogTriggerTitle: string;
|
78
|
-
/** Option to disable button which triggers the create dialog **/
|
79
|
-
dialogTriggerDisabled?: boolean;
|
80
|
-
/** Dialog for create new option **/
|
81
|
-
dialog: DialogPropType;
|
82
|
-
}
|
83
|
-
declare type Select2Props = OnCreateSelect2Props | OnCreateInDialogSelect2Props;
|
84
63
|
declare type Select2PropsWithStatics = React.ForwardRefExoticComponent<Select2Props & React.RefAttributes<HTMLButtonElement>> & {
|
85
64
|
Option: React.ForwardRefExoticComponent<Select2OptionProps>;
|
86
65
|
Group: React.ForwardRefExoticComponent<Select2GroupProps>;
|
@@ -1,6 +1,5 @@
|
|
1
1
|
import React__default from 'react';
|
2
2
|
import cn from 'clsx';
|
3
|
-
import { Icon } from '../Icon/Icon.js';
|
4
3
|
import { useMergedRef } from '../../hooks/useMergedRef.js';
|
5
4
|
import { isElementInsideTable3OrReport, getNextFocussableElement } from '../../utils/dom.js';
|
6
5
|
import { useLocalization } from '../Provider/Localization.js';
|
@@ -12,7 +11,6 @@ import { createCustomKeyboardEvent } from '../../utils/input.js';
|
|
12
11
|
import { useControllableState } from '@radix-ui/react-use-controllable-state';
|
13
12
|
import { FontSizes } from '../../types.js';
|
14
13
|
import { useIsHoverStatePaused } from '../../hooks/useIsHoverStatePaused.js';
|
15
|
-
import { _catch } from '../../../../../node_modules/babel-plugin-transform-async-to-promises/helpers.mjs.js';
|
16
14
|
import { isAriaDirectionKey } from '../../utils/aria.js';
|
17
15
|
import { Root as Root$1, createListboxValueSetter } from '../../primitives/Listbox2/components/Root.js';
|
18
16
|
import '../../primitives/Listbox2/components/Option.js';
|
@@ -45,9 +43,6 @@ const Select2 = /*#__PURE__*/React__default.forwardRef(function Select2(props, r
|
|
45
43
|
name,
|
46
44
|
onChange,
|
47
45
|
onCreate,
|
48
|
-
dialogTriggerTitle,
|
49
|
-
dialogTriggerDisabled,
|
50
|
-
dialog,
|
51
46
|
onDelete,
|
52
47
|
onEdit,
|
53
48
|
placeholder,
|
@@ -117,9 +112,6 @@ const Select2 = /*#__PURE__*/React__default.forwardRef(function Select2(props, r
|
|
117
112
|
listboxRef,
|
118
113
|
multiple,
|
119
114
|
onCreate,
|
120
|
-
dialogTriggerTitle,
|
121
|
-
dialogTriggerDisabled,
|
122
|
-
dialog,
|
123
115
|
onDelete,
|
124
116
|
onEdit,
|
125
117
|
open,
|
@@ -221,27 +213,6 @@ const Select2 = /*#__PURE__*/React__default.forwardRef(function Select2(props, r
|
|
221
213
|
setValue(nextValue);
|
222
214
|
}
|
223
215
|
};
|
224
|
-
const handleCreateInDialog = function (name, color) {
|
225
|
-
try {
|
226
|
-
const _temp2 = function () {
|
227
|
-
if (onCreate && dialog) {
|
228
|
-
const _temp = _catch(function () {
|
229
|
-
return Promise.resolve(onCreate(name, color)).then(function (option) {
|
230
|
-
setValue(option.value);
|
231
|
-
// To avoid memory leak we should bind onClose of dialog with setOpen(false)
|
232
|
-
setOpen(false);
|
233
|
-
});
|
234
|
-
}, function (err) {
|
235
|
-
console.log(err);
|
236
|
-
});
|
237
|
-
if (_temp && _temp.then) return _temp.then(function () {});
|
238
|
-
}
|
239
|
-
}();
|
240
|
-
return Promise.resolve(_temp2 && _temp2.then ? _temp2.then(function () {}) : void 0);
|
241
|
-
} catch (e) {
|
242
|
-
return Promise.reject(e);
|
243
|
-
}
|
244
|
-
};
|
245
216
|
const className = cn('border-grey-300 rounded border bg-white py-1.5 shadow-md outline-none"', createCollectionClassName());
|
246
217
|
return /*#__PURE__*/React__default.createElement(Select2Context.Provider, {
|
247
218
|
value: context
|
@@ -309,16 +280,7 @@ const Select2 = /*#__PURE__*/React__default.forwardRef(function Select2(props, r
|
|
309
280
|
}, searchQuery === '' ? ( /*#__PURE__*/React__default.createElement(Collection, null, initialChildren)) : ( /*#__PURE__*/React__default.createElement(Collection, null, filteredChildren)), onCreate ? /*#__PURE__*/React__default.createElement(Create, {
|
310
281
|
onCreate: onCreate,
|
311
282
|
options: flattenedChildren
|
312
|
-
}) : null)),
|
313
|
-
className: "border-grey-300 h-9 border-t p-1.5"
|
314
|
-
}, /*#__PURE__*/React__default.createElement(Button, {
|
315
|
-
appearance: "discrete",
|
316
|
-
disabled: dialogTriggerDisabled,
|
317
|
-
dialog: dialog(handleCreateInDialog)
|
318
|
-
}, /*#__PURE__*/React__default.createElement(Icon, {
|
319
|
-
className: "text-xs",
|
320
|
-
name: "circle-plus"
|
321
|
-
}), " ", dialogTriggerTitle)))))), /*#__PURE__*/React__default.createElement(ControlledHiddenField, {
|
283
|
+
}) : null))))), /*#__PURE__*/React__default.createElement(ControlledHiddenField, {
|
322
284
|
emptyValue: emptyValue,
|
323
285
|
multiple: multiple || tags,
|
324
286
|
name: name,
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"Select2.js","sources":["../../../../../../../src/components/Select2/Select2.tsx"],"sourcesContent":["import React from 'react';\nimport cn from 'clsx';\nimport { useControllableState } from '@radix-ui/react-use-controllable-state';\nimport * as PopoverPrimitive from '@radix-ui/react-popover';\nimport * as ListboxPrimitive from '../../primitives/Listbox2/Listbox2';\nimport {\n Select2Children,\n Select2CreateHandler,\n Select2DeleteHandler,\n Select2EditHandler,\n Select2OptionValue,\n Select2Value,\n} from './types';\nimport { Option, Select2OptionProps } from './components/Option';\nimport { Group, Select2GroupProps } from './components/Group';\nimport { Select2TitleProps, Title } from './components/Title';\nimport { Select2Context } from './components/Context';\nimport { createCollectionClassName, getFontSize } from './utilities';\nimport { useMergedRef } from '../../hooks/useMergedRef';\nimport { useBoundingClientRectListener } from '../../hooks/useBoundingClientRectListener';\nimport { createCustomKeyboardEvent } from '../../utils/input';\nimport { Trigger } from './components/Trigger';\nimport { useIsFormControl } from '../../hooks/useIsFormControl';\nimport { BubbleSelect } from '../../primitives/BubbleSelect';\nimport { Search } from './components/Search';\nimport { isGroup, useChildren } from './hooks/useChildren';\n\nimport { Create } from './components/Create';\nimport { Collection } from './components/Collection';\nimport { CollectionRef } from '../../primitives/Collection/Collection';\nimport { useLocalization } from '../Provider/Localization';\nimport { useIsHoverStatePaused } from '../../hooks/useIsHoverStatePaused';\nimport { isAriaDirectionKey } from '../../utils/aria';\nimport { getNextFocussableElement, isElementInsideTable3OrReport } from '../../utils/dom';\nimport { Color, FontSize, FontSizes } from '../../types';\nimport { Button } from '../Button/Button';\nimport { Spinner } from '../Spinner/Spinner';\nimport { Icon } from '../Icon/Icon';\nimport { DialogProps } from '../Dialog/Dialog';\n\ntype Select2Texts = {\n allSelect: string;\n allDeselect: string;\n cancel: string;\n chooseColor: string;\n create: string;\n delete: string;\n save: string;\n search: string;\n searchOrCreate: string;\n selectAll: string;\n selectAllResults: string;\n deselectAll: string;\n deselectAllResults: string;\n};\n\ntype DialogPropType = (\n onCreate: (name: string, color: Color | undefined) => void\n) => (dialogProps: Partial<DialogProps>) => JSX.Element;\n\ntype Select2BaseProps = Omit<React.HTMLAttributes<HTMLButtonElement>, 'children' | 'defaultValue' | 'onChange' | 'value'> & {\n /** Autofocus Select2 when loaded **/\n autoFocus?: boolean;\n /** Array of options in Select2 */\n children: Select2Children;\n /** Initial value of the input in Select2 */\n defaultValue?: Select2Value;\n /** Set what value should have an empty option in Select2 */\n emptyValue?: Select2OptionValue;\n /** Whether the Select2 is in a disabled state **/\n disabled?: boolean;\n /** Font size of text in Select2 **/\n fontSize?: FontSize;\n /** Draws attention to the Select2 by changing its style and making it visually prominent */\n highlighted?: boolean;\n /** Whether the Select2 is in an invalid state **/\n invalid?: boolean;\n /** Whether the Select2 is loading the data **/\n loading?: boolean;\n /** Whether the Select2 allows selecting multiple values **/\n multiple?: boolean;\n /** Whether the Select2 is in an invalid state **/\n name?: string;\n /** Handler called when user chooses an option from the provided options **/\n onChange?: (value: Select2Value) => void;\n /** Handler called when user deletes an option **/\n onDelete?: Select2DeleteHandler;\n /** Handler called when user edits an option **/\n onEdit?: Select2EditHandler;\n /** Placeholder showed when nothing is selected **/\n placeholder?: string;\n /** Whether the Select2 is in a readonly state **/\n readOnly?: boolean;\n required?: boolean;\n /** Renders select options as tags **/\n tags?: boolean;\n /** Value of the input in select2 */\n value?: Select2Value;\n};\n\nexport interface OnCreateSelect2Props extends Select2BaseProps {\n /** Handler called when user creates a new option with a label **/\n onCreate?: Select2CreateHandler;\n /** Title for button which triggers the dialog **/\n dialogTriggerTitle?: never;\n /** Option to disable button which triggers the create dialog **/\n dialogTriggerDisabled?: never;\n /** Dialog for create new option **/\n dialog?: never;\n}\n\nexport interface OnCreateInDialogSelect2Props extends Select2BaseProps {\n /** Handler called when user creates a new option in a dialog **/\n onCreate: Select2CreateHandler;\n /** Title for button which triggers the dialog **/\n dialogTriggerTitle: string;\n /** Option to disable button which triggers the create dialog **/\n dialogTriggerDisabled?: boolean;\n /** Dialog for create new option **/\n dialog: DialogPropType;\n}\n\ntype Select2Props = OnCreateSelect2Props | OnCreateInDialogSelect2Props;\n\ntype Select2PropsWithStatics = React.ForwardRefExoticComponent<Select2Props & React.RefAttributes<HTMLButtonElement>> & {\n Option: React.ForwardRefExoticComponent<Select2OptionProps>;\n Group: React.ForwardRefExoticComponent<Select2GroupProps>;\n Title: React.ForwardRefExoticComponent<Select2TitleProps>;\n};\n\nconst Select2 = React.forwardRef<HTMLButtonElement, Select2Props>(function Select2(props, ref) {\n const {\n children: initChildren,\n defaultValue: defaultProp,\n disabled = false,\n emptyValue = undefined,\n fontSize,\n highlighted = false,\n invalid = false,\n loading,\n multiple = false,\n name,\n onChange,\n onCreate,\n dialogTriggerTitle,\n dialogTriggerDisabled,\n dialog,\n onDelete,\n onEdit,\n placeholder,\n readOnly = false,\n tags = false,\n value: prop,\n ...otherProps\n } = props;\n\n const emptyOption: React.ReactElement<Select2OptionProps> | undefined = React.useMemo(() => {\n if (emptyValue !== undefined && !multiple) {\n // Empty option has 0px height, because it's empty, so need to apply height manually\n return <Option key=\"__empty\" children=\"\" value={emptyValue} className=\"h-8\" />;\n }\n return;\n }, [emptyValue, multiple]);\n\n const initialChildren = React.useMemo(() => {\n if (emptyOption) {\n return [emptyOption, ...initChildren] as Select2Children;\n }\n return initChildren;\n }, [emptyOption, initChildren]);\n\n // refs\n const internalRef = useMergedRef<HTMLButtonElement>(ref);\n const listboxRef = React.useRef<CollectionRef>(null);\n const searchRef = React.useRef<HTMLInputElement>(null);\n const { texts } = useLocalization();\n // align the listbox min width with the width of the input - it should never be smaller\n const dimensions = useBoundingClientRectListener(internalRef);\n\n // state\n const [tabTriggeredClose, setTabTriggeredClose] = React.useState(false);\n const [open, setOpen] = React.useState(false);\n const [value, _setValue] = useControllableState<Select2Value>({\n // uncontrolled\n defaultProp,\n // controlled\n onChange,\n prop,\n });\n const setValue = ListboxPrimitive.createListboxValueSetter(multiple, _setValue);\n const [validationError, setValidationError] = React.useState<Error | undefined>();\n const [shouldPauseHoverState, setShouldPauseHoverState] = useIsHoverStatePaused();\n\n const { flattenedChildren, filteredChildren, searchQuery, setSearchQuery } = useChildren({\n children: initialChildren,\n emptyValue,\n multiple,\n open,\n setValue,\n value,\n });\n\n // context\n const context = {\n disabled,\n highlighted,\n invalid,\n listboxRef,\n multiple,\n onCreate,\n dialogTriggerTitle,\n dialogTriggerDisabled,\n dialog,\n onDelete,\n onEdit,\n open,\n readOnly,\n ref: internalRef,\n searchQuery,\n searchRef,\n setOpen,\n setSearchQuery,\n setValidationError,\n setValue,\n shouldPauseHoverState,\n setShouldPauseHoverState,\n tags,\n fontSize,\n validationError,\n value,\n };\n\n const handleKeyDown = (event: React.KeyboardEvent<HTMLElement>) => {\n if (open) {\n event.preventDefault();\n } else if (isElementInsideTable3OrReport(event.currentTarget)) {\n return;\n } else if (!event.ctrlKey && !event.metaKey && (event.key === 'ArrowDown' || /^[a-z0-9]$/i.test(event.key))) {\n setOpen(true);\n }\n\n // the focus should always remain on the input, so we forward events on to the listbox\n listboxRef.current?.dispatchEvent(createCustomKeyboardEvent(event as React.KeyboardEvent<HTMLInputElement>));\n };\n\n let handleBlur;\n\n if (otherProps.onBlur) {\n // we might be focusing on an input or something inside the dropdown that was triggered by the select\n // so see if the element gaining focus is inside a portal and look up its controller\n // if we don't do this, things like validate on blur occur while simply opening the select\n handleBlur = (event: React.FocusEvent<HTMLButtonElement>) => {\n const elementGainingFocus = event.relatedTarget;\n\n if (elementGainingFocus === undefined) {\n return;\n }\n\n const portalId = elementGainingFocus?.closest('[data-radix-popper-content-wrapper] > :first-child')?.id;\n\n if (!portalId || event.currentTarget.getAttribute(`aria-controls`) !== portalId) {\n otherProps.onBlur?.(event);\n }\n };\n }\n\n const handleListboxKeyDown = (event: React.KeyboardEvent<HTMLElement>) => {\n if (isAriaDirectionKey(event)) {\n setShouldPauseHoverState(true);\n }\n };\n\n const handleCloseAutoFocus = (event: Event) => {\n event.preventDefault();\n event.stopPropagation();\n\n if (tabTriggeredClose) {\n const nextFocussableElement = getNextFocussableElement(internalRef.current);\n\n if (nextFocussableElement) {\n // UX requirement: move focus to the next focussable element when tab key is pressed to select the value\n nextFocussableElement.focus();\n // Reset the tabTriggeredClose state\n setTabTriggeredClose(false);\n }\n } else {\n internalRef.current?.focus();\n }\n };\n\n const selectOptions =\n searchQuery === ''\n ? flattenedChildren.map(child => child.props.value)\n : filteredChildren\n .map(child =>\n isGroup(child)\n ? Array.isArray(child.props.children) && child.props.children.map(subChild => subChild.props.value)\n : child.props.value\n )\n .flatMap(c => c) || [];\n\n const areAllSelected = Array.isArray(value) && selectOptions.every(option => value.includes(option as string));\n\n const selectAllText = React.useMemo(() => {\n if (searchQuery === '') {\n if (areAllSelected) {\n return texts.select2.deselectAll;\n } else {\n return texts.select2.selectAll;\n }\n } else if (areAllSelected) {\n return texts.select2.deselectAllResults;\n } else {\n return texts.select2.selectAllResults;\n }\n }, [areAllSelected, searchQuery]);\n\n const selectAll = () => {\n if (!Array.isArray(value) || value.length === 0) {\n setValue(selectOptions);\n } else {\n // array of all available options which are not selected\n const preselectedValues = selectOptions.filter(option => !value.includes(option));\n setValue([...value, ...preselectedValues]);\n }\n };\n\n const deselectAll = () => {\n if (searchQuery === '') {\n setValue([]);\n } else {\n const nextValue = Array.isArray(value) && value.filter(subValue => !selectOptions.includes(subValue as string));\n setValue(nextValue);\n }\n };\n\n const handleCreateInDialog = async (name: string, color: Color | undefined) => {\n if (onCreate && dialog) {\n try {\n const option = await onCreate(name, color);\n setValue(option.value);\n // To avoid memory leak we should bind onClose of dialog with setOpen(false)\n setOpen(false);\n } catch (err) {\n console.log(err);\n }\n }\n };\n\n const className = cn('border-grey-300 rounded border bg-white py-1.5 shadow-md outline-none\"', createCollectionClassName());\n\n return (\n <Select2Context.Provider value={context}>\n <PopoverPrimitive.Root open={open} onOpenChange={setOpen}>\n <PopoverPrimitive.Trigger asChild data-taco=\"Select2\">\n <Trigger\n {...otherProps}\n aria-haspopup=\"listbox\"\n emptyValue={emptyValue}\n onBlur={handleBlur}\n onKeyDown={handleKeyDown}\n placeholder={placeholder}\n ref={internalRef}>\n {flattenedChildren}\n </Trigger>\n </PopoverPrimitive.Trigger>\n <PopoverPrimitive.Portal>\n <PopoverPrimitive.Content\n asChild\n align=\"start\"\n onOpenAutoFocus={() => {\n internalRef.current?.focus();\n }}\n onCloseAutoFocus={handleCloseAutoFocus}\n sideOffset={4}\n tabIndex={-1}>\n <div className={className} style={{ minWidth: dimensions?.width ? `${dimensions.width}px` : undefined }}>\n {flattenedChildren.length > 0 || onCreate ? (\n <>\n <Search\n placeholder={onCreate ? texts.select2.searchOrCreate : texts.select2.search}\n ref={searchRef}\n onTabKeyPress={() => setTabTriggeredClose(true)}\n />\n {multiple && selectOptions.length > 1 && (\n <>\n <Button\n className=\"!justify-start\"\n appearance=\"discrete\"\n onClick={areAllSelected ? deselectAll : selectAll}>\n {selectAllText}\n </Button>\n <div className=\"border-grey-300 mx-3 rounded border-t\" />\n </>\n )}\n </>\n ) : null}\n {loading ? (\n <span className={cn('text-grey-700 flex items-center italic', fontSize && getFontSize(fontSize))}>\n <span>\n <Spinner\n delay={0}\n className={cn('ml-3 mr-2 mt-1.5 h-5 w-5', {\n '!mt-1 !h-3.5 !w-3.5': fontSize === FontSizes.small,\n '!h-4 !w-4': fontSize === FontSizes.medium,\n '!h-5 !w-5': fontSize === FontSizes.large,\n })}\n />\n </span>\n <span>{texts.listbox.loading}</span>\n </span>\n ) : flattenedChildren.length <= 0 ? (\n <div className=\"text-grey-700 -mt-0.5 flex h-8 items-center px-2\" role=\"presentation\">\n No results found...\n </div>\n ) : (\n <ListboxPrimitive.Root\n className=\"flex flex-col gap-0.5\"\n customSelector=\":scope > button\"\n disabled={disabled}\n multiple={multiple}\n onKeyDown={handleListboxKeyDown}\n readOnly={readOnly}\n ref={listboxRef}\n setValue={setValue}\n tabIndex={-1}\n value={value}>\n {searchQuery === '' ? (\n <Collection>{initialChildren}</Collection>\n ) : (\n <Collection>{filteredChildren}</Collection>\n )}\n {onCreate ? <Create onCreate={onCreate} options={flattenedChildren} /> : null}\n </ListboxPrimitive.Root>\n )}\n {dialog && dialogTriggerTitle && (\n <span className=\"border-grey-300 h-9 border-t p-1.5\">\n <Button\n appearance=\"discrete\"\n disabled={dialogTriggerDisabled}\n dialog={dialog(handleCreateInDialog)}>\n <Icon className=\"text-xs\" name=\"circle-plus\" /> {dialogTriggerTitle}\n </Button>\n </span>\n )}\n </div>\n </PopoverPrimitive.Content>\n </PopoverPrimitive.Portal>\n <ControlledHiddenField\n emptyValue={emptyValue}\n multiple={multiple || tags}\n name={name}\n options={flattenedChildren.map(child => child.props.value)}\n parentRef={internalRef}\n setValue={setValue}\n value={value}\n />\n </PopoverPrimitive.Root>\n </Select2Context.Provider>\n );\n}) as Select2PropsWithStatics;\nSelect2.Option = Option;\nSelect2.Group = Group;\nSelect2.Title = Title;\n\nconst ControlledHiddenField = props => {\n const { emptyValue, multiple, name, options, parentRef, value, setValue } = props;\n const isFormControl = useIsFormControl(parentRef, () => setValue(multiple ? [] : undefined));\n\n let bubbleValue;\n\n if (isFormControl) {\n if (value !== undefined) {\n if (multiple) {\n bubbleValue = Array.isArray(value) ? value.map(String) : [value === null ? '' : String(value)];\n } else {\n bubbleValue = value === null ? '' : String(value);\n }\n }\n\n return (\n <BubbleSelect aria-hidden key={String(bubbleValue)} multiple={multiple} name={name} value={bubbleValue}>\n {emptyValue !== undefined ? <option value={emptyValue} /> : null}\n {options.map(option => (\n <option key={String(option)} value={String(option)} />\n ))}\n </BubbleSelect>\n );\n }\n\n return null;\n};\nSelect2.displayName = 'Select2';\n\nexport { Select2 };\n\nexport type {\n Select2Texts,\n Select2GroupProps,\n Select2OptionProps,\n Select2OptionValue,\n Select2Value,\n Select2Props,\n Select2TitleProps,\n};\n"],"names":["Select2","React","forwardRef","props","ref","children","initChildren","defaultValue","defaultProp","disabled","emptyValue","undefined","fontSize","highlighted","invalid","loading","multiple","name","onChange","onCreate","dialogTriggerTitle","dialogTriggerDisabled","dialog","onDelete","onEdit","placeholder","readOnly","tags","value","prop","otherProps","emptyOption","useMemo","Option","key","className","initialChildren","internalRef","useMergedRef","listboxRef","useRef","searchRef","texts","useLocalization","dimensions","useBoundingClientRectListener","tabTriggeredClose","setTabTriggeredClose","useState","open","setOpen","_setValue","useControllableState","setValue","ListboxPrimitive","validationError","setValidationError","shouldPauseHoverState","setShouldPauseHoverState","useIsHoverStatePaused","flattenedChildren","filteredChildren","searchQuery","setSearchQuery","useChildren","context","handleKeyDown","event","preventDefault","isElementInsideTable3OrReport","currentTarget","ctrlKey","metaKey","test","_listboxRef$current","current","dispatchEvent","createCustomKeyboardEvent","handleBlur","onBlur","elementGainingFocus","relatedTarget","portalId","_elementGainingFocus$","closest","id","getAttribute","_otherProps$onBlur","call","handleListboxKeyDown","isAriaDirectionKey","handleCloseAutoFocus","stopPropagation","nextFocussableElement","getNextFocussableElement","focus","_internalRef$current","selectOptions","map","child","isGroup","Array","isArray","subChild","flatMap","c","areAllSelected","every","option","includes","selectAllText","select2","deselectAll","selectAll","deselectAllResults","selectAllResults","length","preselectedValues","filter","nextValue","subValue","handleCreateInDialog","color","_temp","_catch","Promise","resolve","then","err","console","log","_temp2","e","reject","cn","createCollectionClassName","Select2Context","Provider","PopoverPrimitive","onOpenChange","asChild","Trigger","onKeyDown","align","onOpenAutoFocus","_internalRef$current2","onCloseAutoFocus","sideOffset","tabIndex","style","minWidth","width","Search","searchOrCreate","search","onTabKeyPress","Button","appearance","onClick","getFontSize","Spinner","delay","FontSizes","small","medium","large","listbox","role","customSelector","Collection","Create","options","Icon","ControlledHiddenField","parentRef","Group","Title","isFormControl","useIsFormControl","bubbleValue","String","BubbleSelect","displayName"],"mappings":";;;;;;;;;;;;;;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;;EAIvB,OAAO,IAAI;AACf,CAAC;AACD5G,OAAO,CAACsL,WAAW,GAAG,SAAS;;;;"}
|
1
|
+
{"version":3,"file":"Select2.js","sources":["../../../../../../../src/components/Select2/Select2.tsx"],"sourcesContent":["import React from 'react';\nimport cn from 'clsx';\nimport { useControllableState } from '@radix-ui/react-use-controllable-state';\nimport * as PopoverPrimitive from '@radix-ui/react-popover';\nimport * as ListboxPrimitive from '../../primitives/Listbox2/Listbox2';\nimport {\n Select2Children,\n Select2CreateHandler,\n Select2DeleteHandler,\n Select2EditHandler,\n Select2OptionValue,\n Select2Value,\n} from './types';\nimport { Option, Select2OptionProps } from './components/Option';\nimport { Group, Select2GroupProps } from './components/Group';\nimport { Select2TitleProps, Title } from './components/Title';\nimport { Select2Context } from './components/Context';\nimport { createCollectionClassName, getFontSize } from './utilities';\nimport { useMergedRef } from '../../hooks/useMergedRef';\nimport { useBoundingClientRectListener } from '../../hooks/useBoundingClientRectListener';\nimport { createCustomKeyboardEvent } from '../../utils/input';\nimport { Trigger } from './components/Trigger';\nimport { useIsFormControl } from '../../hooks/useIsFormControl';\nimport { BubbleSelect } from '../../primitives/BubbleSelect';\nimport { Search } from './components/Search';\nimport { isGroup, useChildren } from './hooks/useChildren';\n\nimport { Create } from './components/Create';\nimport { Collection } from './components/Collection';\nimport { CollectionRef } from '../../primitives/Collection/Collection';\nimport { useLocalization } from '../Provider/Localization';\nimport { useIsHoverStatePaused } from '../../hooks/useIsHoverStatePaused';\nimport { isAriaDirectionKey } from '../../utils/aria';\nimport { getNextFocussableElement, isElementInsideTable3OrReport } from '../../utils/dom';\nimport { FontSize, FontSizes } from '../../types';\nimport { Button } from '../Button/Button';\nimport { Spinner } from '../Spinner/Spinner';\n\ntype Select2Texts = {\n allSelect: string;\n allDeselect: string;\n cancel: string;\n chooseColor: string;\n create: string;\n delete: string;\n save: string;\n search: string;\n searchOrCreate: string;\n selectAll: string;\n selectAllResults: string;\n deselectAll: string;\n deselectAllResults: string;\n};\n\ntype Select2Props = Omit<React.HTMLAttributes<HTMLButtonElement>, 'children' | 'defaultValue' | 'onChange' | 'value'> & {\n /** Autofocus Select2 when loaded **/\n autoFocus?: boolean;\n /** Array of options in Select2 */\n children: Select2Children;\n /** Initial value of the input in Select2 */\n defaultValue?: Select2Value;\n /** Set what value should have an empty option in Select2 */\n emptyValue?: Select2OptionValue;\n /** Whether the Select2 is in a disabled state **/\n disabled?: boolean;\n /** Font size of text in Select2 **/\n fontSize?: FontSize;\n /** Draws attention to the Select2 by changing its style and making it visually prominent */\n highlighted?: boolean;\n /** Whether the Select2 is in an invalid state **/\n invalid?: boolean;\n /** Whether the Select2 is loading the data **/\n loading?: boolean;\n /** Whether the Select2 allows selecting multiple values **/\n multiple?: boolean;\n /** Whether the Select2 is in an invalid state **/\n name?: string;\n /** Handler called when user chooses an option from the provided options **/\n onChange?: (value: Select2Value) => void;\n /** Handler called when user creates a new option **/\n onCreate?: Select2CreateHandler;\n /** Handler called when user deletes an option **/\n onDelete?: Select2DeleteHandler;\n /** Handler called when user edits an option **/\n onEdit?: Select2EditHandler;\n /** Placeholder showed when nothing is selected **/\n placeholder?: string;\n /** Whether the Select2 is in a readonly state **/\n readOnly?: boolean;\n required?: boolean;\n /** Renders select options as tags **/\n tags?: boolean;\n /** Value of the input in select2 */\n value?: Select2Value;\n};\ntype Select2PropsWithStatics = React.ForwardRefExoticComponent<Select2Props & React.RefAttributes<HTMLButtonElement>> & {\n Option: React.ForwardRefExoticComponent<Select2OptionProps>;\n Group: React.ForwardRefExoticComponent<Select2GroupProps>;\n Title: React.ForwardRefExoticComponent<Select2TitleProps>;\n};\n\nconst Select2 = React.forwardRef<HTMLButtonElement, Select2Props>(function Select2(props, ref) {\n const {\n children: initChildren,\n defaultValue: defaultProp,\n disabled = false,\n emptyValue = undefined,\n fontSize,\n highlighted = false,\n invalid = false,\n loading,\n multiple = false,\n name,\n onChange,\n onCreate,\n onDelete,\n onEdit,\n placeholder,\n readOnly = false,\n tags = false,\n value: prop,\n ...otherProps\n } = props;\n\n const emptyOption: React.ReactElement<Select2OptionProps> | undefined = React.useMemo(() => {\n if (emptyValue !== undefined && !multiple) {\n // Empty option has 0px height, because it's empty, so need to apply height manually\n return <Option key=\"__empty\" children=\"\" value={emptyValue} className=\"h-8\" />;\n }\n return;\n }, [emptyValue, multiple]);\n\n const initialChildren = React.useMemo(() => {\n if (emptyOption) {\n return [emptyOption, ...initChildren] as Select2Children;\n }\n return initChildren;\n }, [emptyOption, initChildren]);\n\n // refs\n const internalRef = useMergedRef<HTMLButtonElement>(ref);\n const listboxRef = React.useRef<CollectionRef>(null);\n const searchRef = React.useRef<HTMLInputElement>(null);\n const { texts } = useLocalization();\n // align the listbox min width with the width of the input - it should never be smaller\n const dimensions = useBoundingClientRectListener(internalRef);\n\n // state\n const [tabTriggeredClose, setTabTriggeredClose] = React.useState(false);\n const [open, setOpen] = React.useState(false);\n const [value, _setValue] = useControllableState<Select2Value>({\n // uncontrolled\n defaultProp,\n // controlled\n onChange,\n prop,\n });\n const setValue = ListboxPrimitive.createListboxValueSetter(multiple, _setValue);\n const [validationError, setValidationError] = React.useState<Error | undefined>();\n const [shouldPauseHoverState, setShouldPauseHoverState] = useIsHoverStatePaused();\n\n const { flattenedChildren, filteredChildren, searchQuery, setSearchQuery } = useChildren({\n children: initialChildren,\n emptyValue,\n multiple,\n open,\n setValue,\n value,\n });\n\n // context\n const context = {\n disabled,\n highlighted,\n invalid,\n listboxRef,\n multiple,\n onCreate,\n onDelete,\n onEdit,\n open,\n readOnly,\n ref: internalRef,\n searchQuery,\n searchRef,\n setOpen,\n setSearchQuery,\n setValidationError,\n setValue,\n shouldPauseHoverState,\n setShouldPauseHoverState,\n tags,\n fontSize,\n validationError,\n value,\n };\n\n const handleKeyDown = (event: React.KeyboardEvent<HTMLElement>) => {\n if (open) {\n event.preventDefault();\n } else if (isElementInsideTable3OrReport(event.currentTarget)) {\n return;\n } else if (!event.ctrlKey && !event.metaKey && (event.key === 'ArrowDown' || /^[a-z0-9]$/i.test(event.key))) {\n setOpen(true);\n }\n\n // the focus should always remain on the input, so we forward events on to the listbox\n listboxRef.current?.dispatchEvent(createCustomKeyboardEvent(event as React.KeyboardEvent<HTMLInputElement>));\n };\n\n let handleBlur;\n\n if (otherProps.onBlur) {\n // we might be focusing on an input or something inside the dropdown that was triggered by the select\n // so see if the element gaining focus is inside a portal and look up its controller\n // if we don't do this, things like validate on blur occur while simply opening the select\n handleBlur = (event: React.FocusEvent<HTMLButtonElement>) => {\n const elementGainingFocus = event.relatedTarget;\n\n if (elementGainingFocus === undefined) {\n return;\n }\n\n const portalId = elementGainingFocus?.closest('[data-radix-popper-content-wrapper] > :first-child')?.id;\n\n if (!portalId || event.currentTarget.getAttribute(`aria-controls`) !== portalId) {\n otherProps.onBlur?.(event);\n }\n };\n }\n\n const handleListboxKeyDown = (event: React.KeyboardEvent<HTMLElement>) => {\n if (isAriaDirectionKey(event)) {\n setShouldPauseHoverState(true);\n }\n };\n\n const handleCloseAutoFocus = (event: Event) => {\n event.preventDefault();\n event.stopPropagation();\n\n if (tabTriggeredClose) {\n const nextFocussableElement = getNextFocussableElement(internalRef.current);\n\n if (nextFocussableElement) {\n // UX requirement: move focus to the next focussable element when tab key is pressed to select the value\n nextFocussableElement.focus();\n // Reset the tabTriggeredClose state\n setTabTriggeredClose(false);\n }\n } else {\n internalRef.current?.focus();\n }\n };\n\n const selectOptions =\n searchQuery === ''\n ? flattenedChildren.map(child => child.props.value)\n : filteredChildren\n .map(child =>\n isGroup(child)\n ? Array.isArray(child.props.children) && child.props.children.map(subChild => subChild.props.value)\n : child.props.value\n )\n .flatMap(c => c) || [];\n\n const areAllSelected = Array.isArray(value) && selectOptions.every(option => value.includes(option as string));\n\n const selectAllText = React.useMemo(() => {\n if (searchQuery === '') {\n if (areAllSelected) {\n return texts.select2.deselectAll;\n } else {\n return texts.select2.selectAll;\n }\n } else if (areAllSelected) {\n return texts.select2.deselectAllResults;\n } else {\n return texts.select2.selectAllResults;\n }\n }, [areAllSelected, searchQuery]);\n\n const selectAll = () => {\n if (!Array.isArray(value) || value.length === 0) {\n setValue(selectOptions);\n } else {\n // array of all available options which are not selected\n const preselectedValues = selectOptions.filter(option => !value.includes(option));\n setValue([...value, ...preselectedValues]);\n }\n };\n\n const deselectAll = () => {\n if (searchQuery === '') {\n setValue([]);\n } else {\n const nextValue = Array.isArray(value) && value.filter(subValue => !selectOptions.includes(subValue as string));\n setValue(nextValue);\n }\n };\n\n const className = cn('border-grey-300 rounded border bg-white py-1.5 shadow-md outline-none\"', createCollectionClassName());\n\n return (\n <Select2Context.Provider value={context}>\n <PopoverPrimitive.Root open={open} onOpenChange={setOpen}>\n <PopoverPrimitive.Trigger asChild data-taco=\"Select2\">\n <Trigger\n {...otherProps}\n aria-haspopup=\"listbox\"\n emptyValue={emptyValue}\n onBlur={handleBlur}\n onKeyDown={handleKeyDown}\n placeholder={placeholder}\n ref={internalRef}>\n {flattenedChildren}\n </Trigger>\n </PopoverPrimitive.Trigger>\n <PopoverPrimitive.Portal>\n <PopoverPrimitive.Content\n asChild\n align=\"start\"\n onOpenAutoFocus={() => {\n internalRef.current?.focus();\n }}\n onCloseAutoFocus={handleCloseAutoFocus}\n sideOffset={4}\n tabIndex={-1}>\n <div className={className} style={{ minWidth: dimensions?.width ? `${dimensions.width}px` : undefined }}>\n {flattenedChildren.length > 0 || onCreate ? (\n <>\n <Search\n placeholder={onCreate ? texts.select2.searchOrCreate : texts.select2.search}\n ref={searchRef}\n onTabKeyPress={() => setTabTriggeredClose(true)}\n />\n {multiple && selectOptions.length > 1 && (\n <>\n <Button\n className=\"!justify-start\"\n appearance=\"discrete\"\n onClick={areAllSelected ? deselectAll : selectAll}>\n {selectAllText}\n </Button>\n <div className=\"border-grey-300 mx-3 rounded border-t\" />\n </>\n )}\n </>\n ) : null}\n {loading ? (\n <span className={cn('text-grey-700 flex items-center italic', fontSize && getFontSize(fontSize))}>\n <span>\n <Spinner\n delay={0}\n className={cn('ml-3 mr-2 mt-1.5 h-5 w-5', {\n '!mt-1 !h-3.5 !w-3.5': fontSize === FontSizes.small,\n '!h-4 !w-4': fontSize === FontSizes.medium,\n '!h-5 !w-5': fontSize === FontSizes.large,\n })}\n />\n </span>\n <span>{texts.listbox.loading}</span>\n </span>\n ) : flattenedChildren.length <= 0 ? (\n <div className=\"text-grey-700 -mt-0.5 flex h-8 items-center px-2\" role=\"presentation\">\n No results found...\n </div>\n ) : (\n <ListboxPrimitive.Root\n className=\"flex flex-col gap-0.5\"\n customSelector=\":scope > button\"\n disabled={disabled}\n multiple={multiple}\n onKeyDown={handleListboxKeyDown}\n readOnly={readOnly}\n ref={listboxRef}\n setValue={setValue}\n tabIndex={-1}\n value={value}>\n {searchQuery === '' ? (\n <Collection>{initialChildren}</Collection>\n ) : (\n <Collection>{filteredChildren}</Collection>\n )}\n {onCreate ? <Create onCreate={onCreate} options={flattenedChildren} /> : null}\n </ListboxPrimitive.Root>\n )}\n </div>\n </PopoverPrimitive.Content>\n </PopoverPrimitive.Portal>\n <ControlledHiddenField\n emptyValue={emptyValue}\n multiple={multiple || tags}\n name={name}\n options={flattenedChildren.map(child => child.props.value)}\n parentRef={internalRef}\n setValue={setValue}\n value={value}\n />\n </PopoverPrimitive.Root>\n </Select2Context.Provider>\n );\n}) as Select2PropsWithStatics;\nSelect2.Option = Option;\nSelect2.Group = Group;\nSelect2.Title = Title;\n\nconst ControlledHiddenField = props => {\n const { emptyValue, multiple, name, options, parentRef, value, setValue } = props;\n const isFormControl = useIsFormControl(parentRef, () => setValue(multiple ? [] : undefined));\n\n let bubbleValue;\n\n if (isFormControl) {\n if (value !== undefined) {\n if (multiple) {\n bubbleValue = Array.isArray(value) ? value.map(String) : [value === null ? '' : String(value)];\n } else {\n bubbleValue = value === null ? '' : String(value);\n }\n }\n\n return (\n <BubbleSelect aria-hidden key={String(bubbleValue)} multiple={multiple} name={name} value={bubbleValue}>\n {emptyValue !== undefined ? <option value={emptyValue} /> : null}\n {options.map(option => (\n <option key={String(option)} value={String(option)} />\n ))}\n </BubbleSelect>\n );\n }\n\n return null;\n};\nSelect2.displayName = 'Select2';\n\nexport { Select2 };\n\nexport type {\n Select2Texts,\n Select2GroupProps,\n Select2OptionProps,\n Select2OptionValue,\n Select2Value,\n Select2Props,\n Select2TitleProps,\n};\n"],"names":["Select2","React","forwardRef","props","ref","children","initChildren","defaultValue","defaultProp","disabled","emptyValue","undefined","fontSize","highlighted","invalid","loading","multiple","name","onChange","onCreate","onDelete","onEdit","placeholder","readOnly","tags","value","prop","otherProps","emptyOption","useMemo","Option","key","className","initialChildren","internalRef","useMergedRef","listboxRef","useRef","searchRef","texts","useLocalization","dimensions","useBoundingClientRectListener","tabTriggeredClose","setTabTriggeredClose","useState","open","setOpen","_setValue","useControllableState","setValue","ListboxPrimitive","validationError","setValidationError","shouldPauseHoverState","setShouldPauseHoverState","useIsHoverStatePaused","flattenedChildren","filteredChildren","searchQuery","setSearchQuery","useChildren","context","handleKeyDown","event","preventDefault","isElementInsideTable3OrReport","currentTarget","ctrlKey","metaKey","test","_listboxRef$current","current","dispatchEvent","createCustomKeyboardEvent","handleBlur","onBlur","elementGainingFocus","relatedTarget","portalId","_elementGainingFocus$","closest","id","getAttribute","_otherProps$onBlur","call","handleListboxKeyDown","isAriaDirectionKey","handleCloseAutoFocus","stopPropagation","nextFocussableElement","getNextFocussableElement","focus","_internalRef$current","selectOptions","map","child","isGroup","Array","isArray","subChild","flatMap","c","areAllSelected","every","option","includes","selectAllText","select2","deselectAll","selectAll","deselectAllResults","selectAllResults","length","preselectedValues","filter","nextValue","subValue","cn","createCollectionClassName","Select2Context","Provider","PopoverPrimitive","onOpenChange","asChild","Trigger","onKeyDown","align","onOpenAutoFocus","_internalRef$current2","onCloseAutoFocus","sideOffset","tabIndex","style","minWidth","width","Search","searchOrCreate","search","onTabKeyPress","Button","appearance","onClick","getFontSize","Spinner","delay","FontSizes","small","medium","large","listbox","role","customSelector","Collection","Create","options","ControlledHiddenField","parentRef","Group","Title","is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AAEA,IAAI;MAAEQ,KAAK,EAAEyI;OACtFxJ,UAAU,KAAKC,SAAS,gBAAGV;MAAQwB,KAAK,EAAEf;MAAc,GAAG,IAAI,EAC/DiJ,OAAO,CAAC5D,GAAG,CAACU,MAAM,mBACfxG;MAAQ8B,GAAG,EAAEoI,MAAM,CAAC1D,MAAM,CAAC;MAAEhF,KAAK,EAAE0I,MAAM,CAAC1D,MAAM;MAAK,CACzD,CAAC,CACS;;EAIvB,OAAO,IAAI;AACf,CAAC;AACDzG,OAAO,CAACqK,WAAW,GAAG,SAAS;;;;"}
|
@@ -10,7 +10,8 @@ const FilterColumn = /*#__PURE__*/React__default.forwardRef((props, ref) => {
|
|
10
10
|
allColumns,
|
11
11
|
filters,
|
12
12
|
onChange: handleChange,
|
13
|
-
value = null
|
13
|
+
value = null,
|
14
|
+
...attributes
|
14
15
|
} = props;
|
15
16
|
const {
|
16
17
|
texts
|
@@ -23,13 +24,13 @@ const FilterColumn = /*#__PURE__*/React__default.forwardRef((props, ref) => {
|
|
23
24
|
message: warning ? texts.table.filters.hiddenColumn : undefined,
|
24
25
|
warning: warning,
|
25
26
|
className: "min-h-[theme(spacing.8)]"
|
26
|
-
}, /*#__PURE__*/React__default.createElement(Select2, {
|
27
|
+
}, /*#__PURE__*/React__default.createElement(Select2, Object.assign({}, attributes, {
|
27
28
|
ref: ref,
|
28
29
|
className: "focus:yt-focus !w-32 flex-shrink-0 ",
|
29
30
|
emptyValue: null,
|
30
31
|
onChange: handleChange,
|
31
32
|
value: value
|
32
|
-
}, allColumns.map(column => {
|
33
|
+
}), allColumns.map(column => {
|
33
34
|
var _column$columnDef$met, _column$parent, _column$parent$column;
|
34
35
|
return /*#__PURE__*/React__default.createElement(Select2.Option, {
|
35
36
|
key: column.id,
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"FilterColumn.js","sources":["../../../../../../../../../../../../../src/primitives/Table/Core/components/Toolbar/components/Filters/components/FilterColumn.tsx"],"sourcesContent":["import React from 'react';\nimport { Column as ReactTableColumn } from '@tanstack/react-table';\nimport { Select2, Select2Props } from '../../../../../../../../components/Select2/Select2';\nimport { Icon } from '../../../../../../../../components/Icon/Icon';\nimport { Tooltip } from '../../../../../../../../components/Tooltip/Tooltip';\nimport { useLocalization } from '../../../../../../../../components/Provider/Localization';\nimport { Field } from '../../../../../../../../components/Field/Field';\nimport { TableFilter } from '../../../../../../types';\n\nexport type FilterColumnProps<TType = unknown> = Omit<Select2Props, 'children'> & {\n allColumns: ReactTableColumn<TType, unknown>[];\n filters: TableFilter[];\n};\n\nexport const FilterColumn = React.forwardRef<HTMLButtonElement, FilterColumnProps>((props, ref) => {\n const { allColumns, filters, onChange: handleChange, value = null } = props;\n const { texts } = useLocalization();\n const selectedColumn = allColumns.find(column => column.id === value);\n const warning = selectedColumn && !selectedColumn.getIsVisible();\n\n return (\n <div className=\"flex flex-col\">\n <Field\n message={warning ? texts.table.filters.hiddenColumn : undefined}\n warning={warning}\n className=\"min-h-[theme(spacing.8)]\">\n <Select2\n ref={ref}\n className=\"focus:yt-focus !w-32 flex-shrink-0 \"\n emptyValue={null}\n onChange={handleChange}\n value={value}>\n {allColumns.map(column => (\n <Select2.Option\n key={column.id}\n value={column.id}\n postfix={\n !column.getIsVisible() || column.getIsGrouped() ? (\n <Tooltip\n title={\n column.getIsGrouped()\n ? texts.table.filters.hiddenGroupedColumn\n : texts.table.filters.hiddenColumn\n }>\n <Icon name=\"eye-off\" className=\"text-grey-500 !h-5 !w-5\" />\n </Tooltip>\n ) : undefined\n }\n disabled={column.id !== value && (!column.getCanFilter() || !!filters.find(f => f.id === column.id))}>\n {(column.columnDef.meta?.header as string) +\n (column.parent ? ` (${column.parent?.columnDef.meta?.header})` : '')}\n </Select2.Option>\n ))}\n </Select2>\n </Field>\n </div>\n );\n});\n"],"names":["FilterColumn","React","forwardRef","props","ref","allColumns","filters","onChange","handleChange","value","texts","useLocalization","selectedColumn","find","column","id","warning","getIsVisible","className","Field","message","table","hiddenColumn","undefined","Select2","emptyValue","map","_column$columnDef$met","_column$parent","_column$parent$column","Option","key","postfix","getIsGrouped","Tooltip","title","hiddenGroupedColumn","Icon","name","disabled","getCanFilter","f","columnDef","meta","header","parent"],"mappings":";;;;;;;MAcaA,YAAY,gBAAGC,cAAK,CAACC,UAAU,CAAuC,CAACC,KAAK,EAAEC,GAAG;EAC1F,MAAM;IAAEC,UAAU;IAAEC,OAAO;IAAEC,QAAQ,EAAEC,YAAY;IAAEC,KAAK,GAAG;
|
1
|
+
{"version":3,"file":"FilterColumn.js","sources":["../../../../../../../../../../../../../src/primitives/Table/Core/components/Toolbar/components/Filters/components/FilterColumn.tsx"],"sourcesContent":["import React from 'react';\nimport { Column as ReactTableColumn } from '@tanstack/react-table';\nimport { Select2, Select2Props } from '../../../../../../../../components/Select2/Select2';\nimport { Icon } from '../../../../../../../../components/Icon/Icon';\nimport { Tooltip } from '../../../../../../../../components/Tooltip/Tooltip';\nimport { useLocalization } from '../../../../../../../../components/Provider/Localization';\nimport { Field } from '../../../../../../../../components/Field/Field';\nimport { TableFilter } from '../../../../../../types';\n\nexport type FilterColumnProps<TType = unknown> = Omit<Select2Props, 'children'> & {\n allColumns: ReactTableColumn<TType, unknown>[];\n filters: TableFilter[];\n};\n\nexport const FilterColumn = React.forwardRef<HTMLButtonElement, FilterColumnProps>((props, ref) => {\n const { allColumns, filters, onChange: handleChange, value = null, ...attributes } = props;\n const { texts } = useLocalization();\n const selectedColumn = allColumns.find(column => column.id === value);\n const warning = selectedColumn && !selectedColumn.getIsVisible();\n\n return (\n <div className=\"flex flex-col\">\n <Field\n message={warning ? texts.table.filters.hiddenColumn : undefined}\n warning={warning}\n className=\"min-h-[theme(spacing.8)]\">\n <Select2\n {...attributes}\n ref={ref}\n className=\"focus:yt-focus !w-32 flex-shrink-0 \"\n emptyValue={null}\n onChange={handleChange}\n value={value}>\n {allColumns.map(column => (\n <Select2.Option\n key={column.id}\n value={column.id}\n postfix={\n !column.getIsVisible() || column.getIsGrouped() ? (\n <Tooltip\n title={\n column.getIsGrouped()\n ? texts.table.filters.hiddenGroupedColumn\n : texts.table.filters.hiddenColumn\n }>\n <Icon name=\"eye-off\" className=\"text-grey-500 !h-5 !w-5\" />\n </Tooltip>\n ) : undefined\n }\n disabled={column.id !== value && (!column.getCanFilter() || !!filters.find(f => f.id === column.id))}>\n {(column.columnDef.meta?.header as string) +\n (column.parent ? ` (${column.parent?.columnDef.meta?.header})` : '')}\n </Select2.Option>\n ))}\n </Select2>\n </Field>\n </div>\n );\n});\n"],"names":["FilterColumn","React","forwardRef","props","ref","allColumns","filters","onChange","handleChange","value","attributes","texts","useLocalization","selectedColumn","find","column","id","warning","getIsVisible","className","Field","message","table","hiddenColumn","undefined","Select2","emptyValue","map","_column$columnDef$met","_column$parent","_column$parent$column","Option","key","postfix","getIsGrouped","Tooltip","title","hiddenGroupedColumn","Icon","name","disabled","getCanFilter","f","columnDef","meta","header","parent"],"mappings":";;;;;;;MAcaA,YAAY,gBAAGC,cAAK,CAACC,UAAU,CAAuC,CAACC,KAAK,EAAEC,GAAG;EAC1F,MAAM;IAAEC,UAAU;IAAEC,OAAO;IAAEC,QAAQ,EAAEC,YAAY;IAAEC,KAAK,GAAG,IAAI;IAAE,GAAGC;GAAY,GAAGP,KAAK;EAC1F,MAAM;IAAEQ;GAAO,GAAGC,eAAe,EAAE;EACnC,MAAMC,cAAc,GAAGR,UAAU,CAACS,IAAI,CAACC,MAAM,IAAIA,MAAM,CAACC,EAAE,KAAKP,KAAK,CAAC;EACrE,MAAMQ,OAAO,GAAGJ,cAAc,IAAI,CAACA,cAAc,CAACK,YAAY,EAAE;EAEhE,oBACIjB;IAAKkB,SAAS,EAAC;kBACXlB,6BAACmB,KAAK;IACFC,OAAO,EAAEJ,OAAO,GAAGN,KAAK,CAACW,KAAK,CAAChB,OAAO,CAACiB,YAAY,GAAGC,SAAS;IAC/DP,OAAO,EAAEA,OAAO;IAChBE,SAAS,EAAC;kBACVlB,6BAACwB,OAAO,oBACAf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Ed,CAAC;;;;"}
|
@@ -8,18 +8,19 @@ function FilterComparator(props) {
|
|
8
8
|
const {
|
9
9
|
column,
|
10
10
|
onChange: handleChange,
|
11
|
-
value
|
11
|
+
value,
|
12
|
+
...attributes
|
12
13
|
} = props;
|
13
14
|
const {
|
14
15
|
texts
|
15
16
|
} = useLocalization();
|
16
17
|
const validComparators = guessComparatorsBasedOnControl(column);
|
17
|
-
return /*#__PURE__*/React__default.createElement(Select2, {
|
18
|
+
return /*#__PURE__*/React__default.createElement(Select2, Object.assign({}, attributes, {
|
18
19
|
className: "!w-32 flex-shrink-0",
|
19
20
|
disabled: !column,
|
20
21
|
onChange: handleChange,
|
21
22
|
value: value
|
22
|
-
}, validComparators.map(comparator => ( /*#__PURE__*/React__default.createElement(Select2.Option, {
|
23
|
+
}), validComparators.map(comparator => ( /*#__PURE__*/React__default.createElement(Select2.Option, {
|
23
24
|
key: comparator,
|
24
25
|
value: comparator
|
25
26
|
}, getComparatorText(comparator, texts, column)))));
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"FilterComparator.js","sources":["../../../../../../../../../../../../../src/primitives/Table/Core/components/Toolbar/components/Filters/components/FilterComparator.tsx"],"sourcesContent":["import React from 'react';\nimport { Column as ReactTableColumn } from '@tanstack/react-table';\nimport { Select2, Select2Props } from '../../../../../../../../components/Select2/Select2';\nimport { LocalizationTexts, useLocalization } from '../../../../../../../../components/Provider/Localization';\nimport { TableFilterComparator } from '../../../../../../types';\nimport { guessComparatorsBasedOnControl } from '../util';\n\nexport type FilterComparatorProps<TType = unknown> = Omit<Select2Props, 'children'> & {\n column?: ReactTableColumn<TType, unknown>;\n};\n\nexport function FilterComparator<TType = unknown>(props: FilterComparatorProps<TType>) {\n const { column, onChange: handleChange, value } = props;\n const { texts } = useLocalization();\n\n const validComparators = guessComparatorsBasedOnControl(column);\n\n return (\n <Select2 className=\"!w-32 flex-shrink-0\" disabled={!column} onChange={handleChange} value={value}>\n {validComparators.map(comparator => (\n <Select2.Option key={comparator} value={comparator}>\n {getComparatorText(comparator, texts, column)}\n </Select2.Option>\n ))}\n </Select2>\n );\n}\n\nfunction getComparatorText<TType = unknown>(\n comparator: TableFilterComparator,\n texts: LocalizationTexts,\n column?: ReactTableColumn<TType, unknown>\n) {\n const isDate = column?.columnDef?.meta?.control === 'datepicker';\n\n switch (comparator) {\n case TableFilterComparator.Contains:\n return texts.table.filters.comparators.contains;\n\n case TableFilterComparator.DoesNotContain:\n return texts.table.filters.comparators.doesNotContain;\n\n case TableFilterComparator.IsEqualTo:\n return texts.table.filters.comparators.isEqualTo;\n\n case TableFilterComparator.IsNotEqualTo:\n return texts.table.filters.comparators.isNotEqualTo;\n\n case TableFilterComparator.IsGreaterThan:\n return isDate ? texts.table.filters.comparators.isAfter : texts.table.filters.comparators.isGreaterThan;\n\n case TableFilterComparator.IsLessThan:\n return isDate ? texts.table.filters.comparators.isBefore : texts.table.filters.comparators.isLessThan;\n\n case TableFilterComparator.IsBetween:\n return texts.table.filters.comparators.isBetween;\n\n case TableFilterComparator.IsEmpty:\n return texts.table.filters.comparators.isEmpty;\n\n case TableFilterComparator.IsNotEmpty:\n return texts.table.filters.comparators.isNotEmpty;\n\n case TableFilterComparator.IsLessThanOrEqualTo:\n return isDate ? texts.table.filters.comparators.isOnOrBefore : texts.table.filters.comparators.isLessThanOrEqualTo;\n\n case TableFilterComparator.IsGreaterThanOrEqualTo:\n return isDate ? texts.table.filters.comparators.isOnOrAfter : texts.table.filters.comparators.isGreaterThanOrEqualTo;\n\n case TableFilterComparator.HasAnyOf:\n return texts.table.filters.comparators.hasAnyOf;\n\n case TableFilterComparator.HasAllOf:\n return texts.table.filters.comparators.hasAllOf;\n\n case TableFilterComparator.HasNoneOf:\n return texts.table.filters.comparators.hasNoneOf;\n\n default:\n return '';\n }\n}\n"],"names":["FilterComparator","props","column","onChange","handleChange","value","texts","useLocalization","validComparators","guessComparatorsBasedOnControl","React","Select2","className","disabled","map","comparator","Option","key","getComparatorText","isDate","_column$columnDef","columnDef","_column$columnDef$met","meta","control","TableFilterComparator","Contains","table","filters","comparators","contains","DoesNotContain","doesNotContain","IsEqualTo","isEqualTo","IsNotEqualTo","isNotEqualTo","IsGreaterThan","isAfter","isGreaterThan","IsLessThan","isBefore","isLessThan","IsBetween","isBetween","IsEmpty","isEmpty","IsNotEmpty","isNotEmpty","IsLessThanOrEqualTo","isOnOrBefore","isLessThanOrEqualTo","IsGreaterThanOrEqualTo","isOnOrAfter","isGreaterThanOrEqualTo","HasAnyOf","hasAnyOf","HasAllOf","hasAllOf","HasNoneOf","hasNoneOf"],"mappings":";;;;;;SAWgBA,gBAAgBA,CAAkBC,KAAmC;EACjF,MAAM;IAAEC,MAAM;IAAEC,QAAQ,EAAEC,YAAY;IAAEC;
|
1
|
+
{"version":3,"file":"FilterComparator.js","sources":["../../../../../../../../../../../../../src/primitives/Table/Core/components/Toolbar/components/Filters/components/FilterComparator.tsx"],"sourcesContent":["import React from 'react';\nimport { Column as ReactTableColumn } from '@tanstack/react-table';\nimport { Select2, Select2Props } from '../../../../../../../../components/Select2/Select2';\nimport { LocalizationTexts, useLocalization } from '../../../../../../../../components/Provider/Localization';\nimport { TableFilterComparator } from '../../../../../../types';\nimport { guessComparatorsBasedOnControl } from '../util';\n\nexport type FilterComparatorProps<TType = unknown> = Omit<Select2Props, 'children'> & {\n column?: ReactTableColumn<TType, unknown>;\n};\n\nexport function FilterComparator<TType = unknown>(props: FilterComparatorProps<TType>) {\n const { column, onChange: handleChange, value, ...attributes } = props;\n const { texts } = useLocalization();\n\n const validComparators = guessComparatorsBasedOnControl(column);\n\n return (\n <Select2 {...attributes} className=\"!w-32 flex-shrink-0\" disabled={!column} onChange={handleChange} value={value}>\n {validComparators.map(comparator => (\n <Select2.Option key={comparator} value={comparator}>\n {getComparatorText(comparator, texts, column)}\n </Select2.Option>\n ))}\n </Select2>\n );\n}\n\nfunction getComparatorText<TType = unknown>(\n comparator: TableFilterComparator,\n texts: LocalizationTexts,\n column?: ReactTableColumn<TType, unknown>\n) {\n const isDate = column?.columnDef?.meta?.control === 'datepicker';\n\n switch (comparator) {\n case TableFilterComparator.Contains:\n return texts.table.filters.comparators.contains;\n\n case TableFilterComparator.DoesNotContain:\n return texts.table.filters.comparators.doesNotContain;\n\n case TableFilterComparator.IsEqualTo:\n return texts.table.filters.comparators.isEqualTo;\n\n case TableFilterComparator.IsNotEqualTo:\n return texts.table.filters.comparators.isNotEqualTo;\n\n case TableFilterComparator.IsGreaterThan:\n return isDate ? texts.table.filters.comparators.isAfter : texts.table.filters.comparators.isGreaterThan;\n\n case TableFilterComparator.IsLessThan:\n return isDate ? texts.table.filters.comparators.isBefore : texts.table.filters.comparators.isLessThan;\n\n case TableFilterComparator.IsBetween:\n return texts.table.filters.comparators.isBetween;\n\n case TableFilterComparator.IsEmpty:\n return texts.table.filters.comparators.isEmpty;\n\n case TableFilterComparator.IsNotEmpty:\n return texts.table.filters.comparators.isNotEmpty;\n\n case TableFilterComparator.IsLessThanOrEqualTo:\n return isDate ? texts.table.filters.comparators.isOnOrBefore : texts.table.filters.comparators.isLessThanOrEqualTo;\n\n case TableFilterComparator.IsGreaterThanOrEqualTo:\n return isDate ? texts.table.filters.comparators.isOnOrAfter : texts.table.filters.comparators.isGreaterThanOrEqualTo;\n\n case TableFilterComparator.HasAnyOf:\n return texts.table.filters.comparators.hasAnyOf;\n\n case TableFilterComparator.HasAllOf:\n return texts.table.filters.comparators.hasAllOf;\n\n case TableFilterComparator.HasNoneOf:\n return texts.table.filters.comparators.hasNoneOf;\n\n default:\n return '';\n }\n}\n"],"names":["FilterComparator","props","column","onChange","handleChange","value","attributes","texts","useLocalization","validComparators","guessComparatorsBasedOnControl","React","Select2","className","disabled","map","comparator","Option","key","getComparatorText","isDate","_column$columnDef","columnDef","_column$columnDef$met","meta","control","TableFilterComparator","Contains","table","filters","comparators","contains","DoesNotContain","doesNotContain","IsEqualTo","isEqualTo","IsNotEqualTo","isNotEqualTo","IsGreaterThan","isAfter","isGreaterThan","IsLessThan","isBefore","isLessThan","IsBetween","isBetween","IsEmpty","isEmpty","IsNotEmpty","isNotEmpty","IsLessThanOrEqualTo","isOnOrBefore","isLessThanOrEqualTo","IsGreaterThanOrEqualTo","isOnOrAfter","isGreaterThanOrEqualTo","HasAnyOf","hasAnyOf","HasAllOf","hasAllOf","HasNoneOf","hasNoneOf"],"mappings":";;;;;;SAWgBA,gBAAgBA,CAAkBC,KAAmC;EACjF,MAAM;IAAEC,MAAM;IAAEC,QAAQ,EAAEC,YAAY;IAAEC,KAAK;IAAE,GAAGC;GAAY,GAAGL,KAAK;EACtE,MAAM;IAAEM;GAAO,GAAGC,eAAe,EAAE;EAEnC,MAAMC,gBAAgB,GAAGC,8BAA8B,CAACR,MAAM,CAAC;EAE/D,oBACIS,6BAACC,OAAO,oBAAKN,UAAU;IAAEO,SAAS,EAAC,qBAAqB;IAACC,QAAQ,EAAE,CAACZ,MAAM;IAAEC,QAAQ,EAAEC,YAAY;IAAEC,KAAK,EAAEA;MACtGI,gBAAgB,CAACM,GAAG,CAACC,UAAU,mBAC5BL,6BAACC,OAAO,CAACK,MAAM;IAACC,GAAG,EAAEF,UAAU;IAAEX,KAAK,EAAEW;KACnCG,iBAAiB,CAACH,UAAU,EAAET,KAAK,EAAEL,MAAM,CAAC,CAChC,CACpB,CAAC,CACI;AAElB;AAEA,SAASiB,iBAAiBA,CACtBH,UAAiC,EACjCT,KAAwB,EACxBL,MAAyC;;EAEzC,MAAMkB,MAAM,GAAG,CAAAlB,MAAM,aAANA,MAAM,wBAAAmB,iBAAA,GAANnB,MAAM,CAAEoB,SAAS,cAAAD,iBAAA,wBAAAE,qBAAA,GAAjBF,iBAAA,CAAmBG,IAAI,cAAAD,qBAAA,uBAAvBA,qBAAA,CAAyBE,OAAO,MAAK,YAAY;EAEhE,QAAQT,UAAU;IACd,KAAKU,qBAAqB,CAACC,QAAQ;MAC/B,OAAOpB,KAAK,CAACqB,KAAK,CAACC,OAAO,CAACC,WAAW,CAACC,QAAQ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AAsB;MAC7C,OAAOjC,MAAM,GAAGb,KAAK,CAACqB,KAAK,CAACC,OAAO,CAACC,WAAW,CAACwB,WAAW,GAAG/C,KAAK,CAACqB,KAAK,CAACC,OAAO,CAACC,WAAW,CAACyB,sBAAsB;IAExH,KAAK7B,qBAAqB,CAAC8B,QAAQ;MAC/B,OAAOjD,KAAK,CAACqB,KAAK,CAACC,OAAO,CAACC,WAAW,CAAC2B,QAAQ;IAEnD,KAAK/B,qBAAqB,CAACgC,QAAQ;MAC/B,OAAOnD,KAAK,CAACqB,KAAK,CAACC,OAAO,CAACC,WAAW,CAAC6B,QAAQ;IAEnD,KAAKjC,qBAAqB,CAACkC,SAAS;MAChC,OAAOrD,KAAK,CAACqB,KAAK,CAACC,OAAO,CAACC,WAAW,CAAC+B,SAAS;IAEpD;MACI,OAAO,EAAE;;AAErB;;;;"}
|
@@ -6,7 +6,7 @@ export declare type FilterColumnProps<TType = unknown> = Omit<Select2Props, 'chi
|
|
6
6
|
allColumns: ReactTableColumn<TType, unknown>[];
|
7
7
|
filters: TableFilter[];
|
8
8
|
};
|
9
|
-
export declare const FilterColumn: React.ForwardRefExoticComponent<Pick<Select2Props, "defaultValue" | "onChange" | "value" | "defaultChecked" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "className" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "id" | "lang" | "nonce" | "placeholder" | "slot" | "spellCheck" | "style" | "tabIndex" | "title" | "translate" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "color" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "
|
9
|
+
export declare const FilterColumn: React.ForwardRefExoticComponent<Pick<Select2Props, "defaultValue" | "onChange" | "value" | "defaultChecked" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "className" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "id" | "lang" | "nonce" | "placeholder" | "slot" | "spellCheck" | "style" | "tabIndex" | "title" | "translate" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "color" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "autoFocus" | "emptyValue" | "disabled" | "fontSize" | "highlighted" | "invalid" | "loading" | "multiple" | "name" | "onCreate" | "onDelete" | "onEdit" | "readOnly" | "required" | "tags"> & {
|
10
10
|
allColumns: ReactTableColumn<unknown, unknown>[];
|
11
11
|
filters: TableFilter[];
|
12
12
|
} & React.RefAttributes<HTMLButtonElement>>;
|
@@ -15310,9 +15310,6 @@ const Select2 = /*#__PURE__*/React__default.forwardRef(function Select2(props, r
|
|
15310
15310
|
name,
|
15311
15311
|
onChange,
|
15312
15312
|
onCreate,
|
15313
|
-
dialogTriggerTitle,
|
15314
|
-
dialogTriggerDisabled,
|
15315
|
-
dialog,
|
15316
15313
|
onDelete,
|
15317
15314
|
onEdit,
|
15318
15315
|
placeholder,
|
@@ -15382,9 +15379,6 @@ const Select2 = /*#__PURE__*/React__default.forwardRef(function Select2(props, r
|
|
15382
15379
|
listboxRef,
|
15383
15380
|
multiple,
|
15384
15381
|
onCreate,
|
15385
|
-
dialogTriggerTitle,
|
15386
|
-
dialogTriggerDisabled,
|
15387
|
-
dialog,
|
15388
15382
|
onDelete,
|
15389
15383
|
onEdit,
|
15390
15384
|
open,
|
@@ -15486,27 +15480,6 @@ const Select2 = /*#__PURE__*/React__default.forwardRef(function Select2(props, r
|
|
15486
15480
|
setValue(nextValue);
|
15487
15481
|
}
|
15488
15482
|
};
|
15489
|
-
const handleCreateInDialog = function (name, color) {
|
15490
|
-
try {
|
15491
|
-
const _temp2 = function () {
|
15492
|
-
if (onCreate && dialog) {
|
15493
|
-
const _temp = _catch(function () {
|
15494
|
-
return Promise.resolve(onCreate(name, color)).then(function (option) {
|
15495
|
-
setValue(option.value);
|
15496
|
-
// To avoid memory leak we should bind onClose of dialog with setOpen(false)
|
15497
|
-
setOpen(false);
|
15498
|
-
});
|
15499
|
-
}, function (err) {
|
15500
|
-
console.log(err);
|
15501
|
-
});
|
15502
|
-
if (_temp && _temp.then) return _temp.then(function () {});
|
15503
|
-
}
|
15504
|
-
}();
|
15505
|
-
return Promise.resolve(_temp2 && _temp2.then ? _temp2.then(function () {}) : void 0);
|
15506
|
-
} catch (e) {
|
15507
|
-
return Promise.reject(e);
|
15508
|
-
}
|
15509
|
-
};
|
15510
15483
|
const className = cn('border-grey-300 rounded border bg-white py-1.5 shadow-md outline-none"', createCollectionClassName());
|
15511
15484
|
return /*#__PURE__*/React__default.createElement(Select2Context.Provider, {
|
15512
15485
|
value: context
|
@@ -15574,16 +15547,7 @@ const Select2 = /*#__PURE__*/React__default.forwardRef(function Select2(props, r
|
|
15574
15547
|
}, searchQuery === '' ? ( /*#__PURE__*/React__default.createElement(Collection$1, null, initialChildren)) : ( /*#__PURE__*/React__default.createElement(Collection$1, null, filteredChildren)), onCreate ? /*#__PURE__*/React__default.createElement(Create, {
|
15575
15548
|
onCreate: onCreate,
|
15576
15549
|
options: flattenedChildren
|
15577
|
-
}) : null)),
|
15578
|
-
className: "border-grey-300 h-9 border-t p-1.5"
|
15579
|
-
}, /*#__PURE__*/React__default.createElement(Button$1, {
|
15580
|
-
appearance: "discrete",
|
15581
|
-
disabled: dialogTriggerDisabled,
|
15582
|
-
dialog: dialog(handleCreateInDialog)
|
15583
|
-
}, /*#__PURE__*/React__default.createElement(Icon, {
|
15584
|
-
className: "text-xs",
|
15585
|
-
name: "circle-plus"
|
15586
|
-
}), " ", dialogTriggerTitle)))))), /*#__PURE__*/React__default.createElement(ControlledHiddenField, {
|
15550
|
+
}) : null))))), /*#__PURE__*/React__default.createElement(ControlledHiddenField, {
|
15587
15551
|
emptyValue: emptyValue,
|
15588
15552
|
multiple: multiple || tags,
|
15589
15553
|
name: name,
|
@@ -15901,7 +15865,8 @@ const FilterColumn = /*#__PURE__*/React__default.forwardRef((props, ref) => {
|
|
15901
15865
|
allColumns,
|
15902
15866
|
filters,
|
15903
15867
|
onChange: handleChange,
|
15904
|
-
value = null
|
15868
|
+
value = null,
|
15869
|
+
...attributes
|
15905
15870
|
} = props;
|
15906
15871
|
const {
|
15907
15872
|
texts
|
@@ -15914,13 +15879,13 @@ const FilterColumn = /*#__PURE__*/React__default.forwardRef((props, ref) => {
|
|
15914
15879
|
message: warning ? texts.table.filters.hiddenColumn : undefined,
|
15915
15880
|
warning: warning,
|
15916
15881
|
className: "min-h-[theme(spacing.8)]"
|
15917
|
-
}, /*#__PURE__*/React__default.createElement(Select2, {
|
15882
|
+
}, /*#__PURE__*/React__default.createElement(Select2, Object.assign({}, attributes, {
|
15918
15883
|
ref: ref,
|
15919
15884
|
className: "focus:yt-focus !w-32 flex-shrink-0 ",
|
15920
15885
|
emptyValue: null,
|
15921
15886
|
onChange: handleChange,
|
15922
15887
|
value: value
|
15923
|
-
}, allColumns.map(column => {
|
15888
|
+
}), allColumns.map(column => {
|
15924
15889
|
var _column$columnDef$met, _column$parent, _column$parent$column;
|
15925
15890
|
return /*#__PURE__*/React__default.createElement(Select2.Option, {
|
15926
15891
|
key: column.id,
|
@@ -15940,18 +15905,19 @@ function FilterComparator(props) {
|
|
15940
15905
|
const {
|
15941
15906
|
column,
|
15942
15907
|
onChange: handleChange,
|
15943
|
-
value
|
15908
|
+
value,
|
15909
|
+
...attributes
|
15944
15910
|
} = props;
|
15945
15911
|
const {
|
15946
15912
|
texts
|
15947
15913
|
} = useLocalization();
|
15948
15914
|
const validComparators = guessComparatorsBasedOnControl(column);
|
15949
|
-
return /*#__PURE__*/React__default.createElement(Select2, {
|
15915
|
+
return /*#__PURE__*/React__default.createElement(Select2, Object.assign({}, attributes, {
|
15950
15916
|
className: "!w-32 flex-shrink-0",
|
15951
15917
|
disabled: !column,
|
15952
15918
|
onChange: handleChange,
|
15953
15919
|
value: value
|
15954
|
-
}, validComparators.map(comparator => ( /*#__PURE__*/React__default.createElement(Select2.Option, {
|
15920
|
+
}), validComparators.map(comparator => ( /*#__PURE__*/React__default.createElement(Select2.Option, {
|
15955
15921
|
key: comparator,
|
15956
15922
|
value: comparator
|
15957
15923
|
}, getComparatorText(comparator, texts, column)))));
|