@pisell/materials 1.0.934 → 1.0.935
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/build/lowcode/assets-daily.json +11 -11
- package/build/lowcode/assets-dev.json +2 -2
- package/build/lowcode/assets-prod.json +11 -11
- package/build/lowcode/index.js +1 -1
- package/build/lowcode/meta.js +1 -1
- package/build/lowcode/preview.js +164 -148
- package/build/lowcode/render/default/view.js +30 -15
- package/build/lowcode/view.js +41 -26
- package/es/components/appVersionControl/index.d.ts +4 -0
- package/es/components/batch-editor/index.d.ts +0 -1
- package/es/components/cardPro/index.d.ts +3 -0
- package/es/components/dataSourceComponents/dataSourceForm/utils.d.ts +56 -0
- package/es/components/dataSourceComponents/dataSourceTable/BaseTable.d.ts +8 -0
- package/es/components/dataSourceComponents/dataSourceTable/filter/index.d.ts +27 -0
- package/es/components/dataSourceComponents/dataSourceTable/hooks/useDrawerState.d.ts +39 -0
- package/es/components/dataSourceComponents/dataSourceTable/hooks/useTableProps.d.ts +98 -0
- package/es/components/dataSourceComponents/dataSourceTable/hooks/useTableProps.js +1 -1
- package/es/components/dataSourceComponents/dataSourceTable/hooks/useTableQuery.d.ts +33 -0
- package/es/components/dataSourceComponents/dataSourceTable/type.d.ts +85 -0
- package/es/components/dataSourceComponents/dataSourceWrapper/index.d.ts +0 -1
- package/es/components/dataSourceComponents/fields/Input.Mobile/WithMode.d.ts +16 -0
- package/es/components/dataSourceComponents/fields/Input.Phone/WithMode.d.ts +16 -0
- package/es/components/dataSourceComponents/fields/Input.Phone/serve.d.ts +25 -0
- package/es/components/dataSourceComponents/fields/Select/index.d.ts +1 -1
- package/es/components/dataSourceComponents/fields/Upload/BaseUpload.d.ts +5 -0
- package/es/components/dataSourceComponents/fields/Upload/CameraPopover.d.ts +5 -0
- package/es/components/dataSourceComponents/fields/Upload/index.d.ts +3 -0
- package/es/components/dataSourceComponents/fields/Upload/type.d.ts +38 -0
- package/es/components/dataSourceComponents/fields/index.d.ts +11 -12
- package/es/components/drag-sort-tree/index.d.ts +3 -0
- package/es/components/filter/types.d.ts +45 -0
- package/es/components/hardwareErrorTip/demo.d.ts +3 -0
- package/es/components/hardwareErrorTip/errorCard/index.d.ts +28 -0
- package/es/components/hardwareErrorTip/errorTipStatistics/index.d.ts +12 -0
- package/es/components/hardwareErrorTip/index.d.ts +19 -0
- package/es/components/hardwareErrorTip/logCard/index.d.ts +27 -0
- package/es/components/hardwareErrorTip/types.d.ts +28 -0
- package/es/components/iconfont/index.d.ts +8 -0
- package/es/components/keyboard/index.d.ts +22 -0
- package/es/components/list/index.d.ts +0 -1
- package/es/components/login-and-register/index.d.ts +82 -0
- package/es/components/pisell-config-provider/index.d.ts +13 -0
- package/es/components/pisell-config-provider/index.js +0 -1
- package/es/components/pisellAdjustPrice/PisellAdjustPriceInputNumber.d.ts +0 -1
- package/es/components/pisellCamera/index.d.ts +4 -0
- package/es/components/pisellCardList/index.d.ts +4 -0
- package/es/components/pisellCardList/index.js +5 -1
- package/es/components/pisellEmpty/index.d.ts +19 -0
- package/es/components/pisellText/components/Editable/index.d.ts +29 -0
- package/es/components/pisellText/index.d.ts +9 -0
- package/es/components/pisellWalletPassCard/index.d.ts +140 -0
- package/es/components/pisellWalletPassCard/index.js +17 -4
- package/es/components/pisellWalletPassCard/utils.d.ts +44 -0
- package/es/components/pisellWalletPassCard/utils.js +499 -0
- package/es/components/productCard/cartSkuCard/components/packages/utils.d.ts +1 -1
- package/es/components/productCard/cartSkuCard/components/swipeAction/index.d.ts +46 -0
- package/es/components/productCard/cartSkuCard/index.d.ts +10 -0
- package/es/components/productCard/components/Header/Actions/index.d.ts +3 -0
- package/es/components/productCard/components/Header/DeleteButton/index.d.ts +3 -0
- package/es/components/productCard/components/Packages/utils.d.ts +1 -1
- package/es/components/productCard/components/Time/components/SelectHolder/index.d.ts +3 -0
- package/es/components/productCard/components/Time/components/SelectResource/index.d.ts +18 -0
- package/es/components/productCard/components/Time/index.d.ts +3 -0
- package/es/components/select/index.d.ts +9 -0
- package/es/components/sortableList/index.d.ts +11 -0
- package/es/components/table/Actions/component/ExportImport/index.d.ts +7 -0
- package/es/components/table/Gallery/components/GalleryItem/index.d.ts +14 -0
- package/es/components/table/Gallery/index.d.ts +5 -0
- package/es/components/table/Table/SelectField/index.d.ts +0 -1
- package/es/components/table/Table/fields/index.d.ts +2 -3
- package/es/components/table/Table/fields/text/Show/index.d.ts +0 -1
- package/es/components/table/Table/fields/text/index.d.ts +0 -1
- package/es/components/table/Table/index.d.ts +4 -0
- package/es/components/table/Table/utils.d.ts +167 -0
- package/es/components/table/hooks/useTableSetting.d.ts +21 -0
- package/es/components/table/hooks/useTableSetting.js +1 -1
- package/es/components/table/hooks/useTransDataSource.d.ts +12 -0
- package/es/components/table/index.d.ts +4 -0
- package/es/components/table/types.d.ts +270 -0
- package/es/components/translation/index.d.ts +15 -0
- package/es/components/versionModal/index.d.ts +24 -0
- package/es/components/virtual-keyboard/Number/index.d.ts +0 -1
- package/es/components/virtualInput/BaseVirtualInput/index.d.ts +40 -0
- package/es/components/walletCard/index.d.ts +71 -0
- package/es/index.d.ts +145 -0
- package/es/locales/en-US.d.ts +342 -0
- package/es/locales/en-US.js +1 -0
- package/es/locales/zh-CN.d.ts +337 -0
- package/es/locales/zh-CN.js +1 -0
- package/es/locales/zh-TW.d.ts +337 -0
- package/es/locales/zh-TW.js +16 -8
- package/es/utils/platform.d.ts +1 -1
- package/lib/components/appVersionControl/index.d.ts +4 -0
- package/lib/components/batch-editor/index.d.ts +0 -1
- package/lib/components/cardPro/index.d.ts +3 -0
- package/lib/components/dataSourceComponents/dataSourceForm/utils.d.ts +56 -0
- package/lib/components/dataSourceComponents/dataSourceTable/BaseTable.d.ts +8 -0
- package/lib/components/dataSourceComponents/dataSourceTable/filter/index.d.ts +27 -0
- package/lib/components/dataSourceComponents/dataSourceTable/hooks/useDrawerState.d.ts +39 -0
- package/lib/components/dataSourceComponents/dataSourceTable/hooks/useTableProps.d.ts +98 -0
- package/lib/components/dataSourceComponents/dataSourceTable/hooks/useTableProps.js +1 -1
- package/lib/components/dataSourceComponents/dataSourceTable/hooks/useTableQuery.d.ts +33 -0
- package/lib/components/dataSourceComponents/dataSourceTable/type.d.ts +85 -0
- package/lib/components/dataSourceComponents/dataSourceWrapper/index.d.ts +0 -1
- package/lib/components/dataSourceComponents/fields/Input.Mobile/WithMode.d.ts +16 -0
- package/lib/components/dataSourceComponents/fields/Input.Phone/WithMode.d.ts +16 -0
- package/lib/components/dataSourceComponents/fields/Input.Phone/serve.d.ts +25 -0
- package/lib/components/dataSourceComponents/fields/Select/index.d.ts +1 -1
- package/lib/components/dataSourceComponents/fields/Upload/BaseUpload.d.ts +5 -0
- package/lib/components/dataSourceComponents/fields/Upload/CameraPopover.d.ts +5 -0
- package/lib/components/dataSourceComponents/fields/Upload/index.d.ts +3 -0
- package/lib/components/dataSourceComponents/fields/Upload/type.d.ts +38 -0
- package/lib/components/dataSourceComponents/fields/index.d.ts +11 -12
- package/lib/components/drag-sort-tree/index.d.ts +3 -0
- package/lib/components/filter/types.d.ts +45 -0
- package/lib/components/hardwareErrorTip/demo.d.ts +3 -0
- package/lib/components/hardwareErrorTip/errorCard/index.d.ts +28 -0
- package/lib/components/hardwareErrorTip/errorTipStatistics/index.d.ts +12 -0
- package/lib/components/hardwareErrorTip/index.d.ts +19 -0
- package/lib/components/hardwareErrorTip/logCard/index.d.ts +27 -0
- package/lib/components/hardwareErrorTip/types.d.ts +28 -0
- package/lib/components/iconfont/index.d.ts +8 -0
- package/lib/components/keyboard/index.d.ts +22 -0
- package/lib/components/list/index.d.ts +0 -1
- package/lib/components/login-and-register/index.d.ts +82 -0
- package/lib/components/pisell-config-provider/index.d.ts +13 -0
- package/lib/components/pisell-config-provider/index.js +0 -1
- package/lib/components/pisellAdjustPrice/PisellAdjustPriceInputNumber.d.ts +0 -1
- package/lib/components/pisellCamera/index.d.ts +4 -0
- package/lib/components/pisellCardList/index.d.ts +4 -0
- package/lib/components/pisellCardList/index.js +5 -1
- package/lib/components/pisellEmpty/index.d.ts +19 -0
- package/lib/components/pisellText/components/Editable/index.d.ts +29 -0
- package/lib/components/pisellText/index.d.ts +9 -0
- package/lib/components/pisellWalletPassCard/index.d.ts +140 -0
- package/lib/components/pisellWalletPassCard/index.js +12 -2
- package/lib/components/pisellWalletPassCard/utils.d.ts +44 -0
- package/lib/components/pisellWalletPassCard/utils.js +349 -0
- package/lib/components/productCard/cartSkuCard/components/packages/utils.d.ts +1 -1
- package/lib/components/productCard/cartSkuCard/components/swipeAction/index.d.ts +46 -0
- package/lib/components/productCard/cartSkuCard/index.d.ts +10 -0
- package/lib/components/productCard/components/Header/Actions/index.d.ts +3 -0
- package/lib/components/productCard/components/Header/DeleteButton/index.d.ts +3 -0
- package/lib/components/productCard/components/Packages/utils.d.ts +1 -1
- package/lib/components/productCard/components/Time/components/SelectHolder/index.d.ts +3 -0
- package/lib/components/productCard/components/Time/components/SelectResource/index.d.ts +18 -0
- package/lib/components/productCard/components/Time/index.d.ts +3 -0
- package/lib/components/select/index.d.ts +9 -0
- package/lib/components/sortableList/index.d.ts +11 -0
- package/lib/components/table/Actions/component/ExportImport/index.d.ts +7 -0
- package/lib/components/table/Gallery/components/GalleryItem/index.d.ts +14 -0
- package/lib/components/table/Gallery/index.d.ts +5 -0
- package/lib/components/table/Table/SelectField/index.d.ts +0 -1
- package/lib/components/table/Table/fields/index.d.ts +2 -3
- package/lib/components/table/Table/fields/text/Show/index.d.ts +0 -1
- package/lib/components/table/Table/fields/text/index.d.ts +0 -1
- package/lib/components/table/Table/index.d.ts +4 -0
- package/lib/components/table/Table/utils.d.ts +167 -0
- package/lib/components/table/hooks/useTableSetting.d.ts +21 -0
- package/lib/components/table/hooks/useTableSetting.js +1 -1
- package/lib/components/table/hooks/useTransDataSource.d.ts +12 -0
- package/lib/components/table/index.d.ts +4 -0
- package/lib/components/table/types.d.ts +270 -0
- package/lib/components/translation/index.d.ts +15 -0
- package/lib/components/versionModal/index.d.ts +24 -0
- package/lib/components/virtual-keyboard/Number/index.d.ts +0 -1
- package/lib/components/virtualInput/BaseVirtualInput/index.d.ts +40 -0
- package/lib/components/walletCard/index.d.ts +71 -0
- package/lib/index.d.ts +145 -0
- package/lib/locales/en-US.d.ts +342 -0
- package/lib/locales/en-US.js +1 -0
- package/lib/locales/zh-CN.d.ts +337 -0
- package/lib/locales/zh-CN.js +1 -0
- package/lib/locales/zh-TW.d.ts +337 -0
- package/lib/locales/zh-TW.js +1 -4
- package/lib/utils/platform.d.ts +1 -1
- package/package.json +3 -3
|
@@ -31,6 +31,10 @@ export interface PisellCardListProps extends Omit<PisellCheckboxGroupProps, 'opt
|
|
|
31
31
|
showCode?: boolean;
|
|
32
32
|
/** 是否展示到期时间 */
|
|
33
33
|
showValidDate?: boolean;
|
|
34
|
+
/** 使用日程信息计算有效期 */
|
|
35
|
+
validDateBySchedule?: boolean;
|
|
36
|
+
/** 日程列表 */
|
|
37
|
+
scheduleList?: any[];
|
|
34
38
|
/** 是否展示详情按钮 */
|
|
35
39
|
showDetail?: boolean;
|
|
36
40
|
/** 是否展示二维码 */
|
|
@@ -75,7 +75,9 @@ var PisellCardList = (props) => {
|
|
|
75
75
|
formatRedeemTitle,
|
|
76
76
|
onBeforeEditAmount,
|
|
77
77
|
onItemClick,
|
|
78
|
-
showActiveBackground
|
|
78
|
+
showActiveBackground,
|
|
79
|
+
validDateBySchedule,
|
|
80
|
+
scheduleList
|
|
79
81
|
} = props;
|
|
80
82
|
return data.length ? /* @__PURE__ */ import_react.default.createElement(
|
|
81
83
|
import_pisellCheckboxGroup.default,
|
|
@@ -121,6 +123,8 @@ var PisellCardList = (props) => {
|
|
|
121
123
|
var _a;
|
|
122
124
|
return (_a = props == null ? void 0 : props.onDetail) == null ? void 0 : _a.call(props, record, index);
|
|
123
125
|
},
|
|
126
|
+
validDateBySchedule: validDateBySchedule || (item == null ? void 0 : item.validDateBySchedule),
|
|
127
|
+
scheduleList: scheduleList || (item == null ? void 0 : item.scheduleList),
|
|
124
128
|
beforeEdit: (record) => {
|
|
125
129
|
var _a;
|
|
126
130
|
return (_a = props == null ? void 0 : props.beforeEdit) == null ? void 0 : _a.call(props, record, index);
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { EmptyProps } from 'antd';
|
|
3
|
+
import { PisellContextType } from '../pisell-config-provider/context';
|
|
4
|
+
import './index.less';
|
|
5
|
+
export interface PisellEmptyProps extends EmptyProps {
|
|
6
|
+
/** 平台 */
|
|
7
|
+
platform?: PisellContextType['platform'];
|
|
8
|
+
/** 额外内容描述 */
|
|
9
|
+
extraDescription?: React.ReactNode;
|
|
10
|
+
/** 额外内容描述 */
|
|
11
|
+
icon?: React.ReactNode;
|
|
12
|
+
/** 自定义底部额外操作区域 */
|
|
13
|
+
footer?: React.ReactNode;
|
|
14
|
+
/** 最大宽度 */
|
|
15
|
+
maxWidth?: number;
|
|
16
|
+
[key: string]: any;
|
|
17
|
+
}
|
|
18
|
+
declare const PisellEmpty: (props: PisellEmptyProps) => JSX.Element;
|
|
19
|
+
export default PisellEmpty;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import './index.less';
|
|
3
|
+
export declare type MultiLanguageValue = {
|
|
4
|
+
en: string;
|
|
5
|
+
'zh-CN': string;
|
|
6
|
+
'zh-HK': string;
|
|
7
|
+
};
|
|
8
|
+
export interface EditableConfig {
|
|
9
|
+
/** 是否禁用编辑 */
|
|
10
|
+
disabled?: boolean;
|
|
11
|
+
/** 最大长度 */
|
|
12
|
+
maxLength?: number;
|
|
13
|
+
/** 编辑图标 */
|
|
14
|
+
icon?: React.ReactNode;
|
|
15
|
+
}
|
|
16
|
+
export interface EditableProps extends React.HTMLAttributes<HTMLSpanElement> {
|
|
17
|
+
/** 文本内容,支持字符串或多语言对象 */
|
|
18
|
+
value?: string | MultiLanguageValue;
|
|
19
|
+
/** 子节点内容,优先级高于 value */
|
|
20
|
+
children?: React.ReactNode;
|
|
21
|
+
/** 可编辑配置,boolean 时使用默认配置 */
|
|
22
|
+
editable?: boolean | EditableConfig;
|
|
23
|
+
/** 编辑变更回调 */
|
|
24
|
+
onChange?: (value: string | MultiLanguageValue) => void;
|
|
25
|
+
/** 输入框尺寸 */
|
|
26
|
+
size?: 'large' | 'middle' | 'small';
|
|
27
|
+
}
|
|
28
|
+
declare const Editable: React.FC<EditableProps>;
|
|
29
|
+
export default Editable;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export interface PisellTextProps extends React.HTMLAttributes<HTMLSpanElement> {
|
|
3
|
+
}
|
|
4
|
+
declare const PisellText: {
|
|
5
|
+
(props: PisellTextProps): JSX.Element;
|
|
6
|
+
Amount: (props: import("./components/Amount").AmountProps) => JSX.Element;
|
|
7
|
+
Editable: React.FC<import("./components/Editable").EditableProps>;
|
|
8
|
+
};
|
|
9
|
+
export default PisellText;
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import './index.less';
|
|
3
|
+
export interface FormatOption {
|
|
4
|
+
/** 原始 DOM 元素 */
|
|
5
|
+
originDom: React.ReactNode;
|
|
6
|
+
/** 是否选中状态 */
|
|
7
|
+
active: boolean;
|
|
8
|
+
/** 完整的组件数据 */
|
|
9
|
+
data: PisellWalletPassCardProps;
|
|
10
|
+
}
|
|
11
|
+
export interface PisellWalletPassCardProps {
|
|
12
|
+
id: number;
|
|
13
|
+
/** 卡片样式 */
|
|
14
|
+
type: 'default' | 'mini';
|
|
15
|
+
/** 商品名称 */
|
|
16
|
+
name: string;
|
|
17
|
+
/** 二维码 */
|
|
18
|
+
qrCode: string;
|
|
19
|
+
/** 共享店铺名称 */
|
|
20
|
+
storeName: string;
|
|
21
|
+
/** 余额 */
|
|
22
|
+
balance?: number;
|
|
23
|
+
/** 识别码编号 */
|
|
24
|
+
code: string;
|
|
25
|
+
/** 有效期 */
|
|
26
|
+
validDate: string;
|
|
27
|
+
/** 使用金额 */
|
|
28
|
+
redeem?: number;
|
|
29
|
+
/** 是否禁用 */
|
|
30
|
+
disabled?: boolean;
|
|
31
|
+
/** 禁用原因 */
|
|
32
|
+
disabledReason?: string;
|
|
33
|
+
/** 是否展示禁用原因 */
|
|
34
|
+
showDisabledReason?: boolean;
|
|
35
|
+
/** 封面图 */
|
|
36
|
+
cover?: string;
|
|
37
|
+
/** 余额标题文案 */
|
|
38
|
+
balanceTitle?: string;
|
|
39
|
+
/** 使用金额标题文案 */
|
|
40
|
+
redeemTitle?: string;
|
|
41
|
+
/** 是否选中 */
|
|
42
|
+
active?: boolean;
|
|
43
|
+
/** 是否展示商品名称 */
|
|
44
|
+
showName?: boolean;
|
|
45
|
+
/** 是否展示共享店铺名称 */
|
|
46
|
+
showStoreName?: boolean | ((data: any) => boolean);
|
|
47
|
+
/** 是否展示使用金额 */
|
|
48
|
+
showRedeem?: boolean;
|
|
49
|
+
/** 是否展示余额 */
|
|
50
|
+
showBalance?: boolean;
|
|
51
|
+
/** 是否展示识别码编号 */
|
|
52
|
+
showCode?: boolean;
|
|
53
|
+
/** 是否展示有效期 */
|
|
54
|
+
showValidDate?: boolean;
|
|
55
|
+
/** 使用日程信息计算有效期 */
|
|
56
|
+
validDateBySchedule?: boolean;
|
|
57
|
+
/** 日程列表 */
|
|
58
|
+
scheduleList?: any[];
|
|
59
|
+
/** 是否展示右上角详情按钮 */
|
|
60
|
+
showDetail?: boolean;
|
|
61
|
+
/** 是否展示qrCode */
|
|
62
|
+
showQrCode?: boolean;
|
|
63
|
+
/** 是否展示封面 */
|
|
64
|
+
showCover?: boolean;
|
|
65
|
+
/** 是否展示余额货币符号 */
|
|
66
|
+
showBalanceSymbol?: boolean;
|
|
67
|
+
/** 展示操作按钮 */
|
|
68
|
+
showActions?: boolean;
|
|
69
|
+
/** 操作按钮配置 */
|
|
70
|
+
actions?: {
|
|
71
|
+
/** 按钮展示方式 */
|
|
72
|
+
layout: 'expanded' | 'collapsed';
|
|
73
|
+
/** detail 按钮配置 */
|
|
74
|
+
detail?: {
|
|
75
|
+
visible: boolean;
|
|
76
|
+
iconColor: string;
|
|
77
|
+
};
|
|
78
|
+
/** edit按钮配置 */
|
|
79
|
+
edit?: {
|
|
80
|
+
visible: boolean;
|
|
81
|
+
iconColor: string;
|
|
82
|
+
dialogTitle: string;
|
|
83
|
+
enableDialog: boolean;
|
|
84
|
+
fields: {
|
|
85
|
+
name: string;
|
|
86
|
+
label: string;
|
|
87
|
+
};
|
|
88
|
+
};
|
|
89
|
+
};
|
|
90
|
+
/** 编辑编辑按钮后,弹窗展示之前 */
|
|
91
|
+
beforeEdit?: (value: any) => Promise<any> | boolean | void;
|
|
92
|
+
/** 编辑弹窗点击提交 */
|
|
93
|
+
onConfirmEdit?: (value: any) => void;
|
|
94
|
+
/** 编辑金额事件 */
|
|
95
|
+
onConfirmEditAmount?: (value: number) => void;
|
|
96
|
+
/** 详情按钮点击事件 */
|
|
97
|
+
onDetail?: (data: {
|
|
98
|
+
id: number;
|
|
99
|
+
name: string;
|
|
100
|
+
storeName: string;
|
|
101
|
+
balance?: number;
|
|
102
|
+
redeem?: number;
|
|
103
|
+
code: string;
|
|
104
|
+
validDate: string;
|
|
105
|
+
originData?: any;
|
|
106
|
+
}) => void;
|
|
107
|
+
/** 是否使用外部详情处理(当为 true 且提供了 onDetail 时,不显示内部模态框) */
|
|
108
|
+
useExternalDetail?: boolean;
|
|
109
|
+
/** 单选或者多选 */
|
|
110
|
+
mode?: 'multiple' | 'single';
|
|
111
|
+
/** 是否展示选中图标 */
|
|
112
|
+
showActiveIcon?: boolean;
|
|
113
|
+
/** 开启编辑金额 */
|
|
114
|
+
enableEditAmount?: boolean;
|
|
115
|
+
/** 显示状态标识 */
|
|
116
|
+
showStatus?: boolean;
|
|
117
|
+
/** 名称标题字号字重颜色配置 */
|
|
118
|
+
nameTitleStyle?: {
|
|
119
|
+
fontSize: number;
|
|
120
|
+
fontWeight: number;
|
|
121
|
+
color: string;
|
|
122
|
+
};
|
|
123
|
+
/** 卡片状态 */
|
|
124
|
+
cardStatus?: 'used' | 'expired' | 'disabled' | 'conflict' | 'lastPayment';
|
|
125
|
+
/** 自定义余额格式化函数,如果提供则优先使用 */
|
|
126
|
+
formatBalance?: (balance?: number, option?: FormatOption) => React.ReactNode;
|
|
127
|
+
/** 自定义余额标题格式化函数,如果提供则优先使用 */
|
|
128
|
+
formatBalanceTitle?: (balanceTitle?: string, option?: FormatOption) => React.ReactNode;
|
|
129
|
+
/** 自定义使用金额格式化函数,如果提供则优先使用 */
|
|
130
|
+
formatRedeem?: (redeem?: number, option?: FormatOption) => React.ReactNode;
|
|
131
|
+
/** 自定义使用金额标题格式化函数,如果提供则优先使用 */
|
|
132
|
+
formatRedeemTitle?: (redeemTitle?: string, option?: FormatOption) => React.ReactNode;
|
|
133
|
+
/** 最大使用金额 */
|
|
134
|
+
maxRedeem?: number;
|
|
135
|
+
/** 编辑金额前事件 */
|
|
136
|
+
onBeforeEditAmount?: (value: any) => Promise<any> | boolean | void;
|
|
137
|
+
[key: string]: any;
|
|
138
|
+
}
|
|
139
|
+
declare const PisellWalletPassCard: (props: PisellWalletPassCardProps) => JSX.Element;
|
|
140
|
+
export default PisellWalletPassCard;
|
|
@@ -41,6 +41,7 @@ var import_dayjs = __toESM(require("dayjs"));
|
|
|
41
41
|
var import_iconfont = __toESM(require("../iconfont"));
|
|
42
42
|
var import__ = require("../../index");
|
|
43
43
|
var import_pisellTags = __toESM(require("../pisellTags"));
|
|
44
|
+
var import_utils = require("./utils");
|
|
44
45
|
var import_Amount = __toESM(require("../pisellText/components/Amount"));
|
|
45
46
|
var import_Amount2 = __toESM(require("../virtual-keyboard/Amount"));
|
|
46
47
|
var import_index = require("./index.less");
|
|
@@ -64,6 +65,7 @@ var PisellWalletPassCard = (props) => {
|
|
|
64
65
|
const [pressTimer, setPressTimer] = import_react.default.useState(
|
|
65
66
|
null
|
|
66
67
|
);
|
|
68
|
+
const config = (0, import__.usePisellConfig)();
|
|
67
69
|
(0, import_react.useEffect)(() => {
|
|
68
70
|
return () => {
|
|
69
71
|
if (pressTimer) {
|
|
@@ -120,7 +122,9 @@ var PisellWalletPassCard = (props) => {
|
|
|
120
122
|
formatBalanceTitle,
|
|
121
123
|
formatRedeem,
|
|
122
124
|
formatRedeemTitle,
|
|
123
|
-
maxRedeem
|
|
125
|
+
maxRedeem,
|
|
126
|
+
validDateBySchedule,
|
|
127
|
+
scheduleList
|
|
124
128
|
} = props;
|
|
125
129
|
(0, import_react.useEffect)(() => {
|
|
126
130
|
document.body.id = "body";
|
|
@@ -248,6 +252,12 @@ var PisellWalletPassCard = (props) => {
|
|
|
248
252
|
}
|
|
249
253
|
setLastTap(now);
|
|
250
254
|
};
|
|
255
|
+
const formatValidDate = (0, import_react.useMemo)(() => {
|
|
256
|
+
if (validDateBySchedule && scheduleList && (scheduleList == null ? void 0 : scheduleList.length) > 0) {
|
|
257
|
+
return /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, (0, import_locales.getText)("pisell-wallet-pass-card-valid"), " ", (0, import_utils.getScheduleSummary)(scheduleList, config == null ? void 0 : config.locale) || validDate);
|
|
258
|
+
}
|
|
259
|
+
return /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, (0, import_locales.getText)("pisell-wallet-pass-card-valid-to"), " ", !!validDate ? validDate : (0, import_locales.getText)("pisell-wallet-pass-card-expireDate"));
|
|
260
|
+
}, [validDateBySchedule, scheduleList, validDate]);
|
|
251
261
|
const _onConfirmEdit = () => {
|
|
252
262
|
form.validateFields().then((values) => {
|
|
253
263
|
var _a;
|
|
@@ -450,7 +460,7 @@ var PisellWalletPassCard = (props) => {
|
|
|
450
460
|
useThousandsSeparator: true,
|
|
451
461
|
value: discount
|
|
452
462
|
}
|
|
453
|
-
)) : /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, discount, "% ", (0, import_locales.getText)("pisell-discount-card-unit"))))), /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-card-code-wrap" }, /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-card-code" }, showCode && !isMini && /* @__PURE__ */ import_react.default.createElement("div", null, code), showValidDate && /* @__PURE__ */ import_react.default.createElement("div", null,
|
|
463
|
+
)) : /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, discount, "% ", (0, import_locales.getText)("pisell-discount-card-unit"))))), /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-card-code-wrap", style: { marginRight: showValidDate ? 60 : 0 } }, /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-card-code" }, showCode && !isMini && /* @__PURE__ */ import_react.default.createElement("div", null, code), showValidDate && /* @__PURE__ */ import_react.default.createElement("div", null, formatValidDate))));
|
|
454
464
|
};
|
|
455
465
|
const getInputItem = (name2) => {
|
|
456
466
|
if ("validDate" === name2) {
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
export declare type Locale = 'en' | 'zh-CN' | 'zh-HK';
|
|
2
|
+
interface ScheduleItem {
|
|
3
|
+
id: number;
|
|
4
|
+
name: string | {
|
|
5
|
+
[key: string]: string;
|
|
6
|
+
};
|
|
7
|
+
type: 'standard' | 'time-slots' | 'designation';
|
|
8
|
+
start_time: string | null;
|
|
9
|
+
end_time: string | null;
|
|
10
|
+
repeat_type: 'none' | 'daily' | 'weekly' | 'monthly' | 'yearly';
|
|
11
|
+
repeat_rule: {
|
|
12
|
+
end: {
|
|
13
|
+
type: 'never' | 'date' | 'occurrence';
|
|
14
|
+
end_date: string | null;
|
|
15
|
+
occurrence: number | null;
|
|
16
|
+
};
|
|
17
|
+
frequency: number;
|
|
18
|
+
excluded_date: Array<{
|
|
19
|
+
start: string;
|
|
20
|
+
end: string;
|
|
21
|
+
}>;
|
|
22
|
+
included_date: any[];
|
|
23
|
+
frequency_date: number[];
|
|
24
|
+
} | null;
|
|
25
|
+
designation: Array<{
|
|
26
|
+
start_date: string;
|
|
27
|
+
start_time: string;
|
|
28
|
+
end_date: string;
|
|
29
|
+
end_time: string;
|
|
30
|
+
}> | null;
|
|
31
|
+
is_all: number;
|
|
32
|
+
time_slot: Array<{
|
|
33
|
+
start_time: string;
|
|
34
|
+
end_time: string;
|
|
35
|
+
}>;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* 获取schedule摘要信息
|
|
39
|
+
* @param scheduleList 日程列表
|
|
40
|
+
* @param locale 语言设置
|
|
41
|
+
* @returns 摘要文本
|
|
42
|
+
*/
|
|
43
|
+
export declare function getScheduleSummary(scheduleList: ScheduleItem[], locale?: Locale): string;
|
|
44
|
+
export {};
|
|
@@ -0,0 +1,349 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
+
mod
|
|
26
|
+
));
|
|
27
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
|
+
|
|
29
|
+
// src/components/pisellWalletPassCard/utils.ts
|
|
30
|
+
var utils_exports = {};
|
|
31
|
+
__export(utils_exports, {
|
|
32
|
+
getScheduleSummary: () => getScheduleSummary
|
|
33
|
+
});
|
|
34
|
+
module.exports = __toCommonJS(utils_exports);
|
|
35
|
+
var import_dayjs = __toESM(require("dayjs"));
|
|
36
|
+
var CONSTANTS = {
|
|
37
|
+
ALL_DAY_START: "00:00",
|
|
38
|
+
ALL_DAY_END: "23:59",
|
|
39
|
+
DEFAULT_FUTURE_YEARS: 10,
|
|
40
|
+
SECONDS_SUFFIX: ":59"
|
|
41
|
+
};
|
|
42
|
+
var textConfig = {
|
|
43
|
+
"zh-HK": {
|
|
44
|
+
weekdays: ["日", "一", "二", "三", "四", "五", "六"],
|
|
45
|
+
separator: "、",
|
|
46
|
+
timeSeparator: "–",
|
|
47
|
+
rangeSeparator: " 至 ",
|
|
48
|
+
periodSeparator: ";",
|
|
49
|
+
timeSlotSeparator: ",",
|
|
50
|
+
every: "每",
|
|
51
|
+
day: "天",
|
|
52
|
+
week: "周",
|
|
53
|
+
month: "月",
|
|
54
|
+
year: "年",
|
|
55
|
+
available: "可用",
|
|
56
|
+
unlimited: "无限期",
|
|
57
|
+
multipleRules: "多規則,點詳情",
|
|
58
|
+
multipleSlots: ",多時段",
|
|
59
|
+
until: "至",
|
|
60
|
+
daily: "每天",
|
|
61
|
+
days: "天",
|
|
62
|
+
weeks: "周",
|
|
63
|
+
everyPrefix: "每",
|
|
64
|
+
weekPrefix: "周",
|
|
65
|
+
dateFormat: "YYYY-MM-DD",
|
|
66
|
+
dateTimeFormat: "YYYY-MM-DD HH:mm",
|
|
67
|
+
longTermValidFrom: "自",
|
|
68
|
+
noExpiry: "起長期有效",
|
|
69
|
+
on: ""
|
|
70
|
+
},
|
|
71
|
+
"zh-CN": {
|
|
72
|
+
weekdays: ["日", "一", "二", "三", "四", "五", "六"],
|
|
73
|
+
separator: "、",
|
|
74
|
+
timeSeparator: "–",
|
|
75
|
+
rangeSeparator: " 至 ",
|
|
76
|
+
periodSeparator: ";",
|
|
77
|
+
timeSlotSeparator: ",",
|
|
78
|
+
every: "每",
|
|
79
|
+
day: "天",
|
|
80
|
+
week: "周",
|
|
81
|
+
month: "月",
|
|
82
|
+
year: "年",
|
|
83
|
+
available: "可用",
|
|
84
|
+
unlimited: "无限期",
|
|
85
|
+
multipleRules: "多规则,点详情",
|
|
86
|
+
multipleSlots: ",多时段",
|
|
87
|
+
until: "至",
|
|
88
|
+
daily: "每天",
|
|
89
|
+
days: "天",
|
|
90
|
+
weeks: "周",
|
|
91
|
+
everyPrefix: "每",
|
|
92
|
+
weekPrefix: "周",
|
|
93
|
+
dateFormat: "YYYY-MM-DD",
|
|
94
|
+
dateTimeFormat: "YYYY-MM-DD HH:mm",
|
|
95
|
+
longTermValidFrom: "自",
|
|
96
|
+
noExpiry: "起长期有效",
|
|
97
|
+
on: ""
|
|
98
|
+
},
|
|
99
|
+
"en": {
|
|
100
|
+
weekdays: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"],
|
|
101
|
+
separator: ", ",
|
|
102
|
+
timeSeparator: "–",
|
|
103
|
+
rangeSeparator: " - ",
|
|
104
|
+
periodSeparator: "; ",
|
|
105
|
+
timeSlotSeparator: ", ",
|
|
106
|
+
every: "every ",
|
|
107
|
+
day: "day",
|
|
108
|
+
week: "week",
|
|
109
|
+
month: "month",
|
|
110
|
+
year: "year",
|
|
111
|
+
available: "available",
|
|
112
|
+
unlimited: "unlimited",
|
|
113
|
+
multipleRules: "Multiple rules, see details",
|
|
114
|
+
multipleSlots: ", multiple slots",
|
|
115
|
+
until: "Until ",
|
|
116
|
+
daily: "daily",
|
|
117
|
+
days: "days",
|
|
118
|
+
weeks: "weeks",
|
|
119
|
+
everyPrefix: "every ",
|
|
120
|
+
weekPrefix: "",
|
|
121
|
+
dateFormat: "DD MMM YYYY",
|
|
122
|
+
dateTimeFormat: "DD MMM YYYY h:mm A",
|
|
123
|
+
longTermValidFrom: "from ",
|
|
124
|
+
noExpiry: ", no expiry",
|
|
125
|
+
on: "on "
|
|
126
|
+
}
|
|
127
|
+
};
|
|
128
|
+
function getWeekdayText(dayNumbers, locale, separator) {
|
|
129
|
+
const config = textConfig[locale];
|
|
130
|
+
return dayNumbers.map((day) => config.weekdays[day]).join(separator || config.separator);
|
|
131
|
+
}
|
|
132
|
+
function getText(locale, key) {
|
|
133
|
+
return textConfig[locale][key];
|
|
134
|
+
}
|
|
135
|
+
function getConfig(locale) {
|
|
136
|
+
return textConfig[locale];
|
|
137
|
+
}
|
|
138
|
+
function getDailyFrequencyText(frequency, locale) {
|
|
139
|
+
if (frequency === 1) {
|
|
140
|
+
return getText(locale, "daily");
|
|
141
|
+
}
|
|
142
|
+
const config = textConfig[locale];
|
|
143
|
+
if (locale === "en") {
|
|
144
|
+
return `${config.everyPrefix}${frequency} ${config.days}`;
|
|
145
|
+
} else {
|
|
146
|
+
return `${config.everyPrefix}${frequency}${config.days}`;
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
function getWeeklyFrequencyPrefix(frequency, locale) {
|
|
150
|
+
if (frequency === 1) {
|
|
151
|
+
return "";
|
|
152
|
+
}
|
|
153
|
+
const config = textConfig[locale];
|
|
154
|
+
if (locale === "en") {
|
|
155
|
+
return `${config.everyPrefix}${frequency} ${config.weeks}, `;
|
|
156
|
+
} else {
|
|
157
|
+
return `${config.everyPrefix}${frequency}${config.weeks} `;
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
function formatDateTime(dateTime, isAll = false, locale = "zh-CN") {
|
|
161
|
+
const date = (0, import_dayjs.default)(dateTime);
|
|
162
|
+
const config = getConfig(locale);
|
|
163
|
+
if (isAll) {
|
|
164
|
+
return date.format(config.dateFormat);
|
|
165
|
+
}
|
|
166
|
+
return date.format(config.dateTimeFormat);
|
|
167
|
+
}
|
|
168
|
+
function isAllDaySchedule(startTime, endTime) {
|
|
169
|
+
return startTime === CONSTANTS.ALL_DAY_START && endTime === CONSTANTS.ALL_DAY_END;
|
|
170
|
+
}
|
|
171
|
+
function formatDateRange(startDate, endDate, isStarted, locale, isAllDay = false) {
|
|
172
|
+
const config = getConfig(locale);
|
|
173
|
+
if (isStarted) {
|
|
174
|
+
const endDateStr = formatDateTime(endDate, isAllDay, locale);
|
|
175
|
+
return `${config.until}${endDateStr}`;
|
|
176
|
+
} else {
|
|
177
|
+
const startDateStr = formatDateTime(startDate, isAllDay, locale);
|
|
178
|
+
const endDateStr = formatDateTime(endDate, isAllDay, locale);
|
|
179
|
+
return `${startDateStr}${config.rangeSeparator}${endDateStr}`;
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
function getScheduleSummary(scheduleList, locale = "zh-CN") {
|
|
183
|
+
try {
|
|
184
|
+
if (!scheduleList || !Array.isArray(scheduleList)) {
|
|
185
|
+
return "";
|
|
186
|
+
}
|
|
187
|
+
if (scheduleList.length > 1) {
|
|
188
|
+
return getText(locale, "multipleRules");
|
|
189
|
+
}
|
|
190
|
+
if (scheduleList.length === 0) {
|
|
191
|
+
return "";
|
|
192
|
+
}
|
|
193
|
+
const schedule = scheduleList[0];
|
|
194
|
+
if (!schedule) {
|
|
195
|
+
return "";
|
|
196
|
+
}
|
|
197
|
+
const now = (0, import_dayjs.default)();
|
|
198
|
+
let startTime = null;
|
|
199
|
+
if (schedule.start_time) {
|
|
200
|
+
startTime = (0, import_dayjs.default)(schedule.start_time);
|
|
201
|
+
} else if (schedule.designation && schedule.designation.length > 0) {
|
|
202
|
+
const firstDesignation = schedule.designation[0];
|
|
203
|
+
if (firstDesignation && firstDesignation.start_date && firstDesignation.start_time) {
|
|
204
|
+
startTime = (0, import_dayjs.default)(`${firstDesignation.start_date} ${firstDesignation.start_time}`);
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
const isStarted = startTime ? isTimeStarted(now, startTime) : false;
|
|
208
|
+
return generateSummaryText(schedule, isStarted, locale);
|
|
209
|
+
} catch (error) {
|
|
210
|
+
console.warn("Error in getScheduleSummary:", error);
|
|
211
|
+
return "";
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
function isTimeStarted(now, startTime) {
|
|
215
|
+
return startTime.isBefore(now);
|
|
216
|
+
}
|
|
217
|
+
function generateSummaryText(schedule, isStarted, locale) {
|
|
218
|
+
if (schedule.type === "designation" && schedule.designation && schedule.designation.length > 1) {
|
|
219
|
+
return getText(locale, "multipleRules");
|
|
220
|
+
}
|
|
221
|
+
if (schedule.type === "time-slots") {
|
|
222
|
+
const endDate = getScheduleEndDate(schedule);
|
|
223
|
+
if (!endDate) return "";
|
|
224
|
+
const endDateStr = formatDateTime(endDate, true, locale);
|
|
225
|
+
const prefix = "";
|
|
226
|
+
const suffix = getText(locale, "multipleSlots");
|
|
227
|
+
return `${prefix}${endDateStr}${suffix}`;
|
|
228
|
+
}
|
|
229
|
+
if (schedule.repeat_type !== "none" && schedule.repeat_rule) {
|
|
230
|
+
return generateRecurringSummary(schedule, isStarted, locale);
|
|
231
|
+
}
|
|
232
|
+
return generateSingleScheduleSummary(schedule, isStarted, locale);
|
|
233
|
+
}
|
|
234
|
+
function generateRecurringSummary(schedule, isStarted, locale) {
|
|
235
|
+
const { repeat_type, repeat_rule } = schedule;
|
|
236
|
+
if (!repeat_rule) return "";
|
|
237
|
+
const { frequency, frequency_date, end } = repeat_rule;
|
|
238
|
+
if (end.type === "never") {
|
|
239
|
+
return generateNeverEndingRecurringSummary(schedule, isStarted, locale, repeat_type, frequency, frequency_date);
|
|
240
|
+
}
|
|
241
|
+
const endDate = getScheduleEndDate(schedule);
|
|
242
|
+
if (!endDate) return "";
|
|
243
|
+
const endDateStr = formatDateTime(endDate, true, locale);
|
|
244
|
+
if (repeat_type === "daily") {
|
|
245
|
+
const frequencyText = getDailyFrequencyText(frequency, locale);
|
|
246
|
+
const dateRange = formatDateRange(schedule.start_time, endDate, isStarted, locale, true);
|
|
247
|
+
return `${dateRange},${frequencyText}`;
|
|
248
|
+
}
|
|
249
|
+
if (repeat_type === "weekly") {
|
|
250
|
+
const weekdaysText = getWeekdayText(frequency_date, locale, "/");
|
|
251
|
+
const frequencyPrefix = getWeeklyFrequencyPrefix(frequency, locale);
|
|
252
|
+
const config = getConfig(locale);
|
|
253
|
+
const dateRange = formatDateRange(schedule.start_time, endDate, isStarted, locale, true);
|
|
254
|
+
return `${dateRange},${frequencyPrefix}${config.weekPrefix}${weekdaysText}`;
|
|
255
|
+
}
|
|
256
|
+
return "";
|
|
257
|
+
}
|
|
258
|
+
function generateNeverEndingRecurringSummary(schedule, isStarted, locale, repeatType, frequency, frequencyDate) {
|
|
259
|
+
const config = getConfig(locale);
|
|
260
|
+
if (repeatType === "daily") {
|
|
261
|
+
if (frequency === 1) {
|
|
262
|
+
if (schedule.start_time) {
|
|
263
|
+
const startDateStr = formatDateTime(schedule.start_time, true, locale);
|
|
264
|
+
return `${config.longTermValidFrom}${startDateStr}${config.noExpiry}`;
|
|
265
|
+
}
|
|
266
|
+
return "";
|
|
267
|
+
} else {
|
|
268
|
+
const frequencyText = getDailyFrequencyText(frequency, locale);
|
|
269
|
+
if (locale === "en") {
|
|
270
|
+
return `${frequencyText}`;
|
|
271
|
+
} else {
|
|
272
|
+
return `${frequencyText}${config.available}`;
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
if (repeatType === "weekly") {
|
|
277
|
+
const weekdaysText = getWeekdayText(frequencyDate, locale, locale === "en" ? " & " : "/");
|
|
278
|
+
if (frequency === 1) {
|
|
279
|
+
if (locale === "en") {
|
|
280
|
+
return `${config.on}${weekdaysText}`;
|
|
281
|
+
} else {
|
|
282
|
+
return `${config.everyPrefix}${config.weekPrefix}${weekdaysText}${config.available}`;
|
|
283
|
+
}
|
|
284
|
+
} else {
|
|
285
|
+
const frequencyPrefix = getWeeklyFrequencyPrefix(frequency, locale);
|
|
286
|
+
if (locale === "en") {
|
|
287
|
+
return `${frequencyPrefix}${config.on}${weekdaysText}`;
|
|
288
|
+
} else {
|
|
289
|
+
return `${frequencyPrefix}${config.weekPrefix}${weekdaysText}`;
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
return "";
|
|
294
|
+
}
|
|
295
|
+
function generateSingleScheduleSummary(schedule, isStarted, locale) {
|
|
296
|
+
const isAllDay = schedule.is_all === 1;
|
|
297
|
+
if (schedule.type === "designation" && schedule.designation && schedule.designation.length === 1) {
|
|
298
|
+
const designation = schedule.designation[0];
|
|
299
|
+
const startDate = designation.start_date;
|
|
300
|
+
const endDate = designation.end_date;
|
|
301
|
+
const startTime = designation.start_time;
|
|
302
|
+
const endTime = designation.end_time;
|
|
303
|
+
const isDesignationAllDay = isAllDaySchedule(startTime, endTime);
|
|
304
|
+
if (isDesignationAllDay || isAllDay) {
|
|
305
|
+
return formatDateRange(startDate, endDate, isStarted, locale, true);
|
|
306
|
+
} else {
|
|
307
|
+
const startDateTime = `${startDate} ${startTime}${CONSTANTS.SECONDS_SUFFIX}`;
|
|
308
|
+
const endDateTime = `${endDate} ${endTime}${CONSTANTS.SECONDS_SUFFIX}`;
|
|
309
|
+
return formatDateRange(startDateTime, endDateTime, isStarted, locale, false);
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
if (isAllDay) {
|
|
313
|
+
const endDate = getScheduleEndDate(schedule);
|
|
314
|
+
if (!endDate) return "";
|
|
315
|
+
return formatDateRange(schedule.start_time, endDate, isStarted, locale, true);
|
|
316
|
+
} else {
|
|
317
|
+
return formatDateRange(schedule.start_time, schedule.end_time, isStarted, locale, false);
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
function getScheduleEndDate(schedule) {
|
|
321
|
+
try {
|
|
322
|
+
if (schedule.repeat_rule) {
|
|
323
|
+
if (schedule.repeat_rule.end.type === "never") {
|
|
324
|
+
const futureDate = (0, import_dayjs.default)().add(CONSTANTS.DEFAULT_FUTURE_YEARS, "year");
|
|
325
|
+
return `${futureDate.format("YYYY-MM-DD")} ${CONSTANTS.ALL_DAY_END}${CONSTANTS.SECONDS_SUFFIX}`;
|
|
326
|
+
} else if (schedule.repeat_rule.end.end_date) {
|
|
327
|
+
return `${schedule.repeat_rule.end.end_date} ${CONSTANTS.ALL_DAY_END}${CONSTANTS.SECONDS_SUFFIX}`;
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
if (schedule.designation && schedule.designation.length > 0) {
|
|
331
|
+
const lastDesignation = schedule.designation[schedule.designation.length - 1];
|
|
332
|
+
return `${lastDesignation.end_date} ${lastDesignation.end_time}${CONSTANTS.SECONDS_SUFFIX}`;
|
|
333
|
+
}
|
|
334
|
+
if (schedule.end_time) {
|
|
335
|
+
return schedule.end_time;
|
|
336
|
+
}
|
|
337
|
+
if (schedule.start_time) {
|
|
338
|
+
return schedule.start_time;
|
|
339
|
+
}
|
|
340
|
+
return null;
|
|
341
|
+
} catch (error) {
|
|
342
|
+
console.warn("Error in getScheduleEndDate:", error);
|
|
343
|
+
return null;
|
|
344
|
+
}
|
|
345
|
+
}
|
|
346
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
347
|
+
0 && (module.exports = {
|
|
348
|
+
getScheduleSummary
|
|
349
|
+
});
|
|
@@ -17,4 +17,4 @@ export declare const minusSign: (item: any, type?: string) => "" | "-";
|
|
|
17
17
|
* @Author: WangHan
|
|
18
18
|
* @Date: 2024-11-22 10:58
|
|
19
19
|
*/
|
|
20
|
-
export declare const _formatAmount: (price?: number, amountSymbol?: string, digit?: number) =>
|
|
20
|
+
export declare const _formatAmount: (price?: number, amountSymbol?: string, digit?: number) => string | number;
|