-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(lib): update NotificationNotice
- `NotificationNotice` migrates to Vue 3. Changes sufficient to render the documentation page of `Notice` are made. Scss is also slightly changed. A commit of updates on the documentation page will follow this commit. - In `src/components/notification/NotificationNotice.vue`, - `v-bind="$options.propsData"` is replaced with `v-bind="$attrs"` because there is no way to pass `$options` via the `h` (createElement) function on Vue 3. `$attrs` contains necessary props because `NoticeMixin` is replaced with `NoticeMixinSubset` (see below). - Adds a `duration` prop because `NoticeMixinSubset` does not include it. `duration` is explicitly given to `<b-notification>` because it is not included in `$attrs`. - `<b-notification>` tag is duplicated to tell two cases, with or without a default slot. `<slot v-if... />` did not work. It set a comment node as the default slot. - `duration` is given to `<b-notification>`. - `model-value` of `<b-notification>` syncs with `isActive` to do animation. - `Notification` is explicitly registered, because `NotificationNotice` will be mounted on a brand-new Vue app. - Removes `$destroy` because Vue 3 no longer provides it. - Lists the "close" event in `emits`. - In `src/components/notification/Notification.vue`, - `Progress` is explicitly registered, because `Notification` may be embedded in `NotificationNotice` which is programmatically opened. - In `src/components/notification/index.js`, - A component instance of `NotificationNotice` is obtained by mounting a brand-new Vue app created by `createApp` instead of directly newing a `Vue.extend`ed component. Because the latter is no longer supported by Vue 3. A brand-new `$buefy` global property is added to the new Vue app so that `globalNoticeInterval` is available. - `createApp` does not actually returns an instance of `NotificationNotice` but another component that wraps `NotificationNotice`. It exposes the `close` function so that it can be programmatically closed. It also calls an `onClose` function specified to props when it is closed. - A mounted app unmounts itself when the `Notice` is closed. - In a new file `src/components/notification/NoticeMixinSubset.js`, - `NoticeMixinSubset` copies `NoticeMixin` but excludes the following props not used by `NoticeMixin` itself, - `type` - `message` - `duration` By excluding these props, they are passed through to `Notification` from `NotificationNotice.` - In `src/utils/NoticeMixin.js`, - `emits` lists "click", and "close" events. - In `src/scss/utils/_animation.scss`, - `.fade-ender` --> `.fade-enter-from`, to conform to Vue 3. - Other classes related to animation are not used in the documentation page but also renamed, - `.zoom-in-enter` --> `.zoom-in-enter-from` - `.zoom-out-enter` --> `.zoom-out-enter-from` - `.slide-next-enter` --> `.slide-next-enter-from` - `.slide-prev-enter` --> `.slide-prev-enter-from` - `.slide-down-enter` --> `.slide-down-enter-from` - `.slide-up-enter` --> `.slide-up-enter-from` - `.slide-enter` --> `.slide-enter-from` - Common, - ESLint fix is applied.
- Loading branch information
Showing
6 changed files
with
123 additions
and
36 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import NoticeMixin from '../../utils/NoticeMixin.js' | ||
|
||
// drops props not used by `NoticeMixin` itself | ||
// - type | ||
// - message | ||
// - duration | ||
const { | ||
queue, | ||
indefinite, | ||
pauseOnHover, | ||
position, | ||
container | ||
} = NoticeMixin.props | ||
|
||
export default { | ||
...NoticeMixin, | ||
props: { | ||
queue, | ||
indefinite, | ||
pauseOnHover, | ||
position, | ||
container | ||
} | ||
} |
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
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
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