This commit is contained in:
Meghdad committed 2026-07-10 04:20:13 +03:30
commit 8fe27cfa5e
52 files changed
+5299

No files matched your search

+72
View File
@@ -0,0 +1,72 @@
.nova-form-card {
overflow: hidden;
}
.nova-form-card__form {
display: flex;
flex-direction: column;
min-height: 100%;
}
.nova-form-card__header {
border-bottom: 1px solid rgba(229, 231, 235, 1);
padding: 1rem 1.5rem;
}
.dark .nova-form-card__header {
border-bottom-color: rgba(55, 65, 81, 1);
}
.nova-form-card__title {
font-size: 1rem;
font-weight: 700;
line-height: 1.5rem;
margin: 0;
}
.nova-form-card__fieldset {
border: 0;
margin: 0;
min-width: 0;
padding: 0;
}
.nova-form-card__body {
padding: 0.75rem 0;
}
.nova-form-card__display-field {
padding-left: 1.5rem;
padding-right: 1.5rem;
}
.nova-form-card__footer {
align-items: center;
border-top: 1px solid rgba(229, 231, 235, 1);
display: flex;
justify-content: flex-end;
padding: 1rem 1.5rem;
}
.dark .nova-form-card__footer {
border-top-color: rgba(55, 65, 81, 1);
}
.nova-form-card__fallback-submit {
align-items: center;
background-color: rgb(14, 165, 233);
border-radius: 0.25rem;
color: #fff;
cursor: pointer;
display: inline-flex;
font-size: 0.875rem;
font-weight: 700;
height: 2.25rem;
justify-content: center;
padding: 0 0.75rem;
}
.nova-form-card__fallback-submit:disabled {
cursor: not-allowed;
opacity: 0.65;
}
+1
View File
@@ -0,0 +1 @@
(function(t){"use strict";const d=(r,e)=>{const o=r.__vccOpts||r;for(const[c,i]of e)o[c]=i;return o};class l{constructor(e={}){this.record(e)}all(){return this.errors}has(e){return e?Object.prototype.hasOwnProperty.call(this.errors,e)||Object.keys(this.errors).some(o=>o.startsWith(`${e}.`)||o.startsWith(`${e}[`)):!1}first(e){return this.get(e)[0]}get(e){return this.errors[e]||[]}record(e={}){this.errors=e}clear(e=null){if(!e){this.errors={};return}Object.keys(this.errors).filter(o=>o===e||o.startsWith(`${e}.`)||o.startsWith(`${e}[`)).forEach(o=>delete this.errors[o])}}function m(){return typeof LaravelNova<"u"&&LaravelNova.Errors?LaravelNova.Errors:l}function a(r={}){const e=m();return new e(r)}const u={provide(){return{removeFile:this.removeFile}},props:{card:{type:Object,required:!0}},data(){return{fields:[],errors:a(),processing:!1,formUniqueId:`nova-form-card-${Math.random().toString(36).slice(2)}`}},computed:{form(){return this.card.formCard||{}},resourceName(){return this.card.resourceName||this.form.resourceName||"nova-form-card"},resourceId(){return this.card.resourceId||this.form.resourceId||"form-card"},resource(){return this.form.resource||{}},submitText(){return this.form.submitText||this.translate("nova-form-card.submit","Submit")},loadingText(){return this.translate("nova-form-card.submitting","Submitting...")},canSubmit(){return this.form.canSubmit!==!1},submitDisabled(){return this.processing||!this.canSubmit},syncEndpoint(){if(!this.form.syncEndpoint||!this.form.token)return;const r=this.form.syncEndpoint.includes("?")?"&":"?";return`${this.form.syncEndpoint}${r}token=${encodeURIComponent(this.form.token)}`},buttonComponent(){return this.resolveNovaUi("Button")||"button"},hasNovaButton(){return this.buttonComponent!=="button"},buttonText(){return this.processing&&!this.hasNovaButton?this.loadingText:this.submitText},validationErrors(){return this.errors}},created(){this.syncFields()},watch:{"card.formCard.fields":{deep:!0,handler(){this.syncFields()}}},methods:{syncFields(){this.fields=(this.form.fields||[]).map(r=>({...r}))},componentName(r){return r.prefixComponent===!1?r.component:r.displayOnly?r.component==="line-field"?`index-${r.component}`:`detail-${r.component}`:`form-${r.component}`},fieldComponent(r){const e=this.componentName(r);return this.resolveNovaComponent(e)||e},fieldWrapperClass(r){return{"nova-form-card__display-field":r.displayOnly}},resolveNovaComponent(r){const e=typeof Nova<"u"?Nova.app?._context?.components:null,o=this.$?.appContext?.components||e||{};return o[r]||o[this.camelize(r)]||o[this.upperFirst(this.camelize(r))]},resolveNovaUi(r){return typeof LaravelNovaUi<"u"?LaravelNovaUi[r]:null},camelize(r){return String(r).replace(/-(\w)/g,(e,o)=>o.toUpperCase())},upperFirst(r){return r=String(r),r.charAt(0).toUpperCase()+r.slice(1)},clearFieldError(r){const e=r.validationKey||r.attribute;e&&this.errors&&typeof this.errors.clear=="function"&&this.errors.clear(e)},formDataFromFields(){const r=new FormData;return this.fields.forEach(e=>{if(!e.displayOnly){if(typeof e.fill=="function"){e.fill(r);return}r.append(e.attribute,e.value??"")}}),r},submissionPayload(){const r=new FormData;return r.append("token",this.form.token),this.formDataFromFields().forEach((e,o)=>{r.append(`fields[${o}]`,e)}),r},submit(){this.submitDisabled||(this.processing=!0,this.errors=a(),Nova.request().post(this.form.endpoint,this.submissionPayload()).then(r=>{this.handleResponse(r.data||{})}).catch(r=>{const e=r.response||{};if(e.status===422){this.errors=a(e.data?.errors||{});return}Nova.error(e.data?.message||this.couldNotSubmitMessage())}).finally(()=>{this.processing=!1}))},removeFile(){return Nova.error(this.translate("nova-form-card.could_not_submit","The form could not be submitted.")),Promise.reject(new Error("Form cards do not delete existing files."))},handleResponse(r){if(r.type==="error"){Nova.error(r.message||this.couldNotSubmitMessage());return}if(r.message&&Nova.success(r.message),r.type==="redirect"&&r.redirect?.url){const e=r.redirect;if(e.remote){Nova.visit({url:e.url,remote:!0});return}Nova.visit(e.url,e.options||{});return}r.refresh&&this.refreshPage()},refreshPage(){if(typeof Nova.visit=="function"){Nova.visit(window.location.pathname+window.location.search,{preserveScroll:!0});return}window.location.reload()},couldNotSubmitMessage(){return this.translate("nova-form-card.could_not_submit","The form could not be submitted.")},translate(r,e){if(typeof this.__=="function"){const o=this.__(r);return o===r?e:o}if(typeof window<"u"&&typeof window.__=="function"){const o=window.__(r);return o===r?e:o}if(typeof Nova<"u"&&typeof Nova.__=="function"){const o=Nova.__(r);return o===r?e:o}return e}}},f={class:"nova-form-card bg-white dark:bg-gray-800 rounded-lg shadow"},h={key:0,class:"nova-form-card__header"},p={class:"nova-form-card__title"},b=["disabled"],_={key:0,class:"nova-form-card__body"},y={class:"nova-form-card__footer"};function v(r,e,o,c,i,s){return t.openBlock(),t.createElementLine truncated