@aplus-frontend/ui 0.4.35 → 0.4.36
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/hooks/use-watch.d.ts +4 -1
- package/es/src/ap-form/hooks/use-watch.mjs +31 -29
- package/es/src/ap-form/index.mjs +1 -1
- package/es/src/business/ap-batch-action-group/MenuItemGroup.vue2.mjs +13 -13
- package/lib/src/ap-form/hooks/use-watch.d.ts +4 -1
- package/lib/src/ap-form/hooks/use-watch.js +1 -1
- package/lib/src/ap-form/index.js +1 -1
- package/lib/src/business/ap-batch-action-group/MenuItemGroup.vue2.js +1 -1
- package/package.json +3 -3
|
@@ -2,5 +2,8 @@ import { NamePath } from '@aplus-frontend/antdv/es/form/interface';
|
|
|
2
2
|
import { ApFormExpose } from '../interface';
|
|
3
3
|
import { Ref } from 'vue';
|
|
4
4
|
type ApFormIns<T> = ApFormExpose<T>;
|
|
5
|
-
|
|
5
|
+
type WatchOptions<ValueType> = {
|
|
6
|
+
initialValue: ValueType;
|
|
7
|
+
};
|
|
8
|
+
export declare function useWatch<ValueType = any, StoreType = any>(name: NamePath | Ref<NamePath>, formOrOptions?: Ref<ApFormIns<StoreType> | undefined> | WatchOptions<ValueType>, options?: WatchOptions<ValueType>): Ref<ValueType | undefined, ValueType | undefined>;
|
|
6
9
|
export default useWatch;
|
|
@@ -1,40 +1,42 @@
|
|
|
1
|
-
import { useInjectForm as
|
|
2
|
-
import { ref as
|
|
3
|
-
import { isArray as
|
|
4
|
-
import { INTERNAL_FORM_INSTANCE_MARK as
|
|
5
|
-
function
|
|
6
|
-
return
|
|
1
|
+
import { useInjectForm as M } from "../context.mjs";
|
|
2
|
+
import { ref as R, watchEffect as d, unref as s, watch as y } from "vue";
|
|
3
|
+
import { isArray as E } from "lodash-unified";
|
|
4
|
+
import { INTERNAL_FORM_INSTANCE_MARK as _ } from "../constant.mjs";
|
|
5
|
+
function N(e, t) {
|
|
6
|
+
return E(t) ? t.reduce((n, l) => n == null ? void 0 : n[l], e) : e == null ? void 0 : e[t];
|
|
7
7
|
}
|
|
8
|
-
function
|
|
8
|
+
function V(e) {
|
|
9
9
|
try {
|
|
10
|
-
return JSON.stringify(
|
|
10
|
+
return JSON.stringify(e);
|
|
11
11
|
} catch {
|
|
12
12
|
return Math.random();
|
|
13
13
|
}
|
|
14
14
|
}
|
|
15
|
-
|
|
16
|
-
const { internalInstance:
|
|
17
|
-
let
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
15
|
+
function W(e, t, n) {
|
|
16
|
+
const { internalInstance: l, model: v } = M(), g = (n == null ? void 0 : n.initialValue) || (t == null ? void 0 : t.initialValue) || void 0, r = R(g);
|
|
17
|
+
let u = V(g), h = !0;
|
|
18
|
+
const i = t && "value" in t ? t : void 0;
|
|
19
|
+
return d((f) => {
|
|
20
|
+
var w;
|
|
21
|
+
const a = ((w = i == null ? void 0 : i.value) == null ? void 0 : w.getInternalInstance(_)) || l;
|
|
22
|
+
if (!a) {
|
|
23
|
+
h = !1;
|
|
23
24
|
return;
|
|
24
25
|
}
|
|
25
|
-
const c =
|
|
26
|
-
const
|
|
27
|
-
|
|
28
|
-
},
|
|
29
|
-
|
|
30
|
-
}),
|
|
31
|
-
() =>
|
|
32
|
-
(
|
|
33
|
-
const
|
|
34
|
-
c !==
|
|
26
|
+
const c = a.registerWatch((A) => {
|
|
27
|
+
const I = N(A, s(e)), S = V(I);
|
|
28
|
+
S !== u && (r.value = I, u = S);
|
|
29
|
+
}, h);
|
|
30
|
+
f(c);
|
|
31
|
+
}), y(
|
|
32
|
+
() => s(e),
|
|
33
|
+
(f) => {
|
|
34
|
+
const a = N(s(v), f), c = V(a);
|
|
35
|
+
c !== u && (r.value = a, u = c);
|
|
35
36
|
}
|
|
36
|
-
),
|
|
37
|
-
}
|
|
37
|
+
), r;
|
|
38
|
+
}
|
|
38
39
|
export {
|
|
39
|
-
|
|
40
|
+
W as default,
|
|
41
|
+
W as useWatch
|
|
40
42
|
};
|
package/es/src/ap-form/index.mjs
CHANGED
|
@@ -4,7 +4,7 @@ import "./item-group/index.vue2.mjs";
|
|
|
4
4
|
import "./list/index.vue2.mjs";
|
|
5
5
|
import "./search-form/index.vue2.mjs";
|
|
6
6
|
import "./modal-form/index.vue2.mjs";
|
|
7
|
-
import m from "./hooks/use-watch.mjs";
|
|
7
|
+
import { useWatch as m } from "./hooks/use-watch.mjs";
|
|
8
8
|
import "./dependency/index.vue2.mjs";
|
|
9
9
|
import "./set/index.vue2.mjs";
|
|
10
10
|
import "./drawer-form/index.vue2.mjs";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineComponent as _, ref as
|
|
1
|
+
import { defineComponent as _, ref as v, createBlock as a, openBlock as s, unref as u, withCtx as d, createElementBlock as h, Fragment as t, renderList as y, mergeProps as k, createElementVNode as w, withDirectives as g, createVNode as C, vShow as b, resolveDynamicComponent as L, h as M } from "vue";
|
|
2
2
|
import { LoadingOutlined as B } from "@ant-design/icons-vue";
|
|
3
3
|
import { Menu as R, MenuItem as x } from "@aplus-frontend/antdv";
|
|
4
4
|
const D = { style: { display: "flex", "align-items": "center" } }, P = /* @__PURE__ */ _({
|
|
@@ -9,31 +9,31 @@ const D = { style: { display: "flex", "align-items": "center" } }, P = /* @__PUR
|
|
|
9
9
|
menuList: {}
|
|
10
10
|
},
|
|
11
11
|
setup(f) {
|
|
12
|
-
const
|
|
13
|
-
async function p(
|
|
14
|
-
var
|
|
15
|
-
const n = (
|
|
12
|
+
const l = f, r = v({});
|
|
13
|
+
async function p(o, c) {
|
|
14
|
+
var e;
|
|
15
|
+
const n = (o == null ? void 0 : o.id) || c;
|
|
16
16
|
r.value[n] = !0;
|
|
17
17
|
try {
|
|
18
|
-
await ((
|
|
18
|
+
await ((e = o == null ? void 0 : o.onClick) == null ? void 0 : e.call(o, { selectedRows: l == null ? void 0 : l.selectedRows }));
|
|
19
19
|
} finally {
|
|
20
|
-
r.value[n] =
|
|
20
|
+
r.value[n] = void 0;
|
|
21
21
|
}
|
|
22
22
|
}
|
|
23
|
-
return (
|
|
23
|
+
return (o, c) => (s(), a(u(R), null, {
|
|
24
24
|
default: d(() => [
|
|
25
|
-
(s(!0),
|
|
26
|
-
key: (n == null ? void 0 : n.id) ||
|
|
25
|
+
(s(!0), h(t, null, y(l.menuList, (n, e) => (s(), a(u(x), k({
|
|
26
|
+
key: (n == null ? void 0 : n.id) || e,
|
|
27
27
|
ref_for: !0
|
|
28
28
|
}, {
|
|
29
29
|
...n,
|
|
30
|
-
onClick: () => p(n,
|
|
31
|
-
disabled: r.value[(n == null ? void 0 : n.id) ||
|
|
30
|
+
onClick: () => p(n, e),
|
|
31
|
+
disabled: r.value[(n == null ? void 0 : n.id) || e] ?? (n == null ? void 0 : n.disabled) ?? !1
|
|
32
32
|
}), {
|
|
33
33
|
default: d(() => [
|
|
34
34
|
w("div", D, [
|
|
35
35
|
g(C(u(B), { style: { "margin-right": "10px" } }, null, 512), [
|
|
36
|
-
[b, r.value[(n == null ? void 0 : n.id) ||
|
|
36
|
+
[b, r.value[(n == null ? void 0 : n.id) || e]]
|
|
37
37
|
]),
|
|
38
38
|
(s(), a(L(M(t, [n == null ? void 0 : n.content]))))
|
|
39
39
|
])
|
|
@@ -2,5 +2,8 @@ import { NamePath } from '@aplus-frontend/antdv/es/form/interface';
|
|
|
2
2
|
import { ApFormExpose } from '../interface';
|
|
3
3
|
import { Ref } from 'vue';
|
|
4
4
|
type ApFormIns<T> = ApFormExpose<T>;
|
|
5
|
-
|
|
5
|
+
type WatchOptions<ValueType> = {
|
|
6
|
+
initialValue: ValueType;
|
|
7
|
+
};
|
|
8
|
+
export declare function useWatch<ValueType = any, StoreType = any>(name: NamePath | Ref<NamePath>, formOrOptions?: Ref<ApFormIns<StoreType> | undefined> | WatchOptions<ValueType>, options?: WatchOptions<ValueType>): Ref<ValueType | undefined, ValueType | undefined>;
|
|
6
9
|
export default useWatch;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const _=require("../context.js"),u=require("vue"),o=require("lodash-unified"),q=require("../constant.js");function w(t,e){return o.isArray(e)?e.reduce((n,r)=>n==null?void 0:n[r],t):t==null?void 0:t[e]}function g(t){try{return JSON.stringify(t)}catch{return Math.random()}}function I(t,e,n){const{internalInstance:r,model:M}=_.useInjectForm(),V=(n==null?void 0:n.initialValue)||(e==null?void 0:e.initialValue)||void 0,i=u.ref(V);let c=g(V),d=!0;const s=e&&"value"in e?e:void 0;return u.watchEffect(f=>{var h;const a=((h=s==null?void 0:s.value)==null?void 0:h.getInternalInstance(q.INTERNAL_FORM_INSTANCE_MARK))||r;if(!a){d=!1;return}const l=a.registerWatch(N=>{const S=w(N,u.unref(t)),v=g(S);v!==c&&(i.value=S,c=v)},d);f(l)}),u.watch(()=>u.unref(t),f=>{const a=w(u.unref(M),f),l=g(a);l!==c&&(i.value=a,c=l)}),i}exports.default=I;exports.useWatch=I;
|
package/lib/src/ap-form/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("./ap-form.vue.js");require("./item/index.vue2.js");require("./item-group/index.vue2.js");require("./list/index.vue2.js");require("./search-form/index.vue2.js");require("./modal-form/index.vue2.js");const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("./ap-form.vue.js");require("./item/index.vue2.js");require("./item-group/index.vue2.js");require("./list/index.vue2.js");require("./search-form/index.vue2.js");require("./modal-form/index.vue2.js");const l=require("./hooks/use-watch.js");require("./dependency/index.vue2.js");require("./set/index.vue2.js");require("./drawer-form/index.vue2.js");require("./render/control.vue2.js");require("./render/item.vue2.js");require("./provider/index.vue2.js");require("./items/index.js");require("./interface.js");const c=require("./ap-form.vue2.js"),r=require("./item/index.vue.js"),t=require("./item-group/index.vue.js"),u=require("./list/index.vue.js"),_=require("./search-form/index.vue.js"),i=require("./modal-form/index.vue.js"),p=require("./dependency/index.vue.js"),o=require("./set/index.vue.js"),n=require("./drawer-form/index.vue.js"),a=require("./render/control.vue.js"),s=require("./render/item.vue.js"),d=require("./provider/index.vue.js"),e=c.default;e.FormItem=r.default;e.FormItemGroup=t.default;e.FormList=u.default;e.SearchForm=_.default;e.ModalForm=i.default;e.useWatch=l.useWatch;e.Dependency=p.default;e.Set=o.default;e.DrawerForm=n.default;e.ControlRender=a.default;e.ItemRender=s.default;e.Provider=d.default;exports.ApFormItem=r.default;exports.ApFormItemGroup=t.default;exports.ApFormList=u.default;exports.ApFormSearchForm=_.default;exports.ApFormModalForm=i.default;exports.ApFormDependency=p.default;exports.ApFormSet=o.default;exports.ApFormDrawerForm=n.default;exports.ApFormControlRender=a.default;exports.ApFormItemRender=s.default;exports.ApFormProvider=d.default;exports.ApForm=e;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),d=require("@ant-design/icons-vue"),s=require("@aplus-frontend/antdv"),f={style:{display:"flex","align-items":"center"}},p=e.defineComponent({__name:"MenuItemGroup",props:{selectedRows:{},buttonProps:{},menuList:{}},setup(a){const r=a,c=e.ref({});async function t(
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),d=require("@ant-design/icons-vue"),s=require("@aplus-frontend/antdv"),f={style:{display:"flex","align-items":"center"}},p=e.defineComponent({__name:"MenuItemGroup",props:{selectedRows:{},buttonProps:{},menuList:{}},setup(a){const r=a,c=e.ref({});async function t(o,u){var l;const n=(o==null?void 0:o.id)||u;c.value[n]=!0;try{await((l=o==null?void 0:o.onClick)==null?void 0:l.call(o,{selectedRows:r==null?void 0:r.selectedRows}))}finally{c.value[n]=void 0}}return(o,u)=>(e.openBlock(),e.createBlock(e.unref(s.Menu),null,{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(r.menuList,(n,l)=>(e.openBlock(),e.createBlock(e.unref(s.MenuItem),e.mergeProps({key:(n==null?void 0:n.id)||l,ref_for:!0},{...n,onClick:()=>t(n,l),disabled:c.value[(n==null?void 0:n.id)||l]??(n==null?void 0:n.disabled)??!1}),{default:e.withCtx(()=>[e.createElementVNode("div",f,[e.withDirectives(e.createVNode(e.unref(d.LoadingOutlined),{style:{"margin-right":"10px"}},null,512),[[e.vShow,c.value[(n==null?void 0:n.id)||l]]]),(e.openBlock(),e.createBlock(e.resolveDynamicComponent(e.h(e.Fragment,[n==null?void 0:n.content]))))])]),_:2},1040))),128))]),_:1}))}});exports.default=p;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aplus-frontend/ui",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.36",
|
|
4
4
|
"main": "./lib/index.js",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"files": [
|
|
@@ -65,8 +65,8 @@
|
|
|
65
65
|
"sortablejs": "^1.15.2",
|
|
66
66
|
"vue-virtual-scroller": "2.0.0-beta.8",
|
|
67
67
|
"vuedraggable": "^4.1.0",
|
|
68
|
-
"@aplus-frontend/
|
|
69
|
-
"@aplus-frontend/
|
|
68
|
+
"@aplus-frontend/utils": "1.0.52",
|
|
69
|
+
"@aplus-frontend/hooks": "1.0.7"
|
|
70
70
|
},
|
|
71
71
|
"peerDependencies": {
|
|
72
72
|
"@aplus-frontend/antdv": "^1.0.13",
|