Code Monkey home page Code Monkey logo

choerodon-ui's People

Contributors

aboyl avatar anthony081105 avatar chrisk-7777 avatar clarissahu avatar demonimmortal avatar dependabot[bot] avatar devane001 avatar duangdong9 avatar hqwcxy avatar huangqiii avatar hughhzwu avatar huihuawk avatar josh-cena avatar liarye avatar luoxilang avatar luoxilang-github avatar mahoo12138 avatar oozeme avatar sandboat avatar snektech avatar sunchir avatar vinkdong avatar xeonice avatar ying-bin avatar yunqiangwu avatar zoeygo 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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

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

choerodon-ui's Issues

table表格给column加上tooltip,在单元格文字显示不全的情况下,鼠标放上去没有气泡展示

table表格给column加上tooltip,在单元格文字显示不全的情况下,鼠标放上去没有气泡展示
1.表格没有出现横向滚动条,单元格显示不完全,加上tooltip为overflow,不会有气泡
image

2.表格出现横向滚动条,单元格显示不完全,加上tooltip为overflow,有气泡
image

3.表格没有出现横向滚动条,单元格显示不完全,加上tooltip为overflow,如果勾选了当前行,会有气泡
image

期望:只要表格单元格文字显示不全,加上tooltip后,鼠标放入的单元格都有气泡

无法启动,运行失败

下载了项目,通过 npm install 进行安装依赖,安装完成后,通过npm run start 进行启动,但是启动失败。也尝试过 通过 npm run site-dev进行启动,也失败。
image

  • node version:16.13.1
  • npm version:8.1.2
  • win10

list组件使用dataset.locate实现点击定位当前行的问题

What happens?

handleClick = record => {
    if (!record?.isCurrent) record?.dataSet?.locate(record.index);
  }

使用上面的方法实现点击定位到当前行始终会跳到第一页。

复现步骤,错误日志以及相关配置

  • 选择第二页
  • 点击第二行
    会跳到第一页的第二行

预期结果

猪齿鱼UI的record的index是基于当前页的,比如我一页有10行,就是0~9,因此使用dataset.locate(1)应该是定位到当前页的第2行,而不是查询并定位到第1页的第2行。

目前我们实现定位到当前行的逻辑需要根据page和size来计算真实的index才能实现:dataSet.locate(record?.index + dataSet.pageSize * (dataSet.currentPage - 1))。能否修改locate的逻辑:基于当前行定位或者将计算index的逻辑加进去,或者修改record.index的取值逻辑

相关环境信息

  • choerodon-ui 版本:0.6.62
  • Node 版本:v12.16.1
  • 操作系统:Windows 10

choerodon-ui: 1.5.1 版本 PerformanceTable 组件动态设置rowSelection-selectedRowKeys无效

下载 https://codesandbox.io/s/11ej3 代码后,然后替换index.js内容如下:
代码如下:

import 'choerodon-ui/dist/choerodon-ui.css';
import 'choerodon-ui/dist/choerodon-ui-pro.css';
import 'choerodon-ui/dist/choerodon-ui-demo-data-mock.min.js';
import React from 'react';
import ReactDOM from 'react-dom';
import { Button, PerformanceTable } from 'choerodon-ui/pro';
const fakeTreeData = [
  {
    key: 1,
    name: 'John Brown sr.',
    age: 60,
    address: 'New York No. 1 Lake Park',
    children: [
      {
        key: 11,
        name: 'John Brown',
        age: 42,
        address: 'New York No. 2 Lake Park',
      },
      {
        key: 12,
        name: 'John Brown jr.',
        age: 30,
        address: 'New York No. 3 Lake Park',
        children: [
          {
            key: 121,
            name: 'Jimmy Brown',
            age: 16,
            address: 'New York No. 3 Lake Park',
          },
        ],
      },
      {
        key: 13,
        name: 'Jim Green sr.',
        age: 72,
        address: 'London No. 1 Lake Park',
        children: [
          {
            key: 131,
            name: 'Jim Green',
            age: 42,
            address: 'London No. 2 Lake Park',
            children: [
              {
                key: 1311,
                name: 'Jim Green jr.',
                age: 25,
                address: 'London No. 3 Lake Park',
              },
              {
                key: 1312,
                name: 'Jimmy Green sr.',
                age: 18,
                address: 'London No. 4 Lake Park',
              },
            ],
          },
        ],
      },
    ],
  },
  {
    key: 2,
    name: 'Joe Black',
    age: 32,
    address: 'Sidney No. 1 Lake Park',
  },
]
const rowKey = 'key'
// 拍平数组
const flatNode = list => {
  return list.reduce((total, cur) => {
    const t = total.concat(cur);
    return cur.children ? t.concat(flatNode(cur.children)) : t;
  }, []);
};

/**
   * 通过当前id 在原数组中查找该id对应的节点
   * @param {*} list 原数组
   * @param {*} curLineId 查找id
   */
 const getChildNode = (list, curLineId) => {
  const arr = [];
  for (let i = 0; i < list.length; i++) {
    const item = list[i];
    if (item[rowKey] === curLineId) {
      arr.push(item);
      break;
    } else if (item.children) {
      const result = getChildNode(item.children, curLineId);
      if (result.length) arr.push(result[0]);
    }
  }
  return arr;
};


const uniq = (arr) => [...new Set(arr)]

const handleRowKeys = list => list.map(v => v[rowKey]);

class TreeTable extends React.Component {
  constructor(props) {
    super(props);
    this.state = {
      data: fakeTreeData.slice(0, 100),
      selectedRowKeys: [],
      selectedRows: []
    };
  }
  // componentDidMount() {
  //   fetch('https://open-hand.github.io/choerodon-ui/zh/procmp/data/fakeLargeData.json')
  //     .then((response) => response.json())
  //     .then((data) => {
  //       this.setState({
  //         data: data
  //       })
  //     });
  // }

  setSelectedRowKeys = (selectedRowKeys) => {
    this.setState({ selectedRowKeys: uniq(selectedRowKeys) });
  }

  setSelectedRows = (selectedRows) => {
    this.setState({ selectedRows: uniq(selectedRows) })
  }

  onRowSelect = (record, selected, _selectedRows) => {
    const { selectedRowKeys, selectedRows } = this.state;
    console.log(selected, 'selected')
    if (selected) {
      const curLineId = record[rowKey];
      // 选中时
      const arr = getChildNode(this.state.data, curLineId);
      const list = flatNode(arr);
      const rowKeys = handleRowKeys(list);
      this.setSelectedRowKeys([...selectedRowKeys, ...rowKeys]);
      this.setSelectedRows([...selectedRows, ...list]);
    } else {
      // 取消
      const curRowKey = record[rowKey];
      this.setSelectedRowKeys(selectedRowKeys.filter(v => v !== curRowKey));
      // 返回的 _selectedRows 中已经过滤掉
      this.setSelectedRows(_selectedRows);
    }
  };

  onSelectAll = selected => {
    if (selected) {
      // 全选
      const list = flatNode(this.state.data);
      const rowKeys = handleRowKeys(list);
      this.setSelectedRowKeys(rowKeys);
      this.setSelectedRows(list);
    } else {
      // 取消
      this.setSelectedRowKeys([]);
      this.setSelectedRows([]);
    }
  };

  get rowSelection() {
    const { selectedRowKeys } = this.state;
    const rowSelection = {
      type: 'checkbox', 
      columnWidth: 100,
      fixed: true,
      selectedRowKeys,
      // checkStrictly: true,
      onSelect: this.onRowSelect,
      onSelectAll: this.onSelectAll,
    }
    return rowSelection;
  }

  render() {
    // const { rowSelection } = this;
    const { data, selectedRowKeys } = this.state;
    console.log(selectedRowKeys, 'selectedRowKeys')
    const rowSelection = {
      type: 'checkbox', 
      columnWidth: 100,
      fixed: true,
      selectedRowKeys,
      checkStrictly: true,
      onSelect: this.onRowSelect,
      onSelectAll: this.onSelectAll,
    }
    const columns = [
      {
        title: 'Name',
        dataIndex: 'name',
        key: 'name',
        width: 200,
        treeCol: true,
      },
      {
        title: 'Age',
        dataIndex: 'age',
        key: 'age',
        width: 300,
      },
      {
        title: 'Address',
        dataIndex: 'address',
        width: 500,
        key: 'address',
      },
    ];
    return (
      <div>
        <Button onClick={() => {
          this.setSelectedRowKeys([12, 121])
        }}>
          动态更新selectedRowKeys
        </Button>
        <PerformanceTable
          isTree
          virtualized
          rowKey={rowKey}
          minHeight={260}
          height={400}
          data={data}
          columns={columns}
          rowSelection={rowSelection}
          defaultExpandedRowKeys={[0]}
          onExpandChange={(expanded, rowData) => {
            // console.log(expanded, rowData);
          }}
          // renderTreeToggle={(icon, rowData, expanded) => {
          //   // if (rowData.labelName === '手机') {
          //   //   return <i className="icon icon-spin icon-spinner" />;
          //   // }
          //   // return icon;
          //   return <i className="icon icon-spin icon-spinner" />;
          // }}
        />
      </div>
    );
  }
}

ReactDOM.render(<TreeTable />, document.getElementById('container'));

操作步骤:

# 1. yarn 的源配置 
yarn config set registry http://nexus.saas.hand-china.com/content/groups/srm-npm-group/
# 2. 安装
yarn
# 3. 运行
yarn start

运行环境:

Mac
Chrome 98
choerodon-ui: 1.5.1

Modal.open page error

use drawerTransitionName prop with 'slide-bottom', Page report error;
Although there is no need to use the expected value in the enumeration, it should not be obtained by an error response.

lov级联查询清除级联条件后lov的值没有清空

image

ds = new DataSet({
    fields: [
      {
        name: 'mySex',
        type: 'string',
        label: '性别',
        lookupCode: 'HR.EMPLOYEE_GENDER',
      },
      {
        name: 'code',
        type: 'object',
        label: 'LOV',
        lovCode: 'LOV_CODE',
        cascadeMap: { sex: 'mySex' },
      },
    ],
    events: {
      update: handleDataSetChange,
    },
  });

hzero-ui css 样式bug

image
.ant-table.resizable-table table {
table-layout: fixed;
}
hzero-ui table组件 这个样式,影响页面布局,
hzero-ui
image
版本号 1.0.84

Upload 组件 如何显示dataSet 中查询出的地址所在图片

截屏2020-08-05 下午5 47 34

截屏2020-08-05 下午5 50 52

请问, 我定义一个dataSet, 绑定在一个form中, avatarUrl是后端查询得到一个图片地址, 怎么让表单中的Upload默认展示出这个地址的图片。
组件上是说props 可以 放入一个fileList, 但我不知如何从dataSet中获取到图片地址
const avatarField = currentDataSet.getField('avatarUrl')
const value = avatarField.getValue() // -> undefined, 得到form时还未开始查询, 先currentDataSet.query()一下 又有错误

高级组件 table 组件和

Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons: 1. You might have mismatching versions of React and the renderer (such as React DOM) 2. You might be breaking the Rules of Hooks 3. You might have more than one copy of React in the same app See https://reactjs.org/link/invalid-hook-call for tips about how to debug and fix this problem.

table
package.json 1.2.0

【ERROR】:在 set 和路由跳转时不定时报错

  1. 报错经常出现在 Lov组件清空级联数据的时候 dataSet.current.set('code', undefined);
    image
  2. 在路由变化时也会报错,非常偶然
    image

尝试过多个c7n 版本 1.4.3、0.8.74,并且多人遇到过,只在本地项目中出现,线上没有问题

Modal 弹出框Upload组件不是最新

ISSUE-256

这个问题依然 还没解决啊, 下面的API props什么的看不太懂,

const modal = Modal.open(...)
我把modal 传进 loadData 函数那, setState完了后, 不管我 
modal.render()/ renderChildren(modal.getBody())/ forceUpdate/ renderChildren( getForm(dataSet) )  。。  
都不行啊   控制台显示 renderChildren 不是一个function

Form绑定dataSet, 查询虽然是异步, 但都正常显示了, 就头像这 查询时放进state里, filelist查state, 不是最新的

TypeError: Cannot read property 'length' of undefined

使用import { Table } from 'choerodon-ui/pro';
的Table组件会报下面的错误

TypeError: Cannot read property 'length' of undefined
Table.renderTable
D:/Microsoft VS Code/project/PH/powerpip-choerodon-demo/table/Table.js:649
646 | const { rowSelection } = this.props;
647 | const prefixCls = this.getPrefixCls();
648 | const columns = this.columns.concat();

649 | if (rowSelection) {
| ^ 650 | const data = this.getFlatCurrentPageData().filter((item, index) => {
651 | if (rowSelection.getCheckboxProps) {
652 | return !this.getCheckboxPropsByItem(item, index).disabled;

dataset动态添加field在record取不到

this.headerDS.query().then((res) => {
      if (res.relationMethodCode === 'HEAD') {
        this.headerDS.addField('expRequisitionNumber', {
          type: FieldType.string,
          label: intl.get('hssp.screen.exp_report_hd.exp_requisition'),
          required: !!res.reqRequired,
        })
      }
    })

查询之后添加的动态字段用record.getField取不到相应的字段信息

文档书写有误

image
教程中,实现tree,绑定的dataSet不是导入进来的DS数据源

dataSet 应该增加一个getFields方法

有些业务场景我们需要动态的创建dataset并获取所有的Field。现在没有直接方法可以获取到。
望猪齿鱼开发组可以添加一个这样的方法。

a vulnerability CVE-2021-23358 is introduced in choerodon-ui

Hi, @Huihuawk @HughHzWu, a vulnerability CVE-2021-23358 is introduced in choerodon-ui via:
[email protected][email protected][email protected][email protected]

However, jsonlint is a legacy package, which has not been maintained for about 3 years.
Is it possible to migrate jsonlint to other package or remove it to remediate this vulnerability?

I noticed a migration record in other js repo for jsonlint:

● in cfn-include, version 1.0.0 ➔ 1.0.1, remove jsonlint via commit
● in gavel, version 2.1.2 ➔ 2.1.3, migrate jsonlint to json-parse-helpfulerror via commit

Thanks.

无法自定义表单组件的只读样式

能否像必输的c7n-pro-field-required样式类一样,给只读组件添加一个c7n-pro-field-readonly的样式类?
因为现在Select之类的组件,里面的input标签始终是readonly的,所以没有办法通过readonly属性自定义只读的样式。

Unhandled Rejection (Error): [MobX] 'has()' can only be used on observable objects, arrays and maps

Unhandled Rejection (Error): [MobX] 'has()' can only be used on observable objects, arrays and maps

import React from 'react';
import { Table } from 'choerodon-ui/pro';
export default class BusinessTrip extends React.Component {
render(){
return < Table columns={[]} dataSource={[]} / >
}
}

从choerodon-ui/pro中引用Table或者DataSet并且在页面中使用就会报这个错,有其他人遇到吗 怎么解决的.我的配置文件
[
'import',
{
libraryName: 'choerodon-ui',
style: true,
},
'c7n',
],
[
'import',
{
libraryName: 'choerodon-ui/pro',
style: true,
},
'c7n-pro',
],

[Bug]Icon component class

choerodon-ui 组件的 class 都带有 c7n 前缀,但是 Icon 组件渲染出来后没有 c7n 前缀,导致使用自定义图标资源,比如iconfont会出现图标覆盖。

1D485BA35E0DAE6E4685DFC92899F376

使用了iconfont之后,如果存在同名的class,就好出现c7n图标不显示

C8341A5CBD103CA3A90010345100913C

9921575884211_ pic_hd

9931575884211_ pic_hd

Uncaught (in promise) Error: Request failed with status code 404

image

使用import {Table } from 'choerodon-ui/pro';

createError.js:16 Uncaught (in promise) Error: Request failed with status code 404
at createError (createError.js:16)
at settle (settle.js:17)
at MockXMLHttpRequest.handleLoad [as onreadystatechange] (xhr.js:62)
at MockXMLHttpRequest.dispatchEvent (mock.js:8476)
at XMLHttpRequest.handle (mock.js:8304)
createError @ createError.js:16
settle @ settle.js:17
handleLoad @ xhr.js:62
dispatchEvent @ mock.js:8476
handle @ mock.js:8304
Promise.then (async)
asyncGeneratorStep @ asyncToGenerator.js:13
_next @ asyncToGenerator.js:25
(anonymous) @ asyncToGenerator.js:32
(anonymous) @ asyncToGenerator.js:21
fetchLovConfig @ Field.js:525
(anonymous) @ Field.js:66
executeAction @ mobx.module.js:191
runInAction @ mobx.module.js:375
Field @ Field.js:60
(anonymous) @ DataSet.js:1133
processIntlField @ utils.js:594
addField @ DataSet.js:1132
executeAction @ mobx.module.js:191
res @ mobx.module.js:183
(anonymous) @ DataSet.js:1118
initFields @ DataSet.js:1115
(anonymous) @ DataSet.js:67
executeAction @ mobx.module.js:191
runInAction @ mobx.module.js:375
DataSet @ DataSet.js:41
initQueryDataSet @ DataSet.js:1368
(anonymous) @ DataSet.js:69
executeAction @ mobx.module.js:191
runInAction @ mobx.module.js:375
DataSet @ DataSet.js:41
(anonymous) @ index.js:37
./src/components/TableDemo2/index.js @ index.js:297
webpack_require @ bootstrap:851
fn @ bootstrap:150
(anonymous) @ App.css?dde5:82
./src/App.js @ App.js:20
webpack_require @ bootstrap:851
fn @ bootstrap:150
(anonymous) @ index.css?bb0a:82
./src/index.js @ index.js:17
webpack_require @ bootstrap:851
fn @ bootstrap:150
1 @ index.js:17
webpack_require @ bootstrap:851
checkDeferredModules @ bootstrap:45
webpackJsonpCallback @ bootstrap:32
(anonymous) @ main.chunk.js:1
Show 17 more frames
createError.js:16 Uncaught (in promise) Error: Request failed with status code 404
at createError (createError.js:16)
at settle (settle.js:17)
at MockXMLHttpRequest.handleLoad [as onreadystatechange] (xhr.js:62)
at MockXMLHttpRequest.dispatchEvent (mock.js:8476)
at XMLHttpRequest.handle (mock.js:8304)
createError @ createError.js:16
settle @ settle.js:17
handleLoad @ xhr.js:62
dispatchEvent @ mock.js:8476
handle @ mock.js:8304
Promise.then (async)
asyncGeneratorStep @ asyncToGenerator.js:13
_next @ asyncToGenerator.js:25
(anonymous) @ asyncToGenerator.js:32
(anonymous) @ asyncToGenerator.js:21
fetchLovConfig @ Field.js:525
(anonymous) @ Field.js:66
executeAction @ mobx.module.js:191
runInAction @ mobx.module.js:375
Field @ Field.js:60
(anonymous) @ Record.js:524
processIntlField @ utils.js:594
addField @ Record.js:523
executeAction @ mobx.module.js:191
res @ mobx.module.js:183
(anonymous) @ Record.js:519
initFields @ Record.js:519
(anonymous) @ Record.js:43
executeAction @ mobx.module.js:191
runInAction @ mobx.module.js:375
Record @ Record.js:28
create @ DataSet.js:658
(anonymous) @ DataSet.js:118
(anonymous) @ _baseDelay.js:18
setTimeout (async)
baseDelay @ _baseDelay.js:18
(anonymous) @ defer.js:23
apply @ _apply.js:15
(anonymous) @ _overRest.js:32
(anonymous) @ DataSet.js:116
(anonymous) @ DataSet.js:115
executeAction @ mobx.module.js:191
runInAction @ mobx.module.js:375
set @ DataSet.js:111
initQueryDataSet @ DataSet.js:1373
(anonymous) @ DataSet.js:69
executeAction @ mobx.module.js:191
runInAction @ mobx.module.js:375
DataSet @ DataSet.js:41
(anonymous) @ index.js:37
./src/components/TableDemo2/index.js @ index.js:297
webpack_require @ bootstrap:851
fn @ bootstrap:150
(anonymous) @ App.css?dde5:82
./src/App.js @ App.js:20
webpack_require @ bootstrap:851
fn @ bootstrap:150
(anonymous) @ index.css?bb0a:82
./src/index.js @ index.js:17
webpack_require @ bootstrap:851
fn @ bootstrap:150
1 @ index.js:17
webpack_require @ bootstrap:851
checkDeferredModules @ bootstrap:45
webpackJsonpCallback @ bootstrap:32
(anonymous) @ main.chunk.js:1
construct.js:19 Uncaught (in promise) Error: Request failed with status code 404
at createError (createError.js:16)
at settle (settle.js:17)
at MockXMLHttpRequest.handleLoad [as onreadystatechange] (xhr.js:62)
at MockXMLHttpRequest.dispatchEvent (mock.js:8476)
at XMLHttpRequest.handle (mock.js:8304)
_construct @ construct.js:19
Wrapper @ wrapNativeSuper.js:26
(anonymous) @ DataSetComponent.js:33
DataSetRequestError @ DataSetRequestError.js:4
_callee9$ @ DataSet.js:1449
tryCatch @ runtime.js:63
invoke @ runtime.js:293
(anonymous) @ runtime.js:118
asyncGeneratorStep @ asyncToGenerator.js:3
_throw @ asyncToGenerator.js:29
Promise.catch (async)
add @ PromiseQueue.js:25
executeAction @ mobx.module.js:191
res @ mobx.module.js:183
query @ DataSet.js:439
(anonymous) @ DataSet.js:78
executeAction @ mobx.module.js:191
runInAction @ mobx.module.js:375
DataSet @ DataSet.js:41
(anonymous) @ index.js:37
./src/components/TableDemo2/index.js @ index.js:297
webpack_require @ bootstrap:851
fn @ bootstrap:150
(anonymous) @ App.css?dde5:82
./src/App.js @ App.js:20
webpack_require @ bootstrap:851
fn @ bootstrap:150
(anonymous) @ index.css?bb0a:82
./src/index.js @ index.js:17
webpack_require @ bootstrap:851
fn @ bootstrap:150
1 @ index.js:17
webpack_require @ bootstrap:851
checkDeferredModules @ bootstrap:45
webpackJsonpCallback @ bootstrap:32
(anonymous) @ main.chunk.js:1
createError.js:16 Uncaught (in promise) Error: Request failed with status code 404
at createError (createError.js:16)
at settle (settle.js:17)
at MockXMLHttpRequest.handleLoad [as onreadystatechange] (xhr.js:62)
at MockXMLHttpRequest.dispatchEvent (mock.js:8476)
at XMLHttpRequest.handle (mock.js:8304)

[BUG]: PerformanceTable 超过一定高度数据展示不出来

  1. 问题描述
    当 PerformanceTable 中数据过多(大于 40000 条,demo中大于 30000 条),数据只展示十几条,已开启虚拟滚动;

猜测:内层 content div 高度是科学计数法表示的,未处理,导致浏览器渲染出问题

  1. 期望结果
    PerformanceTable 能展示出所有数据,期望修复之前的版本

测试版本:1.4.4,1.4.5
浏览器:chrome 91.0

如何 快速开始 一个项目?

我是一个后端, 对前端了解不多, 看到猪齿鱼这个UI风格很棒, 但如何快速的构造一个完整(带路由、权限等)、简易、UI风格
统一的项目, 供后续开发? 通过提供的帮助文档我只能零星的知道其中的某个组件怎么用。 找一个现成的react项目,替换掉全部
的component ? antd pro 则提供了一键初始化项目的功能。

这个要求是不是太大了?😂

ts下使用Collapse报错

image

import React, { PureComponent } from 'react';
import { Header, Content } from 'components/Page';
import { Collapse } from 'choerodon-ui';

const { Panel } = Collapse;

export default class ReportDetailPage extends PureComponent {

  render() {
    return (
      <>
        <Header title="费用报销单详情" backPath="/exp/report/list">
        </Header>
        <Content>
          <Collapse>
            <Panel key="1" header="测试">
              123
            </Panel>
          </Collapse>
        </Content>
      </>
    );
  }

}

choerodon-ui version : 0.8.59

请问Modal.open 里面如何获取state最新值

后端兼职前端,新人,对react的一些核心概念似懂非懂...
问题:
点开弹出框,显示的用户头像是上一次的,fileList不是最新值,之前antd的时候,是在render中 写Modal标签用visible控制显示,它自己会实时渲染的,这里Modal的pro组件可以这么写吗?visible属性都没有, 请问大神这问题该如何解决?

( 另外想知道问题出现的原因是什么, 是因为非return/render不会实时渲染吗? )

伪代码如下:

const comp = () => {

    const context = useContext(Store);
    const { dataSet } = context;

    const [fileList,setFileList] = useState(UploadFile[]);
    
    // 点击按钮,触发
    const showModal = (userId: number) => {
        loadData(userId)
        Modal.open(
            ..
            children: getForm() // 调用getForm获取表单
        )
    }

     async function loadData (userId: number) {
        axios.get(..) // 调后端,查用户信息.
        .then(result => {

            dataSet.loadData([result])

            setFileList({  // 头像url放进state中
                ..
                url 
           })
        })
    }

    cosnt getForm = () => {
        props = {
            ..
            defaultList = fileList // 取state变量
        }
        <Form dataSet={dataSet}>
            ..
            <Upload props={..props} >上传</>
        </Form>
    }
    
    return (
        <div>XXXX</div>
    )
}
export default comp;

datePicker指定最大值、最小值的问题

 {
        name: 'reportDateFrom',
        type: FieldType.date,
        max: 'reportDateTo',
        label: intl.get('hssp.screen.exp_report_header.report_date_from'),
      },
      {
        name: 'reportDateTo',
        type: FieldType.date,
        min: 'reportDateFrom',
        label: intl.get('hssp.screen.exp_report_header.report_date_to'),
      },

在dataset的fields里给日期字段指定了最大值、最小值之后,在没有选择日期时,最大值、最小值都会变成当前日期。
这样会导致用户日期从选不到当前日期之后的日期,日期到选不到当前日期之前的日期。如果选了之后再清空,就全部变成不可选了。
image

image

能否改成没有值的时候不做限制?

[BUG]: Table 组件个性化 customizedCode 变化没有触发列更新

  1. 问题描述
    当传递 customizable 属性时,前后传递 customizedCode 参数不一致,没有触发 loadCustomized 函数,页面列展示没有任何变化(代码:master 分支 TableStore 文件 1297 行)。
  2. 期望效果
    期望 customizedCode 变化时可以触发列样式的更新;
    动态添加 customizable、customizedCode 属性时,期望可以触发列更新,而不是Table 初始化时就需要添加 customizable 属性;

使用版本:1.3.2; 测试版本:1.3.2、1.4.4

[Bug] DataSet-Children

image
image
image


如上图所示,点击新增列时会对 dataSet 下的所有数据中 childComponent 新增一个对象,但是操作结束时,console 中打印出的第一条 record 未经过修改
版本:0.8.41
如何复现:请参考下图 DataSet
image
PS:删除该 children 定义后即可恢复正常
初步推测:childrencurrent(默认第一条数据)绑定了 dataSet,导致第一条数据的修改只能从 children 指定的 dataSet 进行修改,而其他的数据则不受影响
期望结果:修改原始数据时,能够映射至 children 中的 DataSet

Error: [MobX] 'has()' can only be used on observable objects, arrays and maps

Error: [MobX] 'has()' can only be used on observable objects, arrays and maps
▶ 36 stack frames were collapsed.
This screen is visible only in development. It will not appear if the app crashes in production.
Open your browser’s developer console to further inspect this error. Click the 'X' or hit ESC to dismiss this message.

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.