@aplus-frontend/ui 0.2.0-beta.2 → 0.2.0-beta.3
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 +59 -52
- package/es/src/ap-field/interface.d.ts +6 -0
- package/es/src/ap-field/select/index.vue.mjs +14 -13
- package/es/src/ap-form/item/index.vue.mjs +58 -58
- package/es/src/ap-table/ap-table.vue.d.ts +2 -0
- package/es/src/ap-table/ap-table.vue.mjs +28 -27
- package/es/src/ap-table/constants.d.ts +18 -30
- package/es/src/ap-table/utils.d.ts +33 -3
- package/es/src/ap-table/utils.mjs +69 -69
- package/es/src/business/ap-summary/ap-summary.vue.d.ts +30 -0
- package/es/src/business/ap-summary/ap-summary.vue.mjs +4 -0
- package/es/src/business/ap-summary/ap-summary.vue2.mjs +68 -0
- package/es/src/business/ap-summary/index.d.ts +95 -0
- package/es/src/business/ap-summary/index.mjs +13 -0
- package/es/src/business/ap-summary/interface.d.ts +41 -0
- package/es/src/business/ap-summary/interface.mjs +1 -0
- package/es/src/business/ap-summary/style/css.d.ts +0 -0
- package/es/src/business/ap-summary/style/css.js +1 -0
- package/es/src/business/ap-summary/style/index.d.ts +0 -0
- package/es/src/business/ap-summary/style/index.js +1 -0
- package/es/src/business/ap-summary/utils.d.ts +12 -0
- package/es/src/business/ap-summary/utils.mjs +36 -0
- package/es/src/business/index.d.ts +1 -0
- package/es/src/business/index.mjs +16 -14
- package/es/src/editable-table/utils.mjs +51 -51
- package/es/src/hooks/useControllableValue.d.ts +8 -3
- package/es/src/hooks/useControllableValue.mjs +18 -13
- package/es/src/index.mjs +59 -52
- package/es/src/utils/slot.d.ts +9 -1
- package/es/src/utils/slot.mjs +10 -6
- package/lib/index.js +1 -1
- package/lib/src/ap-field/interface.d.ts +6 -0
- package/lib/src/ap-field/select/index.vue.js +1 -1
- package/lib/src/ap-form/item/index.vue.js +1 -1
- package/lib/src/ap-table/ap-table.vue.d.ts +2 -0
- package/lib/src/ap-table/ap-table.vue.js +1 -1
- package/lib/src/ap-table/constants.d.ts +18 -30
- package/lib/src/ap-table/utils.d.ts +33 -3
- package/lib/src/ap-table/utils.js +1 -1
- package/lib/src/business/ap-summary/ap-summary.vue.d.ts +30 -0
- package/lib/src/business/ap-summary/ap-summary.vue.js +1 -0
- package/lib/src/business/ap-summary/ap-summary.vue2.js +1 -0
- package/lib/src/business/ap-summary/index.d.ts +95 -0
- package/lib/src/business/ap-summary/index.js +1 -0
- package/lib/src/business/ap-summary/interface.d.ts +41 -0
- package/lib/src/business/ap-summary/interface.js +1 -0
- package/lib/src/business/ap-summary/style/css.d.ts +0 -0
- package/lib/src/business/ap-summary/style/css.js +1 -0
- package/lib/src/business/ap-summary/style/index.d.ts +0 -0
- package/lib/src/business/ap-summary/style/index.js +1 -0
- package/lib/src/business/ap-summary/utils.d.ts +12 -0
- package/lib/src/business/ap-summary/utils.js +1 -0
- package/lib/src/business/index.d.ts +1 -0
- package/lib/src/business/index.js +1 -1
- package/lib/src/editable-table/utils.js +1 -1
- package/lib/src/hooks/useControllableValue.d.ts +8 -3
- package/lib/src/hooks/useControllableValue.js +1 -1
- package/lib/src/index.js +1 -1
- package/lib/src/utils/slot.d.ts +9 -1
- package/lib/src/utils/slot.js +1 -1
- package/package.json +3 -3
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { defineComponent as k, computed as S, openBlock as o, createBlock as u, unref as n, normalizeClass as i, withCtx as c, createElementBlock as g, Fragment as T, renderList as _, normalizeStyle as C, createTextVNode as b, toDisplayString as L } from "vue";
|
|
2
|
+
import { isNil as N, get as w } from "lodash-unified";
|
|
3
|
+
import { TableSummaryRow as B, TableSummaryCell as z } from "ant-design-vue";
|
|
4
|
+
import { flattenColumns as A, formatDataIndex as D } from "./utils.mjs";
|
|
5
|
+
import "../../config-provider/index.mjs";
|
|
6
|
+
import { isNumeric as F, toThousand as I, toFixed as v } from "@aplus-frontend/utils";
|
|
7
|
+
import { useNamespace as E } from "../../config-provider/hooks/use-namespace.mjs";
|
|
8
|
+
const J = /* @__PURE__ */ k({
|
|
9
|
+
name: "ApSummary",
|
|
10
|
+
__name: "ap-summary",
|
|
11
|
+
props: {
|
|
12
|
+
data: {},
|
|
13
|
+
columns: {},
|
|
14
|
+
summaryTitle: {
|
|
15
|
+
default: "合计"
|
|
16
|
+
},
|
|
17
|
+
hasSelect: {
|
|
18
|
+
type: Boolean,
|
|
19
|
+
default: !0
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
setup(p) {
|
|
23
|
+
const s = p, y = (e) => e === 0, d = (e, r) => {
|
|
24
|
+
var l;
|
|
25
|
+
if (!e || !F(e) || r.valueType !== "number")
|
|
26
|
+
return e;
|
|
27
|
+
const t = (l = r.fieldProps) == null ? void 0 : l.field, a = (t == null ? void 0 : t.precision) || 0;
|
|
28
|
+
return (N(t == null ? void 0 : t.thousands) ? !0 : t == null ? void 0 : t.thousands) ? I(e, a) : v(e, a);
|
|
29
|
+
}, f = S(() => {
|
|
30
|
+
let e = [];
|
|
31
|
+
s.hasSelect && e.push({
|
|
32
|
+
key: "select",
|
|
33
|
+
rowSpan: 1,
|
|
34
|
+
align: "left",
|
|
35
|
+
value: ""
|
|
36
|
+
});
|
|
37
|
+
const t = A(s.columns).map((a, m) => ({
|
|
38
|
+
key: a.key,
|
|
39
|
+
rowSpan: 1,
|
|
40
|
+
align: a.align,
|
|
41
|
+
value: y(m) ? s.summaryTitle : d(w(s.data, D(a.dataIndex || a.key)), a)
|
|
42
|
+
}));
|
|
43
|
+
return e.concat(t);
|
|
44
|
+
}), {
|
|
45
|
+
b: h,
|
|
46
|
+
e: x
|
|
47
|
+
} = E("ap-summary");
|
|
48
|
+
return (e, r) => (o(), u(n(B), {
|
|
49
|
+
class: i(n(h)())
|
|
50
|
+
}, {
|
|
51
|
+
default: c(() => [(o(!0), g(T, null, _(f.value, (t, a) => (o(), u(n(z), {
|
|
52
|
+
class: i(n(x)("item")),
|
|
53
|
+
key: t.key,
|
|
54
|
+
index: a,
|
|
55
|
+
style: C({
|
|
56
|
+
textAlign: t.align
|
|
57
|
+
})
|
|
58
|
+
}, {
|
|
59
|
+
default: c(() => [b(L(t.value), 1)]),
|
|
60
|
+
_: 2
|
|
61
|
+
}, 1032, ["class", "index", "style"]))), 128))]),
|
|
62
|
+
_: 1
|
|
63
|
+
}, 8, ["class"]));
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
export {
|
|
67
|
+
J as default
|
|
68
|
+
};
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import { CreateComponentPublicInstance, ExtractPropTypes, PropType, ComponentOptionsMixin, VNodeProps, AllowedComponentProps, ComponentCustomProps, ComponentOptionsBase, Plugin } from 'vue';
|
|
2
|
+
import { ValueType, SummaryColumnType } from './interface';
|
|
3
|
+
export * from './interface';
|
|
4
|
+
export * from './utils';
|
|
5
|
+
declare const ApSummary: {
|
|
6
|
+
new (...args: any[]): CreateComponentPublicInstance<Readonly< ExtractPropTypes<{
|
|
7
|
+
data: {
|
|
8
|
+
type: PropType<ValueType>;
|
|
9
|
+
};
|
|
10
|
+
columns: {
|
|
11
|
+
type: PropType<SummaryColumnType>;
|
|
12
|
+
required: true;
|
|
13
|
+
};
|
|
14
|
+
summaryTitle: {
|
|
15
|
+
type: PropType<string>;
|
|
16
|
+
default: string;
|
|
17
|
+
};
|
|
18
|
+
hasSelect: {
|
|
19
|
+
type: PropType<boolean>;
|
|
20
|
+
default: boolean;
|
|
21
|
+
};
|
|
22
|
+
}>>, {}, unknown, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, VNodeProps & AllowedComponentProps & ComponentCustomProps & Readonly< ExtractPropTypes<{
|
|
23
|
+
data: {
|
|
24
|
+
type: PropType<ValueType>;
|
|
25
|
+
};
|
|
26
|
+
columns: {
|
|
27
|
+
type: PropType<SummaryColumnType>;
|
|
28
|
+
required: true;
|
|
29
|
+
};
|
|
30
|
+
summaryTitle: {
|
|
31
|
+
type: PropType<string>;
|
|
32
|
+
default: string;
|
|
33
|
+
};
|
|
34
|
+
hasSelect: {
|
|
35
|
+
type: PropType<boolean>;
|
|
36
|
+
default: boolean;
|
|
37
|
+
};
|
|
38
|
+
}>>, {
|
|
39
|
+
summaryTitle: string;
|
|
40
|
+
hasSelect: boolean;
|
|
41
|
+
}, true, {}, {}, {
|
|
42
|
+
P: {};
|
|
43
|
+
B: {};
|
|
44
|
+
D: {};
|
|
45
|
+
C: {};
|
|
46
|
+
M: {};
|
|
47
|
+
Defaults: {};
|
|
48
|
+
}, Readonly< ExtractPropTypes<{
|
|
49
|
+
data: {
|
|
50
|
+
type: PropType<ValueType>;
|
|
51
|
+
};
|
|
52
|
+
columns: {
|
|
53
|
+
type: PropType<SummaryColumnType>;
|
|
54
|
+
required: true;
|
|
55
|
+
};
|
|
56
|
+
summaryTitle: {
|
|
57
|
+
type: PropType<string>;
|
|
58
|
+
default: string;
|
|
59
|
+
};
|
|
60
|
+
hasSelect: {
|
|
61
|
+
type: PropType<boolean>;
|
|
62
|
+
default: boolean;
|
|
63
|
+
};
|
|
64
|
+
}>>, {}, {}, {}, {}, {
|
|
65
|
+
summaryTitle: string;
|
|
66
|
+
hasSelect: boolean;
|
|
67
|
+
}>;
|
|
68
|
+
__isFragment?: never;
|
|
69
|
+
__isTeleport?: never;
|
|
70
|
+
__isSuspense?: never;
|
|
71
|
+
} & ComponentOptionsBase<Readonly< ExtractPropTypes<{
|
|
72
|
+
data: {
|
|
73
|
+
type: PropType<ValueType>;
|
|
74
|
+
};
|
|
75
|
+
columns: {
|
|
76
|
+
type: PropType<SummaryColumnType>;
|
|
77
|
+
required: true;
|
|
78
|
+
};
|
|
79
|
+
summaryTitle: {
|
|
80
|
+
type: PropType<string>;
|
|
81
|
+
default: string;
|
|
82
|
+
};
|
|
83
|
+
hasSelect: {
|
|
84
|
+
type: PropType<boolean>;
|
|
85
|
+
default: boolean;
|
|
86
|
+
};
|
|
87
|
+
}>>, {}, unknown, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, {
|
|
88
|
+
summaryTitle: string;
|
|
89
|
+
hasSelect: boolean;
|
|
90
|
+
}, {}, string, {}> & VNodeProps & AllowedComponentProps & ComponentCustomProps & ( Plugin & (new (...args: any[]) => {
|
|
91
|
+
$props: {
|
|
92
|
+
onClick?: () => void;
|
|
93
|
+
};
|
|
94
|
+
}));
|
|
95
|
+
export { ApSummary };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { withInstall as m } from "@aplus-frontend/utils";
|
|
2
|
+
import "./ap-summary.vue.mjs";
|
|
3
|
+
import "./interface.mjs";
|
|
4
|
+
import { computedRecords as n, flattenColumns as s, formatDataIndex as c, formatNumber as l } from "./utils.mjs";
|
|
5
|
+
import o from "./ap-summary.vue2.mjs";
|
|
6
|
+
const e = m(o);
|
|
7
|
+
export {
|
|
8
|
+
e as ApSummary,
|
|
9
|
+
n as computedRecords,
|
|
10
|
+
s as flattenColumns,
|
|
11
|
+
c as formatDataIndex,
|
|
12
|
+
l as formatNumber
|
|
13
|
+
};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { ColumnsType } from 'ant-design-vue/es/table';
|
|
2
|
+
import { AlignType, DataIndex, Key } from 'ant-design-vue/es/vc-table/interface';
|
|
3
|
+
import { ApColumnType } from 'src/ap-table';
|
|
4
|
+
export type SummaryColumnType = ApColumnType[] | ColumnsType;
|
|
5
|
+
export type ValueType = {
|
|
6
|
+
[key in string]: any;
|
|
7
|
+
};
|
|
8
|
+
export interface ApSummaryProps {
|
|
9
|
+
data?: ValueType;
|
|
10
|
+
columns: SummaryColumnType;
|
|
11
|
+
/**
|
|
12
|
+
* @default 合计
|
|
13
|
+
*/
|
|
14
|
+
summaryTitle?: string;
|
|
15
|
+
/**
|
|
16
|
+
* @default true
|
|
17
|
+
*/
|
|
18
|
+
hasSelect?: boolean;
|
|
19
|
+
}
|
|
20
|
+
export interface SummaryItemType {
|
|
21
|
+
key: any | undefined;
|
|
22
|
+
rowSpan: number;
|
|
23
|
+
align?: AlignType | undefined;
|
|
24
|
+
value: any;
|
|
25
|
+
}
|
|
26
|
+
export interface SumConfig {
|
|
27
|
+
/**
|
|
28
|
+
* 优先用 columns 的dataIndex做对比,再用 key 做对比
|
|
29
|
+
*/
|
|
30
|
+
key: Key;
|
|
31
|
+
dataIndex: DataIndex | undefined;
|
|
32
|
+
}
|
|
33
|
+
export interface ComputedRecordParams<T> {
|
|
34
|
+
records: T[];
|
|
35
|
+
columns: SummaryColumnType;
|
|
36
|
+
configList?: SumConfig[];
|
|
37
|
+
/**
|
|
38
|
+
* 排出 在 columns 和 configList中相同key 的配置项
|
|
39
|
+
*/
|
|
40
|
+
exclude?: Key[];
|
|
41
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import '@aplus-frontend/ui-theme/dist/ap-summary/ap-summary.css';
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import '@aplus-frontend/ui-theme/src/ap-summary/index.less';
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { ComputedRecordParams, SummaryColumnType, ValueType } from './interface';
|
|
2
|
+
import { DataIndex, Key } from 'ant-design-vue/es/vc-table/interface';
|
|
3
|
+
import { ApColumnType } from '../../ap-table/interface';
|
|
4
|
+
export declare const flattenColumns: (columns?: SummaryColumnType) => ApColumnType[];
|
|
5
|
+
export declare const formatDataIndex: (dataIndex?: DataIndex | Key) => string | number | readonly (string | number)[];
|
|
6
|
+
export declare const formatNumber: (value: any, precision: number, thousands: boolean) => string;
|
|
7
|
+
/**
|
|
8
|
+
* 自动对表格数据进行求和
|
|
9
|
+
* @param params ComputedRecordParams
|
|
10
|
+
* @returns
|
|
11
|
+
*/
|
|
12
|
+
export declare function computedRecords<T>(params: ComputedRecordParams<T>): ValueType;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { flatten as k, uniqBy as I, get as s, set as N } from "lodash-unified";
|
|
2
|
+
import { toThousand as R, toFixed as V, addNumber as S } from "@aplus-frontend/utils";
|
|
3
|
+
const b = (t) => {
|
|
4
|
+
var e, d;
|
|
5
|
+
return t != null && t.children && ((e = t == null ? void 0 : t.children) == null ? void 0 : e.length) > 0 ? k((d = t.children) == null ? void 0 : d.map((n) => b(n))) : [t];
|
|
6
|
+
}, T = (t) => k(
|
|
7
|
+
t == null ? void 0 : t.map((e) => b(e))
|
|
8
|
+
), u = (t) => Object.prototype.toString.call(t) === "[object Array]" ? t.map((e) => String(e)).join(".") : t || "", B = (t, e, d) => d ? R(t, e) : V(t, e);
|
|
9
|
+
function D(t) {
|
|
10
|
+
var y;
|
|
11
|
+
const { records: e, columns: d, configList: n, exclude: c } = t;
|
|
12
|
+
if (e.length === 0)
|
|
13
|
+
return {};
|
|
14
|
+
const f = T(d);
|
|
15
|
+
let a = (y = f == null ? void 0 : f.filter((r) => r.valueType === "number")) == null ? void 0 : y.map((r) => ({
|
|
16
|
+
key: r.key || "",
|
|
17
|
+
dataIndex: r.dataIndex
|
|
18
|
+
}));
|
|
19
|
+
n && (n == null ? void 0 : n.length) > 0 && (a = I(a == null ? void 0 : a.concat(n), "key")), c && c.length > 0 && (a = a.filter(
|
|
20
|
+
(r) => !c.includes(r.key)
|
|
21
|
+
));
|
|
22
|
+
const x = {};
|
|
23
|
+
return e.reduce((r, h) => (a.forEach((o) => {
|
|
24
|
+
var p;
|
|
25
|
+
if (s(h, u(o.dataIndex || o.key))) {
|
|
26
|
+
const i = o.dataIndex || o.key, g = s(r, u(i)) || 0, j = s(h, u(i)) || 0, l = (p = S(g, j)) == null ? void 0 : p.toNumber();
|
|
27
|
+
N(r, i, +l);
|
|
28
|
+
}
|
|
29
|
+
}), r), x);
|
|
30
|
+
}
|
|
31
|
+
export {
|
|
32
|
+
D as computedRecords,
|
|
33
|
+
T as flattenColumns,
|
|
34
|
+
u as formatDataIndex,
|
|
35
|
+
B as formatNumber
|
|
36
|
+
};
|
|
@@ -1,37 +1,39 @@
|
|
|
1
1
|
import { default as t } from "./ap-table-modal/index.mjs";
|
|
2
|
-
import { ApAttachment as
|
|
3
|
-
import { ApBatchAction as
|
|
2
|
+
import { ApAttachment as m } from "./ap-attachment/index.mjs";
|
|
3
|
+
import { ApBatchAction as a } from "./ap-batch-action/index.mjs";
|
|
4
4
|
import { ApBatchActionGroup as x } from "./ap-batch-action-group/index.mjs";
|
|
5
5
|
import { ApButtonGroup as l } from "./ap-button-group/index.mjs";
|
|
6
6
|
import { ApCard as n } from "./ap-card/index.mjs";
|
|
7
7
|
import { ApExpandAlert as i } from "./ap-expand-alert/index.mjs";
|
|
8
8
|
import { ApExportGroup as s } from "./ap-export-group/index.mjs";
|
|
9
|
-
import { ApImage as
|
|
10
|
-
import { ApInputRadio as
|
|
11
|
-
import { ApLabel as T, ApLabelGroup as
|
|
12
|
-
import { ApLadder as
|
|
9
|
+
import { ApImage as S } from "./ap-image/index.mjs";
|
|
10
|
+
import { ApInputRadio as h } from "./ap-input-radio/index.mjs";
|
|
11
|
+
import { ApLabel as T, ApLabelGroup as y } from "./ap-label/index.mjs";
|
|
12
|
+
import { ApLadder as I } from "./ap-ladder/index.mjs";
|
|
13
13
|
import { ApSelectLayout as C } from "./ap-select-layout/index.mjs";
|
|
14
14
|
import { ApStatus as H, ApStatusGroup as M } from "./ap-status/index.mjs";
|
|
15
15
|
import { ApTitle as j } from "./ap-title/index.mjs";
|
|
16
16
|
import "./hooks/index.mjs";
|
|
17
|
-
import {
|
|
17
|
+
import { ApSummary as q } from "./ap-summary/index.mjs";
|
|
18
|
+
import { ApTransformDataHelper as w } from "../utils/ap-trans-data/index.mjs";
|
|
18
19
|
export {
|
|
19
|
-
|
|
20
|
-
|
|
20
|
+
m as ApAttachment,
|
|
21
|
+
a as ApBatchAction,
|
|
21
22
|
x as ApBatchActionGroup,
|
|
22
23
|
l as ApButtonGroup,
|
|
23
24
|
n as ApCard,
|
|
24
25
|
i as ApExpandAlert,
|
|
25
26
|
s as ApExportGroup,
|
|
26
|
-
|
|
27
|
-
|
|
27
|
+
S as ApImage,
|
|
28
|
+
h as ApInputRadio,
|
|
28
29
|
T as ApLabel,
|
|
29
|
-
|
|
30
|
-
|
|
30
|
+
y as ApLabelGroup,
|
|
31
|
+
I as ApLadder,
|
|
31
32
|
C as ApSelectLayout,
|
|
32
33
|
H as ApStatus,
|
|
33
34
|
M as ApStatusGroup,
|
|
35
|
+
q as ApSummary,
|
|
34
36
|
t as ApTableModal,
|
|
35
37
|
j as ApTitle,
|
|
36
|
-
|
|
38
|
+
w as ApTransformDataHelper
|
|
37
39
|
};
|
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
import { isVNode as
|
|
2
|
-
import { isFunction as m, isArray as g, isBoolean as
|
|
3
|
-
import { apTableFormItemMap as
|
|
1
|
+
import { isVNode as I, createVNode as r, mergeProps as S, createTextVNode as F, Fragment as w } from "vue";
|
|
2
|
+
import { isFunction as m, isArray as g, isBoolean as P, omit as V, isString as q } from "lodash-unified";
|
|
3
|
+
import { apTableFormItemMap as v, noRenderAsFormItemValueList as C, apTableRenderItemMap as N } from "../ap-table/constants.mjs";
|
|
4
4
|
import { isDef as j } from "../utils/index.mjs";
|
|
5
5
|
import { getValueStr as A } from "../ap-field/number/helper.mjs";
|
|
6
|
-
import
|
|
7
|
-
import { Typography as
|
|
6
|
+
import O from "scroll-into-view-if-needed";
|
|
7
|
+
import { Typography as W, Tooltip as _ } from "ant-design-vue";
|
|
8
8
|
import "../ap-form/index.mjs";
|
|
9
|
-
import { objectToString as
|
|
10
|
-
import { QuestionCircleOutlined as
|
|
9
|
+
import { objectToString as D } from "../ap-table/utils.mjs";
|
|
10
|
+
import { QuestionCircleOutlined as E } from "@ant-design/icons-vue";
|
|
11
11
|
import T from "../ap-form/item/index.vue.mjs";
|
|
12
12
|
function b(t) {
|
|
13
|
-
return typeof t == "function" || Object.prototype.toString.call(t) === "[object Object]" && !
|
|
13
|
+
return typeof t == "function" || Object.prototype.toString.call(t) === "[object Object]" && !I(t);
|
|
14
14
|
}
|
|
15
|
-
function
|
|
16
|
-
return
|
|
15
|
+
function R(t) {
|
|
16
|
+
return v[t];
|
|
17
17
|
}
|
|
18
18
|
function k(t) {
|
|
19
19
|
if (!t.fieldProps)
|
|
@@ -28,9 +28,9 @@ function B(t, e) {
|
|
|
28
28
|
const i = t.fieldProps ? m(t.fieldProps) ? t.fieldProps({}) : t.fieldProps : {};
|
|
29
29
|
return A(e, i) || "--";
|
|
30
30
|
}
|
|
31
|
-
return
|
|
31
|
+
return D(e);
|
|
32
32
|
}
|
|
33
|
-
function
|
|
33
|
+
function H(t, e) {
|
|
34
34
|
const i = [t];
|
|
35
35
|
if (e) {
|
|
36
36
|
const o = g(e) ? e : [e];
|
|
@@ -38,22 +38,22 @@ function Z(t, e) {
|
|
|
38
38
|
}
|
|
39
39
|
return i.join(" ");
|
|
40
40
|
}
|
|
41
|
-
function
|
|
41
|
+
function M(t, e = document.body, i = {}) {
|
|
42
42
|
const o = e.querySelectorAll("tr.ant-table-row")[t];
|
|
43
|
-
o &&
|
|
43
|
+
o && O(o, {
|
|
44
44
|
scrollMode: "if-needed",
|
|
45
45
|
block: "nearest",
|
|
46
46
|
behavior: "smooth",
|
|
47
47
|
...i
|
|
48
48
|
});
|
|
49
49
|
}
|
|
50
|
-
function
|
|
51
|
-
return
|
|
50
|
+
function L(t, e, i) {
|
|
51
|
+
return C.includes(t.valueType) ? i : t.copyable || t.ellipsis ? r(W.Paragraph, {
|
|
52
52
|
copyable: t.copyable ? {
|
|
53
53
|
text: e,
|
|
54
54
|
tooltip: !1
|
|
55
55
|
} : !1,
|
|
56
|
-
ellipsis: t.ellipsis ?
|
|
56
|
+
ellipsis: t.ellipsis ? P(t.ellipsis) ? {
|
|
57
57
|
tooltip: e
|
|
58
58
|
} : {
|
|
59
59
|
...t.ellipsis,
|
|
@@ -62,73 +62,73 @@ function H(t, e, i) {
|
|
|
62
62
|
content: t.ellipsis ? B(t, e) : i
|
|
63
63
|
}, null) : i;
|
|
64
64
|
}
|
|
65
|
-
function
|
|
66
|
-
var
|
|
65
|
+
function tt(t, e, i, o, d, l) {
|
|
66
|
+
var u, y;
|
|
67
67
|
if (e) {
|
|
68
68
|
if (t.customRenderFormItem) {
|
|
69
|
-
const
|
|
70
|
-
return
|
|
71
|
-
default: () => [
|
|
69
|
+
const a = t.customRenderFormItem(t, i.field, e, d);
|
|
70
|
+
return r(T, V(i, ["field"]), b(a) ? a : {
|
|
71
|
+
default: () => [a]
|
|
72
72
|
});
|
|
73
73
|
}
|
|
74
|
-
const
|
|
75
|
-
if (
|
|
76
|
-
return s
|
|
77
|
-
const n = l == null ? void 0 : l[t.valueType],
|
|
78
|
-
return
|
|
79
|
-
default: () => [
|
|
74
|
+
const s = R(t.valueType);
|
|
75
|
+
if (s)
|
|
76
|
+
return r(s, i, null);
|
|
77
|
+
const n = l == null ? void 0 : l[t.valueType], p = (u = n == null ? void 0 : n.renderFormItem) == null ? void 0 : u.call(n, i.field);
|
|
78
|
+
return p ? r(T, i, b(p) ? p : {
|
|
79
|
+
default: () => [p]
|
|
80
80
|
}) : null;
|
|
81
81
|
}
|
|
82
|
-
let
|
|
83
|
-
const
|
|
84
|
-
if (
|
|
85
|
-
|
|
82
|
+
let f;
|
|
83
|
+
const c = N[t.valueType];
|
|
84
|
+
if (c)
|
|
85
|
+
f = r(c, S(i.field, {
|
|
86
86
|
mode: "read"
|
|
87
87
|
}), null);
|
|
88
88
|
else {
|
|
89
|
-
const
|
|
90
|
-
|
|
89
|
+
const s = l == null ? void 0 : l[t.valueType];
|
|
90
|
+
f = (y = s == null ? void 0 : s.render) == null ? void 0 : y.call(s, o, d, i.field);
|
|
91
91
|
}
|
|
92
|
-
return
|
|
92
|
+
return f ? L(t, o, f) : null;
|
|
93
93
|
}
|
|
94
|
-
function
|
|
94
|
+
function et(t, e, i, o, d) {
|
|
95
95
|
const l = o == null ? void 0 : o({
|
|
96
96
|
title: t.title,
|
|
97
97
|
column: t
|
|
98
|
-
});
|
|
99
|
-
if (l &&
|
|
98
|
+
}), f = (l == null ? void 0 : l.filter((h) => h.type !== Symbol.for("v-cmt"))) || [];
|
|
99
|
+
if (l && f.length > 0)
|
|
100
100
|
return l;
|
|
101
|
-
const u = k(t),
|
|
101
|
+
const u = k(t), s = q(t.title) ? {
|
|
102
102
|
class: e,
|
|
103
103
|
title: t.title
|
|
104
|
-
} : {},
|
|
104
|
+
} : {}, n = r("div", s, [u ? r("span", {
|
|
105
105
|
class: i
|
|
106
|
-
}, [F("*")]) : null, t.title]),
|
|
107
|
-
return
|
|
106
|
+
}, [F("*")]) : null, t.title]), p = t.tooltip ? m(t.tooltip) ? t.tooltip(t) : r(w, null, [t.tooltip]) : null;
|
|
107
|
+
return p ? r("span", {
|
|
108
108
|
style: {
|
|
109
109
|
display: "inline-flex",
|
|
110
110
|
alignItems: "center",
|
|
111
111
|
maxWidth: "100%"
|
|
112
112
|
}
|
|
113
|
-
}, [
|
|
114
|
-
title:
|
|
113
|
+
}, [n, r(_, {
|
|
114
|
+
title: p,
|
|
115
115
|
placement: "bottom"
|
|
116
116
|
}, {
|
|
117
|
-
default: () => [
|
|
117
|
+
default: () => [r(E, {
|
|
118
118
|
style: {
|
|
119
119
|
padding: "4px",
|
|
120
120
|
color: d,
|
|
121
121
|
verticalAlign: "middle"
|
|
122
122
|
}
|
|
123
123
|
}, null)]
|
|
124
|
-
})]) :
|
|
124
|
+
})]) : n;
|
|
125
125
|
}
|
|
126
126
|
export {
|
|
127
127
|
k as getColumnIsRequired,
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
128
|
+
R as getEditableComponent,
|
|
129
|
+
et as getEditableTableTitle,
|
|
130
|
+
tt as getFinalNode,
|
|
131
131
|
B as getRawDisplayValue,
|
|
132
|
-
|
|
133
|
-
|
|
132
|
+
H as mergeClass,
|
|
133
|
+
M as scrollToRowIndex
|
|
134
134
|
};
|
|
@@ -1,12 +1,17 @@
|
|
|
1
1
|
import { Ref } from 'vue';
|
|
2
2
|
import { Recordable } from '../type';
|
|
3
|
-
type Options = {
|
|
4
|
-
defaultValue?:
|
|
3
|
+
type Options<ValueType = any> = {
|
|
4
|
+
defaultValue?: ValueType;
|
|
5
5
|
defaultValuePropName?: string;
|
|
6
6
|
valuePropName?: string;
|
|
7
|
+
/**
|
|
8
|
+
* 在更新值之前执行,返回false将不更新值,支持异步
|
|
9
|
+
* @returns
|
|
10
|
+
*/
|
|
11
|
+
beforeUpdateValue?: (nextVal: ValueType) => boolean | Promise<boolean>;
|
|
7
12
|
};
|
|
8
13
|
export declare function useControllableValue<ValueType = any>(props: Recordable, emit: (event: any, ...args: any[]) => void, options?: Options): {
|
|
9
14
|
value: Ref<ValueType>;
|
|
10
|
-
updateValue: (newValue: any) => void
|
|
15
|
+
updateValue: (newValue: any) => Promise<void>;
|
|
11
16
|
};
|
|
12
17
|
export {};
|
|
@@ -1,26 +1,31 @@
|
|
|
1
|
-
import { ref as
|
|
1
|
+
import { ref as V, nextTick as n, watch as N } from "vue";
|
|
2
2
|
import { isUndefined as d } from "lodash-unified";
|
|
3
|
-
function
|
|
4
|
-
const f = (e == null ? void 0 : e.defaultValuePropName) || "defaultValue",
|
|
5
|
-
function
|
|
6
|
-
|
|
3
|
+
function g(a, t, e) {
|
|
4
|
+
const f = (e == null ? void 0 : e.defaultValuePropName) || "defaultValue", l = (e == null ? void 0 : e.valuePropName) || "value", u = V(m());
|
|
5
|
+
async function v(r) {
|
|
6
|
+
e != null && e.beforeUpdateValue && (c(), !await e.beforeUpdateValue(r)) || (a[l] === void 0 && (u.value = r), t(`update:${l}`, r));
|
|
7
7
|
}
|
|
8
8
|
function c() {
|
|
9
|
-
|
|
9
|
+
u.value === void 0 && (u.value = "", n(() => {
|
|
10
|
+
u.value = void 0;
|
|
11
|
+
}));
|
|
10
12
|
}
|
|
11
|
-
|
|
12
|
-
()
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
function m() {
|
|
14
|
+
return d(a[l]) ? d(a[f]) ? e == null ? void 0 : e.defaultValue : a[f] : a[l];
|
|
15
|
+
}
|
|
16
|
+
return N(
|
|
17
|
+
() => a[l],
|
|
18
|
+
(r) => {
|
|
19
|
+
u.value = r;
|
|
15
20
|
},
|
|
16
21
|
{
|
|
17
22
|
deep: !0
|
|
18
23
|
}
|
|
19
24
|
), {
|
|
20
|
-
value:
|
|
21
|
-
updateValue:
|
|
25
|
+
value: u,
|
|
26
|
+
updateValue: v
|
|
22
27
|
};
|
|
23
28
|
}
|
|
24
29
|
export {
|
|
25
|
-
|
|
30
|
+
g as useControllableValue
|
|
26
31
|
};
|