@inseefr/lunatic 2.5.0-fast-forward → 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/README.md +26 -26
- 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/duration/duration.js +52 -0
- package/lib/components/duration/duration.scss +17 -0
- package/lib/components/duration/durationInput.js +72 -0
- package/lib/components/duration/durationUtils.js +31 -0
- package/lib/components/duration/formatDuration.js +28 -0
- package/lib/components/duration/formatDuration.spec.js +38 -0
- package/lib/components/duration/getDurationFromValue.js +64 -0
- package/lib/components/duration/index.js +13 -0
- package/lib/components/index.js +7 -0
- package/lib/components/loop/block-for-loop/block-for-loop.js +5 -7
- package/lib/components/modal-controls/modal-controls.js +3 -5
- package/lib/components/suggester/html/suggester.js +2 -4
- package/lib/components/table/table-orchestrator.js +0 -1
- 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/duration/duration.d.ts +4 -0
- package/lib/src/components/duration/durationInput.d.ts +7 -0
- package/lib/src/components/duration/durationUtils.d.ts +30 -0
- package/lib/src/components/duration/formatDuration.d.ts +2 -0
- package/lib/src/components/duration/formatDuration.spec.d.ts +1 -0
- package/lib/src/components/duration/getDurationFromValue.d.ts +8 -0
- package/lib/src/components/duration/index.d.ts +1 -0
- package/lib/src/components/index.d.ts +1 -0
- package/lib/src/components/loop/block-for-loop/block-for-loop-ochestrator.d.ts +1 -1
- package/lib/src/components/loop/block-for-loop/block-for-loop.d.ts +3 -3
- package/lib/src/components/loop/roster-for-loop/roster-for-loop-orchestrator.d.ts +1 -1
- package/lib/src/components/modal-controls/modal-controls.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/components/table/table-orchestrator.d.ts +1 -1
- package/lib/src/components/type.d.ts +7 -0
- package/lib/src/i18n/index.d.ts +2 -2
- package/lib/src/i18n/inputNumberProps.d.ts +1 -1
- package/lib/src/use-lunatic/actions.d.ts +2 -2
- package/lib/src/use-lunatic/commons/index.d.ts +6 -7
- package/lib/src/use-lunatic/reducer/reduce-on-init.spec.d.ts +1 -0
- package/lib/src/use-lunatic/use-lunatic.d.ts +12 -0
- package/lib/src/utils/object.d.ts +1 -0
- package/lib/{components/commons/components/combo-box/selection/displayLabelOrInput.js → stories/duration/duration.stories.js} +29 -14
- package/lib/stories/duration/source.json +32 -0
- package/lib/stories/duration/source1.json +32 -0
- package/lib/use-lunatic/commons/execute-expression/create-refresh-calculated.spec.js +2 -0
- package/lib/use-lunatic/commons/index.js +6 -13
- package/lib/use-lunatic/reducer/reduce-on-init.js +3 -3
- package/lib/use-lunatic/reducer/reduce-on-init.spec.js +17 -0
- package/lib/use-lunatic/use-lunatic.js +1 -2
- package/lib/utils/object.js +6 -0
- package/package.json +1 -1
- 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/utils/store-tools/auto-load.d.ts +0 -6
- package/lib/use-lunatic/commons/load-suggesters.js +0 -158
- package/lib/utils/store-tools/auto-load.js +0 -162
- /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
|
@@ -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
|
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Formats } from './durationUtils';
|
|
2
|
+
declare const DurationInput: ({ value, format, onChange, }: {
|
|
3
|
+
value: string | null;
|
|
4
|
+
format: Formats;
|
|
5
|
+
onChange: (s: string | null) => void;
|
|
6
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
export default DurationInput;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
export type DurationValue = {
|
|
2
|
+
hours?: number | null;
|
|
3
|
+
minutes?: number | null;
|
|
4
|
+
years?: number | null;
|
|
5
|
+
months?: number | null;
|
|
6
|
+
};
|
|
7
|
+
export type Formats = 'PTnHnM' | 'PnYnM';
|
|
8
|
+
export declare const propsByUnit: {
|
|
9
|
+
hours: {
|
|
10
|
+
min: string;
|
|
11
|
+
max: string;
|
|
12
|
+
};
|
|
13
|
+
minutes: {
|
|
14
|
+
min: string;
|
|
15
|
+
max: string;
|
|
16
|
+
};
|
|
17
|
+
months: {
|
|
18
|
+
min: string;
|
|
19
|
+
max: string;
|
|
20
|
+
};
|
|
21
|
+
years: {
|
|
22
|
+
min: string;
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
export declare const labelByUnit: {
|
|
26
|
+
hours: string;
|
|
27
|
+
minutes: string;
|
|
28
|
+
months: string;
|
|
29
|
+
years: string;
|
|
30
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Formats, DurationValue } from './durationUtils';
|
|
2
|
+
/**
|
|
3
|
+
* Convert a string into a duration
|
|
4
|
+
*
|
|
5
|
+
* ## Example
|
|
6
|
+
* - "P12Y5M" => {year: 12, month: 5}
|
|
7
|
+
*/
|
|
8
|
+
export declare const getDurationFromValue: (value: string | null, format: Formats) => DurationValue;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from "./duration";
|
|
@@ -22,6 +22,7 @@ export { default as SuggesterLoaderWidget } from './suggester-loader-widget';
|
|
|
22
22
|
export { default as Roundabout } from './roundabout';
|
|
23
23
|
export { default as Table } from './table';
|
|
24
24
|
export { default as ComponentSet } from './component-set';
|
|
25
|
+
export { default as Duration } from "./duration";
|
|
25
26
|
export { Summary } from './summary';
|
|
26
27
|
export { default as QuestionInformation } from './questions/question-information';
|
|
27
28
|
export { default as QuestionContext } from './questions/question-context';
|
|
@@ -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;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
declare const _default:
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
declare const _default: import("react").ComponentType<import("../../type").LunaticBaseProps<unknown> & {
|
|
3
3
|
lines: {
|
|
4
4
|
min: number;
|
|
5
5
|
max: number;
|
|
@@ -14,7 +14,7 @@ declare const _default: React.ComponentType<import("../../type").LunaticBaseProp
|
|
|
14
14
|
} | undefined) => T;
|
|
15
15
|
value: Record<string, unknown[]>;
|
|
16
16
|
headers?: {
|
|
17
|
-
label:
|
|
17
|
+
label: import("react").ReactNode;
|
|
18
18
|
}[] | undefined;
|
|
19
19
|
paginatedLoop?: boolean | undefined;
|
|
20
20
|
}>;
|
|
@@ -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;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { LunaticComponentProps } from '../type';
|
|
2
|
-
type Props =
|
|
2
|
+
type Props = Pick<LunaticComponentProps<'Table'>, 'body' | 'id' | 'executeExpression' | 'value' | 'handleChange' | 'iteration'>;
|
|
3
3
|
declare function TableOrchestrator({ body, id, executeExpression, value: valueMap, handleChange, iteration, }: Props): import("react/jsx-runtime").JSX.Element | null;
|
|
4
4
|
export default TableOrchestrator;
|
|
@@ -2,6 +2,7 @@ import { LunaticComponentDefinition, LunaticError, LunaticExpression, LunaticSta
|
|
|
2
2
|
import { CSSProperties, FunctionComponent, ReactNode } from 'react';
|
|
3
3
|
import { SuggesterStatus } from '../use-lunatic/use-suggesters';
|
|
4
4
|
import useLunatic from '../use-lunatic';
|
|
5
|
+
type Formats = 'PTnHnM' | 'PnYnM';
|
|
5
6
|
export type VtlExpression = {
|
|
6
7
|
value: string;
|
|
7
8
|
type: 'VTL' | 'VTL|MD';
|
|
@@ -64,6 +65,12 @@ type ComponentPropsByType = {
|
|
|
64
65
|
name: string;
|
|
65
66
|
};
|
|
66
67
|
};
|
|
68
|
+
Duration: LunaticBaseProps<string | null> & {
|
|
69
|
+
format: Formats;
|
|
70
|
+
response: {
|
|
71
|
+
name: string;
|
|
72
|
+
};
|
|
73
|
+
};
|
|
67
74
|
Input: LunaticBaseProps<string> & {
|
|
68
75
|
maxLength?: number;
|
|
69
76
|
value: null | string;
|
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;
|
|
@@ -41,7 +41,7 @@ export type ActionInit = {
|
|
|
41
41
|
data: LunaticData;
|
|
42
42
|
source: LunaticSource;
|
|
43
43
|
initialPage: string;
|
|
44
|
-
lastReachedPage
|
|
44
|
+
lastReachedPage?: string;
|
|
45
45
|
features: LunaticState['features'];
|
|
46
46
|
preferences: LunaticState['preferences'];
|
|
47
47
|
savingType: LunaticState['savingType'];
|
|
@@ -103,7 +103,7 @@ export declare const onInit: (payload: {
|
|
|
103
103
|
data: LunaticData;
|
|
104
104
|
source: LunaticSource;
|
|
105
105
|
initialPage: string;
|
|
106
|
-
lastReachedPage
|
|
106
|
+
lastReachedPage?: string | undefined;
|
|
107
107
|
features: LunaticState['features'];
|
|
108
108
|
preferences: LunaticState['preferences'];
|
|
109
109
|
savingType: LunaticState['savingType'];
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
export { default as checkLoops } from './check-loops';
|
|
2
2
|
export { default as createMapPages } from './create-map-pages';
|
|
3
|
-
export { default as isPaginatedLoop } from './is-paginated-loop';
|
|
4
|
-
export { default as getComponentsFromState } from './get-components-from-state';
|
|
5
|
-
export { default as useComponentsFromState } from './use-components-from-state';
|
|
6
|
-
export { getPageTag, isNewReachedPage, getNewReachedPage } from './page-tag';
|
|
7
|
-
export { default as isFirstLastPage } from './is-First-last-page';
|
|
8
|
-
export { default as createExecuteExpression } from './execute-expression';
|
|
9
3
|
export { default as executeConditionFilter } from './execute-condition-filter';
|
|
4
|
+
export { default as createExecuteExpression } from './execute-expression';
|
|
10
5
|
export { default as fillComponentExpressions } from './fill-components/fill-component-expressions';
|
|
11
|
-
export { default as loadSuggester } from './load-suggesters';
|
|
12
6
|
export { default as getCompatibleVTLExpression } from './get-compatible-vtl-expression';
|
|
7
|
+
export { default as getComponentsFromState } from './get-components-from-state';
|
|
13
8
|
export { default as getErrorsWithoutEmptyValue } from './get-errors-without-empty-value';
|
|
9
|
+
export { default as isFirstLastPage } from './is-First-last-page';
|
|
10
|
+
export { default as isPaginatedLoop } from './is-paginated-loop';
|
|
11
|
+
export { getNewReachedPage, getPageTag, isNewReachedPage } from './page-tag';
|
|
12
|
+
export { default as useComponentsFromState } from './use-components-from-state';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -39,6 +39,12 @@ declare function useLunatic(source: LunaticSource, data: Partial<Record<"EXTERNA
|
|
|
39
39
|
name: string;
|
|
40
40
|
};
|
|
41
41
|
};
|
|
42
|
+
Duration: import("../components/type").LunaticBaseProps<string | null> & {
|
|
43
|
+
format: "PTnHnM" | "PnYnM";
|
|
44
|
+
response: {
|
|
45
|
+
name: string;
|
|
46
|
+
};
|
|
47
|
+
};
|
|
42
48
|
Input: import("../components/type").LunaticBaseProps<string> & {
|
|
43
49
|
maxLength?: number | undefined;
|
|
44
50
|
value: string | null;
|
|
@@ -268,6 +274,12 @@ declare function useLunatic(source: LunaticSource, data: Partial<Record<"EXTERNA
|
|
|
268
274
|
name: string;
|
|
269
275
|
};
|
|
270
276
|
};
|
|
277
|
+
Duration: import("../components/type").LunaticBaseProps<string | null> & {
|
|
278
|
+
format: "PTnHnM" | "PnYnM";
|
|
279
|
+
response: {
|
|
280
|
+
name: string;
|
|
281
|
+
};
|
|
282
|
+
};
|
|
271
283
|
Input: import("../components/type").LunaticBaseProps<string> & {
|
|
272
284
|
maxLength?: number | undefined;
|
|
273
285
|
value: string | null;
|
|
@@ -2,3 +2,4 @@
|
|
|
2
2
|
* Array.map() but for objet
|
|
3
3
|
*/
|
|
4
4
|
export declare function objectMap<T extends Record<string, any>, V extends unknown>(object: T, callback: (k: keyof T, v: T[keyof T]) => [k: keyof T, v: V] | null): Record<keyof T, V>;
|
|
5
|
+
export declare function objectKeys<T extends Record<string, unknown>>(object: T): (keyof T)[];
|
|
@@ -3,24 +3,39 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.
|
|
7
|
-
var _react = require("react");
|
|
6
|
+
exports["default"] = exports.TimeDuration = exports.DateDuration = void 0;
|
|
7
|
+
var _react = _interopRequireDefault(require("react"));
|
|
8
|
+
var _defaultArgTypes = _interopRequireDefault(require("../utils/default-arg-types"));
|
|
9
|
+
var _orchestrator = _interopRequireDefault(require("../utils/orchestrator"));
|
|
10
|
+
var _source = _interopRequireDefault(require("./source"));
|
|
11
|
+
var _source2 = _interopRequireDefault(require("./source1"));
|
|
8
12
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
13
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
9
14
|
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
15
|
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
16
|
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
17
|
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
18
|
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
14
19
|
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
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
20
|
+
var stories = {
|
|
21
|
+
title: 'Components/Duration',
|
|
22
|
+
component: _orchestrator["default"],
|
|
23
|
+
argTypes: _defaultArgTypes["default"]
|
|
24
|
+
};
|
|
25
|
+
var _default = stories;
|
|
26
|
+
exports["default"] = _default;
|
|
27
|
+
var Template = function Template(args) {
|
|
28
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_orchestrator["default"], _objectSpread({}, args));
|
|
29
|
+
};
|
|
30
|
+
var DateDuration = Template.bind({});
|
|
31
|
+
exports.DateDuration = DateDuration;
|
|
32
|
+
DateDuration.args = {
|
|
33
|
+
id: 'durationAnnéesMois',
|
|
34
|
+
source: _source["default"]
|
|
35
|
+
};
|
|
36
|
+
var TimeDuration = Template.bind({});
|
|
37
|
+
exports.TimeDuration = TimeDuration;
|
|
38
|
+
TimeDuration.args = {
|
|
39
|
+
id: 'durationHeureMinute',
|
|
40
|
+
source: _source2["default"]
|
|
41
|
+
};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
{
|
|
2
|
+
"components": [
|
|
3
|
+
{
|
|
4
|
+
"id": "kxi788",
|
|
5
|
+
"componentType": "Duration",
|
|
6
|
+
"mandatory": false,
|
|
7
|
+
"format": "PnYnM",
|
|
8
|
+
"page": "1",
|
|
9
|
+
"maxPage": "1",
|
|
10
|
+
"label": {
|
|
11
|
+
"value": "\"➡ 1. \" || \"Duration \"",
|
|
12
|
+
"type": "VTL|MD"
|
|
13
|
+
},
|
|
14
|
+
"description": { "value": "\"Description\"", "type": "VTL|MD" },
|
|
15
|
+
"conditionFilter": { "value": "true", "type": "VTL" },
|
|
16
|
+
"response": { "name": "DUREE" }
|
|
17
|
+
}
|
|
18
|
+
],
|
|
19
|
+
"variables": [
|
|
20
|
+
{
|
|
21
|
+
"variableType": "COLLECTED",
|
|
22
|
+
"name": "DUREE",
|
|
23
|
+
"values": {
|
|
24
|
+
"PREVIOUS": null,
|
|
25
|
+
"COLLECTED": null,
|
|
26
|
+
"FORCED": null,
|
|
27
|
+
"EDITED": null,
|
|
28
|
+
"INPUTED": null
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
]
|
|
32
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
{
|
|
2
|
+
"components": [
|
|
3
|
+
{
|
|
4
|
+
"id": "kxi788",
|
|
5
|
+
"componentType": "Duration",
|
|
6
|
+
"mandatory": false,
|
|
7
|
+
"format": "PTnHnM",
|
|
8
|
+
"page": "1",
|
|
9
|
+
"maxPage": "1",
|
|
10
|
+
"label": {
|
|
11
|
+
"value": "\"➡ 1. \" || \"Duration \"",
|
|
12
|
+
"type": "VTL|MD"
|
|
13
|
+
},
|
|
14
|
+
"description": { "value": "\"Description\"", "type": "VTL|MD" },
|
|
15
|
+
"conditionFilter": { "value": "true", "type": "VTL" },
|
|
16
|
+
"response": { "name": "DUREE" }
|
|
17
|
+
}
|
|
18
|
+
],
|
|
19
|
+
"variables": [
|
|
20
|
+
{
|
|
21
|
+
"variableType": "COLLECTED",
|
|
22
|
+
"name": "DUREE",
|
|
23
|
+
"values": {
|
|
24
|
+
"PREVIOUS": null,
|
|
25
|
+
"COLLECTED": "PT12H50M",
|
|
26
|
+
"FORCED": null,
|
|
27
|
+
"EDITED": null,
|
|
28
|
+
"INPUTED": null
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
]
|
|
32
|
+
}
|
|
@@ -69,6 +69,8 @@ var variables = {
|
|
|
69
69
|
var fakeExecute = function fakeExecute(bindings) {
|
|
70
70
|
return function (expression) {
|
|
71
71
|
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
72
|
+
// Assume this code doesn't provide vulnerabilities (only in test)
|
|
73
|
+
// eslint-disable-next-line no-new-func
|
|
72
74
|
return _construct(Function, _toConsumableArray(Object.keys(bindings)).concat(["return ".concat(expression.value)])).apply(void 0, _toConsumableArray(Object.values(bindings).map(function (value) {
|
|
73
75
|
return options.iteration !== undefined && Array.isArray(value) ? value[options.iteration] : value;
|
|
74
76
|
})));
|