@piying/view-react 1.3.1 → 1.3.3
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/component/group.d.ts +1 -3
- package/index.cjs +3 -3
- package/index.js +70 -70
- package/package.json +2 -2
- package/readme.md +1 -1
package/component/group.d.ts
CHANGED
package/index.cjs
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*
|
|
7
7
|
* This source code is licensed under the MIT license found in the
|
|
8
8
|
* LICENSE file in the root directory of this source tree.
|
|
9
|
-
*/var H;function he(){if(H)return x;H=1;var r=Symbol.for("react.transitional.element"),
|
|
9
|
+
*/var H;function he(){if(H)return x;H=1;var r=Symbol.for("react.transitional.element"),n=Symbol.for("react.fragment");function t(u,o,l){var i=null;if(l!==void 0&&(i=""+l),o.key!==void 0&&(i=""+o.key),"key"in o){l={};for(var E in o)E!=="key"&&(l[E]=o[E])}else l=o;return o=l.ref,{$$typeof:r,type:u,key:i,ref:o!==void 0?o:null,props:l}}return x.Fragment=n,x.jsx=t,x.jsxs=t,x}var S={};/**
|
|
10
10
|
* @license React
|
|
11
11
|
* react-jsx-runtime.development.js
|
|
12
12
|
*
|
|
@@ -14,9 +14,9 @@
|
|
|
14
14
|
*
|
|
15
15
|
* This source code is licensed under the MIT license found in the
|
|
16
16
|
* LICENSE file in the root directory of this source tree.
|
|
17
|
-
*/var X;function Ee(){return X||(X=1,process.env.NODE_ENV!=="production"&&function(){function r(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===de?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case w:return"Fragment";case ne:return"Profiler";case te:return"StrictMode";case le:return"Suspense";case ae:return"SuspenseList";case ie:return"Activity"}if(typeof e=="object")switch(typeof e.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),e.$$typeof){case m:return"Portal";case ue:return(e.displayName||"Context")+".Provider";case oe:return(e._context.displayName||"Context")+".Consumer";case se:var s=e.render;return e=e.displayName,e||(e=s.displayName||s.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case ce:return s=e.displayName||null,s!==null?s:r(e.type)||"Memo";case L:s=e._payload,e=e._init;try{return r(e(s))}catch{}}return null}function
|
|
17
|
+
*/var X;function Ee(){return X||(X=1,process.env.NODE_ENV!=="production"&&function(){function r(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===de?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case w:return"Fragment";case ne:return"Profiler";case te:return"StrictMode";case le:return"Suspense";case ae:return"SuspenseList";case ie:return"Activity"}if(typeof e=="object")switch(typeof e.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),e.$$typeof){case m:return"Portal";case ue:return(e.displayName||"Context")+".Provider";case oe:return(e._context.displayName||"Context")+".Consumer";case se:var s=e.render;return e=e.displayName,e||(e=s.displayName||s.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case ce:return s=e.displayName||null,s!==null?s:r(e.type)||"Memo";case L:s=e._payload,e=e._init;try{return r(e(s))}catch{}}return null}function n(e){return""+e}function t(e){try{n(e);var s=!1}catch{s=!0}if(s){s=console;var c=s.error,b=typeof Symbol=="function"&&Symbol.toStringTag&&e[Symbol.toStringTag]||e.constructor.name||"Object";return c.call(s,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",b),n(e)}}function u(e){if(e===w)return"<>";if(typeof e=="object"&&e!==null&&e.$$typeof===L)return"<...>";try{var s=r(e);return s?"<"+s+">":"<...>"}catch{return"<...>"}}function o(){var e=I.A;return e===null?null:e.getOwner()}function l(){return Error("react-stack-top-frame")}function i(e){if(W.call(e,"key")){var s=Object.getOwnPropertyDescriptor(e,"key").get;if(s&&s.isReactWarning)return!1}return e.key!==void 0}function E(e,s){function c(){q||(q=!0,console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",s))}c.isReactWarning=!0,Object.defineProperty(e,"key",{get:c,configurable:!0})}function d(){var e=r(this.type);return U[e]||(U[e]=!0,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),e=this.props.ref,e!==void 0?e:null}function T(e,s,c,b,_,R,N,F){return c=R.ref,e={$$typeof:O,type:e,key:s,props:R,_owner:_},(c!==void 0?c:null)!==null?Object.defineProperty(e,"ref",{enumerable:!1,get:d}):Object.defineProperty(e,"ref",{enumerable:!1,value:null}),e._store={},Object.defineProperty(e._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(e,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(e,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:N}),Object.defineProperty(e,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:F}),Object.freeze&&(Object.freeze(e.props),Object.freeze(e)),e}function k(e,s,c,b,_,R,N,F){var h=s.children;if(h!==void 0)if(b)if(fe(h)){for(b=0;b<h.length;b++)j(h[b]);Object.freeze&&Object.freeze(h)}else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else j(h);if(W.call(s,"key")){h=r(e);var C=Object.keys(s).filter(function(me){return me!=="key"});b=0<C.length?"{key: someKey, "+C.join(": ..., ")+": ...}":"{key: someKey}",z[h+b]||(C=0<C.length?"{"+C.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
|
|
18
18
|
let props = %s;
|
|
19
19
|
<%s {...props} />
|
|
20
20
|
React keys must be passed directly to JSX without using spread:
|
|
21
21
|
let props = %s;
|
|
22
|
-
<%s key={someKey} {...props} />`,b,h,C,h),z[h+b]=!0)}if(h=null,c!==void 0&&(
|
|
22
|
+
<%s key={someKey} {...props} />`,b,h,C,h),z[h+b]=!0)}if(h=null,c!==void 0&&(t(c),h=""+c),i(s)&&(t(s.key),h=""+s.key),"key"in s){c={};for(var Y in s)Y!=="key"&&(c[Y]=s[Y])}else c=s;return h&&E(c,typeof e=="function"?e.displayName||e.name||"Unknown":e),T(e,h,R,_,o(),c,N,F)}function j(e){typeof e=="object"&&e!==null&&e.$$typeof===O&&e._store&&(e._store.validated=1)}var g=a,O=Symbol.for("react.transitional.element"),m=Symbol.for("react.portal"),w=Symbol.for("react.fragment"),te=Symbol.for("react.strict_mode"),ne=Symbol.for("react.profiler"),oe=Symbol.for("react.consumer"),ue=Symbol.for("react.context"),se=Symbol.for("react.forward_ref"),le=Symbol.for("react.suspense"),ae=Symbol.for("react.suspense_list"),ce=Symbol.for("react.memo"),L=Symbol.for("react.lazy"),ie=Symbol.for("react.activity"),de=Symbol.for("react.client.reference"),I=g.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,W=Object.prototype.hasOwnProperty,fe=Array.isArray,M=console.createTask?console.createTask:function(){return null};g={react_stack_bottom_frame:function(e){return e()}};var q,U={},B=g.react_stack_bottom_frame.bind(g,l)(),J=M(u(l)),z={};S.Fragment=w,S.jsx=function(e,s,c,b,_){var R=1e4>I.recentlyCreatedOwnerStacks++;return k(e,s,c,!1,b,_,R?Error("react-stack-top-frame"):B,R?M(u(e)):J)},S.jsxs=function(e,s,c,b,_){var R=1e4>I.recentlyCreatedOwnerStacks++;return k(e,s,c,!0,b,_,R?Error("react-stack-top-frame"):B,R?M(u(e)):J)}}()),S}var Z;function ge(){return Z||(Z=1,process.env.NODE_ENV==="production"?y.exports=he():y.exports=Ee()),y.exports}var f=ge();const V=a.createContext(void 0),P=a.createContext(void 0);function p(r,n){const t=a.useContext(P),[u,o]=a.useState(a.useMemo(()=>n(r),[])),l=a.useRef(u);return a.useEffect(()=>{const i=n(r);Object.is(l.current,i)||(o(i),l.current=i);const E=v.effect(()=>{const d=n(r);Object.is(l.current,d)||(o(d),l.current=d)},{injector:t});return()=>{E.destroy()}},[r,a.useMemo(()=>n,[])]),u}function $(r){const n=a.useMemo(()=>r.wrappers.slice(1),[r.wrappers]),t=r.wrappers[0],u=p(t,()=>({...t?.inputs(),...t?.attributes(),...t?.outputs}));return f.jsx(f.Fragment,{children:t?f.jsx(t.type,{...u,children:f.jsx($,{wrappers:n,children:r.children})}):r.children})}const Q=Symbol.for("ControlValueAccessor");function G(r){const n=p(r.field,m=>m.inputs()),t=p(r.field,m=>m.outputs()),u=p(r.field,m=>m.attributes()),o=a.useMemo(()=>({...u,...n,...t}),[u,n,t]),l=p(r.field,m=>m.renderConfig()),i=p(r.field,m=>m.children?.()),E=p(r.field,m=>m.wrappers()),d=r.field.form.control,T=r.field.define?.type,k=a.useMemo(()=>!!l.hidden||!T,[l.hidden,T]),j=a.useContext(P),g=a.useRef(void 0),O=a.useMemo(()=>({...o,[Q]:g}),[o,g]);return a.useEffect(()=>{let m;return g.current&&(m=A.createViewControlLink(()=>d,g.current,j)),()=>{m?.(),m=void 0}},[g.current,d,j]),f.jsx(f.Fragment,{children:f.jsx(V,{value:r.field,children:k?void 0:f.jsx($,{wrappers:E,children:i?f.jsx(T,{...o}):r.field.form.control?f.jsx(T,{...O}):f.jsx(T,{...o})})})})}function K(r,n,t,u){let o=!0;return v.effect(()=>{const l=n.value$$();o?(be.deepEqual(l,r)||u(l),o=!1):u(l)},{injector:t})}function Re(){const[r,n]=a.useState(void 0),[t,u]=a.useState(!1),o=a.useRef(void 0),l=a.useRef(void 0),i=a.useMemo(()=>({writeValue(d){n(d)},registerOnChange(d){o.current=d},registerOnTouched(d){l.current=d},setDisabledState(d){u(d)}}),[]),E=a.useMemo(()=>({value:r,disabled:t,valueChange:d=>{o.current?.(d),n(d)},touchedChange:()=>{l.current?.()}}),[r,t]);return a.useMemo(()=>({cva:i,cvaa:E}),[E])}function D(r,n){const t=a.useCallback(r,n),u=a.useRef(void 0);a.useMemo(()=>(u.current=t(),u.current),n),a.useEffect(()=>()=>{u.current?.(),u.current=void 0},[])}function pe(){const r=a.useContext(V),n=p(r,t=>t?.children());return f.jsx(f.Fragment,{children:n.map((t,u)=>f.jsx(G,{field:t},u))})}class ee extends A.CoreSchemaHandle{}class re extends A.FormBuilder{}function _e(r){const n=a.useMemo(()=>v.createRootInjector({providers:[{provide:v.ChangeDetectionScheduler,useClass:v.ChangeDetectionSchedulerImpl}]}),[]),[t,u]=a.useMemo(()=>{const o=v.createInjector({providers:[],parent:n});return[A.convert(r.schema,{handle:ee,builder:re,injector:o,registerOnDestroy:i=>{o.get(v.DestroyRef).onDestroy(i)},...r.options}),o]},[r.schema,r.options]);return D(()=>{let o;if(t.form.control){const l=r.model;o=K(typeof l<"u"?l:void 0,t.form.control,u,i=>{v.untracked(()=>{t.form.control?.valueNoError$$()&&r.modelChange?.(i)})})}return()=>{u.destroy(),o?.destroy()}},[t]),D(()=>{t.form.control?.updateValue(r.model)},[t,r.model]),f.jsx(f.Fragment,{children:f.jsx(P,{value:n,children:f.jsx(G,{field:t})})})}const ve=[],Te={directives:"merge",formConfig:"merge",inputs:"merge",outputs:"merge",props:"merge",renderConfig:"merge",wrappers:"replace"};function Ce(r,n){const t=a.useRef(!1);return a.useMemo(()=>{const u={value:r.value==null?"":r.value,disabled:r.disabled,onBlur:r.touchedChange};return n?{...u,onCompositionStart:()=>{t.current=!0},onCompositionEnd:o=>{t.current=!1,r.valueChange(o.target.value)}}:{...u,onInput:o=>r.valueChange(o.target.value)}},[r,n])}function je(r){return a.useMemo(()=>({checked:r.value??!1,disabled:r.disabled,onBlur:r.touchedChange,onChange:n=>r.valueChange(n.target.checked)}),[r])}function xe(r){return a.useMemo(()=>({value:r.value==null?"":r.value,disabled:r.disabled,onBlur:r.touchedChange,onInput:n=>{const t=n.target.value;r.valueChange(t==""?void 0:parseFloat(t))}}),[r])}function Se(r,n){return a.useMemo(()=>({value:n,checked:Object.is(r.value,n),disabled:r.disabled,onBlur:r.touchedChange,onChange:()=>r.valueChange(n)}),[r])}function ke(r){return a.useMemo(()=>{const n=t=>{const u=t.target.value;r.valueChange(u==""?void 0:parseFloat(u))};return{value:r.value==null?"":r.value,disabled:r.disabled,onBlur:r.touchedChange,onInput:n,onChange:n}},[r])}function Oe(r,n=!1){return a.useMemo(()=>({value:r.value,disabled:r.disabled,onBlur:r.touchedChange,onChange:t=>{const u=[],o=t.target;if(o.selectedOptions!==void 0)for(let l=0;l<o.selectedOptions.length;l++){const i=o.selectedOptions[l];if(u.push(i.value),!n)break}else for(let l=0;l<o.options.length;l++){const i=o.options[l];if(i.selected&&(u.push(i.value),!n))break}r.valueChange(n?u:u[0])}}),[r])}exports.CVA=Q;exports.EMPTY_ARRAY=ve;exports.InjectorToken=P;exports.NG_CONFIG_DEFAULT_MERGE_STRAGEGY=Te;exports.PI_VIEW_FIELD_TOKEN=V;exports.PiyingFieldTemplate=G;exports.PiyingGroup=pe;exports.PiyingView=_e;exports.PiyingWrapper=$;exports.ReactFormBuilder=re;exports.ReactSchemaHandle=ee;exports.initListen=K;exports.useControlValueAccessor=Re;exports.useEffectSync=D;exports.useInputCheckboxModel=je;exports.useInputNumberModel=xe;exports.useInputRadioModel=Se;exports.useInputRangeModel=ke;exports.useInputTextModel=Ce;exports.useSelectModel=Oe;exports.useSignalToRef=p;
|
package/index.js
CHANGED
|
@@ -17,8 +17,8 @@ var J;
|
|
|
17
17
|
function Oe() {
|
|
18
18
|
if (J) return x;
|
|
19
19
|
J = 1;
|
|
20
|
-
var r = Symbol.for("react.transitional.element"),
|
|
21
|
-
function
|
|
20
|
+
var r = Symbol.for("react.transitional.element"), n = Symbol.for("react.fragment");
|
|
21
|
+
function t(u, o, l) {
|
|
22
22
|
var c = null;
|
|
23
23
|
if (l !== void 0 && (c = "" + l), o.key !== void 0 && (c = "" + o.key), "key" in o) {
|
|
24
24
|
l = {};
|
|
@@ -33,7 +33,7 @@ function Oe() {
|
|
|
33
33
|
props: l
|
|
34
34
|
};
|
|
35
35
|
}
|
|
36
|
-
return x.Fragment =
|
|
36
|
+
return x.Fragment = n, x.jsx = t, x.jsxs = t, x;
|
|
37
37
|
}
|
|
38
38
|
var k = {};
|
|
39
39
|
/**
|
|
@@ -91,12 +91,12 @@ function Se() {
|
|
|
91
91
|
}
|
|
92
92
|
return null;
|
|
93
93
|
}
|
|
94
|
-
function
|
|
94
|
+
function n(e) {
|
|
95
95
|
return "" + e;
|
|
96
96
|
}
|
|
97
|
-
function
|
|
97
|
+
function t(e) {
|
|
98
98
|
try {
|
|
99
|
-
|
|
99
|
+
n(e);
|
|
100
100
|
var s = !1;
|
|
101
101
|
} catch {
|
|
102
102
|
s = !0;
|
|
@@ -108,7 +108,7 @@ function Se() {
|
|
|
108
108
|
s,
|
|
109
109
|
"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
|
|
110
110
|
h
|
|
111
|
-
),
|
|
111
|
+
), n(e);
|
|
112
112
|
}
|
|
113
113
|
}
|
|
114
114
|
function u(e) {
|
|
@@ -217,7 +217,7 @@ React keys must be passed directly to JSX without using spread:
|
|
|
217
217
|
b
|
|
218
218
|
), q[b + h] = !0);
|
|
219
219
|
}
|
|
220
|
-
if (b = null, a !== void 0 && (
|
|
220
|
+
if (b = null, a !== void 0 && (t(a), b = "" + a), c(s) && (t(s.key), b = "" + s.key), "key" in s) {
|
|
221
221
|
a = {};
|
|
222
222
|
for (var F in s)
|
|
223
223
|
F !== "key" && (a[F] = s[F]);
|
|
@@ -284,39 +284,39 @@ function we() {
|
|
|
284
284
|
}
|
|
285
285
|
var d = we();
|
|
286
286
|
const K = Z(void 0), V = Z(void 0);
|
|
287
|
-
function v(r,
|
|
288
|
-
const
|
|
287
|
+
function v(r, n) {
|
|
288
|
+
const t = D(V), [u, o] = Y(f(() => n(r), [])), l = C(u);
|
|
289
289
|
return M(() => {
|
|
290
|
-
const c =
|
|
290
|
+
const c = n(r);
|
|
291
291
|
Object.is(l.current, c) || (o(c), l.current = c);
|
|
292
292
|
const g = Q(
|
|
293
293
|
() => {
|
|
294
|
-
const i =
|
|
294
|
+
const i = n(r);
|
|
295
295
|
Object.is(l.current, i) || (o(i), l.current = i);
|
|
296
296
|
},
|
|
297
|
-
{ injector:
|
|
297
|
+
{ injector: t }
|
|
298
298
|
);
|
|
299
299
|
return () => {
|
|
300
300
|
g.destroy();
|
|
301
301
|
};
|
|
302
|
-
}, [r, f(() =>
|
|
302
|
+
}, [r, f(() => n, [])]), u;
|
|
303
303
|
}
|
|
304
304
|
function ee(r) {
|
|
305
|
-
const
|
|
305
|
+
const n = f(
|
|
306
306
|
() => r.wrappers.slice(1),
|
|
307
307
|
[r.wrappers]
|
|
308
|
-
),
|
|
309
|
-
...
|
|
310
|
-
...
|
|
311
|
-
...
|
|
308
|
+
), t = r.wrappers[0], u = v(t, () => ({
|
|
309
|
+
...t?.inputs(),
|
|
310
|
+
...t?.attributes(),
|
|
311
|
+
...t?.outputs
|
|
312
312
|
}));
|
|
313
|
-
return /* @__PURE__ */ d.jsx(d.Fragment, { children:
|
|
313
|
+
return /* @__PURE__ */ d.jsx(d.Fragment, { children: t ? /* @__PURE__ */ d.jsx(t.type, { ...u, children: /* @__PURE__ */ d.jsx(ee, { wrappers: n, children: r.children }) }) : r.children });
|
|
314
314
|
}
|
|
315
315
|
const Ae = Symbol.for("ControlValueAccessor");
|
|
316
316
|
function re(r) {
|
|
317
|
-
const
|
|
318
|
-
() => ({ ...u, ...
|
|
319
|
-
[u,
|
|
317
|
+
const n = v(r.field, (m) => m.inputs()), t = v(r.field, (m) => m.outputs()), u = v(r.field, (m) => m.attributes()), o = f(
|
|
318
|
+
() => ({ ...u, ...n, ...t }),
|
|
319
|
+
[u, n, t]
|
|
320
320
|
), l = v(
|
|
321
321
|
r.field,
|
|
322
322
|
(m) => m.renderConfig()
|
|
@@ -338,20 +338,20 @@ function re(r) {
|
|
|
338
338
|
};
|
|
339
339
|
}, [p.current, i, j]), /* @__PURE__ */ d.jsx(d.Fragment, { children: /* @__PURE__ */ d.jsx(K, { value: r.field, children: O ? void 0 : /* @__PURE__ */ d.jsx(ee, { wrappers: g, children: c ? /* @__PURE__ */ d.jsx(_, { ...o }) : r.field.form.control ? /* @__PURE__ */ d.jsx(_, { ...S }) : /* @__PURE__ */ d.jsx(_, { ...o }) }) }) });
|
|
340
340
|
}
|
|
341
|
-
function ye(r,
|
|
341
|
+
function ye(r, n, t, u) {
|
|
342
342
|
let o = !0;
|
|
343
343
|
return Q(
|
|
344
344
|
() => {
|
|
345
|
-
const l =
|
|
345
|
+
const l = n.value$$();
|
|
346
346
|
o ? (ke(l, r) || u(l), o = !1) : u(l);
|
|
347
347
|
},
|
|
348
|
-
{ injector:
|
|
348
|
+
{ injector: t }
|
|
349
349
|
);
|
|
350
350
|
}
|
|
351
351
|
function Ve() {
|
|
352
|
-
const [r,
|
|
352
|
+
const [r, n] = Y(void 0), [t, u] = Y(!1), o = C(void 0), l = C(void 0), c = f(() => ({
|
|
353
353
|
writeValue(i) {
|
|
354
|
-
|
|
354
|
+
n(i);
|
|
355
355
|
},
|
|
356
356
|
registerOnChange(i) {
|
|
357
357
|
o.current = i;
|
|
@@ -364,28 +364,28 @@ function Ve() {
|
|
|
364
364
|
}
|
|
365
365
|
}), []), g = f(() => ({
|
|
366
366
|
value: r,
|
|
367
|
-
disabled:
|
|
367
|
+
disabled: t,
|
|
368
368
|
valueChange: (i) => {
|
|
369
|
-
o.current?.(i),
|
|
369
|
+
o.current?.(i), n(i);
|
|
370
370
|
},
|
|
371
371
|
touchedChange: () => {
|
|
372
372
|
l.current?.();
|
|
373
373
|
}
|
|
374
|
-
}), [r,
|
|
374
|
+
}), [r, t]);
|
|
375
375
|
return f(() => ({
|
|
376
376
|
cva: c,
|
|
377
377
|
cvaa: g
|
|
378
378
|
}), [g]);
|
|
379
379
|
}
|
|
380
|
-
function X(r,
|
|
381
|
-
const
|
|
382
|
-
f(() => (u.current =
|
|
380
|
+
function X(r, n) {
|
|
381
|
+
const t = be(r, n), u = C(void 0);
|
|
382
|
+
f(() => (u.current = t(), u.current), n), M(() => () => {
|
|
383
383
|
u.current?.(), u.current = void 0;
|
|
384
384
|
}, []);
|
|
385
385
|
}
|
|
386
|
-
function $e(
|
|
387
|
-
const
|
|
388
|
-
return /* @__PURE__ */ d.jsx(d.Fragment, { children: n.map((
|
|
386
|
+
function $e() {
|
|
387
|
+
const r = D(K), n = v(r, (t) => t?.children());
|
|
388
|
+
return /* @__PURE__ */ d.jsx(d.Fragment, { children: n.map((t, u) => /* @__PURE__ */ d.jsx(re, { field: t }, u)) });
|
|
389
389
|
}
|
|
390
390
|
class Pe extends Ce {
|
|
391
391
|
// contents?: any[];
|
|
@@ -393,15 +393,15 @@ class Pe extends Ce {
|
|
|
393
393
|
class Ie extends je {
|
|
394
394
|
}
|
|
395
395
|
function Le(r) {
|
|
396
|
-
const
|
|
396
|
+
const n = f(() => ge({
|
|
397
397
|
providers: [
|
|
398
398
|
{
|
|
399
399
|
provide: Ee,
|
|
400
400
|
useClass: pe
|
|
401
401
|
}
|
|
402
402
|
]
|
|
403
|
-
}), []), [
|
|
404
|
-
const o = Re({ providers: [], parent:
|
|
403
|
+
}), []), [t, u] = f(() => {
|
|
404
|
+
const o = Re({ providers: [], parent: n });
|
|
405
405
|
return [xe(r.schema, {
|
|
406
406
|
handle: Pe,
|
|
407
407
|
builder: Ie,
|
|
@@ -414,15 +414,15 @@ function Le(r) {
|
|
|
414
414
|
}, [r.schema, r.options]);
|
|
415
415
|
return X(() => {
|
|
416
416
|
let o;
|
|
417
|
-
if (
|
|
417
|
+
if (t.form.control) {
|
|
418
418
|
const l = r.model;
|
|
419
419
|
o = ye(
|
|
420
420
|
typeof l < "u" ? l : void 0,
|
|
421
|
-
|
|
421
|
+
t.form.control,
|
|
422
422
|
u,
|
|
423
423
|
(c) => {
|
|
424
424
|
_e(() => {
|
|
425
|
-
|
|
425
|
+
t.form.control?.valueNoError$$() && r.modelChange?.(c);
|
|
426
426
|
});
|
|
427
427
|
}
|
|
428
428
|
);
|
|
@@ -430,9 +430,9 @@ function Le(r) {
|
|
|
430
430
|
return () => {
|
|
431
431
|
u.destroy(), o?.destroy();
|
|
432
432
|
};
|
|
433
|
-
}, [
|
|
434
|
-
|
|
435
|
-
}, [
|
|
433
|
+
}, [t]), X(() => {
|
|
434
|
+
t.form.control?.updateValue(r.model);
|
|
435
|
+
}, [t, r.model]), /* @__PURE__ */ d.jsx(d.Fragment, { children: /* @__PURE__ */ d.jsx(V, { value: n, children: /* @__PURE__ */ d.jsx(re, { field: t }) }) });
|
|
436
436
|
}
|
|
437
437
|
const We = [], Ge = {
|
|
438
438
|
directives: "merge",
|
|
@@ -443,34 +443,34 @@ const We = [], Ge = {
|
|
|
443
443
|
renderConfig: "merge",
|
|
444
444
|
wrappers: "replace"
|
|
445
445
|
};
|
|
446
|
-
function Ue(r,
|
|
447
|
-
const
|
|
446
|
+
function Ue(r, n) {
|
|
447
|
+
const t = C(!1);
|
|
448
448
|
return f(() => {
|
|
449
449
|
const u = {
|
|
450
450
|
value: r.value == null ? "" : r.value,
|
|
451
451
|
disabled: r.disabled,
|
|
452
452
|
onBlur: r.touchedChange
|
|
453
453
|
};
|
|
454
|
-
return
|
|
454
|
+
return n ? {
|
|
455
455
|
...u,
|
|
456
456
|
onCompositionStart: () => {
|
|
457
|
-
|
|
457
|
+
t.current = !0;
|
|
458
458
|
},
|
|
459
459
|
onCompositionEnd: (o) => {
|
|
460
|
-
|
|
460
|
+
t.current = !1, r.valueChange(o.target.value);
|
|
461
461
|
}
|
|
462
462
|
} : {
|
|
463
463
|
...u,
|
|
464
464
|
onInput: (o) => r.valueChange(o.target.value)
|
|
465
465
|
};
|
|
466
|
-
}, [r,
|
|
466
|
+
}, [r, n]);
|
|
467
467
|
}
|
|
468
468
|
function Be(r) {
|
|
469
469
|
return f(() => ({
|
|
470
470
|
checked: r.value ?? !1,
|
|
471
471
|
disabled: r.disabled,
|
|
472
472
|
onBlur: r.touchedChange,
|
|
473
|
-
onChange: (
|
|
473
|
+
onChange: (n) => r.valueChange(n.target.checked)
|
|
474
474
|
}), [r]);
|
|
475
475
|
}
|
|
476
476
|
function qe(r) {
|
|
@@ -478,56 +478,56 @@ function qe(r) {
|
|
|
478
478
|
value: r.value == null ? "" : r.value,
|
|
479
479
|
disabled: r.disabled,
|
|
480
480
|
onBlur: r.touchedChange,
|
|
481
|
-
onInput: (
|
|
482
|
-
const
|
|
483
|
-
r.valueChange(
|
|
481
|
+
onInput: (n) => {
|
|
482
|
+
const t = n.target.value;
|
|
483
|
+
r.valueChange(t == "" ? void 0 : parseFloat(t));
|
|
484
484
|
}
|
|
485
485
|
}), [r]);
|
|
486
486
|
}
|
|
487
|
-
function Je(r,
|
|
487
|
+
function Je(r, n) {
|
|
488
488
|
return f(() => ({
|
|
489
|
-
value:
|
|
490
|
-
checked: Object.is(r.value,
|
|
489
|
+
value: n,
|
|
490
|
+
checked: Object.is(r.value, n),
|
|
491
491
|
disabled: r.disabled,
|
|
492
492
|
onBlur: r.touchedChange,
|
|
493
|
-
onChange: () => r.valueChange(
|
|
493
|
+
onChange: () => r.valueChange(n)
|
|
494
494
|
}), [r]);
|
|
495
495
|
}
|
|
496
496
|
function ze(r) {
|
|
497
497
|
return f(() => {
|
|
498
|
-
const
|
|
499
|
-
const u =
|
|
498
|
+
const n = (t) => {
|
|
499
|
+
const u = t.target.value;
|
|
500
500
|
r.valueChange(u == "" ? void 0 : parseFloat(u));
|
|
501
501
|
};
|
|
502
502
|
return {
|
|
503
503
|
value: r.value == null ? "" : r.value,
|
|
504
504
|
disabled: r.disabled,
|
|
505
505
|
onBlur: r.touchedChange,
|
|
506
|
-
onInput:
|
|
507
|
-
onChange:
|
|
506
|
+
onInput: n,
|
|
507
|
+
onChange: n
|
|
508
508
|
};
|
|
509
509
|
}, [r]);
|
|
510
510
|
}
|
|
511
|
-
function He(r,
|
|
511
|
+
function He(r, n = !1) {
|
|
512
512
|
return f(() => ({
|
|
513
513
|
value: r.value,
|
|
514
514
|
disabled: r.disabled,
|
|
515
515
|
onBlur: r.touchedChange,
|
|
516
|
-
onChange: (
|
|
517
|
-
const u = [], o =
|
|
516
|
+
onChange: (t) => {
|
|
517
|
+
const u = [], o = t.target;
|
|
518
518
|
if (o.selectedOptions !== void 0)
|
|
519
519
|
for (let l = 0; l < o.selectedOptions.length; l++) {
|
|
520
520
|
const c = o.selectedOptions[l];
|
|
521
|
-
if (u.push(c.value), !
|
|
521
|
+
if (u.push(c.value), !n)
|
|
522
522
|
break;
|
|
523
523
|
}
|
|
524
524
|
else
|
|
525
525
|
for (let l = 0; l < o.options.length; l++) {
|
|
526
526
|
const c = o.options[l];
|
|
527
|
-
if (c.selected && (u.push(c.value), !
|
|
527
|
+
if (c.selected && (u.push(c.value), !n))
|
|
528
528
|
break;
|
|
529
529
|
}
|
|
530
|
-
r.valueChange(
|
|
530
|
+
r.valueChange(n ? u : u[0]);
|
|
531
531
|
}
|
|
532
532
|
}), [r]);
|
|
533
533
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@piying/view-react",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.3",
|
|
4
4
|
"description": "Piying view For React;Valibot to Component",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"homepage": "https://piying-org.github.io/website/docs/client/intro",
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
],
|
|
35
35
|
"license": "MIT",
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@piying/view-core": "^1.3.
|
|
37
|
+
"@piying/view-core": "^1.3.3",
|
|
38
38
|
"fast-equals": "^5.2.2",
|
|
39
39
|
"static-injector": "^6.1.2",
|
|
40
40
|
"valibot": "^1.1.0"
|