tntd 3.0.0-beta.16 → 3.0.0-beta.19
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/descriptions/descriptions.js +20 -16
- package/es/descriptions/descriptions.js.map +1 -1
- package/es/descriptions/descriptions.less +6 -2
- package/es/descriptions/style/index.less +1 -0
- package/es/drawer/drawer.js +9 -3
- package/es/drawer/drawer.js.map +1 -1
- package/es/handle-icon/index.js +11 -5
- package/es/handle-icon/index.js.map +1 -1
- package/es/handle-icon/index.less +7 -2
- 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/query-form/Field/Checkbox.js +1 -1
- package/es/query-form/Field/Checkbox.js.map +1 -1
- package/es/query-form/Field/SelectInput.js +4 -22
- package/es/query-form/Field/SelectInput.js.map +1 -1
- package/es/query-form/Field/fieldsMap.js +2 -2
- package/es/query-form/Field/fieldsMap.js.map +1 -1
- package/es/query-form/Field/index.js +0 -1
- package/es/query-form/Field/index.js.map +1 -1
- package/es/query-form/index.js +332 -149
- package/es/query-form/index.js.map +1 -1
- package/es/query-form/index.less +60 -17
- package/es/query-form-backup/Field/Composition/FieldPopover.less +35 -0
- package/es/query-form-backup/Field/Composition/index.less +114 -0
- package/es/query-form-backup/index.less +90 -0
- package/es/table/expand.less +51 -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 +76 -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 +17 -31
- package/es/table/table.js +115 -14
- package/es/table/table.js.map +1 -1
- package/es/table/table.less +8 -19
- 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/tabs-container/index.js +1 -1
- package/es/tabs-container/index.js.map +1 -1
- package/es/title/index.js +4 -3
- package/es/title/index.js.map +1 -1
- package/es/tntd-action/Action.js +57 -11
- package/es/tntd-action/Action.js.map +1 -1
- package/es/tntd-action/index.less +5 -3
- package/lib/descriptions/descriptions.d.ts.map +1 -1
- package/lib/descriptions/descriptions.js +23 -18
- package/lib/descriptions/descriptions.js.map +1 -1
- package/lib/descriptions/descriptions.less +6 -2
- package/lib/descriptions/style/index.less +1 -0
- package/lib/drawer/drawer.d.ts +2 -0
- package/lib/drawer/drawer.d.ts.map +1 -1
- package/lib/drawer/drawer.js +8 -2
- package/lib/drawer/drawer.js.map +1 -1
- package/lib/handle-icon/index.d.ts.map +1 -1
- package/lib/handle-icon/index.js +11 -4
- package/lib/handle-icon/index.js.map +1 -1
- package/lib/handle-icon/index.less +7 -2
- 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/query-form/Field/Checkbox.js +1 -1
- package/lib/query-form/Field/Checkbox.js.map +1 -1
- package/lib/query-form/Field/SelectInput.d.ts.map +1 -1
- package/lib/query-form/Field/SelectInput.js +3 -15
- package/lib/query-form/Field/SelectInput.js.map +1 -1
- package/lib/query-form/Field/fieldsMap.d.ts +3 -6
- package/lib/query-form/Field/fieldsMap.js +2 -2
- package/lib/query-form/Field/fieldsMap.js.map +1 -1
- package/lib/query-form/Field/index.d.ts.map +1 -1
- package/lib/query-form/Field/index.js +0 -1
- package/lib/query-form/Field/index.js.map +1 -1
- package/lib/query-form/index.d.ts +27 -15
- package/lib/query-form/index.d.ts.map +1 -1
- package/lib/query-form/index.js +356 -171
- package/lib/query-form/index.js.map +1 -1
- package/lib/query-form/index.less +60 -17
- package/lib/query-form-backup/Field/Composition/FieldPopover.less +35 -0
- package/lib/query-form-backup/Field/Composition/index.less +114 -0
- package/lib/query-form-backup/index.less +90 -0
- package/lib/table/expand.less +51 -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 +106 -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 +17 -31
- package/lib/table/table.d.ts +4 -1
- package/lib/table/table.d.ts.map +1 -1
- package/lib/table/table.js +112 -11
- package/lib/table/table.js.map +1 -1
- package/lib/table/table.less +8 -19
- 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.d.ts.map +1 -1
- package/lib/table-container/index.js +1 -1
- package/lib/table-container/index.js.map +1 -1
- package/lib/tabs-container/index.js +1 -1
- package/lib/tabs-container/index.js.map +1 -1
- 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-action/Action.js +62 -12
- package/lib/tntd-action/Action.js.map +1 -1
- package/lib/tntd-action/index.less +5 -3
- package/package.json +3 -2
|
@@ -10,7 +10,7 @@ var __rest = this && this.__rest || function (s, e) {
|
|
|
10
10
|
* @Author: 周泽飞 zefei.zhou@tongdun.net
|
|
11
11
|
* @Date: 2024-06-08 11:59:04
|
|
12
12
|
* @LastEditors: 周泽飞 zefei.zhou@tongdun.net
|
|
13
|
-
* @LastEditTime: 2024-06-
|
|
13
|
+
* @LastEditTime: 2024-06-26 19:08:00
|
|
14
14
|
* @FilePath: /tntd/packages/tntd/src/descriptions/descriptions.tsx
|
|
15
15
|
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
|
|
16
16
|
*/
|
|
@@ -83,19 +83,22 @@ export const Descriptions = forwardRef((_a, ref) => {
|
|
|
83
83
|
labelPrefix,
|
|
84
84
|
children: childContext
|
|
85
85
|
} = childProps;
|
|
86
|
-
return React.
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
prefix: React.createElement("div", {
|
|
90
|
-
className: "tnt-descriptions-label-title"
|
|
91
|
-
}, React.createElement(Ellipsis, {
|
|
92
|
-
prefix: labelPrefix ? React.createElement("span", {
|
|
93
|
-
className: "tnt-descriptions-label-tag"
|
|
94
|
-
}, labelPrefix) : null,
|
|
86
|
+
return React.cloneElement(child, Object.assign(Object.assign({}, child.props), {
|
|
87
|
+
label: null,
|
|
88
|
+
children: React.createElement(Ellipsis, {
|
|
95
89
|
lines: ellipsisLine,
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
90
|
+
className: "tnt-descriptions-item",
|
|
91
|
+
prefix: React.createElement("div", {
|
|
92
|
+
className: "tnt-descriptions-label-title"
|
|
93
|
+
}, React.createElement(Ellipsis, {
|
|
94
|
+
prefix: labelPrefix ? React.createElement("span", {
|
|
95
|
+
className: "tnt-descriptions-label-tag"
|
|
96
|
+
}, labelPrefix) : null,
|
|
97
|
+
lines: ellipsisLine,
|
|
98
|
+
title: label
|
|
99
|
+
})),
|
|
100
|
+
title: childContext
|
|
101
|
+
})
|
|
99
102
|
}));
|
|
100
103
|
}
|
|
101
104
|
}), tdDescriptions && bordered && ellipsis && !hideTooltip && React.Children.map(children, child => {
|
|
@@ -104,7 +107,8 @@ export const Descriptions = forwardRef((_a, ref) => {
|
|
|
104
107
|
const {
|
|
105
108
|
label,
|
|
106
109
|
labelPrefix,
|
|
107
|
-
children: childContext
|
|
110
|
+
children: childContext,
|
|
111
|
+
ellipsis = true
|
|
108
112
|
} = childProps;
|
|
109
113
|
return React.cloneElement(child, Object.assign(Object.assign({}, child.props), {
|
|
110
114
|
label: React.createElement(Ellipsis, {
|
|
@@ -114,10 +118,10 @@ export const Descriptions = forwardRef((_a, ref) => {
|
|
|
114
118
|
lines: ellipsisLine,
|
|
115
119
|
title: label
|
|
116
120
|
}),
|
|
117
|
-
children: React.createElement(Ellipsis, {
|
|
121
|
+
children: ellipsis ? React.createElement(Ellipsis, {
|
|
118
122
|
lines: ellipsisLine,
|
|
119
123
|
title: childContext
|
|
120
|
-
})
|
|
124
|
+
}) : childContext
|
|
121
125
|
}));
|
|
122
126
|
}
|
|
123
127
|
}), (!tdDescriptions || bordered && !ellipsis || hideTooltip) && children);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"descriptions.js","sourceRoot":"","sources":["../../src/descriptions/descriptions.tsx"],"names":[],"mappings":";;;;;;;;;;;AAAA;;;;;;;GAOG;AACH,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,MAAM,OAAO,CAAA;AAGzC,OAAO,UAAU,MAAM,YAAY,CAAA;AACnC,OAAO,OAAO,MAAM,6BAA6B,CAAA;AACjD,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAA;AACxD,OAAO,EAAE,OAAO,IAAI,gBAAgB,EAAE,MAAM,sBAAsB,CAAA;AAElE,OAAO,QAAQ,MAAM,aAAa,CAAA;AAClC,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAA;AACvC,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAA;AAE5C,cAAc,sBAAsB,CAAA;AAyBpC,MAAM,CAAC,MAAM,YAAY,GAAG,UAAU,CAIpC,CACE,EAWC,EACD,GAAG,EACH,EAAE;QAbF,EACE,SAAS,EACT,MAAM,GAAG,IAAI,EACb,WAAW,EACX,SAAS,EACT,KAAK,EACL,QAAQ,EACR,SAAS,GAAG,KAAK,EACjB,eAAe,GAAG,EAAE,EACpB,KAAK,OAEN,EADI,IAAI,cAVT,iHAWC,CADQ;IAIT,OAAO,CACL,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AAU,GAAG,CAAC,KAAK,CAAC,KAAK,IAAI,EAAE,CAAQ,CAAA;wBAC7C,MAAM,EAAE,KAAK,EAAE,WAAW,EAAE,QAAQ,EAAE,YAAY,EAAE,GAAG,UAAU,CAAA;wBACjE,OAAO,KAAK,CAAC,YAAY,CAAC,KAAK,kCAC1B,KAAK,CAAC,KAAK,KACd,KAAK,EAAE,CACL,oBAAC,QAAQ,IACP,MAAM,EACJ,WAAW,CAAC,CAAC,CAAC,CACZ,8BAAM,SAAS,EAAC,4BAA4B,IAAE,WAAW,CAAQ,CAClE,CAAC,CAAC,CAAC,IAAI,EAEV,KAAK,EAAE,YAAY,EACnB,KAAK,EAAE,KAAK,GACZ,CACH,EACD,QAAQ,EAAE,oBAAC,QAAQ,IAAC,KAAK,EAAE,YAAY,EAAE,KAAK,EAAE,YAAY,GAAI,IAChE,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,YAAY,CAAC,IAAI,GAAG,gBAAgB,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-06-08 13:39:25\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/es/descriptions'\nimport type { DescriptionsItemProps as AntdDescriptionsItemProps } from 'antd/es/descriptions'\nimport classNames from 'classnames'\nimport toArray from 'rc-util/es/Children/toArray'\nimport { ConfigConsumer } from 'antd/es/config-provider'\nimport { default as AntdDescriptions } from 'antd/es/descriptions'\n\nimport Ellipsis from '../ellipsis'\nimport { doUpperTitle } from '../utils'\nimport { getLanguage } from '../prev-locale'\n\nexport * from 'antd/es/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,\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 (\n <div>\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 </div>\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 { label, labelPrefix, children: childContext } = 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 lines={ellipsisLine} title={childContext} />,\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"]}
|
|
1
|
+
{"version":3,"file":"descriptions.js","sourceRoot":"","sources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AAC,CAAC,CAAC,IAAI,EAEV,KAAK,EAAE,YAAY,EACnB,KAAK,EAAE,KAAK,GACZ,CACH,EACD,QAAQ,EAAE,QAAQ,CAAC,CAAC,CAAC,CACnB,oBAAC,QAAQ,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,YAAY,CAAC,IAAI,GAAG,gBAAgB,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-06-26 19:08:00\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/es/descriptions'\nimport type { DescriptionsItemProps as AntdDescriptionsItemProps } from 'antd/es/descriptions'\nimport classNames from 'classnames'\nimport toArray from 'rc-util/es/Children/toArray'\nimport { ConfigConsumer } from 'antd/es/config-provider'\nimport { default as AntdDescriptions } from 'antd/es/descriptions'\n\nimport Ellipsis from '../ellipsis'\nimport { doUpperTitle } from '../utils'\nimport { getLanguage } from '../prev-locale'\n\nexport * from 'antd/es/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,\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"]}
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
background-color: @primary-color;
|
|
37
37
|
border-radius: @border-radius-base;//8px;
|
|
38
38
|
position: absolute;
|
|
39
|
-
top:
|
|
39
|
+
top:5px;
|
|
40
40
|
left:0;
|
|
41
41
|
}
|
|
42
42
|
}
|
|
@@ -109,11 +109,15 @@
|
|
|
109
109
|
.@{descriptions-prefix-cls}-item-content{
|
|
110
110
|
display: flex;
|
|
111
111
|
width: 100%;
|
|
112
|
+
height:100%;
|
|
113
|
+
align-items: center;
|
|
112
114
|
&>.tntd-ellipsis,>.tnt-ellipsis{
|
|
113
115
|
width: 100%;
|
|
116
|
+
height: 100%;
|
|
117
|
+
align-items: center;
|
|
114
118
|
.tnt-descriptions-label-title{
|
|
115
119
|
max-width: 70%;
|
|
116
|
-
margin-right:
|
|
120
|
+
margin-right: 8px;
|
|
117
121
|
color: tint(@bg-color-spotilight, 50%);//#8B919E;
|
|
118
122
|
overflow: hidden;
|
|
119
123
|
text-overflow: ellipsis;
|
package/es/drawer/drawer.js
CHANGED
|
@@ -10,6 +10,7 @@ import { ConfigConsumer } from 'antd/es/config-provider';
|
|
|
10
10
|
import { default as AntdDrawer } from 'antd/es/drawer';
|
|
11
11
|
import LocaleReceiver from 'antd/es/locale-provider/LocaleReceiver';
|
|
12
12
|
import classNames from 'classnames';
|
|
13
|
+
import { doUpperTitle } from '../utils';
|
|
13
14
|
import React, { useEffect } from 'react';
|
|
14
15
|
import { Button } from '../button';
|
|
15
16
|
import Icon from '../icon';
|
|
@@ -52,9 +53,12 @@ export const Drawer = _a => {
|
|
|
52
53
|
confirmLoading = false,
|
|
53
54
|
okButtonProps = {},
|
|
54
55
|
cancelButtonProps = {},
|
|
55
|
-
clickOnBlankToClose = false
|
|
56
|
+
clickOnBlankToClose = false,
|
|
57
|
+
upperCaseIgnore,
|
|
58
|
+
unUpperConverted,
|
|
59
|
+
title
|
|
56
60
|
} = _a,
|
|
57
|
-
rest = __rest(_a, ["closable", "className", "footer", "showFooter", "onClose", "onSubmit", "onCancel", "onOk", "okText", "cancelText", "locale", "okType", "cancelType", "confirmLoading", "okButtonProps", "cancelButtonProps", "clickOnBlankToClose"]);
|
|
61
|
+
rest = __rest(_a, ["closable", "className", "footer", "showFooter", "onClose", "onSubmit", "onCancel", "onOk", "okText", "cancelText", "locale", "okType", "cancelType", "confirmLoading", "okButtonProps", "cancelButtonProps", "clickOnBlankToClose", "upperCaseIgnore", "unUpperConverted", "title"]);
|
|
58
62
|
const drawerDom = React.useRef(null);
|
|
59
63
|
const _onCancel = onCancel || onClose;
|
|
60
64
|
const _onOk = onOk || onSubmit;
|
|
@@ -99,7 +103,9 @@ export const Drawer = _a => {
|
|
|
99
103
|
closable: false,
|
|
100
104
|
onClose: _onCancel,
|
|
101
105
|
width: 480
|
|
102
|
-
}, rest
|
|
106
|
+
}, rest, {
|
|
107
|
+
title: !unUpperConverted ? doUpperTitle(title, upperCaseIgnore) : title
|
|
108
|
+
}), React.createElement(React.Fragment, null, closable !== false && React.createElement(Icon, {
|
|
103
109
|
type: "close",
|
|
104
110
|
className: `${prefixCls}-close`,
|
|
105
111
|
onClick: _onCancel
|
package/es/drawer/drawer.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"drawer.js","sourceRoot":"","sources":["../../src/drawer/drawer.tsx"],"names":[],"mappings":";;;;;;;;;;;AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAA;AAExD,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,gBAAgB,CAAA;AACtD,OAAO,cAAc,MAAM,wCAAwC,CAAA;AACnE,OAAO,UAAU,MAAM,YAAY,CAAA;
|
|
1
|
+
{"version":3,"file":"drawer.js","sourceRoot":"","sources":["../../src/drawer/drawer.tsx"],"names":[],"mappings":";;;;;;;;;;;AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAA;AAExD,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,gBAAgB,CAAA;AACtD,OAAO,cAAc,MAAM,wCAAwC,CAAA;AACnE,OAAO,UAAU,MAAM,YAAY,CAAA;AAGnC,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAA;AACvC,OAAO,KAAK,EAAE,EAAM,SAAS,EAAU,MAAM,OAAO,CAAA;AACpD,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAA;A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CAAC;gBAED,oBAAC,UAAU,kBACT,SAAS,EAAE,UAAU,CAAC,SAAS,EAAE,YAAY,EAAE,SAAS,EAAE;wBACxD,CAAC,GAAG,SAAS,mBAAmB,CAAC,EAAE,QAAQ,KAAK,KAAK;wBACrD,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,YAAY,CAAC,KAAK,EAAE,eAAe,CAAC,CAAC,CAAC,CAAC,KAAK;oBAEvE;wBACG,QAAQ,KAAK,KAAK,IAAI,CACrB,oBAAC,IAAI,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,6BAAK,SAAS,EAAE,GAAG,SAAS,eAAe,IACxC,MAAM,IAAI,CACT,oBAAC,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","sourcesContent":["import { ConfigConsumer } from 'antd/es/config-provider'\nimport type { DrawerProps as AntdDrawerProps } from 'antd/es/drawer'\nimport { default as AntdDrawer } from 'antd/es/drawer'\nimport LocaleReceiver from 'antd/es/locale-provider/LocaleReceiver'\nimport classNames from 'classnames'\nimport type { BaseButtonProps } from 'antd/es/button/button'\nimport type { TntButtonType } from '../button/button'\nimport { doUpperTitle } from '../utils'\nimport React, { FC, 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?: TntButtonType\n cancelType: TntButtonType\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 onOk?: () => void\n okText?: string\n cancelText?: string\n locale?: {\n okText?: string\n cancelText?: string\n }\n okType?: TntButtonType\n cancelType?: TntButtonType\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 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 = onCancel || onClose\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', 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/es/handle-icon/index.js
CHANGED
|
@@ -14,6 +14,7 @@ import PopConfirm from "../popconfirm";
|
|
|
14
14
|
import Divider from '../divider';
|
|
15
15
|
import Dropdown from '../dropdown';
|
|
16
16
|
import Tooltip from '../tooltip';
|
|
17
|
+
import { doUpperTitle } from '../utils';
|
|
17
18
|
import Menu from '../menu';
|
|
18
19
|
import './index.less';
|
|
19
20
|
const HandleIcon = props => {
|
|
@@ -144,9 +145,12 @@ HandleIcon.Item = props => {
|
|
|
144
145
|
desc,
|
|
145
146
|
tooltip = true,
|
|
146
147
|
inMore,
|
|
147
|
-
disabled
|
|
148
|
+
disabled,
|
|
149
|
+
upperCaseIgnore = []
|
|
148
150
|
} = props,
|
|
149
|
-
rest = __rest(props, ["children", "title", "desc", "tooltip", "inMore", "disabled"]);
|
|
151
|
+
rest = __rest(props, ["children", "title", "desc", "tooltip", "inMore", "disabled", "upperCaseIgnore"]);
|
|
152
|
+
const upTitle = doUpperTitle(title, upperCaseIgnore);
|
|
153
|
+
;
|
|
150
154
|
const replaceIconWithText = element => {
|
|
151
155
|
if (React.isValidElement(element)) {
|
|
152
156
|
const {
|
|
@@ -157,14 +161,16 @@ HandleIcon.Item = props => {
|
|
|
157
161
|
if (disabled) {
|
|
158
162
|
disabledProps = {
|
|
159
163
|
disabled,
|
|
160
|
-
onClick:
|
|
164
|
+
onClick: e => {
|
|
165
|
+
e.stopPropagation();
|
|
166
|
+
},
|
|
161
167
|
className: ((eleProps === null || eleProps === void 0 ? void 0 : eleProps.className) || "") + (disabled ? ' disabled' : "")
|
|
162
168
|
};
|
|
163
169
|
}
|
|
164
170
|
// 如果是更多需要替换文字
|
|
165
171
|
if (type === Icon || type === 'img') {
|
|
166
172
|
if (inMore) {
|
|
167
|
-
return React.createElement("a", Object.assign({}, eleProps, disabledProps),
|
|
173
|
+
return React.createElement("a", Object.assign({}, eleProps, disabledProps), upTitle);
|
|
168
174
|
}
|
|
169
175
|
}
|
|
170
176
|
if (disabled && (type === Icon || ['img', 'a'].includes(type))) {
|
|
@@ -187,7 +193,7 @@ HandleIcon.Item = props => {
|
|
|
187
193
|
}
|
|
188
194
|
if ((inMore && desc || !inMore) && tooltip) {
|
|
189
195
|
return React.createElement(Tooltip, Object.assign({
|
|
190
|
-
title: desc ||
|
|
196
|
+
title: disabled ? desc || upTitle : upTitle
|
|
191
197
|
}, rest || {}), newChildren);
|
|
192
198
|
}
|
|
193
199
|
return newChildren;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/handle-icon/index.js"],"names":[],"mappings":";;;;;;;;;;;AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,cAAc,MAAM,wCAAwC,CAAA;AACnE,OAAO,OAAO,MAAM,6BAA6B,CAAC;AAClD,OAAO,IAAI,MAAM,SAAS,CAAA;AAC1B,OAAO,UAAU,MAAM,eAAe,CAAA;AACtC,OAAO,OAAO,MAAM,YAAY,CAAA;AAChC,OAAO,QAAQ,MAAM,aAAa,CAAA;AAClC,OAAO,OAAO,MAAM,YAAY,CAAA;AAChC,OAAO,IAAI,MAAM,SAAS,CAAA;AAC1B,OAAO,cAAc,CAAA;AAErB,MAAM,UAAU,GAAI,CAAC,KAAK,EAAE,EAAE;IAC5B,OAAO,CACL,oBAAC,cAAc,IAAC,aAAa,EAAC,YAAY,IACvC,GAAG,EAAE;QACJ,MAAM,KAOF,KAAK,IAAI,EAAE,EAPT,EACF,QAAQ,GAAG,EAAE,EACb,GAAG,GAAG,CAAC,EACP,OAAO,GAAG,KAAK,EACf,eAAe,GAAC,IAAI,EACpB,IAAI,GAAE,OAAO,OAEF,EADR,IAAI,cANL,yDAOL,CAAc,CAAA;QAGf,IAAI,WAAW,GAAG,EAAE,CAAA;QACpB,IAAI,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE;YAC3B,WAAW,GAAG,CAAA,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,KAAI,EAAE,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AO,EAAC;QACxC,OAAO,CACH,oBAAC,OAAO,kBAAC,KAAK,EAAE,IAAI,IAAE,KAAK,IAAM,CAAC,IAAI,IAAE,EAAE,CAAC,GACtC,WAAW,CACN,CACb,CAAA;KACJ;IAED,OAAO,WAAW,CAAA;AAEtB,CAAC,CAAA;AACD,eAAe,UAAU,CAAA","sourcesContent":["import React from 'react'\nimport LocaleReceiver from 'antd/es/locale-provider/LocaleReceiver'\nimport toArray from \"rc-util/es/Children/toArray\";\nimport Icon from '../icon'\nimport PopConfirm from \"../popconfirm\"\nimport Divider from '../divider'\nimport Dropdown from '../dropdown'\nimport Tooltip from '../tooltip'\nimport Menu from '../menu'\nimport './index.less'\n\nconst HandleIcon = (props) => {\n return (\n <LocaleReceiver componentName=\"HandleIcon\">\n {() => {\n const {\n children = [],\n num = 5,\n divider = false,\n stopPropagation=true,\n size= 'large',\n ...rest\n } = props || {}\n\n \n let newChildren = []\n if (Array.isArray(children)) {\n newChildren = children?.filter((item) => !!item) || []\n } else if (children) {\n newChildren.push(children)\n }\n\n const flattenChildren = (children) => {\n if (!children) {\n return [];\n }\n return toArray(children).reduce(function (flatChildren, child) {\n if (child && child.type === React.Fragment) {\n return flatChildren.concat(flattenChildren(child.props.children));\n }\n \n flatChildren.push(child);\n return flatChildren;\n }, []);\n }\n\n // 解决需要Fragment包的场景\n newChildren = flattenChildren(newChildren);\n\n let [preChildPart, lastChildPart] = [newChildren, null];\n \n // 只有1个时不适配\n if (newChildren.length - num === 1) {\n preChildPart = newChildren\n } else if (newChildren && num && !isNaN(num) && newChildren.length > num) {\n preChildPart = newChildren.slice(0, num)\n lastChildPart = newChildren.slice(num)\n }\n \n if (divider && preChildPart) {\n preChildPart = preChildPart?.map((dom, i) => (\n <>\n {dom}\n {!(\n (i === preChildPart?.length - 1 && !lastChildPart?.length) // 没有更多 且 是最后一个时 不显示 Divider\n ) && <Divider type=\"vertical\" />}\n </>\n ))\n }\n\n const decoratePopconfirm = (element, parentElement) => {\n if (React.isValidElement(element)) {\n const { type, props } = element;\n if (type === PopConfirm ) {\n const placement = { placement: 'left' }\n const {disabled} = parentElement?.props||{}\n let disableProps={};\n if(disabled){\n disableProps={\n disabled,\n onConfirm:()=>{}\n };\n }\n return React.cloneElement(element, {\n overlayStyle: { width: 180 },\n ...(props || {}),\n onClick: (e) => e.stopPropagation(),\n ...placement,\n trigger: 'hover',\n getPopupContainer: (trigger) => trigger.parentNode,\n ...disableProps||{}\n })\n }\n if (props && props.children) {\n const modifiedChildren = React.Children.map(props.children, (child) => {\n return decoratePopconfirm(child,element);\n });\n return React.cloneElement(element, props, modifiedChildren);\n }\n }\n return element;\n };\n \n\n // 对更多的popConfirm\n if(lastChildPart?.length){\n lastChildPart?.forEach((v, i) => {\n v = decoratePopconfirm(v);\n lastChildPart[i] = React.cloneElement(v, {\n ...(v?.props || {}),\n inMore:true,\n })\n }) \n }\n \n const menu = (childArr)=>(\n <Menu className={`menu-handle-icon-more tnt-handle-icon-${size}`}>\n {\n childArr?.map(\n (child,i) => (\n <Menu.Item key={i}>\n {child}\n </Menu.Item>\n )\n )\n }\n </Menu>\n );\n\n return (\n <div\n onClick={(e) => {\n if(stopPropagation){\n e.stopPropagation()\n }\n }}\n {...rest}\n className={`tnt-handle-icon-wrap tnt-handle-icon-${size} ${rest?.className||''}`}\n >\n {preChildPart}\n {!!lastChildPart?.length && (\n <Dropdown \n overlay={menu(lastChildPart || [])} \n arrow \n onClick={(e)=>{\n stopPropagation && e.stopPropagation()\n }}\n >\n <Icon type=\"more\" className='tnt-handle-icon-more'/>\n </Dropdown>\n )}\n </div>\n )\n }}\n </LocaleReceiver>\n )\n}\n\nHandleIcon.Item = (props) => {\n const {children, title, desc, tooltip=true, inMore, disabled,...rest} = props\n const replaceIconWithText = (element) => {\n if (React.isValidElement(element)) {\n const { type, props:eleProps } = element;\n let disabledProps = {}\n if(disabled){\n disabledProps = {\n disabled,\n onClick:()=>{},\n className:(eleProps?.className || \"\")+ (disabled?' disabled':\"\")\n }\n }\n // 如果是更多需要替换文字\n if (type === Icon || type ==='img') {\n if(inMore){\n return (\n <a \n {...eleProps}\n {...disabledProps}\n \n >{title}</a>\n );\n }\n }\n\n if(disabled && (type===Icon || ['img','a'].includes(type))){\n return React.cloneElement(element, {\n ...element?.props || {} ,\n ...disabledProps||{}\n })\n }\n\n if (eleProps && eleProps.children) {\n const modifiedChildren = React.Children.map(eleProps.children, (child) => {\n return replaceIconWithText(child);\n });\n return React.cloneElement(element, eleProps, modifiedChildren);\n }\n }\n return element;\n };\n\n let newChildren = children;\n if(Array.isArray(newChildren)){\n newChildren= children?.map(child=> replaceIconWithText(child))\n }else{\n newChildren= replaceIconWithText(children)\n }\n\n if(((inMore && desc) || !inMore) && tooltip){\n return (\n <Tooltip title={desc||title} {...(rest||{})}>\n {newChildren}\n </Tooltip>\n )\n }\n\n return newChildren\n \n}\nexport default HandleIcon"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/handle-icon/index.js"],"names":[],"mappings":";;;;;;;;;;;AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,cAAc,MAAM,wCAAwC,CAAA;AACnE,OAAO,OAAO,MAAM,6BAA6B,CAAC;AAClD,OAAO,IAAI,MAAM,SAAS,CAAA;AAC1B,OAAO,UAAU,MAAM,eAAe,CAAA;AACtC,OAAO,OAAO,MAAM,YAAY,CAAA;AAChC,OAAO,QAAQ,MAAM,aAAa,CAAA;AAClC,OAAO,OAAO,MAAM,YAAY,CAAA;AAChC,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAA;AACvC,OAAO,IAAI,MAAM,SAAS,CAAA;AAC1B,OAAO,cAAc,CAAA;AAErB,MAAM,UAAU,GAAI,CAAC,KAAK,EAAE,EAAE;IAC5B,OAAO,CACL,oBAAC,cAAc,IAAC,aAAa,EAAC,YAAY,IACvC,GAAG,EAAE;QACJ,MAAM,KAOF,KAAK,IAAI,EAAE,EAPT,EACF,QAAQ,GAAG,EAAE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AAC,CAAC;gBACH,OAAO,KAAK,CAAC,YAAY,CAAC,OAAO,EAAE,QAAQ,EAAE,gBAAgB,CAAC,CAAC;aAClE;SACJ;QACD,OAAO,OAAO,CAAC;IACnB,CAAC,CAAC;IAEF,IAAI,WAAW,GAAG,QAAQ,CAAC;IAC3B,IAAG,KAAK,CAAC,OAAO,CAAC,WAAW,CAAC,EAAC;QAC1B,WAAW,GAAE,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,GAAG,CAAC,KAAK,CAAA,EAAE,CAAC,mBAAmB,CAAC,KAAK,CAAC,CAAC,CAAA;KACjE;SAAI;QACD,WAAW,GAAE,mBAAmB,CAAC,QAAQ,CAAC,CAAA;KAC7C;IAGD,IAAG,CAAC,CAAC,MAAM,IAAI,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,OAAO,EAAC;QACxC,OAAO,CACH,oBAAC,OAAO,kBAAC,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC,IAAI,IAAE,OAAO,CAAC,CAAC,CAAC,CAAC,OAAO,IAAM,CAAC,IAAI,IAAE,EAAE,CAAC,GAC/D,WAAW,CACN,CACb,CAAA;KACJ;IAED,OAAO,WAAW,CAAA;AAEtB,CAAC,CAAA;AACD,eAAe,UAAU,CAAA","sourcesContent":["import React from 'react'\nimport LocaleReceiver from 'antd/es/locale-provider/LocaleReceiver'\nimport toArray from \"rc-util/es/Children/toArray\";\nimport Icon from '../icon'\nimport PopConfirm from \"../popconfirm\"\nimport Divider from '../divider'\nimport Dropdown from '../dropdown'\nimport Tooltip from '../tooltip'\nimport { doUpperTitle } from '../utils'\nimport Menu from '../menu'\nimport './index.less'\n\nconst HandleIcon = (props) => {\n return (\n <LocaleReceiver componentName=\"HandleIcon\">\n {() => {\n const {\n children = [],\n num = 5,\n divider = false,\n stopPropagation=true,\n size= 'large',\n ...rest\n } = props || {}\n\n \n let newChildren = []\n if (Array.isArray(children)) {\n newChildren = children?.filter((item) => !!item) || []\n } else if (children) {\n newChildren.push(children)\n }\n\n const flattenChildren = (children) => {\n if (!children) {\n return [];\n }\n return toArray(children).reduce(function (flatChildren, child) {\n if (child && child.type === React.Fragment) {\n return flatChildren.concat(flattenChildren(child.props.children));\n }\n \n flatChildren.push(child);\n return flatChildren;\n }, []);\n }\n\n // 解决需要Fragment包的场景\n newChildren = flattenChildren(newChildren);\n\n let [preChildPart, lastChildPart] = [newChildren, null];\n \n // 只有1个时不适配\n if (newChildren.length - num === 1) {\n preChildPart = newChildren\n } else if (newChildren && num && !isNaN(num) && newChildren.length > num) {\n preChildPart = newChildren.slice(0, num)\n lastChildPart = newChildren.slice(num)\n }\n \n if (divider && preChildPart) {\n preChildPart = preChildPart?.map((dom, i) => (\n <>\n {dom}\n {!(\n (i === preChildPart?.length - 1 && !lastChildPart?.length) // 没有更多 且 是最后一个时 不显示 Divider\n ) && <Divider type=\"vertical\" />}\n </>\n ))\n }\n\n const decoratePopconfirm = (element, parentElement) => {\n if (React.isValidElement(element)) {\n const { type, props } = element;\n if (type === PopConfirm ) {\n const placement = { placement: 'left' }\n const {disabled} = parentElement?.props||{}\n let disableProps={};\n if(disabled){\n disableProps={\n disabled,\n onConfirm:()=>{}\n };\n }\n return React.cloneElement(element, {\n overlayStyle: { width: 180 },\n ...(props || {}),\n onClick: (e) => e.stopPropagation(),\n ...placement,\n trigger: 'hover',\n getPopupContainer: (trigger) => trigger.parentNode,\n ...disableProps||{}\n })\n }\n if (props && props.children) {\n const modifiedChildren = React.Children.map(props.children, (child) => {\n return decoratePopconfirm(child,element);\n });\n return React.cloneElement(element, props, modifiedChildren);\n }\n }\n return element;\n };\n \n\n // 对更多的popConfirm\n if(lastChildPart?.length){\n lastChildPart?.forEach((v, i) => {\n v = decoratePopconfirm(v);\n lastChildPart[i] = React.cloneElement(v, {\n ...(v?.props || {}),\n inMore:true,\n })\n }) \n }\n \n const menu = (childArr)=>(\n <Menu className={`menu-handle-icon-more tnt-handle-icon-${size}`}>\n {\n childArr?.map(\n (child,i) => (\n <Menu.Item key={i}>\n {child}\n </Menu.Item>\n )\n )\n }\n </Menu>\n );\n\n return (\n <div\n onClick={(e) => {\n if(stopPropagation){\n e.stopPropagation()\n }\n }}\n {...rest}\n className={`tnt-handle-icon-wrap tnt-handle-icon-${size} ${rest?.className||''}`}\n >\n {preChildPart}\n {!!lastChildPart?.length && (\n <Dropdown \n overlay={menu(lastChildPart || [])} \n arrow \n onClick={(e)=>{\n stopPropagation && e.stopPropagation()\n }}\n >\n <Icon type=\"more\" className='tnt-handle-icon-more'/>\n </Dropdown>\n )}\n </div>\n )\n }}\n </LocaleReceiver>\n )\n}\n\nHandleIcon.Item = (props) => {\n const {children, title, desc, tooltip=true, inMore, disabled,upperCaseIgnore=[],...rest} = props\n const upTitle = doUpperTitle(title,upperCaseIgnore);;\n\n const replaceIconWithText = (element) => {\n if (React.isValidElement(element)) {\n const { type, props:eleProps } = element;\n let disabledProps = {}\n if(disabled){\n disabledProps = {\n disabled,\n onClick:(e)=>{\n e.stopPropagation()\n },\n className:(eleProps?.className || \"\")+ (disabled?' disabled':\"\")\n }\n }\n // 如果是更多需要替换文字\n if (type === Icon || type ==='img') {\n if(inMore){\n return (\n <a \n {...eleProps}\n {...disabledProps}\n \n >{upTitle}</a>\n );\n }\n }\n\n if(disabled && (type===Icon || ['img','a'].includes(type))){\n return React.cloneElement(element, {\n ...element?.props || {} ,\n ...disabledProps||{}\n })\n }\n\n if (eleProps && eleProps.children) {\n const modifiedChildren = React.Children.map(eleProps.children, (child) => {\n return replaceIconWithText(child);\n });\n return React.cloneElement(element, eleProps, modifiedChildren);\n }\n }\n return element;\n };\n\n let newChildren = children;\n if(Array.isArray(newChildren)){\n newChildren= children?.map(child=> replaceIconWithText(child))\n }else{\n newChildren= replaceIconWithText(children)\n }\n\n\n if(((inMore && desc) || !inMore) && tooltip){\n return (\n <Tooltip title={disabled ? (desc||upTitle) : upTitle} {...(rest||{})}>\n {newChildren}\n </Tooltip>\n )\n }\n\n return newChildren\n \n}\nexport default HandleIcon"]}
|
|
@@ -30,19 +30,24 @@
|
|
|
30
30
|
.tnt-handle-icon-small{
|
|
31
31
|
.tntd-anticon{
|
|
32
32
|
font-size: @small-size;
|
|
33
|
+
cursor: pointer;
|
|
33
34
|
}
|
|
34
35
|
font-size: @small-size;
|
|
36
|
+
line-height: 22px;
|
|
35
37
|
}
|
|
36
38
|
.tnt-handle-icon-middle{
|
|
37
39
|
.tntd-anticon{
|
|
38
40
|
font-size: @middle-size;
|
|
41
|
+
cursor: pointer;
|
|
39
42
|
}
|
|
40
43
|
font-size: @middle-size;
|
|
44
|
+
line-height: 22px;
|
|
41
45
|
}
|
|
42
46
|
.tnt-handle-icon-large{
|
|
43
47
|
.tntd-anticon{
|
|
44
48
|
font-size: @large-size;
|
|
49
|
+
cursor: pointer;
|
|
45
50
|
}
|
|
46
51
|
font-size: @large-size;
|
|
47
|
-
|
|
48
|
-
|
|
52
|
+
line-height: 22px;
|
|
53
|
+
}
|
|
@@ -6,7 +6,7 @@ export default ((WrappedComponent, options = {}) => {
|
|
|
6
6
|
version,
|
|
7
7
|
className = ''
|
|
8
8
|
} = options;
|
|
9
|
-
const currentVersion = version ||
|
|
9
|
+
const currentVersion = version || 'v3';
|
|
10
10
|
return props => React.createElement("div", {
|
|
11
11
|
className: cn('tnt-page-v-container', 'tnt-current-' + currentVersion, className)
|
|
12
12
|
}, React.createElement(WrappedComponent, Object.assign({}, props, options)));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/page-container/index.js"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,YAAY,CAAA;AAC3B,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,cAAc,CAAA;AAErB,eAAe,CAAC,gBAAgB,EAAE,OAAO,GAAG,EAAE,EAAE,EAAE;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/page-container/index.js"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,YAAY,CAAA;AAC3B,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,cAAc,CAAA;AAErB,eAAe,CAAC,gBAAgB,EAAE,OAAO,GAAG,EAAE,EAAE,EAAE;IAC9C,MAAM,EAAE,OAAO,EAAE,SAAS,GAAG,EAAE,EAAE,GAAG,OAAO,CAAA;IAC3C,MAAM,cAAc,GAAG,OAAO,IAAI,IAAI,CAAC;IAEzC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAChB,6BAAK,SAAS,EAAE,EAAE,CAAC,sBAAsB,EAAE,cAAc,GAAG,cAAc,EAAE,SAAS,CAAC;QACpF,oBAAC,gBAAgB,oBAAK,KAAK,EAAM,OAAO,EAAI,CACxC,CACP,CAAA;AACH,CAAC,CAAA","sourcesContent":["import cn from 'classnames'\nimport React from 'react'\nimport './index.less'\n\nexport default (WrappedComponent, options = {}) => {\n const { version, className = '' } = options\n const currentVersion = version || 'v3';\n\n return (props) => (\n <div className={cn('tnt-page-v-container', 'tnt-current-' + currentVersion, className)}>\n <WrappedComponent {...props} {...options} />\n </div>\n )\n}\n"]}
|
package/es/page-loading/index.js
CHANGED
|
@@ -16,7 +16,7 @@ export default (props => {
|
|
|
16
16
|
version
|
|
17
17
|
} = props,
|
|
18
18
|
other = __rest(props, ["className", "version"]);
|
|
19
|
-
const currentVersion = version ||
|
|
19
|
+
const currentVersion = version || 'v3';
|
|
20
20
|
return React.createElement(LocaleReceiver, {
|
|
21
21
|
componentName: "PageLoading"
|
|
22
22
|
}, (locale, localeCode) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/page-loading/index.js"],"names":[],"mappings":";;;;;;;;;;;AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EAAE,MAAM,YAAY,CAAA;AAC3B,OAAO,cAAc,MAAM,wCAAwC,CAAA;AAEnE,OAAO,cAAc,CAAA;AAErB,eAAe,CAAC,KAAK,EAAE,EAAE;IACvB,MAAM,EAAE,SAAS,EAAE,OAAO,KAAe,KAAK,EAAf,KAAK,UAAK,KAAK,EAAxC,wBAAgC,CAAQ,CAAA;IAC9C,MAAM,cAAc,GAAG,OAAO,IAAI,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/page-loading/index.js"],"names":[],"mappings":";;;;;;;;;;;AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EAAE,MAAM,YAAY,CAAA;AAC3B,OAAO,cAAc,MAAM,wCAAwC,CAAA;AAEnE,OAAO,cAAc,CAAA;AAErB,eAAe,CAAC,KAAK,EAAE,EAAE;IACvB,MAAM,EAAE,SAAS,EAAE,OAAO,KAAe,KAAK,EAAf,KAAK,UAAK,KAAK,EAAxC,wBAAgC,CAAQ,CAAA;IAC9C,MAAM,cAAc,GAAG,OAAO,IAAI,IAAI,CAAA;IACtC,OAAO,CACL,oBAAC,cAAc,IAAC,aAAa,EAAC,aAAa,IACxC,CAAC,MAAM,EAAE,UAAU,EAAE,EAAE;QACtB,OAAO,CACL,2CAAK,SAAS,EAAE,EAAE,CAAC,4BAA4B,EAAE,cAAc,GAAG,cAAc,EAAE,SAAS,CAAC,IAAM,KAAK;YACrG,6BAAK,SAAS,EAAC,qBAAqB;gBAClC,kCAAO,MAAM,CAAC,IAAI,CAAQ,CACtB,CACF,CACP,CAAA;IACH,CAAC,CACc,CAClB,CAAA;AACH,CAAC,CAAC","sourcesContent":["import React from 'react'\nimport cn from 'classnames'\nimport LocaleReceiver from 'antd/es/locale-provider/LocaleReceiver'\n\nimport './index.less'\n\nexport default (props) => {\n const { className, version, ...other } = props\n const currentVersion = version || 'v3'\n return (\n <LocaleReceiver componentName=\"PageLoading\">\n {(locale, localeCode) => {\n return (\n <div className={cn('tnt-page-loading-container', 'tnt-current-' + currentVersion, className)} {...other}>\n <div className=\"tnt-page-loading-bg\">\n <span>{locale.text}</span>\n </div>\n </div>\n )\n }}\n </LocaleReceiver>\n )\n};\n"]}
|
|
@@ -15,7 +15,7 @@ export default (_a => {
|
|
|
15
15
|
} = _a,
|
|
16
16
|
props = __rest(_a, ["value", "onChange"]);
|
|
17
17
|
return React.createElement(Checkbox, Object.assign({}, props, {
|
|
18
|
-
checked:
|
|
18
|
+
checked: value,
|
|
19
19
|
onChange: evt => {
|
|
20
20
|
onChange === null || onChange === void 0 ? void 0 : onChange(evt.target.checked);
|
|
21
21
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Checkbox.js","sourceRoot":"","sources":["../../../src/query-form/Field/Checkbox.js"],"names":[],"mappings":";;;;;;;;;;;AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,OAAO,QAAQ,MAAM,gBAAgB,CAAA;AAErC,eAAe,CAAC,EAA6B,EAAE,EAAE;QAAjC,EAAE,KAAK,EAAE,QAAQ,OAAY,EAAP,KAAK,cAA3B,qBAA6B,CAAF;IAAO,OAAA,CAChD,oBAAC,QAAQ,oBACH,KAAK,IACT,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"Checkbox.js","sourceRoot":"","sources":["../../../src/query-form/Field/Checkbox.js"],"names":[],"mappings":";;;;;;;;;;;AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,OAAO,QAAQ,MAAM,gBAAgB,CAAA;AAErC,eAAe,CAAC,EAA6B,EAAE,EAAE;QAAjC,EAAE,KAAK,EAAE,QAAQ,OAAY,EAAP,KAAK,cAA3B,qBAA6B,CAAF;IAAO,OAAA,CAChD,oBAAC,QAAQ,oBACH,KAAK,IACT,OAAO,EAAE,KAAK,EACd,QAAQ,EAAE,CAAC,GAAG,EAAE,EAAE;YAChB,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAG,GAAG,CAAC,MAAM,CAAC,OAAO,CAAC,CAAA;QAChC,CAAC,IACD,CACH,CAAA;CAAA,CAAA","sourcesContent":["import React from 'react'\n\nimport Checkbox from '../../checkbox'\n\nexport default ({ value, onChange, ...props }) => (\n <Checkbox\n {...props}\n checked={value}\n onChange={(evt) => {\n onChange?.(evt.target.checked)\n }}\n />\n)\n"]}
|
|
@@ -17,11 +17,9 @@ export default (props => {
|
|
|
17
17
|
const {
|
|
18
18
|
options = [],
|
|
19
19
|
addonBeforeStyle,
|
|
20
|
-
selectProps
|
|
21
|
-
form,
|
|
22
|
-
close
|
|
20
|
+
selectProps
|
|
23
21
|
} = props,
|
|
24
|
-
inputProps = __rest(props, ["options", "addonBeforeStyle", "selectProps"
|
|
22
|
+
inputProps = __rest(props, ["options", "addonBeforeStyle", "selectProps"]);
|
|
25
23
|
const [items, setItems] = useState(options);
|
|
26
24
|
const getInitialKey = () => {
|
|
27
25
|
let key = _get(options, '0.value');
|
|
@@ -63,25 +61,9 @@ export default (props => {
|
|
|
63
61
|
setItems(options);
|
|
64
62
|
setKey(getInitialKey());
|
|
65
63
|
}, [options, inputProps.value]);
|
|
66
|
-
return React.createElement(Input
|
|
67
|
-
addonBefore: addonBefore,
|
|
68
|
-
onPressEnter: evt => {
|
|
69
|
-
var _a;
|
|
70
|
-
form.emit('search', {
|
|
71
|
-
[key]: (_a = evt === null || evt === void 0 ? void 0 : evt.target) === null || _a === void 0 ? void 0 : _a.value,
|
|
72
|
-
current: 1
|
|
73
|
-
});
|
|
74
|
-
close && close();
|
|
75
|
-
},
|
|
76
|
-
onSearch: value => {
|
|
77
|
-
form.emit('search', {
|
|
78
|
-
[key]: value,
|
|
79
|
-
current: 1
|
|
80
|
-
});
|
|
81
|
-
close && close();
|
|
82
|
-
}
|
|
83
|
-
}, inputProps, {
|
|
64
|
+
return React.createElement(Input, Object.assign({}, inputProps, {
|
|
84
65
|
value: getInputValue(),
|
|
66
|
+
addonBefore: addonBefore,
|
|
85
67
|
onChange: onChange
|
|
86
68
|
}));
|
|
87
69
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SelectInput.js","sourceRoot":"","sources":["../../../src/query-form/Field/SelectInput.js"],"names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,EAAE,aAAa,EAAE,EAAE,WAAW,EAAE,WAAW,EAAE,QAAQ,EAAE,QAAQ,IAAI,CAChG,CAAA;AACH,CAAC,CAAA","sourcesContent":["import React, { useState, useEffect } from 'react'\nimport { get } from 'lodash'\n\nimport Select from '../../select'\nimport Input from '../../input'\n\nconst { Option } = Select\n\nexport default (props) => {\n const { options = [], addonBeforeStyle, selectProps,...inputProps } = props\n const [items, setItems] = useState(options)\n const getInitialKey = () => {\n let key = get(options, '0.value')\n\n if (inputProps.value) {\n key = get(Object.keys(inputProps.value), '0') || key\n }\n\n return key\n }\n const [key, setKey] = useState(getInitialKey())\n const onKeyChange = (key) => {\n setKey(key)\n props.onChange({\n [key]: '',\n })\n }\n const onChange = (evt) => {\n props.onChange({\n [key]: evt.target.value,\n })\n }\n const addonBefore = (\n <Select\n value={key}\n onChange={onKeyChange}\n style={{\n width: '120px',\n ...addonBeforeStyle,\n }}\n dropdownMatchSelectWidth={false}\n {...(selectProps||{})}\n >\n {items.map(({ label, value }) => (\n <Option key={value} value={value}>\n {label}\n </Option>\n ))}\n </Select>\n )\n const getInputValue = () => {\n return get(inputProps.value, key)\n }\n\n useEffect(() => {\n setItems(options)\n setKey(getInitialKey())\n }, [options, inputProps.value])\n\n return (\n <Input {...inputProps} value={getInputValue()} addonBefore={addonBefore} onChange={onChange} />\n )\n}\n"]}
|
|
@@ -15,8 +15,8 @@ export const getFieldWidth = type => {
|
|
|
15
15
|
}[type] || defaultFieldWidth;
|
|
16
16
|
};
|
|
17
17
|
export default {
|
|
18
|
-
string: Input
|
|
19
|
-
input: Input
|
|
18
|
+
string: Input,
|
|
19
|
+
input: Input,
|
|
20
20
|
search: Input.Search,
|
|
21
21
|
inputNumber: InputNumber,
|
|
22
22
|
number: InputNumber,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fieldsMap.js","sourceRoot":"","sources":["../../../src/query-form/Field/fieldsMap.js"],"names":[],"mappings":"AAAA,OAAO,aAAa,MAAM,YAA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E,KAAK,CAAC,MAAM;IACpB,WAAW,EAAE,WAAW;IACxB,MAAM,EAAE,WAAW;IACnB,MAAM,EAAE,WAAW;IACnB,QAAQ,EAAE,aAAa;IACvB,IAAI,EAAE,UAAU;IAChB,SAAS,EAAE,UAAU,CAAC,WAAW;IACjC,WAAW,EAAE,WAAW;CACzB,CAAA","sourcesContent":["import CheckboxField from './Checkbox'\nimport SelectField from './Select'\nimport SelectInput from './SelectInput'\nimport DatePicker from '../../date-picker'\nimport Input from '../../input'\nimport InputNumber from '../../input-number'\n\nexport const defaultFieldWidth = '200px'\n\nexport const getFieldWidth = (type) => {\n if (type === 'dateRange') {\n return '340px'\n }\n\n return (\n {\n dateRange: '340px',\n selectInput: '320px',\n }[type] || defaultFieldWidth\n )\n}\n\nexport default {\n string: Input,\n input: Input,\n search: Input.Search,\n inputNumber: InputNumber,\n number: InputNumber,\n select: SelectField,\n checkbox: CheckboxField,\n date: DatePicker,\n dateRange: DatePicker.RangePicker,\n selectInput: SelectInput,\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/query-form/Field/index.js"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,aAAa,EAAE,MAAM,OAAO,CAAA;AAC5C,OAAO,EAAE,GAAG,EAAE,MAAM,QAAQ,CAAA;AAC5B,OAAO,SAAS,EAAE,EAAE,aAAa,EAAE,MAAM,aAAa,CAAA;AAEtD,OAAO,IAAI,MAAM,YAAY,CAAA;AAE7B,MAAM,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAA;AAE1B,MAAM,OAAO,GAAG,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,aAAa,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAA;AAErF,MAAM,CAAC,OAAO,OAAO,KAAM,SAAQ,aAAa;IAC9C,YAAY,KAAK;QACf,KAAK,CAAC,KAAK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EAAE,MAAA,GAAG,aAAH,GAAG,uBAAH,GAAG,CAAE,MAAM,0CAAE,KAAK,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC,CAAA,EAAA;oBACjE,QAAQ,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,EAAE,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;iBACxE;gBACD,CAAC,CAAC,EAAE,CAAC,EACH,UAAU,IACd,KAAK,kCACA,UAAU,aAAV,UAAU,uBAAV,UAAU,CAAE,KAAK,KACpB,KAAK,EAAE,eAAe,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAA,MAAA,UAAU,aAAV,UAAU,uBAAV,UAAU,CAAE,KAAK,0CAAE,KAAK,KAAI,aAAa,CAAC,IAAI,CAAC,KAEnF,QAAQ,EAAE,IAAI,CAAC,QAAQ,IACvB,CACO,CACZ,CAAA;IACH,CAAC;IA8BD,iBAAiB;QACf,MAAM,EAAE,IAAI,EAAE,GAAG,IAAI,CAAC,KAAK,CAAA;QAE3B,IAAI,CAAC,EAAE,CAAC,UAAU,EAAE,IAAI,CAAC,WAAW,CAAC,CAAA;QACrC,IAAI,CAAC,EAAE,CAAC,WAAW,EAAE,IAAI,CAAC,YAAY,CAAC,CAAA;IACzC,CAAC;IAED,oBAAoB;QAClB,MAAM,EAAE,IAAI,EAAE,GAAG,IAAI,CAAC,KAAK,CAAA;QAE3B,IAAI,CAAC,GAAG,CAAC,UAAU,EAAE,IAAI,CAAC,WAAW,CAAC,CAAA;QACtC,IAAI,CAAC,GAAG,CAAC,WAAW,EAAE,IAAI,CAAC,YAAY,CAAC,CAAA;IAC1C,CAAC;CACF","sourcesContent":["import React, { PureComponent } from 'react'\nimport { get } from 'lodash'\nimport fieldsMap, { getFieldWidth } from './fieldsMap'\n\nimport Form from '../../form'\n\nconst FormItem = Form.Item\n\nconst isInput = (type) => ['input', 'string', 'search', 'aloneSearch'].includes(type)\n\nexport default class Field extends PureComponent {\n constructor(props) {\n super(props)\n\n this.state = {\n value: props.initialValue,\n }\n }\n\n render () {\n const {\n type = 'input',\n title,\n name,\n isFieldInDrawer = false,\n className = '',\n component,\n form,\n props: fieldProps,\n } = this.props\n const { value } = this.state\n const Field = component || fieldsMap[type]\n\n return (\n <FormItem label={title} className={className}>\n <Field\n value={value}\n {...(isInput(type)\n ? {\n onPressEnter: (evt) =>\n form.emit('search', { [name]: evt?.target?.value, current: 1 }),\n onSearch: (value) => form.emit('search', { [name]: value, current: 1 })\n }\n : {})}\n {...fieldProps}\n style={{\n ...fieldProps?.style,\n width: isFieldInDrawer ? '100%' : fieldProps?.style?.width || getFieldWidth(type),\n }}\n onChange={this.onChange}\n />\n </FormItem>\n )\n }\n\n updateValue = (name, value) => {\n if (name === this.props.name) {\n this.setState({ value })\n this.props.onChange(name, value)\n }\n }\n\n onChange = (...args) => {\n const { name, type = 'input', component, props: fieldProps } = this.props\n const { onChange } = fieldProps || {}\n\n onChange && onChange(...args)\n\n // Input onChange第一个参数为Event对象,取值特殊处理\n if (!component && isInput(type)) {\n args[0] = get(args[0], 'target.value')\n }\n\n this.setState({ value: args[0] })\n this.props.onChange(name, args[0])\n }\n\n onFormChange = (formData) => {\n this.setState({\n value: get(formData, this.props.name),\n })\n }\n\n componentDidMount () {\n const { form } = this.props\n\n form.on('setValue', this.updateValue)\n form.on('setValues', this.onFormChange)\n }\n\n componentWillUnmount () {\n const { form } = this.props\n\n form.off('setValue', this.updateValue)\n form.off('setValues', this.onFormChange)\n }\n}\n"]}
|