@antscorp/antsomi-ui 1.3.5-beta.355 → 1.3.5-beta.356

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.
@@ -37,7 +37,7 @@ export const HeaderV2 = memo(props => {
37
37
  const { env = envContext, language = languageCode, userId = isNaN(Number(auth === null || auth === void 0 ? void 0 : auth.userId)) ? 0 : Number(auth === null || auth === void 0 ? void 0 : auth.userId), portalId = auth === null || auth === void 0 ? void 0 : auth.portalId, token = auth === null || auth === void 0 ? void 0 : auth.token, permissionDomain = PERMISSION_API, iamDomain = IAM_API, appCode = contextAppCode, menuCode = contextMenuCode, } = config || {};
38
38
  const { currentAccount, inputStyle = 'select', onSelectAccount } = accountSelection, accountSelectionProps = __rest(accountSelection, ["currentAccount", "inputStyle", "onSelectAccount"]);
39
39
  const urlParams = useMemo(() => new URLSearchParams(search), [search]);
40
- const oidParam = urlParams.get('oid') || 'all';
40
+ const oidParam = urlParams.get('oid') || currentAccount || 'all';
41
41
  const [selectedAccount, setSelectedAccount] = useState(`${useURLParam ? oidParam : `${(_a = currentAccount !== null && currentAccount !== void 0 ? currentAccount : userId) !== null && _a !== void 0 ? _a : 'all'}`}`);
42
42
  useLayoutEffect(() => {
43
43
  if (useURLParam)
@@ -8,7 +8,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
8
8
  });
9
9
  };
10
10
  import React, { useEffect, useMemo, useState } from 'react';
11
- import { Avatar, Select } from 'antd';
11
+ import { Avatar, AutoComplete } from 'antd';
12
12
  import { useDebounce } from '@antscorp/antsomi-ui/es/hooks/useDebounceV2';
13
13
  import { StyledSearchUserRoot, StyledSelectItem } from './styled';
14
14
  import { isEmail } from '@antscorp/antsomi-ui/es/utils';
@@ -16,6 +16,7 @@ import { useShareAccess } from '../../hooks';
16
16
  import produce from 'immer';
17
17
  import { ACCESS_PROPERTIES_BY_ROLE, ROLE_MAPPING } from '../../constants';
18
18
  import { updateObjAccessInfo } from '../../actions';
19
+ import { Spin } from '@antscorp/antsomi-ui/es/components/atoms';
19
20
  export const SearchUser = (props) => {
20
21
  const { getUserInfo, placeholder } = props;
21
22
  const { state, dispatch } = useShareAccess();
@@ -71,7 +72,13 @@ export const SearchUser = (props) => {
71
72
  if (!allowEdit)
72
73
  return null;
73
74
  return (React.createElement(StyledSearchUserRoot, null,
74
- React.createElement(Select, { showSearch: true, placeholder: placeholder || 'Add people and groups', value: [], searchValue: searchTerm, defaultActiveFirstOption: false, suffixIcon: null, filterOption: false, onSearch: v => setSearchTerm(v), notFoundContent: null, loading: isFetching, options: (excludedUsers || []).map(user => ({
75
+ React.createElement(AutoComplete, { placeholder: placeholder || 'Add people and groups', value: searchTerm, onSearch: v => setSearchTerm(v), notFoundContent: isFetching ? (React.createElement(Spin, { style: {
76
+ width: '100%',
77
+ height: '40px',
78
+ display: 'flex',
79
+ alignItems: 'center',
80
+ justifyContent: 'center',
81
+ }, indicatorSize: 28 })) : null, options: (excludedUsers || []).map(user => ({
75
82
  value: user.user_id,
76
83
  label: (React.createElement(StyledSelectItem, { onClick: () => handleAddUser(user) },
77
84
  React.createElement(Avatar, { src: user.avatar }),
@@ -13,7 +13,7 @@ import axios from 'axios';
13
13
  import React, { useEffect, useMemo, useRef, useState } from 'react';
14
14
  import { CookiesProvider, useCookies } from 'react-cookie';
15
15
  // Icons
16
- import { Button, Flex, Popover, Spin } from '../../atoms';
16
+ import { Button, Flex, Popover, Spin, Text, Typography } from '../../atoms';
17
17
  import CloseIcon from './icons/close';
18
18
  import SearchIcon from './icons/search';
19
19
  import { InnerCardStyled, InputSearchStyled, PackageSharingStyled, TriggerPopoverStyled, } from './styled';
@@ -38,7 +38,7 @@ export const AccountSharing = props => {
38
38
  var _a;
39
39
  const { permissionDomain = '', iamDomain = '', token = '', accountId = 0, networkId = 0, appCode = '', lang = 'en', translateData = DEFAULT_TRANSLATE_DATA, urlEditProfile = '', callbackGetInfoAccount, urlLogout = '', isShowSharing = false, isShareAccountAccess = false, u_ogs = '', callbackLogout, } = props;
40
40
  const selectedNetworkRef = useRef();
41
- const [isShowSearchAccount, setIsShowSearchAccount] = useState(false);
41
+ // const [isShowSearchAccount, setIsShowSearchAccount] = useState(false);
42
42
  const [infoAccount, setInfoAccount] = useState({});
43
43
  const [listAccountSharing, setListAccountSharing] = useState([]);
44
44
  const [listAccountRecent, setListAccountRecent] = useState([]);
@@ -377,9 +377,9 @@ export const AccountSharing = props => {
377
377
  // }
378
378
  setLimitAccount(limitAccount + 1);
379
379
  });
380
- const renderAccounts = (listAccountsRender, customStyle = {}) => (React.createElement("ul", { style: Object.assign(Object.assign({}, customStyle), { opacity: `${isShowLoading ? 0.2 : 1}` }) }, (listAccountsRender === null || listAccountsRender === void 0 ? void 0 : listAccountsRender.length) ? (listAccountsRender.map((account) => (React.createElement("li", { key: account.user_id, onClick: () => handleSwitchAccount(account) },
381
- React.createElement("span", { className: "account-name" }, account.full_name),
382
- React.createElement("span", { className: "account-number" }, formatUserId(account.user_id)))))) : (React.createElement("div", null, translateLang('KEY_NO_ACCOUNTS')))));
380
+ const renderAccounts = (listAccountsRender) => listAccountsRender === null || listAccountsRender === void 0 ? void 0 : listAccountsRender.map((account) => (React.createElement("li", { key: account.user_id, onClick: () => handleSwitchAccount(account) },
381
+ React.createElement(Typography.Text, { className: "account-name", ellipsis: { tooltip: true } }, account.full_name),
382
+ React.createElement(Text, { className: "account-number" }, formatUserId(account.user_id)))));
383
383
  return (React.createElement(CookiesProvider, null,
384
384
  React.createElement(Popover, { content: React.createElement(PackageSharingStyled, null,
385
385
  React.createElement("div", { className: "div-info-account" }, infoAccount ? (React.createElement(React.Fragment, null,
@@ -421,24 +421,23 @@ export const AccountSharing = props => {
421
421
  alignItems: 'center',
422
422
  } },
423
423
  React.createElement("p", { style: { fontSize: 12, color: '#aaa', margin: 0 } }, "No networks")))))),
424
- step === STEP.SWITCH_ACCOUNT ? (isShowSharing ? (React.createElement("div", { className: "div-account-sharing mt-10" },
425
- React.createElement("div", { className: "div-cover-account" },
426
- isShowLoading ? React.createElement(Spin, null) : null,
427
- isShowSearchAccount || !(listAccountRecent === null || listAccountRecent === void 0 ? void 0 : listAccountRecent.length) ? (React.createElement(InputSearch, { value: accountSearch, onChange: value => setAccountSearch(value), onClickRemove: () => {
428
- setAccountSearch('');
429
- setIsShowSearchAccount(false);
430
- } })) : (React.createElement(React.Fragment, null,
431
- React.createElement("div", { className: "div-recent-account" },
432
- React.createElement("span", { className: "recent-title" }, "Recent accounts"),
433
- React.createElement(SearchIcon, { onClick: () => setIsShowSearchAccount(true), className: "search-icon" })),
434
- renderAccounts(listAccountRecent, {
435
- minHeight: 32,
436
- maxHeight: 162,
437
- padding: '0 10px',
438
- }))),
424
+ step === STEP.SWITCH_ACCOUNT ? (isShowSharing ? (React.createElement("div", { className: "div-cover-account" },
425
+ isShowLoading ? React.createElement(Spin, null) : null,
426
+ React.createElement(InputSearch, { value: accountSearch, onChange: value => setAccountSearch(value), onClickRemove: () => {
427
+ setAccountSearch('');
428
+ } }),
429
+ React.createElement("span", { className: "recent-title" }, "Recent accounts"),
430
+ isShowLoading ? null : (React.createElement("div", { className: "no-account-title" },
431
+ React.createElement("span", null, translateLang('KEY_NO_ACCOUNTS')))),
432
+ React.createElement("ul", { style: { opacity: `${isShowLoading ? 0.2 : 1}` } },
433
+ renderAccounts(listAccountRecent),
439
434
  renderAccounts(listAccountSharing)))) : (React.createElement("hr", { style: { margin: '10px 0 20px', background: '#E3EEF1' } }))) : null),
440
435
  React.createElement(Flex, { align: "center", justify: "center" },
441
- React.createElement(Button, { onClick: () => onClickButtonLogout(), icon: React.createElement(Icon, { type: "icon-ants-exit" }) }, translateLang('KEY_LOGOUT')))), arrow: false, trigger: ['click'], placement: "bottomRight", overlayInnerStyle: { backgroundColor: (_a = THEME.token) === null || _a === void 0 ? void 0 : _a.blue1_2, padding: '20px 15px' } },
436
+ React.createElement(Button, { onClick: () => onClickButtonLogout(), icon: React.createElement(Icon, { type: "icon-ants-logout" }) }, translateLang('KEY_LOGOUT')))), arrow: false, trigger: ['click'], placement: "bottomRight", overlayInnerStyle: {
437
+ backgroundColor: (_a = THEME.token) === null || _a === void 0 ? void 0 : _a.blue1_2,
438
+ padding: '20px 15px',
439
+ width: '400px',
440
+ } },
442
441
  React.createElement(TriggerPopoverStyled, null,
443
442
  React.createElement("div", { className: "brand-logo" }, (currentNetwork === null || currentNetwork === void 0 ? void 0 : currentNetwork.logo) ? React.createElement("img", { src: currentNetwork.logo, alt: "" }) : null),
444
443
  React.createElement("div", { className: "avatar" }, infoAccount ? React.createElement("img", { src: infoAccount.avatar, alt: "" }) : null)))));
@@ -1,4 +1,4 @@
1
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
1
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
2
2
  import styled from 'styled-components';
3
3
  import { THEME } from '@antscorp/antsomi-ui/es/constants';
4
4
  export const InputSearchStyled = styled.div `
@@ -57,6 +57,8 @@ export const InputSearchStyled = styled.div `
57
57
 
58
58
  &.remove-icon {
59
59
  /* right: 5px; */
60
+ width: 16px;
61
+ height: 16px;
60
62
  cursor: pointer;
61
63
  /* width: 12px; */
62
64
  }
@@ -113,6 +115,8 @@ export const PackageSharingStyled = styled.div `
113
115
  flex-direction: column;
114
116
  align-items: center;
115
117
  text-align: center;
118
+ width: 370px;
119
+
116
120
  .div-info-left {
117
121
  position: relative;
118
122
  margin-bottom: 10px;
@@ -126,6 +130,7 @@ export const PackageSharingStyled = styled.div `
126
130
  }
127
131
 
128
132
  .edit-profile {
133
+ text-decoration: none;
129
134
  background-color: white;
130
135
  border-radius: 100px;
131
136
  position: absolute;
@@ -153,84 +158,83 @@ export const PackageSharingStyled = styled.div `
153
158
  }
154
159
  }
155
160
  }
156
- .div-account-sharing {
161
+ .div-cover-account {
157
162
  margin-top: 10px;
163
+ min-height: 185px;
164
+ position: relative;
158
165
 
159
- .title-account-sharing {
166
+ .antsomi-spin {
167
+ position: absolute;
168
+ top: 50px;
169
+ width: 100%;
170
+ height: calc(100% - 50px);
171
+ display: flex;
172
+ justify-content: center;
173
+ align-items: center;
174
+ }
175
+ .recent-title {
176
+ display: none;
177
+ font-size: 11px;
160
178
  color: #999;
161
- font-size: 12px;
162
- margin-bottom: 10px;
179
+ padding: 10px 5px 0;
163
180
  }
164
- .div-cover-account {
165
- min-height: 185px;
166
- position: relative;
167
181
 
168
- .antsomi-spin {
169
- position: absolute;
170
- top: 50px;
171
- width: 100%;
172
- height: calc(100% - 50px);
173
- display: flex;
174
- justify-content: center;
175
- align-items: center;
176
- }
177
- .div-recent-account {
178
- padding: 10px 15px;
182
+ &:has(li) .recent-title {
183
+ display: block;
184
+ }
185
+
186
+ .no-account-title {
187
+ position: absolute;
188
+ height: calc(100% - 30px);
189
+ width: 100%;
190
+ display: flex;
191
+ justify-content: center;
192
+ align-items: center;
193
+ }
194
+ &:has(li) .no-account-title {
195
+ display: none;
196
+ }
197
+
198
+ ul {
199
+ overflow-y: auto;
200
+ max-height: 143px;
201
+ list-style: none;
202
+ padding: 0;
203
+ margin: 0;
204
+ li {
205
+ cursor: pointer;
206
+ padding: 8px 5px;
207
+ border-radius: ${(_c = THEME.token) === null || _c === void 0 ? void 0 : _c.borderRadius}px;
179
208
  display: flex;
180
- align-items: center;
181
209
  justify-content: space-between;
182
- position: relative;
210
+ align-items: center;
211
+ gap: 10px;
183
212
 
184
- .recent-title {
185
- font-size: 11px;
186
- color: #999;
213
+ &:hover {
214
+ background-color: ${(_d = THEME.token) === null || _d === void 0 ? void 0 : _d.blue};
187
215
  }
188
216
 
189
- /* .search-icon {
190
- fill: #666;
191
- width: 18px;
192
- cursor: pointer;
193
- } */
194
- }
195
- ul {
196
- overflow-y: auto;
197
- max-height: 143px;
198
- min-height: 108px;
199
- list-style: none;
200
- padding: 0;
201
- margin: 10px 0 0 0;
202
- li {
203
- padding: 8px 5px;
204
- border-radius: 10px;
205
- cursor: pointer;
206
- display: block;
217
+ .account-name {
218
+ color: #666;
219
+ font-size: 13px;
220
+ font-size: 13px;
221
+ font-weight: normal;
207
222
  overflow: hidden;
223
+ white-space: nowrap;
208
224
  text-overflow: ellipsis;
225
+ line-height: 1.4;
226
+ font-size: 13px;
227
+ font-weight: normal;
228
+ overflow: hidden;
209
229
  white-space: nowrap;
210
- position: relative;
211
- &:hover {
212
- background-color: ${(_c = THEME.token) === null || _c === void 0 ? void 0 : _c.blue};
213
- }
230
+ text-overflow: ellipsis;
231
+ line-height: 1.4;
232
+ }
214
233
 
215
- .account-name {
216
- color: #666;
217
- cursor: pointer;
218
- display: block;
219
- font-size: 13px;
220
- font-weight: normal;
221
- overflow: hidden;
222
- white-space: nowrap;
223
- text-overflow: ellipsis;
224
- line-height: 1.4;
225
- }
226
- .account-number {
227
- color: #aaa;
228
- cursor: default;
229
- font-size: 12px;
230
- position: absolute;
231
- right: 5px;
232
- top: 8px;
233
- }
234
+ .account-number {
235
+ color: #aaa;
236
+ font-size: 12px;
237
+ flex-shrink: 0;
234
238
  }
235
239
  }
236
240
  }
@@ -254,7 +258,7 @@ export const PackageSharingStyled = styled.div `
254
258
  height: 42px;
255
259
  padding: 10px;
256
260
  border-radius: 10px;
257
- border: 1px solid ${(_d = THEME.token) === null || _d === void 0 ? void 0 : _d.bw4};
261
+ border: 1px solid ${(_e = THEME.token) === null || _e === void 0 ? void 0 : _e.bw4};
258
262
 
259
263
  & img {
260
264
  width: 100%;
@@ -279,15 +283,15 @@ export const PackageSharingStyled = styled.div `
279
283
  &:hover {
280
284
  .image-wrapper {
281
285
  /* box-shadow: 1px 1px 2px 0 #aaa; */
282
- background-color: ${(_e = THEME.token) === null || _e === void 0 ? void 0 : _e.blue};
283
- border-color: ${(_f = THEME.token) === null || _f === void 0 ? void 0 : _f.blue3};
286
+ background-color: ${(_f = THEME.token) === null || _f === void 0 ? void 0 : _f.blue};
287
+ border-color: ${(_g = THEME.token) === null || _g === void 0 ? void 0 : _g.blue3};
284
288
  }
285
289
  }
286
290
  &.disabled {
287
291
  cursor: default;
288
292
  .image-wrapper {
289
- background: ${(_g = THEME.token) === null || _g === void 0 ? void 0 : _g.blue1_1};
290
- border-color: ${(_h = THEME.token) === null || _h === void 0 ? void 0 : _h.blue7};
293
+ background: ${(_h = THEME.token) === null || _h === void 0 ? void 0 : _h.blue1_1};
294
+ border-color: ${(_j = THEME.token) === null || _j === void 0 ? void 0 : _j.blue7};
291
295
  img {
292
296
  cursor: default;
293
297
  }
@@ -296,24 +300,20 @@ export const PackageSharingStyled = styled.div `
296
300
  .image-wrapper {
297
301
  border: 1px solid #ddd;
298
302
  padding: 10px;
299
- border-radius: ${(_j = THEME.token) === null || _j === void 0 ? void 0 : _j.borderRadius}px;
303
+ border-radius: ${(_k = THEME.token) === null || _k === void 0 ? void 0 : _k.borderRadius}px;
300
304
  transition: all 0.2s ease-in-out;
301
- width: 108px;
302
- height: 45px;
305
+ /* width: 108px;
306
+ height: 45px; */
303
307
  img {
304
308
  max-width: 100%;
305
309
  }
306
310
  }
307
311
  .network-name {
308
- color: ${(_k = THEME.token) === null || _k === void 0 ? void 0 : _k.bw8};
312
+ color: ${(_l = THEME.token) === null || _l === void 0 ? void 0 : _l.bw8};
309
313
  font-size: 11px;
310
314
  margin-top: 5px;
311
315
  margin-bottom: 0;
312
316
  text-align: center;
313
- /* margin: 10px 0 0;
314
- padding: 0 5px;
315
- max-height: 28px;
316
- line-height: 1.27; */
317
317
  overflow: hidden;
318
318
  text-overflow: ellipsis;
319
319
  display: -webkit-box;
@@ -326,8 +326,9 @@ export const PackageSharingStyled = styled.div `
326
326
  }
327
327
  `;
328
328
  export const InnerCardStyled = styled.div `
329
+ width: 370px;
329
330
  background-color: white;
330
- border-radius: ${(_l = THEME.token) === null || _l === void 0 ? void 0 : _l.borderRadius}px;
331
+ border-radius: ${(_m = THEME.token) === null || _m === void 0 ? void 0 : _m.borderRadius}px;
331
332
  padding: 10px;
332
333
  margin-bottom: 15px;
333
334
  `;
@@ -49,7 +49,6 @@ export const Layout = memo(props => {
49
49
  // Hooks
50
50
  useMutationObserver(() => {
51
51
  if (notificationWrapperRef.current) {
52
- console.log('dfjdsoifjdsoijoi');
53
52
  const child = notificationWrapperRef.current.querySelector('div');
54
53
  setNoSpaceTopContent(!!child);
55
54
  }
@@ -103,7 +102,7 @@ export const Layout = memo(props => {
103
102
  p_f_longdatetime: "dd MMMM 'at' HH:mm:ss",
104
103
  embeddedData: {},
105
104
  INSIGHT_U_OGS: 'uogs',
106
- } }) }), accountSharingConfig: Object.assign(Object.assign({}, headerProps === null || headerProps === void 0 ? void 0 : headerProps.accountSharingConfig), { u_ogs: 'uogs', appCode: 'APP_CUSTOMER_360' }), accountSelection: Object.assign(Object.assign({}, headerProps === null || headerProps === void 0 ? void 0 : headerProps.accountSelection), { show: !!((_b = headerProps === null || headerProps === void 0 ? void 0 : headerProps.accountSelection) === null || _b === void 0 ? void 0 : _b.show) && showAccountSelection }) }));
105
+ } }) }), accountSharingConfig: Object.assign(Object.assign({}, headerProps === null || headerProps === void 0 ? void 0 : headerProps.accountSharingConfig), { u_ogs: 'uogs', appCode: 'APP_CUSTOMER_360' }), accountSelection: Object.assign(Object.assign({}, headerProps === null || headerProps === void 0 ? void 0 : headerProps.accountSelection), { currentAccount: auth === null || auth === void 0 ? void 0 : auth.accountId, show: !!((_b = headerProps === null || headerProps === void 0 ? void 0 : headerProps.accountSelection) === null || _b === void 0 ? void 0 : _b.show) && showAccountSelection }) }));
107
106
  }, [headerProps, iamDomain, permissionDomain, showAccountSelection]);
108
107
  const mergeHeaderProps = useDeepCompareMemo(() => merge(cloneDeep(initialHeaderProps), header), [initialHeaderProps, header]);
109
108
  const _c = useDeepCompareMemo(() => merge(cloneDeep(contentWrapperProps), cloneDeep(contentWrapper)), [contentWrapperProps, contentWrapper]), { noPadding } = _c, mergeContentWrapperProps = __rest(_c, ["noPadding"]);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@antscorp/antsomi-ui",
3
- "version": "1.3.5-beta.355",
3
+ "version": "1.3.5-beta.356",
4
4
  "description": "An enterprise-class UI design language and React UI library.",
5
5
  "sideEffects": [
6
6
  "dist/*",
@@ -59,7 +59,7 @@
59
59
  "not op_mini all"
60
60
  ],
61
61
  "dependencies": {
62
- "@antscorp/icons": "0.27.29",
62
+ "@antscorp/icons": "0.27.30",
63
63
  "@antscorp/image-editor": "1.0.2",
64
64
  "@antscorp/processing-notification": "^1.0.3",
65
65
  "@dnd-kit/core": "^6.1.0",