Giter Site home page Giter Site logo

compatible's Introduction

Ant Design Compatible

NPM version NPM downloads CircleCI

Install

yarn add @ant-design/compatible@v5-compatible-v4

Usage

Helps you to compatible different components between v4 and v5.

-- import { Button, Select, Dropdown } from 'antd';
++ import { Button, Select, Dropdown } from '@ant-design/compatible';

FAQ

compatible's People

Contributors

afc163 avatar dependabot-preview[bot] avatar heiyu4585 avatar ikobe avatar imhele avatar indprogo avatar ljjcherry avatar madccc avatar paranoidjk avatar shaodahong avatar vagusx avatar willc001 avatar ycjcl868 avatar yoyo837 avatar zombiej avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

compatible's Issues

Form组件样式Bug

问题

设置Form组件为inline模式时,属性labelColwrapperCol失效

原因

inline时将ant-legacy-form-item设置为了inline-block,导致ant-colflex属性失效

CSS样式显示不正确

  • I have searched the issues of this repository and believe that this is not a duplicate.

Reproduction link

Edit on CodeSandbox

Steps to reproduce

  1. 下载@ant-design/compatible 依赖包
  2. 从包中导出Form, 写一个最简单的antd3的表单
  3. 为表单项上 .ant-legacy-form-item-control-wrapper 当前元素添加 css: flex: 1 1 0%
    4.关于ant-legacy-form-item-control-wrapper 线上包括源码当中是默认有 flex: 1 1 0% 这个样式的,不知道为什么本地复现并没有这个样式,只能手动加上,线上是出现了问题

5.Input 表单项宽度丢失

What is expected?

表单正常显示

What is actually happening?

Input宽度丢失

image

Environment Info
antd 4.12.2
React 16.8
System windows
Browser chrome 88

关闭 Form legacy component警告

devScripts.js:6523 Warning: [antd-compatible: Form] The legacy component has been deprecated, and ant design 4.0 now released! Please follow https://ant.design/components/form to upgrade. 

目前工作用到了非常多的 Form v3,我們沒有人力將 Form重構到 v4。預計永遠不會重構,所以希望有辦法關掉這個警告。

@ant-design/compatible中Form包裹下,Radio.Group 配置options获取不到value,配置children正常

  • I have searched the issues of this repository and believe that this is not a duplicate.

Reproduction link

Edit on CodeSandbox

Steps to reproduce

  1. Form从@ant-design/compatible导入
  2. Radio从antd导入
  3. radio1不能赋值,radio2可以赋值
import React from "react";
import ReactDOM from "react-dom";
import { Form } from "@ant-design/compatible";
import { Button, Radio } from "antd";
import "@ant-design/compatible/assets/index.css";

class MyForm extends React.Component {
  render() {
    const { form } = this.props;
    return (
      <Form
        onSubmit={e => {
          e.preventDefault();
          form.validateFieldsAndScroll((err, values) => {
            if (!err) {
              console.log("values", values);
            }
          });
        }}
      >
        <Form.Item>
          {form.getFieldDecorator("radio1", { initialValue: "1" })(
            <Radio.Group
              options={[
                { label: "radio1 item1", value: "a" },
                { label: "radio1 item2", value: "b" }
              ]}
            />
          )}
        </Form.Item>
        <Form.Item>
          {form.getFieldDecorator("radio2", { initialValue: "1" })(
            <Radio.Group>
              <Radio value="1">radio2 item1</Radio>
              <Radio value="2">radio2 item2</Radio>
            </Radio.Group>
          )}
        </Form.Item>
        <Button htmlType="submit">Submit</Button>
      </Form>
    );
  }
}

const AForm = Form.create()(MyForm);
ReactDOM.render(<AForm />, document.getElementById("container"));

What is expected?

radio1能正确获取到值

What is actually happening?

  1. 初始化时radio1有值,但没有选中。
  2. 任意改变某个控件,radio1的值都为undefined
Environment Info
antd 4.5.1
React 16.13.1
System window 10
Browser chrome 84

编译失败:@input-affix-width; 未找到

我只想用兼容包中的form,然后fork了一份代码,在编译的过程中提示:

NameError: variable @input-affix-width is undefined in /Users/changzhn/projects/react-group/compatible/src/form/style/index.less on line 145, column 55:

请问这个该如何解决?

node: v12.16.1
npm: 6.13.4

表单 select 搜索输入时,select框会往下掉

未输入内容时:
image

输入内容:
image

直接删掉 ant-select-selection-placeholder 节点也可以复现

猜测原因:输入内容后,ant-select-selection-placeholder 的节点删掉了,没有文字内容支撑,line-height 无法生效,导致 select 框往下掉

v5-compatible-v4

@MadCcc do i have to config less loader fot this

import {Comment} from '@ant-design/compatible'

error - ./node_modules/@ant-design/compatible/es/comment/style/index.less
Module parse failed: Unexpected character '@' (1:0)
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
> @import '../../style/default';
| // @import '../../style/mixins/index';

为什么1.1.2版本的peer dependencies中限制antd为3.x

1.1.2版本的@ant-design/compatible中的package.json里写有peer dependencies, antd为3.x。我理解这个是v3升级到v4的兼容包,那么宿主环境中装的antd版本应该是v4的,这里为什么要这么限制呢?同时因为我的项目必须升级至react17以上,所以也不可能有antd3共存在项目中。

@ant-design/compatible内form表单样式问题

  • I have searched the issues of this repository and believe that this is not a duplicate.

Reproduction link

https://stackblitz.com/edit/react-xzpoae

Steps to reproduce

在第一个输入框输入任意字符,然后清空,input会出现红色边框,从4.0.3引入的form组件则没有

What is expected?

获取焦点的时候,错误提示红色的框应该出现在最外层

What is actually happening?

获取焦点以后,红色的框出现在组件内,外面还有一层蓝色框
image

Environment Info
antd 4.0.3
React 16.13.0
System windows7
Browser chrome80.0.3987.132

Form表单下 输入框表单项输入卡顿

@ant-design/compatible 1.1.0
antd 4.18.9

只有一个Form表单,表单内根据数组循环生成表单项,当表单项达到一定数量后,输入框输入非常卡顿。请教一下大佬们有什么优化方式吗?

Compile issue from v4 to v5

Hi,
issue here after compiling:

Compiled with problems:X ERROR in ./node_modules/@ant-design/compatible/es/form/index.js 2:0-107 export 'FormProps' (reexported as 'FormProps') was not found in './Form' (possible exports: default) ERROR in ./node_modules/@ant-design/compatible/es/form/index.js 2:0-107 export 'FormComponentProps' (reexported as 'FormComponentProps') was not found in './Form' (possible exports: default) ERROR in ./node_modules/@ant-design/compatible/es/form/index.js 2:0-107 export 'FormCreateOption' (reexported as 'FormCreateOption') was not found in './Form' (possible exports: default) ERROR in ./node_modules/@ant-design/compatible/es/form/index.js 2:0-107 export 'ValidateCallback' (reexported as 'ValidateCallback') was not found in './Form' (possible exports: default) ERROR in ./node_modules/@ant-design/compatible/es/form/index.js 2:0-107 export 'ValidationRule' (reexported as 'ValidationRule') was not found in './Form' (possible exports: default) ERROR in ./node_modules/@ant-design/compatible/es/form/index.js 3:0-43 export 'FormItemProps' (reexported as 'FormItemProps') was not found in './FormItem' (possible exports: default)

I've used the last package, 5.1.0
I don't know what is happened. Seems all ok in my project, only this one fails. Can somebody check in this export?

Thanks guys!

JSX element type 'FormItem' is not a constructor function for JSX elements.

react 16.13.1
@types/react 16.9.34

升级迁移 兼容V3时 Form & FormItem报错

// tsconfig
{
"compilerOptions": {
"baseUrl": "src",
"target": "es5",
"lib": [
"dom",
"dom.iterable",
"esnext"
],
"allowJs": true,
"skipLibCheck": true,
"esModuleInterop": true,
"allowSyntheticDefaultImports": true,
"strict": true,
"forceConsistentCasingInFileNames": true,
"module": "esnext",
"moduleResolution": "node",
"resolveJsonModule": true,
"isolatedModules": true,
"noEmit": true,
"jsx": "react",
"experimentalDecorators": true,
"noImplicitThis": false
},
"include": [
"src"
],
"extends": "./paths.json"
}

                    <LegacyForm.Item label={index === 0 ? '部门' : ''} >
                        {form.getFieldDecorator(`departmentIds[_${item}]`, {
                            rules: required === false ? [] : [{ required: true, message: '请选择部门' }],
                            initialValue: index < (departmentList || []).length  ? initDepartmentObj[item] : undefined
                        })(
                            <Cascader
                                options={getOptions(data)}
                                placeholder="请选择"
                                className={styles['multiple-select-cascader']}
                                displayRender={(label:any) => label.join(' - ')}
                                getPopupContainer={(triggerNode:{parentNode:React.ReactNode}) => triggerNode.parentNode}
                                {...rst}
                            />
                        )}
                    </LegacyForm.Item>

lerna项目中子应用无法引入compatible样式

@ant-design/compatible 1.1.0
antd 4.19.1

umi子应用按照如下方式引入

import '@ant-design/compatible/assets/index.less';
import 'antd/dist/antd.less';

出现以下报错,但是主应用 node_modules 中有 node_modules/antd/dist/antd.less

error  in /project/node_modules/@ant-design/compatible/assets/index.less

Module build failed (from /project/node_modules/@umijs/bundler-webpack/lib/webpack/plugins/mini-css-extract-plugin/src/loader.js):
ModuleBuildError: Module build failed (from /project/node_modules/@umijs/deps/compiled/less-loader/cjs.js):


@import (reference) 'antd/dist/antd.less';
^
Can't resolve './antd/dist/antd.less' in '/project/node_modules/@ant-design/compatible/lib/form/style'

image

DatePicker修改周的起始日失效

import { DatePicker, ConfigProvider } from 'antd';
import 'moment/locale/zh-cn';
import locale from 'antd/lib/locale/zh_CN';
import moment from 'moment';

moment.locale('zh-cn', {
    week: {
        dow: 3
    }
});

<ConfigProvider locale={locale}>
    <DatePicker />
</ConfigProvider>

做全局的配置没有任何作用

Customize Comment Background Color

How do I customize the colorBgContainer style for the compatible/Comment component? I've tried many different guesses in the ConfigProvider theme property, including

components: {
  Comment: {
    colorBgContainer: 'transparent',
  },
}

as well as

components: {
  compatible: {
    Comment: {
      colorBgContainer: 'transparent',
    },
  },
}

and I can't get it to take. Documentation for theming compatible components is completely absent. Any help is appreciated.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.