intlayer-editor 3.4.8 → 3.5.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/package.json +8 -8
- package/dist/cjs/ContentSelectorWrapper.cjs +0 -67
- package/dist/cjs/ContentSelectorWrapper.cjs.map +0 -1
- package/dist/cjs/DictionaryEditionDrawer/DictionaryEditionDrawer.cjs +0 -156
- package/dist/cjs/DictionaryEditionDrawer/DictionaryEditionDrawer.cjs.map +0 -1
- package/dist/cjs/DictionaryEditionDrawer/index.cjs +0 -25
- package/dist/cjs/DictionaryEditionDrawer/index.cjs.map +0 -1
- package/dist/cjs/DictionaryEditionDrawer/useDictionaryEditionDrawer.cjs +0 -79
- package/dist/cjs/DictionaryEditionDrawer/useDictionaryEditionDrawer.cjs.map +0 -1
- package/dist/cjs/DictionaryListDrawer/DictionaryListDrawer.cjs +0 -89
- package/dist/cjs/DictionaryListDrawer/DictionaryListDrawer.cjs.map +0 -1
- package/dist/cjs/DictionaryListDrawer/dictionaryListDrawerIdentifier.cjs +0 -29
- package/dist/cjs/DictionaryListDrawer/dictionaryListDrawerIdentifier.cjs.map +0 -1
- package/dist/cjs/DictionaryListDrawer/index.cjs +0 -25
- package/dist/cjs/DictionaryListDrawer/index.cjs.map +0 -1
- package/dist/cjs/IntlayerEditorProvider.cjs +0 -92
- package/dist/cjs/IntlayerEditorProvider.cjs.map +0 -1
- package/dist/cjs/index.cjs +0 -27
- package/dist/cjs/index.cjs.map +0 -1
- package/dist/cjs/styles/style.css +0 -2
- package/dist/cjs/styles/style.css.map +0 -1
- package/dist/cjs/styles/tailwind.cjs +0 -41
- package/dist/cjs/styles/tailwind.cjs.map +0 -1
- package/dist/esm/ContentSelectorWrapper.mjs +0 -48
- package/dist/esm/ContentSelectorWrapper.mjs.map +0 -1
- package/dist/esm/DictionaryEditionDrawer/DictionaryEditionDrawer.mjs +0 -141
- package/dist/esm/DictionaryEditionDrawer/DictionaryEditionDrawer.mjs.map +0 -1
- package/dist/esm/DictionaryEditionDrawer/index.mjs +0 -3
- package/dist/esm/DictionaryEditionDrawer/index.mjs.map +0 -1
- package/dist/esm/DictionaryEditionDrawer/useDictionaryEditionDrawer.mjs +0 -58
- package/dist/esm/DictionaryEditionDrawer/useDictionaryEditionDrawer.mjs.map +0 -1
- package/dist/esm/DictionaryListDrawer/DictionaryListDrawer.mjs +0 -71
- package/dist/esm/DictionaryListDrawer/DictionaryListDrawer.mjs.map +0 -1
- package/dist/esm/DictionaryListDrawer/dictionaryListDrawerIdentifier.mjs +0 -5
- package/dist/esm/DictionaryListDrawer/dictionaryListDrawerIdentifier.mjs.map +0 -1
- package/dist/esm/DictionaryListDrawer/index.mjs +0 -3
- package/dist/esm/DictionaryListDrawer/index.mjs.map +0 -1
- package/dist/esm/IntlayerEditorProvider.mjs +0 -71
- package/dist/esm/IntlayerEditorProvider.mjs.map +0 -1
- package/dist/esm/index.mjs +0 -4
- package/dist/esm/index.mjs.map +0 -1
- package/dist/esm/styles/style.css +0 -2
- package/dist/esm/styles/style.css.map +0 -1
- package/dist/esm/styles/tailwind.mjs +0 -8
- package/dist/esm/styles/tailwind.mjs.map +0 -1
- package/dist/types/ContentSelectorWrapper.d.ts +0 -11
- package/dist/types/ContentSelectorWrapper.d.ts.map +0 -1
- package/dist/types/DictionaryEditionDrawer/DictionaryEditionDrawer.d.ts +0 -22
- package/dist/types/DictionaryEditionDrawer/DictionaryEditionDrawer.d.ts.map +0 -1
- package/dist/types/DictionaryEditionDrawer/index.d.ts +0 -3
- package/dist/types/DictionaryEditionDrawer/index.d.ts.map +0 -1
- package/dist/types/DictionaryEditionDrawer/useDictionaryEditionDrawer.d.ts +0 -20
- package/dist/types/DictionaryEditionDrawer/useDictionaryEditionDrawer.d.ts.map +0 -1
- package/dist/types/DictionaryListDrawer/DictionaryListDrawer.d.ts +0 -3
- package/dist/types/DictionaryListDrawer/DictionaryListDrawer.d.ts.map +0 -1
- package/dist/types/DictionaryListDrawer/dictionaryListDrawerIdentifier.d.ts +0 -2
- package/dist/types/DictionaryListDrawer/dictionaryListDrawerIdentifier.d.ts.map +0 -1
- package/dist/types/DictionaryListDrawer/index.d.ts +0 -3
- package/dist/types/DictionaryListDrawer/index.d.ts.map +0 -1
- package/dist/types/IntlayerEditorProvider.d.ts +0 -21
- package/dist/types/IntlayerEditorProvider.d.ts.map +0 -1
- package/dist/types/index.d.ts +0 -4
- package/dist/types/index.d.ts.map +0 -1
- package/dist/types/styles/tailwind.d.ts +0 -3
- package/dist/types/styles/tailwind.d.ts.map +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "intlayer-editor",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.5.0",
|
|
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,9 @@
|
|
|
74
74
|
"react": "^18.3.1",
|
|
75
75
|
"react-dom": "^18.3.1",
|
|
76
76
|
"zustand": "^5.0.1",
|
|
77
|
-
"@intlayer/
|
|
78
|
-
"@intlayer/
|
|
79
|
-
"@intlayer/
|
|
77
|
+
"@intlayer/config": "^3.5.0",
|
|
78
|
+
"@intlayer/core": "^3.5.0",
|
|
79
|
+
"@intlayer/design-system": "^3.5.0"
|
|
80
80
|
},
|
|
81
81
|
"devDependencies": {
|
|
82
82
|
"@babel/generator": "7.26.2",
|
|
@@ -103,10 +103,10 @@
|
|
|
103
103
|
"@utils/tsup-config": "^1.0.4"
|
|
104
104
|
},
|
|
105
105
|
"peerDependencies": {
|
|
106
|
-
"@intlayer/config": "^3.
|
|
107
|
-
"@intlayer/core": "^3.
|
|
108
|
-
"@intlayer/design-system": "^3.
|
|
109
|
-
"react-intlayer": "^3.
|
|
106
|
+
"@intlayer/config": "^3.5.0",
|
|
107
|
+
"@intlayer/core": "^3.5.0",
|
|
108
|
+
"@intlayer/design-system": "^3.5.0",
|
|
109
|
+
"react-intlayer": "^3.5.0"
|
|
110
110
|
},
|
|
111
111
|
"engines": {
|
|
112
112
|
"node": ">=14.18"
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
"use client";
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
-
var __export = (target, all) => {
|
|
8
|
-
for (var name in all)
|
|
9
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
-
};
|
|
11
|
-
var __copyProps = (to, from, except, desc) => {
|
|
12
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
-
for (let key of __getOwnPropNames(from))
|
|
14
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
-
}
|
|
17
|
-
return to;
|
|
18
|
-
};
|
|
19
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
20
|
-
var ContentSelectorWrapper_exports = {};
|
|
21
|
-
__export(ContentSelectorWrapper_exports, {
|
|
22
|
-
ContentSelectorWrapper: () => ContentSelectorWrapper
|
|
23
|
-
});
|
|
24
|
-
module.exports = __toCommonJS(ContentSelectorWrapper_exports);
|
|
25
|
-
var import_jsx_runtime = require("react/jsx-runtime");
|
|
26
|
-
var import_core = require("@intlayer/core");
|
|
27
|
-
var import_design_system = require("@intlayer/design-system");
|
|
28
|
-
var import_react = require("react");
|
|
29
|
-
var import_IntlayerEditorProvider = require('./IntlayerEditorProvider.cjs');
|
|
30
|
-
var import_useDictionaryEditionDrawer = require('./DictionaryEditionDrawer/useDictionaryEditionDrawer.cjs');
|
|
31
|
-
const ContentSelectorWrapper = ({
|
|
32
|
-
children,
|
|
33
|
-
dictionaryId,
|
|
34
|
-
dictionaryPath,
|
|
35
|
-
keyPath
|
|
36
|
-
}) => {
|
|
37
|
-
const { open, getEditedContentValue, focusedContent, isOpen } = (0, import_useDictionaryEditionDrawer.useDictionaryEditionDrawer)(dictionaryId);
|
|
38
|
-
const editedValue = getEditedContentValue(dictionaryId, keyPath);
|
|
39
|
-
const { isEditorEnabled } = (0, import_IntlayerEditorProvider.useIntlayerEditorContext)();
|
|
40
|
-
const [displayedChildren, setDisplayedChildren] = (0, import_react.useState)(children);
|
|
41
|
-
const handleSelect = (0, import_react.useCallback)(
|
|
42
|
-
() => open({
|
|
43
|
-
dictionaryId,
|
|
44
|
-
dictionaryPath,
|
|
45
|
-
keyPath
|
|
46
|
-
}),
|
|
47
|
-
[dictionaryId, dictionaryPath, keyPath, open]
|
|
48
|
-
);
|
|
49
|
-
const isSelected = (0, import_react.useMemo)(
|
|
50
|
-
() => (isOpen && (focusedContent?.keyPath?.length ?? 0) > 0 && (0, import_core.isSameKeyPath)(focusedContent?.keyPath ?? [], keyPath)) ?? false,
|
|
51
|
-
[focusedContent, isOpen, keyPath]
|
|
52
|
-
);
|
|
53
|
-
(0, import_react.useEffect)(() => {
|
|
54
|
-
if (isEditorEnabled && editedValue && typeof editedValue === "string") {
|
|
55
|
-
setDisplayedChildren(editedValue);
|
|
56
|
-
}
|
|
57
|
-
}, [editedValue, isEditorEnabled]);
|
|
58
|
-
if (!isEditorEnabled) {
|
|
59
|
-
return children;
|
|
60
|
-
}
|
|
61
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_design_system.ContentSelector, { onSelect: handleSelect, isSelecting: isSelected, children: displayedChildren });
|
|
62
|
-
};
|
|
63
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
64
|
-
0 && (module.exports = {
|
|
65
|
-
ContentSelectorWrapper
|
|
66
|
-
});
|
|
67
|
-
//# sourceMappingURL=ContentSelectorWrapper.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/ContentSelectorWrapper.tsx"],"sourcesContent":["'use client';\n\nimport { isSameKeyPath, type KeyPath } from '@intlayer/core';\nimport { ContentSelector } from '@intlayer/design-system';\nimport {\n useCallback,\n useEffect,\n useState,\n useMemo,\n type FC,\n type ReactNode,\n} from 'react';\nimport { useIntlayerEditorContext } from './IntlayerEditorProvider';\nimport { useDictionaryEditionDrawer } from './DictionaryEditionDrawer/useDictionaryEditionDrawer';\n\ntype ContentSelectorWrapperProps = {\n children: ReactNode;\n dictionaryId: string;\n dictionaryPath: string;\n keyPath: KeyPath[];\n};\n\nexport const ContentSelectorWrapper: FC<ContentSelectorWrapperProps> = ({\n children,\n dictionaryId,\n dictionaryPath,\n keyPath,\n}) => {\n const { open, getEditedContentValue, focusedContent, isOpen } =\n useDictionaryEditionDrawer(dictionaryId);\n const editedValue = getEditedContentValue(dictionaryId, keyPath);\n const { isEditorEnabled } = useIntlayerEditorContext();\n const [displayedChildren, setDisplayedChildren] =\n useState<ReactNode>(children);\n\n const handleSelect = useCallback(\n () =>\n open({\n dictionaryId,\n dictionaryPath,\n keyPath,\n }),\n [dictionaryId, dictionaryPath, keyPath, open]\n );\n\n const isSelected = useMemo(\n () =>\n (isOpen &&\n (focusedContent?.keyPath?.length ?? 0) > 0 &&\n isSameKeyPath(focusedContent?.keyPath ?? [], keyPath)) ??\n false,\n [focusedContent, isOpen, keyPath]\n );\n\n useEffect(() => {\n // Use useEffect to avoid 'Text content does not match server-rendered HTML' error\n if (isEditorEnabled && editedValue && typeof editedValue === 'string') {\n setDisplayedChildren(editedValue);\n }\n }, [editedValue, isEditorEnabled]);\n\n if (!isEditorEnabled) {\n return children;\n }\n\n return (\n <ContentSelector onSelect={handleSelect} isSelecting={isSelected}>\n {displayedChildren}\n </ContentSelector>\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAkEI;AAhEJ,kBAA4C;AAC5C,2BAAgC;AAChC,mBAOO;AACP,oCAAyC;AACzC,wCAA2C;AASpC,MAAM,yBAA0D,CAAC;AAAA,EACtE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,MAAM;AACJ,QAAM,EAAE,MAAM,uBAAuB,gBAAgB,OAAO,QAC1D,8DAA2B,YAAY;AACzC,QAAM,cAAc,sBAAsB,cAAc,OAAO;AAC/D,QAAM,EAAE,gBAAgB,QAAI,wDAAyB;AACrD,QAAM,CAAC,mBAAmB,oBAAoB,QAC5C,uBAAoB,QAAQ;AAE9B,QAAM,mBAAe;AAAA,IACnB,MACE,KAAK;AAAA,MACH;AAAA,MACA;AAAA,MACA;AAAA,IACF,CAAC;AAAA,IACH,CAAC,cAAc,gBAAgB,SAAS,IAAI;AAAA,EAC9C;AAEA,QAAM,iBAAa;AAAA,IACjB,OACG,WACE,gBAAgB,SAAS,UAAU,KAAK,SACzC,2BAAc,gBAAgB,WAAW,CAAC,GAAG,OAAO,MACtD;AAAA,IACF,CAAC,gBAAgB,QAAQ,OAAO;AAAA,EAClC;AAEA,8BAAU,MAAM;AAEd,QAAI,mBAAmB,eAAe,OAAO,gBAAgB,UAAU;AACrE,2BAAqB,WAAW;AAAA,IAClC;AAAA,EACF,GAAG,CAAC,aAAa,eAAe,CAAC;AAEjC,MAAI,CAAC,iBAAiB;AACpB,WAAO;AAAA,EACT;AAEA,SACE,4CAAC,wCAAgB,UAAU,cAAc,aAAa,YACnD,6BACH;AAEJ;","names":[]}
|
|
@@ -1,156 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
"use client";
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
-
var __export = (target, all) => {
|
|
8
|
-
for (var name in all)
|
|
9
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
-
};
|
|
11
|
-
var __copyProps = (to, from, except, desc) => {
|
|
12
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
-
for (let key of __getOwnPropNames(from))
|
|
14
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
-
}
|
|
17
|
-
return to;
|
|
18
|
-
};
|
|
19
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
20
|
-
var DictionaryEditionDrawer_exports = {};
|
|
21
|
-
__export(DictionaryEditionDrawer_exports, {
|
|
22
|
-
DictionaryEditionDrawer: () => DictionaryEditionDrawer,
|
|
23
|
-
DictionaryEditionDrawerContent: () => DictionaryEditionDrawerContent,
|
|
24
|
-
DictionaryEditionDrawerController: () => DictionaryEditionDrawerController
|
|
25
|
-
});
|
|
26
|
-
module.exports = __toCommonJS(DictionaryEditionDrawer_exports);
|
|
27
|
-
var import_jsx_runtime = require("react/jsx-runtime");
|
|
28
|
-
var import_design_system = require("@intlayer/design-system");
|
|
29
|
-
var import_hooks = require("@intlayer/design-system/hooks");
|
|
30
|
-
var import_react = require("react");
|
|
31
|
-
var import_react_intlayer = require("react-intlayer");
|
|
32
|
-
var import_shallow = require("zustand/shallow");
|
|
33
|
-
var import_dictionaryListDrawerIdentifier = require('../DictionaryListDrawer/dictionaryListDrawerIdentifier.cjs');
|
|
34
|
-
var import_useDictionaryEditionDrawer = require('./useDictionaryEditionDrawer.cjs');
|
|
35
|
-
const DictionaryEditionDrawerContent = ({ locale, identifier, handleOnBack }) => {
|
|
36
|
-
const [keyPathEditionModal, setKeyPathEditionModal] = (0, import_react.useState)(null);
|
|
37
|
-
const { setDictionariesRecord, focusedContent } = (0, import_useDictionaryEditionDrawer.useDictionaryEditionDrawer)(identifier);
|
|
38
|
-
const { all: dictionaries } = (0, import_hooks.useGetAllDictionaries)();
|
|
39
|
-
const onClickDictionaryList = (0, import_react.useCallback)(() => {
|
|
40
|
-
setKeyPathEditionModal(null);
|
|
41
|
-
handleOnBack();
|
|
42
|
-
}, [handleOnBack]);
|
|
43
|
-
(0, import_react.useEffect)(() => {
|
|
44
|
-
if (dictionaries) {
|
|
45
|
-
setDictionariesRecord(dictionaries);
|
|
46
|
-
}
|
|
47
|
-
}, [setDictionariesRecord, dictionaries]);
|
|
48
|
-
const dictionaryId = focusedContent?.dictionaryId;
|
|
49
|
-
if (!dictionaryId) return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, { children: "No dictionary focused" });
|
|
50
|
-
const dictionary = dictionaries[dictionaryId];
|
|
51
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
52
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
53
|
-
import_design_system.Modal,
|
|
54
|
-
{
|
|
55
|
-
isOpen: keyPathEditionModal !== null,
|
|
56
|
-
onClose: () => setKeyPathEditionModal(null),
|
|
57
|
-
hasCloseButton: true,
|
|
58
|
-
title: (0, import_react_intlayer.t)({
|
|
59
|
-
en: "Edit field",
|
|
60
|
-
fr: "Modifier le champ",
|
|
61
|
-
es: "Editar campo"
|
|
62
|
-
}),
|
|
63
|
-
size: "xl",
|
|
64
|
-
transparency: "lg",
|
|
65
|
-
children: dictionary && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
66
|
-
import_design_system.DictionaryFieldEditor,
|
|
67
|
-
{
|
|
68
|
-
dictionary,
|
|
69
|
-
onClickDictionaryList
|
|
70
|
-
}
|
|
71
|
-
)
|
|
72
|
-
}
|
|
73
|
-
),
|
|
74
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
75
|
-
import_design_system.DictionaryEditor,
|
|
76
|
-
{
|
|
77
|
-
dictionary,
|
|
78
|
-
locale,
|
|
79
|
-
onClickEdit: setKeyPathEditionModal
|
|
80
|
-
}
|
|
81
|
-
)
|
|
82
|
-
] });
|
|
83
|
-
};
|
|
84
|
-
const DictionaryEditionDrawer = ({
|
|
85
|
-
locale,
|
|
86
|
-
localeList,
|
|
87
|
-
setLocale,
|
|
88
|
-
dictionaryId
|
|
89
|
-
}) => {
|
|
90
|
-
const id = (0, import_useDictionaryEditionDrawer.getDrawerIdentifier)(dictionaryId);
|
|
91
|
-
const { focusedContent, close } = (0, import_useDictionaryEditionDrawer.useDictionaryEditionDrawer)(dictionaryId);
|
|
92
|
-
const { openDictionaryListDrawer } = (0, import_design_system.useRightDrawerStore)((s) => ({
|
|
93
|
-
openDictionaryListDrawer: () => s.open(import_dictionaryListDrawerIdentifier.dictionaryListDrawerIdentifier)
|
|
94
|
-
}));
|
|
95
|
-
const handleOnBack = () => {
|
|
96
|
-
close();
|
|
97
|
-
openDictionaryListDrawer();
|
|
98
|
-
};
|
|
99
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
100
|
-
import_design_system.RightDrawer,
|
|
101
|
-
{
|
|
102
|
-
title: dictionaryId,
|
|
103
|
-
identifier: id,
|
|
104
|
-
header: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
105
|
-
import_design_system.LocaleSwitcher,
|
|
106
|
-
{
|
|
107
|
-
setLocale,
|
|
108
|
-
locale,
|
|
109
|
-
localeList
|
|
110
|
-
}
|
|
111
|
-
),
|
|
112
|
-
backButton: {
|
|
113
|
-
onBack: handleOnBack,
|
|
114
|
-
text: (0, import_react_intlayer.t)({
|
|
115
|
-
en: "Dictionary list",
|
|
116
|
-
fr: "Liste des dictionnaires",
|
|
117
|
-
es: "Lista de diccionarios"
|
|
118
|
-
})
|
|
119
|
-
},
|
|
120
|
-
children: focusedContent && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
121
|
-
DictionaryEditionDrawerContent,
|
|
122
|
-
{
|
|
123
|
-
focusedContent,
|
|
124
|
-
locale,
|
|
125
|
-
identifier: id,
|
|
126
|
-
handleOnBack
|
|
127
|
-
}
|
|
128
|
-
)
|
|
129
|
-
}
|
|
130
|
-
);
|
|
131
|
-
};
|
|
132
|
-
const DictionaryEditionDrawerController = ({ locale, localeList, setLocale }) => {
|
|
133
|
-
const focusedContent = (0, import_design_system.useEditionPanelStore)(
|
|
134
|
-
(0, import_shallow.useShallow)((s) => s.focusedContent)
|
|
135
|
-
);
|
|
136
|
-
const dictionaryId = focusedContent?.dictionaryId;
|
|
137
|
-
if (!dictionaryId) {
|
|
138
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, {});
|
|
139
|
-
}
|
|
140
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
141
|
-
DictionaryEditionDrawer,
|
|
142
|
-
{
|
|
143
|
-
locale,
|
|
144
|
-
localeList,
|
|
145
|
-
setLocale,
|
|
146
|
-
dictionaryId
|
|
147
|
-
}
|
|
148
|
-
);
|
|
149
|
-
};
|
|
150
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
151
|
-
0 && (module.exports = {
|
|
152
|
-
DictionaryEditionDrawer,
|
|
153
|
-
DictionaryEditionDrawerContent,
|
|
154
|
-
DictionaryEditionDrawerController
|
|
155
|
-
});
|
|
156
|
-
//# sourceMappingURL=DictionaryEditionDrawer.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
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: t({\n en: 'Dictionary list',\n fr: 'Liste des dictionnaires',\n es: 'Lista de diccionarios',\n }),\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":";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAsD4B;AAlD5B,2BAQO;AACP,mBAAsC;AACtC,mBAA0D;AAC1D,4BAAkB;AAClB,qBAA2B;AAC3B,4CAA+C;AAC/C,wCAIO;AASA,MAAM,iCAET,CAAC,EAAE,QAAQ,YAAY,aAAa,MAAM;AAC5C,QAAM,CAAC,qBAAqB,sBAAsB,QAAI,uBAEpD,IAAI;AACN,QAAM,EAAE,uBAAuB,eAAe,QAC5C,8DAA2B,UAAU;AACvC,QAAM,EAAE,KAAK,aAAa,QAAI,oCAAsB;AAEpD,QAAM,4BAAwB,0BAAY,MAAM;AAC9C,2BAAuB,IAAI;AAC3B,iBAAa;AAAA,EACf,GAAG,CAAC,YAAY,CAAC;AAEjB,8BAAU,MAAM;AACd,QAAI,cAAc;AAChB,4BAAsB,YAAY;AAAA,IACpC;AAAA,EACF,GAAG,CAAC,uBAAuB,YAAY,CAAC;AAExC,QAAM,eAAe,gBAAgB;AAErC,MAAI,CAAC,aAAc,QAAO,2EAAE,mCAAqB;AAEjD,QAAM,aAAyB,aAAa,YAAY;AAExD,SACE,4EACE;AAAA;AAAA,MAAC;AAAA;AAAA,QACC,QAAQ,wBAAwB;AAAA,QAChC,SAAS,MAAM,uBAAuB,IAAI;AAAA,QAC1C,gBAAc;AAAA,QACd,WAAO,yBAAE;AAAA,UACP,IAAI;AAAA,UACJ,IAAI;AAAA,UACJ,IAAI;AAAA,QACN,CAAC;AAAA,QACD,MAAK;AAAA,QACL,cAAa;AAAA,QAEZ,wBACC;AAAA,UAAC;AAAA;AAAA,YACC;AAAA,YACA;AAAA;AAAA,QACF;AAAA;AAAA,IAEJ;AAAA,IACA;AAAA,MAAC;AAAA;AAAA,QACC;AAAA,QACA;AAAA,QACA,aAAa;AAAA;AAAA,IACf;AAAA,KACF;AAEJ;AAMO,MAAM,0BAA4D,CAAC;AAAA,EACxE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,MAAM;AACJ,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,UAAM,yBAAE;AAAA,UACN,IAAI;AAAA,UACJ,IAAI;AAAA,UACJ,IAAI;AAAA,QACN,CAAC;AAAA,MACH;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":[]}
|
|
@@ -1,25 +0,0 @@
|
|
|
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 __copyProps = (to, from, except, desc) => {
|
|
7
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
8
|
-
for (let key of __getOwnPropNames(from))
|
|
9
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
10
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
11
|
-
}
|
|
12
|
-
return to;
|
|
13
|
-
};
|
|
14
|
-
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
15
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
16
|
-
var DictionaryEditionDrawer_exports = {};
|
|
17
|
-
module.exports = __toCommonJS(DictionaryEditionDrawer_exports);
|
|
18
|
-
__reExport(DictionaryEditionDrawer_exports, require('./DictionaryEditionDrawer.cjs'), module.exports);
|
|
19
|
-
__reExport(DictionaryEditionDrawer_exports, require('./useDictionaryEditionDrawer.cjs'), module.exports);
|
|
20
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
21
|
-
0 && (module.exports = {
|
|
22
|
-
...require('./DictionaryEditionDrawer.cjs'),
|
|
23
|
-
...require('./useDictionaryEditionDrawer.cjs')
|
|
24
|
-
});
|
|
25
|
-
//# sourceMappingURL=index.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/DictionaryEditionDrawer/index.ts"],"sourcesContent":["export * from './DictionaryEditionDrawer';\nexport * from './useDictionaryEditionDrawer';\n"],"mappings":";;;;;;;;;;;;;;;AAAA;AAAA;AAAA,4CAAc,sCAAd;AACA,4CAAc,yCADd;","names":[]}
|
|
@@ -1,79 +0,0 @@
|
|
|
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 useDictionaryEditionDrawer_exports = {};
|
|
20
|
-
__export(useDictionaryEditionDrawer_exports, {
|
|
21
|
-
getDrawerIdentifier: () => getDrawerIdentifier,
|
|
22
|
-
useDictionaryEditionDrawer: () => useDictionaryEditionDrawer
|
|
23
|
-
});
|
|
24
|
-
module.exports = __toCommonJS(useDictionaryEditionDrawer_exports);
|
|
25
|
-
var import_design_system = require("@intlayer/design-system");
|
|
26
|
-
var import_react = require("react");
|
|
27
|
-
var import_shallow = require("zustand/shallow");
|
|
28
|
-
const getDrawerIdentifier = (dictionaryId) => `dictionary_edition_${dictionaryId}`;
|
|
29
|
-
const useDictionaryEditionDrawer = (dictionaryId) => {
|
|
30
|
-
const id = getDrawerIdentifier(dictionaryId);
|
|
31
|
-
const { isOpenDrawer, openDrawer, closeDrawer } = (0, import_design_system.useRightDrawerStore)(
|
|
32
|
-
(0, import_shallow.useShallow)((e) => ({
|
|
33
|
-
isOpenDrawer: e.isOpen,
|
|
34
|
-
openDrawer: e.open,
|
|
35
|
-
closeDrawer: e.close
|
|
36
|
-
}))
|
|
37
|
-
);
|
|
38
|
-
const { setDictionariesRecord, getEditedContentValue } = (0, import_design_system.useEditedContentStore)(
|
|
39
|
-
(0, import_shallow.useShallow)((s) => ({
|
|
40
|
-
setDictionariesRecord: s.setDictionariesRecord,
|
|
41
|
-
getEditedContentValue: s.getEditedContentValue
|
|
42
|
-
}))
|
|
43
|
-
);
|
|
44
|
-
const { setFocusedContent, focusedContent } = (0, import_design_system.useEditionPanelStore)(
|
|
45
|
-
(0, import_shallow.useShallow)((s) => ({
|
|
46
|
-
focusedContent: s.focusedContent,
|
|
47
|
-
setFocusedContent: s.setFocusedContent
|
|
48
|
-
}))
|
|
49
|
-
);
|
|
50
|
-
const openDictionaryEditionDrawer = (0, import_react.useCallback)(
|
|
51
|
-
({
|
|
52
|
-
dictionaryId: dictionaryId2,
|
|
53
|
-
dictionaryPath,
|
|
54
|
-
keyPath = []
|
|
55
|
-
}) => {
|
|
56
|
-
setFocusedContent({
|
|
57
|
-
dictionaryId: dictionaryId2,
|
|
58
|
-
dictionaryPath,
|
|
59
|
-
keyPath
|
|
60
|
-
});
|
|
61
|
-
openDrawer(id);
|
|
62
|
-
},
|
|
63
|
-
[openDrawer, setFocusedContent]
|
|
64
|
-
);
|
|
65
|
-
return {
|
|
66
|
-
isOpen: isOpenDrawer(id),
|
|
67
|
-
focusedContent,
|
|
68
|
-
setDictionariesRecord,
|
|
69
|
-
getEditedContentValue,
|
|
70
|
-
open: openDictionaryEditionDrawer,
|
|
71
|
-
close: () => closeDrawer(id)
|
|
72
|
-
};
|
|
73
|
-
};
|
|
74
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
75
|
-
0 && (module.exports = {
|
|
76
|
-
getDrawerIdentifier,
|
|
77
|
-
useDictionaryEditionDrawer
|
|
78
|
-
});
|
|
79
|
-
//# sourceMappingURL=useDictionaryEditionDrawer.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/DictionaryEditionDrawer/useDictionaryEditionDrawer.ts"],"sourcesContent":["import type { Dictionary, DictionaryValue, KeyPath } from '@intlayer/core';\nimport {\n useRightDrawerStore,\n useEditedContentStore,\n useEditionPanelStore,\n} from '@intlayer/design-system';\nimport { useCallback } from 'react';\nimport { useShallow } from 'zustand/shallow';\n\nexport const getDrawerIdentifier = (dictionaryId: string) =>\n `dictionary_edition_${dictionaryId}`;\n\ntype DictionaryId = string;\ntype DictionaryPath = string;\n\nexport type FileContent = {\n dictionaryPath?: DictionaryPath;\n dictionaryId: string;\n keyPath?: KeyPath[];\n};\n\ntype DictionaryEditionDrawer = {\n focusedContent: FileContent | null;\n isOpen: boolean;\n open: (content: FileContent) => void;\n close: () => void;\n setDictionariesRecord: (\n dictionariesRecord: Record<DictionaryId, Dictionary>\n ) => void;\n getEditedContentValue: (\n dictionaryId: DictionaryId,\n keyPath: KeyPath[]\n ) => DictionaryValue | undefined;\n};\n\ntype OpenDictionaryEditionDrawerProps = {\n dictionaryId: string;\n dictionaryPath?: string;\n keyPath?: KeyPath[];\n};\n\nexport const useDictionaryEditionDrawer = (\n dictionaryId: string\n): DictionaryEditionDrawer => {\n const id = getDrawerIdentifier(dictionaryId);\n const { isOpenDrawer, openDrawer, closeDrawer } = useRightDrawerStore(\n useShallow((e) => ({\n isOpenDrawer: e.isOpen,\n openDrawer: e.open,\n closeDrawer: e.close,\n }))\n );\n const { setDictionariesRecord, getEditedContentValue } =\n useEditedContentStore(\n useShallow((s) => ({\n setDictionariesRecord: s.setDictionariesRecord,\n getEditedContentValue: s.getEditedContentValue,\n }))\n );\n const { setFocusedContent, focusedContent } = useEditionPanelStore(\n useShallow((s) => ({\n focusedContent: s.focusedContent,\n setFocusedContent: s.setFocusedContent,\n }))\n );\n\n const openDictionaryEditionDrawer = useCallback(\n ({\n dictionaryId,\n dictionaryPath,\n keyPath = [],\n }: OpenDictionaryEditionDrawerProps) => {\n setFocusedContent({\n dictionaryId,\n dictionaryPath,\n keyPath,\n });\n\n openDrawer(id);\n },\n [openDrawer, setFocusedContent]\n );\n\n return {\n isOpen: isOpenDrawer(id),\n focusedContent,\n setDictionariesRecord,\n getEditedContentValue,\n open: openDictionaryEditionDrawer,\n close: () => closeDrawer(id),\n };\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,2BAIO;AACP,mBAA4B;AAC5B,qBAA2B;AAEpB,MAAM,sBAAsB,CAAC,iBAClC,sBAAsB,YAAY;AA+B7B,MAAM,6BAA6B,CACxC,iBAC4B;AAC5B,QAAM,KAAK,oBAAoB,YAAY;AAC3C,QAAM,EAAE,cAAc,YAAY,YAAY,QAAI;AAAA,QAChD,2BAAW,CAAC,OAAO;AAAA,MACjB,cAAc,EAAE;AAAA,MAChB,YAAY,EAAE;AAAA,MACd,aAAa,EAAE;AAAA,IACjB,EAAE;AAAA,EACJ;AACA,QAAM,EAAE,uBAAuB,sBAAsB,QACnD;AAAA,QACE,2BAAW,CAAC,OAAO;AAAA,MACjB,uBAAuB,EAAE;AAAA,MACzB,uBAAuB,EAAE;AAAA,IAC3B,EAAE;AAAA,EACJ;AACF,QAAM,EAAE,mBAAmB,eAAe,QAAI;AAAA,QAC5C,2BAAW,CAAC,OAAO;AAAA,MACjB,gBAAgB,EAAE;AAAA,MAClB,mBAAmB,EAAE;AAAA,IACvB,EAAE;AAAA,EACJ;AAEA,QAAM,kCAA8B;AAAA,IAClC,CAAC;AAAA,MACC,cAAAA;AAAA,MACA;AAAA,MACA,UAAU,CAAC;AAAA,IACb,MAAwC;AACtC,wBAAkB;AAAA,QAChB,cAAAA;AAAA,QACA;AAAA,QACA;AAAA,MACF,CAAC;AAED,iBAAW,EAAE;AAAA,IACf;AAAA,IACA,CAAC,YAAY,iBAAiB;AAAA,EAChC;AAEA,SAAO;AAAA,IACL,QAAQ,aAAa,EAAE;AAAA,IACvB;AAAA,IACA;AAAA,IACA;AAAA,IACA,MAAM;AAAA,IACN,OAAO,MAAM,YAAY,EAAE;AAAA,EAC7B;AACF;","names":["dictionaryId"]}
|
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
"use client";
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
-
var __export = (target, all) => {
|
|
8
|
-
for (var name in all)
|
|
9
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
-
};
|
|
11
|
-
var __copyProps = (to, from, except, desc) => {
|
|
12
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
-
for (let key of __getOwnPropNames(from))
|
|
14
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
-
}
|
|
17
|
-
return to;
|
|
18
|
-
};
|
|
19
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
20
|
-
var DictionaryListDrawer_exports = {};
|
|
21
|
-
__export(DictionaryListDrawer_exports, {
|
|
22
|
-
DictionaryListDrawer: () => DictionaryListDrawer
|
|
23
|
-
});
|
|
24
|
-
module.exports = __toCommonJS(DictionaryListDrawer_exports);
|
|
25
|
-
var import_jsx_runtime = require("react/jsx-runtime");
|
|
26
|
-
var import_design_system = require("@intlayer/design-system");
|
|
27
|
-
var import_hooks = require("@intlayer/design-system/hooks");
|
|
28
|
-
var import_lucide_react = require("lucide-react");
|
|
29
|
-
var import_react = require("react");
|
|
30
|
-
var import_shallow = require("zustand/shallow");
|
|
31
|
-
var import_useDictionaryEditionDrawer = require('../DictionaryEditionDrawer/useDictionaryEditionDrawer.cjs');
|
|
32
|
-
var import_dictionaryListDrawerIdentifier = require('./dictionaryListDrawerIdentifier.cjs');
|
|
33
|
-
const DictionaryListDrawer = () => {
|
|
34
|
-
const { all: dictionaries } = (0, import_hooks.useGetAllDictionaries)();
|
|
35
|
-
const dictionaryKeyList = (0, import_react.useMemo)(
|
|
36
|
-
() => Object.keys(dictionaries),
|
|
37
|
-
[dictionaries]
|
|
38
|
-
);
|
|
39
|
-
const { closeDrawer, openDrawer } = (0, import_design_system.useRightDrawerStore)(
|
|
40
|
-
(0, import_shallow.useShallow)((s) => ({
|
|
41
|
-
closeDrawer: s.close,
|
|
42
|
-
openDrawer: s.open
|
|
43
|
-
}))
|
|
44
|
-
);
|
|
45
|
-
const editedContent = (0, import_design_system.useEditedContentStore)(
|
|
46
|
-
(0, import_shallow.useShallow)((s) => s.editedContent)
|
|
47
|
-
);
|
|
48
|
-
const setFocusedContent = (0, import_design_system.useEditionPanelStore)(
|
|
49
|
-
(0, import_shallow.useShallow)((s) => s.setFocusedContent)
|
|
50
|
-
);
|
|
51
|
-
const handleClickDictionary = (dictionaryId) => {
|
|
52
|
-
closeDrawer(import_dictionaryListDrawerIdentifier.dictionaryListDrawerIdentifier);
|
|
53
|
-
const { filePath } = dictionaries[dictionaryId];
|
|
54
|
-
setFocusedContent({
|
|
55
|
-
dictionaryId,
|
|
56
|
-
dictionaryPath: filePath
|
|
57
|
-
});
|
|
58
|
-
openDrawer((0, import_useDictionaryEditionDrawer.getDrawerIdentifier)(dictionaryId));
|
|
59
|
-
};
|
|
60
|
-
const isDictionaryEdited = (0, import_react.useCallback)(
|
|
61
|
-
(dictionaryId) => Object.keys(editedContent).includes(dictionaryId),
|
|
62
|
-
[editedContent]
|
|
63
|
-
);
|
|
64
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
65
|
-
import_design_system.RightDrawer,
|
|
66
|
-
{
|
|
67
|
-
title: "Dictionary list",
|
|
68
|
-
identifier: import_dictionaryListDrawerIdentifier.dictionaryListDrawerIdentifier,
|
|
69
|
-
children: dictionaryKeyList.map((dictionaryId) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
70
|
-
import_design_system.Button,
|
|
71
|
-
{
|
|
72
|
-
label: `Open dictionary editor ${dictionaryId}`,
|
|
73
|
-
onClick: () => handleClickDictionary(dictionaryId),
|
|
74
|
-
variant: "hoverable",
|
|
75
|
-
color: "text",
|
|
76
|
-
IconRight: import_lucide_react.ChevronRight,
|
|
77
|
-
size: "md",
|
|
78
|
-
isFullWidth: true,
|
|
79
|
-
children: isDictionaryEdited(dictionaryId) ? `\u270E ${dictionaryId}` : dictionaryId
|
|
80
|
-
}
|
|
81
|
-
) }, dictionaryId))
|
|
82
|
-
}
|
|
83
|
-
) });
|
|
84
|
-
};
|
|
85
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
86
|
-
0 && (module.exports = {
|
|
87
|
-
DictionaryListDrawer
|
|
88
|
-
});
|
|
89
|
-
//# sourceMappingURL=DictionaryListDrawer.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/DictionaryListDrawer/DictionaryListDrawer.tsx"],"sourcesContent":["'use client';\n\nimport { Locales } from '@intlayer/config';\nimport {\n RightDrawer,\n Button,\n useEditedContentStore,\n useEditionPanelStore,\n useRightDrawerStore,\n} from '@intlayer/design-system';\nimport { useGetAllDictionaries } from '@intlayer/design-system/hooks';\nimport { ChevronRight } from 'lucide-react';\nimport { useCallback, useMemo, FC } from 'react';\nimport { useShallow } from 'zustand/shallow';\nimport { getDrawerIdentifier } from '../DictionaryEditionDrawer/useDictionaryEditionDrawer';\nimport { dictionaryListDrawerIdentifier } from './dictionaryListDrawerIdentifier';\n\nexport const DictionaryListDrawer: FC = () => {\n const { all: dictionaries } = useGetAllDictionaries();\n const dictionaryKeyList = useMemo(\n () => Object.keys(dictionaries) as Locales[],\n [dictionaries]\n );\n\n const { closeDrawer, openDrawer } = useRightDrawerStore(\n useShallow((s) => ({\n closeDrawer: s.close,\n openDrawer: s.open,\n }))\n );\n\n const editedContent = useEditedContentStore(\n useShallow((s) => s.editedContent)\n );\n const setFocusedContent = useEditionPanelStore(\n useShallow((s) => s.setFocusedContent)\n );\n\n const handleClickDictionary = (dictionaryId: string) => {\n closeDrawer(dictionaryListDrawerIdentifier);\n\n const { filePath } = dictionaries[dictionaryId];\n setFocusedContent({\n dictionaryId,\n dictionaryPath: filePath,\n });\n\n openDrawer(getDrawerIdentifier(dictionaryId));\n };\n\n const isDictionaryEdited = useCallback(\n (dictionaryId: string) => Object.keys(editedContent).includes(dictionaryId),\n [editedContent]\n );\n\n return (\n <>\n <RightDrawer\n title=\"Dictionary list\"\n identifier={dictionaryListDrawerIdentifier}\n >\n {dictionaryKeyList.map((dictionaryId) => (\n <div key={dictionaryId}>\n <Button\n label={`Open dictionary editor ${dictionaryId}`}\n onClick={() => handleClickDictionary(dictionaryId)}\n variant=\"hoverable\"\n color=\"text\"\n IconRight={ChevronRight}\n size=\"md\"\n isFullWidth\n >\n {isDictionaryEdited(dictionaryId)\n ? `✎ ${dictionaryId}`\n : dictionaryId}\n </Button>\n </div>\n ))}\n </RightDrawer>\n </>\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAwDI;AArDJ,2BAMO;AACP,mBAAsC;AACtC,0BAA6B;AAC7B,mBAAyC;AACzC,qBAA2B;AAC3B,wCAAoC;AACpC,4CAA+C;AAExC,MAAM,uBAA2B,MAAM;AAC5C,QAAM,EAAE,KAAK,aAAa,QAAI,oCAAsB;AACpD,QAAM,wBAAoB;AAAA,IACxB,MAAM,OAAO,KAAK,YAAY;AAAA,IAC9B,CAAC,YAAY;AAAA,EACf;AAEA,QAAM,EAAE,aAAa,WAAW,QAAI;AAAA,QAClC,2BAAW,CAAC,OAAO;AAAA,MACjB,aAAa,EAAE;AAAA,MACf,YAAY,EAAE;AAAA,IAChB,EAAE;AAAA,EACJ;AAEA,QAAM,oBAAgB;AAAA,QACpB,2BAAW,CAAC,MAAM,EAAE,aAAa;AAAA,EACnC;AACA,QAAM,wBAAoB;AAAA,QACxB,2BAAW,CAAC,MAAM,EAAE,iBAAiB;AAAA,EACvC;AAEA,QAAM,wBAAwB,CAAC,iBAAyB;AACtD,gBAAY,oEAA8B;AAE1C,UAAM,EAAE,SAAS,IAAI,aAAa,YAAY;AAC9C,sBAAkB;AAAA,MAChB;AAAA,MACA,gBAAgB;AAAA,IAClB,CAAC;AAED,mBAAW,uDAAoB,YAAY,CAAC;AAAA,EAC9C;AAEA,QAAM,yBAAqB;AAAA,IACzB,CAAC,iBAAyB,OAAO,KAAK,aAAa,EAAE,SAAS,YAAY;AAAA,IAC1E,CAAC,aAAa;AAAA,EAChB;AAEA,SACE,2EACE;AAAA,IAAC;AAAA;AAAA,MACC,OAAM;AAAA,MACN,YAAY;AAAA,MAEX,4BAAkB,IAAI,CAAC,iBACtB,4CAAC,SACC;AAAA,QAAC;AAAA;AAAA,UACC,OAAO,0BAA0B,YAAY;AAAA,UAC7C,SAAS,MAAM,sBAAsB,YAAY;AAAA,UACjD,SAAQ;AAAA,UACR,OAAM;AAAA,UACN,WAAW;AAAA,UACX,MAAK;AAAA,UACL,aAAW;AAAA,UAEV,6BAAmB,YAAY,IAC5B,UAAK,YAAY,KACjB;AAAA;AAAA,MACN,KAbQ,YAcV,CACD;AAAA;AAAA,EACH,GACF;AAEJ;","names":[]}
|
|
@@ -1,29 +0,0 @@
|
|
|
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 dictionaryListDrawerIdentifier_exports = {};
|
|
20
|
-
__export(dictionaryListDrawerIdentifier_exports, {
|
|
21
|
-
dictionaryListDrawerIdentifier: () => dictionaryListDrawerIdentifier
|
|
22
|
-
});
|
|
23
|
-
module.exports = __toCommonJS(dictionaryListDrawerIdentifier_exports);
|
|
24
|
-
const dictionaryListDrawerIdentifier = "dictionaryList";
|
|
25
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
26
|
-
0 && (module.exports = {
|
|
27
|
-
dictionaryListDrawerIdentifier
|
|
28
|
-
});
|
|
29
|
-
//# sourceMappingURL=dictionaryListDrawerIdentifier.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/DictionaryListDrawer/dictionaryListDrawerIdentifier.ts"],"sourcesContent":["export const dictionaryListDrawerIdentifier = 'dictionaryList';\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAO,MAAM,iCAAiC;","names":[]}
|
|
@@ -1,25 +0,0 @@
|
|
|
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 __copyProps = (to, from, except, desc) => {
|
|
7
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
8
|
-
for (let key of __getOwnPropNames(from))
|
|
9
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
10
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
11
|
-
}
|
|
12
|
-
return to;
|
|
13
|
-
};
|
|
14
|
-
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
15
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
16
|
-
var DictionaryListDrawer_exports = {};
|
|
17
|
-
module.exports = __toCommonJS(DictionaryListDrawer_exports);
|
|
18
|
-
__reExport(DictionaryListDrawer_exports, require('./DictionaryListDrawer.cjs'), module.exports);
|
|
19
|
-
__reExport(DictionaryListDrawer_exports, require('./dictionaryListDrawerIdentifier.cjs'), module.exports);
|
|
20
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
21
|
-
0 && (module.exports = {
|
|
22
|
-
...require('./DictionaryListDrawer.cjs'),
|
|
23
|
-
...require('./dictionaryListDrawerIdentifier.cjs')
|
|
24
|
-
});
|
|
25
|
-
//# sourceMappingURL=index.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/DictionaryListDrawer/index.ts"],"sourcesContent":["export * from './DictionaryListDrawer';\nexport * from './dictionaryListDrawerIdentifier';\n"],"mappings":";;;;;;;;;;;;;;;AAAA;AAAA;AAAA,yCAAc,mCAAd;AACA,yCAAc,6CADd;","names":[]}
|