@antscorp/antsomi-ui 1.3.5-beta.319 → 1.3.5-beta.320
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.
|
@@ -13,6 +13,7 @@ interface EditorTabItem {
|
|
|
13
13
|
interface EditorTabProps {
|
|
14
14
|
showArrow?: boolean;
|
|
15
15
|
showDropdown?: boolean;
|
|
16
|
+
editNameOnConfigure?: boolean;
|
|
16
17
|
disabledScroll?: boolean;
|
|
17
18
|
showComposeNewQuery?: boolean;
|
|
18
19
|
className?: string;
|
|
@@ -25,7 +26,7 @@ interface EditorTabProps {
|
|
|
25
26
|
onCloseTab: (tab: EditorTabItem, index: number, newTabs: EditorTabItem[]) => void;
|
|
26
27
|
onConfigure: (id: string) => void;
|
|
27
28
|
onSaveName?: (id: string, value: string) => void;
|
|
28
|
-
|
|
29
|
+
onAddTab: () => void;
|
|
29
30
|
}
|
|
30
31
|
export declare const EditorTab: React.FC<EditorTabProps>;
|
|
31
32
|
export {};
|
|
@@ -11,7 +11,7 @@ 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, disabledScroll, onCloseTab, onActiveTab,
|
|
14
|
+
const { listTab = [], activeId = '', defaultActiveId, showArrow, showDropdown, editNameOnConfigure, disabledScroll, onCloseTab, onActiveTab, onAddTab, onConfigure, onSaveName, showComposeNewQuery, className, leftBlockClassName, tabItemClassName, } = props;
|
|
15
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));
|
|
16
16
|
const [arrTabs, setArrTabs] = useState(listTab || []);
|
|
17
17
|
const [isEditable, setIsEditable] = useState();
|
|
@@ -41,7 +41,7 @@ export const EditorTab = props => {
|
|
|
41
41
|
}
|
|
42
42
|
}, [activeId, activeTabId]);
|
|
43
43
|
const handleAddNew = () => {
|
|
44
|
-
|
|
44
|
+
onAddTab();
|
|
45
45
|
};
|
|
46
46
|
const handleCloseTab = (e, tab, idx) => {
|
|
47
47
|
e.stopPropagation();
|
|
@@ -103,7 +103,7 @@ export const EditorTab = props => {
|
|
|
103
103
|
}
|
|
104
104
|
};
|
|
105
105
|
return (React.createElement(EditorTabStyled, { className: className || '' },
|
|
106
|
-
showArrow && (React.createElement("div", { className: classnames('
|
|
106
|
+
showArrow && (React.createElement("div", { className: classnames('navigate-button', {
|
|
107
107
|
'--disabled': activeTabIdx === 0,
|
|
108
108
|
}), onClick: () => onClickArrow('left') },
|
|
109
109
|
React.createElement(Icon, { type: "icon-ants-angle-left" }))),
|
|
@@ -128,7 +128,8 @@ export const EditorTab = props => {
|
|
|
128
128
|
onClick: ({ key, domEvent }) => {
|
|
129
129
|
switch (key) {
|
|
130
130
|
case 'configure':
|
|
131
|
-
|
|
131
|
+
if (editNameOnConfigure)
|
|
132
|
+
setIsEditable(tab.id);
|
|
132
133
|
onConfigure === null || onConfigure === void 0 ? void 0 : onConfigure(tab.id);
|
|
133
134
|
break;
|
|
134
135
|
case 'remove':
|
|
@@ -139,14 +140,17 @@ export const EditorTab = props => {
|
|
|
139
140
|
}
|
|
140
141
|
},
|
|
141
142
|
}, placement: "bottomRight", trigger: ['click'], destroyPopupOnHide: true },
|
|
142
|
-
React.createElement(Button, { icon: React.createElement(Icon, { type: "icon-ants-
|
|
143
|
+
React.createElement(Button, { icon: React.createElement(Icon, { type: "icon-ants-three-dot-vertical", overlayStyle: { fontSize: 12 } }),
|
|
144
|
+
// icon={<Icon type="icon-ants-angle-left" overlayStyle={{ fontSize: 12 }} />}
|
|
145
|
+
// style={{ transform: 'rotate(-90deg)' }}
|
|
146
|
+
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));
|
|
143
147
|
})
|
|
144
148
|
: null),
|
|
145
|
-
showArrow && (React.createElement("div", { className: classnames('
|
|
149
|
+
showArrow && (React.createElement("div", { className: classnames('navigate-button', '--right', {
|
|
146
150
|
'--disabled': activeTabIdx === arrTabs.length - 1,
|
|
147
151
|
}), onClick: () => onClickArrow('right') },
|
|
148
152
|
React.createElement(Icon, { type: "icon-ants-angle-right" }))),
|
|
149
|
-
showComposeNewQuery && (React.createElement(Button, { onClick: handleAddNew, className: "new-query-
|
|
153
|
+
showComposeNewQuery && (React.createElement(Button, { onClick: handleAddNew, className: "new-query-button" },
|
|
150
154
|
React.createElement(Icon, { type: "icon-ants-add-square" }),
|
|
151
155
|
"New query"))));
|
|
152
156
|
};
|
|
@@ -109,12 +109,12 @@ export const EditorTabStyled = styled.div `
|
|
|
109
109
|
}
|
|
110
110
|
}
|
|
111
111
|
|
|
112
|
-
button.new-query-
|
|
112
|
+
button.new-query-button {
|
|
113
113
|
margin-left: 10px;
|
|
114
114
|
border: none;
|
|
115
115
|
}
|
|
116
116
|
|
|
117
|
-
.
|
|
117
|
+
.navigate-button {
|
|
118
118
|
/* Structure Block */
|
|
119
119
|
flex-shrink: 0;
|
|
120
120
|
height: 100%;
|