Skip to content

Commit 3a46c33

Browse files
authored
UI improvements (#1963)
* Update sortableTable.html * Update custom.css
1 parent 1c97593 commit 3a46c33

File tree

2 files changed

+45
-24
lines changed

2 files changed

+45
-24
lines changed

web/assets/css/custom.css

+9-1
Original file line numberDiff line numberDiff line change
@@ -793,7 +793,6 @@ style attribute {
793793

794794
.ant-dropdown-menu-dark .ant-dropdown-menu-item:hover,
795795
.dark .ant-select-dropdown-menu-item-selected,
796-
.dark .ant-select-dropdown-menu-item:hover,
797796
.dark .ant-calendar-time-picker-select-option-selected {
798797
background-color: var(--dark-color-surface-600);
799798
}
@@ -1249,3 +1248,12 @@ b, strong {
12491248
.dark .ant-alert-close-icon .anticon-close:hover {
12501249
color: rgb(255 255 255);
12511250
}
1251+
1252+
.ant-empty-small {
1253+
margin: 4px 0;
1254+
background-color: transparent !important;
1255+
}
1256+
1257+
.ant-empty-small .ant-empty-image {
1258+
height: 20px;
1259+
}

web/html/xui/component/sortableTable.html

+36-23
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
},
3333
props: ['data-source', 'customRow'],
3434
inheritAttrs: false,
35-
provide() {
35+
provide() {
3636
const sortable = {}
3737

3838
Object.defineProperty(sortable, "setSortableIndex", {
@@ -50,25 +50,21 @@
5050
}
5151
},
5252
render: function (createElement) {
53-
return createElement(
54-
'a-table',
55-
{
56-
class: {
57-
'ant-table-is-sorting': this.isDragging(),
58-
},
59-
props: {
60-
...this.$attrs,
61-
'data-source': this.records,
62-
customRow: (record, index) => this.customRowRender(record, index),
63-
},
64-
on: this.$listeners,
65-
nativeOn: {
66-
drop: (e) => this.dropHandler(e),
67-
},
68-
scopedSlots: this.$scopedSlots,
53+
return createElement('a-table', {
54+
class: {
55+
'ant-table-is-sorting': this.isDragging(),
56+
},
57+
props: {
58+
...this.$attrs,
59+
'data-source': this.records,
60+
customRow: (record, index) => this.customRowRender(record, index),
6961
},
70-
this.$slots.default,
71-
)
62+
on: this.$listeners,
63+
nativeOn: {
64+
drop: (e) => this.dropHandler(e),
65+
},
66+
scopedSlots: this.$scopedSlots,
67+
}, this.$slots.default, )
7268
},
7369
created() {
7470
this.$memoSort = {};
@@ -91,8 +87,15 @@
9187
e.preventDefault();
9288
return;
9389
}
90+
const hideDragImage = this.$el.cloneNode(true);
91+
hideDragImage.id = "hideDragImage-hide";
92+
hideDragImage.style.opacity = 0;
93+
document.body.appendChild(hideDragImage);
94+
e.dataTransfer.setDragImage(hideDragImage, 0, 0);
9495
},
9596
dragStopHandler(e, index) {
97+
const hideDragImage = document.getElementById('hideDragImage-hide');
98+
if (hideDragImage) hideDragImage.remove();
9699
this.resetSortableIndex(e, index);
97100
},
98101
dragOverHandler(e, index) {
@@ -209,16 +212,26 @@
209212
}
210213
}
211214
.ant-table-is-sorting .draggable-row td {
212-
background-color: white !important;
215+
background-color: #ffffff !important;
213216
}
214217
.dark .ant-table-is-sorting .draggable-row td {
215218
background-color: var(--dark-color-surface-100) !important;
216219
}
220+
.ant-table-is-sorting .dragging td {
221+
background-color: rgb(232 244 242) !important;
222+
color: rgba(0, 0, 0, 0.3);
223+
}
224+
.dark .ant-table-is-sorting .dragging td {
225+
background-color: var(--dark-color-table-hover) !important;
226+
color: rgba(255, 255, 255, 0.3);
227+
}
217228
.ant-table-is-sorting .dragging {
218-
opacity: 0.5;
229+
opacity: 1;
230+
box-shadow: 1px -2px 2px #008771;
231+
transition: all 0.2s;
219232
}
220233
.ant-table-is-sorting .dragging .ant-table-row-index {
221-
opacity: 0;
234+
opacity: 0.3;
222235
}
223236
</style>
224-
{{end}}
237+
{{end}}

0 commit comments

Comments
 (0)