Skip to content

Commit

Permalink
[ifx]还原maxWidth width设置 review by xiongjj
Browse files Browse the repository at this point in the history
  • Loading branch information
luoxiao-supermap committed Oct 31, 2024
1 parent 93aaa8a commit f1b3627
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 16 deletions.
28 changes: 14 additions & 14 deletions src/mapboxgl/layer-highlight/LayerHighlight.vue
Original file line number Diff line number Diff line change
Expand Up @@ -96,21 +96,20 @@ export default {
columnStyle() {
const { autoResize, keyWidth, valueWidth, keyMaxWidth, valueMaxWidth, keyWordStyle, valueWordStyle } = this.popupStyle;
const style = { keyStyle: {}, valueStyle: {} };
if (keyWidth) {
style.keyStyle.minWidth = keyWidth + 'px';
}
if (valueWidth) {
style.valueStyle.minWidth = valueWidth + 'px';
}
if (keyMaxWidth) {
style.keyStyle.maxWidth = keyMaxWidth + 'px';
}
if (valueMaxWidth) {
style.valueStyle.maxWidth = valueMaxWidth + 'px';
}
if (!autoResize) {
style.keyStyle.maxWidth = style.keyStyle.minWidth;
style.valueStyle.maxWidth = style.valueStyle.minWidth;
if (keyWidth) {
style.keyStyle.width = keyWidth + 'px';
}
if (valueWidth) {
style.valueStyle.width = valueWidth + 'px';
}
} else {
if (keyMaxWidth) {
style.keyStyle.maxWidth = keyMaxWidth + 'px';
}
if (valueMaxWidth) {
style.valueStyle.maxWidth = valueMaxWidth + 'px';
}
}
const ellipsisStyle = {
overflow: 'hidden',
Expand Down Expand Up @@ -141,6 +140,7 @@ export default {
((this.customColumnRenders || {})[record.slotName] ||
(this.$parent && this.$parent.$scopedSlots[record.slotName]));
const style = this.columnStyle.valueStyle;
console.log(style)
if (valueCustomRender) {
return <div style={style} title={text}>{valueCustomRender({ value: text, style })}</div>;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,8 @@ describe('LayerHighlight.vue', () => {
expect(wrapper.find(SmMapPopup).exists()).toBe(true);
expect(wrapper.vm.tableColumns.length).toBe(2);
const style = { overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap' };
expect(wrapper.vm.columnStyle.keyStyle).toEqual({ ...style, maxWidth: '160px', minWidth: '80px' });
expect(wrapper.vm.columnStyle.valueStyle).toEqual({ ...style, maxWidth: '300px', minWidth: '150px' });
expect(wrapper.vm.columnStyle.keyStyle).toEqual({ ...style, maxWidth: '160px' });
expect(wrapper.vm.columnStyle.valueStyle).toEqual({ ...style, maxWidth: '300px' });
done();
});

Expand Down

0 comments on commit f1b3627

Please sign in to comment.