@antv/s2-vue 1.2.2 → 1.3.0
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/dist/index.min.js +1 -1
- package/dist/index.min.js.map +1 -1
- package/esm/index.d.ts +97 -1236
- package/esm/index.js +155 -151
- package/esm/index.js.map +1 -1
- package/lib/index.js +152 -147
- package/lib/index.js.map +1 -1
- package/package.json +1 -1
package/esm/index.js
CHANGED
|
@@ -17,9 +17,9 @@ var __spreadValues = (a, b) => {
|
|
|
17
17
|
return a;
|
|
18
18
|
};
|
|
19
19
|
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
20
|
-
import { customMerge, DEFAULT_OPTIONS, S2Event, extendLocale,
|
|
21
|
-
import { shallowRef,
|
|
22
|
-
import {
|
|
20
|
+
import { customMerge, DEFAULT_OPTIONS, S2Event, extendLocale, TOOLTIP_PREFIX_CLS, i18n, getIcon, getTooltipDefaultOptions, BaseTooltip, S2_PREFIX_CLS, getBaseCellData, TableSheet as TableSheet$1, PivotSheet as PivotSheet$1 } from "@antv/s2";
|
|
21
|
+
import { shallowRef, defineComponent, openBlock, createElementBlock, Fragment, renderList, normalizeClass, createElementVNode, toDisplayString, createCommentVNode, computed, createTextVNode, resolveComponent, createBlock, withCtx, createVNode, renderSlot, render as render$3, ref, watch, onMounted, reactive, isProxy, onBeforeUnmount, toRaw, toRefs, mergeProps, resolveDynamicComponent } from "vue";
|
|
22
|
+
import { Menu, Dropdown, Pagination, Spin, Button, Input, Empty, MenuItem } from "ant-design-vue";
|
|
23
23
|
const EN_US = {
|
|
24
24
|
\u9009\u62E9\u5206\u6790\u4FE1\u606F: "Select Analysis Information",
|
|
25
25
|
\u5207\u6362\u6307\u6807: "Switch indicator",
|
|
@@ -1782,72 +1782,6 @@ const useExpose = (expose) => {
|
|
|
1782
1782
|
});
|
|
1783
1783
|
return s2Ref;
|
|
1784
1784
|
};
|
|
1785
|
-
const DEFAULT_PAGE_NUMBER = 1;
|
|
1786
|
-
const DEFAULT_PAGE_SIZE = 10;
|
|
1787
|
-
const usePagination = (s2Ref, props) => {
|
|
1788
|
-
var _a, _b, _c, _d, _e, _f;
|
|
1789
|
-
const current = ref((_c = (_b = (_a = props.options) == null ? void 0 : _a.pagination) == null ? void 0 : _b.current) != null ? _c : DEFAULT_PAGE_NUMBER);
|
|
1790
|
-
const pageSize = ref((_f = (_e = (_d = props.options) == null ? void 0 : _d.pagination) == null ? void 0 : _e.pageSize) != null ? _f : DEFAULT_PAGE_SIZE);
|
|
1791
|
-
const total = ref(0);
|
|
1792
|
-
const change = (nextCurrent) => {
|
|
1793
|
-
current.value = nextCurrent;
|
|
1794
|
-
};
|
|
1795
|
-
const showSizeChange = (nextPageSize) => {
|
|
1796
|
-
pageSize.value = nextPageSize;
|
|
1797
|
-
};
|
|
1798
|
-
const visible = computed(() => {
|
|
1799
|
-
var _a2;
|
|
1800
|
-
return props.showPagination && !isEmpty((_a2 = props.options) == null ? void 0 : _a2.pagination);
|
|
1801
|
-
});
|
|
1802
|
-
watch([current, pageSize], () => {
|
|
1803
|
-
var _a2;
|
|
1804
|
-
if (!s2Ref.value) {
|
|
1805
|
-
return;
|
|
1806
|
-
}
|
|
1807
|
-
const nextPagination = isEmpty((_a2 = props.options) == null ? void 0 : _a2.pagination) ? null : {
|
|
1808
|
-
current: current.value,
|
|
1809
|
-
pageSize: pageSize.value
|
|
1810
|
-
};
|
|
1811
|
-
s2Ref.value.updatePagination(nextPagination);
|
|
1812
|
-
s2Ref.value.render(false);
|
|
1813
|
-
});
|
|
1814
|
-
watch([() => {
|
|
1815
|
-
var _a2;
|
|
1816
|
-
return (_a2 = props.options) == null ? void 0 : _a2.pagination;
|
|
1817
|
-
}, s2Ref], () => {
|
|
1818
|
-
var _a2, _b2, _c2, _d2, _e2, _f2, _g, _h, _i;
|
|
1819
|
-
current.value = (_c2 = (_b2 = (_a2 = props.options) == null ? void 0 : _a2.pagination) == null ? void 0 : _b2.current) != null ? _c2 : DEFAULT_PAGE_NUMBER;
|
|
1820
|
-
pageSize.value = (_f2 = (_e2 = (_d2 = props.options) == null ? void 0 : _d2.pagination) == null ? void 0 : _e2.pageSize) != null ? _f2 : DEFAULT_PAGE_SIZE;
|
|
1821
|
-
total.value = (_i = (_h = (_g = s2Ref.value) == null ? void 0 : _g.facet) == null ? void 0 : _h.viewCellHeights.getTotalLength()) != null ? _i : 0;
|
|
1822
|
-
}, {
|
|
1823
|
-
immediate: true
|
|
1824
|
-
});
|
|
1825
|
-
watch(s2Ref, (value, oldValue, onCleanup) => {
|
|
1826
|
-
if (!s2Ref.value) {
|
|
1827
|
-
return;
|
|
1828
|
-
}
|
|
1829
|
-
const totalUpdateCallback = (data) => {
|
|
1830
|
-
var _a2;
|
|
1831
|
-
if (isEmpty((_a2 = props.options) == null ? void 0 : _a2.pagination)) {
|
|
1832
|
-
return;
|
|
1833
|
-
}
|
|
1834
|
-
total.value = data.total;
|
|
1835
|
-
};
|
|
1836
|
-
s2Ref.value.on(S2Event.LAYOUT_PAGINATION, totalUpdateCallback);
|
|
1837
|
-
onCleanup(() => {
|
|
1838
|
-
var _a2;
|
|
1839
|
-
(_a2 = s2Ref.value) == null ? void 0 : _a2.off(S2Event.LAYOUT_PAGINATION, totalUpdateCallback);
|
|
1840
|
-
});
|
|
1841
|
-
});
|
|
1842
|
-
return {
|
|
1843
|
-
visible,
|
|
1844
|
-
current,
|
|
1845
|
-
pageSize,
|
|
1846
|
-
total,
|
|
1847
|
-
change,
|
|
1848
|
-
showSizeChange
|
|
1849
|
-
};
|
|
1850
|
-
};
|
|
1851
1785
|
var _export_sfc = (sfc, props) => {
|
|
1852
1786
|
const target = sfc.__vccOpts || sfc;
|
|
1853
1787
|
for (const [key, val] of props) {
|
|
@@ -1855,61 +1789,7 @@ var _export_sfc = (sfc, props) => {
|
|
|
1855
1789
|
}
|
|
1856
1790
|
return target;
|
|
1857
1791
|
};
|
|
1858
|
-
const PRE_CLASS = `${S2_PREFIX_CLS}-pagination`;
|
|
1859
1792
|
const _sfc_main$e = defineComponent({
|
|
1860
|
-
name: "s2-pagination",
|
|
1861
|
-
props: {
|
|
1862
|
-
current: {
|
|
1863
|
-
type: Number,
|
|
1864
|
-
default: DEFAULT_PAGE_NUMBER
|
|
1865
|
-
},
|
|
1866
|
-
total: {
|
|
1867
|
-
type: Number,
|
|
1868
|
-
default: 0
|
|
1869
|
-
},
|
|
1870
|
-
pageSize: {
|
|
1871
|
-
type: Number,
|
|
1872
|
-
default: DEFAULT_PAGE_SIZE
|
|
1873
|
-
}
|
|
1874
|
-
},
|
|
1875
|
-
emits: ["change", "showSizeChange"],
|
|
1876
|
-
setup: (props) => {
|
|
1877
|
-
const showQuickJumper = computed(() => {
|
|
1878
|
-
return props.total / props.pageSize > 5;
|
|
1879
|
-
});
|
|
1880
|
-
return {
|
|
1881
|
-
showQuickJumper,
|
|
1882
|
-
PRE_CLASS,
|
|
1883
|
-
i18n
|
|
1884
|
-
};
|
|
1885
|
-
},
|
|
1886
|
-
components: {
|
|
1887
|
-
AntDPagination: Pagination
|
|
1888
|
-
}
|
|
1889
|
-
});
|
|
1890
|
-
function _sfc_render$e(_ctx, _cache, $props, $setup, $data, $options) {
|
|
1891
|
-
const _component_AntDPagination = resolveComponent("AntDPagination");
|
|
1892
|
-
return openBlock(), createElementBlock("div", {
|
|
1893
|
-
class: normalizeClass(_ctx.PRE_CLASS)
|
|
1894
|
-
}, [
|
|
1895
|
-
createVNode(_component_AntDPagination, {
|
|
1896
|
-
"default-current": 1,
|
|
1897
|
-
current: _ctx.current,
|
|
1898
|
-
total: _ctx.total,
|
|
1899
|
-
pageSize: _ctx.pageSize,
|
|
1900
|
-
showSizeChanger: true,
|
|
1901
|
-
onShowSizeChange: _cache[0] || (_cache[0] = (_, size2) => _ctx.$emit("showSizeChange", size2)),
|
|
1902
|
-
size: "small",
|
|
1903
|
-
showQuickJumper: _ctx.showQuickJumper,
|
|
1904
|
-
onChange: _cache[1] || (_cache[1] = (current) => _ctx.$emit("change", current))
|
|
1905
|
-
}, null, 8, ["current", "total", "pageSize", "showQuickJumper"]),
|
|
1906
|
-
createElementVNode("span", {
|
|
1907
|
-
class: normalizeClass(`${_ctx.PRE_CLASS}-count`)
|
|
1908
|
-
}, toDisplayString(_ctx.i18n("\u5171\u8BA1")) + " " + toDisplayString(_ctx.total || " - ") + " " + toDisplayString(_ctx.i18n("\u6761")), 3)
|
|
1909
|
-
], 2);
|
|
1910
|
-
}
|
|
1911
|
-
var S2Pagination = /* @__PURE__ */ _export_sfc(_sfc_main$e, [["render", _sfc_render$e]]);
|
|
1912
|
-
const _sfc_main$d = defineComponent({
|
|
1913
1793
|
name: "TooltipDetail",
|
|
1914
1794
|
props: ["list"],
|
|
1915
1795
|
setup() {
|
|
@@ -1918,7 +1798,7 @@ const _sfc_main$d = defineComponent({
|
|
|
1918
1798
|
};
|
|
1919
1799
|
}
|
|
1920
1800
|
});
|
|
1921
|
-
function _sfc_render$
|
|
1801
|
+
function _sfc_render$e(_ctx, _cache, $props, $setup, $data, $options) {
|
|
1922
1802
|
return openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.list, (item, index2) => {
|
|
1923
1803
|
return openBlock(), createElementBlock("div", {
|
|
1924
1804
|
key: `${item.value}-${index2}`,
|
|
@@ -1937,8 +1817,8 @@ function _sfc_render$d(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
1937
1817
|
], 2);
|
|
1938
1818
|
}), 128);
|
|
1939
1819
|
}
|
|
1940
|
-
var TooltipDetail = /* @__PURE__ */ _export_sfc(_sfc_main$
|
|
1941
|
-
const _sfc_main$
|
|
1820
|
+
var TooltipDetail = /* @__PURE__ */ _export_sfc(_sfc_main$e, [["render", _sfc_render$e]]);
|
|
1821
|
+
const _sfc_main$d = defineComponent({
|
|
1942
1822
|
name: "TooltipHeadInfo",
|
|
1943
1823
|
props: ["rows", "cols"],
|
|
1944
1824
|
setup() {
|
|
@@ -1949,7 +1829,7 @@ const _sfc_main$c = defineComponent({
|
|
|
1949
1829
|
components: {}
|
|
1950
1830
|
});
|
|
1951
1831
|
const _hoisted_1$4 = { key: 0 };
|
|
1952
|
-
function _sfc_render$
|
|
1832
|
+
function _sfc_render$d(_ctx, _cache, $props, $setup, $data, $options) {
|
|
1953
1833
|
var _a, _b, _c, _d;
|
|
1954
1834
|
return ((_a = _ctx.cols) == null ? void 0 : _a.length) || ((_b = _ctx.rows) == null ? void 0 : _b.length) ? (openBlock(), createElementBlock("div", {
|
|
1955
1835
|
key: 0,
|
|
@@ -1968,8 +1848,8 @@ function _sfc_render$c(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
1968
1848
|
}), 128))
|
|
1969
1849
|
], 2)) : createCommentVNode("", true);
|
|
1970
1850
|
}
|
|
1971
|
-
var TooltipHeadInfo = /* @__PURE__ */ _export_sfc(_sfc_main$
|
|
1972
|
-
const _sfc_main$
|
|
1851
|
+
var TooltipHeadInfo = /* @__PURE__ */ _export_sfc(_sfc_main$d, [["render", _sfc_render$d]]);
|
|
1852
|
+
const _sfc_main$c = defineComponent({
|
|
1973
1853
|
name: "TooltipInfos",
|
|
1974
1854
|
props: ["infos"],
|
|
1975
1855
|
setup() {
|
|
@@ -1979,13 +1859,13 @@ const _sfc_main$b = defineComponent({
|
|
|
1979
1859
|
},
|
|
1980
1860
|
components: {}
|
|
1981
1861
|
});
|
|
1982
|
-
function _sfc_render$
|
|
1862
|
+
function _sfc_render$c(_ctx, _cache, $props, $setup, $data, $options) {
|
|
1983
1863
|
return openBlock(), createElementBlock("div", {
|
|
1984
1864
|
class: normalizeClass(`${_ctx.TOOLTIP_PREFIX_CLS}-infos`)
|
|
1985
1865
|
}, toDisplayString(_ctx.infos), 3);
|
|
1986
1866
|
}
|
|
1987
|
-
var TooltipInfos = /* @__PURE__ */ _export_sfc(_sfc_main$
|
|
1988
|
-
const _sfc_main$
|
|
1867
|
+
var TooltipInfos = /* @__PURE__ */ _export_sfc(_sfc_main$c, [["render", _sfc_render$c]]);
|
|
1868
|
+
const _sfc_main$b = defineComponent({
|
|
1989
1869
|
name: "TooltipSimpleTips",
|
|
1990
1870
|
props: ["name", "tips"],
|
|
1991
1871
|
setup() {
|
|
@@ -1995,7 +1875,7 @@ const _sfc_main$a = defineComponent({
|
|
|
1995
1875
|
},
|
|
1996
1876
|
components: {}
|
|
1997
1877
|
});
|
|
1998
|
-
function _sfc_render$
|
|
1878
|
+
function _sfc_render$b(_ctx, _cache, $props, $setup, $data, $options) {
|
|
1999
1879
|
return openBlock(), createElementBlock(Fragment, null, [
|
|
2000
1880
|
_ctx.name ? (openBlock(), createElementBlock("div", {
|
|
2001
1881
|
key: 0,
|
|
@@ -2007,8 +1887,8 @@ function _sfc_render$a(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
2007
1887
|
}, toDisplayString(_ctx.tips), 3)) : createCommentVNode("", true)
|
|
2008
1888
|
], 64);
|
|
2009
1889
|
}
|
|
2010
|
-
var TooltipSimpleTips = /* @__PURE__ */ _export_sfc(_sfc_main$
|
|
2011
|
-
const _sfc_main$
|
|
1890
|
+
var TooltipSimpleTips = /* @__PURE__ */ _export_sfc(_sfc_main$b, [["render", _sfc_render$b]]);
|
|
1891
|
+
const _sfc_main$a = defineComponent({
|
|
2012
1892
|
name: "TooltipSummary",
|
|
2013
1893
|
props: ["summaries"],
|
|
2014
1894
|
setup(props) {
|
|
@@ -2027,7 +1907,7 @@ const _sfc_main$9 = defineComponent({
|
|
|
2027
1907
|
},
|
|
2028
1908
|
components: {}
|
|
2029
1909
|
});
|
|
2030
|
-
function _sfc_render$
|
|
1910
|
+
function _sfc_render$a(_ctx, _cache, $props, $setup, $data, $options) {
|
|
2031
1911
|
return openBlock(), createElementBlock("div", {
|
|
2032
1912
|
class: normalizeClass(`${_ctx.TOOLTIP_PREFIX_CLS}-summary`)
|
|
2033
1913
|
}, [
|
|
@@ -2054,8 +1934,8 @@ function _sfc_render$9(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
2054
1934
|
}), 128))
|
|
2055
1935
|
], 2);
|
|
2056
1936
|
}
|
|
2057
|
-
var TooltipSummary = /* @__PURE__ */ _export_sfc(_sfc_main$
|
|
2058
|
-
const _sfc_main$
|
|
1937
|
+
var TooltipSummary = /* @__PURE__ */ _export_sfc(_sfc_main$a, [["render", _sfc_render$a]]);
|
|
1938
|
+
const _sfc_main$9 = defineComponent({
|
|
2059
1939
|
name: "TooltipOperatorTitle",
|
|
2060
1940
|
props: ["menu"],
|
|
2061
1941
|
setup(props) {
|
|
@@ -2067,7 +1947,7 @@ const _sfc_main$8 = defineComponent({
|
|
|
2067
1947
|
}
|
|
2068
1948
|
});
|
|
2069
1949
|
const _hoisted_1$3 = ["innerHTML"];
|
|
2070
|
-
function _sfc_render$
|
|
1950
|
+
function _sfc_render$9(_ctx, _cache, $props, $setup, $data, $options) {
|
|
2071
1951
|
return openBlock(), createElementBlock("span", null, [
|
|
2072
1952
|
_ctx.icon ? (openBlock(), createElementBlock("span", {
|
|
2073
1953
|
key: 0,
|
|
@@ -2079,8 +1959,8 @@ function _sfc_render$8(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
2079
1959
|
}, toDisplayString(_ctx.menu.text), 3)
|
|
2080
1960
|
]);
|
|
2081
1961
|
}
|
|
2082
|
-
var TooltipOperatorTitle = /* @__PURE__ */ _export_sfc(_sfc_main$
|
|
2083
|
-
const _sfc_main$
|
|
1962
|
+
var TooltipOperatorTitle = /* @__PURE__ */ _export_sfc(_sfc_main$9, [["render", _sfc_render$9]]);
|
|
1963
|
+
const _sfc_main$8 = defineComponent({
|
|
2084
1964
|
name: "TooltipOperatorMenu",
|
|
2085
1965
|
props: ["menu", "cell"],
|
|
2086
1966
|
setup(props) {
|
|
@@ -2100,7 +1980,7 @@ const _sfc_main$7 = defineComponent({
|
|
|
2100
1980
|
TooltipOperatorTitle
|
|
2101
1981
|
}
|
|
2102
1982
|
});
|
|
2103
|
-
function _sfc_render$
|
|
1983
|
+
function _sfc_render$8(_ctx, _cache, $props, $setup, $data, $options) {
|
|
2104
1984
|
const _component_TooltipOperatorTitle = resolveComponent("TooltipOperatorTitle");
|
|
2105
1985
|
const _component_TooltipOperatorMenu = resolveComponent("TooltipOperatorMenu");
|
|
2106
1986
|
const _component_MenuItem = resolveComponent("MenuItem");
|
|
@@ -2158,9 +2038,9 @@ function _sfc_render$7(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
2158
2038
|
}, 8, ["title"])) : createCommentVNode("", true)
|
|
2159
2039
|
], 64);
|
|
2160
2040
|
}
|
|
2161
|
-
var TooltipOperatorMenu = /* @__PURE__ */ _export_sfc(_sfc_main$
|
|
2041
|
+
var TooltipOperatorMenu = /* @__PURE__ */ _export_sfc(_sfc_main$8, [["render", _sfc_render$8]]);
|
|
2162
2042
|
var index_vue_vue_type_style_index_0_lang$1 = "";
|
|
2163
|
-
const _sfc_main$
|
|
2043
|
+
const _sfc_main$7 = defineComponent({
|
|
2164
2044
|
name: "TooltipOperator",
|
|
2165
2045
|
props: [
|
|
2166
2046
|
"menus",
|
|
@@ -2184,7 +2064,7 @@ const _sfc_main$6 = defineComponent({
|
|
|
2184
2064
|
TooltipOperatorMenu
|
|
2185
2065
|
}
|
|
2186
2066
|
});
|
|
2187
|
-
function _sfc_render$
|
|
2067
|
+
function _sfc_render$7(_ctx, _cache, $props, $setup, $data, $options) {
|
|
2188
2068
|
const _component_TooltipOperatorMenu = resolveComponent("TooltipOperatorMenu");
|
|
2189
2069
|
const _component_Menu = resolveComponent("Menu");
|
|
2190
2070
|
const _component_TooltipOperatorTitle = resolveComponent("TooltipOperatorTitle");
|
|
@@ -2247,9 +2127,9 @@ function _sfc_render$6(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
2247
2127
|
}), 128))
|
|
2248
2128
|
], 2);
|
|
2249
2129
|
}
|
|
2250
|
-
var TooltipOperator = /* @__PURE__ */ _export_sfc(_sfc_main$
|
|
2130
|
+
var TooltipOperator = /* @__PURE__ */ _export_sfc(_sfc_main$7, [["render", _sfc_render$7]]);
|
|
2251
2131
|
var index_vue_vue_type_style_index_0_lang = "";
|
|
2252
|
-
const _sfc_main$
|
|
2132
|
+
const _sfc_main$6 = defineComponent({
|
|
2253
2133
|
name: "TooltipComponent",
|
|
2254
2134
|
props: [
|
|
2255
2135
|
"data",
|
|
@@ -2275,7 +2155,7 @@ const _sfc_main$5 = defineComponent({
|
|
|
2275
2155
|
TooltipOperator
|
|
2276
2156
|
}
|
|
2277
2157
|
});
|
|
2278
|
-
function _sfc_render$
|
|
2158
|
+
function _sfc_render$6(_ctx, _cache, $props, $setup, $data, $options) {
|
|
2279
2159
|
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p;
|
|
2280
2160
|
const _component_TooltipOperator = resolveComponent("TooltipOperator");
|
|
2281
2161
|
const _component_TooltipSimpleTips = resolveComponent("TooltipSimpleTips");
|
|
@@ -2319,7 +2199,7 @@ function _sfc_render$5(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
2319
2199
|
], 64))
|
|
2320
2200
|
], 64));
|
|
2321
2201
|
}
|
|
2322
|
-
var TooltipComponent = /* @__PURE__ */ _export_sfc(_sfc_main$
|
|
2202
|
+
var TooltipComponent = /* @__PURE__ */ _export_sfc(_sfc_main$6, [["render", _sfc_render$6]]);
|
|
2323
2203
|
class CustomTooltip extends BaseTooltip {
|
|
2324
2204
|
constructor(spreadsheet) {
|
|
2325
2205
|
super(spreadsheet);
|
|
@@ -2347,6 +2227,126 @@ class CustomTooltip extends BaseTooltip {
|
|
|
2347
2227
|
}
|
|
2348
2228
|
}
|
|
2349
2229
|
}
|
|
2230
|
+
const DEFAULT_PAGE_NUMBER = 1;
|
|
2231
|
+
const DEFAULT_PAGE_SIZE = 10;
|
|
2232
|
+
const usePagination = (s2Ref, props) => {
|
|
2233
|
+
var _a, _b, _c, _d, _e, _f;
|
|
2234
|
+
const current = ref((_c = (_b = (_a = props.options) == null ? void 0 : _a.pagination) == null ? void 0 : _b.current) != null ? _c : DEFAULT_PAGE_NUMBER);
|
|
2235
|
+
const pageSize = ref((_f = (_e = (_d = props.options) == null ? void 0 : _d.pagination) == null ? void 0 : _e.pageSize) != null ? _f : DEFAULT_PAGE_SIZE);
|
|
2236
|
+
const total = ref(0);
|
|
2237
|
+
const change = (nextCurrent) => {
|
|
2238
|
+
current.value = nextCurrent;
|
|
2239
|
+
};
|
|
2240
|
+
const showSizeChange = (nextPageSize) => {
|
|
2241
|
+
pageSize.value = nextPageSize;
|
|
2242
|
+
};
|
|
2243
|
+
const visible = computed(() => {
|
|
2244
|
+
var _a2;
|
|
2245
|
+
return props.showPagination && !isEmpty((_a2 = props.options) == null ? void 0 : _a2.pagination);
|
|
2246
|
+
});
|
|
2247
|
+
watch([current, pageSize], () => {
|
|
2248
|
+
var _a2;
|
|
2249
|
+
if (!s2Ref.value) {
|
|
2250
|
+
return;
|
|
2251
|
+
}
|
|
2252
|
+
const nextPagination = isEmpty((_a2 = props.options) == null ? void 0 : _a2.pagination) ? null : {
|
|
2253
|
+
current: current.value,
|
|
2254
|
+
pageSize: pageSize.value
|
|
2255
|
+
};
|
|
2256
|
+
s2Ref.value.updatePagination(nextPagination);
|
|
2257
|
+
s2Ref.value.render(false);
|
|
2258
|
+
});
|
|
2259
|
+
watch([() => {
|
|
2260
|
+
var _a2;
|
|
2261
|
+
return (_a2 = props.options) == null ? void 0 : _a2.pagination;
|
|
2262
|
+
}, s2Ref], () => {
|
|
2263
|
+
var _a2, _b2, _c2, _d2, _e2, _f2, _g, _h, _i;
|
|
2264
|
+
current.value = (_c2 = (_b2 = (_a2 = props.options) == null ? void 0 : _a2.pagination) == null ? void 0 : _b2.current) != null ? _c2 : DEFAULT_PAGE_NUMBER;
|
|
2265
|
+
pageSize.value = (_f2 = (_e2 = (_d2 = props.options) == null ? void 0 : _d2.pagination) == null ? void 0 : _e2.pageSize) != null ? _f2 : DEFAULT_PAGE_SIZE;
|
|
2266
|
+
total.value = (_i = (_h = (_g = s2Ref.value) == null ? void 0 : _g.facet) == null ? void 0 : _h.viewCellHeights.getTotalLength()) != null ? _i : 0;
|
|
2267
|
+
}, {
|
|
2268
|
+
immediate: true
|
|
2269
|
+
});
|
|
2270
|
+
watch(s2Ref, (value, oldValue, onCleanup) => {
|
|
2271
|
+
if (!s2Ref.value) {
|
|
2272
|
+
return;
|
|
2273
|
+
}
|
|
2274
|
+
const totalUpdateCallback = (data) => {
|
|
2275
|
+
var _a2;
|
|
2276
|
+
if (isEmpty((_a2 = props.options) == null ? void 0 : _a2.pagination)) {
|
|
2277
|
+
return;
|
|
2278
|
+
}
|
|
2279
|
+
total.value = data.total;
|
|
2280
|
+
};
|
|
2281
|
+
s2Ref.value.on(S2Event.LAYOUT_PAGINATION, totalUpdateCallback);
|
|
2282
|
+
onCleanup(() => {
|
|
2283
|
+
var _a2;
|
|
2284
|
+
(_a2 = s2Ref.value) == null ? void 0 : _a2.off(S2Event.LAYOUT_PAGINATION, totalUpdateCallback);
|
|
2285
|
+
});
|
|
2286
|
+
});
|
|
2287
|
+
return {
|
|
2288
|
+
visible,
|
|
2289
|
+
current,
|
|
2290
|
+
pageSize,
|
|
2291
|
+
total,
|
|
2292
|
+
change,
|
|
2293
|
+
showSizeChange
|
|
2294
|
+
};
|
|
2295
|
+
};
|
|
2296
|
+
const PRE_CLASS = `${S2_PREFIX_CLS}-pagination`;
|
|
2297
|
+
const _sfc_main$5 = defineComponent({
|
|
2298
|
+
name: "s2-pagination",
|
|
2299
|
+
props: {
|
|
2300
|
+
current: {
|
|
2301
|
+
type: Number,
|
|
2302
|
+
default: DEFAULT_PAGE_NUMBER
|
|
2303
|
+
},
|
|
2304
|
+
total: {
|
|
2305
|
+
type: Number,
|
|
2306
|
+
default: 0
|
|
2307
|
+
},
|
|
2308
|
+
pageSize: {
|
|
2309
|
+
type: Number,
|
|
2310
|
+
default: DEFAULT_PAGE_SIZE
|
|
2311
|
+
}
|
|
2312
|
+
},
|
|
2313
|
+
emits: ["change", "showSizeChange"],
|
|
2314
|
+
setup: (props) => {
|
|
2315
|
+
const showQuickJumper = computed(() => {
|
|
2316
|
+
return props.total / props.pageSize > 5;
|
|
2317
|
+
});
|
|
2318
|
+
return {
|
|
2319
|
+
showQuickJumper,
|
|
2320
|
+
PRE_CLASS,
|
|
2321
|
+
i18n
|
|
2322
|
+
};
|
|
2323
|
+
},
|
|
2324
|
+
components: {
|
|
2325
|
+
AntDPagination: Pagination
|
|
2326
|
+
}
|
|
2327
|
+
});
|
|
2328
|
+
function _sfc_render$5(_ctx, _cache, $props, $setup, $data, $options) {
|
|
2329
|
+
const _component_AntDPagination = resolveComponent("AntDPagination");
|
|
2330
|
+
return openBlock(), createElementBlock("div", {
|
|
2331
|
+
class: normalizeClass(_ctx.PRE_CLASS)
|
|
2332
|
+
}, [
|
|
2333
|
+
createVNode(_component_AntDPagination, {
|
|
2334
|
+
"default-current": 1,
|
|
2335
|
+
current: _ctx.current,
|
|
2336
|
+
total: _ctx.total,
|
|
2337
|
+
pageSize: _ctx.pageSize,
|
|
2338
|
+
showSizeChanger: true,
|
|
2339
|
+
onShowSizeChange: _cache[0] || (_cache[0] = (_, size2) => _ctx.$emit("showSizeChange", size2)),
|
|
2340
|
+
size: "small",
|
|
2341
|
+
showQuickJumper: _ctx.showQuickJumper,
|
|
2342
|
+
onChange: _cache[1] || (_cache[1] = (current) => _ctx.$emit("change", current))
|
|
2343
|
+
}, null, 8, ["current", "total", "pageSize", "showQuickJumper"]),
|
|
2344
|
+
createElementVNode("span", {
|
|
2345
|
+
class: normalizeClass(`${_ctx.PRE_CLASS}-count`)
|
|
2346
|
+
}, toDisplayString(_ctx.i18n("\u5171\u8BA1")) + " " + toDisplayString(_ctx.total || " - ") + " " + toDisplayString(_ctx.i18n("\u6761")), 3)
|
|
2347
|
+
], 2);
|
|
2348
|
+
}
|
|
2349
|
+
var S2Pagination = /* @__PURE__ */ _export_sfc(_sfc_main$5, [["render", _sfc_render$5]]);
|
|
2350
2350
|
const RENDER_TOOLTIP_OPTION = {
|
|
2351
2351
|
tooltip: {
|
|
2352
2352
|
renderTooltip: (spreadsheet) => new CustomTooltip(spreadsheet)
|
|
@@ -2451,6 +2451,8 @@ const useEvents = (s2Ref, emit) => {
|
|
|
2451
2451
|
useS2Event(s2Ref, emit, S2Event.GLOBAL_RESET, "reset");
|
|
2452
2452
|
useS2Event(s2Ref, emit, S2Event.GLOBAL_LINK_FIELD_JUMP, "linkFieldJump");
|
|
2453
2453
|
useS2Event(s2Ref, emit, S2Event.GLOBAL_SCROLL, "scroll");
|
|
2454
|
+
useS2Event(s2Ref, emit, S2Event.ROW_CELL_BRUSH_SELECTION, "rowCellBrushSelection");
|
|
2455
|
+
useS2Event(s2Ref, emit, S2Event.COL_CELL_BRUSH_SELECTION, "colCellBrushSelection");
|
|
2454
2456
|
});
|
|
2455
2457
|
};
|
|
2456
2458
|
const useLoading = (s2Ref, loadingProp = false) => {
|
|
@@ -2718,7 +2720,9 @@ const initBaseSheetEmits = () => {
|
|
|
2718
2720
|
"click",
|
|
2719
2721
|
"doubleClick",
|
|
2720
2722
|
"scroll",
|
|
2721
|
-
"hover"
|
|
2723
|
+
"hover",
|
|
2724
|
+
"rowCellBrushSelection",
|
|
2725
|
+
"colCellBrushSelection"
|
|
2722
2726
|
];
|
|
2723
2727
|
return keys2;
|
|
2724
2728
|
};
|
|
@@ -3097,5 +3101,5 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
3097
3101
|
return openBlock(), createBlock(resolveDynamicComponent(_ctx.sheetType), { ref: "s2Ref" }, null, 512);
|
|
3098
3102
|
}
|
|
3099
3103
|
var index = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
|
|
3100
|
-
export { BaseSheet, PivotSheet, index as SheetComponent, TableSheet, useExpose };
|
|
3104
|
+
export { BaseSheet, CustomTooltip, PivotSheet, index as SheetComponent, TableSheet, useExpose };
|
|
3101
3105
|
//# sourceMappingURL=index.js.map
|