tntd 2.8.0-beta.9 → 2.8.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/es/array-input/index.js +57 -42
- package/es/array-input/index.js.map +1 -1
- package/es/array-input/index.less +4 -1
- package/es/button/button.js +3 -7
- package/es/button/button.js.map +1 -1
- package/es/button/button.less +7 -0
- package/es/button/index.js +1 -0
- package/es/button/index.js.map +1 -1
- package/es/collapse/collapse.less +3 -3
- package/es/descriptions/descriptions.js +85 -24
- package/es/descriptions/descriptions.js.map +1 -1
- package/es/descriptions/descriptions.less +63 -62
- package/es/descriptions/style/index.less +1 -0
- package/es/drawer/drawer.js +31 -21
- package/es/drawer/drawer.js.map +1 -1
- package/es/drawer/index.less +11 -12
- package/es/form/form.js +8 -3
- package/es/form/form.js.map +1 -1
- package/es/form/form.less +42 -0
- package/es/form/style/index.less +6 -6
- package/es/handle/index.js +2 -1
- package/es/handle/index.js.map +1 -1
- package/es/handle-icon/index.js +202 -0
- package/es/handle-icon/index.js.map +1 -0
- package/es/handle-icon/index.less +53 -0
- package/es/icon/style/style.less +1 -1
- package/es/index.js +1 -0
- package/es/index.js.map +1 -1
- package/es/input/input.js +10 -6
- package/es/input/input.js.map +1 -1
- package/es/input/style/mixin.less +1 -1
- package/es/locale/en_US.js +3 -0
- package/es/locale/en_US.js.map +1 -1
- package/es/locale/zh_CN.js +3 -0
- package/es/locale/zh_CN.js.map +1 -1
- package/es/mentions/style/index.less +1 -0
- package/es/modal/style/confirm.less +6 -10
- package/es/modal/style/modal.less +4 -2
- package/es/notification/assets/index.js +2 -0
- package/es/notification/assets/index.js.map +1 -0
- package/es/notification/assets/svg-error-tip.js +145 -0
- package/es/notification/assets/svg-error-tip.js.map +1 -0
- package/es/notification/assets/svg-success-tip.js +162 -0
- package/es/notification/assets/svg-success-tip.js.map +1 -0
- package/es/notification/index.js +1 -1
- package/es/notification/index.js.map +1 -1
- package/es/notification/notification.js +80 -0
- package/es/notification/notification.js.map +1 -0
- package/es/notification/notification.less +34 -0
- package/es/notification/style/index.less +1 -0
- package/es/page-container/index.js +1 -1
- package/es/page-container/index.js.map +1 -1
- package/es/page-loading/index.js +1 -1
- package/es/page-loading/index.js.map +1 -1
- package/es/select/select.js +5 -3
- package/es/select/select.js.map +1 -1
- package/es/select/style/index.less +7 -6
- package/es/spin/index.js.map +1 -1
- package/es/spin/spin.js +36 -0
- package/es/spin/spin.js.map +1 -0
- package/es/spin/spin.less +9 -0
- package/es/style/themes/default.less +1 -1
- package/es/table/expand.less +49 -0
- package/es/table/hooks/index.js +2 -1
- package/es/table/hooks/index.js.map +1 -1
- package/es/table/hooks/use-expand-fixed.js +80 -0
- package/es/table/hooks/use-expand-fixed.js.map +1 -0
- package/es/table/index.js +1 -0
- package/es/table/index.js.map +1 -1
- package/es/table/style/index.less +77 -39
- package/es/table/style/size.less +1 -0
- package/es/table/table.js +43 -8
- package/es/table/table.js.map +1 -1
- package/es/table/table.less +5 -5
- package/es/table/table.stories.js +413 -2
- package/es/table/table.stories.js.map +1 -1
- package/es/table/utils.js +11 -0
- package/es/table/utils.js.map +1 -1
- package/es/table-container/index.js +1 -1
- package/es/table-container/index.js.map +1 -1
- package/es/table-container/index.less +10 -10
- package/es/tabs-container/index.js +1 -1
- package/es/tabs-container/index.js.map +1 -1
- package/es/tag/color.less +53 -0
- package/es/tag/index.js +11 -2
- package/es/tag/index.js.map +1 -1
- package/es/tag/tag.js +171 -0
- package/es/tag/tag.js.map +1 -0
- package/es/tag/tag.less +228 -0
- package/es/title/index.js +4 -3
- package/es/title/index.js.map +1 -1
- package/es/tntd-cascader/AntdCascader/component/defaultRenderEmpty.js +5 -11
- package/es/tntd-cascader/AntdCascader/component/defaultRenderEmpty.js.map +1 -1
- package/es/tntd-cascader/AntdCascader/index.less +12 -2
- package/es/tntd-cascader/rc-cascader/OptionList/Column.js +3 -2
- package/es/tntd-cascader/rc-cascader/OptionList/Column.js.map +1 -1
- package/es/tntd-cascader/rc-cascader/OptionList/index.js +1 -0
- package/es/tntd-cascader/rc-cascader/OptionList/index.js.map +1 -1
- package/es/tntd-form/FormItem/ItemHolder.js +1 -6
- package/es/tntd-form/FormItem/ItemHolder.js.map +1 -1
- package/es/tntd-form/FormItemLabel.js +2 -0
- package/es/tntd-form/FormItemLabel.js.map +1 -1
- package/es/tntd-select/index.js +9 -4
- package/es/tntd-select/index.js.map +1 -1
- package/es/tooltip/index.js +3 -2
- package/es/tooltip/index.js.map +1 -1
- package/es/tooltip/index.less +29 -0
- package/es/tooltip/tooltip.js +33 -0
- package/es/tooltip/tooltip.js.map +1 -0
- package/lib/array-input/index.d.ts +1 -12
- package/lib/array-input/index.d.ts.map +1 -1
- package/lib/array-input/index.js +62 -55
- package/lib/array-input/index.js.map +1 -1
- package/lib/array-input/index.less +4 -1
- package/lib/button/button.d.ts.map +1 -1
- package/lib/button/button.js +2 -14
- package/lib/button/button.js.map +1 -1
- package/lib/button/button.less +7 -0
- package/lib/button/index.d.ts +1 -0
- package/lib/button/index.d.ts.map +1 -1
- package/lib/button/index.js +6 -5
- package/lib/button/index.js.map +1 -1
- package/lib/collapse/collapse.less +3 -3
- package/lib/descriptions/descriptions.d.ts +11 -6
- package/lib/descriptions/descriptions.d.ts.map +1 -1
- package/lib/descriptions/descriptions.js +92 -30
- package/lib/descriptions/descriptions.js.map +1 -1
- package/lib/descriptions/descriptions.less +63 -62
- package/lib/descriptions/style/index.less +1 -0
- package/lib/drawer/drawer.d.ts +3 -0
- package/lib/drawer/drawer.d.ts.map +1 -1
- package/lib/drawer/drawer.js +29 -19
- package/lib/drawer/drawer.js.map +1 -1
- package/lib/drawer/index.less +11 -12
- package/lib/form/form.d.ts +1 -0
- package/lib/form/form.d.ts.map +1 -1
- package/lib/form/form.js +9 -3
- package/lib/form/form.js.map +1 -1
- package/lib/form/form.less +42 -0
- package/lib/form/style/index.less +6 -6
- package/lib/handle/index.d.ts.map +1 -1
- package/lib/handle/index.js +2 -1
- package/lib/handle/index.js.map +1 -1
- package/lib/handle-icon/index.d.ts +7 -0
- package/lib/handle-icon/index.d.ts.map +1 -0
- package/lib/handle-icon/index.js +222 -0
- package/lib/handle-icon/index.js.map +1 -0
- package/lib/handle-icon/index.less +53 -0
- package/lib/icon/style/style.less +1 -1
- package/lib/index.d.ts +1 -0
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +7 -0
- package/lib/index.js.map +1 -1
- package/lib/input/input.js +8 -4
- package/lib/input/input.js.map +1 -1
- package/lib/input/style/mixin.less +1 -1
- package/lib/locale/default.d.ts +3 -0
- package/lib/locale/default.d.ts.map +1 -1
- package/lib/locale/en_US.d.ts +3 -0
- package/lib/locale/en_US.d.ts.map +1 -1
- package/lib/locale/en_US.js +3 -0
- package/lib/locale/en_US.js.map +1 -1
- package/lib/locale/zh_CN.d.ts +3 -0
- package/lib/locale/zh_CN.d.ts.map +1 -1
- package/lib/locale/zh_CN.js +3 -0
- package/lib/locale/zh_CN.js.map +1 -1
- package/lib/mentions/style/index.less +1 -0
- package/lib/modal/style/confirm.less +6 -10
- package/lib/modal/style/modal.less +4 -2
- package/lib/notification/assets/index.d.ts +3 -0
- package/lib/notification/assets/index.d.ts.map +1 -0
- package/lib/notification/assets/index.js +20 -0
- package/lib/notification/assets/index.js.map +1 -0
- package/lib/notification/assets/svg-error-tip.d.ts +4 -0
- package/lib/notification/assets/svg-error-tip.d.ts.map +1 -0
- package/lib/notification/assets/svg-error-tip.js +154 -0
- package/lib/notification/assets/svg-error-tip.js.map +1 -0
- package/lib/notification/assets/svg-success-tip.d.ts +4 -0
- package/lib/notification/assets/svg-success-tip.d.ts.map +1 -0
- package/lib/notification/assets/svg-success-tip.js +171 -0
- package/lib/notification/assets/svg-success-tip.js.map +1 -0
- package/lib/notification/index.d.ts +1 -1
- package/lib/notification/index.d.ts.map +1 -1
- package/lib/notification/index.js +7 -8
- package/lib/notification/index.js.map +1 -1
- package/lib/notification/notification.d.ts +9 -0
- package/lib/notification/notification.d.ts.map +1 -0
- package/lib/notification/notification.js +105 -0
- package/lib/notification/notification.js.map +1 -0
- package/lib/notification/notification.less +34 -0
- package/lib/notification/style/index.less +1 -0
- package/lib/page-container/index.js +1 -1
- package/lib/page-container/index.js.map +1 -1
- package/lib/page-loading/index.js +1 -1
- package/lib/page-loading/index.js.map +1 -1
- package/lib/segmented/index.d.ts +1 -1
- package/lib/select/select.d.ts.map +1 -1
- package/lib/select/select.js +4 -2
- package/lib/select/select.js.map +1 -1
- package/lib/select/style/index.less +7 -6
- package/lib/spin/index.d.ts.map +1 -1
- package/lib/spin/index.js.map +1 -1
- package/lib/spin/spin.d.ts +9 -0
- package/lib/spin/spin.d.ts.map +1 -0
- package/lib/spin/spin.js +44 -0
- package/lib/spin/spin.js.map +1 -0
- package/lib/spin/spin.less +9 -0
- package/lib/style/themes/default.less +1 -1
- package/lib/svg-components/illustration-403.d.ts +1 -1
- package/lib/svg-components/illustration-404.d.ts +1 -1
- package/lib/svg-components/illustration-500.d.ts +1 -1
- package/lib/svg-components/illustration-empty.d.ts +1 -1
- package/lib/svg-components/illustration-failure.d.ts +1 -1
- package/lib/svg-components/illustration-no-access.d.ts +1 -1
- package/lib/svg-components/illustration-no-chart.d.ts +1 -1
- package/lib/svg-components/illustration-no-result.d.ts +1 -1
- package/lib/svg-components/illustration-offline.d.ts +1 -1
- package/lib/svg-components/illustration-success.d.ts +1 -1
- package/lib/table/assets/image-loading-background.d.ts +1 -1
- package/lib/table/assets/image-loading.d.ts +1 -1
- package/lib/table/expand.less +49 -0
- package/lib/table/hooks/index.d.ts +1 -0
- package/lib/table/hooks/index.d.ts.map +1 -1
- package/lib/table/hooks/index.js +11 -0
- package/lib/table/hooks/index.js.map +1 -1
- package/lib/table/hooks/use-expand-fixed.d.ts +4 -0
- package/lib/table/hooks/use-expand-fixed.d.ts.map +1 -0
- package/lib/table/hooks/use-expand-fixed.js +110 -0
- package/lib/table/hooks/use-expand-fixed.js.map +1 -0
- package/lib/table/index.d.ts +1 -0
- package/lib/table/index.d.ts.map +1 -1
- package/lib/table/index.js +1 -0
- package/lib/table/index.js.map +1 -1
- package/lib/table/style/index.less +77 -39
- package/lib/table/style/size.less +1 -0
- package/lib/table/table.d.ts +3 -1
- package/lib/table/table.d.ts.map +1 -1
- package/lib/table/table.js +43 -4
- package/lib/table/table.js.map +1 -1
- package/lib/table/table.less +5 -5
- package/lib/table/table.stories.d.ts +106 -29
- package/lib/table/table.stories.d.ts.map +1 -1
- package/lib/table/table.stories.js +426 -3
- package/lib/table/table.stories.js.map +1 -1
- package/lib/table/utils.d.ts +1 -0
- package/lib/table/utils.d.ts.map +1 -1
- package/lib/table/utils.js +13 -0
- package/lib/table/utils.js.map +1 -1
- package/lib/table-container/index.js +1 -1
- package/lib/table-container/index.js.map +1 -1
- package/lib/table-container/index.less +10 -10
- package/lib/tabs-container/index.js +1 -1
- package/lib/tabs-container/index.js.map +1 -1
- package/lib/tag/color.less +53 -0
- package/lib/tag/index.d.ts +3 -2
- package/lib/tag/index.d.ts.map +1 -1
- package/lib/tag/index.js +15 -9
- package/lib/tag/index.js.map +1 -1
- package/lib/tag/tag.d.ts +41 -0
- package/lib/tag/tag.d.ts.map +1 -0
- package/lib/tag/tag.js +183 -0
- package/lib/tag/tag.js.map +1 -0
- package/lib/tag/tag.less +228 -0
- package/lib/title/index.d.ts +1 -0
- package/lib/title/index.d.ts.map +1 -1
- package/lib/title/index.js +3 -2
- package/lib/title/index.js.map +1 -1
- package/lib/tntd-cascader/AntdCascader/component/defaultRenderEmpty.d.ts.map +1 -1
- package/lib/tntd-cascader/AntdCascader/component/defaultRenderEmpty.js +5 -11
- package/lib/tntd-cascader/AntdCascader/component/defaultRenderEmpty.js.map +1 -1
- package/lib/tntd-cascader/AntdCascader/config/utils.d.ts +1 -1
- package/lib/tntd-cascader/AntdCascader/index.less +12 -2
- package/lib/tntd-cascader/rc-cascader/OptionList/Column.d.ts +1 -1
- package/lib/tntd-cascader/rc-cascader/OptionList/Column.d.ts.map +1 -1
- package/lib/tntd-cascader/rc-cascader/OptionList/Column.js +3 -2
- package/lib/tntd-cascader/rc-cascader/OptionList/Column.js.map +1 -1
- package/lib/tntd-cascader/rc-cascader/OptionList/index.d.ts.map +1 -1
- package/lib/tntd-cascader/rc-cascader/OptionList/index.js +1 -0
- package/lib/tntd-cascader/rc-cascader/OptionList/index.js.map +1 -1
- package/lib/tntd-form/FormItem/ItemHolder.js +1 -6
- package/lib/tntd-form/FormItem/ItemHolder.js.map +1 -1
- package/lib/tntd-form/FormItemLabel.d.ts.map +1 -1
- package/lib/tntd-form/FormItemLabel.js +2 -0
- package/lib/tntd-form/FormItemLabel.js.map +1 -1
- package/lib/tntd-rc-select/_util/PurePanel.d.ts +1 -1
- package/lib/tntd-select/index.d.ts.map +1 -1
- package/lib/tntd-select/index.js +8 -3
- package/lib/tntd-select/index.js.map +1 -1
- package/lib/tooltip/index.d.ts +3 -2
- package/lib/tooltip/index.d.ts.map +1 -1
- package/lib/tooltip/index.js +3 -2
- package/lib/tooltip/index.js.map +1 -1
- package/lib/tooltip/index.less +29 -0
- package/lib/tooltip/tooltip.d.ts +9 -0
- package/lib/tooltip/tooltip.d.ts.map +1 -0
- package/lib/tooltip/tooltip.js +53 -0
- package/lib/tooltip/tooltip.js.map +1 -0
- package/package.json +4 -3
- package/themes/default/variables.less +2 -2
- package/themes/default/variablesVar.less +2 -2
- package/es/array-input/icon.js +0 -25
- package/es/array-input/icon.js.map +0 -1
- package/es/drawer/drawer.less +0 -20
- package/lib/array-input/icon.d.ts +0 -4
- package/lib/array-input/icon.d.ts.map +0 -1
- package/lib/array-input/icon.js +0 -32
- package/lib/array-input/icon.js.map +0 -1
- package/lib/drawer/drawer.less +0 -20
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"descriptions.js","sourceRoot":"","sources":["../../src/descriptions/descriptions.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;GAOG;AACH,+CAAy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,8BAAC,kBAAQ,IACP,SAAS,EAAC,uBAAuB,EACjC,MAAM,EAAE,uCAAK,SAAS,EAAC,8BAA8B,IAAE,KAAK,CAAO,EACnE,KAAK,EAAE,KAAK,GACZ,CACE,CACP,CAAA;iBACF;YACH,CAAC,CAAC;YACJ,CAAC,CAAC,QAAQ,CACK,CACpB,CAAA;IACH,CAAC,CACc,CAClB,CAAA;AACH,CAAC,CAA0B,CAAA;AAE3B,oBAAY,CAAC,IAAI,GAAG,sBAAgB,CAAC,IAAI,CAAA","sourcesContent":["/*\n * @Author: 周泽飞 zefei.zhou@tongdun.net\n * @Date: 2023-05-05 15:48:09\n * @LastEditors: 周泽飞 zefei.zhou@tongdun.net\n * @LastEditTime: 2024-01-18 15:27:45\n * @FilePath: /tntd/packages/tntd/src/descriptions/descriptions.tsx\n * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE\n */\nimport React, { forwardRef } from 'react'\nimport LocaleReceiver from 'antd/lib/locale-provider/LocaleReceiver'\nimport type { DescriptionsProps as AntdDescriptionsProps } from 'antd/lib/descriptions'\nimport type { DescriptionsItemProps as AntdDescriptionsItemProps } from 'antd/lib/descriptions'\nimport classNames from 'classnames'\nimport { ConfigConsumer } from 'antd/lib/config-provider'\nimport { default as AntdDescriptions } from 'antd/lib/descriptions'\n\nimport Ellipsis from '../ellipsis'\n\nexport * from 'antd/lib/descriptions'\n\nexport interface DescriptionsProps extends AntdDescriptionsProps {\n tdType: boolean\n ellipsis: boolean\n theme: string\n}\n\nexport interface DescriptionsItemProps extends AntdDescriptionsItemProps {\n tdType: boolean\n theme: string\n}\n\ninterface DescriptionsComponent\n extends React.ForwardRefExoticComponent<\n DescriptionsProps & React.RefAttributes<AntdDescriptions>\n > {\n Item: typeof AntdDescriptions.Item\n}\n\nexport const Descriptions = forwardRef<\n AntdDescriptions,\n DescriptionsProps & { capitalize?: boolean }\n>(({ className, tdType, theme, colon, children, ...rest }, ref) => {\n return (\n <ConfigConsumer>\n {() => {\n const { layout, ellipsis, bordered } = rest || {}\n // 非垂直 且 同盾\n const tdDescriptions = layout !== 'vertical' && tdType\n return (\n <AntdDescriptions\n className={classNames(\n `theme-${theme || (bordered ? 'line' : 'block')}`,\n {\n 'tntd-descriptions-no-border': !bordered,\n },\n {\n 'tntd-descriptions': tdDescriptions,\n },\n {\n 'tntd-descriptions-ellipsis': ellipsis,\n },\n className\n )}\n {...rest}\n colon={tdDescriptions && !bordered ? false : colon}\n >\n {/* 非边框的同盾内置样式 */}\n {tdDescriptions && !bordered\n ? React.Children.map(children, (child) => {\n if (React.isValidElement(child)) {\n const childProps = (child.props || {}) as any\n const { label, children } = childProps\n return (\n <div>\n <Ellipsis\n className=\"tntd-description-item\"\n prefix={<div className=\"tntd-description-label-title\">{label}</div>}\n title={child}\n />\n </div>\n )\n }\n })\n : children}\n </AntdDescriptions>\n )\n }}\n </ConfigConsumer>\n )\n}) as DescriptionsComponent\n\nDescriptions.Item = AntdDescriptions.Item\n"]}
|
|
1
|
+
{"version":3,"file":"descriptions.js","sourceRoot":"","sources":["../../src/descriptions/descriptions.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;GAOG;AACH,+CAAyC;AAGzC,4DAAmC;AACnC,0EAAiD;AACjD,6DAAwD;AACxD,wEAAkE;AAElE,2DAAkC;AAClC,oCAAuC;AACvC,gDAA4C;AAE5C,uDAAoC;AAyBvB,QAAA,YAAY,GAAG,IAAA,kBAAU,EAIpC,CACE,EAWC,EACD,GAAG,EACH,EAAE;QAbF,EACE,SAAS,EACT,MAAM,GAAG,IAAI,EACb,WAAW,GAAG,IAAI,EAClB,SAAS,EACT,KAAK,EACL,QAAQ,EACR,SAAS,GAAG,KAAK,EACjB,eAAe,GAAG,EAAE,EACpB,KAAK,OAEN,EADI,IAAI,cAVT,iHAWC,CADQ;IAIT,OA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AAQ,CAAC,GAAG,CAAC,QAAQ,EAAE,CAAC,KAAK,EAAE,EAAE;oBACrC,IAAI,eAAK,CAAC,cAAc,CAAC,KAAK,CAAC,EAAE;wBAC/B,MAAM,UAAU,GAAG,CAAC,KAAK,CAAC,KAAK,IAAI,EAAE,CAAQ,CAAA;wBAC7C,MAAM,EACJ,KAAK,EACL,WAAW,EACX,QAAQ,EAAE,YAAY,EACtB,QAAQ,GAAG,IAAI,GAChB,GAAG,UAAU,CAAA;wBACd,OAAO,eAAK,CAAC,YAAY,CAAC,KAAK,kCAC1B,KAAK,CAAC,KAAK,KACd,KAAK,EAAE,CACL,8BAAC,kBAAQ,IACP,MAAM,EACJ,WAAW,CAAC,CAAC,CAAC,CACZ,wCAAM,SAAS,EAAC,4BAA4B,IAAE,WAAW,CAAQ,CAClE,CAAC,CAAC,CAAC,IAAI,EAEV,KAAK,EAAE,YAAY,EACnB,KAAK,EAAE,KAAK,GACZ,CACH,EACD,QAAQ,EAAE,QAAQ,CAAC,CAAC,CAAC,CACnB,8BAAC,kBAAQ,IAAC,KAAK,EAAE,YAAY,EAAE,KAAK,EAAE,YAAY,GAAI,CACvD,CAAC,CAAC,CAAC,CACF,YAAY,CACb,IACD,CAAA;qBACH;gBACH,CAAC,CAAC;YAEH,CAAC,CAAC,cAAc,IAAI,CAAC,QAAQ,IAAI,CAAC,QAAQ,CAAC,IAAI,WAAW,CAAC,IAAI,QAAQ,CACvD,CACpB,CAAA;IACH,CAAC,CACc,CAClB,CAAA;AACH,CAAC,CACuB,CAAA;AAE1B,oBAAY,CAAC,IAAI,GAAG,sBAAgB,CAAC,IAAI,CAAA","sourcesContent":["/*\n * @Author: 周泽飞 zefei.zhou@tongdun.net\n * @Date: 2024-06-08 11:59:04\n * @LastEditors: 周泽飞 zefei.zhou@tongdun.net\n * @LastEditTime: 2024-07-22 15:03:26\n * @FilePath: /tntd/packages/tntd/src/descriptions/descriptions.tsx\n * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE\n */\nimport React, { forwardRef } from 'react'\nimport type { DescriptionsProps as AntdDescriptionsProps } from 'antd/lib/descriptions'\nimport type { DescriptionsItemProps as AntdDescriptionsItemProps } from 'antd/lib/descriptions'\nimport classNames from 'classnames'\nimport toArray from 'rc-util/es/Children/toArray'\nimport { ConfigConsumer } from 'antd/lib/config-provider'\nimport { default as AntdDescriptions } from 'antd/lib/descriptions'\n\nimport Ellipsis from '../ellipsis'\nimport { doUpperTitle } from '../utils'\nimport { getLanguage } from '../prev-locale'\n\nexport * from 'antd/lib/descriptions'\n\nexport interface DescriptionsProps extends AntdDescriptionsProps {\n tdType?: boolean\n ellipsis?: boolean\n ellipsisLine?: number\n hideTooltip?: boolean\n undoUpper?: boolean\n upperCaseIgnore?: Array<string>\n titleType?: string\n titleWeight?: boolean\n}\n\nexport interface DescriptionsItemProps extends AntdDescriptionsItemProps {\n labelPrefix?: React.ReactNode\n}\n\ndeclare const DescriptionsItem: React.FC<DescriptionsItemProps>\ninterface DescriptionsComponent\n extends React.ForwardRefExoticComponent<\n DescriptionsProps & React.RefAttributes<AntdDescriptions>\n > {\n Item: typeof DescriptionsItem\n}\n\nexport const Descriptions = forwardRef<\n AntdDescriptions,\n DescriptionsProps & { capitalize?: boolean }\n>(\n (\n {\n className,\n tdType = true,\n titleWeight = true,\n titleType,\n colon,\n children,\n undoUpper = false,\n upperCaseIgnore = [],\n title,\n ...rest\n },\n ref\n ) => {\n return (\n <ConfigConsumer>\n {({ getPrefixCls }) => {\n const prefixCls = getPrefixCls('descriptions')\n const { layout, ellipsis, ellipsisLine = 1, hideTooltip = false, bordered } = rest || {}\n // 非垂直 且 同盾\n const tdDescriptions = layout !== 'vertical' && tdType\n\n const tntPrefixCls = 'tnt-descriptions'\n\n const flattenChildren = (children: React.ReactNode): React.ReactNode[] => {\n if (!children) {\n return []\n }\n return toArray(children).reduce(function (\n flatChildren: React.ReactNode[],\n child: React.ReactNode\n ) {\n if (child && (child as any).type === React.Fragment) {\n return flatChildren.concat(flattenChildren((child as any).props.children))\n }\n\n flatChildren.push(child)\n return flatChildren\n },\n [])\n }\n\n children = flattenChildren(children)\n\n return (\n <AntdDescriptions\n className={classNames(\n `${prefixCls}-${getLanguage()}`,\n {\n [tntPrefixCls]: tdDescriptions,\n },\n `${tntPrefixCls}-title-theme${titleType ? '-' + titleType : ''}`,\n {\n [tntPrefixCls + '-title-weight']: titleWeight,\n },\n {\n [tntPrefixCls + '-ellipsis']: ellipsis,\n },\n className\n )}\n title={undoUpper ? title : doUpperTitle(title, upperCaseIgnore)} // 默认转大写\n {...rest}\n colon={tdDescriptions ? false : colon}\n ref={ref}\n >\n {/*同盾描述框 非边框 开启默认tooltip */}\n {tdDescriptions &&\n !bordered &&\n !hideTooltip &&\n React.Children.map(children, (child) => {\n if (React.isValidElement(child)) {\n const childProps = (child.props || {}) as any\n const { label, labelPrefix, children: childContext } = childProps\n return React.cloneElement(child, {\n ...child.props,\n label: null,\n children: (\n <Ellipsis\n lines={ellipsisLine}\n className=\"tnt-descriptions-item\"\n prefix={\n <div className=\"tnt-descriptions-label-title\">\n <Ellipsis\n prefix={\n labelPrefix ? (\n <span className=\"tnt-descriptions-label-tag\">\n {labelPrefix}\n </span>\n ) : null\n }\n lines={ellipsisLine}\n title={label}\n />\n </div>\n }\n title={childContext}\n />\n ),\n })\n }\n })}\n\n {/*同盾描述框 有边框 不换行 开启默认tooltip */}\n {tdDescriptions &&\n bordered &&\n ellipsis &&\n !hideTooltip &&\n React.Children.map(children, (child) => {\n if (React.isValidElement(child)) {\n const childProps = (child.props || {}) as any\n const {\n label,\n labelPrefix,\n children: childContext,\n ellipsis = true,\n } = childProps\n return React.cloneElement(child, {\n ...child.props,\n label: (\n <Ellipsis\n prefix={\n labelPrefix ? (\n <span className=\"tnt-descriptions-label-tag\">{labelPrefix}</span>\n ) : null\n }\n lines={ellipsisLine}\n title={label}\n />\n ),\n children: ellipsis ? (\n <Ellipsis lines={ellipsisLine} title={childContext} />\n ) : (\n childContext\n ),\n })\n }\n })}\n {/* 非同盾模式下 或者 带边框但换行 或者 不开启默认tooltip 走默认逻辑 */}\n {(!tdDescriptions || (bordered && !ellipsis) || hideTooltip) && children}\n </AntdDescriptions>\n )\n }}\n </ConfigConsumer>\n )\n }\n) as DescriptionsComponent\n\nDescriptions.Item = AntdDescriptions.Item\n"]}
|
|
@@ -5,94 +5,90 @@
|
|
|
5
5
|
@descriptions-small-padding: 8px 16px;
|
|
6
6
|
@descriptions-bg: #e1e6ee;
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
8
|
+
.tnt-descriptions{
|
|
9
|
+
&.@{descriptions-prefix-cls} {
|
|
10
|
+
// 加粗的头部
|
|
11
|
+
&.tnt-descriptions-title-weight{
|
|
12
|
+
>.@{descriptions-prefix-cls}-title{
|
|
13
|
+
font-weight: 600 !important;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
// label中有标签前缀
|
|
18
|
+
.tnt-descriptions-label-tag{
|
|
19
|
+
color:@primary-color;
|
|
20
|
+
margin-right: 4px;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
// title样式
|
|
24
|
+
&[class*="tnt-descriptions-title-theme"]{
|
|
13
25
|
// 默认色主题
|
|
14
|
-
|
|
26
|
+
>.@{descriptions-prefix-cls}-title{
|
|
15
27
|
font-size:@font-size-base;
|
|
16
28
|
position: relative;
|
|
17
29
|
margin-bottom:12px;
|
|
18
30
|
padding-left:12px;
|
|
31
|
+
font-weight: 400;
|
|
19
32
|
&::before{
|
|
20
33
|
content: '';
|
|
21
34
|
width: 4px;
|
|
22
35
|
height: 12px;
|
|
23
36
|
background-color: @primary-color;
|
|
24
|
-
border-radius: 8px;
|
|
37
|
+
border-radius: @border-radius-base;//8px;
|
|
25
38
|
position: absolute;
|
|
26
|
-
top:
|
|
39
|
+
top:5px;
|
|
27
40
|
left:0;
|
|
28
41
|
}
|
|
29
42
|
}
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
43
|
+
// 默认没有前面的线条展示
|
|
44
|
+
&.title-theme-none{
|
|
45
|
+
>.@{descriptions-prefix-cls}-title{
|
|
46
|
+
padding-left:0;
|
|
34
47
|
&::before{
|
|
35
48
|
content: '';
|
|
36
|
-
|
|
49
|
+
display: none;
|
|
37
50
|
}
|
|
38
51
|
}
|
|
39
52
|
}
|
|
40
|
-
|
|
41
53
|
}
|
|
42
54
|
|
|
43
|
-
//
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
font-size:@font-size-base;
|
|
47
|
-
max-width: 100%;
|
|
48
|
-
display: inline-block;
|
|
49
|
-
padding: 6px 20px 6px 16px;
|
|
50
|
-
border-radius: 8px 20px 20px 0px;
|
|
51
|
-
background: linear-gradient(0deg, rgba(18, 107, 251, 0.16) 0%, rgba(18, 107, 251, 0.08) 76.56%);
|
|
52
|
-
margin-right: 4px;
|
|
53
|
-
margin-bottom:16px;
|
|
54
|
-
white-space: nowrap;
|
|
55
|
-
overflow: hidden;
|
|
56
|
-
text-overflow: ellipsis;
|
|
57
|
-
font-weight: 600;
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
&-bordered {
|
|
63
|
-
&.tntd-descriptions {
|
|
64
|
-
&.tntd-descriptions-ellipsis{
|
|
55
|
+
// 带边框
|
|
56
|
+
&-bordered {
|
|
57
|
+
&.tnt-descriptions-ellipsis{
|
|
65
58
|
.@{descriptions-prefix-cls}-item-label,
|
|
66
59
|
.@{descriptions-prefix-cls}-item-content {
|
|
67
|
-
white-space: nowrap;
|
|
68
60
|
overflow: hidden;
|
|
69
61
|
text-overflow: ellipsis;
|
|
62
|
+
-webkit-box-orient: vertical;
|
|
70
63
|
}
|
|
71
|
-
|
|
72
64
|
.@{descriptions-prefix-cls}-item-label{
|
|
73
|
-
width: 180px;
|
|
65
|
+
width: 180px; // 其他语言模式默认180
|
|
66
|
+
background-color: @fill-color-quaternary; //#F8F9FB;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
&.@{descriptions-prefix-cls}-cn{
|
|
70
|
+
.@{descriptions-prefix-cls}-item-label{
|
|
71
|
+
width: 160px; // 中文160
|
|
74
72
|
}
|
|
75
73
|
}
|
|
76
74
|
.@{descriptions-prefix-cls}-view > table {
|
|
77
75
|
table-layout: fixed;
|
|
78
76
|
}
|
|
77
|
+
.@{descriptions-prefix-cls}-item-label{
|
|
78
|
+
background-color: fade(@descriptions-bg, 40%); ;
|
|
79
|
+
}
|
|
80
|
+
.@{descriptions-prefix-cls}-item-label,
|
|
81
|
+
.@{descriptions-prefix-cls}-item-content {
|
|
82
|
+
padding: @descriptions-small-padding;
|
|
83
|
+
}
|
|
79
84
|
}
|
|
80
|
-
.@{descriptions-prefix-cls}-item-label{
|
|
81
|
-
background-color: fade(@descriptions-bg, 40%); ;
|
|
82
|
-
}
|
|
83
|
-
.@{descriptions-prefix-cls}-item-label,
|
|
84
|
-
.@{descriptions-prefix-cls}-item-content {
|
|
85
|
-
padding: 10px 16px;
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
85
|
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
height:
|
|
93
|
-
line-height:
|
|
86
|
+
// 不带边框
|
|
87
|
+
&:not(.@{descriptions-prefix-cls}-bordered ){
|
|
88
|
+
.@{descriptions-prefix-cls}-item{
|
|
89
|
+
height: 30px;
|
|
90
|
+
line-height: 30px;
|
|
94
91
|
position: relative;
|
|
95
|
-
padding-right: 12px;
|
|
96
92
|
padding:0;
|
|
97
93
|
&:not(:first-of-type){
|
|
98
94
|
padding-left: 12px;
|
|
@@ -101,29 +97,34 @@
|
|
|
101
97
|
left:0;
|
|
102
98
|
position: absolute;
|
|
103
99
|
width:1px;
|
|
104
|
-
background-color:
|
|
100
|
+
background-color: @descriptions-bg;
|
|
105
101
|
height:16px;
|
|
106
102
|
top: 50%;
|
|
107
103
|
margin-top:-8px;
|
|
108
104
|
}
|
|
109
105
|
}
|
|
110
|
-
|
|
106
|
+
.@{descriptions-prefix-cls}-item-no-label{
|
|
111
107
|
display: none;
|
|
112
108
|
}
|
|
113
|
-
|
|
109
|
+
.@{descriptions-prefix-cls}-item-content{
|
|
114
110
|
display: flex;
|
|
115
111
|
width: 100%;
|
|
116
|
-
|
|
112
|
+
height:100%;
|
|
113
|
+
align-items: center;
|
|
114
|
+
&>.tntd-ellipsis,>.tnt-ellipsis{
|
|
117
115
|
width: 100%;
|
|
118
|
-
|
|
116
|
+
height: 100%;
|
|
117
|
+
align-items: center;
|
|
118
|
+
.tnt-descriptions-label-title{
|
|
119
119
|
max-width: 70%;
|
|
120
|
-
margin-right:
|
|
121
|
-
color
|
|
122
|
-
white-space: nowrap;
|
|
120
|
+
margin-right: 8px;
|
|
121
|
+
color: tint(@bg-color-spotilight, 50%);//#8B919E;
|
|
123
122
|
overflow: hidden;
|
|
124
123
|
text-overflow: ellipsis;
|
|
125
|
-
|
|
124
|
+
-webkit-box-orient: vertical;
|
|
125
|
+
&+.tnt-descriptions-item{
|
|
126
126
|
flex:1;
|
|
127
|
+
padding-right: 8px;
|
|
127
128
|
}
|
|
128
129
|
}
|
|
129
130
|
}
|
package/lib/drawer/drawer.d.ts
CHANGED
|
@@ -8,6 +8,7 @@ interface CustomDrawerProps extends AntdDrawerProps {
|
|
|
8
8
|
onClose?: () => void;
|
|
9
9
|
onSubmit?: () => void;
|
|
10
10
|
onCancel?: () => void;
|
|
11
|
+
afterClose?: () => void;
|
|
11
12
|
onOk?: () => void;
|
|
12
13
|
okText?: string;
|
|
13
14
|
cancelText?: string;
|
|
@@ -21,6 +22,8 @@ interface CustomDrawerProps extends AntdDrawerProps {
|
|
|
21
22
|
okButtonProps?: BaseButtonProps;
|
|
22
23
|
cancelButtonProps?: BaseButtonProps;
|
|
23
24
|
clickOnBlankToClose: boolean;
|
|
25
|
+
upperCaseIgnore?: [];
|
|
26
|
+
unUpperConverted: boolean;
|
|
24
27
|
}
|
|
25
28
|
export declare const Drawer: FC<CustomDrawerProps>;
|
|
26
29
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"drawer.d.ts","sourceRoot":"","sources":["../../src/drawer/drawer.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,IAAI,eAAe,EAAE,MAAM,gBAAgB,CAAA;AAIpE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAA;AAC5D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAElD,OAAO,KAAK,EAAE,EAAE,EAAE,
|
|
1
|
+
{"version":3,"file":"drawer.d.ts","sourceRoot":"","sources":["../../src/drawer/drawer.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,IAAI,eAAe,EAAE,MAAM,gBAAgB,CAAA;AAIpE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAA;AAC5D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAElD,OAAO,KAAK,EAAE,EAAE,EAAE,EAAkC,MAAM,OAAO,CAAA;AAyCjE,UAAU,iBAAkB,SAAQ,eAAe;IACjD,MAAM,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IACxB,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAA;IACpB,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAA;IACrB,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAA;IACrB,UAAU,CAAC,EAAE,MAAM,IAAI,CAAA;IACvB,IAAI,CAAC,EAAE,MAAM,IAAI,CAAA;IACjB,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,MAAM,CAAC,EAAE;QACP,MAAM,CAAC,EAAE,MAAM,CAAA;QACf,UAAU,CAAC,EAAE,MAAM,CAAA;KACpB,CAAA;IACD,MAAM,CAAC,EAAE,UAAU,CAAA;IACnB,UAAU,CAAC,EAAE,UAAU,CAAA;IACvB,cAAc,CAAC,EAAE,OAAO,CAAA;IACxB,aAAa,CAAC,EAAE,eAAe,CAAA;IAC/B,iBAAiB,CAAC,EAAE,eAAe,CAAA;IACnC,mBAAmB,EAAE,OAAO,CAAA;IAC5B,eAAe,CAAC,EAAE,EAAE,CAAA;IACpB,gBAAgB,EAAE,OAAO,CAAA;CAC1B;AAED,eAAO,MAAM,MAAM,EAAE,EAAE,CAAC,iBAAiB,CAqHxC,CAAA"}
|
package/lib/drawer/drawer.js
CHANGED
|
@@ -8,6 +8,7 @@ var _configProvider = require("antd/lib/config-provider");
|
|
|
8
8
|
var _drawer = _interopRequireDefault(require("antd/lib/drawer"));
|
|
9
9
|
var _LocaleReceiver = _interopRequireDefault(require("antd/lib/locale-provider/LocaleReceiver"));
|
|
10
10
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
11
|
+
var _utils = require("../utils");
|
|
11
12
|
var _react = _interopRequireWildcard(require("react"));
|
|
12
13
|
var _button = require("../button");
|
|
13
14
|
var _icon = _interopRequireDefault(require("../icon"));
|
|
@@ -28,8 +29,6 @@ var __rest = void 0 && (void 0).__rest || function (s, e) {
|
|
|
28
29
|
};
|
|
29
30
|
var DefaultFooter = function DefaultFooter(_ref) {
|
|
30
31
|
var locale = _ref.locale,
|
|
31
|
-
onClose = _ref.onClose,
|
|
32
|
-
onSubmit = _ref.onSubmit,
|
|
33
32
|
onCancel = _ref.onCancel,
|
|
34
33
|
onOk = _ref.onOk,
|
|
35
34
|
okText = _ref.okText,
|
|
@@ -40,13 +39,10 @@ var DefaultFooter = function DefaultFooter(_ref) {
|
|
|
40
39
|
cancelButtonProps = _ref.cancelButtonProps,
|
|
41
40
|
cancelType = _ref.cancelType;
|
|
42
41
|
return _react["default"].createElement(_react["default"].Fragment, null, _react["default"].createElement(_button.Button, Object.assign({
|
|
43
|
-
onClick: onCancel
|
|
44
|
-
style: {
|
|
45
|
-
marginRight: 8
|
|
46
|
-
},
|
|
42
|
+
onClick: onCancel,
|
|
47
43
|
type: cancelType || 'default'
|
|
48
44
|
}, cancelButtonProps), cancelText || (locale === null || locale === void 0 ? void 0 : locale.cancelText)), _react["default"].createElement(_button.Button, Object.assign({
|
|
49
|
-
onClick: onOk
|
|
45
|
+
onClick: onOk,
|
|
50
46
|
type: okType || 'primary',
|
|
51
47
|
loading: confirmLoading
|
|
52
48
|
}, okButtonProps), okText || (locale === null || locale === void 0 ? void 0 : locale.okText)));
|
|
@@ -60,6 +56,7 @@ var Drawer = exports.Drawer = function Drawer(_a) {
|
|
|
60
56
|
onClose = _a.onClose,
|
|
61
57
|
onSubmit = _a.onSubmit,
|
|
62
58
|
onCancel = _a.onCancel,
|
|
59
|
+
afterClose = _a.afterClose,
|
|
63
60
|
onOk = _a.onOk,
|
|
64
61
|
_a$okText = _a.okText,
|
|
65
62
|
okText = _a$okText === void 0 ? '' : _a$okText,
|
|
@@ -78,9 +75,22 @@ var Drawer = exports.Drawer = function Drawer(_a) {
|
|
|
78
75
|
cancelButtonProps = _a$cancelButtonProps === void 0 ? {} : _a$cancelButtonProps,
|
|
79
76
|
_a$clickOnBlankToClos = _a.clickOnBlankToClose,
|
|
80
77
|
clickOnBlankToClose = _a$clickOnBlankToClos === void 0 ? false : _a$clickOnBlankToClos,
|
|
81
|
-
|
|
78
|
+
upperCaseIgnore = _a.upperCaseIgnore,
|
|
79
|
+
unUpperConverted = _a.unUpperConverted,
|
|
80
|
+
title = _a.title,
|
|
81
|
+
rest = __rest(_a, ["closable", "className", "footer", "showFooter", "onClose", "onSubmit", "onCancel", "afterClose", "onOk", "okText", "cancelText", "locale", "okType", "cancelType", "confirmLoading", "okButtonProps", "cancelButtonProps", "clickOnBlankToClose", "upperCaseIgnore", "unUpperConverted", "title"]);
|
|
82
82
|
var drawerDom = _react["default"].useRef(null);
|
|
83
|
-
var _onCancel =
|
|
83
|
+
var _onCancel = (0, _react.useCallback)(function () {
|
|
84
|
+
if (onCancel) {
|
|
85
|
+
onCancel();
|
|
86
|
+
} else if (onClose) {
|
|
87
|
+
onClose();
|
|
88
|
+
}
|
|
89
|
+
if (afterClose) {
|
|
90
|
+
afterClose();
|
|
91
|
+
}
|
|
92
|
+
}, [onCancel, onClose, afterClose]);
|
|
93
|
+
var _onOk = onOk || onSubmit;
|
|
84
94
|
(0, _react.useEffect)(function () {
|
|
85
95
|
if (clickOnBlankToClose) {
|
|
86
96
|
var handleOutsideClick = function handleOutsideClick(event) {
|
|
@@ -116,15 +126,17 @@ var Drawer = exports.Drawer = function Drawer(_a) {
|
|
|
116
126
|
}, _react["default"].createElement(_drawer["default"], Object.assign({
|
|
117
127
|
className: (0, _classnames["default"])(prefixCls, 'tnt-drawer', 'tntd-drawer', className, _defineProperty(_defineProperty({}, "".concat(prefixCls, "-contain-closable"), closable !== false), "".concat(prefixCls, "-footer"), showFooter || footer)),
|
|
118
128
|
closable: false,
|
|
119
|
-
onClose:
|
|
129
|
+
onClose: _onCancel,
|
|
120
130
|
width: 480
|
|
121
|
-
}, rest
|
|
131
|
+
}, rest, {
|
|
132
|
+
title: !unUpperConverted ? (0, _utils.doUpperTitle)(title, upperCaseIgnore) : title
|
|
133
|
+
}), _react["default"].createElement(_react["default"].Fragment, null, closable !== false && _react["default"].createElement(_icon["default"], {
|
|
122
134
|
type: "close",
|
|
123
135
|
className: "".concat(prefixCls, "-close"),
|
|
124
|
-
onClick:
|
|
125
|
-
}), rest.children, _react["default"].createElement("div", {
|
|
136
|
+
onClick: _onCancel
|
|
137
|
+
}), rest.children, (showFooter || footer) && _react["default"].createElement("div", {
|
|
126
138
|
className: "".concat(prefixCls, "-footer-style")
|
|
127
|
-
},
|
|
139
|
+
}, footer || _react["default"].createElement(DefaultFooter, {
|
|
128
140
|
confirmLoading: confirmLoading,
|
|
129
141
|
okButtonProps: okButtonProps,
|
|
130
142
|
cancelButtonProps: cancelButtonProps,
|
|
@@ -133,11 +145,9 @@ var Drawer = exports.Drawer = function Drawer(_a) {
|
|
|
133
145
|
okText: okText,
|
|
134
146
|
cancelType: cancelType,
|
|
135
147
|
cancelText: cancelText,
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
onCancel: onCancel
|
|
140
|
-
}) : footer))));
|
|
148
|
+
onOk: _onOk,
|
|
149
|
+
onCancel: _onCancel
|
|
150
|
+
})))));
|
|
141
151
|
});
|
|
142
152
|
});
|
|
143
153
|
};
|
package/lib/drawer/drawer.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"drawer.js","sourceRoot":"","sources":["../../src/drawer/drawer.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,6DAAwD;AAExD,4DAAsD;AACtD,4FAAmE;AACnE,4DAAmC;
|
|
1
|
+
{"version":3,"file":"drawer.js","sourceRoot":"","sources":["../../src/drawer/drawer.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,6DAAwD;AAExD,4DAAsD;AACtD,4FAAmE;AACnE,4DAAmC;AAGnC,oCAAuC;AACvC,+CAAiE;AACjE,sCAAkC;AAClC,mDAA0B;AAC1B,MAAM,aAAa,GAAG,CAAC,EACrB,MAAM,EACN,QAAQ,EACR,IAAI,EACJ,MAAM,EACN,MAAM,EACN,UAAU,EACV,cAAc,EACd,aAAa,EACb,iBAAiB,EACjB,UAAU,GAeX,EAAE,EAAE;IACH,OAAO,CACL;QACE,8BAAC,eAAM,kBAAC,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,UAAU,IAAI,SAAS,IAAM,iBAAiB,GAC5E,UAAU,KAAI,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,UAAU,CAAA,CAC1B;QACT,8BAAC,eAAM,kBAAC,OAAO,EAAE,IAAI,E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CAAC,GAAG,SAAS,SAAS,CAAC,EAAE,UAAU,IAAI,MAAM;qBAC9C,CAAC,EACF,QAAQ,EAAE,KAAK,EACf,OAAO,EAAE,SAAS,EAClB,KAAK,EAAE,GAAG,IACN,IAAI,IACR,KAAK,EAAE,CAAC,gBAAgB,CAAC,CAAC,CAAC,IAAA,oBAAY,EAAC,KAAK,EAAE,eAAe,CAAC,CAAC,CAAC,CAAC,KAAK;oBAEvE;wBACG,QAAQ,KAAK,KAAK,IAAI,CACrB,8BAAC,cAAI,IAAC,IAAI,EAAC,OAAO,EAAC,SAAS,EAAE,GAAG,SAAS,QAAQ,EAAE,OAAO,EAAE,SAAS,GAAI,CAC3E;wBACA,IAAI,CAAC,QAAQ;wBACb,CAAC,UAAU,IAAI,MAAM,CAAC,IAAI,CACzB,uCAAK,SAAS,EAAE,GAAG,SAAS,eAAe,IACxC,MAAM,IAAI,CACT,8BAAC,aAAa,IACZ,cAAc,EAAE,cAAc,EAC9B,aAAa,EAAE,aAAa,EAC5B,iBAAiB,EAAE,iBAAiB,EACpC,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,MAAM,EACd,UAAU,EAAE,UAAU,EACtB,UAAU,EAAE,UAAU,EACtB,IAAI,EAAE,KAAK,EACX,QAAQ,EAAE,SAAS,GACnB,CACH,CACG,CACP,CACA,CACQ,CACT,CACP,CAAA;QACH,CAAC,CACc,CAClB,CAAA;IACH,CAAC,CACc,CAClB,CAAA;AACH,CAAC,CAAA;AArHY,QAAA,MAAM,UAqHlB","sourcesContent":["import { ConfigConsumer } from 'antd/lib/config-provider'\nimport type { DrawerProps as AntdDrawerProps } from 'antd/lib/drawer'\nimport { default as AntdDrawer } from 'antd/lib/drawer'\nimport LocaleReceiver from 'antd/lib/locale-provider/LocaleReceiver'\nimport classNames from 'classnames'\nimport type { BaseButtonProps } from 'antd/lib/button/button'\nimport type { ButtonType } from '../button/button'\nimport { doUpperTitle } from '../utils'\nimport React, { FC, useCallback, useEffect, useRef } from 'react'\nimport { Button } from '../button'\nimport Icon from '../icon'\nconst DefaultFooter = ({\n locale,\n onCancel,\n onOk,\n okText,\n okType,\n cancelText,\n confirmLoading,\n okButtonProps,\n cancelButtonProps,\n cancelType,\n}: {\n locale?: {\n okText?: string\n cancelText?: string\n }\n onCancel?: () => void\n onOk?: () => void\n okText: string\n cancelText: string\n okType?: ButtonType\n cancelType: ButtonType\n confirmLoading?: boolean\n okButtonProps?: BaseButtonProps\n cancelButtonProps?: BaseButtonProps\n}) => {\n return (\n <>\n <Button onClick={onCancel} type={cancelType || 'default'} {...cancelButtonProps}>\n {cancelText || locale?.cancelText}\n </Button>\n <Button onClick={onOk} type={okType || 'primary'} loading={confirmLoading} {...okButtonProps}>\n {okText || locale?.okText}\n </Button>\n </>\n )\n}\n\ninterface CustomDrawerProps extends AntdDrawerProps {\n footer?: React.ReactNode\n showFooter?: boolean\n onClose?: () => void\n onSubmit?: () => void\n onCancel?: () => void\n afterClose?: () => void\n onOk?: () => void\n okText?: string\n cancelText?: string\n locale?: {\n okText?: string\n cancelText?: string\n }\n okType?: ButtonType\n cancelType?: ButtonType\n confirmLoading?: boolean\n okButtonProps?: BaseButtonProps\n cancelButtonProps?: BaseButtonProps\n clickOnBlankToClose: boolean\n upperCaseIgnore?: []\n unUpperConverted: boolean\n}\n\nexport const Drawer: FC<CustomDrawerProps> = ({\n closable = true,\n className,\n footer,\n showFooter,\n onClose,\n onSubmit,\n onCancel,\n afterClose,\n onOk,\n okText = '',\n cancelText = '',\n locale,\n okType = 'primary',\n cancelType = 'default',\n confirmLoading = false,\n okButtonProps = {},\n cancelButtonProps = {},\n clickOnBlankToClose = false,\n upperCaseIgnore,\n unUpperConverted,\n title,\n ...rest\n}) => {\n const drawerDom = React.useRef<EventTarget | null>(null)\n const _onCancel = useCallback(() => {\n if (onCancel) {\n onCancel()\n } else if (onClose) {\n onClose()\n }\n if (afterClose) {\n afterClose()\n }\n }, [onCancel, onClose, afterClose])\n const _onOk = onOk || onSubmit\n\n useEffect(() => {\n if (clickOnBlankToClose) {\n const handleOutsideClick = (event: Event) => {\n const drawer = drawerDom.current as Node\n const targetElement = event.target as Node\n\n let isInDrawer = false\n if (drawer && targetElement) {\n isInDrawer = drawer.contains(targetElement as Node) || targetElement === drawer\n }\n drawerDom.current = null\n if (rest.visible && !isInDrawer && _onCancel) {\n _onCancel()\n }\n }\n document.removeEventListener('click', handleOutsideClick)\n document.addEventListener('click', handleOutsideClick)\n return () => {\n document.removeEventListener('click', handleOutsideClick)\n }\n }\n }, [rest.visible, clickOnBlankToClose, _onCancel])\n\n return (\n <ConfigConsumer>\n {({ getPrefixCls }) => {\n const prefixCls = getPrefixCls('drawer')\n return (\n <LocaleReceiver componentName=\"Drawer\" defaultLocale={locale}>\n {(locale) => {\n return (\n <div\n onClick={(event: React.MouseEvent<HTMLDivElement>) => {\n drawerDom.current = event.target\n }}\n >\n <AntdDrawer\n className={classNames(prefixCls, 'tnt-drawer', 'tntd-drawer', className, {\n [`${prefixCls}-contain-closable`]: closable !== false,\n [`${prefixCls}-footer`]: showFooter || footer,\n })}\n closable={false}\n onClose={_onCancel}\n width={480}\n {...rest}\n title={!unUpperConverted ? doUpperTitle(title, upperCaseIgnore) : title}\n >\n <>\n {closable !== false && (\n <Icon type=\"close\" className={`${prefixCls}-close`} onClick={_onCancel} />\n )}\n {rest.children}\n {(showFooter || footer) && (\n <div className={`${prefixCls}-footer-style`}>\n {footer || (\n <DefaultFooter\n confirmLoading={confirmLoading}\n okButtonProps={okButtonProps}\n cancelButtonProps={cancelButtonProps}\n okType={okType}\n locale={locale}\n okText={okText}\n cancelType={cancelType}\n cancelText={cancelText}\n onOk={_onOk}\n onCancel={_onCancel}\n />\n )}\n </div>\n )}\n </>\n </AntdDrawer>\n </div>\n )\n }}\n </LocaleReceiver>\n )\n }}\n </ConfigConsumer>\n )\n}\n"]}
|
package/lib/drawer/index.less
CHANGED
|
@@ -20,12 +20,12 @@
|
|
|
20
20
|
|
|
21
21
|
.@{drawer-prefix-cls}-wrapper-body {
|
|
22
22
|
margin-top: 48px;
|
|
23
|
-
max-height: ~'calc(100vh -
|
|
23
|
+
max-height: ~'calc(100vh - 48px)';
|
|
24
24
|
}
|
|
25
25
|
|
|
26
26
|
&-footer {
|
|
27
27
|
.@{drawer-prefix-cls}-header {
|
|
28
|
-
border-bottom: none;
|
|
28
|
+
// border-bottom: none;
|
|
29
29
|
position: absolute;
|
|
30
30
|
right: 0;
|
|
31
31
|
top: 0;
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
}
|
|
35
35
|
|
|
36
36
|
.@{drawer-prefix-cls}-wrapper-body {
|
|
37
|
-
max-height: ~'calc(100vh -
|
|
37
|
+
max-height: ~'calc(100vh - 96px)' !important;
|
|
38
38
|
margin-top: 48px !important;
|
|
39
39
|
margin-bottom: 48px !important;
|
|
40
40
|
}
|
|
@@ -47,11 +47,6 @@
|
|
|
47
47
|
}
|
|
48
48
|
|
|
49
49
|
.@{drawer-prefix-cls}-close {
|
|
50
|
-
color: fade(@text-color, 50%);
|
|
51
|
-
width: 62px;
|
|
52
|
-
top: -4px;
|
|
53
|
-
|
|
54
|
-
|
|
55
50
|
position: absolute;
|
|
56
51
|
top: -2px;
|
|
57
52
|
right: 0;
|
|
@@ -124,20 +119,19 @@
|
|
|
124
119
|
|
|
125
120
|
.@{drawer-prefix-cls}-header {
|
|
126
121
|
padding: 13px 24px;
|
|
127
|
-
border-bottom: none;
|
|
128
122
|
position: absolute;
|
|
129
123
|
right: 0;
|
|
130
124
|
top: 0;
|
|
131
125
|
width: 100%;
|
|
132
126
|
background: #fff;
|
|
127
|
+
border-bottom: 1px solid #E9EDF3;
|
|
128
|
+
|
|
133
129
|
}
|
|
134
130
|
|
|
135
131
|
.@{drawer-prefix-cls}-body {
|
|
136
|
-
padding:
|
|
137
|
-
|
|
132
|
+
padding: 24px !important;
|
|
138
133
|
}
|
|
139
134
|
|
|
140
|
-
|
|
141
135
|
.@{drawer-prefix-cls}-wrapper-body {
|
|
142
136
|
|
|
143
137
|
.@{drawer-prefix-cls}-footer-style {
|
|
@@ -148,6 +142,11 @@
|
|
|
148
142
|
padding: 8px 24px;
|
|
149
143
|
background: #fff;
|
|
150
144
|
text-align: right;
|
|
145
|
+
border-top: 1px solid #E9EDF3;
|
|
146
|
+
|
|
147
|
+
.@{ant-prefix}-btn {
|
|
148
|
+
margin-left: 15px;
|
|
149
|
+
}
|
|
151
150
|
}
|
|
152
151
|
|
|
153
152
|
}
|
package/lib/form/form.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ import type { FormItemProps as AntdFormItemProps, FormProps as AntdFormProps } f
|
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { default as AntdForm } from 'antd/lib/form';
|
|
4
4
|
import type AntdFormItem from 'antd/lib/form/FormItem';
|
|
5
|
+
import './form.less';
|
|
5
6
|
export * from 'antd/lib/form';
|
|
6
7
|
interface FormItemComponent extends React.ForwardRefExoticComponent<AntdFormItemProps & React.RefAttributes<AntdFormItem>> {
|
|
7
8
|
}
|
package/lib/form/form.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"form.d.ts","sourceRoot":"","sources":["../../src/form/form.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,aAAa,IAAI,iBAAiB,EAClC,SAAS,IAAI,aAAa,EAG3B,MAAM,cAAc,CAAA;AACrB,OAAO,KAAqB,MAAM,OAAO,CAAA;AAIzC,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,cAAc,CAAA;AAClD,OAAO,KAAK,YAAY,MAAM,uBAAuB,CAAA;
|
|
1
|
+
{"version":3,"file":"form.d.ts","sourceRoot":"","sources":["../../src/form/form.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,aAAa,IAAI,iBAAiB,EAClC,SAAS,IAAI,aAAa,EAG3B,MAAM,cAAc,CAAA;AACrB,OAAO,KAAqB,MAAM,OAAO,CAAA;AAIzC,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,cAAc,CAAA;AAClD,OAAO,KAAK,YAAY,MAAM,uBAAuB,CAAA;AAGrD,OAAO,aAAa,CAAA;AAEpB,cAAc,cAAc,CAAA;AAE5B,UAAU,iBACR,SAAQ,KAAK,CAAC,yBAAyB,CAAC,iBAAiB,GAAG,KAAK,CAAC,aAAa,CAAC,YAAY,CAAC,CAAC;CAAG;AACnG,UAAU,aACR,SAAQ,KAAK,CAAC,yBAAyB,CAAC,aAAa,GAAG,KAAK,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAC;IACtF,IAAI,EAAE,iBAAiB,CAAA;IACvB,MAAM,EAAE,OAAO,QAAQ,CAAC,MAAM,CAAA;IAC9B,eAAe,EAAE,OAAO,QAAQ,CAAC,eAAe,CAAA;CACjD;AAED,eAAO,MAAM,IAAI,eAQE,CAAA"}
|
package/lib/form/form.js
CHANGED
|
@@ -22,6 +22,9 @@ Object.keys(_form).forEach(function (key) {
|
|
|
22
22
|
});
|
|
23
23
|
});
|
|
24
24
|
var _utils = require("../utils");
|
|
25
|
+
require("./form.less");
|
|
26
|
+
var _classnames = _interopRequireDefault(require("classnames"));
|
|
27
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
25
28
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
26
29
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
|
|
27
30
|
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
@@ -41,6 +44,7 @@ var Form = exports.Form = (0, _react.forwardRef)(function (_a, ref) {
|
|
|
41
44
|
return _react["default"].createElement(_configProvider.ConfigConsumer, null, function (_ref) {
|
|
42
45
|
var getPrefixCls = _ref.getPrefixCls;
|
|
43
46
|
return _react["default"].createElement(_form["default"], Object.assign({}, rest, {
|
|
47
|
+
className: (0, _classnames["default"])(rest.className, 'tnt-form'),
|
|
44
48
|
ref: ref
|
|
45
49
|
}));
|
|
46
50
|
});
|
|
@@ -59,7 +63,7 @@ Form.Item = (0, _react.forwardRef)(function (_a, ref) {
|
|
|
59
63
|
var Create = function Create(options) {
|
|
60
64
|
return function (WrappedComponent) {
|
|
61
65
|
var validateSubmitMap = {};
|
|
62
|
-
var CustomFormWrapper = function CustomFormWrapper(props) {
|
|
66
|
+
var CustomFormWrapper = function CustomFormWrapper(props, ref) {
|
|
63
67
|
var getFieldDecorator = props.form.getFieldDecorator;
|
|
64
68
|
props.form.getFieldDecorator = function (name, options) {
|
|
65
69
|
var opt = options || {};
|
|
@@ -71,7 +75,9 @@ var Create = function Create(options) {
|
|
|
71
75
|
}
|
|
72
76
|
return getFieldDecorator(name, opt);
|
|
73
77
|
};
|
|
74
|
-
return _react["default"].createElement(WrappedComponent, Object.assign({}, props
|
|
78
|
+
return _react["default"].createElement(WrappedComponent, Object.assign({}, props, {
|
|
79
|
+
ref: ref
|
|
80
|
+
}));
|
|
75
81
|
};
|
|
76
82
|
return _form["default"].create(Object.assign(Object.assign({}, options), {
|
|
77
83
|
onValuesChange: function onValuesChange(props, changedValues, allValues) {
|
|
@@ -89,7 +95,7 @@ var Create = function Create(options) {
|
|
|
89
95
|
options.onValuesChange(props, changedValues, allValues);
|
|
90
96
|
}
|
|
91
97
|
}
|
|
92
|
-
}))(CustomFormWrapper);
|
|
98
|
+
}))((0, _react.forwardRef)(CustomFormWrapper));
|
|
93
99
|
};
|
|
94
100
|
};
|
|
95
101
|
Form.createFormField = _form["default"].createFormField;
|
package/lib/form/form.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"form.js","sourceRoot":"","sources":["../../src/form/form.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAMA,+CAAyC;AAEzC,6DAAwD;AAExD,wDAAkD;AAGlD,oCAAuC;
|
|
1
|
+
{"version":3,"file":"form.js","sourceRoot":"","sources":["../../src/form/form.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAMA,+CAAyC;AAEzC,6DAAwD;AAExD,wDAAkD;AAGlD,oCAAuC;AACvC,uBAAoB;AACpB,4DAAmC;AACnC,+CAA4B;AAWf,QAAA,IAAI,GAAG,IAAA,kBAAU,EAA0B,CAAC,EAAW,EAAE,GAAG,EAAE,EAAE;QAAf,IAAI,cAAT,EAAW,CAAF;IAChE,OAAO,CACL,8BAAC,gCAAc,QACZ,CAAC,EAAE,YAAY,EAAE,EAAE,EAAE;QACpB,OAAO,8BAAC,cAAQ,oBAAK,IAAI,IAAE,SAAS,EAAE,IAAA,oBAAU,EAAC,IAAI,CAAC,SAAS,EAAE,UAAU,CAAC,EAAE,GAAG,EAAE,GAAG,IAAI,CAAA;IAC5F,CAAC,CACc,CAClB,CAAA;AACH,CAAC,CAAkB,CAAA;AAEnB,YAAI,CAAC,IAAI,GAAG,IAAA,kBAAU,EAAkC,CAAC,EAAkB,EAAE,GAAG,EAAE,EAAE;QAA3B,EAAE,KAAK,OAAW,EAAN,IAAI,cAAhB,SAAkB,CAAF;IACvE,OAAO,CACL,8BAAC,gCAAc,QACZ,CAAC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AI,CAAC,EAAE;wBAC3B,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC;4BACnB,CAAC,IAAI,CAAC,EAAE,EAAE,MAAM,EAAE,SAAS,EAAE;yBAC9B,CAAC,CAAA;qBACH;gBACH,CAAC,CAAC,CAAA;aACH;YACD,IAAI,OAAO,IAAI,OAAO,CAAC,cAAc,EAAE;gBACrC,OAAO,CAAC,cAAc,CAAC,KAAK,EAAE,aAAa,EAAE,SAAS,CAAC,CAAA;aACxD;QACH,CAAC,IACD,CAAC,IAAA,kBAAU,EAAC,iBAAiB,CAAC,CAAC,CAAA;AACnC,CAAC,CAAA;AAED,YAAI,CAAC,eAAe,GAAG,cAAQ,CAAC,eAAe,CAAA;AAC/C,YAAI,CAAC,MAAM,GAAG,MAAM,CAAA","sourcesContent":["import type {\n FormItemProps as AntdFormItemProps,\n FormProps as AntdFormProps,\n FormComponentProps,\n FormCreateOption,\n} from 'antd/lib/form'\nimport React, { forwardRef } from 'react'\n\nimport { ConfigConsumer } from 'antd/lib/config-provider'\n\nimport { default as AntdForm } from 'antd/lib/form'\nimport type AntdFormItem from 'antd/lib/form/FormItem'\n\nimport { doUpperTitle } from '../utils'\nimport './form.less'\nimport classNames from 'classnames'\nexport * from 'antd/lib/form'\n\ninterface FormItemComponent\n extends React.ForwardRefExoticComponent<AntdFormItemProps & React.RefAttributes<AntdFormItem>> {}\ninterface FormComponent\n extends React.ForwardRefExoticComponent<AntdFormProps & React.RefAttributes<AntdForm>> {\n Item: FormItemComponent\n create: typeof AntdForm.create\n createFormField: typeof AntdForm.createFormField\n}\n\nexport const Form = forwardRef<AntdForm, AntdFormProps>(({ ...rest }, ref) => {\n return (\n <ConfigConsumer>\n {({ getPrefixCls }) => {\n return <AntdForm {...rest} className={classNames(rest.className, 'tnt-form')} ref={ref} />\n }}\n </ConfigConsumer>\n )\n}) as FormComponent\n\nForm.Item = forwardRef<AntdFormItem, AntdFormItemProps>(({ label, ...rest }, ref) => {\n return (\n <ConfigConsumer>\n {({ getPrefixCls }) => {\n return <AntdForm.Item {...rest} label={doUpperTitle(label)} ref={ref} />\n }}\n </ConfigConsumer>\n )\n})\n\n// 定义 create 函数的类型\ntype CreateFunction = <TOwnProps extends FormComponentProps<any>>(\n options?: FormCreateOption<TOwnProps>\n) => any\n\nconst Create: CreateFunction = (options: any) => (WrappedComponent: any) => {\n const validateSubmitMap: any = {}\n const CustomFormWrapper = (props: any, ref: any) => {\n const getFieldDecorator = props.form.getFieldDecorator\n props.form.getFieldDecorator = (name: any, options: any) => {\n let opt = options || {}\n if (opt.validateSubmit) {\n opt = {\n ...options,\n validateTrigger: 'noEvent',\n }\n validateSubmitMap[name] = true\n }\n return getFieldDecorator(name, opt)\n }\n return <WrappedComponent {...props} ref={ref} />\n }\n\n return AntdForm.create({\n ...options,\n onValuesChange: (props: any, changedValues: any, allValues: any) => {\n const keys = Object.keys(changedValues)\n if (keys.length === 1) {\n keys.forEach((name: any) => {\n if (validateSubmitMap[name]) {\n props.form.setFields({\n [name]: { errors: undefined },\n })\n }\n })\n }\n if (options && options.onValuesChange) {\n options.onValuesChange(props, changedValues, allValues)\n }\n },\n })(forwardRef(CustomFormWrapper))\n}\n\nForm.createFormField = AntdForm.createFormField\nForm.create = Create\n"]}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
@form-prefix-cls: ~'@{ant-prefix}-form';
|
|
2
|
+
|
|
3
|
+
.tnt-form {
|
|
4
|
+
.@{form-prefix-cls}-item {
|
|
5
|
+
// min-height: @input-height-base;
|
|
6
|
+
|
|
7
|
+
.@{form-prefix-cls}-item-required::before {
|
|
8
|
+
top: 2px;
|
|
9
|
+
position: relative;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
&-with-help {
|
|
13
|
+
margin-bottom: @form-item-margin-bottom;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
&-control {
|
|
17
|
+
line-height: 1;
|
|
18
|
+
min-height: @input-height-base;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
&-label {
|
|
22
|
+
line-height: @input-height-base;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
&-children {
|
|
26
|
+
line-height: calc(@input-height-base - 2px);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.@{form-prefix-cls}-explain,
|
|
31
|
+
.@{form-prefix-cls}-extra {
|
|
32
|
+
margin-top: 4px;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
&.@{form-prefix-cls}-vertical{
|
|
36
|
+
.@{form-prefix-cls}-item {
|
|
37
|
+
&-label {
|
|
38
|
+
line-height: @line-height-base;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
@@ -83,9 +83,9 @@
|
|
|
83
83
|
position: relative;
|
|
84
84
|
}
|
|
85
85
|
|
|
86
|
-
&-with-help {
|
|
87
|
-
|
|
88
|
-
}
|
|
86
|
+
// &-with-help {
|
|
87
|
+
// margin-bottom: max(0, @form-item-margin-bottom - @form-explain-height - @form-help-margin-top);
|
|
88
|
+
// }
|
|
89
89
|
|
|
90
90
|
&-label {
|
|
91
91
|
display: inline-block;
|
|
@@ -310,9 +310,9 @@ form {
|
|
|
310
310
|
}
|
|
311
311
|
|
|
312
312
|
.@{form-prefix-cls}-vertical {
|
|
313
|
-
.@{form-prefix-cls}-item {
|
|
314
|
-
|
|
315
|
-
}
|
|
313
|
+
// .@{form-prefix-cls}-item {
|
|
314
|
+
// padding-bottom: 8px;
|
|
315
|
+
// }
|
|
316
316
|
.@{form-prefix-cls}-item-control {
|
|
317
317
|
line-height: @line-height-base;
|
|
318
318
|
}
|