qidian-vue-ui 2.0.0-beta.3 → 2.0.0-beta.4
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.
|
@@ -1,53 +1,53 @@
|
|
|
1
|
-
.qd-service-table[data-v-
|
|
1
|
+
.qd-service-table[data-v-70d5cd46] {
|
|
2
2
|
height: 100%;
|
|
3
3
|
display: flex;
|
|
4
4
|
flex-direction: column;
|
|
5
5
|
}
|
|
6
|
-
.qd-service-table[data-v-
|
|
6
|
+
.qd-service-table[data-v-70d5cd46] > .t-table__content {
|
|
7
7
|
flex: 1;
|
|
8
8
|
}
|
|
9
|
-
.qd-service-table[data-v-
|
|
9
|
+
.qd-service-table[data-v-70d5cd46] .t-table__tree-col:not(:has(.t-table__tree-op-icon)) {
|
|
10
10
|
margin-left: calc(var(--td-font-size-body-large) + var(--td-comp-margin-s));
|
|
11
11
|
}
|
|
12
|
-
.qd-service-table[data-v-
|
|
12
|
+
.qd-service-table[data-v-70d5cd46] .t-table__tree-leaf-node .t-table__tree-op-icon:empty {
|
|
13
13
|
width: calc(var(--td-font-size-body-large) + var(--td-comp-margin-s));
|
|
14
14
|
}
|
|
15
|
-
.qd-service-table[data-v-
|
|
16
|
-
.qd-service-table[data-v-
|
|
17
|
-
transform: var(--
|
|
15
|
+
.qd-service-table[data-v-70d5cd46] .t-affix > .t-table__affixed-header-elm-wrap,
|
|
16
|
+
.qd-service-table[data-v-70d5cd46] .t-affix > .t-table__scrollbar--obvious {
|
|
17
|
+
transform: var(--e4fcd59a);
|
|
18
18
|
}
|
|
19
|
-
.qd-service-table--horizontal-bar-static[data-v-
|
|
19
|
+
.qd-service-table--horizontal-bar-static[data-v-70d5cd46] .t-table__scrollbar--obvious {
|
|
20
20
|
visibility: hidden;
|
|
21
21
|
pointer-events: none;
|
|
22
22
|
}
|
|
23
|
-
.qd-service-table[data-v-
|
|
23
|
+
.qd-service-table[data-v-70d5cd46] .t-table__affixed-header-elm-wrap {
|
|
24
24
|
height: auto !important;
|
|
25
25
|
}
|
|
26
|
-
.qd-service-table[data-v-
|
|
26
|
+
.qd-service-table[data-v-70d5cd46] .t-table__affixed-header-elm {
|
|
27
27
|
position: relative;
|
|
28
28
|
scrollbar-width: none;
|
|
29
29
|
}
|
|
30
|
-
.qd-service-table[data-v-
|
|
30
|
+
.qd-service-table[data-v-70d5cd46] .t-table__affixed-header-elm::-webkit-scrollbar {
|
|
31
31
|
display: none;
|
|
32
32
|
width: 0;
|
|
33
33
|
height: 0;
|
|
34
34
|
}
|
|
35
|
-
.qd-service-table[data-v-
|
|
35
|
+
.qd-service-table[data-v-70d5cd46] .t-table__virtual-scroll-cursor + table {
|
|
36
36
|
border-collapse: separate;
|
|
37
37
|
}
|
|
38
|
-
.qd-service-table[data-v-
|
|
38
|
+
.qd-service-table[data-v-70d5cd46] .t-table__cell-wrap > *:not(.t-switch):not(.t-tag):not(.t-icon):not(.qd-file-icon) {
|
|
39
39
|
width: 100%;
|
|
40
40
|
}
|
|
41
|
-
.qd-service-table[data-v-
|
|
41
|
+
.qd-service-table[data-v-70d5cd46] .qd-service-table__non-editable-col {
|
|
42
42
|
background-color: color-mix(in srgb, var(--td-bg-color-secondarycontainer) 50%, transparent);
|
|
43
43
|
}
|
|
44
|
-
.qd-service-table[data-v-
|
|
44
|
+
.qd-service-table[data-v-70d5cd46] .qd-service-table__non-editable-col:is(
|
|
45
45
|
.t-table__cell--fixed-left,
|
|
46
46
|
.t-table__cell--fixed-right
|
|
47
47
|
) {
|
|
48
48
|
background-color: inherit;
|
|
49
49
|
background-image: linear-gradient(color-mix(in srgb, var(--td-bg-color-secondarycontainer) 50%, transparent), color-mix(in srgb, var(--td-bg-color-secondarycontainer) 50%, transparent));
|
|
50
50
|
}
|
|
51
|
-
.qd-service-table--disable-horizontal-scroll[data-v-
|
|
51
|
+
.qd-service-table--disable-horizontal-scroll[data-v-70d5cd46] colgroup > col {
|
|
52
52
|
width: auto !important;
|
|
53
53
|
}
|
|
@@ -2,7 +2,7 @@ import './index.css'
|
|
|
2
2
|
import _sfc_main from "./index.vue2.mjs";
|
|
3
3
|
/* empty css */
|
|
4
4
|
import _export_sfc from "../../../_virtual/_plugin-vue_export-helper.mjs";
|
|
5
|
-
const QdServiceTable = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-
|
|
5
|
+
const QdServiceTable = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-70d5cd46"]]);
|
|
6
6
|
export {
|
|
7
7
|
QdServiceTable as default
|
|
8
8
|
};
|
|
@@ -318,7 +318,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
318
318
|
emit: __emit
|
|
319
319
|
}) {
|
|
320
320
|
useCssVars((_ctx) => ({
|
|
321
|
-
"
|
|
321
|
+
"e4fcd59a": affixedHeaderTransform.value
|
|
322
322
|
}));
|
|
323
323
|
const props = __props;
|
|
324
324
|
const emit = __emit;
|
|
@@ -345,6 +345,16 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
345
345
|
}
|
|
346
346
|
});
|
|
347
347
|
const vResize = resizeDirective;
|
|
348
|
+
const vHorizontalWheel = {
|
|
349
|
+
mounted(el) {
|
|
350
|
+
el.addEventListener("wheel", handleHorizontalWheel, {
|
|
351
|
+
passive: false
|
|
352
|
+
});
|
|
353
|
+
},
|
|
354
|
+
unmounted(el) {
|
|
355
|
+
el.removeEventListener("wheel", handleHorizontalWheel);
|
|
356
|
+
}
|
|
357
|
+
};
|
|
348
358
|
const slots = useSlots();
|
|
349
359
|
const {
|
|
350
360
|
t
|
|
@@ -409,10 +419,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
409
419
|
} = useTimer();
|
|
410
420
|
let probeRafId = 0;
|
|
411
421
|
let affixRefreshRafId = 0;
|
|
412
|
-
let wheelRafId = 0;
|
|
413
|
-
let wheelDeltaY = 0;
|
|
414
422
|
let animatingAncestorCleanup = null;
|
|
415
|
-
const virtualWheelRafEnabled = computed(() => props.scroll?.type === "virtual" && props.scroll.wheelRaf !== false);
|
|
416
423
|
const adaptedColumns = computed(() => {
|
|
417
424
|
const columns = wrapFormItemColumns(props.columns || []);
|
|
418
425
|
const selectType = props.selectType;
|
|
@@ -488,7 +495,6 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
488
495
|
...tableOptions
|
|
489
496
|
} = props;
|
|
490
497
|
const {
|
|
491
|
-
wheelRaf: _wheelRaf,
|
|
492
498
|
virtualUpdateInterval,
|
|
493
499
|
...scrollOptions
|
|
494
500
|
} = scroll ?? {};
|
|
@@ -1677,54 +1683,32 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
1677
1683
|
probeBottomBlockHeight();
|
|
1678
1684
|
refreshTableAffixPosition();
|
|
1679
1685
|
}
|
|
1680
|
-
function normalizeWheelDeltaY(event,
|
|
1686
|
+
function normalizeWheelDeltaY(event, pageSize2) {
|
|
1681
1687
|
if (event.deltaMode === WheelEvent.DOM_DELTA_LINE) return event.deltaY * 16;
|
|
1682
|
-
if (event.deltaMode === WheelEvent.DOM_DELTA_PAGE) return event.deltaY *
|
|
1688
|
+
if (event.deltaMode === WheelEvent.DOM_DELTA_PAGE) return event.deltaY * pageSize2;
|
|
1683
1689
|
return event.deltaY;
|
|
1684
1690
|
}
|
|
1685
|
-
function
|
|
1686
|
-
if (
|
|
1687
|
-
return el.
|
|
1688
|
-
}
|
|
1689
|
-
function hasNestedVerticalScroll(target, root, deltaY) {
|
|
1690
|
-
let el = target instanceof HTMLElement ? target : null;
|
|
1691
|
-
while (el && el !== root) {
|
|
1692
|
-
const {
|
|
1693
|
-
overflowY
|
|
1694
|
-
} = getComputedStyle(el);
|
|
1695
|
-
if (/auto|scroll|overlay/.test(overflowY) && el.scrollHeight > el.clientHeight && canConsumeVerticalScroll(el, deltaY)) {
|
|
1696
|
-
return true;
|
|
1697
|
-
}
|
|
1698
|
-
el = el.parentElement;
|
|
1699
|
-
}
|
|
1700
|
-
return false;
|
|
1691
|
+
function canConsumeHorizontalScroll(el, deltaX) {
|
|
1692
|
+
if (deltaX < 0) return el.scrollLeft > 0;
|
|
1693
|
+
return el.scrollLeft + el.clientWidth < el.scrollWidth - 1;
|
|
1701
1694
|
}
|
|
1702
1695
|
function isWheelFormTarget(target) {
|
|
1703
1696
|
if (!(target instanceof Element)) return false;
|
|
1704
1697
|
return !!target.closest('input, textarea, select, [contenteditable="true"], [role="spinbutton"], [role="slider"]');
|
|
1705
1698
|
}
|
|
1706
|
-
function
|
|
1707
|
-
if (!
|
|
1708
|
-
cancelAnimationFrame(wheelRafId);
|
|
1709
|
-
wheelRafId = 0;
|
|
1710
|
-
}
|
|
1711
|
-
function handleVirtualWheel(event) {
|
|
1712
|
-
const scrollEl = tableContentEl.value;
|
|
1713
|
-
if (!scrollEl || event.defaultPrevented || event.ctrlKey || event.shiftKey || !event.deltaY || Math.abs(event.deltaY) <= Math.abs(event.deltaX) || isWheelFormTarget(event.target)) {
|
|
1699
|
+
function handleHorizontalWheel(event) {
|
|
1700
|
+
if (event.defaultPrevented || event.ctrlKey || !event.shiftKey || !event.deltaY || Math.abs(event.deltaY) <= Math.abs(event.deltaX) || isWheelFormTarget(event.target)) {
|
|
1714
1701
|
return;
|
|
1715
1702
|
}
|
|
1716
|
-
const
|
|
1717
|
-
|
|
1718
|
-
if (!
|
|
1703
|
+
const rootEl = event.currentTarget;
|
|
1704
|
+
const scrollEl = rootEl.querySelector(".t-table__content");
|
|
1705
|
+
if (!scrollEl) return;
|
|
1706
|
+
const deltaX = normalizeWheelDeltaY(event, scrollEl.clientWidth);
|
|
1707
|
+
const maxLeft = Math.max(scrollEl.scrollWidth - scrollEl.clientWidth, 0);
|
|
1708
|
+
if (!maxLeft) return;
|
|
1719
1709
|
event.preventDefault();
|
|
1720
|
-
|
|
1721
|
-
|
|
1722
|
-
wheelRafId = requestAnimationFrame(() => {
|
|
1723
|
-
wheelRafId = 0;
|
|
1724
|
-
if (tableContentEl.value !== scrollEl) return;
|
|
1725
|
-
const maxTop = Math.max(scrollEl.scrollHeight - scrollEl.clientHeight, 0);
|
|
1726
|
-
scrollEl.scrollTop = Math.min(Math.max(scrollEl.scrollTop + wheelDeltaY, 0), maxTop);
|
|
1727
|
-
});
|
|
1710
|
+
if (!canConsumeHorizontalScroll(scrollEl, deltaX)) return;
|
|
1711
|
+
scrollEl.scrollLeft = Math.min(Math.max(scrollEl.scrollLeft + deltaX, 0), maxLeft);
|
|
1728
1712
|
}
|
|
1729
1713
|
function probeBottomBlockHeight(withDelay = true) {
|
|
1730
1714
|
if (withDelay) {
|
|
@@ -1770,18 +1754,6 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
1770
1754
|
watch(expandedTreeNodes, adjustScrollWhenTreeExpanded, {
|
|
1771
1755
|
flush: "post"
|
|
1772
1756
|
});
|
|
1773
|
-
watch([tableContentEl, virtualWheelRafEnabled], ([el, enabled], _oldValue, onCleanup) => {
|
|
1774
|
-
if (!el || !enabled) return;
|
|
1775
|
-
el.addEventListener("wheel", handleVirtualWheel, {
|
|
1776
|
-
passive: false
|
|
1777
|
-
});
|
|
1778
|
-
onCleanup(() => {
|
|
1779
|
-
el.removeEventListener("wheel", handleVirtualWheel);
|
|
1780
|
-
clearWheelRaf();
|
|
1781
|
-
});
|
|
1782
|
-
}, {
|
|
1783
|
-
immediate: true
|
|
1784
|
-
});
|
|
1785
1757
|
watch(tableContentVisible, (visible) => {
|
|
1786
1758
|
if (!visible) return;
|
|
1787
1759
|
watchAnimatingTransformAncestor();
|
|
@@ -1831,7 +1803,6 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
1831
1803
|
tableContentStop();
|
|
1832
1804
|
if (probeRafId) cancelAnimationFrame(probeRafId);
|
|
1833
1805
|
if (affixRefreshRafId) cancelAnimationFrame(affixRefreshRafId);
|
|
1834
|
-
clearWheelRaf();
|
|
1835
1806
|
animatingAncestorCleanup?.();
|
|
1836
1807
|
document.removeEventListener("click", handleDocumentClick);
|
|
1837
1808
|
document.removeEventListener("keydown", handleDocumentKeydown);
|
|
@@ -1910,7 +1881,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
1910
1881
|
name,
|
|
1911
1882
|
fn: withCtx((slotProps) => [renderSlot(_ctx.$slots, name, normalizeProps(guardReactiveProps(slotProps)), void 0, true)])
|
|
1912
1883
|
};
|
|
1913
|
-
})]), 1040, ["class", "selected-row-keys", "active-row-keys", "column-controller-visible", "display-columns", "expanded-row-keys", "filter-value", "sort", "expanded-tree-nodes", "columns", "loading", "data", "pagination"])), [[unref(vResize), onResize]]);
|
|
1884
|
+
})]), 1040, ["class", "selected-row-keys", "active-row-keys", "column-controller-visible", "display-columns", "expanded-row-keys", "filter-value", "sort", "expanded-tree-nodes", "columns", "loading", "data", "pagination"])), [[unref(vResize), onResize], [vHorizontalWheel]]);
|
|
1914
1885
|
};
|
|
1915
1886
|
}
|
|
1916
1887
|
});
|
|
@@ -4,7 +4,6 @@ import type { QdFormItemProps } from '../../form';
|
|
|
4
4
|
type TDesignServiceTableCol<D extends TableRowData> = NonNullable<TdEnhancedTableProps<D>['columns']>[number];
|
|
5
5
|
export type QdServiceTableScroll = NonNullable<TdEnhancedTableProps['scroll']> & {
|
|
6
6
|
xVirtual?: boolean;
|
|
7
|
-
wheelRaf?: boolean;
|
|
8
7
|
virtualUpdateInterval?: number;
|
|
9
8
|
};
|
|
10
9
|
export interface QdServiceTableCol<D extends TableRowData = TableRowData> extends Omit<TDesignServiceTableCol<D>, 'children' | 'foot'> {
|