@aplus-frontend/ui 0.4.33 → 0.5.0-beta.0
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 +121 -117
- package/es/src/ap-button/ap-confirm-button.vue.d.ts +20 -0
- package/es/src/ap-button/ap-confirm-button.vue.mjs +56 -0
- package/es/src/ap-button/ap-confirm-button.vue2.mjs +4 -0
- package/es/src/ap-button/index.d.ts +2 -1
- package/es/src/ap-button/index.mjs +1 -0
- package/es/src/ap-button/interface.d.ts +6 -1
- package/es/src/ap-button/utils/index.d.ts +2 -0
- package/es/src/ap-button/utils/index.mjs +36 -16
- 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.mjs +399 -0
- package/es/src/ap-grid/index.vue2.mjs +4 -0
- package/es/src/ap-grid/interface.d.ts +279 -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-modal/utils/createModal.mjs +28 -28
- 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 +242 -237
- package/es/src/path-map.mjs +2 -1
- package/lib/index.js +1 -1
- package/lib/src/ap-button/ap-confirm-button.vue.d.ts +20 -0
- package/lib/src/ap-button/ap-confirm-button.vue.js +1 -0
- package/lib/src/ap-button/ap-confirm-button.vue2.js +1 -0
- package/lib/src/ap-button/index.d.ts +2 -1
- package/lib/src/ap-button/index.js +1 -1
- package/lib/src/ap-button/interface.d.ts +6 -1
- package/lib/src/ap-button/utils/index.d.ts +2 -0
- package/lib/src/ap-button/utils/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.js +1 -0
- package/lib/src/ap-grid/index.vue2.js +1 -0
- package/lib/src/ap-grid/interface.d.ts +279 -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-modal/utils/createModal.js +1 -1
- 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/antd-global-overwrite/admin/index.css +8 -1
- package/theme/antd-global-overwrite/admin/modal.css +8 -1
- package/theme/antd-global-overwrite/admin/modal.less +10 -1
- package/theme/antd-global-overwrite/aplus/index.css +8 -1
- package/theme/antd-global-overwrite/aplus/modal.css +8 -1
- package/theme/antd-global-overwrite/aplus/modal.less +10 -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
|
@@ -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;
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import { ref as
|
|
2
|
-
import { useTableSortedAndFiltered as
|
|
1
|
+
import { ref as te, reactive as I, unref as h, nextTick as re, onMounted as oe, watch as ne, computed as A, createVNode as C } from "vue";
|
|
2
|
+
import { useTableSortedAndFiltered as ae } from "./use-sorted-filtered.mjs";
|
|
3
3
|
import "../../config-provider/index.mjs";
|
|
4
|
-
import { parseFieldValue as
|
|
5
|
-
import { isArray as N, isEqualWith as
|
|
6
|
-
import { useLocale as
|
|
7
|
-
import { useNamespace as
|
|
4
|
+
import { parseFieldValue as se, dataIndexToStr as ce, isEqualCustom as ie } from "../utils.mjs";
|
|
5
|
+
import { isArray as N, isEqualWith as le } from "lodash-unified";
|
|
6
|
+
import { useLocale as ue } from "../../config-provider/hooks/use-locale.mjs";
|
|
7
|
+
import { useNamespace as fe } from "../../config-provider/hooks/use-namespace.mjs";
|
|
8
8
|
const S = 1, L = 10;
|
|
9
|
-
function
|
|
9
|
+
function ge(g) {
|
|
10
10
|
const l = {};
|
|
11
11
|
return g && (g === !0 ? (l.current = S, l.pageSize = L) : (l.current = g.defaultCurrent || S, l.pageSize = g.defaultPageSize || L)), l;
|
|
12
12
|
}
|
|
13
|
-
const
|
|
13
|
+
const Pe = ({
|
|
14
14
|
manual: g = !1,
|
|
15
15
|
request: l,
|
|
16
16
|
defaultParams: v = {},
|
|
@@ -20,6 +20,7 @@ const Te = ({
|
|
|
20
20
|
resetFieldsIgnores: V,
|
|
21
21
|
filterFields: U,
|
|
22
22
|
sortFields: B,
|
|
23
|
+
namespace: K = "ap-table",
|
|
23
24
|
pagination: p = {
|
|
24
25
|
defaultCurrent: S,
|
|
25
26
|
defaultPageSize: L,
|
|
@@ -28,15 +29,15 @@ const Te = ({
|
|
|
28
29
|
}
|
|
29
30
|
}) => {
|
|
30
31
|
let b = 0, s = {};
|
|
31
|
-
const
|
|
32
|
-
getColumnSFConfig:
|
|
33
|
-
setSF:
|
|
34
|
-
clearAll:
|
|
35
|
-
} =
|
|
32
|
+
const M = p ?? {}, $ = (e) => D ? D(e) : e, z = te(), c = I(ge(p)), {
|
|
33
|
+
getColumnSFConfig: G,
|
|
34
|
+
setSF: J,
|
|
35
|
+
clearAll: Q
|
|
36
|
+
} = ae(), {
|
|
36
37
|
t: T
|
|
37
|
-
} =
|
|
38
|
+
} = ue(), {
|
|
38
39
|
b: P
|
|
39
|
-
} =
|
|
40
|
+
} = fe(K), o = I({
|
|
40
41
|
total: y.length,
|
|
41
42
|
records: y,
|
|
42
43
|
loading: !1
|
|
@@ -45,7 +46,7 @@ const Te = ({
|
|
|
45
46
|
return ((t = (e = z.value) == null ? void 0 : e.apForm) == null ? void 0 : t.getFieldsValueTransformed(!0)) || {};
|
|
46
47
|
}, O = async (e) => {
|
|
47
48
|
var n;
|
|
48
|
-
const t =
|
|
49
|
+
const t = $(e), r = Date.now();
|
|
49
50
|
b = r, o.loading = !0;
|
|
50
51
|
try {
|
|
51
52
|
const a = await l({
|
|
@@ -63,22 +64,22 @@ const Te = ({
|
|
|
63
64
|
return Object.entries(e).forEach(([r, n]) => {
|
|
64
65
|
if (t[r] = n, R && n) {
|
|
65
66
|
const a = R[r];
|
|
66
|
-
a && (t[r] =
|
|
67
|
+
a && (t[r] = se(a, n));
|
|
67
68
|
}
|
|
68
69
|
}), t;
|
|
69
|
-
},
|
|
70
|
+
}, W = async (e) => {
|
|
70
71
|
var n, a, u, f, d;
|
|
71
72
|
const t = F(), r = {};
|
|
72
73
|
Object.entries(t).forEach(([m, x]) => {
|
|
73
74
|
V && V.indexOf(m) > -1 && (r[m] = x);
|
|
74
|
-
}), await ((a = (n = z.value) == null ? void 0 : n.apForm) == null ? void 0 : a.resetFields()), (d = (f = (u = z.value) == null ? void 0 : u.apForm) == null ? void 0 : f.setFieldsValue) == null || d.call(f, r),
|
|
75
|
+
}), await ((a = (n = z.value) == null ? void 0 : n.apForm) == null ? void 0 : a.resetFields()), (d = (f = (u = z.value) == null ? void 0 : u.apForm) == null ? void 0 : f.setFieldsValue) == null || d.call(f, r), re(() => {
|
|
75
76
|
e == null || e();
|
|
76
77
|
});
|
|
77
78
|
}, w = (e) => {
|
|
78
79
|
s = e;
|
|
79
80
|
const t = _(e);
|
|
80
81
|
O(t);
|
|
81
|
-
},
|
|
82
|
+
}, Z = (e) => {
|
|
82
83
|
w({
|
|
83
84
|
...s,
|
|
84
85
|
...e
|
|
@@ -92,11 +93,11 @@ const Te = ({
|
|
|
92
93
|
current: p ? S : void 0,
|
|
93
94
|
pageSize: p ? s.pageSize || c.pageSize : void 0
|
|
94
95
|
});
|
|
95
|
-
},
|
|
96
|
-
|
|
96
|
+
}, H = () => {
|
|
97
|
+
Q(), s.sort = {}, s.filter = {}, W(E);
|
|
97
98
|
}, j = () => {
|
|
98
99
|
w(s);
|
|
99
|
-
},
|
|
100
|
+
}, X = (e) => {
|
|
100
101
|
if (!p)
|
|
101
102
|
j();
|
|
102
103
|
else {
|
|
@@ -104,17 +105,17 @@ const Te = ({
|
|
|
104
105
|
current: t,
|
|
105
106
|
pageSize: r
|
|
106
107
|
} = c, n = o.total - e, a = Math.ceil(n / r), u = t > a ? a : t;
|
|
107
|
-
|
|
108
|
+
Z({
|
|
108
109
|
current: u > 0 ? u : 1
|
|
109
110
|
});
|
|
110
111
|
}
|
|
111
112
|
}, q = (e, t, r) => {
|
|
112
113
|
var m, x;
|
|
113
114
|
const n = F();
|
|
114
|
-
c.current = e.current, c.pageSize = e.pageSize,
|
|
115
|
+
c.current = e.current, c.pageSize = e.pageSize, J(t, r);
|
|
115
116
|
const a = N(r) ? [...r] : [r], u = {};
|
|
116
117
|
for (const i of a)
|
|
117
|
-
(m = h(B)) != null && m.includes(i.columnKey || i.field) && i.order && (u[
|
|
118
|
+
(m = h(B)) != null && m.includes(i.columnKey || i.field) && i.order && (u[ce(i.columnKey || i.field)] = i.order);
|
|
118
119
|
const f = {};
|
|
119
120
|
for (const i of Object.keys(t))
|
|
120
121
|
(x = h(U)) != null && x.includes(i) && t[i] && (f[i] = t[i]);
|
|
@@ -125,9 +126,9 @@ const Te = ({
|
|
|
125
126
|
current: e.current,
|
|
126
127
|
pageSize: e.pageSize
|
|
127
128
|
};
|
|
128
|
-
|
|
129
|
+
le(s, d, ie) || w(d);
|
|
129
130
|
};
|
|
130
|
-
|
|
131
|
+
oe(() => {
|
|
131
132
|
const e = F(), {
|
|
132
133
|
current: t,
|
|
133
134
|
pageSize: r
|
|
@@ -142,12 +143,12 @@ const Te = ({
|
|
|
142
143
|
const n = _(s);
|
|
143
144
|
O(n);
|
|
144
145
|
}
|
|
145
|
-
}),
|
|
146
|
+
}), ne(() => h(v), () => {
|
|
146
147
|
E();
|
|
147
148
|
}, {
|
|
148
149
|
deep: !0
|
|
149
150
|
});
|
|
150
|
-
const
|
|
151
|
+
const Y = A(() => {
|
|
151
152
|
if (o.total === 0)
|
|
152
153
|
return "-";
|
|
153
154
|
const {
|
|
@@ -156,14 +157,14 @@ const Te = ({
|
|
|
156
157
|
} = c;
|
|
157
158
|
return `${e}/${Math.ceil(o.total / t)}`;
|
|
158
159
|
});
|
|
159
|
-
function
|
|
160
|
+
function k(e) {
|
|
160
161
|
N(e) && (o.records = e, o.total = e.length);
|
|
161
162
|
}
|
|
162
|
-
const
|
|
163
|
+
const ee = A(() => {
|
|
163
164
|
const {
|
|
164
165
|
showLessItems: e,
|
|
165
166
|
showTotal: t
|
|
166
|
-
} =
|
|
167
|
+
} = M;
|
|
167
168
|
return {
|
|
168
169
|
loading: o.loading,
|
|
169
170
|
pagination: {
|
|
@@ -182,7 +183,7 @@ const Te = ({
|
|
|
182
183
|
class: P("pagination--total-right")
|
|
183
184
|
}, [T("ap.apTable.pagination.totalRightPrefix"), " ", C("span", {
|
|
184
185
|
class: P("pagination-count-text")
|
|
185
|
-
}, [h(
|
|
186
|
+
}, [h(Y)]), " ", T("ap.apTable.pagination.totalRightSuffix")])]) : void 0
|
|
186
187
|
},
|
|
187
188
|
onChange: q,
|
|
188
189
|
dataSource: o.records
|
|
@@ -191,19 +192,21 @@ const Te = ({
|
|
|
191
192
|
return {
|
|
192
193
|
formRef: z,
|
|
193
194
|
submit: E,
|
|
194
|
-
reset:
|
|
195
|
+
reset: H,
|
|
195
196
|
refresh: j,
|
|
196
|
-
refreshByDelete:
|
|
197
|
+
refreshByDelete: X,
|
|
197
198
|
data: o,
|
|
198
199
|
current: c.current,
|
|
199
200
|
pageSize: c.pageSize,
|
|
200
201
|
handleTableChange: q,
|
|
201
|
-
tableProps:
|
|
202
|
+
tableProps: ee,
|
|
202
203
|
dataSource: A(() => o.records),
|
|
203
|
-
setDataSource:
|
|
204
|
-
getColumnSFConfig:
|
|
204
|
+
setDataSource: k,
|
|
205
|
+
getColumnSFConfig: G
|
|
205
206
|
};
|
|
206
207
|
};
|
|
207
208
|
export {
|
|
208
|
-
|
|
209
|
+
S as DEFAULT_CURRENT,
|
|
210
|
+
L as DEFAULT_PAGE_SIZE,
|
|
211
|
+
Pe as useTablePaging
|
|
209
212
|
};
|
|
@@ -44,6 +44,18 @@ export interface RowSelectionReturnType<RecordType = any> {
|
|
|
44
44
|
* @returns
|
|
45
45
|
*/
|
|
46
46
|
toggleSelect: (item: RecordType) => void;
|
|
47
|
+
/**
|
|
48
|
+
* 多项选中
|
|
49
|
+
* @param items
|
|
50
|
+
* @returns
|
|
51
|
+
*/
|
|
52
|
+
selectMulti: (items: RecordType[]) => void;
|
|
53
|
+
/**
|
|
54
|
+
* 多项反选
|
|
55
|
+
* @param items
|
|
56
|
+
* @returns
|
|
57
|
+
*/
|
|
58
|
+
unSelectMulti: (items: RecordType[]) => void;
|
|
47
59
|
}
|
|
48
60
|
type RowSelectionParams<T> = Omit<ApTableRowSelection<T>, 'mode'> & {
|
|
49
61
|
/**
|