@piying/view-react 1.3.3 → 1.4.1
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/index.cjs +4 -4
- package/index.js +133 -145
- package/package.json +6 -7
- package/util/index.d.ts +0 -1
- package/util/init-listen.d.ts +0 -3
package/index.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("react"),T=require("static-injector"),k=require("@piying/view-core");require("valibot");var A={exports:{}},x={};/**
|
|
2
2
|
* @license React
|
|
3
3
|
* react-jsx-runtime.production.js
|
|
4
4
|
*
|
|
@@ -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
|
|
9
|
+
*/var H;function me(){if(H)return x;H=1;var r=Symbol.for("react.transitional.element"),n=Symbol.for("react.fragment");function t(l,o,a){var i=null;if(a!==void 0&&(i=""+a),o.key!==void 0&&(i=""+o.key),"key"in o){a={};for(var g in o)g!=="key"&&(a[g]=o[g])}else a=o;return o=a.ref,{$$typeof:r,type:l,key:i,ref:o!==void 0?o:null,props:a}}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
|
|
17
|
+
*/var X;function be(){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===ie?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case w:return"Fragment";case te:return"Profiler";case re:return"StrictMode";case se:return"Suspense";case le:return"SuspenseList";case ce: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 oe:return(e.displayName||"Context")+".Provider";case ne:return(e._context.displayName||"Context")+".Consumer";case ue:var u=e.render;return e=e.displayName,e||(e=u.displayName||u.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case ae:return u=e.displayName||null,u!==null?u:r(e.type)||"Memo";case $:u=e._payload,e=e._init;try{return r(e(u))}catch{}}return null}function n(e){return""+e}function t(e){try{n(e);var u=!1}catch{u=!0}if(u){u=console;var c=u.error,b=typeof Symbol=="function"&&Symbol.toStringTag&&e[Symbol.toStringTag]||e.constructor.name||"Object";return c.call(u,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",b),n(e)}}function l(e){if(e===w)return"<>";if(typeof e=="object"&&e!==null&&e.$$typeof===$)return"<...>";try{var u=r(e);return u?"<"+u+">":"<...>"}catch{return"<...>"}}function o(){var e=I.A;return e===null?null:e.getOwner()}function a(){return Error("react-stack-top-frame")}function i(e){if(W.call(e,"key")){var u=Object.getOwnPropertyDescriptor(e,"key").get;if(u&&u.isReactWarning)return!1}return e.key!==void 0}function g(e,u){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)",u))}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 v(e,u,c,b,_,R,N,F){return c=R.ref,e={$$typeof:y,type:e,key:u,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 O(e,u,c,b,_,R,N,F){var h=u.children;if(h!==void 0)if(b)if(de(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(u,"key")){h=r(e);var C=Object.keys(u).filter(function(fe){return fe!=="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&&(t(c),h=""+c),i(
|
|
22
|
+
<%s key={someKey} {...props} />`,b,h,C,h),z[h+b]=!0)}if(h=null,c!==void 0&&(t(c),h=""+c),i(u)&&(t(u.key),h=""+u.key),"key"in u){c={};for(var Y in u)Y!=="key"&&(c[Y]=u[Y])}else c=u;return h&&g(c,typeof e=="function"?e.displayName||e.name||"Unknown":e),v(e,h,R,_,o(),c,N,F)}function j(e){typeof e=="object"&&e!==null&&e.$$typeof===y&&e._store&&(e._store.validated=1)}var E=s,y=Symbol.for("react.transitional.element"),m=Symbol.for("react.portal"),w=Symbol.for("react.fragment"),re=Symbol.for("react.strict_mode"),te=Symbol.for("react.profiler"),ne=Symbol.for("react.consumer"),oe=Symbol.for("react.context"),ue=Symbol.for("react.forward_ref"),se=Symbol.for("react.suspense"),le=Symbol.for("react.suspense_list"),ae=Symbol.for("react.memo"),$=Symbol.for("react.lazy"),ce=Symbol.for("react.activity"),ie=Symbol.for("react.client.reference"),I=E.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,W=Object.prototype.hasOwnProperty,de=Array.isArray,M=console.createTask?console.createTask:function(){return null};E={react_stack_bottom_frame:function(e){return e()}};var q,U={},B=E.react_stack_bottom_frame.bind(E,a)(),J=M(l(a)),z={};S.Fragment=w,S.jsx=function(e,u,c,b,_){var R=1e4>I.recentlyCreatedOwnerStacks++;return O(e,u,c,!1,b,_,R?Error("react-stack-top-frame"):B,R?M(l(e)):J)},S.jsxs=function(e,u,c,b,_){var R=1e4>I.recentlyCreatedOwnerStacks++;return O(e,u,c,!0,b,_,R?Error("react-stack-top-frame"):B,R?M(l(e)):J)}}()),S}var Z;function he(){return Z||(Z=1,process.env.NODE_ENV==="production"?A.exports=me():A.exports=be()),A.exports}var f=he();const V=s.createContext(void 0),P=s.createContext(void 0);function p(r,n){const t=s.useContext(P),[l,o]=s.useState(s.useMemo(()=>n(r),[])),a=s.useRef(l);return s.useEffect(()=>{const i=n(r);Object.is(a.current,i)||(o(i),a.current=i);const g=T.effect(()=>{const d=n(r);Object.is(a.current,d)||(o(d),a.current=d)},{injector:t});return()=>{g.destroy()}},[r,s.useMemo(()=>n,[])]),l}function G(r){const n=s.useMemo(()=>r.wrappers.slice(1),[r.wrappers]),t=r.wrappers[0],l=p(t,()=>({...t?.inputs(),...t?.attributes(),...t?.outputs}));return f.jsx(f.Fragment,{children:t?f.jsx(t.type,{...l,children:f.jsx(G,{wrappers:n,children:r.children})}):r.children})}const Q=Symbol.for("ControlValueAccessor");function L(r){const n=p(r.field,m=>m.inputs()),t=p(r.field,m=>m.outputs()),l=p(r.field,m=>m.attributes()),o=s.useMemo(()=>({...l,...n,...t}),[l,n,t]),a=p(r.field,m=>m.renderConfig()),i=p(r.field,m=>m.children?.()),g=p(r.field,m=>m.wrappers()),d=r.field.form.control,v=r.field.define?.type,O=s.useMemo(()=>!!a.hidden||!v,[a.hidden,v]),j=s.useContext(P),E=s.useRef(void 0),y=s.useMemo(()=>({...o,[Q]:E}),[o,E]);return s.useEffect(()=>{let m;return E.current&&(m=k.createViewControlLink(()=>d,E.current,j)),()=>{m?.(),m=void 0}},[E.current,d,j]),f.jsx(f.Fragment,{children:f.jsx(V,{value:r.field,children:O?void 0:f.jsx(G,{wrappers:g,children:i?f.jsx(v,{...o}):r.field.form.control?f.jsx(v,{...y}):f.jsx(v,{...o})})})})}function ge(){const[r,n]=s.useState(void 0),[t,l]=s.useState(!1),o=s.useRef(void 0),a=s.useRef(void 0),i=s.useMemo(()=>({writeValue(d){n(d)},registerOnChange(d){o.current=d},registerOnTouched(d){a.current=d},setDisabledState(d){l(d)}}),[]),g=s.useMemo(()=>({value:r,disabled:t,valueChange:d=>{o.current?.(d),n(d)},touchedChange:()=>{a.current?.()}}),[r,t]);return s.useMemo(()=>({cva:i,cvaa:g}),[g])}function D(r,n){const t=s.useCallback(r,n),l=s.useRef(void 0);s.useMemo(()=>(l.current=t(),l.current),n),s.useEffect(()=>()=>{l.current?.(),l.current=void 0},[])}function Ee(){const r=s.useContext(V),n=p(r,t=>t?.children());return f.jsx(f.Fragment,{children:n.map((t,l)=>f.jsx(L,{field:t},l))})}class K extends k.CoreSchemaHandle{}class ee extends k.FormBuilder{}function Re(r){const n=s.useMemo(()=>T.createRootInjector({providers:[{provide:T.ChangeDetectionScheduler,useClass:T.ChangeDetectionSchedulerImpl}]}),[]),[t,l]=s.useMemo(()=>{const o=T.createInjector({providers:[],parent:n});return[k.convert(r.schema,{handle:K,builder:ee,injector:o,registerOnDestroy:i=>{o.get(T.DestroyRef).onDestroy(i)},...r.options}),o]},[r.schema,r.options]);return D(()=>{let o;if(t.form.control){const a=r.model;o=k.initListen(typeof a<"u"?a:void 0,t.form.control,l,i=>{T.untracked(()=>{t.form.control?.valueNoError$$()&&r.modelChange?.(i)})})}return()=>{l.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(L,{field:t})})})}const pe=[],_e={directives:"merge",formConfig:"merge",inputs:"merge",outputs:"merge",props:"merge",renderConfig:"merge",wrappers:"replace"};function ve(r,n){const t=s.useRef(!1);return s.useMemo(()=>{const l={value:r.value==null?"":r.value,disabled:r.disabled,onBlur:r.touchedChange};return n?{...l,onCompositionStart:()=>{t.current=!0},onCompositionEnd:o=>{t.current=!1,r.valueChange(o.target.value)}}:{...l,onInput:o=>r.valueChange(o.target.value)}},[r,n])}function Te(r){return s.useMemo(()=>({checked:r.value??!1,disabled:r.disabled,onBlur:r.touchedChange,onChange:n=>r.valueChange(n.target.checked)}),[r])}function Ce(r){return s.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 je(r,n){return s.useMemo(()=>({value:n,checked:Object.is(r.value,n),disabled:r.disabled,onBlur:r.touchedChange,onChange:()=>r.valueChange(n)}),[r])}function xe(r){return s.useMemo(()=>{const n=t=>{const l=t.target.value;r.valueChange(l==""?void 0:parseFloat(l))};return{value:r.value==null?"":r.value,disabled:r.disabled,onBlur:r.touchedChange,onInput:n,onChange:n}},[r])}function Se(r,n=!1){return s.useMemo(()=>({value:r.value,disabled:r.disabled,onBlur:r.touchedChange,onChange:t=>{const l=[],o=t.target;if(o.selectedOptions!==void 0)for(let a=0;a<o.selectedOptions.length;a++){const i=o.selectedOptions[a];if(l.push(i.value),!n)break}else for(let a=0;a<o.options.length;a++){const i=o.options[a];if(i.selected&&(l.push(i.value),!n))break}r.valueChange(n?l:l[0])}}),[r])}exports.CVA=Q;exports.EMPTY_ARRAY=pe;exports.InjectorToken=P;exports.NG_CONFIG_DEFAULT_MERGE_STRAGEGY=_e;exports.PI_VIEW_FIELD_TOKEN=V;exports.PiyingFieldTemplate=L;exports.PiyingGroup=Ee;exports.PiyingView=Re;exports.PiyingWrapper=G;exports.ReactFormBuilder=ee;exports.ReactSchemaHandle=K;exports.useControlValueAccessor=ge;exports.useEffectSync=D;exports.useInputCheckboxModel=Te;exports.useInputNumberModel=Ce;exports.useInputRadioModel=je;exports.useInputRangeModel=xe;exports.useInputTextModel=ve;exports.useSelectModel=Se;exports.useSignalToRef=p;
|
package/index.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { effect as
|
|
3
|
-
import { createViewControlLink as Te, CoreSchemaHandle as Ce, FormBuilder as je, convert as xe } from "@piying/view-core";
|
|
4
|
-
import { deepEqual as ke } from "fast-equals";
|
|
1
|
+
import me, { createContext as Z, useContext as D, useState as Y, useMemo as f, useRef as C, useEffect as M, useCallback as he } from "react";
|
|
2
|
+
import { effect as be, createRootInjector as ge, ChangeDetectionSchedulerImpl as Ee, ChangeDetectionScheduler as pe, createInjector as Re, DestroyRef as ve, untracked as _e } from "static-injector";
|
|
3
|
+
import { createViewControlLink as Te, CoreSchemaHandle as Ce, FormBuilder as je, convert as xe, initListen as ke } from "@piying/view-core";
|
|
5
4
|
import "valibot";
|
|
6
5
|
var w = { exports: {} }, x = {};
|
|
7
6
|
/**
|
|
@@ -18,7 +17,7 @@ function Oe() {
|
|
|
18
17
|
if (J) return x;
|
|
19
18
|
J = 1;
|
|
20
19
|
var r = Symbol.for("react.transitional.element"), n = Symbol.for("react.fragment");
|
|
21
|
-
function t(
|
|
20
|
+
function t(s, o, l) {
|
|
22
21
|
var c = null;
|
|
23
22
|
if (l !== void 0 && (c = "" + l), o.key !== void 0 && (c = "" + o.key), "key" in o) {
|
|
24
23
|
l = {};
|
|
@@ -27,7 +26,7 @@ function Oe() {
|
|
|
27
26
|
} else l = o;
|
|
28
27
|
return o = l.ref, {
|
|
29
28
|
$$typeof: r,
|
|
30
|
-
type:
|
|
29
|
+
type: s,
|
|
31
30
|
key: c,
|
|
32
31
|
ref: o !== void 0 ? o : null,
|
|
33
32
|
props: l
|
|
@@ -51,20 +50,20 @@ function Se() {
|
|
|
51
50
|
function r(e) {
|
|
52
51
|
if (e == null) return null;
|
|
53
52
|
if (typeof e == "function")
|
|
54
|
-
return e.$$typeof ===
|
|
53
|
+
return e.$$typeof === ie ? null : e.displayName || e.name || null;
|
|
55
54
|
if (typeof e == "string") return e;
|
|
56
55
|
switch (e) {
|
|
57
56
|
case A:
|
|
58
57
|
return "Fragment";
|
|
59
|
-
case ne:
|
|
60
|
-
return "Profiler";
|
|
61
58
|
case te:
|
|
59
|
+
return "Profiler";
|
|
60
|
+
case re:
|
|
62
61
|
return "StrictMode";
|
|
63
|
-
case
|
|
62
|
+
case se:
|
|
64
63
|
return "Suspense";
|
|
65
|
-
case
|
|
64
|
+
case le:
|
|
66
65
|
return "SuspenseList";
|
|
67
|
-
case
|
|
66
|
+
case ce:
|
|
68
67
|
return "Activity";
|
|
69
68
|
}
|
|
70
69
|
if (typeof e == "object")
|
|
@@ -73,19 +72,19 @@ function Se() {
|
|
|
73
72
|
), e.$$typeof) {
|
|
74
73
|
case m:
|
|
75
74
|
return "Portal";
|
|
76
|
-
case ue:
|
|
77
|
-
return (e.displayName || "Context") + ".Provider";
|
|
78
75
|
case oe:
|
|
76
|
+
return (e.displayName || "Context") + ".Provider";
|
|
77
|
+
case ne:
|
|
79
78
|
return (e._context.displayName || "Context") + ".Consumer";
|
|
80
|
-
case
|
|
81
|
-
var
|
|
82
|
-
return e = e.displayName, e || (e =
|
|
83
|
-
case
|
|
84
|
-
return
|
|
79
|
+
case ue:
|
|
80
|
+
var u = e.render;
|
|
81
|
+
return e = e.displayName, e || (e = u.displayName || u.name || "", e = e !== "" ? "ForwardRef(" + e + ")" : "ForwardRef"), e;
|
|
82
|
+
case ae:
|
|
83
|
+
return u = e.displayName || null, u !== null ? u : r(e.type) || "Memo";
|
|
85
84
|
case $:
|
|
86
|
-
|
|
85
|
+
u = e._payload, e = e._init;
|
|
87
86
|
try {
|
|
88
|
-
return r(e(
|
|
87
|
+
return r(e(u));
|
|
89
88
|
} catch {
|
|
90
89
|
}
|
|
91
90
|
}
|
|
@@ -97,27 +96,27 @@ function Se() {
|
|
|
97
96
|
function t(e) {
|
|
98
97
|
try {
|
|
99
98
|
n(e);
|
|
100
|
-
var
|
|
99
|
+
var u = !1;
|
|
101
100
|
} catch {
|
|
102
|
-
|
|
101
|
+
u = !0;
|
|
103
102
|
}
|
|
104
|
-
if (
|
|
105
|
-
|
|
106
|
-
var a =
|
|
103
|
+
if (u) {
|
|
104
|
+
u = console;
|
|
105
|
+
var a = u.error, h = typeof Symbol == "function" && Symbol.toStringTag && e[Symbol.toStringTag] || e.constructor.name || "Object";
|
|
107
106
|
return a.call(
|
|
108
|
-
|
|
107
|
+
u,
|
|
109
108
|
"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
|
|
110
109
|
h
|
|
111
110
|
), n(e);
|
|
112
111
|
}
|
|
113
112
|
}
|
|
114
|
-
function
|
|
113
|
+
function s(e) {
|
|
115
114
|
if (e === A) return "<>";
|
|
116
115
|
if (typeof e == "object" && e !== null && e.$$typeof === $)
|
|
117
116
|
return "<...>";
|
|
118
117
|
try {
|
|
119
|
-
var
|
|
120
|
-
return
|
|
118
|
+
var u = r(e);
|
|
119
|
+
return u ? "<" + u + ">" : "<...>";
|
|
121
120
|
} catch {
|
|
122
121
|
return "<...>";
|
|
123
122
|
}
|
|
@@ -131,16 +130,16 @@ function Se() {
|
|
|
131
130
|
}
|
|
132
131
|
function c(e) {
|
|
133
132
|
if (L.call(e, "key")) {
|
|
134
|
-
var
|
|
135
|
-
if (
|
|
133
|
+
var u = Object.getOwnPropertyDescriptor(e, "key").get;
|
|
134
|
+
if (u && u.isReactWarning) return !1;
|
|
136
135
|
}
|
|
137
136
|
return e.key !== void 0;
|
|
138
137
|
}
|
|
139
|
-
function g(e,
|
|
138
|
+
function g(e, u) {
|
|
140
139
|
function a() {
|
|
141
140
|
W || (W = !0, console.error(
|
|
142
141
|
"%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)",
|
|
143
|
-
|
|
142
|
+
u
|
|
144
143
|
));
|
|
145
144
|
}
|
|
146
145
|
a.isReactWarning = !0, Object.defineProperty(e, "key", {
|
|
@@ -154,12 +153,12 @@ function Se() {
|
|
|
154
153
|
"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."
|
|
155
154
|
)), e = this.props.ref, e !== void 0 ? e : null;
|
|
156
155
|
}
|
|
157
|
-
function _(e,
|
|
158
|
-
return a =
|
|
156
|
+
function _(e, u, a, h, R, p, I, N) {
|
|
157
|
+
return a = p.ref, e = {
|
|
159
158
|
$$typeof: S,
|
|
160
159
|
type: e,
|
|
161
|
-
key:
|
|
162
|
-
props:
|
|
160
|
+
key: u,
|
|
161
|
+
props: p,
|
|
163
162
|
_owner: R
|
|
164
163
|
}, (a !== void 0 ? a : null) !== null ? Object.defineProperty(e, "ref", {
|
|
165
164
|
enumerable: !1,
|
|
@@ -186,11 +185,11 @@ function Se() {
|
|
|
186
185
|
value: N
|
|
187
186
|
}), Object.freeze && (Object.freeze(e.props), Object.freeze(e)), e;
|
|
188
187
|
}
|
|
189
|
-
function O(e,
|
|
190
|
-
var b =
|
|
188
|
+
function O(e, u, a, h, R, p, I, N) {
|
|
189
|
+
var b = u.children;
|
|
191
190
|
if (b !== void 0)
|
|
192
191
|
if (h)
|
|
193
|
-
if (
|
|
192
|
+
if (de(b)) {
|
|
194
193
|
for (h = 0; h < b.length; h++)
|
|
195
194
|
j(b[h]);
|
|
196
195
|
Object.freeze && Object.freeze(b);
|
|
@@ -199,10 +198,10 @@ function Se() {
|
|
|
199
198
|
"React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead."
|
|
200
199
|
);
|
|
201
200
|
else j(b);
|
|
202
|
-
if (L.call(
|
|
201
|
+
if (L.call(u, "key")) {
|
|
203
202
|
b = r(e);
|
|
204
|
-
var T = Object.keys(
|
|
205
|
-
return
|
|
203
|
+
var T = Object.keys(u).filter(function(fe) {
|
|
204
|
+
return fe !== "key";
|
|
206
205
|
});
|
|
207
206
|
h = 0 < T.length ? "{key: someKey, " + T.join(": ..., ") + ": ...}" : "{key: someKey}", q[b + h] || (T = 0 < T.length ? "{" + T.join(": ..., ") + ": ...}" : "{}", console.error(
|
|
208
207
|
`A props object containing a "key" prop is being spread into JSX:
|
|
@@ -217,18 +216,18 @@ React keys must be passed directly to JSX without using spread:
|
|
|
217
216
|
b
|
|
218
217
|
), q[b + h] = !0);
|
|
219
218
|
}
|
|
220
|
-
if (b = null, a !== void 0 && (t(a), b = "" + a), c(
|
|
219
|
+
if (b = null, a !== void 0 && (t(a), b = "" + a), c(u) && (t(u.key), b = "" + u.key), "key" in u) {
|
|
221
220
|
a = {};
|
|
222
|
-
for (var F in
|
|
223
|
-
F !== "key" && (a[F] =
|
|
224
|
-
} else a =
|
|
221
|
+
for (var F in u)
|
|
222
|
+
F !== "key" && (a[F] = u[F]);
|
|
223
|
+
} else a = u;
|
|
225
224
|
return b && g(
|
|
226
225
|
a,
|
|
227
226
|
typeof e == "function" ? e.displayName || e.name || "Unknown" : e
|
|
228
227
|
), _(
|
|
229
228
|
e,
|
|
230
229
|
b,
|
|
231
|
-
|
|
230
|
+
p,
|
|
232
231
|
R,
|
|
233
232
|
o(),
|
|
234
233
|
a,
|
|
@@ -239,41 +238,41 @@ React keys must be passed directly to JSX without using spread:
|
|
|
239
238
|
function j(e) {
|
|
240
239
|
typeof e == "object" && e !== null && e.$$typeof === S && e._store && (e._store.validated = 1);
|
|
241
240
|
}
|
|
242
|
-
var
|
|
241
|
+
var E = me, S = Symbol.for("react.transitional.element"), m = Symbol.for("react.portal"), A = Symbol.for("react.fragment"), re = Symbol.for("react.strict_mode"), te = Symbol.for("react.profiler"), ne = Symbol.for("react.consumer"), oe = Symbol.for("react.context"), ue = Symbol.for("react.forward_ref"), se = Symbol.for("react.suspense"), le = Symbol.for("react.suspense_list"), ae = Symbol.for("react.memo"), $ = Symbol.for("react.lazy"), ce = Symbol.for("react.activity"), ie = Symbol.for("react.client.reference"), y = E.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, L = Object.prototype.hasOwnProperty, de = Array.isArray, P = console.createTask ? console.createTask : function() {
|
|
243
242
|
return null;
|
|
244
243
|
};
|
|
245
|
-
|
|
244
|
+
E = {
|
|
246
245
|
react_stack_bottom_frame: function(e) {
|
|
247
246
|
return e();
|
|
248
247
|
}
|
|
249
248
|
};
|
|
250
|
-
var W, G = {}, U =
|
|
251
|
-
|
|
249
|
+
var W, G = {}, U = E.react_stack_bottom_frame.bind(
|
|
250
|
+
E,
|
|
252
251
|
l
|
|
253
|
-
)(), B = P(
|
|
254
|
-
k.Fragment = A, k.jsx = function(e,
|
|
255
|
-
var
|
|
252
|
+
)(), B = P(s(l)), q = {};
|
|
253
|
+
k.Fragment = A, k.jsx = function(e, u, a, h, R) {
|
|
254
|
+
var p = 1e4 > y.recentlyCreatedOwnerStacks++;
|
|
256
255
|
return O(
|
|
257
256
|
e,
|
|
258
|
-
|
|
257
|
+
u,
|
|
259
258
|
a,
|
|
260
259
|
!1,
|
|
261
260
|
h,
|
|
262
261
|
R,
|
|
263
|
-
|
|
264
|
-
|
|
262
|
+
p ? Error("react-stack-top-frame") : U,
|
|
263
|
+
p ? P(s(e)) : B
|
|
265
264
|
);
|
|
266
|
-
}, k.jsxs = function(e,
|
|
267
|
-
var
|
|
265
|
+
}, k.jsxs = function(e, u, a, h, R) {
|
|
266
|
+
var p = 1e4 > y.recentlyCreatedOwnerStacks++;
|
|
268
267
|
return O(
|
|
269
268
|
e,
|
|
270
|
-
|
|
269
|
+
u,
|
|
271
270
|
a,
|
|
272
271
|
!0,
|
|
273
272
|
h,
|
|
274
273
|
R,
|
|
275
|
-
|
|
276
|
-
|
|
274
|
+
p ? Error("react-stack-top-frame") : U,
|
|
275
|
+
p ? P(s(e)) : B
|
|
277
276
|
);
|
|
278
277
|
};
|
|
279
278
|
}()), k;
|
|
@@ -283,13 +282,13 @@ function we() {
|
|
|
283
282
|
return H || (H = 1, process.env.NODE_ENV === "production" ? w.exports = Oe() : w.exports = Se()), w.exports;
|
|
284
283
|
}
|
|
285
284
|
var d = we();
|
|
286
|
-
const
|
|
285
|
+
const Q = Z(void 0), V = Z(void 0);
|
|
287
286
|
function v(r, n) {
|
|
288
|
-
const t = D(V), [
|
|
287
|
+
const t = D(V), [s, o] = Y(f(() => n(r), [])), l = C(s);
|
|
289
288
|
return M(() => {
|
|
290
289
|
const c = n(r);
|
|
291
290
|
Object.is(l.current, c) || (o(c), l.current = c);
|
|
292
|
-
const g =
|
|
291
|
+
const g = be(
|
|
293
292
|
() => {
|
|
294
293
|
const i = n(r);
|
|
295
294
|
Object.is(l.current, i) || (o(i), l.current = i);
|
|
@@ -299,57 +298,47 @@ function v(r, n) {
|
|
|
299
298
|
return () => {
|
|
300
299
|
g.destroy();
|
|
301
300
|
};
|
|
302
|
-
}, [r, f(() => n, [])]),
|
|
301
|
+
}, [r, f(() => n, [])]), s;
|
|
303
302
|
}
|
|
304
|
-
function
|
|
303
|
+
function K(r) {
|
|
305
304
|
const n = f(
|
|
306
305
|
() => r.wrappers.slice(1),
|
|
307
306
|
[r.wrappers]
|
|
308
|
-
), t = r.wrappers[0],
|
|
307
|
+
), t = r.wrappers[0], s = v(t, () => ({
|
|
309
308
|
...t?.inputs(),
|
|
310
309
|
...t?.attributes(),
|
|
311
310
|
...t?.outputs
|
|
312
311
|
}));
|
|
313
|
-
return /* @__PURE__ */ d.jsx(d.Fragment, { children: t ? /* @__PURE__ */ d.jsx(t.type, { ...
|
|
312
|
+
return /* @__PURE__ */ d.jsx(d.Fragment, { children: t ? /* @__PURE__ */ d.jsx(t.type, { ...s, children: /* @__PURE__ */ d.jsx(K, { wrappers: n, children: r.children }) }) : r.children });
|
|
314
313
|
}
|
|
315
314
|
const Ae = Symbol.for("ControlValueAccessor");
|
|
316
|
-
function
|
|
317
|
-
const n = v(r.field, (m) => m.inputs()), t = v(r.field, (m) => m.outputs()),
|
|
318
|
-
() => ({ ...
|
|
319
|
-
[
|
|
315
|
+
function ee(r) {
|
|
316
|
+
const n = v(r.field, (m) => m.inputs()), t = v(r.field, (m) => m.outputs()), s = v(r.field, (m) => m.attributes()), o = f(
|
|
317
|
+
() => ({ ...s, ...n, ...t }),
|
|
318
|
+
[s, n, t]
|
|
320
319
|
), l = v(
|
|
321
320
|
r.field,
|
|
322
321
|
(m) => m.renderConfig()
|
|
323
322
|
), c = v(
|
|
324
323
|
r.field,
|
|
325
324
|
(m) => m.children?.()
|
|
326
|
-
), g = v(r.field, (m) => m.wrappers()), i = r.field.form.control, _ = r.field.define?.type, O = f(() => !!l.hidden || !_, [l.hidden, _]), j = D(V),
|
|
327
|
-
() => ({ ...o, [Ae]:
|
|
328
|
-
[o,
|
|
325
|
+
), g = v(r.field, (m) => m.wrappers()), i = r.field.form.control, _ = r.field.define?.type, O = f(() => !!l.hidden || !_, [l.hidden, _]), j = D(V), E = C(void 0), S = f(
|
|
326
|
+
() => ({ ...o, [Ae]: E }),
|
|
327
|
+
[o, E]
|
|
329
328
|
);
|
|
330
329
|
return M(() => {
|
|
331
330
|
let m;
|
|
332
|
-
return
|
|
331
|
+
return E.current && (m = Te(
|
|
333
332
|
() => i,
|
|
334
|
-
|
|
333
|
+
E.current,
|
|
335
334
|
j
|
|
336
335
|
)), () => {
|
|
337
336
|
m?.(), m = void 0;
|
|
338
337
|
};
|
|
339
|
-
}, [
|
|
340
|
-
}
|
|
341
|
-
function ye(r, n, t, u) {
|
|
342
|
-
let o = !0;
|
|
343
|
-
return Q(
|
|
344
|
-
() => {
|
|
345
|
-
const l = n.value$$();
|
|
346
|
-
o ? (ke(l, r) || u(l), o = !1) : u(l);
|
|
347
|
-
},
|
|
348
|
-
{ injector: t }
|
|
349
|
-
);
|
|
338
|
+
}, [E.current, i, j]), /* @__PURE__ */ d.jsx(d.Fragment, { children: /* @__PURE__ */ d.jsx(Q, { value: r.field, children: O ? void 0 : /* @__PURE__ */ d.jsx(K, { wrappers: g, children: c ? /* @__PURE__ */ d.jsx(_, { ...o }) : r.field.form.control ? /* @__PURE__ */ d.jsx(_, { ...S }) : /* @__PURE__ */ d.jsx(_, { ...o }) }) }) });
|
|
350
339
|
}
|
|
351
|
-
function
|
|
352
|
-
const [r, n] = Y(void 0), [t,
|
|
340
|
+
function De() {
|
|
341
|
+
const [r, n] = Y(void 0), [t, s] = Y(!1), o = C(void 0), l = C(void 0), c = f(() => ({
|
|
353
342
|
writeValue(i) {
|
|
354
343
|
n(i);
|
|
355
344
|
},
|
|
@@ -360,7 +349,7 @@ function Ve() {
|
|
|
360
349
|
l.current = i;
|
|
361
350
|
},
|
|
362
351
|
setDisabledState(i) {
|
|
363
|
-
|
|
352
|
+
s(i);
|
|
364
353
|
}
|
|
365
354
|
}), []), g = f(() => ({
|
|
366
355
|
value: r,
|
|
@@ -378,33 +367,33 @@ function Ve() {
|
|
|
378
367
|
}), [g]);
|
|
379
368
|
}
|
|
380
369
|
function X(r, n) {
|
|
381
|
-
const t =
|
|
382
|
-
f(() => (
|
|
383
|
-
|
|
370
|
+
const t = he(r, n), s = C(void 0);
|
|
371
|
+
f(() => (s.current = t(), s.current), n), M(() => () => {
|
|
372
|
+
s.current?.(), s.current = void 0;
|
|
384
373
|
}, []);
|
|
385
374
|
}
|
|
386
|
-
function
|
|
387
|
-
const r = D(
|
|
388
|
-
return /* @__PURE__ */ d.jsx(d.Fragment, { children: n.map((t,
|
|
375
|
+
function Me() {
|
|
376
|
+
const r = D(Q), n = v(r, (t) => t?.children());
|
|
377
|
+
return /* @__PURE__ */ d.jsx(d.Fragment, { children: n.map((t, s) => /* @__PURE__ */ d.jsx(ee, { field: t }, s)) });
|
|
389
378
|
}
|
|
390
|
-
class
|
|
379
|
+
class ye extends Ce {
|
|
391
380
|
// contents?: any[];
|
|
392
381
|
}
|
|
393
|
-
class
|
|
382
|
+
class Pe extends je {
|
|
394
383
|
}
|
|
395
|
-
function
|
|
384
|
+
function Ve(r) {
|
|
396
385
|
const n = f(() => ge({
|
|
397
386
|
providers: [
|
|
398
387
|
{
|
|
399
|
-
provide:
|
|
400
|
-
useClass:
|
|
388
|
+
provide: pe,
|
|
389
|
+
useClass: Ee
|
|
401
390
|
}
|
|
402
391
|
]
|
|
403
|
-
}), []), [t,
|
|
392
|
+
}), []), [t, s] = f(() => {
|
|
404
393
|
const o = Re({ providers: [], parent: n });
|
|
405
394
|
return [xe(r.schema, {
|
|
406
|
-
handle:
|
|
407
|
-
builder:
|
|
395
|
+
handle: ye,
|
|
396
|
+
builder: Pe,
|
|
408
397
|
injector: o,
|
|
409
398
|
registerOnDestroy: (c) => {
|
|
410
399
|
o.get(ve).onDestroy(c);
|
|
@@ -416,10 +405,10 @@ function Le(r) {
|
|
|
416
405
|
let o;
|
|
417
406
|
if (t.form.control) {
|
|
418
407
|
const l = r.model;
|
|
419
|
-
o =
|
|
408
|
+
o = ke(
|
|
420
409
|
typeof l < "u" ? l : void 0,
|
|
421
410
|
t.form.control,
|
|
422
|
-
|
|
411
|
+
s,
|
|
423
412
|
(c) => {
|
|
424
413
|
_e(() => {
|
|
425
414
|
t.form.control?.valueNoError$$() && r.modelChange?.(c);
|
|
@@ -428,13 +417,13 @@ function Le(r) {
|
|
|
428
417
|
);
|
|
429
418
|
}
|
|
430
419
|
return () => {
|
|
431
|
-
|
|
420
|
+
s.destroy(), o?.destroy();
|
|
432
421
|
};
|
|
433
422
|
}, [t]), X(() => {
|
|
434
423
|
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(
|
|
424
|
+
}, [t, r.model]), /* @__PURE__ */ d.jsx(d.Fragment, { children: /* @__PURE__ */ d.jsx(V, { value: n, children: /* @__PURE__ */ d.jsx(ee, { field: t }) }) });
|
|
436
425
|
}
|
|
437
|
-
const
|
|
426
|
+
const $e = [], Le = {
|
|
438
427
|
directives: "merge",
|
|
439
428
|
formConfig: "merge",
|
|
440
429
|
inputs: "merge",
|
|
@@ -443,16 +432,16 @@ const We = [], Ge = {
|
|
|
443
432
|
renderConfig: "merge",
|
|
444
433
|
wrappers: "replace"
|
|
445
434
|
};
|
|
446
|
-
function
|
|
435
|
+
function We(r, n) {
|
|
447
436
|
const t = C(!1);
|
|
448
437
|
return f(() => {
|
|
449
|
-
const
|
|
438
|
+
const s = {
|
|
450
439
|
value: r.value == null ? "" : r.value,
|
|
451
440
|
disabled: r.disabled,
|
|
452
441
|
onBlur: r.touchedChange
|
|
453
442
|
};
|
|
454
443
|
return n ? {
|
|
455
|
-
...
|
|
444
|
+
...s,
|
|
456
445
|
onCompositionStart: () => {
|
|
457
446
|
t.current = !0;
|
|
458
447
|
},
|
|
@@ -460,12 +449,12 @@ function Ue(r, n) {
|
|
|
460
449
|
t.current = !1, r.valueChange(o.target.value);
|
|
461
450
|
}
|
|
462
451
|
} : {
|
|
463
|
-
...
|
|
452
|
+
...s,
|
|
464
453
|
onInput: (o) => r.valueChange(o.target.value)
|
|
465
454
|
};
|
|
466
455
|
}, [r, n]);
|
|
467
456
|
}
|
|
468
|
-
function
|
|
457
|
+
function Ge(r) {
|
|
469
458
|
return f(() => ({
|
|
470
459
|
checked: r.value ?? !1,
|
|
471
460
|
disabled: r.disabled,
|
|
@@ -473,7 +462,7 @@ function Be(r) {
|
|
|
473
462
|
onChange: (n) => r.valueChange(n.target.checked)
|
|
474
463
|
}), [r]);
|
|
475
464
|
}
|
|
476
|
-
function
|
|
465
|
+
function Ue(r) {
|
|
477
466
|
return f(() => ({
|
|
478
467
|
value: r.value == null ? "" : r.value,
|
|
479
468
|
disabled: r.disabled,
|
|
@@ -484,7 +473,7 @@ function qe(r) {
|
|
|
484
473
|
}
|
|
485
474
|
}), [r]);
|
|
486
475
|
}
|
|
487
|
-
function
|
|
476
|
+
function Be(r, n) {
|
|
488
477
|
return f(() => ({
|
|
489
478
|
value: n,
|
|
490
479
|
checked: Object.is(r.value, n),
|
|
@@ -493,11 +482,11 @@ function Je(r, n) {
|
|
|
493
482
|
onChange: () => r.valueChange(n)
|
|
494
483
|
}), [r]);
|
|
495
484
|
}
|
|
496
|
-
function
|
|
485
|
+
function qe(r) {
|
|
497
486
|
return f(() => {
|
|
498
487
|
const n = (t) => {
|
|
499
|
-
const
|
|
500
|
-
r.valueChange(
|
|
488
|
+
const s = t.target.value;
|
|
489
|
+
r.valueChange(s == "" ? void 0 : parseFloat(s));
|
|
501
490
|
};
|
|
502
491
|
return {
|
|
503
492
|
value: r.value == null ? "" : r.value,
|
|
@@ -508,49 +497,48 @@ function ze(r) {
|
|
|
508
497
|
};
|
|
509
498
|
}, [r]);
|
|
510
499
|
}
|
|
511
|
-
function
|
|
500
|
+
function Je(r, n = !1) {
|
|
512
501
|
return f(() => ({
|
|
513
502
|
value: r.value,
|
|
514
503
|
disabled: r.disabled,
|
|
515
504
|
onBlur: r.touchedChange,
|
|
516
505
|
onChange: (t) => {
|
|
517
|
-
const
|
|
506
|
+
const s = [], o = t.target;
|
|
518
507
|
if (o.selectedOptions !== void 0)
|
|
519
508
|
for (let l = 0; l < o.selectedOptions.length; l++) {
|
|
520
509
|
const c = o.selectedOptions[l];
|
|
521
|
-
if (
|
|
510
|
+
if (s.push(c.value), !n)
|
|
522
511
|
break;
|
|
523
512
|
}
|
|
524
513
|
else
|
|
525
514
|
for (let l = 0; l < o.options.length; l++) {
|
|
526
515
|
const c = o.options[l];
|
|
527
|
-
if (c.selected && (
|
|
516
|
+
if (c.selected && (s.push(c.value), !n))
|
|
528
517
|
break;
|
|
529
518
|
}
|
|
530
|
-
r.valueChange(n ?
|
|
519
|
+
r.valueChange(n ? s : s[0]);
|
|
531
520
|
}
|
|
532
521
|
}), [r]);
|
|
533
522
|
}
|
|
534
523
|
export {
|
|
535
524
|
Ae as CVA,
|
|
536
|
-
|
|
525
|
+
$e as EMPTY_ARRAY,
|
|
537
526
|
V as InjectorToken,
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
Ve as useControlValueAccessor,
|
|
527
|
+
Le as NG_CONFIG_DEFAULT_MERGE_STRAGEGY,
|
|
528
|
+
Q as PI_VIEW_FIELD_TOKEN,
|
|
529
|
+
ee as PiyingFieldTemplate,
|
|
530
|
+
Me as PiyingGroup,
|
|
531
|
+
Ve as PiyingView,
|
|
532
|
+
K as PiyingWrapper,
|
|
533
|
+
Pe as ReactFormBuilder,
|
|
534
|
+
ye as ReactSchemaHandle,
|
|
535
|
+
De as useControlValueAccessor,
|
|
548
536
|
X as useEffectSync,
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
537
|
+
Ge as useInputCheckboxModel,
|
|
538
|
+
Ue as useInputNumberModel,
|
|
539
|
+
Be as useInputRadioModel,
|
|
540
|
+
qe as useInputRangeModel,
|
|
541
|
+
We as useInputTextModel,
|
|
542
|
+
Je as useSelectModel,
|
|
555
543
|
v as useSignalToRef
|
|
556
544
|
};
|
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@piying/view-react",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.4.1",
|
|
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",
|
|
7
7
|
"repository": {
|
|
8
|
-
"url": "https://github.com/piying-org/piying-view",
|
|
8
|
+
"url": "git+https://github.com/piying-org/piying-view.git",
|
|
9
9
|
"directory": "packages/vue",
|
|
10
10
|
"type": "git"
|
|
11
11
|
},
|
|
@@ -34,15 +34,14 @@
|
|
|
34
34
|
],
|
|
35
35
|
"license": "MIT",
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@piying/view-core": "^1.
|
|
38
|
-
"
|
|
39
|
-
"static-injector": "^6.1.2",
|
|
40
|
-
"valibot": "^1.1.0"
|
|
37
|
+
"@piying/view-core": "^1.4.1",
|
|
38
|
+
"static-injector": "^6.1.2"
|
|
41
39
|
},
|
|
42
40
|
"sideEffects": false,
|
|
43
41
|
"peerDependencies": {
|
|
44
42
|
"react": "^19.1.0",
|
|
45
|
-
"react-dom": "^19.1.0"
|
|
43
|
+
"react-dom": "^19.1.0",
|
|
44
|
+
"valibot": "^1.1.0"
|
|
46
45
|
},
|
|
47
46
|
"module": "index.js",
|
|
48
47
|
"typings": "index.d.ts",
|
package/util/index.d.ts
CHANGED
package/util/init-listen.d.ts
DELETED