@pisell/materials 1.0.852 → 1.0.853
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/render/default/view.js +1 -1
- package/build/lowcode/view.js +1 -1
- package/es/components/dataSourceComponents/dataSourceForm/formItem.d.ts +1 -0
- package/es/components/dataSourceComponents/dataSourceTable/filter/utils.d.ts +1 -0
- package/es/components/dataSourceComponents/dataSourceTable/hooks/useDataSourceKey.d.ts +1 -0
- package/es/components/dataSourceComponents/dataSourceTable/hooks/useTableQuery.d.ts +33 -0
- package/es/components/dataSourceComponents/fields/DatePicker/ReadPretty.d.ts +5 -0
- package/es/components/dataSourceComponents/fields/Input.Json/ReadPretty.d.ts +1 -0
- package/es/components/dataSourceComponents/fields/Input.Password/ReadPretty.d.ts +1 -0
- package/es/components/dataSourceComponents/fields/Input.Subdomain/index.d.ts +1 -1
- package/es/components/dataSourceComponents/fields/Select/index.d.ts +1 -1
- package/es/components/dataSourceComponents/fields/Upload/ReadPretty.d.ts +1 -0
- package/es/components/dataSourceComponents/fields/Upload/utils.d.ts +1 -1
- package/es/components/dataSourceComponents/fields/index.d.ts +10 -10
- package/es/components/dataSourceComponents/fields/utils.d.ts +3 -0
- package/es/components/date-picker/datePickerCpt.d.ts +9 -0
- package/es/components/filter/index.d.ts +1 -0
- package/es/components/list/index.d.ts +1 -0
- package/es/components/lowCodePage/index.d.ts +1 -0
- package/es/components/media/index.js +340 -0
- package/es/components/media/index.less +100 -0
- package/es/components/pisellAvatar/index.d.ts +19 -0
- package/es/components/pisellCardList/index.d.ts +73 -0
- package/es/components/pisellCheckboxGroup/index.d.ts +36 -0
- package/es/components/pisellCustomCheckboxGroup/index.d.ts +16 -0
- package/es/components/pisellGoodPassCard/index.d.ts +49 -0
- package/es/components/pisellInformationEntry/hooks/useNativeScanner.d.ts +4 -0
- package/es/components/pisellInformationEntry/index.d.ts +33 -0
- package/es/components/pisellInput/components/Copy/index.d.ts +1 -0
- package/es/components/pisellLoading/index.d.ts +1 -0
- package/es/components/pisellText/components/Amount/index.d.ts +20 -0
- package/es/components/pisellWalletPassCard/index.d.ts +85 -0
- package/es/components/productCard/components/Header/EditButton/index.d.ts +4 -0
- package/es/components/productCard/components/Header/index.d.ts +4 -0
- package/es/components/productCard/components/MultiDay/index.d.ts +4 -0
- package/es/components/productCard/components/Note/index.d.ts +1 -0
- package/es/components/productCard/components/Packages/components/options/index.d.ts +1 -0
- package/es/components/productCard/components/Packages/index.d.ts +1 -0
- package/es/components/productCard/components/Packages/utils.d.ts +1 -1
- package/es/components/productCard/components/Sales/index.d.ts +4 -0
- package/es/components/productCard/components/Time/components/Like/index.d.ts +10 -0
- package/es/components/productCard/components/Time/components/SelectHolderModal/index.d.ts +14 -0
- package/es/components/productCard/components/Time/components/SelectHolderMultiple/index.d.ts +3 -0
- package/es/components/productCard/components/Warning/index.js +4 -4
- package/es/components/productCard/index.js +3 -3
- package/es/components/productCard/status.js +1 -1
- package/es/components/productCard/utils.d.ts +31 -0
- package/es/components/qrcode/index.d.ts +1 -0
- package/es/components/table/BasicTable/index.d.ts +1 -0
- package/es/components/table/Gallery/components/GalleryItem/components/RenderFields/index.d.ts +1 -0
- package/es/components/table/Table/fields/date/Show/index.d.ts +1 -0
- package/es/components/table/Table/fields/link/Show/index.d.ts +1 -0
- package/es/components/table/Table/fields/select/index.d.ts +1 -0
- package/es/components/table/Table/fields/treeSelect/index.d.ts +1 -0
- package/es/components/table/Table/tableConfig/SortRow/index.d.ts +1 -0
- package/es/components/table/View/index.d.ts +1 -0
- package/es/components/walletCard/Guide/index.d.ts +4 -0
- package/es/utils/platform.d.ts +1 -1
- package/lib/components/dataSourceComponents/dataSourceForm/formItem.d.ts +1 -0
- package/lib/components/dataSourceComponents/dataSourceTable/filter/utils.d.ts +1 -0
- package/lib/components/dataSourceComponents/dataSourceTable/hooks/useDataSourceKey.d.ts +1 -0
- package/lib/components/dataSourceComponents/dataSourceTable/hooks/useTableQuery.d.ts +33 -0
- package/lib/components/dataSourceComponents/fields/DatePicker/ReadPretty.d.ts +5 -0
- package/lib/components/dataSourceComponents/fields/Input.Json/ReadPretty.d.ts +1 -0
- package/lib/components/dataSourceComponents/fields/Input.Password/ReadPretty.d.ts +1 -0
- package/lib/components/dataSourceComponents/fields/Input.Subdomain/index.d.ts +1 -1
- package/lib/components/dataSourceComponents/fields/Select/index.d.ts +1 -1
- package/lib/components/dataSourceComponents/fields/Upload/ReadPretty.d.ts +1 -0
- package/lib/components/dataSourceComponents/fields/Upload/utils.d.ts +1 -1
- package/lib/components/dataSourceComponents/fields/index.d.ts +10 -10
- package/lib/components/dataSourceComponents/fields/utils.d.ts +3 -0
- package/lib/components/date-picker/datePickerCpt.d.ts +9 -0
- package/lib/components/filter/index.d.ts +1 -0
- package/lib/components/list/index.d.ts +1 -0
- package/lib/components/lowCodePage/index.d.ts +1 -0
- package/lib/components/media/index.js +265 -0
- package/lib/components/media/index.less +100 -0
- package/lib/components/pisellAvatar/index.d.ts +19 -0
- package/lib/components/pisellCardList/index.d.ts +73 -0
- package/lib/components/pisellCheckboxGroup/index.d.ts +36 -0
- package/lib/components/pisellCustomCheckboxGroup/index.d.ts +16 -0
- package/lib/components/pisellGoodPassCard/index.d.ts +49 -0
- package/lib/components/pisellInformationEntry/hooks/useNativeScanner.d.ts +4 -0
- package/lib/components/pisellInformationEntry/index.d.ts +33 -0
- package/lib/components/pisellInput/components/Copy/index.d.ts +1 -0
- package/lib/components/pisellLoading/index.d.ts +1 -0
- package/lib/components/pisellText/components/Amount/index.d.ts +20 -0
- package/lib/components/pisellWalletPassCard/index.d.ts +85 -0
- package/lib/components/productCard/components/Header/EditButton/index.d.ts +4 -0
- package/lib/components/productCard/components/Header/index.d.ts +4 -0
- package/lib/components/productCard/components/MultiDay/index.d.ts +4 -0
- package/lib/components/productCard/components/Note/index.d.ts +1 -0
- package/lib/components/productCard/components/Packages/components/options/index.d.ts +1 -0
- package/lib/components/productCard/components/Packages/index.d.ts +1 -0
- package/lib/components/productCard/components/Packages/utils.d.ts +1 -1
- package/lib/components/productCard/components/Sales/index.d.ts +4 -0
- package/lib/components/productCard/components/Time/components/Like/index.d.ts +10 -0
- package/lib/components/productCard/components/Time/components/SelectHolderModal/index.d.ts +14 -0
- package/lib/components/productCard/components/Time/components/SelectHolderMultiple/index.d.ts +3 -0
- package/lib/components/productCard/components/Warning/index.js +4 -4
- package/lib/components/productCard/index.js +2 -2
- package/lib/components/productCard/status.js +1 -1
- package/lib/components/productCard/utils.d.ts +31 -0
- package/lib/components/qrcode/index.d.ts +1 -0
- package/lib/components/table/BasicTable/index.d.ts +1 -0
- package/lib/components/table/Gallery/components/GalleryItem/components/RenderFields/index.d.ts +1 -0
- package/lib/components/table/Table/fields/date/Show/index.d.ts +1 -0
- package/lib/components/table/Table/fields/link/Show/index.d.ts +1 -0
- package/lib/components/table/Table/fields/select/index.d.ts +1 -0
- package/lib/components/table/Table/fields/treeSelect/index.d.ts +1 -0
- package/lib/components/table/Table/tableConfig/SortRow/index.d.ts +1 -0
- package/lib/components/table/View/index.d.ts +1 -0
- package/lib/components/walletCard/Guide/index.d.ts +4 -0
- package/lib/utils/platform.d.ts +1 -1
- package/package.json +3 -3
package/es/utils/platform.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const isMobile: () =>
|
|
1
|
+
export declare const isMobile: () => any;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { DataSourceTableProps } from '../type';
|
|
3
|
+
declare type Params = {
|
|
4
|
+
pagination?: {
|
|
5
|
+
page: number;
|
|
6
|
+
size: number;
|
|
7
|
+
};
|
|
8
|
+
order_by?: string;
|
|
9
|
+
tabs?: {
|
|
10
|
+
name: string;
|
|
11
|
+
filterBy: Record<string, any>;
|
|
12
|
+
sortBy: string;
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
declare const useTableQuery: (props: DataSourceTableProps) => {
|
|
16
|
+
queryPageConfig: {
|
|
17
|
+
page: number;
|
|
18
|
+
pageSize: number;
|
|
19
|
+
filter: Record<string, any>;
|
|
20
|
+
sort: string;
|
|
21
|
+
};
|
|
22
|
+
setQueryPageConfig: import("react").Dispatch<import("react").SetStateAction<{
|
|
23
|
+
page: number;
|
|
24
|
+
pageSize: number;
|
|
25
|
+
filter: Record<string, any>;
|
|
26
|
+
sort: string;
|
|
27
|
+
}>>;
|
|
28
|
+
handleValuesChange: (params: Params, allParams: Params) => void;
|
|
29
|
+
refreshData: () => void;
|
|
30
|
+
handleFilterChange: (changedFields: any, allFields: any) => void;
|
|
31
|
+
refreshCurrentPage: () => void;
|
|
32
|
+
};
|
|
33
|
+
export default useTableQuery;
|
|
@@ -2,7 +2,7 @@ import React from 'react';
|
|
|
2
2
|
declare const Subdomain: React.FC<import("antd").InputProps & {
|
|
3
3
|
onChange: (value: string) => void;
|
|
4
4
|
onBlur?: ((e: React.FocusEvent<HTMLInputElement, Element>) => void) | undefined;
|
|
5
|
-
rootDomain: "custom" | "
|
|
5
|
+
rootDomain: "custom" | "saas" | "xzero";
|
|
6
6
|
customDomain?: string | undefined;
|
|
7
7
|
value?: string | undefined;
|
|
8
8
|
tenantId: string;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
declare const SelectWithDataSource: (props: import("antd").SelectProps<any, import("antd/es/select").DefaultOptionType> & import("../../dataSourceForm/utils").WithModeProps & import("../../dataSourceForm/utils").WithFormItemProps & {
|
|
3
3
|
options?: any;
|
|
4
|
-
optionSourceType?: "
|
|
4
|
+
optionSourceType?: "custom" | "default" | "api" | undefined;
|
|
5
5
|
labelField: string;
|
|
6
6
|
valueField: string;
|
|
7
7
|
extraParams?: Record<string, any> | undefined;
|
|
@@ -15,4 +15,4 @@ export declare const getFileMetadataParams: (file: RcFile & {
|
|
|
15
15
|
metadata?: MediaMetadata;
|
|
16
16
|
}) => Record<string, any>;
|
|
17
17
|
export declare const isValueEqual: (value: any, fileListValue: any) => boolean;
|
|
18
|
-
export declare const getBaseTime: (size: number) =>
|
|
18
|
+
export declare const getBaseTime: (size: number) => 2000 | 1000 | 4000 | 8000;
|
|
@@ -20,7 +20,7 @@ declare const formFieldMap: {
|
|
|
20
20
|
Subdomain: import("react").FC<import("antd").InputProps & {
|
|
21
21
|
onChange: (value: string) => void;
|
|
22
22
|
onBlur?: ((e: import("react").FocusEvent<HTMLInputElement, Element>) => void) | undefined;
|
|
23
|
-
rootDomain: "custom" | "
|
|
23
|
+
rootDomain: "custom" | "saas" | "xzero";
|
|
24
24
|
customDomain?: string | undefined;
|
|
25
25
|
value?: string | undefined;
|
|
26
26
|
tenantId: string;
|
|
@@ -35,7 +35,7 @@ declare const formFieldMap: {
|
|
|
35
35
|
};
|
|
36
36
|
FormItemSelect: (props: import("antd").SelectProps<any, import("antd/es/select").DefaultOptionType> & import("../dataSourceForm/utils").WithModeProps & import("../dataSourceForm/utils").WithFormItemProps & {
|
|
37
37
|
options?: any;
|
|
38
|
-
optionSourceType?: "
|
|
38
|
+
optionSourceType?: "custom" | "default" | "api" | undefined;
|
|
39
39
|
labelField: string;
|
|
40
40
|
valueField: string;
|
|
41
41
|
extraParams?: Record<string, any> | undefined;
|
|
@@ -60,11 +60,13 @@ declare const formFieldMap: {
|
|
|
60
60
|
FormItemTranslation: import("react").FC<import("./Translation/type").TranslationProps & import("../dataSourceForm/utils").WithModeProps & import("../dataSourceForm/utils").WithFormItemProps>;
|
|
61
61
|
FormItemIconSelect: import("react").FC<import("./IconSelect/type").IconSelectProps & import("../dataSourceForm/utils").WithModeProps & import("../dataSourceForm/utils").WithFormItemProps>;
|
|
62
62
|
};
|
|
63
|
-
declare const getFieldComponent: (fieldComponent: string) => (import("react").FC<{}> & {
|
|
63
|
+
declare const getFieldComponent: (fieldComponent: string) => import("react").FC<any> | import("react").FC<import("./Input.Phone/WithMode").PhoneInputProps & import("../dataSourceForm/utils").WithModeProps & import("../dataSourceForm/utils").WithFormItemProps> | import("react").FC<import("./Input.Mobile/WithMode").PhoneInputProps & import("../dataSourceForm/utils").WithModeProps & import("../dataSourceForm/utils").WithFormItemProps> | import("react").FC<import("./Checkbox/type").CheckboxGroupProps & import("../dataSourceForm/utils").WithModeProps> | (import("react").FC<{}> & {
|
|
64
64
|
Group: import("react").FC<import("./Checkbox/type").CheckboxGroupProps & import("../dataSourceForm/utils").WithModeProps>;
|
|
65
65
|
} & {
|
|
66
66
|
Group: import("react").FC<import("./Checkbox/type").CheckboxGroupProps & import("../dataSourceForm/utils").WithModeProps>;
|
|
67
|
-
}) | import("react").FC<import("./ColorPicker/type").ColorPickerProps & import("../dataSourceForm/utils").WithModeProps & import("../dataSourceForm/utils").WithFormItemProps> | import("react").FC<(import("antd").DatePickerProps & import("../dataSourceForm/utils").WithModeProps) & import("../dataSourceForm/utils").WithFormItemProps> |
|
|
67
|
+
}) | import("react").FC<import("./ColorPicker/type").ColorPickerProps & import("../dataSourceForm/utils").WithModeProps & import("../dataSourceForm/utils").WithFormItemProps> | import("react").FC<(import("antd").DatePickerProps & import("../dataSourceForm/utils").WithModeProps) & import("../dataSourceForm/utils").WithFormItemProps> | import("react").FC<import("antd/es/input").PasswordProps & import("react").RefAttributes<import("antd").InputRef> & import("../dataSourceForm/utils").WithModeProps & import("../dataSourceForm/utils").WithFormItemProps> | import("react").FC<import("antd").InputProps & import("react").RefAttributes<import("antd").InputRef> & import("../dataSourceForm/utils").WithModeProps & import("../dataSourceForm/utils").WithFormItemProps> | import("react").FC<import("antd").InputProps & {
|
|
68
|
+
onChange: (value: string) => void;
|
|
69
|
+
} & import("../dataSourceForm/utils").WithModeProps & import("../dataSourceForm/utils").WithFormItemProps> | (import("react").FC<import("./Input/type").InputProps> & {
|
|
68
70
|
JSON: import("react").FC<any>;
|
|
69
71
|
Password: import("react").FC<import("antd/es/input").PasswordProps & import("react").RefAttributes<import("antd").InputRef> & import("../dataSourceForm/utils").WithModeProps & import("../dataSourceForm/utils").WithFormItemProps>;
|
|
70
72
|
TextArea: import("react").FC<import("antd/es/input").TextAreaProps & import("react").RefAttributes<import("antd/es/input/TextArea").TextAreaRef> & import("../dataSourceForm/utils").WithModeProps & import("../dataSourceForm/utils").WithFormItemProps>;
|
|
@@ -77,26 +79,24 @@ declare const getFieldComponent: (fieldComponent: string) => (import("react").FC
|
|
|
77
79
|
Subdomain: import("react").FC<import("antd").InputProps & {
|
|
78
80
|
onChange: (value: string) => void;
|
|
79
81
|
onBlur?: ((e: import("react").FocusEvent<HTMLInputElement, Element>) => void) | undefined;
|
|
80
|
-
rootDomain: "custom" | "
|
|
82
|
+
rootDomain: "custom" | "saas" | "xzero";
|
|
81
83
|
customDomain?: string | undefined;
|
|
82
84
|
value?: string | undefined;
|
|
83
85
|
tenantId: string;
|
|
84
86
|
name?: string | undefined;
|
|
85
87
|
fieldKey?: string | undefined;
|
|
86
88
|
} & import("../dataSourceForm/utils").WithModeProps & import("../dataSourceForm/utils").WithFormItemProps>;
|
|
87
|
-
}) | (import("react").FC<{}> & {
|
|
89
|
+
}) | import("react").FC<import("./Radio/type").RadioGroupProps & import("../dataSourceForm/utils").WithModeProps> | (import("react").FC<{}> & {
|
|
88
90
|
Group: import("react").FC<import("./Radio/type").RadioGroupProps & import("../dataSourceForm/utils").WithModeProps>;
|
|
89
91
|
} & {
|
|
90
92
|
Group: import("react").FC<import("./Radio/type").RadioGroupProps & import("../dataSourceForm/utils").WithModeProps>;
|
|
91
93
|
}) | ((props: import("antd").SelectProps<any, import("antd/es/select").DefaultOptionType> & import("../dataSourceForm/utils").WithModeProps & import("../dataSourceForm/utils").WithFormItemProps & {
|
|
92
94
|
options?: any;
|
|
93
|
-
optionSourceType?: "
|
|
95
|
+
optionSourceType?: "custom" | "default" | "api" | undefined;
|
|
94
96
|
labelField: string;
|
|
95
97
|
valueField: string;
|
|
96
98
|
extraParams?: Record<string, any> | undefined;
|
|
97
99
|
} & {
|
|
98
100
|
dataSource?: any;
|
|
99
|
-
}) => JSX.Element) | import("react").FC<
|
|
100
|
-
onChange: (value: string) => void;
|
|
101
|
-
} & import("../dataSourceForm/utils").WithModeProps & import("../dataSourceForm/utils").WithFormItemProps> | import("react").FC<import("antd").InputProps & import("react").RefAttributes<import("antd").InputRef> & import("../dataSourceForm/utils").WithModeProps & import("../dataSourceForm/utils").WithFormItemProps> | import("react").FC<import("antd/es/input").PasswordProps & import("react").RefAttributes<import("antd").InputRef> & import("../dataSourceForm/utils").WithModeProps & import("../dataSourceForm/utils").WithFormItemProps> | import("react").FC<import("./Radio/type").RadioGroupProps & import("../dataSourceForm/utils").WithModeProps> | import("react").FC<import("./Checkbox/type").CheckboxGroupProps & import("../dataSourceForm/utils").WithModeProps> | import("react").FC<import("./DateRangePicker/type").DateRangePickerProps & import("../dataSourceForm/utils").WithModeProps & import("../dataSourceForm/utils").WithFormItemProps> | import("react").FC<import("./Upload/type").UploadProps & import("../dataSourceForm/utils").WithModeProps & import("../dataSourceForm/utils").WithFormItemProps> | import("react").FC<import("./Translation/type").TranslationProps & import("../dataSourceForm/utils").WithModeProps & import("../dataSourceForm/utils").WithFormItemProps> | import("react").FC<import("./IconSelect/type").IconSelectProps & import("../dataSourceForm/utils").WithModeProps & import("../dataSourceForm/utils").WithFormItemProps>;
|
|
101
|
+
}) => JSX.Element) | import("react").FC<import("./TimePicker/type").TimePickerProps & import("../dataSourceForm/utils").WithModeProps & import("../dataSourceForm/utils").WithFormItemProps> | import("react").FC<import("./DateRangePicker/type").DateRangePickerProps & import("../dataSourceForm/utils").WithModeProps & import("../dataSourceForm/utils").WithFormItemProps> | import("react").FC<import("./Upload/type").UploadProps & import("../dataSourceForm/utils").WithModeProps & import("../dataSourceForm/utils").WithFormItemProps> | import("react").FC<import("./Translation/type").TranslationProps & import("../dataSourceForm/utils").WithModeProps & import("../dataSourceForm/utils").WithFormItemProps> | import("react").FC<import("./IconSelect/type").IconSelectProps & import("../dataSourceForm/utils").WithModeProps & import("../dataSourceForm/utils").WithFormItemProps>;
|
|
102
102
|
export { getFieldComponent, formFieldMap };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { PickerDateProps } from 'antd/es/date-picker/generatePicker';
|
|
3
|
+
import { Dayjs } from 'dayjs';
|
|
4
|
+
import './index.less';
|
|
5
|
+
interface DatePickerCptProps extends PickerDateProps<Dayjs> {
|
|
6
|
+
showTime: any;
|
|
7
|
+
}
|
|
8
|
+
declare const DatePickerCpt: (props: DatePickerCptProps) => JSX.Element;
|
|
9
|
+
export default DatePickerCpt;
|
|
@@ -0,0 +1,265 @@
|
|
|
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/media/index.tsx
|
|
30
|
+
var media_exports = {};
|
|
31
|
+
__export(media_exports, {
|
|
32
|
+
default: () => media_default
|
|
33
|
+
});
|
|
34
|
+
module.exports = __toCommonJS(media_exports);
|
|
35
|
+
var import_react = __toESM(require("react"));
|
|
36
|
+
var import_antd = require("antd");
|
|
37
|
+
var import_icons = require("@ant-design/icons");
|
|
38
|
+
var import_ahooks = require("ahooks");
|
|
39
|
+
var import_utils = require("../table/utils");
|
|
40
|
+
var import_useEngineContext = __toESM(require("../../hooks/useEngineContext"));
|
|
41
|
+
var import_index = require("./index.less");
|
|
42
|
+
var Media = (0, import_react.forwardRef)((props, ref) => {
|
|
43
|
+
const {
|
|
44
|
+
__designMode,
|
|
45
|
+
value,
|
|
46
|
+
onChange,
|
|
47
|
+
multiple = false,
|
|
48
|
+
maxCount = 10,
|
|
49
|
+
accept = "image/*,video/*,audio/*",
|
|
50
|
+
disabled = false,
|
|
51
|
+
className,
|
|
52
|
+
style,
|
|
53
|
+
placeholder = "選擇媒體文件",
|
|
54
|
+
showUploadList = true,
|
|
55
|
+
listType = "picture-card"
|
|
56
|
+
} = props;
|
|
57
|
+
const [isModalVisible, setIsModalVisible] = (0, import_react.useState)(false);
|
|
58
|
+
const [selectedItems, setSelectedItems] = (0, import_react.useState)([]);
|
|
59
|
+
const [uploading, setUploading] = (0, import_react.useState)(false);
|
|
60
|
+
const { appHelper } = (0, import_useEngineContext.default)();
|
|
61
|
+
const { mediaUploadUrl, getHeaders } = (appHelper == null ? void 0 : appHelper.constants) || {};
|
|
62
|
+
const { data: mediaList, run: fetchMediaList } = (0, import_ahooks.useRequest)(
|
|
63
|
+
async () => {
|
|
64
|
+
const { data } = await import_utils.request.getRequest().get(
|
|
65
|
+
`/media:list`,
|
|
66
|
+
{
|
|
67
|
+
page: 1,
|
|
68
|
+
pageSize: 100
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
isNocobase: true,
|
|
72
|
+
fullResult: true,
|
|
73
|
+
headers: {
|
|
74
|
+
"x-data-source": "pisell2"
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
);
|
|
78
|
+
return (data == null ? void 0 : data.data) || [];
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
manual: true
|
|
82
|
+
}
|
|
83
|
+
);
|
|
84
|
+
const { run: uploadFile } = (0, import_ahooks.useRequest)(
|
|
85
|
+
async (file) => {
|
|
86
|
+
const formData = new FormData();
|
|
87
|
+
formData.append("file", file);
|
|
88
|
+
formData.append("group_id", "0");
|
|
89
|
+
const { data } = await import_utils.request.getRequest().post(mediaUploadUrl || "/api/media:upload", formData, {
|
|
90
|
+
headers: {
|
|
91
|
+
...getHeaders == null ? void 0 : getHeaders(),
|
|
92
|
+
"Content-Type": "multipart/form-data"
|
|
93
|
+
}
|
|
94
|
+
});
|
|
95
|
+
return data;
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
manual: true,
|
|
99
|
+
onSuccess: (result) => {
|
|
100
|
+
import_antd.message.success("上傳成功");
|
|
101
|
+
fetchMediaList();
|
|
102
|
+
},
|
|
103
|
+
onError: () => {
|
|
104
|
+
import_antd.message.error("上傳失敗");
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
);
|
|
108
|
+
const handleUpload = (0, import_react.useCallback)(
|
|
109
|
+
async (file) => {
|
|
110
|
+
if (file.size > 10 * 1024 * 1024) {
|
|
111
|
+
import_antd.message.error("文件大小不能超過10MB");
|
|
112
|
+
return false;
|
|
113
|
+
}
|
|
114
|
+
setUploading(true);
|
|
115
|
+
try {
|
|
116
|
+
await uploadFile(file);
|
|
117
|
+
} finally {
|
|
118
|
+
setUploading(false);
|
|
119
|
+
}
|
|
120
|
+
return false;
|
|
121
|
+
},
|
|
122
|
+
[uploadFile]
|
|
123
|
+
);
|
|
124
|
+
const showModal = (0, import_react.useCallback)(() => {
|
|
125
|
+
if (__designMode === "design") {
|
|
126
|
+
return;
|
|
127
|
+
}
|
|
128
|
+
setIsModalVisible(true);
|
|
129
|
+
fetchMediaList();
|
|
130
|
+
}, [__designMode, fetchMediaList]);
|
|
131
|
+
const handleCancel = (0, import_react.useCallback)(() => {
|
|
132
|
+
setIsModalVisible(false);
|
|
133
|
+
setSelectedItems([]);
|
|
134
|
+
}, []);
|
|
135
|
+
const handleSelect = (0, import_react.useCallback)(
|
|
136
|
+
(item) => {
|
|
137
|
+
if (multiple) {
|
|
138
|
+
const isSelected = selectedItems.find(
|
|
139
|
+
(selected) => selected.id === item.id
|
|
140
|
+
);
|
|
141
|
+
if (isSelected) {
|
|
142
|
+
setSelectedItems(
|
|
143
|
+
selectedItems.filter((selected) => selected.id !== item.id)
|
|
144
|
+
);
|
|
145
|
+
} else {
|
|
146
|
+
if (selectedItems.length >= maxCount) {
|
|
147
|
+
import_antd.message.warning(`最多只能選擇${maxCount}個文件`);
|
|
148
|
+
return;
|
|
149
|
+
}
|
|
150
|
+
setSelectedItems([...selectedItems, item]);
|
|
151
|
+
}
|
|
152
|
+
} else {
|
|
153
|
+
setSelectedItems([item]);
|
|
154
|
+
}
|
|
155
|
+
},
|
|
156
|
+
[multiple, selectedItems, maxCount]
|
|
157
|
+
);
|
|
158
|
+
const handleOk = (0, import_react.useCallback)(() => {
|
|
159
|
+
if (selectedItems.length === 0) {
|
|
160
|
+
import_antd.message.warning("請選擇媒體文件");
|
|
161
|
+
return;
|
|
162
|
+
}
|
|
163
|
+
const urls = selectedItems.map((item) => item.url);
|
|
164
|
+
const result = multiple ? urls : urls[0];
|
|
165
|
+
onChange == null ? void 0 : onChange(result);
|
|
166
|
+
setIsModalVisible(false);
|
|
167
|
+
setSelectedItems([]);
|
|
168
|
+
}, [selectedItems, multiple, onChange]);
|
|
169
|
+
const renderCurrentFiles = (0, import_react.useMemo)(() => {
|
|
170
|
+
if (!value) return null;
|
|
171
|
+
const files = Array.isArray(value) ? value : [value];
|
|
172
|
+
if (listType === "picture-card") {
|
|
173
|
+
return /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-media-current-files" }, files.map((url, index) => /* @__PURE__ */ import_react.default.createElement("div", { key: index, className: "pisell-media-file-item" }, /* @__PURE__ */ import_react.default.createElement(
|
|
174
|
+
import_antd.Image,
|
|
175
|
+
{
|
|
176
|
+
src: url,
|
|
177
|
+
alt: `file-${index}`,
|
|
178
|
+
width: 80,
|
|
179
|
+
height: 80,
|
|
180
|
+
style: { objectFit: "cover" }
|
|
181
|
+
}
|
|
182
|
+
), /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-media-file-actions" }, /* @__PURE__ */ import_react.default.createElement(
|
|
183
|
+
import_antd.Button,
|
|
184
|
+
{
|
|
185
|
+
type: "text",
|
|
186
|
+
size: "small",
|
|
187
|
+
onClick: () => {
|
|
188
|
+
const newFiles = files.filter((_, i) => i !== index);
|
|
189
|
+
onChange == null ? void 0 : onChange(multiple ? newFiles : newFiles[0] || "");
|
|
190
|
+
}
|
|
191
|
+
},
|
|
192
|
+
"刪除"
|
|
193
|
+
)))));
|
|
194
|
+
}
|
|
195
|
+
return /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-media-current-files" }, files.map((url, index) => /* @__PURE__ */ import_react.default.createElement("div", { key: index, className: "pisell-media-file-item" }, /* @__PURE__ */ import_react.default.createElement("span", null, url), /* @__PURE__ */ import_react.default.createElement(
|
|
196
|
+
import_antd.Button,
|
|
197
|
+
{
|
|
198
|
+
type: "text",
|
|
199
|
+
size: "small",
|
|
200
|
+
onClick: () => {
|
|
201
|
+
const newFiles = files.filter((_, i) => i !== index);
|
|
202
|
+
onChange == null ? void 0 : onChange(multiple ? newFiles : newFiles[0] || "");
|
|
203
|
+
}
|
|
204
|
+
},
|
|
205
|
+
"刪除"
|
|
206
|
+
))));
|
|
207
|
+
}, [value, listType, multiple, onChange]);
|
|
208
|
+
return /* @__PURE__ */ import_react.default.createElement("div", { ref, className: `pisell-media ${className || ""}`, style }, /* @__PURE__ */ import_react.default.createElement(
|
|
209
|
+
import_antd.Button,
|
|
210
|
+
{
|
|
211
|
+
type: "dashed",
|
|
212
|
+
icon: /* @__PURE__ */ import_react.default.createElement(import_icons.PictureOutlined, null),
|
|
213
|
+
onClick: showModal,
|
|
214
|
+
disabled,
|
|
215
|
+
style: { width: "100%", height: listType === "picture-card" ? 80 : 32 }
|
|
216
|
+
},
|
|
217
|
+
placeholder
|
|
218
|
+
), showUploadList && renderCurrentFiles, /* @__PURE__ */ import_react.default.createElement(
|
|
219
|
+
import_antd.Modal,
|
|
220
|
+
{
|
|
221
|
+
title: "媒體庫",
|
|
222
|
+
open: isModalVisible,
|
|
223
|
+
onCancel: handleCancel,
|
|
224
|
+
onOk: handleOk,
|
|
225
|
+
width: 800,
|
|
226
|
+
okText: "確定",
|
|
227
|
+
cancelText: "取消"
|
|
228
|
+
},
|
|
229
|
+
/* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-media-modal" }, /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-media-upload" }, /* @__PURE__ */ import_react.default.createElement(
|
|
230
|
+
import_antd.Upload,
|
|
231
|
+
{
|
|
232
|
+
accept,
|
|
233
|
+
beforeUpload: handleUpload,
|
|
234
|
+
showUploadList: false,
|
|
235
|
+
disabled: uploading
|
|
236
|
+
},
|
|
237
|
+
/* @__PURE__ */ import_react.default.createElement(import_antd.Button, { icon: /* @__PURE__ */ import_react.default.createElement(import_icons.PlusOutlined, null), loading: uploading }, "上傳文件")
|
|
238
|
+
)), /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-media-list" }, mediaList == null ? void 0 : mediaList.map((item) => {
|
|
239
|
+
const isSelected = selectedItems.find(
|
|
240
|
+
(selected) => selected.id === item.id
|
|
241
|
+
);
|
|
242
|
+
return /* @__PURE__ */ import_react.default.createElement(
|
|
243
|
+
"button",
|
|
244
|
+
{
|
|
245
|
+
key: item.id,
|
|
246
|
+
className: `pisell-media-item ${isSelected ? "selected" : ""}`,
|
|
247
|
+
onClick: () => handleSelect(item),
|
|
248
|
+
type: "button"
|
|
249
|
+
},
|
|
250
|
+
/* @__PURE__ */ import_react.default.createElement(
|
|
251
|
+
import_antd.Image,
|
|
252
|
+
{
|
|
253
|
+
src: item.url,
|
|
254
|
+
alt: item.name,
|
|
255
|
+
width: 80,
|
|
256
|
+
height: 80,
|
|
257
|
+
style: { objectFit: "cover" }
|
|
258
|
+
}
|
|
259
|
+
),
|
|
260
|
+
/* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-media-item-info" }, /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-media-item-name" }, item.name), /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-media-item-size" }, (item.size / 1024 / 1024).toFixed(2), " MB"))
|
|
261
|
+
);
|
|
262
|
+
})), selectedItems.length > 0 && /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-media-selected" }, "已選擇 ", selectedItems.length, " 個文件"))
|
|
263
|
+
));
|
|
264
|
+
});
|
|
265
|
+
var media_default = Media;
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
.pisell-media {
|
|
2
|
+
.pisell-media-current-files {
|
|
3
|
+
margin-top: 8px;
|
|
4
|
+
display: flex;
|
|
5
|
+
flex-wrap: wrap;
|
|
6
|
+
gap: 8px;
|
|
7
|
+
|
|
8
|
+
.pisell-media-file-item {
|
|
9
|
+
position: relative;
|
|
10
|
+
border: 1px solid #d9d9d9;
|
|
11
|
+
border-radius: 6px;
|
|
12
|
+
padding: 4px;
|
|
13
|
+
display: flex;
|
|
14
|
+
align-items: center;
|
|
15
|
+
gap: 8px;
|
|
16
|
+
|
|
17
|
+
.pisell-media-file-actions {
|
|
18
|
+
position: absolute;
|
|
19
|
+
top: 4px;
|
|
20
|
+
right: 4px;
|
|
21
|
+
opacity: 0;
|
|
22
|
+
transition: opacity 0.2s;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
&:hover .pisell-media-file-actions {
|
|
26
|
+
opacity: 1;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.pisell-media-modal {
|
|
32
|
+
.pisell-media-upload {
|
|
33
|
+
margin-bottom: 16px;
|
|
34
|
+
padding-bottom: 16px;
|
|
35
|
+
border-bottom: 1px solid #f0f0f0;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
.pisell-media-list {
|
|
39
|
+
display: grid;
|
|
40
|
+
grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
|
|
41
|
+
gap: 12px;
|
|
42
|
+
max-height: 400px;
|
|
43
|
+
overflow-y: auto;
|
|
44
|
+
|
|
45
|
+
.pisell-media-item {
|
|
46
|
+
border: 2px solid transparent;
|
|
47
|
+
border-radius: 8px;
|
|
48
|
+
padding: 8px;
|
|
49
|
+
cursor: pointer;
|
|
50
|
+
background: #fafafa;
|
|
51
|
+
transition: all 0.2s;
|
|
52
|
+
display: flex;
|
|
53
|
+
flex-direction: column;
|
|
54
|
+
align-items: center;
|
|
55
|
+
text-align: center;
|
|
56
|
+
min-height: 120px;
|
|
57
|
+
|
|
58
|
+
&:hover {
|
|
59
|
+
border-color: #1890ff;
|
|
60
|
+
background: #f0f8ff;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
&.selected {
|
|
64
|
+
border-color: #1890ff;
|
|
65
|
+
background: #e6f7ff;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
.pisell-media-item-info {
|
|
69
|
+
margin-top: 8px;
|
|
70
|
+
width: 100%;
|
|
71
|
+
|
|
72
|
+
.pisell-media-item-name {
|
|
73
|
+
font-size: 12px;
|
|
74
|
+
color: #333;
|
|
75
|
+
margin-bottom: 4px;
|
|
76
|
+
overflow: hidden;
|
|
77
|
+
text-overflow: ellipsis;
|
|
78
|
+
white-space: nowrap;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
.pisell-media-item-size {
|
|
82
|
+
font-size: 10px;
|
|
83
|
+
color: #999;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
.pisell-media-selected {
|
|
90
|
+
margin-top: 16px;
|
|
91
|
+
padding: 8px 12px;
|
|
92
|
+
background: #f6ffed;
|
|
93
|
+
border: 1px solid #b7eb8f;
|
|
94
|
+
border-radius: 6px;
|
|
95
|
+
color: #52c41a;
|
|
96
|
+
font-size: 14px;
|
|
97
|
+
text-align: center;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { AvatarProps } from 'antd';
|
|
3
|
+
import './index.less';
|
|
4
|
+
export declare type AvatarSize = 'xs' | 'sm' | 'md' | 'lg' | 'xl' | 'xxl';
|
|
5
|
+
export interface PisellAvatarProps extends Omit<AvatarProps, 'size' | 'shape'> {
|
|
6
|
+
shape?: 'circle' | 'square';
|
|
7
|
+
size?: AvatarSize;
|
|
8
|
+
src?: string;
|
|
9
|
+
alt?: string;
|
|
10
|
+
icon?: React.ReactNode;
|
|
11
|
+
children?: React.ReactNode;
|
|
12
|
+
className?: string;
|
|
13
|
+
style?: React.CSSProperties;
|
|
14
|
+
useTextAvatar?: boolean;
|
|
15
|
+
borderRadius?: number;
|
|
16
|
+
onError?: () => boolean;
|
|
17
|
+
}
|
|
18
|
+
declare const PisellAvatar: React.FC<PisellAvatarProps>;
|
|
19
|
+
export default PisellAvatar;
|