@antscorp/antsomi-ui 1.3.5-beta.980 → 1.3.5-beta.981

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,7 @@
1
+ /// <reference types="react" />
2
+ export declare const EllipsisMiddle: React.FC<{
3
+ suffixCount: number;
4
+ children: string;
5
+ tooltip?: boolean;
6
+ style?: React.CSSProperties;
7
+ }>;
@@ -0,0 +1,9 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { Typography } from 'antd';
3
+ export const EllipsisMiddle = ({ suffixCount, children, tooltip = false, style }) => {
4
+ if (children.length <= suffixCount)
5
+ return _jsx(Typography.Text, { style: style, children: children });
6
+ const start = children.slice(0, children.length - suffixCount);
7
+ const suffix = children.slice(-suffixCount);
8
+ return (_jsx(Typography.Text, { style: { maxWidth: '100%', ...style }, ellipsis: { tooltip: tooltip ? children : false, suffix }, children: start }));
9
+ };
@@ -1 +1,2 @@
1
1
  export { Typography } from './Text';
2
+ export { EllipsisMiddle } from './EllipsisMiddle';
@@ -1 +1,2 @@
1
1
  export { Typography } from './Text';
2
+ export { EllipsisMiddle } from './EllipsisMiddle';
@@ -6,7 +6,7 @@ export { Radio, RadioGroupSub, RadioButton } from './Radio';
6
6
  export { Space } from './Space';
7
7
  export { Tag } from './Tag';
8
8
  export { Tooltip } from './Tooltip';
9
- export { Typography } from './Typography';
9
+ export { Typography, EllipsisMiddle } from './Typography';
10
10
  export { Checkbox } from './Checkbox';
11
11
  export { message } from './Message';
12
12
  export { Segmented } from './Segmented';
@@ -6,7 +6,7 @@ export { Radio, RadioGroupSub, RadioButton } from './Radio';
6
6
  export { Space } from './Space';
7
7
  export { Tag } from './Tag';
8
8
  export { Tooltip } from './Tooltip';
9
- export { Typography } from './Typography';
9
+ export { Typography, EllipsisMiddle } from './Typography';
10
10
  export { Checkbox } from './Checkbox';
11
11
  export { message } from './Message';
12
12
  export { Segmented } from './Segmented';
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import type { PayloadInfo } from '@antscorp/antsomi-ui/es/types';
2
3
  export type TDisplayFormat = 'number' | 'percentage' | 'currency' | 'datetime';
3
4
  type DisplayFormatProps = {
@@ -1,11 +1,11 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
1
+ import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
2
2
  // Libraries
3
3
  import { useEffect, useState } from 'react';
4
4
  import { translate, translations } from '@antscorp/antsomi-locales';
5
5
  // Components
6
6
  import { FormatDatetime, FormatNumber, } from './components';
7
7
  import { EditIcon } from '../../icons';
8
- import { Button, Typography } from '../../atoms';
8
+ import { Button, EllipsisMiddle, Typography } from '../../atoms';
9
9
  // Utils
10
10
  import { formatDatetimeDF, formatNumberDF } from './utils';
11
11
  // Constants
@@ -53,31 +53,25 @@ export const DisplayFormatSettings = props => {
53
53
  flexWrap: 'nowrap',
54
54
  overflow: 'hidden',
55
55
  marginTop: '5px',
56
- }, ...rest, children: [_jsxs(Typography.Text
57
- // size={11}
58
- , {
59
- // size={11}
60
- className: "ants-flex", style: {
56
+ }, ...rest, children: [_jsxs(Typography.Text, { className: "ants-flex", style: {
61
57
  color: '#7F7F7F',
62
58
  fontSize: '11px',
63
59
  whiteSpace: 'nowrap',
64
- maxWidth: 'calc(89%)',
65
- }, children: [translate(translations._ACT_PREVIEW), ": \u00A0", _jsx(Typography.Text, { style: {
60
+ maxWidth: '100%',
61
+ }, children: [translate(translations._ACT_PREVIEW), ": \u00A0"] }), _jsxs("div", { style: { display: 'inline-flex', maxWidth: '100%', alignItems: 'center' }, children: [_jsx(EllipsisMiddle, { style: {
66
62
  color: '#7F7F7F',
67
63
  fontSize: '11px',
68
64
  whiteSpace: 'nowrap',
69
- maxWidth: 'calc(81%)',
70
- }, ellipsis: { tooltip: true }, children: _jsx("bdo", { dir: "ltr", children: formatDFValue }) })] }), _jsx(Button, { disabled: disabled, size: "small", icon: _jsx(EditIcon, { width: 16, height: 16, color: "#005EB8" }), className: "ants-border-none",
71
- // className={`ants-border-none transition-colors duration-300 rounded-md ${
72
- // showDetailEdit ? 'bg-[#DEEFFE]' : 'hover:bg-[#E0F2FE]'
73
- // }`}
74
- style: {
75
- backgroundColor: showDetailEdit ? '#DEEFFE' : 'transparent',
76
- border: 'none',
77
- boxShadow: 'none',
78
- borderRadius: '5px',
79
- flexShrink: 0,
80
- }, onClick: () => setShowDetailEdit(prevShow => !prevShow) })] }));
65
+ flexShrink: 0,
66
+ width: '100%',
67
+ maxWidth: displayFormatType === 'datetime' ? '100%' : 'calc(98% + 1px)',
68
+ }, suffixCount: 7, tooltip: true, children: formatDFValue }), _jsx(Button, { disabled: disabled, size: "small", icon: _jsx(EditIcon, { width: 16, height: 16, color: "#005EB8" }), className: "ants-border-none", style: {
69
+ backgroundColor: showDetailEdit ? '#DEEFFE' : 'transparent',
70
+ border: 'none',
71
+ boxShadow: 'none',
72
+ borderRadius: '5px',
73
+ flexShrink: 0,
74
+ }, onClick: () => setShowDetailEdit(prevShow => !prevShow) })] })] }));
81
75
  };
82
76
  const renderFormatSetting = () => {
83
77
  switch (displayFormatType) {
@@ -112,13 +112,13 @@ export const FormatNumber = (props) => {
112
112
  ...settingValues,
113
113
  isCompact: checked,
114
114
  });
115
- }, children: translate(translations._TITL_EDIT_NUMBER_COMPACT) }) }), _jsx(Form.Item, { label: decimalPlacesLabel, style: { marginBottom: 12 }, colon: false, labelCol: { span: 11 }, wrapperCol: { span: 13 }, children: _jsxs("div", { style: { display: 'flex', marginLeft: '55px', gap: '15px' }, children: [_jsx(Button, { style: { border: 'none', boxShadow: 'none', borderRadius: '5px' }, disabled: decimalPlaces <= 0, onClick: () => onChangeSettingsHandle({
115
+ }, children: translate(translations._TITL_EDIT_NUMBER_COMPACT) }) }), _jsx(Form.Item, { label: decimalPlacesLabel, style: { marginBottom: 12 }, colon: false, labelCol: { span: 12 }, wrapperCol: { span: 12 }, children: _jsxs("div", { style: { display: 'flex', marginLeft: '55px', gap: '15px' }, children: [_jsx(Button, { style: { border: 'none', boxShadow: 'none', borderRadius: '5px' }, disabled: decimalPlaces <= 0, onClick: () => onChangeSettingsHandle({
116
116
  ...settingValues,
117
117
  decimalPlaces: decimalPlaces - 1,
118
118
  }), size: "small", icon: _jsx(DecreaseDecimalIcon, { color: "#005EB8", style: { padding: '2px' } }) }), _jsx(Button, { style: { border: 'none', boxShadow: 'none', borderRadius: '5px' }, onClick: () => onChangeSettingsHandle({
119
119
  ...settingValues,
120
120
  decimalPlaces: decimalPlaces + 1,
121
- }), size: "small", icon: _jsx(IncreaseDecimalIcon, { color: "#005EB8", style: { padding: '2px' } }) })] }) }), _jsx(Form.Item, { label: _jsxs(_Fragment, { children: [_jsx("span", { style: { marginRight: '6px' }, children: translate(translations._DISPLAY_GROUPING) }), _jsx(Tooltip, { placement: "top", title: translate(translations._TOOLTIP__DISPLAY_DECIMAL), style: { marginLeft: 4, opacity: 0.4 }, children: _jsx(ViewDetailsInformationIcon, { size: 14 }) })] }), colon: false, labelCol: { span: 10 }, wrapperCol: { span: 14 }, children: _jsx(Select, { style: { width: 100 }, value: grouping, onChange: value => onChangeSettingsHandle({
121
+ }), disabled: decimalPlaces >= 100, size: "small", icon: _jsx(IncreaseDecimalIcon, { color: "#005EB8", style: { padding: '2px' } }) })] }) }), _jsx(Form.Item, { label: _jsxs(_Fragment, { children: [_jsx("span", { style: { marginRight: '6px' }, children: translate(translations._DISPLAY_GROUPING) }), _jsx(Tooltip, { placement: "top", title: translate(translations._TOOLTIP__DISPLAY_DECIMAL), style: { marginLeft: 4, opacity: 0.4 }, children: _jsx(ViewDetailsInformationIcon, { size: 14 }) })] }), colon: false, labelCol: { span: 10 }, wrapperCol: { span: 14 }, children: _jsx(Select, { style: { width: 100 }, value: grouping, onChange: value => onChangeSettingsHandle({
122
122
  ...settingValues,
123
123
  grouping: value,
124
124
  }), options: listGroupingSeparatorOptions }) }), _jsx(Form.Item, { label: _jsxs(_Fragment, { children: [_jsx("span", { style: { marginRight: '6px' }, children: translate(translations._DISPLAY_DECIMAL) }), _jsx(Tooltip, { placement: "top", title: translate(translations._TOOLTIP__DISPLAY_GROUPING), style: { marginLeft: 4, opacity: 0.4 }, children: _jsx(ViewDetailsInformationIcon, { size: 14 }) })] }), labelCol: { span: 10 }, wrapperCol: { span: 14 }, colon: false, children: _jsx(Select, { style: { width: 100 }, value: decimal, onChange: value => onChangeSettingsHandle({
@@ -3,4 +3,5 @@
3
3
  * Asynchronously loads the component for TemplateListing
4
4
  *
5
5
  */
6
+ /// <reference types="react" />
6
7
  export declare const TemplateListing: (props: import("./types").TemplateListingProps<{}>) => JSX.Element;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@antscorp/antsomi-ui",
3
- "version": "1.3.5-beta.980",
3
+ "version": "1.3.5-beta.981",
4
4
  "description": "An enterprise-class UI design language and React UI library.",
5
5
  "sideEffects": [
6
6
  "dist/*",