Skip to content

Commit

Permalink
Add dependsOn support
Browse files Browse the repository at this point in the history
Co-Authored-By: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
  • Loading branch information
YouneselBarnoussi and dependabot[bot] committed Mar 21, 2023
1 parent 2d7151d commit d803a4e
Show file tree
Hide file tree
Showing 8 changed files with 29,056 additions and 55 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"license": "MIT",
"require": {
"php": ">=7.4",
"laravel/framework": "^8.0|^9.0",
"laravel/framework": "^8.0|^9.0|^10.0",
"laravel/nova": "^4.0",
"spatie/laravel-medialibrary": "^8.0|^9.0|^10.0"
},
Expand Down
29,012 changes: 29,010 additions & 2 deletions dist/js/field.js

Large diffs are not rendered by default.

11 changes: 11 additions & 0 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -322,3 +322,14 @@ Files::make('Multiple files', 'multiple_files')
- Replaced [vuejs-clipper](https://www.npmjs.com/package/vuejs-clipper) with [vue-advanced-cropper](https://www.npmjs.com/package/vue-advanced-cropper) for vue3 support

Full change log in [PR #317](https://github.com/ebess/advanced-nova-media-library/pull/317)

# How to contribute

- You need to have Nova installed of course in your Laravel app
- Work directly in the package in the `vendor` directory (webpack needs Nova to be installed)
- Then from the `vendor/xxx/advanced-nova-media-library` folder:
- `yarn install`
- `yarn npm watch`
- Work hard 🤘
- `yarn npm production` when job is finished
- Make a PR
15 changes: 5 additions & 10 deletions resources/js/components/Gallery.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,9 @@
:configs="field.croppingConfigs"
/>

<template v-if="draggable"

></template>

<draggable v-if="images.length > 0" v-model="images"
class="gallery-list clearfix">

<draggable v-if="images.length > 0" v-model="images" class="gallery-list clearfix">
<template #item="{element, index}">
<div style="float:left;">
<div style="float:left; margin-right: 1em;">
<component :is="singleComponent" class="mb-3 p-3 mr-3"
:key="index" :image="element" :field="field" :editable="editable" :removable="removable || editable" @remove="remove(index)"
:is-custom-properties-editable="customProperties && customPropertiesFields.length > 0"
Expand All @@ -33,12 +27,13 @@
/>
</div>
</template>

</draggable>

<span v-else-if="!editable" class="mr-3">&mdash;</span>

<span v-if="editable" class="form-file">
<br style="clear: both" />

<span v-if="editable" class="">
<input :id="`__media__${field.attribute}`" :multiple="multiple" ref="file" class="form-file-input" type="file" :disabled="uploading" @change="add"/>
<label :for="`__media__${field.attribute}`" class="">
<DefaultButton type="button" @click.prevent="focusFileInput">
Expand Down
4 changes: 2 additions & 2 deletions resources/js/components/SingleFile.vue
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@
{{ image.file_name }}
</span>
<a v-if="isCustomPropertiesEditable" class="edit edit--file ml-2" href="#" @click.prevent="$emit('edit-custom-properties')">
<icon type="edit" view-box="0 0 20 20" width="16" height="16" />
<icon type="pencil" view-box="0 0 20 20" width="16" height="16" />
</a>
<a v-if="removable" class="delete ml-2" href="#" @click.prevent="$emit('remove')">
<icon type="delete" view-box="0 0 20 20" width="16" height="16" />
<icon type="trash" view-box="0 0 20 20" width="16" height="16" />
</a>
</div>
</gallery-item>
Expand Down
6 changes: 3 additions & 3 deletions resources/js/components/fields/FormField.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<template>
<component :is="field.fullSize ? 'FullWidthField' : 'DefaultField'" :field="field" :errors="errors" :show-help-text="showHelpText">
<component :is="field.fullSize ? 'FullWidthField' : 'DefaultField'" :field="currentField" :errors="errors" :show-help-text="showHelpText">
<template #field>
<div :class="{'px-8 pt-6': field.fullSize}">
<gallery slot="value" ref="gallery" v-if="hasSetInitialValue"
Expand All @@ -24,15 +24,15 @@
</template>

<script>
import {FormField, HandlesValidationErrors} from 'laravel-nova';
import {DependentFormField, HandlesValidationErrors} from 'laravel-nova';
import Gallery from '../Gallery';
import FullWidthField from '../FullWidthField';
import ExistingMedia from '../ExistingMedia';
import objectToFormData from 'object-to-formdata';
import get from 'lodash/get';
export default {
mixins: [FormField, HandlesValidationErrors],
mixins: [DependentFormField, HandlesValidationErrors],
components: {
Gallery,
FullWidthField,
Expand Down
3 changes: 2 additions & 1 deletion src/Fields/Media.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

use Illuminate\Support\Carbon;
use Laravel\Nova\Fields\Field;
use Laravel\Nova\Fields\SupportsDependentFields;
use Spatie\MediaLibrary\HasMedia;
use Illuminate\Support\Collection;
use Illuminate\Contracts\Validation\Rule;
Expand All @@ -16,7 +17,7 @@

class Media extends Field
{
use HandlesCustomPropertiesTrait, HandlesConversionsTrait, HandlesExistingMediaTrait;
use HandlesCustomPropertiesTrait, HandlesConversionsTrait, HandlesExistingMediaTrait, SupportsDependentFields;

public $component = 'advanced-media-library-field';

Expand Down
58 changes: 22 additions & 36 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1628,11 +1628,6 @@ babel-plugin-polyfill-regenerator@^0.3.0:
dependencies:
"@babel/helper-define-polyfill-provider" "^0.3.1"

babel-plugin-syntax-jsx@^6.18.0:
version "6.18.0"
resolved "https://registry.yarnpkg.com/babel-plugin-syntax-jsx/-/babel-plugin-syntax-jsx-6.18.0.tgz#0af32a9a6e13ca7a3fd5069e62d7b0f58d0d8946"
integrity sha1-CvMqmm4Tyno/1QaeYtew9Y0NiUY=

balanced-match@^1.0.0:
version "1.0.2"
resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-1.0.2.tgz#e83e3a7e3f300b34cb9d87f615fa0cbf357690ee"
Expand Down Expand Up @@ -2364,9 +2359,9 @@ debug@^4.1.0, debug@^4.1.1:
ms "2.1.2"

decode-uri-component@^0.2.0:
version "0.2.0"
resolved "https://registry.yarnpkg.com/decode-uri-component/-/decode-uri-component-0.2.0.tgz#eb3913333458775cb84cd1a1fae062106bb87545"
integrity sha1-6zkTMzRYd1y4TNGh+uBiEGu4dUU=
version "0.2.2"
resolved "https://registry.yarnpkg.com/decode-uri-component/-/decode-uri-component-0.2.2.tgz#e69dbe25d37941171dd540e024c444cd5188e1e9"
integrity sha512-FqUYQ+8o158GyGTrMFJms9qh3CqTKvAqgqsTnkLI8sKu0028orqBhxNMFkFen0zGyg6epACD32pjVk58ngIErQ==

deepmerge@^4.0.0:
version "4.2.2"
Expand Down Expand Up @@ -2796,7 +2791,7 @@ follow-redirects@^1.0.0, follow-redirects@^1.14.0, follow-redirects@^1.14.8:
resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.14.9.tgz#dd4ea157de7bfaf9ea9b3fbd85aa16951f78d8d7"
integrity sha512-MQDfihBQYMcyy5dhRDJUHcw7lb2Pv/TuE6xP1vyraLukNDHKbDxDNaOE3NbCAdKQApno+GPRyo1YAp89yCjK4w==

form-backend-validation@^2.3.3, form-backend-validation@^2.4.0:
form-backend-validation@^2.4.0:
version "2.4.0"
resolved "https://registry.yarnpkg.com/form-backend-validation/-/form-backend-validation-2.4.0.tgz#9ef53d1dc5a25738adffb622ebdd22ea0f9edb66"
integrity sha512-/AUVPYEqgWarqmMx/oe3AipthX18VzA7APZwvyweXDMvdZvKv4ClGakwLLz0NqeWweyhyiPg6et92Fepv2KTNA==
Expand Down Expand Up @@ -3171,11 +3166,6 @@ import-local@^3.0.2:
pkg-dir "^4.2.0"
resolve-cwd "^3.0.0"

inflector-js@^1.0.1:
version "1.0.1"
resolved "https://registry.yarnpkg.com/inflector-js/-/inflector-js-1.0.1.tgz#8f2b8dae06ba8c1a846e40a196a5e132721be0e0"
integrity sha1-jyuNrga6jBqEbkChlqXhMnIb4OA=

inflight@^1.0.4:
version "1.0.6"
resolved "https://registry.yarnpkg.com/inflight/-/inflight-1.0.6.tgz#49bd6331d7d02d0c09bc910a1075ba8165b56df9"
Expand Down Expand Up @@ -3349,9 +3339,9 @@ json-schema-traverse@^1.0.0:
integrity sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==

json5@^1.0.1:
version "1.0.1"
resolved "https://registry.yarnpkg.com/json5/-/json5-1.0.1.tgz#779fb0018604fa854eacbf6252180d83543e3dbe"
integrity sha512-aKS4WQjPenRxiQsC93MNfjx+nbF4PAdYzmd/1JIj8HYzqfbu86beTuNgXDzPknWk0n0uARlyewZo4s++ES36Ow==
version "1.0.2"
resolved "https://registry.yarnpkg.com/json5/-/json5-1.0.2.tgz#63d98d60f21b313b77c4d6da18bfa69d80e1d593"
integrity sha512-g1MWMLBiz8FKi1e4w0UyVL3w+iJceWAFBAaBnnGKOpNa5f8TLktkbre1+s6oICydWAm+HRUGTmI+//xv2hvXYA==
dependencies:
minimist "^1.2.0"

Expand Down Expand Up @@ -3440,15 +3430,6 @@ laravel-mix@^6.0:
webpackbar "^5.0.0-3"
yargs "^17.2.1"

laravel-nova@^1.0.9:
version "1.12.3"
resolved "https://registry.yarnpkg.com/laravel-nova/-/laravel-nova-1.12.3.tgz#01a24339dcbc674738c686dfa2b6c8108e2fb540"
integrity sha512-mK0z8pGmMCc6AYpvB7hBJM1VCgQo4t0w4LsLXkEyk6dsngGdgtSJPE/TpieiEStzg1pve9AShsUWwKTjSl6Ygw==
dependencies:
babel-plugin-syntax-jsx "^6.18.0"
form-backend-validation "^2.3.3"
inflector-js "^1.0.1"

laravel-vapor@^0.4.0:
version "0.4.2"
resolved "https://registry.yarnpkg.com/laravel-vapor/-/laravel-vapor-0.4.2.tgz#78bf3512d624f32a4a96efc14adf5331e2e9dd53"
Expand All @@ -3472,9 +3453,9 @@ loader-runner@^4.2.0:
integrity sha512-3R/1M+yS3j5ou80Me59j7F9IMs4PXs3VqRrm0TU3AbKPxlmpoY1TNscJV/oGJXo8qCatFGTfDbY6W6ipGOYXfg==

loader-utils@^1.0.1, loader-utils@^1.0.2, loader-utils@^1.1.0:
version "1.4.0"
resolved "https://registry.yarnpkg.com/loader-utils/-/loader-utils-1.4.0.tgz#c579b5e34cb34b1a74edc6c1fb36bfa371d5a613"
integrity sha512-qH0WSMBtn/oHuwjy/NucEgbx5dbxxnxup9s4PVXJUDHZBQY+s0NWA9rJf53RBnQZxfch7euUui7hpoAPvALZdA==
version "1.4.2"
resolved "https://registry.yarnpkg.com/loader-utils/-/loader-utils-1.4.2.tgz#29a957f3a63973883eb684f10ffd3d151fec01a3"
integrity sha512-I5d00Pd/jwMD2QCduo657+YM/6L3KZu++pmX9VFncxaxvHcru9jx1lBaFft+r4Mt2jK0Yhp41XlRAihzPxHNCg==
dependencies:
big.js "^5.2.2"
emojis-list "^3.0.0"
Expand Down Expand Up @@ -3751,10 +3732,15 @@ minimatch@^3.0.4:
dependencies:
brace-expansion "^1.1.7"

minimist@^1.2.0, minimist@^1.2.6:
version "1.2.6"
resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.6.tgz#8637a5b759ea0d6e98702cfb3a9283323c93af44"
integrity sha512-Jsjnk4bw3YJqYzbdyBiNsPWHPfO++UGG749Cxs6peCu5Xg4nrena6OVxOYxrQTqww0Jmwt+Ref8rggumkTLz9Q==
minimist@^1.2.0:
version "1.2.8"
resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.8.tgz#c1a464e7693302e082a075cee0c057741ac4772c"
integrity sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==

minimist@^1.2.6:
version "1.2.7"
resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.7.tgz#daa1c4d91f507390437c6a8bc01078e7000c4d18"
integrity sha512-bzfL1YUZsP41gmu/qjrEk0Q6i2ix/cVeAhbCbqH9u3zYutS1cLg00qhrD0M2MVdCcx4Sc0UpP2eBWo9rotpq6g==

mkdirp@^0.5.5:
version "0.5.6"
Expand Down Expand Up @@ -5180,9 +5166,9 @@ terser-webpack-plugin@^5.1.3, terser-webpack-plugin@^5.2.4:
terser "^5.7.2"

terser@^4.6.3:
version "4.8.0"
resolved "https://registry.yarnpkg.com/terser/-/terser-4.8.0.tgz#63056343d7c70bb29f3af665865a46fe03a0df17"
integrity sha512-EAPipTNeWsb/3wLPeup1tVPaXfIaU68xMnVdPafIL1TV05OhASArYyIfFvnvJCNrR2NIOvDVNNTFRa+Re2MWyw==
version "4.8.1"
resolved "https://registry.yarnpkg.com/terser/-/terser-4.8.1.tgz#a00e5634562de2239fd404c649051bf6fc21144f"
integrity sha512-4GnLC0x667eJG0ewJTa6z/yXrbLGv80D9Ru6HIpCQmO+Q4PfEtBFi0ObSckqwL6VyQv/7ENJieXHo2ANmdQwgw==
dependencies:
commander "^2.20.0"
source-map "~0.6.1"
Expand Down

0 comments on commit d803a4e

Please sign in to comment.