@true-engineering/true-react-common-ui-kit 4.0.0-alpha31 → 4.0.0-alpha33
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/FiltersPane/index.d.ts +1 -0
- package/dist/components/FiltersPane/types.d.ts +2 -1
- package/dist/components/Select/Select.d.ts +2 -2
- package/dist/components/Select/types.d.ts +4 -0
- package/dist/true-react-common-ui-kit.js +5 -1
- package/dist/true-react-common-ui-kit.js.map +1 -1
- package/dist/true-react-common-ui-kit.umd.cjs +5 -1
- package/dist/true-react-common-ui-kit.umd.cjs.map +1 -1
- package/package.json +1 -1
- package/src/components/FiltersPane/index.ts +1 -0
- package/src/components/FiltersPane/types.ts +2 -1
- package/src/components/Select/Select.tsx +5 -4
- package/src/components/Select/types.ts +3 -0
package/package.json
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export * from './FiltersPane';
|
|
2
2
|
export type { IFiltersPaneStyles } from './FiltersPane.styles';
|
|
3
3
|
export * from './types';
|
|
4
|
+
export { PERIODS, PERIODS_GETTERS } from './constants';
|
|
4
5
|
// TODO : подумать над тем чтобы вынести это все наружу
|
|
5
6
|
export * from './components';
|
|
@@ -48,7 +48,7 @@ export type MultiSelectOptionType<Value> = Value | undefined extends
|
|
|
48
48
|
: unknown;
|
|
49
49
|
|
|
50
50
|
export interface IConfigItemBasicBase<Value> {
|
|
51
|
-
name:
|
|
51
|
+
name: ReactNode;
|
|
52
52
|
isInline?: boolean;
|
|
53
53
|
isClearable?: boolean;
|
|
54
54
|
requiredFilledFilters?: string[];
|
|
@@ -59,6 +59,7 @@ export interface IConfigItemBasicBase<Value> {
|
|
|
59
59
|
|
|
60
60
|
export type IIntervalConfigItem<Value> = IConfigItemBasicBase<Value> & {
|
|
61
61
|
type: 'interval';
|
|
62
|
+
name: string;
|
|
62
63
|
} & Omit<IFilterIntervalProps, 'value' | 'onChange' | 'labelName'>;
|
|
63
64
|
|
|
64
65
|
export interface IBooleanConfigItem<Value> extends IConfigItemBasicBase<Value> {
|
|
@@ -17,6 +17,7 @@ import { Portal } from 'react-overlays';
|
|
|
17
17
|
import clsx from 'clsx';
|
|
18
18
|
import { debounce } from 'ts-debounce';
|
|
19
19
|
import {
|
|
20
|
+
applyAction,
|
|
20
21
|
createFilter,
|
|
21
22
|
getArray,
|
|
22
23
|
getTestId,
|
|
@@ -39,14 +40,14 @@ import {
|
|
|
39
40
|
defaultIsOptionDisabled,
|
|
40
41
|
getDefaultConvertToIdFunction,
|
|
41
42
|
} from './helpers';
|
|
42
|
-
import { IChangeSelectEvent, IMultipleSelectValue } from './types';
|
|
43
|
+
import { IChangeSelectEvent, IMultipleSelectValue, ISelectFooter } from './types';
|
|
43
44
|
import { getInputStyles, ISelectStyles, useStyles } from './Select.styles';
|
|
44
45
|
|
|
45
46
|
export interface ISelectProps<Value>
|
|
46
47
|
extends Omit<IInputProps, 'value' | 'onChange' | 'onBlur' | 'type' | 'tweakStyles'>,
|
|
47
48
|
ICommonProps<ISelectStyles> {
|
|
48
49
|
header?: ReactNode;
|
|
49
|
-
footer?:
|
|
50
|
+
footer?: ISelectFooter<Value>;
|
|
50
51
|
defaultOptionLabel?: ReactNode;
|
|
51
52
|
allOptionsLabel?: string;
|
|
52
53
|
noMatchesLabel?: string;
|
|
@@ -194,7 +195,7 @@ export function Select<Value>(
|
|
|
194
195
|
|
|
195
196
|
const filteredOptions = useMemo(() => {
|
|
196
197
|
if (optionsMode !== 'search') {
|
|
197
|
-
return options;
|
|
198
|
+
return options as Value[];
|
|
198
199
|
}
|
|
199
200
|
|
|
200
201
|
const filter =
|
|
@@ -554,7 +555,7 @@ export function Select<Value>(
|
|
|
554
555
|
allOptionsLabel={shouldShowAllOption && allOptionsLabel}
|
|
555
556
|
areAllOptionsSelected={areAllOptionsSelected}
|
|
556
557
|
customListHeader={customHeader}
|
|
557
|
-
customListFooter={footer}
|
|
558
|
+
customListFooter={applyAction(footer, { filteredOptions })}
|
|
558
559
|
noMatchesLabel={noMatchesLabel}
|
|
559
560
|
focusedIndex={focusedListCellIndex}
|
|
560
561
|
activeValue={value}
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import { ChangeEvent, KeyboardEvent } from 'react';
|
|
2
|
+
import { IRenderNode } from '../../types';
|
|
2
3
|
import { IChangeInputEvent } from '../Input';
|
|
3
4
|
|
|
4
5
|
export type IMultipleSelectValue<Value> = Array<NonNullable<Value>>;
|
|
5
6
|
|
|
6
7
|
export type IChangeSelectEvent = IChangeInputEvent | ChangeEvent<HTMLElement> | KeyboardEvent;
|
|
8
|
+
|
|
9
|
+
export type ISelectFooter<T> = IRenderNode<{ filteredOptions: T[] }>;
|