@aplus-frontend/ui 0.6.7 → 0.6.8

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.
@@ -166,6 +166,10 @@ export type ApFormSearchFormProps = ApFormProps & {
166
166
  * 尺寸监听目标元素(用于响应式)
167
167
  */
168
168
  resizeTarget?: HTMLElement | null;
169
+ /**
170
+ * 查询按钮loading延迟(默认300ms)
171
+ */
172
+ loadingDelay?: number;
169
173
  };
170
174
  export type ApFormSearchFormPopoverFilterProps = {
171
175
  config: Array<{
@@ -858,6 +858,7 @@ declare const __VLS_component: DefineComponent<ApFormSearchFormProps, {
858
858
  forceExpand: boolean;
859
859
  maxRows: number;
860
860
  sortable: boolean;
861
+ loadingDelay: number;
861
862
  }, {}, {}, {}, string, ComponentProvideOptions, false, {
862
863
  apForm: ({
863
864
  $: ComponentInternalInstance;
@@ -1,10 +1,10 @@
1
- import { isVNode as le, defineComponent as re, useSlots as se, ref as U, shallowRef as W, computed as S, unref as n, watch as M, createVNode as t, Fragment as _, createBlock as g, openBlock as d, mergeProps as ie, withCtx as B, resolveDynamicComponent as I, createElementBlock as ue, renderList as ce } from "vue";
2
- import { Col as w, Flex as N, Button as z, Row as pe } from "@aplus-frontend/antdv";
1
+ import { isVNode as le, defineComponent as re, useSlots as se, ref as D, shallowRef as U, computed as S, unref as n, watch as W, createVNode as o, Fragment as _, createBlock as g, openBlock as d, mergeProps as ie, withCtx as B, resolveDynamicComponent as I, createElementBlock as ue, renderList as ce } from "vue";
2
+ import { Col as w, Flex as N, Button as M, Row as pe } from "@aplus-frontend/antdv";
3
3
  import "../ap-form.vue.mjs";
4
4
  import "../item/index.vue2.mjs";
5
- import { genRealChildren as D } from "../item-group/helper.mjs";
5
+ import { genRealChildren as z } from "../item-group/helper.mjs";
6
6
  import "../../config-provider/index.mjs";
7
- import { isArray as de, isBoolean as me, omit as fe } from "lodash-unified";
7
+ import { isArray as de, isBoolean as fe, omit as me } from "lodash-unified";
8
8
  import { isDef as q } from "../../utils/index.mjs";
9
9
  import { execFunc as H, diffFormItem as he } from "./utils.mjs";
10
10
  import "./components/popover-filter.vue.mjs";
@@ -17,10 +17,10 @@ import G from "../item/index.vue.mjs";
17
17
  import Ce from "./components/popover-filter.vue2.mjs";
18
18
  import Se from "./components/popover-sorter/index.vue2.mjs";
19
19
  import _e from "../ap-form.vue2.mjs";
20
- function we(m) {
21
- return typeof m == "function" || Object.prototype.toString.call(m) === "[object Object]" && !le(m);
20
+ function we(f) {
21
+ return typeof f == "function" || Object.prototype.toString.call(f) === "[object Object]" && !le(f);
22
22
  }
23
- const s = 24, De = /* @__PURE__ */ re({
23
+ const s = 24, ze = /* @__PURE__ */ re({
24
24
  name: "ApFormSearchForm",
25
25
  __name: "index",
26
26
  props: {
@@ -110,36 +110,39 @@ const s = 24, De = /* @__PURE__ */ re({
110
110
  type: Boolean,
111
111
  default: !0
112
112
  },
113
- resizeTarget: {}
113
+ resizeTarget: {},
114
+ loadingDelay: {
115
+ default: 300
116
+ }
114
117
  },
115
- setup(m, {
118
+ setup(f, {
116
119
  expose: J
117
120
  }) {
118
121
  var L;
119
- const i = se(), o = m, {
120
- b: f
122
+ const i = se(), t = f, {
123
+ b: m
121
124
  } = ye("ap-form-search-form"), {
122
125
  t: k
123
- } = ve(), K = xe(o), y = U(), Q = U();
126
+ } = ve(), K = xe(t), y = D(), Q = D();
124
127
  function T() {
125
128
  var a;
126
129
  const e = (a = y.value) == null ? void 0 : a.getFieldsValueTransformed(!0);
127
- H(o.onSubmit, e);
130
+ H(t.onSubmit, e);
128
131
  }
129
132
  function X() {
130
133
  var e, a;
131
- o.customReset || (a = (e = y.value) == null ? void 0 : e.resetFields) == null || a.call(e), H(o.onReset);
134
+ t.customReset || (a = (e = y.value) == null ? void 0 : e.resetFields) == null || a.call(e), H(t.onReset);
132
135
  }
133
136
  const Y = (e) => q(e) ? (de(e) ? e : [e]).join("") : Date.now();
134
137
  let E = [];
135
- const h = W(D(i.default())), c = W((L = i.extra) == null ? void 0 : L.call(i)), P = S(() => Math.floor(s / n(K))), {
138
+ const h = U(z(i.default())), c = U((L = i.extra) == null ? void 0 : L.call(i)), P = S(() => Math.floor(s / n(K))), {
136
139
  items: R,
137
140
  sorted: O,
138
141
  handleClickConfirm: b
139
142
  } = ge(h);
140
- M(() => i.default(), (e) => {
141
- E = h.value, h.value = he(E, D(e)), O.value = !1;
142
- }), M(() => {
143
+ W(() => i.default(), (e) => {
144
+ E = h.value, h.value = he(E, z(e)), O.value = !1;
145
+ }), W(() => {
143
146
  var e;
144
147
  return (e = i.extra) == null ? void 0 : e.call(i);
145
148
  }, (e) => {
@@ -148,10 +151,10 @@ const s = 24, De = /* @__PURE__ */ re({
148
151
  const l = S(() => {
149
152
  const e = h.value, a = [], r = [], x = [], u = n(P);
150
153
  let v = 0, F = 0;
151
- const te = s * o.maxRows - u * (n(c) && !o.extraInAction ? 2 : 1);
154
+ const te = s * t.maxRows - u * (n(c) && !t.extraInAction ? 2 : 1);
152
155
  e.forEach((A, ne) => {
153
156
  const p = A.props;
154
- if (me(p.hidden) ? !!p.hidden : q(p.hidden))
157
+ if (fe(p.hidden) ? !!p.hidden : q(p.hidden))
155
158
  a.push(A);
156
159
  else {
157
160
  let C = p.span || u;
@@ -165,7 +168,7 @@ const s = 24, De = /* @__PURE__ */ re({
165
168
  });
166
169
  const $ = s - (F + u) % s, oe = F % s < u, ae = $ < u ? s : $;
167
170
  return {
168
- hideNode: t(_, null, [a]),
171
+ hideNode: o(_, null, [a]),
169
172
  nodes: x,
170
173
  collapseNodes: r,
171
174
  extraSpan: ae,
@@ -173,63 +176,65 @@ const s = 24, De = /* @__PURE__ */ re({
173
176
  };
174
177
  }), Z = S(() => {
175
178
  let e;
176
- const a = l.value.collapseNodes.length || o.sortable && h.value.length, r = t(w, {
179
+ const a = l.value.collapseNodes.length || t.sortable && h.value.length, r = o(w, {
177
180
  span: n(P),
178
181
  key: "actionWrapper"
179
182
  }, {
180
- default: () => [t(G, null, {
181
- default: () => [t(N, {
183
+ default: () => [o(G, null, {
184
+ default: () => [o(N, {
182
185
  wrap: "wrap",
183
- justify: l.value.lastRowOnlyIncludeActionAndExtra && !(n(c) && o.extraInAction) ? "flex-end" : "space-between"
186
+ justify: l.value.lastRowOnlyIncludeActionAndExtra && !(n(c) && t.extraInAction) ? "flex-end" : "space-between"
184
187
  }, {
185
- default: () => [t(N, {
188
+ default: () => [o(N, {
186
189
  gap: 8,
187
190
  wrap: "wrap"
188
191
  }, {
189
- default: () => [a ? t("div", {
190
- class: f("column-setting-trigger-wrapper")
191
- }, [l.value.collapseNodes.length ? t(Ce, {
192
+ default: () => [a ? o("div", {
193
+ class: m("column-setting-trigger-wrapper")
194
+ }, [l.value.collapseNodes.length ? o(Ce, {
192
195
  onSubmit: T,
193
196
  config: l.value.collapseNodes,
194
- submitLoading: o.submitLoading
195
- }, null) : null, o.sortable && R.value.length ? t(Se, {
197
+ submitLoading: t.submitLoading
198
+ }, null) : null, t.sortable && R.value.length ? o(Se, {
196
199
  ref: "sorterIns",
197
200
  items: R.value,
198
201
  onClickConfirm: b,
199
202
  sorted: O.value
200
- }, null) : null]) : null, t(z, {
203
+ }, null) : null]) : null, o(M, {
201
204
  type: "primary",
202
205
  onClick: T,
203
- loading: o.submitLoading,
206
+ loading: t.submitLoading ? {
207
+ delay: t.loadingDelay
208
+ } : !1,
204
209
  htmlType: "submit",
205
- class: f("action-btn")
210
+ class: m("action-btn")
206
211
  }, {
207
- default: () => [o.searchText || k("ap.apForm.search.search")]
208
- }), t(z, {
212
+ default: () => [t.searchText || k("ap.apForm.search.search")]
213
+ }), o(M, {
209
214
  onClick: X,
210
215
  type: "text",
211
- class: [f("action-btn"), f("action-btn-reset")]
216
+ class: [m("action-btn"), m("action-btn-reset")]
212
217
  }, {
213
- default: () => [o.resetText || k("ap.apForm.search.reset")]
218
+ default: () => [t.resetText || k("ap.apForm.search.reset")]
214
219
  })]
215
- }), o.extraInAction ? n(c) : null]
220
+ }), t.extraInAction ? n(c) : null]
216
221
  })]
217
222
  })]
218
- }), x = !o.extraInAction && n(c) ? t(w, {
223
+ }), x = !t.extraInAction && n(c) ? o(w, {
219
224
  span: l.value.extraSpan,
220
225
  key: "extraNode"
221
226
  }, {
222
- default: () => [t(G, null, {
223
- default: () => [t(N, {
227
+ default: () => [o(G, null, {
228
+ default: () => [o(N, {
224
229
  justify: l.value.extraSpan === s || l.value.lastRowOnlyIncludeActionAndExtra ? "start" : "flex-end"
225
230
  }, we(e = n(c)) ? e : {
226
231
  default: () => [e]
227
232
  })]
228
233
  })]
229
- }) : null, u = t(w, {
234
+ }) : null, u = o(w, {
230
235
  span: l.value.extraSpan
231
236
  }, null);
232
- return l.value.lastRowOnlyIncludeActionAndExtra ? t(_, null, [x || u, r]) : t(_, null, [r, x]);
237
+ return l.value.lastRowOnlyIncludeActionAndExtra ? o(_, null, [x || u, r]) : o(_, null, [r, x]);
233
238
  });
234
239
  function ee() {
235
240
  var a;
@@ -244,9 +249,9 @@ const s = 24, De = /* @__PURE__ */ re({
244
249
  }), (e, a) => (d(), g(_e, ie({
245
250
  ref_key: "apForm",
246
251
  ref: y,
247
- class: n(f)()
248
- }, n(fe)(o, ["collapse", "defaultCollapse", "onUpdate:collapse", "searchText", "resetText", "onSubmit", "onReset", "extraInAction", "forceExpand", "countPerRow"])), {
249
- default: B(() => [(d(), g(I(l.value.hideNode))), t(n(pe), {
252
+ class: n(m)()
253
+ }, n(me)(t, ["collapse", "defaultCollapse", "onUpdate:collapse", "searchText", "resetText", "onSubmit", "onReset", "extraInAction", "forceExpand", "countPerRow"])), {
254
+ default: B(() => [(d(), g(I(l.value.hideNode))), o(n(pe), {
250
255
  gutter: 8
251
256
  }, {
252
257
  default: B(() => [(d(!0), ue(_, null, ce(l.value.nodes, (r) => (d(), g(n(w), {
@@ -263,5 +268,5 @@ const s = 24, De = /* @__PURE__ */ re({
263
268
  }
264
269
  });
265
270
  export {
266
- De as default
271
+ ze as default
267
272
  };
@@ -14,8 +14,8 @@ declare const _default: DefineComponent<__VLS_Props, {}, {}, {}, {}, ComponentOp
14
14
  "onUpdate:value"?: ((value: string | number) => any) | undefined;
15
15
  }>, {
16
16
  value: string | number;
17
- options: RadioOptionType[];
18
17
  delay: number;
18
+ options: RadioOptionType[];
19
19
  optionStyle: RadioOptionStyleType;
20
20
  }, {}, {}, {}, string, ComponentProvideOptions, false, {}, HTMLDivElement>;
21
21
  export default _default;
@@ -15,8 +15,8 @@ declare const ApRadioGroup: {
15
15
  "update:value": (value: string | number) => any;
16
16
  }, PublicProps, {
17
17
  value: string | number;
18
- options: RadioOptionType[];
19
18
  delay: number;
19
+ options: RadioOptionType[];
20
20
  optionStyle: RadioOptionStyleType;
21
21
  }, false, {}, {}, GlobalComponents, GlobalDirectives, string, {}, HTMLDivElement, ComponentProvideOptions, {
22
22
  P: {};
@@ -35,8 +35,8 @@ declare const ApRadioGroup: {
35
35
  "onUpdate:value"?: ((value: string | number) => any) | undefined;
36
36
  }>, {}, {}, {}, {}, {
37
37
  value: string | number;
38
- options: RadioOptionType[];
39
38
  delay: number;
39
+ options: RadioOptionType[];
40
40
  optionStyle: RadioOptionStyleType;
41
41
  }>;
42
42
  __isFragment?: never;
@@ -55,8 +55,8 @@ declare const ApRadioGroup: {
55
55
  "update:value": (value: string | number) => any;
56
56
  }, string, {
57
57
  value: string | number;
58
- options: RadioOptionType[];
59
58
  delay: number;
59
+ options: RadioOptionType[];
60
60
  optionStyle: RadioOptionStyleType;
61
61
  }, {}, string, {}, GlobalComponents, GlobalDirectives, string, ComponentProvideOptions> & VNodeProps & AllowedComponentProps & ComponentCustomProps & ( Plugin & (new (...args: any[]) => {
62
62
  $props: {
@@ -1,6 +1,6 @@
1
1
  import { ColumnsType } from '@aplus-frontend/antdv/es/table';
2
2
  import { AlignType, DataIndex, Key } from '@aplus-frontend/antdv/es/vc-table/interface';
3
- import { ApColumnType } from 'src/ap-table';
3
+ import { ApColumnType } from '../../ap-table';
4
4
  export type SummaryColumnType = ApColumnType[] | ColumnsType;
5
5
  export type ValueType = {
6
6
  [key in string]: any;
@@ -0,0 +1,14 @@
1
+ interface UseKeepAliveFlagOptions {
2
+ /** 状态切换到deactivated时触发 */
3
+ afterDeactivated?: () => void;
4
+ }
5
+ /**
6
+ * 获取keepAliveFlag
7
+ * @returns
8
+ */
9
+ export declare function useKeepAliveFlag(options?: UseKeepAliveFlagOptions): {
10
+ isDeactivated: () => boolean;
11
+ isActivated: () => boolean;
12
+ registerAfterDeactivated: (fn: UseKeepAliveFlagOptions["afterDeactivated"]) => void;
13
+ };
14
+ export {};
@@ -0,0 +1,18 @@
1
+ import { onActivated as v, onDeactivated as c } from "vue";
2
+ function l(a) {
3
+ let e = "notKeepAlive", t = a == null ? void 0 : a.afterDeactivated;
4
+ return v(() => {
5
+ e = "activated";
6
+ }), c(() => {
7
+ e = "deactivated", t == null || t();
8
+ }), {
9
+ isDeactivated: () => e === "deactivated",
10
+ isActivated: () => e === "activated",
11
+ registerAfterDeactivated: (i) => {
12
+ t = i;
13
+ }
14
+ };
15
+ }
16
+ export {
17
+ l as useKeepAliveFlag
18
+ };
@@ -19,6 +19,10 @@ export interface UsePageListApGrid extends ApGridProps {
19
19
  * 表格刷新相关
20
20
  */
21
21
  tableRefresh?: boolean | Omit<UseTableRefreshOption, 'apTableRef'>;
22
+ /** 是否需要在deactivated的时候清空数据
23
+ * @default true
24
+ */
25
+ clearDataOnDeactivated?: boolean;
22
26
  }
23
27
  /**
24
28
  * 集成了列表页面的ApGrid的默认配置
@@ -1,39 +1,56 @@
1
1
  import "../index.mjs";
2
- import { merge as c, cloneDeep as S } from "lodash-unified";
3
- import { ref as v } from "vue";
4
- import { useTableRefresh as g } from "./useTableRefresh.mjs";
5
- function T(s) {
6
- const o = v(null), {
7
- isShowRowSelection: i = !0,
8
- clearSelectionOnRequest: f = !0,
2
+ import { merge as i, cloneDeep as F } from "lodash-unified";
3
+ import { ref as R } from "vue";
4
+ import { useKeepAliveFlag as w } from "./useKeepAliveFlag.mjs";
5
+ import { useTableRefresh as V } from "./useTableRefresh.mjs";
6
+ function E(s) {
7
+ const o = R(null), {
8
+ isShowRowSelection: f = !0,
9
+ clearSelectionOnRequest: d = !0,
9
10
  transformSearchFormValues: a,
10
11
  api: l,
11
- tableRefresh: d = !0,
12
- virtual: m,
13
- ...p
12
+ tableRefresh: m = !0,
13
+ virtual: p,
14
+ clearDataOnDeactivated: h = !0,
15
+ ...v
14
16
  } = s || {};
15
17
  let n = null;
16
18
  const u = () => {
17
19
  var e, r;
18
20
  (r = (e = o.value) == null ? void 0 : e.rowSelection) == null || r.clearAll();
19
21
  };
20
- return g({
21
- ...R(d),
22
+ V({
23
+ ...b(m),
22
24
  apTableRef: o
23
- }), [c(
25
+ });
26
+ const c = () => {
27
+ var e;
28
+ (e = o.value) == null || e.submit();
29
+ }, S = () => {
30
+ var e;
31
+ (e = o.value) == null || e.reset();
32
+ }, { isDeactivated: g } = w({
33
+ afterDeactivated: c
34
+ });
35
+ return [i(
24
36
  {
25
37
  // scroll,tableLayout,columnResizable设置表格可拖动
26
38
  scroll: { x: "100%", y: "100%" },
27
39
  columnResizable: !0,
28
40
  request: l ? async (e) => {
41
+ if (g() && h)
42
+ return {
43
+ data: [],
44
+ total: 0
45
+ };
29
46
  n = e.sort;
30
47
  const r = a ? a(e) : e;
31
48
  try {
32
49
  if (!l) throw new Error("api is not defined");
33
- const { records: t, total: h } = await l(r);
34
- return f && u(), {
50
+ const { records: t, total: A } = await l(r);
51
+ return d && u(), {
35
52
  data: t,
36
- total: h
53
+ total: A
37
54
  };
38
55
  } catch (t) {
39
56
  return console.error(t), {
@@ -42,33 +59,27 @@ function T(s) {
42
59
  };
43
60
  }
44
61
  } : void 0,
45
- rowSelection: i ? {
62
+ rowSelection: f ? {
46
63
  fixed: "left",
47
64
  columnWidth: 38
48
65
  } : void 0,
49
66
  ref(e) {
50
67
  o.value = e;
51
68
  },
52
- virtual: c(
69
+ virtual: i(
53
70
  {
54
71
  oSize: 20,
55
72
  y: 20
56
73
  },
57
- m
74
+ p
58
75
  ),
59
76
  // 新UI规范,需要都添加分割线
60
77
  card: !0
61
78
  },
62
- p
79
+ v
63
80
  ), {
64
- reload: () => {
65
- var e;
66
- (e = o.value) == null || e.submit();
67
- },
68
- reset: () => {
69
- var e;
70
- (e = o.value) == null || e.reset();
71
- },
81
+ reload: c,
82
+ reset: S,
72
83
  getSearchFormValues: (e = !0) => {
73
84
  var t;
74
85
  const r = ((t = o.value) == null ? void 0 : t.getSearchFormValues(!!e)) || {};
@@ -78,16 +89,16 @@ function T(s) {
78
89
  getSearchFormValuesAndSorted: (e = !0) => {
79
90
  var t;
80
91
  const r = ((t = o.value) == null ? void 0 : t.getSearchFormValues(!!e)) || {};
81
- return r.sort = n && S(n), a ? a(r) : r;
92
+ return r.sort = n && F(n), a ? a(r) : r;
82
93
  },
83
94
  clearSelection: u
84
95
  }];
85
96
  }
86
- function R(s) {
97
+ function b(s) {
87
98
  return s === !0 ? {} : s === !1 ? {
88
99
  refreshBefore: () => !1
89
100
  } : s;
90
101
  }
91
102
  export {
92
- T as usePageListApGrid
103
+ E as usePageListApGrid
93
104
  };
@@ -1,2 +1,2 @@
1
- declare const _default: "0.6.7";
1
+ declare const _default: "0.6.8";
2
2
  export default _default;
@@ -1,4 +1,4 @@
1
- const e = "0.6.7";
1
+ const e = "0.6.8";
2
2
  export {
3
3
  e as default
4
4
  };
@@ -166,6 +166,10 @@ export type ApFormSearchFormProps = ApFormProps & {
166
166
  * 尺寸监听目标元素(用于响应式)
167
167
  */
168
168
  resizeTarget?: HTMLElement | null;
169
+ /**
170
+ * 查询按钮loading延迟(默认300ms)
171
+ */
172
+ loadingDelay?: number;
169
173
  };
170
174
  export type ApFormSearchFormPopoverFilterProps = {
171
175
  config: Array<{
@@ -858,6 +858,7 @@ declare const __VLS_component: DefineComponent<ApFormSearchFormProps, {
858
858
  forceExpand: boolean;
859
859
  maxRows: number;
860
860
  sortable: boolean;
861
+ loadingDelay: number;
861
862
  }, {}, {}, {}, string, ComponentProvideOptions, false, {
862
863
  apForm: ({
863
864
  $: ComponentInternalInstance;
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),r=require("@aplus-frontend/antdv");require("../ap-form.vue.js");require("../item/index.vue2.js");const T=require("../item-group/helper.js");require("../../config-provider/index.js");const w=require("lodash-unified"),P=require("../../utils/index.js"),S=require("./utils.js");require("./components/popover-filter.vue.js");const J=require("./hooks/use-count-per-row.js");require("./components/popover-sorter/index.vue.js");const K=require("./hooks/use-sorter.js"),Q=require("../../config-provider/hooks/use-namespace.js"),X=require("../../config-provider/hooks/use-locale.js"),E=require("../item/index.vue.js"),Y=require("./components/popover-filter.vue2.js"),Z=require("./components/popover-sorter/index.vue2.js"),ee=require("../ap-form.vue2.js");function te(p){return typeof p=="function"||Object.prototype.toString.call(p)==="[object Object]"&&!e.isVNode(p)}const s=24,oe=e.defineComponent({name:"ApFormSearchForm",__name:"index",props:{layout:{default:"horizontal"},labelCol:{},wrapperCol:{},colon:{type:Boolean,default:!0},labelAlign:{default:"right"},labelWrap:{type:Boolean},prefixCls:{},requiredMark:{},hideRequiredMark:{type:Boolean,default:!1},rules:{},validateMessages:{},validateOnRuleChange:{type:Boolean,default:!0},scrollToFirstError:{},onSubmit:{},name:{},validateTrigger:{default:"change"},size:{},disabled:{type:Boolean},onFieldsChange:{},onFinish:{},onFinishFailed:{},onValidate:{},initialValues:{},onValuesChange:{},syncToUrl:{type:[Boolean,Function]},syncToUrlPriority:{type:Boolean},collapse:{type:Boolean,default:void 0},defaultCollapse:{type:Boolean,default:!0},"onUpdate:collapse":{},searchText:{},resetText:{},onReset:{},customReset:{type:Boolean,default:!1},extraInAction:{type:Boolean,default:!1},forceExpand:{type:Boolean,default:!1},countPerRow:{default:4},submitLoading:{type:Boolean},maxRows:{default:2},sortable:{type:Boolean,default:!0},resizeTarget:{}},setup(p,{expose:O}){var V;const u=e.useSlots(),o=p,{b:f}=Q.useNamespace("ap-form-search-form"),{t:B}=X.useLocale(),L=J.useCountPerRow(o),g=e.ref(),j=e.ref();function F(){var n;const t=(n=g.value)==null?void 0:n.getFieldsValueTransformed(!0);S.execFunc(o.onSubmit,t)}function D(){var t,n;o.customReset||(n=(t=g.value)==null?void 0:t.resetFields)==null||n.call(t),S.execFunc(o.onReset)}const M=t=>P.isDef(t)?(w.isArray(t)?t:[t]).join(""):Date.now();let R=[];const m=e.shallowRef(T.genRealChildren(u.default())),i=e.shallowRef((V=u.extra)==null?void 0:V.call(u)),b=e.computed(()=>Math.floor(s/e.unref(L))),{items:v,sorted:k,handleClickConfirm:y}=K.useSorter(m);e.watch(()=>u.default(),t=>{R=m.value,m.value=S.diffFormItem(R,T.genRealChildren(t)),k.value=!1}),e.watch(()=>{var t;return(t=u.extra)==null?void 0:t.call(u)},t=>{i.value=t});const a=e.computed(()=>{const t=m.value,n=[],l=[],h=[],c=e.unref(b);let x=0,C=0;const $=s*o.maxRows-c*(e.unref(i)&&!o.extraInAction?2:1);t.forEach((N,G)=>{const d=N.props;if(w.isBoolean(d.hidden)?!!d.hidden:P.isDef(d.hidden))n.push(N);else{let _=d.span||c;const A={node:N,span:_,key:`ApFormSearchFormItem-${G}-${M(d.name)}-${d._signal}`},I=s-x%s;I<_&&(_+=I),x+=_,x>$?l.push(A):(C=x,h.push(A))}});const q=s-(C+c)%s,z=C%s<c,H=q<c?s:q;return{hideNode:e.createVNode(e.Fragment,null,[n]),nodes:h,collapseNodes:l,extraSpan:H,lastRowOnlyIncludeActionAndExtra:z}}),U=e.computed(()=>{let t;const n=a.value.collapseNodes.length||o.sortable&&m.value.length,l=e.createVNode(r.Col,{span:e.unref(b),key:"actionWrapper"},{default:()=>[e.createVNode(E.default,null,{default:()=>[e.createVNode(r.Flex,{wrap:"wrap",justify:a.value.lastRowOnlyIncludeActionAndExtra&&!(e.unref(i)&&o.extraInAction)?"flex-end":"space-between"},{default:()=>[e.createVNode(r.Flex,{gap:8,wrap:"wrap"},{default:()=>[n?e.createVNode("div",{class:f("column-setting-trigger-wrapper")},[a.value.collapseNodes.length?e.createVNode(Y.default,{onSubmit:F,config:a.value.collapseNodes,submitLoading:o.submitLoading},null):null,o.sortable&&v.value.length?e.createVNode(Z.default,{ref:"sorterIns",items:v.value,onClickConfirm:y,sorted:k.value},null):null]):null,e.createVNode(r.Button,{type:"primary",onClick:F,loading:o.submitLoading,htmlType:"submit",class:f("action-btn")},{default:()=>[o.searchText||B("ap.apForm.search.search")]}),e.createVNode(r.Button,{onClick:D,type:"text",class:[f("action-btn"),f("action-btn-reset")]},{default:()=>[o.resetText||B("ap.apForm.search.reset")]})]}),o.extraInAction?e.unref(i):null]})]})]}),h=!o.extraInAction&&e.unref(i)?e.createVNode(r.Col,{span:a.value.extraSpan,key:"extraNode"},{default:()=>[e.createVNode(E.default,null,{default:()=>[e.createVNode(r.Flex,{justify:a.value.extraSpan===s||a.value.lastRowOnlyIncludeActionAndExtra?"start":"flex-end"},te(t=e.unref(i))?t:{default:()=>[t]})]})]}):null,c=e.createVNode(r.Col,{span:a.value.extraSpan},null);return a.value.lastRowOnlyIncludeActionAndExtra?e.createVNode(e.Fragment,null,[h||c,l]):e.createVNode(e.Fragment,null,[l,h])});function W(){var n;const t=(n=j.value)==null?void 0:n.getCachedList();y(t)}return O({apForm:e.computed(()=>e.unref(g)),getSorterItems:()=>v.value,setSorterItems:y,resetSorterItems:W}),(t,n)=>(e.openBlock(),e.createBlock(ee.default,e.mergeProps({ref_key:"apForm",ref:g,class:e.unref(f)()},e.unref(w.omit)(o,["collapse","defaultCollapse","onUpdate:collapse","searchText","resetText","onSubmit","onReset","extraInAction","forceExpand","countPerRow"])),{default:e.withCtx(()=>[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(a.value.hideNode))),e.createVNode(e.unref(r.Row),{gutter:8},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.value.nodes,l=>(e.openBlock(),e.createBlock(e.unref(r.Col),{key:l.key,span:l.span},{default:e.withCtx(()=>[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(l.node)))]),_:2},1032,["span"]))),128)),(e.openBlock(),e.createBlock(e.resolveDynamicComponent(U.value)))]),_:1})]),_:1},16,["class"]))}});exports.default=oe;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),r=require("@aplus-frontend/antdv");require("../ap-form.vue.js");require("../item/index.vue2.js");const T=require("../item-group/helper.js");require("../../config-provider/index.js");const w=require("lodash-unified"),P=require("../../utils/index.js"),S=require("./utils.js");require("./components/popover-filter.vue.js");const J=require("./hooks/use-count-per-row.js");require("./components/popover-sorter/index.vue.js");const K=require("./hooks/use-sorter.js"),Q=require("../../config-provider/hooks/use-namespace.js"),X=require("../../config-provider/hooks/use-locale.js"),E=require("../item/index.vue.js"),Y=require("./components/popover-filter.vue2.js"),Z=require("./components/popover-sorter/index.vue2.js"),ee=require("../ap-form.vue2.js");function te(p){return typeof p=="function"||Object.prototype.toString.call(p)==="[object Object]"&&!e.isVNode(p)}const s=24,oe=e.defineComponent({name:"ApFormSearchForm",__name:"index",props:{layout:{default:"horizontal"},labelCol:{},wrapperCol:{},colon:{type:Boolean,default:!0},labelAlign:{default:"right"},labelWrap:{type:Boolean},prefixCls:{},requiredMark:{},hideRequiredMark:{type:Boolean,default:!1},rules:{},validateMessages:{},validateOnRuleChange:{type:Boolean,default:!0},scrollToFirstError:{},onSubmit:{},name:{},validateTrigger:{default:"change"},size:{},disabled:{type:Boolean},onFieldsChange:{},onFinish:{},onFinishFailed:{},onValidate:{},initialValues:{},onValuesChange:{},syncToUrl:{type:[Boolean,Function]},syncToUrlPriority:{type:Boolean},collapse:{type:Boolean,default:void 0},defaultCollapse:{type:Boolean,default:!0},"onUpdate:collapse":{},searchText:{},resetText:{},onReset:{},customReset:{type:Boolean,default:!1},extraInAction:{type:Boolean,default:!1},forceExpand:{type:Boolean,default:!1},countPerRow:{default:4},submitLoading:{type:Boolean},maxRows:{default:2},sortable:{type:Boolean,default:!0},resizeTarget:{},loadingDelay:{default:300}},setup(p,{expose:O}){var V;const u=e.useSlots(),o=p,{b:f}=Q.useNamespace("ap-form-search-form"),{t:B}=X.useLocale(),D=J.useCountPerRow(o),g=e.ref(),L=e.ref();function F(){var a;const t=(a=g.value)==null?void 0:a.getFieldsValueTransformed(!0);S.execFunc(o.onSubmit,t)}function j(){var t,a;o.customReset||(a=(t=g.value)==null?void 0:t.resetFields)==null||a.call(t),S.execFunc(o.onReset)}const M=t=>P.isDef(t)?(w.isArray(t)?t:[t]).join(""):Date.now();let R=[];const m=e.shallowRef(T.genRealChildren(u.default())),i=e.shallowRef((V=u.extra)==null?void 0:V.call(u)),b=e.computed(()=>Math.floor(s/e.unref(D))),{items:y,sorted:k,handleClickConfirm:v}=K.useSorter(m);e.watch(()=>u.default(),t=>{R=m.value,m.value=S.diffFormItem(R,T.genRealChildren(t)),k.value=!1}),e.watch(()=>{var t;return(t=u.extra)==null?void 0:t.call(u)},t=>{i.value=t});const n=e.computed(()=>{const t=m.value,a=[],l=[],h=[],c=e.unref(b);let x=0,C=0;const $=s*o.maxRows-c*(e.unref(i)&&!o.extraInAction?2:1);t.forEach((N,G)=>{const d=N.props;if(w.isBoolean(d.hidden)?!!d.hidden:P.isDef(d.hidden))a.push(N);else{let _=d.span||c;const A={node:N,span:_,key:`ApFormSearchFormItem-${G}-${M(d.name)}-${d._signal}`},I=s-x%s;I<_&&(_+=I),x+=_,x>$?l.push(A):(C=x,h.push(A))}});const q=s-(C+c)%s,z=C%s<c,H=q<c?s:q;return{hideNode:e.createVNode(e.Fragment,null,[a]),nodes:h,collapseNodes:l,extraSpan:H,lastRowOnlyIncludeActionAndExtra:z}}),U=e.computed(()=>{let t;const a=n.value.collapseNodes.length||o.sortable&&m.value.length,l=e.createVNode(r.Col,{span:e.unref(b),key:"actionWrapper"},{default:()=>[e.createVNode(E.default,null,{default:()=>[e.createVNode(r.Flex,{wrap:"wrap",justify:n.value.lastRowOnlyIncludeActionAndExtra&&!(e.unref(i)&&o.extraInAction)?"flex-end":"space-between"},{default:()=>[e.createVNode(r.Flex,{gap:8,wrap:"wrap"},{default:()=>[a?e.createVNode("div",{class:f("column-setting-trigger-wrapper")},[n.value.collapseNodes.length?e.createVNode(Y.default,{onSubmit:F,config:n.value.collapseNodes,submitLoading:o.submitLoading},null):null,o.sortable&&y.value.length?e.createVNode(Z.default,{ref:"sorterIns",items:y.value,onClickConfirm:v,sorted:k.value},null):null]):null,e.createVNode(r.Button,{type:"primary",onClick:F,loading:o.submitLoading?{delay:o.loadingDelay}:!1,htmlType:"submit",class:f("action-btn")},{default:()=>[o.searchText||B("ap.apForm.search.search")]}),e.createVNode(r.Button,{onClick:j,type:"text",class:[f("action-btn"),f("action-btn-reset")]},{default:()=>[o.resetText||B("ap.apForm.search.reset")]})]}),o.extraInAction?e.unref(i):null]})]})]}),h=!o.extraInAction&&e.unref(i)?e.createVNode(r.Col,{span:n.value.extraSpan,key:"extraNode"},{default:()=>[e.createVNode(E.default,null,{default:()=>[e.createVNode(r.Flex,{justify:n.value.extraSpan===s||n.value.lastRowOnlyIncludeActionAndExtra?"start":"flex-end"},te(t=e.unref(i))?t:{default:()=>[t]})]})]}):null,c=e.createVNode(r.Col,{span:n.value.extraSpan},null);return n.value.lastRowOnlyIncludeActionAndExtra?e.createVNode(e.Fragment,null,[h||c,l]):e.createVNode(e.Fragment,null,[l,h])});function W(){var a;const t=(a=L.value)==null?void 0:a.getCachedList();v(t)}return O({apForm:e.computed(()=>e.unref(g)),getSorterItems:()=>y.value,setSorterItems:v,resetSorterItems:W}),(t,a)=>(e.openBlock(),e.createBlock(ee.default,e.mergeProps({ref_key:"apForm",ref:g,class:e.unref(f)()},e.unref(w.omit)(o,["collapse","defaultCollapse","onUpdate:collapse","searchText","resetText","onSubmit","onReset","extraInAction","forceExpand","countPerRow"])),{default:e.withCtx(()=>[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(n.value.hideNode))),e.createVNode(e.unref(r.Row),{gutter:8},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(n.value.nodes,l=>(e.openBlock(),e.createBlock(e.unref(r.Col),{key:l.key,span:l.span},{default:e.withCtx(()=>[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(l.node)))]),_:2},1032,["span"]))),128)),(e.openBlock(),e.createBlock(e.resolveDynamicComponent(U.value)))]),_:1})]),_:1},16,["class"]))}});exports.default=oe;
@@ -14,8 +14,8 @@ declare const _default: DefineComponent<__VLS_Props, {}, {}, {}, {}, ComponentOp
14
14
  "onUpdate:value"?: ((value: string | number) => any) | undefined;
15
15
  }>, {
16
16
  value: string | number;
17
- options: RadioOptionType[];
18
17
  delay: number;
18
+ options: RadioOptionType[];
19
19
  optionStyle: RadioOptionStyleType;
20
20
  }, {}, {}, {}, string, ComponentProvideOptions, false, {}, HTMLDivElement>;
21
21
  export default _default;
@@ -15,8 +15,8 @@ declare const ApRadioGroup: {
15
15
  "update:value": (value: string | number) => any;
16
16
  }, PublicProps, {
17
17
  value: string | number;
18
- options: RadioOptionType[];
19
18
  delay: number;
19
+ options: RadioOptionType[];
20
20
  optionStyle: RadioOptionStyleType;
21
21
  }, false, {}, {}, GlobalComponents, GlobalDirectives, string, {}, HTMLDivElement, ComponentProvideOptions, {
22
22
  P: {};
@@ -35,8 +35,8 @@ declare const ApRadioGroup: {
35
35
  "onUpdate:value"?: ((value: string | number) => any) | undefined;
36
36
  }>, {}, {}, {}, {}, {
37
37
  value: string | number;
38
- options: RadioOptionType[];
39
38
  delay: number;
39
+ options: RadioOptionType[];
40
40
  optionStyle: RadioOptionStyleType;
41
41
  }>;
42
42
  __isFragment?: never;
@@ -55,8 +55,8 @@ declare const ApRadioGroup: {
55
55
  "update:value": (value: string | number) => any;
56
56
  }, string, {
57
57
  value: string | number;
58
- options: RadioOptionType[];
59
58
  delay: number;
59
+ options: RadioOptionType[];
60
60
  optionStyle: RadioOptionStyleType;
61
61
  }, {}, string, {}, GlobalComponents, GlobalDirectives, string, ComponentProvideOptions> & VNodeProps & AllowedComponentProps & ComponentCustomProps & ( Plugin & (new (...args: any[]) => {
62
62
  $props: {
@@ -1,6 +1,6 @@
1
1
  import { ColumnsType } from '@aplus-frontend/antdv/es/table';
2
2
  import { AlignType, DataIndex, Key } from '@aplus-frontend/antdv/es/vc-table/interface';
3
- import { ApColumnType } from 'src/ap-table';
3
+ import { ApColumnType } from '../../ap-table';
4
4
  export type SummaryColumnType = ApColumnType[] | ColumnsType;
5
5
  export type ValueType = {
6
6
  [key in string]: any;
@@ -0,0 +1,14 @@
1
+ interface UseKeepAliveFlagOptions {
2
+ /** 状态切换到deactivated时触发 */
3
+ afterDeactivated?: () => void;
4
+ }
5
+ /**
6
+ * 获取keepAliveFlag
7
+ * @returns
8
+ */
9
+ export declare function useKeepAliveFlag(options?: UseKeepAliveFlagOptions): {
10
+ isDeactivated: () => boolean;
11
+ isActivated: () => boolean;
12
+ registerAfterDeactivated: (fn: UseKeepAliveFlagOptions["afterDeactivated"]) => void;
13
+ };
14
+ export {};
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("vue");function c(a){let e="notKeepAlive",t=a==null?void 0:a.afterDeactivated;return i.onActivated(()=>{e="activated"}),i.onDeactivated(()=>{e="deactivated",t==null||t()}),{isDeactivated:()=>e==="deactivated",isActivated:()=>e==="activated",registerAfterDeactivated:v=>{t=v}}}exports.useKeepAliveFlag=c;
@@ -19,6 +19,10 @@ export interface UsePageListApGrid extends ApGridProps {
19
19
  * 表格刷新相关
20
20
  */
21
21
  tableRefresh?: boolean | Omit<UseTableRefreshOption, 'apTableRef'>;
22
+ /** 是否需要在deactivated的时候清空数据
23
+ * @default true
24
+ */
25
+ clearDataOnDeactivated?: boolean;
22
26
  }
23
27
  /**
24
28
  * 集成了列表页面的ApGrid的默认配置
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("../index.js");const u=require("lodash-unified"),g=require("vue"),v=require("./useTableRefresh.js");function b(a){const o=g.ref(null),{isShowRowSelection:i=!0,clearSelectionOnRequest:d=!0,transformSearchFormValues:s,api:n,tableRefresh:f=!0,virtual:h,...S}=a||{};let l=null;const c=()=>{var e,r;(r=(e=o.value)==null?void 0:e.rowSelection)==null||r.clearAll()};v.useTableRefresh({...R(f),apTableRef:o});const p=async e=>{l=e.sort;const r=s?s(e):e;try{if(!n)throw new Error("api is not defined");const{records:t,total:m}=await n(r);return d&&c(),{data:t,total:m}}catch(t){return console.error(t),{data:[],total:0}}};return[u.merge({scroll:{x:"100%",y:"100%"},columnResizable:!0,request:n?p:void 0,rowSelection:i?{fixed:"left",columnWidth:38}:void 0,ref(e){o.value=e},virtual:u.merge({oSize:20,y:20},h),card:!0},S),{reload:()=>{var e;(e=o.value)==null||e.submit()},reset:()=>{var e;(e=o.value)==null||e.reset()},getSearchFormValues:(e=!0)=>{var t;const r=((t=o.value)==null?void 0:t.getSearchFormValues(!!e))||{};return s?s(r):r},getApGridInstance:()=>o.value,getSearchFormValuesAndSorted:(e=!0)=>{var t;const r=((t=o.value)==null?void 0:t.getSearchFormValues(!!e))||{};return r.sort=l&&u.cloneDeep(l),s?s(r):r},clearSelection:c}]}function R(a){return a===!0?{}:a===!1?{refreshBefore:()=>!1}:a}exports.usePageListApGrid=b;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("../index.js");const u=require("lodash-unified"),q=require("vue"),F=require("./useKeepAliveFlag.js"),R=require("./useTableRefresh.js");function w(s){const a=q.ref(null),{isShowRowSelection:d=!0,clearSelectionOnRequest:f=!0,transformSearchFormValues:o,api:l,tableRefresh:p=!0,virtual:v,clearDataOnDeactivated:h=!0,...S}=s||{};let n=null;const c=()=>{var e,r;(r=(e=a.value)==null?void 0:e.rowSelection)==null||r.clearAll()};R.useTableRefresh({...G(p),apTableRef:a});const i=()=>{var e;(e=a.value)==null||e.submit()},g=()=>{var e;(e=a.value)==null||e.reset()},{isDeactivated:m}=F.useKeepAliveFlag({afterDeactivated:i}),A=async e=>{if(m()&&h)return{data:[],total:0};n=e.sort;const r=o?o(e):e;try{if(!l)throw new Error("api is not defined");const{records:t,total:b}=await l(r);return f&&c(),{data:t,total:b}}catch(t){return console.error(t),{data:[],total:0}}};return[u.merge({scroll:{x:"100%",y:"100%"},columnResizable:!0,request:l?A:void 0,rowSelection:d?{fixed:"left",columnWidth:38}:void 0,ref(e){a.value=e},virtual:u.merge({oSize:20,y:20},v),card:!0},S),{reload:i,reset:g,getSearchFormValues:(e=!0)=>{var t;const r=((t=a.value)==null?void 0:t.getSearchFormValues(!!e))||{};return o?o(r):r},getApGridInstance:()=>a.value,getSearchFormValuesAndSorted:(e=!0)=>{var t;const r=((t=a.value)==null?void 0:t.getSearchFormValues(!!e))||{};return r.sort=n&&u.cloneDeep(n),o?o(r):r},clearSelection:c}]}function G(s){return s===!0?{}:s===!1?{refreshBefore:()=>!1}:s}exports.usePageListApGrid=w;
@@ -1,2 +1,2 @@
1
- declare const _default: "0.6.7";
1
+ declare const _default: "0.6.8";
2
2
  export default _default;
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e="0.6.7";exports.default=e;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e="0.6.8";exports.default=e;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aplus-frontend/ui",
3
- "version": "0.6.7",
3
+ "version": "0.6.8",
4
4
  "main": "./lib/index.js",
5
5
  "type": "module",
6
6
  "files": [
@@ -10,9 +10,9 @@
10
10
  ],
11
11
  "keywords": [
12
12
  "aplus",
13
- "vuu3",
13
+ "vue3",
14
14
  "ant-design-vue",
15
- "components"
15
+ "ui-components"
16
16
  ],
17
17
  "release-it": {
18
18
  "git": {