@dazhicheng/ui 1.6.7 → 1.6.8
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-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 +36 -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/index.d.ts +7 -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
|
@@ -0,0 +1,227 @@
|
|
|
1
|
+
import { defineComponent as ae, mergeModels as L, useModel as ie, useSlots as se, getCurrentInstance as le, computed as s, watch as ce, onScopeDispose as ue, createElementBlock as de, openBlock as u, normalizeStyle as fe, createBlock as p, createCommentVNode as m, createVNode as $, unref as r, createSlots as B, withCtx as v, renderSlot as y } from "vue";
|
|
2
|
+
import "axios";
|
|
3
|
+
import "element-plus";
|
|
4
|
+
import { isNumber as d } from "../../../../packages/utils/src/is.js";
|
|
5
|
+
import "dayjs";
|
|
6
|
+
import "numeral";
|
|
7
|
+
import "xe-utils";
|
|
8
|
+
import "dayjs/plugin/utc";
|
|
9
|
+
import "dayjs/plugin/timezone";
|
|
10
|
+
import "../../../../node_modules/.pnpm/decimal.js@10.6.0/node_modules/decimal.js/decimal.js";
|
|
11
|
+
import "../../../../node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/aes.js";
|
|
12
|
+
import "../../../../node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/enc-utf8.js";
|
|
13
|
+
import "../../../../node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/mode-ecb.js";
|
|
14
|
+
import "../../../../node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/pad-pkcs7.js";
|
|
15
|
+
import "lodash-es";
|
|
16
|
+
import { createTtVTableError as f } from "../public/table-errors.js";
|
|
17
|
+
import { createVTableRuntime as he } from "../runtime/createVTableRuntime.js";
|
|
18
|
+
import ge from "./VTableEmpty.vue.js";
|
|
19
|
+
import pe from "./VTablePagination.vue.js";
|
|
20
|
+
import me from "./VTableSelectionAlert.vue.js";
|
|
21
|
+
import ve from "./VTableToolbar.vue.js";
|
|
22
|
+
import ye from "./VTableViewport.vue.js";
|
|
23
|
+
/* empty css */
|
|
24
|
+
const De = /* @__PURE__ */ ae({
|
|
25
|
+
name: "TtVTable",
|
|
26
|
+
inheritAttrs: !1,
|
|
27
|
+
__name: "TtVTable",
|
|
28
|
+
props: /* @__PURE__ */ L({
|
|
29
|
+
records: { default: void 0 },
|
|
30
|
+
fetchRecords: { type: Function, default: void 0 },
|
|
31
|
+
columns: {},
|
|
32
|
+
rowKey: {},
|
|
33
|
+
queryParams: { default: () => ({}) },
|
|
34
|
+
features: { default: () => ({}) },
|
|
35
|
+
mutationMode: { default: "copy-on-write" },
|
|
36
|
+
rendering: { default: () => ({}) },
|
|
37
|
+
nativeOptions: { default: void 0 },
|
|
38
|
+
nativeEvents: { default: void 0 },
|
|
39
|
+
width: { default: "100%" },
|
|
40
|
+
height: { default: 400 },
|
|
41
|
+
controller: { default: void 0 }
|
|
42
|
+
}, {
|
|
43
|
+
selectedRowKeys: { default: () => [] },
|
|
44
|
+
selectedRowKeysModifiers: {}
|
|
45
|
+
}),
|
|
46
|
+
emits: /* @__PURE__ */ L(["ready", "record-change", "fetch-success", "fetch-error", "page-change", "sort-change", "filter-change", "edit-commit", "edit-error", "tree-load-success", "tree-load-error", "column-preferences-change"], ["update:selectedRowKeys"]),
|
|
47
|
+
setup(w, { expose: M, emit: D }) {
|
|
48
|
+
var b;
|
|
49
|
+
const t = w, j = ie(w, "selectedRowKeys"), a = D, l = se(), h = le(), x = s(() => ({
|
|
50
|
+
width: d(t.width) ? `${t.width}px` : t.width,
|
|
51
|
+
height: d(t.height) ? `${t.height}px` : t.height
|
|
52
|
+
})), Q = s(() => {
|
|
53
|
+
var n;
|
|
54
|
+
const e = (n = t.features) == null ? void 0 : n.toolbar;
|
|
55
|
+
return e !== !1 && !!e;
|
|
56
|
+
}), U = s(() => {
|
|
57
|
+
var n;
|
|
58
|
+
const e = (n = t.features) == null ? void 0 : n.pagination;
|
|
59
|
+
return e !== !1 && !!e;
|
|
60
|
+
});
|
|
61
|
+
function Z() {
|
|
62
|
+
const e = (h == null ? void 0 : h.vnode.props) ?? {}, n = Object.hasOwn(e, "records"), c = Object.hasOwn(e, "fetchRecords") || Object.hasOwn(e, "fetch-records");
|
|
63
|
+
if (n && c)
|
|
64
|
+
throw f("TT_VTABLE_SOURCE_CONFLICT", "records 与 fetchRecords 不能同时传入。", {});
|
|
65
|
+
if (!t.rowKey)
|
|
66
|
+
throw f("TT_VTABLE_ROW_KEY_REQUIRED", "TtVTable 必须配置 rowKey。", {});
|
|
67
|
+
if (d(t.width) && t.width <= 0)
|
|
68
|
+
throw f("TT_VTABLE_CONTAINER_SIZE_INVALID", "表格 width 必须大于 0。", {
|
|
69
|
+
width: t.width
|
|
70
|
+
});
|
|
71
|
+
if (d(t.height) && t.height <= 0)
|
|
72
|
+
throw f("TT_VTABLE_CONTAINER_SIZE_INVALID", "表格 height 必须大于 0。", {
|
|
73
|
+
height: t.height
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
Z();
|
|
77
|
+
const i = he({
|
|
78
|
+
records: t.records,
|
|
79
|
+
getRecords: () => t.records,
|
|
80
|
+
getColumns: () => t.columns,
|
|
81
|
+
rowKey: t.rowKey,
|
|
82
|
+
selectedRowKeys: j,
|
|
83
|
+
getQueryParams: () => t.queryParams,
|
|
84
|
+
getFeatures: () => t.features,
|
|
85
|
+
getNativeEvents: () => t.nativeEvents,
|
|
86
|
+
fetchRecords: t.fetchRecords,
|
|
87
|
+
mutationMode: t.mutationMode,
|
|
88
|
+
onRecordChange: (e) => a("record-change", e),
|
|
89
|
+
onFetchSuccess: (e, n) => a("fetch-success", e, n),
|
|
90
|
+
onFetchError: (e, n) => a("fetch-error", e, n),
|
|
91
|
+
onPageChange: (e) => a("page-change", e),
|
|
92
|
+
onSortChange: (e) => a("sort-change", e),
|
|
93
|
+
onFilterChange: (e) => a("filter-change", e),
|
|
94
|
+
onEditCommit: (e) => a("edit-commit", e),
|
|
95
|
+
onEditError: (e) => a("edit-error", e),
|
|
96
|
+
onTreeLoadSuccess: (e) => a("tree-load-success", e),
|
|
97
|
+
onTreeLoadError: (e) => a("tree-load-error", e),
|
|
98
|
+
onColumnPreferencesChange: (e) => a("column-preferences-change", e)
|
|
99
|
+
}), o = i.tableApi;
|
|
100
|
+
(b = t.controller) == null || b.bind(o);
|
|
101
|
+
const W = l, Y = s(
|
|
102
|
+
() => o.records.count.value === 0 || o.query.isFetching.value && o.records.count.value === 0
|
|
103
|
+
), g = s(() => o.records.count.value === 0 ? o.query.error.value : void 0), G = s(
|
|
104
|
+
() => o.columns.columns.value.map((e) => ({
|
|
105
|
+
key: e.key,
|
|
106
|
+
title: e.title || e.key,
|
|
107
|
+
visible: e.visible !== !1
|
|
108
|
+
}))
|
|
109
|
+
);
|
|
110
|
+
function H(e) {
|
|
111
|
+
i.acceptNativeInstance(e), a("ready", o);
|
|
112
|
+
}
|
|
113
|
+
function J(e) {
|
|
114
|
+
i.clearNativeInstance(e);
|
|
115
|
+
}
|
|
116
|
+
function X(e, n) {
|
|
117
|
+
i.acceptViewportSize(e, n);
|
|
118
|
+
}
|
|
119
|
+
function ee(e) {
|
|
120
|
+
}
|
|
121
|
+
function te() {
|
|
122
|
+
o.query.refresh();
|
|
123
|
+
}
|
|
124
|
+
function oe(e, n) {
|
|
125
|
+
n ? o.columns.show(e) : o.columns.hide(e);
|
|
126
|
+
}
|
|
127
|
+
function re() {
|
|
128
|
+
o.columns.resetPreferences();
|
|
129
|
+
}
|
|
130
|
+
function ne() {
|
|
131
|
+
o.query.fetch();
|
|
132
|
+
}
|
|
133
|
+
return ce(
|
|
134
|
+
() => t.records,
|
|
135
|
+
(e) => i.acceptRecords(e ?? [])
|
|
136
|
+
), ue(() => {
|
|
137
|
+
var e;
|
|
138
|
+
(e = t.controller) == null || e.unbind(o), i.release();
|
|
139
|
+
}), M({ tableApi: o }), (e, n) => {
|
|
140
|
+
var c, R, C, _, T, E, S, V, k, O, P, A, z, N, I, K, q, F;
|
|
141
|
+
return u(), de("div", {
|
|
142
|
+
class: "tt-vtable",
|
|
143
|
+
style: fe(x.value)
|
|
144
|
+
}, [
|
|
145
|
+
Q.value ? (u(), p(ve, {
|
|
146
|
+
key: 0,
|
|
147
|
+
"show-refresh": ((c = t.features) == null ? void 0 : c.toolbar) !== !1 && ((C = (R = t.features) == null ? void 0 : R.toolbar) == null ? void 0 : C.refresh) !== !1,
|
|
148
|
+
"show-column-preferences": ((_ = t.features) == null ? void 0 : _.toolbar) !== !1 && !!((E = (T = t.features) == null ? void 0 : T.toolbar) != null && E.columns),
|
|
149
|
+
refreshing: r(o).query.isFetching.value,
|
|
150
|
+
columns: G.value,
|
|
151
|
+
onRefresh: te,
|
|
152
|
+
onColumnVisibilityChange: oe,
|
|
153
|
+
onResetColumns: re
|
|
154
|
+
}, B({ _: 2 }, [
|
|
155
|
+
r(l).toolbar ? {
|
|
156
|
+
name: "left",
|
|
157
|
+
fn: v(() => [
|
|
158
|
+
y(e.$slots, "toolbar", { tableApi: r(o) })
|
|
159
|
+
]),
|
|
160
|
+
key: "0"
|
|
161
|
+
} : void 0
|
|
162
|
+
]), 1032, ["show-refresh", "show-column-preferences", "refreshing", "columns"])) : m("", !0),
|
|
163
|
+
$(me, {
|
|
164
|
+
"selected-count": r(o).selection.keys.value.length,
|
|
165
|
+
"loaded-count": r(o).selection.loadedRows.value.length,
|
|
166
|
+
"missing-count": r(o).selection.missingKeys.value.length,
|
|
167
|
+
onClear: r(o).selection.clear
|
|
168
|
+
}, null, 8, ["selected-count", "loaded-count", "missing-count", "onClear"]),
|
|
169
|
+
$(ye, {
|
|
170
|
+
columns: r(i).renderColumns.value,
|
|
171
|
+
"table-api": r(o),
|
|
172
|
+
"renderer-slots": r(W),
|
|
173
|
+
"get-row-key": r(i).getRowKey,
|
|
174
|
+
"native-options": t.nativeOptions,
|
|
175
|
+
rendering: t.rendering,
|
|
176
|
+
width: "100%",
|
|
177
|
+
height: "auto",
|
|
178
|
+
onReady: H,
|
|
179
|
+
onRelease: J,
|
|
180
|
+
onResize: X,
|
|
181
|
+
onError: ee
|
|
182
|
+
}, null, 8, ["columns", "table-api", "renderer-slots", "get-row-key", "native-options", "rendering"]),
|
|
183
|
+
Y.value ? (u(), p(ge, {
|
|
184
|
+
key: 1,
|
|
185
|
+
loading: r(o).query.isFetching.value,
|
|
186
|
+
error: g.value,
|
|
187
|
+
onRetry: ne
|
|
188
|
+
}, B({ _: 2 }, [
|
|
189
|
+
r(l).empty ? {
|
|
190
|
+
name: "empty",
|
|
191
|
+
fn: v(() => [
|
|
192
|
+
y(e.$slots, "empty", { tableApi: r(o) })
|
|
193
|
+
]),
|
|
194
|
+
key: "0"
|
|
195
|
+
} : void 0,
|
|
196
|
+
r(l).error && g.value ? {
|
|
197
|
+
name: "error",
|
|
198
|
+
fn: v(() => [
|
|
199
|
+
y(e.$slots, "error", {
|
|
200
|
+
error: g.value,
|
|
201
|
+
tableApi: r(o),
|
|
202
|
+
retry: r(o).query.fetch
|
|
203
|
+
})
|
|
204
|
+
]),
|
|
205
|
+
key: "1"
|
|
206
|
+
} : void 0
|
|
207
|
+
]), 1032, ["loading", "error"])) : m("", !0),
|
|
208
|
+
U.value ? (u(), p(pe, {
|
|
209
|
+
key: 2,
|
|
210
|
+
page: r(o).pagination.page.value,
|
|
211
|
+
"page-size": r(o).pagination.pageSize.value,
|
|
212
|
+
total: r(o).pagination.total.value,
|
|
213
|
+
"page-sizes": ((S = t.features) == null ? void 0 : S.pagination) === !1 ? void 0 : [...((k = (V = t.features) == null ? void 0 : V.pagination) == null ? void 0 : k.pageSizes) ?? [20, 50, 100, 200]],
|
|
214
|
+
layout: ((O = t.features) == null ? void 0 : O.pagination) === !1 || (A = (P = t.features) == null ? void 0 : P.pagination) == null ? void 0 : A.layout,
|
|
215
|
+
background: ((z = t.features) == null ? void 0 : z.pagination) === !1 ? !1 : (I = (N = t.features) == null ? void 0 : N.pagination) == null ? void 0 : I.background,
|
|
216
|
+
"hide-on-single-page": ((K = t.features) == null ? void 0 : K.pagination) === !1 ? !1 : (F = (q = t.features) == null ? void 0 : q.pagination) == null ? void 0 : F.hideOnSinglePage,
|
|
217
|
+
disabled: r(o).query.isFetching.value,
|
|
218
|
+
onPageChange: r(o).pagination.setPage,
|
|
219
|
+
onPageSizeChange: r(o).pagination.setPageSize
|
|
220
|
+
}, null, 8, ["page", "page-size", "total", "page-sizes", "layout", "background", "hide-on-single-page", "disabled", "onPageChange", "onPageSizeChange"])) : m("", !0)
|
|
221
|
+
], 4);
|
|
222
|
+
};
|
|
223
|
+
}
|
|
224
|
+
});
|
|
225
|
+
export {
|
|
226
|
+
De as default
|
|
227
|
+
};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { TtFormProps } from '../../../tt-form';
|
|
2
|
+
import { TtVTableProps, TtVTableRowKey } from '../public';
|
|
3
|
+
import { TtVTableFormApi } from '../features/form-integration/useVTableForm';
|
|
4
|
+
/** 表单表格内部记录类型。 */
|
|
5
|
+
type VTableFormRow = Record<string, unknown>;
|
|
6
|
+
/** 表单查询值类型。 */
|
|
7
|
+
type VTableFormValues = Record<string, unknown>;
|
|
8
|
+
/** TtVTableForm 属性。 */
|
|
9
|
+
interface VTableFormComponentProps {
|
|
10
|
+
/** TtForm 配置。 */
|
|
11
|
+
form: TtFormProps<VTableFormValues>;
|
|
12
|
+
/** TtVTable 配置。 */
|
|
13
|
+
table: TtVTableProps<VTableFormRow, TtVTableRowKey, VTableFormValues>;
|
|
14
|
+
}
|
|
15
|
+
declare function __VLS_template(): any;
|
|
16
|
+
type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
|
|
17
|
+
declare const __VLS_component: import('vue').DefineComponent<VTableFormComponentProps, {
|
|
18
|
+
formTableApi: TtVTableFormApi<VTableFormRow, TtVTableRowKey>;
|
|
19
|
+
formApi: import('../../../tt-form/src/types').ExtendedFormApi;
|
|
20
|
+
tableApi: import('../public').TtVTableApi<VTableFormRow, TtVTableRowKey>;
|
|
21
|
+
}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
22
|
+
ready: (formTableApi: TtVTableFormApi<VTableFormRow, TtVTableRowKey>) => any;
|
|
23
|
+
}, string, import('vue').PublicProps, Readonly<VTableFormComponentProps> & Readonly<{
|
|
24
|
+
onReady?: ((formTableApi: TtVTableFormApi<VTableFormRow, TtVTableRowKey>) => any) | undefined;
|
|
25
|
+
}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
|
|
26
|
+
declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
|
|
27
|
+
export default _default;
|
|
28
|
+
type __VLS_WithTemplateSlots<T, S> = T & {
|
|
29
|
+
new (): {
|
|
30
|
+
$slots: S;
|
|
31
|
+
};
|
|
32
|
+
};
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import { defineComponent as x, useAttrs as N, useSlots as U, markRaw as W, shallowRef as u, computed as l, watch as p, createElementBlock as z, openBlock as E, createVNode as b, unref as d, createSlots as y, renderList as h, withCtx as R, renderSlot as w, normalizeProps as S, guardReactiveProps as v, mergeProps as L } from "vue";
|
|
2
|
+
import "axios";
|
|
3
|
+
import "element-plus";
|
|
4
|
+
import "dayjs";
|
|
5
|
+
import "numeral";
|
|
6
|
+
import "xe-utils";
|
|
7
|
+
import "dayjs/plugin/utc";
|
|
8
|
+
import "dayjs/plugin/timezone";
|
|
9
|
+
import "../../../../node_modules/.pnpm/decimal.js@10.6.0/node_modules/decimal.js/decimal.js";
|
|
10
|
+
import "../../../../node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/aes.js";
|
|
11
|
+
import "../../../../node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/enc-utf8.js";
|
|
12
|
+
import "../../../../node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/mode-ecb.js";
|
|
13
|
+
import "../../../../node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/pad-pkcs7.js";
|
|
14
|
+
import "lodash-es";
|
|
15
|
+
import "../../../tt-select/index.js";
|
|
16
|
+
import "../../../tt-checkbox/index.js";
|
|
17
|
+
import "../../../tt-radio-group/index.js";
|
|
18
|
+
import "../../../tt-panel-select/index.js";
|
|
19
|
+
import "../../../tt-upload/index.js";
|
|
20
|
+
import "../../../tt-api-component/index.js";
|
|
21
|
+
import "vee-validate";
|
|
22
|
+
import "../../../../utils/uppercaseInput.js";
|
|
23
|
+
import { useForm as D } from "../../../tt-form/src/useForm.js";
|
|
24
|
+
import "zod";
|
|
25
|
+
import "@vee-validate/zod";
|
|
26
|
+
import "@tanstack/vue-store";
|
|
27
|
+
import "es-toolkit/compat";
|
|
28
|
+
import "../../../tt-form/src/shared/zod-defaults.js";
|
|
29
|
+
import "../../../tt-nav-anchor/index.js";
|
|
30
|
+
import "../../../../node_modules/.pnpm/vue-types@5.1.3_vue@3.5.21_typescript@5.9.3_/node_modules/vue-types/shim/index.modern.js";
|
|
31
|
+
import "vue-router";
|
|
32
|
+
import "../../../tt-icon/index.js";
|
|
33
|
+
import "../../../tt-form/src/components/Slot.js";
|
|
34
|
+
import "../../../tt-form-item-error-tooltip/index.js";
|
|
35
|
+
import "@vueuse/core";
|
|
36
|
+
/* empty css */
|
|
37
|
+
import "../../../tt-form/src/form/RenderContent.vue.js";
|
|
38
|
+
import "../../../tt-form/src/form-render/FormFieldContact.js";
|
|
39
|
+
/* empty css */
|
|
40
|
+
/* empty css */
|
|
41
|
+
import { createVTableController as G } from "../runtime/createVTableController.js";
|
|
42
|
+
import H from "./TtVTable.vue.js";
|
|
43
|
+
const I = { class: "tt-vtable-form" }, jt = /* @__PURE__ */ x({
|
|
44
|
+
name: "TtVTableForm",
|
|
45
|
+
inheritAttrs: !1,
|
|
46
|
+
__name: "TtVTableForm",
|
|
47
|
+
props: {
|
|
48
|
+
form: {},
|
|
49
|
+
table: {}
|
|
50
|
+
},
|
|
51
|
+
emits: ["ready"],
|
|
52
|
+
setup(_, { expose: A, emit: g }) {
|
|
53
|
+
const o = _, F = g, P = N(), c = U(), m = W(G()), a = u({ ...o.table.queryParams ?? {} }), i = u([...o.table.selectedRowKeys ?? []]), T = {
|
|
54
|
+
...o.form,
|
|
55
|
+
handleSubmit: V,
|
|
56
|
+
handleReset: B
|
|
57
|
+
}, [K, s] = D(T), k = l(() => ({
|
|
58
|
+
...o.table,
|
|
59
|
+
queryParams: a.value,
|
|
60
|
+
selectedRowKeys: i.value,
|
|
61
|
+
controller: m
|
|
62
|
+
})), q = l(() => Object.keys(c).filter((t) => t.startsWith("form-"))), C = l(() => Object.keys(c).filter((t) => !t.startsWith("form-"))), f = {
|
|
63
|
+
form: s,
|
|
64
|
+
table: m.tableApi
|
|
65
|
+
};
|
|
66
|
+
async function V(t) {
|
|
67
|
+
var r, e;
|
|
68
|
+
await ((e = (r = o.form).handleSubmit) == null ? void 0 : e.call(r, t)), a.value = { ...t }, m.tableApi.pagination.reset();
|
|
69
|
+
}
|
|
70
|
+
async function B(t) {
|
|
71
|
+
var r, e;
|
|
72
|
+
await ((e = (r = o.form).handleReset) == null ? void 0 : e.call(r, t)), a.value = { ...t }, m.tableApi.pagination.reset();
|
|
73
|
+
}
|
|
74
|
+
function O(t) {
|
|
75
|
+
return t.slice(5);
|
|
76
|
+
}
|
|
77
|
+
function $() {
|
|
78
|
+
F("ready", f);
|
|
79
|
+
}
|
|
80
|
+
function j(t) {
|
|
81
|
+
i.value = [...t];
|
|
82
|
+
}
|
|
83
|
+
return p(
|
|
84
|
+
() => o.table.queryParams,
|
|
85
|
+
(t) => {
|
|
86
|
+
a.value = { ...t ?? {} };
|
|
87
|
+
}
|
|
88
|
+
), p(
|
|
89
|
+
() => o.form,
|
|
90
|
+
(t) => s.setState(t)
|
|
91
|
+
), p(
|
|
92
|
+
() => o.table.selectedRowKeys,
|
|
93
|
+
(t) => {
|
|
94
|
+
i.value = [...t ?? []];
|
|
95
|
+
}
|
|
96
|
+
), A({ formTableApi: f, formApi: s, tableApi: m.tableApi }), (t, r) => (E(), z("div", I, [
|
|
97
|
+
b(d(K), null, y({ _: 2 }, [
|
|
98
|
+
h(q.value, (e) => ({
|
|
99
|
+
name: O(e),
|
|
100
|
+
fn: R((n) => [
|
|
101
|
+
w(t.$slots, e, S(v(n || {})))
|
|
102
|
+
])
|
|
103
|
+
}))
|
|
104
|
+
]), 1024),
|
|
105
|
+
b(H, L({ ...k.value, ...d(P) }, {
|
|
106
|
+
onReady: $,
|
|
107
|
+
"onUpdate:selectedRowKeys": j
|
|
108
|
+
}), y({ _: 2 }, [
|
|
109
|
+
h(C.value, (e) => ({
|
|
110
|
+
name: e,
|
|
111
|
+
fn: R((n) => [
|
|
112
|
+
w(t.$slots, e, S(v(n || {})))
|
|
113
|
+
])
|
|
114
|
+
}))
|
|
115
|
+
]), 1040)
|
|
116
|
+
]));
|
|
117
|
+
}
|
|
118
|
+
});
|
|
119
|
+
export {
|
|
120
|
+
jt as default
|
|
121
|
+
};
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { VNodeChild } from 'vue';
|
|
2
|
+
/** VTable 状态层属性。 */
|
|
3
|
+
interface VTableEmptyProps {
|
|
4
|
+
/** 是否显示加载状态。 */
|
|
5
|
+
loading?: boolean;
|
|
6
|
+
/** 加载提示。 */
|
|
7
|
+
loadingText?: string;
|
|
8
|
+
/** 空状态提示。 */
|
|
9
|
+
emptyText?: string;
|
|
10
|
+
/** 首次加载错误。 */
|
|
11
|
+
error?: Error | string;
|
|
12
|
+
/** 错误状态标题。 */
|
|
13
|
+
errorTitle?: string;
|
|
14
|
+
}
|
|
15
|
+
declare function __VLS_template(): {
|
|
16
|
+
attrs: Partial<{}>;
|
|
17
|
+
slots: Readonly<{
|
|
18
|
+
/** 自定义加载状态。 */
|
|
19
|
+
loading?: (scope: {
|
|
20
|
+
text: string;
|
|
21
|
+
}) => VNodeChild;
|
|
22
|
+
/** 自定义空状态。 */
|
|
23
|
+
empty?: (scope: {
|
|
24
|
+
text: string;
|
|
25
|
+
}) => VNodeChild;
|
|
26
|
+
/** 自定义错误状态。 */
|
|
27
|
+
error?: (scope: {
|
|
28
|
+
error: Error | string;
|
|
29
|
+
}) => VNodeChild;
|
|
30
|
+
}> & {
|
|
31
|
+
/** 自定义加载状态。 */
|
|
32
|
+
loading?: (scope: {
|
|
33
|
+
text: string;
|
|
34
|
+
}) => VNodeChild;
|
|
35
|
+
/** 自定义空状态。 */
|
|
36
|
+
empty?: (scope: {
|
|
37
|
+
text: string;
|
|
38
|
+
}) => VNodeChild;
|
|
39
|
+
/** 自定义错误状态。 */
|
|
40
|
+
error?: (scope: {
|
|
41
|
+
error: Error | string;
|
|
42
|
+
}) => VNodeChild;
|
|
43
|
+
};
|
|
44
|
+
refs: {};
|
|
45
|
+
rootEl: any;
|
|
46
|
+
};
|
|
47
|
+
type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
|
|
48
|
+
declare const __VLS_component: import('vue').DefineComponent<VTableEmptyProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
49
|
+
retry: () => any;
|
|
50
|
+
}, string, import('vue').PublicProps, Readonly<VTableEmptyProps> & Readonly<{
|
|
51
|
+
onRetry?: (() => any) | undefined;
|
|
52
|
+
}>, {
|
|
53
|
+
loading: boolean;
|
|
54
|
+
loadingText: string;
|
|
55
|
+
emptyText: string;
|
|
56
|
+
errorTitle: string;
|
|
57
|
+
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
|
|
58
|
+
declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
|
|
59
|
+
export default _default;
|
|
60
|
+
type __VLS_WithTemplateSlots<T, S> = T & {
|
|
61
|
+
new (): {
|
|
62
|
+
$slots: S;
|
|
63
|
+
};
|
|
64
|
+
};
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import { defineComponent as g, computed as y, createElementBlock as s, openBlock as a, renderSlot as l, createVNode as e, createElementVNode as o, unref as r, toDisplayString as n, withCtx as v } from "vue";
|
|
2
|
+
import { TtButton as T } from "../../../tt-button/index.js";
|
|
3
|
+
import { TtEmpty as b } from "../../../tt-empty/index.js";
|
|
4
|
+
import { TtIcon as m } from "../../../tt-icon/index.js";
|
|
5
|
+
import "axios";
|
|
6
|
+
import "element-plus";
|
|
7
|
+
import { isString as x, isError as h } from "../../../../packages/utils/src/is.js";
|
|
8
|
+
import "dayjs";
|
|
9
|
+
import "numeral";
|
|
10
|
+
import "xe-utils";
|
|
11
|
+
import "dayjs/plugin/utc";
|
|
12
|
+
import "dayjs/plugin/timezone";
|
|
13
|
+
import "../../../../node_modules/.pnpm/decimal.js@10.6.0/node_modules/decimal.js/decimal.js";
|
|
14
|
+
import "../../../../node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/aes.js";
|
|
15
|
+
import "../../../../node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/enc-utf8.js";
|
|
16
|
+
import "../../../../node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/mode-ecb.js";
|
|
17
|
+
import "../../../../node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/pad-pkcs7.js";
|
|
18
|
+
import "lodash-es";
|
|
19
|
+
const E = {
|
|
20
|
+
key: 0,
|
|
21
|
+
class: "tt-vtable-state",
|
|
22
|
+
role: "status",
|
|
23
|
+
"aria-live": "polite"
|
|
24
|
+
}, k = { class: "tt-vtable-state__message" }, B = {
|
|
25
|
+
key: 1,
|
|
26
|
+
class: "tt-vtable-state",
|
|
27
|
+
role: "alert"
|
|
28
|
+
}, S = { class: "tt-vtable-state__title" }, V = { class: "tt-vtable-state__message" }, z = {
|
|
29
|
+
key: 2,
|
|
30
|
+
class: "tt-vtable-state",
|
|
31
|
+
role: "status"
|
|
32
|
+
}, P = /* @__PURE__ */ g({
|
|
33
|
+
name: "VTableEmpty",
|
|
34
|
+
__name: "VTableEmpty",
|
|
35
|
+
props: {
|
|
36
|
+
loading: { type: Boolean, default: !1 },
|
|
37
|
+
loadingText: { default: "正在加载" },
|
|
38
|
+
emptyText: { default: "暂无数据" },
|
|
39
|
+
error: {},
|
|
40
|
+
errorTitle: { default: "数据加载失败" }
|
|
41
|
+
},
|
|
42
|
+
emits: ["retry"],
|
|
43
|
+
setup(c, { emit: d }) {
|
|
44
|
+
const t = c, u = d, _ = y(() => x(t.error) ? t.error : h(t.error) ? String(t.error).replace(/^Error:\s*/, "") : "请稍后重试");
|
|
45
|
+
function f() {
|
|
46
|
+
u("retry");
|
|
47
|
+
}
|
|
48
|
+
return (i, p) => t.loading ? (a(), s("div", E, [
|
|
49
|
+
l(i.$slots, "loading", {
|
|
50
|
+
text: t.loadingText
|
|
51
|
+
}, () => [
|
|
52
|
+
e(r(m), {
|
|
53
|
+
class: "tt-vtable-state__loading-icon",
|
|
54
|
+
icon: "mdi:loading",
|
|
55
|
+
size: 24
|
|
56
|
+
}),
|
|
57
|
+
o("span", k, n(t.loadingText), 1)
|
|
58
|
+
])
|
|
59
|
+
])) : t.error ? (a(), s("div", B, [
|
|
60
|
+
l(i.$slots, "error", {
|
|
61
|
+
error: t.error
|
|
62
|
+
}, () => [
|
|
63
|
+
e(r(m), {
|
|
64
|
+
icon: "mdi:alert-circle-outline",
|
|
65
|
+
size: 32,
|
|
66
|
+
color: "var(--el-color-danger)"
|
|
67
|
+
}),
|
|
68
|
+
o("strong", S, n(t.errorTitle), 1),
|
|
69
|
+
o("span", V, n(_.value), 1),
|
|
70
|
+
e(r(T), {
|
|
71
|
+
type: "primary",
|
|
72
|
+
plain: "",
|
|
73
|
+
"aria-label": "重新加载表格",
|
|
74
|
+
onClick: f
|
|
75
|
+
}, {
|
|
76
|
+
default: v(() => [
|
|
77
|
+
e(r(m), { icon: "mdi:refresh" }),
|
|
78
|
+
p[0] || (p[0] = o("span", null, "重试", -1))
|
|
79
|
+
]),
|
|
80
|
+
_: 1
|
|
81
|
+
})
|
|
82
|
+
])
|
|
83
|
+
])) : (a(), s("div", z, [
|
|
84
|
+
l(i.$slots, "empty", {
|
|
85
|
+
text: t.emptyText
|
|
86
|
+
}, () => [
|
|
87
|
+
e(r(b), {
|
|
88
|
+
description: t.emptyText,
|
|
89
|
+
"image-size": 88
|
|
90
|
+
}, null, 8, ["description"])
|
|
91
|
+
])
|
|
92
|
+
]));
|
|
93
|
+
}
|
|
94
|
+
});
|
|
95
|
+
export {
|
|
96
|
+
P as default
|
|
97
|
+
};
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { VNodeChild } from 'vue';
|
|
2
|
+
/** VTable 分页组件属性。 */
|
|
3
|
+
interface VTablePaginationProps {
|
|
4
|
+
/** 当前从 1 开始的页码。 */
|
|
5
|
+
page: number;
|
|
6
|
+
/** 当前每页记录数。 */
|
|
7
|
+
pageSize: number;
|
|
8
|
+
/** 当前记录总数。 */
|
|
9
|
+
total: number;
|
|
10
|
+
/** 可选每页数量。 */
|
|
11
|
+
pageSizes?: number[];
|
|
12
|
+
/** Element Plus 分页布局。 */
|
|
13
|
+
layout?: string;
|
|
14
|
+
/** 是否禁用分页交互。 */
|
|
15
|
+
disabled?: boolean;
|
|
16
|
+
/** 是否使用背景按钮样式。 */
|
|
17
|
+
background?: boolean;
|
|
18
|
+
/** 单页时是否隐藏分页。 */
|
|
19
|
+
hideOnSinglePage?: boolean;
|
|
20
|
+
}
|
|
21
|
+
declare function __VLS_template(): {
|
|
22
|
+
attrs: Partial<{}>;
|
|
23
|
+
slots: Readonly<{
|
|
24
|
+
/** 分页区域前置内容。 */
|
|
25
|
+
prefix?: () => VNodeChild;
|
|
26
|
+
}> & {
|
|
27
|
+
/** 分页区域前置内容。 */
|
|
28
|
+
prefix?: () => VNodeChild;
|
|
29
|
+
};
|
|
30
|
+
refs: {};
|
|
31
|
+
rootEl: HTMLDivElement;
|
|
32
|
+
};
|
|
33
|
+
type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
|
|
34
|
+
declare const __VLS_component: import('vue').DefineComponent<VTablePaginationProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
35
|
+
"page-change": (page: number) => any;
|
|
36
|
+
"page-size-change": (pageSize: number) => any;
|
|
37
|
+
}, string, import('vue').PublicProps, Readonly<VTablePaginationProps> & Readonly<{
|
|
38
|
+
"onPage-change"?: ((page: number) => any) | undefined;
|
|
39
|
+
"onPage-size-change"?: ((pageSize: number) => any) | undefined;
|
|
40
|
+
}>, {
|
|
41
|
+
disabled: boolean;
|
|
42
|
+
pageSizes: number[];
|
|
43
|
+
background: boolean;
|
|
44
|
+
layout: string;
|
|
45
|
+
hideOnSinglePage: boolean;
|
|
46
|
+
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, HTMLDivElement>;
|
|
47
|
+
declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
|
|
48
|
+
export default _default;
|
|
49
|
+
type __VLS_WithTemplateSlots<T, S> = T & {
|
|
50
|
+
new (): {
|
|
51
|
+
$slots: S;
|
|
52
|
+
};
|
|
53
|
+
};
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { defineComponent as s, createElementBlock as n, openBlock as o, createCommentVNode as r, createVNode as d, renderSlot as c, unref as u } from "vue";
|
|
2
|
+
import { ElPagination as f } from "element-plus";
|
|
3
|
+
const m = {
|
|
4
|
+
class: "tt-vtable-pagination",
|
|
5
|
+
"aria-label": "表格分页"
|
|
6
|
+
}, b = {
|
|
7
|
+
key: 0,
|
|
8
|
+
class: "tt-vtable-pagination__prefix"
|
|
9
|
+
}, S = /* @__PURE__ */ s({
|
|
10
|
+
name: "VTablePagination",
|
|
11
|
+
__name: "VTablePagination",
|
|
12
|
+
props: {
|
|
13
|
+
page: {},
|
|
14
|
+
pageSize: {},
|
|
15
|
+
total: {},
|
|
16
|
+
pageSizes: { default: () => [20, 50, 100, 200] },
|
|
17
|
+
layout: { default: "total, sizes, prev, pager, next, jumper" },
|
|
18
|
+
disabled: { type: Boolean, default: !1 },
|
|
19
|
+
background: { type: Boolean, default: !1 },
|
|
20
|
+
hideOnSinglePage: { type: Boolean, default: !1 }
|
|
21
|
+
},
|
|
22
|
+
emits: ["page-change", "page-size-change"],
|
|
23
|
+
setup(i, { emit: l }) {
|
|
24
|
+
const e = i, t = l;
|
|
25
|
+
function g(a) {
|
|
26
|
+
t("page-change", a);
|
|
27
|
+
}
|
|
28
|
+
function p(a) {
|
|
29
|
+
t("page-size-change", a);
|
|
30
|
+
}
|
|
31
|
+
return (a, h) => (o(), n("div", m, [
|
|
32
|
+
a.$slots.prefix ? (o(), n("div", b, [
|
|
33
|
+
c(a.$slots, "prefix")
|
|
34
|
+
])) : r("", !0),
|
|
35
|
+
d(u(f), {
|
|
36
|
+
background: e.background,
|
|
37
|
+
"current-page": e.page,
|
|
38
|
+
disabled: e.disabled,
|
|
39
|
+
"hide-on-single-page": e.hideOnSinglePage,
|
|
40
|
+
layout: e.layout,
|
|
41
|
+
"page-size": e.pageSize,
|
|
42
|
+
"page-sizes": e.pageSizes,
|
|
43
|
+
total: e.total,
|
|
44
|
+
"onUpdate:currentPage": g,
|
|
45
|
+
"onUpdate:pageSize": p
|
|
46
|
+
}, null, 8, ["background", "current-page", "disabled", "hide-on-single-page", "layout", "page-size", "page-sizes", "total"])
|
|
47
|
+
]));
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
export {
|
|
51
|
+
S as default
|
|
52
|
+
};
|