@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.
- package/es/src/ap-form/ap-form.vue2.mjs +78 -67
- package/es/src/business/ap-keep-alive/hook.d.ts +1 -1
- package/es/src/business/ap-keep-alive/hook.mjs +13 -11
- package/es/src/business/ap-keep-alive/index.d.ts +6 -0
- package/es/src/business/ap-keep-alive/interface.d.ts +1 -0
- package/es/src/business/ap-keep-alive/interface.mjs +6 -6
- package/es/src/business/ap-keep-alive/keep-alive.d.ts +3 -0
- package/es/src/business/ap-keep-alive/keep-alive.mjs +55 -55
- package/es/src/business/ap-keep-alive/keeper/index.mjs +1 -0
- package/es/src/business/ap-view/ap-view.vue2.mjs +109 -101
- package/es/src/tests/mock-resize-observer.d.ts +2 -0
- package/es/src/tests/utils.d.ts +8 -0
- package/es/src/version.d.ts +1 -1
- package/es/src/version.mjs +1 -1
- package/es/src/work-order-modal/createWorkOrder.d.ts +2 -1
- package/es/src/work-order-modal/createWorkOrder.mjs +19 -15
- package/es/src/work-order-modal/interfaces.d.ts +4 -0
- package/es/src/work-order-modal/work-order-modal.vue.mjs +120 -105
- package/lib/src/ap-form/ap-form.vue2.js +1 -1
- package/lib/src/business/ap-keep-alive/hook.d.ts +1 -1
- package/lib/src/business/ap-keep-alive/hook.js +1 -1
- package/lib/src/business/ap-keep-alive/index.d.ts +6 -0
- package/lib/src/business/ap-keep-alive/interface.d.ts +1 -0
- package/lib/src/business/ap-keep-alive/interface.js +1 -1
- package/lib/src/business/ap-keep-alive/keep-alive.d.ts +3 -0
- package/lib/src/business/ap-keep-alive/keep-alive.js +1 -1
- package/lib/src/business/ap-view/ap-view.vue2.js +1 -1
- package/lib/src/tests/mock-resize-observer.d.ts +2 -0
- package/lib/src/tests/utils.d.ts +8 -0
- package/lib/src/version.d.ts +1 -1
- package/lib/src/version.js +1 -1
- package/lib/src/work-order-modal/createWorkOrder.d.ts +2 -1
- package/lib/src/work-order-modal/createWorkOrder.js +1 -1
- package/lib/src/work-order-modal/interfaces.d.ts +4 -0
- package/lib/src/work-order-modal/work-order-modal.vue.js +1 -1
- package/package.json +1 -1
- package/theme/index.css +1 -1
- package/theme/text/index.css +1 -1
- package/theme/text/index.less +1 -1
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { defineComponent as Q, reactive as X, ref as
|
|
2
|
-
import { Form as
|
|
1
|
+
import { defineComponent as Q, reactive as X, ref as E, unref as m, nextTick as Y, toRaw as B, watch as Z, onWatcherCleanup as z, computed as ee, createBlock as te, openBlock as re, mergeProps as oe, withCtx as le, renderSlot as ne } from "vue";
|
|
2
|
+
import { Form as se } from "@aplus-frontend/antdv";
|
|
3
3
|
import { useProvideForm as ie } from "./context.mjs";
|
|
4
|
-
import { isArray as f, cloneDeep as ae, isFunction as
|
|
4
|
+
import { isArray as f, cloneDeep as ae, isFunction as M, isPlainObject as _, omit as ue } from "lodash-unified";
|
|
5
5
|
import { useUrlSearchParams as ce } from "@vueuse/core";
|
|
6
6
|
import { INTERNAL_FORM_INSTANCE_MARK as fe } from "./constant.mjs";
|
|
7
7
|
import { getRouteType as de, isDef as V } from "../utils/index.mjs";
|
|
8
8
|
import ge from "./utils/set.mjs";
|
|
9
|
-
import { genParams as b, setToParams as
|
|
9
|
+
import { genParams as b, setToParams as x } from "./utils/params.mjs";
|
|
10
10
|
import { useInjectFormProvider as Fe } from "./provider/context.mjs";
|
|
11
11
|
const Re = /* @__PURE__ */ Q({
|
|
12
12
|
name: "ApForm",
|
|
@@ -41,54 +41,54 @@ const Re = /* @__PURE__ */ Q({
|
|
|
41
41
|
},
|
|
42
42
|
setup(C, { expose: N }) {
|
|
43
43
|
function S(e, t) {
|
|
44
|
-
return f(t) ? t.reduce((r,
|
|
44
|
+
return f(t) ? t.reduce((r, l) => r == null ? void 0 : r[l], e) : e == null ? void 0 : e[t];
|
|
45
45
|
}
|
|
46
|
-
const
|
|
47
|
-
function v(e, t, r = !0,
|
|
48
|
-
var
|
|
46
|
+
const o = C;
|
|
47
|
+
function v(e, t, r = !0, l) {
|
|
48
|
+
var n;
|
|
49
49
|
if (f(e)) {
|
|
50
|
-
let a =
|
|
50
|
+
let a = s;
|
|
51
51
|
for (let d = 0; d < e.length - 1; d++)
|
|
52
52
|
e[d] in a || (a[e[d]] = {}), a = a[e[d]];
|
|
53
|
-
|
|
53
|
+
l ? l(a, e[e.length - 1]) : a[e[e.length - 1]] = t;
|
|
54
54
|
} else
|
|
55
|
-
|
|
55
|
+
l ? l(s, e) : s[e] = t;
|
|
56
56
|
let i = f(e) ? e[0] : e;
|
|
57
57
|
if (r) {
|
|
58
|
-
const a = { [i]:
|
|
59
|
-
|
|
58
|
+
const a = { [i]: s[i] };
|
|
59
|
+
p.triggerFormChange(o.name, a), (n = o.onValuesChange) == null || n.call(o, a, s, e);
|
|
60
60
|
}
|
|
61
61
|
T();
|
|
62
62
|
}
|
|
63
|
-
const u =
|
|
64
|
-
|
|
63
|
+
const u = E(), U = ce(de()), p = Fe(), P = E(
|
|
64
|
+
o.syncToUrl ? b(o.syncToUrl, U, "get") : {}
|
|
65
65
|
);
|
|
66
|
-
let
|
|
67
|
-
const
|
|
66
|
+
let y = ae(w()), g = {};
|
|
67
|
+
const s = X(w());
|
|
68
68
|
let F = [];
|
|
69
69
|
function w() {
|
|
70
|
-
const e =
|
|
71
|
-
return
|
|
70
|
+
const e = o.initialValues || {};
|
|
71
|
+
return o.syncToUrlPriority ? {
|
|
72
72
|
...e,
|
|
73
|
-
...
|
|
73
|
+
...m(P)
|
|
74
74
|
} : {
|
|
75
|
-
...
|
|
75
|
+
...m(P),
|
|
76
76
|
...e
|
|
77
77
|
};
|
|
78
78
|
}
|
|
79
79
|
function W(e) {
|
|
80
80
|
var r;
|
|
81
81
|
const t = h(e, g);
|
|
82
|
-
|
|
82
|
+
p.triggerFormFinish(o.name, e), o.syncToUrl && x(U, b(o.syncToUrl, t, "set")), (r = o.onFinish) == null || r.call(o, t);
|
|
83
83
|
}
|
|
84
84
|
const q = async () => {
|
|
85
85
|
var e;
|
|
86
86
|
(e = u.value) == null || e.resetFields(), await Y(() => {
|
|
87
|
-
Object.keys(
|
|
88
|
-
|
|
87
|
+
Object.keys(s).forEach((t) => delete s[t]), Object.assign(s, y), T(), o.syncToUrl && x(
|
|
88
|
+
U,
|
|
89
89
|
b(
|
|
90
|
-
|
|
91
|
-
h(
|
|
90
|
+
o.syncToUrl,
|
|
91
|
+
h(y, g),
|
|
92
92
|
"set"
|
|
93
93
|
)
|
|
94
94
|
);
|
|
@@ -100,15 +100,15 @@ const Re = /* @__PURE__ */ Q({
|
|
|
100
100
|
var r;
|
|
101
101
|
return (r = u.value) == null ? void 0 : r.validateFields(e, t);
|
|
102
102
|
}, K = async (e, t) => {
|
|
103
|
-
var
|
|
104
|
-
const r = await ((
|
|
103
|
+
var l;
|
|
104
|
+
const r = await ((l = u.value) == null ? void 0 : l.validateFields(
|
|
105
105
|
e,
|
|
106
106
|
t
|
|
107
107
|
));
|
|
108
108
|
return h(r, g);
|
|
109
109
|
}, O = (e) => {
|
|
110
110
|
var t;
|
|
111
|
-
return e === !0 ?
|
|
111
|
+
return e === !0 ? B(s) : (t = u.value) == null ? void 0 : t.getFieldsValue(e);
|
|
112
112
|
}, L = (e) => {
|
|
113
113
|
const t = O(e);
|
|
114
114
|
return h(t, g);
|
|
@@ -119,26 +119,26 @@ const Re = /* @__PURE__ */ Q({
|
|
|
119
119
|
var r;
|
|
120
120
|
(r = u.value) == null || r.scrollToField(e, t);
|
|
121
121
|
}, H = (e) => {
|
|
122
|
-
Object.assign(
|
|
123
|
-
},
|
|
124
|
-
v(e, t, r,
|
|
122
|
+
Object.assign(s, e), T();
|
|
123
|
+
}, I = (e, t, r = !0, l) => {
|
|
124
|
+
v(e, t, r, l), T();
|
|
125
125
|
};
|
|
126
126
|
function R(e, t) {
|
|
127
|
-
return t || e(
|
|
127
|
+
return t || e(B(s)), F.push(e), () => {
|
|
128
128
|
F = F.filter((r) => r !== e);
|
|
129
129
|
};
|
|
130
130
|
}
|
|
131
131
|
function j({ initialValue: e, name: t, transform: r }) {
|
|
132
132
|
if (V(e) && V(t)) {
|
|
133
|
-
const
|
|
134
|
-
if (!V(
|
|
133
|
+
const l = S(m(P), t);
|
|
134
|
+
if (!V(l) || !o.syncToUrlPriority)
|
|
135
135
|
if (v(t, e, !1), f(t)) {
|
|
136
|
-
let i =
|
|
137
|
-
for (let
|
|
138
|
-
V(i[t[
|
|
136
|
+
let i = y;
|
|
137
|
+
for (let n = 0; n < t.length - 1; n++)
|
|
138
|
+
V(i[t[n]]) || (i[t[n]] = {}), i = i[t[n]];
|
|
139
139
|
i[t[t.length - 1]] = e;
|
|
140
140
|
} else
|
|
141
|
-
|
|
141
|
+
y[t] = e;
|
|
142
142
|
}
|
|
143
143
|
r && (g = ge(
|
|
144
144
|
g,
|
|
@@ -155,12 +155,12 @@ const Re = /* @__PURE__ */ Q({
|
|
|
155
155
|
return {
|
|
156
156
|
registerField: j,
|
|
157
157
|
registerWatch: R,
|
|
158
|
-
setFieldValue:
|
|
158
|
+
setFieldValue: I
|
|
159
159
|
};
|
|
160
160
|
}
|
|
161
161
|
function T() {
|
|
162
162
|
if (F.length) {
|
|
163
|
-
const e =
|
|
163
|
+
const e = B(s);
|
|
164
164
|
F.forEach((t) => {
|
|
165
165
|
t(e);
|
|
166
166
|
});
|
|
@@ -170,25 +170,25 @@ const Re = /* @__PURE__ */ Q({
|
|
|
170
170
|
if (e == null)
|
|
171
171
|
return;
|
|
172
172
|
let r = f(e) ? [] : {};
|
|
173
|
-
return Object.keys(e).forEach((
|
|
174
|
-
const i = e[
|
|
175
|
-
if (
|
|
173
|
+
return Object.keys(e).forEach((l) => {
|
|
174
|
+
const i = e[l], n = t == null ? void 0 : t[l], a = M(n) ? n : n == null ? void 0 : n.transformer, d = M(n) ? !0 : n == null ? void 0 : n.flat;
|
|
175
|
+
if (M(a)) {
|
|
176
176
|
const c = a(i);
|
|
177
|
-
d ? f(c) && f(r) ? r = [...r, ...c] :
|
|
177
|
+
d ? f(c) && f(r) ? r = [...r, ...c] : _(c) && _(r) ? r = {
|
|
178
178
|
...r,
|
|
179
179
|
...c
|
|
180
|
-
} : r[
|
|
181
|
-
} else if (
|
|
180
|
+
} : r[l] = c : r[l] = c;
|
|
181
|
+
} else if (_(i) || f(i)) {
|
|
182
182
|
const c = h(
|
|
183
183
|
i,
|
|
184
|
-
|
|
184
|
+
n
|
|
185
185
|
);
|
|
186
|
-
r[
|
|
186
|
+
r[l] = c;
|
|
187
187
|
} else
|
|
188
|
-
r[
|
|
188
|
+
r[l] = i;
|
|
189
189
|
}), r;
|
|
190
190
|
}
|
|
191
|
-
const
|
|
191
|
+
const A = {
|
|
192
192
|
resetFields: q,
|
|
193
193
|
clearValidate: D,
|
|
194
194
|
validateFields: k,
|
|
@@ -196,42 +196,53 @@ const Re = /* @__PURE__ */ Q({
|
|
|
196
196
|
validate: $,
|
|
197
197
|
scrollToField: G,
|
|
198
198
|
setFieldsValue: H,
|
|
199
|
-
setFieldValue:
|
|
199
|
+
setFieldValue: I,
|
|
200
200
|
registerWatch: R,
|
|
201
201
|
validateFieldsReturnTransformed: K,
|
|
202
202
|
getFieldsValueTransformed: L,
|
|
203
203
|
getInternalInstance: J
|
|
204
204
|
};
|
|
205
205
|
return Z(
|
|
206
|
-
() =>
|
|
206
|
+
() => o.name,
|
|
207
207
|
(e) => {
|
|
208
|
-
e && (
|
|
209
|
-
|
|
208
|
+
e && (p.registerForm(e, A), z(() => {
|
|
209
|
+
p.unregisterForm(o.name);
|
|
210
210
|
}));
|
|
211
211
|
},
|
|
212
212
|
{
|
|
213
213
|
immediate: !0
|
|
214
214
|
}
|
|
215
215
|
), ie({
|
|
216
|
-
model: ee(() =>
|
|
216
|
+
model: ee(() => s),
|
|
217
217
|
updateModel: v,
|
|
218
218
|
internalInstance: {
|
|
219
219
|
registerWatch: R,
|
|
220
220
|
registerField: j,
|
|
221
|
-
setFieldValue:
|
|
221
|
+
setFieldValue: I
|
|
222
222
|
}
|
|
223
|
-
}), N(
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
223
|
+
}), N(A), (e, t) => (re(), te(m(se), oe(
|
|
224
|
+
{
|
|
225
|
+
ref_key: "formRef",
|
|
226
|
+
ref: u
|
|
227
|
+
},
|
|
228
|
+
m(ue)(o, [
|
|
229
|
+
"initialValues",
|
|
230
|
+
"onValuesChange",
|
|
231
|
+
"onFinish",
|
|
232
|
+
"syncToUrl",
|
|
233
|
+
"syncToUrlPriority"
|
|
234
|
+
]),
|
|
235
|
+
{
|
|
236
|
+
model: s,
|
|
237
|
+
"data-form-name": e.name,
|
|
238
|
+
onFinish: W
|
|
239
|
+
}
|
|
240
|
+
), {
|
|
241
|
+
default: le(() => [
|
|
242
|
+
ne(e.$slots, "default")
|
|
232
243
|
]),
|
|
233
244
|
_: 3
|
|
234
|
-
}, 16, ["model"]));
|
|
245
|
+
}, 16, ["model", "data-form-name"]));
|
|
235
246
|
}
|
|
236
247
|
});
|
|
237
248
|
export {
|
|
@@ -3,7 +3,7 @@ import { CacheInterface, PropertyKeyType } from './interface';
|
|
|
3
3
|
type DataModel = {
|
|
4
4
|
getter: (key?: string) => Promise<any>;
|
|
5
5
|
setter: (key: string, data: any) => Promise<any>;
|
|
6
|
-
has: (key
|
|
6
|
+
has: (key?: string) => Promise<any>;
|
|
7
7
|
};
|
|
8
8
|
export declare const useApKeepAliveProvide: (cache: CacheInterface, currentModuleKey: Ref<PropertyKeyType>) => void;
|
|
9
9
|
export declare const useApKeepAliveInject: () => DataModel;
|
|
@@ -1,23 +1,25 @@
|
|
|
1
|
-
import { provide as
|
|
2
|
-
const a = Symbol("ApKeepAliveProvideKey"),
|
|
3
|
-
|
|
1
|
+
import { provide as v, nextTick as i, inject as o } from "vue";
|
|
2
|
+
const a = Symbol("ApKeepAliveProvideKey"), f = (s, r) => {
|
|
3
|
+
v(a, {
|
|
4
4
|
getter: async (e) => {
|
|
5
5
|
await i();
|
|
6
|
-
const t =
|
|
6
|
+
const t = s.get(r.value);
|
|
7
7
|
return t ? e ? t == null ? void 0 : t.get(e) : Object.fromEntries(t) : {};
|
|
8
8
|
},
|
|
9
9
|
setter: async (e, t) => {
|
|
10
10
|
await i();
|
|
11
|
-
let
|
|
12
|
-
return
|
|
11
|
+
let n = s.get(r.value);
|
|
12
|
+
return n || (n = /* @__PURE__ */ new Map(), s.set(r.value, n)), n == null ? void 0 : n.set(e, t);
|
|
13
13
|
},
|
|
14
14
|
has: async (e) => {
|
|
15
|
-
await i()
|
|
16
|
-
|
|
17
|
-
|
|
15
|
+
if (await i(), e) {
|
|
16
|
+
const t = s.get(r.value);
|
|
17
|
+
return !!(t != null && t.has(e));
|
|
18
|
+
}
|
|
19
|
+
return s.has(r.value);
|
|
18
20
|
}
|
|
19
21
|
});
|
|
20
|
-
}, l = () =>
|
|
22
|
+
}, l = () => o(a, {
|
|
21
23
|
getter: async () => {
|
|
22
24
|
},
|
|
23
25
|
setter: async () => {
|
|
@@ -27,5 +29,5 @@ const a = Symbol("ApKeepAliveProvideKey"), c = (n, r) => {
|
|
|
27
29
|
});
|
|
28
30
|
export {
|
|
29
31
|
l as useApKeepAliveInject,
|
|
30
|
-
|
|
32
|
+
f as useApKeepAliveProvide
|
|
31
33
|
};
|
|
@@ -14,6 +14,7 @@ declare const ApKeepAlive: {
|
|
|
14
14
|
};
|
|
15
15
|
max: {
|
|
16
16
|
type: PropType<number>;
|
|
17
|
+
default: number;
|
|
17
18
|
};
|
|
18
19
|
exclude: {
|
|
19
20
|
type: PropType<MatchPattern>;
|
|
@@ -28,6 +29,7 @@ declare const ApKeepAlive: {
|
|
|
28
29
|
}>> & Readonly<{}>, () => VNode<RendererNode, RendererElement, {
|
|
29
30
|
[key: string]: any;
|
|
30
31
|
}>[] | undefined, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, PublicProps, {
|
|
32
|
+
max: number;
|
|
31
33
|
debug: boolean;
|
|
32
34
|
stopTags: string[];
|
|
33
35
|
}, true, {}, {}, GlobalComponents, GlobalDirectives, string, {}, any, ComponentProvideOptions, {
|
|
@@ -47,6 +49,7 @@ declare const ApKeepAlive: {
|
|
|
47
49
|
};
|
|
48
50
|
max: {
|
|
49
51
|
type: PropType<number>;
|
|
52
|
+
default: number;
|
|
50
53
|
};
|
|
51
54
|
exclude: {
|
|
52
55
|
type: PropType<MatchPattern>;
|
|
@@ -61,6 +64,7 @@ declare const ApKeepAlive: {
|
|
|
61
64
|
}>> & Readonly<{}>, () => VNode<RendererNode, RendererElement, {
|
|
62
65
|
[key: string]: any;
|
|
63
66
|
}>[] | undefined, {}, {}, {}, {
|
|
67
|
+
max: number;
|
|
64
68
|
debug: boolean;
|
|
65
69
|
stopTags: string[];
|
|
66
70
|
}>;
|
|
@@ -77,6 +81,7 @@ declare const ApKeepAlive: {
|
|
|
77
81
|
};
|
|
78
82
|
max: {
|
|
79
83
|
type: PropType<number>;
|
|
84
|
+
default: number;
|
|
80
85
|
};
|
|
81
86
|
exclude: {
|
|
82
87
|
type: PropType<MatchPattern>;
|
|
@@ -91,6 +96,7 @@ declare const ApKeepAlive: {
|
|
|
91
96
|
}>> & Readonly<{}>, () => VNode<RendererNode, RendererElement, {
|
|
92
97
|
[key: string]: any;
|
|
93
98
|
}>[] | undefined, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, {
|
|
99
|
+
max: number;
|
|
94
100
|
debug: boolean;
|
|
95
101
|
stopTags: string[];
|
|
96
102
|
}, {}, string, {}, GlobalComponents, GlobalDirectives, string, ComponentProvideOptions> & VNodeProps & AllowedComponentProps & ComponentCustomProps & ( Plugin & (new (...args: any[]) => {
|
|
@@ -4,10 +4,11 @@ const e = () => ({
|
|
|
4
4
|
},
|
|
5
5
|
debug: {
|
|
6
6
|
type: Boolean,
|
|
7
|
-
default: !
|
|
7
|
+
default: !1
|
|
8
8
|
},
|
|
9
9
|
max: {
|
|
10
|
-
type: Number
|
|
10
|
+
type: Number,
|
|
11
|
+
default: 30
|
|
11
12
|
},
|
|
12
13
|
exclude: {
|
|
13
14
|
type: Array
|
|
@@ -30,10 +31,7 @@ const e = () => ({
|
|
|
30
31
|
"APagination",
|
|
31
32
|
"ApTablePagination",
|
|
32
33
|
"ApView",
|
|
33
|
-
"ApFormItem",
|
|
34
|
-
"AFormItem",
|
|
35
34
|
"ApTitle",
|
|
36
|
-
"ap-button",
|
|
37
35
|
"span",
|
|
38
36
|
"svg",
|
|
39
37
|
"iframe",
|
|
@@ -44,8 +42,10 @@ const e = () => ({
|
|
|
44
42
|
"ApGrid",
|
|
45
43
|
"ApBatchActionGroup",
|
|
46
44
|
"ApBatchAction",
|
|
47
|
-
"EditableGrid"
|
|
45
|
+
"EditableGrid",
|
|
48
46
|
//todo EditableGridFormItem 改名
|
|
47
|
+
// 'ApFormItem',
|
|
48
|
+
"AFormItem"
|
|
49
49
|
// 'AForm', 不能忽略,有嵌套情况
|
|
50
50
|
];
|
|
51
51
|
export {
|
|
@@ -10,6 +10,7 @@ declare const _default: DefineComponent<ExtractPropTypes<{
|
|
|
10
10
|
};
|
|
11
11
|
max: {
|
|
12
12
|
type: PropType<number>;
|
|
13
|
+
default: number;
|
|
13
14
|
};
|
|
14
15
|
exclude: {
|
|
15
16
|
type: PropType<MatchPattern>;
|
|
@@ -33,6 +34,7 @@ declare const _default: DefineComponent<ExtractPropTypes<{
|
|
|
33
34
|
};
|
|
34
35
|
max: {
|
|
35
36
|
type: PropType<number>;
|
|
37
|
+
default: number;
|
|
36
38
|
};
|
|
37
39
|
exclude: {
|
|
38
40
|
type: PropType<MatchPattern>;
|
|
@@ -45,6 +47,7 @@ declare const _default: DefineComponent<ExtractPropTypes<{
|
|
|
45
47
|
default: () => never[];
|
|
46
48
|
};
|
|
47
49
|
}>> & Readonly<{}>, {
|
|
50
|
+
max: number;
|
|
48
51
|
debug: boolean;
|
|
49
52
|
stopTags: string[];
|
|
50
53
|
}, {}, {}, {}, string, ComponentProvideOptions, true, {}, any>;
|
|
@@ -6,74 +6,74 @@ import { LruCacher as C } from "./cacher/lru-cacher.mjs";
|
|
|
6
6
|
import { forceStopTags as R, ApKeepAliveProps as _ } from "./interface.mjs";
|
|
7
7
|
import { throttle as S } from "lodash-unified";
|
|
8
8
|
import { useApKeepAliveProvide as $ } from "./hook.mjs";
|
|
9
|
-
const c = console,
|
|
9
|
+
const c = console, a = "|", te = j({
|
|
10
10
|
name: "ApKeepAlive",
|
|
11
11
|
inheritAttrs: !1,
|
|
12
12
|
props: _(),
|
|
13
|
-
setup(
|
|
14
|
-
const g = M(), v = (e) => !(
|
|
13
|
+
setup(o, { slots: h }) {
|
|
14
|
+
const g = M(), v = (e) => !(o.include && (!e || !D(o.include, e)) || o.exclude && e && D(o.exclude, e)), d = o.store || new C(o.max), u = E("");
|
|
15
15
|
let m = "";
|
|
16
|
-
const k = /* @__PURE__ */ new Set([...R, ...
|
|
16
|
+
const k = /* @__PURE__ */ new Set([...R, ...o.stopTags]), p = (e, n = "") => {
|
|
17
17
|
var f;
|
|
18
18
|
const t = [];
|
|
19
19
|
if (!e) return t;
|
|
20
|
-
const { VnodeName: i, vnodeSubPath:
|
|
20
|
+
const { VnodeName: i, vnodeSubPath: s } = T(
|
|
21
21
|
e,
|
|
22
22
|
u.value
|
|
23
23
|
);
|
|
24
|
-
|
|
24
|
+
s && (n += a + s);
|
|
25
25
|
const l = I[i];
|
|
26
26
|
if (l) {
|
|
27
|
-
const
|
|
28
|
-
!W(
|
|
27
|
+
const r = l.get(e);
|
|
28
|
+
!W(r) && t.push([n, r]);
|
|
29
29
|
}
|
|
30
30
|
if (k.has(i))
|
|
31
|
-
return
|
|
31
|
+
return o.debug && c.log("[ stop-VnodeName ] >", i, n), t;
|
|
32
32
|
if (e.children)
|
|
33
33
|
if (Array.isArray(e.children))
|
|
34
|
-
e.children.forEach((
|
|
35
|
-
|
|
34
|
+
e.children.forEach((r) => {
|
|
35
|
+
r = b(r), r && t.push(...p(r, n));
|
|
36
36
|
});
|
|
37
37
|
else {
|
|
38
|
-
const
|
|
39
|
-
|
|
38
|
+
const r = K(e.children);
|
|
39
|
+
r && t.push(...p(r, n));
|
|
40
40
|
}
|
|
41
|
-
return (f = e.component) != null && f.subTree && t.push(...
|
|
42
|
-
},
|
|
41
|
+
return (f = e.component) != null && f.subTree && t.push(...p(e.component.subTree, n)), t;
|
|
42
|
+
}, N = async (e, n, t = "") => {
|
|
43
43
|
var f;
|
|
44
|
-
if (!e || !
|
|
45
|
-
const { VnodeName: i, vnodeSubPath:
|
|
44
|
+
if (!e || !n || (n == null ? void 0 : n.size) < 1) return;
|
|
45
|
+
const { VnodeName: i, vnodeSubPath: s } = T(
|
|
46
46
|
e,
|
|
47
47
|
u.value
|
|
48
48
|
);
|
|
49
|
-
|
|
49
|
+
s && (t += a + s);
|
|
50
50
|
const l = I[i];
|
|
51
51
|
if (l) {
|
|
52
|
-
|
|
53
|
-
const
|
|
52
|
+
o.debug && c.log("[ vnkeeper ] >", i, e.key);
|
|
53
|
+
const r = t.split(a).slice(-1).join(a), U = n.get(r);
|
|
54
54
|
await l.set(e, U);
|
|
55
55
|
}
|
|
56
56
|
if (k.has(i)) {
|
|
57
|
-
|
|
57
|
+
o.debug && c.log("[ stop VnodeName ] >", i, t);
|
|
58
58
|
return;
|
|
59
59
|
}
|
|
60
60
|
if (e.children)
|
|
61
61
|
if (Array.isArray(e.children))
|
|
62
|
-
e.children.forEach((
|
|
63
|
-
|
|
62
|
+
e.children.forEach((r) => {
|
|
63
|
+
r = b(r), r && N(r, n, t);
|
|
64
64
|
});
|
|
65
65
|
else {
|
|
66
|
-
const
|
|
67
|
-
|
|
66
|
+
const r = K(e.children);
|
|
67
|
+
r && N(r, n, t);
|
|
68
68
|
}
|
|
69
|
-
(f = e.component) != null && f.subTree &&
|
|
70
|
-
},
|
|
69
|
+
(f = e.component) != null && f.subTree && N(e.component.subTree, n, t);
|
|
70
|
+
}, V = S(() => {
|
|
71
71
|
B(() => {
|
|
72
|
-
const e = w(g),
|
|
72
|
+
const e = w(g), n = x(e), t = b(n);
|
|
73
73
|
if (!t || typeof t.type == "string" || (typeof t.type == "object" && "name" in t.type && (m = t.type.name || ""), u.value = t.key || m || "", !v(m)) || !u.value)
|
|
74
74
|
return;
|
|
75
75
|
const i = d.get(u.value);
|
|
76
|
-
|
|
76
|
+
N(t, i), c.log(
|
|
77
77
|
"resetDataInVNode",
|
|
78
78
|
g.vnode.key,
|
|
79
79
|
u.value,
|
|
@@ -84,25 +84,25 @@ const c = console, s = "|", te = j({
|
|
|
84
84
|
trailing: !1
|
|
85
85
|
});
|
|
86
86
|
z(() => {
|
|
87
|
-
if (
|
|
88
|
-
|
|
89
|
-
|
|
87
|
+
if (o.debug) {
|
|
88
|
+
c.log("[ onMounted ] >", o.exclude), A(() => {
|
|
89
|
+
V();
|
|
90
90
|
});
|
|
91
91
|
return;
|
|
92
92
|
}
|
|
93
|
-
|
|
93
|
+
V();
|
|
94
94
|
}), F(() => {
|
|
95
|
-
if (
|
|
96
|
-
|
|
97
|
-
|
|
95
|
+
if (o.debug) {
|
|
96
|
+
c.log("[ onUpdated ] >", o.exclude), A(() => {
|
|
97
|
+
V();
|
|
98
98
|
});
|
|
99
99
|
return;
|
|
100
100
|
}
|
|
101
|
-
|
|
101
|
+
V();
|
|
102
102
|
});
|
|
103
|
-
const
|
|
103
|
+
const y = S(() => {
|
|
104
104
|
B(() => {
|
|
105
|
-
const e = w(g),
|
|
105
|
+
const e = w(g), n = x(e), t = b(n);
|
|
106
106
|
if (!t) return;
|
|
107
107
|
if (!u.value) {
|
|
108
108
|
c.warn(
|
|
@@ -111,13 +111,13 @@ const c = console, s = "|", te = j({
|
|
|
111
111
|
return;
|
|
112
112
|
}
|
|
113
113
|
if (!v(m)) return;
|
|
114
|
-
let i =
|
|
115
|
-
i = i.map((l) => [l[0].split(
|
|
116
|
-
const
|
|
117
|
-
|
|
114
|
+
let i = p(t);
|
|
115
|
+
i = i.map((l) => [l[0].split(a).slice(-1).join(a), l[1]]);
|
|
116
|
+
const s = i.map((l) => l[0]);
|
|
117
|
+
s.length > new Set(s).size && c.warn(
|
|
118
118
|
"需要缓存的路径重复请合理设置组件key,保证在当前ApKeepAlive模块下唯一",
|
|
119
|
-
|
|
120
|
-
), d.set(u.value, new Map(i)),
|
|
119
|
+
s
|
|
120
|
+
), d.set(u.value, new Map(i)), o.debug && c.log(
|
|
121
121
|
"[ loadDataInVNode ] >",
|
|
122
122
|
g.vnode.key,
|
|
123
123
|
u.value,
|
|
@@ -128,21 +128,21 @@ const c = console, s = "|", te = j({
|
|
|
128
128
|
trailing: !1
|
|
129
129
|
});
|
|
130
130
|
return L(() => {
|
|
131
|
-
if (
|
|
132
|
-
A(() => {
|
|
133
|
-
|
|
134
|
-
})
|
|
131
|
+
if (o.debug) {
|
|
132
|
+
c.log("[ onBeforeUnmount ] >"), A(() => {
|
|
133
|
+
y();
|
|
134
|
+
});
|
|
135
135
|
return;
|
|
136
136
|
}
|
|
137
|
-
|
|
137
|
+
y();
|
|
138
138
|
}), O(() => {
|
|
139
|
-
if (
|
|
140
|
-
A(() => {
|
|
141
|
-
|
|
142
|
-
})
|
|
139
|
+
if (o.debug) {
|
|
140
|
+
c.log("[ onBeforeUpdate ] >"), A(() => {
|
|
141
|
+
y();
|
|
142
|
+
});
|
|
143
143
|
return;
|
|
144
144
|
}
|
|
145
|
-
|
|
145
|
+
y();
|
|
146
146
|
}), $(d, u), () => {
|
|
147
147
|
var e;
|
|
148
148
|
return (e = h.default) == null ? void 0 : e.call(h);
|