react-intl#injectIntl JavaScript Examples

The following examples show how to use react-intl#injectIntl. 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: index.js    From choerodon-front-base with Apache License 2.0 6 votes vote down vote up
StoreProvider = injectIntl(inject('AppState')((props) => {
  const { children, AppState: { currentMenuType: { id: orgId } }, ldapId } = props;
  const ldapLoadClientDataSet = useMemo(() => new DataSet(LdapLoadClientDataSet({ orgId, ldapId })), [orgId]);
  const value = {
    ...props,
    orgId,
    ldapLoadClientDataSet,
  };
  return (
    <Store.Provider value={value}>
      {children}
    </Store.Provider>
  );
}))
Example #2
Source File: Map.jsx    From covid19-testing with Apache License 2.0 6 votes vote down vote up
Map = compose(
  wrapConfigElements({
    Markers: {
      children: PropTypes.node,
    },
    ZoomControl: {},
  }),
  (component) => injectIntl(component, {withRef: true})
)(MapComponent)
Example #3
Source File: index.js    From choerodon-front-base with Apache License 2.0 6 votes vote down vote up
StoreProvider = withRouter(injectIntl(inject('AppState')(
  (props) => {
    const { AppState: { currentMenuType: { type, id, organizationId } }, intl, children, appId, refresh } = props;
    const appReleasedSubTableDataSet = useMemo(() => new DataSet(AppReleasedSubTableDataSet(intl, id, appId)), [id, appId]);

    const value = {
      ...props,
      projectId: id,
      organizationId,
      appReleasedSubTableDataSet,
      refresh,
      // statusMap,
    };
    return (
      <Store.Provider value={value}>
        {children}
      </Store.Provider>
    );
  },
)))
Example #4
Source File: index.js    From Edlib with GNU General Public License v3.0 5 votes vote down vote up
MillionaireContainer = injectIntl(MillionaireContainer);
Example #5
Source File: context.jsx    From covid19-testing with Apache License 2.0 5 votes vote down vote up
IntlProviderNewContextAdapter = injectIntl(({intl, children}) => (
  <IntlContext.Provider value={intl}>{children}</IntlContext.Provider>
))
Example #6
Source File: index.js    From choerodon-front-base with Apache License 2.0 5 votes vote down vote up
StoreProvider = injectIntl(inject('AppState')((props) => {
  const { children, AppState: { currentMenuType: { id: orgId } } } = props;

  const FuncModeDataSet = new DataSet(funcModeDataSet());
  const intlPrefix = 'c7n.system-setting';
  const format = useFormatMessage(intlPrefix);
  const formatCommon = useFormatCommon();
  const systemSettingDataSet = new DataSet(SystemSettingDataSet({
    id: orgId, hasRegister, intlPrefix, formatCommon, format,
  }));
  // map first color to second color
  const colorMap = {
    '#e50113': '#d20112',
    '#ef7c0a': '#e4770b',
    '#cb8347': '#bf783a',
    '#40886c': '#337d60',
    '#478384': '#387475',
    '#3b5a97': '#2d4a85',
    '#1a73e8': '#3367d6',
    '#3f51b5': '#303f9f',
    '#5365ea': '#5365ea',
  };
  const presetColors = Object.keys(colorMap);
  const value = {
    ...props,
    orgId,
    systemSettingDataSet,
    FuncModeDataSet,
    intlPrefix,
    presetColors,
    colorMap,
    hasRegister,
    format,
    formatCommon,
  };
  return (
    <Store.Provider value={value}>
      {children}
    </Store.Provider>
  );
}))
Example #7
Source File: intl.js    From plant-3d-explorer with GNU Affero General Public License v3.0 5 votes vote down vote up
InjectIntlContext = injectIntl(({ intl, children }) => {
  return (
    <IntlContext.Provider value={intl}>
      { children }
    </IntlContext.Provider>
  )
})
Example #8
Source File: index.js    From choerodon-front-base with Apache License 2.0 5 votes vote down vote up
StoreProvider = injectIntl(inject('AppState')(
  (props) => {
    const { AppState: { currentMenuType: { id, type, organizationId } }, children, intl } = props;
    const intlPrefix = 'organization.pwdpolicy';
    const intlPrefixNew = 'c7ncd.org-safe';
    const formatCommon = useFormatCommon();
    const formatClient = useFormatMessage(intlPrefixNew);

    const orgId = type === 'organization' ? id : organizationId;
    const passwordPolicyDataSet = useMemo(() => new DataSet(
      PasswordPolicyDataSet(orgId, formatCommon, formatClient),
    ), [orgId]);

    const remoteMobxStore = useLocalStore(() => ({
      disableAllBtn: false,
      get getDisableAllBtn() {
        return remoteMobxStore.disableAllBtn;
      },
      setDisable(status) {
        remoteMobxStore.disableAllBtn = status;
      },
    }));

    const value = {
      orgId,
      id,
      passwordPolicyDataSet,
      remoteMobxStore,
      intl,
      intlPrefix,
      formatClient,
      formatCommon,
    };
    return (
      <Store.Provider value={value}>
        {children}
      </Store.Provider>
    );
  },
))
Example #9
Source File: button.js    From zotero-cita with GNU General Public License v3.0 5 votes vote down vote up
Button = injectIntl(ZoteroButton.WrappedComponent)
Example #10
Source File: RichEditor.js    From Edlib with GNU General Public License v3.0 5 votes vote down vote up
RichEditor = injectIntl(RichEditor);
Example #11
Source File: index.js    From choerodon-front-base with Apache License 2.0 4 votes vote down vote up
StoreProvider = injectIntl(inject('AppState')(
  (props) => {
    const { AppState: { currentMenuType: { id, organizationId } }, intl, children } = props;

    const intlPrefix = 'c7ncd.org-user';

    const formatCommon = useFormatCommon();
    const formatProjectUser = useFormatMessage(intlPrefix);

    const statusOptionData = [
      { text: formatCommon({ id: 'enable' }), value: 'true' },
      { text: formatCommon({ id: 'stop' }), value: 'false' },
    ];
    const statusOptionDs = useMemo(() => new DataSet({
      data: statusOptionData,
      selection: 'single',
    }));
    const safeOptionData = [
      { text: formatCommon({ id: 'normal' }), value: 'false' },
      { text: formatCommon({ id: 'locked' }), value: 'true' },
    ];
    const safeOptionDs = useMemo(() => new DataSet({
      data: safeOptionData,
      selection: 'single',
    }));
    const userStore = useStore();

    const orgRoleDataSet = useMemo(() => new DataSet(
      OrgRoleDataSet({
        id,
        intl,
        intlPrefix,
      }),
    ), [id]);
    const orgUserListDataSet = useMemo(() => new DataSet(OrgUserListDataSet({
      id,
      formatCommon,
      formatProjectUser,
      statusOptionDs,
      safeOptionDs,
      orgRoleDataSet,
      orgID: organizationId,
    })), [id]);
    const orgUserCreateDataSet = useMemo(() => new DataSet(OrgUserCreateDataSet({
      id, formatCommon, formatProjectUser, orgRoleDataSet, userStore, organizationId,
    })), [id]);
    const orgUserRoleDataSet = useMemo(() => new DataSet(OrgUserRoleDataSet({
      id, formatCommon, formatProjectUser, orgRoleDataSet,
    })), [id]);
    const passwordPolicyDataSet = useMemo(() => new DataSet(
      PasswordPolicyDataSet(id, formatCommon, formatProjectUser),
    ), [id]);
    const orgAllRoleDataSet = useMemo(() => new DataSet(OrgAllRoleDataSet({ id })), [id]);

    useEffect(() => {
      userStore.checkCreate(organizationId);
    }, [organizationId]);

    const value = {
      ...props,
      formatProjectUser,
      formatCommon,
      orgUserListDataSet,
      orgUserCreateDataSet,
      orgUserRoleDataSet,
      orgRoleDataSet,
      orgAllRoleDataSet,
      prefixCls: 'base-org-user-list',
      intlPrefix,
      permissions: [
        'choerodon.code.organization.manager.user.ps.default',
      ],
      organizationId,
      passwordPolicyDataSet,
      userStore,
      id,
      statusOptionDs,
      safeOptionDs,
      orgID: organizationId,
    };
    return (
      <Store.Provider value={value}>
        {children}
      </Store.Provider>
    );
  },
))