From 38cb9e9a72eba38d8e560a289ca2d9a7e30815a3 Mon Sep 17 00:00:00 2001 From: "ext.pangzhaoqun1" Date: Mon, 24 Jan 2022 15:38:43 +0800 Subject: [PATCH 1/5] =?UTF-8?q?=E6=8B=89=E5=8F=96=E8=BF=9C=E7=A8=8B?= =?UTF-8?q?=E5=88=86=E6=94=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/steps/table/index.tsx | 62 +++++++++++++++++++++++++++++++++++---- 1 file changed, 57 insertions(+), 5 deletions(-) diff --git a/src/steps/table/index.tsx b/src/steps/table/index.tsx index 72111dc..6fdd48d 100644 --- a/src/steps/table/index.tsx +++ b/src/steps/table/index.tsx @@ -9,6 +9,8 @@ import CCMS, { CCMSConfig } from '../../main' import { cloneDeep, get, set } from 'lodash' import InterfaceHelper, { InterfaceConfig } from '../../util/interface' import ConditionHelper, { ConditionConfig } from '../../util/condition' +import { StatementConfig } from '../../util/statement' +import marked from 'marked' /** * 表格步骤配置文件格式定义 @@ -32,6 +34,12 @@ export interface TableConfig extends StepConfig { current?: string pageSize?: string total?: string + }, + description?: { + type: 'text' | 'tooltip' | 'modal' + label?: string | undefined + mode: 'plain' | 'markdown' | 'html' + content?: string | undefined } } @@ -98,7 +106,12 @@ export interface ITable { onChange: (page: number, pageSize: number) => void } tableOperations: React.ReactNode | null - multirowOperations: React.ReactNode | null + multirowOperations: React.ReactNode | null, + description?: { + type: string + label: string | undefined + content: React.ReactNode + } } /** @@ -430,7 +443,7 @@ export default class TableStep extends Step { 您当前使用的UI版本没有实现Table组件的OperationGroupItem部分。 } - + renderOperationModal = (props: ITableStepOperationModal) => { const mask = document.createElement('DIV') mask.style.position = 'fixed' @@ -457,13 +470,16 @@ export default class TableStep extends Step { primary, columns, operations, - pagination + pagination, + description }, data, step, onUnmount } = this.props + console.log(this.props) + const { operation: { enable: operationEnable, @@ -481,14 +497,13 @@ export default class TableStep extends Step { if (Object.prototype.toString.call(getDate) !== '[object Array]') { getDate = [] } - + console.log(getDate) const props: ITable = { title: label, primary, data: getDate, columns: (columns || []).filter((column) => column.field !== undefined && column.field !== '').map((column, index) => { const field = column.field.split('.')[0] - return { field, label: column.label, @@ -564,6 +579,43 @@ export default class TableStep extends Step { multirowOperations: null } + if(description) { + if(description.type === 'text') { + props.description = { + type: 'text', + label: description.label, + content: description.content + } + } else if (description.type === 'tooltip') { + props.description = { + type: 'tooltip', + label: description.label, + content: description.content + } + } else { + props.description = { + type: 'modal', + label: description.label, + content: description.content + } + } + } + + if (description && description.content !== undefined) { + const descriptionType = description.mode + switch (descriptionType) { + case 'plain': + props.description && (props.description.content = description.content) + break + case 'markdown': + props.description && (props.description.content =
) + break + case 'html': + props.description && (props.description.content =
) + break + } + } + if (pagination && pagination.mode === 'server') { const paginationCurrent = Number((pagination.current === undefined || pagination.current === '') ? data[step] : get(data[step], pagination.current, 1)) const paginationPageSize = Number((pagination.pageSize === undefined || pagination.pageSize === '') ? data[step] : get(data[step], pagination.pageSize, 10)) -- Gitee From 1188c3ec25ad4e87d5b1c2985d4bf88496565fcc Mon Sep 17 00:00:00 2001 From: "ext.pangzhaoqun1" Date: Tue, 25 Jan 2022 10:38:46 +0800 Subject: [PATCH 2/5] =?UTF-8?q?=E5=88=A0=E9=99=A4console.log?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/steps/table/index.tsx | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/steps/table/index.tsx b/src/steps/table/index.tsx index 6fdd48d..b3f9af1 100644 --- a/src/steps/table/index.tsx +++ b/src/steps/table/index.tsx @@ -478,8 +478,6 @@ export default class TableStep extends Step { onUnmount } = this.props - console.log(this.props) - const { operation: { enable: operationEnable, @@ -497,7 +495,6 @@ export default class TableStep extends Step { if (Object.prototype.toString.call(getDate) !== '[object Array]') { getDate = [] } - console.log(getDate) const props: ITable = { title: label, primary, -- Gitee From d425cd01d1cbf8ced007f08ce3a8b8cde268e089 Mon Sep 17 00:00:00 2001 From: "ext.pangzhaoqun1" Date: Tue, 25 Jan 2022 11:26:06 +0800 Subject: [PATCH 3/5] =?UTF-8?q?=E4=BF=AE=E6=94=B9description-type=E7=B1=BB?= =?UTF-8?q?=E5=9E=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/steps/table/index.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/steps/table/index.tsx b/src/steps/table/index.tsx index b3f9af1..72b09b1 100644 --- a/src/steps/table/index.tsx +++ b/src/steps/table/index.tsx @@ -108,7 +108,7 @@ export interface ITable { tableOperations: React.ReactNode | null multirowOperations: React.ReactNode | null, description?: { - type: string + type: 'text' | 'tooltip' | 'modal' label: string | undefined content: React.ReactNode } -- Gitee From cbdf549bba4e7b86e6439196647c4c25c31edddb Mon Sep 17 00:00:00 2001 From: "ext.pangzhaoqun1" Date: Tue, 25 Jan 2022 18:54:20 +0800 Subject: [PATCH 4/5] =?UTF-8?q?=E4=BF=AE=E6=94=B9review=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/steps/table/index.tsx | 51 ++++++++++++++++++++------------------- 1 file changed, 26 insertions(+), 25 deletions(-) diff --git a/src/steps/table/index.tsx b/src/steps/table/index.tsx index 72b09b1..bee726d 100644 --- a/src/steps/table/index.tsx +++ b/src/steps/table/index.tsx @@ -9,9 +9,8 @@ import CCMS, { CCMSConfig } from '../../main' import { cloneDeep, get, set } from 'lodash' import InterfaceHelper, { InterfaceConfig } from '../../util/interface' import ConditionHelper, { ConditionConfig } from '../../util/condition' -import { StatementConfig } from '../../util/statement' +import StatementHelper, { StatementConfig } from '../../util/statement' import marked from 'marked' - /** * 表格步骤配置文件格式定义 * - field: 表格列表数据来源字段 @@ -37,9 +36,10 @@ export interface TableConfig extends StepConfig { }, description?: { type: 'text' | 'tooltip' | 'modal' - label?: string | undefined + label?: StatementConfig mode: 'plain' | 'markdown' | 'html' content?: string | undefined + showIcon: boolean } } @@ -111,6 +111,7 @@ export interface ITable { type: 'text' | 'tooltip' | 'modal' label: string | undefined content: React.ReactNode + showIcon: boolean } } @@ -575,44 +576,44 @@ export default class TableStep extends Step { : null, multirowOperations: null } - if(description) { if(description.type === 'text') { props.description = { type: 'text', - label: description.label, - content: description.content + label: StatementHelper(description.label, { data: this.props.data, step: this.props.step }), + content: description.content, + showIcon: description.showIcon } } else if (description.type === 'tooltip') { props.description = { type: 'tooltip', - label: description.label, - content: description.content + label: StatementHelper(description.label, { data: this.props.data, step: this.props.step }), + content: description.content, + showIcon: description.showIcon } } else { props.description = { type: 'modal', - label: description.label, - content: description.content + label: StatementHelper(description.label, { data: this.props.data, step: this.props.step }), + content: description.content, + showIcon: description.showIcon } } - } - - if (description && description.content !== undefined) { - const descriptionType = description.mode - switch (descriptionType) { - case 'plain': - props.description && (props.description.content = description.content) - break - case 'markdown': - props.description && (props.description.content =
) - break - case 'html': - props.description && (props.description.content =
) - break + if(description.content !== undefined) { + const descriptionType = description.mode + switch (descriptionType) { + case 'plain': + props.description && (props.description.content = description.content) + break + case 'markdown': + props.description && (props.description.content =
) + break + case 'html': + props.description && (props.description.content =
) + break + } } } - if (pagination && pagination.mode === 'server') { const paginationCurrent = Number((pagination.current === undefined || pagination.current === '') ? data[step] : get(data[step], pagination.current, 1)) const paginationPageSize = Number((pagination.pageSize === undefined || pagination.pageSize === '') ? data[step] : get(data[step], pagination.pageSize, 10)) -- Gitee From 25be20f14c54ab60596b9f4c2fff2c39b81eecc5 Mon Sep 17 00:00:00 2001 From: "ext.pangzhaoqun1" Date: Wed, 26 Jan 2022 16:33:54 +0800 Subject: [PATCH 5/5] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E8=AF=A6=E6=83=85?= =?UTF-8?q?=E5=86=85=E5=AE=B9=E7=B1=BB=E5=9E=8Bstatementconfig?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/steps/table/index.tsx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/steps/table/index.tsx b/src/steps/table/index.tsx index bee726d..78b0b32 100644 --- a/src/steps/table/index.tsx +++ b/src/steps/table/index.tsx @@ -38,7 +38,7 @@ export interface TableConfig extends StepConfig { type: 'text' | 'tooltip' | 'modal' label?: StatementConfig mode: 'plain' | 'markdown' | 'html' - content?: string | undefined + content?: StatementConfig showIcon: boolean } } @@ -603,13 +603,13 @@ export default class TableStep extends Step { const descriptionType = description.mode switch (descriptionType) { case 'plain': - props.description && (props.description.content = description.content) + props.description && (props.description.content = StatementHelper(description.content, { data: this.props.data, step: this.props.step })) break case 'markdown': - props.description && (props.description.content =
) + props.description && (props.description.content =
) break case 'html': - props.description && (props.description.content =
) + props.description && (props.description.content =
) break } } -- Gitee