@intlayer/design-system 4.0.2 → 4.0.3
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 +1 -1
- package/dist/.vite/manifest.json +26 -156
- package/dist/components/Accordion/Accordion.cjs +1 -1
- package/dist/components/Accordion/Accordion.cjs.map +1 -1
- package/dist/components/Accordion/Accordion.mjs +1 -1
- package/dist/components/Accordion/Accordion.mjs.map +1 -1
- package/dist/components/DictionaryEditor/DictionaryEditor.cjs +3 -15
- package/dist/components/DictionaryEditor/DictionaryEditor.cjs.map +1 -1
- package/dist/components/DictionaryEditor/DictionaryEditor.d.ts.map +1 -1
- package/dist/components/DictionaryEditor/DictionaryEditor.mjs +3 -15
- package/dist/components/DictionaryEditor/DictionaryEditor.mjs.map +1 -1
- package/dist/components/DictionaryEditor/NodeWrapper/StringWrapper.cjs +2 -2
- package/dist/components/DictionaryEditor/NodeWrapper/StringWrapper.cjs.map +1 -1
- package/dist/components/DictionaryEditor/NodeWrapper/StringWrapper.d.ts.map +1 -1
- package/dist/components/DictionaryEditor/NodeWrapper/StringWrapper.mjs +1 -1
- package/dist/components/DictionaryEditor/NodeWrapper/StringWrapper.mjs.map +1 -1
- package/dist/components/DictionaryEditor/ValidDictionaryChangeButtons.cjs +2 -8
- package/dist/components/DictionaryEditor/ValidDictionaryChangeButtons.cjs.map +1 -1
- package/dist/components/DictionaryEditor/ValidDictionaryChangeButtons.d.ts.map +1 -1
- package/dist/components/DictionaryEditor/ValidDictionaryChangeButtons.mjs +2 -8
- package/dist/components/DictionaryEditor/ValidDictionaryChangeButtons.mjs.map +1 -1
- package/dist/components/DictionaryEditor/index.cjs +0 -8
- package/dist/components/DictionaryEditor/index.cjs.map +1 -1
- package/dist/components/DictionaryEditor/index.d.ts +0 -2
- package/dist/components/DictionaryEditor/index.d.ts.map +1 -1
- package/dist/components/DictionaryEditor/index.mjs +1 -9
- package/dist/components/DictionaryEditor/index.mjs.map +1 -1
- package/dist/components/DictionaryEditor/useEditedContentStore.d.ts +1 -1
- package/dist/components/DictionaryFieldEditor/DictionariesSelector/DictionariesSelector.cjs +2 -20
- package/dist/components/DictionaryFieldEditor/DictionariesSelector/DictionariesSelector.cjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/DictionariesSelector/DictionariesSelector.d.ts.map +1 -1
- package/dist/components/DictionaryFieldEditor/DictionariesSelector/DictionariesSelector.mjs +2 -20
- package/dist/components/DictionaryFieldEditor/DictionariesSelector/DictionariesSelector.mjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/DictionaryFieldEditor.cjs +7 -24
- package/dist/components/DictionaryFieldEditor/DictionaryFieldEditor.cjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/DictionaryFieldEditor.d.ts.map +1 -1
- package/dist/components/DictionaryFieldEditor/DictionaryFieldEditor.mjs +7 -24
- package/dist/components/DictionaryFieldEditor/DictionaryFieldEditor.mjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/EditorView/EditorView.cjs +6 -35
- package/dist/components/DictionaryFieldEditor/EditorView/EditorView.cjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/EditorView/EditorView.d.ts.map +1 -1
- package/dist/components/DictionaryFieldEditor/EditorView/EditorView.mjs +4 -33
- package/dist/components/DictionaryFieldEditor/EditorView/EditorView.mjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/EditorView/TextEditor.cjs +5 -23
- package/dist/components/DictionaryFieldEditor/EditorView/TextEditor.cjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/EditorView/TextEditor.d.ts.map +1 -1
- package/dist/components/DictionaryFieldEditor/EditorView/TextEditor.mjs +5 -23
- package/dist/components/DictionaryFieldEditor/EditorView/TextEditor.mjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/JSONEditor.cjs +2 -29
- package/dist/components/DictionaryFieldEditor/JSONEditor.cjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/JSONEditor.d.ts.map +1 -1
- package/dist/components/DictionaryFieldEditor/JSONEditor.mjs +2 -29
- package/dist/components/DictionaryFieldEditor/JSONEditor.mjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/NavigationView/NavigationViewNode.cjs +8 -33
- package/dist/components/DictionaryFieldEditor/NavigationView/NavigationViewNode.cjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/NavigationView/NavigationViewNode.d.ts.map +1 -1
- package/dist/components/DictionaryFieldEditor/NavigationView/NavigationViewNode.mjs +4 -29
- package/dist/components/DictionaryFieldEditor/NavigationView/NavigationViewNode.mjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/NodeEditor.cjs +6 -38
- package/dist/components/DictionaryFieldEditor/NodeEditor.cjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/NodeEditor.d.ts.map +1 -1
- package/dist/components/DictionaryFieldEditor/NodeEditor.mjs +6 -38
- package/dist/components/DictionaryFieldEditor/NodeEditor.mjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/NodeTypeSelector.cjs +3 -27
- package/dist/components/DictionaryFieldEditor/NodeTypeSelector.cjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/NodeTypeSelector.d.ts.map +1 -1
- package/dist/components/DictionaryFieldEditor/NodeTypeSelector.mjs +3 -27
- package/dist/components/DictionaryFieldEditor/NodeTypeSelector.mjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/SaveForm/SaveForm.cjs +2 -14
- package/dist/components/DictionaryFieldEditor/SaveForm/SaveForm.cjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/SaveForm/SaveForm.d.ts.map +1 -1
- package/dist/components/DictionaryFieldEditor/SaveForm/SaveForm.mjs +2 -14
- package/dist/components/DictionaryFieldEditor/SaveForm/SaveForm.mjs.map +1 -1
- package/dist/components/Modal/Modal.cjs +1 -1
- package/dist/components/Modal/Modal.mjs +1 -1
- package/dist/components/Navbar/MobileNavbar.cjs +1 -1
- package/dist/components/Navbar/MobileNavbar.mjs +1 -1
- package/dist/components/RightDrawer/RightDrawer.cjs +2 -3
- package/dist/components/RightDrawer/RightDrawer.cjs.map +1 -1
- package/dist/components/RightDrawer/RightDrawer.mjs +1 -2
- package/dist/components/RightDrawer/RightDrawer.mjs.map +1 -1
- package/dist/components/index.cjs +0 -8
- package/dist/components/index.cjs.map +1 -1
- package/dist/components/index.mjs +0 -8
- package/dist/components/index.mjs.map +1 -1
- package/dist/hooks/index.cjs +1 -1
- package/dist/hooks/index.mjs +2 -2
- package/dist/hooks/usePersistedStore.cjs +8 -5
- package/dist/hooks/usePersistedStore.cjs.map +1 -1
- package/dist/hooks/usePersistedStore.d.ts +2 -1
- package/dist/hooks/usePersistedStore.d.ts.map +1 -1
- package/dist/hooks/usePersistedStore.mjs +8 -5
- package/dist/hooks/usePersistedStore.mjs.map +1 -1
- package/dist/hooks/useScrollBlockage/index.cjs +5 -31
- package/dist/hooks/useScrollBlockage/index.cjs.map +1 -1
- package/dist/hooks/useScrollBlockage/index.mjs +5 -31
- package/dist/hooks/useScrollBlockage/index.mjs.map +1 -1
- package/dist/hooks/useScrollDetection.cjs +1 -1
- package/dist/hooks/useScrollDetection.mjs +1 -1
- package/dist/index-Cg-S9ry9.cjs +77 -0
- package/dist/index-Cg-S9ry9.cjs.map +1 -0
- package/dist/index-O_7rYrbW.js +78 -0
- package/dist/index-O_7rYrbW.js.map +1 -0
- package/package.json +18 -15
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
"use strict";
|
|
3
3
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
4
4
|
const jsxRuntime = require("../../jsx-runtime-CgFM7lM3.cjs");
|
|
5
|
+
const editorReact = require("@intlayer/editor-react");
|
|
5
6
|
const lucideReact = require("lucide-react");
|
|
6
7
|
const require$$0 = require("react");
|
|
7
8
|
const reactIntlayer = require("react-intlayer");
|
|
8
|
-
const shallow = require("../../shallow-lhDIFtEp.cjs");
|
|
9
9
|
require("../../hooks/useScrollBlockage/useScrollBlockageStore.cjs");
|
|
10
10
|
require("../../hooks/useAsync/useAsyncStateStore.cjs");
|
|
11
11
|
const hooks_intlayerAPIHooks = require("../../hooks/intlayerAPIHooks.cjs");
|
|
@@ -14,7 +14,6 @@ require("deepmerge");
|
|
|
14
14
|
const components_Form_FormBase = require("../Form/FormBase.cjs");
|
|
15
15
|
require("../Form/FormField.cjs");
|
|
16
16
|
const components_Form_layout_FormItemLayout = require("../../Form-CSMiPnjC.cjs");
|
|
17
|
-
const components_DictionaryEditor_useEditedContentStore = require("./useEditedContentStore.cjs");
|
|
18
17
|
const components_DictionaryEditor_validDictionaryChangeButtons_content = require("./validDictionaryChangeButtons.content.cjs");
|
|
19
18
|
const components_DictionaryEditor_validDictionaryChangeButtonsSchema = require("./validDictionaryChangeButtonsSchema.cjs");
|
|
20
19
|
const ValidDictionaryChangeButtons = ({ dictionary }) => {
|
|
@@ -23,12 +22,7 @@ const ValidDictionaryChangeButtons = ({ dictionary }) => {
|
|
|
23
22
|
components_DictionaryEditor_validDictionaryChangeButtons_content.validDictionaryChangeButtonsContent
|
|
24
23
|
);
|
|
25
24
|
const { pushDictionaries } = hooks_intlayerAPIHooks.usePushDictionaries();
|
|
26
|
-
const { editedContent, restoreEditedContent } =
|
|
27
|
-
shallow.useShallow((s) => ({
|
|
28
|
-
editedContent: s.editedContent,
|
|
29
|
-
restoreEditedContent: s.restoreEditedContent
|
|
30
|
-
}))
|
|
31
|
-
);
|
|
25
|
+
const { editedContent, restoreEditedContent } = editorReact.useEditedContent();
|
|
32
26
|
const { form, isSubmitting } = components_Form_FormBase.useForm(
|
|
33
27
|
ValidDictionaryChangeButtonsSchemaSchema
|
|
34
28
|
);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ValidDictionaryChangeButtons.cjs","sources":["../../../src/components/DictionaryEditor/ValidDictionaryChangeButtons.tsx"],"sourcesContent":["'use client';\n\nimport { Dictionary as DistantDictionary } from '@intlayer/backend';\nimport type { Dictionary } from '@intlayer/core';\nimport { ArrowUpFromLine, RotateCcw, Save } from 'lucide-react';\nimport { useMemo, type FC } from 'react';\n// @ts-ignore react-intlayer not build yet\nimport { useDictionary } from 'react-intlayer';\nimport {
|
|
1
|
+
{"version":3,"file":"ValidDictionaryChangeButtons.cjs","sources":["../../../src/components/DictionaryEditor/ValidDictionaryChangeButtons.tsx"],"sourcesContent":["'use client';\n\nimport { Dictionary as DistantDictionary } from '@intlayer/backend';\nimport type { Dictionary } from '@intlayer/core';\nimport { useEditedContent } from '@intlayer/editor-react';\nimport { ArrowUpFromLine, RotateCcw, Save } from 'lucide-react';\nimport { useMemo, type FC } from 'react';\n// @ts-ignore react-intlayer not build yet\nimport { useDictionary } from 'react-intlayer';\nimport { usePushDictionaries } from '../../hooks';\nimport { Form, useForm } from '../Form';\nimport { validDictionaryChangeButtonsContent } from './validDictionaryChangeButtons.content';\nimport { getValidDictionaryChangeButtonsSchemaSchema } from './validDictionaryChangeButtonsSchema';\n\ntype ValidDictionaryChangeButtonsProps = {\n dictionary: Dictionary;\n};\n\nexport const ValidDictionaryChangeButtons: FC<\n ValidDictionaryChangeButtonsProps\n> = ({ dictionary }) => {\n const ValidDictionaryChangeButtonsSchemaSchema =\n getValidDictionaryChangeButtonsSchemaSchema();\n\n const { resetButton, saveButton, publishButton } = useDictionary(\n validDictionaryChangeButtonsContent\n );\n\n const { pushDictionaries } = usePushDictionaries();\n\n const { editedContent, restoreEditedContent } = useEditedContent();\n const { form, isSubmitting } = useForm(\n ValidDictionaryChangeButtonsSchemaSchema\n );\n\n const editedDictionary = useMemo(\n () => editedContent[dictionary.key],\n [editedContent, dictionary.key]\n );\n\n const isEdited = useMemo(\n () =>\n editedDictionary &&\n JSON.stringify(editedDictionary?.content) !==\n JSON.stringify(dictionary?.content),\n [editedDictionary, dictionary]\n );\n\n const isLocalDictionary = useMemo(\n () => typeof (dictionary as DistantDictionary)?._id === 'undefined',\n [dictionary]\n );\n\n const onSubmitSuccess = async () => {\n await pushDictionaries([\n {\n ...dictionary,\n ...editedContent[dictionary.key],\n },\n ]);\n };\n\n return (\n <div className=\"mb-4\">\n <Form\n className=\"flex w-full flex-row flex-wrap justify-end gap-3\"\n {...form}\n schema={ValidDictionaryChangeButtonsSchemaSchema}\n onSubmitSuccess={onSubmitSuccess}\n >\n {isEdited && (\n <Form.Button\n type=\"button\"\n label={resetButton.label}\n disabled={!isEdited || isSubmitting}\n className=\"ml-auto\"\n Icon={RotateCcw}\n variant=\"outline\"\n color=\"text\"\n isFullWidth\n isLoading={isSubmitting}\n onClick={() => restoreEditedContent(dictionary.key)}\n >\n {resetButton.text}\n </Form.Button>\n )}\n {isLocalDictionary ? (\n <Form.Button\n type=\"submit\"\n label={publishButton.label}\n disabled={!isEdited || isSubmitting}\n Icon={ArrowUpFromLine}\n color=\"text\"\n isFullWidth\n isLoading={isSubmitting}\n >\n {publishButton.text}\n </Form.Button>\n ) : (\n isEdited && (\n <Form.Button\n type=\"submit\"\n label={saveButton.label}\n disabled={!isEdited || isSubmitting}\n Icon={Save}\n color=\"text\"\n isFullWidth\n isLoading={isSubmitting}\n >\n {saveButton.text}\n </Form.Button>\n )\n )}\n </Form>\n </div>\n );\n};\n"],"names":["getValidDictionaryChangeButtonsSchemaSchema","useDictionary","validDictionaryChangeButtonsContent","usePushDictionaries","useEditedContent","useForm","useMemo","jsx","jsxs","Form","RotateCcw","ArrowUpFromLine","Save"],"mappings":";;;;;;;;;;;;;;;;;;AAkBO,MAAM,+BAET,CAAC,EAAE,iBAAiB;AACtB,QAAM,2CACJA,+DAAAA,4CAA4C;AAE9C,QAAM,EAAE,aAAa,YAAY,cAAkB,IAAAC,cAAA;AAAA,IACjDC,iEAAAA;AAAAA,EACF;AAEM,QAAA,EAAE,iBAAiB,IAAIC,2CAAoB;AAEjD,QAAM,EAAE,eAAe,qBAAqB,IAAIC,6BAAiB;AAC3D,QAAA,EAAE,MAAM,aAAA,IAAiBC,yBAAA;AAAA,IAC7B;AAAA,EACF;AAEA,QAAM,mBAAmBC,WAAA;AAAA,IACvB,MAAM,cAAc,WAAW,GAA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A,UAAA;AAAA,YAGjB,YACEJ,2BAAA,kBAAA;AAAA,UAACE,sCAAAA,KAAK;AAAA,UAAL;AAAA,YACC,MAAK;AAAA,YACL,OAAO,WAAW;AAAA,YAClB,UAAU,CAAC,YAAY;AAAA,YACvB,MAAMG,YAAA;AAAA,YACN,OAAM;AAAA,YACN,aAAW;AAAA,YACX,WAAW;AAAA,YAEV,UAAW,WAAA;AAAA,UAAA;AAAA,QAAA;AAAA,MACd;AAAA,IAAA;AAAA,EAAA,GAIR;AAEJ;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ValidDictionaryChangeButtons.d.ts","sourceRoot":"","sources":["../../../src/components/DictionaryEditor/ValidDictionaryChangeButtons.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"ValidDictionaryChangeButtons.d.ts","sourceRoot":"","sources":["../../../src/components/DictionaryEditor/ValidDictionaryChangeButtons.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAGjD,OAAO,EAAW,KAAK,EAAE,EAAE,MAAM,OAAO,CAAC;AAQzC,KAAK,iCAAiC,GAAG;IACvC,UAAU,EAAE,UAAU,CAAC;CACxB,CAAC;AAEF,eAAO,MAAM,4BAA4B,EAAE,EAAE,CAC3C,iCAAiC,CAiGlC,CAAC"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { j as jsxRuntimeExports } from "../../jsx-runtime-DQkoUcjV.js";
|
|
3
|
+
import { useEditedContent } from "@intlayer/editor-react";
|
|
3
4
|
import { RotateCcw, ArrowUpFromLine, Save } from "lucide-react";
|
|
4
5
|
import { useMemo } from "react";
|
|
5
6
|
import { useDictionary } from "react-intlayer";
|
|
6
|
-
import { u as useShallow } from "../../shallow-m9BpCkKh.js";
|
|
7
7
|
import "../../hooks/useScrollBlockage/useScrollBlockageStore.mjs";
|
|
8
8
|
import "../../hooks/useAsync/useAsyncStateStore.mjs";
|
|
9
9
|
import { usePushDictionaries } from "../../hooks/intlayerAPIHooks.mjs";
|
|
@@ -12,7 +12,6 @@ import "deepmerge";
|
|
|
12
12
|
import { useForm } from "../Form/FormBase.mjs";
|
|
13
13
|
import "../Form/FormField.mjs";
|
|
14
14
|
import { F as Form } from "../../Form-DlqjTz3u.js";
|
|
15
|
-
import { useEditedContentStore } from "./useEditedContentStore.mjs";
|
|
16
15
|
import { validDictionaryChangeButtonsContent } from "./validDictionaryChangeButtons.content.mjs";
|
|
17
16
|
import { getValidDictionaryChangeButtonsSchemaSchema } from "./validDictionaryChangeButtonsSchema.mjs";
|
|
18
17
|
const ValidDictionaryChangeButtons = ({ dictionary }) => {
|
|
@@ -21,12 +20,7 @@ const ValidDictionaryChangeButtons = ({ dictionary }) => {
|
|
|
21
20
|
validDictionaryChangeButtonsContent
|
|
22
21
|
);
|
|
23
22
|
const { pushDictionaries } = usePushDictionaries();
|
|
24
|
-
const { editedContent, restoreEditedContent } =
|
|
25
|
-
useShallow((s) => ({
|
|
26
|
-
editedContent: s.editedContent,
|
|
27
|
-
restoreEditedContent: s.restoreEditedContent
|
|
28
|
-
}))
|
|
29
|
-
);
|
|
23
|
+
const { editedContent, restoreEditedContent } = useEditedContent();
|
|
30
24
|
const { form, isSubmitting } = useForm(
|
|
31
25
|
ValidDictionaryChangeButtonsSchemaSchema
|
|
32
26
|
);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ValidDictionaryChangeButtons.mjs","sources":["../../../src/components/DictionaryEditor/ValidDictionaryChangeButtons.tsx"],"sourcesContent":["'use client';\n\nimport { Dictionary as DistantDictionary } from '@intlayer/backend';\nimport type { Dictionary } from '@intlayer/core';\nimport { ArrowUpFromLine, RotateCcw, Save } from 'lucide-react';\nimport { useMemo, type FC } from 'react';\n// @ts-ignore react-intlayer not build yet\nimport { useDictionary } from 'react-intlayer';\nimport {
|
|
1
|
+
{"version":3,"file":"ValidDictionaryChangeButtons.mjs","sources":["../../../src/components/DictionaryEditor/ValidDictionaryChangeButtons.tsx"],"sourcesContent":["'use client';\n\nimport { Dictionary as DistantDictionary } from '@intlayer/backend';\nimport type { Dictionary } from '@intlayer/core';\nimport { useEditedContent } from '@intlayer/editor-react';\nimport { ArrowUpFromLine, RotateCcw, Save } from 'lucide-react';\nimport { useMemo, type FC } from 'react';\n// @ts-ignore react-intlayer not build yet\nimport { useDictionary } from 'react-intlayer';\nimport { usePushDictionaries } from '../../hooks';\nimport { Form, useForm } from '../Form';\nimport { validDictionaryChangeButtonsContent } from './validDictionaryChangeButtons.content';\nimport { getValidDictionaryChangeButtonsSchemaSchema } from './validDictionaryChangeButtonsSchema';\n\ntype ValidDictionaryChangeButtonsProps = {\n dictionary: Dictionary;\n};\n\nexport const ValidDictionaryChangeButtons: FC<\n ValidDictionaryChangeButtonsProps\n> = ({ dictionary }) => {\n const ValidDictionaryChangeButtonsSchemaSchema =\n getValidDictionaryChangeButtonsSchemaSchema();\n\n const { resetButton, saveButton, publishButton } = useDictionary(\n validDictionaryChangeButtonsContent\n );\n\n const { pushDictionaries } = usePushDictionaries();\n\n const { editedContent, restoreEditedContent } = useEditedContent();\n const { form, isSubmitting } = useForm(\n ValidDictionaryChangeButtonsSchemaSchema\n );\n\n const editedDictionary = useMemo(\n () => editedContent[dictionary.key],\n [editedContent, dictionary.key]\n );\n\n const isEdited = useMemo(\n () =>\n editedDictionary &&\n JSON.stringify(editedDictionary?.content) !==\n JSON.stringify(dictionary?.content),\n [editedDictionary, dictionary]\n );\n\n const isLocalDictionary = useMemo(\n () => typeof (dictionary as DistantDictionary)?._id === 'undefined',\n [dictionary]\n );\n\n const onSubmitSuccess = async () => {\n await pushDictionaries([\n {\n ...dictionary,\n ...editedContent[dictionary.key],\n },\n ]);\n };\n\n return (\n <div className=\"mb-4\">\n <Form\n className=\"flex w-full flex-row flex-wrap justify-end gap-3\"\n {...form}\n schema={ValidDictionaryChangeButtonsSchemaSchema}\n onSubmitSuccess={onSubmitSuccess}\n >\n {isEdited && (\n <Form.Button\n type=\"button\"\n label={resetButton.label}\n disabled={!isEdited || isSubmitting}\n className=\"ml-auto\"\n Icon={RotateCcw}\n variant=\"outline\"\n color=\"text\"\n isFullWidth\n isLoading={isSubmitting}\n onClick={() => restoreEditedContent(dictionary.key)}\n >\n {resetButton.text}\n </Form.Button>\n )}\n {isLocalDictionary ? (\n <Form.Button\n type=\"submit\"\n label={publishButton.label}\n disabled={!isEdited || isSubmitting}\n Icon={ArrowUpFromLine}\n color=\"text\"\n isFullWidth\n isLoading={isSubmitting}\n >\n {publishButton.text}\n </Form.Button>\n ) : (\n isEdited && (\n <Form.Button\n type=\"submit\"\n label={saveButton.label}\n disabled={!isEdited || isSubmitting}\n Icon={Save}\n color=\"text\"\n isFullWidth\n isLoading={isSubmitting}\n >\n {saveButton.text}\n </Form.Button>\n )\n )}\n </Form>\n </div>\n );\n};\n"],"names":["jsx","jsxs"],"mappings":";;;;;;;;;;;;;;;;AAkBO,MAAM,+BAET,CAAC,EAAE,iBAAiB;AACtB,QAAM,2CACJ,4CAA4C;AAE9C,QAAM,EAAE,aAAa,YAAY,cAAkB,IAAA;AAAA,IACjD;AAAA,EACF;AAEM,QAAA,EAAE,iBAAiB,IAAI,oBAAoB;AAEjD,QAAM,EAAE,eAAe,qBAAqB,IAAI,iBAAiB;AAC3D,QAAA,EAAE,MAAM,aAAA,IAAiB;AAAA,IAC7B;AAAA,EACF;AAEA,QAAM,mBAAmB;AAAA,IACvB,MAAM,cAAc,WAAW,GAAG;AAAA,IAClC,CAAC,eAAe,WAAW,GAAG;AAAA,EAChC;AAEA,QAAM,WAAW;AAAA,IACf,MACE,oBACA,KAAK,UAAU,kBAAkB,OAAO,MACtC,KAAK,UAAU,YAAY,OAAO;AAAA,IACtC,CAAC,kBAAkB,UAAU;AAAA,EAC/B;AAEA,QAAM,oBAAoB;AAAA,IACxB,MAAM,OA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13 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const components_DictionaryEditor_useEditedContentStore = require("./useEditedContentStore.cjs");
|
|
4
|
-
const components_DictionaryEditor_useEditionPanelStore = require("./useEditionPanelStore.cjs");
|
|
5
3
|
const components_DictionaryEditor_DictionaryEditor = require("./DictionaryEditor.cjs");
|
|
6
|
-
const utils_dictionary = require("../../utils/dictionary.cjs");
|
|
7
|
-
exports.useEditedContentStore = components_DictionaryEditor_useEditedContentStore.useEditedContentStore;
|
|
8
|
-
exports.useEditionPanelStore = components_DictionaryEditor_useEditionPanelStore.useEditionPanelStore;
|
|
9
4
|
exports.DictionaryEditor = components_DictionaryEditor_DictionaryEditor.DictionaryEditor;
|
|
10
|
-
exports.editDictionaryByKeyPath = utils_dictionary.editDictionaryByKeyPath;
|
|
11
|
-
exports.getDictionaryValueByKeyPath = utils_dictionary.getDictionaryValueByKeyPath;
|
|
12
|
-
exports.renameDictionaryValueByKeyPath = utils_dictionary.renameDictionaryValueByKeyPath;
|
|
13
5
|
//# sourceMappingURL=index.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/DictionaryEditor/index.tsx"],"names":[],"mappings":"AAAA,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/DictionaryEditor/index.tsx"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC"}
|
|
@@ -1,13 +1,5 @@
|
|
|
1
|
-
import { useEditedContentStore } from "./useEditedContentStore.mjs";
|
|
2
|
-
import { useEditionPanelStore } from "./useEditionPanelStore.mjs";
|
|
3
1
|
import { DictionaryEditor } from "./DictionaryEditor.mjs";
|
|
4
|
-
import { editDictionaryByKeyPath, getDictionaryValueByKeyPath, renameDictionaryValueByKeyPath } from "../../utils/dictionary.mjs";
|
|
5
2
|
export {
|
|
6
|
-
DictionaryEditor
|
|
7
|
-
editDictionaryByKeyPath,
|
|
8
|
-
getDictionaryValueByKeyPath,
|
|
9
|
-
renameDictionaryValueByKeyPath,
|
|
10
|
-
useEditedContentStore,
|
|
11
|
-
useEditionPanelStore
|
|
3
|
+
DictionaryEditor
|
|
12
4
|
};
|
|
13
5
|
//# sourceMappingURL=index.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Dictionary, DictionaryValue, KeyPath } from '@intlayer/core';
|
|
2
|
-
export { editDictionaryByKeyPath, getDictionaryValueByKeyPath, renameDictionaryValueByKeyPath, } from '
|
|
2
|
+
export { editDictionaryByKeyPath, getDictionaryValueByKeyPath, renameDictionaryValueByKeyPath, } from '../../../../core/src/dictionaryUtils';
|
|
3
3
|
export type DictionaryContent = Record<Dictionary['key'], Dictionary>;
|
|
4
4
|
type EditedContentStore = {
|
|
5
5
|
dictionariesRecord: DictionaryContent;
|
|
@@ -2,29 +2,15 @@
|
|
|
2
2
|
"use strict";
|
|
3
3
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
4
4
|
const jsxRuntime = require("../../../jsx-runtime-CgFM7lM3.cjs");
|
|
5
|
+
const editorReact = require("@intlayer/editor-react");
|
|
5
6
|
const require$$0 = require("react");
|
|
6
7
|
const reactIntlayer = require("react-intlayer");
|
|
7
|
-
const shallow = require("../../../shallow-lhDIFtEp.cjs");
|
|
8
8
|
require("../../../hooks/useScrollBlockage/useScrollBlockageStore.cjs");
|
|
9
9
|
require("../../../hooks/useAsync/useAsyncStateStore.cjs");
|
|
10
10
|
require("../../../index-DFc7og1d.cjs");
|
|
11
11
|
require("@intlayer/config/client");
|
|
12
12
|
require("../../Toaster/Toast.cjs");
|
|
13
13
|
const hooks_useGetAllDictionaries = require("../../../hooks/useGetAllDictionaries.cjs");
|
|
14
|
-
require("../../DictionaryEditor/useEditedContentStore.cjs");
|
|
15
|
-
const components_DictionaryEditor_useEditionPanelStore = require("../../DictionaryEditor/useEditionPanelStore.cjs");
|
|
16
|
-
require("@intlayer/core");
|
|
17
|
-
require("lucide-react");
|
|
18
|
-
require("clsx");
|
|
19
|
-
require("tailwind-merge");
|
|
20
|
-
require("../../Button/Button.cjs");
|
|
21
|
-
require("../../EditableField/EditableFieldInput.cjs");
|
|
22
|
-
require("../../EditableField/EditableFieldTextArea.cjs");
|
|
23
|
-
require("../../Form/FormBase.cjs");
|
|
24
|
-
require("../../Form/FormField.cjs");
|
|
25
|
-
require("../../../Form-CSMiPnjC.cjs");
|
|
26
|
-
require("../../DictionaryEditor/validDictionaryChangeButtons.content.cjs");
|
|
27
|
-
require("zod");
|
|
28
14
|
const components_Loader_index = require("../../Loader/index.cjs");
|
|
29
15
|
const components_DictionaryFieldEditor_DictionaryFieldEditor = require("../DictionaryFieldEditor.cjs");
|
|
30
16
|
const components_DictionaryFieldEditor_DictionariesSelector_dictionariesSelector_content = require("./dictionariesSelector.content.cjs");
|
|
@@ -34,11 +20,7 @@ const DictionariesSelector = ({
|
|
|
34
20
|
availableLocales
|
|
35
21
|
}) => {
|
|
36
22
|
const { online, locale, isLoading } = hooks_useGetAllDictionaries.useGetAllDictionaries();
|
|
37
|
-
const { focusedContent } =
|
|
38
|
-
shallow.useShallow((s) => ({
|
|
39
|
-
focusedContent: s.focusedContent
|
|
40
|
-
}))
|
|
41
|
-
);
|
|
23
|
+
const { focusedContent } = editorReact.useFocusDictionary();
|
|
42
24
|
const { noDictionaryMessage, dictionaryNotFoundMessage } = reactIntlayer.useDictionary(
|
|
43
25
|
components_DictionaryFieldEditor_DictionariesSelector_dictionariesSelector_content.dictionariesSelectorContent
|
|
44
26
|
);
|
package/dist/components/DictionaryFieldEditor/DictionariesSelector/DictionariesSelector.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DictionariesSelector.cjs","sources":["../../../../src/components/DictionaryFieldEditor/DictionariesSelector/DictionariesSelector.tsx"],"sourcesContent":["'use client';\n\nimport { Locales } from '@intlayer/config';\nimport { useMemo, type FC } from 'react';\n// @ts-ignore react-intlayer not build yet\nimport { useDictionary } from 'react-intlayer';\nimport {
|
|
1
|
+
{"version":3,"file":"DictionariesSelector.cjs","sources":["../../../../src/components/DictionaryFieldEditor/DictionariesSelector/DictionariesSelector.tsx"],"sourcesContent":["'use client';\n\nimport { Locales } from '@intlayer/config';\nimport { useFocusDictionary } from '@intlayer/editor-react';\nimport { useMemo, type FC } from 'react';\n// @ts-ignore react-intlayer not build yet\nimport { useDictionary } from 'react-intlayer';\nimport { useGetAllDictionaries } from '../../../hooks';\nimport { Loader } from '../../Loader';\nimport { DictionaryFieldEditor } from '../DictionaryFieldEditor';\nimport { dictionariesSelectorContent } from './dictionariesSelector.content';\n\ntype DictionariesSelectorProps = {\n onClickDictionaryList: () => void;\n isDarkMode?: boolean;\n availableLocales: Locales[];\n};\n\nexport const DictionariesSelector: FC<DictionariesSelectorProps> = ({\n onClickDictionaryList,\n isDarkMode,\n availableLocales,\n}) => {\n const { online, locale, isLoading } = useGetAllDictionaries();\n const { focusedContent } = useFocusDictionary();\n const { noDictionaryMessage, dictionaryNotFoundMessage } = useDictionary(\n dictionariesSelectorContent\n );\n const dictionary = useMemo(\n () =>\n focusedContent?.dictionaryKey\n ? (online?.[focusedContent?.dictionaryKey] ??\n locale?.[focusedContent?.dictionaryKey])\n : null,\n [online, locale, focusedContent?.dictionaryKey]\n );\n\n if (isLoading) return <Loader />;\n\n if (!focusedContent?.dictionaryKey) return noDictionaryMessage;\n\n if (!dictionary) return dictionaryNotFoundMessage;\n\n return (\n <DictionaryFieldEditor\n dictionary={dictionary}\n onClickDictionaryList={onClickDictionaryList}\n isDarkMode={isDarkMode}\n availableLocales={availableLocales}\n />\n );\n};\n"],"names":["useGetAllDictionaries","useFocusDictionary","useDictionary","dictionariesSelectorContent","useMemo","jsx","Loader","DictionaryFieldEditor"],"mappings":";;;;;;;;;;;;;;;;AAkBO,MAAM,uBAAsD,CAAC;AAAA,EAClE;AAAA,EACA;AAAA,EACA;AACF,MAAM;AACJ,QAAM,EAAE,QAAQ,QAAQ,UAAA,IAAcA,4BAAAA,sBAAsB;AACtD,QAAA,EAAE,eAAe,IAAIC,+BAAmB;AACxC,QAAA,EAAE,qBAAqB,0BAAA,IAA8BC,cAAA;AAAA,IACzDC,mFAAAA;AAAAA,EACF;AACA,QAAM,aAAaC,WAAA;AAAA,IACjB,MACE,gBAAgB,gBACX,SAAS,gBAAgB,aAAa,KACvC,SAAS,gBAAgB,aAAa,IACtC;AAAA,IACN,CAAC,QAAQ,QAAQ,gBAAgB,aAAa;AAAA,EAChD;AAEI,MAAA,UAAkB,QAAAC,iDAACC,wBAAAA,QAAO,CAAA,CAAA;AAE1B,MAAA,CAAC,gBAAgB,cAAsB,QAAA;AAEvC,MAAA,CAAC,WAAmB,QAAA;AAGtB,SAAAD,2BAAA,kBAAA;AAAA,IAACE,uDAAA;AAAA,IAAA;AAAA,MACC;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IAAA;AAAA,EACF;AAEJ;;"}
|
package/dist/components/DictionaryFieldEditor/DictionariesSelector/DictionariesSelector.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DictionariesSelector.d.ts","sourceRoot":"","sources":["../../../../src/components/DictionaryFieldEditor/DictionariesSelector/DictionariesSelector.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"DictionariesSelector.d.ts","sourceRoot":"","sources":["../../../../src/components/DictionaryFieldEditor/DictionariesSelector/DictionariesSelector.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAE3C,OAAO,EAAW,KAAK,EAAE,EAAE,MAAM,OAAO,CAAC;AAQzC,KAAK,yBAAyB,GAAG;IAC/B,qBAAqB,EAAE,MAAM,IAAI,CAAC;IAClC,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,gBAAgB,EAAE,OAAO,EAAE,CAAC;CAC7B,CAAC;AAEF,eAAO,MAAM,oBAAoB,EAAE,EAAE,CAAC,yBAAyB,CAiC9D,CAAC"}
|
|
@@ -1,28 +1,14 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { j as jsxRuntimeExports } from "../../../jsx-runtime-DQkoUcjV.js";
|
|
3
|
+
import { useFocusDictionary } from "@intlayer/editor-react";
|
|
3
4
|
import { useMemo } from "react";
|
|
4
5
|
import { useDictionary } from "react-intlayer";
|
|
5
|
-
import { u as useShallow } from "../../../shallow-m9BpCkKh.js";
|
|
6
6
|
import "../../../hooks/useScrollBlockage/useScrollBlockageStore.mjs";
|
|
7
7
|
import "../../../hooks/useAsync/useAsyncStateStore.mjs";
|
|
8
8
|
import "../../../index-DcWYZrJW.js";
|
|
9
9
|
import "@intlayer/config/client";
|
|
10
10
|
import "../../Toaster/Toast.mjs";
|
|
11
11
|
import { useGetAllDictionaries } from "../../../hooks/useGetAllDictionaries.mjs";
|
|
12
|
-
import "../../DictionaryEditor/useEditedContentStore.mjs";
|
|
13
|
-
import { useEditionPanelStore } from "../../DictionaryEditor/useEditionPanelStore.mjs";
|
|
14
|
-
import "@intlayer/core";
|
|
15
|
-
import "lucide-react";
|
|
16
|
-
import "clsx";
|
|
17
|
-
import "tailwind-merge";
|
|
18
|
-
import "../../Button/Button.mjs";
|
|
19
|
-
import "../../EditableField/EditableFieldInput.mjs";
|
|
20
|
-
import "../../EditableField/EditableFieldTextArea.mjs";
|
|
21
|
-
import "../../Form/FormBase.mjs";
|
|
22
|
-
import "../../Form/FormField.mjs";
|
|
23
|
-
import "../../../Form-DlqjTz3u.js";
|
|
24
|
-
import "../../DictionaryEditor/validDictionaryChangeButtons.content.mjs";
|
|
25
|
-
import "zod";
|
|
26
12
|
import { Loader } from "../../Loader/index.mjs";
|
|
27
13
|
import { DictionaryFieldEditor } from "../DictionaryFieldEditor.mjs";
|
|
28
14
|
import { dictionariesSelectorContent } from "./dictionariesSelector.content.mjs";
|
|
@@ -32,11 +18,7 @@ const DictionariesSelector = ({
|
|
|
32
18
|
availableLocales
|
|
33
19
|
}) => {
|
|
34
20
|
const { online, locale, isLoading } = useGetAllDictionaries();
|
|
35
|
-
const { focusedContent } =
|
|
36
|
-
useShallow((s) => ({
|
|
37
|
-
focusedContent: s.focusedContent
|
|
38
|
-
}))
|
|
39
|
-
);
|
|
21
|
+
const { focusedContent } = useFocusDictionary();
|
|
40
22
|
const { noDictionaryMessage, dictionaryNotFoundMessage } = useDictionary(
|
|
41
23
|
dictionariesSelectorContent
|
|
42
24
|
);
|
package/dist/components/DictionaryFieldEditor/DictionariesSelector/DictionariesSelector.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DictionariesSelector.mjs","sources":["../../../../src/components/DictionaryFieldEditor/DictionariesSelector/DictionariesSelector.tsx"],"sourcesContent":["'use client';\n\nimport { Locales } from '@intlayer/config';\nimport { useMemo, type FC } from 'react';\n// @ts-ignore react-intlayer not build yet\nimport { useDictionary } from 'react-intlayer';\nimport {
|
|
1
|
+
{"version":3,"file":"DictionariesSelector.mjs","sources":["../../../../src/components/DictionaryFieldEditor/DictionariesSelector/DictionariesSelector.tsx"],"sourcesContent":["'use client';\n\nimport { Locales } from '@intlayer/config';\nimport { useFocusDictionary } from '@intlayer/editor-react';\nimport { useMemo, type FC } from 'react';\n// @ts-ignore react-intlayer not build yet\nimport { useDictionary } from 'react-intlayer';\nimport { useGetAllDictionaries } from '../../../hooks';\nimport { Loader } from '../../Loader';\nimport { DictionaryFieldEditor } from '../DictionaryFieldEditor';\nimport { dictionariesSelectorContent } from './dictionariesSelector.content';\n\ntype DictionariesSelectorProps = {\n onClickDictionaryList: () => void;\n isDarkMode?: boolean;\n availableLocales: Locales[];\n};\n\nexport const DictionariesSelector: FC<DictionariesSelectorProps> = ({\n onClickDictionaryList,\n isDarkMode,\n availableLocales,\n}) => {\n const { online, locale, isLoading } = useGetAllDictionaries();\n const { focusedContent } = useFocusDictionary();\n const { noDictionaryMessage, dictionaryNotFoundMessage } = useDictionary(\n dictionariesSelectorContent\n );\n const dictionary = useMemo(\n () =>\n focusedContent?.dictionaryKey\n ? (online?.[focusedContent?.dictionaryKey] ??\n locale?.[focusedContent?.dictionaryKey])\n : null,\n [online, locale, focusedContent?.dictionaryKey]\n );\n\n if (isLoading) return <Loader />;\n\n if (!focusedContent?.dictionaryKey) return noDictionaryMessage;\n\n if (!dictionary) return dictionaryNotFoundMessage;\n\n return (\n <DictionaryFieldEditor\n dictionary={dictionary}\n onClickDictionaryList={onClickDictionaryList}\n isDarkMode={isDarkMode}\n availableLocales={availableLocales}\n />\n );\n};\n"],"names":["jsx"],"mappings":";;;;;;;;;;;;;;AAkBO,MAAM,uBAAsD,CAAC;AAAA,EAClE;AAAA,EACA;AAAA,EACA;AACF,MAAM;AACJ,QAAM,EAAE,QAAQ,QAAQ,UAAA,IAAc,sBAAsB;AACtD,QAAA,EAAE,eAAe,IAAI,mBAAmB;AACxC,QAAA,EAAE,qBAAqB,0BAAA,IAA8B;AAAA,IACzD;AAAA,EACF;AACA,QAAM,aAAa;AAAA,IACjB,MACE,gBAAgB,gBACX,SAAS,gBAAgB,aAAa,KACvC,SAAS,gBAAgB,aAAa,IACtC;AAAA,IACN,CAAC,QAAQ,QAAQ,gBAAgB,aAAa;AAAA,EAChD;AAEI,MAAA,UAAkB,QAAAA,sCAAC,QAAO,CAAA,CAAA;AAE1B,MAAA,CAAC,gBAAgB,cAAsB,QAAA;AAEvC,MAAA,CAAC,WAAmB,QAAA;AAGtB,SAAAA,kCAAA;AAAA,IAAC;AAAA,IAAA;AAAA,MACC;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IAAA;AAAA,EACF;AAEJ;"}
|
|
@@ -2,33 +2,22 @@
|
|
|
2
2
|
"use strict";
|
|
3
3
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
4
4
|
const jsxRuntime = require("../../jsx-runtime-CgFM7lM3.cjs");
|
|
5
|
+
const editorReact = require("@intlayer/editor-react");
|
|
5
6
|
const lucideReact = require("lucide-react");
|
|
6
7
|
const require$$0 = require("react");
|
|
7
8
|
const reactIntlayer = require("react-intlayer");
|
|
8
|
-
const shallow = require("../../shallow-lhDIFtEp.cjs");
|
|
9
9
|
const components_Button_Button = require("../Button/Button.cjs");
|
|
10
10
|
const components_Container_index = require("../Container/index.cjs");
|
|
11
|
-
const
|
|
12
|
-
require("
|
|
11
|
+
const components_Headers_index = require("../Headers/index.cjs");
|
|
12
|
+
require("@intlayer/config/client");
|
|
13
13
|
require("@intlayer/core");
|
|
14
|
-
require("
|
|
15
|
-
require("tailwind-merge");
|
|
16
|
-
require("../EditableField/EditableFieldInput.cjs");
|
|
17
|
-
require("../EditableField/EditableFieldTextArea.cjs");
|
|
14
|
+
require("fuse.js");
|
|
18
15
|
require("../../hooks/useScrollBlockage/useScrollBlockageStore.cjs");
|
|
19
16
|
require("../../hooks/useAsync/useAsyncStateStore.cjs");
|
|
20
17
|
require("../../index-DFc7og1d.cjs");
|
|
21
|
-
require("@intlayer/config/client");
|
|
22
18
|
require("../Toaster/Toast.cjs");
|
|
23
19
|
require("@intlayer/dictionaries-entry");
|
|
24
20
|
require("deepmerge");
|
|
25
|
-
require("../Form/FormBase.cjs");
|
|
26
|
-
require("../Form/FormField.cjs");
|
|
27
|
-
require("../../Form-CSMiPnjC.cjs");
|
|
28
|
-
require("../DictionaryEditor/validDictionaryChangeButtons.content.cjs");
|
|
29
|
-
require("zod");
|
|
30
|
-
const components_Headers_index = require("../Headers/index.cjs");
|
|
31
|
-
require("fuse.js");
|
|
32
21
|
require("../DropDown/index.cjs");
|
|
33
22
|
require("../Input/Input.cjs");
|
|
34
23
|
require("../Input/InputPassword.cjs");
|
|
@@ -52,20 +41,14 @@ const DictionaryFieldEditor = ({
|
|
|
52
41
|
0
|
|
53
42
|
/* NodeEditor */
|
|
54
43
|
);
|
|
55
|
-
const {
|
|
56
|
-
shallow.useShallow((s) => ({
|
|
57
|
-
editedContent: s.editedContent,
|
|
58
|
-
dictionaryRecord: s.dictionariesRecord,
|
|
59
|
-
setDictionariesRecord: s.setDictionariesRecord
|
|
60
|
-
}))
|
|
61
|
-
);
|
|
44
|
+
const { dictionariesRecord, setDictionariesRecord } = editorReact.useDictionariesRecord();
|
|
62
45
|
const { returnToDictionaryList, titleContent, titleInformation } = reactIntlayer.useDictionary(components_DictionaryFieldEditor_dictionaryFieldEditor_content.dictionaryFieldEditorContent);
|
|
63
46
|
require$$0.useEffect(() => {
|
|
64
|
-
if (
|
|
47
|
+
if (dictionariesRecord[key]) return;
|
|
65
48
|
setDictionariesRecord({
|
|
66
49
|
[key]: dictionary
|
|
67
50
|
});
|
|
68
|
-
}, [dictionary, key, setDictionariesRecord,
|
|
51
|
+
}, [dictionary, key, setDictionariesRecord, dictionariesRecord]);
|
|
69
52
|
return /* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsx(components_LocaleSwitcherContentDropDown_LocaleSwitcherContentContext.LocaleSwitcherContentProvider, { availableLocales, children: /* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsxs("div", { className: "flex size-full flex-1 flex-col gap-10", children: [
|
|
70
53
|
/* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-2", children: [
|
|
71
54
|
/* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsx(
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DictionaryFieldEditor.cjs","sources":["../../../src/components/DictionaryFieldEditor/DictionaryFieldEditor.tsx"],"sourcesContent":["'use client';\n\nimport { Locales } from '@intlayer/config';\nimport { Dictionary } from '@intlayer/core';\nimport { ArrowLeft } from 'lucide-react';\nimport { useEffect, useState, type FC } from 'react';\n// @ts-ignore react-intlayer not build yet\nimport { useDictionary } from 'react-intlayer';\nimport {
|
|
1
|
+
{"version":3,"file":"DictionaryFieldEditor.cjs","sources":["../../../src/components/DictionaryFieldEditor/DictionaryFieldEditor.tsx"],"sourcesContent":["'use client';\n\nimport { Locales } from '@intlayer/config';\nimport { Dictionary } from '@intlayer/core';\nimport { useDictionariesRecord } from '@intlayer/editor-react';\nimport { ArrowLeft } from 'lucide-react';\nimport { useEffect, useState, type FC } from 'react';\n// @ts-ignore react-intlayer not build yet\nimport { useDictionary } from 'react-intlayer';\nimport { Button } from '../Button';\nimport { Container } from '../Container';\nimport { H2 } from '../Headers';\nimport { LocaleSwitcherContentProvider } from '../LocaleSwitcherContentDropDown';\nimport { SwitchSelector } from '../SwitchSelector';\nimport { DictionaryDetailsForm } from './DictionaryDetails/DictionaryDetailsForm';\nimport { dictionaryFieldEditorContent } from './dictionaryFieldEditor.content';\nimport { JSONEditor } from './JSONEditor';\nimport { NodeEditor } from './NodeEditor';\nimport { SaveForm } from './SaveForm/SaveForm';\n\ntype DictionaryFieldEditorProps = {\n dictionary: Dictionary;\n onClickDictionaryList?: () => void;\n isDarkMode?: boolean;\n availableLocales: Locales[];\n};\n\nenum EditorViewType {\n NodeEditor,\n JSONEditor,\n}\n\nexport const DictionaryFieldEditor: FC<DictionaryFieldEditorProps> = ({\n dictionary,\n onClickDictionaryList,\n isDarkMode,\n availableLocales,\n}) => {\n const { key } = dictionary;\n const [editorView, setEditorView] = useState<EditorViewType>(\n EditorViewType.NodeEditor\n );\n const { dictionariesRecord, setDictionariesRecord } = useDictionariesRecord();\n const { returnToDictionaryList, titleContent, titleInformation } =\n useDictionary(dictionaryFieldEditorContent);\n\n useEffect(() => {\n if (dictionariesRecord[key]) return;\n\n setDictionariesRecord({\n [key]: dictionary,\n });\n }, [dictionary, key, setDictionariesRecord, dictionariesRecord]);\n\n return (\n <LocaleSwitcherContentProvider availableLocales={availableLocales}>\n <div className=\"flex size-full flex-1 flex-col gap-10\">\n <div className=\"flex items-center gap-2\">\n <Button\n onClick={() => onClickDictionaryList?.()}\n variant=\"hoverable\"\n size=\"icon-md\"\n color=\"text\"\n id=\"return-to-dictionary-list\"\n Icon={ArrowLeft}\n label={returnToDictionaryList.label}\n />\n <label\n className=\"cursor-pointer text-xs hover:underline\"\n htmlFor=\"return-to-dictionary-list\"\n >\n {returnToDictionaryList.text}\n </label>\n </div>\n\n <Container\n className=\"flex size-full justify-center gap-10 p-6\"\n roundedSize=\"xl\"\n >\n <H2>{titleInformation}</H2>\n\n <DictionaryDetailsForm dictionary={dictionary} />\n </Container>\n\n <Container\n className=\"flex size-full justify-center gap-10 p-6\"\n roundedSize=\"xl\"\n >\n <H2>{titleContent}</H2>\n <SwitchSelector\n defaultValue={editorView}\n onChange={(value) => setEditorView(value)}\n color=\"text\"\n size=\"sm\"\n className=\"ml-auto\"\n choices={[\n {\n content: 'Node editor',\n value: EditorViewType.NodeEditor,\n },\n {\n content: 'JSON editor',\n value: EditorViewType.JSONEditor,\n },\n ]}\n />\n {editorView === EditorViewType.NodeEditor && (\n <NodeEditor dictionary={dictionary} locales={availableLocales} />\n )}\n {editorView === EditorViewType.JSONEditor && (\n <JSONEditor dictionary={dictionary} isDarkMode={isDarkMode} />\n )}\n <SaveForm dictionary={dictionary} />\n </Container>\n </div>\n </LocaleSwitcherContentProvider>\n );\n};\n"],"names":["useState","useDictionariesRecord","useDictionary","dictionaryFieldEditorContent","useEffect","LocaleSwitcherContentProvider","jsxs","jsx","Button","ArrowLeft","Container","H2","DictionaryDetailsForm","SwitchSelector","NodeEditor","JSONEditor","SaveForm"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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AAsB,WAAwB,CAAA;AAAA,QAAA;AAAA,MAAA;AAAA,IACjD;AAAA,IAEAN,2BAAA,kBAAA;AAAA,MAACI,2BAAA;AAAA,MAAA;AAAA,QACC,WAAU;AAAA,QACV,aAAY;AAAA,QAEZ,UAAA;AAAA,UAAAH,2BAAAA,kBAAAA,IAACI,+BAAI,UAAa,aAAA,CAAA;AAAA,UAClBJ,2BAAA,kBAAA;AAAA,YAACM,gCAAA;AAAA,YAAA;AAAA,cACC,cAAc;AAAA,cACd,UAAU,CAAC,UAAU,cAAc,KAAK;AAAA,cACxC,OAAM;AAAA,cACN,MAAK;AAAA,cACL,WAAU;AAAA,cACV,SAAS;AAAA,gBACP;AAAA,kBACE,SAAS;AAAA,kBACT,OAAO;AAAA;AAAA,gBACT;AAAA,gBACA;AAAA,kBACE,SAAS;AAAA,kBACT,OAAO;AAAA;AAAA,gBAAA;AAAA,cACT;AAAA,YACF;AAAA,UACF;AAAA,UACC,eAAe,KACdN,iDAACO,4CAAAA,YAAW,EAAA,YAAwB,SAAS,kBAAkB;AAAA,UAEhE,eAAe,KACbP,2BAAA,kBAAA,IAAAQ,4CAAA,YAAA,EAAW,YAAwB,YAAwB;AAAA,UAE9DR,iDAACS,mDAAAA,YAAS,WAAwB,CAAA;AAAA,QAAA;AAAA,MAAA;AAAA,IAAA;AAAA,EACpC,EAAA,CACF,EACF,CAAA;AAEJ;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DictionaryFieldEditor.d.ts","sourceRoot":"","sources":["../../../src/components/DictionaryFieldEditor/DictionaryFieldEditor.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAC3C,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"DictionaryFieldEditor.d.ts","sourceRoot":"","sources":["../../../src/components/DictionaryFieldEditor/DictionaryFieldEditor.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAC3C,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAG5C,OAAO,EAAuB,KAAK,EAAE,EAAE,MAAM,OAAO,CAAC;AAcrD,KAAK,0BAA0B,GAAG;IAChC,UAAU,EAAE,UAAU,CAAC;IACvB,qBAAqB,CAAC,EAAE,MAAM,IAAI,CAAC;IACnC,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,gBAAgB,EAAE,OAAO,EAAE,CAAC;CAC7B,CAAC;AAOF,eAAO,MAAM,qBAAqB,EAAE,EAAE,CAAC,0BAA0B,CAqFhE,CAAC"}
|
|
@@ -1,32 +1,21 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { j as jsxRuntimeExports } from "../../jsx-runtime-DQkoUcjV.js";
|
|
3
|
+
import { useDictionariesRecord } from "@intlayer/editor-react";
|
|
3
4
|
import { ArrowLeft } from "lucide-react";
|
|
4
5
|
import { useState, useEffect } from "react";
|
|
5
6
|
import { useDictionary } from "react-intlayer";
|
|
6
|
-
import { u as useShallow } from "../../shallow-m9BpCkKh.js";
|
|
7
7
|
import { Button } from "../Button/Button.mjs";
|
|
8
8
|
import { Container } from "../Container/index.mjs";
|
|
9
|
-
import {
|
|
10
|
-
import "
|
|
9
|
+
import { H2 } from "../Headers/index.mjs";
|
|
10
|
+
import "@intlayer/config/client";
|
|
11
11
|
import "@intlayer/core";
|
|
12
|
-
import "
|
|
13
|
-
import "tailwind-merge";
|
|
14
|
-
import "../EditableField/EditableFieldInput.mjs";
|
|
15
|
-
import "../EditableField/EditableFieldTextArea.mjs";
|
|
12
|
+
import "fuse.js";
|
|
16
13
|
import "../../hooks/useScrollBlockage/useScrollBlockageStore.mjs";
|
|
17
14
|
import "../../hooks/useAsync/useAsyncStateStore.mjs";
|
|
18
15
|
import "../../index-DcWYZrJW.js";
|
|
19
|
-
import "@intlayer/config/client";
|
|
20
16
|
import "../Toaster/Toast.mjs";
|
|
21
17
|
import "@intlayer/dictionaries-entry";
|
|
22
18
|
import "deepmerge";
|
|
23
|
-
import "../Form/FormBase.mjs";
|
|
24
|
-
import "../Form/FormField.mjs";
|
|
25
|
-
import "../../Form-DlqjTz3u.js";
|
|
26
|
-
import "../DictionaryEditor/validDictionaryChangeButtons.content.mjs";
|
|
27
|
-
import "zod";
|
|
28
|
-
import { H2 } from "../Headers/index.mjs";
|
|
29
|
-
import "fuse.js";
|
|
30
19
|
import "../DropDown/index.mjs";
|
|
31
20
|
import "../Input/Input.mjs";
|
|
32
21
|
import "../Input/InputPassword.mjs";
|
|
@@ -50,20 +39,14 @@ const DictionaryFieldEditor = ({
|
|
|
50
39
|
0
|
|
51
40
|
/* NodeEditor */
|
|
52
41
|
);
|
|
53
|
-
const {
|
|
54
|
-
useShallow((s) => ({
|
|
55
|
-
editedContent: s.editedContent,
|
|
56
|
-
dictionaryRecord: s.dictionariesRecord,
|
|
57
|
-
setDictionariesRecord: s.setDictionariesRecord
|
|
58
|
-
}))
|
|
59
|
-
);
|
|
42
|
+
const { dictionariesRecord, setDictionariesRecord } = useDictionariesRecord();
|
|
60
43
|
const { returnToDictionaryList, titleContent, titleInformation } = useDictionary(dictionaryFieldEditorContent);
|
|
61
44
|
useEffect(() => {
|
|
62
|
-
if (
|
|
45
|
+
if (dictionariesRecord[key]) return;
|
|
63
46
|
setDictionariesRecord({
|
|
64
47
|
[key]: dictionary
|
|
65
48
|
});
|
|
66
|
-
}, [dictionary, key, setDictionariesRecord,
|
|
49
|
+
}, [dictionary, key, setDictionariesRecord, dictionariesRecord]);
|
|
67
50
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(LocaleSwitcherContentProvider, { availableLocales, children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex size-full flex-1 flex-col gap-10", children: [
|
|
68
51
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-2", children: [
|
|
69
52
|
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DictionaryFieldEditor.mjs","sources":["../../../src/components/DictionaryFieldEditor/DictionaryFieldEditor.tsx"],"sourcesContent":["'use client';\n\nimport { Locales } from '@intlayer/config';\nimport { Dictionary } from '@intlayer/core';\nimport { ArrowLeft } from 'lucide-react';\nimport { useEffect, useState, type FC } from 'react';\n// @ts-ignore react-intlayer not build yet\nimport { useDictionary } from 'react-intlayer';\nimport {
|
|
1
|
+
{"version":3,"file":"DictionaryFieldEditor.mjs","sources":["../../../src/components/DictionaryFieldEditor/DictionaryFieldEditor.tsx"],"sourcesContent":["'use client';\n\nimport { Locales } from '@intlayer/config';\nimport { Dictionary } from '@intlayer/core';\nimport { useDictionariesRecord } from '@intlayer/editor-react';\nimport { ArrowLeft } from 'lucide-react';\nimport { useEffect, useState, type FC } from 'react';\n// @ts-ignore react-intlayer not build yet\nimport { useDictionary } from 'react-intlayer';\nimport { Button } from '../Button';\nimport { Container } from '../Container';\nimport { H2 } from '../Headers';\nimport { LocaleSwitcherContentProvider } from '../LocaleSwitcherContentDropDown';\nimport { SwitchSelector } from '../SwitchSelector';\nimport { DictionaryDetailsForm } from './DictionaryDetails/DictionaryDetailsForm';\nimport { dictionaryFieldEditorContent } from './dictionaryFieldEditor.content';\nimport { JSONEditor } from './JSONEditor';\nimport { NodeEditor } from './NodeEditor';\nimport { SaveForm } from './SaveForm/SaveForm';\n\ntype DictionaryFieldEditorProps = {\n dictionary: Dictionary;\n onClickDictionaryList?: () => void;\n isDarkMode?: boolean;\n availableLocales: Locales[];\n};\n\nenum EditorViewType {\n NodeEditor,\n JSONEditor,\n}\n\nexport const DictionaryFieldEditor: FC<DictionaryFieldEditorProps> = ({\n dictionary,\n onClickDictionaryList,\n isDarkMode,\n availableLocales,\n}) => {\n const { key } = dictionary;\n const [editorView, setEditorView] = useState<EditorViewType>(\n EditorViewType.NodeEditor\n );\n const { dictionariesRecord, setDictionariesRecord } = useDictionariesRecord();\n const { returnToDictionaryList, titleContent, titleInformation } =\n useDictionary(dictionaryFieldEditorContent);\n\n useEffect(() => {\n if (dictionariesRecord[key]) return;\n\n setDictionariesRecord({\n [key]: dictionary,\n });\n }, [dictionary, key, setDictionariesRecord, dictionariesRecord]);\n\n return (\n <LocaleSwitcherContentProvider availableLocales={availableLocales}>\n <div className=\"flex size-full flex-1 flex-col gap-10\">\n <div className=\"flex items-center gap-2\">\n <Button\n onClick={() => onClickDictionaryList?.()}\n variant=\"hoverable\"\n size=\"icon-md\"\n color=\"text\"\n id=\"return-to-dictionary-list\"\n Icon={ArrowLeft}\n label={returnToDictionaryList.label}\n />\n <label\n className=\"cursor-pointer text-xs hover:underline\"\n htmlFor=\"return-to-dictionary-list\"\n >\n {returnToDictionaryList.text}\n </label>\n </div>\n\n <Container\n className=\"flex size-full justify-center gap-10 p-6\"\n roundedSize=\"xl\"\n >\n <H2>{titleInformation}</H2>\n\n <DictionaryDetailsForm dictionary={dictionary} />\n </Container>\n\n <Container\n className=\"flex size-full justify-center gap-10 p-6\"\n roundedSize=\"xl\"\n >\n <H2>{titleContent}</H2>\n <SwitchSelector\n defaultValue={editorView}\n onChange={(value) => setEditorView(value)}\n color=\"text\"\n size=\"sm\"\n className=\"ml-auto\"\n choices={[\n {\n content: 'Node editor',\n value: EditorViewType.NodeEditor,\n },\n {\n content: 'JSON editor',\n value: EditorViewType.JSONEditor,\n },\n ]}\n />\n {editorView === EditorViewType.NodeEditor && (\n <NodeEditor dictionary={dictionary} locales={availableLocales} />\n )}\n {editorView === EditorViewType.JSONEditor && (\n <JSONEditor dictionary={dictionary} isDarkMode={isDarkMode} />\n )}\n <SaveForm dictionary={dictionary} />\n </Container>\n </div>\n </LocaleSwitcherContentProvider>\n );\n};\n"],"names":["jsxs","jsx"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgCO,MAAM,wBAAwD,CAAC;AAAA,EACpE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,MAAM;AACE,Q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AAA,UAClBA,kCAAA;AAAA,YAAC;AAAA,YAAA;AAAA,cACC,cAAc;AAAA,cACd,UAAU,CAAC,UAAU,cAAc,KAAK;AAAA,cACxC,OAAM;AAAA,cACN,MAAK;AAAA,cACL,WAAU;AAAA,cACV,SAAS;AAAA,gBACP;AAAA,kBACE,SAAS;AAAA,kBACT,OAAO;AAAA;AAAA,gBACT;AAAA,gBACA;AAAA,kBACE,SAAS;AAAA,kBACT,OAAO;AAAA;AAAA,gBAAA;AAAA,cACT;AAAA,YACF;AAAA,UACF;AAAA,UACC,eAAe,KACdA,sCAAC,YAAW,EAAA,YAAwB,SAAS,kBAAkB;AAAA,UAEhE,eAAe,KACbA,kCAAA,IAAA,YAAA,EAAW,YAAwB,YAAwB;AAAA,UAE9DA,sCAAC,YAAS,WAAwB,CAAA;AAAA,QAAA;AAAA,MAAA;AAAA,IAAA;AAAA,EACpC,EAAA,CACF,EACF,CAAA;AAEJ;"}
|
|
@@ -2,32 +2,15 @@
|
|
|
2
2
|
"use strict";
|
|
3
3
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
4
4
|
const jsxRuntime = require("../../../jsx-runtime-CgFM7lM3.cjs");
|
|
5
|
+
const core = require("@intlayer/core");
|
|
6
|
+
const editorReact = require("@intlayer/editor-react");
|
|
5
7
|
const lucideReact = require("lucide-react");
|
|
6
8
|
const require$$0 = require("react");
|
|
7
9
|
const reactIntlayer = require("react-intlayer");
|
|
8
|
-
const shallow = require("../../../shallow-lhDIFtEp.cjs");
|
|
9
10
|
const components_EditableField_EditableFieldInput = require("../../EditableField/EditableFieldInput.cjs");
|
|
10
11
|
require("../../EditableField/EditableFieldTextArea.cjs");
|
|
11
12
|
const utils_camelCase = require("../../../utils/camelCase.cjs");
|
|
12
|
-
const utils_dictionary = require("../../../utils/dictionary.cjs");
|
|
13
13
|
const components_Button_Button = require("../../Button/Button.cjs");
|
|
14
|
-
const components_DictionaryEditor_useEditedContentStore = require("../../DictionaryEditor/useEditedContentStore.cjs");
|
|
15
|
-
const components_DictionaryEditor_useEditionPanelStore = require("../../DictionaryEditor/useEditionPanelStore.cjs");
|
|
16
|
-
require("@intlayer/core");
|
|
17
|
-
require("clsx");
|
|
18
|
-
require("tailwind-merge");
|
|
19
|
-
require("../../../hooks/useScrollBlockage/useScrollBlockageStore.cjs");
|
|
20
|
-
require("../../../hooks/useAsync/useAsyncStateStore.cjs");
|
|
21
|
-
require("../../../index-DFc7og1d.cjs");
|
|
22
|
-
require("@intlayer/config/client");
|
|
23
|
-
require("../../Toaster/Toast.cjs");
|
|
24
|
-
require("@intlayer/dictionaries-entry");
|
|
25
|
-
require("deepmerge");
|
|
26
|
-
require("../../Form/FormBase.cjs");
|
|
27
|
-
require("../../Form/FormField.cjs");
|
|
28
|
-
require("../../../Form-CSMiPnjC.cjs");
|
|
29
|
-
require("../../DictionaryEditor/validDictionaryChangeButtons.content.cjs");
|
|
30
|
-
require("zod");
|
|
31
14
|
const components_Label_index = require("../../Label/index.cjs");
|
|
32
15
|
const components_DictionaryFieldEditor_editorView_content = require("../editorView.content.cjs");
|
|
33
16
|
const components_DictionaryFieldEditor_getIsEditableSection = require("../getIsEditableSection.cjs");
|
|
@@ -38,12 +21,7 @@ const EditorView = ({
|
|
|
38
21
|
dictionary,
|
|
39
22
|
locales
|
|
40
23
|
}) => {
|
|
41
|
-
const { focusedContent, setFocusedContentKeyPath } =
|
|
42
|
-
shallow.useShallow((s) => ({
|
|
43
|
-
setFocusedContentKeyPath: s.setFocusedContentKeyPath,
|
|
44
|
-
focusedContent: s.focusedContent
|
|
45
|
-
}))
|
|
46
|
-
);
|
|
24
|
+
const { focusedContent, setFocusedContentKeyPath } = editorReact.useFocusDictionary();
|
|
47
25
|
const keyPath = focusedContent?.keyPath ?? [];
|
|
48
26
|
const initialKeyName = keyPath[keyPath.length - 1]?.key ?? "";
|
|
49
27
|
const { titleInput, deleteButton, nodeTypeSelector, restoreButton } = reactIntlayer.useDictionary(components_DictionaryFieldEditor_editorView_content.editorViewContent);
|
|
@@ -52,16 +30,9 @@ const EditorView = ({
|
|
|
52
30
|
renameEditedContent,
|
|
53
31
|
addEditedContent,
|
|
54
32
|
removeEditedContent
|
|
55
|
-
} =
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
renameEditedContent: s.renameEditedContent,
|
|
59
|
-
addEditedContent: s.addEditedContent,
|
|
60
|
-
removeEditedContent: s.removeEditedContent
|
|
61
|
-
}))
|
|
62
|
-
);
|
|
63
|
-
const editedSection = editedContent[dictionaryKey]?.content ? utils_dictionary.getDictionaryValueByKeyPath(editedContent[dictionaryKey].content, keyPath) : void 0;
|
|
64
|
-
const dictionarySection = utils_dictionary.getDictionaryValueByKeyPath(
|
|
33
|
+
} = editorReact.useEditedContent();
|
|
34
|
+
const editedSection = editedContent[dictionaryKey]?.content ? core.getDictionaryValueByKeyPath(editedContent[dictionaryKey].content, keyPath) : void 0;
|
|
35
|
+
const dictionarySection = core.getDictionaryValueByKeyPath(
|
|
65
36
|
dictionary.content,
|
|
66
37
|
keyPath
|
|
67
38
|
);
|