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
package/src/forms/bones/utils.js
CHANGED
|
@@ -12,9 +12,8 @@ export default class Utils {
|
|
|
12
12
|
}
|
|
13
13
|
|
|
14
14
|
static stripHtml(html) {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
return div.textContent || div.innerText || ""
|
|
15
|
+
// DOMParser builds an inert document: no scripts or event handlers run (unlike innerHTML)
|
|
16
|
+
return new DOMParser().parseFromString(String(html ?? ""), "text/html").body.textContent || ""
|
|
18
17
|
}
|
|
19
18
|
|
|
20
19
|
static unescape(value) {
|
|
@@ -93,10 +92,10 @@ export default class Utils {
|
|
|
93
92
|
let finalstr = formatstr
|
|
94
93
|
for (let pathstr of pathlist) {
|
|
95
94
|
let aval = readValue(pathstr, avalue)
|
|
96
|
-
//
|
|
97
|
-
//
|
|
98
|
-
//
|
|
99
|
-
//
|
|
95
|
+
// Numbers and booleans belong in the text too: previously
|
|
96
|
+
// EVERY non-string was replaced by the fallback, so `$(dest.kdnr)` with 42
|
|
97
|
+
// disappeared. Empty values, objects and the placeholder "-" remain the
|
|
98
|
+
// fallback.
|
|
100
99
|
if (aval === null || aval === undefined || aval === "-" || typeof aval === "object") {
|
|
101
100
|
aval = fallback
|
|
102
101
|
} else {
|
|
@@ -110,20 +109,20 @@ export default class Utils {
|
|
|
110
109
|
return finalStrList.join(", ")
|
|
111
110
|
}
|
|
112
111
|
|
|
113
|
-
// ── ViUR
|
|
112
|
+
// ── ViUR values as text ───────────────────────────────────────────────
|
|
114
113
|
//
|
|
115
|
-
//
|
|
116
|
-
//
|
|
117
|
-
//
|
|
118
|
-
//
|
|
119
|
-
//
|
|
114
|
+
// ONE place that turns every bone value into a string — for
|
|
115
|
+
// tables, detail views, export. Because a bone value is rarely a
|
|
116
|
+
// scalar: multilingual bones are one object per language, `multiple` a
|
|
117
|
+
// list, relational bones carry `{dest, rel}` and their own
|
|
118
|
+
// format string, `text` contains HTML.
|
|
120
119
|
|
|
121
|
-
/**
|
|
120
|
+
/** Type family of a bone: "str.email" → "str". */
|
|
122
121
|
static boneFamily(type) {
|
|
123
122
|
return String(type ?? "").split(".")[0]
|
|
124
123
|
}
|
|
125
124
|
|
|
126
|
-
/** select
|
|
125
|
+
/** select value → label. Accepts object AND pair notation. */
|
|
127
126
|
static optionLabel(bone, value) {
|
|
128
127
|
const values = bone?.["values"]
|
|
129
128
|
if (Array.isArray(values)) {
|
|
@@ -137,7 +136,7 @@ export default class Utils {
|
|
|
137
136
|
return String(value)
|
|
138
137
|
}
|
|
139
138
|
|
|
140
|
-
/**
|
|
139
|
+
/** A SINGLE value (without languages/multiple — boneToString handles that). */
|
|
141
140
|
static singleValueToString(value, bone = {}, options = {}) {
|
|
142
141
|
if (value === null || value === undefined || value === "") return ""
|
|
143
142
|
switch (Utils.boneFamily(bone["type"])) {
|
|
@@ -159,7 +158,7 @@ export default class Utils {
|
|
|
159
158
|
case "date": {
|
|
160
159
|
const parsed = new Date(String(value))
|
|
161
160
|
if (Number.isNaN(parsed.getTime())) return String(value)
|
|
162
|
-
// ViUR
|
|
161
|
+
// ViUR sets the flags `date`/`time` (both on by default).
|
|
163
162
|
const wantsDate = bone["date"] !== false
|
|
164
163
|
const wantsTime = bone["time"] !== false
|
|
165
164
|
const format = {}
|
|
@@ -169,15 +168,15 @@ export default class Utils {
|
|
|
169
168
|
}
|
|
170
169
|
case "relational":
|
|
171
170
|
case "record": {
|
|
172
|
-
//
|
|
171
|
+
// Relational bones bring their own format string ("$(dest.name)").
|
|
173
172
|
const formatstr = bone["format"] ?? bone["params"]?.["format"] ?? "$(dest.name)"
|
|
174
173
|
const text = Utils.formatString(formatstr, value, "")
|
|
175
174
|
if (text && text !== "-") return Utils.stripHtml(String(text))
|
|
176
|
-
//
|
|
175
|
+
// Without a format, the key is better than nothing.
|
|
177
176
|
return String(value?.["dest"]?.["key"] ?? value?.["key"] ?? "")
|
|
178
177
|
}
|
|
179
178
|
case "text":
|
|
180
|
-
//
|
|
179
|
+
// Text bones contain HTML — that's disruptive in a cell.
|
|
181
180
|
return Utils.stripHtml(String(value))
|
|
182
181
|
case "raw":
|
|
183
182
|
return typeof value === "object" ? JSON.stringify(value) : String(value)
|
|
@@ -186,7 +185,7 @@ export default class Utils {
|
|
|
186
185
|
}
|
|
187
186
|
}
|
|
188
187
|
|
|
189
|
-
/**
|
|
188
|
+
/** A value WITHOUT language dimension (multiple lists included) as text. */
|
|
190
189
|
static monolingualToString(value, bone = {}, options = {}) {
|
|
191
190
|
if (bone["multiple"]) {
|
|
192
191
|
const list = Array.isArray(value) ? value : value === null || value === undefined ? [] : [value]
|
|
@@ -196,10 +195,10 @@ export default class Utils {
|
|
|
196
195
|
}
|
|
197
196
|
|
|
198
197
|
/**
|
|
199
|
-
*
|
|
200
|
-
*
|
|
201
|
-
* en→US, ja→JP) →
|
|
202
|
-
*
|
|
198
|
+
* Flag of a language — maintenance-free via the browser's CLDR data:
|
|
199
|
+
* language code → most likely region (`Intl.Locale.maximize`, de→DE,
|
|
200
|
+
* en→US, ja→JP) → regional indicator emoji. `null` if no region
|
|
201
|
+
* can be determined.
|
|
203
202
|
*/
|
|
204
203
|
static languageFlag(code) {
|
|
205
204
|
try {
|
|
@@ -211,28 +210,28 @@ export default class Utils {
|
|
|
211
210
|
}
|
|
212
211
|
}
|
|
213
212
|
|
|
214
|
-
/**
|
|
213
|
+
/** Prefix that assigns a value to its language: flag, otherwise code. */
|
|
215
214
|
static languageTag(code) {
|
|
216
215
|
return Utils.languageFlag(code) ?? `${code}:`
|
|
217
216
|
}
|
|
218
217
|
|
|
219
218
|
/**
|
|
220
|
-
* Bone
|
|
219
|
+
* Bone value of an entry as text.
|
|
221
220
|
*
|
|
222
|
-
*
|
|
223
|
-
* - `"*"` —
|
|
224
|
-
*
|
|
225
|
-
* `options.primaryLanguage`
|
|
226
|
-
*
|
|
227
|
-
* -
|
|
228
|
-
*
|
|
229
|
-
*
|
|
230
|
-
*
|
|
231
|
-
* -
|
|
232
|
-
*
|
|
221
|
+
* Multilingual bones (`bone.languages`) are controlled by `options.language`:
|
|
222
|
+
* - `"*"` — ALL filled languages, each with a flag prefix (`🇩🇪 value`),
|
|
223
|
+
* joined with `languageSeparator` (default `", "`).
|
|
224
|
+
* `options.primaryLanguage` comes first, the others follow in the
|
|
225
|
+
* bone's order.
|
|
226
|
+
* - language code — the value of that language. If it's empty, the display falls back
|
|
227
|
+
* to the first filled language and marks that with its flag —
|
|
228
|
+
* an empty cell would otherwise hide that the entry does have content
|
|
229
|
+
* in another language.
|
|
230
|
+
* - not set — the bone's first language, without prefix (stable
|
|
231
|
+
* behavior for format strings and other existing users).
|
|
233
232
|
*
|
|
234
|
-
* @param {*} value
|
|
235
|
-
* @param {object} bone
|
|
233
|
+
* @param {*} value value from the skel
|
|
234
|
+
* @param {object} bone bone description from the `structure`
|
|
236
235
|
* @param {{ language?: string, primaryLanguage?: string, locale?: string, boolTexts?: [string, string], separator?: string, languageSeparator?: string }} [options]
|
|
237
236
|
*/
|
|
238
237
|
static boneToString(value, bone = {}, options = {}) {
|
|
@@ -254,7 +253,7 @@ export default class Utils {
|
|
|
254
253
|
lang = languages.find((other) => !isEmpty(value[other])) ?? lang
|
|
255
254
|
}
|
|
256
255
|
const text = Utils.monolingualToString(value[lang], bone, options)
|
|
257
|
-
//
|
|
256
|
+
// Prefix only if a SPECIFIC language was requested and a different one came.
|
|
258
257
|
return options.language && options.language !== lang && !isEmpty(value[lang])
|
|
259
258
|
? `${Utils.languageTag(lang)} ${text}`
|
|
260
259
|
: text
|
|
@@ -12,44 +12,44 @@
|
|
|
12
12
|
<script setup>
|
|
13
13
|
import { reactive, onMounted, inject, computed } from "vue"
|
|
14
14
|
/**
|
|
15
|
-
*
|
|
15
|
+
* Switch for boolean values (true/false).
|
|
16
16
|
*
|
|
17
|
-
*
|
|
18
|
-
* `bool.select` (
|
|
19
|
-
*
|
|
17
|
+
* Available in three variants: `bool` (switch), `bool.choose` (yes/no buttons),
|
|
18
|
+
* `bool.select` (dropdown). The values `null`, `undefined`, `false` and `""` are
|
|
19
|
+
* uniformly treated as `false`.
|
|
20
20
|
*
|
|
21
21
|
* @displayName BooleanBone
|
|
22
22
|
*
|
|
23
|
-
* @cssClass bone-widget -
|
|
24
|
-
* @cssClass bone-widget-boolean -
|
|
25
|
-
* @cssClass bone-widget-boolean-default -
|
|
26
|
-
* @cssClass bone-widget-boolean-{name} -
|
|
23
|
+
* @cssClass bone-widget - Base class of all bone widgets
|
|
24
|
+
* @cssClass bone-widget-boolean - Identifies the bone type
|
|
25
|
+
* @cssClass bone-widget-boolean-default - Default variant
|
|
26
|
+
* @cssClass bone-widget-boolean-{name} - Dynamically set to the bone name
|
|
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 bone value. `null`, `undefined`, `false` and `""` count as `false`. */
|
|
35
35
|
value: [Object, String, Number, Boolean, Array],
|
|
36
|
-
/** Index
|
|
36
|
+
/** Index in the multiple array; `undefined` for a single value. */
|
|
37
37
|
index: Number,
|
|
38
|
-
/**
|
|
38
|
+
/** Language key for multilingual bones, e.g. `"de"`. */
|
|
39
39
|
lang: String,
|
|
40
|
-
/** Bone
|
|
40
|
+
/** Bone structure (currently not actively used). */
|
|
41
41
|
bone: Object,
|
|
42
|
-
/** Autofocus (
|
|
42
|
+
/** Autofocus (currently not actively used). */
|
|
43
43
|
autofocus: Boolean,
|
|
44
44
|
})
|
|
45
45
|
|
|
46
46
|
const emit = defineEmits([
|
|
47
47
|
/**
|
|
48
|
-
*
|
|
49
|
-
* @arg {string} name - Bone
|
|
50
|
-
* @arg {boolean} value -
|
|
51
|
-
* @arg {string|undefined} lang -
|
|
52
|
-
* @arg {number|undefined} index - Index
|
|
48
|
+
* Fired on every value change and on mount (initialization).
|
|
49
|
+
* @arg {string} name - Bone name
|
|
50
|
+
* @arg {boolean} value - Current value
|
|
51
|
+
* @arg {string|undefined} lang - Language key
|
|
52
|
+
* @arg {number|undefined} index - Index in the multiple array
|
|
53
53
|
*/
|
|
54
54
|
"change",
|
|
55
55
|
])
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<!-- readonly
|
|
3
|
-
|
|
2
|
+
<!-- readonly on the group: wa-radio-group only marks radios that are not
|
|
3
|
+
disabled themselves — otherwise no selection would be visible when readonly -->
|
|
4
4
|
<wa-radio-group
|
|
5
5
|
:value="state.value"
|
|
6
6
|
:disabled="boneState.readonly"
|
|
@@ -8,9 +8,9 @@
|
|
|
8
8
|
:data-user-invalid="boneState.errorMessages.length === 0 ? undefined : true"
|
|
9
9
|
@change="changeEvent"
|
|
10
10
|
>
|
|
11
|
-
<!-- String
|
|
12
|
-
|
|
13
|
-
|
|
11
|
+
<!-- String values: wa-select matches its value against the option values
|
|
12
|
+
when it is set; booleans only become strings later, so the
|
|
13
|
+
stored value would not appear -->
|
|
14
14
|
<wa-option
|
|
15
15
|
v-for="val in ['true', 'false']"
|
|
16
16
|
:key="val"
|
|
@@ -39,21 +39,21 @@ import { EditorState } from "@codemirror/state"
|
|
|
39
39
|
import { languages } from "@codemirror/language-data"
|
|
40
40
|
|
|
41
41
|
/**
|
|
42
|
-
* Code
|
|
42
|
+
* Code editor based on CodeMirror for syntax-highlighted source code input.
|
|
43
43
|
*
|
|
44
|
-
*
|
|
45
|
-
* (
|
|
46
|
-
*
|
|
47
|
-
*
|
|
48
|
-
*
|
|
44
|
+
* Detects the programming language from `boneState.bonestructure.type`
|
|
45
|
+
* (e.g. `raw.code.python`, `raw.code.html`, `raw.code.javascript`) and dynamically
|
|
46
|
+
* loads the matching CodeMirror language plugin. Supports
|
|
47
|
+
* multiple values (`multiple`). An expand button allows expanding
|
|
48
|
+
* to full height.
|
|
49
49
|
*
|
|
50
50
|
* @displayName CodeBone
|
|
51
51
|
*
|
|
52
|
-
* @cssClass bone-widget -
|
|
53
|
-
* @cssClass bone-widget-raw -
|
|
54
|
-
* @cssClass bone-widget-raw-default -
|
|
55
|
-
* @cssClass bone-widget-wrapper -
|
|
56
|
-
* @cssClass is-max-size -
|
|
52
|
+
* @cssClass bone-widget - Base class of all bone widgets
|
|
53
|
+
* @cssClass bone-widget-raw - Identifies the parent bone type
|
|
54
|
+
* @cssClass bone-widget-raw-default - Default variant
|
|
55
|
+
* @cssClass bone-widget-wrapper - Wraps the editor and the expand button
|
|
56
|
+
* @cssClass is-max-size - Toggled via the expand button; removes the maximum height
|
|
57
57
|
*/
|
|
58
58
|
defineOptions({
|
|
59
59
|
inheritAttrs: false,
|
|
@@ -63,27 +63,27 @@ const element = ref(null)
|
|
|
63
63
|
const view = ref(null)
|
|
64
64
|
|
|
65
65
|
const props = defineProps({
|
|
66
|
-
/** Bone
|
|
66
|
+
/** Bone name – passed as the first argument in every `change` event. */
|
|
67
67
|
name: String,
|
|
68
|
-
/**
|
|
68
|
+
/** Current bone value (source code as a string). */
|
|
69
69
|
value: [Object, String, Number, Boolean, Array],
|
|
70
|
-
/** Index
|
|
70
|
+
/** Index in the multiple array; `undefined` for a single value. */
|
|
71
71
|
index: Number,
|
|
72
|
-
/**
|
|
72
|
+
/** Language key for multilingual bones (CodeBone does not support multilang). */
|
|
73
73
|
lang: String,
|
|
74
|
-
/** Bone
|
|
74
|
+
/** Bone structure (currently not actively used). */
|
|
75
75
|
bone: Object,
|
|
76
|
-
/**
|
|
76
|
+
/** Focuses the CodeMirror editor after mount. */
|
|
77
77
|
autofocus: Boolean,
|
|
78
78
|
})
|
|
79
79
|
|
|
80
80
|
const emit = defineEmits([
|
|
81
81
|
/**
|
|
82
|
-
*
|
|
83
|
-
* @arg {string} name - Bone
|
|
84
|
-
* @arg {string} value -
|
|
85
|
-
* @arg {string|undefined} lang -
|
|
86
|
-
* @arg {number|undefined} index - Index
|
|
82
|
+
* Fired on every value change and on mount (initialization).
|
|
83
|
+
* @arg {string} name - Bone name
|
|
84
|
+
* @arg {string} value - Current source code
|
|
85
|
+
* @arg {string|undefined} lang - Language key
|
|
86
|
+
* @arg {number|undefined} index - Index in the multiple array
|
|
87
87
|
*/
|
|
88
88
|
"change",
|
|
89
89
|
])
|
|
@@ -22,43 +22,43 @@
|
|
|
22
22
|
<script setup>
|
|
23
23
|
import { reactive, onMounted, inject } from "vue"
|
|
24
24
|
/**
|
|
25
|
-
*
|
|
25
|
+
* Color picker field using a native `<wa-color-picker>` element.
|
|
26
26
|
*
|
|
27
|
-
*
|
|
28
|
-
*
|
|
27
|
+
* Stores the selected color value as a hex string, e.g. `"#e74c3c"`.
|
|
28
|
+
* Supports multiple values (`multiple`), but not multiple languages.
|
|
29
29
|
*
|
|
30
30
|
* @displayName ColorBone
|
|
31
31
|
*
|
|
32
|
-
* @cssClass bone-widget -
|
|
33
|
-
* @cssClass bone-widget-color -
|
|
34
|
-
* @cssClass bone-widget-color-default -
|
|
35
|
-
* @cssClass bone-widget-color-{name} -
|
|
32
|
+
* @cssClass bone-widget - Base class of all bone widgets
|
|
33
|
+
* @cssClass bone-widget-color - Identifies the bone type
|
|
34
|
+
* @cssClass bone-widget-color-default - Default variant
|
|
35
|
+
* @cssClass bone-widget-color-{name} - Dynamically set to the bone name, e.g. `bone-widget-color-color`
|
|
36
36
|
*/
|
|
37
37
|
defineOptions({
|
|
38
38
|
inheritAttrs: false,
|
|
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 bone value as a hex string, e.g. `"#e74c3c"`, or `null`. */
|
|
44
44
|
value: [Object, String, Number, Boolean, Array],
|
|
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 (currently not actively used). */
|
|
50
50
|
bone: Object,
|
|
51
|
-
/**
|
|
51
|
+
/** Focuses the input element after 600 ms. */
|
|
52
52
|
autofocus: Boolean,
|
|
53
53
|
})
|
|
54
54
|
|
|
55
55
|
const emit = defineEmits([
|
|
56
56
|
/**
|
|
57
|
-
*
|
|
58
|
-
* @arg {string} name - Bone
|
|
59
|
-
* @arg {string|null} value -
|
|
60
|
-
* @arg {string|undefined} lang -
|
|
61
|
-
* @arg {number|undefined} index - Index
|
|
57
|
+
* Fired on every value change and on mount (initialization).
|
|
58
|
+
* @arg {string} name - Bone name
|
|
59
|
+
* @arg {string|null} value - Selected color value as a hex string or `null`
|
|
60
|
+
* @arg {string|undefined} lang - Language key
|
|
61
|
+
* @arg {number|undefined} index - Index in the multiple array
|
|
62
62
|
*/
|
|
63
63
|
"change",
|
|
64
64
|
])
|
|
@@ -19,48 +19,48 @@
|
|
|
19
19
|
<script setup>
|
|
20
20
|
import { reactive, onMounted, computed, inject } from "vue"
|
|
21
21
|
/**
|
|
22
|
-
*
|
|
22
|
+
* Date and/or time field, controlled by `bonestructure.date` and `bonestructure.time`.
|
|
23
23
|
*
|
|
24
|
-
*
|
|
25
|
-
* - `date`
|
|
26
|
-
* - `time`
|
|
27
|
-
* - `datetime-local`
|
|
24
|
+
* Renders a `<wa-input>` with the matching `type` attribute:
|
|
25
|
+
* - `date` if only `date: true`
|
|
26
|
+
* - `time` if only `time: true`
|
|
27
|
+
* - `datetime-local` if both are set
|
|
28
28
|
*
|
|
29
|
-
*
|
|
30
|
-
*
|
|
29
|
+
* Strips timezone data from the value before it is passed to the input.
|
|
30
|
+
* Supports multiple values (`multiple`), but not multiple languages.
|
|
31
31
|
*
|
|
32
32
|
* @displayName DateBone
|
|
33
33
|
*
|
|
34
|
-
* @cssClass bone-widget -
|
|
35
|
-
* @cssClass bone-widget-date -
|
|
36
|
-
* @cssClass bone-widget-date-default -
|
|
37
|
-
* @cssClass bone-widget-date-{name} -
|
|
34
|
+
* @cssClass bone-widget - Base class of all bone widgets
|
|
35
|
+
* @cssClass bone-widget-date - Identifies the bone type
|
|
36
|
+
* @cssClass bone-widget-date-default - Default variant
|
|
37
|
+
* @cssClass bone-widget-date-{name} - Dynamically set to the bone name, e.g. `bone-widget-date-publishedAt`
|
|
38
38
|
*/
|
|
39
39
|
defineOptions({
|
|
40
40
|
inheritAttrs: false,
|
|
41
41
|
})
|
|
42
42
|
const props = defineProps({
|
|
43
|
-
/** Bone
|
|
43
|
+
/** Bone name – passed as the first argument in every `change` event. */
|
|
44
44
|
name: String,
|
|
45
|
-
/**
|
|
45
|
+
/** Current bone value as an ISO string, e.g. `"2026-03-28"` or `"10:30:00"`. */
|
|
46
46
|
value: [Object, String, Number, Boolean, Array],
|
|
47
|
-
/** Index
|
|
47
|
+
/** Index in the multiple array; `undefined` for a single value. */
|
|
48
48
|
index: Number,
|
|
49
|
-
/**
|
|
49
|
+
/** Language key for multilingual bones, e.g. `"de"`. */
|
|
50
50
|
lang: String,
|
|
51
|
-
/** Bone
|
|
51
|
+
/** Bone structure (currently not actively used). */
|
|
52
52
|
bone: Object,
|
|
53
|
-
/**
|
|
53
|
+
/** Focuses the input element after 600 ms. */
|
|
54
54
|
autofocus: Boolean,
|
|
55
55
|
})
|
|
56
56
|
|
|
57
57
|
const emit = defineEmits([
|
|
58
58
|
/**
|
|
59
|
-
*
|
|
60
|
-
* @arg {string} name - Bone
|
|
61
|
-
* @arg {string} value -
|
|
62
|
-
* @arg {string|undefined} lang -
|
|
63
|
-
* @arg {number|undefined} index - Index
|
|
59
|
+
* Fired on every value change and on mount (initialization).
|
|
60
|
+
* @arg {string} name - Bone name
|
|
61
|
+
* @arg {string} value - Current input value as an ISO string
|
|
62
|
+
* @arg {string|undefined} lang - Language key
|
|
63
|
+
* @arg {number|undefined} index - Index in the multiple array
|
|
64
64
|
*/
|
|
65
65
|
"change",
|
|
66
66
|
])
|
|
@@ -21,45 +21,45 @@
|
|
|
21
21
|
import { reactive, onMounted, inject, ref, watchEffect, computed } from "vue"
|
|
22
22
|
import { useTimeoutFn } from "@vueuse/core"
|
|
23
23
|
/**
|
|
24
|
-
*
|
|
24
|
+
* Single-line email input field with native browser validation.
|
|
25
25
|
*
|
|
26
|
-
*
|
|
27
|
-
* Validation API
|
|
28
|
-
* `boneState.label === "placeholder"
|
|
29
|
-
*
|
|
26
|
+
* Renders a `<wa-input type="email">` and uses the browser's native Constraint
|
|
27
|
+
* Validation API for format checking. With
|
|
28
|
+
* `boneState.label === "placeholder"`, the bone description is shown as a
|
|
29
|
+
* placeholder instead of as a label above.
|
|
30
30
|
*
|
|
31
31
|
* @displayName EmailBone
|
|
32
32
|
*
|
|
33
|
-
* @cssClass bone-widget -
|
|
34
|
-
* @cssClass bone-widget-email -
|
|
35
|
-
* @cssClass bone-widget-email-default -
|
|
36
|
-
* @cssClass bone-widget-email-{name} -
|
|
33
|
+
* @cssClass bone-widget - Base class of all bone widgets
|
|
34
|
+
* @cssClass bone-widget-email - Identifies the bone type
|
|
35
|
+
* @cssClass bone-widget-email-default - Default variant
|
|
36
|
+
* @cssClass bone-widget-email-{name} - Dynamically set to the bone name, e.g. `bone-widget-email-email`
|
|
37
37
|
*/
|
|
38
38
|
defineOptions({
|
|
39
39
|
inheritAttrs: false,
|
|
40
40
|
})
|
|
41
41
|
const props = defineProps({
|
|
42
|
-
/** Bone
|
|
42
|
+
/** Bone name – passed as the first argument in every `change` event. */
|
|
43
43
|
name: String,
|
|
44
|
-
/**
|
|
44
|
+
/** Current bone value. */
|
|
45
45
|
value: [Object, String, Number, Boolean, Array],
|
|
46
|
-
/** Index
|
|
46
|
+
/** Index in the multiple array; `undefined` for a single value. */
|
|
47
47
|
index: Number,
|
|
48
|
-
/**
|
|
48
|
+
/** Language key for multilingual bones, e.g. `"de"`. */
|
|
49
49
|
lang: String,
|
|
50
|
-
/** Bone
|
|
50
|
+
/** Bone structure (currently not actively used). */
|
|
51
51
|
bone: Object,
|
|
52
|
-
/**
|
|
52
|
+
/** Focuses the input element after 600 ms. */
|
|
53
53
|
autofocus: Boolean,
|
|
54
54
|
})
|
|
55
55
|
|
|
56
56
|
const emit = defineEmits([
|
|
57
57
|
/**
|
|
58
|
-
*
|
|
59
|
-
* @arg {string} name - Bone
|
|
60
|
-
* @arg {string} value -
|
|
61
|
-
* @arg {string|undefined} lang -
|
|
62
|
-
* @arg {number|undefined} index - Index
|
|
58
|
+
* Fired on every value change and on mount (initialization).
|
|
59
|
+
* @arg {string} name - Bone name
|
|
60
|
+
* @arg {string} value - Current input value
|
|
61
|
+
* @arg {string|undefined} lang - Language key
|
|
62
|
+
* @arg {number|undefined} index - Index in the multiple array
|
|
63
63
|
*/
|
|
64
64
|
"change",
|
|
65
65
|
])
|