waibu-mpa 2.14.0 → 2.14.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.
@@ -303,14 +303,14 @@ async function componentFactory () {
303
303
  * @param {string} tag - The tag name.
304
304
  * @param {Object} params - The parameters for the tag.
305
305
  */
306
- beforeBuildTag = (tag, params) => {}
306
+ beforeBuildTag = async (tag, params) => {}
307
307
 
308
308
  /**
309
309
  * Hook executed after building a tag.
310
310
  * @param {string} tag - The tag name.
311
311
  * @param {Object} params - The parameters for the tag.
312
312
  */
313
- afterBuildTag = (tag, params) => {}
313
+ afterBuildTag = async (tag, params) => {}
314
314
 
315
315
  /**
316
316
  * Builds a child tag based on a detector attribute.
@@ -108,8 +108,8 @@ async function widgetFactory () {
108
108
  const { get, find } = this.app.lib._
109
109
  const prop = find(this.schema.properties ?? [], p => p.name === field)
110
110
  if (!prop) return {}
111
- if (!refName && field.endsWith('Id')) refName = field.slice(0, -2)
112
- const key = this.params.attr.refName ?? refName
111
+ if (!refName) refName = this.getRefName(field)
112
+ const key = refName ?? this.params.attr.refName
113
113
  const ref = get(prop, `ref.${key}`, {})
114
114
  if (returning === 'all') return { ref, key }
115
115
  else if (returning === 'key') return key
@@ -125,9 +125,18 @@ async function widgetFactory () {
125
125
  }
126
126
 
127
127
  getRefName = (field) => {
128
- const { get } = this.app.lib._
129
- let refName = get(this.schema, `view.widget.${field}.attr.ref-name`, this.params.attr.refName)
130
- if (!refName && this.params.attr[field] && this.params.attr[field].endsWith('Id')) refName = this.params.attr[field].slice(0, -2)
128
+ const { get, find } = this.app.lib._
129
+ const prop = find(this.schema.properties ?? [], p => p.name === field) ?? {}
130
+ if (!prop.ref) return
131
+ const keys = Object.keys(prop.ref)
132
+ let refName = get(this.schema, `view.widget.${field}.attr.refName`, this.params.attr.refName)
133
+ if (!refName) {
134
+ if (keys.includes(field)) refName = field
135
+ else if (field.endsWith('Id')) {
136
+ refName = field.slice(0, -2)
137
+ refName = keys.includes(refName) ? refName : undefined
138
+ }
139
+ }
131
140
  return refName
132
141
  }
133
142
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "waibu-mpa",
3
- "version": "2.14.0",
3
+ "version": "2.14.2",
4
4
  "description": "MPA support for Waibu Framework",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/wiki/CHANGES.md CHANGED
@@ -1,5 +1,14 @@
1
1
  # Changes
2
2
 
3
+ ## 2026-04-21
4
+
5
+ - [2.14.2] Bug fix in ```Component.beforeBuildTag()``` and ```Component.afterBuildTag()```
6
+
7
+ ## 2026-04-18
8
+
9
+ - [2.14.1] Bug fix in ```getRef()``` in ```MpaWidget```
10
+ - [2.14.1] Bug fix in ```getRefName()``` in ```MpaWidget```
11
+
3
12
  ## 2026-04-17
4
13
 
5
14
  - [2.14.0] Add data binding properties to ```Widget``` base class