Skip to content

Commit

Permalink
【feature】高亮结果弹窗样式参数调整; review by qiw
Browse files Browse the repository at this point in the history
  • Loading branch information
xiongjiaojiao committed Oct 30, 2024
1 parent 498a0df commit a05e928
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 39 deletions.
2 changes: 1 addition & 1 deletion src/common/attribute-panel/AttributePanel.vue
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ class SmAttributePanel extends Mixins(Theme) {
columns: this.columns,
showHeader: this.showHeader,
background: 'transparent',
textColor: 'inherit'
textColor: this.textColor
};
}
Expand Down
41 changes: 21 additions & 20 deletions src/mapboxgl/layer-highlight/LayerHighlight.vue
Original file line number Diff line number Diff line change
Expand Up @@ -94,33 +94,34 @@ export default {
return this.allPopupDatas[this.currentIndex] || [];
},
columnStyle() {
const { autoResize, keyWidth, valueWidth, keyMaxWidth, valueMaxWidth, keyWordStyle, valueWordStyle} = this.popupStyle;
let style = { keyStyle: {}, valueStyle: {} };
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) {
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';
}
style.keyStyle.maxWidth = style.keyStyle.minWidth;
style.valueStyle.maxWidth = style.valueStyle.minWidth;
}
const ellipsisStyle = {
overflow: 'hidden',
textOverflow: 'ellipsis',
whiteSpace: 'nowrap'
};
if (keyWordStyle === 'ellipsis') {
style.keyStyle = { ...style.keyStyle, ...ellipsisStyle };
}
if (keyWordStyle === 'ellipsis'){
style.keyStyle = {...style.keyStyle, ...ellipsisStyle}
}
if (valueWordStyle === 'ellipsis'){
style.valueStyle = {...style.valueStyle, ...ellipsisStyle}
if (valueWordStyle === 'ellipsis') {
style.valueStyle = { ...style.valueStyle, ...ellipsisStyle };
}
return style;
},
Expand Down
19 changes: 2 additions & 17 deletions src/mapboxgl/layer-highlight/__tests__/LayersHighlight.spec.js
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' });
expect(wrapper.vm.columnStyle.valueStyle).toEqual({ ...style, maxWidth: '300px' });
expect(wrapper.vm.columnStyle.keyStyle).toEqual({ ...style, maxWidth: '160px', minWidth: '80px' });
expect(wrapper.vm.columnStyle.valueStyle).toEqual({ ...style, maxWidth: '300px', minWidth: '150px' });
done();
});

Expand Down Expand Up @@ -139,21 +139,6 @@ describe('LayerHighlight.vue', () => {
done();
});

it('set featureFieldsMap', done => {
wrapper = mount(SmLayerHighlight, {
propsData: {
mapTarget: 'map',
uniqueName: 'Test',
highlightStyle: {}
}
});
const setSpy = jest.spyOn(wrapper.vm.viewModel, 'setDisplayFieldsMap');
wrapper.setProps({ displayFieldsMap: {} });
wrapper.vm.$nextTick();
expect(setSpy).toBeCalled();
done();
});

it('set clickTolerance', done => {
wrapper = mount(SmLayerHighlight, {
propsData: {
Expand Down
1 change: 1 addition & 0 deletions src/mapboxgl/map-popup/MapPopup.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
:textColor="textColor"
:attributes="data[defaultIndex]"
:columns="columns"
:showHeader="showHeader"
@change="changeIndex"
>
</sm-attribute-panel>
Expand Down
2 changes: 1 addition & 1 deletion src/mapboxgl/query/Query.vue
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@
:clickTolerance="clickTolerance"
:popupStyle="popupStyle"
:background="popupStyle.background || background"
:textColor="popupStyle.background || textColor"
:textColor="popupStyle.textColor || textColor"
:mapTarget="mapTarget"
:customColumnRenders="$scopedSlots"
:showPopup="showPopup"
Expand Down

0 comments on commit a05e928

Please sign in to comment.