@aplus-frontend/ui 0.6.0-beta.19 → 0.6.0-beta.20

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 (39) hide show
  1. package/es/src/ap-form/ap-form.vue2.mjs +78 -67
  2. package/es/src/business/ap-keep-alive/hook.d.ts +1 -1
  3. package/es/src/business/ap-keep-alive/hook.mjs +13 -11
  4. package/es/src/business/ap-keep-alive/index.d.ts +6 -0
  5. package/es/src/business/ap-keep-alive/interface.d.ts +1 -0
  6. package/es/src/business/ap-keep-alive/interface.mjs +6 -6
  7. package/es/src/business/ap-keep-alive/keep-alive.d.ts +3 -0
  8. package/es/src/business/ap-keep-alive/keep-alive.mjs +55 -55
  9. package/es/src/business/ap-keep-alive/keeper/index.mjs +1 -0
  10. package/es/src/business/ap-view/ap-view.vue2.mjs +109 -101
  11. package/es/src/tests/mock-resize-observer.d.ts +2 -0
  12. package/es/src/tests/utils.d.ts +8 -0
  13. package/es/src/version.d.ts +1 -1
  14. package/es/src/version.mjs +1 -1
  15. package/es/src/work-order-modal/createWorkOrder.d.ts +2 -1
  16. package/es/src/work-order-modal/createWorkOrder.mjs +19 -15
  17. package/es/src/work-order-modal/interfaces.d.ts +4 -0
  18. package/es/src/work-order-modal/work-order-modal.vue.mjs +120 -105
  19. package/lib/src/ap-form/ap-form.vue2.js +1 -1
  20. package/lib/src/business/ap-keep-alive/hook.d.ts +1 -1
  21. package/lib/src/business/ap-keep-alive/hook.js +1 -1
  22. package/lib/src/business/ap-keep-alive/index.d.ts +6 -0
  23. package/lib/src/business/ap-keep-alive/interface.d.ts +1 -0
  24. package/lib/src/business/ap-keep-alive/interface.js +1 -1
  25. package/lib/src/business/ap-keep-alive/keep-alive.d.ts +3 -0
  26. package/lib/src/business/ap-keep-alive/keep-alive.js +1 -1
  27. package/lib/src/business/ap-view/ap-view.vue2.js +1 -1
  28. package/lib/src/tests/mock-resize-observer.d.ts +2 -0
  29. package/lib/src/tests/utils.d.ts +8 -0
  30. package/lib/src/version.d.ts +1 -1
  31. package/lib/src/version.js +1 -1
  32. package/lib/src/work-order-modal/createWorkOrder.d.ts +2 -1
  33. package/lib/src/work-order-modal/createWorkOrder.js +1 -1
  34. package/lib/src/work-order-modal/interfaces.d.ts +4 -0
  35. package/lib/src/work-order-modal/work-order-modal.vue.js +1 -1
  36. package/package.json +1 -1
  37. package/theme/index.css +1 -1
  38. package/theme/text/index.css +1 -1
  39. package/theme/text/index.less +1 -1
@@ -1,19 +1,21 @@
1
- import { defineComponent as M, computed as B, ref as v, createVNode as _, watch as W, createBlock as h, openBlock as q, unref as K, mergeProps as H, withCtx as J, createElementVNode as Q, normalizeClass as X } from "vue";
1
+ import { defineComponent as q, computed as B, ref as v, createVNode as _, onMounted as H, watch as J, createBlock as Q, openBlock as X, unref as K, mergeProps as Z, withCtx as U, createElementVNode as C, normalizeClass as R } from "vue";
2
2
  import "../../config-provider/index.mjs";
3
- import Z from "./icons/line-down.vue.mjs";
4
- import { ApBatchActionGroup as U } from "../ap-batch-action-group/index.mjs";
3
+ import S from "./icons/line-down.vue.mjs";
4
+ import { ApBatchActionGroup as D } from "../ap-batch-action-group/index.mjs";
5
5
  import "./components/main-button-content.vue.mjs";
6
6
  import "./components/menu-list-content.vue.mjs";
7
- import { useViewProvide as R } from "./hooks/use-view-provide.mjs";
8
- import { useInjectApTable as S } from "../../ap-table/context.mjs";
9
- import { SYSTEM_VIEW_KEY as y } from "./utils/enum.mjs";
10
- import { isValid as C } from "@aplus-frontend/utils";
11
- import { useGlobalConfig as D } from "../../config-provider/hooks/use-global-config.mjs";
12
- import { useNamespace as O } from "../../config-provider/hooks/use-namespace.mjs";
13
- import { useLocale as ee } from "../../config-provider/hooks/use-locale.mjs";
14
- import te from "./components/main-button-content.vue2.mjs";
15
- import ie from "./components/menu-list-content.vue2.mjs";
16
- const ve = /* @__PURE__ */ M({
7
+ import { useViewProvide as O } from "./hooks/use-view-provide.mjs";
8
+ import { useInjectApTable as ee } from "../../ap-table/context.mjs";
9
+ import { SYSTEM_VIEW_KEY as w } from "./utils/enum.mjs";
10
+ import { isValid as te } from "@aplus-frontend/utils";
11
+ import "../ap-keep-alive/index.mjs";
12
+ import { useGlobalConfig as se } from "../../config-provider/hooks/use-global-config.mjs";
13
+ import { useNamespace as ie } from "../../config-provider/hooks/use-namespace.mjs";
14
+ import { useLocale as le } from "../../config-provider/hooks/use-locale.mjs";
15
+ import oe from "./components/main-button-content.vue2.mjs";
16
+ import ne from "./components/menu-list-content.vue2.mjs";
17
+ import { useApKeepAliveInject as ae } from "../ap-keep-alive/hook.mjs";
18
+ const xe = /* @__PURE__ */ q({
17
19
  name: "ApView",
18
20
  __name: "ap-view",
19
21
  props: {
@@ -33,170 +35,176 @@ const ve = /* @__PURE__ */ M({
33
35
  }
34
36
  },
35
37
  setup(E, {
36
- expose: k
38
+ expose: T
37
39
  }) {
38
- const f = E, A = D("viewCacheOption"), {
40
+ const r = E, j = se("viewCacheOption"), {
39
41
  b
40
- } = O("ap-view"), {
41
- t: L
42
- } = ee(), g = B(() => ({
43
- viewKey: y,
44
- viewName: L("ap.apView.systemView")
42
+ } = ie("ap-view"), {
43
+ t: k
44
+ } = le(), g = B(() => ({
45
+ viewKey: w,
46
+ viewName: k("ap.apView.systemView")
45
47
  })), {
46
- getSearchFormValues: P,
47
- setSearchFormValues: T,
48
- submit: j,
49
- reset: G
50
- } = S(), $ = v(!1), N = v(!1), V = v("");
48
+ getSearchFormValues: L,
49
+ setSearchFormValues: P,
50
+ submit: G,
51
+ reset: I
52
+ } = ee(), $ = v(!1), N = v(!1), V = v("");
51
53
  let d = !1, F = !1;
52
- const I = {
54
+ const M = {
53
55
  dropdownType: "dropdown",
54
- content: _(te, {
55
- maxViewNum: f.maxViewNum
56
+ content: _(oe, {
57
+ maxViewNum: r.maxViewNum
56
58
  }, null)
57
59
  }, o = v([g.value]), Y = B(() => o.value.map((t) => ({
58
60
  id: t.viewKey,
59
- content: _(ie, {
61
+ content: _(ne, {
60
62
  view: t
61
63
  }, null)
62
64
  }))), e = {
63
- getSearchFormValues: P,
64
- setSearchFormValues: T,
65
- submit: j,
66
- reset: G,
67
- ...f.saveDataSource
68
- }, i = {
69
- ...A.value,
70
- ...f.viewCacheOption
65
+ getSearchFormValues: L,
66
+ setSearchFormValues: P,
67
+ submit: G,
68
+ reset: I,
69
+ ...r.saveDataSource
70
+ }, s = {
71
+ ...j.value,
72
+ ...r.viewCacheOption
71
73
  }, x = () => {
72
- if (f.isDefaultSystemView)
73
- return y;
74
- if ((f.isFirstDefaultSystemView || F) && d)
75
- return y;
76
- const t = o.value.find((s) => s.isDefault);
77
- return (t == null ? void 0 : t.viewKey) ?? y;
78
- }, p = (t) => {
74
+ if (r.isDefaultSystemView)
75
+ return w;
76
+ if ((r.isFirstDefaultSystemView || F) && d)
77
+ return w;
78
+ const t = o.value.find((i) => i.isDefault);
79
+ return (t == null ? void 0 : t.viewKey) ?? w;
80
+ }, c = (t) => {
79
81
  V.value = t;
80
- const s = o.value.find((l) => l.viewKey === V.value);
81
- s && setTimeout(() => {
82
- var l, n, m, a, r, u;
83
- s.viewKey === y ? d ? (l = e == null ? void 0 : e.submit) == null || l.call(e) : (n = e == null ? void 0 : e.reset) == null || n.call(e) : ((r = e == null ? void 0 : e.setSearchFormValues) == null || r.call(e, {
84
- ...Object.fromEntries(Object.keys(((m = e == null ? void 0 : e.getSearchFormValues) == null ? void 0 : m.call(e)) ?? {}).map((c) => [c, void 0])) ?? {},
85
- ...((a = s.viewConfig) == null ? void 0 : a.searchForm) ?? {}
82
+ const i = o.value.find((l) => l.viewKey === V.value);
83
+ i && setTimeout(() => {
84
+ var l, n, a, f, m, u;
85
+ i.viewKey === w ? d ? (l = e == null ? void 0 : e.submit) == null || l.call(e) : (n = e == null ? void 0 : e.reset) == null || n.call(e) : ((m = e == null ? void 0 : e.setSearchFormValues) == null || m.call(e, {
86
+ ...Object.fromEntries(Object.keys(((a = e == null ? void 0 : e.getSearchFormValues) == null ? void 0 : a.call(e)) ?? {}).map((y) => [y, void 0])) ?? {},
87
+ ...((f = i.viewConfig) == null ? void 0 : f.searchForm) ?? {}
86
88
  }), (u = e == null ? void 0 : e.submit) == null || u.call(e)), d = !1;
87
89
  });
88
- }, w = {
90
+ }, p = {
89
91
  getViewList: async (t) => {
90
- var s;
92
+ var i;
91
93
  try {
92
94
  const {
93
95
  tableKey: l
94
- } = t, n = await ((s = i == null ? void 0 : i.getViewList) == null ? void 0 : s.call(i, {
96
+ } = t, n = await ((i = s == null ? void 0 : s.getViewList) == null ? void 0 : i.call(s, {
95
97
  tableKey: l
96
98
  }));
97
- return o.value = [g.value, ...n ?? []], p(x()), o.value;
99
+ return o.value = [g.value, ...n ?? []], c(x()), o.value;
98
100
  } catch {
99
- return o.value = [g.value], p(y), o.value;
101
+ return o.value = [g.value], c(w), o.value;
100
102
  }
101
103
  },
102
104
  addView: async (t) => {
103
- var r;
105
+ var m;
104
106
  const {
105
- tableKey: s,
107
+ tableKey: i,
106
108
  viewKey: l,
107
109
  viewName: n,
108
- isDefault: m,
109
- viewConfig: a
110
+ isDefault: a,
111
+ viewConfig: f
110
112
  } = t;
111
- await ((r = i == null ? void 0 : i.addView) == null ? void 0 : r.call(i, {
112
- tableKey: s,
113
+ await ((m = s == null ? void 0 : s.addView) == null ? void 0 : m.call(s, {
114
+ tableKey: i,
113
115
  viewKey: l,
114
116
  viewName: n,
115
- isDefault: m,
116
- viewConfig: a
117
- })), m && (o.value = o.value.map((u) => ({
117
+ isDefault: a,
118
+ viewConfig: f
119
+ })), a && (o.value = o.value.map((u) => ({
118
120
  ...u,
119
121
  isDefault: !1
120
122
  }))), o.value = [...o.value, {
121
123
  viewKey: l,
122
124
  viewName: n,
123
- isDefault: m,
124
- viewConfig: a
125
- }], p(l);
125
+ isDefault: a,
126
+ viewConfig: f
127
+ }], c(l);
126
128
  },
127
129
  changeView: async (t) => {
128
130
  var u;
129
131
  const {
130
- tableKey: s,
132
+ tableKey: i,
131
133
  viewKey: l,
132
134
  viewName: n,
133
- isDefault: m,
134
- viewConfig: a
135
+ isDefault: a,
136
+ viewConfig: f
135
137
  } = t;
136
- await ((u = i == null ? void 0 : i.changeView) == null ? void 0 : u.call(i, {
137
- tableKey: s,
138
+ await ((u = s == null ? void 0 : s.changeView) == null ? void 0 : u.call(s, {
139
+ tableKey: i,
138
140
  viewKey: l,
139
141
  viewName: n,
140
- isDefault: m,
141
- viewConfig: a
142
- })), m && (o.value = o.value.map((c) => ({
143
- ...c,
142
+ isDefault: a,
143
+ viewConfig: f
144
+ })), a && (o.value = o.value.map((y) => ({
145
+ ...y,
144
146
  isDefault: !1
145
147
  })));
146
- const r = o.value.find((c) => c.viewKey === l);
147
- r && (r.viewName = n, r.isDefault = m, r.viewConfig = a), p(l);
148
+ const m = o.value.find((y) => y.viewKey === l);
149
+ m && (m.viewName = n, m.isDefault = a, m.viewConfig = f), c(l);
148
150
  },
149
151
  removeView: async (t) => {
150
152
  var n;
151
153
  const {
152
- tableKey: s,
154
+ tableKey: i,
153
155
  viewKey: l
154
156
  } = t;
155
- await ((n = i == null ? void 0 : i.removeView) == null ? void 0 : n.call(i, {
156
- tableKey: s,
157
+ await ((n = s == null ? void 0 : s.removeView) == null ? void 0 : n.call(s, {
158
+ tableKey: i,
157
159
  viewKey: l
158
- })), o.value = o.value.filter((m) => m.viewKey !== l), l === V.value && p(x());
160
+ })), o.value = o.value.filter((a) => a.viewKey !== l), l === V.value && c(x());
159
161
  }
160
162
  }, z = {
161
- tableKey: f.tableKey,
163
+ tableKey: r.tableKey,
162
164
  currentViewKey: V,
163
- changeCurrentViewKey: p,
165
+ changeCurrentViewKey: c,
164
166
  popoverOpen: $,
165
167
  menuOpen: N,
166
168
  viewList: o,
167
- viewListCRUD: w,
169
+ viewListCRUD: p,
168
170
  saveDataSource: e
169
171
  };
170
- return R(z), W(() => f.tableKey, (t) => {
171
- var s;
172
- C(t) && (d = !0, (s = w == null ? void 0 : w.getViewList) == null || s.call(w, {
172
+ O(z);
173
+ const {
174
+ has: W
175
+ } = ae(), A = (t) => {
176
+ F = t;
177
+ }, h = (t) => {
178
+ var i;
179
+ te(t) && (d = !0, (i = p == null ? void 0 : p.getViewList) == null || i.call(p, {
173
180
  tableKey: t
174
181
  }));
175
- }, {
176
- immediate: !0
177
- }), k({
178
- setFirstDefaultSystemView: (t) => {
179
- F = t;
180
- }
181
- }), (t, s) => (q(), h(K(U), H({
182
+ };
183
+ return H(async () => {
184
+ await W() && A(!0), h(r.tableKey);
185
+ }), J(() => r.tableKey, (t) => {
186
+ h(t);
187
+ }), T({
188
+ setFirstDefaultSystemView: A
189
+ }), (t, i) => (X(), Q(K(D), Z({
182
190
  ...t.$attrs
183
191
  }, {
184
192
  open: N.value,
185
- "onUpdate:open": s[0] || (s[0] = (l) => N.value = l),
193
+ "onUpdate:open": i[0] || (i[0] = (l) => N.value = l),
186
194
  class: [K(b)()],
187
- "button-props": I,
195
+ "button-props": M,
188
196
  "menu-list": Y.value,
189
197
  "overlay-class-name": [K(b)("overlay")],
190
198
  trigger: "click",
191
199
  placement: "bottom"
192
200
  }), {
193
- icon: J(() => [Q("div", {
194
- class: X([K(b)("icon")])
195
- }, [_(Z)], 2)]),
201
+ icon: U(() => [C("div", {
202
+ class: R([K(b)("icon")])
203
+ }, [_(S)], 2)]),
196
204
  _: 1
197
205
  }, 16, ["open", "class", "menu-list", "overlay-class-name"]));
198
206
  }
199
207
  });
200
208
  export {
201
- ve as default
209
+ xe as default
202
210
  };
@@ -0,0 +1,2 @@
1
+ export declare function triggerResize(target: Element, width?: number, height?: number): void;
2
+ export declare function setupResizeObserverMock(): void;
@@ -0,0 +1,8 @@
1
+ /**
2
+ * 等待某个元素出现(或者超时)
3
+ * @param selector
4
+ * @param timeout
5
+ * @param interval
6
+ * @returns
7
+ */
8
+ export declare function waitFor(selector: string, timeout?: number, interval?: number): Promise<Element>;
@@ -1,2 +1,2 @@
1
- declare const _default: "0.6.0-beta.19";
1
+ declare const _default: "0.6.0-beta.20";
2
2
  export default _default;
@@ -1,4 +1,4 @@
1
- const e = "0.6.0-beta.19";
1
+ const e = "0.6.0-beta.20";
2
2
  export {
3
3
  e as default
4
4
  };
@@ -1,2 +1,3 @@
1
1
  import { GetOssAccess } from './interfaces';
2
- export declare function createWorkOrderModal(api: (args?: any) => Promise<any>, getOssAccess: GetOssAccess): void;
2
+ import { Recordable } from '../type';
3
+ export declare function createWorkOrderModal(api: (args?: any) => Promise<any>, getOssAccess: GetOssAccess, initialValues?: Recordable, disabledList?: string[], successCallback?: () => void): void;
@@ -1,29 +1,33 @@
1
- import { defineComponent as m, createVNode as n, render as r, h as i } from "vue";
1
+ import { defineComponent as c, createVNode as t, render as n, h as p } from "vue";
2
2
  import "./work-order-modal.vue2.mjs";
3
3
  import "../config-provider/index.mjs";
4
- import { ConfigProvider as c, globalConfigCached as p } from "../config-provider/config-provider.mjs";
5
- import s from "./work-order-modal.vue.mjs";
6
- function b(t, d) {
7
- const a = document.getElementsByTagName("body")[0], e = document.createElement("div");
8
- a.appendChild(e), r(i(/* @__PURE__ */ m({
4
+ import { ConfigProvider as u, globalConfigCached as f } from "../config-provider/config-provider.mjs";
5
+ import C from "./work-order-modal.vue.mjs";
6
+ function M(r, a, l = {}, d = [], i = () => {
7
+ }) {
8
+ const m = document.getElementsByTagName("body")[0], e = document.createElement("div");
9
+ m.appendChild(e), n(p(/* @__PURE__ */ c({
9
10
  render() {
10
- return n(c, p.value, {
11
- default: () => [n(s, {
12
- api: t,
13
- getOssAccess: d,
14
- onModalClose: l,
15
- open: !0
11
+ return t(u, f.value, {
12
+ default: () => [t(C, {
13
+ api: r,
14
+ getOssAccess: a,
15
+ onModalClose: s,
16
+ open: !0,
17
+ initialValues: l,
18
+ disabledList: d,
19
+ successCallback: i
16
20
  }, null)]
17
21
  });
18
22
  }
19
23
  })), e);
20
- function l() {
24
+ function s() {
21
25
  setTimeout(() => {
22
26
  var o;
23
- r(null, e), (o = e.parentElement) == null || o.removeChild(e);
27
+ n(null, e), (o = e.parentElement) == null || o.removeChild(e);
24
28
  }, 500);
25
29
  }
26
30
  }
27
31
  export {
28
- b as createWorkOrderModal
32
+ M as createWorkOrderModal
29
33
  };
@@ -1,5 +1,6 @@
1
1
  import { client } from '@aplus-frontend/oss';
2
2
  import { ModalProps } from '@aplus-frontend/antdv';
3
+ import { Recordable } from '../type';
3
4
  /**
4
5
  * 表单项
5
6
  */
@@ -21,6 +22,9 @@ export type GetOssAccess = Parameters<typeof client.initOssClient>[0]['getOssAcc
21
22
  export interface WorkOrderModalProps extends ModalProps {
22
23
  api: (args?: any) => Promise<any>;
23
24
  getOssAccess: GetOssAccess;
25
+ initialValues?: Recordable;
26
+ disabledList?: string[];
27
+ successCallback?: () => void;
24
28
  }
25
29
  type LocaleType = 'zh_CN' | 'en_US';
26
30
  export declare const langMap: Record<string, LocaleType>;