@aplus-frontend/ui 0.4.34 → 0.5.0-beta.1
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/es/index.mjs +14 -12
- package/es/src/ap-grid/constants.d.ts +9 -0
- package/es/src/ap-grid/constants.mjs +12 -0
- package/es/src/ap-grid/hooks/use-inner-params.d.ts +10 -0
- package/es/src/ap-grid/hooks/use-inner-params.mjs +41 -0
- package/es/src/ap-grid/hooks/use-render-columns.d.ts +6 -0
- package/es/src/ap-grid/hooks/use-render-columns.mjs +29 -0
- package/es/src/ap-grid/index.d.ts +3 -0
- package/es/src/ap-grid/index.mjs +2 -0
- package/es/src/ap-grid/index.vue.d.ts +44 -0
- package/es/src/ap-grid/index.vue.mjs +356 -0
- package/es/src/ap-grid/index.vue2.mjs +4 -0
- package/es/src/ap-grid/interface.d.ts +264 -0
- package/es/src/ap-grid/interface.mjs +1 -0
- package/es/src/ap-grid/style/css.d.ts +0 -0
- package/es/src/ap-grid/style/css.js +1 -0
- package/es/src/ap-grid/style/index.d.ts +0 -0
- package/es/src/ap-grid/style/index.js +1 -0
- package/es/src/ap-grid/utils/col.d.ts +20 -0
- package/es/src/ap-grid/utils/col.mjs +106 -0
- package/es/src/ap-grid/utils/renderer.d.ts +3 -0
- package/es/src/ap-grid/utils/renderer.mjs +21 -0
- package/es/src/ap-grid/utils/table.d.ts +13 -0
- package/es/src/ap-grid/utils/table.mjs +64 -0
- package/es/src/ap-table/ap-table.vue.d.ts +2 -0
- package/es/src/ap-table/components/setting/select-group/index.vue2.mjs +38 -38
- package/es/src/ap-table/components/setting/sortable/item.vue2.mjs +9 -9
- package/es/src/ap-table/components/setting/tree-select/index.vue2.mjs +21 -21
- package/es/src/ap-table/components/setting/utils.d.ts +15 -3
- package/es/src/ap-table/components/setting/utils.mjs +49 -38
- package/es/src/ap-table/context.d.ts +2 -1
- package/es/src/ap-table/context.mjs +8 -7
- package/es/src/ap-table/hooks/use-table-column-state.mjs +79 -70
- package/es/src/ap-table/hooks/use-table-paging-ng.d.ts +8 -2
- package/es/src/ap-table/hooks/use-table-paging-ng.mjs +43 -40
- package/es/src/ap-table/hooks/use-table-row-selection.d.ts +12 -0
- package/es/src/ap-table/hooks/use-table-row-selection.mjs +41 -27
- package/es/src/ap-table/interface.d.ts +4 -0
- package/es/src/ap-table/utils.d.ts +1 -1
- package/es/src/business/ap-table-modal/hooks/use-create-table-modal.d.ts +2 -0
- package/es/src/business/ap-table-modal/hooks/use-table-modal.d.ts +2 -0
- package/es/src/business/ap-table-modal/hooks/use-table-select-modal.d.ts +2 -0
- package/es/src/business/ap-table-modal/index.d.ts +8 -0
- package/es/src/business/ap-table-modal/table-modal.vue.d.ts +4 -0
- package/es/src/business/hooks/usePageListApTable.d.ts +2 -0
- package/es/src/index.d.ts +1 -0
- package/es/src/index.mjs +244 -241
- package/es/src/path-map.mjs +2 -1
- package/lib/index.js +1 -1
- package/lib/src/ap-grid/constants.d.ts +9 -0
- package/lib/src/ap-grid/constants.js +1 -0
- package/lib/src/ap-grid/hooks/use-inner-params.d.ts +10 -0
- package/lib/src/ap-grid/hooks/use-inner-params.js +1 -0
- package/lib/src/ap-grid/hooks/use-render-columns.d.ts +6 -0
- package/lib/src/ap-grid/hooks/use-render-columns.js +1 -0
- package/lib/src/ap-grid/index.d.ts +3 -0
- package/lib/src/ap-grid/index.js +1 -0
- package/lib/src/ap-grid/index.vue.d.ts +44 -0
- package/lib/src/ap-grid/index.vue.js +1 -0
- package/lib/src/ap-grid/index.vue2.js +1 -0
- package/lib/src/ap-grid/interface.d.ts +264 -0
- package/lib/src/ap-grid/interface.js +1 -0
- package/lib/src/ap-grid/style/css.cjs +1 -0
- package/lib/src/ap-grid/style/css.d.ts +0 -0
- package/lib/src/ap-grid/style/index.cjs +1 -0
- package/lib/src/ap-grid/style/index.d.ts +0 -0
- package/lib/src/ap-grid/utils/col.d.ts +20 -0
- package/lib/src/ap-grid/utils/col.js +1 -0
- package/lib/src/ap-grid/utils/renderer.d.ts +3 -0
- package/lib/src/ap-grid/utils/renderer.js +1 -0
- package/lib/src/ap-grid/utils/table.d.ts +13 -0
- package/lib/src/ap-grid/utils/table.js +1 -0
- package/lib/src/ap-table/ap-table.vue.d.ts +2 -0
- package/lib/src/ap-table/components/setting/select-group/index.vue2.js +1 -1
- package/lib/src/ap-table/components/setting/sortable/item.vue2.js +1 -1
- package/lib/src/ap-table/components/setting/tree-select/index.vue2.js +1 -1
- package/lib/src/ap-table/components/setting/utils.d.ts +15 -3
- package/lib/src/ap-table/components/setting/utils.js +1 -1
- package/lib/src/ap-table/context.d.ts +2 -1
- package/lib/src/ap-table/context.js +1 -1
- package/lib/src/ap-table/hooks/use-table-column-state.js +1 -1
- package/lib/src/ap-table/hooks/use-table-paging-ng.d.ts +8 -2
- package/lib/src/ap-table/hooks/use-table-paging-ng.js +1 -1
- package/lib/src/ap-table/hooks/use-table-row-selection.d.ts +12 -0
- package/lib/src/ap-table/hooks/use-table-row-selection.js +1 -1
- package/lib/src/ap-table/interface.d.ts +4 -0
- package/lib/src/ap-table/utils.d.ts +1 -1
- package/lib/src/business/ap-table-modal/hooks/use-create-table-modal.d.ts +2 -0
- package/lib/src/business/ap-table-modal/hooks/use-table-modal.d.ts +2 -0
- package/lib/src/business/ap-table-modal/hooks/use-table-select-modal.d.ts +2 -0
- package/lib/src/business/ap-table-modal/index.d.ts +8 -0
- package/lib/src/business/ap-table-modal/table-modal.vue.d.ts +4 -0
- package/lib/src/business/hooks/usePageListApTable.d.ts +2 -0
- package/lib/src/index.d.ts +1 -0
- package/lib/src/index.js +1 -1
- package/lib/src/path-map.js +1 -1
- package/package.json +3 -1
- package/theme/ap-grid/index.css +302 -0
- package/theme/ap-grid/index.less +65 -0
- package/theme/index.css +51 -0
- package/theme/index.less +1 -0
|
@@ -5,7 +5,7 @@ import "../../../../config-provider/index.mjs";
|
|
|
5
5
|
import { useInjectSorterMethods as M } from "../sorter/context.mjs";
|
|
6
6
|
import S from "../images/icon_carst_down.svg.mjs";
|
|
7
7
|
import U from "../images/icon_fill_right.svg.mjs";
|
|
8
|
-
import {
|
|
8
|
+
import { getLabelRenderNode as j } from "../utils.mjs";
|
|
9
9
|
import { useNamespace as H } from "../../../../config-provider/hooks/use-namespace.mjs";
|
|
10
10
|
import { useLocale as q } from "../../../../config-provider/hooks/use-locale.mjs";
|
|
11
11
|
const G = ["src"], le = /* @__PURE__ */ E({
|
|
@@ -28,18 +28,18 @@ const G = ["src"], le = /* @__PURE__ */ E({
|
|
|
28
28
|
const l = v("left");
|
|
29
29
|
w(l);
|
|
30
30
|
}
|
|
31
|
-
function
|
|
31
|
+
function R() {
|
|
32
32
|
const l = v("right");
|
|
33
33
|
V(l);
|
|
34
34
|
}
|
|
35
|
-
function
|
|
35
|
+
function F() {
|
|
36
36
|
const l = v(void 0);
|
|
37
37
|
y(l);
|
|
38
38
|
}
|
|
39
|
-
function
|
|
39
|
+
function L() {
|
|
40
40
|
C("update:open", !o.open);
|
|
41
41
|
}
|
|
42
|
-
function
|
|
42
|
+
function N() {
|
|
43
43
|
var n;
|
|
44
44
|
const l = o.value;
|
|
45
45
|
l.show = !1, (n = l.children) == null || n.forEach((i) => i.show = !1);
|
|
@@ -58,7 +58,7 @@ const G = ["src"], le = /* @__PURE__ */ E({
|
|
|
58
58
|
}, null, 8, ["class"]),
|
|
59
59
|
p("span", {
|
|
60
60
|
class: t(e(h)("left", "indicator")),
|
|
61
|
-
onClick:
|
|
61
|
+
onClick: L
|
|
62
62
|
}, [
|
|
63
63
|
(i = l.value.children) != null && i.length ? (s(), g("img", {
|
|
64
64
|
key: 0,
|
|
@@ -96,7 +96,7 @@ const G = ["src"], le = /* @__PURE__ */ E({
|
|
|
96
96
|
default: d(() => [
|
|
97
97
|
c(e(z), {
|
|
98
98
|
class: t(e(a)("action-icon")),
|
|
99
|
-
onClick:
|
|
99
|
+
onClick: F
|
|
100
100
|
}, null, 8, ["class"])
|
|
101
101
|
]),
|
|
102
102
|
_: 1
|
|
@@ -109,7 +109,7 @@ const G = ["src"], le = /* @__PURE__ */ E({
|
|
|
109
109
|
c(e(k), {
|
|
110
110
|
rotate: 90,
|
|
111
111
|
class: t(e(a)("action-icon")),
|
|
112
|
-
onClick:
|
|
112
|
+
onClick: R
|
|
113
113
|
}, null, 8, ["class"])
|
|
114
114
|
]),
|
|
115
115
|
_: 1
|
|
@@ -121,7 +121,7 @@ const G = ["src"], le = /* @__PURE__ */ E({
|
|
|
121
121
|
default: d(() => [
|
|
122
122
|
c(e(A), {
|
|
123
123
|
class: t(e(a)("action-icon")),
|
|
124
|
-
onClick:
|
|
124
|
+
onClick: N
|
|
125
125
|
}, null, 8, ["class"])
|
|
126
126
|
]),
|
|
127
127
|
_: 1
|
|
@@ -1,64 +1,64 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { Row as
|
|
1
|
+
import { defineComponent as x, computed as w, unref as o, createElementBlock as i, openBlock as c, createVNode as s, withCtx as d, Fragment as m, renderList as B, createBlock as u, mergeProps as I, resolveDynamicComponent as L } from "vue";
|
|
2
|
+
import { Row as N, Col as k, Checkbox as P } from "@aplus-frontend/antdv";
|
|
3
3
|
import "../select-group/index.vue.mjs";
|
|
4
|
-
import { useInjectApTable as
|
|
5
|
-
import {
|
|
6
|
-
import
|
|
7
|
-
const
|
|
4
|
+
import { useInjectApTable as U } from "../../../context.mjs";
|
|
5
|
+
import { getLabelNode as j } from "../utils.mjs";
|
|
6
|
+
import A from "../select-group/index.vue2.mjs";
|
|
7
|
+
const q = /* @__PURE__ */ x({
|
|
8
8
|
__name: "index",
|
|
9
9
|
props: {
|
|
10
10
|
value: {}
|
|
11
11
|
},
|
|
12
12
|
setup(_) {
|
|
13
|
-
const a = _, { columnsBackup: g } =
|
|
14
|
-
var t,
|
|
15
|
-
return (t = e.children) != null && t.length && !((
|
|
13
|
+
const a = _, { columnsBackup: g, renderConfig: y } = U(), C = w(() => [...o(g) || []].sort((e, n) => {
|
|
14
|
+
var t, l, p, h;
|
|
15
|
+
return (t = e.children) != null && t.length && !((l = n.children) != null && l.length) ? 1 : !((p = e.children) != null && p.length) && ((h = n.children) != null && h.length) ? -1 : 0;
|
|
16
16
|
}));
|
|
17
17
|
function f(r) {
|
|
18
18
|
return a.value.find((e) => e.key === r.key);
|
|
19
19
|
}
|
|
20
|
-
function
|
|
20
|
+
function v(r) {
|
|
21
21
|
const e = f(r);
|
|
22
22
|
return {
|
|
23
23
|
checked: e == null ? void 0 : e.show,
|
|
24
24
|
disabled: e == null ? void 0 : e.disabled
|
|
25
25
|
};
|
|
26
26
|
}
|
|
27
|
-
function
|
|
28
|
-
const n = a.value, t = n == null ? void 0 : n.find((
|
|
27
|
+
function b(r, e) {
|
|
28
|
+
const n = a.value, t = n == null ? void 0 : n.find((l) => l.key === r);
|
|
29
29
|
t && (t.show = e);
|
|
30
30
|
}
|
|
31
31
|
return (r, e) => (c(), i("div", null, [
|
|
32
|
-
s(
|
|
32
|
+
s(o(N), {
|
|
33
33
|
gutter: [24, 16],
|
|
34
34
|
align: "middle"
|
|
35
35
|
}, {
|
|
36
36
|
default: d(() => [
|
|
37
|
-
(c(!0), i(m, null,
|
|
37
|
+
(c(!0), i(m, null, B(C.value, (n) => {
|
|
38
38
|
var t;
|
|
39
39
|
return c(), i(m, {
|
|
40
40
|
key: n.key
|
|
41
41
|
}, [
|
|
42
|
-
(t = n.children) != null && t.length ? (c(), u(
|
|
42
|
+
(t = n.children) != null && t.length ? (c(), u(o(k), {
|
|
43
43
|
key: 1,
|
|
44
44
|
span: 24
|
|
45
45
|
}, {
|
|
46
46
|
default: d(() => [
|
|
47
|
-
s(
|
|
47
|
+
s(A, {
|
|
48
48
|
value: f(n)
|
|
49
49
|
}, null, 8, ["value"])
|
|
50
50
|
]),
|
|
51
51
|
_: 2
|
|
52
|
-
}, 1024)) : (c(), u(
|
|
52
|
+
}, 1024)) : (c(), u(o(k), {
|
|
53
53
|
key: 0,
|
|
54
54
|
span: 8
|
|
55
55
|
}, {
|
|
56
56
|
default: d(() => [
|
|
57
|
-
s(
|
|
58
|
-
"onUpdate:checked": (
|
|
57
|
+
s(o(P), I({ ref_for: !0 }, v(n), {
|
|
58
|
+
"onUpdate:checked": (l) => b(n.key, l)
|
|
59
59
|
}), {
|
|
60
60
|
default: d(() => [
|
|
61
|
-
(c(), u(
|
|
61
|
+
(c(), u(L(o(j)(n, o(y)))))
|
|
62
62
|
]),
|
|
63
63
|
_: 2
|
|
64
64
|
}, 1040, ["onUpdate:checked"])
|
|
@@ -74,5 +74,5 @@ const $ = /* @__PURE__ */ b({
|
|
|
74
74
|
}
|
|
75
75
|
});
|
|
76
76
|
export {
|
|
77
|
-
|
|
77
|
+
q as default
|
|
78
78
|
};
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import { ColumnsType } from '@aplus-frontend/antdv/es/table';
|
|
2
|
-
import { ApColumnState, ApTableSettingDefaultValueType } from '../../interface';
|
|
2
|
+
import { ApColumnState, ApTableContextRenderConfig, ApTableSettingDefaultValueType } from '../../interface';
|
|
3
|
+
import { VNode, RendererNode, RendererElement, VNodeArrayChildren } from 'vue';
|
|
4
|
+
import { ColumnTitleProps } from '@aplus-frontend/antdv/es/table/interface';
|
|
5
|
+
import { VueNode } from '@aplus-frontend/antdv/es/_util/type';
|
|
3
6
|
/**
|
|
4
7
|
* 根据列状态重新生成表格列配置
|
|
5
8
|
* @param columns 表格列数组
|
|
@@ -9,12 +12,21 @@ import { ApColumnState, ApTableSettingDefaultValueType } from '../../interface';
|
|
|
9
12
|
export default function generateColumnsByColumnState(columns: ColumnsType, columnStateList: ApColumnState[]): ColumnsType;
|
|
10
13
|
export declare function customCloneColumnStates<T extends ApColumnState | ApColumnState[]>(columnStates: T): T;
|
|
11
14
|
/**
|
|
12
|
-
*
|
|
15
|
+
* 获取基于title设置的label节点
|
|
13
16
|
* @param node
|
|
14
17
|
* @param overrideProps
|
|
15
18
|
* @returns
|
|
16
19
|
*/
|
|
17
|
-
export declare function
|
|
20
|
+
export declare function getLabelNode(column: any, renderConfig?: ApTableContextRenderConfig): number | boolean | void | VNode<RendererNode, RendererElement, {
|
|
21
|
+
[key: string]: any;
|
|
22
|
+
}> | VNodeArrayChildren | ((props: ColumnTitleProps<any>) => VNodeArrayChildren | VueNode) | null;
|
|
23
|
+
/**
|
|
24
|
+
* 获取最终用于渲染的节点
|
|
25
|
+
* @param node
|
|
26
|
+
* @param overrideProps
|
|
27
|
+
* @returns
|
|
28
|
+
*/
|
|
29
|
+
export declare function getLabelRenderNode(node: any): any;
|
|
18
30
|
/**
|
|
19
31
|
* 生成可用于缓存的列状态对象
|
|
20
32
|
* @param columnStates
|
|
@@ -1,54 +1,65 @@
|
|
|
1
|
-
import { cloneDeepWith as
|
|
2
|
-
import { isVNode as
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
1
|
+
import { cloneDeepWith as s, isArray as c, omit as a } from "lodash-unified";
|
|
2
|
+
import { isVNode as u } from "vue";
|
|
3
|
+
import { getTableTitle as f } from "../../utils.mjs";
|
|
4
|
+
function h(t, e) {
|
|
5
|
+
var l;
|
|
6
|
+
const i = [];
|
|
7
|
+
for (const r of e) {
|
|
8
|
+
const o = t.find((n) => n.key === r.key);
|
|
9
|
+
if ((l = r.children) != null && l.length) {
|
|
10
|
+
const n = h(
|
|
11
|
+
o.children,
|
|
12
|
+
r.children
|
|
12
13
|
);
|
|
13
|
-
|
|
14
|
-
...
|
|
15
|
-
fixed:
|
|
16
|
-
children:
|
|
14
|
+
n.length && i.push({
|
|
15
|
+
...o,
|
|
16
|
+
fixed: r.fixed,
|
|
17
|
+
children: n
|
|
17
18
|
});
|
|
18
19
|
} else {
|
|
19
|
-
if (!
|
|
20
|
+
if (!r.show)
|
|
20
21
|
continue;
|
|
21
|
-
|
|
22
|
+
i.push({ ...o, fixed: r.fixed });
|
|
22
23
|
}
|
|
23
24
|
}
|
|
24
|
-
return
|
|
25
|
+
return i;
|
|
25
26
|
}
|
|
26
|
-
function
|
|
27
|
-
return
|
|
28
|
-
if (
|
|
29
|
-
return
|
|
27
|
+
function y(t) {
|
|
28
|
+
return s(t, (e, i) => {
|
|
29
|
+
if (i === "label")
|
|
30
|
+
return e;
|
|
30
31
|
});
|
|
31
32
|
}
|
|
32
|
-
function
|
|
33
|
-
|
|
33
|
+
function b(t, e) {
|
|
34
|
+
const i = t.title, l = c(i) ? i[0] : i;
|
|
35
|
+
return u(l) ? l : f(
|
|
36
|
+
t,
|
|
37
|
+
(e == null ? void 0 : e.className) || "",
|
|
38
|
+
void 0,
|
|
39
|
+
e == null ? void 0 : e.color
|
|
40
|
+
);
|
|
34
41
|
}
|
|
35
|
-
function
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
42
|
+
function x(t) {
|
|
43
|
+
return u(t) ? t : c(t) ? t[0] : t;
|
|
44
|
+
}
|
|
45
|
+
function S(t) {
|
|
46
|
+
function e(i) {
|
|
47
|
+
const l = {};
|
|
48
|
+
return i.forEach((r, o) => {
|
|
49
|
+
var n;
|
|
50
|
+
l[r.key] = {
|
|
51
|
+
...a(r, ["label", "key", "children"]),
|
|
52
|
+
order: o,
|
|
53
|
+
children: (n = r.children) != null && n.length ? e(r.children) : void 0
|
|
44
54
|
};
|
|
45
|
-
}),
|
|
55
|
+
}), l;
|
|
46
56
|
}
|
|
47
|
-
return
|
|
57
|
+
return e(t);
|
|
48
58
|
}
|
|
49
59
|
export {
|
|
50
|
-
|
|
51
|
-
m as customCloneColumnStates,
|
|
60
|
+
y as customCloneColumnStates,
|
|
52
61
|
h as default,
|
|
53
|
-
|
|
62
|
+
S as getColumnStateString,
|
|
63
|
+
b as getLabelNode,
|
|
64
|
+
x as getLabelRenderNode
|
|
54
65
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ColumnType } from '@aplus-frontend/antdv/es/table';
|
|
2
2
|
import { ComputedRef, InjectionKey } from 'vue';
|
|
3
|
-
import { ApTableProps } from './interface';
|
|
3
|
+
import { ApTableContextRenderConfig, ApTableProps } from './interface';
|
|
4
4
|
type TableSize = ApTableProps['size'];
|
|
5
5
|
type ApTableContextProps<RecordType> = {
|
|
6
6
|
/**
|
|
@@ -25,6 +25,7 @@ type ApTableContextProps<RecordType> = {
|
|
|
25
25
|
size?: ComputedRef<TableSize>;
|
|
26
26
|
updateSize?: (nextSize: TableSize) => void;
|
|
27
27
|
dataSource?: ComputedRef<RecordType[]>;
|
|
28
|
+
renderConfig?: ComputedRef<ApTableContextRenderConfig>;
|
|
28
29
|
};
|
|
29
30
|
export declare const ApTableContextKey: InjectionKey<ApTableContextProps<any>>;
|
|
30
31
|
export declare function useProvideApTable<ModelType>(state: ApTableContextProps<ModelType>): void;
|
|
@@ -1,21 +1,22 @@
|
|
|
1
|
-
import { provide as n, inject as
|
|
1
|
+
import { provide as n, inject as i, computed as e } from "vue";
|
|
2
2
|
const o = Symbol("apTableContextKey");
|
|
3
|
-
function
|
|
3
|
+
function u(t) {
|
|
4
4
|
n(o, t);
|
|
5
5
|
}
|
|
6
|
-
function
|
|
7
|
-
return
|
|
6
|
+
function p() {
|
|
7
|
+
return i(o, {
|
|
8
8
|
columns: e(() => []),
|
|
9
9
|
updateColumns: () => {
|
|
10
10
|
},
|
|
11
11
|
size: e(() => "middle"),
|
|
12
12
|
updateSize: () => {
|
|
13
13
|
},
|
|
14
|
-
dataSource: void 0
|
|
14
|
+
dataSource: void 0,
|
|
15
|
+
renderConfig: void 0
|
|
15
16
|
});
|
|
16
17
|
}
|
|
17
18
|
export {
|
|
18
19
|
o as ApTableContextKey,
|
|
19
|
-
|
|
20
|
-
|
|
20
|
+
p as useInjectApTable,
|
|
21
|
+
u as useProvideApTable
|
|
21
22
|
};
|
|
@@ -1,15 +1,19 @@
|
|
|
1
|
-
import { ref as
|
|
2
|
-
import { isDef as
|
|
3
|
-
import
|
|
4
|
-
import { useInjectApTable as
|
|
5
|
-
import { isObject as N, mergeWith as F, isBoolean as
|
|
1
|
+
import { ref as P, shallowRef as W, unref as i, computed as X, watchEffect as q } from "vue";
|
|
2
|
+
import { isDef as H } from "../../utils/index.mjs";
|
|
3
|
+
import L, { customCloneColumnStates as T, getColumnStateString as Q } from "../components/setting/utils.mjs";
|
|
4
|
+
import { useInjectApTable as U } from "../context.mjs";
|
|
5
|
+
import { isObject as N, mergeWith as F, isBoolean as V, omit as Y, isString as Z, isNumber as B } from "lodash-unified";
|
|
6
|
+
import "../../config-provider/index.mjs";
|
|
7
|
+
import { useToken as $ } from "@aplus-frontend/antdv/es/theme/internal";
|
|
8
|
+
import { getTableTitle as K } from "../utils.mjs";
|
|
9
|
+
import { useNamespace as ee } from "../../config-provider/hooks/use-namespace.mjs";
|
|
6
10
|
function u(r, o) {
|
|
7
11
|
r.forEach((n) => {
|
|
8
|
-
var
|
|
9
|
-
o(n), (
|
|
12
|
+
var a;
|
|
13
|
+
o(n), (a = n.children) != null && a.length && u(n.children, o);
|
|
10
14
|
});
|
|
11
15
|
}
|
|
12
|
-
function
|
|
16
|
+
function te(r, o) {
|
|
13
17
|
if (!o)
|
|
14
18
|
return {};
|
|
15
19
|
const n = r.getItem(o);
|
|
@@ -20,108 +24,113 @@ function I(r, o) {
|
|
|
20
24
|
return F({}, r, o, I);
|
|
21
25
|
}
|
|
22
26
|
const E = Number.MAX_SAFE_INTEGER;
|
|
23
|
-
function
|
|
24
|
-
return
|
|
27
|
+
function re(r, o, n, a) {
|
|
28
|
+
return a ? a.fixed : o ? o.fixed : n && "fixed" in n ? n.fixed : V(r.fixed) ? r.fixed ? "left" : void 0 : r.fixed;
|
|
25
29
|
}
|
|
26
|
-
const
|
|
27
|
-
const
|
|
28
|
-
|
|
29
|
-
), { columnsBackup:
|
|
30
|
-
function
|
|
31
|
-
const e =
|
|
30
|
+
const he = (r, o, n) => {
|
|
31
|
+
const { be: a } = ee("ap-table"), [oe, O] = $(), l = P(n), c = W(
|
|
32
|
+
T(n)
|
|
33
|
+
), { columnsBackup: p, updateColumns: h } = U(), _ = r.persistenceType || "localStorage", S = window[_];
|
|
34
|
+
function J() {
|
|
35
|
+
const e = te(
|
|
32
36
|
S,
|
|
33
|
-
|
|
37
|
+
i(o)
|
|
34
38
|
), t = F(
|
|
35
39
|
{},
|
|
36
40
|
r.defaultValue || {},
|
|
37
41
|
e,
|
|
38
42
|
I
|
|
39
|
-
), s =
|
|
40
|
-
function
|
|
41
|
-
return
|
|
43
|
+
), s = i(p);
|
|
44
|
+
function d(D, m, G) {
|
|
45
|
+
return D.map((f) => {
|
|
42
46
|
var y, A;
|
|
43
|
-
const
|
|
44
|
-
key:
|
|
45
|
-
label:
|
|
47
|
+
const b = (m == null ? void 0 : m[f.key]) || {}, g = {
|
|
48
|
+
key: f.key,
|
|
49
|
+
label: Z(f.title) ? K(
|
|
50
|
+
f,
|
|
51
|
+
a("table-header", "title"),
|
|
52
|
+
void 0,
|
|
53
|
+
O.value.colorPrimary
|
|
54
|
+
) : f.title,
|
|
46
55
|
show: !0,
|
|
47
|
-
fixed:
|
|
48
|
-
|
|
49
|
-
e[
|
|
50
|
-
(y = r.defaultValue) == null ? void 0 : y[
|
|
51
|
-
|
|
56
|
+
fixed: re(
|
|
57
|
+
f,
|
|
58
|
+
e[f.key],
|
|
59
|
+
(y = r.defaultValue) == null ? void 0 : y[f.key],
|
|
60
|
+
G
|
|
52
61
|
),
|
|
53
62
|
disabled: !1,
|
|
54
|
-
...
|
|
63
|
+
...Y(b, ["children", "fixed"])
|
|
55
64
|
};
|
|
56
|
-
return g.children = (A =
|
|
57
|
-
|
|
58
|
-
|
|
65
|
+
return g.children = (A = f.children) != null && A.length ? d(
|
|
66
|
+
f.children,
|
|
67
|
+
b.children,
|
|
59
68
|
g
|
|
60
69
|
) : void 0, g;
|
|
61
|
-
}).sort(
|
|
70
|
+
}).sort(M);
|
|
62
71
|
}
|
|
63
|
-
return
|
|
72
|
+
return d(s || [], t);
|
|
64
73
|
}
|
|
65
|
-
function
|
|
66
|
-
const s =
|
|
67
|
-
let
|
|
68
|
-
return e.fixed === "right" && t.fixed !== "right" && (
|
|
74
|
+
function M(e, t) {
|
|
75
|
+
const s = B(e.order) ? e.order : E;
|
|
76
|
+
let d = B(t.order) ? t.order : E;
|
|
77
|
+
return e.fixed === "right" && t.fixed !== "right" && (d = s - 1), t.fixed === "left" && e.fixed !== "left" && (d = s - 1), s - d;
|
|
69
78
|
}
|
|
70
|
-
const
|
|
79
|
+
const x = X(() => i(l).every((e) => e.show));
|
|
71
80
|
function C() {
|
|
72
|
-
const e =
|
|
81
|
+
const e = i(l);
|
|
73
82
|
u(e, (t) => {
|
|
74
83
|
!t.disabled && (t.show = !0);
|
|
75
84
|
});
|
|
76
85
|
}
|
|
77
|
-
function
|
|
78
|
-
const e =
|
|
86
|
+
function w() {
|
|
87
|
+
const e = i(l);
|
|
79
88
|
u(e, (t) => {
|
|
80
89
|
!t.disabled && (t.show = !1);
|
|
81
90
|
});
|
|
82
91
|
}
|
|
83
|
-
function
|
|
84
|
-
|
|
92
|
+
function R() {
|
|
93
|
+
i(x) ? w() : C();
|
|
85
94
|
}
|
|
86
|
-
function
|
|
87
|
-
u(
|
|
88
|
-
s.key === e && (s.show =
|
|
95
|
+
function j(e, t) {
|
|
96
|
+
u(i(l), (s) => {
|
|
97
|
+
s.key === e && (s.show = H(t) ? t : !s.show);
|
|
89
98
|
});
|
|
90
99
|
}
|
|
91
|
-
function
|
|
92
|
-
|
|
100
|
+
function k(e) {
|
|
101
|
+
l.value = e;
|
|
93
102
|
}
|
|
94
|
-
function
|
|
103
|
+
function z(e) {
|
|
95
104
|
c.value = e;
|
|
96
105
|
}
|
|
97
|
-
function
|
|
98
|
-
if (
|
|
99
|
-
const t =
|
|
100
|
-
S.setItem(
|
|
106
|
+
function v(e) {
|
|
107
|
+
if (i(o)) {
|
|
108
|
+
const t = Q(e);
|
|
109
|
+
S.setItem(i(o), JSON.stringify(t));
|
|
101
110
|
}
|
|
102
111
|
}
|
|
103
|
-
return
|
|
112
|
+
return q(() => {
|
|
104
113
|
var t;
|
|
105
|
-
const e =
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
114
|
+
const e = J();
|
|
115
|
+
k(e), (t = r.onChange) == null || t.call(r, e), h == null || h(
|
|
116
|
+
L(
|
|
117
|
+
i(p),
|
|
118
|
+
i(e)
|
|
110
119
|
)
|
|
111
|
-
), c.value =
|
|
120
|
+
), c.value = T(e), v(e);
|
|
112
121
|
}), {
|
|
113
|
-
columnState:
|
|
122
|
+
columnState: l,
|
|
114
123
|
selectAll: C,
|
|
115
|
-
unSelectAll:
|
|
116
|
-
toggleSelect:
|
|
117
|
-
setColumnState:
|
|
118
|
-
isAllSelected:
|
|
119
|
-
toggleSelectAll:
|
|
124
|
+
unSelectAll: w,
|
|
125
|
+
toggleSelect: j,
|
|
126
|
+
setColumnState: k,
|
|
127
|
+
isAllSelected: x,
|
|
128
|
+
toggleSelectAll: R,
|
|
120
129
|
columnStateBackup: c,
|
|
121
|
-
setColumnStateBackup:
|
|
122
|
-
cacheColumnStateIfNeeded:
|
|
130
|
+
setColumnStateBackup: z,
|
|
131
|
+
cacheColumnStateIfNeeded: v
|
|
123
132
|
};
|
|
124
133
|
};
|
|
125
134
|
export {
|
|
126
|
-
|
|
135
|
+
he as useTableColumnState
|
|
127
136
|
};
|
|
@@ -49,13 +49,19 @@ export type UseTablePagingParams<DataType, ParamsType> = {
|
|
|
49
49
|
* 分页相关
|
|
50
50
|
*/
|
|
51
51
|
pagination?: boolean | ApTablePaginationConfig;
|
|
52
|
+
/**
|
|
53
|
+
* 样式命名空间
|
|
54
|
+
*/
|
|
55
|
+
namespace?: 'ap-table' | 'ap-grid';
|
|
52
56
|
};
|
|
53
57
|
type InternalDataType<DataType = Recordable> = {
|
|
54
58
|
total: number;
|
|
55
59
|
records: DataType[];
|
|
56
60
|
loading: boolean;
|
|
57
61
|
};
|
|
58
|
-
export declare const
|
|
62
|
+
export declare const DEFAULT_CURRENT = 1;
|
|
63
|
+
export declare const DEFAULT_PAGE_SIZE = 10;
|
|
64
|
+
export declare const useTablePaging: <DataType = any, ParamsType = Record<string, any>>({ manual, request, defaultParams, defaultData, formatParams, paramsValueTypeMap, resetFieldsIgnores, filterFields, sortFields, namespace, pagination }: UseTablePagingParams<DataType, ParamsType>) => {
|
|
59
65
|
formRef: Ref<ApFormSearchFormExpose | undefined, ApFormSearchFormExpose | undefined>;
|
|
60
66
|
submit: () => void;
|
|
61
67
|
reset: () => void;
|
|
@@ -74,7 +80,7 @@ export declare const useTablePaging: <DataType = any, ParamsType = Record<string
|
|
|
74
80
|
showSizeChanger: boolean;
|
|
75
81
|
showQuickJumper: boolean;
|
|
76
82
|
showLessItems: boolean | undefined;
|
|
77
|
-
size:
|
|
83
|
+
size: "default" | "small";
|
|
78
84
|
showTotal: ((total: number) => import("vue/jsx-runtime").JSX.Element) | undefined;
|
|
79
85
|
};
|
|
80
86
|
onChange: (pagination: TablePaginationConfig, filters: Record<string, FilterValue | null>, sorter: SorterResult<any> | SorterResult<any>[], extra: TableCurrentDataSource<any>) => void;
|