提交 38864e07 编写于 作者: jlj05024111@163.com's avatar jlj05024111@163.com

feat: 表格更新支持通过控件参数决定表格是否允许换行

上级 c684e46b
/* eslint-disable @typescript-eslint/no-explicit-any */
/* eslint-disable no-param-reassign */ /* eslint-disable no-param-reassign */
import { GridController } from '@ibiz-template/controller'; import { GridController } from '@ibiz-template/controller';
import { import {
...@@ -127,9 +128,15 @@ export function useITableColumns(c: GridController) { ...@@ -127,9 +128,15 @@ export function useITableColumns(c: GridController) {
} else if (frozenLastColumn && index >= allNum - frozenLastColumn) { } else if (frozenLastColumn && index >= allNum - frozenLastColumn) {
column.fixed = 'right'; column.fixed = 'right';
} }
if (ibiz.env.enableGridRowBreak) { if (
(ibiz.env.enableGridRowBreak as any) === 'TRUE' ||
ibiz.env.enableGridRowBreak === true
) {
column.ellipsis = false; column.ellipsis = false;
} }
if (c.controlParams.ENABLEGRIDROWBREAK) {
column.ellipsis = c.controlParams.ENABLEGRIDROWBREAK !== 'TRUE';
}
}); });
return copy; return copy;
}); });
......
/* eslint-disable @typescript-eslint/no-explicit-any */
import { import {
GridFieldColumnController, GridFieldColumnController,
GridRowController, GridRowController,
...@@ -21,6 +22,8 @@ export const GridFieldColumn = defineComponent({ ...@@ -21,6 +22,8 @@ export const GridFieldColumn = defineComponent({
setup(props) { setup(props) {
const ns = useNamespace('grid-field-column'); const ns = useNamespace('grid-field-column');
const c = props.controller;
const codeList = props.controller.model.source.getPSAppCodeList(); const codeList = props.controller.model.source.getPSAppCodeList();
/** /**
...@@ -41,6 +44,15 @@ export const GridFieldColumn = defineComponent({ ...@@ -41,6 +44,15 @@ export const GridFieldColumn = defineComponent({
props.controller.triggerAction(props.row, event); props.controller.triggerAction(props.row, event);
} }
}; };
const enableGridRowBreak = computed(() => {
if (c?.grid?.controlParams?.ENABLEGRIDROWBREAK) {
return c.grid.controlParams.ENABLEGRIDROWBREAK === 'TRUE';
}
return (
(ibiz.env.enableGridRowBreak as any) === 'TRUE' ||
ibiz.env.enableGridRowBreak === true
);
});
const alignStyle = computed(() => { const alignStyle = computed(() => {
let justContent = ''; let justContent = '';
...@@ -58,7 +70,7 @@ export const GridFieldColumn = defineComponent({ ...@@ -58,7 +70,7 @@ export const GridFieldColumn = defineComponent({
return ns.cssVarBlock({ 'justify-content': justContent }); return ns.cssVarBlock({ 'justify-content': justContent });
}); });
return { ns, alignStyle, codeList, onCellClick }; return { ns, alignStyle, codeList, onCellClick, enableGridRowBreak };
}, },
render() { render() {
const c = this.controller; const c = this.controller;
...@@ -73,7 +85,7 @@ export const GridFieldColumn = defineComponent({ ...@@ -73,7 +85,7 @@ export const GridFieldColumn = defineComponent({
<code-list <code-list
class={[ class={[
this.ns.e('text'), this.ns.e('text'),
this.ns.is('enablebreak', ibiz.env.enableGridRowBreak), this.ns.is('enablebreak', this.enableGridRowBreak),
]} ]}
codeListItems={c.codeListItems} codeListItems={c.codeListItems}
codeList={this.codeList} codeList={this.codeList}
...@@ -84,7 +96,7 @@ export const GridFieldColumn = defineComponent({ ...@@ -84,7 +96,7 @@ export const GridFieldColumn = defineComponent({
<span <span
class={[ class={[
this.ns.e('text'), this.ns.e('text'),
this.ns.is('enablebreak', ibiz.env.enableGridRowBreak), this.ns.is('enablebreak', this.enableGridRowBreak),
]} ]}
> >
{fieldValue} {fieldValue}
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册