mobx-react#inject JavaScript Examples

The following examples show how to use mobx-react#inject. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: FiltersPane.js    From dm2 with Apache License 2.0 6 votes vote down vote up
buttonInjector = inject(({ store }) => {
  const { viewsStore, currentView } = store;

  return {
    viewsStore,
    sidebarEnabled: viewsStore?.sidebarEnabled ?? false,
    activeFiltersNumber: currentView?.filtersApplied ?? false,
  };
})
Example #2
Source File: DynamicPreannotationsControl.js    From label-studio-frontend with Apache License 2.0 6 votes vote down vote up
DynamicPreannotationsControl = inject("store")(observer(({ store }) => {
  return store.autoAnnotation && !store.forceAutoAcceptSuggestions ? (
    <Block name="dynamic-preannotations-control">
      <Input
        type="checkbox"
        checked={store.autoAcceptSuggestions}
        label="Auto accept annotation suggestions"
        onChange={(e) => store.setAutoAcceptSuggestions(e.target.checked)}
        waiting={store.awaitingSuggestions}
        labelProps={{
          placement: 'right',
        }}
      />
    </Block>
  ) : null;
}))
Example #3
Source File: index.js    From choerodon-front-base with Apache License 2.0 6 votes vote down vote up
StoreProvider = injectIntl(inject('AppState')(
  (props) => {
    const { AppState: { currentMenuType: { type, id } }, intl, children, context: { applicationId } } = props;
    const intlPrefix = 'project.application-management.list';
    const projectServiceDataSet = useMemo(() => new DataSet(ApplicationServiceDataSet({ id, intl, intlPrefix, applicationId, type: 'project' })), [id]);
    const sharedServiceDataSet = useMemo(() => new DataSet(ApplicationServiceDataSet({ id, intl, intlPrefix, applicationId, type: 'shared' })), [id]);
    const value = {
      ...props,
      prefixCls: 'application-management',
      intlPrefix,
      sharedServiceDataSet,
      projectServiceDataSet,
    };
    return (
      <Store.Provider value={value}>
        {children}
      </Store.Provider>
    );
  },
))
Example #4
Source File: Annotators.js    From dm2 with Apache License 2.0 5 votes vote down vote up
UsersInjector = inject(({ store }) => {
  return {
    users: store.users,
  };
})
Example #5
Source File: Controls.js    From label-studio-frontend with Apache License 2.0 5 votes vote down vote up
controlsInjector = inject(({ store }) => {
  return {
    store,
    history: store?.annotationStore?.selected?.history,
  };
})