@intlayer/design-system 5.1.3 → 5.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/.vite/manifest.json +3 -14
- package/dist/components/Container/index.cjs +1 -1
- package/dist/components/Container/index.cjs.map +1 -1
- package/dist/components/Container/index.mjs +1 -1
- package/dist/components/Container/index.mjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/ContentEditor.cjs +18 -7
- package/dist/components/DictionaryFieldEditor/ContentEditor.cjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/ContentEditor.d.ts.map +1 -1
- package/dist/components/DictionaryFieldEditor/ContentEditor.mjs +18 -7
- package/dist/components/DictionaryFieldEditor/ContentEditor.mjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/ContentEditorView/TextEditor.cjs +233 -204
- package/dist/components/DictionaryFieldEditor/ContentEditorView/TextEditor.cjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/ContentEditorView/TextEditor.d.ts +1 -0
- package/dist/components/DictionaryFieldEditor/ContentEditorView/TextEditor.d.ts.map +1 -1
- package/dist/components/DictionaryFieldEditor/ContentEditorView/TextEditor.mjs +237 -208
- package/dist/components/DictionaryFieldEditor/ContentEditorView/TextEditor.mjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/EnumKeyInput.cjs +1 -1
- package/dist/components/DictionaryFieldEditor/EnumKeyInput.cjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/EnumKeyInput.mjs +1 -1
- package/dist/components/DictionaryFieldEditor/EnumKeyInput.mjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/NavigationView/NavigationViewNode.cjs +18 -12
- 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 +19 -13
- package/dist/components/DictionaryFieldEditor/NavigationView/NavigationViewNode.mjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/NavigationView/navigationViewNode.content.cjs +64 -0
- package/dist/components/DictionaryFieldEditor/NavigationView/navigationViewNode.content.cjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/NavigationView/navigationViewNode.content.d.ts +64 -0
- package/dist/components/DictionaryFieldEditor/NavigationView/navigationViewNode.content.d.ts.map +1 -1
- package/dist/components/DictionaryFieldEditor/NavigationView/navigationViewNode.content.mjs +64 -0
- package/dist/components/DictionaryFieldEditor/NavigationView/navigationViewNode.content.mjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/StructureEditor.cjs +4 -4
- package/dist/components/DictionaryFieldEditor/StructureEditor.cjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/StructureEditor.d.ts.map +1 -1
- package/dist/components/DictionaryFieldEditor/StructureEditor.mjs +4 -4
- package/dist/components/DictionaryFieldEditor/StructureEditor.mjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/StructureView/StructureView.cjs +2 -2
- package/dist/components/DictionaryFieldEditor/StructureView/StructureView.cjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/StructureView/StructureView.mjs +2 -2
- package/dist/components/DictionaryFieldEditor/StructureView/StructureView.mjs.map +1 -1
- package/dist/components/MaxHeightSmoother/index.cjs +1 -1
- package/dist/components/MaxHeightSmoother/index.cjs.map +1 -1
- package/dist/components/MaxHeightSmoother/index.d.ts.map +1 -1
- package/dist/components/MaxHeightSmoother/index.mjs +1 -1
- package/dist/components/MaxHeightSmoother/index.mjs.map +1 -1
- package/dist/hooks/intlayerAPIHooks.cjs +1 -1
- package/dist/hooks/intlayerAPIHooks.cjs.map +1 -1
- package/dist/hooks/intlayerAPIHooks.d.ts.map +1 -1
- package/dist/hooks/intlayerAPIHooks.mjs +1 -1
- package/dist/hooks/intlayerAPIHooks.mjs.map +1 -1
- package/dist/index-BCuMWKyy.js.map +1 -1
- package/dist/index-BYzBot7l.cjs.map +1 -1
- package/dist/tailwind.css +1 -1
- package/dist/zod-BV4nCGJE.js.map +1 -1
- package/dist/zod-DSrtTSD_.cjs.map +1 -1
- package/package.json +19 -19
- package/dist/components/DictionaryFieldEditor/ContentEditorView/EditorView.cjs +0 -49
- package/dist/components/DictionaryFieldEditor/ContentEditorView/EditorView.cjs.map +0 -1
- package/dist/components/DictionaryFieldEditor/ContentEditorView/EditorView.d.ts +0 -10
- package/dist/components/DictionaryFieldEditor/ContentEditorView/EditorView.d.ts.map +0 -1
- package/dist/components/DictionaryFieldEditor/ContentEditorView/EditorView.mjs +0 -49
- package/dist/components/DictionaryFieldEditor/ContentEditorView/EditorView.mjs.map +0 -1
|
@@ -13,12 +13,12 @@ const hooks_intlayerAPIHooks = require("../../../hooks/intlayerAPIHooks.cjs");
|
|
|
13
13
|
require("deepmerge");
|
|
14
14
|
const utils_object = require("../../../utils/object.cjs");
|
|
15
15
|
const components_Button_Button = require("../../Button/Button.cjs");
|
|
16
|
+
const components_Container_index = require("../../Container/index.cjs");
|
|
16
17
|
const components_ContentEditor_ContentEditorInput = require("../../ContentEditor/ContentEditorInput.cjs");
|
|
17
18
|
const components_ContentEditor_ContentEditorTextArea = require("../../ContentEditor/ContentEditorTextArea.cjs");
|
|
18
19
|
const components_Label_index = require("../../Label/index.cjs");
|
|
19
20
|
require("@intlayer/config/client");
|
|
20
21
|
require("fuse.js");
|
|
21
|
-
require("../../Container/index.cjs");
|
|
22
22
|
require("../../DropDown/index.cjs");
|
|
23
23
|
require("../../Input/Input.cjs");
|
|
24
24
|
require("../../Input/Checkbox.cjs");
|
|
@@ -27,7 +27,6 @@ require("../../LocaleSwitcherContentDropDown/localeSwitcher.content.cjs");
|
|
|
27
27
|
const components_LocaleSwitcherContentDropDown_LocaleSwitcherContentContext = require("../../LocaleSwitcherContentDropDown/LocaleSwitcherContentContext.cjs");
|
|
28
28
|
const components_MarkDownRender_index = require("../../MarkDownRender/index.cjs");
|
|
29
29
|
const components_DictionaryFieldEditor_EnumKeyInput = require("../EnumKeyInput.cjs");
|
|
30
|
-
const components_DictionaryFieldEditor_getIsEditableSection = require("../getIsEditableSection.cjs");
|
|
31
30
|
const components_DictionaryFieldEditor_NavigationView_navigationViewNode_content = require("../NavigationView/navigationViewNode.content.cjs");
|
|
32
31
|
const traceKeys = ["filePath", "id", "nodeType"];
|
|
33
32
|
const ContentEditorTextArea = ({
|
|
@@ -122,7 +121,7 @@ const TranslationTextEditor = ({
|
|
|
122
121
|
keyPath,
|
|
123
122
|
dictionary
|
|
124
123
|
}) => {
|
|
125
|
-
const { locale } = reactIntlayer.useLocale();
|
|
124
|
+
const { locale, defaultLocale } = reactIntlayer.useLocale();
|
|
126
125
|
const { selectedLocales, availableLocales } = components_LocaleSwitcherContentDropDown_LocaleSwitcherContentContext.useLocaleSwitcherContent();
|
|
127
126
|
const sectionContent = section[core.NodeType.Translation];
|
|
128
127
|
const sectionContentKeys = Object.keys(sectionContent);
|
|
@@ -131,20 +130,21 @@ const TranslationTextEditor = ({
|
|
|
131
130
|
// If the translation include content in other locales, we display all of them
|
|
132
131
|
[.../* @__PURE__ */ new Set([...availableLocales, ...sectionContentKeys])]
|
|
133
132
|
);
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
137
|
-
|
|
133
|
+
const content = section[core.NodeType.Translation];
|
|
134
|
+
return /* @__PURE__ */ jsxRuntime.jsx("table", { className: "w-full", children: /* @__PURE__ */ jsxRuntime.jsx("tbody", { className: "flex w-full flex-col gap-2", children: localesList.map((translationKey) => /* @__PURE__ */ jsxRuntime.jsxs(ReactExports.Fragment, { children: [
|
|
135
|
+
/* @__PURE__ */ jsxRuntime.jsx("tr", { className: "mt-2 w-full p-2 text-xs", children: core.getLocaleName(translationKey, locale) }),
|
|
136
|
+
/* @__PURE__ */ jsxRuntime.jsx("tr", { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
137
|
+
TextEditorContainer,
|
|
138
138
|
{
|
|
139
|
-
section:
|
|
139
|
+
section: content[translationKey] ?? core.getEmptyNode(content[defaultLocale]),
|
|
140
140
|
keyPath: [
|
|
141
141
|
...keyPath,
|
|
142
142
|
{ type: core.NodeType.Translation, key: translationKey }
|
|
143
143
|
],
|
|
144
144
|
dictionary
|
|
145
145
|
}
|
|
146
|
-
)
|
|
147
|
-
] }
|
|
146
|
+
) })
|
|
147
|
+
] }, translationKey)) }) });
|
|
148
148
|
};
|
|
149
149
|
const EnumerationTextEditor = ({
|
|
150
150
|
section,
|
|
@@ -152,31 +152,37 @@ const EnumerationTextEditor = ({
|
|
|
152
152
|
dictionary
|
|
153
153
|
}) => {
|
|
154
154
|
const { addEditedContent } = editorReact.useEditedContent();
|
|
155
|
-
const { addNewEnumeration } = reactIntlayer.useDictionary(
|
|
156
|
-
|
|
157
|
-
|
|
155
|
+
const { addNewEnumeration, removeEnumeration } = reactIntlayer.useDictionary(
|
|
156
|
+
components_DictionaryFieldEditor_NavigationView_navigationViewNode_content.navigationViewContent
|
|
157
|
+
);
|
|
158
|
+
const content = section[core.NodeType.Enumeration];
|
|
159
|
+
const firstKey = Object.keys(content)[0];
|
|
160
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-2", children: [
|
|
161
|
+
/* @__PURE__ */ jsxRuntime.jsx("table", { className: "w-full", children: /* @__PURE__ */ jsxRuntime.jsx("tbody", { className: "flex w-full flex-col gap-2", children: Object.keys(
|
|
158
162
|
section[core.NodeType.Enumeration]
|
|
159
|
-
).map((enumKey) =>
|
|
160
|
-
|
|
161
|
-
|
|
163
|
+
).map((enumKey) => {
|
|
164
|
+
const childrenKeyPath = [
|
|
165
|
+
...keyPath,
|
|
166
|
+
{ type: core.NodeType.Enumeration }
|
|
167
|
+
];
|
|
168
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(ReactExports.Fragment, { children: [
|
|
169
|
+
/* @__PURE__ */ jsxRuntime.jsx("tr", { className: "mt-2 w-full", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-1", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
162
170
|
components_Button_Button.Button,
|
|
163
171
|
{
|
|
164
|
-
label:
|
|
172
|
+
label: removeEnumeration.label.value,
|
|
165
173
|
variant: "hoverable",
|
|
166
|
-
size: "icon-md",
|
|
167
174
|
color: "text",
|
|
168
|
-
Icon: lucideReact.
|
|
169
|
-
className: "
|
|
170
|
-
onClick: () => addEditedContent(
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
])
|
|
175
|
+
Icon: lucideReact.Trash,
|
|
176
|
+
className: "ml-auto",
|
|
177
|
+
onClick: () => addEditedContent(
|
|
178
|
+
dictionary.key,
|
|
179
|
+
void 0,
|
|
180
|
+
childrenKeyPath
|
|
181
|
+
),
|
|
182
|
+
children: removeEnumeration.text
|
|
177
183
|
}
|
|
178
|
-
),
|
|
179
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
184
|
+
) }) }),
|
|
185
|
+
/* @__PURE__ */ jsxRuntime.jsx("tr", { className: "w-full p-2", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
180
186
|
components_DictionaryFieldEditor_EnumKeyInput.EnumKeyInput,
|
|
181
187
|
{
|
|
182
188
|
value: enumKey,
|
|
@@ -194,38 +200,35 @@ const EnumerationTextEditor = ({
|
|
|
194
200
|
addEditedContent(dictionary.key, newValue, keyPath);
|
|
195
201
|
}
|
|
196
202
|
}
|
|
197
|
-
)
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
) })
|
|
210
|
-
] }, enumKey)) }),
|
|
211
|
-
/* @__PURE__ */ jsxRuntime.jsx("tfoot", { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
203
|
+
) }),
|
|
204
|
+
/* @__PURE__ */ jsxRuntime.jsx("tr", { className: "block w-full", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
205
|
+
TextEditor,
|
|
206
|
+
{
|
|
207
|
+
section: content[enumKey] ?? core.getEmptyNode(content[firstKey]),
|
|
208
|
+
keyPath: childrenKeyPath,
|
|
209
|
+
dictionary
|
|
210
|
+
}
|
|
211
|
+
) })
|
|
212
|
+
] }, enumKey);
|
|
213
|
+
}) }) }),
|
|
214
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
212
215
|
components_Button_Button.Button,
|
|
213
216
|
{
|
|
214
217
|
label: addNewEnumeration.label.value,
|
|
215
218
|
variant: "hoverable",
|
|
216
219
|
color: "neutral",
|
|
217
220
|
textAlign: "left",
|
|
221
|
+
isFullWidth: true,
|
|
218
222
|
onClick: () => addEditedContent(
|
|
219
223
|
dictionary.key,
|
|
220
|
-
"",
|
|
221
|
-
[...keyPath, { type: core.NodeType.Enumeration, key: "unknown" }]
|
|
222
|
-
false
|
|
224
|
+
core.getEmptyNode(content[firstKey]) ?? "",
|
|
225
|
+
[...keyPath, { type: core.NodeType.Enumeration, key: "unknown" }]
|
|
223
226
|
),
|
|
224
227
|
Icon: lucideReact.Plus,
|
|
225
228
|
className: "m-2",
|
|
226
229
|
children: addNewEnumeration.text
|
|
227
230
|
}
|
|
228
|
-
)
|
|
231
|
+
)
|
|
229
232
|
] });
|
|
230
233
|
};
|
|
231
234
|
const ConditionTextEditor = ({
|
|
@@ -233,83 +236,24 @@ const ConditionTextEditor = ({
|
|
|
233
236
|
keyPath,
|
|
234
237
|
dictionary
|
|
235
238
|
}) => {
|
|
236
|
-
const
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
/* @__PURE__ */ jsxRuntime.jsx("
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
239
|
+
const content = section[core.NodeType.Condition];
|
|
240
|
+
return /* @__PURE__ */ jsxRuntime.jsx("table", { className: "w-full", children: /* @__PURE__ */ jsxRuntime.jsx("tbody", { className: "flex w-full flex-col gap-2", children: ["true", "false", "fallback"].map((condKey) => /* @__PURE__ */ jsxRuntime.jsxs(ReactExports.Fragment, { children: [
|
|
241
|
+
/* @__PURE__ */ jsxRuntime.jsx("tr", { className: "mt-2 block w-full p-2 text-xs", children: String(condKey) }, condKey),
|
|
242
|
+
/* @__PURE__ */ jsxRuntime.jsx("tr", { className: "block w-full", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
243
|
+
TextEditorContainer,
|
|
244
|
+
{
|
|
245
|
+
section: content[condKey] ?? core.getEmptyNode(content["true"]),
|
|
246
|
+
keyPath: [
|
|
247
|
+
...keyPath,
|
|
243
248
|
{
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
size: "icon-md",
|
|
247
|
-
color: "text",
|
|
248
|
-
Icon: lucideReact.X,
|
|
249
|
-
className: "w-16",
|
|
250
|
-
onClick: () => addEditedContent(dictionary.key, void 0, [
|
|
251
|
-
...keyPath,
|
|
252
|
-
{
|
|
253
|
-
type: core.NodeType.Condition,
|
|
254
|
-
key: condKey
|
|
255
|
-
}
|
|
256
|
-
])
|
|
249
|
+
type: core.NodeType.Condition,
|
|
250
|
+
key: condKey
|
|
257
251
|
}
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
components_DictionaryFieldEditor_EnumKeyInput.EnumKeyInput,
|
|
261
|
-
{
|
|
262
|
-
value: condKey,
|
|
263
|
-
onChange: (value) => {
|
|
264
|
-
const preValueContent = section[core.NodeType.Condition];
|
|
265
|
-
const newValueContent = utils_object.renameKey(
|
|
266
|
-
preValueContent,
|
|
267
|
-
condKey,
|
|
268
|
-
value
|
|
269
|
-
);
|
|
270
|
-
const newValue = {
|
|
271
|
-
...section,
|
|
272
|
-
[core.NodeType.Condition]: newValueContent
|
|
273
|
-
};
|
|
274
|
-
addEditedContent(dictionary.key, newValue, keyPath);
|
|
275
|
-
}
|
|
276
|
-
}
|
|
277
|
-
)
|
|
278
|
-
] }) }),
|
|
279
|
-
/* @__PURE__ */ jsxRuntime.jsx("td", { className: "w-full p-2", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
280
|
-
TextEditor,
|
|
281
|
-
{
|
|
282
|
-
section: section[core.NodeType.Enumeration][condKey],
|
|
283
|
-
keyPath: [
|
|
284
|
-
...keyPath,
|
|
285
|
-
{
|
|
286
|
-
type: core.NodeType.Array,
|
|
287
|
-
key: parseInt(condKey)
|
|
288
|
-
}
|
|
289
|
-
],
|
|
290
|
-
dictionary
|
|
291
|
-
}
|
|
292
|
-
) })
|
|
293
|
-
] }, condKey)) }),
|
|
294
|
-
/* @__PURE__ */ jsxRuntime.jsx("tfoot", { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
295
|
-
components_Button_Button.Button,
|
|
296
|
-
{
|
|
297
|
-
label: addNewEnumeration.label.value,
|
|
298
|
-
variant: "hoverable",
|
|
299
|
-
color: "neutral",
|
|
300
|
-
textAlign: "left",
|
|
301
|
-
onClick: () => addEditedContent(
|
|
302
|
-
dictionary.key,
|
|
303
|
-
"",
|
|
304
|
-
[...keyPath, { type: core.NodeType.Enumeration, key: "unknown" }],
|
|
305
|
-
false
|
|
306
|
-
),
|
|
307
|
-
Icon: lucideReact.Plus,
|
|
308
|
-
className: "m-2",
|
|
309
|
-
children: addNewEnumeration.text
|
|
252
|
+
],
|
|
253
|
+
dictionary
|
|
310
254
|
}
|
|
311
|
-
) })
|
|
312
|
-
] });
|
|
255
|
+
) }, condKey)
|
|
256
|
+
] }, condKey)) }) });
|
|
313
257
|
};
|
|
314
258
|
const ArrayTextEditor = ({
|
|
315
259
|
section,
|
|
@@ -317,14 +261,38 @@ const ArrayTextEditor = ({
|
|
|
317
261
|
dictionary
|
|
318
262
|
}) => {
|
|
319
263
|
const { addEditedContent } = editorReact.useEditedContent();
|
|
320
|
-
const { addNewElement } = reactIntlayer.useDictionary(components_DictionaryFieldEditor_NavigationView_navigationViewNode_content.navigationViewContent);
|
|
321
|
-
return /* @__PURE__ */ jsxRuntime.jsxs("
|
|
322
|
-
/* @__PURE__ */ jsxRuntime.jsx("tbody", { className: "
|
|
323
|
-
/* @__PURE__ */ jsxRuntime.
|
|
324
|
-
|
|
325
|
-
|
|
264
|
+
const { addNewElement, removeElement } = reactIntlayer.useDictionary(components_DictionaryFieldEditor_NavigationView_navigationViewNode_content.navigationViewContent);
|
|
265
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-2", children: [
|
|
266
|
+
/* @__PURE__ */ jsxRuntime.jsx("table", { className: "w-full", children: /* @__PURE__ */ jsxRuntime.jsx("tbody", { className: "flex w-full flex-col gap-2", children: section.map((subSection, index) => /* @__PURE__ */ jsxRuntime.jsxs(ReactExports.Fragment, { children: [
|
|
267
|
+
/* @__PURE__ */ jsxRuntime.jsxs("tr", { className: "mt-2 flex w-full justify-between gap-2 p-2", children: [
|
|
268
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-xs", children: String(index) }),
|
|
269
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
270
|
+
components_Button_Button.Button,
|
|
271
|
+
{
|
|
272
|
+
label: removeElement.label.value,
|
|
273
|
+
variant: "hoverable",
|
|
274
|
+
color: "neutral",
|
|
275
|
+
className: "ml-auto",
|
|
276
|
+
textAlign: "left",
|
|
277
|
+
onClick: () => {
|
|
278
|
+
const newKeyPath = [
|
|
279
|
+
...keyPath,
|
|
280
|
+
{
|
|
281
|
+
type: core.NodeType.Array,
|
|
282
|
+
key: section.length
|
|
283
|
+
}
|
|
284
|
+
];
|
|
285
|
+
addEditedContent(dictionary.key, void 0, newKeyPath);
|
|
286
|
+
},
|
|
287
|
+
Icon: lucideReact.Trash,
|
|
288
|
+
children: removeElement.text
|
|
289
|
+
}
|
|
290
|
+
)
|
|
291
|
+
] }),
|
|
292
|
+
/* @__PURE__ */ jsxRuntime.jsx("tr", { className: "block w-full", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
293
|
+
TextEditorContainer,
|
|
326
294
|
{
|
|
327
|
-
section: subSection,
|
|
295
|
+
section: subSection ?? core.getEmptyNode(section[0]),
|
|
328
296
|
keyPath: [
|
|
329
297
|
...keyPath,
|
|
330
298
|
{
|
|
@@ -335,14 +303,15 @@ const ArrayTextEditor = ({
|
|
|
335
303
|
dictionary
|
|
336
304
|
}
|
|
337
305
|
) })
|
|
338
|
-
] }, JSON.stringify(subSection))) }),
|
|
339
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
306
|
+
] }, JSON.stringify(subSection))) }) }),
|
|
307
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
340
308
|
components_Button_Button.Button,
|
|
341
309
|
{
|
|
342
310
|
label: addNewElement.label.value,
|
|
343
311
|
variant: "hoverable",
|
|
344
312
|
color: "neutral",
|
|
345
313
|
textAlign: "left",
|
|
314
|
+
isFullWidth: true,
|
|
346
315
|
onClick: () => {
|
|
347
316
|
const newKeyPath = [
|
|
348
317
|
...keyPath,
|
|
@@ -351,14 +320,54 @@ const ArrayTextEditor = ({
|
|
|
351
320
|
key: section.length
|
|
352
321
|
}
|
|
353
322
|
];
|
|
354
|
-
addEditedContent(
|
|
323
|
+
addEditedContent(
|
|
324
|
+
dictionary.key,
|
|
325
|
+
core.getEmptyNode(section[0]) ?? "",
|
|
326
|
+
newKeyPath,
|
|
327
|
+
false
|
|
328
|
+
);
|
|
355
329
|
},
|
|
356
330
|
Icon: lucideReact.Plus,
|
|
357
331
|
children: addNewElement.text
|
|
358
332
|
}
|
|
359
|
-
)
|
|
333
|
+
)
|
|
360
334
|
] });
|
|
361
335
|
};
|
|
336
|
+
const ObjectTextEditor = ({
|
|
337
|
+
section,
|
|
338
|
+
keyPath,
|
|
339
|
+
dictionary
|
|
340
|
+
}) => /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: /* @__PURE__ */ jsxRuntime.jsx("table", { className: "w-full", children: /* @__PURE__ */ jsxRuntime.jsx("tbody", { className: "flex flex-col gap-2", children: Object.keys(section).map(
|
|
341
|
+
(key) => {
|
|
342
|
+
const childKeyPath = [
|
|
343
|
+
...keyPath,
|
|
344
|
+
{ type: core.NodeType.Object, key }
|
|
345
|
+
];
|
|
346
|
+
const typedSection = section;
|
|
347
|
+
const firstKey = Object.keys(
|
|
348
|
+
typedSection
|
|
349
|
+
)[0];
|
|
350
|
+
const subSection = typedSection[key] ?? core.getEmptyNode(typedSection[firstKey]);
|
|
351
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(ReactExports.Fragment, { children: [
|
|
352
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
353
|
+
"tr",
|
|
354
|
+
{
|
|
355
|
+
className: "mt-2 p-2 text-xs",
|
|
356
|
+
children: String(key)
|
|
357
|
+
},
|
|
358
|
+
JSON.stringify(subSection)
|
|
359
|
+
),
|
|
360
|
+
/* @__PURE__ */ jsxRuntime.jsx("tr", { className: "block w-full", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
361
|
+
TextEditor,
|
|
362
|
+
{
|
|
363
|
+
section: subSection,
|
|
364
|
+
keyPath: childKeyPath,
|
|
365
|
+
dictionary
|
|
366
|
+
}
|
|
367
|
+
) }, JSON.stringify(subSection))
|
|
368
|
+
] }, key);
|
|
369
|
+
}
|
|
370
|
+
) }) }) });
|
|
362
371
|
const MarkdownTextEditor = ({
|
|
363
372
|
section,
|
|
364
373
|
keyPath,
|
|
@@ -469,76 +478,82 @@ const TextEditor = ({
|
|
|
469
478
|
}) => {
|
|
470
479
|
const { tsxNotEditable } = reactIntlayer.useDictionary(components_DictionaryFieldEditor_NavigationView_navigationViewNode_content.navigationViewContent);
|
|
471
480
|
const nodeType = core.getNodeType(section);
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
481
|
+
if (nodeType === core.NodeType.ReactNode) {
|
|
482
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
483
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { children: "[React Node]" }),
|
|
484
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-neutral dark:text-neutral-dark text-xs", children: tsxNotEditable })
|
|
485
|
+
] });
|
|
486
|
+
}
|
|
487
|
+
if (nodeType === core.NodeType.Nested) {
|
|
488
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
489
|
+
NestedTextEditor,
|
|
490
|
+
{
|
|
491
|
+
dictionary,
|
|
492
|
+
keyPath,
|
|
493
|
+
section
|
|
494
|
+
}
|
|
495
|
+
);
|
|
496
|
+
}
|
|
497
|
+
if (nodeType === core.NodeType.Translation) {
|
|
498
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
499
|
+
TranslationTextEditor,
|
|
500
|
+
{
|
|
501
|
+
dictionary,
|
|
502
|
+
keyPath,
|
|
503
|
+
section
|
|
504
|
+
}
|
|
505
|
+
);
|
|
506
|
+
}
|
|
507
|
+
if (nodeType === core.NodeType.Enumeration) {
|
|
508
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
509
|
+
EnumerationTextEditor,
|
|
510
|
+
{
|
|
511
|
+
dictionary,
|
|
512
|
+
keyPath,
|
|
513
|
+
section
|
|
514
|
+
}
|
|
515
|
+
);
|
|
516
|
+
}
|
|
517
|
+
if (nodeType === core.NodeType.Condition) {
|
|
518
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
519
|
+
ConditionTextEditor,
|
|
520
|
+
{
|
|
521
|
+
dictionary,
|
|
522
|
+
keyPath,
|
|
523
|
+
section
|
|
524
|
+
}
|
|
525
|
+
);
|
|
526
|
+
}
|
|
527
|
+
if (nodeType === core.NodeType.Markdown) {
|
|
528
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
529
|
+
MarkdownTextEditor,
|
|
530
|
+
{
|
|
531
|
+
dictionary,
|
|
532
|
+
keyPath,
|
|
533
|
+
section,
|
|
534
|
+
isDarkMode
|
|
535
|
+
}
|
|
536
|
+
);
|
|
537
|
+
}
|
|
538
|
+
if (nodeType === core.NodeType.Array) {
|
|
539
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
540
|
+
ArrayTextEditor,
|
|
541
|
+
{
|
|
542
|
+
dictionary,
|
|
543
|
+
keyPath,
|
|
544
|
+
section
|
|
545
|
+
}
|
|
546
|
+
);
|
|
547
|
+
}
|
|
548
|
+
if (nodeType === core.NodeType.Object) {
|
|
549
|
+
return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
550
|
+
ObjectTextEditor,
|
|
551
|
+
{
|
|
552
|
+
dictionary,
|
|
553
|
+
keyPath,
|
|
554
|
+
section
|
|
555
|
+
}
|
|
556
|
+
) });
|
|
542
557
|
}
|
|
543
558
|
if (nodeType === core.NodeType.Number) {
|
|
544
559
|
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-full p-2", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -576,9 +591,23 @@ const TextEditor = ({
|
|
|
576
591
|
}
|
|
577
592
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "w-full p-2", children: [
|
|
578
593
|
"Error. Format not supported.",
|
|
579
|
-
JSON.stringify(section)
|
|
594
|
+
JSON.stringify(section, null, 2),
|
|
595
|
+
JSON.stringify(keyPath, null, 2),
|
|
596
|
+
"NodeType : ",
|
|
597
|
+
nodeType
|
|
580
598
|
] });
|
|
581
599
|
};
|
|
600
|
+
const TextEditorContainer = (props) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
601
|
+
components_Container_index.Container,
|
|
602
|
+
{
|
|
603
|
+
border: true,
|
|
604
|
+
background: "none",
|
|
605
|
+
className: "top-6 flex h-full flex-1 flex-col gap-6 overflow-hidden p-2 md:sticky",
|
|
606
|
+
roundedSize: "xl",
|
|
607
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(TextEditor, { ...props })
|
|
608
|
+
}
|
|
609
|
+
);
|
|
582
610
|
exports.TextEditor = TextEditor;
|
|
611
|
+
exports.TextEditorContainer = TextEditorContainer;
|
|
583
612
|
exports.traceKeys = traceKeys;
|
|
584
613
|
//# sourceMappingURL=TextEditor.cjs.map
|