waibu-maps 2.7.5 → 2.7.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/extend/bajo/intl/en-US.json +2 -2
- package/extend/bajo/intl/id.json +2 -2
- package/extend/waibuBootstrap/theme/component/widget/control-newsticker.js +11 -11
- package/extend/waibuBootstrap/theme/component/widget/control-search.js +59 -6
- package/extend/waibuBootstrap/theme/component/wmaps-base.js +1 -1
- package/package.json +1 -1
- package/wiki/CHANGES.md +9 -0
package/extend/bajo/intl/id.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import control from './control.js'
|
|
2
|
-
const prefix = '
|
|
2
|
+
const prefix = 'news'
|
|
3
3
|
|
|
4
4
|
async function controlNewsticker () {
|
|
5
5
|
const WmapsControl = await control.call(this)
|
|
@@ -49,9 +49,9 @@ async function controlNewsticker () {
|
|
|
49
49
|
const att = item._attachments[0]
|
|
50
50
|
let rsc = ''
|
|
51
51
|
if (att) {
|
|
52
|
-
if (att.mimeType.startsWith('video')) {
|
|
52
|
+
if (att.mimeType.startsWith('video') && !att.url.endsWith('.olv')) {
|
|
53
53
|
rsc = '<iframe style="height:250px; width:100%" frameborder="0" allowfullscreen scrolling="no" allow="camera; microphone; fullscreen" src="' + att.url + '"></iframe>'
|
|
54
|
-
} else {
|
|
54
|
+
} else if (att.mimeType.startsWith('image')) {
|
|
55
55
|
rsc = '<img style="height:250px" class="img-fluid" src="' + att.url + '">'
|
|
56
56
|
}
|
|
57
57
|
}
|
|
@@ -66,13 +66,13 @@ async function controlNewsticker () {
|
|
|
66
66
|
if (!el) return
|
|
67
67
|
}
|
|
68
68
|
`, `
|
|
69
|
-
|
|
69
|
+
${prefix}Dt () {
|
|
70
70
|
const el = document.querySelector('.maplibregl-ctrl-newsticker .datetime h5')
|
|
71
71
|
el.textContent = dayjs().tz('Asia/Jakarta').format('HH:mm [WIB]')
|
|
72
72
|
}
|
|
73
73
|
`, `
|
|
74
|
-
async
|
|
75
|
-
if (window
|
|
74
|
+
async ${prefix}GetPosts () {
|
|
75
|
+
// if (window.${prefix}) window.${prefix}.destroy()
|
|
76
76
|
const el = document.querySelector('.maplibregl-ctrl-newsticker .content')
|
|
77
77
|
el.innerHTML = ''
|
|
78
78
|
this.posts = await wmpa.fetchApi('/cms/post', { headers: { 'X-Attachments': 'true' } }, { limit: 10 })
|
|
@@ -90,7 +90,7 @@ async function controlNewsticker () {
|
|
|
90
90
|
li.appendChild(a)
|
|
91
91
|
el.appendChild(li)
|
|
92
92
|
})
|
|
93
|
-
window
|
|
93
|
+
window.${prefix} = new window.AcmeTicker(el, {
|
|
94
94
|
type: 'vertical',
|
|
95
95
|
direction: 'down',
|
|
96
96
|
speed: 600,
|
|
@@ -100,10 +100,10 @@ async function controlNewsticker () {
|
|
|
100
100
|
`])
|
|
101
101
|
|
|
102
102
|
this.addBlock('run', `
|
|
103
|
-
this
|
|
104
|
-
setInterval(this
|
|
105
|
-
await this
|
|
106
|
-
setInterval(this
|
|
103
|
+
this.${prefix}Dt()
|
|
104
|
+
setInterval(this.${prefix}Dt, 1000)
|
|
105
|
+
await this.${prefix}GetPosts()
|
|
106
|
+
setInterval(this.${prefix}GetPosts, 3 * 60 * 1000)
|
|
107
107
|
`)
|
|
108
108
|
|
|
109
109
|
const ui = await minify(await this.component.buildSentence(`
|
|
@@ -23,10 +23,10 @@ async function controlSearch () {
|
|
|
23
23
|
`)
|
|
24
24
|
this.addBlock('dataInit', `
|
|
25
25
|
this.$watch('$store.mapSearch.value', async val => {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
this.$store.mapSearch.
|
|
26
|
+
await this.${prefix}FetchList(val)
|
|
27
|
+
})
|
|
28
|
+
this.$watch('$store.mapSearch.page', async val => {
|
|
29
|
+
if (val > 0) await this.${prefix}FetchList(this.$store.mapSearch.value, val)
|
|
30
30
|
})
|
|
31
31
|
this.$watch('$store.mapSearch.recent', async val => {
|
|
32
32
|
val = val ?? ''
|
|
@@ -38,6 +38,7 @@ async function controlSearch () {
|
|
|
38
38
|
})
|
|
39
39
|
this.$watch('$store.mapSearch.feed', async val => {
|
|
40
40
|
this.$store.mapSearch.recent = ''
|
|
41
|
+
this.$store.mapSearch.page = null
|
|
41
42
|
})
|
|
42
43
|
this.$watch('$store.mapSearch.busy', async val => {
|
|
43
44
|
const el = document.querySelector('#${id} .input-group .dropdown-toggle')
|
|
@@ -56,6 +57,52 @@ async function controlSearch () {
|
|
|
56
57
|
]
|
|
57
58
|
return [await wmpa.createComponent(body)]
|
|
58
59
|
}
|
|
60
|
+
`, `
|
|
61
|
+
async ${prefix}FetchList (val, page) {
|
|
62
|
+
if (_.isEmpty(val)) return wbs.notify('enterPhrase', { type: 'danger' })
|
|
63
|
+
page = page || this.$store.mapSearch.page || 1
|
|
64
|
+
let result = await ${this.params.attr.method}(val, this.$store.mapSearch.feed, { page })
|
|
65
|
+
if (_.isString(result)) {
|
|
66
|
+
this.$store.mapSearch.recent = result
|
|
67
|
+
this.$store.mapSearch.busy = false
|
|
68
|
+
return
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
let pagination = ''
|
|
72
|
+
const { response, transformer, fields } = result
|
|
73
|
+
if (response.data.length === 0) {
|
|
74
|
+
this.$store.mapSearch.recent = await smaps.searchNotFound()
|
|
75
|
+
this.$store.mapSearch.busy = false
|
|
76
|
+
return
|
|
77
|
+
}
|
|
78
|
+
if (transformer) response.data = await transformer(response)
|
|
79
|
+
const body = ['<c:div><c:table hover><c:thead><c:tr>']
|
|
80
|
+
for (const key of fields) {
|
|
81
|
+
body.push('<c:th t:content="field.' + key + '" />')
|
|
82
|
+
}
|
|
83
|
+
body.push('</c:tr></c:thead><c:tbody divider>')
|
|
84
|
+
for (const row of response.data) {
|
|
85
|
+
body.push('<c:tr style="cursor:pointer" @click="select(\\'' + row._selector + '\\')">')
|
|
86
|
+
for (const key of fields) {
|
|
87
|
+
body.push('<c:td>' + (row[key] || '') + '</c:td>')
|
|
88
|
+
}
|
|
89
|
+
body.push('</c:tr>')
|
|
90
|
+
}
|
|
91
|
+
body.push('</c:tbody></c:table>')
|
|
92
|
+
if (response.pages > 1) {
|
|
93
|
+
body.push('<c:div flex=justify-content:center margin=top-3><c:pagination>')
|
|
94
|
+
const max = response.pages < 10 ? response.pages : 10
|
|
95
|
+
for (let idx = 0; idx < max; idx++) {
|
|
96
|
+
const pageNo = idx + 1
|
|
97
|
+
body.push('<c:pagination-item @click=goto(' + pageNo + ') ' + (pageNo === response.page ? 'active' : '') + '>' + (idx + 1) + '</c:pagination-item>')
|
|
98
|
+
}
|
|
99
|
+
body.push('</c:pagination></c:div>')
|
|
100
|
+
}
|
|
101
|
+
body.push('</c:div>')
|
|
102
|
+
result = await wmpa.fetchRender(body)
|
|
103
|
+
this.$store.mapSearch.recent = result
|
|
104
|
+
this.$store.mapSearch.busy = false
|
|
105
|
+
}
|
|
59
106
|
`, `
|
|
60
107
|
async ${prefix}Populate () {
|
|
61
108
|
const selector = '#${id} .input-group .dropdown-menu'
|
|
@@ -86,8 +133,12 @@ async function controlSearch () {
|
|
|
86
133
|
search () {
|
|
87
134
|
this.$store.mapSearch.value = this.$refs.input.value
|
|
88
135
|
},
|
|
136
|
+
goto (page) {
|
|
137
|
+
this.$store.mapSearch.page = page
|
|
138
|
+
},
|
|
89
139
|
clearHistory () {
|
|
90
140
|
this.$store.mapSearch.recent = ''
|
|
141
|
+
Alpine.store('mapSearch').page = null
|
|
91
142
|
},
|
|
92
143
|
abort () {
|
|
93
144
|
const endpoint = this.$store.mapSearch.busy
|
|
@@ -99,6 +150,7 @@ async function controlSearch () {
|
|
|
99
150
|
resetValue () {
|
|
100
151
|
const el = document.querySelector('#${id} input[type=search]')
|
|
101
152
|
el.value = ''
|
|
153
|
+
Alpine.store('mapSearch').page = null
|
|
102
154
|
},
|
|
103
155
|
select (id) {
|
|
104
156
|
this.$store.mapSearch.select = id
|
|
@@ -106,7 +158,7 @@ async function controlSearch () {
|
|
|
106
158
|
instance.hide()
|
|
107
159
|
}
|
|
108
160
|
}" x-init="$watch('$store.mapSearch.feed', resetValue)">
|
|
109
|
-
<c:form-input x-ref="input" type="search" dim="width:max" @keyup.enter="search()" :disabled="$store.mapSearch.busy">
|
|
161
|
+
<c:form-input x-ref="input" type="search" dim="width:max" @keyup.enter="search()" :disabled="$store.mapSearch.busy" :value="$store.mapSearch.value">
|
|
110
162
|
<c:form-input-addon prepend>
|
|
111
163
|
<c:dropdown>
|
|
112
164
|
</c:dropdown>
|
|
@@ -148,9 +200,10 @@ async function controlSearch () {
|
|
|
148
200
|
Alpine.store('mapSearch', {
|
|
149
201
|
feed: Alpine.$persist('latLng:latLng').as('mapSearchFeed'),
|
|
150
202
|
recent: Alpine.$persist('').as('mapSearchRecent'),
|
|
203
|
+
page: null,
|
|
151
204
|
feeds: [],
|
|
152
205
|
select: null,
|
|
153
|
-
value: null,
|
|
206
|
+
value: Alpine.$persist(null).as('mapSearchValue'),
|
|
154
207
|
busy: false
|
|
155
208
|
})
|
|
156
209
|
`)
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
async function wmapsBase () {
|
|
2
2
|
const controls = ['csrc', 'navigation-control', 'crlr', 'scale-control', 'attribution-control',
|
|
3
3
|
'centerpos', 'fullscreen-control', 'geolocate-control', 'czbp', 'cmp']
|
|
4
|
-
if (this.app.sumbaCms) controls.push('
|
|
4
|
+
if (this.app.sumbaCms) controls.push('news')
|
|
5
5
|
|
|
6
6
|
return class WmapsBase extends this.app.baseClass.MpaWidget {
|
|
7
7
|
static scripts = [...super.scripts,
|
package/package.json
CHANGED
package/wiki/CHANGES.md
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
# Changes
|
|
2
2
|
|
|
3
|
+
## 2026-11-26
|
|
4
|
+
|
|
5
|
+
- [2.7.7] Bug fix in `control-search.js` widget
|
|
6
|
+
|
|
7
|
+
## 2026-11-22
|
|
8
|
+
|
|
9
|
+
- [2.7.6] Bug fix in `control-newsticker.js` widget
|
|
10
|
+
- [2.7.6] Bug fix in `wmaps-base.js` widget
|
|
11
|
+
|
|
3
12
|
## 2026-11-12
|
|
4
13
|
|
|
5
14
|
- [2.7.5] Bug fix in `control-search.js` widget
|