onekijs-ui 0.21.9 → 0.22.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.
- package/dist/components/icon/util.d.ts +23 -23
- package/dist/components/list/typings.d.ts +1 -1
- package/dist/components/select/AutoComplete.d.ts +6 -0
- package/dist/components/select/SelectService.d.ts +4 -3
- package/dist/components/select/components/ControlledSelectComponent.d.ts +1 -1
- package/dist/components/select/typings.d.ts +16 -4
- package/dist/components/select/util.d.ts +2 -0
- package/dist/components/tree/components/ControllerTreeComponent.d.ts +1 -1
- package/dist/components/tree/typings.d.ts +4 -0
- package/dist/index.d.ts +3 -1
- package/dist/index.js +90 -11
- package/dist/index.js.map +1 -1
- package/dist/index.module.js +89 -12
- package/dist/index.module.js.map +1 -1
- package/dist/styles/background.d.ts +1 -1
- package/dist/styles/border.d.ts +6 -6
- package/dist/styles/grid.d.ts +1 -1
- package/dist/styles/size.d.ts +6 -6
- package/dist/styles/svg.d.ts +1 -1
- package/dist/styles/typography.d.ts +4 -4
- package/package.json +3 -3
- package/src/components/list/typings.ts +1 -1
- package/src/components/select/AutoComplete.tsx +54 -0
- package/src/components/select/SelectService.ts +10 -0
- package/src/components/select/components/ControlledSelectComponent.tsx +26 -3
- package/src/components/select/components/ControlledTreeSelectComponent.tsx +13 -0
- package/src/components/select/components/SelectInputComponent.tsx +4 -4
- package/src/components/select/components/TreeSelectComponent.tsx +0 -1
- package/src/components/select/typings.ts +26 -3
- package/src/components/select/util.ts +18 -0
- package/src/components/tree/components/ControllerTreeComponent.tsx +13 -1
- package/src/components/tree/components/TreeBodyComponent.tsx +4 -0
- package/src/components/tree/components/VirtualTreeBodyComponent.tsx +4 -0
- package/src/components/tree/typings.ts +4 -0
- package/src/index.ts +5 -0
|
@@ -42,16 +42,16 @@ export declare const getIconDivProps: (props: IconProps) => {
|
|
|
42
42
|
accessKey?: string | undefined;
|
|
43
43
|
autoFocus?: boolean | undefined;
|
|
44
44
|
className?: string | undefined;
|
|
45
|
-
contentEditable?: "inherit" | (boolean | "
|
|
45
|
+
contentEditable?: "inherit" | (boolean | "true" | "false") | undefined;
|
|
46
46
|
contextMenu?: string | undefined;
|
|
47
47
|
dir?: string | undefined;
|
|
48
|
-
draggable?: (boolean | "
|
|
48
|
+
draggable?: (boolean | "true" | "false") | undefined;
|
|
49
49
|
hidden?: boolean | undefined;
|
|
50
50
|
id?: string | undefined;
|
|
51
51
|
lang?: string | undefined;
|
|
52
52
|
nonce?: string | undefined;
|
|
53
53
|
slot?: string | undefined;
|
|
54
|
-
spellCheck?: (boolean | "
|
|
54
|
+
spellCheck?: (boolean | "true" | "false") | undefined;
|
|
55
55
|
style?: import("react").CSSProperties | undefined;
|
|
56
56
|
tabIndex?: number | undefined;
|
|
57
57
|
title?: string | undefined;
|
|
@@ -80,55 +80,55 @@ export declare const getIconDivProps: (props: IconProps) => {
|
|
|
80
80
|
results?: number | undefined;
|
|
81
81
|
security?: string | undefined;
|
|
82
82
|
unselectable?: "on" | "off" | undefined;
|
|
83
|
-
inputMode?: "search" | "text" | "
|
|
83
|
+
inputMode?: "search" | "text" | "email" | "tel" | "url" | "none" | "numeric" | "decimal" | undefined;
|
|
84
84
|
is?: string | undefined;
|
|
85
85
|
'aria-activedescendant'?: string | undefined;
|
|
86
|
-
'aria-atomic'?: (boolean | "
|
|
87
|
-
'aria-autocomplete'?: "
|
|
86
|
+
'aria-atomic'?: (boolean | "true" | "false") | undefined;
|
|
87
|
+
'aria-autocomplete'?: "list" | "none" | "inline" | "both" | undefined;
|
|
88
88
|
'aria-braillelabel'?: string | undefined;
|
|
89
89
|
'aria-brailleroledescription'?: string | undefined;
|
|
90
|
-
'aria-busy'?: (boolean | "
|
|
91
|
-
'aria-checked'?: boolean | "
|
|
90
|
+
'aria-busy'?: (boolean | "true" | "false") | undefined;
|
|
91
|
+
'aria-checked'?: boolean | "true" | "false" | "mixed" | undefined;
|
|
92
92
|
'aria-colcount'?: number | undefined;
|
|
93
93
|
'aria-colindex'?: number | undefined;
|
|
94
94
|
'aria-colindextext'?: string | undefined;
|
|
95
95
|
'aria-colspan'?: number | undefined;
|
|
96
96
|
'aria-controls'?: string | undefined;
|
|
97
|
-
'aria-current'?: boolean | "time" | "
|
|
97
|
+
'aria-current'?: boolean | "time" | "step" | "date" | "true" | "false" | "page" | "location" | undefined;
|
|
98
98
|
'aria-describedby'?: string | undefined;
|
|
99
99
|
'aria-description'?: string | undefined;
|
|
100
100
|
'aria-details'?: string | undefined;
|
|
101
|
-
'aria-disabled'?: (boolean | "
|
|
101
|
+
'aria-disabled'?: (boolean | "true" | "false") | undefined;
|
|
102
102
|
'aria-dropeffect'?: "link" | "none" | "copy" | "move" | "execute" | "popup" | undefined;
|
|
103
103
|
'aria-errormessage'?: string | undefined;
|
|
104
|
-
'aria-expanded'?: (boolean | "
|
|
104
|
+
'aria-expanded'?: (boolean | "true" | "false") | undefined;
|
|
105
105
|
'aria-flowto'?: string | undefined;
|
|
106
|
-
'aria-grabbed'?: (boolean | "
|
|
107
|
-
'aria-haspopup'?: boolean | "dialog" | "menu" | "
|
|
108
|
-
'aria-hidden'?: (boolean | "
|
|
109
|
-
'aria-invalid'?: boolean | "
|
|
106
|
+
'aria-grabbed'?: (boolean | "true" | "false") | undefined;
|
|
107
|
+
'aria-haspopup'?: boolean | "dialog" | "menu" | "true" | "false" | "grid" | "listbox" | "tree" | undefined;
|
|
108
|
+
'aria-hidden'?: (boolean | "true" | "false") | undefined;
|
|
109
|
+
'aria-invalid'?: boolean | "true" | "false" | "grammar" | "spelling" | undefined;
|
|
110
110
|
'aria-keyshortcuts'?: string | undefined;
|
|
111
111
|
'aria-label'?: string | undefined;
|
|
112
112
|
'aria-labelledby'?: string | undefined;
|
|
113
113
|
'aria-level'?: number | undefined;
|
|
114
114
|
'aria-live'?: "off" | "assertive" | "polite" | undefined;
|
|
115
|
-
'aria-modal'?: (boolean | "
|
|
116
|
-
'aria-multiline'?: (boolean | "
|
|
117
|
-
'aria-multiselectable'?: (boolean | "
|
|
115
|
+
'aria-modal'?: (boolean | "true" | "false") | undefined;
|
|
116
|
+
'aria-multiline'?: (boolean | "true" | "false") | undefined;
|
|
117
|
+
'aria-multiselectable'?: (boolean | "true" | "false") | undefined;
|
|
118
118
|
'aria-orientation'?: "horizontal" | "vertical" | undefined;
|
|
119
119
|
'aria-owns'?: string | undefined;
|
|
120
120
|
'aria-placeholder'?: string | undefined;
|
|
121
121
|
'aria-posinset'?: number | undefined;
|
|
122
|
-
'aria-pressed'?: boolean | "
|
|
123
|
-
'aria-readonly'?: (boolean | "
|
|
124
|
-
'aria-relevant'?: "text" | "
|
|
125
|
-
'aria-required'?: (boolean | "
|
|
122
|
+
'aria-pressed'?: boolean | "true" | "false" | "mixed" | undefined;
|
|
123
|
+
'aria-readonly'?: (boolean | "true" | "false") | undefined;
|
|
124
|
+
'aria-relevant'?: "text" | "additions" | "additions removals" | "additions text" | "all" | "removals" | "removals additions" | "removals text" | "text additions" | "text removals" | undefined;
|
|
125
|
+
'aria-required'?: (boolean | "true" | "false") | undefined;
|
|
126
126
|
'aria-roledescription'?: string | undefined;
|
|
127
127
|
'aria-rowcount'?: number | undefined;
|
|
128
128
|
'aria-rowindex'?: number | undefined;
|
|
129
129
|
'aria-rowindextext'?: string | undefined;
|
|
130
130
|
'aria-rowspan'?: number | undefined;
|
|
131
|
-
'aria-selected'?: (boolean | "
|
|
131
|
+
'aria-selected'?: (boolean | "true" | "false") | undefined;
|
|
132
132
|
'aria-setsize'?: number | undefined;
|
|
133
133
|
'aria-sort'?: "none" | "ascending" | "descending" | "other" | undefined;
|
|
134
134
|
'aria-valuemax'?: number | undefined;
|
|
@@ -64,7 +64,7 @@ export type ListConfig<T = any, I extends ListItem<T> = ListItem<T>> = {
|
|
|
64
64
|
ItemLoadingComponent?: FC;
|
|
65
65
|
ItemComponent?: FC<ListItemProps<T, I>>;
|
|
66
66
|
ItemContentComponent?: FC<ListItemProps<T, I>>;
|
|
67
|
-
NotFoundComponent?: FC<ListNotFoundProps
|
|
67
|
+
NotFoundComponent?: FC<ListNotFoundProps> | null;
|
|
68
68
|
LoadingComponent?: FC<StylableProps>;
|
|
69
69
|
itemHeight?: number | ((index: number) => number);
|
|
70
70
|
keyboardNavigable?: boolean;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { Primitive } from 'onekijs-framework';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { AutoCompleteProps, FormAutoCompleteProps, SelectController, SelectItem, SelectState } from './typings';
|
|
4
|
+
declare const AutoComplete: <T = Primitive, I extends SelectItem<T> = SelectItem<T>, S extends SelectState<T, I> = SelectState<T, I>, C extends SelectController<T, I, S> = SelectController<T, I, S>>(props: AutoCompleteProps<T, I, S, C>) => React.JSX.Element;
|
|
5
|
+
export declare const FormAutoComplete: <T extends Primitive = Primitive, I extends SelectItem<T> = SelectItem<T>>(props: FormAutoCompleteProps<T, I>) => React.JSX.Element;
|
|
6
|
+
export default AutoComplete;
|
|
@@ -5,16 +5,17 @@ declare class SelectService<T = any, I extends SelectItem<T> = SelectItem<T>, S
|
|
|
5
5
|
protected lastCheckQuery: Query | undefined;
|
|
6
6
|
get defaultValue(): T | T[] | null | undefined;
|
|
7
7
|
get defaultValueLoading(): boolean | undefined;
|
|
8
|
-
check(): Generator<void | import("redux-saga/effects").AllEffect<import("redux-saga/effects").CallEffect<Generator<I[] | Generator<void | import("redux-saga/effects").
|
|
8
|
+
check(): Generator<void | import("redux-saga/effects").AllEffect<import("redux-saga/effects").CallEffect<Generator<I[] | Generator<void | import("redux-saga/effects").CancelEffect | import("redux-saga/effects").ForkEffect<Generator<void | import("redux-saga/effects").CallEffect<true>, void, unknown>> | CollectionFetcherResult<T> | Promise<CollectionFetcherResult<T> | undefined>, CollectionFetcherResult<T>, (import("redux-saga").Task<any> | null) & CollectionFetcherResult<T> & (CollectionFetcherResult<T> | undefined)>, I | undefined, I[] & CollectionFetcherResult<T>>>> | import("redux-saga/effects").AllEffect<Generator<I[] | Generator<void | import("redux-saga/effects").CancelEffect | import("redux-saga/effects").ForkEffect<Generator<void | import("redux-saga/effects").CallEffect<true>, void, unknown>> | CollectionFetcherResult<T> | Promise<CollectionFetcherResult<T> | undefined>, CollectionFetcherResult<T>, (import("redux-saga").Task<any> | null) & CollectionFetcherResult<T> & (CollectionFetcherResult<T> | undefined)>, I | undefined, I[] & CollectionFetcherResult<T>>> | import("redux-saga/effects").CallEffect<void>, void, (I | undefined)[]>;
|
|
9
9
|
get status(): CollectionStatus;
|
|
10
10
|
setData(data: T[], query?: Query): void;
|
|
11
|
-
setDefaultValue(value: T | T[] | null | undefined): Generator<void | Generator<void | import("redux-saga/effects").AllEffect<import("redux-saga/effects").CallEffect<Generator<I[] | Generator<void | import("redux-saga/effects").
|
|
11
|
+
setDefaultValue(value: T | T[] | null | undefined): Generator<void | Generator<void | import("redux-saga/effects").AllEffect<import("redux-saga/effects").CallEffect<Generator<I[] | Generator<void | import("redux-saga/effects").CancelEffect | import("redux-saga/effects").ForkEffect<Generator<void | import("redux-saga/effects").CallEffect<true>, void, unknown>> | CollectionFetcherResult<T> | Promise<CollectionFetcherResult<T> | undefined>, CollectionFetcherResult<T>, (import("redux-saga").Task<any> | null) & CollectionFetcherResult<T> & (CollectionFetcherResult<T> | undefined)>, I | undefined, I[] & CollectionFetcherResult<T>>>> | import("redux-saga/effects").AllEffect<Generator<I[] | Generator<void | import("redux-saga/effects").CancelEffect | import("redux-saga/effects").ForkEffect<Generator<void | import("redux-saga/effects").CallEffect<true>, void, unknown>> | CollectionFetcherResult<T> | Promise<CollectionFetcherResult<T> | undefined>, CollectionFetcherResult<T>, (import("redux-saga").Task<any> | null) & CollectionFetcherResult<T> & (CollectionFetcherResult<T> | undefined)>, I | undefined, I[] & CollectionFetcherResult<T>>> | import("redux-saga/effects").CallEffect<void>, void, (I | undefined)[]>, void, unknown>;
|
|
12
12
|
setDefaultValueLoading(loading: boolean): void;
|
|
13
|
+
setInputValue(value: string | null): Generator<void | T | Promise<T | null> | null, void, T>;
|
|
13
14
|
setItemWidth(_item: I, value: number): void;
|
|
14
15
|
setValue(value: null | T | T[]): void;
|
|
15
16
|
setUrl(url: string, query?: Query): void;
|
|
16
17
|
_buildItem(data: T | null | undefined, adaptee: unknown, context?: AnonymousObject): I;
|
|
17
|
-
_filterItem(item: I | undefined, query: Query, valid: boolean): Generator<I[] | Generator<void | import("redux-saga/effects").
|
|
18
|
+
_filterItem(item: I | undefined, query: Query, valid: boolean): Generator<I[] | Generator<void | import("redux-saga/effects").CancelEffect | import("redux-saga/effects").ForkEffect<Generator<void | import("redux-saga/effects").CallEffect<true>, void, unknown>> | CollectionFetcherResult<T> | Promise<CollectionFetcherResult<T> | undefined>, CollectionFetcherResult<T>, (import("redux-saga").Task<any> | null) & CollectionFetcherResult<T> & (CollectionFetcherResult<T> | undefined)>, I | undefined, I[] & CollectionFetcherResult<T>>;
|
|
18
19
|
_compareItem(a: I | undefined, b: I | undefined): boolean;
|
|
19
20
|
_doSearch(search: Primitive | undefined): boolean;
|
|
20
21
|
_setDefaultValue(value: T | T[] | null | undefined): void;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { ControllerSelectProps, SelectController, SelectItem, SelectState } from '../typings';
|
|
3
|
-
declare const ControlledSelectComponent: <T = any, I extends SelectItem<T> = SelectItem<T>, S extends SelectState<T, I> = SelectState<T, I>, C extends SelectController<T, I, S> = SelectController<T, I, S>>({ attachDropdownToBody, className, placeholder, controller, InputComponent, IconComponent, OptionContentComponent, OptionComponent, OptionLoadingComponent, MultiOptionsComponent, NotFoundComponent, autoFocus, value, onChange, onBlur: forwardBlur, onFocus: forwardFocus, height, multiple, status, size, nullable, minChars, openOnFocus, searchable, dropdownWidthModifier, preload, increment, animationMs, disabled, defaultValue, defaultValueLoading, required, sameWidth, overscan, clickable, ListComponent, autoCompleteSearch, maxDisplayTokens, validateValue, }: ControllerSelectProps<T, I, S, C>) => React.JSX.Element;
|
|
3
|
+
declare const ControlledSelectComponent: <T = any, I extends SelectItem<T> = SelectItem<T>, S extends SelectState<T, I> = SelectState<T, I>, C extends SelectController<T, I, S> = SelectController<T, I, S>>({ attachDropdownToBody, className, placeholder, controller, InputComponent, IconComponent, OptionContentComponent, OptionComponent, OptionLoadingComponent, MultiOptionsComponent, NotFoundComponent, autoFocus, value, onChange, onBlur: forwardBlur, onFocus: forwardFocus, height, multiple, status, size, nullable, minChars, openOnFocus, searchable, dropdownWidthModifier, preload, increment, animationMs, disabled, defaultValue, defaultValueLoading, required, sameWidth, overscan, clickable, ListComponent, autoCompleteSearch, autoCompleteAdapter, mode, maxDisplayTokens, validateValue, }: ControllerSelectProps<T, I, S, C>) => React.JSX.Element;
|
|
4
4
|
export default ControlledSelectComponent;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AnyFunction, ChangeHandler, Collection, CollectionBroker, CollectionProxy, FormFieldProps, ValidationStatus } from 'onekijs-framework';
|
|
1
|
+
import { AnyFunction, ChangeHandler, Collection, CollectionBroker, CollectionProxy, FormFieldProps, Primitive, ValidationStatus } from 'onekijs-framework';
|
|
2
2
|
import React, { FC } from 'react';
|
|
3
3
|
import { TshirtSize } from '../../styles/typings';
|
|
4
4
|
import { DropdownWidthModifier } from '../dropdown/typings';
|
|
@@ -14,10 +14,18 @@ export type ArraySelectProps<T = any, I extends SelectItem<T> = SelectItem<T>> =
|
|
|
14
14
|
export type ArrayTreeSelectProps<T = any, I extends TreeSelectItem<T> = TreeSelectItem<T>> = Omit<ArraySelectProps<T, I>, 'dataSource'> & {
|
|
15
15
|
dataSource: T[] | string;
|
|
16
16
|
};
|
|
17
|
+
export type AutoCompleteAdapter<T = any> = (value: string | null) => T | null | Promise<T | null>;
|
|
18
|
+
export type AutoCompleteProps<T = Primitive, I extends SelectItem<T> = SelectItem<T>, S extends SelectState<T, I> = SelectState<T, I>, C extends SelectController<T, I, S> = SelectController<T, I, S>> = Omit<SelectProps<T, I, S, C>, 'mode' | 'autoCompleteSearch' | 'validateValue' | 'clickable' | 'searchable'> & {
|
|
19
|
+
type?: 'text' | 'number';
|
|
20
|
+
};
|
|
17
21
|
export type ControllerSelectProps<T = any, I extends SelectItem<T> = SelectItem<T>, S extends SelectState<T, I> = SelectState<T, I>, C extends SelectController<T, I, S> = SelectController<T, I, S>> = SelectConfig<T, I> & {
|
|
18
22
|
controller: CollectionProxy<T, I, S, C>;
|
|
19
23
|
};
|
|
20
24
|
export type ControllerTreeSelectProps<T = any, I extends TreeSelectItem<T> = TreeSelectItem<T>, S extends TreeSelectState<T, I> = TreeSelectState<T, I>, C extends TreeSelectController<T, I, S> = TreeSelectController<T, I, S>> = ControllerSelectProps<T, I, S, C> & TreeProps<T, I, S, C>;
|
|
25
|
+
export type FormAutoCompleteProps<T = Primitive, I extends SelectItem<T> = SelectItem<T>> = AutoCompleteProps<T, I> & FormFieldProps<T> & FieldLayoutProps & {
|
|
26
|
+
defaultValue?: T | T[] | null;
|
|
27
|
+
FieldComponent?: React.FC<AutoCompleteProps<T, I>>;
|
|
28
|
+
};
|
|
21
29
|
export type FormSelectProps<T = any, I extends SelectItem<T> = SelectItem<T>> = SelectProps<T, I> & FormFieldProps<T> & FieldLayoutProps & {
|
|
22
30
|
defaultValue?: T | T[] | null;
|
|
23
31
|
FieldComponent?: React.FC<SelectProps<T, I>>;
|
|
@@ -29,6 +37,7 @@ export type SelectController<T = any, I extends SelectItem<T> = SelectItem<T>, S
|
|
|
29
37
|
setDefaultValue: (defaultValue: T | T[] | null | undefined) => void;
|
|
30
38
|
setDefaultValueLoading: (loading: boolean) => void;
|
|
31
39
|
setItemWidth: (item: I, width: number) => void;
|
|
40
|
+
setInputValue: (value: string | null) => void;
|
|
32
41
|
};
|
|
33
42
|
export interface SelectIconProps {
|
|
34
43
|
open: boolean;
|
|
@@ -37,7 +46,7 @@ export interface SelectIconProps {
|
|
|
37
46
|
onClick: AnyFunction<void>;
|
|
38
47
|
}
|
|
39
48
|
export interface SelectInputProps<T = any, I extends SelectItem<T> = SelectItem<T>> extends Omit<React.InputHTMLAttributes<HTMLInputElement>, 'value' | 'onChange'> {
|
|
40
|
-
IconComponent?: FC<SelectIconProps
|
|
49
|
+
IconComponent?: FC<SelectIconProps> | null;
|
|
41
50
|
focus: boolean;
|
|
42
51
|
value?: string;
|
|
43
52
|
tokens?: I[];
|
|
@@ -75,6 +84,7 @@ export type SelectOptionProps<T = any, I extends SelectItem<T> = SelectItem<T>>
|
|
|
75
84
|
};
|
|
76
85
|
export type SelectProps<T = any, I extends SelectItem<T> = SelectItem<T>, S extends SelectState<T, I> = SelectState<T, I>, C extends SelectController<T, I, S> = SelectController<T, I, S>> = SelectConfig<T, I> & {
|
|
77
86
|
adapter?: SelectItemAdapter<T>;
|
|
87
|
+
autoCompleteAdapter?: AutoCompleteAdapter<T>;
|
|
78
88
|
controller?: CollectionProxy<T, I, S, C>;
|
|
79
89
|
dataSource?: T[] | [T, string][] | string;
|
|
80
90
|
fetchOnce?: boolean;
|
|
@@ -85,8 +95,8 @@ export type SelectBroker<T = any, I extends SelectItem<T> = SelectItem<T>, S ext
|
|
|
85
95
|
export type SelectConfig<T = any, I extends SelectItem<T> = SelectItem<T>> = Omit<ListConfig<T, I>, 'ItemComponent'> & {
|
|
86
96
|
attachDropdownToBody?: boolean;
|
|
87
97
|
InputComponent?: React.ForwardRefExoticComponent<React.PropsWithoutRef<SelectInputProps<T, I>> & React.RefAttributes<HTMLDivElement>>;
|
|
88
|
-
IconComponent?: FC<SelectIconProps
|
|
89
|
-
NotFoundComponent?: FC<SelectNotFoundProps
|
|
98
|
+
IconComponent?: FC<SelectIconProps> | null;
|
|
99
|
+
NotFoundComponent?: FC<SelectNotFoundProps> | null;
|
|
90
100
|
placeholder?: string;
|
|
91
101
|
value?: T | T[] | null;
|
|
92
102
|
onChange?: ChangeHandler<T | T[] | null>;
|
|
@@ -117,8 +127,10 @@ export type SelectConfig<T = any, I extends SelectItem<T> = SelectItem<T>> = Omi
|
|
|
117
127
|
sameWidth?: boolean;
|
|
118
128
|
ListComponent?: React.FC<SelectListComponentProps<T, I>>;
|
|
119
129
|
autoCompleteSearch?: boolean;
|
|
130
|
+
autoCompleteAdapter?: AutoCompleteAdapter<T>;
|
|
120
131
|
maxDisplayTokens?: number;
|
|
121
132
|
validateValue?: boolean;
|
|
133
|
+
mode?: 'default' | 'autocomplete';
|
|
122
134
|
};
|
|
123
135
|
export type SelectListComponentProps<T = any, I extends SelectItem<T> = SelectItem<T>> = CollectionListProps<T, I> & {
|
|
124
136
|
optionsRef: React.RefObject<HTMLDivElement>;
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { CollectionProxy, Query } from 'onekijs-framework';
|
|
2
2
|
import { SelectController, SelectItem, SelectState } from './typings';
|
|
3
|
+
export declare const defaultAutocompleteAdapter: <T>(value: string | null) => T | null;
|
|
4
|
+
export declare const numberAutocompleteAdapter: <T>(value: string | null) => T | null;
|
|
3
5
|
export declare const findSelectItem: <T = any, I extends SelectItem<T> = SelectItem<T>, S extends SelectState<T, I> = SelectState<T, I>, C extends SelectController<T, I, S> = SelectController<T, I, S>>(controller: C | CollectionProxy<T, I, S, C>, pattern: string) => I | undefined;
|
|
4
6
|
export declare const findSelectItemIndex: <T = any, I extends SelectItem<T> = SelectItem<T>, S extends SelectState<T, I> = SelectState<T, I>, C extends SelectController<T, I, S> = SelectController<T, I, S>>(controller: C | CollectionProxy<T, I, S, C>, item?: I | undefined) => number;
|
|
5
7
|
export declare const shouldCheckSelect: (currentQuery: Query, lastCheckQuery?: Query) => boolean;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { ControllerTreeProps, TreeItem } from '../typings';
|
|
3
3
|
declare const ControllerTreeComponent: {
|
|
4
|
-
<T = any, I extends TreeItem<T> = TreeItem<T>>({ controller, className, onActivate, onSelect, height, virtual, gap, TreeIconComponent, TreeItemComponent, TreeItemContentComponent, treeItemClassName, TreeTogglerComponent, paddingLeft, paddingRight, animate, keyboardNavigable, listRef, }: ControllerTreeProps<T, I>): React.JSX.Element;
|
|
4
|
+
<T extends unknown = any, I extends TreeItem<T> = TreeItem<T>>({ controller, className, onActivate, onDeactivate, onSelect, onUnselect, onHighlight, onUnhighlight, height, virtual, gap, TreeIconComponent, TreeItemComponent, TreeItemContentComponent, treeItemClassName, TreeTogglerComponent, paddingLeft, paddingRight, animate, keyboardNavigable, listRef, }: ControllerTreeProps<T, I>): React.JSX.Element;
|
|
5
5
|
displayName: string;
|
|
6
6
|
};
|
|
7
7
|
export default ControllerTreeComponent;
|
|
@@ -19,7 +19,11 @@ export type TreeConfig<T = any, I extends TreeItem<T> = TreeItem<T>> = {
|
|
|
19
19
|
TreeIconComponent?: React.FC<TreeItemProps<T, I>>;
|
|
20
20
|
TreeTogglerComponent?: React.FC<TreeItemToggleProps<T, I>>;
|
|
21
21
|
onActivate?: TreeItemHandler<T, I>;
|
|
22
|
+
onDeactivate?: TreeItemHandler<T, I>;
|
|
23
|
+
onHighlight?: TreeItemHandler<T, I>;
|
|
24
|
+
onUnhighlight?: TreeItemHandler<T, I>;
|
|
22
25
|
onSelect?: TreeItemHandler<T, I>;
|
|
26
|
+
onUnselect?: TreeItemHandler<T, I>;
|
|
23
27
|
virtual?: boolean;
|
|
24
28
|
gap?: number;
|
|
25
29
|
paddingLeft?: number;
|
package/dist/index.d.ts
CHANGED
|
@@ -99,6 +99,8 @@ export { default as PropertiesComponent } from './components/properties/componen
|
|
|
99
99
|
export { default as Property } from './components/properties/components/Property';
|
|
100
100
|
export { propertiesStyle } from './components/properties/style';
|
|
101
101
|
export { PropertiesContext, PropertiesList, PropertiesProps, PropertyProps } from './components/properties/typings';
|
|
102
|
+
export { default as AutoComplete } from './components/select/AutoComplete';
|
|
103
|
+
export { FormAutoComplete } from './components/select/AutoComplete';
|
|
102
104
|
export { default as Select } from './components/select';
|
|
103
105
|
export { default as FormSelect } from './components/select/FormSelect';
|
|
104
106
|
export { default as DefaultSelectBroker } from './components/select/SelectBroker';
|
|
@@ -117,7 +119,7 @@ export { default as TreeSelectComponent } from './components/select/components/T
|
|
|
117
119
|
export { default as useSelectController } from './components/select/hooks/useSelectController';
|
|
118
120
|
export { useSelectService } from './components/select/hooks/useSelectService';
|
|
119
121
|
export { default as useTreeSelectController } from './components/select/hooks/useTreeSelectController';
|
|
120
|
-
export { ArraySelectProps, ArrayTreeSelectProps, ControllerSelectProps, ControllerTreeSelectProps, FormSelectProps, SelectBroker, SelectConfig, SelectController, SelectGroup, SelectIconProps, SelectInputProps, SelectItem, SelectItemAdaptee, SelectItemAdapter, SelectListComponentProps, SelectNotFoundProps, SelectOptionHandler, SelectOptionProps, SelectOptionSelectionHandler, SelectProps, SelectState, SelectTokenProps, SelectTokensProps, TreeSelectController, TreeSelectItem, TreeSelectProps, TreeSelectState, UseSelectController, UseSelectOptions, } from './components/select/typings';
|
|
122
|
+
export { ArraySelectProps, ArrayTreeSelectProps, ControllerSelectProps, ControllerTreeSelectProps, FormSelectProps, SelectBroker, SelectConfig, SelectController, SelectGroup, SelectIconProps, SelectInputProps, SelectItem, SelectItemAdaptee, SelectItemAdapter, SelectListComponentProps, SelectNotFoundProps, SelectOptionHandler, SelectOptionProps, SelectOptionSelectionHandler, SelectProps, SelectState, SelectTokenProps, SelectTokensProps, TreeSelectController, TreeSelectItem, TreeSelectProps, TreeSelectState, UseSelectController, UseSelectOptions, AutoCompleteAdapter, AutoCompleteProps, FormAutoCompleteProps, } from './components/select/typings';
|
|
121
123
|
export { findSelectItem, findSelectItemIndex, shouldCheckSelect } from './components/select/util';
|
|
122
124
|
export { default as Tabs } from './components/tab';
|
|
123
125
|
export { default as Tab } from './components/tab/components/Tab';
|
package/dist/index.js
CHANGED
|
@@ -6428,6 +6428,22 @@ const Properties = styled(PropertiesComponent) `
|
|
|
6428
6428
|
${propertiesStyle}
|
|
6429
6429
|
`;
|
|
6430
6430
|
|
|
6431
|
+
const defaultAutocompleteAdapter = (value) => {
|
|
6432
|
+
if (value === '' || value === null) {
|
|
6433
|
+
return null;
|
|
6434
|
+
}
|
|
6435
|
+
return value;
|
|
6436
|
+
};
|
|
6437
|
+
const numberAutocompleteAdapter = (value) => {
|
|
6438
|
+
if (value === null) {
|
|
6439
|
+
return null;
|
|
6440
|
+
}
|
|
6441
|
+
const parsed = Number(value);
|
|
6442
|
+
if (isNaN(parsed)) {
|
|
6443
|
+
return null;
|
|
6444
|
+
}
|
|
6445
|
+
return parsed;
|
|
6446
|
+
};
|
|
6431
6447
|
const findSelectItem = (controller, pattern) => {
|
|
6432
6448
|
let result = undefined;
|
|
6433
6449
|
if (controller.items === undefined) {
|
|
@@ -6550,6 +6566,14 @@ let SelectService = class SelectService extends onekijsFramework.CollectionServi
|
|
|
6550
6566
|
setDefaultValueLoading(loading) {
|
|
6551
6567
|
this.state.defaultValueLoading = loading;
|
|
6552
6568
|
}
|
|
6569
|
+
// For autocomplete, get the direct value for the input field and send it to the requester
|
|
6570
|
+
// We must first use the autocompleteAdapter to convert it to a T
|
|
6571
|
+
*setInputValue(value) {
|
|
6572
|
+
if (this.config?.autoCompleteAdapter) {
|
|
6573
|
+
const adaptedValue = yield this.config.autoCompleteAdapter(value);
|
|
6574
|
+
yield this.setValue(adaptedValue);
|
|
6575
|
+
}
|
|
6576
|
+
}
|
|
6553
6577
|
setItemWidth(_item, value) {
|
|
6554
6578
|
if (this.config?.dropdownWidthModifier === 'min' &&
|
|
6555
6579
|
(this.state.width === undefined || value + 30 > this.state.width)) {
|
|
@@ -6680,6 +6704,12 @@ __decorate([
|
|
|
6680
6704
|
__metadata("design:paramtypes", [Boolean]),
|
|
6681
6705
|
__metadata("design:returntype", void 0)
|
|
6682
6706
|
], SelectService.prototype, "setDefaultValueLoading", null);
|
|
6707
|
+
__decorate([
|
|
6708
|
+
onekijsFramework.saga(onekijsFramework.SagaEffect.Latest),
|
|
6709
|
+
__metadata("design:type", Function),
|
|
6710
|
+
__metadata("design:paramtypes", [Object]),
|
|
6711
|
+
__metadata("design:returntype", void 0)
|
|
6712
|
+
], SelectService.prototype, "setInputValue", null);
|
|
6683
6713
|
__decorate([
|
|
6684
6714
|
onekijsFramework.reducer,
|
|
6685
6715
|
__metadata("design:type", Function),
|
|
@@ -6813,14 +6843,14 @@ const SelectInputComponent = ({ setOpen, open, placeholder, loading, fetching, I
|
|
|
6813
6843
|
const [_, refresh] = React.useReducer((x) => x + 1, 0);
|
|
6814
6844
|
// value that is actually shown in the input.
|
|
6815
6845
|
// This value is set to the partial value (that is the unselected part of the value) if the value is pending loading or we don't
|
|
6816
|
-
const showPartialValue = value === undefined ||
|
|
6846
|
+
const showPartialValue = value === undefined || value === null ||
|
|
6817
6847
|
fetching ||
|
|
6818
6848
|
loading ||
|
|
6819
6849
|
!showSelectedRef.current ||
|
|
6820
6850
|
!value.toString().toLowerCase().startsWith(partialValue.toLowerCase());
|
|
6821
6851
|
const proxyValue = showPartialValue
|
|
6822
6852
|
? focus || loading || fetching
|
|
6823
|
-
? value !== undefined &&
|
|
6853
|
+
? value !== undefined && value !== null &&
|
|
6824
6854
|
showSelectedRef.current &&
|
|
6825
6855
|
value.toString().toLowerCase().startsWith(partialValue.toLowerCase())
|
|
6826
6856
|
? value
|
|
@@ -6891,7 +6921,7 @@ const SelectInputComponent = ({ setOpen, open, placeholder, loading, fetching, I
|
|
|
6891
6921
|
const input = inputRef.current;
|
|
6892
6922
|
const autoSizer = autoSizeRef.current;
|
|
6893
6923
|
if (input && focus) {
|
|
6894
|
-
if (value !== undefined &&
|
|
6924
|
+
if (value !== undefined && value !== null &&
|
|
6895
6925
|
value !== partialValueRef.current &&
|
|
6896
6926
|
value.toLowerCase().startsWith((partialValueRef.current || '').toLowerCase()) &&
|
|
6897
6927
|
showSelectedRef.current) {
|
|
@@ -6954,7 +6984,7 @@ const SelectInputComponent = ({ setOpen, open, placeholder, loading, fetching, I
|
|
|
6954
6984
|
React.createElement("input", { ref: inputRef, placeholder: placeholder, className: "o-select-input", onFocus: onFocus, onBlur: onBlur, onChange: handleChange, onKeyDown: handleKeyDown, onKeyUp: handleKeyUp, value: searchable ? proxyValue : '', onClick: onClick, autoCapitalize: "none", autoComplete: "off", autoCorrect: "off", spellCheck: "false", disabled: disabled }),
|
|
6955
6985
|
!searchable && (React.createElement("span", { className: "o-select-input o-select-input-text", onClick: onClick }, multiple ? '' : proxyValue || '')))),
|
|
6956
6986
|
!multiple && nullable && value && !disabled && (React.createElement("div", { className: "o-select-remover", onClick: onNullify }, "\u2716")),
|
|
6957
|
-
React.createElement(IconComponent, { onClick: onIconClick, open: open, loading: loading, fetching: fetching })));
|
|
6987
|
+
IconComponent && React.createElement(IconComponent, { onClick: onIconClick, open: open, loading: loading, fetching: fetching })));
|
|
6958
6988
|
};
|
|
6959
6989
|
SelectInputComponent.displayName = 'SelectInput';
|
|
6960
6990
|
// export default SelectInputComponent;
|
|
@@ -7044,7 +7074,7 @@ const DefaultSelectListComponent = (props) => {
|
|
|
7044
7074
|
});
|
|
7045
7075
|
return (React.createElement(ListBodyComponent, { ...props, className: "o-select-options", bodyRef: props.optionsRef, items: selectItems, totalSize: totalSize, virtualItems: isVirtual ? virtualItems : undefined, scrollToIndex: scrollToIndex, keyboardNavigable: true, service: props.controller?.asService(), state: props.controller.state }));
|
|
7046
7076
|
};
|
|
7047
|
-
const ControlledSelectComponent = ({ attachDropdownToBody = false, className = '', placeholder, controller, InputComponent = SelectInputComponent$1, IconComponent, OptionContentComponent = SelectOptionContent, OptionComponent = SelectOptionComponent$1, OptionLoadingComponent = LoadingItem$1, MultiOptionsComponent = SelectOptionComponent$1, NotFoundComponent = SelectNotFoundComponent, autoFocus, value, onChange, onBlur: forwardBlur, onFocus: forwardFocus, height = 220, multiple = false, status = onekijsFramework.ValidationStatus.None, size = 'medium', nullable, minChars = 0, openOnFocus = false, searchable = true, dropdownWidthModifier = 'min', preload = 50, increment = 50, animationMs = 200, disabled, defaultValue, defaultValueLoading, required = false, sameWidth = true, overscan, clickable = true, ListComponent = DefaultSelectListComponent, autoCompleteSearch = true, maxDisplayTokens, validateValue = true, }) => {
|
|
7077
|
+
const ControlledSelectComponent = ({ attachDropdownToBody = false, className = '', placeholder, controller, InputComponent = SelectInputComponent$1, IconComponent, OptionContentComponent = SelectOptionContent, OptionComponent = SelectOptionComponent$1, OptionLoadingComponent = LoadingItem$1, MultiOptionsComponent = SelectOptionComponent$1, NotFoundComponent = SelectNotFoundComponent, autoFocus, value, onChange, onBlur: forwardBlur, onFocus: forwardFocus, height = 220, multiple = false, status = onekijsFramework.ValidationStatus.None, size = 'medium', nullable, minChars = 0, openOnFocus = false, searchable = true, dropdownWidthModifier = 'min', preload = 50, increment = 50, animationMs = 200, disabled, defaultValue, defaultValueLoading, required = false, sameWidth = true, overscan, clickable = true, ListComponent = DefaultSelectListComponent, autoCompleteSearch = true, autoCompleteAdapter = defaultAutocompleteAdapter, mode, maxDisplayTokens, validateValue = true, }) => {
|
|
7048
7078
|
if (nullable === undefined) {
|
|
7049
7079
|
nullable = !required;
|
|
7050
7080
|
}
|
|
@@ -7088,6 +7118,8 @@ const ControlledSelectComponent = ({ attachDropdownToBody = false, className = '
|
|
|
7088
7118
|
sameWidth,
|
|
7089
7119
|
overscan,
|
|
7090
7120
|
autoCompleteSearch,
|
|
7121
|
+
autoCompleteAdapter,
|
|
7122
|
+
mode,
|
|
7091
7123
|
maxDisplayTokens,
|
|
7092
7124
|
validateValue,
|
|
7093
7125
|
};
|
|
@@ -7128,6 +7160,8 @@ const ControlledSelectComponent = ({ attachDropdownToBody = false, className = '
|
|
|
7128
7160
|
sameWidth,
|
|
7129
7161
|
overscan,
|
|
7130
7162
|
autoCompleteSearch,
|
|
7163
|
+
autoCompleteAdapter,
|
|
7164
|
+
mode,
|
|
7131
7165
|
maxDisplayTokens,
|
|
7132
7166
|
validateValue,
|
|
7133
7167
|
};
|
|
@@ -7145,6 +7179,9 @@ const ControlledSelectComponent = ({ attachDropdownToBody = false, className = '
|
|
|
7145
7179
|
}, [controller.state.selected, service]);
|
|
7146
7180
|
const showActiveRef = React.useRef(false);
|
|
7147
7181
|
const proxyItem = React.useMemo(() => {
|
|
7182
|
+
if (mode === 'autocomplete') {
|
|
7183
|
+
return undefined;
|
|
7184
|
+
}
|
|
7148
7185
|
const search = controller.getSearch();
|
|
7149
7186
|
const active = controller.state.active;
|
|
7150
7187
|
const selected = controller.state.selected;
|
|
@@ -7170,7 +7207,7 @@ const ControlledSelectComponent = ({ attachDropdownToBody = false, className = '
|
|
|
7170
7207
|
if (!multiple) {
|
|
7171
7208
|
return controller.adapt(value);
|
|
7172
7209
|
}
|
|
7173
|
-
}, [focus, controller, value, multiple, autoCompleteSearch]);
|
|
7210
|
+
}, [focus, controller, value, multiple, autoCompleteSearch, mode]);
|
|
7174
7211
|
const optionsRef = React.useRef(null);
|
|
7175
7212
|
const update = React.useCallback(() => {
|
|
7176
7213
|
if (optionsRef.current && onekijsFramework.get(service, 'config.sameWidth')) {
|
|
@@ -7340,6 +7377,9 @@ const ControlledSelectComponent = ({ attachDropdownToBody = false, className = '
|
|
|
7340
7377
|
onSelect(null);
|
|
7341
7378
|
}
|
|
7342
7379
|
else {
|
|
7380
|
+
if (mode === 'autocomplete') {
|
|
7381
|
+
service.setInputValue(nextValue);
|
|
7382
|
+
}
|
|
7343
7383
|
service.search(nextValue);
|
|
7344
7384
|
if (!open) {
|
|
7345
7385
|
setOpen(true);
|
|
@@ -7485,7 +7525,15 @@ const ControlledSelectComponent = ({ attachDropdownToBody = false, className = '
|
|
|
7485
7525
|
onekijsFramework.useEventListener('keydown', onKeyDown, false);
|
|
7486
7526
|
return (React.createElement(SelectServiceContext.Provider, { value: service },
|
|
7487
7527
|
React.createElement("div", { className: classNames, ref: containerRef, onMouseDown: () => (stateRef.current.keepFocus = true), onMouseUp: () => (stateRef.current.keepFocus = false) },
|
|
7488
|
-
React.createElement(InputComponent, { placeholder: placeholder, setOpen: setOpen, open: open, loading: loading, fetching: fetching, onChange: onInputChange, value:
|
|
7528
|
+
React.createElement(InputComponent, { placeholder: placeholder, setOpen: setOpen, open: open, loading: loading, fetching: fetching, onChange: onInputChange, value: mode === 'autocomplete'
|
|
7529
|
+
? value === null || value === undefined
|
|
7530
|
+
? value
|
|
7531
|
+
: `${value}`
|
|
7532
|
+
: autoCompleteSearch
|
|
7533
|
+
? proxyItem
|
|
7534
|
+
? proxyItem.text
|
|
7535
|
+
: ''
|
|
7536
|
+
: controller.getSearch() || '', focus: focus, onFocus: onFocus, onBlur: onBlur, tokens: tokens, multiple: multiple, onRemove: onRemoveToken, autoFocus: autoFocus, style: style, nullable: nullable, IconComponent: IconComponent, searchable: searchable, clickable: clickable, minChars: minChars, ref: triggerRef, disabled: disabled, autoCompleteSearch: autoCompleteSearch, maxDisplayTokens: maxDisplayTokens }),
|
|
7489
7537
|
React.createElement(Dropdown, { attachToBody: attachDropdownToBody, open: open, distance: 0, animationTimeout: animationMs, onDropStart: onOpen, onCollapseDone: onClosed, placement: "bottom-start", widthModifier: dropdownWidthModifier, width: service.state.width ? `${service.state.width}px` : undefined, className: className, zIndex: attachDropdownToBody ? 2000 : undefined },
|
|
7490
7538
|
React.createElement(ListComponent, { className: "o-select-options", height: height, ItemComponent: multiple ? MultiOptionsComponent : OptionComponent, ItemLoadingComponent: OptionLoadingComponent, ItemContentComponent: OptionContentComponent, NotFoundComponent: NotFoundComponent, onItemSelect: onSelect, onItemUnselect: onSelect, controller: controller, keyboardNavigable: true, multiSelect: multiple, onItemActivate: onActivate, optionsRef: optionsRef, preload: preload, increment: increment })))));
|
|
7491
7539
|
};
|
|
@@ -7961,6 +8009,15 @@ const FormSelect = (props) => {
|
|
|
7961
8009
|
FormSelect.displayName = 'FormSelect';
|
|
7962
8010
|
var FormSelect$1 = React.memo(FormSelect);
|
|
7963
8011
|
|
|
8012
|
+
const AutoComplete = (props) => {
|
|
8013
|
+
const adapter = props.type === 'number' ? numberAutocompleteAdapter : defaultAutocompleteAdapter;
|
|
8014
|
+
return (React.createElement(Select, { NotFoundComponent: null, IconComponent: null, autoCompleteAdapter: adapter, openOnFocus: true, ...props, mode: "autocomplete", autoCompleteSearch: false, validateValue: false, searchable: true, clickable: false }));
|
|
8015
|
+
};
|
|
8016
|
+
const FormAutoComplete = (props) => {
|
|
8017
|
+
const adapter = props.type === 'number' ? numberAutocompleteAdapter : defaultAutocompleteAdapter;
|
|
8018
|
+
return (React.createElement(FormSelect$1, { NotFoundComponent: null, IconComponent: null, autoCompleteAdapter: adapter, openOnFocus: true, ...props, mode: "autocomplete", autoCompleteSearch: false, validateValue: false, searchable: true, clickable: false }));
|
|
8019
|
+
};
|
|
8020
|
+
|
|
7964
8021
|
class DefaultSelectBroker extends onekijsFramework.DefaultCollectionBroker {
|
|
7965
8022
|
defaultValue;
|
|
7966
8023
|
setDefaultValue(defaultValue, subscriberId) {
|
|
@@ -8730,7 +8787,7 @@ const TreeBodyComponent = ({ className, controller, }) => {
|
|
|
8730
8787
|
const service = useTreeService();
|
|
8731
8788
|
const ref = React.useRef(null);
|
|
8732
8789
|
const config = useTreeConfig();
|
|
8733
|
-
return (React.createElement(ListBodyComponent, { className: addClassname('o-tree-body', className), items: controller.items, ListComponent: TreeListComponent, parentRef: ref, bodyRef: config.listRef || ref, service: service, state: service.state, onItemSelect: config.onSelect, onItemActivate: config.onActivate, keyboardNavigable: config.keyboardNavigable }));
|
|
8790
|
+
return (React.createElement(ListBodyComponent, { className: addClassname('o-tree-body', className), items: controller.items, ListComponent: TreeListComponent, parentRef: ref, bodyRef: config.listRef || ref, service: service, state: service.state, onItemSelect: config.onSelect, onItemUnselect: config.onUnselect, onItemActivate: config.onActivate, onItemDeactivate: config.onDeactivate, onItemHighlight: config.onHighlight, onItemUnhighlight: config.onUnhighlight, keyboardNavigable: config.keyboardNavigable }));
|
|
8734
8791
|
};
|
|
8735
8792
|
TreeBodyComponent.displayName = 'TreeBody';
|
|
8736
8793
|
|
|
@@ -8884,17 +8941,21 @@ const VirtualTreeBodyComponent = ({ className, controller, height, }) => {
|
|
|
8884
8941
|
ref: config.listRef || ref,
|
|
8885
8942
|
overscan: 20,
|
|
8886
8943
|
});
|
|
8887
|
-
return (React.createElement(ListBodyComponent, { className: addClassname('o-tree-body', className), items: items, parentRef: config.listRef || ref, bodyRef: config.listRef || ref, totalSize: totalSize, virtualItems: virtualItems, service: service, state: service.state, VirtualListComponent: VirtualTreeListComponent, height: height, onItemSelect: config.onSelect, onItemActivate: config.onActivate, keyboardNavigable: config.keyboardNavigable, scrollToIndex: scrollToIndex }));
|
|
8944
|
+
return (React.createElement(ListBodyComponent, { className: addClassname('o-tree-body', className), items: items, parentRef: config.listRef || ref, bodyRef: config.listRef || ref, totalSize: totalSize, virtualItems: virtualItems, service: service, state: service.state, VirtualListComponent: VirtualTreeListComponent, height: height, onItemSelect: config.onSelect, onItemUnselect: config.onUnselect, onItemActivate: config.onActivate, onItemDeactivate: config.onDeactivate, onItemHighlight: config.onHighlight, onItemUnhighlight: config.onUnhighlight, keyboardNavigable: config.keyboardNavigable, scrollToIndex: scrollToIndex }));
|
|
8888
8945
|
};
|
|
8889
8946
|
VirtualTreeBodyComponent.displayName = 'VirtualTreeBody';
|
|
8890
8947
|
|
|
8891
|
-
const ControllerTreeComponent = ({ controller, className, onActivate, onSelect, height, virtual, gap, TreeIconComponent, TreeItemComponent, TreeItemContentComponent, treeItemClassName, TreeTogglerComponent, paddingLeft, paddingRight, animate = true, keyboardNavigable, listRef, }) => {
|
|
8948
|
+
const ControllerTreeComponent = ({ controller, className, onActivate, onDeactivate, onSelect, onUnselect, onHighlight, onUnhighlight, height, virtual, gap, TreeIconComponent, TreeItemComponent, TreeItemContentComponent, treeItemClassName, TreeTogglerComponent, paddingLeft, paddingRight, animate = true, keyboardNavigable, listRef, }) => {
|
|
8892
8949
|
const config = React.useMemo(() => {
|
|
8893
8950
|
return {
|
|
8894
8951
|
className,
|
|
8895
8952
|
onActivate,
|
|
8953
|
+
onDeactivate,
|
|
8896
8954
|
animate,
|
|
8897
8955
|
onSelect,
|
|
8956
|
+
onUnselect,
|
|
8957
|
+
onHighlight,
|
|
8958
|
+
onUnhighlight,
|
|
8898
8959
|
height,
|
|
8899
8960
|
virtual,
|
|
8900
8961
|
gap,
|
|
@@ -8911,8 +8972,12 @@ const ControllerTreeComponent = ({ controller, className, onActivate, onSelect,
|
|
|
8911
8972
|
}, [
|
|
8912
8973
|
className,
|
|
8913
8974
|
onActivate,
|
|
8975
|
+
onDeactivate,
|
|
8914
8976
|
animate,
|
|
8915
8977
|
onSelect,
|
|
8978
|
+
onUnselect,
|
|
8979
|
+
onHighlight,
|
|
8980
|
+
onUnhighlight,
|
|
8916
8981
|
height,
|
|
8917
8982
|
virtual,
|
|
8918
8983
|
gap,
|
|
@@ -9025,7 +9090,19 @@ const TreeSelectListComponent = (props) => {
|
|
|
9025
9090
|
return false;
|
|
9026
9091
|
}
|
|
9027
9092
|
};
|
|
9028
|
-
|
|
9093
|
+
const onUnselect = (item, index) => {
|
|
9094
|
+
if (item.selectable !== false && props.onItemUnselect) {
|
|
9095
|
+
props.onItemUnselect(item, index);
|
|
9096
|
+
return true;
|
|
9097
|
+
}
|
|
9098
|
+
else {
|
|
9099
|
+
isTreeItemExpanded(item, treeProps.controller)
|
|
9100
|
+
? treeProps.controller.collapse(item, index)
|
|
9101
|
+
: treeProps.controller.expand(item, index);
|
|
9102
|
+
return false;
|
|
9103
|
+
}
|
|
9104
|
+
};
|
|
9105
|
+
return (React.createElement(Tree, { ...props, ...treeProps, TreeItemComponent: SelectOptionComponent$1, className: addClassname('o-select-options', treeProps.className), onSelect: onSelect, onUnselect: onUnselect, onActivate: props.onItemActivate, onDeactivate: props.onItemDeactivate, keyboardNavigable: true, listRef: props.optionsRef }));
|
|
9029
9106
|
};
|
|
9030
9107
|
const ControlledTreeSelectComponent = (props) => {
|
|
9031
9108
|
return (React.createElement(TreeSelectPropsContext.Provider, { value: props },
|
|
@@ -14152,6 +14229,7 @@ exports.AlertComponent = AlertComponent;
|
|
|
14152
14229
|
exports.ArraySelectComponent = ArraySelectComponent;
|
|
14153
14230
|
exports.ArrayTreeComponent = ArrayTreeComponent;
|
|
14154
14231
|
exports.ArrayTreeSelectComponent = ArrayTreeSelectComponent;
|
|
14232
|
+
exports.AutoComplete = AutoComplete;
|
|
14155
14233
|
exports.BaseTheme = BaseTheme;
|
|
14156
14234
|
exports.Button = Button;
|
|
14157
14235
|
exports.CalendarComponent = CalendarComponent;
|
|
@@ -14208,6 +14286,7 @@ exports.FieldLayout = FieldLayout;
|
|
|
14208
14286
|
exports.FieldLayoutComponent = FieldLayoutComponent;
|
|
14209
14287
|
exports.FileIcon = FileIcon;
|
|
14210
14288
|
exports.FolderIcon = FolderIcon;
|
|
14289
|
+
exports.FormAutoComplete = FormAutoComplete;
|
|
14211
14290
|
exports.FormCard = FormCard;
|
|
14212
14291
|
exports.FormCardDisplayer = FormCardDisplayer;
|
|
14213
14292
|
exports.FormCheckbox = FormCheckbox;
|