payload-intl 1.3.2 → 1.4.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/README.md +23 -3
- package/dist/components/MessagesField.d.ts +12 -0
- package/dist/components/MessagesField.d.ts.map +1 -0
- package/dist/components/MessagesField.js +36 -0
- package/dist/components/MessagesField.js.map +1 -0
- package/dist/components/MessagesImport.d.ts +2 -0
- package/dist/components/MessagesImport.d.ts.map +1 -0
- package/dist/components/MessagesImport.js +68 -0
- package/dist/components/MessagesImport.js.map +1 -0
- package/dist/components/MessagesImport.module.css +8 -0
- package/dist/components/input/LexicalInput.d.ts +8 -0
- package/dist/components/input/LexicalInput.d.ts.map +1 -0
- package/dist/components/input/LexicalInput.js +21 -0
- package/dist/components/input/LexicalInput.js.map +1 -0
- package/dist/components/input/MessageInput.d.ts +12 -0
- package/dist/components/input/MessageInput.d.ts.map +1 -0
- package/dist/components/{inputs → input}/MessageInput.js +31 -38
- package/dist/components/input/MessageInput.js.map +1 -0
- package/dist/components/{inputs → input}/MessageInput.module.css +14 -19
- package/dist/components/{inputs → input}/ReferencePopover.d.ts +1 -1
- package/dist/components/input/ReferencePopover.d.ts.map +1 -0
- package/dist/components/{inputs → input}/ReferencePopover.js +20 -5
- package/dist/components/input/ReferencePopover.js.map +1 -0
- package/dist/components/input/SingleLinePlugin.d.ts.map +1 -0
- package/dist/components/input/SingleLinePlugin.js.map +1 -0
- package/dist/components/{hooks → input}/useHtmlLexicalAdapter.d.ts.map +1 -1
- package/dist/components/{hooks → input}/useHtmlLexicalAdapter.js.map +1 -1
- package/dist/{utils/format.d.ts → components/input/utils.d.ts} +2 -2
- package/dist/components/input/utils.d.ts.map +1 -0
- package/dist/{utils/format.js → components/input/utils.js} +2 -2
- package/dist/components/input/utils.js.map +1 -0
- package/dist/components/input/variables/VariableChip.d.ts.map +1 -0
- package/dist/components/{inputs → input}/variables/VariableChip.js +1 -2
- package/dist/components/input/variables/VariableChip.js.map +1 -0
- package/dist/components/input/variables/VariableIcon.d.ts.map +1 -0
- package/dist/components/input/variables/VariableIcon.js.map +1 -0
- package/dist/components/input/variables/VariableNode.d.ts.map +1 -0
- package/dist/components/input/variables/VariableNode.js.map +1 -0
- package/dist/components/input/variables/VariableSuggestion.d.ts.map +1 -0
- package/dist/components/input/variables/VariableSuggestion.js.map +1 -0
- package/dist/components/input/variables/editors/PluralVariableEditor.d.ts.map +1 -0
- package/dist/components/{inputs → input}/variables/editors/PluralVariableEditor.js +1 -1
- package/dist/components/input/variables/editors/PluralVariableEditor.js.map +1 -0
- package/dist/components/input/variables/editors/SelectVariableEditor.d.ts.map +1 -0
- package/dist/components/{inputs → input}/variables/editors/SelectVariableEditor.js +1 -1
- package/dist/components/input/variables/editors/SelectVariableEditor.js.map +1 -0
- package/dist/components/input/variables/editors/TagVariableEditor.d.ts.map +1 -0
- package/dist/components/{inputs → input}/variables/editors/TagVariableEditor.js +1 -1
- package/dist/components/input/variables/editors/TagVariableEditor.js.map +1 -0
- package/dist/components/input/variables/editors/TemporalVariableEditor.d.ts.map +1 -0
- package/dist/components/input/variables/editors/TemporalVariableEditor.js.map +1 -0
- package/dist/components/input/variables/pickers/NumericVariableEditor.d.ts.map +1 -0
- package/dist/components/{inputs → input}/variables/pickers/NumericVariableEditor.js +1 -1
- package/dist/components/input/variables/pickers/NumericVariableEditor.js.map +1 -0
- package/dist/components/input/variables/pickers/TemporalVariablePicker.d.ts.map +1 -0
- package/dist/components/{inputs → input}/variables/pickers/TemporalVariablePicker.js +1 -1
- package/dist/components/input/variables/pickers/TemporalVariablePicker.js.map +1 -0
- package/dist/components/layout/MessageField.d.ts +5 -4
- package/dist/components/layout/MessageField.d.ts.map +1 -1
- package/dist/components/layout/MessageField.js +44 -51
- package/dist/components/layout/MessageField.js.map +1 -1
- package/dist/components/layout/MessageField.module.css +17 -5
- package/dist/components/layout/MessagesTabs.d.ts.map +1 -1
- package/dist/components/layout/MessagesTabs.js +9 -19
- package/dist/components/layout/MessagesTabs.js.map +1 -1
- package/dist/components/layout/MessagesTree.d.ts +7 -5
- package/dist/components/layout/MessagesTree.d.ts.map +1 -1
- package/dist/components/layout/MessagesTree.js +12 -22
- package/dist/components/layout/MessagesTree.js.map +1 -1
- package/dist/components/layout/MessagesTree.module.css +7 -3
- package/dist/{utils/config.d.ts → config.d.ts} +1 -1
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js.map +1 -0
- package/dist/const.d.ts +3 -9
- package/dist/const.d.ts.map +1 -1
- package/dist/const.js +3 -12
- package/dist/const.js.map +1 -1
- package/dist/exports/client.d.ts +3 -1
- package/dist/exports/client.d.ts.map +1 -1
- package/dist/exports/client.js +3 -1
- package/dist/exports/client.js.map +1 -1
- package/dist/exports/fetchMessages.d.ts +4 -0
- package/dist/exports/fetchMessages.d.ts.map +1 -0
- package/dist/exports/fetchMessages.js +18 -0
- package/dist/exports/fetchMessages.js.map +1 -0
- package/dist/exports/rsc.d.ts +0 -2
- package/dist/exports/rsc.d.ts.map +1 -1
- package/dist/exports/rsc.js +0 -2
- package/dist/exports/rsc.js.map +1 -1
- package/dist/file-storage-hooks.d.ts +17 -0
- package/dist/file-storage-hooks.d.ts.map +1 -0
- package/dist/file-storage-hooks.js +37 -0
- package/dist/file-storage-hooks.js.map +1 -0
- package/dist/hooks.d.ts +19 -3
- package/dist/hooks.d.ts.map +1 -1
- package/dist/hooks.js +41 -20
- package/dist/hooks.js.map +1 -1
- package/dist/icu/guards.d.ts.map +1 -0
- package/dist/icu/guards.js.map +1 -0
- package/dist/icu/index.d.ts +6 -0
- package/dist/icu/index.d.ts.map +1 -0
- package/dist/icu/index.js +7 -0
- package/dist/icu/index.js.map +1 -0
- package/dist/{utils/icu-tranform.d.ts → icu/lexical.d.ts} +1 -10
- package/dist/icu/lexical.d.ts.map +1 -0
- package/dist/{utils/icu-tranform.js → icu/lexical.js} +4 -44
- package/dist/icu/lexical.js.map +1 -0
- package/dist/icu/schema.d.ts +4 -0
- package/dist/icu/schema.d.ts.map +1 -0
- package/dist/icu/schema.js +43 -0
- package/dist/icu/schema.js.map +1 -0
- package/dist/icu/serialize.d.ts +11 -0
- package/dist/icu/serialize.d.ts.map +1 -0
- package/dist/icu/serialize.js +45 -0
- package/dist/icu/serialize.js.map +1 -0
- package/dist/icu/validate.d.ts.map +1 -0
- package/dist/icu/validate.js.map +1 -0
- package/dist/index.d.ts +23 -22
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +181 -37
- package/dist/index.js.map +1 -1
- package/dist/payload-types.d.ts +43 -16
- package/dist/payload-types.d.ts.map +1 -1
- package/dist/types.d.ts +24 -8
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js.map +1 -1
- package/dist/utils/file-storage.d.ts +26 -0
- package/dist/utils/file-storage.d.ts.map +1 -0
- package/dist/utils/file-storage.js +61 -0
- package/dist/utils/file-storage.js.map +1 -0
- package/dist/utils/sanitize.d.ts +5 -3
- package/dist/utils/sanitize.d.ts.map +1 -1
- package/dist/utils/sanitize.js +4 -2
- package/dist/utils/sanitize.js.map +1 -1
- package/dist/utils/schema.d.ts +5 -7
- package/dist/utils/schema.d.ts.map +1 -1
- package/dist/utils/schema.js +11 -39
- package/dist/utils/schema.js.map +1 -1
- package/dist/utils/scopes.d.ts +3 -0
- package/dist/utils/scopes.d.ts.map +1 -0
- package/dist/utils/scopes.js +24 -0
- package/dist/utils/scopes.js.map +1 -0
- package/package.json +5 -5
- package/dist/components/MessageFormField.d.ts +0 -14
- package/dist/components/MessageFormField.d.ts.map +0 -1
- package/dist/components/MessageFormField.js +0 -28
- package/dist/components/MessageFormField.js.map +0 -1
- package/dist/components/MessagesForm.d.ts +0 -13
- package/dist/components/MessagesForm.d.ts.map +0 -1
- package/dist/components/MessagesForm.js +0 -120
- package/dist/components/MessagesForm.js.map +0 -1
- package/dist/components/MessagesForm.module.css +0 -41
- package/dist/components/MessagesFormProvider.d.ts +0 -33
- package/dist/components/MessagesFormProvider.d.ts.map +0 -1
- package/dist/components/MessagesFormProvider.js +0 -34
- package/dist/components/MessagesFormProvider.js.map +0 -1
- package/dist/components/MessagesLink.d.ts +0 -8
- package/dist/components/MessagesLink.d.ts.map +0 -1
- package/dist/components/MessagesLink.js +0 -22
- package/dist/components/MessagesLink.js.map +0 -1
- package/dist/components/MessagesView.d.ts +0 -10
- package/dist/components/MessagesView.d.ts.map +0 -1
- package/dist/components/MessagesView.js +0 -57
- package/dist/components/MessagesView.js.map +0 -1
- package/dist/components/actions/CopyMessages.d.ts +0 -2
- package/dist/components/actions/CopyMessages.d.ts.map +0 -1
- package/dist/components/actions/CopyMessages.js +0 -41
- package/dist/components/actions/CopyMessages.js.map +0 -1
- package/dist/components/actions/CopyMessages.module.css +0 -8
- package/dist/components/actions/JsonImport.d.ts +0 -5
- package/dist/components/actions/JsonImport.d.ts.map +0 -1
- package/dist/components/actions/JsonImport.js +0 -52
- package/dist/components/actions/JsonImport.js.map +0 -1
- package/dist/components/actions/JsonImport.module.css +0 -14
- package/dist/components/hooks/useMessagesFormSubmit.d.ts +0 -11
- package/dist/components/hooks/useMessagesFormSubmit.d.ts.map +0 -1
- package/dist/components/hooks/useMessagesFormSubmit.js +0 -44
- package/dist/components/hooks/useMessagesFormSubmit.js.map +0 -1
- package/dist/components/inputs/FieldWrapper.d.ts +0 -8
- package/dist/components/inputs/FieldWrapper.d.ts.map +0 -1
- package/dist/components/inputs/FieldWrapper.js +0 -24
- package/dist/components/inputs/FieldWrapper.js.map +0 -1
- package/dist/components/inputs/FieldWrapper.module.css +0 -24
- package/dist/components/inputs/LexicalInput.d.ts +0 -9
- package/dist/components/inputs/LexicalInput.d.ts.map +0 -1
- package/dist/components/inputs/LexicalInput.js +0 -26
- package/dist/components/inputs/LexicalInput.js.map +0 -1
- package/dist/components/inputs/MessageInput.d.ts +0 -14
- package/dist/components/inputs/MessageInput.d.ts.map +0 -1
- package/dist/components/inputs/MessageInput.js.map +0 -1
- package/dist/components/inputs/ReferencePopover.d.ts.map +0 -1
- package/dist/components/inputs/ReferencePopover.js.map +0 -1
- package/dist/components/inputs/SingleLinePlugin.d.ts.map +0 -1
- package/dist/components/inputs/SingleLinePlugin.js.map +0 -1
- package/dist/components/inputs/variables/VariableChip.d.ts.map +0 -1
- package/dist/components/inputs/variables/VariableChip.js.map +0 -1
- package/dist/components/inputs/variables/VariableIcon.d.ts.map +0 -1
- package/dist/components/inputs/variables/VariableIcon.js.map +0 -1
- package/dist/components/inputs/variables/VariableNode.d.ts.map +0 -1
- package/dist/components/inputs/variables/VariableNode.js.map +0 -1
- package/dist/components/inputs/variables/VariableSuggestion.d.ts.map +0 -1
- package/dist/components/inputs/variables/VariableSuggestion.js.map +0 -1
- package/dist/components/inputs/variables/editors/PluralVariableEditor.d.ts.map +0 -1
- package/dist/components/inputs/variables/editors/PluralVariableEditor.js.map +0 -1
- package/dist/components/inputs/variables/editors/SelectVariableEditor.d.ts.map +0 -1
- package/dist/components/inputs/variables/editors/SelectVariableEditor.js.map +0 -1
- package/dist/components/inputs/variables/editors/TagVariableEditor.d.ts.map +0 -1
- package/dist/components/inputs/variables/editors/TagVariableEditor.js.map +0 -1
- package/dist/components/inputs/variables/editors/TemporalVariableEditor.d.ts.map +0 -1
- package/dist/components/inputs/variables/editors/TemporalVariableEditor.js.map +0 -1
- package/dist/components/inputs/variables/pickers/NumericVariableEditor.d.ts.map +0 -1
- package/dist/components/inputs/variables/pickers/NumericVariableEditor.js.map +0 -1
- package/dist/components/inputs/variables/pickers/TemporalVariablePicker.d.ts.map +0 -1
- package/dist/components/inputs/variables/pickers/TemporalVariablePicker.js.map +0 -1
- package/dist/components/layout/GroupStatusDot.d.ts +0 -6
- package/dist/components/layout/GroupStatusDot.d.ts.map +0 -1
- package/dist/components/layout/GroupStatusDot.js +0 -24
- package/dist/components/layout/GroupStatusDot.js.map +0 -1
- package/dist/components/layout/StatusDot.d.ts +0 -7
- package/dist/components/layout/StatusDot.d.ts.map +0 -1
- package/dist/components/layout/StatusDot.js +0 -12
- package/dist/components/layout/StatusDot.js.map +0 -1
- package/dist/components/layout/StatusDot.module.css +0 -16
- package/dist/endpoints/set-messages.d.ts +0 -3
- package/dist/endpoints/set-messages.d.ts.map +0 -1
- package/dist/endpoints/set-messages.js +0 -105
- package/dist/endpoints/set-messages.js.map +0 -1
- package/dist/entities.d.ts +0 -5
- package/dist/entities.d.ts.map +0 -1
- package/dist/entities.js +0 -42
- package/dist/entities.js.map +0 -1
- package/dist/requests/fetchMessages.d.ts +0 -3
- package/dist/requests/fetchMessages.d.ts.map +0 -1
- package/dist/requests/fetchMessages.js +0 -40
- package/dist/requests/fetchMessages.js.map +0 -1
- package/dist/utils/config.d.ts.map +0 -1
- package/dist/utils/config.js.map +0 -1
- package/dist/utils/format.d.ts.map +0 -1
- package/dist/utils/format.js.map +0 -1
- package/dist/utils/guards.d.ts.map +0 -1
- package/dist/utils/guards.js.map +0 -1
- package/dist/utils/icu-tranform.d.ts.map +0 -1
- package/dist/utils/icu-tranform.js.map +0 -1
- package/dist/utils/validate.d.ts.map +0 -1
- package/dist/utils/validate.js.map +0 -1
- /package/dist/components/{inputs → input}/ReferencePopover.module.css +0 -0
- /package/dist/components/{inputs → input}/SingleLinePlugin.d.ts +0 -0
- /package/dist/components/{inputs → input}/SingleLinePlugin.js +0 -0
- /package/dist/components/{hooks → input}/useHtmlLexicalAdapter.d.ts +0 -0
- /package/dist/components/{hooks → input}/useHtmlLexicalAdapter.js +0 -0
- /package/dist/components/{inputs → input}/variables/VariableChip.d.ts +0 -0
- /package/dist/components/{inputs → input}/variables/VariableChip.module.css +0 -0
- /package/dist/components/{inputs → input}/variables/VariableIcon.d.ts +0 -0
- /package/dist/components/{inputs → input}/variables/VariableIcon.js +0 -0
- /package/dist/components/{inputs → input}/variables/VariableNode.d.ts +0 -0
- /package/dist/components/{inputs → input}/variables/VariableNode.js +0 -0
- /package/dist/components/{inputs → input}/variables/VariableSuggestion.d.ts +0 -0
- /package/dist/components/{inputs → input}/variables/VariableSuggestion.js +0 -0
- /package/dist/components/{inputs → input}/variables/VariableSuggestion.module.css +0 -0
- /package/dist/components/{inputs → input}/variables/editors/PluralVariableEditor.d.ts +0 -0
- /package/dist/components/{inputs → input}/variables/editors/PluralVariableEditor.module.css +0 -0
- /package/dist/components/{inputs → input}/variables/editors/SelectVariableEditor.d.ts +0 -0
- /package/dist/components/{inputs → input}/variables/editors/SelectVariableEditor.module.css +0 -0
- /package/dist/components/{inputs → input}/variables/editors/TagVariableEditor.d.ts +0 -0
- /package/dist/components/{inputs → input}/variables/editors/TagVariableEditor.module.css +0 -0
- /package/dist/components/{inputs → input}/variables/editors/TemporalVariableEditor.d.ts +0 -0
- /package/dist/components/{inputs → input}/variables/editors/TemporalVariableEditor.js +0 -0
- /package/dist/components/{inputs → input}/variables/pickers/NumericVariableEditor.d.ts +0 -0
- /package/dist/components/{inputs → input}/variables/pickers/NumericVariableEditor.module.css +0 -0
- /package/dist/components/{inputs → input}/variables/pickers/TemporalVariablePicker.d.ts +0 -0
- /package/dist/components/{inputs → input}/variables/pickers/TemporalVariablePicker.module.css +0 -0
- /package/dist/{utils/config.js → config.js} +0 -0
- /package/dist/{utils → icu}/guards.d.ts +0 -0
- /package/dist/{utils → icu}/guards.js +0 -0
- /package/dist/{utils → icu}/validate.d.ts +0 -0
- /package/dist/{utils → icu}/validate.js +0 -0
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { BasePayload } from 'payload';
|
|
2
|
+
import type { Messages } from '../types';
|
|
3
|
+
interface PersistOptions {
|
|
4
|
+
readonly payload: BasePayload;
|
|
5
|
+
readonly collection: string;
|
|
6
|
+
readonly data: Messages;
|
|
7
|
+
readonly locale: string;
|
|
8
|
+
readonly existingFileId?: number | string;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Serializes messages to a JSON file and uploads it via Payload's
|
|
12
|
+
* `filePath` API. Creates a new document or updates an existing one.
|
|
13
|
+
*/
|
|
14
|
+
export declare function persistDataToFile({ payload, collection, data, locale, existingFileId, }: PersistOptions): Promise<number | string>;
|
|
15
|
+
interface ReadOptions {
|
|
16
|
+
readonly payload: BasePayload;
|
|
17
|
+
readonly collection: string;
|
|
18
|
+
readonly fileId: number | string | undefined;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Reads and parses a JSON messages file from the upload collection's
|
|
22
|
+
* local filesystem path.
|
|
23
|
+
*/
|
|
24
|
+
export declare function readDataFromFile({ payload, collection, fileId, }: ReadOptions): Promise<Messages>;
|
|
25
|
+
export {};
|
|
26
|
+
//# sourceMappingURL=file-storage.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"file-storage.d.ts","sourceRoot":"","sources":["../../src/utils/file-storage.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,WAAW,EAAkB,MAAM,SAAS,CAAC;AAE3D,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAEzC,UAAU,cAAc;IACtB,QAAQ,CAAC,OAAO,EAAE,WAAW,CAAC;IAC9B,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC;IACxB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,cAAc,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;CAC3C;AAED;;;GAGG;AACH,wBAAsB,iBAAiB,CAAC,EACtC,OAAO,EACP,UAAU,EACV,IAAI,EACJ,MAAM,EACN,cAAc,GACf,EAAE,cAAc,GAAG,OAAO,CAAC,MAAM,GAAG,MAAM,CAAC,CA6B3C;AAED,UAAU,WAAW;IACnB,QAAQ,CAAC,OAAO,EAAE,WAAW,CAAC;IAC9B,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAAC;CAC9C;AAED;;;GAGG;AACH,wBAAsB,gBAAgB,CAAC,EACrC,OAAO,EACP,UAAU,EACV,MAAM,GACP,EAAE,WAAW,GAAG,OAAO,CAAC,QAAQ,CAAC,CAoBjC"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { readFile, unlink, writeFile } from 'node:fs/promises';
|
|
2
|
+
import os from 'node:os';
|
|
3
|
+
import path from 'node:path';
|
|
4
|
+
/**
|
|
5
|
+
* Serializes messages to a JSON file and uploads it via Payload's
|
|
6
|
+
* `filePath` API. Creates a new document or updates an existing one.
|
|
7
|
+
*/ export async function persistDataToFile({ payload, collection, data, locale, existingFileId }) {
|
|
8
|
+
const jsonString = JSON.stringify(data, null, 2);
|
|
9
|
+
const tmpPath = path.join(os.tmpdir(), `intl-messages-${locale}-${Date.now()}.json`);
|
|
10
|
+
await writeFile(tmpPath, jsonString, 'utf-8');
|
|
11
|
+
try {
|
|
12
|
+
if (existingFileId) {
|
|
13
|
+
const doc = await payload.update({
|
|
14
|
+
collection: collection,
|
|
15
|
+
id: existingFileId,
|
|
16
|
+
data: {},
|
|
17
|
+
filePath: tmpPath
|
|
18
|
+
});
|
|
19
|
+
return doc.id;
|
|
20
|
+
}
|
|
21
|
+
const doc = await payload.create({
|
|
22
|
+
collection: collection,
|
|
23
|
+
data: {},
|
|
24
|
+
filePath: tmpPath
|
|
25
|
+
});
|
|
26
|
+
return doc.id;
|
|
27
|
+
} finally{
|
|
28
|
+
await unlink(tmpPath).catch(()=>{});
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Reads and parses a JSON messages file from the upload collection's
|
|
33
|
+
* local filesystem path.
|
|
34
|
+
*/ export async function readDataFromFile({ payload, collection, fileId }) {
|
|
35
|
+
if (!fileId) return {};
|
|
36
|
+
const uploadDoc = await payload.findByID({
|
|
37
|
+
collection: collection,
|
|
38
|
+
id: fileId,
|
|
39
|
+
depth: 0
|
|
40
|
+
});
|
|
41
|
+
const filename = uploadDoc.filename;
|
|
42
|
+
if (typeof filename !== 'string') return {};
|
|
43
|
+
const filePath = resolveUploadPath(payload, collection, filename);
|
|
44
|
+
try {
|
|
45
|
+
const content = await readFile(filePath, 'utf-8');
|
|
46
|
+
return JSON.parse(content);
|
|
47
|
+
} catch {
|
|
48
|
+
return {};
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
/** Resolves the absolute filesystem path for a file in an upload collection. */ function resolveUploadPath(payload, collectionSlug, filename) {
|
|
52
|
+
const collectionConfig = payload.config.collections.find((c)=>c.slug === collectionSlug);
|
|
53
|
+
let staticDir = collectionSlug;
|
|
54
|
+
if (typeof collectionConfig?.upload === 'object' && collectionConfig.upload.staticDir) {
|
|
55
|
+
staticDir = collectionConfig.upload.staticDir;
|
|
56
|
+
}
|
|
57
|
+
const resolvedDir = path.isAbsolute(staticDir) ? staticDir : path.resolve(process.cwd(), staticDir);
|
|
58
|
+
return path.join(resolvedDir, filename);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
//# sourceMappingURL=file-storage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/utils/file-storage.ts"],"sourcesContent":["import { readFile, unlink, writeFile } from 'node:fs/promises';\nimport os from 'node:os';\nimport path from 'node:path';\n\nimport type { BasePayload, CollectionSlug } from 'payload';\n\nimport type { Messages } from '../types';\n\ninterface PersistOptions {\n readonly payload: BasePayload;\n readonly collection: string;\n readonly data: Messages;\n readonly locale: string;\n readonly existingFileId?: number | string;\n}\n\n/**\n * Serializes messages to a JSON file and uploads it via Payload's\n * `filePath` API. Creates a new document or updates an existing one.\n */\nexport async function persistDataToFile({\n payload,\n collection,\n data,\n locale,\n existingFileId,\n}: PersistOptions): Promise<number | string> {\n const jsonString = JSON.stringify(data, null, 2);\n const tmpPath = path.join(\n os.tmpdir(),\n `intl-messages-${locale}-${Date.now()}.json`,\n );\n\n await writeFile(tmpPath, jsonString, 'utf-8');\n\n try {\n if (existingFileId) {\n const doc = await payload.update({\n collection: collection as CollectionSlug,\n id: existingFileId,\n data: {},\n filePath: tmpPath,\n });\n return doc.id;\n }\n\n const doc = await payload.create({\n collection: collection as CollectionSlug,\n data: {},\n filePath: tmpPath,\n });\n return doc.id;\n } finally {\n await unlink(tmpPath).catch(() => {});\n }\n}\n\ninterface ReadOptions {\n readonly payload: BasePayload;\n readonly collection: string;\n readonly fileId: number | string | undefined;\n}\n\n/**\n * Reads and parses a JSON messages file from the upload collection's\n * local filesystem path.\n */\nexport async function readDataFromFile({\n payload,\n collection,\n fileId,\n}: ReadOptions): Promise<Messages> {\n if (!fileId) return {};\n\n const uploadDoc = await payload.findByID({\n collection: collection as CollectionSlug,\n id: fileId,\n depth: 0,\n });\n\n const filename = (uploadDoc as unknown as Record<string, unknown>).filename;\n if (typeof filename !== 'string') return {};\n\n const filePath = resolveUploadPath(payload, collection, filename);\n\n try {\n const content = await readFile(filePath, 'utf-8');\n return JSON.parse(content) as Messages;\n } catch {\n return {};\n }\n}\n\n/** Resolves the absolute filesystem path for a file in an upload collection. */\nfunction resolveUploadPath(\n payload: BasePayload,\n collectionSlug: string,\n filename: string,\n): string {\n const collectionConfig = payload.config.collections.find(\n (c) => c.slug === collectionSlug,\n );\n\n let staticDir = collectionSlug;\n if (\n typeof collectionConfig?.upload === 'object' &&\n collectionConfig.upload.staticDir\n ) {\n staticDir = collectionConfig.upload.staticDir;\n }\n\n const resolvedDir = path.isAbsolute(staticDir)\n ? staticDir\n : path.resolve(process.cwd(), staticDir);\n\n return path.join(resolvedDir, filename);\n}\n"],"names":["readFile","unlink","writeFile","os","path","persistDataToFile","payload","collection","data","locale","existingFileId","jsonString","JSON","stringify","tmpPath","join","tmpdir","Date","now","doc","update","id","filePath","create","catch","readDataFromFile","fileId","uploadDoc","findByID","depth","filename","resolveUploadPath","content","parse","collectionSlug","collectionConfig","config","collections","find","c","slug","staticDir","upload","resolvedDir","isAbsolute","resolve","process","cwd"],"mappings":"AAAA,SAASA,QAAQ,EAAEC,MAAM,EAAEC,SAAS,QAAQ,mBAAmB;AAC/D,OAAOC,QAAQ,UAAU;AACzB,OAAOC,UAAU,YAAY;AAc7B;;;CAGC,GACD,OAAO,eAAeC,kBAAkB,EACtCC,OAAO,EACPC,UAAU,EACVC,IAAI,EACJC,MAAM,EACNC,cAAc,EACC;IACf,MAAMC,aAAaC,KAAKC,SAAS,CAACL,MAAM,MAAM;IAC9C,MAAMM,UAAUV,KAAKW,IAAI,CACvBZ,GAAGa,MAAM,IACT,CAAC,cAAc,EAAEP,OAAO,CAAC,EAAEQ,KAAKC,GAAG,GAAG,KAAK,CAAC;IAG9C,MAAMhB,UAAUY,SAASH,YAAY;IAErC,IAAI;QACF,IAAID,gBAAgB;YAClB,MAAMS,MAAM,MAAMb,QAAQc,MAAM,CAAC;gBAC/Bb,YAAYA;gBACZc,IAAIX;gBACJF,MAAM,CAAC;gBACPc,UAAUR;YACZ;YACA,OAAOK,IAAIE,EAAE;QACf;QAEA,MAAMF,MAAM,MAAMb,QAAQiB,MAAM,CAAC;YAC/BhB,YAAYA;YACZC,MAAM,CAAC;YACPc,UAAUR;QACZ;QACA,OAAOK,IAAIE,EAAE;IACf,SAAU;QACR,MAAMpB,OAAOa,SAASU,KAAK,CAAC,KAAO;IACrC;AACF;AAQA;;;CAGC,GACD,OAAO,eAAeC,iBAAiB,EACrCnB,OAAO,EACPC,UAAU,EACVmB,MAAM,EACM;IACZ,IAAI,CAACA,QAAQ,OAAO,CAAC;IAErB,MAAMC,YAAY,MAAMrB,QAAQsB,QAAQ,CAAC;QACvCrB,YAAYA;QACZc,IAAIK;QACJG,OAAO;IACT;IAEA,MAAMC,WAAW,AAACH,UAAiDG,QAAQ;IAC3E,IAAI,OAAOA,aAAa,UAAU,OAAO,CAAC;IAE1C,MAAMR,WAAWS,kBAAkBzB,SAASC,YAAYuB;IAExD,IAAI;QACF,MAAME,UAAU,MAAMhC,SAASsB,UAAU;QACzC,OAAOV,KAAKqB,KAAK,CAACD;IACpB,EAAE,OAAM;QACN,OAAO,CAAC;IACV;AACF;AAEA,8EAA8E,GAC9E,SAASD,kBACPzB,OAAoB,EACpB4B,cAAsB,EACtBJ,QAAgB;IAEhB,MAAMK,mBAAmB7B,QAAQ8B,MAAM,CAACC,WAAW,CAACC,IAAI,CACtD,CAACC,IAAMA,EAAEC,IAAI,KAAKN;IAGpB,IAAIO,YAAYP;IAChB,IACE,OAAOC,kBAAkBO,WAAW,YACpCP,iBAAiBO,MAAM,CAACD,SAAS,EACjC;QACAA,YAAYN,iBAAiBO,MAAM,CAACD,SAAS;IAC/C;IAEA,MAAME,cAAcvC,KAAKwC,UAAU,CAACH,aAChCA,YACArC,KAAKyC,OAAO,CAACC,QAAQC,GAAG,IAAIN;IAEhC,OAAOrC,KAAKW,IAAI,CAAC4B,aAAab;AAChC"}
|
package/dist/utils/sanitize.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { Messages } from '../types';
|
|
2
2
|
/**
|
|
3
3
|
* Sanitize messages data to match the schema.
|
|
4
4
|
* Stored messages might contain keys that are not in the config.
|
|
@@ -11,7 +11,9 @@ import type { DeepPartial, Messages } from '../types';
|
|
|
11
11
|
* - Leaf missing/non-string + !useSchemaDefaults -> omitted
|
|
12
12
|
* - Empty nested groups -> omitted (unless filled by defaults)
|
|
13
13
|
*/
|
|
14
|
-
export declare function sanitizeMessages(config
|
|
14
|
+
export declare function sanitizeMessages({ config, data, useSchemaDefaults, }: {
|
|
15
|
+
config: Messages;
|
|
16
|
+
data: unknown;
|
|
15
17
|
useSchemaDefaults?: boolean;
|
|
16
|
-
}):
|
|
18
|
+
}): Messages;
|
|
17
19
|
//# sourceMappingURL=sanitize.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sanitize.d.ts","sourceRoot":"","sources":["../../src/utils/sanitize.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"sanitize.d.ts","sourceRoot":"","sources":["../../src/utils/sanitize.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAe,QAAQ,EAAE,MAAM,SAAS,CAAC;AAErD;;;;;;;;;;;GAWG;AACH,wBAAgB,gBAAgB,CAAC,EAC/B,MAAM,EACN,IAAI,EACJ,iBAAyB,GAC1B,EAAE;IACD,MAAM,EAAE,QAAQ,CAAC;IACjB,IAAI,EAAE,OAAO,CAAC;IACd,iBAAiB,CAAC,EAAE,OAAO,CAAC;CAC7B,GAAG,QAAQ,CA6BX"}
|
package/dist/utils/sanitize.js
CHANGED
|
@@ -9,14 +9,16 @@
|
|
|
9
9
|
* - Leaf missing/non-string + useSchemaDefaults -> schema value used
|
|
10
10
|
* - Leaf missing/non-string + !useSchemaDefaults -> omitted
|
|
11
11
|
* - Empty nested groups -> omitted (unless filled by defaults)
|
|
12
|
-
*/ export function sanitizeMessages(config, data,
|
|
12
|
+
*/ export function sanitizeMessages({ config, data, useSchemaDefaults = false }) {
|
|
13
13
|
const out = {};
|
|
14
14
|
const src = isObj(data) ? data : {};
|
|
15
15
|
for (const key of Object.keys(config)){
|
|
16
16
|
const shapeVal = config[key];
|
|
17
17
|
const srcVal = src[key];
|
|
18
18
|
if (isObj(shapeVal)) {
|
|
19
|
-
const child = sanitizeMessages(
|
|
19
|
+
const child = sanitizeMessages({
|
|
20
|
+
config: shapeVal,
|
|
21
|
+
data: srcVal,
|
|
20
22
|
useSchemaDefaults
|
|
21
23
|
});
|
|
22
24
|
if (isObj(child) && Object.keys(child).length > 0) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/utils/sanitize.ts"],"sourcesContent":["import type { DeepPartial, Messages } from '@/types';\n\n/**\n * Sanitize messages data to match the schema.\n * Stored messages might contain keys that are not in the config.\n * This happens when messages in the config were (re)moved.\n *\n * Keep exactly the keys from `shape`, fill values from `source` when present.\n * When `useSchemaDefaults` is true, missing leaves fall back to the schema value.\n * - Leaf present as string -> included\n * - Leaf missing/non-string + useSchemaDefaults -> schema value used\n * - Leaf missing/non-string + !useSchemaDefaults -> omitted\n * - Empty nested groups -> omitted (unless filled by defaults)\n */\nexport function sanitizeMessages(\n config
|
|
1
|
+
{"version":3,"sources":["../../src/utils/sanitize.ts"],"sourcesContent":["import type { DeepPartial, Messages } from '@/types';\n\n/**\n * Sanitize messages data to match the schema.\n * Stored messages might contain keys that are not in the config.\n * This happens when messages in the config were (re)moved.\n *\n * Keep exactly the keys from `shape`, fill values from `source` when present.\n * When `useSchemaDefaults` is true, missing leaves fall back to the schema value.\n * - Leaf present as string -> included\n * - Leaf missing/non-string + useSchemaDefaults -> schema value used\n * - Leaf missing/non-string + !useSchemaDefaults -> omitted\n * - Empty nested groups -> omitted (unless filled by defaults)\n */\nexport function sanitizeMessages({\n config,\n data,\n useSchemaDefaults = false,\n}: {\n config: Messages;\n data: unknown;\n useSchemaDefaults?: boolean;\n}): Messages {\n const out: Record<string, unknown> = {};\n const src = isObj(data) ? data : {};\n\n for (const key of Object.keys(config)) {\n const shapeVal = (config as Record<string, unknown>)[key];\n const srcVal = src[key];\n\n if (isObj(shapeVal)) {\n const child = sanitizeMessages({\n config: shapeVal as Messages,\n data: srcVal,\n useSchemaDefaults,\n });\n if (isObj(child) && Object.keys(child).length > 0) {\n out[key] = child;\n }\n // else: omit empty group\n } else {\n // Leaf: keep source string, or fall back to schema value\n if (typeof srcVal === 'string') {\n out[key] = srcVal;\n } else if (useSchemaDefaults && typeof shapeVal === 'string') {\n out[key] = shapeVal;\n }\n }\n }\n\n return out as Messages;\n}\n\nfunction isObj(x: unknown): x is Record<string, unknown> {\n return !!x && typeof x === 'object' && !Array.isArray(x);\n}\n"],"names":["sanitizeMessages","config","data","useSchemaDefaults","out","src","isObj","key","Object","keys","shapeVal","srcVal","child","length","x","Array","isArray"],"mappings":"AAEA;;;;;;;;;;;CAWC,GACD,OAAO,SAASA,iBAAiB,EAC/BC,MAAM,EACNC,IAAI,EACJC,oBAAoB,KAAK,EAK1B;IACC,MAAMC,MAA+B,CAAC;IACtC,MAAMC,MAAMC,MAAMJ,QAAQA,OAAO,CAAC;IAElC,KAAK,MAAMK,OAAOC,OAAOC,IAAI,CAACR,QAAS;QACrC,MAAMS,WAAW,AAACT,MAAkC,CAACM,IAAI;QACzD,MAAMI,SAASN,GAAG,CAACE,IAAI;QAEvB,IAAID,MAAMI,WAAW;YACnB,MAAME,QAAQZ,iBAAiB;gBAC7BC,QAAQS;gBACRR,MAAMS;gBACNR;YACF;YACA,IAAIG,MAAMM,UAAUJ,OAAOC,IAAI,CAACG,OAAOC,MAAM,GAAG,GAAG;gBACjDT,GAAG,CAACG,IAAI,GAAGK;YACb;QACA,yBAAyB;QAC3B,OAAO;YACL,yDAAyD;YACzD,IAAI,OAAOD,WAAW,UAAU;gBAC9BP,GAAG,CAACG,IAAI,GAAGI;YACb,OAAO,IAAIR,qBAAqB,OAAOO,aAAa,UAAU;gBAC5DN,GAAG,CAACG,IAAI,GAAGG;YACb;QACF;IACF;IAEA,OAAON;AACT;AAEA,SAASE,MAAMQ,CAAU;IACvB,OAAO,CAAC,CAACA,KAAK,OAAOA,MAAM,YAAY,CAACC,MAAMC,OAAO,CAACF;AACxD"}
|
package/dist/utils/schema.d.ts
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
export
|
|
5
|
-
|
|
6
|
-
variables: TemplateVariable[];
|
|
7
|
-
};
|
|
1
|
+
import type { JSONField } from 'payload';
|
|
2
|
+
import type { MessagesSchema } from '../types';
|
|
3
|
+
type Schema = NonNullable<JSONField['jsonSchema']>['schema'];
|
|
4
|
+
export declare function messagesToJsonSchema(messages: MessagesSchema): Schema;
|
|
5
|
+
export {};
|
|
8
6
|
//# sourceMappingURL=schema.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../src/utils/schema.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../src/utils/schema.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AACzC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAE9C,KAAK,MAAM,GAAG,WAAW,CAAC,SAAS,CAAC,YAAY,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC;AAE7D,wBAAgB,oBAAoB,CAAC,QAAQ,EAAE,cAAc,GAAG,MAAM,CAerE"}
|
package/dist/utils/schema.js
CHANGED
|
@@ -1,43 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
const
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
export function messagesToJsonSchema(messages) {
|
|
2
|
+
const properties = {};
|
|
3
|
+
for (const [key, value] of Object.entries(messages)){
|
|
4
|
+
properties[key] = typeof value === 'string' ? {
|
|
5
|
+
type: 'string'
|
|
6
|
+
} : messagesToJsonSchema(value);
|
|
7
|
+
}
|
|
7
8
|
return {
|
|
8
|
-
|
|
9
|
-
|
|
9
|
+
type: 'object',
|
|
10
|
+
properties,
|
|
11
|
+
required: Object.keys(messages)
|
|
10
12
|
};
|
|
11
|
-
}
|
|
12
|
-
export const extractTemplateVariables = (schema)=>collectTemplateVariables(parse(schema));
|
|
13
|
-
const collectTemplateVariables = (parts)=>parts.flatMap((part)=>{
|
|
14
|
-
switch(part.type){
|
|
15
|
-
case TYPE.literal:
|
|
16
|
-
case TYPE.pound:
|
|
17
|
-
return [];
|
|
18
|
-
case TYPE.argument:
|
|
19
|
-
case TYPE.number:
|
|
20
|
-
case TYPE.date:
|
|
21
|
-
case TYPE.time:
|
|
22
|
-
return [
|
|
23
|
-
part
|
|
24
|
-
];
|
|
25
|
-
case TYPE.plural:
|
|
26
|
-
case TYPE.select:
|
|
27
|
-
return [
|
|
28
|
-
part,
|
|
29
|
-
...collectTemplateVariables(Object.values(part.options).flatMap(({ value })=>value))
|
|
30
|
-
];
|
|
31
|
-
case TYPE.tag:
|
|
32
|
-
return [
|
|
33
|
-
part,
|
|
34
|
-
...collectTemplateVariables(part.children)
|
|
35
|
-
];
|
|
36
|
-
default:
|
|
37
|
-
return [
|
|
38
|
-
part
|
|
39
|
-
];
|
|
40
|
-
}
|
|
41
|
-
});
|
|
13
|
+
}
|
|
42
14
|
|
|
43
15
|
//# sourceMappingURL=schema.js.map
|
package/dist/utils/schema.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/utils/schema.ts"],"sourcesContent":["import type {
|
|
1
|
+
{"version":3,"sources":["../../src/utils/schema.ts"],"sourcesContent":["import type { JSONField } from 'payload';\nimport type { MessagesSchema } from '@/types';\n\ntype Schema = NonNullable<JSONField['jsonSchema']>['schema'];\n\nexport function messagesToJsonSchema(messages: MessagesSchema): Schema {\n const properties: Record<string, Schema | { type: 'string' }> = {};\n\n for (const [key, value] of Object.entries(messages)) {\n properties[key] =\n typeof value === 'string'\n ? { type: 'string' }\n : messagesToJsonSchema(value);\n }\n\n return {\n type: 'object',\n properties,\n required: Object.keys(messages),\n };\n}\n"],"names":["messagesToJsonSchema","messages","properties","key","value","Object","entries","type","required","keys"],"mappings":"AAKA,OAAO,SAASA,qBAAqBC,QAAwB;IAC3D,MAAMC,aAA0D,CAAC;IAEjE,KAAK,MAAM,CAACC,KAAKC,MAAM,IAAIC,OAAOC,OAAO,CAACL,UAAW;QACnDC,UAAU,CAACC,IAAI,GACb,OAAOC,UAAU,WACb;YAAEG,MAAM;QAAS,IACjBP,qBAAqBI;IAC7B;IAEA,OAAO;QACLG,MAAM;QACNL;QACAM,UAAUH,OAAOI,IAAI,CAACR;IACxB;AACF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scopes.d.ts","sourceRoot":"","sources":["../../src/utils/scopes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAElE,wBAAgB,eAAe,CAC7B,MAAM,EAAE,oBAAoB,GAAG,SAAS,GACvC,GAAG,CAAC,MAAM,EAAE,WAAW,CAAC,CAmB1B"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export function normalizeScopes(scopes) {
|
|
2
|
+
const result = new Map();
|
|
3
|
+
if (!scopes) return result;
|
|
4
|
+
if (Array.isArray(scopes)) {
|
|
5
|
+
for (const slug of scopes){
|
|
6
|
+
result.set(slug, {
|
|
7
|
+
position: 'tab'
|
|
8
|
+
});
|
|
9
|
+
}
|
|
10
|
+
return result;
|
|
11
|
+
}
|
|
12
|
+
for (const [slug, config] of Object.entries(scopes)){
|
|
13
|
+
if (typeof config === 'string') {
|
|
14
|
+
result.set(slug, {
|
|
15
|
+
position: config
|
|
16
|
+
});
|
|
17
|
+
} else {
|
|
18
|
+
result.set(slug, config);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
return result;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
//# sourceMappingURL=scopes.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/utils/scopes.ts"],"sourcesContent":["import type { MessagesScopesConfig, ScopeConfig } from '../types';\n\nexport function normalizeScopes(\n scopes: MessagesScopesConfig | undefined,\n): Map<string, ScopeConfig> {\n const result = new Map<string, ScopeConfig>();\n if (!scopes) return result;\n\n if (Array.isArray(scopes)) {\n for (const slug of scopes) {\n result.set(slug, { position: 'tab' });\n }\n return result;\n }\n\n for (const [slug, config] of Object.entries(scopes)) {\n if (typeof config === 'string') {\n result.set(slug, { position: config });\n } else {\n result.set(slug, config);\n }\n }\n return result;\n}\n"],"names":["normalizeScopes","scopes","result","Map","Array","isArray","slug","set","position","config","Object","entries"],"mappings":"AAEA,OAAO,SAASA,gBACdC,MAAwC;IAExC,MAAMC,SAAS,IAAIC;IACnB,IAAI,CAACF,QAAQ,OAAOC;IAEpB,IAAIE,MAAMC,OAAO,CAACJ,SAAS;QACzB,KAAK,MAAMK,QAAQL,OAAQ;YACzBC,OAAOK,GAAG,CAACD,MAAM;gBAAEE,UAAU;YAAM;QACrC;QACA,OAAON;IACT;IAEA,KAAK,MAAM,CAACI,MAAMG,OAAO,IAAIC,OAAOC,OAAO,CAACV,QAAS;QACnD,IAAI,OAAOQ,WAAW,UAAU;YAC9BP,OAAOK,GAAG,CAACD,MAAM;gBAAEE,UAAUC;YAAO;QACtC,OAAO;YACLP,OAAOK,GAAG,CAACD,MAAMG;QACnB;IACF;IACA,OAAOP;AACT"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "payload-intl",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.4.0",
|
|
4
4
|
"description": "Payload Plugin for I18N using ICU Messages",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"payload",
|
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
"lodash-es": "^4.17.21",
|
|
54
54
|
"react-hook-form": "^7.58.1",
|
|
55
55
|
"zod": "4.3.5",
|
|
56
|
-
"@davincicoding/payload-
|
|
56
|
+
"@davincicoding/payload-plugin-kit": "0.0.3"
|
|
57
57
|
},
|
|
58
58
|
"devDependencies": {
|
|
59
59
|
"@payloadcms/richtext-lexical": "3.72.0",
|
|
@@ -62,14 +62,14 @@
|
|
|
62
62
|
"@types/node": "^22.5.4",
|
|
63
63
|
"@types/react": "19.2.1",
|
|
64
64
|
"@types/react-dom": "19.2.1",
|
|
65
|
+
"json-schema": "^0.4.0",
|
|
65
66
|
"next": "15.5.9",
|
|
66
67
|
"payload": "3.72.0",
|
|
67
68
|
"react": "19.2.1",
|
|
68
69
|
"react-dom": "19.2.1",
|
|
69
70
|
"typescript": "5.7.3",
|
|
70
71
|
"vite": "7.0.6",
|
|
71
|
-
"vitest": "^3.1.2"
|
|
72
|
-
"@davincicoding/payload-plugin-kit": "0.0.3"
|
|
72
|
+
"vitest": "^3.1.2"
|
|
73
73
|
},
|
|
74
74
|
"peerDependencies": {
|
|
75
75
|
"@payloadcms/next": ">=3.72.0",
|
|
@@ -91,7 +91,7 @@
|
|
|
91
91
|
"check:types": "tsc --noEmit",
|
|
92
92
|
"clean": "rm -rf dist && rm -rf node_modules",
|
|
93
93
|
"dev": "plugin-build --watch",
|
|
94
|
-
"generate:types": "generate-types --opt
|
|
94
|
+
"generate:types": "generate-types --opt uploadCollection=uploads",
|
|
95
95
|
"lint": "biome check .",
|
|
96
96
|
"lint:fix": "biome check --write .",
|
|
97
97
|
"test": "vitest run",
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import type { Locale, TemplateVariable } from '../types';
|
|
2
|
-
import type { MessageValidator } from '../utils/validate';
|
|
3
|
-
interface MessageFormFieldProps {
|
|
4
|
-
locale: Locale;
|
|
5
|
-
name: string;
|
|
6
|
-
className?: string;
|
|
7
|
-
variables: TemplateVariable[];
|
|
8
|
-
validate: MessageValidator;
|
|
9
|
-
multiline?: boolean;
|
|
10
|
-
reference?: string;
|
|
11
|
-
}
|
|
12
|
-
export declare function MessageFormField({ name, variables, locale, validate, className, multiline, reference, }: MessageFormFieldProps): React.ReactNode;
|
|
13
|
-
export {};
|
|
14
|
-
//# sourceMappingURL=MessageFormField.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"MessageFormField.d.ts","sourceRoot":"","sources":["../../src/components/MessageFormField.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,MAAM,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AACxD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAIzD,UAAU,qBAAqB;IAC7B,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,gBAAgB,EAAE,CAAC;IAC9B,QAAQ,EAAE,gBAAgB,CAAC;IAC3B,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,wBAAgB,gBAAgB,CAAC,EAC/B,IAAI,EACJ,SAAS,EACT,MAAM,EACN,QAAQ,EACR,SAAS,EACT,SAAS,EACT,SAAS,GACV,EAAE,qBAAqB,GAAG,KAAK,CAAC,SAAS,CA0BzC"}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { Controller } from 'react-hook-form';
|
|
3
|
-
import { useMessagesForm } from '../components/MessagesFormProvider';
|
|
4
|
-
import { MessageInput } from './inputs/MessageInput';
|
|
5
|
-
export function MessageFormField({ name, variables, locale, validate, className, multiline, reference }) {
|
|
6
|
-
const { control } = useMessagesForm();
|
|
7
|
-
return /*#__PURE__*/ _jsx(Controller, {
|
|
8
|
-
control: control,
|
|
9
|
-
name: name,
|
|
10
|
-
render: ({ field, fieldState })=>/*#__PURE__*/ _jsx(MessageInput, {
|
|
11
|
-
className: className,
|
|
12
|
-
error: fieldState.error,
|
|
13
|
-
lang: locale,
|
|
14
|
-
multiline: multiline,
|
|
15
|
-
onBlur: field.onBlur,
|
|
16
|
-
onChange: field.onChange,
|
|
17
|
-
reference: reference,
|
|
18
|
-
value: field.value || '',
|
|
19
|
-
variables: variables
|
|
20
|
-
}),
|
|
21
|
-
rules: {
|
|
22
|
-
required: true,
|
|
23
|
-
validate
|
|
24
|
-
}
|
|
25
|
-
});
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
//# sourceMappingURL=MessageFormField.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/components/MessageFormField.tsx"],"sourcesContent":["import { Controller } from 'react-hook-form';\nimport { useMessagesForm } from '@/components/MessagesFormProvider';\nimport type { Locale, TemplateVariable } from '@/types';\nimport type { MessageValidator } from '@/utils/validate';\n\nimport { MessageInput } from './inputs/MessageInput';\n\ninterface MessageFormFieldProps {\n locale: Locale;\n name: string;\n className?: string;\n variables: TemplateVariable[];\n validate: MessageValidator;\n multiline?: boolean;\n reference?: string;\n}\n\nexport function MessageFormField({\n name,\n variables,\n locale,\n validate,\n className,\n multiline,\n reference,\n}: MessageFormFieldProps): React.ReactNode {\n const { control } = useMessagesForm();\n\n return (\n <Controller\n control={control}\n name={name}\n render={({ field, fieldState }) => (\n <MessageInput\n className={className}\n error={fieldState.error}\n lang={locale}\n multiline={multiline}\n onBlur={field.onBlur}\n onChange={field.onChange}\n reference={reference}\n value={(field.value as unknown as string) || ''}\n variables={variables}\n />\n )}\n rules={{\n required: true,\n validate,\n }}\n />\n );\n}\n"],"names":["Controller","useMessagesForm","MessageInput","MessageFormField","name","variables","locale","validate","className","multiline","reference","control","render","field","fieldState","error","lang","onBlur","onChange","value","rules","required"],"mappings":";AAAA,SAASA,UAAU,QAAQ,kBAAkB;AAC7C,SAASC,eAAe,QAAQ,oCAAoC;AAIpE,SAASC,YAAY,QAAQ,wBAAwB;AAYrD,OAAO,SAASC,iBAAiB,EAC/BC,IAAI,EACJC,SAAS,EACTC,MAAM,EACNC,QAAQ,EACRC,SAAS,EACTC,SAAS,EACTC,SAAS,EACa;IACtB,MAAM,EAAEC,OAAO,EAAE,GAAGV;IAEpB,qBACE,KAACD;QACCW,SAASA;QACTP,MAAMA;QACNQ,QAAQ,CAAC,EAAEC,KAAK,EAAEC,UAAU,EAAE,iBAC5B,KAACZ;gBACCM,WAAWA;gBACXO,OAAOD,WAAWC,KAAK;gBACvBC,MAAMV;gBACNG,WAAWA;gBACXQ,QAAQJ,MAAMI,MAAM;gBACpBC,UAAUL,MAAMK,QAAQ;gBACxBR,WAAWA;gBACXS,OAAO,AAACN,MAAMM,KAAK,IAA0B;gBAC7Cd,WAAWA;;QAGfe,OAAO;YACLC,UAAU;YACVd;QACF;;AAGN"}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import type { DeepPartial, Locale, Messages, MessagesSchema, Translations } from '../types';
|
|
2
|
-
interface MessagesFormProps {
|
|
3
|
-
locales: Locale[];
|
|
4
|
-
defaultLocale: Locale;
|
|
5
|
-
activeLocale: Locale;
|
|
6
|
-
schema: MessagesSchema;
|
|
7
|
-
tabs?: boolean;
|
|
8
|
-
values: Translations<DeepPartial<Messages>>;
|
|
9
|
-
endpointUrl: string;
|
|
10
|
-
}
|
|
11
|
-
export declare function MessagesForm({ locales, defaultLocale, activeLocale, schema, tabs, values, endpointUrl, }: MessagesFormProps): React.ReactNode;
|
|
12
|
-
export {};
|
|
13
|
-
//# sourceMappingURL=MessagesForm.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"MessagesForm.d.ts","sourceRoot":"","sources":["../../src/components/MessagesForm.tsx"],"names":[],"mappings":"AAOA,OAAO,KAAK,EACV,WAAW,EACX,MAAM,EACN,QAAQ,EACR,cAAc,EACd,YAAY,EACb,MAAM,SAAS,CAAC;AAQjB,UAAU,iBAAiB;IACzB,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,aAAa,EAAE,MAAM,CAAC;IACtB,YAAY,EAAE,MAAM,CAAC;IACrB,MAAM,EAAE,cAAc,CAAC;IACvB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,MAAM,EAAE,YAAY,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAC,CAAC;IAC5C,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,wBAAgB,YAAY,CAAC,EAC3B,OAAO,EACP,aAAa,EACb,YAAY,EACZ,MAAM,EACN,IAAY,EACZ,MAAM,EACN,WAAW,GACZ,EAAE,iBAAiB,GAAG,KAAK,CAAC,SAAS,CAyFrC"}
|
|
@@ -1,120 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { Button, useStepNav } from '@payloadcms/ui';
|
|
4
|
-
import { useEffect, useState } from 'react';
|
|
5
|
-
import { useForm } from 'react-hook-form';
|
|
6
|
-
import { MessagesFormProvider } from '../components/MessagesFormProvider';
|
|
7
|
-
import { JsonImport } from './actions/JsonImport';
|
|
8
|
-
import { useMessagesFormSubmit } from './hooks/useMessagesFormSubmit';
|
|
9
|
-
import { MessageField } from './layout/MessageField';
|
|
10
|
-
import { MessagesTabs } from './layout/MessagesTabs';
|
|
11
|
-
import { MessagesTree } from './layout/MessagesTree';
|
|
12
|
-
import styles from './MessagesForm.module.css';
|
|
13
|
-
export function MessagesForm({ locales, defaultLocale, activeLocale, schema, tabs = false, values, endpointUrl }) {
|
|
14
|
-
const { setStepNav } = useStepNav();
|
|
15
|
-
useEffect(()=>{
|
|
16
|
-
setStepNav([
|
|
17
|
-
{
|
|
18
|
-
label: 'Intl Messages',
|
|
19
|
-
url: '/intl'
|
|
20
|
-
}
|
|
21
|
-
]);
|
|
22
|
-
}, [
|
|
23
|
-
setStepNav
|
|
24
|
-
]);
|
|
25
|
-
const form = useForm({
|
|
26
|
-
defaultValues: values,
|
|
27
|
-
reValidateMode: 'onBlur'
|
|
28
|
-
});
|
|
29
|
-
const [activeTab, setActiveTab] = useState(Object.keys(schema)[0]);
|
|
30
|
-
useEffect(()=>{
|
|
31
|
-
const handler = (e)=>{
|
|
32
|
-
if (form.formState.isDirty) {
|
|
33
|
-
e.preventDefault();
|
|
34
|
-
}
|
|
35
|
-
};
|
|
36
|
-
window.addEventListener('beforeunload', handler);
|
|
37
|
-
return ()=>window.removeEventListener('beforeunload', handler);
|
|
38
|
-
}, [
|
|
39
|
-
form
|
|
40
|
-
]);
|
|
41
|
-
const handleSubmit = useMessagesFormSubmit({
|
|
42
|
-
endpointUrl,
|
|
43
|
-
defaultValues: values,
|
|
44
|
-
form
|
|
45
|
-
});
|
|
46
|
-
return /*#__PURE__*/ _jsx(MessagesFormProvider, {
|
|
47
|
-
activeLocale: activeLocale,
|
|
48
|
-
defaultLocale: defaultLocale,
|
|
49
|
-
form: form,
|
|
50
|
-
locales: locales,
|
|
51
|
-
children: /*#__PURE__*/ _jsxs("form", {
|
|
52
|
-
className: styles.form,
|
|
53
|
-
onSubmit: form.handleSubmit(handleSubmit),
|
|
54
|
-
children: [
|
|
55
|
-
/*#__PURE__*/ _jsxs("div", {
|
|
56
|
-
className: styles.stickyHeader,
|
|
57
|
-
children: [
|
|
58
|
-
/*#__PURE__*/ _jsxs("header", {
|
|
59
|
-
className: styles.header,
|
|
60
|
-
children: [
|
|
61
|
-
/*#__PURE__*/ _jsx("h1", {
|
|
62
|
-
className: styles.title,
|
|
63
|
-
children: "Messages"
|
|
64
|
-
}),
|
|
65
|
-
/*#__PURE__*/ _jsxs("div", {
|
|
66
|
-
className: styles.actions,
|
|
67
|
-
children: [
|
|
68
|
-
/*#__PURE__*/ _jsx(JsonImport, {
|
|
69
|
-
activeLocale: activeLocale
|
|
70
|
-
}),
|
|
71
|
-
/*#__PURE__*/ _jsx(Button, {
|
|
72
|
-
className: styles.saveButton,
|
|
73
|
-
disabled: !form.formState.isDirty,
|
|
74
|
-
type: "submit",
|
|
75
|
-
children: "Save"
|
|
76
|
-
})
|
|
77
|
-
]
|
|
78
|
-
})
|
|
79
|
-
]
|
|
80
|
-
}),
|
|
81
|
-
tabs && /*#__PURE__*/ _jsx(MessagesTabs, {
|
|
82
|
-
activeTab: activeTab,
|
|
83
|
-
schema: schema,
|
|
84
|
-
setActiveTab: setActiveTab
|
|
85
|
-
})
|
|
86
|
-
]
|
|
87
|
-
}),
|
|
88
|
-
/*#__PURE__*/ _jsxs("div", {
|
|
89
|
-
className: styles.content,
|
|
90
|
-
id: "messages-form-content",
|
|
91
|
-
children: [
|
|
92
|
-
!tabs && /*#__PURE__*/ _jsx(MessagesTree, {
|
|
93
|
-
nestingLevel: 0,
|
|
94
|
-
path: "",
|
|
95
|
-
schema: schema
|
|
96
|
-
}),
|
|
97
|
-
tabs && Object.entries(schema).map(([key, value])=>{
|
|
98
|
-
if (typeof value === 'string') {
|
|
99
|
-
return /*#__PURE__*/ _jsx(MessageField, {
|
|
100
|
-
hidden: activeTab !== key,
|
|
101
|
-
messageKey: key,
|
|
102
|
-
path: key,
|
|
103
|
-
schema: value
|
|
104
|
-
}, key);
|
|
105
|
-
}
|
|
106
|
-
return /*#__PURE__*/ _jsx(MessagesTree, {
|
|
107
|
-
hidden: activeTab !== key,
|
|
108
|
-
nestingLevel: 0,
|
|
109
|
-
path: key,
|
|
110
|
-
schema: value
|
|
111
|
-
}, key);
|
|
112
|
-
})
|
|
113
|
-
]
|
|
114
|
-
})
|
|
115
|
-
]
|
|
116
|
-
})
|
|
117
|
-
});
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
//# sourceMappingURL=MessagesForm.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/components/MessagesForm.tsx"],"sourcesContent":["'use client';\n\nimport { Button, useStepNav } from '@payloadcms/ui';\nimport { useEffect, useState } from 'react';\nimport { useForm } from 'react-hook-form';\nimport type { FormValues } from '@/components/MessagesFormProvider';\nimport { MessagesFormProvider } from '@/components/MessagesFormProvider';\nimport type {\n DeepPartial,\n Locale,\n Messages,\n MessagesSchema,\n Translations,\n} from '@/types';\nimport { JsonImport } from './actions/JsonImport';\nimport { useMessagesFormSubmit } from './hooks/useMessagesFormSubmit';\nimport { MessageField } from './layout/MessageField';\nimport { MessagesTabs } from './layout/MessagesTabs';\nimport { MessagesTree } from './layout/MessagesTree';\nimport styles from './MessagesForm.module.css';\n\ninterface MessagesFormProps {\n locales: Locale[];\n defaultLocale: Locale;\n activeLocale: Locale;\n schema: MessagesSchema;\n tabs?: boolean;\n values: Translations<DeepPartial<Messages>>;\n endpointUrl: string;\n}\n\nexport function MessagesForm({\n locales,\n defaultLocale,\n activeLocale,\n schema,\n tabs = false,\n values,\n endpointUrl,\n}: MessagesFormProps): React.ReactNode {\n const { setStepNav } = useStepNav();\n useEffect(() => {\n setStepNav([{ label: 'Intl Messages', url: '/intl' }]);\n }, [setStepNav]);\n\n const form = useForm<FormValues>({\n defaultValues: values,\n reValidateMode: 'onBlur',\n });\n const [activeTab, setActiveTab] = useState(Object.keys(schema)[0]);\n\n useEffect(() => {\n const handler = (e: BeforeUnloadEvent) => {\n if (form.formState.isDirty) {\n e.preventDefault();\n }\n };\n window.addEventListener('beforeunload', handler);\n return () => window.removeEventListener('beforeunload', handler);\n }, [form]);\n\n const handleSubmit = useMessagesFormSubmit({\n endpointUrl,\n defaultValues: values,\n form,\n });\n\n return (\n <MessagesFormProvider\n activeLocale={activeLocale}\n defaultLocale={defaultLocale}\n form={form}\n locales={locales}\n >\n <form className={styles.form} onSubmit={form.handleSubmit(handleSubmit)}>\n <div className={styles.stickyHeader}>\n <header className={styles.header}>\n <h1 className={styles.title}>Messages</h1>\n <div className={styles.actions}>\n <JsonImport activeLocale={activeLocale} />\n <Button\n className={styles.saveButton}\n disabled={!form.formState.isDirty}\n type=\"submit\"\n >\n Save\n </Button>\n </div>\n </header>\n\n {tabs && (\n <MessagesTabs\n activeTab={activeTab}\n schema={schema}\n setActiveTab={setActiveTab}\n />\n )}\n </div>\n\n <div className={styles.content} id=\"messages-form-content\">\n {!tabs && <MessagesTree nestingLevel={0} path=\"\" schema={schema} />}\n {tabs &&\n Object.entries(schema).map(([key, value]) => {\n if (typeof value === 'string') {\n return (\n <MessageField\n hidden={activeTab !== key}\n key={key}\n messageKey={key}\n path={key}\n schema={value}\n />\n );\n }\n return (\n <MessagesTree\n hidden={activeTab !== key}\n key={key}\n nestingLevel={0}\n path={key}\n schema={value}\n />\n );\n })}\n </div>\n </form>\n </MessagesFormProvider>\n );\n}\n"],"names":["Button","useStepNav","useEffect","useState","useForm","MessagesFormProvider","JsonImport","useMessagesFormSubmit","MessageField","MessagesTabs","MessagesTree","styles","MessagesForm","locales","defaultLocale","activeLocale","schema","tabs","values","endpointUrl","setStepNav","label","url","form","defaultValues","reValidateMode","activeTab","setActiveTab","Object","keys","handler","e","formState","isDirty","preventDefault","window","addEventListener","removeEventListener","handleSubmit","className","onSubmit","div","stickyHeader","header","h1","title","actions","saveButton","disabled","type","content","id","nestingLevel","path","entries","map","key","value","hidden","messageKey"],"mappings":"AAAA;;AAEA,SAASA,MAAM,EAAEC,UAAU,QAAQ,iBAAiB;AACpD,SAASC,SAAS,EAAEC,QAAQ,QAAQ,QAAQ;AAC5C,SAASC,OAAO,QAAQ,kBAAkB;AAE1C,SAASC,oBAAoB,QAAQ,oCAAoC;AAQzE,SAASC,UAAU,QAAQ,uBAAuB;AAClD,SAASC,qBAAqB,QAAQ,gCAAgC;AACtE,SAASC,YAAY,QAAQ,wBAAwB;AACrD,SAASC,YAAY,QAAQ,wBAAwB;AACrD,SAASC,YAAY,QAAQ,wBAAwB;AACrD,OAAOC,YAAY,4BAA4B;AAY/C,OAAO,SAASC,aAAa,EAC3BC,OAAO,EACPC,aAAa,EACbC,YAAY,EACZC,MAAM,EACNC,OAAO,KAAK,EACZC,MAAM,EACNC,WAAW,EACO;IAClB,MAAM,EAAEC,UAAU,EAAE,GAAGnB;IACvBC,UAAU;QACRkB,WAAW;YAAC;gBAAEC,OAAO;gBAAiBC,KAAK;YAAQ;SAAE;IACvD,GAAG;QAACF;KAAW;IAEf,MAAMG,OAAOnB,QAAoB;QAC/BoB,eAAeN;QACfO,gBAAgB;IAClB;IACA,MAAM,CAACC,WAAWC,aAAa,GAAGxB,SAASyB,OAAOC,IAAI,CAACb,OAAO,CAAC,EAAE;IAEjEd,UAAU;QACR,MAAM4B,UAAU,CAACC;YACf,IAAIR,KAAKS,SAAS,CAACC,OAAO,EAAE;gBAC1BF,EAAEG,cAAc;YAClB;QACF;QACAC,OAAOC,gBAAgB,CAAC,gBAAgBN;QACxC,OAAO,IAAMK,OAAOE,mBAAmB,CAAC,gBAAgBP;IAC1D,GAAG;QAACP;KAAK;IAET,MAAMe,eAAe/B,sBAAsB;QACzCY;QACAK,eAAeN;QACfK;IACF;IAEA,qBACE,KAAClB;QACCU,cAAcA;QACdD,eAAeA;QACfS,MAAMA;QACNV,SAASA;kBAET,cAAA,MAACU;YAAKgB,WAAW5B,OAAOY,IAAI;YAAEiB,UAAUjB,KAAKe,YAAY,CAACA;;8BACxD,MAACG;oBAAIF,WAAW5B,OAAO+B,YAAY;;sCACjC,MAACC;4BAAOJ,WAAW5B,OAAOgC,MAAM;;8CAC9B,KAACC;oCAAGL,WAAW5B,OAAOkC,KAAK;8CAAE;;8CAC7B,MAACJ;oCAAIF,WAAW5B,OAAOmC,OAAO;;sDAC5B,KAACxC;4CAAWS,cAAcA;;sDAC1B,KAACf;4CACCuC,WAAW5B,OAAOoC,UAAU;4CAC5BC,UAAU,CAACzB,KAAKS,SAAS,CAACC,OAAO;4CACjCgB,MAAK;sDACN;;;;;;wBAMJhC,sBACC,KAACR;4BACCiB,WAAWA;4BACXV,QAAQA;4BACRW,cAAcA;;;;8BAKpB,MAACc;oBAAIF,WAAW5B,OAAOuC,OAAO;oBAAEC,IAAG;;wBAChC,CAAClC,sBAAQ,KAACP;4BAAa0C,cAAc;4BAAGC,MAAK;4BAAGrC,QAAQA;;wBACxDC,QACCW,OAAO0B,OAAO,CAACtC,QAAQuC,GAAG,CAAC,CAAC,CAACC,KAAKC,MAAM;4BACtC,IAAI,OAAOA,UAAU,UAAU;gCAC7B,qBACE,KAACjD;oCACCkD,QAAQhC,cAAc8B;oCAEtBG,YAAYH;oCACZH,MAAMG;oCACNxC,QAAQyC;mCAHHD;4BAMX;4BACA,qBACE,KAAC9C;gCACCgD,QAAQhC,cAAc8B;gCAEtBJ,cAAc;gCACdC,MAAMG;gCACNxC,QAAQyC;+BAHHD;wBAMX;;;;;;AAKZ"}
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
.form {
|
|
2
|
-
display: flex;
|
|
3
|
-
height: calc(100vh - var(--app-header-height));
|
|
4
|
-
flex-direction: column;
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
.stickyHeader {
|
|
8
|
-
position: sticky;
|
|
9
|
-
top: 0;
|
|
10
|
-
z-index: 10;
|
|
11
|
-
background-color: var(--theme-bg);
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
.header {
|
|
15
|
-
margin-bottom: 1.5rem;
|
|
16
|
-
display: flex;
|
|
17
|
-
align-items: center;
|
|
18
|
-
justify-content: space-between;
|
|
19
|
-
gap: 1rem;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
.title {
|
|
23
|
-
font-size: var(--font-size-2xl);
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
.actions {
|
|
27
|
-
display: flex;
|
|
28
|
-
align-items: center;
|
|
29
|
-
gap: 0.5rem;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
.saveButton {
|
|
33
|
-
margin-block: 0;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
.content {
|
|
37
|
-
min-height: 0;
|
|
38
|
-
overflow-y: auto;
|
|
39
|
-
padding-top: 2rem;
|
|
40
|
-
padding-bottom: 4rem;
|
|
41
|
-
}
|