intlayer-editor 3.5.2 → 3.5.4
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 +5 -5
- package/dist/cjs/DictionaryEditionDrawer/DictionaryEditionDrawer.cjs +13 -5
- package/dist/cjs/DictionaryEditionDrawer/DictionaryEditionDrawer.cjs.map +1 -1
- package/dist/cjs/DictionaryEditionDrawer/dictionaryEditionDrawer.content.cjs +36 -0
- package/dist/cjs/DictionaryEditionDrawer/dictionaryEditionDrawer.content.cjs.map +1 -0
- package/dist/esm/DictionaryEditionDrawer/DictionaryEditionDrawer.mjs +4 -6
- package/dist/esm/DictionaryEditionDrawer/DictionaryEditionDrawer.mjs.map +1 -1
- package/dist/esm/DictionaryEditionDrawer/dictionaryEditionDrawer.content.mjs +16 -0
- package/dist/esm/DictionaryEditionDrawer/dictionaryEditionDrawer.content.mjs.map +1 -0
- package/dist/types/DictionaryEditionDrawer/DictionaryEditionDrawer.d.ts.map +1 -1
- package/dist/types/DictionaryEditionDrawer/dictionaryEditionDrawer.content.d.ts +8 -0
- package/dist/types/DictionaryEditionDrawer/dictionaryEditionDrawer.content.d.ts.map +1 -0
- package/package.json +13 -11
package/README.md
CHANGED
|
@@ -29,19 +29,19 @@ For more details on how to install the package, see the relevant section below:
|
|
|
29
29
|
|
|
30
30
|
### Integrating with Next.js
|
|
31
31
|
|
|
32
|
-
For integration with Next.js, refer to the [setup guide](https://github.com/aymericzip/intlayer/blob/main/docs/docs/
|
|
32
|
+
For integration with Next.js, refer to the [setup guide](https://github.com/aymericzip/intlayer/blob/main/docs/docs/intlayer_with_nextjs_15.md).
|
|
33
33
|
|
|
34
34
|
### Integrating with Create React App
|
|
35
35
|
|
|
36
|
-
For integration with Create React App, refer to the [setup guide](https://github.com/aymericzip/intlayer/blob/main/docs/docs/
|
|
36
|
+
For integration with Create React App, refer to the [setup guide](https://github.com/aymericzip/intlayer/blob/main/docs/docs/intlayer_with_create_react_app.md
|
|
37
37
|
|
|
38
38
|
### Integrating with Vite + React
|
|
39
39
|
|
|
40
|
-
For integration with Vite + React, refer to the [setup guide](https://github.com/aymericzip/intlayer/blob/main/docs/docs/intlayer_with_vite+
|
|
40
|
+
For integration with Vite + React, refer to the [setup guide](https://github.com/aymericzip/intlayer/blob/main/docs/docs/intlayer_with_vite+react.md
|
|
41
41
|
|
|
42
42
|
## How Intlayer Editor Works
|
|
43
43
|
|
|
44
|
-
Each time you make a change using Intlayer Editor, the server automatically inserts your changes into your [Intlayer declaration files](https://github.com/aymericzip/intlayer/blob/main/docs/docs/content_declaration/
|
|
44
|
+
Each time you make a change using Intlayer Editor, the server automatically inserts your changes into your [Intlayer declaration files](https://github.com/aymericzip/intlayer/blob/main/docs/docs/content_declaration/get_started.mdwherever these files are declared in your project.
|
|
45
45
|
|
|
46
46
|
In this way, you don't have to worry about where the file is declared or about finding your key in your dictionary collection.
|
|
47
47
|
|
|
@@ -83,7 +83,7 @@ const config: IntlayerConfig = {
|
|
|
83
83
|
|
|
84
84
|
> If you don't have a client ID and client secret, you can obtain them by creating a new client in the [Intlayer Dashboard - Projects](https://intlayer.org/dashboard/projects).
|
|
85
85
|
|
|
86
|
-
> To see all available parameters, refer to the [configuration documentation](https://github.com/aymericzip/intlayer/blob/main/docs/docs/
|
|
86
|
+
> To see all available parameters, refer to the [configuration documentation](https://github.com/aymericzip/intlayer/blob/main/docs/docs/configuration.md
|
|
87
87
|
|
|
88
88
|
### 2. Insert the Intlayer Editor Provider in your application
|
|
89
89
|
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
"use client";
|
|
3
|
+
var __create = Object.create;
|
|
3
4
|
var __defProp = Object.defineProperty;
|
|
4
5
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
6
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
8
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
9
|
var __export = (target, all) => {
|
|
8
10
|
for (var name in all)
|
|
@@ -16,6 +18,14 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
16
18
|
}
|
|
17
19
|
return to;
|
|
18
20
|
};
|
|
21
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
22
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
23
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
24
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
25
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
26
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
27
|
+
mod
|
|
28
|
+
));
|
|
19
29
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
20
30
|
var DictionaryEditionDrawer_exports = {};
|
|
21
31
|
__export(DictionaryEditionDrawer_exports, {
|
|
@@ -31,6 +41,7 @@ var import_react = require("react");
|
|
|
31
41
|
var import_react_intlayer = require("react-intlayer");
|
|
32
42
|
var import_shallow = require("zustand/shallow");
|
|
33
43
|
var import_dictionaryListDrawerIdentifier = require('../DictionaryListDrawer/dictionaryListDrawerIdentifier.cjs');
|
|
44
|
+
var import_dictionaryEditionDrawer = __toESM(require('./dictionaryEditionDrawer.content.cjs'));
|
|
34
45
|
var import_useDictionaryEditionDrawer = require('./useDictionaryEditionDrawer.cjs');
|
|
35
46
|
const DictionaryEditionDrawerContent = ({ locale, identifier, handleOnBack }) => {
|
|
36
47
|
const [keyPathEditionModal, setKeyPathEditionModal] = (0, import_react.useState)(null);
|
|
@@ -87,6 +98,7 @@ const DictionaryEditionDrawer = ({
|
|
|
87
98
|
setLocale,
|
|
88
99
|
dictionaryId
|
|
89
100
|
}) => {
|
|
101
|
+
const { backButtonText } = (0, import_react_intlayer.useDictionary)(import_dictionaryEditionDrawer.default);
|
|
90
102
|
const id = (0, import_useDictionaryEditionDrawer.getDrawerIdentifier)(dictionaryId);
|
|
91
103
|
const { focusedContent, close } = (0, import_useDictionaryEditionDrawer.useDictionaryEditionDrawer)(dictionaryId);
|
|
92
104
|
const { openDictionaryListDrawer } = (0, import_design_system.useRightDrawerStore)((s) => ({
|
|
@@ -111,11 +123,7 @@ const DictionaryEditionDrawer = ({
|
|
|
111
123
|
),
|
|
112
124
|
backButton: {
|
|
113
125
|
onBack: handleOnBack,
|
|
114
|
-
text:
|
|
115
|
-
en: "Dictionary list",
|
|
116
|
-
fr: "Liste des dictionnaires",
|
|
117
|
-
es: "Lista de diccionarios"
|
|
118
|
-
})
|
|
126
|
+
text: backButtonText
|
|
119
127
|
},
|
|
120
128
|
children: focusedContent && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
121
129
|
DictionaryEditionDrawerContent,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/DictionaryEditionDrawer/DictionaryEditionDrawer.tsx"],"sourcesContent":["'use client';\n\nimport type { Locales } from '@intlayer/config/client';\nimport type { Dictionary, KeyPath } from '@intlayer/core';\nimport {\n RightDrawer,\n DictionaryEditor,\n LocaleSwitcher,\n Modal,\n useEditionPanelStore,\n DictionaryFieldEditor,\n useRightDrawerStore,\n} from '@intlayer/design-system';\nimport { useGetAllDictionaries } from '@intlayer/design-system/hooks';\nimport { useCallback, useEffect, useState, type FC } from 'react';\nimport { t } from 'react-intlayer';\nimport { useShallow } from 'zustand/shallow';\nimport { dictionaryListDrawerIdentifier } from '../DictionaryListDrawer/dictionaryListDrawerIdentifier';\nimport {\n type FileContent as FileContentWithDictionaryPath,\n useDictionaryEditionDrawer,\n getDrawerIdentifier,\n} from './useDictionaryEditionDrawer';\n\ntype DictionaryEditionDrawerContentProps = {\n focusedContent: FileContentWithDictionaryPath;\n locale: Locales;\n identifier: string;\n handleOnBack: () => void;\n};\n\nexport const DictionaryEditionDrawerContent: FC<\n DictionaryEditionDrawerContentProps\n> = ({ locale, identifier, handleOnBack }) => {\n const [keyPathEditionModal, setKeyPathEditionModal] = useState<\n KeyPath[] | null\n >(null);\n const { setDictionariesRecord, focusedContent } =\n useDictionaryEditionDrawer(identifier);\n const { all: dictionaries } = useGetAllDictionaries();\n\n const onClickDictionaryList = useCallback(() => {\n setKeyPathEditionModal(null);\n handleOnBack();\n }, [handleOnBack]);\n\n useEffect(() => {\n if (dictionaries) {\n setDictionariesRecord(dictionaries);\n }\n }, [setDictionariesRecord, dictionaries]);\n\n const dictionaryId = focusedContent?.dictionaryId;\n\n if (!dictionaryId) return <>No dictionary focused</>;\n\n const dictionary: Dictionary = dictionaries[dictionaryId];\n\n return (\n <>\n <Modal\n isOpen={keyPathEditionModal !== null}\n onClose={() => setKeyPathEditionModal(null)}\n hasCloseButton\n title={t({\n en: 'Edit field',\n fr: 'Modifier le champ',\n es: 'Editar campo',\n })}\n size=\"xl\"\n transparency=\"lg\"\n >\n {dictionary && (\n <DictionaryFieldEditor\n dictionary={dictionary}\n onClickDictionaryList={onClickDictionaryList}\n />\n )}\n </Modal>\n <DictionaryEditor\n dictionary={dictionary}\n locale={locale}\n onClickEdit={setKeyPathEditionModal}\n />\n </>\n );\n};\n\ntype DictionaryEditionDrawerProps = DictionaryEditionDrawerControllerProps & {\n dictionaryId: string;\n};\n\nexport const DictionaryEditionDrawer: FC<DictionaryEditionDrawerProps> = ({\n locale,\n localeList,\n setLocale,\n dictionaryId,\n}) => {\n const id = getDrawerIdentifier(dictionaryId);\n\n const { focusedContent, close } = useDictionaryEditionDrawer(dictionaryId);\n const { openDictionaryListDrawer } = useRightDrawerStore((s) => ({\n openDictionaryListDrawer: () => s.open(dictionaryListDrawerIdentifier),\n }));\n\n const handleOnBack = () => {\n close();\n openDictionaryListDrawer();\n };\n\n return (\n <RightDrawer\n title={dictionaryId}\n identifier={id}\n header={\n <LocaleSwitcher\n setLocale={setLocale}\n locale={locale}\n localeList={localeList}\n />\n }\n backButton={{\n onBack: handleOnBack,\n text:
|
|
1
|
+
{"version":3,"sources":["../../../src/DictionaryEditionDrawer/DictionaryEditionDrawer.tsx"],"sourcesContent":["'use client';\n\nimport type { Locales } from '@intlayer/config/client';\nimport type { Dictionary, KeyPath } from '@intlayer/core';\nimport {\n RightDrawer,\n DictionaryEditor,\n LocaleSwitcher,\n Modal,\n useEditionPanelStore,\n DictionaryFieldEditor,\n useRightDrawerStore,\n} from '@intlayer/design-system';\nimport { useGetAllDictionaries } from '@intlayer/design-system/hooks';\nimport { useCallback, useEffect, useState, type FC } from 'react';\nimport { t, useDictionary } from 'react-intlayer';\nimport { useShallow } from 'zustand/shallow';\nimport { dictionaryListDrawerIdentifier } from '../DictionaryListDrawer/dictionaryListDrawerIdentifier';\nimport dictionaryEditionDrawerContent from './dictionaryEditionDrawer.content';\nimport {\n type FileContent as FileContentWithDictionaryPath,\n useDictionaryEditionDrawer,\n getDrawerIdentifier,\n} from './useDictionaryEditionDrawer';\n\ntype DictionaryEditionDrawerContentProps = {\n focusedContent: FileContentWithDictionaryPath;\n locale: Locales;\n identifier: string;\n handleOnBack: () => void;\n};\n\nexport const DictionaryEditionDrawerContent: FC<\n DictionaryEditionDrawerContentProps\n> = ({ locale, identifier, handleOnBack }) => {\n const [keyPathEditionModal, setKeyPathEditionModal] = useState<\n KeyPath[] | null\n >(null);\n const { setDictionariesRecord, focusedContent } =\n useDictionaryEditionDrawer(identifier);\n const { all: dictionaries } = useGetAllDictionaries();\n\n const onClickDictionaryList = useCallback(() => {\n setKeyPathEditionModal(null);\n handleOnBack();\n }, [handleOnBack]);\n\n useEffect(() => {\n if (dictionaries) {\n setDictionariesRecord(dictionaries);\n }\n }, [setDictionariesRecord, dictionaries]);\n\n const dictionaryId = focusedContent?.dictionaryId;\n\n if (!dictionaryId) return <>No dictionary focused</>;\n\n const dictionary: Dictionary = dictionaries[dictionaryId];\n\n return (\n <>\n <Modal\n isOpen={keyPathEditionModal !== null}\n onClose={() => setKeyPathEditionModal(null)}\n hasCloseButton\n title={t({\n en: 'Edit field',\n fr: 'Modifier le champ',\n es: 'Editar campo',\n })}\n size=\"xl\"\n transparency=\"lg\"\n >\n {dictionary && (\n <DictionaryFieldEditor\n dictionary={dictionary}\n onClickDictionaryList={onClickDictionaryList}\n />\n )}\n </Modal>\n <DictionaryEditor\n dictionary={dictionary}\n locale={locale}\n onClickEdit={setKeyPathEditionModal}\n />\n </>\n );\n};\n\ntype DictionaryEditionDrawerProps = DictionaryEditionDrawerControllerProps & {\n dictionaryId: string;\n};\n\nexport const DictionaryEditionDrawer: FC<DictionaryEditionDrawerProps> = ({\n locale,\n localeList,\n setLocale,\n dictionaryId,\n}) => {\n const { backButtonText } = useDictionary(dictionaryEditionDrawerContent);\n const id = getDrawerIdentifier(dictionaryId);\n\n const { focusedContent, close } = useDictionaryEditionDrawer(dictionaryId);\n const { openDictionaryListDrawer } = useRightDrawerStore((s) => ({\n openDictionaryListDrawer: () => s.open(dictionaryListDrawerIdentifier),\n }));\n\n const handleOnBack = () => {\n close();\n openDictionaryListDrawer();\n };\n\n return (\n <RightDrawer\n title={dictionaryId}\n identifier={id}\n header={\n <LocaleSwitcher\n setLocale={setLocale}\n locale={locale}\n localeList={localeList}\n />\n }\n backButton={{\n onBack: handleOnBack,\n text: backButtonText,\n }}\n >\n {focusedContent && (\n <DictionaryEditionDrawerContent\n focusedContent={focusedContent}\n locale={locale}\n identifier={id}\n handleOnBack={handleOnBack}\n />\n )}\n </RightDrawer>\n );\n};\n\ntype DictionaryEditionDrawerControllerProps = {\n locale: Locales;\n localeList: Locales[];\n setLocale: (locale: Locales) => void;\n};\n\nexport const DictionaryEditionDrawerController: FC<\n DictionaryEditionDrawerControllerProps\n> = ({ locale, localeList, setLocale }) => {\n const focusedContent = useEditionPanelStore(\n useShallow((s) => s.focusedContent)\n );\n const dictionaryId: string | undefined = focusedContent?.dictionaryId;\n\n if (!dictionaryId) {\n return <></>;\n }\n\n return (\n <DictionaryEditionDrawer\n locale={locale}\n localeList={localeList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KACF;AAEJ;AAMO,MAAM,0BAA4D,CAAC;AAAA,EACxE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,MAAM;AACJ,QAAM,EAAE,eAAe,QAAI,qCAAc,+BAAAA,OAA8B;AACvE,QAAM,SAAK,uDAAoB,YAAY;AAE3C,QAAM,EAAE,gBAAgB,MAAM,QAAI,8DAA2B,YAAY;AACzE,QAAM,EAAE,yBAAyB,QAAI,0CAAoB,CAAC,OAAO;AAAA,IAC/D,0BAA0B,MAAM,EAAE,KAAK,oEAA8B;AAAA,EACvE,EAAE;AAEF,QAAM,eAAe,MAAM;AACzB,UAAM;AACN,6BAAyB;AAAA,EAC3B;AAEA,SACE;AAAA,IAAC;AAAA;AAAA,MACC,OAAO;AAAA,MACP,YAAY;AAAA,MACZ,QACE;AAAA,QAAC;AAAA;AAAA,UACC;AAAA,UACA;AAAA,UACA;AAAA;AAAA,MACF;AAAA,MAEF,YAAY;AAAA,QACV,QAAQ;AAAA,QACR,MAAM;AAAA,MACR;AAAA,MAEC,4BACC;AAAA,QAAC;AAAA;AAAA,UACC;AAAA,UACA;AAAA,UACA,YAAY;AAAA,UACZ;AAAA;AAAA,MACF;AAAA;AAAA,EAEJ;AAEJ;AAQO,MAAM,oCAET,CAAC,EAAE,QAAQ,YAAY,UAAU,MAAM;AACzC,QAAM,qBAAiB;AAAA,QACrB,2BAAW,CAAC,MAAM,EAAE,cAAc;AAAA,EACpC;AACA,QAAM,eAAmC,gBAAgB;AAEzD,MAAI,CAAC,cAAc;AACjB,WAAO,2EAAE;AAAA,EACX;AAEA,SACE;AAAA,IAAC;AAAA;AAAA,MACC;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA;AAAA,EACF;AAEJ;","names":["dictionaryEditionDrawerContent"]}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var dictionaryEditionDrawer_content_exports = {};
|
|
20
|
+
__export(dictionaryEditionDrawer_content_exports, {
|
|
21
|
+
default: () => dictionaryEditionDrawer_content_default
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(dictionaryEditionDrawer_content_exports);
|
|
24
|
+
var import_intlayer = require("intlayer");
|
|
25
|
+
const dictionaryEditionDrawerContent = {
|
|
26
|
+
key: "dictionary-edition-drawer",
|
|
27
|
+
content: {
|
|
28
|
+
backButtonText: (0, import_intlayer.t)({
|
|
29
|
+
en: "Dictionary list",
|
|
30
|
+
fr: "Liste des dictionnaires",
|
|
31
|
+
es: "Lista de diccionarios"
|
|
32
|
+
})
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
var dictionaryEditionDrawer_content_default = dictionaryEditionDrawerContent;
|
|
36
|
+
//# sourceMappingURL=dictionaryEditionDrawer.content.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/DictionaryEditionDrawer/dictionaryEditionDrawer.content.ts"],"sourcesContent":["import { t, type DeclarationContent } from 'intlayer';\n\nconst dictionaryEditionDrawerContent = {\n key: 'dictionary-edition-drawer',\n content: {\n backButtonText: t({\n en: 'Dictionary list',\n fr: 'Liste des dictionnaires',\n es: 'Lista de diccionarios',\n }),\n },\n} satisfies DeclarationContent;\n\nexport default dictionaryEditionDrawerContent;\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,sBAA2C;AAE3C,MAAM,iCAAiC;AAAA,EACrC,KAAK;AAAA,EACL,SAAS;AAAA,IACP,oBAAgB,mBAAE;AAAA,MAChB,IAAI;AAAA,MACJ,IAAI;AAAA,MACJ,IAAI;AAAA,IACN,CAAC;AAAA,EACH;AACF;AAEA,IAAO,0CAAQ;","names":[]}
|
|
@@ -11,9 +11,10 @@ import {
|
|
|
11
11
|
} from "@intlayer/design-system";
|
|
12
12
|
import { useGetAllDictionaries } from "@intlayer/design-system/hooks";
|
|
13
13
|
import { useCallback, useEffect, useState } from "react";
|
|
14
|
-
import { t } from "react-intlayer";
|
|
14
|
+
import { t, useDictionary } from "react-intlayer";
|
|
15
15
|
import { useShallow } from "zustand/shallow";
|
|
16
16
|
import { dictionaryListDrawerIdentifier } from '../DictionaryListDrawer/dictionaryListDrawerIdentifier.mjs';
|
|
17
|
+
import dictionaryEditionDrawerContent from './dictionaryEditionDrawer.content.mjs';
|
|
17
18
|
import {
|
|
18
19
|
useDictionaryEditionDrawer,
|
|
19
20
|
getDrawerIdentifier
|
|
@@ -73,6 +74,7 @@ const DictionaryEditionDrawer = ({
|
|
|
73
74
|
setLocale,
|
|
74
75
|
dictionaryId
|
|
75
76
|
}) => {
|
|
77
|
+
const { backButtonText } = useDictionary(dictionaryEditionDrawerContent);
|
|
76
78
|
const id = getDrawerIdentifier(dictionaryId);
|
|
77
79
|
const { focusedContent, close } = useDictionaryEditionDrawer(dictionaryId);
|
|
78
80
|
const { openDictionaryListDrawer } = useRightDrawerStore((s) => ({
|
|
@@ -97,11 +99,7 @@ const DictionaryEditionDrawer = ({
|
|
|
97
99
|
),
|
|
98
100
|
backButton: {
|
|
99
101
|
onBack: handleOnBack,
|
|
100
|
-
text:
|
|
101
|
-
en: "Dictionary list",
|
|
102
|
-
fr: "Liste des dictionnaires",
|
|
103
|
-
es: "Lista de diccionarios"
|
|
104
|
-
})
|
|
102
|
+
text: backButtonText
|
|
105
103
|
},
|
|
106
104
|
children: focusedContent && /* @__PURE__ */ jsx(
|
|
107
105
|
DictionaryEditionDrawerContent,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/DictionaryEditionDrawer/DictionaryEditionDrawer.tsx"],"sourcesContent":["'use client';\n\nimport type { Locales } from '@intlayer/config/client';\nimport type { Dictionary, KeyPath } from '@intlayer/core';\nimport {\n RightDrawer,\n DictionaryEditor,\n LocaleSwitcher,\n Modal,\n useEditionPanelStore,\n DictionaryFieldEditor,\n useRightDrawerStore,\n} from '@intlayer/design-system';\nimport { useGetAllDictionaries } from '@intlayer/design-system/hooks';\nimport { useCallback, useEffect, useState, type FC } from 'react';\nimport { t } from 'react-intlayer';\nimport { useShallow } from 'zustand/shallow';\nimport { dictionaryListDrawerIdentifier } from '../DictionaryListDrawer/dictionaryListDrawerIdentifier';\nimport {\n type FileContent as FileContentWithDictionaryPath,\n useDictionaryEditionDrawer,\n getDrawerIdentifier,\n} from './useDictionaryEditionDrawer';\n\ntype DictionaryEditionDrawerContentProps = {\n focusedContent: FileContentWithDictionaryPath;\n locale: Locales;\n identifier: string;\n handleOnBack: () => void;\n};\n\nexport const DictionaryEditionDrawerContent: FC<\n DictionaryEditionDrawerContentProps\n> = ({ locale, identifier, handleOnBack }) => {\n const [keyPathEditionModal, setKeyPathEditionModal] = useState<\n KeyPath[] | null\n >(null);\n const { setDictionariesRecord, focusedContent } =\n useDictionaryEditionDrawer(identifier);\n const { all: dictionaries } = useGetAllDictionaries();\n\n const onClickDictionaryList = useCallback(() => {\n setKeyPathEditionModal(null);\n handleOnBack();\n }, [handleOnBack]);\n\n useEffect(() => {\n if (dictionaries) {\n setDictionariesRecord(dictionaries);\n }\n }, [setDictionariesRecord, dictionaries]);\n\n const dictionaryId = focusedContent?.dictionaryId;\n\n if (!dictionaryId) return <>No dictionary focused</>;\n\n const dictionary: Dictionary = dictionaries[dictionaryId];\n\n return (\n <>\n <Modal\n isOpen={keyPathEditionModal !== null}\n onClose={() => setKeyPathEditionModal(null)}\n hasCloseButton\n title={t({\n en: 'Edit field',\n fr: 'Modifier le champ',\n es: 'Editar campo',\n })}\n size=\"xl\"\n transparency=\"lg\"\n >\n {dictionary && (\n <DictionaryFieldEditor\n dictionary={dictionary}\n onClickDictionaryList={onClickDictionaryList}\n />\n )}\n </Modal>\n <DictionaryEditor\n dictionary={dictionary}\n locale={locale}\n onClickEdit={setKeyPathEditionModal}\n />\n </>\n );\n};\n\ntype DictionaryEditionDrawerProps = DictionaryEditionDrawerControllerProps & {\n dictionaryId: string;\n};\n\nexport const DictionaryEditionDrawer: FC<DictionaryEditionDrawerProps> = ({\n locale,\n localeList,\n setLocale,\n dictionaryId,\n}) => {\n const id = getDrawerIdentifier(dictionaryId);\n\n const { focusedContent, close } = useDictionaryEditionDrawer(dictionaryId);\n const { openDictionaryListDrawer } = useRightDrawerStore((s) => ({\n openDictionaryListDrawer: () => s.open(dictionaryListDrawerIdentifier),\n }));\n\n const handleOnBack = () => {\n close();\n openDictionaryListDrawer();\n };\n\n return (\n <RightDrawer\n title={dictionaryId}\n identifier={id}\n header={\n <LocaleSwitcher\n setLocale={setLocale}\n locale={locale}\n localeList={localeList}\n />\n }\n backButton={{\n onBack: handleOnBack,\n text:
|
|
1
|
+
{"version":3,"sources":["../../../src/DictionaryEditionDrawer/DictionaryEditionDrawer.tsx"],"sourcesContent":["'use client';\n\nimport type { Locales } from '@intlayer/config/client';\nimport type { Dictionary, KeyPath } from '@intlayer/core';\nimport {\n RightDrawer,\n DictionaryEditor,\n LocaleSwitcher,\n Modal,\n useEditionPanelStore,\n DictionaryFieldEditor,\n useRightDrawerStore,\n} from '@intlayer/design-system';\nimport { useGetAllDictionaries } from '@intlayer/design-system/hooks';\nimport { useCallback, useEffect, useState, type FC } from 'react';\nimport { t, useDictionary } from 'react-intlayer';\nimport { useShallow } from 'zustand/shallow';\nimport { dictionaryListDrawerIdentifier } from '../DictionaryListDrawer/dictionaryListDrawerIdentifier';\nimport dictionaryEditionDrawerContent from './dictionaryEditionDrawer.content';\nimport {\n type FileContent as FileContentWithDictionaryPath,\n useDictionaryEditionDrawer,\n getDrawerIdentifier,\n} from './useDictionaryEditionDrawer';\n\ntype DictionaryEditionDrawerContentProps = {\n focusedContent: FileContentWithDictionaryPath;\n locale: Locales;\n identifier: string;\n handleOnBack: () => void;\n};\n\nexport const DictionaryEditionDrawerContent: FC<\n DictionaryEditionDrawerContentProps\n> = ({ locale, identifier, handleOnBack }) => {\n const [keyPathEditionModal, setKeyPathEditionModal] = useState<\n KeyPath[] | null\n >(null);\n const { setDictionariesRecord, focusedContent } =\n useDictionaryEditionDrawer(identifier);\n const { all: dictionaries } = useGetAllDictionaries();\n\n const onClickDictionaryList = useCallback(() => {\n setKeyPathEditionModal(null);\n handleOnBack();\n }, [handleOnBack]);\n\n useEffect(() => {\n if (dictionaries) {\n setDictionariesRecord(dictionaries);\n }\n }, [setDictionariesRecord, dictionaries]);\n\n const dictionaryId = focusedContent?.dictionaryId;\n\n if (!dictionaryId) return <>No dictionary focused</>;\n\n const dictionary: Dictionary = dictionaries[dictionaryId];\n\n return (\n <>\n <Modal\n isOpen={keyPathEditionModal !== null}\n onClose={() => setKeyPathEditionModal(null)}\n hasCloseButton\n title={t({\n en: 'Edit field',\n fr: 'Modifier le champ',\n es: 'Editar campo',\n })}\n size=\"xl\"\n transparency=\"lg\"\n >\n {dictionary && (\n <DictionaryFieldEditor\n dictionary={dictionary}\n onClickDictionaryList={onClickDictionaryList}\n />\n )}\n </Modal>\n <DictionaryEditor\n dictionary={dictionary}\n locale={locale}\n onClickEdit={setKeyPathEditionModal}\n />\n </>\n );\n};\n\ntype DictionaryEditionDrawerProps = DictionaryEditionDrawerControllerProps & {\n dictionaryId: string;\n};\n\nexport const DictionaryEditionDrawer: FC<DictionaryEditionDrawerProps> = ({\n locale,\n localeList,\n setLocale,\n dictionaryId,\n}) => {\n const { backButtonText } = useDictionary(dictionaryEditionDrawerContent);\n const id = getDrawerIdentifier(dictionaryId);\n\n const { focusedContent, close } = useDictionaryEditionDrawer(dictionaryId);\n const { openDictionaryListDrawer } = useRightDrawerStore((s) => ({\n openDictionaryListDrawer: () => s.open(dictionaryListDrawerIdentifier),\n }));\n\n const handleOnBack = () => {\n close();\n openDictionaryListDrawer();\n };\n\n return (\n <RightDrawer\n title={dictionaryId}\n identifier={id}\n header={\n <LocaleSwitcher\n setLocale={setLocale}\n locale={locale}\n localeList={localeList}\n />\n }\n backButton={{\n onBack: handleOnBack,\n text: backButtonText,\n }}\n >\n {focusedContent && (\n <DictionaryEditionDrawerContent\n focusedContent={focusedContent}\n locale={locale}\n identifier={id}\n handleOnBack={handleOnBack}\n />\n )}\n </RightDrawer>\n );\n};\n\ntype DictionaryEditionDrawerControllerProps = {\n locale: Locales;\n localeList: Locales[];\n setLocale: (locale: Locales) => void;\n};\n\nexport const DictionaryEditionDrawerController: FC<\n DictionaryEditionDrawerControllerProps\n> = ({ locale, localeList, setLocale }) => {\n const focusedContent = useEditionPanelStore(\n useShallow((s) => s.focusedContent)\n );\n const dictionaryId: string | undefined = focusedContent?.dictionaryId;\n\n if (!dictionaryId) {\n return <></>;\n }\n\n return (\n <DictionaryEditionDrawer\n locale={locale}\n localeList={localeList}\n setLocale={setLocale}\n dictionaryId={dictionaryId}\n />\n );\n};\n"],"mappings":";AAuD4B,wBAKxB,YALwB;AAnD5B;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,6BAA6B;AACtC,SAAS,aAAa,WAAW,gBAAyB;AAC1D,SAAS,GAAG,qBAAqB;AACjC,SAAS,kBAAkB;AAC3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AE,gBAAgB,MAAM,IAAI,2BAA2B,YAAY;AACzE,QAAM,EAAE,yBAAyB,IAAI,oBAAoB,CAAC,OAAO;AAAA,IAC/D,0BAA0B,MAAM,EAAE,KAAK,8BAA8B;AAAA,EACvE,EAAE;AAEF,QAAM,eAAe,MAAM;AACzB,UAAM;AACN,6BAAyB;AAAA,EAC3B;AAEA,SACE;AAAA,IAAC;AAAA;AAAA,MACC,OAAO;AAAA,MACP,YAAY;AAAA,MACZ,QACE;AAAA,QAAC;AAAA;AAAA,UACC;AAAA,UACA;AAAA,UACA;AAAA;AAAA,MACF;AAAA,MAEF,YAAY;AAAA,QACV,QAAQ;AAAA,QACR,MAAM;AAAA,MACR;AAAA,MAEC,4BACC;AAAA,QAAC;AAAA;AAAA,UACC;AAAA,UACA;AAAA,UACA,YAAY;AAAA,UACZ;AAAA;AAAA,MACF;AAAA;AAAA,EAEJ;AAEJ;AAQO,MAAM,oCAET,CAAC,EAAE,QAAQ,YAAY,UAAU,MAAM;AACzC,QAAM,iBAAiB;AAAA,IACrB,WAAW,CAAC,MAAM,EAAE,cAAc;AAAA,EACpC;AACA,QAAM,eAAmC,gBAAgB;AAEzD,MAAI,CAAC,cAAc;AACjB,WAAO,gCAAE;AAAA,EACX;AAEA,SACE;AAAA,IAAC;AAAA;AAAA,MACC;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA;AAAA,EACF;AAEJ;","names":[]}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { t } from "intlayer";
|
|
2
|
+
const dictionaryEditionDrawerContent = {
|
|
3
|
+
key: "dictionary-edition-drawer",
|
|
4
|
+
content: {
|
|
5
|
+
backButtonText: t({
|
|
6
|
+
en: "Dictionary list",
|
|
7
|
+
fr: "Liste des dictionnaires",
|
|
8
|
+
es: "Lista de diccionarios"
|
|
9
|
+
})
|
|
10
|
+
}
|
|
11
|
+
};
|
|
12
|
+
var dictionaryEditionDrawer_content_default = dictionaryEditionDrawerContent;
|
|
13
|
+
export {
|
|
14
|
+
dictionaryEditionDrawer_content_default as default
|
|
15
|
+
};
|
|
16
|
+
//# sourceMappingURL=dictionaryEditionDrawer.content.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/DictionaryEditionDrawer/dictionaryEditionDrawer.content.ts"],"sourcesContent":["import { t, type DeclarationContent } from 'intlayer';\n\nconst dictionaryEditionDrawerContent = {\n key: 'dictionary-edition-drawer',\n content: {\n backButtonText: t({\n en: 'Dictionary list',\n fr: 'Liste des dictionnaires',\n es: 'Lista de diccionarios',\n }),\n },\n} satisfies DeclarationContent;\n\nexport default dictionaryEditionDrawerContent;\n"],"mappings":"AAAA,SAAS,SAAkC;AAE3C,MAAM,iCAAiC;AAAA,EACrC,KAAK;AAAA,EACL,SAAS;AAAA,IACP,gBAAgB,EAAE;AAAA,MAChB,IAAI;AAAA,MACJ,IAAI;AAAA,MACJ,IAAI;AAAA,IACN,CAAC;AAAA,EACH;AACF;AAEA,IAAO,0CAAQ;","names":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DictionaryEditionDrawer.d.ts","sourceRoot":"","sources":["../../../src/DictionaryEditionDrawer/DictionaryEditionDrawer.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AAYvD,OAAO,EAAoC,KAAK,EAAE,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"DictionaryEditionDrawer.d.ts","sourceRoot":"","sources":["../../../src/DictionaryEditionDrawer/DictionaryEditionDrawer.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AAYvD,OAAO,EAAoC,KAAK,EAAE,EAAE,MAAM,OAAO,CAAC;AAKlE,OAAO,EACL,KAAK,WAAW,IAAI,6BAA6B,EAGlD,MAAM,8BAA8B,CAAC;AAEtC,KAAK,mCAAmC,GAAG;IACzC,cAAc,EAAE,6BAA6B,CAAC;IAC9C,MAAM,EAAE,OAAO,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,MAAM,IAAI,CAAC;CAC1B,CAAC;AAEF,eAAO,MAAM,8BAA8B,EAAE,EAAE,CAC7C,mCAAmC,CAsDpC,CAAC;AAEF,KAAK,4BAA4B,GAAG,sCAAsC,GAAG;IAC3E,YAAY,EAAE,MAAM,CAAC;CACtB,CAAC;AAEF,eAAO,MAAM,uBAAuB,EAAE,EAAE,CAAC,4BAA4B,CA6CpE,CAAC;AAEF,KAAK,sCAAsC,GAAG;IAC5C,MAAM,EAAE,OAAO,CAAC;IAChB,UAAU,EAAE,OAAO,EAAE,CAAC;IACtB,SAAS,EAAE,CAAC,MAAM,EAAE,OAAO,KAAK,IAAI,CAAC;CACtC,CAAC;AAEF,eAAO,MAAM,iCAAiC,EAAE,EAAE,CAChD,sCAAsC,CAmBvC,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
declare const dictionaryEditionDrawerContent: {
|
|
2
|
+
key: string;
|
|
3
|
+
content: {
|
|
4
|
+
backButtonText: import("@intlayer/core").TranslationContent<string>;
|
|
5
|
+
};
|
|
6
|
+
};
|
|
7
|
+
export default dictionaryEditionDrawerContent;
|
|
8
|
+
//# sourceMappingURL=dictionaryEditionDrawer.content.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dictionaryEditionDrawer.content.d.ts","sourceRoot":"","sources":["../../../src/DictionaryEditionDrawer/dictionaryEditionDrawer.content.ts"],"names":[],"mappings":"AAEA,QAAA,MAAM,8BAA8B;;;;;CASN,CAAC;AAE/B,eAAe,8BAA8B,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "intlayer-editor",
|
|
3
|
-
"version": "3.5.
|
|
3
|
+
"version": "3.5.4",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "IntLayer Editor is a tool that allow you to edit your IntLayer declaration files using a graphical interface.",
|
|
6
6
|
"keywords": [
|
|
@@ -74,9 +74,10 @@
|
|
|
74
74
|
"react": "^18.3.1",
|
|
75
75
|
"react-dom": "^18.3.1",
|
|
76
76
|
"zustand": "^5.0.1",
|
|
77
|
-
"@intlayer/
|
|
78
|
-
"@intlayer/
|
|
79
|
-
"
|
|
77
|
+
"@intlayer/config": "^3.5.4",
|
|
78
|
+
"@intlayer/core": "^3.5.4",
|
|
79
|
+
"intlayer": "^3.5.4",
|
|
80
|
+
"@intlayer/design-system": "^3.5.4"
|
|
80
81
|
},
|
|
81
82
|
"devDependencies": {
|
|
82
83
|
"@babel/generator": "7.26.2",
|
|
@@ -97,16 +98,17 @@
|
|
|
97
98
|
"tsc-alias": "^1.8.10",
|
|
98
99
|
"tsup": "^8.3.5",
|
|
99
100
|
"typescript": "^5.7.2",
|
|
100
|
-
"@utils/eslint-config": "^1.0.4",
|
|
101
|
-
"@utils/tsup-config": "^1.0.4",
|
|
102
101
|
"@utils/ts-config": "^1.0.4",
|
|
103
|
-
"@utils/
|
|
102
|
+
"@utils/eslint-config": "^1.0.4",
|
|
103
|
+
"@utils/ts-config-types": "^1.0.4",
|
|
104
|
+
"@utils/tsup-config": "^1.0.4"
|
|
104
105
|
},
|
|
105
106
|
"peerDependencies": {
|
|
106
|
-
"@intlayer/
|
|
107
|
-
"
|
|
108
|
-
"@intlayer/
|
|
109
|
-
"
|
|
107
|
+
"@intlayer/core": "^3.5.4",
|
|
108
|
+
"intlayer": "^3.5.4",
|
|
109
|
+
"@intlayer/config": "^3.5.4",
|
|
110
|
+
"@intlayer/design-system": "^3.5.4",
|
|
111
|
+
"react-intlayer": "^3.5.4"
|
|
110
112
|
},
|
|
111
113
|
"engines": {
|
|
112
114
|
"node": ">=14.18"
|