remove deprecated modal stuff and replace it with "new" modal stuff

pull/95/head
dperolio 2 years ago
parent 2c8e0b18a0
commit 1131d0b078
No known key found for this signature in database
GPG Key ID: 4191689562D51409

@ -1,4 +1,4 @@
import { getModule, getModuleByDisplayName, modal } from '@vizality/webpack';
import { getModule, getModuleByDisplayName } from '@vizality/webpack';
import AsyncComponent from './AsyncComponent';
import { Icons } from './Icon';
@ -38,10 +38,6 @@ export const TextBadge = AsyncComponent.fetchFromProps('TextBadge');
export const IconBadge = AsyncComponent.fetchFromProps('IconBadge');
export const Checkbox = AsyncComponent.fromDisplayName('Checkbox');
export const Popout = AsyncComponent.fromDisplayName('Popout');
/**
* @deprecated
*/
export const Modal = AsyncComponent.fromDisplayName('DeprecatedModal');
export const ImageModal = AsyncComponent.fromDisplayName('ImageModal');
export const Confirm = AsyncComponent.fromDisplayName('ConfirmModal');
export const HoverRoll = AsyncComponent.fromDisplayName('HoverRoll'); // https://i.imgur.com/73wadZr.gif
@ -51,7 +47,7 @@ export const SearchBar = AsyncComponent.fromDisplayName('SearchBar');
export const Clickable = AsyncComponent.fromDisplayName('Clickable');
export const FormTitle = AsyncComponent.fromDisplayName('FormTitle');
export const HeaderBar = AsyncComponent.fromDisplayName('HeaderBar');
export const NewModal = AsyncComponent.fetchFromProps('ModalRoot');
export const Modal = AsyncComponent.fetchFromProps('ModalRoot');
export const FormText = AsyncComponent.fromDisplayName('FormText');
export const FormItem = AsyncComponent.fromDisplayName('FormItem');
export const Spinner = AsyncComponent.fromDisplayName('Spinner');
@ -240,31 +236,16 @@ getModule('MenuGroup', true, true).then(ContextMenu => {
this.ContextMenu.Menu = ContextMenu.default;
});
getModuleByDisplayName('DeprecatedModal', true, true).then(Modal => {
this.Modal.ListContent = Modal.ListContent;
this.Modal.CloseButton = Modal.CloseButton;
this.Modal.Content = Modal.Content;
this.Modal.Header = Modal.Header;
this.Modal.Footer = Modal.Footer;
this.Modal.Sizes = Modal.Sizes;
getModule('ModalRoot', true, true).then(Modal => {
this.Modal.CloseButton = Modal.ModalCloseButton;
this.Modal.Content = Modal.ModalContent;
this.Modal.Footer = Modal.ModalFooter;
this.Modal.Header = Modal.ModalHeader;
this.Modal.ListContent = Modal.ModalListContent;
this.Modal.Root = Modal.ModalRoot;
this.Modal.Size = Modal.ModalSize;
});
getModule('ModalRoot', true, true).then(NewModal => {
this.NewModal.CloseButton = NewModal.ModalCloseButton;
this.NewModal.Content = NewModal.ModalContent;
this.NewModal.Footer = NewModal.ModalFooter;
this.NewModal.Header = NewModal.ModalHeader;
this.NewModal.ListContent = NewModal.ModalListContent;
this.NewModal.Root = NewModal.ModalRoot;
this.NewModal.Size = NewModal.ModalSize;
});
this.Confirm.defaultProps = {
transitionState: 1,
onClose: modal.pop
};
this.Icon.Icons = Icons;
this.Icon.Names = Object.keys(Icons);
export default this;

@ -1,63 +1,3 @@
/**
* This file/module will soon be removed. Prefer to use the new Modals API instead.
* @deprecated
*/
import { getModule } from '@vizality/webpack';
import { getModule, modal } from '@vizality/webpack';
import { deprecate } from '@vizality/util/logger';
import React from 'react';
const { closeModal: closeNewModal, openModal: openNewModal, openModalLazy: openLazy } = getModule('openModal', 'openModalLazy');
/**
* Opens a new modal.
* @deprecated
* @param {React.Component|function(): React.ReactElement} Component Modal component to show
*/
export const open = Component => {
deprecate({ labels: [ 'Modal', 'Open' ], message: 'This module will soon be removed. Prefer to use the new Modals API instead.' });
modal.push(
class VizalityModal extends React.Component {
render () {
return <Component />;
}
}
);
};
/**
* Closes the currently opened modal
* @deprecated
*/
export const close = () => {
deprecate({ labels: [ 'Modal', 'Close' ], message: 'This module will soon be removed. Prefer to use the new Modals API instead.' });
modal.pop();
};
/**
* Closes all modals
* @deprecated
*/
export const closeAll = () => {
deprecate({ labels: [ 'Modal', 'CloseAll' ], message: 'This module will soon be removed. Prefer to use the new Modals API instead.' });
modal.popAll();
};
/**
* Closes a new modal (for NewModal).
* @param {React.Component|function(): React.ReactElement} Component Component to show
*/
export const closeModal = closeNewModal;
/**
* Opens a new modal (for NewModal).
* @param {React.Component|function(): React.ReactElement} Component Component to show
*/
export const openModal = openNewModal;
/**
* Opens a lazy modal (for LazyModal).
* @param {React.Component|function(): React.ReactElement} Component Component to show
*/
export const openModalLazy = openLazy;
export const { closeModal, openModalLazy: openModal } = getModule('openModal', 'openModalLazy');

Loading…
Cancel
Save