@antscorp/antsomi-ui 1.3.5-beta.464 → 1.3.5-beta.466
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.
- package/es/components/molecules/MatchAnySelect/MatchesAnySelect.js +1 -1
- package/es/components/organism/AccountSharing/AccountSharing.js +4 -2
- package/es/components/organism/DataTable/components/Toolbar/SearchPopover.d.ts +1 -1
- package/es/components/organism/DataTable/components/Toolbar/SearchPopover.js +1 -1
- package/es/components/organism/DataTable/components/Toolbar/ToolbarActionButtons.js +2 -2
- package/es/components/organism/DataTable/hooks/useDataTableListing/types.d.ts +6 -2
- package/es/components/organism/DataTable/hooks/useDataTableListing/useDataTableListing.js +7 -3
- package/es/components/organism/DataTable/types/toolbar.d.ts +1 -1
- package/es/components/organism/DataTable/utils/filter.js +7 -0
- package/package.json +1 -1
|
@@ -252,5 +252,5 @@ export const MatchesAnySelect = props => {
|
|
|
252
252
|
};
|
|
253
253
|
return (React.createElement(Popover, { open: isOpenPopover, arrow: false, placement: "bottomLeft", content: React.createElement(MatchesAny, { items: items, selectedItems: selectedItems, isLoading: isLoading, objectName: objectName, style: { margin: '-8px 0px' }, onApply: onApplyMatchesAny, onCancel: () => setState(prev => (Object.assign(Object.assign({}, prev), { isOpenPopover: false }))) }), overlayStyle: { width: 700 }, trigger: ['click'], destroyTooltipOnHide: true, onOpenChange: () => setState(prev => (Object.assign(Object.assign({}, prev), { isOpenPopover: !isOpenPopover }))) },
|
|
254
254
|
React.createElement(Tooltip, { mouseEnterDelay: 0.5, title: `${selectedItems === null || selectedItems === void 0 ? void 0 : selectedItems.map(item => item.title).join(', ')}` },
|
|
255
|
-
React.createElement(Select, Object.assign({
|
|
255
|
+
React.createElement(Select, Object.assign({ title: "", value: value, placeholder: placeholder, popupMatchSelectWidth: 700, dropdownStyle: Object.assign(Object.assign({}, dropdownStyle), { display: 'none', padding: 0 }) }, restProps)))));
|
|
256
256
|
};
|
|
@@ -221,12 +221,14 @@ export const AccountSharing = props => {
|
|
|
221
221
|
});
|
|
222
222
|
// const delay = (ms) => new Promise((resolve) => setTimeout(resolve, ms))
|
|
223
223
|
const onClickButtonLogout = () => {
|
|
224
|
-
removeCookie(`uogs_${networkId}
|
|
224
|
+
removeCookie(`uogs_${networkId}`, {
|
|
225
|
+
secure: true,
|
|
226
|
+
});
|
|
225
227
|
if (callbackLogout)
|
|
226
228
|
callbackLogout();
|
|
227
229
|
setTimeout(() => {
|
|
228
230
|
window.location.href = urlLogout;
|
|
229
|
-
},
|
|
231
|
+
}, 1000);
|
|
230
232
|
};
|
|
231
233
|
function urlDomain(data) {
|
|
232
234
|
const a = document.createElement('a');
|
|
@@ -4,7 +4,7 @@ import { TSearchActionButton, TSearchItem } from '../../types';
|
|
|
4
4
|
interface SearchPopoverProps extends PopoverProps, TSearchActionButton {
|
|
5
5
|
onAddFilter?: (value: string) => void;
|
|
6
6
|
onSearch?: (value: string) => void;
|
|
7
|
-
onClick?: (searchItem: TSearchItem) => void;
|
|
7
|
+
onClick?: (searchItem: TSearchItem, index: number) => void;
|
|
8
8
|
}
|
|
9
9
|
export declare const SearchPopover: React.FC<SearchPopoverProps>;
|
|
10
10
|
export {};
|
|
@@ -75,7 +75,7 @@ export const SearchPopover = props => {
|
|
|
75
75
|
icon && React.createElement(IconWrapper, null, icon),
|
|
76
76
|
React.createElement(Typography.Text, Object.assign({ ellipsis: { tooltip: label } }, searchItemProps, { className: clsx(`${link ? 'text-link' : ''}`, searchItemProps === null || searchItemProps === void 0 ? void 0 : searchItemProps.className) }), link && !itemSearchRender && !onClickSearchItem && !isAddFilterFromSearchItem ? (React.createElement(Link, { to: link }, label)) : (label))));
|
|
77
77
|
return (React.createElement(StyledSearchItem, { key: id, align: "center", gap: 6, onClick: () => {
|
|
78
|
-
onClick(searchItem);
|
|
78
|
+
onClick(searchItem, index);
|
|
79
79
|
setState(prev => (Object.assign(Object.assign({}, prev), { isOpenPopover: false })));
|
|
80
80
|
} }, itemSearchRender ? itemSearchRender(searchItem, index, Label) : Label));
|
|
81
81
|
});
|
|
@@ -64,11 +64,11 @@ export const ToolbarActionButtons = memo(() => {
|
|
|
64
64
|
switch (key) {
|
|
65
65
|
case 'SEARCH': {
|
|
66
66
|
const _a = action, { addFilterInfo, onClickSearchItem, isAddFilterFromSearchItem } = _a, restOfAction = __rest(_a, ["addFilterInfo", "onClickSearchItem", "isAddFilterFromSearchItem"]);
|
|
67
|
-
return (React.createElement(SearchPopover, Object.assign({ key: key }, restOfAction, { isAddFilterFromSearchItem: isAddFilterFromSearchItem, onClickSearchItem: onClickSearchItem, onClick: searchItem => {
|
|
67
|
+
return (React.createElement(SearchPopover, Object.assign({ key: key }, restOfAction, { isAddFilterFromSearchItem: isAddFilterFromSearchItem, onClickSearchItem: onClickSearchItem, onClick: (searchItem, index) => {
|
|
68
68
|
if (isAddFilterFromSearchItem) {
|
|
69
69
|
onAddFilterFromSearch(searchItem.label, addFilterInfo);
|
|
70
70
|
}
|
|
71
|
-
onClickSearchItem === null || onClickSearchItem === void 0 ? void 0 : onClickSearchItem(searchItem);
|
|
71
|
+
onClickSearchItem === null || onClickSearchItem === void 0 ? void 0 : onClickSearchItem(searchItem, index);
|
|
72
72
|
}, onAddFilter: value => onAddFilterFromSearch(value, addFilterInfo) }), actionButton));
|
|
73
73
|
}
|
|
74
74
|
case 'COLUMN': {
|
|
@@ -10,7 +10,7 @@ import { TGetColumnMetrics, TGetFilterMetricList, TGetModifyColumnList, TGetSave
|
|
|
10
10
|
export type TApiGlobal = AxiosRequestConfig<any> & {
|
|
11
11
|
enabled?: boolean;
|
|
12
12
|
};
|
|
13
|
-
export type TConfig = {
|
|
13
|
+
export type TConfig<TTableType = any> = {
|
|
14
14
|
env?: TEnv;
|
|
15
15
|
auth?: TServiceAuth;
|
|
16
16
|
api?: {
|
|
@@ -18,6 +18,9 @@ export type TConfig = {
|
|
|
18
18
|
column?: TApiGlobal;
|
|
19
19
|
filter?: TApiGlobal;
|
|
20
20
|
search?: TApiGlobal;
|
|
21
|
+
matchesAny?: {
|
|
22
|
+
general: TApiGlobal;
|
|
23
|
+
} & Partial<Record<keyof TTableType, TApiGlobal>>;
|
|
21
24
|
};
|
|
22
25
|
object?: {
|
|
23
26
|
type: number;
|
|
@@ -35,11 +38,12 @@ type TToggleColumnType<TTableType> = TGeneralTableColumnType<TTableType> & {
|
|
|
35
38
|
onChange?: (checked: boolean, record: TTableType) => void;
|
|
36
39
|
};
|
|
37
40
|
type TTableColumnType<TTableType, K extends keyof TTableType | 'toggle'> = K extends 'toggle' ? TToggleColumnType<TTableType> : TGeneralTableColumnType<TTableType>;
|
|
38
|
-
type TSearchProps<TSearchType> = Partial<Pick<TSearchActionButton, 'addFilterInfo' | 'isClientSearch' | 'isAddFilterFromSearchItem' | '
|
|
41
|
+
type TSearchProps<TSearchType> = Partial<Pick<TSearchActionButton, 'addFilterInfo' | 'isClientSearch' | 'isAddFilterFromSearchItem' | 'searchItemProps'>> & {
|
|
39
42
|
link?: ((record: Partial<TSearchType>) => string) | string;
|
|
40
43
|
icon?: (record: Partial<TSearchType>) => ReactNode | ReactNode;
|
|
41
44
|
itemMapKeys: Record<keyof Omit<TSearchItem, 'icon' | 'link'>, keyof TSearchType>;
|
|
42
45
|
render?: (record: TSearchType, index: number, node: ReactNode) => ReactNode;
|
|
46
|
+
onClickSearchItem?: (record?: Partial<TSearchType>) => void;
|
|
43
47
|
formatData?: (response: any) => Partial<TSearchType>[];
|
|
44
48
|
};
|
|
45
49
|
export interface UseDataTableListingProps<TTableType = any, TSearchType = any> {
|
|
@@ -510,7 +510,7 @@ export function useDataTableListing(props) {
|
|
|
510
510
|
selectedRowKeys,
|
|
511
511
|
selectedRow,
|
|
512
512
|
/* Search */
|
|
513
|
-
search: Object.assign(Object.assign(Object.assign({ loading: isSearchListingLoading || isSearchListingFetching, searchList }, (!!(searchProps === null || searchProps === void 0 ? void 0 : searchProps.render) && {
|
|
513
|
+
search: Object.assign(Object.assign(Object.assign(Object.assign({ loading: isSearchListingLoading || isSearchListingFetching, searchList }, (!!(searchProps === null || searchProps === void 0 ? void 0 : searchProps.render) && {
|
|
514
514
|
itemSearchRender(_item, index, node) {
|
|
515
515
|
var _a;
|
|
516
516
|
return (((_a = searchProps === null || searchProps === void 0 ? void 0 : searchProps.render) === null || _a === void 0 ? void 0 : _a.call(searchProps, ((searchListingBody === null || searchListingBody === void 0 ? void 0 : searchListingBody[index]) || {}), index, node)) ||
|
|
@@ -520,11 +520,15 @@ export function useDataTableListing(props) {
|
|
|
520
520
|
if (!(searchProps === null || searchProps === void 0 ? void 0 : searchProps.isClientSearch)) {
|
|
521
521
|
setState(prev => (Object.assign(Object.assign({}, prev), { searchValue: valueSearch })));
|
|
522
522
|
}
|
|
523
|
-
} }),
|
|
523
|
+
} }), ((searchProps === null || searchProps === void 0 ? void 0 : searchProps.onClickSearchItem) && {
|
|
524
|
+
onClickSearchItem(item, index) {
|
|
525
|
+
var _a;
|
|
526
|
+
(_a = searchProps === null || searchProps === void 0 ? void 0 : searchProps.onClickSearchItem) === null || _a === void 0 ? void 0 : _a.call(searchProps, searchListingBody === null || searchListingBody === void 0 ? void 0 : searchListingBody[index]);
|
|
527
|
+
},
|
|
528
|
+
})), pick(searchProps, [
|
|
524
529
|
'isClientSearch',
|
|
525
530
|
'addFilterInfo',
|
|
526
531
|
'isAddFilterFromSearchItem',
|
|
527
|
-
'onClickSearchItem',
|
|
528
532
|
'searchItemProps',
|
|
529
533
|
])),
|
|
530
534
|
/* Queries */
|
|
@@ -40,7 +40,7 @@ export type TSearchActionButton = TActionButton & {
|
|
|
40
40
|
loading?: boolean;
|
|
41
41
|
itemSearchRender?: (item: TSearchItem, index: number, node: ReactNode) => React.ReactNode;
|
|
42
42
|
onSearch?: (valueSearch: string) => void;
|
|
43
|
-
onClickSearchItem?: (item: TSearchItem) => void;
|
|
43
|
+
onClickSearchItem?: (item: TSearchItem, index: number) => void;
|
|
44
44
|
};
|
|
45
45
|
export type TColumnActionButton = TActionButton & {
|
|
46
46
|
modalTitle?: string;
|
|
@@ -12,6 +12,7 @@ import { OPERATORS_CODE } from '@antscorp/antsomi-ui/es/constants/condition';
|
|
|
12
12
|
// Translations
|
|
13
13
|
import { translations } from '@antscorp/antsomi-ui/es/locales/translations';
|
|
14
14
|
import { METRIC_MAP_NUMBER_TYPE, METRIC_MAP_STRING_TYPE } from '../constants/filter';
|
|
15
|
+
import { MatchesAnySelect } from '../../../molecules';
|
|
15
16
|
const { t } = i18nInstance;
|
|
16
17
|
const { Text } = Typography;
|
|
17
18
|
/* Filter */
|
|
@@ -103,6 +104,7 @@ export const flatFilterMetrics = (filterMetrics) => filterMetrics.reduce((acc, c
|
|
|
103
104
|
/* Render Value Field */
|
|
104
105
|
export const renderValueField = ({ filterMetric, operator, value, onChangeValue = () => { }, }) => {
|
|
105
106
|
const { dataType } = filterMetric;
|
|
107
|
+
console.log('🚀 ~ filterMetric:', filterMetric);
|
|
106
108
|
switch (operator) {
|
|
107
109
|
case OPERATORS_CODE.GREATER_THAN:
|
|
108
110
|
case OPERATORS_CODE.GREATER_THAN_EQUAL:
|
|
@@ -138,6 +140,11 @@ export const renderValueField = ({ filterMetric, operator, value, onChangeValue
|
|
|
138
140
|
case OPERATORS_CODE.NOT_START_WITH: {
|
|
139
141
|
return (React.createElement(Input, { value: value, placeholder: t(translations.inputYourValue.title), onChange: e => onChangeValue(e.target.value) }));
|
|
140
142
|
}
|
|
143
|
+
case OPERATORS_CODE.MATCHES:
|
|
144
|
+
case OPERATORS_CODE.MATCHES_ANY:
|
|
145
|
+
case OPERATORS_CODE.NOT_MATCHES: {
|
|
146
|
+
return React.createElement(MatchesAnySelect, null);
|
|
147
|
+
}
|
|
141
148
|
default:
|
|
142
149
|
return null;
|
|
143
150
|
}
|