@json-layout/core 0.32.1 → 0.33.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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@json-layout/core",
3
- "version": "0.32.1",
3
+ "version": "0.33.0",
4
4
  "description": "Compilation and state management utilities for JSON Layout.",
5
5
  "type": "module",
6
6
  "exports": {
package/src/i18n/de.js ADDED
@@ -0,0 +1,33 @@
1
+ /** @type {import('./types.js').LocaleMessages} */
2
+ export default {
3
+ errorOneOf: 'Wählen Sie eine Option',
4
+ errorRequired: 'Erforderliche Information',
5
+ addItem: 'Element hinzufügen',
6
+ delete: 'Löschen',
7
+ edit: 'Bearbeiten',
8
+ close: 'Schließen',
9
+ duplicate: 'Duplizieren',
10
+ sort: 'Sortieren',
11
+ up: 'Nach oben verschieben',
12
+ down: 'Nach unten verschieben',
13
+ showHelp: 'Hilfemeldung anzeigen',
14
+ mdeLink1: '[Link-Titel',
15
+ mdeLink2: '](Link-URL)',
16
+ mdeImg1: '![](',
17
+ mdeImg2: 'Bild-URL)',
18
+ mdeTable1: '',
19
+ mdeTable2: '\n\n| Spalte 1 | Spalte 2 | Spalte 3 |\n| -------- | -------- | -------- |\n| Text | Text | Text |\n\n',
20
+ bold: 'Fett',
21
+ italic: 'Kursiv',
22
+ heading: 'Titel',
23
+ quote: 'Zitat',
24
+ unorderedList: 'Ungeordnete Liste',
25
+ orderedList: 'Geordnete Liste',
26
+ createLink: 'Link erstellen',
27
+ insertImage: 'Bild einfügen',
28
+ createTable: 'Tabelle erstellen',
29
+ preview: 'Vorschau',
30
+ mdeGuide: 'Syntax-Dokumentation',
31
+ undo: 'Rückgängig',
32
+ redo: 'Wiederholen'
33
+ }
package/src/i18n/index.js CHANGED
@@ -1,10 +1,12 @@
1
1
  import en from './en.js'
2
2
  import fr from './fr.js'
3
3
  import nl from './nl.js'
4
+ import de from './de.js'
4
5
 
5
6
  /** @type {Record<string, import('./types.js').LocaleMessages>} */
6
7
  export default {
7
8
  en,
8
9
  fr,
9
- nl
10
+ nl,
11
+ de
10
12
  }
@@ -75,6 +75,7 @@ function fillOptions (partialOptions, compiledLayout) {
75
75
  removeAdditional: 'error',
76
76
  autofocus: false,
77
77
  readOnlyPropertiesMode: 'show',
78
+ fetchOptions: {},
78
79
  onAutofocus: () => {},
79
80
  onUpdate: () => {},
80
81
  onData: () => {},
@@ -554,7 +555,8 @@ export class StatefulLayout {
554
555
  if (q) url.searchParams.set(qSearchParam, q)
555
556
  else url.searchParams.delete(qSearchParam)
556
557
  }
557
- rawItems = await (await fetch(url)).json()
558
+ const fetchOptions = typeof node.options.fetchOptions === 'function' ? node.options.fetchOptions(url) : node.options.fetchOptions
559
+ rawItems = await (await fetch(url, fetchOptions)).json()
558
560
  }
559
561
 
560
562
  if (!rawItems) {
@@ -102,6 +102,7 @@ export interface ValidationState {
102
102
  export type StateNodeOptions = Required<StateNodeOptionsBase & {
103
103
  context: Record<string, any>
104
104
  messages: LocaleMessages
105
+ fetchOptions: RequestInit | ((url: URL) => RequestInit)
105
106
  onData: (data: any) => void
106
107
  onUpdate: (statefulLayout: StatefulLayout) => void
107
108
  onAutofocus: (key: string) => void
@@ -148,5 +148,9 @@ export const runtimeOptions = [
148
148
  key: 'autofocus',
149
149
  description: 'Activate autofocus. The focus will be given to the first input of the form.',
150
150
  default: false
151
+ },
152
+ {
153
+ key: 'fetchOptions',
154
+ description: 'Define options to be given to <a href="https://developer.mozilla.org/en-US/docs/Web/API/Window/fetch">fetch</a> when getting data items from a URL. Can also be a function that will accept a URL object as parameter and return those options.'
151
155
  }
152
156
  ]