New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@veeqo/custom-views

Package Overview
Dependencies
Maintainers
6
Versions
62
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@veeqo/custom-views

veeqo custom views

  • 1.1.6
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1
decreased by-66.67%
Maintainers
6
Weekly downloads
 
Created
Source

Custom Views

Implement Views from veeqo-components library

Installation

Using npm:

npm install @veeqo/components
npm install @veeqo/custom-views

Using yarn:

yarn add @veeqo/components
yarn add @veeqo/custom-views

Usage

In your route:

import { CustomViewsContext } from '@veeqo/custom-views';

const CustomViewsContext = CustomViewsProviderFactory({
  customViewModelType,
  postMode,
  apiHandlers,
  fixedViews,
});

ReactDOM.renderer(
  <CustomViewsContext>
    <MyAwesomeApp />
  </CustomViewsContext>,
  document.getElementById('root'),
);

In your components directory

import { CustomViews } from '@veeqo/custom-views';

const ViewsComponent = (props) => (
  <CustomViews
    {...customViewsProps}
  />
);

export default ViewsComponent;

Views here is the component, that implement Views from veeqo/components with TabsStore. You can also make it by yourself:

import { observer } from 'mobx-react';
import { useCustomViewsStore } from '@veeqo/custom-views';

const { Views } = VeeqoUI;

const ViewsComponent = observer((props) => (
  {...viewsProps}
));

export default ViewsComponent;

Props

Custom Views provider factory

NameTypeDescription
customViewModelTypestringDescribes your current route. Can be used in apiHandlers functions
postModeapi | localStorageDescribes where is saved custom tabs should be located
fixedViews{ key: string, label: string, type: 'fixed' }[]

Api Handlers props

NameTypeDescription
fetch({ type: string }, user: 'user') => (Promise({ data: { key: number | string, id: string | number, label: string, count?: number, default?: boolean, editable: boolean, filters: any[], user: any }[]))filters and user here can be everything because it's not use in Custom Views
post({ type: 'custom_view', attributes: { title: string, type: 'draft', filters: any[] }) => (Promise({ data: { id: string | number } })) Post occurs only when new View was saved
patch({ type: 'custom_view', id: string | number, attributes: { title: string, type: 'saved', filters: any[] } }) => voidPost occurs only when saved View changes
delete(viewId: string | number) => void

Custom Views props

NameTypeDescription
includedFilters{ label: string, text: string | string[] }Array of changed filters. Shows when you create new custom view
hasUnsavedChangesbooleanUsed to understand is something was changed when saved View is active
It's used to show the bottom pill about unsaved changes
handleChangeActiveTab(viewId: string | number) => void
handleDiscardUnsavedChanges() => voidFires when the user click Discard changes button in bottom pill
handleCreateCreateCustomView() => voidFires when the user create new view via the button with plus icon
You should reset all filters to default on this event

Views Props

NameTypeDescription
tabs{ key: number | string, label: string, type: 'fixed' | 'draft | 'saved, count: number }[]Should include all tabs (fixed too)
fixedTabs{ key: number, label: string, type: 'fixed' | 'draft | 'saved', count: number }[]Used to show fixed tabs separately from custom tabs in Reorder component
customTabs{ key: number | string, label: string }[]Used to show custom tabs separately from fixed tabs in Reorder component
activeTabKeynumber | string
includedFilters{ label: string, text: string | string }[]Array of changed filters. Shows when you create new custom view
hasUnsavedChangesbooleanUsed to understand is something was changed when saved View is active
It's used to show the bottom pill about unsaved changes
isLoadingbooleanShows Spinner if variable is true and disable create custom view button
onSave(viewId: number | string, viewName: string) => void
onDelete(viewId: number | string) => void
handleDuplicateTab(viewId: number | string) => voidShould create new tab from selected one but with draft type
handleChangeActiveTab(viewId: number | string) => void
handleCreateCustomView(viewId: number | string) => voidFires when user click on button with plus icon
handleSetCustomTab(treeData: { key: number, label: string, type: 'fixed' | 'draft | 'saved', count: number }[]) => voidFires when order of custom tabs is changed in Reorder component
handleDiscardUnsavedChanges() => voidFires when the user click Discard changes button in bottom pill
handleSaveToCurrentView(viewId: number | string) => voidFires when the user click Save to current view in bottom pill
Should only save current filters

Keywords

FAQs

Package last updated on 19 Jan 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc