waibu-maps 2.3.1 → 2.4.1

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.
@@ -10,6 +10,7 @@
10
10
  "searchIn": "Search in",
11
11
  "clearHistory": "Clear History",
12
12
  "enterPhrase": "You need to enter a search phrase first",
13
+ "loading": "Loading...",
13
14
  "mapCtrl": {
14
15
  "csrc": "Search",
15
16
  "navigation-control": "Navigation",
@@ -12,6 +12,7 @@
12
12
  "searchIn": "Cari di",
13
13
  "clearHistory": "Hapus Jejak",
14
14
  "enterPhrase": "Anda harus memasukkan frase pencarian terlebih dahulu",
15
+ "loading": "Memuat...",
15
16
  "mapCtrl": {
16
17
  "csrc": "Cari",
17
18
  "navigation-control": "Navigasi",
@@ -14,7 +14,7 @@ async function controlGroup () {
14
14
  const { generateId } = this.app.lib.aneka
15
15
  const { jsonStringify, minify } = this.app.waibuMpa
16
16
  const { isString, trim } = this.app.lib._
17
- const { $ } = this.component
17
+ const { $, req } = this.component
18
18
  const tpl = await this.component.buildSentence(this.loadTemplate('waibuMaps.partial:/menu.html', { escape: true }), {}, { minify: true })
19
19
  const id = isString(this.params.attr.id) ? this.params.attr.id : generateId('alpha')
20
20
  const opts = {}
@@ -51,12 +51,12 @@ async function controlGroup () {
51
51
  async ${prefix}Trigger (evt) {
52
52
  const el = evt.target.closest('button')
53
53
  if (!el) return
54
- const menu = el.querySelector('.dropdown-menu')
54
+ const menu = el.querySelector('.dropdown-menu .loading')
55
55
  if (!menu) return
56
56
  if (menu.children.length > 0) return
57
57
  const setting = el.getAttribute('setting') ? ('setting="' + el.getAttribute('setting') + '"') : ''
58
- const options = { selector: menu, checkChild: true, theme: '${this.component.theme.name}', iconset: '${this.component.iconset.name}' }
59
- await wmpa.addComponent('<c:' + el.getAttribute('component') + ' ' + setting + ' />', options)
58
+ const options = { selector: menu, checkChild: true }
59
+ await wmpa.replaceWithComponent('<c:' + el.getAttribute('component') + ' ' + setting + ' />', options)
60
60
  }
61
61
  `, `
62
62
  async ${prefix}Builder (params) {
@@ -69,7 +69,7 @@ async function controlGroup () {
69
69
  html: param.html
70
70
  }
71
71
  if (param.wrapper.includes('component=')) {
72
- args.html = ''
72
+ args.html = '<div class="loading mx-2">${req.t('loading')}</div>'
73
73
  args.click = '${prefix}Trigger'
74
74
  }
75
75
  const wfn = _.template(param.wrapper)
@@ -27,7 +27,7 @@ async function controlImage () {
27
27
  const body = ['<c:${url ? `a url="${url}"` : 'div'}><c:img ${stringifyAttribs(img)} ']
28
28
  body.push('${animate}')
29
29
  body.push('/></c:${url ? 'a' : 'div'}>')
30
- return await wmpa.createComponent(body, { theme: '${this.component.theme.name}', iconset: '${this.component.iconset.name}' })
30
+ return await wmpa.createComponent(body)
31
31
  }
32
32
  `)
33
33
 
@@ -29,7 +29,7 @@ async function controlLogo () {
29
29
  }
30
30
  this.addBlock('reactive', `
31
31
  async ${prefix}Builder () {
32
- const body = ['<c:a href="#" @click="wbs.appLauncher(\\'darkmode language\\', \\'${this.params.attr.menu}\\', { theme: \\'${this.component.theme.name}\\', iconset: \\'${this.component.iconset.name}\\' })">']
32
+ const body = ['<c:a href="#" @click="wbs.appLauncher(\\'darkmode language\\', \\'${this.params.attr.menu}\\')">']
33
33
  body.push('<c:img ${stringifyAttribs(img)} ${animate} />')
34
34
  body.push('</c:a>')
35
35
  return await wmpa.createComponent(body)
@@ -56,8 +56,7 @@ async function controlMousePos () {
56
56
  `, `
57
57
  async ${prefix}Builder () {
58
58
  const body = '<c:div id="${id}" margin="x-2 top-1" text="align:center nowrap"/>'
59
- const options = { theme: '${this.component.theme.name}', iconset: '${this.component.iconset.name}' }
60
- return await wmpa.createComponent(body, options)
59
+ return await wmpa.createComponent(body)
61
60
  }
62
61
  `])
63
62
  this.addBlock('run', `
@@ -54,7 +54,7 @@ async function controlSearch () {
54
54
  '<c:icon name="search" />',
55
55
  '</c:button>'
56
56
  ]
57
- return [await wmpa.createComponent(body, { theme: '${this.component.theme.name}', iconset: '${this.component.iconset.name}' })]
57
+ return [await wmpa.createComponent(body)]
58
58
  }
59
59
  `, `
60
60
  async ${prefix}Populate () {
@@ -62,7 +62,7 @@ async function controlSearch () {
62
62
  feeds.unshift({ code: 'latLng', name: 'gotoLatLng', feed: { id: 'latLng', cmpLabel: 'latLng' } })
63
63
  this.$store.mapSearch.feeds = feeds
64
64
  const body = feeds.map(feed => '<c:dropdown-item :class="$store.mapSearch.feed === $el.getAttribute(\\'data-code-feedid\\') ? \\'active\\' : \\'\\'" data-code-feedid="' + feed.code + ':' + feed.feed.id + '" t:content="' + feed.feed.cmpLabel + '" @click="$store.mapSearch.feed = \\'' + feed.code + ':' + feed.feed.id + '\\'"/>')
65
- const options = { selector: '#${id} .input-group .dropdown-menu', wrapper: 'div', checkChild: true, theme: '${this.component.theme.name}', iconset: '${this.component.iconset.name}' }
65
+ const options = { selector: '#${id} .input-group .dropdown-menu', wrapper: 'div', checkChild: true }
66
66
  await wmpa.addComponent(body, options)
67
67
  if (!this.$store.mapSearch.feed) this.$store.mapSearch.feed = feeds[0].code + ':' + feeds[0].feed.id
68
68
  const html = this.$store.mapSearch.recent ?? ''
@@ -54,7 +54,7 @@ async function controlZbp () {
54
54
  ' }',
55
55
  '}" />'
56
56
  ]
57
- return await wmpa.createComponent(body, { theme: '${this.component.theme.name}', iconset: '${this.component.iconset.name}' })
57
+ return await wmpa.createComponent(body)
58
58
  }
59
59
  `])
60
60
 
@@ -1,28 +1,28 @@
1
1
  import wmapsBase from '../wmaps-base.js'
2
2
 
3
- export function buildLayers (params) {
3
+ export function buildLayers () {
4
4
  const { isString, map } = this.app.lib._
5
5
  const { routePath, attrToArray } = this.app.waibu
6
6
  const { jsonStringify } = this.app.waibuMpa
7
7
 
8
- if (!isString(params.attr.layer)) return ''
9
- const items = map(attrToArray(params.attr.layer), item => routePath(item))
8
+ if (!isString(this.params.attr.layer)) return ''
9
+ const items = map(attrToArray(this.params.attr.layer), item => routePath(item))
10
10
  return `
11
11
  for (const l of ${jsonStringify(items, true)}) {
12
12
  const layer = await this.loadResource(l)
13
- layer.source = '${params.attr.name}'
13
+ layer.source = '${this.params.attr.name}'
14
14
  map.addLayer(layer)
15
15
  }
16
16
  `
17
17
  }
18
18
 
19
- export function buildImage (params) {
19
+ export function buildImage () {
20
20
  const { isString, map } = this.app.lib._
21
21
  const { routePath, attrToArray } = this.app.waibu
22
22
  const { jsonStringify } = this.app.waibuMpa
23
23
 
24
- if (!isString(params.attr.image)) return ''
25
- const items = map(attrToArray(params.attr.image), item => routePath(item))
24
+ if (!isString(this.params.attr.image)) return ''
25
+ const items = map(attrToArray(this.params.attr.image), item => routePath(item))
26
26
  return `
27
27
  for (const l of ${jsonStringify(items, true)}) {
28
28
  let [item, name] = l.split(';')
@@ -34,35 +34,35 @@ export function buildImage (params) {
34
34
  `
35
35
  }
36
36
 
37
- export async function buildSrcImages (params) {
37
+ export async function buildSrcImages () {
38
38
  const { isString } = this.app.lib._
39
39
  const { routePath, fetch } = this.app.waibu
40
40
 
41
- if (!isString(params.attr.srcImages)) return
42
- params.attr.srcImages = routePath(params.attr.srcImages)
43
- const items = await fetch(params.attr.srcImages)
41
+ if (!isString(this.params.attr.srcImages)) return
42
+ this.params.attr.srcImages = routePath(this.params.attr.srcImages)
43
+ const items = await fetch(this.params.attr.srcImages)
44
44
  const lines = []
45
45
  for (const key in items) {
46
46
  lines.push(`${items[key]};${key}`)
47
47
  }
48
- params.attr.image = lines.join(' ')
49
- return buildImage.call(this, params)
48
+ this.params.attr.image = lines.join(' ')
49
+ return buildImage.call(this)
50
50
  }
51
51
 
52
- export function buildSource (params, extra = []) {
52
+ export function buildSource (extra = []) {
53
53
  const { routePath } = this.app.waibu
54
- params.attr.src = routePath(params.attr.src)
54
+ this.params.attr.src = routePath(this.params.attr.src)
55
55
  return `
56
- const rsc = await this.loadResource('${params.attr.src}')
56
+ const rsc = await this.loadResource('${this.params.attr.src}')
57
57
  let data = {}
58
58
  if (rsc.type === 'geojson' && rsc.data) data = rsc
59
59
  else {
60
60
  data.type = 'geojson'
61
61
  data.data = rsc
62
62
  }
63
- ${params.attr.lineGradient ? 'data.lineMetrics = true' : ''}
63
+ ${this.params.attr.lineGradient ? 'data.lineMetrics = true' : ''}
64
64
  ${extra.join('\n')}
65
- map.addSource('${params.attr.name}', data)
65
+ map.addSource('${this.params.attr.name}', data)
66
66
  `
67
67
  }
68
68
 
@@ -91,9 +91,9 @@ async function layerGeojson () {
91
91
  }
92
92
 
93
93
  this.addBlock('mapLoad', `
94
- ${this.params.attr.srcImages ? (await buildSrcImages.call(this, this.params)) : buildImage.call(this, this.params)}
95
- ${buildSource.call(this, this.params, cluster)}
96
- ${buildLayers.call(this, this.params)}
94
+ ${this.params.attr.srcImages ? (await buildSrcImages.call(this)) : buildImage.call(this)}
95
+ ${buildSource.call(this, cluster)}
96
+ ${buildLayers.call(this)}
97
97
  `)
98
98
  this.params.html = this.writeBlock()
99
99
  }
@@ -3,6 +3,7 @@ import { glyphUrl } from './default-style.js'
3
3
  const wmaps = {
4
4
  url: '/wmaps.js',
5
5
  method: 'GET',
6
+ noCacheReq: true,
6
7
  handler: async function (req, reply) {
7
8
  const { get } = this.app.lib._
8
9
  const { routePath } = this.app.waibu
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "waibu-maps",
3
- "version": "2.3.1",
3
+ "version": "2.4.1",
4
4
  "description": "Maps for Waibu MPA",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/wiki/CHANGES.md CHANGED
@@ -1,5 +1,15 @@
1
1
  # Changes
2
2
 
3
+ ## 2026-06-01
4
+
5
+ - [2.4.1] Bug fix in ```wmaps-layer-geojson``` widget
6
+
7
+ ## 2026-05-25
8
+
9
+ - [2.4.0] Auto detect theme & iconset
10
+ - [2.4.0] Bug fix in ```control-group``` widget
11
+ - [2.4.0] Add ```noCacheReq``` to ```wmaps.js``` route
12
+
3
13
  ## 2026-05-22
4
14
 
5
15
  - [2.3.1] Bug fix in icon model schema