tntd 1.4.32 → 1.4.33-beta.1

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 (157) hide show
  1. package/components/Ellipsis/index.js +47 -15
  2. package/components/QueryListScene/QueryForm.js +4 -4
  3. package/components/QueryListScene/createActions.js +4 -4
  4. package/dist/1.tntd.js +1 -1
  5. package/dist/stats.json +24089 -23289
  6. package/dist/tntd.css +1 -1
  7. package/dist/tntd.js +7 -10
  8. package/es/ArrayInput/icon.js +5 -5
  9. package/es/ArrayInput/index.js +79 -111
  10. package/es/AuthContext.js +1 -1
  11. package/es/Columns/index.js +33 -40
  12. package/es/DevelopmentLogin/LoginModal.js +33 -46
  13. package/es/DevelopmentLogin/index.js +14 -18
  14. package/es/Ellipsis/Svg/CopySVG.js +13 -13
  15. package/es/Ellipsis/Svg/TickSVG.js +8 -8
  16. package/es/Ellipsis/index.js +100 -79
  17. package/es/Handle/index.js +46 -64
  18. package/es/Icon/fonts/iconfont.js +7 -12
  19. package/es/Icon/index.js +12 -15
  20. package/es/Img/Contain.js +26 -31
  21. package/es/Img/Cover.js +43 -57
  22. package/es/Img/index.js +39 -48
  23. package/es/Layout/ActionsContext.js +3 -2
  24. package/es/Layout/AppList.js +39 -94
  25. package/es/Layout/Application.js +28 -74
  26. package/es/Layout/Avatar.js +30 -67
  27. package/es/Layout/CompatibleLanguage.js +41 -96
  28. package/es/Layout/EnterpriseLayout/Avatar.js +39 -77
  29. package/es/Layout/EnterpriseLayout/Language.js +16 -34
  30. package/es/Layout/EnterpriseLayout/Theme.js +18 -36
  31. package/es/Layout/EnterpriseLayout/index.js +14 -16
  32. package/es/Layout/GlobalNavigation/NavigationPopup.js +61 -172
  33. package/es/Layout/GlobalNavigation/index.js +22 -56
  34. package/es/Layout/Header.js +26 -47
  35. package/es/Layout/HeaderActions.js +45 -59
  36. package/es/Layout/HeaderNavs.js +24 -51
  37. package/es/Layout/HeaderTabs.js +53 -106
  38. package/es/Layout/Iconfont.js +1 -1
  39. package/es/Layout/Language.js +16 -34
  40. package/es/Layout/Layout.js +88 -110
  41. package/es/Layout/Logo.js +17 -33
  42. package/es/Layout/OrgAppList.js +64 -109
  43. package/es/Layout/SideMenu.js +67 -128
  44. package/es/Layout/Theme.js +25 -63
  45. package/es/Layout/index.js +28 -37
  46. package/es/Layout/paaslayout/CompactSideMenu.js +37 -76
  47. package/es/Layout/paaslayout/Header.js +23 -46
  48. package/es/Layout/paaslayout/Logo.js +4 -14
  49. package/es/Layout/paaslayout/SideMenu.js +41 -80
  50. package/es/Layout/paaslayout/index.js +77 -104
  51. package/es/Layout/storage.js +10 -9
  52. package/es/LoadingButton/index.js +18 -27
  53. package/es/Modal/index.js +42 -51
  54. package/es/Page/Box.js +36 -43
  55. package/es/Page/index.js +56 -71
  56. package/es/Page/utils.js +0 -5
  57. package/es/QueryForm/Field/Checkbox.js +7 -11
  58. package/es/QueryForm/Field/Select.js +34 -44
  59. package/es/QueryForm/Field/SelectInput.js +31 -46
  60. package/es/QueryForm/Field/fieldsMap.js +0 -1
  61. package/es/QueryForm/Field/index.js +46 -78
  62. package/es/QueryForm/createActions.js +6 -7
  63. package/es/QueryForm/index.js +79 -140
  64. package/es/QueryListScene/List.js +83 -139
  65. package/es/QueryListScene/QueryForm.js +54 -91
  66. package/es/QueryListScene/QueryListScene.js +29 -47
  67. package/es/QueryListScene/Title.js +3 -3
  68. package/es/QueryListScene/Toolbar.js +13 -14
  69. package/es/QueryListScene/createActions.js +4 -4
  70. package/es/Select/DropDownWrap.js +32 -55
  71. package/es/Select/index.js +140 -232
  72. package/es/Table/ResizableTable/index.js +29 -43
  73. package/es/Table/index.js +20 -19
  74. package/es/Title/index.js +23 -25
  75. package/es/locale.js +1 -5
  76. package/es/utils/checkAuth.js +6 -8
  77. package/es/utils/findMenuInfoByPath.js +0 -4
  78. package/es/utils/index.js +17 -27
  79. package/lib/ArrayInput/icon.js +7 -9
  80. package/lib/ArrayInput/index.js +82 -131
  81. package/lib/AuthContext.js +2 -6
  82. package/lib/Columns/index.js +36 -54
  83. package/lib/DevelopmentLogin/LoginModal.js +36 -63
  84. package/lib/DevelopmentLogin/index.js +21 -31
  85. package/lib/Ellipsis/Svg/CopySVG.js +15 -18
  86. package/lib/Ellipsis/Svg/TickSVG.js +10 -13
  87. package/lib/Ellipsis/index.js +105 -93
  88. package/lib/Handle/index.js +51 -87
  89. package/lib/Icon/fonts/iconfont.js +7 -12
  90. package/lib/Icon/iconList.js +1 -2
  91. package/lib/Icon/index.js +16 -26
  92. package/lib/Img/Contain.js +29 -40
  93. package/lib/Img/Cover.js +48 -72
  94. package/lib/Img/index.js +42 -58
  95. package/lib/Layout/ActionsContext.js +1 -5
  96. package/lib/Layout/AppList.js +45 -124
  97. package/lib/Layout/Application.js +31 -92
  98. package/lib/Layout/Avatar.js +36 -91
  99. package/lib/Layout/CompatibleLanguage.js +44 -116
  100. package/lib/Layout/EnterpriseLayout/Avatar.js +45 -105
  101. package/lib/Layout/EnterpriseLayout/Language.js +22 -54
  102. package/lib/Layout/EnterpriseLayout/Theme.js +21 -50
  103. package/lib/Layout/EnterpriseLayout/index.js +17 -27
  104. package/lib/Layout/GlobalNavigation/NavigationPopup.js +64 -192
  105. package/lib/Layout/GlobalNavigation/index.js +28 -80
  106. package/lib/Layout/Header.js +36 -68
  107. package/lib/Layout/HeaderActions.js +51 -81
  108. package/lib/Layout/HeaderNavs.js +30 -70
  109. package/lib/Layout/HeaderTabs.js +58 -127
  110. package/lib/Layout/Iconfont.js +4 -9
  111. package/lib/Layout/Language.js +22 -54
  112. package/lib/Layout/Layout.js +93 -134
  113. package/lib/Layout/Logo.js +26 -47
  114. package/lib/Layout/OrgAppList.js +69 -133
  115. package/lib/Layout/SideMenu.js +72 -151
  116. package/lib/Layout/Theme.js +28 -79
  117. package/lib/Layout/createActions.js +3 -9
  118. package/lib/Layout/images/index.js +5 -36
  119. package/lib/Layout/index.js +35 -63
  120. package/lib/Layout/paaslayout/CompactSideMenu.js +40 -90
  121. package/lib/Layout/paaslayout/Header.js +30 -60
  122. package/lib/Layout/paaslayout/Logo.js +11 -24
  123. package/lib/Layout/paaslayout/SideMenu.js +44 -93
  124. package/lib/Layout/paaslayout/index.js +82 -128
  125. package/lib/Layout/storage.js +26 -68
  126. package/lib/LoadingButton/index.js +21 -36
  127. package/lib/Modal/index.js +45 -62
  128. package/lib/Page/Box.js +38 -50
  129. package/lib/Page/index.js +58 -84
  130. package/lib/Page/utils.js +5 -16
  131. package/lib/QueryForm/Field/Checkbox.js +10 -19
  132. package/lib/QueryForm/Field/Select.js +39 -60
  133. package/lib/QueryForm/Field/SelectInput.js +36 -65
  134. package/lib/QueryForm/Field/fieldsMap.js +6 -23
  135. package/lib/QueryForm/Field/index.js +50 -91
  136. package/lib/QueryForm/createActions.js +9 -16
  137. package/lib/QueryForm/index.js +83 -165
  138. package/lib/QueryForm/useForm.js +1 -6
  139. package/lib/QueryListScene/List.js +89 -153
  140. package/lib/QueryListScene/QueryForm.js +58 -101
  141. package/lib/QueryListScene/QueryListScene.js +31 -56
  142. package/lib/QueryListScene/Title.js +6 -11
  143. package/lib/QueryListScene/Toolbar.js +16 -22
  144. package/lib/QueryListScene/createActions.js +7 -13
  145. package/lib/QueryListScene/index.js +5 -19
  146. package/lib/QueryListScene/useActions.js +1 -6
  147. package/lib/Select/DropDownWrap.js +35 -63
  148. package/lib/Select/index.js +142 -245
  149. package/lib/Table/ResizableTable/index.js +31 -54
  150. package/lib/Table/index.js +21 -34
  151. package/lib/Title/index.js +26 -34
  152. package/lib/index.js +36 -57
  153. package/lib/locale.js +9 -25
  154. package/lib/utils/checkAuth.js +9 -16
  155. package/lib/utils/findMenuInfoByPath.js +3 -12
  156. package/lib/utils/index.js +26 -60
  157. package/package.json +3 -2
@@ -4,7 +4,7 @@
4
4
  * @Describe: 省略号组件
5
5
  */
6
6
 
7
- import { useState, useEffect, useRef } from 'react';
7
+ import { useState, useEffect, useRef, useCallback } from 'react';
8
8
  import { Popover, Tooltip } from 'antd';
9
9
  import copy from 'copy-to-clipboard';
10
10
  import CopySVG from './Svg/CopySVG';
@@ -48,23 +48,42 @@ export default props => {
48
48
  const [hasCopy, setHasCopy] = useState(false);
49
49
 
50
50
  const elementRef = useRef();
51
+ const timeRef = useRef();
51
52
 
52
53
  useEffect(() => {
53
- elementRef.current && isEllipsisActive(elementRef.current)
54
- ? setFlag(true)
55
- : (
56
- setFlag(false),
57
- setTipVisible(false)
58
- );
59
- });
54
+ // 检查元素是否存在
55
+ if(elementRef.current){
56
+ const checkEllipsis = () => {
57
+ const isActive = isEllipsisActive(elementRef.current);
58
+ setFlag(isActive);
59
+ if (!isActive) {
60
+ setTipVisible(false);
61
+ }
62
+ };
63
+
64
+ // 初始检查
65
+ checkEllipsis();
66
+
67
+ // 监听 resize 事件,因为窗口大小变化会影响文本截断
68
+ window.addEventListener('resize', checkEllipsis);
69
+
70
+ return () => {
71
+ window.removeEventListener('resize', checkEllipsis);
72
+ if (timeRef.current) {
73
+ clearTimeout(timeRef.current);
74
+ timeRef.current = null;
75
+ }
76
+ elementRef.current = null;
77
+ };
78
+ }
79
+ }, [children, content, title]); // 添加必要的依赖项
80
+
60
81
 
61
82
  // original Node
62
83
  const inner = typeof children === 'string' ? children : (_popover ? content : title);
63
84
 
64
85
  // for className
65
- const getClassName = () => {
66
- return `overflow ${_lines ? 'ellipsis-wrap' : 'ellipsis-nowrap'} ${className || ''}`;
67
- };
86
+ const getClassName = `overflow ${_lines ? 'ellipsis-wrap' : 'ellipsis-nowrap'} ${className || ''}`;
68
87
 
69
88
  // Tooltip.trigger(default 'hover') ==trigger==> onVisibleChange(visible)
70
89
  const handleVisibleChange = (visible) => {
@@ -76,12 +95,25 @@ export default props => {
76
95
  // onClick Copy Button
77
96
  const handleCopy = (innerText) => {
78
97
  copy(innerText);
79
- setHasCopy(!hasCopy);
80
- setTimeout(() => {
98
+
99
+ // 清除之前的定时器
100
+ if (timeRef.current) {
101
+ clearTimeout(timeRef.current);
102
+ timeRef.current = null;
103
+ }
104
+
105
+ setHasCopy(true); // 直接设置为 true
106
+ timeRef.current = setTimeout(() => {
81
107
  setHasCopy(false);
82
108
  }, 1000);
83
109
  };
84
110
 
111
+ const handleCopyClick = useCallback(() => {
112
+ if (elementRef.current) {
113
+ handleCopy(elementRef.current.innerText);
114
+ }
115
+ }, []); // 没有外部依赖
116
+
85
117
  const renderNode = () => {
86
118
  const popoverNode = (
87
119
  <Popover
@@ -133,7 +165,7 @@ export default props => {
133
165
  {prefix && prefix}
134
166
  {/* content */}
135
167
  <div
136
- className={getClassName()}
168
+ className={getClassName}
137
169
  >
138
170
  {inner ? renderNode() : emptyText}
139
171
  </div>
@@ -144,7 +176,7 @@ export default props => {
144
176
  inner && _copyable &&
145
177
  <div
146
178
  className='svg-button'
147
- onClick={() => handleCopy(elementRef.current.innerText)}
179
+ onClick={handleCopyClick}
148
180
  >
149
181
  {
150
182
  !hasCopy
@@ -62,7 +62,7 @@ export default class QueryForm extends React.PureComponent {
62
62
 
63
63
  // memory 与 url解析setForm时 监听事件异步
64
64
  actions.setData('formData', values);
65
- Promise.resolve().then(()=>{
65
+ Promise.resolve().then(() => {
66
66
  onSearch && onSearch(params);
67
67
  actions.emit('search', params);
68
68
  });
@@ -73,19 +73,19 @@ export default class QueryForm extends React.PureComponent {
73
73
 
74
74
  actions.setFormData(initialValues, false);
75
75
 
76
- onReset && onReset(initialValues);
76
+ onReset?.(initialValues);
77
77
  this.onSearch();
78
78
  };
79
79
 
80
80
  onChange = (newValues, changedInfo, ...rest) => {
81
81
  const { onChange, actions } = this.props;
82
82
 
83
- onChange && onChange(
83
+ actions.setFormData(newValues, false);
84
+ onChange?.(
84
85
  newValues,
85
86
  changedInfo,
86
87
  ...rest
87
88
  );
88
- actions.setFormData(newValues, false);
89
89
  }
90
90
 
91
91
  setFormData = (data, needSearch) => {
@@ -21,18 +21,18 @@ export default () => {
21
21
  getPagination: () => get(data, 'pagination'),
22
22
 
23
23
  setFormData: (formData, needSearch = true) => {
24
- set('formData', formData);
24
+ set(data, 'formData', formData);
25
25
  eventEmitter.emit('setFormData', formData, needSearch);
26
26
  },
27
27
  resetFormData: (needSearch = false) => {
28
28
  eventEmitter.emit('resetFormData', needSearch);
29
29
  },
30
30
  setTableDataSource: dataSource => {
31
- set('dataSource', dataSource);
31
+ set(data, 'dataSource', dataSource);
32
32
  eventEmitter.emit('setTableDataSource', dataSource);
33
33
  },
34
34
  setPagination: pagination => {
35
- set('pagination', pagination);
35
+ set(data, 'pagination', pagination);
36
36
  eventEmitter.emit('setPagination', pagination);
37
37
  },
38
38
 
@@ -43,7 +43,7 @@ export default () => {
43
43
  },
44
44
 
45
45
  search: (params = {}, showLoading = true) => {
46
- return new Promise((resolve, reject) => {
46
+ return new Promise((resolve) => {
47
47
  eventEmitter.emit('search', params, {
48
48
  callback: resolve,
49
49
  showLoading
package/dist/1.tntd.js CHANGED
@@ -1 +1 @@
1
- (window.webpackJsonptntd=window.webpackJsonptntd||[]).push([[1],{76:function(e,t,n){"use strict";n.r(t);var s=n(0),p=n(1);function f(t,e){var n,r=Object.keys(t);return Object.getOwnPropertySymbols&&(n=Object.getOwnPropertySymbols(t),e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),r.push.apply(r,n)),r}function b(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function d(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e)){var n=[],r=!0,o=!1,a=void 0;try{for(var c,i=e[Symbol.iterator]();!(r=(c=i.next()).done)&&(n.push(c.value),!t||n.length!==t);r=!0);}catch(e){o=!0,a=e}finally{try{r||null==i.return||i.return()}finally{if(o)throw a}}return n}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}var y=new(n(10).a),m={account:void 0,password:void 0};t.default=function(e){var t=e.visible,r=e.close,n=e.signIn,o=d(Object(s.useState)(!1),2),a=o[0],c=o[1],e=localStorage.getItem("accountInfo");if(e)try{m=JSON.parse(e)}catch(e){}function i(e,t){l(function(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?f(Object(n),!0).forEach(function(e){b(t,e,n[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):f(Object(n)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))})}return t}({},u,b({},e,t.target.value)))}var o=d(Object(s.useState)(m),2),u=o[0],l=o[1],e=u.account,o=u.password;return React.createElement(p.Modal,{title:"开发者模拟登陆",visible:t,maskClosable:!1,onOk:function(){c(!0);var e=n&&n(u);e&&e.then&&e.then(function(n){p.message.success("模拟登陆成功"),localStorage.setItem("accountInfo",JSON.stringify(u)),c(!1),setTimeout(function(){var e=n||{},t=e.tdToken,e=e.userId;y.set("_td_token_",t,{path:"/"}),y.set("_uid_",e,{path:"/"}),r()},500)}).catch(function(e){throw c(!1),e})},onCancel:r,confirmLoading:a},React.createElement(p.Form,{labelCol:{span:5},wrapperCol:{span:18}},React.createElement(p.Form.Item,{label:"用户名:"},React.createElement(p.Input,{type:"text",placeholder:"请输入用户名",value:e||void 0,onChange:function(e){return i("account",e)}})),React.createElement(p.Form.Item,{label:"密码:"},React.createElement(p.Input,{type:"text",placeholder:"请输入用户名",value:o||void 0,onChange:function(e){return i("password",e)}}))))}}}]);
1
+ (window.webpackJsonptntd=window.webpackJsonptntd||[]).push([[1],{51:function(t,e,r){r.r(e);var u=r(0),s=r(1);function n(t){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function o(e,t){var r,n=Object.keys(e);return Object.getOwnPropertySymbols&&(r=Object.getOwnPropertySymbols(e),t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)),n}function f(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?o(Object(r),!0).forEach(function(t){p(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):o(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function p(t,e,r){return(e=(t=>(t=((t,e)=>{if("object"!=n(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0===r)return("string"===e?String:Number)(t);if("object"!=n(r=r.call(t,e||"default")))return r;throw new TypeError("@@toPrimitive must return a primitive value.")})(t,"string"),"symbol"==n(t)?t:t+""))(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function b(t,e){return(t=>{if(Array.isArray(t))return t})(t)||((t,e)=>{var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,o,a,c,i=[],l=!0,u=!1;try{if(a=(r=r.call(t)).next,0===e){if(Object(r)!==r)return;l=!1}else for(;!(l=(n=a.call(r)).done)&&(i.push(n.value),i.length!==e);l=!0);}catch(t){u=!0,o=t}finally{try{if(!l&&null!=r.return&&(c=r.return(),Object(c)!==c))return}finally{if(u)throw o}}return i}})(t,e)||((t,e)=>{var r;if(t)return"string"==typeof t?a(t,e):"Map"===(r="Object"===(r={}.toString.call(t).slice(8,-1))&&t.constructor?t.constructor.name:r)||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?a(t,e):void 0})(t,e)||(()=>{throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")})()}function a(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++)n[r]=t[r];return n}var y=new(r(10).a),m={account:void 0,password:void 0};e.default=function(t){var e=t.visible,n=t.close,r=t.signIn,t=b(Object(u.useState)(!1),2),o=t[0],a=t[1],t=localStorage.getItem("accountInfo");if(t)try{m=JSON.parse(t)}catch(t){}function c(t,e){l(f(f({},i),{},p({},t,e.target.value)))}var t=b(Object(u.useState)(m),2),i=t[0],l=t[1],t=i.account;return React.createElement(s.Modal,{title:"开发者模拟登陆",visible:e,maskClosable:!1,onOk:function(){a(!0);var t=r&&r(i);t&&t.then&&t.then(function(r){s.message.success("模拟登陆成功"),localStorage.setItem("accountInfo",JSON.stringify(i)),a(!1),setTimeout(function(){var t=r||{},e=t.tdToken,t=t.userId;y.set("_td_token_",e,{path:"/"}),y.set("_uid_",t,{path:"/"}),n()},500)}).catch(function(t){throw a(!1),t})},onCancel:n,confirmLoading:o},React.createElement(s.Form,{labelCol:{span:5},wrapperCol:{span:18}},React.createElement(s.Form.Item,{label:"用户名:"},React.createElement(s.Input,{type:"text",placeholder:"请输入用户名",value:t||void 0,onChange:function(t){return c("account",t)}})),React.createElement(s.Form.Item,{label:"密码:"},React.createElement(s.Input,{type:"text",placeholder:"请输入用户名",value:i.password||void 0,onChange:function(t){return c("password",t)}}))))}}}]);