waibu-bootstrap 1.2.12 → 1.2.13

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,36 +1,36 @@
1
- {
2
- "name": "waibu-bootstrap",
3
- "version": "1.2.12",
4
- "description": "Bootstrap suport for Waibu Framework",
5
- "main": "index.js",
6
- "scripts": {
7
- "test": "echo \"Error: no test specified\" && exit 1"
8
- },
9
- "type": "module",
10
- "bajo": {
11
- "type": "plugin"
12
- },
13
- "repository": {
14
- "type": "git",
15
- "url": "git+https://github.com/ardhi/waibu-bootstrap.git"
16
- },
17
- "keywords": [
18
- "bootstrap",
19
- "waibu",
20
- "web",
21
- "webserver",
22
- "bajo",
23
- "framework",
24
- "fastify",
25
- "modular"
26
- ],
27
- "author": "Ardhi Lukianto <ardhi@lukianto.com>",
28
- "license": "MIT",
29
- "bugs": {
30
- "url": "https://github.com/ardhi/waibu-bootstrap/issues"
31
- },
32
- "homepage": "https://github.com/ardhi/waibu-bootstrap#readme",
33
- "dependencies": {
34
- "bootstrap": "^5.3.3"
35
- }
36
- }
1
+ {
2
+ "name": "waibu-bootstrap",
3
+ "version": "1.2.13",
4
+ "description": "Bootstrap suport for Waibu Framework",
5
+ "main": "index.js",
6
+ "scripts": {
7
+ "test": "echo \"Error: no test specified\" && exit 1"
8
+ },
9
+ "type": "module",
10
+ "bajo": {
11
+ "type": "plugin"
12
+ },
13
+ "repository": {
14
+ "type": "git",
15
+ "url": "git+https://github.com/ardhi/waibu-bootstrap.git"
16
+ },
17
+ "keywords": [
18
+ "bootstrap",
19
+ "waibu",
20
+ "web",
21
+ "webserver",
22
+ "bajo",
23
+ "framework",
24
+ "fastify",
25
+ "modular"
26
+ ],
27
+ "author": "Ardhi Lukianto <ardhi@lukianto.com>",
28
+ "license": "MIT",
29
+ "bugs": {
30
+ "url": "https://github.com/ardhi/waibu-bootstrap/issues"
31
+ },
32
+ "homepage": "https://github.com/ardhi/waibu-bootstrap#readme",
33
+ "dependencies": {
34
+ "bootstrap": "^5.3.3"
35
+ }
36
+ }
@@ -117,22 +117,25 @@ async function formSelectExt () {
117
117
  }
118
118
  }`
119
119
  }
120
-
121
120
  this.params.attr['@load.window'] = `
122
121
  const opts = ${opts}
123
122
  instance = new TomSelect($refs.${xref}, opts)
124
123
  const val = $refs.${xref}.dataset.value
125
- if (!_.isEmpty(val)) {
126
- fetch('${group.remote.url}?query=${group.remote.valueField}:' + val, ${jsonStringify(fetchOpts, true)})
127
- .then(resp => resp.json())
128
- .then(json => {
129
- if (json.data.length === 0) return
130
- const opt = _.pick(json.data[0], ['${group.remote.valueField}', '${group.remote.labelField}'])
131
- instance.addOption(opt)
132
- instance.setValue(opt.${group.remote.valueField})
133
- })
134
- }
135
124
  `
125
+ if (group.remote) {
126
+ this.params.attr['@load.window'] += `
127
+ if (!_.isEmpty(val)) {
128
+ fetch('${group.remote.url}?query=${group.remote.valueField}:' + val, ${jsonStringify(fetchOpts, true)})
129
+ .then(resp => resp.json())
130
+ .then(json => {
131
+ if (json.data.length === 0) return
132
+ const opt = _.pick(json.data[0], ['${group.remote.valueField}', '${group.remote.labelField}'])
133
+ instance.addOption(opt)
134
+ instance.setValue(opt.${group.remote.valueField})
135
+ })
136
+ }
137
+ `
138
+ }
136
139
  this.params.attr.options = options
137
140
  this.params.attr = omit(this.params.attr, ['noDropdownInput', 'removeBtn', 'clearBtn', 'c-opts', 'remoteUrl', 'remoteSearchField', 'remoteLabelField', 'remoteValueField'])
138
141
  await build.call(this, buildFormSelect, this.params)