n20-common-lib 2.22.82 → 2.22.84
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/package.json +2 -1
- package/src/assets/css/table.scss +1 -3
- package/src/components/DatePicker/por.vue +3 -2
- package/src/components/TablePro/index.js +3 -0
- package/src/components/TablePro/index.vue +5 -0
- package/src/utils/popupZIndex.js +78 -0
- package/style/index.css +1 -1
- package/theme/blue.css +1 -1
- package/theme/cctcRed.css +1 -1
- package/theme/green.css +1 -1
- package/theme/lightBlue.css +1 -1
- package/theme/orange.css +1 -1
- package/theme/purple.css +1 -1
- package/theme/red.css +1 -1
- package/theme/yellow.css +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "n20-common-lib",
|
|
3
|
-
"version": "2.22.
|
|
3
|
+
"version": "2.22.84",
|
|
4
4
|
"private": false,
|
|
5
5
|
"scripts": {
|
|
6
6
|
"serve": "vue-cli-service serve",
|
|
@@ -54,6 +54,7 @@
|
|
|
54
54
|
"axios": "*",
|
|
55
55
|
"dayjs": "*",
|
|
56
56
|
"decimal.js": "^10.5.0",
|
|
57
|
+
"dom-zindex": "^1.0.6",
|
|
57
58
|
"js-cookie": "^3.0.1",
|
|
58
59
|
"jsencrypt": "^3.3.2",
|
|
59
60
|
"jsonwebtoken": "^8.5.1",
|
|
@@ -182,9 +182,7 @@ th.vxe-header--column {
|
|
|
182
182
|
font-weight: $--font-weight-primary;
|
|
183
183
|
}
|
|
184
184
|
|
|
185
|
-
|
|
186
|
-
z-index: 9999 !important;
|
|
187
|
-
}
|
|
185
|
+
// tooltip 使用公共层级动态分配,避免固定值遮挡后打开的弹窗。
|
|
188
186
|
|
|
189
187
|
.cell-default-set-- .vxe-table--body-wrapper .vxe-body--row .vxe-body--column .vxe-cell .vxe-cell--label:empty::before {
|
|
190
188
|
content: '--';
|
|
@@ -73,8 +73,9 @@ let shortcuts_1 = [
|
|
|
73
73
|
text: $lc('最近一周'),
|
|
74
74
|
onClick(picker) {
|
|
75
75
|
const end = new Date()
|
|
76
|
-
const start = new Date()
|
|
77
|
-
|
|
76
|
+
const start = new Date(end.getTime())
|
|
77
|
+
// 最近一周包含今天,按自然日回退 6 天,避免首尾合计 8 天。
|
|
78
|
+
start.setDate(start.getDate() - 6)
|
|
78
79
|
picker.$emit('pick', [start, end])
|
|
79
80
|
}
|
|
80
81
|
},
|
|
@@ -7,6 +7,7 @@ import { formatExchangeRate } from '../../utils/decimal'
|
|
|
7
7
|
import { $lc } from '../../utils/i18n/index.js'
|
|
8
8
|
import zhCN from 'vxe-table/lib/locale/lang/zh-CN'
|
|
9
9
|
import { getColumnField, getRowValue, getVxeCore, setVxeVersion } from './compat.js'
|
|
10
|
+
import installPopupZIndexBridge from '../../utils/popupZIndex'
|
|
10
11
|
|
|
11
12
|
|
|
12
13
|
function getInstalledVxeVersion(vxe) {
|
|
@@ -153,6 +154,8 @@ if (vxeFormats && typeof vxeFormats.mixin === 'function') {
|
|
|
153
154
|
}
|
|
154
155
|
|
|
155
156
|
function install(Vue) {
|
|
157
|
+
// 原生 vxe-table 也接入 Element 弹层的公共层级。
|
|
158
|
+
installPopupZIndexBridge()
|
|
156
159
|
Vue.use(vxeTable)
|
|
157
160
|
}
|
|
158
161
|
|
|
@@ -142,6 +142,7 @@ import empty from '../Empty'
|
|
|
142
142
|
import tableSetSize from '../TableSetSize/index.vue'
|
|
143
143
|
import { $lc } from '../../utils/i18n/index.js'
|
|
144
144
|
import { getColumnField, getEventField, isVxe320OrNewer, normalizeArray } from './compat.js'
|
|
145
|
+
import installPopupZIndexBridge from '../../utils/popupZIndex'
|
|
145
146
|
|
|
146
147
|
/** 将 Element 表格风格的 show-overflow-tooltip 转为 vxe-column 的 show-overflow */
|
|
147
148
|
function hasOverflowTooltipKey(item) {
|
|
@@ -209,6 +210,10 @@ const renderer = {
|
|
|
209
210
|
}
|
|
210
211
|
export default {
|
|
211
212
|
name: 'TablePro',
|
|
213
|
+
beforeCreate() {
|
|
214
|
+
// 按需引用时,在子表格创建 tooltip 前完成旧版层级适配。
|
|
215
|
+
installPopupZIndexBridge()
|
|
216
|
+
},
|
|
212
217
|
components: {
|
|
213
218
|
tableSetSize,
|
|
214
219
|
empty,
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import Vue from 'vue'
|
|
2
|
+
import vxeTable from 'vxe-table'
|
|
3
|
+
import DomZIndex from 'dom-zindex'
|
|
4
|
+
import PopupManager from 'element-ui/lib/utils/popup/popup-manager'
|
|
5
|
+
import SourcePopupManager from 'element-ui/src/utils/popup/popup-manager'
|
|
6
|
+
|
|
7
|
+
const BRIDGE_FLAG = '__n20PopupZIndexBridge__'
|
|
8
|
+
|
|
9
|
+
function syncLegacyZIndex() {
|
|
10
|
+
const core = vxeTable.VXETable || vxeTable
|
|
11
|
+
const config = core.config
|
|
12
|
+
const zIndex = config && typeof config === 'object' ? Number(config.zIndex) : 0
|
|
13
|
+
if (zIndex > DomZIndex.getCurrent()) DomZIndex.setCurrent(zIndex)
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
function bridgePopupManager(manager) {
|
|
17
|
+
if (manager[BRIDGE_FLAG]) return
|
|
18
|
+
|
|
19
|
+
const descriptor = Object.getOwnPropertyDescriptor(manager, 'zIndex')
|
|
20
|
+
// Element 保存下一次可用值,dom-zindex 保存最后一次已分配值。
|
|
21
|
+
syncLegacyZIndex()
|
|
22
|
+
DomZIndex.setCurrent(Math.max(DomZIndex.getCurrent(), manager.zIndex - 1))
|
|
23
|
+
Object.defineProperty(manager, 'zIndex', {
|
|
24
|
+
configurable: true,
|
|
25
|
+
get() {
|
|
26
|
+
syncLegacyZIndex()
|
|
27
|
+
// 兼容先安装表格、后安装 Element,并保留业务自定义的初始层级。
|
|
28
|
+
const configuredZIndex = Number((Vue.prototype.$ELEMENT || {}).zIndex) || 2000
|
|
29
|
+
return Math.max(descriptor.get.call(manager), DomZIndex.getCurrent() + 1, configuredZIndex)
|
|
30
|
+
},
|
|
31
|
+
set(value) {
|
|
32
|
+
const nextZIndex = Number(value)
|
|
33
|
+
if (!Number.isFinite(nextZIndex)) return
|
|
34
|
+
|
|
35
|
+
const currentZIndex = Math.max(DomZIndex.getCurrent(), nextZIndex - 1)
|
|
36
|
+
DomZIndex.setCurrent(currentZIndex)
|
|
37
|
+
descriptor.set.call(manager, currentZIndex + 1)
|
|
38
|
+
}
|
|
39
|
+
})
|
|
40
|
+
Object.defineProperty(manager, BRIDGE_FLAG, { value: true })
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
function bridgeLegacyTooltip(component) {
|
|
44
|
+
const options = component && (component.options || component)
|
|
45
|
+
const methods = options && options.methods
|
|
46
|
+
if (!methods || !methods.updateZindex || methods.updateZindex[BRIDGE_FLAG]) return
|
|
47
|
+
|
|
48
|
+
const updateZindex = methods.updateZindex
|
|
49
|
+
const updatePlacement = methods.updatePlacement
|
|
50
|
+
// vxe 3.6 的 tooltip 不使用 dom-zindex,每次显示都要从共享层级重新分配。
|
|
51
|
+
methods.updateZindex = function () {
|
|
52
|
+
updateZindex.call(this)
|
|
53
|
+
syncLegacyZIndex()
|
|
54
|
+
this.tipZindex = DomZIndex.getNext()
|
|
55
|
+
}
|
|
56
|
+
Object.defineProperty(methods.updateZindex, BRIDGE_FLAG, { value: true })
|
|
57
|
+
methods.updatePlacement = function (...args) {
|
|
58
|
+
if (this.visible && this.tipStore && this.tipStore.style) {
|
|
59
|
+
// 兼容业务缓存的旧主题 CSS(9999 !important),使用动态内联层级覆盖。
|
|
60
|
+
this.tipStore.style.zIndex = `${this.zIndex || this.tipZindex} !important`
|
|
61
|
+
}
|
|
62
|
+
return updatePlacement.apply(this, args)
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/** 同步 Element 与表格 tooltip 的层级,兼容旧版 vxe 及升级后的 vxe 3.20。 */
|
|
67
|
+
export default function installPopupZIndexBridge() {
|
|
68
|
+
if (typeof document === 'undefined') return
|
|
69
|
+
|
|
70
|
+
bridgePopupManager(PopupManager)
|
|
71
|
+
bridgePopupManager(SourcePopupManager)
|
|
72
|
+
// 旧版导出 Tooltip;新版由 vxe-pc-ui 提供,直接复用上面的计数器桥接。
|
|
73
|
+
if (vxeTable.Tooltip) {
|
|
74
|
+
bridgeLegacyTooltip(vxeTable.Tooltip)
|
|
75
|
+
// Vue.use(vxeTable) 已执行时,注册的构造器也需要同步,支持按需引用 TablePro。
|
|
76
|
+
bridgeLegacyTooltip(Vue.options.components.VxeTooltip)
|
|
77
|
+
}
|
|
78
|
+
}
|