Skip to content

Commit

Permalink
chore: fixed issue customIndexToolbarComponents & support v4.33.3
Browse files Browse the repository at this point in the history
  • Loading branch information
shuvroroy committed May 20, 2024
1 parent 17efe19 commit 747db69
Show file tree
Hide file tree
Showing 7 changed files with 33 additions and 5 deletions.
2 changes: 1 addition & 1 deletion dist/js/tool.js

Large diffs are not rendered by default.

9 changes: 9 additions & 0 deletions dist/js/tool.js.LICENSE.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,16 @@
/*!
* The buffer module from node.js, for the browser.
*
* @author Feross Aboukhadijeh <http://feross.org>
* @license MIT
*/

/*!
* vuex v4.1.0
* (c) 2022 Evan You
* @license MIT
*/

/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */

/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
2 changes: 1 addition & 1 deletion resources/js/mixins/FieldValue.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export default {
return null
}

return String(this.field.displayedAs || this.field.value)
return String(this.field.displayedAs ?? this.field.value)
},

shouldDisplayAsHtml() {
Expand Down
2 changes: 1 addition & 1 deletion resources/js/mixins/HandlesValidationErrors.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export default {
inject: { index: { default: null }, viaParent: { default: null } },

data: () => ({
errorClass: 'form-input-border-error',
errorClass: 'form-control-bordered-error',
}),

computed: {
Expand Down
15 changes: 13 additions & 2 deletions resources/js/mixins/IndexConcerns.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ export default {

provide() {
return {
resourceHasId: computed(() => this.resourceHasId),
authorizedToViewAnyResources: computed(
() => this.authorizedToViewAnyResources
),
Expand Down Expand Up @@ -66,6 +67,7 @@ export default {
orderBy: '',
orderByDirection: '',
pivotActions: null,
resourceHasId: true,
resourceHasActions: false,
resourceResponse: null,
resourceResponseError: null,
Expand Down Expand Up @@ -489,6 +491,7 @@ export default {
shouldShowCheckboxes() {
return (
Boolean(this.hasResources) &&
Boolean(this.resourceHasId) &&
Boolean(
this.resourceHasActions ||
this.authorizedToDeleteAnyResources ||
Expand Down Expand Up @@ -533,6 +536,7 @@ export default {
authorizedToViewAnyResources() {
return (
this.resources.length > 0 &&
Boolean(this.resourceHasId) &&
Boolean(find(this.resources, resource => resource.authorizedToView))
)
},
Expand All @@ -543,6 +547,7 @@ export default {
authorizedToUpdateAnyResources() {
return (
this.resources.length > 0 &&
Boolean(this.resourceHasId) &&
Boolean(find(this.resources, resource => resource.authorizedToUpdate))
)
},
Expand All @@ -553,6 +558,7 @@ export default {
authorizedToDeleteAnyResources() {
return (
this.resources.length > 0 &&
Boolean(this.resourceHasId) &&
Boolean(find(this.resources, resource => resource.authorizedToDelete))
)
},
Expand All @@ -563,6 +569,7 @@ export default {
authorizedToForceDeleteAnyResources() {
return (
this.resources.length > 0 &&
Boolean(this.resourceHasId) &&
Boolean(
find(this.resources, resource => resource.authorizedToForceDelete)
)
Expand All @@ -573,8 +580,11 @@ export default {
* Determine if any selected resources may be restored.
*/
authorizedToRestoreSelectedResources() {
return Boolean(
find(this.selectedResources, resource => resource.authorizedToRestore)
return (
Boolean(this.resourceHasId) &&
Boolean(
find(this.selectedResources, resource => resource.authorizedToRestore)
)
)
},

Expand All @@ -584,6 +594,7 @@ export default {
authorizedToRestoreAnyResources() {
return (
this.resources.length > 0 &&
Boolean(this.resourceHasId) &&
Boolean(find(this.resources, resource => resource.authorizedToRestore))
)
},
Expand Down
2 changes: 2 additions & 0 deletions resources/js/mixins/MetricBehavior.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ export default {
Nova.$on('metric-refresh', this.fetch)

Nova.$on('resources-deleted', this.fetch)
Nova.$on('resources-detached', this.fetch)
Nova.$on('resources-restored', this.fetch)

if (this.card.refreshWhenActionRuns) {
Expand All @@ -13,6 +14,7 @@ export default {
beforeUnmount() {
Nova.$off('metric-refresh', this.fetch)
Nova.$off('resources-deleted', this.fetch)
Nova.$off('resources-detached', this.fetch)
Nova.$off('resources-restored', this.fetch)
Nova.$off('action-executed', this.fetch)
},
Expand Down
6 changes: 6 additions & 0 deletions resources/js/views/Index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,11 @@
"
class="inline-flex items-center gap-2 ml-auto"
>
<custom-index-toolbar
v-if="!viaResource"
:resource-name="resourceName"
/>

<!-- Action Dropdown -->
<ActionDropdown
v-if="availableStandaloneActions.length > 0"
Expand Down Expand Up @@ -288,6 +293,7 @@ export default {
this.getLenses()
Nova.$on('refresh-resources', this.getResources)
Nova.$on('resources-detached', this.getAuthorizationToRelate)
if (this.actionCanceller !== null) this.actionCanceller()
},
Expand Down

0 comments on commit 747db69

Please sign in to comment.