@antscorp/antsomi-ui 1.3.5-beta.322 → 1.3.5-beta.323

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.
@@ -27,11 +27,10 @@ export const EditorTab = props => {
27
27
  setArrTabs(listTab);
28
28
  // eslint-disable-next-line react-hooks/exhaustive-deps
29
29
  }, [listTab]);
30
- useEffect(() => {
31
- if (onActiveTab)
32
- onActiveTab(activeTabId);
33
- // eslint-disable-next-line react-hooks/exhaustive-deps
34
- }, [activeTabId]);
30
+ // useEffect(() => {
31
+ // if (onActiveTab) onActiveTab(activeTabId);
32
+ // // eslint-disable-next-line react-hooks/exhaustive-deps
33
+ // }, [activeTabId]);
35
34
  useEffect(() => {
36
35
  const tabEl = document.getElementById(`tab-${activeTabId}`);
37
36
  if (tabEl) {
@@ -55,20 +54,29 @@ export const EditorTab = props => {
55
54
  if (activeTabId === tab.id) {
56
55
  if (idx === arrTabs.length - 1) {
57
56
  setActiveTabId(arrTabs[idx - 1].id);
57
+ if (onActiveTab)
58
+ onActiveTab(arrTabs[idx - 1].id);
58
59
  }
59
60
  else if (arrTabs.length > 1) {
60
61
  setActiveTabId(arrTabs[idx + 1].id);
62
+ if (onActiveTab)
63
+ onActiveTab(arrTabs[idx - 1].id);
61
64
  }
62
65
  }
63
- setArrTabs(prevTabs => {
64
- const newTabs = [...prevTabs];
65
- newTabs.splice(idx, 1);
66
- onCloseTab(tab, idx, newTabs);
67
- return newTabs;
68
- });
66
+ const newTabs = [...arrTabs];
67
+ newTabs.splice(idx, 1);
68
+ onCloseTab(tab, idx, newTabs);
69
+ // setArrTabs(prevTabs => {
70
+ // const newTabs = [...prevTabs];
71
+ // newTabs.splice(idx, 1);
72
+ // onCloseTab(tab, idx, newTabs);
73
+ // return newTabs;
74
+ // });
69
75
  };
70
- const handleActiveTab = (tab, idx) => {
76
+ const handleActiveTab = tab => {
71
77
  setActiveTabId(tab.id);
78
+ if (onActiveTab)
79
+ onActiveTab(tab.id);
72
80
  };
73
81
  const onWheelLeftBlock = event => {
74
82
  try {
@@ -94,12 +102,16 @@ export const EditorTab = props => {
94
102
  return;
95
103
  }
96
104
  setActiveTabId(arrTabs[idx - 1].id);
105
+ if (onActiveTab)
106
+ onActiveTab(arrTabs[idx - 1].id);
97
107
  break;
98
108
  case 'right':
99
109
  if (idx === arrTabs.length - 1) {
100
110
  return;
101
111
  }
102
112
  setActiveTabId(arrTabs[idx + 1].id);
113
+ if (onActiveTab)
114
+ onActiveTab(arrTabs[idx + 1].id);
103
115
  break;
104
116
  default:
105
117
  break;
@@ -115,7 +127,7 @@ export const EditorTab = props => {
115
127
  ? arrTabs.map((tab, idx) => {
116
128
  const { showIcon = true, closeable = true } = tab;
117
129
  // const { showIcon = true, showDropdown = true, closeable = true } = tab;
118
- return (React.createElement("div", { key: tab.id, id: `tab-${tab.id}`, onClick: () => handleActiveTab(tab, idx), className: classnames('tab-item', tabItemClassName, {
130
+ return (React.createElement("div", { key: tab.id, id: `tab-${tab.id}`, onClick: () => handleActiveTab(tab), className: classnames('tab-item', tabItemClassName, {
119
131
  active: tab.id === activeTabId,
120
132
  }) },
121
133
  showIcon &&
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@antscorp/antsomi-ui",
3
- "version": "1.3.5-beta.322",
3
+ "version": "1.3.5-beta.323",
4
4
  "description": "An enterprise-class UI design language and React UI library.",
5
5
  "sideEffects": [
6
6
  "dist/*",