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.
@@ -37,6 +37,7 @@
37
37
  "404Title": "Page Not Found",
38
38
  "500Title": "Internal Server Error",
39
39
  "fullscreen": "Fullscreen",
40
+ "_blank_": "",
40
41
  "field": {
41
42
  "session": "Session",
42
43
  "expires": "Expires"
@@ -38,6 +38,7 @@
38
38
  "404Title": "Halaman Tidak Ditemukan",
39
39
  "500Title": "Kesalahan Internal Penyelia",
40
40
  "fullscreen": "Layar Penuh",
41
+ "_blank_": "",
41
42
  "field": {
42
43
  "session": "Sesi",
43
44
  "expires": "Kadaluarsa"
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) {
@@ -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') && values.length > 0) values = [values[0]]
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 ?? opt.value)}</option>`)
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "waibu-mpa",
3
- "version": "2.13.0",
3
+ "version": "2.13.1",
4
4
  "description": "MPA support for Waibu Framework",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/wiki/CHANGES.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Changes
2
2
 
3
+ ## 2026-04-07
4
+
5
+ - [2.13.0] Bug fix in ```component.buildOptions()```
6
+
3
7
  ## 2026-04-02
4
8
 
5
9
  - [2.13.0] Changes in widget's static ```css```, ```scripts``` etc, now can be a function that callable with scope to its component