@antscorp/antsomi-ui 1.3.5-beta.405 → 1.3.5-beta.407

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.
@@ -7,6 +7,9 @@ interface ResizableCellProps extends Omit<React.ThHTMLAttributes<HTMLTableCellEl
7
7
  width?: number;
8
8
  handleProps?: HandleProps;
9
9
  disableResize?: boolean;
10
+ fixed?: string;
11
+ index?: number;
12
+ tableRef?: React.RefObject<HTMLDivElement>;
10
13
  }
11
14
  export declare const ResizableCell: React.FC<ResizableCellProps>;
12
15
  export {};
@@ -10,18 +10,35 @@ var __rest = (this && this.__rest) || function (s, e) {
10
10
  return t;
11
11
  };
12
12
  // Libraries
13
- import React from 'react';
13
+ import React, { useMemo } from 'react';
14
14
  import { Resizable } from 'react-resizable';
15
+ import { MIN_COLUMN_WIDTH } from '../../constants';
16
+ // Components
17
+ import { Typography } from '@antscorp/antsomi-ui/es/components/atoms';
15
18
  export const ResizableCell = props => {
16
19
  var _a;
17
- const { width, handleProps, disableResize, onResize } = props, restProps = __rest(props, ["width", "handleProps", "disableResize", "onResize"]);
20
+ const { width, handleProps, disableResize, onResize, children, style, fixed, index, tableRef } = props, restProps = __rest(props, ["width", "handleProps", "disableResize", "onResize", "children", "style", "fixed", "index", "tableRef"]);
21
+ // Memos
22
+ const columnStyle = useMemo(() => (Object.assign(Object.assign({}, style), { zIndex: fixed ? 100 - (index || 0) : undefined })), [style, fixed, index]);
18
23
  const isRowSelectionCol = (_a = props === null || props === void 0 ? void 0 : props.className) === null || _a === void 0 ? void 0 : _a.includes('antsomi-table-selection-column');
19
24
  if (isRowSelectionCol || !width || disableResize) {
20
- return React.createElement("th", Object.assign({}, restProps));
25
+ return (React.createElement("th", Object.assign({}, restProps, { style: columnStyle }),
26
+ React.createElement(Typography.Text, { ellipsis: { tooltip: true } }, children)));
21
27
  }
22
- return (React.createElement(Resizable, { width: width || 0, height: 0, handle: React.createElement("div", { className: "resizable-handle-wrapper", onClick: e => {
28
+ const toggleCellClass = (className = 'resizable-cell') => {
29
+ var _a, _b;
30
+ (_b = (_a = tableRef === null || tableRef === void 0 ? void 0 : tableRef.current) === null || _a === void 0 ? void 0 : _a.querySelectorAll('.antsomi-table-row')) === null || _b === void 0 ? void 0 : _b.forEach(rowEl => {
31
+ var _a;
32
+ const cell = (_a = rowEl.querySelectorAll(`.antsomi-table-cell`)) === null || _a === void 0 ? void 0 : _a[1];
33
+ if (cell) {
34
+ cell.classList.toggle(className);
35
+ }
36
+ });
37
+ };
38
+ return (React.createElement(Resizable, { width: width || 0, height: 0, minConstraints: [MIN_COLUMN_WIDTH, 0], handle: React.createElement("div", { className: "resizable-handle-wrapper", onClick: e => {
23
39
  e.stopPropagation();
24
40
  } },
25
41
  React.createElement("span", Object.assign({ className: "resizable-handle" }, handleProps))), onResize: (...args) => onResize && onResize(...args), draggableOpts: { enableUserSelectHack: true } },
26
- React.createElement("th", Object.assign({}, restProps, { tabIndex: 0 }))));
42
+ React.createElement("th", Object.assign({}, restProps, { style: columnStyle }),
43
+ React.createElement(Typography.Text, { ellipsis: { tooltip: true } }, children))));
27
44
  };
@@ -1,14 +1,3 @@
1
- var __rest = (this && this.__rest) || function (s, e) {
2
- var t = {};
3
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
4
- t[p] = s[p];
5
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
6
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
7
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
8
- t[p[i]] = s[p[i]];
9
- }
10
- return t;
11
- };
12
1
  // Libraries
13
2
  import React, { memo, useCallback, useRef, useState } from 'react';
14
3
  import { cloneDeep } from 'lodash';
@@ -41,12 +30,21 @@ export const Table = memo(() => {
41
30
  // Variables
42
31
  const { scroll } = tableProps;
43
32
  // Handles
44
- const handleResize = useCallback((index) => (e, _a) => {
45
- var { size } = _a, restOfCallback = __rest(_a, ["size"]);
33
+ const handleResize = useCallback((index) => (e, { size }) => {
46
34
  const nextColumns = cloneDeep(columns || []);
47
35
  nextColumns[index] = Object.assign(Object.assign({}, nextColumns[index]), { width: size.width });
48
36
  setState(prev => (Object.assign(Object.assign({}, prev), { columns: nextColumns })));
49
37
  }, [columns]);
38
+ const calculateLastColWidth = (col) => {
39
+ var _a, _b;
40
+ // If last column is fixed then return full rest of width
41
+ if (col.fixed) {
42
+ return '100%';
43
+ }
44
+ const restOfWidth = ((((_a = tableProps.columns) === null || _a === void 0 ? void 0 : _a.length) || 1) - 1) * DEFAULT_COLUMN_WIDTH;
45
+ const tableWidth = ((_b = tableRef.current) === null || _b === void 0 ? void 0 : _b.clientWidth) || restOfWidth;
46
+ return tableWidth > restOfWidth ? tableWidth - restOfWidth : DEFAULT_COLUMN_WIDTH;
47
+ };
50
48
  // Effects
51
49
  useDeepCompareEffect(() => {
52
50
  if (tableProps.columns) {
@@ -55,7 +53,7 @@ export const Table = memo(() => {
55
53
  return (Object.assign(Object.assign({}, prev), { columns: (_a = tableProps.columns) === null || _a === void 0 ? void 0 : _a.map((col, index) => {
56
54
  var _a, _b;
57
55
  return (Object.assign(Object.assign({}, col), { width: index === (((_a = tableProps.columns) === null || _a === void 0 ? void 0 : _a.length) || 1) - 1
58
- ? 'auto'
56
+ ? calculateLastColWidth(col)
59
57
  : (_b = col.width) !== null && _b !== void 0 ? _b : (DEFAULT_COLUMN_WIDTHS[index] || DEFAULT_COLUMN_WIDTH) }));
60
58
  }) }));
61
59
  });
@@ -76,8 +74,11 @@ export const Table = memo(() => {
76
74
  }), { columns: columns === null || columns === void 0 ? void 0 : columns.map((col, index) => (Object.assign(Object.assign({}, col), { onHeaderCell: (column) => {
77
75
  var _a;
78
76
  return ({
77
+ tableRef,
79
78
  disableResize: index === ((columns === null || columns === void 0 ? void 0 : columns.length) || 1) - 1,
79
+ fixed: column.fixed,
80
80
  width: column.width,
81
+ index,
81
82
  handleProps: {
82
83
  style: {
83
84
  height: (_a = tableRef === null || tableRef === void 0 ? void 0 : tableRef.current) === null || _a === void 0 ? void 0 : _a.clientHeight,
@@ -88,5 +89,5 @@ export const Table = memo(() => {
88
89
  } }))), bordered: true, pagination: false, loading: {
89
90
  indicator: React.createElement(Spin, null),
90
91
  spinning: !!tableProps.loading,
91
- }, tableLayout: "auto" })));
92
+ }, tableLayout: "fixed" })));
92
93
  });
@@ -18,6 +18,16 @@ export const StyledTable = styled(Table) `
18
18
  }
19
19
  }
20
20
  }
21
+
22
+ .antsomi-table-body {
23
+ .antsomi-table-row {
24
+ .antsomi-table-cell {
25
+ &.resizable-cell {
26
+ border-inline-end: 2px solid ${globalToken === null || globalToken === void 0 ? void 0 : globalToken.blue1} !important;
27
+ }
28
+ }
29
+ }
30
+ }
21
31
  }
22
32
 
23
33
  thead.antsomi-table-thead {
@@ -26,7 +36,6 @@ export const StyledTable = styled(Table) `
26
36
  }
27
37
 
28
38
  /* Style handle resize */
29
-
30
39
  .resizable-handle-wrapper {
31
40
  position: absolute;
32
41
  top: 0px;
@@ -34,7 +43,7 @@ export const StyledTable = styled(Table) `
34
43
  width: 20px;
35
44
  display: flex;
36
45
  justify-content: center;
37
- z-index: 20;
46
+ z-index: 10;
38
47
  cursor: col-resize;
39
48
 
40
49
  .resizable-handle {
@@ -1,6 +1,7 @@
1
1
  declare const DATA_TABLE_PREFIX = "data-table";
2
2
  declare const DATA_TABLE_DEFAULT_NAME = "default";
3
3
  declare const DEFAULT_COLUMN_WIDTH = 200;
4
+ declare const MIN_COLUMN_WIDTH = 100;
4
5
  declare const DEFAULT_ROW_SELECTION_WIDTH = 47;
5
6
  declare const DEFAULT_COLUMN_WIDTHS: number[];
6
- export { DATA_TABLE_DEFAULT_NAME, DATA_TABLE_PREFIX, DEFAULT_COLUMN_WIDTH, DEFAULT_ROW_SELECTION_WIDTH, DEFAULT_COLUMN_WIDTHS, };
7
+ export { DATA_TABLE_DEFAULT_NAME, DATA_TABLE_PREFIX, DEFAULT_COLUMN_WIDTH, DEFAULT_ROW_SELECTION_WIDTH, MIN_COLUMN_WIDTH, DEFAULT_COLUMN_WIDTHS, };
@@ -1,7 +1,8 @@
1
1
  const DATA_TABLE_PREFIX = 'data-table';
2
2
  const DATA_TABLE_DEFAULT_NAME = 'default';
3
3
  const DEFAULT_COLUMN_WIDTH = 200;
4
+ const MIN_COLUMN_WIDTH = 100;
4
5
  const DEFAULT_FIRST_COLUMN_WIDTH = 200;
5
6
  const DEFAULT_ROW_SELECTION_WIDTH = 47;
6
7
  const DEFAULT_COLUMN_WIDTHS = [DEFAULT_FIRST_COLUMN_WIDTH].concat(Array.from({ length: 20 }, () => DEFAULT_COLUMN_WIDTH));
7
- export { DATA_TABLE_DEFAULT_NAME, DATA_TABLE_PREFIX, DEFAULT_COLUMN_WIDTH, DEFAULT_ROW_SELECTION_WIDTH, DEFAULT_COLUMN_WIDTHS, };
8
+ export { DATA_TABLE_DEFAULT_NAME, DATA_TABLE_PREFIX, DEFAULT_COLUMN_WIDTH, DEFAULT_ROW_SELECTION_WIDTH, MIN_COLUMN_WIDTH, DEFAULT_COLUMN_WIDTHS, };
@@ -3,13 +3,16 @@ import { TEnv } from '@antscorp/antsomi-ui/es/types/config';
3
3
  import { AxiosRequestConfig } from 'axios';
4
4
  import { FilterItem, TableProps } from '../../types';
5
5
  import { PaginationProps } from '../../components';
6
+ export type TApiGlobal = AxiosRequestConfig<any> & {
7
+ enabled?: boolean;
8
+ };
6
9
  export type TConfig = {
7
10
  env?: TEnv;
8
11
  auth?: TServiceAuth;
9
12
  api?: {
10
- listing?: AxiosRequestConfig<any>;
11
- column?: AxiosRequestConfig<any>;
12
- filter?: AxiosRequestConfig<any>;
13
+ listing?: TApiGlobal;
14
+ column?: TApiGlobal;
15
+ filter?: TApiGlobal;
13
16
  };
14
17
  object?: {
15
18
  type: number;
@@ -7,8 +7,19 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
7
7
  step((generator = generator.apply(thisArg, _arguments || [])).next());
8
8
  });
9
9
  };
10
+ var __rest = (this && this.__rest) || function (s, e) {
11
+ var t = {};
12
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
13
+ t[p] = s[p];
14
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
15
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
16
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
17
+ t[p[i]] = s[p[i]];
18
+ }
19
+ return t;
20
+ };
10
21
  // Libraries
11
- import { useCallback, useMemo, useState } from 'react';
22
+ import React, { useCallback, useMemo, useState } from 'react';
12
23
  import { isEmpty } from 'lodash';
13
24
  // Types
14
25
  import { useAppConfigContext } from '@antscorp/antsomi-ui/es/providers';
@@ -47,9 +58,9 @@ export function useDataTableListing(props) {
47
58
  // Variables
48
59
  const { env = appConfig === null || appConfig === void 0 ? void 0 : appConfig.env, auth = appConfig === null || appConfig === void 0 ? void 0 : appConfig.auth, api, object } = config;
49
60
  const { column: apiColumn, filter: apiFilter, listing: apiListing } = api || {};
50
- const { url: columnUrl = `${COLUMN_DOMAIN[env || 'development']}/api/column` } = apiColumn || {};
51
- const { url: filterUrl = `${COLUMN_DOMAIN[env || 'development']}/api/filter` } = apiFilter || {};
52
- const { url: listingUrl = '' } = apiListing || {};
61
+ const _a = apiColumn || {}, { url: columnUrl = `${COLUMN_DOMAIN[env || 'development']}/api/column`, enabled: enabledApiColumn = true } = _a, restOfApiColumnRequest = __rest(_a, ["url", "enabled"]);
62
+ const _b = apiFilter || {}, { url: filterUrl = `${COLUMN_DOMAIN[env || 'development']}/api/filter`, enabled: enabledApiFilter = true } = _b, restOfApiFilterRequest = __rest(_b, ["url", "enabled"]);
63
+ const _c = apiListing || {}, { url: listingUrl = '', enabled: enabledApiListing = true } = _c, restOfApiListingRequest = __rest(_c, ["url", "enabled"]);
53
64
  const { filters, selectedFilterId, pagination } = state;
54
65
  const modifyColumnAuth = Object.assign(Object.assign({}, auth), { url: columnUrl });
55
66
  const filterAuth = Object.assign(Object.assign({}, auth), { url: filterUrl });
@@ -70,24 +81,40 @@ export function useDataTableListing(props) {
70
81
  args: {
71
82
  auth: modifyColumnAuth,
72
83
  params: mapObject,
84
+ request: restOfApiColumnRequest,
85
+ },
86
+ options: {
87
+ enabled: enabledApiColumn,
73
88
  },
74
89
  });
75
90
  const { data: modifyColumnsData, isLoading: isModifyColumnsLoading } = useGetModifyColumnList({
76
91
  args: {
77
92
  auth: modifyColumnAuth,
78
93
  params: mapObject,
94
+ request: restOfApiColumnRequest,
95
+ },
96
+ options: {
97
+ enabled: enabledApiColumn,
79
98
  },
80
99
  });
81
100
  const { data: savedFiltersData } = useGetSavedFilterList({
82
101
  args: {
83
102
  auth: filterAuth,
84
103
  params: mapObject,
104
+ request: restOfApiFilterRequest,
105
+ },
106
+ options: {
107
+ enabled: enabledApiFilter,
85
108
  },
86
109
  });
87
110
  const { data: filterMetricsData } = useGetFilterMetricList({
88
111
  args: {
89
112
  auth: filterAuth,
90
113
  params: mapObject,
114
+ request: restOfApiFilterRequest,
115
+ },
116
+ options: {
117
+ enabled: enabledApiFilter,
91
118
  },
92
119
  });
93
120
  const { data: tableListing, isLoading: isTableListingLoading, isRefetching: isTableListingRefetching, refetch: refetchTableListing, } = useGetTableListing({
@@ -98,9 +125,10 @@ export function useDataTableListing(props) {
98
125
  page: pagination.page,
99
126
  filter: JSON.stringify(mapFiltersToApiFilters(filters || [])),
100
127
  },
128
+ request: restOfApiListingRequest,
101
129
  },
102
130
  options: {
103
- enabled: !!(listingAuth === null || listingAuth === void 0 ? void 0 : listingAuth.url) && !!(listingAuth === null || listingAuth === void 0 ? void 0 : listingAuth.token),
131
+ enabled: !!(listingAuth === null || listingAuth === void 0 ? void 0 : listingAuth.url) && !!(listingAuth === null || listingAuth === void 0 ? void 0 : listingAuth.token) && enabledApiListing,
104
132
  },
105
133
  });
106
134
  // Variables
@@ -179,8 +207,10 @@ export function useDataTableListing(props) {
179
207
  key: name,
180
208
  dataIndex: name,
181
209
  title: label,
182
- ellipsis: true,
183
210
  fixed: fixColumn ? 'left' : undefined,
211
+ render(value, record, index) {
212
+ return React.createElement(Text, { ellipsis: { tooltip: true } }, value);
213
+ },
184
214
  // render(value, record, index) {
185
215
  // return (
186
216
  // <Text ellipsis={{ tooltip: true }} style={{ width: 'fit-content' }}>
@@ -231,7 +261,7 @@ export function useDataTableListing(props) {
231
261
  refetchTableListing();
232
262
  }, [mapObject, refetchTableListing, updateModifyColumn]);
233
263
  const onApplyModifyColumn = useCallback((args) => __awaiter(this, void 0, void 0, function* () {
234
- var _a;
264
+ var _d;
235
265
  const { selectedMetrics, columnSetName, existColumnSet } = args || {};
236
266
  const flattenMetrics = flatTree(columnMetricsData, 'child');
237
267
  const selectedColumnMetrics = selectedMetrics
@@ -244,7 +274,7 @@ export function useDataTableListing(props) {
244
274
  exitModifyColumnId = (existColumnSet === null || existColumnSet === void 0 ? void 0 : existColumnSet.id) || '';
245
275
  if (columnSetName === '') {
246
276
  exitModifyColumnId =
247
- ((_a = modifyColumnsData === null || modifyColumnsData === void 0 ? void 0 : modifyColumnsData.find(modifyColumn => modifyColumn.modifyName === 'Custom')) === null || _a === void 0 ? void 0 : _a.modifyColId) || '';
277
+ ((_d = modifyColumnsData === null || modifyColumnsData === void 0 ? void 0 : modifyColumnsData.find(modifyColumn => modifyColumn.modifyName === 'Custom')) === null || _d === void 0 ? void 0 : _d.modifyColId) || '';
248
278
  }
249
279
  }
250
280
  /**
@@ -375,6 +375,10 @@ export const GlobalStyle = () => {
375
375
  }
376
376
 
377
377
  .antsomi-picker-dropdown__advanced {
378
+ &.antsomi-picker-dropdown > .antsomi-picker-panel-container {
379
+ border-radius: 10px;
380
+ }
381
+
378
382
  > .antsomi-picker-panel-container > .antsomi-picker-panel-layout > .antsomi-picker-panel {
379
383
  flex-direction: column-reverse;
380
384
  padding-bottom: 60px;
@@ -8,11 +8,11 @@ const { GET_COLUMN_METRICS, GET_MODIFY_COLUMN_LIST, GET_SAVED_FILTER_LIST, GET_F
8
8
  /* Column */
9
9
  export const useGetColumnMetrics = (params) => {
10
10
  const { args, options } = params;
11
- return useQuery(Object.assign({ queryKey: [GET_COLUMN_METRICS, args.params], queryFn: () => dataTableServices.column.getColumnMetrics(args) }, options));
11
+ return useQuery(Object.assign({ queryKey: [GET_COLUMN_METRICS, args.params, args.request], queryFn: () => dataTableServices.column.getColumnMetrics(args) }, options));
12
12
  };
13
13
  export const useGetModifyColumnList = (params) => {
14
14
  const { args, options } = params;
15
- return useQuery(Object.assign({ queryKey: [GET_MODIFY_COLUMN_LIST, args.params], queryFn: () => dataTableServices.column.getModifyColumnList(args) }, options));
15
+ return useQuery(Object.assign({ queryKey: [GET_MODIFY_COLUMN_LIST, args.params, args.request], queryFn: () => dataTableServices.column.getModifyColumnList(args) }, options));
16
16
  };
17
17
  export const useUpdateModifyColumn = (params) => {
18
18
  const { options, auth } = params || {};
@@ -44,11 +44,11 @@ export const useDeleteModifyColumn = (params) => {
44
44
  /* Filter */
45
45
  export const useGetSavedFilterList = (params) => {
46
46
  const { args, options } = params;
47
- return useQuery(Object.assign({ queryKey: [GET_SAVED_FILTER_LIST, args.params], queryFn: () => dataTableServices.filter.getSavedFilterList(args) }, options));
47
+ return useQuery(Object.assign({ queryKey: [GET_SAVED_FILTER_LIST, args.params, args.request], queryFn: () => dataTableServices.filter.getSavedFilterList(args) }, options));
48
48
  };
49
49
  export const useGetFilterMetricList = (params) => {
50
50
  const { args, options } = params;
51
- return useQuery(Object.assign({ queryKey: [GET_FILTER_METRIC_LIST, args.params], queryFn: () => dataTableServices.filter.getFilterMetricList(args) }, options));
51
+ return useQuery(Object.assign({ queryKey: [GET_FILTER_METRIC_LIST, args.params, args.request], queryFn: () => dataTableServices.filter.getFilterMetricList(args) }, options));
52
52
  };
53
53
  export const useSaveFilter = (params) => {
54
54
  const { options, auth } = params || {};
@@ -80,5 +80,5 @@ export const useDeleteSavedFilter = (params) => {
80
80
  /* Table Listing */
81
81
  export const useGetTableListing = (params) => {
82
82
  const { options, args } = params || {};
83
- return useQuery(Object.assign({ queryKey: [GET_FILTER_METRIC_LIST, args === null || args === void 0 ? void 0 : args.params], queryFn: () => dataTableServices.listing.getTableListing(args) }, options));
83
+ return useQuery(Object.assign({ queryKey: [GET_FILTER_METRIC_LIST, args === null || args === void 0 ? void 0 : args.params, args === null || args === void 0 ? void 0 : args.request], queryFn: () => dataTableServices.listing.getTableListing(args) }, options));
84
84
  };
@@ -1,3 +1,4 @@
1
+ import { AxiosRequestConfig } from 'axios';
1
2
  import { TServiceAuth } from '../../types';
2
3
  import { ColumnMetric, FilterMetric, ModifyColumn } from '../../models/DataTable';
3
4
  import { SavedFilter } from '../../models/DataTable/SavedFilter';
@@ -10,10 +11,12 @@ export type TGlobalApiParams = {
10
11
  export type TGetMetricListArgs = {
11
12
  auth?: TServiceAuth;
12
13
  params?: TGlobalApiParams;
14
+ request?: AxiosRequestConfig<any>;
13
15
  };
14
16
  export type TGetModifyColumnListArgs = {
15
17
  auth?: TServiceAuth;
16
18
  params?: TGlobalApiParams;
19
+ request?: AxiosRequestConfig<any>;
17
20
  };
18
21
  export type TUpdateModifyColumnArgs = {
19
22
  auth?: TServiceAuth;
@@ -40,10 +43,12 @@ export type TDeleteModifyColumnArgs = {
40
43
  export type TGetSavedFilterListArgs = {
41
44
  auth?: TServiceAuth;
42
45
  params?: TGlobalApiParams;
46
+ request?: AxiosRequestConfig<any>;
43
47
  };
44
48
  export type TGetFilterMetricListArgs = {
45
49
  auth?: TServiceAuth;
46
50
  params?: TGlobalApiParams;
51
+ request?: AxiosRequestConfig<any>;
47
52
  };
48
53
  export type TSaveFilterArgs = {
49
54
  auth?: TServiceAuth;
@@ -74,11 +79,12 @@ export type TGetTableListingArgs = {
74
79
  page?: number;
75
80
  filter?: string;
76
81
  };
82
+ request?: AxiosRequestConfig<any>;
77
83
  };
78
84
  export declare const dataTableServices: {
79
85
  column: {
80
- getColumnMetrics: ({ auth, params }: TGetMetricListArgs) => Promise<ColumnMetric[]>;
81
- getModifyColumnList: ({ auth, params, }: TGetModifyColumnListArgs) => Promise<ModifyColumn[]>;
86
+ getColumnMetrics: ({ auth, params, request, }: TGetMetricListArgs) => Promise<ColumnMetric[]>;
87
+ getModifyColumnList: ({ auth, params, request, }: TGetModifyColumnListArgs) => Promise<ModifyColumn[]>;
82
88
  updateModifyColumn: ({ auth, data, }: TUpdateModifyColumnArgs) => Promise<{
83
89
  status: number;
84
90
  }>;
@@ -90,8 +96,8 @@ export declare const dataTableServices: {
90
96
  }>;
91
97
  };
92
98
  filter: {
93
- getSavedFilterList: ({ auth, params, }: TGetSavedFilterListArgs) => Promise<SavedFilter[]>;
94
- getFilterMetricList: ({ auth, params, }: TGetFilterMetricListArgs) => Promise<FilterMetric[]>;
99
+ getSavedFilterList: ({ auth, params, request, }: TGetSavedFilterListArgs) => Promise<SavedFilter[]>;
100
+ getFilterMetricList: ({ auth, params, request, }: TGetFilterMetricListArgs) => Promise<FilterMetric[]>;
95
101
  saveFilter: ({ auth, data }: TSaveFilterArgs) => Promise<{
96
102
  status: number;
97
103
  }>;
@@ -103,6 +109,6 @@ export declare const dataTableServices: {
103
109
  }>;
104
110
  };
105
111
  listing: {
106
- getTableListing<T = any>({ auth, params, }: TGetTableListingArgs): Promise<DataTableListing<T>>;
112
+ getTableListing<T = any>({ auth, params, request, }: TGetTableListingArgs): Promise<DataTableListing<T>>;
107
113
  };
108
114
  };
@@ -32,29 +32,21 @@ const mapAuth = (auth) => {
32
32
  };
33
33
  export const dataTableServices = {
34
34
  column: {
35
- getColumnMetrics: (_a) => __awaiter(void 0, [_a], void 0, function* ({ auth, params }) {
35
+ getColumnMetrics: (_a) => __awaiter(void 0, [_a], void 0, function* ({ auth, params, request, }) {
36
36
  const { url } = auth || {};
37
37
  const { type = GET_COLUMNS, objType, objId } = params || {};
38
- const response = yield axios({
39
- url,
40
- method: 'GET',
41
- params: Object.assign(Object.assign({}, mapAuth(auth)), { type,
38
+ const response = yield axios(Object.assign(Object.assign({}, request), { url, method: 'GET', params: Object.assign(Object.assign(Object.assign({}, request === null || request === void 0 ? void 0 : request.params), mapAuth(auth)), { type,
42
39
  objType,
43
- objId }),
44
- });
40
+ objId }) }));
45
41
  return get(response, 'data.data.metrics', []);
46
42
  }),
47
- getModifyColumnList: (_b) => __awaiter(void 0, [_b], void 0, function* ({ auth, params, }) {
43
+ getModifyColumnList: (_b) => __awaiter(void 0, [_b], void 0, function* ({ auth, params, request, }) {
48
44
  try {
49
45
  const { url } = auth || {};
50
46
  const { type = GET_LIST_MODIFY_COLUMN, objType, objId } = params || {};
51
- const response = yield axios({
52
- url,
53
- method: 'GET',
54
- params: Object.assign(Object.assign({}, mapAuth(auth)), { type,
47
+ const response = yield axios(Object.assign(Object.assign({}, request), { url, method: 'GET', params: Object.assign(Object.assign(Object.assign({}, request === null || request === void 0 ? void 0 : request.params), mapAuth(auth)), { type,
55
48
  objType,
56
- objId }),
57
- });
49
+ objId }) }));
58
50
  return get(response, 'data.data.modifyColumns', []);
59
51
  }
60
52
  catch (error) {
@@ -107,34 +99,26 @@ export const dataTableServices = {
107
99
  }),
108
100
  },
109
101
  filter: {
110
- getSavedFilterList: (_j) => __awaiter(void 0, [_j], void 0, function* ({ auth, params, }) {
102
+ getSavedFilterList: (_j) => __awaiter(void 0, [_j], void 0, function* ({ auth, params, request, }) {
111
103
  try {
112
104
  const { url } = auth || {};
113
105
  const { type = GET_SAVED_FILTER, objType: object, objId } = params || {};
114
- const response = yield axios({
115
- url,
116
- method: 'GET',
117
- params: Object.assign(Object.assign({}, mapAuth(auth)), { type,
106
+ const response = yield axios(Object.assign(Object.assign({}, request), { url, method: 'GET', params: Object.assign(Object.assign(Object.assign({}, request === null || request === void 0 ? void 0 : request.params), mapAuth(auth)), { type,
118
107
  object,
119
- objId }),
120
- });
108
+ objId }) }));
121
109
  return get(response, 'data.data.filters', []);
122
110
  }
123
111
  catch (error) {
124
112
  return Promise.reject(error);
125
113
  }
126
114
  }),
127
- getFilterMetricList: (_k) => __awaiter(void 0, [_k], void 0, function* ({ auth, params, }) {
115
+ getFilterMetricList: (_k) => __awaiter(void 0, [_k], void 0, function* ({ auth, params, request, }) {
128
116
  try {
129
117
  const { url } = auth || {};
130
118
  const { type = GET_LIST_FILTER, objType: object, objId } = params || {};
131
- const response = yield axios({
132
- url,
133
- method: 'GET',
134
- params: Object.assign(Object.assign({}, mapAuth(auth)), { type,
119
+ const response = yield axios(Object.assign(Object.assign({}, request), { url, method: 'GET', params: Object.assign(Object.assign(Object.assign({}, request === null || request === void 0 ? void 0 : request.params), mapAuth(auth)), { type,
135
120
  object,
136
- objId }),
137
- });
121
+ objId }) }));
138
122
  return get(response, 'data.data.filters', []);
139
123
  }
140
124
  catch (error) {
@@ -198,13 +182,9 @@ export const dataTableServices = {
198
182
  },
199
183
  listing: {
200
184
  getTableListing(_a) {
201
- return __awaiter(this, arguments, void 0, function* ({ auth, params, }) {
185
+ return __awaiter(this, arguments, void 0, function* ({ auth, params, request, }) {
202
186
  try {
203
- const response = yield axios({
204
- url: `${auth === null || auth === void 0 ? void 0 : auth.url}`,
205
- method: 'GET',
206
- params: Object.assign(Object.assign({}, mapAuth(auth)), params),
207
- });
187
+ const response = yield axios(Object.assign(Object.assign({}, request), { url: `${auth === null || auth === void 0 ? void 0 : auth.url}`, method: 'GET', params: Object.assign(Object.assign(Object.assign({}, request === null || request === void 0 ? void 0 : request.params), mapAuth(auth)), params) }));
208
188
  return get(response, 'data.data', {
209
189
  body: [],
210
190
  header: [],
@@ -53,6 +53,9 @@ export const DataTableTest = () => {
53
53
  listing: {
54
54
  url: 'https://sandbox-survey.antsomi.com/api/v1/survey/performance',
55
55
  },
56
+ column: {
57
+ enabled: false,
58
+ },
56
59
  },
57
60
  object: {
58
61
  objectId: -1, // Current just support for survey
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@antscorp/antsomi-ui",
3
- "version": "1.3.5-beta.405",
3
+ "version": "1.3.5-beta.407",
4
4
  "description": "An enterprise-class UI design language and React UI library.",
5
5
  "sideEffects": [
6
6
  "dist/*",