onekijs-ui 0.15.1 → 0.15.3
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/checkbox/typings.d.ts +1 -1
- package/dist/components/field/typings.d.ts +5 -5
- package/dist/components/label/typings.d.ts +3 -3
- package/dist/components/list/components/ListLoadingComponent.d.ts +4 -0
- package/dist/components/list/typings.d.ts +6 -4
- package/dist/components/modal/typings.d.ts +2 -2
- package/dist/components/select/SelectBroker.d.ts +6 -0
- package/dist/components/select/SelectService.d.ts +16 -2
- package/dist/components/select/components/SelectOptionComponent.d.ts +1 -0
- package/dist/components/select/hooks/useSelectController.d.ts +1 -1
- package/dist/components/select/hooks/useSelectService.d.ts +4 -0
- package/dist/components/select/typings.d.ts +32 -6
- package/dist/components/select/util.d.ts +6 -0
- package/dist/components/tab/typings.d.ts +1 -0
- package/dist/components/table/columns/useSelectColumn.d.ts +2 -1
- package/dist/components/table/columns/useTextareaColumn.d.ts +3 -0
- package/dist/components/table/components/cells/SelectCellComponent.d.ts +3 -4
- package/dist/components/table/components/cells/TextareaCellComponent.d.ts +4 -0
- package/dist/components/table/typings.d.ts +14 -8
- package/dist/components/textarea/FormTextarea.d.ts +4 -0
- package/dist/components/textarea/components/TextareaComponent.d.ts +4 -0
- package/dist/components/textarea/index.d.ts +3 -0
- package/dist/components/textarea/style.d.ts +4 -0
- package/dist/components/textarea/typings.d.ts +12 -0
- package/dist/components/tooltip/typings.d.ts +2 -2
- package/dist/components/tree/TreeService.d.ts +2 -2
- package/dist/components/tree/util.d.ts +3 -0
- package/dist/index.d.ts +18 -2
- package/dist/index.js +959 -281
- package/dist/index.js.map +1 -1
- package/dist/index.module.js +944 -283
- package/dist/index.module.js.map +1 -1
- package/dist/styles/typings.d.ts +34 -0
- package/package.json +3 -3
- package/src/components/checkbox/components/CheckboxComponent.tsx +1 -1
- package/src/components/checkbox/style.ts +22 -0
- package/src/components/checkbox/typings.ts +4 -1
- package/src/components/field/components/FieldLayoutComponent.tsx +2 -2
- package/src/components/field/style.ts +20 -8
- package/src/components/field/typings.ts +5 -5
- package/src/components/field/util.ts +5 -0
- package/src/components/input/FormInput.tsx +1 -1
- package/src/components/label/style.ts +0 -1
- package/src/components/label/typings.ts +3 -3
- package/src/components/list/components/ListBodyComponent.tsx +37 -13
- package/src/components/list/components/ListLoadingComponent.tsx +22 -0
- package/src/components/list/components/LoadingItem.tsx +3 -1
- package/src/components/list/hooks/useListView.tsx +12 -10
- package/src/components/list/typings.ts +6 -3
- package/src/components/modal/components/ModalComponent.tsx +10 -7
- package/src/components/modal/style.ts +2 -4
- package/src/components/modal/typings.ts +2 -2
- package/src/components/select/FormSelect.tsx +1 -1
- package/src/components/select/SelectBroker.ts +21 -0
- package/src/components/select/SelectService.ts +187 -3
- package/src/components/select/components/ControllerSelectComponent.tsx +178 -66
- package/src/components/select/components/SelectInputComponent.tsx +18 -7
- package/src/components/select/components/SelectOptionComponent.tsx +36 -20
- package/src/components/select/hooks/useSelectController.ts +10 -11
- package/src/components/select/hooks/useSelectService.ts +7 -0
- package/src/components/select/style.ts +129 -84
- package/src/components/select/typings.ts +41 -5
- package/src/components/select/util.ts +53 -0
- package/src/components/tab/TabsService.ts +1 -0
- package/src/components/tab/components/Tab.tsx +3 -1
- package/src/components/tab/typings.ts +1 -0
- package/src/components/table/columns/useCheckboxColumn.ts +3 -2
- package/src/components/table/columns/useSelectColumn.ts +19 -9
- package/src/components/table/columns/useTextareaColumn.ts +24 -0
- package/src/components/table/components/FormTableComponent.tsx +30 -12
- package/src/components/table/components/TableHeaderTitleComponent.tsx +2 -0
- package/src/components/table/components/cells/SelectCellComponent.tsx +12 -10
- package/src/components/table/components/cells/TextareaCellComponent.tsx +27 -0
- package/src/components/table/style.ts +34 -17
- package/src/components/table/typings.ts +36 -16
- package/src/components/textarea/FormTextarea.tsx +26 -0
- package/src/components/textarea/components/TextareaComponent.tsx +42 -0
- package/src/components/textarea/index.tsx +9 -0
- package/src/components/textarea/style.ts +85 -0
- package/src/components/textarea/typings.ts +15 -0
- package/src/components/tooltip/style.ts +1 -0
- package/src/components/tooltip/typings.ts +2 -1
- package/src/components/tree/TreeService.ts +5 -19
- package/src/components/tree/util.ts +29 -0
- package/src/components/wizard/components/Step.tsx +4 -2
- package/src/index.ts +27 -0
- package/src/styles/typings.ts +36 -0
- package/src/theme/base.tsx +33 -1
- package/src/components/select/hooks/useSelectConfig.ts +0 -7
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { FormFieldProps, ValidationStatus } from 'onekijs-framework';
|
|
3
3
|
import { FieldLayoutProps } from '../field/typings';
|
|
4
|
-
export interface CheckboxProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, 'type' | 'onChange' | 'value' | 'checked'> {
|
|
4
|
+
export interface CheckboxProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, 'type' | 'onChange' | 'value' | 'checked' | 'defaultValue'> {
|
|
5
5
|
label?: string;
|
|
6
6
|
onChange?: (checked: boolean) => void;
|
|
7
7
|
value?: boolean;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { AnonymousObject, ContainerValidation, FieldValidation, FormFieldProps, FormLayout, ValidationStatus } from 'onekijs-framework';
|
|
2
|
-
import React from 'react';
|
|
2
|
+
import React, { ReactNode } from 'react';
|
|
3
3
|
import { TshirtSize } from '../../styles/typings';
|
|
4
4
|
import { GridSize } from '../grid/typings';
|
|
5
5
|
import { LabelProps } from '../label/typings';
|
|
@@ -14,23 +14,23 @@ export declare type FieldComponentProps<T extends AnonymousObject> = T & {
|
|
|
14
14
|
};
|
|
15
15
|
export declare type FieldDescriptionProps = {
|
|
16
16
|
className?: string;
|
|
17
|
-
content:
|
|
17
|
+
content: ReactNode;
|
|
18
18
|
size?: TshirtSize;
|
|
19
19
|
layout?: FormLayout;
|
|
20
20
|
};
|
|
21
21
|
export declare type FieldHelpProps = {
|
|
22
22
|
className?: string;
|
|
23
|
-
content?:
|
|
23
|
+
content?: ReactNode;
|
|
24
24
|
visible?: boolean;
|
|
25
25
|
size?: TshirtSize;
|
|
26
26
|
layout?: FormLayout;
|
|
27
27
|
};
|
|
28
28
|
export declare type FieldLayoutProps = {
|
|
29
29
|
className?: string;
|
|
30
|
-
description?:
|
|
30
|
+
description?: ReactNode;
|
|
31
31
|
disabled?: boolean;
|
|
32
32
|
DescriptionComponent?: React.FC<FieldDescriptionProps>;
|
|
33
|
-
help?:
|
|
33
|
+
help?: ReactNode;
|
|
34
34
|
HelpComponent?: React.FC<FieldHelpProps>;
|
|
35
35
|
id?: string | number;
|
|
36
36
|
label?: string;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import React, { ReactNode } from 'react';
|
|
2
2
|
import { FormLayout } from 'onekijs-framework';
|
|
3
3
|
import { FieldDescriptionProps, FieldHelpProps } from '../field/typings';
|
|
4
4
|
import { TshirtSize } from '../../styles/typings';
|
|
5
5
|
export interface LabelProps {
|
|
6
6
|
className?: string;
|
|
7
|
-
description?:
|
|
7
|
+
description?: ReactNode;
|
|
8
8
|
DescriptionComponent?: React.FC<FieldDescriptionProps>;
|
|
9
9
|
htmlFor?: string | number;
|
|
10
|
-
help?:
|
|
10
|
+
help?: ReactNode;
|
|
11
11
|
HelpComponent?: React.FC<FieldHelpProps>;
|
|
12
12
|
layout?: FormLayout;
|
|
13
13
|
required?: boolean;
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { Collection, CollectionProxy, CollectionState, Item, ItemAdaptee, ItemAdapter, UseCollectionOptions } from 'onekijs-framework';
|
|
2
|
-
import React, { FC } from 'react';
|
|
2
|
+
import React, { FC, ReactNode } from 'react';
|
|
3
|
+
import { StylableProps } from '../../styles/typings';
|
|
3
4
|
export declare type ArrayListProps<T = any, I extends ListItem<T> = ListItem<T>> = ListConfig<T, I> & {
|
|
4
5
|
adapter?: ListItemAdapter<T>;
|
|
5
6
|
dataSource: T[] | string;
|
|
6
7
|
fetchOnce?: boolean;
|
|
7
8
|
};
|
|
8
|
-
export declare type ListBodyProps<T = any, I extends ListItem<T> = ListItem<T>, S extends ListState<T, I> = ListState<T, I>, C extends ListCollection<T, I, S> = ListCollection<T, I, S>> = Pick<CollectionListProps<T, I>, 'onItemSelect' | 'onItemUnselect' | 'onItemActivate' | 'onItemDeactivate' | 'onItemHighlight' | 'onItemUnhighlight' | 'multiSelect' | 'ItemComponent' | 'NotFoundComponent' | 'height' | 'keyboardNavigable'> & {
|
|
9
|
+
export declare type ListBodyProps<T = any, I extends ListItem<T> = ListItem<T>, S extends ListState<T, I> = ListState<T, I>, C extends ListCollection<T, I, S> = ListCollection<T, I, S>> = Pick<CollectionListProps<T, I>, 'onItemSelect' | 'onItemUnselect' | 'onItemActivate' | 'onItemDeactivate' | 'onItemHighlight' | 'onItemUnhighlight' | 'multiSelect' | 'ItemComponent' | 'NotFoundComponent' | 'LoadingComponent' | 'height' | 'keyboardNavigable'> & {
|
|
9
10
|
bodyRef?: React.RefObject<HTMLDivElement>;
|
|
10
11
|
className?: string;
|
|
11
12
|
ItemLoadingComponent?: FC;
|
|
@@ -58,6 +59,7 @@ export declare type ListConfig<T = any, I extends ListItem<T> = ListItem<T>> = {
|
|
|
58
59
|
ItemComponent?: FC<ListItemProps<T, I>>;
|
|
59
60
|
ItemContentComponent?: FC<ListItemProps<T, I>>;
|
|
60
61
|
NotFoundComponent?: FC<ListNotFoundProps>;
|
|
62
|
+
LoadingComponent?: FC<StylableProps>;
|
|
61
63
|
itemHeight?: number | ((index: number) => number);
|
|
62
64
|
keyboardNavigable?: boolean;
|
|
63
65
|
multiSelect?: boolean;
|
|
@@ -73,7 +75,7 @@ export declare type ListConfig<T = any, I extends ListItem<T> = ListItem<T>> = {
|
|
|
73
75
|
virtual?: boolean;
|
|
74
76
|
};
|
|
75
77
|
export declare type ListNotFoundProps = {
|
|
76
|
-
text?:
|
|
78
|
+
text?: ReactNode | ReactNode[];
|
|
77
79
|
};
|
|
78
80
|
export declare type ListProps<T = any, I extends ListItem<T> = ListItem<T>, S extends ListState<T, I> = ListState<T, I>, C extends ListCollection<T, I, S> = ListCollection<T, I, S>> = ListConfig<T, I> & {
|
|
79
81
|
adapter?: ListItemAdapter<T>;
|
|
@@ -91,7 +93,7 @@ export declare enum ListStatus {
|
|
|
91
93
|
PartialLoading = "partial loading",
|
|
92
94
|
Loaded = "loaded"
|
|
93
95
|
}
|
|
94
|
-
export declare type StandardListProps<T = any, I extends ListItem<T> = ListItem<T>> = Pick<ListBodyProps<T, I>, 'items' | 'ItemComponent' | 'ItemLoadingComponent' | 'ItemContentComponent'> & {
|
|
96
|
+
export declare type StandardListProps<T = any, I extends ListItem<T> = ListItem<T>> = Pick<ListBodyProps<T, I>, 'items' | 'ItemComponent' | 'ItemLoadingComponent' | 'ItemContentComponent' | 'LoadingComponent'> & {
|
|
95
97
|
onItemClick?: ListItemHandler<T, I>;
|
|
96
98
|
onItemMouseEnter?: ListItemHandler<T, I>;
|
|
97
99
|
onItemMouseLeave?: ListItemHandler<T, I>;
|
|
@@ -12,8 +12,8 @@ export declare type ModalProps = {
|
|
|
12
12
|
closeIcon?: boolean;
|
|
13
13
|
closeOnEscape?: boolean;
|
|
14
14
|
closeOnClickOutside?: boolean;
|
|
15
|
-
onClose
|
|
16
|
-
onClosed
|
|
15
|
+
onClose?: () => void;
|
|
16
|
+
onClosed?: () => void;
|
|
17
17
|
buttons?: ReactNode[];
|
|
18
18
|
title?: ReactNode;
|
|
19
19
|
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { DefaultCollectionBroker } from 'onekijs-framework';
|
|
2
|
+
import { SelectBroker, SelectController, SelectItem, SelectState } from './typings';
|
|
3
|
+
export default class DefaultSelectBroker<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>> extends DefaultCollectionBroker<T, I, S, C> implements SelectBroker<T, I, S, C> {
|
|
4
|
+
protected defaultValue: T | T[] | null | undefined;
|
|
5
|
+
setDefaultValue(defaultValue: T | T[] | null | undefined, subscriberId?: string): void;
|
|
6
|
+
}
|
|
@@ -1,5 +1,19 @@
|
|
|
1
|
-
import { CollectionService } from 'onekijs-framework';
|
|
2
|
-
import { SelectController, SelectItem, SelectState } from './typings';
|
|
1
|
+
import { AnonymousObject, CollectionFetcherResult, CollectionService, Query } from 'onekijs-framework';
|
|
2
|
+
import { SelectConfig, SelectController, SelectItem, SelectState } from './typings';
|
|
3
3
|
declare class SelectService<T = any, I extends SelectItem<T> = SelectItem<T>, S extends SelectState<T, I> = SelectState<T, I>> extends CollectionService<T, I, S> implements SelectController<T, I> {
|
|
4
|
+
config: SelectConfig<T, I> | undefined;
|
|
5
|
+
protected lastCheckQuery: Query | undefined;
|
|
6
|
+
get defaultValue(): T | T[] | null | undefined;
|
|
7
|
+
check(): Generator<void | import("redux-saga/effects").AllEffect<import("redux-saga/effects").CallEffect<Generator<Generator<void | AnonymousObject<any>, CollectionFetcherResult<T>, (import("redux-saga").Task<any> | null) & CollectionFetcherResult<T> & (CollectionFetcherResult<T> | undefined)>, I | undefined, CollectionFetcherResult<T>>>> | import("redux-saga/effects").AllEffect<Generator<Generator<void | AnonymousObject<any>, CollectionFetcherResult<T>, (import("redux-saga").Task<any> | null) & CollectionFetcherResult<T> & (CollectionFetcherResult<T> | undefined)>, I | undefined, CollectionFetcherResult<T>>>, void, (I | undefined)[]>;
|
|
8
|
+
setData(data: T[]): void;
|
|
9
|
+
setDefaultValue(value: T | T[] | null | undefined): Generator<void | Generator<void | import("redux-saga/effects").AllEffect<import("redux-saga/effects").CallEffect<Generator<Generator<void | AnonymousObject<any>, CollectionFetcherResult<T>, (import("redux-saga").Task<any> | null) & CollectionFetcherResult<T> & (CollectionFetcherResult<T> | undefined)>, I | undefined, CollectionFetcherResult<T>>>> | import("redux-saga/effects").AllEffect<Generator<Generator<void | AnonymousObject<any>, CollectionFetcherResult<T>, (import("redux-saga").Task<any> | null) & CollectionFetcherResult<T> & (CollectionFetcherResult<T> | undefined)>, I | undefined, CollectionFetcherResult<T>>>, void, (I | undefined)[]>, void, unknown>;
|
|
10
|
+
setValue(value: null | T | T[]): void;
|
|
11
|
+
setUrl(url: string): void;
|
|
12
|
+
protected _buildItem(data: T | undefined, adaptee: unknown, context?: AnonymousObject): I;
|
|
13
|
+
protected _filterItem(item: I | undefined, query: Query, valid: boolean): Generator<Generator<void | AnonymousObject<any>, CollectionFetcherResult<T>, (import("redux-saga").Task<any> | null) & CollectionFetcherResult<T> & (CollectionFetcherResult<T> | undefined)>, I | undefined, CollectionFetcherResult<T>>;
|
|
14
|
+
_setDefaultValue(value: T | T[] | null | undefined): void;
|
|
15
|
+
_setValidDefaultValue(value: T | T[] | null): void;
|
|
16
|
+
_setInvalidItems(invalidItems: I[]): void;
|
|
17
|
+
protected _setItems(items: (I | undefined)[]): void;
|
|
4
18
|
}
|
|
5
19
|
export default SelectService;
|
|
@@ -2,5 +2,6 @@ import { FC } from 'react';
|
|
|
2
2
|
import { SelectOptionProps } from '../typings';
|
|
3
3
|
export declare const MultiSelectOptionComponent: FC<SelectOptionProps>;
|
|
4
4
|
export declare const SelectOptionContent: FC<SelectOptionProps>;
|
|
5
|
+
export declare const SelectOptionGroup: FC<SelectOptionProps>;
|
|
5
6
|
declare const SelectOptionComponent: FC<SelectOptionProps>;
|
|
6
7
|
export default SelectOptionComponent;
|
|
@@ -2,5 +2,5 @@ import { CollectionProxy } from 'onekijs-framework';
|
|
|
2
2
|
import { UseListOptions } from '../../list/typings';
|
|
3
3
|
import SelectService from '../SelectService';
|
|
4
4
|
import { SelectItem, SelectState } from '../typings';
|
|
5
|
-
declare const useSelectController: <T = any>(dataSource: string | T[], options?: UseListOptions<T,
|
|
5
|
+
declare const useSelectController: <T = any, I extends SelectItem<T> = SelectItem<T>>(dataSource: string | T[] | undefined, options?: UseListOptions<T, I>) => CollectionProxy<T, I, SelectState<T, I>, SelectService<T, I, SelectState<T, I>>>;
|
|
6
6
|
export default useSelectController;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { SelectController, SelectItem } from '../typings';
|
|
3
|
+
export declare const SelectServiceContext: React.Context<SelectController<any, any, import("../typings").SelectState<any, any>>>;
|
|
4
|
+
export declare const useSelectService: <T = any, I extends SelectItem<T> = SelectItem<T>>() => SelectController<T, I, import("../typings").SelectState<T, I>>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AnyFunction, ChangeHandler, Collection, CollectionProxy, FormFieldProps, ValidationStatus } from 'onekijs-framework';
|
|
1
|
+
import { AnyFunction, ChangeHandler, Collection, CollectionBroker, CollectionProxy, FormFieldProps, 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';
|
|
@@ -16,7 +16,12 @@ export declare type FormSelectProps<T = any, I extends SelectItem<T> = SelectIte
|
|
|
16
16
|
defaultValue?: T | T[] | null;
|
|
17
17
|
FieldComponent?: React.FC<SelectProps>;
|
|
18
18
|
};
|
|
19
|
-
export declare type SelectController<T, I extends SelectItem<T> = SelectItem<T>, S extends SelectState<T, I> = SelectState<T, I>> = Collection<T, I, S
|
|
19
|
+
export declare type SelectController<T, I extends SelectItem<T> = SelectItem<T>, S extends SelectState<T, I> = SelectState<T, I>> = Collection<T, I, S> & {
|
|
20
|
+
config?: SelectConfig<T, I>;
|
|
21
|
+
check: () => void;
|
|
22
|
+
defaultValue: T | T[] | null | undefined;
|
|
23
|
+
setDefaultValue: (defaultValue: T | T[] | null | undefined) => void;
|
|
24
|
+
};
|
|
20
25
|
export interface SelectIconProps {
|
|
21
26
|
open: boolean;
|
|
22
27
|
loading: boolean;
|
|
@@ -37,11 +42,20 @@ export interface SelectInputProps<T = any, I extends SelectItem<T> = SelectItem<
|
|
|
37
42
|
onRemove: SelectOptionHandler<T, I>;
|
|
38
43
|
style?: React.CSSProperties;
|
|
39
44
|
nullable?: boolean;
|
|
45
|
+
searchable: boolean;
|
|
40
46
|
clickable: boolean;
|
|
41
47
|
minChars: number;
|
|
42
48
|
}
|
|
43
|
-
export declare type
|
|
44
|
-
|
|
49
|
+
export declare type SelectGroup = string | {
|
|
50
|
+
text: string;
|
|
51
|
+
[k: string]: any;
|
|
52
|
+
};
|
|
53
|
+
export declare type SelectItem<T = any> = ListItem<T> & {
|
|
54
|
+
group?: SelectGroup;
|
|
55
|
+
};
|
|
56
|
+
export declare type SelectItemAdaptee = ListItemAdaptee & {
|
|
57
|
+
group?: SelectGroup;
|
|
58
|
+
};
|
|
45
59
|
export declare type SelectItemAdapter<T = any> = ListItemAdapter<T>;
|
|
46
60
|
export declare type SelectNotFoundProps = ListNotFoundProps;
|
|
47
61
|
export declare type SelectOptionHandler<T = any, I extends SelectItem<T> = SelectItem<T>> = ListItemHandler<T, I>;
|
|
@@ -55,6 +69,9 @@ export declare type SelectProps<T = any, I extends SelectItem<T> = SelectItem<T>
|
|
|
55
69
|
dataSource?: T[] | string;
|
|
56
70
|
fetchOnce?: boolean;
|
|
57
71
|
};
|
|
72
|
+
export declare type SelectBroker<T, I extends SelectItem<T> = SelectItem<T>, S extends SelectState<T, I> = SelectState<T, I>, C extends SelectController<T, I, S> = SelectController<T, I, S>> = CollectionBroker<T, I, S, C> & {
|
|
73
|
+
setDefaultValue: (defaultValue: T | T[] | null | undefined, subscriberId?: string) => void;
|
|
74
|
+
};
|
|
58
75
|
export declare type SelectConfig<T = any, I extends SelectItem<T> = SelectItem<T>> = Omit<ListConfig<T, I>, 'ItemComponent'> & {
|
|
59
76
|
attachDropdownToBody?: boolean;
|
|
60
77
|
InputComponent?: FC<SelectInputProps<T, I>>;
|
|
@@ -62,7 +79,7 @@ export declare type SelectConfig<T = any, I extends SelectItem<T> = SelectItem<T
|
|
|
62
79
|
NotFoundComponent?: FC<SelectNotFoundProps>;
|
|
63
80
|
placeholder?: string;
|
|
64
81
|
value?: T | T[] | null;
|
|
65
|
-
onChange?: ChangeHandler<T>;
|
|
82
|
+
onChange?: ChangeHandler<T | T[] | null>;
|
|
66
83
|
onFocus?: () => void;
|
|
67
84
|
onBlur?: () => void;
|
|
68
85
|
autoFocus?: boolean;
|
|
@@ -75,15 +92,24 @@ export declare type SelectConfig<T = any, I extends SelectItem<T> = SelectItem<T
|
|
|
75
92
|
minChars?: number;
|
|
76
93
|
openOnFocus?: boolean;
|
|
77
94
|
clickable?: boolean;
|
|
95
|
+
searchable?: boolean;
|
|
78
96
|
dropdownWidthModifier?: DropdownWidthModifier;
|
|
79
97
|
OptionComponent?: FC<SelectOptionProps>;
|
|
98
|
+
OptionGroupComponent?: FC<SelectOptionProps>;
|
|
80
99
|
OptionContentComponent?: FC<SelectOptionProps>;
|
|
81
100
|
OptionLoadingComponent?: FC;
|
|
82
101
|
MultiOptionsComponent?: FC<SelectOptionProps>;
|
|
83
102
|
animationMs?: number;
|
|
84
103
|
disabled?: boolean;
|
|
104
|
+
defaultValue?: T | T[] | null;
|
|
105
|
+
required?: boolean;
|
|
106
|
+
sameWidth?: boolean;
|
|
107
|
+
};
|
|
108
|
+
export declare type SelectState<T = any, I extends SelectItem<T> = SelectItem<T>> = ListState<T, I> & {
|
|
109
|
+
invalidItems?: I[];
|
|
110
|
+
validDefaultValue?: T | T[] | null;
|
|
111
|
+
defaultValue?: T | T[] | null;
|
|
85
112
|
};
|
|
86
|
-
export declare type SelectState<T = any, I extends SelectItem<T> = SelectItem<T>> = ListState<T, I>;
|
|
87
113
|
export interface SelectTokensProps<T = any, I extends SelectItem<T> = SelectItem<T>> {
|
|
88
114
|
tokens?: I[];
|
|
89
115
|
onRemove: SelectOptionHandler<T, I>;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { Collection, Item, Query } from 'onekijs-framework';
|
|
2
|
+
import { SelectItem } from './typings';
|
|
3
|
+
export declare const findSelectItem: (controller: Collection<any, SelectItem<any>>, pattern: string) => SelectItem<any> | undefined;
|
|
4
|
+
export declare const findSelectItemIndex: (controller: Collection<any, SelectItem<any>>, item?: Item<any>) => number;
|
|
5
|
+
export declare const shouldCheckSelect: (currentQuery: Query, lastCheckQuery?: Query) => boolean;
|
|
6
|
+
export declare const getGroupText: (item: SelectItem<unknown> | undefined) => string | undefined;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { SelectItem } from '../../select/typings';
|
|
1
2
|
import { SelectColumn, TableItem, UseSelectColumnOptions } from '../typings';
|
|
2
|
-
declare const useSelectColumn: <T = any>(options: UseSelectColumnOptions<T,
|
|
3
|
+
declare const useSelectColumn: <T = any, S = any, TI extends TableItem<T> = TableItem<T>, SI extends SelectItem<S> = SelectItem<S>>(options: UseSelectColumnOptions<T, S, TI, SI>) => SelectColumn<T, S, TI, SI>;
|
|
3
4
|
export default useSelectColumn;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { CollectionBroker } from 'onekijs-framework';
|
|
2
1
|
import React from 'react';
|
|
3
|
-
import { SelectItem } from '../../../select/typings';
|
|
4
|
-
import { TableBodyCellProps, UseSelectColumnOptions } from '../../typings';
|
|
5
|
-
declare const SelectCellComponent: (options: UseSelectColumnOptions<any, SelectItem<any>>, broker:
|
|
2
|
+
import { SelectBroker, SelectItem } from '../../../select/typings';
|
|
3
|
+
import { TableBodyCellProps, TableItem, UseSelectColumnOptions } from '../../typings';
|
|
4
|
+
declare const SelectCellComponent: (options: UseSelectColumnOptions<any, any, TableItem<any>, SelectItem<any>>, broker: SelectBroker<any, SelectItem<any>>) => React.FC<TableBodyCellProps>;
|
|
6
5
|
export default SelectCellComponent;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { TableBodyCellProps, UseTextareaColumnOptions } from '../../typings';
|
|
3
|
+
declare const TextareaCellComponent: (options: UseTextareaColumnOptions<any, any>) => React.FC<TableBodyCellProps<any, any>>;
|
|
4
|
+
export default TextareaCellComponent;
|
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import { Collection,
|
|
2
|
-
import React, { FC } from 'react';
|
|
1
|
+
import { Collection, CollectionBy, CollectionProxy, FormFieldProps, Item, ItemAdaptee, QueryFilterOrCriteria, QuerySortBy, UseCollectionOptions, ValidationStatus } from 'onekijs-framework';
|
|
2
|
+
import React, { FC, ReactNode } from 'react';
|
|
3
3
|
import { TshirtSize } from '../../styles/typings';
|
|
4
4
|
import { CheckboxProps } from '../checkbox/typings';
|
|
5
5
|
import { FieldLayoutProps } from '../field/typings';
|
|
6
6
|
import { InputProps } from '../input/typings';
|
|
7
7
|
import { ListItemProps, ListItems, ListNotFoundProps, ListState, UseListOptions } from '../list/typings';
|
|
8
|
-
import { SelectItem, SelectProps } from '../select/typings';
|
|
8
|
+
import { SelectBroker, SelectItem, SelectProps } from '../select/typings';
|
|
9
|
+
import { TextareaProps } from '../textarea/typings';
|
|
9
10
|
export declare type ArrayTableProps<T = any, I extends TableItem<T> = TableItem<T>> = TableConfig<T, I> & {
|
|
10
11
|
adapter?: TableItemAdapter<T>;
|
|
11
12
|
columns?: TableColumn<T, I>[];
|
|
@@ -125,6 +126,7 @@ export declare type TableColumnSpec<T, I extends TableItem<T> = TableItem<T>> =
|
|
|
125
126
|
TitleComponent?: React.FC<TableHeaderCellProps<T, I>>;
|
|
126
127
|
weight?: number;
|
|
127
128
|
width?: string;
|
|
129
|
+
help?: ReactNode;
|
|
128
130
|
};
|
|
129
131
|
export declare type TableColumnWidth = {
|
|
130
132
|
auto?: boolean;
|
|
@@ -195,9 +197,10 @@ export declare type TableColumnsState<T = any, I extends TableItem<T> = TableIte
|
|
|
195
197
|
};
|
|
196
198
|
export declare type CheckboxColumn<T = any, I extends TableItem<T> = TableItem<T>> = TableColumn<T, I>;
|
|
197
199
|
export declare type InputColumn<T = any, I extends TableItem<T> = TableItem<T>> = TableColumn<T, I>;
|
|
198
|
-
export declare type SelectColumn<T = any, I extends TableItem<T> = TableItem<T>> = TableColumn<T, I> & {
|
|
199
|
-
broker:
|
|
200
|
+
export declare type SelectColumn<T = any, F = any, I extends TableItem<T> = TableItem<T>, FI extends SelectItem<F> = SelectItem<F>> = TableColumn<T, I> & {
|
|
201
|
+
broker: SelectBroker<F, FI>;
|
|
200
202
|
};
|
|
203
|
+
export declare type TextareaColumn<T = any, I extends TableItem<T> = TableItem<T>> = TableColumn<T, I>;
|
|
201
204
|
export declare type UseLinkColumnOptions<T = any, I extends TableItem<T> = TableItem<T>> = Omit<TableColumnSpec<T, I>, 'CellComponent'> & {
|
|
202
205
|
href: string | ((item: I) => string);
|
|
203
206
|
};
|
|
@@ -208,10 +211,13 @@ export declare type UseCheckboxColumnOptions<T = any, I extends TableItem<T> = T
|
|
|
208
211
|
export declare type UseInputColumnOptions<T = any, I extends TableItem<T> = TableItem<T>> = Omit<TableColumnSpec<T, I>, 'CellComponent'> & Omit<FormFieldProps, 'name'> & Omit<InputProps, 'className' | 'onFocus' | 'onChange' | 'onBlur'> & {
|
|
209
212
|
CellComponent?: (options: UseInputColumnOptions<T, I>) => React.FC<TableBodyCellProps<T, I>>;
|
|
210
213
|
};
|
|
211
|
-
export declare type UseSelectColumnOptions<T = any,
|
|
212
|
-
|
|
213
|
-
CellComponent?: (options: UseSelectColumnOptions<F, FI>, broker: CollectionBroker<F, FI>) => React.FC<TableBodyCellProps<T, I>>;
|
|
214
|
+
export declare type UseSelectColumnOptions<T = any, S = any, TI extends TableItem<T> = TableItem<T>, SI extends SelectItem<S> = SelectItem<S>> = Omit<TableColumnSpec<T, TI>, 'CellComponent'> & Omit<SelectProps<S, SI>, 'className' | 'onFocus' | 'onChange' | 'onBlur' | 'items'> & Omit<FormFieldProps, 'name'> & UseCollectionOptions<S, SI> & {
|
|
215
|
+
CellComponent?: SelectCell<T, S, TI, SI>;
|
|
214
216
|
};
|
|
217
|
+
export declare type UseTextareaColumnOptions<T = any, I extends TableItem<T> = TableItem<T>> = Omit<TableColumnSpec<T, I>, 'CellComponent'> & Omit<FormFieldProps, 'name'> & Omit<TextareaProps, 'className' | 'onFocus' | 'onChange' | 'onBlur'> & {
|
|
218
|
+
CellComponent?: (options: UseTextareaColumnOptions<T, I>) => React.FC<TableBodyCellProps<T, I>>;
|
|
219
|
+
};
|
|
220
|
+
export declare type SelectCell<T = any, S = any, TI extends TableItem<T> = TableItem<T>, SI extends SelectItem<S> = SelectItem<S>> = (options: UseSelectColumnOptions<T, S, TI, SI>, broker: SelectBroker<S, SI>) => React.FC<TableBodyCellProps<T, TI>>;
|
|
215
221
|
export declare type UseTableOptions<T = any, I extends TableItem<T> = TableItem<T>> = UseListOptions<T, I> & {
|
|
216
222
|
adapter?: TableItemAdapter<T>;
|
|
217
223
|
selected?: T[];
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { FormFieldProps, ValidationStatus } from 'onekijs-framework';
|
|
3
|
+
import { TshirtSize } from '../../styles/typings';
|
|
4
|
+
import { FieldLayoutProps } from '../field/typings';
|
|
5
|
+
export declare type TextareaProps = Omit<React.TextareaHTMLAttributes<HTMLTextAreaElement>, 'size'> & {
|
|
6
|
+
status?: ValidationStatus;
|
|
7
|
+
size?: TshirtSize;
|
|
8
|
+
};
|
|
9
|
+
export declare type FormTextareaProps = TextareaProps & FormFieldProps & FieldLayoutProps & {
|
|
10
|
+
defaultValue?: string;
|
|
11
|
+
FieldComponent?: React.FC<TextareaProps>;
|
|
12
|
+
};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
2
|
import { Config, PopperOptions } from 'react-popper-tooltip';
|
|
3
3
|
import { ColorPropertyTheme } from '../../styles/typings';
|
|
4
4
|
export interface TooltipProps extends Config {
|
|
5
|
-
content?:
|
|
5
|
+
content?: ReactNode;
|
|
6
6
|
className?: string;
|
|
7
7
|
popperOptions?: PopperOptions;
|
|
8
8
|
kind?: ColorPropertyTheme;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AnonymousObject, CollectionFetcherResult, CollectionService, LocalQuery, QuerySortComparator } from 'onekijs-framework';
|
|
1
|
+
import { AnonymousObject, CollectionFetcherResult, CollectionService, LocalQuery, QuerySearcher, QuerySortComparator } from 'onekijs-framework';
|
|
2
2
|
import { Task } from 'redux-saga';
|
|
3
3
|
import { TreeController, TreeItem, TreeState } from './typings';
|
|
4
4
|
declare class TreeService<T = any, I extends TreeItem<T> = TreeItem<T>, S extends TreeState<T, I> = TreeState<T, I>> extends CollectionService<T, I, S> implements TreeController<T, I> {
|
|
@@ -13,7 +13,7 @@ declare class TreeService<T = any, I extends TreeItem<T> = TreeItem<T>, S extend
|
|
|
13
13
|
protected _adapt(data: T | undefined, context?: AnonymousObject): I;
|
|
14
14
|
protected _buildItem(data: T | undefined, adaptee: unknown, context?: AnonymousObject): I;
|
|
15
15
|
protected _delayChildrenLoading(delay_ms: number, item: I): Generator<import("redux-saga/effects").CallEffect<true> | I[], void, unknown>;
|
|
16
|
-
protected _execute(items: I[], query: LocalQuery, comparator: QuerySortComparator, comparators: AnonymousObject<QuerySortComparator>): I[];
|
|
16
|
+
protected _execute(items: I[], query: LocalQuery, comparator: QuerySortComparator, comparators: AnonymousObject<QuerySortComparator>, searcher: QuerySearcher<T>): I[];
|
|
17
17
|
_expand(item: I): void;
|
|
18
18
|
_expanding(item: I): void;
|
|
19
19
|
protected _fetchChildren(item: I, callbackSuccess?: (item: I) => void, callbackError?: (item: I) => void): Generator<void | import("redux-saga/effects").CancelEffect | I[] | import("redux-saga/effects").ForkEffect<Generator<import("redux-saga/effects").CallEffect<true> | I[], void, unknown>> | Promise<CollectionFetcherResult<T>>, void, (Task<any> | null) & CollectionFetcherResult<T>>;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { AnonymousObject, LocalQuery, QuerySearcher, QuerySortComparator } from 'onekijs-framework';
|
|
2
|
+
import { TreeItem } from './typings';
|
|
3
|
+
export declare const defaultTreeQueryEngine: <T = any, I extends TreeItem<T> = TreeItem<T>>(items: I[], query: LocalQuery, comparator: QuerySortComparator, comparators: AnonymousObject<QuerySortComparator>, searcher?: QuerySearcher<T> | undefined) => I[];
|
package/dist/index.d.ts
CHANGED
|
@@ -83,11 +83,15 @@ export { default as ControllerSelectComponent } from './components/select/compon
|
|
|
83
83
|
export { default as SelectComponent } from './components/select/components/SelectComponent';
|
|
84
84
|
export { default as SelectIconComponent } from './components/select/components/SelectIconComponent';
|
|
85
85
|
export { default as SelectInputComponent } from './components/select/components/SelectInputComponent';
|
|
86
|
+
export { default as SelectNotFoundComponent } from './components/select/components/SelectNotFoundComponent';
|
|
86
87
|
export { default as SelectOptionComponent } from './components/select/components/SelectOptionComponent';
|
|
87
88
|
export { default as SelectTokensComponent } from './components/select/components/SelectTokensComponent';
|
|
88
89
|
export { default as FormSelect } from './components/select/FormSelect';
|
|
89
90
|
export { default as useSelectController } from './components/select/hooks/useSelectController';
|
|
90
|
-
export {
|
|
91
|
+
export { default as DefaultSelectBroker } from './components/select/SelectBroker';
|
|
92
|
+
export { default as SelectService } from './components/select/SelectService';
|
|
93
|
+
export { ArraySelectProps, ControllerSelectProps, FormSelectProps, SelectBroker, SelectConfig, SelectController, SelectIconProps, SelectInputProps, SelectItem, SelectItemAdaptee, SelectItemAdapter as SelectAdapter, SelectNotFoundProps, SelectOptionHandler, SelectOptionProps, SelectOptionSelectionHandler, SelectProps, SelectState, SelectTokenProps, SelectTokensProps, } from './components/select/typings';
|
|
94
|
+
export { findSelectItem, findSelectItemIndex, shouldCheckSelect } from './components/select/util';
|
|
91
95
|
export { default as Tabs } from './components/tab';
|
|
92
96
|
export { default as Tab } from './components/tab/components/Tab';
|
|
93
97
|
export { default as TabTitle } from './components/tab/components/TabTitle';
|
|
@@ -98,14 +102,25 @@ export { default as useColumn } from './components/table/columns/useColumn';
|
|
|
98
102
|
export { default as useInputColumn } from './components/table/columns/useInputColumn';
|
|
99
103
|
export { default as useLinkColumn } from './components/table/columns/useLinkColumn';
|
|
100
104
|
export { default as useSelectColumn } from './components/table/columns/useSelectColumn';
|
|
105
|
+
export { default as useTextareaColumn } from './components/table/columns/useTextareaColumn';
|
|
106
|
+
export { default as CheckboxCellComponent } from './components/table/components/cells/CheckboxCellComponent';
|
|
107
|
+
export { default as DefaultCellComponent } from './components/table/components/cells/DefaultCellComponent';
|
|
108
|
+
export { default as ExpandedCellComponent } from './components/table/components/cells/ExpandedCellComponent';
|
|
109
|
+
export { default as InputCellComponent } from './components/table/components/cells/InputCellComponent';
|
|
110
|
+
export { default as SelectCellComponent } from './components/table/components/cells/SelectCellComponent';
|
|
111
|
+
export { default as TextareaCellComponent } from './components/table/components/cells/TextareaCellComponent';
|
|
101
112
|
export { default as FormTable } from './components/table/FormTable';
|
|
102
113
|
export { default as useFormTableContext } from './components/table/hooks/useFormTableContext';
|
|
103
114
|
export { default as useTableController } from './components/table/hooks/useTableController';
|
|
104
|
-
export { ArrayTableProps, Cell, CheckboxColumn, ControllerTableProps, FormTableContext, FormTableProps, InputColumn, SelectColumn, TableBodyCellProps, TableBodyProps, TableBodyRowProps, TableColumn, TableColumnComputedWidth, TableColumnSpec, TableColumnsState, TableColumnWidth, TableConfig, TableController, TableExpandedProps, TableFooterCellProps, TableFooterProps, TableHeaderCellProps, TableHeaderProps, TableItem, TableItemAdaptee, TableItemAdapter, TableItems, TableNotFoundProps, TableProps, TableRowHandler, TableSortProps, TableState, UseCheckboxColumnOptions, UseInputColumnOptions, UseLinkColumnOptions, UseSelectColumnOptions, UseTableOptions, } from './components/table/typings';
|
|
115
|
+
export { ArrayTableProps, Cell, CheckboxColumn, ControllerTableProps, FormTableContext, FormTableProps, InputColumn, SelectCell, SelectColumn, TableBodyCellProps, TableBodyProps, TableBodyRowProps, TableColumn, TableColumnComputedWidth, TableColumnSpec, TableColumnsState, TableColumnWidth, TableConfig, TableController, TableExpandedProps, TableFooterCellProps, TableFooterProps, TableHeaderCellProps, TableHeaderProps, TableItem, TableItemAdaptee, TableItemAdapter, TableItems, TableNotFoundProps, TableProps, TableRowHandler, TableSortProps, TableState, TextareaColumn, UseCheckboxColumnOptions, UseInputColumnOptions, UseLinkColumnOptions, UseSelectColumnOptions, UseTableOptions, UseTextareaColumnOptions, } from './components/table/typings';
|
|
105
116
|
export { default as Tag } from './components/tag';
|
|
106
117
|
export { default as TagComponent } from './components/tag/components/TagComponent';
|
|
107
118
|
export { tagStyle } from './components/tag/style';
|
|
108
119
|
export { TagProps } from './components/tag/typings';
|
|
120
|
+
export { default as Textarea } from './components/textarea';
|
|
121
|
+
export { default as TextareaComponent } from './components/textarea/components/TextareaComponent';
|
|
122
|
+
export { default as FormTextarea } from './components/textarea/FormTextarea';
|
|
123
|
+
export { FormTextareaProps, TextareaProps } from './components/textarea/typings';
|
|
109
124
|
export { default as Tooltip } from './components/tooltip';
|
|
110
125
|
export { default as Tree } from './components/tree';
|
|
111
126
|
export { default as ArrayTreeComponent } from './components/tree/components/ArrayTreeComponent';
|
|
@@ -123,6 +138,7 @@ export { default as useTreeService, TreeServiceContext } from './components/tree
|
|
|
123
138
|
export { TreeStateContext, useTreeState } from './components/tree/hooks/useTreeState';
|
|
124
139
|
export { default as TreeService } from './components/tree/TreeService';
|
|
125
140
|
export { ArrayTreeProps, ControllerTreeProps, TreeConfig, TreeController, TreeItem, TreeItemAdaptee, TreeItemAdapter, TreeItemHandler, TreeItemProps, TreeItemToggleProps, TreeListProps, TreeProps, TreeState, UseTreeOptions, VirtualTreeListProps, } from './components/tree/typings';
|
|
141
|
+
export { defaultTreeQueryEngine } from './components/tree/util';
|
|
126
142
|
export { default as Wizard } from './components/wizard';
|
|
127
143
|
export { default as ControlledWizardComponent } from './components/wizard/components/ControlledWizardComponent';
|
|
128
144
|
export { default as Step } from './components/wizard/components/Step';
|