Skip to content

Commit

Permalink
Merge pull request #20 from razorcreations/release/1.2.2
Browse files Browse the repository at this point in the history
Release/1.2.2
  • Loading branch information
garygarside authored Nov 6, 2024
2 parents 9c759ca + 070fac6 commit 9694aff
Show file tree
Hide file tree
Showing 7 changed files with 5,857 additions and 9,613 deletions.
29 changes: 15 additions & 14 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
module.exports = {
extends: [
"eslint:recommended",
"plugin:vue/essential"
],
"globals": {
"Nova": true,
"store": true,
},
rules: {
root: true,
extends: [
"eslint:recommended",
"plugin:vue/essential"
],
"globals": {
"Nova": true,
"store": true,
},
rules: {
// override/add rules settings here...
"indent": ["error", "tab"]
},
env: {
node: true,
},
"indent": ["error", "tab"]
},
env: {
node: true,
},
}
5 changes: 5 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## 1.2.2 - 2024-11-06

- Fix to vue-select 3.x returning an instance of the event on change, rather than the updated value
- `root` declaration on eslint config to fix deprecation warnings

## 1.2.1 - 2024-11-05

- Remove Nova secrets from being required in the CI runner action during Composer setup
Expand Down
101 changes: 53 additions & 48 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,53 +1,58 @@
{
"name": "razorcreations/ajax-field",
"description": "A searchable AJAX powered field for Laravel Nova.",
"version": "1.2.0",
"authors": [
{
"name": "Ross Cooper",
"email": "[email protected]",
"homepage": "http://www.razorcreations.com",
"role": "Developer"
},

{
"name": "Tom Stowe",
"email": "[email protected]",
"homepage": "http://www.razorcreations.com",
"role": "Developer"
}
],
"keywords": [
"laravel",
"nova",
"field",
"ajax"
],
"license": "MIT",
"require": {
"php": "^7.3|^8.0"
},
"autoload": {
"psr-4": {
"Razorcreations\\AjaxField\\": "src/"
}
},
"extra": {
"laravel": {
"providers": [
"Razorcreations\\AjaxField\\FieldServiceProvider"
]
}
},
"config": {
"sort-packages": true
},
"minimum-stability": "dev",
"prefer-stable": true,
"require-dev": {
"friendsofphp/php-cs-fixer": "^3.8"
"name": "razorcreations/ajax-field",
"description": "A searchable AJAX powered field for Laravel Nova 3 and 4.",
"version": "1.2.2",
"authors": [
{
"name": "Ross Cooper",
"email": "[email protected]",
"homepage": "http://www.razorcreations.com",
"role": "Developer"
},
{
"name": "Tom Stowe",
"email": "[email protected]",
"homepage": "http://www.razorcreations.com",
"role": "Developer"
},
{
"name": "Gary Garside",
"email": "[email protected]",
"homepage": "http://www.razorcreations.com",
"role": "Developer"
}
],
"keywords": [
"laravel",
"nova",
"field",
"ajax"
],
"license": "MIT",
"require": {
"php": "^7.3|^8.0"
},
"scripts": {
"autoload": {
"psr-4": {
"Razorcreations\\AjaxField\\": "src/"
}
},
"extra": {
"laravel": {
"providers": [
"Razorcreations\\AjaxField\\FieldServiceProvider"
]
}
},
"config": {
"sort-packages": true
},
"minimum-stability": "dev",
"prefer-stable": true,
"require-dev": {
"friendsofphp/php-cs-fixer": "^3.8"
},
"scripts": {
"fix": "./vendor/bin/php-cs-fixer fix",
"lint": "./vendor/bin/php-cs-fixer fix --dry-run"
}
Expand Down
23 changes: 19 additions & 4 deletions resources/js/components/FormField.vue
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,9 @@ export default {
},
},
mounted() {
mounted () {
this.parseInitialValue();
if (this.parentComponent) {
this.parentComponent.$watch('value', (value) => {
this.parentVal = value;
Expand Down Expand Up @@ -146,8 +147,10 @@ export default {
this.selectedOptions.push(option);
}
})
return;
}
if (this.value == option.value) {
this.selectedOptions.push(option);
}
Expand All @@ -161,7 +164,9 @@ export default {
* Dynamic search with the input value
*/
search: window._.debounce((loading, searchVal, vm) => {
let url = vm.buildParamString(searchVal)
loading(true);
let url = vm.buildParamString(searchVal);
window.Nova.request().get(url).then(({ data }) => {
vm.options = data;
vm.cacheOptions(data);
Expand All @@ -187,13 +192,13 @@ export default {
if (input.length < 3 && !/^\d+$/.test(input)) {
return;
}
loading(true);
this.search(loading, input, this);
},
reduceOption(option) {
const valueKey = this.field.valueKey || 'value';
return option ? option[valueKey] : null;
},
Expand All @@ -220,10 +225,12 @@ export default {
parseInitialValue() {
let value = this.field.value ? this.field.value : null;
if (!value) {
this.value = value;
return;
}
if (!this.field.multiple) {
value = this._parseValue(value);
} else {
Expand All @@ -232,36 +239,44 @@ export default {
}
!value[0] ? value = [] : value = value.map(this._parseValue);
}
this.value = value;
},
_parseValue(value) {
if (this.field.type === 'int') {
value = parseInt(value);
}
if (this.field.type === 'float') {
value = parseFloat(value);
}
return value;
},
inputSelected(value) {
inputSelected () {
const value = this.value;
if (!value) {
return;
}
if (Array.isArray(value)) {
value.forEach(v => {
if (!v) {
return;
}
const selectedOption = this.optionsCache.find(option => option.value === v);
if (selectedOption) {
this.selectedOptions.push(selectedOption);
}
});
} else {
const selectedOption = this.optionsCache.find(option => option.value === value);
if (selectedOption) {
this.selectedOptions.push(selectedOption);
}
Expand Down
2 changes: 1 addition & 1 deletion version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.2.1
1.2.2
26 changes: 13 additions & 13 deletions webpack.mix.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
let mix = require('laravel-mix')

mix.setPublicPath('dist')
.js('resources/js/field.js', 'js')
.vue({version: 3})
.webpackConfig({
externals: {
vue: 'Vue',
},
output: {
uniqueName: 'spatie/nova-ajax-field',
},
resolve: {
symlinks: false
}
})
.js('resources/js/field.js', 'js')
.vue({version: 3})
.webpackConfig({
externals: {
vue: 'Vue',
},
output: {
uniqueName: 'spatie/nova-ajax-field',
},
resolve: {
symlinks: false
}
})
Loading

0 comments on commit 9694aff

Please sign in to comment.