@schemx/vue 0.2.0 → 0.2.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/README.md +1057 -49
- package/dist/analyze.html +1 -1
- package/dist/components/FormGroup/index.d.ts.map +1 -1
- package/dist/components/FormItem/index.d.ts +12 -5
- package/dist/components/FormItem/index.d.ts.map +1 -1
- package/dist/hocs/withRemoteOptions.d.ts.map +1 -1
- package/dist/hooks/index.d.ts +9 -5
- package/dist/hooks/index.d.ts.map +1 -1
- package/dist/hooks/provideFieldContext.d.ts +41 -0
- package/dist/hooks/provideFieldContext.d.ts.map +1 -0
- package/dist/hooks/provideFormConfigContext.d.ts +67 -0
- package/dist/hooks/provideFormConfigContext.d.ts.map +1 -0
- package/dist/hooks/provideFormContext.d.ts +57 -0
- package/dist/hooks/provideFormContext.d.ts.map +1 -0
- package/dist/hooks/useDictionary.d.ts.map +1 -1
- package/dist/hooks/useField.d.ts +0 -31
- package/dist/hooks/useField.d.ts.map +1 -1
- package/dist/hooks/useForm.d.ts +29 -31
- package/dist/hooks/useForm.d.ts.map +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.mjs +228 -168
- package/dist/index.mjs.map +1 -1
- package/dist/types/field.d.ts +2 -0
- package/dist/types/field.d.ts.map +1 -1
- package/dist/types/form.d.ts +3 -2
- package/dist/types/form.d.ts.map +1 -1
- package/dist/types/index.d.ts +2 -1
- package/dist/types/index.d.ts.map +1 -1
- package/package.json +12 -8
- package/dist/hooks/useContext.d.ts +0 -52
- package/dist/hooks/useContext.d.ts.map +0 -1
package/dist/analyze.html
CHANGED
|
@@ -4929,7 +4929,7 @@ var drawChart = (function (exports) {
|
|
|
4929
4929
|
</script>
|
|
4930
4930
|
<script>
|
|
4931
4931
|
/*<!--*/
|
|
4932
|
-
const data = {"version":2,"tree":{"name":"root","children":[{"name":"index.cjs","children":[{"name":"src","children":[{"name":"styles/index.css","uid":"5a50e0ba-1"},{"name":"utils","children":[{"uid":"5a50e0ba-3","name":"rendererProvider.ts"},{"uid":"5a50e0ba-5","name":"rulesProvider.ts"},{"uid":"5a50e0ba-19","name":"equal.ts"},{"uid":"5a50e0ba-25","name":"validation.ts"},{"uid":"5a50e0ba-27","name":"slot.ts"},{"uid":"5a50e0ba-33","name":"helpers.ts"}]},{"name":"hooks","children":[{"uid":"5a50e0ba-7","name":"useForm.ts"},{"uid":"5a50e0ba-9","name":"useField.ts"},{"uid":"5a50e0ba-11","name":"useWatch.ts"},{"uid":"5a50e0ba-13","name":"useEffect.ts"},{"uid":"5a50e0ba-15","name":"useDictionary.ts"},{"uid":"5a50e0ba-17","name":"useContext.ts"},{"uid":"5a50e0ba-21","name":"useStableRef.ts"},{"uid":"5a50e0ba-23","name":"useViewSchemas.ts"}]},{"name":"components","children":[{"name":"FormGroup/index.tsx","uid":"5a50e0ba-29"},{"name":"FormItem/index.tsx","uid":"5a50e0ba-31"}]},{"uid":"5a50e0ba-35","name":"form.vue?vue&type=script&setup=true&lang.ts"},{"uid":"5a50e0ba-37","name":"form.ts"},{"name":"hocs/withRemoteOptions.ts","uid":"5a50e0ba-39"},{"uid":"5a50e0ba-41","name":"index.ts"}]}]}],"isRoot":true},"nodeParts":{"5a50e0ba-1":{"renderedLength":0,"gzipLength":0,"brotliLength":0,"metaUid":"5a50e0ba-0"},"5a50e0ba-3":{"renderedLength":62,"gzipLength":69,"brotliLength":49,"metaUid":"5a50e0ba-2"},"5a50e0ba-5":{"renderedLength":58,"gzipLength":65,"brotliLength":49,"metaUid":"5a50e0ba-4"},"5a50e0ba-7":{"renderedLength":724,"gzipLength":334,"brotliLength":282,"metaUid":"5a50e0ba-6"},"5a50e0ba-9":{"renderedLength":1914,"gzipLength":688,"brotliLength":607,"metaUid":"5a50e0ba-8"},"5a50e0ba-11":{"renderedLength":551,"gzipLength":219,"brotliLength":186,"metaUid":"5a50e0ba-10"},"5a50e0ba-13":{"renderedLength":125,"gzipLength":112,"brotliLength":90,"metaUid":"5a50e0ba-12"},"5a50e0ba-15":{"renderedLength":2696,"gzipLength":879,"brotliLength":753,"metaUid":"5a50e0ba-14"},"5a50e0ba-17":{"renderedLength":319,"gzipLength":215,"brotliLength":167,"metaUid":"5a50e0ba-16"},"5a50e0ba-19":{"renderedLength":202,"gzipLength":154,"brotliLength":120,"metaUid":"5a50e0ba-18"},"5a50e0ba-21":{"renderedLength":240,"gzipLength":168,"brotliLength":143,"metaUid":"5a50e0ba-20"},"5a50e0ba-23":{"renderedLength":261,"gzipLength":162,"brotliLength":143,"metaUid":"5a50e0ba-22"},"5a50e0ba-25":{"renderedLength":768,"gzipLength":322,"brotliLength":262,"metaUid":"5a50e0ba-24"},"5a50e0ba-27":{"renderedLength":1262,"gzipLength":486,"brotliLength":401,"metaUid":"5a50e0ba-26"},"5a50e0ba-29":{"renderedLength":1849,"gzipLength":800,"brotliLength":674,"metaUid":"5a50e0ba-28"},"5a50e0ba-31":{"renderedLength":6476,"gzipLength":2312,"brotliLength":1891,"metaUid":"5a50e0ba-30"},"5a50e0ba-33":{"renderedLength":976,"gzipLength":385,"brotliLength":326,"metaUid":"5a50e0ba-32"},"5a50e0ba-35":{"renderedLength":3730,"gzipLength":1190,"brotliLength":1046,"metaUid":"5a50e0ba-34"},"5a50e0ba-37":{"renderedLength":281,"gzipLength":228,"brotliLength":174,"metaUid":"5a50e0ba-36"},"5a50e0ba-39":{"renderedLength":838,"gzipLength":382,"brotliLength":319,"metaUid":"5a50e0ba-38"},"5a50e0ba-41":{"renderedLength":0,"gzipLength":0,"brotliLength":0,"metaUid":"5a50e0ba-40"}},"nodeMetas":{"5a50e0ba-0":{"id":"/src/styles/index.css","moduleParts":{"index.cjs":"5a50e0ba-1"},"imported":[],"importedBy":[{"uid":"5a50e0ba-40"},{"uid":"5a50e0ba-34"}]},"5a50e0ba-2":{"id":"/src/utils/rendererProvider.ts","moduleParts":{"index.cjs":"5a50e0ba-3"},"imported":[{"uid":"5a50e0ba-44"}],"importedBy":[{"uid":"5a50e0ba-40"},{"uid":"5a50e0ba-6"}]},"5a50e0ba-4":{"id":"/src/utils/rulesProvider.ts","moduleParts":{"index.cjs":"5a50e0ba-5"},"imported":[{"uid":"5a50e0ba-44"}],"importedBy":[{"uid":"5a50e0ba-40"},{"uid":"5a50e0ba-6"}]},"5a50e0ba-6":{"id":"/src/hooks/useForm.ts","moduleParts":{"index.cjs":"5a50e0ba-7"},"imported":[{"uid":"5a50e0ba-46"},{"uid":"5a50e0ba-44"},{"uid":"5a50e0ba-2"},{"uid":"5a50e0ba-4"}],"importedBy":[{"uid":"5a50e0ba-42"},{"uid":"5a50e0ba-8"},{"uid":"5a50e0ba-10"},{"uid":"5a50e0ba-14"}]},"5a50e0ba-8":{"id":"/src/hooks/useField.ts","moduleParts":{"index.cjs":"5a50e0ba-9"},"imported":[{"uid":"5a50e0ba-46"},{"uid":"5a50e0ba-44"},{"uid":"5a50e0ba-6"}],"importedBy":[{"uid":"5a50e0ba-42"}]},"5a50e0ba-10":{"id":"/src/hooks/useWatch.ts","moduleParts":{"index.cjs":"5a50e0ba-11"},"imported":[{"uid":"5a50e0ba-46"},{"uid":"5a50e0ba-44"},{"uid":"5a50e0ba-6"}],"importedBy":[{"uid":"5a50e0ba-42"},{"uid":"5a50e0ba-14"}]},"5a50e0ba-12":{"id":"/src/hooks/useEffect.ts","moduleParts":{"index.cjs":"5a50e0ba-13"},"imported":[{"uid":"5a50e0ba-46"},{"uid":"5a50e0ba-44"}],"importedBy":[{"uid":"5a50e0ba-42"}]},"5a50e0ba-14":{"id":"/src/hooks/useDictionary.ts","moduleParts":{"index.cjs":"5a50e0ba-15"},"imported":[{"uid":"5a50e0ba-46"},{"uid":"5a50e0ba-6"},{"uid":"5a50e0ba-10"}],"importedBy":[{"uid":"5a50e0ba-42"},{"uid":"5a50e0ba-38"}]},"5a50e0ba-16":{"id":"/src/hooks/useContext.ts","moduleParts":{"index.cjs":"5a50e0ba-17"},"imported":[{"uid":"5a50e0ba-46"}],"importedBy":[{"uid":"5a50e0ba-42"}]},"5a50e0ba-18":{"id":"/src/utils/equal.ts","moduleParts":{"index.cjs":"5a50e0ba-19"},"imported":[],"importedBy":[{"uid":"5a50e0ba-20"}]},"5a50e0ba-20":{"id":"/src/hooks/useStableRef.ts","moduleParts":{"index.cjs":"5a50e0ba-21"},"imported":[{"uid":"5a50e0ba-46"},{"uid":"5a50e0ba-18"}],"importedBy":[{"uid":"5a50e0ba-42"}]},"5a50e0ba-22":{"id":"/src/hooks/useViewSchemas.ts","moduleParts":{"index.cjs":"5a50e0ba-23"},"imported":[{"uid":"5a50e0ba-46"}],"importedBy":[{"uid":"5a50e0ba-42"}]},"5a50e0ba-24":{"id":"/src/utils/validation.ts","moduleParts":{"index.cjs":"5a50e0ba-25"},"imported":[],"importedBy":[{"uid":"5a50e0ba-48"}]},"5a50e0ba-26":{"id":"/src/utils/slot.ts","moduleParts":{"index.cjs":"5a50e0ba-27"},"imported":[],"importedBy":[{"uid":"5a50e0ba-48"}]},"5a50e0ba-28":{"id":"/src/components/FormGroup/index.tsx","moduleParts":{"index.cjs":"5a50e0ba-29"},"imported":[{"uid":"5a50e0ba-46"},{"uid":"5a50e0ba-47"},{"uid":"5a50e0ba-30"}],"importedBy":[{"uid":"5a50e0ba-40"},{"uid":"5a50e0ba-30"}]},"5a50e0ba-30":{"id":"/src/components/FormItem/index.tsx","moduleParts":{"index.cjs":"5a50e0ba-31"},"imported":[{"uid":"5a50e0ba-46"},{"uid":"5a50e0ba-47"},{"uid":"5a50e0ba-42"},{"uid":"5a50e0ba-48"},{"uid":"5a50e0ba-28"}],"importedBy":[{"uid":"5a50e0ba-40"},{"uid":"5a50e0ba-36"},{"uid":"5a50e0ba-28"},{"uid":"5a50e0ba-34"}]},"5a50e0ba-32":{"id":"/src/utils/helpers.ts","moduleParts":{"index.cjs":"5a50e0ba-33"},"imported":[],"importedBy":[{"uid":"5a50e0ba-34"}]},"5a50e0ba-34":{"id":"/src/form.vue?vue&type=script&setup=true&lang.ts","moduleParts":{"index.cjs":"5a50e0ba-35"},"imported":[{"uid":"5a50e0ba-46"},{"uid":"5a50e0ba-52"},{"uid":"5a50e0ba-30"},{"uid":"5a50e0ba-42"},{"uid":"5a50e0ba-32"},{"uid":"5a50e0ba-0"}],"importedBy":[{"uid":"5a50e0ba-49"}]},"5a50e0ba-36":{"id":"/src/form.ts","moduleParts":{"index.cjs":"5a50e0ba-37"},"imported":[{"uid":"5a50e0ba-30"},{"uid":"5a50e0ba-45"}],"importedBy":[{"uid":"5a50e0ba-40"}]},"5a50e0ba-38":{"id":"/src/hocs/withRemoteOptions.ts","moduleParts":{"index.cjs":"5a50e0ba-39"},"imported":[{"uid":"5a50e0ba-46"},{"uid":"5a50e0ba-14"}],"importedBy":[{"uid":"5a50e0ba-43"}]},"5a50e0ba-40":{"id":"/src/index.ts","moduleParts":{"index.cjs":"5a50e0ba-41"},"imported":[{"uid":"5a50e0ba-0"},{"uid":"5a50e0ba-36"},{"uid":"5a50e0ba-2"},{"uid":"5a50e0ba-4"},{"uid":"5a50e0ba-42"},{"uid":"5a50e0ba-43"},{"uid":"5a50e0ba-30"},{"uid":"5a50e0ba-28"},{"uid":"5a50e0ba-44"}],"importedBy":[],"isEntry":true},"5a50e0ba-42":{"id":"/src/hooks/index.ts","moduleParts":{},"imported":[{"uid":"5a50e0ba-6"},{"uid":"5a50e0ba-8"},{"uid":"5a50e0ba-10"},{"uid":"5a50e0ba-12"},{"uid":"5a50e0ba-14"},{"uid":"5a50e0ba-16"},{"uid":"5a50e0ba-20"},{"uid":"5a50e0ba-22"}],"importedBy":[{"uid":"5a50e0ba-40"},{"uid":"5a50e0ba-30"},{"uid":"5a50e0ba-34"}]},"5a50e0ba-43":{"id":"/src/hocs/index.ts","moduleParts":{},"imported":[{"uid":"5a50e0ba-38"}],"importedBy":[{"uid":"5a50e0ba-40"}]},"5a50e0ba-44":{"id":"@schemx/core","moduleParts":{},"imported":[],"importedBy":[{"uid":"5a50e0ba-40"},{"uid":"5a50e0ba-2"},{"uid":"5a50e0ba-4"},{"uid":"5a50e0ba-6"},{"uid":"5a50e0ba-8"},{"uid":"5a50e0ba-10"},{"uid":"5a50e0ba-12"}],"isExternal":true},"5a50e0ba-45":{"id":"/src/formRuntime.js","moduleParts":{},"imported":[{"uid":"5a50e0ba-49"}],"importedBy":[{"uid":"5a50e0ba-36"}]},"5a50e0ba-46":{"id":"vue","moduleParts":{},"imported":[],"importedBy":[{"uid":"5a50e0ba-30"},{"uid":"5a50e0ba-28"},{"uid":"5a50e0ba-6"},{"uid":"5a50e0ba-8"},{"uid":"5a50e0ba-10"},{"uid":"5a50e0ba-12"},{"uid":"5a50e0ba-14"},{"uid":"5a50e0ba-16"},{"uid":"5a50e0ba-20"},{"uid":"5a50e0ba-22"},{"uid":"5a50e0ba-38"},{"uid":"5a50e0ba-34"}],"isExternal":true},"5a50e0ba-47":{"id":"classnames","moduleParts":{},"imported":[],"importedBy":[{"uid":"5a50e0ba-30"},{"uid":"5a50e0ba-28"}],"isExternal":true},"5a50e0ba-48":{"id":"/src/utils/index.ts","moduleParts":{},"imported":[{"uid":"5a50e0ba-50"},{"uid":"5a50e0ba-24"},{"uid":"5a50e0ba-26"},{"uid":"5a50e0ba-51"}],"importedBy":[{"uid":"5a50e0ba-30"}]},"5a50e0ba-49":{"id":"/src/form.vue","moduleParts":{},"imported":[{"uid":"5a50e0ba-34"}],"importedBy":[{"uid":"5a50e0ba-45"}]},"5a50e0ba-50":{"id":"/src/utils/dynamic.ts","moduleParts":{},"imported":[{"uid":"5a50e0ba-52"}],"importedBy":[{"uid":"5a50e0ba-48"}]},"5a50e0ba-51":{"id":"/src/utils/diff.ts","moduleParts":{},"imported":[{"uid":"5a50e0ba-53"}],"importedBy":[{"uid":"5a50e0ba-48"}]},"5a50e0ba-52":{"id":"es-toolkit","moduleParts":{},"imported":[],"importedBy":[{"uid":"5a50e0ba-50"},{"uid":"5a50e0ba-34"}],"isExternal":true},"5a50e0ba-53":{"id":"es-toolkit/compat","moduleParts":{},"imported":[],"importedBy":[{"uid":"5a50e0ba-51"}],"isExternal":true}},"env":{"rollup":"4.62.2"},"options":{"gzip":true,"brotli":true,"sourcemap":false}};
|
|
4932
|
+
const data = {"version":2,"tree":{"name":"root","children":[{"name":"index.cjs","children":[{"name":"src","children":[{"name":"styles/index.css","uid":"abc5935a-1"},{"name":"utils","children":[{"uid":"abc5935a-3","name":"rendererProvider.ts"},{"uid":"abc5935a-5","name":"rulesProvider.ts"},{"uid":"abc5935a-23","name":"equal.ts"},{"uid":"abc5935a-29","name":"validation.ts"},{"uid":"abc5935a-31","name":"slot.ts"},{"uid":"abc5935a-37","name":"helpers.ts"}]},{"name":"hooks","children":[{"uid":"abc5935a-7","name":"useForm.ts"},{"uid":"abc5935a-9","name":"provideFormContext.ts"},{"uid":"abc5935a-11","name":"useField.ts"},{"uid":"abc5935a-13","name":"provideFieldContext.ts"},{"uid":"abc5935a-15","name":"useWatch.ts"},{"uid":"abc5935a-17","name":"useEffect.ts"},{"uid":"abc5935a-19","name":"useDictionary.ts"},{"uid":"abc5935a-21","name":"provideFormConfigContext.ts"},{"uid":"abc5935a-25","name":"useStableRef.ts"},{"uid":"abc5935a-27","name":"useViewSchemas.ts"}]},{"name":"components","children":[{"name":"FormGroup/index.tsx","uid":"abc5935a-33"},{"name":"FormItem/index.tsx","uid":"abc5935a-35"}]},{"uid":"abc5935a-39","name":"form.vue?vue&type=script&setup=true&lang.ts"},{"uid":"abc5935a-41","name":"form.ts"},{"name":"hocs/withRemoteOptions.ts","uid":"abc5935a-43"},{"uid":"abc5935a-45","name":"index.ts"}]}]}],"isRoot":true},"nodeParts":{"abc5935a-1":{"renderedLength":0,"gzipLength":0,"brotliLength":0,"metaUid":"abc5935a-0"},"abc5935a-3":{"renderedLength":62,"gzipLength":69,"brotliLength":49,"metaUid":"abc5935a-2"},"abc5935a-5":{"renderedLength":58,"gzipLength":65,"brotliLength":49,"metaUid":"abc5935a-4"},"abc5935a-7":{"renderedLength":348,"gzipLength":194,"brotliLength":159,"metaUid":"abc5935a-6"},"abc5935a-9":{"renderedLength":468,"gzipLength":280,"brotliLength":223,"metaUid":"abc5935a-8"},"abc5935a-11":{"renderedLength":1593,"gzipLength":561,"brotliLength":491,"metaUid":"abc5935a-10"},"abc5935a-13":{"renderedLength":410,"gzipLength":249,"brotliLength":198,"metaUid":"abc5935a-12"},"abc5935a-15":{"renderedLength":551,"gzipLength":219,"brotliLength":186,"metaUid":"abc5935a-14"},"abc5935a-17":{"renderedLength":125,"gzipLength":112,"brotliLength":90,"metaUid":"abc5935a-16"},"abc5935a-19":{"renderedLength":2696,"gzipLength":878,"brotliLength":752,"metaUid":"abc5935a-18"},"abc5935a-21":{"renderedLength":686,"gzipLength":371,"brotliLength":314,"metaUid":"abc5935a-20"},"abc5935a-23":{"renderedLength":202,"gzipLength":154,"brotliLength":120,"metaUid":"abc5935a-22"},"abc5935a-25":{"renderedLength":240,"gzipLength":168,"brotliLength":143,"metaUid":"abc5935a-24"},"abc5935a-27":{"renderedLength":261,"gzipLength":162,"brotliLength":143,"metaUid":"abc5935a-26"},"abc5935a-29":{"renderedLength":768,"gzipLength":322,"brotliLength":262,"metaUid":"abc5935a-28"},"abc5935a-31":{"renderedLength":1262,"gzipLength":486,"brotliLength":401,"metaUid":"abc5935a-30"},"abc5935a-33":{"renderedLength":1878,"gzipLength":806,"brotliLength":656,"metaUid":"abc5935a-32"},"abc5935a-35":{"renderedLength":7378,"gzipLength":2416,"brotliLength":1981,"metaUid":"abc5935a-34"},"abc5935a-37":{"renderedLength":976,"gzipLength":385,"brotliLength":326,"metaUid":"abc5935a-36"},"abc5935a-39":{"renderedLength":4079,"gzipLength":1328,"brotliLength":1163,"metaUid":"abc5935a-38"},"abc5935a-41":{"renderedLength":281,"gzipLength":228,"brotliLength":174,"metaUid":"abc5935a-40"},"abc5935a-43":{"renderedLength":923,"gzipLength":408,"brotliLength":349,"metaUid":"abc5935a-42"},"abc5935a-45":{"renderedLength":0,"gzipLength":0,"brotliLength":0,"metaUid":"abc5935a-44"}},"nodeMetas":{"abc5935a-0":{"id":"/src/styles/index.css","moduleParts":{"index.cjs":"abc5935a-1"},"imported":[],"importedBy":[{"uid":"abc5935a-44"},{"uid":"abc5935a-38"}]},"abc5935a-2":{"id":"/src/utils/rendererProvider.ts","moduleParts":{"index.cjs":"abc5935a-3"},"imported":[{"uid":"abc5935a-48"}],"importedBy":[{"uid":"abc5935a-44"},{"uid":"abc5935a-6"}]},"abc5935a-4":{"id":"/src/utils/rulesProvider.ts","moduleParts":{"index.cjs":"abc5935a-5"},"imported":[{"uid":"abc5935a-48"}],"importedBy":[{"uid":"abc5935a-44"},{"uid":"abc5935a-6"}]},"abc5935a-6":{"id":"/src/hooks/useForm.ts","moduleParts":{"index.cjs":"abc5935a-7"},"imported":[{"uid":"abc5935a-51"},{"uid":"abc5935a-48"},{"uid":"abc5935a-2"},{"uid":"abc5935a-4"}],"importedBy":[{"uid":"abc5935a-46"}]},"abc5935a-8":{"id":"/src/hooks/provideFormContext.ts","moduleParts":{"index.cjs":"abc5935a-9"},"imported":[{"uid":"abc5935a-51"}],"importedBy":[{"uid":"abc5935a-46"},{"uid":"abc5935a-10"},{"uid":"abc5935a-14"},{"uid":"abc5935a-18"}]},"abc5935a-10":{"id":"/src/hooks/useField.ts","moduleParts":{"index.cjs":"abc5935a-11"},"imported":[{"uid":"abc5935a-51"},{"uid":"abc5935a-48"},{"uid":"abc5935a-8"}],"importedBy":[{"uid":"abc5935a-46"}]},"abc5935a-12":{"id":"/src/hooks/provideFieldContext.ts","moduleParts":{"index.cjs":"abc5935a-13"},"imported":[{"uid":"abc5935a-51"}],"importedBy":[{"uid":"abc5935a-46"},{"uid":"abc5935a-42"}]},"abc5935a-14":{"id":"/src/hooks/useWatch.ts","moduleParts":{"index.cjs":"abc5935a-15"},"imported":[{"uid":"abc5935a-51"},{"uid":"abc5935a-48"},{"uid":"abc5935a-8"}],"importedBy":[{"uid":"abc5935a-46"},{"uid":"abc5935a-18"}]},"abc5935a-16":{"id":"/src/hooks/useEffect.ts","moduleParts":{"index.cjs":"abc5935a-17"},"imported":[{"uid":"abc5935a-51"},{"uid":"abc5935a-48"}],"importedBy":[{"uid":"abc5935a-46"}]},"abc5935a-18":{"id":"/src/hooks/useDictionary.ts","moduleParts":{"index.cjs":"abc5935a-19"},"imported":[{"uid":"abc5935a-51"},{"uid":"abc5935a-8"},{"uid":"abc5935a-14"}],"importedBy":[{"uid":"abc5935a-46"},{"uid":"abc5935a-42"}]},"abc5935a-20":{"id":"/src/hooks/provideFormConfigContext.ts","moduleParts":{"index.cjs":"abc5935a-21"},"imported":[{"uid":"abc5935a-51"}],"importedBy":[{"uid":"abc5935a-46"}]},"abc5935a-22":{"id":"/src/utils/equal.ts","moduleParts":{"index.cjs":"abc5935a-23"},"imported":[],"importedBy":[{"uid":"abc5935a-24"}]},"abc5935a-24":{"id":"/src/hooks/useStableRef.ts","moduleParts":{"index.cjs":"abc5935a-25"},"imported":[{"uid":"abc5935a-51"},{"uid":"abc5935a-22"}],"importedBy":[{"uid":"abc5935a-46"}]},"abc5935a-26":{"id":"/src/hooks/useViewSchemas.ts","moduleParts":{"index.cjs":"abc5935a-27"},"imported":[{"uid":"abc5935a-51"}],"importedBy":[{"uid":"abc5935a-46"}]},"abc5935a-28":{"id":"/src/utils/validation.ts","moduleParts":{"index.cjs":"abc5935a-29"},"imported":[],"importedBy":[{"uid":"abc5935a-53"}]},"abc5935a-30":{"id":"/src/utils/slot.ts","moduleParts":{"index.cjs":"abc5935a-31"},"imported":[],"importedBy":[{"uid":"abc5935a-53"}]},"abc5935a-32":{"id":"/src/components/FormGroup/index.tsx","moduleParts":{"index.cjs":"abc5935a-33"},"imported":[{"uid":"abc5935a-51"},{"uid":"abc5935a-52"},{"uid":"abc5935a-34"}],"importedBy":[{"uid":"abc5935a-44"},{"uid":"abc5935a-34"}]},"abc5935a-34":{"id":"/src/components/FormItem/index.tsx","moduleParts":{"index.cjs":"abc5935a-35"},"imported":[{"uid":"abc5935a-51"},{"uid":"abc5935a-52"},{"uid":"abc5935a-46"},{"uid":"abc5935a-53"},{"uid":"abc5935a-32"}],"importedBy":[{"uid":"abc5935a-44"},{"uid":"abc5935a-40"},{"uid":"abc5935a-32"},{"uid":"abc5935a-38"}]},"abc5935a-36":{"id":"/src/utils/helpers.ts","moduleParts":{"index.cjs":"abc5935a-37"},"imported":[],"importedBy":[{"uid":"abc5935a-38"}]},"abc5935a-38":{"id":"/src/form.vue?vue&type=script&setup=true&lang.ts","moduleParts":{"index.cjs":"abc5935a-39"},"imported":[{"uid":"abc5935a-51"},{"uid":"abc5935a-60"},{"uid":"abc5935a-48"},{"uid":"abc5935a-34"},{"uid":"abc5935a-46"},{"uid":"abc5935a-36"},{"uid":"abc5935a-0"}],"importedBy":[{"uid":"abc5935a-57"}]},"abc5935a-40":{"id":"/src/form.ts","moduleParts":{"index.cjs":"abc5935a-41"},"imported":[{"uid":"abc5935a-34"},{"uid":"abc5935a-50"}],"importedBy":[{"uid":"abc5935a-44"}]},"abc5935a-42":{"id":"/src/hocs/withRemoteOptions.ts","moduleParts":{"index.cjs":"abc5935a-43"},"imported":[{"uid":"abc5935a-51"},{"uid":"abc5935a-18"},{"uid":"abc5935a-12"}],"importedBy":[{"uid":"abc5935a-47"}]},"abc5935a-44":{"id":"/src/index.ts","moduleParts":{"index.cjs":"abc5935a-45"},"imported":[{"uid":"abc5935a-0"},{"uid":"abc5935a-40"},{"uid":"abc5935a-2"},{"uid":"abc5935a-4"},{"uid":"abc5935a-46"},{"uid":"abc5935a-47"},{"uid":"abc5935a-34"},{"uid":"abc5935a-32"},{"uid":"abc5935a-48"},{"uid":"abc5935a-49"}],"importedBy":[],"isEntry":true},"abc5935a-46":{"id":"/src/hooks/index.ts","moduleParts":{},"imported":[{"uid":"abc5935a-6"},{"uid":"abc5935a-8"},{"uid":"abc5935a-10"},{"uid":"abc5935a-12"},{"uid":"abc5935a-14"},{"uid":"abc5935a-16"},{"uid":"abc5935a-18"},{"uid":"abc5935a-20"},{"uid":"abc5935a-24"},{"uid":"abc5935a-26"}],"importedBy":[{"uid":"abc5935a-44"},{"uid":"abc5935a-34"},{"uid":"abc5935a-38"}]},"abc5935a-47":{"id":"/src/hocs/index.ts","moduleParts":{},"imported":[{"uid":"abc5935a-42"}],"importedBy":[{"uid":"abc5935a-44"}]},"abc5935a-48":{"id":"@schemx/core","moduleParts":{},"imported":[],"importedBy":[{"uid":"abc5935a-44"},{"uid":"abc5935a-2"},{"uid":"abc5935a-4"},{"uid":"abc5935a-6"},{"uid":"abc5935a-10"},{"uid":"abc5935a-14"},{"uid":"abc5935a-16"},{"uid":"abc5935a-38"}],"isExternal":true},"abc5935a-49":{"id":"/src/types/index.ts","moduleParts":{},"imported":[{"uid":"abc5935a-54"},{"uid":"abc5935a-55"},{"uid":"abc5935a-56"}],"importedBy":[{"uid":"abc5935a-44"}]},"abc5935a-50":{"id":"/src/formRuntime.js","moduleParts":{},"imported":[{"uid":"abc5935a-57"}],"importedBy":[{"uid":"abc5935a-40"}]},"abc5935a-51":{"id":"vue","moduleParts":{},"imported":[],"importedBy":[{"uid":"abc5935a-34"},{"uid":"abc5935a-32"},{"uid":"abc5935a-6"},{"uid":"abc5935a-8"},{"uid":"abc5935a-10"},{"uid":"abc5935a-12"},{"uid":"abc5935a-14"},{"uid":"abc5935a-16"},{"uid":"abc5935a-18"},{"uid":"abc5935a-20"},{"uid":"abc5935a-24"},{"uid":"abc5935a-26"},{"uid":"abc5935a-42"},{"uid":"abc5935a-38"}],"isExternal":true},"abc5935a-52":{"id":"classnames","moduleParts":{},"imported":[],"importedBy":[{"uid":"abc5935a-34"},{"uid":"abc5935a-32"}],"isExternal":true},"abc5935a-53":{"id":"/src/utils/index.ts","moduleParts":{},"imported":[{"uid":"abc5935a-58"},{"uid":"abc5935a-28"},{"uid":"abc5935a-30"},{"uid":"abc5935a-59"}],"importedBy":[{"uid":"abc5935a-34"}]},"abc5935a-54":{"id":"/src/types/dictionary.ts","moduleParts":{},"imported":[],"importedBy":[{"uid":"abc5935a-49"}]},"abc5935a-55":{"id":"/src/types/form.ts","moduleParts":{},"imported":[],"importedBy":[{"uid":"abc5935a-49"}]},"abc5935a-56":{"id":"/src/types/field.ts","moduleParts":{},"imported":[],"importedBy":[{"uid":"abc5935a-49"}]},"abc5935a-57":{"id":"/src/form.vue","moduleParts":{},"imported":[{"uid":"abc5935a-38"}],"importedBy":[{"uid":"abc5935a-50"}]},"abc5935a-58":{"id":"/src/utils/dynamic.ts","moduleParts":{},"imported":[{"uid":"abc5935a-60"}],"importedBy":[{"uid":"abc5935a-53"}]},"abc5935a-59":{"id":"/src/utils/diff.ts","moduleParts":{},"imported":[{"uid":"abc5935a-61"}],"importedBy":[{"uid":"abc5935a-53"}]},"abc5935a-60":{"id":"es-toolkit","moduleParts":{},"imported":[],"importedBy":[{"uid":"abc5935a-58"},{"uid":"abc5935a-38"}],"isExternal":true},"abc5935a-61":{"id":"es-toolkit/compat","moduleParts":{},"imported":[],"importedBy":[{"uid":"abc5935a-59"}],"isExternal":true}},"env":{"rollup":"4.62.2"},"options":{"gzip":true,"brotli":true,"sourcemap":false}};
|
|
4933
4933
|
|
|
4934
4934
|
const run = () => {
|
|
4935
4935
|
const width = window.innerWidth;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/FormGroup/index.tsx"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AASH,OAAO,KAAK,EAAE,qBAAqB,EAAoB,MAAM,EAAE,MAAM,cAAc,CAAA;AAEnF;;;;GAIG;AACH,MAAM,WAAW,gBAAgB,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM;IACzD,MAAM,EAAE,qBAAqB,CAAC,CAAC,CAAC,CAAA;CACjC;AAED,QAAA,MAAM,SAAS;;;;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/FormGroup/index.tsx"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AASH,OAAO,KAAK,EAAE,qBAAqB,EAAoB,MAAM,EAAE,MAAM,cAAc,CAAA;AAEnF;;;;GAIG;AACH,MAAM,WAAW,gBAAgB,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM;IACzD,MAAM,EAAE,qBAAqB,CAAC,CAAC,CAAC,CAAA;CACjC;AAED,QAAA,MAAM,SAAS;;;;kCA0Ed,CAAA;AAED,eAAe,SAAS,CAAA"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { PropType, VNodeChild } from 'vue';
|
|
1
2
|
import { SchemxViewSchema, Values } from '@schemx/core';
|
|
2
3
|
|
|
3
4
|
/**
|
|
@@ -8,10 +9,16 @@ import { SchemxViewSchema, Values } from '@schemx/core';
|
|
|
8
9
|
export interface SchemxItemProps<T extends Values = Values> {
|
|
9
10
|
schema: SchemxViewSchema<T>;
|
|
10
11
|
}
|
|
11
|
-
declare const FormItem: import('vue').
|
|
12
|
-
schema:
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
}
|
|
12
|
+
declare const FormItem: import('vue').DefineComponent<import('vue').ExtractPropTypes<{
|
|
13
|
+
schema: {
|
|
14
|
+
type: PropType<SchemxViewSchema>;
|
|
15
|
+
required: true;
|
|
16
|
+
};
|
|
17
|
+
}>, () => VNodeChild, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<{
|
|
18
|
+
schema: {
|
|
19
|
+
type: PropType<SchemxViewSchema>;
|
|
20
|
+
required: true;
|
|
21
|
+
};
|
|
22
|
+
}>> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
|
|
16
23
|
export default FormItem;
|
|
17
24
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/FormItem/index.tsx"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/FormItem/index.tsx"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAgC,QAAQ,EAAS,MAAM,KAAK,CAAA;AACnE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,KAAK,CAAA;AAqBrC,OAAO,KAAK,EAMV,gBAAgB,EAChB,MAAM,EACP,MAAM,cAAc,CAAA;AAErB;;;;GAIG;AACH,MAAM,WAAW,eAAe,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM;IACxD,MAAM,EAAE,gBAAgB,CAAC,CAAC,CAAC,CAAA;CAC5B;AAED,QAAA,MAAM,QAAQ;;cAKQ,QAAQ,CAAC,gBAAgB,CAAC;;;UAMjC,UAAU;;cANH,QAAQ,CAAC,gBAAgB,CAAC;;;iGAgB9C,CAAA;AAoOF,eAAe,QAAQ,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"withRemoteOptions.d.ts","sourceRoot":"","sources":["../../src/hocs/withRemoteOptions.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,SAAS,EAAgC,QAAQ,EAAgB,MAAM,KAAK,CAAA;AAErF,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAA;
|
|
1
|
+
{"version":3,"file":"withRemoteOptions.d.ts","sourceRoot":"","sources":["../../src/hocs/withRemoteOptions.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,SAAS,EAAgC,QAAQ,EAAgB,MAAM,KAAK,CAAA;AAErF,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAA;AAK1D,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAA;AAG5C;;GAEG;AACH,MAAM,WAAW,0BAA0B;IACzC,cAAc;IACd,OAAO,EAAE,GAAG,EAAE,CAAA;IACd,WAAW;IACX,OAAO,EAAE,OAAO,CAAA;CACjB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,wBAAgB,iBAAiB,CAAC,gBAAgB,EAAE,SAAS;;cAMrC,QAAQ,CAAC,gBAAgB,CAAC;;;;cAIjB,QAAQ,CAAC,QAAQ,CAAC;;;;;;;cAJ3B,QAAQ,CAAC,gBAAgB,CAAC;;;;cAIjB,QAAQ,CAAC,QAAQ,CAAC;;;;;;6EAuBlD;AAED,eAAe,iBAAiB,CAAA"}
|
package/dist/hooks/index.d.ts
CHANGED
|
@@ -4,17 +4,21 @@
|
|
|
4
4
|
* @module hooks
|
|
5
5
|
*/
|
|
6
6
|
/** useForm - 表单状态管理 */
|
|
7
|
-
export { useForm
|
|
7
|
+
export { useForm } from './useForm';
|
|
8
|
+
/** createFormContext - 表单上下文注入与消费 */
|
|
9
|
+
export { createFormContext, useFormContext } from './provideFormContext';
|
|
8
10
|
/** useField - 单字段控制 */
|
|
9
|
-
export { useField
|
|
11
|
+
export { useField } from './useField';
|
|
12
|
+
/** createFieldContext - 表单上下文注入与消费 */
|
|
13
|
+
export { createFieldContext, useFieldContext } from './provideFieldContext';
|
|
10
14
|
/** useWatch - 字段变化监听 */
|
|
11
15
|
export { useWatch, useWatchField, useWatchFields, useWatchAll } from './useWatch';
|
|
12
16
|
/** useEffect - 通用 Signal effect */
|
|
13
17
|
export { useEffect } from './useEffect';
|
|
14
18
|
/** useDictionary - 字典选项加载 */
|
|
15
|
-
export { useDictionary, type
|
|
16
|
-
/**
|
|
17
|
-
export {
|
|
19
|
+
export { useDictionary, type UseDictionaryReturn, } from './useDictionary';
|
|
20
|
+
/** useFormConfigContext - 表单上下文注入与消费 */
|
|
21
|
+
export { createFormConfigContext, useFormConfigContext, formConfigContextOmitKey, type FormConfigContextOmitKey, type FormContextProps, } from './provideFormConfigContext';
|
|
18
22
|
/** useStableRef - 引用稳定化的 shallowRef */
|
|
19
23
|
export { useStableRef } from './useStableRef';
|
|
20
24
|
/** useViewSchemas - ViewSchemas Vue 桥接 */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/hooks/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,uBAAuB;AACvB,OAAO,EAAE,OAAO,EAAE,cAAc,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/hooks/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,uBAAuB;AACvB,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAEnC,qCAAqC;AACrC,OAAO,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AAExE,uBAAuB;AACvB,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA;AAErC,sCAAsC;AACtC,OAAO,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAA;AAE3E,wBAAwB;AACxB,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,YAAY,CAAA;AAEjF,mCAAmC;AACnC,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AAEvC,6BAA6B;AAC7B,OAAO,EACL,aAAa,EACb,KAAK,mBAAmB,GACzB,MAAM,iBAAiB,CAAA;AAExB,wCAAwC;AACxC,OAAO,EACL,uBAAuB,EACvB,oBAAoB,EACpB,wBAAwB,EACxB,KAAK,wBAAwB,EAC7B,KAAK,gBAAgB,GACtB,MAAM,4BAA4B,CAAA;AAEnC,uCAAuC;AACvC,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAE7C,0CAA0C;AAC1C,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAA"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { FieldInstance } from '../types/field';
|
|
2
|
+
import { Values } from '@schemx/core';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* 向后代组件提供当前字段实例。
|
|
6
|
+
*
|
|
7
|
+
* 应在创建字段实例的组件 setup() 同步阶段调用,通常由 FormItem
|
|
8
|
+
* 在调用 useField() 后使用,使字段插槽或自定义子组件能够读取同一实例。
|
|
9
|
+
*
|
|
10
|
+
* @param field - useField() 返回的字段实例
|
|
11
|
+
*
|
|
12
|
+
* @remarks
|
|
13
|
+
* 该函数只注册字段上下文,不创建字段实例,也不负责字段实例的生命周期。
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* ```typescript
|
|
17
|
+
* // FormItem 中
|
|
18
|
+
* const field = useField('date')
|
|
19
|
+
* createFieldContext(field)
|
|
20
|
+
*
|
|
21
|
+
* ```
|
|
22
|
+
*/
|
|
23
|
+
export declare function createFieldContext<TValues extends Values = Values>(field: FieldInstance<TValues>): void;
|
|
24
|
+
/**
|
|
25
|
+
* 获取最近祖先组件提供的当前字段实例。
|
|
26
|
+
*
|
|
27
|
+
* 必须在已调用 createFieldContext() 的组件子树内调用,否则抛出错误。
|
|
28
|
+
*
|
|
29
|
+
* @returns useField() 返回的字段实例
|
|
30
|
+
*
|
|
31
|
+
* @throws Error 当前组件不在字段上下文的后代组件树中时抛出
|
|
32
|
+
*
|
|
33
|
+
* @example
|
|
34
|
+
* ```ts
|
|
35
|
+
* const field = useFieldContext()
|
|
36
|
+
* field.error.value // string[] | undefined
|
|
37
|
+
* field.getValue() // 当前字段值
|
|
38
|
+
* ```
|
|
39
|
+
*/
|
|
40
|
+
export declare function useFieldContext(): FieldInstance<Values>;
|
|
41
|
+
//# sourceMappingURL=provideFieldContext.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"provideFieldContext.d.ts","sourceRoot":"","sources":["../../src/hooks/provideFieldContext.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAA;AACnD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;AAO1C;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,SAAS,MAAM,GAAG,MAAM,EAChE,KAAK,EAAE,aAAa,CAAC,OAAO,CAAC,GAC5B,IAAI,CAEN;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,eAAe,IAAI,aAAa,CAAC,MAAM,CAAC,CAWvD"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { InjectionKey } from 'vue';
|
|
2
|
+
import { SchemxFormProps } from '../types';
|
|
3
|
+
import { Values } from '@schemx/core';
|
|
4
|
+
|
|
5
|
+
/** 表单级展示配置在 Vue provide/inject 中使用的注入 key。 */
|
|
6
|
+
export declare const SCHEMX_FORM_CONFIG_KEY: InjectionKey<FormContextProps<Values>>;
|
|
7
|
+
/**
|
|
8
|
+
* formContextProps 类型排除值
|
|
9
|
+
*/
|
|
10
|
+
export declare const formConfigContextOmitKey: readonly ["form", "modelValue", "rendererRegistry", "validatorRegistry", "defaultRendererType", "onFinish", "onFinishFailed", "onValuesChange", "onFieldsChange"];
|
|
11
|
+
/**
|
|
12
|
+
* formContextProps 类型排除值 - 类型
|
|
13
|
+
*/
|
|
14
|
+
export type FormConfigContextOmitKey = (typeof formConfigContextOmitKey)[number];
|
|
15
|
+
/**
|
|
16
|
+
* 表单级默认配置。
|
|
17
|
+
*
|
|
18
|
+
* 该类型描述由 SchemxForm 提供给字段组件的配置上下文,排除表单实例、
|
|
19
|
+
* 表单数据和回调等运行时处理属性,供字段组件读取默认展示行为。
|
|
20
|
+
*
|
|
21
|
+
* @typeParam TValues - 表单值类型
|
|
22
|
+
*/
|
|
23
|
+
export interface FormContextProps<TValues extends Values = Values> extends Omit<SchemxFormProps<TValues>, FormConfigContextOmitKey> {
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* 创建并注入表单级配置上下文。
|
|
27
|
+
*
|
|
28
|
+
* 应在 `SchemxForm` 或自定义 Provider 的 setup() 同步阶段调用,
|
|
29
|
+
* 使后代字段组件能够读取 readonly、disabled、labelAlign 等默认配置。
|
|
30
|
+
*
|
|
31
|
+
* @typeParam TValues - 表单值类型
|
|
32
|
+
* @param props - 要提供给后代组件的表单级默认配置
|
|
33
|
+
*
|
|
34
|
+
* @remarks
|
|
35
|
+
* 该函数只注册上下文,不创建或销毁表单实例,也不改变传入配置的所有权。
|
|
36
|
+
*/
|
|
37
|
+
export declare const createFormConfigContext: <TValues extends Values = Values>(props: FormContextProps<TValues>) => void;
|
|
38
|
+
/**
|
|
39
|
+
* `createFormConfigContext` 的兼容别名。
|
|
40
|
+
*
|
|
41
|
+
* @deprecated 请使用 createFormConfigContext。
|
|
42
|
+
*/
|
|
43
|
+
export declare const createContext: <TValues extends Values = Values>(props: FormContextProps<TValues>) => void;
|
|
44
|
+
/**
|
|
45
|
+
* 获取最近祖先组件提供的表单级配置。
|
|
46
|
+
*
|
|
47
|
+
* 只能读取祖先组件通过 createFormConfigContext() 注册的配置,
|
|
48
|
+
* 不能读取当前组件或后代组件提供的值。
|
|
49
|
+
*
|
|
50
|
+
* @returns 当前表单树中的表单级默认配置
|
|
51
|
+
*
|
|
52
|
+
* @throws Error 当前组件不在已注册表单配置上下文的后代组件树中时抛出
|
|
53
|
+
*
|
|
54
|
+
* @example
|
|
55
|
+
* ```ts
|
|
56
|
+
* const context = useFormConfigContext()
|
|
57
|
+
* console.log(context.readonly, context.disabled)
|
|
58
|
+
* ```
|
|
59
|
+
*/
|
|
60
|
+
export declare function useFormConfigContext(): FormContextProps;
|
|
61
|
+
/**
|
|
62
|
+
* `useFormConfigContext` 的兼容别名。
|
|
63
|
+
*
|
|
64
|
+
* @deprecated 请使用 useFormConfigContext。
|
|
65
|
+
*/
|
|
66
|
+
export declare const useContext: typeof useFormConfigContext;
|
|
67
|
+
//# sourceMappingURL=provideFormConfigContext.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"provideFormConfigContext.d.ts","sourceRoot":"","sources":["../../src/hooks/provideFormConfigContext.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAU,KAAK,YAAY,EAAW,MAAM,KAAK,CAAA;AAExD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,UAAU,CAAA;AAC/C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;AAE1C,8CAA8C;AAC9C,eAAO,MAAM,sBAAsB,EAAmC,YAAY,CAChF,gBAAgB,CAAC,MAAM,CAAC,CACzB,CAAA;AAED;;GAEG;AACH,eAAO,MAAM,wBAAwB,mKAU3B,CAAA;AAEV;;GAEG;AACH,MAAM,MAAM,wBAAwB,GAAG,CAAC,OAAO,wBAAwB,CAAC,CAAC,MAAM,CAAC,CAAA;AAEhF;;;;;;;GAOG;AACH,MAAM,WAAW,gBAAgB,CAAC,OAAO,SAAS,MAAM,GAAG,MAAM,CAAE,SAAQ,IAAI,CAC7E,eAAe,CAAC,OAAO,CAAC,EACxB,wBAAwB,CACzB;CAAG;AAEJ;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,uBAAuB,GAAI,OAAO,SAAS,MAAM,GAAG,MAAM,EACrE,OAAO,gBAAgB,CAAC,OAAO,CAAC,KAC/B,IAEF,CAAA;AAED;;;;GAIG;AACH,eAAO,MAAM,aAAa,GAXc,OAAO,SAAS,MAAM,kBACrD,gBAAgB,CAAC,OAAO,CAAC,KAC/B,IASiD,CAAA;AAEpD;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,oBAAoB,IAAI,gBAAgB,CAWvD;AAED;;;;GAIG;AACH,eAAO,MAAM,UAAU,6BAAuB,CAAA"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { InjectionKey } from 'vue';
|
|
2
|
+
import { SchemxInstance, Values } from '@schemx/core';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* SchemxInstance 在 Vue provide/inject 中使用的注入 key。
|
|
6
|
+
*
|
|
7
|
+
* 该 key 只应与同一份包代码导出的 createFormContext() 和 useFormContext()
|
|
8
|
+
* 配套使用;重复安装不兼容版本的包不会共享此上下文。
|
|
9
|
+
*/
|
|
10
|
+
export declare const SCHEMX_FORM_INSTANCE_KEY: InjectionKey<SchemxInstance<Values>>;
|
|
11
|
+
/**
|
|
12
|
+
* 旧版表单实例注入 key。
|
|
13
|
+
*
|
|
14
|
+
* @deprecated 请使用 SCHEMX_FORM_INSTANCE_KEY。该别名仅用于兼容旧测试和旧适配代码。
|
|
15
|
+
*/
|
|
16
|
+
export declare const FORM_INSTANCE_KEY: InjectionKey<SchemxInstance<Values>>;
|
|
17
|
+
/**
|
|
18
|
+
* 向当前组件的后代组件提供表单实例。
|
|
19
|
+
*
|
|
20
|
+
* 必须在组件 setup() 的同步执行阶段调用;不要放入 onMounted、nextTick、
|
|
21
|
+
* Promise 或其他异步回调中,否则 Vue 无法把上下文关联到当前组件实例。
|
|
22
|
+
*
|
|
23
|
+
* @typeParam TValues - 表单值类型
|
|
24
|
+
* @param instance - 要提供给后代组件的表单实例
|
|
25
|
+
*
|
|
26
|
+
* @remarks
|
|
27
|
+
* 该函数不接管实例所有权,也不会在组件卸载时销毁实例。
|
|
28
|
+
*
|
|
29
|
+
* @example
|
|
30
|
+
* ```ts
|
|
31
|
+
* const form = props.form ?? useForm(options)
|
|
32
|
+
*
|
|
33
|
+
* // 无论 form 来自外部还是内部,都统一注册上下文。
|
|
34
|
+
* createFormContext(form)
|
|
35
|
+
* ```
|
|
36
|
+
*/
|
|
37
|
+
export declare function createFormContext<TValues extends Values = Values>(instance: SchemxInstance<TValues>): void;
|
|
38
|
+
/**
|
|
39
|
+
* 获取最近祖先组件提供的表单实例。
|
|
40
|
+
*
|
|
41
|
+
* 该函数只能读取祖先组件注册的上下文,不能读取当前组件自身或后代组件
|
|
42
|
+
* 调用 createFormContext() 提供的值。通常由 useField()、useWatch() 等其他
|
|
43
|
+
* 表单 hook 间接调用。
|
|
44
|
+
*
|
|
45
|
+
* @typeParam TValues - 表单值类型
|
|
46
|
+
* @returns 当前组件所属表单树中的 SchemxInstance
|
|
47
|
+
*
|
|
48
|
+
* @throws Error 当前组件不在已注册表单实例上下文的后代组件树中时抛出
|
|
49
|
+
*
|
|
50
|
+
* @example
|
|
51
|
+
* ```ts
|
|
52
|
+
* const form = useFormContext<FormValues>()
|
|
53
|
+
* form.setFieldValue("name", "Schemx")
|
|
54
|
+
* ```
|
|
55
|
+
*/
|
|
56
|
+
export declare function useFormContext<TValues extends Values = Values>(): SchemxInstance<TValues>;
|
|
57
|
+
//# sourceMappingURL=provideFormContext.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"provideFormContext.d.ts","sourceRoot":"","sources":["../../src/hooks/provideFormContext.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,EAAU,KAAK,YAAY,EAAW,MAAM,KAAK,CAAA;AAExD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;AAE1D;;;;;GAKG;AACH,eAAO,MAAM,wBAAwB,EAAgC,YAAY,CAC/E,cAAc,CAAC,MAAM,CAAC,CACvB,CAAA;AAED;;;;GAIG;AACH,eAAO,MAAM,iBAAiB,sCAA2B,CAAA;AAEzD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,SAAS,MAAM,GAAG,MAAM,EAC/D,QAAQ,EAAE,cAAc,CAAC,OAAO,CAAC,GAChC,IAAI,CAEN;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,cAAc,CAC5B,OAAO,SAAS,MAAM,GAAG,MAAM,KAC5B,cAAc,CAAC,OAAO,CAAC,CAW3B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useDictionary.d.ts","sourceRoot":"","sources":["../../src/hooks/useDictionary.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAa,GAAG,EAAO,MAAM,KAAK,CAAA;AAEzC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAA;AAK1D,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;
|
|
1
|
+
{"version":3,"file":"useDictionary.d.ts","sourceRoot":"","sources":["../../src/hooks/useDictionary.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAa,GAAG,EAAO,MAAM,KAAK,CAAA;AAEzC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAA;AAK1D,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;AAEpD,YAAY,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAA;AAEhF;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC,uBAAuB;IACvB,IAAI,EAAE,GAAG,CAAC,GAAG,EAAE,CAAC,CAAA;IAChB,kBAAkB;IAClB,OAAO,EAAE,GAAG,CAAC,OAAO,CAAC,CAAA;IACrB,kBAAkB;IAClB,KAAK,EAAE,GAAG,CAAC,KAAK,GAAG,SAAS,CAAC,CAAA;IAC7B,eAAe;IACf,QAAQ,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAA;IAC7B,qBAAqB;IACrB,OAAO,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAA;IAC5B,8BAA8B;IAC9B,MAAM,EAAE,CAAC,IAAI,EAAE,GAAG,EAAE,KAAK,IAAI,CAAA;CAC9B;AAED;;;;GAIG;AACH,MAAM,MAAM,oBAAoB,GAAG,mBAAmB,CAAA;AAEtD;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,GAAG,EAAE,OAAO,GAAG,KAAK,CAIlD;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,eAAO,MAAM,aAAa,GACxB,OAAO,SAAS,MAAM,GAAG,MAAM,EAC/B,KAAK,SAAS,QAAQ,CAAC,OAAO,CAAC,GAAG,QAAQ,CAAC,OAAO,CAAC,EAEnD,SAAS,gBAAgB,CAAC,OAAO,CAAC,EAClC,YAAY,KAAK,KAChB,mBAmIF,CAAA;AAED,eAAe,aAAa,CAAA"}
|
package/dist/hooks/useField.d.ts
CHANGED
|
@@ -34,36 +34,5 @@ import { NamePath, Values } from '@schemx/core';
|
|
|
34
34
|
* ```
|
|
35
35
|
*/
|
|
36
36
|
export declare const useField: <TValues extends Values = Values>(name: NamePath<TValues>) => FieldInstance<TValues>;
|
|
37
|
-
/**
|
|
38
|
-
* 向子组件树注入当前字段上下文。
|
|
39
|
-
*
|
|
40
|
-
* 应在 FormItem(或任何创建了 useField 的组件)的 setup 中调用。
|
|
41
|
-
*
|
|
42
|
-
* @param field - useField 返回的字段实例
|
|
43
|
-
*
|
|
44
|
-
* @example
|
|
45
|
-
* ```typescript
|
|
46
|
-
* // FormItem 中
|
|
47
|
-
* const field = useField('date')
|
|
48
|
-
* createFieldContext(field)
|
|
49
|
-
*
|
|
50
|
-
* ```
|
|
51
|
-
*/
|
|
52
|
-
export declare function createFieldContext<TValues extends Values = Values>(field: FieldInstance<TValues>): void;
|
|
53
|
-
/**
|
|
54
|
-
* 从最近的 FormItem 获取当前字段上下文。
|
|
55
|
-
*
|
|
56
|
-
* 必须在 FormItem 的组件子树内调用,否则抛出错误。
|
|
57
|
-
*
|
|
58
|
-
* @returns useField 返回的字段实例
|
|
59
|
-
*
|
|
60
|
-
* @throws 当不在 FormItem 子树内时抛出
|
|
61
|
-
*
|
|
62
|
-
* @example
|
|
63
|
-
* const field = useFieldContext()
|
|
64
|
-
* field.error.value // string[] | undefined
|
|
65
|
-
* field.getValue() // 当前字段值(Vue 响应式)
|
|
66
|
-
*/
|
|
67
|
-
export declare function useFieldContext(): ReturnType<typeof useField>;
|
|
68
37
|
export default useField;
|
|
69
38
|
//# sourceMappingURL=useField.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useField.d.ts","sourceRoot":"","sources":["../../src/hooks/useField.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAMH,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAA;AAI9C,OAAO,KAAK,EAAE,QAAQ,EAAkB,MAAM,EAAE,MAAM,cAAc,CAAA;
|
|
1
|
+
{"version":3,"file":"useField.d.ts","sourceRoot":"","sources":["../../src/hooks/useField.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAMH,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAA;AAI9C,OAAO,KAAK,EAAE,QAAQ,EAAkB,MAAM,EAAE,MAAM,cAAc,CAAA;AAqEpE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,eAAO,MAAM,QAAQ,GAAI,OAAO,SAAS,MAAM,GAAG,MAAM,EACtD,MAAM,QAAQ,CAAC,OAAO,CAAC,KACtB,aAAa,CAAC,OAAO,CAuCvB,CAAA;AAED,eAAe,QAAQ,CAAA"}
|
package/dist/hooks/useForm.d.ts
CHANGED
|
@@ -1,59 +1,57 @@
|
|
|
1
1
|
import { CreateFormOptions, NamePath, SchemxInstance, Values } from '@schemx/core';
|
|
2
2
|
|
|
3
|
-
/** SchemxInstance 在 Vue provide/inject 中的注入 key */
|
|
4
|
-
export declare const SCHEMX_INSTANCE_KEY: unique symbol;
|
|
5
|
-
/** @deprecated 请使用 SCHEMX_INSTANCE_KEY。保留给旧测试和旧适配代码兼容。 */
|
|
6
|
-
export declare const FORM_INSTANCE_KEY: symbol;
|
|
7
3
|
/**
|
|
8
|
-
* useForm
|
|
4
|
+
* useForm 配置选项。
|
|
9
5
|
*
|
|
10
|
-
*
|
|
6
|
+
* 当前与 core 层 CreateFormOptions 保持一致,并在 Vue 层自动补充默认的
|
|
7
|
+
* rendererRegistry 和 validatorRegistry。保留独立类型用于后续扩展
|
|
8
|
+
* Vue 专属配置,而不污染 core 层接口。
|
|
11
9
|
*
|
|
12
10
|
* @typeParam TValues - 表单值类型
|
|
13
11
|
*/
|
|
14
12
|
export interface UseFormOptions<TValues extends Values> extends CreateFormOptions<TValues, NamePath<TValues>> {
|
|
15
13
|
}
|
|
16
14
|
/**
|
|
17
|
-
*
|
|
15
|
+
* 创建由当前 Vue effect scope 持有的表单实例。
|
|
18
16
|
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
17
|
+
* useForm 只负责以下职责:
|
|
18
|
+
* 1. 合并 Vue 层默认注册表;
|
|
19
|
+
* 2. 同步创建 SchemxInstance;
|
|
20
|
+
* 3. 在当前 effect scope 销毁时调用 instance.destroy()。
|
|
21
21
|
*
|
|
22
|
-
*
|
|
22
|
+
* useForm 不再自动调用 provide()。需要向后代组件暴露实例时,应由
|
|
23
|
+
* <SchemxForm> 或其他 Provider 组件显式调用 createFormContext(form)。
|
|
24
|
+
* 这样无论实例是内部创建还是通过 props.form 外部传入,都能走同一条
|
|
25
|
+
* 上下文注册路径,并保持清晰的实例所有权:谁创建,谁销毁。
|
|
26
|
+
*
|
|
27
|
+
* 该函数应在组件 setup() 或其他有效的 Vue effect scope 中同步调用。
|
|
28
|
+
* 非 Vue 生命周期场景请直接使用 @schemx/core 的 createForm(),并自行销毁实例。
|
|
23
29
|
*
|
|
24
|
-
* @
|
|
25
|
-
* @
|
|
30
|
+
* @typeParam TValues - 表单值类型
|
|
31
|
+
* @param options - 表单创建配置
|
|
32
|
+
* @returns 当前 scope 持有的 SchemxInstance
|
|
26
33
|
*
|
|
27
34
|
* @example
|
|
28
|
-
* ```
|
|
29
|
-
* // 在 setup 中使用
|
|
35
|
+
* ```ts
|
|
30
36
|
* const form = useForm({
|
|
31
|
-
* initialValues: {
|
|
37
|
+
* initialValues: {
|
|
38
|
+
* name: "",
|
|
39
|
+
* email: "",
|
|
40
|
+
* },
|
|
32
41
|
* onFinish: async (values) => {
|
|
33
42
|
* await api.submit(values)
|
|
34
43
|
* },
|
|
35
44
|
* })
|
|
36
45
|
*
|
|
37
|
-
* form.setFieldValue(
|
|
46
|
+
* form.setFieldValue("name", "Schemx")
|
|
38
47
|
* ```
|
|
39
|
-
*/
|
|
40
|
-
export declare function useForm<TValues extends Values = Values>(options?: UseFormOptions<TValues>): SchemxInstance<TValues>;
|
|
41
|
-
/**
|
|
42
|
-
* 获取表单实例
|
|
43
|
-
*
|
|
44
|
-
* 在子组件中获取 useForm 创建的 SchemxInstance,
|
|
45
|
-
* 可用于读写字段值、校验、订阅等操作。
|
|
46
|
-
*
|
|
47
|
-
* @typeParam TValues - 表单值类型
|
|
48
|
-
* @returns 表单实例
|
|
49
|
-
*
|
|
50
|
-
* @throws Error 如果不在 schemx 提供的上下文中调用
|
|
51
48
|
*
|
|
52
49
|
* @example
|
|
53
50
|
* ```ts
|
|
54
|
-
*
|
|
55
|
-
* form.
|
|
51
|
+
* // Provider 组件中统一注册上下文。
|
|
52
|
+
* const form = props.form ?? useForm(options)
|
|
53
|
+
* createFormContext(form)
|
|
56
54
|
* ```
|
|
57
55
|
*/
|
|
58
|
-
export declare function
|
|
56
|
+
export declare function useForm<TValues extends Values = Values>(options?: UseFormOptions<TValues>): SchemxInstance<TValues>;
|
|
59
57
|
//# sourceMappingURL=useForm.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useForm.d.ts","sourceRoot":"","sources":["../../src/hooks/useForm.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"useForm.d.ts","sourceRoot":"","sources":["../../src/hooks/useForm.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAE,iBAAiB,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;AAEvF;;;;;;;;GAQG;AACH,MAAM,WAAW,cAAc,CAAC,OAAO,SAAS,MAAM,CAAE,SAAQ,iBAAiB,CAC/E,OAAO,EACP,QAAQ,CAAC,OAAO,CAAC,CAClB;CAAG;AAEJ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyCG;AACH,wBAAgB,OAAO,CAAC,OAAO,SAAS,MAAM,GAAG,MAAM,EACrD,OAAO,GAAE,cAAc,CAAC,OAAO,CAAM,GACpC,cAAc,CAAC,OAAO,CAAC,CAgBzB"}
|
package/dist/index.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),t=require("classnames"),r=require("@schemx/core"),n=require("es-toolkit"),o=r.createRendererRegistry("input"),s=r.createValidatorsRegistry(),a=Symbol("SCHEMX_INSTANCE");function l(t={}){const{...n}=t,l={...n,rendererRegistry:n.rendererRegistry??o,validatorRegistry:n.validatorRegistry??s},i=e.computed(()=>r.createForm(l));return e.provide(a,i.value),e.onUnmounted(()=>{i.value.destroy()}),i.value}function i(){const t=e.inject(a);if(!t)throw new Error("useFormContext must be used within a Form");return t}const u=Symbol("schemx:field"),c=new WeakMap;const d=t=>{const n=i(),o=t;let s=c.get(n);s||(s=new Map,c.set(n,s));const a=s.get(o);let l;if(a)a.refCount++,l=a;else{const{result:a,dispose:i}=function(t,n){const o=r.createField(t,n),s=e.shallowRef(o.getValue()),a=e.shallowRef(o.getError()),l=e.shallowRef(o.isPending()),i=o.effect(()=>{s.value=o.getValue(),a.value=o.getError(),l.value=o.isPending()}),u=e.computed(()=>a.value),c=e.computed(()=>(s.value,o.isTouched())),d=e.computed(()=>l.value);return{result:{value:s,error:u,dirty:c,pending:d,...o,getValue:()=>s.value},dispose:i}}(n,t);l={refCount:1,result:a,dispose:i},s.set(o,l)}return e.onUnmounted(()=>{--l.refCount<=0&&(l.dispose(),s.delete(o))}),l.result};function m(t,n,o){const s=i(),a=r.createWatch(s,t,n,o);return e.onUnmounted(a),a}function p(e,t,r){return m(e,t,r)}function f(e){return e instanceof Error?e:new Error(String(e))}const h=(t,r)=>{var n;const o=i(),s=e.ref([]),a=e.ref(!1),l=e.ref(void 0);let u=0;const c=async()=>{try{const e=o.getFieldsValue();if("function"==typeof t.shouldFetch&&!t.shouldFetch(e))return s.value=[],void(a.value=!1);a.value=!0,l.value=void 0;const r=++u,n=await(async e=>{const r=t.retryCount??0,n=t.retryInterval??1e3;let s=new Error("Unknown error");for(let l=0;l<=r;l++)try{return await t.api(e,o)}catch(a){s=f(a),l<r&&await new Promise(e=>setTimeout(e,n))}throw s})(e);if(r!==u)return;const i=await(async e=>"function"==typeof(null==t?void 0:t.formatter)?await t.formatter(e,o):e)(n);if(r!==u)return;s.value=i,l.value=void 0,"function"==typeof t.onSuccess&&t.onSuccess(i,o),a.value=!1}catch(e){const r=f(e);l.value=r,s.value=[],a.value=!1,"function"==typeof t.onError&&t.onError(r,o)}};(null==(n=t.dependsOn)?void 0:n.length)&&p(t.dependsOn,(e,n)=>{"function"==typeof t.onDepsChange&&t.onDepsChange(n,o),t.resetOnDepsChange&&r&&o.setFieldValue(r,void 0),c()});const d=t.immediate??!0;return e.onMounted(()=>{d&&c()}),{list:s,loading:a,error:l,loadDict:c,refresh:()=>c(),mutate:e=>{s.value=e}}},v=Symbol("FormContext");function y(){const t=e.inject(v);if(!t)throw new Error("useConfigContext must be used within a Form");return t}function g(t){const r=e.shallowRef({});return e.watchEffect(()=>{const e=t();((e,t)=>{const r=Object.keys(e),n=Object.keys(t);return r.length===n.length&&r.every(r=>e[r]===t[r])})(r.value,e)||(r.value=e)}),r}function b(e){return void 0!==e&&(!Array.isArray(e)||0!==e.length)}function x(e,t){if(!t)return!1;return(Array.isArray(t)?t:[t]).some(t=>function(e){return{onBlur:"blur",onChange:"change",onSubmit:"submit",blur:"blur",change:"change",submit:"submit"}[e]??"submit"}(t)===e)}const F=e=>/[A-Z]/.test(e),w=e=>e.includes("-"),C=e=>e.replace(/([A-Z])/g,"-$1").toLowerCase(),V=e=>e.replace(/-([a-z])/g,(e,t)=>t.toUpperCase()),_=(e,t)=>{if(e[t])return e[t];const r=F(t)?C(t):w(t)?V(t):void 0;return r&&e[r]?e[r]:void 0},R=(e,t)=>{const r={},n=(o=String(e),(w(o)?V(o):o)+":");var o;const s=(e=>F(e)?C(e):e)(String(e))+":";for(const[a,l]of Object.entries(t))a.startsWith(n)?r[a.slice(n.length)]=l:a.startsWith(s)&&s!==n&&(r[a.slice(s.length)]=l);return r},S=e.defineComponent((r,{slots:n})=>{const o=e.ref(Boolean(r.schema.defaultCollapsed)),s=()=>{r.schema.collapsible&&(o.value=!o.value)};return()=>{const a=r.schema,l=Boolean(a.collapsible);return e.createVNode("div",{class:t("schemx-group",{"schemx-group--collapsed":o.value},a.class),"data-key":a.key},[a.label&&e.createVNode("div",{role:l?"button":void 0,tabindex:l?0:void 0,class:t("schemx-group__header",{"schemx-group__header--clickable":l}),onClick:s,onKeydown:e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),s())}},[e.createVNode("span",{class:"schemx-group__title"},[a.label]),l&&e.createVNode("span",{class:t("schemx-group__arrow",{"schemx-group__arrow--down":!o.value})},null)]),!o.value&&e.createVNode("div",{class:"schemx-group__body"},[a.children.map(t=>e.createVNode(k,{key:t.key,schema:t},n))])])}},{name:"SchemxGroup",props:{schema:{type:Object,required:!0}}}),k=e.defineComponent((r,{slots:n})=>{const o=e.toRef(r,"schema");if(E(o.value))return()=>e.h(S,{schema:o.value},n);const s=i(),a=y(),l=()=>o.value,c=d(l().name);!function(t){e.provide(u,t)}(c);const m=e.computed(()=>{return e=l().validationTrigger,t=a.validationTrigger,r="onChange",b(e)?e:b(t)?t:r;var e,t,r}),p=e.computed(()=>{const e=l().visible&&!l().readonly&&!l().disabled,t=l().rules,r=Array.isArray(t)?(null==t?void 0:t.length)>0:!!l().rules;return e&&r}),f=e=>{var t,r;c.setValue(e),null==(r=null==(t=l().componentProps)?void 0:t.onChange)||r.call(t,e),p.value&&x("change",m.value)&&c.validate()},h=()=>{p.value&&x("blur",m.value)&&c.validate()},v=g(()=>({...l().componentProps,value:c.getValue(),onChange:f,onBlur:h,"onUpdate:value":e=>c.setValue(e)})),F=()=>{const t=_(n,`${l().name}Label`);if(t)return t(l());const r=l().labelAlign||a.labelAlign,o=l().labelWidth||a.labelWidth,s=l().colon??a.colon;return e.createVNode("label",{class:"schemx-item__label",style:{width:o,textAlign:r}},[!l().required||l().disabled||l().readonly?null:e.createVNode("span",{class:"schemx-item__required"},[e.createTextVNode("*")]),e.createVNode("span",{class:"schemx-item__label-text"},[l().label,s?":":""])])},w=()=>{const t=s.getRenderer(l().componentType);if(!t)throw new Error(`[schemx] Can not find component renderer of "${l().componentType}".`);const r=R(A(l().name),n),o=e.h(t,v.value,r),a=_(n,`${l().name}Content`);return a?a({...l(),columnElement:o}):e.createVNode("div",{class:"schemx-item__control"},[o])},C=()=>{const t=_(n,`${l().name}Error`);return t?t({...l(),errors:c.error.value}):Array.isArray(c.error.value)&&0!==c.error.value.length?e.createVNode("div",{class:"schemx-item__error"},[c.error.value[0]]):null};return()=>{if(!l().visible)return null;const r=_(n,A(l().name));if(r)return r(l());const o=l().labelPosition||a.labelPosition;return e.createVNode("div",{class:t("schemx-item-wrapper")},[e.createVNode("div",{class:t("schemx-item",`schemx-item--label-${o}`,l().class,{"is-readonly":l().readonly,"is-disabled":l().disabled}),style:{...l().style??{}}},[F(),e.createVNode("div",{class:"schemx-item__content"},[w(),C()])])])}},{name:"SchemxItem",props:{schema:{type:Object,required:!0}}}),E=e=>"group"===e.componentType,A=e=>Array.isArray(e)?e.map(e=>String(e)).join("."):String(e);function N(e){return!(!e||"group"===e.componentType||"visible"in e&&!1===e.visible)}function O(e,t,r){for(let n=t+r;n>=0&&n<e.length;n+=r)if(N(e[n]))return e[n]}const T=e.defineComponent({name:"SchemxForm",__name:"form",props:{class:{default:""},style:{default:()=>({})},required:{type:Boolean},readonly:{type:Boolean},disabled:{type:Boolean},visible:{type:Boolean},labelIcon:{},labelAlign:{},labelPosition:{},labelWidth:{},contentAlign:{},validationTrigger:{},colon:{type:Boolean},modelValue:{default:()=>({})},initialValues:{default:()=>({})},schemas:{default:()=>[]},form:{default:void 0},rendererRegistry:{default:void 0},defaultRendererType:{},validatorRegistry:{default:void 0},onFinish:{type:Function,default:void 0},onFinishFailed:{type:Function,default:void 0},onValuesChange:{type:Function,default:void 0},onFieldsChange:{type:Function,default:void 0}},emits:["update:modelValue"],setup(t,{expose:r,emit:o}){const s=t,a=o;(t=>{e.provide(v,t)})(n.omit(s,["form","modelValue","rendererRegistry","defaultRendererType","validatorRegistry","onFinish","onFinishFailed","onValuesChange","onFieldsChange"]));const i=s.form?s.form:l({schemas:s.schemas,initialValues:s.initialValues,rendererRegistry:s.rendererRegistry,defaultRendererType:s.defaultRendererType,validatorRegistry:s.validatorRegistry,readonly:s.readonly,disabled:s.disabled,onFinish:async e=>{var t;null==(t=s.onFinish)||t.call(s,e)},onFinishFailed:async e=>{var t;null==(t=s.onFinishFailed)||t.call(s,e)},onValuesChange:(e,t)=>{var r;a("update:modelValue",t),null==(r=s.onValuesChange)||r.call(s,e,t)},onFieldsChange:(e,t)=>{var r;null==(r=s.onFieldsChange)||r.call(s,e,t)}});e.watch(()=>s.schemas,e=>{i.setSchemas(e)},{deep:!1,immediate:!!s.form});const u=function(t){const r=e.shallowRef(t.getViewSchemas()),n=t.subscribeViewSchemas(e=>{r.value=e});return e.onScopeDispose(n),r}(i),c=e=>{const{isFirst:t,isLast:r}=function(e,t){const r=e.findIndex(e=>e.key===t);return-1===r?{found:!1,isFirst:!1,isLast:!1}:N(e[r])?{found:!0,isFirst:!O(e,r,-1),isLast:!O(e,r,1)}:{found:!0,isFirst:!1,isLast:!1}}(u.value,e.key);return{"schemx-item-wrapper--first":t,"schemx-item-wrapper--last":r}};return e.watchEffect(()=>{i.updateDefaultProps(s)}),r({...i}),(t,r)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["schemx",s.class])},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(u),r=>(e.openBlock(),e.createBlock(e.unref(k),{key:r.key,schema:r,class:e.normalizeClass(c(r))},e.createSlots({_:2},[e.renderList(t.$slots,(r,n)=>({name:n,fn:e.withCtx(r=>[e.renderSlot(t.$slots,n,e.mergeProps({ref_for:!0},r??{}))])}))]),1032,["schema","class"]))),128))],2))}});const j=(B=T,P={install(e,t){e.component("SchemxForm",T)},FormItem:k},Object.assign(B,P));var B,P;exports.FormGroup=S,exports.FormItem=k,exports.WithRemoteOptions=function(t){return e.defineComponent({name:`WithRemoteOptions(${t.name||"Anonymous"})`,inheritAttrs:!1,props:{dict:{type:Object,default:void 0},fieldName:{type:[String,Array],default:void 0}},setup(r,{attrs:n,slots:o}){const s=r.dict?h(r.dict,r.fieldName):null,a=e.computed(()=>({...n,dict:r.dict,options:r.dict?null==s?void 0:s.list.value:n.options,loading:r.dict?null==s?void 0:s.loading.value:n.loading}));return()=>e.h(t,a.value,o)}})},exports.default=j,exports.rendererRegistry=o,exports.schemxForm=j,exports.useConfigContext=y,exports.useDictionary=h,exports.useEffect=function(t){const n=r.createEffect(t);return e.onUnmounted(n),n},exports.useField=d,exports.useFieldContext=function(){const t=e.inject(u);if(!t)throw new Error("[schemx] useFieldContext() must be used inside a FormItem tree");return t},exports.useForm=l,exports.useFormContext=i,exports.useWatch=m,exports.useWatchAll=function(e,t){return m(e,t)},exports.useWatchField=function(e,t,r){return m(e,t,r)},exports.useWatchFields=p,exports.validatorRegistry=s,Object.keys(r).forEach(e=>{"default"===e||Object.prototype.hasOwnProperty.call(exports,e)||Object.defineProperty(exports,e,{enumerable:!0,get:()=>r[e]})});
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),t=require("classnames"),r=require("@schemx/core"),n=require("es-toolkit"),o=r.createRendererRegistry("input"),s=r.createValidatorsRegistry();function l(t={}){const n={...t,rendererRegistry:t.rendererRegistry??o,validatorRegistry:t.validatorRegistry??s},l=r.createForm(n);return e.onScopeDispose(()=>{l.destroy()}),l}const a=Symbol("schemx:instance");function i(t){e.provide(a,t)}function c(){const t=e.inject(a,null);if(!t)throw new Error("[schemx] useFormContext() must be called inside a <SchemxForm> descendant. Ensure createFormContext(form) is called synchronously during setup().");return t}const u=new WeakMap;const d=t=>{const n=c(),o=t;let s=u.get(n);s||(s=new Map,u.set(n,s));const l=s.get(o);let a;if(l)l.refCount++,a=l;else{const{result:l,dispose:i}=function(t,n){const o=r.createField(t,n),s=e.shallowRef(o.getValue()),l=e.shallowRef(o.getError()),a=e.shallowRef(o.isPending()),i=o.effect(()=>{s.value=o.getValue(),l.value=o.getError(),a.value=o.isPending()}),c=e.computed(()=>l.value),u=e.computed(()=>(s.value,o.isTouched())),d=e.computed(()=>a.value);return{result:{name:n,value:s,error:c,dirty:u,pending:d,...o,getValue:()=>s.value},dispose:i}}(n,t);a={refCount:1,result:l,dispose:i},s.set(o,a)}return e.onUnmounted(()=>{--a.refCount<=0&&(a.dispose(),s.delete(o))}),a.result},m=Symbol("schemx:field");function p(t){e.provide(m,t)}function h(){const t=e.inject(m);if(!t)throw new Error("[schemx] useFieldContext() must be called inside a component tree where createFieldContext(field) has been called.");return t}function f(t,n,o){const s=c(),l=r.createWatch(s,t,n,o);return e.onUnmounted(l),l}function y(e,t,r){return f(e,t,r)}function v(e){return e instanceof Error?e:new Error(String(e))}const g=(t,r)=>{var n;const o=c(),s=e.ref([]),l=e.ref(!1),a=e.ref(void 0);let i=0;const u=async()=>{try{const e=o.getFieldsValue();if("function"==typeof t.shouldFetch&&!t.shouldFetch(e))return s.value=[],void(l.value=!1);l.value=!0,a.value=void 0;const r=++i,n=await(async e=>{const r=t.retryCount??0,n=t.retryInterval??1e3;let s=new Error("Unknown error");for(let a=0;a<=r;a++)try{return await t.api(e,o)}catch(l){s=v(l),a<r&&await new Promise(e=>setTimeout(e,n))}throw s})(e);if(r!==i)return;const c=await(async e=>"function"==typeof(null==t?void 0:t.formatter)?await t.formatter(e,o):e)(n);if(r!==i)return;s.value=c,a.value=void 0,"function"==typeof t.onSuccess&&t.onSuccess(c,o),l.value=!1}catch(e){const r=v(e);a.value=r,s.value=[],l.value=!1,"function"==typeof t.onError&&t.onError(r,o)}};(null==(n=t.dependsOn)?void 0:n.length)&&y(t.dependsOn,(e,n)=>{"function"==typeof t.onDepsChange&&t.onDepsChange(e,o),t.resetOnDepsChange&&r&&o.setFieldValue(r,void 0),u()});const d=t.immediate??!0;return e.onMounted(()=>{d&&u()}),{list:s,loading:l,error:a,loadDict:u,refresh:()=>u(),mutate:e=>{s.value=e}}},x=Symbol("schemx:form-config"),b=["form","modelValue","rendererRegistry","validatorRegistry","defaultRendererType","onFinish","onFinishFailed","onValuesChange","onFieldsChange"],F=t=>{e.provide(x,t)};function C(){const t=e.inject(x);if(!t)throw new Error("[schemx] useFormConfigContext() must be called inside a <SchemxForm> descendant. Ensure createFormConfigContext(props) is called synchronously during setup().");return t}function w(t){const r=e.shallowRef({});return e.watchEffect(()=>{const e=t();((e,t)=>{const r=Object.keys(e),n=Object.keys(t);return r.length===n.length&&r.every(r=>e[r]===t[r])})(r.value,e)||(r.value=e)}),r}function V(t){const r=e.shallowRef(t.getViewSchemas()),n=t.subscribeViewSchemas(e=>{r.value=e});return e.onScopeDispose(n),r}function S(e){return void 0!==e&&(!Array.isArray(e)||0!==e.length)}function R(e,t){if(!t)return!1;return(Array.isArray(t)?t:[t]).some(t=>function(e){return{onBlur:"blur",onChange:"change",onSubmit:"submit",blur:"blur",change:"change",submit:"submit"}[e]??"submit"}(t)===e)}const _=e=>/[A-Z]/.test(e),k=e=>e.includes("-"),E=e=>e.replace(/([A-Z])/g,"-$1").toLowerCase(),A=e=>e.replace(/-([a-z])/g,(e,t)=>t.toUpperCase()),O=(e,t)=>{if(e[t])return e[t];const r=_(t)?E(t):k(t)?A(t):void 0;return r&&e[r]?e[r]:void 0},j=(e,t)=>{const r={},n=(o=String(e),(k(o)?A(o):o)+":");var o;const s=(e=>_(e)?E(e):e)(String(e))+":";for(const[l,a]of Object.entries(t))l.startsWith(n)?r[l.slice(n.length)]=a:l.startsWith(s)&&s!==n&&(r[l.slice(s.length)]=a);return r},B=e.defineComponent((r,{slots:n})=>{const o=e.ref(Boolean(r.schema.defaultCollapsed)),s=()=>{r.schema.collapsible&&(o.value=!o.value)};return()=>{const l=r.schema,a=Boolean(l.collapsible);return e.createVNode("div",{class:t("schemx-group",{"schemx-group--collapsed":o.value},l.class),style:l.style,"data-key":l.key},[l.label&&e.createVNode("div",{role:a?"button":void 0,tabindex:a?0:void 0,class:t("schemx-group__header",{"schemx-group__header--clickable":a}),onClick:s,onKeydown:e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),s())}},[e.createVNode("span",{class:"schemx-group__title"},[l.label]),a&&e.createVNode("span",{class:t("schemx-group__arrow",{"schemx-group__arrow--down":!o.value})},null)]),!o.value&&e.createVNode("div",{class:"schemx-group__body"},[l.children.map(t=>e.createVNode(N,{key:t.key,schema:t},n))])])}},{name:"SchemxGroup",props:{schema:{type:Object,required:!0}}}),N=e.defineComponent({name:"SchemxItem",props:{schema:{type:Object,required:!0}},setup:(t,{slots:r})=>()=>{const n=t.schema;return T(n)?e.h(B,{schema:n},r):e.h(P,{schema:n},r)}}),P=e.defineComponent({name:"SchemxFieldItem",props:{schema:{type:Object,required:!0}},setup(r,{slots:n}){const o=e.toRef(r,"schema"),s=c(),l=C(),a=()=>o.value,i=d(a().name);p(i);const u=e.computed(()=>{return e=a().validationTrigger,t=l.validationTrigger,r="onChange",S(e)?e:S(t)?t:r;var e,t,r}),m=e.computed(()=>{const e=a().visible&&!a().readonly&&!a().disabled,t=a().rules,r=Array.isArray(t)?(null==t?void 0:t.length)>0:!!a().rules;return e&&r}),h=e=>{var t,r;i.setValue(e),null==(r=null==(t=a().componentProps)?void 0:t.onChange)||r.call(t,e),m.value&&R("change",u.value)&&i.validate()},f=e=>{var t,r;null==(r=null==(t=a().componentProps)?void 0:t.onBlur)||r.call(t,e),m.value&&R("blur",u.value)&&i.validate()},y=w(()=>{const e=a();return{...e.componentProps,readonly:e.readonly,disabled:e.disabled,placeholder:e.placeholder,formItemProps:e,value:i.getValue(),onChange:h,onBlur:f,"onUpdate:value":e=>i.setValue(e)}}),v=()=>{const t=O(n,`${a().name}Label`);if(t)return t(a());const r=a().labelAlign||l.labelAlign,o=a().labelWidth||l.labelWidth,s=a().colon??l.colon;return e.createVNode("label",{class:"schemx-item__label",style:{width:o,textAlign:r}},[!a().required||a().disabled||a().readonly?null:e.createVNode("span",{class:"schemx-item__required"},[e.createTextVNode("*")]),e.createVNode("span",{class:"schemx-item__label-text"},[a().label,s?":":""])])},g=()=>{const t=s.getRenderer(a().componentType);if(!t)throw new Error(`[schemx] Can not find component renderer of "${a().componentType}".`);const r=j(W(a().name),n),o=e.h(t,y.value,r),l=O(n,`${a().name}Content`);return l?l({...a(),columnElement:o}):e.createVNode("div",{class:"schemx-item__control"},[o])},x=()=>{const t=O(n,`${a().name}Error`);return t?t({...a(),errors:i.error.value}):Array.isArray(i.error.value)&&0!==i.error.value.length?e.createVNode("div",{class:"schemx-item__error"},[i.error.value[0]]):null};return()=>{if(!a().visible)return null;const r=O(n,W(a().name));if(r)return r(a());const o=a().labelPosition||l.labelPosition;return e.createVNode("div",{class:t("schemx-item-wrapper"),style:a().style},[e.createVNode("div",{class:t("schemx-item",`schemx-item--label-${o}`,a().class,{"is-readonly":a().readonly,"is-disabled":a().disabled}),style:{...a().style??{}}},[v(),e.createVNode("div",{class:"schemx-item__content"},[g(),x()])])])}}}),T=e=>"group"===e.componentType,W=e=>Array.isArray(e)?e.map(e=>String(e)).join("."):String(e);function q(e){return!(!e||"group"===e.componentType||"visible"in e&&!1===e.visible)}function D(e,t,r){for(let n=t+r;n>=0&&n<e.length;n+=r)if(q(e[n]))return e[n]}const $=e.defineComponent({name:"SchemxForm",__name:"form",props:{class:{default:""},style:{type:[Boolean,null,String,Object,Array],default:()=>({})},required:{type:Boolean},readonly:{type:Boolean},disabled:{type:Boolean},visible:{type:Boolean,default:!0},labelIcon:{},labelAlign:{},labelPosition:{},labelWidth:{},contentAlign:{},validationTrigger:{},colon:{type:Boolean},modelValue:{default:()=>({})},initialValues:{default:()=>({})},schemas:{default:()=>[]},form:{default:void 0},rendererRegistry:{default:void 0},defaultRendererType:{},validatorRegistry:{default:void 0},onFinish:{type:Function,default:void 0},onFinishFailed:{type:Function,default:void 0},onValuesChange:{type:Function,default:void 0},onFieldsChange:{type:Function,default:void 0}},emits:["update:modelValue"],setup(t,{expose:o,emit:s}){const a=t,c=s;F(n.omit(a,b));const u=a.form?a.form:l({schemas:a.schemas,initialValues:Object.keys(a.modelValue).length>0?a.modelValue:a.initialValues,rendererRegistry:a.rendererRegistry,defaultRendererType:a.defaultRendererType,validatorRegistry:a.validatorRegistry,readonly:a.readonly,disabled:a.disabled,onFinish:async e=>{var t;null==(t=a.onFinish)||t.call(a,e)},onFinishFailed:async e=>{var t;null==(t=a.onFinishFailed)||t.call(a,e)},onValuesChange:(e,t)=>{var r;null==(r=a.onValuesChange)||r.call(a,e,t)},onFieldsChange:(e,t)=>{var r;null==(r=a.onFieldsChange)||r.call(a,e,t)}});i(u);let d=!1;e.watch(()=>a.modelValue,e=>{d=!0,u.setFieldsValue(e),d=!1});const m=r.createWatch(u,e=>{d||c("update:modelValue",e)});e.onUnmounted(m),e.watch(()=>a.schemas,e=>{u.setSchemas(e)},{deep:!1,immediate:!!a.form});const p=V(u),h=e=>{const{isFirst:t,isLast:r}=function(e,t){const r=e.findIndex(e=>e.key===t);return-1===r?{found:!1,isFirst:!1,isLast:!1}:q(e[r])?{found:!0,isFirst:!D(e,r,-1),isLast:!D(e,r,1)}:{found:!0,isFirst:!1,isLast:!1}}(p.value,e.key);return{"schemx-item-wrapper--first":t,"schemx-item-wrapper--last":r}};return e.watchEffect(()=>{u.updateDefaultProps(a)}),o({...u}),(t,r)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["schemx",a.class]),style:e.normalizeStyle(a.style)},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(p),r=>(e.openBlock(),e.createBlock(e.unref(N),{key:r.key,schema:r,class:e.normalizeClass(h(r))},e.createSlots({_:2},[e.renderList(t.$slots,(r,n)=>({name:n,fn:e.withCtx(r=>[e.renderSlot(t.$slots,n,e.mergeProps({ref_for:!0},r??{}))])}))]),1032,["schema","class"]))),128))],6))}});const I=(L=$,U={install(e,t){e.component("SchemxForm",$)},FormItem:N},Object.assign(L,U));var L,U;exports.FormGroup=B,exports.FormItem=N,exports.WithRemoteOptions=function(t){return e.defineComponent({name:`WithRemoteOptions(${t.name||"Anonymous"})`,inheritAttrs:!1,props:{dict:{type:Object,default:void 0},fieldName:{type:[String,Array],default:void 0}},setup(r,{attrs:n,slots:o}){const s=r.fieldName??(r.dict?h().name:void 0),l=r.dict?g(r.dict,s):null,a=e.computed(()=>({...n,dict:r.dict,options:r.dict?null==l?void 0:l.list.value:n.options,loading:r.dict?null==l?void 0:l.loading.value:n.loading}));return()=>e.h(t,a.value,o)}})},exports.createFieldContext=p,exports.createFormConfigContext=F,exports.createFormContext=i,exports.default=I,exports.formConfigContextOmitKey=b,exports.rendererRegistry=o,exports.schemxForm=I,exports.useDictionary=g,exports.useEffect=function(t){const n=r.createEffect(t);return e.onUnmounted(n),n},exports.useField=d,exports.useFieldContext=h,exports.useForm=l,exports.useFormConfigContext=C,exports.useFormContext=c,exports.useStableRef=w,exports.useViewSchemas=V,exports.useWatch=f,exports.useWatchAll=function(e,t){return f(e,t)},exports.useWatchField=function(e,t,r){return f(e,t,r)},exports.useWatchFields=y,exports.validatorRegistry=s,Object.keys(r).forEach(e=>{"default"===e||Object.prototype.hasOwnProperty.call(exports,e)||Object.defineProperty(exports,e,{enumerable:!0,get:()=>r[e]})});
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|