waibu-db 1.1.6 → 1.1.7

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "waibu-db",
3
- "version": "1.1.6",
3
+ "version": "1.1.7",
4
4
  "description": "DB Helper",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -13,7 +13,8 @@ async function table () {
13
13
  return value
14
14
  }
15
15
 
16
- isNoWrap = (field, schema) => {
16
+ isNoWrap = (field, schema, bodyNowrap) => {
17
+ if (bodyNowrap) return true
17
18
  const { get } = this.plugin.app.bajo.lib._
18
19
  return get(schema, 'view.noWrap', []).includes(field)
19
20
  }
@@ -46,6 +47,7 @@ async function table () {
46
47
  const qsKey = this.plugin.app.waibu.config.qsKey
47
48
  let fields = without(get(this, `component.locals._meta.query.${qsKey.fields}`, '').split(','), '')
48
49
  if (isEmpty(fields)) fields = schema.view.fields
50
+ if (!isEmpty(schema.view.hidden)) fields = without(fields, ...schema.view.hidden)
49
51
  let sort = this.params.attr.sort ? attrToArray(this.params.attr.sort) : get(this, `component.locals._meta.query.${qsKey.sort}`, '')
50
52
  if (isEmpty(sort)) {
51
53
  const keys = Object.keys(filter.sort)
@@ -99,7 +101,8 @@ async function table () {
99
101
  const attr = { 'x-model': 'toggleAll', name: '_rtm', noWrapper: true, noLabel: true }
100
102
  item = await this.component.buildTag({ tag: 'formCheck', attr, prepend: '<th>', append: '</th>' })
101
103
  } else {
102
- const attr = { name: 'remove', '@click': 'selected = \'\'', style: { cursor: 'pointer' } }
104
+ const attr = { name: 'remove', '@click': 'selected = \'\'' }
105
+ if (!disableds.includes('get')) attr.style = { cursor: 'pointer' }
103
106
  item = await this.component.buildTag({ tag: 'icon', attr, prepend: '<th>', append: '</th>' })
104
107
  }
105
108
  items.unshift(item)
@@ -139,11 +142,12 @@ async function table () {
139
142
  if (isFunction(vf)) dataValue = escape(await vf(d[f], d))
140
143
  else dataValue = await callHandler(vf, req, d[f], d)
141
144
  }
142
- const attr = { dataValue, dataKey: prop.name, dataType: prop.type, style: { cursor: 'pointer' } }
145
+ const attr = { dataValue, dataKey: prop.name, dataType: prop.type }
146
+ if (!disableds.includes('get')) attr.style = { cursor: 'pointer' }
143
147
  const cellFormatter = get(schema, `view.cellFormatter.${f}`)
144
148
  if (cellFormatter) merge(attr, await cellFormatter(dataValue, d))
145
149
  if (!['object', 'array'].includes(prop.type)) {
146
- const noWrap = this.isNoWrap(f, schema) ? 'nowrap' : ''
150
+ const noWrap = this.isNoWrap(f, schema, group.body.nowrap) ? 'nowrap' : ''
147
151
  if (this.isRightAligned(f, schema)) attr.text = `align:end ${noWrap}`
148
152
  else attr.text = noWrap
149
153
  }