@vunk/form 2.19.4 → 2.19.5
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/composables/index.cjs +1 -1
- package/composables/index.mjs +7 -7
- package/package.json +1 -1
package/composables/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("vue"),C=require("@vunk/shared/function"),M=require("element-plus"),m=require("@vunk/core"),P=(t,n={})=>{a.isRef(t)||(t=a.ref(t));const s={...n,slotsChildren:["default"]};n.slotsChildren&&s.slotsChildren.push(...n.slotsChildren);const e=a.computed(()=>{const c={},g={},I={};function d(T,R=[]){T.forEach((l,h)=>{const i=[...R,h],p={source:l,key:i,nextKey:[...R,h+1],prop:l.prop,id:l.id};c[i.join()]=p,l.prop&&(g[l.prop]=p),l.id&&(I[l.id]=p),l.templateSlots&&(Array.isArray(l.templateSlots)&&(i.push("templateSlots"),d(l.templateSlots,i)),s.slotsChildren.forEach(f=>{Array.isArray(l.templateSlots[f])&&(i.push("templateSlots",f),d(l.templateSlots[f],i))}))})}return d(a.unref(t)),{keyRecord:c,propRecord:g,idRecord:I}});return[t,{manager:e,getManagerInfoByProp:c=>e.value.propRecord[c],getManagerInfoByKey:c=>e.value.keyRecord[c.join()],getManagerInfoById:c=>e.value.idRecord[c]}]},v=()=>a.inject("vkfFormVm",null),E=t=>{const n=v();return a.computed(()=>t.readonly??(n==null?void 0:n.props.readonly)??!1)},D=t=>{const n=a.ref(0),s=a.computed(()=>{n.value;const r=t.value;return r?r.matches(":dir(rtl)")||getComputedStyle(r).direction==="rtl":!1});let e=null;const o=r=>{e==null||e.disconnect(),e=new MutationObserver(()=>{n.value++});let u=r.parentElement;for(;u;)e.observe(u,{attributes:!0,attributeFilter:["dir","style","class"]}),u=u.parentElement};return a.watch(t,r=>{r?o(r):e==null||e.disconnect()},{immediate:!0,flush:"post"}),a.onBeforeUnmount(()=>e==null?void 0:e.disconnect()),s};function j(t,n){const s=D(t),e=a.inject(M.formContextKey);return a.computed(()=>{C.noop(t.value);const o=n.value??a.unref(e==null?void 0:e.labelPosition);return o==="start"?s.value?"right":"left":o==="end"?s.value?"left":"right":o})}const S=Symbol("PARENT_KEY"),y=()=>a.inject("vkTemplateInstances",null),k=()=>{const t=y(),n=e=>e==null?void 0:e[S];return{templateInstances:t,getTemplateInstance:e=>{let o=t==null?void 0:t[e];if(o)return o;let r=n(t);for(;r;){if(o=r==null?void 0:r[e],o)return o;r=n(r)}return null},getParent:n}},A=()=>{const t=y(),n=a.shallowReactive({});return n[S]=t,a.provide("vkTemplateInstances",n),n},B=(t,n)=>{const s=a.computed(()=>t.data),r={data:s,emitSetData:u=>{n.emit("setData",{intoUndefined:m.defaultIntoUndefined,...u})},getDataValue:u=>m.getValue(s.value,u,m.defaultIntoUndefined,!0)};return a.provide("vkRendererData",r),r},K=()=>a.inject("vkRendererData",{});exports.initRendererData=B;exports.initTemplateInstances=A;exports.useComputedLabelPosition=j;exports.useComputedReadonly=E;exports.useForm=v;exports.useRendererData=K;exports.useRtl=D;exports.useSourceManager=P;exports.useTemplateInstances=y;exports.useTemplateInstancesContext=k;
|
package/composables/index.mjs
CHANGED
|
@@ -40,10 +40,10 @@ const N = (e, n = {}) => {
|
|
|
40
40
|
getManagerInfoById: (c) => t.value.idRecord[c]
|
|
41
41
|
}
|
|
42
42
|
];
|
|
43
|
-
},
|
|
44
|
-
const n =
|
|
43
|
+
}, V = () => d("vkfFormVm", null), Y = (e) => {
|
|
44
|
+
const n = V();
|
|
45
45
|
return i(() => e.readonly ?? (n == null ? void 0 : n.props.readonly) ?? !1);
|
|
46
|
-
},
|
|
46
|
+
}, j = (e) => {
|
|
47
47
|
const n = v(0), a = i(() => {
|
|
48
48
|
n.value;
|
|
49
49
|
const r = e.value;
|
|
@@ -70,10 +70,10 @@ const N = (e, n = {}) => {
|
|
|
70
70
|
), A(() => t == null ? void 0 : t.disconnect()), a;
|
|
71
71
|
};
|
|
72
72
|
function _(e, n) {
|
|
73
|
-
const a =
|
|
73
|
+
const a = j(e), t = d(P);
|
|
74
74
|
return i(() => {
|
|
75
75
|
K(e.value);
|
|
76
|
-
const o = n.value ?? D(t.labelPosition);
|
|
76
|
+
const o = n.value ?? D(t == null ? void 0 : t.labelPosition);
|
|
77
77
|
return o === "start" ? a.value ? "right" : "left" : o === "end" ? a.value ? "left" : "right" : o;
|
|
78
78
|
});
|
|
79
79
|
}
|
|
@@ -120,9 +120,9 @@ export {
|
|
|
120
120
|
O as initTemplateInstances,
|
|
121
121
|
_ as useComputedLabelPosition,
|
|
122
122
|
Y as useComputedReadonly,
|
|
123
|
-
|
|
123
|
+
V as useForm,
|
|
124
124
|
z as useRendererData,
|
|
125
|
-
|
|
125
|
+
j as useRtl,
|
|
126
126
|
N as useSourceManager,
|
|
127
127
|
T as useTemplateInstances,
|
|
128
128
|
L as useTemplateInstancesContext
|