From 38cb9e9a72eba38d8e560a289ca2d9a7e30815a3 Mon Sep 17 00:00:00 2001 From: "ext.pangzhaoqun1" Date: Mon, 24 Jan 2022 15:38:43 +0800 Subject: [PATCH 1/7] =?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/7] =?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/7] =?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/7] =?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/7] =?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 From a77672d8d893b7e594bc6476bb5f6e3b5a187cff Mon Sep 17 00:00:00 2001 From: "ext.pangzhaoqun1" Date: Thu, 27 Jan 2022 16:47:15 +0800 Subject: [PATCH 6/7] =?UTF-8?q?=E8=AF=A6=E6=83=85=E9=A1=B5=E9=9D=A2?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E8=AF=A6=E6=83=85=E8=AF=B4=E6=98=8E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/detail/detailInfo/index.tsx | 85 ++++++++++++++++++++++ src/components/detail/index.tsx | 11 ++- src/index.tsx | 1 + 3 files changed, 94 insertions(+), 3 deletions(-) create mode 100644 src/components/detail/detailInfo/index.tsx diff --git a/src/components/detail/detailInfo/index.tsx b/src/components/detail/detailInfo/index.tsx new file mode 100644 index 0000000..912c664 --- /dev/null +++ b/src/components/detail/detailInfo/index.tsx @@ -0,0 +1,85 @@ +import React from 'react' +import { DetailField, DetailFieldConfig, DetailFieldError, IDetailField } from '../common' +import StatementHelper, { StatementConfig } from '../../../util/statement' +import marked from 'marked' + +export interface InfoDetailConfig extends DetailFieldConfig { + type: 'detail_info' + description?: { + descType: 'text' | 'tooltip' | 'modal' + label?: StatementConfig + mode: 'plain' | 'markdown' | 'html' + content?: StatementConfig + showIcon: boolean + }, +} + +export interface IInfoProps { + description?: { + descType: 'text' | 'tooltip' | 'modal' + label: string | undefined + content: React.ReactNode + showIcon: boolean + } +} + +export default class InfoDetail extends DetailField implements IDetailField { + renderComponent = (props: IInfoProps) => { + return + 您当前使用的UI版本没有实现InfoDetail组件。 + + } + + render = () => { + const props: IInfoProps = {} + const { + config: { + description + } + } = this.props + if(description) { + if(description.descType === 'text') { + props.description = { + descType: 'text', + label: StatementHelper(description.label, { data: this.props.data, step: this.props.step }), + content: description.content, + showIcon: description.showIcon + } + } else if (description.descType === 'tooltip') { + props.description = { + descType: 'tooltip', + label: StatementHelper(description.label, { data: this.props.data, step: this.props.step }), + content: description.content, + showIcon: description.showIcon + } + } else { + props.description = { + descType: 'modal', + label: StatementHelper(description.label, { data: this.props.data, step: this.props.step }), + content: description.content, + showIcon: description.showIcon + } + } + if(description.content !== undefined) { + const descriptionType = description.mode + switch (descriptionType) { + case 'plain': + props.description && (props.description.content = StatementHelper(description.content, { data: this.props.data, step: this.props.step })) + break + case 'markdown': + props.description && (props.description.content =
) + break + case 'html': + props.description && (props.description.content =
) + break + } + } + } + + return ( + + {this.renderComponent(props)} + + ) + } +} diff --git a/src/components/detail/index.tsx b/src/components/detail/index.tsx index 24ae057..a6b7057 100644 --- a/src/components/detail/index.tsx +++ b/src/components/detail/index.tsx @@ -5,6 +5,7 @@ import StatementDetail, { StatementDetailConfig } from './statement' import GroupField, { GroupFieldConfig } from './group' import ImportSubformField, { ImportSubformFieldConfig } from './importSubform' +import InfoDetail, { InfoDetailConfig } from './detailInfo' /** * 详情步骤内详情项配置文件格式定义 - 枚举 @@ -14,19 +15,23 @@ export type DetailFieldConfigs = EnumDetailConfig | StatementDetailConfig | GroupFieldConfig | - ImportSubformFieldConfig + ImportSubformFieldConfig | + InfoDetailConfig + export type componentType = 'text' | 'group' | 'detail_enum' | 'statement' | - 'import_subform' + 'import_subform' | + 'detail_info' export default { group: GroupField, text: TextField, import_subform: ImportSubformField, detail_enum: EnumDetail, - statement: StatementDetail + statement: StatementDetail, + detail_info: InfoDetail } diff --git a/src/index.tsx b/src/index.tsx index b193a05..297d872 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -58,6 +58,7 @@ export { default as DetailEunmField } from './components/detail/enum' export { default as DetailStatementField } from './components/detail/statement' export { default as DetailTextField } from './components/detail/text' export { default as DetailImportSubformField } from './components/detail/importSubform' +export { default as DetailInfoField } from './components/detail/detailInfo' export { default as HeaderStep } from './steps/header' -- Gitee From 8faf8396049fbc8ae0fe32666070a2d45e018118 Mon Sep 17 00:00:00 2001 From: "ext.pangzhaoqun1" Date: Thu, 17 Mar 2022 18:22:33 +0800 Subject: [PATCH 7/7] =?UTF-8?q?=E4=BF=9D=E5=AD=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/detail/detailInfo/index.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/detail/detailInfo/index.tsx b/src/components/detail/detailInfo/index.tsx index 912c664..939662f 100644 --- a/src/components/detail/detailInfo/index.tsx +++ b/src/components/detail/detailInfo/index.tsx @@ -75,7 +75,7 @@ export default class InfoDetail extends DetailField {this.renderComponent(props)} -- Gitee