Commit bb802ce0c578aaa88ace2d3fcf5e9c9a03b7ba08

Authored by 邱嘉伟
1 parent c464b784

fix :部分问题修复 样式优化

@@ -93,10 +93,10 @@ const ParameterModal: React.FC<ParameterSettingProps> = (props) => { @@ -93,10 +93,10 @@ const ParameterModal: React.FC<ParameterSettingProps> = (props) => {
93 handleChangeField, 93 handleChangeField,
94 inputKey, 94 inputKey,
95 nodeType, 95 nodeType,
  96 + expandedKeys,
96 type, 97 type,
97 } = props; 98 } = props;
98 const [searchValue, setSearchValue] = useState(''); 99 const [searchValue, setSearchValue] = useState('');
99 - const [defaultExpandedKeys, setDefaultExpandedKeys] = useState<React.Key[]>(); //树节点的id 有了则展开  
100 100
101 // const [form] = Form.useForm() 101 // const [form] = Form.useForm()
102 //判断数组是否只有一个子节点 102 //判断数组是否只有一个子节点
@@ -147,15 +147,19 @@ const ParameterModal: React.FC<ParameterSettingProps> = (props) => { @@ -147,15 +147,19 @@ const ParameterModal: React.FC<ParameterSettingProps> = (props) => {
147 </div> 147 </div>
148 ), 148 ),
149 dataIndex: 'code', 149 dataIndex: 'code',
150 - className: 'code-header',  
151 - width: '150px', 150 + className: 'ps-table-cell-header',
  151 + width: '190px',
152 key: 'code', 152 key: 'code',
153 render: (text, record) => { 153 render: (text, record) => {
154 const strTitle = (text as string) || ''; 154 const strTitle = (text as string) || '';
155 const index = strTitle.indexOf(searchValue); 155 const index = strTitle.indexOf(searchValue);
156 return ( 156 return (
157 <Input 157 <Input
158 - style={{ color: index > -1 && searchValue ? '#1890ff' : '' }} 158 + style={{
  159 + color: index > -1 && searchValue ? '#1890ff' : '',
  160 + maxWidth: '110px',
  161 + minWidth: '50px',
  162 + }}
159 draggable={true} 163 draggable={true}
160 onDragStart={(event) => { 164 onDragStart={(event) => {
161 event.stopPropagation(); 165 event.stopPropagation();
@@ -208,7 +212,7 @@ const ParameterModal: React.FC<ParameterSettingProps> = (props) => { @@ -208,7 +212,7 @@ const ParameterModal: React.FC<ParameterSettingProps> = (props) => {
208 ), 212 ),
209 dataIndex: 'type', 213 dataIndex: 'type',
210 className: 'ps-table-cell', 214 className: 'ps-table-cell',
211 - width: '95px', 215 + width: '105px',
212 key: 'type', 216 key: 'type',
213 render: (text, record) => ( 217 render: (text, record) => (
214 <Select 218 <Select
@@ -325,7 +329,7 @@ const ParameterModal: React.FC<ParameterSettingProps> = (props) => { @@ -325,7 +329,7 @@ const ParameterModal: React.FC<ParameterSettingProps> = (props) => {
325 ), 329 ),
326 key: 'action', 330 key: 'action',
327 className: 'ps-table-cell', 331 className: 'ps-table-cell',
328 - width: '96px', 332 + width: '110px',
329 render: (text, record) => { 333 render: (text, record) => {
330 const isShowAdd = record && checkShowAdd(record); 334 const isShowAdd = record && checkShowAdd(record);
331 const isShowTree = record && checkShowTree(record); 335 const isShowTree = record && checkShowTree(record);
@@ -615,7 +619,6 @@ const ParameterModal: React.FC<ParameterSettingProps> = (props) => { @@ -615,7 +619,6 @@ const ParameterModal: React.FC<ParameterSettingProps> = (props) => {
615 (value || []).map((_item: ParamDesignModel) => { 619 (value || []).map((_item: ParamDesignModel) => {
616 expandedArray.push(_item.id); 620 expandedArray.push(_item.id);
617 }); 621 });
618 - setDefaultExpandedKeys(expandedArray);  
619 }, [inputKey]); 622 }, [inputKey]);
620 623
621 //展开 所有子节点 624 //展开 所有子节点
@@ -640,9 +643,9 @@ const ParameterModal: React.FC<ParameterSettingProps> = (props) => { @@ -640,9 +643,9 @@ const ParameterModal: React.FC<ParameterSettingProps> = (props) => {
640 ); 643 );
641 644
642 //每行拖拽渲染 645 //每行拖拽渲染
643 - const onRow = () => ({  
644 - draggable: true,  
645 - style: { cursor: 'move' }, 646 + const onRow = (record) => ({
  647 + draggable: !record.disabled,
  648 + style: { cursor: !record.disabled ? 'move' : '' },
646 onDragStart: (ev: any) => { 649 onDragStart: (ev: any) => {
647 ev.persist(); 650 ev.persist();
648 console.log('onDragStart', ev.target); 651 console.log('onDragStart', ev.target);
@@ -895,11 +898,11 @@ const ParameterModal: React.FC<ParameterSettingProps> = (props) => { @@ -895,11 +898,11 @@ const ParameterModal: React.FC<ParameterSettingProps> = (props) => {
895 expandable={{ 898 expandable={{
896 defaultExpandAllRows: true, 899 defaultExpandAllRows: true,
897 childrenColumnName: 'child', 900 childrenColumnName: 'child',
898 - expandedRowKeys: defaultExpandedKeys, 901 + expandedRowKeys: expandedKeys,
899 expandIcon: ({ expanded, onExpand, record }) => 902 expandIcon: ({ expanded, onExpand, record }) =>
900 record.child && record.child.length > 0 && expanded ? ( 903 record.child && record.child.length > 0 && expanded ? (
901 <> 904 <>
902 - <Icon component={SubDropIcon} className="drop-icon1" /> 905 + <Icon component={SubDropIcon} className="drop-icon" />
903 <QxBaseIcon 906 <QxBaseIcon
904 className={'table-expanded'} 907 className={'table-expanded'}
905 type={'qx-caret-down'} 908 type={'qx-caret-down'}
@@ -908,15 +911,17 @@ const ParameterModal: React.FC<ParameterSettingProps> = (props) => { @@ -908,15 +911,17 @@ const ParameterModal: React.FC<ParameterSettingProps> = (props) => {
908 </> 911 </>
909 ) : record.child && record.child.length > 0 && !expanded ? ( 912 ) : record.child && record.child.length > 0 && !expanded ? (
910 <> 913 <>
911 - <Icon component={SubDropIcon} className="drop-icon1" /> 914 + <Icon component={SubDropIcon} className="drop-icon" />
912 <QxBaseIcon 915 <QxBaseIcon
913 className={'table-expanded-change'} 916 className={'table-expanded-change'}
914 type={'qx-caret-down'} 917 type={'qx-caret-down'}
915 onClick={(e) => onExpand(record, e)} 918 onClick={(e) => onExpand(record, e)}
916 /> 919 />
917 </> 920 </>
  921 + ) : record.disabled ? (
  922 + <></>
918 ) : ( 923 ) : (
919 - <Icon component={SubDropIcon} className="drop-icon1" /> 924 + <Icon component={SubDropIcon} className="drop-icon" />
920 ), 925 ),
921 }} 926 }}
922 className="parameter-setting-table" 927 className="parameter-setting-table"
@@ -531,15 +531,16 @@ export const QxParameterSetting: React.FC<ParameterSettingProps> = (props) => { @@ -531,15 +531,16 @@ export const QxParameterSetting: React.FC<ParameterSettingProps> = (props) => {
531 setTimeout(() => { 531 setTimeout(() => {
532 let myInput = document.getElementById(id); 532 let myInput = document.getElementById(id);
533 myInput.focus(); 533 myInput.focus();
534 - }, 0); 534 + }, 100);
535 }; 535 };
536 536
537 //增加子节点 537 //增加子节点
538 const onAddTree = (key: string) => { 538 const onAddTree = (key: string) => {
  539 + const id = uidGen();
  540 + const code = uidGen(undefined, 6);
  541 +
539 function addNode(pid: string, data: any) { 542 function addNode(pid: string, data: any) {
540 data.forEach((item) => { 543 data.forEach((item) => {
541 - const id = uidGen();  
542 - const code = uidGen(undefined, 6);  
543 if (item.id === pid) { 544 if (item.id === pid) {
544 if (item.child && item.child.length > 0) { 545 if (item.child && item.child.length > 0) {
545 item.child.push({ id, type: 'STRING', pid, code, title: '' }); 546 item.child.push({ id, type: 'STRING', pid, code, title: '' });
@@ -559,6 +560,16 @@ export const QxParameterSetting: React.FC<ParameterSettingProps> = (props) => { @@ -559,6 +560,16 @@ export const QxParameterSetting: React.FC<ParameterSettingProps> = (props) => {
559 setInputKey(inputKey + 1); 560 setInputKey(inputKey + 1);
560 setTreeData(_treeDataNew); 561 setTreeData(_treeDataNew);
561 props?.onChange(_treeDataNew); 562 props?.onChange(_treeDataNew);
  563 + if (expandedKeys) {
  564 + setExpandedKeys([...expandedKeys, key]);
  565 + } else {
  566 + setExpandedKeys([key]);
  567 + }
  568 +
  569 + setTimeout(() => {
  570 + let myInput = document.getElementById(id);
  571 + myInput.focus();
  572 + }, 100);
562 }; 573 };
563 574
564 const onExpand = (newExpandedKeys: any) => { 575 const onExpand = (newExpandedKeys: any) => {
@@ -714,29 +725,33 @@ export const QxParameterSetting: React.FC<ParameterSettingProps> = (props) => { @@ -714,29 +725,33 @@ export const QxParameterSetting: React.FC<ParameterSettingProps> = (props) => {
714 /> 725 />
715 </div> 726 </div>
716 <div className="opt-left"> 727 <div className="opt-left">
717 - <Input  
718 - id={nodeData.id}  
719 - ref={inputRef}  
720 - status={!nodeData.title ? 'error' : ''}  
721 - placeholder={!nodeData.title ? '请输入参数名' : ''}  
722 - className={  
723 - index > -1 && searchValue ? 'search-selected' : 'title-input'  
724 - }  
725 - draggable={true}  
726 - onDragStart={(event) => {  
727 - event.stopPropagation();  
728 - event.preventDefault();  
729 - }}  
730 - key={inputKey}  
731 - style={{ width: '100%', borderRadius: '4px' }}  
732 - maxLength={50}  
733 - disabled={disabled}  
734 - bordered={true}  
735 - defaultValue={nodeData.title}  
736 - onBlur={(e) => {  
737 - handleChange(e, nodeData, 'title');  
738 - }}  
739 - /> 728 + <span className="box-input">
  729 + <Input
  730 + id={nodeData.id}
  731 + ref={inputRef}
  732 + status={!nodeData.title ? 'error' : ''}
  733 + placeholder={!nodeData.title ? '请输入参数名' : ''}
  734 + className={
  735 + index > -1 && searchValue
  736 + ? 'search-selected'
  737 + : 'title-input'
  738 + }
  739 + draggable={true}
  740 + onDragStart={(event) => {
  741 + event.stopPropagation();
  742 + event.preventDefault();
  743 + }}
  744 + key={inputKey}
  745 + style={{ width: '100%', borderRadius: '4px' }}
  746 + maxLength={50}
  747 + disabled={disabled}
  748 + bordered={true}
  749 + defaultValue={nodeData.title}
  750 + onBlur={(e) => {
  751 + handleChange(e, nodeData, 'title');
  752 + }}
  753 + />
  754 + </span>
740 </div> 755 </div>
741 </div> 756 </div>
742 {props?.isShowField && ( 757 {props?.isShowField && (
@@ -781,7 +796,6 @@ export const QxParameterSetting: React.FC<ParameterSettingProps> = (props) => { @@ -781,7 +796,6 @@ export const QxParameterSetting: React.FC<ParameterSettingProps> = (props) => {
781 const onSelect = (e: any) => { 796 const onSelect = (e: any) => {
782 handleAdd('', e.key); 797 handleAdd('', e.key);
783 }; 798 };
784 -  
785 return ( 799 return (
786 <div> 800 <div>
787 <div className={'qx-parameter-setting-content'}> 801 <div className={'qx-parameter-setting-content'}>
@@ -859,8 +873,10 @@ export const QxParameterSetting: React.FC<ParameterSettingProps> = (props) => { @@ -859,8 +873,10 @@ export const QxParameterSetting: React.FC<ParameterSettingProps> = (props) => {
859 onDrop={onDrop} 873 onDrop={onDrop}
860 draggable={{ icon: false }} 874 draggable={{ icon: false }}
861 // draggable={!props.type} 875 // draggable={!props.type}
862 - blockNode 876 + // blockNode
863 defaultExpandAll 877 defaultExpandAll
  878 + checkStrictly
  879 + defaultExpandedKeys={defaultExpandedKeys}
864 expandedKeys={expandedKeys ? expandedKeys : defaultExpandedKeys} 880 expandedKeys={expandedKeys ? expandedKeys : defaultExpandedKeys}
865 autoExpandParent={autoExpandParent} 881 autoExpandParent={autoExpandParent}
866 onExpand={onExpand} 882 onExpand={onExpand}
@@ -869,10 +885,10 @@ export const QxParameterSetting: React.FC<ParameterSettingProps> = (props) => { @@ -869,10 +885,10 @@ export const QxParameterSetting: React.FC<ParameterSettingProps> = (props) => {
869 : null} 885 : null}
870 </div> 886 </div>
871 <ParameterModal 887 <ParameterModal
872 - // nodeItem={props.nodeItem}  
873 inputKey={inputKey} 888 inputKey={inputKey}
874 treeData={list} 889 treeData={list}
875 data={treeData} 890 data={treeData}
  891 + expandedKeys={expandedKeys}
876 nodes={props.nodes} 892 nodes={props.nodes}
877 node={props.node} 893 node={props.node}
878 handleChangeField={changeField} 894 handleChangeField={changeField}
@@ -32,7 +32,8 @@ @@ -32,7 +32,8 @@
32 margin-top: 20px; 32 margin-top: 20px;
33 33
34 .ant-tree .ant-tree-switcher { 34 .ant-tree .ant-tree-switcher {
35 - // width: 34px; 35 + transition: all 0.2s ease;
  36 + width: 0;
36 margin-top: 11.5px; 37 margin-top: 11.5px;
37 display: flex; 38 display: flex;
38 // justify-content: flex-end; 39 // justify-content: flex-end;
@@ -155,7 +156,7 @@ @@ -155,7 +156,7 @@
155 width: 100%; 156 width: 100%;
156 margin-top: 2px; 157 margin-top: 2px;
157 margin-bottom: 2px; 158 margin-bottom: 2px;
158 - overflow: hidden; 159 + // overflow: hidden;
159 text-overflow: ellipsis; 160 text-overflow: ellipsis;
160 transition: width 0.3s cubic-bezier(0.2, 0, 0, 1) 0s; 161 transition: width 0.3s cubic-bezier(0.2, 0, 0, 1) 0s;
161 162
@@ -170,11 +171,26 @@ @@ -170,11 +171,26 @@
170 .ant-input-status-error { 171 .ant-input-status-error {
171 &:focus-within { 172 &:focus-within {
172 border: 1px solid @B8 !important; 173 border: 1px solid @B8 !important;
173 - box-shadow: 0 0 4px 0 #1764ff80; 174 + box-shadow: 0 0 4px 0 @B8 !important;
  175 + // box-shadow: 0 0 0 2px rgba(15, 112, 121, 0.269);
  176 + }
  177 + }
174 178
  179 + .title-input {
  180 + &:focus-within {
  181 + // border: 1px solid @B8 !important;
  182 + box-shadow: 0 0 4px 0 @B8 !important;
175 // box-shadow: 0 0 0 2px rgba(15, 112, 121, 0.269); 183 // box-shadow: 0 0 0 2px rgba(15, 112, 121, 0.269);
176 } 184 }
177 } 185 }
  186 +
  187 + .box-input {
  188 + &:focus-within {
  189 + border-radius: 4px;
  190 + border-inline-end-width: 1px;
  191 + outline: 0;
  192 + }
  193 + }
178 } 194 }
179 195
180 .render-right__help { 196 .render-right__help {
@@ -377,22 +393,42 @@ @@ -377,22 +393,42 @@
377 position: absolute; 393 position: absolute;
378 top: 10px; 394 top: 10px;
379 left: -22px; 395 left: -22px;
380 - opacity: 1; 396 + opacity: 0.01;
381 display: block; 397 display: block;
382 } 398 }
383 399
384 .ant-table-body { 400 .ant-table-body {
385 .ps-table-cell { 401 .ps-table-cell {
386 - transition: all 0.2s ease; 402 + transition: all 0s ease !important;
387 403
388 &:hover { 404 &:hover {
389 border: 1px solid @N6 !important; 405 border: 1px solid @N6 !important;
390 - border-radius: 2px; 406 + box-shadow: 0 0 4px 0 @N6 !important;
  407 + }
  408 +
  409 + &-header {
  410 + transition: all 0s ease !important;
  411 + display: flex;
  412 + height: 41px !important;
  413 +
  414 + &:hover {
  415 + border: 1px solid @N6 !important;
  416 + box-shadow: 0 0 4px 0 @N6 !important;
  417 + // border-radius: 2px;
  418 + .drop-icon {
  419 + position: absolute;
  420 + top: 13px;
  421 + left: 2px;
  422 + opacity: 1;
  423 + display: block;
  424 + }
  425 + }
391 } 426 }
392 427
393 &:focus-within { 428 &:focus-within {
394 - border: 1px solid #1764ff !important;  
395 - border-radius: 2px; 429 + border: 1px solid @B8 !important;
  430 + box-shadow: 0 0 4px 0 @B8 !important;
  431 + // border-radius: 2px;
396 } 432 }
397 433
398 // display: flex; 434 // display: flex;
@@ -415,13 +451,28 @@ @@ -415,13 +451,28 @@
415 position: absolute; 451 position: absolute;
416 top: 10px; 452 top: 10px;
417 left: -22px; 453 left: -22px;
418 - opacity: 1; 454 + opacity: 0.01;
419 display: block; 455 display: block;
420 } 456 }
421 457
422 &:hover { 458 &:hover {
423 background-color: @N3 !important; 459 background-color: @N3 !important;
424 460
  461 + .drop-icon {
  462 + // position: absolute;
  463 + // top: 10px;
  464 + // left: -22px;
  465 + opacity: 1;
  466 + // display: block;
  467 + }
  468 +
  469 + .ant-tree-switcher {
  470 + transition: all 0.2s ease;
  471 + width: 24px !important;
  472 + margin-top: 11.5px;
  473 + display: flex;
  474 + }
  475 +
425 .title-btn-del, 476 .title-btn-del,
426 .title-btn { 477 .title-btn {
427 opacity: 1; 478 opacity: 1;
@@ -473,7 +524,7 @@ @@ -473,7 +524,7 @@
473 524
474 .parameter-setting-table .ant-table-cell { 525 .parameter-setting-table .ant-table-cell {
475 height: 40px; 526 height: 40px;
476 - padding: 4px 16px 4px 4px !important; 527 + padding: 4px 16px 4px 14px !important;
477 } 528 }
478 529
479 .qx-parameter-setting__modal { 530 .qx-parameter-setting__modal {