stk-table-vue 1.0.2 → 1.0.3
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.
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* homepage: https://ja-plus.github.io/stk-table-vue/
|
|
7
7
|
* license: MIT
|
|
8
8
|
*/
|
|
9
|
-
import { t as StkTable_default } from "./StkTable-
|
|
9
|
+
import { t as StkTable_default } from "./StkTable-CoLDxW4i.js";
|
|
10
10
|
import { createElementBlock, createElementVNode, createVNode, defineComponent, h, nextTick, normalizeClass, normalizeStyle, onMounted, onUnmounted, openBlock, reactive, ref, withModifiers } from "vue";
|
|
11
11
|
//#region src/StkTable/custom-cells/FilterCell/Dropdown/index.vue?vue&type=script&setup=true&lang.ts
|
|
12
12
|
var DROPDOWN_DEFAULT_WIDTH = 300;
|
|
@@ -3575,33 +3575,34 @@ function useWheeling(resetDelay = 500) {
|
|
|
3575
3575
|
var _hoisted_1 = ["tabindex"];
|
|
3576
3576
|
var _hoisted_2 = { class: "stk-table-scroll-container" };
|
|
3577
3577
|
var _hoisted_3 = { key: 0 };
|
|
3578
|
-
var _hoisted_4 =
|
|
3579
|
-
var _hoisted_5 = ["
|
|
3580
|
-
var _hoisted_6 =
|
|
3581
|
-
var _hoisted_7 =
|
|
3582
|
-
var _hoisted_8 = ["
|
|
3583
|
-
var _hoisted_9 = ["
|
|
3584
|
-
var _hoisted_10 =
|
|
3585
|
-
var _hoisted_11 =
|
|
3578
|
+
var _hoisted_4 = { key: 1 };
|
|
3579
|
+
var _hoisted_5 = ["onClick"];
|
|
3580
|
+
var _hoisted_6 = ["onMousedown"];
|
|
3581
|
+
var _hoisted_7 = { class: "table-header-title" };
|
|
3582
|
+
var _hoisted_8 = ["onMousedown"];
|
|
3583
|
+
var _hoisted_9 = ["colspan"];
|
|
3584
|
+
var _hoisted_10 = ["title"];
|
|
3585
|
+
var _hoisted_11 = { key: 0 };
|
|
3586
3586
|
var _hoisted_12 = ["colspan"];
|
|
3587
|
-
var _hoisted_13 =
|
|
3587
|
+
var _hoisted_13 = ["colspan"];
|
|
3588
|
+
var _hoisted_14 = {
|
|
3588
3589
|
class: "table-cell-wrapper",
|
|
3589
3590
|
tabindex: "-1"
|
|
3590
3591
|
};
|
|
3591
|
-
var
|
|
3592
|
+
var _hoisted_15 = {
|
|
3592
3593
|
key: 0,
|
|
3593
3594
|
class: "vt-x-left"
|
|
3594
3595
|
};
|
|
3595
|
-
var
|
|
3596
|
-
var
|
|
3597
|
-
var
|
|
3596
|
+
var _hoisted_16 = ["colspan"];
|
|
3597
|
+
var _hoisted_17 = ["title"];
|
|
3598
|
+
var _hoisted_18 = {
|
|
3598
3599
|
key: 2,
|
|
3599
3600
|
class: "table-cell-wrapper",
|
|
3600
3601
|
tabindex: "-1"
|
|
3601
3602
|
};
|
|
3602
|
-
var
|
|
3603
|
-
var
|
|
3604
|
-
var
|
|
3603
|
+
var _hoisted_19 = ["title"];
|
|
3604
|
+
var _hoisted_20 = { key: 2 };
|
|
3605
|
+
var _hoisted_21 = {
|
|
3605
3606
|
key: 1,
|
|
3606
3607
|
class: "vt-x-right"
|
|
3607
3608
|
};
|
|
@@ -4075,6 +4076,15 @@ var StkTable_default = /* @__PURE__ */ defineComponent({
|
|
|
4075
4076
|
[TagType.TF]: tfMap
|
|
4076
4077
|
};
|
|
4077
4078
|
});
|
|
4079
|
+
/**
|
|
4080
|
+
* fixed 模式下 colgroup 中单个 col 的样式。
|
|
4081
|
+
* 仅取叶子列的 width(与 cellStyleMap 中 --cw 保持一致);未设置 width 的列不声明宽度,
|
|
4082
|
+
* 由 table-layout:fixed 将剩余空间平分,符合“一列固定、其余列平分”的预期。
|
|
4083
|
+
*/
|
|
4084
|
+
function getColGroupColStyle(col) {
|
|
4085
|
+
const width = transformWidthToStr(col.width);
|
|
4086
|
+
return width ? `width:${width}` : null;
|
|
4087
|
+
}
|
|
4078
4088
|
function getAbsoluteRowIndex(rowIndex) {
|
|
4079
4089
|
return rowIndex + virtualScroll.value.startIndex;
|
|
4080
4090
|
}
|
|
@@ -4692,7 +4702,13 @@ var StkTable_default = /* @__PURE__ */ defineComponent({
|
|
|
4692
4702
|
onContextmenu: onRowMenu,
|
|
4693
4703
|
onMouseover: onTrMouseOver
|
|
4694
4704
|
}, [
|
|
4695
|
-
|
|
4705
|
+
props.fixedMode && !unref(virtualX_on) ? (openBlock(), createElementBlock("colgroup", _hoisted_3, [(openBlock(true), createElementBlock(Fragment, null, renderList(tableHeaderLast.value, (col) => {
|
|
4706
|
+
return openBlock(), createElementBlock("col", {
|
|
4707
|
+
key: colKeyGen.value(col),
|
|
4708
|
+
style: normalizeStyle(getColGroupColStyle(col))
|
|
4709
|
+
}, null, 4);
|
|
4710
|
+
}), 128))])) : createCommentVNode("", true),
|
|
4711
|
+
!__props.headless ? (openBlock(), createElementBlock("thead", _hoisted_4, [(openBlock(true), createElementBlock(Fragment, null, renderList(unref(virtualX_on) ? unref(virtualX_tableHeaders) : unref(tableHeaders), (row, rowIndex) => {
|
|
4696
4712
|
return openBlock(), createElementBlock("tr", {
|
|
4697
4713
|
key: rowIndex,
|
|
4698
4714
|
onContextmenu: _cache[3] || (_cache[3] = ($event) => onHeaderMenu($event))
|
|
@@ -4713,7 +4729,7 @@ var StkTable_default = /* @__PURE__ */ defineComponent({
|
|
|
4713
4729
|
key: 0,
|
|
4714
4730
|
class: "table-header-resizer left",
|
|
4715
4731
|
onMousedown: ($event) => unref(onThResizeMouseDown)($event, col, true)
|
|
4716
|
-
}, null, 40,
|
|
4732
|
+
}, null, 40, _hoisted_6)) : createCommentVNode("", true),
|
|
4717
4733
|
createElementVNode("div", {
|
|
4718
4734
|
class: "table-header-cell-wrapper",
|
|
4719
4735
|
style: normalizeStyle(col.__R_SP__ ? `--row-span:${col.__R_SP__}` : null)
|
|
@@ -4729,7 +4745,7 @@ var StkTable_default = /* @__PURE__ */ defineComponent({
|
|
|
4729
4745
|
])) : renderSlot(_ctx.$slots, "tableHeader", {
|
|
4730
4746
|
key: 1,
|
|
4731
4747
|
col
|
|
4732
|
-
}, () => [createElementVNode("span",
|
|
4748
|
+
}, () => [createElementVNode("span", _hoisted_7, toDisplayString(col.title), 1)]), col.sorter ? (openBlock(), createBlock(SortIcon_default, {
|
|
4733
4749
|
key: 2,
|
|
4734
4750
|
class: "table-header-sorter"
|
|
4735
4751
|
})) : createCommentVNode("", true)], 4),
|
|
@@ -4737,8 +4753,8 @@ var StkTable_default = /* @__PURE__ */ defineComponent({
|
|
|
4737
4753
|
key: 1,
|
|
4738
4754
|
class: "table-header-resizer right",
|
|
4739
4755
|
onMousedown: ($event) => unref(onThResizeMouseDown)($event, col)
|
|
4740
|
-
}, null, 40,
|
|
4741
|
-
], 16,
|
|
4756
|
+
}, null, 40, _hoisted_8)) : createCommentVNode("", true)
|
|
4757
|
+
], 16, _hoisted_5);
|
|
4742
4758
|
}), 128)),
|
|
4743
4759
|
unref(virtualX_on) ? (openBlock(), createElementBlock("th", {
|
|
4744
4760
|
key: 1,
|
|
@@ -4748,7 +4764,7 @@ var StkTable_default = /* @__PURE__ */ defineComponent({
|
|
|
4748
4764
|
], 32);
|
|
4749
4765
|
}), 128))])) : createCommentVNode("", true),
|
|
4750
4766
|
__props.footerData && __props.footerData.length > 0 ? (openBlock(), createBlock(resolveDynamicComponent(footerTagName.value), {
|
|
4751
|
-
key:
|
|
4767
|
+
key: 2,
|
|
4752
4768
|
class: "stk-footer",
|
|
4753
4769
|
style: normalizeStyle(isFooterTop.value ? `top:${unref(tableHeaderHeight)}px` : "")
|
|
4754
4770
|
}, {
|
|
@@ -4764,7 +4780,7 @@ var StkTable_default = /* @__PURE__ */ defineComponent({
|
|
|
4764
4780
|
key: 0,
|
|
4765
4781
|
class: "vt-x-spacer",
|
|
4766
4782
|
colspan: col.__VT_C_SP__
|
|
4767
|
-
}, null, 8,
|
|
4783
|
+
}, null, 8, _hoisted_9)) : (openBlock(), createElementBlock("td", mergeProps({
|
|
4768
4784
|
key: 1,
|
|
4769
4785
|
ref_for: true
|
|
4770
4786
|
}, getTFProps(col)), [col.customFooterCell ? (openBlock(), createBlock(resolveDynamicComponent(col.customFooterCell), {
|
|
@@ -4784,7 +4800,7 @@ var StkTable_default = /* @__PURE__ */ defineComponent({
|
|
|
4784
4800
|
class: "table-cell-wrapper",
|
|
4785
4801
|
tabindex: "-1",
|
|
4786
4802
|
title: footRow[col.dataIndex] || ""
|
|
4787
|
-
}, [footRow[col.dataIndex] != null ? (openBlock(), createElementBlock("span",
|
|
4803
|
+
}, [footRow[col.dataIndex] != null ? (openBlock(), createElementBlock("span", _hoisted_11, toDisplayString(footRow[col.dataIndex]), 1)) : createCommentVNode("", true)], 8, _hoisted_10)], 16))], 64);
|
|
4788
4804
|
}), 128)),
|
|
4789
4805
|
unref(virtualX_on) ? (openBlock(), createElementBlock("td", {
|
|
4790
4806
|
key: 1,
|
|
@@ -4819,7 +4835,7 @@ var StkTable_default = /* @__PURE__ */ defineComponent({
|
|
|
4819
4835
|
key: 0,
|
|
4820
4836
|
class: "vt-x-spacer",
|
|
4821
4837
|
colspan: col.__VT_C_SP__
|
|
4822
|
-
}, null, 8,
|
|
4838
|
+
}, null, 8, _hoisted_12)) : (openBlock(), createElementBlock("td", {
|
|
4823
4839
|
key: 1,
|
|
4824
4840
|
style: normalizeStyle(cellStyleMap.value[unref(TagType).TD].get(colKeyGen.value(col)))
|
|
4825
4841
|
}, null, 4))], 64);
|
|
@@ -4839,17 +4855,17 @@ var StkTable_default = /* @__PURE__ */ defineComponent({
|
|
|
4839
4855
|
}, { ref_for: true }, getTRProps(row, rowIndex)), [row && row.__EXP_R__ ? (openBlock(), createElementBlock("td", {
|
|
4840
4856
|
key: 0,
|
|
4841
4857
|
colspan: unref(expandRowColspan)
|
|
4842
|
-
}, [createElementVNode("div",
|
|
4858
|
+
}, [createElementVNode("div", _hoisted_14, [renderSlot(_ctx.$slots, "expand", {
|
|
4843
4859
|
row: row.__EXP_R__,
|
|
4844
4860
|
col: row.__EXP_C__
|
|
4845
|
-
}, () => [createTextVNode(toDisplayString(row.__EXP_R__ && row.__EXP_C__ && row.__EXP_R__[row.__EXP_C__.dataIndex] || ""), 1)])])], 8,
|
|
4846
|
-
unref(virtualX_on) ? (openBlock(), createElementBlock("td",
|
|
4861
|
+
}, () => [createTextVNode(toDisplayString(row.__EXP_R__ && row.__EXP_C__ && row.__EXP_R__[row.__EXP_C__.dataIndex] || ""), 1)])])], 8, _hoisted_13)) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
|
|
4862
|
+
unref(virtualX_on) ? (openBlock(), createElementBlock("td", _hoisted_15)) : createCommentVNode("", true),
|
|
4847
4863
|
(openBlock(true), createElementBlock(Fragment, null, renderList(unref(virtualX_columnPart), (col, _colIdx) => {
|
|
4848
4864
|
return openBlock(), createElementBlock(Fragment, { key: col.__VT_C_SP__ ? `spacer-${_colIdx}` : colKeyGen.value(col) }, [col.__VT_C_SP__ ? (openBlock(), createElementBlock("td", {
|
|
4849
4865
|
key: 0,
|
|
4850
4866
|
class: "vt-x-spacer",
|
|
4851
4867
|
colspan: col.__VT_C_SP__
|
|
4852
|
-
}, null, 8,
|
|
4868
|
+
}, null, 8, _hoisted_16)) : !shouldHideCell(row, col) ? (openBlock(), createElementBlock("td", mergeProps({
|
|
4853
4869
|
key: 1,
|
|
4854
4870
|
ref_for: true
|
|
4855
4871
|
}, getTDProps(row, col, rowIndex, col.__LF_S__ ?? 0)), [col.customCell ? (openBlock(), createBlock(resolveDynamicComponent(col.customCell), {
|
|
@@ -4880,7 +4896,7 @@ var StkTable_default = /* @__PURE__ */ defineComponent({
|
|
|
4880
4896
|
class: "table-cell-wrapper",
|
|
4881
4897
|
tabindex: "-1",
|
|
4882
4898
|
title: row[col.dataIndex] || ""
|
|
4883
|
-
}, toDisplayString((row && row[col.dataIndex]) != null ? row && row[col.dataIndex] : getEmptyCellText.value(col, row)), 9,
|
|
4899
|
+
}, toDisplayString((row && row[col.dataIndex]) != null ? row && row[col.dataIndex] : getEmptyCellText.value(col, row)), 9, _hoisted_17)) : col.type === "seq" ? (openBlock(), createElementBlock("div", _hoisted_18, toDisplayString((props.seqConfig.startIndex || 0) + getAbsoluteRowIndex(rowIndex) + 1), 1)) : col.type === "tree-node" ? (openBlock(), createBlock(TreeNodeCell_default, {
|
|
4884
4900
|
key: 3,
|
|
4885
4901
|
class: "table-cell-wrapper",
|
|
4886
4902
|
tabindex: "-1",
|
|
@@ -4894,9 +4910,9 @@ var StkTable_default = /* @__PURE__ */ defineComponent({
|
|
|
4894
4910
|
}, [col.type === "dragRow" ? (openBlock(), createBlock(DragHandle_default, {
|
|
4895
4911
|
key: 0,
|
|
4896
4912
|
onDragstart: ($event) => unref(onTrDragStart)($event, getAbsoluteRowIndex(rowIndex))
|
|
4897
|
-
}, null, 8, ["onDragstart"])) : col.type === "expand" ? (openBlock(), createBlock(TriangleIcon_default, { key: 1 })) : createCommentVNode("", true), row[col.dataIndex] != null ? (openBlock(), createElementBlock("span",
|
|
4913
|
+
}, null, 8, ["onDragstart"])) : col.type === "expand" ? (openBlock(), createBlock(TriangleIcon_default, { key: 1 })) : createCommentVNode("", true), row[col.dataIndex] != null ? (openBlock(), createElementBlock("span", _hoisted_20, toDisplayString(row[col.dataIndex]), 1)) : createCommentVNode("", true)], 8, _hoisted_19))], 16)) : createCommentVNode("", true)], 64);
|
|
4898
4914
|
}), 128)),
|
|
4899
|
-
unref(virtualX_on) ? (openBlock(), createElementBlock("td",
|
|
4915
|
+
unref(virtualX_on) ? (openBlock(), createElementBlock("td", _hoisted_21)) : createCommentVNode("", true)
|
|
4900
4916
|
], 64))], 16);
|
|
4901
4917
|
}), 128)),
|
|
4902
4918
|
!isExperimentalScrollY.value ? (openBlock(), createElementBlock(Fragment, { key: 1 }, [unref(virtual_on) && !unref(isSRBRActive) ? (openBlock(), createElementBlock("tr", {
|
package/lib/stk-table-vue.js
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* homepage: https://ja-plus.github.io/stk-table-vue/
|
|
7
7
|
* license: MIT
|
|
8
8
|
*/
|
|
9
|
-
import { a as insertToOrderedArray, i as binarySearch, n as registerFeature, o as strCompare, r as useAreaSelection, s as tableSort, t as StkTable_default } from "./StkTable-
|
|
9
|
+
import { a as insertToOrderedArray, i as binarySearch, n as registerFeature, o as strCompare, r as useAreaSelection, s as tableSort, t as StkTable_default } from "./StkTable-CoLDxW4i.js";
|
|
10
10
|
import { Fragment, computed, createApp, createBlock, createElementBlock, createElementVNode, createTextVNode, defineComponent, getCurrentInstance, h, markRaw, nextTick, normalizeClass, openBlock, ref, renderSlot, resolveDynamicComponent, toDisplayString, watch, withModifiers } from "vue";
|
|
11
11
|
//#region src/StkTable/custom-cells/FilterCell/Dropdown/index.ts
|
|
12
12
|
var DropdownIns = null;
|
|
@@ -15,7 +15,7 @@ async function getDropdownIns() {
|
|
|
15
15
|
const div = document.createElement("div");
|
|
16
16
|
div.classList.add("stk-filter-dropdown-wrapper");
|
|
17
17
|
document.body.appendChild(div);
|
|
18
|
-
DropdownIns = createApp(await import("./Dropdown-
|
|
18
|
+
DropdownIns = createApp(await import("./Dropdown-gzfyZN4Y.js").then((module) => module.default)).mount(div);
|
|
19
19
|
}
|
|
20
20
|
return DropdownIns;
|
|
21
21
|
}
|
package/package.json
CHANGED
|
@@ -61,6 +61,11 @@
|
|
|
61
61
|
@contextmenu="onRowMenu"
|
|
62
62
|
@mouseover="onTrMouseOver"
|
|
63
63
|
>
|
|
64
|
+
<!-- table-layout:fixed 下浏览器仅依据首行/colgroup 决定列宽,多级表头时子列宽度位于非首行会被忽略。
|
|
65
|
+
故固定模式下通过 colgroup 显式声明每个叶子列宽度,保证子列 width 生效。 -->
|
|
66
|
+
<colgroup v-if="props.fixedMode && !virtualX_on">
|
|
67
|
+
<col v-for="col in tableHeaderLast" :key="colKeyGen(col)" :style="getColGroupColStyle(col)" />
|
|
68
|
+
</colgroup>
|
|
64
69
|
<thead v-if="!headless">
|
|
65
70
|
<tr
|
|
66
71
|
v-for="(row, rowIndex) in virtualX_on ? virtualX_tableHeaders : tableHeaders"
|
|
@@ -1199,6 +1204,16 @@ const cellStyleMap = computed(() => {
|
|
|
1199
1204
|
};
|
|
1200
1205
|
});
|
|
1201
1206
|
|
|
1207
|
+
/**
|
|
1208
|
+
* fixed 模式下 colgroup 中单个 col 的样式。
|
|
1209
|
+
* 仅取叶子列的 width(与 cellStyleMap 中 --cw 保持一致);未设置 width 的列不声明宽度,
|
|
1210
|
+
* 由 table-layout:fixed 将剩余空间平分,符合“一列固定、其余列平分”的预期。
|
|
1211
|
+
*/
|
|
1212
|
+
function getColGroupColStyle(col: PrivateStkTableColumn<DT>) {
|
|
1213
|
+
const width = transformWidthToStr(col.width);
|
|
1214
|
+
return width ? `width:${width}` : null;
|
|
1215
|
+
}
|
|
1216
|
+
|
|
1202
1217
|
function getAbsoluteRowIndex(rowIndex: number) {
|
|
1203
1218
|
return rowIndex + virtualScroll.value.startIndex;
|
|
1204
1219
|
}
|