@abi-software/flatmapvuer 1.5.2 → 1.5.4
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/dist/flatmapvuer.js +25360 -25939
- package/dist/flatmapvuer.umd.cjs +147 -160
- package/dist/style.css +1 -1
- package/package.json +7 -8
- package/src/components/FlatmapVuer.vue +142 -136
- package/src/components/MultiFlatmapVuer.vue +38 -43
- package/vuese-generator.js +75 -16
|
@@ -38,6 +38,12 @@
|
|
|
38
38
|
|
|
39
39
|
</el-popover>
|
|
40
40
|
</div>
|
|
41
|
+
<!--
|
|
42
|
+
This event is emitted when the user chooses a different map option
|
|
43
|
+
from ``openMapOptions`` props.
|
|
44
|
+
@event open-map
|
|
45
|
+
@arg {Object} `$event`
|
|
46
|
+
-->
|
|
41
47
|
<FlatmapVuer
|
|
42
48
|
v-for="(item, key) in speciesList"
|
|
43
49
|
:key="key"
|
|
@@ -59,13 +65,7 @@
|
|
|
59
65
|
:connectivityInfoSidebar="connectivityInfoSidebar"
|
|
60
66
|
@connectivity-info-open="onConnectivityInfoOpen"
|
|
61
67
|
@connectivity-info-close="onConnectivityInfoClose"
|
|
62
|
-
@open-map="
|
|
63
|
-
/**
|
|
64
|
-
* This event is emitted when the user chooses a different map option
|
|
65
|
-
* from ``openMapOptions`` props.
|
|
66
|
-
* @arg $event
|
|
67
|
-
*/
|
|
68
|
-
$emit('open-map', $event)"
|
|
68
|
+
@open-map="$emit('open-map', $event)"
|
|
69
69
|
@pathway-selection-changed="onSelectionsDataChanged"
|
|
70
70
|
:minZoom="minZoom"
|
|
71
71
|
:helpMode="activeSpecies == key && helpMode"
|
|
@@ -137,7 +137,7 @@ export default {
|
|
|
137
137
|
},
|
|
138
138
|
methods: {
|
|
139
139
|
/**
|
|
140
|
-
* @
|
|
140
|
+
* @public
|
|
141
141
|
* Function to initialise the component when mounted.
|
|
142
142
|
* It returns a promise.
|
|
143
143
|
*/
|
|
@@ -216,9 +216,9 @@ export default {
|
|
|
216
216
|
})
|
|
217
217
|
},
|
|
218
218
|
/**
|
|
219
|
-
* @
|
|
219
|
+
* @public
|
|
220
220
|
* Function to emit ``resource-selected`` event with provided ``resource``.
|
|
221
|
-
* @arg action
|
|
221
|
+
* @arg {Object} `action`
|
|
222
222
|
*/
|
|
223
223
|
resourceSelected: function (action) {
|
|
224
224
|
/**
|
|
@@ -227,9 +227,9 @@ export default {
|
|
|
227
227
|
this.$emit('resource-selected', action)
|
|
228
228
|
},
|
|
229
229
|
/**
|
|
230
|
-
* @
|
|
230
|
+
* @public
|
|
231
231
|
* Function to emit ``ready`` event after the flatmap is loaded.
|
|
232
|
-
* @arg component
|
|
232
|
+
* @arg {Object} `component`
|
|
233
233
|
*/
|
|
234
234
|
FlatmapReady: function (component) {
|
|
235
235
|
/**
|
|
@@ -239,17 +239,17 @@ export default {
|
|
|
239
239
|
this.$emit('ready', component)
|
|
240
240
|
},
|
|
241
241
|
/**
|
|
242
|
-
* @
|
|
242
|
+
* @public
|
|
243
243
|
* Function to get the current active map.
|
|
244
244
|
*/
|
|
245
245
|
getCurrentFlatmap: function () {
|
|
246
246
|
return this.$refs[this.activeSpecies][0]
|
|
247
247
|
},
|
|
248
248
|
/**
|
|
249
|
-
* @
|
|
249
|
+
* @public
|
|
250
250
|
* Function to emit ``pan-zoom-callback`` event
|
|
251
251
|
* from the event emitted in ``callback`` function from ``MapManager.loadMap()``.
|
|
252
|
-
* @arg payload
|
|
252
|
+
* @arg {Object} `payload`
|
|
253
253
|
*/
|
|
254
254
|
panZoomCallback: function (payload) {
|
|
255
255
|
/**
|
|
@@ -268,35 +268,35 @@ export default {
|
|
|
268
268
|
this.$emit('pathway-selection-changed', data);
|
|
269
269
|
},
|
|
270
270
|
/**
|
|
271
|
-
* @
|
|
271
|
+
* @public
|
|
272
272
|
* Function to show popup on map.
|
|
273
|
-
* @arg featureId
|
|
274
|
-
* @arg node
|
|
275
|
-
* @arg options
|
|
273
|
+
* @arg {String} `featureId`,
|
|
274
|
+
* @arg {Object} `node`,
|
|
275
|
+
* @arg {Object} `options`
|
|
276
276
|
*/
|
|
277
277
|
showPopup: function (featureId, node, options) {
|
|
278
278
|
let map = this.getCurrentFlatmap()
|
|
279
279
|
map.showPopup(featureId, node, options)
|
|
280
280
|
},
|
|
281
281
|
/**
|
|
282
|
-
* @
|
|
282
|
+
* @public
|
|
283
283
|
* Function to show marker popup.
|
|
284
|
-
* @arg featureId
|
|
285
|
-
* @arg node
|
|
286
|
-
* @arg options
|
|
284
|
+
* @arg {String} `featureId`,
|
|
285
|
+
* @arg {Object} `node`,
|
|
286
|
+
* @arg {Object} `options`
|
|
287
287
|
*/
|
|
288
288
|
showMarkerPopup: function (featureId, node, options) {
|
|
289
289
|
let map = this.getCurrentFlatmap()
|
|
290
290
|
map.showMarkerPopup(featureId, node, options)
|
|
291
291
|
},
|
|
292
292
|
/**
|
|
293
|
-
* @
|
|
293
|
+
* @public
|
|
294
294
|
* Function to set species.
|
|
295
295
|
* This function is called on the first load and
|
|
296
296
|
* when user changes the species.
|
|
297
|
-
* @arg species
|
|
298
|
-
* @arg state
|
|
299
|
-
* @arg numberOfRetry
|
|
297
|
+
* @arg {Array} `species`,
|
|
298
|
+
* @arg {Object} `state`,
|
|
299
|
+
* @arg {Number} `numberOfRetry`
|
|
300
300
|
*/
|
|
301
301
|
setSpecies: function (species, state, numberOfRetry) {
|
|
302
302
|
if (this.$refs && species in this.$refs) {
|
|
@@ -318,7 +318,6 @@ export default {
|
|
|
318
318
|
}
|
|
319
319
|
},
|
|
320
320
|
/**
|
|
321
|
-
* @vuese
|
|
322
321
|
* Function to switch to the latest existing map from
|
|
323
322
|
* a legacy map of the same species.
|
|
324
323
|
* @arg state
|
|
@@ -340,11 +339,9 @@ export default {
|
|
|
340
339
|
}
|
|
341
340
|
},
|
|
342
341
|
/**
|
|
343
|
-
* @vuese
|
|
344
342
|
* Create a legacy entry with the provided information
|
|
345
343
|
* @arg state,
|
|
346
344
|
* @arg taxo,
|
|
347
|
-
* @arg uuid
|
|
348
345
|
*
|
|
349
346
|
* @private
|
|
350
347
|
*/
|
|
@@ -372,7 +369,6 @@ export default {
|
|
|
372
369
|
}
|
|
373
370
|
},
|
|
374
371
|
/**
|
|
375
|
-
* @vuese
|
|
376
372
|
* Function used to translate the legacy map state to one that can be used in current
|
|
377
373
|
* flatmap if required. If it is a legacy, an Select entry will be added
|
|
378
374
|
* @arg state
|
|
@@ -431,11 +427,9 @@ export default {
|
|
|
431
427
|
})
|
|
432
428
|
},
|
|
433
429
|
/**
|
|
434
|
-
* @
|
|
430
|
+
* @public
|
|
435
431
|
* Function used for getting the current states of the scene. This exported states
|
|
436
432
|
* can be imported using the importStates method.
|
|
437
|
-
*
|
|
438
|
-
* @public
|
|
439
433
|
*/
|
|
440
434
|
getState: function () {
|
|
441
435
|
let state = {
|
|
@@ -447,12 +441,10 @@ export default {
|
|
|
447
441
|
return state
|
|
448
442
|
},
|
|
449
443
|
/**
|
|
450
|
-
* @
|
|
444
|
+
* @public
|
|
451
445
|
* Function used for importing the states of the scene. This exported states
|
|
452
446
|
* can be imported using the read states method.
|
|
453
|
-
* @arg state
|
|
454
|
-
*
|
|
455
|
-
* @public
|
|
447
|
+
* @arg {Object} state
|
|
456
448
|
*/
|
|
457
449
|
setState: function (state) {
|
|
458
450
|
if (state) {
|
|
@@ -473,8 +465,9 @@ export default {
|
|
|
473
465
|
}
|
|
474
466
|
},
|
|
475
467
|
/**
|
|
476
|
-
* @
|
|
468
|
+
* @public
|
|
477
469
|
* Function to activate help mode tooltip by item index number
|
|
470
|
+
* @arg {Number} `index`
|
|
478
471
|
*/
|
|
479
472
|
activateTooltipByIndex: function (index) {
|
|
480
473
|
return (
|
|
@@ -483,8 +476,9 @@ export default {
|
|
|
483
476
|
);
|
|
484
477
|
},
|
|
485
478
|
/**
|
|
486
|
-
* @
|
|
479
|
+
* @public
|
|
487
480
|
* Function to check the last item of help mode
|
|
481
|
+
* @arg {Boolean} `isLastItem`
|
|
488
482
|
*/
|
|
489
483
|
onHelpModeLastItem: function (isLastItem) {
|
|
490
484
|
if (isLastItem) {
|
|
@@ -492,7 +486,7 @@ export default {
|
|
|
492
486
|
}
|
|
493
487
|
},
|
|
494
488
|
/**
|
|
495
|
-
* @
|
|
489
|
+
* @public
|
|
496
490
|
* Function to emit event after a tooltip is shown.
|
|
497
491
|
*/
|
|
498
492
|
onTooltipShown: function () {
|
|
@@ -502,7 +496,7 @@ export default {
|
|
|
502
496
|
this.$emit('shown-tooltip');
|
|
503
497
|
},
|
|
504
498
|
/**
|
|
505
|
-
* @
|
|
499
|
+
* @public
|
|
506
500
|
* Function to emit event after a tooltip on the map is shown.
|
|
507
501
|
*/
|
|
508
502
|
onMapTooltipShown: function () {
|
|
@@ -512,8 +506,9 @@ export default {
|
|
|
512
506
|
this.$emit('shown-map-tooltip');
|
|
513
507
|
},
|
|
514
508
|
/**
|
|
515
|
-
* @
|
|
509
|
+
* @public
|
|
516
510
|
* Function to change the view mode of the map.
|
|
511
|
+
* @arg {String} `modeName`
|
|
517
512
|
*/
|
|
518
513
|
changeViewingMode: function (modeName) {
|
|
519
514
|
let map = this.getCurrentFlatmap()
|
package/vuese-generator.js
CHANGED
|
@@ -8,7 +8,8 @@
|
|
|
8
8
|
import fs from 'fs'
|
|
9
9
|
import path from 'path'
|
|
10
10
|
import chokidar from 'chokidar'
|
|
11
|
-
import { parser } from '@vuese/parser'
|
|
11
|
+
// import { parser } from '@vuese/parser'
|
|
12
|
+
import { parseSource } from 'vue-docgen-api'
|
|
12
13
|
import { Render } from '@vuese/markdown-render'
|
|
13
14
|
|
|
14
15
|
const watchMode = process.argv.find((argv) => argv === 'watch')
|
|
@@ -22,29 +23,87 @@ function generateMarkdown(file) {
|
|
|
22
23
|
const fileContent = fs.readFileSync(fileWithPath, 'utf-8')
|
|
23
24
|
|
|
24
25
|
try {
|
|
25
|
-
const parserResult = parser(fileContent)
|
|
26
|
-
const
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
26
|
+
// const parserResult = parser(fileContent)
|
|
27
|
+
const parserResult = parseSource(fileContent, fileWithPath)
|
|
28
|
+
parserResult.then((result) => {
|
|
29
|
+
const {
|
|
30
|
+
displayName: name,
|
|
31
|
+
description: desc,
|
|
32
|
+
props,
|
|
33
|
+
events,
|
|
34
|
+
methods
|
|
35
|
+
} = result
|
|
36
|
+
|
|
37
|
+
// transform props to vuese styles
|
|
38
|
+
const parseResult = {
|
|
39
|
+
name: name,
|
|
40
|
+
componentDesc: {
|
|
41
|
+
default: [desc]
|
|
42
|
+
},
|
|
43
|
+
props: transformData(props),
|
|
44
|
+
events: transformData(events),
|
|
45
|
+
methods: transformData(methods),
|
|
46
|
+
}
|
|
47
|
+
const r = new Render(parseResult)
|
|
48
|
+
const renderResult = r.render()
|
|
49
|
+
const markdownResult = r.renderMarkdown()
|
|
50
|
+
const markdownContent = markdownResult.content
|
|
51
|
+
const componentName = path.basename(fileWithPath, '.vue')
|
|
35
52
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
console.error(`Error writing markdown file for ${componentName}`, err)
|
|
39
|
-
} else {
|
|
40
|
-
console.log(`Markdown file for ${componentName} is generated!`)
|
|
53
|
+
if (!fs.existsSync(outputDir)) {
|
|
54
|
+
fs.mkdirSync(outputDir)
|
|
41
55
|
}
|
|
56
|
+
|
|
57
|
+
fs.writeFile(`${outputDir}/${componentName}.md`, markdownContent, (err) => {
|
|
58
|
+
if (err) {
|
|
59
|
+
console.error(`Error writing markdown file for ${componentName}`, err)
|
|
60
|
+
} else {
|
|
61
|
+
console.log(`Markdown file for ${componentName} is generated!`)
|
|
62
|
+
}
|
|
63
|
+
})
|
|
42
64
|
})
|
|
43
65
|
} catch(e) {
|
|
44
66
|
console.error(e)
|
|
45
67
|
}
|
|
46
68
|
}
|
|
47
69
|
|
|
70
|
+
function transformData(data = []) {
|
|
71
|
+
data.forEach((prop) => {
|
|
72
|
+
prop.name = prop.name
|
|
73
|
+
|
|
74
|
+
if (prop.description) {
|
|
75
|
+
prop.describe = [prop.description.replaceAll('\n', ' ')]
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
if (prop.type) {
|
|
79
|
+
prop.type = prop.type.name
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
if (prop.defaultValue) {
|
|
83
|
+
prop.default = prop.defaultValue.value.replaceAll('\n', ' ')
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
// events
|
|
87
|
+
if (prop.properties) {
|
|
88
|
+
prop.argumentsDesc = []
|
|
89
|
+
prop.properties.forEach((param) => {
|
|
90
|
+
const argName = param.name || param.description
|
|
91
|
+
prop.argumentsDesc.push(argName)
|
|
92
|
+
})
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
// methods
|
|
96
|
+
if (prop.params) {
|
|
97
|
+
prop.argumentsDesc = []
|
|
98
|
+
prop.params.forEach((param) => {
|
|
99
|
+
const argName = param.description || param.name
|
|
100
|
+
prop.argumentsDesc.push(argName)
|
|
101
|
+
})
|
|
102
|
+
}
|
|
103
|
+
})
|
|
104
|
+
return data
|
|
105
|
+
}
|
|
106
|
+
|
|
48
107
|
// To generate markdown files - one time
|
|
49
108
|
components.forEach((component) => {
|
|
50
109
|
console.log(`Write markdown file for ${component} on first load.`)
|