Commit a039f4f4c24c2a5a785808dfefc8171af53177ed

Authored by 邱嘉伟
1 parent f1519cfa

fix:样式修改,图标 调整

... ... @@ -39,6 +39,7 @@ import moment from 'dayjs';
39 39 import { QxBaseIcon } from '@qx/common';
40 40 import Icon from '@ant-design/icons';
41 41 import { SubNodeIcon } from './sub-node-icon';
  42 +import { SubDropIcon } from './sub-node-icon';
42 43
43 44 import '../style/reset.less';
44 45
... ... @@ -162,13 +163,17 @@ const ParameterModal: React.FC<ParameterSettingProps> = (props) => {
162 163 const columns = [
163 164 {
164 165 title: (
165   - <div style={{ display: 'flex', flexDirection: 'row' }}>
166   - <span>参数编码</span>
  166 + <div style={{
  167 + display: 'flex', flexDirection: 'row'
  168 + , alignContent: 'center', flexWrap: 'wrap'
  169 + }}>
  170 + <span className='parameter-setting-table-title'>参数编码</span>
167 171 <span style={{ color: 'red' }}>*</span>
168 172 </div>
169 173 ),
170 174 dataIndex: 'code',
171   - width: '150px',
  175 + className: 'code-header',
  176 + width: '200px',
172 177 key: 'code',
173 178 render: (text, record) => {
174 179 const strTitle = (text as string) || '';
... ... @@ -196,12 +201,13 @@ const ParameterModal: React.FC<ParameterSettingProps> = (props) => {
196 201 {
197 202 title: (
198 203 <div style={{ display: 'flex', flexDirection: 'row' }}>
199   - <span>参数名</span>
  204 + <span className='parameter-setting-table-title'>参数名</span>
200 205 <span style={{ color: 'red' }}>*</span>
201 206 </div>
202 207 ),
203 208 dataIndex: 'title',
204 209 width: '112px',
  210 + className: 'ps-table-cell',
205 211 key: 'title',
206 212 render: (text, record) => {
207 213 const strTitle = (record.title as string) || '';
... ... @@ -229,11 +235,12 @@ const ParameterModal: React.FC<ParameterSettingProps> = (props) => {
229 235 {
230 236 title: (
231 237 <div style={{ display: 'flex', flexDirection: 'row' }}>
232   - <span>参数类型</span>
  238 + <span className='parameter-setting-table-title'>参数类型</span>
233 239 <span style={{ color: 'red' }}>*</span>
234 240 </div>
235 241 ),
236 242 dataIndex: 'type',
  243 + className: 'ps-table-cell',
237 244 width: '102px',
238 245 key: 'type',
239 246 render: (text, record) =>
... ... @@ -256,8 +263,13 @@ const ParameterModal: React.FC<ParameterSettingProps> = (props) => {
256 263 </Form.Item>
257 264 },
258 265 {
259   - title: '默认值',
  266 + title: (
  267 + <div style={{ display: 'flex', flexDirection: 'row' }}>
  268 + <span className='parameter-setting-table-title'>默认值</span>
  269 + </div>
  270 + ),
260 271 dataIndex: 'valueMapping',
  272 + className: 'ps-table-cell',
261 273 width: '116px',
262 274 key: 'valueMapping',
263 275 render: (text, record) =>
... ... @@ -282,8 +294,14 @@ const ParameterModal: React.FC<ParameterSettingProps> = (props) => {
282 294 </div>
283 295 },
284 296 {
285   - title: '参数说明',
  297 + title:
  298 + (
  299 + <div style={{ display: 'flex', flexDirection: 'row' }}>
  300 + <span className='parameter-setting-table-title'>参数说明</span>
  301 + </div>
  302 + ),
286 303 dataIndex: 'description',
  304 + className: 'ps-table-cell',
287 305 key: 'description',
288 306 width: '102px',
289 307 render: (text, record) => (
... ... @@ -306,8 +324,14 @@ const ParameterModal: React.FC<ParameterSettingProps> = (props) => {
306 324 ),
307 325 },
308 326 {
309   - title: '操作',
  327 + title:
  328 + (
  329 + <div style={{ display: 'flex', flexDirection: 'row' }}>
  330 + <span className='parameter-setting-table-title'>操作</span>
  331 + </div>
  332 + ),
310 333 key: 'action',
  334 + className: 'ps-table-cell',
311 335 width: '96px',
312 336 render: (text, record) => {
313 337 const isShowAdd = (record && checkShowAdd(record));
... ... @@ -348,9 +372,14 @@ const ParameterModal: React.FC<ParameterSettingProps> = (props) => {
348 372 ];
349 373
350 374 const range = {
351   - title: '取值范围',
  375 + title:
  376 + (
  377 + <div style={{ display: 'flex', flexDirection: 'row' }}>
  378 + <span className='parameter-setting-table-title'>取值范围</span>
  379 + </div>
  380 + ),
352 381 dataIndex: 'qxProps',
353   - editable: true,
  382 + className: 'ps-table-cell',
354 383 width: '314px',
355 384 key: 'qxProps',
356 385 render: (qxProps: any, record: any) => {
... ... @@ -548,11 +577,16 @@ const ParameterModal: React.FC<ParameterSettingProps> = (props) => {
548 577 };
549 578
550 579 const require = {
551   - title: '必填',
  580 + title:
  581 + (
  582 + <div style={{ display: 'flex', flexDirection: 'row' }}>
  583 + <span className='parameter-setting-table-title'>必填</span>
  584 + </div>
  585 + ),
552 586 dataIndex: 'required',
553   - editable: true,
  587 + className: 'ps-table-cell',
554 588 key: 'required',
555   - width: '76px',
  589 + width: '86px',
556 590 render: (text, record) => (
557 591 <Form.Item
558 592 name={'required' + record.id}
... ... @@ -610,10 +644,11 @@ const ParameterModal: React.FC<ParameterSettingProps> = (props) => {
610 644
611 645 //每行拖拽渲染
612 646 const onRow = () => ({
613   - draggable: !type,
614   - style: !type && { cursor: 'move' },
  647 + draggable: true,
  648 + style: { cursor: 'move' },
615 649 onDragStart: (ev: any) => {
616 650 ev.persist();
  651 + console.log('onDragStart', ev.target)
617 652 ev.dataTransfer.effectAllowed = 'move';
618 653 ev.dataTransfer.setData('text', ev.target.getAttribute('data-row-key'));
619 654 },
... ... @@ -676,6 +711,8 @@ const ParameterModal: React.FC<ParameterSettingProps> = (props) => {
676 711 const dropIndex = _newTreeData.findIndex(
677 712 (item: any) => item.id === dropId,
678 713 ); // 要drop到目标的index
  714 + // console.log('dropId', dropId)
  715 + // console.log('dropCol', dropCol)
679 716 if (dragIndex == dropIndex || !dragId || !dropId) {
680 717 dropCol.childNodes.forEach((item: any) => (item.style.borderTop = ''));
681 718 dropCol.parentNode.childNodes.forEach(
... ... @@ -751,7 +788,7 @@ const ParameterModal: React.FC<ParameterSettingProps> = (props) => {
751 788 footer={null}
752 789 // onOk={handleCancel}
753 790 onCancel={onCancel}
754   - width={960}
  791 + width={1200}
755 792 wrapClassName={'qx-common__modal'}
756 793 closeIcon={
757 794 <QxBaseIcon
... ... @@ -839,9 +876,29 @@ const ParameterModal: React.FC<ParameterSettingProps> = (props) => {
839 876 expandable={{
840 877 defaultExpandAllRows: true,
841 878 childrenColumnName: 'child',
  879 + expandIcon: ({ expanded, onExpand, record }) =>
  880 + record.child && record.child.length > 0 && expanded ? (
  881 + <>
  882 + <Icon component={SubDropIcon}
  883 + className='drop-icon' />
  884 + <QxBaseIcon className={'table-expanded'} type={'qx-caret-down'} onClick={e => onExpand(record, e)} />
  885 + </>
  886 +
  887 + ) : record.child && record.child.length > 0 && !expanded ?
  888 + (
  889 + <>
  890 + <Icon component={SubDropIcon}
  891 + className='drop-icon' />
  892 + <QxBaseIcon className={'table-expanded-change'} type={'qx-caret-down'} onClick={e => onExpand(record, e)} />
  893 + </>
  894 + )
  895 + :
  896 + <Icon component={SubDropIcon}
  897 + className='drop-icon' />
842 898 }}
  899 + className='parameter-setting-table'
843 900 onRow={() => onRow()}
844   - scroll={{ x: 960, y: 432 }}
  901 + scroll={{ x: 1000, y: 432 }}
845 902 bordered
846 903 pagination={false}
847 904 size={'small'}
... ...
... ... @@ -128,7 +128,7 @@ export default () => {
128 128 isHideSearch={isHide}
129 129 isShowField={true}
130 130 title={titleDom}
131   - type={'preview'}
  131 + // type={'preview'}
132 132 // component={QxTagsInput}
133 133 request={request}
134 134 appId={'5ak3C213YQWEO6IYnIs'}
... ...
... ... @@ -37,6 +37,7 @@ type ValueOptionProps = {
37 37 };
38 38
39 39 import { SubNodeIcon } from './sub-node-icon';
  40 +import { SubDropIcon } from './sub-node-icon';
40 41
41 42 const valueOptions = [
42 43 { key: 'STRING', label: '文本' },
... ... @@ -630,95 +631,98 @@ export const QxParameterSetting: React.FC<ParameterSettingProps> = (props) => {
630 631 const isShowTree = checkShowTree(nodeData);
631 632 const disabled = !!props.type ? true : nodeData.disabled;
632 633 return (
633   - <div
634   - onBlur={(e) => onBlur(e)} tabIndex={0} onFocus={(e) => onFocus(e)}>
  634 + <div>
  635 + <Icon component={SubDropIcon}
  636 + className='drop-icon'/>
635 637 <div
636   - style={{
637   - // padding: '2px',
638   - justifyContent: 'flex-end',
639   - display: 'flex',
640   - width: '100%',
641   - flexDirection: 'row-reverse',
642   - }}
643   - >
644   - <div className={'opt-btn'}>
645   - <Select
646   - value={nodeData.type}
647   - disabled={disabled}
648   - className={'select-tree'}
649   - bordered={false}
650   - getPopupContainer={(triggerNode) => triggerNode}
651   - onChange={(e: any) => {
652   - handleChange(e, nodeData, 'type');
653   - }}
654   - >
655   - {valueOptions.map((item) => {
656   - return (
657   - <Select.Option key={item.key} value={item.key}>
658   - {item.label}
659   - </Select.Option>
660   - );
661   - })}
662   - </Select>
663   - {(nodeData.type === 'OBJECT' || nodeData.type === 'ARRAY') &&
664   - isShowTree && (
665   - <Button
666   - icon={<Icon component={SubNodeIcon} />}
667   - disabled={disabled}
668   - type="link"
669   - className="title-btn"
670   - onClick={() => onAddTree(nodeData.id)}
671   - />
672   - )}
673   - <Button
674   - className="title-btn-del"
675   - icon={<QxBaseIcon className={'title-btn-del-btn'} type={'qx-icon-delete'} />}
676   - disabled={disabled}
677   - type="link"
678   - onClick={() => deleteParameter(nodeData)}
679   - />
680   - </div>
681   - <div className="opt-left">
682   - <Input
683   - className={index > -1 && searchValue ? 'search-selected' : ''}
684   - draggable={true}
685   - onDragStart={(event) => {
686   - event.stopPropagation();
687   - event.preventDefault();
688   - }}
689   - key={inputKey}
690   - style={{ width: '100%' }}
691   - maxLength={50}
692   - allowClear
693   - disabled={disabled}
694   - bordered={true}
695   - defaultValue={nodeData.title}
696   - onBlur={(e) => {
697   - handleChange(e, nodeData, 'title');
698   - }}
699   - />
  638 + onBlur={(e) => onBlur(e)} tabIndex={0} onFocus={(e) => onFocus(e)}>
  639 + <div
  640 + style={{
  641 + // padding: '2px',
  642 + justifyContent: 'flex-end',
  643 + display: 'flex',
  644 + width: '100%',
  645 + flexDirection: 'row-reverse',
  646 + }}
  647 + >
  648 + <div className={'opt-btn'}>
  649 + <Select
  650 + value={nodeData.type}
  651 + disabled={disabled}
  652 + className={'select-tree'}
  653 + bordered={false}
  654 + getPopupContainer={(triggerNode) => triggerNode}
  655 + onChange={(e: any) => {
  656 + handleChange(e, nodeData, 'type');
  657 + }}
  658 + >
  659 + {valueOptions.map((item) => {
  660 + return (
  661 + <Select.Option key={item.key} value={item.key}>
  662 + {item.label}
  663 + </Select.Option>
  664 + );
  665 + })}
  666 + </Select>
  667 + {(nodeData.type === 'OBJECT' || nodeData.type === 'ARRAY') &&
  668 + isShowTree && (
  669 + <Button
  670 + icon={<Icon component={SubNodeIcon} />}
  671 + disabled={disabled}
  672 + type="link"
  673 + className="title-btn"
  674 + onClick={() => onAddTree(nodeData.id)}
  675 + />
  676 + )}
  677 + <Button
  678 + className="title-btn-del"
  679 + icon={<QxBaseIcon className={'title-btn-del-btn'} type={'qx-icon-delete'} />}
  680 + disabled={disabled}
  681 + type="link"
  682 + onClick={() => deleteParameter(nodeData)}
  683 + />
  684 + </div>
  685 + <div className="opt-left">
  686 + <Input
  687 + className={index > -1 && searchValue ? 'search-selected' : ''}
  688 + draggable={true}
  689 + onDragStart={(event) => {
  690 + event.stopPropagation();
  691 + event.preventDefault();
  692 + }}
  693 + key={inputKey}
  694 + style={{ width: '100%' }}
  695 + maxLength={50}
  696 + disabled={disabled}
  697 + bordered={true}
  698 + defaultValue={nodeData.title}
  699 + onBlur={(e) => {
  700 + handleChange(e, nodeData, 'title');
  701 + }}
  702 + />
  703 + </div>
700 704 </div>
  705 + {props?.isShowField && (
  706 + <div className="opt-left-down">
  707 + <QxFieldSetter
  708 + disabled={disabled}
  709 + value={nodeData.valuesObj || []}
  710 + params={{ appCode: 'appCode', useId: true }}
  711 + valueOptions={getValueOptions(nodeData)}
  712 + field={nodeData.code}
  713 + widget={typeTranslateWidget(nodeData.type)}
  714 + fieldType={typeTranslateFieIdtype(nodeData.type)}
  715 + fieldGroupType={typeTranslateGrouptype(nodeData.type)}
  716 + isMixValue={typeTranslateFieIdtype(nodeData.type) == 'STRING' ? true : false}
  717 + colsTree={props.nodeItem}
  718 + isMultiple={false}
  719 + onChange={(val) => changeField(val, nodeData)}
  720 + popupOnBody={true}
  721 + inputDis={true}
  722 + />
  723 + </div>
  724 + )}
701 725 </div>
702   - {props?.isShowField && (
703   - <div className="opt-left-down">
704   - <QxFieldSetter
705   - disabled={disabled}
706   - value={nodeData.valuesObj || []}
707   - params={{ appCode: 'appCode', useId: true }}
708   - valueOptions={getValueOptions(nodeData)}
709   - field={nodeData.code}
710   - widget={typeTranslateWidget(nodeData.type)}
711   - fieldType={typeTranslateFieIdtype(nodeData.type)}
712   - fieldGroupType={typeTranslateGrouptype(nodeData.type)}
713   - isMixValue={typeTranslateFieIdtype(nodeData.type) == 'STRING' ? true : false}
714   - colsTree={props.nodeItem}
715   - isMultiple={false}
716   - onChange={(val) => changeField(val, nodeData)}
717   - popupOnBody={true}
718   - inputDis={true}
719   - />
720   - </div>
721   - )}
722 726 </div>
723 727 );
724 728 };
... ... @@ -799,7 +803,8 @@ export const QxParameterSetting: React.FC<ParameterSettingProps> = (props) => {
799 803 titleRender={(nodeData) => renderTitle(nodeData)}
800 804 style={{ height: '100%' }}
801 805 onDrop={onDrop}
802   - draggable={!props.type}
  806 + draggable={{ icon: false }}
  807 + // draggable={!props.type}
803 808 blockNode
804 809 expandedKeys={expandedKeys ? expandedKeys : defaultExpandedKeys}
805 810 autoExpandParent={autoExpandParent}
... ...
  1 +/* stylelint-disable selector-class-pattern */
1 2 @import '~@qx/ui/src/style/variable.less';
2 3
3 4 /* stylelint-disable declaration-block-no-redundant-longhand-properties */
... ... @@ -29,6 +30,15 @@
29 30
30 31 .tree-wrapper {
31 32 margin-top: 20px;
  33 +
  34 + .ant-tree .ant-tree-switcher {
  35 + // margin-top: 6.5px;
  36 + width:44px;
  37 + margin-top: 11.5px;
  38 + margin-right: 7px;
  39 + display: flex;
  40 + justify-content: flex-end;
  41 + }
32 42 }
33 43
34 44 .border-none
... ... @@ -258,6 +268,14 @@
258 268 background 0.3s cubic-bezier(0.645, 0.045, 0.355, 1),
259 269 padding 0.2s cubic-bezier(0.645, 0.045, 0.355, 1);
260 270
  271 + .drop-icon{
  272 + // opacity: 0.1;
  273 + display: none;
  274 + // position: absolute;
  275 + // top: 10px;
  276 + // left: -49px;
  277 + }
  278 +
261 279 &:hover {
262 280 background-color: @N3 !important;
263 281
... ... @@ -266,6 +284,14 @@
266 284 display: block;
267 285 }
268 286
  287 + .drop-icon{
  288 + position: absolute;
  289 + top: 10px;
  290 + left: -39px;
  291 + opacity: 1;
  292 + display: block;
  293 + }
  294 +
269 295 .opt-left {
270 296 width: 65%;
271 297 }
... ... @@ -285,3 +311,47 @@
285 311 background-color: transparent;
286 312 }
287 313 }
  314 +
  315 + .parameter-setting-table-title{
  316 + font-weight: 500;
  317 + font-size: 14px;
  318 + line-height: 22px;
  319 + color: #7C7E86;
  320 + padding-left: 10px;
  321 + }
  322 +
  323 + .parameter-setting-table{
  324 + .code-header{
  325 + display: flex;
  326 + }
  327 +
  328 + .ant-table-tbody .ant-table-row{
  329 + .drop-icon{
  330 + opacity: 0.01;
  331 + }
  332 +
  333 + &:hover {
  334 + .drop-icon{
  335 + opacity: 1;
  336 + }
  337 + }
  338 + }
  339 +
  340 + .table-expanded{
  341 + color: #7C7E86;
  342 + margin-left: 8px;
  343 + transition: transform 0.3s;
  344 + }
  345 +
  346 + .table-expanded-change{
  347 + transform: rotate(-90deg);
  348 + color: #7C7E86;
  349 + margin-left: 8px;
  350 + transition: transform 0.3s;
  351 + }
  352 + }
  353 +
  354 + .parameter-setting-table .ant-table-cell{
  355 + height: 40px;
  356 + padding: 4px 16px 0 4px !important;
  357 + }
... ...
1 1 import React from 'react';
2 2 export const SubNodeIcon = () => (
3   - <svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" aria-hidden="true" focusable="false"><path fill-rule="evenodd" d="M6.333 5.333a1 1 0 0 0-1 1v3h-.667V2.667h10V1.333H1.333v1.334h2v6.666c0 .737.597 1.334 1.333 1.334h.667v3a1 1 0 0 0 1 1h7.333a1 1 0 0 0 1-1V6.333a1 1 0 0 0-1-1H6.333Zm.333 8V6.667h6.667v6.666H6.666Zm2.667-2.666h-2V9.333h2v-2h1.333v2h2v1.334h-2v2H9.333v-2Z" clip-rule="evenodd"/></svg>
  3 + <svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="currentColor" aria-hidden="true" focusable="false"><path fill-rule="evenodd" d="M6.333 5.333a1 1 0 0 0-1 1v3h-.667V2.667h10V1.333H1.333v1.334h2v6.666c0 .737.597 1.334 1.333 1.334h.667v3a1 1 0 0 0 1 1h7.333a1 1 0 0 0 1-1V6.333a1 1 0 0 0-1-1H6.333Zm.333 8V6.667h6.667v6.666H6.666Zm2.667-2.666h-2V9.333h2v-2h1.333v2h2v1.334h-2v2H9.333v-2Z" clip-rule="evenodd" /></svg>
  4 +);
  5 +
  6 +export const SubDropIcon = () => (
  7 + <svg width="1em" height="1em" viewBox="0 0 6 12" fill="none" xmlns="http://www.w3.org/2000/svg">
  8 + <path fill-rule="evenodd" clip-rule="evenodd" d="M0 0H2V2H0V0ZM4 0H6V2H4V0ZM0 5H2V7H0V5ZM4 5H6V7H4V5ZM0 10H2V12H0V10ZM4 10H6V12H4V10Z" fill="#7C7E86" />
  9 + </svg>
4 10 );
... ...