@aplus-frontend/ui 0.0.21 → 0.0.22

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 (35) hide show
  1. package/es/index.mjs +34 -32
  2. package/es/src/ap-form/hooks/use-watch.d.ts +1 -1
  3. package/es/src/ap-form/modal-form/index.vue.mjs +41 -39
  4. package/es/src/ap-list/hooks/use-offline-list.d.ts +21 -0
  5. package/es/src/ap-list/hooks/use-offline-list.mjs +32 -0
  6. package/es/src/ap-list/index.d.ts +4 -0
  7. package/es/src/ap-list/index.mjs +2 -0
  8. package/es/src/ap-list/index.vue.d.ts +153 -0
  9. package/es/src/ap-list/index.vue.mjs +137 -0
  10. package/es/src/ap-list/index.vue2.mjs +4 -0
  11. package/es/src/ap-list/interface.d.ts +35 -2
  12. package/es/src/ap-list/interface.mjs +1 -0
  13. package/es/src/ap-list/style/index.css +5 -0
  14. package/es/src/ap-table/interface.d.ts +2 -2
  15. package/es/src/index.d.ts +1 -0
  16. package/es/src/index.mjs +230 -227
  17. package/es/src/theme/ap-list/index.css +5 -0
  18. package/lib/index.js +1 -1
  19. package/lib/src/ap-form/hooks/use-watch.d.ts +1 -1
  20. package/lib/src/ap-form/modal-form/index.vue.js +1 -1
  21. package/lib/src/ap-list/hooks/use-offline-list.d.ts +21 -0
  22. package/lib/src/ap-list/hooks/use-offline-list.js +1 -0
  23. package/lib/src/ap-list/index.d.ts +4 -0
  24. package/lib/src/ap-list/index.js +1 -0
  25. package/lib/src/ap-list/index.vue.d.ts +153 -0
  26. package/lib/src/ap-list/index.vue.js +1 -0
  27. package/lib/src/ap-list/index.vue2.js +1 -0
  28. package/lib/src/ap-list/interface.d.ts +35 -2
  29. package/lib/src/ap-list/interface.js +1 -0
  30. package/lib/src/ap-list/style/index.css +5 -0
  31. package/lib/src/ap-table/interface.d.ts +2 -2
  32. package/lib/src/index.d.ts +1 -0
  33. package/lib/src/index.js +1 -1
  34. package/lib/src/theme/ap-list/index.css +5 -0
  35. package/package.json +1 -1
@@ -0,0 +1,137 @@
1
+ import { defineComponent as F, ref as M, unref as e, computed as l, watch as W, openBlock as r, createBlock as C, normalizeClass as s, withCtx as j, createElementVNode as A, normalizeStyle as P, renderSlot as c, createElementBlock as m, Fragment as G, renderList as U, createVNode as x, mergeProps as H, createCommentVNode as J } from "vue";
2
+ import { Empty as D, Spin as K, Pagination as Q } from "ant-design-vue";
3
+ import "../ap-table/index.mjs";
4
+ import "../config-provider/index.mjs";
5
+ import { isUndefined as k, omit as X } from "lodash-unified";
6
+ import { useOfflineList as Y } from "./hooks/use-offline-list.mjs";
7
+ import "./style/index.css";
8
+ import { useNamespace as Z } from "../config-provider/hooks/use-namespace.mjs";
9
+ import { useTablePaging as ee } from "../ap-table/hooks/use-table-paging.mjs";
10
+ const fe = /* @__PURE__ */ F({
11
+ __name: "index",
12
+ props: {
13
+ dataSource: {},
14
+ loading: { type: Boolean, default: void 0 },
15
+ onItem: {},
16
+ params: {},
17
+ request: {},
18
+ defaultData: {},
19
+ onLoadingChange: {},
20
+ beforeSearchSubmit: {},
21
+ pagination: { type: [Boolean, Object], default: void 0 },
22
+ manual: { type: Boolean },
23
+ containerStyle: {},
24
+ footerWarpperStyle: {}
25
+ },
26
+ setup(B, { expose: E }) {
27
+ const w = D.PRESENTED_IMAGE_SIMPLE, t = B, { b: d, e: g } = Z("ap-list"), p = M(), {
28
+ formRef: I,
29
+ submit: S,
30
+ reset: h,
31
+ handleTableChange: L,
32
+ data: u,
33
+ refresh: z,
34
+ refreshByDelete: N,
35
+ tableProps: y
36
+ } = ee({
37
+ async request(a) {
38
+ var o;
39
+ const n = await ((o = t.request) == null ? void 0 : o.call(t, a));
40
+ return {
41
+ data: (n == null ? void 0 : n.data) || [],
42
+ total: (n == null ? void 0 : n.total) || 0
43
+ };
44
+ },
45
+ defaultParams: t.params,
46
+ defaultData: t.defaultData,
47
+ manual: t.manual,
48
+ defaultCurrent: t.pagination ? t.pagination.defaultCurrent : void 0,
49
+ defaultPageSize: t.pagination ? t.pagination.defaultPageSize : void 0,
50
+ formatParams: t.beforeSearchSubmit
51
+ }), R = { form: I }, {
52
+ pagination: v,
53
+ dataSource: T,
54
+ onChange: _
55
+ } = Y(t);
56
+ function q(a, n) {
57
+ if (e(i)) {
58
+ _(a, n);
59
+ return;
60
+ }
61
+ L(
62
+ { current: a, pageSize: n },
63
+ {},
64
+ {},
65
+ { currentDataSource: [], action: "paginate" }
66
+ );
67
+ }
68
+ const f = l(() => e(i) ? e(T) : e(u).records), b = l(() => k(t.loading) ? e(u).loading : t.loading), O = l(() => {
69
+ var a, n;
70
+ return t.pagination === !1 ? !1 : ((a = t.pagination) == null ? void 0 : a.hideOnSinglePage) !== !0 ? !0 : e(i) ? (((n = t.dataSource) == null ? void 0 : n.length) || 0) > e(v).pageSize : e(u).total > e(y).pagination.pageSize;
71
+ }), i = l(() => !k(t.dataSource));
72
+ W(
73
+ () => e(b),
74
+ (a) => {
75
+ var n;
76
+ (n = t.onLoadingChange) == null || n.call(t, a);
77
+ }
78
+ );
79
+ function V(a) {
80
+ var n, o;
81
+ (o = (n = p.value) == null ? void 0 : n.querySelector(a || ":first-child")) == null || o.scrollIntoView({ behavior: "smooth", block: "center" });
82
+ }
83
+ return E({
84
+ submit: () => S(),
85
+ reset: () => h(),
86
+ refresh: () => z(),
87
+ refreshByDelete: (a) => N(a),
88
+ scrollToFirstRow: V
89
+ }), (a, n) => (r(), C(e(K), {
90
+ spinning: b.value,
91
+ class: s(e(d)("spin"))
92
+ }, {
93
+ default: j(() => [
94
+ A("div", {
95
+ class: s(e(d)()),
96
+ style: P(a.containerStyle)
97
+ }, [
98
+ c(a.$slots, "header", {
99
+ formIns: R,
100
+ submit: e(S),
101
+ reset: e(h)
102
+ }),
103
+ f.value.length === 0 ? (r(), C(e(D), {
104
+ key: 0,
105
+ image: e(w)
106
+ }, null, 8, ["image"])) : (r(), m("div", {
107
+ key: 1,
108
+ ref_key: "contentRef",
109
+ ref: p,
110
+ class: s(e(g)("content"))
111
+ }, [
112
+ c(a.$slots, "renderContent", { dataSource: f.value }, () => [
113
+ (r(!0), m(G, null, U(f.value, (o, $) => c(a.$slots, "renderItem", {
114
+ item: o,
115
+ index: $
116
+ })), 256))
117
+ ])
118
+ ], 2)),
119
+ O.value ? (r(), m("div", {
120
+ key: 2,
121
+ class: s(e(g)("footer")),
122
+ style: P(a.footerWarpperStyle)
123
+ }, [
124
+ x(e(Q), H(
125
+ i.value ? e(v) : e(X)(e(y).pagination, ["showTotal"]),
126
+ { onChange: q }
127
+ ), null, 16)
128
+ ], 6)) : J("", !0)
129
+ ], 6)
130
+ ]),
131
+ _: 3
132
+ }, 8, ["spinning", "class"]));
133
+ }
134
+ });
135
+ export {
136
+ fe as default
137
+ };
@@ -0,0 +1,4 @@
1
+ import f from "./index.vue.mjs";
2
+ export {
3
+ f as default
4
+ };
@@ -26,8 +26,8 @@ export type ApListProps<RecordType = any, ParamsType = Recordable> = {
26
26
  * @returns
27
27
  */
28
28
  request?: (params: Partial<ParamsType> & {
29
- pageSize?: number;
30
- current?: number;
29
+ pageSize: number;
30
+ current: number;
31
31
  }) => Promise<Partial<RequestData<RecordType>>>;
32
32
  /**
33
33
  * 表格的默认数据源,这些数据源将会在第一次请求后被替换
@@ -51,6 +51,10 @@ export type ApListProps<RecordType = any, ParamsType = Recordable> = {
51
51
  pagination?: false | {
52
52
  defaultCurrent?: number;
53
53
  defaultPageSize?: number;
54
+ /**
55
+ * 只有一页时隐藏分页
56
+ */
57
+ hideOnSinglePage?: boolean;
54
58
  };
55
59
  /**
56
60
  * 是否手动发起第一次网络请求
@@ -65,3 +69,32 @@ export type ApListProps<RecordType = any, ParamsType = Recordable> = {
65
69
  */
66
70
  footerWarpperStyle?: CSSProperties;
67
71
  };
72
+ export type ApListExpose = {
73
+ /**
74
+ * 重置页码并发起网络请求
75
+ * @returns
76
+ */
77
+ submit: () => void;
78
+ /**
79
+ * 重设查询表单(如果有的话)并发起网络请求
80
+ * @returns
81
+ */
82
+ reset: () => void;
83
+ /**
84
+ * 刷新当前页
85
+ * @returns
86
+ */
87
+ refresh: () => void;
88
+ /**
89
+ * 删除N条数据后刷新某一页(具体页面会计算)
90
+ * @param n 删除的n条数据
91
+ * @returns
92
+ */
93
+ refreshByDelete: (n: number) => void;
94
+ /**
95
+ * 滚动到第一行(如果无效需要你传入相对于div.ap-list__content的查询参数)
96
+ * @param selector
97
+ * @returns
98
+ */
99
+ scrollToFirstRow: (selector?: string) => void;
100
+ };
@@ -0,0 +1 @@
1
+
@@ -3,4 +3,9 @@
3
3
  }
4
4
  .aplus-ap-list__footer {
5
5
  margin-top: 16px;
6
+ display: flex;
7
+ justify-content: flex-end;
8
+ }
9
+ .aplus-ap-list-spin {
10
+ max-height: unset !important;
6
11
  }
@@ -165,8 +165,8 @@ export type ApTableProps<RecordType = any, ParamsType = any> = Omit<TableProps<R
165
165
  * @returns
166
166
  */
167
167
  request?: (params: Partial<ParamsType> & {
168
- pageSize?: number;
169
- current?: number;
168
+ pageSize: number;
169
+ current: number;
170
170
  sort?: Record<string, SortOrder>;
171
171
  filter?: Recordable<any>;
172
172
  }) => Promise<Partial<RequestData<RecordType>>>;
package/es/src/index.d.ts CHANGED
@@ -28,6 +28,7 @@ export * from './ap-upload';
28
28
  export * from './ap-download';
29
29
  export * from './check-card';
30
30
  export * from './ap-modal';
31
+ export * from './ap-list';
31
32
  export * from './business';
32
33
  export * from './ap-table';
33
34
  export * from './editable-table';