From b4337ec0a85e288ffe353735db5d77886045b226 Mon Sep 17 00:00:00 2001 From: zjt Date: Thu, 20 Jan 2022 19:22:29 +0800 Subject: [PATCH 01/26] =?UTF-8?q?feat:=20hidden=E3=80=81group=E3=80=81form?= =?UTF-8?q?=E3=80=81tabs?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .DS_Store | Bin 12292 -> 12292 bytes src/components/formFields/form/display.tsx | 69 ++++++++++++++++++ src/components/formFields/group/display.tsx | 45 ++++++++++++ src/components/formFields/hidden/display.tsx | 4 + .../formFields/importSubform/display.tsx | 53 ++++++++++++++ src/components/formFields/index.tsx | 12 ++- src/components/formFields/tabs/display.tsx | 54 ++++++++++++++ 7 files changed, 236 insertions(+), 1 deletion(-) create mode 100644 src/components/formFields/form/display.tsx create mode 100644 src/components/formFields/group/display.tsx create mode 100644 src/components/formFields/hidden/display.tsx create mode 100644 src/components/formFields/importSubform/display.tsx create mode 100644 src/components/formFields/tabs/display.tsx diff --git a/.DS_Store b/.DS_Store index be8e15e699762fb77dc17917e05f0c7a926a6d6c..c75e4b861d9b3fdd3258c555752f8daa402c7179 100644 GIT binary patch delta 76 zcmZokXi1ph&n?5iz`)GFAi%(oJTXRlvYrkbDdWipR|IwQ-*9l`vpd>|#0trYHT e783l)H}QemW^RRV>`ctIo0&EKu`@Hv delta 104 zcmZokXi1ph&nwHoz`)GFAi%&-%uq5hN_(<_4vQ`$P>=|J9-`JTLKW}E%_{Yx7_?ZC!;4vHA diff --git a/src/components/formFields/form/display.tsx b/src/components/formFields/form/display.tsx new file mode 100644 index 0000000..430759b --- /dev/null +++ b/src/components/formFields/form/display.tsx @@ -0,0 +1,69 @@ +import React from 'react' +import { FormDisplay } from 'ccms' +import { Form, Collapse, Space } from 'antd' +import { IFormField, IFormFieldItem, IFormFieldItemField } from 'ccms/dist/src/components/formFields/form/display' +import {display as getALLComponents} from '../' + +export default class FormDisplayComponent extends FormDisplay { + getALLComponents = (type: any) => getALLComponents[type] + + remove: () => Promise = async () => {} + + renderItemFieldComponent = (props: IFormFieldItemField) => { + const { + label, + children + } = props + return ( + + {children} + + ) + } + + renderItemComponent = (props: IFormFieldItem) => { + const { + title, + index, + canCollapse, + children + } = props + + return ( + {title}} + key={index} + forceRender={true} + showArrow={!!canCollapse} + > + {children} + + ) + } + + renderComponent = (props: IFormField) => { + const { + canCollapse, + children + } = props + + const collapsePaneldDefaultActiveKeys = Array.from(Array(children.length), (v,k) =>k) + const CollapseProps = canCollapse? { + accordion: true + }: { + activeKey: collapsePaneldDefaultActiveKeys + } + return ( + + + {children} + + + ) + } +} diff --git a/src/components/formFields/group/display.tsx b/src/components/formFields/group/display.tsx new file mode 100644 index 0000000..c7b0342 --- /dev/null +++ b/src/components/formFields/group/display.tsx @@ -0,0 +1,45 @@ +import React from "react"; +import { GroupDisplay } from 'ccms'; +import { IGroupField, GroupFieldConfig } from "ccms/dist/src/components/formFields/group"; +import { IFormItem } from "ccms/dist/src/steps/form"; +import { Form } from "antd" +import {display as getALLComponents} from '../' +import styles from './index.less' + +export const PropsType = (props: GroupFieldConfig) => { }; + +export default class GroupDisplayComponent extends GroupDisplay { + getALLComponents = (type: any) => getALLComponents[type] + + renderComponent = (props: IGroupField) => { + const { + children + } = props + return ( +
+ {children} +
+ ) + } + + renderItemComponent = (props: IFormItem) => { + const { + key, + label, + visitable, + fieldType, + children + } = props + + return ( + + {children} + + ) + } +} \ No newline at end of file diff --git a/src/components/formFields/hidden/display.tsx b/src/components/formFields/hidden/display.tsx new file mode 100644 index 0000000..1beed5f --- /dev/null +++ b/src/components/formFields/hidden/display.tsx @@ -0,0 +1,4 @@ +import { HiddenDisplay } from 'ccms' + +export default class HiddenDisplayComponent extends HiddenDisplay { +} diff --git a/src/components/formFields/importSubform/display.tsx b/src/components/formFields/importSubform/display.tsx new file mode 100644 index 0000000..69566ac --- /dev/null +++ b/src/components/formFields/importSubform/display.tsx @@ -0,0 +1,53 @@ + +import React from "react"; +import { ImportSubformDisplay } from "ccms"; +import { IImportSubformField } from "ccms/dist/src/components/detail/importSubform"; +import { Display } from "ccms/dist/src/components/formFields/common"; +import { IDetailItem } from "ccms/dist/src/steps/detail"; +import { display as getALLComponents } from '../' +import InterfaceHelper from "../../../util/interface"; +import { Form } from "antd"; +import styles from './index.less' + +export default class ImportSubformDisplayComponent extends ImportSubformDisplay { + getALLComponents = (type: any): typeof Display => getALLComponents[type] + + interfaceHelper = new InterfaceHelper() + + renderComponent = (props: IImportSubformField) => { + const { + children + } = props + return ( +
+ {children} +
+ ) + } + + /** + * 表单项组件 - UI渲染方法 + * 各UI库需重写该方法 + * @param props + */ + renderItemComponent = (props: IDetailItem) => { + const { + key, + label, + visitable, + fieldType, + children + } = props + + return ( + + {children} + + ) + } +} diff --git a/src/components/formFields/index.tsx b/src/components/formFields/index.tsx index c2f26a4..40adc7b 100644 --- a/src/components/formFields/index.tsx +++ b/src/components/formFields/index.tsx @@ -21,16 +21,21 @@ import ImportSubformField from './importSubform' import AnyField from './any' import TextDisplayComponent from './text/display' +import FormDisplayComponent from './form/display' import LongTextDisplayComponent from './longtext/display' import RadioDisplayComponent from './radio/display' import ColorDisplayComponent from './color/display' import NumberDisplayComponent from './number/display' import SwitchDisplayComponent from './switch/display' +import GroupDisplayComponent from './group/display' import UploadDisplayComponent from './upload/display' import DatetimeDisplayComponent from './datetime/display' import DatetimeRangeDisplayComponent from './datetimeRange/display' import SelectSingleDisplayComponent from './select/single/display' import SelectMultipleDisplayComponent from './select/multiple/display' +import TabsDisplayComponent from './tabs/display' +import MultipleTextDisplayComponent from './multipleText/display' +import ImportSubformDisplayComponent from './importSubform/display' export default { text: TextField, @@ -58,6 +63,7 @@ export default { export const display = { text: TextDisplayComponent, + form: FormDisplayComponent, radio: RadioDisplayComponent, longtext: LongTextDisplayComponent, number: NumberDisplayComponent, @@ -67,5 +73,9 @@ export const display = { select_single: SelectSingleDisplayComponent, select_multiple: SelectMultipleDisplayComponent, color: ColorDisplayComponent, - upload: UploadDisplayComponent + upload: UploadDisplayComponent, + group: GroupDisplayComponent, + tabs: TabsDisplayComponent, + multiple_text: MultipleTextDisplayComponent, + import_subform: ImportSubformDisplayComponent, } \ No newline at end of file diff --git a/src/components/formFields/tabs/display.tsx b/src/components/formFields/tabs/display.tsx new file mode 100644 index 0000000..47e7910 --- /dev/null +++ b/src/components/formFields/tabs/display.tsx @@ -0,0 +1,54 @@ +import React from 'react' +import { TabsDisplay } from 'ccms' +import { Form, Tabs } from 'antd' +import { ITabsField, ITabsFieldItem, ITabsFieldItemField } from 'ccms/dist/src/components/formFields/tabs/display' +import {display as getALLComponents} from '../' +import { Display } from 'ccms/dist/src/components/formFields/common' + +export default class TabsDisplayComponent extends TabsDisplay<{}> { + // 各表单项对应的类型所使用的UI组件的类 + getALLComponents = (type: any): typeof Display => getALLComponents[type] + + renderItemFieldComponent = (props: ITabsFieldItemField) => { + const { + label, + children + } = props + + return ( + + {children} + + ) + } + + renderItemComponent = (props: ITabsFieldItem) => { + const { + key, + label, + children + } = props + + return ( + + {children} + + ) + } + + renderComponent = (props: ITabsField) => { + const { + children + } = props + + return ( + + + {children} + + + ) + } +} -- Gitee From be2694b136557ea3f3b8d1dafe53d8169490b346 Mon Sep 17 00:00:00 2001 From: wangailin Date: Fri, 21 Jan 2022 17:31:39 +0800 Subject: [PATCH 02/26] =?UTF-8?q?feat:=20=E6=96=B0=E5=A2=9E=E5=9B=BE?= =?UTF-8?q?=E7=89=87=E7=BB=84=E4=BB=B6=EF=BC=9B=E6=B7=BB=E5=8A=A0group?= =?UTF-8?q?=E4=B8=8B=E7=9A=84=E5=AD=90=E9=A1=B9=E6=8D=A2=E8=A1=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/detail/group/index.less | 3 +++ src/components/detail/group/index.tsx | 2 +- src/components/detail/image/index.tsx | 24 +++++++++++++++++++++++ src/components/detail/statement/index.tsx | 2 +- src/components/detail/text/index.tsx | 2 +- 5 files changed, 30 insertions(+), 3 deletions(-) create mode 100644 src/components/detail/image/index.tsx diff --git a/src/components/detail/group/index.less b/src/components/detail/group/index.less index 9f51d17..721827b 100644 --- a/src/components/detail/group/index.less +++ b/src/components/detail/group/index.less @@ -26,4 +26,7 @@ white-space: nowrap; } } + .detail-group-children { + word-break: break-all; + } } \ No newline at end of file diff --git a/src/components/detail/group/index.tsx b/src/components/detail/group/index.tsx index c6411aa..edd93fb 100644 --- a/src/components/detail/group/index.tsx +++ b/src/components/detail/group/index.tsx @@ -48,7 +48,7 @@ export default class GroupFieldComponent extends DetailGroupField {
{label}
-
{children}
+
{children}
) diff --git a/src/components/detail/image/index.tsx b/src/components/detail/image/index.tsx new file mode 100644 index 0000000..451152b --- /dev/null +++ b/src/components/detail/image/index.tsx @@ -0,0 +1,24 @@ +import React from 'react' +import { DetailImageField } from 'ccms' +import { IImageDetail, ImageDetailConfig } from 'ccms/dist/src/components/detail/image' +import { Image } from 'antd'; +export const PropsType = (props: ImageDetailConfig) => { } + +export default class ImageDetailComponent extends DetailImageField { + renderComponent = (props: IImageDetail) => { + const { + value, + height, + width, + preview + } = props + return ( + + ) + } +} diff --git a/src/components/detail/statement/index.tsx b/src/components/detail/statement/index.tsx index d62eeb4..26f3542 100644 --- a/src/components/detail/statement/index.tsx +++ b/src/components/detail/statement/index.tsx @@ -10,7 +10,7 @@ export default class StatementDetailComponent extends DetailStatementField { content } = props return ( -
{content}
+ <>{content} ) } } diff --git a/src/components/detail/text/index.tsx b/src/components/detail/text/index.tsx index 8a6d391..61a2501 100644 --- a/src/components/detail/text/index.tsx +++ b/src/components/detail/text/index.tsx @@ -10,7 +10,7 @@ export default class TextFieldComponent extends DetailTextField { value } = props return ( -
{value}
+ <>{value} ) } } -- Gitee From 85a963e921a292a27f95114aa338269ac3e615aa Mon Sep 17 00:00:00 2001 From: zjt Date: Fri, 21 Jan 2022 22:33:49 +0800 Subject: [PATCH 03/26] =?UTF-8?q?feat:=20group=E3=80=81importSubform?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=88=86=E6=A0=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/detail/importSubform/index.tsx | 40 ++++++++++++++--- src/components/formFields/form/display.tsx | 4 ++ src/components/formFields/group/display.tsx | 43 ++++++++++++++++--- .../formFields/importSubform/display.tsx | 41 +++++++++++++++--- src/components/formFields/tabs/display.tsx | 5 ++- 5 files changed, 111 insertions(+), 22 deletions(-) diff --git a/src/components/detail/importSubform/index.tsx b/src/components/detail/importSubform/index.tsx index ad4096d..af2de8c 100644 --- a/src/components/detail/importSubform/index.tsx +++ b/src/components/detail/importSubform/index.tsx @@ -7,6 +7,7 @@ import { display as getALLComponents } from '../../formFields' import InterfaceHelper from "../../../util/interface"; import { Form } from "antd"; import styles from './index.less' +import { formItemLayout, computedItemStyle, computedGapStyle } from "../../formFields/common"; export default class ImportSubformField extends DetailImportSubformField { getALLComponents = (type: any): typeof Display => getALLComponents[type] @@ -15,10 +16,16 @@ export default class ImportSubformField extends DetailImportSubformField { renderComponent = (props: IImportSubformField) => { const { + columns, children } = props + const gap = computedGapStyle(columns, 'row') return ( -
+
{children}
) @@ -33,20 +40,39 @@ export default class ImportSubformField extends DetailImportSubformField { const { key, label, + columns, + layout, visitable, fieldType, children } = props + const colStyle = computedItemStyle(columns, layout) + const itemStyle = visitable ? {} : { overflow: 'hidden', width: 0, height: 0, margin: 0, padding: 0 } + if (columns?.type === 'width' && columns?.value && columns.wrap) { + Object.assign(itemStyle, { width: columns.value }) + } return ( - - {children} - + + {children} + +
) } } \ No newline at end of file diff --git a/src/components/formFields/form/display.tsx b/src/components/formFields/form/display.tsx index 430759b..567fe0c 100644 --- a/src/components/formFields/form/display.tsx +++ b/src/components/formFields/form/display.tsx @@ -3,6 +3,7 @@ import { FormDisplay } from 'ccms' import { Form, Collapse, Space } from 'antd' import { IFormField, IFormFieldItem, IFormFieldItemField } from 'ccms/dist/src/components/formFields/form/display' import {display as getALLComponents} from '../' +import { formItemLayout } from '../common' export default class FormDisplayComponent extends FormDisplay { getALLComponents = (type: any) => getALLComponents[type] @@ -12,11 +13,14 @@ export default class FormDisplayComponent extends FormDisplay { renderItemFieldComponent = (props: IFormFieldItemField) => { const { label, + layout, + fieldType, children } = props return ( {children} diff --git a/src/components/formFields/group/display.tsx b/src/components/formFields/group/display.tsx index c7b0342..cf7946b 100644 --- a/src/components/formFields/group/display.tsx +++ b/src/components/formFields/group/display.tsx @@ -5,6 +5,8 @@ import { IFormItem } from "ccms/dist/src/steps/form"; import { Form } from "antd" import {display as getALLComponents} from '../' import styles from './index.less' +import { formItemLayout, computedItemStyle, computedGapStyle } from "../common"; + export const PropsType = (props: GroupFieldConfig) => { }; @@ -13,10 +15,17 @@ export default class GroupDisplayComponent extends GroupDisplay { renderComponent = (props: IGroupField) => { const { + columns, children } = props + const gap = computedGapStyle(columns, 'row') + return ( -
+
{children}
) @@ -25,21 +34,41 @@ export default class GroupDisplayComponent extends GroupDisplay { renderItemComponent = (props: IFormItem) => { const { key, + columns, + layout, label, visitable, fieldType, children } = props + const colStyle = computedItemStyle(columns, layout) + const itemStyle = visitable ? {} : { overflow: 'hidden', width: 0, height: 0, margin: 0, padding: 0 } + if (columns?.type === 'width' && columns?.value && columns.wrap) { + Object.assign(itemStyle, { width: columns.value }) + } + return ( - - {children} - + + {children} + +
) } } \ No newline at end of file diff --git a/src/components/formFields/importSubform/display.tsx b/src/components/formFields/importSubform/display.tsx index 69566ac..b9306ca 100644 --- a/src/components/formFields/importSubform/display.tsx +++ b/src/components/formFields/importSubform/display.tsx @@ -8,6 +8,7 @@ import { display as getALLComponents } from '../' import InterfaceHelper from "../../../util/interface"; import { Form } from "antd"; import styles from './index.less' +import { computedItemStyle, computedGapStyle } from "../common"; export default class ImportSubformDisplayComponent extends ImportSubformDisplay { getALLComponents = (type: any): typeof Display => getALLComponents[type] @@ -16,10 +17,17 @@ export default class ImportSubformDisplayComponent extends ImportSubformDisplay renderComponent = (props: IImportSubformField) => { const { + columns, children } = props + const gap = computedGapStyle(columns, 'row') + return ( -
+
{children}
) @@ -34,20 +42,39 @@ export default class ImportSubformDisplayComponent extends ImportSubformDisplay const { key, label, + columns, + layout, visitable, fieldType, children } = props + const colStyle = computedItemStyle(columns, layout) + const itemStyle = visitable ? {} : { overflow: 'hidden', width: 0, height: 0, margin: 0, padding: 0 } + if (columns?.type === 'width' && columns?.value && columns.wrap) { + Object.assign(itemStyle, { width: columns.value }) + } + return ( - - {children} - + + {children} + +
) } } diff --git a/src/components/formFields/tabs/display.tsx b/src/components/formFields/tabs/display.tsx index 47e7910..6bd7ecc 100644 --- a/src/components/formFields/tabs/display.tsx +++ b/src/components/formFields/tabs/display.tsx @@ -4,7 +4,7 @@ import { Form, Tabs } from 'antd' import { ITabsField, ITabsFieldItem, ITabsFieldItemField } from 'ccms/dist/src/components/formFields/tabs/display' import {display as getALLComponents} from '../' import { Display } from 'ccms/dist/src/components/formFields/common' - +import { formItemLayout } from '../common' export default class TabsDisplayComponent extends TabsDisplay<{}> { // 各表单项对应的类型所使用的UI组件的类 getALLComponents = (type: any): typeof Display => getALLComponents[type] @@ -12,12 +12,15 @@ export default class TabsDisplayComponent extends TabsDisplay<{}> { renderItemFieldComponent = (props: ITabsFieldItemField) => { const { label, + fieldType, + layout, children } = props return ( {children} -- Gitee From 789b5be607a42f7d5fe2dc97e54a8b491996aeae Mon Sep 17 00:00:00 2001 From: wangailin Date: Mon, 24 Jan 2022 09:54:07 +0800 Subject: [PATCH 04/26] =?UTF-8?q?feat:=20=E6=96=B0=E5=A2=9E=E8=AF=A6?= =?UTF-8?q?=E6=83=85=E6=9C=89=E5=9B=BE=E7=89=87=E7=BB=84=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/detail/index.tsx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/components/detail/index.tsx b/src/components/detail/index.tsx index 2bcd753..6de0042 100644 --- a/src/components/detail/index.tsx +++ b/src/components/detail/index.tsx @@ -3,11 +3,13 @@ import GroupField from './group' import StatementDetail from './statement' import EnumDetailComponent from './enum' import ImportSubformField from './importSubform' +import ImageDetail from './image' export default { text: TextField, group: GroupField, statement: StatementDetail, + image: ImageDetail, detail_enum: EnumDetailComponent, import_subform: ImportSubformField } -- Gitee From 13a190a7b49d82ec7de3de4717358c7ae397d9e6 Mon Sep 17 00:00:00 2001 From: zjt Date: Mon, 24 Jan 2022 12:40:42 +0800 Subject: [PATCH 05/26] =?UTF-8?q?style:=20=E8=A1=A5=E5=85=85detail/importS?= =?UTF-8?q?ubform=E6=A0=B7=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../detail/importSubform/index.less | 22 ++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/src/components/detail/importSubform/index.less b/src/components/detail/importSubform/index.less index 3613bb8..1edb492 100644 --- a/src/components/detail/importSubform/index.less +++ b/src/components/detail/importSubform/index.less @@ -35,4 +35,24 @@ } } } -} \ No newline at end of file +} + +.ccms-antd-mini-form-group-row { + position : relative; + display : flex; + box-orient : horizontal; + box-direction: normal; + flex-flow : row wrap; + width : 100%; + +} + +.form-group-col { + flex-direction: row; + margin-bottom : 0; + flex-direction: row; + position : relative; + max-width : 100%; + min-height : 1px; + flex: 0 0 100%; +} -- Gitee From 777dd8fdfa754a526c95bf2a6375b534192f8d6d Mon Sep 17 00:00:00 2001 From: wangailin Date: Tue, 25 Jan 2022 10:02:00 +0800 Subject: [PATCH 06/26] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E5=AD=90?= =?UTF-8?q?=E8=A1=A8=E5=8D=95=E5=9C=A8=E7=BE=A4=E7=BB=84=E5=88=86=E6=A0=8F?= =?UTF-8?q?=E6=98=BE=E7=A4=BA=E5=BC=82=E5=B8=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/detail/common.ts | 5 ++++- src/components/detail/group/index.less | 3 ++- src/components/formFields/common.ts | 3 +++ src/steps/detail/index.less | 3 ++- 4 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/components/detail/common.ts b/src/components/detail/common.ts index 2dcb12b..c7c4b03 100644 --- a/src/components/detail/common.ts +++ b/src/components/detail/common.ts @@ -1,3 +1,4 @@ + import { FormItemProps } from "antd"; export function formItemLayout(layout: 'horizontal' | 'vertical' | 'inline', fieldType: string, label: string | undefined) { @@ -61,10 +62,12 @@ export function computedItemStyle(columns: any, layout: string) { export function computedGapStyle(columns: any, type: string) { const setStyle = {} - const gap = (Number(columns?.gap || columns?.rowGap) || 0)/2 + const gap = (Number(columns?.gap || columns?.rowGap) || 0) / 2 if (type === 'row') { Object.assign(setStyle, { + flexFlow: 'row wrap', + display: 'flex', rowGap: `${gap}px`, marginLeft: `-${gap / 2}px`, marginRight: `-${gap / 2}px` diff --git a/src/components/detail/group/index.less b/src/components/detail/group/index.less index 721827b..c1ede2a 100644 --- a/src/components/detail/group/index.less +++ b/src/components/detail/group/index.less @@ -26,7 +26,8 @@ white-space: nowrap; } } - .detail-group-children { + &>:global(.detail-group-children) { word-break: break-all; + display: flex; } } \ No newline at end of file diff --git a/src/components/formFields/common.ts b/src/components/formFields/common.ts index 1d80758..0576dcb 100644 --- a/src/components/formFields/common.ts +++ b/src/components/formFields/common.ts @@ -1,3 +1,4 @@ +import { display } from './index'; import { FormItemProps, Form } from "antd"; @@ -55,6 +56,8 @@ export function computedGapStyle(columns: any, type: string) { if (type === 'row') { Object.assign(setStyle, { + flexFlow: 'row wrap', + display: 'flex', rowGap: `${rowgap}px`, marginLeft: `-${gap}px`, marginRight: `-${gap}px` diff --git a/src/steps/detail/index.less b/src/steps/detail/index.less index 45e9198..8d94b4b 100644 --- a/src/steps/detail/index.less +++ b/src/steps/detail/index.less @@ -11,6 +11,7 @@ flex-direction : row; position : relative; max-width : 100%; + flex : 0 0 100%; min-height : 1px; } @@ -32,7 +33,7 @@ margin-bottom: 20px; padding : 16px 0; border-bottom: 1px solid #f1f1f1; - white-space: nowrap + white-space : nowrap } } } \ No newline at end of file -- Gitee From 12eda8db7c3f3257206b4c1b769feacff76bcf02 Mon Sep 17 00:00:00 2001 From: wangailin Date: Tue, 25 Jan 2022 11:13:22 +0800 Subject: [PATCH 07/26] =?UTF-8?q?style:=20=E6=A0=B7=E5=BC=8F=E4=BF=AE?= =?UTF-8?q?=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/detail/group/index.less | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/components/detail/group/index.less b/src/components/detail/group/index.less index c1ede2a..c503e97 100644 --- a/src/components/detail/group/index.less +++ b/src/components/detail/group/index.less @@ -14,20 +14,24 @@ position : relative; max-width : 100%; min-height : 1px; + flex : 0 0 100%; } .detail-group-content { - &>:global(.ant-form-item){ + &>:global(.ant-form-item) { margin-bottom: 0 !important; } + flex-direction: row; display : flex; - .ccms-antd-mini-detail-gruop-title{ + + .ccms-antd-mini-detail-gruop-title { white-space: nowrap; } } + &>:global(.detail-group-children) { word-break: break-all; - display: flex; + display : flex; } } \ No newline at end of file -- Gitee From 7c4fbe05cde390084d318a8d18a7b1f52c0de5fe Mon Sep 17 00:00:00 2001 From: zjt Date: Wed, 16 Feb 2022 15:13:46 +0800 Subject: [PATCH 08/26] feat: rollup --- .babelrc | 34 +++++++++++++ .commitlintrc.js | 31 ++++++++++++ .editorconfig | 9 ++++ .eslintrc | 54 ++++++++++++++++++++ .eslintrc.js | 25 ---------- .fatherrc.js | 19 ------- .prettierrc | 5 ++ package.json | 125 ++++++++++++++++++++++++++++++++--------------- rollup.config.js | 55 +++++++++++++++++++++ tsconfig.json | 38 +++++++++----- 10 files changed, 298 insertions(+), 97 deletions(-) create mode 100644 .babelrc create mode 100644 .commitlintrc.js create mode 100644 .editorconfig create mode 100644 .eslintrc delete mode 100644 .eslintrc.js delete mode 100644 .fatherrc.js create mode 100644 .prettierrc create mode 100644 rollup.config.js diff --git a/.babelrc b/.babelrc new file mode 100644 index 0000000..3de8b61 --- /dev/null +++ b/.babelrc @@ -0,0 +1,34 @@ +{ + "sourceMaps": true, + "presets": [ + ["@babel/preset-typescript", + { + "isTSX": true, + "allExtensions": true + }], + "@babel/preset-react", + [ + "@babel/preset-env", + { + "targets": { + "node": "10.13.0" + }, + // "modules": false + //将 ES6 module 转换为其他模块规范,可选 "adm" | "umd" | "systemjs" | "commonjs" | "cjs" | false,默认为 false + // 否则 Babel 会在 Rollup 有机会做处理之前,将我们的模块转成 CommonJS ,导致 Rollup 的一些处理失败。 + } + ] + ], + "plugins": [ + [ + "import", + { + "libraryName": "antd", + "style": "css" + } + ] + ] +// 导入js模块:["import", { "libraryName": "antd" }] +// 导入js和css模块(LESS/Sass源文件):["import", { "libraryName": "antd", "style": true }] +//    导入js和css模块(css 内置文件):["import", { "libraryName": "antd", "style": "css" }] +} \ No newline at end of file diff --git a/.commitlintrc.js b/.commitlintrc.js new file mode 100644 index 0000000..1de314f --- /dev/null +++ b/.commitlintrc.js @@ -0,0 +1,31 @@ +/** + * @file commitlint 配置 + * commit message: (注意冒号后面有空格) + * + */ +module.exports = { + extends: ['@commitlint/config-conventional'], + rules: { + 'type-enum': [ + 2, + 'always', + [ + 'init', // 初始提交 + 'feat', // 新功能(feature) + 'perf', // 优化 + 'fix', // 修补bug + 'docs', // 文档(documentation) + 'style', // 格式(不影响代码运行的变动) + 'refactor', // 重构(即不是新增功能,也不是修改bug的代码变动) + 'build', // 编译构建 + 'test', // 增加测试 + 'revert', // 回滚 + 'chore' // 其他改动 + ] + ], + 'type-empty': [2, 'never'], // 提交不符合规范时,也可以提交,但是会有警告 + 'subject-empty': [2, 'never'], // 提交不符合规范时,也可以提交,但是会有警告 + 'subject-full-stop': [0, 'never'], + 'subject-case': [0, 'never'] + } +}; diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..c6c8b36 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,9 @@ +root = true + +[*] +indent_style = space +indent_size = 2 +end_of_line = lf +charset = utf-8 +trim_trailing_whitespace = true +insert_final_newline = true diff --git a/.eslintrc b/.eslintrc new file mode 100644 index 0000000..04b963d --- /dev/null +++ b/.eslintrc @@ -0,0 +1,54 @@ +{ + // 为我们提供运行环境,一个环境定义了一组预定义的全局变量 + "env": { + "browser": true, + "es2021": true, + "jest": true, + "node": true, + "commonjs": true + }, + // 一个配置文件可以被基础配置中的已启用的规则继承。 + "extends": [ + "airbnb", + "prettier", + "plugin:compat/recommended", + "plugin:jest/recommended", + "plugin:react/recommended", + "plugin:import/typescript", + "plugin:@typescript-eslint/recommended" + ], + // ESLint 默认使用Espree作为其解析器,你可以在配置文件中指定一个不同的解析器 + "parser": "@typescript-eslint/parser", + // 配置解析器支持的语法 + "parserOptions": { + "ecmaFeatures": { + "jsx": true + }, + "ecmaVersion": 12, + "sourceType": "module" + }, + // ESLint 支持使用第三方插件。在使用插件之前,你必须使用 npm 安装它。 + // 在配置文件里配置插件时,可以使用 plugins 关键字来存放插件名字的列表。插件名称可以省略 eslint-plugin- 前缀 + "plugins": [ + "react", + "babel", + "jest", + "react-hooks", + "@typescript-eslint" + ], + // ESLint 附带有大量的规则。你可以使用注释或配置文件修改你项目中要使用的规则。要改变一个规则设置,你必须将规则 ID 设置为下列值之一: + // "off" 或 0 - 关闭规则 + // "warn" 或 1 - 开启规则,使用警告级别的错误:warn (不会导致程序退出) + // "error" 或 2 - 开启规则,使用错误级别的错误:error (当被触发的时候,程序会退出) + "rules": { + "no-use-before-define": "off", + "react/display-name": 0, + "import/extensions": 0 + }, + // 指定react版本为安装的版本 + "settings": { + "react": { + "version": "16.13.1" + } + } +} diff --git a/.eslintrc.js b/.eslintrc.js deleted file mode 100644 index eacf354..0000000 --- a/.eslintrc.js +++ /dev/null @@ -1,25 +0,0 @@ -module.exports = { - "env": { - "browser": true, - "es2021": true - }, - "extends": [ - "eslint:recommended", - "plugin:react/recommended", - "plugin:@typescript-eslint/recommended" - ], - "parser": "@typescript-eslint/parser", - "parserOptions": { - "ecmaFeatures": { - "jsx": true - }, - "ecmaVersion": 12, - "sourceType": "module" - }, - "plugins": [ - "react", - "@typescript-eslint" - ], - "rules": { - } -}; diff --git a/.fatherrc.js b/.fatherrc.js deleted file mode 100644 index de0d772..0000000 --- a/.fatherrc.js +++ /dev/null @@ -1,19 +0,0 @@ - -export default { - entry: 'src/index.tsx', - cjs: "rollup", - cssModules: true, - injectCSS: true, - lessInBabelMode: true, - doc: { - title: "猎户座+ 配置文档", - typescript: true, - codeSandbox: false, - setWebpackConfig: { - publicPath: '/public', - }, - filterComponents: (files) => - //This overrides the default filtering of components - files.filter(filepath => /[w-]*.(js|jsx|ts|tsx)$/.test(filepath)) - } -} \ No newline at end of file diff --git a/.prettierrc b/.prettierrc new file mode 100644 index 0000000..d0ed5e8 --- /dev/null +++ b/.prettierrc @@ -0,0 +1,5 @@ +{ + "singleQuote": true, + "printWidth": 120, + "tabWidth": 2 +} diff --git a/package.json b/package.json index 1723a27..85cb507 100644 --- a/package.json +++ b/package.json @@ -5,71 +5,116 @@ "main": "dist/index.js", "types": "dist/src/index.d.ts", "files": [ - "dist/*" + "dist" ], "scripts": { - "dev": "father doc dev", - "build": "father build", - "docs": "father doc build", - "lint": "eslint src --ext .ts", + "build": "npm run clear && rollup -c", + "clear": "rm -rf dist", "test": "jest", - "link": "npm link ccms" + "link": "npm link ccms", + "lint": "npm run lint:code && npm run lint:style", + "lint:code": "eslint --fix **/*.{js,ts,jsx,tsx}", + "lint:style": "stylelint --fix src/**/*.{css,less,scss,sass}", + "prettier": "prettier -c --write **/*", + "commit": "git-cz" + }, + "husky": { + "hooks": { + "commit-msg": "commitlint --env HUSKY_GIT_PARAMS", + "pre-commit": "lint-staged" + } + }, + "lint-staged": { + "src/*.{js, jsx, ts, tsx}": [ + "npm run prettier", + "npm run lint:code" + ], + "src/*.{css,scss,less,json,html,md,markdown}": [ + "npm run prettier" + ], + "src/**/*.{css,less,scss,sass}": [ + "npm run lint:style" + ] + }, + "config": { + "commitizen": { + "path": "./node_modules/cz-conventional-changelog" + } }, "author": "niuweb", "license": "MIT", "devDependencies": { - "@babel/core": "^7.11.4", + "@babel/core": "^7.16.12", "@babel/plugin-proposal-class-properties": "^7.10.4", "@babel/plugin-proposal-decorators": "^7.10.5", "@babel/plugin-syntax-dynamic-import": "^7.8.3", "@babel/plugin-transform-runtime": "^7.11.0", - "@babel/preset-env": "^7.11.0", - "@babel/preset-react": "^7.10.4", + "@babel/preset-env": "^7.16.11", + "@babel/preset-react": "^7.16.7", + "@babel/preset-typescript": "^7.16.7", + "@commitlint/cli": "^9.0.1", + "@commitlint/config-conventional": "^9.0.1", + "@rollup/plugin-babel": "^5.3.0", + "@rollup/plugin-commonjs": "^21.0.1", + "@rollup/plugin-json": "^4.1.0", + "@rollup/plugin-node-resolve": "^13.1.3", "@testing-library/react": "^11.0.4", - "@types/jest": "^26.0.14", + "@types/jest": "^27.4.0", + "@types/lodash": "^4.14.178", + "@types/marked": "^1.2.0", "@types/node": "^14.11.2", - "@types/react": "^16.14.11", + "@types/react": "^16.9.46", "@types/react-dom": "^16.9.8", + "@types/react-router-dom": "^5.1.5", + "@types/react-color": "^3.0.6", "@types/react-loadable": "^5.5.3", "@types/react-test-renderer": "^16.9.3", - "@typescript-eslint/eslint-plugin": "^4.15.1", - "@typescript-eslint/parser": "^4.15.1", + "@typescript-eslint/eslint-plugin": "^5.10.1", + "@typescript-eslint/parser": "^5.10.1", "awesome-typescript-loader": "^5.2.1", "babel-jest": "^26.3.0", - "babel-loader": "^8.1.0", - "babel-plugin-import": "^1.13.0", - "css-loader": "^4.3.0", - "eslint": "^7.17.0", - "eslint-config-standard": "^16.0.2", - "eslint-plugin-import": "^2.22.1", + "babel-plugin-import": "^1.13.3", + "commitizen": "^4.2.4", + "cz-conventional-changelog": "^3.3.0", + "eslint": "^7.32.0", + "eslint-config-airbnb": "^19.0.4", + "eslint-config-prettier": "^8.3.0", + "eslint-plugin-babel": "^5.3.1", + "eslint-plugin-compat": "^4.0.1", + "eslint-plugin-import": "^2.25.4", + "eslint-plugin-jest": "^26.0.0", + "eslint-plugin-jsx-a11y": "^6.5.1", "eslint-plugin-node": "^11.1.0", - "eslint-plugin-promise": "^4.2.1", - "eslint-plugin-react": "^7.24.0", - "express": "^4.17.1", - "father": "^2.29.11", - "html-webpack-plugin": "^4.5.0", - "identity-obj-proxy": "^3.0.0", - "jest": "^26.4.2", - "less": "^3.12.2", - "less-loader": "^7.0.1", - "react-docgen": "^5.3.1", - "react-test-renderer": "^16.13.1", - "style-loader": "^1.2.1", - "ts-jest": "^26.4.0", - "typedoc": "^0.19.2", - "typescript": "^4.0.2", - "webpack": "^4.44.2", - "webpack-bundle-analyzer": "^3.9.0", - "webpack-cli": "^3.3.12", - "webpack-dev-server": "^3.11.0", - "webpack-merge": "^5.1.4" + "eslint-plugin-promise": "^4.3.1", + "eslint-plugin-react": "^7.28.0", + "eslint-plugin-react-hooks": "^4.3.0", + "execa": "^4.1.0", + "husky": "^4.2.5", + "jest": "^27.4.7", + "less": "^4.1.2", + "lint-staged": "^10.2.11", + "postcss": "^8.4.5", + "prettier": "^2.5.1", + "rollup": "^2.66.0", + "rollup-plugin-eslint": "^7.0.0", + "rollup-plugin-postcss": "^4.0.2", + "rollup-plugin-terser": "^7.0.2", + "rollup-plugin-typescript2": "^0.31.1", + "stylelint": "^14.4.0", + "stylelint-config-rational-order": "^0.1.2", + "stylelint-config-standard": "^25.0.0", + "stylelint-order": "^5.0.0", + "ts-jest": "^27.1.3", + "typescript": "^4.5.5" }, "dependencies": { "@ant-design/icons": "^4.3.0", - "@types/react-router-dom": "^5.1.5", "antd": "^4.14.1", "axios": "^0.20.0", + "lodash": "^4.17.21", + "marked": "^1.2.5", "moment": "^2.29.0", + "qiankun": "^2.5.1", "rc-table": "^7.9.10", "react": "^16.13.1", "react-color": "^2.19.3", diff --git a/rollup.config.js b/rollup.config.js new file mode 100644 index 0000000..0a70596 --- /dev/null +++ b/rollup.config.js @@ -0,0 +1,55 @@ +import path from 'path'; +import ts from 'rollup-plugin-typescript2'; +import { nodeResolve } from '@rollup/plugin-node-resolve'; + +import { babel } from '@rollup/plugin-babel'; +import commonjs from '@rollup/plugin-commonjs'; +import { eslint } from 'rollup-plugin-eslint'; +import json from '@rollup/plugin-json'; +import postcss from 'rollup-plugin-postcss'; +import { terser } from 'rollup-plugin-terser'; + +export default { + input: 'src/index.tsx', + output: [ + { + format: 'cjs', + file: path.resolve('dist/index.js') // 输出的文件路径 + // sourcemap: true + } + ], + onwarn(warning) { + if (warning.code === 'THIS_IS_UNDEFINED') { + return; + } + console.error(warning.message); + }, + plugins: [ + // eslint({ + // throwOnError: true, + // exclude: ['node_modules/**', 'lib/**', 'dist/**'] + // }), + postcss({ + extensions: ['.css', '.less'], + modules: true // 启用CSS模块 + }), + json(), + ts({ + tsconfig: path.resolve(__dirname, 'tsconfig.json') + }), + babel({ + babelHelpers: 'runtime', + exclude: 'node_modules/**' // 只编译我们的源代码 + }), + commonjs(), + nodeResolve({ + extensions: ['.js', '.ts', '.tsx'] + }), + terser() + ], + external: ['react', 'react-dom', 'ccms', '@ant-design/icons', 'react-color', 'antd'], + // external: id => /lodash/.test(id), // lodash 现在将被视为外部的(externals),不会与你的库打包在一起 + watch: { + include: 'src/**' + } +}; diff --git a/tsconfig.json b/tsconfig.json index 95deb7c..630e8fd 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,32 +1,44 @@ { + "exclude": [ + "node_modules", + "dist", + "scripts", + "rollup.config.js" + ], "compilerOptions": { - "target": "es6", - "module": "esnext", - "jsx": "react", - "sourceMap": true, - "outDir": "./lib/", + /* Visit https://aka.ms/tsconfig.json to read more about this file */ + "target": "ES6", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019', 'ES2020', or 'ESNEXT'. */ + "module": "ESNext", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', 'es2020', or 'ESNext'. */ + "sourceMap": true, /* Generates corresponding '.map' file. */ + "outDir": "./dist/src", //输出编译后的文件 /* Redirect output structure to the directory. */ + "esModuleInterop": true, /* 通过为所有导入创建命名空间对象,启用 CommonJS 和 ES 模块之间的发射互操作性 Implies 'allowSyntheticDefaultImports'. */ + "declaration": true, // 生成定义文件 /* Generates corresponding '.d.ts' file. */ + "jsx": "react", /* Specify JSX code generation: 'preserve', 'react-native', or 'react'. */ + // "declarationDir": "./ts/types", // 定义文件输出目录 + // "declarationMap": true, // 生成定义sourceMap /* Generates a sourcemap for each corresponding '.d.ts' file. */ + // "removeComments": true, // 删除注释 + // "noUnusedLocals": true, // 未使用变量报错 /* Report errors on unused locals. */ "strict": true, - "esModuleInterop": true, - "lib": [ + "lib": [ // // 指定要包含在编译中的库文件导入库类型定义 "dom", "dom.iterable", "esnext" ], - "allowJs": true, - "skipLibCheck": true, + "allowJs": true, /* Allow javascript files to be compiled. */ + "skipLibCheck": true, // Skip type checking of declaration files. "allowSyntheticDefaultImports": true, - "forceConsistentCasingInFileNames": true, - "moduleResolution": "node", + "forceConsistentCasingInFileNames": true, // /* Disallow inconsistently-cased references to the same file. */ + "moduleResolution": "node", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */ "resolveJsonModule": true, "isolatedModules": true, "noEmit": true, "noImplicitAny": true, "strictNullChecks": true, "suppressImplicitAnyIndexErrors": true, - "types": [ + "types": [ // // 导入指定类型包 "node", "jest" ], "experimentalDecorators": true } -} \ No newline at end of file +} -- Gitee From 01b04461244c6df6c318c4525f8383baad2a4fcb Mon Sep 17 00:00:00 2001 From: zjt Date: Wed, 16 Feb 2022 15:57:58 +0800 Subject: [PATCH 09/26] feat: stylelint MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 样式格式校验 --- .stylelintrc.js | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 .stylelintrc.js diff --git a/.stylelintrc.js b/.stylelintrc.js new file mode 100644 index 0000000..6c7fe47 --- /dev/null +++ b/.stylelintrc.js @@ -0,0 +1,8 @@ +module.exports = { + extends: ['stylelint-config-standard', 'stylelint-config-rational-order'], + plugins: ['stylelint-order'], + rules: { + 'selector-pseudo-class-no-unknown': null, + 'no-descending-specificity': null + } +}; -- Gitee From 62abd9afbe5cd1f500238760a5ee66d28957fe98 Mon Sep 17 00:00:00 2001 From: zjt Date: Wed, 16 Feb 2022 17:58:47 +0800 Subject: [PATCH 10/26] =?UTF-8?q?feat:=20less=E6=A0=BC=E5=BC=8F=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .stylelintignore | 10 +++ .stylelintrc.js | 4 +- package.json | 9 +-- src/components/detail/group/index.less | 31 ++++----- .../detail/importSubform/index.less | 54 ++++++++------- src/components/formFields/color/index.less | 10 +-- src/components/formFields/datetime/index.less | 8 +-- .../formFields/datetimeRange/index.less | 8 +-- src/components/formFields/group/index.less | 64 +++++++++-------- .../formFields/importSubform/index.less | 56 +++++++-------- src/components/formFields/upload/index.less | 47 ++++++------- src/steps/detail/index.less | 35 +++++----- src/steps/form/index.less | 69 ++++++++++--------- src/steps/header/index.less | 4 +- src/steps/table/index.less | 31 +++++---- src/variable.less | 2 - 16 files changed, 233 insertions(+), 209 deletions(-) create mode 100644 .stylelintignore diff --git a/.stylelintignore b/.stylelintignore new file mode 100644 index 0000000..1cca3d1 --- /dev/null +++ b/.stylelintignore @@ -0,0 +1,10 @@ +*.js +*.tsx +*.ts +*.json +*.png +*.eot +*.ttf +*.woff +*.css +src/main.less diff --git a/.stylelintrc.js b/.stylelintrc.js index 6c7fe47..13abf1c 100644 --- a/.stylelintrc.js +++ b/.stylelintrc.js @@ -3,6 +3,8 @@ module.exports = { plugins: ['stylelint-order'], rules: { 'selector-pseudo-class-no-unknown': null, - 'no-descending-specificity': null + 'no-descending-specificity': null, + 'selector-class-pattern': null, + 'property-no-unknown': null } }; diff --git a/package.json b/package.json index 85cb507..2eb6c44 100644 --- a/package.json +++ b/package.json @@ -14,7 +14,7 @@ "link": "npm link ccms", "lint": "npm run lint:code && npm run lint:style", "lint:code": "eslint --fix **/*.{js,ts,jsx,tsx}", - "lint:style": "stylelint --fix src/**/*.{css,less,scss,sass}", + "lint:style": "stylelint --fix src/**/*.less --custom-syntax postcss-less", "prettier": "prettier -c --write **/*", "commit": "git-cz" }, @@ -29,7 +29,7 @@ "npm run prettier", "npm run lint:code" ], - "src/*.{css,scss,less,json,html,md,markdown}": [ + "src/*.{json,html,md,markdown}": [ "npm run prettier" ], "src/**/*.{css,less,scss,sass}": [ @@ -64,10 +64,10 @@ "@types/marked": "^1.2.0", "@types/node": "^14.11.2", "@types/react": "^16.9.46", - "@types/react-dom": "^16.9.8", - "@types/react-router-dom": "^5.1.5", "@types/react-color": "^3.0.6", + "@types/react-dom": "^16.9.8", "@types/react-loadable": "^5.5.3", + "@types/react-router-dom": "^5.1.5", "@types/react-test-renderer": "^16.9.3", "@typescript-eslint/eslint-plugin": "^5.10.1", "@typescript-eslint/parser": "^5.10.1", @@ -94,6 +94,7 @@ "less": "^4.1.2", "lint-staged": "^10.2.11", "postcss": "^8.4.5", + "postcss-less": "^6.0.0", "prettier": "^2.5.1", "rollup": "^2.66.0", "rollup-plugin-eslint": "^7.0.0", diff --git a/src/components/detail/group/index.less b/src/components/detail/group/index.less index c503e97..605f0f6 100644 --- a/src/components/detail/group/index.less +++ b/src/components/detail/group/index.less @@ -1,37 +1,36 @@ .ccms-antd-mini-detail-group-row { - position : relative; - display : flex; - box-orient : horizontal; + position: relative; + display: flex; + box-orient: horizontal; box-direction: normal; - flex-flow : row wrap; - width : 100%; + flex-flow: row wrap; + width: 100%; .detail-group-col { + position: relative; + flex: 0 0 100%; flex-direction: row; + max-width: 100%; + min-height: 1px; // display: flex; - margin-bottom : 15px; - flex-direction: row; - position : relative; - max-width : 100%; - min-height : 1px; - flex : 0 0 100%; + margin-bottom: 15px; } .detail-group-content { - &>:global(.ant-form-item) { + & > :global(.ant-form-item) { margin-bottom: 0 !important; } + display: flex; flex-direction: row; - display : flex; .ccms-antd-mini-detail-gruop-title { white-space: nowrap; } } - &>:global(.detail-group-children) { + & > :global(.detail-group-children) { + display: flex; word-break: break-all; - display : flex; } -} \ No newline at end of file +} diff --git a/src/components/detail/importSubform/index.less b/src/components/detail/importSubform/index.less index 1edb492..9cb06a3 100644 --- a/src/components/detail/importSubform/index.less +++ b/src/components/detail/importSubform/index.less @@ -1,36 +1,40 @@ -.ccms-antd-mini-form-import_subform, .ccms-antd-mini-detail-group { +.ccms-antd-mini-form-import_subform, +.ccms-antd-mini-detail-group { margin-bottom: 0 !important; - &>:global(.ant-form-item) { + & > :global(.ant-form-item) { margin-bottom: 0 !important; } - &>:global(.ant-form-item-label) { + & > :global(.ant-form-item-label) { + flex: 0 0 auto !important; width: calc(100% + 16px) !important; max-width: calc(100% + 16px) !important; margin-left: -8px !important; padding: 2px 8px !important; - flex: 0 0 auto !important; - background-color: #00000008 !important; font-weight: bold; + background-color: #00000008 !important; } - &>:global(.ant-form-item-control) { - margin-left: -8px !important; + + & > :global(.ant-form-item-control) { + max-width: calc(100% + 16px) !important; margin-right: -8px !important; + margin-left: -8px !important; padding: 8px !important; - max-width: calc(100% + 16px) !important; background-color: #00000004 !important; } - &>:global(.ant-form-item-control):first-child { + + & > :global(.ant-form-item-control):first-child { padding-top: 0 !important; - background-color: #00000000 !important; + background-color: #0000 !important; } } -.ccms-antd-mini-form-form, .ccms-antd-mini-form-object { - &>:global(.ant-form-item-control) { - &>:global(.ant-form-item-control-input) { - &>:global(.ant-form-item-control-input-content) { +.ccms-antd-mini-form-form, +.ccms-antd-mini-form-object { + & > :global(.ant-form-item-control) { + & > :global(.ant-form-item-control-input) { + & > :global(.ant-form-item-control-input-content) { min-height: 24px !important; } } @@ -38,21 +42,19 @@ } .ccms-antd-mini-form-group-row { - position : relative; - display : flex; - box-orient : horizontal; + position: relative; + display: flex; + box-orient: horizontal; box-direction: normal; - flex-flow : row wrap; - width : 100%; - + flex-flow: row wrap; + width: 100%; } .form-group-col { - flex-direction: row; - margin-bottom : 0; - flex-direction: row; - position : relative; - max-width : 100%; - min-height : 1px; + position: relative; flex: 0 0 100%; + flex-direction: row; + max-width: 100%; + min-height: 1px; + margin-bottom: 0; } diff --git a/src/components/formFields/color/index.less b/src/components/formFields/color/index.less index b5872be..e084448 100644 --- a/src/components/formFields/color/index.less +++ b/src/components/formFields/color/index.less @@ -1,8 +1,8 @@ .ccms-antd-color-preview { width: 22px; height: 24px; - border: 1px solid #d9d9d9; margin-left: -6px; + border: 1px solid #d9d9d9; border-radius: 2px; } @@ -10,15 +10,15 @@ position: absolute; z-index: 2; - &>.mask { + & > .mask { position: fixed; top: 0; - left: 0; right: 0; bottom: 0; + left: 0; } - &>.picker { + & > .picker { padding: 6px 1px; } -} \ No newline at end of file +} diff --git a/src/components/formFields/datetime/index.less b/src/components/formFields/datetime/index.less index 4fb9f3d..84946e1 100644 --- a/src/components/formFields/datetime/index.less +++ b/src/components/formFields/datetime/index.less @@ -1,4 +1,4 @@ -.picker-readonly{ - border-color: #d9d9d9 !important; - background: #fff !important; -} \ No newline at end of file +.picker-readonly { + background: #fff !important; + border-color: #d9d9d9 !important; +} diff --git a/src/components/formFields/datetimeRange/index.less b/src/components/formFields/datetimeRange/index.less index 4fb9f3d..84946e1 100644 --- a/src/components/formFields/datetimeRange/index.less +++ b/src/components/formFields/datetimeRange/index.less @@ -1,4 +1,4 @@ -.picker-readonly{ - border-color: #d9d9d9 !important; - background: #fff !important; -} \ No newline at end of file +.picker-readonly { + background: #fff !important; + border-color: #d9d9d9 !important; +} diff --git a/src/components/formFields/group/index.less b/src/components/formFields/group/index.less index a6be0ee..2037e72 100644 --- a/src/components/formFields/group/index.less +++ b/src/components/formFields/group/index.less @@ -1,63 +1,71 @@ -.ccms-antd-mini-form-import_subform, .ccms-antd-mini-form-group { +.ccms-antd-mini-form-import_subform, +.ccms-antd-mini-form-group { margin-bottom: 0 !important; - &>:global(.ant-form-item-label) { + + & > :global(.ant-form-item-label) { + flex: 0 0 auto !important; width: calc(100% + 16px) !important; max-width: calc(100% + 16px) !important; margin-left: -8px !important; padding: 2px 8px !important; - flex: 0 0 auto !important; - background-color: #00000008 !important; font-weight: bold; + background-color: #00000008 !important; } - &>:global(.ant-form-item-control) { - margin-left: -8px !important; + + & > :global(.ant-form-item-control) { + max-width: calc(100% + 16px) !important; margin-right: -8px !important; + margin-left: -8px !important; padding: 8px !important; - max-width: calc(100% + 16px) !important; background-color: #00000004 !important; } - &>:global(.ant-form-item-control):first-child { + + & > :global(.ant-form-item-control):first-child { padding-top: 0 !important; - background-color: #00000000 !important; + background-color: #0000 !important; } + .form-group-content { + display: flex; flex-direction: row; - display : flex; margin-bottom: 0; } } -.ccms-antd-mini-form-import_subform> .ant-col:first-child, .ccms-antd-mini-form-group > .ant-col:first-child{ + +.ccms-antd-mini-form-import_subform > .ant-col:first-child, +.ccms-antd-mini-form-group > .ant-col:first-child { font-weight: bold; } -.ccms-antd-mini-form-form, .ccms-antd-mini-form-object { - &>:global(.ant-form-item-control) { - &>:global(.ant-form-item-control-input) { - &>:global(.ant-form-item-control-input-content) { + +.ccms-antd-mini-form-form, +.ccms-antd-mini-form-object { + & > :global(.ant-form-item-control) { + & > :global(.ant-form-item-control-input) { + & > :global(.ant-form-item-control-input-content) { min-height: 24px !important; } } } } + .ccms-antd-mini-form-desc:not(:last-child) { - margin-bottom: 0px!important; + margin-bottom: 0 !important; } .ccms-antd-mini-form-group-row { - position : relative; - display : flex; - box-orient : horizontal; + position: relative; + display: flex; + box-orient: horizontal; box-direction: normal; - flex-flow : row wrap; - width : 100%; - + flex-flow: row wrap; + width: 100%; } .form-group-col { - flex-direction: row; - margin-bottom : 0; - flex-direction: row; - position : relative; - max-width : 100%; - min-height : 1px; + position: relative; flex: 0 0 100%; + flex-direction: row; + max-width: 100%; + min-height: 1px; + margin-bottom: 0; } diff --git a/src/components/formFields/importSubform/index.less b/src/components/formFields/importSubform/index.less index 5075ed3..251937d 100644 --- a/src/components/formFields/importSubform/index.less +++ b/src/components/formFields/importSubform/index.less @@ -1,60 +1,62 @@ -.ccms-antd-mini-form-import_subform, .ccms-antd-mini-form-group { +.ccms-antd-mini-form-import_subform, +.ccms-antd-mini-form-group { margin-bottom: 0 !important; - &>:global(.ant-form-item-label) { + & > :global(.ant-form-item-label) { + flex: 0 0 auto !important; width: calc(100% + 16px) !important; max-width: calc(100% + 16px) !important; margin-left: -8px !important; padding: 2px 8px !important; - flex: 0 0 auto !important; - background-color: #00000008 !important; font-weight: bold; + background-color: #00000008 !important; } - &>:global(.ant-form-item-control) { - margin-left: -8px !important; + + & > :global(.ant-form-item-control) { + max-width: calc(100% + 16px) !important; margin-right: -8px !important; + margin-left: -8px !important; padding: 8px !important; - max-width: calc(100% + 16px) !important; background-color: #00000004 !important; } - &>:global(.ant-form-item-control):first-child { + + & > :global(.ant-form-item-control):first-child { padding-top: 0 !important; - background-color: #00000000 !important; + background-color: #0000 !important; } + .form-group-content { + display: flex; flex-direction: row; - display : flex; margin-bottom: 0; } } -.ccms-antd-mini-form-form, .ccms-antd-mini-form-object { - &>:global(.ant-form-item-control) { - &>:global(.ant-form-item-control-input) { - &>:global(.ant-form-item-control-input-content) { +.ccms-antd-mini-form-form, +.ccms-antd-mini-form-object { + & > :global(.ant-form-item-control) { + & > :global(.ant-form-item-control-input) { + & > :global(.ant-form-item-control-input-content) { min-height: 24px !important; } } } } - .ccms-antd-mini-form-group-row { - position : relative; - display : flex; - box-orient : horizontal; + position: relative; + display: flex; + box-orient: horizontal; box-direction: normal; - flex-flow : row wrap; - width : 100%; + flex-flow: row wrap; + width: 100%; } - .form-group-col { - flex-direction: row; - margin-bottom : 0; - flex-direction: row; - position : relative; - max-width : 100%; - min-height : 1px; + position: relative; flex: 0 0 100%; + flex-direction: row; + max-width: 100%; + min-height: 1px; + margin-bottom: 0; } diff --git a/src/components/formFields/upload/index.less b/src/components/formFields/upload/index.less index 3830e44..1fdd600 100644 --- a/src/components/formFields/upload/index.less +++ b/src/components/formFields/upload/index.less @@ -1,60 +1,61 @@ .ccms-antd-upload { - &>:global(.ant-upload) { + & > :global(.ant-upload) { width: 100%; } } .ccms-antd-upload-image-box { - &>:global(.ant-upload-select) { + & > :global(.ant-upload-select) { width: auto; } } .ccms-antd-upload-image { + position: relative; width: 120px; height: 120px; + padding: 4px; border: 1px solid #d9d9d9; border-radius: 2px; - padding: 4px; - position: relative; - &>.image { + & > .image { width: 100%; height: 100%; object-fit: contain; } - &>.mask { - opacity: 0; - width: 100%; - height: 100%; + & > .mask { position: absolute; - left: 0; top: 0; - background: rgba(0,0,0,.6); - color: white; - font-size: 16px; + left: 0; display: flex; - justify-content: center; align-items: center; - transition: all .5s; + justify-content: center; + width: 100%; + height: 100%; + color: white; + font-size: 16px; + background: rgb(0 0 0 / 60%); + opacity: 0; + transition: all 0.5s; - &>:global(.ant-space) { - &>:global(.ant-space-item) { + & > :global(.ant-space) { + & > :global(.ant-space-item) { cursor: pointer; } } } - &:hover>.mask { + + &:hover > .mask { opacity: 1; } - &>.empty { - width: 100%; - height: 100%; + & > .empty { display: flex; - justify-content: center; align-items: center; + justify-content: center; + width: 100%; + height: 100%; cursor: pointer; } -} \ No newline at end of file +} diff --git a/src/steps/detail/index.less b/src/steps/detail/index.less index 8d94b4b..a10a510 100644 --- a/src/steps/detail/index.less +++ b/src/steps/detail/index.less @@ -1,39 +1,38 @@ .ccms-antd-mini-detail-row { - display : flex; - box-orient : horizontal; + position: relative; + display: flex; + flex-flow: row wrap; + box-orient: horizontal; box-direction: normal; - flex-flow : row wrap; - position : relative; .detail-col { - margin-bottom : 15px; + position: relative; + flex: 0 0 100%; // display : flex; - flex-direction : row; - position : relative; - max-width : 100%; - flex : 0 0 100%; - min-height : 1px; + flex-direction: row; + max-width: 100%; + min-height: 1px; + margin-bottom: 15px; } .detail-group-content { + display: flex; flex-direction: row; - display : flex; } .ant-collapse-header-text { font-weight: bold; - font-size : 16px; + font-size: 16px; } .ccms-antd-mini-detail-group { - .detail-group-title { - font-weight : bold; - font-size : 16px; margin-bottom: 20px; - padding : 16px 0; + padding: 16px 0; + font-weight: bold; + font-size: 16px; + white-space: nowrap; border-bottom: 1px solid #f1f1f1; - white-space : nowrap } } -} \ No newline at end of file +} diff --git a/src/steps/form/index.less b/src/steps/form/index.less index c6472e4..e3d6c05 100644 --- a/src/steps/form/index.less +++ b/src/steps/form/index.less @@ -1,74 +1,75 @@ +/* stylelint-disable kebab-case */ .ccms-antd-mini-form-import_subform, .ccms-antd-mini-form-group { margin-bottom: 0 !important; - &>:global(.ant-form-item-label) { - width : calc(100% + 16px) !important; - max-width : calc(100% + 16px) !important; - margin-left : -8px !important; - padding : 2px 8px !important; - flex : 0 0 auto !important; + & > :global(.ant-form-item-label) { + flex: 0 0 auto !important; + width: calc(100% + 16px) !important; + max-width: calc(100% + 16px) !important; + margin-left: -8px !important; + padding: 2px 8px !important; background-color: #00000008 !important; } - &>:global(.ant-form-item-control) { - margin-left : -8px !important; - margin-right : -8px !important; - padding : 8px !important; - max-width : calc(100% + 16px) !important; + & > :global(.ant-form-item-control) { + max-width: calc(100% + 16px) !important; + margin-right: -8px !important; + margin-left: -8px !important; + padding: 8px !important; background-color: #00000004 !important; } - &>:global(.ant-form-item-control):first-child { - padding-top : 0 !important; - background-color: #00000000 !important; + & > :global(.ant-form-item-control):first-child { + padding-top: 0 !important; + background-color: #0000 !important; } + .form-group-content { + display: flex; flex-direction: row; - display : flex; margin-bottom: 15px; } } .ccms-antd-mini-form-form { - &>:global(.ant-form-item-control) { - &>:global(.ant-form-item-control-input) { - &>:global(.ant-form-item-control-input-content) { + & > :global(.ant-form-item-control) { + & > :global(.ant-form-item-control-input) { + & > :global(.ant-form-item-control-input-content) { min-height: 24px !important; } } } } - .ccms-antd-mini-form-row { - display : flex; - box-orient : horizontal; - box-direction: normal; - flex-flow : row wrap; - position : relative; + position: relative; + display: flex; + flex-flow: row wrap; + box-orient: horizontal; /* stylelint-disable-line */ + box-direction: normal; /* stylelint-disable-line */ } .form-col { - margin-bottom : 15px; - flex-direction : row; - position : relative; - max-width : 100%; - min-height : 1px; + position: relative; flex: 0 0 100%; + flex-direction: row; + max-width: 100%; + min-height: 1px; + margin-bottom: 15px; } .ant-collapse-header-text { font-weight: bold; - font-size : 16px; + font-size: 16px; } .ccms-antd-mini-form-group { .form-group-title { - font-weight : bold; - font-size : 16px; margin-bottom: 20px; - padding : 16px 0; + padding: 16px 0; + font-weight: bold; + font-size: 16px; border-bottom: 1px solid #f1f1f1; } -} \ No newline at end of file +} diff --git a/src/steps/header/index.less b/src/steps/header/index.less index 4771eed..d6b62d6 100644 --- a/src/steps/header/index.less +++ b/src/steps/header/index.less @@ -1,6 +1,6 @@ .ccms-antd-header { - padding: 0 !important; margin-bottom: 24px !important; + padding: 0 !important; } .breadcrumb-item-bold { @@ -9,4 +9,4 @@ .breadcrumb-item-pointer { cursor: pointer; -} \ No newline at end of file +} diff --git a/src/steps/table/index.less b/src/steps/table/index.less index 157b1c1..05696d2 100644 --- a/src/steps/table/index.less +++ b/src/steps/table/index.less @@ -1,17 +1,18 @@ .ccms-antd-table { - &>.ccms-antd-table-header { - display: flex; - justify-content: space-between; - align-items: center; - margin-bottom: 16px; - - &>.ccms-antd-table-title { - color: #000000d9; - font-weight: 500; - font-size: 16px; - } - &>.ccms-antd-table-tableOperation { - margin-left: 16px; - } + & > .ccms-antd-table-header { + display: flex; + align-items: center; + justify-content: space-between; + margin-bottom: 16px; + + & > .ccms-antd-table-title { + color: #000000d9; + font-weight: 500; + font-size: 16px; } - } \ No newline at end of file + + & > .ccms-antd-table-tableOperation { + margin-left: 16px; + } + } +} diff --git a/src/variable.less b/src/variable.less index ca3b06a..d0217a8 100644 --- a/src/variable.less +++ b/src/variable.less @@ -13,7 +13,6 @@ @ccms-form-field-border-radius: 2px; @ccms-form-field-background: #ffffff; - @primary-color: #1890ff; // 全局主色 @link-color: #1890ff; // 链接色 @success-color: #52c41a; // 成功色 @@ -28,4 +27,3 @@ @border-color-base: #d9d9d9; // 边框色 @box-shadow-base: 0 3px 6px -4px rgba(0, 0, 0, 0.12), 0 6px 16px 0 rgba(0, 0, 0, 0.08), 0 9px 28px 8px rgba(0, 0, 0, 0.05); // 浮层阴影 - -- Gitee From 331cd988260318aac192d9b0bf2ef166d4944a24 Mon Sep 17 00:00:00 2001 From: zjt Date: Tue, 1 Mar 2022 21:44:44 +0800 Subject: [PATCH 11/26] chore: w --- .babelrc | 64 +++++++++++++++++++++++++----------------------- .eslintrc | 13 +++++++++- package.json | 1 + rollup.config.js | 19 +++++++------- src/main.tsx | 5 ++-- tsconfig.json | 2 +- 6 files changed, 60 insertions(+), 44 deletions(-) diff --git a/.babelrc b/.babelrc index 3de8b61..4796b9a 100644 --- a/.babelrc +++ b/.babelrc @@ -1,34 +1,36 @@ { - "sourceMaps": true, - "presets": [ - ["@babel/preset-typescript", - { - "isTSX": true, - "allExtensions": true - }], - "@babel/preset-react", - [ - "@babel/preset-env", - { - "targets": { - "node": "10.13.0" - }, - // "modules": false - //将 ES6 module 转换为其他模块规范,可选 "adm" | "umd" | "systemjs" | "commonjs" | "cjs" | false,默认为 false - // 否则 Babel 会在 Rollup 有机会做处理之前,将我们的模块转成 CommonJS ,导致 Rollup 的一些处理失败。 - } - ] + "sourceMaps": true, + "presets": [ + [ + "@babel/preset-typescript", + { + "isTSX": true, + "allExtensions": true + } ], - "plugins": [ - [ - "import", - { - "libraryName": "antd", - "style": "css" - } - ] + "@babel/preset-react", + [ + "@babel/preset-env", + { + "targets": { + "node": "10.13.0" + } + // "modules": false + //将 ES6 module 转换为其他模块规范,可选 "adm" | "umd" | "systemjs" | "commonjs" | "cjs" | false,默认为 false + // 否则 Babel 会在 Rollup 有机会做处理之前,将我们的模块转成 CommonJS ,导致 Rollup 的一些处理失败。 + } ] -// 导入js模块:["import", { "libraryName": "antd" }] -// 导入js和css模块(LESS/Sass源文件):["import", { "libraryName": "antd", "style": true }] -//    导入js和css模块(css 内置文件):["import", { "libraryName": "antd", "style": "css" }] -} \ No newline at end of file + ], + "plugins": [ + [ + "import", + { + "libraryName": "antd", + "style": "css" + } + ] + ] + // 导入js模块:["import", { "libraryName": "antd" }] + // 导入js和css模块(LESS/Sass源文件):["import", { "libraryName": "antd", "style": true }] + //    导入js和css模块(css 内置文件):["import", { "libraryName": "antd", "style": "css" }] +} diff --git a/.eslintrc b/.eslintrc index 04b963d..3a3094a 100644 --- a/.eslintrc +++ b/.eslintrc @@ -43,7 +43,18 @@ "rules": { "no-use-before-define": "off", "react/display-name": 0, - "import/extensions": 0 + "import/extensions": 0, + "react/jsx-filename-extension": [ + 2, + { + "extensions": [ + ".js", + ".jsx", + ".ts", + ".tsx" + ] + } + ] }, // 指定react版本为安装的版本 "settings": { diff --git a/package.json b/package.json index 2eb6c44..d1e4c65 100644 --- a/package.json +++ b/package.json @@ -112,6 +112,7 @@ "@ant-design/icons": "^4.3.0", "antd": "^4.14.1", "axios": "^0.20.0", + "ccms": "workspace:*", "lodash": "^4.17.21", "marked": "^1.2.5", "moment": "^2.29.0", diff --git a/rollup.config.js b/rollup.config.js index 0a70596..92a8897 100644 --- a/rollup.config.js +++ b/rollup.config.js @@ -14,9 +14,9 @@ export default { output: [ { format: 'cjs', - file: path.resolve('dist/index.js') // 输出的文件路径 + file: path.resolve('dist/index.js'), // 输出的文件路径 // sourcemap: true - } + }, ], onwarn(warning) { if (warning.code === 'THIS_IS_UNDEFINED') { @@ -31,25 +31,26 @@ export default { // }), postcss({ extensions: ['.css', '.less'], - modules: true // 启用CSS模块 + modules: true, // 启用CSS模块 }), json(), ts({ - tsconfig: path.resolve(__dirname, 'tsconfig.json') + tsconfig: path.resolve(__dirname, 'tsconfig.json'), }), babel({ babelHelpers: 'runtime', - exclude: 'node_modules/**' // 只编译我们的源代码 + exclude: 'node_modules/**', // 只编译我们的源代码 + plugins: ['@babel/plugin-transform-runtime'], }), commonjs(), nodeResolve({ - extensions: ['.js', '.ts', '.tsx'] + extensions: ['.js', '.ts', '.tsx'], }), - terser() + terser(), ], external: ['react', 'react-dom', 'ccms', '@ant-design/icons', 'react-color', 'antd'], // external: id => /lodash/.test(id), // lodash 现在将被视为外部的(externals),不会与你的库打包在一起 watch: { - include: 'src/**' - } + include: 'src/**', + }, }; diff --git a/src/main.tsx b/src/main.tsx index 1d36ea2..aaa45bc 100644 --- a/src/main.tsx +++ b/src/main.tsx @@ -4,6 +4,7 @@ import { ICCMS, CCMSProps } from 'ccms/dist/src/main' import { PageHeader, Space } from 'antd' import StepComponents from './steps' import styles from "./main.less" + export default class CCMSComponent extends CCMS { getStepComponent = (key: string) => StepComponents[key] @@ -17,13 +18,13 @@ export default class CCMSComponent extends CCMS {
{ (title || description) && -
+
{description}
} -
+
{children}
diff --git a/tsconfig.json b/tsconfig.json index 630e8fd..464724f 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -32,7 +32,7 @@ "resolveJsonModule": true, "isolatedModules": true, "noEmit": true, - "noImplicitAny": true, + "noImplicitAny": false, "strictNullChecks": true, "suppressImplicitAnyIndexErrors": true, "types": [ // // 导入指定类型包 -- Gitee From ae74dd3184cf2ad986bd338e0dd23e8c0deb2590 Mon Sep 17 00:00:00 2001 From: zjt Date: Tue, 1 Mar 2022 21:46:13 +0800 Subject: [PATCH 12/26] 1.1.2 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index d1e4c65..550adc6 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ccms-antd", - "version": "1.1.1", + "version": "1.1.2", "description": "1.1.1 修改日期时间汉化", "main": "dist/index.js", "types": "dist/src/index.d.ts", -- Gitee From a2adf8bc973f7557fffb7d3a7290bd5bfbe34345 Mon Sep 17 00:00:00 2001 From: zjt Date: Tue, 1 Mar 2022 21:46:20 +0800 Subject: [PATCH 13/26] 1.1.3 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 550adc6..6fbd812 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ccms-antd", - "version": "1.1.2", + "version": "1.1.3", "description": "1.1.1 修改日期时间汉化", "main": "dist/index.js", "types": "dist/src/index.d.ts", -- Gitee From 5cb79f5942fc80d83091e49e7c7bd0c3538afbb2 Mon Sep 17 00:00:00 2001 From: zjt Date: Wed, 2 Mar 2022 10:33:48 +0800 Subject: [PATCH 14/26] 1.1.4 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 6fbd812..b9fd535 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ccms-antd", - "version": "1.1.3", + "version": "1.1.4", "description": "1.1.1 修改日期时间汉化", "main": "dist/index.js", "types": "dist/src/index.d.ts", -- Gitee From 26b8f030a547939de5d6e07d7ebd4d8e0fc6bccd Mon Sep 17 00:00:00 2001 From: zjt Date: Wed, 2 Mar 2022 10:33:52 +0800 Subject: [PATCH 15/26] 1.1.5 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index b9fd535..55802fc 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ccms-antd", - "version": "1.1.4", + "version": "1.1.5", "description": "1.1.1 修改日期时间汉化", "main": "dist/index.js", "types": "dist/src/index.d.ts", -- Gitee From 7d9bbbafc087401133c2e485337e43bbfe084ddd Mon Sep 17 00:00:00 2001 From: zjt Date: Wed, 2 Mar 2022 10:38:13 +0800 Subject: [PATCH 16/26] 1.1.6 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 55802fc..925a17d 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ccms-antd", - "version": "1.1.5", + "version": "1.1.6", "description": "1.1.1 修改日期时间汉化", "main": "dist/index.js", "types": "dist/src/index.d.ts", -- Gitee From 1a3cc8fce49d713d54f04dbc167e26dc21932e48 Mon Sep 17 00:00:00 2001 From: zjt Date: Wed, 2 Mar 2022 11:31:04 +0800 Subject: [PATCH 17/26] =?UTF-8?q?chore:=20=E6=95=B4=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .DS_Store | Bin 12292 -> 0 bytes .commitlintrc.js | 12 ++++++------ .eslintrc | 22 ++++++---------------- rollup.config.js | 4 +--- tsconfig.json | 31 +++++++++++++------------------ 5 files changed, 26 insertions(+), 43 deletions(-) delete mode 100644 .DS_Store diff --git a/.DS_Store b/.DS_Store deleted file mode 100644 index ea4d6d3fc9cd20f1d3fa774edd8bd61f838d772a..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 12292 zcmeHNU2GIp6h3F$%1oEG(+YI?>n2di;0?GjPV7}y)(PaPC?>}BFs(Z zp1J3qbMHN8zS%qH+yww^%P0*1H2@&c#i%r!s;2>BVWOVG`q?$36c7jLT1*$+O8^$w zUAmb{>Sl6=^h`#GSWLf=UkYeGeHyT!h5Bl)^FnuZpnwUfK)+|wRlzYj6G7>&Dh%Ax$HgDUn3&-&RXJTG)lpY5C% zb7|bAQx4^-q{CH-I;!Y~80e@IKgPs~#$7t)P)8lmQ3rHqMmIu1K0E2fxHw?kp+OyZ zAn?FU50nwBz=^6okvogL&r{Eh$U7&+VsAITznC1+HOsEA{{}+^g+=$x5`?tdyRl<*{y;rCX!zj=iCGvi5$LwO1?-hf5-xx;Aaz(mfza z8B5)v>awkksvWYeS_4vSZ3O8=Y#cYG`=HM!RFXL!j!FDYT6_}@Ht@OhKZ0>H^vbT?@MsE75M?_&a>uFUKRS~MQP^gZxBp4NLa&^4k zX-RBnS`78j2AkmkjKDaYgwyaUybBlLJ@_2Hf-7(pet@6h7x)#f!5@ei!U8P9Qmn+K z_y8`)8f?HuY{G|e6L#Td?8ZlN5AMZ%cmPwV<1iXHf}{92PT>>yB%Z_<@D!fL7x6Vb zk8k2z_%?ou7x7EHgjaAHui}sR6aMC`Fq8%MR;Qh<@prnrfnxWq4V}6D-|!=o2~9CHq+IM}jaazGxLzhL2_a8-0C!B9Qw ze=)Kzj5Lb@PMBuWOQO|Li6KpxUbtX>B)UAhLLmH0$a^28wiKebfr+k;HiV@D!oA3w zYr<=zQV~Ji>1_^g2up?Z4miCV!||weAEDjpZ4Y;bC17u(cw4ysEm$wX*YG_7^-s7? z@GQm(0%(i?T90dSBgU~6JFpYCVGqGGfxWn&;CT>b4p9S5g6KF-;Bh=bKz#k z&*K?_=}Y)BzJjmg8+eWb_5!|-AK*v$F@Azy;ANclLA5&zQitNz8&Dlhqz&CP28qLf zT?&UmWr<-*{-!ATYrr8&6c1ACFj)CpR^fb-_ikCm&<$PC4xO+K5>(g0Fev#tuz_^W z<`T>R<@AcnG}95P2WjS2ptF=SwfT%}1-=o^`9_%S8{rmuSn1OfVF#_T6*^$+&DV-g z`84MGG;A0m-=t|fAK+_9lh?*?W;I^(jZ{D$PD3i+GM;?*`o@*Y?vm{Bl+YB`%m*{m zO(EGgB{hQ*cp&gV;DNvcfd>K){3jkLp;-&*6M>(r=WqYOK5V?7Q#rZ2GY60}FZ+GN z9!QQEFL7oh5_q8P9ggW8qJ#houvOB!l^zSLy?V@$L7L0^uQ+x<#gYzQx#FxG zPi+_!J*PpNEeg&j4oE_o~uyBkK>8*<9MR{IG(6`ioylsuFjN0 Xsh7&X{zm|Q6cz0M!Tx`5@Be=ROBgB@ diff --git a/.commitlintrc.js b/.commitlintrc.js index 1de314f..e8077e8 100644 --- a/.commitlintrc.js +++ b/.commitlintrc.js @@ -20,12 +20,12 @@ module.exports = { 'build', // 编译构建 'test', // 增加测试 'revert', // 回滚 - 'chore' // 其他改动 - ] + 'chore', // 其他改动 + ], ], - 'type-empty': [2, 'never'], // 提交不符合规范时,也可以提交,但是会有警告 - 'subject-empty': [2, 'never'], // 提交不符合规范时,也可以提交,但是会有警告 + 'type-empty': [2, 'never'], + 'subject-empty': [2, 'never'], 'subject-full-stop': [0, 'never'], - 'subject-case': [0, 'never'] - } + 'subject-case': [0, 'never'], + }, }; diff --git a/.eslintrc b/.eslintrc index 3a3094a..50fbc7d 100644 --- a/.eslintrc +++ b/.eslintrc @@ -1,5 +1,4 @@ { - // 为我们提供运行环境,一个环境定义了一组预定义的全局变量 "env": { "browser": true, "es2021": true, @@ -7,7 +6,6 @@ "node": true, "commonjs": true }, - // 一个配置文件可以被基础配置中的已启用的规则继承。 "extends": [ "airbnb", "prettier", @@ -17,9 +15,7 @@ "plugin:import/typescript", "plugin:@typescript-eslint/recommended" ], - // ESLint 默认使用Espree作为其解析器,你可以在配置文件中指定一个不同的解析器 "parser": "@typescript-eslint/parser", - // 配置解析器支持的语法 "parserOptions": { "ecmaFeatures": { "jsx": true @@ -27,8 +23,6 @@ "ecmaVersion": 12, "sourceType": "module" }, - // ESLint 支持使用第三方插件。在使用插件之前,你必须使用 npm 安装它。 - // 在配置文件里配置插件时,可以使用 plugins 关键字来存放插件名字的列表。插件名称可以省略 eslint-plugin- 前缀 "plugins": [ "react", "babel", @@ -36,14 +30,16 @@ "react-hooks", "@typescript-eslint" ], - // ESLint 附带有大量的规则。你可以使用注释或配置文件修改你项目中要使用的规则。要改变一个规则设置,你必须将规则 ID 设置为下列值之一: - // "off" 或 0 - 关闭规则 - // "warn" 或 1 - 开启规则,使用警告级别的错误:warn (不会导致程序退出) - // "error" 或 2 - 开启规则,使用错误级别的错误:error (当被触发的时候,程序会退出) + "settings": { + "react": { + "version": "16.13.1" + } + }, "rules": { "no-use-before-define": "off", "react/display-name": 0, "import/extensions": 0, + "comma-dangle": 0, "react/jsx-filename-extension": [ 2, { @@ -55,11 +51,5 @@ ] } ] - }, - // 指定react版本为安装的版本 - "settings": { - "react": { - "version": "16.13.1" - } } } diff --git a/rollup.config.js b/rollup.config.js index 92a8897..1198ec5 100644 --- a/rollup.config.js +++ b/rollup.config.js @@ -14,8 +14,7 @@ export default { output: [ { format: 'cjs', - file: path.resolve('dist/index.js'), // 输出的文件路径 - // sourcemap: true + file: path.resolve('dist/index.js'), }, ], onwarn(warning) { @@ -49,7 +48,6 @@ export default { terser(), ], external: ['react', 'react-dom', 'ccms', '@ant-design/icons', 'react-color', 'antd'], - // external: id => /lodash/.test(id), // lodash 现在将被视为外部的(externals),不会与你的库打包在一起 watch: { include: 'src/**', }, diff --git a/tsconfig.json b/tsconfig.json index 464724f..47d3ebe 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -6,36 +6,31 @@ "rollup.config.js" ], "compilerOptions": { - /* Visit https://aka.ms/tsconfig.json to read more about this file */ - "target": "ES6", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019', 'ES2020', or 'ESNEXT'. */ - "module": "ESNext", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', 'es2020', or 'ESNext'. */ - "sourceMap": true, /* Generates corresponding '.map' file. */ - "outDir": "./dist/src", //输出编译后的文件 /* Redirect output structure to the directory. */ - "esModuleInterop": true, /* 通过为所有导入创建命名空间对象,启用 CommonJS 和 ES 模块之间的发射互操作性 Implies 'allowSyntheticDefaultImports'. */ - "declaration": true, // 生成定义文件 /* Generates corresponding '.d.ts' file. */ - "jsx": "react", /* Specify JSX code generation: 'preserve', 'react-native', or 'react'. */ - // "declarationDir": "./ts/types", // 定义文件输出目录 - // "declarationMap": true, // 生成定义sourceMap /* Generates a sourcemap for each corresponding '.d.ts' file. */ - // "removeComments": true, // 删除注释 - // "noUnusedLocals": true, // 未使用变量报错 /* Report errors on unused locals. */ + "target": "ES6", + "module": "ESNext", + "sourceMap": true, + "outDir": "./dist/src", + "esModuleInterop": true, + "declaration": true, + "jsx": "react", "strict": true, - "lib": [ // // 指定要包含在编译中的库文件导入库类型定义 + "lib": [ "dom", "dom.iterable", "esnext" ], - "allowJs": true, /* Allow javascript files to be compiled. */ - "skipLibCheck": true, // Skip type checking of declaration files. + "allowJs": true, + "skipLibCheck": true, "allowSyntheticDefaultImports": true, - "forceConsistentCasingInFileNames": true, // /* Disallow inconsistently-cased references to the same file. */ - "moduleResolution": "node", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */ + "forceConsistentCasingInFileNames": true, + "moduleResolution": "node", "resolveJsonModule": true, "isolatedModules": true, "noEmit": true, "noImplicitAny": false, "strictNullChecks": true, "suppressImplicitAnyIndexErrors": true, - "types": [ // // 导入指定类型包 + "types": [ "node", "jest" ], -- Gitee From 09f1b305fc26ff2a22f5931e5742869c716c9bcd Mon Sep 17 00:00:00 2001 From: zjt Date: Wed, 2 Mar 2022 15:09:41 +0800 Subject: [PATCH 18/26] =?UTF-8?q?chore:=20=E6=95=B4=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .eslintrc | 14 ++++++++++++-- rollup.config.js | 20 ++++++++++---------- 2 files changed, 22 insertions(+), 12 deletions(-) diff --git a/.eslintrc b/.eslintrc index 50fbc7d..65e4279 100644 --- a/.eslintrc +++ b/.eslintrc @@ -33,13 +33,23 @@ "settings": { "react": { "version": "16.13.1" - } + }, + "polyfills": [ + "Promise" + ] }, "rules": { "no-use-before-define": "off", "react/display-name": 0, "import/extensions": 0, - "comma-dangle": 0, + "comma-dangle": [ + "error", + "never" + ], + "space-before-function-paren": [ + "error", + "always" + ], "react/jsx-filename-extension": [ 2, { diff --git a/rollup.config.js b/rollup.config.js index 1198ec5..06176c0 100644 --- a/rollup.config.js +++ b/rollup.config.js @@ -14,10 +14,10 @@ export default { output: [ { format: 'cjs', - file: path.resolve('dist/index.js'), - }, + file: path.resolve('dist/index.js') + } ], - onwarn(warning) { + onwarn (warning) { if (warning.code === 'THIS_IS_UNDEFINED') { return; } @@ -30,25 +30,25 @@ export default { // }), postcss({ extensions: ['.css', '.less'], - modules: true, // 启用CSS模块 + modules: true // 启用CSS模块 }), json(), ts({ - tsconfig: path.resolve(__dirname, 'tsconfig.json'), + tsconfig: path.resolve(__dirname, 'tsconfig.json') }), babel({ babelHelpers: 'runtime', exclude: 'node_modules/**', // 只编译我们的源代码 - plugins: ['@babel/plugin-transform-runtime'], + plugins: ['@babel/plugin-transform-runtime'] }), commonjs(), nodeResolve({ - extensions: ['.js', '.ts', '.tsx'], + extensions: ['.js', '.ts', '.tsx'] }), - terser(), + terser() ], external: ['react', 'react-dom', 'ccms', '@ant-design/icons', 'react-color', 'antd'], watch: { - include: 'src/**', - }, + include: 'src/**' + } }; -- Gitee From e677262c8b45813bfd1b6a04f13feb26c2624c78 Mon Sep 17 00:00:00 2001 From: zjt Date: Wed, 2 Mar 2022 17:01:29 +0800 Subject: [PATCH 19/26] =?UTF-8?q?=F0=9F=92=84=E6=A0=BC=E5=BC=8F(tsx):=20?= =?UTF-8?q?=E6=97=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/index.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/index.tsx b/src/index.tsx index 1b721d0..f680e43 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -12,4 +12,4 @@ export { default as Table } from './steps/table' export { default as Fetch } from './steps/fetch' export { default as DetailStep } from './steps/detail' export { default as DetailGroupField } from './components/detail/group' -export { default as DetailTextField } from './components/detail/text' \ No newline at end of file +export { default as DetailTextField } from './components/detail/text' -- Gitee From 3e927766f4c0d93d8e6274172a1de572357bb3b5 Mon Sep 17 00:00:00 2001 From: zjt Date: Wed, 2 Mar 2022 17:24:55 +0800 Subject: [PATCH 20/26] =?UTF-8?q?feat(commit):=20=F0=9F=92=84=E6=A0=BC?= =?UTF-8?q?=E5=BC=8F(tsx):=20=E6=97=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 925a17d..4cbf7c4 100644 --- a/package.json +++ b/package.json @@ -38,7 +38,7 @@ }, "config": { "commitizen": { - "path": "./node_modules/cz-conventional-changelog" + "path": "./node_modules/cz-customizable" } }, "author": "niuweb", @@ -75,7 +75,8 @@ "babel-jest": "^26.3.0", "babel-plugin-import": "^1.13.3", "commitizen": "^4.2.4", - "cz-conventional-changelog": "^3.3.0", + "commitlint-config-cz": "^0.13.2", + "cz-customizable": "^6.3.0", "eslint": "^7.32.0", "eslint-config-airbnb": "^19.0.4", "eslint-config-prettier": "^8.3.0", @@ -85,6 +86,7 @@ "eslint-plugin-jest": "^26.0.0", "eslint-plugin-jsx-a11y": "^6.5.1", "eslint-plugin-node": "^11.1.0", + "eslint-plugin-prettier": "^4.0.0", "eslint-plugin-promise": "^4.3.1", "eslint-plugin-react": "^7.28.0", "eslint-plugin-react-hooks": "^4.3.0", -- Gitee From a3003e6bf1dd65049b6ea20c5e45bef22d233f33 Mon Sep 17 00:00:00 2001 From: zjt Date: Wed, 2 Mar 2022 17:25:42 +0800 Subject: [PATCH 21/26] feat: diy commit --- .commitlintrc.js | 22 ++++++++++++---------- .cz-config.js | 30 ++++++++++++++++++++++++++++++ .eslintrc | 37 +++++++++++-------------------------- .prettierrc | 5 ++++- 4 files changed, 57 insertions(+), 37 deletions(-) create mode 100644 .cz-config.js diff --git a/.commitlintrc.js b/.commitlintrc.js index e8077e8..72120c1 100644 --- a/.commitlintrc.js +++ b/.commitlintrc.js @@ -1,7 +1,9 @@ /** * @file commitlint 配置 - * commit message: (注意冒号后面有空格) - * + * commit message: (): (注意冒号后面有空格) + * type 标识commit类别 + * scope 标识commit影响范围 + * subject 本次修改的简单描述 */ module.exports = { extends: ['@commitlint/config-conventional'], @@ -14,18 +16,18 @@ module.exports = { 'feat', // 新功能(feature) 'perf', // 优化 'fix', // 修补bug - 'docs', // 文档(documentation) - 'style', // 格式(不影响代码运行的变动) - 'refactor', // 重构(即不是新增功能,也不是修改bug的代码变动) + 'docs', // 文档 + 'style', // 格式 + 'refactor', // 重构 'build', // 编译构建 'test', // 增加测试 'revert', // 回滚 - 'chore', // 其他改动 - ], + 'chore' // 其他改动 + ] ], 'type-empty': [2, 'never'], 'subject-empty': [2, 'never'], 'subject-full-stop': [0, 'never'], - 'subject-case': [0, 'never'], - }, -}; + 'subject-case': [0, 'never'] + } +} diff --git a/.cz-config.js b/.cz-config.js new file mode 100644 index 0000000..ac77282 --- /dev/null +++ b/.cz-config.js @@ -0,0 +1,30 @@ +'use strict' +module.exports = { + types: [ + { value: 'init', name: '初始化' }, + { value: 'feat', name: '新增: 新功能' }, + { value: 'fix', name: '修复: 修复一个Bug' }, + { value: 'docs', name: '文档: 变更的只有文档' }, + { value: 'style', name: '格式: 空格, 分号等格式修复' }, + { value: 'refactor', name: '重构: 代码重构,注意和特性、修复区分开' }, + { value: 'perf', name: '性能: 提升性能' }, + { value: 'test', name: '测试: 添加一个测试' }, + { value: 'build', name: '工具: 开发工具变动(构建、脚手架工具等)' }, + { value: 'revert', name: '回滚: 代码回退' }, + { value: 'chore', name: '其他' } + ], + scopes: [{ name: 'javascript' }, { name: 'typescript' }, { name: 'React' }, { name: 'node' }], + messages: { + type: '选择一种你的提交类型:', + scope: '选择一个scope (可选):', + customScope: 'Denote the SCOPE of this change:', + subject: '短说明:\n', + body: '长说明,使用"|"换行(可选):\n', + breaking: '非兼容性说明 (可选):\n', + footer: '关联关闭的issue,例如:#31, #34(可选):\n', + confirmCommit: '确定提交说明?(yes/no)' + }, + allowCustomScopes: true, + allowBreakingChanges: ['特性', '修复'], + subjectLimit: 100 +} diff --git a/.eslintrc b/.eslintrc index 65e4279..3776a0c 100644 --- a/.eslintrc +++ b/.eslintrc @@ -8,12 +8,13 @@ }, "extends": [ "airbnb", - "prettier", "plugin:compat/recommended", "plugin:jest/recommended", "plugin:react/recommended", "plugin:import/typescript", - "plugin:@typescript-eslint/recommended" + "plugin:@typescript-eslint/recommended", + "prettier", + "plugin:prettier/recommended" ], "parser": "@typescript-eslint/parser", "parserOptions": { @@ -23,42 +24,26 @@ "ecmaVersion": 12, "sourceType": "module" }, - "plugins": [ - "react", - "babel", - "jest", - "react-hooks", - "@typescript-eslint" - ], + "plugins": ["react", "babel", "jest", "react-hooks", "@typescript-eslint"], "settings": { "react": { "version": "16.13.1" }, - "polyfills": [ - "Promise" - ] + "polyfills": ["Promise"] }, "rules": { + "prettier/prettier": "error", + "arrow-body-style": "off", + "prefer-arrow-callback": "off", "no-use-before-define": "off", "react/display-name": 0, "import/extensions": 0, - "comma-dangle": [ - "error", - "never" - ], - "space-before-function-paren": [ - "error", - "always" - ], + "comma-dangle": ["error", "never"], + "space-before-function-paren": ["error", "always"], "react/jsx-filename-extension": [ 2, { - "extensions": [ - ".js", - ".jsx", - ".ts", - ".tsx" - ] + "extensions": [".js", ".jsx", ".ts", ".tsx"] } ] } diff --git a/.prettierrc b/.prettierrc index d0ed5e8..51fdad2 100644 --- a/.prettierrc +++ b/.prettierrc @@ -1,5 +1,8 @@ { "singleQuote": true, "printWidth": 120, - "tabWidth": 2 + "useTabs": false, + "tabWidth": 2, + "semi": false, + "trailingComma": "none" } -- Gitee From 7144c431406a12f8cca2129a63c794644bee384c Mon Sep 17 00:00:00 2001 From: zjt Date: Wed, 2 Mar 2022 17:58:44 +0800 Subject: [PATCH 22/26] =?UTF-8?q?fix:=20prettier=E4=B8=8Eeslint=E5=86=B2?= =?UTF-8?q?=E7=AA=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .eslintrc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.eslintrc b/.eslintrc index 3776a0c..23b421f 100644 --- a/.eslintrc +++ b/.eslintrc @@ -39,7 +39,7 @@ "react/display-name": 0, "import/extensions": 0, "comma-dangle": ["error", "never"], - "space-before-function-paren": ["error", "always"], + "space-before-function-paren": [0, "always"], "react/jsx-filename-extension": [ 2, { -- Gitee From a03ee3cdb64bed3a69c435de887c146ecf4a72e4 Mon Sep 17 00:00:00 2001 From: zjt Date: Thu, 3 Mar 2022 10:45:48 +0800 Subject: [PATCH 23/26] =?UTF-8?q?perf:=20=E4=BC=98=E5=8C=96=E8=A7=84?= =?UTF-8?q?=E5=88=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .babelrc | 6 ------ .eslintrc | 5 +---- package.json | 1 - 3 files changed, 1 insertion(+), 11 deletions(-) diff --git a/.babelrc b/.babelrc index 4796b9a..6d99c23 100644 --- a/.babelrc +++ b/.babelrc @@ -15,9 +15,6 @@ "targets": { "node": "10.13.0" } - // "modules": false - //将 ES6 module 转换为其他模块规范,可选 "adm" | "umd" | "systemjs" | "commonjs" | "cjs" | false,默认为 false - // 否则 Babel 会在 Rollup 有机会做处理之前,将我们的模块转成 CommonJS ,导致 Rollup 的一些处理失败。 } ] ], @@ -30,7 +27,4 @@ } ] ] - // 导入js模块:["import", { "libraryName": "antd" }] - // 导入js和css模块(LESS/Sass源文件):["import", { "libraryName": "antd", "style": true }] - //    导入js和css模块(css 内置文件):["import", { "libraryName": "antd", "style": "css" }] } diff --git a/.eslintrc b/.eslintrc index 23b421f..fc8dbf2 100644 --- a/.eslintrc +++ b/.eslintrc @@ -13,7 +13,6 @@ "plugin:react/recommended", "plugin:import/typescript", "plugin:@typescript-eslint/recommended", - "prettier", "plugin:prettier/recommended" ], "parser": "@typescript-eslint/parser", @@ -32,9 +31,7 @@ "polyfills": ["Promise"] }, "rules": { - "prettier/prettier": "error", - "arrow-body-style": "off", - "prefer-arrow-callback": "off", + "react/jsx-props-no-spreading": 0, "no-use-before-define": "off", "react/display-name": 0, "import/extensions": 0, diff --git a/package.json b/package.json index 4cbf7c4..a013963 100644 --- a/package.json +++ b/package.json @@ -114,7 +114,6 @@ "@ant-design/icons": "^4.3.0", "antd": "^4.14.1", "axios": "^0.20.0", - "ccms": "workspace:*", "lodash": "^4.17.21", "marked": "^1.2.5", "moment": "^2.29.0", -- Gitee From d8e5581731af7249e0e3a81ebcb772d8ee1747e6 Mon Sep 17 00:00:00 2001 From: zjt Date: Wed, 20 Apr 2022 19:01:49 +0800 Subject: [PATCH 24/26] =?UTF-8?q?style:=20=E6=A0=BC=E5=BC=8F=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .eslintrc | 34 ++++++++++-- src/components/detail/importSubform/index.tsx | 45 ++++++---------- src/components/formFields/form/display.tsx | 52 +++++++----------- src/components/formFields/group/display.tsx | 46 ++++++---------- .../formFields/importSubform/display.tsx | 53 ++++++------------- src/components/formFields/tabs/display.tsx | 45 ++++++---------- 6 files changed, 110 insertions(+), 165 deletions(-) diff --git a/.eslintrc b/.eslintrc index fc8dbf2..f574bbc 100644 --- a/.eslintrc +++ b/.eslintrc @@ -23,24 +23,48 @@ "ecmaVersion": 12, "sourceType": "module" }, - "plugins": ["react", "babel", "jest", "react-hooks", "@typescript-eslint"], + "plugins": [ + "react", + "babel", + "jest", + "react-hooks", + "@typescript-eslint" + ], "settings": { "react": { "version": "16.13.1" }, - "polyfills": ["Promise"] + "polyfills": [ + "Promise" + ] }, "rules": { + "import/no-unresolved": 1, + "import/no-cycle": 1, + "import/no-extraneous-dependencies": 1, + "@typescript-eslint/no-empty-function": 1, + "typescript-eslint/no-explicit-any": 0, "react/jsx-props-no-spreading": 0, "no-use-before-define": "off", "react/display-name": 0, "import/extensions": 0, - "comma-dangle": ["error", "never"], - "space-before-function-paren": [0, "always"], + "comma-dangle": [ + "error", + "never" + ], + "space-before-function-paren": [ + 0, + "always" + ], "react/jsx-filename-extension": [ 2, { - "extensions": [".js", ".jsx", ".ts", ".tsx"] + "extensions": [ + ".js", + ".jsx", + ".ts", + ".tsx" + ] } ] } diff --git a/src/components/detail/importSubform/index.tsx b/src/components/detail/importSubform/index.tsx index af2de8c..6f7933f 100644 --- a/src/components/detail/importSubform/index.tsx +++ b/src/components/detail/importSubform/index.tsx @@ -1,13 +1,13 @@ -import React from "react"; -import { DetailImportSubformField } from "ccms"; -import { IImportSubformField } from "ccms/dist/src/components/detail/importSubform"; -import { Display } from "ccms/dist/src/components/formFields/common"; -import { IDetailItem } from "ccms/dist/src/steps/detail"; +import React from 'react' +import { DetailImportSubformField } from 'ccms' +import { IImportSubformField } from 'ccms/dist/src/components/detail/importSubform' +import { Display } from 'ccms/dist/src/components/formFields/common' +import { IDetailItem } from 'ccms/dist/src/steps/detail' +import { Form } from 'antd' import { display as getALLComponents } from '../../formFields' -import InterfaceHelper from "../../../util/interface"; -import { Form } from "antd"; +import InterfaceHelper from '../../../util/interface' import styles from './index.less' -import { formItemLayout, computedItemStyle, computedGapStyle } from "../../formFields/common"; +import { formItemLayout, computedItemStyle, computedGapStyle } from '../../formFields/common' export default class ImportSubformField extends DetailImportSubformField { getALLComponents = (type: any): typeof Display => getALLComponents[type] @@ -15,17 +15,15 @@ export default class ImportSubformField extends DetailImportSubformField { interfaceHelper = new InterfaceHelper() renderComponent = (props: IImportSubformField) => { - const { - columns, - children - } = props + const { columns, children } = props const gap = computedGapStyle(columns, 'row') return (
+ className={styles['ccms-antd-mini-form-group-row']} + > {children}
) @@ -37,16 +35,8 @@ export default class ImportSubformField extends DetailImportSubformField { * @param props */ renderItemComponent = (props: IDetailItem) => { - const { - key, - label, - columns, - layout, - visitable, - fieldType, - children - } = props - const colStyle = computedItemStyle(columns, layout) + const { key, label, columns, layout, visitable, fieldType, children } = props + const colStyle = computedItemStyle(columns, layout, visitable) const itemStyle = visitable ? {} : { overflow: 'hidden', width: 0, height: 0, margin: 0, padding: 0 } if (columns?.type === 'width' && columns?.value && columns.wrap) { Object.assign(itemStyle, { width: columns.value }) @@ -56,12 +46,7 @@ export default class ImportSubformField extends DetailImportSubformField {
) } -} \ No newline at end of file +} diff --git a/src/components/formFields/form/display.tsx b/src/components/formFields/form/display.tsx index 567fe0c..188ee54 100644 --- a/src/components/formFields/form/display.tsx +++ b/src/components/formFields/form/display.tsx @@ -2,7 +2,7 @@ import React from 'react' import { FormDisplay } from 'ccms' import { Form, Collapse, Space } from 'antd' import { IFormField, IFormFieldItem, IFormFieldItemField } from 'ccms/dist/src/components/formFields/form/display' -import {display as getALLComponents} from '../' +import { display as getALLComponents } from '..' import { formItemLayout } from '../common' export default class FormDisplayComponent extends FormDisplay { @@ -11,12 +11,7 @@ export default class FormDisplayComponent extends FormDisplay { remove: () => Promise = async () => {} renderItemFieldComponent = (props: IFormFieldItemField) => { - const { - label, - layout, - fieldType, - children - } = props + const { label, fieldType, children } = props return ( { - const { - title, - index, - canCollapse, - children - } = props + const { title, index, canCollapse, children } = props return ( {title}
} key={index} - forceRender={true} + forceRender showArrow={!!canCollapse} > {children} - + ) } renderComponent = (props: IFormField) => { - const { - canCollapse, - children - } = props + const { canCollapse, children } = props - const collapsePaneldDefaultActiveKeys = Array.from(Array(children.length), (v,k) =>k) - const CollapseProps = canCollapse? { - accordion: true - }: { - activeKey: collapsePaneldDefaultActiveKeys - } + const collapsePaneldDefaultActiveKeys = Array.from(Array(children.length), (v, k) => k) + const CollapseProps = canCollapse + ? { + accordion: true + } + : { + activeKey: collapsePaneldDefaultActiveKeys + } return ( - - - {children} - - + + + {children} + + ) } } diff --git a/src/components/formFields/group/display.tsx b/src/components/formFields/group/display.tsx index cf7946b..33bd3c2 100644 --- a/src/components/formFields/group/display.tsx +++ b/src/components/formFields/group/display.tsx @@ -1,23 +1,19 @@ -import React from "react"; -import { GroupDisplay } from 'ccms'; -import { IGroupField, GroupFieldConfig } from "ccms/dist/src/components/formFields/group"; -import { IFormItem } from "ccms/dist/src/steps/form"; -import { Form } from "antd" -import {display as getALLComponents} from '../' +import React from 'react' +import { GroupDisplay } from 'ccms' +import { IGroupField, GroupFieldConfig } from 'ccms/dist/src/components/formFields/group' +import { IFormItem } from 'ccms/dist/src/steps/form' +import { Form } from 'antd' +import { display as getALLComponents } from '..' import styles from './index.less' -import { formItemLayout, computedItemStyle, computedGapStyle } from "../common"; +import { formItemLayout, computedItemStyle, computedGapStyle } from '../common' - -export const PropsType = (props: GroupFieldConfig) => { }; +export const PropsType = (props: GroupFieldConfig) => {} export default class GroupDisplayComponent extends GroupDisplay { getALLComponents = (type: any) => getALLComponents[type] renderComponent = (props: IGroupField) => { - const { - columns, - children - } = props + const { columns, children } = props const gap = computedGapStyle(columns, 'row') return ( @@ -25,24 +21,17 @@ export default class GroupDisplayComponent extends GroupDisplay { style={{ ...gap }} - className={styles['ccms-antd-mini-form-group-row']}> + className={styles['ccms-antd-mini-form-group-row']} + > {children}
) } renderItemComponent = (props: IFormItem) => { - const { - key, - columns, - layout, - label, - visitable, - fieldType, - children - } = props + const { key, columns, layout, label, visitable, fieldType, children } = props - const colStyle = computedItemStyle(columns, layout) + const colStyle = computedItemStyle(columns, layout, visitable) const itemStyle = visitable ? {} : { overflow: 'hidden', width: 0, height: 0, margin: 0, padding: 0 } if (columns?.type === 'width' && columns?.value && columns.wrap) { Object.assign(itemStyle, { width: columns.value }) @@ -52,12 +41,7 @@ export default class GroupDisplayComponent extends GroupDisplay {
) } -} \ No newline at end of file +} diff --git a/src/components/formFields/importSubform/display.tsx b/src/components/formFields/importSubform/display.tsx index b9306ca..eeee564 100644 --- a/src/components/formFields/importSubform/display.tsx +++ b/src/components/formFields/importSubform/display.tsx @@ -1,14 +1,13 @@ - -import React from "react"; -import { ImportSubformDisplay } from "ccms"; -import { IImportSubformField } from "ccms/dist/src/components/detail/importSubform"; -import { Display } from "ccms/dist/src/components/formFields/common"; -import { IDetailItem } from "ccms/dist/src/steps/detail"; -import { display as getALLComponents } from '../' -import InterfaceHelper from "../../../util/interface"; -import { Form } from "antd"; +import React from 'react' +import { ImportSubformDisplay } from 'ccms' +import { IImportSubformField } from 'ccms/dist/src/components/detail/importSubform' +import { Display } from 'ccms/dist/src/components/formFields/common' +import { IDetailItem } from 'ccms/dist/src/steps/detail' +import { Form } from 'antd' +import { display as getALLComponents } from '..' +import InterfaceHelper from '../../../util/interface' import styles from './index.less' -import { computedItemStyle, computedGapStyle } from "../common"; +import { computedItemStyle, computedGapStyle } from '../common' export default class ImportSubformDisplayComponent extends ImportSubformDisplay { getALLComponents = (type: any): typeof Display => getALLComponents[type] @@ -16,10 +15,7 @@ export default class ImportSubformDisplayComponent extends ImportSubformDisplay interfaceHelper = new InterfaceHelper() renderComponent = (props: IImportSubformField) => { - const { - columns, - children - } = props + const { columns, children } = props const gap = computedGapStyle(columns, 'row') return ( @@ -27,7 +23,8 @@ export default class ImportSubformDisplayComponent extends ImportSubformDisplay style={{ ...gap }} - className={styles['ccms-antd-mini-form-group-row']}> + className={styles['ccms-antd-mini-form-group-row']} + > {children}
) @@ -39,17 +36,9 @@ export default class ImportSubformDisplayComponent extends ImportSubformDisplay * @param props */ renderItemComponent = (props: IDetailItem) => { - const { - key, - label, - columns, - layout, - visitable, - fieldType, - children - } = props + const { key, label, columns, layout, visitable, fieldType, children } = props - const colStyle = computedItemStyle(columns, layout) + const colStyle = computedItemStyle(columns, layout, visitable) const itemStyle = visitable ? {} : { overflow: 'hidden', width: 0, height: 0, margin: 0, padding: 0 } if (columns?.type === 'width' && columns?.value && columns.wrap) { Object.assign(itemStyle, { width: columns.value }) @@ -59,19 +48,9 @@ export default class ImportSubformDisplayComponent extends ImportSubformDisplay
- + {children}
diff --git a/src/components/formFields/tabs/display.tsx b/src/components/formFields/tabs/display.tsx index 6bd7ecc..485e92d 100644 --- a/src/components/formFields/tabs/display.tsx +++ b/src/components/formFields/tabs/display.tsx @@ -2,22 +2,17 @@ import React from 'react' import { TabsDisplay } from 'ccms' import { Form, Tabs } from 'antd' import { ITabsField, ITabsFieldItem, ITabsFieldItemField } from 'ccms/dist/src/components/formFields/tabs/display' -import {display as getALLComponents} from '../' import { Display } from 'ccms/dist/src/components/formFields/common' -import { formItemLayout } from '../common' -export default class TabsDisplayComponent extends TabsDisplay<{}> { - // 各表单项对应的类型所使用的UI组件的类 - getALLComponents = (type: any): typeof Display => getALLComponents[type] - - renderItemFieldComponent = (props: ITabsFieldItemField) => { - const { - label, - fieldType, - layout, - children - } = props - - return ( +import { display as getALLComponents } from '..' + +export default class TabsDisplayComponent extends TabsDisplay> { + // 各表单项对应的类型所使用的UI组件的类 + getALLComponents = (type: any): typeof Display => getALLComponents[type] + + renderItemFieldComponent = (props: ITabsFieldItemField) => { + const { label, children } = props + + return ( { } renderItemComponent = (props: ITabsFieldItem) => { - const { - key, - label, - children - } = props + const { key, label, children } = props return ( - + {children} ) } renderComponent = (props: ITabsField) => { - const { - children - } = props + const { children } = props return ( - - - {children} - - + + {children} + ) } } -- Gitee From 586bb56934955b98ae60269e8798ec5ebcb61f78 Mon Sep 17 00:00:00 2001 From: zjt Date: Fri, 22 Apr 2022 14:55:22 +0800 Subject: [PATCH 25/26] fix: use styles.classname --- src/components/detail/group/index.less | 2 +- src/components/detail/group/index.tsx | 47 ++++++++++---------------- 2 files changed, 19 insertions(+), 30 deletions(-) diff --git a/src/components/detail/group/index.less b/src/components/detail/group/index.less index c675b31..f374c15 100644 --- a/src/components/detail/group/index.less +++ b/src/components/detail/group/index.less @@ -34,7 +34,7 @@ } } - &> :global(.detail-group-children) { + &>.detail-group-children { display: flex; word-break: break-all; } diff --git a/src/components/detail/group/index.tsx b/src/components/detail/group/index.tsx index edd93fb..f15ba41 100644 --- a/src/components/detail/group/index.tsx +++ b/src/components/detail/group/index.tsx @@ -1,56 +1,45 @@ -import React from "react"; -import { DetailGroupField } from 'ccms'; -import { IGroupField, GroupFieldConfig } from "ccms/dist/src/components/detail/group"; -import { IDetailItem } from "ccms/dist/src/steps/detail"; -import { Col, Row } from "antd" -import getALLComponents from '../' +import React from 'react' +import { DetailGroupField } from 'ccms' +import { IGroupField, GroupFieldConfig } from 'ccms/dist/src/components/detail/group' +import { IDetailItem } from 'ccms/dist/src/steps/detail' +import { Col, Row } from 'antd' +import getALLComponents from '..' import styles from './index.less' -import { computedItemStyle, computedGapStyle } from "../common"; +import { computedItemStyle, computedGapStyle } from '../common' -export const PropsType = (props: GroupFieldConfig) => { }; +export const PropsType = (props: GroupFieldConfig) => {} export default class GroupFieldComponent extends DetailGroupField { getALLComponents = (type: any) => getALLComponents[type] renderComponent = (props: IGroupField) => { - const { - children, - columns - } = props + const { children, columns } = props const gap = computedGapStyle(columns, 'row') return (
+ className={styles['ccms-antd-mini-detail-group-row']} + > {children}
) } renderItemComponent = (props: IDetailItem) => { - const { - layout, - label, - styles: itemstyle, - columns, - fieldType, - children - } = props + const { layout, label, styles: itemstyle, columns, fieldType, children } = props const colStyle = computedItemStyle(columns, layout) - + return ( -
+
-
{label}
-
{children}
+
+ {children} +
) } -} \ No newline at end of file +} -- Gitee From dd7568c8a92e8f9e0a5e2b7c37a374421c79907a Mon Sep 17 00:00:00 2001 From: zjt Date: Sun, 24 Apr 2022 15:34:33 +0800 Subject: [PATCH 26/26] =?UTF-8?q?style:=20=E6=A0=BC=E5=BC=8F=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- rollup.config.js | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/rollup.config.js b/rollup.config.js index 06176c0..ce15ed7 100644 --- a/rollup.config.js +++ b/rollup.config.js @@ -1,13 +1,13 @@ -import path from 'path'; -import ts from 'rollup-plugin-typescript2'; -import { nodeResolve } from '@rollup/plugin-node-resolve'; +import path from 'path' +import ts from 'rollup-plugin-typescript2' +import { nodeResolve } from '@rollup/plugin-node-resolve' -import { babel } from '@rollup/plugin-babel'; -import commonjs from '@rollup/plugin-commonjs'; -import { eslint } from 'rollup-plugin-eslint'; -import json from '@rollup/plugin-json'; -import postcss from 'rollup-plugin-postcss'; -import { terser } from 'rollup-plugin-terser'; +import { babel } from '@rollup/plugin-babel' +import commonjs from '@rollup/plugin-commonjs' +import { eslint } from 'rollup-plugin-eslint' +import json from '@rollup/plugin-json' +import postcss from 'rollup-plugin-postcss' +import { terser } from 'rollup-plugin-terser' export default { input: 'src/index.tsx', @@ -17,11 +17,11 @@ export default { file: path.resolve('dist/index.js') } ], - onwarn (warning) { + onwarn(warning) { if (warning.code === 'THIS_IS_UNDEFINED') { - return; + return } - console.error(warning.message); + console.error(warning.message) }, plugins: [ // eslint({ @@ -51,4 +51,4 @@ export default { watch: { include: 'src/**' } -}; +} -- Gitee