@aplus-frontend/ui 0.0.21 → 0.0.23

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 (55) 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/check-card/group.vue.d.ts +1 -1
  16. package/es/src/check-card/group.vue.mjs +1 -1
  17. package/es/src/check-card/index.vue.d.ts +1 -1
  18. package/es/src/check-card/index.vue2.mjs +40 -36
  19. package/es/src/check-card/interface.d.ts +1 -1
  20. package/es/src/editable-table/form-item.vue.d.ts +755 -105
  21. package/es/src/editable-table/form-item.vue.mjs +81 -64
  22. package/es/src/editable-table/index.vue.d.ts +527 -112
  23. package/es/src/editable-table/index.vue.mjs +93 -76
  24. package/es/src/editable-table/interface.d.ts +11 -5
  25. package/es/src/index.d.ts +1 -0
  26. package/es/src/index.mjs +230 -227
  27. package/es/src/theme/ap-list/index.css +5 -0
  28. package/lib/index.js +1 -1
  29. package/lib/src/ap-form/hooks/use-watch.d.ts +1 -1
  30. package/lib/src/ap-form/modal-form/index.vue.js +1 -1
  31. package/lib/src/ap-list/hooks/use-offline-list.d.ts +21 -0
  32. package/lib/src/ap-list/hooks/use-offline-list.js +1 -0
  33. package/lib/src/ap-list/index.d.ts +4 -0
  34. package/lib/src/ap-list/index.js +1 -0
  35. package/lib/src/ap-list/index.vue.d.ts +153 -0
  36. package/lib/src/ap-list/index.vue.js +1 -0
  37. package/lib/src/ap-list/index.vue2.js +1 -0
  38. package/lib/src/ap-list/interface.d.ts +35 -2
  39. package/lib/src/ap-list/interface.js +1 -0
  40. package/lib/src/ap-list/style/index.css +5 -0
  41. package/lib/src/ap-table/interface.d.ts +2 -2
  42. package/lib/src/check-card/group.vue.d.ts +1 -1
  43. package/lib/src/check-card/group.vue.js +1 -1
  44. package/lib/src/check-card/index.vue.d.ts +1 -1
  45. package/lib/src/check-card/index.vue2.js +1 -1
  46. package/lib/src/check-card/interface.d.ts +1 -1
  47. package/lib/src/editable-table/form-item.vue.d.ts +755 -105
  48. package/lib/src/editable-table/form-item.vue.js +1 -1
  49. package/lib/src/editable-table/index.vue.d.ts +527 -112
  50. package/lib/src/editable-table/index.vue.js +1 -1
  51. package/lib/src/editable-table/interface.d.ts +11 -5
  52. package/lib/src/index.d.ts +1 -0
  53. package/lib/src/index.js +1 -1
  54. package/lib/src/theme/ap-list/index.css +5 -0
  55. package/package.json +3 -3
@@ -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>>>;
@@ -28,7 +28,7 @@ declare const _default: __VLS_WithTemplateSlots< DefineComponent<__VLS_WithDefau
28
28
  size: "small" | "middle";
29
29
  value: CheckCardValueType | CheckCardValueType[];
30
30
  bordered: boolean;
31
- stopPropagation: boolean;
31
+ stopPropagation: boolean | ((event: MouseEvent) => boolean);
32
32
  }, {}>, {
33
33
  default?(_: {}): any;
34
34
  }>;
@@ -11,7 +11,7 @@ const z = /* @__PURE__ */ g({
11
11
  disabled: { type: Boolean, default: void 0 },
12
12
  loading: { type: Boolean, default: void 0 },
13
13
  size: { default: void 0 },
14
- stopPropagation: { type: Boolean, default: void 0 },
14
+ stopPropagation: { type: [Boolean, Function], default: void 0 },
15
15
  multiple: { type: Boolean, default: !1 },
16
16
  defaultValue: { type: [String, Number, Boolean, Array] },
17
17
  value: { type: [String, Number, Boolean, Array], default: void 0 },
@@ -27,7 +27,7 @@ declare const _default: __VLS_WithTemplateSlots< DefineComponent<__VLS_WithDefau
27
27
  size: "small" | "middle";
28
28
  bordered: boolean;
29
29
  checked: boolean;
30
- stopPropagation: boolean;
30
+ stopPropagation: boolean | ((event: MouseEvent) => boolean);
31
31
  }, {}>, Readonly<CheckCardSlots> & CheckCardSlots>;
32
32
  export default _default;
33
33
  type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
@@ -1,15 +1,15 @@
1
- import { defineComponent as F, computed as i, unref as l, createVNode as m, watch as I, watchEffect as U, openBlock as c, createElementBlock as N, normalizeStyle as W, normalizeClass as P, withModifiers as j, createBlock as f, renderSlot as G, resolveDynamicComponent as V, createCommentVNode as v, createElementVNode as O } from "vue";
2
- import { Skeleton as $ } from "ant-design-vue";
1
+ import { defineComponent as I, computed as i, unref as l, createVNode as m, watch as U, watchEffect as W, openBlock as c, createElementBlock as N, normalizeStyle as j, normalizeClass as P, withModifiers as G, createBlock as f, renderSlot as O, resolveDynamicComponent as V, createCommentVNode as v, createElementVNode as $ } from "vue";
2
+ import { Skeleton as q } from "ant-design-vue";
3
3
  import "../config-provider/index.mjs";
4
4
  import "../hooks/index.mjs";
5
5
  import { isFunction as z } from "lodash-unified";
6
- import { useInjectCheckCard as q } from "./context.mjs";
6
+ import { useInjectCheckCard as A } from "./context.mjs";
7
7
  import "./style/index.css";
8
- import A from "./checked.svg.mjs";
9
- import { useNamespace as H } from "../config-provider/hooks/use-namespace.mjs";
10
- import { useGlobalConfig as J } from "../config-provider/hooks/use-global-config.mjs";
11
- import { useControllableValue as K } from "../hooks/useControllableValue.mjs";
12
- const L = ["src"], ne = /* @__PURE__ */ F({
8
+ import H from "./checked.svg.mjs";
9
+ import { useNamespace as J } from "../config-provider/hooks/use-namespace.mjs";
10
+ import { useGlobalConfig as K } from "../config-provider/hooks/use-global-config.mjs";
11
+ import { useControllableValue as L } from "../hooks/useControllableValue.mjs";
12
+ const Q = ["src"], re = /* @__PURE__ */ I({
13
13
  name: "CheckCard",
14
14
  __name: "index",
15
15
  props: {
@@ -27,7 +27,7 @@ const L = ["src"], ne = /* @__PURE__ */ F({
27
27
  default: "middle"
28
28
  },
29
29
  stopPropagation: {
30
- type: Boolean,
30
+ type: [Boolean, Function],
31
31
  default: !1
32
32
  },
33
33
  checked: {
@@ -48,19 +48,19 @@ const L = ["src"], ne = /* @__PURE__ */ F({
48
48
  content: {}
49
49
  },
50
50
  emits: ["update:checked"],
51
- setup(_, {
52
- emit: w
51
+ setup(S, {
52
+ emit: _
53
53
  }) {
54
- const o = _, {
54
+ const o = S, {
55
55
  b: g,
56
- m: u,
56
+ m: s,
57
57
  e: p,
58
- bm: D,
58
+ bm: w,
59
59
  em: k
60
- } = H("check-card"), b = J("uiMode", "aplus"), E = w, n = q(), {
60
+ } = J("check-card"), h = K("uiMode", "aplus"), D = _, n = A(), {
61
61
  value: r,
62
- updateValue: h
63
- } = K(o, E, {
62
+ updateValue: b
63
+ } = L(o, D, {
64
64
  valuePropName: "checked",
65
65
  defaultValuePropName: "defaultChecked"
66
66
  }), a = i(() => {
@@ -68,12 +68,12 @@ const L = ["src"], ne = /* @__PURE__ */ F({
68
68
  ...o
69
69
  }, t = l(n);
70
70
  return t && (e.disabled = e.disabled || t.disabled, e.bordered = e.bordered || t.bordered, e.loading = e.loading || t.loading, e.size = e.size || t.size, e.stopPropagation = e.stopPropagation || t.stopPropagation), e;
71
- }), S = i(() => {
72
- const e = l(b), t = l(a);
73
- return [g(), ...t.disabled ? [] : [g(e), l(r) ? D(e, "checked") : null], u(t.size), t.bordered ? u("bordered") : null, t.disabled ? u("disabled") : null];
71
+ }), E = i(() => {
72
+ const e = l(h), t = l(a);
73
+ return [g(), ...t.disabled ? [] : [g(e), l(r) ? w(e, "checked") : null], s(t.size), t.bordered ? s("bordered") : null, t.disabled ? s("disabled") : null];
74
74
  }), M = i(() => ({
75
75
  ...o.style,
76
- "--check-card-border-color": b.value === "admin" ? "#D9D9D9" : "#E9EDF3"
76
+ "--check-card-border-color": h.value === "admin" ? "#D9D9D9" : "#E9EDF3"
77
77
  })), y = i(() => {
78
78
  if (!o.title)
79
79
  return;
@@ -90,30 +90,34 @@ const L = ["src"], ne = /* @__PURE__ */ F({
90
90
  }, [e]);
91
91
  });
92
92
  function T(e) {
93
+ const t = l(a).stopPropagation;
94
+ return t ? t === !0 ? e.target !== e.currentTarget : t(e) : !1;
95
+ }
96
+ function F(e) {
93
97
  var t, d;
94
- a.value.stopPropagation && e.target !== e.currentTarget || a.value.loading || a.value.disabled || (n.value ? (d = (t = n.value) == null ? void 0 : t.toggleOption) == null || d.call(t, o.value) : h(!l(r)));
98
+ T(e) || a.value.loading || a.value.disabled || (n.value ? (d = (t = n.value) == null ? void 0 : t.toggleOption) == null || d.call(t, o.value) : b(!l(r)));
95
99
  }
96
- return I(() => n.value, (e) => {
100
+ return U(() => n.value, (e) => {
97
101
  if (!e)
98
102
  return;
99
103
  const t = e.multiple ? (e.value || []).includes(o.value) : e.value === o.value;
100
- h(t);
104
+ b(t);
101
105
  }, {
102
106
  immediate: !0
103
- }), U((e) => {
107
+ }), W((e) => {
104
108
  var t, d;
105
109
  (d = (t = n.value) == null ? void 0 : t.registerValue) == null || d.call(t, o.value), e(() => {
106
- var s, B;
107
- return (B = (s = n.value) == null ? void 0 : s.cancelValue) == null ? void 0 : B.call(s, o.value);
110
+ var u, B;
111
+ return (B = (u = n.value) == null ? void 0 : u.cancelValue) == null ? void 0 : B.call(u, o.value);
108
112
  });
109
113
  }), (e, t) => (c(), N("div", {
110
- style: W(M.value),
111
- class: P(S.value),
112
- onClick: j(T, ["stop"])
113
- }, [a.value.loading ? (c(), f(l($), {
114
+ style: j(M.value),
115
+ class: P(E.value),
116
+ onClick: G(F, ["stop"])
117
+ }, [a.value.loading ? (c(), f(l(q), {
114
118
  key: 0,
115
119
  active: ""
116
- })) : G(e.$slots, "default", {
120
+ })) : O(e.$slots, "default", {
117
121
  key: 1,
118
122
  checked: l(r)
119
123
  }, () => [y.value ? (c(), f(V(y.value), {
@@ -123,11 +127,11 @@ const L = ["src"], ne = /* @__PURE__ */ F({
123
127
  })) : v("", !0)]), l(r) ? (c(), N("div", {
124
128
  key: 2,
125
129
  class: P(l(p)("checked-icon"))
126
- }, [O("img", {
127
- src: l(A)
128
- }, null, 8, L)], 2)) : v("", !0)], 6));
130
+ }, [$("img", {
131
+ src: l(H)
132
+ }, null, 8, Q)], 2)) : v("", !0)], 6));
129
133
  }
130
134
  });
131
135
  export {
132
- ne as default
136
+ re as default
133
137
  };
@@ -24,7 +24,7 @@ type CheckCardCommonType = {
24
24
  /**
25
25
  * 是否阻止点击事件冒泡(对于自定义内容包含输入控件时需要设置)
26
26
  */
27
- stopPropagation?: boolean;
27
+ stopPropagation?: boolean | ((event: MouseEvent) => boolean);
28
28
  };
29
29
  export type CheckCardProps = CheckCardCommonType & {
30
30
  /**