@dazhicheng/ui 1.6.5 → 1.6.7
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-area/TtArea.vue.js +1 -1
- package/dist/components/tt-drawer/src/components/DrawerHeader.vue.js +2 -2
- package/dist/components/tt-icon/index.vue.js +2 -2
- package/dist/components/tt-loading/src/loading.vue.js +2 -2
- package/dist/components/tt-modal/index.d.ts +32 -8
- package/dist/components/tt-modal/src/RenderModal.vue.d.ts +32 -8
- package/dist/components/tt-modal/src/RenderModal.vue.js +254 -193
- package/dist/components/tt-modal/src/components/ModalWrapper.vue.d.ts +14 -2
- package/dist/components/tt-modal/src/components/ModalWrapper.vue.js +61 -30
- package/dist/components/tt-modal/src/hooks/useModalRender.js +72 -71
- package/dist/components/tt-modal/src/utils/resolve-modal-target.d.ts +19 -0
- package/dist/components/tt-modal/src/utils/resolve-modal-target.js +151 -0
- package/dist/components/tt-nav-anchor/src/TtNavAnchor.vue.js +199 -167
- package/dist/components/tt-nav-anchor/src/types.d.ts +13 -4
- package/dist/components/tt-panel-select/src/components/PanelMiddle.vue.d.ts +2 -2
- package/dist/components/tt-table/src/TableForm.vue.d.ts +0 -9
- package/dist/components/tt-table/src/TableForm.vue.js +37 -38
- package/dist/components/tt-table/src/hooks/useTableForm.js +22 -23
- package/dist/components/tt-table/src/props.d.ts +0 -5
- package/dist/components/tt-table/src/props.js +22 -31
- package/dist/components/tt-table/src/types/tableForm.d.ts +0 -2
- package/dist/components/tt-table/src/utils/table-form-api.js +14 -15
- package/dist/directives/dialog-resize/use-draggable.js +47 -25
- package/dist/style.css +1 -1
- package/package.json +1 -1
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { defineComponent as
|
|
1
|
+
import { defineComponent as Re, useSlots as _e, getCurrentInstance as Ie, ref as De, shallowReactive as Ke, onScopeDispose as X, computed as u, unref as r, shallowRef as Ve, toRaw as P, watch as h, toValue as S, onMounted as ke, nextTick as Y, createElementBlock as Z, openBlock as ee, normalizeClass as D, createCommentVNode as Be, createElementVNode as Le, createVNode as A, renderSlot as n, createSlots as K, renderList as te, withCtx as b, normalizeProps as oe, guardReactiveProps as re, mergeProps as se, toHandlers as xe, isRef as ze } from "vue";
|
|
2
2
|
import "../../tt-button/index.js";
|
|
3
3
|
import "../../tt-checkbox/index.js";
|
|
4
4
|
import "../../tt-empty/index.js";
|
|
5
5
|
import "axios";
|
|
6
6
|
import "element-plus";
|
|
7
|
-
import { isFunction as
|
|
7
|
+
import { isFunction as je } from "../../../packages/utils/src/is.js";
|
|
8
8
|
import "dayjs";
|
|
9
9
|
import "numeral";
|
|
10
10
|
import { extractResourceFromApi as Ne, generateTestId as M } from "../../../packages/utils/src/testid-helper.js";
|
|
@@ -76,7 +76,7 @@ import rt from "./Table.vue.js";
|
|
|
76
76
|
import { forwardedEventEntries as st } from "./table-mutation-events.js";
|
|
77
77
|
import { TableFormApi as at } from "./utils/table-form-api.js";
|
|
78
78
|
import { provideFormActionTestIds as it } from "./utils/context.js";
|
|
79
|
-
const nt = ["data-testid"], lt = ["data-testid"], Do = /* @__PURE__ */
|
|
79
|
+
const nt = ["data-testid"], lt = ["data-testid"], Do = /* @__PURE__ */ Re({
|
|
80
80
|
name: "TtTableForm",
|
|
81
81
|
__name: "TableForm",
|
|
82
82
|
props: ot,
|
|
@@ -91,12 +91,12 @@ const nt = ["data-testid"], lt = ["data-testid"], Do = /* @__PURE__ */ Ee({
|
|
|
91
91
|
],
|
|
92
92
|
setup(ie, { expose: ne, emit: le }) {
|
|
93
93
|
var J, q, G;
|
|
94
|
-
const i = ie, y = le,
|
|
94
|
+
const i = ie, y = le, $ = _e(), g = Ie(), { prefixCls: E } = qe("table-form");
|
|
95
95
|
function V() {
|
|
96
96
|
var e;
|
|
97
97
|
return Object.hasOwn(((e = g == null ? void 0 : g.vnode) == null ? void 0 : e.props) || {}, "table");
|
|
98
98
|
}
|
|
99
|
-
const
|
|
99
|
+
const R = De();
|
|
100
100
|
let t = i.tableFormApi;
|
|
101
101
|
t || (t = new at(i), t.useStore = (e) => Je(t.store, e));
|
|
102
102
|
const k = Ke({});
|
|
@@ -116,21 +116,21 @@ const nt = ["data-testid"], lt = ["data-testid"], Do = /* @__PURE__ */ Ee({
|
|
|
116
116
|
reset: M(r(w), "search-btn-reset")
|
|
117
117
|
}))
|
|
118
118
|
);
|
|
119
|
-
const { getSlotKeys: ue, replaceSlotKey: ce } = ae("form-"), { getSlotKeys: de, replaceSlotKey: fe } = ae("t-"), { getFormProps:
|
|
119
|
+
const { getSlotKeys: ue, replaceSlotKey: ce } = ae("form-"), { getSlotKeys: de, replaceSlotKey: fe } = ae("t-"), { getFormProps: _, getTableProps: m, getTableToolProps: be, submitSearchQuery: L } = et(
|
|
120
120
|
c,
|
|
121
121
|
t.tableApi.reload,
|
|
122
122
|
t.tableApi.getLoading,
|
|
123
123
|
t.tableApi.getPagination
|
|
124
|
-
),
|
|
125
|
-
let
|
|
124
|
+
), x = Ve([]), ge = u(() => (i.table, !V() || !i.table ? !1 : (i.table.data, Object.hasOwn(P(i.table), "data"))));
|
|
125
|
+
let I = () => {
|
|
126
126
|
};
|
|
127
127
|
function he(e) {
|
|
128
|
-
|
|
128
|
+
I(), I = h(
|
|
129
129
|
() => S(e),
|
|
130
130
|
(o) => {
|
|
131
|
-
|
|
131
|
+
x.value = o || [];
|
|
132
132
|
},
|
|
133
|
-
{ immediate: !0, deep:
|
|
133
|
+
{ immediate: !0, deep: ze(e) ? !1 : 1 }
|
|
134
134
|
);
|
|
135
135
|
}
|
|
136
136
|
function Se() {
|
|
@@ -154,7 +154,7 @@ const nt = ["data-testid"], lt = ["data-testid"], Do = /* @__PURE__ */ Ee({
|
|
|
154
154
|
200,
|
|
155
155
|
{ leading: !0 }
|
|
156
156
|
), [ye, s] = We({
|
|
157
|
-
...S(
|
|
157
|
+
...S(_),
|
|
158
158
|
handleSubmit: Te,
|
|
159
159
|
handleReset: we,
|
|
160
160
|
submitOnEnter: !0,
|
|
@@ -165,7 +165,7 @@ const nt = ["data-testid"], lt = ["data-testid"], Do = /* @__PURE__ */ Ee({
|
|
|
165
165
|
collapsed: !0,
|
|
166
166
|
collapseTriggerResize: !0,
|
|
167
167
|
collapsedRows: 3
|
|
168
|
-
}), { restoreColumns: ve, saveColumns:
|
|
168
|
+
}), { restoreColumns: ve, saveColumns: z } = Ye({
|
|
169
169
|
getTableProps: m,
|
|
170
170
|
getProps: c,
|
|
171
171
|
tableMethods: t.tableApi
|
|
@@ -178,7 +178,7 @@ const nt = ["data-testid"], lt = ["data-testid"], Do = /* @__PURE__ */ Ee({
|
|
|
178
178
|
const { run: Fe } = O(async () => {
|
|
179
179
|
if (d || !r(m).useHttpCache) return;
|
|
180
180
|
const e = (t.tableApi.getTableColumns() || []).map((o) => o.field).filter(Boolean);
|
|
181
|
-
e.length && await
|
|
181
|
+
e.length && await z(JSON.stringify(e));
|
|
182
182
|
}, 300);
|
|
183
183
|
function Ce(e) {
|
|
184
184
|
var o;
|
|
@@ -211,13 +211,13 @@ const nt = ["data-testid"], lt = ["data-testid"], Do = /* @__PURE__ */ Ee({
|
|
|
211
211
|
};
|
|
212
212
|
async function Oe() {
|
|
213
213
|
const { tableRefreshBefore: e } = r(c);
|
|
214
|
-
|
|
214
|
+
je(e) && await e(), v.reload();
|
|
215
215
|
}
|
|
216
|
-
async function
|
|
216
|
+
async function j() {
|
|
217
217
|
var e;
|
|
218
218
|
await Y(), !d && ((e = t.tableApi) == null || e.redoHeight());
|
|
219
219
|
}
|
|
220
|
-
async function
|
|
220
|
+
async function $e(e) {
|
|
221
221
|
var F, C;
|
|
222
222
|
if (d) return;
|
|
223
223
|
const o = S((C = (F = r(c)) == null ? void 0 : F.table) == null ? void 0 : C.columns) || [], a = new Map(o.map((f) => [f.field, f])), l = e.checkedModel.map((f) => a.get(f)).filter(Boolean);
|
|
@@ -227,7 +227,7 @@ const nt = ["data-testid"], lt = ["data-testid"], Do = /* @__PURE__ */ Ee({
|
|
|
227
227
|
}
|
|
228
228
|
e.modalApi.setModalProps({ confirmLoading: !0 });
|
|
229
229
|
try {
|
|
230
|
-
if (r(m).useHttpCache && await
|
|
230
|
+
if (r(m).useHttpCache && await z(JSON.stringify(e.checkedModel)), d) return;
|
|
231
231
|
t.tableApi.setTableColumns(l), e.modalApi.closeModal(), y("set-columns", l);
|
|
232
232
|
} finally {
|
|
233
233
|
d || e.modalApi.setModalProps({ confirmLoading: !1 });
|
|
@@ -236,12 +236,12 @@ const nt = ["data-testid"], lt = ["data-testid"], Do = /* @__PURE__ */ Ee({
|
|
|
236
236
|
function N(e, o = !1) {
|
|
237
237
|
var f, Q, U;
|
|
238
238
|
const { notSetColumnField: a, columns: l } = r(m), F = ((((f = t.tableApi.getTableInstance()) == null ? void 0 : f.getTableColumn()) || {}).visibleColumn || []).map((p) => p.field).filter(Boolean), C = (S(l) || []).filter((p) => p.visible === !0 || p.visible === void 0).map((p) => p.field);
|
|
239
|
-
(Q =
|
|
239
|
+
(Q = R.value) == null || Q.openModal({
|
|
240
240
|
columns: (S(l) || []).filter((p) => p.visible !== !1),
|
|
241
241
|
displayFields: o ? C : F,
|
|
242
242
|
disabledColumnField: a || [],
|
|
243
243
|
isExport: e
|
|
244
|
-
}), (U =
|
|
244
|
+
}), (U = R.value) == null || U.setModalProps({ title: e ? "自定义导出" : "列设置" });
|
|
245
245
|
}
|
|
246
246
|
function H(e = !1) {
|
|
247
247
|
N(!1, e);
|
|
@@ -249,7 +249,7 @@ const nt = ["data-testid"], lt = ["data-testid"], Do = /* @__PURE__ */ Ee({
|
|
|
249
249
|
function W(e = !1) {
|
|
250
250
|
N(!0, e);
|
|
251
251
|
}
|
|
252
|
-
function
|
|
252
|
+
function Ee() {
|
|
253
253
|
const e = i.table;
|
|
254
254
|
if (!V() || !e) return;
|
|
255
255
|
const o = {};
|
|
@@ -258,7 +258,7 @@ const nt = ["data-testid"], lt = ["data-testid"], Do = /* @__PURE__ */ Ee({
|
|
|
258
258
|
}), o;
|
|
259
259
|
}
|
|
260
260
|
return tt(i, t.setState, ["tableFormApi", "table"]), h(
|
|
261
|
-
|
|
261
|
+
Ee,
|
|
262
262
|
(e) => {
|
|
263
263
|
e && t.setState({ table: e });
|
|
264
264
|
},
|
|
@@ -269,28 +269,28 @@ const nt = ["data-testid"], lt = ["data-testid"], Do = /* @__PURE__ */ Ee({
|
|
|
269
269
|
s == null || s.setState({ submitButtonOptions: { loading: e } });
|
|
270
270
|
},
|
|
271
271
|
{ immediate: (G = (q = t.store.state) == null ? void 0 : q.table) == null ? void 0 : G.immediate }
|
|
272
|
-
), h(
|
|
272
|
+
), h(_, (e) => s == null ? void 0 : s.setState(e)), h(m, (e) => {
|
|
273
273
|
var o;
|
|
274
274
|
return (o = t.tableApi) == null ? void 0 : o.setState(e);
|
|
275
275
|
}), ke(() => {
|
|
276
|
-
g && y("register", v, g.uid), t.mount(v, s), s == null || s.setState(r(
|
|
276
|
+
g && y("register", v, g.uid), t.mount(v, s), s == null || s.setState(r(_)), Y(() => {
|
|
277
277
|
d || ve();
|
|
278
|
-
}), window.addEventListener("resize",
|
|
278
|
+
}), window.addEventListener("resize", j);
|
|
279
279
|
}), X(() => {
|
|
280
|
-
d = !0,
|
|
280
|
+
d = !0, I(), t == null || t.unmount(), window.removeEventListener("resize", j);
|
|
281
281
|
}), ne({ ...v, instance: g }), (e, o) => (ee(), Z("div", {
|
|
282
|
-
class: D(r(
|
|
282
|
+
class: D(r(E)),
|
|
283
283
|
"data-testid": me.value
|
|
284
284
|
}, [
|
|
285
285
|
c.value.useSearchForm ? (ee(), Z("div", {
|
|
286
286
|
key: 0,
|
|
287
|
-
class: D(`${r(
|
|
287
|
+
class: D(`${r(E)}-header`),
|
|
288
288
|
"data-testid": pe.value
|
|
289
289
|
}, [
|
|
290
290
|
A(r(ye), {
|
|
291
291
|
"test-id": `${w.value}-search-form`
|
|
292
292
|
}, K({ _: 2 }, [
|
|
293
|
-
te(r(ue)(r(
|
|
293
|
+
te(r(ue)(r($)), (a) => ({
|
|
294
294
|
name: r(ce)(a),
|
|
295
295
|
fn: b((l) => [
|
|
296
296
|
n(e.$slots, a, oe(re(l || {})))
|
|
@@ -301,7 +301,7 @@ const nt = ["data-testid"], lt = ["data-testid"], Do = /* @__PURE__ */ Ee({
|
|
|
301
301
|
], 10, lt)) : Be("", !0),
|
|
302
302
|
Le("div", {
|
|
303
303
|
class: D({
|
|
304
|
-
[`${r(
|
|
304
|
+
[`${r(E)}-wrapper`]: !0,
|
|
305
305
|
"pt-(--tt-base-padding)!": !0,
|
|
306
306
|
"pb-(--tt-base-padding)!": !r(m).showPager
|
|
307
307
|
})
|
|
@@ -309,13 +309,12 @@ const nt = ["data-testid"], lt = ["data-testid"], Do = /* @__PURE__ */ Ee({
|
|
|
309
309
|
n(e.$slots, "table-top"),
|
|
310
310
|
A(rt, se({
|
|
311
311
|
...r(m),
|
|
312
|
-
...ge.value ? { data:
|
|
312
|
+
...ge.value ? { data: x.value } : {}
|
|
313
313
|
}, {
|
|
314
|
-
"table-row-id": e.tableRowId,
|
|
315
314
|
"form-api": r(s),
|
|
316
315
|
"table-api": r(t).tableApi
|
|
317
|
-
},
|
|
318
|
-
te(r(de)(r(
|
|
316
|
+
}, xe(Pe.value)), K({ _: 2 }, [
|
|
317
|
+
te(r(de)(r($)), (a) => ({
|
|
319
318
|
name: r(fe)(a),
|
|
320
319
|
fn: b((l) => [
|
|
321
320
|
n(e.$slots, a, oe(re(l || {})))
|
|
@@ -341,22 +340,22 @@ const nt = ["data-testid"], lt = ["data-testid"], Do = /* @__PURE__ */ Ee({
|
|
|
341
340
|
]),
|
|
342
341
|
key: "0"
|
|
343
342
|
} : void 0
|
|
344
|
-
]), 1040, ["
|
|
343
|
+
]), 1040, ["form-api", "table-api"]),
|
|
345
344
|
n(e.$slots, "table-bottom")
|
|
346
345
|
], 2),
|
|
347
346
|
A(Qe, {
|
|
348
347
|
ref_key: "columnModalRef",
|
|
349
|
-
ref:
|
|
348
|
+
ref: R,
|
|
350
349
|
"open-export": W,
|
|
351
350
|
"open-column": H,
|
|
352
|
-
onOnSubmit:
|
|
351
|
+
onOnSubmit: $e
|
|
353
352
|
}, K({
|
|
354
353
|
beforeFooter: b(() => [
|
|
355
354
|
n(e.$slots, "t-column-modal-before-footer")
|
|
356
355
|
]),
|
|
357
356
|
_: 2
|
|
358
357
|
}, [
|
|
359
|
-
r(
|
|
358
|
+
r($)["t-column-modal-title"] ? {
|
|
360
359
|
name: "title",
|
|
361
360
|
fn: b(() => [
|
|
362
361
|
n(e.$slots, "t-column-modal-title")
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import "axios";
|
|
2
2
|
import "element-plus";
|
|
3
3
|
import { isFunction as m } from "../../../../packages/utils/src/is.js";
|
|
4
|
-
import { computed as
|
|
4
|
+
import { computed as s, unref as i, toValue as a } from "vue";
|
|
5
5
|
import "dayjs";
|
|
6
6
|
import "numeral";
|
|
7
7
|
import "xe-utils";
|
|
@@ -12,12 +12,12 @@ import "../../../../node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/ae
|
|
|
12
12
|
import "../../../../node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/enc-utf8.js";
|
|
13
13
|
import "../../../../node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/mode-ecb.js";
|
|
14
14
|
import "../../../../node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/pad-pkcs7.js";
|
|
15
|
-
import { omit as
|
|
16
|
-
function
|
|
17
|
-
const f =
|
|
15
|
+
import { omit as u } from "lodash-es";
|
|
16
|
+
function k(n, p, h, l) {
|
|
17
|
+
const f = s(() => {
|
|
18
18
|
const { form: t } = i(n), o = {
|
|
19
19
|
...t == null ? void 0 : t.submitButtonOptions,
|
|
20
|
-
loading: i(
|
|
20
|
+
loading: i(h)
|
|
21
21
|
};
|
|
22
22
|
return {
|
|
23
23
|
...t,
|
|
@@ -25,44 +25,43 @@ function j(n, h, l, d) {
|
|
|
25
25
|
};
|
|
26
26
|
});
|
|
27
27
|
async function b(t) {
|
|
28
|
-
const o =
|
|
29
|
-
await
|
|
28
|
+
const o = l(), r = { currentPage: 1, pageSize: o == null ? void 0 : o.pageSize };
|
|
29
|
+
await p({ tablePage: r, searchInfo: t });
|
|
30
30
|
}
|
|
31
|
-
async function
|
|
32
|
-
const { handleSearchInfoFn: o, table: r } =
|
|
31
|
+
async function d(t) {
|
|
32
|
+
const { handleSearchInfoFn: o, table: r } = a(n);
|
|
33
33
|
let e = t;
|
|
34
34
|
return m(o) && (e = await o(e) || e), m(r == null ? void 0 : r.beforeFetch) && (e = await r.beforeFetch(e) || e), e;
|
|
35
35
|
}
|
|
36
|
-
const
|
|
37
|
-
const { columnsKey: t, showSetting: o, showSetColumn: r, showRefresh: e, showExport:
|
|
36
|
+
const c = s(() => {
|
|
37
|
+
const { columnsKey: t, showSetting: o, showSetColumn: r, showRefresh: e, showExport: F } = i(n).table || {}, { toolConfig: w } = i(n);
|
|
38
38
|
return {
|
|
39
39
|
columnsKey: t,
|
|
40
40
|
showSetting: o,
|
|
41
41
|
showRefresh: e,
|
|
42
42
|
showSetColumn: r,
|
|
43
|
-
showExport:
|
|
44
|
-
...
|
|
43
|
+
showExport: F,
|
|
44
|
+
...w
|
|
45
45
|
};
|
|
46
|
-
}), g =
|
|
47
|
-
const { table: t = {},
|
|
46
|
+
}), g = s(() => {
|
|
47
|
+
const { table: t = {}, useSearchForm: o, testId: r } = a(n), e = u(i(c), ["tableRowId"]);
|
|
48
48
|
return {
|
|
49
|
-
useSearchForm:
|
|
49
|
+
useSearchForm: o || !1,
|
|
50
50
|
// 数据由 TableForm 单独绑定,不进入表格配置。
|
|
51
|
-
...
|
|
52
|
-
...
|
|
53
|
-
tableRowId: (t == null ? void 0 : t.tableRowId) || o,
|
|
51
|
+
...u(t, ["data"]),
|
|
52
|
+
...e,
|
|
54
53
|
// 继承外层的 testId,如果 table.testId 未设置则使用外层的 testId
|
|
55
|
-
testId: (t == null ? void 0 : t.testId) ||
|
|
56
|
-
beforeFetch:
|
|
54
|
+
testId: (t == null ? void 0 : t.testId) || r,
|
|
55
|
+
beforeFetch: d
|
|
57
56
|
};
|
|
58
57
|
});
|
|
59
58
|
return {
|
|
60
59
|
getFormProps: f,
|
|
61
60
|
submitSearchQuery: b,
|
|
62
61
|
getTableProps: g,
|
|
63
|
-
getTableToolProps:
|
|
62
|
+
getTableToolProps: c
|
|
64
63
|
};
|
|
65
64
|
}
|
|
66
65
|
export {
|
|
67
|
-
|
|
66
|
+
k as useTableForm
|
|
68
67
|
};
|
|
@@ -509,11 +509,6 @@ export declare const tableFormProps: {
|
|
|
509
509
|
type: PropType<TtTableToolsProps>;
|
|
510
510
|
default: null;
|
|
511
511
|
};
|
|
512
|
-
/** 表格行id */
|
|
513
|
-
tableRowId: {
|
|
514
|
-
type: StringConstructor;
|
|
515
|
-
default: () => string | undefined;
|
|
516
|
-
};
|
|
517
512
|
/** 表格 testId,用于生成测试标识 */
|
|
518
513
|
testId: {
|
|
519
514
|
type: StringConstructor;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { propTypes as
|
|
1
|
+
import { propTypes as t } from "../../../packages/hooks/src/propTypes.js";
|
|
2
2
|
import "axios";
|
|
3
3
|
import "element-plus";
|
|
4
4
|
import "dayjs";
|
|
@@ -14,12 +14,11 @@ import "../../../node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/mode-
|
|
|
14
14
|
import "../../../node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/pad-pkcs7.js";
|
|
15
15
|
import "lodash-es";
|
|
16
16
|
import "vue-router";
|
|
17
|
-
import {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
return l()[t];
|
|
17
|
+
import { createSharedTableDefaults as o } from "./table-defaults.js";
|
|
18
|
+
function e(l) {
|
|
19
|
+
return o()[l];
|
|
21
20
|
}
|
|
22
|
-
const
|
|
21
|
+
const a = {
|
|
23
22
|
/** 是否显示分页 */
|
|
24
23
|
showPager: { type: Boolean, default: () => e("showPager") },
|
|
25
24
|
/** 当前页数 field */
|
|
@@ -30,7 +29,7 @@ const r = {
|
|
|
30
29
|
totalField: { type: String, default: () => e("totalField") },
|
|
31
30
|
/** 数据的 field */
|
|
32
31
|
dataField: { type: String, default: () => e("dataField") }
|
|
33
|
-
},
|
|
32
|
+
}, r = {
|
|
34
33
|
/** 是否显示复选框 */
|
|
35
34
|
showCheckbox: { type: Boolean, default: () => e("showCheckbox") },
|
|
36
35
|
/** 是否跨页保持复选框选中状态 */
|
|
@@ -83,7 +82,7 @@ const r = {
|
|
|
83
82
|
type: Function
|
|
84
83
|
// default: () => GlobalConfig.table?.customizeColumn,
|
|
85
84
|
}
|
|
86
|
-
},
|
|
85
|
+
}, p = {
|
|
87
86
|
/** api请求方法 */
|
|
88
87
|
api: {
|
|
89
88
|
type: Function,
|
|
@@ -116,7 +115,7 @@ const r = {
|
|
|
116
115
|
},
|
|
117
116
|
/** 是否滚动加载数据 */
|
|
118
117
|
isScrollFetch: { type: Boolean, default: () => e("isScrollFetch") }
|
|
119
|
-
},
|
|
118
|
+
}, n = {
|
|
120
119
|
/** 是否显示toolbar */
|
|
121
120
|
showToolbar: { type: Boolean, default: () => e("showToolbar") },
|
|
122
121
|
/** 具体某些列排序 field数组 */
|
|
@@ -142,14 +141,14 @@ const r = {
|
|
|
142
141
|
},
|
|
143
142
|
/** 是否显示表格上方 alert */
|
|
144
143
|
showTableAlert: { type: Boolean, default: () => e("showTableAlert") }
|
|
145
|
-
},
|
|
144
|
+
}, x = {
|
|
146
145
|
/**
|
|
147
146
|
* 是否自适应高度
|
|
148
147
|
*
|
|
149
148
|
* 组件方式默认 `true`,与 `table-api.ts` 的 `getDefaultState()` 里 hook 方式默认 `false` 有意不同,
|
|
150
149
|
* 不要统一:改任一边都会改变现有页面的表格高度。因此它不进 `createSharedTableDefaults()`。
|
|
151
150
|
*/
|
|
152
|
-
autoHeight:
|
|
151
|
+
autoHeight: t.bool.def(!0),
|
|
153
152
|
/** 左侧插槽的宽度 */
|
|
154
153
|
leftSlotWidth: { type: Number, default: () => e("leftSlotWidth") },
|
|
155
154
|
/** 右侧插槽的宽度 */
|
|
@@ -200,17 +199,17 @@ const r = {
|
|
|
200
199
|
type: Object
|
|
201
200
|
},
|
|
202
201
|
/** 是否使用搜索form */
|
|
203
|
-
useSearchForm:
|
|
202
|
+
useSearchForm: t.bool.def(!1),
|
|
204
203
|
/** 表格 testId,用于生成测试标识 */
|
|
205
204
|
testId: {
|
|
206
205
|
type: String,
|
|
207
206
|
default: void 0
|
|
208
207
|
},
|
|
208
|
+
...a,
|
|
209
209
|
...r,
|
|
210
210
|
...p,
|
|
211
|
-
...n
|
|
212
|
-
|
|
213
|
-
}, d = {
|
|
211
|
+
...n
|
|
212
|
+
}, i = {
|
|
214
213
|
/** 按键配置项 */
|
|
215
214
|
keyboardConfig: {
|
|
216
215
|
type: Object,
|
|
@@ -231,7 +230,7 @@ const r = {
|
|
|
231
230
|
type: Object,
|
|
232
231
|
default: () => e("radioConfig")
|
|
233
232
|
}
|
|
234
|
-
},
|
|
233
|
+
}, T = {
|
|
235
234
|
/**
|
|
236
235
|
* table参数
|
|
237
236
|
*
|
|
@@ -243,10 +242,10 @@ const r = {
|
|
|
243
242
|
*/
|
|
244
243
|
table: {
|
|
245
244
|
type: Object,
|
|
246
|
-
default: () => ({ ...
|
|
245
|
+
default: () => ({ ...o(), autoHeight: !0, columnsKey: "", useSearchForm: !1 })
|
|
247
246
|
},
|
|
248
247
|
/** 是否使用搜索form */
|
|
249
|
-
useSearchForm:
|
|
248
|
+
useSearchForm: t.bool.def(!0),
|
|
250
249
|
/** BasicFormProps 的配置 */
|
|
251
250
|
form: {
|
|
252
251
|
type: Object,
|
|
@@ -267,14 +266,6 @@ const r = {
|
|
|
267
266
|
type: Object,
|
|
268
267
|
default: null
|
|
269
268
|
},
|
|
270
|
-
/** 表格行id */
|
|
271
|
-
tableRowId: {
|
|
272
|
-
type: String,
|
|
273
|
-
default: () => {
|
|
274
|
-
var t;
|
|
275
|
-
return (t = a.table) == null ? void 0 : t.tableRowId;
|
|
276
|
-
}
|
|
277
|
-
},
|
|
278
269
|
/** 表格 testId,用于生成测试标识 */
|
|
279
270
|
testId: {
|
|
280
271
|
type: String,
|
|
@@ -284,7 +275,7 @@ const r = {
|
|
|
284
275
|
tableFormApi: {
|
|
285
276
|
type: Object
|
|
286
277
|
}
|
|
287
|
-
},
|
|
278
|
+
}, j = {
|
|
288
279
|
/** 列配置 */
|
|
289
280
|
columns: {
|
|
290
281
|
type: Array,
|
|
@@ -341,10 +332,10 @@ const r = {
|
|
|
341
332
|
type: String,
|
|
342
333
|
default: "right"
|
|
343
334
|
},
|
|
344
|
-
...
|
|
335
|
+
...i
|
|
345
336
|
};
|
|
346
337
|
export {
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
338
|
+
T as tableFormProps,
|
|
339
|
+
j as tableOtherProps,
|
|
340
|
+
x as tableProps
|
|
350
341
|
};
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var s = (r, t, e) =>
|
|
1
|
+
var l = Object.defineProperty;
|
|
2
|
+
var c = (r, t, e) => t in r ? l(r, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : r[t] = e;
|
|
3
|
+
var s = (r, t, e) => c(r, typeof t != "symbol" ? t + "" : t, e);
|
|
4
4
|
import "axios";
|
|
5
5
|
import "element-plus";
|
|
6
|
-
import { isFunction as
|
|
7
|
-
import { reactive as i, computed as
|
|
6
|
+
import { isFunction as u } from "../../../../packages/utils/src/is.js";
|
|
7
|
+
import { reactive as i, computed as b, toValue as f } from "vue";
|
|
8
8
|
import "dayjs";
|
|
9
9
|
import "numeral";
|
|
10
10
|
import { bindMethods as d } from "../../../../packages/utils/src/tool.js";
|
|
@@ -25,7 +25,7 @@ function g(r) {
|
|
|
25
25
|
e !== "data" && Object.assign(t, { [e]: r[e] });
|
|
26
26
|
}), t;
|
|
27
27
|
}
|
|
28
|
-
class
|
|
28
|
+
class z {
|
|
29
29
|
/**
|
|
30
30
|
* 构造函数,初始化 store、tableApi、状态等
|
|
31
31
|
* @param options 表单+表格配置项
|
|
@@ -48,15 +48,14 @@ class q {
|
|
|
48
48
|
/**
|
|
49
49
|
* 当前选中的行 key 数组(响应式)
|
|
50
50
|
*/
|
|
51
|
-
s(this, "selectedKeys",
|
|
51
|
+
s(this, "selectedKeys", b(() => f(this.tableApi.selectedKeys) ?? []));
|
|
52
52
|
const e = { ...t }, o = g(t.table);
|
|
53
53
|
o && (e.table = o);
|
|
54
|
-
const
|
|
54
|
+
const m = y();
|
|
55
55
|
this.store = new A(
|
|
56
56
|
a(e, {
|
|
57
57
|
useSearchForm: !0,
|
|
58
|
-
table:
|
|
59
|
-
tableRowId: p.tableRowId || "id"
|
|
58
|
+
table: m
|
|
60
59
|
}),
|
|
61
60
|
{
|
|
62
61
|
onUpdate: () => {
|
|
@@ -64,11 +63,11 @@ class q {
|
|
|
64
63
|
}
|
|
65
64
|
}
|
|
66
65
|
), this.state = this.store.state, this.stateHandler = new O();
|
|
67
|
-
const
|
|
66
|
+
const p = new j({
|
|
68
67
|
...this.state.table,
|
|
69
68
|
useSearchForm: this.state.useSearchForm || !1
|
|
70
|
-
}),
|
|
71
|
-
|
|
69
|
+
}), n = p;
|
|
70
|
+
n.useStore = (h) => S(p.store, h), Object.setPrototypeOf(this.tableApi, n), d(this);
|
|
72
71
|
}
|
|
73
72
|
/**
|
|
74
73
|
* 组件挂载时调用,注入表单和表格实例
|
|
@@ -84,7 +83,7 @@ class q {
|
|
|
84
83
|
* @param stateOrFn 新状态或返回新状态的函数
|
|
85
84
|
*/
|
|
86
85
|
setState(t) {
|
|
87
|
-
|
|
86
|
+
u(t) ? this.store.setState((e) => a(t(e), e)) : this.store.setState((e) => a(t, e));
|
|
88
87
|
}
|
|
89
88
|
/**
|
|
90
89
|
* 重新加载表格数据
|
|
@@ -141,5 +140,5 @@ class q {
|
|
|
141
140
|
}
|
|
142
141
|
}
|
|
143
142
|
export {
|
|
144
|
-
|
|
143
|
+
z as TableFormApi
|
|
145
144
|
};
|
|
@@ -1,35 +1,57 @@
|
|
|
1
|
-
import { isString as
|
|
2
|
-
import { unref as
|
|
3
|
-
import
|
|
4
|
-
function
|
|
1
|
+
import { isString as U, isNumber as j } from "lodash-es";
|
|
2
|
+
import { unref as X, watchEffect as k } from "vue";
|
|
3
|
+
import z from "./use-parse-translate.js";
|
|
4
|
+
function Y(e, n = "px") {
|
|
5
5
|
if (!e) return "";
|
|
6
|
-
if (S(e))
|
|
7
|
-
return e;
|
|
8
6
|
if (U(e))
|
|
9
|
-
return
|
|
7
|
+
return e;
|
|
8
|
+
if (j(e))
|
|
9
|
+
return `${e}${n}`;
|
|
10
|
+
}
|
|
11
|
+
function G(e) {
|
|
12
|
+
const n = e.closest(".el-overlay-dialog"), c = e.closest(".el-overlay"), s = n || c;
|
|
13
|
+
if (s)
|
|
14
|
+
return s.getBoundingClientRect();
|
|
15
|
+
const { clientWidth: o, clientHeight: t } = document.documentElement;
|
|
16
|
+
return {
|
|
17
|
+
left: 0,
|
|
18
|
+
top: 0,
|
|
19
|
+
right: o,
|
|
20
|
+
bottom: t,
|
|
21
|
+
width: o,
|
|
22
|
+
height: t,
|
|
23
|
+
x: 0,
|
|
24
|
+
y: 0,
|
|
25
|
+
toJSON() {
|
|
26
|
+
return {};
|
|
27
|
+
}
|
|
28
|
+
};
|
|
10
29
|
}
|
|
11
|
-
function
|
|
12
|
-
const t =
|
|
13
|
-
var
|
|
14
|
-
const
|
|
30
|
+
function V(e, n, c, s, o) {
|
|
31
|
+
const t = X(e), a = X(n), f = (h) => {
|
|
32
|
+
var w, x, y, E, M, R, N, D;
|
|
33
|
+
const B = h.clientX, C = h.clientY, { x: m, y: l } = z(t.style.transform), H = ((x = (w = o.value) == null ? void 0 : w.draggableLimit) == null ? void 0 : x[0]) ?? 50, S = ((E = (y = o.value) == null ? void 0 : y.draggableLimit) == null ? void 0 : E[1]) ?? 50, W = ((R = (M = o.value) == null ? void 0 : M.draggableLimit) == null ? void 0 : R[2]) ?? 50, _ = ((D = (N = o.value) == null ? void 0 : N.draggableLimit) == null ? void 0 : D[3]) ?? 50, i = t.getBoundingClientRect(), v = i.left, p = i.top, q = i.width, A = i.height, r = G(t), F = r.left - v - q + _ + m, J = r.right - v - S + m, u = r.top - p + H + l;
|
|
34
|
+
let g = r.bottom - p - A - W + l;
|
|
35
|
+
g < u && (g = u);
|
|
36
|
+
const L = (T) => {
|
|
15
37
|
requestAnimationFrame(() => {
|
|
16
|
-
const
|
|
17
|
-
t.style.transform = `translate(${
|
|
38
|
+
const O = Math.min(Math.max(m + T.clientX - B, F), J), P = Math.min(Math.max(l + T.clientY - C, u), g);
|
|
39
|
+
t.style.transform = `translate(${Y(O)}, ${Y(P)})`;
|
|
18
40
|
});
|
|
19
|
-
},
|
|
20
|
-
document.removeEventListener("mousemove",
|
|
41
|
+
}, b = () => {
|
|
42
|
+
document.removeEventListener("mousemove", L), document.removeEventListener("mouseup", b);
|
|
21
43
|
};
|
|
22
|
-
document.addEventListener("mousemove",
|
|
23
|
-
},
|
|
24
|
-
|
|
25
|
-
},
|
|
26
|
-
|
|
44
|
+
document.addEventListener("mousemove", L), document.addEventListener("mouseup", b);
|
|
45
|
+
}, $ = () => {
|
|
46
|
+
a && t && (t.className = `${t.className} is-draggable`, a.addEventListener("mousedown", f));
|
|
47
|
+
}, d = () => {
|
|
48
|
+
a && t && (t.className = t.className.replace("is-draggable", ""), a.removeEventListener("mousedown", f));
|
|
27
49
|
};
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
}),
|
|
50
|
+
k(() => {
|
|
51
|
+
c.value ? $() : d();
|
|
52
|
+
}), s.push(d);
|
|
31
53
|
}
|
|
32
54
|
export {
|
|
33
|
-
|
|
34
|
-
|
|
55
|
+
Y as addUnit,
|
|
56
|
+
V as default
|
|
35
57
|
};
|