@aplus-frontend/ui 0.1.24 → 0.1.26

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.
Files changed (96) hide show
  1. package/es/index.mjs +58 -55
  2. package/es/src/ap-form/ap-form-item.vue.mjs +26 -26
  3. package/es/src/ap-form/search-form/index.vue.mjs +1 -0
  4. package/es/src/ap-layout/ApInfoLayout.vue.d.ts +81 -0
  5. package/es/src/ap-layout/ApInfoLayout.vue.mjs +41 -0
  6. package/es/src/ap-layout/ApInfoLayout.vue2.mjs +4 -0
  7. package/es/src/ap-layout/ap-info-layout-admin/ApInfoLayoutAdmin.vue.d.ts +48 -0
  8. package/es/src/ap-layout/ap-info-layout-admin/ApInfoLayoutAdmin.vue.mjs +4 -0
  9. package/es/src/ap-layout/ap-info-layout-admin/ApInfoLayoutAdmin.vue2.mjs +42 -0
  10. package/es/src/ap-layout/{ap-info-layout → ap-info-layout-aplus}/ap-info-layout.vue.d.ts +3 -3
  11. package/es/src/ap-layout/ap-info-layout-aplus/ap-info-layout.vue.mjs +4 -0
  12. package/es/src/ap-layout/index.d.ts +2 -1
  13. package/es/src/ap-layout/index.mjs +2 -1
  14. package/es/src/ap-layout/interface.d.ts +8 -2
  15. package/es/src/ap-layout/interface.mjs +1 -0
  16. package/es/src/ap-layout/style/ap-info-layout.css +17 -0
  17. package/es/src/ap-upload/components/MultipleFile.vue2.mjs +91 -89
  18. package/es/src/ap-upload/components/Picture.vue2.mjs +114 -112
  19. package/es/src/ap-upload/components/SingleFile.vue2.mjs +10 -7
  20. package/es/src/business/ap-input-radio/ApInputRadio.vue2.mjs +37 -27
  21. package/es/src/business/ap-input-radio/interface.d.ts +4 -3
  22. package/es/src/business/ap-ladder/ApLadder.vue.d.ts +159 -0
  23. package/es/src/business/ap-ladder/ApLadder.vue.mjs +4 -0
  24. package/es/src/business/ap-ladder/ApLadder.vue2.mjs +176 -0
  25. package/es/src/business/ap-ladder/interface.d.ts +134 -0
  26. package/es/src/business/ap-ladder/interface.mjs +10 -0
  27. package/es/src/business/ap-ladder/style.css +56 -0
  28. package/es/src/business/hooks/index.d.ts +1 -0
  29. package/es/src/business/hooks/index.mjs +3 -1
  30. package/es/src/business/hooks/usePageListApTable.d.ts +25 -3
  31. package/es/src/business/hooks/usePageListApTable.mjs +40 -29
  32. package/es/src/business/hooks/useTableRefresh.d.ts +17 -0
  33. package/es/src/business/hooks/useTableRefresh.mjs +16 -0
  34. package/es/src/business/index.d.ts +719 -9
  35. package/es/src/business/index.mjs +25 -22
  36. package/es/src/components.d.ts +1 -0
  37. package/es/src/index.mjs +206 -203
  38. package/es/src/theme/antd-global-overwrite/aplus/index.css +8 -0
  39. package/es/src/theme/antd-global-overwrite/aplus/table.css +8 -0
  40. package/es/src/theme/ap-ladder/ap-ladder.css +56 -0
  41. package/es/src/theme/ap-layout/ap-info-layout.css +17 -0
  42. package/lib/index.js +1 -1
  43. package/lib/src/ap-form/ap-form-item.vue.js +1 -1
  44. package/lib/src/ap-form/search-form/index.vue.js +1 -1
  45. package/lib/src/ap-layout/ApInfoLayout.vue.d.ts +81 -0
  46. package/lib/src/ap-layout/ApInfoLayout.vue.js +1 -0
  47. package/lib/src/ap-layout/ApInfoLayout.vue2.js +1 -0
  48. package/lib/src/ap-layout/ap-info-layout-admin/ApInfoLayoutAdmin.vue.d.ts +48 -0
  49. package/lib/src/ap-layout/ap-info-layout-admin/ApInfoLayoutAdmin.vue.js +1 -0
  50. package/lib/src/ap-layout/ap-info-layout-admin/ApInfoLayoutAdmin.vue2.js +1 -0
  51. package/lib/src/ap-layout/{ap-info-layout → ap-info-layout-aplus}/ap-info-layout.vue.d.ts +3 -3
  52. package/lib/src/ap-layout/{ap-info-layout/ap-info-layout.vue2.js → ap-info-layout-aplus/ap-info-layout.vue.js} +1 -1
  53. package/lib/src/ap-layout/index.d.ts +2 -1
  54. package/lib/src/ap-layout/index.js +1 -1
  55. package/lib/src/ap-layout/interface.d.ts +8 -2
  56. package/lib/src/ap-layout/interface.js +1 -0
  57. package/lib/src/ap-layout/style/ap-info-layout.css +17 -0
  58. package/lib/src/ap-upload/components/MultipleFile.vue2.js +1 -1
  59. package/lib/src/ap-upload/components/Picture.vue2.js +1 -1
  60. package/lib/src/ap-upload/components/SingleFile.vue2.js +1 -1
  61. package/lib/src/business/ap-input-radio/ApInputRadio.vue2.js +1 -1
  62. package/lib/src/business/ap-input-radio/interface.d.ts +4 -3
  63. package/lib/src/business/ap-ladder/ApLadder.vue.d.ts +159 -0
  64. package/lib/src/business/ap-ladder/ApLadder.vue.js +1 -0
  65. package/lib/src/business/ap-ladder/ApLadder.vue2.js +1 -0
  66. package/lib/src/business/ap-ladder/interface.d.ts +134 -0
  67. package/lib/src/business/ap-ladder/interface.js +1 -0
  68. package/lib/src/business/ap-ladder/style.css +56 -0
  69. package/lib/src/business/hooks/index.d.ts +1 -0
  70. package/lib/src/business/hooks/index.js +1 -1
  71. package/lib/src/business/hooks/usePageListApTable.d.ts +25 -3
  72. package/lib/src/business/hooks/usePageListApTable.js +1 -1
  73. package/lib/src/business/hooks/useTableRefresh.d.ts +17 -0
  74. package/lib/src/business/hooks/useTableRefresh.js +1 -0
  75. package/lib/src/business/index.d.ts +719 -9
  76. package/lib/src/business/index.js +1 -1
  77. package/lib/src/components.d.ts +1 -0
  78. package/lib/src/index.js +1 -1
  79. package/lib/src/theme/antd-global-overwrite/aplus/index.css +8 -0
  80. package/lib/src/theme/antd-global-overwrite/aplus/table.css +8 -0
  81. package/lib/src/theme/ap-ladder/ap-ladder.css +56 -0
  82. package/lib/src/theme/ap-layout/ap-info-layout.css +17 -0
  83. package/package.json +1 -1
  84. package/es/src/ap-layout/ap-info-layout/ap-info-layout.vue2.mjs +0 -4
  85. /package/es/src/ap-layout/{ap-info-layout/ap-info-layout.vue.mjs → ap-info-layout-aplus/ap-info-layout.vue2.mjs} +0 -0
  86. /package/es/src/business/{expandAlert → ap-expand-alert}/ApExpandAlert.vue.d.ts +0 -0
  87. /package/es/src/business/{expandAlert → ap-expand-alert}/ApExpandAlert.vue.mjs +0 -0
  88. /package/es/src/business/{expandAlert → ap-expand-alert}/ApExpandAlert.vue2.mjs +0 -0
  89. /package/es/src/business/{expandAlert → ap-expand-alert}/interface.d.ts +0 -0
  90. /package/es/src/business/{expandAlert → ap-expand-alert}/style.css +0 -0
  91. /package/lib/src/ap-layout/{ap-info-layout/ap-info-layout.vue.js → ap-info-layout-aplus/ap-info-layout.vue2.js} +0 -0
  92. /package/lib/src/business/{expandAlert → ap-expand-alert}/ApExpandAlert.vue.d.ts +0 -0
  93. /package/lib/src/business/{expandAlert → ap-expand-alert}/ApExpandAlert.vue.js +0 -0
  94. /package/lib/src/business/{expandAlert → ap-expand-alert}/ApExpandAlert.vue2.js +0 -0
  95. /package/lib/src/business/{expandAlert → ap-expand-alert}/interface.d.ts +0 -0
  96. /package/lib/src/business/{expandAlert → ap-expand-alert}/style.css +0 -0
@@ -0,0 +1,176 @@
1
+ import { defineComponent as q, useSlots as H, ref as R, computed as h, unref as l, onMounted as J, openBlock as t, createElementBlock as r, normalizeClass as u, createBlock as $, normalizeProps as w, mergeProps as E, createSlots as M, withCtx as b, Fragment as y, createElementVNode as p, normalizeStyle as m, toDisplayString as i, renderSlot as N, createCommentVNode as f, renderList as z, createTextVNode as K } from "vue";
2
+ import { Tooltip as O } from "ant-design-vue";
3
+ import "../../config-provider/index.mjs";
4
+ import { locales as Q } from "./interface.mjs";
5
+ import "./style.css";
6
+ import { useNamespace as U } from "../../config-provider/hooks/use-namespace.mjs";
7
+ import { useGlobalConfig as X } from "../../config-provider/hooks/use-global-config.mjs";
8
+ const Y = { key: 1 }, Z = { key: 0 }, x = { key: 1 }, ee = { key: 0 }, oe = ["onClick"], te = { key: 0 }, re = { key: 1 }, le = { key: 0 }, se = { key: 1 }, me = /* @__PURE__ */ q({
9
+ name: "ApLadder",
10
+ __name: "ApLadder",
11
+ props: {
12
+ major: { default: "" },
13
+ minor: { default: "" },
14
+ majorColor: { default: "" },
15
+ minorColor: { default: "" },
16
+ layout: { default: "vertical" },
17
+ tooltip: { type: Boolean, default: !0 },
18
+ labelValues: { default: () => [] },
19
+ tooltipProps: { default: () => ({
20
+ title: void 0,
21
+ align: {},
22
+ arrowPointAtCenter: !1,
23
+ arrow: !0,
24
+ autoAdjustOverflow: !0,
25
+ color: "",
26
+ destroyTooltipOnHide: !1,
27
+ getPopupContainer: () => document.body,
28
+ mouseEnterDelay: 0.1,
29
+ mouseLeaveDelay: 0.1,
30
+ overlayClassName: "",
31
+ overlayStyle: {},
32
+ overlayInnerStyle: {},
33
+ placement: "top",
34
+ trigger: "hover"
35
+ }) }
36
+ },
37
+ setup(A) {
38
+ const v = H(), s = A, { b: B, e: n, m: L } = U("ap-ladder"), F = X("uiMode", "aplus"), _ = `ap-ladder-${Math.floor(Math.random() * 1e7)}`, W = n("ellipsis"), k = R(!1), D = h(() => s.labelValues.length === 0), T = h(() => s.labelValues.length > 0), g = h(() => s.majorColor ? {
39
+ color: `${s.majorColor}`
40
+ } : {}), S = h(() => s.minorColor ? {
41
+ color: `${s.minorColor}`
42
+ } : {}), C = (o) => o == null || typeof o == "string" && o.trim() === "", c = (o, a = {}) => {
43
+ const e = {
44
+ rawValue: a.rawValue,
45
+ precision: a.precision === void 0 ? 2 : a.precision,
46
+ thousand: a.thousand,
47
+ thousandSeparator: a.thousandSeparator || ",",
48
+ currency: a.currency,
49
+ percent: a.percent
50
+ };
51
+ return C(o) ? "--" : e.rawValue ? o : typeof o == "number" ? e.percent ? `${o.toFixed(e.precision)}%` : e.currency ? o.toLocaleString(Q[e.currency], {
52
+ style: "currency",
53
+ currency: e.currency
54
+ }) : e.thousand ? o.toFixed(e.precision).replace(
55
+ /(\d)(?=(\d{3})+(?!\d))/g,
56
+ `$1${e.thousandSeparator}`
57
+ ) : o.toFixed(e.precision) : o;
58
+ }, G = () => {
59
+ const o = document.getElementById(_);
60
+ if (!o)
61
+ return;
62
+ const a = o.querySelectorAll(`.${W}`);
63
+ new ResizeObserver((d) => {
64
+ d.forEach((j) => {
65
+ j.target === o && (k.value = !1, a.forEach((P) => {
66
+ P.clientWidth < P.scrollWidth && (k.value = !0);
67
+ }));
68
+ });
69
+ }).observe(o), k.value = !1, a.forEach((d) => {
70
+ d.clientWidth < d.scrollWidth && (k.value = !0);
71
+ });
72
+ }, V = h(() => v.title ? !0 : s.tooltip && l(k)), I = (o) => {
73
+ o && window.open(o, "_blank");
74
+ };
75
+ return J(() => {
76
+ G();
77
+ }), (o, a) => (t(), r("div", {
78
+ id: _,
79
+ class: u([l(B)(), `${l(L)(l(F))}`])
80
+ }, [
81
+ D.value ? (t(), $(l(O), w(E({ key: 0 }, { ...s.tooltipProps })), M({
82
+ default: b(() => [
83
+ !C(o.major) || !C(o.minor) ? (t(), r(y, { key: 0 }, [
84
+ s.layout === "vertical" ? (t(), r(y, { key: 0 }, [
85
+ p("div", {
86
+ class: u([l(n)("major"), l(n)("ellipsis")]),
87
+ style: m(g.value)
88
+ }, i(c(o.major)), 7),
89
+ p("div", {
90
+ class: u([l(n)("minor"), l(n)("ellipsis")]),
91
+ style: m(S.value)
92
+ }, i(c(o.minor)), 7)
93
+ ], 64)) : (t(), r("div", {
94
+ key: 1,
95
+ class: u(l(n)("ellipsis"))
96
+ }, [
97
+ p("span", {
98
+ class: u([l(n)("major")]),
99
+ style: m(g.value)
100
+ }, i(c(o.major)), 7),
101
+ p("span", {
102
+ class: u([l(n)("minor")]),
103
+ style: m(S.value)
104
+ }, i(c(o.minor)), 7)
105
+ ], 2))
106
+ ], 64)) : (t(), r("div", Y, i("--")))
107
+ ]),
108
+ _: 2
109
+ }, [
110
+ V.value ? {
111
+ name: "title",
112
+ fn: b(() => [
113
+ v.title ? N(o.$slots, "title", { key: 0 }) : (t(), r(y, { key: 1 }, [
114
+ s.tooltipProps.title ? (t(), r("div", Z, i(s.tooltipProps.title), 1)) : (t(), r("div", x, [
115
+ p("div", null, i(c(o.major)), 1),
116
+ p("div", null, i(c(o.minor)), 1)
117
+ ]))
118
+ ], 64))
119
+ ]),
120
+ key: "0"
121
+ } : void 0
122
+ ]), 1040)) : f("", !0),
123
+ T.value ? (t(), $(l(O), w(E({ key: 1 }, { ...s.tooltipProps })), M({
124
+ default: b(() => [
125
+ (t(!0), r(y, null, z(s.labelValues, (e, d) => (t(), r("div", {
126
+ key: d,
127
+ class: u([l(n)("ellipsis")])
128
+ }, [
129
+ p("span", {
130
+ class: u(l(n)("label")),
131
+ style: m(e.labelColor ? { color: e.labelColor } : void 0)
132
+ }, [
133
+ K(i(e.label), 1),
134
+ e.label ? (t(), r("span", ee, ":")) : f("", !0)
135
+ ], 6),
136
+ C(e.link) ? (t(), r("span", {
137
+ key: 1,
138
+ class: u(l(n)("value")),
139
+ style: m(e.valueColor ? { color: e.valueColor } : void 0)
140
+ }, i(c(e.value, { ...e })), 7)) : (t(), r("span", {
141
+ key: 0,
142
+ class: u(l(n)("link")),
143
+ style: m(e.linkColor ? { color: e.linkColor } : void 0),
144
+ onClick: (j) => I(e.link)
145
+ }, i(c(e.value, { ...e })), 15, oe)),
146
+ e.unit ? (t(), r("span", {
147
+ key: 2,
148
+ class: u(l(n)("unit")),
149
+ style: m(e.unitColor ? { color: e.unitColor } : void 0)
150
+ }, i(e.unit), 7)) : f("", !0)
151
+ ], 2))), 128))
152
+ ]),
153
+ _: 2
154
+ }, [
155
+ V.value ? {
156
+ name: "title",
157
+ fn: b(() => [
158
+ v.title ? N(o.$slots, "title", { key: 0 }) : (t(), r(y, { key: 1 }, [
159
+ s.tooltipProps.title ? (t(), r("div", te, i(s.tooltipProps.title), 1)) : (t(), r("div", re, [
160
+ (t(!0), r(y, null, z(s.labelValues, (e, d) => (t(), r("div", { key: d }, [
161
+ e.label ? (t(), r("span", le, i(e.label), 1)) : f("", !0),
162
+ e.label ? (t(), r("span", se, ":")) : f("", !0),
163
+ p("span", null, i(c(e.value, { ...e })), 1)
164
+ ]))), 128))
165
+ ]))
166
+ ], 64))
167
+ ]),
168
+ key: "0"
169
+ } : void 0
170
+ ]), 1040)) : f("", !0)
171
+ ], 2));
172
+ }
173
+ });
174
+ export {
175
+ me as default
176
+ };
@@ -0,0 +1,134 @@
1
+ import { TooltipProps } from 'ant-design-vue/es/tooltip/Tooltip';
2
+ import { VNode } from 'vue';
3
+ /**
4
+ * Tooltip 需要的属性
5
+ */
6
+ export type TooltipNeedProps = Required<Pick<TooltipProps, 'title' | 'align' | 'arrowPointAtCenter' | 'arrow' | 'autoAdjustOverflow' | 'color' | 'destroyTooltipOnHide' | 'getPopupContainer' | 'mouseEnterDelay' | 'mouseLeaveDelay' | 'overlayClassName' | 'overlayStyle' | 'overlayInnerStyle' | 'placement' | 'trigger'>>;
7
+ /**
8
+ * 健值对
9
+ */
10
+ export interface ApLadderLabelValue {
11
+ /**
12
+ * 健名称
13
+ */
14
+ label: string;
15
+ /**
16
+ * 值
17
+ */
18
+ value: string | number | undefined | null;
19
+ /**
20
+ * 是否采用原始值
21
+ */
22
+ rawValue?: boolean;
23
+ /**
24
+ * 精度 默认2位小数
25
+ */
26
+ precision?: number;
27
+ /**
28
+ * 千分位展示
29
+ */
30
+ thousand?: boolean;
31
+ /**
32
+ * 千分位分隔符
33
+ */
34
+ thousandSeparator?: string;
35
+ /**
36
+ * 货币单位
37
+ */
38
+ currency?: CurrencyCode;
39
+ /**
40
+ * 百分比展示
41
+ */
42
+ percent?: boolean;
43
+ /**
44
+ * 自定义单位
45
+ */
46
+ unit?: string;
47
+ /**
48
+ * 自定义单位颜色
49
+ */
50
+ unitColor?: string;
51
+ /**
52
+ * 自定义健颜色
53
+ */
54
+ labelColor?: string;
55
+ /**
56
+ * 自定义值颜色
57
+ */
58
+ valueColor?: string;
59
+ /**
60
+ * 跳转第三方链接
61
+ */
62
+ link?: string;
63
+ /**
64
+ * 自定义链接颜色
65
+ */
66
+ linkColor?: string;
67
+ }
68
+ /**
69
+ * ApLadder Props 属性类型声明
70
+ */
71
+ export interface ApLadderProps {
72
+ /**
73
+ * 重要信息
74
+ * @description 如 操作人名称、供应商名称...
75
+ */
76
+ major: string;
77
+ /**
78
+ * 次要信息
79
+ * @description 如 操作人邮箱、供应商编码...
80
+ */
81
+ minor: string;
82
+ /**
83
+ * 自定义重要信息颜色
84
+ */
85
+ majorColor: string;
86
+ /**
87
+ * 自定义次要信息颜色
88
+ */
89
+ minorColor: string;
90
+ /**
91
+ * 布局方式
92
+ * - `vertical` 垂直布局
93
+ * - `horizontal` 水平布局
94
+ * @default `vertical`
95
+ */
96
+ layout: 'vertical' | 'horizontal';
97
+ /**
98
+ * 是否展示气泡
99
+ * @description 默认展示
100
+ */
101
+ tooltip: boolean;
102
+ /**
103
+ * 健值对 - 数组展示
104
+ */
105
+ labelValues: Array<ApLadderLabelValue>;
106
+ /**
107
+ * 扩展 Tooltip
108
+ */
109
+ tooltipProps: TooltipNeedProps;
110
+ }
111
+ /**
112
+ * ApLadder Slots 类型声明
113
+ */
114
+ export interface ApLadderSlots {
115
+ title?: VNode;
116
+ }
117
+ /**
118
+ * 国际货币代码-映射-语言
119
+ */
120
+ export interface CurrencyCodeInLocale {
121
+ [string: string]: Intl.LocalesArgument;
122
+ }
123
+ /**
124
+ * 国际货币代码
125
+ * - `CNY` 人民币
126
+ * - `USD` 美元
127
+ * - `EUR` 欧元
128
+ * - `GBP` 英镑
129
+ */
130
+ export type CurrencyCode = 'CNY' | 'USD' | 'EUR' | 'GBP';
131
+ /**
132
+ * 国际货币代码-映射-语言
133
+ */
134
+ export declare const locales: CurrencyCodeInLocale;
@@ -0,0 +1,10 @@
1
+ const e = {
2
+ USD: "en-US",
3
+ CNY: "zh-CN",
4
+ EUR: "de-DE",
5
+ GBP: "en-GB"
6
+ // 请自行添加更多的国际货币代码-映射-语言
7
+ };
8
+ export {
9
+ e as locales
10
+ };
@@ -0,0 +1,56 @@
1
+ .aplus-ap-ladder {
2
+ position: relative;
3
+ width: inherit;
4
+ font-size: 14px;
5
+ /** 自动溢出省略 */
6
+ /** Aplus端样式 */
7
+ /** Admin端样式 */
8
+ }
9
+ .aplus-ap-ladder__ellipsis {
10
+ overflow: hidden;
11
+ text-overflow: ellipsis;
12
+ white-space: nowrap;
13
+ word-break: break-all;
14
+ }
15
+ .aplus-ap-ladder__major {
16
+ line-height: 22px;
17
+ color: #182948;
18
+ }
19
+ .aplus-ap-ladder__minor {
20
+ line-height: 22px;
21
+ color: #8896B0;
22
+ }
23
+ .aplus-ap-ladder__label {
24
+ color: #8896B0;
25
+ word-break: break-all;
26
+ }
27
+ .aplus-ap-ladder__value {
28
+ color: #182948;
29
+ word-break: break-all;
30
+ }
31
+ .aplus-ap-ladder__unit {
32
+ margin-left: 5px;
33
+ color: #182948;
34
+ }
35
+ .aplus-ap-ladder__link {
36
+ cursor: pointer;
37
+ color: #0070ff;
38
+ }
39
+ .aplus-ap-ladder--admin .aplus-ap-ladder__major {
40
+ color: #333333;
41
+ }
42
+ .aplus-ap-ladder--admin .aplus-ap-ladder__minor {
43
+ color: #999999;
44
+ }
45
+ .aplus-ap-ladder--admin .aplus-ap-ladder__label {
46
+ color: #999999;
47
+ }
48
+ .aplus-ap-ladder--admin .aplus-ap-ladder__value {
49
+ color: #333333;
50
+ }
51
+ .aplus-ap-ladder--admin .aplus-ap-ladder__unit {
52
+ color: #333333;
53
+ }
54
+ .aplus-ap-ladder--admin .aplus-ap-ladder__link {
55
+ color: #34b77c;
56
+ }
@@ -1 +1,2 @@
1
1
  export * from './usePageListApTable';
2
+ export * from './useTableRefresh';
@@ -1,4 +1,6 @@
1
1
  import { usePageListApTable as o } from "./usePageListApTable.mjs";
2
+ import { useTableRefresh as a } from "./useTableRefresh.mjs";
2
3
  export {
3
- o as usePageListApTable
4
+ o as usePageListApTable,
5
+ a as useTableRefresh
4
6
  };
@@ -1,4 +1,5 @@
1
1
  import { ApTableProps } from '../../';
2
+ import { UseTableRefreshOption } from './useTableRefresh';
2
3
  import { Recordable } from '../../type';
3
4
  export interface UsePageListApTable extends ApTableProps {
4
5
  /** 是否显示默认的行选择配置
@@ -9,6 +10,16 @@ export interface UsePageListApTable extends ApTableProps {
9
10
  transformSearchFormValues?: (values: any) => any;
10
11
  /** ApTable数据接口 */
11
12
  api?(record: any): Promise<any>;
13
+ /** 发起请求的时候情况行选中
14
+ * @default true
15
+ */
16
+ clearSelectionOnRequest?: boolean;
17
+ /** 用于覆盖默认的class */
18
+ class?: string;
19
+ /**
20
+ * 表格刷新相关
21
+ */
22
+ tableRefresh?: boolean | Omit<UseTableRefreshOption, 'apTableRef'>;
12
23
  }
13
24
  /**
14
25
  * 集成了列表页面的ApTable的默认配置
@@ -20,10 +31,21 @@ export declare function usePageListApTable(props?: UsePageListApTable): [ApTable
20
31
  reset: () => void;
21
32
  getSearchFormValues: () => any;
22
33
  getApTableInstance: () => {
23
- reset: () => void;
24
34
  submit: () => void;
25
- dataSource: any;
35
+ reset: () => void;
26
36
  setSearchFormValues: (fields: Partial< Recordable>) => void;
27
37
  getSearchFormValues: () => Partial< Recordable>;
28
- } | null;
38
+ dataSource: any;
39
+ rowSelection?: {
40
+ select: (item: any) => void;
41
+ selectedRows: any[];
42
+ unSelect: (item: any) => void;
43
+ isSelected: (item: any) => boolean;
44
+ selectAll: () => void;
45
+ unSelectAll: () => void;
46
+ clearAll: () => void;
47
+ toggleSelect: (item: any) => void;
48
+ } | undefined;
49
+ } | null | undefined;
50
+ clearSelection: () => void;
29
51
  }];
@@ -1,17 +1,27 @@
1
- import "../../index.mjs";
2
- import { merge as p } from "lodash-unified";
3
- import { ref as m } from "vue";
4
- import { useGlobalConfig as d } from "../../config-provider/hooks/use-global-config.mjs";
5
- function A(l) {
6
- const t = m(null), n = d("uiMode", "aplus");
7
- console.log("mode", n.value);
8
- const {
1
+ import { merge as m } from "lodash-unified";
2
+ import { ref as b } from "vue";
3
+ import { useTableRefresh as d } from "./useTableRefresh.mjs";
4
+ function h(a) {
5
+ return a === !0 ? {} : a === !1 ? {
6
+ refreshBefore: () => !1
7
+ } : a;
8
+ }
9
+ function F(a) {
10
+ const r = b(null), {
9
11
  isShowRowSelection: c = !0,
12
+ clearSelectionOnRequest: u = !0,
10
13
  transformSearchFormValues: o,
11
- api: a,
12
- ...u
13
- } = l || {};
14
- return [p(
14
+ api: s,
15
+ tableRefresh: i = !1,
16
+ ...f
17
+ } = a || {}, n = () => {
18
+ var e, t;
19
+ (t = (e = r.value) == null ? void 0 : e.rowSelection) == null || t.clearAll();
20
+ };
21
+ return d({
22
+ ...h(i),
23
+ apTableRef: r
24
+ }), [m(
15
25
  {
16
26
  // scroll,tableLayout,columnResizable设置表格可拖动
17
27
  scroll: { x: "100%", y: "100%" },
@@ -19,17 +29,17 @@ function A(l) {
19
29
  columnResizable: !0,
20
30
  // 表格header吸顶效果
21
31
  class: "ap-table--sticky",
22
- request: a ? async (e) => {
23
- const r = o ? o(e) : e;
32
+ request: s ? async (e) => {
33
+ const t = o ? o(e) : e;
24
34
  try {
25
- if (!a) throw new Error("api is not defined");
26
- const { records: s, total: i } = await a(r);
27
- return {
28
- data: s,
29
- total: i
35
+ if (!s) throw new Error("api is not defined");
36
+ const { records: l, total: p } = await s(t);
37
+ return u && n(), {
38
+ data: l,
39
+ total: p
30
40
  };
31
- } catch (s) {
32
- return console.error(s), {
41
+ } catch (l) {
42
+ return console.error(l), {
33
43
  data: [],
34
44
  total: 0
35
45
  };
@@ -41,27 +51,28 @@ function A(l) {
41
51
  columnWidth: 50
42
52
  } : void 0,
43
53
  ref(e) {
44
- t.value = e;
54
+ r.value = e;
45
55
  }
46
56
  },
47
- u
57
+ f
48
58
  ), {
49
59
  reload: () => {
50
60
  var e;
51
- (e = t.value) == null || e.submit();
61
+ (e = r.value) == null || e.submit();
52
62
  },
53
63
  reset: () => {
54
64
  var e;
55
- (e = t.value) == null || e.reset();
65
+ (e = r.value) == null || e.reset();
56
66
  },
57
67
  getSearchFormValues: () => {
58
- var r;
59
- const e = ((r = t.value) == null ? void 0 : r.getSearchFormValues()) || {};
68
+ var t;
69
+ const e = ((t = r.value) == null ? void 0 : t.getSearchFormValues()) || {};
60
70
  return o ? o(e) : e;
61
71
  },
62
- getApTableInstance: () => t.value
72
+ getApTableInstance: () => r.value,
73
+ clearSelection: n
63
74
  }];
64
75
  }
65
76
  export {
66
- A as usePageListApTable
77
+ F as usePageListApTable
67
78
  };
@@ -0,0 +1,17 @@
1
+ import { Ref } from 'vue';
2
+ import { ApTableExpose } from '../../';
3
+ export interface UseTableRefreshOption {
4
+ /**
5
+ * apTable实例
6
+ */
7
+ apTableRef?: Ref<ApTableExpose | undefined | null>;
8
+ /**
9
+ * 刷新类型,reset:重置,submit:提交
10
+ */
11
+ refreskType?: 'reset' | 'submit';
12
+ /**
13
+ * 刷新前执行,返回false则不执行
14
+ */
15
+ refreshBefore?: () => boolean;
16
+ }
17
+ export declare function useTableRefresh(option?: UseTableRefreshOption): void;
@@ -0,0 +1,16 @@
1
+ import { onMounted as c, nextTick as l, onActivated as T } from "vue";
2
+ function m(e) {
3
+ const a = (["reset", "submit", void 0].includes(e == null ? void 0 : e.refreskType) ? e == null ? void 0 : e.refreskType : "submit") ?? "submit", r = (e == null ? void 0 : e.refreshBefore) ?? (() => !0);
4
+ let s = !0;
5
+ c(() => {
6
+ l(() => {
7
+ s = !1;
8
+ });
9
+ }), T(() => {
10
+ var u, f;
11
+ s || r != null && r() && ((f = (u = e == null ? void 0 : e.apTableRef) == null ? void 0 : u.value) == null || f[a]());
12
+ });
13
+ }
14
+ export {
15
+ m as useTableRefresh
16
+ };