@aplus-frontend/ui 7.15.8 → 7.17.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 +285 -281
- package/es/src/ag-grid/components/header-cell/index.vue2.mjs +56 -41
- package/es/src/ag-grid/context.d.ts +8 -0
- package/es/src/ag-grid/context.mjs +18 -7
- package/es/src/ag-grid/hooks/use-columns-def.d.ts +2 -2
- package/es/src/ag-grid/hooks/use-columns-def.mjs +64 -61
- package/es/src/ag-grid/hooks/use-columns.mjs +39 -30
- package/es/src/ag-grid/index.vue.mjs +270 -255
- package/es/src/ag-grid/interface.d.ts +20 -1
- package/es/src/ag-grid/style/custom-header.mjs +22 -13
- package/es/src/ap-field/cascader/index.vue.d.ts +60 -0
- package/es/src/ap-field/cascader/index.vue.mjs +217 -0
- package/es/src/ap-field/cascader/index.vue2.mjs +4 -0
- package/es/src/ap-field/cascader/read.vue.d.ts +8 -0
- package/es/src/ap-field/cascader/read.vue.mjs +4 -0
- package/es/src/ap-field/cascader/read.vue2.mjs +159 -0
- package/es/src/ap-field/cascader/use-options.d.ts +25 -0
- package/es/src/ap-field/cascader/use-options.mjs +66 -0
- package/es/src/ap-field/hooks/use-default-placeholder.d.ts +3 -1
- package/es/src/ap-field/hooks/use-default-placeholder.mjs +13 -8
- package/es/src/ap-field/index.d.ts +8 -2
- package/es/src/ap-field/index.mjs +72 -65
- package/es/src/ap-field/interface.d.ts +27 -1
- package/es/src/ap-field/tree-select/index.vue.mjs +43 -39
- package/es/src/ap-field/tree-select/use-request.mjs +22 -19
- package/es/src/ap-form/items/cascader/index.vue.d.ts +435 -0
- package/es/src/ap-form/items/cascader/index.vue.mjs +102 -0
- package/es/src/ap-form/items/cascader/index.vue2.mjs +4 -0
- package/es/src/ap-form/items/index.d.ts +2 -1
- package/es/src/ap-form/items/index.mjs +3 -2
- package/es/src/ap-form/items/interface.d.ts +6 -1
- package/es/src/ap-table/components/setting/sortable/item.vue2.mjs +86 -65
- package/es/src/ap-table/constants.d.ts +269 -4
- package/es/src/ap-table/constants.mjs +29 -26
- package/es/src/ap-table/interface.d.ts +5 -1
- package/es/src/ap-table/style/setting.mjs +30 -27
- package/es/src/ap-table/utils.d.ts +1 -1
- package/es/src/business/ag-grid-modal/interface.d.ts +4 -0
- package/es/src/business/ag-grid-modal/modal-layout/index.vue.d.ts +1 -0
- package/es/src/business/ag-grid-modal/modal-layout/index.vue2.mjs +25 -21
- package/es/src/business/ag-grid-modal/style/index.mjs +1 -1
- package/es/src/business/ag-grid-modal/utils.d.ts +1 -0
- package/es/src/index.mjs +250 -246
- package/es/src/locale/lang/en.mjs +1 -0
- package/es/src/locale/lang/zh-cn.mjs +1 -0
- package/es/src/version.d.ts +1 -1
- package/es/src/version.mjs +1 -1
- package/lib/index.js +1 -1
- package/lib/src/ag-grid/components/header-cell/index.vue2.js +1 -1
- package/lib/src/ag-grid/context.d.ts +8 -0
- package/lib/src/ag-grid/context.js +1 -1
- package/lib/src/ag-grid/hooks/use-columns-def.d.ts +2 -2
- package/lib/src/ag-grid/hooks/use-columns-def.js +1 -1
- package/lib/src/ag-grid/hooks/use-columns.js +1 -1
- package/lib/src/ag-grid/index.vue.js +1 -1
- package/lib/src/ag-grid/interface.d.ts +20 -1
- package/lib/src/ag-grid/style/custom-header.js +1 -1
- package/lib/src/ap-field/cascader/index.vue.d.ts +60 -0
- package/lib/src/ap-field/cascader/index.vue.js +1 -0
- package/lib/src/ap-field/cascader/index.vue2.js +1 -0
- package/lib/src/ap-field/cascader/read.vue.d.ts +8 -0
- package/lib/src/ap-field/cascader/read.vue.js +1 -0
- package/lib/src/ap-field/cascader/read.vue2.js +1 -0
- package/lib/src/ap-field/cascader/use-options.d.ts +25 -0
- package/lib/src/ap-field/cascader/use-options.js +1 -0
- package/lib/src/ap-field/hooks/use-default-placeholder.d.ts +3 -1
- package/lib/src/ap-field/hooks/use-default-placeholder.js +1 -1
- package/lib/src/ap-field/index.d.ts +8 -2
- package/lib/src/ap-field/index.js +1 -1
- package/lib/src/ap-field/interface.d.ts +27 -1
- package/lib/src/ap-field/tree-select/index.vue.js +1 -1
- package/lib/src/ap-field/tree-select/use-request.js +1 -1
- package/lib/src/ap-form/items/cascader/index.vue.d.ts +435 -0
- package/lib/src/ap-form/items/cascader/index.vue.js +1 -0
- package/lib/src/ap-form/items/cascader/index.vue2.js +1 -0
- package/lib/src/ap-form/items/index.d.ts +2 -1
- package/lib/src/ap-form/items/index.js +1 -1
- package/lib/src/ap-form/items/interface.d.ts +6 -1
- package/lib/src/ap-table/components/setting/sortable/item.vue2.js +1 -1
- package/lib/src/ap-table/constants.d.ts +269 -4
- package/lib/src/ap-table/constants.js +1 -1
- package/lib/src/ap-table/interface.d.ts +5 -1
- package/lib/src/ap-table/style/setting.js +1 -1
- package/lib/src/ap-table/utils.d.ts +1 -1
- package/lib/src/business/ag-grid-modal/interface.d.ts +4 -0
- package/lib/src/business/ag-grid-modal/modal-layout/index.vue.d.ts +1 -0
- package/lib/src/business/ag-grid-modal/modal-layout/index.vue2.js +1 -1
- package/lib/src/business/ag-grid-modal/style/index.js +1 -1
- package/lib/src/business/ag-grid-modal/utils.d.ts +1 -0
- package/lib/src/index.js +1 -1
- package/lib/src/locale/lang/en.js +1 -1
- package/lib/src/locale/lang/zh-cn.js +1 -1
- package/lib/src/version.d.ts +1 -1
- package/lib/src/version.js +1 -1
- package/package.json +4 -4
|
@@ -1,67 +1,82 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { CaretUpOutlined as V, CaretDownOutlined as
|
|
3
|
-
import { useToken as
|
|
4
|
-
import { useInjectSorter as
|
|
5
|
-
import { getTableTitle as
|
|
1
|
+
import { defineComponent as L, computed as l, createElementBlock as u, openBlock as o, normalizeClass as a, unref as e, createVNode as m, createCommentVNode as h, withModifiers as R, createBlock as S } from "vue";
|
|
2
|
+
import { CaretUpOutlined as V, CaretDownOutlined as _, CaretLeftOutlined as z, CaretRightOutlined as A } from "@ant-design/icons-vue";
|
|
3
|
+
import { useToken as M } from "@aplus-frontend/antdv/es/theme/internal";
|
|
4
|
+
import { useInjectSorter as U, useInjectExpandable as $ } from "../../context.mjs";
|
|
5
|
+
import { getTableTitle as q } from "../../../ap-table/utils.mjs";
|
|
6
6
|
import "../../../config-provider/index.mjs";
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
|
|
7
|
+
import "../../../render/index.mjs";
|
|
8
|
+
import F from "../../style/custom-header.mjs";
|
|
9
|
+
import { useNamespace as k } from "../../../config-provider/hooks/use-namespace.mjs";
|
|
10
|
+
import H from "../../../render/render.mjs";
|
|
11
|
+
const oe = /* @__PURE__ */ L({
|
|
10
12
|
__name: "index",
|
|
11
13
|
props: {
|
|
12
14
|
params: {}
|
|
13
15
|
},
|
|
14
|
-
setup(
|
|
15
|
-
const
|
|
16
|
-
|
|
16
|
+
setup(v) {
|
|
17
|
+
const r = v, { b, e: n } = k("ag-custom-header"), { be: x, bem: I } = k("ag-grid"), y = F("ag-custom-header"), [, T] = M(), { sorter: p, setSorter: w } = U(), { expandable: E } = $(), s = l(() => r.params.column.sorter), G = l(() => r.params.columnGroup?.getLeafColumns?.()?.some((t) => t.getColDef().columnGroupShow)), i = l(() => {
|
|
18
|
+
const t = r.params.columnGroup?.getGroupId?.();
|
|
19
|
+
return t ? E.value[t] ?? !1 : !1;
|
|
20
|
+
});
|
|
21
|
+
function N(t) {
|
|
17
22
|
return t ? t === "asc" ? "desc" : null : "asc";
|
|
18
23
|
}
|
|
19
|
-
const
|
|
20
|
-
function
|
|
21
|
-
if (!
|
|
24
|
+
const d = l(() => r.params?.column?.getColId?.());
|
|
25
|
+
function O() {
|
|
26
|
+
if (!s.value)
|
|
22
27
|
return;
|
|
23
|
-
const
|
|
24
|
-
...
|
|
25
|
-
sort:
|
|
28
|
+
const c = r.params.column.getColId(), j = r.params.column.getSort(), f = N(j), g = r.params.api, D = g.getColumnState().map((C) => ({
|
|
29
|
+
...C,
|
|
30
|
+
sort: C.colId === c ? f : null
|
|
26
31
|
}));
|
|
27
|
-
|
|
28
|
-
state:
|
|
29
|
-
}),
|
|
32
|
+
g.applyColumnState({
|
|
33
|
+
state: D
|
|
34
|
+
}), w({ [c]: f });
|
|
30
35
|
}
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
36
|
+
function B() {
|
|
37
|
+
r.params.setExpanded(!i.value);
|
|
38
|
+
}
|
|
39
|
+
return (t, c) => (o(), u("div", {
|
|
40
|
+
class: a([
|
|
41
|
+
e(b)(),
|
|
42
|
+
{ sortable: s.value },
|
|
35
43
|
`align-${t.params.column.align || "left"}`,
|
|
36
|
-
e(
|
|
44
|
+
e(y)
|
|
37
45
|
]),
|
|
38
|
-
onClick:
|
|
46
|
+
onClick: O
|
|
39
47
|
}, [
|
|
40
|
-
(
|
|
41
|
-
e(
|
|
48
|
+
m(e(H), {
|
|
49
|
+
renderer: () => e(q)(
|
|
42
50
|
t.params.column,
|
|
43
51
|
[
|
|
44
|
-
e(
|
|
45
|
-
t.params.column.tooltip ? "" : e(
|
|
52
|
+
e(x)("table-header", "title"),
|
|
53
|
+
t.params.column.tooltip ? "" : e(I)("table-header", "title", "single")
|
|
46
54
|
],
|
|
47
|
-
|
|
48
|
-
e(
|
|
55
|
+
t.params.headerCell,
|
|
56
|
+
e(T).colorTextTertiary
|
|
49
57
|
)
|
|
50
|
-
)
|
|
51
|
-
|
|
58
|
+
}, null, 8, ["renderer"]),
|
|
59
|
+
s.value ? (o(), u("span", {
|
|
52
60
|
key: 0,
|
|
53
|
-
class:
|
|
61
|
+
class: a(e(n)("sort-wrapper"))
|
|
54
62
|
}, [
|
|
55
|
-
|
|
56
|
-
class:
|
|
63
|
+
m(e(V), {
|
|
64
|
+
class: a({ [e(n)("sorter-up")]: !0, active: e(p)[d.value] === "asc" })
|
|
57
65
|
}, null, 8, ["class"]),
|
|
58
|
-
|
|
59
|
-
class:
|
|
66
|
+
m(e(_), {
|
|
67
|
+
class: a({ [e(n)("sorter-down")]: !0, active: e(p)[d.value] === "desc" })
|
|
60
68
|
}, null, 8, ["class"])
|
|
61
|
-
], 2)) :
|
|
69
|
+
], 2)) : h("", !0),
|
|
70
|
+
G.value ? (o(), u("span", {
|
|
71
|
+
key: 1,
|
|
72
|
+
class: a(e(n)("expand-wrapper")),
|
|
73
|
+
onClick: R(B, ["stop"])
|
|
74
|
+
}, [
|
|
75
|
+
i.value ? (o(), S(e(z), { key: 0 })) : (o(), S(e(A), { key: 1 }))
|
|
76
|
+
], 2)) : h("", !0)
|
|
62
77
|
], 2));
|
|
63
78
|
}
|
|
64
79
|
});
|
|
65
80
|
export {
|
|
66
|
-
|
|
81
|
+
oe as default
|
|
67
82
|
};
|
|
@@ -12,7 +12,15 @@ type AgGridSorterContextProps = {
|
|
|
12
12
|
*/
|
|
13
13
|
setSorter: (nextSorter: Recordable) => void;
|
|
14
14
|
};
|
|
15
|
+
type AgGirdColumnExpandedContextProps = {
|
|
16
|
+
expandable: Ref<Recordable<boolean>>;
|
|
17
|
+
};
|
|
18
|
+
export declare const AgGridExpandableContextKey: InjectionKey<AgGirdColumnExpandedContextProps>;
|
|
15
19
|
export declare const AgGridSorterContextKey: InjectionKey<AgGridSorterContextProps>;
|
|
20
|
+
export declare function useProvideExpandable(state: AgGirdColumnExpandedContextProps): void;
|
|
21
|
+
export declare function useInjectExpandable(): {
|
|
22
|
+
expandable: Ref<Recordable<boolean>, Recordable<boolean>>;
|
|
23
|
+
};
|
|
16
24
|
export declare function useProvideSorter(state: AgGridSorterContextProps): void;
|
|
17
25
|
export declare function useInjectSorter(): AgGridSorterContextProps;
|
|
18
26
|
export {};
|
|
@@ -1,17 +1,28 @@
|
|
|
1
|
-
import { provide as
|
|
2
|
-
const
|
|
1
|
+
import { provide as r, inject as t, ref as n } from "vue";
|
|
2
|
+
const o = /* @__PURE__ */ Symbol("agGridExpandableKey"), i = /* @__PURE__ */ Symbol("agGridSorterContextKey");
|
|
3
|
+
function d(e) {
|
|
4
|
+
r(o, e);
|
|
5
|
+
}
|
|
6
|
+
function u() {
|
|
7
|
+
return t(o, {
|
|
8
|
+
expandable: n({})
|
|
9
|
+
});
|
|
10
|
+
}
|
|
3
11
|
function c(e) {
|
|
4
|
-
|
|
12
|
+
r(i, e);
|
|
5
13
|
}
|
|
6
|
-
function
|
|
7
|
-
return
|
|
14
|
+
function x() {
|
|
15
|
+
return t(i, {
|
|
8
16
|
sorter: n({}),
|
|
9
17
|
setSorter: () => {
|
|
10
18
|
}
|
|
11
19
|
});
|
|
12
20
|
}
|
|
13
21
|
export {
|
|
14
|
-
|
|
15
|
-
|
|
22
|
+
o as AgGridExpandableContextKey,
|
|
23
|
+
i as AgGridSorterContextKey,
|
|
24
|
+
u as useInjectExpandable,
|
|
25
|
+
x as useInjectSorter,
|
|
26
|
+
d as useProvideExpandable,
|
|
16
27
|
c as useProvideSorter
|
|
17
28
|
};
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { CellClassFunc, ColDef, ColGroupDef } from 'ag-grid-community';
|
|
2
2
|
import { Ref, ComputedRef } from 'vue';
|
|
3
|
-
import { AgGridColumnType, AgGridProps } from '../interface';
|
|
3
|
+
import { AgGridColumnType, AgGridProps, AgGridSlots } from '../interface';
|
|
4
4
|
/**
|
|
5
5
|
* 维护AgGrid列配置
|
|
6
6
|
* @param shownColumns
|
|
7
7
|
* @param props
|
|
8
8
|
* @returns
|
|
9
9
|
*/
|
|
10
|
-
export declare const useColumnsDef: <RecordType>(columns: Ref<AgGridColumnType<RecordType>[]>, props: AgGridProps<RecordType>, customCellClass: (callback: CellClassFunc) => CellClassFunc) => {
|
|
10
|
+
export declare const useColumnsDef: <RecordType>(columns: Ref<AgGridColumnType<RecordType>[]>, props: AgGridProps<RecordType>, customCellClass: (callback: CellClassFunc) => CellClassFunc, headerCell?: AgGridSlots<RecordType>["headerCell"]) => {
|
|
11
11
|
columnDefs: ComputedRef<(ColDef<any, any> | ColGroupDef<any>)[]>;
|
|
12
12
|
defaultColDef: ComputedRef<ColDef<any, any>>;
|
|
13
13
|
gridWrapperRef: Ref<HTMLDivElement | undefined, HTMLDivElement | undefined>;
|
|
@@ -1,36 +1,36 @@
|
|
|
1
|
-
import { isNumber as u, isFunction as
|
|
2
|
-
import { ref as
|
|
3
|
-
import { dataIndexToField as
|
|
4
|
-
import { getTableRenderProps as
|
|
1
|
+
import { isNumber as u, isFunction as b } from "lodash-unified";
|
|
2
|
+
import { ref as D, unref as C, computed as h } from "vue";
|
|
3
|
+
import { dataIndexToField as P } from "../../ap-grid/utils/col.mjs";
|
|
4
|
+
import { getTableRenderProps as m, objectToString as G } from "../../ap-table/utils.mjs";
|
|
5
5
|
import "../../config-provider/index.mjs";
|
|
6
6
|
import "../../utils/index.mjs";
|
|
7
7
|
import "../components/body-cell/index.vue.mjs";
|
|
8
8
|
import "../components/header-cell/index.vue.mjs";
|
|
9
9
|
import "../components/tooltip/index.vue.mjs";
|
|
10
|
-
import { rendererMap as
|
|
10
|
+
import { rendererMap as T } from "../renderer/index.mjs";
|
|
11
11
|
import { useGlobalConfig as I } from "../../config-provider/hooks/use-global-config.mjs";
|
|
12
12
|
import { useNamespace as _ } from "../../config-provider/hooks/use-namespace.mjs";
|
|
13
|
-
import
|
|
14
|
-
import
|
|
15
|
-
import { isDef as
|
|
16
|
-
import
|
|
17
|
-
function
|
|
13
|
+
import W from "../components/body-cell/index.vue2.mjs";
|
|
14
|
+
import z from "../components/tooltip/index.vue2.mjs";
|
|
15
|
+
import { isDef as F } from "../../utils/is.mjs";
|
|
16
|
+
import c from "../components/header-cell/index.vue2.mjs";
|
|
17
|
+
function M(t) {
|
|
18
18
|
return u(t) && t > 1;
|
|
19
19
|
}
|
|
20
|
-
function
|
|
21
|
-
if (
|
|
22
|
-
return
|
|
23
|
-
if (
|
|
24
|
-
return
|
|
20
|
+
function V(t, i) {
|
|
21
|
+
if (i.bodyCellTooltip)
|
|
22
|
+
return b(i.bodyCellTooltip) ? i.bodyCellTooltip(t.value, t.data) : i.bodyCellTooltip;
|
|
23
|
+
if (i.renderText)
|
|
24
|
+
return i.renderText({
|
|
25
25
|
value: t.value,
|
|
26
26
|
record: t.data,
|
|
27
|
-
column:
|
|
27
|
+
column: i,
|
|
28
28
|
text: t.value
|
|
29
29
|
});
|
|
30
|
-
const
|
|
31
|
-
if (
|
|
32
|
-
const f =
|
|
33
|
-
{ ...
|
|
30
|
+
const p = i.valueType || "text", d = T[p];
|
|
31
|
+
if (d) {
|
|
32
|
+
const f = m(
|
|
33
|
+
{ ...i, valueType: p },
|
|
34
34
|
{
|
|
35
35
|
value: t.value,
|
|
36
36
|
text: t.value,
|
|
@@ -40,22 +40,22 @@ function M(t, a) {
|
|
|
40
40
|
pinned: t.node?.rowPinned
|
|
41
41
|
}
|
|
42
42
|
);
|
|
43
|
-
return
|
|
43
|
+
return d(f);
|
|
44
44
|
}
|
|
45
|
-
return
|
|
45
|
+
return G(t.value);
|
|
46
46
|
}
|
|
47
|
-
const
|
|
48
|
-
const
|
|
49
|
-
const
|
|
50
|
-
cellRenderer:
|
|
47
|
+
const Z = (t, i, p, d) => {
|
|
48
|
+
const v = I("valueTypeMap"), f = D(), { em: y } = _("ag-grid"), w = (r) => {
|
|
49
|
+
const a = {
|
|
50
|
+
cellRenderer: W,
|
|
51
51
|
cellRendererParams: {
|
|
52
52
|
column: r,
|
|
53
|
-
extraValueType:
|
|
54
|
-
rowKey:
|
|
53
|
+
extraValueType: C(v),
|
|
54
|
+
rowKey: i.rowKey
|
|
55
55
|
}
|
|
56
56
|
};
|
|
57
57
|
if (r.customRender)
|
|
58
|
-
return
|
|
58
|
+
return a;
|
|
59
59
|
if (r.renderText)
|
|
60
60
|
return {
|
|
61
61
|
valueFormatter: (o) => r.renderText({
|
|
@@ -65,10 +65,10 @@ const Y = (t, a, d) => {
|
|
|
65
65
|
text: o.value
|
|
66
66
|
})
|
|
67
67
|
};
|
|
68
|
-
const s = r.valueType || "text", e =
|
|
68
|
+
const s = r.valueType || "text", e = T[s];
|
|
69
69
|
return e ? {
|
|
70
70
|
valueFormatter: (o) => {
|
|
71
|
-
const l =
|
|
71
|
+
const l = m(
|
|
72
72
|
{ ...r, valueType: s },
|
|
73
73
|
{
|
|
74
74
|
value: o.value,
|
|
@@ -81,26 +81,27 @@ const Y = (t, a, d) => {
|
|
|
81
81
|
);
|
|
82
82
|
return e(l);
|
|
83
83
|
}
|
|
84
|
-
} :
|
|
85
|
-
},
|
|
86
|
-
const
|
|
87
|
-
return e.tooltipValueGetter = o ? (
|
|
84
|
+
} : a;
|
|
85
|
+
}, g = (r) => {
|
|
86
|
+
const a = r.valueType || "text", s = T[a], e = {}, o = r.bodyCellTooltip || !r.customRender && s && (r.ellipsis === !0 || r.ellipsis === "tooltip" || u(r.ellipsis)), l = u(r.ellipsis) && r.ellipsis > 1, n = u(r.ellipsis) ? r.ellipsis : 1;
|
|
87
|
+
return e.tooltipValueGetter = o ? (x) => V(x, r) : void 0, e.wrapText = !r.ellipsis || l, e.cellStyle = {
|
|
88
88
|
"--ag-grid-line-clamp": n
|
|
89
|
-
}, e.tooltipComponent =
|
|
89
|
+
}, e.tooltipComponent = z, e.tooltipComponentParams = {
|
|
90
90
|
lineClamp: n,
|
|
91
|
-
gridWrapperRef:
|
|
91
|
+
gridWrapperRef: f
|
|
92
92
|
}, e;
|
|
93
|
-
},
|
|
94
|
-
const r =
|
|
95
|
-
function
|
|
93
|
+
}, S = h(() => {
|
|
94
|
+
const r = C(t);
|
|
95
|
+
function a(s) {
|
|
96
96
|
return s.map((e) => {
|
|
97
97
|
const o = {
|
|
98
|
-
field:
|
|
99
|
-
colId:
|
|
98
|
+
field: P(e.dataIndex),
|
|
99
|
+
colId: F(e.key) ? String(e.key) : void 0,
|
|
100
100
|
sortable: !!e.sorter,
|
|
101
101
|
comparator: e.sorter === !0 ? () => 0 : e.sorter,
|
|
102
102
|
headerComponentParams: {
|
|
103
|
-
column: e
|
|
103
|
+
column: e,
|
|
104
|
+
headerCell: d
|
|
104
105
|
},
|
|
105
106
|
resizable: e.resizable,
|
|
106
107
|
width: e.width,
|
|
@@ -108,53 +109,55 @@ const Y = (t, a, d) => {
|
|
|
108
109
|
maxWidth: e.maxWidth,
|
|
109
110
|
suppressKeyboardEvent: () => !0,
|
|
110
111
|
// 避免单元格内元素事件被劫持
|
|
111
|
-
flex: e.width ? void 0 : 1,
|
|
112
|
+
flex: e.width ? void 0 : e.flex ?? 1,
|
|
112
113
|
// 如果没有设置确切的宽度,则设置为可自由伸缩列
|
|
113
114
|
pinned: e.fixed || null,
|
|
114
115
|
// undefined to null
|
|
115
116
|
colSpan: e.colSpan,
|
|
116
117
|
spanRows: e.spanRows,
|
|
117
|
-
cellClass:
|
|
118
|
-
const n = e.cellClass || "",
|
|
118
|
+
cellClass: p((l) => {
|
|
119
|
+
const n = e.cellClass || "", x = b(n) ? n(l.data, l.node) : n;
|
|
119
120
|
return [
|
|
120
|
-
`${
|
|
121
|
-
|
|
122
|
-
|
|
121
|
+
`${y("cell", e.align || "left")}`,
|
|
122
|
+
M(e.ellipsis) ? y("cell", "multiline") : null,
|
|
123
|
+
x
|
|
123
124
|
].flat().filter(Boolean);
|
|
124
125
|
}),
|
|
125
126
|
cellStyle: e.cellStyle,
|
|
126
127
|
headerStyle: e.headerStyle,
|
|
127
128
|
headerClass: e.headerClass,
|
|
129
|
+
columnGroupShow: e.columnGroupShow,
|
|
128
130
|
autoHeight: !0,
|
|
129
131
|
// 设置自动计算高度以自适应多行换行的场景
|
|
130
|
-
...
|
|
131
|
-
...
|
|
132
|
+
...g(e),
|
|
133
|
+
...w(e)
|
|
132
134
|
};
|
|
133
135
|
return e.children?.length ? {
|
|
134
136
|
...o,
|
|
135
|
-
headerGroupComponent:
|
|
137
|
+
headerGroupComponent: c,
|
|
136
138
|
headerGroupComponentParams: {
|
|
137
|
-
column: e
|
|
139
|
+
column: e,
|
|
140
|
+
headerCell: d
|
|
138
141
|
},
|
|
139
|
-
children:
|
|
142
|
+
children: a(e.children)
|
|
140
143
|
} : o;
|
|
141
144
|
});
|
|
142
145
|
}
|
|
143
|
-
return
|
|
144
|
-
}), R =
|
|
146
|
+
return a(r);
|
|
147
|
+
}), R = h(
|
|
145
148
|
() => ({
|
|
146
|
-
headerComponent:
|
|
147
|
-
resizable:
|
|
149
|
+
headerComponent: c,
|
|
150
|
+
resizable: i.columnResizable,
|
|
148
151
|
suppressMovable: !0,
|
|
149
152
|
cellDataType: !1
|
|
150
153
|
})
|
|
151
154
|
);
|
|
152
155
|
return {
|
|
153
|
-
columnDefs:
|
|
156
|
+
columnDefs: S,
|
|
154
157
|
defaultColDef: R,
|
|
155
|
-
gridWrapperRef:
|
|
158
|
+
gridWrapperRef: f
|
|
156
159
|
};
|
|
157
160
|
};
|
|
158
161
|
export {
|
|
159
|
-
|
|
162
|
+
Z as useColumnsDef
|
|
160
163
|
};
|
|
@@ -1,51 +1,60 @@
|
|
|
1
|
-
import { ref as c, computed as s, watch as
|
|
2
|
-
import { getStringKey as
|
|
3
|
-
const
|
|
4
|
-
const
|
|
5
|
-
function
|
|
6
|
-
return
|
|
1
|
+
import { ref as c, computed as s, watch as h } from "vue";
|
|
2
|
+
import { getStringKey as d } from "../utils.mjs";
|
|
3
|
+
const C = (o) => {
|
|
4
|
+
const t = c([]), u = c([]);
|
|
5
|
+
function l(n = []) {
|
|
6
|
+
return n.filter((e) => !e.hideInTable).map((e) => {
|
|
7
|
+
if (e.children?.length) {
|
|
8
|
+
const r = l(e.children);
|
|
9
|
+
return r?.length ? {
|
|
10
|
+
...e,
|
|
11
|
+
children: r
|
|
12
|
+
} : null;
|
|
13
|
+
}
|
|
14
|
+
return e;
|
|
15
|
+
}).filter(Boolean);
|
|
7
16
|
}
|
|
8
|
-
function
|
|
9
|
-
return
|
|
17
|
+
function f(n) {
|
|
18
|
+
return t.value.find((e) => d(e.key) === n);
|
|
10
19
|
}
|
|
11
|
-
const
|
|
12
|
-
() =>
|
|
20
|
+
const m = s(
|
|
21
|
+
() => t.value.map((n) => d(n.key)).filter(Boolean)
|
|
13
22
|
);
|
|
14
|
-
|
|
15
|
-
() =>
|
|
23
|
+
h(
|
|
24
|
+
() => o.columns,
|
|
16
25
|
() => {
|
|
17
|
-
const
|
|
18
|
-
|
|
26
|
+
const n = l(o.columns);
|
|
27
|
+
t.value = n, u.value = n, o.onShownColumnsChange?.(n);
|
|
19
28
|
},
|
|
20
29
|
{
|
|
21
30
|
deep: !0,
|
|
22
31
|
immediate: !0
|
|
23
32
|
}
|
|
24
33
|
);
|
|
25
|
-
function
|
|
26
|
-
for (const
|
|
27
|
-
if (
|
|
28
|
-
const
|
|
29
|
-
if (
|
|
30
|
-
return
|
|
31
|
-
} else if (
|
|
32
|
-
const
|
|
34
|
+
function i(n) {
|
|
35
|
+
for (const e of n)
|
|
36
|
+
if (e.children) {
|
|
37
|
+
const r = i(e.children);
|
|
38
|
+
if (r)
|
|
39
|
+
return r;
|
|
40
|
+
} else if (e.defaultSortOrder) {
|
|
41
|
+
const r = e.field ?? e.dataIndex ?? e.key;
|
|
33
42
|
return {
|
|
34
|
-
colKey:
|
|
35
|
-
field:
|
|
36
|
-
order:
|
|
43
|
+
colKey: e.key,
|
|
44
|
+
field: r,
|
|
45
|
+
order: e.defaultSortOrder
|
|
37
46
|
};
|
|
38
47
|
}
|
|
39
48
|
}
|
|
40
|
-
const a = s(() =>
|
|
49
|
+
const a = s(() => i(t.value));
|
|
41
50
|
return {
|
|
42
|
-
columns:
|
|
51
|
+
columns: t,
|
|
43
52
|
shownColumns: u,
|
|
44
|
-
columnKeys:
|
|
45
|
-
getTargetColumnByKey:
|
|
53
|
+
columnKeys: m,
|
|
54
|
+
getTargetColumnByKey: f,
|
|
46
55
|
defaultSortOrder: a
|
|
47
56
|
};
|
|
48
57
|
};
|
|
49
58
|
export {
|
|
50
|
-
|
|
59
|
+
C as useColumns
|
|
51
60
|
};
|