@piying/view-react 1.0.1 → 1.0.2
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 +159 -159
- package/package.json +2 -2
package/index.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("react"),T=require("static-injector"),P=require("@piying/view-core");require("valibot");const be=require("fast-equals");var
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("react"),T=require("static-injector"),P=require("@piying/view-core");require("valibot");const be=require("fast-equals");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
|
|
9
|
+
*/var X;function ge(){if(X)return x;X=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function o(l,n,a){var i=null;if(a!==void 0&&(i=""+a),n.key!==void 0&&(i=""+n.key),"key"in n){a={};for(var E in n)E!=="key"&&(a[E]=n[E])}else a=n;return n=a.ref,{$$typeof:e,type:l,key:i,ref:n!==void 0?n:null,props:a}}return x.Fragment=t,x.jsx=o,x.jsxs=o,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
|
|
17
|
+
*/var Z;function Ee(){return Z||(Z=1,process.env.NODE_ENV!=="production"&&function(){function e(r){if(r==null)return null;if(typeof r=="function")return r.$$typeof===de?null:r.displayName||r.name||null;if(typeof r=="string")return r;switch(r){case p:return"Fragment";case d:return"Profiler";case M:return"StrictMode";case le:return"Suspense";case ae:return"SuspenseList";case ce:return"Activity"}if(typeof r=="object")switch(typeof r.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),r.$$typeof){case O:return"Portal";case ue:return(r.displayName||"Context")+".Provider";case oe:return(r._context.displayName||"Context")+".Consumer";case se:var u=r.render;return r=r.displayName,r||(r=u.displayName||u.name||"",r=r!==""?"ForwardRef("+r+")":"ForwardRef"),r;case ie:return u=r.displayName||null,u!==null?u:e(r.type)||"Memo";case W:u=r._payload,r=r._init;try{return e(r(u))}catch{}}return null}function t(r){return""+r}function o(r){try{t(r);var u=!1}catch{u=!0}if(u){u=console;var c=u.error,b=typeof Symbol=="function"&&Symbol.toStringTag&&r[Symbol.toStringTag]||r.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),t(r)}}function l(r){if(r===p)return"<>";if(typeof r=="object"&&r!==null&&r.$$typeof===W)return"<...>";try{var u=e(r);return u?"<"+u+">":"<...>"}catch{return"<...>"}}function n(){var r=N.A;return r===null?null:r.getOwner()}function a(){return Error("react-stack-top-frame")}function i(r){if(q.call(r,"key")){var u=Object.getOwnPropertyDescriptor(r,"key").get;if(u&&u.isReactWarning)return!1}return r.key!==void 0}function E(r,u){function c(){U||(U=!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(r,"key",{get:c,configurable:!0})}function m(){var r=e(this.type);return B[r]||(B[r]=!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.")),r=this.props.ref,r!==void 0?r:null}function I(r,u,c,b,_,h,Y,D){return c=h.ref,r={$$typeof:y,type:r,key:u,props:h,_owner:_},(c!==void 0?c:null)!==null?Object.defineProperty(r,"ref",{enumerable:!1,get:m}):Object.defineProperty(r,"ref",{enumerable:!1,value:null}),r._store={},Object.defineProperty(r._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(r,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(r,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:Y}),Object.defineProperty(r,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:D}),Object.freeze&&(Object.freeze(r.props),Object.freeze(r)),r}function k(r,u,c,b,_,h,Y,D){var g=u.children;if(g!==void 0)if(b)if(fe(g)){for(b=0;b<g.length;b++)j(g[b]);Object.freeze&&Object.freeze(g)}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(g);if(q.call(u,"key")){g=e(r);var C=Object.keys(u).filter(function(me){return me!=="key"});b=0<C.length?"{key: someKey, "+C.join(": ..., ")+": ...}":"{key: someKey}",H[g+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,
|
|
22
|
+
<%s key={someKey} {...props} />`,b,g,C,g),H[g+b]=!0)}if(g=null,c!==void 0&&(o(c),g=""+c),i(u)&&(o(u.key),g=""+u.key),"key"in u){c={};for(var V in u)V!=="key"&&(c[V]=u[V])}else c=u;return g&&E(c,typeof r=="function"?r.displayName||r.name||"Unknown":r),I(r,g,h,_,n(),c,Y,D)}function j(r){typeof r=="object"&&r!==null&&r.$$typeof===y&&r._store&&(r._store.validated=1)}var R=s,y=Symbol.for("react.transitional.element"),O=Symbol.for("react.portal"),p=Symbol.for("react.fragment"),M=Symbol.for("react.strict_mode"),d=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"),ie=Symbol.for("react.memo"),W=Symbol.for("react.lazy"),ce=Symbol.for("react.activity"),de=Symbol.for("react.client.reference"),N=R.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,q=Object.prototype.hasOwnProperty,fe=Array.isArray,F=console.createTask?console.createTask:function(){return null};R={"react-stack-bottom-frame":function(r){return r()}};var U,B={},J=R["react-stack-bottom-frame"].bind(R,a)(),z=F(l(a)),H={};S.Fragment=p,S.jsx=function(r,u,c,b,_){var h=1e4>N.recentlyCreatedOwnerStacks++;return k(r,u,c,!1,b,_,h?Error("react-stack-top-frame"):J,h?F(l(r)):z)},S.jsxs=function(r,u,c,b,_){var h=1e4>N.recentlyCreatedOwnerStacks++;return k(r,u,c,!0,b,_,h?Error("react-stack-top-frame"):J,h?F(l(r)):z)}}()),S}var Q;function Re(){return Q||(Q=1,process.env.NODE_ENV==="production"?A.exports=ge():A.exports=Ee()),A.exports}var f=Re();const K=s.createContext(void 0),w=s.createContext(void 0);function v(e,t){const o=s.useContext(w),[l,n]=s.useState(s.useMemo(()=>t(e),[])),a=s.useRef(l);return s.useEffect(()=>{const i=t(e);Object.is(a.current,i)||(n(i),a.current=i);const E=T.effect(()=>{const m=t(e);Object.is(a.current,m)||(n(m),a.current=m)},{injector:o});return()=>{E.destroy()}},[e,s.useMemo(()=>t,[])]),l}function $(e){const t=s.useMemo(()=>e.wrappers.slice(1),[e.wrappers]),o=e.wrappers[0],l=v(o,()=>({...o?.inputs(),...o?.attributes(),...o?.outputs}));return f.jsx(f.Fragment,{children:o?f.jsx(o.type,{...l,children:f.jsx($,{wrappers:t,children:e.children})}):e.children})}const ee=Symbol.for("ControlValueAccessor");function L(e){const t=v(e.field,d=>d.inputs()),o=v(e.field,d=>d.outputs()),l=v(e.field,d=>d.attributes()),n=s.useMemo(()=>({...l,...t,...o}),[l,t,o]),a=v(e.field,d=>d.renderConfig()),i=v(e.field,d=>d.fieldGroup?.()),E=v(e.field,d=>d.fieldArray?.()),m=s.useMemo(()=>({...n,fields:i}),[n,i]),I=s.useMemo(()=>({...n,fields:E}),[n,E]),k=v(e.field,d=>d.wrappers()),j=e.field.form.control,R=e.field.define?.type,y=s.useMemo(()=>!!a.hidden||!R,[a.hidden,R]),O=s.useContext(w),p=s.useRef(void 0),M=s.useMemo(()=>({...n,[ee]:p}),[n,p]);return s.useEffect(()=>{let d;return p.current&&(d=P.createViewControlLink(()=>j,p.current,O)),()=>{d?.(),d=void 0}},[p.current,j,O]),f.jsx(f.Fragment,{children:f.jsx(K,{value:e.field,children:y?void 0:f.jsx($,{wrappers:k,children:i?f.jsx(R,{...m}):E?f.jsx(R,{...I}):e.field.form.control?f.jsx(R,{...M}):f.jsx(R,{...n})})})})}function he(e){return f.jsx(f.Fragment,{children:e.fields.map((t,o)=>f.jsx(L,{field:t},o))})}class re extends P.CoreSchemaHandle{}class te extends P.FormBuilder{}function ne(e,t,o,l){let n=!0;return T.effect(()=>{const a=t.value$$();n?(be.deepEqual(a,e)||l(a),n=!1):l(a)},{injector:o})}function G(e,t){const o=s.useCallback(e,t),l=s.useRef(void 0);s.useMemo(()=>(l.current=o(),l.current),t),s.useEffect(()=>()=>{l.current?.(),l.current=void 0},[])}function pe(e){const t=s.useMemo(()=>T.createRootInjector({providers:[{provide:T.ChangeDetectionScheduler,useClass:T.ChangeDetectionSchedulerImpl}]}),[]),[o,l]=s.useMemo(()=>{const n=T.createInjector({providers:[],parent:t});return[P.convert(e.schema,{handle:re,builder:te,injector:n,registerOnDestroy:i=>{n.get(T.DestroyRef).onDestroy(i)},...e.options}),n]},[e.schema,e.options]);return G(()=>{let n;if(o.form.control){const a=e.model;n=ne(typeof a<"u"?a:void 0,o.form.control,l,i=>{T.untracked(()=>{o.form.control?.valueNoError$$()&&e.modelChange?.(i)})})}return()=>{l.destroy(),n?.destroy()}},[o]),G(()=>{o.form.control?.updateValue(e.model)},[o,e.model]),f.jsx(f.Fragment,{children:f.jsx(w,{value:t,children:f.jsx(L,{field:o})})})}const ve=[],_e={directives:"merge",formConfig:"merge",inputs:"merge",outputs:"merge",props:"merge",renderConfig:"merge",wrappers:"replace"};function Te(e,t){const o=s.useRef(!1);return s.useMemo(()=>{const l={value:e.value==null?"":e.value,disabled:e.disabled,onBlur:e.touchedChange};return t?{...l,onCompositionStart:()=>{o.current=!0},onCompositionEnd:n=>{o.current=!1,e.valueChange(n.target.value)}}:{...l,onInput:n=>e.valueChange(n.target.value)}},[e,t])}function Ce(e){return s.useMemo(()=>({checked:e.value??!1,disabled:e.disabled,onBlur:e.touchedChange,onChange:t=>e.valueChange(t.target.checked)}),[e])}function je(e){return s.useMemo(()=>({value:e.value==null?"":e.value,disabled:e.disabled,onBlur:e.touchedChange,onInput:t=>{const o=t.target.value;e.valueChange(o==""?void 0:parseFloat(o))}}),[e])}function xe(e,t){return s.useMemo(()=>({value:t,checked:Object.is(e.value,t),disabled:e.disabled,onBlur:e.touchedChange,onChange:()=>e.valueChange(t)}),[e])}function Se(e){return s.useMemo(()=>{const t=o=>{const l=o.target.value;e.valueChange(l==""?void 0:parseFloat(l))};return{value:e.value==null?"":e.value,disabled:e.disabled,onBlur:e.touchedChange,onInput:t,onChange:t}},[e])}function ke(e,t=!1){return s.useMemo(()=>({value:e.value,disabled:e.disabled,onBlur:e.touchedChange,onChange:o=>{const l=[],n=o.target;if(n.selectedOptions!==void 0)for(let a=0;a<n.selectedOptions.length;a++){const i=n.selectedOptions[a];if(l.push(i.value),!t)break}else for(let a=0;a<n.options.length;a++){const i=n.options[a];if(i.selected&&(l.push(i.value),!t))break}e.valueChange(t?l:l[0])}}),[e])}function ye(){const[e,t]=s.useState(void 0),[o,l]=s.useState(!1),n=s.useRef(void 0),a=s.useRef(void 0),i=s.useMemo(()=>({writeValue(m){t(m)},registerOnChange(m){n.current=m},registerOnTouched(m){a.current=m},setDisabledState(m){l(m)}}),[]),E=s.useMemo(()=>({value:e,disabled:o,valueChange:m=>{n.current?.(m),t(m)},touchedChange:()=>{a.current?.()}}),[e,o]);return s.useMemo(()=>({cva:i,cvaa:E}),[E])}exports.CVA=ee;exports.EMPTY_ARRAY=ve;exports.InjectorToken=w;exports.NG_CONFIG_DEFAULT_MERGE_STRAGEGY=_e;exports.PI_VIEW_FIELD_TOKEN=K;exports.PiyingFieldTemplate=L;exports.PiyingGroup=he;exports.PiyingView=pe;exports.PiyingWrapper=$;exports.ReactFormBuilder=te;exports.ReactSchemaHandle=re;exports.initListen=ne;exports.useControlValueAccessor=ye;exports.useEffectSync=G;exports.useInputCheckboxModel=Ce;exports.useInputNumberModel=je;exports.useInputRadioModel=xe;exports.useInputRangeModel=Se;exports.useInputTextModel=Te;exports.useSelectModel=ke;exports.useSignalToRef=v;
|
package/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import me, { createContext as
|
|
2
|
-
import { effect as
|
|
1
|
+
import me, { createContext as Q, useContext as K, useState as M, useMemo as c, useRef as C, useEffect as V, useCallback as be } from "react";
|
|
2
|
+
import { effect as ee, createRootInjector as he, ChangeDetectionSchedulerImpl as ge, ChangeDetectionScheduler as pe, createInjector as Ee, DestroyRef as Re, untracked as ve } from "static-injector";
|
|
3
3
|
import { createViewControlLink as _e, CoreSchemaHandle as Te, FormBuilder as Ce, convert as je } from "@piying/view-core";
|
|
4
4
|
import "valibot";
|
|
5
5
|
import { deepEqual as xe } from "fast-equals";
|
|
6
|
-
var
|
|
6
|
+
var A = { exports: {} }, x = {};
|
|
7
7
|
/**
|
|
8
8
|
* @license React
|
|
9
9
|
* react-jsx-runtime.production.js
|
|
@@ -13,29 +13,29 @@ var S = { exports: {} }, k = {};
|
|
|
13
13
|
* This source code is licensed under the MIT license found in the
|
|
14
14
|
* LICENSE file in the root directory of this source tree.
|
|
15
15
|
*/
|
|
16
|
-
var
|
|
16
|
+
var z;
|
|
17
17
|
function ke() {
|
|
18
|
-
if (
|
|
19
|
-
|
|
18
|
+
if (z) return x;
|
|
19
|
+
z = 1;
|
|
20
20
|
var e = Symbol.for("react.transitional.element"), t = Symbol.for("react.fragment");
|
|
21
|
-
function
|
|
22
|
-
var
|
|
23
|
-
if (l !== void 0 && (
|
|
21
|
+
function o(s, n, l) {
|
|
22
|
+
var a = null;
|
|
23
|
+
if (l !== void 0 && (a = "" + l), n.key !== void 0 && (a = "" + n.key), "key" in n) {
|
|
24
24
|
l = {};
|
|
25
|
-
for (var g in
|
|
26
|
-
g !== "key" && (l[g] =
|
|
27
|
-
} else l =
|
|
28
|
-
return
|
|
25
|
+
for (var g in n)
|
|
26
|
+
g !== "key" && (l[g] = n[g]);
|
|
27
|
+
} else l = n;
|
|
28
|
+
return n = l.ref, {
|
|
29
29
|
$$typeof: e,
|
|
30
30
|
type: s,
|
|
31
|
-
key:
|
|
32
|
-
ref:
|
|
31
|
+
key: a,
|
|
32
|
+
ref: n !== void 0 ? n : null,
|
|
33
33
|
props: l
|
|
34
34
|
};
|
|
35
35
|
}
|
|
36
|
-
return
|
|
36
|
+
return x.Fragment = t, x.jsx = o, x.jsxs = o, x;
|
|
37
37
|
}
|
|
38
|
-
var
|
|
38
|
+
var k = {};
|
|
39
39
|
/**
|
|
40
40
|
* @license React
|
|
41
41
|
* react-jsx-runtime.development.js
|
|
@@ -45,9 +45,9 @@ var O = {};
|
|
|
45
45
|
* This source code is licensed under the MIT license found in the
|
|
46
46
|
* LICENSE file in the root directory of this source tree.
|
|
47
47
|
*/
|
|
48
|
-
var
|
|
48
|
+
var H;
|
|
49
49
|
function Oe() {
|
|
50
|
-
return
|
|
50
|
+
return H || (H = 1, process.env.NODE_ENV !== "production" && function() {
|
|
51
51
|
function e(r) {
|
|
52
52
|
if (r == null) return null;
|
|
53
53
|
if (typeof r == "function")
|
|
@@ -71,11 +71,11 @@ function Oe() {
|
|
|
71
71
|
switch (typeof r.tag == "number" && console.error(
|
|
72
72
|
"Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."
|
|
73
73
|
), r.$$typeof) {
|
|
74
|
-
case
|
|
74
|
+
case y:
|
|
75
75
|
return "Portal";
|
|
76
76
|
case oe:
|
|
77
77
|
return (r.displayName || "Context") + ".Provider";
|
|
78
|
-
case
|
|
78
|
+
case ne:
|
|
79
79
|
return (r._context.displayName || "Context") + ".Consumer";
|
|
80
80
|
case ue:
|
|
81
81
|
var u = r.render;
|
|
@@ -94,7 +94,7 @@ function Oe() {
|
|
|
94
94
|
function t(r) {
|
|
95
95
|
return "" + r;
|
|
96
96
|
}
|
|
97
|
-
function
|
|
97
|
+
function o(r) {
|
|
98
98
|
try {
|
|
99
99
|
t(r);
|
|
100
100
|
var u = !1;
|
|
@@ -103,8 +103,8 @@ function Oe() {
|
|
|
103
103
|
}
|
|
104
104
|
if (u) {
|
|
105
105
|
u = console;
|
|
106
|
-
var
|
|
107
|
-
return
|
|
106
|
+
var i = u.error, b = typeof Symbol == "function" && Symbol.toStringTag && r[Symbol.toStringTag] || r.constructor.name || "Object";
|
|
107
|
+
return i.call(
|
|
108
108
|
u,
|
|
109
109
|
"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
|
|
110
110
|
b
|
|
@@ -122,46 +122,46 @@ function Oe() {
|
|
|
122
122
|
return "<...>";
|
|
123
123
|
}
|
|
124
124
|
}
|
|
125
|
-
function
|
|
126
|
-
var r =
|
|
125
|
+
function n() {
|
|
126
|
+
var r = I.A;
|
|
127
127
|
return r === null ? null : r.getOwner();
|
|
128
128
|
}
|
|
129
129
|
function l() {
|
|
130
130
|
return Error("react-stack-top-frame");
|
|
131
131
|
}
|
|
132
|
-
function
|
|
133
|
-
if (
|
|
132
|
+
function a(r) {
|
|
133
|
+
if (G.call(r, "key")) {
|
|
134
134
|
var u = Object.getOwnPropertyDescriptor(r, "key").get;
|
|
135
135
|
if (u && u.isReactWarning) return !1;
|
|
136
136
|
}
|
|
137
137
|
return r.key !== void 0;
|
|
138
138
|
}
|
|
139
139
|
function g(r, u) {
|
|
140
|
-
function
|
|
141
|
-
|
|
140
|
+
function i() {
|
|
141
|
+
W || (W = !0, console.error(
|
|
142
142
|
"%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
143
|
u
|
|
144
144
|
));
|
|
145
145
|
}
|
|
146
|
-
|
|
147
|
-
get:
|
|
146
|
+
i.isReactWarning = !0, Object.defineProperty(r, "key", {
|
|
147
|
+
get: i,
|
|
148
148
|
configurable: !0
|
|
149
149
|
});
|
|
150
150
|
}
|
|
151
151
|
function m() {
|
|
152
152
|
var r = e(this.type);
|
|
153
|
-
return
|
|
153
|
+
return U[r] || (U[r] = !0, console.error(
|
|
154
154
|
"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
155
|
)), r = this.props.ref, r !== void 0 ? r : null;
|
|
156
156
|
}
|
|
157
|
-
function w(r, u,
|
|
158
|
-
return
|
|
159
|
-
$$typeof:
|
|
157
|
+
function w(r, u, i, b, v, E, F, Y) {
|
|
158
|
+
return i = E.ref, r = {
|
|
159
|
+
$$typeof: S,
|
|
160
160
|
type: r,
|
|
161
161
|
key: u,
|
|
162
|
-
props:
|
|
162
|
+
props: E,
|
|
163
163
|
_owner: v
|
|
164
|
-
}, (
|
|
164
|
+
}, (i !== void 0 ? i : null) !== null ? Object.defineProperty(r, "ref", {
|
|
165
165
|
enumerable: !1,
|
|
166
166
|
get: m
|
|
167
167
|
}) : Object.defineProperty(r, "ref", { enumerable: !1, value: null }), r._store = {}, Object.defineProperty(r._store, "validated", {
|
|
@@ -178,33 +178,33 @@ function Oe() {
|
|
|
178
178
|
configurable: !1,
|
|
179
179
|
enumerable: !1,
|
|
180
180
|
writable: !0,
|
|
181
|
-
value:
|
|
181
|
+
value: F
|
|
182
182
|
}), Object.defineProperty(r, "_debugTask", {
|
|
183
183
|
configurable: !1,
|
|
184
184
|
enumerable: !1,
|
|
185
185
|
writable: !0,
|
|
186
|
-
value:
|
|
186
|
+
value: Y
|
|
187
187
|
}), Object.freeze && (Object.freeze(r.props), Object.freeze(r)), r;
|
|
188
188
|
}
|
|
189
|
-
function
|
|
189
|
+
function O(r, u, i, b, v, E, F, Y) {
|
|
190
190
|
var h = u.children;
|
|
191
191
|
if (h !== void 0)
|
|
192
192
|
if (b)
|
|
193
193
|
if (de(h)) {
|
|
194
194
|
for (b = 0; b < h.length; b++)
|
|
195
|
-
|
|
195
|
+
j(h[b]);
|
|
196
196
|
Object.freeze && Object.freeze(h);
|
|
197
197
|
} else
|
|
198
198
|
console.error(
|
|
199
199
|
"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
200
|
);
|
|
201
|
-
else
|
|
202
|
-
if (
|
|
201
|
+
else j(h);
|
|
202
|
+
if (G.call(u, "key")) {
|
|
203
203
|
h = e(r);
|
|
204
|
-
var
|
|
204
|
+
var T = Object.keys(u).filter(function(fe) {
|
|
205
205
|
return fe !== "key";
|
|
206
206
|
});
|
|
207
|
-
b = 0 <
|
|
207
|
+
b = 0 < T.length ? "{key: someKey, " + T.join(": ..., ") + ": ...}" : "{key: someKey}", J[h + b] || (T = 0 < T.length ? "{" + T.join(": ..., ") + ": ...}" : "{}", console.error(
|
|
208
208
|
`A props object containing a "key" prop is being spread into JSX:
|
|
209
209
|
let props = %s;
|
|
210
210
|
<%s {...props} />
|
|
@@ -213,129 +213,129 @@ React keys must be passed directly to JSX without using spread:
|
|
|
213
213
|
<%s key={someKey} {...props} />`,
|
|
214
214
|
b,
|
|
215
215
|
h,
|
|
216
|
-
|
|
216
|
+
T,
|
|
217
217
|
h
|
|
218
|
-
),
|
|
218
|
+
), J[h + b] = !0);
|
|
219
219
|
}
|
|
220
|
-
if (h = null,
|
|
221
|
-
|
|
222
|
-
for (var
|
|
223
|
-
|
|
224
|
-
} else
|
|
220
|
+
if (h = null, i !== void 0 && (o(i), h = "" + i), a(u) && (o(u.key), h = "" + u.key), "key" in u) {
|
|
221
|
+
i = {};
|
|
222
|
+
for (var D in u)
|
|
223
|
+
D !== "key" && (i[D] = u[D]);
|
|
224
|
+
} else i = u;
|
|
225
225
|
return h && g(
|
|
226
|
-
|
|
226
|
+
i,
|
|
227
227
|
typeof r == "function" ? r.displayName || r.name || "Unknown" : r
|
|
228
228
|
), w(
|
|
229
229
|
r,
|
|
230
230
|
h,
|
|
231
|
-
|
|
231
|
+
E,
|
|
232
232
|
v,
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
233
|
+
n(),
|
|
234
|
+
i,
|
|
235
|
+
F,
|
|
236
|
+
Y
|
|
237
237
|
);
|
|
238
238
|
}
|
|
239
|
-
function
|
|
240
|
-
typeof r == "object" && r !== null && r.$$typeof ===
|
|
239
|
+
function j(r) {
|
|
240
|
+
typeof r == "object" && r !== null && r.$$typeof === S && r._store && (r._store.validated = 1);
|
|
241
241
|
}
|
|
242
|
-
var
|
|
242
|
+
var p = me, S = Symbol.for("react.transitional.element"), y = Symbol.for("react.portal"), R = Symbol.for("react.fragment"), P = Symbol.for("react.strict_mode"), d = 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"), L = Symbol.for("react.lazy"), ie = Symbol.for("react.activity"), ce = Symbol.for("react.client.reference"), I = p.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, G = Object.prototype.hasOwnProperty, de = Array.isArray, N = console.createTask ? console.createTask : function() {
|
|
243
243
|
return null;
|
|
244
244
|
};
|
|
245
|
-
|
|
245
|
+
p = {
|
|
246
246
|
"react-stack-bottom-frame": function(r) {
|
|
247
247
|
return r();
|
|
248
248
|
}
|
|
249
249
|
};
|
|
250
|
-
var
|
|
251
|
-
|
|
250
|
+
var W, U = {}, B = p["react-stack-bottom-frame"].bind(
|
|
251
|
+
p,
|
|
252
252
|
l
|
|
253
|
-
)(),
|
|
254
|
-
|
|
255
|
-
var
|
|
256
|
-
return
|
|
253
|
+
)(), q = N(s(l)), J = {};
|
|
254
|
+
k.Fragment = R, k.jsx = function(r, u, i, b, v) {
|
|
255
|
+
var E = 1e4 > I.recentlyCreatedOwnerStacks++;
|
|
256
|
+
return O(
|
|
257
257
|
r,
|
|
258
258
|
u,
|
|
259
|
-
|
|
259
|
+
i,
|
|
260
260
|
!1,
|
|
261
261
|
b,
|
|
262
262
|
v,
|
|
263
|
-
|
|
264
|
-
|
|
263
|
+
E ? Error("react-stack-top-frame") : B,
|
|
264
|
+
E ? N(s(r)) : q
|
|
265
265
|
);
|
|
266
|
-
},
|
|
267
|
-
var
|
|
268
|
-
return
|
|
266
|
+
}, k.jsxs = function(r, u, i, b, v) {
|
|
267
|
+
var E = 1e4 > I.recentlyCreatedOwnerStacks++;
|
|
268
|
+
return O(
|
|
269
269
|
r,
|
|
270
270
|
u,
|
|
271
|
-
|
|
271
|
+
i,
|
|
272
272
|
!0,
|
|
273
273
|
b,
|
|
274
274
|
v,
|
|
275
|
-
|
|
276
|
-
|
|
275
|
+
E ? Error("react-stack-top-frame") : B,
|
|
276
|
+
E ? N(s(r)) : q
|
|
277
277
|
);
|
|
278
278
|
};
|
|
279
|
-
}()),
|
|
279
|
+
}()), k;
|
|
280
280
|
}
|
|
281
|
-
var
|
|
282
|
-
function
|
|
283
|
-
return
|
|
281
|
+
var X;
|
|
282
|
+
function Se() {
|
|
283
|
+
return X || (X = 1, process.env.NODE_ENV === "production" ? A.exports = ke() : A.exports = Oe()), A.exports;
|
|
284
284
|
}
|
|
285
|
-
var f =
|
|
286
|
-
const
|
|
285
|
+
var f = Se();
|
|
286
|
+
const ye = Q(void 0), $ = Q(void 0);
|
|
287
287
|
function _(e, t) {
|
|
288
|
-
const
|
|
289
|
-
return
|
|
290
|
-
const
|
|
291
|
-
Object.is(l.current,
|
|
292
|
-
const g =
|
|
288
|
+
const o = K($), [s, n] = M(c(() => t(e), [])), l = C(s);
|
|
289
|
+
return V(() => {
|
|
290
|
+
const a = t(e);
|
|
291
|
+
Object.is(l.current, a) || (n(a), l.current = a);
|
|
292
|
+
const g = ee(
|
|
293
293
|
() => {
|
|
294
294
|
const m = t(e);
|
|
295
|
-
Object.is(l.current, m) || (
|
|
295
|
+
Object.is(l.current, m) || (n(m), l.current = m);
|
|
296
296
|
},
|
|
297
|
-
{ injector:
|
|
297
|
+
{ injector: o }
|
|
298
298
|
);
|
|
299
299
|
return () => {
|
|
300
300
|
g.destroy();
|
|
301
301
|
};
|
|
302
302
|
}, [e, c(() => t, [])]), s;
|
|
303
303
|
}
|
|
304
|
-
function
|
|
305
|
-
const t = c(() => e.wrappers.slice(1), [e.wrappers]),
|
|
306
|
-
return /* @__PURE__ */ f.jsx(f.Fragment, { children:
|
|
304
|
+
function re(e) {
|
|
305
|
+
const t = c(() => e.wrappers.slice(1), [e.wrappers]), o = e.wrappers[0], s = _(o, () => ({ ...o?.inputs(), ...o?.attributes(), ...o?.outputs }));
|
|
306
|
+
return /* @__PURE__ */ f.jsx(f.Fragment, { children: o ? /* @__PURE__ */ f.jsx(o.type, { ...s, children: /* @__PURE__ */ f.jsx(re, { wrappers: t, children: e.children }) }) : e.children });
|
|
307
307
|
}
|
|
308
|
-
const
|
|
309
|
-
function
|
|
310
|
-
const t = _(e.field, (d) => d.inputs()),
|
|
311
|
-
return
|
|
308
|
+
const Ae = Symbol.for("ControlValueAccessor");
|
|
309
|
+
function te(e) {
|
|
310
|
+
const t = _(e.field, (d) => d.inputs()), o = _(e.field, (d) => d.outputs()), s = _(e.field, (d) => d.attributes()), n = c(() => ({ ...s, ...t, ...o }), [s, t, o]), l = _(e.field, (d) => d.renderConfig()), a = _(e.field, (d) => d.fieldGroup?.()), g = _(e.field, (d) => d.fieldArray?.()), m = c(() => ({ ...n, fields: a }), [n, a]), w = c(() => ({ ...n, fields: g }), [n, g]), O = _(e.field, (d) => d.wrappers()), j = e.field.form.control, p = e.field.define?.type, S = c(() => !!l.hidden || !p, [l.hidden, p]), y = K($), R = C(void 0), P = c(() => ({ ...n, [Ae]: R }), [n, R]);
|
|
311
|
+
return V(() => {
|
|
312
312
|
let d;
|
|
313
|
-
return R.current && (d = _e(() =>
|
|
314
|
-
d?.
|
|
313
|
+
return R.current && (d = _e(() => j, R.current, y)), () => {
|
|
314
|
+
d?.(), d = void 0;
|
|
315
315
|
};
|
|
316
|
-
}, [R.current,
|
|
316
|
+
}, [R.current, j, y]), /* @__PURE__ */ f.jsx(f.Fragment, { children: /* @__PURE__ */ f.jsx(ye, { value: e.field, children: S ? void 0 : /* @__PURE__ */ f.jsx(re, { wrappers: O, children: a ? /* @__PURE__ */ f.jsx(p, { ...m }) : g ? /* @__PURE__ */ f.jsx(p, { ...w }) : e.field.form.control ? /* @__PURE__ */ f.jsx(p, { ...P }) : /* @__PURE__ */ f.jsx(p, { ...n }) }) }) });
|
|
317
317
|
}
|
|
318
318
|
function Ve(e) {
|
|
319
|
-
return /* @__PURE__ */ f.jsx(f.Fragment, { children: e.fields.map((t,
|
|
319
|
+
return /* @__PURE__ */ f.jsx(f.Fragment, { children: e.fields.map((t, o) => /* @__PURE__ */ f.jsx(te, { field: t }, o)) });
|
|
320
320
|
}
|
|
321
321
|
class we extends Te {
|
|
322
322
|
// contents?: any[];
|
|
323
323
|
}
|
|
324
324
|
class Pe extends Ce {
|
|
325
325
|
}
|
|
326
|
-
function Ie(e, t,
|
|
327
|
-
let
|
|
328
|
-
return
|
|
326
|
+
function Ie(e, t, o, s) {
|
|
327
|
+
let n = !0;
|
|
328
|
+
return ee(
|
|
329
329
|
() => {
|
|
330
330
|
const l = t.value$$();
|
|
331
|
-
|
|
331
|
+
n ? (xe(l, e) || s(l), n = !1) : s(l);
|
|
332
332
|
},
|
|
333
|
-
{ injector:
|
|
333
|
+
{ injector: o }
|
|
334
334
|
);
|
|
335
335
|
}
|
|
336
|
-
function
|
|
337
|
-
const
|
|
338
|
-
c(() => (s.current =
|
|
336
|
+
function Z(e, t) {
|
|
337
|
+
const o = be(e, t), s = C(void 0);
|
|
338
|
+
c(() => (s.current = o(), s.current), t), V(() => () => {
|
|
339
339
|
s.current?.(), s.current = void 0;
|
|
340
340
|
}, []);
|
|
341
341
|
}
|
|
@@ -343,40 +343,40 @@ function $e(e) {
|
|
|
343
343
|
const t = c(() => he({
|
|
344
344
|
providers: [
|
|
345
345
|
{
|
|
346
|
-
provide:
|
|
346
|
+
provide: pe,
|
|
347
347
|
useClass: ge
|
|
348
348
|
}
|
|
349
349
|
]
|
|
350
|
-
}), []), [
|
|
351
|
-
const
|
|
350
|
+
}), []), [o, s] = c(() => {
|
|
351
|
+
const n = Ee({ providers: [], parent: t });
|
|
352
352
|
return [je(e.schema, {
|
|
353
353
|
handle: we,
|
|
354
354
|
builder: Pe,
|
|
355
|
-
injector:
|
|
356
|
-
registerOnDestroy: (
|
|
357
|
-
|
|
355
|
+
injector: n,
|
|
356
|
+
registerOnDestroy: (a) => {
|
|
357
|
+
n.get(Re).onDestroy(a);
|
|
358
358
|
},
|
|
359
359
|
...e.options
|
|
360
|
-
}),
|
|
360
|
+
}), n];
|
|
361
361
|
}, [e.schema, e.options]);
|
|
362
|
-
return
|
|
363
|
-
let
|
|
364
|
-
if (
|
|
362
|
+
return Z(() => {
|
|
363
|
+
let n;
|
|
364
|
+
if (o.form.control) {
|
|
365
365
|
const l = e.model;
|
|
366
|
-
|
|
366
|
+
n = Ie(typeof l < "u" ? l : void 0, o.form.control, s, (a) => {
|
|
367
367
|
ve(() => {
|
|
368
|
-
|
|
368
|
+
o.form.control?.valueNoError$$() && e.modelChange?.(a);
|
|
369
369
|
});
|
|
370
370
|
});
|
|
371
371
|
}
|
|
372
372
|
return () => {
|
|
373
|
-
s.destroy(),
|
|
373
|
+
s.destroy(), n?.destroy();
|
|
374
374
|
};
|
|
375
|
-
}, [
|
|
376
|
-
|
|
377
|
-
}, [
|
|
375
|
+
}, [o]), Z(() => {
|
|
376
|
+
o.form.control?.updateValue(e.model);
|
|
377
|
+
}, [o, e.model]), /* @__PURE__ */ f.jsx(f.Fragment, { children: /* @__PURE__ */ f.jsx($, { value: t, children: /* @__PURE__ */ f.jsx(te, { field: o }) }) });
|
|
378
378
|
}
|
|
379
|
-
const
|
|
379
|
+
const Le = [], Ge = {
|
|
380
380
|
directives: "merge",
|
|
381
381
|
formConfig: "merge",
|
|
382
382
|
inputs: "merge",
|
|
@@ -386,20 +386,20 @@ const Ge = [], Le = {
|
|
|
386
386
|
wrappers: "replace"
|
|
387
387
|
};
|
|
388
388
|
function We(e, t) {
|
|
389
|
-
const
|
|
389
|
+
const o = C(!1);
|
|
390
390
|
return c(() => {
|
|
391
391
|
const s = { value: e.value == null ? "" : e.value, disabled: e.disabled, onBlur: e.touchedChange };
|
|
392
392
|
return t ? {
|
|
393
393
|
...s,
|
|
394
394
|
onCompositionStart: () => {
|
|
395
|
-
|
|
395
|
+
o.current = !0;
|
|
396
396
|
},
|
|
397
|
-
onCompositionEnd: (
|
|
398
|
-
|
|
397
|
+
onCompositionEnd: (n) => {
|
|
398
|
+
o.current = !1, e.valueChange(n.target.value);
|
|
399
399
|
}
|
|
400
400
|
} : {
|
|
401
401
|
...s,
|
|
402
|
-
onInput: (
|
|
402
|
+
onInput: (n) => e.valueChange(n.target.value)
|
|
403
403
|
};
|
|
404
404
|
}, [e, t]);
|
|
405
405
|
}
|
|
@@ -417,8 +417,8 @@ function Be(e) {
|
|
|
417
417
|
disabled: e.disabled,
|
|
418
418
|
onBlur: e.touchedChange,
|
|
419
419
|
onInput: (t) => {
|
|
420
|
-
const
|
|
421
|
-
e.valueChange(
|
|
420
|
+
const o = t.target.value;
|
|
421
|
+
e.valueChange(o == "" ? void 0 : parseFloat(o));
|
|
422
422
|
}
|
|
423
423
|
}), [e]);
|
|
424
424
|
}
|
|
@@ -433,8 +433,8 @@ function qe(e, t) {
|
|
|
433
433
|
}
|
|
434
434
|
function Je(e) {
|
|
435
435
|
return c(() => {
|
|
436
|
-
const t = (
|
|
437
|
-
const s =
|
|
436
|
+
const t = (o) => {
|
|
437
|
+
const s = o.target.value;
|
|
438
438
|
e.valueChange(s == "" ? void 0 : parseFloat(s));
|
|
439
439
|
};
|
|
440
440
|
return {
|
|
@@ -451,18 +451,18 @@ function ze(e, t = !1) {
|
|
|
451
451
|
value: e.value,
|
|
452
452
|
disabled: e.disabled,
|
|
453
453
|
onBlur: e.touchedChange,
|
|
454
|
-
onChange: (
|
|
455
|
-
const s = [],
|
|
456
|
-
if (
|
|
457
|
-
for (let l = 0; l <
|
|
458
|
-
const
|
|
459
|
-
if (s.push(
|
|
454
|
+
onChange: (o) => {
|
|
455
|
+
const s = [], n = o.target;
|
|
456
|
+
if (n.selectedOptions !== void 0)
|
|
457
|
+
for (let l = 0; l < n.selectedOptions.length; l++) {
|
|
458
|
+
const a = n.selectedOptions[l];
|
|
459
|
+
if (s.push(a.value), !t)
|
|
460
460
|
break;
|
|
461
461
|
}
|
|
462
462
|
else
|
|
463
|
-
for (let l = 0; l <
|
|
464
|
-
const
|
|
465
|
-
if (
|
|
463
|
+
for (let l = 0; l < n.options.length; l++) {
|
|
464
|
+
const a = n.options[l];
|
|
465
|
+
if (a.selected && (s.push(a.value), !t))
|
|
466
466
|
break;
|
|
467
467
|
}
|
|
468
468
|
e.valueChange(t ? s : s[0]);
|
|
@@ -470,12 +470,12 @@ function ze(e, t = !1) {
|
|
|
470
470
|
}), [e]);
|
|
471
471
|
}
|
|
472
472
|
function He() {
|
|
473
|
-
const [e, t] =
|
|
473
|
+
const [e, t] = M(void 0), [o, s] = M(!1), n = C(void 0), l = C(void 0), a = c(() => ({
|
|
474
474
|
writeValue(m) {
|
|
475
475
|
t(m);
|
|
476
476
|
},
|
|
477
477
|
registerOnChange(m) {
|
|
478
|
-
|
|
478
|
+
n.current = m;
|
|
479
479
|
},
|
|
480
480
|
registerOnTouched(m) {
|
|
481
481
|
l.current = m;
|
|
@@ -485,34 +485,34 @@ function He() {
|
|
|
485
485
|
}
|
|
486
486
|
}), []), g = c(() => ({
|
|
487
487
|
value: e,
|
|
488
|
-
disabled:
|
|
488
|
+
disabled: o,
|
|
489
489
|
valueChange: (m) => {
|
|
490
|
-
|
|
490
|
+
n.current?.(m), t(m);
|
|
491
491
|
},
|
|
492
492
|
touchedChange: () => {
|
|
493
493
|
l.current?.();
|
|
494
494
|
}
|
|
495
|
-
}), [e,
|
|
495
|
+
}), [e, o]);
|
|
496
496
|
return c(() => ({
|
|
497
|
-
cva:
|
|
497
|
+
cva: a,
|
|
498
498
|
cvaa: g
|
|
499
499
|
}), [g]);
|
|
500
500
|
}
|
|
501
501
|
export {
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
502
|
+
Ae as CVA,
|
|
503
|
+
Le as EMPTY_ARRAY,
|
|
504
|
+
$ as InjectorToken,
|
|
505
|
+
Ge as NG_CONFIG_DEFAULT_MERGE_STRAGEGY,
|
|
506
|
+
ye as PI_VIEW_FIELD_TOKEN,
|
|
507
|
+
te as PiyingFieldTemplate,
|
|
508
508
|
Ve as PiyingGroup,
|
|
509
509
|
$e as PiyingView,
|
|
510
|
-
|
|
510
|
+
re as PiyingWrapper,
|
|
511
511
|
Pe as ReactFormBuilder,
|
|
512
512
|
we as ReactSchemaHandle,
|
|
513
513
|
Ie as initListen,
|
|
514
514
|
He as useControlValueAccessor,
|
|
515
|
-
|
|
515
|
+
Z as useEffectSync,
|
|
516
516
|
Ue as useInputCheckboxModel,
|
|
517
517
|
Be as useInputNumberModel,
|
|
518
518
|
qe as useInputRadioModel,
|
package/package.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@piying/view-react",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.2",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"dependencies": {
|
|
6
|
-
"@piying/view-core": "^0.6.
|
|
6
|
+
"@piying/view-core": "^0.6.27",
|
|
7
7
|
"fast-equals": "^5.2.2",
|
|
8
8
|
"static-injector": "^6.1.2",
|
|
9
9
|
"valibot": "^1.1.0"
|