waibu-mpa 2.13.1 → 2.13.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.
|
@@ -309,7 +309,8 @@ class Wmpa {
|
|
|
309
309
|
|
|
310
310
|
parseValue = (value, type) => {
|
|
311
311
|
try {
|
|
312
|
-
if (
|
|
312
|
+
if (type === 'boolean') value = value === 'true'
|
|
313
|
+
else if (['integer', 'smallint'].includes(type)) value = parseInt(value)
|
|
313
314
|
else if (['float', 'double'].includes(type)) value = parseFloat(value)
|
|
314
315
|
else if (['datetime', 'date', 'time'].includes(type)) value = new Date(Date.parse(value))
|
|
315
316
|
else if (['array', 'object'].includes(type)) value = JSON.parse(value)
|
|
@@ -27,11 +27,11 @@ async function meta (options) {
|
|
|
27
27
|
await runHook(`${this.ns}.${theme.name}:afterInjectMeta`, { meta: theme.meta, items, req })
|
|
28
28
|
}
|
|
29
29
|
// title
|
|
30
|
-
const
|
|
30
|
+
const format = get(this, 'app.waibuMpa.pageTitleFormat', '%s : %s')
|
|
31
31
|
const title = page.fullTitle ?? page.title
|
|
32
32
|
let pageTitle
|
|
33
|
-
if (isFunction(
|
|
34
|
-
else pageTitle = sprintf(
|
|
33
|
+
if (isFunction(format)) pageTitle = await format.call(this, locals)
|
|
34
|
+
else pageTitle = sprintf(format, title, this.app.waibuMpa.getAppTitle(req))
|
|
35
35
|
$('head').append(`<title>${pageTitle}</title>`)
|
|
36
36
|
// favicon
|
|
37
37
|
const favicon = this.app.waibuMpa.config.favicon
|
package/lib/class/widget.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import path from 'path'
|
|
2
2
|
|
|
3
3
|
async function widgetFactory () {
|
|
4
|
+
const { kebabCase } = this.app.lib._
|
|
4
5
|
class MpaWidget extends this.app.baseClass.MpaTools {
|
|
5
6
|
static scripts = []
|
|
6
7
|
static css = []
|
|
@@ -10,6 +11,12 @@ async function widgetFactory () {
|
|
|
10
11
|
|
|
11
12
|
constructor ({ component = {}, params = {} } = {}) {
|
|
12
13
|
super(component.plugin)
|
|
14
|
+
const names = kebabCase(this.constructor.name).split('-')
|
|
15
|
+
const alias = names.length > 1 ? names[0] : 'wbs'
|
|
16
|
+
let plugin = this.app.bajo.getPlugin(alias, true)
|
|
17
|
+
if (!plugin) plugin = this.app.waibuBootstrap
|
|
18
|
+
this.plugin = plugin
|
|
19
|
+
this.app = plugin.app
|
|
13
20
|
this.component = component
|
|
14
21
|
this.params = params
|
|
15
22
|
this.block = {}
|
package/package.json
CHANGED