w-plot-vue 1.0.0
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/.editorconfig +9 -0
- package/.eslintignore +3 -0
- package/.eslintrc.js +55 -0
- package/.jsdoc +25 -0
- package/LICENSE +21 -0
- package/README.md +89 -0
- package/SECURITY.md +5 -0
- package/babel.config.js +15 -0
- package/dist/w-geo-vue.umd.js +7 -0
- package/dist/w-geo-vue.umd.js.map +1 -0
- package/docs/examples/app.html +65 -0
- package/docs/examples/app.umd.js +7 -0
- package/docs/examples/app.umd.js.map +1 -0
- package/docs/examples/w-bar_horizontal_multi-set(color).html +492 -0
- package/docs/examples/w-bar_horizontal_multi-set(color, gradient).html +492 -0
- package/docs/examples/w-bar_horizontal_multi-set(series color).html +492 -0
- package/docs/examples/w-bar_horizontal_multi-set(series color, gradient).html +492 -0
- package/docs/examples/w-bar_horizontal_multi-set.html +492 -0
- package/docs/examples/w-bar_horizontal_multi-set__barDisplay(stackNormal).html +495 -0
- package/docs/examples/w-bar_horizontal_multi-set__barDisplay(stackPercent).html +496 -0
- package/docs/examples/w-bar_horizontal_multi-set__hide legned.html +492 -0
- package/docs/examples/w-bar_horizontal_multi-set__show labels.html +492 -0
- package/docs/examples/w-bar_horizontal_multi-set_barKpColor(gradient).html +508 -0
- package/docs/examples/w-bar_horizontal_multi-set_barKpColor.html +506 -0
- package/docs/examples/w-bar_horizontal_multi-set_barWidthRatio.html +493 -0
- package/docs/examples/w-bar_horizontal_multi-set_barWidthRatio_barGroupWidthRatio.html +498 -0
- package/docs/examples/w-bar_horizontal_one-set(color).html +490 -0
- package/docs/examples/w-bar_horizontal_one-set(color, gradient).html +490 -0
- package/docs/examples/w-bar_horizontal_one-set.html +490 -0
- package/docs/examples/w-bar_horizontal_one-set_barColor(gradient).html +491 -0
- package/docs/examples/w-bar_horizontal_one-set_barColor.html +491 -0
- package/docs/examples/w-bar_horizontal_one-set_barKpColor(gradient).html +500 -0
- package/docs/examples/w-bar_horizontal_one-set_barKpColor.html +498 -0
- package/docs/examples/w-bar_horizontal_one-set_barWidthRatio.html +491 -0
- package/docs/examples/w-bar_horizontal_one-set_barWidthRatio_barGroupWidthRatio.html +496 -0
- package/docs/examples/w-bar_horizontal_one-set_hide labels.html +491 -0
- package/docs/examples/w-bar_horizontal_one-set_marginLeft_marginRight.html +495 -0
- package/docs/examples/w-bar_horizontal_one-set_show legned.html +491 -0
- package/docs/examples/w-bar_multi-set(color).html +489 -0
- package/docs/examples/w-bar_multi-set(color, gradient).html +489 -0
- package/docs/examples/w-bar_multi-set(series color).html +489 -0
- package/docs/examples/w-bar_multi-set(series color, gradient).html +489 -0
- package/docs/examples/w-bar_multi-set.html +489 -0
- package/docs/examples/w-bar_multi-set__barDisplay(stackNormal).html +490 -0
- package/docs/examples/w-bar_multi-set__barDisplay(stackNormal)_.html +492 -0
- package/docs/examples/w-bar_multi-set__barDisplay(stackPercent).html +491 -0
- package/docs/examples/w-bar_multi-set__hide legned.html +489 -0
- package/docs/examples/w-bar_multi-set__show labels.html +489 -0
- package/docs/examples/w-bar_multi-set_barKpColor(gradient).html +503 -0
- package/docs/examples/w-bar_multi-set_barKpColor.html +503 -0
- package/docs/examples/w-bar_multi-set_barWidthRatio.html +490 -0
- package/docs/examples/w-bar_multi-set_barWidthRatio_barGroupWidthRatio_barBorderRadius.html +495 -0
- package/docs/examples/w-bar_one-set(color).html +487 -0
- package/docs/examples/w-bar_one-set(color, gradient).html +487 -0
- package/docs/examples/w-bar_one-set.html +487 -0
- package/docs/examples/w-bar_one-set_barColor(gradient).html +488 -0
- package/docs/examples/w-bar_one-set_barColor.html +488 -0
- package/docs/examples/w-bar_one-set_barKpColor(gradient).html +495 -0
- package/docs/examples/w-bar_one-set_barKpColor.html +495 -0
- package/docs/examples/w-bar_one-set_barWidthRatio.html +488 -0
- package/docs/examples/w-bar_one-set_barWidthRatio_barGroupWidthRatio_barBorderRadius.html +493 -0
- package/docs/examples/w-bar_one-set_hide labels.html +488 -0
- package/docs/examples/w-bar_one-set_marginLeft_marginRight_marginTop.html +493 -0
- package/docs/examples/w-bar_one-set_show legned.html +488 -0
- package/docs/examples/w-pie_one-set(color).html +251 -0
- package/docs/examples/w-pie_one-set(color, gradient).html +251 -0
- package/docs/examples/w-pie_one-set.html +251 -0
- package/docs/examples/w-pie_one-set_hide labels.html +252 -0
- package/docs/examples/w-pie_one-set_hide legned.html +252 -0
- package/docs/examples/w-pie_one-set_marginLeft_marginRight_marginTop.html +257 -0
- package/docs/examples/w-pie_one-set_pieBorderRadius.html +252 -0
- package/docs/examples/w-pie_one-set_pieBorderWidth_pieBorderRadius.html +253 -0
- package/docs/examples/w-pie_one-set_pieKpColor(gradient).html +259 -0
- package/docs/examples/w-pie_one-set_pieKpColor.html +259 -0
- package/docs/examples/w-pie_one-set_pieThicknessRatio.html +252 -0
- package/docs/examples/w-plot_default.html +174 -0
- package/docs/examples/w-rose_multi-set(color).html +489 -0
- package/docs/examples/w-rose_multi-set(color, gradient).html +489 -0
- package/docs/examples/w-rose_multi-set(series color).html +489 -0
- package/docs/examples/w-rose_multi-set(series color, gradient).html +489 -0
- package/docs/examples/w-rose_multi-set.html +489 -0
- package/docs/examples/w-rose_multi-set__hide legned.html +489 -0
- package/docs/examples/w-rose_multi-set__show labels.html +489 -0
- package/docs/examples/w-rose_multi-set_roseBorderWidth.html +490 -0
- package/docs/examples/w-rose_multi-set_roseKpColor(gradient).html +503 -0
- package/docs/examples/w-rose_multi-set_roseKpColor.html +503 -0
- package/docs/examples/w-rose_multi-set_roseWidthRatio.html +490 -0
- package/docs/examples/w-rose_one-set(color).html +487 -0
- package/docs/examples/w-rose_one-set(color, gradient).html +487 -0
- package/docs/examples/w-rose_one-set.html +487 -0
- package/docs/examples/w-rose_one-set_marginLeft_marginRight_marginTop.html +493 -0
- package/docs/examples/w-rose_one-set_roseBorderWidth.html +488 -0
- package/docs/examples/w-rose_one-set_roseKpColor(gradient).html +495 -0
- package/docs/examples/w-rose_one-set_roseKpColor.html +495 -0
- package/docs/examples/w-rose_one-set_roseShowLabels.html +488 -0
- package/docs/examples/w-rose_one-set_roseWidthRatio.html +488 -0
- package/docs/examples/w-rose_one-set_showLegend.html +488 -0
- package/docs/examples/w-rose_one-set_showLegend_legendPosition.html +489 -0
- package/docs/fonts/Montserrat/Montserrat-Bold.eot +0 -0
- package/docs/fonts/Montserrat/Montserrat-Bold.ttf +0 -0
- package/docs/fonts/Montserrat/Montserrat-Bold.woff +0 -0
- package/docs/fonts/Montserrat/Montserrat-Bold.woff2 +0 -0
- package/docs/fonts/Montserrat/Montserrat-Regular.eot +0 -0
- package/docs/fonts/Montserrat/Montserrat-Regular.ttf +0 -0
- package/docs/fonts/Montserrat/Montserrat-Regular.woff +0 -0
- package/docs/fonts/Montserrat/Montserrat-Regular.woff2 +0 -0
- package/docs/fonts/Source-Sans-Pro/sourcesanspro-light-webfont.eot +0 -0
- package/docs/fonts/Source-Sans-Pro/sourcesanspro-light-webfont.svg +978 -0
- package/docs/fonts/Source-Sans-Pro/sourcesanspro-light-webfont.ttf +0 -0
- package/docs/fonts/Source-Sans-Pro/sourcesanspro-light-webfont.woff +0 -0
- package/docs/fonts/Source-Sans-Pro/sourcesanspro-light-webfont.woff2 +0 -0
- package/docs/fonts/Source-Sans-Pro/sourcesanspro-regular-webfont.eot +0 -0
- package/docs/fonts/Source-Sans-Pro/sourcesanspro-regular-webfont.svg +1049 -0
- package/docs/fonts/Source-Sans-Pro/sourcesanspro-regular-webfont.ttf +0 -0
- package/docs/fonts/Source-Sans-Pro/sourcesanspro-regular-webfont.woff +0 -0
- package/docs/fonts/Source-Sans-Pro/sourcesanspro-regular-webfont.woff2 +0 -0
- package/docs/getDefAxis.mjs.html +157 -0
- package/docs/getDefChart.mjs.html +123 -0
- package/docs/getDefLegend.mjs.html +115 -0
- package/docs/getDefOpt.mjs.html +137 -0
- package/docs/global.html +1088 -0
- package/docs/index.html +84 -0
- package/docs/module-WBar.html +216 -0
- package/docs/module-WPie.html +216 -0
- package/docs/module-WPlot.html +216 -0
- package/docs/module-WRose.html +216 -0
- package/docs/scripts/collapse.js +39 -0
- package/docs/scripts/commonNav.js +28 -0
- package/docs/scripts/linenumber.js +25 -0
- package/docs/scripts/nav.js +12 -0
- package/docs/scripts/polyfill.js +4 -0
- package/docs/scripts/prettify/Apache-License-2.0.txt +202 -0
- package/docs/scripts/prettify/lang-css.js +2 -0
- package/docs/scripts/prettify/prettify.js +28 -0
- package/docs/scripts/search.js +99 -0
- package/docs/setLegendLoc.mjs.html +176 -0
- package/docs/styles/jsdoc.css +776 -0
- package/docs/styles/prettify.css +80 -0
- package/g.mjs +0 -0
- package/package.json +68 -0
- package/public/index.html +38 -0
- package/src/App.vue +118 -0
- package/src/AppZoneWBar.vue +1454 -0
- package/src/AppZoneWPie.vue +324 -0
- package/src/AppZoneWPlot.vue +78 -0
- package/src/AppZoneWRose.vue +735 -0
- package/src/components/WBar.vue +107 -0
- package/src/components/WGeoVue.vue +18 -0
- package/src/components/WPie.vue +107 -0
- package/src/components/WPlot.vue +86 -0
- package/src/components/WRose.vue +107 -0
- package/src/components/demolink.vue +105 -0
- package/src/js/genBarOpt.mjs +303 -0
- package/src/js/genPieOpt.mjs +233 -0
- package/src/js/genRoseOpt.mjs +297 -0
- package/src/js/getDefAxis.mjs +85 -0
- package/src/js/getDefChart.mjs +51 -0
- package/src/js/getDefLegend.mjs +43 -0
- package/src/js/getDefOpt.mjs +65 -0
- package/src/js/setLegendLoc.mjs +104 -0
- package/src/main.js +8 -0
- package/test/all.test.mjs +10 -0
- package/toolg/addVersion.mjs +4 -0
- package/toolg/cleanFolder.mjs +4 -0
- package/toolg/cvCasename.mjs +43 -0
- package/toolg/gDistApp.mjs +38 -0
- package/toolg/gDistRollupComps.mjs +21 -0
- package/toolg/gDocExams.mjs +47 -0
- package/toolg/gExtractHtml.mjs +263 -0
- package/toolg/gMergeComps.mjs +75 -0
- package/toolg/modifyReadme.mjs +4 -0
- package/vue.config.js +21 -0
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import map from 'lodash-es/map'
|
|
2
|
+
import trim from 'lodash-es/trim'
|
|
3
|
+
import filter from 'lodash-es/filter'
|
|
4
|
+
import toUpper from 'lodash-es/toUpper'
|
|
5
|
+
import split from 'lodash-es/split'
|
|
6
|
+
import size from 'lodash-es/size'
|
|
7
|
+
import join from 'lodash-es/join'
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
function seCut(str) {
|
|
11
|
+
|
|
12
|
+
//split
|
|
13
|
+
let s = split(str, '&')
|
|
14
|
+
|
|
15
|
+
//trim
|
|
16
|
+
s = map(s, function(v) {
|
|
17
|
+
return trim(v)
|
|
18
|
+
})
|
|
19
|
+
|
|
20
|
+
//n
|
|
21
|
+
let n = size(s)
|
|
22
|
+
n = Math.min(4, n)
|
|
23
|
+
|
|
24
|
+
//r
|
|
25
|
+
let r = []
|
|
26
|
+
for (let i = 0; i < n; i++) {
|
|
27
|
+
r.push(s[i])
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
//join
|
|
31
|
+
let c = join(r, '_')
|
|
32
|
+
|
|
33
|
+
return c
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
function cvCasename(casename) {
|
|
38
|
+
//return seEncode(casename)
|
|
39
|
+
return seCut(casename)
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
export default cvCasename
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import rollupVueToHtml from 'w-package-tools/src/rollupVueToHtml.mjs'
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
let opt = {
|
|
5
|
+
title: `w-plot-vue`,
|
|
6
|
+
head: `
|
|
7
|
+
|
|
8
|
+
<!-- rollupVueToHtml已自動添加@babel/polyfill與vue -->
|
|
9
|
+
|
|
10
|
+
<!-- fontawesome -->
|
|
11
|
+
<link href="https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free@6.4.2/css/all.min.css" rel="stylesheet">
|
|
12
|
+
|
|
13
|
+
<!-- mdi, 各組件使用mdi/js故不需引用 -->
|
|
14
|
+
<link _href="https://cdn.jsdelivr.net/npm/@mdi/font@7.2.96/css/materialdesignicons.min.css" rel="stylesheet">
|
|
15
|
+
|
|
16
|
+
<!-- google, 各組件使用mdi/js故不需引用 -->
|
|
17
|
+
<link _href="https://fonts.googleapis.com/css?family=Roboto:100,300,400,500,700,900" rel="stylesheet">
|
|
18
|
+
<link _href="https://fonts.googleapis.com/css?family=Material+Icons" rel="stylesheet">
|
|
19
|
+
|
|
20
|
+
<!-- data -->
|
|
21
|
+
<script src="https://cdn.jsdelivr.net/npm/w-demores@1.0.23/res/data/dataAAPL.js"></script>
|
|
22
|
+
<script src="https://cdn.jsdelivr.net/npm/w-demores@1.0.23/res/data/dataUSD2EUR.js"></script>
|
|
23
|
+
<script src="https://cdn.jsdelivr.net/npm/w-demores@1.0.23/res/data/dataTemperature.js"></script>
|
|
24
|
+
<script src="https://cdn.jsdelivr.net/npm/w-demores@1.0.23/res/data/dataHousePriceArea.js"></script>
|
|
25
|
+
<script src="https://cdn.jsdelivr.net/npm/w-demores@1.0.23/res/data/dataFlare.js"></script>
|
|
26
|
+
<script src="https://cdn.jsdelivr.net/npm/w-demores@1.0.23/res/data/dataRain.js"></script>
|
|
27
|
+
<script src="https://cdn.jsdelivr.net/npm/w-demores@1.0.23/res/data/dataRainClip.js"></script>
|
|
28
|
+
|
|
29
|
+
`,
|
|
30
|
+
globals: {
|
|
31
|
+
'vue': 'Vue', //因動態加載組件, 現統一使用window內Vue, 故此處不打包進來, 若vue-cli則自動將Vue關聯至window內的Vue
|
|
32
|
+
},
|
|
33
|
+
external: [
|
|
34
|
+
'vue',
|
|
35
|
+
],
|
|
36
|
+
}
|
|
37
|
+
rollupVueToHtml('./src/App.vue', './docs/examples/app.html', opt)
|
|
38
|
+
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import _ from 'lodash-es'
|
|
2
|
+
import rollupFiles from 'w-package-tools/src/rollupFiles.mjs'
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
let fdSrc = './src/components/'
|
|
6
|
+
let fdTar = './dist'
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
rollupFiles({
|
|
10
|
+
fns: 'WGeoVue.vue',
|
|
11
|
+
fdSrc,
|
|
12
|
+
fdTar,
|
|
13
|
+
nameDistType: 'kebabCase',
|
|
14
|
+
globals: {
|
|
15
|
+
'vue': 'Vue', //因動態加載組件, 現統一使用window內Vue, 故此處不打包進來, 若vue-cli則自動將Vue關聯至window內的Vue
|
|
16
|
+
},
|
|
17
|
+
external: [
|
|
18
|
+
'vue',
|
|
19
|
+
],
|
|
20
|
+
})
|
|
21
|
+
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import fs from 'fs'
|
|
2
|
+
import _ from 'lodash-es'
|
|
3
|
+
import getFiles from 'w-package-tools/src/getFiles.mjs'
|
|
4
|
+
import getPks from 'w-package-tools/src/getPks.mjs'
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
let fdSrc = './test-html/'
|
|
8
|
+
let fdTar = './docs/examples/'
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
function main() {
|
|
12
|
+
//把example裡面cdn更換, 再複製到docs的example內, 作為日後發佈為靜態網站
|
|
13
|
+
|
|
14
|
+
//pks
|
|
15
|
+
let pks = getPks()
|
|
16
|
+
|
|
17
|
+
//cdn
|
|
18
|
+
let cdn = `<script src="https://cdn.jsdelivr.net/npm/w-plot-vue@${pks.version}/dist/w-plot-vue.umd.js"></script>`
|
|
19
|
+
|
|
20
|
+
//mkdirSync
|
|
21
|
+
if (!fs.existsSync(fdTar)) {
|
|
22
|
+
fs.mkdirSync(fdTar)
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
//getFiles
|
|
26
|
+
let ltfs = getFiles(fdSrc)
|
|
27
|
+
|
|
28
|
+
_.each(ltfs, function(v) {
|
|
29
|
+
|
|
30
|
+
//fn
|
|
31
|
+
let fn = fdSrc + v
|
|
32
|
+
|
|
33
|
+
//c
|
|
34
|
+
let c = fs.readFileSync(fn, 'utf8')
|
|
35
|
+
|
|
36
|
+
//replace
|
|
37
|
+
let r = `<script src="../dist/w-plot-vue.umd.js"></script>`
|
|
38
|
+
c = c.replace(r, cdn)
|
|
39
|
+
|
|
40
|
+
//write
|
|
41
|
+
//console.log(c)
|
|
42
|
+
fs.writeFileSync(fdTar + v, c, 'utf8')
|
|
43
|
+
|
|
44
|
+
})
|
|
45
|
+
|
|
46
|
+
}
|
|
47
|
+
main()
|
|
@@ -0,0 +1,263 @@
|
|
|
1
|
+
import fs from 'fs'
|
|
2
|
+
import * as cheerio from 'cheerio'
|
|
3
|
+
import _ from 'lodash-es'
|
|
4
|
+
import w from 'wsemi'
|
|
5
|
+
import getFiles from 'w-package-tools/src/getFiles.mjs'
|
|
6
|
+
import cleanFolder from 'w-package-tools/src/cleanFolder.mjs'
|
|
7
|
+
import parseVueCode from 'w-package-tools/src/parseVueCode.mjs'
|
|
8
|
+
import kebabPropsVueTemp from 'w-package-tools/src/kebabPropsVueTemp.mjs'
|
|
9
|
+
import extractHtml from 'w-package-tools/src/extractHtml.mjs'
|
|
10
|
+
import cvCasename from './cvCasename.mjs'
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
let fdSrc = './src/'
|
|
14
|
+
let fdTestHtml = './test-html/'
|
|
15
|
+
let fdTestSrc = './test-action/'
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
let $setting = {
|
|
19
|
+
//ignoreWhitespace: true,
|
|
20
|
+
xmlMode: false, //不能設定true, 否則會導致vue組件名稱變成self-closing, 此於瀏覽器指定html5規範下無法解析
|
|
21
|
+
decodeEntities: false,
|
|
22
|
+
// recognizeSelfClosing: false, //若xmlMode為true則recognizeSelfClosing必定為true
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
function writeHtml(v) {
|
|
27
|
+
|
|
28
|
+
function getAppTmp() {
|
|
29
|
+
|
|
30
|
+
//h
|
|
31
|
+
let h = v.tmp
|
|
32
|
+
// console.log('h', w.strleft(h, 100) + '...')
|
|
33
|
+
|
|
34
|
+
//$
|
|
35
|
+
let $ = cheerio.load(h, $setting)
|
|
36
|
+
|
|
37
|
+
//移除demolink
|
|
38
|
+
$('demolink').remove()
|
|
39
|
+
|
|
40
|
+
//於bk前插入, 添加組件kbname
|
|
41
|
+
$('div.bk').before(`<div class="head1"><span style="cursor:pointer;" title="open for copy link to view component" onclick="window.open('//yuda-lyu.github.io/w-plot-vue/examples/app.html?cmp='+this.innerText,'_blank')">${v.kbname}</span></div>`)
|
|
42
|
+
|
|
43
|
+
//於bk內插入, 添加範例casename
|
|
44
|
+
$('div.bk').prepend(`<div class="item">${v.casename}</div>`)
|
|
45
|
+
|
|
46
|
+
//to html
|
|
47
|
+
h = $('body').html()
|
|
48
|
+
// console.log('getAppTmp', w.strleft(h, 100) + '...')
|
|
49
|
+
|
|
50
|
+
return h
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
function procHtml(h) {
|
|
54
|
+
|
|
55
|
+
//replace mdi-icon
|
|
56
|
+
let r = `mdi[A-Za-z]+` //有些mdi是放在元素attr內, 有些是放在vue data內, 故不能包含雙引號(限定attr)查找
|
|
57
|
+
let reg = new RegExp(r, 'g')
|
|
58
|
+
let mdis = h.match(reg)
|
|
59
|
+
if (mdis) {
|
|
60
|
+
_.each(mdis, (mdi) => {
|
|
61
|
+
let c = mdi
|
|
62
|
+
c = _.kebabCase(c) //轉kebab
|
|
63
|
+
c = `'${c}'` //添加單引號成為字串
|
|
64
|
+
h = h.replace(mdi, c) //取代
|
|
65
|
+
})
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
return h
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
//opt
|
|
72
|
+
let opt = {
|
|
73
|
+
title: `w-plot-vue`,
|
|
74
|
+
head: `
|
|
75
|
+
|
|
76
|
+
<!-- extractHtml已自動添加@babel/polyfill與vue -->
|
|
77
|
+
|
|
78
|
+
<!-- fontawesome -->
|
|
79
|
+
<link href="https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free@6.4.2/css/all.min.css" rel="stylesheet">
|
|
80
|
+
|
|
81
|
+
<!-- mdi, 各組件使用mdi/js會於轉單頁時改為mdi icon, 故需引用mdi/css -->
|
|
82
|
+
<link href="https://cdn.jsdelivr.net/npm/@mdi/font@7.2.96/css/materialdesignicons.min.css" rel="stylesheet">
|
|
83
|
+
|
|
84
|
+
<!-- google, 各組件使用mdi/js故不需引用 -->
|
|
85
|
+
<link _href="https://fonts.googleapis.com/css?family=Roboto:100,300,400,500,700,900" rel="stylesheet">
|
|
86
|
+
<link _href="https://fonts.googleapis.com/css?family=Material+Icons" rel="stylesheet">
|
|
87
|
+
|
|
88
|
+
<!-- data -->
|
|
89
|
+
<script src="https://cdn.jsdelivr.net/npm/w-demores@1.0.23/res/data/dataAAPL.js"></script>
|
|
90
|
+
<script src="https://cdn.jsdelivr.net/npm/w-demores@1.0.23/res/data/dataUSD2EUR.js"></script>
|
|
91
|
+
<script src="https://cdn.jsdelivr.net/npm/w-demores@1.0.23/res/data/dataTemperature.js"></script>
|
|
92
|
+
<script src="https://cdn.jsdelivr.net/npm/w-demores@1.0.23/res/data/dataHousePriceArea.js"></script>
|
|
93
|
+
<script src="https://cdn.jsdelivr.net/npm/w-demores@1.0.23/res/data/dataFlare.js"></script>
|
|
94
|
+
<script src="https://cdn.jsdelivr.net/npm/w-demores@1.0.23/res/data/dataRain.js"></script>
|
|
95
|
+
<script src="https://cdn.jsdelivr.net/npm/w-demores@1.0.23/res/data/dataRainClip.js"></script>
|
|
96
|
+
|
|
97
|
+
<!-- w-plot-vue -->
|
|
98
|
+
<script src="../dist/w-plot-vue.umd.js"></script>
|
|
99
|
+
|
|
100
|
+
<style>
|
|
101
|
+
.v-application--wrap {
|
|
102
|
+
/* width與max-width fix for IE11, 其外不能使用padding或margin避免失效 */
|
|
103
|
+
width: 100vw;
|
|
104
|
+
max-width: 100vw;
|
|
105
|
+
font-family: inherit;
|
|
106
|
+
background: #fff;
|
|
107
|
+
}
|
|
108
|
+
.item { /* 因item位於demolink, 提取各範例html後會刪除demolink, 故得額外補上 */
|
|
109
|
+
border-left: 3px solid #ffba75;
|
|
110
|
+
margin: 5px 5px 8px 0px;
|
|
111
|
+
padding: 3px 3px 5px 10px;
|
|
112
|
+
font-size: 0.9rem;
|
|
113
|
+
display: flex;
|
|
114
|
+
justify-content: flex-start;
|
|
115
|
+
align-items: center;
|
|
116
|
+
}
|
|
117
|
+
.head1 {
|
|
118
|
+
margin: 0px;
|
|
119
|
+
padding: 0px 0px 20px 0px;
|
|
120
|
+
font-size: 2.5rem;
|
|
121
|
+
}
|
|
122
|
+
.bk {
|
|
123
|
+
vertical-align: top;
|
|
124
|
+
padding: 10px 0px 60px 0px;
|
|
125
|
+
}
|
|
126
|
+
@media screen and (min-width:1000px){ /* 寬版 */
|
|
127
|
+
.bk {
|
|
128
|
+
display: inline-block;
|
|
129
|
+
margin: 0px 80px 0px 0px;
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
</style>
|
|
133
|
+
|
|
134
|
+
`,
|
|
135
|
+
appTag: `v-app`,
|
|
136
|
+
appStyle: `font-family:inherit; padding:0px 30px;`,
|
|
137
|
+
appTmp: getAppTmp(),
|
|
138
|
+
installVue: `Vue.use(window['w-plot-vue'])`,
|
|
139
|
+
data: v.data,
|
|
140
|
+
mounted: v.mounted,
|
|
141
|
+
computed: v.computed,
|
|
142
|
+
methods: v.methods,
|
|
143
|
+
action: v.action,
|
|
144
|
+
procHtml,
|
|
145
|
+
fpHtml: `${fdTestHtml}${v.fn}.html`,
|
|
146
|
+
fpAction: `${fdTestSrc}${v.fn}.action.json`,
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
//extractHtml
|
|
150
|
+
extractHtml(opt)
|
|
151
|
+
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
|
|
155
|
+
function extractAppZone(fn) {
|
|
156
|
+
|
|
157
|
+
//read
|
|
158
|
+
let hh = fs.readFileSync(fn, 'utf8')
|
|
159
|
+
// console.log('hh', hh)
|
|
160
|
+
|
|
161
|
+
//parseVueCode
|
|
162
|
+
let { tmp, data, mounted, computed, methods, action } = parseVueCode(hh)
|
|
163
|
+
|
|
164
|
+
//vue屬性轉kebab, 記得要在cheerio處理前, 否則attr都會被改成小寫
|
|
165
|
+
tmp = kebabPropsVueTemp(tmp)
|
|
166
|
+
tmp = w.replace(tmp, `=""`, '')
|
|
167
|
+
// console.log('tmp', w.strleft(tmp, 100) + '...')
|
|
168
|
+
|
|
169
|
+
//$
|
|
170
|
+
let $ = cheerio.load(tmp, $setting)
|
|
171
|
+
// console.log(`$('div.bk').html()`, w.strleft($('div.bk').html(), 100) + '...')
|
|
172
|
+
|
|
173
|
+
//name
|
|
174
|
+
let name = fn.split('AppZone')
|
|
175
|
+
name = name[1]
|
|
176
|
+
name = name.replace('.vue', '')
|
|
177
|
+
|
|
178
|
+
//clear data
|
|
179
|
+
let ss = data.split('\r\n')
|
|
180
|
+
ss = _.filter(ss, (s) => {
|
|
181
|
+
return s.indexOf(' mdi') < 0 //去除@mdi/js icon
|
|
182
|
+
})
|
|
183
|
+
ss = _.map(ss, (v, k) => {
|
|
184
|
+
if (k === 0) {
|
|
185
|
+
return v
|
|
186
|
+
}
|
|
187
|
+
return ` ${v}`
|
|
188
|
+
})
|
|
189
|
+
data = ss.join('\r\n')
|
|
190
|
+
//console.log('data', data)
|
|
191
|
+
|
|
192
|
+
function getAttr(h, name) {
|
|
193
|
+
// console.log('getAttr', h, name)
|
|
194
|
+
let $ = cheerio.load(h, $setting)
|
|
195
|
+
let c = $('demolink').attr(':' + name)
|
|
196
|
+
c = w.replace(c, `\'`, '')
|
|
197
|
+
return c
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
//取各個bk, 先於各bk外層添加shell在取html, 才能取到bk含自己的html
|
|
201
|
+
$('div.bk').wrap('<div class="shell"></div>')
|
|
202
|
+
$('div.shell').map((i, v) => {
|
|
203
|
+
// console.log('v', v)
|
|
204
|
+
|
|
205
|
+
//me
|
|
206
|
+
let me = $(v)
|
|
207
|
+
// console.log(i, 'me', me)
|
|
208
|
+
|
|
209
|
+
//tmp
|
|
210
|
+
let tmp = me.html()
|
|
211
|
+
// console.log(i, 'tmp', tmp)
|
|
212
|
+
|
|
213
|
+
//ss
|
|
214
|
+
let kbname = getAttr(tmp, 'kbname')
|
|
215
|
+
let casename = getAttr(tmp, 'casename')
|
|
216
|
+
// console.log(i, kbname, ',', casename)
|
|
217
|
+
|
|
218
|
+
//fn
|
|
219
|
+
let fnc = `${casename}`
|
|
220
|
+
let fn = `${kbname}_${cvCasename(fnc)}`
|
|
221
|
+
|
|
222
|
+
//writeHtml
|
|
223
|
+
writeHtml({ name, kbname, casename, tmp, data, mounted, computed, methods, action, fn })
|
|
224
|
+
|
|
225
|
+
})
|
|
226
|
+
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
|
|
230
|
+
function main() {
|
|
231
|
+
//由jsdoc產製之wsemi.html, 自動添加將example轉換成codepen線上編輯功能
|
|
232
|
+
|
|
233
|
+
//fdTestHtml
|
|
234
|
+
cleanFolder(fdTestHtml)
|
|
235
|
+
//fs.mkdirSync(fdTestHtml)
|
|
236
|
+
//await fs.promises.mkdir(fdTestHtml)
|
|
237
|
+
|
|
238
|
+
//fdTestSrc
|
|
239
|
+
cleanFolder(fdTestSrc)
|
|
240
|
+
//fs.mkdirSync(fdTestSrc)
|
|
241
|
+
//await fs.promises.mkdir(fdTestSrc)
|
|
242
|
+
|
|
243
|
+
//getFiles
|
|
244
|
+
let ltfs = getFiles(fdSrc)
|
|
245
|
+
|
|
246
|
+
//filter
|
|
247
|
+
ltfs = _.filter(ltfs, (v) => {
|
|
248
|
+
return v.indexOf('AppZone') >= 0
|
|
249
|
+
})
|
|
250
|
+
// ltfs = [
|
|
251
|
+
// 'AppZoneWJsonView.vue',
|
|
252
|
+
// ]
|
|
253
|
+
// console.log(ltfs)
|
|
254
|
+
|
|
255
|
+
//extractAppZone
|
|
256
|
+
_.each(ltfs, (v) => {
|
|
257
|
+
let fn = fdSrc + v
|
|
258
|
+
console.log('extracting: ' + fn)
|
|
259
|
+
extractAppZone(fn)
|
|
260
|
+
})
|
|
261
|
+
|
|
262
|
+
}
|
|
263
|
+
main()
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import _ from 'lodash-es'
|
|
2
|
+
import fs from 'fs'
|
|
3
|
+
import w from 'wsemi'
|
|
4
|
+
import getFiles from 'w-package-tools/src/getFiles.mjs'
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
let fdSrc = './src/components/'
|
|
8
|
+
let fn_tar = 'WGeoVue.vue'
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
function main() {
|
|
12
|
+
//讀取components裡面組件, 自動生成WGeoVue, 供rollup打包整體組件
|
|
13
|
+
|
|
14
|
+
//getFiles
|
|
15
|
+
let ltfs = getFiles(fdSrc)
|
|
16
|
+
_.pull(ltfs, fn_tar)
|
|
17
|
+
_.pull(ltfs, 'demolink.vue')
|
|
18
|
+
|
|
19
|
+
//c1, c2
|
|
20
|
+
let c1 = []
|
|
21
|
+
let c2 = []
|
|
22
|
+
_.each(ltfs, function(v) {
|
|
23
|
+
|
|
24
|
+
//name_all
|
|
25
|
+
let name_all = v
|
|
26
|
+
|
|
27
|
+
//s
|
|
28
|
+
let s = _.split(v, '.')
|
|
29
|
+
|
|
30
|
+
//name_ori
|
|
31
|
+
let name_ori = s[0]
|
|
32
|
+
|
|
33
|
+
//name_ext
|
|
34
|
+
let name_ext = s[1]
|
|
35
|
+
|
|
36
|
+
//name_ori, name_kb
|
|
37
|
+
let name_kb = _.kebabCase(name_ori)
|
|
38
|
+
|
|
39
|
+
//c1
|
|
40
|
+
c1.push(`import ${name_ori} from './${name_all}'`)
|
|
41
|
+
|
|
42
|
+
//c2
|
|
43
|
+
if (name_ext === 'vue') {
|
|
44
|
+
c2.push(` Vue.component('${name_kb}', ${name_ori})`)
|
|
45
|
+
}
|
|
46
|
+
else if (name_ext === 'mjs') {
|
|
47
|
+
let funName = _.toLower(name_ori)
|
|
48
|
+
funName = '$' + w.strdelleft(funName, 1)
|
|
49
|
+
c2.push(` Vue.prototype.${funName} = ${name_ori}`)
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
})
|
|
53
|
+
|
|
54
|
+
//c
|
|
55
|
+
let c =
|
|
56
|
+
`<script>
|
|
57
|
+
${_.join(c1, '\r\n')}
|
|
58
|
+
|
|
59
|
+
let WGeoVue = {
|
|
60
|
+
install: function(Vue) {
|
|
61
|
+
${_.join(c2, '\r\n')}
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
export default WGeoVue
|
|
66
|
+
</script>
|
|
67
|
+
|
|
68
|
+
`
|
|
69
|
+
|
|
70
|
+
//write
|
|
71
|
+
//console.log(c)
|
|
72
|
+
fs.writeFileSync(fdSrc + fn_tar, c, 'utf8')
|
|
73
|
+
|
|
74
|
+
}
|
|
75
|
+
main()
|
package/vue.config.js
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
module.exports = {
|
|
2
|
+
lintOnSave: false, //禁止eslint-loader於編譯時檢查語法
|
|
3
|
+
devServer: {
|
|
4
|
+
proxy: {
|
|
5
|
+
'/api': {
|
|
6
|
+
target: 'http://localhost:9000',
|
|
7
|
+
pathRewrite: {
|
|
8
|
+
'^/api': '/api'
|
|
9
|
+
},
|
|
10
|
+
},
|
|
11
|
+
'/swdoc': {
|
|
12
|
+
target: 'http://localhost:9000',
|
|
13
|
+
pathRewrite: {
|
|
14
|
+
'^/swdoc': '/swdoc'
|
|
15
|
+
},
|
|
16
|
+
},
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
//transpileDependencies: ['abc'],
|
|
20
|
+
//publicPath: process.env.NODE_ENV === 'production' ? '/abc/' : '/',
|
|
21
|
+
}
|