@antscorp/antsomi-ui 1.3.5-beta.4 → 1.3.5-beta.6
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/assets/images/background/skeleton-background.png +0 -0
- package/es/components/common/ConfigProvider/ConfigProvider.d.ts +1 -1
- package/es/components/common/ConfigProvider/ConfigProvider.js +1 -1
- package/es/components/molecules/DatePicker/components/AdvancedPicker/AdvancedPicker.js +4 -4
- package/es/components/molecules/DatePicker/components/AdvancedPicker/styled.d.ts +2 -0
- package/es/components/molecules/DatePicker/components/AdvancedPicker/styled.js +8 -1
- package/es/components/molecules/DatePicker/components/AdvancedRangePicker/AdvancedRangePicker.d.ts +2 -1
- package/es/components/molecules/DatePicker/components/AdvancedRangePicker/AdvancedRangePicker.js +3 -2
- package/es/components/molecules/ThumbnailCard/ThumbnailCard.d.ts +3 -0
- package/es/components/{template/TemplateListing/components/TemplateItem/index.js → molecules/ThumbnailCard/ThumbnailCard.js} +15 -12
- package/es/components/molecules/ThumbnailCard/constants.d.ts +3 -0
- package/es/components/molecules/ThumbnailCard/constants.js +3 -0
- package/es/components/molecules/ThumbnailCard/index.d.ts +2 -0
- package/es/components/molecules/ThumbnailCard/index.js +2 -0
- package/es/components/molecules/ThumbnailCard/styled.d.ts +1 -0
- package/es/components/{template/TemplateListing/components/TemplateItem → molecules/ThumbnailCard}/styled.js +13 -7
- package/es/components/molecules/ThumbnailCard/types.d.ts +17 -0
- package/es/components/molecules/index.d.ts +2 -0
- package/es/components/molecules/index.js +1 -0
- package/es/components/template/TemplateListing/components/BlankTemplate/index.js +7 -7
- package/es/components/template/TemplateListing/components/BlankTemplate/styled.js +2 -0
- package/es/components/template/TemplateListing/components/CategoryListing/index.js +3 -3
- package/es/components/template/TemplateListing/components/CategoryListing/styled.js +2 -2
- package/es/components/template/TemplateListing/components/CategoryListing/types.d.ts +2 -1
- package/es/components/template/TemplateListing/components/index.d.ts +0 -1
- package/es/components/template/TemplateListing/components/index.js +0 -1
- package/es/components/template/TemplateListing/constants/defaultProps.d.ts +4 -2
- package/es/components/template/TemplateListing/constants/defaultProps.js +2 -0
- package/es/components/template/TemplateListing/index.js +4 -3
- package/es/components/template/TemplateListing/types/BlankTemplate.d.ts +3 -2
- package/es/components/template/TemplateListing/types/CategoryListing.d.ts +3 -1
- package/es/components/template/TemplateListing/types/TemplateListing.d.ts +7 -6
- package/es/components/template/TemplateListing/types/index.d.ts +0 -1
- package/es/components/template/TemplateListing/types/index.js +0 -1
- package/es/locales/en/translation.json +2 -2
- package/package.json +1 -1
- package/es/components/template/TemplateListing/components/TemplateItem/index.d.ts +0 -3
- package/es/components/template/TemplateListing/components/TemplateItem/styled.d.ts +0 -1
- package/es/components/template/TemplateListing/types/TemplateItem.d.ts +0 -14
- /package/es/components/{template/TemplateListing/types/TemplateItem.js → molecules/ThumbnailCard/types.js} +0 -0
|
Binary file
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { ConfigProviderProps as AntdConfigProviderProps } from 'antd/es/config-provider';
|
|
2
2
|
import React, { ReactNode } from 'react';
|
|
3
|
-
import 'animate.css';
|
|
4
3
|
import '@antscorp/antsomi-ui/es/assets/css/main.scss';
|
|
5
4
|
import { TLocale } from '@antscorp/antsomi-ui/es/types';
|
|
5
|
+
import 'animate.css';
|
|
6
6
|
interface ConfigProviderProps extends Omit<AntdConfigProviderProps, 'locale'> {
|
|
7
7
|
children?: ReactNode;
|
|
8
8
|
locale?: TLocale;
|
|
@@ -19,7 +19,6 @@ import localeData from 'dayjs/plugin/localeData';
|
|
|
19
19
|
/** dayjs plugins for timezone */
|
|
20
20
|
import utc from 'dayjs/plugin/utc';
|
|
21
21
|
import timezone from 'dayjs/plugin/timezone';
|
|
22
|
-
import 'animate.css';
|
|
23
22
|
// Constants
|
|
24
23
|
import { THEME } from '@antscorp/antsomi-ui/es/constants';
|
|
25
24
|
// Style
|
|
@@ -28,6 +27,7 @@ import '@antscorp/antsomi-ui/es/assets/css/main.scss';
|
|
|
28
27
|
// Initialize languages
|
|
29
28
|
// import '@antscorp/antsomi-ui/es/locales/i18n';
|
|
30
29
|
import i18next from '@antscorp/antsomi-ui/es/locales/i18n';
|
|
30
|
+
import 'animate.css';
|
|
31
31
|
// NOTE: HOT fix DatePicker Advanced
|
|
32
32
|
dayjs.extend(weekday);
|
|
33
33
|
dayjs.extend(localeData);
|
|
@@ -10,7 +10,7 @@ import { useDeepCompareEffect } from '../../../../../hooks';
|
|
|
10
10
|
import Icon from '@antscorp/icons';
|
|
11
11
|
import { EventIcon } from '../../../../icons';
|
|
12
12
|
// Components
|
|
13
|
-
import {
|
|
13
|
+
import { InputNumber, Divider, Space, Button, Typography, } from '@antscorp/antsomi-ui/es/components/atoms';
|
|
14
14
|
import { Select, Dropdown } from '@antscorp/antsomi-ui/es/components';
|
|
15
15
|
import { ErrorMessage } from '../ErrorMessage/ErrorMessage';
|
|
16
16
|
import { DropdownLabel } from '../DropdownLabel/DropdownLabel';
|
|
@@ -18,7 +18,7 @@ import { DropdownLabel } from '../DropdownLabel/DropdownLabel';
|
|
|
18
18
|
import { handleError, reorder } from '@antscorp/antsomi-ui/es/utils';
|
|
19
19
|
import { calculationDateAdvanced, getCellRender, getFormatDisplay, getPickerRender, getTimePickerRender, } from './utils';
|
|
20
20
|
// Styled
|
|
21
|
-
import { DatePickerCustomInput, DatePickerHeader, DropdownContent, DropdownHeader, DatePickerFooter, DropdownFooter, CalendarIconWrapper, } from './styled';
|
|
21
|
+
import { DatePickerCustomInput, DatePickerHeader, DropdownContent, DropdownHeader, DatePickerFooter, DropdownFooter, CalendarIconWrapper, InputStyled, } from './styled';
|
|
22
22
|
// Constants
|
|
23
23
|
import { CALCULATION_DATES, CALCULATION_TYPES, DATE_TYPES, DEFAULT_DATE_FORMAT, VALUE_TYPES, ADVANCED_PICKER_TYPE, WEEK_ARR, QUARTER_PLACEHOLDER, WEEK_PLACEHOLDER, DAY_LABEL_SHORT, MONTH_LABEL_FULL, DAY_OF_MONTH, ANCHOR_LEAP_YEAR, GRANULARITY_MAPPING, } from './constants';
|
|
24
24
|
import { THEME } from '@antscorp/antsomi-ui/es/constants';
|
|
@@ -413,10 +413,10 @@ export const AdvancedPicker = props => {
|
|
|
413
413
|
// }}
|
|
414
414
|
overlayStyle: { width: 'fit-content', minWidth: 'auto' } },
|
|
415
415
|
React.createElement(Tooltip, { title: selectedDateTitle },
|
|
416
|
-
React.createElement(
|
|
416
|
+
React.createElement(InputStyled, { disabled: disabled, onClick: () => toggleOpenDropdown(), readOnly: true, suffix: React.createElement(CalendarIconWrapper, { style: {
|
|
417
417
|
pointerEvents: disabled ? 'none' : 'all',
|
|
418
418
|
}, onClick: () => toggleOpenDropdown() },
|
|
419
|
-
React.createElement(EventIcon, { width: 19, height: 19 })), style: inputStyle, value: selectedDateTitle, status: errorMessage ? 'error' : '' }))))));
|
|
419
|
+
React.createElement(EventIcon, { width: 19, height: 19 })), style: Object.assign({ textOverflow: 'ellipsis' }, inputStyle), value: selectedDateTitle, status: errorMessage ? 'error' : '' }))))));
|
|
420
420
|
};
|
|
421
421
|
AdvancedPicker.defaultProps = {
|
|
422
422
|
label: '',
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
1
2
|
export declare const DropdownContent: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
2
3
|
export declare const DropdownHeader: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
3
4
|
export declare const DropdownFooter: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
4
5
|
export declare const DatePickerHeader: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
5
6
|
export declare const DatePickerCustomInput: import("styled-components").StyledComponent<"input", any, {}, never>;
|
|
7
|
+
export declare const InputStyled: import("styled-components").StyledComponent<import("react").ComponentType<any> | keyof import("react").JSX.IntrinsicElements, any, import("../../../../atoms/Input").InputProps, any>;
|
|
6
8
|
export declare const DatePickerFooter: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
7
9
|
export declare const CalendarIconWrapper: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
var _a, _b, _c, _d, _e;
|
|
2
2
|
// Libraries
|
|
3
|
-
import { THEME } from '../../../../../constants';
|
|
4
3
|
import styled from 'styled-components';
|
|
4
|
+
import { Input } from '@antscorp/antsomi-ui/es/components/atoms';
|
|
5
|
+
import { THEME } from '../../../../../constants';
|
|
5
6
|
export const DropdownContent = styled.div `
|
|
6
7
|
width: 250px;
|
|
7
8
|
padding: 10px 10px 0px 10px;
|
|
@@ -80,6 +81,12 @@ export const DatePickerHeader = styled.div `
|
|
|
80
81
|
export const DatePickerCustomInput = styled.input `
|
|
81
82
|
font-family: ${(_d = THEME.token) === null || _d === void 0 ? void 0 : _d.fontFamily};
|
|
82
83
|
color: ${(_e = THEME.token) === null || _e === void 0 ? void 0 : _e.bw10} !important;
|
|
84
|
+
text-overflow: ellipsis;
|
|
85
|
+
`;
|
|
86
|
+
export const InputStyled = styled(Input) `
|
|
87
|
+
input {
|
|
88
|
+
text-overflow: ellipsis;
|
|
89
|
+
}
|
|
83
90
|
`;
|
|
84
91
|
export const DatePickerFooter = styled.div `
|
|
85
92
|
position: absolute;
|
package/es/components/molecules/DatePicker/components/AdvancedRangePicker/AdvancedRangePicker.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import React, { ReactNode } from 'react';
|
|
2
2
|
import { TShowCalculationTypeCondition, ValueTypes } from '../AdvancedPicker/types';
|
|
3
3
|
import { TDateConfig, TOnChangePayload, TTimeRange } from './types';
|
|
4
4
|
export interface AdvancedRangePickerProps {
|
|
@@ -12,6 +12,7 @@ export interface AdvancedRangePickerProps {
|
|
|
12
12
|
showLabel?: boolean;
|
|
13
13
|
showTime?: boolean;
|
|
14
14
|
timezone?: string;
|
|
15
|
+
separator?: ReactNode;
|
|
15
16
|
onChange?: ({ timeRange, mode }: TOnChangePayload) => void;
|
|
16
17
|
}
|
|
17
18
|
export declare const AdvancedRangePicker: React.FC<AdvancedRangePickerProps>;
|
package/es/components/molecules/DatePicker/components/AdvancedRangePicker/AdvancedRangePicker.js
CHANGED
|
@@ -19,7 +19,7 @@ const PATH = '@antscorp/antsomi-ui/es/components/molecules/DatePicker/components
|
|
|
19
19
|
export const AdvancedRangePicker = props => {
|
|
20
20
|
const { t } = i18nInstance;
|
|
21
21
|
// Props
|
|
22
|
-
const { valueType, timeRange, errorMessage, showLabel, startDateConfig, endDateConfig, showTime, showCalculationTypeCondition, disabled, timezone, onChange, } = props;
|
|
22
|
+
const { valueType, timeRange, errorMessage, showLabel, startDateConfig, endDateConfig, showTime, showCalculationTypeCondition, disabled, timezone, separator, onChange, } = props;
|
|
23
23
|
const [timeRangeState, setTimeRange] = useState(timeRange);
|
|
24
24
|
useDeepCompareEffect(() => {
|
|
25
25
|
if (typeof onChange === 'function') {
|
|
@@ -54,8 +54,9 @@ export const AdvancedRangePicker = props => {
|
|
|
54
54
|
});
|
|
55
55
|
}
|
|
56
56
|
};
|
|
57
|
-
return (React.createElement(Space, { size: 20 },
|
|
57
|
+
return (React.createElement(Space, { size: 20, align: "end" },
|
|
58
58
|
React.createElement(AdvancedPicker, { valueType: valueType, disabled: disabled, label: showLabel ? t(translations.datePicker.startDate) || '' : '', date: timeRange.startDate.date, option: omit(timeRange.startDate, 'date'), operatorKey: "between", type: "startDate", format: ADVANCED_RANGE_PICKER_FORMAT.startDate, errorMessage: errorMessage, disableAfterDate: timeRange.endDate.date, showTime: showTime, calculationTypeKeysShow: startDateConfig === null || startDateConfig === void 0 ? void 0 : startDateConfig.calculationTypeKeysShow, showCalculationTypeCondition: showCalculationTypeCondition, timezone: timezone, onUpdatedNewDate: ({ date }) => onUpdateTimeRange('startDate', { date }, 'system'), onApply: ({ date, option }) => onUpdateTimeRange('startDate', Object.assign({ date }, option), 'user') }),
|
|
59
|
+
separator || null,
|
|
59
60
|
React.createElement(AdvancedPicker, { valueType: valueType, disabled: disabled, label: showLabel ? t(translations.datePicker.endDate) || '' : '', date: timeRange.endDate.date, option: omit(timeRange.endDate, 'date'), operatorKey: "between", type: "endDate", format: ADVANCED_RANGE_PICKER_FORMAT.endDate, errorMessage: errorMessage, showTime: showTime, calculationTypeKeysShow: endDateConfig === null || endDateConfig === void 0 ? void 0 : endDateConfig.calculationTypeKeysShow, showCalculationTypeCondition: showCalculationTypeCondition, timezone: timezone, onUpdatedNewDate: ({ date }) => onUpdateTimeRange('endDate', { date }, 'system'), onApply: ({ date, option }) => onUpdateTimeRange('endDate', Object.assign({ date }, option), 'user') })));
|
|
60
61
|
};
|
|
61
62
|
AdvancedRangePicker.defaultProps = {
|
|
@@ -23,16 +23,17 @@ import React, { memo } from 'react';
|
|
|
23
23
|
import Icon from '@antscorp/icons';
|
|
24
24
|
import { Modal } from 'antd';
|
|
25
25
|
// Styled
|
|
26
|
-
import {
|
|
26
|
+
import { ThumbnailCardWrapper } from './styled';
|
|
27
27
|
// Components
|
|
28
|
-
import { Button, Flex } from '
|
|
29
|
-
|
|
30
|
-
|
|
28
|
+
import { Button, Flex, Typography } from '../../atoms';
|
|
29
|
+
// Constants
|
|
30
|
+
import { THUMBNAIL_CARD_DEFAULT_HEIGHT, THUMBNAIL_CARD_DEFAULT_WIDTH } from './constants';
|
|
31
|
+
export const ThumbnailCard = memo(props => {
|
|
31
32
|
const [modal, contextHolder] = Modal.useModal();
|
|
32
|
-
const { id, width =
|
|
33
|
-
const _a =
|
|
33
|
+
const { id, width = THUMBNAIL_CARD_DEFAULT_WIDTH, height = THUMBNAIL_CARD_DEFAULT_HEIGHT, thumbnail, removable = true, editText = 'Edit thumbnail', previewText = 'Preview', onClickEdit, onClickPreview, removeModalProps, } = props;
|
|
34
|
+
const _a = removeModalProps || {}, { onOk } = _a, restOfRemoveTemplateModalProps = __rest(_a, ["onOk"]);
|
|
34
35
|
// Handlers
|
|
35
|
-
const
|
|
36
|
+
const handleRemoveThumbnail = () => {
|
|
36
37
|
modal.confirm(Object.assign(Object.assign({ title: 'Remove Template', centered: true, icon: React.createElement(Icon, { type: "icon-ants-info", style: { fontSize: 16, lineHeight: '25px' } }), content: (React.createElement("div", null,
|
|
37
38
|
React.createElement("p", null, "Are you sure you want to remove the template?"),
|
|
38
39
|
React.createElement("p", null, "This action cant not be undone."))), okText: 'Remove', cancelText: 'Cancel', closable: true }, restOfRemoveTemplateModalProps), { onOk: () => __awaiter(void 0, void 0, void 0, function* () {
|
|
@@ -40,14 +41,16 @@ export const TemplateItem = memo(props => {
|
|
|
40
41
|
onOk(id);
|
|
41
42
|
}) }));
|
|
42
43
|
};
|
|
43
|
-
return (React.createElement(
|
|
44
|
+
return (React.createElement(ThumbnailCardWrapper, { style: { width, height } },
|
|
44
45
|
React.createElement("div", { className: "screen" }, thumbnail && React.createElement("img", { src: thumbnail, alt: "" })),
|
|
45
46
|
React.createElement(Flex, { className: "center-action", align: "center", gap: 10, vertical: true },
|
|
46
|
-
React.createElement(Button, { type: "primary", className: "animate__animated animate__fadeIn", onClick: () => onClickEdit && onClickEdit(id) },
|
|
47
|
-
|
|
47
|
+
React.createElement(Button, { type: "primary", className: "animate__animated animate__fadeIn", onClick: () => onClickEdit && onClickEdit(id) },
|
|
48
|
+
React.createElement(Typography.Text, { ellipsis: { tooltip: editText }, style: { maxWidth: '100%', color: 'inherit' } }, editText)),
|
|
49
|
+
React.createElement(Button, { className: "animate__animated animate__fadeIn", onClick: () => onClickPreview && onClickPreview(id) },
|
|
50
|
+
React.createElement(Typography.Text, { ellipsis: { tooltip: previewText }, style: { maxWidth: '100%', color: 'inherit' } }, previewText))),
|
|
48
51
|
removable && (React.createElement("div", { className: "top-right-corner-action animate__animated animate__fadeIn" },
|
|
49
|
-
React.createElement(Button, { type: "primary", icon: React.createElement(Icon, { type: "icon-ants-trash-outline", style: { fontSize: 24, color: '#FFFFFF' } }), onClick:
|
|
52
|
+
React.createElement(Button, { type: "primary", icon: React.createElement(Icon, { type: "icon-ants-trash-outline", style: { fontSize: 24, color: '#FFFFFF' } }), onClick: handleRemoveThumbnail }))),
|
|
50
53
|
React.createElement("div", { className: "backdrop" }),
|
|
51
54
|
React.createElement("div", null, contextHolder)));
|
|
52
55
|
});
|
|
53
|
-
|
|
56
|
+
ThumbnailCard.displayName = 'ThumbnailCard';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const ThumbnailCardWrapper: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
@@ -1,17 +1,23 @@
|
|
|
1
|
+
// Libraries
|
|
1
2
|
import styled from 'styled-components';
|
|
2
|
-
//
|
|
3
|
-
|
|
4
|
-
const
|
|
5
|
-
export const
|
|
3
|
+
// Images
|
|
4
|
+
import skeletonBackground from '../../../assets/images/background/skeleton-background.png';
|
|
5
|
+
const THUMBNAIL_CARD_RADIUS = 5;
|
|
6
|
+
export const ThumbnailCardWrapper = styled.div `
|
|
6
7
|
background-color: #e5e5e5;
|
|
7
8
|
padding: 10px;
|
|
8
|
-
border-radius: ${
|
|
9
|
+
border-radius: ${THUMBNAIL_CARD_RADIUS}px;
|
|
9
10
|
position: relative;
|
|
10
11
|
box-sizing: border-box;
|
|
11
12
|
|
|
12
13
|
:hover {
|
|
13
14
|
.center-action {
|
|
14
15
|
display: flex;
|
|
16
|
+
max-width: 90%;
|
|
17
|
+
|
|
18
|
+
button {
|
|
19
|
+
max-width: 100%;
|
|
20
|
+
}
|
|
15
21
|
}
|
|
16
22
|
|
|
17
23
|
.top-right-corner-action {
|
|
@@ -26,7 +32,7 @@ export const TemplateItemWrapper = styled.div `
|
|
|
26
32
|
.screen {
|
|
27
33
|
width: 100%;
|
|
28
34
|
height: 100%;
|
|
29
|
-
background-image: url(${
|
|
35
|
+
background-image: url(${skeletonBackground});
|
|
30
36
|
|
|
31
37
|
img {
|
|
32
38
|
width: 100%;
|
|
@@ -68,7 +74,7 @@ export const TemplateItemWrapper = styled.div `
|
|
|
68
74
|
}
|
|
69
75
|
|
|
70
76
|
.backdrop {
|
|
71
|
-
border-radius: ${
|
|
77
|
+
border-radius: ${THUMBNAIL_CARD_RADIUS}px;
|
|
72
78
|
position: absolute;
|
|
73
79
|
width: 100%;
|
|
74
80
|
height: 100%;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { ModalFuncProps } from 'antd';
|
|
2
|
+
export type TThumbnailCardId = string | number;
|
|
3
|
+
export type TRemoveModalProps = Omit<ModalFuncProps, 'onOk'> & {
|
|
4
|
+
onOk?: (id: TThumbnailCardId) => void;
|
|
5
|
+
};
|
|
6
|
+
export interface ThumbnailCardProps {
|
|
7
|
+
id: TThumbnailCardId;
|
|
8
|
+
width?: number;
|
|
9
|
+
height?: number;
|
|
10
|
+
thumbnail?: string;
|
|
11
|
+
removable?: boolean;
|
|
12
|
+
editText?: string;
|
|
13
|
+
previewText?: string;
|
|
14
|
+
removeModalProps?: TRemoveModalProps;
|
|
15
|
+
onClickEdit?: (id: TThumbnailCardId) => void;
|
|
16
|
+
onClickPreview?: (id: TThumbnailCardId) => void;
|
|
17
|
+
}
|
|
@@ -30,6 +30,7 @@ export { FontFamilySelect } from './FontFamilySelect';
|
|
|
30
30
|
export { TextDecorationSelect } from './TextDecorationSelect';
|
|
31
31
|
export { TextTransformSelect } from './TextTransformSelect';
|
|
32
32
|
export { FontSetting, FontSettingEdit } from './FontSetting';
|
|
33
|
+
export { ThumbnailCard } from './ThumbnailCard';
|
|
33
34
|
export { Form } from './Form';
|
|
34
35
|
export { ResizeGrid } from './ResizeGrid';
|
|
35
36
|
export * from './RichMenu';
|
|
@@ -43,3 +44,4 @@ export type { AlignEditProps, AlignSettingProps } from './AlignSetting';
|
|
|
43
44
|
export type { TFontSettingProps, TFontSettingEditProps } from './FontSetting';
|
|
44
45
|
export type { IResizeGridProps, TCell, TGrid } from './ResizeGrid';
|
|
45
46
|
export type { ModalProps } from './ModalV2';
|
|
47
|
+
export type { ThumbnailCardProps } from './ThumbnailCard';
|
|
@@ -30,6 +30,7 @@ export { FontFamilySelect } from './FontFamilySelect';
|
|
|
30
30
|
export { TextDecorationSelect } from './TextDecorationSelect';
|
|
31
31
|
export { TextTransformSelect } from './TextTransformSelect';
|
|
32
32
|
export { FontSetting, FontSettingEdit } from './FontSetting';
|
|
33
|
+
export { ThumbnailCard } from './ThumbnailCard';
|
|
33
34
|
export { Form } from './Form';
|
|
34
35
|
export { ResizeGrid } from './ResizeGrid';
|
|
35
36
|
export * from './RichMenu';
|
|
@@ -2,16 +2,16 @@
|
|
|
2
2
|
import React, { memo } from 'react';
|
|
3
3
|
import Icon from '@antscorp/icons';
|
|
4
4
|
// Components
|
|
5
|
-
import { Button, Flex } from '../../../../atoms';
|
|
5
|
+
import { Button, Flex, Typography } from '../../../../atoms';
|
|
6
6
|
// Styled
|
|
7
7
|
import { BlankTemplateWrapper } from './styled';
|
|
8
8
|
export const BlankTemplate = memo(props => {
|
|
9
|
-
const { width, height, show, description,
|
|
10
|
-
|
|
11
|
-
React.createElement(Flex, { align: "center", justify: "center", gap: 10, vertical: true },
|
|
12
|
-
React.createElement(Button, { type: "text", className: "add-blank-btn", icon: React.createElement(Icon, { type: "icon-ants-plus-slim", style: { fontSize: 24 } })
|
|
9
|
+
const { width, height, show, description = 'Blank Template', blankTemplateRender, onClick, } = props;
|
|
10
|
+
const BlankTemplateNode = (React.createElement(BlankTemplateWrapper, { style: { width, height }, align: "center", justify: "center", onClick: onClick },
|
|
11
|
+
React.createElement(Flex, { align: "center", justify: "center", gap: 10, vertical: true, style: { width: '100%' } },
|
|
12
|
+
React.createElement(Button, { type: "text", className: "add-blank-btn", icon: React.createElement(Icon, { type: "icon-ants-plus-slim", style: { fontSize: 24 } }) }),
|
|
13
13
|
React.createElement("div", { className: "description" },
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
React.createElement(Typography.Text, { ellipsis: { tooltip: description }, style: { maxWidth: '100%', color: 'inherit' } }, description)))));
|
|
15
|
+
return show ? (blankTemplateRender ? (React.createElement(React.Fragment, null, blankTemplateRender(BlankTemplateNode))) : (BlankTemplateNode)) : null;
|
|
16
16
|
});
|
|
17
17
|
BlankTemplate.displayName = 'BlankTemplate';
|
|
@@ -6,6 +6,7 @@ export const BlankTemplateWrapper = styled(Flex) `
|
|
|
6
6
|
box-sizing: border-box;
|
|
7
7
|
border: 1px solid #b8cfe6;
|
|
8
8
|
border-radius: 5px;
|
|
9
|
+
cursor: pointer;
|
|
9
10
|
|
|
10
11
|
.add-blank-btn {
|
|
11
12
|
width: 50px !important;
|
|
@@ -20,5 +21,6 @@ export const BlankTemplateWrapper = styled(Flex) `
|
|
|
20
21
|
|
|
21
22
|
.description {
|
|
22
23
|
font-weight: 700;
|
|
24
|
+
max-width: 90%;
|
|
23
25
|
}
|
|
24
26
|
`;
|
|
@@ -24,7 +24,7 @@ import { handleError } from '@antscorp/antsomi-ui/es/utils';
|
|
|
24
24
|
import { CATEGORY_LISTING_WITH } from '../../constants';
|
|
25
25
|
const PATH = 'src/components/template/TemplateListing/components/CategoryListing/index.tsx';
|
|
26
26
|
export const CategoryListing = memo(props => {
|
|
27
|
-
const { width = CATEGORY_LISTING_WITH, items, checkedCategories = {}, onMenuChange } = props, restOfProps = __rest(props, ["width", "items", "checkedCategories", "onMenuChange"]);
|
|
27
|
+
const { width = CATEGORY_LISTING_WITH, items = [], visible = true, checkedCategories = {}, onMenuChange } = props, restOfProps = __rest(props, ["width", "items", "visible", "checkedCategories", "onMenuChange"]);
|
|
28
28
|
// Handlers
|
|
29
29
|
const handleClickMenu = e => {
|
|
30
30
|
var _a;
|
|
@@ -97,7 +97,7 @@ export const CategoryListing = memo(props => {
|
|
|
97
97
|
});
|
|
98
98
|
return menuItems;
|
|
99
99
|
}, [getItem, items]);
|
|
100
|
-
return (React.createElement(MenuWrapper, { "$width": width },
|
|
101
|
-
React.createElement(Menu, Object.assign({ items: menuItems, inlineIndent: 0, mode: "inline", expandIcon: React.createElement(Icon, { type: "icon-ants-expand-more", style: { fontSize: 20, color: '#595959' } }), onClick: handleClickMenu }, restOfProps))));
|
|
100
|
+
return visible ? (React.createElement(MenuWrapper, { "$width": width },
|
|
101
|
+
React.createElement(Menu, Object.assign({ items: menuItems, inlineIndent: 0, mode: "inline", expandIcon: React.createElement(Icon, { type: "icon-ants-expand-more", style: { fontSize: 20, color: '#595959' } }), onClick: handleClickMenu }, restOfProps)))) : null;
|
|
102
102
|
});
|
|
103
103
|
CategoryListing.displayName = 'CategoryListing';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import styled from 'styled-components';
|
|
2
2
|
export const MenuWrapper = styled.div `
|
|
3
|
-
width: ${({ $width }) => ($width !== undefined ? `${$width}px` : 'auto')}
|
|
3
|
+
width: ${({ $width }) => ($width !== undefined ? `${$width}px` : 'auto')};
|
|
4
4
|
overflow: auto;
|
|
5
5
|
|
|
6
6
|
.antsomi-menu {
|
|
@@ -9,7 +9,7 @@ export const MenuWrapper = styled.div `
|
|
|
9
9
|
.antsomi-menu-submenu {
|
|
10
10
|
.antsomi-menu-submenu-title,
|
|
11
11
|
.antsomi-menu-item {
|
|
12
|
-
padding-left: 10px
|
|
12
|
+
padding-left: 10px;
|
|
13
13
|
}
|
|
14
14
|
}
|
|
15
15
|
}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { MenuProps } from 'antd';
|
|
3
|
+
import { TCategoryItemId } from '../../types';
|
|
3
4
|
export type TMenuItem = Required<MenuProps>['items'][number];
|
|
4
5
|
export type TItem = {
|
|
5
|
-
key:
|
|
6
|
+
key: TCategoryItemId;
|
|
6
7
|
label: React.ReactNode | string;
|
|
7
8
|
total?: number;
|
|
8
9
|
children?: TItem[];
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ThumbnailCardProps } from '../../../molecules';
|
|
2
|
+
import { BlankTemplateProps, CategoryListingProps, TemplateListingProps } from '../types';
|
|
2
3
|
export declare const TEMPLATE_ITEM_WIDTH = 200;
|
|
3
4
|
export declare const TEMPLATE_ITEM_HEIGHT = 200;
|
|
4
5
|
export declare const CATEGORY_LISTING_WITH = 220;
|
|
5
|
-
export declare const
|
|
6
|
+
export declare const THUMBNAIL_URL = "https://st-media-template.antsomi.com/base64-img/37563.png";
|
|
7
|
+
export declare const TEMPLATE_ITEM_DEFAULT: Omit<ThumbnailCardProps, 'id'>;
|
|
6
8
|
export declare const BLANK_TEMPLATE_DEFAULT: BlankTemplateProps;
|
|
7
9
|
export declare const CATEGORY_LISTING_DEFAULT: Omit<CategoryListingProps, 'items'>;
|
|
8
10
|
export declare const TEMPLATE_LISTING_DEFAULT: TemplateListingProps;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export const TEMPLATE_ITEM_WIDTH = 200;
|
|
2
2
|
export const TEMPLATE_ITEM_HEIGHT = 200;
|
|
3
3
|
export const CATEGORY_LISTING_WITH = 220;
|
|
4
|
+
export const THUMBNAIL_URL = 'https://st-media-template.antsomi.com/base64-img/37563.png';
|
|
4
5
|
export const TEMPLATE_ITEM_DEFAULT = {
|
|
5
6
|
width: TEMPLATE_ITEM_WIDTH,
|
|
6
7
|
height: TEMPLATE_ITEM_HEIGHT,
|
|
@@ -9,6 +10,7 @@ export const TEMPLATE_ITEM_DEFAULT = {
|
|
|
9
10
|
export const BLANK_TEMPLATE_DEFAULT = { show: false };
|
|
10
11
|
export const CATEGORY_LISTING_DEFAULT = {
|
|
11
12
|
width: CATEGORY_LISTING_WITH,
|
|
13
|
+
visible: true,
|
|
12
14
|
checkedCategories: {},
|
|
13
15
|
onMenuChange: () => { },
|
|
14
16
|
};
|
|
@@ -1,21 +1,22 @@
|
|
|
1
1
|
// Libraries
|
|
2
2
|
import React, { memo } from 'react';
|
|
3
3
|
// Components
|
|
4
|
-
import { CategoryListing,
|
|
4
|
+
import { CategoryListing, BlankTemplate } from './components';
|
|
5
5
|
import { Flex, Typography } from '../../atoms';
|
|
6
|
+
import { ThumbnailCard } from '../../molecules';
|
|
6
7
|
// Constants
|
|
7
8
|
import { BLANK_TEMPLATE_DEFAULT, TEMPLATE_ITEM_DEFAULT, TEMPLATE_LISTING_DEFAULT, TEMPLATE_ITEM_HEIGHT, TEMPLATE_ITEM_WIDTH, CATEGORY_LISTING_DEFAULT, } from './constants';
|
|
8
9
|
// Styled
|
|
9
10
|
import { TemplateListingWrapper } from './styled';
|
|
10
11
|
export const TemplateListing = memo(props => {
|
|
11
|
-
const { templateItems, categoryItems, templateItemProps = TEMPLATE_ITEM_DEFAULT, blankTemplateProps = BLANK_TEMPLATE_DEFAULT, categoryListingProps = CATEGORY_LISTING_DEFAULT, } = props;
|
|
12
|
+
const { templateItems = [], categoryItems = [], templateItemProps = TEMPLATE_ITEM_DEFAULT, blankTemplateProps = BLANK_TEMPLATE_DEFAULT, categoryListingProps = CATEGORY_LISTING_DEFAULT, } = props;
|
|
12
13
|
const { width = TEMPLATE_ITEM_WIDTH, height = TEMPLATE_ITEM_HEIGHT } = templateItemProps;
|
|
13
14
|
return (React.createElement(TemplateListingWrapper, null,
|
|
14
15
|
React.createElement(CategoryListing, Object.assign({ items: categoryItems }, categoryListingProps, { className: `category-listing ${(categoryListingProps === null || categoryListingProps === void 0 ? void 0 : categoryListingProps.className) || ''}` })),
|
|
15
16
|
React.createElement(Flex, { gap: 30, wrap: "wrap", style: { padding: '15px' }, className: "template-listing" },
|
|
16
17
|
React.createElement(BlankTemplate, Object.assign({ width: width, height: height }, blankTemplateProps)), templateItems === null || templateItems === void 0 ? void 0 :
|
|
17
18
|
templateItems.map(({ key, name, thumbnail }) => (React.createElement(Flex, { key: key, vertical: true, gap: 10 },
|
|
18
|
-
React.createElement(
|
|
19
|
+
React.createElement(ThumbnailCard, Object.assign({ id: key, thumbnail: thumbnail }, templateItemProps)),
|
|
19
20
|
React.createElement(Typography.Text, { ellipsis: { tooltip: name }, style: { maxWidth: '100%' } }, name)))))));
|
|
20
21
|
});
|
|
21
22
|
TemplateListing.displayName = 'TemplateListing';
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
2
|
export interface BlankTemplateProps {
|
|
3
3
|
width?: number;
|
|
4
4
|
height?: number;
|
|
5
5
|
show?: boolean;
|
|
6
6
|
description?: string;
|
|
7
|
-
|
|
7
|
+
onClick?: React.MouseEventHandler<HTMLElement>;
|
|
8
|
+
blankTemplateRender?: (node: ReactNode) => ReactNode;
|
|
8
9
|
}
|
|
@@ -1,15 +1,17 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { MenuProps } from 'antd';
|
|
3
3
|
export type TCheckedCategories = Record<string | number, (string | number)[]>;
|
|
4
|
+
export type TCategoryItemId = string | number;
|
|
4
5
|
export interface CategoryListingProps extends MenuProps {
|
|
5
6
|
items: TCategoryItem[];
|
|
6
7
|
width?: number;
|
|
8
|
+
visible?: boolean;
|
|
7
9
|
checkedCategories?: TCheckedCategories;
|
|
8
10
|
onMenuChange?: (value: TCheckedCategories) => void;
|
|
9
11
|
}
|
|
10
12
|
export type TMenuItem = Required<MenuProps>['items'][number];
|
|
11
13
|
export type TCategoryItem = {
|
|
12
|
-
key:
|
|
14
|
+
key: TCategoryItemId;
|
|
13
15
|
label: React.ReactNode | string;
|
|
14
16
|
total?: number;
|
|
15
17
|
children?: TCategoryItem[];
|
|
@@ -1,15 +1,16 @@
|
|
|
1
|
+
import { ThumbnailCardProps } from '../../../molecules';
|
|
2
|
+
import { TThumbnailCardId } from '../../../molecules/ThumbnailCard';
|
|
1
3
|
import { BlankTemplateProps } from './BlankTemplate';
|
|
2
4
|
import { CategoryListingProps } from './CategoryListing';
|
|
3
|
-
import { TemplateItemProps } from './TemplateItem';
|
|
4
5
|
export interface TemplateListingProps {
|
|
5
|
-
templateItems
|
|
6
|
-
categoryItems
|
|
7
|
-
templateItemProps?: Omit<
|
|
6
|
+
templateItems?: TTemplateItem[];
|
|
7
|
+
categoryItems?: CategoryListingProps['items'];
|
|
8
|
+
templateItemProps?: Omit<ThumbnailCardProps, 'id' | 'thumbnail'>;
|
|
8
9
|
categoryListingProps?: Omit<CategoryListingProps, 'items'>;
|
|
9
10
|
blankTemplateProps?: Omit<BlankTemplateProps, 'width' | 'height'>;
|
|
10
11
|
}
|
|
11
12
|
export interface TTemplateItem {
|
|
12
13
|
name: string;
|
|
13
|
-
key:
|
|
14
|
-
thumbnail?:
|
|
14
|
+
key: TThumbnailCardId;
|
|
15
|
+
thumbnail?: ThumbnailCardProps['thumbnail'];
|
|
15
16
|
}
|
|
@@ -14,8 +14,8 @@
|
|
|
14
14
|
"firstDayOfMonth": "First day of this month",
|
|
15
15
|
"firstDayOfQuarter": "First day of this quarter",
|
|
16
16
|
"firstDayOfYear": "First day of this year",
|
|
17
|
-
"lastDayOfWeekMonSun": "
|
|
18
|
-
"lastDayOfWeekSunSat": "
|
|
17
|
+
"lastDayOfWeekMonSun": "Last day of this week (Mon - Sun)",
|
|
18
|
+
"lastDayOfWeekSunSat": "Last day of this week (Sun - Sat)",
|
|
19
19
|
"lastDayOfMonth": "Last day of this month",
|
|
20
20
|
"lastDayOfQuarter": "Last day of this quarter",
|
|
21
21
|
"lastDayOfYear": "Last day of this year",
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const TemplateItemWrapper: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { ModalFuncProps } from 'antd';
|
|
2
|
-
export type TTemplateItemId = string | number;
|
|
3
|
-
export interface TemplateItemProps {
|
|
4
|
-
id: TTemplateItemId;
|
|
5
|
-
width?: number;
|
|
6
|
-
height?: number;
|
|
7
|
-
thumbnail?: string;
|
|
8
|
-
removable?: boolean;
|
|
9
|
-
onClickEdit?: (id: TTemplateItemId) => void;
|
|
10
|
-
onClickPreview?: (id: TTemplateItemId) => void;
|
|
11
|
-
removeTemplateModalProps?: Omit<ModalFuncProps, 'onOk'> & {
|
|
12
|
-
onOk?: (id: TTemplateItemId) => void;
|
|
13
|
-
};
|
|
14
|
-
}
|
|
File without changes
|