+ :style="{ minWidth }"
+ >
@@ -42,6 +42,7 @@
this.$on('updatePopper', () => {
this.$parent.visible && this.updatePopper()
})
+ this.$on('destroyPopper', this.destroyPopper)
}
}
diff --git a/vue/element-ui-personal/index.js b/vue/element-ui-personal/index.js
new file mode 100644
index 0000000..6612258
--- /dev/null
+++ b/vue/element-ui-personal/index.js
@@ -0,0 +1,13 @@
+import Message from "./components/Message"
+import Popover from './components/Popover'
+import Select from './components/Select/Select'
+
+const components = [Popover, Select]
+
+export default function (Vue) {
+ components.forEach(component => {
+ Vue.component(component.name, component)
+ })
+
+ Vue.prototype.$message = Message
+}
diff --git a/vue/element-ui-personal/mixins/vue-popper.js b/vue/element-ui-personal/mixins/vue-popper.js
index 4bdea74..bc2efca 100644
--- a/vue/element-ui-personal/mixins/vue-popper.js
+++ b/vue/element-ui-personal/mixins/vue-popper.js
@@ -1,51 +1,33 @@
import {PopupManager} from 'element-ui/lib/utils/popup'
-const PopperJS = require('@popperjs/core')
+import PopperJS from 'popper.js'
+//import * as PopperJS from '@popperjs/core'
+
+const POPPER_VERSION = 'v1'
+
+if (POPPER_VERSION === 'v2') {
+ console.warn = () => ({})
+}
const stop = e => e.stopPropagation()
-/**
- * @param {HTMLElement} [reference=$refs.reference] - The reference element used to position the popper.
- * @param {HTMLElement} [popper=$refs.popper] - The HTML element used as popper, or a configuration used to generate the popper.
- * @param {String} [placement=button] - Placement of the popper accepted values: top(-start, -end), right(-start, -end), bottom(-start, -end), left(-start, -end)
- * @param {Number} [offset=0] - Amount of pixels the popper will be shifted (can be negative).
- * @param {Boolean} [visible=false] Visibility of the popup element.
- * @param {Boolean} [visible-arrow=false] Visibility of the arrow, no style.
- */
+const defaultOptions = () => {
+ return POPPER_VERSION === 'v2' ? {modifiers: []} : {modifiers: {computeStyle: {gpuAcceleration: false}}}
+}
+
export default {
props: {
- transformOrigin: {
- type: [Boolean, String],
- default: true
- },
- placement: {
- type: String,
- default: 'bottom'
- },
- boundariesPadding: {
- type: Number,
- default: 5
- },
+ transformOrigin: {type: [Boolean, String], default: true},
+ placement: {type: String, default: 'bottom'},
+ boundariesPadding: {type: Number, default: 5},
reference: {},
popper: {},
- offset: {
- type: Number,
- default: 12
- },
+ offset: {type: Number, default: POPPER_VERSION === 'v2' ? 12 : 0},
value: Boolean,
- visibleArrow: {
- type: Boolean,
- default: true
- },
- arrowOffset: {
- type: Number,
- default: 35
- },
- appendToBody: Boolean,
- popperOptions: {
- type: Object,
- default: () => ({modifiers: []})
- }
+ visibleArrow: {type: Boolean, default: true},
+ arrowOffset: {type: Number, default: 35},
+ appendToBody: {type: Boolean, default: true},
+ popperOptions: {type: Object, default: defaultOptions}
},
data() {
@@ -58,10 +40,10 @@ export default {
value: {
immediate: true,
handler(val) {
- if (this.disabled) return
- val && this.updatePopper()
this.showPopper = val
this.$emit('input', val)
+ if (this.disabled) return
+ val && this.updatePopper()
}
}
},
@@ -88,16 +70,19 @@ export default {
if (this.appendToBody) document.body.appendChild(this.popperElm)
if (this.visibleArrow) this.setArrow()
- this.setOffset()
+ this.setOffset(options)
options.placement = this.placement
- options.onFirstUpdate = () => {
+ const createEvent = POPPER_VERSION === 'v2' ? 'onFirstUpdate' : 'onCreate'
+ options[createEvent] = () => {
this.$emit('created', this)
+ this.resetTransformOrigin()
this.$nextTick(this.updatePopper)
}
-
- this.popperJS = PopperJS.createPopper(reference, popper, options)
+ this.popperJS = POPPER_VERSION === 'v2' ?
+ PopperJS.createPopper(reference, popper, options)
+ : new PopperJS(reference, popper, options)
popper.style.zIndex = PopupManager.nextZIndex()
this.popperElm.addEventListener('click', stop)
@@ -118,46 +103,64 @@ export default {
this.popperJS = null
},
+ destroyPopper() {
+ this.popperJS && this.resetTransformOrigin()
+ },
+
+ setOffset(options) {
+ if (POPPER_VERSION === 'v2') {
+ const modifier = this.popperOptions.modifiers.find(modifier => modifier.name === 'offset'),
+ offset = {offset: [0, this.offset]}
+
+ if (!modifier) {
+ this.popperOptions.modifiers.push({name: 'offset', options: offset})
+ }
+ else modifier.options = offset
+ }
+ else {
+ if (!options.modifiers.offset) {
+ options.modifiers.offset = {}
+ }
+ options.modifiers.offset.offset = this.offset
+ }
+ },
+
setArrow() {
if (this.appended) return
this.appended = true
const arrow = document.createElement('div')
arrow.className = 'popper__arrow'
- arrow.setAttribute('data-popper-arrow', '')
+ arrow.setAttribute(POPPER_VERSION === 'v2' ? 'data-popper-arrow' : 'x-arrow', '')
+ const attributes = this.popperElm.attributes
+ const key = Object.keys(attributes).find(key => /^_v-/.test(attributes[key].name))
+ if (key) arrow.setAttribute(attributes[key].name, '')
this.popperElm.appendChild(arrow)
-
- const modifier = this.popperOptions.modifiers.find(modifier => modifier.name === 'arrow'),
- options = {element: '[data-popper-arrow]', padding: this.arrowOffset}
-
- if (!modifier) {
- this.popperOptions.modifiers.push({name: 'arrow', options})
- }
- else modifier.options = options
},
- setOffset() {
- const modifier = this.popperOptions.modifiers.find(modifier => modifier.name === 'offset'),
- options = {offset: [0, this.offset]}
-
- if (!modifier) {
- this.popperOptions.modifiers.push({name: 'offset', options})
- }
- else modifier.options = options
+ resetTransformOrigin() {
+ if (!this.transformOrigin) return
+ const placementMap = {top: 'bottom', bottom: 'top', left: 'right', right: 'left'}
+ const attr = POPPER_VERSION === 'v2' ? 'data-popper-placement' : 'x-placement'
+ const placement = this.popperElm.getAttribute(attr).split('-')[0]
+ const origin = placementMap[placement]
+ this.popperElm.style.transformOrigin =
+ typeof this.transformOrigin === 'string'
+ ? this.transformOrigin
+ : ['top', 'bottom'].includes(placement) ? `center ${origin}` : `${origin} center`
}
},
+ deactivated() {
+ this.$options.beforeDestroy[0].call(this)
+ },
+
beforeDestroy() {
this.doDestroy(true)
if (this.popperElm && this.popperElm.parentNode === document.body) {
this.popperElm.removeEventListener('click', stop)
document.body.removeChild(this.popperElm)
}
- },
-
- // call destroy in keep-alive mode
- deactivated() {
- this.$options.beforeDestroy[0].call(this)
}
}
diff --git a/vue/package-lock.json b/vue/package-lock.json
index 9b2193d..be6f6f2 100644
--- a/vue/package-lock.json
+++ b/vue/package-lock.json
@@ -1135,9 +1135,9 @@
"dev": true
},
"@popperjs/core": {
- "version": "2.4.0",
- "resolved": "https://registry.npmjs.org/@popperjs/core/-/core-2.4.0.tgz",
- "integrity": "sha512-NMrDy6EWh9TPdSRiHmHH2ye1v5U0gBD7pRYwSwJvomx7Bm4GG04vu63dYiVzebLOx2obPpJugew06xVP0Nk7hA=="
+ "version": "2.4.1",
+ "resolved": "https://registry.npmjs.org/@popperjs/core/-/core-2.4.1.tgz",
+ "integrity": "sha512-hdRh4Xul0S4VVJz8/T2EXuaVGnRp+bC/AksVp2DGtmvE4X4OKYsiZC4H2PlZmVhJZT58KFb5+xIog8BE3hpiSA=="
},
"@soda/friendly-errors-webpack-plugin": {
"version": "1.7.1",
@@ -8416,6 +8416,11 @@
"ts-pnp": "^1.1.6"
}
},
+ "popper.js": {
+ "version": "1.16.1",
+ "resolved": "https://registry.npmjs.org/popper.js/-/popper.js-1.16.1.tgz",
+ "integrity": "sha512-Wb4p1J4zyFTbM+u6WuO4XstYx4Ky9Cewe4DWrel7B0w6VVICvPwdOpotjzcf6eD8TsckVnIMNONQyPIUFOUbCQ=="
+ },
"portfinder": {
"version": "1.0.26",
"resolved": "https://registry.npmjs.org/portfinder/-/portfinder-1.0.26.tgz",
diff --git a/vue/package.json b/vue/package.json
index 48c0d59..f4e5eed 100644
--- a/vue/package.json
+++ b/vue/package.json
@@ -8,7 +8,7 @@
"svgo": "svgo -f src/assets/icons/svg --config=src/assets/icons/svgo.yml"
},
"dependencies": {
- "@popperjs/core": "^2.4.0",
+ "@popperjs/core": "^2.4.1",
"axios": "^0.19.2",
"core-js": "^3.6.5",
"decimal.js": "^10.2.0",
@@ -19,6 +19,7 @@
"nprogress": "^0.2.0",
"pako": "^1.0.11",
"path-to-regexp": "^6.1.0",
+ "popper.js": "^1.16.1",
"socket.io-client": "^2.3.0",
"v-viewer": "^1.5.1",
"vue": "^2.6.11",
diff --git a/vue/src/assets/styles/element-ui.scss b/vue/src/assets/styles/element-ui.scss
index bc48d07..b79a82a 100644
--- a/vue/src/assets/styles/element-ui.scss
+++ b/vue/src/assets/styles/element-ui.scss
@@ -19,54 +19,64 @@
}
}
-.el-form {
- .el-row {
- display: flex;
- flex-direction: row;
- flex-wrap: wrap;
+.el-card {
+ .el-card__body {
+ height: 100%;
}
-}
-.el-table {
- thead {
- color: rgba(0, 0, 0, .85)
+ .el-card__header + .el-card__body {
+ height: calc(100% - 55px);
}
+}
- thead > tr > th {
- background: #fbfbfb;
- }
+.el-date-editor.el-input,
+.el-date-editor--daterange {
+ width: 100% !important;
+}
- .el-table__body tr.current-row > td {
- background-color: $--color-primary;
- color: #fff;
+.el-dialog {
+ @include deep-shadow;
- .el-table__expand-icon {
- color: #fff;
+ margin-bottom: 0;
+ min-width: 384px;
+
+ .el-dialog__header {
+ border-bottom: 1px solid #ebeef5;
+ padding: 17px;
+
+ .el-dialog__title {
+ line-height: inherit;
+ color: inherit;
+ font-size: inherit;
}
- }
-}
-.el-pagination {
- padding-top: 20px;
-}
+ .el-dialog__headerbtn {
+ top: 18px;
+ }
+ }
-.el-scrollbar {
- height: 100%;
+ .el-dialog__footer {
+ border-top: 1px solid #ebeef5;
+ padding: 10px 16px;
+ }
.el-scrollbar__wrap {
- -webkit-overflow-scrolling: touch;
+ //53 for dialog header,53 for dialog footer,100 for up+down
+ max-height: calc(100vh - 53px - 53px - 100px);
}
}
-.el-tree {
- &.el-tree--highlight-current .el-tree-node.is-current > .el-tree-node__content {
- background-color: $--color-primary;
- color: #fff;
+.el-form {
+ .el-row {
+ display: flex;
+ flex-direction: row;
+ flex-wrap: wrap;
}
}
-.el-select {
- width: 100%;
+.el-loading-mask {
+ background: #fff;
+ color: $--color-primary;
}
.el-message {
@@ -109,45 +119,49 @@
}
}
-.el-card {
- .el-card__body {
- height: 100%;
- }
+.el-pagination {
+ padding-top: 20px;
+ text-align: right;
- .el-card__header + .el-card__body {
- height: calc(100% - 55px);
+ .el-pagination__editor.el-input {
+ margin: 0 5px;
}
}
-.el-dialog {
- @include deep-shadow;
+.el-scrollbar {
+ height: 100%;
- margin-bottom: 0;
- min-width: 384px;
+ .el-scrollbar__wrap {
+ -webkit-overflow-scrolling: touch;
+ }
+}
- .el-dialog__header {
- border-bottom: 1px solid #ebeef5;
- padding: 17px;
+.el-select {
+ width: 100%;
+}
- .el-dialog__title {
- line-height: inherit;
- color: inherit;
- font-size: inherit;
- }
+.el-table {
+ thead {
+ color: rgba(0, 0, 0, .85)
+ }
- .el-dialog__headerbtn {
- top: 18px;
- }
+ thead > tr > th {
+ background: #fbfbfb;
}
- .el-dialog__footer {
- border-top: 1px solid #ebeef5;
- padding: 10px 16px;
+ .el-table__body tr.current-row > td {
+ background-color: $--color-primary;
+ color: #fff;
+
+ .el-table__expand-icon {
+ color: #fff;
+ }
}
+}
- .el-scrollbar__wrap {
- //53 for dialog header,53 for dialog footer,100 for up+down
- max-height: calc(100vh - 53px - 53px - 100px);
+.el-textarea {
+ .el-input__count {
+ background: transparent;
}
}
@@ -172,33 +186,9 @@
}
}
-.el-textarea {
- .el-input__count {
- background: transparent;
- }
-}
-
-.el-pagination {
- text-align: right;
-
- .el-pagination__editor.el-input {
- margin: 0 5px;
+.el-tree {
+ &.el-tree--highlight-current .el-tree-node.is-current > .el-tree-node__content {
+ background-color: $--color-primary;
+ color: #fff;
}
}
-
-.el-loading-mask {
- background: #fff;
- color: $--color-primary;
-}
-
-.el-date-editor.el-input,
-.el-date-editor--daterange {
- width: 100% !important;
-}
-
-
-
-
-
-
-
diff --git a/vue/src/components/LoadingMask/index.vue b/vue/src/components/LoadingMask/index.vue
index 5eae649..dcf5895 100644
--- a/vue/src/components/LoadingMask/index.vue
+++ b/vue/src/components/LoadingMask/index.vue
@@ -13,7 +13,7 @@
- 拼命加载中
+ 加载中...
)
diff --git a/vue/src/components/RegionSelector/Tree.vue b/vue/src/components/RegionSelector/Tree.vue
deleted file mode 100644
index c362b71..0000000
--- a/vue/src/components/RegionSelector/Tree.vue
+++ /dev/null
@@ -1,92 +0,0 @@
-
-
-
-
-
-
- {{limit ? data.name + `(${data.value})` : data.name}}
-
-
-
-
-
-
-
diff --git a/vue/src/components/RegionSelector/Tree/TreeDialog.vue b/vue/src/components/RegionSelector/Tree/TreeDialog.vue
new file mode 100644
index 0000000..afb1a3f
--- /dev/null
+++ b/vue/src/components/RegionSelector/Tree/TreeDialog.vue
@@ -0,0 +1,82 @@
+
diff --git a/vue/src/components/RegionSelector/Tree/index.vue b/vue/src/components/RegionSelector/Tree/index.vue
new file mode 100644
index 0000000..6f4e3ce
--- /dev/null
+++ b/vue/src/components/RegionSelector/Tree/index.vue
@@ -0,0 +1,85 @@
+
diff --git a/vue/src/components/ZoomControl/index.vue b/vue/src/components/ZoomControl/index.vue
index 4f7b5a0..2448f1d 100644
--- a/vue/src/components/ZoomControl/index.vue
+++ b/vue/src/components/ZoomControl/index.vue
@@ -6,7 +6,7 @@
-