viur-ui 0.0.1 → 0.0.2

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.
Files changed (83) hide show
  1. package/README.md +67 -41
  2. package/index.d.ts +18 -9
  3. package/index.js +6 -3
  4. package/package.json +3 -5
  5. package/src/components/Browser/Browser.vue +58 -58
  6. package/src/components/Browser/TreeNav.vue +32 -32
  7. package/src/components/Browser/ViurBrowser.d.vue.ts +21 -21
  8. package/src/components/Browser/ViurBrowser.vue +47 -44
  9. package/src/components/Browser/dragSession.ts +27 -27
  10. package/src/components/Browser/index.ts +3 -3
  11. package/src/components/Browser/types.ts +9 -9
  12. package/src/components/DataTable/ColumnFilterPanel.vue +7 -7
  13. package/src/components/DataTable/DataTable.vue +346 -346
  14. package/src/components/DataTable/ViurDataTable.d.vue.ts +26 -26
  15. package/src/components/DataTable/ViurDataTable.vue +51 -50
  16. package/src/components/DataTable/columns.ts +30 -30
  17. package/src/components/DataTable/index.ts +12 -12
  18. package/src/components/DataTable/rows.ts +71 -72
  19. package/src/components/DataTable/types.ts +55 -55
  20. package/src/components/DataTable/useColumnLayout.ts +28 -28
  21. package/src/components/DataTable/useGridNavigation.ts +15 -15
  22. package/src/components/DataTable/useVirtualRows.ts +10 -10
  23. package/src/components/DataTable/viurColumns.ts +69 -69
  24. package/src/forms/ViForm.d.vue.ts +32 -32
  25. package/src/forms/ViForm.vue +17 -16
  26. package/src/forms/ViFormCategory.vue +3 -1
  27. package/src/forms/bones/Bone.vue +125 -108
  28. package/src/forms/bones/BoneActions.vue +21 -21
  29. package/src/forms/bones/BoneLabel.vue +1 -1
  30. package/src/forms/bones/BoneMultipleWrapper.vue +3 -3
  31. package/src/forms/bones/BoneNestedWrapper.vue +3 -3
  32. package/src/forms/bones/BoneSingleEntry.vue +2 -2
  33. package/src/forms/bones/FilterBone.vue +3 -3
  34. package/src/forms/bones/actions/ActionDialog.vue +2 -2
  35. package/src/forms/bones/actions/Debug.vue +6 -6
  36. package/src/forms/bones/actions/Delete.vue +2 -2
  37. package/src/forms/bones/actions/DescribeImage.vue +4 -3
  38. package/src/forms/bones/actions/Download.vue +4 -4
  39. package/src/forms/bones/actions/Placeholder.vue +2 -2
  40. package/src/forms/bones/actions/index.js +72 -74
  41. package/src/forms/bones/bone.d.ts +19 -19
  42. package/src/forms/bones/uploadAdapter.js +3 -3
  43. package/src/forms/bones/utils.js +40 -41
  44. package/src/forms/bones/view/base_item.vue +1 -1
  45. package/src/forms/bones/view/boneLogic.js +1 -1
  46. package/src/forms/bones/widgets/booleanBone.vue +19 -19
  47. package/src/forms/bones/widgets/booleanBoneChoose.vue +2 -2
  48. package/src/forms/bones/widgets/booleanBoneSelect.vue +3 -3
  49. package/src/forms/bones/widgets/codeBone.vue +22 -22
  50. package/src/forms/bones/widgets/colorBone.vue +18 -18
  51. package/src/forms/bones/widgets/dateBone.vue +22 -22
  52. package/src/forms/bones/widgets/emailBone.vue +20 -20
  53. package/src/forms/bones/widgets/fileBone.vue +32 -31
  54. package/src/forms/bones/widgets/keyBone.vue +21 -21
  55. package/src/forms/bones/widgets/numericBone.vue +21 -21
  56. package/src/forms/bones/widgets/passwordBone.vue +34 -31
  57. package/src/forms/bones/widgets/phoneBone.vue +20 -20
  58. package/src/forms/bones/widgets/rawBone.vue +19 -19
  59. package/src/forms/bones/widgets/recordBone.vue +16 -16
  60. package/src/forms/bones/widgets/relationalBone.vue +26 -26
  61. package/src/forms/bones/widgets/selectBone.vue +23 -23
  62. package/src/forms/bones/widgets/selectBoneChoose.vue +2 -2
  63. package/src/forms/bones/widgets/spatialBone.vue +21 -21
  64. package/src/forms/bones/widgets/stringBone.vue +27 -27
  65. package/src/forms/bones/widgets/textBone.vue +28 -26
  66. package/src/forms/install.d.ts +1 -1
  67. package/src/forms/install.js +7 -0
  68. package/src/forms/layouts/LayloutList2Columns.vue +1 -1
  69. package/src/forms/layouts/LayoutCategory.vue +1 -1
  70. package/src/forms/layouts/LayoutList.vue +1 -1
  71. package/src/forms/utils.js +22 -22
  72. package/src/request/configStore.js +4 -4
  73. package/src/request/envelope.js +6 -6
  74. package/src/request/request.js +22 -22
  75. package/src/translations/de.js +31 -0
  76. package/src/translations/en.js +31 -0
  77. package/src/user/LoginScreen.d.vue.ts +24 -24
  78. package/src/user/LoginScreen.vue +6 -7
  79. package/src/user/store.d.ts +16 -16
  80. package/src/vite/safeHtml.js +73 -0
  81. package/src/vite/sanitizeVHtml.d.ts +4 -0
  82. package/src/vite/sanitizeVHtml.js +15 -0
  83. package/src/webawesomeCompat.css +0 -40
@@ -1,52 +1,52 @@
1
1
  import type { DefineComponent } from "vue"
2
2
 
3
- /** Props von ViForm.vue (siehe defineProps dort — hier die gebräuchlichen). */
3
+ /** Props of ViForm.vue (see defineProps there — the common ones here). */
4
4
  export interface ViFormProps {
5
- /** Modulname bzw. Punkt-Pfad ("user", "shop.order"). */
5
+ /** Module name or dot path ("user", "shop.order"). */
6
6
  module?: string
7
- /** Aktion unterhalb des Moduls ("add", "edit", "login", "auth_.../login"). */
7
+ /** Action below the module ("add", "edit", "login", "auth_.../login"). */
8
8
  action?: string | null
9
- /** Untertyp gruppierter Listen. */
9
+ /** Subtype of grouped lists. */
10
10
  group?: string | null
11
- /** Schlüssel des Datensatzes für edit/clone — ein Singleton braucht keinen. */
11
+ /** Key of the entry for edit/clone — a singleton doesn't need one. */
12
12
  skelkey?: string | null
13
- /** Baum-Typ ("node" | "leaf"). */
13
+ /** Tree type ("node" | "leaf"). */
14
14
  skeltype?: string | null
15
- /** skey mitsenden (Standard: true). */
15
+ /** Send the skey along (default: true). */
16
16
  secure?: boolean
17
17
  /**
18
- * Feedback in den Message-Store schreiben (Speichern erfolgreich, Login
19
- * fehlgeschlagen, …). Wirkt nur, wenn die App Pinia installiert hat;
20
- * `false` hält dieses Formular stumm. Standard: true.
18
+ * Write feedback to the message store (save successful, login
19
+ * failed, …). Only takes effect if the app has installed Pinia;
20
+ * `false` keeps this form silent. Default: true.
21
21
  */
22
22
  useMessageStore?: boolean
23
- /** Fertige Struktur/Werte statt eines Requests. */
23
+ /** Ready-made structure/values instead of a request. */
24
24
  skel?: Record<string, any> | string | null
25
25
  structure?: Record<string, any> | unknown[] | null
26
26
  values?: Record<string, any> | null
27
- /** Nur diese Bones zeigen. */
27
+ /** Show only these bones. */
28
28
  bones?: string[]
29
- /** Zusätzliche Daten für den AUFBAU des Formulars (z. B. `{ bounce: 1 }`). */
29
+ /** Additional data for BUILDING the form (e.g. `{ bounce: 1 }`). */
30
30
  params?: Record<string, any>
31
- /** Abweichende Adresse für den Aufbau. */
31
+ /** Alternative URL for building the form. */
32
32
  fetchUrl?: string | null
33
- /** Renderer der Requests (Standard: VITE_DEFAULT_RENDERER). */
33
+ /** Renderer of the requests (default: VITE_DEFAULT_RENDERER). */
34
34
  renderer?: string
35
- /** Protokollversion festnageln. */
35
+ /** Pin the protocol version. */
36
36
  version?: string | number | null
37
37
  useCategories?: boolean
38
38
  collapsedCategories?: string[]
39
39
  categoryDefaultname?: string
40
40
  readonly?: boolean
41
- /** Bone-Action-Leisten anzeigen (Pflicht-Actions erscheinen immer). */
41
+ /** Show bone action bars (required actions always appear). */
42
42
  boneactions?: boolean
43
43
  /**
44
- * Formular-weite Action-Konfiguration: Einträge wie `bone.params.actions`
45
- * (`"-name"` deaktiviert explizit, auch Pflicht-Actions). Array = alle
46
- * Bones; Objekt = pro Bone-Name, `"*"` für alle.
44
+ * Form-wide action configuration: entries like `bone.params.actions`
45
+ * (`"-name"` explicitly disables, even required actions). Array = all
46
+ * bones; object = per bone name, `"*"` for all.
47
47
  */
48
48
  actions?: (string | Record<string, any>)[] | Record<string, (string | Record<string, any>)[]> | null
49
- /** Mehrstufigen Ablauf fahren (Login, Assistenten). */
49
+ /** Run a multi-step flow (login, wizards). */
50
50
  multistep?: boolean
51
51
  showSteps?: boolean
52
52
  submitLabel?: string
@@ -54,16 +54,16 @@ export interface ViFormProps {
54
54
  backLabel?: string
55
55
  }
56
56
 
57
- /** Zustand des Formulars, wie ihn `state` freigibt. */
57
+ /** State of the form as exposed by `state`. */
58
58
  export interface ViFormState {
59
59
  loading: boolean
60
60
  failed: unknown
61
61
  skel: Record<string, any>
62
- /** Werte des letzten Server-Stands (Grundlage von resetForm). */
62
+ /** Values of the last server state (basis for resetForm). */
63
63
  pristine: Record<string, any> | null
64
64
  structure: Record<string, any> | null
65
65
  errors: { fieldPath?: string[]; errorMessage?: string; severity?: number }[]
66
- /** v2-Status der letzten Antwort: "init" | "success" | "rejected" | … */
66
+ /** v2 status of the last response: "init" | "success" | "rejected" | … */
67
67
  status: string | null
68
68
  actionname: string | null
69
69
  actionparams: Record<string, any> | null
@@ -73,31 +73,31 @@ export interface ViFormState {
73
73
  [key: string]: unknown
74
74
  }
75
75
 
76
- /** Was ViForm per defineExpose freigibt. */
76
+ /** What ViForm exposes via defineExpose. */
77
77
  export interface ViFormApi {
78
- /** Werte abschicken (POST auf die Adresse des Formulars). */
78
+ /** Submit the values (POST to the form's URL). */
79
79
  sendData: (
80
80
  alternativeUrl?: string | null,
81
81
  additionalData?: Record<string, any> | null,
82
82
  headers?: Record<string, string> | null,
83
83
  removeKeyFromDataset?: boolean
84
84
  ) => Promise<unknown>
85
- /** Formular (neu) vom Server holen. */
85
+ /** (Re)fetch the form from the server. */
86
86
  fetchData: (
87
87
  alternativeUrl?: string | null,
88
88
  additionalData?: Record<string, any> | null,
89
89
  headers?: Record<string, string> | null
90
90
  ) => Promise<unknown>
91
- /** Schritt eines mehrstufigen Ablaufs rendern. */
91
+ /** Render a step of a multi-step flow. */
92
92
  loadStep: (url?: string | null) => Promise<unknown>
93
- /** Aktuellen Schritt abschicken und ggf. zum nächsten gehen. */
93
+ /** Submit the current step and advance to the next one if applicable. */
94
94
  submitStep: () => Promise<unknown>
95
- /** Einen Schritt zurück. */
95
+ /** Go back one step. */
96
96
  back: () => Promise<unknown> | void
97
97
  updateSkel: (values: Record<string, any>) => void
98
- /** Von vorn aufbauen — holt das Formular neu vom Server. */
98
+ /** Rebuild from scratch — refetches the form from the server. */
99
99
  reload: () => void
100
- /** Änderungen verwerfen: Werte des letzten Server-Stands ohne neuen Request. */
100
+ /** Discard changes: values of the last server state without a new request. */
101
101
  resetForm: () => void
102
102
  state: ViFormState
103
103
  }
@@ -107,7 +107,7 @@
107
107
 
108
108
  <!-- Footer / action bar for the multi-step flow. Override via the `actions`
109
109
  slot; slot props expose the `next` (submit/advance) and `back` actions
110
- plus flow state. The default is a Zurück / Weiter|Absenden bar. -->
110
+ plus flow state. The default is a Back / Next|Submit bar. -->
111
111
  <slot
112
112
  name="actions"
113
113
  :next="submitStep"
@@ -146,11 +146,12 @@
146
146
 
147
147
  <script setup>
148
148
  import { useI18n } from "vue-i18n"
149
- import { useFormUtils } from "./utils"
149
+ import { useFormUtils } from "./utils.js"
150
150
  import { v1SelectionFollow } from "../request/index.js"
151
151
  import { reactive, watch, onBeforeMount, computed, provide, ref } from "vue"
152
152
  import { useDebounceFn } from "@vueuse/core"
153
153
  import LayoutCategory from "./layouts/LayoutCategory.vue"
154
+ import Bone from "./bones/Bone.vue"
154
155
 
155
156
  const emit = defineEmits(["change", "keypress-enter", "failed", "success", "step-change"])
156
157
 
@@ -246,16 +247,16 @@ const props = defineProps({
246
247
  default: false,
247
248
  },
248
249
  /**
249
- * Formular-weite Action-Konfiguration für die Bones — dieselben Einträge
250
- * wie `bone.params.actions`: Namen/Inline-Objekte AKTIVIEREN zusätzlich,
251
- * `"-name"` DEAKTIVIERT explizit (schlägt auch Pflicht-Actions).
250
+ * Form-wide action configuration for the bones — the same entries
251
+ * as `bone.params.actions`: names/inline objects additionally ENABLE,
252
+ * `"-name"` explicitly DISABLES (even overrides required actions).
252
253
  *
253
- * :actions="['-removeEntry']" // ALLE Bones
254
- * :actions="{ '*': ['debug'], tags: ['-removeEntry'] }" // pro Bone
254
+ * :actions="['-removeEntry']" // ALL bones
255
+ * :actions="{ '*': ['debug'], tags: ['-removeEntry'] }" // per bone
255
256
  *
256
- * Wird per provide("boneActionsConfig") an die Bones gereicht und dort VOR
257
- * `bone.params.actions` gemerged (Bone-Lokales ist spezifischer; ein Minus
258
- * gewinnt immer, egal aus welcher Quelle).
257
+ * Passed to the bones via provide("boneActionsConfig") and merged there BEFORE
258
+ * `bone.params.actions` (bone-local is more specific; a minus
259
+ * always wins, regardless of the source).
259
260
  */
260
261
  actions: {
261
262
  type: [Array, Object],
@@ -336,7 +337,7 @@ const props = defineProps({
336
337
 
337
338
  const state = reactive({
338
339
  skel: {}, // working data
339
- pristine: null, // Werte des letzten Server-Stands (für resetForm)
340
+ pristine: null, // values of the last server state (for resetForm)
340
341
  structure: {}, // working data, use dict!
341
342
  errors: [], // working data
342
343
  actionparams: {}, //actionskel parameters
@@ -405,8 +406,8 @@ function listLabel(item, i) {
405
406
  return `#${i + 1}`
406
407
  }
407
408
  provide("formState", state)
408
- // Formular-weite Action-Konfiguration (siehe actions-Prop) — computed, damit
409
- // eine reaktive Prop-Änderung bei den Bones ankommt.
409
+ // Form-wide action configuration (see actions prop) — computed so that
410
+ // a reactive prop change reaches the bones.
410
411
  provide("boneActionsConfig", computed(() => props.actions))
411
412
  if (!props.internal) {
412
413
  provide("mainformState", state)
@@ -492,9 +493,9 @@ async function submitStep() {
492
493
  // the normalized v2 envelope.
493
494
  const fetchResult = await sendData(state.postUrl)
494
495
  const data = fetchResult?.data?.value
495
- // v2 liefert das Ziel des nächsten Schritts als `follow`. In der klassischen
496
- // v1-Login-Kette gibt es das nicht — dort ist das Ziel der gewählte Wert
497
- // (die Provider-Auswahl listet URLs).
496
+ // v2 delivers the next step's target as `follow`. The classic
497
+ // v1 login chain doesn't have that — there the target is the selected value
498
+ // (the provider selection lists URLs).
498
499
  const follow = data?.["follow"] ?? v1SelectionFollow(data)
499
500
  if (data?.["status"] === "success") {
500
501
  emit("success", data)
@@ -12,13 +12,15 @@
12
12
  >
13
13
  <div
14
14
  slot="summary"
15
- v-html="name"
15
+ v-safe-html="name"
16
16
  ></div>
17
17
  <slot></slot>
18
18
  </wa-details>
19
19
  </template>
20
20
 
21
21
  <script setup>
22
+ import { vSafeHtml } from "../vite/safeHtml.js"
23
+
22
24
  const props = defineProps({
23
25
  // String shown a Category
24
26
  name: {