waibu-mpa 2.13.0 → 2.13.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.
- package/extend/bajo/intl/en-US.json +1 -0
- package/extend/bajo/intl/id.json +1 -0
- package/index.js +1 -1
- package/lib/class/component.js +7 -3
- package/package.json +1 -1
- package/wiki/CHANGES.md +4 -0
package/extend/bajo/intl/id.json
CHANGED
package/index.js
CHANGED
|
@@ -581,7 +581,7 @@ async function factory (pkgName) {
|
|
|
581
581
|
v = v.join(kvDelimiter)
|
|
582
582
|
if (trimValue) v = v.slice(1, v.length - 1)
|
|
583
583
|
if (v === 'undefined') continue
|
|
584
|
-
if (k !== 'content' && v === '') v = true
|
|
584
|
+
if (k !== 'content' && (v === '' || v === 'true')) v = true
|
|
585
585
|
// check for retainAttrKey on ALL plugins
|
|
586
586
|
let retain = false
|
|
587
587
|
for (const name of names) {
|
package/lib/class/component.js
CHANGED
|
@@ -207,7 +207,7 @@ async function componentFactory () {
|
|
|
207
207
|
* @returns {string} The generated `<option>` elements.
|
|
208
208
|
*/
|
|
209
209
|
buildOptions = async (params) => {
|
|
210
|
-
const { isString, has, omit, find, isPlainObject, isArray, pick, camelCase, get } = this.app.lib._
|
|
210
|
+
const { isString, has, omit, find, isPlainObject, isArray, pick, camelCase, get, isEmpty } = this.app.lib._
|
|
211
211
|
const { attrToArray } = this.app.waibu
|
|
212
212
|
const { getMethod, callHandler } = this.app.bajo
|
|
213
213
|
let prop = {}
|
|
@@ -217,7 +217,10 @@ async function componentFactory () {
|
|
|
217
217
|
const items = []
|
|
218
218
|
let input = params.attr.options
|
|
219
219
|
let values = attrToArray(params.attr.value)
|
|
220
|
-
if (!has(params.attr, 'multiple')
|
|
220
|
+
if (!has(params.attr, 'multiple')) {
|
|
221
|
+
if (values.length > 0) values = [values[0]]
|
|
222
|
+
else if (prop.default) values = [prop.default]
|
|
223
|
+
}
|
|
221
224
|
let options = []
|
|
222
225
|
if (isString(input)) {
|
|
223
226
|
if (getMethod(input, false)) {
|
|
@@ -240,10 +243,11 @@ async function componentFactory () {
|
|
|
240
243
|
return { value: item, text: (item + '') }
|
|
241
244
|
})
|
|
242
245
|
}
|
|
246
|
+
if (!isEmpty(prop) && !prop.required) options.unshift({ value: '', text: '_blank_' })
|
|
243
247
|
for (const opt of options) {
|
|
244
248
|
const sel = find(values, v => opt.value === v)
|
|
245
249
|
const ttext = camelCase(`${prop.name} ${opt.text}`)
|
|
246
|
-
items.push(`<option value="${opt.value}"${sel ? ' selected' : ''}>${this.req.te(ttext) ? this.req.t(ttext) : (opt.text
|
|
250
|
+
items.push(`<option value="${opt.value}"${sel ? ' selected' : ''}>${this.req.te(ttext) ? this.req.t(ttext) : this.req.t(opt.text)}</option>`)
|
|
247
251
|
}
|
|
248
252
|
params.attr = omit(params.attr, ['options'])
|
|
249
253
|
return items.join('\n')
|
package/package.json
CHANGED
package/wiki/CHANGES.md
CHANGED