web-component-gallery 2.2.27 → 2.2.30
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/js.umd.js +1 -1
- package/lib/descriptions-list/index.jsx +23 -16
- package/lib/form-comp/ASelectCustom.vue +7 -0
- package/package.json +1 -1
- package/utils/Tree.js +5 -7
|
@@ -76,27 +76,34 @@ const DescriptionsList = {
|
|
|
76
76
|
|
|
77
77
|
},
|
|
78
78
|
mounted() {
|
|
79
|
-
|
|
79
|
+
this.setDescContentWidth()
|
|
80
80
|
this.$bus.$onWindow(this, 'resize', this.setDescContentWidth)
|
|
81
81
|
},
|
|
82
82
|
methods: {
|
|
83
83
|
setDescContentWidth() {
|
|
84
|
-
const
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
84
|
+
const retry = () => {
|
|
85
|
+
const elementG = this.$refs.Descriptions.querySelectorAll('.ant-descriptions-item-content')
|
|
86
|
+
const width = document.querySelector('.ant-descriptions-view').offsetWidth
|
|
87
|
+
const labelWidth = document.querySelector('.ant-descriptions-item-label').offsetWidth
|
|
88
|
+
const { column, descSettings } = this
|
|
89
|
+
if (width === 0) {
|
|
90
|
+
setTimeout(retry, 100) // 重试间隔100ms
|
|
91
|
+
return
|
|
92
|
+
}
|
|
93
|
+
for (let i = 0; i < elementG.length; i++) {
|
|
94
|
+
const contentWidth = (
|
|
95
|
+
descSettings[i].span ?
|
|
96
|
+
width * (descSettings[i].span / column) :
|
|
97
|
+
width / column ) - labelWidth + 'px'
|
|
98
|
+
const element = elementG[i]
|
|
99
|
+
element.style = `
|
|
100
|
+
width: ${contentWidth};
|
|
101
|
+
min-width: ${contentWidth};
|
|
102
|
+
max-width: ${contentWidth};
|
|
103
|
+
`
|
|
104
|
+
}
|
|
99
105
|
}
|
|
106
|
+
retry() // 初始调用
|
|
100
107
|
}
|
|
101
108
|
}
|
|
102
109
|
}
|
|
@@ -125,6 +125,7 @@ export default {
|
|
|
125
125
|
innerOptions: [],
|
|
126
126
|
|
|
127
127
|
// UI状态
|
|
128
|
+
isInitialized: false,
|
|
128
129
|
isSelectOpen: false,
|
|
129
130
|
isLoadingMore: false,
|
|
130
131
|
searchValue: ''
|
|
@@ -218,10 +219,16 @@ export default {
|
|
|
218
219
|
? [...records]
|
|
219
220
|
: [...this.innerOptions, ...this.handleFilter(records)]
|
|
220
221
|
this.pagination.total = total
|
|
222
|
+
|
|
223
|
+
if (!this.isInitialized) return this.$emit('fetchInitialData', {
|
|
224
|
+
options: [...this.innerOptions],
|
|
225
|
+
pagination: {...this.pagination}
|
|
226
|
+
})
|
|
221
227
|
} catch (error) {
|
|
222
228
|
this.pagination.current--
|
|
223
229
|
console.error('分页加载失败:', error)
|
|
224
230
|
} finally {
|
|
231
|
+
this.isInitialized = true
|
|
225
232
|
this.isLoadingMore = false
|
|
226
233
|
}
|
|
227
234
|
},
|
package/package.json
CHANGED
package/utils/Tree.js
CHANGED
|
@@ -23,8 +23,8 @@ export function getTreeKey(
|
|
|
23
23
|
|
|
24
24
|
function traverse(node) {
|
|
25
25
|
const shouldCollect = !parent || node[children]?.length
|
|
26
|
-
if (shouldCollect) keys.push(node[key])
|
|
27
26
|
|
|
27
|
+
if (shouldCollect) keys.push(node[key])
|
|
28
28
|
if (node[children]?.length) {
|
|
29
29
|
node[children].forEach(traverse)
|
|
30
30
|
}
|
|
@@ -152,12 +152,10 @@ export function getAllParents(tree, nodeId, { children = 'children', key = 'id'
|
|
|
152
152
|
const path = []
|
|
153
153
|
let current = nodeMap.get(nodeId)
|
|
154
154
|
while (current) {
|
|
155
|
-
|
|
156
|
-
// 直接返回原对象
|
|
157
|
-
path.unshift(current.node)
|
|
158
|
-
|
|
159
|
-
path.unshift(current.node[key])
|
|
160
|
-
}
|
|
155
|
+
returnObjects
|
|
156
|
+
? path.unshift(current.node) // 直接返回原对象
|
|
157
|
+
: path.unshift(current.node[key])
|
|
158
|
+
|
|
161
159
|
current = current.metaInfo.get(current.node).parentId
|
|
162
160
|
? nodeMap.get(current.metaInfo.get(current.node).parentId)
|
|
163
161
|
: null
|