-
Notifications
You must be signed in to change notification settings - Fork 7.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(table): 重写列宽度计算方式,以实际内容宽度为准 #1900
Conversation
…换行,而不是截断,这样是为了让视觉更清晰;同时在CSS中增加了nowrap类
…换行,而不是截断,这样是为了让视觉更清晰;同时在CSS中增加了nowrap类 Signed-off-by: 凌天翔龙 <15810208908@qq.com>
Run & review this pull request in StackBlitz Codeflow. |
增加nowrap参数支持强制换行
增加nowrap类
增加事件处理方式,支持在render(options)的参数中直接定义lay-event指定的需要执行的时间方法;我认为现在的layui事件处理是需要优化的,同时在回调的参数,增加了(index,rows,cols),index:当前事件行索引,rows:当前事件行数据,cols:录前事件列配置信息
修正当不使用分页时的BUG
感谢您的 PR
|
refresh
优化事件注册判断方式
当列数据少的时候防止表头显示不全,提高视觉呈现的直观性
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
包含了太多 CSS 空格的变动,可能是编辑器进行了格式化处理,建议在本次 PR 中移除 layui.css
。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
因为工具不一致导致,我用的Visual Studio,这工具对CSS格式化的时候在值前面加空格了
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
table.js
存在提交记录的冲突
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
主要是我重写了不少地方的代码,以及增加了不少新功能与其他版本冲突吧;可以直接用的版本,
重写的部分:单元格的宽度计算,改成了以多行数据中的最多数据实际长度(但不大于设定的最大列宽)作为列宽度,主要是为了让数据能直观全部呈现出来,当大于列宽的时候自动换行或溢出(以nowrap参数控制);重写分页处理逻辑及增加当选择或改变页码时执行onselect时间,这样更适合在各环境中兼容使用;增加在表格数据渲染时的options中增加自定义事件,不用在额外用layui.event进行处理,这样方便上下文的数据引用及处理;具体可看一下我的代码版本以及对未来其他模块进行重写以及采用我的思路,让使用起来更快捷简便。
该 PR 由于文件内容出现了大量格式化的差异,以及存在代码冲突,难以进行 Review。暂时设置为 Draft 状态。 |
另外增加一个表格布局:工具栏及分页栏上下固定的CSS: .layui-table-view { position: absolute; top: 0; left: 0; right: 0; bottom: 0; } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
感谢您的贡献。
由于您的编辑器对代码进行了格式化处理,导致与当前文本的差异过大,难以进行 review,该 PR 先关闭。
建议:同步仓库 main
的最新代码(避免代码冲突),在本地使用 VScode 或 Sublime Text 编辑器修改,再重新创建 PR。
接下来会对 Layui 配置 Prettier,以保证代码格式的统一。 |
之前一直用Visual Studio,现在用vs code,vs code的格式代码,可以的啊。。 |
😃 本次 PR 的变化性质
🌱 本次 PR 的变化内容
✅ 本次 PR 的满足条件