@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.
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("vue"),T=require("@vunk/shared/function"),M=require("element-plus"),m=require("@vunk/core"),P=(t,n={})=>{o.isRef(t)||(t=o.ref(t));const s={...n,slotsChildren:["default"]};n.slotsChildren&&s.slotsChildren.push(...n.slotsChildren);const e=o.computed(()=>{const c={},g={},I={};function d(C,R=[]){C.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(o.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=()=>o.inject("vkfFormVm",null),E=t=>{const n=v();return o.computed(()=>t.readonly??(n==null?void 0:n.props.readonly)??!1)},D=t=>{const n=o.ref(0),s=o.computed(()=>{n.value;const r=t.value;return r?r.matches(":dir(rtl)")||getComputedStyle(r).direction==="rtl":!1});let e=null;const a=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 o.watch(t,r=>{r?a(r):e==null||e.disconnect()},{immediate:!0,flush:"post"}),o.onBeforeUnmount(()=>e==null?void 0:e.disconnect()),s};function j(t,n){const s=D(t),e=o.inject(M.formContextKey);return o.computed(()=>{T.noop(t.value);const a=n.value??o.unref(e.labelPosition);return a==="start"?s.value?"right":"left":a==="end"?s.value?"left":"right":a})}const S=Symbol("PARENT_KEY"),y=()=>o.inject("vkTemplateInstances",null),k=()=>{const t=y(),n=e=>e==null?void 0:e[S];return{templateInstances:t,getTemplateInstance:e=>{let a=t==null?void 0:t[e];if(a)return a;let r=n(t);for(;r;){if(a=r==null?void 0:r[e],a)return a;r=n(r)}return null},getParent:n}},A=()=>{const t=y(),n=o.shallowReactive({});return n[S]=t,o.provide("vkTemplateInstances",n),n},B=(t,n)=>{const s=o.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 o.provide("vkRendererData",r),r},K=()=>o.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;
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;
@@ -40,10 +40,10 @@ const N = (e, n = {}) => {
40
40
  getManagerInfoById: (c) => t.value.idRecord[c]
41
41
  }
42
42
  ];
43
- }, x = () => d("vkfFormVm", null), Y = (e) => {
44
- const n = x();
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
- }, V = (e) => {
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 = V(e), t = d(P);
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
- x as useForm,
123
+ V as useForm,
124
124
  z as useRendererData,
125
- V as useRtl,
125
+ j as useRtl,
126
126
  N as useSourceManager,
127
127
  T as useTemplateInstances,
128
128
  L as useTemplateInstancesContext
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vunk/form",
3
- "version": "2.19.4",
3
+ "version": "2.19.5",
4
4
  "description": "",
5
5
  "main": "index.esm.js",
6
6
  "scripts": {