waibu-db 1.0.2 → 1.0.3
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
|
@@ -46,7 +46,7 @@ async function btnEdit () {
|
|
|
46
46
|
if (id.slice(-6) === '-split') {
|
|
47
47
|
const selector = '#' + id.replace('-split', '-menu') + ' a.dropdown-item'
|
|
48
48
|
const item = document.querySelector(selector)
|
|
49
|
-
item.href = href.replace('
|
|
49
|
+
item.href = href.replace('edit?&id=', 'add?&id=') + '&mode=clone'
|
|
50
50
|
} else el.href = href
|
|
51
51
|
}
|
|
52
52
|
`
|
|
@@ -5,7 +5,7 @@ async function echarts () {
|
|
|
5
5
|
|
|
6
6
|
return class WdbEcharts extends WdbBase {
|
|
7
7
|
static scripts = [...super.scripts,
|
|
8
|
-
'^
|
|
8
|
+
'^waibuExtra.virtual:/echarts/echarts.min.js'
|
|
9
9
|
]
|
|
10
10
|
|
|
11
11
|
constructor (options) {
|
|
@@ -24,7 +24,6 @@ async function echarts () {
|
|
|
24
24
|
const { defaultsDeep, generateId } = this.plugin.app.bajo
|
|
25
25
|
const { base64JsonDecode, jsonStringify } = this.plugin.app.waibuMpa
|
|
26
26
|
const { cloneDeep } = this.plugin.app.bajo.lib._
|
|
27
|
-
this._normalizeAttr(this.params, { tag: 'div' })
|
|
28
27
|
this.params.attr.dim = this.params.attr.dim ?? 'width:100 height:100'
|
|
29
28
|
this.params.attr.id = generateId('alpha')
|
|
30
29
|
this.params.attr['x-data'] = `chart${this.params.attr.id}`
|
|
@@ -66,6 +66,37 @@ async function query () {
|
|
|
66
66
|
if (ext) prefix += ext
|
|
67
67
|
return ':' + prefix + '\\'' + v + '\\''
|
|
68
68
|
},
|
|
69
|
+
initBuilder () {
|
|
70
|
+
this.builder = document.getElementById('${id}').value
|
|
71
|
+
if (_.isEmpty(this.builder)) return
|
|
72
|
+
const tokens = _.merge({}, this.ops, {
|
|
73
|
+
in: ':[',
|
|
74
|
+
contains: ':~',
|
|
75
|
+
starts: ':~^',
|
|
76
|
+
ends: ':~$$',
|
|
77
|
+
'!in': ':-[',
|
|
78
|
+
'!contains': ':-~',
|
|
79
|
+
'!starts': ':-~^',
|
|
80
|
+
'!ends': ':-~$$'
|
|
81
|
+
})
|
|
82
|
+
for (const part of this.builder.split('+')) {
|
|
83
|
+
let [f, opv] = part.split(':')
|
|
84
|
+
opv = ':' + opv
|
|
85
|
+
this.selected.push(f)
|
|
86
|
+
let op
|
|
87
|
+
let val
|
|
88
|
+
_.each(tokens, (v, k) => {
|
|
89
|
+
if (opv.slice(0, v.length) === v) {
|
|
90
|
+
op = k
|
|
91
|
+
val = opv.slice(v.length).replaceAll('[', '').replaceAll(']', '').replaceAll('\\'', '')
|
|
92
|
+
}
|
|
93
|
+
})
|
|
94
|
+
console.log(op, val)
|
|
95
|
+
if (_.isEmpty(op)) continue
|
|
96
|
+
this[f + 'Op'] = op
|
|
97
|
+
this[f + 'Val'] = val
|
|
98
|
+
}
|
|
99
|
+
},
|
|
69
100
|
expandArray (val = '') {
|
|
70
101
|
return _.map(val.split(','), item => {
|
|
71
102
|
item = _.trim(item)
|
|
@@ -98,14 +129,15 @@ async function query () {
|
|
|
98
129
|
if (run) {
|
|
99
130
|
const url = new URL(window.location.href)
|
|
100
131
|
const params = new URLSearchParams(url.search)
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
window.location.href = '?' +
|
|
132
|
+
params.set('${qsKey.page}', 1)
|
|
133
|
+
params.set('${qsKey.query}', this.builder ?? '')
|
|
134
|
+
window.location.href = '?' + params.toString()
|
|
104
135
|
} else $dispatch('on-query', this.builder)
|
|
105
136
|
const instance = wbs.getInstance('${upperFirst(container)}', $refs.query)
|
|
106
137
|
instance.hide()
|
|
107
138
|
}
|
|
108
139
|
}" x-init="
|
|
140
|
+
initBuilder()
|
|
109
141
|
const ops = _.map(fields, f => (f + 'Op'))
|
|
110
142
|
const vals = _.map(fields, f => (f + 'Val'))
|
|
111
143
|
const watcher = ['selected', ...ops, ...vals].join(',')
|
|
@@ -130,9 +162,9 @@ async function query () {
|
|
|
130
162
|
const val = document.getElementById('${id}').value ?? ''
|
|
131
163
|
const url = new URL(window.location.href)
|
|
132
164
|
const params = new URLSearchParams(url.search)
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
window.location.href = '?' +
|
|
165
|
+
params.set('${qsKey.page}', 1)
|
|
166
|
+
params.set('${qsKey.query}', val)
|
|
167
|
+
window.location.href = '?' + params.toString()
|
|
136
168
|
}
|
|
137
169
|
}" @click="submit" @on-submit.window="submit()" />
|
|
138
170
|
</c:form-input-addon>
|