tntd 3.0.0-beta.7 → 3.0.0-beta.8
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/drawer/drawer.js +4 -2
- package/es/drawer/drawer.js.map +1 -1
- package/es/handle/index.js +11 -8
- package/es/handle/index.js.map +1 -1
- package/es/handle/index.less +16 -0
- package/es/input/style/mixin.less +1 -1
- package/es/page-loading/index.js +8 -4
- package/es/page-loading/index.js.map +1 -1
- package/es/page-loading/index.less +33 -17
- package/es/query-form/Field/Composition/FieldPopover.js +70 -46
- package/es/query-form/Field/Composition/FieldPopover.js.map +1 -1
- package/es/query-form/Field/Composition/Select.js +8 -12
- package/es/query-form/Field/Composition/Select.js.map +1 -1
- package/es/query-form/Field/Composition/index.js +68 -44
- package/es/query-form/Field/Composition/index.js.map +1 -1
- package/es/query-form/Field/Composition/index.less +10 -2
- package/es/query-form/Field/SelectInput.js +22 -4
- 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 +1 -0
- package/es/query-form/Field/index.js.map +1 -1
- package/es/query-form/index.js +11 -5
- package/es/query-form/index.js.map +1 -1
- package/es/table-container/index.less +1 -1
- package/es/tabs-container/index.js +1 -0
- package/es/tabs-container/index.js.map +1 -1
- package/es/tabs-container/index.less +3 -3
- package/lib/drawer/drawer.d.ts.map +1 -1
- package/lib/drawer/drawer.js +4 -2
- package/lib/drawer/drawer.js.map +1 -1
- package/lib/handle/index.d.ts.map +1 -1
- package/lib/handle/index.js +18 -12
- package/lib/handle/index.js.map +1 -1
- package/lib/handle/index.less +16 -0
- package/lib/input/style/mixin.less +1 -1
- package/lib/page-loading/index.d.ts.map +1 -1
- package/lib/page-loading/index.js +7 -3
- package/lib/page-loading/index.js.map +1 -1
- package/lib/page-loading/index.less +33 -17
- package/lib/query-form/Field/Composition/FieldPopover.d.ts +7 -5
- package/lib/query-form/Field/Composition/FieldPopover.d.ts.map +1 -1
- package/lib/query-form/Field/Composition/FieldPopover.js +107 -79
- package/lib/query-form/Field/Composition/FieldPopover.js.map +1 -1
- package/lib/query-form/Field/Composition/Select.d.ts.map +1 -1
- package/lib/query-form/Field/Composition/Select.js +7 -11
- package/lib/query-form/Field/Composition/Select.js.map +1 -1
- package/lib/query-form/Field/Composition/index.d.ts +1 -1
- package/lib/query-form/Field/Composition/index.js +70 -51
- package/lib/query-form/Field/Composition/index.js.map +1 -1
- package/lib/query-form/Field/Composition/index.less +10 -2
- package/lib/query-form/Field/SelectInput.d.ts.map +1 -1
- package/lib/query-form/Field/SelectInput.js +15 -3
- package/lib/query-form/Field/SelectInput.js.map +1 -1
- package/lib/query-form/Field/fieldsMap.d.ts +6 -3
- 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 +1 -0
- package/lib/query-form/Field/index.js.map +1 -1
- package/lib/query-form/index.d.ts.map +1 -1
- package/lib/query-form/index.js +11 -5
- package/lib/query-form/index.js.map +1 -1
- package/lib/table-container/index.less +1 -1
- package/lib/tabs-container/index.d.ts +2 -1
- package/lib/tabs-container/index.d.ts.map +1 -1
- package/lib/tabs-container/index.js +3 -2
- package/lib/tabs-container/index.js.map +1 -1
- package/lib/tabs-container/index.less +3 -3
- package/package.json +1 -1
package/es/drawer/drawer.js
CHANGED
|
@@ -17,6 +17,8 @@ const DefaultFooter = ({
|
|
|
17
17
|
locale,
|
|
18
18
|
onClose,
|
|
19
19
|
onSubmit,
|
|
20
|
+
onCancel,
|
|
21
|
+
onOk,
|
|
20
22
|
okText,
|
|
21
23
|
okType,
|
|
22
24
|
cancelText,
|
|
@@ -25,13 +27,13 @@ const DefaultFooter = ({
|
|
|
25
27
|
cancelButtonProps
|
|
26
28
|
}) => {
|
|
27
29
|
return React.createElement(React.Fragment, null, React.createElement(Button, Object.assign({
|
|
28
|
-
onClick: onClose,
|
|
30
|
+
onClick: onCancel || onClose,
|
|
29
31
|
style: {
|
|
30
32
|
marginRight: 8
|
|
31
33
|
},
|
|
32
34
|
type: 'tertiary'
|
|
33
35
|
}, cancelButtonProps), cancelText || (locale === null || locale === void 0 ? void 0 : locale.cancelText)), React.createElement(Button, Object.assign({
|
|
34
|
-
onClick: onSubmit,
|
|
36
|
+
onClick: onOk || onSubmit,
|
|
35
37
|
type: okType,
|
|
36
38
|
loading: confirmLoading
|
|
37
39
|
}, okButtonProps), okText || (locale === null || locale === void 0 ? void 0 : locale.okText)));
|
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;AAInC,OAAO,KAAK,EAAE,EAAM,SAAS,EAAU,MAAM,OAAO,CAAA;AACpD,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAA;AAClC,OAAO,IAAI,MAAM,SAAS,CAAA;AAC1B,MAAM,aAAa,GAAG,CAAC,EACrB,MAAM,EACN,OAAO,EACP,QAAQ,EACR,MAAM,EACN,MAAM,EACN,UAAU,EACV,cAAc,EACd,aAAa,EACb,iBAAiB,
|
|
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,CA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,CAAC,MAAM,CAAA;gBAClC,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;qBACpC,CAAC,EACF,QAAQ,EAAE,KAAK,EACf,OAAO,EAAE,OAAO,EAChB,KAAK,EAAE,GAAG,IACN,IAAI;oBAER;wBACG,QAAQ,KAAK,KAAK,IAAI,CACrB,oBAAC,IAAI,IAAC,IAAI,EAAC,OAAO,EAAC,SAAS,EAAE,GAAG,SAAS,QAAQ,EAAE,OAAO,EAAE,OAAO,GAAI,CACzE;wBACA,IAAI,CAAC,QAAQ;wBACb,UAAU,IAAI,CACb,6BAAK,SAAS,EAAE,GAAG,SAAS,eAAe,IACxC,UAAU,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CACvB,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,OAAO,EAAE,OAAO,EAChB,QAAQ,EAAE,QAAQ,GAClB,CACH,CAAC,CAAC,CAAC,CACF,MAAM,CACP,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'\n\nimport React, { FC, useEffect, useRef } from 'react'\nimport { Button } from '../button'\nimport Icon from '../icon'\nconst DefaultFooter = ({\n locale,\n onClose,\n onSubmit,\n onCancel,\n onOk,\n okText,\n okType,\n cancelText,\n confirmLoading,\n okButtonProps,\n cancelButtonProps,\n}: {\n locale?: {\n okText?: string\n cancelText?: string\n }\n onClose?: () => void\n onSubmit?: () => void\n onCancel?: () => void\n onOk?: () => void\n okText: string\n cancelText: string\n okType?: TntButtonType\n confirmLoading?: boolean\n okButtonProps?: BaseButtonProps\n cancelButtonProps?: BaseButtonProps\n}) => {\n return (\n <>\n <Button\n onClick={onCancel || onClose}\n style={{ marginRight: 8 }}\n type={'tertiary'}\n {...cancelButtonProps}\n >\n {cancelText || locale?.cancelText}\n </Button>\n <Button onClick={onOk || onSubmit} type={okType} 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 okText?: string\n cancelText?: string\n locale?: {\n okText?: string\n cancelText?: string\n }\n okType?: TntButtonType\n confirmLoading?: boolean\n okButtonProps?: BaseButtonProps\n cancelButtonProps?: BaseButtonProps\n clickOnBlankToClose: boolean\n}\n\nexport const Drawer: FC<CustomDrawerProps> = ({\n closable = true,\n className,\n footer,\n showFooter,\n onClose,\n onSubmit,\n okText = '',\n cancelText = '',\n locale,\n okType = 'primary',\n confirmLoading = false,\n okButtonProps = {},\n cancelButtonProps = {},\n clickOnBlankToClose = false,\n ...rest\n}) => {\n const drawerDom = React.useRef<EventTarget | null>(null)\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 && onClose) {\n onClose()\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, onClose])\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,\n })}\n closable={false}\n onClose={onClose}\n width={480}\n {...rest}\n >\n <>\n {closable !== false && (\n <Icon type=\"close\" className={`${prefixCls}-close`} onClick={onClose} />\n )}\n {rest.children}\n {showFooter && (\n <div className={`${prefixCls}-footer-style`}>\n {showFooter && !footer ? (\n <DefaultFooter\n confirmLoading={confirmLoading}\n okButtonProps={okButtonProps}\n cancelButtonProps={cancelButtonProps}\n okType={okType}\n locale={locale}\n okText={okText}\n cancelText={cancelText}\n onClose={onClose}\n onSubmit={onSubmit}\n />\n ) : (\n footer\n )}\n </div>\n )}\n </>\n </AntdDrawer>\n </div>\n )\n }}\n </LocaleReceiver>\n )\n }}\n </ConfigConsumer>\n )\n}\n"]}
|
package/es/handle/index.js
CHANGED
|
@@ -8,7 +8,7 @@ var __rest = this && this.__rest || function (s, e) {
|
|
|
8
8
|
};
|
|
9
9
|
import React, { Fragment } from 'react';
|
|
10
10
|
import LocaleReceiver from 'antd/es/locale-provider/LocaleReceiver';
|
|
11
|
-
import Icon from '../
|
|
11
|
+
import Icon from '../icon';
|
|
12
12
|
import { doUpperTitle } from "../utils/lang";
|
|
13
13
|
import Divider from '../divider';
|
|
14
14
|
import Dropdown from '../dropdown';
|
|
@@ -22,13 +22,13 @@ export default (props => {
|
|
|
22
22
|
const _a = props || {},
|
|
23
23
|
{
|
|
24
24
|
children = [],
|
|
25
|
-
type,
|
|
26
|
-
num =
|
|
25
|
+
type = "icon",
|
|
26
|
+
num = 6,
|
|
27
27
|
lang,
|
|
28
|
-
divider =
|
|
29
|
-
lessOneMoreFit,
|
|
28
|
+
divider = false,
|
|
29
|
+
lessOneMoreFit = true,
|
|
30
30
|
popConfirmHandle,
|
|
31
|
-
isIconBtn,
|
|
31
|
+
isIconBtn = true,
|
|
32
32
|
stopPropagation = true,
|
|
33
33
|
upperCaseIgnore = [],
|
|
34
34
|
unUpperConverted = false
|
|
@@ -128,11 +128,14 @@ export default (props => {
|
|
|
128
128
|
e.stopPropagation();
|
|
129
129
|
}
|
|
130
130
|
}
|
|
131
|
-
}, rest
|
|
131
|
+
}, rest, {
|
|
132
|
+
className: `tnt-handle-wrap ${(rest === null || rest === void 0 ? void 0 : rest.className) || ''}`
|
|
133
|
+
}), preChildPart, !!(lastChildPart === null || lastChildPart === void 0 ? void 0 : lastChildPart.length) && React.createElement(Dropdown, {
|
|
132
134
|
overlay: menu(lastChildPart || []),
|
|
133
135
|
arrow: true
|
|
134
136
|
}, type === 'icon' ? React.createElement(Icon, {
|
|
135
|
-
type: "more"
|
|
137
|
+
type: "more",
|
|
138
|
+
className: 'tnt-handle-more'
|
|
136
139
|
}) : React.createElement("a", {
|
|
137
140
|
className: "ant-dropdown-more"
|
|
138
141
|
}, locale === null || locale === void 0 ? void 0 : locale.more, React.createElement("i", {
|
package/es/handle/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/handle/index.js"],"names":[],"mappings":";;;;;;;;;;;AAAA,OAAO,KAAK,EAAE,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AACvC,OAAO,cAAc,MAAM,wCAAwC,CAAA;AACnE,OAAO,IAAI,MAAM,cAAc,CAAA;AAC/B,OAAO,EAAC,YAAY,EAAC,MAAM,eAAe,CAAA;AA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,CAAC,CAAC,CAAC,CACjB,oBAAC,IAAI,IAAC,IAAI,EAAC,MAAM,GAAG,CACrB,CAAC,CAAC,CAAC,CACF,2BAAG,SAAS,EAAC,mBAAmB,IAC7B,MAAM,aAAN,MAAM;gBAAN,MAAM,CAAE,IAAI;gBACb,2BAAG,SAAS,EAAE,GAAG,SAAS,gBAAgB;oBACxC,oBAAC,IAAI,IAAC,IAAI,EAAC,MAAM,GAAG,CAClB,CACF,CACL,CACQ,CACZ,CACG,CACP,CAAA;IACH,CAAC,CACc,CAClB,CAAA;AACH,CAAC,CAAA","sourcesContent":["import React, { Fragment } from 'react'\nimport LocaleReceiver from 'antd/es/locale-provider/LocaleReceiver'\nimport Icon from '../tntd-icon'\nimport {doUpperTitle} from \"../utils/lang\"\nimport Divider from '../divider'\nimport Dropdown from '../dropdown'\nimport Menu from '../menu'\nimport './index.less'\n\nconst clsPrefix = 'tntd-more-menus'\n\n\nexport default (props) => {\n return (\n <LocaleReceiver componentName=\"Handle\">\n {(locale, localeCode) => {\n const {\n children = [],\n type,\n num = 3,\n lang,\n divider = true,\n lessOneMoreFit,\n popConfirmHandle,\n isIconBtn,\n stopPropagation=true,\n upperCaseIgnore=[],\n unUpperConverted=false,\n ...rest\n } = props || {}\n\n // 非中文\n let isCn = lang === 'cn'\n if (!lang) {\n isCn = localeCode === 'zh-cn'\n }\n\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\n // 非中文 且非 icon图标\n if(!unUpperConverted && !isCn && !isIconBtn ){\n newChildren?.forEach((v,i)=>{\n newChildren[i] = React.cloneElement(v, {\n ...(v?.props || {}),\n children: doUpperTitle(v.props.children, upperCaseIgnore)\n })\n })\n }\n\n // 子元素大于1个,且不是 icon元素\n const specialSceneDefaultShow = newChildren?.length > 1 && !isIconBtn\n\n if (specialSceneDefaultShow && (!isCn || popConfirmHandle)) {\n newChildren?.forEach((v, i) => {\n const { type, props } = v\n if (\n type?.name === 'Popconfirm' ||\n (props.hasOwnProperty('onConfirm') && typeof props?.onConfirm === 'function')\n ) {\n let placement = {}\n if (\n !isCn ||\n (num &&\n !isNaN(num) &&\n i + 1 > num &&\n !(lessOneMoreFit && newChildren.length - num === 1))\n ) {\n placement = {\n placement: 'left',\n }\n }\n newChildren[i] = React.cloneElement(v, {\n overlayStyle: { width: 180 },\n ...(v?.props || {}),\n onClick: (e) => e.stopPropagation(),\n ...placement,\n trigger: 'hover',\n getPopupContainer: (trigger) => trigger.parentNode,\n })\n }\n })\n }\n\n let [preChildPart, lastChildPart] = [newChildren, null]\n\n // 只有1个时不适配\n if (lessOneMoreFit && 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 const preChildLen = preChildPart.length\n preChildPart = preChildPart.map((dom, i) => (\n <Fragment key={i}>\n {dom}\n {!(\n (i === preChildLen - 1 && !lastChildPart?.length) // 没有更多 且 是最后一个时 不显示 Divider\n ) && <Divider type=\"vertical\" />}\n </Fragment>\n ))\n }\n const menu = (childArr)=>(\n <Menu className=\"org-pop-opera-btn\">\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\n if(!isCn && specialSceneDefaultShow ){\n return (\n <Dropdown overlay={menu(newChildren||[])} arrow onClick={(e)=>{\n if(stopPropagation){\n e.stopPropagation()\n }\n }}>\n {\n type === 'icon' ?\n <Icon type=\"more\" /> :\n <a className=\"ant-dropdown-more\">\n {locale?.more}\n <i className={`${clsPrefix}-dropdown-icon`}>\n <Icon type=\"down\" />\n </i>\n </a>\n }\n </Dropdown>\n );\n }\n\n return (\n <div\n onClick={(e) => {\n if(stopPropagation){\n e.stopPropagation()\n }\n }}\n {...rest}\n >\n {preChildPart}\n {!!lastChildPart?.length && (\n <Dropdown overlay={menu(lastChildPart || [])} arrow>\n {type === 'icon' ? (\n <Icon type=\"more\" />\n ) : (\n <a className=\"ant-dropdown-more\">\n {locale?.more}\n <i className={`${clsPrefix}-dropdown-icon`}>\n <Icon type=\"down\" />\n </i>\n </a>\n )}\n </Dropdown>\n )}\n </div>\n )\n }}\n </LocaleReceiver>\n )\n}\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/handle/index.js"],"names":[],"mappings":";;;;;;;;;;;AAAA,OAAO,KAAK,EAAE,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AACvC,OAAO,cAAc,MAAM,wCAAwC,CAAA;AACnE,OAAO,IAAI,MAAM,SAAS,CAAA;AAC1B,OAAO,EAAC,YAAY,EAAC,MAAM,eAAe,CAAA;AAC1C,OAAO,OAAO,MAAM,YAAY,CAAA;AAChC,OAAO,QAAQ,MAAM,aAAa,CAAA;AAClC,OAAO,IAAI,MAAM,SAAS,CAAA;AAC1B,OAAO,cAAc,CAAA;AAErB,MAAM,SAAS,GAAG,iBAAiB,CAAA;AAGnC,eAAe,CAAC,KAAK,EAAE,EAAE;IACvB,OAAO,CACL,oBAAC,cAAc,IAAC,aAAa,EAAC,QAAQ,IACnC,CAAC,MAAM,EAAE,UAAU,EAAE,EAAE;QACtB,MAAM,KAaF,KAAK,IAAI,EAAE,EAbT,EACF,QAAQ,GAAG,EAAE,EACb,IAAI,GAAC,MAAM,EACX,GAAG,GAAG,CAAC,EACP,IAAI,EACJ,OAAO,GAAG,KAAK,EACf,cAAc,GAAC,IAAI,EACnB,gBAAgB,EAChB,SAAS,GAAC,IAAI,EACd,eAAe,GAAC,IAAI,EACpB,eAAe,GAAC,EAAE,EAClB,gBAAgB,GAAC,KAAK,OAEX,EADR,IAAI,cAZL,2JAaL,CAAc,CAAA;QAEf,MAAM;QACN,IAAI,IAAI,GAAG,IAAI,KAAK,IAAI,CAAA;QACxB,IAAI,CAAC,IAAI,EAAE;YACT,IAAI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,mBAAmB,IAC3B,MAAM,aAAN,MAAM;oBAAN,MAAM,CAAE,IAAI;oBACb,2BAAG,SAAS,EAAE,GAAG,SAAS,gBAAgB;wBACtC,oBAAC,IAAI,IAAC,IAAI,EAAC,MAAM,GAAG,CACpB,CACJ,CAEL,CACd,CAAC;SACL;QAED,OAAO,CACL,2CACE,OAAO,EAAE,CAAC,CAAC,EAAE,EAAE;gBACX,IAAG,eAAe,EAAC;oBACf,CAAC,CAAC,eAAe,EAAE,CAAA;iBACtB;YACL,CAAC,IACG,IAAI,IACR,SAAS,EAAE,mBAAmB,CAAA,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,SAAS,KAAE,EAAE,EAAE;YAElD,YAAY;YACZ,CAAC,CAAC,CAAA,aAAa,aAAb,aAAa,uBAAb,aAAa,CAAE,MAAM,CAAA,IAAI,CAC1B,oBAAC,QAAQ,IAAC,OAAO,EAAE,IAAI,CAAC,aAAa,IAAI,EAAE,CAAC,EAAE,KAAK,UAChD,IAAI,KAAK,MAAM,CAAC,CAAC,CAAC,CACf,oBAAC,IAAI,IAAC,IAAI,EAAC,MAAM,EAAC,SAAS,EAAC,iBAAiB,GAAE,CAClD,CAAC,CAAC,CAAC,CACF,2BAAG,SAAS,EAAC,mBAAmB,IAC7B,MAAM,aAAN,MAAM;gBAAN,MAAM,CAAE,IAAI;gBACb,2BAAG,SAAS,EAAE,GAAG,SAAS,gBAAgB;oBACxC,oBAAC,IAAI,IAAC,IAAI,EAAC,MAAM,GAAG,CAClB,CACF,CACL,CACQ,CACZ,CACG,CACP,CAAA;IACH,CAAC,CACc,CAClB,CAAA;AACH,CAAC,CAAA","sourcesContent":["import React, { Fragment } from 'react'\nimport LocaleReceiver from 'antd/es/locale-provider/LocaleReceiver'\nimport Icon from '../icon'\nimport {doUpperTitle} from \"../utils/lang\"\nimport Divider from '../divider'\nimport Dropdown from '../dropdown'\nimport Menu from '../menu'\nimport './index.less'\n\nconst clsPrefix = 'tntd-more-menus'\n\n\nexport default (props) => {\n return (\n <LocaleReceiver componentName=\"Handle\">\n {(locale, localeCode) => {\n const {\n children = [],\n type=\"icon\",\n num = 6,\n lang,\n divider = false,\n lessOneMoreFit=true,\n popConfirmHandle,\n isIconBtn=true,\n stopPropagation=true,\n upperCaseIgnore=[],\n unUpperConverted=false,\n ...rest\n } = props || {}\n\n // 非中文\n let isCn = lang === 'cn'\n if (!lang) {\n isCn = localeCode === 'zh-cn'\n }\n\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\n // 非中文 且非 icon图标\n if(!unUpperConverted && !isCn && !isIconBtn ){\n newChildren?.forEach((v,i)=>{\n newChildren[i] = React.cloneElement(v, {\n ...(v?.props || {}),\n children: doUpperTitle(v.props.children, upperCaseIgnore)\n })\n })\n }\n\n // 子元素大于1个,且不是 icon元素\n const specialSceneDefaultShow = newChildren?.length > 1 && !isIconBtn\n\n if (specialSceneDefaultShow && (!isCn || popConfirmHandle)) {\n newChildren?.forEach((v, i) => {\n const { type, props } = v\n if (\n type?.name === 'Popconfirm' ||\n (props.hasOwnProperty('onConfirm') && typeof props?.onConfirm === 'function')\n ) {\n let placement = {}\n if (\n !isCn ||\n (num &&\n !isNaN(num) &&\n i + 1 > num &&\n !(lessOneMoreFit && newChildren.length - num === 1))\n ) {\n placement = {\n placement: 'left',\n }\n }\n newChildren[i] = React.cloneElement(v, {\n overlayStyle: { width: 180 },\n ...(v?.props || {}),\n onClick: (e) => e.stopPropagation(),\n ...placement,\n trigger: 'hover',\n getPopupContainer: (trigger) => trigger.parentNode,\n })\n }\n })\n }\n\n let [preChildPart, lastChildPart] = [newChildren, null]\n\n // 只有1个时不适配\n if (lessOneMoreFit && 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 const preChildLen = preChildPart.length\n preChildPart = preChildPart.map((dom, i) => (\n <Fragment key={i}>\n {dom}\n {!(\n (i === preChildLen - 1 && !lastChildPart?.length) // 没有更多 且 是最后一个时 不显示 Divider\n ) && <Divider type=\"vertical\" />}\n </Fragment>\n ))\n }\n const menu = (childArr)=>(\n <Menu className=\"org-pop-opera-btn\">\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\n if(!isCn && specialSceneDefaultShow ){\n return (\n <Dropdown overlay={menu(newChildren||[])} arrow onClick={(e)=>{\n if(stopPropagation){\n e.stopPropagation()\n }\n }}>\n {\n type === 'icon' ?\n <Icon type=\"more\" /> :\n <a className=\"ant-dropdown-more\">\n {locale?.more}\n <i className={`${clsPrefix}-dropdown-icon`}>\n <Icon type=\"down\" />\n </i>\n </a>\n }\n </Dropdown>\n );\n }\n\n return (\n <div\n onClick={(e) => {\n if(stopPropagation){\n e.stopPropagation()\n }\n }}\n {...rest}\n className={`tnt-handle-wrap ${rest?.className||''}`}\n >\n {preChildPart}\n {!!lastChildPart?.length && (\n <Dropdown overlay={menu(lastChildPart || [])} arrow>\n {type === 'icon' ? (\n <Icon type=\"more\" className='tnt-handle-more'/>\n ) : (\n <a className=\"ant-dropdown-more\">\n {locale?.more}\n <i className={`${clsPrefix}-dropdown-icon`}>\n <Icon type=\"down\" />\n </i>\n </a>\n )}\n </Dropdown>\n )}\n </div>\n )\n }}\n </LocaleReceiver>\n )\n}\n"]}
|
package/es/handle/index.less
CHANGED
|
@@ -7,3 +7,19 @@
|
|
|
7
7
|
margin-left: 2px;
|
|
8
8
|
}
|
|
9
9
|
}
|
|
10
|
+
.tnt-handle-wrap{
|
|
11
|
+
>*:not(:last-of-type){
|
|
12
|
+
margin-right: 8px;
|
|
13
|
+
}
|
|
14
|
+
>*.tntd-anticon{
|
|
15
|
+
font-size: 20px;
|
|
16
|
+
&.icon-disabled,&.disabled{
|
|
17
|
+
cursor: not-allowed;
|
|
18
|
+
pointer-events: auto;
|
|
19
|
+
color: @disabled-color;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
.tnt-handle-more{
|
|
24
|
+
font-size: 20px;
|
|
25
|
+
}
|
|
@@ -170,7 +170,7 @@
|
|
|
170
170
|
|
|
171
171
|
// Reset Select's style in addon
|
|
172
172
|
.@{ant-prefix}-select {
|
|
173
|
-
margin: calc(1px - @input-padding-vertical-base) (-@input-padding-horizontal-base);
|
|
173
|
+
margin: calc(-1px - @input-padding-vertical-base) (-@input-padding-horizontal-base);
|
|
174
174
|
|
|
175
175
|
.@{ant-prefix}-select-selection {
|
|
176
176
|
margin: -1px;
|
package/es/page-loading/index.js
CHANGED
|
@@ -12,14 +12,18 @@ import LocaleReceiver from 'antd/es/locale-provider/LocaleReceiver';
|
|
|
12
12
|
import './index.less';
|
|
13
13
|
export default (props => {
|
|
14
14
|
const {
|
|
15
|
-
className
|
|
15
|
+
className,
|
|
16
|
+
version
|
|
16
17
|
} = props,
|
|
17
|
-
other = __rest(props, ["className"]);
|
|
18
|
+
other = __rest(props, ["className", "version"]);
|
|
19
|
+
const currentVersion = version || localStorage.getItem('app_version') || 'v2';
|
|
18
20
|
return React.createElement(LocaleReceiver, {
|
|
19
21
|
componentName: "PageLoading"
|
|
20
22
|
}, (locale, localeCode) => {
|
|
21
23
|
return React.createElement("div", Object.assign({
|
|
22
|
-
className: cn('tnt-page-loading-container', className)
|
|
23
|
-
}, other), React.createElement("
|
|
24
|
+
className: cn('tnt-page-loading-container', 'tnt-current-' + currentVersion, className)
|
|
25
|
+
}, other), React.createElement("div", {
|
|
26
|
+
className: "tnt-page-loading-bg"
|
|
27
|
+
}, React.createElement("span", null, locale.text)));
|
|
24
28
|
});
|
|
25
29
|
});
|
|
@@ -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;
|
|
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,YAAY,CAAC,OAAO,CAAC,aAAa,CAAC,IAAI,IAAI,CAAA;IAC7E,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 || localStorage.getItem('app_version') || 'v2'\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"]}
|
|
@@ -1,22 +1,38 @@
|
|
|
1
1
|
.tnt-page-loading-container {
|
|
2
|
-
position:
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
background-image: url("./loading.gif");
|
|
11
|
-
z-index: 99999999999;
|
|
12
|
-
text-align: center;
|
|
13
|
-
span {
|
|
2
|
+
position: relative;
|
|
3
|
+
&.tnt-current-v2 {
|
|
4
|
+
height: calc(-50px + 100vh) !important;
|
|
5
|
+
}
|
|
6
|
+
&.tnt-current-v3 {
|
|
7
|
+
height: calc(-60px + 100vh) !important;
|
|
8
|
+
}
|
|
9
|
+
.tnt-page-loading-bg {
|
|
14
10
|
position: absolute;
|
|
11
|
+
top: 45%;
|
|
15
12
|
left: 50%;
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
13
|
+
width: 70px;
|
|
14
|
+
height: 70px;
|
|
15
|
+
background-size: 100% 100%;
|
|
16
|
+
transform: translate(-50%, -50%);
|
|
17
|
+
background-repeat: no-repeat;
|
|
18
|
+
background-image: url("./loading.gif");
|
|
19
|
+
z-index: 99999999999;
|
|
20
|
+
text-align: center;
|
|
21
|
+
span {
|
|
22
|
+
position: absolute;
|
|
23
|
+
left: 50%;
|
|
24
|
+
bottom: 0;
|
|
25
|
+
transform: translate(-50%, 0);
|
|
26
|
+
width: 100%;
|
|
27
|
+
font-size: 12px;
|
|
28
|
+
color: #17233D;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
.tnt-themeS2,.tnt-themeS3 {
|
|
33
|
+
.tnt-current-v3.tnt-page-loading-container {
|
|
34
|
+
span {
|
|
35
|
+
color: #fff;
|
|
36
|
+
}
|
|
21
37
|
}
|
|
22
38
|
}
|
|
@@ -8,68 +8,84 @@ var __rest = this && this.__rest || function (s, e) {
|
|
|
8
8
|
}
|
|
9
9
|
return t;
|
|
10
10
|
};
|
|
11
|
-
import React, { useEffect, useState } from 'react';
|
|
11
|
+
import React, { useEffect, useState, forwardRef, useImperativeHandle } from 'react';
|
|
12
12
|
import Popover from '../../../popover';
|
|
13
13
|
import SelectOpt from './Select';
|
|
14
14
|
import { highlightSubstring, getLabelFromOptions } from './utils';
|
|
15
15
|
import fieldsMap, { getFieldWidth } from '../fieldsMap';
|
|
16
16
|
import './FieldPopover.less';
|
|
17
17
|
const isInput = type => ['input', 'string', 'search', 'number', 'inputNumber'].includes(type);
|
|
18
|
-
|
|
18
|
+
const FieldPopover = (_a, ref) => {
|
|
19
19
|
var {
|
|
20
20
|
visible,
|
|
21
21
|
setVisible,
|
|
22
22
|
searchText,
|
|
23
23
|
children,
|
|
24
24
|
value,
|
|
25
|
+
regex,
|
|
26
|
+
fieldItems,
|
|
27
|
+
propItem,
|
|
28
|
+
setFieldItem,
|
|
25
29
|
onChange,
|
|
26
|
-
|
|
30
|
+
form,
|
|
27
31
|
locale,
|
|
28
|
-
searchTarget,
|
|
29
|
-
setSearchTarget,
|
|
30
32
|
clsPrefix
|
|
31
33
|
} = _a,
|
|
32
|
-
props = __rest(_a, ["visible", "setVisible", "searchText", "children", "value", "
|
|
33
|
-
const [
|
|
34
|
-
const
|
|
34
|
+
props = __rest(_a, ["visible", "setVisible", "searchText", "children", "value", "regex", "fieldItems", "propItem", "setFieldItem", "onChange", "form", "locale", "clsPrefix"]);
|
|
35
|
+
const [searchTarget, setSearchTarget] = useState(undefined);
|
|
36
|
+
const [popoverContent, setPopoverContent] = useState(false);
|
|
37
|
+
const onPropsClick = props => {
|
|
38
|
+
const {
|
|
39
|
+
type = 'input'
|
|
40
|
+
} = props || {};
|
|
35
41
|
const copyValue = _cloneDeep(value);
|
|
36
|
-
if (!(copyValue === null || copyValue === void 0 ? void 0 : copyValue.find(v => v.key ===
|
|
42
|
+
if (!(copyValue === null || copyValue === void 0 ? void 0 : copyValue.find(v => v.key === props.name))) {
|
|
37
43
|
copyValue.push({
|
|
38
|
-
key:
|
|
39
|
-
value:
|
|
40
|
-
|
|
44
|
+
key: props.name,
|
|
45
|
+
value: type === 'array' ? [] : '',
|
|
46
|
+
closable: false,
|
|
47
|
+
label: (props.propsTitle || props.title || props.name) + ':'
|
|
41
48
|
});
|
|
42
49
|
}
|
|
43
|
-
|
|
44
|
-
|
|
50
|
+
setFieldItem(props);
|
|
51
|
+
if (isInput(type)) {
|
|
52
|
+
const target = copyValue.find(v => v.key === props.name);
|
|
45
53
|
onChange(target, true);
|
|
46
54
|
close();
|
|
47
55
|
return;
|
|
48
56
|
}
|
|
49
|
-
|
|
57
|
+
setVisible(true);
|
|
58
|
+
setPopoverContent(true);
|
|
50
59
|
onChange(copyValue);
|
|
51
60
|
};
|
|
61
|
+
useImperativeHandle(ref, () => ({
|
|
62
|
+
onPropsClick
|
|
63
|
+
}));
|
|
52
64
|
const onSelectChange = (v, isMultiple) => {
|
|
53
65
|
var _a, _b, _c, _d, _e, _f, _g;
|
|
66
|
+
const {
|
|
67
|
+
props: fieldProps
|
|
68
|
+
} = propItem || (v === null || v === void 0 ? void 0 : v.propItem) || {}; // 直接搜索拿v.xx的值
|
|
54
69
|
const copyValue = _cloneDeep(value || []);
|
|
55
70
|
let index;
|
|
56
|
-
if (v.
|
|
71
|
+
if (v === null || v === void 0 ? void 0 : v.propItem) {
|
|
57
72
|
const _index = copyValue.findIndex(vv => {
|
|
58
73
|
var _a;
|
|
59
|
-
return vv.key === ((_a = v.
|
|
74
|
+
return vv.key === ((_a = v.propItem) === null || _a === void 0 ? void 0 : _a.name);
|
|
60
75
|
});
|
|
61
76
|
if (_index > -1) {
|
|
62
77
|
index = _index;
|
|
63
78
|
} else {
|
|
64
79
|
copyValue.push({
|
|
65
|
-
key: (_a = v.
|
|
80
|
+
key: (_a = v.propItem) === null || _a === void 0 ? void 0 : _a.name,
|
|
66
81
|
value: isMultiple ? [] : '',
|
|
67
|
-
label: (((_b = v.
|
|
82
|
+
label: (((_b = v.propItem) === null || _b === void 0 ? void 0 : _b.propsTitle) || ((_c = v.propItem) === null || _c === void 0 ? void 0 : _c.title) || ((_d = v.propItem) === null || _d === void 0 ? void 0 : _d.name)) + ':'
|
|
68
83
|
});
|
|
69
84
|
index = copyValue.length - 1;
|
|
70
85
|
}
|
|
86
|
+
setFieldItem(v.propItem);
|
|
71
87
|
} else {
|
|
72
|
-
index = copyValue.findIndex(v => v.key === (
|
|
88
|
+
index = copyValue.findIndex(v => v.key === (propItem === null || propItem === void 0 ? void 0 : propItem.name));
|
|
73
89
|
}
|
|
74
90
|
if (isMultiple) {
|
|
75
91
|
if (!((_f = (_e = copyValue[index]) === null || _e === void 0 ? void 0 : _e.value) === null || _f === void 0 ? void 0 : _f.length)) {
|
|
@@ -83,7 +99,7 @@ export default (_a => {
|
|
|
83
99
|
copyValue[index].label = result;
|
|
84
100
|
} else {
|
|
85
101
|
copyValue[index].value.push(v.value);
|
|
86
|
-
copyValue[index].label += '|' + (v === null || v === void 0 ? void 0 : v.label);
|
|
102
|
+
copyValue[index].label += ' | ' + (v === null || v === void 0 ? void 0 : v.label);
|
|
87
103
|
}
|
|
88
104
|
}
|
|
89
105
|
} else {
|
|
@@ -91,7 +107,9 @@ export default (_a => {
|
|
|
91
107
|
copyValue[index].label = copyValue[index].label.match(/(.*:)/)[0] + (v === null || v === void 0 ? void 0 : v.label);
|
|
92
108
|
close();
|
|
93
109
|
}
|
|
110
|
+
copyValue[index].closable = true;
|
|
94
111
|
onChange(copyValue, false, true);
|
|
112
|
+
(fieldProps === null || fieldProps === void 0 ? void 0 : fieldProps.onChange) && fieldProps.onChange(copyValue[index].value);
|
|
95
113
|
};
|
|
96
114
|
const onFieldChange = (...args) => {
|
|
97
115
|
var _a, _b;
|
|
@@ -100,14 +118,12 @@ export default (_a => {
|
|
|
100
118
|
component,
|
|
101
119
|
props: fieldProps,
|
|
102
120
|
setLabel
|
|
103
|
-
} =
|
|
121
|
+
} = propItem || {};
|
|
104
122
|
const {
|
|
105
|
-
onChange: onChangeCustom,
|
|
106
123
|
options
|
|
107
124
|
} = fieldProps || {};
|
|
108
|
-
onChangeCustom && onChangeCustom(...args);
|
|
109
125
|
const copyValue = _cloneDeep(value);
|
|
110
|
-
const index = copyValue.findIndex(v => v.key === (
|
|
126
|
+
const index = copyValue.findIndex(v => v.key === (propItem === null || propItem === void 0 ? void 0 : propItem.name));
|
|
111
127
|
copyValue[index].value = args[0];
|
|
112
128
|
if (type === 'date') {
|
|
113
129
|
copyValue[index].label = copyValue[index].label.match(/(.*:)/)[0] + args[1];
|
|
@@ -134,23 +150,26 @@ export default (_a => {
|
|
|
134
150
|
}
|
|
135
151
|
close();
|
|
136
152
|
}
|
|
153
|
+
copyValue[index].closable = true;
|
|
137
154
|
onChange(copyValue, false, true);
|
|
138
|
-
|
|
155
|
+
(fieldProps === null || fieldProps === void 0 ? void 0 : fieldProps.onChange) && fieldProps.onChange(copyValue[index].value);
|
|
139
156
|
};
|
|
140
157
|
const close = () => {
|
|
141
158
|
setVisible(false);
|
|
159
|
+
setPopoverContent(false);
|
|
142
160
|
};
|
|
143
|
-
const handleVisibleChange =
|
|
144
|
-
|
|
161
|
+
const handleVisibleChange = () => {
|
|
162
|
+
if (!visible && !regex.test(searchText)) {
|
|
163
|
+
setVisible(true);
|
|
164
|
+
} else {
|
|
165
|
+
close();
|
|
166
|
+
}
|
|
145
167
|
};
|
|
146
|
-
useEffect(() => {
|
|
147
|
-
setDataItem(null);
|
|
148
|
-
}, [visible]);
|
|
149
168
|
useEffect(() => {
|
|
150
169
|
let bool1 = false,
|
|
151
170
|
bool2 = false;
|
|
152
|
-
if (searchText) {
|
|
153
|
-
|
|
171
|
+
if (searchText && !propItem) {
|
|
172
|
+
fieldItems === null || fieldItems === void 0 ? void 0 : fieldItems.forEach(v => {
|
|
154
173
|
const {
|
|
155
174
|
name,
|
|
156
175
|
propsTitle,
|
|
@@ -166,7 +185,7 @@ export default (_a => {
|
|
|
166
185
|
const fieldNames = props === null || props === void 0 ? void 0 : props.fieldNames;
|
|
167
186
|
const target = sOptions === null || sOptions === void 0 ? void 0 : sOptions.find(item => {
|
|
168
187
|
const labelKey = (fieldNames === null || fieldNames === void 0 ? void 0 : fieldNames.label) || 'label';
|
|
169
|
-
const label = item instanceof Object ? item[labelKey] : item;
|
|
188
|
+
const label = item instanceof Object ? item[labelKey] : item + '';
|
|
170
189
|
return (label === null || label === void 0 ? void 0 : label.indexOf(searchText)) > -1;
|
|
171
190
|
});
|
|
172
191
|
if (target) {
|
|
@@ -178,13 +197,13 @@ export default (_a => {
|
|
|
178
197
|
propsValue: bool2
|
|
179
198
|
});
|
|
180
199
|
} else {
|
|
181
|
-
setSearchTarget(
|
|
200
|
+
setSearchTarget(undefined);
|
|
182
201
|
}
|
|
183
|
-
}, [
|
|
202
|
+
}, [fieldItems, searchText, propItem]);
|
|
184
203
|
const renderFirstOptions = menu => {
|
|
185
204
|
return React.createElement("div", null, (!searchText || (searchTarget === null || searchTarget === void 0 ? void 0 : searchTarget.propsTitle)) && React.createElement("label", null, locale.propTitle), React.createElement("ul", {
|
|
186
205
|
className: "ant-select-dropdown-menu"
|
|
187
|
-
},
|
|
206
|
+
}, fieldItems === null || fieldItems === void 0 ? void 0 : fieldItems.map(v => {
|
|
188
207
|
const {
|
|
189
208
|
name,
|
|
190
209
|
propsTitle,
|
|
@@ -209,7 +228,7 @@ export default (_a => {
|
|
|
209
228
|
}
|
|
210
229
|
}));
|
|
211
230
|
}
|
|
212
|
-
return
|
|
231
|
+
return null;
|
|
213
232
|
}
|
|
214
233
|
return React.createElement("li", {
|
|
215
234
|
className: "ant-select-dropdown-menu-item",
|
|
@@ -222,7 +241,7 @@ export default (_a => {
|
|
|
222
241
|
}, _propsTitle);
|
|
223
242
|
})), searchText && React.createElement("div", null, (searchTarget === null || searchTarget === void 0 ? void 0 : searchTarget.propsValue) && React.createElement("label", null, locale.propValue), React.createElement("ul", {
|
|
224
243
|
className: "ant-select-dropdown-menu"
|
|
225
|
-
},
|
|
244
|
+
}, fieldItems === null || fieldItems === void 0 ? void 0 : fieldItems.map(v => {
|
|
226
245
|
const {
|
|
227
246
|
name,
|
|
228
247
|
propsTitle,
|
|
@@ -231,11 +250,13 @@ export default (_a => {
|
|
|
231
250
|
} = v.props || {};
|
|
232
251
|
const target = value === null || value === void 0 ? void 0 : value.find(v => v.key === name);
|
|
233
252
|
if (type === 'select' && props && props.options && props.options.length > 0) {
|
|
234
|
-
return React.createElement(SelectOpt, Object.assign({
|
|
253
|
+
return React.createElement(SelectOpt, Object.assign({
|
|
254
|
+
key: name
|
|
255
|
+
}, props, {
|
|
235
256
|
searchText: searchText,
|
|
257
|
+
propItem: v.props,
|
|
236
258
|
onChange: onSelectChange,
|
|
237
|
-
value: target === null || target === void 0 ? void 0 : target.value
|
|
238
|
-
dataItem: v.props
|
|
259
|
+
value: target === null || target === void 0 ? void 0 : target.value
|
|
239
260
|
}));
|
|
240
261
|
}
|
|
241
262
|
return;
|
|
@@ -251,34 +272,37 @@ export default (_a => {
|
|
|
251
272
|
className,
|
|
252
273
|
component,
|
|
253
274
|
props: fieldProps
|
|
254
|
-
} =
|
|
275
|
+
} = propItem || {};
|
|
255
276
|
const target = value === null || value === void 0 ? void 0 : value.find(v => v.key === name);
|
|
256
277
|
const Field = component || fieldsMap[type];
|
|
257
278
|
return React.createElement("div", {
|
|
258
279
|
onClick: e => e.stopPropagation(),
|
|
259
280
|
className: className
|
|
260
281
|
}, React.createElement("label", null, propsTitle || title || name), type === 'select' ? React.createElement(SelectOpt, Object.assign({}, fieldProps, {
|
|
282
|
+
propItem: propItem,
|
|
261
283
|
onChange: onSelectChange,
|
|
262
284
|
value: target === null || target === void 0 ? void 0 : target.value
|
|
263
285
|
})) : React.createElement("div", {
|
|
264
286
|
className: `${clsPrefix}-field-popover-content`,
|
|
265
287
|
onClick: e => e.stopPropagation()
|
|
266
288
|
}, React.createElement(Field, Object.assign({
|
|
289
|
+
form: form,
|
|
267
290
|
value: target === null || target === void 0 ? void 0 : target.value
|
|
268
291
|
}, fieldProps, {
|
|
269
292
|
style: Object.assign(Object.assign({}, fieldProps === null || fieldProps === void 0 ? void 0 : fieldProps.style), {
|
|
270
293
|
width: ((_a = fieldProps === null || fieldProps === void 0 ? void 0 : fieldProps.style) === null || _a === void 0 ? void 0 : _a.width) || getFieldWidth(type)
|
|
271
294
|
}),
|
|
295
|
+
close: close,
|
|
272
296
|
onChange: onFieldChange
|
|
273
297
|
}))));
|
|
274
298
|
};
|
|
275
299
|
return React.createElement(Popover, Object.assign({
|
|
276
300
|
trigger: "click",
|
|
277
|
-
// onClick={(e) => e.stopPropagation()}
|
|
278
301
|
visible: visible,
|
|
279
302
|
placement: "bottom",
|
|
280
303
|
overlayClassName: `${clsPrefix}-field-popover`,
|
|
281
|
-
content: !
|
|
304
|
+
content: !popoverContent ? renderFirstOptions() : renderSecondOptions(),
|
|
282
305
|
onVisibleChange: handleVisibleChange
|
|
283
306
|
}, props), children);
|
|
284
|
-
}
|
|
307
|
+
};
|
|
308
|
+
export default forwardRef(FieldPopover);
|