@antscorp/antsomi-ui 1.3.5-common.2 → 1.3.5-common.3

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.
@@ -168,39 +168,6 @@ For more information about SproutCore, visit http://www.sproutcore.com
168
168
  * LICENSE file in the root directory of this source tree.
169
169
  */
170
170
 
171
- /**
172
- * @remix-run/router v1.7.2
173
- *
174
- * Copyright (c) Remix Software Inc.
175
- *
176
- * This source code is licensed under the MIT license found in the
177
- * LICENSE.md file in the root directory of this source tree.
178
- *
179
- * @license MIT
180
- */
181
-
182
- /**
183
- * React Router DOM v6.14.2
184
- *
185
- * Copyright (c) Remix Software Inc.
186
- *
187
- * This source code is licensed under the MIT license found in the
188
- * LICENSE.md file in the root directory of this source tree.
189
- *
190
- * @license MIT
191
- */
192
-
193
- /**
194
- * React Router v6.14.2
195
- *
196
- * Copyright (c) Remix Software Inc.
197
- *
198
- * This source code is licensed under the MIT license found in the
199
- * LICENSE.md file in the root directory of this source tree.
200
- *
201
- * @license MIT
202
- */
203
-
204
171
  /** @license React v16.13.1
205
172
  * react-is.production.min.js
206
173
  *
@@ -3,14 +3,9 @@ interface EditorTabItem {
3
3
  showIcon?: boolean;
4
4
  showDropdown?: boolean;
5
5
  closeable?: boolean;
6
- formatSelectedText: string;
7
- formattedQuery: string;
8
6
  id: string;
9
7
  name: string;
10
- query: string;
11
- type: string;
12
- selectedTextOut: string;
13
- queryResult: any;
8
+ type: 'query' | 'table-detail';
14
9
  cursorSql?: string;
15
10
  cursorSqlOut?: string;
16
11
  refreshAndFocusId?: string;
@@ -25,6 +20,7 @@ interface EditorTabProps {
25
20
  tabItemClassName?: string;
26
21
  listTab?: EditorTabItem[];
27
22
  activeId?: string;
23
+ defaultActiveId?: string;
28
24
  onActiveTab: (id: string) => void;
29
25
  onCloseTab: (tab: EditorTabItem, index: number, newTabs: EditorTabItem[]) => void;
30
26
  onConfigure: (id: string) => void;
@@ -9,29 +9,21 @@ import { EditorTabStyled } from './styled';
9
9
  // Utils
10
10
  import { handleError } from '@antscorp/antsomi-ui/es/utils';
11
11
  const PATH = 'src/components/EditorTab/index.jsx';
12
- const constants = {
13
- TAB_TYPE: {
14
- QUERY: 'query',
15
- TABLE_DETAIL: 'table-detail',
16
- },
17
- };
18
12
  export const EditorTab = props => {
19
13
  var _a;
20
- const { listTab = [], activeId = '', showArrow, showDropdown, disabledScroll, onCloseTab, onActiveTab, handleAddTab, onConfigure, onSaveName, showComposeNewQuery, className, leftBlockClassName, tabItemClassName, } = props;
21
- const [activeTabId, setActiveTabId] = useState(activeId || ((_a = listTab === null || listTab === void 0 ? void 0 : listTab[0]) === null || _a === void 0 ? void 0 : _a.id));
14
+ const { listTab = [], activeId = '', defaultActiveId, showArrow, showDropdown, disabledScroll, onCloseTab, onActiveTab, handleAddTab, onConfigure, onSaveName, showComposeNewQuery, className, leftBlockClassName, tabItemClassName, } = props;
15
+ const [activeTabId, setActiveTabId] = useState(defaultActiveId || activeId || ((_a = listTab === null || listTab === void 0 ? void 0 : listTab[0]) === null || _a === void 0 ? void 0 : _a.id));
22
16
  const [arrTabs, setArrTabs] = useState(listTab || []);
23
17
  const [isEditable, setIsEditable] = useState();
24
18
  // Ref
25
19
  const leftBlockRef = useRef(null);
26
- const activeTabIdx = useMemo(() => {
27
- return arrTabs.findIndex(tab => tab.id === activeId);
28
- }, [activeId]);
20
+ const activeTabIdx = useMemo(() => arrTabs.findIndex(tab => tab.id === activeId), [activeId, arrTabs]);
29
21
  useEffect(() => {
30
22
  if (listTab.length - arrTabs.length === 1) {
31
23
  setActiveTabId(listTab[listTab.length - 1].id);
32
24
  }
33
25
  setArrTabs(listTab);
34
- }, [listTab]);
26
+ }, [listTab, arrTabs.length]);
35
27
  useEffect(() => {
36
28
  onActiveTab(activeTabId);
37
29
  setTimeout(() => {
@@ -42,12 +34,12 @@ export const EditorTab = props => {
42
34
  }
43
35
  }
44
36
  }, 500);
45
- }, [activeTabId]);
37
+ }, [activeTabId, disabledScroll, onActiveTab]);
46
38
  useEffect(() => {
47
39
  if (activeId && activeTabId !== activeId) {
48
40
  setActiveTabId(activeId);
49
41
  }
50
- }, [activeId]);
42
+ }, [activeId, activeTabId]);
51
43
  const handleAddNew = () => {
52
44
  handleAddTab();
53
45
  };
@@ -105,6 +97,8 @@ export const EditorTab = props => {
105
97
  }
106
98
  setActiveTabId(arrTabs[idx + 1].id);
107
99
  break;
100
+ default:
101
+ break;
108
102
  }
109
103
  }
110
104
  };
@@ -121,7 +115,7 @@ export const EditorTab = props => {
121
115
  active: tab.id === activeTabId,
122
116
  }) },
123
117
  showIcon &&
124
- (tab.type === constants.TAB_TYPE.QUERY ? (React.createElement(Icon, { type: "icon-ants-material-outline-manage-search", overlayStyle: { fontSize: 21 } })) : (React.createElement(Icon, { type: "icon-ants-table-vertical", overlayStyle: { fontSize: 21 } }))),
118
+ (tab.type === 'query' ? (React.createElement(Icon, { type: "icon-ants-material-outline-manage-search", overlayStyle: { fontSize: 21 } })) : (React.createElement(Icon, { type: "icon-ants-table-vertical", overlayStyle: { fontSize: 21 } }))),
125
119
  isEditable === tab.id ? (React.createElement(ContentEditable, { value: tab.name, onSave: newValue => {
126
120
  setIsEditable(undefined);
127
121
  onSaveName === null || onSaveName === void 0 ? void 0 : onSaveName(tab.id, newValue);
@@ -134,7 +128,6 @@ export const EditorTab = props => {
134
128
  onClick: ({ key, domEvent }) => {
135
129
  switch (key) {
136
130
  case 'configure':
137
- console.log('click configure', domEvent);
138
131
  setIsEditable(tab.id);
139
132
  onConfigure === null || onConfigure === void 0 ? void 0 : onConfigure(tab.id);
140
133
  break;
@@ -145,7 +138,7 @@ export const EditorTab = props => {
145
138
  break;
146
139
  }
147
140
  },
148
- }, placement: "bottomRight", trigger: ['click'] },
141
+ }, placement: "bottomRight", trigger: ['click'], destroyPopupOnHide: true },
149
142
  React.createElement(Button, { icon: React.createElement(Icon, { type: "icon-ants-angle-left", overlayStyle: { fontSize: 12 } }), style: { transform: 'rotate(-90deg)' }, size: "small" }))) : closeable ? (React.createElement(Button, { icon: React.createElement(Icon, { type: "icon-ants-remove-slim", onClick: e => handleCloseTab(e, tab, idx), overlayStyle: { fontSize: 12 } }), size: "small" })) : null));
150
143
  })
151
144
  : null),
@@ -54,8 +54,15 @@ export const EditorTabStyled = styled.div `
54
54
  max-width: 200px;
55
55
  background-color: ${(_b = THEME.token) === null || _b === void 0 ? void 0 : _b.bw2};
56
56
 
57
+ & button {
58
+ display: none !important;
59
+ }
60
+
57
61
  &:hover {
58
62
  background-color: ${(_c = THEME.token) === null || _c === void 0 ? void 0 : _c.blue};
63
+ & button {
64
+ display: flex !important;
65
+ }
59
66
  }
60
67
 
61
68
  white-space: nowrap;
@@ -87,6 +94,9 @@ export const EditorTabStyled = styled.div `
87
94
  transform: scaleX(1);
88
95
  }
89
96
  background-color: #fff;
97
+ & button {
98
+ display: flex !important;
99
+ }
90
100
  }
91
101
  }
92
102
 
@@ -71,10 +71,10 @@ export const useLeftMenu = (props) => {
71
71
  const { data: dashboardData, refetch: refetchDashboard } = useGetDashboard({
72
72
  args: {
73
73
  auth: {
74
- token: env === 'development' ? '5474r2x214z284d4w2b4y494d43464k5a4v2j464m5a4' : auth === null || auth === void 0 ? void 0 : auth.token,
75
- url: env === 'development' ? `${CDP_API.production}/hub` : `${CDP_API === null || CDP_API === void 0 ? void 0 : CDP_API[env]}/hub`,
76
- portalId: env === 'development' ? 561236459 : auth === null || auth === void 0 ? void 0 : auth.portalId,
77
- userId: env === 'development' ? '1600083836' : auth === null || auth === void 0 ? void 0 : auth.userId,
74
+ token: auth === null || auth === void 0 ? void 0 : auth.token,
75
+ url: `${CDP_API === null || CDP_API === void 0 ? void 0 : CDP_API[env]}/hub`,
76
+ portalId: auth === null || auth === void 0 ? void 0 : auth.portalId,
77
+ userId: auth === null || auth === void 0 ? void 0 : auth.userId,
78
78
  },
79
79
  params: {
80
80
  objectType,
@@ -3,6 +3,7 @@ import styled, { css } from 'styled-components';
3
3
  import skeletonBackground from '../../../../../assets/images/background/skeleton-background.png';
4
4
  // Constants
5
5
  import { globalToken } from '@antscorp/antsomi-ui/es/constants';
6
+ import { MOBILE_VIEWPORT } from '@antscorp/antsomi-ui/es/components/atoms/MobileFrameV2/constants';
6
7
  const THUMBNAIL_CARD_RADIUS = 5;
7
8
  export const BannerWrapper = styled.div `
8
9
  width: 100%;
@@ -19,9 +20,16 @@ export const BannerWrapper = styled.div `
19
20
  #banner-mobile {
20
21
  ${props => {
21
22
  const height = props.$height || 700;
22
- const scale = (height - 10) / 722.41;
23
+ const smallScale = (height - 10) / (MOBILE_VIEWPORT.MD.height + 36);
24
+ const largeScale = (height - 10) / (MOBILE_VIEWPORT.LG.height + 36);
23
25
  return css `
24
- transform: scale(${scale});
26
+ @media screen and (max-height: 1000px) {
27
+ transform: scale(${smallScale});
28
+ }
29
+
30
+ @media screen and (min-height: 1001px) {
31
+ transform: scale(${largeScale});
32
+ }
25
33
  `;
26
34
  }}
27
35
  }
@@ -177,9 +177,9 @@ THEME.components = {
177
177
  titleFontSizeSM: 14,
178
178
  horizontalMargin: '0px',
179
179
  colorBorderSecondary: '#E5E5E5',
180
- lineHeight: 1.17,
181
- lineHeightLG: 1.17,
182
- lineHeightSM: 1.17,
180
+ lineHeight: 1.143,
181
+ lineHeightLG: 1.143,
182
+ lineHeightSM: 1.143,
183
183
  itemHoverColor: (_w = THEME.token) === null || _w === void 0 ? void 0 : _w.colorPrimary,
184
184
  },
185
185
  Collapse: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@antscorp/antsomi-ui",
3
- "version": "1.3.5-common.2",
3
+ "version": "1.3.5-common.3",
4
4
  "description": "An enterprise-class UI design language and React UI library.",
5
5
  "sideEffects": [
6
6
  "dist/*",
@@ -19,6 +19,7 @@
19
19
  "unpkg": "dist/index.js",
20
20
  "types": "es/index.d.ts",
21
21
  "scripts": {
22
+ "publish": "npm run clean && npm run build:es",
22
23
  "build:es": "npm run copy-files && npm run ts-compile",
23
24
  "clean": "rimraf dist lib es",
24
25
  "dev": "vite",