treege 0.13.1 → 0.15.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +2 -2
- package/dist/main.js +3376 -3017
- package/dist/main.umd.cjs +38 -38
- package/dist/src/constants/fields.d.ts +6 -0
- package/dist/src/features/Treege/components/DynamicSelectFieldFromTree/DynamicSelectFieldFromTree.d.ts +8 -0
- package/dist/src/features/Treege/components/DynamicSelectFieldFromTree/index.d.ts +3 -0
- package/dist/src/features/Treege/components/DynamicSelectWarning/DynamicSelectWarning.d.ts +5 -0
- package/dist/src/features/Treege/components/DynamicSelectWarning/index.d.ts +3 -0
- package/dist/src/features/Treege/components/FieldSelect/useFieldSelect.d.ts +6 -0
- package/dist/src/features/Treege/components/Forms/FormTreeCardMutation/useFormTreeCardMutation.d.ts +11 -4
- package/dist/src/features/Treege/type/TreeNode.d.ts +16 -1
- package/dist/src/locales/en/form-en.d.ts +11 -0
- package/dist/src/locales/en/translation-en.d.ts +1 -0
- package/dist/src/locales/fr/form-fr.d.ts +11 -0
- package/dist/src/locales/fr/translation-fr.d.ts +1 -0
- package/dist/src/utils/tree/appendNode/appendNode.d.ts +3 -1
- package/package.json +2 -1
|
@@ -106,5 +106,11 @@ declare const fields: readonly [{
|
|
|
106
106
|
readonly isRepeatableDisabled: true;
|
|
107
107
|
readonly isRequiredDisabled: false;
|
|
108
108
|
readonly type: "autocomplete";
|
|
109
|
+
}, {
|
|
110
|
+
readonly isBooleanField: false;
|
|
111
|
+
readonly isDecisionField: false;
|
|
112
|
+
readonly isRepeatableDisabled: false;
|
|
113
|
+
readonly isRequiredDisabled: false;
|
|
114
|
+
readonly type: "dynamicSelect";
|
|
109
115
|
}];
|
|
110
116
|
export default fields;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { SelectChangeEvent } from "@tracktor/design-system";
|
|
2
|
+
interface DynamicSelectFieldFromTreeProps {
|
|
3
|
+
value: string | null;
|
|
4
|
+
onChange?: (event: SelectChangeEvent<string | undefined>, newValue: string | undefined) => void;
|
|
5
|
+
currentName: string;
|
|
6
|
+
}
|
|
7
|
+
declare const DynamicSelectFieldFromTree: ({ value, onChange, currentName }: DynamicSelectFieldFromTreeProps) => import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
export default DynamicSelectFieldFromTree;
|
|
@@ -107,6 +107,12 @@ declare const useFieldSelect: () => {
|
|
|
107
107
|
readonly isRepeatableDisabled: true;
|
|
108
108
|
readonly isRequiredDisabled: false;
|
|
109
109
|
readonly type: "autocomplete";
|
|
110
|
+
} | {
|
|
111
|
+
readonly isBooleanField: false;
|
|
112
|
+
readonly isDecisionField: false;
|
|
113
|
+
readonly isRepeatableDisabled: false;
|
|
114
|
+
readonly isRequiredDisabled: false;
|
|
115
|
+
readonly type: "dynamicSelect";
|
|
110
116
|
})[];
|
|
111
117
|
};
|
|
112
118
|
export default useFieldSelect;
|
package/dist/src/features/Treege/components/Forms/FormTreeCardMutation/useFormTreeCardMutation.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import type { SelectChangeEvent } from "@tracktor/design-system";
|
|
2
2
|
import { ChangeEvent, FormEvent, MouseEvent, SyntheticEvent } from "react";
|
|
3
|
-
import type { TreeNodeField } from '../../../../../features/Treege/type/TreeNode';
|
|
3
|
+
import type { Params, Route, TreeNodeField } from '../../../../../features/Treege/type/TreeNode';
|
|
4
4
|
declare const useFormTreeCardMutation: () => {
|
|
5
5
|
getDisabledValueField: (index: number) => boolean;
|
|
6
|
+
handleAddParams: () => void;
|
|
6
7
|
handleAddValue: () => void;
|
|
7
8
|
handleChangeHelperText: (event: ChangeEvent<HTMLInputElement>) => void;
|
|
8
9
|
handleChangeHiddenValue: (event: ChangeEvent<HTMLInputElement>) => void;
|
|
@@ -13,6 +14,9 @@ declare const useFormTreeCardMutation: () => {
|
|
|
13
14
|
handleChangeOptionLabel: (event: ChangeEvent<HTMLInputElement>) => void;
|
|
14
15
|
handleChangeOptionMessage: (event: ChangeEvent<HTMLInputElement>) => void;
|
|
15
16
|
handleChangeOptionValue: (event: ChangeEvent<HTMLInputElement>) => void;
|
|
17
|
+
handleChangeParam: (index: number, property: keyof Params, event: ChangeEvent<HTMLInputElement | HTMLTextAreaElement>) => void;
|
|
18
|
+
handleChangeParentRef: (_: SelectChangeEvent<string | undefined>, newValue: string | undefined) => void;
|
|
19
|
+
handleChangePath: <T extends HTMLInputElement | HTMLTextAreaElement>(property: string, event: ChangeEvent<T>) => void;
|
|
16
20
|
handleChangeRepeatable: (event: ChangeEvent<HTMLInputElement>) => void;
|
|
17
21
|
handleChangeRequired: (event: ChangeEvent<HTMLInputElement>) => void;
|
|
18
22
|
handleChangeSearchKey: (event: ChangeEvent<HTMLInputElement>) => void;
|
|
@@ -24,6 +28,8 @@ declare const useFormTreeCardMutation: () => {
|
|
|
24
28
|
handleChangeTreeSelect: (event: SelectChangeEvent) => void;
|
|
25
29
|
handleChangeType: (event: SelectChangeEvent<TreeNodeField["type"]>) => void;
|
|
26
30
|
handleChangeUrl: (event: ChangeEvent<HTMLInputElement>) => void;
|
|
31
|
+
handleChangeUrlSelect: (event: ChangeEvent<HTMLInputElement>) => void;
|
|
32
|
+
handleDeleteParam: (e: MouseEvent<HTMLButtonElement>) => void;
|
|
27
33
|
handleDeleteValue: (e: MouseEvent<HTMLButtonElement>) => void;
|
|
28
34
|
handleSubmit: (e: FormEvent) => Promise<void>;
|
|
29
35
|
helperText: string;
|
|
@@ -32,6 +38,7 @@ declare const useFormTreeCardMutation: () => {
|
|
|
32
38
|
isBooleanField: boolean;
|
|
33
39
|
isDecision: boolean;
|
|
34
40
|
isDecisionField: boolean;
|
|
41
|
+
isDynamicSelect: boolean;
|
|
35
42
|
isEditModal: boolean;
|
|
36
43
|
isHiddenField: boolean;
|
|
37
44
|
isLeaf: boolean;
|
|
@@ -45,15 +52,15 @@ declare const useFormTreeCardMutation: () => {
|
|
|
45
52
|
on: string;
|
|
46
53
|
};
|
|
47
54
|
name: string;
|
|
55
|
+
parentRef: string | null;
|
|
48
56
|
repeatable: boolean;
|
|
49
57
|
required: boolean;
|
|
50
|
-
|
|
58
|
+
route: Route;
|
|
51
59
|
step: string;
|
|
52
60
|
tag: string | null;
|
|
53
61
|
treeSelected: string;
|
|
54
|
-
type: "number" | "text" | "address" | "select" | "time" | "switch" | "hidden" | "email" | "file" | "password" | "tel" | "url" | "date" | "dateRange" | "checkbox" | "tree" | "radio" | "autocomplete";
|
|
62
|
+
type: "number" | "text" | "address" | "select" | "time" | "switch" | "hidden" | "email" | "file" | "password" | "tel" | "url" | "date" | "dateRange" | "checkbox" | "tree" | "radio" | "autocomplete" | "dynamicSelect";
|
|
55
63
|
uniqueNameErrorMessage: string;
|
|
56
|
-
url: string;
|
|
57
64
|
values: {
|
|
58
65
|
id: string;
|
|
59
66
|
label: string;
|
|
@@ -8,9 +8,22 @@ export interface TreeValues {
|
|
|
8
8
|
value: string;
|
|
9
9
|
message?: string;
|
|
10
10
|
}
|
|
11
|
+
export interface Params {
|
|
12
|
+
id: string;
|
|
13
|
+
key: string;
|
|
14
|
+
value: string;
|
|
15
|
+
}
|
|
16
|
+
export interface PathKey {
|
|
17
|
+
object?: string;
|
|
18
|
+
value?: string;
|
|
19
|
+
label?: string;
|
|
20
|
+
image?: string;
|
|
21
|
+
}
|
|
11
22
|
export interface Route {
|
|
12
23
|
url: string;
|
|
13
|
-
searchKey
|
|
24
|
+
searchKey?: string;
|
|
25
|
+
pathKey?: PathKey;
|
|
26
|
+
params?: Params[];
|
|
14
27
|
}
|
|
15
28
|
export interface TreeNode extends Omit<RawNodeDatum, "attributes" | "children"> {
|
|
16
29
|
name: string;
|
|
@@ -37,6 +50,7 @@ export interface TreeNode extends Omit<RawNodeDatum, "attributes" | "children">
|
|
|
37
50
|
repeatable?: boolean;
|
|
38
51
|
hiddenValue?: string;
|
|
39
52
|
route?: Route;
|
|
53
|
+
parentRef?: string;
|
|
40
54
|
} | {
|
|
41
55
|
depth: number;
|
|
42
56
|
tag?: string;
|
|
@@ -57,6 +71,7 @@ export interface TreeNode extends Omit<RawNodeDatum, "attributes" | "children">
|
|
|
57
71
|
repeatable?: never;
|
|
58
72
|
hiddenValue?: never;
|
|
59
73
|
route?: Route;
|
|
74
|
+
parentRef?: string;
|
|
60
75
|
};
|
|
61
76
|
children: TreeNode[];
|
|
62
77
|
treeId?: string;
|
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
declare const FORM_EN: {
|
|
2
|
+
readonly additionalParams: "Additional parameters";
|
|
3
|
+
readonly ancestor: "Ancestor";
|
|
2
4
|
readonly apiRoute: "Api route";
|
|
5
|
+
readonly dataMapping: "Data mapping";
|
|
3
6
|
readonly decisionField: "Decision field";
|
|
4
7
|
readonly helperText: "Helper text";
|
|
5
8
|
readonly hiddenValue: "Hidden value";
|
|
6
9
|
readonly label: "Label";
|
|
7
10
|
readonly mustBeUnique: "Must be unique";
|
|
8
11
|
readonly newTree: "Nouvel arbre";
|
|
12
|
+
readonly noAncestorFound: "No parents found";
|
|
9
13
|
readonly offMessage: "Message (disable)";
|
|
10
14
|
readonly onMessage: "Message (enable)";
|
|
11
15
|
readonly repeatable: "Repeatable";
|
|
@@ -19,6 +23,7 @@ declare const FORM_EN: {
|
|
|
19
23
|
readonly checkbox: "Checkbox";
|
|
20
24
|
readonly date: "Date";
|
|
21
25
|
readonly dateRange: "Date range";
|
|
26
|
+
readonly dynamicSelect: "Dynamic select";
|
|
22
27
|
readonly email: "Email";
|
|
23
28
|
readonly file: "File";
|
|
24
29
|
readonly hidden: "Hidden field";
|
|
@@ -33,11 +38,17 @@ declare const FORM_EN: {
|
|
|
33
38
|
readonly tree: "Tree";
|
|
34
39
|
readonly url: "URL";
|
|
35
40
|
};
|
|
41
|
+
readonly urlConstruction: "URL construction";
|
|
36
42
|
readonly value: "Value";
|
|
37
43
|
readonly values: "Values";
|
|
38
44
|
readonly warningApiAutocomplete: {
|
|
39
45
|
readonly response: "should have as a response";
|
|
40
46
|
readonly url: "The API Route";
|
|
41
47
|
};
|
|
48
|
+
readonly warningApiSelect: {
|
|
49
|
+
readonly response: "at the location specified in the API URL.";
|
|
50
|
+
readonly url: "To automatically include the parent value in the API URL: add";
|
|
51
|
+
readonly warning: "{{}}";
|
|
52
|
+
};
|
|
42
53
|
};
|
|
43
54
|
export default FORM_EN;
|
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
declare const FORM_FR: {
|
|
2
|
+
readonly additionalParams: "Paramètres additionnels";
|
|
3
|
+
readonly ancestor: "Ancêtre";
|
|
2
4
|
readonly apiRoute: "Api route";
|
|
5
|
+
readonly dataMapping: "Mapping de données";
|
|
3
6
|
readonly decisionField: "Champs de décision";
|
|
4
7
|
readonly helperText: "Texte d'information";
|
|
5
8
|
readonly hiddenValue: "Valeur caché";
|
|
6
9
|
readonly label: "Label";
|
|
7
10
|
readonly mustBeUnique: "Doit être unique";
|
|
8
11
|
readonly newTree: "Nouvel arbre";
|
|
12
|
+
readonly noAncestorFound: "Aucun parent trouvé";
|
|
9
13
|
readonly offMessage: "Message (désactiver)";
|
|
10
14
|
readonly onMessage: "Message (activer)";
|
|
11
15
|
readonly repeatable: "Répétable";
|
|
@@ -19,6 +23,7 @@ declare const FORM_FR: {
|
|
|
19
23
|
readonly checkbox: "Case à cocher";
|
|
20
24
|
readonly date: "Date";
|
|
21
25
|
readonly dateRange: "Plage de dates";
|
|
26
|
+
readonly dynamicSelect: "Sélection dynamique";
|
|
22
27
|
readonly email: "Email";
|
|
23
28
|
readonly file: "Fichier";
|
|
24
29
|
readonly hidden: "Champs caché";
|
|
@@ -33,11 +38,17 @@ declare const FORM_FR: {
|
|
|
33
38
|
readonly tree: "Arbre";
|
|
34
39
|
readonly url: "URL";
|
|
35
40
|
};
|
|
41
|
+
readonly urlConstruction: "Construction de l'URL";
|
|
36
42
|
readonly value: "Valeur";
|
|
37
43
|
readonly values: "Valeurs";
|
|
38
44
|
readonly warningApiAutocomplete: {
|
|
39
45
|
readonly response: "dois avoir comme réponse";
|
|
40
46
|
readonly url: "La route de l'API";
|
|
41
47
|
};
|
|
48
|
+
readonly warningApiSelect: {
|
|
49
|
+
readonly response: "à l'emplacement de votre variable.";
|
|
50
|
+
readonly url: "Pour intégrer automatiquement la valeur du parent dans l'URL";
|
|
51
|
+
readonly warning: "placez {{}}";
|
|
52
|
+
};
|
|
42
53
|
};
|
|
43
54
|
export default FORM_FR;
|
|
@@ -11,6 +11,7 @@ declare const TRANSLATION_FR: {
|
|
|
11
11
|
readonly isTheRoot: "Est la racine";
|
|
12
12
|
readonly label: "Label";
|
|
13
13
|
readonly name: "Nom";
|
|
14
|
+
readonly parentRef: "Element parent";
|
|
14
15
|
readonly remove: "Supprimer";
|
|
15
16
|
readonly required: "Requis";
|
|
16
17
|
readonly save: "Enregistrer";
|
|
@@ -27,7 +27,7 @@ declare const appendNode: ({ tree, path, name, child }: AppendChildParams) => Tr
|
|
|
27
27
|
label: string;
|
|
28
28
|
required?: boolean | undefined;
|
|
29
29
|
step?: string | undefined;
|
|
30
|
-
type: "number" | "text" | "address" | "select" | "time" | "switch" | "hidden" | "email" | "file" | "password" | "tel" | "url" | "date" | "dateRange" | "checkbox" | "tree" | "radio" | "autocomplete";
|
|
30
|
+
type: "number" | "text" | "address" | "select" | "time" | "switch" | "hidden" | "email" | "file" | "password" | "tel" | "url" | "date" | "dateRange" | "checkbox" | "tree" | "radio" | "autocomplete" | "dynamicSelect";
|
|
31
31
|
value?: undefined;
|
|
32
32
|
values?: import('../../../features/Treege/type/TreeNode').TreeValues[] | undefined;
|
|
33
33
|
message?: undefined;
|
|
@@ -36,6 +36,7 @@ declare const appendNode: ({ tree, path, name, child }: AppendChildParams) => Tr
|
|
|
36
36
|
repeatable?: boolean | undefined;
|
|
37
37
|
hiddenValue?: string | undefined;
|
|
38
38
|
route?: import('../../../features/Treege/type/TreeNode').Route | undefined;
|
|
39
|
+
parentRef?: string | undefined;
|
|
39
40
|
} | {
|
|
40
41
|
isLeaf: boolean;
|
|
41
42
|
isRoot: boolean;
|
|
@@ -56,6 +57,7 @@ declare const appendNode: ({ tree, path, name, child }: AppendChildParams) => Tr
|
|
|
56
57
|
repeatable?: undefined;
|
|
57
58
|
hiddenValue?: undefined;
|
|
58
59
|
route?: import('../../../features/Treege/type/TreeNode').Route | undefined;
|
|
60
|
+
parentRef?: string | undefined;
|
|
59
61
|
};
|
|
60
62
|
name: string;
|
|
61
63
|
children: TreeNode[];
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "treege",
|
|
3
3
|
"description": "Form decision tree generator",
|
|
4
4
|
"license": "ISC",
|
|
5
|
-
"version": "0.
|
|
5
|
+
"version": "0.15.0",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"types": "./dist/main.d.ts",
|
|
8
8
|
"main": "./dist/main.umd.cjs",
|
|
@@ -26,6 +26,7 @@
|
|
|
26
26
|
"dev": "vite",
|
|
27
27
|
"build": "tsc && vite build",
|
|
28
28
|
"lint": "eslint . --max-warnings=0 && tsc --noEmit",
|
|
29
|
+
"lint:fix": "eslint . --fix",
|
|
29
30
|
"preview": "vite preview",
|
|
30
31
|
"test": "yarn lint && vitest",
|
|
31
32
|
"test:coverage": "vitest run --coverage",
|