-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #19 from the-alichemist/nova-4-upgrade
Nova 4 upgrade Very big thanks to @the-alichemist
- Loading branch information
Showing
16 changed files
with
356 additions
and
259 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
@import url(https://unpkg.com/tailwindcss@^2/dist/tailwind.min.css); | ||
|
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
/*! | ||
* vuex v4.0.2 | ||
* (c) 2021 Evan You | ||
* @license MIT | ||
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
{ | ||
"/js/tool.js": "/js/tool.js?id=e49fc7b7e737d1ce30aa", | ||
"/css/tool.css": "/css/tool.css?id=d41d8cd98f00b204e980" | ||
} | ||
"/js/tool.js": "/js/tool.js", | ||
"/css/tool.css": "/css/tool.css" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
const mix = require('laravel-mix') | ||
const webpack = require('webpack') | ||
const path = require('path') | ||
|
||
class NovaExtension { | ||
name() { | ||
return 'nova-extension' | ||
} | ||
|
||
register(name) { | ||
this.name = name | ||
} | ||
|
||
webpackConfig(webpackConfig) { | ||
webpackConfig.externals = { | ||
vue: 'Vue', | ||
} | ||
|
||
webpackConfig.resolve.alias = { | ||
...(webpackConfig.resolve.alias || {}), | ||
'laravel-nova': path.join( | ||
__dirname, | ||
'../../vendor/laravel/nova/resources/js/mixins/packages.js' | ||
), | ||
} | ||
|
||
webpackConfig.output = { | ||
uniqueName: this.name, | ||
} | ||
} | ||
} | ||
|
||
mix.extend('nova', new NovaExtension()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,127 +1,130 @@ | ||
<template> | ||
<div :class="elementSize"> | ||
<field-wrapper :stacked="field.stacked"> | ||
<div class="px-8" :class="field.stacked ? 'pt-6 w-full' : 'py-6 w-1/5'"> | ||
<slot> | ||
<form-label | ||
:label-for="field.attribute" | ||
:class="{ 'mb-2': showHelpText && field.helpText }" | ||
> | ||
{{ fieldLabel }} | ||
|
||
<span v-if="field.required" class="text-danger text-sm">{{ | ||
__('*') | ||
}}</span> | ||
</form-label> | ||
</slot> | ||
</div> | ||
<div class="py-6 px-8" :class="fieldClasses"> | ||
<slot name="field"/> | ||
|
||
<help-text | ||
class="error-text mt-2 text-danger" | ||
v-if="showErrors && hasError" | ||
> | ||
{{ firstError }} | ||
</help-text> | ||
|
||
<help-text class="help-text mt-2" v-if="showHelpText"> | ||
{{ field.helpText }} | ||
</help-text> | ||
</div> | ||
</field-wrapper> | ||
</div> | ||
<div :class="elementSize"> | ||
<field-wrapper :stacked="field.stacked"> | ||
<div class="px-8" :class="field.stacked ? 'pt-6 w-full' : 'py-6 w-1/5'"> | ||
<slot> | ||
<form-label | ||
:label-for="field.attribute" | ||
:class="{ 'mb-2': showHelpText && field.helpText }" | ||
> | ||
{{ fieldLabel }} | ||
|
||
<span v-if="field.required" class="text-danger text-sm">{{ | ||
__("*") | ||
}}</span> | ||
</form-label> | ||
</slot> | ||
</div> | ||
<div class="py-6 px-8" :class="fieldClasses"> | ||
<slot name="field" /> | ||
|
||
<help-text | ||
class="error-text mt-2 text-danger" | ||
v-if="showErrors && hasError" | ||
> | ||
{{ firstError }} | ||
</help-text> | ||
|
||
<help-text class="help-text mt-2" v-if="showHelpText"> | ||
{{ field.helpText }} | ||
</help-text> | ||
</div> | ||
</field-wrapper> | ||
</div> | ||
</template> | ||
|
||
<script> | ||
import {HandlesValidationErrors, Errors} from 'laravel-nova' | ||
export default { | ||
mixins: [HandlesValidationErrors], | ||
props: { | ||
field: {type: Object, required: true}, | ||
fieldName: {type: String}, | ||
showHelpText: {type: Boolean, default: true}, | ||
showErrors: {type: Boolean, default: true}, | ||
fullWidthContent: {type: Boolean, default: false}, | ||
}, | ||
mounted() { | ||
// If field has a size, this allows to use flex on card | ||
if(this.hasSize) { | ||
this.$parent.$parent.$el.classList.add('flex-dom') | ||
this.$parent.$parent.$el.classList.add('flex-wrap') | ||
this.$parent.$parent.$el.classList.add('flex') | ||
// Use for eminiarts/nova-tabs package | ||
if(document.getElementsByClassName('relationship-tabs-panel')){ | ||
var tabs = document.getElementsByClassName('relationship-tabs-panel') | ||
for(var i = 0; i < tabs.length; i++) { | ||
tabs.item(i).className += " w-full" | ||
} | ||
this.$parent.$el.parentElement.classList.add('flex') | ||
this.$parent.$el.parentElement.classList.add('flex-wrap') | ||
} | ||
if(document.getElementsByClassName('action').length > 0){ | ||
document.getElementsByClassName('action').item(0).parentElement.classList.add('flex') | ||
document.getElementsByClassName('action').item(0).parentElement.classList.add('flex-wrap') | ||
} | ||
} | ||
if(this.getRemoveBottomBorder === true){ | ||
this.$el.children[0].classList.add('remove-bottom-border') | ||
} else if(this.getRemoveBottomBorder === false){ | ||
this.$el.children[0].classList.remove('remove-bottom-border') | ||
} | ||
}, | ||
computed: { | ||
/** | ||
* Return the label that should be used for the field. | ||
*/ | ||
fieldLabel() { | ||
// If the field name is purposefully an empty string, then let's show it as such | ||
if (this.fieldName === '') { | ||
return '' | ||
} | ||
return this.fieldName || this.field.name || this.field.singularLabel | ||
}, | ||
/** | ||
* Return the classes that should be used for the field content. | ||
*/ | ||
fieldClasses() { | ||
return this.fullWidthContent | ||
? this.field.stacked | ||
? 'w-full' | ||
: 'w-4/5' | ||
: this.hasSize | ||
? 'w-full' | ||
: 'w-1/2' | ||
}, | ||
/** | ||
* Return the size that should be used for the field container. | ||
*/ | ||
elementSize() { | ||
return this.field.size || 'w-full' | ||
}, | ||
/** | ||
* Return if the field has a size | ||
*/ | ||
hasSize() { | ||
return this.field.size !== undefined; | ||
}, | ||
/** | ||
* Return if we must to remove or not the bottom border field | ||
*/ | ||
getRemoveBottomBorder() { | ||
return this.field.removeBottomBorder || null | ||
} | ||
}, | ||
import { HandlesValidationErrors, Errors } from "laravel-nova"; | ||
export default { | ||
mixins: [HandlesValidationErrors], | ||
props: { | ||
field: { type: Object, required: true }, | ||
fieldName: { type: String }, | ||
showHelpText: { type: Boolean, default: true }, | ||
showErrors: { type: Boolean, default: true }, | ||
fullWidthContent: { type: Boolean, default: false }, | ||
}, | ||
mounted() { | ||
if (!this.hasSize) { | ||
this.$el.parentElement.classList.add("w-full"); | ||
} | ||
// If field has a size, this allows to use flex on card | ||
if (this.hasSize & this.$parent.$parent.$parent.selectedTab === undefined) { | ||
this.$parent.$parent.$el.classList.add("flex-dom"); | ||
this.$parent.$parent.$el.classList.add("flex-wrap"); | ||
this.$parent.$parent.$el.classList.add("flex"); | ||
} | ||
//Use for eminiarts/nova-tabs package | ||
if ( | ||
this.hasSize & | ||
(this.$parent.$parent.$parent.selectedTab !== undefined) | ||
) { | ||
this.$el.classList.add("inline-block"); | ||
} | ||
if (this.getRemoveBottomBorder === true) { | ||
this.$el.children[0].classList.add("remove-bottom-border"); | ||
} else if (this.getRemoveBottomBorder === false) { | ||
this.$el.children[0].classList.remove("remove-bottom-border"); | ||
} | ||
}, | ||
computed: { | ||
/** | ||
* Return the label that should be used for the field. | ||
*/ | ||
fieldLabel() { | ||
// If the field name is purposefully an empty string, then let's show it as such | ||
if (this.fieldName === "") { | ||
return ""; | ||
} | ||
return this.fieldName || this.field.name || this.field.singularLabel; | ||
}, | ||
/** | ||
* Return the classes that should be used for the field content. | ||
*/ | ||
fieldClasses() { | ||
return this.fullWidthContent | ||
? this.field.stacked | ||
? "w-full" | ||
: "w-4/5" | ||
: this.hasSize | ||
? "w-full" | ||
: "w-1/2"; | ||
}, | ||
/** | ||
* Return the size that should be used for the field container. | ||
*/ | ||
elementSize() { | ||
return this.field.size || "w-full"; | ||
}, | ||
/** | ||
* Return if the field has a size | ||
*/ | ||
hasSize() { | ||
return this.field.size !== undefined; | ||
}, | ||
/** | ||
* Return if we must to remove or not the bottom border field | ||
*/ | ||
getRemoveBottomBorder() { | ||
return this.field.removeBottomBorder || null; | ||
}, | ||
}, | ||
}; | ||
</script> |
Oops, something went wrong.