@v-c/table 1.0.0 → 1.0.1
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/package.json +4 -4
- package/dist/Body/BodyRow.cjs +0 -143
- package/dist/Body/ExpandedRow.cjs +0 -55
- package/dist/Body/MeasureCell.cjs +0 -39
- package/dist/Body/MeasureRow.cjs +0 -68
- package/dist/Body/index.cjs +0 -82
- package/dist/Cell/index.cjs +0 -202
- package/dist/Cell/useHoverState.cjs +0 -18
- package/dist/ColGroup.cjs +0 -51
- package/dist/FixedHolder/index.cjs +0 -142
- package/dist/Footer/Cell.cjs +0 -51
- package/dist/Footer/Row.cjs +0 -23
- package/dist/Footer/Summary.cjs +0 -19
- package/dist/Footer/SummaryContext.cjs +0 -12
- package/dist/Footer/index.cjs +0 -39
- package/dist/Header/Header.cjs +0 -89
- package/dist/Header/HeaderRow.cjs +0 -66
- package/dist/Panel/index.cjs +0 -13
- package/dist/Table.cjs +0 -739
- package/dist/VirtualTable/BodyGrid.cjs +0 -180
- package/dist/VirtualTable/BodyLine.cjs +0 -92
- package/dist/VirtualTable/VirtualCell.cjs +0 -87
- package/dist/VirtualTable/context.cjs +0 -21
- package/dist/VirtualTable/index.cjs +0 -337
- package/dist/_virtual/rolldown_runtime.cjs +0 -21
- package/dist/constant.cjs +0 -5
- package/dist/context/PerfContext.cjs +0 -14
- package/dist/context/TableContext.cjs +0 -21
- package/dist/hooks/useColumns/index.cjs +0 -127
- package/dist/hooks/useColumns/useWidthColumns.cjs +0 -57
- package/dist/hooks/useExpand.cjs +0 -56
- package/dist/hooks/useFixedInfo.cjs +0 -20
- package/dist/hooks/useFlattenRecords.cjs +0 -38
- package/dist/hooks/useFrame.cjs +0 -49
- package/dist/hooks/useHover.cjs +0 -20
- package/dist/hooks/useRowInfo.cjs +0 -53
- package/dist/hooks/useSticky.cjs +0 -27
- package/dist/hooks/useStickyOffsets.cjs +0 -41
- package/dist/index.cjs +0 -24
- package/dist/interface.cjs +0 -1
- package/dist/namePathType.cjs +0 -1
- package/dist/stickyScrollBar.cjs +0 -173
- package/dist/sugar/Column.cjs +0 -109
- package/dist/sugar/ColumnGroup.cjs +0 -109
- package/dist/utils/expandUtil.cjs +0 -38
- package/dist/utils/fixUtil.cjs +0 -49
- package/dist/utils/legacyUtil.cjs +0 -35
- package/dist/utils/offsetUtil.cjs +0 -12
- package/dist/utils/valueUtil.cjs +0 -28
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
Object.defineProperties(exports, {
|
|
2
|
-
__esModule: { value: true },
|
|
3
|
-
[Symbol.toStringTag]: { value: "Module" }
|
|
4
|
-
});
|
|
5
|
-
const require_rolldown_runtime = require("../_virtual/rolldown_runtime.cjs");
|
|
6
|
-
let vue = require("vue");
|
|
7
|
-
function fillRecords(list, record, indent, childrenColumnName, expandedKeys, getRowKey, index) {
|
|
8
|
-
const key = getRowKey(record, index);
|
|
9
|
-
list.push({
|
|
10
|
-
record,
|
|
11
|
-
indent,
|
|
12
|
-
index,
|
|
13
|
-
rowKey: key
|
|
14
|
-
});
|
|
15
|
-
const expanded = expandedKeys?.has(key);
|
|
16
|
-
const children = record?.[childrenColumnName];
|
|
17
|
-
if (record && Array.isArray(children) && expanded) for (let i = 0; i < children.length; i += 1) fillRecords(list, children[i], indent + 1, childrenColumnName, expandedKeys, getRowKey, i);
|
|
18
|
-
}
|
|
19
|
-
function useFlattenRecords(data, childrenColumnName, expandedKeys, getRowKey) {
|
|
20
|
-
return (0, vue.computed)(() => {
|
|
21
|
-
const mergedData = (0, vue.unref)(data) || [];
|
|
22
|
-
const mergedChildrenColumnName = (0, vue.unref)(childrenColumnName);
|
|
23
|
-
const mergedExpandedKeys = (0, vue.unref)(expandedKeys);
|
|
24
|
-
const mergedGetRowKey = (0, vue.unref)(getRowKey);
|
|
25
|
-
if (mergedExpandedKeys?.size) {
|
|
26
|
-
const list = [];
|
|
27
|
-
for (let i = 0; i < mergedData.length; i += 1) fillRecords(list, mergedData[i], 0, mergedChildrenColumnName, mergedExpandedKeys, mergedGetRowKey, i);
|
|
28
|
-
return list;
|
|
29
|
-
}
|
|
30
|
-
return mergedData.map((item, index) => ({
|
|
31
|
-
record: item,
|
|
32
|
-
indent: 0,
|
|
33
|
-
index,
|
|
34
|
-
rowKey: mergedGetRowKey(item, index)
|
|
35
|
-
}));
|
|
36
|
-
});
|
|
37
|
-
}
|
|
38
|
-
exports.default = useFlattenRecords;
|
package/dist/hooks/useFrame.cjs
DELETED
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_rolldown_runtime = require("../_virtual/rolldown_runtime.cjs");
|
|
3
|
-
let vue = require("vue");
|
|
4
|
-
let _v_c_util_dist_raf = require("@v-c/util/dist/raf");
|
|
5
|
-
_v_c_util_dist_raf = require_rolldown_runtime.__toESM(_v_c_util_dist_raf);
|
|
6
|
-
function useLayoutState(defaultState) {
|
|
7
|
-
const stateRef = (0, vue.shallowRef)(defaultState);
|
|
8
|
-
let rafId;
|
|
9
|
-
const updateBatchRef = (0, vue.shallowRef)([]);
|
|
10
|
-
function setFrameState(updater) {
|
|
11
|
-
updateBatchRef.value.push(updater);
|
|
12
|
-
_v_c_util_dist_raf.default.cancel(rafId);
|
|
13
|
-
rafId = (0, _v_c_util_dist_raf.default)(() => {
|
|
14
|
-
const prevBatch = updateBatchRef.value;
|
|
15
|
-
updateBatchRef.value = [];
|
|
16
|
-
prevBatch.forEach((batchUpdater) => {
|
|
17
|
-
stateRef.value = batchUpdater(stateRef.value);
|
|
18
|
-
});
|
|
19
|
-
});
|
|
20
|
-
}
|
|
21
|
-
(0, vue.onBeforeUnmount)(() => {
|
|
22
|
-
_v_c_util_dist_raf.default.cancel(rafId);
|
|
23
|
-
});
|
|
24
|
-
return [stateRef, setFrameState];
|
|
25
|
-
}
|
|
26
|
-
function useTimeoutLock(defaultState) {
|
|
27
|
-
const frameRef = (0, vue.ref)(defaultState || null);
|
|
28
|
-
const timeoutRef = (0, vue.ref)();
|
|
29
|
-
function cleanUp() {
|
|
30
|
-
clearTimeout(timeoutRef.value);
|
|
31
|
-
}
|
|
32
|
-
function setState(newState) {
|
|
33
|
-
frameRef.value = newState;
|
|
34
|
-
cleanUp();
|
|
35
|
-
timeoutRef.value = setTimeout(() => {
|
|
36
|
-
frameRef.value = null;
|
|
37
|
-
timeoutRef.value = void 0;
|
|
38
|
-
}, 100);
|
|
39
|
-
}
|
|
40
|
-
function getState() {
|
|
41
|
-
return frameRef.value;
|
|
42
|
-
}
|
|
43
|
-
(0, vue.onBeforeUnmount)(() => {
|
|
44
|
-
cleanUp();
|
|
45
|
-
});
|
|
46
|
-
return [setState, getState];
|
|
47
|
-
}
|
|
48
|
-
exports.useLayoutState = useLayoutState;
|
|
49
|
-
exports.useTimeoutLock = useTimeoutLock;
|
package/dist/hooks/useHover.cjs
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
Object.defineProperties(exports, {
|
|
2
|
-
__esModule: { value: true },
|
|
3
|
-
[Symbol.toStringTag]: { value: "Module" }
|
|
4
|
-
});
|
|
5
|
-
const require_rolldown_runtime = require("../_virtual/rolldown_runtime.cjs");
|
|
6
|
-
let vue = require("vue");
|
|
7
|
-
function useHover() {
|
|
8
|
-
const startRow = (0, vue.ref)(-1);
|
|
9
|
-
const endRow = (0, vue.ref)(-1);
|
|
10
|
-
const onHover = (start, end) => {
|
|
11
|
-
startRow.value = start;
|
|
12
|
-
endRow.value = end;
|
|
13
|
-
};
|
|
14
|
-
return [
|
|
15
|
-
startRow,
|
|
16
|
-
endRow,
|
|
17
|
-
onHover
|
|
18
|
-
];
|
|
19
|
-
}
|
|
20
|
-
exports.default = useHover;
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
Object.defineProperties(exports, {
|
|
2
|
-
__esModule: { value: true },
|
|
3
|
-
[Symbol.toStringTag]: { value: "Module" }
|
|
4
|
-
});
|
|
5
|
-
const require_rolldown_runtime = require("../_virtual/rolldown_runtime.cjs");
|
|
6
|
-
const require_TableContext = require("../context/TableContext.cjs");
|
|
7
|
-
const require_valueUtil = require("../utils/valueUtil.cjs");
|
|
8
|
-
let vue = require("vue");
|
|
9
|
-
let _v_c_util = require("@v-c/util");
|
|
10
|
-
function useRowInfo(record, rowKey, recordIndex, indent) {
|
|
11
|
-
const tableContext = require_TableContext.useInjectTableContext();
|
|
12
|
-
const nestExpandable = (0, vue.computed)(() => tableContext.expandableType === "nest");
|
|
13
|
-
const rowSupportExpand = (0, vue.computed)(() => {
|
|
14
|
-
const mergedRecord = (0, vue.unref)(record);
|
|
15
|
-
return tableContext.expandableType === "row" && (!tableContext.rowExpandable || tableContext.rowExpandable(mergedRecord));
|
|
16
|
-
});
|
|
17
|
-
const expandable = (0, vue.computed)(() => rowSupportExpand.value || nestExpandable.value);
|
|
18
|
-
const expanded = (0, vue.computed)(() => tableContext.expandedKeys?.has((0, vue.unref)(rowKey)));
|
|
19
|
-
const hasNestChildren = (0, vue.computed)(() => {
|
|
20
|
-
const mergedRecord = (0, vue.unref)(record);
|
|
21
|
-
return !!(tableContext.childrenColumnName && mergedRecord?.[tableContext.childrenColumnName]);
|
|
22
|
-
});
|
|
23
|
-
const rowProps = (0, vue.computed)(() => {
|
|
24
|
-
const mergedRecord = (0, vue.unref)(record);
|
|
25
|
-
const mergedRecordIndex = (0, vue.unref)(recordIndex);
|
|
26
|
-
const mergedIndent = (0, vue.unref)(indent);
|
|
27
|
-
const customRowProps = tableContext.onRow?.(mergedRecord, mergedRecordIndex) || {};
|
|
28
|
-
const onRowClick = customRowProps?.onClick;
|
|
29
|
-
const onClick = (event) => {
|
|
30
|
-
if (tableContext.expandRowByClick && expandable.value) tableContext.onTriggerExpand(mergedRecord, event);
|
|
31
|
-
onRowClick?.(event);
|
|
32
|
-
};
|
|
33
|
-
let computeRowClassName = "";
|
|
34
|
-
if (typeof tableContext.rowClassName === "string") computeRowClassName = tableContext.rowClassName;
|
|
35
|
-
else if (typeof tableContext.rowClassName === "function") computeRowClassName = tableContext.rowClassName(mergedRecord, mergedRecordIndex, mergedIndent);
|
|
36
|
-
return {
|
|
37
|
-
...customRowProps,
|
|
38
|
-
className: (0, _v_c_util.clsx)(computeRowClassName, customRowProps?.className, customRowProps?.class),
|
|
39
|
-
onClick
|
|
40
|
-
};
|
|
41
|
-
});
|
|
42
|
-
return {
|
|
43
|
-
tableContext,
|
|
44
|
-
columnsKey: (0, vue.computed)(() => require_valueUtil.getColumnsKey(tableContext.flattenColumns)),
|
|
45
|
-
nestExpandable,
|
|
46
|
-
expanded,
|
|
47
|
-
hasNestChildren,
|
|
48
|
-
rowSupportExpand,
|
|
49
|
-
expandable,
|
|
50
|
-
rowProps
|
|
51
|
-
};
|
|
52
|
-
}
|
|
53
|
-
exports.default = useRowInfo;
|
package/dist/hooks/useSticky.cjs
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
Object.defineProperties(exports, {
|
|
2
|
-
__esModule: { value: true },
|
|
3
|
-
[Symbol.toStringTag]: { value: "Module" }
|
|
4
|
-
});
|
|
5
|
-
const require_rolldown_runtime = require("../_virtual/rolldown_runtime.cjs");
|
|
6
|
-
let vue = require("vue");
|
|
7
|
-
let _v_c_util_dist_Dom_canUseDom = require("@v-c/util/dist/Dom/canUseDom");
|
|
8
|
-
_v_c_util_dist_Dom_canUseDom = require_rolldown_runtime.__toESM(_v_c_util_dist_Dom_canUseDom);
|
|
9
|
-
var defaultContainer = (0, _v_c_util_dist_Dom_canUseDom.default)() ? window : null;
|
|
10
|
-
function useSticky(sticky, prefixCls) {
|
|
11
|
-
return (0, vue.computed)(() => {
|
|
12
|
-
const mergedSticky = (0, vue.unref)(sticky);
|
|
13
|
-
const mergedPrefixCls = (0, vue.unref)(prefixCls);
|
|
14
|
-
const { offsetHeader = 0, offsetSummary = 0, offsetScroll = 0, getContainer = () => defaultContainer } = typeof mergedSticky === "object" ? mergedSticky : {};
|
|
15
|
-
const container = getContainer?.() || defaultContainer;
|
|
16
|
-
const isSticky = !!mergedSticky;
|
|
17
|
-
return {
|
|
18
|
-
isSticky,
|
|
19
|
-
stickyClassName: isSticky ? `${mergedPrefixCls}-sticky-holder` : "",
|
|
20
|
-
offsetHeader,
|
|
21
|
-
offsetSummary,
|
|
22
|
-
offsetScroll,
|
|
23
|
-
container
|
|
24
|
-
};
|
|
25
|
-
});
|
|
26
|
-
}
|
|
27
|
-
exports.default = useSticky;
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
Object.defineProperties(exports, {
|
|
2
|
-
__esModule: { value: true },
|
|
3
|
-
[Symbol.toStringTag]: { value: "Module" }
|
|
4
|
-
});
|
|
5
|
-
const require_rolldown_runtime = require("../_virtual/rolldown_runtime.cjs");
|
|
6
|
-
let vue = require("vue");
|
|
7
|
-
function useStickyOffsets(colWidths, flattenColumns) {
|
|
8
|
-
return (0, vue.computed)(() => {
|
|
9
|
-
const mergedWidths = (0, vue.unref)(colWidths) || [];
|
|
10
|
-
const mergedColumns = (0, vue.unref)(flattenColumns) || [];
|
|
11
|
-
const columnCount = mergedColumns.length;
|
|
12
|
-
const parseWidth = (value) => {
|
|
13
|
-
if (typeof value === "number") return Number.isFinite(value) && value > 0 ? value : null;
|
|
14
|
-
if (typeof value === "string") {
|
|
15
|
-
const trimmed = value.trim();
|
|
16
|
-
if (trimmed.endsWith("%")) return null;
|
|
17
|
-
const parsed = trimmed.endsWith("px") ? Number.parseFloat(trimmed) : Number.parseFloat(trimmed);
|
|
18
|
-
return Number.isFinite(parsed) && parsed > 0 ? parsed : null;
|
|
19
|
-
}
|
|
20
|
-
return null;
|
|
21
|
-
};
|
|
22
|
-
const normalizedWidths = mergedColumns.map((column, index) => {
|
|
23
|
-
return parseWidth(mergedWidths[index]) ?? parseWidth(column?.width) ?? 0;
|
|
24
|
-
});
|
|
25
|
-
const getOffsets = (startIndex, endIndex, offset) => {
|
|
26
|
-
const offsets = [];
|
|
27
|
-
let total = 0;
|
|
28
|
-
for (let i = startIndex; i !== endIndex; i += offset) {
|
|
29
|
-
offsets.push(total);
|
|
30
|
-
if (mergedColumns[i]?.fixed) total += normalizedWidths[i] || 0;
|
|
31
|
-
}
|
|
32
|
-
return offsets;
|
|
33
|
-
};
|
|
34
|
-
return {
|
|
35
|
-
start: getOffsets(0, columnCount, 1),
|
|
36
|
-
end: getOffsets(columnCount - 1, -1, -1).reverse(),
|
|
37
|
-
widths: normalizedWidths
|
|
38
|
-
};
|
|
39
|
-
});
|
|
40
|
-
}
|
|
41
|
-
exports.default = useStickyOffsets;
|
package/dist/index.cjs
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
Object.defineProperties(exports, {
|
|
2
|
-
__esModule: { value: true },
|
|
3
|
-
[Symbol.toStringTag]: { value: "Module" }
|
|
4
|
-
});
|
|
5
|
-
const require_legacyUtil = require("./utils/legacyUtil.cjs");
|
|
6
|
-
const require_constant = require("./constant.cjs");
|
|
7
|
-
const require_Cell = require("./Footer/Cell.cjs");
|
|
8
|
-
const require_Row = require("./Footer/Row.cjs");
|
|
9
|
-
const require_index = require("./Footer/index.cjs");
|
|
10
|
-
const require_Column = require("./sugar/Column.cjs");
|
|
11
|
-
const require_ColumnGroup = require("./sugar/ColumnGroup.cjs");
|
|
12
|
-
const require_Table = require("./Table.cjs");
|
|
13
|
-
const require_index$1 = require("./VirtualTable/index.cjs");
|
|
14
|
-
var src_default = require_Table.default;
|
|
15
|
-
exports.Column = require_Column.default;
|
|
16
|
-
exports.ColumnGroup = require_ColumnGroup.default;
|
|
17
|
-
exports.EXPAND_COLUMN = require_constant.EXPAND_COLUMN;
|
|
18
|
-
exports.INTERNAL_COL_DEFINE = require_legacyUtil.INTERNAL_COL_DEFINE;
|
|
19
|
-
exports.INTERNAL_HOOKS = require_constant.INTERNAL_HOOKS;
|
|
20
|
-
exports.Summary = require_index.FooterComponents;
|
|
21
|
-
exports.SummaryCell = require_Cell.default;
|
|
22
|
-
exports.SummaryRow = require_Row.default;
|
|
23
|
-
exports.VirtualTable = require_index$1.default;
|
|
24
|
-
exports.default = src_default;
|
package/dist/interface.cjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
package/dist/namePathType.cjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
package/dist/stickyScrollBar.cjs
DELETED
|
@@ -1,173 +0,0 @@
|
|
|
1
|
-
Object.defineProperties(exports, {
|
|
2
|
-
__esModule: { value: true },
|
|
3
|
-
[Symbol.toStringTag]: { value: "Module" }
|
|
4
|
-
});
|
|
5
|
-
const require_rolldown_runtime = require("./_virtual/rolldown_runtime.cjs");
|
|
6
|
-
const require_TableContext = require("./context/TableContext.cjs");
|
|
7
|
-
const require_useFrame = require("./hooks/useFrame.cjs");
|
|
8
|
-
const require_offsetUtil = require("./utils/offsetUtil.cjs");
|
|
9
|
-
let vue = require("vue");
|
|
10
|
-
let _v_c_util = require("@v-c/util");
|
|
11
|
-
let _v_c_util_dist_Dom_findDOMNode = require("@v-c/util/dist/Dom/findDOMNode");
|
|
12
|
-
let _v_c_util_dist_getScrollBarSize = require("@v-c/util/dist/getScrollBarSize");
|
|
13
|
-
_v_c_util_dist_getScrollBarSize = require_rolldown_runtime.__toESM(_v_c_util_dist_getScrollBarSize);
|
|
14
|
-
let _v_c_util_dist_raf = require("@v-c/util/dist/raf");
|
|
15
|
-
_v_c_util_dist_raf = require_rolldown_runtime.__toESM(_v_c_util_dist_raf);
|
|
16
|
-
var MOUSEUP_EVENT = "mouseup";
|
|
17
|
-
var MOUSEMOVE_EVENT = "mousemove";
|
|
18
|
-
var SCROLL_EVENT = "scroll";
|
|
19
|
-
var RESIZE_EVENT = "resize";
|
|
20
|
-
var StickyScrollBar = /* @__PURE__ */ (0, vue.defineComponent)({
|
|
21
|
-
name: "TableStickyScrollBar",
|
|
22
|
-
props: [
|
|
23
|
-
"scrollBodyRef",
|
|
24
|
-
"onScroll",
|
|
25
|
-
"offsetScroll",
|
|
26
|
-
"container",
|
|
27
|
-
"direction"
|
|
28
|
-
],
|
|
29
|
-
setup(props, { expose }) {
|
|
30
|
-
const { prefixCls } = require_TableContext.useInjectTableContext();
|
|
31
|
-
const scrollBarRef = (0, vue.ref)(null);
|
|
32
|
-
const [scrollState, setScrollState] = require_useFrame.useLayoutState({
|
|
33
|
-
scrollLeft: 0,
|
|
34
|
-
isHiddenScrollBar: true
|
|
35
|
-
});
|
|
36
|
-
const refState = (0, vue.ref)({
|
|
37
|
-
delta: 0,
|
|
38
|
-
x: 0
|
|
39
|
-
});
|
|
40
|
-
const isActive = (0, vue.ref)(false);
|
|
41
|
-
const rafRef = (0, vue.ref)(null);
|
|
42
|
-
const bodyScrollWidth = (0, vue.computed)(() => props.scrollBodyRef.value?.scrollWidth || 0);
|
|
43
|
-
const bodyWidth = (0, vue.computed)(() => props.scrollBodyRef.value?.clientWidth || 0);
|
|
44
|
-
const scrollBarWidth = (0, vue.computed)(() => {
|
|
45
|
-
const totalWidth = bodyScrollWidth.value;
|
|
46
|
-
const clientWidth = bodyWidth.value;
|
|
47
|
-
return totalWidth ? clientWidth * (clientWidth / totalWidth) : 0;
|
|
48
|
-
});
|
|
49
|
-
const onMouseUp = () => {
|
|
50
|
-
isActive.value = false;
|
|
51
|
-
};
|
|
52
|
-
const onMouseDown = (event) => {
|
|
53
|
-
refState.value.delta = event.pageX - scrollState.value.scrollLeft;
|
|
54
|
-
refState.value.x = 0;
|
|
55
|
-
isActive.value = true;
|
|
56
|
-
event.preventDefault();
|
|
57
|
-
};
|
|
58
|
-
const onMouseMove = (event) => {
|
|
59
|
-
const buttons = event?.buttons ?? window?.event?.buttons;
|
|
60
|
-
if (!isActive.value || buttons === 0) {
|
|
61
|
-
if (isActive.value) isActive.value = false;
|
|
62
|
-
return;
|
|
63
|
-
}
|
|
64
|
-
let left = refState.value.x + event.pageX - refState.value.x - refState.value.delta;
|
|
65
|
-
const isRTL = props.direction === "rtl";
|
|
66
|
-
left = Math.max(isRTL ? scrollBarWidth.value - bodyWidth.value : 0, Math.min(isRTL ? 0 : bodyWidth.value - scrollBarWidth.value, left));
|
|
67
|
-
if (!isRTL || Math.abs(left) + Math.abs(scrollBarWidth.value) < bodyWidth.value) {
|
|
68
|
-
props.onScroll({ scrollLeft: left / bodyWidth.value * (bodyScrollWidth.value + 2) });
|
|
69
|
-
refState.value.x = event.pageX;
|
|
70
|
-
}
|
|
71
|
-
};
|
|
72
|
-
const checkScrollBarVisible = () => {
|
|
73
|
-
_v_c_util_dist_raf.default.cancel(rafRef.value);
|
|
74
|
-
rafRef.value = (0, _v_c_util_dist_raf.default)(() => {
|
|
75
|
-
if (!props.scrollBodyRef.value || !props.container) return;
|
|
76
|
-
const container = props.container;
|
|
77
|
-
const tableOffsetTop = require_offsetUtil.getOffset(props.scrollBodyRef.value).top;
|
|
78
|
-
const tableBottomOffset = tableOffsetTop + props.scrollBodyRef.value.offsetHeight;
|
|
79
|
-
const currentClientOffset = container === window ? document.documentElement.scrollTop + window.innerHeight : require_offsetUtil.getOffset(container).top + container.clientHeight;
|
|
80
|
-
if (tableBottomOffset - (0, _v_c_util_dist_getScrollBarSize.default)() <= currentClientOffset || tableOffsetTop >= currentClientOffset - props.offsetScroll) setScrollState((state) => ({
|
|
81
|
-
...state,
|
|
82
|
-
isHiddenScrollBar: true
|
|
83
|
-
}));
|
|
84
|
-
else setScrollState((state) => ({
|
|
85
|
-
...state,
|
|
86
|
-
isHiddenScrollBar: false
|
|
87
|
-
}));
|
|
88
|
-
});
|
|
89
|
-
};
|
|
90
|
-
const setScrollLeft = (left) => {
|
|
91
|
-
setScrollState((state) => ({
|
|
92
|
-
...state,
|
|
93
|
-
scrollLeft: left / bodyScrollWidth.value * bodyWidth.value || 0
|
|
94
|
-
}));
|
|
95
|
-
};
|
|
96
|
-
expose({
|
|
97
|
-
setScrollLeft,
|
|
98
|
-
checkScrollBarVisible
|
|
99
|
-
});
|
|
100
|
-
(0, vue.onMounted)(() => {
|
|
101
|
-
document.body.addEventListener(MOUSEUP_EVENT, onMouseUp, false);
|
|
102
|
-
document.body.addEventListener(MOUSEMOVE_EVENT, onMouseMove, false);
|
|
103
|
-
checkScrollBarVisible();
|
|
104
|
-
});
|
|
105
|
-
const removeScrollListeners = (0, vue.ref)(null);
|
|
106
|
-
(0, vue.onBeforeUnmount)(() => {
|
|
107
|
-
document.body.removeEventListener(MOUSEUP_EVENT, onMouseUp);
|
|
108
|
-
document.body.removeEventListener(MOUSEMOVE_EVENT, onMouseMove);
|
|
109
|
-
_v_c_util_dist_raf.default.cancel(rafRef.value);
|
|
110
|
-
removeScrollListeners.value?.();
|
|
111
|
-
});
|
|
112
|
-
(0, vue.watch)(() => [scrollBarWidth.value, isActive.value], () => {
|
|
113
|
-
checkScrollBarVisible();
|
|
114
|
-
});
|
|
115
|
-
(0, vue.watch)(() => props.container, () => {
|
|
116
|
-
removeScrollListeners.value?.();
|
|
117
|
-
removeScrollListeners.value = null;
|
|
118
|
-
if (!props.scrollBodyRef.value || !props.container) return;
|
|
119
|
-
const container = props.container;
|
|
120
|
-
const scrollParents = [];
|
|
121
|
-
let parent = (0, _v_c_util_dist_Dom_findDOMNode.getDOM)(props.scrollBodyRef.value);
|
|
122
|
-
while (parent) {
|
|
123
|
-
scrollParents.push(parent);
|
|
124
|
-
parent = parent.parentElement;
|
|
125
|
-
}
|
|
126
|
-
scrollParents.forEach((p) => {
|
|
127
|
-
p.addEventListener(SCROLL_EVENT, checkScrollBarVisible, false);
|
|
128
|
-
});
|
|
129
|
-
window.addEventListener(RESIZE_EVENT, checkScrollBarVisible, false);
|
|
130
|
-
window.addEventListener(SCROLL_EVENT, checkScrollBarVisible, false);
|
|
131
|
-
container.addEventListener(SCROLL_EVENT, checkScrollBarVisible, false);
|
|
132
|
-
removeScrollListeners.value = () => {
|
|
133
|
-
scrollParents.forEach((p) => {
|
|
134
|
-
p.removeEventListener(SCROLL_EVENT, checkScrollBarVisible);
|
|
135
|
-
});
|
|
136
|
-
window.removeEventListener(RESIZE_EVENT, checkScrollBarVisible);
|
|
137
|
-
window.removeEventListener(SCROLL_EVENT, checkScrollBarVisible);
|
|
138
|
-
container.removeEventListener(SCROLL_EVENT, checkScrollBarVisible);
|
|
139
|
-
};
|
|
140
|
-
}, { immediate: true });
|
|
141
|
-
(0, vue.watch)(() => scrollState.value.isHiddenScrollBar, (hidden) => {
|
|
142
|
-
if (!hidden) setScrollState((state) => {
|
|
143
|
-
const bodyNode = props.scrollBodyRef.value;
|
|
144
|
-
if (!bodyNode) return state;
|
|
145
|
-
return {
|
|
146
|
-
...state,
|
|
147
|
-
scrollLeft: bodyNode.scrollLeft / bodyNode.scrollWidth * bodyNode.clientWidth
|
|
148
|
-
};
|
|
149
|
-
});
|
|
150
|
-
});
|
|
151
|
-
return () => {
|
|
152
|
-
if (bodyScrollWidth.value <= bodyWidth.value || !scrollBarWidth.value || scrollState.value.isHiddenScrollBar) return null;
|
|
153
|
-
return (0, vue.createVNode)("div", {
|
|
154
|
-
"style": {
|
|
155
|
-
height: `${(0, _v_c_util_dist_getScrollBarSize.default)()}px`,
|
|
156
|
-
width: `${bodyWidth.value}px`,
|
|
157
|
-
bottom: `${props.offsetScroll}px`
|
|
158
|
-
},
|
|
159
|
-
"class": `${prefixCls}-sticky-scroll`
|
|
160
|
-
}, [(0, vue.createVNode)("div", {
|
|
161
|
-
"onMousedown": onMouseDown,
|
|
162
|
-
"ref": scrollBarRef,
|
|
163
|
-
"class": (0, _v_c_util.clsx)(`${prefixCls}-sticky-scroll-bar`, { [`${prefixCls}-sticky-scroll-bar-active`]: isActive.value }),
|
|
164
|
-
"style": {
|
|
165
|
-
width: `${scrollBarWidth.value}px`,
|
|
166
|
-
transform: `translate3d(${scrollState.value.scrollLeft}px, 0, 0)`
|
|
167
|
-
}
|
|
168
|
-
}, null)]);
|
|
169
|
-
};
|
|
170
|
-
}
|
|
171
|
-
});
|
|
172
|
-
var stickyScrollBar_default = StickyScrollBar;
|
|
173
|
-
exports.default = stickyScrollBar_default;
|
package/dist/sugar/Column.cjs
DELETED
|
@@ -1,109 +0,0 @@
|
|
|
1
|
-
Object.defineProperties(exports, {
|
|
2
|
-
__esModule: { value: true },
|
|
3
|
-
[Symbol.toStringTag]: { value: "Module" }
|
|
4
|
-
});
|
|
5
|
-
const require_rolldown_runtime = require("../_virtual/rolldown_runtime.cjs");
|
|
6
|
-
let vue = require("vue");
|
|
7
|
-
var Column = /* @__PURE__ */ (0, vue.defineComponent)(() => {
|
|
8
|
-
return () => null;
|
|
9
|
-
}, { props: {
|
|
10
|
-
colSpan: {
|
|
11
|
-
type: Number,
|
|
12
|
-
required: false,
|
|
13
|
-
default: void 0
|
|
14
|
-
},
|
|
15
|
-
dataIndex: {
|
|
16
|
-
required: false,
|
|
17
|
-
default: void 0
|
|
18
|
-
},
|
|
19
|
-
render: {
|
|
20
|
-
type: Function,
|
|
21
|
-
required: false,
|
|
22
|
-
default: void 0
|
|
23
|
-
},
|
|
24
|
-
shouldCellUpdate: {
|
|
25
|
-
type: Function,
|
|
26
|
-
required: false,
|
|
27
|
-
default: void 0
|
|
28
|
-
},
|
|
29
|
-
rowSpan: {
|
|
30
|
-
type: Number,
|
|
31
|
-
required: false,
|
|
32
|
-
default: void 0
|
|
33
|
-
},
|
|
34
|
-
width: {
|
|
35
|
-
type: [Number, String],
|
|
36
|
-
required: false,
|
|
37
|
-
default: void 0
|
|
38
|
-
},
|
|
39
|
-
minWidth: {
|
|
40
|
-
type: Number,
|
|
41
|
-
required: false,
|
|
42
|
-
default: void 0
|
|
43
|
-
},
|
|
44
|
-
onCell: {
|
|
45
|
-
type: Function,
|
|
46
|
-
required: false,
|
|
47
|
-
default: void 0
|
|
48
|
-
},
|
|
49
|
-
onCellClick: {
|
|
50
|
-
type: Function,
|
|
51
|
-
required: false,
|
|
52
|
-
default: void 0
|
|
53
|
-
},
|
|
54
|
-
title: {
|
|
55
|
-
type: [
|
|
56
|
-
Object,
|
|
57
|
-
Function,
|
|
58
|
-
String,
|
|
59
|
-
Number,
|
|
60
|
-
null,
|
|
61
|
-
Boolean,
|
|
62
|
-
Array
|
|
63
|
-
],
|
|
64
|
-
required: false,
|
|
65
|
-
default: void 0
|
|
66
|
-
},
|
|
67
|
-
key: {
|
|
68
|
-
type: [String, Number],
|
|
69
|
-
required: false,
|
|
70
|
-
default: void 0
|
|
71
|
-
},
|
|
72
|
-
className: {
|
|
73
|
-
type: String,
|
|
74
|
-
required: false,
|
|
75
|
-
default: void 0
|
|
76
|
-
},
|
|
77
|
-
hidden: {
|
|
78
|
-
type: Boolean,
|
|
79
|
-
required: false,
|
|
80
|
-
default: void 0
|
|
81
|
-
},
|
|
82
|
-
fixed: {
|
|
83
|
-
type: [String, Boolean],
|
|
84
|
-
required: false,
|
|
85
|
-
default: void 0
|
|
86
|
-
},
|
|
87
|
-
onHeaderCell: {
|
|
88
|
-
type: Function,
|
|
89
|
-
required: false,
|
|
90
|
-
default: void 0
|
|
91
|
-
},
|
|
92
|
-
ellipsis: {
|
|
93
|
-
type: [Object, Boolean],
|
|
94
|
-
required: false,
|
|
95
|
-
default: void 0
|
|
96
|
-
},
|
|
97
|
-
align: {
|
|
98
|
-
type: String,
|
|
99
|
-
required: false,
|
|
100
|
-
default: void 0
|
|
101
|
-
},
|
|
102
|
-
rowScope: {
|
|
103
|
-
type: String,
|
|
104
|
-
required: false,
|
|
105
|
-
default: void 0
|
|
106
|
-
}
|
|
107
|
-
} });
|
|
108
|
-
var Column_default = Column;
|
|
109
|
-
exports.default = Column_default;
|
|
@@ -1,109 +0,0 @@
|
|
|
1
|
-
Object.defineProperties(exports, {
|
|
2
|
-
__esModule: { value: true },
|
|
3
|
-
[Symbol.toStringTag]: { value: "Module" }
|
|
4
|
-
});
|
|
5
|
-
const require_rolldown_runtime = require("../_virtual/rolldown_runtime.cjs");
|
|
6
|
-
let vue = require("vue");
|
|
7
|
-
var ColumnGroup = /* @__PURE__ */ (0, vue.defineComponent)(() => {
|
|
8
|
-
return () => null;
|
|
9
|
-
}, { props: {
|
|
10
|
-
colSpan: {
|
|
11
|
-
type: Number,
|
|
12
|
-
required: false,
|
|
13
|
-
default: void 0
|
|
14
|
-
},
|
|
15
|
-
dataIndex: {
|
|
16
|
-
required: false,
|
|
17
|
-
default: void 0
|
|
18
|
-
},
|
|
19
|
-
render: {
|
|
20
|
-
type: Function,
|
|
21
|
-
required: false,
|
|
22
|
-
default: void 0
|
|
23
|
-
},
|
|
24
|
-
shouldCellUpdate: {
|
|
25
|
-
type: Function,
|
|
26
|
-
required: false,
|
|
27
|
-
default: void 0
|
|
28
|
-
},
|
|
29
|
-
rowSpan: {
|
|
30
|
-
type: Number,
|
|
31
|
-
required: false,
|
|
32
|
-
default: void 0
|
|
33
|
-
},
|
|
34
|
-
width: {
|
|
35
|
-
type: [Number, String],
|
|
36
|
-
required: false,
|
|
37
|
-
default: void 0
|
|
38
|
-
},
|
|
39
|
-
minWidth: {
|
|
40
|
-
type: Number,
|
|
41
|
-
required: false,
|
|
42
|
-
default: void 0
|
|
43
|
-
},
|
|
44
|
-
onCell: {
|
|
45
|
-
type: Function,
|
|
46
|
-
required: false,
|
|
47
|
-
default: void 0
|
|
48
|
-
},
|
|
49
|
-
onCellClick: {
|
|
50
|
-
type: Function,
|
|
51
|
-
required: false,
|
|
52
|
-
default: void 0
|
|
53
|
-
},
|
|
54
|
-
title: {
|
|
55
|
-
type: [
|
|
56
|
-
Object,
|
|
57
|
-
Function,
|
|
58
|
-
String,
|
|
59
|
-
Number,
|
|
60
|
-
null,
|
|
61
|
-
Boolean,
|
|
62
|
-
Array
|
|
63
|
-
],
|
|
64
|
-
required: false,
|
|
65
|
-
default: void 0
|
|
66
|
-
},
|
|
67
|
-
key: {
|
|
68
|
-
type: [String, Number],
|
|
69
|
-
required: false,
|
|
70
|
-
default: void 0
|
|
71
|
-
},
|
|
72
|
-
className: {
|
|
73
|
-
type: String,
|
|
74
|
-
required: false,
|
|
75
|
-
default: void 0
|
|
76
|
-
},
|
|
77
|
-
hidden: {
|
|
78
|
-
type: Boolean,
|
|
79
|
-
required: false,
|
|
80
|
-
default: void 0
|
|
81
|
-
},
|
|
82
|
-
fixed: {
|
|
83
|
-
type: [String, Boolean],
|
|
84
|
-
required: false,
|
|
85
|
-
default: void 0
|
|
86
|
-
},
|
|
87
|
-
onHeaderCell: {
|
|
88
|
-
type: Function,
|
|
89
|
-
required: false,
|
|
90
|
-
default: void 0
|
|
91
|
-
},
|
|
92
|
-
ellipsis: {
|
|
93
|
-
type: [Object, Boolean],
|
|
94
|
-
required: false,
|
|
95
|
-
default: void 0
|
|
96
|
-
},
|
|
97
|
-
align: {
|
|
98
|
-
type: String,
|
|
99
|
-
required: false,
|
|
100
|
-
default: void 0
|
|
101
|
-
},
|
|
102
|
-
rowScope: {
|
|
103
|
-
type: String,
|
|
104
|
-
required: false,
|
|
105
|
-
default: void 0
|
|
106
|
-
}
|
|
107
|
-
} });
|
|
108
|
-
var ColumnGroup_default = ColumnGroup;
|
|
109
|
-
exports.default = ColumnGroup_default;
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_rolldown_runtime = require("../_virtual/rolldown_runtime.cjs");
|
|
3
|
-
let vue = require("vue");
|
|
4
|
-
let _v_c_util = require("@v-c/util");
|
|
5
|
-
function renderExpandIcon({ prefixCls, record, onExpand, expanded, expandable }) {
|
|
6
|
-
const expandClassName = `${prefixCls}-row-expand-icon`;
|
|
7
|
-
if (!expandable) return (0, vue.createVNode)("span", { "class": (0, _v_c_util.clsx)(expandClassName, `${prefixCls}-row-spaced`) }, null);
|
|
8
|
-
const onClick = (event) => {
|
|
9
|
-
onExpand(record, event);
|
|
10
|
-
event.stopPropagation();
|
|
11
|
-
};
|
|
12
|
-
return (0, vue.createVNode)("span", {
|
|
13
|
-
"class": (0, _v_c_util.clsx)(expandClassName, {
|
|
14
|
-
[`${prefixCls}-row-expanded`]: expanded,
|
|
15
|
-
[`${prefixCls}-row-collapsed`]: !expanded
|
|
16
|
-
}),
|
|
17
|
-
"onClick": onClick
|
|
18
|
-
}, null);
|
|
19
|
-
}
|
|
20
|
-
function findAllChildrenKeys(data, getRowKey, childrenColumnName) {
|
|
21
|
-
const keys = [];
|
|
22
|
-
function dig(list) {
|
|
23
|
-
(list || []).forEach((item, index) => {
|
|
24
|
-
keys.push(getRowKey(item, index));
|
|
25
|
-
dig(item[childrenColumnName]);
|
|
26
|
-
});
|
|
27
|
-
}
|
|
28
|
-
dig(data);
|
|
29
|
-
return keys;
|
|
30
|
-
}
|
|
31
|
-
function computedExpandedClassName(cls, record, index, indent) {
|
|
32
|
-
if (typeof cls === "string") return cls;
|
|
33
|
-
if (typeof cls === "function") return cls(record, index, indent);
|
|
34
|
-
return "";
|
|
35
|
-
}
|
|
36
|
-
exports.computedExpandedClassName = computedExpandedClassName;
|
|
37
|
-
exports.findAllChildrenKeys = findAllChildrenKeys;
|
|
38
|
-
exports.renderExpandIcon = renderExpandIcon;
|