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 { 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 #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 Edlib with GNU General Public License v3.0 5 votes vote down vote up
MillionaireContainer = injectIntl(MillionaireContainer);
Example #4
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 #5
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: { type, id } }, intl, children, match: { params: { applicationId } } } = props;
    const intlPrefix = 'project.application-management.list';
    const serviceDataSet = useMemo(() => new DataSet(ServiceDataSet({ id, intl, intlPrefix, applicationId })), [id]);
    const versionDataSet = useMemo(() => new DataSet(VersionDataSet({ id, intl, intlPrefix, applicationId })), [id]);
    const versionCreateDataSet = useMemo(() => new DataSet(VersionCreateDataSet({ id, intl, intlPrefix, applicationId })), [id]);
    const value = {
      ...props,
      prefixCls: 'application-management',
      intlPrefix,
      serviceDataSet,
      versionDataSet,
      versionCreateDataSet,
      applicationId,
      projectId: id,
      permissions: [
        'base-service.project-app-service.addAppSvcRef', // 0 添加应用服务
        'base-service.project-app-service.deleteAppSvcRef', // 1 删除应用服务
        'base-service.project-app-version.createAppVersion', // 2 创建应用版本
        'base-service.project-app-version.deleteAppVersion', // 3 删除应用版本
        'base-service.project-app-version.updateAppVersion', // 4 修改应用版本
      ],
      serviceTypeMap: {
        normal: '普通应用',
        test: '测试应用',
      },
      tagMap: {
        publishing: {
          color: 'rgba(77,144,254,1)',
          text: '发布中',
        },
        unpublished: {
          color: 'rgba(0,0,0,0.2)',
          text: '未发布',
        },
        published: {
          color: 'rgba(0,191,165,1)',
          text: '已发布',
        },
      },
    };
    return (
      <Store.Provider value={value}>
        {children}
      </Store.Provider>
    );
  },
))
Example #6
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 #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 4 votes vote down vote up
StoreProvider = injectIntl(inject('AppState', 'HeaderStore')(
  (props) => {
    const { children, intl } = props;
    const booleanDs = new DataSet({
      data: [{
        meaning: '是',
        value: true,
      }, {
        meaning: '否',
        value: false,
      }],
    });
    const queryFieldParamType = new DataSet({
      data: [{
        meaning: 'query',
        value: 'query',
      }, {
        meaning: 'path',
        value: 'path',
      }],
    });
    const alignDs = new DataSet({
      data: [{
        meaning: '左对齐',
        value: 'left',
      }, {
        meaning: '右对齐',
        value: 'right',
      }, {
        meaning: '居中',
        value: 'center',
      }],
    });
    const resourceLevelDs = new DataSet({
      data: [{
        meaning: '平台',
        value: 'SITE',
      }, {
        meaning: '组织',
        value: 'ORGANIZATION',
      }, {
        meaning: '项目',
        value: 'PROJECT',
      }],
    });
    const queryFieldTypeDs = new DataSet({
      data: [{
        meaning: '文本输入框',
        value: 'TextFiled',
      }, {
        meaning: '数字输入框',
        value: 'NumberField',
      }, {
        meaning: '下拉框',
        value: 'Select',
      }, {
        meaning: '时间选择器',
        value: 'DateTimePicker',
      }, {
        meaning: '日期选择器',
        value: 'DatePicker',
      }, {
        meaning: 'lov',
        value: 'Lov',
      }],
    });
    async function checkCode(value, name, record) {
      if (!CODE_REGULAR_EXPRESSION.test(value)) {
        return '编码只能由字母、数字、"-"、"_"、"."组成,且只能以字母开头';
      }
      if (value === record.getPristineValue(name)) {
        return true;
      }
    }
    const intlPrefix = 'organization.pwdpolicy';
    const queryFieldDataSet = useMemo(() => new DataSet(QueryFieldDataSet({ queryFieldTypeDs, booleanDs, queryFieldParamType })), []);
    const gridFieldsDataSet = useMemo(() => new DataSet(GridFieldDataSet({ alignDs, queryFieldDataSet, checkCode })), []);
    const lovDataSet = useMemo(() => new DataSet(LOVDataSet({ intl, gridFieldsDataSet, queryFieldDataSet, booleanDs, resourceLevelDs, checkCode })), []);
    
    const modalStyle = {
      width: 'calc(100% - 3.5rem)',
    };
    const permissions = [
     
    ];
    const value = {
      ...props,
      intl,
      intlPrefix,
      modalStyle,
      lovDataSet,
      permissions,
    };
    return (
      <Store.Provider value={value}>
        {children}
      </Store.Provider>
    );
  },
))