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.
- package/README.md +67 -41
- package/index.d.ts +18 -9
- package/index.js +6 -3
- package/package.json +3 -5
- package/src/components/Browser/Browser.vue +58 -58
- package/src/components/Browser/TreeNav.vue +32 -32
- package/src/components/Browser/ViurBrowser.d.vue.ts +21 -21
- package/src/components/Browser/ViurBrowser.vue +47 -44
- package/src/components/Browser/dragSession.ts +27 -27
- package/src/components/Browser/index.ts +3 -3
- package/src/components/Browser/types.ts +9 -9
- package/src/components/DataTable/ColumnFilterPanel.vue +7 -7
- package/src/components/DataTable/DataTable.vue +346 -346
- package/src/components/DataTable/ViurDataTable.d.vue.ts +26 -26
- package/src/components/DataTable/ViurDataTable.vue +51 -50
- package/src/components/DataTable/columns.ts +30 -30
- package/src/components/DataTable/index.ts +12 -12
- package/src/components/DataTable/rows.ts +71 -72
- package/src/components/DataTable/types.ts +55 -55
- package/src/components/DataTable/useColumnLayout.ts +28 -28
- package/src/components/DataTable/useGridNavigation.ts +15 -15
- package/src/components/DataTable/useVirtualRows.ts +10 -10
- package/src/components/DataTable/viurColumns.ts +69 -69
- package/src/forms/ViForm.d.vue.ts +32 -32
- package/src/forms/ViForm.vue +17 -16
- package/src/forms/ViFormCategory.vue +3 -1
- package/src/forms/bones/Bone.vue +125 -108
- package/src/forms/bones/BoneActions.vue +21 -21
- package/src/forms/bones/BoneLabel.vue +1 -1
- package/src/forms/bones/BoneMultipleWrapper.vue +3 -3
- package/src/forms/bones/BoneNestedWrapper.vue +3 -3
- package/src/forms/bones/BoneSingleEntry.vue +2 -2
- package/src/forms/bones/FilterBone.vue +3 -3
- package/src/forms/bones/actions/ActionDialog.vue +2 -2
- package/src/forms/bones/actions/Debug.vue +6 -6
- package/src/forms/bones/actions/Delete.vue +2 -2
- package/src/forms/bones/actions/DescribeImage.vue +4 -3
- package/src/forms/bones/actions/Download.vue +4 -4
- package/src/forms/bones/actions/Placeholder.vue +2 -2
- package/src/forms/bones/actions/index.js +72 -74
- package/src/forms/bones/bone.d.ts +19 -19
- package/src/forms/bones/uploadAdapter.js +3 -3
- package/src/forms/bones/utils.js +40 -41
- package/src/forms/bones/view/base_item.vue +1 -1
- package/src/forms/bones/view/boneLogic.js +1 -1
- package/src/forms/bones/widgets/booleanBone.vue +19 -19
- package/src/forms/bones/widgets/booleanBoneChoose.vue +2 -2
- package/src/forms/bones/widgets/booleanBoneSelect.vue +3 -3
- package/src/forms/bones/widgets/codeBone.vue +22 -22
- package/src/forms/bones/widgets/colorBone.vue +18 -18
- package/src/forms/bones/widgets/dateBone.vue +22 -22
- package/src/forms/bones/widgets/emailBone.vue +20 -20
- package/src/forms/bones/widgets/fileBone.vue +32 -31
- package/src/forms/bones/widgets/keyBone.vue +21 -21
- package/src/forms/bones/widgets/numericBone.vue +21 -21
- package/src/forms/bones/widgets/passwordBone.vue +34 -31
- package/src/forms/bones/widgets/phoneBone.vue +20 -20
- package/src/forms/bones/widgets/rawBone.vue +19 -19
- package/src/forms/bones/widgets/recordBone.vue +16 -16
- package/src/forms/bones/widgets/relationalBone.vue +26 -26
- package/src/forms/bones/widgets/selectBone.vue +23 -23
- package/src/forms/bones/widgets/selectBoneChoose.vue +2 -2
- package/src/forms/bones/widgets/spatialBone.vue +21 -21
- package/src/forms/bones/widgets/stringBone.vue +27 -27
- package/src/forms/bones/widgets/textBone.vue +28 -26
- package/src/forms/install.d.ts +1 -1
- package/src/forms/install.js +7 -0
- package/src/forms/layouts/LayloutList2Columns.vue +1 -1
- package/src/forms/layouts/LayoutCategory.vue +1 -1
- package/src/forms/layouts/LayoutList.vue +1 -1
- package/src/forms/utils.js +22 -22
- package/src/request/configStore.js +4 -4
- package/src/request/envelope.js +6 -6
- package/src/request/request.js +22 -22
- package/src/translations/de.js +31 -0
- package/src/translations/en.js +31 -0
- package/src/user/LoginScreen.d.vue.ts +24 -24
- package/src/user/LoginScreen.vue +6 -7
- package/src/user/store.d.ts +16 -16
- package/src/vite/safeHtml.js +73 -0
- package/src/vite/sanitizeVHtml.d.ts +4 -0
- package/src/vite/sanitizeVHtml.js +15 -0
- package/src/webawesomeCompat.css +0 -40
|
@@ -1,52 +1,52 @@
|
|
|
1
1
|
import type { DefineComponent } from "vue"
|
|
2
2
|
|
|
3
|
-
/** Props
|
|
3
|
+
/** Props of ViForm.vue (see defineProps there — the common ones here). */
|
|
4
4
|
export interface ViFormProps {
|
|
5
|
-
/**
|
|
5
|
+
/** Module name or dot path ("user", "shop.order"). */
|
|
6
6
|
module?: string
|
|
7
|
-
/**
|
|
7
|
+
/** Action below the module ("add", "edit", "login", "auth_.../login"). */
|
|
8
8
|
action?: string | null
|
|
9
|
-
/**
|
|
9
|
+
/** Subtype of grouped lists. */
|
|
10
10
|
group?: string | null
|
|
11
|
-
/**
|
|
11
|
+
/** Key of the entry for edit/clone — a singleton doesn't need one. */
|
|
12
12
|
skelkey?: string | null
|
|
13
|
-
/**
|
|
13
|
+
/** Tree type ("node" | "leaf"). */
|
|
14
14
|
skeltype?: string | null
|
|
15
|
-
/** skey
|
|
15
|
+
/** Send the skey along (default: true). */
|
|
16
16
|
secure?: boolean
|
|
17
17
|
/**
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
* `false`
|
|
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
|
-
/**
|
|
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
|
-
/**
|
|
27
|
+
/** Show only these bones. */
|
|
28
28
|
bones?: string[]
|
|
29
|
-
/**
|
|
29
|
+
/** Additional data for BUILDING the form (e.g. `{ bounce: 1 }`). */
|
|
30
30
|
params?: Record<string, any>
|
|
31
|
-
/**
|
|
31
|
+
/** Alternative URL for building the form. */
|
|
32
32
|
fetchUrl?: string | null
|
|
33
|
-
/** Renderer
|
|
33
|
+
/** Renderer of the requests (default: VITE_DEFAULT_RENDERER). */
|
|
34
34
|
renderer?: string
|
|
35
|
-
/**
|
|
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
|
-
/**
|
|
41
|
+
/** Show bone action bars (required actions always appear). */
|
|
42
42
|
boneactions?: boolean
|
|
43
43
|
/**
|
|
44
|
-
*
|
|
45
|
-
* (`"-name"`
|
|
46
|
-
*
|
|
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
|
-
/**
|
|
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
|
-
/**
|
|
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
|
-
/**
|
|
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
|
|
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
|
-
/**
|
|
76
|
+
/** What ViForm exposes via defineExpose. */
|
|
77
77
|
export interface ViFormApi {
|
|
78
|
-
/**
|
|
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
|
-
/**
|
|
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
|
-
/**
|
|
91
|
+
/** Render a step of a multi-step flow. */
|
|
92
92
|
loadStep: (url?: string | null) => Promise<unknown>
|
|
93
|
-
/**
|
|
93
|
+
/** Submit the current step and advance to the next one if applicable. */
|
|
94
94
|
submitStep: () => Promise<unknown>
|
|
95
|
-
/**
|
|
95
|
+
/** Go back one step. */
|
|
96
96
|
back: () => Promise<unknown> | void
|
|
97
97
|
updateSkel: (values: Record<string, any>) => void
|
|
98
|
-
/**
|
|
98
|
+
/** Rebuild from scratch — refetches the form from the server. */
|
|
99
99
|
reload: () => void
|
|
100
|
-
/**
|
|
100
|
+
/** Discard changes: values of the last server state without a new request. */
|
|
101
101
|
resetForm: () => void
|
|
102
102
|
state: ViFormState
|
|
103
103
|
}
|
package/src/forms/ViForm.vue
CHANGED
|
@@ -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
|
|
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
|
-
*
|
|
250
|
-
*
|
|
251
|
-
* `"-name"`
|
|
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']" //
|
|
254
|
-
* :actions="{ '*': ['debug'], tags: ['-removeEntry'] }" //
|
|
254
|
+
* :actions="['-removeEntry']" // ALL bones
|
|
255
|
+
* :actions="{ '*': ['debug'], tags: ['-removeEntry'] }" // per bone
|
|
255
256
|
*
|
|
256
|
-
*
|
|
257
|
-
* `bone.params.actions`
|
|
258
|
-
*
|
|
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, //
|
|
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
|
-
//
|
|
409
|
-
//
|
|
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
|
|
496
|
-
// v1
|
|
497
|
-
// (
|
|
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: {
|