@antscorp/antsomi-ui 1.3.5-common.4 → 1.3.5-common.5

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.
@@ -14,7 +14,6 @@ interface EditorTabProps {
14
14
  showArrow?: boolean;
15
15
  showDropdown?: boolean;
16
16
  editNameOnConfigure?: boolean;
17
- disabledScroll?: boolean;
18
17
  showComposeNewQuery?: boolean;
19
18
  className?: string;
20
19
  leftBlockClassName?: string;
@@ -11,7 +11,9 @@ import { handleError } from '@antscorp/antsomi-ui/es/utils';
11
11
  const PATH = 'src/components/EditorTab/index.jsx';
12
12
  export const EditorTab = props => {
13
13
  var _a;
14
- const { listTab = [], activeId = '', defaultActiveId, showArrow, showDropdown, editNameOnConfigure, disabledScroll, onCloseTab, onActiveTab, onAddTab, onConfigure, onSaveName, showComposeNewQuery, className, leftBlockClassName, tabItemClassName, } = props;
14
+ const { listTab = [], activeId = '', defaultActiveId, showArrow, showDropdown, editNameOnConfigure,
15
+ // disabledScroll,
16
+ onCloseTab, onActiveTab, onAddTab, onConfigure, onSaveName, showComposeNewQuery, className, leftBlockClassName, tabItemClassName, } = props;
15
17
  const [activeTabId, setActiveTabId] = useState(defaultActiveId || activeId || ((_a = listTab === null || listTab === void 0 ? void 0 : listTab[0]) === null || _a === void 0 ? void 0 : _a.id));
16
18
  const [arrTabs, setArrTabs] = useState(listTab || []);
17
19
  const [isEditable, setIsEditable] = useState();
@@ -23,23 +25,25 @@ export const EditorTab = props => {
23
25
  setActiveTabId(listTab[listTab.length - 1].id);
24
26
  }
25
27
  setArrTabs(listTab);
26
- }, [listTab, arrTabs.length]);
28
+ // eslint-disable-next-line react-hooks/exhaustive-deps
29
+ }, [listTab]);
27
30
  useEffect(() => {
28
- onActiveTab(activeTabId);
29
- setTimeout(() => {
30
- if (!disabledScroll) {
31
- const tabEl = document.getElementById(`tab-${activeTabId}`);
32
- if (tabEl) {
33
- tabEl.scrollIntoView({ block: 'center', inline: 'center', behavior: 'smooth' });
34
- }
35
- }
36
- }, 500);
37
- }, [activeTabId, disabledScroll, onActiveTab]);
31
+ if (onActiveTab)
32
+ onActiveTab(activeTabId);
33
+ // eslint-disable-next-line react-hooks/exhaustive-deps
34
+ }, [activeTabId]);
38
35
  useEffect(() => {
39
- if (activeId && activeTabId !== activeId) {
40
- setActiveTabId(activeId);
36
+ const tabEl = document.getElementById(`tab-${activeTabId}`);
37
+ if (tabEl) {
38
+ tabEl.scrollIntoView({ block: 'center', inline: 'center', behavior: 'smooth' });
41
39
  }
42
- }, [activeId, activeTabId]);
40
+ }, [activeTabId]);
41
+ useEffect(() => {
42
+ // if (activeId && activeTabId !== activeId) {
43
+ // setActiveTabId(activeId);
44
+ // }
45
+ setActiveTabId(prev => (activeId && prev !== activeId ? activeId : prev));
46
+ }, [activeId]);
43
47
  const handleAddNew = () => {
44
48
  onAddTab();
45
49
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@antscorp/antsomi-ui",
3
- "version": "1.3.5-common.4",
3
+ "version": "1.3.5-common.5",
4
4
  "description": "An enterprise-class UI design language and React UI library.",
5
5
  "sideEffects": [
6
6
  "dist/*",