@insightphp/forms
Advanced tools
Comparing version 0.2.2 to 0.2.3
@@ -1,10 +0,29 @@ | ||
import { defineComponent as m, openBlock as t, createElementBlock as n, Fragment as u, renderList as d, createTextVNode as i, toDisplayString as s, createCommentVNode as a, createElementVNode as c, createVNode as p, unref as f } from "vue"; | ||
import { Portal as V, ComponentManager as _ } from "@insightphp/inertia-view-components"; | ||
const g = { class: "space-y-6" }, b = ["for"], h = { | ||
import { defineComponent as i, computed as f, openBlock as l, createBlock as _, unref as a, createElementBlock as s, Fragment as b, renderList as V, createTextVNode as g, toDisplayString as d, createCommentVNode as c, createElementVNode as F, createVNode as y } from "vue"; | ||
import { Portal as p, ComponentManager as h } from "@insightphp/inertia-view-components"; | ||
import { useForm as k } from "@inertiajs/inertia-vue3"; | ||
const x = /* @__PURE__ */ i({ | ||
__name: "Form", | ||
props: { | ||
form: null | ||
}, | ||
setup(o) { | ||
const n = o, r = f(() => n.form); | ||
return (m, t) => (l(), _(a(p), { | ||
component: a(r).formModel.renderAs, | ||
modelValue: a(r).form, | ||
"onUpdate:modelValue": t[0] || (t[0] = (e) => a(r).form = e), | ||
errors: a(r).form.errors, | ||
onClearError: t[1] || (t[1] = (e) => a(r).form.clearError(e.name)) | ||
}, null, 8, ["component", "modelValue", "errors"])); | ||
} | ||
}), v = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ | ||
__proto__: null, | ||
default: x | ||
}, Symbol.toStringTag, { value: "Module" })), C = { class: "space-y-6" }, S = ["for"], E = { | ||
key: 0, | ||
class: "text-danger-500" | ||
}, k = { | ||
}, j = { | ||
key: 1, | ||
class: "text-xs text-gray-500 mt-0.5 mb-1" | ||
}, x = { class: "mt-1" }, y = /* @__PURE__ */ m({ | ||
}, M = { class: "mt-1" }, N = /* @__PURE__ */ i({ | ||
__name: "StackedForm", | ||
@@ -16,7 +35,10 @@ props: { | ||
}, | ||
emits: ["input"], | ||
setup(o, { emit: l }) { | ||
return (C, S) => (t(), n("div", g, [ | ||
(t(!0), n(u, null, d(o.items, (e) => (t(), n("div", null, [ | ||
e.label ? (t(), n("label", { | ||
emits: ["input", "clearError"], | ||
setup(o, { emit: n }) { | ||
const r = (m, t) => { | ||
n("input", { name: m.name, value: t }), n("clearError", m.name); | ||
}; | ||
return (m, t) => (l(), s("div", C, [ | ||
(l(!0), s(b, null, V(o.items, (e) => (l(), s("div", null, [ | ||
e.label ? (l(), s("label", { | ||
key: 0, | ||
@@ -26,12 +48,12 @@ for: e.name, | ||
}, [ | ||
i(s(e.label) + " ", 1), | ||
e.isRequired ? (t(), n("span", h, "*")) : a("", !0) | ||
], 8, b)) : a("", !0), | ||
e.hint ? (t(), n("p", k, s(e.hint), 1)) : a("", !0), | ||
c("div", x, [ | ||
p(f(V), { | ||
g(d(e.label) + " ", 1), | ||
e.isRequired ? (l(), s("span", E, "*")) : c("", !0) | ||
], 8, S)) : c("", !0), | ||
e.hint ? (l(), s("p", j, d(e.hint), 1)) : c("", !0), | ||
F("div", M, [ | ||
y(a(p), { | ||
component: e.fieldView, | ||
name: e.name, | ||
modelValue: o.modelValue[e.name], | ||
"onUpdate:modelValue": (r) => o.modelValue[e.name] = r, | ||
"onUpdate:modelValue": (u) => o.modelValue[e.name] = u, | ||
"inertia-form": o.modelValue, | ||
@@ -42,3 +64,4 @@ errors: o.errors, | ||
required: e.isRequired, | ||
onInput: (r) => l("input", { name: e.name, value: r }) | ||
onInput: (u) => r(e, u), | ||
class: "w-full" | ||
}, null, 8, ["component", "name", "modelValue", "onUpdate:modelValue", "inertia-form", "errors", "error", "required", "onInput"]) | ||
@@ -49,10 +72,10 @@ ]) | ||
} | ||
}), v = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ | ||
}), O = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ | ||
__proto__: null, | ||
default: y | ||
}, Symbol.toStringTag, { value: "Module" })), q = { | ||
install(o, l) { | ||
_.registerComponentsInNamespace( | ||
/* @__PURE__ */ Object.assign({ "./ViewComponents/StackedForm.vue": v }), | ||
"./ViewComponents", | ||
default: N | ||
}, Symbol.toStringTag, { value: "Module" })), P = { | ||
install(o, n) { | ||
h.registerComponentsInNamespace( | ||
/* @__PURE__ */ Object.assign({ "./Components/Form.vue": v, "./Components/StackedForm.vue": O }), | ||
"./Components", | ||
"insight-forms" | ||
@@ -62,5 +85,19 @@ ); | ||
}; | ||
function T(o, n) { | ||
const r = k(o.initialValue); | ||
return { | ||
submit: () => { | ||
o.method && o.action && r.submit(o.method, o.action, n); | ||
}, | ||
form: { | ||
form: r, | ||
formModel: o | ||
} | ||
}; | ||
} | ||
export { | ||
q as Forms, | ||
y as StackedForm | ||
x as Form, | ||
P as Forms, | ||
N as StackedForm, | ||
T as useForm | ||
}; |
@@ -1,1 +0,1 @@ | ||
(function(t,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue"),require("@insightphp/inertia-view-components")):typeof define=="function"&&define.amd?define(["exports","vue","@insightphp/inertia-view-components"],e):(t=typeof globalThis<"u"?globalThis:t||self,e(t.Forms={},t.Vue,t.InertiaViewComponents))})(this,function(t,e,l){"use strict";const i={class:"space-y-6"},c=["for"],d={key:0,class:"text-danger-500"},m={key:1,class:"text-xs text-gray-500 mt-0.5 mb-1"},p={class:"mt-1"},a=e.defineComponent({__name:"StackedForm",props:{items:null,modelValue:null,errors:null},emits:["input"],setup(o,{emit:s}){return(k,V)=>(e.openBlock(),e.createElementBlock("div",i,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.items,n=>(e.openBlock(),e.createElementBlock("div",null,[n.label?(e.openBlock(),e.createElementBlock("label",{key:0,for:n.name,class:"block text-sm font-medium text-gray-700"},[e.createTextVNode(e.toDisplayString(n.label)+" ",1),n.isRequired?(e.openBlock(),e.createElementBlock("span",d,"*")):e.createCommentVNode("",!0)],8,c)):e.createCommentVNode("",!0),n.hint?(e.openBlock(),e.createElementBlock("p",m,e.toDisplayString(n.hint),1)):e.createCommentVNode("",!0),e.createElementVNode("div",p,[e.createVNode(e.unref(l.Portal),{component:n.fieldView,name:n.name,modelValue:o.modelValue[n.name],"onUpdate:modelValue":r=>o.modelValue[n.name]=r,"inertia-form":o.modelValue,errors:o.errors,error:o.errors[n.name],"field-path":[],required:n.isRequired,onInput:r=>s("input",{name:n.name,value:r})},null,8,["component","name","modelValue","onUpdate:modelValue","inertia-form","errors","error","required","onInput"])])]))),256))]))}}),u=Object.freeze(Object.defineProperty({__proto__:null,default:a},Symbol.toStringTag,{value:"Module"})),f={install(o,s){l.ComponentManager.registerComponentsInNamespace(Object.assign({"./ViewComponents/StackedForm.vue":u}),"./ViewComponents","insight-forms")}};t.Forms=f,t.StackedForm=a,Object.defineProperties(t,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}); | ||
(function(r,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue"),require("@insightphp/inertia-view-components"),require("@inertiajs/inertia-vue3")):typeof define=="function"&&define.amd?define(["exports","vue","@insightphp/inertia-view-components","@inertiajs/inertia-vue3"],e):(r=typeof globalThis<"u"?globalThis:r||self,e(r.Forms={},r.Vue,r.InertiaViewComponents,r.InertiaVue))})(this,function(r,e,i,u){"use strict";const c=e.defineComponent({__name:"Form",props:{form:null},setup(n){const l=n,t=e.computed(()=>l.form);return(s,a)=>(e.openBlock(),e.createBlock(e.unref(i.Portal),{component:e.unref(t).formModel.renderAs,modelValue:e.unref(t).form,"onUpdate:modelValue":a[0]||(a[0]=o=>e.unref(t).form=o),errors:e.unref(t).form.errors,onClearError:a[1]||(a[1]=o=>e.unref(t).form.clearError(o.name))},null,8,["component","modelValue","errors"]))}}),p=Object.freeze(Object.defineProperty({__proto__:null,default:c},Symbol.toStringTag,{value:"Module"})),f={class:"space-y-6"},_=["for"],k={key:0,class:"text-danger-500"},V={key:1,class:"text-xs text-gray-500 mt-0.5 mb-1"},g={class:"mt-1"},d=e.defineComponent({__name:"StackedForm",props:{items:null,modelValue:null,errors:null},emits:["input","clearError"],setup(n,{emit:l}){const t=(s,a)=>{l("input",{name:s.name,value:a}),l("clearError",s.name)};return(s,a)=>(e.openBlock(),e.createElementBlock("div",f,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(n.items,o=>(e.openBlock(),e.createElementBlock("div",null,[o.label?(e.openBlock(),e.createElementBlock("label",{key:0,for:o.name,class:"block text-sm font-medium text-gray-700"},[e.createTextVNode(e.toDisplayString(o.label)+" ",1),o.isRequired?(e.openBlock(),e.createElementBlock("span",k,"*")):e.createCommentVNode("",!0)],8,_)):e.createCommentVNode("",!0),o.hint?(e.openBlock(),e.createElementBlock("p",V,e.toDisplayString(o.hint),1)):e.createCommentVNode("",!0),e.createElementVNode("div",g,[e.createVNode(e.unref(i.Portal),{component:o.fieldView,name:o.name,modelValue:n.modelValue[o.name],"onUpdate:modelValue":m=>n.modelValue[o.name]=m,"inertia-form":n.modelValue,errors:n.errors,error:n.errors[o.name],"field-path":[],required:o.isRequired,onInput:m=>t(o,m),class:"w-full"},null,8,["component","name","modelValue","onUpdate:modelValue","inertia-form","errors","error","required","onInput"])])]))),256))]))}}),b=Object.freeze(Object.defineProperty({__proto__:null,default:d},Symbol.toStringTag,{value:"Module"})),h={install(n,l){i.ComponentManager.registerComponentsInNamespace(Object.assign({"./Components/Form.vue":p,"./Components/StackedForm.vue":b}),"./Components","insight-forms")}};function y(n,l){const t=u.useForm(n.initialValue);return{submit:()=>{n.method&&n.action&&t.submit(n.method,n.action,l)},form:{form:t,formModel:n}}}r.Form=c,r.Forms=h,r.StackedForm=d,r.useForm=y,Object.defineProperties(r,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}); |
import Forms from "./plugin"; | ||
import type { PluginOptions as FormsPluginOptions } from "./plugin"; | ||
export * from './ViewComponents'; | ||
export * from './Components'; | ||
export * from './Composables'; | ||
export * from './contracts'; | ||
export { Forms, FormsPluginOptions }; |
{ | ||
"name": "@insightphp/forms", | ||
"version": "0.2.2", | ||
"version": "0.2.3", | ||
"description": "Forms component of Insight.", | ||
@@ -5,0 +5,0 @@ "repository": { |
import Forms from "./plugin"; | ||
import type { PluginOptions as FormsPluginOptions } from "./plugin"; | ||
export * from './ViewComponents' | ||
export * from './Components' | ||
export * from './Composables' | ||
export * from './contracts' | ||
@@ -6,0 +8,0 @@ export { |
@@ -11,5 +11,5 @@ import type { App } from "vue"; | ||
ComponentManager.registerComponentsInNamespace( | ||
import.meta.globEager('./ViewComponents/**/*.vue'), './ViewComponents', 'insight-forms', | ||
import.meta.globEager('./Components/**/*.vue'), './Components', 'insight-forms', | ||
) | ||
} | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
14440
20
262
1