waibu-db 2.8.2 → 2.10.0

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.
@@ -17,21 +17,14 @@ async function btnColumns () {
17
17
  return
18
18
  }
19
19
  let fields = without(get(this, `component.locals._meta.query.${qsKey.fields}`, '').split(','), '')
20
- if (isEmpty(fields)) fields = schema.view.fields
20
+ if (isEmpty(fields)) fields = without(schema.view.fields, 'id')
21
21
  const items = []
22
22
  this.params.attr.color = this.params.attr.color ?? 'secondary-outline'
23
23
  if (isEmpty(this.params.attr.content)) this.params.attr.content = req.t('columns')
24
24
  for (const f of schema.view.fields) {
25
- if (!fields.includes(f)) continue
26
25
  let prop = find(schema.properties, { name: f })
27
26
  if (!prop) prop = find(schema.view.calcFields, { name: f })
28
27
  if (!prop) continue
29
- /*
30
- if (f === 'id') {
31
- items.push(await this.component.buildTag({ tag: 'formCheck', attr: { checked: true, label: req.t('ID'), value: f, disabled: true } }))
32
- continue
33
- }
34
- */
35
28
  const attr = { 'x-model': 'selected', label: req.t(get(schema, `view.label.${f}`, `field.${f}`)), value: f }
36
29
  if (fields.includes(f)) attr.checked = true
37
30
  items.push(await this.component.buildTag({ tag: 'formCheck', attr }))
@@ -21,7 +21,7 @@ async function table () {
21
21
  return get(schema, 'view.noWrap', []).includes(field)
22
22
  }
23
23
 
24
- _defFormatter = async ({ req, key, value, data, schema }) => {
24
+ _defFormatter = async ({ req, key, value, data, schema, params }) => {
25
25
  const { get, find, camelCase, isEmpty } = this.app.lib._
26
26
  const { escape } = this.app.waibu
27
27
  const prop = find(schema.properties, { name: key })
@@ -34,7 +34,7 @@ async function table () {
34
34
  const item = find(values, { value }) ?? {}
35
35
  const ttext = camelCase(`${prop.name} ${item.text}`)
36
36
  value = escape(req.format(!isEmpty(item) ? (req.te(ttext) ? req.t(ttext) : item.text) : value, prop.type))
37
- if (item) value += ` <sup><a href="#" title="${req.t('dataValue')}: ${data[key]}">*</a></sup>`
37
+ if (item && !params.attr.noDataValueRef) value += ` <sup><a href="#" title="${req.t('dataValue')}: ${data[key]}">*</a></sup>`
38
38
  } else if (['string', 'text'].includes(prop.type)) {
39
39
  if (!get(schema, 'view.noEscape', []).includes(key)) value = escape(value)
40
40
  }
@@ -74,7 +74,7 @@ async function table () {
74
74
  }
75
75
  const qsKey = this.app.waibu.config.qsKey
76
76
  let fields = without(get(this, `component.locals._meta.query.${qsKey.fields}`, '').split(','), '')
77
- if (isEmpty(fields)) fields = schema.view.fields
77
+ if (isEmpty(fields)) fields = without(schema.view.fields, 'id')
78
78
  let sort = this.params.attr.sort ? attrToArray(this.params.attr.sort) : get(this, `component.locals._meta.query.${qsKey.sort}`, '')
79
79
  if (isEmpty(sort) && filter.sort) {
80
80
  const keys = Object.keys(filter.sort)
@@ -175,8 +175,8 @@ async function table () {
175
175
  if (item) value = req.t(item[lookup.field ?? 'name'])
176
176
  }
177
177
  const formatter = get(schema, `view.formatter.${f}`)
178
- if (formatter) value = await formatter.call(this, value, d)
179
- else value = await this._defFormatter({ req, key: f, schema, value, data: d })
178
+ if (formatter) value = await formatter.call(this, value, d, { params: this.params })
179
+ else value = await this._defFormatter({ req, key: f, schema, value, data: d, params: this.params })
180
180
  const line = await this.component.buildTag({ tag: 'td', attr, html: value })
181
181
  lines.push(line)
182
182
  }
@@ -175,7 +175,7 @@ async function getSchemaExt (modelName, view, options = {}) {
175
175
 
176
176
  const model = isString(modelName) ? this.app.dobo.getModel(modelName) : modelName
177
177
  const schema = pick(model, ['name', 'properties', 'indexes', 'disabled', 'attachment', 'sortables', 'view', 'hidden'])
178
- const base = path.basename(model.file, path.extname(model.file))
178
+ const base = options.base ?? path.basename(model.file, path.extname(model.file))
179
179
  let ext = await readConfig(`${model.plugin.ns}:/extend/waibuDb/schema/${base}.*`, { ignoreError: true, options })
180
180
  const over = await readConfig(`main:/extend/waibuDb/extend/${model.plugin.ns}/schema/${base}.*`, { ignoreError: true, options })
181
181
  ext = defaultsDeep(options.schema ?? {}, over, ext)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "waibu-db",
3
- "version": "2.8.2",
3
+ "version": "2.10.0",
4
4
  "description": "DB Helper",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/wiki/CHANGES.md CHANGED
@@ -1,5 +1,15 @@
1
1
  # Changes
2
2
 
3
+ ## 2026-03-19
4
+
5
+ - [2.10.0] Data value tooltip can now be turned off with ```no-data-value-ref```
6
+
7
+ ## 2026-03-15
8
+
9
+ - [2.9.0] Add ability to overwrite ```base``` through ```options```
10
+ - [2.9.0] Bug fix in ```wdb-btn-columns``` widget
11
+ - [2.9.0] Bug fix in ```wdb-table``` widget
12
+
3
13
  ## 2026-03-08
4
14
 
5
15
  - [2.8.1] Bug fix in ```build-params.js```