tntd 3.0.0-beta.7 → 3.0.0-beta.9

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.
Files changed (75) hide show
  1. package/es/drawer/drawer.js +23 -13
  2. package/es/drawer/drawer.js.map +1 -1
  3. package/es/form/form.js +5 -3
  4. package/es/form/form.js.map +1 -1
  5. package/es/handle/index.js +9 -6
  6. package/es/handle/index.js.map +1 -1
  7. package/es/handle/index.less +16 -0
  8. package/es/input/style/mixin.less +1 -1
  9. package/es/page-loading/index.js +8 -4
  10. package/es/page-loading/index.js.map +1 -1
  11. package/es/page-loading/index.less +33 -17
  12. package/es/query-form/Field/Composition/FieldPopover.js +70 -46
  13. package/es/query-form/Field/Composition/FieldPopover.js.map +1 -1
  14. package/es/query-form/Field/Composition/Select.js +8 -12
  15. package/es/query-form/Field/Composition/Select.js.map +1 -1
  16. package/es/query-form/Field/Composition/index.js +68 -44
  17. package/es/query-form/Field/Composition/index.js.map +1 -1
  18. package/es/query-form/Field/Composition/index.less +10 -2
  19. package/es/query-form/Field/SelectInput.js +22 -4
  20. package/es/query-form/Field/SelectInput.js.map +1 -1
  21. package/es/query-form/Field/fieldsMap.js +2 -2
  22. package/es/query-form/Field/fieldsMap.js.map +1 -1
  23. package/es/query-form/Field/index.js +1 -0
  24. package/es/query-form/Field/index.js.map +1 -1
  25. package/es/query-form/index.js +11 -5
  26. package/es/query-form/index.js.map +1 -1
  27. package/es/table-container/index.less +1 -1
  28. package/es/tabs-container/index.js +1 -0
  29. package/es/tabs-container/index.js.map +1 -1
  30. package/es/tabs-container/index.less +3 -3
  31. package/lib/drawer/drawer.d.ts +3 -0
  32. package/lib/drawer/drawer.d.ts.map +1 -1
  33. package/lib/drawer/drawer.js +24 -13
  34. package/lib/drawer/drawer.js.map +1 -1
  35. package/lib/form/form.js +5 -3
  36. package/lib/form/form.js.map +1 -1
  37. package/lib/handle/index.d.ts.map +1 -1
  38. package/lib/handle/index.js +15 -10
  39. package/lib/handle/index.js.map +1 -1
  40. package/lib/handle/index.less +16 -0
  41. package/lib/input/style/mixin.less +1 -1
  42. package/lib/page-loading/index.d.ts.map +1 -1
  43. package/lib/page-loading/index.js +7 -3
  44. package/lib/page-loading/index.js.map +1 -1
  45. package/lib/page-loading/index.less +33 -17
  46. package/lib/query-form/Field/Composition/FieldPopover.d.ts +7 -5
  47. package/lib/query-form/Field/Composition/FieldPopover.d.ts.map +1 -1
  48. package/lib/query-form/Field/Composition/FieldPopover.js +107 -79
  49. package/lib/query-form/Field/Composition/FieldPopover.js.map +1 -1
  50. package/lib/query-form/Field/Composition/Select.d.ts.map +1 -1
  51. package/lib/query-form/Field/Composition/Select.js +7 -11
  52. package/lib/query-form/Field/Composition/Select.js.map +1 -1
  53. package/lib/query-form/Field/Composition/index.d.ts +1 -1
  54. package/lib/query-form/Field/Composition/index.js +70 -51
  55. package/lib/query-form/Field/Composition/index.js.map +1 -1
  56. package/lib/query-form/Field/Composition/index.less +10 -2
  57. package/lib/query-form/Field/SelectInput.d.ts.map +1 -1
  58. package/lib/query-form/Field/SelectInput.js +15 -3
  59. package/lib/query-form/Field/SelectInput.js.map +1 -1
  60. package/lib/query-form/Field/fieldsMap.d.ts +6 -3
  61. package/lib/query-form/Field/fieldsMap.js +2 -2
  62. package/lib/query-form/Field/fieldsMap.js.map +1 -1
  63. package/lib/query-form/Field/index.d.ts.map +1 -1
  64. package/lib/query-form/Field/index.js +1 -0
  65. package/lib/query-form/Field/index.js.map +1 -1
  66. package/lib/query-form/index.d.ts.map +1 -1
  67. package/lib/query-form/index.js +11 -5
  68. package/lib/query-form/index.js.map +1 -1
  69. package/lib/table-container/index.less +1 -1
  70. package/lib/tabs-container/index.d.ts +2 -1
  71. package/lib/tabs-container/index.d.ts.map +1 -1
  72. package/lib/tabs-container/index.js +3 -2
  73. package/lib/tabs-container/index.js.map +1 -1
  74. package/lib/tabs-container/index.less +3 -3
  75. package/package.json +2 -2
@@ -17,22 +17,25 @@ const DefaultFooter = ({
17
17
  locale,
18
18
  onClose,
19
19
  onSubmit,
20
+ onCancel,
21
+ onOk,
20
22
  okText,
21
23
  okType,
22
24
  cancelText,
23
25
  confirmLoading,
24
26
  okButtonProps,
25
- cancelButtonProps
27
+ cancelButtonProps,
28
+ cancelType
26
29
  }) => {
27
30
  return React.createElement(React.Fragment, null, React.createElement(Button, Object.assign({
28
- onClick: onClose,
31
+ onClick: onCancel || onClose,
29
32
  style: {
30
33
  marginRight: 8
31
34
  },
32
- type: 'tertiary'
35
+ type: cancelType || 'tertiary'
33
36
  }, cancelButtonProps), cancelText || (locale === null || locale === void 0 ? void 0 : locale.cancelText)), React.createElement(Button, Object.assign({
34
- onClick: onSubmit,
35
- type: okType,
37
+ onClick: onOk || onSubmit,
38
+ type: okType || 'primary',
36
39
  loading: confirmLoading
37
40
  }, okButtonProps), okText || (locale === null || locale === void 0 ? void 0 : locale.okText)));
38
41
  };
@@ -44,17 +47,21 @@ export const Drawer = _a => {
44
47
  showFooter,
45
48
  onClose,
46
49
  onSubmit,
50
+ onCancel,
51
+ onOk,
47
52
  okText = '',
48
53
  cancelText = '',
49
54
  locale,
50
55
  okType = 'primary',
56
+ cancelType = 'default',
51
57
  confirmLoading = false,
52
58
  okButtonProps = {},
53
59
  cancelButtonProps = {},
54
60
  clickOnBlankToClose = false
55
61
  } = _a,
56
- rest = __rest(_a, ["closable", "className", "footer", "showFooter", "onClose", "onSubmit", "okText", "cancelText", "locale", "okType", "confirmLoading", "okButtonProps", "cancelButtonProps", "clickOnBlankToClose"]);
62
+ rest = __rest(_a, ["closable", "className", "footer", "showFooter", "onClose", "onSubmit", "onCancel", "onOk", "okText", "cancelText", "locale", "okType", "cancelType", "confirmLoading", "okButtonProps", "cancelButtonProps", "clickOnBlankToClose"]);
57
63
  const drawerDom = React.useRef(null);
64
+ const _onCancel = onCancel || onClose;
58
65
  useEffect(() => {
59
66
  if (clickOnBlankToClose) {
60
67
  const handleOutsideClick = event => {
@@ -65,8 +72,8 @@ export const Drawer = _a => {
65
72
  isInDrawer = drawer.contains(targetElement) || targetElement === drawer;
66
73
  }
67
74
  drawerDom.current = null;
68
- if (rest.visible && !isInDrawer && onClose) {
69
- onClose();
75
+ if (rest.visible && !isInDrawer && _onCancel) {
76
+ _onCancel();
70
77
  }
71
78
  };
72
79
  document.removeEventListener('click', handleOutsideClick);
@@ -75,7 +82,7 @@ export const Drawer = _a => {
75
82
  document.removeEventListener('click', handleOutsideClick);
76
83
  };
77
84
  }
78
- }, [rest.visible, clickOnBlankToClose, onClose]);
85
+ }, [rest.visible, clickOnBlankToClose, _onCancel]);
79
86
  return React.createElement(ConfigConsumer, null, ({
80
87
  getPrefixCls
81
88
  }) => {
@@ -91,7 +98,7 @@ export const Drawer = _a => {
91
98
  }, React.createElement(AntdDrawer, Object.assign({
92
99
  className: classNames(prefixCls, 'tnt-drawer', className, {
93
100
  [`${prefixCls}-contain-closable`]: closable !== false,
94
- [`${prefixCls}-footer`]: showFooter
101
+ [`${prefixCls}-footer`]: showFooter || footer
95
102
  }),
96
103
  closable: false,
97
104
  onClose: onClose,
@@ -100,18 +107,21 @@ export const Drawer = _a => {
100
107
  type: "close",
101
108
  className: `${prefixCls}-close`,
102
109
  onClick: onClose
103
- }), rest.children, showFooter && React.createElement("div", {
110
+ }), rest.children, React.createElement("div", {
104
111
  className: `${prefixCls}-footer-style`
105
- }, showFooter && !footer ? React.createElement(DefaultFooter, {
112
+ }, !footer ? showFooter && React.createElement(DefaultFooter, {
106
113
  confirmLoading: confirmLoading,
107
114
  okButtonProps: okButtonProps,
108
115
  cancelButtonProps: cancelButtonProps,
109
116
  okType: okType,
110
117
  locale: locale,
111
118
  okText: okText,
119
+ cancelType: cancelType,
112
120
  cancelText: cancelText,
113
121
  onClose: onClose,
114
- onSubmit: onSubmit
122
+ onSubmit: onSubmit,
123
+ onOk: onOk,
124
+ onCancel: onCancel
115
125
  }) : footer))));
116
126
  });
117
127
  });
@@ -1 +1 @@
1
- {"version":3,"file":"draw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erProps } 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 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 okText: string\n cancelText: string\n okType?: TntButtonType\n confirmLoading?: boolean\n okButtonProps?: BaseButtonProps\n cancelButtonProps?: BaseButtonProps\n}) => {\n return (\n <>\n <Button onClick={onClose} style={{ marginRight: 8 }} type={'tertiary'} {...cancelButtonProps}>\n {cancelText || locale?.cancelText}\n </Button>\n <Button onClick={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"]}
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,MA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dDrawerProps } 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 cancelType,\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 cancelType: 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={cancelType || 'tertiary'}\n {...cancelButtonProps}\n >\n {cancelText || locale?.cancelText}\n </Button>\n <Button\n onClick={onOk || onSubmit}\n type={okType || 'primary'}\n loading={confirmLoading}\n {...okButtonProps}\n >\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}\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 ...rest\n}) => {\n const drawerDom = React.useRef<EventTarget | null>(null)\n const _onCancel = onCancel || onClose\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={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 <div className={`${prefixCls}-footer-style`}>\n {!footer\n ? showFooter && (\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 onClose={onClose}\n onSubmit={onSubmit}\n onOk={onOk}\n onCancel={onCancel}\n />\n )\n : footer}\n </div>\n </>\n </AntdDrawer>\n </div>\n )\n }}\n </LocaleReceiver>\n )\n }}\n </ConfigConsumer>\n )\n}\n"]}
package/es/form/form.js CHANGED
@@ -40,7 +40,7 @@ Form.Item = forwardRef((_a, ref) => {
40
40
  });
41
41
  const Create = options => WrappedComponent => {
42
42
  const validateSubmitMap = {};
43
- const CustomFormWrapper = props => {
43
+ const CustomFormWrapper = (props, ref) => {
44
44
  const getFieldDecorator = props.form.getFieldDecorator;
45
45
  props.form.getFieldDecorator = (name, options) => {
46
46
  let opt = options || {};
@@ -52,7 +52,9 @@ const Create = options => WrappedComponent => {
52
52
  }
53
53
  return getFieldDecorator(name, opt);
54
54
  };
55
- return React.createElement(WrappedComponent, Object.assign({}, props));
55
+ return React.createElement(WrappedComponent, Object.assign({}, props, {
56
+ ref: ref
57
+ }));
56
58
  };
57
59
  return AntdForm.create(Object.assign(Object.assign({}, options), {
58
60
  onValuesChange: (props, changedValues, allValues) => {
@@ -72,7 +74,7 @@ const Create = options => WrappedComponent => {
72
74
  options.onValuesChange(props, changedValues, allValues);
73
75
  }
74
76
  }
75
- }))(CustomFormWrapper);
77
+ }))(forwardRef(CustomFormWrapper));
76
78
  };
77
79
  Form.createFormField = AntdForm.createFormField;
78
80
  Form.create = Create;
@@ -1 +1 @@
1
- {"version":3,"file":"form.js","sourceRoot":"","sources":["../../src/form/form.tsx"],"names":[],"mappings":";;;;;;;;;;;AAMA,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,MAAM,OAAO,CAAA;AAEzC,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAA;AAExD,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,cAAc,CAAA;AAGlD,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAA;AACvC,OAAO,aAAa,CAAA;AACpB,OAAO,UAAU,MAAM,YAAY,CAAA;AACnC,cAAc,cAAc,CAAA;AAW5B,MAAM,CAAC,MAAM,IAAI,GAAG,UAAU,CAA0B,CAAC,EAAW,EAAE,GAAG,EAAE,EAAE;QAAf,IAAI,cAAT,EAAW,CAAF;IAChE,OAAO,CACL,oBAAC,cAAc,QACZ,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oBAAC,gBAAgB,oBAAK,KAAK,EAAI,CAAA;IACxC,CAAC,CAAA;IAED,OAAO,QAAQ,CAAC,MAAM,iCACjB,OAAO,KACV,cAAc,EAAE,CAAC,KAAU,EAAE,aAAkB,EAAE,SAAc,EAAE,EAAE;YACjE,MAAM,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC,aAAa,CAAC,CAAA;YACvC,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC,EAAE;gBACrB,IAAI,CAAC,OAAO,CAAC,CAAC,IAAS,EAAE,EAAE;oBACzB,IAAI,iBAAiB,CAAC,IAAI,CAAC,EAAE;wBAC3B,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC;4BACnB,CAAC,IAAI,CAAC,EAAE,EAAE,MAAM,EAAE,SAAS,EAAE;yBAC9B,CAAC,CAAA;qBACH;gBACH,CAAC,CAAC,CAAA;aACH;YACD,IAAI,OAAO,IAAI,OAAO,CAAC,cAAc,EAAE;gBACrC,OAAO,CAAC,cAAc,CAAC,KAAK,EAAE,aAAa,EAAE,SAAS,CAAC,CAAA;aACxD;QACH,CAAC,IACD,CAAC,iBAAiB,CAAC,CAAA;AACvB,CAAC,CAAA;AAED,IAAI,CAAC,eAAe,GAAG,QAAQ,CAAC,eAAe,CAAA;AAC/C,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA","sourcesContent":["import type {\n FormItemProps as AntdFormItemProps,\n FormProps as AntdFormProps,\n FormComponentProps,\n FormCreateOption,\n} from 'antd/es/form'\nimport React, { forwardRef } from 'react'\n\nimport { ConfigConsumer } from 'antd/es/config-provider'\n\nimport { default as AntdForm } from 'antd/es/form'\nimport type AntdFormItem from 'antd/es/form/FormItem'\n\nimport { doUpperTitle } from '../utils'\nimport './form.less'\nimport classNames from 'classnames'\nexport * from 'antd/es/form'\n\ninterface FormItemComponent\n extends React.ForwardRefExoticComponent<AntdFormItemProps & React.RefAttributes<AntdFormItem>> {}\ninterface FormComponent\n extends React.ForwardRefExoticComponent<AntdFormProps & React.RefAttributes<AntdForm>> {\n Item: FormItemComponent\n create: typeof AntdForm.create\n createFormField: typeof AntdForm.createFormField\n}\n\nexport const Form = forwardRef<AntdForm, AntdFormProps>(({ ...rest }, ref) => {\n return (\n <ConfigConsumer>\n {({ getPrefixCls }) => {\n return <AntdForm {...rest} className={classNames(rest.className, 'tnt-form')} ref={ref} />\n }}\n </ConfigConsumer>\n )\n}) as FormComponent\n\nForm.Item = forwardRef<AntdFormItem, AntdFormItemProps>(({ label, ...rest }, ref) => {\n return (\n <ConfigConsumer>\n {({ getPrefixCls }) => {\n return <AntdForm.Item {...rest} label={doUpperTitle(label)} ref={ref} />\n }}\n </ConfigConsumer>\n )\n})\n\n// 定义 create 函数的类型\ntype CreateFunction = <TOwnProps extends FormComponentProps<any>>(\n options?: FormCreateOption<TOwnProps>\n) => any\n\nconst Create: CreateFunction = (options: any) => (WrappedComponent: any) => {\n const validateSubmitMap: any = {}\n const CustomFormWrapper = (props: any) => {\n const getFieldDecorator = props.form.getFieldDecorator\n props.form.getFieldDecorator = (name: any, options: any) => {\n let opt = options || {}\n if (opt.validateSubmit) {\n opt = {\n ...options,\n validateTrigger: 'noEvent',\n }\n validateSubmitMap[name] = true\n }\n return getFieldDecorator(name, opt)\n }\n return <WrappedComponent {...props} />\n }\n\n return AntdForm.create({\n ...options,\n onValuesChange: (props: any, changedValues: any, allValues: any) => {\n const keys = Object.keys(changedValues)\n if (keys.length === 1) {\n keys.forEach((name: any) => {\n if (validateSubmitMap[name]) {\n props.form.setFields({\n [name]: { errors: undefined },\n })\n }\n })\n }\n if (options && options.onValuesChange) {\n options.onValuesChange(props, changedValues, allValues)\n }\n },\n })(CustomFormWrapper)\n}\n\nForm.createFormField = AntdForm.createFormField\nForm.create = Create\n"]}
1
+ {"version":3,"file":"form.js","sourceRoot":"","sources":["../../src/form/form.tsx"],"names":[],"mappings":";;;;;;;;;;;AAMA,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,MAAM,OAAO,CAAA;AAEz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AA;AAC/C,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA","sourcesContent":["import type {\n FormItemProps as AntdFormItemProps,\n FormProps as AntdFormProps,\n FormComponentProps,\n FormCreateOption,\n} from 'antd/es/form'\nimport React, { forwardRef } from 'react'\n\nimport { ConfigConsumer } from 'antd/es/config-provider'\n\nimport { default as AntdForm } from 'antd/es/form'\nimport type AntdFormItem from 'antd/es/form/FormItem'\n\nimport { doUpperTitle } from '../utils'\nimport './form.less'\nimport classNames from 'classnames'\nexport * from 'antd/es/form'\n\ninterface FormItemComponent\n extends React.ForwardRefExoticComponent<AntdFormItemProps & React.RefAttributes<AntdFormItem>> {}\ninterface FormComponent\n extends React.ForwardRefExoticComponent<AntdFormProps & React.RefAttributes<AntdForm>> {\n Item: FormItemComponent\n create: typeof AntdForm.create\n createFormField: typeof AntdForm.createFormField\n}\n\nexport const Form = forwardRef<AntdForm, AntdFormProps>(({ ...rest }, ref) => {\n return (\n <ConfigConsumer>\n {({ getPrefixCls }) => {\n return <AntdForm {...rest} className={classNames(rest.className, 'tnt-form')} ref={ref} />\n }}\n </ConfigConsumer>\n )\n}) as FormComponent\n\nForm.Item = forwardRef<AntdFormItem, AntdFormItemProps>(({ label, ...rest }, ref) => {\n return (\n <ConfigConsumer>\n {({ getPrefixCls }) => {\n return <AntdForm.Item {...rest} label={doUpperTitle(label)} ref={ref} />\n }}\n </ConfigConsumer>\n )\n})\n\n// 定义 create 函数的类型\ntype CreateFunction = <TOwnProps extends FormComponentProps<any>>(\n options?: FormCreateOption<TOwnProps>\n) => any\n\nconst Create: CreateFunction = (options: any) => (WrappedComponent: any) => {\n const validateSubmitMap: any = {}\n const CustomFormWrapper = (props: any, ref: any) => {\n const getFieldDecorator = props.form.getFieldDecorator\n props.form.getFieldDecorator = (name: any, options: any) => {\n let opt = options || {}\n if (opt.validateSubmit) {\n opt = {\n ...options,\n validateTrigger: 'noEvent',\n }\n validateSubmitMap[name] = true\n }\n return getFieldDecorator(name, opt)\n }\n return <WrappedComponent {...props} ref={ref} />\n }\n\n return AntdForm.create({\n ...options,\n onValuesChange: (props: any, changedValues: any, allValues: any) => {\n const keys = Object.keys(changedValues)\n if (keys.length === 1) {\n keys.forEach((name: any) => {\n if (validateSubmitMap[name]) {\n props.form.setFields({\n [name]: { errors: undefined },\n })\n }\n })\n }\n if (options && options.onValuesChange) {\n options.onValuesChange(props, changedValues, allValues)\n }\n },\n })(forwardRef(CustomFormWrapper))\n}\n\nForm.createFormField = AntdForm.createFormField\nForm.create = Create\n"]}
@@ -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 '../tntd-icon';
11
+ import Icon from '../icon';
12
12
  import { doUpperTitle } from "../utils/lang";
13
13
  import Divider from '../divider';
14
14
  import Dropdown from '../dropdown';
@@ -25,10 +25,10 @@ export default (props => {
25
25
  type,
26
26
  num = 3,
27
27
  lang,
28
- divider = true,
29
- lessOneMoreFit,
28
+ divider = false,
29
+ lessOneMoreFit = true,
30
30
  popConfirmHandle,
31
- isIconBtn,
31
+ isIconBtn = false,
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), preChildPart, !!(lastChildPart === null || lastChildPart === void 0 ? void 0 : lastChildPart.length) && React.createElement(Dropdown, {
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", {
@@ -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;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,EACJ,GAAG,GAAG,CAAC,EACP,IAAI,EACJ,OAAO,GAAG,IAAI,EACd,cAAc,EACd,gBAAgB,EAChB,SAAS,EACT,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,GAAG,UAAU,KAAK,OAAO,CAAA;SAC9B;QAID,IAAI,WAAW,GAAG,EAAE,CAAA;QACpB,IAAI,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE;YAC3B,WAAW,GAAG,CAAA,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE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,OAAO,CACL,2CACE,OAAO,EAAE,CAAC,CAAC,EAAE,EAAE;gBACX,IAAG,eAAe,EAAC;oBACf,CAAC,CAAC,eAAe,EAAE,CAAA;iBACtB;YACL,CAAC,IACG,IAAI;YAEP,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,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,EACJ,G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C,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,\n num = 3,\n lang,\n divider = false,\n lessOneMoreFit=true,\n popConfirmHandle,\n isIconBtn=false,\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"]}
@@ -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;
@@ -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("span", null, locale.text));
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;IACrB,MAAM,EAAE,SAAS,KAAe,KAAK,EAAf,KAAK,UAAK,KAAK,EAA/B,aAAuB,CAAQ,CAAA;IACrC,OAAO,CACH,oBAAC,cAAc,IAAC,aAAa,EAAC,aAAa,IACxC,CAAC,MAAM,EAAE,UAAU,EAAE,EAAE;QACtB,OAAO,CACH,2CAAK,SAAS,EAAE,EAAE,CAAC,4BAA4B,EAAE,SAAS,CAAC,IAAM,KAAK;YACtE,kCAAO,MAAM,CAAC,IAAI,CAAQ,CACxB,CACL,CAAA;IACH,CAAC,CACc,CAClB,CAAA;AACP,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, ...other } = props\n return (\n <LocaleReceiver componentName=\"PageLoading\">\n {(locale, localeCode) => {\n return (\n <div className={cn('tnt-page-loading-container', className)} {...other}>\n <span>{locale.text}</span>\n </div>\n )\n }}\n </LocaleReceiver>\n ) \n};\n"]}
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: fixed;
3
- top: 140px;
4
- left: 50%;
5
- width: 70px;
6
- height: 70px;
7
- background-size: 100% 100%;
8
- transform: translate(-50%, 0);
9
- background-repeat: no-repeat;
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
- bottom: 0;
17
- transform: translate(-50%, 0);
18
- width: 100%;
19
- font-size: 12px;
20
- color: #17233D;
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
  }