From b8aa5da1b2873bea760483cc5ab335fde9fb6de6 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期四, 12 五月 2022 18:15:56 +0800 Subject: [PATCH] 2022-05-12 --- src/menu/components/table/edit-table/columns/index.jsx | 35 +++++++++++++---------------------- 1 files changed, 13 insertions(+), 22 deletions(-) diff --git a/src/menu/components/table/edit-table/columns/index.jsx b/src/menu/components/table/edit-table/columns/index.jsx index cbf2d50..23067de 100644 --- a/src/menu/components/table/edit-table/columns/index.jsx +++ b/src/menu/components/table/edit-table/columns/index.jsx @@ -149,7 +149,7 @@ val = column.formula if (column.eval === 'false') { val = val.replace(/\n/ig, '<br/>').replace(/\s/ig, ' ') - val = <span dangerouslySetInnerHTML={{__html: val}}></span> + val = <span style={{fontWeight: 'inherit'}} dangerouslySetInnerHTML={{__html: val}}></span> } } return ( @@ -199,18 +199,17 @@ return uuid.join('') }) () - if (config.wrap && config.wrap.borderColor) { // 杈规棰滆壊 - let style = `#${tableId} table, #${tableId} tr, #${tableId} th, #${tableId} td {border-color: ${config.wrap.borderColor}}` - let ele = document.createElement('style') - ele.innerHTML = style - document.getElementsByTagName('head')[0].appendChild(ele) - } - this.setState({ tableId, columns: fromJS(config.cols).toJS(), fields: fromJS(config.columns).toJS(), lineMarks: config.lineMarks ? fromJS(config.lineMarks).toJS() : [] + }, () => { + const element = document.getElementById(tableId) + element && element.style.setProperty('--mk-table-border-color', config.wrap.borderColor || '#e8e8e8') + element && element.style.setProperty('--mk-table-color', config.wrap.color || 'rgba(0, 0, 0, 0.65)') + element && element.style.setProperty('--mk-table-font-size', config.wrap.fontSize || '14px') + element && element.style.setProperty('--mk-table-font-weight', config.wrap.fontWeight || 'normal') }) } @@ -224,11 +223,12 @@ } } else if (!is(fromJS(this.state.fields), fromJS(nextProps.config.columns))) { this.setState({fields: fromJS(nextProps.config.columns).toJS()}) - } else if (this.props.config.wrap.borderColor !== nextProps.config.wrap.borderColor) { - let style = `#${this.state.tableId} table, #${this.state.tableId} tr, #${this.state.tableId} th, #${this.state.tableId} td {border-color: ${nextProps.config.wrap.borderColor}}` - let ele = document.createElement('style') - ele.innerHTML = style - document.getElementsByTagName('head')[0].appendChild(ele) + } else if (!is(fromJS(this.props.config.wrap), fromJS(nextProps.config.wrap))) { + const element = document.getElementById(this.state.tableId) + element && element.style.setProperty('--mk-table-border-color', nextProps.config.wrap.borderColor || '#e8e8e8') + element && element.style.setProperty('--mk-table-color', nextProps.config.wrap.color || 'rgba(0, 0, 0, 0.65)') + element && element.style.setProperty('--mk-table-font-size', nextProps.config.wrap.fontSize || '14px') + element && element.style.setProperty('--mk-table-font-weight', nextProps.config.wrap.fontWeight || 'normal') } } @@ -560,14 +560,6 @@ } }) - let style = {} - if (config.wrap.color) { - style.color = config.wrap.color - } - if (config.wrap.fontSize) { - style.fontSize = config.wrap.fontSize - } - return ( <div className={`edit-table-columns ${config.setting.laypage} ${config.wrap.mode || ''}`} id={tableId}> <div className="col-control"> @@ -589,7 +581,6 @@ rowKey="uuid" size={config.wrap.size || 'middle'} rowClassName="editable-row" - style={style} bordered={config.wrap.bordered !== 'false'} rowSelection={rowSelection} components={components} -- Gitblit v1.8.0