@dazhicheng/ui 1.6.6 → 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-area/TtArea.vue.js +1 -1
- package/dist/components/tt-drawer/src/components/DrawerHeader.vue.js +2 -2
- 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-icon/index.vue.js +2 -2
- package/dist/components/tt-loading/src/loading.vue.js +2 -2
- package/dist/components/tt-modal/src/utils/resolve-modal-target.js +1 -3
- package/dist/components/tt-panel-select/src/components/PanelMiddle.vue.d.ts +2 -2
- 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.d.ts +0 -9
- package/dist/components/tt-table/src/TableForm.vue.js +175 -167
- 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/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/table.d.ts +2 -1
- package/dist/components/tt-table/src/types/tableForm.d.ts +0 -2
- 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-table/src/utils/table-form-api.js +14 -15
- 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,126 @@
|
|
|
1
|
+
import { defineComponent as k, createElementBlock as d, openBlock as n, createElementVNode as o, renderSlot as f, createBlock as p, createCommentVNode as b, unref as t, withCtx as l, createVNode as r, Fragment as x, renderList as w, normalizeStyle as B, createTextVNode as T, toDisplayString as V } from "vue";
|
|
2
|
+
import { TtButton as u } from "../../../tt-button/index.js";
|
|
3
|
+
import { TtIcon as c } from "../../../tt-icon/index.js";
|
|
4
|
+
import "axios";
|
|
5
|
+
import { ElPopover as E, ElScrollbar as N, ElCheckbox as R } from "element-plus";
|
|
6
|
+
import { isBoolean as S } from "../../../../packages/utils/src/is.js";
|
|
7
|
+
import "dayjs";
|
|
8
|
+
import "numeral";
|
|
9
|
+
import "xe-utils";
|
|
10
|
+
import "dayjs/plugin/utc";
|
|
11
|
+
import "dayjs/plugin/timezone";
|
|
12
|
+
import "../../../../node_modules/.pnpm/decimal.js@10.6.0/node_modules/decimal.js/decimal.js";
|
|
13
|
+
import "../../../../node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/aes.js";
|
|
14
|
+
import "../../../../node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/enc-utf8.js";
|
|
15
|
+
import "../../../../node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/mode-ecb.js";
|
|
16
|
+
import "../../../../node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/pad-pkcs7.js";
|
|
17
|
+
import "lodash-es";
|
|
18
|
+
const P = {
|
|
19
|
+
class: "tt-vtable-toolbar",
|
|
20
|
+
role: "toolbar",
|
|
21
|
+
"aria-label": "表格工具栏"
|
|
22
|
+
}, $ = { class: "tt-vtable-toolbar__section tt-vtable-toolbar__section--left" }, L = { class: "tt-vtable-toolbar__section tt-vtable-toolbar__section--right" }, z = { class: "tt-vtable-column-menu" }, D = { class: "tt-vtable-column-menu__footer" }, ee = /* @__PURE__ */ k({
|
|
23
|
+
name: "VTableToolbar",
|
|
24
|
+
__name: "VTableToolbar",
|
|
25
|
+
props: {
|
|
26
|
+
showRefresh: { type: Boolean, default: !0 },
|
|
27
|
+
showColumnPreferences: { type: Boolean, default: !1 },
|
|
28
|
+
refreshing: { type: Boolean, default: !1 },
|
|
29
|
+
columns: { default: () => [] }
|
|
30
|
+
},
|
|
31
|
+
emits: ["refresh", "column-visibility-change", "reset-columns"],
|
|
32
|
+
setup(_, { emit: h }) {
|
|
33
|
+
const a = _, m = h;
|
|
34
|
+
function v() {
|
|
35
|
+
m("refresh");
|
|
36
|
+
}
|
|
37
|
+
function g(s, e) {
|
|
38
|
+
S(e) && m("column-visibility-change", s, e);
|
|
39
|
+
}
|
|
40
|
+
function y() {
|
|
41
|
+
m("reset-columns");
|
|
42
|
+
}
|
|
43
|
+
return (s, e) => (n(), d("div", P, [
|
|
44
|
+
o("div", $, [
|
|
45
|
+
f(s.$slots, "left")
|
|
46
|
+
]),
|
|
47
|
+
o("div", L, [
|
|
48
|
+
f(s.$slots, "right"),
|
|
49
|
+
a.showRefresh ? (n(), p(t(u), {
|
|
50
|
+
key: 0,
|
|
51
|
+
text: "",
|
|
52
|
+
loading: a.refreshing,
|
|
53
|
+
"aria-label": "刷新表格",
|
|
54
|
+
onClick: v
|
|
55
|
+
}, {
|
|
56
|
+
default: l(() => [
|
|
57
|
+
r(t(c), { icon: "mdi:refresh" }),
|
|
58
|
+
e[0] || (e[0] = o("span", null, "刷新", -1))
|
|
59
|
+
]),
|
|
60
|
+
_: 1
|
|
61
|
+
}, 8, ["loading"])) : b("", !0),
|
|
62
|
+
a.showColumnPreferences ? (n(), p(t(E), {
|
|
63
|
+
key: 1,
|
|
64
|
+
placement: "bottom-end",
|
|
65
|
+
width: 280,
|
|
66
|
+
trigger: "click"
|
|
67
|
+
}, {
|
|
68
|
+
reference: l(() => [
|
|
69
|
+
r(t(u), {
|
|
70
|
+
text: "",
|
|
71
|
+
"aria-label": "打开列设置"
|
|
72
|
+
}, {
|
|
73
|
+
default: l(() => [
|
|
74
|
+
r(t(c), { icon: "mdi:view-column-outline" }),
|
|
75
|
+
e[1] || (e[1] = o("span", null, "列设置", -1))
|
|
76
|
+
]),
|
|
77
|
+
_: 1
|
|
78
|
+
})
|
|
79
|
+
]),
|
|
80
|
+
default: l(() => [
|
|
81
|
+
o("div", z, [
|
|
82
|
+
r(t(N), { "max-height": "320px" }, {
|
|
83
|
+
default: l(() => [
|
|
84
|
+
(n(!0), d(x, null, w(a.columns, (i) => (n(), d("div", {
|
|
85
|
+
key: i.key,
|
|
86
|
+
class: "tt-vtable-column-menu__row",
|
|
87
|
+
style: B({ paddingLeft: `${12 + (i.depth ?? 0) * 16}px` })
|
|
88
|
+
}, [
|
|
89
|
+
r(t(R), {
|
|
90
|
+
disabled: i.disabled,
|
|
91
|
+
"model-value": i.visible,
|
|
92
|
+
onChange: (C) => g(i.key, C)
|
|
93
|
+
}, {
|
|
94
|
+
default: l(() => [
|
|
95
|
+
T(V(i.title), 1)
|
|
96
|
+
]),
|
|
97
|
+
_: 2
|
|
98
|
+
}, 1032, ["disabled", "model-value", "onChange"])
|
|
99
|
+
], 4))), 128))
|
|
100
|
+
]),
|
|
101
|
+
_: 1
|
|
102
|
+
}),
|
|
103
|
+
o("div", D, [
|
|
104
|
+
r(t(u), {
|
|
105
|
+
text: "",
|
|
106
|
+
"aria-label": "恢复默认列设置",
|
|
107
|
+
onClick: y
|
|
108
|
+
}, {
|
|
109
|
+
default: l(() => [
|
|
110
|
+
r(t(c), { icon: "mdi:restore" }),
|
|
111
|
+
e[2] || (e[2] = o("span", null, "恢复默认", -1))
|
|
112
|
+
]),
|
|
113
|
+
_: 1
|
|
114
|
+
})
|
|
115
|
+
])
|
|
116
|
+
])
|
|
117
|
+
]),
|
|
118
|
+
_: 1
|
|
119
|
+
})) : b("", !0)
|
|
120
|
+
])
|
|
121
|
+
]));
|
|
122
|
+
}
|
|
123
|
+
});
|
|
124
|
+
export {
|
|
125
|
+
ee as default
|
|
126
|
+
};
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
import { defineComponent as F, getCurrentInstance as I, shallowRef as l, computed as B, watch as f, nextTick as b, onMounted as k, onBeforeUnmount as L, createElementBlock as K, openBlock as y, normalizeStyle as D, createBlock as M, createCommentVNode as U, unref as Z } from "vue";
|
|
2
|
+
import "axios";
|
|
3
|
+
import "element-plus";
|
|
4
|
+
import { isNumber as m, isClient as $, isError as q } 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 { ListTable as H } from "@visactor/vue-vtable";
|
|
17
|
+
import "../engine/visactor/createVueCellLayout.js";
|
|
18
|
+
import { createTtVTableError as T } from "../public/table-errors.js";
|
|
19
|
+
import { toFrozenColumnOrder as W, toColumnDefinitions as j, getFrozenColumnCounts as G } from "../engine/visactor/toColumnDefinitions.js";
|
|
20
|
+
import { toListTableOptions as J } from "../engine/visactor/toListTableOptions.js";
|
|
21
|
+
const ve = /* @__PURE__ */ F({
|
|
22
|
+
name: "VTableViewport",
|
|
23
|
+
__name: "VTableViewport",
|
|
24
|
+
props: {
|
|
25
|
+
columns: {},
|
|
26
|
+
tableApi: {},
|
|
27
|
+
rendererSlots: {},
|
|
28
|
+
getRowKey: {},
|
|
29
|
+
nativeOptions: {},
|
|
30
|
+
rendering: {},
|
|
31
|
+
width: { default: "100%" },
|
|
32
|
+
height: { default: "auto" }
|
|
33
|
+
},
|
|
34
|
+
emits: ["ready", "release", "resize", "error"],
|
|
35
|
+
setup(_, { emit: E }) {
|
|
36
|
+
const e = _, s = E, c = I(), u = l(), i = l(), A = l(0), z = l(0), v = l(!1);
|
|
37
|
+
let a, n = 0;
|
|
38
|
+
const O = B(() => ({
|
|
39
|
+
width: m(e.width) ? `${e.width}px` : e.width,
|
|
40
|
+
height: m(e.height) ? `${e.height}px` : e.height
|
|
41
|
+
}));
|
|
42
|
+
function h() {
|
|
43
|
+
return J({
|
|
44
|
+
columns: e.columns,
|
|
45
|
+
tableApi: e.tableApi,
|
|
46
|
+
rendererSlots: e.rendererSlots,
|
|
47
|
+
getRowKey: e.getRowKey,
|
|
48
|
+
nativeOptions: e.nativeOptions,
|
|
49
|
+
rendering: e.rendering,
|
|
50
|
+
getVueUserAppContext: () => c == null ? void 0 : c.appContext
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
const d = l(h());
|
|
54
|
+
function w(t) {
|
|
55
|
+
const o = q(t) ? t : new Error(String(t));
|
|
56
|
+
s("error", o);
|
|
57
|
+
}
|
|
58
|
+
function g() {
|
|
59
|
+
if (m(e.width) && e.width <= 0)
|
|
60
|
+
throw T("TT_VTABLE_CONTAINER_SIZE_INVALID", "表格 width 必须大于 0。", {
|
|
61
|
+
width: e.width
|
|
62
|
+
});
|
|
63
|
+
if (m(e.height) && e.height <= 0)
|
|
64
|
+
throw T("TT_VTABLE_CONTAINER_SIZE_INVALID", "表格 height 必须大于 0。", {
|
|
65
|
+
height: e.height
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
function p() {
|
|
69
|
+
const t = u.value;
|
|
70
|
+
if (!t) return;
|
|
71
|
+
const o = t.getBoundingClientRect();
|
|
72
|
+
A.value = o.width, z.value = o.height, s("resize", o.width, o.height), o.width > 0 && o.height > 0 && (v.value = !0), !(!i.value || o.width <= 0 || o.height <= 0) && (n && cancelAnimationFrame(n), n = requestAnimationFrame(() => {
|
|
73
|
+
var r;
|
|
74
|
+
n = 0, (r = i.value) == null || r.resize();
|
|
75
|
+
}));
|
|
76
|
+
}
|
|
77
|
+
function V(t) {
|
|
78
|
+
i.value = t, s("ready", t), b(p);
|
|
79
|
+
}
|
|
80
|
+
function R(t) {
|
|
81
|
+
w(t);
|
|
82
|
+
}
|
|
83
|
+
function S(t) {
|
|
84
|
+
const o = W(t), r = i.value;
|
|
85
|
+
if (!r) {
|
|
86
|
+
d.value = h();
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
89
|
+
const x = j(o, {
|
|
90
|
+
tableApi: e.tableApi,
|
|
91
|
+
rendererSlots: e.rendererSlots,
|
|
92
|
+
getRowKey: e.getRowKey
|
|
93
|
+
}), C = G(o);
|
|
94
|
+
r.updateColumns(x), r.setFrozenColCount(C.frozenColCount), r.rightFrozenColCount = C.rightFrozenColCount;
|
|
95
|
+
}
|
|
96
|
+
async function N() {
|
|
97
|
+
const t = h(), o = i.value;
|
|
98
|
+
if (!o) {
|
|
99
|
+
d.value = t;
|
|
100
|
+
return;
|
|
101
|
+
}
|
|
102
|
+
try {
|
|
103
|
+
await o.updateOption(t);
|
|
104
|
+
} catch (r) {
|
|
105
|
+
w(r);
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
return f(() => e.columns, S), f([() => e.nativeOptions, () => e.rendering], () => void N()), f([() => e.width, () => e.height], () => {
|
|
109
|
+
g(), b(p);
|
|
110
|
+
}), k(() => {
|
|
111
|
+
g(), $ && (a = new ResizeObserver(p), u.value && a.observe(u.value), p());
|
|
112
|
+
}), L(() => {
|
|
113
|
+
a == null || a.disconnect(), a = void 0, n && cancelAnimationFrame(n), n = 0, i.value && s("release", i.value), i.value = void 0;
|
|
114
|
+
}), (t, o) => (y(), K("div", {
|
|
115
|
+
ref_key: "viewportElement",
|
|
116
|
+
ref: u,
|
|
117
|
+
class: "tt-vtable__viewport",
|
|
118
|
+
style: D(O.value)
|
|
119
|
+
}, [
|
|
120
|
+
v.value ? (y(), M(Z(H), {
|
|
121
|
+
key: 0,
|
|
122
|
+
options: d.value,
|
|
123
|
+
width: "100%",
|
|
124
|
+
height: "100%",
|
|
125
|
+
"on-ready": V,
|
|
126
|
+
"on-error": R
|
|
127
|
+
}, null, 8, ["options"])) : U("", !0)
|
|
128
|
+
], 4));
|
|
129
|
+
}
|
|
130
|
+
});
|
|
131
|
+
export {
|
|
132
|
+
ve as default
|
|
133
|
+
};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { MaybeRefOrGetter, Ref } from 'vue';
|
|
2
|
+
import { TtVTableColumn, TtVTableFeatureOptions, TtVTableFetchRecords, TtVTableMutationMode, TtVTableNativeEvents, TtVTableNativeOptions, TtVTableRenderingOptions, TtVTableRowKey, TtVTableRowKeySource } from '../public';
|
|
3
|
+
import { createVTableController } from '../runtime/createVTableController';
|
|
4
|
+
/** useVTable 接受的 maybe-reactive 配置。 */
|
|
5
|
+
export interface UseVTableOptions<Row extends Record<string, unknown>, Key extends TtVTableRowKey = TtVTableRowKey, QueryParams extends Record<string, unknown> = Record<string, unknown>> {
|
|
6
|
+
/** maybe-reactive 本地记录根快照。 */
|
|
7
|
+
records?: MaybeRefOrGetter<readonly Row[]>;
|
|
8
|
+
/** 远程记录请求函数,作为回调保持普通函数语义。 */
|
|
9
|
+
fetchRecords?: TtVTableFetchRecords<Row, QueryParams>;
|
|
10
|
+
/** maybe-reactive 语义列根。 */
|
|
11
|
+
columns: MaybeRefOrGetter<readonly TtVTableColumn<Row, Key>[]>;
|
|
12
|
+
/** 业务主键读取配置,函数值不会被 toValue 执行。 */
|
|
13
|
+
rowKey: TtVTableRowKeySource<Row, Key>;
|
|
14
|
+
/** maybe-reactive 查询参数根。 */
|
|
15
|
+
queryParams?: MaybeRefOrGetter<QueryParams>;
|
|
16
|
+
/** 可写选择主键 ref。 */
|
|
17
|
+
selectedRowKeys?: Ref<Key[]>;
|
|
18
|
+
/** maybe-reactive feature 配置根。 */
|
|
19
|
+
features?: MaybeRefOrGetter<TtVTableFeatureOptions<Row, Key> | undefined>;
|
|
20
|
+
/** 记录所有权策略。 */
|
|
21
|
+
mutationMode?: TtVTableMutationMode;
|
|
22
|
+
/** maybe-reactive Vue DOM 渲染配置。 */
|
|
23
|
+
rendering?: MaybeRefOrGetter<TtVTableRenderingOptions | undefined>;
|
|
24
|
+
/** maybe-reactive 原生 options 根。 */
|
|
25
|
+
nativeOptions?: MaybeRefOrGetter<TtVTableNativeOptions | undefined>;
|
|
26
|
+
/** maybe-reactive原生事件根。 */
|
|
27
|
+
nativeEvents?: MaybeRefOrGetter<TtVTableNativeEvents | undefined>;
|
|
28
|
+
/** maybe-reactive 表格宽度。 */
|
|
29
|
+
width?: MaybeRefOrGetter<number | string | undefined>;
|
|
30
|
+
/** maybe-reactive 表格高度。 */
|
|
31
|
+
height?: MaybeRefOrGetter<number | string | undefined>;
|
|
32
|
+
}
|
|
33
|
+
/** useVTable 返回的标准绑定结果。 */
|
|
34
|
+
export interface UseVTableResult<Row extends Record<string, unknown>, Key extends TtVTableRowKey = TtVTableRowKey> {
|
|
35
|
+
/** 可直接传给 TtVTable 的响应式绑定。 */
|
|
36
|
+
tableBindings: Record<string, unknown>;
|
|
37
|
+
/** 从 setup 开始保持引用稳定的公共 API。 */
|
|
38
|
+
tableApi: ReturnType<typeof createVTableController<Row, Key>>["tableApi"];
|
|
39
|
+
}
|
|
40
|
+
/** 创建 maybe-reactive 表格绑定和稳定 tableApi。 */
|
|
41
|
+
export declare function useVTable<Row extends Record<string, unknown>, Key extends TtVTableRowKey = TtVTableRowKey, QueryParams extends Record<string, unknown> = Record<string, unknown>>(options: UseVTableOptions<Row, Key, QueryParams>): UseVTableResult<Row, Key>;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { markRaw as d, shallowRef as n, computed as r, toValue as t, reactive as i, isRef as u } from "vue";
|
|
2
|
+
import { createVTableController as f } from "../runtime/createVTableController.js";
|
|
3
|
+
function w(e) {
|
|
4
|
+
const l = d(f()), a = e.selectedRowKeys ?? n([]), c = {
|
|
5
|
+
rowKey: e.rowKey,
|
|
6
|
+
mutationMode: e.mutationMode,
|
|
7
|
+
controller: l,
|
|
8
|
+
columns: r(() => t(e.columns)),
|
|
9
|
+
queryParams: r(() => t(e.queryParams) ?? {}),
|
|
10
|
+
features: r(() => t(e.features)),
|
|
11
|
+
rendering: r(() => t(e.rendering)),
|
|
12
|
+
nativeOptions: r(() => t(e.nativeOptions)),
|
|
13
|
+
nativeEvents: r(() => t(e.nativeEvents)),
|
|
14
|
+
width: r(() => t(e.width)),
|
|
15
|
+
height: r(() => t(e.height)),
|
|
16
|
+
selectedRowKeys: a,
|
|
17
|
+
"onUpdate:selectedRowKeys": (s) => {
|
|
18
|
+
u(a) && (a.value = s);
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
return e.fetchRecords ? c.fetchRecords = e.fetchRecords : c.records = r(() => t(e.records) ?? []), { tableBindings: i(c), tableApi: l.tableApi };
|
|
22
|
+
}
|
|
23
|
+
export {
|
|
24
|
+
w as useVTable
|
|
25
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { DefineSetupFnComponent, SlotsType } from 'vue';
|
|
2
|
+
import { TtVTableFormApi, TtVTableFormProps } from '../features/form-integration/useVTableForm';
|
|
3
|
+
import { TtVTableRowKey } from '../public';
|
|
4
|
+
/** 表单表格渲染组件允许的插槽集合。 */
|
|
5
|
+
type VTableFormRenderSlots = Record<string, (slotScope: Record<string, unknown>) => unknown>;
|
|
6
|
+
/** useVTableFormRender 返回值。 */
|
|
7
|
+
export type UseVTableFormRenderResult<Row extends Record<string, unknown>, Key extends TtVTableRowKey = TtVTableRowKey, FormValues extends Record<string, unknown> = Record<string, unknown>> = [
|
|
8
|
+
DefineSetupFnComponent<Partial<TtVTableFormProps<Row, Key, FormValues>>, Record<string, (...eventArguments: unknown[]) => unknown>, SlotsType<VTableFormRenderSlots>>,
|
|
9
|
+
TtVTableFormApi<Row, Key>
|
|
10
|
+
];
|
|
11
|
+
/** 创建带查询表单的动态表格组件与稳定组合 API。 */
|
|
12
|
+
export declare function useVTableFormRender<Row extends Record<string, unknown>, Key extends TtVTableRowKey = TtVTableRowKey, FormValues extends Record<string, unknown> = Record<string, unknown>>(options: TtVTableFormProps<Row, Key, FormValues>): UseVTableFormRenderResult<Row, Key, FormValues>;
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import "axios";
|
|
2
|
+
import "element-plus";
|
|
3
|
+
import { isFunction as T } from "../../../../packages/utils/src/is.js";
|
|
4
|
+
import { shallowRef as f, defineComponent as g, h as c } from "vue";
|
|
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 "../../../tt-select/index.js";
|
|
17
|
+
import "../../../tt-checkbox/index.js";
|
|
18
|
+
import "../../../tt-radio-group/index.js";
|
|
19
|
+
import "../../../tt-panel-select/index.js";
|
|
20
|
+
import "../../../tt-upload/index.js";
|
|
21
|
+
import "../../../tt-api-component/index.js";
|
|
22
|
+
import "vee-validate";
|
|
23
|
+
import "../../../../utils/uppercaseInput.js";
|
|
24
|
+
import { useForm as v } from "../../../tt-form/src/useForm.js";
|
|
25
|
+
import "zod";
|
|
26
|
+
import "@vee-validate/zod";
|
|
27
|
+
import "@tanstack/vue-store";
|
|
28
|
+
import "es-toolkit/compat";
|
|
29
|
+
import "../../../tt-form/src/shared/zod-defaults.js";
|
|
30
|
+
import "../../../tt-nav-anchor/index.js";
|
|
31
|
+
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";
|
|
32
|
+
import "vue-router";
|
|
33
|
+
import "../../../tt-icon/index.js";
|
|
34
|
+
import "../../../tt-form/src/components/Slot.js";
|
|
35
|
+
import "../../../tt-form-item-error-tooltip/index.js";
|
|
36
|
+
import "@vueuse/core";
|
|
37
|
+
/* empty css */
|
|
38
|
+
import "../../../tt-form/src/form/RenderContent.vue.js";
|
|
39
|
+
import "../../../tt-form/src/form-render/FormFieldContact.js";
|
|
40
|
+
/* empty css */
|
|
41
|
+
/* empty css */
|
|
42
|
+
import { useVTableRender as y } from "./useVTableRender.js";
|
|
43
|
+
function dt(t) {
|
|
44
|
+
const i = f({ ...t.table.queryParams ?? {} }), b = f([...t.table.selectedRowKeys ?? []]), a = t.form.handleSubmit, n = t.form.handleReset, l = {
|
|
45
|
+
columns: t.table.columns,
|
|
46
|
+
rowKey: t.table.rowKey,
|
|
47
|
+
queryParams: i,
|
|
48
|
+
selectedRowKeys: b,
|
|
49
|
+
features: t.table.features,
|
|
50
|
+
mutationMode: t.table.mutationMode,
|
|
51
|
+
rendering: t.table.rendering,
|
|
52
|
+
nativeOptions: t.table.nativeOptions,
|
|
53
|
+
nativeEvents: t.table.nativeEvents,
|
|
54
|
+
width: t.table.width,
|
|
55
|
+
height: t.table.height
|
|
56
|
+
};
|
|
57
|
+
T(t.table.fetchRecords) ? l.fetchRecords = t.table.fetchRecords : l.records = t.table.records ?? [];
|
|
58
|
+
const [d, p] = y(l);
|
|
59
|
+
async function h(e) {
|
|
60
|
+
await (a == null ? void 0 : a(e)), i.value = { ...e }, p.pagination.reset();
|
|
61
|
+
}
|
|
62
|
+
async function u(e) {
|
|
63
|
+
await (n == null ? void 0 : n(e)), i.value = { ...e }, p.pagination.reset();
|
|
64
|
+
}
|
|
65
|
+
const [R, w] = v({
|
|
66
|
+
...t.form,
|
|
67
|
+
handleSubmit: h,
|
|
68
|
+
handleReset: u
|
|
69
|
+
});
|
|
70
|
+
function F(e) {
|
|
71
|
+
const o = {}, m = {};
|
|
72
|
+
return Object.entries(e).forEach(([r, s]) => {
|
|
73
|
+
r.startsWith("form-") ? o[r.slice(5)] = s : m[r] = s;
|
|
74
|
+
}), { formSlots: o, tableSlots: m };
|
|
75
|
+
}
|
|
76
|
+
return [g(
|
|
77
|
+
(e, { attrs: o, slots: m }) => () => {
|
|
78
|
+
const r = F(m);
|
|
79
|
+
return c("div", { class: "tt-vtable-form" }, [
|
|
80
|
+
c(R, {}, r.formSlots),
|
|
81
|
+
c(d, o, r.tableSlots)
|
|
82
|
+
]);
|
|
83
|
+
},
|
|
84
|
+
{ name: "TtVTableFormRender", inheritAttrs: !1 }
|
|
85
|
+
), {
|
|
86
|
+
form: w,
|
|
87
|
+
table: p
|
|
88
|
+
}];
|
|
89
|
+
}
|
|
90
|
+
export {
|
|
91
|
+
dt as useVTableFormRender
|
|
92
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { DefineSetupFnComponent, SlotsType } from 'vue';
|
|
2
|
+
import { TtVTableProps, TtVTableRowKey, TtVTableSlots } from '../public';
|
|
3
|
+
import { useVTable, UseVTableOptions } from './useVTable';
|
|
4
|
+
/** 动态渲染组件允许的宽松事件签名。 */
|
|
5
|
+
type VTableRenderEmits = Record<string, (...eventArguments: unknown[]) => unknown>;
|
|
6
|
+
/** useVTableRender 返回值。 */
|
|
7
|
+
export type UseVTableRenderResult<Row extends Record<string, unknown>, Key extends TtVTableRowKey = TtVTableRowKey, QueryParams extends Record<string, unknown> = Record<string, unknown>> = [
|
|
8
|
+
DefineSetupFnComponent<Partial<TtVTableProps<Row, Key, QueryParams>>, VTableRenderEmits, SlotsType<TtVTableSlots<Row, Key>>>,
|
|
9
|
+
ReturnType<typeof useVTable<Row, Key, QueryParams>>["tableApi"]
|
|
10
|
+
];
|
|
11
|
+
/** 创建可直接渲染的 TtVTable 组件和稳定 tableApi。 */
|
|
12
|
+
export declare function useVTableRender<Row extends Record<string, unknown>, Key extends TtVTableRowKey = TtVTableRowKey, QueryParams extends Record<string, unknown> = Record<string, unknown>>(options: UseVTableOptions<Row, Key, QueryParams>): UseVTableRenderResult<Row, Key, QueryParams>;
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { defineComponent as a, h as m } from "vue";
|
|
2
|
+
import l from "../components/TtVTable.vue.js";
|
|
3
|
+
import { useVTable as s } from "./useVTable.js";
|
|
4
|
+
function T(e) {
|
|
5
|
+
const { tableBindings: n, tableApi: r } = s(e);
|
|
6
|
+
return [a(
|
|
7
|
+
(t, { attrs: o, slots: i }) => () => m(l, { ...n, ...t, ...o }, i),
|
|
8
|
+
{ name: "TtVTableRender", inheritAttrs: !1 }
|
|
9
|
+
), r];
|
|
10
|
+
}
|
|
11
|
+
export {
|
|
12
|
+
T as useVTableRender
|
|
13
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ListTable } from '@visactor/vtable';
|
|
2
|
+
import { VisactorTableEngine } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* 创建只持有浅层原生实例引用的 VisActor 适配器。
|
|
5
|
+
* @param initialInstance 已经由官方 Vue ListTable 创建的实例
|
|
6
|
+
* @returns 可供 runtime 使用的稳定适配器
|
|
7
|
+
*/
|
|
8
|
+
export declare function createVisactorTableEngine<Row extends Record<string, unknown>>(initialInstance?: ListTable): VisactorTableEngine<Row> & {
|
|
9
|
+
setInstance: (instance?: ListTable) => void;
|
|
10
|
+
};
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { shallowRef as g } from "vue";
|
|
2
|
+
import { changeVisactorCellValue as C, deleteVisactorRecords as h, updateVisactorRecords as I, addVisactorRecords as P, setVisactorRecords as b } from "./record-adapter.js";
|
|
3
|
+
function x(u) {
|
|
4
|
+
const a = g();
|
|
5
|
+
let n = !1;
|
|
6
|
+
a.value = u;
|
|
7
|
+
function o() {
|
|
8
|
+
return n ? void 0 : a.value;
|
|
9
|
+
}
|
|
10
|
+
function l(e) {
|
|
11
|
+
n || (a.value = e);
|
|
12
|
+
}
|
|
13
|
+
function r(e) {
|
|
14
|
+
a.value && b(a.value, e);
|
|
15
|
+
}
|
|
16
|
+
function i(e, t) {
|
|
17
|
+
a.value && P(a.value, e, t);
|
|
18
|
+
}
|
|
19
|
+
function c(e, t) {
|
|
20
|
+
a.value && I(a.value, e, t);
|
|
21
|
+
}
|
|
22
|
+
function s(e) {
|
|
23
|
+
a.value && h(a.value, e);
|
|
24
|
+
}
|
|
25
|
+
function d(e, t, m) {
|
|
26
|
+
return a.value ? C(a.value, e, t, m) : !1;
|
|
27
|
+
}
|
|
28
|
+
function f(e) {
|
|
29
|
+
return a.value ? a.value.updateOption(e) : Promise.resolve();
|
|
30
|
+
}
|
|
31
|
+
function v(e) {
|
|
32
|
+
var t;
|
|
33
|
+
(t = a.value) == null || t.updateColumns(e);
|
|
34
|
+
}
|
|
35
|
+
function p(e) {
|
|
36
|
+
var t;
|
|
37
|
+
(t = a.value) == null || t.updatePagination(e);
|
|
38
|
+
}
|
|
39
|
+
function R() {
|
|
40
|
+
var e;
|
|
41
|
+
(e = a.value) == null || e.renderWithRecreateCells();
|
|
42
|
+
}
|
|
43
|
+
function V() {
|
|
44
|
+
n || (n = !0, a.value = void 0);
|
|
45
|
+
}
|
|
46
|
+
return {
|
|
47
|
+
getInstance: o,
|
|
48
|
+
setInstance: l,
|
|
49
|
+
setRecords: r,
|
|
50
|
+
addRecords: i,
|
|
51
|
+
updateRecords: c,
|
|
52
|
+
deleteRecords: s,
|
|
53
|
+
changeCellValue: d,
|
|
54
|
+
updateOptions: f,
|
|
55
|
+
updateColumns: v,
|
|
56
|
+
updatePagination: p,
|
|
57
|
+
recalculate: R,
|
|
58
|
+
release: V
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
export {
|
|
62
|
+
x as createVisactorTableEngine
|
|
63
|
+
};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { TYPES } from '@visactor/vtable';
|
|
2
|
+
import { TtVTableApi, TtVTableColumn, TtVTableRendererSlots, TtVTableRowKey } from '../../public';
|
|
3
|
+
/** 创建正文 Vue DOM 布局所需上下文。 */
|
|
4
|
+
export interface CreateVueCellLayoutOptions<Row extends Record<string, unknown>, Key extends TtVTableRowKey = TtVTableRowKey> {
|
|
5
|
+
/** 当前语义列。 */
|
|
6
|
+
column: TtVTableColumn<Row, Key>;
|
|
7
|
+
/** 当前稳定公共 API。 */
|
|
8
|
+
tableApi: TtVTableApi<Row, Key>;
|
|
9
|
+
/** 当前组件可用的命名插槽。 */
|
|
10
|
+
rendererSlots: TtVTableRendererSlots<Row, Key>;
|
|
11
|
+
/** 从记录读取业务主键。 */
|
|
12
|
+
getRowKey: (record: Row) => Key;
|
|
13
|
+
}
|
|
14
|
+
/** 创建表头 Vue DOM 布局所需上下文。 */
|
|
15
|
+
export interface CreateVueHeaderLayoutOptions<Row extends Record<string, unknown>, Key extends TtVTableRowKey = TtVTableRowKey> {
|
|
16
|
+
/** 当前语义列。 */
|
|
17
|
+
column: TtVTableColumn<Row, Key>;
|
|
18
|
+
/** 当前稳定公共 API。 */
|
|
19
|
+
tableApi: TtVTableApi<Row, Key>;
|
|
20
|
+
/** 当前组件可用的命名插槽。 */
|
|
21
|
+
rendererSlots: TtVTableRendererSlots<Row, Key>;
|
|
22
|
+
}
|
|
23
|
+
/** 官方 customLayout 返回值。 */
|
|
24
|
+
type VisactorCustomLayout = TYPES.ICustomLayoutFuc;
|
|
25
|
+
/**
|
|
26
|
+
* 创建正文 Vue DOM customLayout。
|
|
27
|
+
* @param options renderer、API、插槽与主键读取配置
|
|
28
|
+
* @returns 原生 VTable customLayout
|
|
29
|
+
*/
|
|
30
|
+
export declare function createVueCellLayout<Row extends Record<string, unknown>, Key extends TtVTableRowKey>(options: CreateVueCellLayoutOptions<Row, Key>): VisactorCustomLayout;
|
|
31
|
+
/**
|
|
32
|
+
* 创建表头 Vue DOM headerCustomLayout。
|
|
33
|
+
* @param options renderer、API 与插槽配置
|
|
34
|
+
* @returns 原生 VTable headerCustomLayout
|
|
35
|
+
*/
|
|
36
|
+
export declare function createVueHeaderLayout<Row extends Record<string, unknown>, Key extends TtVTableRowKey>(options: CreateVueHeaderLayoutOptions<Row, Key>): VisactorCustomLayout;
|
|
37
|
+
export {};
|