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
|
@@ -97,51 +97,52 @@
|
|
|
97
97
|
<script setup>
|
|
98
98
|
import { reactive, onMounted, inject, ref } from "vue"
|
|
99
99
|
import { downloadUrlFor, uploadFile } from "../../../request/index.js"
|
|
100
|
+
import BoneActions from "../BoneActions.vue"
|
|
100
101
|
/**
|
|
101
|
-
*
|
|
102
|
+
* File upload widget for bones of type `relational.tree.leaf.file.file`.
|
|
102
103
|
*
|
|
103
|
-
*
|
|
104
|
-
*
|
|
105
|
-
*
|
|
106
|
-
*
|
|
104
|
+
* Provides a combined click/drop area: a click opens the file picker,
|
|
105
|
+
* a drop uploads the dropped file. For image files, a clickable
|
|
106
|
+
* preview is shown that opens a dialog. Action buttons (download, delete)
|
|
107
|
+
* are inserted via `<bone-actions>` through the default slot.
|
|
107
108
|
*
|
|
108
109
|
* @displayName FileBone
|
|
109
110
|
*
|
|
110
|
-
* @cssClass bone-widget-file-area -
|
|
111
|
-
* @cssClass bone-widget-prompt - Empty
|
|
112
|
-
* @cssClass bone-widget-loader -
|
|
113
|
-
* @cssClass bone-widget-preview - Container
|
|
114
|
-
* @cssClass has-preview -
|
|
115
|
-
* @cssClass is-dragover -
|
|
116
|
-
* @cssClass has-value -
|
|
117
|
-
* @cssClass is-loading -
|
|
118
|
-
* @cssClass is-readonly -
|
|
111
|
+
* @cssClass bone-widget-file-area - Outer clickable container (drop zone)
|
|
112
|
+
* @cssClass bone-widget-prompt - Empty state (icon + text)
|
|
113
|
+
* @cssClass bone-widget-loader - Visible during the upload
|
|
114
|
+
* @cssClass bone-widget-preview - Container for the preview image or the file icon
|
|
115
|
+
* @cssClass has-preview - Additional class when an image preview is present
|
|
116
|
+
* @cssClass is-dragover - When a file is dragged over the area
|
|
117
|
+
* @cssClass has-value - When a value is set
|
|
118
|
+
* @cssClass is-loading - While an upload is in progress
|
|
119
|
+
* @cssClass is-readonly - When the bone is readonly
|
|
119
120
|
*/
|
|
120
121
|
defineOptions({
|
|
121
122
|
inheritAttrs: false,
|
|
122
123
|
})
|
|
123
124
|
const props = defineProps({
|
|
124
|
-
/** Bone
|
|
125
|
+
/** Bone name – passed as the first argument in every `change` event. */
|
|
125
126
|
name: String,
|
|
126
|
-
/**
|
|
127
|
+
/** Current bone value; object with `dest` and `rel` keys, or `null`. */
|
|
127
128
|
value: [Object, String, Number, Boolean, Array],
|
|
128
|
-
/** Index
|
|
129
|
+
/** Index in the multiple array; `undefined` for a single value. */
|
|
129
130
|
index: Number,
|
|
130
|
-
/**
|
|
131
|
+
/** Language key for multilingual bones, e.g. `"de"`. */
|
|
131
132
|
lang: String,
|
|
132
|
-
/** Bone
|
|
133
|
+
/** Bone structure; the `public` flag controls whether the upload is public. */
|
|
133
134
|
bone: Object,
|
|
134
|
-
/**
|
|
135
|
+
/** Currently not used. */
|
|
135
136
|
autofocus: Boolean,
|
|
136
137
|
})
|
|
137
138
|
|
|
138
139
|
const emit = defineEmits([
|
|
139
140
|
/**
|
|
140
|
-
*
|
|
141
|
-
* @arg {string} name - Bone
|
|
142
|
-
* @arg {{ dest: object, rel: null }|string} value -
|
|
143
|
-
* @arg {string|undefined} lang -
|
|
144
|
-
* @arg {number|undefined} index - Index
|
|
141
|
+
* Fired on file upload, file drop, clearing, and on mount (initialization).
|
|
142
|
+
* @arg {string} name - Bone name
|
|
143
|
+
* @arg {{ dest: object, rel: null }|string} value - Uploaded file object, or `""` when cleared
|
|
144
|
+
* @arg {string|undefined} lang - Language key
|
|
145
|
+
* @arg {number|undefined} index - Index in the multiple array
|
|
145
146
|
*/
|
|
146
147
|
"change",
|
|
147
148
|
])
|
|
@@ -159,9 +160,9 @@ onMounted(() => {
|
|
|
159
160
|
})
|
|
160
161
|
|
|
161
162
|
/**
|
|
162
|
-
*
|
|
163
|
-
*
|
|
164
|
-
*
|
|
163
|
+
* Triggers the native file picker of the hidden input.
|
|
164
|
+
* Only active in the empty state — if a value is already set, it must first be
|
|
165
|
+
* cleared via the delete action or replaced via drag-and-drop.
|
|
165
166
|
*/
|
|
166
167
|
function openPicker() {
|
|
167
168
|
if (state.loading || boneState.readonly || props.value) return
|
|
@@ -237,11 +238,11 @@ async function handleDrop(event) {
|
|
|
237
238
|
.bone-widget-prompt {
|
|
238
239
|
justify-content: center;
|
|
239
240
|
color: var(--wa-color-on-quiet);
|
|
240
|
-
/*
|
|
241
|
+
/* Clicks fall through to the outer drop zone */
|
|
241
242
|
pointer-events: none;
|
|
242
243
|
}
|
|
243
244
|
|
|
244
|
-
/*
|
|
245
|
+
/* Filename row may shrink; long names are truncated with an ellipsis */
|
|
245
246
|
.bone-widget-file-row {
|
|
246
247
|
min-width: 0;
|
|
247
248
|
}
|
|
@@ -261,7 +262,7 @@ async function handleDrop(event) {
|
|
|
261
262
|
background-color: color-mix(in srgb, var(--wa-color-surface-default) 70%, transparent);
|
|
262
263
|
}
|
|
263
264
|
|
|
264
|
-
/*
|
|
265
|
+
/* Clickable image preview: zoom cursor + slight scaling on hover */
|
|
265
266
|
.bone-widget-preview.has-preview {
|
|
266
267
|
cursor: zoom-in;
|
|
267
268
|
transition: transform 0.15s ease;
|
|
@@ -12,48 +12,48 @@
|
|
|
12
12
|
<script setup>
|
|
13
13
|
import { reactive, onMounted, inject } from "vue"
|
|
14
14
|
/**
|
|
15
|
-
*
|
|
15
|
+
* Display widget for an entry's internal database key (type `key`).
|
|
16
16
|
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
17
|
+
* Renders an always-disabled `<wa-input>`, since the key cannot be edited
|
|
18
|
+
* manually. The value is taken directly from the skel and serves
|
|
19
|
+
* informational purposes only. Supports neither multiple nor multilang.
|
|
20
20
|
*
|
|
21
21
|
* @displayName KeyBone
|
|
22
22
|
*
|
|
23
|
-
* @cssClass bone-widget -
|
|
24
|
-
* @cssClass bone-widget-key -
|
|
25
|
-
* @cssClass bone-widget-key-default -
|
|
26
|
-
* @cssClass bone-widget-key-{name} -
|
|
23
|
+
* @cssClass bone-widget - Base class of all bone widgets
|
|
24
|
+
* @cssClass bone-widget-key - Identifies the bone type
|
|
25
|
+
* @cssClass bone-widget-key-default - Default variant
|
|
26
|
+
* @cssClass bone-widget-key-{name} - Dynamically set to the bone name, e.g. `bone-widget-key-key`
|
|
27
27
|
*/
|
|
28
28
|
defineOptions({
|
|
29
29
|
inheritAttrs: false,
|
|
30
30
|
})
|
|
31
31
|
const props = defineProps({
|
|
32
|
-
/** Bone
|
|
32
|
+
/** Bone name – passed as the first argument in every `change` event. */
|
|
33
33
|
name: String,
|
|
34
|
-
/**
|
|
34
|
+
/** Current key value (URL-safe Base64 string). */
|
|
35
35
|
value: [Object, String, Number, Boolean, Array],
|
|
36
|
-
/** Index
|
|
36
|
+
/** Index in the multiple array; unused, since multiple is not supported. */
|
|
37
37
|
index: Number,
|
|
38
|
-
/**
|
|
38
|
+
/** Language key; unused, since multilang is not supported. */
|
|
39
39
|
lang: String,
|
|
40
|
-
/** Readonly
|
|
40
|
+
/** Readonly flag (not evaluated – the bone is always disabled). */
|
|
41
41
|
readonly: Boolean,
|
|
42
|
-
/**
|
|
42
|
+
/** Additional bone parameters. */
|
|
43
43
|
params: Object,
|
|
44
|
-
/** Bone
|
|
44
|
+
/** Bone structure (currently not actively used). */
|
|
45
45
|
bone: Object,
|
|
46
|
-
/**
|
|
46
|
+
/** Sets the focus (no effect, since the element is always disabled). */
|
|
47
47
|
autofocus: Boolean,
|
|
48
48
|
})
|
|
49
49
|
|
|
50
50
|
const emit = defineEmits([
|
|
51
51
|
/**
|
|
52
|
-
*
|
|
53
|
-
* @arg {string} name - Bone
|
|
54
|
-
* @arg {string} value -
|
|
55
|
-
* @arg {string|undefined} lang -
|
|
56
|
-
* @arg {number|undefined} index - Index
|
|
52
|
+
* Fired on mount (initialization) and on change.
|
|
53
|
+
* @arg {string} name - Bone name
|
|
54
|
+
* @arg {string} value - Current key value
|
|
55
|
+
* @arg {string|undefined} lang - Language key
|
|
56
|
+
* @arg {number|undefined} index - Index in the multiple array
|
|
57
57
|
*/
|
|
58
58
|
"change",
|
|
59
59
|
])
|
|
@@ -32,46 +32,46 @@
|
|
|
32
32
|
import { reactive, onMounted, computed, inject, ref, watchEffect } from "vue"
|
|
33
33
|
import { useTimeoutFn } from "@vueuse/core"
|
|
34
34
|
/**
|
|
35
|
-
*
|
|
35
|
+
* Numeric input field for integers and decimal values.
|
|
36
36
|
*
|
|
37
|
-
*
|
|
38
|
-
*
|
|
39
|
-
* (`languages`)
|
|
40
|
-
*
|
|
37
|
+
* Renders a `<wa-input type="number">` and optionally shows hints about
|
|
38
|
+
* the minimum/maximum value and precision. Supports multiple languages
|
|
39
|
+
* (`languages`) and multiple values (`multiple`). The step (`step`) is
|
|
40
|
+
* calculated from `boneState.bonestructure.precision`.
|
|
41
41
|
*
|
|
42
42
|
* @displayName NumericBone
|
|
43
43
|
*
|
|
44
|
-
* @cssClass bone-widget -
|
|
45
|
-
* @cssClass bone-widget-numeric -
|
|
46
|
-
* @cssClass bone-widget-numeric-default -
|
|
47
|
-
* @cssClass bone-widget-numeric-{name} -
|
|
44
|
+
* @cssClass bone-widget - Base class of all bone widgets
|
|
45
|
+
* @cssClass bone-widget-numeric - Identifies the bone type
|
|
46
|
+
* @cssClass bone-widget-numeric-default - Default variant
|
|
47
|
+
* @cssClass bone-widget-numeric-{name} - Dynamically set to the bone name, e.g. `bone-widget-numeric-amount`
|
|
48
48
|
*/
|
|
49
49
|
defineOptions({
|
|
50
50
|
inheritAttrs: false,
|
|
51
51
|
})
|
|
52
52
|
const props = defineProps({
|
|
53
|
-
/** Bone
|
|
53
|
+
/** Bone name – passed as the first argument in every `change` event. */
|
|
54
54
|
name: String,
|
|
55
|
-
/**
|
|
55
|
+
/** Current bone value. */
|
|
56
56
|
value: [Object, String, Number, Boolean, Array],
|
|
57
|
-
/** Index
|
|
57
|
+
/** Index in the multiple array; `undefined` for a single value. */
|
|
58
58
|
index: Number,
|
|
59
|
-
/**
|
|
59
|
+
/** Language key for multilingual bones, e.g. `"de"`. */
|
|
60
60
|
lang: String,
|
|
61
|
-
/** Bone
|
|
61
|
+
/** Bone structure (currently not actively used). */
|
|
62
62
|
bone: Object,
|
|
63
|
-
/**
|
|
63
|
+
/** Focuses the input element after 600 ms. */
|
|
64
64
|
autofocus: Boolean,
|
|
65
65
|
})
|
|
66
66
|
|
|
67
67
|
const emit = defineEmits([
|
|
68
68
|
/**
|
|
69
|
-
*
|
|
70
|
-
* @arg {string} name - Bone
|
|
71
|
-
* @arg {string} value -
|
|
72
|
-
* @arg {string|undefined} lang -
|
|
73
|
-
* @arg {number|undefined} index - Index
|
|
74
|
-
* @arg {boolean} [valid] -
|
|
69
|
+
* Fired on every value change and on mount (initialization).
|
|
70
|
+
* @arg {string} name - Bone name
|
|
71
|
+
* @arg {string} value - Current input value (as a string)
|
|
72
|
+
* @arg {string|undefined} lang - Language key
|
|
73
|
+
* @arg {number|undefined} index - Index in the multiple array
|
|
74
|
+
* @arg {boolean} [valid] - Validation status; missing on the init event
|
|
75
75
|
*/
|
|
76
76
|
"change",
|
|
77
77
|
])
|
|
@@ -61,64 +61,67 @@
|
|
|
61
61
|
<script setup>
|
|
62
62
|
import { reactive, onMounted, computed, inject, watch, ref, watchEffect } from "vue"
|
|
63
63
|
import { useTimeoutFn } from "@vueuse/core"
|
|
64
|
+
import { useI18n } from "vue-i18n"
|
|
64
65
|
/**
|
|
65
|
-
*
|
|
66
|
+
* Password input field with confirmation and strength validation.
|
|
66
67
|
*
|
|
67
|
-
*
|
|
68
|
-
*
|
|
69
|
-
*
|
|
70
|
-
* (`PasswordBone(raw=True, tests=(), test_threshold=0)`);
|
|
71
|
-
*
|
|
72
|
-
*
|
|
73
|
-
*
|
|
74
|
-
*
|
|
75
|
-
*
|
|
68
|
+
* Renders `<wa-input type="password">` — with a confirmation field IF the bone
|
|
69
|
+
* comes with password tests at all (`bonestructure.tests`). A login form
|
|
70
|
+
* receives a raw password bone without tests from the server
|
|
71
|
+
* (`PasswordBone(raw=True, tests=(), test_threshold=0)`); a confirmation would be
|
|
72
|
+
* wrong there — you enter an existing password, you don't set one.
|
|
73
|
+
* In readonly mode the confirmation is omitted as well. Password tests
|
|
74
|
+
* are configured via `boneState.bonestructure.tests` (array of `[regex, message, required]`
|
|
75
|
+
* tuples). `boneState.bonestructure.test_threshold` defines
|
|
76
|
+
* how many optional tests may fail.
|
|
76
77
|
*
|
|
77
78
|
* @displayName PasswordBone
|
|
78
79
|
*
|
|
79
|
-
* @cssClass bone-widget -
|
|
80
|
-
* @cssClass bone-widget-password -
|
|
81
|
-
* @cssClass bone-widget-password-default -
|
|
82
|
-
* @cssClass bone-widget-password-{name} -
|
|
83
|
-
* @cssClass has-check -
|
|
80
|
+
* @cssClass bone-widget - Base class of all bone widgets
|
|
81
|
+
* @cssClass bone-widget-password - Identifies the bone type
|
|
82
|
+
* @cssClass bone-widget-password-default - Default variant
|
|
83
|
+
* @cssClass bone-widget-password-{name} - Dynamically set to the bone name
|
|
84
|
+
* @cssClass has-check - Set when not readonly; removes border-bottom-right-radius for a seamless transition to the confirmation field
|
|
84
85
|
*/
|
|
85
86
|
defineOptions({
|
|
86
87
|
inheritAttrs: false,
|
|
87
88
|
})
|
|
88
89
|
const props = defineProps({
|
|
89
|
-
/** Bone
|
|
90
|
+
/** Bone name – passed as the first argument in every `change` event. */
|
|
90
91
|
name: String,
|
|
91
|
-
/**
|
|
92
|
+
/** Current bone value (mirrored in `state.value1`). */
|
|
92
93
|
value: [Object, String, Number, Boolean, Array],
|
|
93
|
-
/** Index
|
|
94
|
+
/** Index in the multiple array; `undefined` for a single value. */
|
|
94
95
|
index: Number,
|
|
95
|
-
/**
|
|
96
|
+
/** Language key for multilingual bones, e.g. `"de"`. */
|
|
96
97
|
lang: String,
|
|
97
|
-
/** Bone
|
|
98
|
+
/** Bone structure (currently not actively used). */
|
|
98
99
|
bone: Object,
|
|
99
|
-
/**
|
|
100
|
+
/** Focuses the first password field after 600 ms. */
|
|
100
101
|
autofocus: Boolean,
|
|
101
102
|
})
|
|
102
103
|
|
|
103
104
|
const emit = defineEmits([
|
|
104
105
|
/**
|
|
105
|
-
*
|
|
106
|
-
* @arg {string} name - Bone
|
|
107
|
-
* @arg {string} value -
|
|
108
|
-
* @arg {string|undefined} lang -
|
|
109
|
-
* @arg {number|undefined} index - Index
|
|
110
|
-
* @arg {boolean} valid - `true`
|
|
106
|
+
* Fired on every value change and on mount (initialization).
|
|
107
|
+
* @arg {string} name - Bone name
|
|
108
|
+
* @arg {string} value - Current password value (only if both fields match and the tests passed)
|
|
109
|
+
* @arg {string|undefined} lang - Language key
|
|
110
|
+
* @arg {number|undefined} index - Index in the multiple array
|
|
111
|
+
* @arg {boolean} valid - `true` if the password is valid (tests passed + fields equal)
|
|
111
112
|
*/
|
|
112
113
|
"change",
|
|
113
114
|
])
|
|
114
115
|
|
|
116
|
+
const { t } = useI18n()
|
|
117
|
+
|
|
115
118
|
const boneState = inject("boneState")
|
|
116
119
|
const state = reactive({
|
|
117
120
|
value1: "",
|
|
118
121
|
value2: null,
|
|
119
122
|
equal: false,
|
|
120
|
-
//
|
|
121
|
-
//
|
|
123
|
+
// Confirmation only if the bone comes with tests (= a password is being
|
|
124
|
+
// SET). On login, the server delivers a raw bone without tests.
|
|
122
125
|
needsConfirm: computed(() => !boneState.readonly && (boneState?.bonestructure?.["tests"]?.length ?? 0) > 0),
|
|
123
126
|
passwordInfo: [],
|
|
124
127
|
requiredPasswordInfo: [],
|
|
@@ -172,10 +175,10 @@ function testPassword(password) {
|
|
|
172
175
|
}
|
|
173
176
|
}
|
|
174
177
|
if (state.needsConfirm && !state.equal) {
|
|
175
|
-
state.requiredPasswordInfo.push("
|
|
178
|
+
state.requiredPasswordInfo.push(t("bones.password.mismatch"))
|
|
176
179
|
}
|
|
177
180
|
if (!state.value1) {
|
|
178
|
-
state.requiredPasswordInfo.push("
|
|
181
|
+
state.requiredPasswordInfo.push(t("bones.password.empty"))
|
|
179
182
|
}
|
|
180
183
|
}
|
|
181
184
|
|
|
@@ -34,49 +34,49 @@
|
|
|
34
34
|
<script setup>
|
|
35
35
|
import { reactive, onMounted, inject, computed, watchEffect, ref } from "vue"
|
|
36
36
|
import { useTimeoutFn } from "@vueuse/core"
|
|
37
|
-
import Utils from "../utils"
|
|
37
|
+
import Utils from "../utils.js"
|
|
38
38
|
import jsonData from "../country_information.json"
|
|
39
39
|
import parsePhoneNumber from "libphonenumber-js/min"
|
|
40
40
|
import { AsYouType, validatePhoneNumberLength } from "libphonenumber-js/min"
|
|
41
41
|
/**
|
|
42
|
-
*
|
|
42
|
+
* Phone number input field with country code selection.
|
|
43
43
|
*
|
|
44
|
-
*
|
|
45
|
-
* `<wa-input type="tel">`
|
|
46
|
-
*
|
|
47
|
-
*
|
|
48
|
-
*
|
|
44
|
+
* Renders a `<wa-select>` for the country code (flag emoji) and a
|
|
45
|
+
* `<wa-input type="tel">` for the actual number. The number is formatted and
|
|
46
|
+
* normalized via `libphonenumber-js` while typing. The
|
|
47
|
+
* default country code can be controlled via `boneState.bonestructure.default_country_code`
|
|
48
|
+
* (default: `+49`).
|
|
49
49
|
*
|
|
50
50
|
* @displayName PhoneBone
|
|
51
51
|
*
|
|
52
|
-
* @cssClass bone-widget -
|
|
53
|
-
* @cssClass bone-widget-phone -
|
|
52
|
+
* @cssClass bone-widget - Base class of all bone widgets (on the inner `<wa-input>`)
|
|
53
|
+
* @cssClass bone-widget-phone - Identifies the bone type (on the inner `<wa-input>`, via wrapper class)
|
|
54
54
|
*/
|
|
55
55
|
defineOptions({
|
|
56
56
|
inheritAttrs: false,
|
|
57
57
|
})
|
|
58
58
|
const props = defineProps({
|
|
59
|
-
/** Bone
|
|
59
|
+
/** Bone name – passed as the first argument in every `change` event. */
|
|
60
60
|
name: String,
|
|
61
|
-
/**
|
|
61
|
+
/** Current bone value as an international phone number, e.g. `"+49 89 12345678"`. */
|
|
62
62
|
value: [Object, String, Number, Boolean, Array],
|
|
63
|
-
/** Index
|
|
63
|
+
/** Index in the multiple array; `undefined` for a single value. */
|
|
64
64
|
index: Number,
|
|
65
|
-
/**
|
|
65
|
+
/** Language key for multilingual bones, e.g. `"de"`. */
|
|
66
66
|
lang: String,
|
|
67
|
-
/** Bone
|
|
67
|
+
/** Bone structure (currently not actively used). */
|
|
68
68
|
bone: Object,
|
|
69
|
-
/**
|
|
69
|
+
/** Focuses the tel input element after 600 ms. */
|
|
70
70
|
autofocus: Boolean,
|
|
71
71
|
})
|
|
72
72
|
|
|
73
73
|
const emit = defineEmits([
|
|
74
74
|
/**
|
|
75
|
-
*
|
|
76
|
-
* @arg {string} name - Bone
|
|
77
|
-
* @arg {string} value -
|
|
78
|
-
* @arg {string|undefined} lang -
|
|
79
|
-
* @arg {number|undefined} index - Index
|
|
75
|
+
* Fired on every value change and on mount (initialization).
|
|
76
|
+
* @arg {string} name - Bone name
|
|
77
|
+
* @arg {string} value - Formatted international phone number
|
|
78
|
+
* @arg {string|undefined} lang - Language key
|
|
79
|
+
* @arg {number|undefined} index - Index in the multiple array
|
|
80
80
|
*/
|
|
81
81
|
"change",
|
|
82
82
|
])
|
|
@@ -30,44 +30,44 @@
|
|
|
30
30
|
<script setup>
|
|
31
31
|
import { reactive, onMounted, inject, computed } from "vue"
|
|
32
32
|
/**
|
|
33
|
-
*
|
|
33
|
+
* Multi-line free-text or JSON input field for raw data.
|
|
34
34
|
*
|
|
35
|
-
*
|
|
36
|
-
*
|
|
37
|
-
*
|
|
35
|
+
* Renders a `<wa-textarea>`. If `boneState.bonestructure.type === 'raw.json'`,
|
|
36
|
+
* the value is serialized via `JSON.stringify` for display. Supports
|
|
37
|
+
* multiple languages (`languages`) and multiple values (`multiple`).
|
|
38
38
|
*
|
|
39
39
|
* @displayName RawBone
|
|
40
40
|
*
|
|
41
|
-
* @cssClass bone-widget -
|
|
42
|
-
* @cssClass bone-widget-raw -
|
|
43
|
-
* @cssClass bone-widget-raw-default -
|
|
44
|
-
* @cssClass bone-widget-raw-{name} -
|
|
41
|
+
* @cssClass bone-widget - Base class of all bone widgets
|
|
42
|
+
* @cssClass bone-widget-raw - Identifies the bone type
|
|
43
|
+
* @cssClass bone-widget-raw-default - Default variant
|
|
44
|
+
* @cssClass bone-widget-raw-{name} - Dynamically set to the bone name, e.g. `bone-widget-raw-content`
|
|
45
45
|
*/
|
|
46
46
|
defineOptions({
|
|
47
47
|
inheritAttrs: false,
|
|
48
48
|
})
|
|
49
49
|
const props = defineProps({
|
|
50
|
-
/** Bone
|
|
50
|
+
/** Bone name – passed as the first argument in every `change` event. */
|
|
51
51
|
name: String,
|
|
52
|
-
/**
|
|
52
|
+
/** Current bone value. With `raw.json`, an object is displayed via `JSON.stringify`. */
|
|
53
53
|
value: [Object, String, Number, Boolean, Array],
|
|
54
|
-
/** Index
|
|
54
|
+
/** Index in the multiple array; `undefined` for a single value. */
|
|
55
55
|
index: Number,
|
|
56
|
-
/**
|
|
56
|
+
/** Language key for multilingual bones, e.g. `"de"`. */
|
|
57
57
|
lang: String,
|
|
58
|
-
/** Bone
|
|
58
|
+
/** Bone structure (currently not actively used). */
|
|
59
59
|
bone: Object,
|
|
60
|
-
/**
|
|
60
|
+
/** Focuses the textarea element after mount. */
|
|
61
61
|
autofocus: Boolean,
|
|
62
62
|
})
|
|
63
63
|
|
|
64
64
|
const emit = defineEmits([
|
|
65
65
|
/**
|
|
66
|
-
*
|
|
67
|
-
* @arg {string} name - Bone
|
|
68
|
-
* @arg {string} value -
|
|
69
|
-
* @arg {string|undefined} lang -
|
|
70
|
-
* @arg {number|undefined} index - Index
|
|
66
|
+
* Fired on every value change and on mount (initialization).
|
|
67
|
+
* @arg {string} name - Bone name
|
|
68
|
+
* @arg {string} value - Current input value
|
|
69
|
+
* @arg {string|undefined} lang - Language key
|
|
70
|
+
* @arg {number|undefined} index - Index in the multiple array
|
|
71
71
|
*/
|
|
72
72
|
"change",
|
|
73
73
|
])
|
|
@@ -14,12 +14,12 @@
|
|
|
14
14
|
import { reactive, onMounted, inject, computed, getCurrentInstance } from "vue"
|
|
15
15
|
import Wrapper_nested from "../BoneNestedWrapper.vue"
|
|
16
16
|
/**
|
|
17
|
-
* Record
|
|
17
|
+
* Record widget for bones of type `record`.
|
|
18
18
|
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
19
|
+
* Delegates all rendering to `Wrapper_nested`, which renders the sub-bones
|
|
20
|
+
* from `bone.using`. The record value is an object whose keys match the
|
|
21
|
+
* sub-bone names. With `multiple: true`, the value is an array
|
|
22
|
+
* of these objects.
|
|
23
23
|
*
|
|
24
24
|
* @displayName RecordBone
|
|
25
25
|
*/
|
|
@@ -29,26 +29,26 @@ defineOptions({
|
|
|
29
29
|
|
|
30
30
|
const emit = defineEmits([
|
|
31
31
|
/**
|
|
32
|
-
*
|
|
33
|
-
* @arg {string} name - Bone
|
|
34
|
-
* @arg {object} value -
|
|
35
|
-
* @arg {string|undefined} lang -
|
|
36
|
-
* @arg {number|undefined} index - Index
|
|
32
|
+
* Forwarded when `Wrapper_nested` changes a value, or on mount (initialization).
|
|
33
|
+
* @arg {string} name - Bone name
|
|
34
|
+
* @arg {object} value - Current record value (object with sub-bone values)
|
|
35
|
+
* @arg {string|undefined} lang - Language key
|
|
36
|
+
* @arg {number|undefined} index - Index in the multiple array
|
|
37
37
|
*/
|
|
38
38
|
"change",
|
|
39
39
|
])
|
|
40
40
|
const props = defineProps({
|
|
41
|
-
/** Bone
|
|
41
|
+
/** Bone name – passed as the first argument in every `change` event. */
|
|
42
42
|
name: String,
|
|
43
|
-
/**
|
|
43
|
+
/** Current record value; object with sub-bone values, or an array of them with `multiple`. */
|
|
44
44
|
value: null,
|
|
45
|
-
/** Index
|
|
45
|
+
/** Index in the multiple array; `undefined` for a single value. */
|
|
46
46
|
index: Number,
|
|
47
|
-
/**
|
|
47
|
+
/** Language key for multilingual bones, e.g. `"de"`. */
|
|
48
48
|
lang: String,
|
|
49
|
-
/** Bone
|
|
49
|
+
/** Bone structure; `using` contains the sub-bone definitions. */
|
|
50
50
|
bone: Object,
|
|
51
|
-
/**
|
|
51
|
+
/** Currently not used. */
|
|
52
52
|
autofocus: Boolean,
|
|
53
53
|
})
|
|
54
54
|
|