Commit bb802ce0c578aaa88ace2d3fcf5e9c9a03b7ba08

Authored by 邱嘉伟
1 parent c464b784

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

... ... @@ -93,10 +93,10 @@ const ParameterModal: React.FC<ParameterSettingProps> = (props) => {
93 93 handleChangeField,
94 94 inputKey,
95 95 nodeType,
  96 + expandedKeys,
96 97 type,
97 98 } = props;
98 99 const [searchValue, setSearchValue] = useState('');
99   - const [defaultExpandedKeys, setDefaultExpandedKeys] = useState<React.Key[]>(); //树节点的id 有了则展开
100 100
101 101 // const [form] = Form.useForm()
102 102 //判断数组是否只有一个子节点
... ... @@ -147,15 +147,19 @@ const ParameterModal: React.FC<ParameterSettingProps> = (props) => {
147 147 </div>
148 148 ),
149 149 dataIndex: 'code',
150   - className: 'code-header',
151   - width: '150px',
  150 + className: 'ps-table-cell-header',
  151 + width: '190px',
152 152 key: 'code',
153 153 render: (text, record) => {
154 154 const strTitle = (text as string) || '';
155 155 const index = strTitle.indexOf(searchValue);
156 156 return (
157 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 163 draggable={true}
160 164 onDragStart={(event) => {
161 165 event.stopPropagation();
... ... @@ -208,7 +212,7 @@ const ParameterModal: React.FC<ParameterSettingProps> = (props) => {
208 212 ),
209 213 dataIndex: 'type',
210 214 className: 'ps-table-cell',
211   - width: '95px',
  215 + width: '105px',
212 216 key: 'type',
213 217 render: (text, record) => (
214 218 <Select
... ... @@ -325,7 +329,7 @@ const ParameterModal: React.FC<ParameterSettingProps> = (props) => {
325 329 ),
326 330 key: 'action',
327 331 className: 'ps-table-cell',
328   - width: '96px',
  332 + width: '110px',
329 333 render: (text, record) => {
330 334 const isShowAdd = record && checkShowAdd(record);
331 335 const isShowTree = record && checkShowTree(record);
... ... @@ -615,7 +619,6 @@ const ParameterModal: React.FC<ParameterSettingProps> = (props) => {
615 619 (value || []).map((_item: ParamDesignModel) => {
616 620 expandedArray.push(_item.id);
617 621 });
618   - setDefaultExpandedKeys(expandedArray);
619 622 }, [inputKey]);
620 623
621 624 //展开 所有子节点
... ... @@ -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 649 onDragStart: (ev: any) => {
647 650 ev.persist();
648 651 console.log('onDragStart', ev.target);
... ... @@ -895,11 +898,11 @@ const ParameterModal: React.FC<ParameterSettingProps> = (props) => {
895 898 expandable={{
896 899 defaultExpandAllRows: true,
897 900 childrenColumnName: 'child',
898   - expandedRowKeys: defaultExpandedKeys,
  901 + expandedRowKeys: expandedKeys,
899 902 expandIcon: ({ expanded, onExpand, record }) =>
900 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 906 <QxBaseIcon
904 907 className={'table-expanded'}
905 908 type={'qx-caret-down'}
... ... @@ -908,15 +911,17 @@ const ParameterModal: React.FC<ParameterSettingProps> = (props) => {
908 911 </>
909 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 915 <QxBaseIcon
913 916 className={'table-expanded-change'}
914 917 type={'qx-caret-down'}
915 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 927 className="parameter-setting-table"
... ...
... ... @@ -531,15 +531,16 @@ export const QxParameterSetting: React.FC<ParameterSettingProps> = (props) => {
531 531 setTimeout(() => {
532 532 let myInput = document.getElementById(id);
533 533 myInput.focus();
534   - }, 0);
  534 + }, 100);
535 535 };
536 536
537 537 //增加子节点
538 538 const onAddTree = (key: string) => {
  539 + const id = uidGen();
  540 + const code = uidGen(undefined, 6);
  541 +
539 542 function addNode(pid: string, data: any) {
540 543 data.forEach((item) => {
541   - const id = uidGen();
542   - const code = uidGen(undefined, 6);
543 544 if (item.id === pid) {
544 545 if (item.child && item.child.length > 0) {
545 546 item.child.push({ id, type: 'STRING', pid, code, title: '' });
... ... @@ -559,6 +560,16 @@ export const QxParameterSetting: React.FC<ParameterSettingProps> = (props) => {
559 560 setInputKey(inputKey + 1);
560 561 setTreeData(_treeDataNew);
561 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 575 const onExpand = (newExpandedKeys: any) => {
... ... @@ -714,29 +725,33 @@ export const QxParameterSetting: React.FC<ParameterSettingProps> = (props) => {
714 725 />
715 726 </div>
716 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 755 </div>
741 756 </div>
742 757 {props?.isShowField && (
... ... @@ -781,7 +796,6 @@ export const QxParameterSetting: React.FC<ParameterSettingProps> = (props) => {
781 796 const onSelect = (e: any) => {
782 797 handleAdd('', e.key);
783 798 };
784   -
785 799 return (
786 800 <div>
787 801 <div className={'qx-parameter-setting-content'}>
... ... @@ -859,8 +873,10 @@ export const QxParameterSetting: React.FC<ParameterSettingProps> = (props) => {
859 873 onDrop={onDrop}
860 874 draggable={{ icon: false }}
861 875 // draggable={!props.type}
862   - blockNode
  876 + // blockNode
863 877 defaultExpandAll
  878 + checkStrictly
  879 + defaultExpandedKeys={defaultExpandedKeys}
864 880 expandedKeys={expandedKeys ? expandedKeys : defaultExpandedKeys}
865 881 autoExpandParent={autoExpandParent}
866 882 onExpand={onExpand}
... ... @@ -869,10 +885,10 @@ export const QxParameterSetting: React.FC<ParameterSettingProps> = (props) => {
869 885 : null}
870 886 </div>
871 887 <ParameterModal
872   - // nodeItem={props.nodeItem}
873 888 inputKey={inputKey}
874 889 treeData={list}
875 890 data={treeData}
  891 + expandedKeys={expandedKeys}
876 892 nodes={props.nodes}
877 893 node={props.node}
878 894 handleChangeField={changeField}
... ...
... ... @@ -32,7 +32,8 @@
32 32 margin-top: 20px;
33 33
34 34 .ant-tree .ant-tree-switcher {
35   - // width: 34px;
  35 + transition: all 0.2s ease;
  36 + width: 0;
36 37 margin-top: 11.5px;
37 38 display: flex;
38 39 // justify-content: flex-end;
... ... @@ -155,7 +156,7 @@
155 156 width: 100%;
156 157 margin-top: 2px;
157 158 margin-bottom: 2px;
158   - overflow: hidden;
  159 + // overflow: hidden;
159 160 text-overflow: ellipsis;
160 161 transition: width 0.3s cubic-bezier(0.2, 0, 0, 1) 0s;
161 162
... ... @@ -170,11 +171,26 @@
170 171 .ant-input-status-error {
171 172 &:focus-within {
172 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 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 196 .render-right__help {
... ... @@ -377,22 +393,42 @@
377 393 position: absolute;
378 394 top: 10px;
379 395 left: -22px;
380   - opacity: 1;
  396 + opacity: 0.01;
381 397 display: block;
382 398 }
383 399
384 400 .ant-table-body {
385 401 .ps-table-cell {
386   - transition: all 0.2s ease;
  402 + transition: all 0s ease !important;
387 403
388 404 &:hover {
389 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 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 434 // display: flex;
... ... @@ -415,13 +451,28 @@
415 451 position: absolute;
416 452 top: 10px;
417 453 left: -22px;
418   - opacity: 1;
  454 + opacity: 0.01;
419 455 display: block;
420 456 }
421 457
422 458 &:hover {
423 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 476 .title-btn-del,
426 477 .title-btn {
427 478 opacity: 1;
... ... @@ -473,7 +524,7 @@
473 524
474 525 .parameter-setting-table .ant-table-cell {
475 526 height: 40px;
476   - padding: 4px 16px 4px 4px !important;
  527 + padding: 4px 16px 4px 14px !important;
477 528 }
478 529
479 530 .qx-parameter-setting__modal {
... ...