@inseefr/lunatic 3.0.0 → 3.0.1-rc.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/lib/components/Sequence/Sequence.d.ts +1 -1
- package/lib/components/Subsequence/Subsequence.d.ts +1 -1
- package/lib/components/Suggester/CustomSuggester.js +1 -1
- package/lib/components/Suggester/CustomSuggester.js.map +1 -1
- package/lib/components/Suggester/SuggesterType.d.ts +0 -1
- package/lib/components/library.d.ts +3 -3
- package/lib/components/shared/HOC/slottableComponent.d.ts +2 -0
- package/lib/components/shared/HOC/slottableComponent.js.map +1 -1
- package/lib/components/shared/MDLabel/MDLabel.d.ts +1 -1
- package/lib/components/shared/MDLabel/MDLabel.js +13 -16
- package/lib/components/shared/MDLabel/MDLabel.js.map +1 -1
- package/lib/components/shared/MDLabel/MarkdownLink.d.ts +8 -0
- package/lib/components/shared/MDLabel/MarkdownLink.js +20 -0
- package/lib/components/shared/MDLabel/MarkdownLink.js.map +1 -0
- package/lib/type.source.d.ts +22 -11
- package/lib/use-lunatic/commons/compile-controls.js +15 -4
- package/lib/use-lunatic/commons/compile-controls.js.map +1 -1
- package/lib/use-lunatic/commons/fill-components/fill-components.d.ts +1 -1
- package/lib/use-lunatic/commons/fill-components/fill-components.js +2 -2
- package/lib/use-lunatic/commons/fill-components/fill-components.js.map +1 -1
- package/lib/use-lunatic/commons/page.js +3 -4
- package/lib/use-lunatic/commons/page.js.map +1 -1
- package/lib/use-lunatic/props/getComponentTypeProps.d.ts +306 -1
- package/lib/use-lunatic/props/getComponentTypeProps.js +1 -1
- package/lib/use-lunatic/props/getComponentTypeProps.js.map +1 -1
- package/lib/use-lunatic/reducer/commons/validate-condition-filter.js +2 -5
- package/lib/use-lunatic/reducer/commons/validate-condition-filter.js.map +1 -1
- package/lib/utils/search/SearchInterface.d.ts +0 -1
- package/package.json +1 -1
- package/lib/components/shared/MDLabel/MDLabelLink.d.ts +0 -8
- package/lib/components/shared/MDLabel/MDLabelLink.js +0 -35
- package/lib/components/shared/MDLabel/MDLabelLink.js.map +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
export declare const Sequence: import("react").ComponentType<Pick<import("../type").LunaticBaseProps<string>, "
|
|
2
|
+
export declare const Sequence: import("react").ComponentType<Pick<import("../type").LunaticBaseProps<string>, "description" | "declarations" | "id" | "label" | "style"> & {
|
|
3
3
|
componentType?: "Sequence" | undefined;
|
|
4
4
|
}>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
export declare const Subsequence: import("react").ComponentType<Pick<import("../type").LunaticBaseProps<string>, "
|
|
2
|
+
export declare const Subsequence: import("react").ComponentType<Pick<import("../type").LunaticBaseProps<string>, "description" | "declarations" | "id" | "label"> & {
|
|
3
3
|
componentType?: "Subsequence" | undefined;
|
|
4
4
|
}>;
|
|
@@ -13,6 +13,6 @@ export const CustomSuggester = slottableComponent('Suggester', ({ className, cla
|
|
|
13
13
|
onSelect(options.find((o) => o.id === id) ?? null);
|
|
14
14
|
}
|
|
15
15
|
};
|
|
16
|
-
return (_jsx(Combobox, { id: id, isLoading: state === 'loading', className: className, classNamePrefix: classNamePrefix, onChange: (v) => onSearch(v ?? ''), disabled: disabled, readOnly: readOnly, options: options, editable: true, onBlur: onBlur, onFocus: onFocus, onSelect: handleSelect, value: value[0]?.id ?? '', search: search, optionRenderer: optionRenderer, labelRenderer: labelRenderer, placeholder: placeholder, label: label, description: description, errors: errors }));
|
|
16
|
+
return (_jsx(Combobox, { id: id, isLoading: state === 'loading', className: className, classNamePrefix: classNamePrefix, onChange: (v) => onSearch(v ?? ''), disabled: disabled, readOnly: readOnly, options: options.map((o) => ({ value: o.id, ...o })), editable: true, onBlur: onBlur, onFocus: onFocus, onSelect: handleSelect, value: value[0]?.id ?? '', search: search, optionRenderer: optionRenderer, labelRenderer: labelRenderer, placeholder: placeholder, label: label, description: description, errors: errors }));
|
|
17
17
|
});
|
|
18
18
|
//# sourceMappingURL=CustomSuggester.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CustomSuggester.js","sourceRoot":"","sources":["../../../src/components/Suggester/CustomSuggester.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAkB,MAAM,OAAO,CAAC;AACvC,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAGpD,OAAO,CAAC,MAAM,YAAY,CAAC;AAC3B,OAAO,EAAE,kBAAkB,EAAE,MAAM,kCAAkC,CAAC;AACtE,OAAO,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AA0BvD,MAAM,CAAC,MAAM,eAAe,GAAG,kBAAkB,CAChD,WAAW,EACX,CAAC,EACA,SAAS,EACT,eAAe,GAAG,SAAS,EAC3B,WAAW,GAAG,CAAC,CAAC,WAAW,EAC3B,QAAQ,GAAG,YAAY,EACvB,aAAa,EACb,cAAc,EACd,KAAK,EACL,QAAQ,EACR,QAAQ,EACR,EAAE,EACF,MAAM,EACN,KAAK,EACL,WAAW,EACX,MAAM,EACN,OAAO,EACP,QAAQ,EACR,MAAM,EACN,OAAO,EACP,KAAK,EACL,OAAO,GACP,EAAE,EAAE;IACJ,MAAM,YAAY,GAAG,CAAC,EAAiB,EAAE,EAAE;QAC1C,IAAI,EAAE,KAAK,IAAI,EAAE,CAAC;YACjB,OAAO,EAAE,CAAC;QACX,CAAC;aAAM,CAAC;YACP,QAAQ,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,IAAI,IAAI,CAAC,CAAC;QACpD,CAAC;IACF,CAAC,CAAC;IAEF,OAAO,CACN,KAAC,QAAQ,IACR,EAAE,EAAE,EAAE,EACN,SAAS,EAAE,KAAK,KAAK,SAAS,EAC9B,SAAS,EAAE,SAAS,EACpB,eAAe,EAAE,eAAe,EAChC,QAAQ,EAAE,CAAC,CAAC,E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S,EACpB,eAAe,EAAE,eAAe,EAChC,QAAQ,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,QAAQ,CAAC,CAAC,IAAI,EAAE,CAAC,EAClC,QAAQ,EAAE,QAAQ,EAClB,QAAQ,EAAE,QAAQ,EAClB,OAAO,EAAE,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC,EAAE,EAAE,GAAG,CAAC,EAAE,CAAC,CAAC,EACpD,QAAQ,EAAE,IAAI,EACd,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,OAAO,EAChB,QAAQ,EAAE,YAAY,EACtB,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE,IAAI,EAAE,EACzB,MAAM,EAAE,MAAM,EACd,cAAc,EAAE,cAAc,EAC9B,aAAa,EAAE,aAAa,EAC5B,WAAW,EAAE,WAAW,EACxB,KAAK,EAAE,KAAK,EACZ,WAAW,EAAE,WAAW,EACxB,MAAM,EAAE,MAAM,GACb,CACF,CAAC;AACH,CAAC,CACD,CAAC"}
|
|
@@ -16,10 +16,10 @@ import { CheckboxOne } from './CheckboxOne/CheckboxOne';
|
|
|
16
16
|
import { Suggester } from './Suggester/Suggester';
|
|
17
17
|
import { Summary } from './Summary/Summary';
|
|
18
18
|
export declare const library: {
|
|
19
|
-
Sequence: ComponentType<Pick<import("./type").LunaticBaseProps<string>, "
|
|
19
|
+
Sequence: ComponentType<Pick<import("./type").LunaticBaseProps<string>, "description" | "declarations" | "id" | "label" | "style"> & {
|
|
20
20
|
componentType?: "Sequence" | undefined;
|
|
21
21
|
}>;
|
|
22
|
-
Subsequence: ComponentType<Pick<import("./type").LunaticBaseProps<string>, "
|
|
22
|
+
Subsequence: ComponentType<Pick<import("./type").LunaticBaseProps<string>, "description" | "declarations" | "id" | "label"> & {
|
|
23
23
|
componentType?: "Subsequence" | undefined;
|
|
24
24
|
}>;
|
|
25
25
|
RosterForLoop: (props: import("./type").LunaticBaseProps<unknown> & {
|
|
@@ -76,7 +76,7 @@ export declare const library: {
|
|
|
76
76
|
} | undefined;
|
|
77
77
|
componentType?: "Switch" | undefined;
|
|
78
78
|
}>;
|
|
79
|
-
Question: ({ components, ...props }: Pick<import("./type").LunaticBaseProps<unknown>, "
|
|
79
|
+
Question: ({ components, ...props }: Pick<import("./type").LunaticBaseProps<unknown>, "description" | "declarations" | "id" | "label" | "errors" | "disabled" | "readOnly"> & {
|
|
80
80
|
components: LunaticComponentProps<keyof import("./type").ComponentPropsByType>[];
|
|
81
81
|
componentType?: "Question" | undefined;
|
|
82
82
|
}) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -37,6 +37,7 @@ import type { CustomCheckboxGroup } from '../../CheckboxGroup/CustomCheckboxGrou
|
|
|
37
37
|
import type { RouterLink } from '../MDLabel/RouterLink';
|
|
38
38
|
import type { SummaryResponses, SummaryTitle } from '../../Summary/Summary';
|
|
39
39
|
import type { LunaticComponentProps } from '../../type';
|
|
40
|
+
import type { MarkdownLink } from '../MDLabel/MarkdownLink';
|
|
40
41
|
/**
|
|
41
42
|
* Contains the type of every customizable component
|
|
42
43
|
*/
|
|
@@ -93,6 +94,7 @@ export type LunaticSlotComponents = {
|
|
|
93
94
|
ComponentWrapper: ComponentType<PropsWithChildren<LunaticComponentProps & {
|
|
94
95
|
index: number;
|
|
95
96
|
}>>;
|
|
97
|
+
MarkdownLink: typeof MarkdownLink;
|
|
96
98
|
};
|
|
97
99
|
export declare const SlotsProvider: ({ slots, children, }: PropsWithChildren<{
|
|
98
100
|
slots?: Partial<LunaticSlotComponents>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"slottableComponent.js","sourceRoot":"","sources":["../../../../src/components/shared/HOC/slottableComponent.tsx"],"names":[],"mappings":";AAAA,OAAO,EAEN,aAAa,EAGb,UAAU,GACV,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"slottableComponent.js","sourceRoot":"","sources":["../../../../src/components/shared/HOC/slottableComponent.tsx"],"names":[],"mappings":";AAAA,OAAO,EAEN,aAAa,EAGb,UAAU,GACV,MAAM,OAAO,CAAC;AAuHf,MAAM,KAAK,GAAG,EAAgD,CAAC;AAE/D,MAAM,YAAY,GAAG,aAAa,CAAC,KAAK,CAAC,CAAC;AAE1C,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,EAC7B,KAAK,EACL,QAAQ,GACuD,EAAE,EAAE;IACnE,IAAI,CAAC,KAAK,EAAE,CAAC;QACZ,OAAO,4BAAG,QAAQ,GAAI,CAAC;IACxB,CAAC;IACD,OAAO,CACN,KAAC,YAAY,CAAC,QAAQ,IAAC,KAAK,EAAE,KAAK,IAAI,KAAK,YAC1C,QAAQ,GACc,CACxB,CAAC;AACH,CAAC,CAAC;AAEF;;;;GAIG;AACH,MAAM,UAAU,kBAAkB,CACjC,IAAiC,EACjC,iBAAuC;IAEvC,MAAM,kBAAkB,GAAG,CAAC,KAAQ,EAAE,EAAE;QACvC,MAAM,MAAM,GAAG,UAAU,CAAC,YAAY,CAAC,IAAI,KAAK,CAAC;QAEjD,IAAI,MAAM,IAAI,IAAI,IAAI,MAAM,EAAE,CAAC;YAC9B,MAAM,aAAa,GAAG,MAAM,CAAC,IAAI,CAAqB,CAAC;YACvD,OAAO,KAAC,aAAa,OAAK,KAAK,GAAI,CAAC;QACrC,CAAC;QAED,OAAO,KAAC,iBAAiB,OAAK,KAAK,GAAI,CAAC;IACzC,CAAC,CAAC;IACF,kBAAkB,CAAC,WAAW,GAAG,IAAI,CAAC;IACtC,OAAO,kBAAkB,CAAC;AAC3B,CAAC"}
|
|
@@ -1,23 +1,20 @@
|
|
|
1
|
-
import { jsx as _jsx
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Fragment } from 'react';
|
|
3
|
+
import Markdown, {} from 'react-markdown';
|
|
4
|
+
import { MarkdownLink } from './MarkdownLink';
|
|
4
5
|
import remarkBreaks from 'remark-breaks';
|
|
5
6
|
import emoji from 'remark-emoji';
|
|
6
|
-
export
|
|
7
|
-
|
|
8
|
-
};
|
|
9
|
-
const renderComponentsFor = (expression) => {
|
|
7
|
+
export function MDLabel({ expression }) {
|
|
8
|
+
const hasParagraphs = /\n\n/.test(expression);
|
|
10
9
|
const components = {
|
|
11
|
-
p:
|
|
10
|
+
p: hasParagraphs ? 'p' : Fragment,
|
|
12
11
|
br: 'br',
|
|
13
|
-
a:
|
|
12
|
+
a: MarkdownA,
|
|
14
13
|
};
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
}
|
|
21
|
-
return components;
|
|
14
|
+
return (_jsx(Markdown, { components: components, remarkPlugins: [[emoji, { accessible: true }], remarkBreaks], children: expression }));
|
|
15
|
+
}
|
|
16
|
+
const MarkdownA = ({ title, href, children, }) => {
|
|
17
|
+
const tooltip = title ? _jsx(MDLabel, { expression: title }) : null;
|
|
18
|
+
return (_jsx(MarkdownLink, { href: href, tooltip: tooltip, children: children }));
|
|
22
19
|
};
|
|
23
20
|
//# sourceMappingURL=MDLabel.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MDLabel.js","sourceRoot":"","sources":["../../../../src/components/shared/MDLabel/MDLabel.tsx"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"MDLabel.js","sourceRoot":"","sources":["../../../../src/components/shared/MDLabel/MDLabel.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAA0B,MAAM,OAAO,CAAC;AACzD,OAAO,QAAQ,EAAE,EAAmB,MAAM,gBAAgB,CAAC;AAC3D,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,YAAY,MAAM,eAAe,CAAC;AACzC,OAAO,KAAK,MAAM,cAAc,CAAC;AAIjC,MAAM,UAAU,OAAO,CAAC,EAAE,UAAU,EAAS;IAC5C,MAAM,aAAa,GAAG,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;IAC9C,MAAM,UAAU,GAAG;QAClB,CAAC,EAAE,aAAa,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,QAAQ;QACjC,EAAE,EAAE,IAAI;QACR,CAAC,EAAE,SAAS;KACW,CAAC;IACzB,OAAO,CACN,KAAC,QAAQ,IACR,UAAU,EAAE,UAAU,EACtB,aAAa,EAAE,CAAC,CAAC,KAAK,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,CAAC,EAAE,YAAY,CAAC,YAE3D,UAAU,GACD,CACX,CAAC;AACH,CAAC;AACD,MAAM,SAAS,GAAG,CAAC,EAClB,KAAK,EACL,IAAI,EACJ,QAAQ,GAC6C,EAAE,EAAE;IACzD,MAAM,OAAO,GAAG,KAAK,CAAC,CAAC,CAAC,KAAC,OAAO,IAAC,UAAU,EAAE,KAAK,GAAI,CAAC,CAAC,CAAC,IAAI,CAAC;IAC9D,OAAO,CACN,KAAC,YAAY,IAAC,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,YACxC,QAAQ,GACK,CACf,CAAC;AACH,CAAC,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { type PropsWithChildren, type ReactNode } from 'react';
|
|
2
|
+
type Props = PropsWithChildren<{
|
|
3
|
+
href: string;
|
|
4
|
+
tooltip?: ReactNode;
|
|
5
|
+
}>;
|
|
6
|
+
export declare const MarkdownLink: import("react").ComponentType<Props>;
|
|
7
|
+
export declare function generateUniqueId(): string;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useState } from 'react';
|
|
3
|
+
import { Tooltip } from 'react-tooltip';
|
|
4
|
+
import { RouterLink } from './RouterLink';
|
|
5
|
+
import { slottableComponent } from '../HOC/slottableComponent';
|
|
6
|
+
export const MarkdownLink = slottableComponent('MarkdownLink', ({ href, children, tooltip }) => {
|
|
7
|
+
// Must be replace by useId when queen move to React 18.
|
|
8
|
+
const [id] = useState(() => generateUniqueId());
|
|
9
|
+
const extraProps = tooltip
|
|
10
|
+
? { 'data-tooltip-id': `tooltip-${id}`, className: 'link-md' }
|
|
11
|
+
: {};
|
|
12
|
+
const isAbsoluteLink = href.trim().startsWith('/');
|
|
13
|
+
return (_jsxs(_Fragment, { children: [isAbsoluteLink ? (_jsx(RouterLink, { to: href, id: id, ...extraProps, children: children })) : (_jsx("a", { href: href, target: "_blank", rel: "noopener noreferrer", id: id, ...extraProps, children: children })), tooltip && (_jsx(Tooltip, { className: "tooltip-content", id: `tooltip-${id}`, children: tooltip }))] }));
|
|
14
|
+
});
|
|
15
|
+
export function generateUniqueId() {
|
|
16
|
+
const timestamp = Date.now().toString(36);
|
|
17
|
+
const randomPart = Math.random().toString(36).substring(2, 8);
|
|
18
|
+
return `${timestamp}-${randomPart}`;
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=MarkdownLink.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MarkdownLink.js","sourceRoot":"","sources":["../../../../src/components/shared/MDLabel/MarkdownLink.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAA0C,MAAM,OAAO,CAAC;AACzE,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AACxC,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAI/D,MAAM,CAAC,MAAM,YAAY,GAAG,kBAAkB,CAC7C,cAAc,EACd,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,EAAE,EAAE;IAC/B,wDAAwD;IACxD,MAAM,CAAC,EAAE,CAAC,GAAG,QAAQ,CAAC,GAAG,EAAE,CAAC,gBAAgB,EAAE,CAAC,CAAC;IAEhD,MAAM,UAAU,GAAG,OAAO;QACzB,CAAC,CAAC,EAAE,iBAAiB,EAAE,WAAW,EAAE,EAAE,EAAE,SAAS,EAAE,SAAS,EAAE;QAC9D,CAAC,CAAC,EAAE,CAAC;IACN,MAAM,cAAc,GAAG,IAAI,CAAC,IAAI,EAAE,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC;IAEnD,OAAO,CACN,8BACE,cAAc,CAAC,CAAC,CAAC,CACjB,KAAC,UAAU,IAAC,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE,EAAE,KAAM,UAAU,YAC1C,QAAQ,GACG,CACb,CAAC,CAAC,CAAC,CACH,YACC,IAAI,EAAE,IAAI,EACV,MAAM,EAAC,QAAQ,EACf,GAAG,EAAC,qBAAqB,EACzB,EAAE,EAAE,EAAE,KACF,UAAU,YAEb,QAAQ,GACN,CACJ,EACA,OAAO,IAAI,CACX,KAAC,OAAO,IAAC,SAAS,EAAC,iBAAiB,EAAC,EAAE,EAAE,WAAW,EAAE,EAAE,YACtD,OAAO,GACC,CACV,IACC,CACH,CAAC;AACH,CAAC,CACD,CAAC;AAEF,MAAM,UAAU,gBAAgB;IAC/B,MAAM,SAAS,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;IAC1C,MAAM,UAAU,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IAC9D,OAAO,GAAG,SAAS,IAAI,UAAU,EAAE,CAAC;AACrC,CAAC"}
|
package/lib/type.source.d.ts
CHANGED
|
@@ -8,7 +8,7 @@ export type ComponentDefinitionWithPage = ComponentDefinition & ({
|
|
|
8
8
|
} | {
|
|
9
9
|
goToPage: string;
|
|
10
10
|
});
|
|
11
|
-
export type ComponentDefinition = ComponentInputDefinition | ComponentSequenceDefinition | ComponentRoundaboutDefinition | ComponentLoopDefinition | ComponentRosterForLoopDefinition | ComponentTableDefinition | ComponentNumberDefinition | ComponentDurationDefinition | ComponentDatePickerDefinition | ComponentCheckboxGroupDefinition | ComponentCheckboxBooleanDefinition | ComponentRadioDefinition | ComponentDropdownDefinition | ComponentQuestionDefinition | ComponentCheckboxOneDefinition | ComponentSuggesterDefinition | ComponentPairWiseLinksDefinition | ComponentSummaryDefinition;
|
|
11
|
+
export type ComponentDefinition = ComponentInputDefinition | ComponentSequenceDefinition | ComponentRoundaboutDefinition | ComponentLoopDefinition | ComponentRosterForLoopDefinition | ComponentTableDefinition | ComponentNumberDefinition | ComponentDurationDefinition | ComponentDatePickerDefinition | ComponentCheckboxGroupDefinition | ComponentCheckboxBooleanDefinition | ComponentRadioDefinition | ComponentDropdownDefinition | ComponentQuestionDefinition | ComponentCheckboxOneDefinition | ComponentSuggesterDefinition | ComponentPairWiseLinksDefinition | ComponentSummaryDefinition | ComponentText;
|
|
12
12
|
export type ComponentInputDefinition = ComponentInputDefinition1 & {
|
|
13
13
|
componentType: 'Input' | 'Textarea';
|
|
14
14
|
maxLength?: number;
|
|
@@ -224,6 +224,13 @@ export type VariableScalarValue = string | number | null;
|
|
|
224
224
|
* A lunatic survey unit
|
|
225
225
|
*/
|
|
226
226
|
export interface LunaticSource {
|
|
227
|
+
label?: VTLExpression;
|
|
228
|
+
pagination?: 'question' | 'sequence';
|
|
229
|
+
enoCoreVersion?: string;
|
|
230
|
+
lunaticModelVersion?: string;
|
|
231
|
+
generatingDate?: string;
|
|
232
|
+
modele?: string;
|
|
233
|
+
id?: string;
|
|
227
234
|
components: ComponentDefinitionWithPage[];
|
|
228
235
|
variables: Variable[];
|
|
229
236
|
suggesters?: SuggesterDefinition[];
|
|
@@ -263,16 +270,6 @@ export interface LunaticSource {
|
|
|
263
270
|
};
|
|
264
271
|
maxPage?: string;
|
|
265
272
|
}
|
|
266
|
-
export interface ComponentDefinitionBase {
|
|
267
|
-
label?: VTLExpression;
|
|
268
|
-
description?: VTLExpression;
|
|
269
|
-
declarations?: Declaration[];
|
|
270
|
-
conditionFilter?: VTLScalarExpression;
|
|
271
|
-
controls?: ControlDefinition[];
|
|
272
|
-
id: string;
|
|
273
|
-
mandatory?: boolean;
|
|
274
|
-
missingResponse?: ResponseDefinition;
|
|
275
|
-
}
|
|
276
273
|
export interface VTLExpression {
|
|
277
274
|
/**
|
|
278
275
|
* Valid VTL Expression
|
|
@@ -284,6 +281,16 @@ export interface VTLExpression {
|
|
|
284
281
|
bindingDependencies?: string[];
|
|
285
282
|
type: 'VTL' | 'VTL|MD' | 'TXT';
|
|
286
283
|
}
|
|
284
|
+
export interface ComponentDefinitionBase {
|
|
285
|
+
label?: VTLExpression;
|
|
286
|
+
description?: VTLExpression;
|
|
287
|
+
declarations?: Declaration[];
|
|
288
|
+
conditionFilter?: VTLScalarExpression;
|
|
289
|
+
controls?: ControlDefinition[];
|
|
290
|
+
id: string;
|
|
291
|
+
mandatory?: boolean;
|
|
292
|
+
missingResponse?: ResponseDefinition;
|
|
293
|
+
}
|
|
287
294
|
export interface Declaration {
|
|
288
295
|
id: string;
|
|
289
296
|
declarationType: 'INSTRUCTION' | 'COMMENT' | 'HELP' | 'CODECARD' | 'WARNING' | 'STATEMENT';
|
|
@@ -314,6 +321,10 @@ export interface ControlDefinition {
|
|
|
314
321
|
export interface ResponseDefinition {
|
|
315
322
|
name: string;
|
|
316
323
|
}
|
|
324
|
+
export interface ComponentText {
|
|
325
|
+
componentType: 'Text';
|
|
326
|
+
label: VTLExpression;
|
|
327
|
+
}
|
|
317
328
|
export interface SuggesterDefinition {
|
|
318
329
|
/**
|
|
319
330
|
* Name of the list (will be used as storeName for suggester)
|
|
@@ -12,6 +12,9 @@ const isLoopComponent = (component) => {
|
|
|
12
12
|
function checkComponents(state, components) {
|
|
13
13
|
let errors = {};
|
|
14
14
|
for (const component of components) {
|
|
15
|
+
if (!('controls' in component) || !('id' in component)) {
|
|
16
|
+
continue;
|
|
17
|
+
}
|
|
15
18
|
const { controls, id } = component;
|
|
16
19
|
// The component has global level controls
|
|
17
20
|
if (Array.isArray(controls)) {
|
|
@@ -76,7 +79,7 @@ function computeIterations(component, executeExpression) {
|
|
|
76
79
|
*/
|
|
77
80
|
function checkComponentInLoop(state, component, errors) {
|
|
78
81
|
// The component has no controls, skip it
|
|
79
|
-
if (!Array.isArray(component.controls)) {
|
|
82
|
+
if ('controls' in component && !Array.isArray(component.controls)) {
|
|
80
83
|
return errors;
|
|
81
84
|
}
|
|
82
85
|
// Execute control for each iteration
|
|
@@ -88,10 +91,15 @@ function checkComponentInLoop(state, component, errors) {
|
|
|
88
91
|
iteration: i,
|
|
89
92
|
nbIterations: iterations,
|
|
90
93
|
};
|
|
94
|
+
// There is no controls on this component
|
|
95
|
+
if (!('controls' in component) || !component.controls) {
|
|
96
|
+
continue;
|
|
97
|
+
}
|
|
91
98
|
// The component is filtered on this iteration, skip it
|
|
92
99
|
if (
|
|
93
100
|
// conditionFilter can be the interpreted expression, or the object representing the expression
|
|
94
|
-
(
|
|
101
|
+
('conditionFilter' in component &&
|
|
102
|
+
component.conditionFilter &&
|
|
95
103
|
typeof component.conditionFilter == 'object' &&
|
|
96
104
|
'value' in component.conditionFilter &&
|
|
97
105
|
!state.executeExpression({ value: component.conditionFilter.value, type: 'VTL' }, iterationPager)) ||
|
|
@@ -127,8 +135,11 @@ export function compileControls(state) {
|
|
|
127
135
|
const components = replaceComponentSequence(getComponentsFromState(state));
|
|
128
136
|
const componentFiltered = components
|
|
129
137
|
.map((component) => fillComponentExpressions(component, state))
|
|
130
|
-
.filter((
|
|
131
|
-
|
|
138
|
+
.filter((component) => {
|
|
139
|
+
if ('conditionFilter' in component) {
|
|
140
|
+
return component.conditionFilter ?? true;
|
|
141
|
+
}
|
|
142
|
+
return true;
|
|
132
143
|
});
|
|
133
144
|
let errors = checkComponents(state, componentFiltered);
|
|
134
145
|
const currentErrors = Object.keys(errors).length > 0 ? errors : undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compile-controls.js","sourceRoot":"","sources":["../../../src/use-lunatic/commons/compile-controls.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAC;AAOzE,OAAO,EACN,wBAAwB,GAExB,MAAM,8CAA8C,CAAC;AACtD,OAAO,EAAE,sBAAsB,EAAE,MAAM,8CAA8C,CAAC;AACtF,OAAO,EAAE,gBAAgB,EAAE,MAAM,wCAAwC,CAAC;AAC1E,OAAO,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AAerE,MAAM,eAAe,GAAG,CACvB,SAA+B,EACS,EAAE;IAC1C,OAAO,CAAC,MAAM,EAAE,eAAe,CAAC,CAAC,QAAQ,CAAC,SAAS,CAAC,aAAa,CAAC,CAAC;AACpE,CAAC,CAAC;AAEF;;GAEG;AACH,SAAS,eAAe,CACvB,KAAuB,EACvB,UAAkC;IAElC,IAAI,MAAM,GAAG,EAAoC,CAAC;IAElD,KAAK,MAAM,SAAS,IAAI,UAAU,EAAE,CAAC;QACpC,MAAM,EAAE,QAAQ,EAAE,EAAE,EAAE,GAAG,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"compile-controls.js","sourceRoot":"","sources":["../../../src/use-lunatic/commons/compile-controls.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAC;AAOzE,OAAO,EACN,wBAAwB,GAExB,MAAM,8CAA8C,CAAC;AACtD,OAAO,EAAE,sBAAsB,EAAE,MAAM,8CAA8C,CAAC;AACtF,OAAO,EAAE,gBAAgB,EAAE,MAAM,wCAAwC,CAAC;AAC1E,OAAO,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AAerE,MAAM,eAAe,GAAG,CACvB,SAA+B,EACS,EAAE;IAC1C,OAAO,CAAC,MAAM,EAAE,eAAe,CAAC,CAAC,QAAQ,CAAC,SAAS,CAAC,aAAa,CAAC,CAAC;AACpE,CAAC,CAAC;AAEF;;GAEG;AACH,SAAS,eAAe,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a,CAAC;KAC3C,CAAC;AACH,CAAC"}
|
|
@@ -13,7 +13,7 @@ type FillComponentArgs = {
|
|
|
13
13
|
variables: LunaticReducerState['variables'];
|
|
14
14
|
};
|
|
15
15
|
/**
|
|
16
|
-
* To make this work with TypeScript we need to call function in succession, we prefer expressiveness here over generalized
|
|
16
|
+
* To make this work with TypeScript we need to call function in succession, we prefer expressiveness here over generalized approach
|
|
17
17
|
*/
|
|
18
18
|
export declare const fillComponent: (component: LunaticComponentDefinition, state: FillComponentArgs) => LunaticComponentProps & {
|
|
19
19
|
conditionFilter?: boolean;
|
|
@@ -4,7 +4,7 @@ import { getMissingResponseProp } from '../../props/propMissingResponse';
|
|
|
4
4
|
import { getValueProp } from '../../props/propValue';
|
|
5
5
|
import { getIterationsProp } from '../../props/propIterations';
|
|
6
6
|
/**
|
|
7
|
-
* To make this work with TypeScript we need to call function in succession, we prefer expressiveness here over generalized
|
|
7
|
+
* To make this work with TypeScript we need to call function in succession, we prefer expressiveness here over generalized approach
|
|
8
8
|
*/
|
|
9
9
|
export const fillComponent = (component, state) => {
|
|
10
10
|
const interpretedProps = fillComponentExpressions(component, state);
|
|
@@ -18,7 +18,7 @@ export const fillComponent = (component, state) => {
|
|
|
18
18
|
goNextPage: state.goNextPage,
|
|
19
19
|
goPreviousPage: state.goPreviousPage,
|
|
20
20
|
iteration: state.pager.iteration,
|
|
21
|
-
required: component.mandatory,
|
|
21
|
+
required: 'mandatory' in component ? component.mandatory : false,
|
|
22
22
|
value: getValueProp(component, state),
|
|
23
23
|
missingResponse: getMissingResponseProp(component, state),
|
|
24
24
|
management: state.management,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fill-components.js","sourceRoot":"","sources":["../../../../src/use-lunatic/commons/fill-components/fill-components.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,wBAAwB,EAAE,MAAM,8BAA8B,CAAC;AACxE,OAAO,EAAE,qBAAqB,EAAE,MAAM,mCAAmC,CAAC;AAE1E,OAAO,EAAE,sBAAsB,EAAE,MAAM,iCAAiC,CAAC;AACzE,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AACrD,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAe/D;;GAEG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,CAC5B,SAAqC,EACrC,KAAwB,EACgC,EAAE;IAC1D,MAAM,gBAAgB,GAAG,wBAAwB,CAAC,SAAS,EAAE,KAAK,CAAC,CAAC;IACpE,OAAO;QACN,GAAG,gBAAgB;QACnB,aAAa,EAAE,KAAK,CAAC,aAAa;QAClC,iBAAiB,EAAE,KAAK,CAAC,iBAAiB;QAC1C,WAAW,EAAE,KAAK,CAAC,WAAW;QAC9B,QAAQ,EAAE,KAAK,CAAC,QAAQ;QACxB,QAAQ,EAAE,KAAK,CAAC,QAAQ;QACxB,UAAU,EAAE,KAAK,CAAC,UAAU;QAC5B,cAAc,EAAE,KAAK,CAAC,cAAc;QACpC,SAAS,EAAE,KAAK,CAAC,KAAK,CAAC,SAAS;QAChC,QAAQ,EAAE,SAAS,CAAC,SAAS;
|
|
1
|
+
{"version":3,"file":"fill-components.js","sourceRoot":"","sources":["../../../../src/use-lunatic/commons/fill-components/fill-components.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,wBAAwB,EAAE,MAAM,8BAA8B,CAAC;AACxE,OAAO,EAAE,qBAAqB,EAAE,MAAM,mCAAmC,CAAC;AAE1E,OAAO,EAAE,sBAAsB,EAAE,MAAM,iCAAiC,CAAC;AACzE,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AACrD,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAe/D;;GAEG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,CAC5B,SAAqC,EACrC,KAAwB,EACgC,EAAE;IAC1D,MAAM,gBAAgB,GAAG,wBAAwB,CAAC,SAAS,EAAE,KAAK,CAAC,CAAC;IACpE,OAAO;QACN,GAAG,gBAAgB;QACnB,aAAa,EAAE,KAAK,CAAC,aAAa;QAClC,iBAAiB,EAAE,KAAK,CAAC,iBAAiB;QAC1C,WAAW,EAAE,KAAK,CAAC,WAAW;QAC9B,QAAQ,EAAE,KAAK,CAAC,QAAQ;QACxB,QAAQ,EAAE,KAAK,CAAC,QAAQ;QACxB,UAAU,EAAE,KAAK,CAAC,UAAU;QAC5B,cAAc,EAAE,KAAK,CAAC,cAAc;QACpC,SAAS,EAAE,KAAK,CAAC,KAAK,CAAC,SAAS;QAChC,QAAQ,EAAE,WAAW,IAAI,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC,CAAC,KAAK;QAChE,KAAK,EAAE,YAAY,CAAC,SAAS,EAAE,KAAK,CAAC;QACrC,eAAe,EAAE,sBAAsB,CAAC,SAAS,EAAE,KAAK,CAAC;QACzD,UAAU,EAAE,KAAK,CAAC,UAAU;QAC5B,UAAU,EAAE,iBAAiB,CAAC,SAAS,EAAE,KAAK,CAAC;QAC/C,GAAG,qBAAqB,CAAC,gBAAgB,EAAE,KAAK,CAAC;QACjD,kEAAkE;KAC3D,CAAC;AACV,CAAC,CAAC;AAEF;;GAEG;AACH,MAAM,UAAU,cAAc,CAC7B,UAAwC,EACxC,KAAwB;IAExB,OAAO,UAAU;SACf,GAAG,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,aAAa,CAAC,SAAS,EAAE,KAAK,CAAC,CAAC;SACnD,MAAM,CAAC,CAAC,EAAE,eAAe,EAAE,EAAE,EAAE,CAAC,eAAe,IAAI,IAAI,CAAC,CAAC;AAC5D,CAAC"}
|
|
@@ -20,10 +20,9 @@ export function isPageEmpty(state, isMovingBackward = false) {
|
|
|
20
20
|
const { executeExpression, pager } = state;
|
|
21
21
|
const { iteration } = pager;
|
|
22
22
|
const components = getComponentsFromState(state);
|
|
23
|
-
const visibleComponents = components.filter(
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
return executeConditionFilter(conditionFilter, executeExpression, iteration);
|
|
23
|
+
const visibleComponents = components.filter((component) => {
|
|
24
|
+
if ('conditionFilter' in component && component.conditionFilter) {
|
|
25
|
+
return executeConditionFilter(component.conditionFilter, executeExpression, iteration);
|
|
27
26
|
}
|
|
28
27
|
return true;
|
|
29
28
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"page.js","sourceRoot":"","sources":["../../../src/use-lunatic/commons/page.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AACrE,OAAO,sBAAsB,MAAM,4BAA4B,CAAC;AAEhE,MAAM,UAAU,SAAS,CAAC,EACzB,OAAO,EACP,IAAI,GACoD;IACxD,IAAI,OAAO,KAAK,SAAS,EAAE,CAAC;QAC3B,OAAO,IAAI,CAAC;IACb,CAAC;IACD,OAAO,GAAG,IAAI,IAAI,OAAO,GAAG,CAAC,EAAE,CAAC;AACjC,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,mBAAmB,CAAC,IAAY;IAC/C,OAAO,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,QAAQ,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC;AACpD,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,WAAW,CAC1B,KAA0B,EAC1B,gBAAgB,GAAG,KAAK;IAExB,MAAM,EAAE,iBAAiB,EAAE,KAAK,EAAE,GAAG,KAAK,CAAC;IAC3C,MAAM,EAAE,SAAS,EAAE,GAAG,KAAK,CAAC;IAC5B,MAAM,UAAU,GAAG,sBAAsB,CAAC,KAAK,CAAC,CAAC;IACjD,MAAM,iBAAiB,GAAG,UAAU,CAAC,MAAM,CAAC,
|
|
1
|
+
{"version":3,"file":"page.js","sourceRoot":"","sources":["../../../src/use-lunatic/commons/page.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;A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import { type DeepTranslateExpression } from '../commons/fill-components/fill-component-expressions';
|
|
3
4
|
import { fillComponent } from '../commons/fill-components/fill-components';
|
|
@@ -5,5 +6,309 @@ type State = Parameters<typeof fillComponent>[1];
|
|
|
5
6
|
/**
|
|
6
7
|
* Get component specific props (RoundAbout for instance)
|
|
7
8
|
*/
|
|
8
|
-
export declare function getComponentTypeProps(component: DeepTranslateExpression<LunaticComponentDefinition>, state: State): {
|
|
9
|
+
export declare function getComponentTypeProps(component: DeepTranslateExpression<LunaticComponentDefinition>, state: State): {
|
|
10
|
+
expressions: {};
|
|
11
|
+
page: number;
|
|
12
|
+
} | {
|
|
13
|
+
components: import("../..").LunaticComponentProps[];
|
|
14
|
+
} | {
|
|
15
|
+
getComponents: (x: number, y: number) => import("../..").LunaticComponentProps[];
|
|
16
|
+
} | {
|
|
17
|
+
body: ((import("../../components/type").LunaticBaseProps<string> & {
|
|
18
|
+
maxLength?: number | undefined;
|
|
19
|
+
value: string | null;
|
|
20
|
+
response: {
|
|
21
|
+
name: string;
|
|
22
|
+
};
|
|
23
|
+
componentType?: "Input" | undefined;
|
|
24
|
+
} & {
|
|
25
|
+
conditionFilter?: boolean | undefined;
|
|
26
|
+
}) | (import("../../components/type").LunaticBaseProps<string> & {
|
|
27
|
+
cols?: number | undefined;
|
|
28
|
+
placeHolder?: string | undefined;
|
|
29
|
+
maxLength?: number | undefined;
|
|
30
|
+
rows?: number | undefined;
|
|
31
|
+
response: {
|
|
32
|
+
name: string;
|
|
33
|
+
};
|
|
34
|
+
componentType?: "Textarea" | undefined;
|
|
35
|
+
} & {
|
|
36
|
+
conditionFilter?: boolean | undefined;
|
|
37
|
+
}) | (Pick<import("../../components/type").LunaticBaseProps<string>, "description" | "declarations" | "id" | "label" | "style"> & {
|
|
38
|
+
componentType?: "Sequence" | undefined;
|
|
39
|
+
} & {
|
|
40
|
+
conditionFilter?: boolean | undefined;
|
|
41
|
+
}) | (Pick<import("../../components/type").LunaticBaseProps<string>, "description" | "declarations" | "id" | "label"> & {
|
|
42
|
+
componentType?: "Subsequence" | undefined;
|
|
43
|
+
} & {
|
|
44
|
+
conditionFilter?: boolean | undefined;
|
|
45
|
+
}) | (import("../../components/type").LunaticBaseProps<string> & {
|
|
46
|
+
iterations: number;
|
|
47
|
+
goToPage: (page: {
|
|
48
|
+
page: number | import("../type").PageTag;
|
|
49
|
+
iteration?: number | undefined;
|
|
50
|
+
nbIterations?: number | undefined;
|
|
51
|
+
subPage?: number | undefined;
|
|
52
|
+
}) => void;
|
|
53
|
+
page: number;
|
|
54
|
+
locked?: boolean | undefined;
|
|
55
|
+
expressions: {
|
|
56
|
+
unnecessary?: boolean[] | undefined;
|
|
57
|
+
complete?: boolean[] | undefined;
|
|
58
|
+
partial?: boolean[] | undefined;
|
|
59
|
+
label?: string[] | undefined;
|
|
60
|
+
};
|
|
61
|
+
componentType?: "Roundabout" | undefined;
|
|
62
|
+
} & {
|
|
63
|
+
conditionFilter?: boolean | undefined;
|
|
64
|
+
}) | (import("../../components/type").LunaticBaseProps<unknown> & {
|
|
65
|
+
lines: {
|
|
66
|
+
min: number;
|
|
67
|
+
max: number;
|
|
68
|
+
};
|
|
69
|
+
iterations: number;
|
|
70
|
+
getComponents: (n: number) => import("../..").LunaticComponentProps<keyof import("../../components/type").ComponentPropsByType>[];
|
|
71
|
+
executeExpression: <T extends unknown = unknown>(expression: import("../../type.source").VTLExpression, args?: {
|
|
72
|
+
iteration?: number | number[] | undefined;
|
|
73
|
+
bindingDependencies?: string[] | undefined;
|
|
74
|
+
deps?: string[] | undefined;
|
|
75
|
+
} | undefined) => T;
|
|
76
|
+
value: Record<string, unknown[]>;
|
|
77
|
+
header?: {
|
|
78
|
+
label: import("react").ReactNode;
|
|
79
|
+
}[] | undefined;
|
|
80
|
+
paginatedLoop?: boolean | undefined;
|
|
81
|
+
componentType?: "Loop" | undefined;
|
|
82
|
+
} & {
|
|
83
|
+
conditionFilter?: boolean | undefined;
|
|
84
|
+
}) | (import("../../components/type").LunaticBaseProps<unknown> & {
|
|
85
|
+
lines: {
|
|
86
|
+
min: number;
|
|
87
|
+
max: number;
|
|
88
|
+
};
|
|
89
|
+
iterations: number;
|
|
90
|
+
getComponents: (n: number) => import("../..").LunaticComponentProps<keyof import("../../components/type").ComponentPropsByType>[];
|
|
91
|
+
executeExpression: <T extends unknown = unknown>(expression: import("../../type.source").VTLExpression, args?: {
|
|
92
|
+
iteration?: number | number[] | undefined;
|
|
93
|
+
bindingDependencies?: string[] | undefined;
|
|
94
|
+
deps?: string[] | undefined;
|
|
95
|
+
} | undefined) => T;
|
|
96
|
+
value: Record<string, unknown[]>;
|
|
97
|
+
header?: {
|
|
98
|
+
label: import("react").ReactNode;
|
|
99
|
+
rowspan?: number | undefined;
|
|
100
|
+
colspan?: number | undefined;
|
|
101
|
+
}[] | undefined;
|
|
102
|
+
paginatedLoop?: boolean | undefined;
|
|
103
|
+
componentType?: "RosterForLoop" | undefined;
|
|
104
|
+
} & {
|
|
105
|
+
conditionFilter?: boolean | undefined;
|
|
106
|
+
}) | (import("../../components/type").LunaticBaseProps<unknown> & {
|
|
107
|
+
value: Record<string, unknown>;
|
|
108
|
+
header: {
|
|
109
|
+
label: import("react").ReactNode;
|
|
110
|
+
rowspan?: number | undefined;
|
|
111
|
+
colspan?: number | undefined;
|
|
112
|
+
}[];
|
|
113
|
+
body: (import("../..").LunaticComponentProps<keyof import("../../components/type").ComponentPropsByType> & {
|
|
114
|
+
colspan?: number | undefined;
|
|
115
|
+
rowspan?: number | undefined;
|
|
116
|
+
})[][];
|
|
117
|
+
executeExpression: <T extends unknown = unknown>(expression: import("../../type.source").VTLExpression, args?: {
|
|
118
|
+
iteration?: number | number[] | undefined;
|
|
119
|
+
bindingDependencies?: string[] | undefined;
|
|
120
|
+
deps?: string[] | undefined;
|
|
121
|
+
} | undefined) => T;
|
|
122
|
+
iteration: number | undefined;
|
|
123
|
+
componentType?: "Table" | undefined;
|
|
124
|
+
} & {
|
|
125
|
+
conditionFilter?: boolean | undefined;
|
|
126
|
+
}) | (import("../../components/type").LunaticBaseProps<number | null> & {
|
|
127
|
+
min?: number | undefined;
|
|
128
|
+
max?: number | undefined;
|
|
129
|
+
decimals?: number | undefined;
|
|
130
|
+
unit?: string | undefined;
|
|
131
|
+
response: {
|
|
132
|
+
name: string;
|
|
133
|
+
};
|
|
134
|
+
componentType?: "InputNumber" | undefined;
|
|
135
|
+
} & {
|
|
136
|
+
conditionFilter?: boolean | undefined;
|
|
137
|
+
}) | (import("../../components/type").LunaticBaseProps<string | null> & {
|
|
138
|
+
format: "PnYnM" | "PTnHnM";
|
|
139
|
+
response: {
|
|
140
|
+
name: string;
|
|
141
|
+
};
|
|
142
|
+
componentType?: "Duration" | undefined;
|
|
143
|
+
} & {
|
|
144
|
+
conditionFilter?: boolean | undefined;
|
|
145
|
+
}) | (import("../../components/type").LunaticBaseProps<string | null> & {
|
|
146
|
+
dateFormat: "YYYY-MM-DD" | "YYYY" | "YYYY-MM";
|
|
147
|
+
min?: string | undefined;
|
|
148
|
+
max?: string | undefined;
|
|
149
|
+
response: {
|
|
150
|
+
name: string;
|
|
151
|
+
};
|
|
152
|
+
componentType?: "Datepicker" | undefined;
|
|
153
|
+
} & {
|
|
154
|
+
conditionFilter?: boolean | undefined;
|
|
155
|
+
}) | (import("../../components/type").LunaticBaseProps<Record<string, boolean | null>> & {
|
|
156
|
+
responses: {
|
|
157
|
+
id: string;
|
|
158
|
+
label: import("react").ReactNode;
|
|
159
|
+
description?: import("react").ReactNode;
|
|
160
|
+
response: {
|
|
161
|
+
name: string;
|
|
162
|
+
};
|
|
163
|
+
}[];
|
|
164
|
+
componentType?: "CheckboxGroup" | undefined;
|
|
165
|
+
} & {
|
|
166
|
+
conditionFilter?: boolean | undefined;
|
|
167
|
+
}) | (import("../../components/type").LunaticBaseProps<boolean> & {
|
|
168
|
+
response: {
|
|
169
|
+
name: string;
|
|
170
|
+
};
|
|
171
|
+
componentType?: "CheckboxBoolean" | undefined;
|
|
172
|
+
} & {
|
|
173
|
+
conditionFilter?: boolean | undefined;
|
|
174
|
+
}) | (import("../../components/type").LunaticBaseProps<string | null> & {
|
|
175
|
+
options: {
|
|
176
|
+
description?: import("react").ReactNode;
|
|
177
|
+
label: import("react").ReactNode;
|
|
178
|
+
value: string;
|
|
179
|
+
}[];
|
|
180
|
+
checkboxStyle?: boolean | undefined;
|
|
181
|
+
response: {
|
|
182
|
+
name: string;
|
|
183
|
+
};
|
|
184
|
+
componentType?: "Radio" | undefined;
|
|
185
|
+
} & {
|
|
186
|
+
conditionFilter?: boolean | undefined;
|
|
187
|
+
}) | (import("../../components/type").LunaticBaseProps<string | null> & {
|
|
188
|
+
options: {
|
|
189
|
+
description?: import("react").ReactNode;
|
|
190
|
+
label: import("react").ReactNode;
|
|
191
|
+
value: string;
|
|
192
|
+
}[];
|
|
193
|
+
response: {
|
|
194
|
+
name: string;
|
|
195
|
+
};
|
|
196
|
+
componentType?: "Dropdown" | undefined;
|
|
197
|
+
} & {
|
|
198
|
+
conditionFilter?: boolean | undefined;
|
|
199
|
+
}) | (Pick<import("../../components/type").LunaticBaseProps<unknown>, "description" | "declarations" | "id" | "label" | "errors" | "disabled" | "readOnly"> & {
|
|
200
|
+
components: import("../..").LunaticComponentProps<keyof import("../../components/type").ComponentPropsByType>[];
|
|
201
|
+
componentType?: "Question" | undefined;
|
|
202
|
+
} & {
|
|
203
|
+
conditionFilter?: boolean | undefined;
|
|
204
|
+
}) | (import("../../components/type").LunaticBaseProps<string | null> & {
|
|
205
|
+
options: {
|
|
206
|
+
description?: import("react").ReactNode;
|
|
207
|
+
label: import("react").ReactNode;
|
|
208
|
+
value: string;
|
|
209
|
+
}[];
|
|
210
|
+
response: {
|
|
211
|
+
name: string;
|
|
212
|
+
};
|
|
213
|
+
componentType?: "CheckboxOne" | undefined;
|
|
214
|
+
} & {
|
|
215
|
+
conditionFilter?: boolean | undefined;
|
|
216
|
+
}) | (import("../../components/type").LunaticBaseProps<string | null> & {
|
|
217
|
+
componentType?: "Suggester" | undefined;
|
|
218
|
+
storeName: string;
|
|
219
|
+
optionRenderer: import("react").FunctionComponent<{
|
|
220
|
+
option: import("../../components/type").SuggesterOption;
|
|
221
|
+
placeholder?: string | undefined;
|
|
222
|
+
search?: string | undefined;
|
|
223
|
+
}>;
|
|
224
|
+
labelRenderer: import("react").FunctionComponent<{
|
|
225
|
+
option?: import("../../components/type").SuggesterOption | undefined;
|
|
226
|
+
selected?: boolean | undefined;
|
|
227
|
+
search?: string | undefined;
|
|
228
|
+
}>;
|
|
229
|
+
focused: boolean;
|
|
230
|
+
response: {
|
|
231
|
+
name: string;
|
|
232
|
+
};
|
|
233
|
+
optionResponses?: {
|
|
234
|
+
name: string;
|
|
235
|
+
attribute: string;
|
|
236
|
+
}[] | undefined;
|
|
237
|
+
arbitrary?: {
|
|
238
|
+
response: {
|
|
239
|
+
name: string;
|
|
240
|
+
};
|
|
241
|
+
} | undefined;
|
|
242
|
+
arbitraryValue?: string | undefined;
|
|
243
|
+
allowArbitrary?: boolean | undefined;
|
|
244
|
+
executeExpression: <T extends unknown = unknown>(expression: import("../../type.source").VTLExpression, args?: {
|
|
245
|
+
iteration?: number | number[] | undefined;
|
|
246
|
+
bindingDependencies?: string[] | undefined;
|
|
247
|
+
deps?: string[] | undefined;
|
|
248
|
+
} | undefined) => T;
|
|
249
|
+
iteration: number | undefined;
|
|
250
|
+
} & {
|
|
251
|
+
conditionFilter?: boolean | undefined;
|
|
252
|
+
}) | (Omit<import("../../components/type").LunaticBaseProps<unknown>, "value"> & {
|
|
253
|
+
components: LunaticComponentDefinition[];
|
|
254
|
+
features?: ("VTL" | "MD")[] | undefined;
|
|
255
|
+
executeExpression: <T extends unknown = unknown>(expression: import("../../type.source").VTLExpression, args?: {
|
|
256
|
+
iteration?: number | number[] | undefined;
|
|
257
|
+
bindingDependencies?: string[] | undefined;
|
|
258
|
+
deps?: string[] | undefined;
|
|
259
|
+
} | undefined) => T;
|
|
260
|
+
xAxisIterations: number;
|
|
261
|
+
yAxisIterations: number;
|
|
262
|
+
symLinks: Record<string, Record<string, string>>;
|
|
263
|
+
value: Record<string, unknown[]>;
|
|
264
|
+
getComponents: (x: number, y: number) => import("../..").LunaticComponentProps<keyof import("../../components/type").ComponentPropsByType>[];
|
|
265
|
+
componentType?: "PairwiseLinks" | undefined;
|
|
266
|
+
} & {
|
|
267
|
+
conditionFilter?: boolean | undefined;
|
|
268
|
+
}) | (import("../../components/type").LunaticBaseProps<string | null> & {
|
|
269
|
+
componentType?: "Summary" | undefined;
|
|
270
|
+
executeExpression: <T extends unknown = unknown>(expression: import("../../type.source").VTLExpression, args?: {
|
|
271
|
+
iteration?: number | number[] | undefined;
|
|
272
|
+
bindingDependencies?: string[] | undefined;
|
|
273
|
+
deps?: string[] | undefined;
|
|
274
|
+
} | undefined) => T;
|
|
275
|
+
sections: {
|
|
276
|
+
id: string;
|
|
277
|
+
responses?: {
|
|
278
|
+
id: string;
|
|
279
|
+
label: import("../../components/type").VtlExpression;
|
|
280
|
+
value: import("../../components/type").VtlExpression;
|
|
281
|
+
}[] | undefined;
|
|
282
|
+
title?: import("../../components/type").VtlExpression | undefined;
|
|
283
|
+
iterations?: import("../../components/type").VtlExpression | undefined;
|
|
284
|
+
}[];
|
|
285
|
+
} & {
|
|
286
|
+
conditionFilter?: boolean | undefined;
|
|
287
|
+
}) | (import("../../components/type").LunaticBaseProps<string> & {
|
|
288
|
+
componentType?: "Text" | undefined;
|
|
289
|
+
} & {
|
|
290
|
+
conditionFilter?: boolean | undefined;
|
|
291
|
+
}) | (import("../../components/type").LunaticBaseProps<boolean> & {
|
|
292
|
+
response: {
|
|
293
|
+
name: string;
|
|
294
|
+
};
|
|
295
|
+
statusLabel?: {
|
|
296
|
+
true: string;
|
|
297
|
+
false: string;
|
|
298
|
+
} | undefined;
|
|
299
|
+
componentType?: "Switch" | undefined;
|
|
300
|
+
} & {
|
|
301
|
+
conditionFilter?: boolean | undefined;
|
|
302
|
+
}) | (Pick<import("../../components/type").LunaticBaseProps<string>, "id" | "label"> & {
|
|
303
|
+
componentType?: "FilterDescription" | undefined;
|
|
304
|
+
} & {
|
|
305
|
+
conditionFilter?: boolean | undefined;
|
|
306
|
+
}) | {
|
|
307
|
+
label: unknown;
|
|
308
|
+
})[][];
|
|
309
|
+
} | {
|
|
310
|
+
arbitraryValue?: undefined;
|
|
311
|
+
} | {
|
|
312
|
+
arbitraryValue: unknown;
|
|
313
|
+
};
|
|
9
314
|
export {};
|
|
@@ -131,7 +131,7 @@ function getTableProps(component, state) {
|
|
|
131
131
|
*/
|
|
132
132
|
function getSuggesterProps(component, state) {
|
|
133
133
|
if (!component.arbitrary) {
|
|
134
|
-
return
|
|
134
|
+
return {};
|
|
135
135
|
}
|
|
136
136
|
return {
|
|
137
137
|
arbitraryValue: state.executeExpression({ type: 'VTL', value: component.arbitrary.response.name }, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getComponentTypeProps.js","sourceRoot":"","sources":["../../../src/use-lunatic/props/getComponentTypeProps.ts"],"names":[],"mappings":"AAIA,OAAO,EAAgC,MAAM,uDAAuD,CAAC;AACrG,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,EACN,aAAa,EACb,cAAc,GACd,MAAM,4CAA4C,CAAC;AAIpD;;;GAGG;AACH,SAAS,kBAAkB,CAC1B,SAA4E,EAC5E,KAAY;IAEZ,MAAM,UAAU,GAAG,SAAS,CAAC,UAA+B,CAAC,CAAC,sEAAsE;IACpI,MAAM,QAAQ,GAAG,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC,MAAM,CAAC,UAC7D,MAAM,EACN,CAAC,IAAI,EAAE,UAAU,CAAC;QAElB,MAAM,MAAM,GAAG,KAAK,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,UAAU,EAAE,EAAE,CAAC,CAAC,EAAE,SAAS,EAAE,EAAE;YAClE,OAAO,KAAK,CAAC,iBAAiB,CAAC,UAAU,EA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,CAAC,CAAC,EAAE,CAAC,CAAC;iCACjB;6BACD,CAAC;wBACH,CAAC;wBACD,OAAO;4BACN,GAAG,GAAG;4BACN,gCAAgC;4BAChC,EAAE,GAAG,CAAC,EAAE,SAAS,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE;yBAC3B,CAAC;oBACH,CAAC,EACD,EAAyD,CACzD,CACD,CAAC;gBACH,CAAC;gBACD,KAAK,EAAE;oBACN,GAAG,KAAK,CAAC,KAAK;oBACd,eAAe,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC;oBACvB,OAAO,EAAE,CAAC,EAAE,0CAA0C;iBACtD;aACD,CAAC,CAAC;QACJ,CAAC;KACD,CAAC;AACH,CAAC;AAED;;GAEG;AACH,SAAS,aAAa,CACrB,SAAuE,EACvE,KAAY;IAEZ,OAAO;QACN,IAAI,EAAE,SAAS,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAChC,GAAG,CAAC,GAAG,CAAC,CAAC,SAAS,EAAE,EAAE;YACrB,IAAI,gBAAgB,CAAC,SAAS,CAAC,EAAE,CAAC;gBACjC,OAAO,aAAa,CAAC,SAAuC,EAAE,KAAK,CAAC,CAAC;YACtE,CAAC;YACD,6EAA6E;YAC7E,OAAO;gBACN,GAAG,SAAS;gBACZ,KAAK,EAAE,KAAK,CAAC,iBAAiB,CAAC,SAAS,CAAC,KAAK,EAAE;oBAC/C,SAAS,EAAE,KAAK,CAAC,KAAK,CAAC,SAAS;iBAChC,CAAC;aACF,CAAC;QACH,CAAC,CAAC,CACF;KACD,CAAC;AACH,CAAC;AAED;;GAEG;AACH,SAAS,iBAAiB,CACzB,SAA2E,EAC3E,KAAY;IAEZ,IAAI,CAAC,SAAS,CAAC,SAAS,EAAE,CAAC;QAC1B,OAAO,
|
|
1
|
+
{"version":3,"file":"getComponentTypeProps.js","sourceRoot":"","sources":["../../../src/use-lunatic/props/getComponentTypeProps.ts"],"names":[],"mappings":"AAIA,OAAO,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AAW;YACf,OAAO,iBAAiB,CAAC,SAAS,EAAE,KAAK,CAAC,CAAC;QAC5C;YACC,OAAO,EAAE,CAAC;IACZ,CAAC;AACF,CAAC"}
|
|
@@ -3,11 +3,8 @@ function validateLoopConditionFilter(state, { next, iteration }) {
|
|
|
3
3
|
const { pages, executeExpression } = state;
|
|
4
4
|
const { components } = pages[next];
|
|
5
5
|
const [loop] = components;
|
|
6
|
-
if (loop) {
|
|
7
|
-
|
|
8
|
-
if (conditionFilter) {
|
|
9
|
-
return !!executeConditionFilter(conditionFilter, executeExpression, iteration);
|
|
10
|
-
}
|
|
6
|
+
if (loop && 'conditionFilter' in loop && loop.conditionFilter) {
|
|
7
|
+
return !!executeConditionFilter(loop.conditionFilter, executeExpression, iteration);
|
|
11
8
|
}
|
|
12
9
|
return true;
|
|
13
10
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validate-condition-filter.js","sourceRoot":"","sources":["../../../../src/use-lunatic/reducer/commons/validate-condition-filter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,eAAe,CAAC;AAGvD,SAAS,2BAA2B,CACnC,KAA+D,EAC/D,EAAE,IAAI,EAAE,SAAS,EAAwC;IAEzD,MAAM,EAAE,KAAK,EAAE,iBAAiB,EAAE,GAAG,KAAK,CAAC;IAC3C,MAAM,EAAE,UAAU,EAAE,GAAG,KAAK,CAAC,IAAI,CAAC,CAAC;IACnC,MAAM,CAAC,IAAI,CAAC,GAAG,UAAU,CAAC;IAC1B,IAAI,IAAI,
|
|
1
|
+
{"version":3,"file":"validate-condition-filter.js","sourceRoot":"","sources":["../../../../src/use-lunatic/reducer/commons/validate-condition-filter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,eAAe,CAAC;AAGvD,SAAS,2BAA2B,CACnC,KAA+D,EAC/D,EAAE,IAAI,EAAE,SAAS,EAAwC;IAEzD,MAAM,EAAE,KAAK,EAAE,iBAAiB,EAAE,GAAG,KAAK,CAAC;IAC3C,MAAM,EAAE,UAAU,EAAE,GAAG,KAAK,CAAC,IAAI,CAAC,CAAC;IACnC,MAAM,CAAC,IAAI,CAAC,GAAG,UAAU,CAAC;IAC1B,IAAI,IAAI,IAAI,iBAAiB,IAAI,IAAI,IAAI,IAAI,CAAC,eAAe,EAAE,CAAC;QAC/D,OAAO,CAAC,CAAC,sBAAsB,CAC9B,IAAI,CAAC,eAAe,EACpB,iBAAiB,EACjB,SAAS,CACT,CAAC;IACH,CAAC;IACD,OAAO,IAAI,CAAC;AACb,CAAC;AAED,OAAO,EAAE,2BAA2B,EAAE,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { type PropsWithChildren } from 'react';
|
|
2
|
-
type Props = PropsWithChildren<{
|
|
3
|
-
href: string;
|
|
4
|
-
title: string;
|
|
5
|
-
}>;
|
|
6
|
-
export declare const MDLabelLink: (props: Props) => import("react/jsx-runtime").JSX.Element;
|
|
7
|
-
export declare function generateUniqueId(): string;
|
|
8
|
-
export {};
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { useState } from 'react';
|
|
3
|
-
import { Tooltip } from 'react-tooltip';
|
|
4
|
-
import Markdown from 'react-markdown';
|
|
5
|
-
import { RouterLink } from './RouterLink';
|
|
6
|
-
export const MDLabelLink = (props) => {
|
|
7
|
-
const { href, children, title,
|
|
8
|
-
// logFunction
|
|
9
|
-
} = props;
|
|
10
|
-
// Must be replace by useId when queen move to React 18.
|
|
11
|
-
const [id] = useState(() => generateUniqueId());
|
|
12
|
-
const LinkComponent = (() => {
|
|
13
|
-
if (href.trim().startsWith('/')) {
|
|
14
|
-
return RouterLink;
|
|
15
|
-
}
|
|
16
|
-
else {
|
|
17
|
-
return 'a';
|
|
18
|
-
}
|
|
19
|
-
})();
|
|
20
|
-
const linkProps = {
|
|
21
|
-
...(href.trim().startsWith('/')
|
|
22
|
-
? { to: href, id }
|
|
23
|
-
: { href, target: '_blank', rel: 'noopener noreferrer', id }),
|
|
24
|
-
...(title
|
|
25
|
-
? { 'data-tooltip-id': `tooltip-${id}`, className: 'link-md' }
|
|
26
|
-
: {}),
|
|
27
|
-
};
|
|
28
|
-
return (_jsxs(_Fragment, { children: [_jsx(LinkComponent, { ...linkProps, children: children }), title && (_jsx(Tooltip, { className: "tooltip-content", id: `tooltip-${id}`, children: _jsx(Markdown, { components: { p: (props) => _jsx(_Fragment, { children: props.children }) }, children: title }) }))] }));
|
|
29
|
-
};
|
|
30
|
-
export function generateUniqueId() {
|
|
31
|
-
const timestamp = Date.now().toString(36);
|
|
32
|
-
const randomPart = Math.random().toString(36).substring(2, 8);
|
|
33
|
-
return `${timestamp}-${randomPart}`;
|
|
34
|
-
}
|
|
35
|
-
//# sourceMappingURL=MDLabelLink.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"MDLabelLink.js","sourceRoot":"","sources":["../../../../src/components/shared/MDLabel/MDLabelLink.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAA0B,MAAM,OAAO,CAAC;AACzD,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AACxC,OAAO,QAAQ,MAAM,gBAAgB,CAAC;AACtC,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAI1C,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,KAAY,EAAE,EAAE;IAC3C,MAAM,EACL,IAAI,EACJ,QAAQ,EACR,KAAK;IACL,cAAc;MACd,GAAG,KAAK,CAAC;IAEV,wDAAwD;IACxD,MAAM,CAAC,EAAE,CAAC,GAAG,QAAQ,CAAC,GAAG,EAAE,CAAC,gBAAgB,EAAE,CAAC,CAAC;IAEhD,MAAM,aAAa,GAKd,CAAC,GAAG,EAAE;QACV,IAAI,IAAI,CAAC,IAAI,EAAE,CAAC,UAAU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