waibu-bootstrap 2.8.0 → 2.8.1
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.
|
@@ -5,7 +5,6 @@ async function formPlaintext () {
|
|
|
5
5
|
return class FormPlaintext extends this.app.baseClass.MpaWidget {
|
|
6
6
|
build = async () => {
|
|
7
7
|
const { isEmpty, get } = this.app.lib._
|
|
8
|
-
const { req } = this.component
|
|
9
8
|
const { escape } = this.app.waibu
|
|
10
9
|
this.params.attr.disabled = true
|
|
11
10
|
const { name } = this.params.attr
|
|
@@ -17,8 +16,8 @@ async function formPlaintext () {
|
|
|
17
16
|
const format = get(this.schema, `view.format.${name}`)
|
|
18
17
|
const labelField = get(this.schema, `view.widget.${name}.attr.labelField`)
|
|
19
18
|
if (prop.ref) {
|
|
20
|
-
|
|
21
|
-
if (format && !isEmpty(
|
|
19
|
+
const newValue = this.getRefValue({ field: name, labelField, refName: this.getRefName(name) })
|
|
20
|
+
if (format && !isEmpty(newValue)) this.params.attr.href = await format.call(this, newValue, this.formData, { linkOnly: true })
|
|
22
21
|
} else if (format && !isEmpty(value)) value = await format.call(this, value, this.formData)
|
|
23
22
|
this.params.attr.dataValue = escape(dataValue)
|
|
24
23
|
this.params.attr.value = escape(value)
|
|
@@ -21,7 +21,7 @@ async function formSelectExt () {
|
|
|
21
21
|
const { req } = this.component
|
|
22
22
|
let apiKey = ''
|
|
23
23
|
if (req.user && this.app.sumba) apiKey = await this.app.sumba.getApiKeyFromUserId(req.user.id)
|
|
24
|
-
const xref = this.params.attr['x-ref'] ??
|
|
24
|
+
const xref = this.params.attr['x-ref'] ?? this.params.attr.name
|
|
25
25
|
this.params.attr.id = this.params.attr.id ?? generateId('alpha')
|
|
26
26
|
this.params.attr['x-ref'] = xref
|
|
27
27
|
const xData = ['instance: null', 'value: null']
|
|
@@ -31,14 +31,6 @@ async function formSelectExt () {
|
|
|
31
31
|
if (this.params.attr.clearBtn) plugins.push('clear_button')
|
|
32
32
|
if (this.params.attr.optgroupColumns) plugins.push('optgroup_columns')
|
|
33
33
|
if (this.params.attr.noCaret) this.params.attr.class.push('no-caret') // TODO: no caret remove caret on ALL instances, need to make it instance specific
|
|
34
|
-
let options = []
|
|
35
|
-
if (this.params.attr.options) {
|
|
36
|
-
try {
|
|
37
|
-
options = base64JsonDecode(this.params.attr.options)
|
|
38
|
-
} catch (err) {
|
|
39
|
-
options = this.params.attr.options
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
34
|
let opts = { plugins }
|
|
43
35
|
let cOpts = {}
|
|
44
36
|
if (this.params.attr.cOpts) {
|
|
@@ -138,9 +130,17 @@ async function formSelectExt () {
|
|
|
138
130
|
this.params.attr['x-data'] = `{ ${xData.join(',\n')} }`
|
|
139
131
|
// this.params.attr['@load.window'] = 'onLoad()'
|
|
140
132
|
this.params.attr['x-init'] = 'onLoad()'
|
|
133
|
+
await build.call(this, buildFormSelect, this.params)
|
|
134
|
+
let options = []
|
|
135
|
+
if (this.params.attr.options) {
|
|
136
|
+
try {
|
|
137
|
+
options = base64JsonDecode(this.params.attr.options)
|
|
138
|
+
} catch (err) {
|
|
139
|
+
options = this.params.attr.options
|
|
140
|
+
}
|
|
141
|
+
}
|
|
141
142
|
if (options.length > 0) this.params.attr.options = options
|
|
142
143
|
this.params.attr = omit(this.params.attr, ['noDropdownInput', 'removeBtn', 'clearBtn', 'c-opts', 'remoteUrl', 'remoteSearchField', 'remoteLabelField', 'remoteValueField', 'remoteQuery', 'remoteApiKey'])
|
|
143
|
-
await build.call(this, buildFormSelect, this.params)
|
|
144
144
|
}
|
|
145
145
|
}
|
|
146
146
|
}
|