@inseefr/lunatic 2.5.0-fix-last-reached-page → 2.5.1-beta
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/lib/components/commons/components/combo-box/combo-box.js +2 -2
- package/lib/components/commons/components/{default-option-renderer.js → combo-box/panel/combo-box-option.js} +3 -2
- package/lib/components/commons/components/{default-option-renderer.spec.js → combo-box/panel/combo-box-option.spec.js} +5 -5
- package/lib/components/commons/components/combo-box/panel/panel.js +4 -4
- package/lib/components/commons/components/combo-box/selection/LabelOrInput.js +51 -0
- package/lib/components/commons/components/combo-box/selection/LabelOrInput.spec.js +23 -0
- package/lib/components/commons/components/combo-box/selection/__snapshots__/selection.spec.tsx.snap +14 -12
- package/lib/components/commons/components/combo-box/selection/{delete.js → clear-button.js} +6 -3
- package/lib/components/commons/components/combo-box/selection/{delete.spec.js → clear-button.spec.js} +9 -9
- package/lib/components/commons/components/combo-box/selection/combo-box-label-selection.js +47 -0
- package/lib/components/commons/components/{default-label-renderer.spec.js → combo-box/selection/combo-box-label-selection.spec.js} +4 -4
- package/lib/components/commons/components/combo-box/selection/input.js +2 -2
- package/lib/components/commons/components/combo-box/selection/label-selection.js +8 -12
- package/lib/components/commons/components/combo-box/selection/label-selection.spec.js +3 -11
- package/lib/components/commons/components/combo-box/selection/selection.js +5 -11
- package/lib/components/commons/components/combo-box/selection/selection.spec.js +5 -30
- package/lib/components/commons/index.js +1 -12
- package/lib/components/suggester/html/suggester.js +2 -4
- package/lib/src/components/commons/components/combo-box/combo-box.d.ts +3 -3
- package/lib/src/components/commons/components/combo-box/combo-box.stories.d.ts +3 -3
- package/lib/src/components/commons/components/combo-box/combo-box.type.d.ts +1 -1
- package/lib/src/components/commons/components/combo-box/panel/combo-box-option.d.ts +8 -0
- package/lib/src/components/commons/components/combo-box/panel/panel.d.ts +7 -4
- package/lib/src/components/commons/components/combo-box/selection/LabelOrInput.d.ts +16 -0
- package/lib/src/components/commons/components/combo-box/selection/clear-button.d.ts +9 -0
- package/lib/src/components/commons/components/combo-box/selection/combo-box-label-selection.d.ts +10 -0
- package/lib/src/components/commons/components/combo-box/selection/input.d.ts +9 -4
- package/lib/src/components/commons/components/combo-box/selection/label-selection.d.ts +9 -9
- package/lib/src/components/commons/components/combo-box/state-management/actions.d.ts +5 -5
- package/lib/src/components/commons/index.d.ts +0 -3
- package/lib/src/components/dropdown/html/dropdown-simple/simple-label-renderer.d.ts +2 -2
- package/lib/src/components/dropdown/html/dropdown-simple/simple-option-renderer.d.ts +2 -2
- package/lib/src/components/dropdown/html/dropdown-writable/dropdown-writable.d.ts +2 -2
- package/lib/src/components/dropdown/html/dropdown-writable/writable-label-renderer.d.ts +2 -2
- package/lib/src/components/dropdown/html/dropdown-writable/writable-option-renderer.d.ts +2 -2
- package/lib/src/components/loop/block-for-loop/block-for-loop-ochestrator.d.ts +1 -1
- package/lib/src/components/loop/roster-for-loop/roster-for-loop-orchestrator.d.ts +1 -1
- package/lib/src/components/suggester/html/suggester.d.ts +2 -2
- package/lib/src/components/suggester/searching/create-searching.d.ts +2 -2
- package/lib/src/i18n/index.d.ts +2 -2
- package/lib/src/i18n/inputNumberProps.d.ts +1 -1
- package/package.json +1 -1
- package/lib/components/commons/components/combo-box/selection/displayLabelOrInput.js +0 -26
- package/lib/components/commons/components/combo-box/selection/displayLabelOrInput.spec.js +0 -56
- package/lib/components/commons/components/default-label-renderer.js +0 -37
- package/lib/src/components/commons/components/combo-box/selection/delete.d.ts +0 -8
- package/lib/src/components/commons/components/combo-box/selection/displayLabelOrInput.d.ts +0 -5
- package/lib/src/components/commons/components/default-label-renderer.d.ts +0 -8
- package/lib/src/components/commons/components/default-option-renderer.d.ts +0 -7
- /package/lib/src/components/commons/components/combo-box/{selection/delete.spec.d.ts → panel/combo-box-option.spec.d.ts} +0 -0
- /package/lib/src/components/commons/components/combo-box/selection/{displayLabelOrInput.spec.d.ts → LabelOrInput.spec.d.ts} +0 -0
- /package/lib/src/components/commons/components/{default-label-renderer.spec.d.ts → combo-box/selection/clear-button.spec.d.ts} +0 -0
- /package/lib/src/components/commons/components/{default-option-renderer.spec.d.ts → combo-box/selection/combo-box-label-selection.spec.d.ts} +0 -0
|
@@ -10,13 +10,6 @@ Object.defineProperty(exports, "ComboBox", {
|
|
|
10
10
|
return _comboBox["default"];
|
|
11
11
|
}
|
|
12
12
|
});
|
|
13
|
-
Object.defineProperty(exports, "DefaultLabelRenderer", {
|
|
14
|
-
enumerable: true,
|
|
15
|
-
get: function get() {
|
|
16
|
-
return _defaultLabelRenderer["default"];
|
|
17
|
-
}
|
|
18
|
-
});
|
|
19
|
-
exports.DefaultOptionRenderer = void 0;
|
|
20
13
|
Object.defineProperty(exports, "Errors", {
|
|
21
14
|
enumerable: true,
|
|
22
15
|
get: function get() {
|
|
@@ -90,8 +83,6 @@ Object.defineProperty(exports, "useOptionsKeydown", {
|
|
|
90
83
|
return _useOptionsKeydown["default"];
|
|
91
84
|
}
|
|
92
85
|
});
|
|
93
|
-
var _defaultOptionRenderer = _interopRequireDefault(require("./components/default-option-renderer"));
|
|
94
|
-
var _defaultLabelRenderer = _interopRequireDefault(require("./components/default-label-renderer"));
|
|
95
86
|
var _fieldContainer = _interopRequireDefault(require("./components/field-container"));
|
|
96
87
|
var _label = _interopRequireDefault(require("./components/label"));
|
|
97
88
|
var _fieldset = _interopRequireDefault(require("./components/fieldset"));
|
|
@@ -109,6 +100,4 @@ var _safetyLabel = _interopRequireDefault(require("./safety-label"));
|
|
|
109
100
|
var _errors = _interopRequireDefault(require("./components/errors"));
|
|
110
101
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
111
102
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
112
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
113
|
-
var DefaultOptionRenderer = _defaultOptionRenderer["default"]; // We need to export this way to avoid crash on storybook TODO : investigate
|
|
114
|
-
exports.DefaultOptionRenderer = DefaultOptionRenderer;
|
|
103
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
@@ -30,10 +30,8 @@ function Suggester(_ref) {
|
|
|
30
30
|
placeholder = _ref$placeholder === void 0 ? _i18n["default"].PLACEHOLDER : _ref$placeholder,
|
|
31
31
|
_ref$onSelect = _ref.onSelect,
|
|
32
32
|
onSelect = _ref$onSelect === void 0 ? _function.voidFunction : _ref$onSelect,
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
_ref$optionRenderer = _ref.optionRenderer,
|
|
36
|
-
optionRenderer = _ref$optionRenderer === void 0 ? _commons.DefaultOptionRenderer : _ref$optionRenderer,
|
|
33
|
+
labelRenderer = _ref.labelRenderer,
|
|
34
|
+
optionRenderer = _ref.optionRenderer,
|
|
37
35
|
value = _ref.value,
|
|
38
36
|
disabled = _ref.disabled,
|
|
39
37
|
id = _ref.id,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
2
|
import './combo-box.scss';
|
|
3
|
-
import {
|
|
3
|
+
import { ComboBoxOptionType } from './combo-box.type';
|
|
4
4
|
import { SelectionProps } from './selection/selection';
|
|
5
5
|
import { PanelProps } from './panel/panel';
|
|
6
6
|
import { LunaticBaseProps } from '../../../type';
|
|
@@ -9,13 +9,13 @@ type Props = SelectionProps & PanelProps & {
|
|
|
9
9
|
classStyle?: string;
|
|
10
10
|
value: string | null;
|
|
11
11
|
messageError?: string;
|
|
12
|
-
getOptionValue?: (o:
|
|
12
|
+
getOptionValue?: (o: ComboBoxOptionType) => string;
|
|
13
13
|
label?: ReactNode;
|
|
14
14
|
description?: ReactNode;
|
|
15
15
|
errors?: LunaticBaseProps['errors'];
|
|
16
16
|
onChange?: (s: string | null) => void;
|
|
17
17
|
onSelect: (s: string | null) => void;
|
|
18
|
-
options:
|
|
18
|
+
options: ComboBoxOptionType[];
|
|
19
19
|
};
|
|
20
20
|
declare const _default: import("react").ComponentType<Props>;
|
|
21
21
|
export default _default;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { Meta, Story } from '@storybook/react';
|
|
3
|
-
import {
|
|
3
|
+
import { ComboBoxOptionType } from './combo-box.type';
|
|
4
4
|
declare const stories: Meta;
|
|
5
5
|
export default stories;
|
|
6
6
|
export declare const Default: Story<{
|
|
@@ -15,7 +15,7 @@ export declare const Default: Story<{
|
|
|
15
15
|
classStyle?: string | undefined;
|
|
16
16
|
value: string | null;
|
|
17
17
|
messageError?: string | undefined;
|
|
18
|
-
getOptionValue?: ((o:
|
|
18
|
+
getOptionValue?: ((o: ComboBoxOptionType) => string) | undefined;
|
|
19
19
|
label?: import("react").ReactNode;
|
|
20
20
|
description?: import("react").ReactNode;
|
|
21
21
|
errors?: {
|
|
@@ -23,5 +23,5 @@ export declare const Default: Story<{
|
|
|
23
23
|
} | undefined;
|
|
24
24
|
onChange?: ((s: string | null) => void) | undefined;
|
|
25
25
|
onSelect: (s: string | null) => void;
|
|
26
|
-
options:
|
|
26
|
+
options: ComboBoxOptionType[];
|
|
27
27
|
}>;
|
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
import { FunctionComponent } from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { ComboBoxOptionType } from '../combo-box.type';
|
|
3
3
|
export type PanelProps = {
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
/**
|
|
5
|
+
* @deprecated use createCustomizableField with ComboboxOptionRenderer as name.
|
|
6
|
+
*/
|
|
7
|
+
optionRenderer?: FunctionComponent<{
|
|
8
|
+
option: ComboBoxOptionType;
|
|
6
9
|
selected?: boolean;
|
|
7
10
|
search?: string;
|
|
8
11
|
}>;
|
|
9
|
-
options: Array<
|
|
12
|
+
options: Array<ComboBoxOptionType>;
|
|
10
13
|
focused?: boolean;
|
|
11
14
|
selectedIndex?: number | string | null;
|
|
12
15
|
expanded?: boolean;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { LabelSelectionProps } from './label-selection';
|
|
2
|
+
import { InputProps } from './input';
|
|
3
|
+
type LabelOrInputTypeProps = LabelSelectionProps & InputProps & {
|
|
4
|
+
editable?: boolean;
|
|
5
|
+
expanded?: boolean;
|
|
6
|
+
};
|
|
7
|
+
/**
|
|
8
|
+
* Display the input or the label of the selection based on the state of the Suggester.
|
|
9
|
+
*
|
|
10
|
+
* When the component is not focused, a representation of what is being searched
|
|
11
|
+
* is presented instead of the Input. This is related to what the user searched
|
|
12
|
+
* (i.e. the letters entered), not directly to the option chosen among the suggestions.
|
|
13
|
+
* Using the input directly to represent the selection causes a conflict with that which the user enters in order to search.
|
|
14
|
+
*/
|
|
15
|
+
export declare function LabelOrInput(props: LabelOrInputTypeProps): import("react/jsx-runtime").JSX.Element;
|
|
16
|
+
export {};
|
package/lib/src/components/commons/components/combo-box/selection/combo-box-label-selection.d.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { ComboBoxOptionType } from '../combo-box.type';
|
|
3
|
+
type Props = {
|
|
4
|
+
option?: ComboBoxOptionType | null;
|
|
5
|
+
placeholder?: string;
|
|
6
|
+
search?: string;
|
|
7
|
+
disabled?: boolean;
|
|
8
|
+
};
|
|
9
|
+
declare const _default: import("react").ComponentType<Props>;
|
|
10
|
+
export default _default;
|
|
@@ -1,5 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import React, { HTMLAttributes } from 'react';
|
|
2
|
+
export type InputProps = {
|
|
3
|
+
placeholder?: string;
|
|
4
|
+
disabled?: boolean;
|
|
5
|
+
value?: string;
|
|
6
|
+
labelledBy?: string;
|
|
7
|
+
focused?: boolean;
|
|
8
|
+
} & HTMLAttributes<HTMLInputElement>;
|
|
9
|
+
declare const _default: React.ComponentType<Record<string, unknown>>;
|
|
5
10
|
export default _default;
|
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
import { FunctionComponent } from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { ComboBoxOptionType } from '../combo-box.type';
|
|
3
3
|
export type LabelSelectionProps = {
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
/**
|
|
5
|
+
* @deprecated use createCustomizableField with ComboboxLabelRenderer as name.
|
|
6
|
+
*/
|
|
7
|
+
labelRenderer?: FunctionComponent<{
|
|
8
|
+
option?: ComboBoxOptionType;
|
|
6
9
|
placeholder?: string;
|
|
7
10
|
search?: string;
|
|
11
|
+
disabled?: boolean;
|
|
8
12
|
}>;
|
|
9
13
|
placeholder?: string;
|
|
10
14
|
selectedIndex?: number;
|
|
11
|
-
options: Array<
|
|
15
|
+
options: Array<ComboBoxOptionType>;
|
|
12
16
|
search?: string;
|
|
13
17
|
disabled?: boolean;
|
|
14
18
|
};
|
|
15
19
|
export declare function LabelSelection({ labelRenderer: Renderer, placeholder, selectedIndex, options, search, disabled, }: LabelSelectionProps): import("react/jsx-runtime").JSX.Element;
|
|
16
|
-
|
|
17
|
-
editable?: boolean | undefined;
|
|
18
|
-
expanded?: boolean | undefined;
|
|
19
|
-
}) => import("react/jsx-runtime").JSX.Element | null;
|
|
20
|
-
export default _default;
|
|
20
|
+
export default LabelSelection;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ComboBoxOptionType } from '../combo-box.type';
|
|
2
2
|
export declare enum ComboActionKind {
|
|
3
3
|
ON_CHANGE = "combo-box/on-change",
|
|
4
4
|
ON_SELECT = "combo-box/on-select",
|
|
@@ -39,9 +39,9 @@ export declare const onBlur: () => {
|
|
|
39
39
|
export declare const onInit: ({ ...payload }: ComboAction<ComboActionKind.ON_INIT>['payload']) => {
|
|
40
40
|
readonly type: ComboActionKind.ON_INIT;
|
|
41
41
|
readonly payload: {
|
|
42
|
-
readonly options:
|
|
42
|
+
readonly options: ComboBoxOptionType[];
|
|
43
43
|
readonly value: string | null;
|
|
44
|
-
readonly getOptionValue: (o:
|
|
44
|
+
readonly getOptionValue: (o: ComboBoxOptionType) => string;
|
|
45
45
|
};
|
|
46
46
|
};
|
|
47
47
|
export type ComboAction<T extends ComboActionKind = ComboActionKind> = ({
|
|
@@ -69,9 +69,9 @@ export type ComboAction<T extends ComboActionKind = ComboActionKind> = ({
|
|
|
69
69
|
} | {
|
|
70
70
|
type: ComboActionKind.ON_INIT;
|
|
71
71
|
payload: {
|
|
72
|
-
options:
|
|
72
|
+
options: ComboBoxOptionType[];
|
|
73
73
|
value: string | null;
|
|
74
|
-
getOptionValue: (o:
|
|
74
|
+
getOptionValue: (o: ComboBoxOptionType) => string;
|
|
75
75
|
};
|
|
76
76
|
}) & {
|
|
77
77
|
type: T;
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import { default as DefaultOptionRendererFn } from './components/default-option-renderer';
|
|
2
|
-
export { default as DefaultLabelRenderer } from './components/default-label-renderer';
|
|
3
1
|
export { default as FieldContainer } from './components/field-container';
|
|
4
2
|
export { default as Label } from './components/label';
|
|
5
3
|
export { default as Fieldset } from './components/fieldset';
|
|
@@ -12,6 +10,5 @@ export { default as createRowOrchestrator } from './create-row-orchestrator';
|
|
|
12
10
|
export { default as OrchestratedComponent } from './components/orchestrated-component';
|
|
13
11
|
export { default as ComboBox } from './components/combo-box';
|
|
14
12
|
export * as HtmlTable from './components/html-table';
|
|
15
|
-
export declare const DefaultOptionRenderer: typeof DefaultOptionRendererFn;
|
|
16
13
|
export { default as safetyLabel } from './safety-label';
|
|
17
14
|
export { default as Errors } from './components/errors';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ComboBoxOptionType } from '../../../commons/components/combo-box/combo-box.type';
|
|
2
2
|
type Props = {
|
|
3
|
-
option?:
|
|
3
|
+
option?: ComboBoxOptionType;
|
|
4
4
|
placeholder?: string;
|
|
5
5
|
search?: string;
|
|
6
6
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ComboBoxOptionType } from '../../../commons/components/combo-box/combo-box.type';
|
|
2
2
|
type Props = {
|
|
3
|
-
option:
|
|
3
|
+
option: ComboBoxOptionType;
|
|
4
4
|
selected?: boolean;
|
|
5
5
|
};
|
|
6
6
|
declare function SimpleOptionRenderer({ option, selected }: Props): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { ComboBoxOptionType } from '../../../commons/components/combo-box/combo-box.type';
|
|
3
3
|
import { LunaticError } from '../../../../use-lunatic/type';
|
|
4
4
|
type Props = {
|
|
5
5
|
id?: string;
|
|
6
6
|
disabled?: boolean;
|
|
7
|
-
options:
|
|
7
|
+
options: ComboBoxOptionType[];
|
|
8
8
|
onSelect: (v: string | null) => void;
|
|
9
9
|
className?: string;
|
|
10
10
|
value: string | null;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ComboBoxOptionType } from '../../../commons/components/combo-box/combo-box.type';
|
|
2
2
|
type Props = {
|
|
3
|
-
option?:
|
|
3
|
+
option?: ComboBoxOptionType;
|
|
4
4
|
placeholder?: string;
|
|
5
5
|
search?: string;
|
|
6
6
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ComboBoxOptionType } from '../../../commons/components/combo-box/combo-box.type';
|
|
2
2
|
type Props = {
|
|
3
|
-
option:
|
|
3
|
+
option: ComboBoxOptionType;
|
|
4
4
|
selected?: boolean;
|
|
5
5
|
search?: string;
|
|
6
6
|
};
|
|
@@ -47,5 +47,5 @@ declare const BlockForLoopOrchestrator: ({ id, components, nbRows, valueMap, han
|
|
|
47
47
|
label: import("react").ReactNode;
|
|
48
48
|
}[] | undefined;
|
|
49
49
|
paginatedLoop?: boolean | undefined;
|
|
50
|
-
}, "
|
|
50
|
+
}, "missing" | "shortcut" | "id" | "preferences" | "errors" | "disabled">, "missing" | "shortcut" | "id" | "components" | "iteration" | "executeExpression" | "features" | "preferences" | "errors" | "valueMap">) => import("react/jsx-runtime").JSX.Element | null;
|
|
51
51
|
export default BlockForLoopOrchestrator;
|
|
@@ -47,5 +47,5 @@ declare const RosterForLoopOrchestrator: ({ id, components, nbRows, valueMap, ha
|
|
|
47
47
|
label: import("react").ReactNode;
|
|
48
48
|
}[] | undefined;
|
|
49
49
|
paginatedLoop?: boolean | undefined;
|
|
50
|
-
}, "
|
|
50
|
+
}, "missing" | "shortcut" | "id" | "preferences" | "errors" | "disabled">, "missing" | "shortcut" | "id" | "components" | "iteration" | "executeExpression" | "features" | "preferences" | "errors" | "valueMap">) => import("react/jsx-runtime").JSX.Element | null;
|
|
51
51
|
export default RosterForLoopOrchestrator;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React, { ReactNode } from 'react';
|
|
2
2
|
import './default-style.scss';
|
|
3
3
|
import { LunaticError } from '../../../use-lunatic/type';
|
|
4
|
-
import {
|
|
4
|
+
import { ComboBoxOptionType } from '../../commons/components/combo-box/combo-box.type';
|
|
5
5
|
import { LunaticComponentProps } from '../../type';
|
|
6
6
|
type Props = {
|
|
7
7
|
className?: string;
|
|
@@ -13,7 +13,7 @@ type Props = {
|
|
|
13
13
|
disabled?: boolean;
|
|
14
14
|
id?: string;
|
|
15
15
|
searching?: (s: string | null) => Promise<{
|
|
16
|
-
results:
|
|
16
|
+
results: ComboBoxOptionType[];
|
|
17
17
|
}>;
|
|
18
18
|
label?: ReactNode;
|
|
19
19
|
description?: ReactNode;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ComboBoxOptionType } from '../../commons/components/combo-box/combo-box.type';
|
|
2
2
|
export declare function isWorkerCompatible(): boolean;
|
|
3
3
|
declare function createSearching(name: string, version: string): (search: string | null) => Promise<{
|
|
4
|
-
results:
|
|
4
|
+
results: ComboBoxOptionType[];
|
|
5
5
|
}>;
|
|
6
6
|
export default createSearching;
|
package/lib/src/i18n/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export declare const inputNumberPropsI18N: {
|
|
2
|
-
allDecimalSeparators: ("
|
|
2
|
+
allDecimalSeparators: ("," | ".")[];
|
|
3
3
|
thousandSeparator: string;
|
|
4
4
|
decimalSeparator: string;
|
|
5
5
|
};
|
|
6
|
-
declare const _default: Record<"
|
|
6
|
+
declare const _default: Record<"DEFAULT_BUTTON_ADD" | "DEFAULT_BUTTON_REMOVE" | "MODAL_IGNORE" | "MODAL_CORRECT" | "DK" | "RF" | "PLACEHOLDER", string>;
|
|
7
7
|
export default _default;
|
|
@@ -8,6 +8,6 @@ declare const inputNumberProps: {
|
|
|
8
8
|
readonly en: ".";
|
|
9
9
|
};
|
|
10
10
|
};
|
|
11
|
-
export declare const allDecimalSeparators: ("
|
|
11
|
+
export declare const allDecimalSeparators: ("," | ".")[];
|
|
12
12
|
export type InputNumberPropsI18N = typeof inputNumberProps;
|
|
13
13
|
export default inputNumberProps;
|
package/package.json
CHANGED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.displayLabelOrInput = displayLabelOrInput;
|
|
7
|
-
var _react = require("react");
|
|
8
|
-
var _jsxRuntime = require("react/jsx-runtime");
|
|
9
|
-
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
10
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
11
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
12
|
-
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
13
|
-
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
14
|
-
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
15
|
-
function displayLabelOrInput(Field, name) {
|
|
16
|
-
var Memoized = /*#__PURE__*/(0, _react.memo)(Field);
|
|
17
|
-
return function LabelOrInput(props) {
|
|
18
|
-
var editable = props.editable,
|
|
19
|
-
expanded = props.expanded;
|
|
20
|
-
var displayLabel = !editable || !expanded;
|
|
21
|
-
if (name === 'Input' && !displayLabel || name === 'LabelSelection' && displayLabel) {
|
|
22
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(Memoized, _objectSpread({}, props));
|
|
23
|
-
}
|
|
24
|
-
return null;
|
|
25
|
-
};
|
|
26
|
-
}
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _react = _interopRequireDefault(require("react"));
|
|
4
|
-
var _react2 = require("@testing-library/react");
|
|
5
|
-
var _displayLabelOrInput = require("./displayLabelOrInput");
|
|
6
|
-
var _vitest = require("vitest");
|
|
7
|
-
var _jsxRuntime = require("react/jsx-runtime");
|
|
8
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
9
|
-
(0, _vitest.describe)('displayLabelOrInput', function () {
|
|
10
|
-
var MockComponent = function MockComponent(_ref) {
|
|
11
|
-
var value = _ref.value;
|
|
12
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
13
|
-
children: value
|
|
14
|
-
});
|
|
15
|
-
};
|
|
16
|
-
(0, _vitest.it)('should render Memoized component when name is Input and displayLabel is false', function () {
|
|
17
|
-
var WrappedComponent = (0, _displayLabelOrInput.displayLabelOrInput)(MockComponent, 'Input');
|
|
18
|
-
var _render = (0, _react2.render)( /*#__PURE__*/(0, _jsxRuntime.jsx)(WrappedComponent, {
|
|
19
|
-
editable: true,
|
|
20
|
-
value: "hello",
|
|
21
|
-
expanded: true
|
|
22
|
-
})),
|
|
23
|
-
getByText = _render.getByText;
|
|
24
|
-
(0, _vitest.expect)(getByText('hello')).toBeInTheDocument();
|
|
25
|
-
});
|
|
26
|
-
(0, _vitest.it)('should render nothing when name is Input and displayLabel is true', function () {
|
|
27
|
-
var WrappedComponent = (0, _displayLabelOrInput.displayLabelOrInput)(MockComponent, 'Input');
|
|
28
|
-
var _render2 = (0, _react2.render)( /*#__PURE__*/(0, _jsxRuntime.jsx)(WrappedComponent, {
|
|
29
|
-
editable: false,
|
|
30
|
-
value: "hello",
|
|
31
|
-
expanded: true
|
|
32
|
-
})),
|
|
33
|
-
container = _render2.container;
|
|
34
|
-
(0, _vitest.expect)(container.firstChild).toBeNull();
|
|
35
|
-
});
|
|
36
|
-
(0, _vitest.it)('should render Memoized component when name is LabelSelection and displayLabel is true', function () {
|
|
37
|
-
var WrappedComponent = (0, _displayLabelOrInput.displayLabelOrInput)(MockComponent, 'LabelSelection');
|
|
38
|
-
var _render3 = (0, _react2.render)( /*#__PURE__*/(0, _jsxRuntime.jsx)(WrappedComponent, {
|
|
39
|
-
editable: false,
|
|
40
|
-
value: "hello",
|
|
41
|
-
expanded: true
|
|
42
|
-
})),
|
|
43
|
-
getByText = _render3.getByText;
|
|
44
|
-
(0, _vitest.expect)(getByText('hello')).toBeInTheDocument();
|
|
45
|
-
});
|
|
46
|
-
(0, _vitest.it)('should render nothing when name is LabelSelection and displayLabel is false', function () {
|
|
47
|
-
var WrappedComponent = (0, _displayLabelOrInput.displayLabelOrInput)(MockComponent, 'LabelSelection');
|
|
48
|
-
var _render4 = (0, _react2.render)( /*#__PURE__*/(0, _jsxRuntime.jsx)(WrappedComponent, {
|
|
49
|
-
editable: true,
|
|
50
|
-
value: "hello",
|
|
51
|
-
expanded: true
|
|
52
|
-
})),
|
|
53
|
-
container = _render4.container;
|
|
54
|
-
(0, _vitest.expect)(container.firstChild).toBeNull();
|
|
55
|
-
});
|
|
56
|
-
});
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports["default"] = void 0;
|
|
7
|
-
var _jsxRuntime = require("react/jsx-runtime");
|
|
8
|
-
function getContent(option, search) {
|
|
9
|
-
if (option) {
|
|
10
|
-
var id = option.id,
|
|
11
|
-
value = option.value,
|
|
12
|
-
label = option.label;
|
|
13
|
-
return label ? "".concat(id || value, " - ").concat(label) : id || value;
|
|
14
|
-
}
|
|
15
|
-
if (search && search.trim().length) {
|
|
16
|
-
return search;
|
|
17
|
-
}
|
|
18
|
-
return null;
|
|
19
|
-
}
|
|
20
|
-
function DefaultLabelRenderer(_ref) {
|
|
21
|
-
var option = _ref.option,
|
|
22
|
-
placeholder = _ref.placeholder,
|
|
23
|
-
search = _ref.search;
|
|
24
|
-
var content = getContent(option, search);
|
|
25
|
-
if (content) {
|
|
26
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
27
|
-
className: "selection",
|
|
28
|
-
children: content
|
|
29
|
-
});
|
|
30
|
-
}
|
|
31
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
32
|
-
className: "placeholder",
|
|
33
|
-
children: placeholder
|
|
34
|
-
});
|
|
35
|
-
}
|
|
36
|
-
var _default = DefaultLabelRenderer;
|
|
37
|
-
exports["default"] = _default;
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import { FunctionComponent } from 'react';
|
|
2
|
-
export declare function displayLabelOrInput<T extends Record<string, unknown>>(Field: FunctionComponent<T>, name: string): (props: T & {
|
|
3
|
-
editable?: boolean;
|
|
4
|
-
expanded?: boolean;
|
|
5
|
-
}) => import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { SuggesterOption } from '../../type';
|
|
2
|
-
type Props = {
|
|
3
|
-
option?: SuggesterOption | null;
|
|
4
|
-
placeholder?: string;
|
|
5
|
-
search?: string;
|
|
6
|
-
};
|
|
7
|
-
declare function DefaultLabelRenderer({ option, placeholder, search }: Props): import("react/jsx-runtime").JSX.Element;
|
|
8
|
-
export default DefaultLabelRenderer;
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { SuggesterOption } from '../../type';
|
|
2
|
-
type Props = {
|
|
3
|
-
option: SuggesterOption;
|
|
4
|
-
selected?: boolean;
|
|
5
|
-
};
|
|
6
|
-
declare function DefaultOptionRenderer({ option, selected }: Props): import("react/jsx-runtime").JSX.Element;
|
|
7
|
-
export default DefaultOptionRenderer;
|
|
File without changes
|
|
File without changes
|
|
File without changes
|