@pisell/materials 1.0.498 → 1.0.500
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 +5 -5
- package/build/lowcode/preview.js +8 -8
- package/build/lowcode/render/default/view.css +1 -1
- package/build/lowcode/render/default/view.js +22 -22
- package/build/lowcode/view.css +1 -1
- package/build/lowcode/view.js +21 -21
- package/es/components/dataSourceComponents/dataSourceForm/style.less +9 -0
- package/es/components/dataSourceComponents/dataSourceForm/submitButton/index.d.ts +1 -0
- package/es/components/dataSourceComponents/dataSourceForm/submitButton/index.js +13 -10
- package/es/components/dataSourceComponents/dataSourceForm/type.d.ts +1 -1
- package/es/components/dataSourceComponents/dataSourceForm/utils.d.ts +1 -1
- package/es/components/dataSourceComponents/dataSourceForm/utils.js +16 -11
- package/es/components/dataSourceComponents/dataSourceTable/BaseTable.js +7 -3
- package/es/components/dataSourceComponents/dataSourceTable/filter/utils.js +2 -1
- package/es/components/dataSourceComponents/dataSourceTable/hooks/useColumns.js +1 -1
- package/es/components/dataSourceComponents/dataSourceTable/hooks/useTableProps.d.ts +1 -0
- package/es/components/dataSourceComponents/dataSourceTable/hooks/useTableProps.js +11 -2
- package/es/components/dataSourceComponents/fields/Checkbox/ReadPretty.js +3 -2
- package/es/components/dataSourceComponents/fields/DatePicker/ReadPretty.js +6 -2
- package/es/components/dataSourceComponents/fields/DatePicker/ReadPretty.less +5 -0
- package/es/components/dataSourceComponents/fields/DateRangePicker/ReadPretty.js +6 -2
- package/es/components/dataSourceComponents/fields/DateRangePicker/ReadPretty.less +5 -0
- package/es/components/dataSourceComponents/fields/Input/ReadPretty.js +7 -2
- package/es/components/dataSourceComponents/fields/Input/ReadPretty.less +5 -0
- package/es/components/dataSourceComponents/fields/Input.Email/ReadPretty.js +7 -2
- package/es/components/dataSourceComponents/fields/Input.Email/ReadPretty.less +5 -0
- package/es/components/dataSourceComponents/fields/Input.Password/ReadPretty.js +11 -5
- package/es/components/dataSourceComponents/fields/Input.Password/ReadPretty.less +5 -0
- package/es/components/dataSourceComponents/fields/Input.Phone/ReadPretty.d.ts +1 -1
- package/es/components/dataSourceComponents/fields/Input.Phone/ReadPretty.js +11 -4
- package/es/components/dataSourceComponents/fields/Input.Phone/ReadPretty.less +5 -0
- package/es/components/dataSourceComponents/fields/Input.Phone/WithMode.d.ts +2 -0
- package/es/components/dataSourceComponents/fields/Input.Phone/WithMode.js +3 -7
- package/es/components/dataSourceComponents/fields/Input.TextArea/ReadPretty.js +7 -2
- package/es/components/dataSourceComponents/fields/Input.TextArea/ReadPretty.less +5 -0
- package/es/components/dataSourceComponents/fields/Input.Url/ReadPretty.js +8 -3
- package/es/components/dataSourceComponents/fields/Input.Url/ReadPretty.less +5 -0
- package/es/components/dataSourceComponents/fields/InputNumber/ReadPretty.js +9 -4
- package/es/components/dataSourceComponents/fields/InputNumber/ReadPretty.less +5 -0
- package/es/components/dataSourceComponents/fields/Radio/ReadPretty.js +3 -2
- package/es/components/dataSourceComponents/fields/Select/ReadPretty.js +3 -2
- package/es/components/dataSourceComponents/fields/TimePicker/ReadPretty.js +6 -2
- package/es/components/dataSourceComponents/fields/TimePicker/ReadPretty.less +5 -0
- package/es/components/dataSourceComponents/fields/Translation/BaseTranslation.d.ts +5 -0
- package/es/components/dataSourceComponents/fields/Translation/BaseTranslation.js +103 -0
- package/es/components/dataSourceComponents/fields/Translation/ReadPretty.d.ts +5 -0
- package/es/components/dataSourceComponents/fields/Translation/ReadPretty.js +13 -0
- package/es/components/dataSourceComponents/fields/Translation/ReadPretty.less +11 -0
- package/es/components/dataSourceComponents/fields/Translation/WithMode.d.ts +4 -0
- package/es/components/dataSourceComponents/fields/Translation/WithMode.js +5 -0
- package/es/components/dataSourceComponents/fields/Translation/index.d.ts +3 -0
- package/es/components/dataSourceComponents/fields/Translation/index.js +4 -0
- package/es/components/dataSourceComponents/fields/Translation/index.less +61 -0
- package/es/components/dataSourceComponents/fields/Translation/type.d.ts +15 -0
- package/es/components/dataSourceComponents/fields/Translation/type.js +1 -0
- package/es/components/dataSourceComponents/fields/Upload/BaseUpload.d.ts +1 -1
- package/es/components/dataSourceComponents/fields/Upload/BaseUpload.js +377 -235
- package/es/components/dataSourceComponents/fields/Upload/ReadPretty.d.ts +1 -1
- package/es/components/dataSourceComponents/fields/Upload/ReadPretty.js +35 -11
- package/es/components/dataSourceComponents/fields/Upload/constants.d.ts +9 -0
- package/es/components/dataSourceComponents/fields/Upload/constants.js +9 -0
- package/es/components/dataSourceComponents/fields/Upload/index.less +56 -0
- package/es/components/dataSourceComponents/fields/Upload/type.d.ts +12 -11
- package/es/components/dataSourceComponents/fields/Upload/types.d.ts +48 -0
- package/es/components/dataSourceComponents/fields/Upload/types.js +1 -0
- package/es/components/dataSourceComponents/fields/Upload/utils.d.ts +13 -13
- package/es/components/dataSourceComponents/fields/Upload/utils.js +240 -215
- package/es/components/dataSourceComponents/fields/index.d.ts +4 -2
- package/es/components/dataSourceComponents/fields/index.js +4 -1
- package/es/hooks/useTranslationOriginal.d.ts +2 -0
- package/es/hooks/useTranslationOriginal.js +9 -0
- package/es/index.d.ts +1 -0
- package/es/index.js +1 -0
- package/es/locales/en-US.d.ts +6 -0
- package/es/locales/en-US.js +12 -2
- package/es/locales/zh-CN.d.ts +6 -0
- package/es/locales/zh-CN.js +7 -1
- package/es/locales/zh-TW.d.ts +6 -0
- package/es/locales/zh-TW.js +7 -1
- package/lib/components/dataSourceComponents/dataSourceForm/style.less +9 -0
- package/lib/components/dataSourceComponents/dataSourceForm/submitButton/index.d.ts +1 -0
- package/lib/components/dataSourceComponents/dataSourceForm/submitButton/index.js +6 -3
- package/lib/components/dataSourceComponents/dataSourceForm/type.d.ts +1 -1
- package/lib/components/dataSourceComponents/dataSourceForm/utils.d.ts +1 -1
- package/lib/components/dataSourceComponents/dataSourceForm/utils.js +11 -9
- package/lib/components/dataSourceComponents/dataSourceTable/BaseTable.js +4 -1
- package/lib/components/dataSourceComponents/dataSourceTable/filter/utils.js +2 -1
- package/lib/components/dataSourceComponents/dataSourceTable/hooks/useColumns.js +1 -1
- package/lib/components/dataSourceComponents/dataSourceTable/hooks/useTableProps.d.ts +1 -0
- package/lib/components/dataSourceComponents/dataSourceTable/hooks/useTableProps.js +10 -1
- package/lib/components/dataSourceComponents/fields/Checkbox/ReadPretty.js +2 -2
- package/lib/components/dataSourceComponents/fields/DatePicker/ReadPretty.js +11 -2
- package/lib/components/dataSourceComponents/fields/DatePicker/ReadPretty.less +5 -0
- package/lib/components/dataSourceComponents/fields/DateRangePicker/ReadPretty.js +11 -2
- package/lib/components/dataSourceComponents/fields/DateRangePicker/ReadPretty.less +5 -0
- package/lib/components/dataSourceComponents/fields/Input/ReadPretty.js +11 -1
- package/lib/components/dataSourceComponents/fields/Input/ReadPretty.less +5 -0
- package/lib/components/dataSourceComponents/fields/Input.Email/ReadPretty.js +11 -1
- package/lib/components/dataSourceComponents/fields/Input.Email/ReadPretty.less +5 -0
- package/lib/components/dataSourceComponents/fields/Input.Password/ReadPretty.js +9 -4
- package/lib/components/dataSourceComponents/fields/Input.Password/ReadPretty.less +5 -0
- package/lib/components/dataSourceComponents/fields/Input.Phone/ReadPretty.d.ts +1 -1
- package/lib/components/dataSourceComponents/fields/Input.Phone/ReadPretty.js +11 -4
- package/lib/components/dataSourceComponents/fields/Input.Phone/ReadPretty.less +5 -0
- package/lib/components/dataSourceComponents/fields/Input.Phone/WithMode.d.ts +2 -0
- package/lib/components/dataSourceComponents/fields/Input.Phone/WithMode.js +6 -8
- package/lib/components/dataSourceComponents/fields/Input.TextArea/ReadPretty.js +11 -1
- package/lib/components/dataSourceComponents/fields/Input.TextArea/ReadPretty.less +5 -0
- package/lib/components/dataSourceComponents/fields/Input.Url/ReadPretty.js +12 -1
- package/lib/components/dataSourceComponents/fields/Input.Url/ReadPretty.less +5 -0
- package/lib/components/dataSourceComponents/fields/InputNumber/ReadPretty.js +9 -4
- package/lib/components/dataSourceComponents/fields/InputNumber/ReadPretty.less +5 -0
- package/lib/components/dataSourceComponents/fields/Radio/ReadPretty.js +2 -2
- package/lib/components/dataSourceComponents/fields/Select/ReadPretty.js +2 -2
- package/lib/components/dataSourceComponents/fields/TimePicker/ReadPretty.js +11 -2
- package/lib/components/dataSourceComponents/fields/TimePicker/ReadPretty.less +5 -0
- package/lib/components/dataSourceComponents/fields/Translation/BaseTranslation.d.ts +5 -0
- package/lib/components/dataSourceComponents/fields/Translation/BaseTranslation.js +107 -0
- package/lib/components/dataSourceComponents/fields/Translation/ReadPretty.d.ts +5 -0
- package/lib/components/dataSourceComponents/fields/Translation/ReadPretty.js +50 -0
- package/lib/components/dataSourceComponents/fields/Translation/ReadPretty.less +11 -0
- package/lib/components/dataSourceComponents/fields/Translation/WithMode.d.ts +4 -0
- package/lib/components/dataSourceComponents/fields/Translation/WithMode.js +39 -0
- package/lib/components/dataSourceComponents/fields/Translation/index.d.ts +3 -0
- package/lib/components/dataSourceComponents/fields/Translation/index.js +38 -0
- package/lib/components/dataSourceComponents/fields/Translation/index.less +61 -0
- package/lib/components/dataSourceComponents/fields/Translation/type.d.ts +15 -0
- package/lib/components/dataSourceComponents/fields/Translation/type.js +17 -0
- package/lib/components/dataSourceComponents/fields/Upload/BaseUpload.d.ts +1 -1
- package/lib/components/dataSourceComponents/fields/Upload/BaseUpload.js +384 -247
- package/lib/components/dataSourceComponents/fields/Upload/ReadPretty.d.ts +1 -1
- package/lib/components/dataSourceComponents/fields/Upload/ReadPretty.js +24 -4
- package/lib/components/dataSourceComponents/fields/Upload/constants.d.ts +9 -0
- package/lib/components/dataSourceComponents/fields/Upload/constants.js +47 -0
- package/lib/components/dataSourceComponents/fields/Upload/index.less +56 -0
- package/lib/components/dataSourceComponents/fields/Upload/type.d.ts +12 -11
- package/lib/components/dataSourceComponents/fields/Upload/types.d.ts +48 -0
- package/lib/components/dataSourceComponents/fields/Upload/types.js +17 -0
- package/lib/components/dataSourceComponents/fields/Upload/utils.d.ts +13 -13
- package/lib/components/dataSourceComponents/fields/Upload/utils.js +207 -254
- package/lib/components/dataSourceComponents/fields/index.d.ts +4 -2
- package/lib/components/dataSourceComponents/fields/index.js +4 -1
- package/lib/hooks/useTranslationOriginal.d.ts +2 -0
- package/lib/hooks/useTranslationOriginal.js +41 -0
- package/lib/index.d.ts +1 -0
- package/lib/index.js +3 -0
- package/lib/locales/en-US.d.ts +6 -0
- package/lib/locales/en-US.js +8 -1
- package/lib/locales/zh-CN.d.ts +6 -0
- package/lib/locales/zh-CN.js +7 -1
- package/lib/locales/zh-TW.d.ts +6 -0
- package/lib/locales/zh-TW.js +7 -1
- package/lowcode/data-source-form/constants.ts +1 -0
- package/lowcode/data-source-form/utils.ts +16 -4
- package/lowcode/data-source-table/utils.tsx +2 -2
- package/lowcode/form-item-translation/meta.ts +249 -0
- package/lowcode/form-item-translation/snippets.ts +13 -0
- package/lowcode/form-item-upload/meta.ts +11 -0
- package/lowcode/submit-button/meta.ts +10 -0
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { UploadProps } from './type';
|
|
3
3
|
import './ReadPretty.less';
|
|
4
|
-
declare const UploadReadPretty: (props: UploadProps) => React.JSX.Element | null;
|
|
4
|
+
declare const UploadReadPretty: (props: UploadProps) => React.JSX.Element[] | null;
|
|
5
5
|
export default UploadReadPretty;
|
|
@@ -34,17 +34,37 @@ __export(ReadPretty_exports, {
|
|
|
34
34
|
module.exports = __toCommonJS(ReadPretty_exports);
|
|
35
35
|
var import_react = __toESM(require("react"));
|
|
36
36
|
var import_antd = require("antd");
|
|
37
|
+
var import_utils = require("@pisell/utils");
|
|
38
|
+
var import_useTranslationOriginal = __toESM(require("../../../../hooks/useTranslationOriginal"));
|
|
37
39
|
var import_fallback = __toESM(require("./fallback.png"));
|
|
38
40
|
var import_ReadPretty = require("./ReadPretty.less");
|
|
39
41
|
var UploadReadPretty = (props) => {
|
|
40
|
-
|
|
42
|
+
const { value, enableMultilingual } = props;
|
|
43
|
+
const translationOriginal = (0, import_useTranslationOriginal.default)();
|
|
44
|
+
const normalizedValue = (0, import_react.useMemo)(() => {
|
|
45
|
+
if (!value)
|
|
46
|
+
return [];
|
|
47
|
+
let processedValue = (0, import_utils.isArr)(value) ? value : [value];
|
|
48
|
+
processedValue = processedValue.map((item) => {
|
|
49
|
+
if (!item) {
|
|
50
|
+
return null;
|
|
51
|
+
}
|
|
52
|
+
if ((0, import_utils.isString)(item)) {
|
|
53
|
+
return item;
|
|
54
|
+
}
|
|
55
|
+
return translationOriginal(item);
|
|
56
|
+
});
|
|
57
|
+
return processedValue.filter((item) => !!item);
|
|
58
|
+
}, [value, enableMultilingual, translationOriginal]);
|
|
59
|
+
if (!normalizedValue.length) {
|
|
41
60
|
return null;
|
|
42
61
|
}
|
|
43
|
-
return /* @__PURE__ */ import_react.default.createElement(
|
|
62
|
+
return normalizedValue.map((item, index) => /* @__PURE__ */ import_react.default.createElement(
|
|
44
63
|
import_antd.Image,
|
|
45
64
|
{
|
|
65
|
+
key: `${String(item)}-${index}`,
|
|
46
66
|
className: "pisell-upload-read-pretty",
|
|
47
|
-
src:
|
|
67
|
+
src: String(item),
|
|
48
68
|
width: 100,
|
|
49
69
|
height: 100,
|
|
50
70
|
fallback: import_fallback.default,
|
|
@@ -52,6 +72,6 @@ var UploadReadPretty = (props) => {
|
|
|
52
72
|
maskClassName: "pisell-upload-read-pretty-mask"
|
|
53
73
|
}
|
|
54
74
|
}
|
|
55
|
-
);
|
|
75
|
+
));
|
|
56
76
|
};
|
|
57
77
|
var ReadPretty_default = UploadReadPretty;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export declare const SUPPORTED_LANGUAGES: readonly ["original", "en", "zh-CN", "zh-HK"];
|
|
2
|
+
export declare const DEFAULT_MAX_COUNT = 9;
|
|
3
|
+
export declare const DEFAULT_UID = "-1";
|
|
4
|
+
export declare const MEDIA_TYPES: {
|
|
5
|
+
readonly VIDEO: "video/";
|
|
6
|
+
readonly AUDIO: "audio/";
|
|
7
|
+
};
|
|
8
|
+
export declare const IMAGE_QUALITY = 0.8;
|
|
9
|
+
export declare const IMAGE_TYPE = "image/jpeg";
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
|
|
19
|
+
// src/components/dataSourceComponents/fields/Upload/constants.ts
|
|
20
|
+
var constants_exports = {};
|
|
21
|
+
__export(constants_exports, {
|
|
22
|
+
DEFAULT_MAX_COUNT: () => DEFAULT_MAX_COUNT,
|
|
23
|
+
DEFAULT_UID: () => DEFAULT_UID,
|
|
24
|
+
IMAGE_QUALITY: () => IMAGE_QUALITY,
|
|
25
|
+
IMAGE_TYPE: () => IMAGE_TYPE,
|
|
26
|
+
MEDIA_TYPES: () => MEDIA_TYPES,
|
|
27
|
+
SUPPORTED_LANGUAGES: () => SUPPORTED_LANGUAGES
|
|
28
|
+
});
|
|
29
|
+
module.exports = __toCommonJS(constants_exports);
|
|
30
|
+
var SUPPORTED_LANGUAGES = ["original", "en", "zh-CN", "zh-HK"];
|
|
31
|
+
var DEFAULT_MAX_COUNT = 9;
|
|
32
|
+
var DEFAULT_UID = "-1";
|
|
33
|
+
var MEDIA_TYPES = {
|
|
34
|
+
VIDEO: "video/",
|
|
35
|
+
AUDIO: "audio/"
|
|
36
|
+
};
|
|
37
|
+
var IMAGE_QUALITY = 0.8;
|
|
38
|
+
var IMAGE_TYPE = "image/jpeg";
|
|
39
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
40
|
+
0 && (module.exports = {
|
|
41
|
+
DEFAULT_MAX_COUNT,
|
|
42
|
+
DEFAULT_UID,
|
|
43
|
+
IMAGE_QUALITY,
|
|
44
|
+
IMAGE_TYPE,
|
|
45
|
+
MEDIA_TYPES,
|
|
46
|
+
SUPPORTED_LANGUAGES
|
|
47
|
+
});
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
.pisell-lowcode-upload {
|
|
2
|
+
position: relative;
|
|
3
|
+
}
|
|
1
4
|
.pisell-upload-button {
|
|
2
5
|
border: 0;
|
|
3
6
|
background: none;
|
|
@@ -7,6 +10,18 @@
|
|
|
7
10
|
margin-top: 8px;
|
|
8
11
|
}
|
|
9
12
|
|
|
13
|
+
.pisell-upload-globe-icon {
|
|
14
|
+
position: absolute;
|
|
15
|
+
right: 6px;
|
|
16
|
+
bottom: 6px;
|
|
17
|
+
cursor: pointer;
|
|
18
|
+
color: #98A2B3;
|
|
19
|
+
font-size: 20px;
|
|
20
|
+
&:hover {
|
|
21
|
+
transition: color 0.3s;
|
|
22
|
+
color: var(--theme-color);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
10
25
|
// &[disabled] {
|
|
11
26
|
// opacity: 0.4;
|
|
12
27
|
// }
|
|
@@ -19,4 +34,45 @@
|
|
|
19
34
|
}
|
|
20
35
|
}
|
|
21
36
|
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
.pisell-upload-multilingual-container {
|
|
40
|
+
padding: 24px 0;
|
|
41
|
+
|
|
42
|
+
.pisell-upload-multilingual-item {
|
|
43
|
+
margin-bottom: 24px;
|
|
44
|
+
&-title {
|
|
45
|
+
font-size: 14px;
|
|
46
|
+
font-weight: 500;
|
|
47
|
+
color: #344054;
|
|
48
|
+
margin-bottom: 8px;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
&-content {
|
|
52
|
+
.ant-upload-wrapper {
|
|
53
|
+
.ant-upload-list {
|
|
54
|
+
.ant-upload-list-item-container {
|
|
55
|
+
width: 100px;
|
|
56
|
+
height: 100px;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
.ant-upload.ant-upload-select {
|
|
60
|
+
width: 100px;
|
|
61
|
+
height: 100px;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
.pisell-upload-multilingual-icon {
|
|
69
|
+
color: #fff;
|
|
70
|
+
font-size: 16px;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
.pisell-lowcode-image-preview-wrap {
|
|
74
|
+
z-index: 1201 !important;
|
|
75
|
+
}
|
|
76
|
+
.pisell-lowcode-image-preview-mask {
|
|
77
|
+
z-index: 1201 !important;
|
|
22
78
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { UploadFile as AntdUploadFile } from 'antd/es/upload/interface';
|
|
2
|
-
import {
|
|
2
|
+
import type { UploadValue, UploadChangeHandler } from './types';
|
|
3
3
|
export interface UploadFile extends AntdUploadFile {
|
|
4
4
|
metadata?: {
|
|
5
5
|
width?: number;
|
|
@@ -8,19 +8,20 @@ export interface UploadFile extends AntdUploadFile {
|
|
|
8
8
|
bitrate?: number;
|
|
9
9
|
};
|
|
10
10
|
}
|
|
11
|
-
export interface UploadProps
|
|
12
|
-
renderMode?:
|
|
13
|
-
|
|
14
|
-
allowMediaLibrary?: boolean;
|
|
15
|
-
allowLocalUpload?: boolean;
|
|
16
|
-
allowPreview?: boolean;
|
|
17
|
-
maxSize: number;
|
|
11
|
+
export interface UploadProps {
|
|
12
|
+
renderMode?: string;
|
|
13
|
+
maxSize?: number;
|
|
18
14
|
minCount?: number;
|
|
19
15
|
maxCount?: number;
|
|
16
|
+
multiple?: boolean;
|
|
17
|
+
presetType?: string[];
|
|
18
|
+
customType?: string[];
|
|
20
19
|
enablePresetType?: boolean;
|
|
21
|
-
presetType?: (number | string)[];
|
|
22
20
|
enableCustomType?: boolean;
|
|
23
|
-
|
|
24
|
-
|
|
21
|
+
allowPreview?: boolean;
|
|
22
|
+
value?: UploadValue;
|
|
25
23
|
typeMaxSizeMap?: Record<string, number>;
|
|
24
|
+
enableMultilingual?: boolean;
|
|
25
|
+
onChange?: UploadChangeHandler;
|
|
26
|
+
disabled?: boolean;
|
|
26
27
|
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import type { UploadFile } from 'antd/es/upload/interface';
|
|
2
|
+
import { SUPPORTED_LANGUAGES } from './constants';
|
|
3
|
+
export declare type Language = typeof SUPPORTED_LANGUAGES[number];
|
|
4
|
+
export interface MediaMetadata {
|
|
5
|
+
width?: number;
|
|
6
|
+
height?: number;
|
|
7
|
+
duration?: number;
|
|
8
|
+
bitrate?: number;
|
|
9
|
+
cover?: File;
|
|
10
|
+
}
|
|
11
|
+
export interface FileCountValidation {
|
|
12
|
+
multiple: boolean;
|
|
13
|
+
minCount: number;
|
|
14
|
+
maxCount: number;
|
|
15
|
+
valueLength: number;
|
|
16
|
+
}
|
|
17
|
+
export interface ValidationResult {
|
|
18
|
+
success: boolean;
|
|
19
|
+
message?: string;
|
|
20
|
+
}
|
|
21
|
+
export interface MultilingualFile extends UploadFile {
|
|
22
|
+
multilingual?: SingleMultilingualValue;
|
|
23
|
+
multilingualFileList?: Record<Language, UploadFile[]>;
|
|
24
|
+
response?: {
|
|
25
|
+
status: boolean;
|
|
26
|
+
data: {
|
|
27
|
+
url: string;
|
|
28
|
+
};
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
export interface FileListOptions {
|
|
32
|
+
enableMultilingual: boolean;
|
|
33
|
+
multiple: boolean;
|
|
34
|
+
}
|
|
35
|
+
export declare type SingleUploadValue = string;
|
|
36
|
+
export declare type MultipleUploadValue = string[];
|
|
37
|
+
export declare type SingleMultilingualValue = Record<Language, string>;
|
|
38
|
+
export declare type MultipleMultilingualValue = SingleMultilingualValue[];
|
|
39
|
+
export declare type UploadValue = SingleUploadValue | MultipleUploadValue | SingleMultilingualValue | MultipleMultilingualValue;
|
|
40
|
+
export interface MultilingualUploadResponse {
|
|
41
|
+
status: boolean;
|
|
42
|
+
data: {
|
|
43
|
+
url: string;
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
export declare type UploadChangeHandler = (value: UploadValue) => void;
|
|
47
|
+
export declare type NonNullMultilingualValue = NonNullable<SingleMultilingualValue>;
|
|
48
|
+
export declare type NonNullMultilingualArray = NonNullMultilingualValue[];
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __copyProps = (to, from, except, desc) => {
|
|
6
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
7
|
+
for (let key of __getOwnPropNames(from))
|
|
8
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
9
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
10
|
+
}
|
|
11
|
+
return to;
|
|
12
|
+
};
|
|
13
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
14
|
+
|
|
15
|
+
// src/components/dataSourceComponents/fields/Upload/types.ts
|
|
16
|
+
var types_exports = {};
|
|
17
|
+
module.exports = __toCommonJS(types_exports);
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
+
import { RcFile, UploadFile } from 'antd/es/upload/interface';
|
|
2
|
+
import type { MediaMetadata, FileCountValidation, ValidationResult, MultilingualFile, FileListOptions, UploadValue, SingleMultilingualValue } from './types';
|
|
3
|
+
export declare const generateUid: () => string;
|
|
1
4
|
export declare const getSuffix: (name: string) => string;
|
|
2
5
|
export declare const getPointSuffix: (name: string) => string;
|
|
3
6
|
export declare const getFileType: (name: string) => string;
|
|
4
|
-
export declare const
|
|
5
|
-
export declare const checkFileCount: ({ multiple, minCount, maxCount, valueLength, }:
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
}
|
|
14
|
-
success: boolean;
|
|
15
|
-
message?: undefined;
|
|
16
|
-
};
|
|
7
|
+
export declare const getFileName: (url: string) => string;
|
|
8
|
+
export declare const checkFileCount: ({ multiple, minCount, maxCount, valueLength, }: FileCountValidation) => ValidationResult;
|
|
9
|
+
export declare const getMediaMetadata: (file: RcFile) => Promise<MediaMetadata | null>;
|
|
10
|
+
export declare const genFileListByString: (value: string) => UploadFile[];
|
|
11
|
+
export declare const createMultilingualData: (value: string) => SingleMultilingualValue;
|
|
12
|
+
export declare const createMultilingualFileList: (value: string) => Record<string, UploadFile<any>[]>;
|
|
13
|
+
export declare const getDefaultFileList: (value: UploadValue | undefined, options: FileListOptions) => MultilingualFile[];
|
|
14
|
+
export declare const getFileMetadataParams: (file: RcFile & {
|
|
15
|
+
metadata?: MediaMetadata;
|
|
16
|
+
}) => Record<string, any>;
|