@antscorp/antsomi-ui 1.3.5-beta.475 → 1.3.5-beta.477

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.
@@ -0,0 +1,3 @@
1
+ import React from 'react';
2
+ import { IconProps } from './type';
3
+ export declare const DataIcon: React.ForwardRefExoticComponent<IconProps & React.RefAttributes<SVGSVGElement>>;
@@ -0,0 +1,18 @@
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
+ // Libraries
13
+ import React, { forwardRef } from 'react';
14
+ export const DataIcon = forwardRef((props, ref) => {
15
+ const restProps = __rest(props, []);
16
+ return (React.createElement("svg", Object.assign({ ref: ref, width: "24", height: "24", viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, restProps),
17
+ React.createElement("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M19.002 6.5C19.002 7.88071 15.6499 9 11.515 9C7.38 9 4.02795 7.88071 4.02795 6.5C4.02795 5.11929 7.38 4 11.515 4C15.6499 4 19.002 5.11929 19.002 6.5ZM18.974 12.131C18.974 13.42 15.622 14.465 11.487 14.465C7.352 14.465 4 13.419 4 12.131V8.46204C4 9.75104 7.352 10.795 11.487 10.795C15.622 10.795 18.974 9.74904 18.974 8.46204V12.131ZM18.974 17.8423C18.974 19.1313 15.622 20.1763 11.487 20.1763C7.352 20.1763 4 19.1303 4 17.8423V14.1733C4 15.4623 7.352 16.5063 11.487 16.5063C15.622 16.5063 18.974 15.4603 18.974 14.1733V17.8423Z", fill: "currentColor" })));
18
+ });
@@ -54,3 +54,4 @@ export { Interactive } from './Interactive';
54
54
  export { Web } from './Web';
55
55
  export { LocalMallIcon } from './LocalMallIcon';
56
56
  export { LoadingIcon } from './LoadingIcon';
57
+ export { DataIcon } from './DataIcon';
@@ -54,3 +54,4 @@ export { Interactive } from './Interactive';
54
54
  export { Web } from './Web';
55
55
  export { LocalMallIcon } from './LocalMallIcon';
56
56
  export { LoadingIcon } from './LoadingIcon';
57
+ export { DataIcon } from './DataIcon';
@@ -30,6 +30,7 @@ import { globalToken } from '@antscorp/antsomi-ui/es/constants';
30
30
  import { useDeepCompareEffect, useDeepCompareMemo } from '@antscorp/antsomi-ui/es/hooks';
31
31
  // Utils
32
32
  import { flatTree, recursiveSearchItems } from '@antscorp/antsomi-ui/es/utils';
33
+ import { DataIcon } from '../../icons';
33
34
  const initialState = {
34
35
  isOpenPopover: false,
35
36
  };
@@ -205,7 +206,7 @@ export const MatchesAny = props => {
205
206
  React.createElement(TextButton, { disabled: isDisableRemoveAll, onClick: onRemoveAll }, t(translations.global.removeAll).toString())),
206
207
  React.createElement("div", { className: "matches-any__body" },
207
208
  React.createElement(Spin, { spinning: loading },
208
- React.createElement(Scrollbars, { style: { height: '100%' } }, !(selectedItems === null || selectedItems === void 0 ? void 0 : selectedItems.length) ? (React.createElement(EmptyData, { icon: "icon-ants-database", description: t(translations.global.selectItemsFromList).toString() })) : (React.createElement(StyledTree, { selectable: false, treeData: selectedTreeData, switcherIcon: props => (React.createElement(Icon, { type: "icon-ants-caret-down", style: {
209
+ React.createElement(Scrollbars, { style: { height: '100%' } }, !(selectedItems === null || selectedItems === void 0 ? void 0 : selectedItems.length) ? (React.createElement(EmptyData, { icon: React.createElement(DataIcon, { color: globalToken === null || globalToken === void 0 ? void 0 : globalToken.bw5, width: 48, height: 48 }), description: t(translations.global.selectItemsFromList).toString() })) : (React.createElement(StyledTree, { selectable: false, treeData: selectedTreeData, switcherIcon: props => (React.createElement(Icon, { type: "icon-ants-caret-down", style: {
209
210
  transform: props.expanded ? 'rotate(0)' : 'rotate(-90deg)',
210
211
  transition: 'transform 0.3s ease',
211
212
  }, color: globalToken === null || globalToken === void 0 ? void 0 : globalToken.bw8 })) })))))));
@@ -33,7 +33,11 @@ export const AddFilterButton = memo(() => {
33
33
  });
34
34
  } })) : (React.createElement(SavedFilterAndMetrics, { onSelectFilterMetric: onSelectFilterMetric, onSelectSavedFilter: () => {
35
35
  setAddFilterConditionState(prev => (Object.assign(Object.assign({}, prev), { openPopover: false })));
36
- } }))), trigger: ['click'], overlayInnerStyle: { width: 300, padding: 0 }, arrow: false, placement: "bottomLeft", destroyTooltipOnHide: true, onOpenChange: open => {
36
+ } }))), trigger: ['click'], overlayInnerStyle: {
37
+ width: 300,
38
+ padding: 0,
39
+ overflow: selectedFilterMetric ? 'visible' : 'hidden',
40
+ }, arrow: false, placement: "bottomLeft", destroyTooltipOnHide: true, onOpenChange: open => {
37
41
  setAddFilterConditionState(prev => (Object.assign(Object.assign({}, prev), { openPopover: open })));
38
42
  if (!open) {
39
43
  /* Reset filter metric */
@@ -5,8 +5,9 @@ import { Flex } from '@antscorp/antsomi-ui/es/components/atoms';
5
5
  import { Select, Form, ApplyPopupContent } from '@antscorp/antsomi-ui/es/components/molecules';
6
6
  // Constants
7
7
  import { OPERATORS, OPERATORS_OPTION } from '@antscorp/antsomi-ui/es/constants/condition';
8
- import { renderValueField } from '../../../utils';
9
8
  import { EXCEPTION_OFF_FILTER_CLASS } from '../../../constants/filter';
9
+ // Utils
10
+ import { renderValueField } from '../../../utils';
10
11
  const { BETWEEN, EXISTS, NOT_EXISTS } = OPERATORS_OPTION;
11
12
  export const FilterCondition = props => {
12
13
  // Props
@@ -88,7 +89,7 @@ export const FilterCondition = props => {
88
89
  React.createElement(Form.Item, { name: "operator", noStyle: true },
89
90
  React.createElement(Select, { value: operator, options: operatorList, onChange: () => form.setFieldsValue({
90
91
  value: '',
91
- }), dropdownRender: menu => (React.createElement("div", { className: EXCEPTION_OFF_FILTER_CLASS, onClick: e => e.stopPropagation() }, menu)) })),
92
+ }), getPopupContainer: triggerNode => triggerNode.parentElement, dropdownRender: menu => (React.createElement("div", { className: EXCEPTION_OFF_FILTER_CLASS, onClick: e => e.stopPropagation() }, menu)) })),
92
93
  React.createElement(Form.Item, { name: "value", noStyle: true }),
93
94
  renderValueField({
94
95
  filterMetric,
@@ -33,19 +33,22 @@ export const ResizableCell = props => {
33
33
  if (isRowSelectionCol || !width || disableResize) {
34
34
  return (React.createElement("th", Object.assign({}, restProps, { style: columnStyle, onClick: onClick }), CellHeaderContent));
35
35
  }
36
- const toggleCellClass = (className = 'resizable-cell') => {
36
+ const handleStyleResizable = (type) => {
37
37
  var _a, _b;
38
38
  (_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 => {
39
39
  var _a;
40
- const cell = (_a = rowEl.querySelectorAll(`.antsomi-table-cell`)) === null || _a === void 0 ? void 0 : _a[(index !== null && index !== void 0 ? index : 0) + 1];
40
+ const cell = (_a = rowEl.querySelectorAll(`.antsomi-table-cell:not(.antsomi-table-selection-column)`)) === null || _a === void 0 ? void 0 : _a[index !== null && index !== void 0 ? index : 0];
41
41
  if (cell) {
42
- cell.classList.toggle(className);
42
+ if (type === 'add') {
43
+ return cell.setAttribute('aria-resizable', 'true');
44
+ }
45
+ cell.removeAttribute('aria-resizable');
43
46
  }
44
47
  });
45
48
  };
46
49
  return (React.createElement(Resizable, { width: width || 0, height: 0, minConstraints: [MIN_COLUMN_WIDTH, 0], handle: React.createElement("div", { className: "resizable-handle-wrapper", onClick: e => {
47
50
  e.stopPropagation();
48
- } },
51
+ }, onMouseEnter: () => handleStyleResizable('add'), onMouseLeave: () => handleStyleResizable('remove') },
49
52
  React.createElement("span", Object.assign({ className: "resizable-handle" }, handleProps))), onResize: (_e, data) => {
50
53
  var _a;
51
54
  const { size } = data; // Destructure size from the resize data
@@ -16,6 +16,8 @@ import { useShallow } from 'zustand/react/shallow';
16
16
  // Components
17
17
  import { ResizableCell } from './ResizableCell';
18
18
  import { Spin, Icon } from '@antscorp/antsomi-ui/es/components/atoms';
19
+ import { EmptyData } from '@antscorp/antsomi-ui/es/components/molecules';
20
+ import { DataIcon } from '@antscorp/antsomi-ui/es/components/icons';
19
21
  // Hooks
20
22
  import { useDeepCompareEffect } from '@antscorp/antsomi-ui/es/hooks';
21
23
  // Styled
@@ -25,6 +27,10 @@ import { useDataTableContext } from '../../contexts/DataTableContext';
25
27
  // Constants
26
28
  import { DEFAULT_COLUMN_WIDTH, DEFAULT_COLUMN_WIDTHS, DEFAULT_ROW_SELECTION_WIDTH, } from '../../constants';
27
29
  import { globalToken } from '@antscorp/antsomi-ui/es/constants';
30
+ // Locales
31
+ import i18nInstance from '@antscorp/antsomi-ui/es/locales/i18n';
32
+ import { translations } from '@antscorp/antsomi-ui/es/locales/translations';
33
+ const { t } = i18nInstance;
28
34
  export const Table = memo(() => {
29
35
  var _a;
30
36
  // Store
@@ -59,7 +65,7 @@ export const Table = memo(() => {
59
65
  });
60
66
  }
61
67
  }, [tableProps.columns, columnWidths]);
62
- return (React.createElement(ConfigProvider, { theme: { token: { motion: false } } },
68
+ return (React.createElement(ConfigProvider, { theme: { token: { motion: false } }, renderEmpty: () => (React.createElement(EmptyData, { icon: React.createElement(DataIcon, { color: globalToken === null || globalToken === void 0 ? void 0 : globalToken.bw5, width: 48, height: 48 }), description: t(translations.noData).toString() })) },
63
69
  React.createElement(StyledTable, Object.assign({}, restOfTable, { ref: ref => {
64
70
  tableRef.current = ref === null || ref === void 0 ? void 0 : ref.nativeElement;
65
71
  }, scroll: Object.assign(Object.assign({}, scroll), { y: (scroll === null || scroll === void 0 ? void 0 : scroll.y) || '100%', x: (scroll === null || scroll === void 0 ? void 0 : scroll.x) || '100%' }), components: {
@@ -65,13 +65,9 @@ export const StyledTable = styled(Table) `
65
65
  }
66
66
  }
67
67
 
68
- .antsomi-table-tbody-virtual {
69
- .antsomi-table-row {
70
- .antsomi-table-cell {
71
- &.resizable-cell {
72
- border-inline-end: 2px solid ${blue1} !important;
73
- }
74
- }
68
+ .antsomi-table-row {
69
+ .antsomi-table-cell[aria-resizable='true'] {
70
+ border-inline-end: 2px solid ${blue1} !important;
75
71
  }
76
72
  }
77
73
  }
@@ -50,7 +50,7 @@ const StyledContent = styled.div `
50
50
  }
51
51
  `;
52
52
  export const SearchPopover = props => {
53
- const { children, objectName, searchList, isClientSearch, loading, isAddFilterFromSearchItem, onAddFilter = () => { }, onSearch = () => { }, onClick = () => { }, onClickSearchItem, itemSearchRender, searchItemProps } = props, restProps = __rest(props, ["children", "objectName", "searchList", "isClientSearch", "loading", "isAddFilterFromSearchItem", "onAddFilter", "onSearch", "onClick", "onClickSearchItem", "itemSearchRender", "searchItemProps"]);
53
+ const { children, objectName, searchList, isClientSearch, loading, isAddFilterFromSearchItem, searchItemProps, onAddFilter = () => { }, onSearch = () => { }, onClick = () => { }, onClickSearchItem, itemSearchRender } = props, restProps = __rest(props, ["children", "objectName", "searchList", "isClientSearch", "loading", "isAddFilterFromSearchItem", "searchItemProps", "onAddFilter", "onSearch", "onClick", "onClickSearchItem", "itemSearchRender"]);
54
54
  // State
55
55
  const [state, setState] = useState({
56
56
  searchValue: '',
@@ -145,7 +145,6 @@ export function useDataTableListing(props) {
145
145
  retry: false,
146
146
  },
147
147
  });
148
- console.log('getMatchesAnyList', getMatchesAnyList);
149
148
  // Variables
150
149
  const { data: modifyColumnsData, isLoading: isModifyColumnsLoading } = getModifyColumnList || {};
151
150
  const modifyColumnSelected = useDeepCompareMemo(() => { var _a; return ((_a = modifyColumnsData === null || modifyColumnsData === void 0 ? void 0 : modifyColumnsData.find(({ isLasted }) => +isLasted === 1)) === null || _a === void 0 ? void 0 : _a.modifyColId) || ''; }, [modifyColumnsData]);
@@ -306,10 +305,8 @@ export function useDataTableListing(props) {
306
305
  const matchesAnyProps = (matchesAny === null || matchesAny === void 0 ? void 0 : matchesAny[`${selectedFilterItem === null || selectedFilterItem === void 0 ? void 0 : selectedFilterItem.column}`.toLowerCase()])
307
306
  ? matchesAny === null || matchesAny === void 0 ? void 0 : matchesAny[`${selectedFilterItem === null || selectedFilterItem === void 0 ? void 0 : selectedFilterItem.column}`.toLowerCase()]
308
307
  : matchesAny === null || matchesAny === void 0 ? void 0 : matchesAny.general;
309
- return matchesAnyProps.formatData(matchesAnyListData);
310
- return [];
308
+ return (matchesAnyProps === null || matchesAnyProps === void 0 ? void 0 : matchesAnyProps.formatData(matchesAnyListData)) || [];
311
309
  }, [matchesAny, matchesAnyListData, selectedFilterItem === null || selectedFilterItem === void 0 ? void 0 : selectedFilterItem.column]);
312
- console.log('matchesAnyList', matchesAnyList);
313
310
  // Effects
314
311
  /**
315
312
  * Update values from local storage to state
@@ -167,7 +167,7 @@ export const renderValueField = ({ filterMetric, operator, value, matchesAny, on
167
167
  case OPERATORS_CODE.BEFORE:
168
168
  case OPERATORS_CODE.ON:
169
169
  case OPERATORS_CODE.BEFORE_DATE: {
170
- return (React.createElement(DatePicker, { placeholder: DATE_TIME_FORMAT_DISPLAY.FILTER_CONDITION, format: DATE_TIME_FORMAT_DISPLAY.FILTER_CONDITION, allowClear: false, popupClassName: EXCEPTION_OFF_FILTER_CLASS, value: dayjs(value).isValid() ? dayjs(value) : undefined, onChange: onChangeValue }));
170
+ return (React.createElement(DatePicker, { placeholder: DATE_TIME_FORMAT_DISPLAY.FILTER_CONDITION, format: DATE_TIME_FORMAT_DISPLAY.FILTER_CONDITION, allowClear: false, getPopupContainer: trigger => trigger.parentElement, placement: "bottomLeft", popupClassName: EXCEPTION_OFF_FILTER_CLASS, value: value && dayjs(value).isValid() ? dayjs(value) : undefined, onChange: onChangeValue }));
171
171
  }
172
172
  default:
173
173
  return null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@antscorp/antsomi-ui",
3
- "version": "1.3.5-beta.475",
3
+ "version": "1.3.5-beta.477",
4
4
  "description": "An enterprise-class UI design language and React UI library.",
5
5
  "sideEffects": [
6
6
  "dist/*",