@dazhicheng/ui 1.6.7 → 1.6.9
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/tt-form/src/form-render/expandable.js +31 -32
- package/dist/components/tt-form/src/useFormContext.js +1 -1
- package/dist/components/tt-panel-select/src/index.vue.js +28 -28
- package/dist/components/tt-table/index.d.ts +3 -15
- package/dist/components/tt-table/index.js +5 -4
- package/dist/components/tt-table/src/Table.vue.d.ts +1 -1
- package/dist/components/tt-table/src/Table.vue.js +3 -3
- package/dist/components/tt-table/src/TableForm.vue.js +168 -159
- package/dist/components/tt-table/src/components/TableAction.vue.d.ts +2 -12
- package/dist/components/tt-table/src/components/TableAction.vue.js +78 -175
- package/dist/components/tt-table/src/hooks/useGridProps.js +64 -60
- package/dist/components/tt-table/src/hooks/useTableData.js +77 -74
- package/dist/components/tt-table/src/types/table.d.ts +2 -1
- package/dist/components/tt-table/src/utils/table-api.d.ts +2 -1
- package/dist/components/tt-table/src/utils/table-api.js +3 -2
- package/dist/components/tt-vtable/index.js +54 -0
- package/dist/components/tt-vtable/src/components/TtVTable.vue.d.ts +188 -0
- package/dist/components/tt-vtable/src/components/TtVTable.vue.js +227 -0
- package/dist/components/tt-vtable/src/components/TtVTable.vue2.js +4 -0
- package/dist/components/tt-vtable/src/components/TtVTableForm.vue.d.ts +32 -0
- package/dist/components/tt-vtable/src/components/TtVTableForm.vue.js +121 -0
- package/dist/components/tt-vtable/src/components/TtVTableForm.vue2.js +4 -0
- package/dist/components/tt-vtable/src/components/VTableEmpty.vue.d.ts +64 -0
- package/dist/components/tt-vtable/src/components/VTableEmpty.vue.js +97 -0
- package/dist/components/tt-vtable/src/components/VTableEmpty.vue2.js +4 -0
- package/dist/components/tt-vtable/src/components/VTablePagination.vue.d.ts +53 -0
- package/dist/components/tt-vtable/src/components/VTablePagination.vue.js +52 -0
- package/dist/components/tt-vtable/src/components/VTablePagination.vue2.js +4 -0
- package/dist/components/tt-vtable/src/components/VTableSelectionAlert.vue.d.ts +35 -0
- package/dist/components/tt-vtable/src/components/VTableSelectionAlert.vue.js +50 -0
- package/dist/components/tt-vtable/src/components/VTableSelectionAlert.vue2.js +4 -0
- package/dist/components/tt-vtable/src/components/VTableToolbar.vue.d.ts +63 -0
- package/dist/components/tt-vtable/src/components/VTableToolbar.vue.js +126 -0
- package/dist/components/tt-vtable/src/components/VTableToolbar.vue2.js +4 -0
- package/dist/components/tt-vtable/src/components/VTableViewport.vue.js +133 -0
- package/dist/components/tt-vtable/src/components/VTableViewport.vue2.js +4 -0
- package/dist/components/tt-vtable/src/composables/useVTable.d.ts +41 -0
- package/dist/components/tt-vtable/src/composables/useVTable.js +25 -0
- package/dist/components/tt-vtable/src/composables/useVTableFormRender.d.ts +13 -0
- package/dist/components/tt-vtable/src/composables/useVTableFormRender.js +92 -0
- package/dist/components/tt-vtable/src/composables/useVTableRender.d.ts +13 -0
- package/dist/components/tt-vtable/src/composables/useVTableRender.js +13 -0
- package/dist/components/tt-vtable/src/engine/visactor/createListTable.d.ts +10 -0
- package/dist/components/tt-vtable/src/engine/visactor/createListTable.js +63 -0
- package/dist/components/tt-vtable/src/engine/visactor/createVueCellLayout.d.ts +37 -0
- package/dist/components/tt-vtable/src/engine/visactor/createVueCellLayout.js +133 -0
- package/dist/components/tt-vtable/src/engine/visactor/index.d.ts +8 -0
- package/dist/components/tt-vtable/src/engine/visactor/native-boundaries.d.ts +23 -0
- package/dist/components/tt-vtable/src/engine/visactor/native-boundaries.js +70 -0
- package/dist/components/tt-vtable/src/engine/visactor/record-adapter.d.ts +38 -0
- package/dist/components/tt-vtable/src/engine/visactor/record-adapter.js +41 -0
- package/dist/components/tt-vtable/src/engine/visactor/toColumnDefinitions.d.ts +45 -0
- package/dist/components/tt-vtable/src/engine/visactor/toColumnDefinitions.js +73 -0
- package/dist/components/tt-vtable/src/engine/visactor/toListTableOptions.d.ts +25 -0
- package/dist/components/tt-vtable/src/engine/visactor/toListTableOptions.js +25 -0
- package/dist/components/tt-vtable/src/engine/visactor/types.d.ts +29 -0
- package/dist/components/tt-vtable/src/features/column-preferences/column-preference-storage.d.ts +5 -0
- package/dist/components/tt-vtable/src/features/column-preferences/column-preference-storage.js +52 -0
- package/dist/components/tt-vtable/src/features/column-preferences/useColumnPreferences.d.ts +74 -0
- package/dist/components/tt-vtable/src/features/column-preferences/useColumnPreferences.js +232 -0
- package/dist/components/tt-vtable/src/features/editing/useCellEditing.d.ts +48 -0
- package/dist/components/tt-vtable/src/features/editing/useCellEditing.js +102 -0
- package/dist/components/tt-vtable/src/features/form-integration/useVTableForm.d.ts +51 -0
- package/dist/components/tt-vtable/src/features/pagination/useTablePagination.d.ts +40 -0
- package/dist/components/tt-vtable/src/features/pagination/useTablePagination.js +51 -0
- package/dist/components/tt-vtable/src/features/querying/useRecordQuery.d.ts +38 -0
- package/dist/components/tt-vtable/src/features/querying/useRecordQuery.js +57 -0
- package/dist/components/tt-vtable/src/features/records/index.d.ts +3 -0
- package/dist/components/tt-vtable/src/features/records/record-index.d.ts +122 -0
- package/dist/components/tt-vtable/src/features/records/record-index.js +209 -0
- package/dist/components/tt-vtable/src/features/records/useRecordSource.d.ts +41 -0
- package/dist/components/tt-vtable/src/features/records/useRecordSource.js +249 -0
- package/dist/components/tt-vtable/src/features/selection/useRowSelection.d.ts +65 -0
- package/dist/components/tt-vtable/src/features/selection/useRowSelection.js +129 -0
- package/dist/components/tt-vtable/src/features/tree/useTreeRecords.d.ts +60 -0
- package/dist/components/tt-vtable/src/features/tree/useTreeRecords.js +125 -0
- package/dist/components/tt-vtable/src/public/column-preferences.d.ts +32 -0
- package/dist/components/tt-vtable/src/public/index.d.ts +8 -0
- package/dist/components/tt-vtable/src/public/table-api.d.ts +215 -0
- package/dist/components/tt-vtable/src/public/table-column.d.ts +123 -0
- package/dist/components/tt-vtable/src/public/table-errors.d.ts +26 -0
- package/dist/components/tt-vtable/src/public/table-errors.js +26 -0
- package/dist/components/tt-vtable/src/public/table-events.d.ts +69 -0
- package/dist/components/tt-vtable/src/public/table-props.d.ts +216 -0
- package/dist/components/tt-vtable/src/public/table-slots.d.ts +37 -0
- package/dist/components/tt-vtable/src/runtime/createVTableController.d.ts +12 -0
- package/dist/components/tt-vtable/src/runtime/createVTableController.js +238 -0
- package/dist/components/tt-vtable/src/runtime/createVTableRuntime.d.ts +79 -0
- package/dist/components/tt-vtable/src/runtime/createVTableRuntime.js +380 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +129 -115
- package/dist/packages/utils/src/is.js +46 -37
- package/dist/style.css +1 -1
- package/package.json +3 -1
- package/dist/assets/svg/action_more.svg.js +0 -4
|
@@ -1,13 +1,15 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { propTypes as
|
|
3
|
-
import { useDesign as
|
|
1
|
+
import { defineComponent as F, useAttrs as j, inject as b, computed as d, unref as n, h as z, onMounted as E, createElementBlock as l, openBlock as i, normalizeClass as x, createVNode as O, withCtx as y, Fragment as p, renderList as P, renderSlot as R, withDirectives as U, mergeProps as K, createBlock as I, normalizeStyle as V, createCommentVNode as c, toDisplayString as H } from "vue";
|
|
2
|
+
import { propTypes as w } from "../../../../packages/hooks/src/propTypes.js";
|
|
3
|
+
import { useDesign as L } from "../../../../packages/hooks/src/useDesign.js";
|
|
4
4
|
import "axios";
|
|
5
|
-
import { ElDivider as
|
|
6
|
-
import { isNullOrUnDef as
|
|
5
|
+
import { ElDivider as M, ElSpace as W } from "element-plus";
|
|
6
|
+
import { isNullOrUnDef as a, isBoolean as X, isFunction as Y, isArray as q, isObject as G } from "../../../../packages/utils/src/is.js";
|
|
7
7
|
import "dayjs";
|
|
8
8
|
import "numeral";
|
|
9
|
-
import { generateTestId as
|
|
10
|
-
import
|
|
9
|
+
import { generateTestId as g, toKebabCase as C } from "../../../../packages/utils/src/testid-helper.js";
|
|
10
|
+
import "xe-utils";
|
|
11
|
+
import "dayjs/plugin/utc";
|
|
12
|
+
import "dayjs/plugin/timezone";
|
|
11
13
|
import "../../../../node_modules/.pnpm/decimal.js@10.6.0/node_modules/decimal.js/decimal.js";
|
|
12
14
|
import "../../../../node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/aes.js";
|
|
13
15
|
import "../../../../node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/enc-utf8.js";
|
|
@@ -15,13 +17,12 @@ import "../../../../node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/mo
|
|
|
15
17
|
import "../../../../node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/pad-pkcs7.js";
|
|
16
18
|
import "lodash-es";
|
|
17
19
|
import "vue-router";
|
|
18
|
-
import { TtButton as
|
|
19
|
-
import { TtIcon as
|
|
20
|
-
import
|
|
21
|
-
import
|
|
22
|
-
import {
|
|
23
|
-
|
|
24
|
-
const ye = { key: 1 }, ge = ["onClick"], Ve = /* @__PURE__ */ q({
|
|
20
|
+
import { TtButton as J } from "../../../tt-button/index.js";
|
|
21
|
+
import { TtIcon as Q } from "../../../tt-icon/index.js";
|
|
22
|
+
import Z from "../../../../directives/disabled-tip/index.js";
|
|
23
|
+
import { ROW_INDEX_KEY as tt } from "./RowContext.js";
|
|
24
|
+
import { scheduleNormalizeActionTabIndex as et } from "../utils/action-tab-index.js";
|
|
25
|
+
const ot = { key: 1 }, _t = /* @__PURE__ */ F({
|
|
25
26
|
name: "TtTableAction",
|
|
26
27
|
__name: "TableAction",
|
|
27
28
|
props: {
|
|
@@ -43,199 +44,101 @@ const ye = { key: 1 }, ge = ["onClick"], Ve = /* @__PURE__ */ q({
|
|
|
43
44
|
/** 是否分割线 */
|
|
44
45
|
// divider: propTypes.bool.def(true),
|
|
45
46
|
/** 是否清除冒泡 */
|
|
46
|
-
stopButtonPropagation:
|
|
47
|
-
/**
|
|
48
|
-
|
|
49
|
-
/** 弹出框的宽度 */
|
|
50
|
-
popoverWidth: v.number.def(27),
|
|
51
|
-
/** 是否自动换行 */
|
|
52
|
-
wrap: v.bool.def(!0)
|
|
47
|
+
stopButtonPropagation: w.bool.def(!1),
|
|
48
|
+
/** 操作按钮在宽度不足时是否自动换行 */
|
|
49
|
+
wrap: w.bool.def(!0)
|
|
53
50
|
},
|
|
54
|
-
setup(
|
|
55
|
-
const
|
|
51
|
+
setup(u) {
|
|
52
|
+
const s = u, f = j(), { prefixCls: h } = L("table-action"), k = b(
|
|
56
53
|
"tableIdContext",
|
|
57
54
|
d(() => "")
|
|
58
|
-
),
|
|
55
|
+
), T = b(tt, void 0), v = d(() => {
|
|
59
56
|
var o;
|
|
60
|
-
if (!
|
|
61
|
-
return
|
|
62
|
-
const
|
|
63
|
-
if (!
|
|
64
|
-
return
|
|
65
|
-
if (!
|
|
66
|
-
return
|
|
67
|
-
if (!f
|
|
68
|
-
return
|
|
57
|
+
if (!a(s.rowIndex))
|
|
58
|
+
return s.rowIndex;
|
|
59
|
+
const e = n(T);
|
|
60
|
+
if (!a(e))
|
|
61
|
+
return e;
|
|
62
|
+
if (!a((o = s.slotContext) == null ? void 0 : o.$rowIndex))
|
|
63
|
+
return s.slotContext.$rowIndex;
|
|
64
|
+
if (!a(f.$rowIndex))
|
|
65
|
+
return f.$rowIndex;
|
|
69
66
|
});
|
|
70
|
-
function
|
|
71
|
-
const o =
|
|
72
|
-
return
|
|
67
|
+
function B(e) {
|
|
68
|
+
const o = n(k), t = v.value;
|
|
69
|
+
return a(t) ? g(o, "action", C(e)) : g(o, "action", `row${t}`, C(e));
|
|
73
70
|
}
|
|
74
|
-
function _(
|
|
75
|
-
const o =
|
|
76
|
-
let
|
|
77
|
-
return
|
|
71
|
+
function _(e) {
|
|
72
|
+
const o = e.ifShow;
|
|
73
|
+
let t = !0;
|
|
74
|
+
return X(o) && (t = o), Y(o) && (t = o(e)), t;
|
|
78
75
|
}
|
|
79
|
-
const
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
function $(t, o) {
|
|
84
|
-
const e = t;
|
|
85
|
-
return ue(e) && e.length > 0 ? e.some((n) => !!(n != null && n.condition)) : ce(e) ? !!e.condition : !!o;
|
|
76
|
+
const A = d(() => (s.actions || []).filter((e) => _(e))), S = d(() => "left flex items-center");
|
|
77
|
+
function N(e, o) {
|
|
78
|
+
const t = e;
|
|
79
|
+
return q(t) && t.length > 0 ? t.some((r) => !!(r != null && r.condition)) : G(t) ? !!t.condition : !!o;
|
|
86
80
|
}
|
|
87
|
-
function
|
|
88
|
-
if (!
|
|
89
|
-
|
|
90
|
-
var
|
|
91
|
-
return ((
|
|
92
|
-
}) &&
|
|
81
|
+
function $(e) {
|
|
82
|
+
if (!s.stopButtonPropagation) return;
|
|
83
|
+
e.composedPath().find((r) => {
|
|
84
|
+
var m;
|
|
85
|
+
return ((m = r.tagName) == null ? void 0 : m.toUpperCase()) === "BUTTON";
|
|
86
|
+
}) && e.stopPropagation();
|
|
93
87
|
}
|
|
94
|
-
const
|
|
88
|
+
const D = z(M, {
|
|
95
89
|
direction: "vertical",
|
|
96
90
|
style: { fontSize: "12px", margin: "0 6px" }
|
|
97
91
|
});
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
}
|
|
101
|
-
const h = x({
|
|
102
|
-
top: 0,
|
|
103
|
-
left: 0,
|
|
104
|
-
bottom: 0,
|
|
105
|
-
right: 0
|
|
106
|
-
});
|
|
107
|
-
Q(() => ve());
|
|
108
|
-
const Y = x({
|
|
109
|
-
getBoundingClientRect() {
|
|
110
|
-
return h.value;
|
|
111
|
-
}
|
|
112
|
-
});
|
|
113
|
-
return (t, o) => (i(), s("div", {
|
|
114
|
-
class: w([r(N), U.value]),
|
|
92
|
+
return E(() => et()), (e, o) => (i(), l("div", {
|
|
93
|
+
class: x([n(h), S.value]),
|
|
115
94
|
tabindex: "-1",
|
|
116
|
-
onClick:
|
|
95
|
+
onClick: $
|
|
117
96
|
}, [
|
|
118
|
-
|
|
97
|
+
O(n(W), {
|
|
119
98
|
size: 0,
|
|
120
|
-
spacer:
|
|
121
|
-
wrap:
|
|
99
|
+
spacer: n(D),
|
|
100
|
+
wrap: u.wrap
|
|
122
101
|
}, {
|
|
123
|
-
default:
|
|
124
|
-
(i(!0),
|
|
125
|
-
key: `${
|
|
102
|
+
default: y(() => [
|
|
103
|
+
(i(!0), l(p, null, P(A.value, (t, r) => (i(), l(p, {
|
|
104
|
+
key: `${r}-${t.label}`
|
|
126
105
|
}, [
|
|
127
|
-
|
|
106
|
+
t.slot ? R(e.$slots, t.slot, K({
|
|
128
107
|
key: 0,
|
|
129
108
|
ref_for: !0
|
|
130
|
-
},
|
|
109
|
+
}, t)) : U((i(), I(n(J), {
|
|
131
110
|
key: 1,
|
|
132
111
|
link: "",
|
|
133
|
-
type:
|
|
134
|
-
disabled:
|
|
135
|
-
style:
|
|
136
|
-
loading:
|
|
137
|
-
"data-index":
|
|
112
|
+
type: t.type || "primary",
|
|
113
|
+
disabled: N(t.disabledTip, t.disabled),
|
|
114
|
+
style: V({ color: t.color, visibility: t.isTextHide ? "hidden" : "visible" }),
|
|
115
|
+
loading: t.loading,
|
|
116
|
+
"data-index": r,
|
|
138
117
|
"data-table-action-button": "",
|
|
139
|
-
"data-testid":
|
|
140
|
-
onClick:
|
|
118
|
+
"data-testid": B(t.label || ""),
|
|
119
|
+
onClick: t.onClick
|
|
141
120
|
}, {
|
|
142
|
-
default:
|
|
143
|
-
|
|
144
|
-
|
|
121
|
+
default: y(() => [
|
|
122
|
+
t.iconFont ? (i(), l(p, { key: 0 }, [
|
|
123
|
+
t.iconFont ? (i(), I(n(Q), {
|
|
145
124
|
key: 0,
|
|
146
|
-
"icon-font":
|
|
147
|
-
class:
|
|
148
|
-
}, null, 8, ["icon-font", "class"])) :
|
|
149
|
-
], 64)) :
|
|
150
|
-
|
|
125
|
+
"icon-font": t.iconFont,
|
|
126
|
+
class: x({ "mr-1": !!t.label })
|
|
127
|
+
}, null, 8, ["icon-font", "class"])) : c("", !0)
|
|
128
|
+
], 64)) : c("", !0),
|
|
129
|
+
t.label ? (i(), l("span", ot, H(t.label), 1)) : c("", !0)
|
|
151
130
|
]),
|
|
152
131
|
_: 2
|
|
153
132
|
}, 1032, ["type", "disabled", "style", "loading", "data-index", "data-testid", "onClick"])), [
|
|
154
|
-
[
|
|
133
|
+
[n(Z), t.disabledTip]
|
|
155
134
|
])
|
|
156
|
-
], 64))), 128))
|
|
157
|
-
V.value ? (i(), c(r(C), {
|
|
158
|
-
key: 0,
|
|
159
|
-
link: "",
|
|
160
|
-
type: "primary",
|
|
161
|
-
"data-testid": y("more")
|
|
162
|
-
}, {
|
|
163
|
-
default: u(() => [
|
|
164
|
-
te("span", {
|
|
165
|
-
onMouseover: oe(X, ["stop"]),
|
|
166
|
-
onMouseleave: o[0] || (o[0] = (e) => b.value = !1)
|
|
167
|
-
}, [
|
|
168
|
-
k(r(I), {
|
|
169
|
-
icon: r(fe),
|
|
170
|
-
"is-custom-svg": "",
|
|
171
|
-
size: 14
|
|
172
|
-
}, null, 8, ["icon"])
|
|
173
|
-
], 32)
|
|
174
|
-
]),
|
|
175
|
-
_: 1
|
|
176
|
-
}, 8, ["data-testid"])) : p("", !0)
|
|
135
|
+
], 64))), 128))
|
|
177
136
|
]),
|
|
178
137
|
_: 3
|
|
179
|
-
}, 8, ["spacer", "wrap"])
|
|
180
|
-
h.value.left ? (i(), c(r(ae), {
|
|
181
|
-
key: 0,
|
|
182
|
-
visible: b.value,
|
|
183
|
-
"onUpdate:visible": o[1] || (o[1] = (e) => b.value = e),
|
|
184
|
-
trigger: "hover",
|
|
185
|
-
placement: "bottom",
|
|
186
|
-
width: K.value,
|
|
187
|
-
offset: 8,
|
|
188
|
-
"hide-after": 0,
|
|
189
|
-
"virtual-ref": Y.value,
|
|
190
|
-
"virtual-triggering": "",
|
|
191
|
-
"popper-class": `${r(N)}-popover-class`,
|
|
192
|
-
"popper-style": {
|
|
193
|
-
padding: "6px 0px",
|
|
194
|
-
minWidth: "60px"
|
|
195
|
-
}
|
|
196
|
-
}, {
|
|
197
|
-
default: u(() => [
|
|
198
|
-
(i(!0), s(m, null, S(g.value, (e, n) => (i(), s("div", {
|
|
199
|
-
key: `${n}-${e.label}`,
|
|
200
|
-
onClick: () => {
|
|
201
|
-
var a;
|
|
202
|
-
!e.disabled && ((a = e.onClick) == null || a.call(e));
|
|
203
|
-
}
|
|
204
|
-
}, [
|
|
205
|
-
F((i(), c(r(C), {
|
|
206
|
-
link: "",
|
|
207
|
-
disabled: $(e.disabledTip, e.disabled),
|
|
208
|
-
type: e.type || "primary",
|
|
209
|
-
style: W({ color: e.color }),
|
|
210
|
-
"data-testid": y(e.label || "")
|
|
211
|
-
}, re({
|
|
212
|
-
default: u(() => [
|
|
213
|
-
e.label ? (i(), s(m, { key: 0 }, [
|
|
214
|
-
ne(E(e.label), 1)
|
|
215
|
-
], 64)) : p("", !0)
|
|
216
|
-
]),
|
|
217
|
-
_: 2
|
|
218
|
-
}, [
|
|
219
|
-
e.iconFont ? {
|
|
220
|
-
name: "icon",
|
|
221
|
-
fn: u(() => [
|
|
222
|
-
k(r(I), {
|
|
223
|
-
"icon-font": e.iconFont,
|
|
224
|
-
class: w({ "mr-1": !!e.label })
|
|
225
|
-
}, null, 8, ["icon-font", "class"])
|
|
226
|
-
]),
|
|
227
|
-
key: "0"
|
|
228
|
-
} : void 0
|
|
229
|
-
]), 1032, ["disabled", "type", "style", "data-testid"])), [
|
|
230
|
-
[r(P), e.disabledTip]
|
|
231
|
-
])
|
|
232
|
-
], 8, ge))), 128))
|
|
233
|
-
]),
|
|
234
|
-
_: 1
|
|
235
|
-
}, 8, ["visible", "width", "virtual-ref", "popper-class"])) : p("", !0)
|
|
138
|
+
}, 8, ["spacer", "wrap"])
|
|
236
139
|
], 2));
|
|
237
140
|
}
|
|
238
141
|
});
|
|
239
142
|
export {
|
|
240
|
-
|
|
143
|
+
_t as default
|
|
241
144
|
};
|
|
@@ -1,121 +1,125 @@
|
|
|
1
|
-
import { useTimeoutFn as
|
|
2
|
-
import { omit as
|
|
3
|
-
import { computed as
|
|
4
|
-
import { tableProps as
|
|
5
|
-
const
|
|
1
|
+
import { useTimeoutFn as K } from "@vueuse/core";
|
|
2
|
+
import { omit as S } from "lodash-es";
|
|
3
|
+
import { computed as T, unref as d } from "vue";
|
|
4
|
+
import { tableProps as j } from "../props.js";
|
|
5
|
+
const D = [...Object.keys(j), "modelValue", "data", "columns"], F = {
|
|
6
6
|
orders: ["desc", "asc", null],
|
|
7
7
|
trigger: "cell",
|
|
8
8
|
allowClear: !0,
|
|
9
9
|
showIcon: !0
|
|
10
10
|
};
|
|
11
|
-
function
|
|
12
|
-
|
|
13
|
-
return !(o && !o.transform || t && (i == null ? void 0 : i.mode) !== "fixed");
|
|
11
|
+
function q(o) {
|
|
12
|
+
return !!(o.autoHeight || o.height || o.maxHeight);
|
|
14
13
|
}
|
|
15
|
-
function
|
|
16
|
-
|
|
14
|
+
function G(o) {
|
|
15
|
+
const { expandConfig: i, hasExpandColumn: t, treeConfig: e } = o;
|
|
16
|
+
return !(!o.hasScrollViewport || e && !e.transform || t && (i == null ? void 0 : i.mode) !== "fixed");
|
|
17
|
+
}
|
|
18
|
+
function I({
|
|
19
|
+
$table: o,
|
|
17
20
|
column: i
|
|
18
21
|
}) {
|
|
19
|
-
var
|
|
20
|
-
const t = (
|
|
22
|
+
var f, h;
|
|
23
|
+
const t = (f = o == null ? void 0 : o.getEl) == null ? void 0 : f.call(o);
|
|
21
24
|
if (!t) return "auto";
|
|
22
|
-
const { visibleColumn:
|
|
25
|
+
const { visibleColumn: e = [] } = o.getTableColumn() || {}, l = e.reduce(
|
|
23
26
|
(r, n) => r + (n.id === i.id ? 0 : Number(n.renderWidth) || 0),
|
|
24
27
|
0
|
|
25
|
-
),
|
|
26
|
-
return
|
|
28
|
+
), C = ((h = t.querySelector(".vxe-table--scroll-y-virtual")) == null ? void 0 : h.offsetWidth) || 0, a = t.clientWidth - l - C;
|
|
29
|
+
return a > 0 ? a : "auto";
|
|
27
30
|
}
|
|
28
|
-
function
|
|
29
|
-
const
|
|
31
|
+
function Q(o, { attrs: i, slots: t }, e = {}) {
|
|
32
|
+
const l = /* @__PURE__ */ new WeakMap(), { start: C } = K(() => {
|
|
30
33
|
var r;
|
|
31
|
-
return (r =
|
|
34
|
+
return (r = e.onTreeLoadResolved) == null ? void 0 : r.call(e);
|
|
32
35
|
}, 0, {
|
|
33
36
|
immediate: !1
|
|
34
37
|
});
|
|
35
|
-
function
|
|
36
|
-
const n =
|
|
38
|
+
function a(r) {
|
|
39
|
+
const n = l.get(r);
|
|
37
40
|
if (n) return n;
|
|
38
|
-
const g = async (
|
|
39
|
-
var
|
|
40
|
-
const
|
|
41
|
-
return (
|
|
41
|
+
const g = async (w) => {
|
|
42
|
+
var m;
|
|
43
|
+
const c = await r(w);
|
|
44
|
+
return (m = e.prepareRows) == null || m.call(e, c), C(), c;
|
|
42
45
|
};
|
|
43
|
-
return
|
|
46
|
+
return l.set(r, g), g;
|
|
44
47
|
}
|
|
45
|
-
const
|
|
46
|
-
var
|
|
48
|
+
const f = T(() => {
|
|
49
|
+
var y;
|
|
47
50
|
const {
|
|
48
51
|
checkboxConfig: r,
|
|
49
52
|
rowConfig: n,
|
|
50
53
|
columnConfig: g,
|
|
51
|
-
resizableConfig:
|
|
52
|
-
isCellResize:
|
|
53
|
-
showToolbar:
|
|
54
|
-
toolbarConfig:
|
|
54
|
+
resizableConfig: w,
|
|
55
|
+
isCellResize: c,
|
|
56
|
+
showToolbar: m,
|
|
57
|
+
toolbarConfig: V = {},
|
|
55
58
|
showPager: W,
|
|
56
|
-
autoHeight:
|
|
57
|
-
virtualYConfig:
|
|
59
|
+
autoHeight: b,
|
|
60
|
+
virtualYConfig: p = {},
|
|
58
61
|
expandConfig: v = {},
|
|
59
|
-
treeConfig:
|
|
60
|
-
sortConfig:
|
|
61
|
-
showHeaderTooltip:
|
|
62
|
+
treeConfig: u,
|
|
63
|
+
sortConfig: z,
|
|
64
|
+
showHeaderTooltip: E,
|
|
62
65
|
showCellTooltip: O,
|
|
63
|
-
showOverflow:
|
|
64
|
-
reserveSelection:
|
|
66
|
+
showOverflow: R,
|
|
67
|
+
reserveSelection: H,
|
|
65
68
|
footerMethod: _
|
|
66
|
-
} =
|
|
69
|
+
} = d(o), s = {}, P = Object.hasOwn(p, "enabled"), x = q(d(o)), Y = x ? P ? p.enabled : G({
|
|
67
70
|
expandConfig: v,
|
|
68
|
-
hasExpandColumn:
|
|
69
|
-
treeConfig:
|
|
70
|
-
|
|
71
|
-
|
|
71
|
+
hasExpandColumn: d(e.hasExpandColumn),
|
|
72
|
+
treeConfig: u,
|
|
73
|
+
hasScrollViewport: x
|
|
74
|
+
}) : !1, L = ((y = e.toVxeRowConfig) == null ? void 0 : y.call(e, n)) || n, M = _ ? void 0 : d(e.footerSummaryMethod);
|
|
75
|
+
return m && (s.toolbarConfig = {
|
|
72
76
|
slots: t.toolbar_tools || t.toolbar_buttons ? {
|
|
73
77
|
tools: t.toolbar_tools ? "toolbar_tools" : void 0,
|
|
74
78
|
buttons: t.toolbar_buttons ? "toolbar_buttons" : void 0
|
|
75
79
|
} : void 0,
|
|
76
|
-
...
|
|
77
|
-
}), W || (
|
|
80
|
+
...V
|
|
81
|
+
}), W || (s.pagerConfig = void 0), b && (s.height = "auto", s.autoResize = !0, s.syncResize = !0), {
|
|
78
82
|
// 去除 data 与 columns,避免与内部数据、列管理冲突
|
|
79
|
-
...
|
|
80
|
-
...
|
|
81
|
-
virtualYConfig: { enabled:
|
|
83
|
+
...S(d(o), ["data", "columns"]),
|
|
84
|
+
...s,
|
|
85
|
+
virtualYConfig: { enabled: Y, mode: "wheel", ...p },
|
|
82
86
|
// 表头 tooltip 由 vxe 负责:开启时翻译成 showHeaderOverflow: "tooltip",
|
|
83
87
|
// 由它自己做溢出检测(scrollWidth > clientWidth)并弹层,样式走原生 headerTooltipConfig。
|
|
84
88
|
// 关闭时固定 false —— 一旦命中任意溢出值,vxe 会给表头单元格加 col--ellipsis 并把
|
|
85
89
|
// 内层 .vxe-cell 的高度从 minHeight 改成固定 height,表头高度算法就变了。
|
|
86
90
|
// 固定 false 也意味着调用方传入的 showHeaderOverflow 不参与判定,与改动前一致。
|
|
87
|
-
showHeaderOverflow:
|
|
91
|
+
showHeaderOverflow: E ? "tooltip" : !1,
|
|
88
92
|
// 单元格 tooltip 同样交给 vxe,但与表头侧不对称:表头侧改动前无条件写死 false,
|
|
89
93
|
// 所以关闭时也固定 false;单元格侧改动前是原样透传,所以关闭时必须沿用原值,
|
|
90
94
|
// 否则会覆盖调用方传入的 showOverflow 与 GlobalConfig.table 的默认值。
|
|
91
|
-
showOverflow: O ? "tooltip" :
|
|
95
|
+
showOverflow: O ? "tooltip" : R,
|
|
92
96
|
// 列宽调整由 column-config.resizable 统一控制,列上单独设置的 resizable 优先
|
|
93
97
|
// 排序交由 vxe 负责,组件只预置与改动前等价的交互口径
|
|
94
|
-
sortConfig: { ...
|
|
95
|
-
columnConfig: { useKey: !0, resizable:
|
|
96
|
-
rowConfig: { useKey: !0, isHover: !0, isCurrent: !1, ...
|
|
97
|
-
resizableConfig: { showDragTip: !0, minWidth:
|
|
98
|
+
sortConfig: { ...F, ...z },
|
|
99
|
+
columnConfig: { useKey: !0, resizable: c, ...g },
|
|
100
|
+
rowConfig: { useKey: !0, isHover: !0, isCurrent: !1, ...L },
|
|
101
|
+
resizableConfig: { showDragTip: !0, minWidth: I, ...w },
|
|
98
102
|
// reserveSelection 开启时同时打开 vxe 的跨页保留存储,调用方显式配的 reserve 优先。
|
|
99
103
|
// 只有存储打开,useRowSelection 才能从 getCheckboxReserveRecords 读到跨页那部分。
|
|
100
104
|
// 关闭时不写 reserve 键,保持与改动前完全相同的配置对象(不覆盖 vxe 全局默认)。
|
|
101
|
-
checkboxConfig: { highlight: !1, ...
|
|
105
|
+
checkboxConfig: { highlight: !1, ...H ? { reserve: !0 } : {}, ...r },
|
|
102
106
|
expandConfig: {
|
|
103
107
|
padding: !0,
|
|
104
108
|
iconClose: "vxe-icon-caret-down",
|
|
105
109
|
iconOpen: "vxe-icon-caret-up",
|
|
106
110
|
...v
|
|
107
111
|
},
|
|
108
|
-
treeConfig:
|
|
112
|
+
treeConfig: u != null && u.loadMethod ? { ...u, loadMethod: a(u.loadMethod) } : u,
|
|
109
113
|
round: !0,
|
|
110
114
|
// 列上声明 summary 时自动开启表尾;没有任何列声明时不写这两个键,
|
|
111
115
|
// 表尾相关配置与改动前完全一致(vxe 的 showFooter 默认 false,表尾不渲染)。
|
|
112
|
-
...
|
|
116
|
+
...M ? { showFooter: !0, footerMethod: M } : {},
|
|
113
117
|
// loading 由外层容器接管
|
|
114
118
|
loading: !1
|
|
115
119
|
};
|
|
116
|
-
}), h =
|
|
117
|
-
return { bindValues:
|
|
120
|
+
}), h = T(() => S({ ...i, ...d(f) }, D));
|
|
121
|
+
return { bindValues: f, gridProps: h };
|
|
118
122
|
}
|
|
119
123
|
export {
|
|
120
|
-
|
|
124
|
+
Q as useGridProps
|
|
121
125
|
};
|