ep-craft 0.1.32 → 0.1.33
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/components/checkbox/index.js +6 -5
- package/dist/components/table/index.d.ts +56 -3
- package/dist/components/table/index.js +20 -4
- package/dist/components/table/src/composables/use-scrollbar.d.ts +6 -0
- package/dist/components/table/src/composables/use-scrollbar.js +24 -0
- package/dist/components/table/src/config.d.ts +87 -0
- package/dist/components/table/src/config.js +210 -0
- package/dist/components/table/src/filter-panel.vue.d.ts +837 -0
- package/dist/components/table/src/filter-panel.vue.js +130 -0
- package/dist/components/table/src/filter-panel2.vue.js +155 -0
- package/dist/components/table/src/h-helper.d.ts +13 -0
- package/dist/components/table/src/h-helper.js +30 -0
- package/dist/components/table/src/layout-observer.d.ts +8 -0
- package/dist/components/table/src/layout-observer.js +49 -0
- package/dist/components/table/src/store/current.d.ts +15 -0
- package/dist/components/table/src/store/current.js +45 -0
- package/dist/components/table/src/store/expand.d.ts +14 -0
- package/dist/components/table/src/store/expand.js +55 -0
- package/dist/components/table/src/store/helper.d.ts +548 -0
- package/dist/components/table/src/store/helper.js +61 -0
- package/dist/components/table/src/store/index.d.ts +1107 -0
- package/dist/components/table/src/store/index.js +123 -0
- package/dist/components/table/src/store/tree.d.ts +27 -0
- package/dist/components/table/src/store/tree.js +153 -0
- package/dist/components/table/src/store/watcher.d.ts +88 -0
- package/dist/components/table/src/store/watcher.js +483 -0
- package/dist/components/table/src/table/defaults.d.ts +560 -0
- package/dist/components/table/src/table/defaults.js +236 -0
- package/dist/components/table/src/table/key-render-helper.d.ts +2 -0
- package/dist/components/table/src/table/key-render-helper.js +18 -0
- package/dist/components/table/src/table/style-helper.d.ts +51 -0
- package/dist/components/table/src/table/style-helper.js +169 -0
- package/dist/components/table/src/table/utils-helper.d.ts +16 -0
- package/dist/components/table/src/table/utils-helper.js +36 -0
- package/dist/components/table/src/table-body/defaults.d.ts +39 -0
- package/dist/components/table/src/table-body/defaults.js +25 -0
- package/dist/components/table/src/table-body/events-helper.d.ts +19 -0
- package/dist/components/table/src/table-body/events-helper.js +126 -0
- package/dist/components/table/src/table-body/index.d.ts +84 -0
- package/dist/components/table/src/table-body/index.js +77 -0
- package/dist/components/table/src/table-body/render-helper.d.ts +18 -0
- package/dist/components/table/src/table-body/render-helper.js +188 -0
- package/dist/components/table/src/table-body/styles-helper.d.ts +15 -0
- package/dist/components/table/src/table-body/styles-helper.js +98 -0
- package/dist/components/table/src/table-body/td-wrapper.vue.d.ts +33 -0
- package/dist/components/table/src/table-body/td-wrapper.vue.js +26 -0
- package/dist/components/table/src/table-body/td-wrapper2.vue.js +4 -0
- package/dist/components/table/src/table-column/defaults.d.ts +348 -0
- package/dist/components/table/src/table-column/defaults.js +152 -0
- package/dist/components/table/src/table-column/index.d.ts +2 -0
- package/dist/components/table/src/table-column/index.vue.d.ts +32 -0
- package/dist/components/table/src/table-column/index.vue.js +161 -0
- package/dist/components/table/src/table-column/index2.vue.js +4 -0
- package/dist/components/table/src/table-column/render-helper.d.ts +17 -0
- package/dist/components/table/src/table-column/render-helper.js +116 -0
- package/dist/components/table/src/table-column/watcher-helper.d.ts +8 -0
- package/dist/components/table/src/table-column/watcher-helper.js +85 -0
- package/dist/components/table/src/table-footer/index.d.ts +79 -0
- package/dist/components/table/src/table-footer/index.js +110 -0
- package/dist/components/table/src/table-footer/mapState-helper.d.ts +9 -0
- package/dist/components/table/src/table-footer/mapState-helper.js +16 -0
- package/dist/components/table/src/table-footer/style-helper.d.ts +9 -0
- package/dist/components/table/src/table-footer/style-helper.js +42 -0
- package/dist/components/table/src/table-header/event-helper.d.ts +14 -0
- package/dist/components/table/src/table-header/event-helper.js +113 -0
- package/dist/components/table/src/table-header/index.d.ts +361 -0
- package/dist/components/table/src/table-header/index.js +255 -0
- package/dist/components/table/src/table-header/style.helper.d.ts +10 -0
- package/dist/components/table/src/table-header/style.helper.js +73 -0
- package/dist/components/table/src/table-header/utils-helper.d.ts +10 -0
- package/dist/components/table/src/table-header/utils-helper.js +45 -0
- package/dist/components/table/src/table-layout.d.ts +37 -0
- package/dist/components/table/src/table-layout.js +144 -0
- package/dist/components/table/src/table.vue.d.ts +734 -0
- package/dist/components/table/src/table.vue.js +443 -0
- package/dist/components/table/src/table2.vue.js +4 -0
- package/dist/components/table/src/tableColumn.d.ts +2 -0
- package/dist/components/table/src/tokens.d.ts +3 -0
- package/dist/components/table/src/tokens.js +4 -0
- package/dist/components/table/src/util.d.ts +55 -0
- package/dist/components/table/src/util.js +310 -0
- package/dist/components/table-column/index.d.ts +40 -3
- package/dist/components/table-column/index.js +6 -3
- package/dist/directives/mousewheel/index.js +28 -0
- package/dist/ep-craft.js +186 -182
- package/dist/index.d.ts +24 -0
- package/dist/vendored-components.d.ts +1 -1
- package/dist/vendored-components.js +12 -1
- package/package.json +1 -1
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
import V from "./filter-panel2.vue.js";
|
|
2
|
+
import { resolveComponent as a, openBlock as n, createBlock as u, withCtx as r, createElementVNode as s, normalizeClass as t, createVNode as m, renderSlot as C, createElementBlock as d, Fragment as b, renderList as c, createTextVNode as $, toDisplayString as p } from "vue";
|
|
3
|
+
import S from "../../../_virtual/_plugin-vue_export-helper.js";
|
|
4
|
+
const F = ["disabled"], R = ["tabindex", "aria-checked"], A = ["tabindex", "aria-checked", "onClick"], N = ["aria-label"];
|
|
5
|
+
function T(e, o, B, H, K, P) {
|
|
6
|
+
const f = a("ep-checkbox"), k = a("ep-checkbox-group"), h = a("el-scrollbar"), w = a("arrow-up"), v = a("arrow-down"), g = a("el-icon"), y = a("el-tooltip");
|
|
7
|
+
return n(), u(y, {
|
|
8
|
+
ref: "tooltipRef",
|
|
9
|
+
offset: 0,
|
|
10
|
+
placement: e.placement,
|
|
11
|
+
"show-arrow": !1,
|
|
12
|
+
trigger: "click",
|
|
13
|
+
role: "dialog",
|
|
14
|
+
teleported: "",
|
|
15
|
+
effect: "light",
|
|
16
|
+
pure: "",
|
|
17
|
+
loop: "",
|
|
18
|
+
"popper-class": e.filterClassName,
|
|
19
|
+
persistent: "",
|
|
20
|
+
"append-to": e.appendTo,
|
|
21
|
+
onShow: e.handleShowTooltip,
|
|
22
|
+
onHide: e.handleHideTooltip
|
|
23
|
+
}, {
|
|
24
|
+
content: r(() => [
|
|
25
|
+
e.multiple ? (n(), d("div", {
|
|
26
|
+
key: 0,
|
|
27
|
+
ref: "rootRef",
|
|
28
|
+
tabindex: "-1",
|
|
29
|
+
class: t(e.ns.e("multiple"))
|
|
30
|
+
}, [
|
|
31
|
+
s("div", {
|
|
32
|
+
class: t(e.ns.e("content"))
|
|
33
|
+
}, [
|
|
34
|
+
m(h, {
|
|
35
|
+
"wrap-class": e.ns.e("wrap")
|
|
36
|
+
}, {
|
|
37
|
+
default: r(() => [
|
|
38
|
+
m(k, {
|
|
39
|
+
modelValue: e.filteredValue,
|
|
40
|
+
"onUpdate:modelValue": o[0] || (o[0] = (l) => e.filteredValue = l),
|
|
41
|
+
class: t(e.ns.e("checkbox-group"))
|
|
42
|
+
}, {
|
|
43
|
+
default: r(() => [
|
|
44
|
+
(n(!0), d(b, null, c(e.filters, (l) => (n(), u(f, {
|
|
45
|
+
key: l.value,
|
|
46
|
+
value: l.value
|
|
47
|
+
}, {
|
|
48
|
+
default: r(() => [
|
|
49
|
+
$(p(l.text), 1)
|
|
50
|
+
]),
|
|
51
|
+
_: 2
|
|
52
|
+
}, 1032, ["value"]))), 128))
|
|
53
|
+
]),
|
|
54
|
+
_: 1
|
|
55
|
+
}, 8, ["modelValue", "class"])
|
|
56
|
+
]),
|
|
57
|
+
_: 1
|
|
58
|
+
}, 8, ["wrap-class"])
|
|
59
|
+
], 2),
|
|
60
|
+
s("div", {
|
|
61
|
+
class: t(e.ns.e("bottom"))
|
|
62
|
+
}, [
|
|
63
|
+
s("button", {
|
|
64
|
+
class: t(e.ns.is("disabled", e.filteredValue.length === 0)),
|
|
65
|
+
disabled: e.filteredValue.length === 0,
|
|
66
|
+
type: "button",
|
|
67
|
+
onClick: o[1] || (o[1] = (...l) => e.handleConfirm && e.handleConfirm(...l))
|
|
68
|
+
}, p(e.t("el.table.confirmFilter")), 11, F),
|
|
69
|
+
s("button", {
|
|
70
|
+
type: "button",
|
|
71
|
+
onClick: o[2] || (o[2] = (...l) => e.handleReset && e.handleReset(...l))
|
|
72
|
+
}, p(e.t("el.table.resetFilter")), 1)
|
|
73
|
+
], 2)
|
|
74
|
+
], 2)) : (n(), d("ul", {
|
|
75
|
+
key: 1,
|
|
76
|
+
ref: "rootRef",
|
|
77
|
+
tabindex: "-1",
|
|
78
|
+
role: "radiogroup",
|
|
79
|
+
class: t(e.ns.e("list")),
|
|
80
|
+
onKeydown: o[4] || (o[4] = (...l) => e.handleKeydown && e.handleKeydown(...l))
|
|
81
|
+
}, [
|
|
82
|
+
s("li", {
|
|
83
|
+
role: "radio",
|
|
84
|
+
class: t([
|
|
85
|
+
e.ns.e("list-item"),
|
|
86
|
+
e.ns.is("active", e.isPropAbsent(e.filterValue))
|
|
87
|
+
]),
|
|
88
|
+
tabindex: e.checkedIndex === 0 ? 0 : -1,
|
|
89
|
+
"aria-checked": e.isPropAbsent(e.filterValue),
|
|
90
|
+
onClick: o[3] || (o[3] = (l) => e.handleSelect(null, 0))
|
|
91
|
+
}, p(e.t("el.table.clearFilter")), 11, R),
|
|
92
|
+
(n(!0), d(b, null, c(e.filters, (l, i) => (n(), d("li", {
|
|
93
|
+
key: l.value,
|
|
94
|
+
role: "radio",
|
|
95
|
+
class: t([e.ns.e("list-item"), e.ns.is("active", e.isActive(l))]),
|
|
96
|
+
tabindex: e.checkedIndex === i + 1 ? 0 : -1,
|
|
97
|
+
"aria-checked": e.isActive(l),
|
|
98
|
+
onClick: (E) => e.handleSelect(l.value, i + 1)
|
|
99
|
+
}, p(l.text), 11, A))), 128))
|
|
100
|
+
], 34))
|
|
101
|
+
]),
|
|
102
|
+
default: r(() => {
|
|
103
|
+
var l;
|
|
104
|
+
return [
|
|
105
|
+
s("button", {
|
|
106
|
+
type: "button",
|
|
107
|
+
class: t(`${e.ns.namespace.value}-table__column-filter-trigger`),
|
|
108
|
+
"aria-label": e.t("el.table.filterLabel", { column: ((l = e.column) == null ? void 0 : l.label) || "" })
|
|
109
|
+
}, [
|
|
110
|
+
m(g, null, {
|
|
111
|
+
default: r(() => [
|
|
112
|
+
C(e.$slots, "filter-icon", {}, () => {
|
|
113
|
+
var i;
|
|
114
|
+
return [
|
|
115
|
+
(i = e.column) != null && i.filterOpened ? (n(), u(w, { key: 0 })) : (n(), u(v, { key: 1 }))
|
|
116
|
+
];
|
|
117
|
+
})
|
|
118
|
+
]),
|
|
119
|
+
_: 3
|
|
120
|
+
})
|
|
121
|
+
], 10, N)
|
|
122
|
+
];
|
|
123
|
+
}),
|
|
124
|
+
_: 3
|
|
125
|
+
}, 8, ["placement", "popper-class", "append-to", "onShow", "onHide"]);
|
|
126
|
+
}
|
|
127
|
+
const D = /* @__PURE__ */ S(V, [["render", T]]);
|
|
128
|
+
export {
|
|
129
|
+
D as default
|
|
130
|
+
};
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
import { defineComponent as F, getCurrentInstance as R, ref as k, computed as m } from "vue";
|
|
2
|
+
import { EpCheckbox as j } from "../../checkbox/index.js";
|
|
3
|
+
import { EpCheckboxGroup as p } from "../../checkbox-group/index.js";
|
|
4
|
+
import { ElIcon as K } from "../../icon/index.js";
|
|
5
|
+
import { ArrowUp as _, ArrowDown as q } from "@element-plus/icons-vue";
|
|
6
|
+
import { EVENT_CODE as a } from "../../../constants/aria.js";
|
|
7
|
+
import { useNamespace as G } from "../../../hooks/use-namespace/index.js";
|
|
8
|
+
import { isPropAbsent as h } from "../../../utils/types.js";
|
|
9
|
+
import "lodash-unified";
|
|
10
|
+
import "@vueuse/core";
|
|
11
|
+
import "@vue/shared";
|
|
12
|
+
import { getEventCode as H } from "../../../utils/dom/event.js";
|
|
13
|
+
import { useLocale as L } from "../../../hooks/use-locale/index.js";
|
|
14
|
+
import "../../../hooks/use-size/index.js";
|
|
15
|
+
import "@popperjs/core";
|
|
16
|
+
import "../../../hooks/use-z-index/index.js";
|
|
17
|
+
import "../../../hooks/use-delayed-toggle/index.js";
|
|
18
|
+
import "../../../hooks/use-aria/index.js";
|
|
19
|
+
import "../../../hooks/use-model-toggle/index.js";
|
|
20
|
+
import "../../../hooks/use-empty-values/index.js";
|
|
21
|
+
import { ElTooltip as M } from "../../tooltip/index.js";
|
|
22
|
+
import { EpScrollbar as U } from "../../scrollbar/index.js";
|
|
23
|
+
import { useTooltipContentProps as z } from "../../tooltip/src/content.js";
|
|
24
|
+
const Ce = F({
|
|
25
|
+
name: "ElTableFilterPanel",
|
|
26
|
+
components: {
|
|
27
|
+
EpCheckbox: j,
|
|
28
|
+
EpCheckboxGroup: p,
|
|
29
|
+
ElScrollbar: U,
|
|
30
|
+
ElTooltip: M,
|
|
31
|
+
ElIcon: K,
|
|
32
|
+
ArrowDown: q,
|
|
33
|
+
ArrowUp: _
|
|
34
|
+
},
|
|
35
|
+
props: {
|
|
36
|
+
placement: {
|
|
37
|
+
type: String,
|
|
38
|
+
default: "bottom-start"
|
|
39
|
+
},
|
|
40
|
+
store: {
|
|
41
|
+
type: Object
|
|
42
|
+
},
|
|
43
|
+
column: {
|
|
44
|
+
type: Object
|
|
45
|
+
},
|
|
46
|
+
upDataColumn: {
|
|
47
|
+
type: Function
|
|
48
|
+
},
|
|
49
|
+
appendTo: z.appendTo
|
|
50
|
+
},
|
|
51
|
+
setup(t) {
|
|
52
|
+
const f = R(), { t: S } = L(), s = G("table-filter"), g = f == null ? void 0 : f.parent;
|
|
53
|
+
t.column && !g.filterPanels.value[t.column.id] && (g.filterPanels.value[t.column.id] = f);
|
|
54
|
+
const w = k(null), b = k(null), u = k(0), c = m(() => t.column && t.column.filters), P = m(() => t.column && t.column.filterClassName ? `${s.b()} ${t.column.filterClassName}` : s.b()), r = m({
|
|
55
|
+
get: () => {
|
|
56
|
+
var e;
|
|
57
|
+
return (((e = t.column) == null ? void 0 : e.filteredValue) || [])[0];
|
|
58
|
+
},
|
|
59
|
+
set: (e) => {
|
|
60
|
+
o.value && (h(e) ? o.value.splice(0, 1) : o.value.splice(0, 1, e));
|
|
61
|
+
}
|
|
62
|
+
}), o = m({
|
|
63
|
+
get() {
|
|
64
|
+
return t.column ? t.column.filteredValue || [] : [];
|
|
65
|
+
},
|
|
66
|
+
set(e) {
|
|
67
|
+
var l;
|
|
68
|
+
t.column && ((l = t.upDataColumn) == null || l.call(t, "filteredValue", e));
|
|
69
|
+
}
|
|
70
|
+
}), x = m(() => t.column ? t.column.filterMultiple : !0), A = (e) => e.value === r.value, d = () => {
|
|
71
|
+
var e;
|
|
72
|
+
(e = w.value) == null || e.onClose();
|
|
73
|
+
}, I = () => {
|
|
74
|
+
v(o.value), d();
|
|
75
|
+
}, N = () => {
|
|
76
|
+
o.value = [], v(o.value), d();
|
|
77
|
+
}, C = (e, l) => {
|
|
78
|
+
r.value = e, u.value = l, h(e) ? v([]) : v(o.value), d();
|
|
79
|
+
}, v = (e) => {
|
|
80
|
+
var l, i;
|
|
81
|
+
(l = t.store) == null || l.commit("filterChange", {
|
|
82
|
+
column: t.column,
|
|
83
|
+
values: e
|
|
84
|
+
}), (i = t.store) == null || i.updateAllSelected();
|
|
85
|
+
}, O = () => {
|
|
86
|
+
var e, l;
|
|
87
|
+
(e = b.value) == null || e.focus(), !x.value && $(), t.column && ((l = t.upDataColumn) == null || l.call(t, "filterOpened", !0));
|
|
88
|
+
}, V = () => {
|
|
89
|
+
var e;
|
|
90
|
+
t.column && ((e = t.upDataColumn) == null || e.call(t, "filterOpened", !1));
|
|
91
|
+
}, $ = () => {
|
|
92
|
+
if (h(r)) {
|
|
93
|
+
u.value = 0;
|
|
94
|
+
return;
|
|
95
|
+
}
|
|
96
|
+
const e = (c.value || []).findIndex((l) => l.value === r.value);
|
|
97
|
+
u.value = e >= 0 ? e + 1 : 0;
|
|
98
|
+
};
|
|
99
|
+
return {
|
|
100
|
+
multiple: x,
|
|
101
|
+
filterClassName: P,
|
|
102
|
+
filteredValue: o,
|
|
103
|
+
filterValue: r,
|
|
104
|
+
filters: c,
|
|
105
|
+
handleConfirm: I,
|
|
106
|
+
handleReset: N,
|
|
107
|
+
handleSelect: C,
|
|
108
|
+
isPropAbsent: h,
|
|
109
|
+
isActive: A,
|
|
110
|
+
t: S,
|
|
111
|
+
ns: s,
|
|
112
|
+
tooltipRef: w,
|
|
113
|
+
rootRef: b,
|
|
114
|
+
checkedIndex: u,
|
|
115
|
+
handleShowTooltip: O,
|
|
116
|
+
handleHideTooltip: V,
|
|
117
|
+
handleKeydown: (e) => {
|
|
118
|
+
var D, T;
|
|
119
|
+
const l = H(e), i = (c.value ? c.value.length : 0) + 1;
|
|
120
|
+
let n = u.value, E = !0;
|
|
121
|
+
switch (l) {
|
|
122
|
+
case a.down:
|
|
123
|
+
case a.right:
|
|
124
|
+
n = (n + 1) % i;
|
|
125
|
+
break;
|
|
126
|
+
case a.up:
|
|
127
|
+
case a.left:
|
|
128
|
+
n = (n - 1 + i) % i;
|
|
129
|
+
break;
|
|
130
|
+
case a.tab:
|
|
131
|
+
d(), E = !1;
|
|
132
|
+
break;
|
|
133
|
+
case a.enter:
|
|
134
|
+
case a.space:
|
|
135
|
+
if (n === 0)
|
|
136
|
+
C(null, 0);
|
|
137
|
+
else {
|
|
138
|
+
const y = (c.value || [])[n - 1];
|
|
139
|
+
y.value && C(y.value, n);
|
|
140
|
+
}
|
|
141
|
+
break;
|
|
142
|
+
default:
|
|
143
|
+
E = !1;
|
|
144
|
+
break;
|
|
145
|
+
}
|
|
146
|
+
E && e.preventDefault(), u.value = n, (T = (D = b.value) == null ? void 0 : D.querySelector(
|
|
147
|
+
`.${s.e("list-item")}:nth-child(${n + 1})`
|
|
148
|
+
)) == null || T.focus();
|
|
149
|
+
}
|
|
150
|
+
};
|
|
151
|
+
}
|
|
152
|
+
});
|
|
153
|
+
export {
|
|
154
|
+
Ce as default
|
|
155
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { TableColumnCtx } from './table-column/defaults';
|
|
2
|
+
import type { DefaultRow } from './table/defaults';
|
|
3
|
+
type Props = {
|
|
4
|
+
tableLayout: 'fixed' | 'auto';
|
|
5
|
+
columns?: TableColumnCtx<DefaultRow>[];
|
|
6
|
+
};
|
|
7
|
+
export declare function hColgroup(props: Props): import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
8
|
+
[key: string]: any;
|
|
9
|
+
}>;
|
|
10
|
+
export declare namespace hColgroup {
|
|
11
|
+
var props: string[];
|
|
12
|
+
}
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { h as a } from "vue";
|
|
2
|
+
import { isUndefined as n } from "../../../utils/types.js";
|
|
3
|
+
import "lodash-unified";
|
|
4
|
+
import "@vueuse/core";
|
|
5
|
+
import "@vue/shared";
|
|
6
|
+
import "@element-plus/icons-vue";
|
|
7
|
+
function p(o) {
|
|
8
|
+
const r = o.tableLayout === "auto";
|
|
9
|
+
let e = o.columns || [];
|
|
10
|
+
r && e.every(({ width: t }) => n(t)) && (e = []);
|
|
11
|
+
const m = (t) => {
|
|
12
|
+
const i = {
|
|
13
|
+
key: `${o.tableLayout}_${t.id}`,
|
|
14
|
+
style: {},
|
|
15
|
+
name: void 0
|
|
16
|
+
};
|
|
17
|
+
return r ? i.style = {
|
|
18
|
+
width: `${t.width}px`
|
|
19
|
+
} : i.name = t.id, i;
|
|
20
|
+
};
|
|
21
|
+
return a(
|
|
22
|
+
"colgroup",
|
|
23
|
+
{},
|
|
24
|
+
e.map((t) => a("col", m(t)))
|
|
25
|
+
);
|
|
26
|
+
}
|
|
27
|
+
p.props = ["columns", "tableLayout"];
|
|
28
|
+
export {
|
|
29
|
+
p as hColgroup
|
|
30
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type TableLayout from './table-layout';
|
|
2
|
+
import type { DefaultRow, Table } from './table/defaults';
|
|
3
|
+
declare function useLayoutObserver<T extends DefaultRow>(root: Table<T>): {
|
|
4
|
+
tableLayout: TableLayout<T>;
|
|
5
|
+
onColumnsChange: (layout: TableLayout<T>) => void;
|
|
6
|
+
onScrollableChange: (layout: TableLayout<T>) => void;
|
|
7
|
+
};
|
|
8
|
+
export default useLayoutObserver;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { getCurrentInstance as f, onBeforeMount as m, onMounted as b, onUpdated as p, onUnmounted as y, computed as C } from "vue";
|
|
2
|
+
function A(s) {
|
|
3
|
+
const v = f();
|
|
4
|
+
m(() => {
|
|
5
|
+
l.value.addObserver(v);
|
|
6
|
+
}), b(() => {
|
|
7
|
+
i(l.value), d(l.value);
|
|
8
|
+
}), p(() => {
|
|
9
|
+
i(l.value), d(l.value);
|
|
10
|
+
}), y(() => {
|
|
11
|
+
l.value.removeObserver(v);
|
|
12
|
+
});
|
|
13
|
+
const l = C(() => {
|
|
14
|
+
const t = s.layout;
|
|
15
|
+
if (!t)
|
|
16
|
+
throw new Error("Can not find table layout.");
|
|
17
|
+
return t;
|
|
18
|
+
}), i = (t) => {
|
|
19
|
+
var u;
|
|
20
|
+
const o = ((u = s.vnode.el) == null ? void 0 : u.querySelectorAll("colgroup > col")) || [];
|
|
21
|
+
if (!o.length) return;
|
|
22
|
+
const a = t.getFlattenColumns(), r = {};
|
|
23
|
+
a.forEach((e) => {
|
|
24
|
+
r[e.id] = e;
|
|
25
|
+
});
|
|
26
|
+
for (let e = 0, c = o.length; e < c; e++) {
|
|
27
|
+
const n = o[e], g = n.getAttribute("name"), h = r[g];
|
|
28
|
+
h && n.setAttribute("width", h.realWidth || h.width);
|
|
29
|
+
}
|
|
30
|
+
}, d = (t) => {
|
|
31
|
+
var r, u;
|
|
32
|
+
const o = ((r = s.vnode.el) == null ? void 0 : r.querySelectorAll("colgroup > col[name=gutter]")) || [];
|
|
33
|
+
for (let e = 0, c = o.length; e < c; e++)
|
|
34
|
+
o[e].setAttribute("width", t.scrollY.value ? t.gutterWidth : "0");
|
|
35
|
+
const a = ((u = s.vnode.el) == null ? void 0 : u.querySelectorAll("th.gutter")) || [];
|
|
36
|
+
for (let e = 0, c = a.length; e < c; e++) {
|
|
37
|
+
const n = a[e];
|
|
38
|
+
n.style.width = t.scrollY.value ? `${t.gutterWidth}px` : "0", n.style.display = t.scrollY.value ? "" : "none";
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
return {
|
|
42
|
+
tableLayout: l.value,
|
|
43
|
+
onColumnsChange: i,
|
|
44
|
+
onScrollableChange: d
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
export {
|
|
48
|
+
A as default
|
|
49
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { Ref } from 'vue';
|
|
2
|
+
import type { DefaultRow } from '../table/defaults';
|
|
3
|
+
import type { WatcherPropsData } from '.';
|
|
4
|
+
declare function useCurrent<T extends DefaultRow>(watcherData: WatcherPropsData<T>): {
|
|
5
|
+
setCurrentRowKey: (key: string) => void;
|
|
6
|
+
restoreCurrentRowKey: () => void;
|
|
7
|
+
setCurrentRowByKey: (key: string) => void;
|
|
8
|
+
updateCurrentRow: (_currentRow: T) => void;
|
|
9
|
+
updateCurrentRowData: () => void;
|
|
10
|
+
states: {
|
|
11
|
+
_currentRowKey: Ref<string | null, string | null>;
|
|
12
|
+
currentRow: Ref<T | null, T | null>;
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
export default useCurrent;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { getCurrentInstance as R, ref as v, unref as C } from "vue";
|
|
2
|
+
import { getRowIdentity as d } from "../util.js";
|
|
3
|
+
function g(a) {
|
|
4
|
+
const r = R(), l = v(null), t = v(null), w = (e) => {
|
|
5
|
+
r.store.assertRowKey(), l.value = e, o(e);
|
|
6
|
+
}, c = () => {
|
|
7
|
+
l.value = null;
|
|
8
|
+
}, o = (e) => {
|
|
9
|
+
const { data: n, rowKey: u } = a, s = t.value;
|
|
10
|
+
let i = null;
|
|
11
|
+
u.value && (i = (C(n) || []).find(
|
|
12
|
+
(f) => d(f, u.value) === e
|
|
13
|
+
) ?? null), t.value = i ?? null, r.emit("current-change", t.value, s);
|
|
14
|
+
};
|
|
15
|
+
return {
|
|
16
|
+
setCurrentRowKey: w,
|
|
17
|
+
restoreCurrentRowKey: c,
|
|
18
|
+
setCurrentRowByKey: o,
|
|
19
|
+
updateCurrentRow: (e) => {
|
|
20
|
+
const n = t.value;
|
|
21
|
+
if (e && e !== n) {
|
|
22
|
+
t.value = e, r.emit("current-change", t.value, n);
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
!e && n && (t.value = null, r.emit("current-change", null, n));
|
|
26
|
+
},
|
|
27
|
+
updateCurrentRowData: () => {
|
|
28
|
+
const e = a.rowKey.value, n = a.data.value || [], u = t.value;
|
|
29
|
+
if (u && !n.includes(u))
|
|
30
|
+
if (e) {
|
|
31
|
+
const s = d(u, e);
|
|
32
|
+
o(s);
|
|
33
|
+
} else
|
|
34
|
+
t.value = null, r.emit("current-change", null, u);
|
|
35
|
+
else l.value && (o(l.value), c());
|
|
36
|
+
},
|
|
37
|
+
states: {
|
|
38
|
+
_currentRowKey: l,
|
|
39
|
+
currentRow: t
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
export {
|
|
44
|
+
g as default
|
|
45
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { Ref } from 'vue';
|
|
2
|
+
import type { WatcherPropsData } from '.';
|
|
3
|
+
import type { DefaultRow } from '../table/defaults';
|
|
4
|
+
declare function useExpand<T extends DefaultRow>(watcherData: WatcherPropsData<T>): {
|
|
5
|
+
updateExpandRows: () => void;
|
|
6
|
+
toggleRowExpansion: (row: T, expanded?: boolean) => void;
|
|
7
|
+
setExpandRowKeys: (rowKeys: (string | number)[]) => void;
|
|
8
|
+
isRowExpanded: (row: T) => boolean;
|
|
9
|
+
states: {
|
|
10
|
+
expandRows: Ref<T[], T[]>;
|
|
11
|
+
defaultExpandAll: Ref<boolean, boolean>;
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
export default useExpand;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { getCurrentInstance as f, ref as v } from "vue";
|
|
2
|
+
import { getKeysMap as i, getRowIdentity as x, toggleRowStatus as w } from "../util.js";
|
|
3
|
+
function M(s) {
|
|
4
|
+
const u = f(), p = v(!1), o = v([]), l = (e, n) => {
|
|
5
|
+
const t = u.store.states.rowExpandable.value;
|
|
6
|
+
return (t == null ? void 0 : t(e, n)) ?? !0;
|
|
7
|
+
};
|
|
8
|
+
return {
|
|
9
|
+
updateExpandRows: () => {
|
|
10
|
+
const e = s.data.value || [], n = s.rowKey.value;
|
|
11
|
+
if (p.value)
|
|
12
|
+
o.value = u.store.states.rowExpandable.value ? e.filter(l) : e.slice();
|
|
13
|
+
else if (n) {
|
|
14
|
+
const t = i(o.value, n);
|
|
15
|
+
o.value = e.filter((a, d) => {
|
|
16
|
+
const c = x(a, n);
|
|
17
|
+
return !!t[c] && l(a, d);
|
|
18
|
+
});
|
|
19
|
+
} else
|
|
20
|
+
o.value = [];
|
|
21
|
+
},
|
|
22
|
+
toggleRowExpansion: (e, n) => {
|
|
23
|
+
const a = (s.data.value || []).indexOf(e);
|
|
24
|
+
if (a > -1 && !l(e, a)) return;
|
|
25
|
+
w(
|
|
26
|
+
o.value,
|
|
27
|
+
e,
|
|
28
|
+
n,
|
|
29
|
+
void 0,
|
|
30
|
+
void 0,
|
|
31
|
+
void 0,
|
|
32
|
+
s.rowKey.value
|
|
33
|
+
) && u.emit("expand-change", e, o.value.slice());
|
|
34
|
+
},
|
|
35
|
+
setExpandRowKeys: (e) => {
|
|
36
|
+
u.store.assertRowKey();
|
|
37
|
+
const n = s.data.value || [], t = s.rowKey.value, a = i(n, t);
|
|
38
|
+
o.value = e.reduce((d, c) => {
|
|
39
|
+
const r = a[c];
|
|
40
|
+
return r && l(r.row, r.index) && d.push(r.row), d;
|
|
41
|
+
}, []);
|
|
42
|
+
},
|
|
43
|
+
isRowExpanded: (e) => {
|
|
44
|
+
const n = s.rowKey.value;
|
|
45
|
+
return n ? !!i(o.value, n)[x(e, n)] : o.value.includes(e);
|
|
46
|
+
},
|
|
47
|
+
states: {
|
|
48
|
+
expandRows: o,
|
|
49
|
+
defaultExpandAll: p
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
export {
|
|
54
|
+
M as default
|
|
55
|
+
};
|