@pisell/materials 2.2.81 → 2.2.82
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 +2 -2
- package/build/lowcode/preview.js +145 -145
- package/build/lowcode/render/default/view.css +1 -1
- package/build/lowcode/render/default/view.js +41 -31
- package/build/lowcode/view.css +1 -1
- package/build/lowcode/view.js +37 -27
- package/es/components/batch-editor/index.d.ts +1 -0
- package/es/components/dataSourceComponents/dataSourceShow/dataSourceImage/index.d.ts +1 -0
- package/es/components/dataSourceComponents/dataSourceShow/dataSourceQRCode/index.d.ts +1 -0
- package/es/components/dataSourceComponents/dataSourceTable/filter/index.d.ts +1 -0
- package/es/components/dataSourceComponents/dataSourceTable/hooks/useDataSourceKey.d.ts +2 -2
- package/es/components/dataSourceComponents/dataSourceTable/hooks/useTableProps.d.ts +4 -4
- package/es/components/dataSourceComponents/dataSourceWrapper/index.d.ts +1 -0
- package/es/components/dataSourceComponents/fields/Select/index.d.ts +1 -0
- package/es/components/dataSourceComponents/fields/Upload/utils.d.ts +1 -1
- package/es/components/dataSourceComponents/fields/index.d.ts +7 -6
- package/es/components/date-picker/index.d.ts +1 -0
- package/es/components/iconfont/index.js +1 -1
- package/es/components/page/index.d.ts +1 -0
- package/es/components/pisellInput/index.d.ts +1 -0
- package/es/components/pisellModal/components/IpadModal/index.d.ts +1 -0
- package/es/components/pisellModal/components/MobileModal/index.d.ts +1 -0
- package/es/components/pisellModal/components/index.d.ts +1 -0
- package/es/components/pisellToast/index.js +3 -0
- package/es/components/pisellWalletPassCard/index.d.ts +1 -0
- package/es/components/productCard/cartSkuCard/components/basicInfo/index.d.ts +21 -0
- package/es/components/productCard/cartSkuCard/components/basicInfo/index.js +61 -0
- package/es/components/productCard/cartSkuCard/components/basicInfo/index.less +98 -0
- package/es/components/productCard/cartSkuCard/components/discountReason/index.d.ts +2 -0
- package/es/components/productCard/cartSkuCard/components/discountReason/index.js +51 -0
- package/es/components/productCard/cartSkuCard/components/holders/index.d.ts +4 -0
- package/es/components/productCard/cartSkuCard/components/holders/index.js +32 -0
- package/es/components/productCard/cartSkuCard/components/holders/index.less +32 -0
- package/es/components/productCard/cartSkuCard/components/packages/index.d.ts +10 -0
- package/es/components/productCard/cartSkuCard/components/packages/index.js +52 -0
- package/es/components/productCard/cartSkuCard/components/packages/index.less +22 -0
- package/es/components/productCard/cartSkuCard/components/packages/utils.d.ts +20 -0
- package/es/components/productCard/cartSkuCard/components/packages/utils.js +40 -0
- package/es/components/productCard/cartSkuCard/components/resources/index.d.ts +4 -0
- package/es/components/productCard/cartSkuCard/components/resources/index.js +44 -0
- package/es/components/productCard/cartSkuCard/components/resources/index.less +20 -0
- package/es/components/productCard/cartSkuCard/components/sales/index.d.ts +11 -0
- package/es/components/productCard/cartSkuCard/components/sales/index.js +55 -0
- package/es/components/productCard/cartSkuCard/components/sales/index.less +22 -0
- package/es/components/productCard/cartSkuCard/components/specs/index.d.ts +3 -0
- package/es/components/productCard/cartSkuCard/components/specs/index.js +43 -0
- package/es/components/productCard/cartSkuCard/components/specs/index.less +28 -0
- package/es/components/productCard/cartSkuCard/components/timeRange/index.d.ts +7 -0
- package/es/components/productCard/cartSkuCard/components/timeRange/index.js +53 -0
- package/es/components/productCard/cartSkuCard/components/timeRange/index.less +37 -0
- package/es/components/productCard/cartSkuCard/index.d.ts +8 -0
- package/es/components/productCard/cartSkuCard/index.js +195 -0
- package/es/components/productCard/cartSkuCard/index.less +69 -0
- package/es/components/productCard/cartSkuCard/locales.d.ts +93 -0
- package/es/components/{pisellVHFix/index.js → productCard/cartSkuCard/locales.js} +21 -30
- package/es/components/productCard/components/Packages/utils.d.ts +2 -2
- package/es/components/productCard/index.d.ts +3 -1
- package/es/components/productCard/index.js +2 -0
- package/es/components/productCard/utils.js +8 -6
- package/es/components/select-time/index.d.ts +1 -0
- package/es/components/table/Actions/component/ColumnsSetting/index.d.ts +1 -0
- package/es/components/table/Actions/component/GallerySetting/index.d.ts +1 -0
- package/es/components/table/Actions/component/Group/index.d.ts +1 -0
- package/es/components/table/Actions/index.d.ts +1 -0
- package/es/components/table/Gallery/components/GalleryItem/components/Cover/index.d.ts +1 -0
- package/es/components/table/Gallery/components/GalleryItem/components/Title/index.d.ts +1 -0
- package/es/components/table/Gallery/components/VirtualGrid/useGapSize.d.ts +2 -2
- package/es/components/table/Table/SelectField/index.d.ts +1 -0
- package/es/components/table/Table/fields/date/index.d.ts +1 -0
- package/es/components/table/Table/fields/image/Show/index.d.ts +1 -0
- package/es/components/table/Table/fields/image/index.d.ts +1 -0
- package/es/components/table/Table/fields/index.d.ts +3 -2
- package/es/components/table/Table/fields/link/index.d.ts +1 -0
- package/es/components/table/Table/fields/number/Show/index.d.ts +1 -0
- package/es/components/table/Table/fields/number/index.d.ts +1 -0
- package/es/components/table/Table/fields/numberRange/Show/index.d.ts +1 -0
- package/es/components/table/Table/fields/numberRange/index.d.ts +1 -0
- package/es/components/table/Table/fields/oldRangePicker/index.d.ts +1 -0
- package/es/components/table/Table/fields/pSwitch/Show/index.d.ts +1 -0
- package/es/components/table/Table/fields/pSwitch/index.d.ts +1 -0
- package/es/components/table/Table/fields/rangePicker/index.d.ts +1 -0
- package/es/components/table/Table/fields/search/Show/index.d.ts +1 -0
- package/es/components/table/Table/fields/search/index.d.ts +1 -0
- package/es/components/table/Table/fields/select/filterUtil/index.d.ts +1 -1
- package/es/components/table/Table/fields/text/Show/index.d.ts +1 -0
- package/es/components/table/Table/fields/text/index.d.ts +1 -0
- package/es/components/table/Table/fields/treeSelect/filterUtil/index.d.ts +1 -1
- package/es/components/table/Table/utils.d.ts +1 -1
- package/es/components/versionSelect/index.d.ts +1 -0
- package/es/utils/index.d.ts +1 -1
- package/es/utils/platform.d.ts +1 -1
- package/lib/components/batch-editor/index.d.ts +1 -0
- package/lib/components/dataSourceComponents/dataSourceShow/dataSourceImage/index.d.ts +1 -0
- package/lib/components/dataSourceComponents/dataSourceShow/dataSourceQRCode/index.d.ts +1 -0
- package/lib/components/dataSourceComponents/dataSourceTable/filter/index.d.ts +1 -0
- package/lib/components/dataSourceComponents/dataSourceTable/hooks/useDataSourceKey.d.ts +2 -2
- package/lib/components/dataSourceComponents/dataSourceTable/hooks/useTableProps.d.ts +4 -4
- package/lib/components/dataSourceComponents/dataSourceWrapper/index.d.ts +1 -0
- package/lib/components/dataSourceComponents/fields/Select/index.d.ts +1 -0
- package/lib/components/dataSourceComponents/fields/Upload/utils.d.ts +1 -1
- package/lib/components/dataSourceComponents/fields/index.d.ts +7 -6
- package/lib/components/date-picker/index.d.ts +1 -0
- package/lib/components/iconfont/index.js +1 -1
- package/lib/components/page/index.d.ts +1 -0
- package/lib/components/pisellInput/index.d.ts +1 -0
- package/lib/components/pisellModal/components/IpadModal/index.d.ts +1 -0
- package/lib/components/pisellModal/components/MobileModal/index.d.ts +1 -0
- package/lib/components/pisellModal/components/index.d.ts +1 -0
- package/lib/components/pisellToast/index.js +3 -0
- package/lib/components/pisellWalletPassCard/index.d.ts +1 -0
- package/lib/components/productCard/cartSkuCard/components/basicInfo/index.d.ts +21 -0
- package/lib/components/productCard/cartSkuCard/components/basicInfo/index.js +71 -0
- package/lib/components/productCard/cartSkuCard/components/basicInfo/index.less +98 -0
- package/lib/components/productCard/cartSkuCard/components/discountReason/index.d.ts +2 -0
- package/lib/components/productCard/cartSkuCard/components/discountReason/index.js +70 -0
- package/lib/components/productCard/cartSkuCard/components/holders/index.d.ts +4 -0
- package/lib/components/{pisellVHFix → productCard/cartSkuCard/components/holders}/index.js +19 -23
- package/lib/components/productCard/cartSkuCard/components/holders/index.less +32 -0
- package/lib/components/productCard/cartSkuCard/components/packages/index.d.ts +10 -0
- package/lib/components/productCard/cartSkuCard/components/packages/index.js +73 -0
- package/lib/components/productCard/cartSkuCard/components/packages/index.less +22 -0
- package/lib/components/productCard/cartSkuCard/components/packages/utils.d.ts +20 -0
- package/lib/components/productCard/cartSkuCard/components/packages/utils.js +44 -0
- package/lib/components/productCard/cartSkuCard/components/resources/index.d.ts +4 -0
- package/lib/components/productCard/cartSkuCard/components/resources/index.js +73 -0
- package/lib/components/productCard/cartSkuCard/components/resources/index.less +20 -0
- package/lib/components/productCard/cartSkuCard/components/sales/index.d.ts +11 -0
- package/lib/components/productCard/cartSkuCard/components/sales/index.js +76 -0
- package/lib/components/productCard/cartSkuCard/components/sales/index.less +22 -0
- package/lib/components/productCard/cartSkuCard/components/specs/index.d.ts +3 -0
- package/lib/components/productCard/cartSkuCard/components/specs/index.js +65 -0
- package/lib/components/productCard/cartSkuCard/components/specs/index.less +28 -0
- package/lib/components/productCard/cartSkuCard/components/timeRange/index.d.ts +7 -0
- package/lib/components/productCard/cartSkuCard/components/timeRange/index.js +67 -0
- package/lib/components/productCard/cartSkuCard/components/timeRange/index.less +37 -0
- package/lib/components/productCard/cartSkuCard/index.d.ts +8 -0
- package/lib/components/productCard/cartSkuCard/index.js +216 -0
- package/lib/components/productCard/cartSkuCard/index.less +69 -0
- package/lib/components/productCard/cartSkuCard/locales.d.ts +93 -0
- package/lib/components/productCard/cartSkuCard/locales.js +58 -0
- package/lib/components/productCard/components/Packages/utils.d.ts +2 -2
- package/lib/components/productCard/index.d.ts +3 -1
- package/lib/components/productCard/index.js +2 -0
- package/lib/components/productCard/utils.js +7 -6
- package/lib/components/select-time/index.d.ts +1 -0
- package/lib/components/table/Actions/component/ColumnsSetting/index.d.ts +1 -0
- package/lib/components/table/Actions/component/GallerySetting/index.d.ts +1 -0
- package/lib/components/table/Actions/component/Group/index.d.ts +1 -0
- package/lib/components/table/Actions/index.d.ts +1 -0
- package/lib/components/table/Gallery/components/GalleryItem/components/Cover/index.d.ts +1 -0
- package/lib/components/table/Gallery/components/GalleryItem/components/Title/index.d.ts +1 -0
- package/lib/components/table/Gallery/components/VirtualGrid/useGapSize.d.ts +2 -2
- package/lib/components/table/Table/SelectField/index.d.ts +1 -0
- package/lib/components/table/Table/fields/date/index.d.ts +1 -0
- package/lib/components/table/Table/fields/image/Show/index.d.ts +1 -0
- package/lib/components/table/Table/fields/image/index.d.ts +1 -0
- package/lib/components/table/Table/fields/index.d.ts +3 -2
- package/lib/components/table/Table/fields/link/index.d.ts +1 -0
- package/lib/components/table/Table/fields/number/Show/index.d.ts +1 -0
- package/lib/components/table/Table/fields/number/index.d.ts +1 -0
- package/lib/components/table/Table/fields/numberRange/Show/index.d.ts +1 -0
- package/lib/components/table/Table/fields/numberRange/index.d.ts +1 -0
- package/lib/components/table/Table/fields/oldRangePicker/index.d.ts +1 -0
- package/lib/components/table/Table/fields/pSwitch/Show/index.d.ts +1 -0
- package/lib/components/table/Table/fields/pSwitch/index.d.ts +1 -0
- package/lib/components/table/Table/fields/rangePicker/index.d.ts +1 -0
- package/lib/components/table/Table/fields/search/Show/index.d.ts +1 -0
- package/lib/components/table/Table/fields/search/index.d.ts +1 -0
- package/lib/components/table/Table/fields/select/filterUtil/index.d.ts +1 -1
- package/lib/components/table/Table/fields/text/Show/index.d.ts +1 -0
- package/lib/components/table/Table/fields/text/index.d.ts +1 -0
- package/lib/components/table/Table/fields/treeSelect/filterUtil/index.d.ts +1 -1
- package/lib/components/table/Table/utils.d.ts +1 -1
- package/lib/components/versionSelect/index.d.ts +1 -0
- package/lib/components/virtual-keyboard/VirtualKeyInput/index.js +8 -1
- package/lib/utils/index.d.ts +1 -1
- package/lib/utils/platform.d.ts +1 -1
- package/lowcode/_setters/antd-icon-setter/index.tsx +3 -2
- package/package.json +1 -1
- package/es/components/appVersionControl/index.d.ts +0 -4
- package/es/components/dataSourceComponents/dataSourceTable/hooks/useDrawerState.d.ts +0 -38
- package/es/components/dataSourceComponents/dataSourceTable/type.d.ts +0 -78
- package/es/components/dataSourceComponents/fields/Input.Phone/serve.d.ts +0 -24
- package/es/components/drag-sort-tree/TreeItem/index.d.ts +0 -18
- package/es/components/drag-sort-tree/index.d.ts +0 -4
- package/es/components/iconfont/index.d.ts +0 -8
- package/es/components/login-and-register/index.d.ts +0 -82
- package/es/components/media/index.d.ts +0 -18
- package/es/components/media/index.js +0 -340
- package/es/components/media/index.less +0 -100
- package/es/components/pisell-config-provider/index.d.ts +0 -12
- package/es/components/pisellAdjustPrice/index.d.ts +0 -9
- package/es/components/pisellEmpty/index.d.ts +0 -19
- package/es/components/pisellInformationEntry/hooks/useTerminalPeripherals.d.ts +0 -8
- package/es/components/pisellVHFix/index.d.ts +0 -13
- package/es/components/pisellVHFix/index.less +0 -10
- package/es/components/productCard/components/Header/DeleteButton/index.d.ts +0 -3
- package/es/components/productCard/components/Time/index.d.ts +0 -3
- package/es/components/table/Table/index.d.ts +0 -4
- package/es/components/table/hooks/useTableSetting.d.ts +0 -22
- package/es/components/table/types.d.ts +0 -251
- package/es/components/versionModal/index.d.ts +0 -23
- package/es/components/virtual-keyboard/Amount/index.d.ts +0 -22
- package/es/components/virtual-keyboard/Keyboard/index.d.ts +0 -21
- package/es/components/walletCard/index.d.ts +0 -67
- package/es/locales/en-US.d.ts +0 -278
- package/es/locales/zh-CN.d.ts +0 -273
- package/es/locales/zh-TW.d.ts +0 -273
- package/lib/components/appVersionControl/index.d.ts +0 -4
- package/lib/components/dataSourceComponents/dataSourceTable/hooks/useDrawerState.d.ts +0 -38
- package/lib/components/dataSourceComponents/dataSourceTable/type.d.ts +0 -78
- package/lib/components/dataSourceComponents/fields/Input.Phone/serve.d.ts +0 -24
- package/lib/components/drag-sort-tree/TreeItem/index.d.ts +0 -18
- package/lib/components/drag-sort-tree/index.d.ts +0 -4
- package/lib/components/iconfont/index.d.ts +0 -8
- package/lib/components/login-and-register/index.d.ts +0 -82
- package/lib/components/media/index.d.ts +0 -18
- package/lib/components/media/index.js +0 -265
- package/lib/components/media/index.less +0 -100
- package/lib/components/pisell-config-provider/index.d.ts +0 -12
- package/lib/components/pisellAdjustPrice/index.d.ts +0 -9
- package/lib/components/pisellEmpty/index.d.ts +0 -19
- package/lib/components/pisellInformationEntry/hooks/useTerminalPeripherals.d.ts +0 -8
- package/lib/components/pisellVHFix/index.d.ts +0 -13
- package/lib/components/pisellVHFix/index.less +0 -10
- package/lib/components/productCard/components/Header/DeleteButton/index.d.ts +0 -3
- package/lib/components/productCard/components/Time/index.d.ts +0 -3
- package/lib/components/table/Table/index.d.ts +0 -4
- package/lib/components/table/hooks/useTableSetting.d.ts +0 -22
- package/lib/components/table/types.d.ts +0 -251
- package/lib/components/versionModal/index.d.ts +0 -23
- package/lib/components/virtual-keyboard/Amount/index.d.ts +0 -22
- package/lib/components/virtual-keyboard/Keyboard/index.d.ts +0 -21
- package/lib/components/walletCard/index.d.ts +0 -67
- package/lib/locales/en-US.d.ts +0 -278
- package/lib/locales/zh-CN.d.ts +0 -273
- package/lib/locales/zh-TW.d.ts +0 -273
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
|
-
import { ColumnType } from 'antd/es/table';
|
|
3
|
-
import { DataSourceType } from '../provider/dataSource/DataSourceContext';
|
|
4
|
-
export declare type OperationItem = {
|
|
5
|
-
label?: string;
|
|
6
|
-
openMode: 'modal' | 'drawer' | 'custom';
|
|
7
|
-
openContentSize: 'small' | 'middle' | 'large';
|
|
8
|
-
openTitle: string;
|
|
9
|
-
actionType: 'detail' | 'edit' | 'delete' | 'custom';
|
|
10
|
-
key: string;
|
|
11
|
-
buttonProps?: any;
|
|
12
|
-
onClick?: (record: any) => void;
|
|
13
|
-
};
|
|
14
|
-
export interface DataSourceTableProps {
|
|
15
|
-
title?: string | React.ReactNode | (() => React.ReactNode);
|
|
16
|
-
subTitle?: string | React.ReactNode | (() => React.ReactNode);
|
|
17
|
-
titleButtons?: {
|
|
18
|
-
show: boolean;
|
|
19
|
-
maxCount: number;
|
|
20
|
-
items: OperationItem[];
|
|
21
|
-
};
|
|
22
|
-
tableButtons?: {
|
|
23
|
-
show: boolean;
|
|
24
|
-
maxCount: number;
|
|
25
|
-
items: OperationItem[];
|
|
26
|
-
};
|
|
27
|
-
buttons?: any[];
|
|
28
|
-
operation?: {
|
|
29
|
-
show: boolean;
|
|
30
|
-
title: string;
|
|
31
|
-
width: number;
|
|
32
|
-
align: 'left' | 'center' | 'right';
|
|
33
|
-
fixed: 'left' | 'right' | false;
|
|
34
|
-
type: 'link' | 'button';
|
|
35
|
-
items: OperationItem[];
|
|
36
|
-
};
|
|
37
|
-
operationContent?: {
|
|
38
|
-
[key: string]: React.ReactNode;
|
|
39
|
-
};
|
|
40
|
-
dataSource: DataSourceType;
|
|
41
|
-
columns: ColumnType<any>[];
|
|
42
|
-
filter: any;
|
|
43
|
-
search?: {
|
|
44
|
-
show: boolean;
|
|
45
|
-
placeholder: string;
|
|
46
|
-
};
|
|
47
|
-
__designMode: string;
|
|
48
|
-
componentId: string;
|
|
49
|
-
clickToDetail?: {
|
|
50
|
-
show: boolean;
|
|
51
|
-
useCustomAction: boolean;
|
|
52
|
-
actionType: string;
|
|
53
|
-
openMode: 'modal' | 'drawer';
|
|
54
|
-
openContentSize: 'small' | 'middle' | 'large';
|
|
55
|
-
openTitle: string;
|
|
56
|
-
key: string;
|
|
57
|
-
};
|
|
58
|
-
onRow?: any;
|
|
59
|
-
filterBy?: Record<string, any>;
|
|
60
|
-
sortBy: string;
|
|
61
|
-
tabs?: {
|
|
62
|
-
show: boolean;
|
|
63
|
-
type: string;
|
|
64
|
-
items: {
|
|
65
|
-
name: string;
|
|
66
|
-
filterBy: Record<string, any>;
|
|
67
|
-
sortBy: string;
|
|
68
|
-
}[];
|
|
69
|
-
};
|
|
70
|
-
onValuesChange?: (changedValues: any, values: any) => void;
|
|
71
|
-
extraParams?: {
|
|
72
|
-
list?: Record<string, any>;
|
|
73
|
-
get?: Record<string, any>;
|
|
74
|
-
update?: Record<string, any>;
|
|
75
|
-
create?: Record<string, any>;
|
|
76
|
-
destroy?: Record<string, any>;
|
|
77
|
-
};
|
|
78
|
-
}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* 获取nocobase数据列表
|
|
3
|
-
*/
|
|
4
|
-
export declare const getCountryDataList: () => Promise<any>;
|
|
5
|
-
export interface Country {
|
|
6
|
-
id: number;
|
|
7
|
-
name: {
|
|
8
|
-
en: string;
|
|
9
|
-
"zh-CN": string;
|
|
10
|
-
"zh-HK": string;
|
|
11
|
-
original: string;
|
|
12
|
-
};
|
|
13
|
-
code: string;
|
|
14
|
-
calling_code: string;
|
|
15
|
-
currency_code: string;
|
|
16
|
-
sort: number;
|
|
17
|
-
status: string;
|
|
18
|
-
created_at: string;
|
|
19
|
-
updated_at: string;
|
|
20
|
-
prefix: string;
|
|
21
|
-
}
|
|
22
|
-
export declare const useCountries: () => {
|
|
23
|
-
data: Country[];
|
|
24
|
-
};
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import './index.less';
|
|
2
|
-
import { ValueProps, SortType } from '../types';
|
|
3
|
-
declare type IdType = string | number;
|
|
4
|
-
declare type TreeItemProps = {
|
|
5
|
-
id: string | number;
|
|
6
|
-
key: string | number;
|
|
7
|
-
item: ValueProps | any;
|
|
8
|
-
depth: number;
|
|
9
|
-
lists: any[];
|
|
10
|
-
childrenProps?: SortType;
|
|
11
|
-
sensors?: any;
|
|
12
|
-
expandedKeys?: IdType[];
|
|
13
|
-
setExpandedKeys?: any;
|
|
14
|
-
onSelectKeys?: (ids: IdType) => void;
|
|
15
|
-
onChange?: (value: any[]) => void;
|
|
16
|
-
};
|
|
17
|
-
declare const TreeItem: (props: TreeItemProps) => JSX.Element;
|
|
18
|
-
export default TreeItem;
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { IconComponentProps } from '@ant-design/icons/es/components/Icon';
|
|
2
|
-
import React from 'react';
|
|
3
|
-
interface IconFontProps extends IconComponentProps {
|
|
4
|
-
type: string;
|
|
5
|
-
onClick?: React.MouseEventHandler<HTMLSpanElement>;
|
|
6
|
-
}
|
|
7
|
-
declare const IconFont: React.FC<IconFontProps>;
|
|
8
|
-
export default IconFont;
|
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import './index.less';
|
|
3
|
-
/**
|
|
4
|
-
* loginAndRegister组件的属性接口
|
|
5
|
-
*/
|
|
6
|
-
export interface loginAndRegisterProps {
|
|
7
|
-
/** Logo相关配置 */
|
|
8
|
-
showLogo?: boolean;
|
|
9
|
-
logo?: string;
|
|
10
|
-
logoPosition?: 'left' | 'center' | 'right';
|
|
11
|
-
logoSize?: {
|
|
12
|
-
width?: number;
|
|
13
|
-
height?: number;
|
|
14
|
-
};
|
|
15
|
-
/** 标题相关配置 */
|
|
16
|
-
title?: string;
|
|
17
|
-
showTitle?: boolean;
|
|
18
|
-
titleAlign?: 'left' | 'center' | 'right';
|
|
19
|
-
/** 副标题相关配置 */
|
|
20
|
-
subtitle?: string;
|
|
21
|
-
showSubtitle?: boolean;
|
|
22
|
-
subtitleAlign?: 'left' | 'center' | 'right';
|
|
23
|
-
/** 登录方式配置 */
|
|
24
|
-
loginMethods?: ('email' | 'google' | 'facebook' | 'apple')[];
|
|
25
|
-
defaultLoginMethod?: 'email' | 'google' | 'facebook' | 'apple';
|
|
26
|
-
/** 表单配置 */
|
|
27
|
-
emailLabel?: string;
|
|
28
|
-
passwordLabel?: string;
|
|
29
|
-
emailPlaceholder?: string;
|
|
30
|
-
passwordPlaceholder?: string;
|
|
31
|
-
emailRules?: any[];
|
|
32
|
-
buttonText?: string;
|
|
33
|
-
rememberMeText?: string;
|
|
34
|
-
forgotPasswordText?: string;
|
|
35
|
-
showRememberMe?: boolean;
|
|
36
|
-
showForgotPassword?: boolean;
|
|
37
|
-
/** 社交登录配置 */
|
|
38
|
-
socialLoginTexts?: {
|
|
39
|
-
google?: string;
|
|
40
|
-
facebook?: string;
|
|
41
|
-
apple?: string;
|
|
42
|
-
};
|
|
43
|
-
/** 底部配置 */
|
|
44
|
-
showFooter?: boolean;
|
|
45
|
-
showSignUp?: boolean;
|
|
46
|
-
signUpText?: string;
|
|
47
|
-
signUpLink?: string;
|
|
48
|
-
signUpPosition?: 'left' | 'center' | 'right';
|
|
49
|
-
otherLinks?: Array<{
|
|
50
|
-
text: string;
|
|
51
|
-
url: string;
|
|
52
|
-
}>;
|
|
53
|
-
otherLinksPosition?: 'left' | 'center' | 'right';
|
|
54
|
-
/** 登录/注册切换配置 */
|
|
55
|
-
showTabs?: boolean;
|
|
56
|
-
loginTabText?: string;
|
|
57
|
-
registerTabText?: string;
|
|
58
|
-
/** 注册表单配置 */
|
|
59
|
-
registerEmailPlaceholder?: string;
|
|
60
|
-
registerPasswordPlaceholder?: string;
|
|
61
|
-
registerButtonText?: string;
|
|
62
|
-
/** 事件回调 */
|
|
63
|
-
onLogin?: (values: {
|
|
64
|
-
email: string;
|
|
65
|
-
loginMethod: string;
|
|
66
|
-
}) => void;
|
|
67
|
-
onSocialLogin?: (type: 'google' | 'facebook' | 'apple') => void;
|
|
68
|
-
onSignUp?: () => void;
|
|
69
|
-
onRegister?: (values: {
|
|
70
|
-
email: string;
|
|
71
|
-
password: string;
|
|
72
|
-
}) => void;
|
|
73
|
-
/** 新增背景图片属性 */
|
|
74
|
-
backgroundImage?: string;
|
|
75
|
-
}
|
|
76
|
-
/**
|
|
77
|
-
* Saas登录组件
|
|
78
|
-
* @param props - 组件属性
|
|
79
|
-
* @returns React组件
|
|
80
|
-
*/
|
|
81
|
-
declare const loginAndRegister: React.FC<loginAndRegisterProps>;
|
|
82
|
-
export default loginAndRegister;
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
export interface MediaProps {
|
|
3
|
-
__designMode?: 'design' | undefined;
|
|
4
|
-
value?: string | string[];
|
|
5
|
-
onChange?: (value: string | string[]) => void;
|
|
6
|
-
multiple?: boolean;
|
|
7
|
-
maxCount?: number;
|
|
8
|
-
accept?: string;
|
|
9
|
-
disabled?: boolean;
|
|
10
|
-
className?: string;
|
|
11
|
-
style?: React.CSSProperties;
|
|
12
|
-
placeholder?: string;
|
|
13
|
-
showUploadList?: boolean;
|
|
14
|
-
listType?: 'text' | 'picture' | 'picture-card';
|
|
15
|
-
}
|
|
16
|
-
import './index.less';
|
|
17
|
-
declare const Media: React.ForwardRefExoticComponent<MediaProps & React.RefAttributes<HTMLDivElement>>;
|
|
18
|
-
export default Media;
|
|
@@ -1,340 +0,0 @@
|
|
|
1
|
-
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
-
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
3
|
-
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
4
|
-
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
5
|
-
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
6
|
-
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
7
|
-
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
8
|
-
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
9
|
-
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
10
|
-
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
11
|
-
function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw new Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator.return && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw new Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, catch: function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
|
|
12
|
-
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
13
|
-
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
14
|
-
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
15
|
-
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
16
|
-
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
17
|
-
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
18
|
-
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
19
|
-
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
20
|
-
import React, { forwardRef, useMemo, useState, useCallback } from 'react';
|
|
21
|
-
import { Button, Modal, Upload, Image, message } from 'antd';
|
|
22
|
-
import { PlusOutlined, PictureOutlined } from '@ant-design/icons';
|
|
23
|
-
import { useRequest } from 'ahooks';
|
|
24
|
-
import { request } from "../table/utils";
|
|
25
|
-
import useEngineContext from "../../hooks/useEngineContext";
|
|
26
|
-
import "./index.less";
|
|
27
|
-
var Media = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
28
|
-
var __designMode = props.__designMode,
|
|
29
|
-
value = props.value,
|
|
30
|
-
onChange = props.onChange,
|
|
31
|
-
_props$multiple = props.multiple,
|
|
32
|
-
multiple = _props$multiple === void 0 ? false : _props$multiple,
|
|
33
|
-
_props$maxCount = props.maxCount,
|
|
34
|
-
maxCount = _props$maxCount === void 0 ? 10 : _props$maxCount,
|
|
35
|
-
_props$accept = props.accept,
|
|
36
|
-
accept = _props$accept === void 0 ? 'image/*,video/*,audio/*' : _props$accept,
|
|
37
|
-
_props$disabled = props.disabled,
|
|
38
|
-
disabled = _props$disabled === void 0 ? false : _props$disabled,
|
|
39
|
-
className = props.className,
|
|
40
|
-
style = props.style,
|
|
41
|
-
_props$placeholder = props.placeholder,
|
|
42
|
-
placeholder = _props$placeholder === void 0 ? '選擇媒體文件' : _props$placeholder,
|
|
43
|
-
_props$showUploadList = props.showUploadList,
|
|
44
|
-
showUploadList = _props$showUploadList === void 0 ? true : _props$showUploadList,
|
|
45
|
-
_props$listType = props.listType,
|
|
46
|
-
listType = _props$listType === void 0 ? 'picture-card' : _props$listType;
|
|
47
|
-
var _useState = useState(false),
|
|
48
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
49
|
-
isModalVisible = _useState2[0],
|
|
50
|
-
setIsModalVisible = _useState2[1];
|
|
51
|
-
var _useState3 = useState([]),
|
|
52
|
-
_useState4 = _slicedToArray(_useState3, 2),
|
|
53
|
-
selectedItems = _useState4[0],
|
|
54
|
-
setSelectedItems = _useState4[1];
|
|
55
|
-
var _useState5 = useState(false),
|
|
56
|
-
_useState6 = _slicedToArray(_useState5, 2),
|
|
57
|
-
uploading = _useState6[0],
|
|
58
|
-
setUploading = _useState6[1];
|
|
59
|
-
var _useEngineContext = useEngineContext(),
|
|
60
|
-
appHelper = _useEngineContext.appHelper;
|
|
61
|
-
var _ref = (appHelper === null || appHelper === void 0 ? void 0 : appHelper.constants) || {},
|
|
62
|
-
mediaUploadUrl = _ref.mediaUploadUrl,
|
|
63
|
-
getHeaders = _ref.getHeaders;
|
|
64
|
-
|
|
65
|
-
// 获取媒体库列表
|
|
66
|
-
var _useRequest = useRequest( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
67
|
-
var _yield$request$getReq, data;
|
|
68
|
-
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
69
|
-
while (1) switch (_context.prev = _context.next) {
|
|
70
|
-
case 0:
|
|
71
|
-
_context.next = 2;
|
|
72
|
-
return request.getRequest().get("/media:list", {
|
|
73
|
-
page: 1,
|
|
74
|
-
pageSize: 100
|
|
75
|
-
}, {
|
|
76
|
-
isNocobase: true,
|
|
77
|
-
fullResult: true,
|
|
78
|
-
headers: {
|
|
79
|
-
'x-data-source': 'pisell2'
|
|
80
|
-
}
|
|
81
|
-
});
|
|
82
|
-
case 2:
|
|
83
|
-
_yield$request$getReq = _context.sent;
|
|
84
|
-
data = _yield$request$getReq.data;
|
|
85
|
-
return _context.abrupt("return", (data === null || data === void 0 ? void 0 : data.data) || []);
|
|
86
|
-
case 5:
|
|
87
|
-
case "end":
|
|
88
|
-
return _context.stop();
|
|
89
|
-
}
|
|
90
|
-
}, _callee);
|
|
91
|
-
})), {
|
|
92
|
-
manual: true
|
|
93
|
-
}),
|
|
94
|
-
mediaList = _useRequest.data,
|
|
95
|
-
fetchMediaList = _useRequest.run;
|
|
96
|
-
|
|
97
|
-
// 上传文件
|
|
98
|
-
var _useRequest2 = useRequest( /*#__PURE__*/function () {
|
|
99
|
-
var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(file) {
|
|
100
|
-
var formData, _yield$request$getReq2, data;
|
|
101
|
-
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
102
|
-
while (1) switch (_context2.prev = _context2.next) {
|
|
103
|
-
case 0:
|
|
104
|
-
formData = new FormData();
|
|
105
|
-
formData.append('file', file);
|
|
106
|
-
formData.append('group_id', '0');
|
|
107
|
-
_context2.next = 5;
|
|
108
|
-
return request.getRequest().post(mediaUploadUrl || '/api/media:upload', formData, {
|
|
109
|
-
headers: _objectSpread(_objectSpread({}, getHeaders === null || getHeaders === void 0 ? void 0 : getHeaders()), {}, {
|
|
110
|
-
'Content-Type': 'multipart/form-data'
|
|
111
|
-
})
|
|
112
|
-
});
|
|
113
|
-
case 5:
|
|
114
|
-
_yield$request$getReq2 = _context2.sent;
|
|
115
|
-
data = _yield$request$getReq2.data;
|
|
116
|
-
return _context2.abrupt("return", data);
|
|
117
|
-
case 8:
|
|
118
|
-
case "end":
|
|
119
|
-
return _context2.stop();
|
|
120
|
-
}
|
|
121
|
-
}, _callee2);
|
|
122
|
-
}));
|
|
123
|
-
return function (_x) {
|
|
124
|
-
return _ref3.apply(this, arguments);
|
|
125
|
-
};
|
|
126
|
-
}(), {
|
|
127
|
-
manual: true,
|
|
128
|
-
onSuccess: function onSuccess(result) {
|
|
129
|
-
message.success('上傳成功');
|
|
130
|
-
fetchMediaList();
|
|
131
|
-
},
|
|
132
|
-
onError: function onError() {
|
|
133
|
-
message.error('上傳失敗');
|
|
134
|
-
}
|
|
135
|
-
}),
|
|
136
|
-
uploadFile = _useRequest2.run;
|
|
137
|
-
|
|
138
|
-
// 处理文件上传
|
|
139
|
-
var handleUpload = useCallback( /*#__PURE__*/function () {
|
|
140
|
-
var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(file) {
|
|
141
|
-
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
142
|
-
while (1) switch (_context3.prev = _context3.next) {
|
|
143
|
-
case 0:
|
|
144
|
-
if (!(file.size > 10 * 1024 * 1024)) {
|
|
145
|
-
_context3.next = 3;
|
|
146
|
-
break;
|
|
147
|
-
}
|
|
148
|
-
message.error('文件大小不能超過10MB');
|
|
149
|
-
return _context3.abrupt("return", false);
|
|
150
|
-
case 3:
|
|
151
|
-
setUploading(true);
|
|
152
|
-
_context3.prev = 4;
|
|
153
|
-
_context3.next = 7;
|
|
154
|
-
return uploadFile(file);
|
|
155
|
-
case 7:
|
|
156
|
-
_context3.prev = 7;
|
|
157
|
-
setUploading(false);
|
|
158
|
-
return _context3.finish(7);
|
|
159
|
-
case 10:
|
|
160
|
-
return _context3.abrupt("return", false);
|
|
161
|
-
case 11:
|
|
162
|
-
case "end":
|
|
163
|
-
return _context3.stop();
|
|
164
|
-
}
|
|
165
|
-
}, _callee3, null, [[4,, 7, 10]]);
|
|
166
|
-
}));
|
|
167
|
-
return function (_x2) {
|
|
168
|
-
return _ref4.apply(this, arguments);
|
|
169
|
-
};
|
|
170
|
-
}(), [uploadFile]);
|
|
171
|
-
|
|
172
|
-
// 打开媒体库模态框
|
|
173
|
-
var showModal = useCallback(function () {
|
|
174
|
-
if (__designMode === 'design') {
|
|
175
|
-
return;
|
|
176
|
-
}
|
|
177
|
-
setIsModalVisible(true);
|
|
178
|
-
fetchMediaList();
|
|
179
|
-
}, [__designMode, fetchMediaList]);
|
|
180
|
-
|
|
181
|
-
// 关闭媒体库模态框
|
|
182
|
-
var handleCancel = useCallback(function () {
|
|
183
|
-
setIsModalVisible(false);
|
|
184
|
-
setSelectedItems([]);
|
|
185
|
-
}, []);
|
|
186
|
-
|
|
187
|
-
// 选择媒体文件
|
|
188
|
-
var handleSelect = useCallback(function (item) {
|
|
189
|
-
if (multiple) {
|
|
190
|
-
var isSelected = selectedItems.find(function (selected) {
|
|
191
|
-
return selected.id === item.id;
|
|
192
|
-
});
|
|
193
|
-
if (isSelected) {
|
|
194
|
-
setSelectedItems(selectedItems.filter(function (selected) {
|
|
195
|
-
return selected.id !== item.id;
|
|
196
|
-
}));
|
|
197
|
-
} else {
|
|
198
|
-
if (selectedItems.length >= maxCount) {
|
|
199
|
-
message.warning("\u6700\u591A\u53EA\u80FD\u9078\u64C7".concat(maxCount, "\u500B\u6587\u4EF6"));
|
|
200
|
-
return;
|
|
201
|
-
}
|
|
202
|
-
setSelectedItems([].concat(_toConsumableArray(selectedItems), [item]));
|
|
203
|
-
}
|
|
204
|
-
} else {
|
|
205
|
-
setSelectedItems([item]);
|
|
206
|
-
}
|
|
207
|
-
}, [multiple, selectedItems, maxCount]);
|
|
208
|
-
|
|
209
|
-
// 确认选择
|
|
210
|
-
var handleOk = useCallback(function () {
|
|
211
|
-
if (selectedItems.length === 0) {
|
|
212
|
-
message.warning('請選擇媒體文件');
|
|
213
|
-
return;
|
|
214
|
-
}
|
|
215
|
-
var urls = selectedItems.map(function (item) {
|
|
216
|
-
return item.url;
|
|
217
|
-
});
|
|
218
|
-
var result = multiple ? urls : urls[0];
|
|
219
|
-
onChange === null || onChange === void 0 || onChange(result);
|
|
220
|
-
setIsModalVisible(false);
|
|
221
|
-
setSelectedItems([]);
|
|
222
|
-
}, [selectedItems, multiple, onChange]);
|
|
223
|
-
|
|
224
|
-
// 渲染当前选中的文件
|
|
225
|
-
var renderCurrentFiles = useMemo(function () {
|
|
226
|
-
if (!value) return null;
|
|
227
|
-
var files = Array.isArray(value) ? value : [value];
|
|
228
|
-
if (listType === 'picture-card') {
|
|
229
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
230
|
-
className: "pisell-media-current-files"
|
|
231
|
-
}, files.map(function (url, index) {
|
|
232
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
233
|
-
key: index,
|
|
234
|
-
className: "pisell-media-file-item"
|
|
235
|
-
}, /*#__PURE__*/React.createElement(Image, {
|
|
236
|
-
src: url,
|
|
237
|
-
alt: "file-".concat(index),
|
|
238
|
-
width: 80,
|
|
239
|
-
height: 80,
|
|
240
|
-
style: {
|
|
241
|
-
objectFit: 'cover'
|
|
242
|
-
}
|
|
243
|
-
}), /*#__PURE__*/React.createElement("div", {
|
|
244
|
-
className: "pisell-media-file-actions"
|
|
245
|
-
}, /*#__PURE__*/React.createElement(Button, {
|
|
246
|
-
type: "text",
|
|
247
|
-
size: "small",
|
|
248
|
-
onClick: function onClick() {
|
|
249
|
-
var newFiles = files.filter(function (_, i) {
|
|
250
|
-
return i !== index;
|
|
251
|
-
});
|
|
252
|
-
onChange === null || onChange === void 0 || onChange(multiple ? newFiles : newFiles[0] || '');
|
|
253
|
-
}
|
|
254
|
-
}, "\u522A\u9664")));
|
|
255
|
-
}));
|
|
256
|
-
}
|
|
257
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
258
|
-
className: "pisell-media-current-files"
|
|
259
|
-
}, files.map(function (url, index) {
|
|
260
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
261
|
-
key: index,
|
|
262
|
-
className: "pisell-media-file-item"
|
|
263
|
-
}, /*#__PURE__*/React.createElement("span", null, url), /*#__PURE__*/React.createElement(Button, {
|
|
264
|
-
type: "text",
|
|
265
|
-
size: "small",
|
|
266
|
-
onClick: function onClick() {
|
|
267
|
-
var newFiles = files.filter(function (_, i) {
|
|
268
|
-
return i !== index;
|
|
269
|
-
});
|
|
270
|
-
onChange === null || onChange === void 0 || onChange(multiple ? newFiles : newFiles[0] || '');
|
|
271
|
-
}
|
|
272
|
-
}, "\u522A\u9664"));
|
|
273
|
-
}));
|
|
274
|
-
}, [value, listType, multiple, onChange]);
|
|
275
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
276
|
-
ref: ref,
|
|
277
|
-
className: "pisell-media ".concat(className || ''),
|
|
278
|
-
style: style
|
|
279
|
-
}, /*#__PURE__*/React.createElement(Button, {
|
|
280
|
-
type: "dashed",
|
|
281
|
-
icon: /*#__PURE__*/React.createElement(PictureOutlined, null),
|
|
282
|
-
onClick: showModal,
|
|
283
|
-
disabled: disabled,
|
|
284
|
-
style: {
|
|
285
|
-
width: '100%',
|
|
286
|
-
height: listType === 'picture-card' ? 80 : 32
|
|
287
|
-
}
|
|
288
|
-
}, placeholder), showUploadList && renderCurrentFiles, /*#__PURE__*/React.createElement(Modal, {
|
|
289
|
-
title: "\u5A92\u9AD4\u5EAB",
|
|
290
|
-
open: isModalVisible,
|
|
291
|
-
onCancel: handleCancel,
|
|
292
|
-
onOk: handleOk,
|
|
293
|
-
width: 800,
|
|
294
|
-
okText: "\u78BA\u5B9A",
|
|
295
|
-
cancelText: "\u53D6\u6D88"
|
|
296
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
297
|
-
className: "pisell-media-modal"
|
|
298
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
299
|
-
className: "pisell-media-upload"
|
|
300
|
-
}, /*#__PURE__*/React.createElement(Upload, {
|
|
301
|
-
accept: accept,
|
|
302
|
-
beforeUpload: handleUpload,
|
|
303
|
-
showUploadList: false,
|
|
304
|
-
disabled: uploading
|
|
305
|
-
}, /*#__PURE__*/React.createElement(Button, {
|
|
306
|
-
icon: /*#__PURE__*/React.createElement(PlusOutlined, null),
|
|
307
|
-
loading: uploading
|
|
308
|
-
}, "\u4E0A\u50B3\u6587\u4EF6"))), /*#__PURE__*/React.createElement("div", {
|
|
309
|
-
className: "pisell-media-list"
|
|
310
|
-
}, mediaList === null || mediaList === void 0 ? void 0 : mediaList.map(function (item) {
|
|
311
|
-
var isSelected = selectedItems.find(function (selected) {
|
|
312
|
-
return selected.id === item.id;
|
|
313
|
-
});
|
|
314
|
-
return /*#__PURE__*/React.createElement("button", {
|
|
315
|
-
key: item.id,
|
|
316
|
-
className: "pisell-media-item ".concat(isSelected ? 'selected' : ''),
|
|
317
|
-
onClick: function onClick() {
|
|
318
|
-
return handleSelect(item);
|
|
319
|
-
},
|
|
320
|
-
type: "button"
|
|
321
|
-
}, /*#__PURE__*/React.createElement(Image, {
|
|
322
|
-
src: item.url,
|
|
323
|
-
alt: item.name,
|
|
324
|
-
width: 80,
|
|
325
|
-
height: 80,
|
|
326
|
-
style: {
|
|
327
|
-
objectFit: 'cover'
|
|
328
|
-
}
|
|
329
|
-
}), /*#__PURE__*/React.createElement("div", {
|
|
330
|
-
className: "pisell-media-item-info"
|
|
331
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
332
|
-
className: "pisell-media-item-name"
|
|
333
|
-
}, item.name), /*#__PURE__*/React.createElement("div", {
|
|
334
|
-
className: "pisell-media-item-size"
|
|
335
|
-
}, (item.size / 1024 / 1024).toFixed(2), " MB")));
|
|
336
|
-
})), selectedItems.length > 0 && /*#__PURE__*/React.createElement("div", {
|
|
337
|
-
className: "pisell-media-selected"
|
|
338
|
-
}, "\u5DF2\u9078\u64C7 ", selectedItems.length, " \u500B\u6587\u4EF6"))));
|
|
339
|
-
});
|
|
340
|
-
export default Media;
|