@mtes-mct/monitor-ui 24.17.1 → 24.18.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/CHANGELOG.md +11 -0
- package/fields/CheckTreePicker/CheckTreePickerBox.d.ts +21 -0
- package/fields/CheckTreePicker/CheckTreePickerBox.d.ts.map +1 -0
- package/fields/CheckTreePicker/RsuiteCheckTreePickerBox.d.ts +3 -0
- package/fields/CheckTreePicker/RsuiteCheckTreePickerBox.d.ts.map +1 -0
- package/fields/CheckTreePicker/index.d.ts +3 -3
- package/fields/CheckTreePicker/index.d.ts.map +1 -1
- package/fields/CheckTreePicker/types.d.ts +2 -6
- package/fields/CheckTreePicker/types.d.ts.map +1 -1
- package/fields/CheckTreePicker/utils.d.ts +5 -4
- package/fields/CheckTreePicker/utils.d.ts.map +1 -1
- package/fields/shared/StyledRsuitePickerBox.d.ts +2 -0
- package/fields/shared/StyledRsuitePickerBox.d.ts.map +1 -1
- package/fields/shared/utils.d.ts +13 -4
- package/fields/shared/utils.d.ts.map +1 -1
- package/index.js +475 -220
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,14 @@
|
|
|
1
|
+
## [24.17.1](https://github.com/MTES-MCT/monitor-ui/compare/v24.17.0...v24.17.1) (2025-05-02)
|
|
2
|
+
|
|
3
|
+
### Buid System & Dependencies
|
|
4
|
+
|
|
5
|
+
* **deps:** bump @tanstack/react-table ([652fa3c](https://github.com/MTES-MCT/monitor-ui/commit/652fa3cf4dd1b9bd67168f088aff1cb00b6f307b))
|
|
6
|
+
* **dev-deps:** bump the all-non-major-dependencies group ([44922f2](https://github.com/MTES-MCT/monitor-ui/commit/44922f2e4127eb1eac1e3060eedd6cc45e6731c9))
|
|
7
|
+
* **dev-deps:** bump the all-non-major-dependencies group ([b31336b](https://github.com/MTES-MCT/monitor-ui/commit/b31336b8dabfe48747548aa5198a559ac6dc77b6))
|
|
8
|
+
* **dev-deps:** bump the non-major-dev-dependencies group across 1 directory with 17 updates ([c2ae567](https://github.com/MTES-MCT/monitor-ui/commit/c2ae567788228b0b67a738823a6a1c892bf8979f))
|
|
9
|
+
* **dev-deps:** bump vite ([04cc7d4](https://github.com/MTES-MCT/monitor-ui/commit/04cc7d4b90f0f317fe481da26890c86c8412d9b4))
|
|
10
|
+
* **dev-deps:** bump vite in the npm_and_yarn group ([3aef1de](https://github.com/MTES-MCT/monitor-ui/commit/3aef1de215e81c39cf2880c3e486ee2a4537b098))
|
|
11
|
+
|
|
1
12
|
## [24.16.0](https://github.com/MTES-MCT/monitor-ui/compare/v24.15.1...v24.16.0) (2025-04-02)
|
|
2
13
|
|
|
3
14
|
### Features
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
interface CheckPickerBoxProps {
|
|
2
|
+
boxRef: React.RefObject<HTMLDivElement> | undefined;
|
|
3
|
+
children?: React.ReactNode;
|
|
4
|
+
className: string | undefined;
|
|
5
|
+
disabled: boolean;
|
|
6
|
+
error: string | undefined;
|
|
7
|
+
hasError: boolean;
|
|
8
|
+
isErrorMessageHidden: boolean;
|
|
9
|
+
isLabelHidden?: boolean;
|
|
10
|
+
isLight: boolean;
|
|
11
|
+
isRequired?: boolean;
|
|
12
|
+
isTransparent: boolean;
|
|
13
|
+
label: string;
|
|
14
|
+
name: string;
|
|
15
|
+
popupWidth: number | undefined;
|
|
16
|
+
readOnly: boolean;
|
|
17
|
+
style: React.CSSProperties | undefined;
|
|
18
|
+
}
|
|
19
|
+
export declare function CheckTreePickerBox({ boxRef, children, className, disabled, error, hasError, isErrorMessageHidden, isLabelHidden, isLight, isRequired, isTransparent, label, name, popupWidth, readOnly, style }: CheckPickerBoxProps): import("react/jsx-runtime").JSX.Element;
|
|
20
|
+
export {};
|
|
21
|
+
//# sourceMappingURL=CheckTreePickerBox.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CheckTreePickerBox.d.ts","sourceRoot":"","sources":["../../../src/fields/CheckTreePicker/CheckTreePickerBox.tsx"],"names":[],"mappings":"AAMA,UAAU,mBAAmB;IAC3B,MAAM,EAAE,KAAK,CAAC,SAAS,CAAC,cAAc,CAAC,GAAG,SAAS,CAAA;IACnD,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IAC1B,SAAS,EAAE,MAAM,GAAG,SAAS,CAAA;IAC7B,QAAQ,EAAE,OAAO,CAAA;IACjB,KAAK,EAAE,MAAM,GAAG,SAAS,CAAA;IACzB,QAAQ,EAAE,OAAO,CAAA;IACjB,oBAAoB,EAAE,OAAO,CAAA;IAC7B,aAAa,CAAC,EAAE,OAAO,CAAA;IACvB,OAAO,EAAE,OAAO,CAAA;IAChB,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB,aAAa,EAAE,OAAO,CAAA;IACtB,KAAK,EAAE,MAAM,CAAA;IACb,IAAI,EAAE,MAAM,CAAA;IACZ,UAAU,EAAE,MAAM,GAAG,SAAS,CAAA;IAC9B,QAAQ,EAAE,OAAO,CAAA;IACjB,KAAK,EAAE,KAAK,CAAC,aAAa,GAAG,SAAS,CAAA;CACvC;AAED,wBAAgB,kBAAkB,CAAC,EACjC,MAAM,EACN,QAAQ,EACR,SAAS,EACT,QAAQ,EACR,KAAK,EACL,QAAQ,EACR,oBAAoB,EACpB,aAAa,EACb,OAAO,EACP,UAAU,EACV,aAAa,EACb,KAAK,EACL,IAAI,EACJ,UAAU,EACV,QAAQ,EACR,KAAK,EACN,EAAE,mBAAmB,2CAqBrB"}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { CommonPickerFieldStyleProps } from '@fields/shared/types';
|
|
2
|
+
export declare const RsuiteCheckTreePickerBox: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, CommonPickerFieldStyleProps>> & string;
|
|
3
|
+
//# sourceMappingURL=RsuiteCheckTreePickerBox.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RsuiteCheckTreePickerBox.d.ts","sourceRoot":"","sources":["../../../src/fields/CheckTreePicker/RsuiteCheckTreePickerBox.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,sBAAsB,CAAA;AAEvE,eAAO,MAAM,wBAAwB,gQAkRpC,CAAA"}
|
|
@@ -2,7 +2,6 @@ import { type CheckTreePickerProps as RsuiteCheckTreePickerProps } from 'rsuite'
|
|
|
2
2
|
import type { TreeOption } from './types';
|
|
3
3
|
import type { Promisable } from 'type-fest';
|
|
4
4
|
export type CheckTreePickerProps = Omit<RsuiteCheckTreePickerProps, 'as' | 'container' | 'data' | 'defaultValue' | 'id' | 'onChange' | 'renderMenuItem' | 'value'> & {
|
|
5
|
-
childrenKey?: string;
|
|
6
5
|
error?: string | undefined;
|
|
7
6
|
isErrorMessageHidden?: boolean | undefined;
|
|
8
7
|
isLabelHidden?: boolean | undefined;
|
|
@@ -13,12 +12,13 @@ export type CheckTreePickerProps = Omit<RsuiteCheckTreePickerProps, 'as' | 'cont
|
|
|
13
12
|
isUndefinedWhenDisabled?: boolean | undefined;
|
|
14
13
|
label: string;
|
|
15
14
|
name: string;
|
|
16
|
-
onChange?: (nextValue:
|
|
15
|
+
onChange?: (nextValue: any[] | undefined) => Promisable<void>;
|
|
17
16
|
options: TreeOption[];
|
|
18
17
|
popupWidth?: number | undefined;
|
|
19
18
|
renderedChildrenValue?: string;
|
|
20
19
|
renderedValue?: string;
|
|
20
|
+
shouldShowLabels?: boolean;
|
|
21
21
|
value?: TreeOption[] | undefined;
|
|
22
22
|
};
|
|
23
|
-
export declare function CheckTreePicker({ childrenKey, className, disabled, error, isErrorMessageHidden, isLabelHidden, isLight, isMultiSelect, isRequired, isTransparent, isUndefinedWhenDisabled, label, onChange, options, popupWidth, readOnly, renderedChildrenValue, renderedValue, style, value, ...originalProps }: CheckTreePickerProps): import("react/jsx-runtime").JSX.Element;
|
|
23
|
+
export declare function CheckTreePicker({ childrenKey, className, disabled, error, isErrorMessageHidden, isLabelHidden, isLight, isMultiSelect, isRequired, isTransparent, isUndefinedWhenDisabled, label, labelKey, onChange, options, popupWidth, readOnly, renderedChildrenValue, renderedValue, shouldShowLabels, style, value, valueKey, ...originalProps }: CheckTreePickerProps): import("react/jsx-runtime").JSX.Element;
|
|
24
24
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/fields/CheckTreePicker/index.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/fields/CheckTreePicker/index.tsx"],"names":[],"mappings":"AASA,OAAO,EAEL,KAAK,oBAAoB,IAAI,0BAA0B,EACxD,MAAM,QAAQ,CAAA;AAYf,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAA;AAEzC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,WAAW,CAAA;AAE3C,MAAM,MAAM,oBAAoB,GAAG,IAAI,CACrC,0BAA0B,EAC1B,IAAI,GAAG,WAAW,GAAG,MAAM,GAAG,cAAc,GAAG,IAAI,GAAG,UAAU,GAAG,gBAAgB,GAAG,OAAO,CAC9F,GAAG;IACF,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;IAC1B,oBAAoB,CAAC,EAAE,OAAO,GAAG,SAAS,CAAA;IAC1C,aAAa,CAAC,EAAE,OAAO,GAAG,SAAS,CAAA;IACnC,OAAO,CAAC,EAAE,OAAO,GAAG,SAAS,CAAA;IAC7B,aAAa,CAAC,EAAE,OAAO,CAAA;IACvB,UAAU,CAAC,EAAE,OAAO,GAAG,SAAS,CAAA;IAChC,aAAa,CAAC,EAAE,OAAO,GAAG,SAAS,CAAA;IACnC,uBAAuB,CAAC,EAAE,OAAO,GAAG,SAAS,CAAA;IAC7C,KAAK,EAAE,MAAM,CAAA;IACb,IAAI,EAAE,MAAM,CAAA;IACZ,QAAQ,CAAC,EAAE,CAAC,SAAS,EAAE,GAAG,EAAE,GAAG,SAAS,KAAK,UAAU,CAAC,IAAI,CAAC,CAAA;IAC7D,OAAO,EAAE,UAAU,EAAE,CAAA;IACrB,UAAU,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;IAC/B,qBAAqB,CAAC,EAAE,MAAM,CAAA;IAC9B,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,gBAAgB,CAAC,EAAE,OAAO,CAAA;IAC1B,KAAK,CAAC,EAAE,UAAU,EAAE,GAAG,SAAS,CAAA;CACjC,CAAA;AAED,wBAAgB,eAAe,CAAC,EAC9B,WAAwB,EACxB,SAAS,EACT,QAAgB,EAChB,KAAK,EACL,oBAA4B,EAC5B,aAAqB,EACrB,OAAe,EACf,aAAoB,EACpB,UAAkB,EAClB,aAAqB,EACrB,uBAA+B,EAC/B,KAAK,EACL,QAAkB,EAClB,QAAQ,EACR,OAAO,EACP,UAAU,EACV,QAAgB,EAChB,qBAAyC,EACzC,aAA4B,EAC5B,gBAAuB,EACvB,KAAK,EACL,KAAK,EACL,QAAkB,EAClB,GAAG,aAAa,EACjB,EAAE,oBAAoB,2CA+JtB"}
|
|
@@ -1,8 +1,4 @@
|
|
|
1
|
-
export type TreeOption =
|
|
2
|
-
|
|
3
|
-
value: string | number;
|
|
4
|
-
} & Record<string, TreeOption[] | undefined>) | {
|
|
5
|
-
label: string;
|
|
6
|
-
value: string | number;
|
|
1
|
+
export type TreeOption = {
|
|
2
|
+
[key: string]: string | number | TreeOption[] | undefined;
|
|
7
3
|
};
|
|
8
4
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/fields/CheckTreePicker/types.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/fields/CheckTreePicker/types.ts"],"names":[],"mappings":"AACA,MAAM,MAAM,UAAU,GAAG;IACvB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,GAAG,UAAU,EAAE,GAAG,SAAS,CAAA;CAC1D,CAAA"}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import type { TreeOption } from './types';
|
|
2
2
|
import type { ValueType } from 'rsuite/esm/CheckTreePicker';
|
|
3
|
-
export declare function fromRsuiteValue(selectedValues: ValueType, allOptions: TreeOption[], childrenKey?: string): TreeOption[] | undefined;
|
|
4
|
-
export declare function getTreeOptionsBySelectedValues(selectedValues: ValueType | undefined, options: TreeOption[], childrenKey?: string): TreeOption[];
|
|
5
|
-
export declare function toRsuiteValue(uiValues: TreeOption[] | undefined, childrenKey?: string): ValueType | undefined;
|
|
6
|
-
export declare function computeDisabledValues(isMultiSelect: boolean, value: ValueType | undefined, options: TreeOption[], childrenKey?: string): (string | number)[];
|
|
3
|
+
export declare function fromRsuiteValue(selectedValues: ValueType, allOptions: TreeOption[], childrenKey?: string, valueKey?: string | number, labelKey?: string): TreeOption[] | undefined;
|
|
4
|
+
export declare function getTreeOptionsBySelectedValues(selectedValues: ValueType | undefined, options: TreeOption[], childrenKey?: string, valueKey?: string | number, labelKey?: string): TreeOption[];
|
|
5
|
+
export declare function toRsuiteValue(uiValues: TreeOption[] | undefined, childrenKey?: string, valueKey?: string): ValueType | undefined;
|
|
6
|
+
export declare function computeDisabledValues(isMultiSelect: boolean, value: ValueType | undefined, options: TreeOption[], childrenKey?: string, valueKey?: string, labelKey?: string): (string | number)[];
|
|
7
|
+
export declare function getOptionsToDisplay(allOptions: TreeOption[], selectedOptions: TreeOption[], childrenKey?: string, valueKey?: string): TreeOption[];
|
|
7
8
|
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/fields/CheckTreePicker/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAA;AACzC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAA;AAE3D,wBAAgB,eAAe,CAC7B,cAAc,EAAE,SAAS,EACzB,UAAU,EAAE,UAAU,EAAE,EACxB,WAAW,GAAE,MAAmB,
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/fields/CheckTreePicker/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAA;AACzC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAA;AAE3D,wBAAgB,eAAe,CAC7B,cAAc,EAAE,SAAS,EACzB,UAAU,EAAE,UAAU,EAAE,EACxB,WAAW,GAAE,MAAmB,EAChC,QAAQ,GAAE,MAAM,GAAG,MAAgB,EACnC,QAAQ,GAAE,MAAgB,GACzB,UAAU,EAAE,GAAG,SAAS,CAI1B;AAED,wBAAgB,8BAA8B,CAC5C,cAAc,EAAE,SAAS,GAAG,SAAS,EACrC,OAAO,EAAE,UAAU,EAAE,EACrB,WAAW,GAAE,MAAmB,EAChC,QAAQ,GAAE,MAAM,GAAG,MAAgB,EACnC,QAAQ,GAAE,MAAgB,GACzB,UAAU,EAAE,CAgCd;AAED,wBAAgB,aAAa,CAC3B,QAAQ,EAAE,UAAU,EAAE,GAAG,SAAS,EAClC,WAAW,GAAE,MAAmB,EAChC,QAAQ,GAAE,MAAgB,GACzB,SAAS,GAAG,SAAS,CAcvB;AAED,wBAAgB,qBAAqB,CACnC,aAAa,EAAE,OAAO,EACtB,KAAK,EAAE,SAAS,GAAG,SAAS,EAC5B,OAAO,EAAE,UAAU,EAAE,EACrB,WAAW,GAAE,MAAmB,EAChC,QAAQ,GAAE,MAAgB,EAC1B,QAAQ,GAAE,MAAgB,uBAmB3B;AACD,wBAAgB,mBAAmB,CACjC,UAAU,EAAE,UAAU,EAAE,EACxB,eAAe,EAAE,UAAU,EAAE,EAC7B,WAAW,GAAE,MAAmB,EAChC,QAAQ,GAAE,MAAgB,GACzB,UAAU,EAAE,CA0Bd"}
|
|
@@ -1,3 +1,5 @@
|
|
|
1
1
|
import type { CommonPickerFieldStyleProps } from './types';
|
|
2
|
+
export declare const getCheckPickerInputCss: (p: CommonPickerFieldStyleProps) => import("styled-components").RuleSet<object>;
|
|
3
|
+
export declare const getCheckPickerMenuCss: (p: CommonPickerFieldStyleProps) => import("styled-components").RuleSet<object>;
|
|
2
4
|
export declare const StyledRsuitePickerBox: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, CommonPickerFieldStyleProps>> & string;
|
|
3
5
|
//# sourceMappingURL=StyledRsuitePickerBox.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StyledRsuitePickerBox.d.ts","sourceRoot":"","sources":["../../../src/fields/shared/StyledRsuitePickerBox.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,SAAS,CAAA;AAE1D,eAAO,MAAM,qBAAqB,
|
|
1
|
+
{"version":3,"file":"StyledRsuitePickerBox.d.ts","sourceRoot":"","sources":["../../../src/fields/shared/StyledRsuitePickerBox.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,SAAS,CAAA;AAE1D,eAAO,MAAM,sBAAsB,GAAI,GAAG,2BAA2B,gDAwHpE,CAAA;AACD,eAAO,MAAM,qBAAqB,GAAI,GAAG,2BAA2B,gDA4LnE,CAAA;AACD,eAAO,MAAM,qBAAqB,gQAajC,CAAA"}
|
package/fields/shared/utils.d.ts
CHANGED
|
@@ -1,7 +1,16 @@
|
|
|
1
|
-
import type { CommonChoiceFieldStyleProps,
|
|
1
|
+
import type { CommonChoiceFieldStyleProps, PseudoState } from './types';
|
|
2
2
|
export declare function getChoiceFieldBackgroundColorFactoryForState(pseudoState: PseudoState): (props: CommonChoiceFieldStyleProps) => string;
|
|
3
3
|
export declare function getChoiceFieldBorderColorFactoryForState(pseudoState: PseudoState): (props: CommonChoiceFieldStyleProps) => string;
|
|
4
|
-
export declare function getFieldBackgroundColorFactory(): (props:
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
export declare function getFieldBackgroundColorFactory(): (props: {
|
|
5
|
+
[key: string]: any;
|
|
6
|
+
theme: any;
|
|
7
|
+
}) => any;
|
|
8
|
+
export declare function getFieldBorderColorFactoryForState(pseudoState: PseudoState): (props: {
|
|
9
|
+
[key: string]: any;
|
|
10
|
+
theme: any;
|
|
11
|
+
}) => any;
|
|
12
|
+
export declare function getFieldPlaceholderColorFactoryForState(pseudoState: PseudoState): (props: {
|
|
13
|
+
[key: string]: any;
|
|
14
|
+
theme: any;
|
|
15
|
+
}) => any;
|
|
7
16
|
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/fields/shared/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,2BAA2B,EAAE,
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/fields/shared/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,2BAA2B,EAAE,WAAW,EAAE,MAAM,SAAS,CAAA;AAEvE,wBAAgB,4CAA4C,CAAC,WAAW,EAAE,WAAW,IAC3E,OAAO,2BAA2B,YAsC3C;AAED,wBAAgB,wCAAwC,CAAC,WAAW,EAAE,WAAW,IACvE,OAAO,2BAA2B,YAoC3C;AAED,wBAAgB,8BAA8B,KACpC,OAAO;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;IAAC,KAAK,EAAE,GAAG,CAAA;CAAE,SAqBlD;AAED,wBAAgB,kCAAkC,CAAC,WAAW,EAAE,WAAW,IACjE,OAAO;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;IAAC,KAAK,EAAE,GAAG,CAAA;CAAE,SAiClD;AAED,wBAAgB,uCAAuC,CAAC,WAAW,EAAE,WAAW,IACtE,OAAO;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;IAAC,KAAK,EAAE,GAAG,CAAA;CAAE,SAoBlD"}
|
package/index.js
CHANGED
|
@@ -53937,7 +53937,7 @@ function IconButton({ accent = Accent.PRIMARY, badgeBackgroundColor, badgeColor,
|
|
|
53937
53937
|
return /*#__PURE__*/ jsx(Fragment, {
|
|
53938
53938
|
children: badgeNumber === undefined ? /*#__PURE__*/ jsx(SecondaryButton$1, {
|
|
53939
53939
|
...buttonProps
|
|
53940
|
-
}) : /*#__PURE__*/ jsxs(Wrapper$
|
|
53940
|
+
}) : /*#__PURE__*/ jsxs(Wrapper$3, {
|
|
53941
53941
|
className: className,
|
|
53942
53942
|
style: style,
|
|
53943
53943
|
children: [
|
|
@@ -53957,7 +53957,7 @@ function IconButton({ accent = Accent.PRIMARY, badgeBackgroundColor, badgeColor,
|
|
|
53957
53957
|
return /*#__PURE__*/ jsx(Fragment, {
|
|
53958
53958
|
children: badgeNumber === undefined ? /*#__PURE__*/ jsx(TertiaryButton$1, {
|
|
53959
53959
|
...buttonProps
|
|
53960
|
-
}) : /*#__PURE__*/ jsxs(Wrapper$
|
|
53960
|
+
}) : /*#__PURE__*/ jsxs(Wrapper$3, {
|
|
53961
53961
|
className: className,
|
|
53962
53962
|
style: style,
|
|
53963
53963
|
children: [
|
|
@@ -53977,7 +53977,7 @@ function IconButton({ accent = Accent.PRIMARY, badgeBackgroundColor, badgeColor,
|
|
|
53977
53977
|
return /*#__PURE__*/ jsx(Fragment, {
|
|
53978
53978
|
children: badgeNumber === undefined ? /*#__PURE__*/ jsx(PrimaryButton$1, {
|
|
53979
53979
|
...buttonProps
|
|
53980
|
-
}) : /*#__PURE__*/ jsxs(Wrapper$
|
|
53980
|
+
}) : /*#__PURE__*/ jsxs(Wrapper$3, {
|
|
53981
53981
|
className: className,
|
|
53982
53982
|
style: style,
|
|
53983
53983
|
children: [
|
|
@@ -53995,7 +53995,7 @@ function IconButton({ accent = Accent.PRIMARY, badgeBackgroundColor, badgeColor,
|
|
|
53995
53995
|
});
|
|
53996
53996
|
}
|
|
53997
53997
|
}
|
|
53998
|
-
const Wrapper$
|
|
53998
|
+
const Wrapper$3 = styled.div`
|
|
53999
53999
|
position: relative;
|
|
54000
54000
|
`;
|
|
54001
54001
|
const LEFT_MARGIN = {
|
|
@@ -54084,12 +54084,12 @@ const MenuButton = styled(IconButton)`
|
|
|
54084
54084
|
`;
|
|
54085
54085
|
|
|
54086
54086
|
function Menu({ children }) {
|
|
54087
|
-
return /*#__PURE__*/ jsx(Wrapper$
|
|
54087
|
+
return /*#__PURE__*/ jsx(Wrapper$2, {
|
|
54088
54088
|
role: "menu",
|
|
54089
54089
|
children: children
|
|
54090
54090
|
});
|
|
54091
54091
|
}
|
|
54092
|
-
const Wrapper$
|
|
54092
|
+
const Wrapper$2 = styled.div`
|
|
54093
54093
|
background-color: ${(p)=>p.theme.color.charcoal};
|
|
54094
54094
|
box-sizing: border-box;
|
|
54095
54095
|
display: flex;
|
|
@@ -54521,7 +54521,7 @@ function Banner({ children, className = undefined, closingDelay = 3000, isClosab
|
|
|
54521
54521
|
onAutoClose,
|
|
54522
54522
|
withAutomaticClosing
|
|
54523
54523
|
]);
|
|
54524
|
-
return /*#__PURE__*/ jsx(Wrapper, {
|
|
54524
|
+
return /*#__PURE__*/ jsx(Wrapper$1, {
|
|
54525
54525
|
$isCollapsed: isCollapsed,
|
|
54526
54526
|
$isCollapsible: isCollapsible,
|
|
54527
54527
|
$isFixed: isFixed,
|
|
@@ -54565,7 +54565,7 @@ function Banner({ children, className = undefined, closingDelay = 3000, isClosab
|
|
|
54565
54565
|
})
|
|
54566
54566
|
});
|
|
54567
54567
|
}
|
|
54568
|
-
const Wrapper = styled.div`
|
|
54568
|
+
const Wrapper$1 = styled.div`
|
|
54569
54569
|
align-items: center;
|
|
54570
54570
|
background-color: ${(p)=>getBannerPalette(p.$level).backgroundColor};
|
|
54571
54571
|
border-bottom: ${(p)=>p.$isCollapsible ? `4px solid ${getBannerPalette(p.$level).borderColor}` : 'none'};
|
|
@@ -55465,16 +55465,7 @@ const StyledRsuiteCheckbox = styled(Checkbox$1)`
|
|
|
55465
55465
|
return optionValues.map((optionValue)=>getRsuiteDataItemValueFromOptionValue(optionValue, optionValueKey));
|
|
55466
55466
|
}
|
|
55467
55467
|
|
|
55468
|
-
const
|
|
55469
|
-
font-size: 13px !important;
|
|
55470
|
-
position: relative;
|
|
55471
|
-
user-select: none;
|
|
55472
|
-
width: 100%;
|
|
55473
|
-
|
|
55474
|
-
* {
|
|
55475
|
-
${(p)=>p.$isReadOnly && `cursor: default !important;`}
|
|
55476
|
-
}
|
|
55477
|
-
|
|
55468
|
+
const getCheckPickerInputCss = (p)=>css`
|
|
55478
55469
|
> .rs-picker-toggle-wrapper,
|
|
55479
55470
|
> .rs-auto-complete {
|
|
55480
55471
|
background-color: transparent;
|
|
@@ -55494,9 +55485,8 @@ const StyledRsuitePickerBox = styled.div`
|
|
|
55494
55485
|
/* Remove focus ring (Select) */
|
|
55495
55486
|
box-shadow: none;
|
|
55496
55487
|
font-size: 13px;
|
|
55497
|
-
height: 30px;
|
|
55498
55488
|
line-height: 1.3846;
|
|
55499
|
-
padding: 3.5px 40px
|
|
55489
|
+
padding: 3.5px 40px 3.5px 8px !important;
|
|
55500
55490
|
|
|
55501
55491
|
&:hover,
|
|
55502
55492
|
&._hover {
|
|
@@ -55548,7 +55538,7 @@ const StyledRsuitePickerBox = styled.div`
|
|
|
55548
55538
|
|
|
55549
55539
|
/* Selected value(s) */
|
|
55550
55540
|
> .rs-picker-toggle-value {
|
|
55551
|
-
color: ${
|
|
55541
|
+
color: ${p.theme.color.gunMetal};
|
|
55552
55542
|
font-weight: 500;
|
|
55553
55543
|
|
|
55554
55544
|
> .rs-picker-value-list {
|
|
@@ -55560,7 +55550,7 @@ const StyledRsuitePickerBox = styled.div`
|
|
|
55560
55550
|
/* Counter badge, if any */
|
|
55561
55551
|
> .rs-picker-value-count {
|
|
55562
55552
|
align-items: center;
|
|
55563
|
-
background-color: ${
|
|
55553
|
+
background-color: ${p.theme.color.charcoal};
|
|
55564
55554
|
border-radius: 50%;
|
|
55565
55555
|
display: flex;
|
|
55566
55556
|
font-family: 'Open Sans', sans-serif !important;
|
|
@@ -55595,13 +55585,14 @@ const StyledRsuitePickerBox = styled.div`
|
|
|
55595
55585
|
}
|
|
55596
55586
|
}
|
|
55597
55587
|
}
|
|
55598
|
-
|
|
55588
|
+
`;
|
|
55589
|
+
const getCheckPickerMenuCss = (p)=>css`
|
|
55599
55590
|
> .rs-picker-popup {
|
|
55600
|
-
border: solid 1px ${
|
|
55591
|
+
border: solid 1px ${p.theme.color.gainsboro};
|
|
55601
55592
|
border-radius: 0;
|
|
55602
55593
|
padding: 0;
|
|
55603
55594
|
|
|
55604
|
-
${
|
|
55595
|
+
${p.$popupWidth ? `
|
|
55605
55596
|
max-width: ${p.$popupWidth}px;
|
|
55606
55597
|
min-width: ${p.$popupWidth}px !important;
|
|
55607
55598
|
width: ${p.$popupWidth}px;
|
|
@@ -55613,13 +55604,13 @@ const StyledRsuitePickerBox = styled.div`
|
|
|
55613
55604
|
padding: 8px;
|
|
55614
55605
|
|
|
55615
55606
|
> .rs-input-group {
|
|
55616
|
-
background-color: ${
|
|
55617
|
-
border: solid 1px ${
|
|
55607
|
+
background-color: ${p.theme.color.white};
|
|
55608
|
+
border: solid 1px ${p.theme.color.lightGray};
|
|
55618
55609
|
border-radius: 0;
|
|
55619
55610
|
|
|
55620
55611
|
> [role='searchbox'] {
|
|
55621
|
-
color: ${
|
|
55622
|
-
caret-color: ${
|
|
55612
|
+
color: ${p.theme.color.gunMetal};
|
|
55613
|
+
caret-color: ${p.theme.color.gunMetal};
|
|
55623
55614
|
font-size: 13px;
|
|
55624
55615
|
line-height: 1;
|
|
55625
55616
|
padding: 1px 8px 5px 8px;
|
|
@@ -55634,7 +55625,7 @@ const StyledRsuitePickerBox = styled.div`
|
|
|
55634
55625
|
padding: 4px 8px 4px 4px;
|
|
55635
55626
|
|
|
55636
55627
|
> svg {
|
|
55637
|
-
color: ${
|
|
55628
|
+
color: ${p.theme.color.lightGray};
|
|
55638
55629
|
}
|
|
55639
55630
|
}
|
|
55640
55631
|
}
|
|
@@ -55649,7 +55640,7 @@ const StyledRsuitePickerBox = styled.div`
|
|
|
55649
55640
|
[role='option'],
|
|
55650
55641
|
[role='treeitem'] {
|
|
55651
55642
|
> .rs-picker-select-menu-item {
|
|
55652
|
-
color: ${
|
|
55643
|
+
color: ${p.theme.color.gunMetal};
|
|
55653
55644
|
line-height: 1;
|
|
55654
55645
|
overflow: hidden;
|
|
55655
55646
|
padding: 8px 8px 11px 8px;
|
|
@@ -55657,8 +55648,8 @@ const StyledRsuitePickerBox = styled.div`
|
|
|
55657
55648
|
white-space: nowrap;
|
|
55658
55649
|
|
|
55659
55650
|
&:hover {
|
|
55660
|
-
background-color: ${
|
|
55661
|
-
color: ${
|
|
55651
|
+
background-color: ${p.theme.color.blueYonder25};
|
|
55652
|
+
color: ${p.theme.color.blueYonder};
|
|
55662
55653
|
}
|
|
55663
55654
|
|
|
55664
55655
|
&.rs-picker-select-menu-item-active {
|
|
@@ -55666,13 +55657,13 @@ const StyledRsuitePickerBox = styled.div`
|
|
|
55666
55657
|
font-weight: 500;
|
|
55667
55658
|
|
|
55668
55659
|
&:hover {
|
|
55669
|
-
background-color: ${
|
|
55660
|
+
background-color: ${p.theme.color.blueYonder25};
|
|
55670
55661
|
}
|
|
55671
55662
|
}
|
|
55672
55663
|
|
|
55673
55664
|
&.rs-picker-select-menu-item-disabled {
|
|
55674
55665
|
background-color: transparent;
|
|
55675
|
-
color: ${
|
|
55666
|
+
color: ${p.theme.color.lightGray};
|
|
55676
55667
|
}
|
|
55677
55668
|
}
|
|
55678
55669
|
|
|
@@ -55681,7 +55672,7 @@ const StyledRsuitePickerBox = styled.div`
|
|
|
55681
55672
|
min-height: auto;
|
|
55682
55673
|
|
|
55683
55674
|
> label {
|
|
55684
|
-
color: ${
|
|
55675
|
+
color: ${p.theme.color.gunMetal};
|
|
55685
55676
|
font-size: 13px !important;
|
|
55686
55677
|
line-height: 1;
|
|
55687
55678
|
overflow: hidden;
|
|
@@ -55696,8 +55687,8 @@ const StyledRsuitePickerBox = styled.div`
|
|
|
55696
55687
|
|
|
55697
55688
|
> .rs-checkbox-inner {
|
|
55698
55689
|
&:before {
|
|
55699
|
-
background-color: ${
|
|
55700
|
-
border: solid 2px ${
|
|
55690
|
+
background-color: ${p.theme.color.gainsboro};
|
|
55691
|
+
border: solid 2px ${p.theme.color.lightGray};
|
|
55701
55692
|
border-radius: 0;
|
|
55702
55693
|
}
|
|
55703
55694
|
}
|
|
@@ -55706,17 +55697,17 @@ const StyledRsuitePickerBox = styled.div`
|
|
|
55706
55697
|
}
|
|
55707
55698
|
|
|
55708
55699
|
&:hover {
|
|
55709
|
-
background-color: ${
|
|
55700
|
+
background-color: ${p.theme.color.blueYonder25};
|
|
55710
55701
|
|
|
55711
55702
|
> .rs-checkbox-checker {
|
|
55712
55703
|
> label {
|
|
55713
|
-
color: ${
|
|
55704
|
+
color: ${p.theme.color.blueYonder};
|
|
55714
55705
|
|
|
55715
55706
|
> .rs-checkbox-wrapper {
|
|
55716
55707
|
> .rs-checkbox-inner {
|
|
55717
55708
|
&:before {
|
|
55718
|
-
background-color: ${
|
|
55719
|
-
border: solid 2px ${
|
|
55709
|
+
background-color: ${p.theme.color.blueYonder25};
|
|
55710
|
+
border: solid 2px ${p.theme.color.blueYonder};
|
|
55720
55711
|
}
|
|
55721
55712
|
}
|
|
55722
55713
|
}
|
|
@@ -55725,7 +55716,7 @@ const StyledRsuitePickerBox = styled.div`
|
|
|
55725
55716
|
}
|
|
55726
55717
|
|
|
55727
55718
|
&.rs-check-item-focus {
|
|
55728
|
-
background-color: ${
|
|
55719
|
+
background-color: ${p.theme.color.blueYonder25};
|
|
55729
55720
|
|
|
55730
55721
|
> .rs-checkbox-checker {
|
|
55731
55722
|
> label {
|
|
@@ -55738,19 +55729,19 @@ const StyledRsuitePickerBox = styled.div`
|
|
|
55738
55729
|
background-color: transparent;
|
|
55739
55730
|
|
|
55740
55731
|
&.rs-check-item-focus {
|
|
55741
|
-
background-color: ${
|
|
55732
|
+
background-color: ${p.theme.color.blueYonder25};
|
|
55742
55733
|
}
|
|
55743
55734
|
|
|
55744
55735
|
> .rs-checkbox-checker {
|
|
55745
55736
|
> label {
|
|
55746
|
-
color: ${
|
|
55737
|
+
color: ${p.theme.color.gunMetal};
|
|
55747
55738
|
font-weight: 500;
|
|
55748
55739
|
|
|
55749
55740
|
> .rs-checkbox-wrapper {
|
|
55750
55741
|
> .rs-checkbox-inner {
|
|
55751
55742
|
&:before {
|
|
55752
|
-
background-color: ${
|
|
55753
|
-
border: solid 2px ${
|
|
55743
|
+
background-color: ${p.theme.color.charcoal};
|
|
55744
|
+
border: solid 2px ${p.theme.color.charcoal};
|
|
55754
55745
|
}
|
|
55755
55746
|
}
|
|
55756
55747
|
}
|
|
@@ -55759,17 +55750,17 @@ const StyledRsuitePickerBox = styled.div`
|
|
|
55759
55750
|
|
|
55760
55751
|
&:hover,
|
|
55761
55752
|
&._hover {
|
|
55762
|
-
background-color: ${
|
|
55753
|
+
background-color: ${p.theme.color.blueYonder25};
|
|
55763
55754
|
|
|
55764
55755
|
> .rs-checkbox-checker {
|
|
55765
55756
|
> label {
|
|
55766
|
-
color: ${
|
|
55757
|
+
color: ${p.theme.color.blueYonder};
|
|
55767
55758
|
|
|
55768
55759
|
> .rs-checkbox-wrapper {
|
|
55769
55760
|
> .rs-checkbox-inner {
|
|
55770
55761
|
&:before {
|
|
55771
|
-
background-color: ${
|
|
55772
|
-
border: solid 2px ${
|
|
55762
|
+
background-color: ${p.theme.color.blueYonder};
|
|
55763
|
+
border: solid 2px ${p.theme.color.blueYonder};
|
|
55773
55764
|
}
|
|
55774
55765
|
}
|
|
55775
55766
|
}
|
|
@@ -55780,11 +55771,209 @@ const StyledRsuitePickerBox = styled.div`
|
|
|
55780
55771
|
}
|
|
55781
55772
|
}
|
|
55782
55773
|
}
|
|
55783
|
-
|
|
55774
|
+
}
|
|
55775
|
+
`;
|
|
55776
|
+
const StyledRsuitePickerBox = styled.div`
|
|
55777
|
+
font-size: 13px !important;
|
|
55778
|
+
position: relative;
|
|
55779
|
+
user-select: none;
|
|
55780
|
+
width: 100%;
|
|
55781
|
+
|
|
55782
|
+
* {
|
|
55783
|
+
${(p)=>p.$isReadOnly && `cursor: default !important;`}
|
|
55784
|
+
}
|
|
55785
|
+
|
|
55786
|
+
${(p)=>getCheckPickerInputCss(p)}
|
|
55787
|
+
|
|
55788
|
+
${(p)=>getCheckPickerMenuCss(p)}
|
|
55789
|
+
`;
|
|
55790
|
+
|
|
55791
|
+
function CheckPickerBox({ boxRef, children, className, disabled, error, hasError, isErrorMessageHidden, isLabelHidden, isLight, isRequired, isTransparent, label, name, popupWidth, readOnly, style }) {
|
|
55792
|
+
return /*#__PURE__*/ jsxs(Field$2, {
|
|
55793
|
+
className: className,
|
|
55794
|
+
style: style,
|
|
55795
|
+
children: [
|
|
55796
|
+
/*#__PURE__*/ jsx(Label, {
|
|
55797
|
+
$isDisabled: disabled,
|
|
55798
|
+
$isHidden: isLabelHidden,
|
|
55799
|
+
$isRequired: isRequired,
|
|
55800
|
+
htmlFor: name,
|
|
55801
|
+
children: label
|
|
55802
|
+
}),
|
|
55803
|
+
/*#__PURE__*/ jsx(StyledRsuitePickerBox, {
|
|
55804
|
+
ref: boxRef,
|
|
55805
|
+
$hasError: hasError,
|
|
55806
|
+
$isDisabled: disabled,
|
|
55807
|
+
$isLight: isLight,
|
|
55808
|
+
$isReadOnly: readOnly,
|
|
55809
|
+
$isTransparent: isTransparent,
|
|
55810
|
+
$popupWidth: popupWidth,
|
|
55811
|
+
children: children
|
|
55812
|
+
}),
|
|
55813
|
+
!isErrorMessageHidden && hasError && /*#__PURE__*/ jsx(FieldError, {
|
|
55814
|
+
children: error
|
|
55815
|
+
})
|
|
55816
|
+
]
|
|
55817
|
+
});
|
|
55818
|
+
}
|
|
55819
|
+
|
|
55820
|
+
function CheckPicker({ className, customSearch, customSearchMinQueryLength = 1, disabled = false, error, isErrorMessageHidden = false, isLabelHidden = false, isLight = false, isRequired = false, isTransparent = false, isUndefinedWhenDisabled = false, label, onChange, options, optionValueKey, popupWidth, readOnly = false, searchable = false, style, value, ...originalProps }) {
|
|
55821
|
+
// eslint-disable-next-line no-null/no-null
|
|
55822
|
+
const boxRef = useRef(null);
|
|
55823
|
+
/** Instance of `CustomSearch` */ const customSearchRef = useRef(customSearch);
|
|
55824
|
+
const controlledClassName = useMemo(()=>classnames('Field-CheckPicker', className), [
|
|
55825
|
+
className
|
|
55826
|
+
]);
|
|
55827
|
+
const controlledError = useMemo(()=>normalizeString(error), [
|
|
55828
|
+
error
|
|
55829
|
+
]);
|
|
55830
|
+
const hasError = Boolean(controlledError);
|
|
55831
|
+
const selectedRsuiteValue = useMemo(()=>getRsuiteDataItemValuesFromOptionValues(value, optionValueKey), [
|
|
55832
|
+
optionValueKey,
|
|
55833
|
+
value
|
|
55834
|
+
]);
|
|
55835
|
+
const rsuiteData = useMemo(()=>getRsuiteDataItemsFromOptions(options, optionValueKey), [
|
|
55836
|
+
options,
|
|
55837
|
+
optionValueKey
|
|
55838
|
+
]);
|
|
55839
|
+
const { forceUpdate } = useForceUpdate();
|
|
55840
|
+
// Only used when `customSearch` prop is set
|
|
55841
|
+
const [controlledRsuiteData, setControlledRsuiteData] = useState(customSearch ? rsuiteData : undefined);
|
|
55842
|
+
const handleChange = useCallback((nextOptionRsuiteValues)=>{
|
|
55843
|
+
if (!onChange) {
|
|
55844
|
+
return;
|
|
55845
|
+
}
|
|
55846
|
+
const nextValue = nextOptionRsuiteValues ? getSelectedOptionValuesFromSelectedRsuiteDataItemValues(rsuiteData, nextOptionRsuiteValues) : [];
|
|
55847
|
+
const normalizedNextValue = nextValue.length > 0 ? nextValue : undefined;
|
|
55848
|
+
setControlledRsuiteData(rsuiteData);
|
|
55849
|
+
onChange(normalizedNextValue);
|
|
55850
|
+
}, [
|
|
55851
|
+
onChange,
|
|
55852
|
+
rsuiteData
|
|
55853
|
+
]);
|
|
55854
|
+
const handleSearch = useCallback((nextQuery)=>{
|
|
55855
|
+
if (!customSearchRef.current || nextQuery.trim().length < customSearchMinQueryLength) {
|
|
55856
|
+
setControlledRsuiteData(rsuiteData);
|
|
55857
|
+
return;
|
|
55858
|
+
}
|
|
55859
|
+
const nextControlledRsuiteData = nextQuery.trim().length >= customSearchMinQueryLength ? getRsuiteDataItemsFromOptions(customSearchRef.current.find(nextQuery), optionValueKey) : rsuiteData;
|
|
55860
|
+
setControlledRsuiteData(nextControlledRsuiteData);
|
|
55861
|
+
}, [
|
|
55862
|
+
customSearchMinQueryLength,
|
|
55863
|
+
optionValueKey,
|
|
55864
|
+
rsuiteData
|
|
55865
|
+
]);
|
|
55866
|
+
const renderMenuItem = useCallback((node)=>/*#__PURE__*/ jsx("span", {
|
|
55867
|
+
title: String(node),
|
|
55868
|
+
children: String(node)
|
|
55869
|
+
}), []);
|
|
55870
|
+
useFieldUndefineEffect(isUndefinedWhenDisabled && disabled, onChange);
|
|
55871
|
+
useEffect(()=>{
|
|
55872
|
+
forceUpdate();
|
|
55873
|
+
}, [
|
|
55874
|
+
forceUpdate
|
|
55875
|
+
]);
|
|
55876
|
+
return /*#__PURE__*/ jsx(CheckPickerBox, {
|
|
55877
|
+
boxRef: boxRef,
|
|
55878
|
+
className: controlledClassName,
|
|
55879
|
+
disabled: disabled,
|
|
55880
|
+
error: controlledError,
|
|
55881
|
+
hasError: hasError,
|
|
55882
|
+
isErrorMessageHidden: isErrorMessageHidden,
|
|
55883
|
+
isLabelHidden: isLabelHidden,
|
|
55884
|
+
isLight: isLight,
|
|
55885
|
+
isRequired: isRequired,
|
|
55886
|
+
isTransparent: isTransparent,
|
|
55887
|
+
label: label,
|
|
55888
|
+
name: originalProps.name,
|
|
55889
|
+
popupWidth: popupWidth,
|
|
55890
|
+
readOnly: readOnly,
|
|
55891
|
+
style: style,
|
|
55892
|
+
children: boxRef.current && /*#__PURE__*/ jsx(CheckPicker$1, {
|
|
55893
|
+
container: boxRef.current,
|
|
55894
|
+
// When we use a custom search, we use `controlledRsuiteData` to provide the matching options (data),
|
|
55895
|
+
// when we don't, we don't need to control that and just pass the non-internally-controlled `rsuiteData`
|
|
55896
|
+
data: controlledRsuiteData ?? rsuiteData,
|
|
55897
|
+
disabled: disabled,
|
|
55898
|
+
id: originalProps.name,
|
|
55899
|
+
onChange: handleChange,
|
|
55900
|
+
onSearch: handleSearch,
|
|
55901
|
+
readOnly: readOnly,
|
|
55902
|
+
renderMenuItem: renderMenuItem,
|
|
55903
|
+
searchable: !!customSearch || searchable,
|
|
55904
|
+
// When we use a custom search, we use `controlledRsuiteData` to provide the matching options (data),
|
|
55905
|
+
// that's why we send this "always true" filter to disable Rsuite CheckPicker internal search filtering
|
|
55906
|
+
searchBy: customSearch ? ()=>true : undefined,
|
|
55907
|
+
size: originalProps.size ?? 'sm',
|
|
55908
|
+
value: selectedRsuiteValue,
|
|
55909
|
+
...originalProps
|
|
55910
|
+
})
|
|
55911
|
+
});
|
|
55912
|
+
}
|
|
55913
|
+
|
|
55914
|
+
const RsuiteCheckTreePickerBox = styled.div`
|
|
55915
|
+
font-size: 13px !important;
|
|
55916
|
+
position: relative;
|
|
55917
|
+
user-select: none;
|
|
55918
|
+
width: 100%;
|
|
55919
|
+
|
|
55920
|
+
* {
|
|
55921
|
+
${(p)=>p.$isReadOnly && `cursor: default !important;`}
|
|
55922
|
+
}
|
|
55923
|
+
|
|
55924
|
+
${(p)=>getCheckPickerInputCss(p)}
|
|
55925
|
+
|
|
55926
|
+
> .rs-picker-popup {
|
|
55927
|
+
border: solid 1px ${(p)=>p.theme.color.gainsboro};
|
|
55928
|
+
border-radius: 0;
|
|
55929
|
+
padding: 0;
|
|
55930
|
+
|
|
55931
|
+
${(p)=>p.$popupWidth ? `
|
|
55932
|
+
max-width: ${p.$popupWidth}px;
|
|
55933
|
+
min-width: ${p.$popupWidth}px !important;
|
|
55934
|
+
width: ${p.$popupWidth}px;
|
|
55935
|
+
` : `
|
|
55936
|
+
width: 100%;
|
|
55937
|
+
`};
|
|
55938
|
+
|
|
55939
|
+
> .rs-search-box {
|
|
55940
|
+
padding: 8px;
|
|
55941
|
+
|
|
55942
|
+
> .rs-input-group {
|
|
55943
|
+
background-color: ${(p)=>p.theme.color.white};
|
|
55944
|
+
border: solid 1px ${(p)=>p.theme.color.lightGray};
|
|
55945
|
+
border-radius: 0;
|
|
55946
|
+
|
|
55947
|
+
> [role='searchbox'] {
|
|
55948
|
+
color: ${(p)=>p.theme.color.gunMetal};
|
|
55949
|
+
caret-color: ${(p)=>p.theme.color.gunMetal};
|
|
55950
|
+
font-size: 13px;
|
|
55951
|
+
line-height: 1;
|
|
55952
|
+
padding: 1px 8px 5px 8px;
|
|
55953
|
+
|
|
55954
|
+
&::placeholder {
|
|
55955
|
+
color: transparent;
|
|
55956
|
+
}
|
|
55957
|
+
}
|
|
55958
|
+
|
|
55959
|
+
> .rs-input-group-addon {
|
|
55960
|
+
line-height: 1;
|
|
55961
|
+
padding: 4px 8px 4px 4px;
|
|
55962
|
+
|
|
55963
|
+
> svg {
|
|
55964
|
+
color: ${(p)=>p.theme.color.lightGray};
|
|
55965
|
+
}
|
|
55966
|
+
}
|
|
55967
|
+
}
|
|
55968
|
+
}
|
|
55784
55969
|
> .rs-check-tree {
|
|
55785
55970
|
padding: 0;
|
|
55786
55971
|
margin: 0;
|
|
55787
55972
|
|
|
55973
|
+
.rs-check-tree-node {
|
|
55974
|
+
padding: 0 !important;
|
|
55975
|
+
}
|
|
55976
|
+
|
|
55788
55977
|
.rs-check-tree-node-custom-icon {
|
|
55789
55978
|
margin-top: -2px;
|
|
55790
55979
|
}
|
|
@@ -55792,6 +55981,7 @@ const StyledRsuitePickerBox = styled.div`
|
|
|
55792
55981
|
[role='treeitem'] {
|
|
55793
55982
|
display: flex;
|
|
55794
55983
|
align-items: center;
|
|
55984
|
+
|
|
55795
55985
|
.rs-check-item {
|
|
55796
55986
|
width: 100%;
|
|
55797
55987
|
color: ${(p)=>p.theme.color.gunMetal};
|
|
@@ -55800,7 +55990,7 @@ const StyledRsuitePickerBox = styled.div`
|
|
|
55800
55990
|
text-overflow: ellipsis;
|
|
55801
55991
|
white-space: nowrap;
|
|
55802
55992
|
.rs-check-item-focus {
|
|
55803
|
-
background-color:
|
|
55993
|
+
background-color: transparent;
|
|
55804
55994
|
}
|
|
55805
55995
|
|
|
55806
55996
|
&.rs-picker-select-menu-item-active {
|
|
@@ -55834,6 +56024,9 @@ const StyledRsuitePickerBox = styled.div`
|
|
|
55834
56024
|
background-color: ${(p)=>p.theme.color.charcoal} !important;
|
|
55835
56025
|
border: solid 2px ${(p)=>p.theme.color.charcoal} !important;
|
|
55836
56026
|
}
|
|
56027
|
+
&:after {
|
|
56028
|
+
margin-left: 11px !important;
|
|
56029
|
+
}
|
|
55837
56030
|
}
|
|
55838
56031
|
}
|
|
55839
56032
|
&.rs-checkbox-disabled {
|
|
@@ -55858,21 +56051,21 @@ const StyledRsuitePickerBox = styled.div`
|
|
|
55858
56051
|
> label {
|
|
55859
56052
|
color: ${(p)=>p.theme.color.gunMetal};
|
|
55860
56053
|
font-size: 13px !important;
|
|
55861
|
-
line-height: 1;
|
|
55862
56054
|
overflow: hidden;
|
|
55863
56055
|
text-overflow: ellipsis;
|
|
55864
56056
|
white-space: nowrap;
|
|
55865
56057
|
padding: 1px 0;
|
|
55866
56058
|
|
|
55867
56059
|
> .rs-check-tree-node-label-content {
|
|
55868
|
-
margin-left: 38px;
|
|
55869
56060
|
background-color: initial;
|
|
55870
56061
|
color: initial;
|
|
56062
|
+
padding: 3px 8px 6px 44px;
|
|
56063
|
+
width: 100%;
|
|
55871
56064
|
}
|
|
55872
56065
|
|
|
55873
56066
|
> .rs-checkbox-wrapper {
|
|
55874
56067
|
height: auto;
|
|
55875
|
-
left:
|
|
56068
|
+
left: 0px;
|
|
55876
56069
|
top: 7px !important;
|
|
55877
56070
|
margin-left: 14px;
|
|
55878
56071
|
|
|
@@ -55881,7 +56074,10 @@ const StyledRsuitePickerBox = styled.div`
|
|
|
55881
56074
|
background-color: ${(p)=>p.theme.color.gainsboro};
|
|
55882
56075
|
border: solid 2px ${(p)=>p.theme.color.lightGray};
|
|
55883
56076
|
border-radius: 0;
|
|
55884
|
-
margin-
|
|
56077
|
+
margin-left: 8px;
|
|
56078
|
+
}
|
|
56079
|
+
&:after {
|
|
56080
|
+
margin-left: 13px;
|
|
55885
56081
|
}
|
|
55886
56082
|
}
|
|
55887
56083
|
}
|
|
@@ -55959,12 +56155,36 @@ const StyledRsuitePickerBox = styled.div`
|
|
|
55959
56155
|
}
|
|
55960
56156
|
}
|
|
55961
56157
|
}
|
|
56158
|
+
|
|
56159
|
+
/* childrens */
|
|
56160
|
+
&[aria-level='2'] {
|
|
56161
|
+
> .rs-check-item {
|
|
56162
|
+
> .rs-checkbox-checker {
|
|
56163
|
+
> label {
|
|
56164
|
+
> .rs-check-tree-node-label-content {
|
|
56165
|
+
padding-left: 60px;
|
|
56166
|
+
}
|
|
56167
|
+
|
|
56168
|
+
> .rs-checkbox-wrapper {
|
|
56169
|
+
> .rs-checkbox-inner {
|
|
56170
|
+
&:before {
|
|
56171
|
+
margin-left: 24px;
|
|
56172
|
+
}
|
|
56173
|
+
&:after {
|
|
56174
|
+
margin-left: 29px;
|
|
56175
|
+
}
|
|
56176
|
+
}
|
|
56177
|
+
}
|
|
56178
|
+
}
|
|
56179
|
+
}
|
|
56180
|
+
}
|
|
56181
|
+
}
|
|
55962
56182
|
}
|
|
55963
56183
|
}
|
|
55964
56184
|
}
|
|
55965
56185
|
`;
|
|
55966
56186
|
|
|
55967
|
-
function
|
|
56187
|
+
function CheckTreePickerBox({ boxRef, children, className, disabled, error, hasError, isErrorMessageHidden, isLabelHidden, isLight, isRequired, isTransparent, label, name, popupWidth, readOnly, style }) {
|
|
55968
56188
|
return /*#__PURE__*/ jsxs(Field$2, {
|
|
55969
56189
|
className: className,
|
|
55970
56190
|
style: style,
|
|
@@ -55976,7 +56196,7 @@ function CheckPickerBox({ boxRef, children, className, disabled, error, hasError
|
|
|
55976
56196
|
htmlFor: name,
|
|
55977
56197
|
children: label
|
|
55978
56198
|
}),
|
|
55979
|
-
/*#__PURE__*/ jsx(
|
|
56199
|
+
/*#__PURE__*/ jsx(RsuiteCheckTreePickerBox, {
|
|
55980
56200
|
ref: boxRef,
|
|
55981
56201
|
$hasError: hasError,
|
|
55982
56202
|
$isDisabled: disabled,
|
|
@@ -55993,105 +56213,11 @@ function CheckPickerBox({ boxRef, children, className, disabled, error, hasError
|
|
|
55993
56213
|
});
|
|
55994
56214
|
}
|
|
55995
56215
|
|
|
55996
|
-
function
|
|
55997
|
-
|
|
55998
|
-
const boxRef = useRef(null);
|
|
55999
|
-
/** Instance of `CustomSearch` */ const customSearchRef = useRef(customSearch);
|
|
56000
|
-
const controlledClassName = useMemo(()=>classnames('Field-CheckPicker', className), [
|
|
56001
|
-
className
|
|
56002
|
-
]);
|
|
56003
|
-
const controlledError = useMemo(()=>normalizeString(error), [
|
|
56004
|
-
error
|
|
56005
|
-
]);
|
|
56006
|
-
const hasError = Boolean(controlledError);
|
|
56007
|
-
const selectedRsuiteValue = useMemo(()=>getRsuiteDataItemValuesFromOptionValues(value, optionValueKey), [
|
|
56008
|
-
optionValueKey,
|
|
56009
|
-
value
|
|
56010
|
-
]);
|
|
56011
|
-
const rsuiteData = useMemo(()=>getRsuiteDataItemsFromOptions(options, optionValueKey), [
|
|
56012
|
-
options,
|
|
56013
|
-
optionValueKey
|
|
56014
|
-
]);
|
|
56015
|
-
const { forceUpdate } = useForceUpdate();
|
|
56016
|
-
// Only used when `customSearch` prop is set
|
|
56017
|
-
const [controlledRsuiteData, setControlledRsuiteData] = useState(customSearch ? rsuiteData : undefined);
|
|
56018
|
-
const handleChange = useCallback((nextOptionRsuiteValues)=>{
|
|
56019
|
-
if (!onChange) {
|
|
56020
|
-
return;
|
|
56021
|
-
}
|
|
56022
|
-
const nextValue = nextOptionRsuiteValues ? getSelectedOptionValuesFromSelectedRsuiteDataItemValues(rsuiteData, nextOptionRsuiteValues) : [];
|
|
56023
|
-
const normalizedNextValue = nextValue.length > 0 ? nextValue : undefined;
|
|
56024
|
-
setControlledRsuiteData(rsuiteData);
|
|
56025
|
-
onChange(normalizedNextValue);
|
|
56026
|
-
}, [
|
|
56027
|
-
onChange,
|
|
56028
|
-
rsuiteData
|
|
56029
|
-
]);
|
|
56030
|
-
const handleSearch = useCallback((nextQuery)=>{
|
|
56031
|
-
if (!customSearchRef.current || nextQuery.trim().length < customSearchMinQueryLength) {
|
|
56032
|
-
setControlledRsuiteData(rsuiteData);
|
|
56033
|
-
return;
|
|
56034
|
-
}
|
|
56035
|
-
const nextControlledRsuiteData = nextQuery.trim().length >= customSearchMinQueryLength ? getRsuiteDataItemsFromOptions(customSearchRef.current.find(nextQuery), optionValueKey) : rsuiteData;
|
|
56036
|
-
setControlledRsuiteData(nextControlledRsuiteData);
|
|
56037
|
-
}, [
|
|
56038
|
-
customSearchMinQueryLength,
|
|
56039
|
-
optionValueKey,
|
|
56040
|
-
rsuiteData
|
|
56041
|
-
]);
|
|
56042
|
-
const renderMenuItem = useCallback((node)=>/*#__PURE__*/ jsx("span", {
|
|
56043
|
-
title: String(node),
|
|
56044
|
-
children: String(node)
|
|
56045
|
-
}), []);
|
|
56046
|
-
useFieldUndefineEffect(isUndefinedWhenDisabled && disabled, onChange);
|
|
56047
|
-
useEffect(()=>{
|
|
56048
|
-
forceUpdate();
|
|
56049
|
-
}, [
|
|
56050
|
-
forceUpdate
|
|
56051
|
-
]);
|
|
56052
|
-
return /*#__PURE__*/ jsx(CheckPickerBox, {
|
|
56053
|
-
boxRef: boxRef,
|
|
56054
|
-
className: controlledClassName,
|
|
56055
|
-
disabled: disabled,
|
|
56056
|
-
error: controlledError,
|
|
56057
|
-
hasError: hasError,
|
|
56058
|
-
isErrorMessageHidden: isErrorMessageHidden,
|
|
56059
|
-
isLabelHidden: isLabelHidden,
|
|
56060
|
-
isLight: isLight,
|
|
56061
|
-
isRequired: isRequired,
|
|
56062
|
-
isTransparent: isTransparent,
|
|
56063
|
-
label: label,
|
|
56064
|
-
name: originalProps.name,
|
|
56065
|
-
popupWidth: popupWidth,
|
|
56066
|
-
readOnly: readOnly,
|
|
56067
|
-
style: style,
|
|
56068
|
-
children: boxRef.current && /*#__PURE__*/ jsx(CheckPicker$1, {
|
|
56069
|
-
container: boxRef.current,
|
|
56070
|
-
// When we use a custom search, we use `controlledRsuiteData` to provide the matching options (data),
|
|
56071
|
-
// when we don't, we don't need to control that and just pass the non-internally-controlled `rsuiteData`
|
|
56072
|
-
data: controlledRsuiteData ?? rsuiteData,
|
|
56073
|
-
disabled: disabled,
|
|
56074
|
-
id: originalProps.name,
|
|
56075
|
-
onChange: handleChange,
|
|
56076
|
-
onSearch: handleSearch,
|
|
56077
|
-
readOnly: readOnly,
|
|
56078
|
-
renderMenuItem: renderMenuItem,
|
|
56079
|
-
searchable: !!customSearch || searchable,
|
|
56080
|
-
// When we use a custom search, we use `controlledRsuiteData` to provide the matching options (data),
|
|
56081
|
-
// that's why we send this "always true" filter to disable Rsuite CheckPicker internal search filtering
|
|
56082
|
-
searchBy: customSearch ? ()=>true : undefined,
|
|
56083
|
-
size: originalProps.size ?? 'sm',
|
|
56084
|
-
value: selectedRsuiteValue,
|
|
56085
|
-
...originalProps
|
|
56086
|
-
})
|
|
56087
|
-
});
|
|
56088
|
-
}
|
|
56089
|
-
|
|
56090
|
-
function fromRsuiteValue(selectedValues, allOptions, childrenKey = 'children') {
|
|
56091
|
-
const formattedTree = getTreeOptionsBySelectedValues(selectedValues, allOptions, childrenKey);
|
|
56216
|
+
function fromRsuiteValue(selectedValues, allOptions, childrenKey = 'children', valueKey = 'value', labelKey = 'label') {
|
|
56217
|
+
const formattedTree = getTreeOptionsBySelectedValues(selectedValues, allOptions, childrenKey, valueKey, labelKey);
|
|
56092
56218
|
return formattedTree.length > 0 ? formattedTree : undefined;
|
|
56093
56219
|
}
|
|
56094
|
-
function getTreeOptionsBySelectedValues(selectedValues, options, childrenKey = 'children') {
|
|
56220
|
+
function getTreeOptionsBySelectedValues(selectedValues, options, childrenKey = 'children', valueKey = 'value', labelKey = 'label') {
|
|
56095
56221
|
function getOption(option) {
|
|
56096
56222
|
const children = option[childrenKey];
|
|
56097
56223
|
if (children && Array.isArray(children)) {
|
|
@@ -56099,55 +56225,81 @@ function getTreeOptionsBySelectedValues(selectedValues, options, childrenKey = '
|
|
|
56099
56225
|
if (filteredChildren.length > 0) {
|
|
56100
56226
|
return {
|
|
56101
56227
|
[childrenKey]: filteredChildren.map((child)=>({
|
|
56102
|
-
|
|
56103
|
-
|
|
56228
|
+
[labelKey]: child[labelKey],
|
|
56229
|
+
[valueKey]: child[valueKey]
|
|
56104
56230
|
})),
|
|
56105
|
-
|
|
56106
|
-
|
|
56231
|
+
[labelKey]: option[labelKey],
|
|
56232
|
+
[valueKey]: option[valueKey]
|
|
56107
56233
|
};
|
|
56108
56234
|
}
|
|
56109
56235
|
}
|
|
56110
|
-
if (selectedValues?.includes(option
|
|
56236
|
+
if (selectedValues?.includes(option[valueKey])) {
|
|
56111
56237
|
return {
|
|
56112
56238
|
[childrenKey]: (option[childrenKey] ?? []).map((child)=>({
|
|
56113
|
-
|
|
56114
|
-
|
|
56239
|
+
[labelKey]: child[labelKey],
|
|
56240
|
+
[valueKey]: child[valueKey]
|
|
56115
56241
|
})),
|
|
56116
|
-
|
|
56117
|
-
|
|
56242
|
+
[labelKey]: option[labelKey],
|
|
56243
|
+
[valueKey]: option[valueKey]
|
|
56118
56244
|
};
|
|
56119
56245
|
}
|
|
56120
56246
|
return undefined;
|
|
56121
56247
|
}
|
|
56122
|
-
// Appliquer la fonction filterOption à chaque option de départ
|
|
56123
56248
|
return options.map(getOption).filter((option)=>option !== undefined);
|
|
56124
56249
|
}
|
|
56125
|
-
function toRsuiteValue(uiValues, childrenKey = 'children') {
|
|
56250
|
+
function toRsuiteValue(uiValues, childrenKey = 'children', valueKey = 'value') {
|
|
56126
56251
|
if (!uiValues) {
|
|
56127
56252
|
return undefined;
|
|
56128
56253
|
}
|
|
56129
56254
|
// set only childless and children values
|
|
56130
|
-
const rsuiteValues = uiValues.filter((uiValue)=>uiValue[childrenKey] === undefined).flatMap((
|
|
56131
|
-
const rsuiteChildrenValues = uiValues.flatMap((uiValue)=>(uiValue[childrenKey] ?? []).flatMap((
|
|
56255
|
+
const rsuiteValues = uiValues.filter((uiValue)=>uiValue[childrenKey] === undefined || uiValue[childrenKey].length === 0).flatMap((option)=>option[valueKey]);
|
|
56256
|
+
const rsuiteChildrenValues = uiValues.flatMap((uiValue)=>(uiValue[childrenKey] ?? []).flatMap((child)=>child[valueKey]));
|
|
56132
56257
|
return [
|
|
56133
56258
|
...rsuiteValues,
|
|
56134
56259
|
...rsuiteChildrenValues
|
|
56135
56260
|
];
|
|
56136
56261
|
}
|
|
56137
|
-
function computeDisabledValues(isMultiSelect, value, options, childrenKey = 'children') {
|
|
56262
|
+
function computeDisabledValues(isMultiSelect, value, options, childrenKey = 'children', valueKey = 'value', labelKey = 'label') {
|
|
56138
56263
|
if (isMultiSelect) {
|
|
56139
56264
|
return [];
|
|
56140
56265
|
}
|
|
56141
|
-
const selectedOptions = getTreeOptionsBySelectedValues(value, options, childrenKey);
|
|
56142
|
-
const valuesToDisabled = options.filter((option)=>selectedOptions.some((selectedOption)=>selectedOption
|
|
56143
|
-
const subValuesToDisabled = options.filter((option)=>selectedOptions.some((selectedOption)=>selectedOption
|
|
56266
|
+
const selectedOptions = getTreeOptionsBySelectedValues(value, options, childrenKey, valueKey, labelKey);
|
|
56267
|
+
const valuesToDisabled = options.filter((option)=>selectedOptions.some((selectedOption)=>selectedOption[valueKey] !== option[valueKey])).map((option)=>option[valueKey]);
|
|
56268
|
+
const subValuesToDisabled = options.filter((option)=>selectedOptions.some((selectedOption)=>selectedOption[valueKey] !== option[valueKey])).flatMap((option)=>option[childrenKey]).filter(Boolean).flatMap((option)=>option[valueKey]);
|
|
56144
56269
|
return [
|
|
56145
56270
|
...valuesToDisabled,
|
|
56146
56271
|
...subValuesToDisabled
|
|
56147
56272
|
];
|
|
56148
56273
|
}
|
|
56274
|
+
function getOptionsToDisplay(allOptions, selectedOptions, childrenKey = 'children', valueKey = 'value') {
|
|
56275
|
+
const selectedMap = new Map(selectedOptions.map((opt)=>[
|
|
56276
|
+
opt[valueKey],
|
|
56277
|
+
opt
|
|
56278
|
+
]));
|
|
56279
|
+
const result = [];
|
|
56280
|
+
function findChildren(option) {
|
|
56281
|
+
const children = option[childrenKey];
|
|
56282
|
+
const value = option[valueKey];
|
|
56283
|
+
if (children && children.length > 0) {
|
|
56284
|
+
const hasAllChildrenSelected = children.every((child)=>selectedMap.has(child[valueKey]));
|
|
56285
|
+
if (hasAllChildrenSelected) {
|
|
56286
|
+
result.push(option) // on garde le parent seulement
|
|
56287
|
+
;
|
|
56288
|
+
children.forEach((child)=>selectedMap.delete(child[valueKey]));
|
|
56289
|
+
} else {
|
|
56290
|
+
children.forEach(findChildren) // on descend chercher les enfants partiellement sélectionnés
|
|
56291
|
+
;
|
|
56292
|
+
}
|
|
56293
|
+
} else if (selectedMap.has(value)) {
|
|
56294
|
+
result.push(option) // enfant orphelin sélectionné
|
|
56295
|
+
;
|
|
56296
|
+
}
|
|
56297
|
+
}
|
|
56298
|
+
allOptions.forEach(findChildren);
|
|
56299
|
+
return result;
|
|
56300
|
+
}
|
|
56149
56301
|
|
|
56150
|
-
function CheckTreePicker({ childrenKey = 'children', className, disabled = false, error, isErrorMessageHidden = false, isLabelHidden = false, isLight = false, isMultiSelect = true, isRequired = false, isTransparent = false, isUndefinedWhenDisabled = false, label, onChange, options, popupWidth, readOnly = false, renderedChildrenValue = 'Sous-thématique', renderedValue = 'Thématique', style, value, ...originalProps }) {
|
|
56302
|
+
function CheckTreePicker({ childrenKey = 'children', className, disabled = false, error, isErrorMessageHidden = false, isLabelHidden = false, isLight = false, isMultiSelect = true, isRequired = false, isTransparent = false, isUndefinedWhenDisabled = false, label, labelKey = 'label', onChange, options, popupWidth, readOnly = false, renderedChildrenValue = 'Sous-thématique', renderedValue = 'Thématique', shouldShowLabels = true, style, value, valueKey = 'value', ...originalProps }) {
|
|
56151
56303
|
// eslint-disable-next-line no-null/no-null
|
|
56152
56304
|
const boxRef = useRef(null);
|
|
56153
56305
|
const controlledClassName = useMemo(()=>classnames('Field-CheckTreePicker', className), [
|
|
@@ -56164,29 +56316,42 @@ function CheckTreePicker({ childrenKey = 'children', className, disabled = false
|
|
|
56164
56316
|
}, [
|
|
56165
56317
|
forceUpdate
|
|
56166
56318
|
]);
|
|
56167
|
-
const
|
|
56319
|
+
const [disabledValues, setDisabledValues] = useState([]);
|
|
56320
|
+
const rsuiteValue = useMemo(()=>{
|
|
56321
|
+
const nextRsuiteValue = toRsuiteValue(value, childrenKey, valueKey);
|
|
56322
|
+
if (!isMultiSelect && nextRsuiteValue) {
|
|
56323
|
+
setDisabledValues(computeDisabledValues(isMultiSelect, nextRsuiteValue, options, childrenKey, valueKey, labelKey));
|
|
56324
|
+
} else {
|
|
56325
|
+
setDisabledValues([]);
|
|
56326
|
+
}
|
|
56327
|
+
return nextRsuiteValue;
|
|
56328
|
+
}, [
|
|
56168
56329
|
childrenKey,
|
|
56169
|
-
|
|
56330
|
+
isMultiSelect,
|
|
56331
|
+
labelKey,
|
|
56332
|
+
options,
|
|
56333
|
+
value,
|
|
56334
|
+
valueKey
|
|
56170
56335
|
]);
|
|
56171
|
-
const [disabledValues, setDisabledValues] = useState(computeDisabledValues(isMultiSelect, rsuiteValue, options, childrenKey));
|
|
56172
56336
|
const handleChange = useCallback((nextValue)=>{
|
|
56173
56337
|
if (!onChange) {
|
|
56174
56338
|
return;
|
|
56175
56339
|
}
|
|
56176
|
-
const formattedValues = fromRsuiteValue(nextValue, options, childrenKey);
|
|
56177
|
-
if (!isMultiSelect && formattedValues) {
|
|
56178
|
-
setDisabledValues(computeDisabledValues(isMultiSelect, nextValue, options, childrenKey));
|
|
56179
|
-
} else {
|
|
56180
|
-
setDisabledValues([]);
|
|
56181
|
-
}
|
|
56340
|
+
const formattedValues = fromRsuiteValue(nextValue, options, childrenKey, valueKey, labelKey);
|
|
56182
56341
|
onChange(formattedValues);
|
|
56183
56342
|
}, [
|
|
56184
56343
|
childrenKey,
|
|
56185
|
-
|
|
56344
|
+
labelKey,
|
|
56186
56345
|
onChange,
|
|
56187
|
-
options
|
|
56346
|
+
options,
|
|
56347
|
+
valueKey
|
|
56188
56348
|
]);
|
|
56189
|
-
|
|
56349
|
+
const removeOptions = (valuesToRemove, e)=>{
|
|
56350
|
+
e.stopPropagation();
|
|
56351
|
+
const valueToUpdate = rsuiteValue?.filter((rvalue)=>!valuesToRemove.includes(rvalue));
|
|
56352
|
+
handleChange(valueToUpdate ?? []);
|
|
56353
|
+
};
|
|
56354
|
+
return /*#__PURE__*/ jsx(CheckTreePickerBox, {
|
|
56190
56355
|
boxRef: boxRef,
|
|
56191
56356
|
className: controlledClassName,
|
|
56192
56357
|
disabled: disabled,
|
|
@@ -56210,6 +56375,7 @@ function CheckTreePicker({ childrenKey = 'children', className, disabled = false
|
|
|
56210
56375
|
disabled: disabled,
|
|
56211
56376
|
disabledItemValues: disabledValues,
|
|
56212
56377
|
id: originalProps.name,
|
|
56378
|
+
labelKey: labelKey,
|
|
56213
56379
|
onChange: handleChange,
|
|
56214
56380
|
readOnly: readOnly,
|
|
56215
56381
|
renderTreeIcon: ({ expand })=>/*#__PURE__*/ jsx(IconButton, {
|
|
@@ -56221,45 +56387,84 @@ function CheckTreePicker({ childrenKey = 'children', className, disabled = false
|
|
|
56221
56387
|
}
|
|
56222
56388
|
}),
|
|
56223
56389
|
renderValue: ()=>{
|
|
56224
|
-
const
|
|
56225
|
-
const
|
|
56226
|
-
|
|
56227
|
-
|
|
56228
|
-
|
|
56229
|
-
|
|
56230
|
-
|
|
56231
|
-
|
|
56232
|
-
|
|
56233
|
-
|
|
56234
|
-
|
|
56235
|
-
|
|
56236
|
-
|
|
56237
|
-
|
|
56238
|
-
|
|
56239
|
-
|
|
56240
|
-
|
|
56241
|
-
|
|
56242
|
-
|
|
56243
|
-
|
|
56244
|
-
|
|
56245
|
-
|
|
56246
|
-
|
|
56247
|
-
|
|
56248
|
-
|
|
56249
|
-
|
|
56250
|
-
|
|
56251
|
-
|
|
56252
|
-
|
|
56253
|
-
|
|
56254
|
-
|
|
56255
|
-
|
|
56256
|
-
|
|
56390
|
+
const children = getTreeOptionsBySelectedValues(rsuiteValue, options, childrenKey, valueKey, labelKey).flatMap((treeOption)=>treeOption[childrenKey]);
|
|
56391
|
+
const parents = getTreeOptionsBySelectedValues(rsuiteValue, options, childrenKey, valueKey, labelKey);
|
|
56392
|
+
if (!shouldShowLabels) {
|
|
56393
|
+
return /*#__PURE__*/ jsxs(Fragment, {
|
|
56394
|
+
children: [
|
|
56395
|
+
/*#__PURE__*/ jsxs("span", {
|
|
56396
|
+
className: "rs-picker-value-list",
|
|
56397
|
+
title: renderedValue,
|
|
56398
|
+
children: [
|
|
56399
|
+
renderedValue,
|
|
56400
|
+
" ",
|
|
56401
|
+
/*#__PURE__*/ jsxs(Bold, {
|
|
56402
|
+
children: [
|
|
56403
|
+
"(",
|
|
56404
|
+
parents.length,
|
|
56405
|
+
")"
|
|
56406
|
+
]
|
|
56407
|
+
})
|
|
56408
|
+
]
|
|
56409
|
+
}),
|
|
56410
|
+
children.length > 0 && /*#__PURE__*/ jsxs("span", {
|
|
56411
|
+
className: "rs-picker-value-list",
|
|
56412
|
+
title: renderedChildrenValue,
|
|
56413
|
+
children: [
|
|
56414
|
+
renderedChildrenValue,
|
|
56415
|
+
" ",
|
|
56416
|
+
/*#__PURE__*/ jsxs(Bold, {
|
|
56417
|
+
children: [
|
|
56418
|
+
"(",
|
|
56419
|
+
children.length,
|
|
56420
|
+
")"
|
|
56421
|
+
]
|
|
56422
|
+
})
|
|
56423
|
+
]
|
|
56424
|
+
})
|
|
56425
|
+
]
|
|
56426
|
+
});
|
|
56427
|
+
}
|
|
56428
|
+
const optionsToDisplay = getOptionsToDisplay(options, [
|
|
56429
|
+
...parents,
|
|
56430
|
+
...children
|
|
56431
|
+
], childrenKey, valueKey);
|
|
56432
|
+
return /*#__PURE__*/ jsx(Wrapper, {
|
|
56433
|
+
children: /*#__PURE__*/ jsx(SubWrapper, {
|
|
56434
|
+
children: optionsToDisplay.map((option)=>{
|
|
56435
|
+
const isParent = option[childrenKey] !== undefined && option[childrenKey].length > 0;
|
|
56436
|
+
return /*#__PURE__*/ jsxs(SelectedOptionContainer, {
|
|
56437
|
+
children: [
|
|
56438
|
+
/*#__PURE__*/ jsxs(SelectedOptionLabel, {
|
|
56439
|
+
$isLight: isLight || isTransparent,
|
|
56440
|
+
title: option[labelKey],
|
|
56441
|
+
children: [
|
|
56442
|
+
option[labelKey],
|
|
56443
|
+
isParent && ' (Tout)'
|
|
56444
|
+
]
|
|
56445
|
+
}),
|
|
56446
|
+
/*#__PURE__*/ jsx(StyledButton, {
|
|
56447
|
+
$isLight: isLight || isTransparent,
|
|
56448
|
+
accent: Accent.TERTIARY,
|
|
56449
|
+
Icon: Close,
|
|
56450
|
+
onClick: (e)=>{
|
|
56451
|
+
removeOptions(isParent ? option[childrenKey].flatMap((child)=>child[valueKey]) : [
|
|
56452
|
+
option[valueKey]
|
|
56453
|
+
], e);
|
|
56454
|
+
},
|
|
56455
|
+
size: Size.SMALL,
|
|
56456
|
+
tabIndex: 0,
|
|
56457
|
+
title: `Retirer ${option[labelKey]}`
|
|
56458
|
+
})
|
|
56459
|
+
]
|
|
56460
|
+
}, option[valueKey]);
|
|
56257
56461
|
})
|
|
56258
|
-
|
|
56462
|
+
})
|
|
56259
56463
|
});
|
|
56260
56464
|
},
|
|
56261
56465
|
size: originalProps.size ?? 'sm',
|
|
56262
56466
|
value: rsuiteValue ?? [],
|
|
56467
|
+
valueKey: valueKey,
|
|
56263
56468
|
...originalProps
|
|
56264
56469
|
})
|
|
56265
56470
|
});
|
|
@@ -56268,6 +56473,56 @@ const Bold = styled.span`
|
|
|
56268
56473
|
font-weight: bold;
|
|
56269
56474
|
margin-right: 4px;
|
|
56270
56475
|
`;
|
|
56476
|
+
const StyledButton = styled(Button)`
|
|
56477
|
+
padding: 0 3px;
|
|
56478
|
+
background-color: ${(p)=>p.$isLight ? p.theme.color.gainsboro : p.theme.color.white};
|
|
56479
|
+
|
|
56480
|
+
&:hover,
|
|
56481
|
+
&._hover {
|
|
56482
|
+
background-color: ${(p)=>p.$isLight ? p.theme.color.gainsboro : p.theme.color.white};
|
|
56483
|
+
border: 1px solid ${(p)=>p.$isLight ? p.theme.color.gainsboro : p.theme.color.white};
|
|
56484
|
+
color: ${(p)=>p.theme.color.maximumRed};
|
|
56485
|
+
}
|
|
56486
|
+
|
|
56487
|
+
&:active,
|
|
56488
|
+
&._active {
|
|
56489
|
+
background-color: ${(p)=>p.$isLight ? p.theme.color.gainsboro : p.theme.color.white};
|
|
56490
|
+
border: 1px solid ${(p)=>p.$isLight ? p.theme.color.gainsboro : p.theme.color.white};
|
|
56491
|
+
color: ${(p)=>p.theme.color.maximumRed};
|
|
56492
|
+
}
|
|
56493
|
+
|
|
56494
|
+
> .Element-IconBox {
|
|
56495
|
+
margin-right: 0px;
|
|
56496
|
+
> svg {
|
|
56497
|
+
height: 10px;
|
|
56498
|
+
width: 10px;
|
|
56499
|
+
}
|
|
56500
|
+
}
|
|
56501
|
+
`;
|
|
56502
|
+
const Wrapper = styled.div`
|
|
56503
|
+
display: contents;
|
|
56504
|
+
`;
|
|
56505
|
+
const SubWrapper = styled.div`
|
|
56506
|
+
display: flex;
|
|
56507
|
+
flex-wrap: wrap;
|
|
56508
|
+
gap: 4px;
|
|
56509
|
+
max-width: calc(100% - 6px);
|
|
56510
|
+
`;
|
|
56511
|
+
const SelectedOptionContainer = styled.div`
|
|
56512
|
+
display: flex;
|
|
56513
|
+
gap: 1px;
|
|
56514
|
+
padding-top: 1px;
|
|
56515
|
+
max-width: calc(100% - 6px);
|
|
56516
|
+
`;
|
|
56517
|
+
const SelectedOptionLabel = styled.span`
|
|
56518
|
+
background-color: ${(p)=>p.$isLight ? p.theme.color.gainsboro : p.theme.color.white};
|
|
56519
|
+
font-size: 11px;
|
|
56520
|
+
padding: 2px 8px 1px 8px;
|
|
56521
|
+
overflow: hidden;
|
|
56522
|
+
text-overflow: ellipsis;
|
|
56523
|
+
vertical-align: top;
|
|
56524
|
+
white-space: nowrap;
|
|
56525
|
+
`;
|
|
56271
56526
|
|
|
56272
56527
|
function isNumeric(val) {
|
|
56273
56528
|
// parseFloat NaNs numeric-cast false positives (null|true|false|"")
|
package/package.json
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mtes-mct/monitor-ui",
|
|
3
3
|
"description": "Common React components, hooks, utilities and CSS stylesheets for MonitorFish, MonitorEnv and RapportNav.",
|
|
4
|
-
"version": "24.
|
|
4
|
+
"version": "24.18.0",
|
|
5
5
|
"license": "AGPL-3.0",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"engines": {
|
|
8
8
|
"node": ">=20"
|
|
9
9
|
},
|
|
10
10
|
"dependencies": {
|
|
11
|
-
"@babel/runtime": "7.27.
|
|
11
|
+
"@babel/runtime": "7.27.1",
|
|
12
12
|
"@tanstack/react-table": "8.21.3",
|
|
13
13
|
"@tanstack/react-virtual": "3.13.6",
|
|
14
14
|
"prop-types": "15.8.1",
|